@barefootjs/cli 0.31.8 → 0.31.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +127 -56
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -3920,8 +3920,8 @@ function templateAttrExpr(attrName, valExpr, presenceOrUndefined) {
|
|
|
3920
3920
|
function escapeAttrValueExpr(valExpr) {
|
|
3921
3921
|
return `escapeAttr(${valExpr})`;
|
|
3922
3922
|
}
|
|
3923
|
-
function escapeTextSlotExpr(innerExpr) {
|
|
3924
|
-
return
|
|
3923
|
+
function escapeTextSlotExpr(innerExpr, isMarkup = false) {
|
|
3924
|
+
return `${isMarkup ? "escapeTextOrMarkup" : "escapeText"}(${innerExpr})`;
|
|
3925
3925
|
}
|
|
3926
3926
|
function dangerouslyHtmlChildren(attrs, toExpr) {
|
|
3927
3927
|
const attr = attrs.find((a) => a.name === "dangerouslySetInnerHTML");
|
|
@@ -4175,7 +4175,7 @@ function irToHtmlTemplate(node, restSpreadNames, loopDepth = 0, loopParams, bran
|
|
|
4175
4175
|
case "jsx-children": {
|
|
4176
4176
|
const hoistedRecurse = (n) => irToHtmlTemplate(n, restSpreadNames, loopDepth, loopParams, branchSlotsVar, true);
|
|
4177
4177
|
const childHtml = p.value.children.map((c) => hoistedRecurse(c)).join("");
|
|
4178
|
-
return `${quotePropName(p.name)}: \`${childHtml}
|
|
4178
|
+
return p.name === "children" ? `${quotePropName(p.name)}: \`${childHtml}\`` : `${quotePropName(p.name)}: bfMarkup(\`${childHtml}\`)`;
|
|
4179
4179
|
}
|
|
4180
4180
|
case "literal":
|
|
4181
4181
|
return `${quotePropName(p.name)}: ${JSON.stringify(p.value.value)}`;
|
|
@@ -4493,6 +4493,9 @@ function irChildrenToJsExpr(children2) {
|
|
|
4493
4493
|
if (exprs.length === 1) return exprs[0];
|
|
4494
4494
|
return `[${exprs.join(", ")}]`;
|
|
4495
4495
|
}
|
|
4496
|
+
function isSingleElementJsxChildren(nodes) {
|
|
4497
|
+
return nodes.length === 1 && nodes[0].type === "element";
|
|
4498
|
+
}
|
|
4496
4499
|
function irNodeToJsExprs(node) {
|
|
4497
4500
|
switch (node.type) {
|
|
4498
4501
|
case "component": {
|
|
@@ -4501,8 +4504,11 @@ function irNodeToJsExprs(node) {
|
|
|
4501
4504
|
return `${quotePropName(p.name)}: ${attrValueToString(p.value) ?? "undefined"}`;
|
|
4502
4505
|
}
|
|
4503
4506
|
switch (p.value.kind) {
|
|
4504
|
-
case "jsx-children":
|
|
4505
|
-
|
|
4507
|
+
case "jsx-children": {
|
|
4508
|
+
const jsxExpr = irChildrenToJsExpr(p.value.children);
|
|
4509
|
+
const wrapped = p.name !== "children" && isSingleElementJsxChildren(p.value.children) ? `bfMarkup(${jsxExpr})` : jsxExpr;
|
|
4510
|
+
return `get ${quotePropName(p.name)}() { return ${wrapped} }`;
|
|
4511
|
+
}
|
|
4506
4512
|
case "literal":
|
|
4507
4513
|
return `get ${quotePropName(p.name)}() { return ${JSON.stringify(p.value.value)} }`;
|
|
4508
4514
|
case "boolean-shorthand":
|
|
@@ -4567,8 +4573,8 @@ function isSingleRootElement(html) {
|
|
|
4567
4573
|
const closingPattern = new RegExp(`</${tag}>\\s*$`);
|
|
4568
4574
|
return closingPattern.test(html.trim());
|
|
4569
4575
|
}
|
|
4570
|
-
function irToComponentTemplate(node, inlinableConstants, restSpreadNames, propsObjectName) {
|
|
4571
|
-
return irToComponentTemplateWithOpts(node, { inlinableConstants, restSpreadNames, propsObjectName, loopDepth: -1 });
|
|
4576
|
+
function irToComponentTemplate(node, inlinableConstants, restSpreadNames, propsObjectName, markupSlotIds) {
|
|
4577
|
+
return irToComponentTemplateWithOpts(node, { inlinableConstants, restSpreadNames, propsObjectName, loopDepth: -1, markupSlotIds });
|
|
4572
4578
|
}
|
|
4573
4579
|
function irToComponentTemplateWithOpts(node, opts) {
|
|
4574
4580
|
const { inlinableConstants, restSpreadNames, propsObjectName, loopDepth = 0 } = opts;
|
|
@@ -4670,7 +4676,8 @@ function irToComponentTemplateWithOpts(node, opts) {
|
|
|
4670
4676
|
const wrapped = transformExpr(node.expr, node.templateExpr);
|
|
4671
4677
|
const value2 = node.joinArrayChild ? `Array.isArray(${wrapped}) ? ${wrapped}.join('') : (${wrapped} ?? '')` : wrapped;
|
|
4672
4678
|
if (node.slotId) {
|
|
4673
|
-
|
|
4679
|
+
const isMarkup = opts.markupSlotIds?.has(node.slotId) ?? false;
|
|
4680
|
+
return `<!--bf:${node.slotId}-->\${${node.joinArrayChild ? value2 : escapeTextSlotExpr(wrapped, isMarkup)}}<!--/-->`;
|
|
4674
4681
|
}
|
|
4675
4682
|
return `\${${value2}}`;
|
|
4676
4683
|
}
|
|
@@ -4696,7 +4703,7 @@ function irToComponentTemplateWithOpts(node, opts) {
|
|
|
4696
4703
|
case "jsx-children": {
|
|
4697
4704
|
const hoistedRecurse = (n) => irToComponentTemplateWithOpts(n, { ...opts, inHoistedChildren: true });
|
|
4698
4705
|
const childHtml = p.value.children.map((c) => hoistedRecurse(c)).join("");
|
|
4699
|
-
return `${quotePropName(p.name)}: \`${childHtml}
|
|
4706
|
+
return p.name === "children" ? `${quotePropName(p.name)}: \`${childHtml}\`` : `${quotePropName(p.name)}: bfMarkup(\`${childHtml}\`)`;
|
|
4700
4707
|
}
|
|
4701
4708
|
case "literal":
|
|
4702
4709
|
return `${quotePropName(p.name)}: ${JSON.stringify(p.value.value)}`;
|
|
@@ -4811,7 +4818,8 @@ function generateCsrTemplate(node, inlinableConstants, ctx2, restSpreadNames, pr
|
|
|
4811
4818
|
}
|
|
4812
4819
|
}
|
|
4813
4820
|
const effectiveUnsafeLocalNames = mergeCsrNullUnsafe(ctx2, unsafeLocalNames);
|
|
4814
|
-
|
|
4821
|
+
const markupSlotIds = new Set(ctx2.dynamicElements.map((e) => e.slotId));
|
|
4822
|
+
return generateCsrTemplateWithOpts(node, { inlinableConstants, restSpreadNames, propsObjectName, csrEnv, unsafeLocalNames: effectiveUnsafeLocalNames, deferredChildSlots, loopDepth: -1, markupSlotIds });
|
|
4815
4823
|
}
|
|
4816
4824
|
function mergeCsrNullUnsafe(ctx2, unsafeLocalNames) {
|
|
4817
4825
|
let merged = null;
|
|
@@ -4975,7 +4983,8 @@ function generateCsrTemplateWithOpts(node, opts) {
|
|
|
4975
4983
|
const expr = transformed === UNSAFE_TEMPLATE_EXPR ? "''" : transformed;
|
|
4976
4984
|
const value2 = node.joinArrayChild ? `Array.isArray(${expr}) ? ${expr}.join('') : (${expr} ?? '')` : expr;
|
|
4977
4985
|
if (node.slotId) {
|
|
4978
|
-
|
|
4986
|
+
const isMarkup = opts.markupSlotIds?.has(node.slotId) ?? false;
|
|
4987
|
+
return `<!--bf:${node.slotId}-->\${${node.joinArrayChild ? value2 : escapeTextSlotExpr(expr, isMarkup)}}<!--/-->`;
|
|
4979
4988
|
}
|
|
4980
4989
|
return `\${${value2}}`;
|
|
4981
4990
|
}
|
|
@@ -5004,7 +5013,7 @@ function generateCsrTemplateWithOpts(node, opts) {
|
|
|
5004
5013
|
case "jsx-children": {
|
|
5005
5014
|
const hoistedRecurse = (n) => generateCsrTemplateWithOpts(n, { ...opts, inHoistedChildren: true });
|
|
5006
5015
|
const childHtml = p.value.children.map((c) => hoistedRecurse(c)).join("");
|
|
5007
|
-
return `${quotePropName(p.name)}: \`${childHtml}
|
|
5016
|
+
return p.name === "children" ? `${quotePropName(p.name)}: \`${childHtml}\`` : `${quotePropName(p.name)}: bfMarkup(\`${childHtml}\`)`;
|
|
5008
5017
|
}
|
|
5009
5018
|
case "literal":
|
|
5010
5019
|
return `${quotePropName(p.name)}: ${JSON.stringify(p.value.value)}`;
|
|
@@ -14629,22 +14638,52 @@ var init_reactivity = __esm({
|
|
|
14629
14638
|
});
|
|
14630
14639
|
|
|
14631
14640
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/template-parse.ts
|
|
14632
|
-
function
|
|
14641
|
+
function namespaceForTag(tag) {
|
|
14642
|
+
if (SVG_ROOT_TAGS.has(tag) || SVG_ROOT_TAGS.has(tag.toLowerCase())) return "svg";
|
|
14643
|
+
if (MATHML_ROOT_TAGS.has(tag) || MATHML_ROOT_TAGS.has(tag.toLowerCase())) return "math";
|
|
14644
|
+
return null;
|
|
14645
|
+
}
|
|
14646
|
+
function detectRootNamespaceWrapTag(template) {
|
|
14633
14647
|
const stripped = stripLeadingNonContent(template);
|
|
14634
14648
|
const m = stripped.match(/^<\s*([A-Za-z][A-Za-z0-9-]*)/);
|
|
14635
|
-
if (m)
|
|
14636
|
-
const tag = m[1];
|
|
14637
|
-
if (SVG_ROOT_TAGS.has(tag)) return true;
|
|
14638
|
-
return SVG_ROOT_TAGS.has(tag.toLowerCase());
|
|
14639
|
-
}
|
|
14649
|
+
if (m) return namespaceForTag(m[1]);
|
|
14640
14650
|
const branches = extractConditionalBranchTemplates(stripped);
|
|
14641
|
-
if (branches === null || branches.length === 0) return
|
|
14642
|
-
|
|
14651
|
+
if (branches === null || branches.length === 0) return null;
|
|
14652
|
+
let result2;
|
|
14653
|
+
for (const branch of branches) {
|
|
14654
|
+
const branchNs = detectRootNamespaceWrapTag(branch);
|
|
14655
|
+
if (result2 === void 0) {
|
|
14656
|
+
result2 = branchNs;
|
|
14657
|
+
} else if (result2 !== branchNs) {
|
|
14658
|
+
return null;
|
|
14659
|
+
}
|
|
14660
|
+
}
|
|
14661
|
+
return result2 ?? null;
|
|
14643
14662
|
}
|
|
14644
|
-
function
|
|
14663
|
+
function multiRootTemplateNeedsNamespaceWrap(template) {
|
|
14645
14664
|
const m = stripLeadingNonContent(template).match(/^<\s*([A-Za-z][A-Za-z0-9-]*)/);
|
|
14646
|
-
if (m
|
|
14647
|
-
|
|
14665
|
+
if (m) {
|
|
14666
|
+
const tagLower = m[1].toLowerCase();
|
|
14667
|
+
if (tagLower === "svg" || tagLower === "math") return null;
|
|
14668
|
+
}
|
|
14669
|
+
return detectRootNamespaceWrapTag(template);
|
|
14670
|
+
}
|
|
14671
|
+
function namespaceWrapForTemplate(template) {
|
|
14672
|
+
const wrapTag = detectRootNamespaceWrapTag(template);
|
|
14673
|
+
return {
|
|
14674
|
+
wrapTag,
|
|
14675
|
+
childPath: wrapTag ? ".firstElementChild.firstElementChild" : ".firstElementChild"
|
|
14676
|
+
};
|
|
14677
|
+
}
|
|
14678
|
+
function multiRootNamespaceWrapForTemplate(template) {
|
|
14679
|
+
const wrapTag = multiRootTemplateNeedsNamespaceWrap(template);
|
|
14680
|
+
return {
|
|
14681
|
+
wrapTag,
|
|
14682
|
+
childPath: wrapTag ? ".firstElementChild" : ""
|
|
14683
|
+
};
|
|
14684
|
+
}
|
|
14685
|
+
function wrapHtmlForNamespace(html, wrapTag) {
|
|
14686
|
+
return wrapTag ? `<${wrapTag}>${html}</${wrapTag}>` : html;
|
|
14648
14687
|
}
|
|
14649
14688
|
function stripLeadingNonContent(template) {
|
|
14650
14689
|
let s = template.trimStart();
|
|
@@ -14665,32 +14704,26 @@ function extractConditionalBranchTemplates(template) {
|
|
|
14665
14704
|
return findTopLevelTemplateLiterals(expr);
|
|
14666
14705
|
}
|
|
14667
14706
|
function emitTemplateCloneInline(template) {
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
}
|
|
14671
|
-
return `const __tpl = document.createElement('template'); __tpl.innerHTML = \`${template}\`; return __tpl.content.firstElementChild.cloneNode(true)`;
|
|
14707
|
+
const { wrapTag, childPath } = namespaceWrapForTemplate(template);
|
|
14708
|
+
const html = wrapHtmlForNamespace(template, wrapTag);
|
|
14709
|
+
return `const __tpl = document.createElement('template'); __tpl.innerHTML = \`${html}\`; return __tpl.content${childPath}.cloneNode(true)`;
|
|
14672
14710
|
}
|
|
14673
14711
|
function emitHoistedTemplateDecl(lines, indent, tplVar, skeletonTemplate) {
|
|
14674
|
-
const
|
|
14675
|
-
const html =
|
|
14712
|
+
const { wrapTag } = namespaceWrapForTemplate(skeletonTemplate);
|
|
14713
|
+
const html = wrapHtmlForNamespace(skeletonTemplate, wrapTag);
|
|
14676
14714
|
lines.push(`${indent}const ${tplVar} = document.createElement('template')`);
|
|
14677
14715
|
lines.push(`${indent}${tplVar}.innerHTML = \`${html}\``);
|
|
14678
14716
|
}
|
|
14679
14717
|
function hoistedCloneExpr(tplVar, skeletonTemplate) {
|
|
14680
|
-
return
|
|
14718
|
+
return `${tplVar}.content${namespaceWrapForTemplate(skeletonTemplate).childPath}.cloneNode(true)`;
|
|
14681
14719
|
}
|
|
14682
14720
|
function emitTemplateCloneLines(template, indent) {
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
`${indent}const __tpl = document.createElement('template')`,
|
|
14686
|
-
`${indent}__tpl.innerHTML = \`<svg>${template}</svg>\``,
|
|
14687
|
-
`${indent}return __tpl.content.firstElementChild.firstElementChild.cloneNode(true)`
|
|
14688
|
-
];
|
|
14689
|
-
}
|
|
14721
|
+
const { wrapTag, childPath } = namespaceWrapForTemplate(template);
|
|
14722
|
+
const html = wrapHtmlForNamespace(template, wrapTag);
|
|
14690
14723
|
return [
|
|
14691
14724
|
`${indent}const __tpl = document.createElement('template')`,
|
|
14692
|
-
`${indent}__tpl.innerHTML = \`${
|
|
14693
|
-
`${indent}return __tpl.content.
|
|
14725
|
+
`${indent}__tpl.innerHTML = \`${html}\``,
|
|
14726
|
+
`${indent}return __tpl.content${childPath}.cloneNode(true)`
|
|
14694
14727
|
];
|
|
14695
14728
|
}
|
|
14696
14729
|
function emitLoopItemElementSetup(lines, opts) {
|
|
@@ -14720,9 +14753,9 @@ function emitLoopItemElementSetup(lines, opts) {
|
|
|
14720
14753
|
lines.push(`${indent}})()${mountRow ? ")" : ""}`);
|
|
14721
14754
|
}
|
|
14722
14755
|
function emitMultiRootTemplateCloneLines(template, indent, varEl, varExtras) {
|
|
14723
|
-
const
|
|
14724
|
-
const innerHtmlExpr =
|
|
14725
|
-
const parentExpr =
|
|
14756
|
+
const { wrapTag, childPath } = multiRootNamespaceWrapForTemplate(template);
|
|
14757
|
+
const innerHtmlExpr = `\`${wrapHtmlForNamespace(template, wrapTag)}\``;
|
|
14758
|
+
const parentExpr = `__tpl.content${childPath}`;
|
|
14726
14759
|
return [
|
|
14727
14760
|
`${indent}const __tpl = document.createElement('template')`,
|
|
14728
14761
|
`${indent}__tpl.innerHTML = ${innerHtmlExpr}`,
|
|
@@ -14731,7 +14764,7 @@ function emitMultiRootTemplateCloneLines(template, indent, varEl, varExtras) {
|
|
|
14731
14764
|
`${indent}{ let __sib = ${parentExpr}.firstElementChild.nextElementSibling; while (__sib) { ${varExtras}.push(__sib.cloneNode(true)); __sib = __sib.nextElementSibling } }`
|
|
14732
14765
|
];
|
|
14733
14766
|
}
|
|
14734
|
-
var SVG_ROOT_TAGS;
|
|
14767
|
+
var SVG_ROOT_TAGS, MATHML_ROOT_TAGS;
|
|
14735
14768
|
var init_template_parse = __esm({
|
|
14736
14769
|
"../jsx/src/ir-to-client-js/control-flow/stringify/template-parse.ts"() {
|
|
14737
14770
|
"use strict";
|
|
@@ -14777,6 +14810,34 @@ var init_template_parse = __esm({
|
|
|
14777
14810
|
"animateTransform",
|
|
14778
14811
|
"animateMotion"
|
|
14779
14812
|
]);
|
|
14813
|
+
MATHML_ROOT_TAGS = /* @__PURE__ */ new Set([
|
|
14814
|
+
"math",
|
|
14815
|
+
"mrow",
|
|
14816
|
+
"mfrac",
|
|
14817
|
+
"msup",
|
|
14818
|
+
"msub",
|
|
14819
|
+
"msubsup",
|
|
14820
|
+
"mn",
|
|
14821
|
+
"mi",
|
|
14822
|
+
"mo",
|
|
14823
|
+
"mtext",
|
|
14824
|
+
"munder",
|
|
14825
|
+
"mover",
|
|
14826
|
+
"munderover",
|
|
14827
|
+
"mtable",
|
|
14828
|
+
"mtr",
|
|
14829
|
+
"mtd",
|
|
14830
|
+
"msqrt",
|
|
14831
|
+
"mroot",
|
|
14832
|
+
"mstyle",
|
|
14833
|
+
"merror",
|
|
14834
|
+
"mpadded",
|
|
14835
|
+
"mphantom",
|
|
14836
|
+
"menclose",
|
|
14837
|
+
"semantics",
|
|
14838
|
+
"annotation",
|
|
14839
|
+
"annotation-xml"
|
|
14840
|
+
]);
|
|
14780
14841
|
}
|
|
14781
14842
|
});
|
|
14782
14843
|
|
|
@@ -14991,6 +15052,9 @@ function jsxChildrenContainComponent(nodes) {
|
|
|
14991
15052
|
}
|
|
14992
15053
|
return false;
|
|
14993
15054
|
}
|
|
15055
|
+
function isSingleElementJsxChildren2(nodes) {
|
|
15056
|
+
return nodes.length === 1 && nodes[0].type === "element";
|
|
15057
|
+
}
|
|
14994
15058
|
function buildRestSpreadNames(ctx2) {
|
|
14995
15059
|
const names = /* @__PURE__ */ new Set();
|
|
14996
15060
|
if (ctx2.restPropsName) names.add(ctx2.restPropsName);
|
|
@@ -15022,6 +15086,8 @@ function buildComponentPropsExpr(props, ctx2) {
|
|
|
15022
15086
|
const jsxExpr = irChildrenToJsExpr(prop.value.children);
|
|
15023
15087
|
if (jsxChildrenContainComponent(prop.value.children)) {
|
|
15024
15088
|
propsForInit.push(`get ${quotePropName(prop.name)}() { return __slot(() => ${jsxExpr}) }`);
|
|
15089
|
+
} else if (prop.name !== "children" && isSingleElementJsxChildren2(prop.value.children)) {
|
|
15090
|
+
propsForInit.push(`get ${quotePropName(prop.name)}() { return bfMarkup(${jsxExpr}) }`);
|
|
15025
15091
|
} else {
|
|
15026
15092
|
propsForInit.push(`get ${quotePropName(prop.name)}() { return ${jsxExpr} }`);
|
|
15027
15093
|
}
|
|
@@ -15154,7 +15220,7 @@ function collectElements(node, ctx2, siblingOffsets, insideConditional = false)
|
|
|
15154
15220
|
reactiveTextSlotIds: new Set(bindings.reactiveTexts.map((t) => t.slotId))
|
|
15155
15221
|
};
|
|
15156
15222
|
skeletonTemplate = buildLoopSkeletonTemplate(l.children[0], skeletonSafeSlots) ?? void 0;
|
|
15157
|
-
if (skeletonTemplate && !
|
|
15223
|
+
if (skeletonTemplate && !detectRootNamespaceWrapTag(skeletonTemplate)) {
|
|
15158
15224
|
skeletonPaths = computeSkeletonSlotPaths(l.children[0], skeletonSafeSlots) ?? void 0;
|
|
15159
15225
|
}
|
|
15160
15226
|
}
|
|
@@ -16243,6 +16309,11 @@ var init_imports = __esm({
|
|
|
16243
16309
|
"escapeAttr",
|
|
16244
16310
|
"escapeText",
|
|
16245
16311
|
"escapeTextOrNode",
|
|
16312
|
+
// JSX-element-as-non-children-prop markup brand (#2651) — `bfMarkup` wraps
|
|
16313
|
+
// the compiler-built HTML at the producer (renderChild / initChild props);
|
|
16314
|
+
// `escapeTextOrMarkup` unwraps it at the claim-plan-'markup' template slot.
|
|
16315
|
+
"bfMarkup",
|
|
16316
|
+
"escapeTextOrMarkup",
|
|
16246
16317
|
"qsa",
|
|
16247
16318
|
"qsaItem",
|
|
16248
16319
|
"qsaChildScope",
|
|
@@ -17154,7 +17225,8 @@ function emitRegistrationAndHydration(lines, ctx2, _ir, graph, inlinability) {
|
|
|
17154
17225
|
const isCommentScope = _ir.root.type === "fragment" && _ir.root.needsScopeComment || _ir.root.type === "component";
|
|
17155
17226
|
const defParts = [`init: init${name2}`];
|
|
17156
17227
|
if (canGenerateStaticTemplate(_ir.root, propNamesForStaticCheck, inlinableConstants, unsafeLocalNames)) {
|
|
17157
|
-
const
|
|
17228
|
+
const markupSlotIds = new Set(ctx2.dynamicElements.map((e) => e.slotId));
|
|
17229
|
+
const templateHtml = irToComponentTemplate(_ir.root, inlinableConstants, restSpreadNames, ctx2.propsObjectName, markupSlotIds);
|
|
17158
17230
|
if (templateHtml) {
|
|
17159
17231
|
defParts.push(buildTemplateDefPart(ctx2, templateHtml));
|
|
17160
17232
|
}
|
|
@@ -20613,9 +20685,8 @@ function stringifyBranchInnerLoops(lines, plan, indent, pc) {
|
|
|
20613
20685
|
lines.push(`${indent} ${inner.paramUnwrap}`);
|
|
20614
20686
|
}
|
|
20615
20687
|
{
|
|
20616
|
-
const
|
|
20617
|
-
const innerHtml =
|
|
20618
|
-
const childPath = isSvg ? ".firstElementChild.firstElementChild" : ".firstElementChild";
|
|
20688
|
+
const { wrapTag, childPath } = namespaceWrapForTemplate(inner.wrappedTemplate);
|
|
20689
|
+
const innerHtml = wrapTag ? `<${wrapTag}>${inner.wrappedTemplate}</${wrapTag}>` : inner.wrappedTemplate;
|
|
20619
20690
|
lines.push(`${indent} let __bel${uid} = __existing ?? (() => { const __t = document.createElement('template'); __t.innerHTML = \`${innerHtml}\`; return __t.content${childPath}.cloneNode(true) })()`);
|
|
20620
20691
|
}
|
|
20621
20692
|
if (inner.wrappedKey) {
|
|
@@ -21377,14 +21448,14 @@ function stringifyStaticLoop(lines, plan) {
|
|
|
21377
21448
|
lines.push(` let __iterEl = ${containerVar}.children[${childIndexExpr}]`);
|
|
21378
21449
|
if (csrMaterialize) {
|
|
21379
21450
|
lines.push(` if (!__iterEl) {`);
|
|
21380
|
-
const
|
|
21381
|
-
const itemHtml =
|
|
21451
|
+
const { wrapTag, childPath } = csrMaterialize.bodyIsMultiRoot ? multiRootNamespaceWrapForTemplate(csrMaterialize.itemTemplate) : namespaceWrapForTemplate(csrMaterialize.itemTemplate);
|
|
21452
|
+
const itemHtml = wrapHtmlForNamespace(csrMaterialize.itemTemplate, wrapTag);
|
|
21382
21453
|
if (csrMaterialize.bodyIsMultiRoot) {
|
|
21383
21454
|
lines.push(` const __mtpl = document.createElement('template')`);
|
|
21384
21455
|
lines.push(` __mtpl.innerHTML = \`${itemHtml}\``);
|
|
21385
21456
|
lines.push(` const __anchor = ${containerVar}.children[${childIndexExpr}] ?? null`);
|
|
21386
21457
|
lines.push(` let __first = null`);
|
|
21387
|
-
lines.push(` let __sib = __mtpl.content${
|
|
21458
|
+
lines.push(` let __sib = __mtpl.content${childPath}.firstElementChild`);
|
|
21388
21459
|
lines.push(` while (__sib) {`);
|
|
21389
21460
|
lines.push(` const __next = __sib.nextElementSibling`);
|
|
21390
21461
|
lines.push(` const __cloned = __sib.cloneNode(true)`);
|
|
@@ -21396,7 +21467,7 @@ function stringifyStaticLoop(lines, plan) {
|
|
|
21396
21467
|
} else {
|
|
21397
21468
|
lines.push(` const __tpl = document.createElement('template')`);
|
|
21398
21469
|
lines.push(` __tpl.innerHTML = \`${itemHtml}\``);
|
|
21399
|
-
lines.push(` const __cloned = __tpl.content${
|
|
21470
|
+
lines.push(` const __cloned = __tpl.content${childPath}`);
|
|
21400
21471
|
lines.push(` if (__cloned) {`);
|
|
21401
21472
|
lines.push(` const __anchor = ${containerVar}.children[${childIndexExpr}] ?? null`);
|
|
21402
21473
|
lines.push(` ${containerVar}.insertBefore(__cloned, __anchor)`);
|
|
@@ -21478,9 +21549,8 @@ function emitReactive(lines, inner, indent, pc) {
|
|
|
21478
21549
|
lines.push(`${innerIndent} __innerEl${uid}.__bfExtras = __innerExtras${uid}`);
|
|
21479
21550
|
lines.push(`${indent} }`);
|
|
21480
21551
|
} else {
|
|
21481
|
-
const
|
|
21482
|
-
const innerHtml =
|
|
21483
|
-
const childPath = isSvg ? ".firstElementChild.firstElementChild" : ".firstElementChild";
|
|
21552
|
+
const { wrapTag, childPath } = namespaceWrapForTemplate(emit.wrappedTemplate);
|
|
21553
|
+
const innerHtml = wrapTag ? `<${wrapTag}>${emit.wrappedTemplate}</${wrapTag}>` : emit.wrappedTemplate;
|
|
21484
21554
|
lines.push(`${indent} let __innerEl${uid} = __existing ?? (() => { const __t = document.createElement('template'); __t.innerHTML = \`${innerHtml}\`; return __t.content${childPath}.cloneNode(true) })()`);
|
|
21485
21555
|
}
|
|
21486
21556
|
if (emit.wrappedKey) {
|
|
@@ -22985,7 +23055,8 @@ function generateTemplateOnlyMount(ir, ctx2) {
|
|
|
22985
23055
|
if (ctx2.propsObjectName) restSpreadNames.add(ctx2.propsObjectName);
|
|
22986
23056
|
let templateHtml;
|
|
22987
23057
|
if (canGenerateStaticTemplate(ir.root, propNamesForStaticCheck, inlinableConstants, unsafeLocalNames)) {
|
|
22988
|
-
|
|
23058
|
+
const markupSlotIds = new Set(ctx2.dynamicElements.map((e) => e.slotId));
|
|
23059
|
+
templateHtml = irToComponentTemplate(ir.root, inlinableConstants, restSpreadNames, ctx2.propsObjectName, markupSlotIds);
|
|
22989
23060
|
}
|
|
22990
23061
|
if (!templateHtml) {
|
|
22991
23062
|
const csrInlinableConstants = csrInlinableConstantsFromCtx(ctx2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/cli",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.9",
|
|
4
4
|
"description": "CLI for agent-driven UI component discovery and scaffolding",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"esbuild": "^0.25.0",
|
|
31
31
|
"typescript": "^5.0.0",
|
|
32
32
|
"vite": "^6.0.0",
|
|
33
|
-
"@barefootjs/client": "0.31.
|
|
34
|
-
"@barefootjs/shared": "0.31.
|
|
33
|
+
"@barefootjs/client": "0.31.9",
|
|
34
|
+
"@barefootjs/shared": "0.31.9"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@barefootjs/jsx": "0.31.
|
|
38
|
-
"@barefootjs/vite": "0.31.
|
|
37
|
+
"@barefootjs/jsx": "0.31.9",
|
|
38
|
+
"@barefootjs/vite": "0.31.9",
|
|
39
39
|
"@happy-dom/global-registrator": "^20.0.11",
|
|
40
40
|
"@types/node": "^22.0.0",
|
|
41
41
|
"happy-dom": "^20.0.11"
|