@jay-framework/compiler-jay-html 0.17.4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -270,7 +270,7 @@ declare function assignCoordinatesToJayHtml(jayHtml: string, headlessContractNam
270
270
  /**
271
271
  * Assign `jay-coordinate-base` and `jay-scope` attributes to elements in the DOM tree.
272
272
  *
273
- * Must run after slow-render (which resolves slow conditions, unrolls slowForEach,
273
+ * Must run after slow-render (which resolves slow conditions
274
274
  * and wraps multi-child headless inline templates).
275
275
  *
276
276
  * Mutates the DOM in place. Returns the serialized DOM for debug output.
package/dist/index.js CHANGED
@@ -5891,18 +5891,6 @@ function walkChildren(parent, parentCoord, scopeId, options, counter) {
5891
5891
  continue;
5892
5892
  }
5893
5893
  }
5894
- const slowForEachAttr = element.getAttribute("slowForEach");
5895
- if (slowForEachAttr) {
5896
- const jayTrackBy = element.getAttribute("jayTrackBy");
5897
- if (jayTrackBy) {
5898
- const itemScopeId = nextScopeId(counter);
5899
- element.setAttribute(SCOPE_ATTR, itemScopeId);
5900
- const itemCoord = `${itemScopeId}/0`;
5901
- element.setAttribute(COORD_ATTR$1, itemCoord);
5902
- walkChildren(element, itemCoord, itemScopeId, options, counter);
5903
- continue;
5904
- }
5905
- }
5906
5894
  const coord = `${parentCoord}/${childCounter}`;
5907
5895
  element.setAttribute(COORD_ATTR$1, coord);
5908
5896
  childCounter++;
@@ -13446,27 +13434,6 @@ function isConditional(node2) {
13446
13434
  function isForEach(node2) {
13447
13435
  return node2.nodeType !== NodeType.TEXT_NODE && node2.hasAttribute("forEach");
13448
13436
  }
13449
- function isSlowForEach(node2) {
13450
- return node2.nodeType !== NodeType.TEXT_NODE && node2.hasAttribute("slowForEach");
13451
- }
13452
- function getSlowForEachInfo(node2) {
13453
- if (!isSlowForEach(node2))
13454
- return void 0;
13455
- const element = node2;
13456
- const arrayName = element.getAttribute("slowForEach");
13457
- const jayIndex = element.getAttribute("jayIndex");
13458
- const jayTrackBy = element.getAttribute("jayTrackBy");
13459
- const trackBy = element.getAttribute("trackBy") || "id";
13460
- if (!arrayName || jayIndex === null || !jayTrackBy) {
13461
- return void 0;
13462
- }
13463
- return {
13464
- arrayName,
13465
- jayIndex: parseInt(jayIndex, 10),
13466
- jayTrackBy,
13467
- trackBy
13468
- };
13469
- }
13470
13437
  function isRecurse(node2) {
13471
13438
  return node2.nodeType !== NodeType.TEXT_NODE && node2.rawTagName?.toLowerCase() === "recurse";
13472
13439
  }
@@ -14451,9 +14418,7 @@ const DIRECTIVE_ATTRIBUTES = /* @__PURE__ */ new Set([
14451
14418
  "foreach",
14452
14419
  "trackby",
14453
14420
  "ref",
14454
- "slowforeach",
14455
- "jayindex",
14456
- "jaytrackby",
14421
+ "slow",
14457
14422
  "jay-coordinate-base",
14458
14423
  "jay-scope",
14459
14424
  AsyncDirectiveTypes.loading.directive,
@@ -14481,18 +14446,6 @@ function validateForEachAccessor(forEach, variables) {
14481
14446
  ]);
14482
14447
  return { accessor, childVariables: variables.childVariableFor(accessor) };
14483
14448
  }
14484
- function validateSlowForEachAccessor(arrayName, variables) {
14485
- const accessor = parseAccessor(arrayName, variables);
14486
- if (accessor.resolvedType === JayUnknown)
14487
- return new RenderFragment("", Imports.none(), [
14488
- `slowForEach directive - failed to resolve array type [slowForEach=${arrayName}]`
14489
- ]);
14490
- if (!isArrayType$1(accessor.resolvedType))
14491
- return new RenderFragment("", Imports.none(), [
14492
- `slowForEach directive - resolved type is not an array [slowForEach=${arrayName}]`
14493
- ]);
14494
- return { accessor, childVariables: variables.childVariableFor(accessor) };
14495
- }
14496
14449
  function validateAsyncAccessor(property, directive, variables) {
14497
14450
  const accessor = parseAccessor(property, variables);
14498
14451
  if (accessor.resolvedType === JayUnknown)
@@ -14717,7 +14670,6 @@ function renderBridge(types2, rootBodyElement, importStatements, elementType, pr
14717
14670
  headlessInstanceDefs: [],
14718
14671
  // Not used for bridge
14719
14672
  headlessInstanceCounter: { count: 0 },
14720
- coordinatePrefix: [],
14721
14673
  coordinateCounters: /* @__PURE__ */ new Map()
14722
14674
  });
14723
14675
  renderedBridge = optimizeRefs(renderedBridge, headlessImports);
@@ -14765,7 +14717,6 @@ function renderSandboxRoot(types2, rootBodyElement, importStatements, headlessIm
14765
14717
  headlessInstanceDefs: [],
14766
14718
  // Not used for sandbox
14767
14719
  headlessInstanceCounter: { count: 0 },
14768
- coordinatePrefix: [],
14769
14720
  coordinateCounters: /* @__PURE__ */ new Map()
14770
14721
  });
