diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js
index 83a668acd5..831a7c66ca 100644
--- a/test/js/samples/action/expected.js
+++ b/test/js/samples/action/expected.js
@@ -1,24 +1,23 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createElement, detachNode, init, insert, noop, run, safe_not_equal } from "svelte/internal.js";
function link(node) {
+ function onClick(event) {
+ event.preventDefault();
+ history.pushState(null, null, event.target.href);
+ }
- function onClick(event) {
- event.preventDefault();
- history.pushState(null, null, event.target.href);
- }
-
- node.addEventListener('click', onClick);
+ node.addEventListener('click', onClick);
- return {
- destroy() {
- node.removeEventListener('click', onClick);
- }
- }
-};
+ return {
+ destroy() {
+ node.removeEventListener('click', onClick);
+ }
+ }
+}
-function create_main_fragment(component, ctx) {
- var a, link_action;
+function create_fragment(component, ctx) {
+ var a, link_action, current;
return {
c() {
@@ -29,33 +28,34 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
insert(target, a, anchor);
- link_action = link.call(component, a) || {};
+ link_action = link.call(null, a) || {};
+ current = true;
},
p: noop,
+ i(target, anchor) {
+ if (current) return;
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(a);
}
- if (link_action && typeof link_action.destroy === 'function') link_action.destroy.call(component);
+ if (link_action && typeof link_action.destroy === 'function') link_action.destroy();
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
-
- this._fragment = create_main_fragment(this, this._state);
-
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, noop, create_fragment, safe_not_equal);
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/action/input.html b/test/js/samples/action/input.html
index 713e44249a..3722587039 100644
--- a/test/js/samples/action/input.html
+++ b/test/js/samples/action/input.html
@@ -1,6 +1,5 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/test/js/samples/event-modifiers/expected.js b/test/js/samples/event-modifiers/expected.js
index e0b355f216..e0801e4c1a 100644
--- a/test/js/samples/event-modifiers/expected.js
+++ b/test/js/samples/event-modifiers/expected.js
@@ -1,36 +1,16 @@
-/* generated by Svelte vX.Y.Z */
-import { addListener, append, assign, createElement, createText, detachNode, init, insert, noop, proto, removeListener } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, addListener, append, createElement, createText, detachNode, init, insert, noop, removeListener, run, safe_not_equal } from "svelte/internal.js";
-var methods = {
- handleTouchstart() {
- // ...
- },
-
- handleClick() {
- // ...
- }
-};
-
-function create_main_fragment(component, ctx) {
- var div, button0, text1, button1, text3, button2;
-
- function click_handler(event) {
- event.preventDefault();
- event.stopPropagation();
- component.handleClick();
- }
-
- function click_handler_1(event) {
- component.handleClick();
- }
+function handleTouchstart() {
+ // ...
+}
- function click_handler_2(event) {
- component.handleClick();
- }
+function handleClick() {
+ // ...
+}
- function touchstart_handler(event) {
- component.handleTouchstart();
- }
+function create_fragment(component, ctx) {
+ var div, button0, text1, button1, text3, button2, current;
return {
c() {
@@ -43,10 +23,10 @@ function create_main_fragment(component, ctx) {
text3 = createText("\n\t");
button2 = createElement("button");
button2.textContent = "or me!";
- addListener(button0, "click", click_handler);
- addListener(button1, "click", click_handler_1, { once: true, capture: true });
- addListener(button2, "click", click_handler_2, true);
- addListener(div, "touchstart", touchstart_handler, { passive: true });
+ addListener(button0, "click|stopPropagation|preventDefault", handleClick);
+ addListener(button1, "click|once|capture", handleClick);
+ addListener(button2, "click|capture", handleClick);
+ addListener(div, "touchstart", handleTouchstart, { passive: true });
},
m(target, anchor) {
@@ -56,36 +36,37 @@ function create_main_fragment(component, ctx) {
append(div, button1);
append(div, text3);
append(div, button2);
+ current = true;
},
p: noop,
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(div);
}
- removeListener(button0, "click", click_handler);
- removeListener(button1, "click", click_handler_1, { once: true, capture: true });
- removeListener(button2, "click", click_handler_2, true);
- removeListener(div, "touchstart", touchstart_handler, { passive: true });
+ removeListener(button0, "click|stopPropagation|preventDefault", handleClick);
+ removeListener(button1, "click|once|capture", handleClick);
+ removeListener(button2, "click|capture", handleClick);
+ removeListener(div, "touchstart", handleTouchstart, { passive: true });
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
-
- this._fragment = create_main_fragment(this, this._state);
-
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, noop, create_fragment, safe_not_equal);
}
}
-assign(SvelteComponent.prototype, proto);
-assign(SvelteComponent.prototype, methods);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/head-no-whitespace/expected.js b/test/js/samples/head-no-whitespace/expected.js
index 9d016e027b..d179906aa2 100644
--- a/test/js/samples/head-no-whitespace/expected.js
+++ b/test/js/samples/head-no-whitespace/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { append, assign, createElement, detachNode, init, noop, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, append, createElement, detachNode, init, noop, run, safe_not_equal } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var meta0, meta1;
+function create_fragment(component, ctx) {
+ var meta0, meta1, current;
return {
c() {
@@ -17,10 +17,19 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
append(document.head, meta0);
append(document.head, meta1);
+ current = true;
},
p: noop,
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
detachNode(meta0);
detachNode(meta1);
@@ -28,18 +37,11 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
-
- this._fragment = create_main_fragment(this, this._state);
-
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, noop, create_fragment, safe_not_equal);
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js
index d39c77fccf..672d315162 100644
--- a/test/js/samples/if-block-no-update/expected.js
+++ b/test/js/samples/if-block-no-update/expected.js
@@ -1,54 +1,36 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createComment, createElement, detachNode, init, insert, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createComment, createElement, detachNode, flush, init, insert, run, safe_not_equal } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var if_block_anchor;
-
- function select_block_type(ctx) {
- if (ctx.foo) return create_if_block;
- return create_else_block;
- }
-
- var current_block_type = select_block_type(ctx);
- var if_block = current_block_type(component, ctx);
+// (3:0) {:else}
+function create_else_block(component, ctx) {
+ var p;
return {
c() {
- if_block.c();
- if_block_anchor = createComment();
+ p = createElement("p");
+ p.textContent = "not foo!";
},
m(target, anchor) {
- if_block.m(target, anchor);
- insert(target, if_block_anchor, anchor);
- },
-
- p(changed, ctx) {
- if (current_block_type !== (current_block_type = select_block_type(ctx))) {
- if_block.d(1);
- if_block = current_block_type(component, ctx);
- if_block.c();
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
+ insert(target, p, anchor);
},
d(detach) {
- if_block.d(detach);
if (detach) {
- detachNode(if_block_anchor);
+ detachNode(p);
}
}
};
}
-// (3:0) {:else}
-function create_else_block(component, ctx) {
+// (1:0) {#if foo}
+function create_if_block(component, ctx) {
var p;
return {
c() {
p = createElement("p");
- p.textContent = "not foo!";
+ p.textContent = "foo!";
},
m(target, anchor) {
@@ -63,40 +45,80 @@ function create_else_block(component, ctx) {
};
}
-// (1:0) {#if foo}
-function create_if_block(component, ctx) {
- var p;
+function create_fragment(component, ctx) {
+ var if_block_anchor, current;
+
+ function select_block_type(ctx) {
+ if (ctx.foo) return create_if_block;
+ return create_else_block;
+ }
+
+ var current_block_type = select_block_type(ctx);
+ var if_block = current_block_type(component, ctx);
return {
c() {
- p = createElement("p");
- p.textContent = "foo!";
+ if_block.c();
+ if_block_anchor = createComment();
},
m(target, anchor) {
- insert(target, p, anchor);
+ if_block.m(target, anchor);
+ insert(target, if_block_anchor, anchor);
+ current = true;
+ },
+
+ p(changed, ctx) {
+ if (current_block_type !== (current_block_type = select_block_type(ctx))) {
+ if_block.d(1);
+ if_block = current_block_type(component, ctx);
+ if_block.c();
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
+ }
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
+ if_block.d(detach);
if (detach) {
- detachNode(p);
+ detachNode(if_block_anchor);
}
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props) {
+ let { foo } = $$props;
+
+ // TODO only what's needed by the template
+ $$self.$$.get = () => ({ foo });
- this._fragment = create_main_fragment(this, this._state);
+ $$self.$$.set = $$props => {
+ if ('foo' in $$props) foo = $$props.foo;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
+
+ get foo() {
+ return this.$$.get().foo;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set foo(value) {
+ this.$set({ foo: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js
index 1592464f9f..2614e7af04 100644
--- a/test/js/samples/if-block-simple/expected.js
+++ b/test/js/samples/if-block-simple/expected.js
@@ -1,8 +1,30 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createComment, createElement, detachNode, init, insert, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createComment, createElement, detachNode, flush, init, insert, run, safe_not_equal } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var if_block_anchor;
+// (1:0) {#if foo}
+function create_if_block(component, ctx) {
+ var p;
+
+ return {
+ c() {
+ p = createElement("p");
+ p.textContent = "foo!";
+ },
+
+ m(target, anchor) {
+ insert(target, p, anchor);
+ },
+
+ d(detach) {
+ if (detach) {
+ detachNode(p);
+ }
+ }
+ };
+}
+
+function create_fragment(component, ctx) {
+ var if_block_anchor, current;
var if_block = (ctx.foo) && create_if_block(component, ctx);
@@ -15,6 +37,7 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
+ current = true;
},
p(changed, ctx) {
@@ -30,6 +53,14 @@ function create_main_fragment(component, ctx) {
}
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (if_block) if_block.d(detach);
if (detach) {
@@ -39,40 +70,30 @@ function create_main_fragment(component, ctx) {
};
}
-// (1:0) {#if foo}
-function create_if_block(component, ctx) {
- var p;
-
- return {
- c() {
- p = createElement("p");
- p.textContent = "foo!";
- },
+function define($$self, $$props) {
+ let { foo } = $$props;
- m(target, anchor) {
- insert(target, p, anchor);
- },
+ $$self.$$.get = () => ({ foo });
- d(detach) {
- if (detach) {
- detachNode(p);
- }
- }
+ $$self.$$.set = $$props => {
+ if ('foo' in $$props) foo = $$props.foo;
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get foo() {
+ return this.$$.get().foo;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set foo(value) {
+ this.$set({ foo: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js
index 2768d3c8de..a8ae965a62 100644
--- a/test/js/samples/inline-style-optimized-multiple/expected.js
+++ b/test/js/samples/inline-style-optimized-multiple/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createElement, detachNode, init, insert, proto, setStyle } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createElement, detachNode, flush, init, insert, run, safe_not_equal, setStyle } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var div;
+function create_fragment(component, ctx) {
+ var div, current;
return {
c() {
@@ -13,6 +13,7 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
insert(target, div, anchor);
+ current = true;
},
p(changed, ctx) {
@@ -25,6 +26,14 @@ function create_main_fragment(component, ctx) {
}
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(div);
@@ -33,18 +42,50 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props) {
+ let { color, x, y } = $$props;
+
+ $$self.$$.get = () => ({ color, x, y });
+
+ $$self.$$.set = $$props => {
+ if ('color' in $$props) color = $$props.color;
+ if ('x' in $$props) x = $$props.x;
+ if ('y' in $$props) y = $$props.y;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get color() {
+ return this.$$.get().color;
+ }
+
+ set color(value) {
+ this.$set({ color: value });
+ flush();
+ }
+
+ get x() {
+ return this.$$.get().x;
+ }
+
+ set x(value) {
+ this.$set({ x: value });
+ flush();
+ }
+
+ get y() {
+ return this.$$.get().y;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set y(value) {
+ this.$set({ y: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js
index 5257071ee3..00a626773c 100644
--- a/test/js/samples/inline-style-optimized-url/expected.js
+++ b/test/js/samples/inline-style-optimized-url/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createElement, detachNode, init, insert, proto, setStyle } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createElement, detachNode, flush, init, insert, run, safe_not_equal, setStyle } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var div;
+function create_fragment(component, ctx) {
+ var div, current;
return {
c() {
@@ -12,6 +12,7 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
insert(target, div, anchor);
+ current = true;
},
p(changed, ctx) {
@@ -20,6 +21,14 @@ function create_main_fragment(component, ctx) {
}
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(div);
@@ -28,18 +37,30 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props) {
+ let { data } = $$props;
+
+ $$self.$$.get = () => ({ data });
- this._fragment = create_main_fragment(this, this._state);
+ $$self.$$.set = $$props => {
+ if ('data' in $$props) data = $$props.data;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
+
+ get data() {
+ return this.$$.get().data;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set data(value) {
+ this.$set({ data: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js
index 4765fe8cbf..54f401ec0e 100644
--- a/test/js/samples/inline-style-optimized/expected.js
+++ b/test/js/samples/inline-style-optimized/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createElement, detachNode, init, insert, proto, setStyle } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createElement, detachNode, flush, init, insert, run, safe_not_equal, setStyle } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var div;
+function create_fragment(component, ctx) {
+ var div, current;
return {
c() {
@@ -12,6 +12,7 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
insert(target, div, anchor);
+ current = true;
},
p(changed, ctx) {
@@ -20,6 +21,13 @@ function create_main_fragment(component, ctx) {
}
},
+ i(target, anchor) {
+ if (current) return;
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(div);
@@ -28,18 +36,30 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props) {
+ let { color } = $$props;
+
+ $$self.$$.get = () => ({ color });
+
+ $$self.$$.set = $$props => {
+ if ('color' in $$props) color = $$props.color;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get color() {
+ return this.$$.get().color;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set color(value) {
+ this.$set({ color: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js
index fd7ba41033..c457d73f40 100644
--- a/test/js/samples/inline-style-unoptimized/expected.js
+++ b/test/js/samples/inline-style-unoptimized/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createElement, createText, detachNode, init, insert, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createElement, createText, detachNode, flush, init, insert, run, safe_not_equal } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var div0, text, div1, div1_style_value;
+function create_fragment(component, ctx) {
+ var div0, text, div1, div1_style_value, current;
return {
c() {
@@ -17,6 +17,7 @@ function create_main_fragment(component, ctx) {
insert(target, div0, anchor);
insert(target, text, anchor);
insert(target, div1, anchor);
+ current = true;
},
p(changed, ctx) {
@@ -29,6 +30,13 @@ function create_main_fragment(component, ctx) {
}
},
+ i(target, anchor) {
+ if (current) return;
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(div0);
@@ -39,18 +47,50 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props) {
+ let { style, key, value } = $$props;
+
+ $$self.$$.get = () => ({ style, key, value });
+
+ $$self.$$.set = $$props => {
+ if ('style' in $$props) style = $$props.style;
+ if ('key' in $$props) key = $$props.key;
+ if ('value' in $$props) value = $$props.value;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
+
+ get style() {
+ return this.$$.get().style;
+ }
- this._fragment = create_main_fragment(this, this._state);
+ set style(value) {
+ this.$set({ style: value });
+ flush();
+ }
+
+ get key() {
+ return this.$$.get().key;
+ }
+
+ set key(value) {
+ this.$set({ key: value });
+ flush();
+ }
+
+ get value() {
+ return this.$$.get().value;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set value(value) {
+ this.$set({ value: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/input-files/expected.js b/test/js/samples/input-files/expected.js
index 028e15bd28..ba90b94e58 100644
--- a/test/js/samples/input-files/expected.js
+++ b/test/js/samples/input-files/expected.js
@@ -1,19 +1,13 @@
-/* generated by Svelte vX.Y.Z */
-import { addListener, assign, createElement, detachNode, init, insert, proto, removeListener, setAttribute } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, flush, init, insert, removeListener, run, safe_not_equal, setAttribute } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var input, input_updating = false;
-
- function input_input_handler() {
- input_updating = true;
- component.set({ files: input.files });
- input_updating = false;
- }
+function create_fragment(component, ctx) {
+ var input, input_updating = false, current;
return {
c() {
input = createElement("input");
- addListener(input, "input", input_input_handler);
+ addListener(input, "input", ctx.input_input_handler);
setAttribute(input, "type", "file");
input.multiple = true;
},
@@ -22,34 +16,60 @@ function create_main_fragment(component, ctx) {
insert(target, input, anchor);
input.files = ctx.files;
+
+ current = true;
},
p(changed, ctx) {
if (!input_updating && changed.files) input.files = ctx.files;
},
+ i(target, anchor) {
+ if (current) return;
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(input);
}
- removeListener(input, "input", input_input_handler);
+ removeListener(input, "input", ctx.input_input_handler);
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props, $$make_dirty) {
+ let { files } = $$props;
- this._fragment = create_main_fragment(this, this._state);
+ function input_input_handler() {
+ files = this.files;
+ $$make_dirty('files');
+ }
+
+ $$self.$$.get = () => ({ files, input_input_handler });
+
+ $$self.$$.set = $$props => {
+ if ('files' in $$props) files = $$props.files;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
+
+ get files() {
+ return this.$$.get().files;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set files(value) {
+ this.$set({ files: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/input-range/expected.js b/test/js/samples/input-range/expected.js
index bb430b0e92..57f3126632 100644
--- a/test/js/samples/input-range/expected.js
+++ b/test/js/samples/input-range/expected.js
@@ -1,18 +1,14 @@
-/* generated by Svelte vX.Y.Z */
-import { addListener, assign, createElement, detachNode, init, insert, proto, removeListener, setAttribute, toNumber } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, flush, init, insert, removeListener, run, safe_not_equal, setAttribute, toNumber } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var input;
-
- function input_change_input_handler() {
- component.set({ value: toNumber(input.value) });
- }
+function create_fragment(component, ctx) {
+ var input, current;
return {
c() {
input = createElement("input");
- addListener(input, "change", input_change_input_handler);
- addListener(input, "input", input_change_input_handler);
+ addListener(input, "change", ctx.input_change_input_handler);
+ addListener(input, "input", ctx.input_change_input_handler);
setAttribute(input, "type", "range");
},
@@ -20,35 +16,62 @@ function create_main_fragment(component, ctx) {
insert(target, input, anchor);
input.value = ctx.value;
+
+ current = true;
},
p(changed, ctx) {
if (changed.value) input.value = ctx.value;
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(input);
}
- removeListener(input, "change", input_change_input_handler);
- removeListener(input, "input", input_change_input_handler);
+ removeListener(input, "change", ctx.input_change_input_handler);
+ removeListener(input, "input", ctx.input_change_input_handler);
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props, $$make_dirty) {
+ let { value } = $$props;
+
+ function input_change_input_handler() {
+ value = toNumber(this.value);
+ $$make_dirty('value');
+ }
+
+ $$self.$$.get = () => ({ value, input_change_input_handler });
+
+ $$self.$$.set = $$props => {
+ if ('value' in $$props) value = $$props.value;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get value() {
+ return this.$$.get().value;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set value(value) {
+ this.$set({ value: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js
index cff06b1e6a..40b3e099c3 100644
--- a/test/js/samples/input-without-blowback-guard/expected.js
+++ b/test/js/samples/input-without-blowback-guard/expected.js
@@ -1,17 +1,13 @@
-/* generated by Svelte vX.Y.Z */
-import { addListener, assign, createElement, detachNode, init, insert, proto, removeListener, setAttribute } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, flush, init, insert, removeListener, run, safe_not_equal, setAttribute } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var input;
-
- function input_change_handler() {
- component.set({ foo: input.checked });
- }
+function create_fragment(component, ctx) {
+ var input, current;
return {
c() {
input = createElement("input");
- addListener(input, "change", input_change_handler);
+ addListener(input, "change", ctx.input_change_handler);
setAttribute(input, "type", "checkbox");
},
@@ -19,34 +15,61 @@ function create_main_fragment(component, ctx) {
insert(target, input, anchor);
input.checked = ctx.foo;
+
+ current = true;
},
p(changed, ctx) {
if (changed.foo) input.checked = ctx.foo;
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(input);
}
- removeListener(input, "change", input_change_handler);
+ removeListener(input, "change", ctx.input_change_handler);
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props, $$make_dirty) {
+ let { foo } = $$props;
+
+ function input_change_handler() {
+ foo = this.checked;
+ $$make_dirty('foo');
+ }
+
+ $$self.$$.get = () => ({ foo, input_change_handler });
+
+ $$self.$$.set = $$props => {
+ if ('foo' in $$props) foo = $$props.foo;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get foo() {
+ return this.$$.get().foo;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set foo(value) {
+ this.$set({ foo: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js
index d44b789837..58e3214476 100644
--- a/test/js/samples/legacy-input-type/expected.js
+++ b/test/js/samples/legacy-input-type/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createElement, detachNode, init, insert, noop, proto, setInputType } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, createElement, detachNode, init, insert, noop, run, safe_not_equal, setInputType } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var input;
+function create_fragment(component, ctx) {
+ var input, current;
return {
c() {
@@ -12,10 +12,19 @@ function create_main_fragment(component, ctx) {
m(target, anchor) {
insert(target, input, anchor);
+ current = true;
},
p: noop,
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(input);
@@ -24,18 +33,11 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
-
- this._fragment = create_main_fragment(this, this._state);
-
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, noop, create_fragment, safe_not_equal);
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js
index 6571049306..d98e5dbf2d 100644
--- a/test/js/samples/media-bindings/expected.js
+++ b/test/js/samples/media-bindings/expected.js
@@ -1,61 +1,31 @@
-/* generated by Svelte vX.Y.Z */
-import { addListener, assign, createElement, detachNode, flush, init, insert, proto, removeListener, timeRangesToArray } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, addListener, add_render_callback, createElement, detachNode, flush, init, insert, removeListener, run, safe_not_equal, timeRangesToArray } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var audio, audio_is_paused = true, audio_updating = false, audio_animationframe;
-
- function audio_timeupdate_handler() {
- cancelAnimationFrame(audio_animationframe);
- if (!audio.paused) audio_animationframe = requestAnimationFrame(audio_timeupdate_handler);
- audio_updating = true;
- component.set({ played: timeRangesToArray(audio.played), currentTime: audio.currentTime });
- audio_updating = false;
- }
-
- function audio_durationchange_handler() {
- component.set({ duration: audio.duration });
- }
-
- function audio_play_pause_handler() {
- audio_updating = true;
- component.set({ paused: audio.paused });
- audio_updating = false;
- }
-
- function audio_progress_handler() {
- component.set({ buffered: timeRangesToArray(audio.buffered) });
- }
-
- function audio_loadedmetadata_handler() {
- component.set({ buffered: timeRangesToArray(audio.buffered), seekable: timeRangesToArray(audio.seekable) });
- }
-
- function audio_volumechange_handler() {
- audio_updating = true;
- component.set({ volume: audio.volume });
- audio_updating = false;
- }
+function create_fragment(component, ctx) {
+ var audio, audio_is_paused = true, audio_updating = false, audio_animationframe, current;
return {
c() {
audio = createElement("audio");
- addListener(audio, "timeupdate", audio_timeupdate_handler);
- if (!('played' in ctx && 'currentTime' in ctx)) component.root._beforecreate.push(audio_timeupdate_handler);
- addListener(audio, "durationchange", audio_durationchange_handler);
- if (!('duration' in ctx)) component.root._beforecreate.push(audio_durationchange_handler);
- addListener(audio, "play", audio_play_pause_handler);
- addListener(audio, "pause", audio_play_pause_handler);
- addListener(audio, "progress", audio_progress_handler);
- if (!('buffered' in ctx)) component.root._beforecreate.push(audio_progress_handler);
- addListener(audio, "loadedmetadata", audio_loadedmetadata_handler);
- if (!('buffered' in ctx && 'seekable' in ctx)) component.root._beforecreate.push(audio_loadedmetadata_handler);
- addListener(audio, "volumechange", audio_volumechange_handler);
+ addListener(audio, "timeupdate", ctx.audio_timeupdate_handler);
+ if (ctx.played === void 0 || ctx.currentTime === void 0) add_render_callback(() => ctx.audio_timeupdate_handler.call(audio));
+ addListener(audio, "durationchange", ctx.audio_durationchange_handler);
+ if (ctx.duration === void 0) add_render_callback(() => ctx.audio_durationchange_handler.call(audio));
+ addListener(audio, "play", ctx.audio_play_pause_handler);
+ addListener(audio, "pause", ctx.audio_play_pause_handler);
+ addListener(audio, "progress", ctx.audio_progress_handler);
+ if (ctx.buffered === void 0) add_render_callback(() => ctx.audio_progress_handler.call(audio));
+ addListener(audio, "loadedmetadata", ctx.audio_loadedmetadata_handler);
+ if (ctx.buffered === void 0 || ctx.seekable === void 0) add_render_callback(() => ctx.audio_loadedmetadata_handler.call(audio));
+ addListener(audio, "volumechange", ctx.audio_volumechange_handler);
},
m(target, anchor) {
insert(target, audio, anchor);
audio.volume = ctx.volume;
+
+ current = true;
},
p(changed, ctx) {
@@ -64,36 +34,165 @@ function create_main_fragment(component, ctx) {
if (!audio_updating && !isNaN(ctx.volume) && changed.volume) audio.volume = ctx.volume;
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(audio);
}
- removeListener(audio, "timeupdate", audio_timeupdate_handler);
- removeListener(audio, "durationchange", audio_durationchange_handler);
- removeListener(audio, "play", audio_play_pause_handler);
- removeListener(audio, "pause", audio_play_pause_handler);
- removeListener(audio, "progress", audio_progress_handler);
- removeListener(audio, "loadedmetadata", audio_loadedmetadata_handler);
- removeListener(audio, "volumechange", audio_volumechange_handler);
+ removeListener(audio, "timeupdate", ctx.audio_timeupdate_handler);
+ removeListener(audio, "durationchange", ctx.audio_durationchange_handler);
+ removeListener(audio, "play", ctx.audio_play_pause_handler);
+ removeListener(audio, "pause", ctx.audio_play_pause_handler);
+ removeListener(audio, "progress", ctx.audio_progress_handler);
+ removeListener(audio, "loadedmetadata", ctx.audio_loadedmetadata_handler);
+ removeListener(audio, "volumechange", ctx.audio_volumechange_handler);
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$make_dirty) {
+ // TODO some of these are read-only...
+ let { buffered, seekable, played, currentTime, duration, paused, volume } = $$props;
+
+ function audio_timeupdate_handler() {
+ cancelAnimationFrame(audio_animationframe);
+ if (!audio.paused) audio_animationframe = requestAnimationFrame(audio_timeupdate_handler);
+ played = timeRangesToArray(this.played);
+ currentTime = this.currentTime;
+ $$make_dirty('played');
+ $$make_dirty('currentTime');
+ }
+
+ function audio_durationchange_handler() {
+ duration = this.duration;
+ $$make_dirty('duration');
+ }
+
+ function audio_play_pause_handler() {
+ paused = this.paused;
+ $$make_dirty('paused');
+ }
+
+ function audio_progress_handler() {
+ buffered = timeRangesToArray(this.buffered);
+ $$make_dirty('buffered');
+ }
+
+ function audio_loadedmetadata_handler() {
+ buffered = timeRangesToArray(this.buffered);
+ seekable = timeRangesToArray(this.seekable);
+ $$make_dirty('buffered');
+ $$make_dirty('seekable');
+ }
+
+ function audio_volumechange_handler() {
+ volume = this.volume;
+ $$make_dirty('volume');
+ }
+
+ $$self.$$.get = () => ({
+ buffered,
+ seekable,
+ played,
+ currentTime,
+ duration,
+ paused,
+ volume,
+ audio_timeupdate_handler,
+ audio_durationchange_handler,
+ audio_play_pause_handler,
+ audio_progress_handler,
+ audio_loadedmetadata_handler,
+ audio_volumechange_handler
+ });
+
+ $$self.$$.set = $$props => {
+ if ('buffered' in $$props) buffered = $$props.buffered;
+ if ('seekable' in $$props) seekable = $$props.seekable;
+ if ('played' in $$props) played = $$props.played;
+ if ('currentTime' in $$props) currentTime = $$props.currentTime;
+ if ('duration' in $$props) duration = $$props.duration;
+ if ('paused' in $$props) paused = $$props.paused;
+ if ('volume' in $$props) volume = $$props.volume;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get buffered() {
+ return this.$$.get().buffered;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set buffered(value) {
+ this.$set({ buffered: value });
+ flush();
+ }
+
+ get seekable() {
+ return this.$$.get().seekable;
+ }
+
+ set seekable(value) {
+ this.$set({ seekable: value });
+ flush();
+ }
+
+ get played() {
+ return this.$$.get().played;
+ }
+
+ set played(value) {
+ this.$set({ played: value });
+ flush();
+ }
+
+ get currentTime() {
+ return this.$$.get().currentTime;
+ }
+
+ set currentTime(value) {
+ this.$set({ currentTime: value });
+ flush();
+ }
+
+ get duration() {
+ return this.$$.get().duration;
+ }
+
+ set duration(value) {
+ this.$set({ duration: value });
+ flush();
+ }
+
+ get paused() {
+ return this.$$.get().paused;
+ }
+
+ set paused(value) {
+ this.$set({ paused: value });
+ flush();
+ }
+
+ get volume() {
+ return this.$$.get().volume;
+ }
- flush(this);
+ set volume(value) {
+ this.$set({ volume: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js
index 8e47d1b1d3..970bda8ff5 100644
--- a/test/js/samples/non-imported-component/expected.js
+++ b/test/js/samples/non-imported-component/expected.js
@@ -1,62 +1,63 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, createText, detachNode, flush, init, insert, noop, proto } from "svelte/shared.js";
-import Imported from 'Imported.html';
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, callAfter, createText, detachNode, init, insert, mount_component, noop, safe_not_equal } from "svelte/internal.js";
+import Imported from "Imported.html";
+function create_fragment(component, ctx) {
+ var text, current;
+ var imported = new Imported({});
-function create_main_fragment(component, ctx) {
- var text;
-
- var imported = new Imported({
- root: component.root,
- store: component.store
- });
-
- var nonimported = new NonImported({
- root: component.root,
- store: component.store
- });
+ var nonimported = new NonImported({});
return {
c() {
- imported._fragment.c();
+ imported.$$.fragment.c();
text = createText("\n");
- nonimported._fragment.c();
+ nonimported.$$.fragment.c();
},
m(target, anchor) {
- imported._mount(target, anchor);
+ mount_component(imported, target, anchor);
insert(target, text, anchor);
- nonimported._mount(target, anchor);
+ mount_component(nonimported, target, anchor);
+ current = true;
},
p: noop,
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o(outrocallback) {
+ if (!current) return;
+
+ outrocallback = callAfter(outrocallback, 2);
+
+ if (imported) imported.$$.fragment.o(outrocallback);
+ if (nonimported) nonimported.$$.fragment.o(outrocallback);
+ current = false;
+ },
+
d(detach) {
- imported.destroy(detach);
+ imported.$destroy(detach);
+
if (detach) {
detachNode(text);
}
- nonimported.destroy(detach);
+ nonimported.$destroy(detach);
}
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
-
- this._fragment = create_main_fragment(this, this._state);
-
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
-
- flush(this);
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, noop, create_fragment, safe_not_equal);
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js
index 44c741f54b..37b0b83024 100644
--- a/test/js/samples/select-dynamic-value/expected.js
+++ b/test/js/samples/select-dynamic-value/expected.js
@@ -1,8 +1,8 @@
-/* generated by Svelte vX.Y.Z */
-import { append, assign, createElement, detachNode, init, insert, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, append, createElement, detachNode, flush, init, insert, run, safe_not_equal } from "svelte/internal.js";
-function create_main_fragment(component, ctx) {
- var select, option0, option1, select_value_value;
+function create_fragment(component, ctx) {
+ var select, option0, option1, select_value_value, current;
return {
c() {
@@ -31,6 +31,8 @@ function create_main_fragment(component, ctx) {
break;
}
}
+
+ current = true;
},
p(changed, ctx) {
@@ -46,6 +48,14 @@ function create_main_fragment(component, ctx) {
}
},
+ i(target, anchor) {
+ if (current) return;
+
+ this.m(target, anchor);
+ },
+
+ o: run,
+
d(detach) {
if (detach) {
detachNode(select);
@@ -54,18 +64,30 @@ function create_main_fragment(component, ctx) {
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
+function define($$self, $$props) {
+ let { current } = $$props;
+
+ $$self.$$.get = () => ({ current });
+
+ $$self.$$.set = $$props => {
+ if ('current' in $$props) current = $$props.current;
+ };
+}
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- this._fragment = create_main_fragment(this, this._state);
+ get current() {
+ return this.$$.get().current;
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ set current(value) {
+ this.$set({ current: value });
+ flush();
}
}
-assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/setup-method/expected.js b/test/js/samples/setup-method/expected.js
index d68f1478aa..6a8546bc0c 100644
--- a/test/js/samples/setup-method/expected.js
+++ b/test/js/samples/setup-method/expected.js
@@ -1,50 +1,32 @@
-/* generated by Svelte vX.Y.Z */
-import { assign, init, noop, proto } from "svelte/shared.js";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { SvelteComponent as SvelteComponent_1, init, noop, run, safe_not_equal } from "svelte/internal.js";
-var methods = {
- foo ( bar ) {
- console.log( bar );
- }
-};
+export const SOME_CONSTANT = 42;
-function setup(Component) {
- Component.SOME_CONSTANT = 42;
- Component.factory = function (target) {
- return new Component({
- target: target
- });
- }
- Component.prototype.foo( 'baz' );
+function foo(bar) {
+ console.log(bar);
}
-function create_main_fragment(component, ctx) {
-
+function create_fragment(component, ctx) {
return {
c: noop,
-
m: noop,
-
p: noop,
-
+ i: noop,
+ o: run,
d: noop
};
}
-function SvelteComponent(options) {
- init(this, options);
- this._state = assign({}, options.data);
- this._intro = true;
-
- this._fragment = create_main_fragment(this, this._state);
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, define, create_fragment, safe_not_equal);
+ }
- if (options.target) {
- this._fragment.c();
- this._mount(options.target, options.anchor);
+ get foo() {
+ return foo;
}
}
-assign(SvelteComponent.prototype, proto);
-assign(SvelteComponent.prototype, methods);
-
-setup(SvelteComponent);
export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/setup-method/input.html b/test/js/samples/setup-method/input.html
index 1f48f2bc26..e8b71eb079 100644
--- a/test/js/samples/setup-method/input.html
+++ b/test/js/samples/setup-method/input.html
@@ -1,9 +1,9 @@
-
\ No newline at end of file
diff --git a/test/js/samples/ssr-no-oncreate-etc/expected.js b/test/js/samples/ssr-no-oncreate-etc/expected.js
index 5a2af8759f..e090cd2f10 100644
--- a/test/js/samples/ssr-no-oncreate-etc/expected.js
+++ b/test/js/samples/ssr-no-oncreate-etc/expected.js
@@ -1,16 +1,33 @@
-"use strict";
+/* generated by Svelte vX.Y.Z-alpha1 */
+import { onMount, onDestroy } from "svelte";
function preload(input) {
return output;
-};
+}
+
+function foo() {
+ console.log('foo');
+}
+
+function swipe(node, callback) {
+ // TODO implement
+}
-var SvelteComponent = {};;
+function define($$props) {
+ onMount(() => {
+ console.log('onMount');
+ });
+
+ onDestroy(() => {
+ console.log('onDestroy');
+ });
-SvelteComponent.data = function() {
return {};
-};
+}
-SvelteComponent.render = function(state, options = {}) {
+var SvelteComponent = {};
+
+SvelteComponent.render = function(props = {}, options = {}) {
var components = new Set();
function addComponent(component) {
@@ -18,7 +35,7 @@ SvelteComponent.render = function(state, options = {}) {
}
var result = { head: '', addComponent };
- var html = SvelteComponent._render(result, state, options);
+ var html = SvelteComponent.$$render(result, props, options);
var cssCode = Array.from(components).map(c => c.css && c.css.code).filter(Boolean).join('\n');
@@ -32,10 +49,10 @@ SvelteComponent.render = function(state, options = {}) {
};
}
-SvelteComponent._render = function(__result, ctx, options) {
- __result.addComponent(SvelteComponent);
+SvelteComponent.$$render = function($$result, props, options) {
+ const ctx = define(props);
- ctx = Object.assign({}, ctx);
+ $$result.addComponent(SvelteComponent);
return ``;
};
@@ -46,7 +63,4 @@ SvelteComponent.css = {
};
var warned = false;
-
-SvelteComponent.preload = preload;
-
-module.exports = SvelteComponent;
\ No newline at end of file
+export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/ssr-no-oncreate-etc/input.html b/test/js/samples/ssr-no-oncreate-etc/input.html
index 1e8fff7de1..0ffe3c016c 100644
--- a/test/js/samples/ssr-no-oncreate-etc/input.html
+++ b/test/js/samples/ssr-no-oncreate-etc/input.html
@@ -1,4 +1,4 @@
-