tutuca 0.9.109 → 0.9.110

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.
@@ -6210,9 +6210,12 @@ function parseRenderEach(px, value, as, attrs) {
6210
6210
  maybeDeprecateBareXDirective(px, "render-each", "when");
6211
6211
  attrParser._parseWhen(when.value);
6212
6212
  }
6213
- const lWith = attrs.getNamedItem("loop-with");
6214
- if (lWith)
6213
+ const lWith = attrs.getNamedItem("@loop-with") ?? attrs.getNamedItem("loop-with");
6214
+ if (lWith) {
6215
+ if (lWith.name.charCodeAt(0) !== 64)
6216
+ maybeDeprecateBareXDirective(px, "render-each", "loop-with");
6215
6217
  attrParser._parseLoopWith(lWith.value);
6218
+ }
6216
6219
  const each = px.addNodeIf(EachNode, seqVal);
6217
6220
  each.iterInfo.whenVal = eachAttr.whenVal ?? null;
6218
6221
  each.iterInfo.loopWithVal = eachAttr.loopWithVal ?? null;
@@ -6726,7 +6729,7 @@ var init_anode = __esm(() => {
6726
6729
  text: xOp([], { wrappable: true, ignoresChildren: true }),
6727
6730
  render: xOp(["as"], { wrappable: true, ignoresChildren: true }),
6728
6731
  "render-it": xOp(["as"], { wrappable: true, ignoresChildren: true }),
6729
- "render-each": xOp(["as", "when", "loop-with", "@when"], {
6732
+ "render-each": xOp(["as", "when", "loop-with", "@when", "@loop-with"], {
6730
6733
  wrappable: true,
6731
6734
  ignoresChildren: true
6732
6735
  }),
@@ -9473,11 +9476,11 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
9473
9476
  const iter = node.iterInfo;
9474
9477
  if (iter.whenVal)
9475
9478
  checkConsistentAttrVal(lx, iter.whenVal, env, false, {
9476
- originAttr: "<x render-each when>"
9479
+ originAttr: "<x render-each @when>"
9477
9480
  });
9478
9481
  if (iter.loopWithVal)
9479
9482
  checkConsistentAttrVal(lx, iter.loopWithVal, env, false, {
9480
- originAttr: "<x render-each loop-with>"
9483
+ originAttr: "<x render-each @loop-with>"
9481
9484
  });
9482
9485
  }
9483
9486
  }
@@ -9741,7 +9744,7 @@ var init_lint_check = __esm(() => {
9741
9744
  };
9742
9745
  BINDING_MEMBER_TOO_DEEP_RE = /^@[a-zA-Z]\w*\??(\.[a-zA-Z]\w*\??){2,}$/;
9743
9746
  UNSUPPORTED_EXPR_GUIDANCE = {
9744
- ternary: "Ternary expressions aren't supported in dynamic attributes. Define a method or computed field on the component that returns the value, then reference it as '$methodName'.",
9747
+ ternary: "Ternary expressions aren't supported in dynamic attributes. Define a method or computed value on the component that returns the value, then reference it as '$methodName'.",
9745
9748
  comparison: "Comparisons aren't supported in dynamic attributes. Define a method like 'isFooSelected' that returns the boolean, then reference it as '$isFooSelected'.",
9746
9749
  logical: "Logical operators aren't supported in dynamic attributes. Combine the conditions in a method on the component and reference it as '$methodName'.",
9747
9750
  "call-with-args": "Method calls with arguments aren't supported here. Reference a no-arg method ('$methodName') and read what you need from component state, or split into per-case methods.",
@@ -10076,7 +10079,7 @@ var init_lint_rules = __esm(() => {
10076
10079
  code: DEPRECATED_BARE_X_DIRECTIVE,
10077
10080
  level: "warn",
10078
10081
  group: "Templates / events",
10079
- summary: "Bare `show`/`hide`/`when` on an `<x>` op is deprecated — use the `@`-prefixed directive (`@show`/`@hide`/`@when`)."
10082
+ summary: "Bare `show`/`hide`/`when`/`loop-with` on an `<x>` op is deprecated — use the `@`-prefixed directive (`@show`/`@hide`/`@when`/`@loop-with`)."
10080
10083
  },
10081
10084
  {
10082
10085
  code: BAD_VALUE,
@@ -10212,7 +10215,7 @@ function badValueMessage(info) {
10212
10215
  case "handler-arg":
10213
10216
  return `Cannot parse handler argument ${v}`;
10214
10217
  case "macro-var":
10215
- return `Macro variable '^${info.name}' is not defined`;
10218
+ return `Macro parameter '^${info.name}' is not defined`;
10216
10219
  default:
10217
10220
  return `Cannot parse value ${v}`;
10218
10221
  }
@@ -10292,7 +10295,7 @@ function lintIdToMessage(id, info) {
10292
10295
  case "ALT_HANDLER_NOT_REFERENCED":
10293
10296
  return `Alter handler '${info.name}' is defined but never used — remove it or reference it from @when, @enrich-with, or @loop-with`;
10294
10297
  case "DYN_VAL_NOT_DEFINED":
10295
- return `Dynamic variable '*${info.name}' is not defined${fmtOriginSuffix(info)}`;
10298
+ return `Dynamic binding '*${info.name}' is not defined${fmtOriginSuffix(info)}`;
10296
10299
  case "DYN_ALIAS_NOT_REFERENCED":
10297
10300
  return `Lookup '${info.name}' is defined but never used — remove it or reference it as '*${info.name}' in a view`;
10298
10301
  case "PROVIDE_NOT_ADDRESSABLE":
@@ -10330,9 +10333,9 @@ function lintIdToMessage(id, info) {
10330
10333
  return `Enrich handler '${info.name}' only copies members of the loop value — read them directly${reads ? ` (${reads})` : ""} and remove the '@enrich-with'`;
10331
10334
  }
10332
10335
  case "REDUNDANT_TEMPLATE_STRING":
10333
- return `Redundant template string — '{${info.simpler}}' should be just '${info.simpler}'${fmtOriginSuffix(info)}`;
10336
+ return `Redundant string template — '{${info.simpler}}' should be just '${info.simpler}'${fmtOriginSuffix(info)}`;
10334
10337
  case "PLACEHOLDERLESS_TEMPLATE_STRING":
10335
- return `Template string has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
10338
+ return `String template has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
10336
10339
  case "CONSTANT_CONDITION":
10337
10340
  return `Condition is the constant literal ${info.literal} — it never changes; reference a field ('.name') or a method ('$name') instead${fmtOriginSuffix(info)}`;
10338
10341
  case "UNKNOWN_COMPONENT_SPEC_KEY":
@@ -151,7 +151,7 @@ function makeCompositeView({
151
151
  @show=".isExpanded"
152
152
  class="ml-1 flex flex-col gap-0.5 border-l ${borderClass} pl-2 mt-0.5"
153
153
  >
154
- <x render-each=".items" loop-with="getPageRange"></x>
154
+ <x render-each=".items" @loop-with="getPageRange"></x>
155
155
  </div>
156
156
  </span>`;
157
157
  }
@@ -786,13 +786,13 @@ var GRID_BODY = html4`<div
786
786
  class="ml-1 grid gap-x-2 gap-y-0.5 items-baseline border-l border-base-content/10 pl-2 mt-0.5"
787
787
  style="grid-template-columns: auto 1fr"
788
788
  >
789
- <x render-each=".items" loop-with="getPageRange"></x>
789
+ <x render-each=".items" @loop-with="getPageRange"></x>
790
790
  </div>`;
791
791
  var LIST_BODY = html4`<div
792
792
  @show=".isExpanded"
793
793
  class="ml-1 flex flex-col gap-0.5 border-l border-base-content/10 pl-2 mt-0.5"
794
794
  >
795
- <x render-each=".items" loop-with="getPageRange"></x>
795
+ <x render-each=".items" @loop-with="getPageRange"></x>
796
796
  </div>`;
797
797
  function makeSchemaView(accent, body = GRID_BODY) {
798
798
  return html4`<span class="font-mono text-sm leading-tight inline-block">
@@ -1640,7 +1640,7 @@ function lintMessage(id, info = {}) {
1640
1640
  case "ALT_HANDLER_NOT_DEFINED":
1641
1641
  return `Alter handler '${info.name}' is not defined${originSuffix(info)}`;
1642
1642
  case "DYN_VAL_NOT_DEFINED":
1643
- return `Dynamic variable '*${info.name}' is not defined${originSuffix(info)}`;
1643
+ return `Dynamic binding '*${info.name}' is not defined${originSuffix(info)}`;
1644
1644
  case "UNKNOWN_COMPONENT_NAME":
1645
1645
  return `Unknown component '${info.name}'${originSuffix(info)}`;
1646
1646
  case "UNKNOWN_DIRECTIVE":
@@ -1648,9 +1648,9 @@ function lintMessage(id, info = {}) {
1648
1648
  case "IF_NO_BRANCH_SET":
1649
1649
  return `'@if.${info.attr}' has no '@then' or '@else' branch${tagSuffix(info)}`;
1650
1650
  case "REDUNDANT_TEMPLATE_STRING":
1651
- return `Redundant template string — '{${info.simpler}}' should be just '${info.simpler}'${originSuffix(info)}`;
1651
+ return `Redundant string template — '{${info.simpler}}' should be just '${info.simpler}'${originSuffix(info)}`;
1652
1652
  case "PLACEHOLDERLESS_TEMPLATE_STRING":
1653
- return `Template string has no dynamic parts — use the literal ${info.literal} instead${originSuffix(info)}`;
1653
+ return `String template has no dynamic parts — use the literal ${info.literal} instead${originSuffix(info)}`;
1654
1654
  case "CONSTANT_CONDITION":
1655
1655
  return `Constant condition ${info.literal} — reference a field ('.name') or method ('$name')${originSuffix(info)}`;
1656
1656
  case "ASYNC_HANDLER":
@@ -2375,9 +2375,12 @@ function parseRenderEach(px, value, as, attrs) {
2375
2375
  maybeDeprecateBareXDirective(px, "render-each", "when");
2376
2376
  attrParser._parseWhen(when.value);
2377
2377
  }
2378
- const lWith = attrs.getNamedItem("loop-with");
2379
- if (lWith)
2378
+ const lWith = attrs.getNamedItem("@loop-with") ?? attrs.getNamedItem("loop-with");
2379
+ if (lWith) {
2380
+ if (lWith.name.charCodeAt(0) !== 64)
2381
+ maybeDeprecateBareXDirective(px, "render-each", "loop-with");
2380
2382
  attrParser._parseLoopWith(lWith.value);
2383
+ }
2381
2384
  const each = px.addNodeIf(EachNode, seqVal);
2382
2385
  each.iterInfo.whenVal = eachAttr.whenVal ?? null;
2383
2386
  each.iterInfo.loopWithVal = eachAttr.loopWithVal ?? null;
@@ -2513,7 +2516,7 @@ var X_OPS = {
2513
2516
  text: xOp([], { wrappable: true, ignoresChildren: true }),
2514
2517
  render: xOp(["as"], { wrappable: true, ignoresChildren: true }),
2515
2518
  "render-it": xOp(["as"], { wrappable: true, ignoresChildren: true }),
2516
- "render-each": xOp(["as", "when", "loop-with", "@when"], {
2519
+ "render-each": xOp(["as", "when", "loop-with", "@when", "@loop-with"], {
2517
2520
  wrappable: true,
2518
2521
  ignoresChildren: true
2519
2522
  }),
@@ -5200,7 +5203,7 @@ function classifyBadValue(value) {
5200
5203
  }
5201
5204
  var BINDING_MEMBER_TOO_DEEP_RE = /^@[a-zA-Z]\w*\??(\.[a-zA-Z]\w*\??){2,}$/;
5202
5205
  var UNSUPPORTED_EXPR_GUIDANCE = {
5203
- ternary: "Ternary expressions aren't supported in dynamic attributes. Define a method or computed field on the component that returns the value, then reference it as '$methodName'.",
5206
+ ternary: "Ternary expressions aren't supported in dynamic attributes. Define a method or computed value on the component that returns the value, then reference it as '$methodName'.",
5204
5207
  comparison: "Comparisons aren't supported in dynamic attributes. Define a method like 'isFooSelected' that returns the boolean, then reference it as '$isFooSelected'.",
5205
5208
  logical: "Logical operators aren't supported in dynamic attributes. Combine the conditions in a method on the component and reference it as '$methodName'.",
5206
5209
  "call-with-args": "Method calls with arguments aren't supported here. Reference a no-arg method ('$methodName') and read what you need from component state, or split into per-case methods.",
@@ -5728,11 +5731,11 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
5728
5731
  const iter = node.iterInfo;
5729
5732
  if (iter.whenVal)
5730
5733
  checkConsistentAttrVal(lx, iter.whenVal, env, false, {
5731
- originAttr: "<x render-each when>"
5734
+ originAttr: "<x render-each @when>"
5732
5735
  });
5733
5736
  if (iter.loopWithVal)
5734
5737
  checkConsistentAttrVal(lx, iter.loopWithVal, env, false, {
5735
- originAttr: "<x render-each loop-with>"
5738
+ originAttr: "<x render-each @loop-with>"
5736
5739
  });
5737
5740
  }
5738
5741
  }
@@ -7399,7 +7402,7 @@ function badValueMessage(info) {
7399
7402
  case "handler-arg":
7400
7403
  return `Cannot parse handler argument ${v}`;
7401
7404
  case "macro-var":
7402
- return `Macro variable '^${info.name}' is not defined`;
7405
+ return `Macro parameter '^${info.name}' is not defined`;
7403
7406
  default:
7404
7407
  return `Cannot parse value ${v}`;
7405
7408
  }
@@ -7479,7 +7482,7 @@ function lintIdToMessage(id, info) {
7479
7482
  case "ALT_HANDLER_NOT_REFERENCED":
7480
7483
  return `Alter handler '${info.name}' is defined but never used — remove it or reference it from @when, @enrich-with, or @loop-with`;
7481
7484
  case "DYN_VAL_NOT_DEFINED":
7482
- return `Dynamic variable '*${info.name}' is not defined${fmtOriginSuffix(info)}`;
7485
+ return `Dynamic binding '*${info.name}' is not defined${fmtOriginSuffix(info)}`;
7483
7486
  case "DYN_ALIAS_NOT_REFERENCED":
7484
7487
  return `Lookup '${info.name}' is defined but never used — remove it or reference it as '*${info.name}' in a view`;
7485
7488
  case "PROVIDE_NOT_ADDRESSABLE":
@@ -7517,9 +7520,9 @@ function lintIdToMessage(id, info) {
7517
7520
  return `Enrich handler '${info.name}' only copies members of the loop value — read them directly${reads ? ` (${reads})` : ""} and remove the '@enrich-with'`;
7518
7521
  }
7519
7522
  case "REDUNDANT_TEMPLATE_STRING":
7520
- return `Redundant template string — '{${info.simpler}}' should be just '${info.simpler}'${fmtOriginSuffix(info)}`;
7523
+ return `Redundant string template — '{${info.simpler}}' should be just '${info.simpler}'${fmtOriginSuffix(info)}`;
7521
7524
  case "PLACEHOLDERLESS_TEMPLATE_STRING":
7522
- return `Template string has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
7525
+ return `String template has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
7523
7526
  case "CONSTANT_CONDITION":
7524
7527
  return `Condition is the constant literal ${info.literal} — it never changes; reference a field ('.name') or a method ('$name') instead${fmtOriginSuffix(info)}`;
7525
7528
  case "UNKNOWN_COMPONENT_SPEC_KEY":
@@ -10024,9 +10024,12 @@ function parseRenderEach(px, value, as, attrs) {
10024
10024
  maybeDeprecateBareXDirective(px, "render-each", "when");
10025
10025
  attrParser._parseWhen(when.value);
10026
10026
  }
10027
- const lWith = attrs.getNamedItem("loop-with");
10028
- if (lWith)
10027
+ const lWith = attrs.getNamedItem("@loop-with") ?? attrs.getNamedItem("loop-with");
10028
+ if (lWith) {
10029
+ if (lWith.name.charCodeAt(0) !== 64)
10030
+ maybeDeprecateBareXDirective(px, "render-each", "loop-with");
10029
10031
  attrParser._parseLoopWith(lWith.value);
10032
+ }
10030
10033
  const each = px.addNodeIf(EachNode, seqVal);
10031
10034
  each.iterInfo.whenVal = eachAttr.whenVal ?? null;
10032
10035
  each.iterInfo.loopWithVal = eachAttr.loopWithVal ?? null;
@@ -10162,7 +10165,7 @@ var X_OPS = {
10162
10165
  text: xOp([], { wrappable: true, ignoresChildren: true }),
10163
10166
  render: xOp(["as"], { wrappable: true, ignoresChildren: true }),
10164
10167
  "render-it": xOp(["as"], { wrappable: true, ignoresChildren: true }),
10165
- "render-each": xOp(["as", "when", "loop-with", "@when"], {
10168
+ "render-each": xOp(["as", "when", "loop-with", "@when", "@loop-with"], {
10166
10169
  wrappable: true,
10167
10170
  ignoresChildren: true
10168
10171
  }),
@@ -12849,7 +12852,7 @@ function classifyBadValue(value) {
12849
12852
  }
12850
12853
  var BINDING_MEMBER_TOO_DEEP_RE = /^@[a-zA-Z]\w*\??(\.[a-zA-Z]\w*\??){2,}$/;
12851
12854
  var UNSUPPORTED_EXPR_GUIDANCE = {
12852
- ternary: "Ternary expressions aren't supported in dynamic attributes. Define a method or computed field on the component that returns the value, then reference it as '$methodName'.",
12855
+ ternary: "Ternary expressions aren't supported in dynamic attributes. Define a method or computed value on the component that returns the value, then reference it as '$methodName'.",
12853
12856
  comparison: "Comparisons aren't supported in dynamic attributes. Define a method like 'isFooSelected' that returns the boolean, then reference it as '$isFooSelected'.",
12854
12857
  logical: "Logical operators aren't supported in dynamic attributes. Combine the conditions in a method on the component and reference it as '$methodName'.",
12855
12858
  "call-with-args": "Method calls with arguments aren't supported here. Reference a no-arg method ('$methodName') and read what you need from component state, or split into per-case methods.",
@@ -13377,11 +13380,11 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
13377
13380
  const iter = node.iterInfo;
13378
13381
  if (iter.whenVal)
13379
13382
  checkConsistentAttrVal(lx, iter.whenVal, env, false, {
13380
- originAttr: "<x render-each when>"
13383
+ originAttr: "<x render-each @when>"
13381
13384
  });
13382
13385
  if (iter.loopWithVal)
13383
13386
  checkConsistentAttrVal(lx, iter.loopWithVal, env, false, {
13384
- originAttr: "<x render-each loop-with>"
13387
+ originAttr: "<x render-each @loop-with>"
13385
13388
  });
13386
13389
  }
13387
13390
  }
@@ -15048,7 +15051,7 @@ function badValueMessage(info) {
15048
15051
  case "handler-arg":
15049
15052
  return `Cannot parse handler argument ${v}`;
15050
15053
  case "macro-var":
15051
- return `Macro variable '^${info.name}' is not defined`;
15054
+ return `Macro parameter '^${info.name}' is not defined`;
15052
15055
  default:
15053
15056
  return `Cannot parse value ${v}`;
15054
15057
  }
@@ -15128,7 +15131,7 @@ function lintIdToMessage(id, info) {
15128
15131
  case "ALT_HANDLER_NOT_REFERENCED":
15129
15132
  return `Alter handler '${info.name}' is defined but never used — remove it or reference it from @when, @enrich-with, or @loop-with`;
15130
15133
  case "DYN_VAL_NOT_DEFINED":
15131
- return `Dynamic variable '*${info.name}' is not defined${fmtOriginSuffix(info)}`;
15134
+ return `Dynamic binding '*${info.name}' is not defined${fmtOriginSuffix(info)}`;
15132
15135
  case "DYN_ALIAS_NOT_REFERENCED":
15133
15136
  return `Lookup '${info.name}' is defined but never used — remove it or reference it as '*${info.name}' in a view`;
15134
15137
  case "PROVIDE_NOT_ADDRESSABLE":
@@ -15166,9 +15169,9 @@ function lintIdToMessage(id, info) {
15166
15169
  return `Enrich handler '${info.name}' only copies members of the loop value — read them directly${reads ? ` (${reads})` : ""} and remove the '@enrich-with'`;
15167
15170
  }
15168
15171
  case "REDUNDANT_TEMPLATE_STRING":
15169
- return `Redundant template string — '{${info.simpler}}' should be just '${info.simpler}'${fmtOriginSuffix(info)}`;
15172
+ return `Redundant string template — '{${info.simpler}}' should be just '${info.simpler}'${fmtOriginSuffix(info)}`;
15170
15173
  case "PLACEHOLDERLESS_TEMPLATE_STRING":
15171
- return `Template string has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
15174
+ return `String template has no dynamic parts — use the string literal ${info.literal} instead${fmtOriginSuffix(info)}`;
15172
15175
  case "CONSTANT_CONDITION":
15173
15176
  return `Condition is the constant literal ${info.literal} — it never changes; reference a field ('.name') or a method ('$name') instead${fmtOriginSuffix(info)}`;
15174
15177
  case "UNKNOWN_COMPONENT_SPEC_KEY":