mirror of https://github.com/sveltejs/svelte
70 lines
1.2 KiB
70 lines
1.2 KiB
/* generated by Svelte vX.Y.Z */
|
|
import { assign, callAll, init, noop, proto } from "svelte/shared.js";
|
|
|
|
|
|
export default (function() {
|
|
|
|
var template = (function() {
|
|
return {
|
|
components: {
|
|
Nested: window.Nested
|
|
}
|
|
};
|
|
}());
|
|
|
|
function create_main_fragment(state, component) {
|
|
|
|
var nested = new template.components.Nested({
|
|
_root: component._root,
|
|
data: { foo: "bar" }
|
|
});
|
|
|
|
return {
|
|
create: function() {
|
|
nested._fragment.create();
|
|
},
|
|
|
|
mount: function(target, anchor) {
|
|
nested._mount(target, anchor);
|
|
},
|
|
|
|
update: noop,
|
|
|
|
unmount: function() {
|
|
nested._unmount();
|
|
},
|
|
|
|
destroy: function() {
|
|
nested.destroy(false);
|
|
}
|
|
};
|
|
}
|
|
|
|
function SvelteComponent(options) {
|
|
init(this, options);
|
|
this._state = options.data || {};
|
|
|
|
if (!options._root) {
|
|
this._oncreate = [];
|
|
this._beforecreate = [];
|
|
this._aftercreate = [];
|
|
}
|
|
|
|
this._fragment = create_main_fragment(this._state, this);
|
|
|
|
if (options.target) {
|
|
this._fragment.create();
|
|
this._fragment.mount(options.target, options.anchor || null);
|
|
|
|
this._lock = true;
|
|
callAll(this._beforecreate);
|
|
callAll(this._oncreate);
|
|
callAll(this._aftercreate);
|
|
this._lock = false;
|
|
}
|
|
}
|
|
|
|
assign(SvelteComponent.prototype, proto);
|
|
|
|
return SvelteComponent;
|
|
}()); |