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
@@ -85,6 +85,7 @@ function stringifyStyleObject(name, value) {
85
85
  warnedStyleKeys.add(name);
86
86
  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-")}\`.`);
87
87
  }
88
+ 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.`);
88
89
  return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
89
90
  }
90
91
  const unsafeStyleAttrReg = /[\\;]/g;
@@ -159,6 +160,13 @@ function assertValidAttrValue(name, value) {
159
160
  function assertValidTextValue(value) {
160
161
  const unrenderable = describeUnrenderable(value);
161
162
  if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
163
+ if (isSilentlyDropped(value)) console.warn(`Text content of \`${describeDropped(value)}\` renders as nothing; convert it to a string or number to render it.`);
164
+ }
165
+ function isSilentlyDropped(value) {
166
+ return value !== value || typeof value === "bigint" && !value;
167
+ }
168
+ function describeDropped(value) {
169
+ return value !== value ? "NaN" : "0n";
162
170
  }
163
171
  function describeUnrenderable(value) {
164
172
  if (typeof value === "symbol") return "a symbol";
@@ -182,6 +190,9 @@ function assertValidLoopKey(key, seenKeys) {
182
190
  function assertValidList(value) {
183
191
  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)}.`);
184
192
  }
193
+ function assertValidRangeStart(name, value) {
194
+ 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)}.`);
195
+ }
185
196
  function assertValidRangeBound(name, value) {
186
197
  if (!isFinite(value)) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
187
198
  }
@@ -527,31 +538,31 @@ const KNOWN_OBJECTS = /* @__PURE__ */ new Map([
527
538
  ]);
528
539
  var State$1 = class {
529
540
  ids = 0;
530
- flush = 0;
541
+ flushId = 0;
531
542
  wroteUndefined = false;
532
543
  buf = [];
533
544
  strs = /* @__PURE__ */ new Map();
534
545
  refs = /* @__PURE__ */ new WeakMap();
535
- assigned = /* @__PURE__ */ new Set();
546
+ pendingAssignments = /* @__PURE__ */ new Set();
536
547
  boundary = void 0;
537
548
  channel = void 0;
538
549
  channelDeps = null;
539
550
  mutated = [];
540
551
  };
