mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
116 lines
2.4 KiB
JavaScript
116 lines
2.4 KiB
JavaScript
/* generated by Svelte vX.Y.Z */
|
|
import { append, assign, createComment, createElement, createText, destroyEach, detachNode, init, insert, proto, setData } from "svelte/shared.js";
|
|
|
|
function get_each_context(ctx, list, i) {
|
|
const child_ctx = Object.create(ctx);
|
|
child_ctx.node = list[i];
|
|
child_ctx.each_value = list;
|
|
child_ctx.node_index = i;
|
|
return child_ctx;
|
|
}
|
|
|
|
function create_main_fragment(component, ctx) {
|
|
var each_anchor;
|
|
|
|
var each_value = ctx.createElement;
|
|
|
|
var each_blocks = [];
|
|
|
|
for (var i = 0; i < each_value.length; i += 1) {
|
|
each_blocks[i] = create_each_block(component, get_each_context(ctx, each_value, i));
|
|
}
|
|
|
|
return {
|
|
c() {
|
|
for (var i = 0; i < each_blocks.length; i += 1) {
|
|
each_blocks[i].c();
|
|
}
|
|
|
|
each_anchor = createComment();
|
|
},
|
|
|
|
m(target, anchor) {
|
|
for (var i = 0; i < each_blocks.length; i += 1) {
|
|
each_blocks[i].m(target, anchor);
|
|
}
|
|
|
|
insert(target, each_anchor, anchor);
|
|
},
|
|
|
|
p(changed, ctx) {
|
|
if (changed.createElement) {
|
|
each_value = ctx.createElement;
|
|
|
|
for (var i = 0; i < each_value.length; i += 1) {
|
|
const child_ctx = get_each_context(ctx, each_value, i);
|
|
|
|
if (each_blocks[i]) {
|
|
each_blocks[i].p(changed, child_ctx);
|
|
} else {
|
|
each_blocks[i] = create_each_block(component, child_ctx);
|
|
each_blocks[i].c();
|
|
each_blocks[i].m(each_anchor.parentNode, each_anchor);
|
|
}
|
|
}
|
|
|
|
for (; i < each_blocks.length; i += 1) {
|
|
each_blocks[i].d(1);
|
|
}
|
|
each_blocks.length = each_value.length;
|
|
}
|
|
},
|
|
|
|
d(detach) {
|
|
destroyEach(each_blocks, detach);
|
|
|
|
if (detach) {
|
|
detachNode(each_anchor);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
// (1:0) {#each createElement as node}
|
|
function create_each_block(component, ctx) {
|
|
var span, text_value = ctx.node, text;
|
|
|
|
return {
|
|
c() {
|
|
span = createElement("span");
|
|
text = createText(text_value);
|
|
},
|
|
|
|
m(target, anchor) {
|
|
insert(target, span, anchor);
|
|
append(span, text);
|
|
},
|
|
|
|
p(changed, ctx) {
|
|
if ((changed.createElement) && text_value !== (text_value = ctx.node)) {
|
|
setData(text, text_value);
|
|
}
|
|
},
|
|
|
|
d(detach) {
|
|
if (detach) {
|
|
detachNode(span);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
assign(SvelteComponent.prototype, proto);
|
|
export default SvelteComponent; |