pull/1746/head
Rich Harris 8 years ago
parent de23c5b83e
commit 60ab41fa91

@ -16,56 +16,4 @@ export default class DebugTag extends Node {
return new Expression(component, parent, scope, node);
});
}
build(
block: Block,
parentNode: string,
parentNodes: string,
) {
if (!this.component.options.dev) return;
const { code } = this.component;
if (this.expressions.length === 0) {
// Debug all
code.overwrite(this.start + 1, this.start + 7, 'debugger', {
storeName: true
});
const statement = `[✂${this.start + 1}-${this.start + 7}✂];`;
block.builders.create.addLine(statement);
block.builders.update.addLine(statement);
} else {
const { code } = this.component;
code.overwrite(this.start + 1, this.start + 7, 'log', {
storeName: true
});
const log = `[✂${this.start + 1}-${this.start + 7}✂]`;
const dependencies = new Set();
this.expressions.forEach(expression => {
addToSet(dependencies, expression.dependencies);
});
const condition = [...dependencies].map(d => `changed.${d}`).join(' || ');
const identifiers = this.expressions.map(e => e.node.name).join(', ');
block.builders.update.addBlock(deindent`
if (${condition}) {
const { ${identifiers} } = ctx;
console.${log}({ ${identifiers} });
debugger;
}
`);
block.builders.create.addBlock(deindent`
{
const { ${identifiers} } = ctx;
console.${log}({ ${identifiers} });
debugger;
}
`);
}
}
}