541
552
  var Reference = class {
542
- assigns = null;
553
+ assignments = null;
543
554
  calls = null;
544
555
  scopeId = void 0;
545
556
  channel = void 0;
546
557
  parent;
547
558
  accessor;
548
- flush;
559
+ flushId;
549
560
  pos;
550
561
  id;
551
- constructor(parent, accessor, flush, pos = null, id = null) {
562
+ constructor(parent, accessor, flushId, pos = null, id = null) {
552
563
  this.parent = parent;
553
564
  this.accessor = accessor;
554
- this.flush = flush;
565
+ this.flushId = flushId;
555
566
  this.pos = pos;
556
567
  this.id = id;
557
568
  }
@@ -578,7 +589,7 @@ var Serializer = class {
578
589
  this.#state.channel = channel;
579
590
  return writeScopesRoot(this.#state, flushes);
580
591
  } finally {
581
- this.#state.flush++;
592
+ this.#state.flushId++;
582
593
  this.#state.buf = [];
583
594
  }
584
595
  }
@@ -632,7 +643,7 @@ function writeScopesRoot(state, flushes) {
632
643
  }
633
644
  if (nextSlotId !== -1) buf.push("]");
634
645
  let extras = "";
635
- if (state.assigned.size || hasChannelMutations(state)) {
646
+ if (state.pendingAssignments.size || hasChannelMutations(state)) {
636
647
  extras = ",0)";
637
648
  if (fillIndex !== -1) {
638
649
  buf[fillIndex] = "_(" + buf[fillIndex];
@@ -651,21 +662,21 @@ function writeScopesRoot(state, flushes) {
651
662
  }
652
663
  function writeAssigned(state) {
653
664
  let sep = state.buf.length ? "," : "";
654
- if (state.assigned.size) {
655
- const assigned = state.assigned;
656
- state.assigned = /* @__PURE__ */ new Set();
665
+ if (state.pendingAssignments.size) {
666
+ const pending = state.pendingAssignments;
667
+ state.pendingAssignments = /* @__PURE__ */ new Set();
657
668
  let buf = "";
658
669
  let hasCalls = false;
659
- for (const ref of assigned) {
660
- if (ref.assigns) {
661
- buf += sep + assignsToString(ref.assigns, ref.id);
662
- ref.assigns = null;
670
+ for (const ref of pending) {
671
+ if (ref.assignments) {
672
+ buf += sep + assignmentsToString(ref.assignments, ref.id);
673
+ ref.assignments = null;
663
674
  sep = ",";
664
675
  }
665
676
  hasCalls ||= ref.calls !== null;
666
677
  }
667
678
  if (buf) state.buf.push(buf);
668
- if (hasCalls) for (const ref of assigned) {
679
+ if (hasCalls) for (const ref of pending) {
669
680
  if (!ref.calls) continue;
670
681
  for (const { method, args } of ref.calls) {
671
682
  state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
@@ -712,13 +723,16 @@ function writeAssigned(state) {
712
723
  }
713
724
  state.mutated = remaining;
714
725
  }
715
- if (state.assigned.size) writeAssigned(state);
726
+ if (state.pendingAssignments.size) writeAssigned(state);
716
727
  }
717
728
  function writeCallArg(state, val) {
718
729
  if (val === void 0) {
719
730
  state.wroteUndefined = true;
720
731
  state.buf.push("$");
721
- } else if (!writeProp(state, val, null, "")) state.buf.push("void 0");
732
+ } else if (writeProp(state, val, null, "")) {
733
+ const ref = state.refs.get(val) || state.strs.get(val);
734
+ if (ref && ref.id === null) assignId(state, ref);
735
+ } else state.buf.push("void 0");
722
736
  }
723
737
  function hasChannelMutations(state) {
724
738
  return hasMatchingMutations(state.mutated, state.channel?.readyId);
@@ -753,7 +767,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
753
767
  }
754
768
  if (parent && isCircular(parent, ref)) {
755
769
  ensureId(state, ref);
756
- state.assigned.add(ref);
770
+ state.pendingAssignments.add(ref);
757
771
  addAssignment(ref, accessId(state, parent) + toAccess(accessor));
758
772
  return false;
759
773
  }
@@ -762,7 +776,7 @@ function writeReferenceOr(state, write, val, parent, accessor) {
762
776
  }
763
777
  const registered = REGISTRY.get(val);
764
778
  if (registered) return writeRegistered(state, val, parent, accessor, registered);
765
- state.refs.set(val, ref = new Reference(parent, accessor, state.flush, state.buf.length));
779
+ state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length));
766
780
  ref.channel = state.channel;
767
781
  ref.debug = DEBUG.get(val);
768
782
  if (write(state, val, ref)) return true;
@@ -775,7 +789,7 @@ function trackScope(state, val, scopeId) {
775
789
  else newScopeReference(state, val, scopeId);
776
790
  }
777
791
  function newScopeReference(state, val, scopeId) {
778
- const ref = new Reference(null, null, state.flush);
792
+ const ref = new Reference(null, null, state.flushId);
779
793
  ref.scopeId = scopeId;
780
794
  ref.channel = state.channel;
781
795
  state.refs.set(val, ref);
@@ -785,7 +799,7 @@ function newScopeReference(state, val, scopeId) {
785
799
  function writeRegistered(state, val, parent, accessor, registered) {
786
800
  const { scope } = registered;
787
801
  if (scope) {
788
- const ref = new Reference(parent, accessor, state.flush, state.buf.length);
802
+ const ref = new Reference(parent, accessor, state.flushId, state.buf.length);
789
803
  ref.channel = state.channel;
790
804
  state.refs.set(val, ref);
791
805
  ref.debug = DEBUG.get(val);
@@ -805,7 +819,7 @@ function writeString(state, val, parent, accessor) {
805
819
  return true;
806
820
  }
807
821
  } else {
808
- const ref = new Reference(parent, accessor, state.flush, state.buf.length);
822
+ const ref = new Reference(parent, accessor, state.flushId, state.buf.length);
809
823
  ref.channel = state.channel;
810
824
  state.strs.set(val, ref);
811
825
  }
@@ -991,7 +1005,7 @@ function writePromise(state, val, ref) {
991
1005
  }
992
1006
  function newAsyncHandle(state, parent, id) {
993
1007
  const handle = {};
994
- const handleRef = new Reference(parent, null, state.flush, null, id);
1008
+ const handleRef = new Reference(parent, null, state.flushId, null, id);
995
1009
  handleRef.channel = state.channel;
996
1010
  state.refs.set(handle, handleRef);
997
1011
  return handle;
@@ -1002,7 +1016,7 @@ function writeMap(state, val, ref) {
1002
1016
  return true;
1003
1017
  }
1004
1018
  const items = [];
1005
- let assigns;
1019
+ let assignments;
1006
1020
  let needsId;
1007
1021
  let deferring = false;
1008
1022
  let i = 0;
@@ -1015,16 +1029,16 @@ function writeMap(state, val, ref) {
1015
1029
  }
1016
1030
  if (itemKey === val) {
1017
1031
  itemKey = void 0;
1018
- (assigns ||= []).push("a[" + i + "][0]");
1032
+ (assignments ||= []).push("a[" + i + "][0]");
1019
1033
  }
1020
1034
  if (itemValue === val) {
1021
1035
  itemValue = void 0;
1022
- (assigns ||= []).push("a[" + i + "][1]");
1036
+ (assignments ||= []).push("a[" + i + "][1]");
1023
1037
  }
1024
1038
  needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue);
1025
1039
  i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
1026
1040
  }
1027
- 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);
1041
+ 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);
1028
1042
  } else {
1029
1043
  for (let [itemKey, itemValue] of val) {
1030
1044
  if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue))) deferring = true;
@@ -1034,16 +1048,16 @@ function writeMap(state, val, ref) {
1034
1048
  }
1035
1049
  if (itemKey === val) {
1036
1050
  itemKey = 0;
1037
- (assigns ||= []).push("a[" + i + "]");
1051
+ (assignments ||= []).push("a[" + i + "]");
1038
1052
  }
1039
1053
  if (itemValue === val) {
1040
1054
  itemValue = 0;
1041
- (assigns ||= []).push("a[" + (i + 1) + "]");
1055
+ (assignments ||= []).push("a[" + (i + 1) + "]");
1042
1056
  }
1043
1057
  needsId ||= isDedupedMember(itemKey) || isDedupedMember(itemValue);
1044
1058
  i = items.push(itemKey, itemValue);
1045
1059
  }
1046
- 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);
1060
+ 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);
1047
1061
  }
1048
1062
  return true;
1049
1063
  }
@@ -1053,7 +1067,7 @@ function writeSet(state, val, ref) {
1053
1067
  return true;
1054
1068
  }
1055
1069
  const items = [];
1056
- let assigns;
1070
+ let assignments;
1057
1071
  let needsId;
1058
1072
  let deferring = false;
1059
1073
  let i = 0;
@@ -1065,11 +1079,11 @@ function writeSet(state, val, ref) {
1065
1079
  }
1066
1080
  if (item === val) {
1067
1081
  item = 0;
1068
- (assigns ||= []).push("i[" + i + "]");
1082
+ (assignments ||= []).push("i[" + i + "]");
1069
1083
  } else needsId ||= isDedupedMember(item);
1070
1084
  i = items.push(item);
1071
1085
  }
