pull/4604/head
Timothy Johnson 6 years ago
parent c766af7541
commit 004ce9d44f

@ -71,10 +71,16 @@ export default function dom(
} }
const uses_slots = component.var_lookup.has('$$slots'); const uses_slots = component.var_lookup.has('$$slots');
let slots = null let slots = null;
let slots_update = null;
if (uses_slots) { if (uses_slots) {
slots = b`let { $$slots, update: #update_$$slots } = @create_slots_accessor(#slots, $$scope)` slots = b`let { $$slots, update: #update_$$slots } = @create_slots_accessor(#slots, $$scope)`;
slots_update = b`
if (${renderer.dirty(['$$scope'], true)}) {
#update_$$slots($$scope)
}
`;
renderer.add_to_context('$$scope'); renderer.add_to_context('$$scope');
} }
@ -454,9 +460,7 @@ export default function dom(
${(reactive_declarations.length > 0 || uses_slots) && b` ${(reactive_declarations.length > 0 || uses_slots) && b`
$$self.$$.update = () => { $$self.$$.update = () => {
if (${renderer.dirty(['$$scope'], true)}) { ${slots_update}
#update_$$slots($$scope)
}
${reactive_declarations} ${reactive_declarations}
}; };

@ -103,6 +103,7 @@ function instance($$self, $$props, $$invalidate) {
$$subscribe_prop = () => ($$unsubscribe_prop(), $$unsubscribe_prop = subscribe(prop, $$value => $$invalidate(2, $prop = $$value)), prop); $$subscribe_prop = () => ($$unsubscribe_prop(), $$unsubscribe_prop = subscribe(prop, $$value => $$invalidate(2, $prop = $$value)), prop);
$$self.$$.on_destroy.push(() => $$unsubscribe_prop()); $$self.$$.on_destroy.push(() => $$unsubscribe_prop());
let { $$slots: slots = {}, $$scope } = $$props;
let { prop } = $$props; let { prop } = $$props;
validate_store(prop, "prop"); validate_store(prop, "prop");
$$subscribe_prop(); $$subscribe_prop();
@ -115,8 +116,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
$$self.$set = $$props => { $$self.$set = $$props => {
if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop)); if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop));

@ -69,6 +69,7 @@ function create_fragment(ctx) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { name } = $$props; let { name } = $$props;
const writable_props = ["name"]; const writable_props = ["name"];
@ -76,8 +77,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
$$self.$set = $$props => { $$self.$set = $$props => {
if ("name" in $$props) $$invalidate(0, name = $$props.name); if ("name" in $$props) $$invalidate(0, name = $$props.name);

@ -170,6 +170,7 @@ function create_fragment(ctx) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { things } = $$props; let { things } = $$props;
let { foo } = $$props; let { foo } = $$props;
let { bar } = $$props; let { bar } = $$props;
@ -180,8 +181,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
$$self.$set = $$props => { $$self.$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("things" in $$props) $$invalidate(0, things = $$props.things);

@ -164,6 +164,7 @@ function create_fragment(ctx) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { things } = $$props; let { things } = $$props;
let { foo } = $$props; let { foo } = $$props;
const writable_props = ["things", "foo"]; const writable_props = ["things", "foo"];
@ -172,8 +173,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
$$self.$set = $$props => { $$self.$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("things" in $$props) $$invalidate(0, things = $$props.things);

@ -49,6 +49,7 @@ function create_fragment(ctx) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let obj = { x: 5 }; let obj = { x: 5 };
let kobzol = 5; let kobzol = 5;
const writable_props = []; const writable_props = [];
@ -57,8 +58,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
$$self.$capture_state = () => ({ obj, kobzol }); $$self.$capture_state = () => ({ obj, kobzol });
$$self.$inject_state = $$props => { $$self.$inject_state = $$props => {

@ -136,14 +136,14 @@ function create_fragment(ctx) {
} }
function instance($$self, $$props) { function instance($$self, $$props) {
let { $$slots: slots = {}, $$scope } = $$props;
const writable_props = []; const writable_props = [];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
return []; return [];
} }

@ -65,6 +65,7 @@ function create_fragment(ctx) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { foo } = $$props; let { foo } = $$props;
let bar; let bar;
const writable_props = ["foo"]; const writable_props = ["foo"];
@ -73,8 +74,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
$$self.$set = $$props => { $$self.$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);

@ -67,6 +67,7 @@ function foo() {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let node; let node;
{ {
@ -111,8 +112,7 @@ function instance($$self, $$props, $$invalidate) {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(`<Component> was created with unknown prop '${key}'`); if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(`<Component> was created with unknown prop '${key}'`);
}); });
let { $$slots = {}, $$scope } = $$props; validate_slots("Component", slots, []);
validate_slots("Component", $$slots, []);
function div_binding($$value) { function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => { binding_callbacks[$$value ? "unshift" : "push"](() => {

@ -3,7 +3,7 @@ export default {
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<button>Click me</button> <button>Click me</button>
<div><p attr="value">Value: a</p><p>bar</p></div> <div><p attr="value">Value: a</p><p>bar</p></div>
`) `);
const btn = target.querySelector('button'); const btn = target.querySelector('button');
const clickEvent = new window.MouseEvent('click'); const clickEvent = new window.MouseEvent('click');

Loading…
Cancel
Save