@jay-framework/compiler-jay-html 0.6.2 → 0.6.4

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 +14 -11
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -4062,6 +4062,7 @@ class Variables {
4062
4062
  __publicField(this, "currentType");
4063
4063
  __publicField(this, "currentContext");
4064
4064
  __publicField(this, "parent");
4065
+ __publicField(this, "children", {});
4065
4066
  __publicField(this, "depth");
4066
4067
  this.currentVar = depth === 0 ? "vs" : "vs" + depth;
4067
4068
  this.currentContext = depth === 0 ? "context" : "cx" + depth;
@@ -4086,8 +4087,16 @@ class Variables {
4086
4087
  });
4087
4088
  return new Accessor(this.currentVar, accessor, validations, curr);
4088
4089
  }
4089
- childVariableFor(resolvedForEachType) {
4090
- return new Variables(resolvedForEachType, this, this.depth + 1);
4090
+ childVariableFor(accessor) {
4091
+ const path2 = accessor.terms.join(".");
4092
+ if (this.children[path2])
4093
+ return this.children[path2];
4094
+ else {
4095
+ const resolvedForEachType = accessor.resolvedType.itemType;
4096
+ const variables = new Variables(resolvedForEachType, this, this.depth + 1);
4097
+ this.children[path2] = variables;
4098
+ return variables;
4099
+ }
4091
4100
  }
4092
4101
  }
4093
4102
  function doParse(expression, startRule, vars) {
@@ -5077,9 +5086,7 @@ ${indent.curr}return ${childElement.rendered}}, '${trackBy}')`,
5077
5086
  const paramName = forEachAccessor.rootVar;
5078
5087
  const paramType = variables.currentType.name;
5079
5088
  const forEachFragment = forEachAccessor.render().map((_) => `(${paramName}: ${paramType}) => ${_}`);
5080
- let forEachVariables = variables.childVariableFor(
5081
- forEachAccessor.resolvedType.itemType
5082
- );
5089
+ let forEachVariables = variables.childVariableFor(forEachAccessor);
5083
5090
  let newContext = {
5084
5091
  ...context,
5085
5092
  variables: forEachVariables,
@@ -5262,9 +5269,7 @@ ${indent.firstLine}])`,
5262
5269
  const paramName = forEachAccessor.rootVar;
5263
5270
  const paramType = variables.currentType.name;
5264
5271
  const forEachFragment = forEachAccessor.render().map((_) => `(${paramName}: ${paramType}) => ${_}`);
5265
- let forEachVariables = variables.childVariableFor(
5266
- forEachAccessor.resolvedType.itemType
5267
- );
5272
+ let forEachVariables = variables.childVariableFor(forEachAccessor);
5268
5273
  let childElement = renderHtmlElement(htmlElement, {
5269
5274
  ...context,
5270
5275
  variables: forEachVariables,
@@ -5709,9 +5714,7 @@ ${newContext.indent.firstLine}` : children
5709
5714
  return new compilerShared.RenderFragment("", compilerShared.Imports.none(), [
5710
5715
  `forEach directive - failed to resolve type for forEach=${forEach}`
5711
5716
  ]);
5712
- let forEachVariables = variables.childVariableFor(
5713
- forEachAccessor.resolvedType.itemType
5714
- );
5717
+ let forEachVariables = variables.childVariableFor(forEachAccessor);
5715
5718
  let newContext = {
5716
5719
  ...renderContext,
5717
5720
  variables: forEachVariables,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-jay-html",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "author": "",
29
29
  "dependencies": {
30
- "@jay-framework/compiler-analyze-exported-types": "^0.6.2",
31
- "@jay-framework/compiler-shared": "^0.6.2",
32
- "@jay-framework/component": "^0.6.2",
33
- "@jay-framework/runtime": "^0.6.2",
34
- "@jay-framework/secure": "^0.6.2",
30
+ "@jay-framework/compiler-analyze-exported-types": "^0.6.4",
31
+ "@jay-framework/compiler-shared": "^0.6.4",
32
+ "@jay-framework/component": "^0.6.4",
33
+ "@jay-framework/runtime": "^0.6.4",
34
+ "@jay-framework/secure": "^0.6.4",
35
35
  "@types/js-yaml": "^4.0.9",
36
36
  "change-case": "^4.1.2",
37
37
  "js-yaml": "^4.1.0",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@caiogondim/strip-margin": "^1.0.0",
46
- "@jay-framework/4-react": "^0.6.2",
47
- "@jay-framework/dev-environment": "^0.6.2",
46
+ "@jay-framework/4-react": "^0.6.4",
47
+ "@jay-framework/dev-environment": "^0.6.4",
48
48
  "@testing-library/jest-dom": "^6.2.0",
49
49
  "@types/js-beautify": "^1",
50
50
  "@types/node": "^20.11.5",