@geajs/vite-plugin 1.0.28 → 1.1.0
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 +868 -379
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -180,8 +180,8 @@ function collectStateReferences(ast, storeImports = /* @__PURE__ */ new Map()) {
|
|
|
180
180
|
VariableDeclarator(path) {
|
|
181
181
|
if (!path.node.init || !t.isIdentifier(path.node.id)) return;
|
|
182
182
|
if (stateRefs.has(path.node.id.name)) return;
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
183
|
+
const classMethod10 = path.findParent((p) => t.isClassMethod(p.node));
|
|
184
|
+
if (!classMethod10) return;
|
|
185
185
|
candidates.set(path.node.id.name, t.cloneNode(path.node.init, true));
|
|
186
186
|
}
|
|
187
187
|
});
|
|
@@ -591,14 +591,14 @@ function replaceThisPropsRootWithValueParam(expr, propName) {
|
|
|
591
591
|
visit(e.object),
|
|
592
592
|
e.property,
|
|
593
593
|
e.computed,
|
|
594
|
-
e.optional
|
|
594
|
+
e.optional ?? true
|
|
595
595
|
);
|
|
596
596
|
}
|
|
597
597
|
if (t2.isOptionalCallExpression(e)) {
|
|
598
598
|
return t2.optionalCallExpression(
|
|
599
599
|
visit(e.callee),
|
|
600
600
|
e.arguments.map((a) => t2.isExpression(a) ? visit(a) : a),
|
|
601
|
-
e.optional
|
|
601
|
+
e.optional ?? true
|
|
602
602
|
);
|
|
603
603
|
}
|
|
604
604
|
if (t2.isCallExpression(e)) {
|
|
@@ -728,14 +728,14 @@ function optionalizeMemberChainsFromBindingRoot(expr, rootName) {
|
|
|
728
728
|
visit(e.object),
|
|
729
729
|
e.property,
|
|
730
730
|
e.computed,
|
|
731
|
-
e.optional
|
|
731
|
+
e.optional ?? true
|
|
732
732
|
);
|
|
733
733
|
}
|
|
734
734
|
if (t2.isOptionalCallExpression(e)) {
|
|
735
735
|
return t2.optionalCallExpression(
|
|
736
736
|
visit(e.callee),
|
|
737
737
|
e.arguments.map((a) => t2.isExpression(a) ? visit(a) : a),
|
|
738
|
-
e.optional
|
|
738
|
+
e.optional ?? true
|
|
739
739
|
);
|
|
740
740
|
}
|
|
741
741
|
if (t2.isCallExpression(e)) {
|
|
@@ -861,14 +861,14 @@ function optionalizeMemberChainsAfterComputedItemKey(expr, itemKeyName) {
|
|
|
861
861
|
visit(e.object),
|
|
862
862
|
e.property,
|
|
863
863
|
e.computed,
|
|
864
|
-
e.optional
|
|
864
|
+
e.optional ?? true
|
|
865
865
|
);
|
|
866
866
|
}
|
|
867
867
|
if (t2.isOptionalCallExpression(e)) {
|
|
868
868
|
return t2.optionalCallExpression(
|
|
869
869
|
visit(e.callee),
|
|
870
870
|
e.arguments.map((a) => t2.isExpression(a) ? visit(a) : a),
|
|
871
|
-
e.optional
|
|
871
|
+
e.optional ?? true
|
|
872
872
|
);
|
|
873
873
|
}
|
|
874
874
|
if (t2.isCallExpression(e)) {
|
|
@@ -1033,14 +1033,14 @@ function replacePropRefsInNode(node, propNames, wholeParamName, propDefaults) {
|
|
|
1033
1033
|
r(node.object),
|
|
1034
1034
|
node.property,
|
|
1035
1035
|
node.computed,
|
|
1036
|
-
node.optional
|
|
1036
|
+
node.optional ?? true
|
|
1037
1037
|
);
|
|
1038
1038
|
}
|
|
1039
1039
|
if (t2.isOptionalCallExpression(node)) {
|
|
1040
1040
|
return t2.optionalCallExpression(
|
|
1041
1041
|
r(node.callee),
|
|
1042
1042
|
node.arguments.map((a) => t2.isExpression(a) ? r(a) : a),
|
|
1043
|
-
node.optional
|
|
1043
|
+
node.optional ?? true
|
|
1044
1044
|
);
|
|
1045
1045
|
}
|
|
1046
1046
|
if (t2.isConditionalExpression(node)) {
|
|
@@ -1177,8 +1177,8 @@ function wrapEventsGetterWithCache(getter) {
|
|
|
1177
1177
|
const returnStmt = body.find((s) => t2.isReturnStatement(s) && s.argument !== null);
|
|
1178
1178
|
if (!returnStmt?.argument) return;
|
|
1179
1179
|
const cachedProp = t2.memberExpression(t2.thisExpression(), t2.identifier("__evts"));
|
|
1180
|
-
const elementProp = t2.memberExpression(t2.thisExpression(), t2.identifier("
|
|
1181
|
-
const tmpId = t2.identifier("
|
|
1180
|
+
const elementProp = t2.memberExpression(t2.thisExpression(), t2.identifier("GEA_ELEMENT"), true);
|
|
1181
|
+
const tmpId = t2.identifier("geaEvtsResult");
|
|
1182
1182
|
const objectExpr = returnStmt.argument;
|
|
1183
1183
|
const returnIndex = body.indexOf(returnStmt);
|
|
1184
1184
|
body.splice(
|
|
@@ -1642,7 +1642,7 @@ function stmtUsesPropRefreshCall(stmt) {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
function containsPropRefreshCall(node) {
|
|
1644
1644
|
if (t2.isMemberExpression(node) && t2.isIdentifier(node.property)) {
|
|
1645
|
-
if (node.property.name === "
|
|
1645
|
+
if (node.property.name === "GEA_UPDATE_PROPS" || node.property.name.startsWith("__refresh")) return true;
|
|
1646
1646
|
}
|
|
1647
1647
|
const keys = t2.VISITOR_KEYS[node.type];
|
|
1648
1648
|
if (!keys) return false;
|
|
@@ -1709,6 +1709,70 @@ function loggingCatchClause(extra = []) {
|
|
|
1709
1709
|
])
|
|
1710
1710
|
);
|
|
1711
1711
|
}
|
|
1712
|
+
function buildThisGeaMember(symExportName) {
|
|
1713
|
+
return t2.memberExpression(t2.thisExpression(), t2.identifier(symExportName), true);
|
|
1714
|
+
}
|
|
1715
|
+
function buildThisGeaCall(symExportName, args = []) {
|
|
1716
|
+
return t2.callExpression(buildThisGeaMember(symExportName), args);
|
|
1717
|
+
}
|
|
1718
|
+
function buildExprGeaMember(expr, symExportName) {
|
|
1719
|
+
return t2.memberExpression(expr, t2.identifier(symExportName), true);
|
|
1720
|
+
}
|
|
1721
|
+
var GEA_COMPILER_SYMBOL_IMPORTS = [
|
|
1722
|
+
"GEA_RENDERED",
|
|
1723
|
+
"GEA_PARENT_COMPONENT",
|
|
1724
|
+
"GEA_ELEMENT",
|
|
1725
|
+
"GEA_MAPS",
|
|
1726
|
+
"GEA_CONDS",
|
|
1727
|
+
"GEA_RESET_ELS",
|
|
1728
|
+
"GEA_OBSERVE",
|
|
1729
|
+
"GEA_OBSERVE_LIST",
|
|
1730
|
+
"GEA_EL",
|
|
1731
|
+
"GEA_UPDATE_TEXT",
|
|
1732
|
+
"GEA_REQUEST_RENDER",
|
|
1733
|
+
"GEA_UPDATE_PROPS",
|
|
1734
|
+
"GEA_SYNC_MAP",
|
|
1735
|
+
"GEA_REGISTER_MAP",
|
|
1736
|
+
"GEA_PATCH_COND",
|
|
1737
|
+
"GEA_PATCH_NODE",
|
|
1738
|
+
"GEA_REGISTER_COND",
|
|
1739
|
+
"GEA_REFRESH_LIST",
|
|
1740
|
+
"GEA_RECONCILE_LIST",
|
|
1741
|
+
"GEA_ENSURE_ARRAY_CONFIGS",
|
|
1742
|
+
"GEA_APPLY_LIST_CHANGES",
|
|
1743
|
+
"GEA_INSTANTIATE_CHILD_COMPONENTS",
|
|
1744
|
+
"GEA_MOUNT_COMPILED_CHILD_COMPONENTS",
|
|
1745
|
+
"GEA_SWAP_CHILD",
|
|
1746
|
+
"GEA_SWAP_STATE_CHILDREN",
|
|
1747
|
+
"GEA_CHILD",
|
|
1748
|
+
"GEA_LIST_CONFIG_REFRESHING",
|
|
1749
|
+
"GEA_DOM_KEY",
|
|
1750
|
+
"GEA_DOM_ITEM",
|
|
1751
|
+
"GEA_DOM_PROPS",
|
|
1752
|
+
"GEA_HANDLE_ITEM_HANDLER",
|
|
1753
|
+
"GEA_MAP_CONFIG_TPL",
|
|
1754
|
+
"GEA_MAP_CONFIG_PREV",
|
|
1755
|
+
"GEA_MAP_CONFIG_COUNT",
|
|
1756
|
+
"geaCondPatchedSymbol",
|
|
1757
|
+
"geaCondValueSymbol",
|
|
1758
|
+
"geaObservePrevSymbol",
|
|
1759
|
+
"geaPrevGuardSymbol",
|
|
1760
|
+
"GEA_SETUP_LOCAL_STATE_OBSERVERS",
|
|
1761
|
+
"GEA_CLONE_TEMPLATE",
|
|
1762
|
+
"GEA_SETUP_REFS",
|
|
1763
|
+
"GEA_ON_PROP_CHANGE",
|
|
1764
|
+
"GEA_SELF_PROXY",
|
|
1765
|
+
"GEA_STORE_ROOT",
|
|
1766
|
+
"GEA_PROXY_RAW",
|
|
1767
|
+
"GEA_PROXY_GET_TARGET",
|
|
1768
|
+
"geaSanitizeAttr",
|
|
1769
|
+
"geaEscapeHtml"
|
|
1770
|
+
];
|
|
1771
|
+
function ensureGeaCompilerSymbolImports(ast) {
|
|
1772
|
+
for (const name of GEA_COMPILER_SYMBOL_IMPORTS) {
|
|
1773
|
+
ensureImport(ast, "@geajs/core", name);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1712
1776
|
|
|
1713
1777
|
// src/hmr.ts
|
|
1714
1778
|
import { createRequire as createRequire2 } from "module";
|
|
@@ -1751,9 +1815,9 @@ function injectHMR(ast, componentClassName, componentImports, componentImportsUs
|
|
|
1751
1815
|
hmrStmts.push(...createAccepts(componentImports, proxyDep));
|
|
1752
1816
|
hmrStmts.push(js`const __origCreated = ${id2(componentClassName)}.prototype.created;`);
|
|
1753
1817
|
hmrStmts.push(
|
|
1754
|
-
js`${id2(componentClassName)}.prototype.created = function(
|
|
1818
|
+
js`${id2(componentClassName)}.prototype.created = function(geaProps) {
|
|
1755
1819
|
registerComponentInstance(this.constructor.name, this);
|
|
1756
|
-
return __origCreated.call(this,
|
|
1820
|
+
return __origCreated.call(this, geaProps);
|
|
1757
1821
|
};`
|
|
1758
1822
|
);
|
|
1759
1823
|
hmrStmts.push(js`const __origDispose = ${id2(componentClassName)}.prototype.dispose;`);
|
|
@@ -1843,39 +1907,54 @@ import { dirname, resolve } from "path";
|
|
|
1843
1907
|
var EVENT_NAMES = /* @__PURE__ */ new Set([
|
|
1844
1908
|
"click",
|
|
1845
1909
|
"dblclick",
|
|
1910
|
+
"change",
|
|
1911
|
+
"input",
|
|
1912
|
+
"submit",
|
|
1913
|
+
"reset",
|
|
1914
|
+
"focus",
|
|
1915
|
+
"blur",
|
|
1916
|
+
"keydown",
|
|
1917
|
+
"keyup",
|
|
1918
|
+
"keypress",
|
|
1846
1919
|
"mousedown",
|
|
1847
1920
|
"mouseup",
|
|
1848
1921
|
"mouseover",
|
|
1849
1922
|
"mouseout",
|
|
1923
|
+
"mouseenter",
|
|
1924
|
+
"mouseleave",
|
|
1850
1925
|
"mousemove",
|
|
1851
|
-
"
|
|
1852
|
-
"keyup",
|
|
1853
|
-
"keypress",
|
|
1854
|
-
"focus",
|
|
1855
|
-
"blur",
|
|
1856
|
-
"input",
|
|
1857
|
-
"change",
|
|
1858
|
-
"submit",
|
|
1859
|
-
"scroll",
|
|
1926
|
+
"contextmenu",
|
|
1860
1927
|
"touchstart",
|
|
1861
|
-
"touchmove",
|
|
1862
1928
|
"touchend",
|
|
1929
|
+
"touchmove",
|
|
1930
|
+
"pointerdown",
|
|
1931
|
+
"pointerup",
|
|
1932
|
+
"pointermove",
|
|
1933
|
+
"scroll",
|
|
1934
|
+
"resize",
|
|
1935
|
+
"drag",
|
|
1936
|
+
"dragstart",
|
|
1937
|
+
"dragend",
|
|
1938
|
+
"dragover",
|
|
1939
|
+
"dragleave",
|
|
1940
|
+
"drop",
|
|
1941
|
+
"animationstart",
|
|
1942
|
+
"animationend",
|
|
1943
|
+
"animationiteration",
|
|
1944
|
+
"transitionstart",
|
|
1945
|
+
"transitionend",
|
|
1946
|
+
"transitionrun",
|
|
1947
|
+
"transitioncancel",
|
|
1863
1948
|
"tap",
|
|
1864
1949
|
"longTap",
|
|
1865
1950
|
"swipeRight",
|
|
1866
1951
|
"swipeUp",
|
|
1867
1952
|
"swipeLeft",
|
|
1868
|
-
"swipeDown"
|
|
1869
|
-
"dragstart",
|
|
1870
|
-
"dragend",
|
|
1871
|
-
"dragover",
|
|
1872
|
-
"dragleave",
|
|
1873
|
-
"drop"
|
|
1953
|
+
"swipeDown"
|
|
1874
1954
|
]);
|
|
1875
1955
|
function toGeaEventType(attrName) {
|
|
1876
1956
|
if (attrName.startsWith("on") && attrName.length > 2) {
|
|
1877
|
-
|
|
1878
|
-
return rest.charAt(0).toLowerCase() + rest.slice(1);
|
|
1957
|
+
return attrName.slice(2).toLowerCase();
|
|
1879
1958
|
}
|
|
1880
1959
|
return attrName;
|
|
1881
1960
|
}
|
|
@@ -2747,7 +2826,7 @@ function buildComponentPropsExpression(jsxElement, imports, componentInstances,
|
|
|
2747
2826
|
else if (t8.isJSXExpressionContainer(attr.value) && !t8.isJSXEmptyExpression(attr.value.expression)) {
|
|
2748
2827
|
const expr = attr.value.expression;
|
|
2749
2828
|
propValue = transformExpression(expr);
|
|
2750
|
-
if (propValue && (/^on[A-Z]/.test(propName) || /^(click|input|change|submit|focus|blur|keydown|keyup|keypress|mousedown|mouseup|mouseover|mouseout|mouseenter|mouseleave|touchstart|touchend|touchmove|pointerdown|pointerup|pointermove|scroll|resize|drag|dragstart|dragend|dragover|drop|
|
|
2829
|
+
if (propValue && (/^on[A-Z]/.test(propName) || /^(click|dblclick|input|change|submit|reset|focus|blur|keydown|keyup|keypress|mousedown|mouseup|mouseover|mouseout|mouseenter|mouseleave|mousemove|contextmenu|touchstart|touchend|touchmove|pointerdown|pointerup|pointermove|scroll|resize|drag|dragstart|dragend|dragover|dragleave|drop|tap|longTap|swipeRight|swipeUp|swipeLeft|swipeDown)$/.test(
|
|
2751
2830
|
propName
|
|
2752
2831
|
)) && t8.isMemberExpression(propValue)) {
|
|
2753
2832
|
const argsId = t8.identifier("args");
|
|
@@ -3659,7 +3738,8 @@ function analyzeChildren(node, tagName, elementPath, bindings, propBindings, arr
|
|
|
3659
3738
|
stateRefs,
|
|
3660
3739
|
onUnresolvedMap,
|
|
3661
3740
|
classBody2,
|
|
3662
|
-
templateSetupContext
|
|
3741
|
+
templateSetupContext,
|
|
3742
|
+
conditionalSlots?.length
|
|
3663
3743
|
);
|
|
3664
3744
|
} else {
|
|
3665
3745
|
const nestedMapCalls = collectNestedMapCalls(expr);
|
|
@@ -3799,7 +3879,7 @@ function collectImportedStoreGetterDependencies(expr, setupStatements, stateRefs
|
|
|
3799
3879
|
}
|
|
3800
3880
|
return Array.from(deps.values());
|
|
3801
3881
|
}
|
|
3802
|
-
function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stateProps, stateRefs, onUnresolvedMap, classBody2, templateSetupContext) {
|
|
3882
|
+
function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stateProps, stateRefs, onUnresolvedMap, classBody2, templateSetupContext, afterCondSlotIndex) {
|
|
3803
3883
|
const arrayExpr = expr.callee.object;
|
|
3804
3884
|
const normalizedArrayExpr = resolveHelperCallExpression(arrayExpr, classBody2) || arrayExpr;
|
|
3805
3885
|
if (t9.isArrowFunctionExpression(expr.arguments?.[0])) {
|
|
@@ -3857,7 +3937,8 @@ function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stat
|
|
|
3857
3937
|
dependencies,
|
|
3858
3938
|
containerElementPath: [...elementPath],
|
|
3859
3939
|
...cbBodyStmts2.length > 0 ? { callbackBodyStatements: cbBodyStmts2 } : {},
|
|
3860
|
-
...relationalClassBindings.length > 0 ? { relationalClassBindings } : {}
|
|
3940
|
+
...relationalClassBindings.length > 0 ? { relationalClassBindings } : {},
|
|
3941
|
+
...afterCondSlotIndex != null ? { afterCondSlotIndex } : {}
|
|
3861
3942
|
});
|
|
3862
3943
|
}
|
|
3863
3944
|
return;
|
|
@@ -3967,9 +4048,41 @@ function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stat
|
|
|
3967
4048
|
...!itemIdProperty && isKeyed ? { keyExpression: t9.cloneNode(extractKeyExpression(itemTemplate), true) } : {},
|
|
3968
4049
|
classToggleName,
|
|
3969
4050
|
conditionalBindings,
|
|
3970
|
-
...cbBodyStmts.length > 0 ? { callbackBodyStatements: cbBodyStmts } : {}
|
|
4051
|
+
...cbBodyStmts.length > 0 ? { callbackBodyStatements: cbBodyStmts } : {},
|
|
4052
|
+
...afterCondSlotIndex != null ? { afterCondSlotIndex } : {}
|
|
3971
4053
|
});
|
|
3972
4054
|
}
|
|
4055
|
+
function expressionContainsComponentJSX(node) {
|
|
4056
|
+
if (t9.isJSXElement(node)) {
|
|
4057
|
+
const name = node.openingElement.name;
|
|
4058
|
+
if (t9.isJSXIdentifier(name) && /^[A-Z]/.test(name.name)) return true;
|
|
4059
|
+
if (t9.isJSXMemberExpression(name)) {
|
|
4060
|
+
let cur = name;
|
|
4061
|
+
while (t9.isJSXMemberExpression(cur)) cur = cur.object;
|
|
4062
|
+
if (t9.isJSXIdentifier(cur) && /^[A-Z]/.test(cur.name)) return true;
|
|
4063
|
+
}
|
|
4064
|
+
for (const c of node.children) {
|
|
4065
|
+
if (expressionContainsComponentJSX(c)) return true;
|
|
4066
|
+
}
|
|
4067
|
+
return false;
|
|
4068
|
+
}
|
|
4069
|
+
if (t9.isJSXExpressionContainer(node) && !t9.isJSXEmptyExpression(node.expression)) {
|
|
4070
|
+
return expressionContainsComponentJSX(node.expression);
|
|
4071
|
+
}
|
|
4072
|
+
if (t9.isLogicalExpression(node)) {
|
|
4073
|
+
return expressionContainsComponentJSX(node.left) || expressionContainsComponentJSX(node.right);
|
|
4074
|
+
}
|
|
4075
|
+
if (t9.isConditionalExpression(node)) {
|
|
4076
|
+
return expressionContainsComponentJSX(node.consequent) || expressionContainsComponentJSX(node.alternate);
|
|
4077
|
+
}
|
|
4078
|
+
if (t9.isParenthesizedExpression(node)) {
|
|
4079
|
+
return expressionContainsComponentJSX(node.expression);
|
|
4080
|
+
}
|
|
4081
|
+
if (t9.isJSXFragment(node)) {
|
|
4082
|
+
return node.children.some((c) => expressionContainsComponentJSX(c));
|
|
4083
|
+
}
|
|
4084
|
+
return false;
|
|
4085
|
+
}
|
|
3973
4086
|
function handleTextBinding(expr, node, tagName, elementPath, bindings, propBindings, stateProps, stateRefs, textTemplate, textExpressions, shouldBuildTextTemplate, propsParamName, destructuredPropNames, templateSetupContext, rerenderPropNames, rerenderConditions, conditionalSlots, _hasNestedMapCall = false, classBody2, conditionalSlotNodeMap, textNodeIndex, jsxInTextSiblingGroup = false) {
|
|
3974
4087
|
const propName = resolvePropRef(expr, propsParamName, destructuredPropNames);
|
|
3975
4088
|
if (propName) {
|
|
@@ -4090,6 +4203,7 @@ function handleTextBinding(expr, node, tagName, elementPath, bindings, propBindi
|
|
|
4090
4203
|
conditionExpr: t9.cloneNode(conditionExpr, true),
|
|
4091
4204
|
setupStatements: condSetupStatements.map((s) => t9.cloneNode(s, true)),
|
|
4092
4205
|
htmlSetupStatements: fullSetupStatements.map((s) => t9.cloneNode(s, true)),
|
|
4206
|
+
...expressionContainsComponentJSX(expr) ? { hasCompiledChildren: true } : {},
|
|
4093
4207
|
dependentPropNames: [...dependentProps],
|
|
4094
4208
|
dependencies: dependencies.map((dep) => ({
|
|
4095
4209
|
observeKey: dep.observeKey,
|
|
@@ -4100,6 +4214,7 @@ function handleTextBinding(expr, node, tagName, elementPath, bindings, propBindi
|
|
|
4100
4214
|
});
|
|
4101
4215
|
conditionalSlotNodeMap?.set(expr, slotId);
|
|
4102
4216
|
}
|
|
4217
|
+
return;
|
|
4103
4218
|
}
|
|
4104
4219
|
}
|
|
4105
4220
|
}
|
|
@@ -4652,6 +4767,35 @@ function toHtmlAttrName(attrName, isComponent) {
|
|
|
4652
4767
|
if (attrName === "className") return "class";
|
|
4653
4768
|
return attrName;
|
|
4654
4769
|
}
|
|
4770
|
+
function unwrapExpression(expr) {
|
|
4771
|
+
let e = expr;
|
|
4772
|
+
while (t10.isParenthesizedExpression(e)) {
|
|
4773
|
+
e = e.expression;
|
|
4774
|
+
}
|
|
4775
|
+
return e;
|
|
4776
|
+
}
|
|
4777
|
+
function extractHtmlTemplatesFromRawConditional(rawExpr, ctx, slotId) {
|
|
4778
|
+
const childCtx = { ...ctx, elementPathPrefix: "__cs_" + slotId };
|
|
4779
|
+
const top = unwrapExpression(rawExpr);
|
|
4780
|
+
if (t10.isLogicalExpression(top) && top.operator === "&&") {
|
|
4781
|
+
return extractHtmlTemplatesFromRawConditional(top.right, ctx, slotId);
|
|
4782
|
+
}
|
|
4783
|
+
if (t10.isConditionalExpression(top)) {
|
|
4784
|
+
const truthyHtmlExpr = transformJSXExpression(top.consequent, childCtx);
|
|
4785
|
+
const alt = unwrapExpression(top.alternate);
|
|
4786
|
+
if (t10.isConditionalExpression(alt)) {
|
|
4787
|
+
return {
|
|
4788
|
+
truthyHtmlExpr,
|
|
4789
|
+
falsyHtmlExpr: transformJSXExpression(top.alternate, childCtx)
|
|
4790
|
+
};
|
|
4791
|
+
}
|
|
4792
|
+
return {
|
|
4793
|
+
truthyHtmlExpr,
|
|
4794
|
+
falsyHtmlExpr: transformJSXExpression(top.alternate, childCtx)
|
|
4795
|
+
};
|
|
4796
|
+
}
|
|
4797
|
+
return null;
|
|
4798
|
+
}
|
|
4655
4799
|
function extractHtmlTemplatesFromConditional(expr) {
|
|
4656
4800
|
const normalizeHtmlExpression = (value) => {
|
|
4657
4801
|
if (t10.isCallExpression(value) && t10.isMemberExpression(value.callee) && t10.isIdentifier(value.callee.property) && value.callee.property.name === "map") {
|
|
@@ -4667,7 +4811,11 @@ function extractHtmlTemplatesFromConditional(expr) {
|
|
|
4667
4811
|
}
|
|
4668
4812
|
if (t10.isConditionalExpression(expr)) {
|
|
4669
4813
|
const truthy = extractHtmlTemplatesFromConditional(expr.consequent).truthyHtmlExpr;
|
|
4670
|
-
const
|
|
4814
|
+
const alt = unwrapExpression(expr.alternate);
|
|
4815
|
+
if (t10.isConditionalExpression(alt)) {
|
|
4816
|
+
return { truthyHtmlExpr: truthy, falsyHtmlExpr: normalizeHtmlExpression(alt) };
|
|
4817
|
+
}
|
|
4818
|
+
const falsy = extractHtmlTemplatesFromConditional(alt).truthyHtmlExpr;
|
|
4671
4819
|
return { truthyHtmlExpr: truthy, falsyHtmlExpr: falsy };
|
|
4672
4820
|
}
|
|
4673
4821
|
if (t10.isParenthesizedExpression(expr)) {
|
|
@@ -4792,7 +4940,7 @@ function escapeHtml(str) {
|
|
|
4792
4940
|
var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "cite", "poster", "background"]);
|
|
4793
4941
|
function wrapWithSanitizeAttr(attrName, expr) {
|
|
4794
4942
|
if (!URL_ATTRS.has(attrName)) return expr;
|
|
4795
|
-
return t10.callExpression(t10.identifier("
|
|
4943
|
+
return t10.callExpression(t10.identifier("geaSanitizeAttr"), [
|
|
4796
4944
|
t10.stringLiteral(attrName),
|
|
4797
4945
|
t10.callExpression(t10.identifier("String"), [expr])
|
|
4798
4946
|
]);
|
|
@@ -4846,24 +4994,48 @@ var EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
4846
4994
|
"dblclick",
|
|
4847
4995
|
"change",
|
|
4848
4996
|
"input",
|
|
4997
|
+
"submit",
|
|
4998
|
+
"reset",
|
|
4999
|
+
"focus",
|
|
5000
|
+
"blur",
|
|
4849
5001
|
"keydown",
|
|
4850
5002
|
"keyup",
|
|
4851
|
-
"
|
|
4852
|
-
"focus",
|
|
5003
|
+
"keypress",
|
|
4853
5004
|
"mousedown",
|
|
4854
5005
|
"mouseup",
|
|
4855
|
-
"
|
|
5006
|
+
"mouseover",
|
|
5007
|
+
"mouseout",
|
|
5008
|
+
"mouseenter",
|
|
5009
|
+
"mouseleave",
|
|
5010
|
+
"mousemove",
|
|
5011
|
+
"contextmenu",
|
|
5012
|
+
"touchstart",
|
|
5013
|
+
"touchend",
|
|
5014
|
+
"touchmove",
|
|
5015
|
+
"pointerdown",
|
|
5016
|
+
"pointerup",
|
|
5017
|
+
"pointermove",
|
|
5018
|
+
"scroll",
|
|
5019
|
+
"resize",
|
|
5020
|
+
"drag",
|
|
5021
|
+
"dragstart",
|
|
5022
|
+
"dragend",
|
|
5023
|
+
"dragover",
|
|
5024
|
+
"dragleave",
|
|
5025
|
+
"drop",
|
|
5026
|
+
"animationstart",
|
|
5027
|
+
"animationend",
|
|
5028
|
+
"animationiteration",
|
|
5029
|
+
"transitionstart",
|
|
5030
|
+
"transitionend",
|
|
5031
|
+
"transitionrun",
|
|
5032
|
+
"transitioncancel",
|
|
4856
5033
|
"tap",
|
|
4857
5034
|
"longTap",
|
|
4858
5035
|
"swipeRight",
|
|
4859
5036
|
"swipeUp",
|
|
4860
5037
|
"swipeLeft",
|
|
4861
|
-
"swipeDown"
|
|
4862
|
-
"dragstart",
|
|
4863
|
-
"dragend",
|
|
4864
|
-
"dragover",
|
|
4865
|
-
"dragleave",
|
|
4866
|
-
"drop"
|
|
5038
|
+
"swipeDown"
|
|
4867
5039
|
]);
|
|
4868
5040
|
function transformJSXToTemplate(el, ctx, elementPath = []) {
|
|
4869
5041
|
const parts = jsxToTemplateParts(el, ctx, elementPath);
|
|
@@ -5551,8 +5723,9 @@ function processChildren(children, parts, ctx, elementPath, dcCursor, directChil
|
|
|
5551
5723
|
});
|
|
5552
5724
|
appendString(parts, `-->`);
|
|
5553
5725
|
pushString(parts, "");
|
|
5554
|
-
|
|
5555
|
-
|
|
5726
|
+
const slotCtx = { ...ctx, elementPathPrefix: "__cs_" + slot.slotId };
|
|
5727
|
+
let condExpr = transformJSXExpression(rawExpr, slotCtx);
|
|
5728
|
+
const extracted = extractHtmlTemplatesFromRawConditional(rawExpr, ctx, slot.slotId) ?? extractHtmlTemplatesFromConditional(condExpr);
|
|
5556
5729
|
slot.truthyHtmlExpr = extracted.truthyHtmlExpr;
|
|
5557
5730
|
slot.falsyHtmlExpr = extracted.falsyHtmlExpr;
|
|
5558
5731
|
if (expressionMayBeFalsy(rawExpr)) {
|
|
@@ -5608,9 +5781,7 @@ function processChildren(children, parts, ctx, elementPath, dcCursor, directChil
|
|
|
5608
5781
|
expr = t10.logicalExpression("||", expr, t10.stringLiteral(""));
|
|
5609
5782
|
}
|
|
5610
5783
|
const skipEscape = childCallInfo || isChildrenPropAccess(rawExpr) || expressionContainsJSX(rawExpr) || ctx.inMapCallback || callsJSXReturningProperty(rawExpr, ctx.classBody);
|
|
5611
|
-
const safeExpr = skipEscape ? expr : t10.callExpression(t10.identifier("
|
|
5612
|
-
t10.callExpression(t10.identifier("String"), [expr])
|
|
5613
|
-
]);
|
|
5784
|
+
const safeExpr = skipEscape ? expr : t10.callExpression(t10.identifier("geaEscapeHtml"), [t10.callExpression(t10.identifier("String"), [expr])]);
|
|
5614
5785
|
parts.push({ type: "expression", value: safeExpr });
|
|
5615
5786
|
}
|
|
5616
5787
|
}
|
|
@@ -6041,9 +6212,7 @@ function generatePatchItemMethod(arrayMap, templatePropNames, wholeParamName, te
|
|
|
6041
6212
|
const keyRenames = arrayMap.indexVariable ? /* @__PURE__ */ new Map([[arrayMap.indexVariable, "__idx"]]) : void 0;
|
|
6042
6213
|
const rawItemIdExpr = arrayMap.keyExpression ? t11.cloneNode(rewriteItemVarInExpression(arrayMap.keyExpression, arrayMap.itemVariable, "item", keyRenames), true) : itemIdProperty && itemIdProperty !== ITEM_IS_KEY ? t11.logicalExpression("??", buildOptionalMemberChain(t11.identifier("item"), itemIdProperty), t11.identifier("item")) : t11.identifier("item");
|
|
6043
6214
|
const itemIdExpr = t11.callExpression(t11.identifier("String"), [rawItemIdExpr]);
|
|
6044
|
-
body.push(
|
|
6045
|
-
t11.expressionStatement(t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaKey")), itemIdExpr))
|
|
6046
|
-
);
|
|
6215
|
+
body.push(t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_KEY"), itemIdExpr)));
|
|
6047
6216
|
const rowElsProp = `__rowEls_${arrayMap.containerBindingId ?? "list"}`;
|
|
6048
6217
|
const privateElsRef = t11.memberExpression(t11.thisExpression(), t11.privateName(t11.identifier(rowElsProp)));
|
|
6049
6218
|
body.push(
|
|
@@ -6065,9 +6234,7 @@ function generatePatchItemMethod(arrayMap, templatePropNames, wholeParamName, te
|
|
|
6065
6234
|
);
|
|
6066
6235
|
const patchPrivateFields = [rowElsProp];
|
|
6067
6236
|
body.push(
|
|
6068
|
-
t11.expressionStatement(
|
|
6069
|
-
t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaItem")), t11.identifier("item"))
|
|
6070
|
-
)
|
|
6237
|
+
t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_ITEM"), t11.identifier("item")))
|
|
6071
6238
|
);
|
|
6072
6239
|
const params = [t11.identifier("row"), t11.identifier("item"), t11.identifier("__prevItem")];
|
|
6073
6240
|
if (arrayMap.indexVariable) params.push(t11.identifier("__idx"));
|
|
@@ -6111,6 +6278,9 @@ function collectPatchEntries(arrayMap) {
|
|
|
6111
6278
|
if (t11.isJSXElement(modified)) {
|
|
6112
6279
|
const rootTagName = getJSXTagName(modified.openingElement.name);
|
|
6113
6280
|
const rootIsComponent = isComponentTag(rootTagName);
|
|
6281
|
+
if (!rootIsComponent && !requiresRerender) {
|
|
6282
|
+
requiresRerender = templateHasChildComponent(modified);
|
|
6283
|
+
}
|
|
6114
6284
|
walkJSXForPatch(modified, [], entries, rootIsComponent);
|
|
6115
6285
|
}
|
|
6116
6286
|
for (const ent of entries) {
|
|
@@ -6195,7 +6365,9 @@ function walkJSXForPatch(node, path, entries, rootIsComponent = false) {
|
|
|
6195
6365
|
let elementIndex = 0;
|
|
6196
6366
|
for (const child of node.children) {
|
|
6197
6367
|
if (t11.isJSXElement(child)) {
|
|
6198
|
-
|
|
6368
|
+
if (!isComponentTag(getJSXTagName(child.openingElement.name))) {
|
|
6369
|
+
walkJSXForPatch(child, [...path, elementIndex], entries);
|
|
6370
|
+
}
|
|
6199
6371
|
elementIndex++;
|
|
6200
6372
|
}
|
|
6201
6373
|
}
|
|
@@ -6390,7 +6562,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6390
6562
|
t11.expressionStatement(
|
|
6391
6563
|
t11.assignmentExpression(
|
|
6392
6564
|
"=",
|
|
6393
|
-
|
|
6565
|
+
buildExprGeaMember(t11.identifier("el"), "GEA_DOM_PROPS"),
|
|
6394
6566
|
t11.objectExpression(propsProperties)
|
|
6395
6567
|
)
|
|
6396
6568
|
)
|
|
@@ -6431,7 +6603,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6431
6603
|
t11.assignmentExpression(
|
|
6432
6604
|
"=",
|
|
6433
6605
|
t11.cloneNode(privateRsField),
|
|
6434
|
-
|
|
6606
|
+
buildExprGeaMember(t11.identifier(arrayMap.storeVar), "GEA_PROXY_RAW")
|
|
6435
6607
|
)
|
|
6436
6608
|
)
|
|
6437
6609
|
)
|
|
@@ -6479,7 +6651,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6479
6651
|
t11.expressionStatement(
|
|
6480
6652
|
t11.assignmentExpression(
|
|
6481
6653
|
"=",
|
|
6482
|
-
|
|
6654
|
+
buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
|
|
6483
6655
|
t11.memberExpression(
|
|
6484
6656
|
t11.memberExpression(t11.identifier("__tw"), t11.identifier("content")),
|
|
6485
6657
|
t11.identifier("firstElementChild")
|
|
@@ -6489,7 +6661,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6489
6661
|
t11.expressionStatement(
|
|
6490
6662
|
t11.optionalCallExpression(
|
|
6491
6663
|
t11.optionalMemberExpression(
|
|
6492
|
-
|
|
6664
|
+
buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
|
|
6493
6665
|
t11.identifier("removeAttribute"),
|
|
6494
6666
|
false,
|
|
6495
6667
|
true
|
|
@@ -6504,13 +6676,13 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6504
6676
|
t11.ifStatement(
|
|
6505
6677
|
t11.logicalExpression(
|
|
6506
6678
|
"&&",
|
|
6507
|
-
|
|
6508
|
-
t11.memberExpression(
|
|
6679
|
+
buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
|
|
6680
|
+
t11.memberExpression(buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"), t11.identifier("className"))
|
|
6509
6681
|
),
|
|
6510
6682
|
t11.expressionStatement(
|
|
6511
6683
|
t11.assignmentExpression(
|
|
6512
6684
|
"=",
|
|
6513
|
-
t11.memberExpression(
|
|
6685
|
+
t11.memberExpression(buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"), t11.identifier("className")),
|
|
6514
6686
|
t11.stringLiteral("")
|
|
6515
6687
|
)
|
|
6516
6688
|
)
|
|
@@ -6519,19 +6691,19 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6519
6691
|
}
|
|
6520
6692
|
body.push(
|
|
6521
6693
|
t11.ifStatement(
|
|
6522
|
-
t11.unaryExpression("!",
|
|
6694
|
+
t11.unaryExpression("!", buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL")),
|
|
6523
6695
|
t11.blockStatement([t11.tryStatement(t11.blockStatement(tplInit), loggingCatchClause())])
|
|
6524
6696
|
)
|
|
6525
6697
|
);
|
|
6526
6698
|
body.push(
|
|
6527
6699
|
t11.ifStatement(
|
|
6528
|
-
|
|
6700
|
+
buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
|
|
6529
6701
|
t11.blockStatement([
|
|
6530
6702
|
t11.variableDeclaration("var", [
|
|
6531
6703
|
t11.variableDeclarator(
|
|
6532
6704
|
elVar,
|
|
6533
6705
|
t11.callExpression(
|
|
6534
|
-
t11.memberExpression(
|
|
6706
|
+
t11.memberExpression(buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"), t11.identifier("cloneNode")),
|
|
6535
6707
|
[t11.booleanLiteral(true)]
|
|
6536
6708
|
)
|
|
6537
6709
|
)
|
|
@@ -6732,14 +6904,10 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6732
6904
|
) : itemIdProperty && itemIdProperty !== ITEM_IS_KEY ? t11.logicalExpression("??", buildOptionalMemberChain(t11.identifier("item"), itemIdProperty), t11.identifier("item")) : t11.identifier("item");
|
|
6733
6905
|
const patchItemIdExpr = t11.callExpression(t11.identifier("String"), [rawPatchItemIdExpr]);
|
|
6734
6906
|
body.push(
|
|
6735
|
-
t11.expressionStatement(
|
|
6736
|
-
t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaKey")), patchItemIdExpr)
|
|
6737
|
-
)
|
|
6907
|
+
t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_KEY"), patchItemIdExpr))
|
|
6738
6908
|
);
|
|
6739
6909
|
body.push(
|
|
6740
|
-
t11.expressionStatement(
|
|
6741
|
-
t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaItem")), t11.identifier("item"))
|
|
6742
|
-
)
|
|
6910
|
+
t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_ITEM"), t11.identifier("item")))
|
|
6743
6911
|
);
|
|
6744
6912
|
if (itemTemplateRootIsComponent && t11.isJSXElement(arrayMap.itemTemplate)) {
|
|
6745
6913
|
const propsProperties = [];
|
|
@@ -6770,11 +6938,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
|
|
|
6770
6938
|
if (propsProperties.length > 0) {
|
|
6771
6939
|
body.push(
|
|
6772
6940
|
t11.expressionStatement(
|
|
6773
|
-
t11.assignmentExpression(
|
|
6774
|
-
"=",
|
|
6775
|
-
t11.memberExpression(elVar, t11.identifier("__geaProps")),
|
|
6776
|
-
t11.objectExpression(propsProperties)
|
|
6777
|
-
)
|
|
6941
|
+
t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_PROPS"), t11.objectExpression(propsProperties))
|
|
6778
6942
|
)
|
|
6779
6943
|
);
|
|
6780
6944
|
}
|
|
@@ -6823,6 +6987,14 @@ function branchContainsJSX(expr) {
|
|
|
6823
6987
|
});
|
|
6824
6988
|
return containsJSX;
|
|
6825
6989
|
}
|
|
6990
|
+
function templateHasChildComponent(root) {
|
|
6991
|
+
for (const child of root.children) {
|
|
6992
|
+
if (!t11.isJSXElement(child)) continue;
|
|
6993
|
+
if (isComponentTag(getJSXTagName(child.openingElement.name))) return true;
|
|
6994
|
+
if (templateHasChildComponent(child)) return true;
|
|
6995
|
+
}
|
|
6996
|
+
return false;
|
|
6997
|
+
}
|
|
6826
6998
|
|
|
6827
6999
|
// src/generate-clone.ts
|
|
6828
7000
|
var EVENT_TYPES2 = /* @__PURE__ */ new Set([
|
|
@@ -6830,24 +7002,48 @@ var EVENT_TYPES2 = /* @__PURE__ */ new Set([
|
|
|
6830
7002
|
"dblclick",
|
|
6831
7003
|
"change",
|
|
6832
7004
|
"input",
|
|
7005
|
+
"submit",
|
|
7006
|
+
"reset",
|
|
7007
|
+
"focus",
|
|
7008
|
+
"blur",
|
|
6833
7009
|
"keydown",
|
|
6834
7010
|
"keyup",
|
|
6835
|
-
"
|
|
6836
|
-
"focus",
|
|
7011
|
+
"keypress",
|
|
6837
7012
|
"mousedown",
|
|
6838
7013
|
"mouseup",
|
|
6839
|
-
"
|
|
7014
|
+
"mouseover",
|
|
7015
|
+
"mouseout",
|
|
7016
|
+
"mouseenter",
|
|
7017
|
+
"mouseleave",
|
|
7018
|
+
"mousemove",
|
|
7019
|
+
"contextmenu",
|
|
7020
|
+
"touchstart",
|
|
7021
|
+
"touchend",
|
|
7022
|
+
"touchmove",
|
|
7023
|
+
"pointerdown",
|
|
7024
|
+
"pointerup",
|
|
7025
|
+
"pointermove",
|
|
7026
|
+
"scroll",
|
|
7027
|
+
"resize",
|
|
7028
|
+
"drag",
|
|
7029
|
+
"dragstart",
|
|
7030
|
+
"dragend",
|
|
7031
|
+
"dragover",
|
|
7032
|
+
"dragleave",
|
|
7033
|
+
"drop",
|
|
7034
|
+
"animationstart",
|
|
7035
|
+
"animationend",
|
|
7036
|
+
"animationiteration",
|
|
7037
|
+
"transitionstart",
|
|
7038
|
+
"transitionend",
|
|
7039
|
+
"transitionrun",
|
|
7040
|
+
"transitioncancel",
|
|
6840
7041
|
"tap",
|
|
6841
7042
|
"longTap",
|
|
6842
7043
|
"swipeRight",
|
|
6843
7044
|
"swipeUp",
|
|
6844
7045
|
"swipeLeft",
|
|
6845
|
-
"swipeDown"
|
|
6846
|
-
"dragstart",
|
|
6847
|
-
"dragend",
|
|
6848
|
-
"dragover",
|
|
6849
|
-
"dragleave",
|
|
6850
|
-
"drop"
|
|
7046
|
+
"swipeDown"
|
|
6851
7047
|
]);
|
|
6852
7048
|
var VOID_ELEMENTS2 = /* @__PURE__ */ new Set([
|
|
6853
7049
|
"area",
|
|
@@ -7343,7 +7539,13 @@ function generateCloneMembers(root, analysis, templateParams, sourceFile, import
|
|
|
7343
7539
|
true
|
|
7344
7540
|
);
|
|
7345
7541
|
const cloneMethodBody = buildCloneTemplateBody(identityPatches, contentPatches, cloneCtx);
|
|
7346
|
-
const cloneMethod = t12.classMethod(
|
|
7542
|
+
const cloneMethod = t12.classMethod(
|
|
7543
|
+
"method",
|
|
7544
|
+
t12.identifier("GEA_CLONE_TEMPLATE"),
|
|
7545
|
+
[],
|
|
7546
|
+
t12.blockStatement(cloneMethodBody),
|
|
7547
|
+
true
|
|
7548
|
+
);
|
|
7347
7549
|
return [staticField, cloneMethod];
|
|
7348
7550
|
}
|
|
7349
7551
|
function buildCloneTemplateBody(identityPatches, contentPatches, cloneCtx) {
|
|
@@ -7616,18 +7818,34 @@ function ensureMapItemHelper(classBody2, ctx, helperName) {
|
|
|
7616
7818
|
)
|
|
7617
7819
|
);
|
|
7618
7820
|
const method = jsMethod2`${id4(helperName)}(e) {}`;
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7821
|
+
if (!ctx.keyExpression && ctx.itemIdProperty && ctx.itemIdProperty !== ITEM_IS_KEY) {
|
|
7822
|
+
method.body.body.push(
|
|
7823
|
+
...buildGeaItemDomWalk(),
|
|
7824
|
+
...jsBlockBody`
|
|
7825
|
+
if (!__el) return null;
|
|
7826
|
+
if (__el[GEA_DOM_ITEM]) return __el[GEA_DOM_ITEM];
|
|
7827
|
+
const __itemId = __el[GEA_DOM_KEY] ?? (__el.getAttribute && __el.getAttribute('data-gea-item-id'));
|
|
7828
|
+
if (__itemId == null) return null;
|
|
7829
|
+
const __items = ${itemsExpr};
|
|
7830
|
+
const __arr = Array.isArray(__items) ? __items : Array.isArray(__items?.[GEA_PROXY_GET_TARGET]) ? __items[GEA_PROXY_GET_TARGET] : [];
|
|
7831
|
+
const __found = __arr.find(${findPredicate});
|
|
7832
|
+
return __found != null ? __found : { ${ctx.itemIdProperty}: __itemId };
|
|
7833
|
+
`
|
|
7834
|
+
);
|
|
7835
|
+
} else {
|
|
7836
|
+
method.body.body.push(
|
|
7837
|
+
...buildGeaItemDomWalk(),
|
|
7838
|
+
...jsBlockBody`
|
|
7839
|
+
if (!__el) return null;
|
|
7840
|
+
if (__el[GEA_DOM_ITEM]) return __el[GEA_DOM_ITEM];
|
|
7841
|
+
const __itemId = __el[GEA_DOM_KEY] ?? (__el.getAttribute && __el.getAttribute('data-gea-item-id'));
|
|
7842
|
+
if (__itemId == null) return null;
|
|
7843
|
+
const __items = ${itemsExpr};
|
|
7844
|
+
const __arr = Array.isArray(__items) ? __items : Array.isArray(__items?.[GEA_PROXY_GET_TARGET]) ? __items[GEA_PROXY_GET_TARGET] : [];
|
|
7845
|
+
return __arr.find(${findPredicate}) || __itemId;
|
|
7846
|
+
`
|
|
7847
|
+
);
|
|
7848
|
+
}
|
|
7631
7849
|
classBody2.body.unshift(method);
|
|
7632
7850
|
}
|
|
7633
7851
|
function getLocalFunctionInSetup(name, setupStatements) {
|
|
@@ -7639,12 +7857,17 @@ function getLocalFunctionInSetup(name, setupStatements) {
|
|
|
7639
7857
|
}
|
|
7640
7858
|
return null;
|
|
7641
7859
|
}
|
|
7642
|
-
function appendCompiledEventMethods(classBody2, handlers, setupStatements = []) {
|
|
7860
|
+
function appendCompiledEventMethods(classBody2, handlers, setupStatements = [], fileAst) {
|
|
7643
7861
|
if (handlers.length === 0) return false;
|
|
7644
7862
|
const paramContext = getTemplateParamContext(classBody2);
|
|
7645
7863
|
const mapHandlers = handlers.filter(
|
|
7646
7864
|
(h) => Boolean(h.mapContext)
|
|
7647
7865
|
);
|
|
7866
|
+
if (mapHandlers.length > 0 && fileAst) {
|
|
7867
|
+
ensureImport(fileAst, "@geajs/core", "GEA_MAPS");
|
|
7868
|
+
ensureImport(fileAst, "@geajs/core", "GEA_DOM_KEY");
|
|
7869
|
+
ensureImport(fileAst, "@geajs/core", "GEA_DOM_ITEM");
|
|
7870
|
+
}
|
|
7648
7871
|
const seenContexts = /* @__PURE__ */ new Set();
|
|
7649
7872
|
for (const h of mapHandlers) {
|
|
7650
7873
|
const key = getMapContextKey(h.mapContext);
|
|
@@ -7659,6 +7882,13 @@ function appendCompiledEventMethods(classBody2, handlers, setupStatements = [])
|
|
|
7659
7882
|
function isDirectThisMethodRef(handler) {
|
|
7660
7883
|
return !!handler.handlerExpression && t13.isMemberExpression(handler.handlerExpression) && t13.isThisExpression(handler.handlerExpression.object) && t13.isIdentifier(handler.handlerExpression.property) && !handler.delegatedPropName && !handler.mapContext;
|
|
7661
7884
|
}
|
|
7885
|
+
function wrapEventsGetterHandlerRef(methodProperty) {
|
|
7886
|
+
const callee = t13.memberExpression(t13.thisExpression(), methodProperty);
|
|
7887
|
+
return t13.arrowFunctionExpression(
|
|
7888
|
+
[t13.identifier("e"), t13.identifier("targetComponent")],
|
|
7889
|
+
t13.callExpression(callee, [t13.identifier("e"), t13.identifier("targetComponent")])
|
|
7890
|
+
);
|
|
7891
|
+
}
|
|
7662
7892
|
function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupStatements) {
|
|
7663
7893
|
const getter = ensureEventsGetter(classBody2);
|
|
7664
7894
|
const eventsObject = getEventsObject(getter);
|
|
@@ -7667,7 +7897,7 @@ function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupSta
|
|
|
7667
7897
|
let handlerRef;
|
|
7668
7898
|
if (isDirectThisMethodRef(handler)) {
|
|
7669
7899
|
const prop = handler.handlerExpression.property;
|
|
7670
|
-
handlerRef =
|
|
7900
|
+
handlerRef = wrapEventsGetterHandlerRef(t13.cloneNode(prop));
|
|
7671
7901
|
} else {
|
|
7672
7902
|
let methodName = handler.methodName || `__event_${handler.eventType}_${index}`;
|
|
7673
7903
|
let uniqueIndex = 1;
|
|
@@ -7678,7 +7908,7 @@ function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupSta
|
|
|
7678
7908
|
if (!findClassMethod(classBody2, methodName)) {
|
|
7679
7909
|
classBody2.body.push(buildSelectorHandlerMethod(handler, methodName, paramContext, setupStatements));
|
|
7680
7910
|
}
|
|
7681
|
-
handlerRef =
|
|
7911
|
+
handlerRef = wrapEventsGetterHandlerRef(t13.identifier(methodName));
|
|
7682
7912
|
}
|
|
7683
7913
|
const selectorExpr = handler.selectorExpression ? replacePropRefsInExpression(
|
|
7684
7914
|
t13.cloneNode(handler.selectorExpression, true),
|
|
@@ -7812,7 +8042,7 @@ function replacePropsObjectRefsInNode(node, propsObjectName) {
|
|
|
7812
8042
|
replacePropsObjectRefsInNode(node.object, propsObjectName),
|
|
7813
8043
|
node.property,
|
|
7814
8044
|
node.computed,
|
|
7815
|
-
node.optional
|
|
8045
|
+
node.optional ?? true
|
|
7816
8046
|
);
|
|
7817
8047
|
}
|
|
7818
8048
|
if (t13.isOptionalCallExpression(node)) {
|
|
@@ -7821,7 +8051,7 @@ function replacePropsObjectRefsInNode(node, propsObjectName) {
|
|
|
7821
8051
|
node.arguments.map(
|
|
7822
8052
|
(a) => t13.isExpression(a) ? replacePropsObjectRefsInNode(a, propsObjectName) : a
|
|
7823
8053
|
),
|
|
7824
|
-
node.optional
|
|
8054
|
+
node.optional ?? true
|
|
7825
8055
|
);
|
|
7826
8056
|
}
|
|
7827
8057
|
if (t13.isConditionalExpression(node)) {
|
|
@@ -7918,7 +8148,7 @@ function buildArrayItemsExpr(ctx, opts = {}) {
|
|
|
7918
8148
|
return t13.callExpression(
|
|
7919
8149
|
t13.memberExpression(
|
|
7920
8150
|
t13.memberExpression(
|
|
7921
|
-
t13.memberExpression(t13.thisExpression(), t13.identifier("
|
|
8151
|
+
t13.memberExpression(t13.thisExpression(), t13.identifier("GEA_MAPS"), true),
|
|
7922
8152
|
t13.numericLiteral(mapIdx),
|
|
7923
8153
|
true
|
|
7924
8154
|
),
|
|
@@ -7927,7 +8157,7 @@ function buildArrayItemsExpr(ctx, opts = {}) {
|
|
|
7927
8157
|
[]
|
|
7928
8158
|
);
|
|
7929
8159
|
}
|
|
7930
|
-
const base = ctx.isImportedState ? opts.raw ?
|
|
8160
|
+
const base = ctx.isImportedState ? opts.raw ? buildExprGeaMember(t13.identifier(ctx.storeVar || "store"), "GEA_PROXY_RAW") : t13.identifier(ctx.storeVar || "store") : t13.thisExpression();
|
|
7931
8161
|
if (ctx.arrayPathParts.length === 0) return base;
|
|
7932
8162
|
const [, ...rest] = ctx.arrayPathParts;
|
|
7933
8163
|
const isIndex = /^\d+$/.test(first);
|
|
@@ -7937,7 +8167,7 @@ function buildArrayItemsExpr(ctx, opts = {}) {
|
|
|
7937
8167
|
function buildGeaItemDomWalk() {
|
|
7938
8168
|
return jsBlockBody`
|
|
7939
8169
|
var __el = e.target;
|
|
7940
|
-
while (__el && __el
|
|
8170
|
+
while (__el && __el[GEA_DOM_KEY] == null && (!__el.getAttribute || !__el.getAttribute('data-gea-item-id'))) __el = __el.parentElement;
|
|
7941
8171
|
`;
|
|
7942
8172
|
}
|
|
7943
8173
|
function buildMapEventBody(handler, paramContext) {
|
|
@@ -7955,8 +8185,8 @@ function buildMapEventBody(handler, paramContext) {
|
|
|
7955
8185
|
const preamble2 = [
|
|
7956
8186
|
...buildGeaItemDomWalk(),
|
|
7957
8187
|
...jsBlockBody`
|
|
7958
|
-
if (!__el || !__el
|
|
7959
|
-
const ${id4(ctx.indexVariable)} = ${rawArrayExpr}.indexOf(__el
|
|
8188
|
+
if (!__el || !__el[GEA_DOM_ITEM]) return;
|
|
8189
|
+
const ${id4(ctx.indexVariable)} = ${rawArrayExpr}.indexOf(__el[GEA_DOM_ITEM]);
|
|
7960
8190
|
`
|
|
7961
8191
|
];
|
|
7962
8192
|
return [...preamble2, ...handlerBody];
|
|
@@ -7970,7 +8200,7 @@ function buildMapEventBody(handler, paramContext) {
|
|
|
7970
8200
|
preamble.push(
|
|
7971
8201
|
...buildGeaItemDomWalk(),
|
|
7972
8202
|
...jsBlockBody`
|
|
7973
|
-
const ${id4(ctx.indexVariable)} = __el ? ${rawArrayExpr}.indexOf(__el
|
|
8203
|
+
const ${id4(ctx.indexVariable)} = __el ? ${rawArrayExpr}.indexOf(__el[GEA_DOM_ITEM]) : -1;
|
|
7974
8204
|
`
|
|
7975
8205
|
);
|
|
7976
8206
|
}
|
|
@@ -8095,10 +8325,7 @@ function injectChildComponents(ast, componentInstances, directForwardingChildren
|
|
|
8095
8325
|
t14.assignmentExpression(
|
|
8096
8326
|
"=",
|
|
8097
8327
|
t14.memberExpression(t14.thisExpression(), t14.identifier(backingField)),
|
|
8098
|
-
t14.callExpression(
|
|
8099
|
-
t14.identifier(child.tagName),
|
|
8100
|
-
propsArg
|
|
8101
|
-
])
|
|
8328
|
+
t14.callExpression(buildThisGeaMember("GEA_CHILD"), [t14.identifier(child.tagName), propsArg])
|
|
8102
8329
|
)
|
|
8103
8330
|
)
|
|
8104
8331
|
),
|
|
@@ -8171,10 +8398,7 @@ function buildInstanceStatements(instances, directForwardingChildren) {
|
|
|
8171
8398
|
t14.assignmentExpression(
|
|
8172
8399
|
"=",
|
|
8173
8400
|
t14.memberExpression(t14.thisExpression(), t14.identifier(child.instanceVar)),
|
|
8174
|
-
t14.callExpression(
|
|
8175
|
-
t14.identifier(child.tagName),
|
|
8176
|
-
propsArg
|
|
8177
|
-
])
|
|
8401
|
+
t14.callExpression(buildThisGeaMember("GEA_CHILD"), [t14.identifier(child.tagName), propsArg])
|
|
8178
8402
|
)
|
|
8179
8403
|
)
|
|
8180
8404
|
);
|
|
@@ -8312,10 +8536,7 @@ function buildValueExpression(textExpr, stateRefs) {
|
|
|
8312
8536
|
return rewriteStateRefs(t15.cloneNode(textExpr.expression, true), stateRefs);
|
|
8313
8537
|
}
|
|
8314
8538
|
if (textExpr.isImportedState && textExpr.storeVar) {
|
|
8315
|
-
return buildMemberChainFromParts(
|
|
8316
|
-
t15.memberExpression(t15.identifier(textExpr.storeVar), t15.identifier("__store")),
|
|
8317
|
-
textExpr.pathParts
|
|
8318
|
-
);
|
|
8539
|
+
return buildMemberChainFromParts(t15.identifier(textExpr.storeVar), textExpr.pathParts);
|
|
8319
8540
|
}
|
|
8320
8541
|
return buildMemberChainFromParts(t15.thisExpression(), textExpr.pathParts);
|
|
8321
8542
|
}
|
|
@@ -8335,19 +8556,15 @@ function rewriteStateRefs(expr, stateRefs) {
|
|
|
8335
8556
|
} else if (ref.kind === "local") {
|
|
8336
8557
|
path.replaceWith(t15.thisExpression());
|
|
8337
8558
|
} else if ((ref.kind === "imported-destructured" || ref.kind === "store-alias") && ref.storeVar && ref.propName) {
|
|
8338
|
-
path.replaceWith(
|
|
8339
|
-
t15.memberExpression(
|
|
8340
|
-
t15.memberExpression(t15.identifier(ref.storeVar), t15.identifier("__store")),
|
|
8341
|
-
t15.identifier(ref.propName)
|
|
8342
|
-
)
|
|
8343
|
-
);
|
|
8559
|
+
path.replaceWith(t15.memberExpression(t15.identifier(ref.storeVar), t15.identifier(ref.propName)));
|
|
8344
8560
|
path.skip();
|
|
8345
8561
|
} else if (ref.kind === "local-destructured" && ref.propName) {
|
|
8346
8562
|
path.replaceWith(t15.memberExpression(t15.thisExpression(), t15.identifier(ref.propName)));
|
|
8347
8563
|
path.skip();
|
|
8348
|
-
} else {
|
|
8349
|
-
path.replaceWith(t15.memberExpression(t15.identifier(path.node.name), t15.identifier("__store")));
|
|
8564
|
+
} else if (ref.kind === "imported") {
|
|
8350
8565
|
path.skip();
|
|
8566
|
+
} else {
|
|
8567
|
+
throw new Error(`rewriteStateRefs: unhandled state ref kind ${ref.kind}`);
|
|
8351
8568
|
}
|
|
8352
8569
|
}
|
|
8353
8570
|
});
|
|
@@ -8391,7 +8608,7 @@ function buildSimpleUpdate(binding, param, stateRefs) {
|
|
|
8391
8608
|
}
|
|
8392
8609
|
if (target === "textContent" && binding.bindingId && binding.bindingId !== "" && !binding.userIdExpr) {
|
|
8393
8610
|
const suffix = t15.stringLiteral(binding.bindingId);
|
|
8394
|
-
return
|
|
8611
|
+
return t15.expressionStatement(t15.callExpression(buildThisGeaMember("GEA_UPDATE_TEXT"), [suffix, valueExpr]));
|
|
8395
8612
|
}
|
|
8396
8613
|
return js3`if (${el}) { ${jsExpr2`${el}.${id6(target)}`} = ${valueExpr}; }`;
|
|
8397
8614
|
}
|
|
@@ -8647,7 +8864,7 @@ function buildPropPatcherFunction(binding, propName) {
|
|
|
8647
8864
|
t17.variableDeclaration("const", [
|
|
8648
8865
|
t17.variableDeclarator(
|
|
8649
8866
|
t17.identifier("__newAttr"),
|
|
8650
|
-
URL_ATTRS2.has(attrName) ? t17.callExpression(t17.identifier("
|
|
8867
|
+
URL_ATTRS2.has(attrName) ? t17.callExpression(t17.identifier("geaSanitizeAttr"), [
|
|
8651
8868
|
t17.stringLiteral(attrName),
|
|
8652
8869
|
t17.callExpression(t17.identifier("String"), [t17.identifier("__attrValue")])
|
|
8653
8870
|
]) : t17.callExpression(t17.identifier("String"), [t17.identifier("__attrValue")])
|
|
@@ -9021,7 +9238,9 @@ function generateEnsureArrayConfigsMethod(arrayMaps) {
|
|
|
9021
9238
|
])
|
|
9022
9239
|
);
|
|
9023
9240
|
});
|
|
9024
|
-
|
|
9241
|
+
const method = t17.classMethod("method", t17.identifier("GEA_ENSURE_ARRAY_CONFIGS"), [], t17.blockStatement([]), true);
|
|
9242
|
+
method.body.body.push(...body);
|
|
9243
|
+
return method;
|
|
9025
9244
|
}
|
|
9026
9245
|
function generateArrayRelationalObserver(path, arrayMap, bindings, methodName) {
|
|
9027
9246
|
const arrayPath = pathPartsToString(getArrayPathParts(arrayMap));
|
|
@@ -9096,12 +9315,12 @@ function generateArrayConditionalPatchObserver(arrayMap, bindings, methodName) {
|
|
|
9096
9315
|
const containerName = `__${arrayPath.replace(/\./g, "_")}_container`;
|
|
9097
9316
|
const containerRef = t17.memberExpression(t17.thisExpression(), t17.identifier(containerName));
|
|
9098
9317
|
const proxiedArr = arrayMap.isImportedState ? buildMemberChain(
|
|
9099
|
-
|
|
9318
|
+
buildExprGeaMember(t17.identifier(arrayMap.storeVar || "store"), "GEA_STORE_ROOT"),
|
|
9100
9319
|
arrayPath
|
|
9101
9320
|
) : buildMemberChain(t17.thisExpression(), arrayPath);
|
|
9102
9321
|
const rawArrExpr = t17.logicalExpression(
|
|
9103
9322
|
"||",
|
|
9104
|
-
|
|
9323
|
+
buildExprGeaMember(t17.cloneNode(proxiedArr, true), "GEA_PROXY_GET_TARGET"),
|
|
9105
9324
|
t17.cloneNode(proxiedArr, true)
|
|
9106
9325
|
);
|
|
9107
9326
|
const loopBody = [
|
|
@@ -9154,12 +9373,12 @@ function generateArrayConditionalRerenderObserver(arrayMap, methodName) {
|
|
|
9154
9373
|
const containerRef = t17.memberExpression(t17.thisExpression(), t17.identifier(containerName));
|
|
9155
9374
|
const configRef = t17.memberExpression(t17.thisExpression(), t17.identifier(getArrayConfigPropName(arrayMap)));
|
|
9156
9375
|
const proxiedArr = arrayMap.isImportedState ? buildMemberChain(
|
|
9157
|
-
|
|
9376
|
+
buildExprGeaMember(t17.identifier(arrayMap.storeVar || "store"), "GEA_STORE_ROOT"),
|
|
9158
9377
|
arrayPath
|
|
9159
9378
|
) : buildMemberChain(t17.thisExpression(), arrayPath);
|
|
9160
9379
|
const rawArrExpr = t17.logicalExpression(
|
|
9161
9380
|
"||",
|
|
9162
|
-
|
|
9381
|
+
buildExprGeaMember(t17.cloneNode(proxiedArr, true), "GEA_PROXY_GET_TARGET"),
|
|
9163
9382
|
t17.cloneNode(proxiedArr, true)
|
|
9164
9383
|
);
|
|
9165
9384
|
return appendToBody3(
|
|
@@ -9237,9 +9456,7 @@ function generateArrayConditionalRerenderObserver(arrayMap, methodName) {
|
|
|
9237
9456
|
t17.ifStatement(
|
|
9238
9457
|
t17.unaryExpression("!", t17.identifier("__skipArrayConditionalRerender")),
|
|
9239
9458
|
t17.blockStatement([
|
|
9240
|
-
t17.expressionStatement(
|
|
9241
|
-
t17.callExpression(t17.memberExpression(t17.thisExpression(), t17.identifier("__ensureArrayConfigs")), [])
|
|
9242
|
-
),
|
|
9459
|
+
t17.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")),
|
|
9243
9460
|
t17.variableDeclaration("const", [
|
|
9244
9461
|
t17.variableDeclarator(
|
|
9245
9462
|
t17.identifier("__arr"),
|
|
@@ -9251,7 +9468,7 @@ function generateArrayConditionalRerenderObserver(arrayMap, methodName) {
|
|
|
9251
9468
|
)
|
|
9252
9469
|
]),
|
|
9253
9470
|
t17.expressionStatement(
|
|
9254
|
-
|
|
9471
|
+
buildThisGeaCall("GEA_APPLY_LIST_CHANGES", [
|
|
9255
9472
|
containerRef,
|
|
9256
9473
|
t17.identifier("__arr"),
|
|
9257
9474
|
t17.nullLiteral(),
|
|
@@ -9372,16 +9589,12 @@ function buildElsLookup(elsRef, containerRef, idExpr, rowVar, containerBindingId
|
|
|
9372
9589
|
"||",
|
|
9373
9590
|
t17.binaryExpression(
|
|
9374
9591
|
"==",
|
|
9375
|
-
|
|
9592
|
+
buildExprGeaMember(t17.identifier("__ch"), "GEA_DOM_KEY"),
|
|
9376
9593
|
t17.cloneNode(idExpr, true)
|
|
9377
9594
|
),
|
|
9378
9595
|
t17.logicalExpression(
|
|
9379
9596
|
"&&",
|
|
9380
|
-
t17.binaryExpression(
|
|
9381
|
-
"==",
|
|
9382
|
-
t17.memberExpression(t17.identifier("__ch"), t17.identifier("__geaKey")),
|
|
9383
|
-
t17.nullLiteral()
|
|
9384
|
-
),
|
|
9597
|
+
t17.binaryExpression("==", buildExprGeaMember(t17.identifier("__ch"), "GEA_DOM_KEY"), t17.nullLiteral()),
|
|
9385
9598
|
t17.binaryExpression(
|
|
9386
9599
|
"==",
|
|
9387
9600
|
t17.optionalCallExpression(
|
|
@@ -9469,11 +9682,9 @@ function generateArrayHandlers(arrayMap, methodName) {
|
|
|
9469
9682
|
t17.returnStatement()
|
|
9470
9683
|
])
|
|
9471
9684
|
),
|
|
9685
|
+
t17.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")),
|
|
9472
9686
|
t17.expressionStatement(
|
|
9473
|
-
|
|
9474
|
-
),
|
|
9475
|
-
t17.expressionStatement(
|
|
9476
|
-
t17.callExpression(t17.memberExpression(t17.thisExpression(), t17.identifier("__applyListChanges")), [
|
|
9687
|
+
buildThisGeaCall("GEA_APPLY_LIST_CHANGES", [
|
|
9477
9688
|
containerRef,
|
|
9478
9689
|
t17.identifier(paramName),
|
|
9479
9690
|
t17.identifier("change"),
|
|
@@ -9811,7 +10022,7 @@ function generateRenderItemMethod(arrayMap, imports, eventHandlers, eventIdCount
|
|
|
9811
10022
|
t18.assignmentExpression(
|
|
9812
10023
|
"=",
|
|
9813
10024
|
t18.cloneNode(privateRsField),
|
|
9814
|
-
|
|
10025
|
+
buildExprGeaMember(t18.identifier(arrayMap.storeVar), "GEA_PROXY_RAW")
|
|
9815
10026
|
)
|
|
9816
10027
|
)
|
|
9817
10028
|
)
|
|
@@ -9827,11 +10038,33 @@ function generateRenderItemMethod(arrayMap, imports, eventHandlers, eventIdCount
|
|
|
9827
10038
|
returnStmt
|
|
9828
10039
|
);
|
|
9829
10040
|
if (handlerPropsInMap.length > 0 && classBody2) {
|
|
9830
|
-
const
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
10041
|
+
const handleItemHandlerBody = t18.blockStatement([
|
|
10042
|
+
t18.variableDeclaration("const", [
|
|
10043
|
+
t18.variableDeclarator(
|
|
10044
|
+
t18.identifier("fn"),
|
|
10045
|
+
t18.optionalMemberExpression(
|
|
10046
|
+
t18.memberExpression(t18.thisExpression(), t18.identifier("__itemHandlers_")),
|
|
10047
|
+
t18.identifier("itemId"),
|
|
10048
|
+
true,
|
|
10049
|
+
true
|
|
10050
|
+
)
|
|
10051
|
+
)
|
|
10052
|
+
]),
|
|
10053
|
+
t18.ifStatement(
|
|
10054
|
+
t18.identifier("fn"),
|
|
10055
|
+
t18.expressionStatement(t18.callExpression(t18.identifier("fn"), [t18.identifier("e")]))
|
|
10056
|
+
)
|
|
10057
|
+
]);
|
|
10058
|
+
const handleItemHandler = t18.classMethod(
|
|
10059
|
+
"method",
|
|
10060
|
+
t18.identifier("GEA_HANDLE_ITEM_HANDLER"),
|
|
10061
|
+
[t18.identifier("itemId"), t18.identifier("e")],
|
|
10062
|
+
handleItemHandlerBody,
|
|
10063
|
+
true
|
|
10064
|
+
);
|
|
10065
|
+
if (!classBody2.body.some(
|
|
10066
|
+
(m) => t18.isClassMethod(m) && m.computed === true && t18.isIdentifier(m.key) && m.key.name === "GEA_HANDLE_ITEM_HANDLER"
|
|
10067
|
+
)) {
|
|
9835
10068
|
classBody2.body.unshift(handleItemHandler);
|
|
9836
10069
|
}
|
|
9837
10070
|
}
|
|
@@ -9870,7 +10103,16 @@ function getArrayCapName2(arrayPropName) {
|
|
|
9870
10103
|
return arrayPropName.charAt(0).toUpperCase() + arrayPropName.slice(1);
|
|
9871
10104
|
}
|
|
9872
10105
|
function getComponentArrayItemsName(arrayPropName) {
|
|
9873
|
-
|
|
10106
|
+
const safe = arrayPropName.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
10107
|
+
return `_gea_${safe}_items`;
|
|
10108
|
+
}
|
|
10109
|
+
function buildComponentArrayItemsSymbolDecl(arrayPropName, itemsBinding) {
|
|
10110
|
+
return t19.variableDeclaration("const", [
|
|
10111
|
+
t19.variableDeclarator(
|
|
10112
|
+
t19.identifier(itemsBinding),
|
|
10113
|
+
t19.callExpression(t19.identifier("geaListItemsSymbol"), [t19.stringLiteral(arrayPropName)])
|
|
10114
|
+
)
|
|
10115
|
+
]);
|
|
9874
10116
|
}
|
|
9875
10117
|
function getComponentArrayRefreshMethodName(arrayPropName) {
|
|
9876
10118
|
return `__refresh${getArrayCapName2(arrayPropName)}Items`;
|
|
@@ -9938,6 +10180,7 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
|
|
|
9938
10180
|
finalPropsExpr = cloned;
|
|
9939
10181
|
}
|
|
9940
10182
|
const itemsName = getComponentArrayItemsName(arrayPropName);
|
|
10183
|
+
const symbolConstDecl = buildComponentArrayItemsSymbolDecl(arrayPropName, itemsName);
|
|
9941
10184
|
let arrAccessExpr;
|
|
9942
10185
|
let arrSetupStatements = [];
|
|
9943
10186
|
if (storeArrayAccess) {
|
|
@@ -9980,7 +10223,7 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
|
|
|
9980
10223
|
if (!t19.isVariableDeclaration(stmt)) continue;
|
|
9981
10224
|
for (const decl of stmt.declarations) {
|
|
9982
10225
|
if (t19.isIdentifier(decl.init) && storeVarNames.has(decl.init.name)) {
|
|
9983
|
-
decl.init =
|
|
10226
|
+
decl.init = buildExprGeaMember(t19.identifier(decl.init.name), "GEA_PROXY_RAW");
|
|
9984
10227
|
}
|
|
9985
10228
|
}
|
|
9986
10229
|
}
|
|
@@ -9994,7 +10237,7 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
|
|
|
9994
10237
|
const keyExpr = itemIdProp && itemIdProp !== ITEM_IS_KEY ? t19.callExpression(t19.identifier("String"), [t19.memberExpression(t19.identifier("opt"), t19.identifier(itemIdProp))]) : itemIdProp === ITEM_IS_KEY ? t19.callExpression(t19.identifier("String"), [t19.identifier("opt")]) : t19.binaryExpression("+", t19.stringLiteral("__idx_"), t19.identifier("__k"));
|
|
9995
10238
|
const mapParams = [t19.identifier("opt")];
|
|
9996
10239
|
if (indexVar || !itemIdProp) mapParams.push(t19.identifier("__k"));
|
|
9997
|
-
const childCall = t19.callExpression(
|
|
10240
|
+
const childCall = t19.callExpression(buildThisGeaMember("GEA_CHILD"), [
|
|
9998
10241
|
t19.identifier(comp.componentTag),
|
|
9999
10242
|
t19.cloneNode(itemPropsCall, true),
|
|
10000
10243
|
t19.cloneNode(keyExpr, true)
|
|
@@ -10004,11 +10247,12 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
|
|
|
10004
10247
|
const parenthesized = t19.parenthesizedExpression ? t19.parenthesizedExpression(nullishCoalesce) : nullishCoalesce;
|
|
10005
10248
|
const mapCallExpr = t19.callExpression(t19.memberExpression(parenthesized, t19.identifier("map")), [mapCallback]);
|
|
10006
10249
|
const constructorInit = t19.expressionStatement(
|
|
10007
|
-
t19.assignmentExpression("=", t19.memberExpression(t19.thisExpression(), t19.identifier(itemsName)), mapCallExpr)
|
|
10250
|
+
t19.assignmentExpression("=", t19.memberExpression(t19.thisExpression(), t19.identifier(itemsName), true), mapCallExpr)
|
|
10008
10251
|
);
|
|
10009
10252
|
return {
|
|
10010
10253
|
itemPropsMethod,
|
|
10011
10254
|
constructorInit,
|
|
10255
|
+
symbolConstDecl,
|
|
10012
10256
|
componentTag: comp.componentTag,
|
|
10013
10257
|
containerBindingId: um.containerBindingId,
|
|
10014
10258
|
containerUserIdExpr: um.containerUserIdExpr,
|
|
@@ -10047,7 +10291,7 @@ function rewriteTemplateBodyForImportedState(_templateMethod, _stateRefs, _store
|
|
|
10047
10291
|
function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = []) {
|
|
10048
10292
|
const body = [];
|
|
10049
10293
|
if (hasArrayConfigs) {
|
|
10050
|
-
body.push(
|
|
10294
|
+
body.push(t20.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")));
|
|
10051
10295
|
}
|
|
10052
10296
|
const observeListPathKeys = /* @__PURE__ */ new Set();
|
|
10053
10297
|
for (const config of observeListConfigs) {
|
|
@@ -10076,7 +10320,7 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
|
|
|
10076
10320
|
if (handlers.length === 1 && !handlers[0].isVia) {
|
|
10077
10321
|
body.push(
|
|
10078
10322
|
t20.expressionStatement(
|
|
10079
|
-
t20.callExpression(
|
|
10323
|
+
t20.callExpression(thisGea("GEA_OBSERVE"), [
|
|
10080
10324
|
storeVarExpr,
|
|
10081
10325
|
pathArray,
|
|
10082
10326
|
t20.memberExpression(t20.thisExpression(), t20.identifier(handlers[0].methodName))
|
|
@@ -10107,10 +10351,10 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
|
|
|
10107
10351
|
])
|
|
10108
10352
|
);
|
|
10109
10353
|
if (h.dynamicKeyExpr) {
|
|
10110
|
-
const keyId = t20.identifier(`
|
|
10111
|
-
const changeId = t20.identifier(`
|
|
10112
|
-
const partsId = t20.identifier(`
|
|
10113
|
-
const prevRootId = t20.identifier(`
|
|
10354
|
+
const keyId = t20.identifier(`geaDynKey${hi}`);
|
|
10355
|
+
const changeId = t20.identifier(`geaDynChange${hi}`);
|
|
10356
|
+
const partsId = t20.identifier(`geaDynParts${hi}`);
|
|
10357
|
+
const prevRootId = t20.identifier(`geaDynPrevRoot${hi}`);
|
|
10114
10358
|
const prefixChecks = h.pathParts.map(
|
|
10115
10359
|
(part, idx) => t20.binaryExpression(
|
|
10116
10360
|
"===",
|
|
@@ -10188,7 +10432,7 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
|
|
|
10188
10432
|
}
|
|
10189
10433
|
body.push(
|
|
10190
10434
|
t20.expressionStatement(
|
|
10191
|
-
t20.callExpression(
|
|
10435
|
+
t20.callExpression(thisGea("GEA_OBSERVE"), [
|
|
10192
10436
|
storeVarExpr,
|
|
10193
10437
|
pathArray,
|
|
10194
10438
|
t20.arrowFunctionExpression([vParam, cParam], t20.blockStatement(callStmts))
|
|
@@ -10202,17 +10446,15 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
|
|
|
10202
10446
|
const itemsName = getComponentArrayItemsName(config.arrayPropName);
|
|
10203
10447
|
const itemPropsMethodName = `__itemProps_${config.arrayPropName}`;
|
|
10204
10448
|
const configProps = [
|
|
10205
|
-
t20.objectProperty(t20.identifier("items"), t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName))),
|
|
10206
|
-
t20.objectProperty(t20.identifier("itemsKey"), t20.
|
|
10449
|
+
t20.objectProperty(t20.identifier("items"), t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true)),
|
|
10450
|
+
t20.objectProperty(t20.identifier("itemsKey"), t20.identifier(itemsName)),
|
|
10207
10451
|
t20.objectProperty(
|
|
10208
10452
|
t20.identifier("container"),
|
|
10209
10453
|
t20.arrowFunctionExpression(
|
|
10210
10454
|
[],
|
|
10211
10455
|
config.containerUserIdExpr ? t20.callExpression(t20.memberExpression(t20.identifier("document"), t20.identifier("getElementById")), [
|
|
10212
10456
|
t20.cloneNode(config.containerUserIdExpr, true)
|
|
10213
|
-
]) : config.containerBindingId ? t20.callExpression(
|
|
10214
|
-
t20.stringLiteral(config.containerBindingId)
|
|
10215
|
-
]) : jsExpr4`this.$(":scope")`
|
|
10457
|
+
]) : config.containerBindingId ? t20.callExpression(thisGea("GEA_EL"), [t20.stringLiteral(config.containerBindingId)]) : jsExpr4`this.$(":scope")`
|
|
10216
10458
|
)
|
|
10217
10459
|
),
|
|
10218
10460
|
t20.objectProperty(t20.identifier("Ctor"), t20.identifier(config.componentTag)),
|
|
@@ -10241,6 +10483,11 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
|
|
|
10241
10483
|
)
|
|
10242
10484
|
)
|
|
10243
10485
|
];
|
|
10486
|
+
if (config.afterCondSlotIndex != null) {
|
|
10487
|
+
configProps.push(
|
|
10488
|
+
t20.objectProperty(t20.identifier("afterCondSlotIndex"), t20.numericLiteral(config.afterCondSlotIndex))
|
|
10489
|
+
);
|
|
10490
|
+
}
|
|
10244
10491
|
const samePathHandlers = [];
|
|
10245
10492
|
const pathKey = JSON.stringify(config.pathParts);
|
|
10246
10493
|
for (const handler of store.observeHandlers) {
|
|
@@ -10266,11 +10513,7 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
|
|
|
10266
10513
|
}
|
|
10267
10514
|
body.push(
|
|
10268
10515
|
t20.expressionStatement(
|
|
10269
|
-
t20.callExpression(
|
|
10270
|
-
storeVarExpr,
|
|
10271
|
-
pathArray,
|
|
10272
|
-
t20.objectExpression(configProps)
|
|
10273
|
-
])
|
|
10516
|
+
t20.callExpression(thisGea("GEA_OBSERVE_LIST"), [storeVarExpr, pathArray, t20.objectExpression(configProps)])
|
|
10274
10517
|
)
|
|
10275
10518
|
);
|
|
10276
10519
|
}
|
|
@@ -10311,6 +10554,15 @@ function classMethodUsesParam(method, index) {
|
|
|
10311
10554
|
function serializeAstNode(node) {
|
|
10312
10555
|
return node ? JSON.stringify(node) : "";
|
|
10313
10556
|
}
|
|
10557
|
+
var thisGea = buildThisGeaMember;
|
|
10558
|
+
function insertStmtBeforeClass(classPath, stmt) {
|
|
10559
|
+
const parent = classPath.parentPath;
|
|
10560
|
+
if (parent.isExportDefaultDeclaration()) {
|
|
10561
|
+
parent.insertBefore(stmt);
|
|
10562
|
+
} else {
|
|
10563
|
+
classPath.insertBefore(stmt);
|
|
10564
|
+
}
|
|
10565
|
+
}
|
|
10314
10566
|
function expressionReferencesIdentifier(expr, name) {
|
|
10315
10567
|
let found = false;
|
|
10316
10568
|
const program12 = t20.program([t20.expressionStatement(t20.cloneNode(expr, true))]);
|
|
@@ -10326,16 +10578,16 @@ function expressionReferencesIdentifier(expr, name) {
|
|
|
10326
10578
|
return found;
|
|
10327
10579
|
}
|
|
10328
10580
|
function generateLocalStateObserverSetup(observeHandlers, hasArrayConfigs) {
|
|
10329
|
-
const localStore =
|
|
10581
|
+
const localStore = buildThisGeaMember("GEA_STORE_ROOT");
|
|
10330
10582
|
const body = [];
|
|
10331
10583
|
if (hasArrayConfigs) {
|
|
10332
|
-
body.push(
|
|
10584
|
+
body.push(t20.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")));
|
|
10333
10585
|
}
|
|
10334
10586
|
body.push(js6`if (!${localStore}) { return; }`);
|
|
10335
10587
|
for (const observeHandler of observeHandlers) {
|
|
10336
10588
|
body.push(
|
|
10337
10589
|
t20.expressionStatement(
|
|
10338
|
-
t20.callExpression(
|
|
10590
|
+
t20.callExpression(thisGea("GEA_OBSERVE"), [
|
|
10339
10591
|
t20.thisExpression(),
|
|
10340
10592
|
t20.arrayExpression(observeHandler.pathParts.map((part) => t20.stringLiteral(part))),
|
|
10341
10593
|
t20.memberExpression(t20.thisExpression(), t20.identifier(observeHandler.methodName))
|
|
@@ -10343,7 +10595,13 @@ function generateLocalStateObserverSetup(observeHandlers, hasArrayConfigs) {
|
|
|
10343
10595
|
)
|
|
10344
10596
|
);
|
|
10345
10597
|
}
|
|
10346
|
-
const method =
|
|
10598
|
+
const method = t20.classMethod(
|
|
10599
|
+
"method",
|
|
10600
|
+
t20.identifier("GEA_SETUP_LOCAL_STATE_OBSERVERS"),
|
|
10601
|
+
[],
|
|
10602
|
+
t20.blockStatement([]),
|
|
10603
|
+
true
|
|
10604
|
+
);
|
|
10347
10605
|
method.body.body.push(...body);
|
|
10348
10606
|
return method;
|
|
10349
10607
|
}
|
|
@@ -10376,6 +10634,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
10376
10634
|
traverse12(ast, {
|
|
10377
10635
|
ClassDeclaration(classPath) {
|
|
10378
10636
|
if (!t20.isIdentifier(classPath.node.id) || classPath.node.id.name !== className) return;
|
|
10637
|
+
ensureGeaCompilerSymbolImports(ast);
|
|
10379
10638
|
let originalClassBody;
|
|
10380
10639
|
traverse12(originalAST, {
|
|
10381
10640
|
noScope: true,
|
|
@@ -10471,7 +10730,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
10471
10730
|
t20.memberExpression(t20.thisExpression(), t20.identifier("id")),
|
|
10472
10731
|
t20.stringLiteral("-" + pb.bindingId)
|
|
10473
10732
|
)
|
|
10474
|
-
) : pb.selector === ":scope" ?
|
|
10733
|
+
) : pb.selector === ":scope" ? thisGea("GEA_ELEMENT") : t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("$")), [
|
|
10475
10734
|
t20.stringLiteral(pb.selector)
|
|
10476
10735
|
]);
|
|
10477
10736
|
const valueExpr = pb.expression && pb.setupStatements ? t20.identifier("__boundValue") : t20.identifier("value");
|
|
@@ -10545,31 +10804,163 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
10545
10804
|
t20.cloneNode(valueExpr, true)
|
|
10546
10805
|
)
|
|
10547
10806
|
);
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
t20.
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10807
|
+
let consequent;
|
|
10808
|
+
if (isHtmlProducing) {
|
|
10809
|
+
const __tpl = t20.identifier("__tpl");
|
|
10810
|
+
const __nc = t20.identifier("__nc");
|
|
10811
|
+
const __oc = t20.identifier("__oc");
|
|
10812
|
+
const __structural = t20.identifier("__structural");
|
|
10813
|
+
const __j = t20.identifier("__j");
|
|
10814
|
+
const setupStmts = [
|
|
10815
|
+
t20.variableDeclaration("var", [
|
|
10816
|
+
t20.variableDeclarator(
|
|
10817
|
+
__tpl,
|
|
10818
|
+
t20.callExpression(t20.memberExpression(t20.identifier("document"), t20.identifier("createElement")), [
|
|
10819
|
+
t20.stringLiteral("template")
|
|
10820
|
+
])
|
|
10821
|
+
)
|
|
10822
|
+
]),
|
|
10562
10823
|
t20.expressionStatement(
|
|
10563
|
-
t20.
|
|
10824
|
+
t20.assignmentExpression(
|
|
10825
|
+
"=",
|
|
10826
|
+
t20.memberExpression(__tpl, t20.identifier("innerHTML")),
|
|
10827
|
+
t20.cloneNode(valueExpr, true)
|
|
10828
|
+
)
|
|
10829
|
+
),
|
|
10830
|
+
t20.variableDeclaration("var", [
|
|
10831
|
+
t20.variableDeclarator(
|
|
10832
|
+
__nc,
|
|
10564
10833
|
t20.memberExpression(
|
|
10565
|
-
t20.memberExpression(
|
|
10566
|
-
t20.identifier("
|
|
10834
|
+
t20.memberExpression(__tpl, t20.identifier("content")),
|
|
10835
|
+
t20.identifier("childNodes")
|
|
10836
|
+
)
|
|
10837
|
+
)
|
|
10838
|
+
]),
|
|
10839
|
+
t20.variableDeclaration("var", [
|
|
10840
|
+
t20.variableDeclarator(__oc, t20.memberExpression(t20.identifier("__el"), t20.identifier("childNodes")))
|
|
10841
|
+
])
|
|
10842
|
+
];
|
|
10843
|
+
const structuralDetect = [
|
|
10844
|
+
t20.variableDeclaration("var", [
|
|
10845
|
+
t20.variableDeclarator(
|
|
10846
|
+
__structural,
|
|
10847
|
+
t20.binaryExpression(
|
|
10848
|
+
"!==",
|
|
10849
|
+
t20.memberExpression(__nc, t20.identifier("length")),
|
|
10850
|
+
t20.memberExpression(__oc, t20.identifier("length"))
|
|
10851
|
+
)
|
|
10852
|
+
)
|
|
10853
|
+
]),
|
|
10854
|
+
t20.ifStatement(
|
|
10855
|
+
t20.unaryExpression("!", __structural),
|
|
10856
|
+
t20.blockStatement([
|
|
10857
|
+
t20.forStatement(
|
|
10858
|
+
t20.variableDeclaration("var", [t20.variableDeclarator(__j, t20.numericLiteral(0))]),
|
|
10859
|
+
t20.binaryExpression("<", __j, t20.memberExpression(__nc, t20.identifier("length"))),
|
|
10860
|
+
t20.updateExpression("++", __j),
|
|
10861
|
+
t20.blockStatement([
|
|
10862
|
+
t20.ifStatement(
|
|
10863
|
+
t20.logicalExpression(
|
|
10864
|
+
"||",
|
|
10865
|
+
t20.binaryExpression(
|
|
10866
|
+
"!==",
|
|
10867
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
|
|
10868
|
+
t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("nodeType"))
|
|
10869
|
+
),
|
|
10870
|
+
t20.logicalExpression(
|
|
10871
|
+
"&&",
|
|
10872
|
+
t20.binaryExpression(
|
|
10873
|
+
"===",
|
|
10874
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
|
|
10875
|
+
t20.numericLiteral(1)
|
|
10876
|
+
),
|
|
10877
|
+
t20.binaryExpression(
|
|
10878
|
+
"!==",
|
|
10879
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("tagName")),
|
|
10880
|
+
t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("tagName"))
|
|
10881
|
+
)
|
|
10882
|
+
)
|
|
10883
|
+
),
|
|
10884
|
+
t20.blockStatement([
|
|
10885
|
+
t20.expressionStatement(t20.assignmentExpression("=", __structural, t20.booleanLiteral(true))),
|
|
10886
|
+
t20.breakStatement()
|
|
10887
|
+
])
|
|
10888
|
+
)
|
|
10889
|
+
])
|
|
10890
|
+
)
|
|
10891
|
+
])
|
|
10892
|
+
)
|
|
10893
|
+
];
|
|
10894
|
+
const patchNodeCall = t20.callExpression(
|
|
10895
|
+
t20.memberExpression(
|
|
10896
|
+
t20.memberExpression(t20.thisExpression(), t20.identifier("constructor")),
|
|
10897
|
+
t20.identifier("GEA_PATCH_NODE"),
|
|
10898
|
+
true
|
|
10899
|
+
),
|
|
10900
|
+
[t20.memberExpression(__oc, __j, true), t20.memberExpression(__nc, __j, true), t20.booleanLiteral(true)]
|
|
10901
|
+
);
|
|
10902
|
+
const patchLoop = t20.forStatement(
|
|
10903
|
+
t20.variableDeclaration("var", [t20.variableDeclarator(__j, t20.numericLiteral(0))]),
|
|
10904
|
+
t20.binaryExpression("<", __j, t20.memberExpression(__nc, t20.identifier("length"))),
|
|
10905
|
+
t20.updateExpression("++", __j),
|
|
10906
|
+
t20.blockStatement([
|
|
10907
|
+
t20.ifStatement(
|
|
10908
|
+
t20.binaryExpression(
|
|
10909
|
+
"===",
|
|
10910
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
|
|
10911
|
+
t20.numericLiteral(3)
|
|
10567
10912
|
),
|
|
10568
|
-
[
|
|
10913
|
+
t20.blockStatement([
|
|
10914
|
+
t20.ifStatement(
|
|
10915
|
+
t20.binaryExpression(
|
|
10916
|
+
"!==",
|
|
10917
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("textContent")),
|
|
10918
|
+
t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("textContent"))
|
|
10919
|
+
),
|
|
10920
|
+
t20.expressionStatement(
|
|
10921
|
+
t20.assignmentExpression(
|
|
10922
|
+
"=",
|
|
10923
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("textContent")),
|
|
10924
|
+
t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("textContent"))
|
|
10925
|
+
)
|
|
10926
|
+
)
|
|
10927
|
+
)
|
|
10928
|
+
]),
|
|
10929
|
+
t20.ifStatement(
|
|
10930
|
+
t20.binaryExpression(
|
|
10931
|
+
"===",
|
|
10932
|
+
t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
|
|
10933
|
+
t20.numericLiteral(1)
|
|
10934
|
+
),
|
|
10935
|
+
t20.expressionStatement(patchNodeCall)
|
|
10936
|
+
)
|
|
10937
|
+
)
|
|
10938
|
+
])
|
|
10939
|
+
);
|
|
10940
|
+
const fallbackBlock = t20.blockStatement([
|
|
10941
|
+
assignStmt,
|
|
10942
|
+
t20.expressionStatement(t20.callExpression(buildThisGeaMember("GEA_INSTANTIATE_CHILD_COMPONENTS"), [])),
|
|
10943
|
+
t20.ifStatement(
|
|
10944
|
+
buildThisGeaMember("GEA_PARENT_COMPONENT"),
|
|
10945
|
+
t20.expressionStatement(
|
|
10946
|
+
t20.callExpression(
|
|
10947
|
+
buildExprGeaMember(
|
|
10948
|
+
buildThisGeaMember("GEA_PARENT_COMPONENT"),
|
|
10949
|
+
"GEA_MOUNT_COMPILED_CHILD_COMPONENTS"
|
|
10950
|
+
),
|
|
10951
|
+
[]
|
|
10952
|
+
)
|
|
10569
10953
|
)
|
|
10570
10954
|
)
|
|
10571
|
-
)
|
|
10572
|
-
|
|
10955
|
+
]);
|
|
10956
|
+
consequent = t20.blockStatement([
|
|
10957
|
+
...setupStmts,
|
|
10958
|
+
...structuralDetect,
|
|
10959
|
+
t20.ifStatement(__structural, fallbackBlock, t20.blockStatement([patchLoop]))
|
|
10960
|
+
]);
|
|
10961
|
+
} else {
|
|
10962
|
+
consequent = assignStmt;
|
|
10963
|
+
}
|
|
10573
10964
|
updateStmt = t20.ifStatement(
|
|
10574
10965
|
t20.binaryExpression(
|
|
10575
10966
|
"!==",
|
|
@@ -10764,7 +11155,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
10764
11155
|
t20.binaryExpression("===", valueExpr, t20.nullLiteral()),
|
|
10765
11156
|
t20.binaryExpression("===", valueExpr, t20.identifier("undefined"))
|
|
10766
11157
|
);
|
|
10767
|
-
const newAttrValueExpr = isBooleanAttr ? t20.stringLiteral("") : URL_ATTRS3.has(attrName) ? t20.callExpression(t20.identifier("
|
|
11158
|
+
const newAttrValueExpr = isBooleanAttr ? t20.stringLiteral("") : URL_ATTRS3.has(attrName) ? t20.callExpression(t20.identifier("geaSanitizeAttr"), [
|
|
10768
11159
|
t20.stringLiteral(attrName),
|
|
10769
11160
|
t20.callExpression(t20.identifier("String"), [valueExpr])
|
|
10770
11161
|
]) : t20.callExpression(t20.identifier("String"), [valueExpr]);
|
|
@@ -10970,8 +11361,35 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
10970
11361
|
const parsed = JSON.parse(entry.observeKey);
|
|
10971
11362
|
const storeVarName = parsed.storeVar || void 0;
|
|
10972
11363
|
const methodNameStr = getObserveMethodName(propPath, storeVarName);
|
|
10973
|
-
const
|
|
10974
|
-
|
|
11364
|
+
const prevGuardMem = t20.memberExpression(
|
|
11365
|
+
t20.thisExpression(),
|
|
11366
|
+
t20.callExpression(t20.identifier("geaPrevGuardSymbol"), [t20.stringLiteral(methodNameStr)]),
|
|
11367
|
+
true
|
|
11368
|
+
);
|
|
11369
|
+
const rerenderMethod = t20.classMethod(
|
|
11370
|
+
"method",
|
|
11371
|
+
t20.identifier(methodNameStr),
|
|
11372
|
+
[t20.identifier("__v"), t20.identifier("__c")],
|
|
11373
|
+
t20.blockStatement([
|
|
11374
|
+
// Skip only when we've seen a prior value and truthiness is unchanged.
|
|
11375
|
+
// If prev is undefined and __v is false, !__v and !prev are both true — without this
|
|
11376
|
+
// guard the first delivery after mount would skip rerender (auth early-return repro).
|
|
11377
|
+
t20.ifStatement(
|
|
11378
|
+
t20.logicalExpression(
|
|
11379
|
+
"&&",
|
|
11380
|
+
t20.binaryExpression("!==", prevGuardMem, t20.identifier("undefined")),
|
|
11381
|
+
t20.binaryExpression(
|
|
11382
|
+
"===",
|
|
11383
|
+
t20.unaryExpression("!", t20.identifier("__v")),
|
|
11384
|
+
t20.unaryExpression("!", prevGuardMem)
|
|
11385
|
+
)
|
|
11386
|
+
),
|
|
11387
|
+
t20.returnStatement()
|
|
11388
|
+
),
|
|
11389
|
+
t20.expressionStatement(t20.assignmentExpression("=", prevGuardMem, t20.identifier("__v"))),
|
|
11390
|
+
t20.expressionStatement(buildThisGeaCall("GEA_REQUEST_RENDER"))
|
|
11391
|
+
])
|
|
11392
|
+
);
|
|
10975
11393
|
mergeObserveMethod(entry.observeKey, rerenderMethod);
|
|
10976
11394
|
if (!stateProps.has(entry.observeKey)) {
|
|
10977
11395
|
stateProps.set(entry.observeKey, entry.pathParts);
|
|
@@ -11036,9 +11454,11 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11036
11454
|
usesTargetComponent: true
|
|
11037
11455
|
}));
|
|
11038
11456
|
if (delegatedEvents.length > 0) {
|
|
11039
|
-
appendCompiledEventMethods(classPath.node.body, delegatedEvents);
|
|
11457
|
+
appendCompiledEventMethods(classPath.node.body, delegatedEvents, [], ast);
|
|
11040
11458
|
}
|
|
11041
11459
|
}
|
|
11460
|
+
ensureImport(ast, "@geajs/core", "geaListItemsSymbol");
|
|
11461
|
+
insertStmtBeforeClass(classPath, arrayResult.symbolConstDecl);
|
|
11042
11462
|
inlineIntoConstructor(classPath.node.body, [
|
|
11043
11463
|
...arrayResult.arrSetupStatements.map((s) => t20.cloneNode(s, true)),
|
|
11044
11464
|
arrayResult.constructorInit
|
|
@@ -11051,7 +11471,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11051
11471
|
componentTag: arrayResult.componentTag,
|
|
11052
11472
|
containerBindingId: arrayResult.containerBindingId,
|
|
11053
11473
|
containerUserIdExpr: arrayResult.containerUserIdExpr,
|
|
11054
|
-
itemIdProperty: arrayResult.itemIdProperty
|
|
11474
|
+
itemIdProperty: arrayResult.itemIdProperty,
|
|
11475
|
+
afterCondSlotIndex: um.afterCondSlotIndex
|
|
11055
11476
|
});
|
|
11056
11477
|
} else {
|
|
11057
11478
|
const computedDeps = (um.dependencies || collectUnresolvedDependencies([um], stateRefs, classPath.node.body)).filter((dep) => dep.storeVar || dep.pathParts[0] !== "props");
|
|
@@ -11061,9 +11482,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11061
11482
|
const containerSuffix = arrayResult.containerBindingId;
|
|
11062
11483
|
const containerExpr = arrayResult.containerUserIdExpr ? t20.callExpression(t20.memberExpression(t20.identifier("document"), t20.identifier("getElementById")), [
|
|
11063
11484
|
t20.cloneNode(arrayResult.containerUserIdExpr, true)
|
|
11064
|
-
]) : containerSuffix ? t20.callExpression(
|
|
11065
|
-
t20.stringLiteral(containerSuffix)
|
|
11066
|
-
]) : jsExpr4`this.$(":scope")`;
|
|
11485
|
+
]) : containerSuffix ? t20.callExpression(thisGea("GEA_EL"), [t20.stringLiteral(containerSuffix)]) : jsExpr4`this.$(":scope")`;
|
|
11067
11486
|
const itemIdProp = arrayResult.itemIdProperty;
|
|
11068
11487
|
const keyFn = itemIdProp && itemIdProp !== ITEM_IS_KEY ? t20.arrowFunctionExpression(
|
|
11069
11488
|
[t20.identifier("opt")],
|
|
@@ -11091,8 +11510,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11091
11510
|
t20.variableDeclaration("const", [
|
|
11092
11511
|
t20.variableDeclarator(
|
|
11093
11512
|
t20.identifier("__new"),
|
|
11094
|
-
t20.callExpression(
|
|
11095
|
-
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)),
|
|
11513
|
+
t20.callExpression(thisGea("GEA_RECONCILE_LIST"), [
|
|
11514
|
+
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
|
|
11096
11515
|
t20.identifier("__arr"),
|
|
11097
11516
|
t20.cloneNode(containerExpr, true),
|
|
11098
11517
|
t20.identifier(arrayResult.componentTag),
|
|
@@ -11111,7 +11530,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11111
11530
|
t20.assignmentExpression(
|
|
11112
11531
|
"=",
|
|
11113
11532
|
t20.memberExpression(
|
|
11114
|
-
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)),
|
|
11533
|
+
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
|
|
11115
11534
|
t20.identifier("length")
|
|
11116
11535
|
),
|
|
11117
11536
|
t20.numericLiteral(0)
|
|
@@ -11120,7 +11539,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11120
11539
|
t20.expressionStatement(
|
|
11121
11540
|
t20.callExpression(
|
|
11122
11541
|
t20.memberExpression(
|
|
11123
|
-
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)),
|
|
11542
|
+
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
|
|
11124
11543
|
t20.identifier("push")
|
|
11125
11544
|
),
|
|
11126
11545
|
[t20.spreadElement(t20.identifier("__new"))]
|
|
@@ -11307,11 +11726,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11307
11726
|
t20.identifier(getObserveMethodName(dep.pathParts, dep.storeVar)),
|
|
11308
11727
|
[t20.identifier("value"), t20.identifier("change")],
|
|
11309
11728
|
t20.blockStatement([
|
|
11310
|
-
t20.expressionStatement(
|
|
11311
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
|
|
11312
|
-
t20.numericLiteral(mapIdx)
|
|
11313
|
-
])
|
|
11314
|
-
)
|
|
11729
|
+
t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(mapIdx)]))
|
|
11315
11730
|
])
|
|
11316
11731
|
)
|
|
11317
11732
|
);
|
|
@@ -11370,13 +11785,13 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11370
11785
|
);
|
|
11371
11786
|
if (elRefFieldNames.length > 0) {
|
|
11372
11787
|
const hasReset = classPath.node.body.body.some(
|
|
11373
|
-
(m) => t20.isClassMethod(m) && t20.isIdentifier(m.key) && m.key.name === "
|
|
11788
|
+
(m) => t20.isClassMethod(m) && m.computed === true && t20.isIdentifier(m.key) && m.key.name === "GEA_RESET_ELS"
|
|
11374
11789
|
);
|
|
11375
11790
|
if (!hasReset) {
|
|
11376
11791
|
classPath.node.body.body.push(
|
|
11377
11792
|
t20.classMethod(
|
|
11378
11793
|
"method",
|
|
11379
|
-
t20.identifier("
|
|
11794
|
+
t20.identifier("GEA_RESET_ELS"),
|
|
11380
11795
|
[],
|
|
11381
11796
|
t20.blockStatement(
|
|
11382
11797
|
elRefFieldNames.map(
|
|
@@ -11388,7 +11803,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11388
11803
|
)
|
|
11389
11804
|
)
|
|
11390
11805
|
)
|
|
11391
|
-
)
|
|
11806
|
+
),
|
|
11807
|
+
true
|
|
11392
11808
|
)
|
|
11393
11809
|
);
|
|
11394
11810
|
applied = true;
|
|
@@ -11419,11 +11835,13 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11419
11835
|
if (!dep.storeVar) continue;
|
|
11420
11836
|
addCondSlotIndex(dep.observeKey, slotIndex);
|
|
11421
11837
|
}
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11838
|
+
if (!slot.hasCompiledChildren) {
|
|
11839
|
+
for (const htmlExpr of [slot.truthyHtmlExpr, slot.falsyHtmlExpr]) {
|
|
11840
|
+
if (!htmlExpr) continue;
|
|
11841
|
+
const contentDeps = collectExpressionDependencies(htmlExpr, stateRefs, slot.setupStatements);
|
|
11842
|
+
for (const dep of contentDeps) {
|
|
11843
|
+
addCondSlotIndex(dep.observeKey, slotIndex);
|
|
11844
|
+
}
|
|
11427
11845
|
}
|
|
11428
11846
|
}
|
|
11429
11847
|
});
|
|
@@ -11433,9 +11851,10 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11433
11851
|
stateProps.set(observeKey, parts);
|
|
11434
11852
|
}
|
|
11435
11853
|
}
|
|
11436
|
-
const hasOnPropChange = classPath.node.body.body.some(
|
|
11437
|
-
(
|
|
11438
|
-
|
|
11854
|
+
const hasOnPropChange = classPath.node.body.body.some((member) => {
|
|
11855
|
+
if (!t20.isClassMethod(member) || !t20.isIdentifier(member.key)) return false;
|
|
11856
|
+
return member.computed && member.key.name === "GEA_ON_PROP_CHANGE";
|
|
11857
|
+
});
|
|
11439
11858
|
const childObserveGroups = /* @__PURE__ */ new Map();
|
|
11440
11859
|
compiledChildren.forEach((child) => {
|
|
11441
11860
|
if (childHasNoProps(child)) return;
|
|
@@ -11849,9 +12268,9 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11849
12268
|
}).map((child) => {
|
|
11850
12269
|
const updateExpr = t20.expressionStatement(
|
|
11851
12270
|
t20.callExpression(
|
|
11852
|
-
|
|
12271
|
+
buildExprGeaMember(
|
|
11853
12272
|
t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
|
|
11854
|
-
|
|
12273
|
+
"GEA_UPDATE_PROPS"
|
|
11855
12274
|
),
|
|
11856
12275
|
[
|
|
11857
12276
|
t20.callExpression(
|
|
@@ -11891,7 +12310,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11891
12310
|
unresolvedBindings.forEach(({ info, binding }) => {
|
|
11892
12311
|
const deps = info.dependencies || collectUnresolvedDependencies([info], stateRefs, classPath.node.body);
|
|
11893
12312
|
const mapIdx = getMapIndex(binding.arrayPathParts);
|
|
11894
|
-
const delegateName = `
|
|
12313
|
+
const delegateName = `geaSyncMapDelegate_${mapIdx}`;
|
|
11895
12314
|
const hasNonRelationalDeps = deps.some(
|
|
11896
12315
|
(dep) => !(info.relationalClassBindings || []).find((rb) => rb.observeKey === dep.observeKey)
|
|
11897
12316
|
);
|
|
@@ -11923,11 +12342,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11923
12342
|
classPath.node.body.body.push(
|
|
11924
12343
|
appendToBody5(
|
|
11925
12344
|
jsMethod8`${id11(delegateName)}() {}`,
|
|
11926
|
-
t20.expressionStatement(
|
|
11927
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
|
|
11928
|
-
t20.numericLiteral(mapIdx)
|
|
11929
|
-
])
|
|
11930
|
-
)
|
|
12345
|
+
t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(mapIdx)]))
|
|
11931
12346
|
)
|
|
11932
12347
|
);
|
|
11933
12348
|
delegateEmitted = true;
|
|
@@ -11939,11 +12354,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
11939
12354
|
});
|
|
11940
12355
|
} else {
|
|
11941
12356
|
const syncBody = t20.blockStatement([
|
|
11942
|
-
t20.expressionStatement(
|
|
11943
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
|
|
11944
|
-
t20.numericLiteral(mapIdx)
|
|
11945
|
-
])
|
|
11946
|
-
)
|
|
12357
|
+
t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(mapIdx)]))
|
|
11947
12358
|
]);
|
|
11948
12359
|
mergeObserveMethod(
|
|
11949
12360
|
dep.observeKey,
|
|
@@ -12035,9 +12446,11 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12035
12446
|
usesTargetComponent: true
|
|
12036
12447
|
}));
|
|
12037
12448
|
if (delegatedEvents.length > 0) {
|
|
12038
|
-
appendCompiledEventMethods(classPath.node.body, delegatedEvents);
|
|
12449
|
+
appendCompiledEventMethods(classPath.node.body, delegatedEvents, [], ast);
|
|
12039
12450
|
}
|
|
12040
12451
|
}
|
|
12452
|
+
ensureImport(ast, "@geajs/core", "geaListItemsSymbol");
|
|
12453
|
+
insertStmtBeforeClass(classPath, arrayResult.symbolConstDecl);
|
|
12041
12454
|
inlineIntoConstructor(classPath.node.body, [
|
|
12042
12455
|
...arrayResult.arrSetupStatements.map((s) => t20.cloneNode(s, true)),
|
|
12043
12456
|
arrayResult.constructorInit
|
|
@@ -12050,7 +12463,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12050
12463
|
componentTag: arrayResult.componentTag,
|
|
12051
12464
|
containerBindingId: arrayResult.containerBindingId,
|
|
12052
12465
|
containerUserIdExpr: arrayResult.containerUserIdExpr,
|
|
12053
|
-
itemIdProperty: arrayResult.itemIdProperty
|
|
12466
|
+
itemIdProperty: arrayResult.itemIdProperty,
|
|
12467
|
+
afterCondSlotIndex: arrayMap.afterCondSlotIndex
|
|
12054
12468
|
});
|
|
12055
12469
|
}
|
|
12056
12470
|
componentArrayDisposeTargets.push(getComponentArrayItemsName(arrayPropName));
|
|
@@ -12078,14 +12492,12 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12078
12492
|
const depObserveKey = buildObserveKey(depPath, arrayMap.storeVar);
|
|
12079
12493
|
const depMethodName = getObserveMethodName(depPath, arrayMap.storeVar);
|
|
12080
12494
|
const refreshStmt = t20.expressionStatement(
|
|
12081
|
-
t20.callExpression(
|
|
12082
|
-
t20.stringLiteral(pathKey)
|
|
12083
|
-
])
|
|
12495
|
+
t20.callExpression(thisGea("GEA_REFRESH_LIST"), [t20.stringLiteral(pathKey)])
|
|
12084
12496
|
);
|
|
12085
12497
|
const existing = addedMethods.get(depObserveKey);
|
|
12086
12498
|
if (existing && t20.isBlockStatement(existing.body)) {
|
|
12087
12499
|
const renderedGuardIdx = existing.body.body.findIndex(
|
|
12088
|
-
(s) => t20.isIfStatement(s) && t20.isMemberExpression(s.test) && t20.isIdentifier(s.test.property) && s.test.property.name === "
|
|
12500
|
+
(s) => t20.isIfStatement(s) && t20.isMemberExpression(s.test) && s.test.computed === true && t20.isIdentifier(s.test.property) && s.test.property.name === "GEA_RENDERED"
|
|
12089
12501
|
);
|
|
12090
12502
|
if (renderedGuardIdx >= 0) {
|
|
12091
12503
|
existing.body.body.splice(renderedGuardIdx, 0, refreshStmt);
|
|
@@ -12131,7 +12543,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12131
12543
|
MemberExpression(mePath) {
|
|
12132
12544
|
const resolved = resolvePath(mePath.node, stateRefs);
|
|
12133
12545
|
if (!resolved?.parts?.length || !resolved.isImportedState) return;
|
|
12134
|
-
if (resolved.parts.some((p) => p === "__raw")) return;
|
|
12546
|
+
if (resolved.parts.some((p) => p === "__raw" || p === "GEA_PROXY_RAW")) return;
|
|
12135
12547
|
const depKey = buildObserveKey(resolved.parts, resolved.storeVar);
|
|
12136
12548
|
if (!getterDepKeys.has(depKey) && !externalDeps.has(depKey)) {
|
|
12137
12549
|
externalDeps.set(depKey, { parts: [...resolved.parts], storeVar: resolved.storeVar });
|
|
@@ -12142,11 +12554,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12142
12554
|
const depMethodName = getObserveMethodName(dep.parts, dep.storeVar);
|
|
12143
12555
|
if (!stateProps.has(depKey)) stateProps.set(depKey, dep.parts);
|
|
12144
12556
|
const delegateBody = t20.blockStatement([
|
|
12145
|
-
t20.expressionStatement(
|
|
12146
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__refreshList")), [
|
|
12147
|
-
t20.stringLiteral(pathKey)
|
|
12148
|
-
])
|
|
12149
|
-
)
|
|
12557
|
+
t20.expressionStatement(t20.callExpression(thisGea("GEA_REFRESH_LIST"), [t20.stringLiteral(pathKey)]))
|
|
12150
12558
|
]);
|
|
12151
12559
|
const delegateMethod = t20.classMethod(
|
|
12152
12560
|
"method",
|
|
@@ -12180,7 +12588,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12180
12588
|
const strippedInTemplate = templateMethod && (analysis.conditionalSlots || []).length > 0 ? stripHtmlArrayMapJoinInTemplateMethod(templateMethod, arrayMap) : false;
|
|
12181
12589
|
if (strippedInSlots || strippedInTemplate) {
|
|
12182
12590
|
const currentValueExpr = arrayMap.storeVar ? buildMemberChainFromParts(t20.identifier(arrayMap.storeVar), arrayMap.arrayPathParts) : buildMemberChainFromParts(t20.thisExpression(), arrayMap.arrayPathParts);
|
|
12183
|
-
const initialArrayName = `
|
|
12591
|
+
const initialArrayName = `geaInitial_${arrayHandlerMethodName}`;
|
|
12184
12592
|
initialHtmlArrayRefreshOnMount.push(
|
|
12185
12593
|
t20.variableDeclaration("const", [
|
|
12186
12594
|
t20.variableDeclarator(t20.identifier(initialArrayName), currentValueExpr)
|
|
@@ -12288,17 +12696,17 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12288
12696
|
}
|
|
12289
12697
|
}
|
|
12290
12698
|
if (renderEventHandlers.length > 0) {
|
|
12291
|
-
applied = appendCompiledEventMethods(classPath.node.body, renderEventHandlers) || applied;
|
|
12699
|
+
applied = appendCompiledEventMethods(classPath.node.body, renderEventHandlers, [], ast) || applied;
|
|
12292
12700
|
}
|
|
12293
12701
|
if (unresolvedEventHandlers.length > 0) {
|
|
12294
|
-
applied = appendCompiledEventMethods(classPath.node.body, unresolvedEventHandlers) || applied;
|
|
12702
|
+
applied = appendCompiledEventMethods(classPath.node.body, unresolvedEventHandlers, [], ast) || applied;
|
|
12295
12703
|
}
|
|
12296
12704
|
if (applied) {
|
|
12297
12705
|
const importedStores = /* @__PURE__ */ new Map();
|
|
12298
12706
|
const localObserveHandlers = /* @__PURE__ */ new Map();
|
|
12299
12707
|
const ensureStoreGroup = (storeVar) => {
|
|
12300
12708
|
if (!importedStores.has(storeVar)) {
|
|
12301
|
-
const captureExpression =
|
|
12709
|
+
const captureExpression = buildExprGeaMember(t20.identifier(storeVar), "GEA_STORE_ROOT");
|
|
12302
12710
|
importedStores.set(storeVar, {
|
|
12303
12711
|
captureExpression,
|
|
12304
12712
|
observeHandlers: /* @__PURE__ */ new Map()
|
|
@@ -12435,6 +12843,31 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
|
|
|
12435
12843
|
}
|
|
12436
12844
|
}
|
|
12437
12845
|
} else if (parts.length === 1) {
|
|
12846
|
+
const selfKey = buildObserveKey(parts, sv);
|
|
12847
|
+
if (guardStateKeys.has(selfKey) && t20.isBlockStatement(method.body)) {
|
|
12848
|
+
const storePropExpr = t20.memberExpression(t20.identifier(sv), t20.identifier(parts[0]));
|
|
12849
|
+
const observePrevMem = t20.memberExpression(
|
|
12850
|
+
t20.thisExpression(),
|
|
12851
|
+
t20.callExpression(t20.identifier("geaObservePrevSymbol"), [
|
|
12852
|
+
t20.stringLiteral(getObserveMethodName(parts, sv))
|
|
12853
|
+
]),
|
|
12854
|
+
true
|
|
12855
|
+
);
|
|
12856
|
+
const guardBlock = t20.ifStatement(
|
|
12857
|
+
t20.binaryExpression("==", t20.cloneNode(storePropExpr), t20.nullLiteral()),
|
|
12858
|
+
t20.blockStatement([
|
|
12859
|
+
t20.expressionStatement(t20.assignmentExpression("=", observePrevMem, t20.cloneNode(storePropExpr))),
|
|
12860
|
+
t20.ifStatement(
|
|
12861
|
+
thisGea("GEA_RENDERED"),
|
|
12862
|
+
t20.blockStatement([
|
|
12863
|
+
t20.expressionStatement(t20.callExpression(thisGea("GEA_REQUEST_RENDER"), []))
|
|
12864
|
+
])
|
|
12865
|
+
),
|
|
12866
|
+
t20.returnStatement()
|
|
12867
|
+
])
|
|
12868
|
+
);
|
|
12869
|
+
method.body.body.unshift(guardBlock);
|
|
12870
|
+
}
|
|
12438
12871
|
const storeRef = stateRefs.get(sv);
|
|
12439
12872
|
if (storeRef?.getterDeps) {
|
|
12440
12873
|
for (const [getterName, depPaths] of storeRef.getterDeps) {
|
|
@@ -12718,7 +13151,7 @@ function generateUnresolvedRelationalObserver(arrayMap, unresolvedMap, relBindin
|
|
|
12718
13151
|
)
|
|
12719
13152
|
]);
|
|
12720
13153
|
const commonPreamble = [
|
|
12721
|
-
|
|
13154
|
+
t20.ifStatement(t20.unaryExpression("!", thisGea("GEA_RENDERED")), t20.blockStatement([t20.returnStatement()])),
|
|
12722
13155
|
lazyInit2(containerName, containerLookup),
|
|
12723
13156
|
...jsBlockBody4`if (!${containerRef}) return;`,
|
|
12724
13157
|
...setupStatements,
|
|
@@ -12842,9 +13275,7 @@ function generateMapRegistration(arrayMap, unresolvedMap, templatePropNames, who
|
|
|
12842
13275
|
} else if (arrayMap.itemIdProperty && arrayMap.itemIdProperty !== ITEM_IS_KEY) {
|
|
12843
13276
|
registerArgs.push(t20.stringLiteral(arrayMap.itemIdProperty));
|
|
12844
13277
|
}
|
|
12845
|
-
return t20.expressionStatement(
|
|
12846
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaRegisterMap")), registerArgs)
|
|
12847
|
-
);
|
|
13278
|
+
return t20.expressionStatement(t20.callExpression(thisGea("GEA_REGISTER_MAP"), registerArgs));
|
|
12848
13279
|
}
|
|
12849
13280
|
function collectFreeIdentifiers(nodes) {
|
|
12850
13281
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -12939,7 +13370,10 @@ function replaceMapWithComponentArrayItems(templateMethod, arrayExpr, itemsName,
|
|
|
12939
13370
|
toReplace = path.parentPath.parentPath;
|
|
12940
13371
|
}
|
|
12941
13372
|
const replacement = opts?.slotBranch ? t20.stringLiteral("") : t20.callExpression(
|
|
12942
|
-
t20.memberExpression(
|
|
13373
|
+
t20.memberExpression(
|
|
13374
|
+
t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
|
|
13375
|
+
t20.identifier("join")
|
|
13376
|
+
),
|
|
12943
13377
|
[t20.stringLiteral("")]
|
|
12944
13378
|
);
|
|
12945
13379
|
toReplace.replaceWith(replacement);
|
|
@@ -12968,6 +13402,7 @@ function replaceMapWithComponentArrayItemsInConditionalSlots(slots, arrayExpr, i
|
|
|
12968
13402
|
}
|
|
12969
13403
|
}
|
|
12970
13404
|
}
|
|
13405
|
+
var ctorInlineInsertOffset = /* @__PURE__ */ new WeakMap();
|
|
12971
13406
|
function inlineIntoConstructor(classBody2, statements) {
|
|
12972
13407
|
let ctor = classBody2.body.find(
|
|
12973
13408
|
(member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "constructor"
|
|
@@ -12979,13 +13414,42 @@ function inlineIntoConstructor(classBody2, statements) {
|
|
|
12979
13414
|
...statements
|
|
12980
13415
|
);
|
|
12981
13416
|
classBody2.body.unshift(ctor);
|
|
13417
|
+
ctorInlineInsertOffset.set(ctor, statements.length);
|
|
12982
13418
|
return;
|
|
12983
13419
|
}
|
|
12984
|
-
ctor.body.body
|
|
13420
|
+
const body = ctor.body.body;
|
|
13421
|
+
const superIdx = body.findIndex(
|
|
13422
|
+
(stmt) => t20.isExpressionStatement(stmt) && t20.isCallExpression(stmt.expression) && t20.isSuper(stmt.expression.callee)
|
|
13423
|
+
);
|
|
13424
|
+
const base = superIdx >= 0 ? superIdx + 1 : 0;
|
|
13425
|
+
const prev = ctorInlineInsertOffset.get(ctor) ?? 0;
|
|
13426
|
+
const insertAt = base + prev;
|
|
13427
|
+
body.splice(insertAt, 0, ...statements);
|
|
13428
|
+
ctorInlineInsertOffset.set(ctor, prev + statements.length);
|
|
12985
13429
|
}
|
|
12986
13430
|
function ensureDisposeCalls(classBody2, targets) {
|
|
12987
13431
|
const disposeStatements = targets.map(
|
|
12988
|
-
(target) =>
|
|
13432
|
+
(target) => t20.expressionStatement(
|
|
13433
|
+
t20.optionalCallExpression(
|
|
13434
|
+
t20.optionalMemberExpression(
|
|
13435
|
+
t20.memberExpression(t20.thisExpression(), t20.identifier(target), true),
|
|
13436
|
+
t20.identifier("forEach"),
|
|
13437
|
+
false,
|
|
13438
|
+
true
|
|
13439
|
+
),
|
|
13440
|
+
[
|
|
13441
|
+
t20.arrowFunctionExpression(
|
|
13442
|
+
[t20.identifier("item")],
|
|
13443
|
+
t20.optionalCallExpression(
|
|
13444
|
+
t20.optionalMemberExpression(t20.identifier("item"), t20.identifier("dispose"), false, true),
|
|
13445
|
+
[],
|
|
13446
|
+
true
|
|
13447
|
+
)
|
|
13448
|
+
)
|
|
13449
|
+
],
|
|
13450
|
+
true
|
|
13451
|
+
)
|
|
13452
|
+
)
|
|
12989
13453
|
);
|
|
12990
13454
|
const existingDispose = classBody2.body.find(
|
|
12991
13455
|
(member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "dispose"
|
|
@@ -12999,9 +13463,10 @@ function ensureDisposeCalls(classBody2, targets) {
|
|
|
12999
13463
|
);
|
|
13000
13464
|
}
|
|
13001
13465
|
function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildren, arrayRefreshDeps, conditionalSlots = [], unresolvedMapPropRefreshDeps = []) {
|
|
13002
|
-
const existing = classBody2.body.find(
|
|
13003
|
-
(
|
|
13004
|
-
|
|
13466
|
+
const existing = classBody2.body.find((member) => {
|
|
13467
|
+
if (!t20.isClassMethod(member) || !t20.isIdentifier(member.key)) return false;
|
|
13468
|
+
return member.computed && member.key.name === "GEA_ON_PROP_CHANGE";
|
|
13469
|
+
});
|
|
13005
13470
|
if (existing) return;
|
|
13006
13471
|
const directForwardCalls = [];
|
|
13007
13472
|
const nonDirectChildren = [];
|
|
@@ -13019,9 +13484,9 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
|
|
|
13019
13484
|
guard,
|
|
13020
13485
|
t20.expressionStatement(
|
|
13021
13486
|
t20.callExpression(
|
|
13022
|
-
|
|
13487
|
+
buildExprGeaMember(
|
|
13023
13488
|
t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
|
|
13024
|
-
|
|
13489
|
+
"GEA_UPDATE_PROPS"
|
|
13025
13490
|
),
|
|
13026
13491
|
[t20.objectExpression([t20.objectProperty(t20.identifier("key"), t20.identifier("value"), true)])]
|
|
13027
13492
|
)
|
|
@@ -13035,9 +13500,9 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
|
|
|
13035
13500
|
t20.binaryExpression("===", t20.identifier("key"), t20.stringLiteral(m.parentPropName)),
|
|
13036
13501
|
t20.expressionStatement(
|
|
13037
13502
|
t20.callExpression(
|
|
13038
|
-
|
|
13503
|
+
buildExprGeaMember(
|
|
13039
13504
|
t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
|
|
13040
|
-
|
|
13505
|
+
"GEA_UPDATE_PROPS"
|
|
13041
13506
|
),
|
|
13042
13507
|
[t20.objectExpression([t20.objectProperty(t20.identifier(m.childPropName), t20.identifier("value"))])]
|
|
13043
13508
|
)
|
|
@@ -13069,10 +13534,7 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
|
|
|
13069
13534
|
const childRefreshCalls = childRefreshEntries.map(({ child, depProps }) => {
|
|
13070
13535
|
const call = t20.expressionStatement(
|
|
13071
13536
|
t20.callExpression(
|
|
13072
|
-
t20.memberExpression(
|
|
13073
|
-
t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
|
|
13074
|
-
t20.identifier("__geaUpdateProps")
|
|
13075
|
-
),
|
|
13537
|
+
buildExprGeaMember(t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)), "GEA_UPDATE_PROPS"),
|
|
13076
13538
|
[
|
|
13077
13539
|
t20.callExpression(
|
|
13078
13540
|
t20.memberExpression(t20.thisExpression(), t20.identifier(`__buildProps_${child.instanceVar.replace(/^_/, "")}`)),
|
|
@@ -13107,9 +13569,7 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
|
|
|
13107
13569
|
if (conditionalSlots.length > 0) {
|
|
13108
13570
|
for (let i = 0; i < conditionalSlots.length; i++) {
|
|
13109
13571
|
const slot = conditionalSlots[i];
|
|
13110
|
-
const call = t20.expressionStatement(
|
|
13111
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaPatchCond")), [t20.numericLiteral(i)])
|
|
13112
|
-
);
|
|
13572
|
+
const call = t20.expressionStatement(t20.callExpression(thisGea("GEA_PATCH_COND"), [t20.numericLiteral(i)]));
|
|
13113
13573
|
if (slot.dependentPropNames.length > 0) {
|
|
13114
13574
|
const guard = slot.dependentPropNames.reduce((acc, prop) => {
|
|
13115
13575
|
const test = t20.binaryExpression("===", t20.identifier("key"), t20.stringLiteral(prop));
|
|
@@ -13128,11 +13588,7 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
|
|
|
13128
13588
|
)
|
|
13129
13589
|
);
|
|
13130
13590
|
const unresolvedMapRefreshCalls = unresolvedMapPropRefreshDeps.map((dep) => {
|
|
13131
|
-
const call = t20.expressionStatement(
|
|
13132
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
|
|
13133
|
-
t20.numericLiteral(dep.mapIdx)
|
|
13134
|
-
])
|
|
13135
|
-
);
|
|
13591
|
+
const call = t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(dep.mapIdx)]));
|
|
13136
13592
|
if (dep.propNames.length > 0) {
|
|
13137
13593
|
const guard = dep.propNames.reduce((acc, prop) => {
|
|
13138
13594
|
const test = t20.binaryExpression("===", t20.identifier("key"), t20.stringLiteral(prop));
|
|
@@ -13151,7 +13607,18 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
|
|
|
13151
13607
|
];
|
|
13152
13608
|
if (allKeyGuarded.length === 0) return;
|
|
13153
13609
|
const merged = mergeKeyGuards(allKeyGuarded);
|
|
13154
|
-
classBody2.body.push(
|
|
13610
|
+
classBody2.body.push(
|
|
13611
|
+
appendToBody5(
|
|
13612
|
+
t20.classMethod(
|
|
13613
|
+
"method",
|
|
13614
|
+
t20.identifier("GEA_ON_PROP_CHANGE"),
|
|
13615
|
+
[t20.identifier("key"), t20.identifier("value")],
|
|
13616
|
+
t20.blockStatement([]),
|
|
13617
|
+
true
|
|
13618
|
+
),
|
|
13619
|
+
...merged
|
|
13620
|
+
)
|
|
13621
|
+
);
|
|
13155
13622
|
}
|
|
13156
13623
|
function serializeKeyGuard(test) {
|
|
13157
13624
|
if (t20.isBinaryExpression(test) && test.operator === "===" && t20.isIdentifier(test.left, { name: "key" }) && t20.isStringLiteral(test.right)) {
|
|
@@ -13312,7 +13779,11 @@ function generateConditionalPatchMethods(classBody2, slots, templatePropNames, w
|
|
|
13312
13779
|
t20.expressionStatement(
|
|
13313
13780
|
t20.assignmentExpression(
|
|
13314
13781
|
"=",
|
|
13315
|
-
t20.memberExpression(
|
|
13782
|
+
t20.memberExpression(
|
|
13783
|
+
t20.thisExpression(),
|
|
13784
|
+
t20.callExpression(t20.identifier("geaCondValueSymbol"), [t20.numericLiteral(i)]),
|
|
13785
|
+
true
|
|
13786
|
+
),
|
|
13316
13787
|
t20.unaryExpression("!", t20.unaryExpression("!", rewrittenCondExprsSafe[i]))
|
|
13317
13788
|
)
|
|
13318
13789
|
)
|
|
@@ -13350,7 +13821,7 @@ function generateConditionalPatchMethods(classBody2, slots, templatePropNames, w
|
|
|
13350
13821
|
};
|
|
13351
13822
|
registerCondCalls.push(
|
|
13352
13823
|
t20.expressionStatement(
|
|
13353
|
-
t20.callExpression(
|
|
13824
|
+
t20.callExpression(thisGea("GEA_REGISTER_COND"), [
|
|
13354
13825
|
t20.numericLiteral(i),
|
|
13355
13826
|
t20.stringLiteral(slot.slotId),
|
|
13356
13827
|
t20.arrowFunctionExpression([], t20.blockStatement(getCondBody)),
|
|
@@ -13538,6 +14009,8 @@ function addJoinToUnresolvedMapCalls(templateMethod, _unresolvedMaps) {
|
|
|
13538
14009
|
const alreadyHasJoin = path.parentPath?.isMemberExpression() && t20.isIdentifier(path.parentPath.node.property) && path.parentPath.node.property.name === "join" && path.parentPath.parentPath?.isCallExpression();
|
|
13539
14010
|
if (alreadyHasJoin) {
|
|
13540
14011
|
const joinCall = path.parentPath.parentPath;
|
|
14012
|
+
const joinArg = joinCall.node.arguments[0];
|
|
14013
|
+
if (t20.isStringLiteral(joinArg) && joinArg.value !== "") return;
|
|
13541
14014
|
const replacement = t20.binaryExpression("+", t20.cloneNode(joinCall.node, true), t20.stringLiteral("<!---->"));
|
|
13542
14015
|
joinCall.replaceWith(replacement);
|
|
13543
14016
|
joinCall.skip();
|
|
@@ -13668,76 +14141,85 @@ function replaceMapInConditionalSlots(slots, arrayMap) {
|
|
|
13668
14141
|
}
|
|
13669
14142
|
function generateStoreInlinePatchObserver(pathParts, storeVar, patchStatements) {
|
|
13670
14143
|
const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
|
|
13671
|
-
method.body.body.push(
|
|
13672
|
-
t20.ifStatement(t20.memberExpression(t20.thisExpression(), t20.identifier("rendered_")), t20.blockStatement(patchStatements))
|
|
13673
|
-
);
|
|
14144
|
+
method.body.body.push(t20.ifStatement(thisGea("GEA_RENDERED"), t20.blockStatement(patchStatements)));
|
|
13674
14145
|
return method;
|
|
13675
14146
|
}
|
|
13676
14147
|
function generateRerenderObserver(pathParts, storeVar, truthinessOnly) {
|
|
13677
14148
|
const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
|
|
13678
14149
|
if (storeVar) {
|
|
13679
|
-
const
|
|
14150
|
+
const observePrevMem = t20.memberExpression(
|
|
14151
|
+
t20.thisExpression(),
|
|
14152
|
+
t20.callExpression(t20.identifier("geaObservePrevSymbol"), [
|
|
14153
|
+
t20.stringLiteral(getObserveMethodName(pathParts, storeVar))
|
|
14154
|
+
]),
|
|
14155
|
+
true
|
|
14156
|
+
);
|
|
13680
14157
|
if (truthinessOnly) {
|
|
13681
14158
|
method.body.body.push(
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
14159
|
+
t20.ifStatement(
|
|
14160
|
+
t20.logicalExpression(
|
|
14161
|
+
"&&",
|
|
14162
|
+
t20.binaryExpression("!==", observePrevMem, t20.identifier("undefined")),
|
|
14163
|
+
t20.binaryExpression(
|
|
14164
|
+
"===",
|
|
14165
|
+
t20.unaryExpression("!", t20.identifier("value")),
|
|
14166
|
+
t20.unaryExpression("!", observePrevMem)
|
|
14167
|
+
)
|
|
14168
|
+
),
|
|
14169
|
+
t20.returnStatement()
|
|
14170
|
+
),
|
|
14171
|
+
t20.expressionStatement(t20.assignmentExpression("=", observePrevMem, t20.identifier("value")))
|
|
13686
14172
|
);
|
|
13687
14173
|
} else {
|
|
13688
14174
|
method.body.body.push(
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
this.${id11(prevProp)} = value;
|
|
13692
|
-
`
|
|
14175
|
+
t20.ifStatement(t20.binaryExpression("===", t20.identifier("value"), observePrevMem), t20.returnStatement()),
|
|
14176
|
+
t20.expressionStatement(t20.assignmentExpression("=", observePrevMem, t20.identifier("value")))
|
|
13693
14177
|
);
|
|
13694
14178
|
}
|
|
13695
14179
|
}
|
|
13696
14180
|
method.body.body.push(
|
|
13697
14181
|
t20.ifStatement(
|
|
13698
|
-
|
|
13699
|
-
t20.blockStatement([
|
|
13700
|
-
t20.expressionStatement(
|
|
13701
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaRequestRender")), [])
|
|
13702
|
-
)
|
|
13703
|
-
])
|
|
14182
|
+
thisGea("GEA_RENDERED"),
|
|
14183
|
+
t20.blockStatement([t20.expressionStatement(t20.callExpression(thisGea("GEA_REQUEST_RENDER"), []))])
|
|
13704
14184
|
)
|
|
13705
14185
|
);
|
|
13706
14186
|
return method;
|
|
13707
14187
|
}
|
|
13708
14188
|
function generateConditionalSlotObserveMethod(pathParts, storeVar, slotIndices, emitEarlyReturn = true) {
|
|
13709
14189
|
const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
|
|
13710
|
-
const anyPatchedExpr = slotIndices.map(
|
|
14190
|
+
const anyPatchedExpr = slotIndices.map(
|
|
14191
|
+
(i) => t20.memberExpression(
|
|
14192
|
+
t20.thisExpression(),
|
|
14193
|
+
t20.callExpression(t20.identifier("geaCondPatchedSymbol"), [t20.numericLiteral(i)]),
|
|
14194
|
+
true
|
|
14195
|
+
)
|
|
14196
|
+
).reduce((acc, expr) => t20.logicalExpression("||", acc, expr));
|
|
13711
14197
|
const patchStatements = [];
|
|
13712
14198
|
if (slotIndices.length === 1) {
|
|
13713
14199
|
patchStatements.push(t20.ifStatement(anyPatchedExpr, t20.returnStatement()));
|
|
13714
14200
|
}
|
|
13715
14201
|
slotIndices.forEach((slotIndex) => {
|
|
14202
|
+
const patchedMem = t20.memberExpression(
|
|
14203
|
+
t20.thisExpression(),
|
|
14204
|
+
t20.callExpression(t20.identifier("geaCondPatchedSymbol"), [t20.numericLiteral(slotIndex)]),
|
|
14205
|
+
true
|
|
14206
|
+
);
|
|
13716
14207
|
patchStatements.push(
|
|
13717
14208
|
t20.expressionStatement(
|
|
13718
14209
|
t20.assignmentExpression(
|
|
13719
14210
|
"=",
|
|
13720
|
-
|
|
13721
|
-
t20.callExpression(
|
|
13722
|
-
t20.numericLiteral(slotIndex)
|
|
13723
|
-
])
|
|
14211
|
+
patchedMem,
|
|
14212
|
+
t20.callExpression(thisGea("GEA_PATCH_COND"), [t20.numericLiteral(slotIndex)])
|
|
13724
14213
|
)
|
|
13725
14214
|
)
|
|
13726
14215
|
);
|
|
13727
14216
|
patchStatements.push(
|
|
13728
14217
|
t20.ifStatement(
|
|
13729
|
-
|
|
14218
|
+
patchedMem,
|
|
13730
14219
|
t20.blockStatement([
|
|
13731
14220
|
t20.expressionStatement(
|
|
13732
14221
|
t20.callExpression(t20.identifier("queueMicrotask"), [
|
|
13733
|
-
t20.arrowFunctionExpression(
|
|
13734
|
-
[],
|
|
13735
|
-
t20.assignmentExpression(
|
|
13736
|
-
"=",
|
|
13737
|
-
t20.memberExpression(t20.thisExpression(), t20.identifier(`__geaCondPatched_${slotIndex}`)),
|
|
13738
|
-
t20.booleanLiteral(false)
|
|
13739
|
-
)
|
|
13740
|
-
)
|
|
14222
|
+
t20.arrowFunctionExpression([], t20.assignmentExpression("=", patchedMem, t20.booleanLiteral(false)))
|
|
13741
14223
|
])
|
|
13742
14224
|
)
|
|
13743
14225
|
])
|
|
@@ -13747,28 +14229,22 @@ function generateConditionalSlotObserveMethod(pathParts, storeVar, slotIndices,
|
|
|
13747
14229
|
if (emitEarlyReturn) {
|
|
13748
14230
|
patchStatements.push(t20.ifStatement(anyPatchedExpr, t20.returnStatement()));
|
|
13749
14231
|
}
|
|
13750
|
-
method.body.body.push(
|
|
13751
|
-
t20.ifStatement(t20.memberExpression(t20.thisExpression(), t20.identifier("rendered_")), t20.blockStatement(patchStatements))
|
|
13752
|
-
);
|
|
14232
|
+
method.body.body.push(t20.ifStatement(thisGea("GEA_RENDERED"), t20.blockStatement(patchStatements)));
|
|
13753
14233
|
return method;
|
|
13754
14234
|
}
|
|
13755
14235
|
function generateStateChildSwapObserver(pathParts, storeVar) {
|
|
13756
14236
|
const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
|
|
13757
14237
|
method.body.body.push(
|
|
13758
14238
|
t20.ifStatement(
|
|
13759
|
-
|
|
13760
|
-
t20.blockStatement([
|
|
13761
|
-
t20.expressionStatement(
|
|
13762
|
-
t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSwapStateChildren")), [])
|
|
13763
|
-
)
|
|
13764
|
-
])
|
|
14239
|
+
thisGea("GEA_RENDERED"),
|
|
14240
|
+
t20.blockStatement([t20.expressionStatement(t20.callExpression(thisGea("GEA_SWAP_STATE_CHILDREN"), []))])
|
|
13765
14241
|
)
|
|
13766
14242
|
);
|
|
13767
14243
|
return method;
|
|
13768
14244
|
}
|
|
13769
14245
|
function generateStateChildSwapMethod(classBody2, stateChildSlots) {
|
|
13770
14246
|
const existing = classBody2.body.find(
|
|
13771
|
-
(member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "
|
|
14247
|
+
(member) => t20.isClassMethod(member) && member.computed && t20.isIdentifier(member.key) && member.key.name === "GEA_SWAP_STATE_CHILDREN"
|
|
13772
14248
|
);
|
|
13773
14249
|
if (existing) return;
|
|
13774
14250
|
const templateMethod = classBody2.body.find(
|
|
@@ -13791,9 +14267,9 @@ function generateStateChildSwapMethod(classBody2, stateChildSlots) {
|
|
|
13791
14267
|
if (!hasBuildProps) return null;
|
|
13792
14268
|
return t20.expressionStatement(
|
|
13793
14269
|
t20.callExpression(
|
|
13794
|
-
|
|
14270
|
+
buildExprGeaMember(
|
|
13795
14271
|
t20.memberExpression(t20.thisExpression(), t20.identifier(slot.childInstanceVar)),
|
|
13796
|
-
|
|
14272
|
+
"GEA_UPDATE_PROPS"
|
|
13797
14273
|
),
|
|
13798
14274
|
[t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier(buildPropsName)), [])]
|
|
13799
14275
|
)
|
|
@@ -13802,7 +14278,7 @@ function generateStateChildSwapMethod(classBody2, stateChildSlots) {
|
|
|
13802
14278
|
const swapCalls = stateChildSlots.map((slot) => {
|
|
13803
14279
|
const guardClone = t20.cloneNode(slot.guardExpr, true);
|
|
13804
14280
|
return t20.expressionStatement(
|
|
13805
|
-
t20.callExpression(
|
|
14281
|
+
t20.callExpression(thisGea("GEA_SWAP_CHILD"), [
|
|
13806
14282
|
t20.stringLiteral(slot.markerId),
|
|
13807
14283
|
t20.logicalExpression(
|
|
13808
14284
|
"&&",
|
|
@@ -13815,9 +14291,10 @@ function generateStateChildSwapMethod(classBody2, stateChildSlots) {
|
|
|
13815
14291
|
const filteredSetup = pruneUnusedSetupDestructuring(setupStatements, [...propsUpdateCalls, ...swapCalls]);
|
|
13816
14292
|
const method = t20.classMethod(
|
|
13817
14293
|
"method",
|
|
13818
|
-
t20.identifier("
|
|
14294
|
+
t20.identifier("GEA_SWAP_STATE_CHILDREN"),
|
|
13819
14295
|
[],
|
|
13820
|
-
t20.blockStatement([...filteredSetup, ...propsUpdateCalls, ...swapCalls])
|
|
14296
|
+
t20.blockStatement([...filteredSetup, ...propsUpdateCalls, ...swapCalls]),
|
|
14297
|
+
true
|
|
13821
14298
|
);
|
|
13822
14299
|
classBody2.body.push(method);
|
|
13823
14300
|
}
|
|
@@ -13849,9 +14326,6 @@ function resolveImportPath2(importer, source) {
|
|
|
13849
14326
|
}
|
|
13850
14327
|
var getterDepsCache = /* @__PURE__ */ new Map();
|
|
13851
14328
|
var storeFieldsCache = /* @__PURE__ */ new Map();
|
|
13852
|
-
function isPrivateName(name) {
|
|
13853
|
-
return name.charCodeAt(0) === 95 || name.charCodeAt(name.length - 1) === 95;
|
|
13854
|
-
}
|
|
13855
14329
|
function extractGetterStatePaths(method) {
|
|
13856
14330
|
if (!t21.isBlockStatement(method.body)) return null;
|
|
13857
14331
|
const paths = /* @__PURE__ */ new Map();
|
|
@@ -13864,7 +14338,6 @@ function extractGetterStatePaths(method) {
|
|
|
13864
14338
|
return;
|
|
13865
14339
|
}
|
|
13866
14340
|
const propName = node.property.name;
|
|
13867
|
-
if (isPrivateName(propName)) return;
|
|
13868
14341
|
if (!paths.has(propName)) {
|
|
13869
14342
|
paths.set(propName, [propName]);
|
|
13870
14343
|
}
|
|
@@ -13874,7 +14347,6 @@ function extractGetterStatePaths(method) {
|
|
|
13874
14347
|
for (const prop of path.node.id.properties) {
|
|
13875
14348
|
if (!t21.isObjectProperty(prop) || !t21.isIdentifier(prop.key)) continue;
|
|
13876
14349
|
const propName = prop.key.name;
|
|
13877
|
-
if (isPrivateName(propName)) continue;
|
|
13878
14350
|
if (!paths.has(propName)) {
|
|
13879
14351
|
paths.set(propName, [propName]);
|
|
13880
14352
|
}
|
|
@@ -14154,7 +14626,7 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
|
|
|
14154
14626
|
(p) => t22.isClassDeclaration(p.node)
|
|
14155
14627
|
);
|
|
14156
14628
|
if (earlyClassPath) {
|
|
14157
|
-
transformed = appendCompiledEventMethods(earlyClassPath.node.body, earlyReturnCtx.eventHandlers, []) || transformed;
|
|
14629
|
+
transformed = appendCompiledEventMethods(earlyClassPath.node.body, earlyReturnCtx.eventHandlers, [], ast) || transformed;
|
|
14158
14630
|
}
|
|
14159
14631
|
}
|
|
14160
14632
|
for (const info of conditionalSlotInfos) {
|
|
@@ -14185,6 +14657,7 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
|
|
|
14185
14657
|
cloneCtxForPatches
|
|
14186
14658
|
);
|
|
14187
14659
|
if (cloneMembers) {
|
|
14660
|
+
ensureImport(ast, "@geajs/core", "GEA_CLONE_TEMPLATE");
|
|
14188
14661
|
classPath.node.body.body.push(...cloneMembers);
|
|
14189
14662
|
transformed = true;
|
|
14190
14663
|
}
|
|
@@ -14193,17 +14666,18 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
|
|
|
14193
14666
|
const classPath2 = path.findParent((p) => t22.isClassDeclaration(p.node));
|
|
14194
14667
|
if (classPath2) {
|
|
14195
14668
|
const setupStatements = returnIndex >= 0 ? body.slice(0, returnIndex) : [];
|
|
14196
|
-
transformed = appendCompiledEventMethods(classPath2.node.body, eventHandlers, setupStatements) || transformed;
|
|
14669
|
+
transformed = appendCompiledEventMethods(classPath2.node.body, eventHandlers, setupStatements, ast) || transformed;
|
|
14197
14670
|
}
|
|
14198
14671
|
}
|
|
14199
14672
|
if (refBindings.length > 0) {
|
|
14200
14673
|
const classPath2 = path.findParent((p) => t22.isClassDeclaration(p.node));
|
|
14201
14674
|
if (classPath2) {
|
|
14675
|
+
ensureImport(ast, "@geajs/core", "GEA_ELEMENT");
|
|
14202
14676
|
const refStatements = refBindings.flatMap((ref) => {
|
|
14203
14677
|
const target = ref.targetExpr;
|
|
14204
14678
|
const q = t22.callExpression(
|
|
14205
14679
|
t22.memberExpression(
|
|
14206
|
-
t22.memberExpression(t22.thisExpression(), t22.identifier("
|
|
14680
|
+
t22.memberExpression(t22.thisExpression(), t22.identifier("GEA_ELEMENT"), true),
|
|
14207
14681
|
t22.identifier("querySelector")
|
|
14208
14682
|
),
|
|
14209
14683
|
[t22.stringLiteral(`[data-gea-ref="${ref.refId}"]`)]
|
|
@@ -14213,14 +14687,16 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
|
|
|
14213
14687
|
t22.expressionStatement(t22.assignmentExpression("=", target, q))
|
|
14214
14688
|
];
|
|
14215
14689
|
});
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14690
|
+
ensureImport(ast, "@geajs/core", "GEA_SETUP_REFS");
|
|
14691
|
+
const existingSetup = classPath2.node.body.body.find((m) => {
|
|
14692
|
+
if (!t22.isClassMethod(m) || !t22.isIdentifier(m.key)) return false;
|
|
14693
|
+
return m.computed && m.key.name === "GEA_SETUP_REFS";
|
|
14694
|
+
});
|
|
14219
14695
|
if (existingSetup && t22.isClassMethod(existingSetup)) {
|
|
14220
14696
|
existingSetup.body.body.push(...refStatements);
|
|
14221
14697
|
} else {
|
|
14222
14698
|
classPath2.node.body.body.push(
|
|
14223
|
-
t22.classMethod("method", t22.identifier("
|
|
14699
|
+
t22.classMethod("method", t22.identifier("GEA_SETUP_REFS"), [], t22.blockStatement(refStatements), true)
|
|
14224
14700
|
);
|
|
14225
14701
|
}
|
|
14226
14702
|
transformed = true;
|
|
@@ -14334,14 +14810,15 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
|
|
|
14334
14810
|
if (!t22.isClassMethod(member) || member.kind === "constructor") continue;
|
|
14335
14811
|
const name = t22.isIdentifier(member.key) ? member.key.name : null;
|
|
14336
14812
|
if (!name) continue;
|
|
14337
|
-
const isCompilerGenerated = name === "template" || name === "events" && member.kind === "get" || name.startsWith("__");
|
|
14813
|
+
const isCompilerGenerated = name === "template" || name === "events" && member.kind === "get" || name.startsWith("__") || member.computed && name === "GEA_ON_PROP_CHANGE";
|
|
14338
14814
|
if (isCompilerGenerated) {
|
|
14339
14815
|
cacheThisIdInMethod(member);
|
|
14340
14816
|
}
|
|
14341
14817
|
if (name === "events" && member.kind === "get") {
|
|
14818
|
+
ensureImport(ast, "@geajs/core", "GEA_ELEMENT");
|
|
14342
14819
|
wrapEventsGetterWithCache(member);
|
|
14343
14820
|
}
|
|
14344
|
-
if (name === "
|
|
14821
|
+
if (member.computed && name === "GEA_ON_PROP_CHANGE") {
|
|
14345
14822
|
wrapSubpathCacheGuards(member, subpathPcCounter, path.node.body);
|
|
14346
14823
|
}
|
|
14347
14824
|
}
|
|
@@ -14349,6 +14826,9 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
|
|
|
14349
14826
|
}
|
|
14350
14827
|
});
|
|
14351
14828
|
}
|
|
14829
|
+
if (transformed) {
|
|
14830
|
+
ensureGeaCompilerSymbolImports(ast);
|
|
14831
|
+
}
|
|
14352
14832
|
return transformed;
|
|
14353
14833
|
}
|
|
14354
14834
|
function transformNonComponentJSX(ast, imports) {
|
|
@@ -14476,8 +14956,8 @@ function transformRemainingJSX(ast, imports) {
|
|
|
14476
14956
|
traverse14(ast, {
|
|
14477
14957
|
noScope: true,
|
|
14478
14958
|
JSXElement(path) {
|
|
14479
|
-
const
|
|
14480
|
-
if (
|
|
14959
|
+
const classMethod10 = path.findParent((p) => t22.isClassMethod(p.node));
|
|
14960
|
+
if (classMethod10 && t22.isClassMethod(classMethod10.node) && t22.isIdentifier(classMethod10.node.key) && classMethod10.node.key.name === "template")
|
|
14481
14961
|
return;
|
|
14482
14962
|
try {
|
|
14483
14963
|
path.replaceWith(transformJSXToTemplate(path.node, { imports }));
|
|
@@ -14486,8 +14966,8 @@ function transformRemainingJSX(ast, imports) {
|
|
|
14486
14966
|
}
|
|
14487
14967
|
},
|
|
14488
14968
|
JSXFragment(path) {
|
|
14489
|
-
const
|
|
14490
|
-
if (
|
|
14969
|
+
const classMethod10 = path.findParent((p) => t22.isClassMethod(p.node));
|
|
14970
|
+
if (classMethod10 && t22.isClassMethod(classMethod10.node) && t22.isIdentifier(classMethod10.node.key) && classMethod10.node.key.name === "template")
|
|
14491
14971
|
return;
|
|
14492
14972
|
try {
|
|
14493
14973
|
path.replaceWith(transformJSXFragmentToTemplate(path.node, { imports }));
|
|
@@ -14622,8 +15102,9 @@ var RESOLVED_HMR_RUNTIME_ID = "\0" + HMR_RUNTIME_ID;
|
|
|
14622
15102
|
var STORE_REGISTRY_ID = "virtual:gea-store-registry";
|
|
14623
15103
|
var RESOLVED_STORE_REGISTRY_ID = "\0" + STORE_REGISTRY_ID;
|
|
14624
15104
|
var RECONCILE_SOURCE = `
|
|
15105
|
+
import { GEA_DOM_ITEM } from '@geajs/core';
|
|
14625
15106
|
function getKey(el) {
|
|
14626
|
-
if (el
|
|
15107
|
+
if (el[GEA_DOM_ITEM]) return String(el[GEA_DOM_ITEM].id);
|
|
14627
15108
|
return el.getAttribute('key');
|
|
14628
15109
|
}
|
|
14629
15110
|
export function reconcile(oldC, newC) {
|
|
@@ -14761,41 +15242,42 @@ export function unregisterComponentInstance(className, instance) {
|
|
|
14761
15242
|
}
|
|
14762
15243
|
|
|
14763
15244
|
function reRenderComponent(instance) {
|
|
14764
|
-
if (!instance || !instance
|
|
14765
|
-
var parent = instance.
|
|
15245
|
+
if (!instance || !instance[GEA_ELEMENT]) return;
|
|
15246
|
+
var parent = instance[GEA_ELEMENT].parentElement;
|
|
14766
15247
|
if (!parent) return;
|
|
14767
|
-
var index = Array.prototype.indexOf.call(parent.children, instance
|
|
15248
|
+
var index = Array.prototype.indexOf.call(parent.children, instance[GEA_ELEMENT]);
|
|
14768
15249
|
var props = Object.assign({}, instance.props);
|
|
14769
15250
|
var __stateSnapshot = {};
|
|
14770
15251
|
var __ownKeys = Object.getOwnPropertyNames(instance);
|
|
14771
15252
|
for (var __ki = 0; __ki < __ownKeys.length; __ki++) {
|
|
14772
15253
|
var __k = __ownKeys[__ki];
|
|
14773
|
-
if (__k.charAt(0) === '_' || __k === 'props' || __k === '
|
|
15254
|
+
if (__k.charAt(0) === '_' || __k === 'props' || __k === 'id') continue;
|
|
14774
15255
|
var __desc = Object.getOwnPropertyDescriptor(instance, __k);
|
|
14775
15256
|
if (__desc && (__desc.get || __desc.set)) continue;
|
|
14776
15257
|
try { __stateSnapshot[__k] = instance[__k]; } catch(e) {}
|
|
14777
15258
|
}
|
|
14778
|
-
instance
|
|
14779
|
-
if (instance
|
|
14780
|
-
if (instance
|
|
15259
|
+
instance[GEA_RENDERED] = false;
|
|
15260
|
+
if (typeof instance[GEA_CLEANUP_BINDINGS] === 'function') instance[GEA_CLEANUP_BINDINGS]();
|
|
15261
|
+
if (typeof instance[GEA_TEARDOWN_SELF_LISTENERS] === 'function') instance[GEA_TEARDOWN_SELF_LISTENERS]();
|
|
14781
15262
|
if (instance.__cleanupCompiledDirectEvents) instance.__cleanupCompiledDirectEvents();
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
15263
|
+
var __cc = instance[GEA_CHILD_COMPONENTS];
|
|
15264
|
+
if (__cc && __cc.length) {
|
|
15265
|
+
__cc.forEach(function(child) { if (child && child.dispose) child.dispose(); });
|
|
15266
|
+
instance[GEA_CHILD_COMPONENTS] = [];
|
|
14785
15267
|
}
|
|
14786
|
-
if (instance
|
|
14787
|
-
instance.
|
|
15268
|
+
if (instance[GEA_ELEMENT] && instance[GEA_ELEMENT].parentNode) {
|
|
15269
|
+
instance[GEA_ELEMENT].parentNode.removeChild(instance[GEA_ELEMENT]);
|
|
14788
15270
|
}
|
|
14789
|
-
instance
|
|
15271
|
+
instance[GEA_ELEMENT] = null;
|
|
14790
15272
|
instance.props = props;
|
|
14791
15273
|
var __restoreKeys = Object.getOwnPropertyNames(__stateSnapshot);
|
|
14792
15274
|
for (var __ri = 0; __ri < __restoreKeys.length; __ri++) {
|
|
14793
15275
|
try { instance[__restoreKeys[__ri]] = __stateSnapshot[__restoreKeys[__ri]]; } catch(e) {}
|
|
14794
15276
|
}
|
|
14795
|
-
if (!instance
|
|
15277
|
+
if (!instance[GEA_BINDINGS]) instance[GEA_BINDINGS] = [];
|
|
14796
15278
|
if (!instance.__bindingRemovers) instance.__bindingRemovers = [];
|
|
14797
|
-
if (!instance
|
|
14798
|
-
if (!instance
|
|
15279
|
+
if (!instance[GEA_SELF_LISTENERS]) instance[GEA_SELF_LISTENERS] = [];
|
|
15280
|
+
if (!instance[GEA_CHILD_COMPONENTS]) instance[GEA_CHILD_COMPONENTS] = [];
|
|
14799
15281
|
instance.render(parent, index);
|
|
14800
15282
|
if (typeof instance.createdHooks === 'function') {
|
|
14801
15283
|
instance.createdHooks(instance.props);
|
|
@@ -15084,7 +15566,13 @@ ${entries.join(",\n")}
|
|
|
15084
15566
|
noScope: true,
|
|
15085
15567
|
ClassDeclaration(path) {
|
|
15086
15568
|
if (!path.node.id || path.node.id.name !== cn) return;
|
|
15087
|
-
const prop = t24.classProperty(
|
|
15569
|
+
const prop = t24.classProperty(
|
|
15570
|
+
t24.identifier("GEA_CTOR_TAG_NAME"),
|
|
15571
|
+
t24.stringLiteral(kebab),
|
|
15572
|
+
void 0,
|
|
15573
|
+
void 0,
|
|
15574
|
+
true
|
|
15575
|
+
);
|
|
15088
15576
|
prop.static = true;
|
|
15089
15577
|
path.node.body.body.unshift(prop);
|
|
15090
15578
|
path.stop();
|
|
@@ -15092,6 +15580,7 @@ ${entries.join(",\n")}
|
|
|
15092
15580
|
});
|
|
15093
15581
|
transformed = true;
|
|
15094
15582
|
}
|
|
15583
|
+
ensureImport(ast, "@geajs/core", "GEA_CTOR_TAG_NAME");
|
|
15095
15584
|
} else {
|
|
15096
15585
|
transformed = transformNonComponentJSX(ast, imports);
|
|
15097
15586
|
}
|
|
@@ -15117,8 +15606,8 @@ ${entries.join(",\n")}
|
|
|
15117
15606
|
if (hmrAdded) transformed = true;
|
|
15118
15607
|
}
|
|
15119
15608
|
if (!transformed) return null;
|
|
15120
|
-
ensureImport(ast, "@geajs/core", "
|
|
15121
|
-
ensureImport(ast, "@geajs/core", "
|
|
15609
|
+
ensureImport(ast, "@geajs/core", "geaEscapeHtml");
|
|
15610
|
+
ensureImport(ast, "@geajs/core", "geaSanitizeAttr");
|
|
15122
15611
|
const output = generate4(ast, { sourceMaps: true, sourceFileName: cleanId }, code);
|
|
15123
15612
|
return { code: output.code, map: output.map };
|
|
15124
15613
|
} catch (error) {
|