diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts index f8000c35..e0714226 100644 --- a/src/compiler/code_generator.ts +++ b/src/compiler/code_generator.ts @@ -1031,7 +1031,7 @@ export class CodeGenerator { this.helpers.add("LazyValue"); const bodyAst: AST = { type: ASTType.Multi, content: ast.body }; const name = this.compileInNewTarget("value", bodyAst, ctx); - let value = `new LazyValue(${name}, ctx, node)`; + let value = `new LazyValue(${name}, ctx, this, node)`; value = ast.value ? (value ? `withDefault(${expr}, ${value})` : expr) : value; this.addLine(`ctx[\`${ast.name}\`] = ${value};`); } else { @@ -1187,7 +1187,7 @@ export class CodeGenerator { })`, }); - let blockExpr = `${id}(${propString}, ${keyArg}, node, ctx, ${ast.isDynamic ? expr : null})`; + let blockExpr = `${id}(${propString}, ${keyArg}, node, this, ${ast.isDynamic ? expr : null})`; if (ast.isDynamic) { blockExpr = `toggler(${expr}, ${blockExpr})`; } diff --git a/src/runtime/template_helpers.ts b/src/runtime/template_helpers.ts index fb8b8790..0e7e5e2c 100644 --- a/src/runtime/template_helpers.ts +++ b/src/runtime/template_helpers.ts @@ -108,15 +108,17 @@ function shallowEqual(l1: any[], l2: any[]): boolean { class LazyValue { fn: any; ctx: any; + component: any; node: any; - constructor(fn: any, ctx: any, node: any) { + constructor(fn: any, ctx: any, component: any, node: any) { this.fn = fn; this.ctx = capture(ctx); + this.component = component; this.node = node; } evaluate(): any { - return this.fn(this.ctx, this.node); + return this.fn.call(this.component, this.ctx, this.node); } toString() { diff --git a/tests/__snapshots__/reactivity.test.ts.snap b/tests/__snapshots__/reactivity.test.ts.snap index 4a1e4872..01a773a1 100644 --- a/tests/__snapshots__/reactivity.test.ts.snap +++ b/tests/__snapshots__/reactivity.test.ts.snap @@ -57,7 +57,7 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -89,7 +89,7 @@ exports[`Reactivity: useState destroyed component is inactive 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -134,7 +134,7 @@ exports[`Reactivity: useState parent and children subscribed to same context 1`] let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); let txt1 = ctx['contextObj'].b; return block1([txt1], [b2]); } @@ -228,8 +228,8 @@ exports[`Reactivity: useState two components are updated in parallel 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); - const b3 = comp2({}, key + \`__2\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); + const b3 = comp2({}, key + \`__2\`, node, this, null); return block1([], [b2, b3]); } }" @@ -259,8 +259,8 @@ exports[`Reactivity: useState two components can subscribe to same context 1`] = let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); - const b3 = comp2({}, key + \`__2\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); + const b3 = comp2({}, key + \`__2\`, node, this, null); return block1([], [b2, b3]); } }" @@ -290,8 +290,8 @@ exports[`Reactivity: useState two independent components on different levels are let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); - const b3 = comp2({}, key + \`__2\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); + const b3 = comp2({}, key + \`__2\`, node, this, null); return block1([], [b2, b3]); } }" @@ -320,7 +320,7 @@ exports[`Reactivity: useState two independent components on different levels are let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -355,7 +355,7 @@ exports[`Reactivity: useState useless atoms should be deleted 1`] = ` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`id\`] = v_block2[i1]; const key1 = ctx['id']; - c_block2[i1] = withKey(comp1({id: ctx['id']}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block2[i1] = withKey(comp1({id: ctx['id']}, key + \`__1__\${key1}\`, node, this, null), key1); } ctx = ctx.__proto__; const b2 = list(c_block2); diff --git a/tests/compiler/__snapshots__/misc.test.ts.snap b/tests/compiler/__snapshots__/misc.test.ts.snap index 0d85de09..923c7f15 100644 --- a/tests/compiler/__snapshots__/misc.test.ts.snap +++ b/tests/compiler/__snapshots__/misc.test.ts.snap @@ -35,7 +35,7 @@ exports[`misc complex template 1`] = ` for (let i1 = 0; i1 < l_block4; i1++) { ctx[\`slot\`] = v_block4[i1]; const key1 = ctx['slot'].id; - c_block4[i1] = withKey(comp1({class: ctx['slot_container'],slot: ctx['slot']}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block4[i1] = withKey(comp1({class: ctx['slot_container'],slot: ctx['slot']}, key + \`__1__\${key1}\`, node, this, null), key1); } ctx = ctx.__proto__; b4 = list(c_block4); @@ -319,8 +319,8 @@ exports[`misc other complex template 1`] = ` if (!ctx['project']) { b24 = block24(); } else { - const b26 = comp1({bundles: ctx['bundles'].sticky,category_custom_views: ctx['category_custom_views'],search: ctx['search']}, key + \`__2\`, node, ctx, null); - const b27 = comp2({bundles: ctx['bundles'].dev,search: ctx['search']}, key + \`__3\`, node, ctx, null); + const b26 = comp1({bundles: ctx['bundles'].sticky,category_custom_views: ctx['category_custom_views'],search: ctx['search']}, key + \`__2\`, node, this, null); + const b27 = comp2({bundles: ctx['bundles'].dev,search: ctx['search']}, key + \`__3\`, node, this, null); b25 = block25([], [b26, b27]); } return block1([attr1, txt1, hdlr2, hdlr3, attr8, hdlr4, hdlr5, ref1, hdlr6, ref2], [b2, b4, b14, b17, b22, b23, b24, b25]); diff --git a/tests/compiler/__snapshots__/t_esc.test.ts.snap b/tests/compiler/__snapshots__/t_esc.test.ts.snap index 9d4f0a9d..b0263bd7 100644 --- a/tests/compiler/__snapshots__/t_esc.test.ts.snap +++ b/tests/compiler/__snapshots__/t_esc.test.ts.snap @@ -126,7 +126,7 @@ exports[`t-esc t-esc is escaped 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`var\`] = new LazyValue(value1, ctx, node); + ctx[\`var\`] = new LazyValue(value1, ctx, this, node); let txt1 = ctx['var']; return block1([txt1]); } diff --git a/tests/compiler/__snapshots__/t_out.test.ts.snap b/tests/compiler/__snapshots__/t_out.test.ts.snap index c1bfd046..61fa4789 100644 --- a/tests/compiler/__snapshots__/t_out.test.ts.snap +++ b/tests/compiler/__snapshots__/t_out.test.ts.snap @@ -161,7 +161,7 @@ exports[`t-out t-out bdom 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`var\`] = new LazyValue(value1, ctx, node); + ctx[\`var\`] = new LazyValue(value1, ctx, this, node); const b3 = safeOutput(ctx['var']); return block1([], [b3]); } @@ -310,7 +310,7 @@ exports[`t-out t-out switch markup on bdom 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 let b3,b5; - ctx[\`bdom\`] = new LazyValue(value1, ctx, node); + ctx[\`bdom\`] = new LazyValue(value1, ctx, this, node); if (ctx['hasBdom']) { const b4 = safeOutput(ctx['bdom']); b3 = block3([], [b4]); diff --git a/tests/compiler/__snapshots__/t_set.test.ts.snap b/tests/compiler/__snapshots__/t_set.test.ts.snap index 2bb733dc..b4e20c90 100644 --- a/tests/compiler/__snapshots__/t_set.test.ts.snap +++ b/tests/compiler/__snapshots__/t_set.test.ts.snap @@ -106,7 +106,7 @@ exports[`t-set set from body literal (with t-if/t-else 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`value\`] = new LazyValue(value1, ctx, node); + ctx[\`value\`] = new LazyValue(value1, ctx, this, node); return text(ctx['value']); } }" @@ -142,7 +142,7 @@ exports[`t-set set from body lookup 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`stuff\`] = new LazyValue(value1, ctx, node); + ctx[\`stuff\`] = new LazyValue(value1, ctx, this, node); let txt1 = ctx['stuff']; return block1([txt1]); } @@ -206,7 +206,7 @@ exports[`t-set t-set body is evaluated immediately 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"v1\\", 'before'); - ctx[\`v2\`] = new LazyValue(value1, ctx, node); + ctx[\`v2\`] = new LazyValue(value1, ctx, this, node); setContextValue(ctx, \\"v1\\", 'after'); const b3 = safeOutput(ctx['v2']); return block1([], [b3]); @@ -471,7 +471,7 @@ exports[`t-set t-set with content and sub t-esc 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`setvar\`] = new LazyValue(value1, ctx, node); + ctx[\`setvar\`] = new LazyValue(value1, ctx, this, node); let txt1 = ctx['setvar']; return block1([txt1]); } @@ -497,7 +497,7 @@ exports[`t-set t-set with t-value (falsy) and body 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"v3\\", false); setContextValue(ctx, \\"v1\\", 'before'); - ctx[\`v2\`] = withDefault(ctx['v3'], new LazyValue(value1, ctx, node)); + ctx[\`v2\`] = withDefault(ctx['v3'], new LazyValue(value1, ctx, this, node)); setContextValue(ctx, \\"v1\\", 'after'); setContextValue(ctx, \\"v3\\", true); const b3 = safeOutput(ctx['v2']); @@ -525,7 +525,7 @@ exports[`t-set t-set with t-value (truthy) and body 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"v3\\", 'Truthy'); setContextValue(ctx, \\"v1\\", 'before'); - ctx[\`v2\`] = withDefault(ctx['v3'], new LazyValue(value1, ctx, node)); + ctx[\`v2\`] = withDefault(ctx['v3'], new LazyValue(value1, ctx, this, node)); setContextValue(ctx, \\"v1\\", 'after'); setContextValue(ctx, \\"v3\\", false); const b3 = safeOutput(ctx['v2']); @@ -615,7 +615,7 @@ exports[`t-set value priority (with non text body 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`value\`] = withDefault(1, new LazyValue(value1, ctx, node)); + ctx[\`value\`] = withDefault(1, new LazyValue(value1, ctx, this, node)); let txt1 = ctx['value']; return block1([txt1]); } diff --git a/tests/components/__snapshots__/basics.test.ts.snap b/tests/components/__snapshots__/basics.test.ts.snap index ee22d617..c0adbd3f 100644 --- a/tests/components/__snapshots__/basics.test.ts.snap +++ b/tests/components/__snapshots__/basics.test.ts.snap @@ -8,7 +8,7 @@ exports[`basics GrandChild display is controlled by its GrandParent 1`] = ` return function template(ctx, node, key = \\"\\") { const Comp1 = ctx['myComp']; - return toggler(Comp1, comp1({displayGrandChild: ctx['displayGrandChild']}, key + \`__1\`, node, ctx, Comp1)); + return toggler(Comp1, comp1({displayGrandChild: ctx['displayGrandChild']}, key + \`__1\`, node, this, Comp1)); } }" `; @@ -22,7 +22,7 @@ exports[`basics GrandChild display is controlled by its GrandParent 2`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['props'].displayGrandChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -66,7 +66,7 @@ exports[`basics a class component inside a class component, no external dom 1`] const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -106,7 +106,7 @@ exports[`basics a component inside a component 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -150,7 +150,7 @@ exports[`basics can handle empty props 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({val: undefined}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: undefined}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -268,7 +268,7 @@ exports[`basics child can be updated 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].counter}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].counter}, key + \`__1\`, node, this, null); } }" `; @@ -305,7 +305,7 @@ exports[`basics class parent, class child component with props 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: 42}, key + \`__1\`, node, ctx, null); + return comp1({value: 42}, key + \`__1\`, node, this, null); } }" `; @@ -333,7 +333,7 @@ exports[`basics component children doesn't leak (if case) 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['ifVar']) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -361,7 +361,7 @@ exports[`basics component children doesn't leak (t-key case) 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['keyVar']; - return toggler(tKey_1, comp1({}, tKey_1 + key + \`__1\`, node, ctx, null)); + return toggler(tKey_1, comp1({}, tKey_1 + key + \`__1\`, node, this, null)); } }" `; @@ -427,7 +427,7 @@ exports[`basics higher order components parent and child 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({child: ctx['state'].child}, key + \`__1\`, node, ctx, null); + return comp1({child: ctx['state'].child}, key + \`__1\`, node, this, null); } }" `; @@ -442,9 +442,9 @@ exports[`basics higher order components parent and child 2`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3; if (ctx['props'].child==='a') { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } else { - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); } return multi([b2, b3]); } @@ -494,8 +494,8 @@ exports[`basics list of two sub components inside other nodes 1`] = ` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`blip\`] = v_block2[i1]; const key1 = ctx['blip'].id; - const b4 = comp1({}, key + \`__1__\${key1}\`, node, ctx, null); - const b5 = comp2({}, key + \`__2__\${key1}\`, node, ctx, null); + const b4 = comp1({}, key + \`__1__\${key1}\`, node, this, null); + const b5 = comp2({}, key + \`__2__\${key1}\`, node, this, null); c_block2[i1] = withKey(block3([], [b4, b5]), key1); } const b2 = list(c_block2); @@ -524,7 +524,7 @@ exports[`basics parent, child and grandchild 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -536,7 +536,7 @@ exports[`basics parent, child and grandchild 2`] = ` const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -603,9 +603,9 @@ exports[`basics reconciliation alg is not confused in some specific situation 1` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); const tKey_1 = 4; - const b3 = toggler(tKey_1, comp2({}, tKey_1 + key + \`__2\`, node, ctx, null)); + const b3 = toggler(tKey_1, comp2({}, tKey_1 + key + \`__2\`, node, this, null)); return block1([], [b2, b3]); } }" @@ -631,7 +631,7 @@ exports[`basics rerendering a widget with a sub widget 1`] = ` const comp1 = app.createComponent(\`Counter\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -663,9 +663,9 @@ exports[`basics same t-keys in two different places 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = 1; - const b2 = toggler(tKey_1, comp1({blip: '1'}, tKey_1 + key + \`__1\`, node, ctx, null)); + const b2 = toggler(tKey_1, comp1({blip: '1'}, tKey_1 + key + \`__1\`, node, this, null)); const tKey_2 = 1; - const b3 = toggler(tKey_2, comp2({blip: '2'}, tKey_2 + key + \`__2\`, node, ctx, null)); + const b3 = toggler(tKey_2, comp2({blip: '2'}, tKey_2 + key + \`__2\`, node, this, null)); return block1([], [b2, b3]); } }" @@ -744,7 +744,7 @@ exports[`basics sub components between t-ifs 1`] = ` } else { b3 = block3(); } - b4 = comp1({}, key + \`__1\`, node, ctx, null); + b4 = comp1({}, key + \`__1\`, node, this, null); if (ctx['state'].flag) { b5 = block5(); } @@ -780,7 +780,7 @@ exports[`basics t-elif works with t-component 1`] = ` if (ctx['state'].flag) { b2 = block2(); } else if (!ctx['state'].flag) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -814,7 +814,7 @@ exports[`basics t-else with empty string works with t-component 1`] = ` if (ctx['state'].flag) { b2 = block2(); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -848,7 +848,7 @@ exports[`basics t-else works with t-component 1`] = ` if (ctx['state'].flag) { b2 = block2(); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -879,7 +879,7 @@ exports[`basics t-if works with t-component 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -912,9 +912,9 @@ exports[`basics t-key on a component with t-if, and a sibling component 1`] = ` let b2,b3; if (false) { const tKey_1 = 'str'; - b2 = toggler(tKey_1, comp1({}, tKey_1 + key + \`__1\`, node, ctx, null)); + b2 = toggler(tKey_1, comp1({}, tKey_1 + key + \`__1\`, node, this, null)); } - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); return block1([], [b2, b3]); } }" @@ -944,7 +944,7 @@ exports[`basics text after a conditional component 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } let txt1 = ctx['state'].text; return block1([txt1], [b2]); @@ -972,7 +972,7 @@ exports[`basics three level of components with collapsing root nodes 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -984,7 +984,7 @@ exports[`basics three level of components with collapsing root nodes 2`] = ` const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -1010,8 +1010,8 @@ exports[`basics two child components 1`] = ` const comp2 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); - const b3 = comp2({}, key + \`__2\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); + const b3 = comp2({}, key + \`__2\`, node, this, null); return multi([b2, b3]); } }" @@ -1040,7 +1040,7 @@ exports[`basics update props of component without concrete own node 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['childProps'].key; - const b2 = toggler(tKey_1, comp1(Object.assign({}, ctx['childProps']), tKey_1 + key + \`__1\`, node, ctx, null)); + const b2 = toggler(tKey_1, comp1(Object.assign({}, ctx['childProps']), tKey_1 + key + \`__1\`, node, this, null)); return block1([], [b2]); } }" @@ -1054,7 +1054,7 @@ exports[`basics update props of component without concrete own node 2`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['props'].subKey; - return toggler(tKey_1, comp1({key: ctx['props'].key,subKey: ctx['props'].subKey}, tKey_1 + key + \`__1\`, node, ctx, null)); + return toggler(tKey_1, comp1({key: ctx['props'].key,subKey: ctx['props'].subKey}, tKey_1 + key + \`__1\`, node, this, null)); } }" `; @@ -1100,7 +1100,7 @@ exports[`basics updating widget immediately 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({flag: ctx['state'].flag}, key + \`__1\`, node, ctx, null); + return comp1({flag: ctx['state'].flag}, key + \`__1\`, node, this, null); } }" `; @@ -1142,7 +1142,7 @@ exports[`basics widget after a t-foreach 1`] = ` } ctx = ctx.__proto__; const b2 = list(c_block2); - const b4 = comp1({}, key + \`__1\`, node, ctx, null); + const b4 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2, b4]); } }" @@ -1170,7 +1170,7 @@ exports[`basics zero or one child components 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -1251,7 +1251,7 @@ exports[`support svg components add proper namespace to svg 1`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/concurrency.test.ts.snap b/tests/components/__snapshots__/concurrency.test.ts.snap index 12decd86..18df8e4c 100644 --- a/tests/components/__snapshots__/concurrency.test.ts.snap +++ b/tests/components/__snapshots__/concurrency.test.ts.snap @@ -8,7 +8,7 @@ exports[`Cascading renders after microtaskTick 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); const b3 = text(\` _ \`); ctx = Object.create(ctx); const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['state']);; @@ -36,7 +36,7 @@ exports[`Cascading renders after microtaskTick 2`] = ` for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`elem\`] = v_block1[i1]; const key1 = ctx['elem'].id; - c_block1[i1] = withKey(comp1({id: ctx['elem'].id}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block1[i1] = withKey(comp1({id: ctx['elem'].id}, key + \`__1__\${key1}\`, node, this, null), key1); } return list(c_block1); } @@ -64,7 +64,7 @@ exports[`another scenario with delayed rendering 1`] = ` let b2,b3; b2 = text(\`A\`); if (ctx['state'].value<15) { - b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -79,7 +79,7 @@ exports[`another scenario with delayed rendering 2`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['props'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -121,7 +121,7 @@ exports[`calling render in destroy 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - return toggler(tKey_1, comp1({fromA: ctx['state']}, tKey_1 + key + \`__1\`, node, ctx, null)); + return toggler(tKey_1, comp1({fromA: ctx['state']}, tKey_1 + key + \`__1\`, node, this, null)); } }" `; @@ -133,7 +133,7 @@ exports[`calling render in destroy 2`] = ` const comp1 = app.createComponent(\`C\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx, null); + return comp1({fromA: ctx['props'].fromA}, key + \`__1\`, node, this, null); } }" `; @@ -177,7 +177,7 @@ exports[`changing state before first render does not trigger a render (with pare return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -221,7 +221,7 @@ exports[`concurrent renderings scenario 1 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -236,7 +236,7 @@ exports[`concurrent renderings scenario 1 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA,fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA,fromB: ctx['state'].fromB}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -267,7 +267,7 @@ exports[`concurrent renderings scenario 2 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].fromA; - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([txt1], [b2]); } }" @@ -282,7 +282,7 @@ exports[`concurrent renderings scenario 2 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA,fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA,fromB: ctx['state'].fromB}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -312,7 +312,7 @@ exports[`concurrent renderings scenario 2bis 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -327,7 +327,7 @@ exports[`concurrent renderings scenario 2bis 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA,fromB: ctx['state'].fromB}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA,fromB: ctx['state'].fromB}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -357,7 +357,7 @@ exports[`concurrent renderings scenario 3 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -372,7 +372,7 @@ exports[`concurrent renderings scenario 3 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -387,7 +387,7 @@ exports[`concurrent renderings scenario 3 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA,fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA,fromC: ctx['state'].fromC}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -417,7 +417,7 @@ exports[`concurrent renderings scenario 4 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -432,7 +432,7 @@ exports[`concurrent renderings scenario 4 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -447,7 +447,7 @@ exports[`concurrent renderings scenario 4 3`] = ` let block1 = createBlock(\`\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA,fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA,fromC: ctx['state'].fromC}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -477,7 +477,7 @@ exports[`concurrent renderings scenario 5 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -506,7 +506,7 @@ exports[`concurrent renderings scenario 6 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -535,7 +535,7 @@ exports[`concurrent renderings scenario 7 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -565,7 +565,7 @@ exports[`concurrent renderings scenario 8 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -597,8 +597,8 @@ exports[`concurrent renderings scenario 9 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].fromA; - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); - const b3 = comp2({fromA: ctx['state'].fromA}, key + \`__2\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); + const b3 = comp2({fromA: ctx['state'].fromA}, key + \`__2\`, node, this, null); return block1([txt1], [b2, b3]); } }" @@ -627,7 +627,7 @@ exports[`concurrent renderings scenario 9 3`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['props'].fromA,fromC: ctx['state'].fromC}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['props'].fromA,fromC: ctx['state'].fromC}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -657,7 +657,7 @@ exports[`concurrent renderings scenario 10 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + const b2 = comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -674,7 +674,7 @@ exports[`concurrent renderings scenario 10 2`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({value: ctx['props'].value}, key + \`__1\`, node, ctx, null); + b2 = comp1({value: ctx['props'].value}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -704,7 +704,7 @@ exports[`concurrent renderings scenario 11 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -734,7 +734,7 @@ exports[`concurrent renderings scenario 12 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({val: ctx['val']}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['val']}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -765,9 +765,9 @@ exports[`concurrent renderings scenario 13 1`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3; - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); if (ctx['state'].bool) { - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); } return block1([], [b2, b3]); } @@ -797,7 +797,7 @@ exports[`concurrent renderings scenario 14 1`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -812,7 +812,7 @@ exports[`concurrent renderings scenario 14 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromB: ctx['state'].fromB,fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromB: ctx['state'].fromB,fromA: ctx['props'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -843,7 +843,7 @@ exports[`concurrent renderings scenario 15 1`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -858,7 +858,7 @@ exports[`concurrent renderings scenario 15 2`] = ` let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({fromB: ctx['state'].fromB,fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({fromB: ctx['state'].fromB,fromA: ctx['props'].fromA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -887,7 +887,7 @@ exports[`concurrent renderings scenario 16 1`] = ` const comp1 = app.createComponent(\`B\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, ctx, null); + return comp1({fromA: ctx['state'].fromA}, key + \`__1\`, node, this, null); } }" `; @@ -899,7 +899,7 @@ exports[`concurrent renderings scenario 16 2`] = ` const comp1 = app.createComponent(\`C\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({fromB: ctx['state'].fromB,fromA: ctx['props'].fromA}, key + \`__1\`, node, ctx, null); + return comp1({fromB: ctx['state'].fromB,fromA: ctx['props'].fromA}, key + \`__1\`, node, this, null); } }" `; @@ -919,7 +919,7 @@ exports[`concurrent renderings scenario 16 3`] = ` b6 = text(ctx['state'].fromC); b7 = text(\`: \`); if (ctx['state'].fromC===13) { - b8 = comp1({}, key + \`__1\`, node, ctx, null); + b8 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2, b3, b4, b5, b6, b7, b8]); } @@ -947,10 +947,10 @@ exports[`creating two async components, scenario 1 1`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3; if (ctx['state'].flagA) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } if (ctx['state'].flagB) { - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); } return multi([b2, b3]); } @@ -995,9 +995,9 @@ exports[`creating two async components, scenario 2 1`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3; - b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, ctx, null); + b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, this, null); if (ctx['state'].flagB) { - b3 = comp2({val: ctx['state'].valB}, key + \`__2\`, node, ctx, null); + b3 = comp2({val: ctx['state'].valB}, key + \`__2\`, node, this, null); } return block1([], [b2, b3]); } @@ -1043,9 +1043,9 @@ exports[`creating two async components, scenario 3 (patching in the same frame) return function template(ctx, node, key = \\"\\") { let b2,b3; - b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, ctx, null); + b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, this, null); if (ctx['state'].flagB) { - b3 = comp2({val: ctx['state'].valB}, key + \`__2\`, node, ctx, null); + b3 = comp2({val: ctx['state'].valB}, key + \`__2\`, node, this, null); } return block1([], [b2, b3]); } @@ -1087,7 +1087,7 @@ exports[`delay willUpdateProps 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1113,7 +1113,7 @@ exports[`delay willUpdateProps with rendering grandchild 1`] = ` const comp1 = app.createComponent(\`Parent\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({state: ctx['state']}, key + \`__1\`, node, ctx, null); + return comp1({state: ctx['state']}, key + \`__1\`, node, this, null); } }" `; @@ -1126,8 +1126,8 @@ exports[`delay willUpdateProps with rendering grandchild 2`] = ` const comp2 = app.createComponent(\`ReactiveChild\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({value: ctx['props'].state.value}, key + \`__1\`, node, ctx, null); - const b3 = comp2({}, key + \`__2\`, node, ctx, null); + const b2 = comp1({value: ctx['props'].state.value}, key + \`__1\`, node, this, null); + const b3 = comp2({}, key + \`__2\`, node, this, null); return multi([b2, b3]); } }" @@ -1168,7 +1168,7 @@ exports[`delayed fiber does not get rendered if it was cancelled 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(\`A\`); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -1182,7 +1182,7 @@ exports[`delayed fiber does not get rendered if it was cancelled 2`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(\`B\`); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -1196,7 +1196,7 @@ exports[`delayed fiber does not get rendered if it was cancelled 3`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(\`C\`); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -1220,7 +1220,7 @@ exports[`delayed rendering, but then initial rendering is cancelled by yet anoth const comp1 = app.createComponent(\`B\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1232,7 +1232,7 @@ exports[`delayed rendering, but then initial rendering is cancelled by yet anoth const comp1 = app.createComponent(\`C\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].someValue+ctx['props'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].someValue+ctx['props'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1246,7 +1246,7 @@ exports[`delayed rendering, but then initial rendering is cancelled by yet anoth let block3 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); let txt1 = ctx['props'].value; const b3 = block3([txt1]); return multi([b2, b3]); @@ -1277,7 +1277,7 @@ exports[`delayed rendering, destruction, stuff happens 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(\`A\`); - const b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + const b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -1293,7 +1293,7 @@ exports[`delayed rendering, destruction, stuff happens 2`] = ` let b2,b3; b2 = text(\`B\`); if (ctx['state'].hasChild) { - b3 = comp1({value: ctx['state'].someValue+ctx['props'].value}, key + \`__1\`, node, ctx, null); + b3 = comp1({value: ctx['state'].someValue+ctx['props'].value}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -1310,7 +1310,7 @@ exports[`delayed rendering, destruction, stuff happens 3`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(\`C\`); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); let txt1 = ctx['props'].value; const b4 = block4([txt1]); return multi([b2, b3, b4]); @@ -1342,7 +1342,7 @@ exports[`delayed rendering, reusing fiber and stuff 1`] = ` const comp1 = app.createComponent(\`B\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1355,7 +1355,7 @@ exports[`delayed rendering, reusing fiber and stuff 2`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['props'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -1386,7 +1386,7 @@ exports[`delayed rendering, reusing fiber then component is destroyed and stuff let b2,b3; b2 = text(\`A\`); if (ctx['state'].value<15) { - b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -1401,7 +1401,7 @@ exports[`delayed rendering, reusing fiber then component is destroyed and stuff return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['props'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -1429,7 +1429,7 @@ exports[`delayed rendering, then component is destroyed and stuff 1`] = ` const comp1 = app.createComponent(\`B\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1444,7 +1444,7 @@ exports[`delayed rendering, then component is destroyed and stuff 2`] = ` let b2,b3; b2 = text(ctx['props'].value); if (ctx['props'].value<10) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -1477,8 +1477,8 @@ exports[`destroyed component causes other soon to be destroyed component to rere let b2,b3; b2 = text(\` A \`); if (ctx['state'].flag) { - const b4 = comp1({value: ctx['state'].valueB}, key + \`__1\`, node, ctx, null); - const b5 = comp2({value: ctx['state'].valueC}, key + \`__2\`, node, ctx, null); + const b4 = comp1({value: ctx['state'].valueB}, key + \`__1\`, node, this, null); + const b5 = comp2({value: ctx['state'].valueC}, key + \`__2\`, node, this, null); b3 = multi([b4, b5]); } return multi([b2, b3]); @@ -1518,7 +1518,7 @@ exports[`destroying/recreating a subcomponent, other scenario 1`] = ` let b2,b3; b2 = text(\`parent\`); if (ctx['state'].hasChild) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -1547,7 +1547,7 @@ exports[`destroying/recreating a subwidget with different props (if start is not return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].val>1) { - b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -1575,7 +1575,7 @@ exports[`parent and child rendered at exact same time 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1602,7 +1602,7 @@ exports[`properly behave when destroyed/unmounted while rendering 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -1618,7 +1618,7 @@ exports[`properly behave when destroyed/unmounted while rendering 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({val: ctx['props'].val}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['props'].val}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1649,7 +1649,7 @@ exports[`rendering component again in next microtick 1`] = ` let b2; let hdlr1 = [ctx['onClick'], ctx]; if (ctx['env'].config.flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([hdlr1], [b2]); } @@ -1676,7 +1676,7 @@ exports[`rendering parent twice, with different props on child and stuff 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1701,8 +1701,8 @@ exports[`renderings, destruction, patch, stuff, ... yet another variation 1`] = return function template(ctx, node, key = \\"\\") { const b2 = text(\`A\`); - const b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); - const b4 = comp2({}, key + \`__2\`, node, ctx, null); + const b3 = comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); + const b4 = comp2({}, key + \`__2\`, node, this, null); return multi([b2, b3, b4]); } }" @@ -1718,7 +1718,7 @@ exports[`renderings, destruction, patch, stuff, ... yet another variation 2`] = let b2,b3; b2 = text(\`B\`); if (ctx['props'].value===33) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -1776,7 +1776,7 @@ exports[`t-foreach with dynamic async component 1`] = ` let b3; if (ctx['arr']) { const Comp1 = ctx['myComp']; - b3 = toggler(Comp1, comp1({key: ctx['arr'][0]}, key + \`__1__\${key1}\`, node, ctx, Comp1)); + b3 = toggler(Comp1, comp1({key: ctx['arr'][0]}, key + \`__1__\${key1}\`, node, this, Comp1)); } c_block1[i1] = withKey(multi([b3]), key1); } @@ -1810,7 +1810,7 @@ exports[`t-key on dom node having a component 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; const Comp1 = ctx['myComp']; - const b2 = toggler(tKey_1, toggler(Comp1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, Comp1))); + const b2 = toggler(tKey_1, toggler(Comp1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, Comp1))); return toggler(tKey_1, block1([], [b2])); } }" @@ -1836,7 +1836,7 @@ exports[`t-key on dynamic async component (toggler is never patched) 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; const Comp1 = ctx['myComp']; - return toggler(tKey_1, toggler(Comp1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, Comp1))); + return toggler(tKey_1, toggler(Comp1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, Comp1))); } }" `; @@ -1867,7 +1867,7 @@ exports[`two renderings initiated between willPatch and patched 1`] = ` let b2; if (ctx['state'].flag) { const tKey_1 = 'panel_'+ctx['state'].panel; - b2 = toggler(tKey_1, comp1({val: ctx['state'].panel}, tKey_1 + key + \`__1\`, node, ctx, null)); + b2 = toggler(tKey_1, comp1({val: ctx['state'].panel}, tKey_1 + key + \`__1\`, node, this, null)); } return block1([], [b2]); } @@ -1896,7 +1896,7 @@ exports[`two sequential renderings before an animation frame 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -1921,7 +1921,7 @@ exports[`update a sub-component twice in the same frame 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1950,7 +1950,7 @@ exports[`update a sub-component twice in the same frame, 2 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['state'].valA}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/error_handling.test.ts.snap b/tests/components/__snapshots__/error_handling.test.ts.snap index 15586fb1..bd70be30 100644 --- a/tests/components/__snapshots__/error_handling.test.ts.snap +++ b/tests/components/__snapshots__/error_handling.test.ts.snap @@ -7,7 +7,7 @@ exports[`basics display a nice error if a component is not a component 1`] = ` const comp1 = app.createComponent(\`SomeComponent\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -21,7 +21,7 @@ exports[`basics display a nice error if it cannot find component (in dev mode) 1 return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SomeMispelledComponent\`, props1, ctx); - return comp1(props1, key + \`__1\`, node, ctx, null); + return comp1(props1, key + \`__1\`, node, this, null); } }" `; @@ -33,7 +33,7 @@ exports[`basics display a nice error if it cannot find component 1`] = ` const comp1 = app.createComponent(\`SomeMispelledComponent\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -47,7 +47,7 @@ exports[`basics no component catching error lead to full app destruction 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({flag: ctx['state'].flag}, key + \`__1\`, node, ctx, null); + const b2 = comp1({flag: ctx['state'].flag}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -80,7 +80,7 @@ exports[`basics simple catchError 1`] = ` if (ctx['error']) { b2 = text(\`Error\`); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -111,7 +111,7 @@ exports[`can catch errors an error in onWillDestroy 1`] = ` let b2,b3; b2 = text(ctx['state'].value); if (ctx['state'].hasChild) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -141,7 +141,7 @@ exports[`can catch errors an error in onWillDestroy, variation 1`] = ` let b2,b3; b2 = text(ctx['state'].value); if (ctx['state'].hasChild) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2, b3]); } @@ -183,11 +183,11 @@ exports[`can catch errors can catch an error in a component render function 1`] let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({flag: ctx['state'].flag}, key + \`__1\`, node, ctx, null); + return comp1({flag: ctx['state'].flag}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -238,11 +238,11 @@ exports[`can catch errors can catch an error in the constructor call of a compon let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -280,13 +280,13 @@ exports[`can catch errors can catch an error in the constructor call of a compon let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - const b3 = comp1({}, key + \`__1\`, node, ctx, null); - const b4 = comp2({}, key + \`__2\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); + const b4 = comp2({}, key + \`__2\`, node, this, null); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { - const b5 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx, null); + const b5 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, this, null); return block1([], [b5]); } }" @@ -362,11 +362,11 @@ exports[`can catch errors can catch an error in the initial call of a component let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -417,13 +417,13 @@ exports[`can catch errors can catch an error in the initial call of a component let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { let b3; if (ctx['state'].flag) { - b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); } return block1([], [b3]); } @@ -471,7 +471,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch const comp1 = app.createComponent(\`B\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -485,7 +485,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -504,7 +504,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch if (ctx['state'].error) { b2 = text(\`Error handled\`); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -537,7 +537,7 @@ exports[`can catch errors can catch an error in the mounted call (in root compon if (ctx['state'].error) { b2 = text(\`Error handled\`); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -568,11 +568,11 @@ exports[`can catch errors can catch an error in the mounted call 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -622,12 +622,12 @@ exports[`can catch errors can catch an error in the willPatch call 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({message: ctx['state'].message}, key + \`__1\`, node, ctx, null); + return comp1({message: ctx['state'].message}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].message; - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([txt1], [b3]); } }" @@ -678,11 +678,11 @@ exports[`can catch errors can catch an error in the willStart call 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -733,13 +733,13 @@ exports[`can catch errors can catch an error origination from a child's willStar let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - const b3 = comp1({}, key + \`__1\`, node, ctx, null); - const b4 = comp2({}, key + \`__2\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); + const b4 = comp2({}, key + \`__2\`, node, this, null); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { - const b5 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx, null); + const b5 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, this, null); return block1([], [b5]); } }" @@ -804,7 +804,7 @@ exports[`can catch errors catchError in catchError 1`] = ` if (ctx['error']) { b2 = text(\`Error\`); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -820,7 +820,7 @@ exports[`can catch errors catchError in catchError 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -850,7 +850,7 @@ exports[`can catch errors catching error, rethrow, render parent -- a main comp function slot1(ctx, node, key = \\"\\") { const Comp1 = ctx['cp'].Comp; - return toggler(Comp1, comp1({}, key + \`__1\`, node, ctx, Comp1)); + return toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1)); } return function template(ctx, node, key = \\"\\") { @@ -861,7 +861,7 @@ exports[`can catch errors catching error, rethrow, render parent -- a main comp const key1 = ctx['cp'].id; const v1 = ctx['cp']; const ctx1 = capture(ctx); - c_block1[i1] = withKey(comp2({onError: ()=>this.cleanUp(v1.id),slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2__\${key1}\`, node, ctx, null), key1); + c_block1[i1] = withKey(comp2({onError: ()=>this.cleanUp(v1.id),slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2__\${key1}\`, node, this, null), key1); } return list(c_block1); } @@ -887,7 +887,7 @@ exports[`can catch errors catching error, rethrow, render parent -- a main comp const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -928,7 +928,7 @@ exports[`can catch errors catching in child makes parent render 1`] = ` function slot1(ctx, node, key = \\"\\") { const Comp1 = ctx['elem'][1]; - return toggler(Comp1, comp1({id: ctx['elem'][0]}, key + \`__1\`, node, ctx, Comp1)); + return toggler(Comp1, comp1({id: ctx['elem'][0]}, key + \`__1\`, node, this, Comp1)); } return function template(ctx, node, key = \\"\\") { @@ -939,7 +939,7 @@ exports[`can catch errors catching in child makes parent render 1`] = ` const key1 = ctx['elem'][0]; const v1 = ctx['elem']; const ctx1 = capture(ctx); - c_block1[i1] = withKey(comp2({onError: (_error)=>this.onError(v1[0],_error),slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2__\${key1}\`, node, ctx, null), key1); + c_block1[i1] = withKey(comp2({onError: (_error)=>this.onError(v1[0],_error),slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2__\${key1}\`, node, this, null), key1); } return list(c_block1); } @@ -997,12 +997,12 @@ exports[`can catch errors error in mounted on a component with a sibling (proper let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp2({}, key + \`__2\`, node, ctx, null); + return comp2({}, key + \`__2\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); - const b4 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); + const b4 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, this, null); return block1([], [b2, b4]); } }" @@ -1059,7 +1059,7 @@ exports[`can catch errors onError in class inheritance is called if rethrown 1`] const comp1 = app.createComponent(\`Concrete\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -1090,7 +1090,7 @@ exports[`can catch errors onError in class inheritance is not called if no rethr const comp1 = app.createComponent(\`Concrete\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -1123,7 +1123,7 @@ exports[`errors and promises a rendering error in a sub component will reject th let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1166,7 +1166,7 @@ exports[`errors and promises a rendering error will reject the render promise (w let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); let txt1 = ctx['x'].y; return block1([txt1], [b2]); } diff --git a/tests/components/__snapshots__/event_handling.test.ts.snap b/tests/components/__snapshots__/event_handling.test.ts.snap index 49f9a575..579a1a49 100644 --- a/tests/components/__snapshots__/event_handling.test.ts.snap +++ b/tests/components/__snapshots__/event_handling.test.ts.snap @@ -38,7 +38,7 @@ exports[`event handling handler receive the event as argument 1`] = ` return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['inc'], ctx]; - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); let txt1 = ctx['state'].value; return block1([hdlr1, txt1], [b2]); } @@ -69,7 +69,7 @@ exports[`event handling input blur event is not called if component is destroyed return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].cond) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } diff --git a/tests/components/__snapshots__/higher_order_component.test.ts.snap b/tests/components/__snapshots__/higher_order_component.test.ts.snap index aa8fc709..dd69227b 100644 --- a/tests/components/__snapshots__/higher_order_component.test.ts.snap +++ b/tests/components/__snapshots__/higher_order_component.test.ts.snap @@ -7,7 +7,7 @@ exports[`basics basic use 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({p: 1}, key + \`__1\`, node, ctx, null); + return comp1({p: 1}, key + \`__1\`, node, this, null); } }" `; @@ -36,10 +36,10 @@ exports[`basics can select a sub widget 1`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3; if (ctx['env'].options.flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } if (!ctx['env'].options.flag) { - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); } return multi([b2, b3]); } @@ -82,10 +82,10 @@ exports[`basics can select a sub widget, part 2 1`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } if (!ctx['state'].flag) { - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); } return multi([b2, b3]); } @@ -125,7 +125,7 @@ exports[`basics sub widget is interactive 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({p: 1}, key + \`__1\`, node, ctx, null); + return comp1({p: 1}, key + \`__1\`, node, this, null); } }" `; @@ -154,7 +154,7 @@ exports[`basics top level sub widget with a parent 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -167,7 +167,7 @@ exports[`basics top level sub widget with a parent 2`] = ` const comp1 = app.createComponent(\`ComponentC\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/hooks.test.ts.snap b/tests/components/__snapshots__/hooks.test.ts.snap index a1c42fb7..102c1afd 100644 --- a/tests/components/__snapshots__/hooks.test.ts.snap +++ b/tests/components/__snapshots__/hooks.test.ts.snap @@ -44,7 +44,7 @@ exports[`hooks can use onWillStart, onWillUpdateProps 1`] = ` const comp1 = app.createComponent(\`MyComponent\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -112,7 +112,7 @@ exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['env'].val); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -144,7 +144,7 @@ exports[`hooks parent and child env (with useChildSubEnv) 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['env'].val); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -172,7 +172,7 @@ exports[`hooks parent and child env (with useSubEnv) 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['env'].val); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -227,7 +227,7 @@ exports[`hooks useChildSubEnv supports arbitrary descriptor 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -328,7 +328,7 @@ exports[`hooks useExternalListener 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -386,7 +386,7 @@ exports[`hooks useSubEnv supports arbitrary descriptor 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/lifecycle.test.ts.snap b/tests/components/__snapshots__/lifecycle.test.ts.snap index 1bb2a9ed..5418cbf3 100644 --- a/tests/components/__snapshots__/lifecycle.test.ts.snap +++ b/tests/components/__snapshots__/lifecycle.test.ts.snap @@ -23,8 +23,8 @@ exports[`lifecycle hooks component semantics 1`] = ` let block1 = createBlock(\`
A
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); - const b3 = comp2({}, key + \`__2\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); + const b3 = comp2({}, key + \`__2\`, node, this, null); return block1([], [b2, b3]); } }" @@ -55,11 +55,11 @@ exports[`lifecycle hooks component semantics 3`] = ` return function template(ctx, node, key = \\"\\") { let b2,b3,b4; - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); if (ctx['state'].flag) { - b3 = comp2({}, key + \`__2\`, node, ctx, null); + b3 = comp2({}, key + \`__2\`, node, this, null); } else { - b4 = comp3({}, key + \`__3\`, node, ctx, null); + b4 = comp3({}, key + \`__3\`, node, this, null); } return block1([], [b2, b3, b4]); } @@ -116,7 +116,7 @@ exports[`lifecycle hooks components are unmounted and destroyed if no longer in return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - const b3 = comp1({n: ctx['state'].n}, key + \`__1\`, node, ctx, null); + const b3 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null); b2 = block2([], [b3]); } return multi([b2]); @@ -147,7 +147,7 @@ exports[`lifecycle hooks components are unmounted destroyed if no longer in DOM return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].ok) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -177,7 +177,7 @@ exports[`lifecycle hooks destroy new children before being mountged 1`] = ` let b2,b3,b4; b2 = text(\`before\`); if (ctx['state'].flag) { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } b4 = text(\`after\`); return multi([b2, b3, b4]); @@ -205,7 +205,7 @@ exports[`lifecycle hooks hooks are called in proper order in widget creation/des let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -231,7 +231,7 @@ exports[`lifecycle hooks lifecycle callbacks are bound to component 1`] = ` const comp1 = app.createComponent(\`Test\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({rev: ctx['rev']}, key + \`__1\`, node, ctx, null); + return comp1({rev: ctx['rev']}, key + \`__1\`, node, this, null); } }" `; @@ -256,7 +256,7 @@ exports[`lifecycle hooks lifecycle semantics 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, ctx, null); + const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -284,7 +284,7 @@ exports[`lifecycle hooks lifecycle semantics, part 2 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -298,7 +298,7 @@ exports[`lifecycle hooks lifecycle semantics, part 2 2`] = ` const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -325,7 +325,7 @@ exports[`lifecycle hooks lifecycle semantics, part 3 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -341,7 +341,7 @@ exports[`lifecycle hooks lifecycle semantics, part 4 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -355,7 +355,7 @@ exports[`lifecycle hooks lifecycle semantics, part 4 2`] = ` const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -382,7 +382,7 @@ exports[`lifecycle hooks lifecycle semantics, part 5 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -409,7 +409,7 @@ exports[`lifecycle hooks lifecycle semantics, part 6 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -449,7 +449,7 @@ exports[`lifecycle hooks mounted hook is called on every mount, not just the fir return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasChild) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -478,7 +478,7 @@ exports[`lifecycle hooks mounted hook is called on subcomponents, in proper orde let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -508,7 +508,7 @@ exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper o return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -524,7 +524,7 @@ exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper o let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -550,7 +550,7 @@ 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, ctx, null); + return comp1({someValue: ctx['state'].value}, key + \`__1\`, node, this, null); } }" `; @@ -579,7 +579,7 @@ exports[`lifecycle hooks patched hook is called after updateProps 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, ctx, null); + const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -663,7 +663,7 @@ exports[`lifecycle hooks sub widget (inside sub node): hooks are correctly calle return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -705,7 +705,7 @@ exports[`lifecycle hooks timeout in onWillUpdateProps emits a warning 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {prop: ctx['state'].prop}; helpers.validateProps(\`Child\`, props1, ctx); - return comp1(props1, key + \`__1\`, node, ctx, null); + return comp1(props1, key + \`__1\`, node, this, null); } }" `; @@ -730,7 +730,7 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({n: ctx['state'].n}, key + \`__1\`, node, ctx, null); + const b2 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -745,7 +745,7 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents, let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({n: ctx['props'].n}, key + \`__1\`, node, ctx, null); + const b2 = comp1({n: ctx['props'].n}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -772,7 +772,7 @@ exports[`lifecycle hooks willStart hook is called on sub component 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -828,7 +828,7 @@ exports[`lifecycle hooks willStart, mounted on subwidget rendered after main is return function template(ctx, node, key = \\"\\") { let b2,b3; if (ctx['state'].ok) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } else { b3 = block3(); } @@ -857,7 +857,7 @@ exports[`lifecycle hooks willUpdateProps hook is called 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({n: ctx['state'].n}, key + \`__1\`, node, ctx, null); + return comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/props.test.ts.snap b/tests/components/__snapshots__/props.test.ts.snap index 7dec1359..ebe50251 100644 --- a/tests/components/__snapshots__/props.test.ts.snap +++ b/tests/components/__snapshots__/props.test.ts.snap @@ -9,7 +9,7 @@ exports[`basics accept ES6-like syntax for props (with getters) 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({greetings: ctx['greetings']}, key + \`__1\`, node, ctx, null); + const b2 = comp1({greetings: ctx['greetings']}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -44,7 +44,7 @@ exports[`basics arrow functions as prop correctly capture their scope 1`] = ` const key1 = ctx['item'].val; const v1 = ctx['onClick']; const v2 = ctx['item']; - c_block1[i1] = withKey(comp1({onClick: _ev=>v1(v2.val,_ev)}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block1[i1] = withKey(comp1({onClick: _ev=>v1(v2.val,_ev)}, key + \`__1__\${key1}\`, node, this, null), key1); } return list(c_block1); } @@ -74,7 +74,7 @@ exports[`basics explicit object prop 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({value: ctx['state'].val}, key + \`__1\`, node, ctx, null); + const b2 = comp1({value: ctx['state'].val}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -101,7 +101,7 @@ exports[`basics prop names can contain - 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({'prop-name': 7}, key + \`__1\`, node, ctx, null); + return comp1({'prop-name': 7}, key + \`__1\`, node, this, null); } }" `; @@ -127,7 +127,7 @@ exports[`basics support prop names that aren't valid bare object property names const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({'some-dashed-prop': 5}, key + \`__1\`, node, ctx, null); + return comp1({'some-dashed-prop': 5}, key + \`__1\`, node, this, null); } }" `; @@ -163,8 +163,8 @@ exports[`basics t-set with a body expression can be passed in props, and then t- return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`abc\`] = new LazyValue(value1, ctx, node); - const b3 = comp1({val: ctx['abc']}, key + \`__1\`, node, ctx, null); + ctx[\`abc\`] = new LazyValue(value1, ctx, this, node); + const b3 = comp1({val: ctx['abc']}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -199,7 +199,7 @@ exports[`basics t-set with a body expression can be used as textual prop 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"abc\\", \`42\`); - const b2 = comp1({val: ctx['abc']}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['abc']}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -232,7 +232,7 @@ exports[`basics t-set works 1`] = ` ctx = Object.create(ctx); ctx[isBoundary] = 1 setContextValue(ctx, \\"val\\", 42); - const b2 = comp1({val: ctx['val']}, key + \`__1\`, node, ctx, null); + const b2 = comp1({val: ctx['val']}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -259,7 +259,7 @@ exports[`basics template string in prop 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({propName: \`1\${ctx['someVal']}3\`}, key + \`__1\`, node, ctx, null); + return comp1({propName: \`1\${ctx['someVal']}3\`}, key + \`__1\`, node, this, null); } }" `; @@ -283,7 +283,7 @@ exports[`bound functions is referentially equal after update 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val,fn: bind(ctx, ctx['someFunction'])}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val,fn: bind(ctx, ctx['someFunction'])}, key + \`__1\`, node, this, null); } }" `; @@ -307,7 +307,7 @@ exports[`can bind function prop with bind suffix 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({doSomething: bind(ctx, ctx['doSomething'])}, key + \`__1\`, node, ctx, null); + return comp1({doSomething: bind(ctx, ctx['doSomething'])}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/props_validation.test.ts.snap b/tests/components/__snapshots__/props_validation.test.ts.snap index 88b843aa..281e3a4c 100644 --- a/tests/components/__snapshots__/props_validation.test.ts.snap +++ b/tests/components/__snapshots__/props_validation.test.ts.snap @@ -9,7 +9,7 @@ exports[`default props a default prop cannot be defined on a mandatory prop 1`] return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`Child\`, props1, ctx); - return comp1(props1, key + \`__1\`, node, ctx, null); + return comp1(props1, key + \`__1\`, node, this, null); } }" `; @@ -25,7 +25,7 @@ exports[`default props can set default boolean values 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -62,7 +62,7 @@ exports[`default props can set default values 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -93,7 +93,7 @@ exports[`default props default values are also set whenever component is updated return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['state'].p}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -122,7 +122,7 @@ exports[`props validation can specify that additional props are allowed (array) return function template(ctx, node, key = \\"\\") { const props1 = {message: 'm',otherProp: 'o'}; helpers.validateProps(\`Child\`, props1, ctx); - return comp1(props1, key + \`__1\`, node, ctx, null); + return comp1(props1, key + \`__1\`, node, this, null); } }" `; @@ -149,7 +149,7 @@ exports[`props validation can specify that additional props are allowed (object) return function template(ctx, node, key = \\"\\") { const props1 = {message: 'm',otherProp: 'o'}; helpers.validateProps(\`Child\`, props1, ctx); - return comp1(props1, key + \`__1\`, node, ctx, null); + return comp1(props1, key + \`__1\`, node, this, null); } }" `; @@ -178,7 +178,7 @@ exports[`props validation can validate a prop with multiple types 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -208,7 +208,7 @@ exports[`props validation can validate a prop with multiple types 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -238,7 +238,7 @@ exports[`props validation can validate a prop with multiple types 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -255,7 +255,7 @@ exports[`props validation can validate an array with given primitive type 1`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -285,7 +285,7 @@ exports[`props validation can validate an array with given primitive type 3`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -315,7 +315,7 @@ exports[`props validation can validate an array with given primitive type 5`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -332,7 +332,7 @@ exports[`props validation can validate an array with given primitive type 6`] = return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -349,7 +349,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -379,7 +379,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -409,7 +409,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -439,7 +439,7 @@ exports[`props validation can validate an array with multiple sub element types return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -456,7 +456,7 @@ exports[`props validation can validate an object with simple shape 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -486,7 +486,7 @@ exports[`props validation can validate an object with simple shape 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -503,7 +503,7 @@ exports[`props validation can validate an object with simple shape 4`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -520,7 +520,7 @@ exports[`props validation can validate an object with simple shape 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -537,7 +537,7 @@ exports[`props validation can validate an optional props 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -567,7 +567,7 @@ exports[`props validation can validate an optional props 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -597,7 +597,7 @@ exports[`props validation can validate an optional props 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -614,7 +614,7 @@ exports[`props validation can validate recursively complicated prop def 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -644,7 +644,7 @@ exports[`props validation can validate recursively complicated prop def 3`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -674,7 +674,7 @@ exports[`props validation can validate recursively complicated prop def 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -691,7 +691,7 @@ exports[`props validation default values are applied before validating props at return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['state'].p}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -722,7 +722,7 @@ exports[`props validation missing required boolean prop causes an error 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -739,7 +739,7 @@ exports[`props validation mix of optional and mandatory 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`Child\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -756,7 +756,7 @@ exports[`props validation props are validated in dev mode (code snapshot) 1`] = return function template(ctx, node, key = \\"\\") { const props1 = {message: 1}; helpers.validateProps(\`Child\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -787,7 +787,7 @@ exports[`props validation props are validated whenever component is updated 1`] return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['state'].p}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -818,7 +818,7 @@ exports[`props validation props: list of strings 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -835,7 +835,7 @@ exports[`props validation validate simple types 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -852,7 +852,7 @@ exports[`props validation validate simple types 2`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -882,7 +882,7 @@ exports[`props validation validate simple types 4`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -899,7 +899,7 @@ exports[`props validation validate simple types 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -916,7 +916,7 @@ exports[`props validation validate simple types 6`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -946,7 +946,7 @@ exports[`props validation validate simple types 8`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -963,7 +963,7 @@ exports[`props validation validate simple types 9`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -980,7 +980,7 @@ exports[`props validation validate simple types 10`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1010,7 +1010,7 @@ exports[`props validation validate simple types 12`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1027,7 +1027,7 @@ exports[`props validation validate simple types 13`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1044,7 +1044,7 @@ exports[`props validation validate simple types 14`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1074,7 +1074,7 @@ exports[`props validation validate simple types 16`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1091,7 +1091,7 @@ exports[`props validation validate simple types 17`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1108,7 +1108,7 @@ exports[`props validation validate simple types 18`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1138,7 +1138,7 @@ exports[`props validation validate simple types 20`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1155,7 +1155,7 @@ exports[`props validation validate simple types 21`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1172,7 +1172,7 @@ exports[`props validation validate simple types 22`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1202,7 +1202,7 @@ exports[`props validation validate simple types 24`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1219,7 +1219,7 @@ exports[`props validation validate simple types, alternate form 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1236,7 +1236,7 @@ exports[`props validation validate simple types, alternate form 2`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1266,7 +1266,7 @@ exports[`props validation validate simple types, alternate form 4`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1283,7 +1283,7 @@ exports[`props validation validate simple types, alternate form 5`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1300,7 +1300,7 @@ exports[`props validation validate simple types, alternate form 6`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1330,7 +1330,7 @@ exports[`props validation validate simple types, alternate form 8`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1347,7 +1347,7 @@ exports[`props validation validate simple types, alternate form 9`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1364,7 +1364,7 @@ exports[`props validation validate simple types, alternate form 10`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1394,7 +1394,7 @@ exports[`props validation validate simple types, alternate form 12`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1411,7 +1411,7 @@ exports[`props validation validate simple types, alternate form 13`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1428,7 +1428,7 @@ exports[`props validation validate simple types, alternate form 14`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1458,7 +1458,7 @@ exports[`props validation validate simple types, alternate form 16`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1475,7 +1475,7 @@ exports[`props validation validate simple types, alternate form 17`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1492,7 +1492,7 @@ exports[`props validation validate simple types, alternate form 18`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1522,7 +1522,7 @@ exports[`props validation validate simple types, alternate form 20`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1539,7 +1539,7 @@ exports[`props validation validate simple types, alternate form 21`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1556,7 +1556,7 @@ exports[`props validation validate simple types, alternate form 22`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1586,7 +1586,7 @@ exports[`props validation validate simple types, alternate form 24`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {p: ctx['p']}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1603,7 +1603,7 @@ exports[`props validation validation is only done in dev mode 1`] = ` return function template(ctx, node, key = \\"\\") { const props1 = {}; helpers.validateProps(\`SubComp\`, props1, ctx); - const b2 = comp1(props1, key + \`__1\`, node, ctx, null); + const b2 = comp1(props1, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1618,7 +1618,7 @@ exports[`props validation validation is only done in dev mode 2`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/reactivity.test.ts.snap b/tests/components/__snapshots__/reactivity.test.ts.snap index d85f81b6..9f8a4962 100644 --- a/tests/components/__snapshots__/reactivity.test.ts.snap +++ b/tests/components/__snapshots__/reactivity.test.ts.snap @@ -9,7 +9,7 @@ exports[`reactivity in lifecycle Child component doesn't render when state they return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].renderChild) { - b2 = comp1({state: ctx['state']}, key + \`__1\`, node, ctx, null); + b2 = comp1({state: ctx['state']}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -34,7 +34,7 @@ exports[`reactivity in lifecycle Component is automatically subscribed to reacti const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({obj: ctx['obj'],reactiveObj: ctx['reactiveObj']}, key + \`__1\`, node, ctx, null); + return comp1({obj: ctx['obj'],reactiveObj: ctx['reactiveObj']}, key + \`__1\`, node, this, null); } }" `; @@ -119,7 +119,7 @@ exports[`reactivity in lifecycle state changes in willUnmount do not trigger rer return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return block1([], [b2]); } diff --git a/tests/components/__snapshots__/refs.test.ts.snap b/tests/components/__snapshots__/refs.test.ts.snap index 2c443162..c4d1f058 100644 --- a/tests/components/__snapshots__/refs.test.ts.snap +++ b/tests/components/__snapshots__/refs.test.ts.snap @@ -52,7 +52,7 @@ exports[`refs refs and recursive templates 1`] = ` let b2; let txt1 = ctx['props'].tree.value; if (ctx['props'].tree.child) { - b2 = comp1({tree: ctx['props'].tree.child}, key + \`__1\`, node, ctx, null); + b2 = comp1({tree: ctx['props'].tree.child}, key + \`__1\`, node, this, null); } return block1([ref1, txt1], [b2]); } @@ -79,7 +79,7 @@ exports[`refs refs are properly bound in slots 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].val; const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([txt1], [b3]); } }" diff --git a/tests/components/__snapshots__/rendering.test.ts.snap b/tests/components/__snapshots__/rendering.test.ts.snap index c161d792..7c37bde4 100644 --- a/tests/components/__snapshots__/rendering.test.ts.snap +++ b/tests/components/__snapshots__/rendering.test.ts.snap @@ -8,7 +8,7 @@ exports[`children, default props and renderings 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['state'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -32,7 +32,7 @@ exports[`force render in case of existing render 1`] = ` const comp1 = app.createComponent(\`B\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } }" `; @@ -44,7 +44,7 @@ exports[`force render in case of existing render 2`] = ` const comp1 = app.createComponent(\`C\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); const b3 = text(ctx['props'].val); return multi([b2, b3]); } @@ -70,7 +70,7 @@ exports[`rendering semantics can force a render to update sub tree 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['state'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -95,7 +95,7 @@ exports[`rendering semantics can render a parent without rendering child 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['state'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -119,7 +119,7 @@ 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, ctx, null); + return comp1({a: ctx['state']}, key + \`__1\`, node, this, null); } }" `; @@ -142,7 +142,7 @@ 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, ctx, null); + return comp1({a: ctx['state']}, key + \`__1\`, node, this, null); } }" `; @@ -166,7 +166,7 @@ exports[`rendering semantics render need a boolean = true to be 'deep' 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['state'].value); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -192,7 +192,7 @@ exports[`rendering semantics render with deep=true followed by render with deep= return function template(ctx, node, key = \\"\\") { const b2 = text(\`parent\`); const b3 = text(ctx['state'].value); - const b4 = comp1({}, key + \`__1\`, node, ctx, null); + const b4 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3, b4]); } }" @@ -219,7 +219,7 @@ exports[`rendering semantics rendering is atomic (for one subtree) 1`] = ` return function template(ctx, node, key = \\"\\") { const b2 = text(ctx['state'].obj.val); - const b3 = comp1({obj: ctx['state'].obj}, key + \`__1\`, node, ctx, null); + const b3 = comp1({obj: ctx['state'].obj}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -232,7 +232,7 @@ exports[`rendering semantics rendering is atomic (for one subtree) 2`] = ` const comp1 = app.createComponent(\`C\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({obj: ctx['props'].obj}, key + \`__1\`, node, ctx, null); + return comp1({obj: ctx['props'].obj}, key + \`__1\`, node, this, null); } }" `; @@ -255,7 +255,7 @@ 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, ctx, null); + return comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/slots.test.ts.snap b/tests/components/__snapshots__/slots.test.ts.snap index 4e9bfc49..a9f0c944 100644 --- a/tests/components/__snapshots__/slots.test.ts.snap +++ b/tests/components/__snapshots__/slots.test.ts.snap @@ -9,7 +9,7 @@ exports[`slots can define a default content 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -55,7 +55,7 @@ exports[`slots can define and call slots 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b4 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1}, 'footer': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b4 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1}, 'footer': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b4]); } }" @@ -90,7 +90,7 @@ exports[`slots can define and call slots with bound params 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'abc': {__render: slot1, __ctx: ctx1, getValue: bind(ctx, ctx['getValue'])}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'abc': {__render: slot1, __ctx: ctx1, getValue: bind(ctx, ctx['getValue'])}})}, key + \`__1\`, node, this, null); } }" `; @@ -130,7 +130,7 @@ exports[`slots can define and call slots with params 1`] = ` return function template(ctx, node, key = \\"\\") { 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, ctx, null); + 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]); } }" @@ -168,12 +168,12 @@ exports[`slots can render node with t-ref and Component in same slot 1`] = ` const refs = ctx.__owl__.refs; const ref1 = (el) => refs[\`div\`] = el; const b2 = block2([ref1]); - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); return multi([b2, b3]); } return function template(ctx, node, key = \\"\\") { - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); } }" `; @@ -209,7 +209,7 @@ exports[`slots can use component in default-content of t-slot 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -222,7 +222,7 @@ exports[`slots can use component in default-content of t-slot 2`] = ` const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true); function defaultContent1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { @@ -249,7 +249,7 @@ exports[`slots can use t-call in default-content of t-slot 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -296,7 +296,7 @@ exports[`slots content is the default slot (variation) 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -328,7 +328,7 @@ exports[`slots content is the default slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -364,7 +364,7 @@ exports[`slots default content is not rendered if named slot is provided 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'header': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -403,7 +403,7 @@ exports[`slots default content is not rendered if slot is provided 1`] = ` } return function template(ctx, node, key = \\"\\") { - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -443,7 +443,7 @@ exports[`slots default slot next to named slot, with default content 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -485,7 +485,7 @@ 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, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null); } }" `; @@ -520,7 +520,7 @@ exports[`slots default slot with slot scope: shorthand syntax 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null); } }" `; @@ -552,7 +552,7 @@ exports[`slots default slot work with text nodes (variation) 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -583,7 +583,7 @@ exports[`slots default slot work with text nodes 1`] = ` } return function template(ctx, node, key = \\"\\") { - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -628,7 +628,7 @@ exports[`slots dynamic t-slot call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b6 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b6 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b6]); } }" @@ -675,7 +675,7 @@ exports[`slots dynamic t-slot call with default 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b6 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b6 = comp1({slots: markRaw({'slot1': {__render: slot1, __ctx: ctx1}, 'slot2': {__render: slot2, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b6]); } }" @@ -713,7 +713,7 @@ exports[`slots fun: two calls to the same slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -741,7 +741,7 @@ exports[`slots missing slots are ignored 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -770,7 +770,7 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil const comp1 = app.createComponent(\`P\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -786,7 +786,7 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['inc'], ctx]; const b2 = block2([hdlr1]); - const b3 = comp1({number: ctx['state'].number}, key + \`__1\`, node, ctx, null); + const b3 = comp1({number: ctx['state'].number}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -808,7 +808,7 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); } }" `; @@ -856,7 +856,7 @@ exports[`slots mix of slots, t-call, t-call with body, and giving own props chil return function template(ctx, node, key = \\"\\") { const b2 = text(\`[B]\`); - const b3 = comp1({slots: ctx['props'].slots}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: ctx['props'].slots}, key + \`__1\`, node, this, null); return multi([b2, b3]); } }" @@ -894,7 +894,7 @@ exports[`slots multiple roots are allowed in a default slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - const b5 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + const b5 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); return block1([], [b5]); } }" @@ -934,7 +934,7 @@ exports[`slots multiple roots are allowed in a named slot 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b5 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b5 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b5]); } }" @@ -965,16 +965,16 @@ exports[`slots multiple slots containing components 1`] = ` const comp3 = app.createComponent(\`B\`, true, true, false, true); function slot1(ctx, node, key = \\"\\") { - return comp1({val: 1}, key + \`__1\`, node, ctx, null); + return comp1({val: 1}, key + \`__1\`, node, this, null); } function slot2(ctx, node, key = \\"\\") { - return comp2({val: 2}, key + \`__2\`, node, ctx, null); + return comp2({val: 2}, key + \`__2\`, node, this, null); } return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp3({slots: markRaw({'s1': {__render: slot1, __ctx: ctx1}, 's2': {__render: slot2, __ctx: ctx1}})}, key + \`__3\`, node, ctx, null); + return comp3({slots: markRaw({'s1': {__render: slot1, __ctx: ctx1}, 's2': {__render: slot2, __ctx: ctx1}})}, key + \`__3\`, node, this, null); } }" `; @@ -1028,7 +1028,7 @@ exports[`slots named slot inside slot 1`] = ` function slot2(ctx, node, key = \\"\\") { const ctx2 = capture(ctx); - return comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, this, null); } function slot3(ctx, node, key = \\"\\") { @@ -1038,7 +1038,7 @@ exports[`slots named slot inside slot 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b5 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b5 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b5]); } }" @@ -1079,7 +1079,7 @@ exports[`slots named slot inside slot, part 3 1`] = ` function slot2(ctx, node, key = \\"\\") { const ctx2 = capture(ctx); - return comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'brol': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, this, null); } function slot3(ctx, node, key = \\"\\") { @@ -1089,7 +1089,7 @@ exports[`slots named slot inside slot, part 3 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b5 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b5 = comp2({slots: markRaw({'brol': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b5]); } }" @@ -1120,7 +1120,7 @@ exports[`slots named slots can define a default content 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -1164,7 +1164,7 @@ exports[`slots named slots inside slot, again 1`] = ` function slot2(ctx, node, key = \\"\\") { const ctx2 = capture(ctx); - return comp1({slots: markRaw({'brol2': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'brol2': {__render: slot3, __ctx: ctx2}})}, key + \`__1\`, node, this, null); } function slot3(ctx, node, key = \\"\\") { @@ -1174,7 +1174,7 @@ exports[`slots named slots inside slot, again 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b5 = comp2({slots: markRaw({'brol1': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b5 = comp2({slots: markRaw({'brol1': {__render: slot1, __ctx: ctx1}, 'default': {__render: slot2, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b5]); } }" @@ -1217,15 +1217,15 @@ exports[`slots nested slots in same template 1`] = ` let block1 = createBlock(\`\`); function slot1(ctx, node, key = \\"\\") { - return comp2({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__2\`, node, this, null); } function slot2(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b4 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, ctx, null); + const b4 = comp3({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__3\`, node, this, null); return block1([], [b4]); } }" @@ -1283,11 +1283,11 @@ exports[`slots nested slots: evaluation context and parented relationship 1`] = const comp2 = app.createComponent(\`Child\`, true, true, false, true); function slot1(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); } }" `; @@ -1304,7 +1304,7 @@ exports[`slots nested slots: evaluation context and parented relationship 2`] = } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -1345,7 +1345,7 @@ exports[`slots no named slot content => just no children 1`] = ` const comp1 = app.createComponent(\`Dialog\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -1377,7 +1377,7 @@ exports[`slots simple default slot 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -1415,7 +1415,7 @@ exports[`slots simple default slot with params 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -1447,7 +1447,7 @@ 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, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null); } }" `; @@ -1476,7 +1476,7 @@ exports[`slots simple default slot, variation 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -1512,7 +1512,7 @@ exports[`slots simple dynamic slot with slot scope 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null); } }" `; @@ -1542,7 +1542,7 @@ exports[`slots simple named and empty slot -- 2 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'myEmptySlot': {myProp: 'myProp text'}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'myEmptySlot': {myProp: 'myProp text'}})}, key + \`__1\`, node, this, null); } }" `; @@ -1579,7 +1579,7 @@ exports[`slots simple named and empty slot 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'myEmptySlot': {}, 'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'myEmptySlot': {}, 'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); } }" `; @@ -1619,7 +1619,7 @@ exports[`slots simple slot with slot scope 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"slotScope\\"}})}, key + \`__1\`, node, this, null); } }" `; @@ -1655,7 +1655,7 @@ exports[`slots slot and (inline) t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -1705,7 +1705,7 @@ exports[`slots slot and t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -1753,7 +1753,7 @@ exports[`slots slot and t-esc 1`] = ` } return function template(ctx, node, key = \\"\\") { - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -1785,13 +1785,13 @@ exports[`slots slot are properly rendered if inner props are changed 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { let hdlr1 = [ctx['inc'], ctx]; let txt1 = ctx['state'].val; - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([hdlr1, txt1], [b3]); } }" @@ -1835,11 +1835,11 @@ 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, ctx, null); + return comp1({parent: 'Parent'}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); } }" `; @@ -1852,7 +1852,7 @@ exports[`slots slot content has different key from other content -- dynamic slot const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({parent: 'SlotDisplay'}, key + \`__1\`, node, ctx, null); + const b2 = comp1({parent: 'SlotDisplay'}, key + \`__1\`, node, this, null); const slot1 = (ctx['slotName']); const b3 = toggler(slot1, callSlot(ctx, node, key, slot1, true, {})); return multi([b2, b3]); @@ -1883,11 +1883,11 @@ 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, ctx, null); + return comp1({parent: 'Parent'}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); } }" `; @@ -1900,7 +1900,7 @@ exports[`slots slot content has different key from other content -- static slot const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({parent: 'SlotDisplay'}, key + \`__1\`, node, ctx, null); + const b2 = comp1({parent: 'SlotDisplay'}, key + \`__1\`, node, this, null); const b3 = callSlot(ctx, node, key, 'default', false, {}); return multi([b2, b3]); } @@ -1940,7 +1940,7 @@ exports[`slots slot content is bound to caller (variation) 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); } }" `; @@ -1975,7 +1975,7 @@ exports[`slots slot content is bound to caller 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -2006,11 +2006,11 @@ exports[`slots slot preserves properly parented relationship 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -2055,7 +2055,7 @@ exports[`slots slot preserves properly parented relationship, even through t-cal return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -2068,7 +2068,7 @@ exports[`slots slot preserves properly parented relationship, even through t-cal const comp1 = app.createComponent(\`GrandChild\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -2116,7 +2116,7 @@ exports[`slots slot with slot scope and t-props 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"info\\"}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'slotName': {__render: slot1, __ctx: ctx1, __scope: \\"info\\"}})}, key + \`__1\`, node, this, null); } }" `; @@ -2145,7 +2145,7 @@ exports[`slots slots and wrapper components 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -2172,7 +2172,7 @@ exports[`slots slots are properly bound to correct component 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -2218,7 +2218,7 @@ exports[`slots slots are rendered with proper context 1`] = ` return function template(ctx, node, key = \\"\\") { let txt1 = ctx['state'].val; const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'footer': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([txt1], [b3]); } }" @@ -2262,7 +2262,7 @@ exports[`slots slots are rendered with proper context, part 2 1`] = ` ctx[\`user\`] = v_block2[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, ctx, null); + 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 b2 = list(c_block2); @@ -2311,7 +2311,7 @@ exports[`slots slots are rendered with proper context, part 3 1`] = ` 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, ctx, null); + 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 b2 = list(c_block2); @@ -2354,7 +2354,7 @@ exports[`slots slots are rendered with proper context, part 4 1`] = ` ctx[isBoundary] = 1 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, ctx, null); + const b3 = comp1({to: '/user/'+ctx['state'].user.id,slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -2396,7 +2396,7 @@ exports[`slots slots in slots, with vars 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"test\\", ctx['state'].name); const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -2416,7 +2416,7 @@ exports[`slots slots in slots, with vars 2`] = ` } return function template(ctx, node, key = \\"\\") { - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -2458,7 +2458,7 @@ exports[`slots slots in t-foreach and re-rendering 1`] = ` ctx[\`n_index\`] = i1; const key1 = ctx['n_index']; const ctx1 = capture(ctx); - c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null), key1); } const b2 = list(c_block2); return block1([], [b2]); @@ -2513,7 +2513,7 @@ exports[`slots slots in t-foreach in t-foreach 1`] = ` ctx[\`node2\`] = v_block6[i2]; const key2 = ctx['node2'].key; const ctx1 = capture(ctx); - c_block6[i2] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}__\${key2}\`, node, ctx, null), key2); + c_block6[i2] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}__\${key2}\`, node, this, null), key2); } ctx = ctx.__proto__; const b6 = list(c_block6); @@ -2565,7 +2565,7 @@ exports[`slots slots in t-foreach with t-set and re-rendering 1`] = ` const key1 = ctx['n_index']; setContextValue(ctx, \\"dummy\\", ctx['n_index']); const ctx1 = capture(ctx); - c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block2[i1] = withKey(comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1__\${key1}\`, node, this, null), key1); } const b2 = list(c_block2); return block1([], [b2]); @@ -2605,7 +2605,7 @@ exports[`slots t-debug on a t-set-slot (defining a slot) 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'content': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -2644,7 +2644,7 @@ exports[`slots t-set t-value in a slot 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return block1([], [b3]); } }" @@ -2706,7 +2706,7 @@ exports[`slots t-slot in recursive templates 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); } }" `; @@ -2737,11 +2737,11 @@ exports[`slots t-slot nested within another slot 1`] = ` let block1 = createBlock(\`\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -2758,7 +2758,7 @@ exports[`slots t-slot nested within another slot 2`] = ` let block1 = createBlock(\`\`); function slot1(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot2, __ctx: ctx}})}, key + \`__1\`, node, this, null); } function slot2(ctx, node, key = \\"\\") { @@ -2766,7 +2766,7 @@ exports[`slots t-slot nested within another slot 2`] = ` } return function template(ctx, node, key = \\"\\") { - const b4 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b4 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b4]); } }" @@ -2829,7 +2829,7 @@ exports[`slots t-slot scope context 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -2850,7 +2850,7 @@ exports[`slots t-slot scope context 2`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -2884,7 +2884,7 @@ exports[`slots t-slot within dynamic t-call 1`] = ` return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + const b3 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -2914,7 +2914,7 @@ exports[`slots t-slot within dynamic t-call 3`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -2944,11 +2944,11 @@ exports[`slots template can just return a slot 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null); + 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, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" diff --git a/tests/components/__snapshots__/style_class.test.ts.snap b/tests/components/__snapshots__/style_class.test.ts.snap index e35edcf5..cafd236a 100644 --- a/tests/components/__snapshots__/style_class.test.ts.snap +++ b/tests/components/__snapshots__/style_class.test.ts.snap @@ -7,7 +7,7 @@ exports[`style and class handling can set class on multi root component 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'fromparent'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'fromparent'}, key + \`__1\`, node, this, null); } }" `; @@ -36,7 +36,7 @@ exports[`style and class handling can set class on sub component, as prop 1`] = const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'some-class'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'some-class'}, key + \`__1\`, node, this, null); } }" `; @@ -62,7 +62,7 @@ exports[`style and class handling can set class on sub sub component 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'fromparent'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'fromparent'}, key + \`__1\`, node, this, null); } }" `; @@ -74,7 +74,7 @@ exports[`style and class handling can set class on sub sub component 2`] = ` const comp1 = app.createComponent(\`ChildChild\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: (ctx['props'].class||'')+' fromchild'}, key + \`__1\`, node, ctx, null); + return comp1({class: (ctx['props'].class||'')+' fromchild'}, key + \`__1\`, node, this, null); } }" `; @@ -100,7 +100,7 @@ exports[`style and class handling can set more than one class on sub component 1 const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'a b'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'a b'}, key + \`__1\`, node, this, null); } }" `; @@ -153,7 +153,7 @@ exports[`style and class handling class on sub component, which is switched to a const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'someclass',child: ctx['state'].child}, key + \`__1\`, node, ctx, null); + return comp1({class: 'someclass',child: ctx['state'].child}, key + \`__1\`, node, this, null); } }" `; @@ -168,9 +168,9 @@ exports[`style and class handling class on sub component, which is switched to a return function template(ctx, node, key = \\"\\") { let b2,b3; if (ctx['props'].child==='a') { - b2 = comp1({class: ctx['props'].class}, key + \`__1\`, node, ctx, null); + b2 = comp1({class: ctx['props'].class}, key + \`__1\`, node, this, null); } else { - b3 = comp2({class: ctx['props'].class}, key + \`__2\`, node, ctx, null); + b3 = comp2({class: ctx['props'].class}, key + \`__2\`, node, this, null); } return multi([b2, b3]); } @@ -214,7 +214,7 @@ exports[`style and class handling class with extra whitespaces (variation) 1`] = let block1 = createBlock(\`

\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({class: 'a b c d'}, key + \`__1\`, node, ctx, null); + const b2 = comp1({class: 'a b c d'}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -241,7 +241,7 @@ exports[`style and class handling class with extra whitespaces 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'a b c d'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'a b c d'}, key + \`__1\`, node, this, null); } }" `; @@ -267,7 +267,7 @@ exports[`style and class handling component class and parent class combine toget const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'from parent'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'from parent'}, key + \`__1\`, node, this, null); } }" `; @@ -322,7 +322,7 @@ exports[`style and class handling empty class attribute is not added on widget r let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({class: undefined}, key + \`__1\`, node, ctx, null); + const b2 = comp1({class: undefined}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -349,7 +349,7 @@ exports[`style and class handling error in subcomponent with class 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'a'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'a'}, key + \`__1\`, node, this, null); } }" `; @@ -376,7 +376,7 @@ exports[`style and class handling no class is set is child ignores it 1`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: 'hey'}, key + \`__1\`, node, ctx, null); + return comp1({class: 'hey'}, key + \`__1\`, node, this, null); } }" `; @@ -401,7 +401,7 @@ exports[`style and class handling no class is set is parent does not give it as const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -427,7 +427,7 @@ exports[`style and class handling style is properly added on widget root el 1`] const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({style: 'font-weight: bold;'}, key + \`__1\`, node, ctx, null); + return comp1({style: 'font-weight: bold;'}, key + \`__1\`, node, this, null); } }" `; @@ -455,7 +455,7 @@ exports[`style and class handling t-att-class is properly added/removed on widge let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({class: {b:ctx['state'].b}}, key + \`__1\`, node, ctx, null); + const b2 = comp1({class: {b:ctx['state'].b}}, key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -482,7 +482,7 @@ exports[`style and class handling t-att-class is properly added/removed on widge const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({class: {a:true,b:ctx['state'].b}}, key + \`__1\`, node, ctx, null); + return comp1({class: {a:true,b:ctx['state'].b}}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/t_call.test.ts.snap b/tests/components/__snapshots__/t_call.test.ts.snap index d87a829f..1a3f8a0a 100644 --- a/tests/components/__snapshots__/t_call.test.ts.snap +++ b/tests/components/__snapshots__/t_call.test.ts.snap @@ -50,7 +50,7 @@ exports[`t-call dynamic t-call: key is propagated 1`] = ` const call = app.callTemplate.bind(app); return function template(ctx, node, key = \\"\\") { - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); const template1 = (ctx['sub']); const b3 = call(this, template1, ctx, node, key + \`__2\`); return multi([b2, b3]); @@ -79,7 +79,7 @@ exports[`t-call dynamic t-call: key is propagated 3`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -197,7 +197,7 @@ exports[`t-call parent is set within t-call 2`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -234,7 +234,7 @@ exports[`t-call parent is set within t-call with no parentNode 2`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, true); return function template(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } }" `; @@ -331,7 +331,7 @@ exports[`t-call sub components in two t-calls 2`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } }" `; @@ -384,7 +384,7 @@ exports[`t-call t-call in t-foreach and children component 2`] = ` const comp1 = app.createComponent(\`Child\`, true, false, false, false); return function template(ctx, node, key = \\"\\") { - return comp1({val: ctx['val']}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['val']}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/t_component.test.ts.snap b/tests/components/__snapshots__/t_component.test.ts.snap index 0fb3f5a3..36405cca 100644 --- a/tests/components/__snapshots__/t_component.test.ts.snap +++ b/tests/components/__snapshots__/t_component.test.ts.snap @@ -10,7 +10,7 @@ exports[`t-component can switch between dynamic components without the need for return function template(ctx, node, key = \\"\\") { const Comp1 = ctx['constructor'].components[ctx['state'].child]; - const b2 = toggler(Comp1, comp1({}, key + \`__1\`, node, ctx, Comp1)); + const b2 = toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1)); return block1([], [b2]); } }" @@ -51,7 +51,7 @@ exports[`t-component can use dynamic components (the class) if given (with diffe return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['state'].child; const Comp1 = ctx['myComponent']; - return toggler(tKey_1, toggler(Comp1, comp1({}, tKey_1 + key + \`__1\`, node, ctx, Comp1))); + return toggler(tKey_1, toggler(Comp1, comp1({}, tKey_1 + key + \`__1\`, node, this, Comp1))); } }" `; @@ -91,7 +91,7 @@ exports[`t-component can use dynamic components (the class) if given 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['state'].child; const Comp1 = ctx['myComponent']; - return toggler(tKey_1, toggler(Comp1, comp1({}, tKey_1 + key + \`__1\`, node, ctx, Comp1))); + return toggler(tKey_1, toggler(Comp1, comp1({}, tKey_1 + key + \`__1\`, node, this, Comp1))); } }" `; @@ -132,7 +132,7 @@ exports[`t-component modifying a sub widget 1`] = ` return function template(ctx, node, key = \\"\\") { const Comp1 = ctx['Counter']; - const b2 = toggler(Comp1, comp1({}, key + \`__1\`, node, ctx, Comp1)); + const b2 = toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1)); return block1([], [b2]); } }" @@ -162,7 +162,7 @@ exports[`t-component switching dynamic component 1`] = ` return function template(ctx, node, key = \\"\\") { const Comp1 = ctx['Child']; - return toggler(Comp1, comp1({}, key + \`__1\`, node, ctx, Comp1)); + return toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1)); } }" `; @@ -199,7 +199,7 @@ exports[`t-component t-component works in simple case 1`] = ` return function template(ctx, node, key = \\"\\") { const Comp1 = ctx['Child']; - return toggler(Comp1, comp1({}, key + \`__1\`, node, ctx, Comp1)); + return toggler(Comp1, comp1({}, key + \`__1\`, node, this, Comp1)); } }" `; diff --git a/tests/components/__snapshots__/t_foreach.test.ts.snap b/tests/components/__snapshots__/t_foreach.test.ts.snap index 2719e02d..9e6d0fa8 100644 --- a/tests/components/__snapshots__/t_foreach.test.ts.snap +++ b/tests/components/__snapshots__/t_foreach.test.ts.snap @@ -16,7 +16,7 @@ exports[`list of components components in a node in a t-foreach 1`] = ` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`item\`] = v_block2[i1]; const key1 = 'li_'+ctx['item']; - const b4 = comp1({item: ctx['item']}, key + \`__1__\${key1}\`, node, ctx, null); + const b4 = comp1({item: ctx['item']}, key + \`__1__\${key1}\`, node, this, null); c_block2[i1] = withKey(block3([], [b4]), key1); } const b2 = list(c_block2); @@ -57,7 +57,7 @@ exports[`list of components crash on duplicate key in dev mode 1`] = ` keys1.add(key1); const props1 = {}; helpers.validateProps(\`Child\`, props1, ctx); - c_block1[i1] = withKey(comp1(props1, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block1[i1] = withKey(comp1(props1, key + \`__1__\${key1}\`, node, this, null), key1); } return list(c_block1); } @@ -91,7 +91,7 @@ exports[`list of components list of sub components inside other nodes 1`] = ` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`blip\`] = v_block2[i1]; const key1 = ctx['blip'].id; - const b4 = comp1({}, key + \`__1__\${key1}\`, node, ctx, null); + const b4 = comp1({}, key + \`__1__\${key1}\`, node, this, null); c_block2[i1] = withKey(block3([], [b4]), key1); } const b2 = list(c_block2); @@ -135,7 +135,7 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach ctx[\`blip\`] = v_block3[i2]; ctx[\`blip_index\`] = i2; const key2 = ctx['blip_index']; - c_block3[i2] = withKey(comp1({blip: ctx['blip']}, key + \`__1__\${key1}__\${key2}\`, node, ctx, null), key2); + c_block3[i2] = withKey(comp1({blip: ctx['blip']}, key + \`__1__\${key1}__\${key2}\`, node, this, null), key2); } ctx = ctx.__proto__; c_block2[i1] = withKey(list(c_block3), key1); @@ -182,7 +182,7 @@ exports[`list of components reconciliation alg works for t-foreach in t-foreach, for (let i2 = 0; i2 < l_block4; i2++) { ctx[\`col\`] = v_block4[i2]; const key2 = ctx['col']; - const b6 = comp1({row: ctx['row'],col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, ctx, null); + const b6 = comp1({row: ctx['row'],col: ctx['col']}, key + \`__1__\${key1}__\${key2}\`, node, this, null); c_block4[i2] = withKey(block5([], [b6]), key2); } ctx = ctx.__proto__; @@ -222,7 +222,7 @@ exports[`list of components simple list 1`] = ` for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`elem\`] = v_block1[i1]; const key1 = ctx['elem'].id; - c_block1[i1] = withKey(comp1({value: ctx['elem'].value}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block1[i1] = withKey(comp1({value: ctx['elem'].value}, key + \`__1__\${key1}\`, node, this, null), key1); } return list(c_block1); } @@ -258,7 +258,7 @@ exports[`list of components sub components rendered in a loop 1`] = ` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`number\`] = v_block2[i1]; const key1 = ctx['number']; - c_block2[i1] = withKey(comp1({n: ctx['number']}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block2[i1] = withKey(comp1({n: ctx['number']}, key + \`__1__\${key1}\`, node, this, null), key1); } const b2 = list(c_block2); return block1([], [b2]); @@ -295,7 +295,7 @@ exports[`list of components sub components with some state rendered in a loop 1` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`number\`] = v_block2[i1]; const key1 = ctx['number']; - c_block2[i1] = withKey(comp1({}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block2[i1] = withKey(comp1({}, key + \`__1__\${key1}\`, node, this, null), key1); } const b2 = list(c_block2); return block1([], [b2]); @@ -332,7 +332,7 @@ 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, ctx, null), key1); + c_block2[i1] = withKey(comp1({key: ctx['c']}, key + \`__1__\${key1}\`, node, this, null), key1); } const b2 = list(c_block2); return block1([], [b2]); @@ -370,7 +370,7 @@ exports[`list of components t-foreach with t-component, and update 1`] = ` ctx[\`n\`] = v_block2[i1]; ctx[\`n_index\`] = i1; const key1 = ctx['n_index']; - c_block2[i1] = withKey(comp1({val: ctx['n_index']}, key + \`__1__\${key1}\`, node, ctx, null), key1); + c_block2[i1] = withKey(comp1({val: ctx['n_index']}, key + \`__1__\${key1}\`, node, this, null), key1); } const b2 = list(c_block2); return block1([], [b2]); diff --git a/tests/components/__snapshots__/t_key.test.ts.snap b/tests/components/__snapshots__/t_key.test.ts.snap index 9bcc2a78..43488f61 100644 --- a/tests/components/__snapshots__/t_key.test.ts.snap +++ b/tests/components/__snapshots__/t_key.test.ts.snap @@ -16,7 +16,7 @@ exports[`t-key t-foreach with t-key switch component position 1`] = ` ctx[\`c\`] = v_block2[i1]; const key1 = ctx['c']; const tKey_1 = ctx['key1']; - c_block2[i1] = withKey(comp1({key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, ctx, null), tKey_1 + key1); + c_block2[i1] = withKey(comp1({key: ctx['c']+ctx['key1']}, tKey_1 + key + \`__1__\${key1}\`, node, this, null), tKey_1 + key1); } const b2 = list(c_block2); return block1([], [b2]); @@ -46,7 +46,7 @@ exports[`t-key t-key on Component 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, null)); + return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null)); } }" `; @@ -75,7 +75,7 @@ exports[`t-key t-key on Component as a function 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - const b2 = toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, null)); + const b2 = toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null)); return block1([], [b2]); } }" @@ -106,9 +106,9 @@ exports[`t-key t-key on multiple Components 1`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key1']; - const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx, null)); + const b2 = 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, ctx, null)); + const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, this, null)); return block1([], [b2, b3]); } }" @@ -163,7 +163,7 @@ exports[`t-key t-key on multiple Components with t-call 1 2`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key']; - return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, ctx, null)); + return toggler(tKey_1, comp1({key: ctx['key']}, tKey_1 + key + \`__1\`, node, this, null)); } }" `; @@ -206,9 +206,9 @@ exports[`t-key t-key on multiple Components with t-call 2 2`] = ` return function template(ctx, node, key = \\"\\") { const tKey_1 = ctx['key1']; - const b2 = toggler(tKey_1, comp1({key: ctx['key1']}, tKey_1 + key + \`__1\`, node, ctx, null)); + const b2 = 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, ctx, null)); + const b3 = toggler(tKey_2, comp2({key: ctx['key2']}, tKey_2 + key + \`__2\`, node, this, null)); return multi([b2, b3]); } }" diff --git a/tests/components/__snapshots__/t_on.test.ts.snap b/tests/components/__snapshots__/t_on.test.ts.snap index 9b7f3490..76652047 100644 --- a/tests/components/__snapshots__/t_on.test.ts.snap +++ b/tests/components/__snapshots__/t_on.test.ts.snap @@ -133,7 +133,7 @@ exports[`t-on t-on on component next to t-on on div 1`] = ` return function template(ctx, node, key = \\"\\") { const hdlr1 = [ctx['increment'], ctx]; - const b2 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null), [hdlr1]); + const b2 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]); let hdlr2 = [ctx['decrement'], ctx]; return block1([hdlr2], [b2]); } @@ -164,7 +164,7 @@ exports[`t-on t-on on components 1`] = ` return function template(ctx, node, key = \\"\\") { const hdlr1 = [ctx['increment'], ctx]; - return catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null), [hdlr1]); + return catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]); } }" `; @@ -199,7 +199,7 @@ exports[`t-on t-on on components and t-foreach 1`] = ` const key1 = ctx['name']; const v1 = ctx['name']; const hdlr1 = [()=>this.log(v1), ctx]; - c_block1[i1] = withKey(catcher1(comp1({value: ctx['name']}, key + \`__1__\${key1}\`, node, ctx, null), [hdlr1]), key1); + c_block1[i1] = withKey(catcher1(comp1({value: ctx['name']}, key + \`__1__\${key1}\`, node, this, null), [hdlr1]), key1); } return list(c_block1); } @@ -232,7 +232,7 @@ exports[`t-on t-on on components, variation 1`] = ` return function template(ctx, node, key = \\"\\") { const hdlr1 = [ctx['increment'], ctx]; - const b2 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null), [hdlr1]); + const b2 = catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]); return block1([], [b2]); } }" @@ -262,7 +262,7 @@ exports[`t-on t-on on components, with 'prevent' modifier 1`] = ` return function template(ctx, node, key = \\"\\") { const hdlr1 = [\\"prevent\\", ctx['increment'], ctx]; - return catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, ctx, null), [hdlr1]); + return catcher1(comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null), [hdlr1]); } }" `; @@ -295,7 +295,7 @@ exports[`t-on t-on on components, with a handler update 1`] = ` setContextValue(ctx, \\"name\\", ctx['state'].name); const v1 = ctx['name']; const hdlr1 = [()=>this.log(v1), ctx]; - return catcher1(comp1({value: ctx['name']}, key + \`__1\`, node, ctx, null), [hdlr1]); + return catcher1(comp1({value: ctx['name']}, key + \`__1\`, node, this, null), [hdlr1]); } }" `; @@ -325,7 +325,7 @@ exports[`t-on t-on on destroyed components 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].flag) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2]); } @@ -360,7 +360,7 @@ exports[`t-on t-on on slot, with 'prevent' modifier 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; @@ -402,7 +402,7 @@ exports[`t-on t-on on t-set-slots 1`] = ` const b3 = text(ctx['state'].count); const b4 = text(\`] \`); const ctx1 = capture(ctx); - const b8 = comp1({slots: markRaw({'myslot': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, ctx, null); + const b8 = comp1({slots: markRaw({'myslot': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); return multi([b2, b3, b4, b8]); } }" @@ -434,7 +434,7 @@ exports[`t-on t-on on t-slots 1`] = ` } return function template(ctx, node, key = \\"\\") { - return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, ctx, null); + return comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__1\`, node, this, null); } }" `; diff --git a/tests/components/__snapshots__/t_props.test.ts.snap b/tests/components/__snapshots__/t_props.test.ts.snap index 4f78687f..8b578382 100644 --- a/tests/components/__snapshots__/t_props.test.ts.snap +++ b/tests/components/__snapshots__/t_props.test.ts.snap @@ -9,7 +9,7 @@ exports[`t-props basic use 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1(Object.assign({}, ctx['some'].obj), key + \`__1\`, node, ctx, null); + const b2 = comp1(Object.assign({}, ctx['some'].obj), key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -36,7 +36,7 @@ exports[`t-props child receives a copy of the t-props object, not the original 1 const comp1 = app.createComponent(\`Child\`, true, false, true, false); return function template(ctx, node, key = \\"\\") { - return comp1(Object.assign({}, ctx['childProps']), key + \`__1\`, node, ctx, null); + return comp1(Object.assign({}, ctx['childProps']), key + \`__1\`, node, this, null); } }" `; @@ -63,7 +63,7 @@ exports[`t-props t-props and other props 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1(Object.assign({}, ctx['state1'], {a: ctx['a']}), key + \`__1\`, node, ctx, null); + const b2 = comp1(Object.assign({}, ctx['state1'], {a: ctx['a']}), key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -93,7 +93,7 @@ exports[`t-props t-props only 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, ctx, null); + const b2 = comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, this, null); return block1([], [b2]); } }" @@ -122,7 +122,7 @@ exports[`t-props t-props with props 1`] = ` let block1 = createBlock(\`
\`); return function template(ctx, node, key = \\"\\") { - const b2 = comp1(Object.assign({}, ctx['childProps'], {a: 1,b: 2}), key + \`__1\`, node, ctx, null); + const b2 = comp1(Object.assign({}, ctx['childProps'], {a: 1,b: 2}), key + \`__1\`, node, this, null); return block1([], [b2]); } }" diff --git a/tests/components/__snapshots__/t_set.test.ts.snap b/tests/components/__snapshots__/t_set.test.ts.snap index 2312d7c8..f4deefec 100644 --- a/tests/components/__snapshots__/t_set.test.ts.snap +++ b/tests/components/__snapshots__/t_set.test.ts.snap @@ -22,7 +22,7 @@ exports[`t-set slot setted value (with t-set) not accessible with t-esc 1`] = ` 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, ctx, null); + const b2 = comp1({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__1\`, node, this, null); let txt2 = ctx['iter']; return block1([txt1, txt2], [b2]); } @@ -59,19 +59,19 @@ 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 - ctx[\`v\`] = new LazyValue(value1, ctx, node); + ctx[\`v\`] = new LazyValue(value1, ctx, this, node); const b3 = text(\` in slot \`); const b4 = safeOutput(ctx['v']); return multi([b3, b4]); } function value1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); } }" `; @@ -114,21 +114,21 @@ exports[`t-set slots with an t-set with a component in body 1`] = ` function slot1(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`v\`] = new LazyValue(value1, ctx, node); + ctx[\`v\`] = new LazyValue(value1, ctx, this, node); const b5 = text(\` tea \`); const b6 = safeOutput(ctx['v']); return multi([b5, b6]); } function value1(ctx, node, key = \\"\\") { - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); const b4 = block4(); return multi([b3, b4]); } return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); } }" `; @@ -169,17 +169,17 @@ 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 - ctx[\`v\`] = new LazyValue(value1, ctx, node); + ctx[\`v\`] = new LazyValue(value1, ctx, this, node); return text(\` in slot \`); } function value1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { const ctx1 = capture(ctx); - return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, ctx, null); + return comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx1}})}, key + \`__2\`, node, this, null); } }" `; @@ -275,7 +275,7 @@ exports[`t-set t-set not altered by child comp 1`] = ` ctx[isBoundary] = 1 setContextValue(ctx, \\"iter\\", 'source'); let txt1 = ctx['iter']; - const b2 = comp1({}, key + \`__1\`, node, ctx, null); + const b2 = comp1({}, key + \`__1\`, node, this, null); let txt2 = ctx['iter']; return block1([txt1, txt2], [b2]); } @@ -337,13 +337,13 @@ exports[`t-set t-set with a component in body 1`] = ` let block1 = createBlock(\`
\`); function value1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`v\`] = new LazyValue(value1, ctx, node); + ctx[\`v\`] = new LazyValue(value1, ctx, this, node); const b3 = safeOutput(ctx['v']); return block1([], [b3]); } @@ -377,7 +377,7 @@ exports[`t-set t-set with something in body 1`] = ` return function template(ctx, node, key = \\"\\") { ctx = Object.create(ctx); ctx[isBoundary] = 1 - ctx[\`v\`] = new LazyValue(value1, ctx, node); + ctx[\`v\`] = new LazyValue(value1, ctx, this, node); const b3 = safeOutput(ctx['v']); return block1([], [b3]); } diff --git a/tests/misc/__snapshots__/portal.test.ts.snap b/tests/misc/__snapshots__/portal.test.ts.snap index 621ebeb9..dca22dd3 100644 --- a/tests/misc/__snapshots__/portal.test.ts.snap +++ b/tests/misc/__snapshots__/portal.test.ts.snap @@ -166,11 +166,11 @@ exports[`Portal Portal composed with t-slot 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({customHandler: ctx['_handled']}, key + \`__1\`, node, ctx, null); + return comp1({customHandler: ctx['_handled']}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { - const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null); + const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, this, null); return block1([], [b3]); } }" @@ -303,7 +303,7 @@ exports[`Portal conditional use of Portal (with sub Component) 1`] = ` let block2 = createBlock(\`1\`); function slot1(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { @@ -365,7 +365,7 @@ exports[`Portal conditional use of Portal with child and div 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasPortal) { - b2 = comp1({}, key + \`__1\`, node, ctx, null); + b2 = comp1({}, key + \`__1\`, node, this, null); } return multi([b2]); } @@ -413,7 +413,7 @@ exports[`Portal conditional use of Portal with child and div, variation 1`] = ` return function template(ctx, node, key = \\"\\") { let b2; if (ctx['state'].hasPortal) { - const b3 = comp1({}, key + \`__1\`, node, ctx, null); + const b3 = comp1({}, key + \`__1\`, node, this, null); b2 = block2([], [b3]); } return multi([b2]); @@ -488,7 +488,7 @@ exports[`Portal lifecycle hooks of portal sub component are properly called 1`] let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { @@ -552,7 +552,7 @@ exports[`Portal portal destroys on crash 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({error: ctx['state'].error}, key + \`__1\`, node, ctx, null); + return comp1({error: ctx['state'].error}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { @@ -587,7 +587,7 @@ exports[`Portal portal with child and props 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { @@ -740,7 +740,7 @@ exports[`Portal portal's parent's env is not polluted 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({}, key + \`__1\`, node, ctx, null); + return comp1({}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") { @@ -776,7 +776,7 @@ exports[`Portal simple catchError with portal 1`] = ` if (ctx['error']) { b2 = text(\`Error\`); } else { - b3 = comp1({}, key + \`__1\`, node, ctx, null); + b3 = comp1({}, key + \`__1\`, node, this, null); } return block1([], [b2, b3]); } @@ -900,7 +900,7 @@ exports[`Portal: UI/UX focus is kept across re-renders 1`] = ` let block1 = createBlock(\`
\`); function slot1(ctx, node, key = \\"\\") { - return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null); + return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null); } return function template(ctx, node, key = \\"\\") {