marko 6.3.33 → 6.3.34

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 (59) hide show
  1. package/cheatsheet.md +37 -33
  2. package/dist/common/errors.d.ts +1 -0
  3. package/dist/debug/dom/catch.feat.js +1 -1
  4. package/dist/debug/dom/catch.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +1 -1
  14. package/dist/debug/dom/controllable.feat.mjs +1 -1
  15. package/dist/debug/{dom-CiFITSPN.js → dom-Bj58jt8y.js} +55 -30
  16. package/dist/debug/{dom-BJ93mcSe.mjs → dom-klf8Ec_o.mjs} +55 -30
  17. package/dist/debug/dom.js +3 -1
  18. package/dist/debug/dom.mjs +3 -1
  19. package/dist/debug/html.js +119 -79
  20. package/dist/debug/html.mjs +119 -79
  21. package/dist/dom/catch.feat.js +1 -1
  22. package/dist/dom/catch.feat.mjs +1 -1
  23. package/dist/dom/control-flow.d.ts +3 -1
  24. package/dist/dom/controllable-input.feat.js +1 -1
  25. package/dist/dom/controllable-input.feat.mjs +1 -1
  26. package/dist/dom/controllable-open.feat.js +1 -1
  27. package/dist/dom/controllable-open.feat.mjs +1 -1
  28. package/dist/dom/controllable-select.feat.js +1 -1
  29. package/dist/dom/controllable-select.feat.mjs +1 -1
  30. package/dist/dom/controllable-textarea.feat.js +1 -1
  31. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  32. package/dist/dom/controllable.feat.js +1 -1
  33. package/dist/dom/controllable.feat.mjs +1 -1
  34. package/dist/{dom-Cj4HQ7T_.mjs → dom-6hBvZW7X.mjs} +27 -21
  35. package/dist/{dom-CI-06TZb.js → dom-B-XpL2_H.js} +27 -21
  36. package/dist/dom.js +3 -1
  37. package/dist/dom.mjs +3 -1
  38. package/dist/html/compat.d.ts +4 -2
  39. package/dist/html.js +73 -54
  40. package/dist/html.mjs +73 -54
  41. package/dist/translator/core/client.d.ts +1 -2
  42. package/dist/translator/core/server.d.ts +1 -2
  43. package/dist/translator/core/static.d.ts +1 -2
  44. package/dist/translator/index.js +377 -244
  45. package/dist/translator/util/constants/binding-type.d.ts +1 -0
  46. package/dist/translator/util/references.d.ts +8 -1
  47. package/dist/translator/util/serialize-reasons.d.ts +4 -4
  48. package/dist/translator/util/signals.d.ts +3 -0
  49. package/dist/translator/util/statement-tag.d.ts +2 -0
  50. package/dist/translator/visitors/program/index.d.ts +0 -1
  51. package/package.json +5 -4
  52. package/tags/html-comment.d.marko +2 -0
  53. package/tags/html-script.d.marko +2 -0
  54. package/tags/html-style.d.marko +2 -0
  55. package/tags/let.d.marko +2 -2
  56. package/tags/show.d.marko +6 -0
  57. package/tags/try.d.marko +1 -1
  58. package/tags-html.d.ts +6 -1
  59. /package/dist/translator/util/{get-accessor-char.d.ts → get-accessor-enums.d.ts} +0 -0
@@ -83,6 +83,7 @@ function stringifyStyleObject(name, value) {
83
83
  warnedStyleKeys.add(name);
84
84
  console.warn(`\`${name}\` is not a CSS property name; \`style\` object keys are written verbatim, so it renders as invalid CSS. Use \`${name.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^ms-/, "-ms-")}\`.`);
85
85
  }
86
+ if (value !== value || typeof value === "bigint" && !value) console.warn(`The \`${name}\` style value \`${value !== value ? "NaN" : "0n"}\` drops the declaration; convert it to a string or number to render it.`);
86
87
  return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
87
88
  }
88
89
  const unsafeStyleAttrReg = /[\\;]/g;
