@torpor/view 1.3.1 → 1.3.3

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.
@@ -324,6 +324,21 @@ interface Effect {
324
324
  * The number of children of this effect.
325
325
  */
326
326
  extent: number;
327
+ /**
328
+ * Monotonic creation order, assigned by `$run`. The effect queue is run in
329
+ * this order, so an effect always re-runs before effects that were created
330
+ * while it was running (its "children" — e.g. a control statement's branch
331
+ * effects). That is what lets a branch be disposed before its own bindings
332
+ * re-run when the branch's condition turns false.
333
+ */
334
+ seq: number;
335
+ /**
336
+ * True once the effect's owning region has been released (`clearRegion`).
337
+ * A destroyed effect is skipped if it's still queued: e.g. an `@if`
338
+ * branch's bindings must not run again in the same flush in which the
339
+ * control statement disposed the branch.
340
+ */
341
+ destroyed?: boolean;
327
342
  /**
328
343
  * True while the effect is linked into the current run queue. Reset as
329
344
  * soon as the effect is processed, so a signal write later in the same
@@ -395,4 +410,4 @@ interface Effect {
395
410
  }
396
411
  //#endregion
397
412
  export { ProxySignal as i, Region as n, Computed as r, Effect as t };
398
- //# sourceMappingURL=Effect-Bf8fz_zC.d.cts.map
413
+ //# sourceMappingURL=Effect-Bp-BIDDm.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Effect-99HYQdzZ.d.mts","names":[],"sources":["../src/types/AsyncSettle.ts","../src/types/constants.ts","../src/types/ProxySignal.ts","../src/types/Subscription.ts","../src/types/Computed.ts","../src/types/ErrorBoundary.ts","../src/types/Region.ts","../src/types/Effect.ts"],"mappings":";;;;;;;;;;;;;;;KAaK;EAAgB;EAAU;;EAAiB;EAAW;;;;;;;cCV9C;;;;cAKA;;;;cAKA;;;;;;;UCNY;;;;EAIxB,aAAa;;;;EAKb,aAAa;;;;EAKb,oBAAoB;;;;EAKpB;;;;;;;;UClBwB;;;;EAIxB,QAAQ,cAAc;;;;EAKtB,QAAQ,WAAW;;;;;EAMnB,YAAY;;;;;EAMZ,YAAY;;;;;;;EAQZ,gBAAgB;;;;;;EAOhB;;;;;EAMA;;;;EAKA;;;;;;;;;UC9CwB,SAAS;;;;EAIjC,aAAa;;;;;;;;EASb;;;;EAKA,OAAO;;;;EAKP,WAAW;;;;EAKX,aAAa;;;;EAKb,aAAa;;;;;;;EAQb;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,QAAQ;;;;;;;;;;;;;;;EAgBR;;;;EAKA,UAAU;;;;EAKV;;;;;;;;;;UCrHwB;;;;;;EAMxB;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;EAUR,cAAc,cAAc;;;;UCnCJ;EACxB,WAAW;EACX,SAAS;EAET,gBAAgB;EAChB,YAAY;EACZ;;;;;EAMA,YAAY,IAAI;;;;EAKhB;;;;EAKA,SAAS;;;;;;;EAQT,gBAAgB;;;;;;;EAQhB;;;;;;EAOA;;;;;;;UCtCwB;;;;EAIxB,aAAa;;;;;EAMb,WAAW;;;;EAKX,SAAS;;;;EAKT,aAAa;EAKb,YAAY;;;;EAKZ;;;;;;EAOA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
1
+ {"version":3,"file":"Effect-Bp-BIDDm.d.cts","names":[],"sources":["../src/types/AsyncSettle.ts","../src/types/constants.ts","../src/types/ProxySignal.ts","../src/types/Subscription.ts","../src/types/Computed.ts","../src/types/ErrorBoundary.ts","../src/types/Region.ts","../src/types/Effect.ts"],"mappings":";;;;;;;;;;;;;;;KAaK;EAAgB;EAAU;;EAAiB;EAAW;;;;;;;cCV9C;;;;cAKA;;;;cAKA;;;;;;;UCNY;;;;EAIxB,aAAa;;;;EAKb,aAAa;;;;EAKb,oBAAoB;;;;EAKpB;;;;;;;;UClBwB;;;;EAIxB,QAAQ,cAAc;;;;EAKtB,QAAQ,WAAW;;;;;EAMnB,YAAY;;;;;EAMZ,YAAY;;;;;;;EAQZ,gBAAgB;;;;;;EAOhB;;;;;EAMA;;;;EAKA;;;;;;;;;UC9CwB,SAAS;;;;EAIjC,aAAa;;;;;;;;EASb;;;;EAKA,OAAO;;;;EAKP,WAAW;;;;EAKX,aAAa;;;;EAKb,aAAa;;;;;;;EAQb;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,QAAQ;;;;;;;;;;;;;;;EAgBR;;;;EAKA,UAAU;;;;EAKV;;;;;;;;;;UCrHwB;;;;;;EAMxB;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;EAUR,cAAc,cAAc;;;;UCnCJ;EACxB,WAAW;EACX,SAAS;EAET,gBAAgB;EAChB,YAAY;EACZ;;;;;EAMA,YAAY,IAAI;;;;EAKhB;;;;EAKA,SAAS;;;;;;;EAQT,gBAAgB;;;;;;;EAQhB;;;;;;EAOA;;;;;;;UCtCwB;;;;EAIxB,aAAa;;;;;EAMb,WAAW;;;;EAKX,SAAS;;;;EAKT,aAAa;EAKb,YAAY;;;;EAKZ;;;;;;;;EASA;;;;;;;EAQA;;;;;;EAOA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
@@ -324,6 +324,21 @@ interface Effect {
324
324
  * The number of children of this effect.
325
325
  */
326
326
  extent: number;
327
+ /**
328
+ * Monotonic creation order, assigned by `$run`. The effect queue is run in
329
+ * this order, so an effect always re-runs before effects that were created
330
+ * while it was running (its "children" — e.g. a control statement's branch
331
+ * effects). That is what lets a branch be disposed before its own bindings
332
+ * re-run when the branch's condition turns false.
333
+ */
334
+ seq: number;
335
+ /**
336
+ * True once the effect's owning region has been released (`clearRegion`).
337
+ * A destroyed effect is skipped if it's still queued: e.g. an `@if`
338
+ * branch's bindings must not run again in the same flush in which the
339
+ * control statement disposed the branch.
340
+ */
341
+ destroyed?: boolean;
327
342
  /**
328
343
  * True while the effect is linked into the current run queue. Reset as
329
344
  * soon as the effect is processed, so a signal write later in the same
@@ -395,4 +410,4 @@ interface Effect {
395
410
  }
396
411
  //#endregion
397
412
  export { ProxySignal as i, Region as n, Computed as r, Effect as t };
398
- //# sourceMappingURL=Effect-99HYQdzZ.d.mts.map
413
+ //# sourceMappingURL=Effect-VsIY2vPx.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Effect-Bf8fz_zC.d.cts","names":[],"sources":["../src/types/AsyncSettle.ts","../src/types/constants.ts","../src/types/ProxySignal.ts","../src/types/Subscription.ts","../src/types/Computed.ts","../src/types/ErrorBoundary.ts","../src/types/Region.ts","../src/types/Effect.ts"],"mappings":";;;;;;;;;;;;;;;KAaK;EAAgB;EAAU;;EAAiB;EAAW;;;;;;;cCV9C;;;;cAKA;;;;cAKA;;;;;;;UCNY;;;;EAIxB,aAAa;;;;EAKb,aAAa;;;;EAKb,oBAAoB;;;;EAKpB;;;;;;;;UClBwB;;;;EAIxB,QAAQ,cAAc;;;;EAKtB,QAAQ,WAAW;;;;;EAMnB,YAAY;;;;;EAMZ,YAAY;;;;;;;EAQZ,gBAAgB;;;;;;EAOhB;;;;;EAMA;;;;EAKA;;;;;;;;;UC9CwB,SAAS;;;;EAIjC,aAAa;;;;;;;;EASb;;;;EAKA,OAAO;;;;EAKP,WAAW;;;;EAKX,aAAa;;;;EAKb,aAAa;;;;;;;EAQb;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,QAAQ;;;;;;;;;;;;;;;EAgBR;;;;EAKA,UAAU;;;;EAKV;;;;;;;;;;UCrHwB;;;;;;EAMxB;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;EAUR,cAAc,cAAc;;;;UCnCJ;EACxB,WAAW;EACX,SAAS;EAET,gBAAgB;EAChB,YAAY;EACZ;;;;;EAMA,YAAY,IAAI;;;;EAKhB;;;;EAKA,SAAS;;;;;;;EAQT,gBAAgB;;;;;;;EAQhB;;;;;;EAOA;;;;;;;UCtCwB;;;;EAIxB,aAAa;;;;;EAMb,WAAW;;;;EAKX,SAAS;;;;EAKT,aAAa;EAKb,YAAY;;;;EAKZ;;;;;;EAOA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
1
+ {"version":3,"file":"Effect-VsIY2vPx.d.mts","names":[],"sources":["../src/types/AsyncSettle.ts","../src/types/constants.ts","../src/types/ProxySignal.ts","../src/types/Subscription.ts","../src/types/Computed.ts","../src/types/ErrorBoundary.ts","../src/types/Region.ts","../src/types/Effect.ts"],"mappings":";;;;;;;;;;;;;;;KAaK;EAAgB;EAAU;;EAAiB;EAAW;;;;;;;cCV9C;;;;cAKA;;;;cAKA;;;;;;;UCNY;;;;EAIxB,aAAa;;;;EAKb,aAAa;;;;EAKb,oBAAoB;;;;EAKpB;;;;;;;;UClBwB;;;;EAIxB,QAAQ,cAAc;;;;EAKtB,QAAQ,WAAW;;;;;EAMnB,YAAY;;;;;EAMZ,YAAY;;;;;;;EAQZ,gBAAgB;;;;;;EAOhB;;;;;EAMA;;;;EAKA;;;;;;;;;UC9CwB,SAAS;;;;EAIjC,aAAa;;;;;;;;EASb;;;;EAKA,OAAO;;;;EAKP,WAAW;;;;EAKX,aAAa;;;;EAKb,aAAa;;;;;;;EAQb;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,QAAQ;;;;;;;;;;;;;;;EAgBR;;;;EAKA,UAAU;;;;EAKV;;;;;;;;;;UCrHwB;;;;;;EAMxB;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;EAUR,cAAc,cAAc;;;;UCnCJ;EACxB,WAAW;EACX,SAAS;EAET,gBAAgB;EAChB,YAAY;EACZ;;;;;EAMA,YAAY,IAAI;;;;EAKhB;;;;EAKA,SAAS;;;;;;;EAQT,gBAAgB;;;;;;;EAQhB;;;;;;EAOA;;;;;;;UCtCwB;;;;EAIxB,aAAa;;;;;EAMb,WAAW;;;;EAKX,SAAS;;;;EAKT,aAAa;EAKb,YAAY;;;;EAKZ;;;;;;;;EASA;;;;;;;EAQA;;;;;;EAOA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;EAWA,iBAAiB,IAAI;;;;EAKrB;;;;;;EAOA,SAAS;;;;;;EAOT,gBAAgB,cAAc;;;;;;;;;EAU9B;;;;;;;;;;;;;;;;EAiBA"}
package/dist/compile.cjs CHANGED
@@ -488,10 +488,11 @@ function addPopDevBoundary(status, b) {
488
488
  function addPushDevBoundary(type, name, status, b) {
489
489
  if (status.options.dev === true) {
490
490
  status.imports.add("t_push_dev_bound");
491
+ name = name.replace(/\s+/g, " ");
491
492
  if (name.startsWith("'") && name.endsWith("'") || name.startsWith("\"") && name.endsWith("\"") || name.startsWith("`") && name.endsWith("`")) {
492
493
  const quote = name[0];
493
494
  name = quote + name.substring(1, name.length - 1).replaceAll(quote, "\\" + quote) + quote;
494
- } else name = `"${name.replaceAll("\"", "\\\"")}"`;
495
+ } else name = JSON.stringify(name);
495
496
  b.append(`t_push_dev_bound("${type}", ${name});`);
496
497
  b.append("");
497
498
  }
@@ -597,7 +598,7 @@ function isReactive(text) {
597
598
  function trimQuotes(text) {
598
599
  let start = 0;
599
600
  let end = text.length;
600
- while (text[start] === "'" && text[end - 1] === "'" || text[start] === "\"" && text[end - 1] === "\"" || text[start] === "`" && text[end - 1] === "`") {
601
+ while (start < end && (text[start] === "'" && text[end - 1] === "'" || text[start] === "\"" && text[end - 1] === "\"" || text[start] === "`" && text[end - 1] === "`")) {
601
602
  start += 1;
602
603
  end -= 1;
603
604
  }
@@ -885,6 +886,21 @@ function isSpecialNode(node) {
885
886
  return node.type === "special";
886
887
  }
887
888
  //#endregion
889
+ //#region src/compile/utils/propKey.ts
890
+ const IDENTIFIER_REGEX = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
891
+ /**
892
+ * Formats a prop name for use as an object key in generated code. Valid
893
+ * identifiers are left unquoted; anything else (e.g. dashed props like
894
+ * `aria-hidden`) is quoted so that the generated code stays valid.
895
+ *
896
+ * @param name The prop name as written on the component or slot
897
+ *
898
+ * @returns The name as an object key text
899
+ */
900
+ function propKey(name) {
901
+ return IDENTIFIER_REGEX.test(name) ? name : JSON.stringify(name);
902
+ }
903
+ //#endregion
888
904
  //#region src/compile/build/utils/nextVarName.ts
889
905
  /**
890
906
  * Makes a supplied variable name (hopefully!) unique by prepending `t_` and
@@ -1706,8 +1722,9 @@ function buildComponentNode(node, status, b, root = false) {
1706
1722
  let value = p.value;
1707
1723
  p.preText ??= "";
1708
1724
  p.postText ??= "";
1709
- if (p.spans.length === 1) addMappedText(p.name ? `${p.name}: ` + p.preText : p.preText, value, p.postText + ",", p.spans[0], status, b);
1710
- else addMappedTextWithOffsets(p.name ? `${p.name}: ` + p.preText : p.preText, value, p.postText + ",", p.spans, p.offsets, p.lengths, status, b);
1725
+ const key = p.name ? `${propKey(p.name)}: ` : "";
1726
+ if (p.spans.length === 1) addMappedText(key + p.preText, value, p.postText + ",", p.spans[0], status, b);
1727
+ else addMappedTextWithOffsets(key + p.preText, value, p.postText + ",", p.spans, p.offsets, p.lengths, status, b);
1711
1728
  }
1712
1729
  b.append("});");
1713
1730
  if (runs.length) buildRun("setProps", runs.join("\n"), status, b);
@@ -2172,8 +2189,10 @@ function buildForNode(node, status, b) {
2172
2189
  appendForVarBindings(b, status, `${node.statement}\n${keyStatement}`);
2173
2190
  addMappedText("", `${node.statement}`, " {", node.span, status, b);
2174
2191
  const dataExpr = singleVar ? forVarNames[0] : `{ ${forVarNames.join(", ")} }`;
2175
- if (key !== void 0) addMappedText(`${listItemsName}.push({ data: ${dataExpr}, key: `, `${keyStatement || "undefined"}`, " });", key.span, status, b);
2176
- else b.append(`${listItemsName}.push({ data: ${dataExpr} });`);
2192
+ if (key !== void 0) {
2193
+ status.imports.add("$peek");
2194
+ addMappedText(`${listItemsName}.push({ data: ${dataExpr}, key: $peek(() => `, `${keyStatement || "undefined"}`, ") });", key.span, status, b);
2195
+ } else b.append(`${listItemsName}.push({ data: ${dataExpr} });`);
2177
2196
  b.append(`}`);
2178
2197
  b.append(`return ${listItemsName};`);
2179
2198
  b.append(`},
@@ -2938,7 +2957,7 @@ function buildSlotNode(node, status, b) {
2938
2957
  b.append(`const ${propsName} = $watch({`);
2939
2958
  for (let p of props) {
2940
2959
  let value = p.value;
2941
- addMappedText(`${p.name}: `, value, ",", p.span, status, b);
2960
+ addMappedText(`${propKey(p.name)}: `, value, ",", p.span, status, b);
2942
2961
  }
2943
2962
  b.append("});");
2944
2963
  if (runs.length) buildRun("setProps", runs.join("\n"), status, b);
@@ -3140,6 +3159,7 @@ function buildCode(template, map, options, errors = [], warnings = []) {
3140
3159
  let imports = /* @__PURE__ */ new Set();
3141
3160
  imports.add("SlotRender");
3142
3161
  buildTemplate(template, map, imports, b, options, errors, warnings);
3162
+ if (imports.has("t_next") && !b.toString().includes("t_next(")) imports.delete("t_next");
3143
3163
  let startSize = b.toString().length;
3144
3164
  if (imports.size) {
3145
3165
  const folder = options?.renderFolder ?? "@torpor/view";
@@ -3373,7 +3393,7 @@ function buildServerComponentNode(node, status, b) {
3373
3393
  });
3374
3394
  }
