diff --git a/test/js/samples/action-custom-event-handler/expected.js b/test/js/samples/action-custom-event-handler/expected.js index 5ed38de87c..f4120f5b50 100644 --- a/test/js/samples/action-custom-event-handler/expected.js +++ b/test/js/samples/action-custom-event-handler/expected.js @@ -24,7 +24,7 @@ function create_fragment(ctx) { foo_action = foo.call(null, button, ctx[1]) || ({}); }, p(ctx, changed) { - if (is_function(foo_action.update) && changed.bar) foo_action.update.call(null, ctx[1]); + if (is_function(foo_action.update) && changed & 1) foo_action.update.call(null, ctx[1]); }, i: noop, o: noop, diff --git a/test/js/samples/bind-online/expected.js b/test/js/samples/bind-online/expected.js index 278d807001..a2e0c0b89d 100644 --- a/test/js/samples/bind-online/expected.js +++ b/test/js/samples/bind-online/expected.js @@ -15,10 +15,7 @@ function create_fragment(ctx) { return { c() { - dispose = [ - listen(window, "online", ctx[1]), - listen(window, "offline", ctx[1]) - ]; + dispose = [listen(window, "online", ctx[1]), listen(window, "offline", ctx[1])]; }, m: noop, p: noop, diff --git a/test/js/samples/bind-open/expected.js b/test/js/samples/bind-open/expected.js index f235b21f7b..d5680c0aa7 100644 --- a/test/js/samples/bind-open/expected.js +++ b/test/js/samples/bind-open/expected.js @@ -27,8 +27,10 @@ function create_fragment(ctx) { insert(target, details, anchor); details.open = ctx[0]; }, - p(ctx) { - details.open = ctx[0]; + p(ctx, changed) { + if (changed & 1) { + details.open = ctx[0]; + } }, i: noop, o: noop, @@ -43,7 +45,8 @@ function instance($$self, $$props, $$invalidate) { let { open } = $$props; function details_toggle_handler() { - $$invalidate(0, open = this.open); + open = this.open; + $$invalidate(0, open); } $$self.$set = $$props => { diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index 18efcfdc08..551f05fd76 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -19,11 +19,11 @@ function create_fragment(ctx) { c() { div = element("div"); div.textContent = "some content"; - add_render_callback(() => ctx.div_elementresize_handler.call(div)); + add_render_callback(() => ctx[2].call(div)); }, m(target, anchor) { insert(target, div, anchor); - div_resize_listener = add_resize_listener(div, ctx.div_elementresize_handler.bind(div)); + div_resize_listener = add_resize_listener(div, ctx[2].bind(div)); }, p: noop, i: noop, @@ -42,22 +42,22 @@ function instance($$self, $$props, $$invalidate) { function div_elementresize_handler() { w = this.offsetWidth; h = this.offsetHeight; - $$invalidate("w", w); - $$invalidate("h", h); + $$invalidate(0, w); + $$invalidate(1, h); } $$self.$set = $$props => { - if ("w" in $$props) $$invalidate("w", w = $$props.w); - if ("h" in $$props) $$invalidate("h", h = $$props.h); + if ("w" in $$props) $$invalidate(0, w = $$props.w); + if ("h" in $$props) $$invalidate(1, h = $$props.h); }; - return { w, h, div_elementresize_handler }; + return [w, h, div_elementresize_handler]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { w: 0, h: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { w: 0, h: 1 }); } } diff --git a/test/js/samples/bindings-readonly-order/expected.js b/test/js/samples/bindings-readonly-order/expected.js index 04eff699f8..99078890f0 100644 --- a/test/js/samples/bindings-readonly-order/expected.js +++ b/test/js/samples/bindings-readonly-order/expected.js @@ -26,11 +26,7 @@ function create_fragment(ctx) { input1 = element("input"); attr(input0, "type", "file"); attr(input1, "type", "file"); - - dispose = [ - listen(input0, "change", ctx.input0_change_handler), - listen(input1, "change", ctx.input1_change_handler) - ]; + dispose = [listen(input0, "change", ctx[1]), listen(input1, "change", ctx[2])]; }, m(target, anchor) { insert(target, input0, anchor); @@ -54,23 +50,19 @@ function instance($$self, $$props, $$invalidate) { function input0_change_handler() { files = this.files; - $$invalidate("files", files); + $$invalidate(0, files); } function input1_change_handler() { files = this.files; - $$invalidate("files", files); + $$invalidate(0, files); } $$self.$set = $$props => { - if ("files" in $$props) $$invalidate("files", files = $$props.files); + if ("files" in $$props) $$invalidate(0, files = $$props.files); }; - return { - files, - input0_change_handler, - input1_change_handler - }; + return [files, input0_change_handler, input1_change_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/capture-inject-dev-only/expected.js b/test/js/samples/capture-inject-dev-only/expected.js index ee2f6d0dc9..c1c81a1c42 100644 --- a/test/js/samples/capture-inject-dev-only/expected.js +++ b/test/js/samples/capture-inject-dev-only/expected.js @@ -25,23 +25,23 @@ function create_fragment(ctx) { return { c() { p = element("p"); - t0 = text(ctx.foo); + t0 = text(ctx[0]); t1 = space(); input = element("input"); - dispose = listen(input, "input", ctx.input_input_handler); + dispose = listen(input, "input", ctx[1]); }, m(target, anchor) { insert(target, p, anchor); append(p, t0); insert(target, t1, anchor); insert(target, input, anchor); - set_input_value(input, ctx.foo); + set_input_value(input, ctx[0]); }, - p(changed, ctx) { - if (changed.foo) set_data(t0, ctx.foo); + p(ctx, changed) { + if (changed & 1) set_data(t0, ctx[0]); - if (changed.foo && input.value !== ctx.foo) { - set_input_value(input, ctx.foo); + if (changed & 1 && input.value !== ctx[0]) { + set_input_value(input, ctx[0]); } }, i: noop, @@ -60,10 +60,10 @@ function instance($$self, $$props, $$invalidate) { function input_input_handler() { foo = this.value; - $$invalidate("foo", foo); + $$invalidate(0, foo); } - return { foo, input_input_handler }; + return [foo, input_input_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 5fb7aaef15..0819a0de01 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -27,15 +27,15 @@ function create_fragment(ctx) { return { c() { p = element("p"); - t = text(ctx.foo); + t = text(ctx[0]); attr(p, "class", "svelte-1a7i8ec"); }, m(target, anchor) { insert(target, p, anchor); append(p, t); }, - p(changed, ctx) { - if (changed.foo) set_data(t, ctx.foo); + p(ctx, changed) { + if (changed & 1) set_data(t, ctx[0]); }, i: noop, o: noop, @@ -49,10 +49,10 @@ function instance($$self, $$props, $$invalidate) { let { foo = 42 } = $$props; $$self.$set = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; - return { foo }; + return [foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-static-array/expected.js b/test/js/samples/component-static-array/expected.js index b89ee46764..7948ecd171 100644 --- a/test/js/samples/component-static-array/expected.js +++ b/test/js/samples/component-static-array/expected.js @@ -13,7 +13,7 @@ import { function create_fragment(ctx) { let current; - const nested = new ctx.Nested({ props: { foo: [1, 2, 3] } }); + const nested = new ctx[0]({ props: { foo: [1, 2, 3] } }); return { c() { @@ -41,7 +41,7 @@ function create_fragment(ctx) { function instance($$self) { const Nested = window.Nested; - return { Nested }; + return [Nested]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-static-immutable/expected.js b/test/js/samples/component-static-immutable/expected.js index 17b42a4a43..80d531b793 100644 --- a/test/js/samples/component-static-immutable/expected.js +++ b/test/js/samples/component-static-immutable/expected.js @@ -13,7 +13,7 @@ import { function create_fragment(ctx) { let current; - const nested = new ctx.Nested({ props: { foo: "bar" } }); + const nested = new ctx[0]({ props: { foo: "bar" } }); return { c() { @@ -41,7 +41,7 @@ function create_fragment(ctx) { function instance($$self) { const Nested = window.Nested; - return { Nested }; + return [Nested]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-static-immutable2/expected.js b/test/js/samples/component-static-immutable2/expected.js index 17b42a4a43..80d531b793 100644 --- a/test/js/samples/component-static-immutable2/expected.js +++ b/test/js/samples/component-static-immutable2/expected.js @@ -13,7 +13,7 @@ import { function create_fragment(ctx) { let current; - const nested = new ctx.Nested({ props: { foo: "bar" } }); + const nested = new ctx[0]({ props: { foo: "bar" } }); return { c() { @@ -41,7 +41,7 @@ function create_fragment(ctx) { function instance($$self) { const Nested = window.Nested; - return { Nested }; + return [Nested]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-static-var/expected.js b/test/js/samples/component-static-var/expected.js index 29c585744e..fcbc130676 100644 --- a/test/js/samples/component-static-var/expected.js +++ b/test/js/samples/component-static-var/expected.js @@ -26,7 +26,7 @@ function create_fragment(ctx) { let current; let dispose; const foo = new Foo({ props: { x: y } }); - const bar = new Bar({ props: { x: ctx.z } }); + const bar = new Bar({ props: { x: ctx[0] } }); return { c() { @@ -35,7 +35,7 @@ function create_fragment(ctx) { create_component(bar.$$.fragment); t1 = space(); input = element("input"); - dispose = listen(input, "input", ctx.input_input_handler); + dispose = listen(input, "input", ctx[1]); }, m(target, anchor) { mount_component(foo, target, anchor); @@ -43,16 +43,16 @@ function create_fragment(ctx) { mount_component(bar, target, anchor); insert(target, t1, anchor); insert(target, input, anchor); - set_input_value(input, ctx.z); + set_input_value(input, ctx[0]); current = true; }, - p(changed, ctx) { + p(ctx, changed) { const bar_changes = {}; - if (changed.z) bar_changes.x = ctx.z; + if (changed & 1) bar_changes.x = ctx[0]; bar.$set(bar_changes); - if (changed.z && input.value !== ctx.z) { - set_input_value(input, ctx.z); + if (changed & 1 && input.value !== ctx[0]) { + set_input_value(input, ctx[0]); } }, i(local) { @@ -84,10 +84,10 @@ function instance($$self, $$props, $$invalidate) { function input_input_handler() { z = this.value; - $$invalidate("z", z); + $$invalidate(0, z); } - return { z, input_input_handler }; + return [z, input_input_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 16d9ea9c4c..c242bf0bf5 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -13,7 +13,7 @@ import { function create_fragment(ctx) { let current; - const nested = new ctx.Nested({ props: { foo: "bar" } }); + const nested = new ctx[0]({ props: { foo: "bar" } }); return { c() { @@ -41,7 +41,7 @@ function create_fragment(ctx) { function instance($$self) { const Nested = window.Nested; - return { Nested }; + return [Nested]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-store-access-invalidate/expected.js b/test/js/samples/component-store-access-invalidate/expected.js index b3eedd3d6e..b31c1e1a6a 100644 --- a/test/js/samples/component-store-access-invalidate/expected.js +++ b/test/js/samples/component-store-access-invalidate/expected.js @@ -22,14 +22,14 @@ function create_fragment(ctx) { return { c() { h1 = element("h1"); - t = text(ctx.$foo); + t = text(ctx[1]); }, m(target, anchor) { insert(target, h1, anchor); append(h1, t); }, - p(changed, ctx) { - if (changed.$foo) set_data(t, ctx.$foo); + p(ctx, changed) { + if (changed & 2) set_data(t, ctx[1]); }, i: noop, o: noop, @@ -42,8 +42,8 @@ function create_fragment(ctx) { function instance($$self, $$props, $$invalidate) { let $foo; const foo = writable(0); - component_subscribe($$self, foo, value => $$invalidate("$foo", $foo = value)); - return { foo, $foo }; + component_subscribe($$self, foo, value => $$invalidate(1, $foo = value)); + return [foo, $foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/component-store-file-invalidate/expected.js b/test/js/samples/component-store-file-invalidate/expected.js index a4d7ad5c10..d2fb3d0be4 100644 --- a/test/js/samples/component-store-file-invalidate/expected.js +++ b/test/js/samples/component-store-file-invalidate/expected.js @@ -11,13 +11,13 @@ import { count } from "./store.js"; function instance($$self, $$props, $$invalidate) { let $count; - component_subscribe($$self, count, $$value => $$invalidate("$count", $count = $$value)); + component_subscribe($$self, count, $$value => $$invalidate(1, $count = $$value)); function increment() { set_store_value(count, $count++, $count); } - return { increment }; + return [increment]; } class Component extends SvelteComponent { @@ -27,7 +27,7 @@ class Component extends SvelteComponent { } get increment() { - return this.$$.ctx.increment; + return this.$$.ctx[0]; } } diff --git a/test/js/samples/component-store-reassign-invalidate/expected.js b/test/js/samples/component-store-reassign-invalidate/expected.js index 890e28f79c..a36c37577d 100644 --- a/test/js/samples/component-store-reassign-invalidate/expected.js +++ b/test/js/samples/component-store-reassign-invalidate/expected.js @@ -27,11 +27,11 @@ function create_fragment(ctx) { return { c() { h1 = element("h1"); - t0 = text(ctx.$foo); + t0 = text(ctx[1]); t1 = space(); button = element("button"); button.textContent = "reset"; - dispose = listen(button, "click", ctx.click_handler); + dispose = listen(button, "click", ctx[2]); }, m(target, anchor) { insert(target, h1, anchor); @@ -39,8 +39,8 @@ function create_fragment(ctx) { insert(target, t1, anchor); insert(target, button, anchor); }, - p(changed, ctx) { - if (changed.$foo) set_data(t0, ctx.$foo); + p(ctx, changed) { + if (changed & 2) set_data(t0, ctx[1]); }, i: noop, o: noop, @@ -56,13 +56,13 @@ function create_fragment(ctx) { function instance($$self, $$props, $$invalidate) { let $foo, $$unsubscribe_foo = noop, - $$subscribe_foo = () => ($$unsubscribe_foo(), $$unsubscribe_foo = subscribe(foo, $$value => $$invalidate("$foo", $foo = $$value)), foo); + $$subscribe_foo = () => ($$unsubscribe_foo(), $$unsubscribe_foo = subscribe(foo, $$value => $$invalidate(1, $foo = $$value)), foo); $$self.$$.on_destroy.push(() => $$unsubscribe_foo()); let foo = writable(0); $$subscribe_foo(); - const click_handler = () => $$subscribe_foo($$invalidate("foo", foo = writable(0))); - return { foo, $foo, click_handler }; + const click_handler = () => $$subscribe_foo($$invalidate(0, foo = writable(0))); + return [foo, $foo, click_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index 4d3954358e..8e5964f8a6 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -13,24 +13,24 @@ function instance($$self, $$props, $$invalidate) { } $$self.$set = $$props => { - if ("x" in $$props) $$invalidate("x", x = $$props.x); + if ("x" in $$props) $$invalidate(0, x = $$props.x); }; - return { x, a, b }; + return [x, a, b]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { x: 0, a: 0, b: 0 }); + init(this, options, instance, null, safe_not_equal, { x: 0, a: 1, b: 2 }); } get a() { - return this.$$.ctx.a; + return this.$$.ctx[1]; } get b() { - return this.$$.ctx.b; + return this.$$.ctx[2]; } } diff --git a/test/js/samples/data-attribute/expected.js b/test/js/samples/data-attribute/expected.js index 674be31867..86ecc37166 100644 --- a/test/js/samples/data-attribute/expected.js +++ b/test/js/samples/data-attribute/expected.js @@ -22,16 +22,16 @@ function create_fragment(ctx) { t = space(); div1 = element("div"); attr(div0, "data-foo", "bar"); - attr(div1, "data-foo", ctx.bar); + attr(div1, "data-foo", ctx[0]); }, m(target, anchor) { insert(target, div0, anchor); insert(target, t, anchor); insert(target, div1, anchor); }, - p(changed, ctx) { - if (changed.bar) { - attr(div1, "data-foo", ctx.bar); + p(ctx, changed) { + if (changed & 1) { + attr(div1, "data-foo", ctx[0]); } }, i: noop, @@ -48,10 +48,10 @@ function instance($$self, $$props, $$invalidate) { let { bar } = $$props; $$self.$set = $$props => { - if ("bar" in $$props) $$invalidate("bar", bar = $$props.bar); + if ("bar" in $$props) $$invalidate(0, bar = $$props.bar); }; - return { bar }; + return [bar]; } class Component extends SvelteComponent { diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index b545823c57..572c33d732 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -28,7 +28,7 @@ function create_fragment(ctx) { c: function create() { h1 = element("h1"); t0 = text("Hello "); - t1 = text(ctx.name); + t1 = text(ctx[0]); t2 = text("!"); t3 = space(); debugger; @@ -44,8 +44,8 @@ function create_fragment(ctx) { append_dev(h1, t2); insert_dev(target, t3, anchor); }, - p: function update(changed, ctx) { - if (changed.name) set_data_dev(t1, ctx.name); + p: function update(ctx, changed) { + if (changed & 1) set_data_dev(t1, ctx[0]); debugger; }, i: noop, @@ -76,7 +76,7 @@ function instance($$self, $$props, $$invalidate) { }); $$self.$set = $$props => { - if ("name" in $$props) $$invalidate("name", name = $$props.name); + if ("name" in $$props) $$invalidate(0, name = $$props.name); }; $$self.$capture_state = () => { @@ -84,10 +84,10 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$inject_state = $$props => { - if ("name" in $$props) $$invalidate("name", name = $$props.name); + if ("name" in $$props) $$invalidate(0, name = $$props.name); }; - return { name }; + return [name]; } class Component extends SvelteComponentDev { @@ -105,7 +105,7 @@ class Component extends SvelteComponentDev { const { ctx } = this.$$; const props = options.props || ({}); - if (ctx.name === undefined && !("name" in props)) { + if (ctx[0] === undefined && !("name" in props)) { console.warn(" was created without expected prop 'name'"); } } diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 448fc82176..da59fd12fe 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -19,15 +19,15 @@ import { const file = undefined; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.thing = list[i]; + const child_ctx = ctx.slice(); + child_ctx[4] = list[i]; return child_ctx; } // (8:0) {#each things as thing} function create_each_block(ctx) { let span; - let t0_value = ctx.thing.name + ""; + let t0_value = ctx[4].name + ""; let t0; let t1; @@ -50,10 +50,10 @@ function create_each_block(ctx) { append_dev(span, t0); insert_dev(target, t1, anchor); }, - p: function update(changed, ctx) { - if (changed.things && t0_value !== (t0_value = ctx.thing.name + "")) set_data_dev(t0, t0_value); + p: function update(ctx, changed) { + if (changed & 1 && t0_value !== (t0_value = ctx[4].name + "")) set_data_dev(t0, t0_value); - if (changed.foo || changed.bar || changed.baz || changed.things) { + if (changed & 15) { const { foo, bar, baz, thing } = ctx; console.log({ foo, bar, baz, thing }); debugger; @@ -81,7 +81,7 @@ function create_fragment(ctx) { let p; let t1; let t2; - let each_value = ctx.things; + let each_value = ctx[0]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -97,7 +97,7 @@ function create_fragment(ctx) { t0 = space(); p = element("p"); t1 = text("foo: "); - t2 = text(ctx.foo); + t2 = text(ctx[1]); add_location(p, file, 12, 0, 182); }, l: function claim(nodes) { @@ -113,16 +113,16 @@ function create_fragment(ctx) { append_dev(p, t1); append_dev(p, t2); }, - p: function update(changed, ctx) { - if (changed.things) { - each_value = ctx.things; + p: function update(ctx, changed) { + if (changed & 1) { + each_value = ctx[0]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context(ctx, each_value, i); if (each_blocks[i]) { - each_blocks[i].p(changed, child_ctx); + each_blocks[i].p(child_ctx, changed); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); @@ -137,7 +137,7 @@ function create_fragment(ctx) { each_blocks.length = each_value.length; } - if (changed.foo) set_data_dev(t2, ctx.foo); + if (changed & 2) set_data_dev(t2, ctx[1]); }, i: noop, o: noop, @@ -171,10 +171,10 @@ function instance($$self, $$props, $$invalidate) { }); $$self.$set = $$props => { - if ("things" in $$props) $$invalidate("things", things = $$props.things); - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); - if ("bar" in $$props) $$invalidate("bar", bar = $$props.bar); - if ("baz" in $$props) $$invalidate("baz", baz = $$props.baz); + if ("things" in $$props) $$invalidate(0, things = $$props.things); + if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); + if ("bar" in $$props) $$invalidate(2, bar = $$props.bar); + if ("baz" in $$props) $$invalidate(3, baz = $$props.baz); }; $$self.$capture_state = () => { @@ -182,19 +182,19 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$inject_state = $$props => { - if ("things" in $$props) $$invalidate("things", things = $$props.things); - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); - if ("bar" in $$props) $$invalidate("bar", bar = $$props.bar); - if ("baz" in $$props) $$invalidate("baz", baz = $$props.baz); + if ("things" in $$props) $$invalidate(0, things = $$props.things); + if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); + if ("bar" in $$props) $$invalidate(2, bar = $$props.bar); + if ("baz" in $$props) $$invalidate(3, baz = $$props.baz); }; - return { things, foo, bar, baz }; + return [things, foo, bar, baz, null, null, null]; } class Component extends SvelteComponentDev { constructor(options) { super(options); - init(this, options, instance, create_fragment, safe_not_equal, { things: 0, foo: 0, bar: 0, baz: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { things: 0, foo: 1, bar: 2, baz: 3 }); dispatch_dev("SvelteRegisterComponent", { component: this, @@ -206,19 +206,19 @@ class Component extends SvelteComponentDev { const { ctx } = this.$$; const props = options.props || ({}); - if (ctx.things === undefined && !("things" in props)) { + if (ctx[0] === undefined && !("things" in props)) { console.warn(" was created without expected prop 'things'"); } - if (ctx.foo === undefined && !("foo" in props)) { + if (ctx[1] === undefined && !("foo" in props)) { console.warn(" was created without expected prop 'foo'"); } - if (ctx.bar === undefined && !("bar" in props)) { + if (ctx[2] === undefined && !("bar" in props)) { console.warn(" was created without expected prop 'bar'"); } - if (ctx.baz === undefined && !("baz" in props)) { + if (ctx[3] === undefined && !("baz" in props)) { console.warn(" was created without expected prop 'baz'"); } } diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index 8abfd1bae1..b9795f3d38 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -19,15 +19,15 @@ import { const file = undefined; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.thing = list[i]; + const child_ctx = ctx.slice(); + child_ctx[2] = list[i]; return child_ctx; } // (6:0) {#each things as thing} function create_each_block(ctx) { let span; - let t0_value = ctx.thing.name + ""; + let t0_value = ctx[2].name + ""; let t0; let t1; @@ -50,10 +50,10 @@ function create_each_block(ctx) { append_dev(span, t0); insert_dev(target, t1, anchor); }, - p: function update(changed, ctx) { - if (changed.things && t0_value !== (t0_value = ctx.thing.name + "")) set_data_dev(t0, t0_value); + p: function update(ctx, changed) { + if (changed & 1 && t0_value !== (t0_value = ctx[2].name + "")) set_data_dev(t0, t0_value); - if (changed.foo) { + if (changed & 2) { const { foo } = ctx; console.log({ foo }); debugger; @@ -81,7 +81,7 @@ function create_fragment(ctx) { let p; let t1; let t2; - let each_value = ctx.things; + let each_value = ctx[0]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -97,7 +97,7 @@ function create_fragment(ctx) { t0 = space(); p = element("p"); t1 = text("foo: "); - t2 = text(ctx.foo); + t2 = text(ctx[1]); add_location(p, file, 10, 0, 131); }, l: function claim(nodes) { @@ -113,16 +113,16 @@ function create_fragment(ctx) { append_dev(p, t1); append_dev(p, t2); }, - p: function update(changed, ctx) { - if (changed.things) { - each_value = ctx.things; + p: function update(ctx, changed) { + if (changed & 1) { + each_value = ctx[0]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context(ctx, each_value, i); if (each_blocks[i]) { - each_blocks[i].p(changed, child_ctx); + each_blocks[i].p(child_ctx, changed); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); @@ -137,7 +137,7 @@ function create_fragment(ctx) { each_blocks.length = each_value.length; } - if (changed.foo) set_data_dev(t2, ctx.foo); + if (changed & 2) set_data_dev(t2, ctx[1]); }, i: noop, o: noop, @@ -169,8 +169,8 @@ function instance($$self, $$props, $$invalidate) { }); $$self.$set = $$props => { - if ("things" in $$props) $$invalidate("things", things = $$props.things); - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("things" in $$props) $$invalidate(0, things = $$props.things); + if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); }; $$self.$capture_state = () => { @@ -178,17 +178,17 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$inject_state = $$props => { - if ("things" in $$props) $$invalidate("things", things = $$props.things); - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("things" in $$props) $$invalidate(0, things = $$props.things); + if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); }; - return { things, foo }; + return [things, foo, null, null, null]; } class Component extends SvelteComponentDev { constructor(options) { super(options); - init(this, options, instance, create_fragment, safe_not_equal, { things: 0, foo: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { things: 0, foo: 1 }); dispatch_dev("SvelteRegisterComponent", { component: this, @@ -200,11 +200,11 @@ class Component extends SvelteComponentDev { const { ctx } = this.$$; const props = options.props || ({}); - if (ctx.things === undefined && !("things" in props)) { + if (ctx[0] === undefined && !("things" in props)) { console.warn(" was created without expected prop 'things'"); } - if (ctx.foo === undefined && !("foo" in props)) { + if (ctx[1] === undefined && !("foo" in props)) { console.warn(" was created without expected prop 'foo'"); } } diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index 7ab1d3348e..57e0d182e4 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -23,7 +23,7 @@ function create_fragment(ctx) { }, m: noop, p: function update(changed, ctx) { - if (changed.obj || changed.kobzol) { + if (changed & 3) { const { obj } = ctx; console.log({ obj, kobzol }); debugger; @@ -45,21 +45,20 @@ function create_fragment(ctx) { return block; } -let kobzol = 5; - function instance($$self) { let obj = { x: 5 }; + let kobzol = 5; $$self.$capture_state = () => { return {}; }; $$self.$inject_state = $$props => { - if ("obj" in $$props) $$invalidate("obj", obj = $$props.obj); - if ("kobzol" in $$props) $$invalidate("kobzol", kobzol = $$props.kobzol); + if ("obj" in $$props) $$invalidate(0, obj = $$props.obj); + if ("kobzol" in $$props) $$invalidate(1, kobzol = $$props.kobzol); }; - return { obj }; + return [obj, kobzol]; } class Component extends SvelteComponentDev { diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index 903bdb83b6..31a81e8c5f 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -16,16 +16,16 @@ import { const file = undefined; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.thing = list[i]; - child_ctx.index = i; + const child_ctx = ctx.slice(); + child_ctx[0] = list[i]; + child_ctx[2] = i; return child_ctx; } // (4:0) {#each things as thing, index} function create_each_block(ctx) { let t0; - let t1_value = ctx.thing + ""; + let t1_value = ctx[0] + ""; let t1; const block = { @@ -88,8 +88,8 @@ function create_fragment(ctx) { insert_dev(target, each_1_anchor, anchor); }, - p: function update(changed, ctx) { - if (changed.things) { + p: function update(ctx, changed) { + if (changed & 1) { each_value = things; let i; @@ -97,7 +97,7 @@ function create_fragment(ctx) { const child_ctx = get_each_context(ctx, each_value, i); if (each_blocks[i]) { - each_blocks[i].p(changed, child_ctx); + each_blocks[i].p(child_ctx, changed); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); diff --git a/test/js/samples/deconflict-builtins/expected.js b/test/js/samples/deconflict-builtins/expected.js index 54448a91b4..1f13224b30 100644 --- a/test/js/samples/deconflict-builtins/expected.js +++ b/test/js/samples/deconflict-builtins/expected.js @@ -15,15 +15,15 @@ import { } from "svelte/internal"; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.node = list[i]; + const child_ctx = ctx.slice(); + child_ctx[1] = list[i]; return child_ctx; } // (5:0) {#each createElement as node} function create_each_block(ctx) { let span; - let t_value = ctx.node + ""; + let t_value = ctx[1] + ""; let t; return { @@ -35,8 +35,8 @@ function create_each_block(ctx) { insert(target, span, anchor); append(span, t); }, - p(changed, ctx) { - if (changed.createElement && t_value !== (t_value = ctx.node + "")) set_data(t, t_value); + p(ctx, changed) { + if (changed & 1 && t_value !== (t_value = ctx[1] + "")) set_data(t, t_value); }, d(detaching) { if (detaching) detach(span); @@ -46,7 +46,7 @@ function create_each_block(ctx) { function create_fragment(ctx) { let each_1_anchor; - let each_value = ctx.createElement; + let each_value = ctx[0]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -68,16 +68,16 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, - p(changed, ctx) { - if (changed.createElement) { - each_value = ctx.createElement; + p(ctx, changed) { + if (changed & 1) { + each_value = ctx[0]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context(ctx, each_value, i); if (each_blocks[i]) { - each_blocks[i].p(changed, child_ctx); + each_blocks[i].p(child_ctx, changed); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); @@ -105,10 +105,10 @@ function instance($$self, $$props, $$invalidate) { let { createElement } = $$props; $$self.$set = $$props => { - if ("createElement" in $$props) $$invalidate("createElement", createElement = $$props.createElement); + if ("createElement" in $$props) $$invalidate(0, createElement = $$props.createElement); }; - return { createElement }; + return [createElement, null, null, null]; } class Component extends SvelteComponent { diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js index 6bd0c596b9..7e83c21f0e 100644 --- a/test/js/samples/deconflict-globals/expected.js +++ b/test/js/samples/deconflict-globals/expected.js @@ -11,10 +11,10 @@ function instance($$self, $$props, $$invalidate) { }); $$self.$set = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; - return { foo }; + return [foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js index 5da2b4aead..42c0f17a41 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -19,7 +19,7 @@ const file = undefined; function create_fragment(ctx) { let p; - let t0_value = Math.max(0, ctx.foo) + ""; + let t0_value = Math.max(0, ctx[0]) + ""; let t0; let t1; let t2; @@ -29,7 +29,7 @@ function create_fragment(ctx) { p = element("p"); t0 = text(t0_value); t1 = space(); - t2 = text(ctx.bar); + t2 = text(ctx[1]); add_location(p, file, 7, 0, 67); }, l: function claim(nodes) { @@ -41,9 +41,9 @@ function create_fragment(ctx) { append_dev(p, t1); append_dev(p, t2); }, - p: function update(changed, ctx) { - if (changed.foo && t0_value !== (t0_value = Math.max(0, ctx.foo) + "")) set_data_dev(t0, t0_value); - if (changed.bar) set_data_dev(t2, ctx.bar); + p: function update(ctx, changed) { + if (changed & 1 && t0_value !== (t0_value = Math.max(0, ctx[0]) + "")) set_data_dev(t0, t0_value); + if (changed & 2) set_data_dev(t2, ctx[1]); }, i: noop, o: noop, @@ -73,7 +73,7 @@ function instance($$self, $$props, $$invalidate) { }); $$self.$set = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; $$self.$capture_state = () => { @@ -81,17 +81,17 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$inject_state = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); - if ("bar" in $$props) $$invalidate("bar", bar = $$props.bar); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); + if ("bar" in $$props) $$invalidate(1, bar = $$props.bar); }; - $$self.$$.update = (changed = { foo: 1 }) => { - if (changed.foo) { - $: $$invalidate("bar", bar = foo * 2); + $$self.$$.update = () => { + if ($$self.$$.dirty & 1) { + $: $$invalidate(1, bar = foo * 2); } }; - return { foo, bar }; + return [foo, bar]; } class Component extends SvelteComponentDev { @@ -109,7 +109,7 @@ class Component extends SvelteComponentDev { const { ctx } = this.$$; const props = options.props || ({}); - if (ctx.foo === undefined && !("foo" in props)) { + if (ctx[0] === undefined && !("foo" in props)) { console.warn(" was created without expected prop 'foo'"); } } diff --git a/test/js/samples/each-block-array-literal/expected.js b/test/js/samples/each-block-array-literal/expected.js index 3804cab6bb..8f6e902c21 100644 --- a/test/js/samples/each-block-array-literal/expected.js +++ b/test/js/samples/each-block-array-literal/expected.js @@ -15,15 +15,15 @@ import { } from "svelte/internal"; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.num = list[i]; + const child_ctx = ctx.slice(); + child_ctx[5] = list[i]; return child_ctx; } // (9:0) {#each [a, b, c, d, e] as num} function create_each_block(ctx) { let span; - let t_value = ctx.num + ""; + let t_value = ctx[5] + ""; let t; return { @@ -35,8 +35,8 @@ function create_each_block(ctx) { insert(target, span, anchor); append(span, t); }, - p(changed, ctx) { - if ((changed.a || changed.b || changed.c || changed.d || changed.e) && t_value !== (t_value = ctx.num + "")) set_data(t, t_value); + p(ctx, changed) { + if (changed & 31 && t_value !== (t_value = ctx[5] + "")) set_data(t, t_value); }, d(detaching) { if (detaching) detach(span); @@ -46,7 +46,7 @@ function create_each_block(ctx) { function create_fragment(ctx) { let each_1_anchor; - let each_value = [ctx.a, ctx.b, ctx.c, ctx.d, ctx.e]; + let each_value = [ctx[0], ctx[1], ctx[2], ctx[3], ctx[4]]; let each_blocks = []; for (let i = 0; i < 5; i += 1) { @@ -68,16 +68,16 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, - p(changed, ctx) { - if (changed.a || changed.b || changed.c || changed.d || changed.e) { - each_value = [ctx.a, ctx.b, ctx.c, ctx.d, ctx.e]; + p(ctx, changed) { + if (changed & 31) { + each_value = [ctx[0], ctx[1], ctx[2], ctx[3], ctx[4]]; let i; for (i = 0; i < 5; i += 1) { const child_ctx = get_each_context(ctx, each_value, i); if (each_blocks[i]) { - each_blocks[i].p(changed, child_ctx); + each_blocks[i].p(child_ctx, changed); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); @@ -107,20 +107,20 @@ function instance($$self, $$props, $$invalidate) { let { e } = $$props; $$self.$set = $$props => { - if ("a" in $$props) $$invalidate("a", a = $$props.a); - if ("b" in $$props) $$invalidate("b", b = $$props.b); - if ("c" in $$props) $$invalidate("c", c = $$props.c); - if ("d" in $$props) $$invalidate("d", d = $$props.d); - if ("e" in $$props) $$invalidate("e", e = $$props.e); + if ("a" in $$props) $$invalidate(0, a = $$props.a); + if ("b" in $$props) $$invalidate(1, b = $$props.b); + if ("c" in $$props) $$invalidate(2, c = $$props.c); + if ("d" in $$props) $$invalidate(3, d = $$props.d); + if ("e" in $$props) $$invalidate(4, e = $$props.e); }; - return { a, b, c, d, e }; + return [a, b, c, d, e, null, null, null]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { a: 0, b: 0, c: 0, d: 0, e: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { a: 0, b: 1, c: 2, d: 3, e: 4 }); } } diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index a2735ae9c4..56c399cdc5 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -17,9 +17,9 @@ import { } from "svelte/internal"; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.comment = list[i]; - child_ctx.i = i; + const child_ctx = ctx.slice(); + child_ctx[4] = list[i]; + child_ctx[6] = i; return child_ctx; } @@ -30,21 +30,21 @@ function create_each_block(ctx) { let t0; let t1; let span; - let t2_value = ctx.comment.author + ""; + let t2_value = ctx[4].author + ""; let t2; let t3; - let t4_value = ctx.elapsed(ctx.comment.time, ctx.time) + ""; + let t4_value = ctx[1](ctx[4].time, ctx[2]) + ""; let t4; let t5; let t6; let html_tag; - let raw_value = ctx.comment.html + ""; + let raw_value = ctx[4].html + ""; return { c() { div = element("div"); strong = element("strong"); - t0 = text(ctx.i); + t0 = text(ctx[6]); t1 = space(); span = element("span"); t2 = text(t2_value); @@ -69,10 +69,10 @@ function create_each_block(ctx) { append(div, t6); html_tag.m(div); }, - p(changed, ctx) { - if (changed.comments && t2_value !== (t2_value = ctx.comment.author + "")) set_data(t2, t2_value); - if ((changed.elapsed || changed.comments || changed.time) && t4_value !== (t4_value = ctx.elapsed(ctx.comment.time, ctx.time) + "")) set_data(t4, t4_value); - if (changed.comments && raw_value !== (raw_value = ctx.comment.html + "")) html_tag.p(raw_value); + p(ctx, changed) { + if (changed & 1 && t2_value !== (t2_value = ctx[4].author + "")) set_data(t2, t2_value); + if (changed & 7 && t4_value !== (t4_value = ctx[1](ctx[4].time, ctx[2]) + "")) set_data(t4, t4_value); + if (changed & 1 && raw_value !== (raw_value = ctx[4].html + "")) html_tag.p(raw_value); }, d(detaching) { if (detaching) detach(div); @@ -84,7 +84,7 @@ function create_fragment(ctx) { let t0; let p; let t1; - let each_value = ctx.comments; + let each_value = ctx[0]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -99,7 +99,7 @@ function create_fragment(ctx) { t0 = space(); p = element("p"); - t1 = text(ctx.foo); + t1 = text(ctx[3]); }, m(target, anchor) { for (let i = 0; i < each_blocks.length; i += 1) { @@ -110,16 +110,16 @@ function create_fragment(ctx) { insert(target, p, anchor); append(p, t1); }, - p(changed, ctx) { - if (changed.comments || changed.elapsed || changed.time) { - each_value = ctx.comments; + p(ctx, changed) { + if (changed & 7) { + each_value = ctx[0]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context(ctx, each_value, i); if (each_blocks[i]) { - each_blocks[i].p(changed, child_ctx); + each_blocks[i].p(child_ctx, changed); } else { each_blocks[i] = create_each_block(child_ctx); each_blocks[i].c(); @@ -134,7 +134,7 @@ function create_fragment(ctx) { each_blocks.length = each_value.length; } - if (changed.foo) set_data(t1, ctx.foo); + if (changed & 8) set_data(t1, ctx[3]); }, i: noop, o: noop, @@ -153,19 +153,19 @@ function instance($$self, $$props, $$invalidate) { let { foo } = $$props; $$self.$set = $$props => { - if ("comments" in $$props) $$invalidate("comments", comments = $$props.comments); - if ("elapsed" in $$props) $$invalidate("elapsed", elapsed = $$props.elapsed); - if ("time" in $$props) $$invalidate("time", time = $$props.time); - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("comments" in $$props) $$invalidate(0, comments = $$props.comments); + if ("elapsed" in $$props) $$invalidate(1, elapsed = $$props.elapsed); + if ("time" in $$props) $$invalidate(2, time = $$props.time); + if ("foo" in $$props) $$invalidate(3, foo = $$props.foo); }; - return { comments, elapsed, time, foo }; + return [comments, elapsed, time, foo, null, null, null]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { comments: 0, elapsed: 0, time: 0, foo: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { comments: 0, elapsed: 1, time: 2, foo: 3 }); } } diff --git a/test/js/samples/each-block-keyed-animated/expected.js b/test/js/samples/each-block-keyed-animated/expected.js index e3661764b1..780f5c6db2 100644 --- a/test/js/samples/each-block-keyed-animated/expected.js +++ b/test/js/samples/each-block-keyed-animated/expected.js @@ -18,15 +18,15 @@ import { } from "svelte/internal"; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.thing = list[i]; + const child_ctx = ctx.slice(); + child_ctx[1] = list[i]; return child_ctx; } // (19:0) {#each things as thing (thing.id)} function create_each_block(key_1, ctx) { let div; - let t_value = ctx.thing.name + ""; + let t_value = ctx[1].name + ""; let t; let rect; let stop_animation = noop; @@ -43,8 +43,8 @@ function create_each_block(key_1, ctx) { insert(target, div, anchor); append(div, t); }, - p(changed, ctx) { - if (changed.things && t_value !== (t_value = ctx.thing.name + "")) set_data(t, t_value); + p(ctx, changed) { + if (changed & 1 && t_value !== (t_value = ctx[1].name + "")) set_data(t, t_value); }, r() { rect = div.getBoundingClientRect(); @@ -67,8 +67,8 @@ function create_fragment(ctx) { let each_blocks = []; let each_1_lookup = new Map(); let each_1_anchor; - let each_value = ctx.things; - const get_key = ctx => ctx.thing.id; + let each_value = ctx[0]; + const get_key = ctx => ctx[1].id; for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context(ctx, each_value, i); @@ -91,8 +91,8 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, - p(changed, ctx) { - const each_value = ctx.things; + p(ctx, changed) { + const each_value = ctx[0]; for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].r(); each_blocks = update_keyed_each(each_blocks, changed, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, fix_and_destroy_block, create_each_block, each_1_anchor, get_each_context); for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].a(); @@ -127,10 +127,10 @@ function instance($$self, $$props, $$invalidate) { let { things } = $$props; $$self.$set = $$props => { - if ("things" in $$props) $$invalidate("things", things = $$props.things); + if ("things" in $$props) $$invalidate(0, things = $$props.things); }; - return { things }; + return [things, null, null, null]; } class Component extends SvelteComponent { diff --git a/test/js/samples/each-block-keyed/expected.js b/test/js/samples/each-block-keyed/expected.js index beb5a613bc..dd72e418c7 100644 --- a/test/js/samples/each-block-keyed/expected.js +++ b/test/js/samples/each-block-keyed/expected.js @@ -16,15 +16,15 @@ import { } from "svelte/internal"; function get_each_context(ctx, list, i) { - const child_ctx = Object.create(ctx); - child_ctx.thing = list[i]; + const child_ctx = ctx.slice(); + child_ctx[1] = list[i]; return child_ctx; } // (5:0) {#each things as thing (thing.id)} function create_each_block(key_1, ctx) { let div; - let t_value = ctx.thing.name + ""; + let t_value = ctx[1].name + ""; let t; return { @@ -39,8 +39,8 @@ function create_each_block(key_1, ctx) { insert(target, div, anchor); append(div, t); }, - p(changed, ctx) { - if (changed.things && t_value !== (t_value = ctx.thing.name + "")) set_data(t, t_value); + p(ctx, changed) { + if (changed & 1 && t_value !== (t_value = ctx[1].name + "")) set_data(t, t_value); }, d(detaching) { if (detaching) detach(div); @@ -52,8 +52,8 @@ function create_fragment(ctx) { let each_blocks = []; let each_1_lookup = new Map(); let each_1_anchor; - let each_value = ctx.things; - const get_key = ctx => ctx.thing.id; + let each_value = ctx[0]; + const get_key = ctx => ctx[1].id; for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context(ctx, each_value, i); @@ -76,8 +76,8 @@ function create_fragment(ctx) { insert(target, each_1_anchor, anchor); }, - p(changed, ctx) { - const each_value = ctx.things; + p(ctx, changed) { + const each_value = ctx[0]; each_blocks = update_keyed_each(each_blocks, changed, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, destroy_block, create_each_block, each_1_anchor, get_each_context); }, i: noop, @@ -96,10 +96,10 @@ function instance($$self, $$props, $$invalidate) { let { things } = $$props; $$self.$set = $$props => { - if ("things" in $$props) $$invalidate("things", things = $$props.things); + if ("things" in $$props) $$invalidate(0, things = $$props.things); }; - return { things }; + return [things, null, null, null]; } class Component extends SvelteComponent { diff --git a/test/js/samples/empty-dom/expected.js b/test/js/samples/empty-dom/expected.js index bd5a9fb7ef..d5c80be696 100644 --- a/test/js/samples/empty-dom/expected.js +++ b/test/js/samples/empty-dom/expected.js @@ -3,7 +3,7 @@ import { SvelteComponent, init, safe_not_equal } from "svelte/internal"; function instance($$self) { const a = 1 + 2; - return {}; + return []; } class Component extends SvelteComponent { diff --git a/test/js/samples/event-handler-dynamic/expected.js b/test/js/samples/event-handler-dynamic/expected.js index 515d7e36a9..7778616247 100644 --- a/test/js/samples/event-handler-dynamic/expected.js +++ b/test/js/samples/event-handler-dynamic/expected.js @@ -37,16 +37,16 @@ function create_fragment(ctx) { button1.textContent = "set handler 2"; t3 = space(); p1 = element("p"); - t4 = text(ctx.number); + t4 = text(ctx[1]); t5 = space(); button2 = element("button"); button2.textContent = "click"; dispose = [ - listen(button0, "click", ctx.updateHandler1), - listen(button1, "click", ctx.updateHandler2), + listen(button0, "click", ctx[2]), + listen(button1, "click", ctx[3]), listen(button2, "click", function () { - ctx.clickHandler.apply(this, arguments); + ctx[0].apply(this, arguments); }) ]; }, @@ -61,9 +61,9 @@ function create_fragment(ctx) { insert(target, t5, anchor); insert(target, button2, anchor); }, - p(changed, new_ctx) { + p(new_ctx, changed) { ctx = new_ctx; - if (changed.number) set_data(t4, ctx.number); + if (changed & 2) set_data(t4, ctx[1]); }, i: noop, o: noop, @@ -83,19 +83,14 @@ function instance($$self, $$props, $$invalidate) { let number = 0; function updateHandler1() { - $$invalidate("clickHandler", clickHandler = () => $$invalidate("number", number = 1)); + $$invalidate(0, clickHandler = () => $$invalidate(1, number = 1)); } function updateHandler2() { - $$invalidate("clickHandler", clickHandler = () => $$invalidate("number", number = 2)); + $$invalidate(0, clickHandler = () => $$invalidate(1, number = 2)); } - return { - clickHandler, - number, - updateHandler1, - updateHandler2 - }; + return [clickHandler, number, updateHandler1, updateHandler2]; } class Component extends SvelteComponent { diff --git a/test/js/samples/if-block-complex/expected.js b/test/js/samples/if-block-complex/expected.js index badae4a2c0..a40e0e8afb 100644 --- a/test/js/samples/if-block-complex/expected.js +++ b/test/js/samples/if-block-complex/expected.js @@ -29,7 +29,7 @@ function create_if_block(ctx) { } function create_fragment(ctx) { - let show_if = ctx.item.divider && ctx.item.divider.includes(1); + let show_if = ctx[0].divider && ctx[0].divider.includes(1); let if_block_anchor; let if_block = show_if && create_if_block(ctx); @@ -54,7 +54,7 @@ function create_fragment(ctx) { function instance($$self) { let item = { divider: [1] }; - return { item }; + return [item]; } class Component extends SvelteComponent { diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index b057041e88..a7982a1f7d 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -48,12 +48,12 @@ function create_if_block(ctx) { function create_fragment(ctx) { let if_block_anchor; - function select_block_type(changed, ctx) { - if (ctx.foo) return create_if_block; + function select_block_type(ctx, changed) { + if (ctx[0]) return create_if_block; return create_else_block; } - let current_block_type = select_block_type(null, ctx); + let current_block_type = select_block_type(ctx, -1); let if_block = current_block_type(ctx); return { @@ -65,8 +65,8 @@ function create_fragment(ctx) { if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, - p(changed, ctx) { - if (current_block_type !== (current_block_type = select_block_type(changed, ctx))) { + p(ctx, changed) { + if (current_block_type !== (current_block_type = select_block_type(ctx, changed))) { if_block.d(1); if_block = current_block_type(ctx); @@ -89,10 +89,10 @@ function instance($$self, $$props, $$invalidate) { let { foo } = $$props; $$self.$set = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; - return { foo }; + return [foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index fd2185b86d..af311c43fe 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -29,7 +29,7 @@ function create_if_block(ctx) { function create_fragment(ctx) { let if_block_anchor; - let if_block = ctx.foo && create_if_block(ctx); + let if_block = ctx[0] && create_if_block(ctx); return { c() { @@ -40,14 +40,14 @@ function create_fragment(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, - p(changed, ctx) { - if (ctx.foo) { + p(ctx, changed) { + if (ctx[0]) { if (!if_block) { if_block = create_if_block(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } else { - + } } else if (if_block) { if_block.d(1); @@ -67,10 +67,10 @@ function instance($$self, $$props, $$invalidate) { let { foo } = $$props; $$self.$set = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; - return { foo }; + return [foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js index 636a4f19bb..efb3637297 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -16,19 +16,19 @@ function create_fragment(ctx) { return { c() { div = element("div"); - set_style(div, "color", ctx.color); - set_style(div, "transform", "translate(" + ctx.x + "px," + ctx.y + "px)"); + set_style(div, "color", ctx[0]); + set_style(div, "transform", "translate(" + ctx[1] + "px," + ctx[2] + "px)"); }, m(target, anchor) { insert(target, div, anchor); }, - p(changed, ctx) { - if (changed.color) { - set_style(div, "color", ctx.color); + p(ctx, changed) { + if (changed & 1) { + set_style(div, "color", ctx[0]); } - if (changed.x || changed.y) { - set_style(div, "transform", "translate(" + ctx.x + "px," + ctx.y + "px)"); + if (changed & 6) { + set_style(div, "transform", "translate(" + ctx[1] + "px," + ctx[2] + "px)"); } }, i: noop, @@ -45,18 +45,18 @@ function instance($$self, $$props, $$invalidate) { let { y } = $$props; $$self.$set = $$props => { - if ("color" in $$props) $$invalidate("color", color = $$props.color); - if ("x" in $$props) $$invalidate("x", x = $$props.x); - if ("y" in $$props) $$invalidate("y", y = $$props.y); + if ("color" in $$props) $$invalidate(0, color = $$props.color); + if ("x" in $$props) $$invalidate(1, x = $$props.x); + if ("y" in $$props) $$invalidate(2, y = $$props.y); }; - return { color, x, y }; + return [color, x, y]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { color: 0, x: 0, y: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { color: 0, x: 1, y: 2 }); } } diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js index 53a9434369..9d11d96055 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -16,14 +16,14 @@ function create_fragment(ctx) { return { c() { div = element("div"); - set_style(div, "background", "url(data:image/png;base64," + ctx.data + ")"); + set_style(div, "background", "url(data:image/png;base64," + ctx[0] + ")"); }, m(target, anchor) { insert(target, div, anchor); }, - p(changed, ctx) { - if (changed.data) { - set_style(div, "background", "url(data:image/png;base64," + ctx.data + ")"); + p(ctx, changed) { + if (changed & 1) { + set_style(div, "background", "url(data:image/png;base64," + ctx[0] + ")"); } }, i: noop, @@ -38,10 +38,10 @@ function instance($$self, $$props, $$invalidate) { let { data } = $$props; $$self.$set = $$props => { - if ("data" in $$props) $$invalidate("data", data = $$props.data); + if ("data" in $$props) $$invalidate(0, data = $$props.data); }; - return { data }; + return [data]; } class Component extends SvelteComponent { diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js index 95079a63fe..f9def765d1 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -16,14 +16,14 @@ function create_fragment(ctx) { return { c() { div = element("div"); - set_style(div, "color", ctx.color); + set_style(div, "color", ctx[0]); }, m(target, anchor) { insert(target, div, anchor); }, - p(changed, ctx) { - if (changed.color) { - set_style(div, "color", ctx.color); + p(ctx, changed) { + if (changed & 1) { + set_style(div, "color", ctx[0]); } }, i: noop, @@ -38,10 +38,10 @@ function instance($$self, $$props, $$invalidate) { let { color } = $$props; $$self.$set = $$props => { - if ("color" in $$props) $$invalidate("color", color = $$props.color); + if ("color" in $$props) $$invalidate(0, color = $$props.color); }; - return { color }; + return [color]; } class Component extends SvelteComponent { diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index 11eaddbdf7..a40e0e7e73 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -22,20 +22,20 @@ function create_fragment(ctx) { div0 = element("div"); t = space(); div1 = element("div"); - attr(div0, "style", ctx.style); - attr(div1, "style", div1_style_value = "" + (ctx.key + ": " + ctx.value)); + attr(div0, "style", ctx[0]); + attr(div1, "style", div1_style_value = "" + (ctx[1] + ": " + ctx[2])); }, m(target, anchor) { insert(target, div0, anchor); insert(target, t, anchor); insert(target, div1, anchor); }, - p(changed, ctx) { - if (changed.style) { - attr(div0, "style", ctx.style); + p(ctx, changed) { + if (changed & 1) { + attr(div0, "style", ctx[0]); } - if ((changed.key || changed.value) && div1_style_value !== (div1_style_value = "" + (ctx.key + ": " + ctx.value))) { + if (changed & 6 && div1_style_value !== (div1_style_value = "" + (ctx[1] + ": " + ctx[2]))) { attr(div1, "style", div1_style_value); } }, @@ -55,18 +55,18 @@ function instance($$self, $$props, $$invalidate) { let { value } = $$props; $$self.$set = $$props => { - if ("style" in $$props) $$invalidate("style", style = $$props.style); - if ("key" in $$props) $$invalidate("key", key = $$props.key); - if ("value" in $$props) $$invalidate("value", value = $$props.value); + if ("style" in $$props) $$invalidate(0, style = $$props.style); + if ("key" in $$props) $$invalidate(1, key = $$props.key); + if ("value" in $$props) $$invalidate(2, value = $$props.value); }; - return { style, key, value }; + return [style, key, value]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { style: 0, key: 0, value: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { style: 0, key: 1, value: 2 }); } } diff --git a/test/js/samples/input-files/expected.js b/test/js/samples/input-files/expected.js index a190d6cf72..08745fa730 100644 --- a/test/js/samples/input-files/expected.js +++ b/test/js/samples/input-files/expected.js @@ -20,7 +20,7 @@ function create_fragment(ctx) { input = element("input"); attr(input, "type", "file"); input.multiple = true; - dispose = listen(input, "change", ctx.input_change_handler); + dispose = listen(input, "change", ctx[1]); }, m(target, anchor) { insert(target, input, anchor); @@ -40,14 +40,14 @@ function instance($$self, $$props, $$invalidate) { function input_change_handler() { files = this.files; - $$invalidate("files", files); + $$invalidate(0, files); } $$self.$set = $$props => { - if ("files" in $$props) $$invalidate("files", files = $$props.files); + if ("files" in $$props) $$invalidate(0, files = $$props.files); }; - return { files, input_change_handler }; + return [files, input_change_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/input-no-initial-value/expected.js b/test/js/samples/input-no-initial-value/expected.js index 85bc9dfcef..15f87b1d81 100644 --- a/test/js/samples/input-no-initial-value/expected.js +++ b/test/js/samples/input-no-initial-value/expected.js @@ -31,22 +31,18 @@ function create_fragment(ctx) { button.textContent = "Store"; attr(input, "type", "text"); input.required = true; - - dispose = [ - listen(input, "input", ctx.input_input_handler), - listen(form, "submit", ctx.handleSubmit) - ]; + dispose = [listen(input, "input", ctx[2]), listen(form, "submit", ctx[1])]; }, m(target, anchor) { insert(target, form, anchor); append(form, input); - set_input_value(input, ctx.test); + set_input_value(input, ctx[0]); append(form, t0); append(form, button); }, - p(changed, ctx) { - if (changed.test && input.value !== ctx.test) { - set_input_value(input, ctx.test); + p(ctx, changed) { + if (changed & 1 && input.value !== ctx[0]) { + set_input_value(input, ctx[0]); } }, i: noop, @@ -68,10 +64,10 @@ function instance($$self, $$props, $$invalidate) { function input_input_handler() { test = this.value; - $$invalidate("test", test); + $$invalidate(0, test); } - return { test, handleSubmit, input_input_handler }; + return [test, handleSubmit, input_input_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/input-range/expected.js b/test/js/samples/input-range/expected.js index 2ea13df038..ecf36ab2f6 100644 --- a/test/js/samples/input-range/expected.js +++ b/test/js/samples/input-range/expected.js @@ -22,19 +22,15 @@ function create_fragment(ctx) { c() { input = element("input"); attr(input, "type", "range"); - - dispose = [ - listen(input, "change", ctx.input_change_input_handler), - listen(input, "input", ctx.input_change_input_handler) - ]; + dispose = [listen(input, "change", ctx[1]), listen(input, "input", ctx[1])]; }, m(target, anchor) { insert(target, input, anchor); - set_input_value(input, ctx.value); + set_input_value(input, ctx[0]); }, - p(changed, ctx) { - if (changed.value) { - set_input_value(input, ctx.value); + p(ctx, changed) { + if (changed & 1) { + set_input_value(input, ctx[0]); } }, i: noop, @@ -51,14 +47,14 @@ function instance($$self, $$props, $$invalidate) { function input_change_input_handler() { value = to_number(this.value); - $$invalidate("value", value); + $$invalidate(0, value); } $$self.$set = $$props => { - if ("value" in $$props) $$invalidate("value", value = $$props.value); + if ("value" in $$props) $$invalidate(0, value = $$props.value); }; - return { value, input_change_input_handler }; + return [value, input_change_input_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index eacdbece83..aa52f72040 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -19,15 +19,15 @@ function create_fragment(ctx) { c() { input = element("input"); attr(input, "type", "checkbox"); - dispose = listen(input, "change", ctx.input_change_handler); + dispose = listen(input, "change", ctx[1]); }, m(target, anchor) { insert(target, input, anchor); - input.checked = ctx.foo; + input.checked = ctx[0]; }, - p(changed, ctx) { - if (changed.foo) { - input.checked = ctx.foo; + p(ctx, changed) { + if (changed & 1) { + input.checked = ctx[0]; } }, i: noop, @@ -44,14 +44,14 @@ function instance($$self, $$props, $$invalidate) { function input_change_handler() { foo = this.checked; - $$invalidate("foo", foo); + $$invalidate(0, foo); } $$self.$set = $$props => { - if ("foo" in $$props) $$invalidate("foo", foo = $$props.foo); + if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; - return { foo, input_change_handler }; + return [foo, input_change_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/instrumentation-script-if-no-block/expected.js b/test/js/samples/instrumentation-script-if-no-block/expected.js index 4b0574b79d..70c5e25e8d 100644 --- a/test/js/samples/instrumentation-script-if-no-block/expected.js +++ b/test/js/samples/instrumentation-script-if-no-block/expected.js @@ -29,8 +29,8 @@ function create_fragment(ctx) { t1 = space(); p = element("p"); t2 = text("x: "); - t3 = text(ctx.x); - dispose = listen(button, "click", ctx.foo); + t3 = text(ctx[0]); + dispose = listen(button, "click", ctx[1]); }, m(target, anchor) { insert(target, button, anchor); @@ -39,8 +39,8 @@ function create_fragment(ctx) { append(p, t2); append(p, t3); }, - p(changed, ctx) { - if (changed.x) set_data(t3, ctx.x); + p(ctx, changed) { + if (changed & 1) set_data(t3, ctx[0]); }, i: noop, o: noop, @@ -57,10 +57,10 @@ function instance($$self, $$props, $$invalidate) { let x = 0; function foo() { - if (true) $$invalidate("x", x += 1); + if (true) $$invalidate(0, x += 1); } - return { x, foo }; + return [x, foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/instrumentation-script-x-equals-x/expected.js b/test/js/samples/instrumentation-script-x-equals-x/expected.js index 8a3fa9366a..9b25a9c444 100644 --- a/test/js/samples/instrumentation-script-x-equals-x/expected.js +++ b/test/js/samples/instrumentation-script-x-equals-x/expected.js @@ -19,7 +19,7 @@ function create_fragment(ctx) { let t1; let p; let t2; - let t3_value = ctx.things.length + ""; + let t3_value = ctx[0].length + ""; let t3; let dispose; @@ -31,7 +31,7 @@ function create_fragment(ctx) { p = element("p"); t2 = text("number of things: "); t3 = text(t3_value); - dispose = listen(button, "click", ctx.foo); + dispose = listen(button, "click", ctx[1]); }, m(target, anchor) { insert(target, button, anchor); @@ -40,8 +40,8 @@ function create_fragment(ctx) { append(p, t2); append(p, t3); }, - p(changed, ctx) { - if (changed.things && t3_value !== (t3_value = ctx.things.length + "")) set_data(t3, t3_value); + p(ctx, changed) { + if (changed & 1 && t3_value !== (t3_value = ctx[0].length + "")) set_data(t3, t3_value); }, i: noop, o: noop, @@ -59,10 +59,10 @@ function instance($$self, $$props, $$invalidate) { function foo() { things.push(1); - $$invalidate("things", things); + $$invalidate(0, things); } - return { things, foo }; + return [things, foo]; } class Component extends SvelteComponent { diff --git a/test/js/samples/instrumentation-template-if-no-block/expected.js b/test/js/samples/instrumentation-template-if-no-block/expected.js index e2d8c4466f..18dc615adf 100644 --- a/test/js/samples/instrumentation-template-if-no-block/expected.js +++ b/test/js/samples/instrumentation-template-if-no-block/expected.js @@ -29,8 +29,8 @@ function create_fragment(ctx) { t1 = space(); p = element("p"); t2 = text("x: "); - t3 = text(ctx.x); - dispose = listen(button, "click", ctx.click_handler); + t3 = text(ctx[0]); + dispose = listen(button, "click", ctx[1]); }, m(target, anchor) { insert(target, button, anchor); @@ -39,8 +39,8 @@ function create_fragment(ctx) { append(p, t2); append(p, t3); }, - p(changed, ctx) { - if (changed.x) set_data(t3, ctx.x); + p(ctx, changed) { + if (changed & 1) set_data(t3, ctx[0]); }, i: noop, o: noop, @@ -57,10 +57,10 @@ function instance($$self, $$props, $$invalidate) { let x = 0; const click_handler = () => { - if (true) $$invalidate("x", x += 1); + if (true) $$invalidate(0, x += 1); }; - return { x, click_handler }; + return [x, click_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/instrumentation-template-x-equals-x/expected.js b/test/js/samples/instrumentation-template-x-equals-x/expected.js index eefda55f31..0b71f86a5b 100644 --- a/test/js/samples/instrumentation-template-x-equals-x/expected.js +++ b/test/js/samples/instrumentation-template-x-equals-x/expected.js @@ -19,7 +19,7 @@ function create_fragment(ctx) { let t1; let p; let t2; - let t3_value = ctx.things.length + ""; + let t3_value = ctx[0].length + ""; let t3; let dispose; @@ -31,7 +31,7 @@ function create_fragment(ctx) { p = element("p"); t2 = text("number of things: "); t3 = text(t3_value); - dispose = listen(button, "click", ctx.click_handler); + dispose = listen(button, "click", ctx[1]); }, m(target, anchor) { insert(target, button, anchor); @@ -40,8 +40,8 @@ function create_fragment(ctx) { append(p, t2); append(p, t3); }, - p(changed, ctx) { - if (changed.things && t3_value !== (t3_value = ctx.things.length + "")) set_data(t3, t3_value); + p(ctx, changed) { + if (changed & 1 && t3_value !== (t3_value = ctx[0].length + "")) set_data(t3, t3_value); }, i: noop, o: noop, @@ -59,10 +59,10 @@ function instance($$self, $$props, $$invalidate) { const click_handler = () => { things.push(1); - $$invalidate("things", things); + $$invalidate(0, things); }; - return { things, click_handler }; + return [things, click_handler]; } class Component extends SvelteComponent { diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index 59d9a7e43b..e2df5820e1 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -68,7 +68,7 @@ function instance($$self) { }; $$self.$inject_state = $$props => { - + }; $: { @@ -89,7 +89,7 @@ function instance($$self) { } while (true); } - return {}; + return []; } class Component extends SvelteComponentDev { diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 0538f07055..0ebd19b4da 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -29,59 +29,59 @@ function create_fragment(ctx) { audio_updating = true; } - ctx.audio_timeupdate_handler.call(audio); + ctx[10].call(audio); } return { c() { audio = element("audio"); - if (ctx.played === void 0 || ctx.currentTime === void 0 || ctx.ended === void 0) add_render_callback(audio_timeupdate_handler); - if (ctx.duration === void 0) add_render_callback(() => ctx.audio_durationchange_handler.call(audio)); - if (ctx.buffered === void 0) add_render_callback(() => ctx.audio_progress_handler.call(audio)); - if (ctx.buffered === void 0 || ctx.seekable === void 0) add_render_callback(() => ctx.audio_loadedmetadata_handler.call(audio)); - if (ctx.seeking === void 0) add_render_callback(() => ctx.audio_seeking_seeked_handler.call(audio)); - if (ctx.ended === void 0) add_render_callback(() => ctx.audio_ended_handler.call(audio)); + if (ctx[2] === void 0 || ctx[3] === void 0 || ctx[9] === void 0) add_render_callback(audio_timeupdate_handler); + if (ctx[4] === void 0) add_render_callback(() => ctx[11].call(audio)); + if (ctx[0] === void 0) add_render_callback(() => ctx[13].call(audio)); + if (ctx[0] === void 0 || ctx[1] === void 0) add_render_callback(() => ctx[14].call(audio)); + if (ctx[8] === void 0) add_render_callback(() => ctx[17].call(audio)); + if (ctx[9] === void 0) add_render_callback(() => ctx[18].call(audio)); dispose = [ listen(audio, "timeupdate", audio_timeupdate_handler), - listen(audio, "durationchange", ctx.audio_durationchange_handler), - listen(audio, "play", ctx.audio_play_pause_handler), - listen(audio, "pause", ctx.audio_play_pause_handler), - listen(audio, "progress", ctx.audio_progress_handler), - listen(audio, "loadedmetadata", ctx.audio_loadedmetadata_handler), - listen(audio, "volumechange", ctx.audio_volumechange_handler), - listen(audio, "ratechange", ctx.audio_ratechange_handler), - listen(audio, "seeking", ctx.audio_seeking_seeked_handler), - listen(audio, "seeked", ctx.audio_seeking_seeked_handler), - listen(audio, "ended", ctx.audio_ended_handler) + listen(audio, "durationchange", ctx[11]), + listen(audio, "play", ctx[12]), + listen(audio, "pause", ctx[12]), + listen(audio, "progress", ctx[13]), + listen(audio, "loadedmetadata", ctx[14]), + listen(audio, "volumechange", ctx[15]), + listen(audio, "ratechange", ctx[16]), + listen(audio, "seeking", ctx[17]), + listen(audio, "seeked", ctx[17]), + listen(audio, "ended", ctx[18]) ]; }, m(target, anchor) { insert(target, audio, anchor); - if (!isNaN(ctx.volume)) { - audio.volume = ctx.volume; + if (!isNaN(ctx[6])) { + audio.volume = ctx[6]; } - if (!isNaN(ctx.playbackRate)) { - audio.playbackRate = ctx.playbackRate; + if (!isNaN(ctx[7])) { + audio.playbackRate = ctx[7]; } }, - p(changed, ctx) { - if (!audio_updating && changed.currentTime && !isNaN(ctx.currentTime)) { - audio.currentTime = ctx.currentTime; + p(ctx, changed) { + if (!audio_updating && changed & 8 && !isNaN(ctx[3])) { + audio.currentTime = ctx[3]; } - if (changed.paused && audio_is_paused !== (audio_is_paused = ctx.paused)) { + if (changed & 32 && audio_is_paused !== (audio_is_paused = ctx[5])) { audio[audio_is_paused ? "pause" : "play"](); } - if (changed.volume && !isNaN(ctx.volume)) { - audio.volume = ctx.volume; + if (changed & 64 && !isNaN(ctx[6])) { + audio.volume = ctx[6]; } - if (changed.playbackRate && !isNaN(ctx.playbackRate)) { - audio.playbackRate = ctx.playbackRate; + if (changed & 128 && !isNaN(ctx[7])) { + audio.playbackRate = ctx[7]; } audio_updating = false; @@ -111,67 +111,67 @@ function instance($$self, $$props, $$invalidate) { played = time_ranges_to_array(this.played); currentTime = this.currentTime; ended = this.ended; - $$invalidate("played", played); - $$invalidate("currentTime", currentTime); - $$invalidate("ended", ended); + $$invalidate(2, played); + $$invalidate(3, currentTime); + $$invalidate(9, ended); } function audio_durationchange_handler() { duration = this.duration; - $$invalidate("duration", duration); + $$invalidate(4, duration); } function audio_play_pause_handler() { paused = this.paused; - $$invalidate("paused", paused); + $$invalidate(5, paused); } function audio_progress_handler() { buffered = time_ranges_to_array(this.buffered); - $$invalidate("buffered", buffered); + $$invalidate(0, buffered); } function audio_loadedmetadata_handler() { buffered = time_ranges_to_array(this.buffered); seekable = time_ranges_to_array(this.seekable); - $$invalidate("buffered", buffered); - $$invalidate("seekable", seekable); + $$invalidate(0, buffered); + $$invalidate(1, seekable); } function audio_volumechange_handler() { volume = this.volume; - $$invalidate("volume", volume); + $$invalidate(6, volume); } function audio_ratechange_handler() { playbackRate = this.playbackRate; - $$invalidate("playbackRate", playbackRate); + $$invalidate(7, playbackRate); } function audio_seeking_seeked_handler() { seeking = this.seeking; - $$invalidate("seeking", seeking); + $$invalidate(8, seeking); } function audio_ended_handler() { ended = this.ended; - $$invalidate("ended", ended); + $$invalidate(9, ended); } $$self.$set = $$props => { - if ("buffered" in $$props) $$invalidate("buffered", buffered = $$props.buffered); - if ("seekable" in $$props) $$invalidate("seekable", seekable = $$props.seekable); - if ("played" in $$props) $$invalidate("played", played = $$props.played); - if ("currentTime" in $$props) $$invalidate("currentTime", currentTime = $$props.currentTime); - if ("duration" in $$props) $$invalidate("duration", duration = $$props.duration); - if ("paused" in $$props) $$invalidate("paused", paused = $$props.paused); - if ("volume" in $$props) $$invalidate("volume", volume = $$props.volume); - if ("playbackRate" in $$props) $$invalidate("playbackRate", playbackRate = $$props.playbackRate); - if ("seeking" in $$props) $$invalidate("seeking", seeking = $$props.seeking); - if ("ended" in $$props) $$invalidate("ended", ended = $$props.ended); + if ("buffered" in $$props) $$invalidate(0, buffered = $$props.buffered); + if ("seekable" in $$props) $$invalidate(1, seekable = $$props.seekable); + if ("played" in $$props) $$invalidate(2, played = $$props.played); + if ("currentTime" in $$props) $$invalidate(3, currentTime = $$props.currentTime); + if ("duration" in $$props) $$invalidate(4, duration = $$props.duration); + if ("paused" in $$props) $$invalidate(5, paused = $$props.paused); + if ("volume" in $$props) $$invalidate(6, volume = $$props.volume); + if ("playbackRate" in $$props) $$invalidate(7, playbackRate = $$props.playbackRate); + if ("seeking" in $$props) $$invalidate(8, seeking = $$props.seeking); + if ("ended" in $$props) $$invalidate(9, ended = $$props.ended); }; - return { + return [ buffered, seekable, played, @@ -191,7 +191,7 @@ function instance($$self, $$props, $$invalidate) { audio_ratechange_handler, audio_seeking_seeked_handler, audio_ended_handler - }; + ]; } class Component extends SvelteComponent { @@ -200,15 +200,15 @@ class Component extends SvelteComponent { init(this, options, instance, create_fragment, safe_not_equal, { buffered: 0, - seekable: 0, - played: 0, - currentTime: 0, - duration: 0, - paused: 0, - volume: 0, - playbackRate: 0, - seeking: 0, - ended: 0 + seekable: 1, + played: 2, + currentTime: 3, + duration: 4, + paused: 5, + volume: 6, + playbackRate: 7, + seeking: 8, + ended: 9 }); } } diff --git a/test/js/samples/reactive-values-non-topologically-ordered/expected.js b/test/js/samples/reactive-values-non-topologically-ordered/expected.js index 3d1b6aaae3..e4a4cc6605 100644 --- a/test/js/samples/reactive-values-non-topologically-ordered/expected.js +++ b/test/js/samples/reactive-values-non-topologically-ordered/expected.js @@ -7,20 +7,20 @@ function instance($$self, $$props, $$invalidate) { let b; $$self.$set = $$props => { - if ("x" in $$props) $$invalidate("x", x = $$props.x); + if ("x" in $$props) $$invalidate(0, x = $$props.x); }; - $$self.$$.update = (changed = { x: 1, b: 1 }) => { - if (changed.x) { + $$self.$$.update = () => { + if ($$self.$$.dirty & 1) { $: $$invalidate("b", b = x); } - if (changed.b) { + if ($$self.$$.dirty & 2) { $: a = b; } }; - return { x }; + return [x]; } class Component extends SvelteComponent { diff --git a/test/js/samples/reactive-values-non-writable-dependencies/expected.js b/test/js/samples/reactive-values-non-writable-dependencies/expected.js index 393af95df0..9c29f8510e 100644 --- a/test/js/samples/reactive-values-non-writable-dependencies/expected.js +++ b/test/js/samples/reactive-values-non-writable-dependencies/expected.js @@ -6,23 +6,23 @@ function instance($$self, $$props, $$invalidate) { let { b = 2 } = $$props; $$self.$set = $$props => { - if ("a" in $$props) $$invalidate("a", a = $$props.a); - if ("b" in $$props) $$invalidate("b", b = $$props.b); + if ("a" in $$props) $$invalidate(0, a = $$props.a); + if ("b" in $$props) $$invalidate(1, b = $$props.b); }; - $$self.$$.update = (changed = { a: 1, b: 1 }) => { - if (changed.a || changed.b) { + $$self.$$.update = () => { + if ($$self.$$.dirty & 3) { $: console.log("max", Math.max(a, b)); } }; - return { a, b }; + return [a, b]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, null, safe_not_equal, { a: 0, b: 0 }); + init(this, options, instance, null, safe_not_equal, { a: 0, b: 1 }); } } diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js index da284d977a..efa4662297 100644 --- a/test/js/samples/select-dynamic-value/expected.js +++ b/test/js/samples/select-dynamic-value/expected.js @@ -32,7 +32,7 @@ function create_fragment(ctx) { insert(target, select, anchor); append(select, option0); append(select, option1); - select_value_value = ctx.current; + select_value_value = ctx[0]; for (var i = 0; i < select.options.length; i += 1) { var option = select.options[i]; @@ -43,8 +43,8 @@ function create_fragment(ctx) { } } }, - p(changed, ctx) { - if (changed.current && select_value_value !== (select_value_value = ctx.current)) { + p(ctx, changed) { + if (changed & 1 && select_value_value !== (select_value_value = ctx[0])) { for (var i = 0; i < select.options.length; i += 1) { var option = select.options[i]; @@ -67,10 +67,10 @@ function instance($$self, $$props, $$invalidate) { let { current } = $$props; $$self.$set = $$props => { - if ("current" in $$props) $$invalidate("current", current = $$props.current); + if ("current" in $$props) $$invalidate(0, current = $$props.current); }; - return { current }; + return [current]; } class Component extends SvelteComponent { diff --git a/test/js/samples/src-attribute-check/expected.js b/test/js/samples/src-attribute-check/expected.js index 8af33a962b..bf11b3821d 100644 --- a/test/js/samples/src-attribute-check/expected.js +++ b/test/js/samples/src-attribute-check/expected.js @@ -35,21 +35,21 @@ function create_fragment(ctx) { }, h() { attr(img0, "alt", "potato"); - if (img0.src !== (img0_src_value = ctx.url)) attr(img0, "src", img0_src_value); + if (img0.src !== (img0_src_value = ctx[0])) attr(img0, "src", img0_src_value); attr(img1, "alt", "potato"); - if (img1.src !== (img1_src_value = "" + (ctx.slug + ".jpg"))) attr(img1, "src", img1_src_value); + if (img1.src !== (img1_src_value = "" + (ctx[1] + ".jpg"))) attr(img1, "src", img1_src_value); }, m(target, anchor) { insert(target, img0, anchor); insert(target, t, anchor); insert(target, img1, anchor); }, - p(changed, ctx) { - if (changed.url && img0.src !== (img0_src_value = ctx.url)) { + p(ctx, changed) { + if (changed & 1 && img0.src !== (img0_src_value = ctx[0])) { attr(img0, "src", img0_src_value); } - if (changed.slug && img1.src !== (img1_src_value = "" + (ctx.slug + ".jpg"))) { + if (changed & 2 && img1.src !== (img1_src_value = "" + (ctx[1] + ".jpg"))) { attr(img1, "src", img1_src_value); } }, @@ -68,17 +68,17 @@ function instance($$self, $$props, $$invalidate) { let { slug } = $$props; $$self.$set = $$props => { - if ("url" in $$props) $$invalidate("url", url = $$props.url); - if ("slug" in $$props) $$invalidate("slug", slug = $$props.slug); + if ("url" in $$props) $$invalidate(0, url = $$props.url); + if ("slug" in $$props) $$invalidate(1, slug = $$props.slug); }; - return { url, slug }; + return [url, slug]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { url: 0, slug: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { url: 0, slug: 1 }); } } diff --git a/test/js/samples/title/expected.js b/test/js/samples/title/expected.js index 205f352950..b091b2a516 100644 --- a/test/js/samples/title/expected.js +++ b/test/js/samples/title/expected.js @@ -3,13 +3,13 @@ import { SvelteComponent, init, noop, safe_not_equal } from "svelte/internal"; function create_fragment(ctx) { let title_value; - document.title = title_value = "a " + ctx.custom + " title"; + document.title = title_value = "a " + ctx[0] + " title"; return { c: noop, m: noop, - p(changed, ctx) { - if (changed.custom && title_value !== (title_value = "a " + ctx.custom + " title")) { + p(ctx, changed) { + if (changed & 1 && title_value !== (title_value = "a " + ctx[0] + " title")) { document.title = title_value; } }, @@ -23,10 +23,10 @@ function instance($$self, $$props, $$invalidate) { let { custom } = $$props; $$self.$set = $$props => { - if ("custom" in $$props) $$invalidate("custom", custom = $$props.custom); + if ("custom" in $$props) $$invalidate(0, custom = $$props.custom); }; - return { custom }; + return [custom]; } class Component extends SvelteComponent { diff --git a/test/js/samples/transition-local/expected.js b/test/js/samples/transition-local/expected.js index 7fa88f4254..63f3ec4692 100644 --- a/test/js/samples/transition-local/expected.js +++ b/test/js/samples/transition-local/expected.js @@ -15,7 +15,7 @@ import { function create_if_block(ctx) { let if_block_anchor; - let if_block = ctx.y && create_if_block_1(ctx); + let if_block = ctx[1] && create_if_block_1(ctx); return { c() { @@ -26,8 +26,8 @@ function create_if_block(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, - p(changed, ctx) { - if (ctx.y) { + p(ctx, changed) { + if (ctx[1]) { if (!if_block) { if_block = create_if_block_1(ctx); if_block.c(); @@ -80,7 +80,7 @@ function create_if_block_1(ctx) { function create_fragment(ctx) { let if_block_anchor; - let if_block = ctx.x && create_if_block(ctx); + let if_block = ctx[0] && create_if_block(ctx); return { c() { @@ -91,10 +91,10 @@ function create_fragment(ctx) { if (if_block) if_block.m(target, anchor); insert(target, if_block_anchor, anchor); }, - p(changed, ctx) { - if (ctx.x) { + p(ctx, changed) { + if (ctx[0]) { if (if_block) { - if_block.p(changed, ctx); + if_block.p(ctx, changed); } else { if_block = create_if_block(ctx); if_block.c(); @@ -115,7 +115,7 @@ function create_fragment(ctx) { } function foo() { - + } function instance($$self, $$props, $$invalidate) { @@ -123,17 +123,17 @@ function instance($$self, $$props, $$invalidate) { let { y } = $$props; $$self.$set = $$props => { - if ("x" in $$props) $$invalidate("x", x = $$props.x); - if ("y" in $$props) $$invalidate("y", y = $$props.y); + if ("x" in $$props) $$invalidate(0, x = $$props.x); + if ("y" in $$props) $$invalidate(1, y = $$props.y); }; - return { x, y }; + return [x, y]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { x: 0, y: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { x: 0, y: 1 }); } } diff --git a/test/js/samples/transition-repeated-outro/expected.js b/test/js/samples/transition-repeated-outro/expected.js index c40818dc4e..898bfb63a5 100644 --- a/test/js/samples/transition-repeated-outro/expected.js +++ b/test/js/samples/transition-repeated-outro/expected.js @@ -49,7 +49,7 @@ function create_if_block(ctx) { function create_fragment(ctx) { let if_block_anchor; let current; - let if_block = ctx.num < 5 && create_if_block(ctx); + let if_block = ctx[0] < 5 && create_if_block(ctx); return { c() { @@ -61,8 +61,8 @@ function create_fragment(ctx) { insert(target, if_block_anchor, anchor); current = true; }, - p(changed, ctx) { - if (ctx.num < 5) { + p(ctx, changed) { + if (ctx[0] < 5) { if (!if_block) { if_block = create_if_block(ctx); if_block.c(); @@ -101,10 +101,10 @@ function instance($$self, $$props, $$invalidate) { let { num = 1 } = $$props; $$self.$set = $$props => { - if ("num" in $$props) $$invalidate("num", num = $$props.num); + if ("num" in $$props) $$invalidate(0, num = $$props.num); }; - return { num }; + return [num]; } class Component extends SvelteComponent { diff --git a/test/js/samples/unchanged-expression/expected.js b/test/js/samples/unchanged-expression/expected.js index 231960bb49..f726af14a1 100644 --- a/test/js/samples/unchanged-expression/expected.js +++ b/test/js/samples/unchanged-expression/expected.js @@ -41,7 +41,7 @@ function create_fragment(ctx) { div1 = element("div"); p3 = element("p"); t8 = text("Hello "); - t9 = text(ctx.world3); + t9 = text(ctx[0]); }, m(target, anchor) { insert(target, div0, anchor); @@ -56,8 +56,8 @@ function create_fragment(ctx) { append(p3, t8); append(p3, t9); }, - p(changed, ctx) { - if (changed.world3) set_data(t9, ctx.world3); + p(ctx, changed) { + if (changed & 1) set_data(t9, ctx[0]); }, i: noop, o: noop, @@ -76,10 +76,10 @@ function instance($$self, $$props, $$invalidate) { const world3 = "world"; function foo() { - $$invalidate("world3", world3 = "svelte"); + $$invalidate(0, world3 = "svelte"); } - return { world3 }; + return [world3]; } class Component extends SvelteComponent { diff --git a/test/js/samples/unreferenced-state-not-invalidated/expected.js b/test/js/samples/unreferenced-state-not-invalidated/expected.js index f0409c3cca..f85026bc9b 100644 --- a/test/js/samples/unreferenced-state-not-invalidated/expected.js +++ b/test/js/samples/unreferenced-state-not-invalidated/expected.js @@ -21,14 +21,14 @@ function create_fragment(ctx) { return { c() { p = element("p"); - t = text(ctx.y); + t = text(ctx[0]); }, m(target, anchor) { insert(target, p, anchor); append(p, t); }, - p(changed, ctx) { - if (changed.y) set_data(t, ctx.y); + p(ctx, changed) { + if (changed & 1) set_data(t, ctx[0]); }, i: noop, o: noop, @@ -44,7 +44,7 @@ function instance($$self, $$props, $$invalidate) { onMount(() => { const interval = setInterval( () => { - $$invalidate("b", b += 1); + $$invalidate(1, b += 1); c += 1; console.log(b, c); }, @@ -57,17 +57,17 @@ function instance($$self, $$props, $$invalidate) { let x; let y; - $$self.$$.update = (changed = { a: 1, b: 1 }) => { - if (changed.a) { + $$self.$$.update = () => { + if ($$self.$$.dirty === -1) { $: x = a * 2; } - if (changed.b) { - $: $$invalidate("y", y = b * 2); + if ($$self.$$.dirty & 2) { + $: $$invalidate(0, y = b * 2); } }; - return { y }; + return [y]; } class Component extends SvelteComponent { diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index eeaba55ed0..fc77218bf8 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -112,11 +112,11 @@ function create_fragment(ctx) { let t6; let t7; let if_block4_anchor; - let if_block0 = ctx.a && create_if_block_4(ctx); - let if_block1 = ctx.b && create_if_block_3(ctx); - let if_block2 = ctx.c && create_if_block_2(ctx); - let if_block3 = ctx.d && create_if_block_1(ctx); - let if_block4 = ctx.e && create_if_block(ctx); + let if_block0 = ctx[0] && create_if_block_4(ctx); + let if_block1 = ctx[1] && create_if_block_3(ctx); + let if_block2 = ctx[2] && create_if_block_2(ctx); + let if_block3 = ctx[3] && create_if_block_1(ctx); + let if_block4 = ctx[4] && create_if_block(ctx); return { c() { @@ -155,66 +155,66 @@ function create_fragment(ctx) { if (if_block4) if_block4.m(target, anchor); insert(target, if_block4_anchor, anchor); }, - p(changed, ctx) { - if (ctx.a) { + p(ctx, changed) { + if (ctx[0]) { if (!if_block0) { if_block0 = create_if_block_4(ctx); if_block0.c(); if_block0.m(div, t0); } else { - + } } else if (if_block0) { if_block0.d(1); if_block0 = null; } - if (ctx.b) { + if (ctx[1]) { if (!if_block1) { if_block1 = create_if_block_3(ctx); if_block1.c(); if_block1.m(div, t3); } else { - + } } else if (if_block1) { if_block1.d(1); if_block1 = null; } - if (ctx.c) { + if (ctx[2]) { if (!if_block2) { if_block2 = create_if_block_2(ctx); if_block2.c(); if_block2.m(div, t4); } else { - + } } else if (if_block2) { if_block2.d(1); if_block2 = null; } - if (ctx.d) { + if (ctx[3]) { if (!if_block3) { if_block3 = create_if_block_1(ctx); if_block3.c(); if_block3.m(div, null); } else { - + } } else if (if_block3) { if_block3.d(1); if_block3 = null; } - if (ctx.e) { + if (ctx[4]) { if (!if_block4) { if_block4 = create_if_block(ctx); if_block4.c(); if_block4.m(if_block4_anchor.parentNode, if_block4_anchor); } else { - + } } else if (if_block4) { if_block4.d(1); @@ -244,20 +244,20 @@ function instance($$self, $$props, $$invalidate) { let { e } = $$props; $$self.$set = $$props => { - if ("a" in $$props) $$invalidate("a", a = $$props.a); - if ("b" in $$props) $$invalidate("b", b = $$props.b); - if ("c" in $$props) $$invalidate("c", c = $$props.c); - if ("d" in $$props) $$invalidate("d", d = $$props.d); - if ("e" in $$props) $$invalidate("e", e = $$props.e); + if ("a" in $$props) $$invalidate(0, a = $$props.a); + if ("b" in $$props) $$invalidate(1, b = $$props.b); + if ("c" in $$props) $$invalidate(2, c = $$props.c); + if ("d" in $$props) $$invalidate(3, d = $$props.d); + if ("e" in $$props) $$invalidate(4, e = $$props.e); }; - return { a, b, c, d, e }; + return [a, b, c, d, e]; } class Component extends SvelteComponent { constructor(options) { super(); - init(this, options, instance, create_fragment, safe_not_equal, { a: 0, b: 0, c: 0, d: 0, e: 0 }); + init(this, options, instance, create_fragment, safe_not_equal, { a: 0, b: 1, c: 2, d: 3, e: 4 }); } } diff --git a/test/js/samples/video-bindings/expected.js b/test/js/samples/video-bindings/expected.js index e0e7707577..43241d51ff 100644 --- a/test/js/samples/video-bindings/expected.js +++ b/test/js/samples/video-bindings/expected.js @@ -29,27 +29,27 @@ function create_fragment(ctx) { video_updating = true; } - ctx.video_timeupdate_handler.call(video); + ctx[5].call(video); } return { c() { video = element("video"); - add_render_callback(() => ctx.video_elementresize_handler.call(video)); - if (ctx.videoHeight === void 0 || ctx.videoWidth === void 0) add_render_callback(() => ctx.video_resize_handler.call(video)); + add_render_callback(() => ctx[4].call(video)); + if (ctx[1] === void 0 || ctx[2] === void 0) add_render_callback(() => ctx[6].call(video)); dispose = [ listen(video, "timeupdate", video_timeupdate_handler), - listen(video, "resize", ctx.video_resize_handler) + listen(video, "resize", ctx[6]) ]; }, m(target, anchor) { insert(target, video, anchor); - video_resize_listener = add_resize_listener(video, ctx.video_elementresize_handler.bind(video)); + video_resize_listener = add_resize_listener(video, ctx[4].bind(video)); }, - p(changed, ctx) { - if (!video_updating && changed.currentTime && !isNaN(ctx.currentTime)) { - video.currentTime = ctx.currentTime; + p(ctx, changed) { + if (!video_updating && changed & 1 && !isNaN(ctx[0])) { + video.currentTime = ctx[0]; } video_updating = false; @@ -72,29 +72,29 @@ function instance($$self, $$props, $$invalidate) { function video_elementresize_handler() { offsetWidth = this.offsetWidth; - $$invalidate("offsetWidth", offsetWidth); + $$invalidate(3, offsetWidth); } function video_timeupdate_handler() { currentTime = this.currentTime; - $$invalidate("currentTime", currentTime); + $$invalidate(0, currentTime); } function video_resize_handler() { videoHeight = this.videoHeight; videoWidth = this.videoWidth; - $$invalidate("videoHeight", videoHeight); - $$invalidate("videoWidth", videoWidth); + $$invalidate(1, videoHeight); + $$invalidate(2, videoWidth); } $$self.$set = $$props => { - if ("currentTime" in $$props) $$invalidate("currentTime", currentTime = $$props.currentTime); - if ("videoHeight" in $$props) $$invalidate("videoHeight", videoHeight = $$props.videoHeight); - if ("videoWidth" in $$props) $$invalidate("videoWidth", videoWidth = $$props.videoWidth); - if ("offsetWidth" in $$props) $$invalidate("offsetWidth", offsetWidth = $$props.offsetWidth); + if ("currentTime" in $$props) $$invalidate(0, currentTime = $$props.currentTime); + if ("videoHeight" in $$props) $$invalidate(1, videoHeight = $$props.videoHeight); + if ("videoWidth" in $$props) $$invalidate(2, videoWidth = $$props.videoWidth); + if ("offsetWidth" in $$props) $$invalidate(3, offsetWidth = $$props.offsetWidth); }; - return { + return [ currentTime, videoHeight, videoWidth, @@ -102,7 +102,7 @@ function instance($$self, $$props, $$invalidate) { video_elementresize_handler, video_timeupdate_handler, video_resize_handler - }; + ]; } class Component extends SvelteComponent { @@ -111,9 +111,9 @@ class Component extends SvelteComponent { init(this, options, instance, create_fragment, safe_not_equal, { currentTime: 0, - videoHeight: 0, - videoWidth: 0, - offsetWidth: 0 + videoHeight: 1, + videoWidth: 2, + offsetWidth: 3 }); } } diff --git a/test/js/samples/window-binding-online/expected.js b/test/js/samples/window-binding-online/expected.js index d34e84330f..a2e0c0b89d 100644 --- a/test/js/samples/window-binding-online/expected.js +++ b/test/js/samples/window-binding-online/expected.js @@ -11,14 +11,11 @@ import { function create_fragment(ctx) { let dispose; - add_render_callback(ctx.onlinestatuschanged); + add_render_callback(ctx[1]); return { c() { - dispose = [ - listen(window, "online", ctx.onlinestatuschanged), - listen(window, "offline", ctx.onlinestatuschanged) - ]; + dispose = [listen(window, "online", ctx[1]), listen(window, "offline", ctx[1])]; }, m: noop, p: noop, @@ -34,10 +31,10 @@ function instance($$self, $$props, $$invalidate) { let online; function onlinestatuschanged() { - $$invalidate("online", online = navigator.onLine); + $$invalidate(0, online = navigator.onLine); } - return { online, onlinestatuschanged }; + return [online, onlinestatuschanged]; } class Component extends SvelteComponent { diff --git a/test/js/samples/window-binding-scroll/expected.js b/test/js/samples/window-binding-scroll/expected.js index 85d894119b..254fb81966 100644 --- a/test/js/samples/window-binding-scroll/expected.js +++ b/test/js/samples/window-binding-scroll/expected.js @@ -26,19 +26,19 @@ function create_fragment(ctx) { let t0; let t1; let dispose; - add_render_callback(ctx.onwindowscroll); + add_render_callback(ctx[1]); return { c() { p = element("p"); t0 = text("scrolled to "); - t1 = text(ctx.y); + t1 = text(ctx[0]); dispose = listen(window, "scroll", () => { scrolling = true; clearTimeout(scrolling_timeout); scrolling_timeout = setTimeout(clear_scrolling, 100); - ctx.onwindowscroll(); + ctx[1](); }); }, m(target, anchor) { @@ -46,15 +46,15 @@ function create_fragment(ctx) { append(p, t0); append(p, t1); }, - p(changed, ctx) { - if (changed.y && !scrolling) { + p(ctx, changed) { + if (changed & 1 && !scrolling) { scrolling = true; clearTimeout(scrolling_timeout); - scrollTo(window.pageXOffset, ctx.y); + scrollTo(window.pageXOffset, ctx[0]); scrolling_timeout = setTimeout(clear_scrolling, 100); } - if (changed.y) set_data(t1, ctx.y); + if (changed & 1) set_data(t1, ctx[0]); }, i: noop, o: noop, @@ -69,14 +69,14 @@ function instance($$self, $$props, $$invalidate) { let { y } = $$props; function onwindowscroll() { - $$invalidate("y", y = window.pageYOffset) + $$invalidate(0, y = window.pageYOffset) } $$self.$set = $$props => { - if ("y" in $$props) $$invalidate("y", y = $$props.y); + if ("y" in $$props) $$invalidate(0, y = $$props.y); }; - return { y, onwindowscroll }; + return [y, onwindowscroll]; } class Component extends SvelteComponent {