@@ -157,6 +158,13 @@ function assertValidAttrValue(name, value) {
157
158
  function assertValidTextValue(value) {
158
159
  const unrenderable = describeUnrenderable(value);
159
160
  if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
161
+ if (isSilentlyDropped(value)) console.warn(`Text content of \`${describeDropped(value)}\` renders as nothing; convert it to a string or number to render it.`);
162
+ }
163
+ function isSilentlyDropped(value) {
164
+ return value !== value || typeof value === "bigint" && !value;
165
+ }
166
+ function describeDropped(value) {
167
+ return value !== value ? "NaN" : "0n";
160
168
  }
161
169
  function describeUnrenderable(value) {
162
170
  if (typeof value === "symbol") return "a symbol";
@@ -180,6 +188,9 @@ function assertValidLoopKey(key, seenKeys) {
180
188
  function assertValidList(value) {
181
189
  if (value && typeof value[Symbol.iterator] !== "function") throw new Error(`A \`<for>\` tag's \`of\` attribute must be an iterable, such as an array, but received ${describeForValue(value)}.`);
182
190
  }
191
+ function assertValidRangeStart(name, value) {
192
+ if (value && (typeof value !== "number" || !isFinite(value))) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
193
+ }
183
194
  function assertValidRangeBound(name, value) {
184
195
  if (!isFinite(value)) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
185
196
  }
@@ -525,31 +536,31 @@ const KNOWN_OBJECTS = /* @__PURE__ */ new Map([
525
536
  ]);
526
537
  var State$1 = class {
527
538
  ids = 0;
528
- flush = 0;
539
+ flushId = 0;
529
540
  wroteUndefined = false;
530
541
  buf = [];
531
542
  strs = /* @__PURE__ */ new Map();
532
543
  refs = /* @__PURE__ */ new WeakMap();
533
- assigned = /* @__PURE__ */ new Set();
544
+ pendingAssignments = /* @__PURE__ */ new Set();
534
545
  boundary = void 0;
535
546
  channel = void 0;
536
547
  channelDeps = null;
537
548
  mutated = [];
538
549
  };
539
550
  var Reference = class {
540
- assigns = null;
551
+ assignments = null;
541
552
  calls = null;
542
553
  scopeId = void 0;
543
554
  channel = void 0;
544
555
  parent;
545
556
  accessor;
546
- flush;
557
+ flushId;
547
558
  pos;
548
559
  id;
549
- constructor(parent, accessor, flush, pos = null, id = null) {
560
+ constructor(parent, accessor, flushId, pos = null, id = null) {
550
561
  this.parent = parent;
551
562
  this.accessor = accessor;
552
- this.flush = flush;
563
+ this.flushId = flushId;
553
564
  this.pos = pos;
554
565
  this.id = id;
555
566
  }
@@ -576,7 +587,7 @@ var Serializer = class {
576
587
  this.#state.channel = channel;
577
588
  return writeScopesRoot(this.#state, flushes);
578
589
  } finally {
579
- this.#state.flush++;
590
+ this.#state.flushId++;
580
591
  this.#state.buf = [];
581
592
  }
582
593
  }
@@ -630,7 +641,7 @@ function writeScopesRoot(state, flushes) {
630
641
  }
631
642
  if (nextSlotId !== -1) buf.push("]");
632
643
  let extras = "";
633
- if (state.assigned.size || hasChannelMutations(state)) {
644
+ if (state.pendingAssignments.size || hasChannelMutations(state)) {
634
645
  extras = ",0)";
635
646
  if (fillIndex !== -1) {
636
647
  buf[fillIndex] = "_(" + buf[fillIndex];
@@ -649,21 +660,21 @@ function writeScopesRoot(state, flushes) {
649
660
  }
650
661
  function writeAssigned(state) {
651
662
  let sep = state.buf.length ? "," : "";
652
- if (state.assigned.size) {
653
- const assigned = state.assigned;
654
- state.assigned = /* @__PURE__ */ new Set();
663
+ if (state.pendingAssignments.size) {
664
+ const pending = state.pendingAssignments;
665
+ state.pendingAssignments = /* @__PURE__ */ new Set();
655
666
  let buf = "";
656
667
  let hasCalls = false;
657
- for (const ref of assigned) {
658
- if (ref.assigns) {
659
- buf += sep + assignsToString(ref.assigns, ref.id);
660
- ref.assigns = null;
668
+ for (const ref of pending) {
669
+ if (ref.assignments) {
670
+ buf += sep + assignmentsToString(ref.assignments, ref.id);
671
+ ref.assignments = null;
661
672
  sep = ",";
662
673
  }
663
674
  hasCalls ||= ref.calls !== null;
664
675
  }
665
676
  if (buf) state.buf.push(buf);
666
- if (hasCalls) for (const ref of assigned) {
677
+ if (hasCalls) for (const ref of pending) {
667
678
  if (!ref.calls) continue;
668
679
  for (const { method, args } of ref.calls) {
669
680
  state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
@@ -710,13 +721,16 @@ function writeAssigned(state) {
710
721
  }
711
722
  state.mutated = remaining;
712
723
  }
713
- if (state.assigned.size) writeAssigned(state);
724
+ if (state.pendingAssignments.size) writeAssigned(state);
714
725
  }
715
726
  function writeCallArg(state, val) {
716
727
  if (val === void 0) {
717
728
  state.wroteUndefined = true;
718
729
  state.buf.push("$");
719
- } else if (!writeProp(state, val, null, "")) state.buf.push("void 0");
730
+ } else if (writeProp(state, val, null, "")) {
731
+ const ref = state.refs.get(val) || state.strs.get(val);
732
+ if (ref && ref.id === null) assignId(state, ref);
733
+ } else state.buf.push("void 0");
720
734
  }
721
735
  function hasChannelMutations(state) {
722
736
  return hasMatchingMutations(state.mutated, state.channel?.readyId);
@@ -751,7 +765,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
751
765
  }
752
766
  if (parent && isCircular(parent, ref)) {
753
767
  ensureId(state, ref);
754
- state.assigned.add(ref);
768
+ state.pendingAssignments.add(ref);
755
769
  addAssignment(ref, accessId(state, parent) + toAccess(accessor));
756
770
  return false;
757
771
  }
@@ -760,7 +774,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
760
774
  }
761
775
  const registered = REGISTRY.get(val);
762
776
  if (registered) return writeRegistered(state, val, parent, accessor, registered);
763
- state.refs.set(val, ref = new Reference(parent, accessor, state.flush, state.buf.length));
777
+ state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length));
764
778
  ref.channel = state.channel;
765
779
  ref.debug = DEBUG.get(val);
766
780
  if (write(state, val, ref)) return true;
@@ -773,7 +787,7 @@ function trackScope(state, val, scopeId) {
773
787
  else newScopeReference(state, val, scopeId);
774
788
  }
775
789
  function newScopeReference(state, val, scopeId) {
776
- const ref = new Reference(null, null, state.flush);
790
+ const ref = new Reference(null, null, state.flushId);
777
791
  ref.scopeId = scopeId;
778
792
  ref.channel = state.channel;
779
793
  state.refs.set(val, ref);
@@ -783,7 +797,7 @@ function newScopeReference(state, val, scopeId) {
783
797
  function writeRegistered(state, val, parent, accessor, registered) {
784
798
  const { scope } = registered;
785
799
  if (scope) {
786
- const ref = new Reference(parent, accessor, state.flush, state.buf.length);
800
+ const ref = new Reference(parent, accessor, state.flushId, state.buf.length);
787
801
  ref.channel = state.channel;
788
802
  state.refs.set(val, ref);
789
803
  ref.debug = DEBUG.get(val);
@@ -803,7 +817,7 @@ function writeString(state, val, parent, accessor) {
803
817
  return true;
804
818
  }
805
819
  } else {
806
- const ref = new Reference(parent, accessor, state.flush, state.buf.length);
820
+ const ref = new Reference(parent, accessor, state.flushId, state.buf.length);
807
821
  ref.channel = state.channel;
808
822
  state.strs.set(val, ref);
809
823
  }
@@ -989,7 +1003,7 @@ function writePromise(state, val, ref) {
989
1003
  }
990
1004
  function newAsyncHandle(state, parent, id) {
991
1005
  const handle = {};
992
- const handleRef = new Reference(parent, null, state.flush, null, id);
1006
+ const handleRef = new Reference(parent, null, state.flushId, null, id);
993
1007
  handleRef.channel = state.channel;
994
1008
  state.refs.set(handle, handleRef);
995
1009
  return handle;
@@ -1000,7 +1014,7 @@ function writeMap(state, val, ref) {
1000
1014
  return true;
1001
1015
  }
1002
1016
  const items = [];
1003
- let assigns;
1017
+ let assignments;
1004
1018
  let needsId;
1005
1019
  let deferring = false;
1006
1020
  let i = 0;
@@ -1013,16 +1027,16 @@ function writeMap(state, val, ref) {
1013
1027
  }
1014
1028
  if (itemKey === val) {
1015
1029
  itemKey = void 0;
1016
- (assigns ||= []).push("a[" + i + "][0]");
1030
+ (assignments ||= []).push("a[" + i + "][0]");
1017
1031
  }
1018
1032
  if (itemValue === val) {
1019
1033
  itemValue = void 0;
1020
- (assigns ||= []).push("a[" + i + "][1]");
1034
+ (assignments ||= []).push("a[" + i + "][1]");
1021
1035
  }
1022
1036
  needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue);
1023
1037
  i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
1024
1038
  }
1025
- writeArrayArg(state, ref, items, assigns && "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
1039
+ writeArrayArg(state, ref, items, assignments && "((m,a)=>(" + assignmentsToString(assignments, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
1026
1040
  } else {
1027
1041
  for (let [itemKey, itemValue] of val) {
1028
1042
  if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue))) deferring = true;
@@ -1032,16 +1046,16 @@ function writeMap(state, val, ref) {
1032
1046
  }
1033
1047
  if (itemKey === val) {
1034
1048
  itemKey = 0;
1035
- (assigns ||= []).push("a[" + i + "]");
1049
+ (assignments ||= []).push("a[" + i + "]");
1036
1050
  }
1037
1051
  if (itemValue === val) {
1038
1052
  itemValue = 0;
1039
- (assigns ||= []).push("a[" + (i + 1) + "]");
1053
+ (assignments ||= []).push("a[" + (i + 1) + "]");
1040
1054
  }
1041
1055
  needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue);
1042
1056
  i = items.push(itemKey, itemValue);
1043
1057
  }
1044
- writeArrayArg(state, ref, items, assigns && "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(", "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(", needsId);
1058
+ writeArrayArg(state, ref, items, assignments && "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignmentsToString(assignments, "new Map") + "))(", "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(", needsId);
1045
1059
  }
1046
1060
  return true;
1047
1061
  }
@@ -1051,7 +1065,7 @@ function writeSet(state, val, ref) {
1051
1065
  return true;
1052
1066
  }
1053
1067
  const items = [];
1054
- let assigns;
1068
+ let assignments;
1055
1069
  let needsId;
1056
1070
  let deferring = false;
1057
1071
  let i = 0;
@@ -1063,11 +1077,11 @@ function writeSet(state, val, ref) {
1063
1077
  }
1064
1078
  if (item === val) {
1065
1079
  item = 0;
1066
- (assigns ||= []).push("i[" + i + "]");
1080
+ (assignments ||= []).push("i[" + i + "]");
1067
1081
  } else needsId ||= isDedupedMember(item);
1068
1082
  i = items.push(item);
1069
1083
  }
1070
- writeArrayArg(state, ref, items, assigns && "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
1084
+ writeArrayArg(state, ref, items, assignments && "((s,i)=>(" + assignmentsToString(assignments, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
1071
1085
  return true;
1072
1086
  }
1073
1087
  function isAncestorMember(state, container, member) {
@@ -1081,16 +1095,16 @@ function deferCall(state, ref, method, args) {
1081
1095
  method,
1082
1096
  args
1083
1097
  });
1084
- state.assigned.add(ref);
1098
+ state.pendingAssignments.add(ref);
1085
1099
  }
1086
1100
  function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
1087
1101
  if (assignsPrefix || needsId) {
1088
- const arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1102
+ const arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1089
1103
  state.buf.push((assignsPrefix || plainPrefix) + arrayRef.id + "=");
1090
1104
  writeArray(state, items, arrayRef);
1091
1105
  } else {
1092
1106
  state.buf.push(plainPrefix);
1093
- writeArray(state, items, new Reference(ref, null, state.flush, state.buf.length));
1107
+ writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
1094
1108
  }
1095
1109
  state.buf.push(")");
1096
1110
  }
@@ -1134,7 +1148,7 @@ function writeTypedArray(state, val, ref) {
1134
1148
  writeProp(state, val.buffer, ref, "buffer");
1135
1149
  state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
1136
1150
  } else {
1137
- state.refs.set(val.buffer, new Reference(ref, "buffer", state.flush, null));
1151
+ state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null));
1138
1152
  state.buf.push("new " + val.constructor.name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"));
1139
1153
  }
1140
1154
  return true;
@@ -1165,7 +1179,7 @@ function writeAggregateError(state, val, ref) {
1165
1179
  if (inlined) {
1166
1180
  const errorsRef = state.refs.get(val.errors);
1167
1181
  if (errorsRef?.id) {
1168
- state.assigned.add(errorsRef);
1182
+ state.pendingAssignments.add(errorsRef);
1169
1183
  addAssignment(errorsRef, accessId(state, ref) + toAccess("errors"));
1170
1184
  }
1171
1185
  }
@@ -1228,7 +1242,7 @@ function writeRequest(state, val, ref) {
1228
1242
  options += sep + "headers:" + ensureId(state, seenHeaders);
1229
1243
  sep = ",";
1230
1244
  } else {
1231
- state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
1245
+ state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
1232
1246
  const headers = stringEntriesToHeadersInit(val.headers);
1233
1247
  if (headers) {
1234
1248
  options += sep + "headers:" + headers;
@@ -1277,7 +1291,7 @@ function writeResponse(state, val, ref) {
1277
1291
  const seenHeaders = state.refs.get(val.headers);
1278
1292
  if (seenHeaders) options += sep + "headers:" + ensureId(state, seenHeaders);
1279
1293
  else {
1280
- state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
1294
+ state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
1281
1295
  const headers = stringEntriesToHeadersInit(val.headers);
1282
1296
  if (headers) options += sep + "headers:" + headers;
1283
1297
  }
@@ -1298,10 +1312,10 @@ function writeIntl(state, val, name, ref) {
1298
1312
  state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
1299
1313
  let optionsRef;
1300
1314
  if (needsId) {
1301
- optionsRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1315
+ optionsRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1302
1316
  state.buf.push(optionsRef.id + "={");
1303
1317
  } else {
1304
- optionsRef = new Reference(ref, null, state.flush, state.buf.length);
1318
+ optionsRef = new Reference(ref, null, state.flushId, state.buf.length);
1305
1319
  state.buf.push("{");
1306
1320
  }
1307
1321
  writeObjectProps(state, options, optionsRef);
@@ -1362,12 +1376,12 @@ function writeGenerator(state, iter, ref) {
1362
1376
  const heldReturn = returnValue !== void 0 && isAncestorMember(state, ref, returnValue);
1363
1377
  state.buf.push(returnValue === void 0 ? "(function*(a){yield*a})(" : heldReturn ? "(function*(a,r){yield*a;return r.v})(" : "(function*(a,r){yield*a;return r})(");
1364
1378
  if (needsId) {
1365
- const arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1379
+ const arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1366
1380
  state.buf.push(arrayRef.id + "=");
1367
1381
  writeArray(state, yields, arrayRef);
1368
- } else writeArray(state, yields, new Reference(ref, null, state.flush, state.buf.length));
1382
+ } else writeArray(state, yields, new Reference(ref, null, state.flushId, state.buf.length));
1369
1383
  if (heldReturn) {
1370
- const holder = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1384
+ const holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1371
1385
  state.buf.push("," + holder.id + "={}");
1372
1386
  writeProp(state, returnValue, holder, "v");
1373
1387
  } else if (returnValue !== void 0) {
@@ -1431,7 +1445,7 @@ function writeMaybeIterableProps(state, val, ref) {
1431
1445
  for (const item of val) if (item === val && !(yieldSelf || iterArr.length)) yieldSelf = "yield this;";
1432
1446
  else iterArr.push(item);
1433
1447
  if (iterArr.length) {
1434
- const iterRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1448
+ const iterRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1435
1449
  state.buf.push(sep + "*[(" + iterRef.id + "=");
1436
1450
  writeArray(state, iterArr, iterRef);
1437
1451
  state.buf.push(",Symbol.iterator)](){" + yieldSelf + "yield*" + iterRef.id + "}");
@@ -1601,7 +1615,7 @@ function accessId(state, ref) {
1601
1615
  function assignId(state, ref) {
1602
1616
  const { pos } = ref;
1603
1617
  ref.id = nextRefAccess(state);
1604
- if (pos !== null && ref.flush === state.flush) {
1618
+ if (pos !== null && ref.flushId === state.flushId) {
1605
1619
  if (pos === 0) state.buf[0] = ref.id + "=" + state.buf[0];
1606
1620
  else state.buf[pos - 1] += ref.id + "=";
1607
1621
  return ref.id;
@@ -1618,7 +1632,7 @@ function assignId(state, ref) {
1618
1632
  break;
1619
1633
  }
1620
1634
  }
1621
- if (parent.flush === state.flush || parent.scopeId !== void 0) {
1635
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1622
1636
  accessPrevValue = accessId(state, parent) + accessPrevValue;
1623
1637
  break;
1624
1638
  }
@@ -1626,13 +1640,13 @@ function assignId(state, ref) {
1626
1640
  } while (cur);
1627
1641
  return ref.id + "=" + accessPrevValue;
1628
1642
  }
1629
- function assignsToString(assigns, value) {
1630
- if (assigns.length > 100) return "($=>(" + assigns.join("=$,") + "=$))(" + value + ")";
1631
- return assigns.join("=") + "=" + value;
1643
+ function assignmentsToString(assignments, value) {
1644
+ if (assignments.length > 100) return "($=>(" + assignments.join("=$,") + "=$))(" + value + ")";
1645
+ return assignments.join("=") + "=" + value;
1632
1646
  }
1633
1647
  function addAssignment(ref, assign) {
1634
- if (ref.assigns) ref.assigns.push(assign);
1635
- else ref.assigns = [assign];
1648
+ if (ref.assignments) ref.assignments.push(assign);
1649
+ else ref.assignments = [assign];
1636
1650
  }
1637
1651
  function nextRefAccess(state) {
1638
1652
  return "_." + nextId(state);
@@ -1706,12 +1720,16 @@ function forOf(list, cb) {
1706
1720
  }
1707
1721
  function forTo(to, from, step, cb) {
1708
1722
  assertValidRangeBound("to", to);
1723
+ assertValidRangeStart("from", from);
1724
+ assertValidRangeStart("step", step);
1709
1725
  const start = from || 0;
1710
1726
  const delta = step || 1;
1711
1727
  for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
1712
1728
  }
1713
1729
  function forUntil(until, from, step, cb) {
1714
1730
  assertValidRangeBound("until", until);
1731
+ assertValidRangeStart("from", from);
1732
+ assertValidRangeStart("step", step);
1715
1733
  const start = from || 0;
1716
1734
  const delta = step || 1;
1717
1735
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
@@ -2739,7 +2757,13 @@ function offTick(cb) {
2739
2757
  function flushTickQueue() {
2740
2758
  const queue = tickQueue;
2741
2759
  tickQueue = void 0;
2742
- for (const cb of queue) cb(true);
2760
+ for (const cb of queue) try {
2761
+ cb(true);
2762
+ } catch (err) {
2763
+ tick(() => {
2764
+ throw err;
2765
+ });
2766
+ }
2743
2767
  }
2744
2768
  //#endregion
2745
2769
  //#region src/html/attrs.ts
@@ -2876,16 +2900,14 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2876
2900
  result += _attr_style(value);
2877
2901
  break;
2878
2902
  default:
2879
- if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
2880
- assertValidAttrName(name);
2881
- if (isEventHandler(name)) {
2882
- if (!events) {
2883
- events = {};
2884
- writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
2885
- }
2886
- events[getEventHandlerName(name)] = value;
2887
- } else result += nonVoidAttr(name, value);
2888
- }
2903
+ if (name) assertValidAttrName(name);
2904
+ if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) if (isEventHandler(name)) {
2905
+ if (!events) {
2906
+ events = {};
2907
+ writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
2908
+ }
2909
+ events[getEventHandlerName(name)] = value;
2910
+ } else result += nonVoidAttr(name, value);
2889
2911
  break;
2890
2912
  }
2891
2913
  }
@@ -2901,6 +2923,10 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
2901
2923
  const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
2902
2924
  if (!skip[key]) partial[key] = data[name];
2903
2925
  }
2926
+ assertExclusiveAttrs({
2927
+ ...data,
2928
+ ...skip
2929
+ });
2904
2930
  return _attrs(partial, nodeAccessor, scopeId, tagName);
2905
2931
  }
2906
2932
  function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
@@ -2908,7 +2934,13 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
2908
2934
  _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2909
2935
  }
2910
2936
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
2911
- assertHandlerIsFunction("valueChange", valueChange);
2937
+ assertHandlerIsFunction([
2938
+ "checkedChange",
2939
+ "checkedValueChange",
2940
+ "valueChange",
2941
+ "valueChange",
2942
+ "openChange"
2943
+ ][type], valueChange);
2912
2944
  writeScope(scopeId, serializeType ? {
2913
2945
  [ControlledType + nodeAccessor]: type,
2914
2946
  [ControlledValue + nodeAccessor]: value,
@@ -2930,8 +2962,8 @@ function nonVoidAttr(name, value) {
2930
2962
  }
2931
2963
  return " " + name + attrAssignment(value + "");
2932
2964
  }
2933
- const singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g;
2934
- const doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g;
2965
+ const singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g;
2966
+ const doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g;
2935
2967
  const needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g;
2936
2968
  function attrAssignment(value) {
2937
2969
  return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, "\"") ? "='" + escapeSingleQuotedAttrValue(value) + "'" : "=\"" + escapeDoubleQuotedAttrValue(value) + "\"" : "=" + value : "";
@@ -2940,13 +2972,13 @@ function escapeSingleQuotedAttrValue(value) {
2940
2972
  return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
2941
2973
  }
2942
2974
  function replaceUnsafeSingleQuoteAttrChar(match) {
2943
- return match === "'" ? "&#39;" : "&amp;";
2975
+ return match === "'" ? "&#39;" : match === "\r" ? "&#13;" : "&amp;";
2944
2976
  }
2945
2977
  function escapeDoubleQuotedAttrValue(value) {
2946
2978
  return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
2947
2979
  }
2948
2980
  function replaceUnsafeDoubleQuoteAttrChar(match) {
2949
- return match === "\"" ? "&#34;" : "&amp;";
2981
+ return match === "\"" ? "&#34;" : match === "\r" ? "&#13;" : "&amp;";
2950
2982
  }
2951
2983
  function normalizedValueMatches(a, b) {
2952
2984
  const value = normalizeStrAttrValue(b);
@@ -2974,21 +3006,21 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2974
3006
  rendered = true;
2975
3007
  const renderNative = () => {
2976
3008
  _scope_id();
2977
- _html(`<${renderer}${_attrs(input, `#${renderer}/0`, branchId, renderer)}>`);
3009
+ _html(`<${renderer}${_attrs(input, `#${renderer.toLowerCase()}/0`, branchId, renderer)}>`);
2978
3010
  if (!voidElementsReg.test(renderer)) {
2979
3011
  const renderContent = content || normalizeDynamicRenderer(input.content);
2980
3012
  if (renderer === "textarea") {
2981
3013
  if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
2982
- _html(_attr_textarea_value(branchId, `#${renderer}/0`, input.value, input.valueChange, 1));
3014
+ _html(_attr_textarea_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, 1));
2983
3015
  } else if (renderContent) {
2984
3016
  if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2985
- if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer}/0`, input.value, input.valueChange, renderContent, 1);
2986
- else _dynamic_tag(branchId, `#${renderer}/0`, renderContent, void 0, 0, void 0, serializeReason);
3017
+ if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, renderContent, 1);
3018
+ else _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, serializeReason);
2987
3019
  }
2988
3020
  _html(`</${renderer}>`);
2989
3021
  } else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2990
3022
  const childScope = getScopeById(branchId);
2991
- const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
3023
+ const needsScript = childScope && (childScope[`EventAttributes:#${renderer.toLowerCase()}/0`] || childScope[`ControlledHandler:#${renderer.toLowerCase()}/0`]);
2992
3024
  if (needsScript) {
2993
3025
  writeScope(branchId, { [Renderer]: renderer });
2994
3026
  _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
@@ -3383,6 +3415,7 @@ const compat = {
3383
3415
  peekNextScopeId: _peek_scope_id,
3384
3416
  isInResumedBranch,
3385
3417
  withChunk,
3418
+ getChunk,
3386
3419
  ensureState($global) {
3387
3420
  let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
3388
3421
  if (!state) {
@@ -3424,11 +3457,18 @@ const compat = {
3424
3457
  return compatRegistered;
3425
3458
  };
3426
3459
  },
3427
- flushScript($global) {
3460
+ createChunk($global) {
3428
3461
  const state = this.ensureState($global);
3429
- const boundary = new Boundary(state);
3430
- if (boundary.flush() === 1) throw new Error("Cannot serialize promise across tags/class compat layer.");
3431
- return new Chunk(boundary, null, null, state).flushScript().scripts;
3462
+ return new Chunk(new Boundary(state), null, null, state);
3463
+ },
3464
+ flushScript($global, chunk) {
3465
+ chunk ||= this.createChunk($global);
3466
+ const { boundary } = chunk;
3467
+ switch (boundary.flush()) {
3468
+ case 2: throw boundary.signal.reason;
3469
+ case 1: throw new Error("Cannot serialize promise across tags/class compat layer.");
3470
+ }
3471
+ return chunk.flushScript().scripts;
3432
3472
  },
3433
3473
  render(renderer, willRerender, classAPIOut, component, input, completeChunks, registerChildScope) {
3434
3474
  const state = this.ensureState(classAPIOut.global);
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js"), handlePendingTry = (fn, scope, branch) => {
1
+ let require_control_flow = require("../dom-B-XpL2_H.js"), handlePendingTry = (fn, scope, branch) => {
2
2
  for (; branch;) {
3
3
  if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
4
4
  branch = branch.N;
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { Jt as caughtError, Xt as placeholderShown, Yt as installCatch, h as renderCatch } from "../dom-Cj4HQ7T_.mjs";
7
+ import { Jt as caughtError, Xt as placeholderShown, Yt as installCatch, h as renderCatch } from "../dom-6hBvZW7X.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
10
10
  if (checkPending || caughtError.has(effects)) {
@@ -14,9 +14,11 @@ export declare const _show: (nodeAccessor: EncodedAccessor, startNodeAccessor?:
14
14
  export declare function patchDynamicTag(fn: <T extends typeof _dynamic_tag>(cond: T) => T): void;
15
15
  export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
16
16
  export declare const _dynamic_tag_content: (nodeAccessor: EncodedAccessor) => Signal<Renderer | undefined>;
17
- export declare function _resume_dynamic_tag(): void;
17
+ export declare const _resume_dynamic_tag: () => typeof dynamicTagScript;
18
+ declare function dynamicTagScript(branch: Scope): void;
18
19
  export declare function setConditionalRenderer<T>(scope: Scope, nodeAccessor: Accessor, newRenderer: T, createBranch: ($global: Scope[typeof AccessorProp.Global], renderer: NonNullable<T>, parentScope: Scope, parentNode: ParentNode) => BranchScope): void;
19
20
  export declare const _for_of: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
20
21
  export declare const _for_in: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
21
22
  export declare const _for_to: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [to: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
22
23
  export declare const _for_until: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [until: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
24
+ export {};
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-B-XpL2_H.js");
2
2
  require_control_flow.R[0] = require_control_flow.w, require_control_flow.R[1] = require_control_flow.S, require_control_flow.R[2] = require_control_flow.k;
3
3
  //#endregion
@@ -1,3 +1,3 @@
1
- import { R as controllableScripts, S as _attr_input_checkedValue_script, k as _attr_input_value_script, w as _attr_input_checked_script } from "../dom-Cj4HQ7T_.mjs";
1
+ import { R as controllableScripts, S as _attr_input_checkedValue_script, k as _attr_input_value_script, w as _attr_input_checked_script } from "../dom-6hBvZW7X.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-B-XpL2_H.js");
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  require_control_flow.R[4] = require_control_flow.v;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as controllableScripts, v as _attr_details_or_dialog_open_script } from "../dom-Cj4HQ7T_.mjs";
1
+ import { R as controllableScripts, v as _attr_details_or_dialog_open_script } from "../dom-6hBvZW7X.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-B-XpL2_H.js");
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  require_control_flow.R[3] = require_control_flow.M;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { M as _attr_select_value_script, R as controllableScripts } from "../dom-Cj4HQ7T_.mjs";
1
+ import { M as _attr_select_value_script, R as controllableScripts } from "../dom-6hBvZW7X.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-B-XpL2_H.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  require_control_flow.R[2] = require_control_flow.k;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as controllableScripts, k as _attr_input_value_script } from "../dom-Cj4HQ7T_.mjs";
1
+ import { R as controllableScripts, k as _attr_input_value_script } from "../dom-6hBvZW7X.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-B-XpL2_H.js");
2
2
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.L.INPUT = require_control_flow.N, require_control_flow.L.TEXTAREA = require_control_flow.I, require_control_flow.L.SELECT = require_control_flow.F, require_control_flow.L.DETAILS = require_control_flow.L.DIALOG = require_control_flow.P;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _controllable_select, I as _controllable_textarea, L as controllableRenders, N as _controllable_input, P as _controllable_open } from "../dom-Cj4HQ7T_.mjs";
1
+ import { F as _controllable_select, I as _controllable_textarea, L as controllableRenders, N as _controllable_input, P as _controllable_open } from "../dom-6hBvZW7X.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";