14771
14722
  let refsPart = renderedBridge.rendered.length > 0 ? `
@@ -19666,7 +19617,6 @@ function buildRenderContext(context) {
19666
19617
  headlessInstanceDefs: context.headlessInstanceDefs,
19667
19618
  headlessInstanceCounter: context.headlessInstanceCounter,
19668
19619
  // Element target still uses its own coordinate logic (DL#103: out of scope)
19669
- coordinatePrefix: [],
19670
19620
  coordinateCounters: /* @__PURE__ */ new Map()
19671
19621
  };
19672
19622
  }
@@ -19721,7 +19671,7 @@ function renderHydrateElement(element, context) {
19721
19671
  );
19722
19672
  const createAttributes = renderAttributes$1(element, createRenderContext);
19723
19673
  const needDynamicElement = createChildNodes.some(
19724
- (_) => _.nodeType === NodeType.ELEMENT_NODE && (isConditional(_) || isForEach(_) || isSlowForEach(_) || checkAsync(_).isAsync)
19674
+ (_) => _.nodeType === NodeType.ELEMENT_NODE && (isConditional(_) || isForEach(_) || checkAsync(_).isAsync)
19725
19675
  );
19726
19676
  const createElementFunc = needDynamicElement ? "de" : "e";
19727
19677
  const createElementImport = needDynamicElement ? Import.dynamicElement : Import.element;
@@ -19740,6 +19690,33 @@ ${context.indent.firstLine} ${createBody})`,
19740
19690
  childContent.refs
19741
19691
  );
19742
19692
  }
19693
+ if (isConditional(element) && context.interactivePaths.size > 0) {
19694
+ const condition = element.getAttribute("if");
19695
+ const viewStateVars = new Variables(
19696
+ context.variables.currentType,
19697
+ void 0,
19698
+ 0,
19699
+ "viewState"
19700
+ );
19701
+ const renderedCondition = parseServerCondition(condition, viewStateVars);
19702
+ const coordinate = element.getAttribute(COORD_ATTR) || "0";
19703
+ const childContent = renderHydrateElementContent(
19704
+ element,
19705
+ context,
19706
+ renderContext,
19707
+ coordinate,
19708
+ true
19709
+ );
19710
+ const adoption = childContent.rendered.trim();
19711
+ if (adoption) {
19712
+ return new RenderFragment(
19713
+ `${context.indent.firstLine}...(${renderedCondition.rendered} ? [${adoption}] : [])`,
19714
+ childContent.imports.plus(Import.adoptElement),
19715
+ [...renderedCondition.validations, ...childContent.validations],
19716
+ childContent.refs
19717
+ );
19718
+ }
19719
+ }
19743
19720
  if (isForEach(element)) {
19744
19721
  const { variables, indent } = context;
19745
19722
  const forEach = element.getAttribute("forEach");
@@ -19874,7 +19851,7 @@ ${indent.firstLine} ]` : "() => []";
19874
19851
  );
19875
19852
  const createAttributes = renderAttributes$1(element, createRenderContext);
19876
19853
  const forEachNeedsDynamic = createChildNodes.some(
19877
- (_) => _.nodeType === NodeType.ELEMENT_NODE && (isConditional(_) || isForEach(_) || isSlowForEach(_) || checkAsync(_).isAsync)
19854
+ (_) => _.nodeType === NodeType.ELEMENT_NODE && (isConditional(_) || isForEach(_) || checkAsync(_).isAsync)
19878
19855
  );
19879
19856
  const forEachElementFunc = forEachNeedsDynamic ? "de" : "e";
19880
19857
  const forEachElementImport = forEachNeedsDynamic ? Import.dynamicElement : Import.element;
@@ -19903,98 +19880,6 @@ ${indent.firstLine})`,
19903
19880
  );
