[REF] move component function to app, improve some code

This commit is contained in:
Géry Debongnie
2022-06-08 11:09:39 +02:00
committed by Sam Degueldre
parent 51538c2fea
commit 0e6059467f
53 changed files with 2522 additions and 1975 deletions
+126 -84
View File
@@ -3,9 +3,10 @@
exports[`Portal Add and remove portals 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
function slot1(ctx, node, key = \\"\\") {
const b3 = text(\` Portal\`);
@@ -20,7 +21,7 @@ exports[`Portal Add and remove portals 1`] = `
ctx[\`portalId\`] = v_block1[i1];
const key1 = ctx['portalId'];
const ctx1 = capture(ctx);
c_block1[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1);
c_block1[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
}
return list(c_block1);
}
@@ -30,9 +31,10 @@ exports[`Portal Add and remove portals 1`] = `
exports[`Portal Add and remove portals on div 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<div> Portal<block-text-0/></div>\`);
@@ -48,7 +50,7 @@ exports[`Portal Add and remove portals on div 1`] = `
ctx[\`portalId\`] = v_block1[i1];
const key1 = ctx['portalId'];
const ctx1 = capture(ctx);
c_block1[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1);
c_block1[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
}
return list(c_block1);
}
@@ -58,9 +60,10 @@ exports[`Portal Add and remove portals on div 1`] = `
exports[`Portal Add and remove portals with t-foreach 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<div><block-text-0/><block-child-0/></div>\`);
@@ -78,7 +81,7 @@ exports[`Portal Add and remove portals with t-foreach 1`] = `
const key1 = ctx['portalId'];
let txt1 = ctx['portalId'];
const ctx1 = capture(ctx);
const b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx);
const b6 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
c_block1[i1] = withKey(block2([txt1], [b6]), key1);
}
return list(c_block1);
@@ -89,9 +92,10 @@ exports[`Portal Add and remove portals with t-foreach 1`] = `
exports[`Portal Add and remove portals with t-foreach and destroy 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<div><block-text-0/><block-child-0/></div>\`);
@@ -109,7 +113,7 @@ exports[`Portal Add and remove portals with t-foreach and destroy 1`] = `
const key1 = ctx['portalId'];
let txt1 = ctx['portalId'];
const ctx1 = capture(ctx);
const b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx);
const b6 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
c_block1[i1] = withKey(block2([txt1], [b6]), key1);
}
return list(c_block1);
@@ -120,9 +124,10 @@ exports[`Portal Add and remove portals with t-foreach and destroy 1`] = `
exports[`Portal Add and remove portals with t-foreach inside div 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<div><block-text-0/><block-child-0/></div>\`);
@@ -141,7 +146,7 @@ exports[`Portal Add and remove portals with t-foreach inside div 1`] = `
const key1 = ctx['portalId'];
let txt1 = ctx['portalId'];
const ctx1 = capture(ctx);
const b7 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx);
const b7 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal);
c_block2[i1] = withKey(block3([txt1], [b7]), key1);
}
const b2 = list(c_block2);
@@ -153,17 +158,19 @@ exports[`Portal Add and remove portals with t-foreach inside div 1`] = `
exports[`Portal Portal composed with t-slot 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Child2\`, true, false, false);
const comp2 = app.createComponent(\`Child\`, true, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child2\`, {customHandler: ctx['_handled']}, key + \`__1\`, node, ctx);
return comp1({customHandler: ctx['_handled']}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(\`Child\`, {slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx);
const b3 = comp2({slots: markRaw({'default': {__render: slot1, __ctx: ctx}})}, key + \`__2\`, node, ctx, null);
return block1([], [b3]);
}
}"
@@ -172,16 +179,17 @@ exports[`Portal Portal composed with t-slot 1`] = `
exports[`Portal Portal composed with t-slot 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
function slot1(ctx, node, key = \\"\\") {
return callSlot(ctx, node, key, 'default', false, {});
}
return function template(ctx, node, key = \\"\\") {
return component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
return comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
}
}"
`;
@@ -189,7 +197,7 @@ exports[`Portal Portal composed with t-slot 2`] = `
exports[`Portal Portal composed with t-slot 3`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<div block-handler-0=\\"custom\\"><span id=\\"childSpan\\">child2</span></div>\`);
@@ -203,8 +211,9 @@ exports[`Portal Portal composed with t-slot 3`] = `
exports[`Portal basic use of portal 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -214,7 +223,7 @@ exports[`Portal basic use of portal 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -223,8 +232,9 @@ exports[`Portal basic use of portal 1`] = `
exports[`Portal basic use of portal in dev mode 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -234,7 +244,7 @@ exports[`Portal basic use of portal in dev mode 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -243,8 +253,9 @@ exports[`Portal basic use of portal in dev mode 1`] = `
exports[`Portal basic use of portal on div 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<div><p>2</p></div>\`);
@@ -254,7 +265,7 @@ exports[`Portal basic use of portal on div 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -263,8 +274,9 @@ exports[`Portal basic use of portal on div 1`] = `
exports[`Portal basic use of portal, variation 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -274,7 +286,7 @@ exports[`Portal basic use of portal, variation 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: ctx['target'],slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: ctx['target'],slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -283,20 +295,22 @@ exports[`Portal basic use of portal, variation 1`] = `
exports[`Portal conditional use of Portal (with sub Component) 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<span>1</span>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child\`, {val: ctx['state'].val}, key + \`__1\`, node, ctx);
return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
let b2,b4;
b2 = block2();
if (ctx['state'].hasPortal) {
b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx);
b4 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
}
return multi([b2, b4]);
}
@@ -306,7 +320,7 @@ exports[`Portal conditional use of Portal (with sub Component) 1`] = `
exports[`Portal conditional use of Portal (with sub Component) 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<p><block-text-0/></p>\`);
@@ -320,8 +334,9 @@ exports[`Portal conditional use of Portal (with sub Component) 2`] = `
exports[`Portal conditional use of Portal 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<span>1</span>\`);
let block3 = createBlock(\`<p>2</p>\`);
@@ -334,7 +349,7 @@ exports[`Portal conditional use of Portal 1`] = `
let b2,b4;
b2 = block2();
if (ctx['state'].hasPortal) {
b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
}
return multi([b2, b4]);
}
@@ -344,12 +359,13 @@ exports[`Portal conditional use of Portal 1`] = `
exports[`Portal conditional use of Portal with child and div 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].hasPortal) {
b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
b2 = comp1({}, key + \`__1\`, node, ctx, null);
}
return multi([b2]);
}
@@ -359,9 +375,10 @@ exports[`Portal conditional use of Portal with child and div 1`] = `
exports[`Portal conditional use of Portal with child and div 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>hasPortal</span><block-child-0/></div>\`);
let block3 = createBlock(\`<p>thePortal</p>\`);
@@ -377,7 +394,7 @@ exports[`Portal conditional use of Portal with child and div 2`] = `
ctx[\`elem\`] = v_block2[i1];
const key1 = ctx['elem'];
const ctx1 = capture(ctx);
c_block2[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1);
c_block2[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
}
const b2 = list(c_block2);
return block1([], [b2]);
@@ -388,14 +405,15 @@ exports[`Portal conditional use of Portal with child and div 2`] = `
exports[`Portal conditional use of Portal with child and div, variation 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false);
let block2 = createBlock(\`<div><block-child-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].hasPortal) {
const b3 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
const b3 = comp1({}, key + \`__1\`, node, ctx, null);
b2 = block2([], [b3]);
}
return multi([b2]);
@@ -406,9 +424,10 @@ exports[`Portal conditional use of Portal with child and div, variation 1`] = `
exports[`Portal conditional use of Portal with child and div, variation 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<span>hasPortal</span>\`);
let block4 = createBlock(\`<p>thePortal</p>\`);
@@ -425,7 +444,7 @@ exports[`Portal conditional use of Portal with child and div, variation 2`] = `
ctx[\`elem\`] = v_block3[i1];
const key1 = ctx['elem'];
const ctx1 = capture(ctx);
c_block3[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1);
c_block3[i1] = withKey(comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx, Portal), key1);
}
const b3 = list(c_block3);
return multi([b2, b3]);
@@ -436,8 +455,9 @@ exports[`Portal conditional use of Portal with child and div, variation 2`] = `
exports[`Portal conditional use of Portal with div 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block2 = createBlock(\`<div><span>hasPortal</span><block-child-0/></div>\`);
let block3 = createBlock(\`<p>thePortal</p>\`);
@@ -449,7 +469,7 @@ exports[`Portal conditional use of Portal with div 1`] = `
return function template(ctx, node, key = \\"\\") {
let b2;
if (ctx['state'].hasPortal) {
const b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
b2 = block2([], [b4]);
}
return multi([b2]);
@@ -460,19 +480,21 @@ exports[`Portal conditional use of Portal with div 1`] = `
exports[`Portal lifecycle hooks of portal sub component are properly called 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/><block-child-0/></div>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child\`, {val: ctx['state'].val}, key + \`__1\`, node, ctx);
return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
let b3;
if (ctx['state'].hasChild) {
b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx);
b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
}
return block1([], [b3]);
}
@@ -482,7 +504,7 @@ exports[`Portal lifecycle hooks of portal sub component are properly called 1`]
exports[`Portal lifecycle hooks of portal sub component are properly called 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<span><block-text-0/></span>\`);
@@ -496,8 +518,9 @@ exports[`Portal lifecycle hooks of portal sub component are properly called 2`]
exports[`Portal portal could have dynamically no content 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<span><block-text-0/></span>\`);
@@ -512,7 +535,7 @@ exports[`Portal portal could have dynamically no content 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b4]);
}
}"
@@ -521,17 +544,19 @@ exports[`Portal portal could have dynamically no content 1`] = `
exports[`Portal portal destroys on crash 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child\`, {error: ctx['state'].error}, key + \`__1\`, node, ctx);
return comp1({error: ctx['state'].error}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx);
const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -540,7 +565,7 @@ exports[`Portal portal destroys on crash 1`] = `
exports[`Portal portal destroys on crash 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<span><block-text-0/></span>\`);
@@ -554,17 +579,19 @@ exports[`Portal portal destroys on crash 2`] = `
exports[`Portal portal with child and props 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child\`, {val: ctx['state'].val}, key + \`__1\`, node, ctx);
return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx);
const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -573,7 +600,7 @@ exports[`Portal portal with child and props 1`] = `
exports[`Portal portal with child and props 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<span><block-text-0/></span>\`);
@@ -587,8 +614,9 @@ exports[`Portal portal with child and props 2`] = `
exports[`Portal portal with dynamic body 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<span><block-text-0/></span>\`);
@@ -606,7 +634,7 @@ exports[`Portal portal with dynamic body 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b5 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b5 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b5]);
}
}"
@@ -615,8 +643,9 @@ exports[`Portal portal with dynamic body 1`] = `
exports[`Portal portal with many children 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<div>1</div>\`);
@@ -629,7 +658,7 @@ exports[`Portal portal with many children 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b5 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b5 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b5]);
}
}"
@@ -638,8 +667,9 @@ exports[`Portal portal with many children 1`] = `
exports[`Portal portal with no content 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -652,7 +682,7 @@ exports[`Portal portal with no content 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b4 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b4 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b4]);
}
}"
@@ -661,8 +691,9 @@ exports[`Portal portal with no content 1`] = `
exports[`Portal portal with only text as content 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -671,7 +702,7 @@ exports[`Portal portal with only text as content 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -680,8 +711,9 @@ exports[`Portal portal with only text as content 1`] = `
exports[`Portal portal with target not in dom 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>2</div>\`);
@@ -691,7 +723,7 @@ exports[`Portal portal with target not in dom 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#does-not-exist',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#does-not-exist',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -700,17 +732,19 @@ exports[`Portal portal with target not in dom 1`] = `
exports[`Portal portal's parent's env is not polluted 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child\`, {}, key + \`__1\`, node, ctx);
return comp1({}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx);
const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -719,7 +753,7 @@ exports[`Portal portal's parent's env is not polluted 1`] = `
exports[`Portal portal's parent's env is not polluted 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<button>child</button>\`);
@@ -732,7 +766,8 @@ exports[`Portal portal's parent's env is not polluted 2`] = `
exports[`Portal simple catchError with portal 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Boom\`, true, false, false);
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
@@ -741,7 +776,7 @@ exports[`Portal simple catchError with portal 1`] = `
if (ctx['error']) {
b2 = text(\`Error\`);
} else {
b3 = component(\`Boom\`, {}, key + \`__1\`, node, ctx);
b3 = comp1({}, key + \`__1\`, node, ctx, null);
}
return block1([], [b2, b3]);
}
@@ -751,8 +786,9 @@ exports[`Portal simple catchError with portal 1`] = `
exports[`Portal simple catchError with portal 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p><block-text-0/></p>\`);
@@ -763,7 +799,7 @@ exports[`Portal simple catchError with portal 2`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -772,8 +808,9 @@ exports[`Portal simple catchError with portal 2`] = `
exports[`Portal with target in template (after portal) 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/><div id=\\"local-target\\"/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -783,7 +820,7 @@ exports[`Portal with target in template (after portal) 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -792,8 +829,9 @@ exports[`Portal with target in template (after portal) 1`] = `
exports[`Portal with target in template (before portal) 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><div id=\\"local-target\\"/><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -803,7 +841,7 @@ exports[`Portal with target in template (before portal) 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: '#local-target',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -812,8 +850,9 @@ exports[`Portal with target in template (before portal) 1`] = `
exports[`Portal: Props validation target must be a valid selector 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>2</div>\`);
@@ -823,7 +862,7 @@ exports[`Portal: Props validation target must be a valid selector 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: ' ',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: ' ',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -832,8 +871,9 @@ exports[`Portal: Props validation target must be a valid selector 1`] = `
exports[`Portal: Props validation target must be a valid selector 2 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>2</div>\`);
@@ -843,7 +883,7 @@ exports[`Portal: Props validation target must be a valid selector 2 1`] = `
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: 'aa',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx);
const b3 = comp1({target: 'aa',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__1\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -852,17 +892,19 @@ exports[`Portal: Props validation target must be a valid selector 2 1`] = `
exports[`Portal: UI/UX focus is kept across re-renders 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
function slot1(ctx, node, key = \\"\\") {
return component(\`Child\`, {val: ctx['state'].val}, key + \`__1\`, node, ctx);
return comp1({val: ctx['state'].val}, key + \`__1\`, node, ctx, null);
}
return function template(ctx, node, key = \\"\\") {
const b3 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx);
const b3 = comp2({target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx}}}, key + \`__2\`, node, ctx, Portal);
return block1([], [b3]);
}
}"
@@ -871,7 +913,7 @@ exports[`Portal: UI/UX focus is kept across re-renders 1`] = `
exports[`Portal: UI/UX focus is kept across re-renders 2`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let block1 = createBlock(\`<input id=\\"target-me\\" block-attribute-0=\\"placeholder\\"/>\`);