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/each-block-array-literal/expected.js

168 lines
3.1 KiB

/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, append, createComment, createElement, createText, destroyEach, detachNode, flush, init, insert, noop, safe_not_equal, setData } from "svelte/internal";
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.num = list[i];
return child_ctx;
}
// (9:0) {#each [a, b, c, d, e] as num}
function create_each_block(ctx) {
var span, text_value = ctx.num, 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.a || changed.b || changed.c || changed.d || changed.e) && text_value !== (text_value = ctx.num)) {
setData(text, text_value);
}
},
d(detach) {
if (detach) {
detachNode(span);
}
}
};
}
function create_fragment(ctx) {
var each_anchor;
var each_value = [ctx.a, ctx.b, ctx.c, ctx.d, ctx.e];
var each_blocks = [];
for (var i = 0; i < 5; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
return {
c() {
for (var i = 0; i < 5; i += 1) {
each_blocks[i].c();
}
each_anchor = createComment();
},
m(target, anchor) {
for (var i = 0; i < 5; i += 1) {
each_blocks[i].m(target, anchor);
}
insert(target, each_anchor, anchor);
},
p(changed, ctx) {
if (changed.a || changed.b || changed.c || changed.d || changed.e) {
each_value = [ctx.a, ctx.b, ctx.c, ctx.d, ctx.e];
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(child_ctx);
each_blocks[i].c();
each_blocks[i].m(each_anchor.parentNode, each_anchor);
}
}
for (; i < 5; i += 1) {
each_blocks[i].d(1);
}
}
},
i: noop,
o: noop,
d(detach) {
destroyEach(each_blocks, detach);
if (detach) {
detachNode(each_anchor);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let { a, b, c, d, e } = $$props;
$$self.$set = $$props => {
if ('a' in $$props) $$invalidate('a', a = $$props.a);
if ('b' in $$props) $$invalidate('b', b = $$props.b);
if ('c' in $$props) $$invalidate('c', c = $$props.c);
if ('d' in $$props) $$invalidate('d', d = $$props.d);
if ('e' in $$props) $$invalidate('e', e = $$props.e);
};
return { a, b, c, d, e };
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, ["a", "b", "c", "d", "e"]);
}
get a() {
return this.$$.ctx.a;
}
set a(a) {
this.$set({ a });
flush();
}
get b() {
return this.$$.ctx.b;
}
set b(b) {
this.$set({ b });
flush();
}
get c() {
return this.$$.ctx.c;
}
set c(c) {
this.$set({ c });
flush();
}
get d() {
return this.$$.ctx.d;
}
set d(d) {
this.$set({ d });
flush();
}
get e() {
return this.$$.ctx.e;
}
set e(e) {
this.$set({ e });
flush();
}
}
export default SvelteComponent;