shorter & less ambiguous param names

pull/3822/head
rixo 6 years ago
parent 16398f9581
commit 1f84174116

@ -181,9 +181,9 @@ export default function dom(
const var_names = (variables: Var[]) => variables.map(prop => p`${prop.name}`); const var_names = (variables: Var[]) => variables.map(prop => p`${prop.name}`);
capture_state = x` capture_state = x`
({ props: $props = true, local: $local = true } = {}) => ({ ({ props: $p = true, local: $l = true } = {}) => ({
...${x`$props && { ${var_names(capturable_props)} }`}, ...${x`$p && { ${var_names(capturable_props)} }`},
...${x`$local && { ${var_names(local_vars)} }`} ...${x`$l && { ${var_names(local_vars)} }`}
}) })
`; `;

@ -79,10 +79,7 @@ function instance($$self, $$props, $$invalidate) {
if ("name" in $$props) $$invalidate(0, name = $$props.name); if ("name" in $$props) $$invalidate(0, name = $$props.name);
}; };
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({ $$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({ ...$p && ({ name }), ...$l && ({}) });
...$props && ({ name }),
...$local && ({})
});
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {
if ("name" in $$props) $$invalidate(0, name = $$props.name); if ("name" in $$props) $$invalidate(0, name = $$props.name);

@ -183,9 +183,9 @@ function instance($$self, $$props, $$invalidate) {
if ("baz" in $$props) $$invalidate(3, baz = $$props.baz); if ("baz" in $$props) $$invalidate(3, baz = $$props.baz);
}; };
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({ $$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({
...$props && ({ things, foo, bar, baz }), ...$p && ({ things, foo, bar, baz }),
...$local && ({}) ...$l && ({})
}); });
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {

@ -173,9 +173,9 @@ function instance($$self, $$props, $$invalidate) {
if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo);
}; };
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({ $$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({
...$props && ({ things, foo }), ...$p && ({ things, foo }),
...$local && ({}) ...$l && ({})
}); });
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {

@ -51,9 +51,9 @@ function instance($$self) {
let obj = { x: 5 }; let obj = { x: 5 };
let kobzol = 5; let kobzol = 5;
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({ $$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({
...$props && ({}), ...$p && ({}),
...$local && ({ obj, kobzol }) ...$l && ({ obj, kobzol })
}); });
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {

@ -76,10 +76,7 @@ function instance($$self, $$props, $$invalidate) {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
}; };
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({ $$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({ ...$p && ({ foo }), ...$l && ({ bar }) });
...$props && ({ foo }),
...$local && ({ bar })
});
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);

Loading…
Cancel
Save