19904
19881
  return nestRefs(forEachAccessor.terms, hydrateForEachFragment);
19905
19882
  }
19906
- if (isSlowForEach(element)) {
19907
- const slowForEachInfo = getSlowForEachInfo(element);
19908
- if (!slowForEachInfo) {
19909
- return new RenderFragment("", Imports.none(), [
19910
- `slowForEach element is missing required attributes (slowForEach, jayIndex, jayTrackBy)`
19911
- ]);
19912
- }
19913
- const { arrayName, jayIndex, jayTrackBy } = slowForEachInfo;
19914
- const { variables, indent } = context;
19915
- const slowValidated = validateSlowForEachAccessor(arrayName, variables);
19916
- if (isValidationError(slowValidated))
19917
- return slowValidated;
19918
- const { accessor: arrayAccessor, childVariables: slowForEachVariables } = slowValidated;
19919
- const parentTypeName = variables.currentType.name;
19920
- const itemTypeName = slowForEachVariables.currentType.name;
19921
- const paramName = arrayAccessor.rootVar;
19922
- const getItemsFragment = arrayAccessor.render().map((_) => `(${paramName}: ${parentTypeName}) => ${_}`);
19923
- const itemContext = {
19924
- ...context,
19925
- variables: slowForEachVariables,
19926
- indent: indent.child().child(),
19927
- dynamicRef: true,
19928
- insideSlowForEach: true
19929
- };
19930
- const itemChildNodes = filterContentNodes(element.childNodes);
19931
- const childFragments = itemChildNodes.map((child) => renderHydrateNode(child, itemContext));
19932
- const nonEmptyChildren = childFragments.filter((f) => f.rendered.trim());
19933
- if (nonEmptyChildren.length === 0) {
19934
- return RenderFragment.empty();
19935
- }
19936
- let callbackBody;
19937
- let callbackImports = Imports.none();
19938
- let callbackValidations = [];
19939
- let callbackRefs;
19940
- if (nonEmptyChildren.length === 1) {
19941
- callbackBody = nonEmptyChildren[0].rendered.trim();
19942
- callbackImports = nonEmptyChildren[0].imports;
19943
- callbackValidations = [...nonEmptyChildren[0].validations];
19944
- callbackRefs = nonEmptyChildren[0].refs;
19945
- } else {
19946
- const hasDynamicGroups = itemChildNodes.some(
19947
- (child) => child.nodeType === NodeType.ELEMENT_NODE && (isConditional(child) && conditionIsInteractive(
19948
- child.getAttribute("if"),
19949
- itemContext.interactivePaths
19950
- ) || isForEach(child) || isSlowForEach(child))
19951
- );
19952
- if (hasDynamicGroups) {
19953
- const childParts = [];
19954
- for (let i = 0; i < childFragments.length; i++) {
19955
- const frag = childFragments[i];
19956
- if (frag.rendered.trim()) {
19957
- childParts.push(frag.rendered);
19958
- callbackImports = callbackImports.plus(frag.imports);
19959
- callbackValidations.push(...frag.validations);
19960
- if (frag.refs)
19961
- callbackRefs = callbackRefs ? mergeRefsTrees(callbackRefs, frag.refs) : frag.refs;
19962
- } else if (itemChildNodes[i].nodeType === NodeType.ELEMENT_NODE) {
19963
- childParts.push(`${indent.firstLine} STATIC`);
19964
- callbackImports = callbackImports.plus(Import.STATIC);
19965
- }
19966
- }
19967
- const childrenArr = childParts.join(",\n");
19968
- const itemCoord = element.getAttribute(COORD_ATTR) || "";
19969
- callbackBody = `adoptDynamicElement('${itemCoord}', {}, [
19970
- ${childrenArr},
19971
- ${indent.firstLine} ])`;
19972
- callbackImports = callbackImports.plus(Import.adoptDynamicElement);
19973
- } else {
19974
- const itemCoord = element.getAttribute(COORD_ATTR) || "";
19975
- const childrenArr = nonEmptyChildren.map((f) => f.rendered).join(",\n");
19976
- callbackBody = `adoptElement('${itemCoord}', {}, [
19977
- ${childrenArr},
19978
- ${indent.firstLine} ])`;
19979
- for (const f of nonEmptyChildren) {
19980
- callbackImports = callbackImports.plus(f.imports);
19981
- callbackValidations.push(...f.validations);
19982
- if (f.refs)
19983
- callbackRefs = callbackRefs ? mergeRefsTrees(callbackRefs, f.refs) : f.refs;
19984
- }
19985
- callbackImports = callbackImports.plus(Import.adoptElement);
19986
- }
19987
- }
19988
- const slowForEachFragment = new RenderFragment(
19989
- `${indent.firstLine}slowForEachItem<${parentTypeName}, ${itemTypeName}>(${getItemsFragment.rendered}, ${jayIndex}, '${jayTrackBy}',
19990
- ${indent.firstLine}() => ${callbackBody}
19991
- ${indent.firstLine})`,
19992
- Imports.for(Import.slowForEachItem).plus(getItemsFragment.imports).plus(callbackImports),
19993
- [...getItemsFragment.validations, ...callbackValidations],
19994
- callbackRefs
19995
- );
19996
- return nestRefs(arrayName.split("."), slowForEachFragment);
19997
- }
19998
19883
  if (checkAsync(element).isAsync) {
19999
19884
  return RenderFragment.empty();
20000
19885
  }
