@barefootjs/jsx 0.5.2 → 0.5.3
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/combine-client-js.d.ts.map +1 -1
- package/dist/index.js +176 -51
- package/dist/ir-to-client-js/collect-elements.d.ts +26 -14
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts +8 -3
- package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-reactive.d.ts.map +1 -1
- package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
- package/dist/ir-to-client-js/imports.d.ts +2 -2
- package/dist/ir-to-client-js/imports.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts +3 -3
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/types.d.ts +26 -4
- package/dist/ir-to-client-js/types.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +19 -1
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +203 -203
- package/src/__tests__/child-components-in-map.test.ts +333 -0
- package/src/__tests__/combine-client-js.test.ts +47 -0
- package/src/__tests__/dangerously-set-inner-html.test.ts +82 -0
- package/src/__tests__/static-loop-csr-materialize.test.ts +6 -4
- package/src/__tests__/text-slot-escaping.test.ts +56 -0
- package/src/combine-client-js.ts +66 -22
- package/src/ir-to-client-js/collect-elements.ts +170 -32
- package/src/ir-to-client-js/control-flow/plan/build-event-delegation.ts +1 -1
- package/src/ir-to-client-js/control-flow/plan/build-loop.ts +2 -1
- package/src/ir-to-client-js/control-flow/plan/event-delegation.ts +8 -3
- package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +3 -3
- package/src/ir-to-client-js/emit-reactive.ts +9 -0
- package/src/ir-to-client-js/html-template.ts +82 -10
- package/src/ir-to-client-js/imports.ts +1 -1
- package/src/ir-to-client-js/plan/build-static-array-child-init.ts +4 -8
- package/src/ir-to-client-js/plan/static-array-child-init.ts +3 -3
- package/src/ir-to-client-js/types.ts +27 -4
- package/src/ir-to-client-js/utils.ts +41 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine-client-js.d.ts","sourceRoot":"","sources":["../src/combine-client-js.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"combine-client-js.d.ts","sourceRoot":"","sources":["../src/combine-client-js.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA2ErB"}
|
package/dist/index.js
CHANGED
|
@@ -273,6 +273,21 @@ function buildChainedArrayExpr(elem) {
|
|
|
273
273
|
chainOrder: elem.chainOrder
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
+
function loopOffsetTerms(offset) {
|
|
277
|
+
if (!offset)
|
|
278
|
+
return [];
|
|
279
|
+
const terms = [];
|
|
280
|
+
if (offset.staticCount)
|
|
281
|
+
terms.push(String(offset.staticCount));
|
|
282
|
+
terms.push(...offset.dynamicTerms);
|
|
283
|
+
return terms;
|
|
284
|
+
}
|
|
285
|
+
function buildLoopChildIndexExpr(indexParam, offset) {
|
|
286
|
+
return [indexParam, ...loopOffsetTerms(offset)].join(" + ");
|
|
287
|
+
}
|
|
288
|
+
function buildLoopChildIndexSubtraction(offset) {
|
|
289
|
+
return loopOffsetTerms(offset).map((term) => ` - ${term}`).join("");
|
|
290
|
+
}
|
|
276
291
|
var jsxToDomEventMap = {
|
|
277
292
|
doubleclick: "dblclick"
|
|
278
293
|
};
|
|
@@ -1036,16 +1051,30 @@ function maybeHoistedScopeAttr(inHoistedChildren, node) {
|
|
|
1036
1051
|
}
|
|
1037
1052
|
var UNSAFE_TEMPLATE_EXPR = "undefined";
|
|
1038
1053
|
function templateAttrExpr(attrName, valExpr, presenceOrUndefined) {
|
|
1054
|
+
if (attrName === "dangerouslySetInnerHTML")
|
|
1055
|
+
return "";
|
|
1039
1056
|
if (isBooleanAttr(attrName) || presenceOrUndefined) {
|
|
1040
1057
|
return `\${${valExpr} ? '${attrName}' : ''}`;
|
|
1041
1058
|
}
|
|
1042
1059
|
if (attrName === "style") {
|
|
1043
|
-
return `\${((v) => v != null ? 'style="' + v + '"' : '')(styleToCss(${valExpr}))}`;
|
|
1060
|
+
return `\${((v) => v != null ? 'style="' + ${escapeAttrValueExpr("v")} + '"' : '')(styleToCss(${valExpr}))}`;
|
|
1044
1061
|
}
|
|
1045
1062
|
if (attrName === "data-key" || attrName.startsWith("data-key-")) {
|
|
1046
1063
|
return `${attrName}="\${${valExpr}}"`;
|
|
1047
1064
|
}
|
|
1048
|
-
return `\${(${valExpr}) != null ? '${attrName}="' +
|
|
1065
|
+
return `\${(${valExpr}) != null ? '${attrName}="' + ${escapeAttrValueExpr(valExpr)} + '"' : ''}`;
|
|
1066
|
+
}
|
|
1067
|
+
function escapeAttrValueExpr(valExpr) {
|
|
1068
|
+
return `escapeAttr(${valExpr})`;
|
|
1069
|
+
}
|
|
1070
|
+
function escapeTextSlotExpr(innerExpr) {
|
|
1071
|
+
return `escapeText(${innerExpr})`;
|
|
1072
|
+
}
|
|
1073
|
+
function dangerouslyHtmlChildren(attrs, toExpr) {
|
|
1074
|
+
const attr = attrs.find((a) => a.name === "dangerouslySetInnerHTML");
|
|
1075
|
+
if (!attr || attr.value.kind !== "expression")
|
|
1076
|
+
return null;
|
|
1077
|
+
return `\${((${toExpr(attr.value)}) ?? {}).__html ?? ''}`;
|
|
1049
1078
|
}
|
|
1050
1079
|
function transformKeyValue(value, transformExpr) {
|
|
1051
1080
|
switch (value.kind) {
|
|
@@ -1093,6 +1122,8 @@ function isMergeableAttr(a, ctx) {
|
|
|
1093
1122
|
return false;
|
|
1094
1123
|
if (a.name === "key")
|
|
1095
1124
|
return false;
|
|
1125
|
+
if (a.name === "dangerouslySetInnerHTML")
|
|
1126
|
+
return false;
|
|
1096
1127
|
const v = a.value;
|
|
1097
1128
|
if (v.kind === "jsx-children")
|
|
1098
1129
|
return false;
|
|
@@ -1191,7 +1222,7 @@ function irToHtmlTemplate(node, restSpreadNames, loopDepth = 0, loopParams, bran
|
|
|
1191
1222
|
}
|
|
1192
1223
|
const attrs = attrParts.join(" ");
|
|
1193
1224
|
const childrenRecurse = (n) => irToHtmlTemplate(n, restSpreadNames, loopDepth, loopParams, branchSlotsVar, insideLoop, false);
|
|
1194
|
-
const children = node.children.map(childrenRecurse).join("");
|
|
1225
|
+
const children = dangerouslyHtmlChildren(node.attrs, (v) => wrapExpr(v.expr)) ?? node.children.map(childrenRecurse).join("");
|
|
1195
1226
|
if (children || !VOID_ELEMENTS.has(node.tag)) {
|
|
1196
1227
|
return `<${node.tag}${attrs ? " " + attrs : ""}>${children}</${node.tag}>`;
|
|
1197
1228
|
}
|
|
@@ -1203,7 +1234,9 @@ function irToHtmlTemplate(node, restSpreadNames, loopDepth = 0, loopParams, bran
|
|
|
1203
1234
|
if (node.expr === "null" || node.expr === "undefined")
|
|
1204
1235
|
return "";
|
|
1205
1236
|
if (node.slotId) {
|
|
1206
|
-
|
|
1237
|
+
const inner = wrapInterpolation(wrapExpr(node.expr));
|
|
1238
|
+
const slotted = branchSlotsVar ? inner : escapeTextSlotExpr(inner);
|
|
1239
|
+
return `<!--bf:${node.slotId}-->\${${slotted}}<!--/-->`;
|
|
1207
1240
|
}
|
|
1208
1241
|
return `\${${wrapInterpolation(wrapExpr(node.expr))}}`;
|
|
1209
1242
|
case "conditional": {
|
|
@@ -1301,7 +1334,7 @@ function irToPlaceholderTemplate(node, restSpreadNames, loopDepth = 0, loopParam
|
|
|
1301
1334
|
attrParts.push(`bf="${node.slotId}"`);
|
|
1302
1335
|
}
|
|
1303
1336
|
const attrs = attrParts.join(" ");
|
|
1304
|
-
const children = node.children.map(recurse).join("");
|
|
1337
|
+
const children = dangerouslyHtmlChildren(node.attrs, (v) => wrapExpr(v.expr)) ?? node.children.map(recurse).join("");
|
|
1305
1338
|
if (children || !VOID_ELEMENTS.has(node.tag)) {
|
|
1306
1339
|
return `<${node.tag}${attrs ? " " + attrs : ""}>${children}</${node.tag}>`;
|
|
1307
1340
|
}
|
|
@@ -1313,7 +1346,7 @@ function irToPlaceholderTemplate(node, restSpreadNames, loopDepth = 0, loopParam
|
|
|
1313
1346
|
if (node.expr === "null" || node.expr === "undefined")
|
|
1314
1347
|
return "";
|
|
1315
1348
|
if (node.slotId) {
|
|
1316
|
-
return `<!--bf:${node.slotId}-->\${${wrapExpr(node.expr)}}<!--/-->`;
|
|
1349
|
+
return `<!--bf:${node.slotId}-->\${${escapeTextSlotExpr(wrapExpr(node.expr))}}<!--/-->`;
|
|
1317
1350
|
}
|
|
1318
1351
|
return `\${${wrapExpr(node.expr)}}`;
|
|
1319
1352
|
case "conditional": {
|
|
@@ -1529,7 +1562,7 @@ function irToComponentTemplateWithOpts(node, opts) {
|
|
|
1529
1562
|
attrParts.push(`bf="${node.slotId}"`);
|
|
1530
1563
|
}
|
|
1531
1564
|
const attrs = attrParts.join(" ");
|
|
1532
|
-
const children = node.children.map(childrenRecurse).join("");
|
|
1565
|
+
const children = dangerouslyHtmlChildren(node.attrs, (v) => transformExpr(v.expr, v.templateExpr)) ?? node.children.map(childrenRecurse).join("");
|
|
1533
1566
|
if (children || !VOID_ELEMENTS.has(node.tag)) {
|
|
1534
1567
|
return `<${node.tag}${attrs ? " " + attrs : ""}>${children}</${node.tag}>`;
|
|
1535
1568
|
}
|
|
@@ -1541,7 +1574,7 @@ function irToComponentTemplateWithOpts(node, opts) {
|
|
|
1541
1574
|
if (node.expr === "null" || node.expr === "undefined")
|
|
1542
1575
|
return "";
|
|
1543
1576
|
if (node.slotId) {
|
|
1544
|
-
return `<!--bf:${node.slotId}-->\${${transformExpr(node.expr, node.templateExpr)}}<!--/-->`;
|
|
1577
|
+
return `<!--bf:${node.slotId}-->\${${escapeTextSlotExpr(transformExpr(node.expr, node.templateExpr))}}<!--/-->`;
|
|
1545
1578
|
}
|
|
1546
1579
|
return `\${${transformExpr(node.expr, node.templateExpr)}}`;
|
|
1547
1580
|
case "conditional": {
|
|
@@ -1755,7 +1788,7 @@ function generateCsrTemplateWithOpts(node, opts) {
|
|
|
1755
1788
|
attrParts.push(`bf="${node.slotId}"`);
|
|
1756
1789
|
}
|
|
1757
1790
|
const attrs = attrParts.join(" ");
|
|
1758
|
-
const children = node.children.map(childrenRecurse).join("");
|
|
1791
|
+
const children = dangerouslyHtmlChildren(node.attrs, (v) => transformExpr(v.expr, v.templateExpr)) ?? node.children.map(childrenRecurse).join("");
|
|
1759
1792
|
if (children || !VOID_ELEMENTS.has(node.tag)) {
|
|
1760
1793
|
return `<${node.tag}${attrs ? " " + attrs : ""}>${children}</${node.tag}>`;
|
|
1761
1794
|
}
|
|
@@ -1773,7 +1806,7 @@ function generateCsrTemplateWithOpts(node, opts) {
|
|
|
1773
1806
|
const transformed = transformExpr(node.expr, node.templateExpr);
|
|
1774
1807
|
const expr = transformed === UNSAFE_TEMPLATE_EXPR ? "''" : transformed;
|
|
1775
1808
|
if (node.slotId) {
|
|
1776
|
-
return `<!--bf:${node.slotId}-->\${${expr}}<!--/-->`;
|
|
1809
|
+
return `<!--bf:${node.slotId}-->\${${escapeTextSlotExpr(expr)}}<!--/-->`;
|
|
1777
1810
|
}
|
|
1778
1811
|
return `\${${expr}}`;
|
|
1779
1812
|
}
|
|
@@ -9710,24 +9743,80 @@ function collectLoopChildReactiveAttrs(node, ctx, loopParam, loopParamBindings)
|
|
|
9710
9743
|
}
|
|
9711
9744
|
|
|
9712
9745
|
// src/ir-to-client-js/collect-elements.ts
|
|
9713
|
-
|
|
9714
|
-
|
|
9746
|
+
var EMPTY_RENDER_EXPRS = new Set(["null", "undefined", "false", "''", '""', "``"]);
|
|
9747
|
+
function domElementCount(node) {
|
|
9748
|
+
switch (node.type) {
|
|
9749
|
+
case "element":
|
|
9750
|
+
case "component":
|
|
9751
|
+
case "provider":
|
|
9752
|
+
case "async":
|
|
9753
|
+
return 1;
|
|
9754
|
+
case "text":
|
|
9755
|
+
return 0;
|
|
9756
|
+
case "expression":
|
|
9757
|
+
return EMPTY_RENDER_EXPRS.has(node.expr.trim()) ? 0 : null;
|
|
9758
|
+
case "loop":
|
|
9759
|
+
if (node.bodyIsItemConditional || node.method === "flatMap")
|
|
9760
|
+
return null;
|
|
9761
|
+
return `(${buildLoopChainExpr({
|
|
9762
|
+
base: node.array,
|
|
9763
|
+
sortComparator: node.sortComparator,
|
|
9764
|
+
filterPredicate: node.filterPredicate,
|
|
9765
|
+
chainOrder: node.chainOrder
|
|
9766
|
+
})}).length`;
|
|
9767
|
+
case "conditional": {
|
|
9768
|
+
const t = domElementCount(node.whenTrue);
|
|
9769
|
+
const f = domElementCount(node.whenFalse);
|
|
9770
|
+
if (t === null || f === null)
|
|
9771
|
+
return null;
|
|
9772
|
+
if (typeof t === "number" && typeof f === "number" && t === f)
|
|
9773
|
+
return t;
|
|
9774
|
+
return `(${node.condition} ? ${t} : ${f})`;
|
|
9775
|
+
}
|
|
9776
|
+
case "fragment":
|
|
9777
|
+
return sumElementCounts(node.children);
|
|
9778
|
+
default:
|
|
9779
|
+
return null;
|
|
9780
|
+
}
|
|
9781
|
+
}
|
|
9782
|
+
function sumElementCounts(nodes) {
|
|
9783
|
+
let staticCount = 0;
|
|
9784
|
+
const dynamic = [];
|
|
9785
|
+
for (const n of nodes) {
|
|
9786
|
+
const c = domElementCount(n);
|
|
9787
|
+
if (c === null)
|
|
9788
|
+
return null;
|
|
9789
|
+
if (typeof c === "number")
|
|
9790
|
+
staticCount += c;
|
|
9791
|
+
else
|
|
9792
|
+
dynamic.push(c);
|
|
9793
|
+
}
|
|
9794
|
+
if (dynamic.length === 0)
|
|
9795
|
+
return staticCount;
|
|
9796
|
+
const parts = staticCount > 0 ? [String(staticCount), ...dynamic] : dynamic;
|
|
9797
|
+
return parts.length === 1 ? parts[0] : `(${parts.join(" + ")})`;
|
|
9798
|
+
}
|
|
9799
|
+
function legacyElementCount(node) {
|
|
9800
|
+
return node.type === "element" || node.type === "component" || node.type === "provider" || node.type === "async" || node.type === "text" || node.type === "expression" && !node.reactive || node.type === "conditional" ? 1 : 0;
|
|
9715
9801
|
}
|
|
9716
9802
|
function computeLoopSiblingOffsets(root) {
|
|
9717
9803
|
const offsets = new Map;
|
|
9718
|
-
const
|
|
9719
|
-
let nonLoopCount = 0;
|
|
9804
|
+
const recordRun = (children, preceding) => {
|
|
9720
9805
|
for (const child of children) {
|
|
9721
9806
|
if (child.type === "loop") {
|
|
9722
|
-
if (
|
|
9723
|
-
offsets.set(child,
|
|
9724
|
-
|
|
9725
|
-
|
|
9807
|
+
if (preceding.length > 0 && !offsets.has(child)) {
|
|
9808
|
+
offsets.set(child, [...preceding]);
|
|
9809
|
+
}
|
|
9810
|
+
preceding.push(child);
|
|
9811
|
+
} else if (child.type === "fragment" || child.type === "provider" || child.type === "async") {
|
|
9812
|
+
recordRun(child.children, preceding);
|
|
9813
|
+
} else {
|
|
9814
|
+
preceding.push(child);
|
|
9726
9815
|
}
|
|
9727
9816
|
}
|
|
9728
9817
|
};
|
|
9729
9818
|
const containerVisit = ({ node, descend }) => {
|
|
9730
|
-
|
|
9819
|
+
recordRun(node.children, []);
|
|
9731
9820
|
descend();
|
|
9732
9821
|
};
|
|
9733
9822
|
walkIR(root, null, {
|
|
@@ -9739,6 +9828,24 @@ function computeLoopSiblingOffsets(root) {
|
|
|
9739
9828
|
});
|
|
9740
9829
|
return offsets;
|
|
9741
9830
|
}
|
|
9831
|
+
function resolveLoopOffset(preceding) {
|
|
9832
|
+
if (!preceding || preceding.length === 0)
|
|
9833
|
+
return;
|
|
9834
|
+
let staticCount = 0;
|
|
9835
|
+
const dynamicTerms = [];
|
|
9836
|
+
for (const node of preceding) {
|
|
9837
|
+
const c = domElementCount(node);
|
|
9838
|
+
if (c === null)
|
|
9839
|
+
staticCount += legacyElementCount(node);
|
|
9840
|
+
else if (typeof c === "number")
|
|
9841
|
+
staticCount += c;
|
|
9842
|
+
else
|
|
9843
|
+
dynamicTerms.push(c);
|
|
9844
|
+
}
|
|
9845
|
+
if (staticCount === 0 && dynamicTerms.length === 0)
|
|
9846
|
+
return;
|
|
9847
|
+
return { staticCount, dynamicTerms };
|
|
9848
|
+
}
|
|
9742
9849
|
var branchInnerLoopOptions = {
|
|
9743
9850
|
collectItemBindings: true,
|
|
9744
9851
|
templateDepth: 1,
|
|
@@ -9824,7 +9931,7 @@ function collectInnerLoops(nodes, siblingOffsets, outerLoopParam, ctx, options)
|
|
|
9824
9931
|
refsOuterParam: refsOuter,
|
|
9825
9932
|
childComponents,
|
|
9826
9933
|
insideConditional: !flat && scope.insideCond ? true : undefined,
|
|
9827
|
-
|
|
9934
|
+
offset: flat ? undefined : resolveLoopOffset(siblingOffsets.get(n)),
|
|
9828
9935
|
bindings
|
|
9829
9936
|
});
|
|
9830
9937
|
if (!flat) {
|
|
@@ -10042,7 +10149,7 @@ function collectElements(node, ctx, siblingOffsets, insideConditional = false) {
|
|
|
10042
10149
|
isStaticArray: l.isStaticArray,
|
|
10043
10150
|
useElementReconciliation,
|
|
10044
10151
|
innerLoops: useElementReconciliation || l.isStaticArray && innerLoops?.length ? innerLoops : undefined,
|
|
10045
|
-
|
|
10152
|
+
offset: resolveLoopOffset(siblingOffsets.get(l)),
|
|
10046
10153
|
filterPredicate: l.filterPredicate ? {
|
|
10047
10154
|
param: l.filterPredicate.param,
|
|
10048
10155
|
raw: l.filterPredicate.raw
|
|
@@ -10812,6 +10919,8 @@ var RUNTIME_IMPORT_CANDIDATES = [
|
|
|
10812
10919
|
"splitProps",
|
|
10813
10920
|
"spreadAttrs",
|
|
10814
10921
|
"styleToCss",
|
|
10922
|
+
"escapeAttr",
|
|
10923
|
+
"escapeText",
|
|
10815
10924
|
"qsa",
|
|
10816
10925
|
"qsaItem",
|
|
10817
10926
|
"qsaChildScope",
|
|
@@ -12678,7 +12787,7 @@ function buildOuterNestedPlan(elem, comp) {
|
|
|
12678
12787
|
arrayExpr: elem.array,
|
|
12679
12788
|
param: elem.param,
|
|
12680
12789
|
indexParam,
|
|
12681
|
-
offsetExpr:
|
|
12790
|
+
offsetExpr: buildLoopChildIndexExpr(indexParam, elem.offset),
|
|
12682
12791
|
outerPreludeStatements: elem.mapPreamble ? [elem.mapPreamble] : [],
|
|
12683
12792
|
propsExpr: buildStaticPropsExpr(comp.props)
|
|
12684
12793
|
};
|
|
@@ -12696,12 +12805,12 @@ function buildInnerLoopNestedPlan(elem, innerLoop, innerComps) {
|
|
|
12696
12805
|
outerArrayExpr: elem.array,
|
|
12697
12806
|
outerParam: elem.param,
|
|
12698
12807
|
outerIndexParam,
|
|
12699
|
-
outerOffsetExpr:
|
|
12808
|
+
outerOffsetExpr: buildLoopChildIndexExpr(outerIndexParam, elem.offset),
|
|
12700
12809
|
outerPreludeStatements: elem.mapPreamble ? [elem.mapPreamble] : [],
|
|
12701
12810
|
innerContainerSlotId: innerLoop.containerSlotId ?? null,
|
|
12702
12811
|
innerArrayExpr: innerLoop.array,
|
|
12703
12812
|
innerParam: innerLoop.param,
|
|
12704
|
-
innerOffsetExpr:
|
|
12813
|
+
innerOffsetExpr: buildLoopChildIndexExpr("__innerIdx", innerLoop.offset),
|
|
12705
12814
|
innerPreludeStatements: innerLoop.mapPreamble ? [innerLoop.mapPreamble] : [],
|
|
12706
12815
|
depth: innerLoop.depth,
|
|
12707
12816
|
comps
|
|
@@ -13463,7 +13572,7 @@ function buildStaticArrayDelegationPlan(elem) {
|
|
|
13463
13572
|
arrayExpr: buildChainedArrayExpr(elem),
|
|
13464
13573
|
param: elem.param,
|
|
13465
13574
|
mapPreamble: elem.mapPreamble ?? null,
|
|
13466
|
-
|
|
13575
|
+
offset: elem.offset ?? null
|
|
13467
13576
|
}
|
|
13468
13577
|
};
|
|
13469
13578
|
}
|
|
@@ -13581,6 +13690,11 @@ function buildArmBody(branch, options) {
|
|
|
13581
13690
|
// src/ir-to-client-js/emit-reactive.ts
|
|
13582
13691
|
function emitAttrUpdate(target, attrName, expression, meta) {
|
|
13583
13692
|
const htmlName = toHtmlAttrName(attrName);
|
|
13693
|
+
if (attrName === "dangerouslySetInnerHTML" || htmlName === "dangerouslySetInnerHTML") {
|
|
13694
|
+
return [
|
|
13695
|
+
`{ const __v = ${expression}; ${target}.innerHTML = __v != null && __v.__html != null ? String(__v.__html) : '' }`
|
|
13696
|
+
];
|
|
13697
|
+
}
|
|
13584
13698
|
if (htmlName === "style") {
|
|
13585
13699
|
return [
|
|
13586
13700
|
`{ const __v = styleToCss(${expression}); if (__v != null) ${target}.setAttribute('style', __v); else ${target}.removeAttribute('style') }`
|
|
@@ -14592,11 +14706,11 @@ function emitDynamicIndexLookup(ls, ev, handlerCall, lookup) {
|
|
|
14592
14706
|
ls.push(` }`);
|
|
14593
14707
|
}
|
|
14594
14708
|
function emitStaticIndexLookup(ls, ev, handlerCall, lookup, containerVar) {
|
|
14595
|
-
const { arrayExpr, param, mapPreamble,
|
|
14709
|
+
const { arrayExpr, param, mapPreamble, offset } = lookup;
|
|
14596
14710
|
ls.push(` let __el = ${varSlotId(ev.childSlotId)}El`);
|
|
14597
14711
|
ls.push(` while (__el.parentElement && __el.parentElement !== ${containerVar}) __el = __el.parentElement`);
|
|
14598
14712
|
ls.push(` if (__el.parentElement === ${containerVar}) {`);
|
|
14599
|
-
const idxOffset =
|
|
14713
|
+
const idxOffset = buildLoopChildIndexSubtraction(offset ?? undefined);
|
|
14600
14714
|
ls.push(` const __idx = Array.from(${containerVar}.children).indexOf(__el)${idxOffset}`);
|
|
14601
14715
|
ls.push(` const ${param} = ${arrayExpr}[__idx]`);
|
|
14602
14716
|
if (mapPreamble)
|
|
@@ -14873,7 +14987,7 @@ function buildStaticLoopPlan(elem, unsafeLocalNames) {
|
|
|
14873
14987
|
}
|
|
14874
14988
|
}
|
|
14875
14989
|
const indexParam = elem.index || "__idx";
|
|
14876
|
-
const childIndexExpr =
|
|
14990
|
+
const childIndexExpr = buildLoopChildIndexExpr(indexParam, elem.offset);
|
|
14877
14991
|
return {
|
|
14878
14992
|
kind: "static",
|
|
14879
14993
|
containerVar: `_${varSlotId(elem.slotId)}`,
|
|
@@ -17161,6 +17275,7 @@ function emitAttrValue(value, emitter, name) {
|
|
|
17161
17275
|
}
|
|
17162
17276
|
}
|
|
17163
17277
|
// src/combine-client-js.ts
|
|
17278
|
+
import ts18 from "typescript";
|
|
17164
17279
|
var CHILD_PLACEHOLDER_RE = /import '\/\* @bf-child:(\w+) \*\/'/g;
|
|
17165
17280
|
function combineParentChildClientJs(files) {
|
|
17166
17281
|
const result = new Map;
|
|
@@ -17217,33 +17332,43 @@ function combineParentChildClientJs(files) {
|
|
|
17217
17332
|
return result;
|
|
17218
17333
|
}
|
|
17219
17334
|
function parseAndMerge(content, importsBySource, otherImports, codeSections) {
|
|
17220
|
-
const
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
if (
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17335
|
+
const sourceFile = ts18.createSourceFile("combine.js", content, ts18.ScriptTarget.Latest, false, ts18.ScriptKind.JS);
|
|
17336
|
+
const importSpans = [];
|
|
17337
|
+
for (const stmt of sourceFile.statements) {
|
|
17338
|
+
if (!ts18.isImportDeclaration(stmt))
|
|
17339
|
+
continue;
|
|
17340
|
+
const start = stmt.getStart(sourceFile);
|
|
17341
|
+
const end = stmt.getEnd();
|
|
17342
|
+
importSpans.push([start, end]);
|
|
17343
|
+
const stmtText = content.slice(start, end);
|
|
17344
|
+
if (stmtText.includes("@bf-child:"))
|
|
17345
|
+
continue;
|
|
17346
|
+
const clause = stmt.importClause;
|
|
17347
|
+
const bindings = clause?.namedBindings;
|
|
17348
|
+
const specifier = ts18.isStringLiteral(stmt.moduleSpecifier) ? stmt.moduleSpecifier.text : "";
|
|
17349
|
+
if (clause && !clause.name && bindings && ts18.isNamedImports(bindings)) {
|
|
17350
|
+
if (!importsBySource.has(specifier)) {
|
|
17351
|
+
importsBySource.set(specifier, new Set);
|
|
17352
|
+
}
|
|
17353
|
+
const set = importsBySource.get(specifier);
|
|
17354
|
+
for (const el of bindings.elements) {
|
|
17355
|
+
const name = el.propertyName ? `${el.propertyName.text} as ${el.name.text}` : el.name.text;
|
|
17356
|
+
set.add(name);
|
|
17240
17357
|
}
|
|
17241
17358
|
} else {
|
|
17242
|
-
|
|
17359
|
+
if (!otherImports.includes(stmtText)) {
|
|
17360
|
+
otherImports.push(stmtText);
|
|
17361
|
+
}
|
|
17243
17362
|
}
|
|
17244
17363
|
}
|
|
17245
|
-
|
|
17246
|
-
|
|
17364
|
+
let code = "";
|
|
17365
|
+
let cursor = 0;
|
|
17366
|
+
for (const [start, end] of importSpans) {
|
|
17367
|
+
code += content.slice(cursor, start);
|
|
17368
|
+
cursor = end;
|
|
17369
|
+
}
|
|
17370
|
+
code += content.slice(cursor);
|
|
17371
|
+
code = code.trim();
|
|
17247
17372
|
if (code) {
|
|
17248
17373
|
codeSections.push(code);
|
|
17249
17374
|
}
|
|
@@ -4,26 +4,38 @@
|
|
|
4
4
|
import { type IRNode, type IRLoop } from '../types';
|
|
5
5
|
import type { ClientJsContext, LoopChildBindings, LoopChildConditional, NestedLoop } from './types';
|
|
6
6
|
/**
|
|
7
|
-
* Pre-pass: for every loop node in the IR tree, record the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Pre-pass: for every loop node in the IR tree, record the sibling nodes that
|
|
8
|
+
* appear before it in its parent container. Read when constructing
|
|
9
|
+
* TopLevelLoop and NestedLoop so the client JS can offset children[idx]
|
|
10
|
+
* access past everything rendered ahead of the loop's items.
|
|
11
11
|
*
|
|
12
12
|
* Counting must happen for every container whose children render as a
|
|
13
13
|
* contiguous run of DOM siblings into the same parent — not just `element`.
|
|
14
14
|
* A loop nested directly inside a component (`<Wrapper><span/>{xs.map(...)}`
|
|
15
15
|
* </Wrapper>`), fragment, provider, or async boundary has its preceding
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* (
|
|
20
|
-
*
|
|
16
|
+
* siblings rendered as siblings of the loop's items too, so `children[idx]`
|
|
17
|
+
* access is shifted exactly as it is under an element parent (#1688).
|
|
18
|
+
*
|
|
19
|
+
* Transparent containers (fragment / provider / async) render no DOM element
|
|
20
|
+
* wrapper, so their children are siblings in the nearest ancestor element —
|
|
21
|
+
* not in a container of their own. `recordRun` therefore threads ONE
|
|
22
|
+
* preceding-sibling accumulator through them, so a loop inside a fragment sees
|
|
23
|
+
* the parent element's earlier siblings too, not just the fragment's own
|
|
24
|
+
* children (#1699). `<Box><hr/><hr/><>{xs.map(...)}</></Box>` must offset the
|
|
25
|
+
* items past both `<hr/>`s.
|
|
26
|
+
*
|
|
27
|
+
* The siblings are stored raw; `resolveLoopOffset` turns each into its element
|
|
28
|
+
* count via `domElementCount`. That generalisation closes the #1688 follow-up
|
|
29
|
+
* (#1693): a preceding `.map()` contributes `array.length` and a preceding
|
|
30
|
+
* conditional contributes a `(cond ? … : …)` term, both resolved at runtime —
|
|
31
|
+
* a static-only count resolved later groups' nested children against the wrong
|
|
32
|
+
* `children[idx]`, leaving them inert after hydration.
|
|
21
33
|
*
|
|
22
34
|
* Computed once up front (instead of during collection) so the offset data
|
|
23
35
|
* lives in an explicit value rather than a module-level WeakMap mutated by
|
|
24
36
|
* two separate traversals.
|
|
25
37
|
*/
|
|
26
|
-
export declare function computeLoopSiblingOffsets(root: IRNode): Map<IRLoop,
|
|
38
|
+
export declare function computeLoopSiblingOffsets(root: IRNode): Map<IRLoop, IRNode[]>;
|
|
27
39
|
/**
|
|
28
40
|
* Options controlling `collectInnerLoops` traversal and payload collection.
|
|
29
41
|
*
|
|
@@ -77,7 +89,7 @@ export declare const branchInnerLoopOptions: CollectInnerLoopsOptions;
|
|
|
77
89
|
* `collectBranchInnerLoops`; see that history for why the option preset
|
|
78
90
|
* hard-codes `templateDepth: 1` and `flatBranchMode: true`.
|
|
79
91
|
*/
|
|
80
|
-
export declare function collectInnerLoops(nodes: IRNode[], siblingOffsets: Map<IRLoop,
|
|
92
|
+
export declare function collectInnerLoops(nodes: IRNode[], siblingOffsets: Map<IRLoop, IRNode[]>, outerLoopParam?: string, ctx?: ClientJsContext, options?: CollectInnerLoopsOptions): NestedLoop[];
|
|
81
93
|
/**
|
|
82
94
|
* Walk the IR tree and populate `ctx` with every interactive / dynamic /
|
|
83
95
|
* loop / conditional element that needs client-side wiring. Implemented
|
|
@@ -86,7 +98,7 @@ export declare function collectInnerLoops(nodes: IRNode[], siblingOffsets: Map<I
|
|
|
86
98
|
* variables; conditional branches flip the `insideConditional` scope flag
|
|
87
99
|
* so text effects and conditional pushes gate correctly).
|
|
88
100
|
*/
|
|
89
|
-
export declare function collectElements(node: IRNode, ctx: ClientJsContext, siblingOffsets: Map<IRLoop,
|
|
101
|
+
export declare function collectElements(node: IRNode, ctx: ClientJsContext, siblingOffsets: Map<IRLoop, IRNode[]>, insideConditional?: boolean): void;
|
|
90
102
|
/**
|
|
91
103
|
* Collect reactive conditionals from loop children.
|
|
92
104
|
* These are conditional nodes with a slotId that have reactive conditions,
|
|
@@ -113,6 +125,6 @@ export declare function collectElements(node: IRNode, ctx: ClientJsContext, sibl
|
|
|
113
125
|
* resolve child slot ids inside nested loops; the rest of the per-item
|
|
114
126
|
* collectors don't read them but pass them through for symmetry.
|
|
115
127
|
*/
|
|
116
|
-
export declare function collectLoopChildBindings(children: readonly IRNode[], ctx: ClientJsContext, siblingOffsets: Map<IRLoop,
|
|
117
|
-
export declare function collectLoopChildConditionals(node: IRNode, ctx: ClientJsContext, siblingOffsets: Map<IRLoop,
|
|
128
|
+
export declare function collectLoopChildBindings(children: readonly IRNode[], ctx: ClientJsContext, siblingOffsets: Map<IRLoop, IRNode[]>, loopParam: string, loopParamBindings: readonly import('../types').LoopParamBinding[] | undefined): LoopChildBindings;
|
|
129
|
+
export declare function collectLoopChildConditionals(node: IRNode, ctx: ClientJsContext, siblingOffsets: Map<IRLoop, IRNode[]>, loopParam?: string, loopParamBindings?: readonly import('../types').LoopParamBinding[]): LoopChildConditional[];
|
|
118
130
|
//# sourceMappingURL=collect-elements.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-elements.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/collect-elements.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAoC,KAAK,MAAM,EAAmC,MAAM,UAAU,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAA+H,iBAAiB,EAA0B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"collect-elements.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/collect-elements.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAoC,KAAK,MAAM,EAAmC,MAAM,UAAU,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAA+H,iBAAiB,EAA0B,oBAAoB,EAAc,UAAU,EAAE,MAAM,SAAS,CAAA;AAwGpQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA0C7E;AAyBD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,mBAA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 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"build-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,aAAa,CAAA;AAiBpB,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EAEb,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACnC,8FAA8F;IAC9F,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC9B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,oBAAoB,GAAG,QAAQ,CAsBtF;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CA8BpE;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CAiCrG"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Covers three legacy emitters with one shape — they only differ in the
|
|
5
5
|
* container variable and the per-event item-lookup strategy.
|
|
6
6
|
*/
|
|
7
|
-
import type { LoopChildEvent, TopLevelLoop } from '../../types';
|
|
7
|
+
import type { LoopChildEvent, LoopOffset, TopLevelLoop } from '../../types';
|
|
8
8
|
/**
|
|
9
9
|
* Plan for a loop's event-delegation block. Covers three legacy emitters:
|
|
10
10
|
* - `emitDynamicLoopEventDelegation` (top-level dynamic loop)
|
|
@@ -63,7 +63,12 @@ export interface StaticIndexItemLookup {
|
|
|
63
63
|
arrayExpr: string;
|
|
64
64
|
param: string;
|
|
65
65
|
mapPreamble: string | null;
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Offset of the loop's items past its preceding container siblings. Its
|
|
68
|
+
* terms are subtracted from the DOM child index to recover the array index,
|
|
69
|
+
* so later `static + .map()` groups resolve the correct item (#1693).
|
|
70
|
+
* `null` when nothing precedes the loop.
|
|
71
|
+
*/
|
|
72
|
+
offset: LoopOffset | null;
|
|
68
73
|
}
|
|
69
74
|
//# sourceMappingURL=event-delegation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE3E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,kBAAkB,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,sBAAsB,GACtB,qBAAqB,CAAA;AAEzB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAA;IACb,sFAAsF;IACtF,aAAa,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IAC5C;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,6EAA6E;IAC7E,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,eAAe,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B;;;;;OAKG;IACH,MAAM,EAAE,UAAU,GAAG,IAAI,CAAA;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-reactive.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/emit-reactive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"emit-reactive.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/emit-reactive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,KAAK,EAAE,eAAe,E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
|
-
export declare const RUNTIME_IMPORT_CANDIDATES: readonly ['createSignal', 'createMemo', 'createEffect', 'onCleanup', 'onMount', 'hydrate', 'insert', 'reconcileElements', 'getLoopChildren', 'getLoopNodes', 'mapArray', 'mapArrayAnchored', 'createDisposableEffect', 'createComponent', 'renderChild', 'registerComponent', 'registerTemplate', 'initChild', 'upsertChild', 'updateClientMarker', 'createPortal', 'provideContext', 'createContext', 'useContext', 'forwardProps', 'applyRestAttrs', 'splitProps', 'spreadAttrs', 'styleToCss', 'qsa', 'qsaItem', 'qsaChildScope', 'qsaChildScopes', 'upsertChildItem', '__slot', '__bfSlot', '__bfText'];
|
|
5
|
+
export declare const RUNTIME_IMPORT_CANDIDATES: readonly ['createSignal', 'createMemo', 'createEffect', 'onCleanup', 'onMount', 'hydrate', 'insert', 'reconcileElements', 'getLoopChildren', 'getLoopNodes', 'mapArray', 'mapArrayAnchored', 'createDisposableEffect', 'createComponent', 'renderChild', 'registerComponent', 'registerTemplate', 'initChild', 'upsertChild', 'updateClientMarker', 'createPortal', 'provideContext', 'createContext', 'useContext', 'forwardProps', 'applyRestAttrs', 'splitProps', 'spreadAttrs', 'styleToCss', 'escapeAttr', 'escapeText', 'qsa', 'qsaItem', 'qsaChildScope', 'qsaChildScopes', 'upsertChildItem', '__slot', '__bfSlot', '__bfText'];
|
|
6
6
|
/** @deprecated Use RUNTIME_IMPORT_CANDIDATES */
|
|
7
|
-
export declare const DOM_IMPORT_CANDIDATES: readonly ["createSignal", "createMemo", "createEffect", "onCleanup", "onMount", "hydrate", "insert", "reconcileElements", "getLoopChildren", "getLoopNodes", "mapArray", "mapArrayAnchored", "createDisposableEffect", "createComponent", "renderChild", "registerComponent", "registerTemplate", "initChild", "upsertChild", "updateClientMarker", "createPortal", "provideContext", "createContext", "useContext", "forwardProps", "applyRestAttrs", "splitProps", "spreadAttrs", "styleToCss", "qsa", "qsaItem", "qsaChildScope", "qsaChildScopes", "upsertChildItem", "__slot", "__bfSlot", "__bfText"];
|
|
7
|
+
export declare const DOM_IMPORT_CANDIDATES: readonly ["createSignal", "createMemo", "createEffect", "onCleanup", "onMount", "hydrate", "insert", "reconcileElements", "getLoopChildren", "getLoopNodes", "mapArray", "mapArrayAnchored", "createDisposableEffect", "createComponent", "renderChild", "registerComponent", "registerTemplate", "initChild", "upsertChild", "updateClientMarker", "createPortal", "provideContext", "createContext", "useContext", "forwardProps", "applyRestAttrs", "splitProps", "spreadAttrs", "styleToCss", "escapeAttr", "escapeText", "qsa", "qsaItem", "qsaChildScope", "qsaChildScopes", "upsertChildItem", "__slot", "__bfSlot", "__bfText"];
|
|
8
8
|
export declare const RUNTIME_MODULE = "@barefootjs/client/runtime";
|
|
9
9
|
export declare const IMPORT_PLACEHOLDER = "/* __BAREFOOTJS_DOM_IMPORTS__ */";
|
|
10
10
|
export declare const MODULE_CONSTANTS_PLACEHOLDER = "/* __MODULE_LEVEL_CONSTANTS__ */";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/imports.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,UAAU,CAAA;AAGnD,eAAO,MAAM,yBAAyB,YACpC,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EACpE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,wBAAwB,EACrI,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAC3H,cAAc,EACd,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAC/C,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/imports.ts"],"names":[],"m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: string;
|
|
73
|
-
/** `indexParam`
|
|
73
|
+
/** `indexParam` plus any sibling-offset terms (`+ 1 + (arr).length`) — already substituted. */
|
|
74
74
|
offsetExpr: string;
|
|
75
75
|
/**
|
|
76
76
|
* Outer `.map()` callback preamble locals (#1064), emitted inside the
|
|
@@ -93,7 +93,7 @@ export interface InnerLoopNestedInitPlan {
|
|
|
93
93
|
outerArrayExpr: string;
|
|
94
94
|
outerParam: string;
|
|
95
95
|
outerIndexParam: string;
|
|
96
|
-
/** Outer offset — `outerIndexParam`
|
|
96
|
+
/** Outer offset — `outerIndexParam` plus any sibling-offset terms. */
|
|
97
97
|
outerOffsetExpr: string;
|
|
98
98
|
/**
|
|
99
99
|
* Outer `.map()` callback preamble locals, emitted after the
|
|
@@ -109,7 +109,7 @@ export interface InnerLoopNestedInitPlan {
|
|
|
109
109
|
innerContainerSlotId: string | null;
|
|
110
110
|
innerArrayExpr: string;
|
|
111
111
|
innerParam: string;
|
|
112
|
-
/** Inner offset — `__innerIdx`
|
|
112
|
+
/** Inner offset — `__innerIdx` plus any sibling-offset terms. */
|
|
113
113
|
innerOffsetExpr: string;
|
|
114
114
|
/**
|
|
115
115
|
* Inner `.map()` callback preamble locals, emitted after the
|