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}`);
capture_state = x`
({ props: $props = true, local: $local = true } = {}) => ({
...${x`$props && { ${var_names(capturable_props)} }`},
...${x`$local && { ${var_names(local_vars)} }`}
({ props: $p = true, local: $l = true } = {}) => ({
...${x`$p && { ${var_names(capturable_props)} }`},
...${x`$l && { ${var_names(local_vars)} }`}
})
`;

@ -79,10 +79,7 @@ function instance($$self, $$props, $$invalidate) {
if ("name" in $$props) $$invalidate(0, name = $$props.name);
};
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({
...$props && ({ name }),
...$local && ({})
});
$$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({ ...$p && ({ name }), ...$l && ({}) });
$$self.$inject_state = $$props => {
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);
};
$$self.$capture_state = ({ props: $props = true, local: $local = true } = {}) => ({
...$props && ({ things, foo, bar, baz }),
...$local && ({})
$$self.$capture_state = ({ props: $p = true, local: $l = true } = {}) => ({
...$p && ({ things, foo, bar, baz }),
...$l && ({})
});
$$self.$inject_state = $$props => {

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

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

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

Loading…
Cancel
Save