@vtmn/svelte
Advanced tools
Comparing version 0.7.11 to 0.7.12
@@ -401,5 +401,12 @@ (function (global, factory) { | ||
let current; | ||
const default_slot_template = /*#slots*/ ctx[7].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[6], null); | ||
let a_levels = [{ class: /*componentClass*/ ctx[0] }, /*$$restProps*/ ctx[1]]; | ||
const default_slot_template = /*#slots*/ ctx[9].default; | ||
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[8], null); | ||
let a_levels = [ | ||
{ href: /*href*/ ctx[0] }, | ||
{ target: /*target*/ ctx[1] }, | ||
{ class: /*componentClass*/ ctx[2] }, | ||
/*$$restProps*/ ctx[3] | ||
]; | ||
let a_data = {}; | ||
@@ -428,3 +435,3 @@ | ||
if (default_slot) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 64)) { | ||
if (default_slot.p && (!current || dirty & /*$$scope*/ 256)) { | ||
update_slot_base( | ||
@@ -434,6 +441,6 @@ default_slot, | ||
ctx, | ||
/*$$scope*/ ctx[6], | ||
/*$$scope*/ ctx[8], | ||
!current | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[6]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[6], dirty, null), | ||
? get_all_dirty_from_scope(/*$$scope*/ ctx[8]) | ||
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[8], dirty, null), | ||
null | ||
@@ -445,4 +452,6 @@ ); | ||
set_attributes(a, a_data = get_spread_update(a_levels, [ | ||
(!current || dirty & /*componentClass*/ 1) && { class: /*componentClass*/ ctx[0] }, | ||
dirty & /*$$restProps*/ 2 && /*$$restProps*/ ctx[1] | ||
(!current || dirty & /*href*/ 1) && { href: /*href*/ ctx[0] }, | ||
(!current || dirty & /*target*/ 2) && { target: /*target*/ ctx[1] }, | ||
(!current || dirty & /*componentClass*/ 4) && { class: /*componentClass*/ ctx[2] }, | ||
dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3] | ||
])); | ||
@@ -468,5 +477,7 @@ }, | ||
let componentClass; | ||
const omit_props_names = ["size","standalone","iconAlong","class"]; | ||
const omit_props_names = ["href","target","size","standalone","iconAlong","class"]; | ||
let $$restProps = compute_rest_props($$props, omit_props_names); | ||
let { $$slots: slots = {}, $$scope } = $$props; | ||
let { href } = $$props; | ||
let { target } = $$props; | ||
let { size = 'medium' } = $$props; | ||
@@ -479,13 +490,15 @@ let { standalone = false } = $$props; | ||
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); | ||
$$invalidate(1, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
if ('size' in $$new_props) $$invalidate(2, size = $$new_props.size); | ||
if ('standalone' in $$new_props) $$invalidate(3, standalone = $$new_props.standalone); | ||
if ('iconAlong' in $$new_props) $$invalidate(4, iconAlong = $$new_props.iconAlong); | ||
if ('class' in $$new_props) $$invalidate(5, className = $$new_props.class); | ||
if ('$$scope' in $$new_props) $$invalidate(6, $$scope = $$new_props.$$scope); | ||
$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
if ('href' in $$new_props) $$invalidate(0, href = $$new_props.href); | ||
if ('target' in $$new_props) $$invalidate(1, target = $$new_props.target); | ||
if ('size' in $$new_props) $$invalidate(4, size = $$new_props.size); | ||
if ('standalone' in $$new_props) $$invalidate(5, standalone = $$new_props.standalone); | ||
if ('iconAlong' in $$new_props) $$invalidate(6, iconAlong = $$new_props.iconAlong); | ||
if ('class' in $$new_props) $$invalidate(7, className = $$new_props.class); | ||
if ('$$scope' in $$new_props) $$invalidate(8, $$scope = $$new_props.$$scope); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*size, standalone, iconAlong, className*/ 60) { | ||
$$invalidate(0, componentClass = cn('vtmn-link', size && `vtmn-link_size--${size}`, standalone && 'vtmn-link--standalone', standalone && iconAlong && 'vtmn-link--icon-along', className)); | ||
if ($$self.$$.dirty & /*size, standalone, iconAlong, className*/ 240) { | ||
$$invalidate(2, componentClass = cn('vtmn-link', size && `vtmn-link_size--${size}`, standalone && 'vtmn-link--standalone', standalone && iconAlong && 'vtmn-link--icon-along', className)); | ||
} | ||
@@ -495,2 +508,4 @@ }; | ||
return [ | ||
href, | ||
target, | ||
componentClass, | ||
@@ -512,6 +527,8 @@ $$restProps, | ||
init(this, options, instance, create_fragment, safe_not_equal, { | ||
size: 2, | ||
standalone: 3, | ||
iconAlong: 4, | ||
class: 5 | ||
href: 0, | ||
target: 1, | ||
size: 4, | ||
standalone: 5, | ||
iconAlong: 6, | ||
class: 7 | ||
}); | ||
@@ -518,0 +535,0 @@ } |
@@ -110,5 +110,2 @@ (function (global, factory) { | ||
} | ||
function toggle_class(element, name, toggle) { | ||
element.classList[toggle ? 'add' : 'remove'](name); | ||
} | ||
@@ -350,2 +347,13 @@ let current_component; | ||
/** | ||
* @typedef {false|undefined|null|''|0|NaN} FalsyValue | ||
*/ | ||
/** | ||
* Concat all classNames, remove falsy or empty ones. | ||
* @param {(string|FalsyValue)[]} classNames | ||
* @returns {string} | ||
*/ | ||
const cn = (...classNames) => classNames.filter(Boolean).join(' '); | ||
/* src/components/VtmnTextInput.svelte generated by Svelte v3.43.1 */ | ||
@@ -362,3 +370,3 @@ | ||
attr(label, "class", "vtmn-text-input_label"); | ||
attr(label, "for", /*identifier*/ ctx[1]); | ||
attr(label, "for", /*id*/ ctx[1]); | ||
}, | ||
@@ -372,4 +380,4 @@ m(target, anchor) { | ||
if (dirty & /*identifier*/ 2) { | ||
attr(label, "for", /*identifier*/ ctx[1]); | ||
if (dirty & /*id*/ 2) { | ||
attr(label, "for", /*id*/ ctx[1]); | ||
} | ||
@@ -383,3 +391,3 @@ }, | ||
// (81:0) {:else} | ||
// (93:0) {:else} | ||
function create_else_block(ctx) { | ||
@@ -395,5 +403,5 @@ let div; | ||
let input_levels = [ | ||
{ class: "vtmn-text-input" }, | ||
{ class: /*componentClass*/ ctx[9] }, | ||
{ type: "text" }, | ||
{ id: /*identifier*/ ctx[1] }, | ||
{ id: /*id*/ ctx[1] }, | ||
{ disabled: /*disabled*/ ctx[4] }, | ||
@@ -417,5 +425,3 @@ { placeholder: /*placeholder*/ ctx[3] }, | ||
set_attributes(input, input_data); | ||
toggle_class(input, "vtmn-text-input--valid", /*valid*/ ctx[7]); | ||
toggle_class(input, "vtmn-text-input--error", /*error*/ ctx[8]); | ||
attr(span, "class", span_class_value = /*icon*/ ctx[9] && `vtmx-${/*icon*/ ctx[9]}`); | ||
attr(span, "class", span_class_value = /*icon*/ ctx[8] && `vtmx-${/*icon*/ ctx[8]}`); | ||
attr(div, "class", "vtmn-text-input_container"); | ||
@@ -432,3 +438,3 @@ }, | ||
if (!mounted) { | ||
dispose = listen(input, "input", /*input_input_handler*/ ctx[12]); | ||
dispose = listen(input, "input", /*input_input_handler*/ ctx[14]); | ||
mounted = true; | ||
@@ -439,5 +445,5 @@ } | ||
set_attributes(input, input_data = get_spread_update(input_levels, [ | ||
{ class: "vtmn-text-input" }, | ||
dirty & /*componentClass*/ 512 && { class: /*componentClass*/ ctx[9] }, | ||
{ type: "text" }, | ||
dirty & /*identifier*/ 2 && { id: /*identifier*/ ctx[1] }, | ||
dirty & /*id*/ 2 && { id: /*id*/ ctx[1] }, | ||
dirty & /*disabled*/ 16 && { disabled: /*disabled*/ ctx[4] }, | ||
@@ -452,6 +458,3 @@ dirty & /*placeholder*/ 8 && { placeholder: /*placeholder*/ ctx[3] }, | ||
toggle_class(input, "vtmn-text-input--valid", /*valid*/ ctx[7]); | ||
toggle_class(input, "vtmn-text-input--error", /*error*/ ctx[8]); | ||
if (dirty & /*icon*/ 512 && span_class_value !== (span_class_value = /*icon*/ ctx[9] && `vtmx-${/*icon*/ ctx[9]}`)) { | ||
if (dirty & /*icon*/ 256 && span_class_value !== (span_class_value = /*icon*/ ctx[8] && `vtmx-${/*icon*/ ctx[8]}`)) { | ||
attr(span, "class", span_class_value); | ||
@@ -468,3 +471,3 @@ } | ||
// (70:0) {#if multiline} | ||
// (84:0) {#if multiline} | ||
function create_if_block_1(ctx) { | ||
@@ -476,4 +479,4 @@ let textarea; | ||
let textarea_levels = [ | ||
{ class: "vtmn-text-input" }, | ||
{ id: /*identifier*/ ctx[1] }, | ||
{ class: /*componentClass*/ ctx[9] }, | ||
{ id: /*id*/ ctx[1] }, | ||
{ disabled: /*disabled*/ ctx[4] }, | ||
@@ -494,4 +497,2 @@ { placeholder: /*placeholder*/ ctx[3] }, | ||
set_attributes(textarea, textarea_data); | ||
toggle_class(textarea, "vtmn-text-input--error", /*error*/ ctx[8]); | ||
toggle_class(textarea, "vtmn-text-input--valid", /*valid*/ ctx[7]); | ||
}, | ||
@@ -504,3 +505,3 @@ m(target, anchor) { | ||
if (!mounted) { | ||
dispose = listen(textarea, "input", /*textarea_input_handler*/ ctx[11]); | ||
dispose = listen(textarea, "input", /*textarea_input_handler*/ ctx[13]); | ||
mounted = true; | ||
@@ -511,4 +512,4 @@ } | ||
set_attributes(textarea, textarea_data = get_spread_update(textarea_levels, [ | ||
{ class: "vtmn-text-input" }, | ||
dirty & /*identifier*/ 2 && { id: /*identifier*/ ctx[1] }, | ||
dirty & /*componentClass*/ 512 && { class: /*componentClass*/ ctx[9] }, | ||
dirty & /*id*/ 2 && { id: /*id*/ ctx[1] }, | ||
dirty & /*disabled*/ 16 && { disabled: /*disabled*/ ctx[4] }, | ||
@@ -522,5 +523,2 @@ dirty & /*placeholder*/ 8 && { placeholder: /*placeholder*/ ctx[3] }, | ||
} | ||
toggle_class(textarea, "vtmn-text-input--error", /*error*/ ctx[8]); | ||
toggle_class(textarea, "vtmn-text-input--valid", /*valid*/ ctx[7]); | ||
}, | ||
@@ -535,6 +533,7 @@ d(detaching) { | ||
// (97:0) {#if helperText} | ||
// (107:0) {#if helperText} | ||
function create_if_block(ctx) { | ||
let p; | ||
let t; | ||
let p_class_value; | ||
@@ -545,4 +544,3 @@ return { | ||
t = text(/*helperText*/ ctx[5]); | ||
attr(p, "class", "vtmn-text-input_helper-text"); | ||
toggle_class(p, "vtmn-text-input_helper-text--error", /*error*/ ctx[8]); | ||
attr(p, "class", p_class_value = cn('vtmn-text-input_helper-text', /*error*/ ctx[7] && 'vtmn-text-input_helper-text--error')); | ||
}, | ||
@@ -556,4 +554,4 @@ m(target, anchor) { | ||
if (dirty & /*error*/ 256) { | ||
toggle_class(p, "vtmn-text-input_helper-text--error", /*error*/ ctx[8]); | ||
if (dirty & /*error*/ 128 && p_class_value !== (p_class_value = cn('vtmn-text-input_helper-text', /*error*/ ctx[7] && 'vtmn-text-input_helper-text--error'))) { | ||
attr(p, "class", p_class_value); | ||
} | ||
@@ -652,8 +650,10 @@ }, | ||
function instance($$self, $$props, $$invalidate) { | ||
let componentClass; | ||
const omit_props_names = [ | ||
"identifier","labelText","placeholder","disabled","helperText","multiline","valid","error","icon","value" | ||
"id","labelText","placeholder","disabled","helperText","multiline","valid","error","icon","value","class" | ||
]; | ||
let $$restProps = compute_rest_props($$props, omit_props_names); | ||
let { identifier } = $$props; | ||
let { id } = $$props; | ||
let { labelText } = $$props; | ||
@@ -668,2 +668,3 @@ let { placeholder } = $$props; | ||
let { value } = $$props; | ||
let { class: className } = $$props; | ||
@@ -683,3 +684,3 @@ function textarea_input_handler() { | ||
$$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names)); | ||
if ('identifier' in $$new_props) $$invalidate(1, identifier = $$new_props.identifier); | ||
if ('id' in $$new_props) $$invalidate(1, id = $$new_props.id); | ||
if ('labelText' in $$new_props) $$invalidate(2, labelText = $$new_props.labelText); | ||
@@ -690,11 +691,18 @@ if ('placeholder' in $$new_props) $$invalidate(3, placeholder = $$new_props.placeholder); | ||
if ('multiline' in $$new_props) $$invalidate(6, multiline = $$new_props.multiline); | ||
if ('valid' in $$new_props) $$invalidate(7, valid = $$new_props.valid); | ||
if ('error' in $$new_props) $$invalidate(8, error = $$new_props.error); | ||
if ('icon' in $$new_props) $$invalidate(9, icon = $$new_props.icon); | ||
if ('valid' in $$new_props) $$invalidate(11, valid = $$new_props.valid); | ||
if ('error' in $$new_props) $$invalidate(7, error = $$new_props.error); | ||
if ('icon' in $$new_props) $$invalidate(8, icon = $$new_props.icon); | ||
if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value); | ||
if ('class' in $$new_props) $$invalidate(12, className = $$new_props.class); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*valid, error, className*/ 6272) { | ||
$$invalidate(9, componentClass = cn('vtmn-text-input', valid && 'vtmn-text-input--valid', error && 'vtmn-text-input--error', className)); | ||
} | ||
}; | ||
return [ | ||
value, | ||
identifier, | ||
id, | ||
labelText, | ||
@@ -705,6 +713,8 @@ placeholder, | ||
multiline, | ||
valid, | ||
error, | ||
icon, | ||
componentClass, | ||
$$restProps, | ||
valid, | ||
className, | ||
textarea_input_handler, | ||
@@ -720,3 +730,3 @@ input_input_handler | ||
init(this, options, instance, create_fragment, safe_not_equal, { | ||
identifier: 1, | ||
id: 1, | ||
labelText: 2, | ||
@@ -727,6 +737,7 @@ placeholder: 3, | ||
multiline: 6, | ||
valid: 7, | ||
error: 8, | ||
icon: 9, | ||
value: 0 | ||
valid: 11, | ||
error: 7, | ||
icon: 8, | ||
value: 0, | ||
class: 12 | ||
}); | ||
@@ -733,0 +744,0 @@ } |
{ | ||
"name": "@vtmn/svelte", | ||
"version": "0.7.11", | ||
"version": "0.7.12", | ||
"description": "Decathlon Design System - Vitamin Svelte library", | ||
@@ -63,3 +63,3 @@ "keywords": [ | ||
"svelte": "src/index.js", | ||
"gitHead": "f4b5cc91ccb24aba71b97738b2bc97c3a719f881" | ||
"gitHead": "ba2df6c888434874ae72576fbdabe2a7162a1f48" | ||
} |
@@ -87,3 +87,3 @@ # `@vtmn/svelte` | ||
import { VtmnButton } from '@vtmn/svelte'; | ||
<script> | ||
</script> | ||
@@ -90,0 +90,0 @@ <VtmnButton>Button</VtmnButton> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206210
24
5855