tutuca 0.9.23 → 0.9.25

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.
@@ -1053,7 +1053,7 @@ class ANode extends BaseNode {
1053
1053
  return px.frame.macroSlots[slotName] ?? maybeFragment(childs);
1054
1054
  }
1055
1055
  const [nAttrs, wrappers] = Attributes.parse(attrs, px, true);
1056
- px.onAttributes(nAttrs, wrappers, null);
1056
+ px.onAttributes(nAttrs, wrappers, null, true);
1057
1057
  return wrap(px.newMacroNode(macroName, nAttrs.toMacroVars(), childs), px, wrappers);
1058
1058
  } else if (VALID_NODE_RE.test(tag)) {
1059
1059
  const [nAttrs, wrappers, textChild] = Attributes.parse(attrs, px);
@@ -1375,7 +1375,7 @@ class ParseContext {
1375
1375
  getNodeForId(id) {
1376
1376
  return this.nodes[id] ?? null;
1377
1377
  }
1378
- onAttributes(_attrs, _wrapperAttrs, _textChild) {}
1378
+ onAttributes(_attrs, _wrapperAttrs, _textChild, _isMacroCall) {}
1379
1379
  }
1380
1380
  var isTextNodeAllBlanks = (n) => n instanceof TextNode && n.isWhiteSpace();
1381
1381
  var isFirstDomNode = (n) => n instanceof DomNode || n instanceof FragmentNode && n.childs[0] instanceof DomNode;
@@ -1732,7 +1732,7 @@ function checkEventHandlersHaveImpls(lx, Comp, referencedInputs) {
1732
1732
  });
1733
1733
  }
1734
1734
  }
1735
- function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed) {
1735
+ function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal = false) {
1736
1736
  const valName = val?.constructor.name;
1737
1737
  if (valName === "FieldVal" || valName === "RawFieldVal") {
1738
1738
  const { name } = val;
@@ -1746,8 +1746,8 @@ function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter,
1746
1746
  lx.error(COMPUTED_VAL_NOT_DEFINED, { val, name });
1747
1747
  }
1748
1748
  } else if (valName === "SeqAccessVal") {
1749
- checkConsistentAttrVal(lx, val.seqVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1750
- checkConsistentAttrVal(lx, val.keyVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1749
+ checkConsistentAttrVal(lx, val.seqVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal);
1750
+ checkConsistentAttrVal(lx, val.keyVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal);
1751
1751
  } else if (valName === "RequestVal") {
1752
1752
  if (scope.lookupRequest(val.name) === null) {
1753
1753
  lx.warn(UNKNOWN_REQUEST_NAME, { name: val.name });
@@ -1757,12 +1757,12 @@ function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter,
1757
1757
  lx.warn(UNKNOWN_COMPONENT_NAME, { name: val.name });
1758
1758
  }
1759
1759
  } else if (valName === "NameVal") {
1760
- if (!isKnownHandlerName(val.name)) {
1760
+ if (!skipNameVal && !isKnownHandlerName(val.name)) {
1761
1761
  lx.warn(UNKNOWN_HANDLER_ARG_NAME, { name: val.name });
1762
1762
  }
1763
1763
  } else if (valName === "StrTplVal") {
1764
1764
  for (const subVal of val.vals) {
1765
- checkConsistentAttrVal(lx, subVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1765
+ checkConsistentAttrVal(lx, subVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal);
1766
1766
  }
1767
1767
  } else if (valName === "AlterHandlerNameVal") {
1768
1768
  referencedAlters?.add(val.name);
@@ -1781,11 +1781,11 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedComputed) {
1781
1781
  lx.push({ viewName }, () => {
1782
1782
  const view = views[viewName];
1783
1783
  for (const attr of view.ctx.attrs) {
1784
- const { attrs, wrapperAttrs, textChild } = attr;
1784
+ const { attrs, wrapperAttrs, textChild, isMacroCall } = attr;
1785
1785
  if (attrs?.constructor.name === "DynAttrs") {
1786
1786
  for (const attr2 of attrs.items) {
1787
1787
  if (attr2?.constructor.name === "Attr") {
1788
- checkConsistentAttrVal(lx, attr2.val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1788
+ checkConsistentAttrVal(lx, attr2.val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, isMacroCall);
1789
1789
  }
1790
1790
  }
1791
1791
  }
@@ -1811,6 +1811,13 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedComputed) {
1811
1811
  if (node.val) {
1812
1812
  checkConsistentAttrVal(lx, node.val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1813
1813
  }
1814
+ if (node.constructor.name === "RenderEachNode") {
1815
+ const iter = node.iterInfo;
1816
+ if (iter.whenVal)
1817
+ checkConsistentAttrVal(lx, iter.whenVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1818
+ if (iter.loopWithVal)
1819
+ checkConsistentAttrVal(lx, iter.loopWithVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
1820
+ }
1814
1821
  }
1815
1822
  });
1816
1823
  }
@@ -1870,8 +1877,8 @@ class LintParseContext extends ParseContext {
1870
1877
  super(DOMParser, Text, Comment);
1871
1878
  this.attrs = [];
1872
1879
  }
1873
- onAttributes(attrs, wrapperAttrs, textChild) {
1874
- this.attrs.push({ attrs, wrapperAttrs, textChild });
1880
+ onAttributes(attrs, wrapperAttrs, textChild, isMacroCall = false) {
1881
+ this.attrs.push({ attrs, wrapperAttrs, textChild, isMacroCall });
1875
1882
  }
1876
1883
  }
1877
1884
 
@@ -8540,9 +8547,9 @@ class LintClassCollectorCtx extends ParseCtxClassSetCollector {
8540
8547
  v.attrs = this.attrs;
8541
8548
  return v;
8542
8549
  }
8543
- onAttributes(attrs, wrapperAttrs, textChild) {
8544
- super.onAttributes(attrs, wrapperAttrs, textChild);
8545
- this.attrs.push({ attrs, wrapperAttrs, textChild });
8550
+ onAttributes(attrs, wrapperAttrs, textChild, isMacroCall = false) {
8551
+ super.onAttributes(attrs, wrapperAttrs, textChild, isMacroCall);
8552
+ this.attrs.push({ attrs, wrapperAttrs, textChild, isMacroCall });
8546
8553
  }
8547
8554
  }
8548
8555
  export {
@@ -8595,7 +8602,6 @@ export {
8595
8602
  component,
8596
8603
  compileClassesToStyleText,
8597
8604
  compileClassesToStyle,
8598
- checkView,
8599
8605
  checkComponent,
8600
8606
  check,
8601
8607
  UNKNOWN_REQUEST_NAME,
@@ -8619,9 +8625,6 @@ export {
8619
8625
  LintParseContext,
8620
8626
  LintContext,
8621
8627
  LintClassCollectorCtx,
8622
- LEVEL_WARN,
8623
- LEVEL_HINT,
8624
- LEVEL_ERROR,
8625
8628
  KList,
8626
8629
  Set2 as ISet,
8627
8630
  INPUT_HANDLER_NOT_REFERENCED,