tutuca 0.9.24 → 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.
@@ -91,14 +91,7 @@ class LintReport {
91
91
  }
92
92
 
93
93
  class RenderedExample {
94
- constructor({
95
- title,
96
- description = null,
97
- componentName,
98
- view,
99
- html,
100
- error = null
101
- }) {
94
+ constructor({ title, description = null, componentName, view, html, error = null }) {
102
95
  this.title = title;
103
96
  this.description = description;
104
97
  this.componentName = componentName;
@@ -1458,7 +1451,7 @@ class ParseContext {
1458
1451
  getNodeForId(id) {
1459
1452
  return this.nodes[id] ?? null;
1460
1453
  }
1461
- onAttributes(_attrs, _wrapperAttrs, _textChild) {}
1454
+ onAttributes(_attrs, _wrapperAttrs, _textChild, _isMacroCall) {}
1462
1455
  }
1463
1456
  function condenseChildsWhites(childs) {
1464
1457
  let end = childs.length;
@@ -1676,7 +1669,7 @@ var init_anode = __esm(() => {
1676
1669
  return px.frame.macroSlots[slotName] ?? maybeFragment(childs);
1677
1670
  }
1678
1671
  const [nAttrs, wrappers] = Attributes.parse(attrs, px, true);
1679
- px.onAttributes(nAttrs, wrappers, null);
1672
+ px.onAttributes(nAttrs, wrappers, null, true);
1680
1673
  return wrap(px.newMacroNode(macroName, nAttrs.toMacroVars(), childs), px, wrappers);
1681
1674
  } else if (VALID_NODE_RE.test(tag)) {
1682
1675
  const [nAttrs, wrappers, textChild] = Attributes.parse(attrs, px);
@@ -2202,7 +2195,7 @@ function checkEventHandlersHaveImpls(lx, Comp, referencedInputs) {
2202
2195
  });
2203
2196
  }
2204
2197
  }
2205
- function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed) {
2198
+ function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal = false) {
2206
2199
  const valName = val?.constructor.name;
2207
2200
  if (valName === "FieldVal" || valName === "RawFieldVal") {
2208
2201
  const { name } = val;
@@ -2216,8 +2209,8 @@ function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter,
2216
2209
  lx.error(COMPUTED_VAL_NOT_DEFINED, { val, name });
2217
2210
  }
2218
2211
  } else if (valName === "SeqAccessVal") {
2219
- checkConsistentAttrVal(lx, val.seqVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
2220
- checkConsistentAttrVal(lx, val.keyVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
2212
+ checkConsistentAttrVal(lx, val.seqVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal);
2213
+ checkConsistentAttrVal(lx, val.keyVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal);
2221
2214
  } else if (valName === "RequestVal") {
2222
2215
  if (scope.lookupRequest(val.name) === null) {
2223
2216
  lx.warn(UNKNOWN_REQUEST_NAME, { name: val.name });
@@ -2227,12 +2220,12 @@ function checkConsistentAttrVal(lx, val, fields, proto, computed, scope, alter,
2227
2220
  lx.warn(UNKNOWN_COMPONENT_NAME, { name: val.name });
2228
2221
  }
2229
2222
  } else if (valName === "NameVal") {
2230
- if (!isKnownHandlerName(val.name)) {
2223
+ if (!skipNameVal && !isKnownHandlerName(val.name)) {
2231
2224
  lx.warn(UNKNOWN_HANDLER_ARG_NAME, { name: val.name });
2232
2225
  }
2233
2226
  } else if (valName === "StrTplVal") {
2234
2227
  for (const subVal of val.vals) {
2235
- checkConsistentAttrVal(lx, subVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
2228
+ checkConsistentAttrVal(lx, subVal, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, skipNameVal);
2236
2229
  }
2237
2230
  } else if (valName === "AlterHandlerNameVal") {
2238
2231
  referencedAlters?.add(val.name);
@@ -2251,11 +2244,11 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedComputed) {
2251
2244
  lx.push({ viewName }, () => {
2252
2245
  const view = views[viewName];
2253
2246
  for (const attr of view.ctx.attrs) {
2254
- const { attrs, wrapperAttrs, textChild } = attr;
2247
+ const { attrs, wrapperAttrs, textChild, isMacroCall } = attr;
2255
2248
  if (attrs?.constructor.name === "DynAttrs") {
2256
2249
  for (const attr2 of attrs.items) {
2257
2250
  if (attr2?.constructor.name === "Attr") {
2258
- checkConsistentAttrVal(lx, attr2.val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed);
2251
+ checkConsistentAttrVal(lx, attr2.val, fields, proto, computed, scope, alter, referencedAlters, referencedComputed, isMacroCall);
2259
2252
  }
2260
2253
  }
2261
2254
  }
@@ -2370,8 +2363,8 @@ var init_lint_check = __esm(() => {
2370
2363
  super(DOMParser, Text, Comment);
2371
2364
  this.attrs = [];
2372
2365
  }
2373
- onAttributes(attrs, wrapperAttrs, textChild) {
2374
- this.attrs.push({ attrs, wrapperAttrs, textChild });
2366
+ onAttributes(attrs, wrapperAttrs, textChild, isMacroCall = false) {
2367
+ this.attrs.push({ attrs, wrapperAttrs, textChild, isMacroCall });
2375
2368
  }
2376
2369
  };
2377
2370
  });
@@ -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
  }
@@ -1877,8 +1877,8 @@ class LintParseContext extends ParseContext {
1877
1877
  super(DOMParser, Text, Comment);
1878
1878
  this.attrs = [];
1879
1879
  }
1880
- onAttributes(attrs, wrapperAttrs, textChild) {
1881
- this.attrs.push({ attrs, wrapperAttrs, textChild });
1880
+ onAttributes(attrs, wrapperAttrs, textChild, isMacroCall = false) {
1881
+ this.attrs.push({ attrs, wrapperAttrs, textChild, isMacroCall });
1882
1882
  }
1883
1883
  }
1884
1884
 
@@ -8547,9 +8547,9 @@ class LintClassCollectorCtx extends ParseCtxClassSetCollector {
8547
8547
  v.attrs = this.attrs;
8548
8548
  return v;
8549
8549
  }
8550
- onAttributes(attrs, wrapperAttrs, textChild) {
8551
- super.onAttributes(attrs, wrapperAttrs, textChild);
8552
- 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 });
8553
8553
  }
8554
8554
  }
8555
8555
  export {