@geajs/vite-plugin 1.0.28 → 1.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +945 -380
  2. 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 classMethod9 = path.findParent((p) => t.isClassMethod(p.node));
184
- if (!classMethod9) return;
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("element_"));
1181
- const tmpId = t2.identifier("__geaEvtsResult");
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 === "__geaUpdateProps" || node.property.name.startsWith("__refresh")) return true;
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(__geaProps) {
1818
+ js`${id2(componentClassName)}.prototype.created = function(geaProps) {
1755
1819
  registerComponentInstance(this.constructor.name, this);
1756
- return __origCreated.call(this, __geaProps);
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
- "keydown",
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
- const rest = attrName.slice(2);
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|reset)$/.test(
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);
@@ -3693,6 +3773,16 @@ function analyzeChildren(node, tagName, elementPath, bindings, propBindings, arr
3693
3773
  );
3694
3774
  const slotCountAfter = conditionalSlots?.length ?? 0;
3695
3775
  const slotId = slotCountAfter > slotCountBefore ? conditionalSlots[slotCountAfter - 1].slotId : void 0;
3776
+ if (slotCountAfter > slotCountBefore && conditionalSlots && conditionalSlotNodeMap && templateSetupContext) {
3777
+ registerNestedConditionalsInBranches(
3778
+ expr,
3779
+ stateRefs,
3780
+ templateSetupContext,
3781
+ conditionalSlots,
3782
+ conditionalSlotNodeMap,
3783
+ classBody2
3784
+ );
3785
+ }
3696
3786
  nestedMapCalls.forEach(({ mapExpr, parentElement, containerPath }) => {
3697
3787
  let mapNode = node;
3698
3788
  let mapElementPath = elementPath;
@@ -3799,7 +3889,7 @@ function collectImportedStoreGetterDependencies(expr, setupStatements, stateRefs
3799
3889
  }
3800
3890
  return Array.from(deps.values());
3801
3891
  }
3802
- function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stateProps, stateRefs, onUnresolvedMap, classBody2, templateSetupContext) {
3892
+ function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stateProps, stateRefs, onUnresolvedMap, classBody2, templateSetupContext, afterCondSlotIndex) {
3803
3893
  const arrayExpr = expr.callee.object;
3804
3894
  const normalizedArrayExpr = resolveHelperCallExpression(arrayExpr, classBody2) || arrayExpr;
3805
3895
  if (t9.isArrowFunctionExpression(expr.arguments?.[0])) {
@@ -3857,7 +3947,8 @@ function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stat
3857
3947
  dependencies,
3858
3948
  containerElementPath: [...elementPath],
3859
3949
  ...cbBodyStmts2.length > 0 ? { callbackBodyStatements: cbBodyStmts2 } : {},
3860
- ...relationalClassBindings.length > 0 ? { relationalClassBindings } : {}
3950
+ ...relationalClassBindings.length > 0 ? { relationalClassBindings } : {},
3951
+ ...afterCondSlotIndex != null ? { afterCondSlotIndex } : {}
3861
3952
  });
3862
3953
  }
3863
3954
  return;
@@ -3967,9 +4058,41 @@ function handleArrayMap(expr, tagName, node, elementPath, index, arrayMaps, stat
3967
4058
  ...!itemIdProperty && isKeyed ? { keyExpression: t9.cloneNode(extractKeyExpression(itemTemplate), true) } : {},
3968
4059
  classToggleName,
3969
4060
  conditionalBindings,
3970
- ...cbBodyStmts.length > 0 ? { callbackBodyStatements: cbBodyStmts } : {}
4061
+ ...cbBodyStmts.length > 0 ? { callbackBodyStatements: cbBodyStmts } : {},
4062
+ ...afterCondSlotIndex != null ? { afterCondSlotIndex } : {}
3971
4063
  });
3972
4064
  }
4065
+ function expressionContainsComponentJSX(node) {
4066
+ if (t9.isJSXElement(node)) {
4067
+ const name = node.openingElement.name;
4068
+ if (t9.isJSXIdentifier(name) && /^[A-Z]/.test(name.name)) return true;
4069
+ if (t9.isJSXMemberExpression(name)) {
4070
+ let cur = name;
4071
+ while (t9.isJSXMemberExpression(cur)) cur = cur.object;
4072
+ if (t9.isJSXIdentifier(cur) && /^[A-Z]/.test(cur.name)) return true;
4073
+ }
4074
+ for (const c of node.children) {
4075
+ if (expressionContainsComponentJSX(c)) return true;
4076
+ }
4077
+ return false;
4078
+ }
4079
+ if (t9.isJSXExpressionContainer(node) && !t9.isJSXEmptyExpression(node.expression)) {
4080
+ return expressionContainsComponentJSX(node.expression);
4081
+ }
4082
+ if (t9.isLogicalExpression(node)) {
4083
+ return expressionContainsComponentJSX(node.left) || expressionContainsComponentJSX(node.right);
4084
+ }
4085
+ if (t9.isConditionalExpression(node)) {
4086
+ return expressionContainsComponentJSX(node.consequent) || expressionContainsComponentJSX(node.alternate);
4087
+ }
4088
+ if (t9.isParenthesizedExpression(node)) {
4089
+ return expressionContainsComponentJSX(node.expression);
4090
+ }
4091
+ if (t9.isJSXFragment(node)) {
4092
+ return node.children.some((c) => expressionContainsComponentJSX(c));
4093
+ }
4094
+ return false;
4095
+ }
3973
4096
  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
4097
  const propName = resolvePropRef(expr, propsParamName, destructuredPropNames);
3975
4098
  if (propName) {
@@ -4090,6 +4213,7 @@ function handleTextBinding(expr, node, tagName, elementPath, bindings, propBindi
4090
4213
  conditionExpr: t9.cloneNode(conditionExpr, true),
4091
4214
  setupStatements: condSetupStatements.map((s) => t9.cloneNode(s, true)),
4092
4215
  htmlSetupStatements: fullSetupStatements.map((s) => t9.cloneNode(s, true)),
4216
+ ...expressionContainsComponentJSX(expr) ? { hasCompiledChildren: true } : {},
4093
4217
  dependentPropNames: [...dependentProps],
4094
4218
  dependencies: dependencies.map((dep) => ({
4095
4219
  observeKey: dep.observeKey,
@@ -4100,6 +4224,7 @@ function handleTextBinding(expr, node, tagName, elementPath, bindings, propBindi
4100
4224
  });
4101
4225
  conditionalSlotNodeMap?.set(expr, slotId);
4102
4226
  }
4227
+ return;
4103
4228
  }
4104
4229
  }
4105
4230
  }
@@ -4205,6 +4330,59 @@ function extractConditionalControlExpression(expr) {
4205
4330
  }
4206
4331
  return null;
4207
4332
  }
4333
+ function registerNestedConditionalsInBranches(expr, stateRefs, templateSetupContext, conditionalSlots, conditionalSlotNodeMap, classBody2) {
4334
+ function visitChildren(children) {
4335
+ for (const child of children) {
4336
+ if (t9.isJSXElement(child)) visitChildren(child.children);
4337
+ else if (t9.isJSXFragment(child)) visitChildren(child.children);
4338
+ else if (t9.isJSXExpressionContainer(child) && !t9.isJSXEmptyExpression(child.expression)) {
4339
+ const innerExpr = child.expression;
4340
+ if (!expressionMayProduceJSX(innerExpr)) continue;
4341
+ const conditionExpr = extractConditionalControlExpression(innerExpr);
4342
+ if (!conditionExpr) continue;
4343
+ const condSetupStatements = collectTemplateSetupStatements(conditionExpr, templateSetupContext);
4344
+ const fullSetupStatements = collectTemplateSetupStatements(innerExpr, templateSetupContext);
4345
+ const allDeps = collectExpressionDependencies(conditionExpr, stateRefs, condSetupStatements);
4346
+ if (allDeps.length === 0) continue;
4347
+ const slotId = `c${conditionalSlots.length}`;
4348
+ conditionalSlots.push({
4349
+ slotId,
4350
+ conditionExpr: t9.cloneNode(conditionExpr, true),
4351
+ setupStatements: condSetupStatements.map((s) => t9.cloneNode(s, true)),
4352
+ htmlSetupStatements: fullSetupStatements.map((s) => t9.cloneNode(s, true)),
4353
+ ...expressionContainsComponentJSX(innerExpr) ? { hasCompiledChildren: true } : {},
4354
+ dependentPropNames: [],
4355
+ dependencies: allDeps.map((dep) => ({
4356
+ observeKey: dep.observeKey,
4357
+ pathParts: [...dep.pathParts],
4358
+ ...dep.storeVar ? { storeVar: dep.storeVar } : {}
4359
+ })),
4360
+ originalExpr: t9.cloneNode(innerExpr, true)
4361
+ });
4362
+ conditionalSlotNodeMap.set(innerExpr, slotId);
4363
+ registerNestedConditionalsInBranches(
4364
+ innerExpr,
4365
+ stateRefs,
4366
+ templateSetupContext,
4367
+ conditionalSlots,
4368
+ conditionalSlotNodeMap,
4369
+ classBody2
4370
+ );
4371
+ }
4372
+ }
4373
+ }
4374
+ function visitBranch(node) {
4375
+ if (t9.isJSXElement(node)) visitChildren(node.children);
4376
+ else if (t9.isJSXFragment(node)) visitChildren(node.children);
4377
+ else if (t9.isParenthesizedExpression(node)) visitBranch(node.expression);
4378
+ }
4379
+ if (t9.isConditionalExpression(expr)) {
4380
+ visitBranch(expr.consequent);
4381
+ visitBranch(expr.alternate);
4382
+ } else if (t9.isLogicalExpression(expr) && expr.operator === "&&") {
4383
+ visitBranch(expr.right);
4384
+ }
4385
+ }
4208
4386
  function buildDerivedPropBindings(expr, type, attributeName, elementPath, propsParamName, destructuredPropNames, templateSetupContext, classBody2) {
4209
4387
  if (t9.isJSXEmptyExpression(expr) || !templateSetupContext) return [];
4210
4388
  const setupStatements = collectTemplateSetupStatements(expr, templateSetupContext);
@@ -4652,6 +4830,35 @@ function toHtmlAttrName(attrName, isComponent) {
4652
4830
  if (attrName === "className") return "class";
4653
4831
  return attrName;
4654
4832
  }
4833
+ function unwrapExpression(expr) {
4834
+ let e = expr;
4835
+ while (t10.isParenthesizedExpression(e)) {
4836
+ e = e.expression;
4837
+ }
4838
+ return e;
4839
+ }
4840
+ function extractHtmlTemplatesFromRawConditional(rawExpr, ctx, slotId) {
4841
+ const childCtx = { ...ctx, elementPathPrefix: "__cs_" + slotId };
4842
+ const top = unwrapExpression(rawExpr);
4843
+ if (t10.isLogicalExpression(top) && top.operator === "&&") {
4844
+ return extractHtmlTemplatesFromRawConditional(top.right, ctx, slotId);
4845
+ }
4846
+ if (t10.isConditionalExpression(top)) {
4847
+ const truthyHtmlExpr = transformJSXExpression(top.consequent, childCtx);
4848
+ const alt = unwrapExpression(top.alternate);
4849
+ if (t10.isConditionalExpression(alt)) {
4850
+ return {
4851
+ truthyHtmlExpr,
4852
+ falsyHtmlExpr: transformJSXExpression(top.alternate, childCtx)
4853
+ };
4854
+ }
4855
+ return {
4856
+ truthyHtmlExpr,
4857
+ falsyHtmlExpr: transformJSXExpression(top.alternate, childCtx)
4858
+ };
4859
+ }
4860
+ return null;
4861
+ }
4655
4862
  function extractHtmlTemplatesFromConditional(expr) {
4656
4863
  const normalizeHtmlExpression = (value) => {
4657
4864
  if (t10.isCallExpression(value) && t10.isMemberExpression(value.callee) && t10.isIdentifier(value.callee.property) && value.callee.property.name === "map") {
@@ -4667,7 +4874,11 @@ function extractHtmlTemplatesFromConditional(expr) {
4667
4874
  }
4668
4875
  if (t10.isConditionalExpression(expr)) {
4669
4876
  const truthy = extractHtmlTemplatesFromConditional(expr.consequent).truthyHtmlExpr;
4670
- const falsy = extractHtmlTemplatesFromConditional(expr.alternate).truthyHtmlExpr;
4877
+ const alt = unwrapExpression(expr.alternate);
4878
+ if (t10.isConditionalExpression(alt)) {
4879
+ return { truthyHtmlExpr: truthy, falsyHtmlExpr: normalizeHtmlExpression(alt) };
4880
+ }
4881
+ const falsy = extractHtmlTemplatesFromConditional(alt).truthyHtmlExpr;
4671
4882
  return { truthyHtmlExpr: truthy, falsyHtmlExpr: falsy };
4672
4883
  }
4673
4884
  if (t10.isParenthesizedExpression(expr)) {
@@ -4792,7 +5003,7 @@ function escapeHtml(str) {
4792
5003
  var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "cite", "poster", "background"]);
4793
5004
  function wrapWithSanitizeAttr(attrName, expr) {
4794
5005
  if (!URL_ATTRS.has(attrName)) return expr;
4795
- return t10.callExpression(t10.identifier("__sanitizeAttr"), [
5006
+ return t10.callExpression(t10.identifier("geaSanitizeAttr"), [
4796
5007
  t10.stringLiteral(attrName),
4797
5008
  t10.callExpression(t10.identifier("String"), [expr])
4798
5009
  ]);
@@ -4846,24 +5057,48 @@ var EVENT_TYPES = /* @__PURE__ */ new Set([
4846
5057
  "dblclick",
4847
5058
  "change",
4848
5059
  "input",
5060
+ "submit",
5061
+ "reset",
5062
+ "focus",
5063
+ "blur",
4849
5064
  "keydown",
4850
5065
  "keyup",
4851
- "blur",
4852
- "focus",
5066
+ "keypress",
4853
5067
  "mousedown",
4854
5068
  "mouseup",
4855
- "submit",
5069
+ "mouseover",
5070
+ "mouseout",
5071
+ "mouseenter",
5072
+ "mouseleave",
5073
+ "mousemove",
5074
+ "contextmenu",
5075
+ "touchstart",
5076
+ "touchend",
5077
+ "touchmove",
5078
+ "pointerdown",
5079
+ "pointerup",
5080
+ "pointermove",
5081
+ "scroll",
5082
+ "resize",
5083
+ "drag",
5084
+ "dragstart",
5085
+ "dragend",
5086
+ "dragover",
5087
+ "dragleave",
5088
+ "drop",
5089
+ "animationstart",
5090
+ "animationend",
5091
+ "animationiteration",
5092
+ "transitionstart",
5093
+ "transitionend",
5094
+ "transitionrun",
5095
+ "transitioncancel",
4856
5096
  "tap",
4857
5097
  "longTap",
4858
5098
  "swipeRight",
4859
5099
  "swipeUp",
4860
5100
  "swipeLeft",
4861
- "swipeDown",
4862
- "dragstart",
4863
- "dragend",
4864
- "dragover",
4865
- "dragleave",
4866
- "drop"
5101
+ "swipeDown"
4867
5102
  ]);
4868
5103
  function transformJSXToTemplate(el, ctx, elementPath = []) {
4869
5104
  const parts = jsxToTemplateParts(el, ctx, elementPath);
@@ -5551,8 +5786,16 @@ function processChildren(children, parts, ctx, elementPath, dcCursor, directChil
5551
5786
  });
5552
5787
  appendString(parts, `-->`);
5553
5788
  pushString(parts, "");
5554
- let condExpr = transformJSXExpression(rawExpr, { ...ctx, elementPathPrefix: "__cs_" + slot.slotId });
5555
- const extracted = extractHtmlTemplatesFromConditional(condExpr);
5789
+ const slotCtx = { ...ctx, elementPathPrefix: "__cs_" + slot.slotId };
5790
+ const eventIdBefore = ctx.eventIdCounter?.value ?? 0;
5791
+ let condExpr = transformJSXExpression(rawExpr, slotCtx);
5792
+ const extractCtx = {
5793
+ ...ctx,
5794
+ isRoot: false,
5795
+ eventHandlers: ctx.eventHandlers ? [] : void 0,
5796
+ eventIdCounter: ctx.eventIdCounter ? { value: eventIdBefore } : void 0
5797
+ };
5798
+ const extracted = extractHtmlTemplatesFromRawConditional(rawExpr, extractCtx, slot.slotId) ?? extractHtmlTemplatesFromConditional(condExpr);
5556
5799
  slot.truthyHtmlExpr = extracted.truthyHtmlExpr;
5557
5800
  slot.falsyHtmlExpr = extracted.falsyHtmlExpr;
5558
5801
  if (expressionMayBeFalsy(rawExpr)) {
@@ -5608,9 +5851,7 @@ function processChildren(children, parts, ctx, elementPath, dcCursor, directChil
5608
5851
  expr = t10.logicalExpression("||", expr, t10.stringLiteral(""));
5609
5852
  }
5610
5853
  const skipEscape = childCallInfo || isChildrenPropAccess(rawExpr) || expressionContainsJSX(rawExpr) || ctx.inMapCallback || callsJSXReturningProperty(rawExpr, ctx.classBody);
5611
- const safeExpr = skipEscape ? expr : t10.callExpression(t10.identifier("__escapeHtml"), [
5612
- t10.callExpression(t10.identifier("String"), [expr])
5613
- ]);
5854
+ const safeExpr = skipEscape ? expr : t10.callExpression(t10.identifier("geaEscapeHtml"), [t10.callExpression(t10.identifier("String"), [expr])]);
5614
5855
  parts.push({ type: "expression", value: safeExpr });
5615
5856
  }
5616
5857
  }
@@ -6041,9 +6282,7 @@ function generatePatchItemMethod(arrayMap, templatePropNames, wholeParamName, te
6041
6282
  const keyRenames = arrayMap.indexVariable ? /* @__PURE__ */ new Map([[arrayMap.indexVariable, "__idx"]]) : void 0;
6042
6283
  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
6284
  const itemIdExpr = t11.callExpression(t11.identifier("String"), [rawItemIdExpr]);
6044
- body.push(
6045
- t11.expressionStatement(t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaKey")), itemIdExpr))
6046
- );
6285
+ body.push(t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_KEY"), itemIdExpr)));
6047
6286
  const rowElsProp = `__rowEls_${arrayMap.containerBindingId ?? "list"}`;
6048
6287
  const privateElsRef = t11.memberExpression(t11.thisExpression(), t11.privateName(t11.identifier(rowElsProp)));
6049
6288
  body.push(
@@ -6065,9 +6304,7 @@ function generatePatchItemMethod(arrayMap, templatePropNames, wholeParamName, te
6065
6304
  );
6066
6305
  const patchPrivateFields = [rowElsProp];
6067
6306
  body.push(
6068
- t11.expressionStatement(
6069
- t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaItem")), t11.identifier("item"))
6070
- )
6307
+ t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_ITEM"), t11.identifier("item")))
6071
6308
  );
6072
6309
  const params = [t11.identifier("row"), t11.identifier("item"), t11.identifier("__prevItem")];
6073
6310
  if (arrayMap.indexVariable) params.push(t11.identifier("__idx"));
@@ -6111,6 +6348,9 @@ function collectPatchEntries(arrayMap) {
6111
6348
  if (t11.isJSXElement(modified)) {
6112
6349
  const rootTagName = getJSXTagName(modified.openingElement.name);
6113
6350
  const rootIsComponent = isComponentTag(rootTagName);
6351
+ if (!rootIsComponent && !requiresRerender) {
6352
+ requiresRerender = templateHasChildComponent(modified);
6353
+ }
6114
6354
  walkJSXForPatch(modified, [], entries, rootIsComponent);
6115
6355
  }
6116
6356
  for (const ent of entries) {
@@ -6195,7 +6435,9 @@ function walkJSXForPatch(node, path, entries, rootIsComponent = false) {
6195
6435
  let elementIndex = 0;
6196
6436
  for (const child of node.children) {
6197
6437
  if (t11.isJSXElement(child)) {
6198
- walkJSXForPatch(child, [...path, elementIndex], entries);
6438
+ if (!isComponentTag(getJSXTagName(child.openingElement.name))) {
6439
+ walkJSXForPatch(child, [...path, elementIndex], entries);
6440
+ }
6199
6441
  elementIndex++;
6200
6442
  }
6201
6443
  }
@@ -6390,7 +6632,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6390
6632
  t11.expressionStatement(
6391
6633
  t11.assignmentExpression(
6392
6634
  "=",
6393
- t11.memberExpression(t11.identifier("el"), t11.identifier("__geaProps")),
6635
+ buildExprGeaMember(t11.identifier("el"), "GEA_DOM_PROPS"),
6394
6636
  t11.objectExpression(propsProperties)
6395
6637
  )
6396
6638
  )
@@ -6431,7 +6673,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6431
6673
  t11.assignmentExpression(
6432
6674
  "=",
6433
6675
  t11.cloneNode(privateRsField),
6434
- t11.memberExpression(t11.identifier(arrayMap.storeVar), t11.identifier("__raw"))
6676
+ buildExprGeaMember(t11.identifier(arrayMap.storeVar), "GEA_PROXY_RAW")
6435
6677
  )
6436
6678
  )
6437
6679
  )
@@ -6479,7 +6721,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6479
6721
  t11.expressionStatement(
6480
6722
  t11.assignmentExpression(
6481
6723
  "=",
6482
- t11.memberExpression(cVar, t11.identifier("__geaTpl")),
6724
+ buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
6483
6725
  t11.memberExpression(
6484
6726
  t11.memberExpression(t11.identifier("__tw"), t11.identifier("content")),
6485
6727
  t11.identifier("firstElementChild")
@@ -6489,7 +6731,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6489
6731
  t11.expressionStatement(
6490
6732
  t11.optionalCallExpression(
6491
6733
  t11.optionalMemberExpression(
6492
- t11.memberExpression(cVar, t11.identifier("__geaTpl")),
6734
+ buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
6493
6735
  t11.identifier("removeAttribute"),
6494
6736
  false,
6495
6737
  true
@@ -6504,13 +6746,13 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6504
6746
  t11.ifStatement(
6505
6747
  t11.logicalExpression(
6506
6748
  "&&",
6507
- t11.memberExpression(cVar, t11.identifier("__geaTpl")),
6508
- t11.memberExpression(t11.memberExpression(cVar, t11.identifier("__geaTpl")), t11.identifier("className"))
6749
+ buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
6750
+ t11.memberExpression(buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"), t11.identifier("className"))
6509
6751
  ),
6510
6752
  t11.expressionStatement(
6511
6753
  t11.assignmentExpression(
6512
6754
  "=",
6513
- t11.memberExpression(t11.memberExpression(cVar, t11.identifier("__geaTpl")), t11.identifier("className")),
6755
+ t11.memberExpression(buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"), t11.identifier("className")),
6514
6756
  t11.stringLiteral("")
6515
6757
  )
6516
6758
  )
@@ -6519,19 +6761,19 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6519
6761
  }
6520
6762
  body.push(
6521
6763
  t11.ifStatement(
6522
- t11.unaryExpression("!", t11.memberExpression(cVar, t11.identifier("__geaTpl"))),
6764
+ t11.unaryExpression("!", buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL")),
6523
6765
  t11.blockStatement([t11.tryStatement(t11.blockStatement(tplInit), loggingCatchClause())])
6524
6766
  )
6525
6767
  );
6526
6768
  body.push(
6527
6769
  t11.ifStatement(
6528
- t11.memberExpression(cVar, t11.identifier("__geaTpl")),
6770
+ buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"),
6529
6771
  t11.blockStatement([
6530
6772
  t11.variableDeclaration("var", [
6531
6773
  t11.variableDeclarator(
6532
6774
  elVar,
6533
6775
  t11.callExpression(
6534
- t11.memberExpression(t11.memberExpression(cVar, t11.identifier("__geaTpl")), t11.identifier("cloneNode")),
6776
+ t11.memberExpression(buildExprGeaMember(cVar, "GEA_MAP_CONFIG_TPL"), t11.identifier("cloneNode")),
6535
6777
  [t11.booleanLiteral(true)]
6536
6778
  )
6537
6779
  )
@@ -6732,14 +6974,10 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6732
6974
  ) : itemIdProperty && itemIdProperty !== ITEM_IS_KEY ? t11.logicalExpression("??", buildOptionalMemberChain(t11.identifier("item"), itemIdProperty), t11.identifier("item")) : t11.identifier("item");
6733
6975
  const patchItemIdExpr = t11.callExpression(t11.identifier("String"), [rawPatchItemIdExpr]);
6734
6976
  body.push(
6735
- t11.expressionStatement(
6736
- t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaKey")), patchItemIdExpr)
6737
- )
6977
+ t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_KEY"), patchItemIdExpr))
6738
6978
  );
6739
6979
  body.push(
6740
- t11.expressionStatement(
6741
- t11.assignmentExpression("=", t11.memberExpression(elVar, t11.identifier("__geaItem")), t11.identifier("item"))
6742
- )
6980
+ t11.expressionStatement(t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_ITEM"), t11.identifier("item")))
6743
6981
  );
6744
6982
  if (itemTemplateRootIsComponent && t11.isJSXElement(arrayMap.itemTemplate)) {
6745
6983
  const propsProperties = [];
@@ -6770,11 +7008,7 @@ function generateCreateItemMethod(arrayMap, templatePropNames, wholeParamName, t
6770
7008
  if (propsProperties.length > 0) {
6771
7009
  body.push(
6772
7010
  t11.expressionStatement(
6773
- t11.assignmentExpression(
6774
- "=",
6775
- t11.memberExpression(elVar, t11.identifier("__geaProps")),
6776
- t11.objectExpression(propsProperties)
6777
- )
7011
+ t11.assignmentExpression("=", buildExprGeaMember(elVar, "GEA_DOM_PROPS"), t11.objectExpression(propsProperties))
6778
7012
  )
6779
7013
  );
6780
7014
  }
@@ -6823,6 +7057,14 @@ function branchContainsJSX(expr) {
6823
7057
  });
6824
7058
  return containsJSX;
6825
7059
  }
7060
+ function templateHasChildComponent(root) {
7061
+ for (const child of root.children) {
7062
+ if (!t11.isJSXElement(child)) continue;
7063
+ if (isComponentTag(getJSXTagName(child.openingElement.name))) return true;
7064
+ if (templateHasChildComponent(child)) return true;
7065
+ }
7066
+ return false;
7067
+ }
6826
7068
 
6827
7069
  // src/generate-clone.ts
6828
7070
  var EVENT_TYPES2 = /* @__PURE__ */ new Set([
@@ -6830,24 +7072,48 @@ var EVENT_TYPES2 = /* @__PURE__ */ new Set([
6830
7072
  "dblclick",
6831
7073
  "change",
6832
7074
  "input",
7075
+ "submit",
7076
+ "reset",
7077
+ "focus",
7078
+ "blur",
6833
7079
  "keydown",
6834
7080
  "keyup",
6835
- "blur",
6836
- "focus",
7081
+ "keypress",
6837
7082
  "mousedown",
6838
7083
  "mouseup",
6839
- "submit",
7084
+ "mouseover",
7085
+ "mouseout",
7086
+ "mouseenter",
7087
+ "mouseleave",
7088
+ "mousemove",
7089
+ "contextmenu",
7090
+ "touchstart",
7091
+ "touchend",
7092
+ "touchmove",
7093
+ "pointerdown",
7094
+ "pointerup",
7095
+ "pointermove",
7096
+ "scroll",
7097
+ "resize",
7098
+ "drag",
7099
+ "dragstart",
7100
+ "dragend",
7101
+ "dragover",
7102
+ "dragleave",
7103
+ "drop",
7104
+ "animationstart",
7105
+ "animationend",
7106
+ "animationiteration",
7107
+ "transitionstart",
7108
+ "transitionend",
7109
+ "transitionrun",
7110
+ "transitioncancel",
6840
7111
  "tap",
6841
7112
  "longTap",
6842
7113
  "swipeRight",
6843
7114
  "swipeUp",
6844
7115
  "swipeLeft",
6845
- "swipeDown",
6846
- "dragstart",
6847
- "dragend",
6848
- "dragover",
6849
- "dragleave",
6850
- "drop"
7116
+ "swipeDown"
6851
7117
  ]);
6852
7118
  var VOID_ELEMENTS2 = /* @__PURE__ */ new Set([
6853
7119
  "area",
@@ -7343,7 +7609,13 @@ function generateCloneMembers(root, analysis, templateParams, sourceFile, import
7343
7609
  true
7344
7610
  );
7345
7611
  const cloneMethodBody = buildCloneTemplateBody(identityPatches, contentPatches, cloneCtx);
7346
- const cloneMethod = t12.classMethod("method", t12.identifier("__cloneTemplate"), [], t12.blockStatement(cloneMethodBody));
7612
+ const cloneMethod = t12.classMethod(
7613
+ "method",
7614
+ t12.identifier("GEA_CLONE_TEMPLATE"),
7615
+ [],
7616
+ t12.blockStatement(cloneMethodBody),
7617
+ true
7618
+ );
7347
7619
  return [staticField, cloneMethod];
7348
7620
  }
7349
7621
  function buildCloneTemplateBody(identityPatches, contentPatches, cloneCtx) {
@@ -7616,18 +7888,34 @@ function ensureMapItemHelper(classBody2, ctx, helperName) {
7616
7888
  )
7617
7889
  );
7618
7890
  const method = jsMethod2`${id4(helperName)}(e) {}`;
7619
- method.body.body.push(
7620
- ...buildGeaItemDomWalk(),
7621
- ...jsBlockBody`
7622
- if (!__el) return null;
7623
- if (__el.__geaItem) return __el.__geaItem;
7624
- const __itemId = __el.__geaKey ?? (__el.getAttribute && __el.getAttribute('data-gea-item-id'));
7625
- if (__itemId == null) return null;
7626
- const __items = ${itemsExpr};
7627
- const __arr = Array.isArray(__items) ? __items : Array.isArray(__items?.__getTarget) ? __items.__getTarget : [];
7628
- return __arr.find(${findPredicate}) || __itemId;
7629
- `
7630
- );
7891
+ if (!ctx.keyExpression && ctx.itemIdProperty && ctx.itemIdProperty !== ITEM_IS_KEY) {
7892
+ method.body.body.push(
7893
+ ...buildGeaItemDomWalk(),
7894
+ ...jsBlockBody`
7895
+ if (!__el) return null;
7896
+ if (__el[GEA_DOM_ITEM]) return __el[GEA_DOM_ITEM];
7897
+ const __itemId = __el[GEA_DOM_KEY] ?? (__el.getAttribute && __el.getAttribute('data-gea-item-id'));
7898
+ if (__itemId == null) return null;
7899
+ const __items = ${itemsExpr};
7900
+ const __arr = Array.isArray(__items) ? __items : Array.isArray(__items?.[GEA_PROXY_GET_TARGET]) ? __items[GEA_PROXY_GET_TARGET] : [];
7901
+ const __found = __arr.find(${findPredicate});
7902
+ return __found != null ? __found : { ${ctx.itemIdProperty}: __itemId };
7903
+ `
7904
+ );
7905
+ } else {
7906
+ method.body.body.push(
7907
+ ...buildGeaItemDomWalk(),
7908
+ ...jsBlockBody`
7909
+ if (!__el) return null;
7910
+ if (__el[GEA_DOM_ITEM]) return __el[GEA_DOM_ITEM];
7911
+ const __itemId = __el[GEA_DOM_KEY] ?? (__el.getAttribute && __el.getAttribute('data-gea-item-id'));
7912
+ if (__itemId == null) return null;
7913
+ const __items = ${itemsExpr};
7914
+ const __arr = Array.isArray(__items) ? __items : Array.isArray(__items?.[GEA_PROXY_GET_TARGET]) ? __items[GEA_PROXY_GET_TARGET] : [];
7915
+ return __arr.find(${findPredicate}) || __itemId;
7916
+ `
7917
+ );
7918
+ }
7631
7919
  classBody2.body.unshift(method);
7632
7920
  }
7633
7921
  function getLocalFunctionInSetup(name, setupStatements) {
@@ -7639,12 +7927,17 @@ function getLocalFunctionInSetup(name, setupStatements) {
7639
7927
  }
7640
7928
  return null;
7641
7929
  }
7642
- function appendCompiledEventMethods(classBody2, handlers, setupStatements = []) {
7930
+ function appendCompiledEventMethods(classBody2, handlers, setupStatements = [], fileAst) {
7643
7931
  if (handlers.length === 0) return false;
7644
7932
  const paramContext = getTemplateParamContext(classBody2);
7645
7933
  const mapHandlers = handlers.filter(
7646
7934
  (h) => Boolean(h.mapContext)
7647
7935
  );
7936
+ if (mapHandlers.length > 0 && fileAst) {
7937
+ ensureImport(fileAst, "@geajs/core", "GEA_MAPS");
7938
+ ensureImport(fileAst, "@geajs/core", "GEA_DOM_KEY");
7939
+ ensureImport(fileAst, "@geajs/core", "GEA_DOM_ITEM");
7940
+ }
7648
7941
  const seenContexts = /* @__PURE__ */ new Set();
7649
7942
  for (const h of mapHandlers) {
7650
7943
  const key = getMapContextKey(h.mapContext);
@@ -7659,6 +7952,13 @@ function appendCompiledEventMethods(classBody2, handlers, setupStatements = [])
7659
7952
  function isDirectThisMethodRef(handler) {
7660
7953
  return !!handler.handlerExpression && t13.isMemberExpression(handler.handlerExpression) && t13.isThisExpression(handler.handlerExpression.object) && t13.isIdentifier(handler.handlerExpression.property) && !handler.delegatedPropName && !handler.mapContext;
7661
7954
  }
7955
+ function wrapEventsGetterHandlerRef(methodProperty) {
7956
+ const callee = t13.memberExpression(t13.thisExpression(), methodProperty);
7957
+ return t13.arrowFunctionExpression(
7958
+ [t13.identifier("e"), t13.identifier("targetComponent")],
7959
+ t13.callExpression(callee, [t13.identifier("e"), t13.identifier("targetComponent")])
7960
+ );
7961
+ }
7662
7962
  function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupStatements) {
7663
7963
  const getter = ensureEventsGetter(classBody2);
7664
7964
  const eventsObject = getEventsObject(getter);
@@ -7667,7 +7967,7 @@ function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupSta
7667
7967
  let handlerRef;
7668
7968
  if (isDirectThisMethodRef(handler)) {
7669
7969
  const prop = handler.handlerExpression.property;
7670
- handlerRef = t13.memberExpression(t13.thisExpression(), t13.cloneNode(prop));
7970
+ handlerRef = wrapEventsGetterHandlerRef(t13.cloneNode(prop));
7671
7971
  } else {
7672
7972
  let methodName = handler.methodName || `__event_${handler.eventType}_${index}`;
7673
7973
  let uniqueIndex = 1;
@@ -7678,7 +7978,7 @@ function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupSta
7678
7978
  if (!findClassMethod(classBody2, methodName)) {
7679
7979
  classBody2.body.push(buildSelectorHandlerMethod(handler, methodName, paramContext, setupStatements));
7680
7980
  }
7681
- handlerRef = t13.memberExpression(t13.thisExpression(), t13.identifier(methodName));
7981
+ handlerRef = wrapEventsGetterHandlerRef(t13.identifier(methodName));
7682
7982
  }
7683
7983
  const selectorExpr = handler.selectorExpression ? replacePropRefsInExpression(
7684
7984
  t13.cloneNode(handler.selectorExpression, true),
@@ -7693,7 +7993,13 @@ function appendEventsGetterHandlers(classBody2, handlers, paramContext, setupSta
7693
7993
  eventsObject.properties.push(eventTypeProp);
7694
7994
  }
7695
7995
  const selectorMap = eventTypeProp.value;
7696
- selectorMap.properties.push(t13.objectProperty(selectorExpr, handlerRef, !handler.selector));
7996
+ const selectorCode = generate2(selectorExpr).code;
7997
+ const isDuplicate = selectorMap.properties.some(
7998
+ (prop) => t13.isObjectProperty(prop) && generate2(prop.key).code === selectorCode
7999
+ );
8000
+ if (!isDuplicate) {
8001
+ selectorMap.properties.push(t13.objectProperty(selectorExpr, handlerRef, !handler.selector));
8002
+ }
7697
8003
  });
7698
8004
  }
7699
8005
  function buildSelectorHandlerMethod(handler, methodName, paramContext, setupStatements) {
@@ -7812,7 +8118,7 @@ function replacePropsObjectRefsInNode(node, propsObjectName) {
7812
8118
  replacePropsObjectRefsInNode(node.object, propsObjectName),
7813
8119
  node.property,
7814
8120
  node.computed,
7815
- node.optional
8121
+ node.optional ?? true
7816
8122
  );
7817
8123
  }
7818
8124
  if (t13.isOptionalCallExpression(node)) {
@@ -7821,7 +8127,7 @@ function replacePropsObjectRefsInNode(node, propsObjectName) {
7821
8127
  node.arguments.map(
7822
8128
  (a) => t13.isExpression(a) ? replacePropsObjectRefsInNode(a, propsObjectName) : a
7823
8129
  ),
7824
- node.optional
8130
+ node.optional ?? true
7825
8131
  );
7826
8132
  }
7827
8133
  if (t13.isConditionalExpression(node)) {
@@ -7918,7 +8224,7 @@ function buildArrayItemsExpr(ctx, opts = {}) {
7918
8224
  return t13.callExpression(
7919
8225
  t13.memberExpression(
7920
8226
  t13.memberExpression(
7921
- t13.memberExpression(t13.thisExpression(), t13.identifier("__geaMaps")),
8227
+ t13.memberExpression(t13.thisExpression(), t13.identifier("GEA_MAPS"), true),
7922
8228
  t13.numericLiteral(mapIdx),
7923
8229
  true
7924
8230
  ),
@@ -7927,7 +8233,7 @@ function buildArrayItemsExpr(ctx, opts = {}) {
7927
8233
  []
7928
8234
  );
7929
8235
  }
7930
- const base = ctx.isImportedState ? opts.raw ? t13.memberExpression(t13.identifier(ctx.storeVar || "store"), t13.identifier("__raw")) : t13.identifier(ctx.storeVar || "store") : t13.thisExpression();
8236
+ const base = ctx.isImportedState ? opts.raw ? buildExprGeaMember(t13.identifier(ctx.storeVar || "store"), "GEA_PROXY_RAW") : t13.identifier(ctx.storeVar || "store") : t13.thisExpression();
7931
8237
  if (ctx.arrayPathParts.length === 0) return base;
7932
8238
  const [, ...rest] = ctx.arrayPathParts;
7933
8239
  const isIndex = /^\d+$/.test(first);
@@ -7937,7 +8243,7 @@ function buildArrayItemsExpr(ctx, opts = {}) {
7937
8243
  function buildGeaItemDomWalk() {
7938
8244
  return jsBlockBody`
7939
8245
  var __el = e.target;
7940
- while (__el && __el.__geaKey == null && (!__el.getAttribute || !__el.getAttribute('data-gea-item-id'))) __el = __el.parentElement;
8246
+ while (__el && __el[GEA_DOM_KEY] == null && (!__el.getAttribute || !__el.getAttribute('data-gea-item-id'))) __el = __el.parentElement;
7941
8247
  `;
7942
8248
  }
7943
8249
  function buildMapEventBody(handler, paramContext) {
@@ -7955,8 +8261,8 @@ function buildMapEventBody(handler, paramContext) {
7955
8261
  const preamble2 = [
7956
8262
  ...buildGeaItemDomWalk(),
7957
8263
  ...jsBlockBody`
7958
- if (!__el || !__el.__geaItem) return;
7959
- const ${id4(ctx.indexVariable)} = ${rawArrayExpr}.indexOf(__el.__geaItem);
8264
+ if (!__el || !__el[GEA_DOM_ITEM]) return;
8265
+ const ${id4(ctx.indexVariable)} = ${rawArrayExpr}.indexOf(__el[GEA_DOM_ITEM]);
7960
8266
  `
7961
8267
  ];
7962
8268
  return [...preamble2, ...handlerBody];
@@ -7970,7 +8276,7 @@ function buildMapEventBody(handler, paramContext) {
7970
8276
  preamble.push(
7971
8277
  ...buildGeaItemDomWalk(),
7972
8278
  ...jsBlockBody`
7973
- const ${id4(ctx.indexVariable)} = __el ? ${rawArrayExpr}.indexOf(__el.__geaItem) : -1;
8279
+ const ${id4(ctx.indexVariable)} = __el ? ${rawArrayExpr}.indexOf(__el[GEA_DOM_ITEM]) : -1;
7974
8280
  `
7975
8281
  );
7976
8282
  }
@@ -8095,10 +8401,7 @@ function injectChildComponents(ast, componentInstances, directForwardingChildren
8095
8401
  t14.assignmentExpression(
8096
8402
  "=",
8097
8403
  t14.memberExpression(t14.thisExpression(), t14.identifier(backingField)),
8098
- t14.callExpression(t14.memberExpression(t14.thisExpression(), t14.identifier("__child")), [
8099
- t14.identifier(child.tagName),
8100
- propsArg
8101
- ])
8404
+ t14.callExpression(buildThisGeaMember("GEA_CHILD"), [t14.identifier(child.tagName), propsArg])
8102
8405
  )
8103
8406
  )
8104
8407
  ),
@@ -8171,10 +8474,7 @@ function buildInstanceStatements(instances, directForwardingChildren) {
8171
8474
  t14.assignmentExpression(
8172
8475
  "=",
8173
8476
  t14.memberExpression(t14.thisExpression(), t14.identifier(child.instanceVar)),
8174
- t14.callExpression(t14.memberExpression(t14.thisExpression(), t14.identifier("__child")), [
8175
- t14.identifier(child.tagName),
8176
- propsArg
8177
- ])
8477
+ t14.callExpression(buildThisGeaMember("GEA_CHILD"), [t14.identifier(child.tagName), propsArg])
8178
8478
  )
8179
8479
  )
8180
8480
  );
@@ -8312,10 +8612,7 @@ function buildValueExpression(textExpr, stateRefs) {
8312
8612
  return rewriteStateRefs(t15.cloneNode(textExpr.expression, true), stateRefs);
8313
8613
  }
8314
8614
  if (textExpr.isImportedState && textExpr.storeVar) {
8315
- return buildMemberChainFromParts(
8316
- t15.memberExpression(t15.identifier(textExpr.storeVar), t15.identifier("__store")),
8317
- textExpr.pathParts
8318
- );
8615
+ return buildMemberChainFromParts(t15.identifier(textExpr.storeVar), textExpr.pathParts);
8319
8616
  }
8320
8617
  return buildMemberChainFromParts(t15.thisExpression(), textExpr.pathParts);
8321
8618
  }
@@ -8335,19 +8632,15 @@ function rewriteStateRefs(expr, stateRefs) {
8335
8632
  } else if (ref.kind === "local") {
8336
8633
  path.replaceWith(t15.thisExpression());
8337
8634
  } 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
- );
8635
+ path.replaceWith(t15.memberExpression(t15.identifier(ref.storeVar), t15.identifier(ref.propName)));
8344
8636
  path.skip();
8345
8637
  } else if (ref.kind === "local-destructured" && ref.propName) {
8346
8638
  path.replaceWith(t15.memberExpression(t15.thisExpression(), t15.identifier(ref.propName)));
8347
8639
  path.skip();
8348
- } else {
8349
- path.replaceWith(t15.memberExpression(t15.identifier(path.node.name), t15.identifier("__store")));
8640
+ } else if (ref.kind === "imported") {
8350
8641
  path.skip();
8642
+ } else {
8643
+ throw new Error(`rewriteStateRefs: unhandled state ref kind ${ref.kind}`);
8351
8644
  }
8352
8645
  }
8353
8646
  });
@@ -8391,7 +8684,7 @@ function buildSimpleUpdate(binding, param, stateRefs) {
8391
8684
  }
8392
8685
  if (target === "textContent" && binding.bindingId && binding.bindingId !== "" && !binding.userIdExpr) {
8393
8686
  const suffix = t15.stringLiteral(binding.bindingId);
8394
- return js3`${jsExpr2`this.__updateText(${suffix}, ${valueExpr})`};`;
8687
+ return t15.expressionStatement(t15.callExpression(buildThisGeaMember("GEA_UPDATE_TEXT"), [suffix, valueExpr]));
8395
8688
  }
8396
8689
  return js3`if (${el}) { ${jsExpr2`${el}.${id6(target)}`} = ${valueExpr}; }`;
8397
8690
  }
@@ -8647,7 +8940,7 @@ function buildPropPatcherFunction(binding, propName) {
8647
8940
  t17.variableDeclaration("const", [
8648
8941
  t17.variableDeclarator(
8649
8942
  t17.identifier("__newAttr"),
8650
- URL_ATTRS2.has(attrName) ? t17.callExpression(t17.identifier("__sanitizeAttr"), [
8943
+ URL_ATTRS2.has(attrName) ? t17.callExpression(t17.identifier("geaSanitizeAttr"), [
8651
8944
  t17.stringLiteral(attrName),
8652
8945
  t17.callExpression(t17.identifier("String"), [t17.identifier("__attrValue")])
8653
8946
  ]) : t17.callExpression(t17.identifier("String"), [t17.identifier("__attrValue")])
@@ -9021,7 +9314,9 @@ function generateEnsureArrayConfigsMethod(arrayMaps) {
9021
9314
  ])
9022
9315
  );
9023
9316
  });
9024
- return appendToBody3(jsMethod5`${id8("__ensureArrayConfigs")}() {}`, ...body);
9317
+ const method = t17.classMethod("method", t17.identifier("GEA_ENSURE_ARRAY_CONFIGS"), [], t17.blockStatement([]), true);
9318
+ method.body.body.push(...body);
9319
+ return method;
9025
9320
  }
9026
9321
  function generateArrayRelationalObserver(path, arrayMap, bindings, methodName) {
9027
9322
  const arrayPath = pathPartsToString(getArrayPathParts(arrayMap));
@@ -9096,12 +9391,12 @@ function generateArrayConditionalPatchObserver(arrayMap, bindings, methodName) {
9096
9391
  const containerName = `__${arrayPath.replace(/\./g, "_")}_container`;
9097
9392
  const containerRef = t17.memberExpression(t17.thisExpression(), t17.identifier(containerName));
9098
9393
  const proxiedArr = arrayMap.isImportedState ? buildMemberChain(
9099
- t17.memberExpression(t17.identifier(arrayMap.storeVar || "store"), t17.identifier("__store")),
9394
+ buildExprGeaMember(t17.identifier(arrayMap.storeVar || "store"), "GEA_STORE_ROOT"),
9100
9395
  arrayPath
9101
9396
  ) : buildMemberChain(t17.thisExpression(), arrayPath);
9102
9397
  const rawArrExpr = t17.logicalExpression(
9103
9398
  "||",
9104
- t17.memberExpression(t17.cloneNode(proxiedArr, true), t17.identifier("__getTarget")),
9399
+ buildExprGeaMember(t17.cloneNode(proxiedArr, true), "GEA_PROXY_GET_TARGET"),
9105
9400
  t17.cloneNode(proxiedArr, true)
9106
9401
  );
9107
9402
  const loopBody = [
@@ -9154,12 +9449,12 @@ function generateArrayConditionalRerenderObserver(arrayMap, methodName) {
9154
9449
  const containerRef = t17.memberExpression(t17.thisExpression(), t17.identifier(containerName));
9155
9450
  const configRef = t17.memberExpression(t17.thisExpression(), t17.identifier(getArrayConfigPropName(arrayMap)));
9156
9451
  const proxiedArr = arrayMap.isImportedState ? buildMemberChain(
9157
- t17.memberExpression(t17.identifier(arrayMap.storeVar || "store"), t17.identifier("__store")),
9452
+ buildExprGeaMember(t17.identifier(arrayMap.storeVar || "store"), "GEA_STORE_ROOT"),
9158
9453
  arrayPath
9159
9454
  ) : buildMemberChain(t17.thisExpression(), arrayPath);
9160
9455
  const rawArrExpr = t17.logicalExpression(
9161
9456
  "||",
9162
- t17.memberExpression(t17.cloneNode(proxiedArr, true), t17.identifier("__getTarget")),
9457
+ buildExprGeaMember(t17.cloneNode(proxiedArr, true), "GEA_PROXY_GET_TARGET"),
9163
9458
  t17.cloneNode(proxiedArr, true)
9164
9459
  );
9165
9460
  return appendToBody3(
@@ -9237,9 +9532,7 @@ function generateArrayConditionalRerenderObserver(arrayMap, methodName) {
9237
9532
  t17.ifStatement(
9238
9533
  t17.unaryExpression("!", t17.identifier("__skipArrayConditionalRerender")),
9239
9534
  t17.blockStatement([
9240
- t17.expressionStatement(
9241
- t17.callExpression(t17.memberExpression(t17.thisExpression(), t17.identifier("__ensureArrayConfigs")), [])
9242
- ),
9535
+ t17.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")),
9243
9536
  t17.variableDeclaration("const", [
9244
9537
  t17.variableDeclarator(
9245
9538
  t17.identifier("__arr"),
@@ -9251,7 +9544,7 @@ function generateArrayConditionalRerenderObserver(arrayMap, methodName) {
9251
9544
  )
9252
9545
  ]),
9253
9546
  t17.expressionStatement(
9254
- t17.callExpression(t17.memberExpression(t17.thisExpression(), t17.identifier("__applyListChanges")), [
9547
+ buildThisGeaCall("GEA_APPLY_LIST_CHANGES", [
9255
9548
  containerRef,
9256
9549
  t17.identifier("__arr"),
9257
9550
  t17.nullLiteral(),
@@ -9372,16 +9665,12 @@ function buildElsLookup(elsRef, containerRef, idExpr, rowVar, containerBindingId
9372
9665
  "||",
9373
9666
  t17.binaryExpression(
9374
9667
  "==",
9375
- t17.memberExpression(t17.identifier("__ch"), t17.identifier("__geaKey")),
9668
+ buildExprGeaMember(t17.identifier("__ch"), "GEA_DOM_KEY"),
9376
9669
  t17.cloneNode(idExpr, true)
9377
9670
  ),
9378
9671
  t17.logicalExpression(
9379
9672
  "&&",
9380
- t17.binaryExpression(
9381
- "==",
9382
- t17.memberExpression(t17.identifier("__ch"), t17.identifier("__geaKey")),
9383
- t17.nullLiteral()
9384
- ),
9673
+ t17.binaryExpression("==", buildExprGeaMember(t17.identifier("__ch"), "GEA_DOM_KEY"), t17.nullLiteral()),
9385
9674
  t17.binaryExpression(
9386
9675
  "==",
9387
9676
  t17.optionalCallExpression(
@@ -9469,11 +9758,9 @@ function generateArrayHandlers(arrayMap, methodName) {
9469
9758
  t17.returnStatement()
9470
9759
  ])
9471
9760
  ),
9761
+ t17.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")),
9472
9762
  t17.expressionStatement(
9473
- t17.callExpression(t17.memberExpression(t17.thisExpression(), t17.identifier("__ensureArrayConfigs")), [])
9474
- ),
9475
- t17.expressionStatement(
9476
- t17.callExpression(t17.memberExpression(t17.thisExpression(), t17.identifier("__applyListChanges")), [
9763
+ buildThisGeaCall("GEA_APPLY_LIST_CHANGES", [
9477
9764
  containerRef,
9478
9765
  t17.identifier(paramName),
9479
9766
  t17.identifier("change"),
@@ -9811,7 +10098,7 @@ function generateRenderItemMethod(arrayMap, imports, eventHandlers, eventIdCount
9811
10098
  t18.assignmentExpression(
9812
10099
  "=",
9813
10100
  t18.cloneNode(privateRsField),
9814
- t18.memberExpression(t18.identifier(arrayMap.storeVar), t18.identifier("__raw"))
10101
+ buildExprGeaMember(t18.identifier(arrayMap.storeVar), "GEA_PROXY_RAW")
9815
10102
  )
9816
10103
  )
9817
10104
  )
@@ -9827,11 +10114,33 @@ function generateRenderItemMethod(arrayMap, imports, eventHandlers, eventIdCount
9827
10114
  returnStmt
9828
10115
  );
9829
10116
  if (handlerPropsInMap.length > 0 && classBody2) {
9830
- const handleItemHandler = jsMethod6`__handleItemHandler(itemId, e) {
9831
- const fn = this.__itemHandlers_?.[itemId];
9832
- if (fn) fn(e);
9833
- }`;
9834
- if (!classBody2.body.some((m) => t18.isClassMethod(m) && t18.isIdentifier(m.key) && m.key.name === "__handleItemHandler")) {
10117
+ const handleItemHandlerBody = t18.blockStatement([
10118
+ t18.variableDeclaration("const", [
10119
+ t18.variableDeclarator(
10120
+ t18.identifier("fn"),
10121
+ t18.optionalMemberExpression(
10122
+ t18.memberExpression(t18.thisExpression(), t18.identifier("__itemHandlers_")),
10123
+ t18.identifier("itemId"),
10124
+ true,
10125
+ true
10126
+ )
10127
+ )
10128
+ ]),
10129
+ t18.ifStatement(
10130
+ t18.identifier("fn"),
10131
+ t18.expressionStatement(t18.callExpression(t18.identifier("fn"), [t18.identifier("e")]))
10132
+ )
10133
+ ]);
10134
+ const handleItemHandler = t18.classMethod(
10135
+ "method",
10136
+ t18.identifier("GEA_HANDLE_ITEM_HANDLER"),
10137
+ [t18.identifier("itemId"), t18.identifier("e")],
10138
+ handleItemHandlerBody,
10139
+ true
10140
+ );
10141
+ if (!classBody2.body.some(
10142
+ (m) => t18.isClassMethod(m) && m.computed === true && t18.isIdentifier(m.key) && m.key.name === "GEA_HANDLE_ITEM_HANDLER"
10143
+ )) {
9835
10144
  classBody2.body.unshift(handleItemHandler);
9836
10145
  }
9837
10146
  }
@@ -9870,7 +10179,16 @@ function getArrayCapName2(arrayPropName) {
9870
10179
  return arrayPropName.charAt(0).toUpperCase() + arrayPropName.slice(1);
9871
10180
  }
9872
10181
  function getComponentArrayItemsName(arrayPropName) {
9873
- return `_${arrayPropName}Items`;
10182
+ const safe = arrayPropName.replace(/[^a-zA-Z0-9_$]/g, "_");
10183
+ return `_gea_${safe}_items`;
10184
+ }
10185
+ function buildComponentArrayItemsSymbolDecl(arrayPropName, itemsBinding) {
10186
+ return t19.variableDeclaration("const", [
10187
+ t19.variableDeclarator(
10188
+ t19.identifier(itemsBinding),
10189
+ t19.callExpression(t19.identifier("geaListItemsSymbol"), [t19.stringLiteral(arrayPropName)])
10190
+ )
10191
+ ]);
9874
10192
  }
9875
10193
  function getComponentArrayRefreshMethodName(arrayPropName) {
9876
10194
  return `__refresh${getArrayCapName2(arrayPropName)}Items`;
@@ -9938,6 +10256,7 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
9938
10256
  finalPropsExpr = cloned;
9939
10257
  }
9940
10258
  const itemsName = getComponentArrayItemsName(arrayPropName);
10259
+ const symbolConstDecl = buildComponentArrayItemsSymbolDecl(arrayPropName, itemsName);
9941
10260
  let arrAccessExpr;
9942
10261
  let arrSetupStatements = [];
9943
10262
  if (storeArrayAccess) {
@@ -9980,7 +10299,7 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
9980
10299
  if (!t19.isVariableDeclaration(stmt)) continue;
9981
10300
  for (const decl of stmt.declarations) {
9982
10301
  if (t19.isIdentifier(decl.init) && storeVarNames.has(decl.init.name)) {
9983
- decl.init = t19.memberExpression(t19.identifier(decl.init.name), t19.identifier("__raw"));
10302
+ decl.init = buildExprGeaMember(t19.identifier(decl.init.name), "GEA_PROXY_RAW");
9984
10303
  }
9985
10304
  }
9986
10305
  }
@@ -9994,7 +10313,7 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
9994
10313
  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
10314
  const mapParams = [t19.identifier("opt")];
9996
10315
  if (indexVar || !itemIdProp) mapParams.push(t19.identifier("__k"));
9997
- const childCall = t19.callExpression(t19.memberExpression(t19.thisExpression(), t19.identifier("__child")), [
10316
+ const childCall = t19.callExpression(buildThisGeaMember("GEA_CHILD"), [
9998
10317
  t19.identifier(comp.componentTag),
9999
10318
  t19.cloneNode(itemPropsCall, true),
10000
10319
  t19.cloneNode(keyExpr, true)
@@ -10004,11 +10323,12 @@ function generateComponentArrayResult(um, arrayPropName, imports, propNames, _cl
10004
10323
  const parenthesized = t19.parenthesizedExpression ? t19.parenthesizedExpression(nullishCoalesce) : nullishCoalesce;
10005
10324
  const mapCallExpr = t19.callExpression(t19.memberExpression(parenthesized, t19.identifier("map")), [mapCallback]);
10006
10325
  const constructorInit = t19.expressionStatement(
10007
- t19.assignmentExpression("=", t19.memberExpression(t19.thisExpression(), t19.identifier(itemsName)), mapCallExpr)
10326
+ t19.assignmentExpression("=", t19.memberExpression(t19.thisExpression(), t19.identifier(itemsName), true), mapCallExpr)
10008
10327
  );
10009
10328
  return {
10010
10329
  itemPropsMethod,
10011
10330
  constructorInit,
10331
+ symbolConstDecl,
10012
10332
  componentTag: comp.componentTag,
10013
10333
  containerBindingId: um.containerBindingId,
10014
10334
  containerUserIdExpr: um.containerUserIdExpr,
@@ -10047,7 +10367,7 @@ function rewriteTemplateBodyForImportedState(_templateMethod, _stateRefs, _store
10047
10367
  function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = []) {
10048
10368
  const body = [];
10049
10369
  if (hasArrayConfigs) {
10050
- body.push(js6`this.__ensureArrayConfigs();`);
10370
+ body.push(t20.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")));
10051
10371
  }
10052
10372
  const observeListPathKeys = /* @__PURE__ */ new Set();
10053
10373
  for (const config of observeListConfigs) {
@@ -10076,7 +10396,7 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
10076
10396
  if (handlers.length === 1 && !handlers[0].isVia) {
10077
10397
  body.push(
10078
10398
  t20.expressionStatement(
10079
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__observe")), [
10399
+ t20.callExpression(thisGea("GEA_OBSERVE"), [
10080
10400
  storeVarExpr,
10081
10401
  pathArray,
10082
10402
  t20.memberExpression(t20.thisExpression(), t20.identifier(handlers[0].methodName))
@@ -10107,10 +10427,10 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
10107
10427
  ])
10108
10428
  );
10109
10429
  if (h.dynamicKeyExpr) {
10110
- const keyId = t20.identifier(`__geaKey${hi}`);
10111
- const changeId = t20.identifier(`__geaChange${hi}`);
10112
- const partsId = t20.identifier(`__geaParts${hi}`);
10113
- const prevRootId = t20.identifier(`__geaPrevRoot${hi}`);
10430
+ const keyId = t20.identifier(`geaDynKey${hi}`);
10431
+ const changeId = t20.identifier(`geaDynChange${hi}`);
10432
+ const partsId = t20.identifier(`geaDynParts${hi}`);
10433
+ const prevRootId = t20.identifier(`geaDynPrevRoot${hi}`);
10114
10434
  const prefixChecks = h.pathParts.map(
10115
10435
  (part, idx) => t20.binaryExpression(
10116
10436
  "===",
@@ -10188,7 +10508,7 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
10188
10508
  }
10189
10509
  body.push(
10190
10510
  t20.expressionStatement(
10191
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__observe")), [
10511
+ t20.callExpression(thisGea("GEA_OBSERVE"), [
10192
10512
  storeVarExpr,
10193
10513
  pathArray,
10194
10514
  t20.arrowFunctionExpression([vParam, cParam], t20.blockStatement(callStmts))
@@ -10202,17 +10522,15 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
10202
10522
  const itemsName = getComponentArrayItemsName(config.arrayPropName);
10203
10523
  const itemPropsMethodName = `__itemProps_${config.arrayPropName}`;
10204
10524
  const configProps = [
10205
- t20.objectProperty(t20.identifier("items"), t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName))),
10206
- t20.objectProperty(t20.identifier("itemsKey"), t20.stringLiteral(itemsName)),
10525
+ t20.objectProperty(t20.identifier("items"), t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true)),
10526
+ t20.objectProperty(t20.identifier("itemsKey"), t20.identifier(itemsName)),
10207
10527
  t20.objectProperty(
10208
10528
  t20.identifier("container"),
10209
10529
  t20.arrowFunctionExpression(
10210
10530
  [],
10211
10531
  config.containerUserIdExpr ? t20.callExpression(t20.memberExpression(t20.identifier("document"), t20.identifier("getElementById")), [
10212
10532
  t20.cloneNode(config.containerUserIdExpr, true)
10213
- ]) : config.containerBindingId ? t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__el")), [
10214
- t20.stringLiteral(config.containerBindingId)
10215
- ]) : jsExpr4`this.$(":scope")`
10533
+ ]) : config.containerBindingId ? t20.callExpression(thisGea("GEA_EL"), [t20.stringLiteral(config.containerBindingId)]) : jsExpr4`this.$(":scope")`
10216
10534
  )
10217
10535
  ),
10218
10536
  t20.objectProperty(t20.identifier("Ctor"), t20.identifier(config.componentTag)),
@@ -10241,6 +10559,11 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
10241
10559
  )
10242
10560
  )
10243
10561
  ];
10562
+ if (config.afterCondSlotIndex != null) {
10563
+ configProps.push(
10564
+ t20.objectProperty(t20.identifier("afterCondSlotIndex"), t20.numericLiteral(config.afterCondSlotIndex))
10565
+ );
10566
+ }
10244
10567
  const samePathHandlers = [];
10245
10568
  const pathKey = JSON.stringify(config.pathParts);
10246
10569
  for (const handler of store.observeHandlers) {
@@ -10266,11 +10589,7 @@ function generateCreatedHooks(stores, hasArrayConfigs, observeListConfigs = [])
10266
10589
  }
10267
10590
  body.push(
10268
10591
  t20.expressionStatement(
10269
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__observeList")), [
10270
- storeVarExpr,
10271
- pathArray,
10272
- t20.objectExpression(configProps)
10273
- ])
10592
+ t20.callExpression(thisGea("GEA_OBSERVE_LIST"), [storeVarExpr, pathArray, t20.objectExpression(configProps)])
10274
10593
  )
10275
10594
  );
10276
10595
  }
@@ -10311,6 +10630,15 @@ function classMethodUsesParam(method, index) {
10311
10630
  function serializeAstNode(node) {
10312
10631
  return node ? JSON.stringify(node) : "";
10313
10632
  }
10633
+ var thisGea = buildThisGeaMember;
10634
+ function insertStmtBeforeClass(classPath, stmt) {
10635
+ const parent = classPath.parentPath;
10636
+ if (parent.isExportDefaultDeclaration()) {
10637
+ parent.insertBefore(stmt);
10638
+ } else {
10639
+ classPath.insertBefore(stmt);
10640
+ }
10641
+ }
10314
10642
  function expressionReferencesIdentifier(expr, name) {
10315
10643
  let found = false;
10316
10644
  const program12 = t20.program([t20.expressionStatement(t20.cloneNode(expr, true))]);
@@ -10326,16 +10654,16 @@ function expressionReferencesIdentifier(expr, name) {
10326
10654
  return found;
10327
10655
  }
10328
10656
  function generateLocalStateObserverSetup(observeHandlers, hasArrayConfigs) {
10329
- const localStore = t20.memberExpression(t20.thisExpression(), t20.identifier("__store"));
10657
+ const localStore = buildThisGeaMember("GEA_STORE_ROOT");
10330
10658
  const body = [];
10331
10659
  if (hasArrayConfigs) {
10332
- body.push(js6`this.__ensureArrayConfigs();`);
10660
+ body.push(t20.expressionStatement(buildThisGeaCall("GEA_ENSURE_ARRAY_CONFIGS")));
10333
10661
  }
10334
10662
  body.push(js6`if (!${localStore}) { return; }`);
10335
10663
  for (const observeHandler of observeHandlers) {
10336
10664
  body.push(
10337
10665
  t20.expressionStatement(
10338
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__observe")), [
10666
+ t20.callExpression(thisGea("GEA_OBSERVE"), [
10339
10667
  t20.thisExpression(),
10340
10668
  t20.arrayExpression(observeHandler.pathParts.map((part) => t20.stringLiteral(part))),
10341
10669
  t20.memberExpression(t20.thisExpression(), t20.identifier(observeHandler.methodName))
@@ -10343,7 +10671,13 @@ function generateLocalStateObserverSetup(observeHandlers, hasArrayConfigs) {
10343
10671
  )
10344
10672
  );
10345
10673
  }
10346
- const method = jsMethod8`${id11("__setupLocalStateObservers")}() {}`;
10674
+ const method = t20.classMethod(
10675
+ "method",
10676
+ t20.identifier("GEA_SETUP_LOCAL_STATE_OBSERVERS"),
10677
+ [],
10678
+ t20.blockStatement([]),
10679
+ true
10680
+ );
10347
10681
  method.body.body.push(...body);
10348
10682
  return method;
10349
10683
  }
@@ -10376,6 +10710,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
10376
10710
  traverse12(ast, {
10377
10711
  ClassDeclaration(classPath) {
10378
10712
  if (!t20.isIdentifier(classPath.node.id) || classPath.node.id.name !== className) return;
10713
+ ensureGeaCompilerSymbolImports(ast);
10379
10714
  let originalClassBody;
10380
10715
  traverse12(originalAST, {
10381
10716
  noScope: true,
@@ -10471,7 +10806,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
10471
10806
  t20.memberExpression(t20.thisExpression(), t20.identifier("id")),
10472
10807
  t20.stringLiteral("-" + pb.bindingId)
10473
10808
  )
10474
- ) : pb.selector === ":scope" ? t20.memberExpression(t20.thisExpression(), t20.identifier("element_")) : t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("$")), [
10809
+ ) : pb.selector === ":scope" ? thisGea("GEA_ELEMENT") : t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("$")), [
10475
10810
  t20.stringLiteral(pb.selector)
10476
10811
  ]);
10477
10812
  const valueExpr = pb.expression && pb.setupStatements ? t20.identifier("__boundValue") : t20.identifier("value");
@@ -10545,31 +10880,163 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
10545
10880
  t20.cloneNode(valueExpr, true)
10546
10881
  )
10547
10882
  );
10548
- const consequent = isHtmlProducing ? t20.blockStatement([
10549
- assignStmt,
10550
- // After replacing innerHTML for children, re-initialize child
10551
- // components that were created from the new HTML string.
10552
- t20.expressionStatement(
10553
- t20.callExpression(
10554
- t20.memberExpression(t20.thisExpression(), t20.identifier("instantiateChildComponents_")),
10555
- []
10556
- )
10557
- ),
10558
- // Reconnect compiled children from the parent component whose
10559
- // DOM elements were replaced by the innerHTML update.
10560
- t20.ifStatement(
10561
- t20.memberExpression(t20.thisExpression(), t20.identifier("parentComponent")),
10883
+ let consequent;
10884
+ if (isHtmlProducing) {
10885
+ const __tpl = t20.identifier("__tpl");
10886
+ const __nc = t20.identifier("__nc");
10887
+ const __oc = t20.identifier("__oc");
10888
+ const __structural = t20.identifier("__structural");
10889
+ const __j = t20.identifier("__j");
10890
+ const setupStmts = [
10891
+ t20.variableDeclaration("var", [
10892
+ t20.variableDeclarator(
10893
+ __tpl,
10894
+ t20.callExpression(t20.memberExpression(t20.identifier("document"), t20.identifier("createElement")), [
10895
+ t20.stringLiteral("template")
10896
+ ])
10897
+ )
10898
+ ]),
10562
10899
  t20.expressionStatement(
10563
- t20.callExpression(
10900
+ t20.assignmentExpression(
10901
+ "=",
10902
+ t20.memberExpression(__tpl, t20.identifier("innerHTML")),
10903
+ t20.cloneNode(valueExpr, true)
10904
+ )
10905
+ ),
10906
+ t20.variableDeclaration("var", [
10907
+ t20.variableDeclarator(
10908
+ __nc,
10564
10909
  t20.memberExpression(
10565
- t20.memberExpression(t20.thisExpression(), t20.identifier("parentComponent")),
10566
- t20.identifier("mountCompiledChildComponents_")
10910
+ t20.memberExpression(__tpl, t20.identifier("content")),
10911
+ t20.identifier("childNodes")
10912
+ )
10913
+ )
10914
+ ]),
10915
+ t20.variableDeclaration("var", [
10916
+ t20.variableDeclarator(__oc, t20.memberExpression(t20.identifier("__el"), t20.identifier("childNodes")))
10917
+ ])
10918
+ ];
10919
+ const structuralDetect = [
10920
+ t20.variableDeclaration("var", [
10921
+ t20.variableDeclarator(
10922
+ __structural,
10923
+ t20.binaryExpression(
10924
+ "!==",
10925
+ t20.memberExpression(__nc, t20.identifier("length")),
10926
+ t20.memberExpression(__oc, t20.identifier("length"))
10927
+ )
10928
+ )
10929
+ ]),
10930
+ t20.ifStatement(
10931
+ t20.unaryExpression("!", __structural),
10932
+ t20.blockStatement([
10933
+ t20.forStatement(
10934
+ t20.variableDeclaration("var", [t20.variableDeclarator(__j, t20.numericLiteral(0))]),
10935
+ t20.binaryExpression("<", __j, t20.memberExpression(__nc, t20.identifier("length"))),
10936
+ t20.updateExpression("++", __j),
10937
+ t20.blockStatement([
10938
+ t20.ifStatement(
10939
+ t20.logicalExpression(
10940
+ "||",
10941
+ t20.binaryExpression(
10942
+ "!==",
10943
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
10944
+ t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("nodeType"))
10945
+ ),
10946
+ t20.logicalExpression(
10947
+ "&&",
10948
+ t20.binaryExpression(
10949
+ "===",
10950
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
10951
+ t20.numericLiteral(1)
10952
+ ),
10953
+ t20.binaryExpression(
10954
+ "!==",
10955
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("tagName")),
10956
+ t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("tagName"))
10957
+ )
10958
+ )
10959
+ ),
10960
+ t20.blockStatement([
10961
+ t20.expressionStatement(t20.assignmentExpression("=", __structural, t20.booleanLiteral(true))),
10962
+ t20.breakStatement()
10963
+ ])
10964
+ )
10965
+ ])
10966
+ )
10967
+ ])
10968
+ )
10969
+ ];
10970
+ const patchNodeCall = t20.callExpression(
10971
+ t20.memberExpression(
10972
+ t20.memberExpression(t20.thisExpression(), t20.identifier("constructor")),
10973
+ t20.identifier("GEA_PATCH_NODE"),
10974
+ true
10975
+ ),
10976
+ [t20.memberExpression(__oc, __j, true), t20.memberExpression(__nc, __j, true), t20.booleanLiteral(true)]
10977
+ );
10978
+ const patchLoop = t20.forStatement(
10979
+ t20.variableDeclaration("var", [t20.variableDeclarator(__j, t20.numericLiteral(0))]),
10980
+ t20.binaryExpression("<", __j, t20.memberExpression(__nc, t20.identifier("length"))),
10981
+ t20.updateExpression("++", __j),
10982
+ t20.blockStatement([
10983
+ t20.ifStatement(
10984
+ t20.binaryExpression(
10985
+ "===",
10986
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
10987
+ t20.numericLiteral(3)
10567
10988
  ),
10568
- []
10989
+ t20.blockStatement([
10990
+ t20.ifStatement(
10991
+ t20.binaryExpression(
10992
+ "!==",
10993
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("textContent")),
10994
+ t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("textContent"))
10995
+ ),
10996
+ t20.expressionStatement(
10997
+ t20.assignmentExpression(
10998
+ "=",
10999
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("textContent")),
11000
+ t20.memberExpression(t20.memberExpression(__nc, __j, true), t20.identifier("textContent"))
11001
+ )
11002
+ )
11003
+ )
11004
+ ]),
11005
+ t20.ifStatement(
11006
+ t20.binaryExpression(
11007
+ "===",
11008
+ t20.memberExpression(t20.memberExpression(__oc, __j, true), t20.identifier("nodeType")),
11009
+ t20.numericLiteral(1)
11010
+ ),
11011
+ t20.expressionStatement(patchNodeCall)
11012
+ )
11013
+ )
11014
+ ])
11015
+ );
11016
+ const fallbackBlock = t20.blockStatement([
11017
+ assignStmt,
11018
+ t20.expressionStatement(t20.callExpression(buildThisGeaMember("GEA_INSTANTIATE_CHILD_COMPONENTS"), [])),
11019
+ t20.ifStatement(
11020
+ buildThisGeaMember("GEA_PARENT_COMPONENT"),
11021
+ t20.expressionStatement(
11022
+ t20.callExpression(
11023
+ buildExprGeaMember(
11024
+ buildThisGeaMember("GEA_PARENT_COMPONENT"),
11025
+ "GEA_MOUNT_COMPILED_CHILD_COMPONENTS"
11026
+ ),
11027
+ []
11028
+ )
10569
11029
  )
10570
11030
  )
10571
- )
10572
- ]) : assignStmt;
11031
+ ]);
11032
+ consequent = t20.blockStatement([
11033
+ ...setupStmts,
11034
+ ...structuralDetect,
11035
+ t20.ifStatement(__structural, fallbackBlock, t20.blockStatement([patchLoop]))
11036
+ ]);
11037
+ } else {
11038
+ consequent = assignStmt;
11039
+ }
10573
11040
  updateStmt = t20.ifStatement(
10574
11041
  t20.binaryExpression(
10575
11042
  "!==",
@@ -10764,7 +11231,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
10764
11231
  t20.binaryExpression("===", valueExpr, t20.nullLiteral()),
10765
11232
  t20.binaryExpression("===", valueExpr, t20.identifier("undefined"))
10766
11233
  );
10767
- const newAttrValueExpr = isBooleanAttr ? t20.stringLiteral("") : URL_ATTRS3.has(attrName) ? t20.callExpression(t20.identifier("__sanitizeAttr"), [
11234
+ const newAttrValueExpr = isBooleanAttr ? t20.stringLiteral("") : URL_ATTRS3.has(attrName) ? t20.callExpression(t20.identifier("geaSanitizeAttr"), [
10768
11235
  t20.stringLiteral(attrName),
10769
11236
  t20.callExpression(t20.identifier("String"), [valueExpr])
10770
11237
  ]) : t20.callExpression(t20.identifier("String"), [valueExpr]);
@@ -10970,8 +11437,35 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
10970
11437
  const parsed = JSON.parse(entry.observeKey);
10971
11438
  const storeVarName = parsed.storeVar || void 0;
10972
11439
  const methodNameStr = getObserveMethodName(propPath, storeVarName);
10973
- const prevProp = `__geaPrev_guard_${methodNameStr}`;
10974
- const rerenderMethod = jsMethod8`${id11(methodNameStr)}(__v, __c) { if (!__v === !this.${id11(prevProp)}) return; this.${id11(prevProp)} = __v; this.__geaRequestRender(); }`;
11440
+ const prevGuardMem = t20.memberExpression(
11441
+ t20.thisExpression(),
11442
+ t20.callExpression(t20.identifier("geaPrevGuardSymbol"), [t20.stringLiteral(methodNameStr)]),
11443
+ true
11444
+ );
11445
+ const rerenderMethod = t20.classMethod(
11446
+ "method",
11447
+ t20.identifier(methodNameStr),
11448
+ [t20.identifier("__v"), t20.identifier("__c")],
11449
+ t20.blockStatement([
11450
+ // Skip only when we've seen a prior value and truthiness is unchanged.
11451
+ // If prev is undefined and __v is false, !__v and !prev are both true — without this
11452
+ // guard the first delivery after mount would skip rerender (auth early-return repro).
11453
+ t20.ifStatement(
11454
+ t20.logicalExpression(
11455
+ "&&",
11456
+ t20.binaryExpression("!==", prevGuardMem, t20.identifier("undefined")),
11457
+ t20.binaryExpression(
11458
+ "===",
11459
+ t20.unaryExpression("!", t20.identifier("__v")),
11460
+ t20.unaryExpression("!", prevGuardMem)
11461
+ )
11462
+ ),
11463
+ t20.returnStatement()
11464
+ ),
11465
+ t20.expressionStatement(t20.assignmentExpression("=", prevGuardMem, t20.identifier("__v"))),
11466
+ t20.expressionStatement(buildThisGeaCall("GEA_REQUEST_RENDER"))
11467
+ ])
11468
+ );
10975
11469
  mergeObserveMethod(entry.observeKey, rerenderMethod);
10976
11470
  if (!stateProps.has(entry.observeKey)) {
10977
11471
  stateProps.set(entry.observeKey, entry.pathParts);
@@ -11036,9 +11530,11 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11036
11530
  usesTargetComponent: true
11037
11531
  }));
11038
11532
  if (delegatedEvents.length > 0) {
11039
- appendCompiledEventMethods(classPath.node.body, delegatedEvents);
11533
+ appendCompiledEventMethods(classPath.node.body, delegatedEvents, [], ast);
11040
11534
  }
11041
11535
  }
11536
+ ensureImport(ast, "@geajs/core", "geaListItemsSymbol");
11537
+ insertStmtBeforeClass(classPath, arrayResult.symbolConstDecl);
11042
11538
  inlineIntoConstructor(classPath.node.body, [
11043
11539
  ...arrayResult.arrSetupStatements.map((s) => t20.cloneNode(s, true)),
11044
11540
  arrayResult.constructorInit
@@ -11051,7 +11547,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11051
11547
  componentTag: arrayResult.componentTag,
11052
11548
  containerBindingId: arrayResult.containerBindingId,
11053
11549
  containerUserIdExpr: arrayResult.containerUserIdExpr,
11054
- itemIdProperty: arrayResult.itemIdProperty
11550
+ itemIdProperty: arrayResult.itemIdProperty,
11551
+ afterCondSlotIndex: um.afterCondSlotIndex
11055
11552
  });
11056
11553
  } else {
11057
11554
  const computedDeps = (um.dependencies || collectUnresolvedDependencies([um], stateRefs, classPath.node.body)).filter((dep) => dep.storeVar || dep.pathParts[0] !== "props");
@@ -11061,9 +11558,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11061
11558
  const containerSuffix = arrayResult.containerBindingId;
11062
11559
  const containerExpr = arrayResult.containerUserIdExpr ? t20.callExpression(t20.memberExpression(t20.identifier("document"), t20.identifier("getElementById")), [
11063
11560
  t20.cloneNode(arrayResult.containerUserIdExpr, true)
11064
- ]) : containerSuffix ? t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__el")), [
11065
- t20.stringLiteral(containerSuffix)
11066
- ]) : jsExpr4`this.$(":scope")`;
11561
+ ]) : containerSuffix ? t20.callExpression(thisGea("GEA_EL"), [t20.stringLiteral(containerSuffix)]) : jsExpr4`this.$(":scope")`;
11067
11562
  const itemIdProp = arrayResult.itemIdProperty;
11068
11563
  const keyFn = itemIdProp && itemIdProp !== ITEM_IS_KEY ? t20.arrowFunctionExpression(
11069
11564
  [t20.identifier("opt")],
@@ -11091,8 +11586,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11091
11586
  t20.variableDeclaration("const", [
11092
11587
  t20.variableDeclarator(
11093
11588
  t20.identifier("__new"),
11094
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__reconcileList")), [
11095
- t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)),
11589
+ t20.callExpression(thisGea("GEA_RECONCILE_LIST"), [
11590
+ t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
11096
11591
  t20.identifier("__arr"),
11097
11592
  t20.cloneNode(containerExpr, true),
11098
11593
  t20.identifier(arrayResult.componentTag),
@@ -11111,7 +11606,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11111
11606
  t20.assignmentExpression(
11112
11607
  "=",
11113
11608
  t20.memberExpression(
11114
- t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)),
11609
+ t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
11115
11610
  t20.identifier("length")
11116
11611
  ),
11117
11612
  t20.numericLiteral(0)
@@ -11120,7 +11615,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11120
11615
  t20.expressionStatement(
11121
11616
  t20.callExpression(
11122
11617
  t20.memberExpression(
11123
- t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)),
11618
+ t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
11124
11619
  t20.identifier("push")
11125
11620
  ),
11126
11621
  [t20.spreadElement(t20.identifier("__new"))]
@@ -11307,11 +11802,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11307
11802
  t20.identifier(getObserveMethodName(dep.pathParts, dep.storeVar)),
11308
11803
  [t20.identifier("value"), t20.identifier("change")],
11309
11804
  t20.blockStatement([
11310
- t20.expressionStatement(
11311
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
11312
- t20.numericLiteral(mapIdx)
11313
- ])
11314
- )
11805
+ t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(mapIdx)]))
11315
11806
  ])
11316
11807
  )
11317
11808
  );
@@ -11370,13 +11861,13 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11370
11861
  );
11371
11862
  if (elRefFieldNames.length > 0) {
11372
11863
  const hasReset = classPath.node.body.body.some(
11373
- (m) => t20.isClassMethod(m) && t20.isIdentifier(m.key) && m.key.name === "__resetEls"
11864
+ (m) => t20.isClassMethod(m) && m.computed === true && t20.isIdentifier(m.key) && m.key.name === "GEA_RESET_ELS"
11374
11865
  );
11375
11866
  if (!hasReset) {
11376
11867
  classPath.node.body.body.push(
11377
11868
  t20.classMethod(
11378
11869
  "method",
11379
- t20.identifier("__resetEls"),
11870
+ t20.identifier("GEA_RESET_ELS"),
11380
11871
  [],
11381
11872
  t20.blockStatement(
11382
11873
  elRefFieldNames.map(
@@ -11388,7 +11879,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11388
11879
  )
11389
11880
  )
11390
11881
  )
11391
- )
11882
+ ),
11883
+ true
11392
11884
  )
11393
11885
  );
11394
11886
  applied = true;
@@ -11419,11 +11911,13 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11419
11911
  if (!dep.storeVar) continue;
11420
11912
  addCondSlotIndex(dep.observeKey, slotIndex);
11421
11913
  }
11422
- for (const htmlExpr of [slot.truthyHtmlExpr, slot.falsyHtmlExpr]) {
11423
- if (!htmlExpr) continue;
11424
- const contentDeps = collectExpressionDependencies(htmlExpr, stateRefs, slot.setupStatements);
11425
- for (const dep of contentDeps) {
11426
- addCondSlotIndex(dep.observeKey, slotIndex);
11914
+ if (!slot.hasCompiledChildren) {
11915
+ for (const htmlExpr of [slot.truthyHtmlExpr, slot.falsyHtmlExpr]) {
11916
+ if (!htmlExpr) continue;
11917
+ const contentDeps = collectExpressionDependencies(htmlExpr, stateRefs, slot.setupStatements);
11918
+ for (const dep of contentDeps) {
11919
+ addCondSlotIndex(dep.observeKey, slotIndex);
11920
+ }
11427
11921
  }
11428
11922
  }
11429
11923
  });
@@ -11433,9 +11927,10 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11433
11927
  stateProps.set(observeKey, parts);
11434
11928
  }
11435
11929
  }
11436
- const hasOnPropChange = classPath.node.body.body.some(
11437
- (member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "__onPropChange"
11438
- );
11930
+ const hasOnPropChange = classPath.node.body.body.some((member) => {
11931
+ if (!t20.isClassMethod(member) || !t20.isIdentifier(member.key)) return false;
11932
+ return member.computed && member.key.name === "GEA_ON_PROP_CHANGE";
11933
+ });
11439
11934
  const childObserveGroups = /* @__PURE__ */ new Map();
11440
11935
  compiledChildren.forEach((child) => {
11441
11936
  if (childHasNoProps(child)) return;
@@ -11849,9 +12344,9 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11849
12344
  }).map((child) => {
11850
12345
  const updateExpr = t20.expressionStatement(
11851
12346
  t20.callExpression(
11852
- t20.memberExpression(
12347
+ buildExprGeaMember(
11853
12348
  t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
11854
- t20.identifier("__geaUpdateProps")
12349
+ "GEA_UPDATE_PROPS"
11855
12350
  ),
11856
12351
  [
11857
12352
  t20.callExpression(
@@ -11891,7 +12386,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11891
12386
  unresolvedBindings.forEach(({ info, binding }) => {
11892
12387
  const deps = info.dependencies || collectUnresolvedDependencies([info], stateRefs, classPath.node.body);
11893
12388
  const mapIdx = getMapIndex(binding.arrayPathParts);
11894
- const delegateName = `__geaSyncMapDelegate_${mapIdx}`;
12389
+ const delegateName = `geaSyncMapDelegate_${mapIdx}`;
11895
12390
  const hasNonRelationalDeps = deps.some(
11896
12391
  (dep) => !(info.relationalClassBindings || []).find((rb) => rb.observeKey === dep.observeKey)
11897
12392
  );
@@ -11923,11 +12418,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11923
12418
  classPath.node.body.body.push(
11924
12419
  appendToBody5(
11925
12420
  jsMethod8`${id11(delegateName)}() {}`,
11926
- t20.expressionStatement(
11927
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
11928
- t20.numericLiteral(mapIdx)
11929
- ])
11930
- )
12421
+ t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(mapIdx)]))
11931
12422
  )
11932
12423
  );
11933
12424
  delegateEmitted = true;
@@ -11939,11 +12430,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
11939
12430
  });
11940
12431
  } else {
11941
12432
  const syncBody = t20.blockStatement([
11942
- t20.expressionStatement(
11943
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSyncMap")), [
11944
- t20.numericLiteral(mapIdx)
11945
- ])
11946
- )
12433
+ t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(mapIdx)]))
11947
12434
  ]);
11948
12435
  mergeObserveMethod(
11949
12436
  dep.observeKey,
@@ -12035,9 +12522,11 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12035
12522
  usesTargetComponent: true
12036
12523
  }));
12037
12524
  if (delegatedEvents.length > 0) {
12038
- appendCompiledEventMethods(classPath.node.body, delegatedEvents);
12525
+ appendCompiledEventMethods(classPath.node.body, delegatedEvents, [], ast);
12039
12526
  }
12040
12527
  }
12528
+ ensureImport(ast, "@geajs/core", "geaListItemsSymbol");
12529
+ insertStmtBeforeClass(classPath, arrayResult.symbolConstDecl);
12041
12530
  inlineIntoConstructor(classPath.node.body, [
12042
12531
  ...arrayResult.arrSetupStatements.map((s) => t20.cloneNode(s, true)),
12043
12532
  arrayResult.constructorInit
@@ -12050,7 +12539,8 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12050
12539
  componentTag: arrayResult.componentTag,
12051
12540
  containerBindingId: arrayResult.containerBindingId,
12052
12541
  containerUserIdExpr: arrayResult.containerUserIdExpr,
12053
- itemIdProperty: arrayResult.itemIdProperty
12542
+ itemIdProperty: arrayResult.itemIdProperty,
12543
+ afterCondSlotIndex: arrayMap.afterCondSlotIndex
12054
12544
  });
12055
12545
  }
12056
12546
  componentArrayDisposeTargets.push(getComponentArrayItemsName(arrayPropName));
@@ -12078,14 +12568,12 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12078
12568
  const depObserveKey = buildObserveKey(depPath, arrayMap.storeVar);
12079
12569
  const depMethodName = getObserveMethodName(depPath, arrayMap.storeVar);
12080
12570
  const refreshStmt = t20.expressionStatement(
12081
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__refreshList")), [
12082
- t20.stringLiteral(pathKey)
12083
- ])
12571
+ t20.callExpression(thisGea("GEA_REFRESH_LIST"), [t20.stringLiteral(pathKey)])
12084
12572
  );
12085
12573
  const existing = addedMethods.get(depObserveKey);
12086
12574
  if (existing && t20.isBlockStatement(existing.body)) {
12087
12575
  const renderedGuardIdx = existing.body.body.findIndex(
12088
- (s) => t20.isIfStatement(s) && t20.isMemberExpression(s.test) && t20.isIdentifier(s.test.property) && s.test.property.name === "rendered_"
12576
+ (s) => t20.isIfStatement(s) && t20.isMemberExpression(s.test) && s.test.computed === true && t20.isIdentifier(s.test.property) && s.test.property.name === "GEA_RENDERED"
12089
12577
  );
12090
12578
  if (renderedGuardIdx >= 0) {
12091
12579
  existing.body.body.splice(renderedGuardIdx, 0, refreshStmt);
@@ -12131,7 +12619,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12131
12619
  MemberExpression(mePath) {
12132
12620
  const resolved = resolvePath(mePath.node, stateRefs);
12133
12621
  if (!resolved?.parts?.length || !resolved.isImportedState) return;
12134
- if (resolved.parts.some((p) => p === "__raw")) return;
12622
+ if (resolved.parts.some((p) => p === "__raw" || p === "GEA_PROXY_RAW")) return;
12135
12623
  const depKey = buildObserveKey(resolved.parts, resolved.storeVar);
12136
12624
  if (!getterDepKeys.has(depKey) && !externalDeps.has(depKey)) {
12137
12625
  externalDeps.set(depKey, { parts: [...resolved.parts], storeVar: resolved.storeVar });
@@ -12142,11 +12630,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12142
12630
  const depMethodName = getObserveMethodName(dep.parts, dep.storeVar);
12143
12631
  if (!stateProps.has(depKey)) stateProps.set(depKey, dep.parts);
12144
12632
  const delegateBody = t20.blockStatement([
12145
- t20.expressionStatement(
12146
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__refreshList")), [
12147
- t20.stringLiteral(pathKey)
12148
- ])
12149
- )
12633
+ t20.expressionStatement(t20.callExpression(thisGea("GEA_REFRESH_LIST"), [t20.stringLiteral(pathKey)]))
12150
12634
  ]);
12151
12635
  const delegateMethod = t20.classMethod(
12152
12636
  "method",
@@ -12180,7 +12664,7 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12180
12664
  const strippedInTemplate = templateMethod && (analysis.conditionalSlots || []).length > 0 ? stripHtmlArrayMapJoinInTemplateMethod(templateMethod, arrayMap) : false;
12181
12665
  if (strippedInSlots || strippedInTemplate) {
12182
12666
  const currentValueExpr = arrayMap.storeVar ? buildMemberChainFromParts(t20.identifier(arrayMap.storeVar), arrayMap.arrayPathParts) : buildMemberChainFromParts(t20.thisExpression(), arrayMap.arrayPathParts);
12183
- const initialArrayName = `__geaInitial_${arrayHandlerMethodName}`;
12667
+ const initialArrayName = `geaInitial_${arrayHandlerMethodName}`;
12184
12668
  initialHtmlArrayRefreshOnMount.push(
12185
12669
  t20.variableDeclaration("const", [
12186
12670
  t20.variableDeclarator(t20.identifier(initialArrayName), currentValueExpr)
@@ -12288,17 +12772,17 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12288
12772
  }
12289
12773
  }
12290
12774
  if (renderEventHandlers.length > 0) {
12291
- applied = appendCompiledEventMethods(classPath.node.body, renderEventHandlers) || applied;
12775
+ applied = appendCompiledEventMethods(classPath.node.body, renderEventHandlers, [], ast) || applied;
12292
12776
  }
12293
12777
  if (unresolvedEventHandlers.length > 0) {
12294
- applied = appendCompiledEventMethods(classPath.node.body, unresolvedEventHandlers) || applied;
12778
+ applied = appendCompiledEventMethods(classPath.node.body, unresolvedEventHandlers, [], ast) || applied;
12295
12779
  }
12296
12780
  if (applied) {
12297
12781
  const importedStores = /* @__PURE__ */ new Map();
12298
12782
  const localObserveHandlers = /* @__PURE__ */ new Map();
12299
12783
  const ensureStoreGroup = (storeVar) => {
12300
12784
  if (!importedStores.has(storeVar)) {
12301
- const captureExpression = t20.memberExpression(t20.identifier(storeVar), t20.identifier("__store"));
12785
+ const captureExpression = buildExprGeaMember(t20.identifier(storeVar), "GEA_STORE_ROOT");
12302
12786
  importedStores.set(storeVar, {
12303
12787
  captureExpression,
12304
12788
  observeHandlers: /* @__PURE__ */ new Map()
@@ -12435,6 +12919,31 @@ function applyStaticReactivity(ast, originalAST, className, sourceFile, imports,
12435
12919
  }
12436
12920
  }
12437
12921
  } else if (parts.length === 1) {
12922
+ const selfKey = buildObserveKey(parts, sv);
12923
+ if (guardStateKeys.has(selfKey) && t20.isBlockStatement(method.body)) {
12924
+ const storePropExpr = t20.memberExpression(t20.identifier(sv), t20.identifier(parts[0]));
12925
+ const observePrevMem = t20.memberExpression(
12926
+ t20.thisExpression(),
12927
+ t20.callExpression(t20.identifier("geaObservePrevSymbol"), [
12928
+ t20.stringLiteral(getObserveMethodName(parts, sv))
12929
+ ]),
12930
+ true
12931
+ );
12932
+ const guardBlock = t20.ifStatement(
12933
+ t20.binaryExpression("==", t20.cloneNode(storePropExpr), t20.nullLiteral()),
12934
+ t20.blockStatement([
12935
+ t20.expressionStatement(t20.assignmentExpression("=", observePrevMem, t20.cloneNode(storePropExpr))),
12936
+ t20.ifStatement(
12937
+ thisGea("GEA_RENDERED"),
12938
+ t20.blockStatement([
12939
+ t20.expressionStatement(t20.callExpression(thisGea("GEA_REQUEST_RENDER"), []))
12940
+ ])
12941
+ ),
12942
+ t20.returnStatement()
12943
+ ])
12944
+ );
12945
+ method.body.body.unshift(guardBlock);
12946
+ }
12438
12947
  const storeRef = stateRefs.get(sv);
12439
12948
  if (storeRef?.getterDeps) {
12440
12949
  for (const [getterName, depPaths] of storeRef.getterDeps) {
@@ -12718,7 +13227,7 @@ function generateUnresolvedRelationalObserver(arrayMap, unresolvedMap, relBindin
12718
13227
  )
12719
13228
  ]);
12720
13229
  const commonPreamble = [
12721
- js6`if (!this.rendered_) return;`,
13230
+ t20.ifStatement(t20.unaryExpression("!", thisGea("GEA_RENDERED")), t20.blockStatement([t20.returnStatement()])),
12722
13231
  lazyInit2(containerName, containerLookup),
12723
13232
  ...jsBlockBody4`if (!${containerRef}) return;`,
12724
13233
  ...setupStatements,
@@ -12842,9 +13351,7 @@ function generateMapRegistration(arrayMap, unresolvedMap, templatePropNames, who
12842
13351
  } else if (arrayMap.itemIdProperty && arrayMap.itemIdProperty !== ITEM_IS_KEY) {
12843
13352
  registerArgs.push(t20.stringLiteral(arrayMap.itemIdProperty));
12844
13353
  }
12845
- return t20.expressionStatement(
12846
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaRegisterMap")), registerArgs)
12847
- );
13354
+ return t20.expressionStatement(t20.callExpression(thisGea("GEA_REGISTER_MAP"), registerArgs));
12848
13355
  }
12849
13356
  function collectFreeIdentifiers(nodes) {
12850
13357
  const names = /* @__PURE__ */ new Set();
@@ -12939,7 +13446,10 @@ function replaceMapWithComponentArrayItems(templateMethod, arrayExpr, itemsName,
12939
13446
  toReplace = path.parentPath.parentPath;
12940
13447
  }
12941
13448
  const replacement = opts?.slotBranch ? t20.stringLiteral("") : t20.callExpression(
12942
- t20.memberExpression(t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName)), t20.identifier("join")),
13449
+ t20.memberExpression(
13450
+ t20.memberExpression(t20.thisExpression(), t20.identifier(itemsName), true),
13451
+ t20.identifier("join")
13452
+ ),
12943
13453
  [t20.stringLiteral("")]
12944
13454
  );
12945
13455
  toReplace.replaceWith(replacement);
@@ -12968,6 +13478,7 @@ function replaceMapWithComponentArrayItemsInConditionalSlots(slots, arrayExpr, i
12968
13478
  }
12969
13479
  }
12970
13480
  }
13481
+ var ctorInlineInsertOffset = /* @__PURE__ */ new WeakMap();
12971
13482
  function inlineIntoConstructor(classBody2, statements) {
12972
13483
  let ctor = classBody2.body.find(
12973
13484
  (member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "constructor"
@@ -12979,13 +13490,42 @@ function inlineIntoConstructor(classBody2, statements) {
12979
13490
  ...statements
12980
13491
  );
12981
13492
  classBody2.body.unshift(ctor);
13493
+ ctorInlineInsertOffset.set(ctor, statements.length);
12982
13494
  return;
12983
13495
  }
12984
- ctor.body.body.push(...statements);
13496
+ const body = ctor.body.body;
13497
+ const superIdx = body.findIndex(
13498
+ (stmt) => t20.isExpressionStatement(stmt) && t20.isCallExpression(stmt.expression) && t20.isSuper(stmt.expression.callee)
13499
+ );
13500
+ const base = superIdx >= 0 ? superIdx + 1 : 0;
13501
+ const prev = ctorInlineInsertOffset.get(ctor) ?? 0;
13502
+ const insertAt = base + prev;
13503
+ body.splice(insertAt, 0, ...statements);
13504
+ ctorInlineInsertOffset.set(ctor, prev + statements.length);
12985
13505
  }
12986
13506
  function ensureDisposeCalls(classBody2, targets) {
12987
13507
  const disposeStatements = targets.map(
12988
- (target) => js6`this.${id11(target)}?.forEach?.(item => item?.dispose?.());`
13508
+ (target) => t20.expressionStatement(
13509
+ t20.optionalCallExpression(
13510
+ t20.optionalMemberExpression(
13511
+ t20.memberExpression(t20.thisExpression(), t20.identifier(target), true),
13512
+ t20.identifier("forEach"),
13513
+ false,
13514
+ true
13515
+ ),
13516
+ [
13517
+ t20.arrowFunctionExpression(
13518
+ [t20.identifier("item")],
13519
+ t20.optionalCallExpression(
13520
+ t20.optionalMemberExpression(t20.identifier("item"), t20.identifier("dispose"), false, true),
13521
+ [],
13522
+ true
13523
+ )
13524
+ )
13525
+ ],
13526
+ true
13527
+ )
13528
+ )
12989
13529
  );
12990
13530
  const existingDispose = classBody2.body.find(
12991
13531
  (member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "dispose"
@@ -12999,9 +13539,10 @@ function ensureDisposeCalls(classBody2, targets) {
12999
13539
  );
13000
13540
  }
13001
13541
  function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildren, arrayRefreshDeps, conditionalSlots = [], unresolvedMapPropRefreshDeps = []) {
13002
- const existing = classBody2.body.find(
13003
- (member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "__onPropChange"
13004
- );
13542
+ const existing = classBody2.body.find((member) => {
13543
+ if (!t20.isClassMethod(member) || !t20.isIdentifier(member.key)) return false;
13544
+ return member.computed && member.key.name === "GEA_ON_PROP_CHANGE";
13545
+ });
13005
13546
  if (existing) return;
13006
13547
  const directForwardCalls = [];
13007
13548
  const nonDirectChildren = [];
@@ -13019,9 +13560,9 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
13019
13560
  guard,
13020
13561
  t20.expressionStatement(
13021
13562
  t20.callExpression(
13022
- t20.memberExpression(
13563
+ buildExprGeaMember(
13023
13564
  t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
13024
- t20.identifier("__geaUpdateProps")
13565
+ "GEA_UPDATE_PROPS"
13025
13566
  ),
13026
13567
  [t20.objectExpression([t20.objectProperty(t20.identifier("key"), t20.identifier("value"), true)])]
13027
13568
  )
@@ -13035,9 +13576,9 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
13035
13576
  t20.binaryExpression("===", t20.identifier("key"), t20.stringLiteral(m.parentPropName)),
13036
13577
  t20.expressionStatement(
13037
13578
  t20.callExpression(
13038
- t20.memberExpression(
13579
+ buildExprGeaMember(
13039
13580
  t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
13040
- t20.identifier("__geaUpdateProps")
13581
+ "GEA_UPDATE_PROPS"
13041
13582
  ),
13042
13583
  [t20.objectExpression([t20.objectProperty(t20.identifier(m.childPropName), t20.identifier("value"))])]
13043
13584
  )
@@ -13069,10 +13610,7 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
13069
13610
  const childRefreshCalls = childRefreshEntries.map(({ child, depProps }) => {
13070
13611
  const call = t20.expressionStatement(
13071
13612
  t20.callExpression(
13072
- t20.memberExpression(
13073
- t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)),
13074
- t20.identifier("__geaUpdateProps")
13075
- ),
13613
+ buildExprGeaMember(t20.memberExpression(t20.thisExpression(), t20.identifier(child.instanceVar)), "GEA_UPDATE_PROPS"),
13076
13614
  [
13077
13615
  t20.callExpression(
13078
13616
  t20.memberExpression(t20.thisExpression(), t20.identifier(`__buildProps_${child.instanceVar.replace(/^_/, "")}`)),
@@ -13107,9 +13645,7 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
13107
13645
  if (conditionalSlots.length > 0) {
13108
13646
  for (let i = 0; i < conditionalSlots.length; i++) {
13109
13647
  const slot = conditionalSlots[i];
13110
- const call = t20.expressionStatement(
13111
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaPatchCond")), [t20.numericLiteral(i)])
13112
- );
13648
+ const call = t20.expressionStatement(t20.callExpression(thisGea("GEA_PATCH_COND"), [t20.numericLiteral(i)]));
13113
13649
  if (slot.dependentPropNames.length > 0) {
13114
13650
  const guard = slot.dependentPropNames.reduce((acc, prop) => {
13115
13651
  const test = t20.binaryExpression("===", t20.identifier("key"), t20.stringLiteral(prop));
@@ -13128,11 +13664,7 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
13128
13664
  )
13129
13665
  );
13130
13666
  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
- );
13667
+ const call = t20.expressionStatement(t20.callExpression(thisGea("GEA_SYNC_MAP"), [t20.numericLiteral(dep.mapIdx)]));
13136
13668
  if (dep.propNames.length > 0) {
13137
13669
  const guard = dep.propNames.reduce((acc, prop) => {
13138
13670
  const test = t20.binaryExpression("===", t20.identifier("key"), t20.stringLiteral(prop));
@@ -13151,7 +13683,18 @@ function ensureOnPropChangeMethod(classBody2, inlinePatchBodies, compiledChildre
13151
13683
  ];
13152
13684
  if (allKeyGuarded.length === 0) return;
13153
13685
  const merged = mergeKeyGuards(allKeyGuarded);
13154
- classBody2.body.push(appendToBody5(jsMethod8`${id11("__onPropChange")}(key, value) {}`, ...merged));
13686
+ classBody2.body.push(
13687
+ appendToBody5(
13688
+ t20.classMethod(
13689
+ "method",
13690
+ t20.identifier("GEA_ON_PROP_CHANGE"),
13691
+ [t20.identifier("key"), t20.identifier("value")],
13692
+ t20.blockStatement([]),
13693
+ true
13694
+ ),
13695
+ ...merged
13696
+ )
13697
+ );
13155
13698
  }
13156
13699
  function serializeKeyGuard(test) {
13157
13700
  if (t20.isBinaryExpression(test) && test.operator === "===" && t20.isIdentifier(test.left, { name: "key" }) && t20.isStringLiteral(test.right)) {
@@ -13312,7 +13855,11 @@ function generateConditionalPatchMethods(classBody2, slots, templatePropNames, w
13312
13855
  t20.expressionStatement(
13313
13856
  t20.assignmentExpression(
13314
13857
  "=",
13315
- t20.memberExpression(t20.thisExpression(), t20.identifier(`__geaCond_${i}`)),
13858
+ t20.memberExpression(
13859
+ t20.thisExpression(),
13860
+ t20.callExpression(t20.identifier("geaCondValueSymbol"), [t20.numericLiteral(i)]),
13861
+ true
13862
+ ),
13316
13863
  t20.unaryExpression("!", t20.unaryExpression("!", rewrittenCondExprsSafe[i]))
13317
13864
  )
13318
13865
  )
@@ -13350,7 +13897,7 @@ function generateConditionalPatchMethods(classBody2, slots, templatePropNames, w
13350
13897
  };
13351
13898
  registerCondCalls.push(
13352
13899
  t20.expressionStatement(
13353
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaRegisterCond")), [
13900
+ t20.callExpression(thisGea("GEA_REGISTER_COND"), [
13354
13901
  t20.numericLiteral(i),
13355
13902
  t20.stringLiteral(slot.slotId),
13356
13903
  t20.arrowFunctionExpression([], t20.blockStatement(getCondBody)),
@@ -13538,6 +14085,8 @@ function addJoinToUnresolvedMapCalls(templateMethod, _unresolvedMaps) {
13538
14085
  const alreadyHasJoin = path.parentPath?.isMemberExpression() && t20.isIdentifier(path.parentPath.node.property) && path.parentPath.node.property.name === "join" && path.parentPath.parentPath?.isCallExpression();
13539
14086
  if (alreadyHasJoin) {
13540
14087
  const joinCall = path.parentPath.parentPath;
14088
+ const joinArg = joinCall.node.arguments[0];
14089
+ if (t20.isStringLiteral(joinArg) && joinArg.value !== "") return;
13541
14090
  const replacement = t20.binaryExpression("+", t20.cloneNode(joinCall.node, true), t20.stringLiteral("<!---->"));
13542
14091
  joinCall.replaceWith(replacement);
13543
14092
  joinCall.skip();
@@ -13668,76 +14217,85 @@ function replaceMapInConditionalSlots(slots, arrayMap) {
13668
14217
  }
13669
14218
  function generateStoreInlinePatchObserver(pathParts, storeVar, patchStatements) {
13670
14219
  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
- );
14220
+ method.body.body.push(t20.ifStatement(thisGea("GEA_RENDERED"), t20.blockStatement(patchStatements)));
13674
14221
  return method;
13675
14222
  }
13676
14223
  function generateRerenderObserver(pathParts, storeVar, truthinessOnly) {
13677
14224
  const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
13678
14225
  if (storeVar) {
13679
- const prevProp = `__geaPrev_${getObserveMethodName(pathParts, storeVar)}`;
14226
+ const observePrevMem = t20.memberExpression(
14227
+ t20.thisExpression(),
14228
+ t20.callExpression(t20.identifier("geaObservePrevSymbol"), [
14229
+ t20.stringLiteral(getObserveMethodName(pathParts, storeVar))
14230
+ ]),
14231
+ true
14232
+ );
13680
14233
  if (truthinessOnly) {
13681
14234
  method.body.body.push(
13682
- ...jsBlockBody4`
13683
- if (!value === !this.${id11(prevProp)}) return;
13684
- this.${id11(prevProp)} = value;
13685
- `
14235
+ t20.ifStatement(
14236
+ t20.logicalExpression(
14237
+ "&&",
14238
+ t20.binaryExpression("!==", observePrevMem, t20.identifier("undefined")),
14239
+ t20.binaryExpression(
14240
+ "===",
14241
+ t20.unaryExpression("!", t20.identifier("value")),
14242
+ t20.unaryExpression("!", observePrevMem)
14243
+ )
14244
+ ),
14245
+ t20.returnStatement()
14246
+ ),
14247
+ t20.expressionStatement(t20.assignmentExpression("=", observePrevMem, t20.identifier("value")))
13686
14248
  );
13687
14249
  } else {
13688
14250
  method.body.body.push(
13689
- ...jsBlockBody4`
13690
- if (value === this.${id11(prevProp)}) return;
13691
- this.${id11(prevProp)} = value;
13692
- `
14251
+ t20.ifStatement(t20.binaryExpression("===", t20.identifier("value"), observePrevMem), t20.returnStatement()),
14252
+ t20.expressionStatement(t20.assignmentExpression("=", observePrevMem, t20.identifier("value")))
13693
14253
  );
13694
14254
  }
13695
14255
  }
13696
14256
  method.body.body.push(
13697
14257
  t20.ifStatement(
13698
- t20.memberExpression(t20.thisExpression(), t20.identifier("rendered_")),
13699
- t20.blockStatement([
13700
- t20.expressionStatement(
13701
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaRequestRender")), [])
13702
- )
13703
- ])
14258
+ thisGea("GEA_RENDERED"),
14259
+ t20.blockStatement([t20.expressionStatement(t20.callExpression(thisGea("GEA_REQUEST_RENDER"), []))])
13704
14260
  )
13705
14261
  );
13706
14262
  return method;
13707
14263
  }
13708
14264
  function generateConditionalSlotObserveMethod(pathParts, storeVar, slotIndices, emitEarlyReturn = true) {
13709
14265
  const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
13710
- const anyPatchedExpr = slotIndices.map((i) => t20.memberExpression(t20.thisExpression(), t20.identifier(`__geaCondPatched_${i}`))).reduce((acc, expr) => t20.logicalExpression("||", acc, expr));
14266
+ const anyPatchedExpr = slotIndices.map(
14267
+ (i) => t20.memberExpression(
14268
+ t20.thisExpression(),
14269
+ t20.callExpression(t20.identifier("geaCondPatchedSymbol"), [t20.numericLiteral(i)]),
14270
+ true
14271
+ )
14272
+ ).reduce((acc, expr) => t20.logicalExpression("||", acc, expr));
13711
14273
  const patchStatements = [];
13712
14274
  if (slotIndices.length === 1) {
13713
14275
  patchStatements.push(t20.ifStatement(anyPatchedExpr, t20.returnStatement()));
13714
14276
  }
13715
14277
  slotIndices.forEach((slotIndex) => {
14278
+ const patchedMem = t20.memberExpression(
14279
+ t20.thisExpression(),
14280
+ t20.callExpression(t20.identifier("geaCondPatchedSymbol"), [t20.numericLiteral(slotIndex)]),
14281
+ true
14282
+ );
13716
14283
  patchStatements.push(
13717
14284
  t20.expressionStatement(
13718
14285
  t20.assignmentExpression(
13719
14286
  "=",
13720
- t20.memberExpression(t20.thisExpression(), t20.identifier(`__geaCondPatched_${slotIndex}`)),
13721
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaPatchCond")), [
13722
- t20.numericLiteral(slotIndex)
13723
- ])
14287
+ patchedMem,
14288
+ t20.callExpression(thisGea("GEA_PATCH_COND"), [t20.numericLiteral(slotIndex)])
13724
14289
  )
13725
14290
  )
13726
14291
  );
13727
14292
  patchStatements.push(
13728
14293
  t20.ifStatement(
13729
- t20.memberExpression(t20.thisExpression(), t20.identifier(`__geaCondPatched_${slotIndex}`)),
14294
+ patchedMem,
13730
14295
  t20.blockStatement([
13731
14296
  t20.expressionStatement(
13732
14297
  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
- )
14298
+ t20.arrowFunctionExpression([], t20.assignmentExpression("=", patchedMem, t20.booleanLiteral(false)))
13741
14299
  ])
13742
14300
  )
13743
14301
  ])
@@ -13747,28 +14305,22 @@ function generateConditionalSlotObserveMethod(pathParts, storeVar, slotIndices,
13747
14305
  if (emitEarlyReturn) {
13748
14306
  patchStatements.push(t20.ifStatement(anyPatchedExpr, t20.returnStatement()));
13749
14307
  }
13750
- method.body.body.push(
13751
- t20.ifStatement(t20.memberExpression(t20.thisExpression(), t20.identifier("rendered_")), t20.blockStatement(patchStatements))
13752
- );
14308
+ method.body.body.push(t20.ifStatement(thisGea("GEA_RENDERED"), t20.blockStatement(patchStatements)));
13753
14309
  return method;
13754
14310
  }
13755
14311
  function generateStateChildSwapObserver(pathParts, storeVar) {
13756
14312
  const method = jsMethod8`${id11(getObserveMethodName(pathParts, storeVar))}(value, change) {}`;
13757
14313
  method.body.body.push(
13758
14314
  t20.ifStatement(
13759
- t20.memberExpression(t20.thisExpression(), t20.identifier("rendered_")),
13760
- t20.blockStatement([
13761
- t20.expressionStatement(
13762
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSwapStateChildren")), [])
13763
- )
13764
- ])
14315
+ thisGea("GEA_RENDERED"),
14316
+ t20.blockStatement([t20.expressionStatement(t20.callExpression(thisGea("GEA_SWAP_STATE_CHILDREN"), []))])
13765
14317
  )
13766
14318
  );
13767
14319
  return method;
13768
14320
  }
13769
14321
  function generateStateChildSwapMethod(classBody2, stateChildSlots) {
13770
14322
  const existing = classBody2.body.find(
13771
- (member) => t20.isClassMethod(member) && t20.isIdentifier(member.key) && member.key.name === "__geaSwapStateChildren"
14323
+ (member) => t20.isClassMethod(member) && member.computed && t20.isIdentifier(member.key) && member.key.name === "GEA_SWAP_STATE_CHILDREN"
13772
14324
  );
13773
14325
  if (existing) return;
13774
14326
  const templateMethod = classBody2.body.find(
@@ -13791,9 +14343,9 @@ function generateStateChildSwapMethod(classBody2, stateChildSlots) {
13791
14343
  if (!hasBuildProps) return null;
13792
14344
  return t20.expressionStatement(
13793
14345
  t20.callExpression(
13794
- t20.memberExpression(
14346
+ buildExprGeaMember(
13795
14347
  t20.memberExpression(t20.thisExpression(), t20.identifier(slot.childInstanceVar)),
13796
- t20.identifier("__geaUpdateProps")
14348
+ "GEA_UPDATE_PROPS"
13797
14349
  ),
13798
14350
  [t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier(buildPropsName)), [])]
13799
14351
  )
@@ -13802,7 +14354,7 @@ function generateStateChildSwapMethod(classBody2, stateChildSlots) {
13802
14354
  const swapCalls = stateChildSlots.map((slot) => {
13803
14355
  const guardClone = t20.cloneNode(slot.guardExpr, true);
13804
14356
  return t20.expressionStatement(
13805
- t20.callExpression(t20.memberExpression(t20.thisExpression(), t20.identifier("__geaSwapChild")), [
14357
+ t20.callExpression(thisGea("GEA_SWAP_CHILD"), [
13806
14358
  t20.stringLiteral(slot.markerId),
13807
14359
  t20.logicalExpression(
13808
14360
  "&&",
@@ -13815,9 +14367,10 @@ function generateStateChildSwapMethod(classBody2, stateChildSlots) {
13815
14367
  const filteredSetup = pruneUnusedSetupDestructuring(setupStatements, [...propsUpdateCalls, ...swapCalls]);
13816
14368
  const method = t20.classMethod(
13817
14369
  "method",
13818
- t20.identifier("__geaSwapStateChildren"),
14370
+ t20.identifier("GEA_SWAP_STATE_CHILDREN"),
13819
14371
  [],
13820
- t20.blockStatement([...filteredSetup, ...propsUpdateCalls, ...swapCalls])
14372
+ t20.blockStatement([...filteredSetup, ...propsUpdateCalls, ...swapCalls]),
14373
+ true
13821
14374
  );
13822
14375
  classBody2.body.push(method);
13823
14376
  }
@@ -13849,9 +14402,6 @@ function resolveImportPath2(importer, source) {
13849
14402
  }
13850
14403
  var getterDepsCache = /* @__PURE__ */ new Map();
13851
14404
  var storeFieldsCache = /* @__PURE__ */ new Map();
13852
- function isPrivateName(name) {
13853
- return name.charCodeAt(0) === 95 || name.charCodeAt(name.length - 1) === 95;
13854
- }
13855
14405
  function extractGetterStatePaths(method) {
13856
14406
  if (!t21.isBlockStatement(method.body)) return null;
13857
14407
  const paths = /* @__PURE__ */ new Map();
@@ -13864,7 +14414,6 @@ function extractGetterStatePaths(method) {
13864
14414
  return;
13865
14415
  }
13866
14416
  const propName = node.property.name;
13867
- if (isPrivateName(propName)) return;
13868
14417
  if (!paths.has(propName)) {
13869
14418
  paths.set(propName, [propName]);
13870
14419
  }
@@ -13874,7 +14423,6 @@ function extractGetterStatePaths(method) {
13874
14423
  for (const prop of path.node.id.properties) {
13875
14424
  if (!t21.isObjectProperty(prop) || !t21.isIdentifier(prop.key)) continue;
13876
14425
  const propName = prop.key.name;
13877
- if (isPrivateName(propName)) continue;
13878
14426
  if (!paths.has(propName)) {
13879
14427
  paths.set(propName, [propName]);
13880
14428
  }
@@ -14154,7 +14702,7 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
14154
14702
  (p) => t22.isClassDeclaration(p.node)
14155
14703
  );
14156
14704
  if (earlyClassPath) {
14157
- transformed = appendCompiledEventMethods(earlyClassPath.node.body, earlyReturnCtx.eventHandlers, []) || transformed;
14705
+ transformed = appendCompiledEventMethods(earlyClassPath.node.body, earlyReturnCtx.eventHandlers, [], ast) || transformed;
14158
14706
  }
14159
14707
  }
14160
14708
  for (const info of conditionalSlotInfos) {
@@ -14185,6 +14733,7 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
14185
14733
  cloneCtxForPatches
14186
14734
  );
14187
14735
  if (cloneMembers) {
14736
+ ensureImport(ast, "@geajs/core", "GEA_CLONE_TEMPLATE");
14188
14737
  classPath.node.body.body.push(...cloneMembers);
14189
14738
  transformed = true;
14190
14739
  }
@@ -14193,17 +14742,18 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
14193
14742
  const classPath2 = path.findParent((p) => t22.isClassDeclaration(p.node));
14194
14743
  if (classPath2) {
14195
14744
  const setupStatements = returnIndex >= 0 ? body.slice(0, returnIndex) : [];
14196
- transformed = appendCompiledEventMethods(classPath2.node.body, eventHandlers, setupStatements) || transformed;
14745
+ transformed = appendCompiledEventMethods(classPath2.node.body, eventHandlers, setupStatements, ast) || transformed;
14197
14746
  }
14198
14747
  }
14199
14748
  if (refBindings.length > 0) {
14200
14749
  const classPath2 = path.findParent((p) => t22.isClassDeclaration(p.node));
14201
14750
  if (classPath2) {
14751
+ ensureImport(ast, "@geajs/core", "GEA_ELEMENT");
14202
14752
  const refStatements = refBindings.flatMap((ref) => {
14203
14753
  const target = ref.targetExpr;
14204
14754
  const q = t22.callExpression(
14205
14755
  t22.memberExpression(
14206
- t22.memberExpression(t22.thisExpression(), t22.identifier("element_")),
14756
+ t22.memberExpression(t22.thisExpression(), t22.identifier("GEA_ELEMENT"), true),
14207
14757
  t22.identifier("querySelector")
14208
14758
  ),
14209
14759
  [t22.stringLiteral(`[data-gea-ref="${ref.refId}"]`)]
@@ -14213,14 +14763,16 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
14213
14763
  t22.expressionStatement(t22.assignmentExpression("=", target, q))
14214
14764
  ];
14215
14765
  });
14216
- const existingSetup = classPath2.node.body.body.find(
14217
- (m) => t22.isClassMethod(m) && t22.isIdentifier(m.key) && m.key.name === "__setupRefs"
14218
- );
14766
+ ensureImport(ast, "@geajs/core", "GEA_SETUP_REFS");
14767
+ const existingSetup = classPath2.node.body.body.find((m) => {
14768
+ if (!t22.isClassMethod(m) || !t22.isIdentifier(m.key)) return false;
14769
+ return m.computed && m.key.name === "GEA_SETUP_REFS";
14770
+ });
14219
14771
  if (existingSetup && t22.isClassMethod(existingSetup)) {
14220
14772
  existingSetup.body.body.push(...refStatements);
14221
14773
  } else {
14222
14774
  classPath2.node.body.body.push(
14223
- t22.classMethod("method", t22.identifier("__setupRefs"), [], t22.blockStatement(refStatements))
14775
+ t22.classMethod("method", t22.identifier("GEA_SETUP_REFS"), [], t22.blockStatement(refStatements), true)
14224
14776
  );
14225
14777
  }
14226
14778
  transformed = true;
@@ -14334,14 +14886,15 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
14334
14886
  if (!t22.isClassMethod(member) || member.kind === "constructor") continue;
14335
14887
  const name = t22.isIdentifier(member.key) ? member.key.name : null;
14336
14888
  if (!name) continue;
14337
- const isCompilerGenerated = name === "template" || name === "events" && member.kind === "get" || name.startsWith("__");
14889
+ const isCompilerGenerated = name === "template" || name === "events" && member.kind === "get" || name.startsWith("__") || member.computed && name === "GEA_ON_PROP_CHANGE";
14338
14890
  if (isCompilerGenerated) {
14339
14891
  cacheThisIdInMethod(member);
14340
14892
  }
14341
14893
  if (name === "events" && member.kind === "get") {
14894
+ ensureImport(ast, "@geajs/core", "GEA_ELEMENT");
14342
14895
  wrapEventsGetterWithCache(member);
14343
14896
  }
14344
- if (name === "__onPropChange") {
14897
+ if (member.computed && name === "GEA_ON_PROP_CHANGE") {
14345
14898
  wrapSubpathCacheGuards(member, subpathPcCounter, path.node.body);
14346
14899
  }
14347
14900
  }
@@ -14349,6 +14902,9 @@ function transformComponentFile(ast, imports, storeImports, className, sourceFil
14349
14902
  }
14350
14903
  });
14351
14904
  }
14905
+ if (transformed) {
14906
+ ensureGeaCompilerSymbolImports(ast);
14907
+ }
14352
14908
  return transformed;
14353
14909
  }
14354
14910
  function transformNonComponentJSX(ast, imports) {
@@ -14476,8 +15032,8 @@ function transformRemainingJSX(ast, imports) {
14476
15032
  traverse14(ast, {
14477
15033
  noScope: true,
14478
15034
  JSXElement(path) {
14479
- const classMethod9 = path.findParent((p) => t22.isClassMethod(p.node));
14480
- if (classMethod9 && t22.isClassMethod(classMethod9.node) && t22.isIdentifier(classMethod9.node.key) && classMethod9.node.key.name === "template")
15035
+ const classMethod10 = path.findParent((p) => t22.isClassMethod(p.node));
15036
+ if (classMethod10 && t22.isClassMethod(classMethod10.node) && t22.isIdentifier(classMethod10.node.key) && classMethod10.node.key.name === "template")
14481
15037
  return;
14482
15038
  try {
14483
15039
  path.replaceWith(transformJSXToTemplate(path.node, { imports }));
@@ -14486,8 +15042,8 @@ function transformRemainingJSX(ast, imports) {
14486
15042
  }
14487
15043
  },
14488
15044
  JSXFragment(path) {
14489
- const classMethod9 = path.findParent((p) => t22.isClassMethod(p.node));
14490
- if (classMethod9 && t22.isClassMethod(classMethod9.node) && t22.isIdentifier(classMethod9.node.key) && classMethod9.node.key.name === "template")
15045
+ const classMethod10 = path.findParent((p) => t22.isClassMethod(p.node));
15046
+ if (classMethod10 && t22.isClassMethod(classMethod10.node) && t22.isIdentifier(classMethod10.node.key) && classMethod10.node.key.name === "template")
14491
15047
  return;
14492
15048
  try {
14493
15049
  path.replaceWith(transformJSXFragmentToTemplate(path.node, { imports }));
@@ -14622,8 +15178,9 @@ var RESOLVED_HMR_RUNTIME_ID = "\0" + HMR_RUNTIME_ID;
14622
15178
  var STORE_REGISTRY_ID = "virtual:gea-store-registry";
14623
15179
  var RESOLVED_STORE_REGISTRY_ID = "\0" + STORE_REGISTRY_ID;
14624
15180
  var RECONCILE_SOURCE = `
15181
+ import { GEA_DOM_ITEM } from '@geajs/core';
14625
15182
  function getKey(el) {
14626
- if (el.__geaItem) return String(el.__geaItem.id);
15183
+ if (el[GEA_DOM_ITEM]) return String(el[GEA_DOM_ITEM].id);
14627
15184
  return el.getAttribute('key');
14628
15185
  }
14629
15186
  export function reconcile(oldC, newC) {
@@ -14761,41 +15318,42 @@ export function unregisterComponentInstance(className, instance) {
14761
15318
  }
14762
15319
 
14763
15320
  function reRenderComponent(instance) {
14764
- if (!instance || !instance.element_) return;
14765
- var parent = instance.element_.parentElement;
15321
+ if (!instance || !instance[GEA_ELEMENT]) return;
15322
+ var parent = instance[GEA_ELEMENT].parentElement;
14766
15323
  if (!parent) return;
14767
- var index = Array.prototype.indexOf.call(parent.children, instance.element_);
15324
+ var index = Array.prototype.indexOf.call(parent.children, instance[GEA_ELEMENT]);
14768
15325
  var props = Object.assign({}, instance.props);
14769
15326
  var __stateSnapshot = {};
14770
15327
  var __ownKeys = Object.getOwnPropertyNames(instance);
14771
15328
  for (var __ki = 0; __ki < __ownKeys.length; __ki++) {
14772
15329
  var __k = __ownKeys[__ki];
14773
- if (__k.charAt(0) === '_' || __k === 'props' || __k === 'element_' || __k === 'rendered_' || __k === 'id') continue;
15330
+ if (__k.charAt(0) === '_' || __k === 'props' || __k === 'id') continue;
14774
15331
  var __desc = Object.getOwnPropertyDescriptor(instance, __k);
14775
15332
  if (__desc && (__desc.get || __desc.set)) continue;
14776
15333
  try { __stateSnapshot[__k] = instance[__k]; } catch(e) {}
14777
15334
  }
14778
- instance.rendered_ = false;
14779
- if (instance.cleanupBindings_) instance.cleanupBindings_();
14780
- if (instance.teardownSelfListeners_) instance.teardownSelfListeners_();
15335
+ instance[GEA_RENDERED] = false;
15336
+ if (typeof instance[GEA_CLEANUP_BINDINGS] === 'function') instance[GEA_CLEANUP_BINDINGS]();
15337
+ if (typeof instance[GEA_TEARDOWN_SELF_LISTENERS] === 'function') instance[GEA_TEARDOWN_SELF_LISTENERS]();
14781
15338
  if (instance.__cleanupCompiledDirectEvents) instance.__cleanupCompiledDirectEvents();
14782
- if (instance.__childComponents && instance.__childComponents.length) {
14783
- instance.__childComponents.forEach(function(child) { if (child && child.dispose) child.dispose(); });
14784
- instance.__childComponents = [];
15339
+ var __cc = instance[GEA_CHILD_COMPONENTS];
15340
+ if (__cc && __cc.length) {
15341
+ __cc.forEach(function(child) { if (child && child.dispose) child.dispose(); });
15342
+ instance[GEA_CHILD_COMPONENTS] = [];
14785
15343
  }
14786
- if (instance.element_ && instance.element_.parentNode) {
14787
- instance.element_.parentNode.removeChild(instance.element_);
15344
+ if (instance[GEA_ELEMENT] && instance[GEA_ELEMENT].parentNode) {
15345
+ instance[GEA_ELEMENT].parentNode.removeChild(instance[GEA_ELEMENT]);
14788
15346
  }
14789
- instance.element_ = null;
15347
+ instance[GEA_ELEMENT] = null;
14790
15348
  instance.props = props;
14791
15349
  var __restoreKeys = Object.getOwnPropertyNames(__stateSnapshot);
14792
15350
  for (var __ri = 0; __ri < __restoreKeys.length; __ri++) {
14793
15351
  try { instance[__restoreKeys[__ri]] = __stateSnapshot[__restoreKeys[__ri]]; } catch(e) {}
14794
15352
  }
14795
- if (!instance.__bindings) instance.__bindings = [];
15353
+ if (!instance[GEA_BINDINGS]) instance[GEA_BINDINGS] = [];
14796
15354
  if (!instance.__bindingRemovers) instance.__bindingRemovers = [];
14797
- if (!instance.__selfListeners) instance.__selfListeners = [];
14798
- if (!instance.__childComponents) instance.__childComponents = [];
15355
+ if (!instance[GEA_SELF_LISTENERS]) instance[GEA_SELF_LISTENERS] = [];
15356
+ if (!instance[GEA_CHILD_COMPONENTS]) instance[GEA_CHILD_COMPONENTS] = [];
14799
15357
  instance.render(parent, index);
14800
15358
  if (typeof instance.createdHooks === 'function') {
14801
15359
  instance.createdHooks(instance.props);
@@ -15084,7 +15642,13 @@ ${entries.join(",\n")}
15084
15642
  noScope: true,
15085
15643
  ClassDeclaration(path) {
15086
15644
  if (!path.node.id || path.node.id.name !== cn) return;
15087
- const prop = t24.classProperty(t24.identifier("__geaTagName"), t24.stringLiteral(kebab));
15645
+ const prop = t24.classProperty(
15646
+ t24.identifier("GEA_CTOR_TAG_NAME"),
15647
+ t24.stringLiteral(kebab),
15648
+ void 0,
15649
+ void 0,
15650
+ true
15651
+ );
15088
15652
  prop.static = true;
15089
15653
  path.node.body.body.unshift(prop);
15090
15654
  path.stop();
@@ -15092,6 +15656,7 @@ ${entries.join(",\n")}
15092
15656
  });
15093
15657
  transformed = true;
15094
15658
  }
15659
+ ensureImport(ast, "@geajs/core", "GEA_CTOR_TAG_NAME");
15095
15660
  } else {
15096
15661
  transformed = transformNonComponentJSX(ast, imports);
15097
15662
  }
@@ -15117,8 +15682,8 @@ ${entries.join(",\n")}
15117
15682
  if (hmrAdded) transformed = true;
15118
15683
  }
15119
15684
  if (!transformed) return null;
15120
- ensureImport(ast, "@geajs/core", "__escapeHtml");
15121
- ensureImport(ast, "@geajs/core", "__sanitizeAttr");
15685
+ ensureImport(ast, "@geajs/core", "geaEscapeHtml");
15686
+ ensureImport(ast, "@geajs/core", "geaSanitizeAttr");
15122
15687
  const output = generate4(ast, { sourceMaps: true, sourceFileName: cleanId }, code);
15123
15688
  return { code: output.code, map: output.map };
15124
15689
  } catch (error) {