@ -51,7 +51,7 @@ export default class Renderer {
});
this.block.hasUpdateMethod = true;
this.blocks = [this.block];
this.blocks = [];
this.fragment = new FragmentWrapper(
this,
@ -62,6 +62,8 @@ export default class Renderer {
null
);
this.blocks.push(this.block);
this.blocks.forEach(block => {
if (typeof block !== 'string') {
block.assignVariableNames();

@ -98,7 +98,11 @@ export default function dom(
`);
}
renderer.blocks.forEach(block => {
// fix order
// TODO the deconflicted names of blocks are reversed... should set them here
const blocks = renderer.blocks.slice().reverse();
blocks.forEach(block => {
builder.addBlock(block.toString());
});

@ -0,0 +1,72 @@
import Renderer from '../Renderer';
import Wrapper from './shared/Wrapper';
import Block from '../Block';
import DebugTag from '../../nodes/DebugTag';
import addToSet from '../../../utils/addToSet';
import deindent from '../../../utils/deindent';
export default class DebugTagWrapper extends Wrapper {
node: DebugTag;
constructor(
renderer: Renderer,
block: Block,
parent: Wrapper,
node: DebugTag,
stripWhitespace: boolean,
nextSibling: Wrapper
) {
super(renderer, block, parent, node);
}
render(block: Block, parentNode: string, parentNodes: string) {
const { renderer } = this;
const { component } = renderer;
if (!renderer.options.dev) return;
const { code } = component;
if (this.node.expressions.length === 0) {
// Debug all
code.overwrite(this.node.start + 1, this.node.start + 7, 'debugger', {
storeName: true
});
const statement = `[✂${this.node.start + 1}-${this.node.start + 7}✂];`;
block.builders.create.addLine(statement);
block.builders.update.addLine(statement);
} else {
const { code } = component;
code.overwrite(this.node.start + 1, this.node.start + 7, 'log', {
storeName: true
});
const log = `[✂${this.node.start + 1}-${this.node.start + 7}✂]`;
const dependencies = new Set();
this.node.expressions.forEach(expression => {
addToSet(dependencies, expression.dependencies);
});
const condition = [...dependencies].map(d => `changed.${d}`).join(' || ');
const identifiers = this.node.expressions.map(e => e.node.name).join(', ');
block.builders.update.addBlock(deindent`
if (${condition}) {
const { ${identifiers} } = ctx;
console.${log}({ ${identifiers} });
debugger;
}
`);
block.builders.create.addBlock(deindent`
{
const { ${identifiers} } = ctx;
console.${log}({ ${identifiers} });
debugger;
}
`);
}
}
}

@ -1,5 +1,6 @@
import Wrapper from './shared/Wrapper';
import AwaitBlock from './AwaitBlock';
import DebugTag from './DebugTag';
import EachBlock from './EachBlock';
import Element from './Element';
import Head from './Head';
@ -20,6 +21,7 @@ import Block from '../Block';
const wrappers = {
AwaitBlock,
Comment: null,
DebugTag,
EachBlock,
Element,
Head,
@ -86,7 +88,7 @@ export default class FragmentWrapper {
}
// glue text nodes (which could e.g. be separated by comments) together
if (lastChild && lastChild.type === 'Text') {
if (lastChild && lastChild.node.type === 'Text') {
lastChild.data = data + lastChild.data;
continue;
}
@ -101,7 +103,7 @@ export default class FragmentWrapper {
else {
const Wrapper = wrappers[child.type];
if (!Wrapper) return;
if (!Wrapper) continue;
const wrapper = new Wrapper(renderer, block, parent, child, stripWhitespace, lastChild || nextSibling);
this.nodes.unshift(wrapper);
@ -116,6 +118,7 @@ export default class FragmentWrapper {
if (first && first.node.type === 'Text') {
first.data = trimStart(first.data);
if (!first.data) {
first.var = null;
this.nodes.shift();
if (this.nodes.length) {

@ -4,7 +4,7 @@ import * as path from "path";
import { rollup } from "rollup";
import { loadConfig, svelte } from "../helpers.js";
describe("js", () => {
describe.only("js", () => {
fs.readdirSync("test/js/samples").forEach(dir => {
if (dir[0] === ".") return;

@ -191,30 +191,30 @@ var protoDev = {
const file = undefined;
function create_main_fragment(component, ctx) {
var h1, text, text_1, text_2, text_3;
var h1, text0, text1, text2, text3;
return {
c: function create() {
h1 = createElement("h1");
text = createText("Hello ");
text_1 = createText(ctx.name);
text_2 = createText("!");
text_3 = createText("\n");
text0 = createText("Hello ");
text1 = createText(ctx.name);
text2 = createText("!");
text3 = createText("\n");
debugger;
addLoc(h1, file, 0, 0, 0);
},
m: function mount(target, anchor) {
insert(target, h1, anchor);
append(h1, text);
append(h1, text_1);
append(h1, text_2);
insert(target, text_3, anchor);
append(h1, text0);
append(h1, text1);
append(h1, text2);
insert(target, text3, anchor);
},
p: function update(changed, ctx) {
if (changed.name) {
setData(text_1, ctx.name);
setData(text1, ctx.name);
}
debugger;
@ -223,7 +223,7 @@ function create_main_fragment(component, ctx) {
d: function destroy$$1(detach) {
if (detach) {
detachNode(h1);
detachNode(text_3);
detachNode(text3);
}
}
};

@ -4,30 +4,30 @@ import { addLoc, append, assign, createElement, createText, detachNode, init, in
const file = undefined;
function create_main_fragment(component, ctx) {
var h1, text, text_1, text_2, text_3;
var h1, text0, text1, text2, text3;
return {
c: function create() {
h1 = createElement("h1");
text = createText("Hello ");
text_1 = createText(ctx.name);
text_2 = createText("!");
text_3 = createText("\n");
text0 = createText("Hello ");
text1 = createText(ctx.name);
text2 = createText("!");
text3 = createText("\n");
debugger;
addLoc(h1, file, 0, 0, 0);
},
m: function mount(target, anchor) {
insert(target, h1, anchor);
append(h1, text);
append(h1, text_1);
append(h1, text_2);
insert(target, text_3, anchor);
append(h1, text0);
append(h1, text1);
append(h1, text2);
insert(target, text3, anchor);
},
p: function update(changed, ctx) {
if (changed.name) {
setData(text_1, ctx.name);
setData(text1, ctx.name);
}
debugger;
@ -36,7 +36,7 @@ function create_main_fragment(component, ctx) {
d: function destroy(detach) {
if (detach) {
detachNode(h1);
detachNode(text_3);
detachNode(text3);
}
}
};

@ -196,8 +196,16 @@ var protoDev = {
const file = undefined;
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var text, p, text_1, text_2;
var text0, p, text1, text2;
var each_value = ctx.things;
@ -213,10 +221,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].c();
}
text = createText("\n\n");
text0 = createText("\n\n");
p = createElement("p");
text_1 = createText("foo: ");
text_2 = createText(ctx.foo);
text1 = createText("foo: ");
text2 = createText(ctx.foo);
addLoc(p, file, 5, 0, 91);
},
@ -225,10 +233,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].m(target, anchor);
}
insert(target, text, anchor);
insert(target, text0, anchor);
insert(target, p, anchor);
append(p, text_1);
append(p, text_2);
append(p, text1);
append(p, text2);
},
p: function update(changed, ctx) {
@ -243,7 +251,7 @@ function create_main_fragment(component, ctx) {
} else {
each_blocks[i] = create_each_block(component, child_ctx);
each_blocks[i].c();
each_blocks[i].m(text.parentNode, text);
each_blocks[i].m(text0.parentNode, text0);
}
}
@ -254,7 +262,7 @@ function create_main_fragment(component, ctx) {
}
if (changed.foo) {
setData(text_2, ctx.foo);
setData(text2, ctx.foo);
}
},
@ -262,7 +270,7 @@ function create_main_fragment(component, ctx) {
destroyEach(each_blocks, detach);
if (detach) {
detachNode(text);
detachNode(text0);
detachNode(p);
}
}
@ -271,13 +279,13 @@ function create_main_fragment(component, ctx) {
// (1:0) {#each things as thing}
function create_each_block(component, ctx) {
var span, text_value = ctx.thing.name, text, text_1;
var span, text0_value = ctx.thing.name, text0, text1;
return {
c: function create() {
span = createElement("span");
text = createText(text_value);
text_1 = createText("\n\t");
text0 = createText(text0_value);
text1 = createText("\n\t");
{
const { foo, bar, baz, thing } = ctx;
@ -289,13 +297,13 @@ function create_each_block(component, ctx) {
m: function mount(target, anchor) {
insert(target, span, anchor);
append(span, text);
insert(target, text_1, anchor);
append(span, text0);
insert(target, text1, anchor);
},
p: function update(changed, ctx) {
if ((changed.things) && text_value !== (text_value = ctx.thing.name)) {
setData(text, text_value);
if ((changed.things) && text0_value !== (text0_value = ctx.thing.name)) {
setData(text0, text0_value);
}
if (changed.foo || changed.bar || changed.baz || changed.things) {
@ -308,20 +316,12 @@ function create_each_block(component, ctx) {
d: function destroy$$1(detach) {
if (detach) {
detachNode(span);
detachNode(text_1);
detachNode(text1);
}
}
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option");

@ -3,8 +3,16 @@ import { addLoc, append, assign, createElement, createText, destroyEach, detachN
const file = undefined;
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var text, p, text_1, text_2;
var text0, p, text1, text2;
var each_value = ctx.things;
@ -20,10 +28,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].c();
}
text = createText("\n\n");
text0 = createText("\n\n");
p = createElement("p");
text_1 = createText("foo: ");
text_2 = createText(ctx.foo);
text1 = createText("foo: ");
text2 = createText(ctx.foo);
addLoc(p, file, 5, 0, 91);
},
@ -32,10 +40,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].m(target, anchor);
}
insert(target, text, anchor);
insert(target, text0, anchor);
insert(target, p, anchor);
append(p, text_1);
append(p, text_2);
append(p, text1);
append(p, text2);
},
p: function update(changed, ctx) {
@ -50,7 +58,7 @@ function create_main_fragment(component, ctx) {
} else {
each_blocks[i] = create_each_block(component, child_ctx);
each_blocks[i].c();
each_blocks[i].m(text.parentNode, text);
each_blocks[i].m(text0.parentNode, text0);
}
}
@ -61,7 +69,7 @@ function create_main_fragment(component, ctx) {
}
if (changed.foo) {
setData(text_2, ctx.foo);
setData(text2, ctx.foo);
}
},
@ -69,7 +77,7 @@ function create_main_fragment(component, ctx) {
destroyEach(each_blocks, detach);
if (detach) {
detachNode(text);
detachNode(text0);
detachNode(p);
}
}
@ -78,13 +86,13 @@ function create_main_fragment(component, ctx) {
// (1:0) {#each things as thing}
function create_each_block(component, ctx) {
var span, text_value = ctx.thing.name, text, text_1;
var span, text0_value = ctx.thing.name, text0, text1;
return {
c: function create() {
span = createElement("span");
text = createText(text_value);
text_1 = createText("\n\t");
text0 = createText(text0_value);
text1 = createText("\n\t");
{
const { foo, bar, baz, thing } = ctx;
@ -96,13 +104,13 @@ function create_each_block(component, ctx) {
m: function mount(target, anchor) {
insert(target, span, anchor);
append(span, text);
insert(target, text_1, anchor);
append(span, text0);
insert(target, text1, anchor);
},
p: function update(changed, ctx) {
if ((changed.things) && text_value !== (text_value = ctx.thing.name)) {
setData(text, text_value);
if ((changed.things) && text0_value !== (text0_value = ctx.thing.name)) {
setData(text0, text0_value);
}
if (changed.foo || changed.bar || changed.baz || changed.things) {
@ -115,20 +123,12 @@ function create_each_block(component, ctx) {
d: function destroy(detach) {
if (detach) {
detachNode(span);
detachNode(text_1);
detachNode(text1);
}
}
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option");

@ -196,8 +196,16 @@ var protoDev = {
const file = undefined;
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var text, p, text_1, text_2;
var text0, p, text1, text2;
var each_value = ctx.things;
@ -213,10 +221,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].c();
}
text = createText("\n\n");
text0 = createText("\n\n");
p = createElement("p");
text_1 = createText("foo: ");
text_2 = createText(ctx.foo);
text1 = createText("foo: ");
text2 = createText(ctx.foo);
addLoc(p, file, 5, 0, 74);
},
@ -225,10 +233,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].m(target, anchor);
}
insert(target, text, anchor);
insert(target, text0, anchor);
insert(target, p, anchor);
append(p, text_1);
append(p, text_2);
append(p, text1);
append(p, text2);
},
p: function update(changed, ctx) {
@ -243,7 +251,7 @@ function create_main_fragment(component, ctx) {
} else {
each_blocks[i] = create_each_block(component, child_ctx);
each_blocks[i].c();
each_blocks[i].m(text.parentNode, text);
each_blocks[i].m(text0.parentNode, text0);
}
}
@ -254,7 +262,7 @@ function create_main_fragment(component, ctx) {
}
if (changed.foo) {
setData(text_2, ctx.foo);
setData(text2, ctx.foo);
}
},
@ -262,7 +270,7 @@ function create_main_fragment(component, ctx) {
destroyEach(each_blocks, detach);
if (detach) {
detachNode(text);
detachNode(text0);
detachNode(p);
}
}
@ -271,13 +279,13 @@ function create_main_fragment(component, ctx) {
// (1:0) {#each things as thing}
function create_each_block(component, ctx) {
var span, text_value = ctx.thing.name, text, text_1;
var span, text0_value = ctx.thing.name, text0, text1;
return {
c: function create() {
span = createElement("span");
text = createText(text_value);
text_1 = createText("\n\t");
text0 = createText(text0_value);
text1 = createText("\n\t");
{
const { foo } = ctx;
@ -289,13 +297,13 @@ function create_each_block(component, ctx) {
m: function mount(target, anchor) {
insert(target, span, anchor);
append(span, text);
insert(target, text_1, anchor);
append(span, text0);
insert(target, text1, anchor);
},
p: function update(changed, ctx) {
if ((changed.things) && text_value !== (text_value = ctx.thing.name)) {
setData(text, text_value);
if ((changed.things) && text0_value !== (text0_value = ctx.thing.name)) {
setData(text0, text0_value);
}
if (changed.foo) {
@ -308,20 +316,12 @@ function create_each_block(component, ctx) {
d: function destroy$$1(detach) {
if (detach) {
detachNode(span);
detachNode(text_1);
detachNode(text1);
}
}
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option");

@ -3,8 +3,16 @@ import { addLoc, append, assign, createElement, createText, destroyEach, detachN
const file = undefined;
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var text, p, text_1, text_2;
var text0, p, text1, text2;
var each_value = ctx.things;
@ -20,10 +28,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].c();
}
text = createText("\n\n");
text0 = createText("\n\n");
p = createElement("p");
text_1 = createText("foo: ");
text_2 = createText(ctx.foo);
text1 = createText("foo: ");
text2 = createText(ctx.foo);
addLoc(p, file, 5, 0, 74);
},
@ -32,10 +40,10 @@ function create_main_fragment(component, ctx) {
each_blocks[i].m(target, anchor);
}
insert(target, text, anchor);
insert(target, text0, anchor);
insert(target, p, anchor);
append(p, text_1);
append(p, text_2);
append(p, text1);
append(p, text2);
},
p: function update(changed, ctx) {
@ -50,7 +58,7 @@ function create_main_fragment(component, ctx) {
} else {
each_blocks[i] = create_each_block(component, child_ctx);
each_blocks[i].c();
each_blocks[i].m(text.parentNode, text);
each_blocks[i].m(text0.parentNode, text0);
}
}
@ -61,7 +69,7 @@ function create_main_fragment(component, ctx) {
}
if (changed.foo) {
setData(text_2, ctx.foo);
setData(text2, ctx.foo);
}
},
@ -69,7 +77,7 @@ function create_main_fragment(component, ctx) {
destroyEach(each_blocks, detach);
if (detach) {
detachNode(text);
detachNode(text0);
detachNode(p);
}
}
@ -78,13 +86,13 @@ function create_main_fragment(component, ctx) {
// (1:0) {#each things as thing}
function create_each_block(component, ctx) {
var span, text_value = ctx.thing.name, text, text_1;
var span, text0_value = ctx.thing.name, text0, text1;
return {
c: function create() {
span = createElement("span");
text = createText(text_value);
text_1 = createText("\n\t");
text0 = createText(text0_value);
text1 = createText("\n\t");
{
const { foo } = ctx;
@ -96,13 +104,13 @@ function create_each_block(component, ctx) {
m: function mount(target, anchor) {
insert(target, span, anchor);
append(span, text);
insert(target, text_1, anchor);
append(span, text0);
insert(target, text1, anchor);
},
p: function update(changed, ctx) {
if ((changed.things) && text_value !== (text_value = ctx.thing.name)) {
setData(text, text_value);
if ((changed.things) && text0_value !== (text0_value = ctx.thing.name)) {
setData(text0, text0_value);
}
if (changed.foo) {
@ -115,20 +123,12 @@ function create_each_block(component, ctx) {
d: function destroy(detach) {
if (detach) {
detachNode(span);
detachNode(text_1);
detachNode(text1);
}
}
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
this._debugName = '<SvelteComponent>';
if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option");

@ -174,6 +174,14 @@ var proto = {
/* generated by Svelte vX.Y.Z */
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;
@ -264,14 +272,6 @@ function create_each_block(component, ctx) {
};
}
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 SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);

@ -1,6 +1,14 @@
/* 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;
@ -91,14 +99,6 @@ function create_each_block(component, ctx) {
};
}
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 SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);

@ -195,31 +195,31 @@ function bar({ foo }) {
const file = undefined;
function create_main_fragment(component, ctx) {
var p, text1_value = ctx.Math.max(0, ctx.foo), text1, text2, text3;
var p, text0_value = ctx.Math.max(0, ctx.foo), text0, text1, text2;
return {
c: function create() {
p = createElement("p");
text1 = createText(text1_value);
text2 = createText("\n\t");
text3 = createText(ctx.bar);
text0 = createText(text0_value);
text1 = createText("\n\t");
text2 = createText(ctx.bar);
addLoc(p, file, 0, 0, 0);
},
m: function mount(target, anchor) {
insert(target, p, anchor);
append(p, text0);
append(p, text1);
append(p, text2);
append(p, text3);
},
p: function update(changed, ctx) {
if ((changed.Math || changed.foo) && text1_value !== (text1_value = ctx.Math.max(0, ctx.foo))) {
setData(text1, text1_value);
if ((changed.Math || changed.foo) && text0_value !== (text0_value = ctx.Math.max(0, ctx.foo))) {
setData(text0, text0_value);
}
if (changed.bar) {
setData(text3, ctx.bar);
setData(text2, ctx.bar);
}
},

@ -8,31 +8,31 @@ function bar({ foo }) {
const file = undefined;
function create_main_fragment(component, ctx) {
var p, text1_value = ctx.Math.max(0, ctx.foo), text1, text2, text3;
var p, text0_value = ctx.Math.max(0, ctx.foo), text0, text1, text2;
return {
c: function create() {
p = createElement("p");
text1 = createText(text1_value);
text2 = createText("\n\t");
text3 = createText(ctx.bar);
text0 = createText(text0_value);
text1 = createText("\n\t");
text2 = createText(ctx.bar);
addLoc(p, file, 0, 0, 0);
},
m: function mount(target, anchor) {
insert(target, p, anchor);
append(p, text0);
append(p, text1);
append(p, text2);
append(p, text3);
},
p: function update(changed, ctx) {
if ((changed.Math || changed.foo) && text1_value !== (text1_value = ctx.Math.max(0, ctx.foo))) {
setData(text1, text1_value);
if ((changed.Math || changed.foo) && text0_value !== (text0_value = ctx.Math.max(0, ctx.foo))) {
setData(text0, text0_value);
}
if (changed.bar) {
setData(text3, ctx.bar);
setData(text2, ctx.bar);
}
},

@ -492,6 +492,14 @@ function foo(node, animation, params) {
}
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var each_blocks_1 = [], each_lookup = blankObject(), each_anchor;
@ -583,14 +591,6 @@ function create_each_block(component, key_1, ctx) {
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);

@ -15,6 +15,14 @@ function foo(node, animation, params) {
};
};
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var each_blocks_1 = [], each_lookup = blankObject(), each_anchor;
@ -106,14 +114,6 @@ function create_each_block(component, key_1, ctx) {
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);

@ -259,6 +259,14 @@ var proto = {
/* generated by Svelte vX.Y.Z */
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var each_blocks_1 = [], each_lookup = blankObject(), each_anchor;
@ -334,14 +342,6 @@ function create_each_block(component, key_1, ctx) {
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);

@ -1,6 +1,14 @@
/* generated by Svelte vX.Y.Z */
import { append, assign, blankObject, createComment, createElement, createText, destroyBlock, detachNode, init, insert, proto, setData, updateKeyedEach } from "svelte/shared.js";
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function create_main_fragment(component, ctx) {
var each_blocks_1 = [], each_lookup = blankObject(), each_anchor;
@ -76,14 +84,6 @@ function create_each_block(component, key_1, ctx) {
};
}
function get_each_context(ctx, list, i) {
const child_ctx = Object.create(ctx);
child_ctx.thing = list[i];
child_ctx.each_value = list;
child_ctx.thing_index = i;
return child_ctx;
}
function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);

@ -196,14 +196,14 @@ function create_main_fragment(component, ctx) {
};
}
// (1:0) {#if foo}
function create_if_block(component, ctx) {
// (3:0) {:else}
function create_else_block(component, ctx) {
var p;
return {
c() {
p = createElement("p");
p.textContent = "foo!";
p.textContent = "not foo!";
},
m(target, anchor) {
@ -218,14 +218,14 @@ function create_if_block(component, ctx) {
};
}
// (3:0) {:else}
function create_else_block(component, ctx) {
// (1:0) {#if foo}
function create_if_block(component, ctx) {
var p;
return {
c() {
p = createElement("p");
p.textContent = "not foo!";
p.textContent = "foo!";
},
m(target, anchor) {

@ -41,14 +41,14 @@ function create_main_fragment(component, ctx) {
};
}
// (1:0) {#if foo}
function create_if_block(component, ctx) {
// (3:0) {:else}
function create_else_block(component, ctx) {
var p;
return {
c() {
p = createElement("p");
p.textContent = "foo!";
p.textContent = "not foo!";
},
m(target, anchor) {
@ -63,14 +63,14 @@ function create_if_block(component, ctx) {
};
}
// (3:0) {:else}
function create_else_block(component, ctx) {
// (1:0) {#if foo}
function create_if_block(component, ctx) {
var p;
return {
c() {
p = createElement("p");
p.textContent = "not foo!";
p.textContent = "foo!";
},
m(target, anchor) {

@ -165,111 +165,113 @@ var proto = {
/* generated by Svelte vX.Y.Z */
function create_main_fragment(component, ctx) {
var div, text, p, text_2, text_3, text_4, p_1, text_6, text_8, if_block_4_anchor;
var div, text0, p0, text2, text3, text4, p1, text6, text7, text8, if_block4_anchor;
var if_block = (ctx.a) && create_if_block(component, ctx);
var if_block0 = (ctx.a) && create_if_block_4(component, ctx);
var if_block_1 = (ctx.b) && create_if_block_1(component, ctx);
var if_block1 = (ctx.b) && create_if_block_3(component, ctx);
var if_block_2 = (ctx.c) && create_if_block_2(component, ctx);
var if_block2 = (ctx.c) && create_if_block_2(component, ctx);
var if_block_3 = (ctx.d) && create_if_block_3(component, ctx);
var if_block3 = (ctx.d) && create_if_block_1(component, ctx);
var if_block_4 = (ctx.e) && create_if_block_4(component, ctx);
var if_block4 = (ctx.e) && create_if_block(component, ctx);
return {
c() {
div = createElement("div");
if (if_block) if_block.c();
text = createText("\n\n\t");
p = createElement("p");
p.textContent = "this can be used as an anchor";
text_2 = createText("\n\n\t");
if (if_block_1) if_block_1.c();
text_3 = createText("\n\n\t");
if (if_block_2) if_block_2.c();
text_4 = createText("\n\n\t");
p_1 = createElement("p");
p_1.textContent = "so can this";
text_6 = createText("\n\n\t");
if (if_block_3) if_block_3.c();
text_8 = createText("\n\n");
if (if_block_4) if_block_4.c();
if_block_4_anchor = createComment();
if (if_block0) if_block0.c();
text0 = createText("\n\n\t");
p0 = createElement("p");
p0.textContent = "this can be used as an anchor";
text2 = createText("\n\n\t");
if (if_block1) if_block1.c();
text3 = createText("\n\n\t");
if (if_block2) if_block2.c();
text4 = createText("\n\n\t");
p1 = createElement("p");
p1.textContent = "so can this";
text6 = createText("\n\n\t");
if (if_block3) if_block3.c();
text7 = createText("\n\n\t\n");
text8 = createText("\n\n");
if (if_block4) if_block4.c();
if_block4_anchor = createComment();
},
m(target, anchor) {
insert(target, div, anchor);
if (if_block) if_block.m(div, null);
append(div, text);
append(div, p);
append(div, text_2);
if (if_block_1) if_block_1.m(div, null);
append(div, text_3);
if (if_block_2) if_block_2.m(div, null);
append(div, text_4);
append(div, p_1);
append(div, text_6);
if (if_block_3) if_block_3.m(div, null);
insert(target, text_8, anchor);
if (if_block_4) if_block_4.m(target, anchor);
insert(target, if_block_4_anchor, anchor);
if (if_block0) if_block0.m(div, null);
append(div, text0);
append(div, p0);
append(div, text2);
if (if_block1) if_block1.m(div, null);
append(div, text3);
if (if_block2) if_block2.m(div, null);
append(div, text4);
append(div, p1);
append(div, text6);
if (if_block3) if_block3.m(div, null);
append(div, text7);
insert(target, text8, anchor);
if (if_block4) if_block4.m(target, anchor);
insert(target, if_block4_anchor, anchor);
},
p(changed, ctx) {
if (ctx.a) {
if (!if_block) {
if_block = create_if_block(component, ctx);
if_block.c();
if_block.m(div, text);
if (!if_block0) {
if_block0 = create_if_block_4(component, ctx);
if_block0.c();
if_block0.m(div, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
if (ctx.b) {
if (!if_block_1) {
if_block_1 = create_if_block_1(component, ctx);
if_block_1.c();
if_block_1.m(div, text_3);
if (!if_block1) {
if_block1 = create_if_block_3(component, ctx);
if_block1.c();
if_block1.m(div, text3);
}
} else if (if_block_1) {
if_block_1.d(1);
if_block_1 = null;
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
if (ctx.c) {
if (!if_block_2) {
if_block_2 = create_if_block_2(component, ctx);
if_block_2.c();
if_block_2.m(div, text_4);
if (!if_block2) {
if_block2 = create_if_block_2(component, ctx);
if_block2.c();
if_block2.m(div, text4);
}
} else if (if_block_2) {
if_block_2.d(1);
if_block_2 = null;
} else if (if_block2) {
if_block2.d(1);
if_block2 = null;
}
if (ctx.d) {
if (!if_block_3) {
if_block_3 = create_if_block_3(component, ctx);
if_block_3.c();
if_block_3.m(div, null);
if (!if_block3) {
if_block3 = create_if_block_1(component, ctx);
if_block3.c();
if_block3.m(div, text7);
}
} else if (if_block_3) {
if_block_3.d(1);
if_block_3 = null;
} else if (if_block3) {
if_block3.d(1);
if_block3 = null;
}
if (ctx.e) {
if (!if_block_4) {
if_block_4 = create_if_block_4(component, ctx);
if_block_4.c();
if_block_4.m(if_block_4_anchor.parentNode, if_block_4_anchor);
if (!if_block4) {
if_block4 = create_if_block(component, ctx);
if_block4.c();
if_block4.m(if_block4_anchor.parentNode, if_block4_anchor);
}
} else if (if_block_4) {
if_block_4.d(1);
if_block_4 = null;
} else if (if_block4) {
if_block4.d(1);
if_block4 = null;
}
},
@ -278,24 +280,24 @@ function create_main_fragment(component, ctx) {
detachNode(div);
}
if (if_block) if_block.d();
if (if_block_1) if_block_1.d();
if (if_block_2) if_block_2.d();
if (if_block_3) if_block_3.d();
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
if (if_block2) if_block2.d();
if (if_block3) if_block3.d();
if (detach) {
detachNode(text_8);
detachNode(text8);
}
if (if_block_4) if_block_4.d(detach);
if (if_block4) if_block4.d(detach);
if (detach) {
detachNode(if_block_4_anchor);
detachNode(if_block4_anchor);
}
}
};
}
// (2:1) {#if a}
function create_if_block(component, ctx) {
function create_if_block_4(component, ctx) {
var p;
return {
@ -317,7 +319,7 @@ function create_if_block(component, ctx) {
}
// (8:1) {#if b}
function create_if_block_1(component, ctx) {
function create_if_block_3(component, ctx) {
var p;
return {
@ -361,7 +363,7 @@ function create_if_block_2(component, ctx) {
}
// (18:1) {#if d}
function create_if_block_3(component, ctx) {
function create_if_block_1(component, ctx) {
var p;
return {
@ -383,7 +385,7 @@ function create_if_block_3(component, ctx) {
}
// (25:0) {#if e}
function create_if_block_4(component, ctx) {
function create_if_block(component, ctx) {
var p;
return {

@ -2,111 +2,113 @@
import { append, assign, createComment, createElement, createText, detachNode, init, insert, proto } from "svelte/shared.js";
function create_main_fragment(component, ctx) {
var div, text, p, text_2, text_3, text_4, p_1, text_6, text_8, if_block_4_anchor;
var div, text0, p0, text2, text3, text4, p1, text6, text7, text8, if_block4_anchor;
var if_block = (ctx.a) && create_if_block(component, ctx);
var if_block0 = (ctx.a) && create_if_block_4(component, ctx);
var if_block_1 = (ctx.b) && create_if_block_1(component, ctx);
var if_block1 = (ctx.b) && create_if_block_3(component, ctx);
var if_block_2 = (ctx.c) && create_if_block_2(component, ctx);
var if_block2 = (ctx.c) && create_if_block_2(component, ctx);
var if_block_3 = (ctx.d) && create_if_block_3(component, ctx);
var if_block3 = (ctx.d) && create_if_block_1(component, ctx);
var if_block_4 = (ctx.e) && create_if_block_4(component, ctx);
var if_block4 = (ctx.e) && create_if_block(component, ctx);
return {
c() {
div = createElement("div");
if (if_block) if_block.c();
text = createText("\n\n\t");
p = createElement("p");
p.textContent = "this can be used as an anchor";
text_2 = createText("\n\n\t");
if (if_block_1) if_block_1.c();
text_3 = createText("\n\n\t");
if (if_block_2) if_block_2.c();
text_4 = createText("\n\n\t");
p_1 = createElement("p");
p_1.textContent = "so can this";
text_6 = createText("\n\n\t");
if (if_block_3) if_block_3.c();
text_8 = createText("\n\n");
if (if_block_4) if_block_4.c();
if_block_4_anchor = createComment();
if (if_block0) if_block0.c();
text0 = createText("\n\n\t");
p0 = createElement("p");
p0.textContent = "this can be used as an anchor";
text2 = createText("\n\n\t");
if (if_block1) if_block1.c();
text3 = createText("\n\n\t");
if (if_block2) if_block2.c();
text4 = createText("\n\n\t");
p1 = createElement("p");
p1.textContent = "so can this";
text6 = createText("\n\n\t");
if (if_block3) if_block3.c();
text7 = createText("\n\n\t\n");
text8 = createText("\n\n");
if (if_block4) if_block4.c();
if_block4_anchor = createComment();
},
m(target, anchor) {
insert(target, div, anchor);
if (if_block) if_block.m(div, null);
append(div, text);
append(div, p);
append(div, text_2);
if (if_block_1) if_block_1.m(div, null);
append(div, text_3);
if (if_block_2) if_block_2.m(div, null);
append(div, text_4);
append(div, p_1);
append(div, text_6);
if (if_block_3) if_block_3.m(div, null);
insert(target, text_8, anchor);
if (if_block_4) if_block_4.m(target, anchor);
insert(target, if_block_4_anchor, anchor);
if (if_block0) if_block0.m(div, null);
append(div, text0);
append(div, p0);
append(div, text2);
if (if_block1) if_block1.m(div, null);
append(div, text3);
if (if_block2) if_block2.m(div, null);
append(div, text4);
append(div, p1);
append(div, text6);
if (if_block3) if_block3.m(div, null);
append(div, text7);
insert(target, text8, anchor);
if (if_block4) if_block4.m(target, anchor);
insert(target, if_block4_anchor, anchor);
},
p(changed, ctx) {
if (ctx.a) {
if (!if_block) {
if_block = create_if_block(component, ctx);
if_block.c();
if_block.m(div, text);
if (!if_block0) {
if_block0 = create_if_block_4(component, ctx);
if_block0.c();
if_block0.m(div, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
if (ctx.b) {
if (!if_block_1) {
if_block_1 = create_if_block_1(component, ctx);
if_block_1.c();
if_block_1.m(div, text_3);
if (!if_block1) {
if_block1 = create_if_block_3(component, ctx);
if_block1.c();
if_block1.m(div, text3);
}
} else if (if_block_1) {
if_block_1.d(1);
if_block_1 = null;
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
if (ctx.c) {
if (!if_block_2) {
if_block_2 = create_if_block_2(component, ctx);
if_block_2.c();
if_block_2.m(div, text_4);
if (!if_block2) {
if_block2 = create_if_block_2(component, ctx);
if_block2.c();
if_block2.m(div, text4);
}
} else if (if_block_2) {
if_block_2.d(1);
if_block_2 = null;
} else if (if_block2) {
if_block2.d(1);
if_block2 = null;
}
if (ctx.d) {
if (!if_block_3) {
if_block_3 = create_if_block_3(component, ctx);
if_block_3.c();
if_block_3.m(div, null);
if (!if_block3) {
if_block3 = create_if_block_1(component, ctx);
if_block3.c();
if_block3.m(div, text7);
}
} else if (if_block_3) {
if_block_3.d(1);
if_block_3 = null;
} else if (if_block3) {
if_block3.d(1);
if_block3 = null;
}
if (ctx.e) {
if (!if_block_4) {
if_block_4 = create_if_block_4(component, ctx);
if_block_4.c();
if_block_4.m(if_block_4_anchor.parentNode, if_block_4_anchor);
if (!if_block4) {
if_block4 = create_if_block(component, ctx);
if_block4.c();
if_block4.m(if_block4_anchor.parentNode, if_block4_anchor);
}
} else if (if_block_4) {
if_block_4.d(1);
if_block_4 = null;
} else if (if_block4) {
if_block4.d(1);
if_block4 = null;
}
},
@ -115,24 +117,24 @@ function create_main_fragment(component, ctx) {
detachNode(div);
}
if (if_block) if_block.d();
if (if_block_1) if_block_1.d();
if (if_block_2) if_block_2.d();
if (if_block_3) if_block_3.d();
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
if (if_block2) if_block2.d();
if (if_block3) if_block3.d();
if (detach) {
detachNode(text_8);
detachNode(text8);
}
if (if_block_4) if_block_4.d(detach);
if (if_block4) if_block4.d(detach);
if (detach) {
detachNode(if_block_4_anchor);
detachNode(if_block4_anchor);
}
}
};
}
// (2:1) {#if a}
function create_if_block(component, ctx) {
function create_if_block_4(component, ctx) {
var p;
return {
@ -154,7 +156,7 @@ function create_if_block(component, ctx) {
}
// (8:1) {#if b}
function create_if_block_1(component, ctx) {
function create_if_block_3(component, ctx) {
var p;
return {
@ -198,7 +200,7 @@ function create_if_block_2(component, ctx) {
}
// (18:1) {#if d}
function create_if_block_3(component, ctx) {
function create_if_block_1(component, ctx) {
var p;
return {
@ -220,7 +222,7 @@ function create_if_block_3(component, ctx) {
}
// (25:0) {#if e}
function create_if_block_4(component, ctx) {
function create_if_block(component, ctx) {
var p;
return {

@ -165,7 +165,7 @@ var proto = {
/* generated by Svelte vX.Y.Z */
function create_main_fragment(component, ctx) {
var window_updating = false, clear_window_updating = function() { window_updating = false; }, window_updating_timeout, p, text1, text2;
var window_updating = false, clear_window_updating = function() { window_updating = false; }, window_updating_timeout, p, text0, text1;
function onwindowscroll(event) {
if (window_updating) return;
@ -190,19 +190,19 @@ function create_main_fragment(component, ctx) {
return {
c() {
p = createElement("p");
text1 = createText("scrolled to ");
text2 = createText(ctx.y);
text0 = createText("scrolled to ");
text1 = createText(ctx.y);
},
m(target, anchor) {
insert(target, p, anchor);
append(p, text0);
append(p, text1);
append(p, text2);
},
p(changed, ctx) {
if (changed.y) {
setData(text2, ctx.y);
setData(text1, ctx.y);
}
},

@ -2,7 +2,7 @@
import { append, assign, createElement, createText, detachNode, init, insert, proto, setData } from "svelte/shared.js";
function create_main_fragment(component, ctx) {
var window_updating = false, clear_window_updating = function() { window_updating = false; }, window_updating_timeout, p, text1, text2;
var window_updating = false, clear_window_updating = function() { window_updating = false; }, window_updating_timeout, p, text0, text1;
function onwindowscroll(event) {
if (window_updating) return;
@ -27,19 +27,19 @@ function create_main_fragment(component, ctx) {
return {
c() {
p = createElement("p");
text1 = createText("scrolled to ");
text2 = createText(ctx.y);
text0 = createText("scrolled to ");
text1 = createText(ctx.y);
},
m(target, anchor) {
insert(target, p, anchor);
append(p, text0);
append(p, text1);
append(p, text2);
},
p(changed, ctx) {
if (changed.y) {
setData(text2, ctx.y);
setData(text1, ctx.y);
}
},

Loading…
Cancel
Save