3375
3395
  b.append(`const ${propsName} = {`);
3376
- for (let p of props) b.append(p.name ? `${p.name}: ${p.value},` : `${p.value},`);
3396
+ for (let p of props) b.append(p.name ? `${propKey(p.name)}: ${p.value},` : `${p.value},`);
3377
3397
  b.append("};");
3378
3398
  }
3379
3399
  const componentHasSlots = node.children.length;
@@ -3663,8 +3683,8 @@ function buildElementAttributes(node, status) {
3663
3683
  status.imports.add("t_style");
3664
3684
  attributes.push(`\${t_style(${value})}`);
3665
3685
  } else {
3666
- status.imports.add("t_attr");
3667
- attributes.push(`\${(${value}) ? \`${name}="\${t_attr(${value})}"\` : ""}`);
3686
+ status.imports.add("t_attr_if");
3687
+ attributes.push(`\${t_attr_if("${name}", ${value})}`);
3668
3688
  }
3669
3689
  } else if (value != null && reactive) {
3670
3690
  status.imports.add("t_attr");
@@ -3810,6 +3830,7 @@ const importsMap = {
3810
3830
  t_await_server: "import { t_await_server } from \"${folder}\";",
3811
3831
  t_fmt: "import { t_fmt } from \"${folder}\";",
3812
3832
  t_attr: "import { t_attr } from \"${folder}\";",
3833
+ t_attr_if: "import { t_attr_if } from \"${folder}\";",
3813
3834
  t_class: "import { t_class } from \"${folder}\";",
3814
3835
  t_style: "import { t_style } from \"${folder}\";",
3815
3836
  t_slot_guard: "import { t_slot_guard } from \"${folder}\";",
@@ -317,8 +317,9 @@ interface RestrictedStaticAttribute {
317
317
  /**
318
318
  * A dynamic attribute: the value is an expression evaluated at render time.
319
319
  *
320
- * - `format: "attr"` — set only when truthy, HTML-escaped (matches the JS
321
- * server build's conditional attribute behavior).
320
+ * - `format: "attr"` — dropped for null/undefined/false, HTML-escaped
321
+ * otherwise (matches the JS server build's conditional attribute behavior;
322
+ * empty string and 0 still render).
322
323
  * - `format: "class"` — class value semantics (arrays/objects); `scoped` is
323
324
  * the component's style-hash class to append.
324
325
  * - `format: "style"` — style value semantics (objects/arrays).
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.cts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/Import.ts","../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;EACA;EACA;EACA;;;;UCLwB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SAAS;;EAET,QAAQ;;EAER;EACA,OAAO;EACP,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UC1BwB;EACxB,SAAS;EACT,QAAQ;EACR,YAAY;;;;UCVY;;;;EAIxB;;;;EAIA;;;;EAIA;;;;;;;EAOA;;;;EAIA;;;;;;;;EAQA;;;;;;EAMA;;;;UCrCwB;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;;;;UCLwB;EACxB;EACA,QAAQ;EACR,UAAU;;;;UCFc;EACxB;EACA;IACC;IACA;;EAED,KAAK;EACL,QAAQ;;;;;;EAMR,UAAU;;;;;;;;;;;iBCCa,MAAM,UAAU,UAAU,UAAU,eAAe;;;;;;;;;;;;;;KCL/D;KACA;KAkBA;;;;;;;;;;;KAYA;EACP;EAAW,OAAO;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AE1C;;EAEA;EAEA,YAAY,iBAAiB,eAAe;;UAwP5B;EAChB,YAAY;;EAEZ;;UAGgB;;;;;;EAMhB;;;;;;;wBAuBe,sBACf,gBACA,iBACA,UAAU,yBACR"}
1
+ {"version":3,"file":"compile.d.cts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/Import.ts","../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;EACA;EACA;EACA;;;;UCLwB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SAAS;;EAET,QAAQ;;EAER;EACA,OAAO;EACP,QAAQ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EhB,cAAc;EACd,YAAY;;UAGI;EAChB,SAAS;EACT;IACC;IACA;;EAED,QALSA;;UAQO;;EAEhB;;EAEA;;UAGgB;EAChB;EACA,MAAM;;EAEN;EACA;EACA;;KAGW,sCACX,MAAM,uBACN,SAAS,iBAAiB,eAAe,sBACzC,UAAU;;;UCxKM,+BAA+B;;;;;;;;;;;iBAiCxB,gBACvB,UAAU,UACV,UAAU,yBACR;;;;;;;;;;;iBCrDqB,UAAU,UAAU,UAAU,UAAU;;;UCTvC;EACxB;EACA,QAAQ;EACR,WAAW;;;;;;;;;;;;iBCKY,MAAM,iBAAiB;;;;;;;;;iBCHvB,iBAAiB,UAAU;;;;;;;;;;;;;;;;;;;;;;qBCctC,8BAA8B;;EAE1C;;EAEA;EAEA,YAAY,iBAAiB,eAAe;;UAwP5B;EAChB,YAAY;;EAEZ;;UAGgB;;;;;;EAMhB;;;;;;;wBAuBe,sBACf,gBACA,iBACA,UAAU,yBACR"}
@@ -317,8 +317,9 @@ interface RestrictedStaticAttribute {
317
317
  /**
318
318
  * A dynamic attribute: the value is an expression evaluated at render time.
319
319
  *
320
- * - `format: "attr"` — set only when truthy, HTML-escaped (matches the JS
321
- * server build's conditional attribute behavior).
320
+ * - `format: "attr"` — dropped for null/undefined/false, HTML-escaped
321
+ * otherwise (matches the JS server build's conditional attribute behavior;
322
+ * empty string and 0 still render).
322
323
  * - `format: "class"` — class value semantics (arrays/objects); `scoped` is
323
324
  * the component's style-hash class to append.
324
325
  * - `format: "style"` — style value semantics (objects/arrays).
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.mts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/Import.ts","../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;EACA;EACA;EACA;;;;UCLwB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SAAS;;EAET,QAAQ;;EAER;EACA,OAAO;EACP,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UC1BwB;EACxB,SAAS;EACT,QAAQ;EACR,YAAY;;;;UCVY;;;;EAIxB;;;;EAIA;;;;EAIA;;;;;;;EAOA;;;;EAIA;;;;;;;;EAQA;;;;;;EAMA;;;;UCrCwB;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;;;;UCLwB;EACxB;EACA,QAAQ;EACR,UAAU;;;;UCFc;EACxB;EACA;IACC;IACA;;EAED,KAAK;EACL,QAAQ;;;;;;EAMR,UAAU;;;;;;;;;;;iBCCa,MAAM,UAAU,UAAU,UAAU,eAAe;;;;;;;;;;;;;;KCL/D;KACA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;;;;;;;;;;;;;;;;;;;;;qBCctC,8BAA8B;;EAE1C;;EAEA;EAEA,YAAY,iBAAiB,eAAe;;UAwP5B;EAChB,YAAY;;EAEZ;;UAGgB;;;;;;EAMhB;;;;;;;wBAuBe,sBACf,gBACA,iBACA,UAAU,yBACR"}
1
+ {"version":3,"file":"compile.d.mts","names":["_$______types_CompileError0.default"],"sources":["../src/compile/types/Import.ts","../src/compile/types/SourceSpan.ts","../src/compile/types/ScriptChunk.ts","../src/compile/types/nodes/Fragment.ts","../src/compile/types/nodes/NodeType.ts","../src/compile/types/nodes/TemplateNode.ts","../src/compile/types/nodes/ParentNode.ts","../src/compile/types/nodes/RootNode.ts","../src/compile/types/styles/StyleNode.ts","../src/compile/types/styles/Style.ts","../src/types/TemplateComponent.ts","../src/types/Template.ts","../src/compile/types/BuildOptions.ts","../src/compile/types/CompileError.ts","../src/compile/types/SourceMapping.ts","../src/compile/types/BuildResult.ts","../src/compile/build.ts","../src/compile/build/restricted/types.ts","../src/compile/build/restricted/buildRestricted.ts","../src/compile/buildType.ts","../src/compile/types/ParseResult.ts","../src/compile/parse.ts","../src/compile/parse/bindDataTemplate.ts","../src/compile/build/restricted/parseExpression.ts"],"mappings":";;UAAyB;EACxB;EACA;EACA;EACA;EACA;;;;UCLwB;EACxB;EACA;;;;UCAwB;EACxB;EACA,MAAM;;;;UCFkB;EACxB;EACA;EACA;EACA;IACC;IACA,OAAO;IACP;IACA;IACA;;EAED;IACC;IACA;IACA;;EAED;EACA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;KC7CI;;;UCEoB;EACxB,MAAM;EAGN;EAKA;EAKA;;;;UCbwB,mBAAmB;EAC3C,MAAM;EACN,UAAU;;;;UCDc,iBAAiB;EACzC;EACA,UAAU;EAGV,WAAW;;;;UCTa;EACxB;EACA;;;;UCAwB;EACxB;EACA,UAAU;EACV;;;;UCFwB;EACxB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,SA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QAAQ;;UAGQ;EAChB;EACA,MAAM;;UAGU;;EAEhB,cAAc;EACd,YAAY;;UAGI;EAChB,SAAS;EACT;IACC;IACA;;EAED,QALSA;;UAQO;;EAEhB;;EAEA;;UAGgB;EAChB;EACA,MAAM;;EAEN;EACA;EACA;;KAGW,sCACX,MAAM,uBACN,SAAS,iBAAiB,eAAe,sBACzC,UAAU;;;UCxKM,+BAA+B;;;;;;;;;;;iBAiCxB,gBACvB,UAAU,UACV,UAAU,yBACR;;;;;;;;;;;iBCrDqB,UAAU,UAAU,UAAU,UAAU;;;UCTvC;EACxB;EACA,QAAQ;EACR,WAAW;;;;;;;;;;;;iBCKY,MAAM,iBAAiB;;;;;;;;;iBCHvB,iBAAiB,UAAU;;;;;;;;;;;;;;;;;;;;;;qBCctC,8BAA8B;;EAE1C;;EAEA;EAEA,YAAY,iBAAiB,eAAe;;UAwP5B;EAChB,YAAY;;EAEZ;;UAGgB;;;;;;EAMhB;;;;;;;wBAuBe,sBACf,gBACA,iBACA,UAAU,yBACR"}
package/dist/compile.mjs CHANGED
@@ -487,10 +487,11 @@ function addPopDevBoundary(status, b) {
487
487
  function addPushDevBoundary(type, name, status, b) {
488
488
  if (status.options.dev === true) {
489
489
  status.imports.add("t_push_dev_bound");
490
+ name = name.replace(/\s+/g, " ");
490
491
  if (name.startsWith("'") && name.endsWith("'") || name.startsWith("\"") && name.endsWith("\"") || name.startsWith("`") && name.endsWith("`")) {
491
492
  const quote = name[0];
492
493
  name = quote + name.substring(1, name.length - 1).replaceAll(quote, "\\" + quote) + quote;
493
- } else name = `"${name.replaceAll("\"", "\\\"")}"`;
494
+ } else name = JSON.stringify(name);
494
495
  b.append(`t_push_dev_bound("${type}", ${name});`);
495
496
  b.append("");
496
497
  }
@@ -596,7 +597,7 @@ function isReactive(text) {
596
597
  function trimQuotes(text) {
597
598
  let start = 0;
598
599
  let end = text.length;
599
- while (text[start] === "'" && text[end - 1] === "'" || text[start] === "\"" && text[end - 1] === "\"" || text[start] === "`" && text[end - 1] === "`") {
600
+ while (start < end && (text[start] === "'" && text[end - 1] === "'" || text[start] === "\"" && text[end - 1] === "\"" || text[start] === "`" && text[end - 1] === "`")) {
600
601
  start += 1;
601
602
  end -= 1;
602
603
  }
@@ -884,6 +885,21 @@ function isSpecialNode(node) {
884
885
  return node.type === "special";
885
886
  }
886
887
  //#endregion
888
+ //#region src/compile/utils/propKey.ts
889
+ const IDENTIFIER_REGEX = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
890
+ /**
891
+ * Formats a prop name for use as an object key in generated code. Valid
892
+ * identifiers are left unquoted; anything else (e.g. dashed props like
893
+ * `aria-hidden`) is quoted so that the generated code stays valid.
894
+ *
895
+ * @param name The prop name as written on the component or slot
896
+ *
897
+ * @returns The name as an object key text
898
+ */
899
+ function propKey(name) {
900
+ return IDENTIFIER_REGEX.test(name) ? name : JSON.stringify(name);
901
+ }
902
+ //#endregion
887
903
  //#region src/compile/build/utils/nextVarName.ts
888
904
  /**
889
905
  * Makes a supplied variable name (hopefully!) unique by prepending `t_` and
@@ -1705,8 +1721,9 @@ function buildComponentNode(node, status, b, root = false) {
1705
1721
  let value = p.value;
1706
1722
  p.preText ??= "";
1707
1723
  p.postText ??= "";
1708
- if (p.spans.length === 1) addMappedText(p.name ? `${p.name}: ` + p.preText : p.preText, value, p.postText + ",", p.spans[0], status, b);
1709
- else addMappedTextWithOffsets(p.name ? `${p.name}: ` + p.preText : p.preText, value, p.postText + ",", p.spans, p.offsets, p.lengths, status, b);
1724
+ const key = p.name ? `${propKey(p.name)}: ` : "";
1725
+ if (p.spans.length === 1) addMappedText(key + p.preText, value, p.postText + ",", p.spans[0], status, b);
1726
+ else addMappedTextWithOffsets(key + p.preText, value, p.postText + ",", p.spans, p.offsets, p.lengths, status, b);
1710
1727
  }
1711
1728
  b.append("});");
1712
1729
  if (runs.length) buildRun("setProps", runs.join("\n"), status, b);
@@ -2171,8 +2188,10 @@ function buildForNode(node, status, b) {
2171
2188
  appendForVarBindings(b, status, `${node.statement}\n${keyStatement}`);
2172
2189
  addMappedText("", `${node.statement}`, " {", node.span, status, b);
2173
2190
  const dataExpr = singleVar ? forVarNames[0] : `{ ${forVarNames.join(", ")} }`;
2174
- if (key !== void 0) addMappedText(`${listItemsName}.push({ data: ${dataExpr}, key: `, `${keyStatement || "undefined"}`, " });", key.span, status, b);
2175
- else b.append(`${listItemsName}.push({ data: ${dataExpr} });`);
2191
+ if (key !== void 0) {
2192
+ status.imports.add("$peek");
2193
+ addMappedText(`${listItemsName}.push({ data: ${dataExpr}, key: $peek(() => `, `${keyStatement || "undefined"}`, ") });", key.span, status, b);
2194
+ } else b.append(`${listItemsName}.push({ data: ${dataExpr} });`);
2176
2195
  b.append(`}`);
2177
2196
  b.append(`return ${listItemsName};`);
2178
2197
  b.append(`},
@@ -2937,7 +2956,7 @@ function buildSlotNode(node, status, b) {
2937
2956
  b.append(`const ${propsName} = $watch({`);
2938
2957
  for (let p of props) {
2939
2958
  let value = p.value;
2940
- addMappedText(`${p.name}: `, value, ",", p.span, status, b);
2959
+ addMappedText(`${propKey(p.name)}: `, value, ",", p.span, status, b);
2941
2960
  }
2942
2961
  b.append("});");
2943
2962
  if (runs.length) buildRun("setProps", runs.join("\n"), status, b);
@@ -3139,6 +3158,7 @@ function buildCode(template, map, options, errors = [], warnings = []) {
3139
3158
  let imports = /* @__PURE__ */ new Set();
3140
3159
  imports.add("SlotRender");
3141
3160
  buildTemplate(template, map, imports, b, options, errors, warnings);
3161
+ if (imports.has("t_next") && !b.toString().includes("t_next(")) imports.delete("t_next");
3142
3162
  let startSize = b.toString().length;
3143
3163
  if (imports.size) {
3144
3164
  const folder = options?.renderFolder ?? "@torpor/view";
@@ -3372,7 +3392,7 @@ function buildServerComponentNode(node, status, b) {
3372
3392
  });
3373
3393
  }
3374
3394
  b.append(`const ${propsName} = {`);
3375
- for (let p of props) b.append(p.name ? `${p.name}: ${p.value},` : `${p.value},`);
3395
+ for (let p of props) b.append(p.name ? `${propKey(p.name)}: ${p.value},` : `${p.value},`);
3376
3396
  b.append("};");
3377
3397
  }
3378
3398
  const componentHasSlots = node.children.length;
@@ -3662,8 +3682,8 @@ function buildElementAttributes(node, status) {
3662
3682
  status.imports.add("t_style");
3663
3683
  attributes.push(`\${t_style(${value})}`);
3664
3684
  } else {
3665
- status.imports.add("t_attr");
3666
- attributes.push(`\${(${value}) ? \`${name}="\${t_attr(${value})}"\` : ""}`);
3685
+ status.imports.add("t_attr_if");
3686
+ attributes.push(`\${t_attr_if("${name}", ${value})}`);
3667
3687
  }
3668
3688
  } else if (value != null && reactive) {
3669
3689
  status.imports.add("t_attr");
@@ -3809,6 +3829,7 @@ const importsMap = {
3809
3829
  t_await_server: "import { t_await_server } from \"${folder}\";",
3810
3830
  t_fmt: "import { t_fmt } from \"${folder}\";",
3811
3831
  t_attr: "import { t_attr } from \"${folder}\";",
3832
+ t_attr_if: "import { t_attr_if } from \"${folder}\";",
3812
3833
  t_class: "import { t_class } from \"${folder}\";",
3813
3834
  t_style: "import { t_style } from \"${folder}\";",
3814
3835
  t_slot_guard: "import { t_slot_guard } from \"${folder}\";",