mirror of https://github.com/sveltejs/svelte
parent
ad653c5834
commit
7407bccb79
@ -1,48 +1,51 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import { assign, flush, init, noop, proto } from "svelte/shared.js";
|
||||
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, safe_not_equal } from "svelte/internal.js";
|
||||
|
||||
var Nested = window.Nested;
|
||||
const Nested = window.Nested;
|
||||
|
||||
function create_main_fragment(component, ctx) {
|
||||
function create_fragment(component, ctx) {
|
||||
var current;
|
||||
|
||||
var nested_initial_data = { foo: [1, 2, 3] };
|
||||
var nested = new Nested({
|
||||
root: component.root,
|
||||
store: component.store,
|
||||
data: nested_initial_data
|
||||
props: { foo: [1, 2, 3] }
|
||||
});
|
||||
|
||||
return {
|
||||
c() {
|
||||
nested._fragment.c();
|
||||
nested.$$.fragment.c();
|
||||
},
|
||||
|
||||
m(target, anchor) {
|
||||
nested._mount(target, anchor);
|
||||
mount_component(nested, target, anchor);
|
||||
current = true;
|
||||
},
|
||||
|
||||
p: noop,
|
||||
|
||||
i(target, anchor) {
|
||||
if (current) return;
|
||||
|
||||
this.m(target, anchor);
|
||||
},
|
||||
|
||||
o(outrocallback) {
|
||||
if (!current) return;
|
||||
|
||||
if (nested) nested.$$.fragment.o(outrocallback);
|
||||
current = false;
|
||||
},
|
||||
|
||||
d(detach) {
|
||||
nested.destroy(detach);
|
||||
nested.$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;
|
@ -1,50 +1,51 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import { _differsImmutable, assign, flush, init, noop, proto } from "svelte/shared.js";
|
||||
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, not_equal } from "svelte/internal.js";
|
||||
|
||||
var Nested = window.Nested;
|
||||
const Nested = window.Nested;
|
||||
|
||||
function create_main_fragment(component, ctx) {
|
||||
function create_fragment(component, ctx) {
|
||||
var current;
|
||||
|
||||
var nested_initial_data = { foo: "bar" };
|
||||
var nested = new Nested({
|
||||
root: component.root,
|
||||
store: component.store,
|
||||
data: nested_initial_data
|
||||
props: { foo: "bar" }
|
||||
});
|
||||
|
||||
return {
|
||||
c() {
|
||||
nested._fragment.c();
|
||||
nested.$$.fragment.c();
|
||||
},
|
||||
|
||||
m(target, anchor) {
|
||||
nested._mount(target, anchor);
|
||||
mount_component(nested, target, anchor);
|
||||
current = true;
|
||||
},
|
||||
|
||||
p: noop,
|
||||
|
||||
i(target, anchor) {
|
||||
if (current) return;
|
||||
|
||||
this.m(target, anchor);
|
||||
},
|
||||
|
||||
o(outrocallback) {
|
||||
if (!current) return;
|
||||
|
||||
if (nested) nested.$$.fragment.o(outrocallback);
|
||||
current = false;
|
||||
},
|
||||
|
||||
d(detach) {
|
||||
nested.destroy(detach);
|
||||
nested.$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, not_equal);
|
||||
}
|
||||
}
|
||||
|
||||
assign(SvelteComponent.prototype, proto);
|
||||
|
||||
SvelteComponent.prototype._differs = _differsImmutable;
|
||||
export default SvelteComponent;
|
@ -1,48 +1,51 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import { assign, flush, init, noop, proto } from "svelte/shared.js";
|
||||
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, safe_not_equal } from "svelte/internal.js";
|
||||
|
||||
var Nested = window.Nested;
|
||||
const Nested = window.Nested;
|
||||
|
||||
function create_main_fragment(component, ctx) {
|
||||
function create_fragment(component, ctx) {
|
||||
var current;
|
||||
|
||||
var nested_initial_data = { foo: "bar" };
|
||||
var nested = new Nested({
|
||||
root: component.root,
|
||||
store: component.store,
|
||||
data: nested_initial_data
|
||||
props: { foo: "bar" }
|
||||
});
|
||||
|
||||
return {
|
||||
c() {
|
||||
nested._fragment.c();
|
||||
nested.$$.fragment.c();
|
||||
},
|
||||
|
||||
m(target, anchor) {
|
||||
nested._mount(target, anchor);
|
||||
mount_component(nested, target, anchor);
|
||||
current = true;
|
||||
},
|
||||
|
||||
p: noop,
|
||||
|
||||
i(target, anchor) {
|
||||
if (current) return;
|
||||
|
||||
this.m(target, anchor);
|
||||
},
|
||||
|
||||
o(outrocallback) {
|
||||
if (!current) return;
|
||||
|
||||
if (nested) nested.$$.fragment.o(outrocallback);
|
||||
current = false;
|
||||
},
|
||||
|
||||
d(detach) {
|
||||
nested.destroy(detach);
|
||||
nested.$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;
|
@ -1,48 +1,46 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import { assign, assignTrue, flush, init, noop, proto } from "svelte/shared.js";
|
||||
|
||||
function data_1() {
|
||||
return {
|
||||
foo: 'bar'
|
||||
};
|
||||
}
|
||||
|
||||
function oncreate() {
|
||||
alert(JSON.stringify(data()));
|
||||
};
|
||||
|
||||
function create_main_fragment(component, ctx) {
|
||||
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||
import { SvelteComponent as SvelteComponent_1, flush, init, noop, run, safe_not_equal } from "svelte/internal.js";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
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(data_1(), options.data);
|
||||
this._intro = true;
|
||||
function define($$self, $$props) {
|
||||
let { foo = 'bar' } = $$props;
|
||||
|
||||
this._fragment = create_main_fragment(this, this._state);
|
||||
|
||||
this.root._oncreate.push(() => {
|
||||
oncreate.call(this);
|
||||
this.fire("update", { changed: assignTrue({}, this._state), current: this._state });
|
||||
onMount(() => {
|
||||
alert(JSON.stringify(data()));
|
||||
});
|
||||
|
||||
if (options.target) {
|
||||
this._fragment.c();
|
||||
this._mount(options.target, options.anchor);
|
||||
$$self.$$.get = () => ({ foo });
|
||||
|
||||
$$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;
|
||||
}
|
||||
|
||||
flush(this);
|
||||
set foo(value) {
|
||||
this.$set({ foo: value });
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
assign(SvelteComponent.prototype, proto);
|
||||
export default SvelteComponent;
|
@ -1,46 +1,72 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import { assign, flush, init, noop, proto } from "svelte/shared.js";
|
||||
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||
import { SvelteComponent as SvelteComponent_1, flush, init, mount_component, safe_not_equal } from "svelte/internal.js";
|
||||
|
||||
function create_main_fragment(component, ctx) {
|
||||
function func() {
|
||||
return import('./Foo.html');
|
||||
}
|
||||
|
||||
function create_fragment(component, ctx) {
|
||||
var current;
|
||||
|
||||
var lazyload_initial_data = { load: () => import('./Foo.html') };
|
||||
var lazyload = new LazyLoad({
|
||||
root: component.root,
|
||||
store: component.store,
|
||||
data: lazyload_initial_data
|
||||
var lazyload = new ctx.LazyLoad({
|
||||
props: { load: func }
|
||||
});
|
||||
|
||||
return {
|
||||
c() {
|
||||
lazyload._fragment.c();
|
||||
lazyload.$$.fragment.c();
|
||||
},
|
||||
|
||||
m(target, anchor) {
|
||||
lazyload._mount(target, anchor);
|
||||
mount_component(lazyload, target, anchor);
|
||||
current = true;
|
||||
},
|
||||
|
||||
p: noop,
|
||||
|
||||
i(target, anchor) {
|
||||
if (current) return;
|
||||
|
||||
this.m(target, anchor);
|
||||
},
|
||||
|
||||
o(outrocallback) {
|
||||
if (!current) return;
|
||||
|
||||
if (lazyload) lazyload.$$.fragment.o(outrocallback);
|
||||
current = false;
|
||||
},
|
||||
|
||||
d(detach) {
|
||||
lazyload.destroy(detach);
|
||||
lazyload.$destroy(detach);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function SvelteComponent(options) {
|
||||
init(this, options);
|
||||
this._state = assign({}, options.data);
|
||||
this._intro = true;
|
||||
function define($$self, $$props) {
|
||||
let { LazyLoad } = $$props;
|
||||
|
||||
$$self.$$.get = () => ({ LazyLoad });
|
||||
|
||||
this._fragment = create_main_fragment(this, this._state);
|
||||
$$self.$$.set = $$props => {
|
||||
if ('LazyLoad' in $$props) LazyLoad = $$props.LazyLoad;
|
||||
};
|
||||
}
|
||||
|
||||
if (options.target) {
|
||||
this._fragment.c();
|
||||
this._mount(options.target, options.anchor);
|
||||
class SvelteComponent extends SvelteComponent_1 {
|
||||
constructor(options) {
|
||||
super();
|
||||
init(this, options, define, create_fragment, safe_not_equal);
|
||||
}
|
||||
|
||||
get LazyLoad() {
|
||||
return this.$$.get().LazyLoad;
|
||||
}
|
||||
|
||||
flush(this);
|
||||
set LazyLoad(value) {
|
||||
this.$set({ LazyLoad: value });
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
assign(SvelteComponent.prototype, proto);
|
||||
export default SvelteComponent;
|
@ -1,60 +1,77 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import { assign, createElement, detachNode, init, insert, proto } from "svelte/shared.js";
|
||||
/* generated by Svelte vX.Y.Z-alpha1 */
|
||||
import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, flush, init, insert, noop, removeListener, run, safe_not_equal } from "svelte/internal.js";
|
||||
|
||||
function foo( node, callback ) {
|
||||
// code goes here
|
||||
};
|
||||
|
||||
var methods = {
|
||||
foo ( bar ) {
|
||||
console.log( bar );
|
||||
}
|
||||
};
|
||||
function handleFoo(bar) {
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function create_main_fragment(component, ctx) {
|
||||
var button, foo_handler;
|
||||
function create_fragment(component, ctx) {
|
||||
var button, current;
|
||||
|
||||
return {
|
||||
c() {
|
||||
button = createElement("button");
|
||||
button.textContent = "foo";
|
||||
foo_handler = foo.call(component, button, function(event) {
|
||||
component.foo( ctx.bar );
|
||||
});
|
||||
addListener(button, "foo", ctx.foo_handler);
|
||||
},
|
||||
|
||||
m(target, anchor) {
|
||||
insert(target, button, anchor);
|
||||
current = true;
|
||||
},
|
||||
|
||||
p(changed, _ctx) {
|
||||
ctx = _ctx;
|
||||
p: noop,
|
||||
|
||||
i(target, anchor) {
|
||||
if (current) return;
|
||||
|
||||
this.m(target, anchor);
|
||||
},
|
||||
|
||||
o: run,
|
||||
|
||||
d(detach) {
|
||||
if (detach) {
|
||||
detachNode(button);
|
||||
}
|
||||
|
||||
foo_handler.destroy();
|
||||
removeListener(button, "foo", ctx.foo_handler);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function SvelteComponent(options) {
|
||||
init(this, options);
|
||||
this._state = assign({}, options.data);
|
||||
this._intro = true;
|
||||
function define($$self, $$props) {
|
||||
let { bar } = $$props;
|
||||
|
||||
this._fragment = create_main_fragment(this, this._state);
|
||||
function foo(node, callback) {
|
||||
// code goes here
|
||||
}
|
||||
|
||||
if (options.target) {
|
||||
this._fragment.c();
|
||||
this._mount(options.target, options.anchor);
|
||||
function foo_handler() {
|
||||
return handleFoo(bar);
|
||||
}
|
||||
|
||||
// TODO only what's needed by the template
|
||||
$$self.$$.get = () => ({ bar, foo_handler });
|
||||
|
||||
$$self.$$.set = $$props => {
|
||||
if ('bar' in $$props) bar = $$props.bar;
|
||||
};
|
||||
}
|
||||
|
||||
assign(SvelteComponent.prototype, proto);
|
||||
assign(SvelteComponent.prototype, methods);
|
||||
class SvelteComponent extends SvelteComponent_1 {
|
||||
constructor(options) {
|
||||
super();
|
||||
init(this, options, define, create_fragment, safe_not_equal);
|
||||
}
|
||||
|
||||
get bar() {
|
||||
return this.$$.get().bar;
|
||||
}
|
||||
|
||||
set bar(value) {
|
||||
this.$set({ bar: value });
|
||||
flush();
|
||||
}
|
||||
}
|
||||
export default SvelteComponent;
|
@ -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;
|
@ -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;
|
@ -1,9 +1,9 @@
|
||||
<script scope="shared">
|
||||
<script context="module">
|
||||
export const SOME_CONSTANT = 42;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export function foo(bar) {
|
||||
console.log( bar );
|
||||
console.log(bar);
|
||||
}
|
||||
</script>
|
Loading…
Reference in new issue