1072
- writeArrayArg(state, ref, items, assigns && "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
1086
+ writeArrayArg(state, ref, items, assignments && "((s,i)=>(" + assignmentsToString(assignments, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
1073
1087
  return true;
1074
1088
  }
1075
1089
  function isAncestorMember(state, container, member) {
@@ -1083,16 +1097,16 @@ function deferCall(state, ref, method, args) {
1083
1097
  method,
1084
1098
  args
1085
1099
  });
1086
- state.assigned.add(ref);
1100
+ state.pendingAssignments.add(ref);
1087
1101
  }
1088
1102
  function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
1089
1103
  if (assignsPrefix || needsId) {
1090
- const arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1104
+ const arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1091
1105
  state.buf.push((assignsPrefix || plainPrefix) + arrayRef.id + "=");
1092
1106
  writeArray(state, items, arrayRef);
1093
1107
  } else {
1094
1108
  state.buf.push(plainPrefix);
1095
- writeArray(state, items, new Reference(ref, null, state.flush, state.buf.length));
1109
+ writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
1096
1110
  }
1097
1111
  state.buf.push(")");
1098
1112
  }
@@ -1136,7 +1150,7 @@ function writeTypedArray(state, val, ref) {
1136
1150
  writeProp(state, val.buffer, ref, "buffer");
1137
1151
  state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.length : "") : "") + ")");