@@ -20154,7 +20039,6 @@ ${adoptInlineBody.rendered}
20154
20039
  // inside headfull FS component templates can be detected (DL#123)
20155
20040
  headlessContractNames: renderContext.headlessContractNames,
20156
20041
  headlessImports: renderContext.headlessImports,
20157
- coordinatePrefix: [],
20158
20042
  coordinateCounters: /* @__PURE__ */ new Map()
20159
20043
  };
20160
20044
  const createRenderedChildren = childNodes.map((_) => renderNode(_, createRenderContext)).reduce(
@@ -20505,7 +20389,6 @@ function renderHydrate(types2, body, importStatements, elementType, preRenderTyp
20505
20389
  headlessInstanceDefs: [],
20506
20390
  headlessInstanceCounter: { count: 0 },
20507
20391
  insideFastForEach: false,
20508
- insideSlowForEach: false,
20509
20392
  interactivePaths: buildInteractivePaths(contract)
20510
20393
  };
20511
20394
  const rootElement = ensureSingleChildElement(body);
@@ -20896,7 +20779,7 @@ function renderNode(node2, context) {
20896
20779
  if (childNodes.length === 1 && childNodes[0].nodeType === NodeType.TEXT_NODE)
20897
20780
  childIndent = childIndent.noFirstLineBreak();
20898
20781
  let needDynamicElement = childNodes.map(
20899
- (_) => isConditional(_) || isForEach(_) || isSlowForEach(_) || isRecurseWithData(_) || isWithData(_) || checkAsync(_).isAsync
20782
+ (_) => isConditional(_) || isForEach(_) || isRecurseWithData(_) || isWithData(_) || checkAsync(_).isAsync
20900
20783
  ).reduce((prev, current) => prev || current, false);
20901
20784
  let childRenders = childNodes.length === 0 ? RenderFragment.empty() : childNodes.map((_) => renderNode(_, contextForChildren)).reduce(
20902
20785
  (prev, current) => RenderFragment.merge(prev, current, ",\n"),
@@ -21073,7 +20956,7 @@ ${renderedChildren.rendered}
21073
20956
  if (explicitRef) {
21074
20957
  coordinateRef = explicitRef;
21075
20958
  } else {
21076
- const counterKey = [...newContext.coordinatePrefix, contractName].join("/");
20959
+ const counterKey = contractName;
21077
20960
  const localIndex = newContext.coordinateCounters.get(counterKey) ?? 0;
21078
20961
  newContext.coordinateCounters.set(counterKey, localIndex + 1);
21079
20962
  coordinateRef = `AR${localIndex}`;
@@ -21081,7 +20964,7 @@ ${renderedChildren.rendered}
21081
20964
  const isInsideForEach = newContext.insideFastForEach;
21082
20965
  const coordinateSuffix = `${contractName}:${coordinateRef}`;
21083
20966
  const instanceCoordBase = htmlElement.getAttribute("jay-coordinate-base");
21084
- const coordinateKey2 = isInsideForEach ? void 0 : instanceCoordBase || [...newContext.coordinatePrefix, coordinateSuffix].join("/");
20967
+ const coordinateKey2 = isInsideForEach ? void 0 : instanceCoordBase || coordinateSuffix;
21085
20968
  const renderFnCode = `
21086
20969
  // Inline template for headless component: ${contractName} #${idx}
21087
20970
  type ${elementType} = JayElement<${interactiveViewStateType}, ${refsTypeName}>;
@@ -21268,43 +21151,6 @@ const ${componentSymbol} = makeHeadlessInstanceComponent(
21268
21151
  forEachAccessPath,
21269
21152
  renderForEach(forEachFragment, forEachVariables, trackBy, childElement)
21270
21153
  );
21271
- } else if (isSlowForEach(htmlElement)) {
21272
- const slowForEachInfo = getSlowForEachInfo(htmlElement);
21273
- if (!slowForEachInfo) {
21274
- return new RenderFragment("", Imports.none(), [
21275
- `slowForEach element is missing required attributes (slowForEach, jayIndex, jayTrackBy)`
21276
- ]);
21277
- }
21278
- const { arrayName, jayIndex, jayTrackBy } = slowForEachInfo;
21279
- const slowValidated = validateSlowForEachAccessor(arrayName, variables);
21280
- if (isValidationError(slowValidated))
21281
- return slowValidated;
21282
- const { accessor: arrayAccessor, childVariables: slowForEachVariables } = slowValidated;
21283
- context.usedComponentImports.add(slowForEachVariables.currentType.name);
21284
- let newContext = {
21285
- ...context,
21286
- variables: slowForEachVariables,
21287
- indent: indent.child().noFirstLineBreak().withLastLineBreak(),
21288
- dynamicRef: true,
21289
- isInsideGuard: true,
21290
- // Mark that we're inside a guard
21291
- coordinatePrefix: [...context.coordinatePrefix, jayTrackBy]
21292
- };
21293
- let childElement = renderHtmlElement(htmlElement, newContext);
21294
- const parentTypeName = variables.currentType.name;
21295
- const itemTypeName = slowForEachVariables.currentType.name;
21296
- const paramName = arrayAccessor.rootVar;
21297
- const getItemsFragment = arrayAccessor.render().map((_) => `(${paramName}: ${parentTypeName}) => ${_}`);
21298
- const slowForEachFragment = new RenderFragment(
21299
- `${indent.firstLine}slowForEachItem<${parentTypeName}, ${itemTypeName}>(${getItemsFragment.rendered}, ${jayIndex}, '${jayTrackBy}',
21300
- ${indent.firstLine}() => ${childElement.rendered}
21301
- ${indent.firstLine})`,
21302
- childElement.imports.plus(Import.slowForEachItem).plus(getItemsFragment.imports),
21303
- [...getItemsFragment.validations, ...childElement.validations],
21304
- childElement.refs,
21305
- childElement.recursiveRegions
21306
- );
21307
- return nestRefs(arrayName.split("."), slowForEachFragment);
21308
21154
  } else if (checkAsync(htmlElement).isAsync) {
21309
21155
  const asyncDirective = checkAsync(htmlElement);
21310
21156
  const asyncProperty = htmlElement.getAttribute(asyncDirective.directive);
@@ -21443,8 +21289,6 @@ function renderFunctionImplementation$1(types2, rootBodyElement, importStatement
21443
21289
  // Accumulator for inline template definitions
21444
21290
  headlessInstanceCounter,
21445
21291
  // Counter for unique naming
21446
- coordinatePrefix: [],
21447
- // Root has empty coordinate prefix
21448
21292
  coordinateCounters: /* @__PURE__ */ new Map()
21449
21293
  // Scope-level counter for unique coordinates
21450
21294
  });
@@ -21697,6 +21541,9 @@ function generateElementBridgeFile(jayFile) {
21697
21541
  }
21698
21542
  function generateElementHydrateFile(jayFile, importerMode) {
21699
21543
  const types2 = generateTypes(jayFile.types);
21544
+ const headlessImports = jayFile.headlessImports?.filter((h) => !h.key) ?? [];
21545
+ const headlessContractNames = new Set(headlessImports.map((h) => h.contractName));
21546
+ assignCoordinates(jayFile.body, { headlessContractNames });
21700
21547
  const {
21701
21548
  renderedRefs,
21702
21549
  renderedElement,
@@ -22422,48 +22269,6 @@ ${indent.firstLine}}`,
22422
22269
  itemBody.validations
22423
22270
  );
22424
22271
  }
22425
- if (isSlowForEach(element)) {
22426
- const slowForEachInfo = getSlowForEachInfo(element);
22427
- if (slowForEachInfo) {
22428
- const { arrayName, jayIndex } = slowForEachInfo;
22429
- const slowValidated = validateSlowForEachAccessor(arrayName, variables);
22430
- if (isValidationError(slowValidated))
22431
- return slowValidated;
22432
- const { accessor: arrayAccessor, childVariables: slowForEachVariables } = slowValidated;
22433
- const arrayExpr = arrayAccessor.render().rendered;
22434
- const itemVar = slowForEachVariables.currentVar;
22435
- const itemContext = {
22436
- ...context,
22437
- variables: slowForEachVariables,
22438
- indent,
22439
- insideSlowForEach: true
22440
- };
22441
- const childContent = renderServerElementContent(element, itemContext, {
22442
- isRoot: true
22443
- });
22444
- const needsItemVar = childContent.rendered.includes(itemVar + ".");
22445
- if (needsItemVar) {
22446
- const itemIndent = new Indent(indent.curr + " ");
22447
- const indentedContext = {
22448
- ...context,
22449
- variables: slowForEachVariables,
22450
- indent: itemIndent,
22451
- insideSlowForEach: true
22452
- };
22453
- const indentedContent = renderServerElementContent(element, indentedContext, {
22454
- isRoot: true
22455
- });
22456
- return new RenderFragment(
22457
- `${indent.firstLine}{ const ${itemVar} = ${arrayExpr}?.[${jayIndex}]; if (${itemVar}) {
22458
- ${indentedContent.rendered}
22459
- ${indent.firstLine}}}`,
22460
- indentedContent.imports,
22461
- [...arrayAccessor.validations, ...indentedContent.validations]
22462
- );
22463
- }
22464
- return childContent;
22465
- }
22466
- }
22467
22272
  return renderServerElementContent(element, context);
22468
22273
  }
22469
22274
  function renderServerHeadlessInstance(element, context, contractName) {
@@ -22901,7 +22706,7 @@ function renderServerElementContent(element, context, options) {
22901
22706
  }
22902
22707
  }
22903
22708
  const refName = element.attributes.ref ? camelCase(element.attributes.ref) : null;
22904
- const needsCoordinate = options?.isRoot === true || isConditional(element) && conditionIsInteractive(element.getAttribute("if"), context.interactivePaths) || dynamicTextFragment !== null || refName !== null || hasDynamicAttributeBindings(element, variables) || hasInteractiveChildElements(childNodes) || hasMixedContentDynamicTextInteractive(childNodes, context.interactivePaths);
22709
+ const needsCoordinate = options?.isRoot === true || isConditional(element) || dynamicTextFragment !== null || refName !== null || hasDynamicAttributeBindings(element, variables) || hasInteractiveChildElements(childNodes) || hasMixedContentDynamicTextInteractive(childNodes, context.interactivePaths);
22905
22710
  const coordTemplate = needsCoordinate ? element.getAttribute(COORD_ATTR) : null;
22906
22711
  const isVoid = voidElements.has(element.rawTagName.toLowerCase());
22907
22712
  const closeTag = isVoid ? " />" : ">";
@@ -23090,7 +22895,6 @@ function generateServerElementFile(jayFile, _options) {
23090
22895
  headlessInstanceCounter: { count: 0 },
23091
22896
  varMappings: {},
23092
22897
  insideForEach: false,
23093
- insideSlowForEach: false,
23094
22898
  interactivePaths: buildInteractivePaths(jayFile.contract)
23095
22899
  };
23096
22900
  const rendered = renderServerElementContent(rootElement.val, context, {
@@ -29998,37 +29802,6 @@ function resolveTextBindings(text2, contextData, phaseMap, contextPath = "") {
29998
29802
  return new WithValidations(resolved, validationErrors);
29999
29803
  }
30000
29804
  function transformElement(element, phaseMap, contextPath, contextData) {
30001
- const forEachAttr = element.getAttribute("forEach");
30002
- if (forEachAttr) {
30003
- const fullPath = contextPath ? `${contextPath}.${forEachAttr}` : forEachAttr;
30004
- const phaseInfo = phaseMap.get(fullPath);
30005
- if (phaseInfo?.phase === "slow") {
30006
- const arrayValue = getValueByPath(contextData, forEachAttr);
30007
- if (Array.isArray(arrayValue)) {
30008
- const trackBy = element.getAttribute("trackBy") || "id";
30009
- const itemResults = arrayValue.map((item, index) => {
30010
- const cloned = element.clone();
30011
- cloned.removeAttribute("forEach");
30012
- cloned.removeAttribute("foreach");
30013
- cloned.removeAttribute("trackBy");
30014
- cloned.removeAttribute("trackby");
30015
- cloned.setAttribute("slowForEach", forEachAttr);
30016
- cloned.setAttribute("jayIndex", String(index));
30017
- const trackByValue = item && typeof item === "object" ? String(item[trackBy] || index) : String(index);
30018
- cloned.setAttribute("jayTrackBy", trackByValue);
30019
- const itemData = item;
30020
- return transformChildren(cloned, phaseMap, fullPath, itemData).map(
30021
- (children) => {
30022
- cloned.innerHTML = "";
30023
- children.forEach((child) => cloned.appendChild(child));
30024
- return cloned;
30025
- }
30026
- );
30027
- });
30028
- return WithValidations.all(itemResults);
30029
- }
30030
- }
30031
- }
30032
29805
  const ifAttr = element.getAttribute("if");
30033
29806
  if (ifAttr) {
30034
29807
  const slowContext = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-jay-html",
3
- "version": "0.17.4",
3
+ "version": "0.18.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "author": "",
36
36
  "dependencies": {
37
- "@jay-framework/compiler-analyze-exported-types": "^0.17.4",
38
- "@jay-framework/compiler-shared": "^0.17.4",
39
- "@jay-framework/component": "^0.17.4",
40
- "@jay-framework/logger": "^0.17.4",
41
- "@jay-framework/runtime": "^0.17.4",
42
- "@jay-framework/secure": "^0.17.4",
37
+ "@jay-framework/compiler-analyze-exported-types": "^0.18.0",
38
+ "@jay-framework/compiler-shared": "^0.18.0",
39
+ "@jay-framework/component": "^0.18.0",
40
+ "@jay-framework/logger": "^0.18.0",
41
+ "@jay-framework/runtime": "^0.18.0",
42
+ "@jay-framework/secure": "^0.18.0",
43
43
  "@types/js-yaml": "^4.0.9",
44
44
  "change-case": "^4.1.2",
45
45
  "he": "^1.2.0",
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@caiogondim/strip-margin": "^1.0.0",
55
- "@jay-framework/4-react": "^0.17.4",
56
- "@jay-framework/dev-environment": "^0.17.4",
55
+ "@jay-framework/4-react": "^0.18.0",
56
+ "@jay-framework/dev-environment": "^0.18.0",
57
57
  "@testing-library/jest-dom": "^6.2.0",
58
58
  "@types/js-beautify": "^1",
59
59
  "@types/node": "^20.11.5",