You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/js/samples/legacy-default/expected.js

85 lines
2.3 KiB

/* generated by Svelte vX.Y.Z */
import { appendNode, assign, callAll, createComment, createElement, createFragment, createText, detachNode, init, insertNode, noop, proto, reinsertBetween } from "svelte/shared.js";
function create_main_fragment(state, component) {
var text, p, text_1, text_2, text_3, slot_content_default = component._slotted["default"], slot_content_default_before, slot_content_default_after;
var foo = new Foo({
root: component.root,
slots: { "default": createFragment() }
});
return {
c: function create() {
text = createText("\n\t");
p = createElement("p");
text_1 = createText("some default slotted content");
text_2 = createText("\n");
foo._fragment.c();
text_3 = createText("\n\n");
},
m: function mount(target, anchor) {
appendNode(text, foo._slotted["default"]);
appendNode(p, foo._slotted["default"]);
appendNode(text_1, p);
appendNode(text_2, foo._slotted["default"]);
foo._mount(target, anchor);
insertNode(text_3, target, anchor);
if (slot_content_default) {
insertNode(slot_content_default_before || (slot_content_default_before = createComment()), target, anchor);
insertNode(slot_content_default, target, anchor);
insertNode(slot_content_default_after || (slot_content_default_after = createComment()), target, anchor);
}
},
p: noop,
u: function unmount() {
foo._unmount();
detachNode(text_3);
if (slot_content_default) {
reinsertBetween(slot_content_default_before, slot_content_default_after, slot_content_default);
detachNode(slot_content_default_before);
detachNode(slot_content_default_after);
}
},
d: function destroy() {
foo.destroy(false);
}
};
}
function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);
this._slotted = options.slots || {};
if (!options.root) {
this._oncreate = [];
this._beforecreate = [];
this._aftercreate = [];
}
this.slots = {};
this._fragment = create_main_fragment(this._state, this);
if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._lock = true;
callAll(this._beforecreate);
callAll(this._oncreate);
callAll(this._aftercreate);
this._lock = false;
}
}
assign(SvelteComponent.prototype, proto);
export default SvelteComponent;