1138
1152
  } else {
1139
- state.refs.set(val.buffer, new Reference(ref, "buffer", state.flush, null));
1153
+ state.refs.set(val.buffer, new Reference(ref, "buffer", state.flushId, null));
1140
1154
  state.buf.push("new " + val.constructor.name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"));
1141
1155
  }
1142
1156
  return true;
@@ -1167,7 +1181,7 @@ function writeAggregateError(state, val, ref) {
1167
1181
  if (inlined) {
1168
1182
  const errorsRef = state.refs.get(val.errors);
1169
1183
  if (errorsRef?.id) {
1170
- state.assigned.add(errorsRef);
1184
+ state.pendingAssignments.add(errorsRef);
1171
1185
  addAssignment(errorsRef, accessId(state, ref) + toAccess("errors"));
1172
1186
  }
1173
1187
  }
@@ -1230,7 +1244,7 @@ function writeRequest(state, val, ref) {
1230
1244
  options += sep + "headers:" + ensureId(state, seenHeaders);
1231
1245
  sep = ",";
1232
1246
  } else {
1233
- state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
1247
+ state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
1234
1248
  const headers = stringEntriesToHeadersInit(val.headers);
1235
1249
  if (headers) {
1236
1250
  options += sep + "headers:" + headers;
@@ -1279,7 +1293,7 @@ function writeResponse(state, val, ref) {
1279
1293
  const seenHeaders = state.refs.get(val.headers);
1280
1294
  if (seenHeaders) options += sep + "headers:" + ensureId(state, seenHeaders);
1281
1295
  else {
1282
- state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
1296
+ state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
1283
1297
  const headers = stringEntriesToHeadersInit(val.headers);
1284
1298
  if (headers) options += sep + "headers:" + headers;
1285
1299
  }
@@ -1300,10 +1314,10 @@ function writeIntl(state, val, name, ref) {
1300
1314
  state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
1301
1315
  let optionsRef;
1302
1316
  if (needsId) {
1303
- optionsRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1317
+ optionsRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1304
1318
  state.buf.push(optionsRef.id + "={");
1305
1319
  } else {
1306
- optionsRef = new Reference(ref, null, state.flush, state.buf.length);
1320
+ optionsRef = new Reference(ref, null, state.flushId, state.buf.length);
1307
1321
  state.buf.push("{");
1308
1322
  }
1309
1323
  writeObjectProps(state, options, optionsRef);
@@ -1364,12 +1378,12 @@ function writeGenerator(state, iter, ref) {
1364
1378
  const heldReturn = returnValue !== void 0 && isAncestorMember(state, ref, returnValue);
1365
1379
  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})(");
1366
1380
  if (needsId) {
1367
- const arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1381
+ const arrayRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1368
1382
  state.buf.push(arrayRef.id + "=");
1369
1383
  writeArray(state, yields, arrayRef);
1370
- } else writeArray(state, yields, new Reference(ref, null, state.flush, state.buf.length));
1384
+ } else writeArray(state, yields, new Reference(ref, null, state.flushId, state.buf.length));
1371
1385
  if (heldReturn) {
1372
- const holder = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1386
+ const holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1373
1387
  state.buf.push("," + holder.id + "={}");
1374
1388
  writeProp(state, returnValue, holder, "v");
1375
1389
  } else if (returnValue !== void 0) {
@@ -1433,7 +1447,7 @@ function writeMaybeIterableProps(state, val, ref) {
1433
1447
  for (const item of val) if (item === val && !(yieldSelf || iterArr.length)) yieldSelf = "yield this;";
1434
1448
  else iterArr.push(item);
1435
1449
  if (iterArr.length) {
1436
- const iterRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1450
+ const iterRef = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
1437
1451
  state.buf.push(sep + "*[(" + iterRef.id + "=");
1438
1452
  writeArray(state, iterArr, iterRef);
1439
1453
  state.buf.push(",Symbol.iterator)](){" + yieldSelf + "yield*" + iterRef.id + "}");
@@ -1603,7 +1617,7 @@ function accessId(state, ref) {
1603
1617
  function assignId(state, ref) {
1604
1618
  const { pos } = ref;
1605
1619
  ref.id = nextRefAccess(state);
1606
- if (pos !== null && ref.flush === state.flush) {
1620
+ if (pos !== null && ref.flushId === state.flushId) {
1607
1621
  if (pos === 0) state.buf[0] = ref.id + "=" + state.buf[0];
1608
1622
  else state.buf[pos - 1] += ref.id + "=";
1609
1623
  return ref.id;
@@ -1620,7 +1634,7 @@ function assignId(state, ref) {
1620
1634
  break;
1621
1635
  }
1622
1636
  }
1623
- if (parent.flush === state.flush || parent.scopeId !== void 0) {
1637
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1624
1638
  accessPrevValue = accessId(state, parent) + accessPrevValue;
1625
1639
  break;
1626
1640
  }
@@ -1628,13 +1642,13 @@ function assignId(state, ref) {
1628
1642
  } while (cur);
1629
1643
  return ref.id + "=" + accessPrevValue;
1630
1644
  }
1631
- function assignsToString(assigns, value) {
1632
- if (assigns.length > 100) return "($=>(" + assigns.join("=$,") + "=$))(" + value + ")";
1633
- return assigns.join("=") + "=" + value;
1645
+ function assignmentsToString(assignments, value) {
1646
+ if (assignments.length > 100) return "($=>(" + assignments.join("=$,") + "=$))(" + value + ")";
1647
+ return assignments.join("=") + "=" + value;
1634
1648
  }
1635
1649
  function addAssignment(ref, assign) {
1636
- if (ref.assigns) ref.assigns.push(assign);
1637
- else ref.assigns = [assign];
1650
+ if (ref.assignments) ref.assignments.push(assign);
1651
+ else ref.assignments = [assign];
1638
1652
  }
1639
1653
  function nextRefAccess(state) {
1640
1654
  return "_." + nextId(state);
@@ -1708,12 +1722,16 @@ function forOf(list, cb) {
1708
1722
  }
1709
1723
  function forTo(to, from, step, cb) {
1710
1724
  assertValidRangeBound("to", to);
1725
+ assertValidRangeStart("from", from);
1726
+ assertValidRangeStart("step", step);
1711
1727
  const start = from || 0;
1712
1728
  const delta = step || 1;
1713
1729
  for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
1714
1730
  }
1715
1731
  function forUntil(until, from, step, cb) {
1716
1732
  assertValidRangeBound("until", until);
1733
+ assertValidRangeStart("from", from);
1734
+ assertValidRangeStart("step", step);
1717
1735
  const start = from || 0;
1718
1736
  const delta = step || 1;
1719
1737
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
@@ -2741,7 +2759,13 @@ function offTick(cb) {
2741
2759
  function flushTickQueue() {
2742
2760
  const queue = tickQueue;
2743
2761
  tickQueue = void 0;
2744
- for (const cb of queue) cb(true);
2762
+ for (const cb of queue) try {
2763
+ cb(true);
2764
+ } catch (err) {
2765
+ tick(() => {
2766
+ throw err;
2767
+ });
2768
+ }
2745
2769
  }
2746
2770
  //#endregion
2747
2771
  //#region src/html/attrs.ts
@@ -2878,16 +2902,14 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2878
2902
  result += _attr_style(value);
2879
2903
  break;
2880
2904
  default:
2881
- if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
2882
- assertValidAttrName(name);
2883
- if (isEventHandler(name)) {
2884
- if (!events) {
2885
- events = {};
2886
- writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
2887
- }
2888
- events[getEventHandlerName(name)] = value;
2889
- } else result += nonVoidAttr(name, value);
2890
- }
2905
+ if (name) assertValidAttrName(name);
2906
+ if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) if (isEventHandler(name)) {
2907
+ if (!events) {
2908
+ events = {};
2909
+ writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
2910
+ }
2911
+ events[getEventHandlerName(name)] = value;
2912
+ } else result += nonVoidAttr(name, value);
2891
2913
  break;
2892
2914
  }
2893
2915
  }
@@ -2903,6 +2925,10 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
2903
2925
  const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
2904
2926
  if (!skip[key]) partial[key] = data[name];
2905
2927
  }
2928
+ assertExclusiveAttrs({
2929
+ ...data,
2930
+ ...skip
2931
+ });
2906
2932
  return _attrs(partial, nodeAccessor, scopeId, tagName);
2907
2933
  }
2908
2934
  function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
@@ -2910,7 +2936,13 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
2910
2936
  _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2911
2937
  }
2912
2938
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
2913
- assertHandlerIsFunction("valueChange", valueChange);
2939
+ assertHandlerIsFunction([
2940
+ "checkedChange",
2941
+ "checkedValueChange",
2942
+ "valueChange",
2943
+ "valueChange",
2944
+ "openChange"
2945
+ ][type], valueChange);
2914
2946
  writeScope(scopeId, serializeType ? {
2915
2947
  [ControlledType + nodeAccessor]: type,
2916
2948
  [ControlledValue + nodeAccessor]: value,
@@ -2932,8 +2964,8 @@ function nonVoidAttr(name, value) {
2932
2964
  }
2933
2965
  return " " + name + attrAssignment(value + "");
2934
2966
  }
2935
- const singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g;
2936
- const doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g;
2967
+ const singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g;
2968
+ const doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g;
2937
2969
  const needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g;
2938
2970
  function attrAssignment(value) {
2939
2971
  return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, "\"") ? "='" + escapeSingleQuotedAttrValue(value) + "'" : "=\"" + escapeDoubleQuotedAttrValue(value) + "\"" : "=" + value : "";
@@ -2942,13 +2974,13 @@ function escapeSingleQuotedAttrValue(value) {
2942
2974
  return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
2943
2975
  }
2944
2976
  function replaceUnsafeSingleQuoteAttrChar(match) {
2945
- return match === "'" ? "&#39;" : "&amp;";
2977
+ return match === "'" ? "&#39;" : match === "\r" ? "&#13;" : "&amp;";
2946
2978
  }
2947
2979
  function escapeDoubleQuotedAttrValue(value) {
2948
2980
  return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
2949
2981
  }
2950
2982
  function replaceUnsafeDoubleQuoteAttrChar(match) {
2951
- return match === "\"" ? "&#34;" : "&amp;";
2983
+ return match === "\"" ? "&#34;" : match === "\r" ? "&#13;" : "&amp;";
2952
2984
  }
2953
2985
  function normalizedValueMatches(a, b) {
2954
2986
  const value = normalizeStrAttrValue(b);
@@ -2976,21 +3008,21 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2976
3008
  rendered = true;
2977
3009
  const renderNative = () => {
2978
3010
  _scope_id();
2979
- _html(`<${renderer}${_attrs(input, `#${renderer}/0`, branchId, renderer)}>`);
3011
+ _html(`<${renderer}${_attrs(input, `#${renderer.toLowerCase()}/0`, branchId, renderer)}>`);
2980
3012
  if (!voidElementsReg.test(renderer)) {
2981
3013
  const renderContent = content || normalizeDynamicRenderer(input.content);
2982
3014
  if (renderer === "textarea") {
2983
3015
  if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
2984
- _html(_attr_textarea_value(branchId, `#${renderer}/0`, input.value, input.valueChange, 1));
3016
+ _html(_attr_textarea_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, 1));
2985
3017
  } else if (renderContent) {
2986
3018
  if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2987
- if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer}/0`, input.value, input.valueChange, renderContent, 1);
2988
- else _dynamic_tag(branchId, `#${renderer}/0`, renderContent, void 0, 0, void 0, serializeReason);
3019
+ if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, renderContent, 1);
3020
+ else _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, serializeReason);
2989
3021
  }
2990
3022
  _html(`</${renderer}>`);
2991
3023
  } else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2992
3024
  const childScope = getScopeById(branchId);
2993
- const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
3025
+ const needsScript = childScope && (childScope[`EventAttributes:#${renderer.toLowerCase()}/0`] || childScope[`ControlledHandler:#${renderer.toLowerCase()}/0`]);
2994
3026
  if (needsScript) {
2995
3027
  writeScope(branchId, { [Renderer]: renderer });
2996
3028
  _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
@@ -3385,6 +3417,7 @@ const compat = {
3385
3417
  peekNextScopeId: _peek_scope_id,
3386
3418
  isInResumedBranch,
3387
3419
  withChunk,
3420
+ getChunk,
3388
3421
  ensureState($global) {
3389
3422
  let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
3390
3423
  if (!state) {
@@ -3426,11 +3459,18 @@ const compat = {
3426
3459
  return compatRegistered;
3427
3460
  };
3428
3461
  },
3429
- flushScript($global) {
3462
+ createChunk($global) {
3430
3463
  const state = this.ensureState($global);
3431
- const boundary = new Boundary(state);
3432
- if (boundary.flush() === 1) throw new Error("Cannot serialize promise across tags/class compat layer.");
3433
- return new Chunk(boundary, null, null, state).flushScript().scripts;
3464
+ return new Chunk(new Boundary(state), null, null, state);
3465
+ },
3466
+ flushScript($global, chunk) {
3467
+ chunk ||= this.createChunk($global);
3468
+ const { boundary } = chunk;
3469
+ switch (boundary.flush()) {
3470
+ case 2: throw boundary.signal.reason;
3471
+ case 1: throw new Error("Cannot serialize promise across tags/class compat layer.");
3472
+ }
3473
+ return chunk.flushScript().scripts;
3434
3474
  },
3435
3475
  render(renderer, willRerender, classAPIOut, component, input, completeChunks, registerChildScope) {
3436
3476
  const state = this.ensureState(classAPIOut.global);