\`);
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`div\`] = el;
- let b2;
+ let b2,b3;
+ b2 = text(\`
+ \`);
if (ctx['state'].value) {
- b2 = block2([ref1]);
+ const b4 = text(\`
+ \`);
+ const b5 = block5([ref1]);
+ const b6 = text(\`
+ \`);
+ b3 = multi([b4, b5, b6]);
}
- return multi([b2]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/lifecycle.test.ts.snap b/tests/components/__snapshots__/lifecycle.test.ts.snap
index 5418cbf3..6a607292 100644
--- a/tests/components/__snapshots__/lifecycle.test.ts.snap
+++ b/tests/components/__snapshots__/lifecycle.test.ts.snap
@@ -51,17 +51,22 @@ exports[`lifecycle hooks component semantics 3`] = `
const comp2 = app.createComponent(\`E\`, true, false, false, true);
const comp3 = app.createComponent(\`F\`, true, false, false, true);
- let block1 = createBlock(\`
C
\`);
+ let block3 = createBlock(\`
C
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- let b2,b3,b4;
- b2 = comp1({}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ let b4,b5,b6;
+ b4 = comp1({}, key + \`__1\`, node, this, null);
if (ctx['state'].flag) {
- b3 = comp2({}, key + \`__2\`, node, this, null);
+ b5 = comp2({}, key + \`__2\`, node, this, null);
} else {
- b4 = comp3({}, key + \`__3\`, node, this, null);
+ b6 = comp3({}, key + \`__3\`, node, this, null);
}
- return block1([], [b2, b3, b4]);
+ const b3 = block3([], [b4, b5, b6]);
+ return multi([b2, b3]);
}
}"
`;
@@ -111,15 +116,21 @@ exports[`lifecycle hooks components are unmounted and destroyed if no longer in
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block2 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- let b2;
+ let b2,b3,b5;
+ b2 = text(\`
+ \`);
if (ctx['state'].flag) {
- const b3 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
- b2 = block2([], [b3]);
+ const b4 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
+ b3 = block3([], [b4]);
}
- return multi([b2]);
+ b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -550,7 +561,10 @@ exports[`lifecycle hooks onWillRender 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
- return comp1({someValue: ctx['state'].value}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b3 = comp1({someValue: ctx['state'].value}, key + \`__1\`, node, this, null);
+ return multi([b2, b3]);
}
}"
`;
@@ -727,11 +741,16 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents,
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -742,11 +761,16 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents,
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1({n: ctx['props'].n}, key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1({n: ctx['props'].n}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -756,11 +780,16 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents,
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['props'].n;
- return block1([txt1]);
+ const b3 = block3([txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -822,17 +851,32 @@ exports[`lifecycle hooks willStart, mounted on subwidget rendered after main is
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block10 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- let b2,b3;
+ const b2 = text(\`
+ \`);
+ let b4,b8;
if (ctx['state'].ok) {
- b2 = comp1({}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ b4 = multi([b5, b6, b7]);
} else {
- b3 = block3();
+ const b9 = text(\`
+ \`);
+ const b10 = block10();
+ const b11 = text(\`
+ \`);
+ b8 = multi([b9, b10, b11]);
}
- return block1([], [b2, b3]);
+ const b3 = block3([], [b4, b8]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/props.test.ts.snap b/tests/components/__snapshots__/props.test.ts.snap
index ebe50251..ef247ddf 100644
--- a/tests/components/__snapshots__/props.test.ts.snap
+++ b/tests/components/__snapshots__/props.test.ts.snap
@@ -37,16 +37,27 @@ exports[`basics arrow functions as prop correctly capture their scope 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`item\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['items']);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`item\`] = v_block3[i1];
const key1 = ctx['item'].val;
+ const b5 = text(\`
+ \`);
const v1 = ctx['onClick'];
const v2 = ctx['item'];
- c_block1[i1] = withKey(comp1({onClick: _ev=>v1(v2.val,_ev)}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b6 = comp1({onClick: _ev=>v1(v2.val,_ev)}, key + \`__1__\${key1}\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ c_block3[i1] = withKey(multi([b5, b6, b7]), key1);
}
- return list(c_block1);
+ ctx = ctx.__proto__;
+ const b3 = list(c_block3);
+ const b8 = text(\`
+ \`);
+ return multi([b2, b3, b8]);
}
}"
`;
@@ -153,19 +164,25 @@ exports[`basics t-set with a body expression can be passed in props, and then t-
let { isBoundary, withDefault, LazyValue } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`
43
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block4 = createBlock(\`
43
\`);
function value1(ctx, node, key = \\"\\") {
- return block2();
+ return block4();
}
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
ctx[\`abc\`] = new LazyValue(value1, ctx, this, node);
- const b3 = comp1({val: ctx['abc']}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b5 = comp1({val: ctx['abc']}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -176,12 +193,18 @@ exports[`basics t-set with a body expression can be passed in props, and then t-
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { safeOutput } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['props'].val;
- const b2 = safeOutput(ctx['props'].val);
- return block1([txt1], [b2]);
+ const b4 = safeOutput(ctx['props'].val);
+ const b3 = block3([txt1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -193,14 +216,20 @@ exports[`basics t-set with a body expression can be used as textual prop 1`] = `
let { isBoundary, withDefault, setContextValue } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"abc\\", \`42\`);
- const b2 = comp1({val: ctx['abc']}, key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b4 = comp1({val: ctx['abc']}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -226,14 +255,20 @@ exports[`basics t-set works 1`] = `
let { isBoundary, withDefault, setContextValue } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"val\\", 42);
- const b2 = comp1({val: ctx['val']}, key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b4 = comp1({val: ctx['val']}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/reactivity.test.ts.snap b/tests/components/__snapshots__/reactivity.test.ts.snap
index 9f8a4962..a37e9537 100644
--- a/tests/components/__snapshots__/reactivity.test.ts.snap
+++ b/tests/components/__snapshots__/reactivity.test.ts.snap
@@ -99,11 +99,16 @@ exports[`reactivity in lifecycle change state while mounting component 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['state'].val;
- return block1([txt1]);
+ const b3 = block3([txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -114,14 +119,21 @@ exports[`reactivity in lifecycle state changes in willUnmount do not trigger rer
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- let b2;
+ const b2 = text(\`
+ \`);
+ let b4;
if (ctx['state'].flag) {
- b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ b4 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
}
- return block1([], [b2]);
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -131,12 +143,17 @@ exports[`reactivity in lifecycle state changes in willUnmount do not trigger rer
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['props'].val;
let txt2 = ctx['state'].n;
- return block1([txt1, txt2]);
+ const b3 = block3([txt1, txt2]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
diff --git a/tests/components/__snapshots__/refs.test.ts.snap b/tests/components/__snapshots__/refs.test.ts.snap
index c4d1f058..ecba406f 100644
--- a/tests/components/__snapshots__/refs.test.ts.snap
+++ b/tests/components/__snapshots__/refs.test.ts.snap
@@ -21,19 +21,31 @@ exports[`refs can use 2 refs with same name in a t-if/t-else situation 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { multiRefSetter } = helpers;
- let block2 = createBlock(\`
\`);
- let block3 = createBlock(\`
\`);
+ let block5 = createBlock(\`\`);
+ let block9 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = multiRefSetter(refs, \`coucou\`);
- let b2,b3;
+ let b2,b3,b7;
+ b2 = text(\`
+ \`);
if (ctx['state'].value) {
- b2 = block2([ref1]);
+ const b4 = text(\`
+ \`);
+ const b5 = block5([ref1]);
+ const b6 = text(\`
+ \`);
+ b3 = multi([b4, b5, b6]);
} else {
- b3 = block3([ref1]);
+ const b8 = text(\`
+ \`);
+ const b9 = block9([ref1]);
+ const b10 = text(\`
+ \`);
+ b7 = multi([b8, b9, b10]);
}
- return multi([b2, b3]);
+ return multi([b2, b3, b7]);
}
}"
`;
@@ -44,17 +56,23 @@ exports[`refs refs and recursive templates 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Test\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`root\`] = el;
- let b2;
+ const b2 = text(\`
+ \`);
+ let b4;
let txt1 = ctx['props'].tree.value;
if (ctx['props'].tree.child) {
- b2 = comp1({tree: ctx['props'].tree.child}, key + \`__1\`, node, this, null);
+ b4 = comp1({tree: ctx['props'].tree.child}, key + \`__1\`, node, this, null);
}
- return block1([ref1, txt1], [b2]);
+ const b3 = block3([ref1, txt1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -66,21 +84,37 @@ exports[`refs refs are properly bound in slots 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block4 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = (el) => refs[\`myButton\`] = el;
let hdlr1 = [ctx['doSomething'], ctx];
- return block2([hdlr1, ref1]);
+ return block4([hdlr1, ref1]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b6 = text(\`
+ \`);
+ const b7 = text(\`
+ \`);
+ return multi([b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['state'].val;
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([txt1], [b3]);
+ const b8 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([txt1], [b8]);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b3, b9]);
}
}"
`;
@@ -106,15 +140,19 @@ exports[`refs throws if there are 2 same refs at the same time 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { multiRefSetter } = helpers;
- let block2 = createBlock(\`\`);
- let block3 = createBlock(\`
\`);
+ let block3 = createBlock(\`\`);
+ let block5 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
const ref1 = multiRefSetter(refs, \`coucou\`);
- const b2 = block2([ref1]);
+ const b2 = text(\`
+ \`);
const b3 = block3([ref1]);
- return multi([b2, b3]);
+ const b4 = text(\`
+ \`);
+ const b5 = block5([ref1]);
+ return multi([b2, b3, b4, b5]);
}
}"
`;
diff --git a/tests/components/__snapshots__/rendering.test.ts.snap b/tests/components/__snapshots__/rendering.test.ts.snap
index 7c37bde4..7a864542 100644
--- a/tests/components/__snapshots__/rendering.test.ts.snap
+++ b/tests/components/__snapshots__/rendering.test.ts.snap
@@ -7,9 +7,15 @@ exports[`children, default props and renderings 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
- const b2 = text(ctx['state'].value);
- const b3 = comp1({}, key + \`__1\`, node, this, null);
- return multi([b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b3 = text(ctx['state'].value);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b4, b5, b6]);
}
}"
`;
@@ -69,9 +75,15 @@ exports[`rendering semantics can force a render to update sub tree 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
- const b2 = text(ctx['state'].value);
- const b3 = comp1({}, key + \`__1\`, node, this, null);
- return multi([b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b3 = text(ctx['state'].value);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b4, b5, b6]);
}
}"
`;
@@ -94,9 +106,15 @@ exports[`rendering semantics can render a parent without rendering child 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
- const b2 = text(ctx['state'].value);
- const b3 = comp1({}, key + \`__1\`, node, this, null);
- return multi([b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b3 = text(ctx['state'].value);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b4, b5, b6]);
}
}"
`;
@@ -119,7 +137,12 @@ exports[`rendering semantics props are reactive (nested prop) 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
- return comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b3 = comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -142,7 +165,12 @@ exports[`rendering semantics props are reactive 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
- return comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b3 = comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -165,9 +193,15 @@ exports[`rendering semantics render need a boolean = true to be 'deep' 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
- const b2 = text(ctx['state'].value);
- const b3 = comp1({}, key + \`__1\`, node, this, null);
- return multi([b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b3 = text(ctx['state'].value);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b4, b5, b6]);
}
}"
`;
@@ -255,7 +289,12 @@ exports[`rendering semantics works as expected for dynamic number of props 1`] =
const comp1 = app.createComponent(\`Child\`, true, false, true, false);
return function template(ctx, node, key = \\"\\") {
- return comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b3 = comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
diff --git a/tests/components/__snapshots__/slots.test.ts.snap b/tests/components/__snapshots__/slots.test.ts.snap
index a9f0c944..2293eae5 100644
--- a/tests/components/__snapshots__/slots.test.ts.snap
+++ b/tests/components/__snapshots__/slots.test.ts.snap
@@ -21,15 +21,20 @@ exports[`slots can define a default content 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function defaultContent1(ctx, node, key = \\"\\") {
return text(\`default content\`);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -41,22 +46,37 @@ exports[`slots can define and call slots 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`header\`);
- let block3 = createBlock(\`footer\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block4 = createBlock(\`header\`);
+ let block5 = createBlock(\`footer\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ return block4();
}
function slot2(ctx, node, key = \\"\\") {
- return block3();
+ return block5();
+ }
+
+ function slot3(ctx, node, key = \\"\\") {
+ const b7 = text(\`
+ \`);
+ const b8 = text(\`
+ \`);
+ const b9 = text(\`
+ \`);
+ return multi([b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b4 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1}, 'footer': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b4]);
+ const b10 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1}, 'footer': {__render: slot2, __ctx: ctx1}, 'default': {__render: slot3, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b10]);
+ return multi([b2, b3]);
}
}"
`;
@@ -67,12 +87,18 @@ exports[`slots can define and call slots 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'header', false, {});
- const b3 = callSlot(ctx, node, key, 'footer', false, {});
- return block1([], [b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'header', false, {});
+ const b5 = callSlot(ctx, node, key, 'footer', false, {});
+ const b3 = block3([], [b4, b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -88,9 +114,20 @@ exports[`slots can define and call slots with bound params 1`] = `
return text(\`abc\`);
}
+ function slot2(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
+ const b6 = text(\`
+ \`);
+ return multi([b5, b6]);
+ }
+
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp1({slots: markRaw({'abc': {__render: slot1, __ctx: ctx1, getValue: bind(ctx, ctx['getValue'])}})}, key + \`__1\`, node, this, null);
+ const b7 = comp1({slots: markRaw({'abc': {__render: slot1, __ctx: ctx1, getValue: bind(ctx, ctx['getValue'])}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -102,9 +139,13 @@ exports[`slots can define and call slots with bound params 2`] = `
let { callSlot } = helpers;
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'abc', false, {});
- const b3 = text(ctx['props'].slots['abc'].getValue());
- return multi([b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b3 = callSlot(ctx, node, key, 'abc', false, {});
+ const b4 = text(\`
+ \`);
+ const b5 = text(ctx['props'].slots['abc'].getValue());
+ return multi([b2, b3, b4, b5]);
}
}"
`;
@@ -116,22 +157,37 @@ exports[`slots can define and call slots with params 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`header\`);
- let block3 = createBlock(\`footer\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block4 = createBlock(\`header\`);
+ let block5 = createBlock(\`footer\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ return block4();
}
function slot2(ctx, node, key = \\"\\") {
- return block3();
+ return block5();
+ }
+
+ function slot3(ctx, node, key = \\"\\") {
+ const b7 = text(\`
+ \`);
+ const b8 = text(\`
+ \`);
+ const b9 = text(\`
+ \`);
+ return multi([b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b4 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1, param: ctx['var']}, 'footer': {__render: slot2, __ctx: ctx1, param: '5'}})}, key + \`__1\`, node, this, null);
- return block1([], [b4]);
+ const b10 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1, param: ctx['var']}, 'footer': {__render: slot2, __ctx: ctx1, param: '5'}, 'default': {__render: slot3, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b10]);
+ return multi([b2, b3]);
}
}"
`;
@@ -142,14 +198,22 @@ exports[`slots can define and call slots with params 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['props'].slots['header'].param;
- const b2 = callSlot(ctx, node, key, 'header', false, {});
+ const b4 = callSlot(ctx, node, key, 'header', false, {});
let txt2 = ctx['props'].slots['footer'].param;
- const b3 = callSlot(ctx, node, key, 'footer', false, {});
- return block1([txt1, txt2], [b2, b3]);
+ const b5 = callSlot(ctx, node, key, 'footer', false, {});
+ const b3 = block3([txt1, txt2], [b4, b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -289,14 +353,22 @@ exports[`slots content is the default slot (variation) 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`sts rocks\`);
+ let block5 = createBlock(\`sts rocks\`);
function slot1(ctx, node, key = \\"\\") {
- return block1();
+ const b4 = text(\`
+ \`);
+ const b5 = block5();
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -320,16 +392,26 @@ exports[`slots content is the default slot 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`sts rocks\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`sts rocks\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -376,15 +458,20 @@ exports[`slots default content is not rendered if named slot is provided 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function defaultContent1(ctx, node, key = \\"\\") {
return text(\`default content\`);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -415,15 +502,20 @@ exports[`slots default content is not rendered if slot is provided 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function defaultContent1(ctx, node, key = \\"\\") {
return text(\`default content\`);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -435,16 +527,33 @@ exports[`slots default slot next to named slot, with default content 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return text(\` Overridden footer \`);
+ return text(\`
+ Overridden footer
+ \`);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b6 = text(\`
+ \`);
+ const b7 = text(\`
+ \`);
+ return multi([b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b8 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b8]);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b3, b9]);
}
}"
`;
@@ -455,20 +564,36 @@ exports[`slots default slot next to named slot, with default content 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
function defaultContent1(ctx, node, key = \\"\\") {
- return text(\` Default content \`);
+ return text(\`
+ Default content
+ \`);
}
function defaultContent2(ctx, node, key = \\"\\") {
- return text(\` Default footer \`);
+ return text(\`
+ Default footer
+ \`);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
- const b5 = callSlot(ctx, node, key, 'footer', false, {}, defaultContent2);
- return block1([], [b3, b5]);
+ const b2 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
+ const b7 = callSlot(ctx, node, key, 'footer', false, {}, defaultContent2);
+ const b3 = block3([], [b5, b7]);
+ const b8 = text(\`
+ \`);
+ return multi([b2, b3, b8]);
}
}"
`;
@@ -485,7 +610,10 @@ exports[`slots default slot with params with - in it 1`] = `
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b4]);
}
}"
`;
@@ -510,17 +638,24 @@ exports[`slots default slot with slot scope: shorthand syntax 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- let b2,b3;
+ let b4,b5,b6,b7;
+ b4 = text(\`
+ \`);
if (ctx['slotScope'].bool) {
- b2 = text(\`some text\`);
+ b5 = text(\`some text\`);
} else {
- b3 = text(\`other text\`);
+ b6 = text(\`other text\`);
}
- return multi([b2, b3]);
+ b7 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b8]);
}
}"
`;
@@ -576,15 +711,20 @@ exports[`slots default slot work with text nodes 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
return text(\`sts rocks\`);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -611,25 +751,40 @@ exports[`slots dynamic t-slot call 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Toggler\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`slot1
\`);
- let block4 = createBlock(\`content\`);
- let block5 = createBlock(\`slot2
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`slot1
\`);
+ let block6 = createBlock(\`content\`);
+ let block7 = createBlock(\`slot2
\`);
function slot1(ctx, node, key = \\"\\") {
- const b3 = block3();
- const b4 = block4();
- return multi([b3, b4]);
+ const b5 = block5();
+ const b6 = block6();
+ return multi([b5, b6]);
}
function slot2(ctx, node, key = \\"\\") {
- return block5();
+ return block7();
+ }
+
+ function slot3(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
+ const b11 = text(\`
+ \`);
+ return multi([b9, b10, b11]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b6 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b6]);
+ const b12 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}, 'default': {__render: slot3, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b12]);
+ return multi([b2, b3]);
}
}"
`;
@@ -658,25 +813,40 @@ exports[`slots dynamic t-slot call with default 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Toggler\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`slot1
\`);
- let block4 = createBlock(\`content\`);
- let block5 = createBlock(\`slot2
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`slot1
\`);
+ let block6 = createBlock(\`content\`);
+ let block7 = createBlock(\`slot2
\`);
function slot1(ctx, node, key = \\"\\") {
- const b3 = block3();
- const b4 = block4();
- return multi([b3, b4]);
+ const b5 = block5();
+ const b6 = block6();
+ return multi([b5, b6]);
}
function slot2(ctx, node, key = \\"\\") {
- return block5();
+ return block7();
+ }
+
+ function slot3(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
+ const b11 = text(\`
+ \`);
+ return multi([b9, b10, b11]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b6 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b6]);
+ const b12 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}, 'default': {__render: slot3, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b12]);
+ return multi([b2, b3]);
}
}"
`;
@@ -687,16 +857,23 @@ exports[`slots dynamic t-slot call with default 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
function defaultContent1(ctx, node, key = \\"\\") {
- return text(\` owl \`);
+ return text(\`
+ owl
+ \`);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let hdlr1 = [ctx['toggle'], ctx];
- const b3 = callSlot(ctx, node, key, (ctx['current'].slot), true, {}, defaultContent1);
- return block1([hdlr1], [b3]);
+ const b5 = callSlot(ctx, node, key, (ctx['current'].slot), true, {}, defaultContent1);
+ const b3 = block3([hdlr1], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -753,12 +930,19 @@ exports[`slots missing slots are ignored 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`some content\`);
+ let block3 = createBlock(\`
+
+ some content
+
+ \`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- const b3 = callSlot(ctx, node, key, 'footer', false, {});
- return block1([], [b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b5 = callSlot(ctx, node, key, 'footer', false, {});
+ const b3 = block3([], [b4, b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -817,19 +1001,28 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let { isBoundary, withDefault, setContextValue } = helpers;
+ let { isBoundary, withDefault, setContextValue, zero } = helpers;
const callTemplate_1 = app.getTemplate(\`__template__1001\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
- const b2 = text(\`[sub1] \`);
+ const b2 = text(\`[sub1]
+ \`);
setContextValue(ctx, \\"dummy\\", ctx['validate']);
+ const b3 = text(\`
+ \`);
ctx = Object.create(ctx);
ctx[isBoundary] = 1;
+ const b5 = text(\`
+ \`);
setContextValue(ctx, \\"v\\", ctx['props'].number);
- const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
- return multi([b2, b3]);
+ const b6 = text(\`
+ \`);
+ const b4 = multi([b5, b6]);
+ ctx[zero] = b4;
+ const b7 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ return multi([b2, b3, b7]);
}
}"
`;
@@ -883,19 +1076,30 @@ exports[`slots multiple roots are allowed in a default slot 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`sts\`);
- let block4 = createBlock(\`rocks\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`sts\`);
+ let block8 = createBlock(\`rocks\`);
function slot1(ctx, node, key = \\"\\") {
- const b3 = block3();
- const b4 = block4();
- return multi([b3, b4]);
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ const b8 = block8();
+ const b9 = text(\`
+ \`);
+ return multi([b5, b6, b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
- const b5 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
- return block1([], [b5]);
+ const b2 = text(\`
+ \`);
+ const b10 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b10]);
+ return multi([b2, b3]);
}
}"
`;
@@ -922,20 +1126,39 @@ exports[`slots multiple roots are allowed in a named slot 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`sts\`);
- let block4 = createBlock(\`rocks\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`sts\`);
+ let block8 = createBlock(\`rocks\`);
function slot1(ctx, node, key = \\"\\") {
- const b3 = block3();
- const b4 = block4();
- return multi([b3, b4]);
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ const b8 = block8();
+ const b9 = text(\`
+ \`);
+ return multi([b5, b6, b7, b8, b9]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b11 = text(\`
+ \`);
+ const b12 = text(\`
+ \`);
+ return multi([b11, b12]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b5 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b5]);
+ const b13 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b13]);
+ return multi([b2, b3]);
}
}"
`;
@@ -972,9 +1195,22 @@ exports[`slots multiple slots containing components 1`] = `
return comp2({val: 2}, key + \`__2\`, node, this, null);
}
+ function slot3(ctx, node, key = \\"\\") {
+ const b6 = text(\`
+ \`);
+ const b7 = text(\`
+ \`);
+ const b8 = text(\`
+ \`);
+ return multi([b6, b7, b8]);
+ }
+
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp3({slots: markRaw({'s1': {__render: slot1, __ctx: ctx1}, 's2': {__render: slot2, __ctx: ctx1}})}, key + \`__3\`, node, this, null);
+ const b9 = comp3({slots: markRaw({'s1': {__render: slot1, __ctx: ctx1}, 's2': {__render: slot2, __ctx: ctx1}, 'default': {__render: slot3, __ctx: ctx1}})}, key + \`__3\`, node, this, null);
+ return multi([b2, b9]);
}
}"
`;
@@ -1017,29 +1253,59 @@ exports[`slots named slot inside slot 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`A
\`);
- let block3 = createBlock(\`B
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`A
\`);
+ let block13 = createBlock(\`B
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
let txt1 = ctx['value'];
- return block2([txt1]);
+ const b6 = block6([txt1]);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
function slot2(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
const ctx2 = capture(ctx);
- return comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, this, null);
+ const b18 = comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}, 'default': {__render: slot4, __ctx: ctx2}})}, key + \`__1\`, node, this, null);
+ const b19 = text(\`
+ \`);
+ return multi([b9, b10, b18, b19]);
}
function slot3(ctx, node, key = \\"\\") {
+ const b12 = text(\`
+ \`);
let txt2 = ctx['value'];
- return block3([txt2]);
+ const b13 = block13([txt2]);
+ const b14 = text(\`
+ \`);
+ return multi([b12, b13, b14]);
+ }
+
+ function slot4(ctx, node, key = \\"\\") {
+ const b16 = text(\`
+ \`);
+ const b17 = text(\`
+ \`);
+ return multi([b16, b17]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b5 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
- return block1([], [b5]);
+ const b20 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b20]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1050,12 +1316,18 @@ exports[`slots named slot inside slot 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'brol', false, {});
- const b3 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'brol', false, {});
+ const b5 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4, b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1068,29 +1340,63 @@ exports[`slots named slot inside slot, part 3 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`A
\`);
- let block3 = createBlock(\`B
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`A
\`);
+ let block13 = createBlock(\`B
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
let txt1 = ctx['value'];
- return block2([txt1]);
+ const b6 = block6([txt1]);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
function slot2(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
const ctx2 = capture(ctx);
- return comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, this, null);
+ const b20 = comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}, 'default': {__render: slot4, __ctx: ctx2}})}, key + \`__1\`, node, this, null);
+ const b21 = text(\`
+ \`);
+ return multi([b9, b10, b20, b21]);
}
function slot3(ctx, node, key = \\"\\") {
+ const b12 = text(\`
+ \`);
let txt2 = ctx['value'];
- return block3([txt2]);
+ const b13 = block13([txt2]);
+ const b14 = text(\`
+ \`);
+ return multi([b12, b13, b14]);
+ }
+
+ function slot4(ctx, node, key = \\"\\") {
+ const b16 = text(\`
+ \`);
+ const b17 = text(\`
+ \`);
+ const b18 = text(\`
+ \`);
+ const b19 = text(\`
+ \`);
+ return multi([b16, b17, b18, b19]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b5 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
- return block1([], [b5]);
+ const b22 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b22]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1101,12 +1407,18 @@ exports[`slots named slot inside slot, part 3 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'brol', false, {});
- const b3 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'brol', false, {});
+ const b5 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4, b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1132,15 +1444,20 @@ exports[`slots named slots can define a default content 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function defaultContent1(ctx, node, key = \\"\\") {
return text(\`default content\`);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'header', false, {}, defaultContent1);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1153,29 +1470,59 @@ exports[`slots named slots inside slot, again 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`A
\`);
- let block3 = createBlock(\`B
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`A
\`);
+ let block13 = createBlock(\`B
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
let txt1 = ctx['value'];
- return block2([txt1]);
+ const b6 = block6([txt1]);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
function slot2(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
const ctx2 = capture(ctx);
- return comp1({slots: markRaw({'brol2': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, this, null);
+ const b18 = comp1({slots: markRaw({'brol2': {__render: slot3, __ctx: ctx2}, 'default': {__render: slot4, __ctx: ctx2}})}, key + \`__1\`, node, this, null);
+ const b19 = text(\`
+ \`);
+ return multi([b9, b10, b18, b19]);
}
function slot3(ctx, node, key = \\"\\") {
+ const b12 = text(\`
+ \`);
let txt2 = ctx['value'];
- return block3([txt2]);
+ const b13 = block13([txt2]);
+ const b14 = text(\`
+ \`);
+ return multi([b12, b13, b14]);
+ }
+
+ function slot4(ctx, node, key = \\"\\") {
+ const b16 = text(\`
+ \`);
+ const b17 = text(\`
+ \`);
+ return multi([b16, b17]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b5 = comp2({slots: markRaw({'brol1': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
- return block1([], [b5]);
+ const b20 = comp2({slots: markRaw({'brol1': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b20]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1186,7 +1533,11 @@ exports[`slots named slots inside slot, again 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
+ \`);
function defaultContent1(ctx, node, key = \\"\\") {
return text(\`default1\`);
@@ -1197,10 +1548,13 @@ exports[`slots named slots inside slot, again 2`] = `
}
return function template(ctx, node, key = \\"\\") {
- const b3 = callSlot(ctx, node, key, 'brol1', false, {}, defaultContent1);
- const b5 = callSlot(ctx, node, key, 'brol2', false, {}, defaultContent2);
- const b6 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b3, b5, b6]);
+ const b2 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'brol1', false, {}, defaultContent1);
+ const b7 = callSlot(ctx, node, key, 'brol2', false, {}, defaultContent2);
+ const b8 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b5, b7, b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1214,19 +1568,34 @@ exports[`slots nested slots in same template 1`] = `
const comp2 = app.createComponent(\`Child2\`, true, true, false, true);
const comp3 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function slot1(ctx, node, key = \\"\\") {
- return comp2({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b10 = comp2({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b11 = text(\`
+ \`);
+ return multi([b5, b10, b11]);
}
function slot2(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ const b8 = comp1({}, key + \`__1\`, node, this, null);
+ const b9 = text(\`
+ \`);
+ return multi([b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
- const b4 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, this, null);
- return block1([], [b4]);
+ const b2 = text(\`
+ \`);
+ const b12 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, this, null);
+ const b3 = block3([], [b12]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1237,11 +1606,18 @@ exports[`slots nested slots in same template 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
+ \`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1252,11 +1628,16 @@ exports[`slots nested slots in same template 3`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1266,10 +1647,13 @@ exports[`slots nested slots in same template 4`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`Child 3\`);
+ let block3 = createBlock(\`Child 3\`);
return function template(ctx, node, key = \\"\\") {
- return block1();
+ const b2 = text(\`
+ \`);
+ const b3 = block3();
+ return multi([b2, b3]);
}
}"
`;
@@ -1300,11 +1684,19 @@ exports[`slots nested slots: evaluation context and parented relationship 2`] =
const comp1 = app.createComponent(\`GrandChild\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- return callSlot(ctx, node, key, 'default', false, {});
+ const b4 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'default', false, {});
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -1405,17 +1797,24 @@ exports[`slots simple default slot with params 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- let b2,b3;
+ let b4,b5,b6,b7;
+ b4 = text(\`
+ \`);
if (ctx['slotScope'].bool) {
- b2 = text(\`some text\`);
+ b5 = text(\`some text\`);
} else {
- b3 = text(\`other text\`);
+ b6 = text(\`other text\`);
}
- return multi([b2, b3]);
+ b7 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b8]);
}
}"
`;
@@ -1447,7 +1846,10 @@ exports[`slots simple default slot with params and bound function 1`] = `
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b4]);
}
}"
`;
@@ -1501,18 +1903,33 @@ exports[`slots simple dynamic slot with slot scope 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- let b2,b3;
+ let b4,b5,b6,b7;
+ b4 = text(\`
+ \`);
if (ctx['slotScope'].bool) {
- b2 = text(\`some text\`);
+ b5 = text(\`some text\`);
} else {
- b3 = text(\`other text\`);
+ b6 = text(\`other text\`);
}
- return multi([b2, b3]);
+ b7 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
+ return multi([b9, b10]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ const b11 = comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b11]);
}
}"
`;
@@ -1608,18 +2025,33 @@ exports[`slots simple slot with slot scope 1`] = `
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- let b2,b3;
+ let b4,b5,b6,b7;
+ b4 = text(\`
+ \`);
if (ctx['slotScope'].bool) {
- b2 = text(\`some text\`);
+ b5 = text(\`some text\`);
} else {
- b3 = text(\`other text\`);
+ b6 = text(\`other text\`);
}
- return multi([b2, b3]);
+ b7 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
+ return multi([b9, b10]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null);
+ const b11 = comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b11]);
}
}"
`;
@@ -1782,17 +2214,28 @@ exports[`slots slot are properly rendered if inner props are changed 1`] = `
const comp1 = app.createComponent(\`SomeComponent\`, true, false, false, false);
const comp2 = app.createComponent(\`GenericComponent\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let hdlr1 = [ctx['inc'], ctx];
let txt1 = ctx['state'].val;
- const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
- return block1([hdlr1, txt1], [b3]);
+ const b8 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([hdlr1, txt1], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1817,11 +2260,16 @@ exports[`slots slot are properly rendered if inner props are changed 3`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\` SC:
\`);
+ let block3 = createBlock(\`
+ SC:
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['props'].val;
- return block1([txt1]);
+ const b3 = block3([txt1]);
+ return multi([b2, b3]);
}
}"
`;
@@ -1835,11 +2283,19 @@ exports[`slots slot content has different key from other content -- dynamic slot
const comp2 = app.createComponent(\`SlotDisplay\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- return comp1({parent: 'Parent'}, key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({parent: 'Parent'}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -1883,11 +2339,19 @@ exports[`slots slot content has different key from other content -- static slot
const comp2 = app.createComponent(\`SlotDisplay\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
- return comp1({parent: 'Parent'}, key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({parent: 'Parent'}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -1928,19 +2392,29 @@ exports[`slots slot content is bound to caller (variation) 1`] = `
let { capture, isBoundary, withDefault, setContextValue, markRaw } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block6 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b4 = text(\`
+ \`);
setContextValue(ctx, \\"var\\", 1);
+ const b5 = text(\`
+ \`);
let hdlr1 = [()=>this.inc(), ctx];
- return block1([hdlr1]);
+ const b6 = block6([hdlr1]);
+ const b7 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b8]);
}
}"
`;
@@ -2003,15 +2477,25 @@ exports[`slots slot preserves properly parented relationship 1`] = `
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true);
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2047,16 +2531,26 @@ exports[`slots slot preserves properly parented relationship, even through t-cal
const callTemplate_1 = app.getTemplate(\`sub\`);
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ const b5 = text(\`
+ \`);
+ const b6 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
- return block1([], [b3]);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2103,20 +2597,37 @@ exports[`slots slot with slot scope and t-props 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block2 = createBlock(\`
\`);
- let block3 = createBlock(\`
\`);
+ let block5 = createBlock(\`
\`);
+ let block7 = createBlock(\`
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b4 = text(\`
+ \`);
let txt1 = ctx['info'].a;
- const b2 = block2([txt1]);
+ const b5 = block5([txt1]);
+ const b6 = text(\`
+ \`);
let txt2 = ctx['info'].b;
- const b3 = block3([txt2]);
- return multi([b2, b3]);
+ const b7 = block7([txt2]);
+ const b8 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7, b8]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b10 = text(\`
+ \`);
+ const b11 = text(\`
+ \`);
+ return multi([b10, b11]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"info\\"}})}, key + \`__1\`, node, this, null);
+ const b12 = comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"info\\"}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b12]);
}
}"
`;
@@ -2128,7 +2639,10 @@ exports[`slots slot with slot scope and t-props 2`] = `
let { callSlot } = helpers;
return function template(ctx, node, key = \\"\\") {
- return callSlot(ctx, node, key, 'slotName', false, Object.assign({}, ctx['info']));
+ const b2 = text(\`
+ \`);
+ const b3 = callSlot(ctx, node, key, 'slotName', false, Object.assign({}, ctx['info']));
+ return multi([b2, b3]);
}
}"
`;
@@ -2156,11 +2670,16 @@ exports[`slots slots and wrapper components 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2183,19 +2702,31 @@ exports[`slots slots are properly bound to correct component 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot, isBoundary, withDefault, setContextValue } = helpers;
- let block1 = createBlock(\`\`);
+ let block6 = createBlock(\`\`);
function defaultContent1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b4 = text(\`
+ \`);
setContextValue(ctx, \\"var\\", 1);
+ const b5 = text(\`
+ \`);
let hdlr1 = [()=>this.increment(), ctx];
let txt1 = ctx['state'].value;
- return block1([hdlr1, txt1]);
+ const b6 = block6([hdlr1, txt1]);
+ const b7 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- return callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
+ const b2 = text(\`
+ \`);
+ const b8 = callSlot(ctx, node, key, 'default', false, {}, defaultContent1);
+ return multi([b2, b8]);
}
}"
`;
@@ -2207,19 +2738,38 @@ exports[`slots slots are rendered with proper context 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block6 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
let hdlr1 = [ctx['doSomething'], ctx];
- return block2([hdlr1]);
+ const b6 = block6([hdlr1]);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b9 = text(\`
+ \`);
+ const b10 = text(\`
+ \`);
+ return multi([b9, b10]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['state'].val;
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([txt1], [b3]);
+ const b11 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([txt1], [b11]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2246,27 +2796,35 @@ exports[`slots slots are rendered with proper context, part 2 1`] = `
let { prepareList, capture, markRaw, withKey } = helpers;
const comp1 = app.createComponent(\`Link\`, true, true, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`
+
+ \`);
function slot1(ctx, node, key = \\"\\") {
- const b5 = text(\`User \`);
- const b6 = text(ctx['user'].name);
- return multi([b5, b6]);
+ const b7 = text(\`User \`);
+ const b8 = text(ctx['user'].name);
+ return multi([b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`user\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].users);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`user\`] = v_block4[i1];
const key1 = ctx['user'].id;
const ctx1 = capture(ctx);
- const b7 = comp1({to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
- c_block2[i1] = withKey(block3([], [b7]), key1);
+ const b9 = comp1({to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
+ c_block4[i1] = withKey(block5([], [b9]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2277,12 +2835,17 @@ exports[`slots slots are rendered with proper context, part 2 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let attr1 = ctx['props'].to;
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([attr1], [b2]);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([attr1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2294,8 +2857,13 @@ exports[`slots slots are rendered with proper context, part 3 1`] = `
let { prepareList, isBoundary, withDefault, setContextValue, capture, markRaw, withKey } = helpers;
const comp1 = app.createComponent(\`Link\`, true, true, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`
+
+
+ \`);
function slot1(ctx, node, key = \\"\\") {
return text(ctx['userdescr']);
@@ -2304,18 +2872,22 @@ exports[`slots slots are rendered with proper context, part 3 1`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].users);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`user\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].users);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`user\`] = v_block4[i1];
const key1 = ctx['user'].id;
setContextValue(ctx, \\"userdescr\\", 'User '+ctx['user'].name);
const ctx1 = capture(ctx);
- const b5 = comp1({to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
- c_block2[i1] = withKey(block3([], [b5]), key1);
+ const b7 = comp1({to: '/user/'+ctx['user'].id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
+ c_block4[i1] = withKey(block5([], [b7]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2326,12 +2898,17 @@ exports[`slots slots are rendered with proper context, part 3 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let attr1 = ctx['props'].to;
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([attr1], [b2]);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([attr1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2343,7 +2920,10 @@ exports[`slots slots are rendered with proper context, part 4 1`] = `
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Link\`, true, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
return text(ctx['userdescr']);
@@ -2352,10 +2932,13 @@ exports[`slots slots are rendered with proper context, part 4 1`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"userdescr\\", 'User '+ctx['state'].user.name);
const ctx1 = capture(ctx);
- const b3 = comp1({to: '/user/'+ctx['state'].user.id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b5 = comp1({to: '/user/'+ctx['state'].user.id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2366,12 +2949,17 @@ exports[`slots slots are rendered with proper context, part 4 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let attr1 = ctx['props'].to;
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([attr1], [b2]);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([attr1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2383,21 +2971,32 @@ exports[`slots slots in slots, with vars 1`] = `
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
const comp1 = app.createComponent(\`A\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`hey
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block6 = createBlock(\`hey
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
let txt1 = ctx['test'];
- return block2([txt1]);
+ const b6 = block6([txt1]);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"test\\", ctx['state'].name);
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2409,15 +3008,25 @@ exports[`slots slots in slots, with vars 2`] = `
let { callSlot, markRaw } = helpers;
const comp1 = app.createComponent(\`B\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return callSlot(ctx, node, key, 'default', false, {});
+ const b5 = text(\`
+ \`);
+ const b6 = callSlot(ctx, node, key, 'default', false, {});
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2444,24 +3053,35 @@ exports[`slots slots in t-foreach and re-rendering 1`] = `
let { prepareList, capture, markRaw, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
return text(ctx['n_index']);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`n\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(Array(2));;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`n\`] = v_block4[i1];
ctx[\`n_index\`] = i1;
const key1 = ctx['n_index'];
+ const b6 = text(\`
+ \`);
const ctx1 = capture(ctx);
- c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
+ const b9 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b8, b9]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2489,39 +3109,63 @@ exports[`slots slots in t-foreach in t-foreach 1`] = `
let { prepareList, capture, markRaw, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
- let block4 = createBlock(\`
\`);
- let block5 = createBlock(\`\`);
- let block7 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`
\`);
+ let block9 = createBlock(\`\`);
+ let block15 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
+ const b14 = text(\`
+ \`);
let txt2 = ctx['node1'].value;
- return block7([txt2]);
+ const b15 = block15([txt2]);
+ const b16 = text(\`
+ \`);
+ return multi([b14, b15, b16]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['tree']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`node1\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['tree']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`node1\`] = v_block4[i1];
const key1 = ctx['node1'].key;
+ const b6 = text(\`
+ \`);
let txt1 = ctx['node1'].value;
- const b4 = block4([txt1]);
+ const b7 = block7([txt1]);
+ const b8 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block6, v_block6, l_block6, c_block6] = prepareList(ctx['node1'].nodes);;
- for (let i2 = 0; i2 < l_block6; i2++) {
- ctx[\`node2\`] = v_block6[i2];
+ const [k_block10, v_block10, l_block10, c_block10] = prepareList(ctx['node1'].nodes);;
+ for (let i2 = 0; i2 < l_block10; i2++) {
+ ctx[\`node2\`] = v_block10[i2];
const key2 = ctx['node2'].key;
+ const b12 = text(\`
+ \`);
const ctx1 = capture(ctx);
- c_block6[i2] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}__\${key2}\`, node, this, null), key2);
+ const b17 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}__\${key2}\`, node, this, null);
+ const b18 = text(\`
+ \`);
+ c_block10[i2] = withKey(multi([b12, b17, b18]), key2);
}
ctx = ctx.__proto__;
- const b6 = list(c_block6);
- const b5 = block5([], [b6]);
- c_block2[i1] = withKey(multi([b4, b5]), key1);
+ const b10 = list(c_block10);
+ const b9 = block9([], [b10]);
+ const b19 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8, b9, b19]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2532,11 +3176,16 @@ exports[`slots slots in t-foreach in t-foreach 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -2548,7 +3197,9 @@ exports[`slots slots in t-foreach with t-set and re-rendering 1`] = `
let { prepareList, isBoundary, withDefault, setContextValue, capture, markRaw, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
return text(ctx['dummy']);
@@ -2557,18 +3208,29 @@ exports[`slots slots in t-foreach with t-set and re-rendering 1`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`n\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(Array(2));;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`n\`] = v_block4[i1];
ctx[\`n_index\`] = i1;
const key1 = ctx['n_index'];
+ const b6 = text(\`
+ \`);
setContextValue(ctx, \\"dummy\\", ctx['n_index']);
+ const b7 = text(\`
+ \`);
const ctx1 = capture(ctx);
- c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b9 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null);
+ const b10 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b9, b10]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2579,12 +3241,18 @@ exports[`slots slots in t-foreach with t-set and re-rendering 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['state'].val;
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([txt1], [b2]);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([txt1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2596,7 +3264,9 @@ exports[`slots t-debug on a t-set-slot (defining a slot) 1`] = `
let { capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
debugger;
@@ -2604,9 +3274,12 @@ exports[`slots t-debug on a t-set-slot (defining a slot) 1`] = `
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b5 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2633,19 +3306,31 @@ exports[`slots t-set t-value in a slot 1`] = `
let { capture, isBoundary, withDefault, setContextValue, markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b5 = text(\`
+ \`);
setContextValue(ctx, \\"rainbow\\", 'dash');
- return text(ctx['rainbow']);
+ const b6 = text(\`
+ \`);
+ const b7 = text(ctx['rainbow']);
+ const b8 = text(\`
+ \`);
+ return multi([b5, b6, b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return block1([], [b3]);
+ const b9 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b9]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2656,11 +3341,16 @@ exports[`slots t-set t-value in a slot 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2669,44 +3359,70 @@ exports[`slots t-slot in recursive templates 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let { capture, prepareList, isBoundary, withDefault, setContextValue, withKey, markRaw } = helpers;
+ let { capture, prepareList, isBoundary, withDefault, setContextValue, zero, withKey, markRaw } = helpers;
const callTemplate_1 = app.getTemplate(\`_test_recursive_template\`);
const comp1 = app.createComponent(\`Wrapper\`, true, true, false, true);
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
- const b2 = text(ctx['name']);
+ const b4 = text(\`
+ \`);
+ const b5 = text(ctx['name']);
+ const b6 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['items']);;
- for (let i1 = 0; i1 < l_block3; i1++) {
- ctx[\`item\`] = v_block3[i1];
+ const [k_block7, v_block7, l_block7, c_block7] = prepareList(ctx['items']);;
+ for (let i1 = 0; i1 < l_block7; i1++) {
+ ctx[\`item\`] = v_block7[i1];
ctx[\`item_first\`] = i1 === 0;
- ctx[\`item_last\`] = i1 === v_block3.length - 1;
+ ctx[\`item_last\`] = i1 === v_block7.length - 1;
ctx[\`item_index\`] = i1;
- ctx[\`item_value\`] = k_block3[i1];
+ ctx[\`item_value\`] = k_block7[i1];
const key1 = ctx['item'].name;
- let b5,b6;
+ let b9,b10,b18,b19;
+ b9 = text(\`
+ \`);
if (!ctx['item'].children.length) {
- b5 = text(ctx['item'].name);
+ const b11 = text(\`
+ \`);
+ const b12 = text(ctx['item'].name);
+ const b13 = text(\`
+ \`);
+ b10 = multi([b11, b12, b13]);
} else {
ctx = Object.create(ctx);
ctx[isBoundary] = 1;
+ const b15 = text(\`
+ \`);
setContextValue(ctx, \\"name\\", ctx['item'].name);
+ const b16 = text(\`
+ \`);
setContextValue(ctx, \\"items\\", ctx['item'].children);
- b6 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`);
+ const b17 = text(\`
+ \`);
+ const b14 = multi([b15, b16, b17]);
+ ctx[zero] = b14;
+ b18 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`);
ctx = ctx.__proto__;
}
- c_block3[i1] = withKey(multi([b5, b6]), key1);
+ b19 = text(\`
+ \`);
+ c_block7[i1] = withKey(multi([b9, b10, b18, b19]), key1);
}
ctx = ctx.__proto__;
- const b3 = list(c_block3);
- return multi([b2, b3]);
+ const b7 = list(c_block7);
+ const b20 = text(\`
+ \`);
+ return multi([b4, b5, b6, b7, b20]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b21 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ return multi([b2, b21]);
}
}"
`;
@@ -2717,11 +3433,16 @@ exports[`slots t-slot in recursive templates 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = callSlot(ctx, node, key, 'default', false, {});
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2734,15 +3455,25 @@ exports[`slots t-slot nested within another slot 1`] = `
const comp1 = app.createComponent(\`Child3\`, true, false, false, true);
const comp2 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2755,19 +3486,34 @@ exports[`slots t-slot nested within another slot 2`] = `
const comp1 = app.createComponent(\`Portal\`, true, true, false, true);
const comp2 = app.createComponent(\`Modal\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b10 = comp1({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b11 = text(\`
+ \`);
+ return multi([b5, b10, b11]);
}
function slot2(ctx, node, key = \\"\\") {
- return callSlot(ctx, node, key, 'default', false, {});
+ const b7 = text(\`
+ \`);
+ const b8 = callSlot(ctx, node, key, 'default', false, {});
+ const b9 = text(\`
+ \`);
+ return multi([b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
- const b4 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
- return block1([], [b4]);
+ const b2 = text(\`
+ \`);
+ const b12 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b12]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2822,14 +3568,22 @@ exports[`slots t-slot scope context 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Dialog\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block5 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
- return block1();
+ const b4 = text(\`
+ \`);
+ const b5 = block5();
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -2841,16 +3595,28 @@ exports[`slots t-slot scope context 2`] = `
let { callSlot, markRaw } = helpers;
const comp1 = app.createComponent(\`Wrapper\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block5 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b4 = text(\`
+ \`);
let hdlr1 = [ctx['onClick'], ctx];
- const b2 = callSlot(ctx, node, key, 'default', false, {});
- return block1([hdlr1], [b2]);
+ const b6 = callSlot(ctx, node, key, 'default', false, {});
+ const b5 = block5([hdlr1], [b6]);
+ const b7 = text(\`
+ \`);
+ return multi([b4, b5, b7]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b8, b9]);
}
}"
`;
@@ -2875,17 +3641,27 @@ exports[`slots t-slot within dynamic t-call 1`] = `
const call = app.callTemplate.bind(app);
const comp1 = app.createComponent(\`Slotted\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
const template1 = (ctx['tcallTemplate']);
- return call(this, template1, ctx, node, key + \`__1\`);
+ const b6 = call(this, template1, ctx, node, key + \`__1\`);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
- return block1([], [b3]);
+ const b8 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -2911,11 +3687,16 @@ exports[`slots t-slot within dynamic t-call 3`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1({}, key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1({}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -2941,15 +3722,20 @@ exports[`slots template can just return a slot 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(\`SlotComponent\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/style_class.test.ts.snap b/tests/components/__snapshots__/style_class.test.ts.snap
index cafd236a..0118f586 100644
--- a/tests/components/__snapshots__/style_class.test.ts.snap
+++ b/tests/components/__snapshots__/style_class.test.ts.snap
@@ -124,10 +124,15 @@ exports[`style and class handling can set style and class inside component 1`] =
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`world
\`);
+ let block3 = createBlock(\`world
\`);
return function template(ctx, node, key = \\"\\") {
- return block1();
+ const b2 = text(\`
+ \`);
+ const b3 = block3();
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -452,11 +457,16 @@ exports[`style and class handling t-att-class is properly added/removed on widge
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1({class: {b:ctx['state'].b}}, key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1({class: {b:ctx['state'].b}}, key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_call.test.ts.snap b/tests/components/__snapshots__/t_call.test.ts.snap
index aa4521d2..0a04c93c 100644
--- a/tests/components/__snapshots__/t_call.test.ts.snap
+++ b/tests/components/__snapshots__/t_call.test.ts.snap
@@ -8,12 +8,17 @@ exports[`t-call dynamic t-call 1`] = `
const call = app.callTemplate.bind(app);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
ctx[isBoundary] = 1;
- const b1 = text(\` owl \`);
- ctx[zero] = b1;
+ const b3 = text(\`
+ owl
+ \`);
+ ctx[zero] = b3;
const template1 = (ctx['current'].template);
- return call(this, template1, ctx, node, key + \`__1\`);
+ const b4 = call(this, template1, ctx, node, key + \`__1\`);
+ return multi([b2, b4]);
}
}"
`;
@@ -90,13 +95,16 @@ exports[`t-call handlers are properly bound through a dynamic t-call 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const call = app.callTemplate.bind(app);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const template1 = ('__template__999');
- const b2 = call(this, template1, ctx, node, key + \`__1\`);
+ const b4 = call(this, template1, ctx, node, key + \`__1\`);
let txt1 = ctx['counter'];
- return block1([txt1], [b2]);
+ const b3 = block3([txt1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -121,12 +129,15 @@ exports[`t-call handlers are properly bound through a t-call 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const callTemplate_1 = app.getTemplate(\`__template__999\`);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ const b2 = text(\`
+ \`);
+ const b4 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
let txt1 = ctx['counter'];
- return block1([txt1], [b2]);
+ const b3 = block3([txt1], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -259,16 +270,22 @@ exports[`t-call recursive t-call binding this -- static t-call 1`] = `
let { isBoundary, withDefault, setContextValue } = helpers;
const callTemplate_1 = app.getTemplate(\`recursive\`);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
ctx[isBoundary] = 1;
setContextValue(ctx, \\"level\\", 0);
- const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
- return block1([], [b2]);
+ const b4 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ ctx = ctx.__proto__;
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -277,27 +294,43 @@ exports[`t-call recursive t-call binding this -- static t-call 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let { isBoundary, withDefault, setContextValue } = helpers;
+ let { isBoundary, withDefault, setContextValue, zero } = helpers;
const callTemplate_1 = app.getTemplate(\`recursive\`);
- let block3 = createBlock(\`
\`);
+ let block5 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
- let b2;
+ let b2,b3,b12;
+ b2 = text(\`
+ \`);
if (ctx['level']<2) {
+ const b4 = text(\`
+ \`);
let hdlr1 = [\\"stop\\", ctx['onClicked'].bind(this), ctx];
let txt1 = ctx['level'];
- const b3 = block3([hdlr1, txt1]);
+ const b5 = block5([hdlr1, txt1]);
+ const b6 = text(\`
+ \`);
ctx = Object.create(ctx);
ctx[isBoundary] = 1;
+ const b8 = text(\`
+ \`);
setContextValue(ctx, \\"level\\", ctx['level']+1);
- const b4 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ const b9 = text(\`
+ \`);
+ const b7 = multi([b8, b9]);
+ ctx[zero] = b7;
+ const b10 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
ctx = ctx.__proto__;
- b2 = multi([b3, b4]);
+ const b11 = text(\`
+ \`);
+ b3 = multi([b4, b5, b6, b10, b11]);
}
- return multi([b2]);
+ b12 = text(\`
+ \`);
+ return multi([b2, b3, b12]);
}
}"
`;
@@ -309,17 +342,24 @@ exports[`t-call sub components in two t-calls 1`] = `
const callTemplate_1 = app.getTemplate(\`sub\`);
const callTemplate_2 = app.getTemplate(\`sub\`);
- let block3 = createBlock(\`
\`);
+ let block7 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
- let b2,b3;
+ let b2,b3,b7;
+ b2 = text(\`
+ \`);
if (ctx['state'].val===1) {
- b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ const b4 = text(\`
+ \`);
+ const b5 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
+ const b6 = text(\`
+ \`);
+ b3 = multi([b4, b5, b6]);
} else {
- const b4 = callTemplate_2.call(this, ctx, node, key + \`__2\`);
- b3 = block3([], [b4]);
+ const b8 = callTemplate_2.call(this, ctx, node, key + \`__2\`);
+ b7 = block7([], [b8]);
}
- return multi([b2, b3]);
+ return multi([b2, b3, b7]);
}
}"
`;
@@ -357,22 +397,33 @@ exports[`t-call t-call in t-foreach and children component 1`] = `
let { prepareList, withKey } = helpers;
const callTemplate_1 = app.getTemplate(\`__template__999\`);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b','c']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`val\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(['a','b','c']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`val\`] = v_block4[i1];
ctx[\`val_first\`] = i1 === 0;
- ctx[\`val_last\`] = i1 === v_block2.length - 1;
+ ctx[\`val_last\`] = i1 === v_block4.length - 1;
ctx[\`val_index\`] = i1;
- ctx[\`val_value\`] = k_block2[i1];
+ ctx[\`val_value\`] = k_block4[i1];
const key1 = ctx['val'];
- c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
+ const b6 = text(\`
+ \`);
+ const b7 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -410,8 +461,11 @@ exports[`t-call t-call with t-call-context and subcomponent 1`] = `
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let ctx1 = ctx['subctx'];
- return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
+ const b3 = callTemplate_1.call(this, ctx1, node, key + \`__1\`);
+ return multi([b2, b3]);
}
}"
`;
@@ -424,9 +478,15 @@ exports[`t-call t-call with t-call-context and subcomponent 2`] = `
const comp2 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1({name: ctx['aab']}, key + \`__1\`, node, this, null);
- const b3 = comp2({name: ctx['lpe']}, key + \`__2\`, node, this, null);
- return multi([b2, b3]);
+ const b2 = text(\`
+ \`);
+ const b3 = comp1({name: ctx['aab']}, key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ const b5 = comp2({name: ctx['lpe']}, key + \`__2\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b4, b5, b6]);
}
}"
`;
@@ -451,8 +511,11 @@ exports[`t-call t-call with t-call-context, simple use 1`] = `
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let ctx1 = ctx['subctx'];
- return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
+ const b3 = callTemplate_1.call(this, ctx1, node, key + \`__1\`);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_component.test.ts.snap b/tests/components/__snapshots__/t_component.test.ts.snap
index 36405cca..79d88a60 100644
--- a/tests/components/__snapshots__/t_component.test.ts.snap
+++ b/tests/components/__snapshots__/t_component.test.ts.snap
@@ -6,12 +6,17 @@ exports[`t-component can switch between dynamic components without the need for
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(null, false, false, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const Comp1 = ctx['constructor'].components[ctx['state'].child];
- const b2 = toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1));
- return block1([], [b2]);
+ const b4 = toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1));
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -143,13 +148,16 @@ exports[`t-component modifying a sub widget 2`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['state'].counter;
const v1 = ctx['state'];
let hdlr1 = [()=>v1.counter++, ctx];
- return block1([txt1, hdlr1]);
+ const b3 = block3([txt1, hdlr1]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_foreach.test.ts.snap b/tests/components/__snapshots__/t_foreach.test.ts.snap
index 9e6d0fa8..74999a26 100644
--- a/tests/components/__snapshots__/t_foreach.test.ts.snap
+++ b/tests/components/__snapshots__/t_foreach.test.ts.snap
@@ -7,20 +7,35 @@ exports[`list of components components in a node in a t-foreach 1`] = `
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
+ let block7 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`item\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['items']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`item\`] = v_block4[i1];
const key1 = 'li_'+ctx['item'];
- const b4 = comp1({item: ctx['item']}, key + \`__1__\${key1}\`, node, this, null);
- c_block2[i1] = withKey(block3([], [b4]), key1);
+ const b6 = text(\`
+ \`);
+ const b8 = comp1({item: ctx['item']}, key + \`__1__\${key1}\`, node, this, null);
+ const b7 = block7([], [b8]);
+ const b9 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b9]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -47,19 +62,30 @@ exports[`list of components crash on duplicate key in dev mode 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList([1,2]);;
- const keys1 = new Set();
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`item\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList([1,2]);;
+ const keys3 = new Set();
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`item\`] = v_block3[i1];
const key1 = 'child';
- if (keys1.has(key1)) { throw new Error(\`Got duplicate key in t-foreach: \${key1}\`)}
- keys1.add(key1);
+ if (keys3.has(key1)) { throw new Error(\`Got duplicate key in t-foreach: \${key1}\`)}
+ keys3.add(key1);
+ const b5 = text(\`
+ \`);
const props1 = {};
helpers.validateProps(\`Child\`, props1, ctx);
- c_block1[i1] = withKey(comp1(props1, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b6 = comp1(props1, key + \`__1__\${key1}\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ c_block3[i1] = withKey(multi([b5, b6, b7]), key1);
}
- return list(c_block1);
+ ctx = ctx.__proto__;
+ const b3 = list(c_block3);
+ const b8 = text(\`
+ \`);
+ return multi([b2, b3, b8]);
}
}"
`;
@@ -82,20 +108,28 @@ exports[`list of components list of sub components inside other nodes 1`] = `
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`SubComponent\`, true, false, false, true);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].blips);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`blip\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].blips);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`blip\`] = v_block4[i1];
const key1 = ctx['blip'].id;
- const b4 = comp1({}, key + \`__1__\${key1}\`, node, this, null);
- c_block2[i1] = withKey(block3([], [b4]), key1);
+ const b6 = comp1({}, key + \`__1__\${key1}\`, node, this, null);
+ c_block4[i1] = withKey(block5([], [b6]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -120,28 +154,44 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].s);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`section\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].s);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`section\`] = v_block4[i1];
ctx[\`section_index\`] = i1;
const key1 = ctx['section_index'];
+ const b6 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['section'].blips);;
- for (let i2 = 0; i2 < l_block3; i2++) {
- ctx[\`blip\`] = v_block3[i2];
+ const [k_block7, v_block7, l_block7, c_block7] = prepareList(ctx['section'].blips);;
+ for (let i2 = 0; i2 < l_block7; i2++) {
+ ctx[\`blip\`] = v_block7[i2];
ctx[\`blip_index\`] = i2;
const key2 = ctx['blip_index'];
- c_block3[i2] = withKey(comp1({blip: ctx['blip']}, key + \`__1__\${key1}__\${key2}\`, node, this, null), key2);
+ const b9 = text(\`
+ \`);
+ const b10 = comp1({blip: ctx['blip']}, key + \`__1__\${key1}__\${key2}\`, node, this, null);
+ const b11 = text(\`
+ \`);
+ c_block7[i2] = withKey(multi([b9, b10, b11]), key2);
}
ctx = ctx.__proto__;
- c_block2[i1] = withKey(list(c_block3), key1);
+ const b7 = list(c_block7);
+ const b12 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b12]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -167,30 +217,40 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach,
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`
\`);
- let block5 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].rows);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`row\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].rows);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`row\`] = v_block4[i1];
const key1 = ctx['row'];
ctx = Object.create(ctx);
- const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].cols);;
- for (let i2 = 0; i2 < l_block4; i2++) {
- ctx[\`col\`] = v_block4[i2];
+ const [k_block6, v_block6, l_block6, c_block6] = prepareList(ctx['state'].cols);;
+ for (let i2 = 0; i2 < l_block6; i2++) {
+ ctx[\`col\`] = v_block6[i2];
const key2 = ctx['col'];
- const b6 = comp1({row: ctx['row'],col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, this, null);
- c_block4[i2] = withKey(block5([], [b6]), key2);
+ const b8 = comp1({row: ctx['row'],col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, this, null);
+ c_block6[i2] = withKey(block7([], [b8]), key2);
}
ctx = ctx.__proto__;
- const b4 = list(c_block4);
- c_block2[i1] = withKey(block3([], [b4]), key1);
+ const b6 = list(c_block6);
+ c_block4[i1] = withKey(block5([], [b6]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -217,14 +277,22 @@ exports[`list of components simple list 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state'].elems);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`elem\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['state'].elems);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`elem\`] = v_block3[i1];
const key1 = ctx['elem'].id;
- c_block1[i1] = withKey(comp1({value: ctx['elem'].value}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({value: ctx['elem'].value}, key + \`__1__\${key1}\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ c_block3[i1] = withKey(multi([b5, b6, b7]), key1);
}
- return list(c_block1);
+ const b3 = list(c_block3);
+ return multi([b2, b3]);
}
}"
`;
@@ -250,18 +318,29 @@ exports[`list of components sub components rendered in a loop 1`] = `
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`number\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].numbers);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`number\`] = v_block4[i1];
const key1 = ctx['number'];
- c_block2[i1] = withKey(comp1({n: ctx['number']}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({n: ctx['number']}, key + \`__1__\${key1}\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -287,18 +366,29 @@ exports[`list of components sub components with some state rendered in a loop 1`
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].numbers);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`number\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].numbers);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`number\`] = v_block4[i1];
const key1 = ctx['number'];
- c_block2[i1] = withKey(comp1({}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({}, key + \`__1__\${key1}\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -324,7 +414,9 @@ exports[`list of components switch component position 1`] = `
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
@@ -332,8 +424,14 @@ exports[`list of components switch component position 1`] = `
for (let i1 = 0; i1 < l_block2; i1++) {
ctx[\`c\`] = v_block2[i1];
const key1 = ctx['c'];
- c_block2[i1] = withKey(comp1({key: ctx['c']}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({key: ctx['c']}, key + \`__1__\${key1}\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ c_block2[i1] = withKey(multi([b4, b5, b6]), key1);
}
+ ctx = ctx.__proto__;
const b2 = list(c_block2);
return block1([], [b2]);
}
@@ -361,19 +459,30 @@ exports[`list of components t-foreach with t-component, and update 1`] = `
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(2));;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`n\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(Array(2));;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`n\`] = v_block4[i1];
ctx[\`n_index\`] = i1;
const key1 = ctx['n_index'];
- c_block2[i1] = withKey(comp1({val: ctx['n_index']}, key + \`__1__\${key1}\`, node, this, null), key1);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({val: ctx['n_index']}, key + \`__1__\${key1}\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -383,12 +492,18 @@ exports[`list of components t-foreach with t-component, and update 2`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['state'].val;
let txt2 = ctx['props'].val;
- return block1([txt1, txt2]);
+ const b3 = block3([txt1, txt2]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_key.test.ts.snap b/tests/components/__snapshots__/t_key.test.ts.snap
index 43488f61..57467c76 100644
--- a/tests/components/__snapshots__/t_key.test.ts.snap
+++ b/tests/components/__snapshots__/t_key.test.ts.snap
@@ -7,7 +7,9 @@ exports[`t-key t-foreach with t-key switch component position 1`] = `
let { prepareList, withKey } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
@@ -15,9 +17,15 @@ exports[`t-key t-foreach with t-key switch component position 1`] = `
for (let i1 = 0; i1 < l_block2; i1++) {
ctx[\`c\`] = v_block2[i1];
const key1 = ctx['c'];
+ const b4 = text(\`
+ \`);
const tKey_1 = ctx['key1'];
- c_block2[i1] = withKey(comp1({key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, this, null), tKey_1 + key1);
+ const b5 = toggler(tKey_1, comp1({key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, this, null));
+ const b6 = text(\`
+ \`);
+ c_block2[i1] = withKey(multi([b4, b5, b6]), key1);
}
+ ctx = ctx.__proto__;
const b2 = list(c_block2);
return block1([], [b2]);
}
@@ -102,7 +110,10 @@ exports[`t-key t-key on multiple Components 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(\`Child\`, true, false, false, false);
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
+
+ \`);
return function template(ctx, node, key = \\"\\") {
const tKey_1 = ctx['key1'];
@@ -136,7 +147,10 @@ exports[`t-key t-key on multiple Components with t-call 1 1`] = `
const callTemplate_1 = app.getTemplate(\`calledTemplate\`);
const callTemplate_2 = app.getTemplate(\`calledTemplate\`);
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
+
+ \`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
@@ -150,6 +164,7 @@ exports[`t-key t-key on multiple Components with t-call 1 1`] = `
ctx[isBoundary] = 1;
setContextValue(ctx, \\"key\\", ctx['key2']);
const b3 = callTemplate_2.call(this, ctx, node, key + \`__2\`);
+ ctx = ctx.__proto__;
return block1([], [b2, b3]);
}
}"
@@ -162,8 +177,13 @@ exports[`t-key t-key on multiple Components with t-call 1 2`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const tKey_1 = ctx['key'];
- return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null));
+ const b3 = toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null));
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -188,7 +208,9 @@ exports[`t-key t-key on multiple Components with t-call 2 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const callTemplate_1 = app.getTemplate(\`calledTemplate\`);
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
@@ -205,11 +227,15 @@ exports[`t-key t-key on multiple Components with t-call 2 2`] = `
const comp2 = app.createComponent(\`Child\`, true, false, false, false);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const tKey_1 = ctx['key1'];
- const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, this, null));
+ const b3 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, this, null));
const tKey_2 = ctx['key2'];
- const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, this, null));
- return multi([b2, b3]);
+ const b4 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, this, null));
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b4, b5]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_model.test.ts.snap b/tests/components/__snapshots__/t_model.test.ts.snap
index 053ebfbb..4d71f9f6 100644
--- a/tests/components/__snapshots__/t_model.test.ts.snap
+++ b/tests/components/__snapshots__/t_model.test.ts.snap
@@ -6,15 +6,23 @@ exports[`t-model directive .lazy modifier 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
let txt1 = ctx['state'].text;
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -25,15 +33,23 @@ exports[`t-model directive .number modifier 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'number';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = toNumber(ev.target.value); }];
let txt1 = ctx['state'].number;
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -44,15 +60,23 @@ exports[`t-model directive .trim modifier 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value.trim(); }];
let txt1 = ctx['state'].text;
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -63,15 +87,21 @@ exports[`t-model directive basic use, on an input 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
let txt1 = ctx['state'].text;
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ return multi([b2, b3]);
}
}"
`;
@@ -82,15 +112,21 @@ exports[`t-model directive basic use, on an input with bracket expression 1`] =
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
let txt1 = ctx['state'].text;
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ return multi([b2, b3]);
}
}"
`;
@@ -101,7 +137,10 @@ exports[`t-model directive basic use, on another key in component 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block1 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
const bExpr1 = ctx['some'];
@@ -120,15 +159,22 @@ exports[`t-model directive can also define t-on directive on same event, part 1
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let hdlr1 = [ctx['onInput'], ctx];
const bExpr1 = ctx['state'];
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr2 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
- return block1([hdlr1, attr1, hdlr2]);
+ const b3 = block3([hdlr1, attr1, hdlr2]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -139,9 +185,15 @@ exports[`t-model directive can also define t-on directive on same event, part 2
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let hdlr1 = [ctx['onClick'], ctx];
const bExpr1 = ctx['state'];
const expr1 = 'choice';
@@ -157,7 +209,10 @@ exports[`t-model directive can also define t-on directive on same event, part 2
const expr3 = 'choice';
let attr3 = bExpr3[expr3] === 'Three';
let hdlr6 = [(ev) => { bExpr3[expr3] = ev.target.value; }];
- return block1([hdlr1, attr1, hdlr2, hdlr3, attr2, hdlr4, hdlr5, attr3, hdlr6]);
+ const b3 = block3([hdlr1, attr1, hdlr2, hdlr3, attr2, hdlr4, hdlr5, attr3, hdlr6]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -168,17 +223,25 @@ exports[`t-model directive following a scope protecting directive (e.g. t-set) 1
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue, toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"admiral\\", 'Bruno');
const bExpr1 = ctx['state'];
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
- return block1([attr1, hdlr1]);
+ const b3 = block3([attr1, hdlr1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -189,23 +252,36 @@ exports[`t-model directive in a t-foreach 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, toNumber, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`thing\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`thing\`] = v_block4[i1];
const key1 = ctx['thing'].id;
+ const b6 = text(\`
+ \`);
const bExpr1 = ctx['thing'];
const expr1 = 'f';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.checked; }];
- c_block2[i1] = withKey(block3([attr1, hdlr1]), key1);
+ const b7 = block7([attr1, hdlr1]);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b3, b9]);
}
}"
`;
@@ -216,24 +292,37 @@ exports[`t-model directive in a t-foreach, part 2 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, toNumber, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`thing\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`thing\`] = v_block4[i1];
ctx[\`thing_index\`] = i1;
const key1 = ctx['thing_index'];
+ const b6 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = ctx['thing_index'];
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
- c_block2[i1] = withKey(block3([attr1, hdlr1]), key1);
+ const b7 = block7([attr1, hdlr1]);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b3, b9]);
}
}"
`;
@@ -244,24 +333,37 @@ exports[`t-model directive in a t-foreach, part 3 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, toNumber, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['names']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`name\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['names']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`name\`] = v_block4[i1];
ctx[\`name_index\`] = i1;
const key1 = ctx['name_index'];
+ const b6 = text(\`
+ \`);
const bExpr1 = ctx['state'].values;
const expr1 = ctx['name'];
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
- c_block2[i1] = withKey(block3([attr1, hdlr1]), key1);
+ const b7 = block7([attr1, hdlr1]);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b3, b9]);
}
}"
`;
@@ -272,7 +374,14 @@ exports[`t-model directive on a select 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`Choice:
\`);
+ let block1 = createBlock(\`
+
+ Choice:
+
\`);
return function template(ctx, node, key = \\"\\") {
const bExpr1 = ctx['state'];
@@ -291,14 +400,25 @@ exports[`t-model directive on a select, initial state 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'color';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
- return block1([attr1, hdlr1]);
+ const b3 = block3([attr1, hdlr1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -309,15 +429,23 @@ exports[`t-model directive on a sub state key 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'].something;
const expr1 = 'text';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
let txt1 = ctx['state'].something.text;
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -328,7 +456,11 @@ exports[`t-model directive on an input type=radio 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`Choice:
\`);
+ let block1 = createBlock(\`
+
+
+ Choice:
+
\`);
return function template(ctx, node, key = \\"\\") {
const bExpr1 = ctx['state'];
@@ -351,7 +483,10 @@ exports[`t-model directive on an input type=radio, with initial value 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
const bExpr1 = ctx['state'];
@@ -373,7 +508,12 @@ exports[`t-model directive on an input, type=checkbox 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block1 = createBlock(\`
+
+
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
let b2,b3;
@@ -397,7 +537,10 @@ exports[`t-model directive on an textarea 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block1 = createBlock(\`
+
\`);
return function template(ctx, node, key = \\"\\") {
const bExpr1 = ctx['state'];
@@ -434,9 +577,17 @@ exports[`t-model directive t-model on select with static options 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'model';
let attr1 = bExpr1[expr1];
@@ -444,7 +595,10 @@ exports[`t-model directive t-model on select with static options 1`] = `
let txt1 = 'a';
let txt2 = 'b';
let txt3 = 'c';
- return block1([attr1, hdlr1, txt1, txt2, txt3]);
+ const b3 = block3([attr1, hdlr1, txt1, txt2, txt3]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -455,9 +609,16 @@ exports[`t-model directive t-model with dynamic values on select options -- 2 1`
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'model';
const bValue1 = bExpr1[expr1];
@@ -468,7 +629,10 @@ exports[`t-model directive t-model with dynamic values on select options -- 2 1`
let attr3 = (ctx['options'][1]);
let attr4 = bValue1 === (ctx['options'][1]);
let txt2 = ctx['options'][1];
- return block1([hdlr1, attr1, attr2, txt1, attr3, attr4, txt2]);
+ const b3 = block3([hdlr1, attr1, attr2, txt1, attr3, attr4, txt2]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -479,9 +643,16 @@ exports[`t-model directive t-model with dynamic values on select options -- 3 1`
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'model';
const bValue1 = bExpr1[expr1];
@@ -491,7 +662,10 @@ exports[`t-model directive t-model with dynamic values on select options -- 3 1`
let txt1 = ctx['options'][0];
let attr3 = bValue1 === \\"b\\";
let txt2 = ctx['options'][1];
- return block1([hdlr1, attr1, attr2, txt1, attr3, txt2]);
+ const b3 = block3([hdlr1, attr1, attr2, txt1, attr3, txt2]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -502,9 +676,16 @@ exports[`t-model directive t-model with dynamic values on select options 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'model';
const bValue1 = bExpr1[expr1];
@@ -515,7 +696,10 @@ exports[`t-model directive t-model with dynamic values on select options 1`] = `
let attr3 = ctx['options'][1];
let attr4 = bValue1 === ctx['options'][1];
let txt2 = ctx['options'][1];
- return block1([hdlr1, attr1, attr2, txt1, attr3, attr4, txt2]);
+ const b3 = block3([hdlr1, attr1, attr2, txt1, attr3, attr4, txt2]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -526,26 +710,41 @@ exports[`t-model directive t-model with dynamic values on select options in fore
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber, prepareList, withKey } = helpers;
- let block1 = createBlock(\`\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'];
const expr1 = 'model';
const bValue1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['options']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`v\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['options']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`v\`] = v_block4[i1];
const key1 = ctx['v'];
+ const b6 = text(\`
+ \`);
let attr1 = ctx['v'];
let attr2 = bValue1 === ctx['v'];
let txt1 = ctx['v'];
- c_block2[i1] = withKey(block3([attr1, attr2, txt1]), key1);
+ const b7 = block7([attr1, attr2, txt1]);
+ const b8 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b8]), key1);
}
- const b2 = list(c_block2);
- return block1([hdlr1], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([hdlr1], [b4]);
+ const b9 = text(\`
+ \`);
+ return multi([b2, b3, b9]);
}
}"
`;
@@ -556,27 +755,35 @@ exports[`t-model directive two inputs in a div alternating with a t-if 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block4 = createBlock(\`\`);
+ let block5 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
- let b2,b3;
+ const b2 = text(\`
+ \`);
+ let b4,b5;
if (ctx['state'].flag) {
const bExpr1 = ctx['state'];
const expr1 = 'text1';
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
- b2 = block2([attr1, hdlr1]);
+ b4 = block4([attr1, hdlr1]);
}
if (!ctx['state'].flag) {
const bExpr2 = ctx['state'];
const expr2 = 'text2';
let attr2 = bExpr2[expr2];
let hdlr2 = [(ev) => { bExpr2[expr2] = ev.target.value; }];
- b3 = block3([attr2, hdlr2]);
+ b5 = block5([attr2, hdlr2]);
}
- return block1([], [b2, b3]);
+ const b3 = block3([], [b4, b5]);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b6]);
}
}"
`;
@@ -587,15 +794,23 @@ exports[`t-model directive with expression having a changing key 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { toNumber } = helpers;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const bExpr1 = ctx['state'].something;
const expr1 = ctx['text'].key;
let attr1 = bExpr1[expr1];
let hdlr1 = [(ev) => { bExpr1[expr1] = ev.target.value; }];
let txt1 = ctx['state'].something[ctx['text'].key];
- return block1([attr1, hdlr1, txt1]);
+ const b3 = block3([attr1, hdlr1, txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_on.test.ts.snap b/tests/components/__snapshots__/t_on.test.ts.snap
index 76652047..aa0d7c89 100644
--- a/tests/components/__snapshots__/t_on.test.ts.snap
+++ b/tests/components/__snapshots__/t_on.test.ts.snap
@@ -6,26 +6,38 @@ exports[`t-on t-on expression captured in t-foreach 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue, prepareList, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block5 = createBlock(\`
+
+
+
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 0);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['arr']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`val\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['arr']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`val\`] = v_block4[i1];
const key1 = ctx['val'];
const v1 = ctx['otherState'];
const v2 = ctx['iter'];
let hdlr1 = [()=>v1.vals.push(v2+'_'+v2), ctx];
setContextValue(ctx, \\"iter\\", ctx['iter']+1);
- c_block2[i1] = withKey(block3([hdlr1]), key1);
+ c_block4[i1] = withKey(block5([hdlr1]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b6]);
}
}"
`;
@@ -36,14 +48,21 @@ exports[`t-on t-on expression in t-foreach 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`:
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`
+ :
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`val\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].values);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`val\`] = v_block4[i1];
ctx[\`val_index\`] = i1;
const key1 = ctx['val'];
let txt1 = ctx['val_index'];
@@ -51,10 +70,14 @@ exports[`t-on t-on expression in t-foreach 1`] = `
const v1 = ctx['otherState'];
const v2 = ctx['val'];
let hdlr1 = [()=>v1.vals.push(v2), ctx];
- c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1);
+ c_block4[i1] = withKey(block5([txt1, txt2, hdlr1]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b6]);
}
}"
`;
@@ -65,17 +88,26 @@ exports[`t-on t-on expression in t-foreach with t-set 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue, prepareList, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`:
\`);
+ let block3 = createBlock(\`
+
+
+
\`);
+ let block5 = createBlock(\`
+
+ :
+
+
\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"bossa\\", 'nova');
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`val\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].values);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`val\`] = v_block4[i1];
ctx[\`val_index\`] = i1;
const key1 = ctx['val'];
setContextValue(ctx, \\"bossa\\", ctx['bossa']+'_'+ctx['val_index']);
@@ -85,10 +117,14 @@ exports[`t-on t-on expression in t-foreach with t-set 1`] = `
const v2 = ctx['val'];
const v3 = ctx['bossa'];
let hdlr1 = [()=>v1.vals.push(v2+'_'+v3), ctx];
- c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1);
+ c_block4[i1] = withKey(block5([txt1, txt2, hdlr1]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b6]);
}
}"
`;
@@ -99,24 +135,35 @@ exports[`t-on t-on method call in t-foreach 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, withKey } = helpers;
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`:
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block5 = createBlock(\`
+ :
+
+
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['state'].values);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`val\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state'].values);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`val\`] = v_block4[i1];
ctx[\`val_index\`] = i1;
const key1 = ctx['val'];
let txt1 = ctx['val_index'];
let txt2 = ctx['val']+'';
const v1 = ctx['val'];
let hdlr1 = [()=>this.addVal(v1), ctx];
- c_block2[i1] = withKey(block3([txt1, txt2, hdlr1]), key1);
+ c_block4[i1] = withKey(block5([txt1, txt2, hdlr1]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ const b6 = text(\`
+ \`);
+ return multi([b2, b3, b6]);
}
}"
`;
@@ -129,13 +176,19 @@ exports[`t-on t-on on component next to t-on on div 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const catcher1 = createCatcher({\\"click\\":0});
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const hdlr1 = [ctx['increment'], ctx];
- const b2 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]);
+ const b4 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]);
let hdlr2 = [ctx['decrement'], ctx];
- return block1([hdlr2], [b2]);
+ const b3 = block3([hdlr2], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -192,16 +245,24 @@ exports[`t-on t-on on components and t-foreach 1`] = `
const catcher1 = createCatcher({\\"click\\":0});
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(['John','Raoul','Gérald']);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`name\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(['John','Raoul','Gérald']);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`name\`] = v_block3[i1];
const key1 = ctx['name'];
+ const b5 = text(\`
+ \`);
const v1 = ctx['name'];
const hdlr1 = [()=>this.log(v1), ctx];
- c_block1[i1] = withKey(catcher1(comp1({value: ctx['name']}, key + \`__1__\${key1}\`, node, this, null), [hdlr1]), key1);
+ const b6 = catcher1(comp1({value: ctx['name']}, key + \`__1__\${key1}\`, node, this, null), [hdlr1]);
+ const b7 = text(\`
+ \`);
+ c_block3[i1] = withKey(multi([b5, b6, b7]), key1);
}
- return list(c_block1);
+ const b3 = list(c_block3);
+ return multi([b2, b3]);
}
}"
`;
@@ -228,12 +289,19 @@ exports[`t-on t-on on components, variation 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const catcher1 = createCatcher({\\"click\\":0});
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const hdlr1 = [ctx['increment'], ctx];
- const b2 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]);
- return block1([], [b2]);
+ const b4 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -292,10 +360,15 @@ exports[`t-on t-on on components, with a handler update 1`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"name\\", ctx['state'].name);
+ const b3 = text(\`
+ \`);
const v1 = ctx['name'];
const hdlr1 = [()=>this.log(v1), ctx];
- return catcher1(comp1({value: ctx['name']}, key + \`__1\`, node, this, null), [hdlr1]);
+ const b4 = catcher1(comp1({value: ctx['name']}, key + \`__1\`, node, this, null), [hdlr1]);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -353,14 +426,22 @@ exports[`t-on t-on on slot, with 'prevent' modifier 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block5 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
- return block1();
+ const b4 = text(\`
+ \`);
+ const b5 = block5();
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -387,23 +468,39 @@ exports[`t-on t-on on t-set-slots 1`] = `
const catcher1 = createCatcher({\\"click\\":0});
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block6 = createBlock(\`something
\`);
- let block7 = createBlock(\`paragraph
\`);
+ let block7 = createBlock(\`something
\`);
+ let block9 = createBlock(\`paragraph
\`);
function slot1(ctx, node, key = \\"\\") {
- const b6 = block6();
+ const b6 = text(\`
+ \`);
const b7 = block7();
+ const b8 = text(\`
+ \`);
+ const b9 = block9();
+ const b10 = text(\`
+ \`);
const hdlr1 = [()=>this.state.count++, ctx];
- return catcher1(multi([b6, b7]), [hdlr1]);
+ return catcher1(multi([b6, b7, b8, b9, b10]), [hdlr1]);
+ }
+
+ function slot2(ctx, node, key = \\"\\") {
+ const b12 = text(\`
+ \`);
+ const b13 = text(\`
+ \`);
+ return multi([b12, b13]);
}
return function template(ctx, node, key = \\"\\") {
- const b2 = text(\` [\`);
+ const b2 = text(\`
+ [\`);
const b3 = text(ctx['state'].count);
- const b4 = text(\`] \`);
+ const b4 = text(\`]
+ \`);
const ctx1 = capture(ctx);
- const b8 = comp1({slots: markRaw({'myslot': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
- return multi([b2, b3, b4, b8]);
+ const b14 = comp1({slots: markRaw({'myslot': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b3, b4, b14]);
}
}"
`;
@@ -427,14 +524,22 @@ exports[`t-on t-on on t-slots 1`] = `
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`something
\`);
+ let block5 = createBlock(\`something
\`);
function slot1(ctx, node, key = \\"\\") {
- return block1();
+ const b4 = text(\`
+ \`);
+ const b5 = block5();
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ const b2 = text(\`
+ \`);
+ const b7 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null);
+ return multi([b2, b7]);
}
}"
`;
@@ -447,9 +552,11 @@ exports[`t-on t-on on t-slots 2`] = `
const catcher1 = createCatcher({\\"click\\":0});
return function template(ctx, node, key = \\"\\") {
- const b2 = text(\` [\`);
+ const b2 = text(\`
+ [\`);
const b3 = text(ctx['state'].count);
- const b4 = text(\`] \`);
+ const b4 = text(\`]
+ \`);
const hdlr1 = [()=>this.state.count++, ctx];
const b5 = catcher1(callSlot(ctx, node, key, 'default', false, {}), [hdlr1]);
return multi([b2, b3, b4, b5]);
diff --git a/tests/components/__snapshots__/t_props.test.ts.snap b/tests/components/__snapshots__/t_props.test.ts.snap
index 8b578382..b250a205 100644
--- a/tests/components/__snapshots__/t_props.test.ts.snap
+++ b/tests/components/__snapshots__/t_props.test.ts.snap
@@ -6,11 +6,18 @@ exports[`t-props basic use 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, true, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1(Object.assign({}, ctx['some'].obj), key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1(Object.assign({}, ctx['some'].obj), key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
@@ -20,11 +27,18 @@ exports[`t-props basic use 2`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+ \`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let txt1 = ctx['props'].a+ctx['props'].b;
- return block1([txt1]);
+ const b3 = block3([txt1]);
+ const b4 = text(\`
+ \`);
+ return multi([b2, b3, b4]);
}
}"
`;
@@ -119,11 +133,18 @@ exports[`t-props t-props with props 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, true, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- const b2 = comp1(Object.assign({}, ctx['childProps'], {a: 1,b: 2}), key + \`__1\`, node, this, null);
- return block1([], [b2]);
+ const b2 = text(\`
+ \`);
+ const b4 = comp1(Object.assign({}, ctx['childProps'], {a: 1,b: 2}), key + \`__1\`, node, this, null);
+ const b3 = block3([], [b4]);
+ const b5 = text(\`
+ \`);
+ return multi([b2, b3, b5]);
}
}"
`;
diff --git a/tests/components/__snapshots__/t_set.test.ts.snap b/tests/components/__snapshots__/t_set.test.ts.snap
index b591ce2f..5a67e90e 100644
--- a/tests/components/__snapshots__/t_set.test.ts.snap
+++ b/tests/components/__snapshots__/t_set.test.ts.snap
@@ -7,24 +7,36 @@ exports[`t-set slot setted value (with t-set) not accessible with t-esc 1`] = `
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
const comp1 = app.createComponent(\`Childcomp\`, true, true, false, true);
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b5 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 'inCall');
- return text('');
+ const b6 = text(\`
+ \`);
+ return multi([b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 'source');
let txt1 = ctx['iter'];
const ctx1 = capture(ctx);
- const b2 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
+ const b7 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null);
let txt2 = ctx['iter'];
- return block1([txt1, txt2], [b2]);
+ const b3 = block3([txt1, txt2], [b7]);
+ return multi([b2, b3]);
}
}"
`;
@@ -59,19 +71,33 @@ exports[`t-set slots with a t-set with a component in body 1`] = `
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b4 = text(\`
+ \`);
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
- const b3 = text(\` in slot \`);
- const b4 = safeOutput(ctx['v']);
- return multi([b3, b4]);
+ const b9 = text(\`
+ in slot
+ \`);
+ const b10 = safeOutput(ctx['v']);
+ const b11 = text(\`
+ \`);
+ return multi([b4, b9, b10, b11]);
}
function value1(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({}, key + \`__1\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ return multi([b6, b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b12 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ return multi([b2, b12]);
}
}"
`;
@@ -109,26 +135,41 @@ exports[`t-set slots with an t-set with a component in body 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
const comp2 = app.createComponent(\`Blorg\`, true, true, false, true);
- let block4 = createBlock(\`coffee
\`);
+ let block9 = createBlock(\`coffee
\`);
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b4 = text(\`
+ \`);
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
- const b5 = text(\` tea \`);
- const b6 = safeOutput(ctx['v']);
- return multi([b5, b6]);
+ const b11 = text(\`
+ tea
+ \`);
+ const b12 = safeOutput(ctx['v']);
+ const b13 = text(\`
+ \`);
+ return multi([b4, b11, b12, b13]);
}
function value1(ctx, node, key = \\"\\") {
- const b3 = comp1({}, key + \`__1\`, node, this, null);
- const b4 = block4();
- return multi([b3, b4]);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({}, key + \`__1\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ const b9 = block9();
+ const b10 = text(\`
+ \`);
+ return multi([b6, b7, b8, b9, b10]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b14 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ return multi([b2, b14]);
}
}"
`;
@@ -169,17 +210,30 @@ exports[`t-set slots with an unused t-set with a component in body 1`] = `
function slot1(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b4 = text(\`
+ \`);
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
- return text(\` in slot \`);
+ const b9 = text(\`
+ in slot
+ \`);
+ return multi([b4, b9]);
}
function value1(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({}, key + \`__1\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ return multi([b6, b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
const ctx1 = capture(ctx);
- return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ const b10 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null);
+ return multi([b2, b10]);
}
}"
`;
@@ -204,15 +258,22 @@ exports[`t-set t-set can't alter component even if key in component 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
let txt1 = ctx['iter'];
setContextValue(ctx, \\"iter\\", 5);
let txt2 = ctx['iter'];
- return block1([txt1, txt2]);
+ const b3 = block3([txt1, txt2]);
+ return multi([b2, b3]);
}
}"
`;
@@ -223,15 +284,22 @@ exports[`t-set t-set can't alter component if key not in component 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
let txt1 = ctx['iter'];
setContextValue(ctx, \\"iter\\", 5);
let txt2 = ctx['iter'];
- return block1([txt1, txt2]);
+ const b3 = block3([txt1, txt2]);
+ return multi([b2, b3]);
}
}"
`;
@@ -242,21 +310,44 @@ exports[`t-set t-set in t-if 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
+ let b4,b7,b10;
setContextValue(ctx, \\"flag\\", ctx['state'].flag);
if (ctx['flag']==='if') {
+ const b5 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 2);
+ const b6 = text(\`
+ \`);
+ b4 = multi([b5, b6]);
} else if (ctx['flag']==='elif') {
+ const b8 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 3);
+ const b9 = text(\`
+ \`);
+ b7 = multi([b8, b9]);
} else {
+ const b11 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 4);
+ const b12 = text(\`
+ \`);
+ b10 = multi([b11, b12]);
}
let txt1 = ctx['iter'];
- return block1([txt1]);
+ const b3 = block3([txt1], [b4, b7, b10]);
+ return multi([b2, b3]);
}
}"
`;
@@ -268,16 +359,24 @@ exports[`t-set t-set not altered by child comp 1`] = `
let { isBoundary, withDefault, setContextValue } = helpers;
const comp1 = app.createComponent(\`Childcomp\`, true, false, false, true);
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 'source');
let txt1 = ctx['iter'];
- const b2 = comp1({}, key + \`__1\`, node, this, null);
+ const b4 = comp1({}, key + \`__1\`, node, this, null);
let txt2 = ctx['iter'];
- return block1([txt1, txt2], [b2]);
+ const b3 = block3([txt1, txt2], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -307,22 +406,46 @@ exports[`t-set t-set outside modified in t-if 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, setContextValue } = helpers;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
+ let b4,b7,b10;
setContextValue(ctx, \\"iter\\", 0);
setContextValue(ctx, \\"flag\\", ctx['state'].flag);
if (ctx['flag']==='if') {
+ const b5 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 2);
+ const b6 = text(\`
+ \`);
+ b4 = multi([b5, b6]);
} else if (ctx['flag']==='elif') {
+ const b8 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 3);
+ const b9 = text(\`
+ \`);
+ b7 = multi([b8, b9]);
} else {
+ const b11 = text(\`
+ \`);
setContextValue(ctx, \\"iter\\", 4);
+ const b12 = text(\`
+ \`);
+ b10 = multi([b11, b12]);
}
let txt1 = ctx['iter'];
- return block1([txt1]);
+ const b3 = block3([txt1], [b4, b7, b10]);
+ return multi([b2, b3]);
}
}"
`;
@@ -334,18 +457,29 @@ exports[`t-set t-set with a component in body 1`] = `
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
function value1(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
- const b3 = safeOutput(ctx['v']);
- return block1([], [b3]);
+ const b8 = safeOutput(ctx['v']);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -367,19 +501,30 @@ exports[`t-set t-set with something in body 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
- let block1 = createBlock(\`\`);
- let block2 = createBlock(\`coucou
\`);
+ let block3 = createBlock(\`\`);
+ let block6 = createBlock(\`coucou
\`);
function value1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
+ const b2 = text(\`
+ \`);
ctx[\`v\`] = new LazyValue(value1, ctx, this, node);
- const b3 = safeOutput(ctx['v']);
- return block1([], [b3]);
+ const b8 = safeOutput(ctx['v']);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
diff --git a/tests/misc/__snapshots__/portal.test.ts.snap b/tests/misc/__snapshots__/portal.test.ts.snap
index dca22dd3..a39a5ef6 100644
--- a/tests/misc/__snapshots__/portal.test.ts.snap
+++ b/tests/misc/__snapshots__/portal.test.ts.snap
@@ -9,21 +9,27 @@ exports[`Portal Add and remove portals 1`] = `
const comp1 = app.createComponent(null, false, true, false, false);
function slot1(ctx, node, key = \\"\\") {
- const b3 = text(\` Portal\`);
- const b4 = text(ctx['portalId']);
- return multi([b3, b4]);
+ const b5 = text(\`
+ Portal\`);
+ const b6 = text(ctx['portalId']);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`portalId\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['portalIds']);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`portalId\`] = v_block3[i1];
const key1 = ctx['portalId'];
const ctx1 = capture(ctx);
- c_block1[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
+ c_block3[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
}
- return list(c_block1);
+ const b3 = list(c_block3);
+ return multi([b2, b3]);
}
}"
`;
@@ -36,23 +42,28 @@ exports[`Portal Add and remove portals on div 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block2 = createBlock(\` Portal
\`);
+ let block4 = createBlock(\`
+ Portal
+
\`);
function slot1(ctx, node, key = \\"\\") {
let txt1 = ctx['portalId'];
- return block2([txt1]);
+ return block4([txt1]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`portalId\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['portalIds']);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`portalId\`] = v_block3[i1];
const key1 = ctx['portalId'];
const ctx1 = capture(ctx);
- c_block1[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
+ c_block3[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
}
- return list(c_block1);
+ const b3 = list(c_block3);
+ return multi([b2, b3]);
}
}"
`;
@@ -65,26 +76,40 @@ exports[`Portal Add and remove portals with t-foreach 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block2 = createBlock(\`
\`);
+ let block6 = createBlock(\`
+
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- const b4 = text(\` Portal\`);
- const b5 = text(ctx['portalId']);
- return multi([b4, b5]);
+ const b8 = text(\`
+ Portal\`);
+ const b9 = text(ctx['portalId']);
+ const b10 = text(\`
+ \`);
+ return multi([b8, b9, b10]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`portalId\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['portalIds']);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`portalId\`] = v_block3[i1];
const key1 = ctx['portalId'];
+ const b5 = text(\`
+ \`);
let txt1 = ctx['portalId'];
const ctx1 = capture(ctx);
- const b6 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
- c_block1[i1] = withKey(block2([txt1], [b6]), key1);
+ const b11 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
+ const b6 = block6([txt1], [b11]);
+ const b12 = text(\`
+ \`);
+ c_block3[i1] = withKey(multi([b5, b6, b12]), key1);
}
- return list(c_block1);
+ const b3 = list(c_block3);
+ return multi([b2, b3]);
}
}"
`;
@@ -97,26 +122,40 @@ exports[`Portal Add and remove portals with t-foreach and destroy 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block2 = createBlock(\`
\`);
+ let block6 = createBlock(\`
+
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- const b4 = text(\` Portal\`);
- const b5 = text(ctx['portalId']);
- return multi([b4, b5]);
+ const b8 = text(\`
+ Portal\`);
+ const b9 = text(ctx['portalId']);
+ const b10 = text(\`
+ \`);
+ return multi([b8, b9, b10]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['portalIds']);;
- for (let i1 = 0; i1 < l_block1; i1++) {
- ctx[\`portalId\`] = v_block1[i1];
+ const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['portalIds']);;
+ for (let i1 = 0; i1 < l_block3; i1++) {
+ ctx[\`portalId\`] = v_block3[i1];
const key1 = ctx['portalId'];
+ const b5 = text(\`
+ \`);
let txt1 = ctx['portalId'];
const ctx1 = capture(ctx);
- const b6 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
- c_block1[i1] = withKey(block2([txt1], [b6]), key1);
+ const b11 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
+ const b6 = block6([txt1], [b11]);
+ const b12 = text(\`
+ \`);
+ c_block3[i1] = withKey(multi([b5, b6, b12]), key1);
}
- return list(c_block1);
+ const b3 = list(c_block3);
+ return multi([b2, b3]);
}
}"
`;
@@ -129,28 +168,45 @@ exports[`Portal Add and remove portals with t-foreach inside div 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block7 = createBlock(\`
+
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- const b5 = text(\` Portal\`);
- const b6 = text(ctx['portalId']);
- return multi([b5, b6]);
+ const b9 = text(\`
+ Portal\`);
+ const b10 = text(ctx['portalId']);
+ const b11 = text(\`
+ \`);
+ return multi([b9, b10, b11]);
}
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
ctx = Object.create(ctx);
- const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['portalIds']);;
- for (let i1 = 0; i1 < l_block2; i1++) {
- ctx[\`portalId\`] = v_block2[i1];
+ const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['portalIds']);;
+ for (let i1 = 0; i1 < l_block4; i1++) {
+ ctx[\`portalId\`] = v_block4[i1];
const key1 = ctx['portalId'];
+ const b6 = text(\`
+ \`);
let txt1 = ctx['portalId'];
const ctx1 = capture(ctx);
- const b7 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
- c_block2[i1] = withKey(block3([txt1], [b7]), key1);
+ const b12 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
+ const b7 = block7([txt1], [b12]);
+ const b13 = text(\`
+ \`);
+ c_block4[i1] = withKey(multi([b6, b7, b13]), key1);
}
- const b2 = list(c_block2);
- return block1([], [b2]);
+ ctx = ctx.__proto__;
+ const b4 = list(c_block4);
+ const b3 = block3([], [b4]);
+ return multi([b2, b3]);
}
}"
`;
@@ -163,15 +219,25 @@ exports[`Portal Portal composed with t-slot 1`] = `
const comp1 = app.createComponent(\`Child2\`, true, false, false, false);
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({customHandler: ctx['_handled']}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({customHandler: ctx['_handled']}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -185,11 +251,19 @@ exports[`Portal Portal composed with t-slot 2`] = `
const comp1 = app.createComponent(null, false, true, false, false);
function slot1(ctx, node, key = \\"\\") {
- return callSlot(ctx, node, key, 'default', false, {});
+ const b4 = text(\`
+ \`);
+ const b5 = callSlot(ctx, node, key, 'default', false, {});
+ const b6 = text(\`
+ \`);
+ return multi([b4, b5, b6]);
}
return function template(ctx, node, key = \\"\\") {
- return comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b2 = text(\`
+ \`);
+ const b7 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ return multi([b2, b7]);
}
}"
`;
@@ -215,16 +289,27 @@ exports[`Portal basic use of portal 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`1
\`);
- let block2 = createBlock(\`2
\`);
+ let block3 = createBlock(\`
+ 1
+
+
\`);
+ let block6 = createBlock(\`2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -236,16 +321,27 @@ exports[`Portal basic use of portal in dev mode 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`1
\`);
- let block2 = createBlock(\`2
\`);
+ let block3 = createBlock(\`
+ 1
+
+
\`);
+ let block6 = createBlock(\`2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -257,16 +353,24 @@ exports[`Portal basic use of portal on div 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`1
\`);
- let block2 = createBlock(\`\`);
+ let block3 = createBlock(\`
+ 1
+
+
\`);
+ let block4 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ return block4();
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b5 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -278,16 +382,27 @@ exports[`Portal basic use of portal, variation 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`1
\`);
- let block2 = createBlock(\`2
\`);
+ let block3 = createBlock(\`
+ 1
+
+
\`);
+ let block6 = createBlock(\`2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: ctx['target'],slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: ctx['target'],slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -300,19 +415,28 @@ exports[`Portal conditional use of Portal (with sub Component) 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
- let block2 = createBlock(\`1\`);
+ let block3 = createBlock(\`1\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ return multi([b6, b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
- let b2,b4;
- b2 = block2();
+ let b2,b3,b4,b9;
+ b2 = text(\`
+ \`);
+ b3 = block3();
+ b4 = text(\`
+ \`);
if (ctx['state'].hasPortal) {
- b4 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
+ b9 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
}
- return multi([b2, b4]);
+ return multi([b2, b3, b4, b9]);
}
}"
`;
@@ -338,20 +462,29 @@ exports[`Portal conditional use of Portal 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block2 = createBlock(\`1\`);
- let block3 = createBlock(\`2
\`);
+ let block3 = createBlock(\`1\`);
+ let block7 = createBlock(\`2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block3();
+ const b6 = text(\`
+ \`);
+ const b7 = block7();
+ const b8 = text(\`
+ \`);
+ return multi([b6, b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
- let b2,b4;
- b2 = block2();
+ let b2,b3,b4,b9;
+ b2 = text(\`
+ \`);
+ b3 = block3();
+ b4 = text(\`
+ \`);
if (ctx['state'].hasPortal) {
- b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ b9 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
}
- return multi([b2, b4]);
+ return multi([b2, b3, b4, b9]);
}
}"
`;
@@ -363,11 +496,18 @@ exports[`Portal conditional use of Portal with child and div 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
- let b2;
+ let b2,b3;
+ b2 = text(\`
+ \`);
if (ctx['state'].hasPortal) {
- b2 = comp1({}, key + \`__1\`, node, this, null);
+ const b4 = text(\`
+ \`);
+ const b5 = comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ b3 = multi([b4, b5, b6]);
}
- return multi([b2]);
+ return multi([b2, b3]);
}
}"
`;
@@ -408,15 +548,24 @@ exports[`Portal conditional use of Portal with child and div, variation 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
- let block2 = createBlock(\`
\`);
+ let block5 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- let b2;
+ let b2,b3;
+ b2 = text(\`
+ \`);
if (ctx['state'].hasPortal) {
- const b3 = comp1({}, key + \`__1\`, node, this, null);
- b2 = block2([], [b3]);
+ const b4 = text(\`
+ \`);
+ const b6 = comp1({}, key + \`__1\`, node, this, null);
+ const b5 = block5([], [b6]);
+ const b7 = text(\`
+ \`);
+ b3 = multi([b4, b5, b7]);
}
- return multi([b2]);
+ return multi([b2, b3]);
}
}"
`;
@@ -459,20 +608,35 @@ exports[`Portal conditional use of Portal with div 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block2 = createBlock(\`hasPortal
\`);
- let block3 = createBlock(\`thePortal
\`);
+ let block5 = createBlock(\`
+ hasPortal
+
+
\`);
+ let block8 = createBlock(\`thePortal
\`);
function slot1(ctx, node, key = \\"\\") {
- return block3();
+ const b7 = text(\`
+ \`);
+ const b8 = block8();
+ const b9 = text(\`
+ \`);
+ return multi([b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
- let b2;
+ let b2,b3;
+ b2 = text(\`
+ \`);
if (ctx['state'].hasPortal) {
- const b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- b2 = block2([], [b4]);
+ const b4 = text(\`
+ \`);
+ const b10 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b5 = block5([], [b10]);
+ const b11 = text(\`
+ \`);
+ b3 = multi([b4, b5, b11]);
}
- return multi([b2]);
+ return multi([b2, b3]);
}
}"
`;
@@ -485,18 +649,28 @@ exports[`Portal lifecycle hooks of portal sub component are properly called 1`]
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- let b3;
+ const b2 = text(\`
+ \`);
+ let b8;
if (ctx['state'].hasChild) {
- b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
+ b8 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
}
- return block1([], [b3]);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -522,21 +696,30 @@ exports[`Portal portal could have dynamically no content 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
- let b3;
+ let b5,b6,b7;
+ b5 = text(\`
+ \`);
if (ctx['state'].val) {
let txt1 = ctx['state'].val;
- b3 = block3([txt1]);
+ b6 = block6([txt1]);
}
- return multi([b3]);
+ b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b4]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -549,15 +732,25 @@ exports[`Portal portal destroys on crash 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({error: ctx['state'].error}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({error: ctx['state'].error}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -584,15 +777,25 @@ exports[`Portal portal with child and props 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -618,24 +821,33 @@ exports[`Portal portal with dynamic body 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`\`);
- let block4 = createBlock(\`\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`\`);
+ let block7 = createBlock(\`\`);
function slot1(ctx, node, key = \\"\\") {
- let b3,b4;
+ let b5,b6,b7,b8;
+ b5 = text(\`
+ \`);
if (ctx['state'].val) {
let txt1 = ctx['state'].val;
- b3 = block3([txt1]);
+ b6 = block6([txt1]);
} else {
- b4 = block4();
+ b7 = block7();
}
- return multi([b3, b4]);
+ b8 = text(\`
+ \`);
+ return multi([b5, b6, b7, b8]);
}
return function template(ctx, node, key = \\"\\") {
- const b5 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b5]);
+ const b2 = text(\`
+ \`);
+ const b9 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b9]);
+ return multi([b2, b3]);
}
}"
`;
@@ -647,19 +859,30 @@ exports[`Portal portal with many children 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block3 = createBlock(\`1
\`);
- let block4 = createBlock(\`2
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`1
\`);
+ let block8 = createBlock(\`2
\`);
function slot1(ctx, node, key = \\"\\") {
- const b3 = block3();
- const b4 = block4();
- return multi([b3, b4]);
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ const b8 = block8();
+ const b9 = text(\`
+ \`);
+ return multi([b5, b6, b7, b8, b9]);
}
return function template(ctx, node, key = \\"\\") {
- const b5 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b5]);
+ const b2 = text(\`
+ \`);
+ const b10 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b10]);
+ return multi([b2, b3]);
}
}"
`;
@@ -671,19 +894,28 @@ exports[`Portal portal with no content 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- let b3;
+ let b5,b6,b7;
+ b5 = text(\`
+ \`);
if (false) {
- b3 = text('ABC');
+ b6 = text('ABC');
}
- return multi([b3]);
+ b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b4]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -695,15 +927,25 @@ exports[`Portal portal with only text as content 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return text('only text');
+ const b5 = text(\`
+ \`);
+ const b6 = text('only text');
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -715,16 +957,26 @@ exports[`Portal portal with target not in dom 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`2
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#does-not-exist',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#does-not-exist',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -737,15 +989,25 @@ exports[`Portal portal's parent's env is not polluted 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
const comp2 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -755,10 +1017,13 @@ exports[`Portal portal's parent's env is not polluted 2`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`\`);
+ let block3 = createBlock(\`\`);
return function template(ctx, node, key = \\"\\") {
- return block1();
+ const b2 = text(\`
+ \`);
+ const b3 = block3();
+ return multi([b2, b3]);
}
}"
`;
@@ -769,16 +1034,26 @@ exports[`Portal simple catchError with portal 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Boom\`, true, false, false, true);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
return function template(ctx, node, key = \\"\\") {
- let b2,b3;
+ const b2 = text(\`
+ \`);
+ let b4,b5;
if (ctx['error']) {
- b2 = text(\`Error\`);
+ b4 = text(\`Error\`);
} else {
- b3 = comp1({}, key + \`__1\`, node, this, null);
+ const b6 = text(\`
+ \`);
+ const b7 = comp1({}, key + \`__1\`, node, this, null);
+ const b8 = text(\`
+ \`);
+ b5 = multi([b6, b7, b8]);
}
- return block1([], [b2, b3]);
+ const b3 = block3([], [b4, b5]);
+ return multi([b2, b3]);
}
}"
`;
@@ -790,17 +1065,28 @@ exports[`Portal simple catchError with portal 2`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`1
\`);
- let block2 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+ 1
+
+
\`);
+ let block6 = createBlock(\`
\`);
function slot1(ctx, node, key = \\"\\") {
+ const b5 = text(\`
+ \`);
let txt1 = ctx['a'].b.c;
- return block2([txt1]);
+ const b6 = block6([txt1]);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -812,16 +1098,28 @@ exports[`Portal with target in template (after portal) 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`1\`);
- let block2 = createBlock(\`
2
\`);
+ let block3 = createBlock(\`
+
1
+
+
+
\`);
+ let block6 = createBlock(\`
2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -833,16 +1131,28 @@ exports[`Portal with target in template (before portal) 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
1
\`);
- let block2 = createBlock(\`
2
\`);
+ let block3 = createBlock(\`
+
+ 1
+
+
\`);
+ let block6 = createBlock(\`
2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -854,16 +1164,26 @@ exports[`Portal: Props validation target must be a valid selector 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`
2
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`
2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: ' ',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: ' ',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -875,16 +1195,26 @@ exports[`Portal: Props validation target must be a valid selector 2 1`] = `
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
- let block2 = createBlock(\`
2
\`);
+ let block3 = createBlock(\`
+
+
\`);
+ let block6 = createBlock(\`
2
\`);
function slot1(ctx, node, key = \\"\\") {
- return block2();
+ const b5 = text(\`
+ \`);
+ const b6 = block6();
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp1({target: 'aa',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp1({target: 'aa',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -897,15 +1227,25 @@ exports[`Portal: UI/UX focus is kept across re-renders 1`] = `
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
+
+
\`);
function slot1(ctx, node, key = \\"\\") {
- return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b5 = text(\`
+ \`);
+ const b6 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
+ const b7 = text(\`
+ \`);
+ return multi([b5, b6, b7]);
}
return function template(ctx, node, key = \\"\\") {
- const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
- return block1([], [b3]);
+ const b2 = text(\`
+ \`);
+ const b8 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
+ const b3 = block3([], [b8]);
+ return multi([b2, b3]);
}
}"
`;
@@ -915,11 +1255,14 @@ exports[`Portal: UI/UX focus is kept across re-renders 2`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
- let block1 = createBlock(\`
\`);
+ let block3 = createBlock(\`
\`);
return function template(ctx, node, key = \\"\\") {
+ const b2 = text(\`
+ \`);
let attr1 = ctx['props'].val;
- return block1([attr1]);
+ const b3 = block3([attr1]);
+ return multi([b2, b3]);
}
}"
`;