this is styled
this is unstyled
diff --git a/test/css/samples/spread/input.svelte b/test/css/samples/spread/input.svelte
index ab5f2e937e..aa43e4ae11 100644
--- a/test/css/samples/spread/input.svelte
+++ b/test/css/samples/spread/input.svelte
@@ -1,3 +1,7 @@
+
+
Big red Comic Sans
diff --git a/test/css/samples/unused-selector-ternary/_config.js b/test/css/samples/unused-selector-ternary/_config.js
index 68254477d9..4ff2713108 100644
--- a/test/css/samples/unused-selector-ternary/_config.js
+++ b/test/css/samples/unused-selector-ternary/_config.js
@@ -8,22 +8,22 @@ export default {
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {
- line: 12,
+ line: 16,
column: 1,
- character: 123
+ character: 163
},
end: {
- line: 12,
+ line: 16,
column: 13,
- character: 135
+ character: 175
},
- pos: 123,
+ pos: 163,
frame: `
- 10: }
- 11:
- 12: .maybeactive {
+ 14: }
+ 15:
+ 16: .maybeactive {
^
- 13: color: green;
- 14: }`
+ 17: color: green;
+ 18: }`
}]
};
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-ternary/input.svelte b/test/css/samples/unused-selector-ternary/input.svelte
index 728dfa766a..f72592834f 100644
--- a/test/css/samples/unused-selector-ternary/input.svelte
+++ b/test/css/samples/unused-selector-ternary/input.svelte
@@ -1,3 +1,7 @@
+
+
`;
- init(this, { target: this.shadowRoot }, null, create_fragment, safe_not_equal);
+ init(this, { target: this.shadowRoot }, null, create_fragment, safe_not_equal, []);
if (options) {
if (options.target) {
diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js
index 4a6393388c..efe966c552 100644
--- a/test/js/samples/debug-empty/expected.js
+++ b/test/js/samples/debug-empty/expected.js
@@ -1,20 +1,33 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponentDev, addLoc, append, createElement, createText, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
+import {
+ SvelteComponentDev,
+ add_location,
+ append,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ set_data,
+ space,
+ text
+} from "svelte/internal";
const file = undefined;
function create_fragment(ctx) {
- var h1, text0, text1, text2, text3;
+ var h1, t0, t1, t2, t3;
return {
c: function create() {
- h1 = createElement("h1");
- text0 = createText("Hello ");
- text1 = createText(ctx.name);
- text2 = createText("!");
- text3 = createText("\n");
+ h1 = element("h1");
+ t0 = text("Hello ");
+ t1 = text(ctx.name);
+ t2 = text("!");
+ t3 = space();
debugger;
- addLoc(h1, file, 0, 0, 0);
+ add_location(h1, file, 4, 0, 38);
},
l: function claim(nodes) {
@@ -23,15 +36,15 @@ function create_fragment(ctx) {
m: function mount(target, anchor) {
insert(target, h1, anchor);
- append(h1, text0);
- append(h1, text1);
- append(h1, text2);
- insert(target, text3, anchor);
+ append(h1, t0);
+ append(h1, t1);
+ append(h1, t2);
+ insert(target, t3, anchor);
},
p: function update(changed, ctx) {
if (changed.name) {
- setData(text1, ctx.name);
+ set_data(t1, ctx.name);
}
debugger;
@@ -40,10 +53,10 @@ function create_fragment(ctx) {
i: noop,
o: noop,
- d: function destroy(detach) {
- if (detach) {
- detachNode(h1);
- detachNode(text3);
+ d: function destroy(detaching) {
+ if (detaching) {
+ detach(h1);
+ detach(t3);
}
}
};
@@ -62,7 +75,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev {
constructor(options) {
super(options);
- init(this, options, instance, create_fragment, safe_not_equal);
+ init(this, options, instance, create_fragment, safe_not_equal, ["name"]);
const { ctx } = this.$$;
const props = options.props || {};
@@ -72,12 +85,11 @@ class SvelteComponent extends SvelteComponentDev {
}
get name() {
- return this.$$.ctx.name;
+ throw new Error("
: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set name(name) {
- this.$set({ name });
- flush();
+ set name(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
}
diff --git a/test/js/samples/debug-empty/input.svelte b/test/js/samples/debug-empty/input.svelte
index 11da4f6d15..24f03b00c1 100644
--- a/test/js/samples/debug-empty/input.svelte
+++ b/test/js/samples/debug-empty/input.svelte
@@ -1,2 +1,6 @@
+
+
Hello {name}!
{@debug}
\ No newline at end of file
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 b56d333238..0220664d12 100644
--- a/test/js/samples/debug-foo-bar-baz-things/expected.js
+++ b/test/js/samples/debug-foo-bar-baz-things/expected.js
@@ -1,5 +1,19 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponentDev, addLoc, append, createElement, createText, destroyEach, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
+import {
+ SvelteComponentDev,
+ add_location,
+ append,
+ destroy_each,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ set_data,
+ space,
+ text
+} from "svelte/internal";
const file = undefined;
@@ -9,33 +23,33 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
-// (1:0) {#each things as thing}
+// (8:0) {#each things as thing}
function create_each_block(ctx) {
- var span, text0_value = ctx.thing.name, text0, text1;
+ var span, t0_value = ctx.thing.name, t0, t1;
return {
c: function create() {
- span = createElement("span");
- text0 = createText(text0_value);
- text1 = createText("\n\t");
+ span = element("span");
+ t0 = text(t0_value);
+ t1 = space();
{
const { foo, bar, baz, thing } = ctx;
console.log({ foo, bar, baz, thing });
debugger;
}
- addLoc(span, file, 1, 1, 25);
+ add_location(span, file, 8, 1, 116);
},
m: function mount(target, anchor) {
insert(target, span, anchor);
- append(span, text0);
- insert(target, text1, anchor);
+ append(span, t0);
+ insert(target, t1, anchor);
},
p: function update(changed, ctx) {
- if ((changed.things) && text0_value !== (text0_value = ctx.thing.name)) {
- setData(text0, text0_value);
+ if ((changed.things) && t0_value !== (t0_value = ctx.thing.name)) {
+ set_data(t0, t0_value);
}
if (changed.foo || changed.bar || changed.baz || changed.things) {
@@ -45,17 +59,17 @@ function create_each_block(ctx) {
}
},
- d: function destroy(detach) {
- if (detach) {
- detachNode(span);
- detachNode(text1);
+ d: function destroy(detaching) {
+ if (detaching) {
+ detach(span);
+ detach(t1);
}
}
};
}
function create_fragment(ctx) {
- var text0, p, text1, text2;
+ var t0, p, t1, t2;
var each_value = ctx.things;
@@ -71,11 +85,11 @@ function create_fragment(ctx) {
each_blocks[i].c();
}
- text0 = createText("\n\n");
- p = createElement("p");
- text1 = createText("foo: ");
- text2 = createText(ctx.foo);
- addLoc(p, file, 5, 0, 91);
+ t0 = space();
+ p = element("p");
+ t1 = text("foo: ");
+ t2 = text(ctx.foo);
+ add_location(p, file, 12, 0, 182);
},
l: function claim(nodes) {
@@ -87,10 +101,10 @@ function create_fragment(ctx) {
each_blocks[i].m(target, anchor);
}
- insert(target, text0, anchor);
+ insert(target, t0, anchor);
insert(target, p, anchor);
- append(p, text1);
- append(p, text2);
+ append(p, t1);
+ append(p, t2);
},
p: function update(changed, ctx) {
@@ -105,7 +119,7 @@ function create_fragment(ctx) {
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
- each_blocks[i].m(text0.parentNode, text0);
+ each_blocks[i].m(t0.parentNode, t0);
}
}
@@ -116,19 +130,19 @@ function create_fragment(ctx) {
}
if (changed.foo) {
- setData(text2, ctx.foo);
+ set_data(t2, ctx.foo);
}
},
i: noop,
o: noop,
- d: function destroy(detach) {
- destroyEach(each_blocks, detach);
+ d: function destroy(detaching) {
+ destroy_each(each_blocks, detaching);
- if (detach) {
- detachNode(text0);
- detachNode(p);
+ if (detaching) {
+ detach(t0);
+ detach(p);
}
}
};
@@ -150,7 +164,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev {
constructor(options) {
super(options);
- init(this, options, instance, create_fragment, safe_not_equal);
+ init(this, options, instance, create_fragment, safe_not_equal, ["things", "foo", "bar", "baz"]);
const { ctx } = this.$$;
const props = options.props || {};
@@ -169,39 +183,35 @@ class SvelteComponent extends SvelteComponentDev {
}
get things() {
- return this.$$.ctx.things;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set things(things) {
- this.$set({ things });
- flush();
+ set things(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
get foo() {
- return this.$$.ctx.foo;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set foo(foo) {
- this.$set({ foo });
- flush();
+ set foo(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
get bar() {
- return this.$$.ctx.bar;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set bar(bar) {
- this.$set({ bar });
- flush();
+ set bar(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
get baz() {
- return this.$$.ctx.baz;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set baz(baz) {
- this.$set({ baz });
- flush();
+ set baz(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
}
diff --git a/test/js/samples/debug-foo-bar-baz-things/input.svelte b/test/js/samples/debug-foo-bar-baz-things/input.svelte
index 6fa8611415..df6095c52d 100644
--- a/test/js/samples/debug-foo-bar-baz-things/input.svelte
+++ b/test/js/samples/debug-foo-bar-baz-things/input.svelte
@@ -1,3 +1,10 @@
+
+
{#each things as thing}
{thing.name}
{@debug foo, bar, baz, thing}
diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js
index 35d0a1f18f..ccd5f14ec4 100644
--- a/test/js/samples/debug-foo/expected.js
+++ b/test/js/samples/debug-foo/expected.js
@@ -1,5 +1,19 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponentDev, addLoc, append, createElement, createText, destroyEach, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
+import {
+ SvelteComponentDev,
+ add_location,
+ append,
+ destroy_each,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ set_data,
+ space,
+ text
+} from "svelte/internal";
const file = undefined;
@@ -9,33 +23,33 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
-// (1:0) {#each things as thing}
+// (6:0) {#each things as thing}
function create_each_block(ctx) {
- var span, text0_value = ctx.thing.name, text0, text1;
+ var span, t0_value = ctx.thing.name, t0, t1;
return {
c: function create() {
- span = createElement("span");
- text0 = createText(text0_value);
- text1 = createText("\n\t");
+ span = element("span");
+ t0 = text(t0_value);
+ t1 = space();
{
const { foo } = ctx;
console.log({ foo });
debugger;
}
- addLoc(span, file, 1, 1, 25);
+ add_location(span, file, 6, 1, 82);
},
m: function mount(target, anchor) {
insert(target, span, anchor);
- append(span, text0);
- insert(target, text1, anchor);
+ append(span, t0);
+ insert(target, t1, anchor);
},
p: function update(changed, ctx) {
- if ((changed.things) && text0_value !== (text0_value = ctx.thing.name)) {
- setData(text0, text0_value);
+ if ((changed.things) && t0_value !== (t0_value = ctx.thing.name)) {
+ set_data(t0, t0_value);
}
if (changed.foo) {
@@ -45,17 +59,17 @@ function create_each_block(ctx) {
}
},
- d: function destroy(detach) {
- if (detach) {
- detachNode(span);
- detachNode(text1);
+ d: function destroy(detaching) {
+ if (detaching) {
+ detach(span);
+ detach(t1);
}
}
};
}
function create_fragment(ctx) {
- var text0, p, text1, text2;
+ var t0, p, t1, t2;
var each_value = ctx.things;
@@ -71,11 +85,11 @@ function create_fragment(ctx) {
each_blocks[i].c();
}
- text0 = createText("\n\n");
- p = createElement("p");
- text1 = createText("foo: ");
- text2 = createText(ctx.foo);
- addLoc(p, file, 5, 0, 74);
+ t0 = space();
+ p = element("p");
+ t1 = text("foo: ");
+ t2 = text(ctx.foo);
+ add_location(p, file, 10, 0, 131);
},
l: function claim(nodes) {
@@ -87,10 +101,10 @@ function create_fragment(ctx) {
each_blocks[i].m(target, anchor);
}
- insert(target, text0, anchor);
+ insert(target, t0, anchor);
insert(target, p, anchor);
- append(p, text1);
- append(p, text2);
+ append(p, t1);
+ append(p, t2);
},
p: function update(changed, ctx) {
@@ -105,7 +119,7 @@ function create_fragment(ctx) {
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
- each_blocks[i].m(text0.parentNode, text0);
+ each_blocks[i].m(t0.parentNode, t0);
}
}
@@ -116,19 +130,19 @@ function create_fragment(ctx) {
}
if (changed.foo) {
- setData(text2, ctx.foo);
+ set_data(t2, ctx.foo);
}
},
i: noop,
o: noop,
- d: function destroy(detach) {
- destroyEach(each_blocks, detach);
+ d: function destroy(detaching) {
+ destroy_each(each_blocks, detaching);
- if (detach) {
- detachNode(text0);
- detachNode(p);
+ if (detaching) {
+ detach(t0);
+ detach(p);
}
}
};
@@ -148,7 +162,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev {
constructor(options) {
super(options);
- init(this, options, instance, create_fragment, safe_not_equal);
+ init(this, options, instance, create_fragment, safe_not_equal, ["things", "foo"]);
const { ctx } = this.$$;
const props = options.props || {};
@@ -161,21 +175,19 @@ class SvelteComponent extends SvelteComponentDev {
}
get things() {
- return this.$$.ctx.things;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set things(things) {
- this.$set({ things });
- flush();
+ set things(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
get foo() {
- return this.$$.ctx.foo;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set foo(foo) {
- this.$set({ foo });
- flush();
+ set foo(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
}
diff --git a/test/js/samples/debug-foo/input.svelte b/test/js/samples/debug-foo/input.svelte
index 6e926a4015..553f080d94 100644
--- a/test/js/samples/debug-foo/input.svelte
+++ b/test/js/samples/debug-foo/input.svelte
@@ -1,3 +1,8 @@
+
+
{#each things as thing}
{thing.name}
{@debug foo}
diff --git a/test/js/samples/debug-ssr-foo/expected.js b/test/js/samples/debug-ssr-foo/expected.js
index afad023a3f..02bbec5fba 100644
--- a/test/js/samples/debug-ssr-foo/expected.js
+++ b/test/js/samples/debug-ssr-foo/expected.js
@@ -1,11 +1,19 @@
/* generated by Svelte vX.Y.Z */
-import { create_ssr_component, debug, each, escape } from "svelte/internal";
+import {
+ create_ssr_component,
+ debug,
+ each,
+ escape
+} from "svelte/internal";
const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
let { things, foo } = $$props;
+ if ($$props.things === void 0 && $$bindings.things && things !== void 0) $$bindings.things(things);
+ if ($$props.foo === void 0 && $$bindings.foo && foo !== void 0) $$bindings.foo(foo);
+
return `${each(things, (thing) => `${escape(thing.name)}
- ${debug(null, 2, 2, { foo })}`)}
+ ${debug(null, 7, 2, { foo })}`)}
foo: ${escape(foo)}
`;
});
diff --git a/test/js/samples/debug-ssr-foo/input.svelte b/test/js/samples/debug-ssr-foo/input.svelte
index 6e926a4015..553f080d94 100644
--- a/test/js/samples/debug-ssr-foo/input.svelte
+++ b/test/js/samples/debug-ssr-foo/input.svelte
@@ -1,3 +1,8 @@
+
+
{#each things as thing}
{thing.name}
{@debug foo}
diff --git a/test/js/samples/deconflict-builtins/expected.js b/test/js/samples/deconflict-builtins/expected.js
index 7ad954e330..32bbdb4394 100644
--- a/test/js/samples/deconflict-builtins/expected.js
+++ b/test/js/samples/deconflict-builtins/expected.js
@@ -1,5 +1,18 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponent as SvelteComponent_1, append, createComment, createElement as createElement_1, createText, destroyEach, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
+import {
+ SvelteComponent as SvelteComponent_1,
+ append,
+ comment,
+ destroy_each,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ set_data,
+ text
+} from "svelte/internal";
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
@@ -7,37 +20,37 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
-// (1:0) {#each createElement as node}
+// (5:0) {#each createElement as node}
function create_each_block(ctx) {
- var span, text_value = ctx.node, text;
+ var span, t_value = ctx.node, t;
return {
c() {
- span = createElement_1("span");
- text = createText(text_value);
+ span = element("span");
+ t = text(t_value);
},
m(target, anchor) {
insert(target, span, anchor);
- append(span, text);
+ append(span, t);
},
p(changed, ctx) {
- if ((changed.createElement) && text_value !== (text_value = ctx.node)) {
- setData(text, text_value);
+ if ((changed.createElement) && t_value !== (t_value = ctx.node)) {
+ set_data(t, t_value);
}
},
- d(detach) {
- if (detach) {
- detachNode(span);
+ d(detaching) {
+ if (detaching) {
+ detach(span);
}
}
};
}
function create_fragment(ctx) {
- var each_anchor;
+ var each_1_anchor;
var each_value = ctx.createElement;
@@ -53,7 +66,7 @@ function create_fragment(ctx) {
each_blocks[i].c();
}
- each_anchor = createComment();
+ each_1_anchor = comment();
},
m(target, anchor) {
@@ -61,7 +74,7 @@ function create_fragment(ctx) {
each_blocks[i].m(target, anchor);
}
- insert(target, each_anchor, anchor);
+ insert(target, each_1_anchor, anchor);
},
p(changed, ctx) {
@@ -76,7 +89,7 @@ function create_fragment(ctx) {
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
- each_blocks[i].m(each_anchor.parentNode, each_anchor);
+ each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
}
}
@@ -90,11 +103,11 @@ function create_fragment(ctx) {
i: noop,
o: noop,
- d(detach) {
- destroyEach(each_blocks, detach);
+ d(detaching) {
+ destroy_each(each_blocks, detaching);
- if (detach) {
- detachNode(each_anchor);
+ if (detaching) {
+ detach(each_1_anchor);
}
}
};
@@ -113,16 +126,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal);
- }
-
- get createElement() {
- return this.$$.ctx.createElement;
- }
-
- set createElement(createElement) {
- this.$set({ createElement });
- flush();
+ init(this, options, instance, create_fragment, safe_not_equal, ["createElement"]);
}
}
diff --git a/test/js/samples/deconflict-builtins/input.svelte b/test/js/samples/deconflict-builtins/input.svelte
index 48a413b323..01052de947 100644
--- a/test/js/samples/deconflict-builtins/input.svelte
+++ b/test/js/samples/deconflict-builtins/input.svelte
@@ -1,3 +1,7 @@
+
+
{#each createElement as node}
{node}
{/each}
\ No newline at end of file
diff --git a/test/js/samples/deconflict-globals/expected.js b/test/js/samples/deconflict-globals/expected.js
index f3e8c93ebe..fe941d2b24 100644
--- a/test/js/samples/deconflict-globals/expected.js
+++ b/test/js/samples/deconflict-globals/expected.js
@@ -1,5 +1,10 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponent as SvelteComponent_1, flush, init, noop, safe_not_equal } from "svelte/internal";
+import {
+ SvelteComponent as SvelteComponent_1,
+ init,
+ noop,
+ safe_not_equal
+} from "svelte/internal";
import { onMount } from "svelte";
function create_fragment(ctx) {
@@ -30,16 +35,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal);
- }
-
- get foo() {
- return this.$$.ctx.foo;
- }
-
- set foo(foo) {
- this.$set({ foo });
- flush();
+ init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
}
}
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 dcd1078a6d..3840e9544d 100644
--- a/test/js/samples/dev-warning-missing-data-computed/expected.js
+++ b/test/js/samples/dev-warning-missing-data-computed/expected.js
@@ -1,18 +1,31 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponentDev, addLoc, append, createElement, createText, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
+import {
+ SvelteComponentDev,
+ add_location,
+ append,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ set_data,
+ space,
+ text
+} from "svelte/internal";
const file = undefined;
function create_fragment(ctx) {
- var p, text0_value = Math.max(0, ctx.foo), text0, text1, text2;
+ var p, t0_value = Math.max(0, ctx.foo), t0, t1, t2;
return {
c: function create() {
- p = createElement("p");
- text0 = createText(text0_value);
- text1 = createText("\n\t");
- text2 = createText(ctx.bar);
- addLoc(p, file, 7, 0, 67);
+ p = element("p");
+ t0 = text(t0_value);
+ t1 = space();
+ t2 = text(ctx.bar);
+ add_location(p, file, 7, 0, 67);
},
l: function claim(nodes) {
@@ -21,27 +34,27 @@ function create_fragment(ctx) {
m: function mount(target, anchor) {
insert(target, p, anchor);
- append(p, text0);
- append(p, text1);
- append(p, text2);
+ append(p, t0);
+ append(p, t1);
+ append(p, t2);
},
p: function update(changed, ctx) {
- if ((changed.foo) && text0_value !== (text0_value = Math.max(0, ctx.foo))) {
- setData(text0, text0_value);
+ if ((changed.foo) && t0_value !== (t0_value = Math.max(0, ctx.foo))) {
+ set_data(t0, t0_value);
}
if (changed.bar) {
- setData(text2, ctx.bar);
+ set_data(t2, ctx.bar);
}
},
i: noop,
o: noop,
- d: function destroy(detach) {
- if (detach) {
- detachNode(p);
+ d: function destroy(detaching) {
+ if (detaching) {
+ detach(p);
}
}
};
@@ -68,7 +81,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev {
constructor(options) {
super(options);
- init(this, options, instance, create_fragment, safe_not_equal);
+ init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
const { ctx } = this.$$;
const props = options.props || {};
@@ -78,12 +91,11 @@ class SvelteComponent extends SvelteComponentDev {
}
get foo() {
- return this.$$.ctx.foo;
+ throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''");
}
- set foo(foo) {
- this.$set({ foo });
- flush();
+ set foo(value) {
+ throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''");
}
}
diff --git a/test/js/samples/do-use-dataset/expected.js b/test/js/samples/do-use-dataset/expected.js
index f340f71b01..60a8c54869 100644
--- a/test/js/samples/do-use-dataset/expected.js
+++ b/test/js/samples/do-use-dataset/expected.js
@@ -1,21 +1,30 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponent as SvelteComponent_1, createElement, createText, detachNode, flush, init, insert, noop, safe_not_equal } from "svelte/internal";
+import {
+ SvelteComponent as SvelteComponent_1,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ space
+} from "svelte/internal";
function create_fragment(ctx) {
- var div0, text, div1;
+ var div0, t, div1;
return {
c() {
- div0 = createElement("div");
- text = createText("\n");
- div1 = createElement("div");
+ div0 = element("div");
+ t = space();
+ div1 = element("div");
div0.dataset.foo = "bar";
div1.dataset.foo = ctx.bar;
},
m(target, anchor) {
insert(target, div0, anchor);
- insert(target, text, anchor);
+ insert(target, t, anchor);
insert(target, div1, anchor);
},
@@ -28,11 +37,11 @@ function create_fragment(ctx) {
i: noop,
o: noop,
- d(detach) {
- if (detach) {
- detachNode(div0);
- detachNode(text);
- detachNode(div1);
+ d(detaching) {
+ if (detaching) {
+ detach(div0);
+ detach(t);
+ detach(div1);
}
}
};
@@ -51,16 +60,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal);
- }
-
- get bar() {
- return this.$$.ctx.bar;
- }
-
- set bar(bar) {
- this.$set({ bar });
- flush();
+ init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
diff --git a/test/js/samples/do-use-dataset/input.svelte b/test/js/samples/do-use-dataset/input.svelte
index ffd72ac6ee..e340b2610f 100644
--- a/test/js/samples/do-use-dataset/input.svelte
+++ b/test/js/samples/do-use-dataset/input.svelte
@@ -1,2 +1,6 @@
+
+
\ No newline at end of file
diff --git a/test/js/samples/dont-invalidate-this/expected.js b/test/js/samples/dont-invalidate-this/expected.js
index db21ccdd64..2b3cd63514 100644
--- a/test/js/samples/dont-invalidate-this/expected.js
+++ b/test/js/samples/dont-invalidate-this/expected.js
@@ -1,13 +1,22 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, init, insert, noop, safe_not_equal } from "svelte/internal";
+import {
+ SvelteComponent as SvelteComponent_1,
+ detach,
+ element,
+ init,
+ insert,
+ listen,
+ noop,
+ safe_not_equal
+} from "svelte/internal";
function create_fragment(ctx) {
var input, dispose;
return {
c() {
- input = createElement("input");
- dispose = addListener(input, "input", make_uppercase);
+ input = element("input");
+ dispose = listen(input, "input", make_uppercase);
},
m(target, anchor) {
@@ -18,9 +27,9 @@ function create_fragment(ctx) {
i: noop,
o: noop,
- d(detach) {
- if (detach) {
- detachNode(input);
+ d(detaching) {
+ if (detaching) {
+ detach(input);
}
dispose();
@@ -35,8 +44,8 @@ function make_uppercase() {
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
- init(this, options, null, create_fragment, safe_not_equal);
+ init(this, options, null, create_fragment, safe_not_equal, []);
}
}
-export default SvelteComponent;
+export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected.js b/test/js/samples/dont-use-dataset-in-legacy/expected.js
index 974ed23b28..4d63cb8c73 100644
--- a/test/js/samples/dont-use-dataset-in-legacy/expected.js
+++ b/test/js/samples/dont-use-dataset-in-legacy/expected.js
@@ -1,38 +1,48 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponent as SvelteComponent_1, createElement, createText, detachNode, flush, init, insert, noop, safe_not_equal, setAttribute } from "svelte/internal";
+import {
+ SvelteComponent as SvelteComponent_1,
+ attr,
+ detach,
+ element,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ space
+} from "svelte/internal";
function create_fragment(ctx) {
- var div0, text, div1;
+ var div0, t, div1;
return {
c() {
- div0 = createElement("div");
- text = createText("\n");
- div1 = createElement("div");
- setAttribute(div0, "data-foo", "bar");
- setAttribute(div1, "data-foo", ctx.bar);
+ div0 = element("div");
+ t = space();
+ div1 = element("div");
+ attr(div0, "data-foo", "bar");
+ attr(div1, "data-foo", ctx.bar);
},
m(target, anchor) {
insert(target, div0, anchor);
- insert(target, text, anchor);
+ insert(target, t, anchor);
insert(target, div1, anchor);
},
p(changed, ctx) {
if (changed.bar) {
- setAttribute(div1, "data-foo", ctx.bar);
+ attr(div1, "data-foo", ctx.bar);
}
},
i: noop,
o: noop,
- d(detach) {
- if (detach) {
- detachNode(div0);
- detachNode(text);
- detachNode(div1);
+ d(detaching) {
+ if (detaching) {
+ detach(div0);
+ detach(t);
+ detach(div1);
}
}
};
@@ -51,16 +61,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal);
- }
-
- get bar() {
- return this.$$.ctx.bar;
- }
-
- set bar(bar) {
- this.$set({ bar });
- flush();
+ init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
diff --git a/test/js/samples/dont-use-dataset-in-legacy/input.svelte b/test/js/samples/dont-use-dataset-in-legacy/input.svelte
index ffd72ac6ee..e340b2610f 100644
--- a/test/js/samples/dont-use-dataset-in-legacy/input.svelte
+++ b/test/js/samples/dont-use-dataset-in-legacy/input.svelte
@@ -1,2 +1,6 @@
+
+
\ No newline at end of file
diff --git a/test/js/samples/dont-use-dataset-in-svg/expected.js b/test/js/samples/dont-use-dataset-in-svg/expected.js
index cc29258326..3f58d7f155 100644
--- a/test/js/samples/dont-use-dataset-in-svg/expected.js
+++ b/test/js/samples/dont-use-dataset-in-svg/expected.js
@@ -1,16 +1,26 @@
/* generated by Svelte vX.Y.Z */
-import { SvelteComponent as SvelteComponent_1, append, createSvgElement, detachNode, flush, init, insert, noop, safe_not_equal, setAttribute } from "svelte/internal";
+import {
+ SvelteComponent as SvelteComponent_1,
+ append,
+ attr,
+ detach,
+ init,
+ insert,
+ noop,
+ safe_not_equal,
+ svg_element
+} from "svelte/internal";
function create_fragment(ctx) {
var svg, g0, g1;
return {
c() {
- svg = createSvgElement("svg");
- g0 = createSvgElement("g");
- g1 = createSvgElement("g");
- setAttribute(g0, "data-foo", "bar");
- setAttribute(g1, "data-foo", ctx.bar);
+ svg = svg_element("svg");
+ g0 = svg_element("g");
+ g1 = svg_element("g");
+ attr(g0, "data-foo", "bar");
+ attr(g1, "data-foo", ctx.bar);
},
m(target, anchor) {
@@ -21,16 +31,16 @@ function create_fragment(ctx) {
p(changed, ctx) {
if (changed.bar) {
- setAttribute(g1, "data-foo", ctx.bar);
+ attr(g1, "data-foo", ctx.bar);
}
},
i: noop,
o: noop,
- d(detach) {
- if (detach) {
- detachNode(svg);
+ d(detaching) {
+ if (detaching) {
+ detach(svg);
}
}
};
@@ -49,16 +59,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
- init(this, options, instance, create_fragment, safe_not_equal);
- }
-
- get bar() {
- return this.$$.ctx.bar;
- }
-
- set bar(bar) {
- this.$set({ bar });
- flush();
+ init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
}
}
diff --git a/test/js/samples/dont-use-dataset-in-svg/input.svelte b/test/js/samples/dont-use-dataset-in-svg/input.svelte
index fe6c4eba9b..969377de33 100644
--- a/test/js/samples/dont-use-dataset-in-svg/input.svelte
+++ b/test/js/samples/dont-use-dataset-in-svg/input.svelte
@@ -1,3 +1,7 @@
+
+