marko 6.1.13 → 6.1.15

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.
@@ -19,8 +19,136 @@ function* attrTagIterator() {
19
19
  yield* this[rest];
20
20
  }
21
21
  //#endregion
22
+ //#region src/common/helpers.ts
23
+ const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
24
+ const knownWrongAttrs = {
25
+ className: "class",
26
+ classList: "class",
27
+ htmlFor: "for",
28
+ acceptCharset: "accept-charset",
29
+ httpEquiv: "http-equiv",
30
+ defaultValue: "value",
31
+ defaultChecked: "checked",
32
+ dangerouslySetInnerHTML: "$!{html}",
33
+ key: "<for by>",
34
+ ref: "<tag/ref>",
35
+ "v-if": "<if>",
36
+ "v-else": "<else>",
37
+ "v-else-if": "<else if>",
38
+ "v-for": "<for>",
39
+ "v-show": "<if>",
40
+ "v-model": "value:=state",
41
+ "v-bind": "...attrs",
42
+ "v-html": "$!{html}",
43
+ "v-text": "${text}"
44
+ };
45
+ function getWrongAttrSuggestion(name) {
46
+ const exact = knownWrongAttrs[name];
47
+ if (exact) return exact;
48
+ const colon = name.indexOf(":");
49
+ if (colon > 0) {
50
+ const rest = name.slice(colon + 1);
51
+ switch (name.slice(0, colon)) {
52
+ case "class": return `class={ ${rest}: condition }`;
53
+ case "style": return `style={ ${rest}: value }`;
54
+ case "on":
55
+ case "v-on": return `on${rest.charAt(0).toUpperCase()}${rest.slice(1)}`;
56
+ case "bind":
57
+ case "v-model": return `${rest}:=state`;
58
+ case "v-bind": return rest;
59
+ }
60
+ }
61
+ }
62
+ function stringifyClassObject(name, value) {
63
+ return value ? name : "";
64
+ }
65
+ function stringifyStyleObject(name, value) {
66
+ return value || value === 0 ? name + ":" + value : "";
67
+ }
68
+ const toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
69
+ let str = "";
70
+ let sep = "";
71
+ let part;
72
+ if (val) if (typeof val !== "object") str += val;
73
+ else if (Array.isArray(val)) for (const v of val) {
74
+ part = toDelimitedString(v, delimiter, stringify);
75
+ if (part) {
76
+ str += sep + part;
77
+ sep = delimiter;
78
+ }
79
+ }
80
+ else for (const name in val) {
81
+ part = stringify(name, val[name]);
82
+ if (part) {
83
+ str += sep + part;
84
+ sep = delimiter;
85
+ }
86
+ }
87
+ return str;
88
+ };
89
+ function isEventHandler(name) {
90
+ return /^on[A-Z-]/.test(name);
91
+ }
92
+ function getEventHandlerName(name) {
93
+ return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
94
+ }
95
+ function isVoid(value) {
96
+ return value == null || value === false;
97
+ }
98
+ function isNotVoid(value) {
99
+ return value != null && value !== false;
100
+ }
101
+ function normalizeDynamicRenderer(value) {
102
+ if (value) {
103
+ if (typeof value === "string") return value;
104
+ const normalized = value.content || value.default || value;
105
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
106
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
107
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
108
+ }
109
+ if ("id" in normalized) return normalized;
110
+ }
111
+ }
112
+ //#endregion
22
113
  //#region src/common/errors.ts
23
114
  const lowercaseEventHandlerReg = /^on[a-z]/;
115
+ function assertValidAttrValue(name, value) {
116
+ if (value && typeof value !== "string" && lowercaseEventHandlerReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
117
+ if (typeof value === "function") {
118
+ if (name === "content" || /^on/i.test(name) || /Change$/.test(name)) return;
119
+ throw new Error(`The \`${name}\` attribute cannot be a function.`);
120
+ }
121
+ const unrenderable = describeUnrenderable(value);
122
+ if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
123
+ }
124
+ function assertValidTextValue(value) {
125
+ const unrenderable = describeUnrenderable(value);
126
+ if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
127
+ }
128
+ function describeUnrenderable(value) {
129
+ if (typeof value === "symbol") return "a symbol";
130
+ if (typeof value === "object" && value !== null) {
131
+ let stringified;
132
+ try {
133
+ stringified = `${value}`;
134
+ } catch {
135
+ stringified = "[object Object]";
136
+ }
137
+ if (/^\[object \w+\]$/.test(stringified)) return stringified === "[object Promise]" ? "a promise (use the `<await>` tag to render its resolved value)" : stringified === "[object Object]" ? "a plain object (it would render as `[object Object]`)" : `a value that renders as \`${stringified}\``;
138
+ }
139
+ }
140
+ function assertValidLoopKey(key, seenKeys) {
141
+ if (typeof key !== "string" && typeof key !== "number") throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null ? "null" : `type "${typeof key}"`}.`);
142
+ if (seenKeys) {
143
+ if (seenKeys.has(key)) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a unique value for each item, but \`${key}\` was used more than once.`);
144
+ seenKeys.add(key);
145
+ }
146
+ }
147
+ function assertValidAttrName(name) {
148
+ if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
149
+ const suggestion = getWrongAttrSuggestion(name);
150
+ if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
151
+ }
24
152
  function _el_read_error() {
25
153
  throw new Error("Element references can only be read in scripts and event handlers.");
26
154
  }
@@ -45,9 +173,6 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
45
173
  if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
46
174
  }
47
175
  }
48
- function assertValidEventHandlerAttr(name, value) {
49
- if (value && typeof value !== "string" && lowercaseEventHandlerReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
50
- }
51
176
  function assertHandlerIsFunction(name, value) {
52
177
  if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
53
178
  }
@@ -71,27 +196,32 @@ const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
71
196
  //#endregion
72
197
  //#region src/html/content.ts
73
198
  function _unescaped(val) {
199
+ assertValidTextValue(val);
74
200
  return val ? val + "" : val === 0 ? "0" : "";
75
201
  }
76
202
  const unsafeXMLReg = /[<&]/g;
77
203
  const replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
78
204
  const escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
79
205
  function _escape(val) {
206
+ assertValidTextValue(val);
80
207
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
81
208
  }
82
209
  const unsafeScriptReg = /<\/script/gi;
83
210
  const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
84
211
  function _escape_script(val) {
212
+ assertValidTextValue(val);
85
213
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
86
214
  }
87
215
  const unsafeStyleReg = /<\/style/gi;
88
216
  const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
89
217
  function _escape_style(val) {
218
+ assertValidTextValue(val);
90
219
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
91
220
  }
92
221
  const unsafeCommentReg = />/g;
93
222
  const escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
94
223
  function _escape_comment(val) {
224
+ assertValidTextValue(val);
95
225
  return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
96
226
  }
97
227
  //#endregion
@@ -1157,6 +1287,7 @@ function isCircular(parent, ref) {
1157
1287
  }
1158
1288
  function toObjectKey(name) {
1159
1289
  if (name === "") return "\"\"";
1290
+ if (name === "__proto__") return "[\"__proto__\"]";
1160
1291
  const startChar = name[0];
1161
1292
  if (isDigit(startChar)) {
1162
1293
  if (startChar === "0") {
@@ -1169,7 +1300,7 @@ function toObjectKey(name) {
1169
1300
  }
1170
1301
  function toAccess(accessor) {
1171
1302
  const start = accessor[0];
1172
- return start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
1303
+ return start === "[" ? accessor : start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
1173
1304
  }
1174
1305
  function quote(str, startPos) {
1175
1306
  let result = "";
@@ -1311,55 +1442,6 @@ function patchIteratorNext(proto) {
1311
1442
  proto.next[kTouchedIterator] = true;
1312
1443
  }
1313
1444
  //#endregion
1314
- //#region src/common/helpers.ts
1315
- const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
1316
- function stringifyClassObject(name, value) {
1317
- return value ? name : "";
1318
- }
1319
- function stringifyStyleObject(name, value) {
1320
- return value || value === 0 ? name + ":" + value : "";
1321
- }
1322
- const toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
1323
- let str = "";
1324
- let sep = "";
1325
- let part;
1326
- if (val) if (typeof val !== "object") str += val;
1327
- else if (Array.isArray(val)) for (const v of val) {
1328
- part = toDelimitedString(v, delimiter, stringify);
1329
- if (part) {
1330
- str += sep + part;
1331
- sep = delimiter;
1332
- }
1333
- }
1334
- else for (const name in val) {
1335
- part = stringify(name, val[name]);
1336
- if (part) {
1337
- str += sep + part;
1338
- sep = delimiter;
1339
- }
1340
- }
1341
- return str;
1342
- };
1343
- function isEventHandler(name) {
1344
- return /^on[A-Z-]/.test(name);
1345
- }
1346
- function getEventHandlerName(name) {
1347
- return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
1348
- }
1349
- function isVoid(value) {
1350
- return value == null || value === false;
1351
- }
1352
- function isNotVoid(value) {
1353
- return value != null && value !== false;
1354
- }
1355
- function normalizeDynamicRenderer(value) {
1356
- if (value) {
1357
- if (typeof value === "string") return value;
1358
- const normalized = value.content || value.default || value;
1359
- if ("id" in normalized) return normalized;
1360
- }
1361
- }
1362
- //#endregion
1363
1445
  //#region src/common/for.ts
1364
1446
  function forIn(obj, cb) {
1365
1447
  for (const key in obj) cb(key, obj[key]);
@@ -1402,28 +1484,13 @@ function concat(opt, other) {
1402
1484
  //#endregion
1403
1485
  //#region src/html/for.ts
1404
1486
  function forOfBy(by, item, index) {
1405
- if (by) {
1406
- const key = typeof by === "string" ? item[by] : by(item, index);
1407
- if (typeof key !== "string" && typeof key !== "number") console.error(`A <for> tag's \`by\` attribute must return a string or number, but it returned:`, key);
1408
- return key;
1409
- }
1410
- return index;
1487
+ return by ? typeof by === "string" ? item[by] : by(item, index) : index;
1411
1488
  }
1412
1489
  function forInBy(by, name, value) {
1413
- if (by) {
1414
- const key = by(name, value);
1415
- if (typeof key !== "string" && typeof key !== "number") console.error(`A <for> tag's \`by\` attribute must return a string or number, but it returned:`, key);
1416
- return key;
1417
- }
1418
- return name;
1490
+ return by ? by(name, value) : name;
1419
1491
  }
1420
1492
  function forStepBy(by, index) {
1421
- if (by) {
1422
- const key = by(index);
1423
- if (typeof key !== "string" && typeof key !== "number") console.error(`A <for> tag's \`by\` attribute must return a string or number, but it returned:`, key);
1424
- return key;
1425
- }
1426
- return index;
1493
+ return by ? by(index) : index;
1427
1494
  }
1428
1495
  //#endregion
1429
1496
  //#region src/html/inlined-runtimes.debug.ts
@@ -1684,20 +1751,31 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1684
1751
  }) : forIn(obj, cb), scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1685
1752
  }
1686
1753
  function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1687
- forBranches(by, (each) => each ? forTo(to, from, step, (i) => {
1688
- const itemKey = forStepBy(by, i);
1689
- each(itemKey, itemKey === i, () => cb(i));
1690
- }) : forTo(to, from, step, cb), scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1754
+ forBranches(by, (each) => {
1755
+ let index = 0;
1756
+ return each ? forTo(to, from, step, (value) => {
1757
+ const itemKey = forStepBy(by, value);
1758
+ each(itemKey, itemKey === index++, () => cb(value));
1759
+ }) : forTo(to, from, step, cb);
1760
+ }, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1691
1761
  }
1692
1762
  function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1693
- forBranches(by, (each) => each ? forUntil(to, from, step, (i) => {
1694
- const itemKey = forStepBy(by, i);
1695
- each(itemKey, itemKey === i, () => cb(i));
1696
- }) : forUntil(to, from, step, cb), scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1763
+ forBranches(by, (each) => {
1764
+ let index = 0;
1765
+ return each ? forUntil(to, from, step, (value) => {
1766
+ const itemKey = forStepBy(by, value);
1767
+ each(itemKey, itemKey === index++, () => cb(value));
1768
+ }) : forUntil(to, from, step, cb);
1769
+ }, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1697
1770
  }
1698
1771
  function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1772
+ var seenKeys = /* @__PURE__ */ new Set();
1699
1773
  if (serializeBranch === 0) {
1700
- iterate(0);
1774
+ if (by) iterate((itemKey, _sameAsIndex, render) => {
1775
+ assertValidLoopKey(itemKey, seenKeys);
1776
+ render();
1777
+ });
1778
+ else iterate(0);
1701
1779
  writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, "");
1702
1780
  return;
1703
1781
  }
@@ -1706,13 +1784,9 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
1706
1784
  const resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0);
1707
1785
  let flushBranchIds = "";
1708
1786
  let loopScopes;
1709
- var seenKeys = /* @__PURE__ */ new Set();
1710
1787
  iterate((itemKey, sameAsIndex, render) => {
1711
1788
  const branchId = _peek_scope_id();
1712
- if (by) {
1713
- if (seenKeys.has(itemKey)) console.error(`A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`, itemKey);
1714
- seenKeys.add(itemKey);
1715
- }
1789
+ if (by) assertValidLoopKey(itemKey, seenKeys);
1716
1790
  if (resumeMarker) if (singleNode) flushBranchIds = " " + branchId + flushBranchIds;
1717
1791
  else {
1718
1792
  $chunk.writeHTML(state.mark("[", flushBranchIds));
@@ -2384,12 +2458,24 @@ function _attr_style(value) {
2384
2458
  }
2385
2459
  function _attr_option_value(value) {
2386
2460
  const valueAttr = _attr("value", value);
2387
- return normalizedValueMatches(getContext(kSelectedValue), value) ? valueAttr + " selected" : valueAttr;
2461
+ if (normalizedValueMatches(getContext(kSelectedValue), value)) {
2462
+ {
2463
+ const matched = getContext(kSelectedValueMatched);
2464
+ if (matched) matched.value = true;
2465
+ }
2466
+ return valueAttr + " selected";
2467
+ }
2468
+ return valueAttr;
2388
2469
  }
2389
2470
  const kSelectedValue = Symbol("selectedValue");
2471
+ const kSelectedValueMatched = Symbol("selectedValueMatched");
2390
2472
  function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
2391
2473
  if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange);
2392
- if (content) withContext(kSelectedValue, value, content);
2474
+ if (content) if (valueChange) {
2475
+ const matched = { value: false };
2476
+ withContext(kSelectedValue, value, () => withContext(kSelectedValueMatched, matched, content));
2477
+ if (!matched.value && (Array.isArray(value) ? value.some((v) => normalizeStrAttrValue(v) !== "") : normalizeStrAttrValue(value) !== "")) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
2478
+ } else withContext(kSelectedValue, value, content);
2393
2479
  }
2394
2480
  function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2395
2481
  if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange);
@@ -2428,7 +2514,6 @@ function _attr_nonce() {
2428
2514
  return getChunk().boundary.state.nonceAttr;
2429
2515
  }
2430
2516
  function _attr(name, value) {
2431
- assertValidEventHandlerAttr(name, value);
2432
2517
  return isVoid(value) ? "" : nonVoidAttr(name, value);
2433
2518
  }
2434
2519
  function _attrs(data, nodeAccessor, scopeId, tagName) {
@@ -2473,7 +2558,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2473
2558
  break;
2474
2559
  default:
2475
2560
  if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
2476
- if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
2561
+ assertValidAttrName(name);
2477
2562
  if (isEventHandler(name)) {
2478
2563
  if (!events) {
2479
2564
  events = {};
@@ -2515,6 +2600,7 @@ function stringAttr(name, value) {
2515
2600
  return value && " " + name + attrAssignment(value);
2516
2601
  }
2517
2602
  function nonVoidAttr(name, value) {
2603
+ assertValidAttrValue(name, value);
2518
2604
  switch (typeof value) {
2519
2605
  case "string": return " " + name + attrAssignment(value);
2520
2606
  case "boolean": return " " + name;
@@ -2559,7 +2645,6 @@ const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta
2559
2645
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
2560
2646
  const shouldResume = serializeReason !== 0;
2561
2647
  const renderer = normalizeDynamicRenderer(tag);
2562
- if (renderer && typeof renderer !== "function" && typeof renderer !== "string") throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
2563
2648
  const state = getState();
2564
2649
  const branchId = _peek_scope_id();
2565
2650
  let rendered;
package/dist/dom.js CHANGED
@@ -118,26 +118,6 @@ function attrTags(first, attrs) {
118
118
  function* attrTagIterator() {
119
119
  yield this, yield* this[rest];
120
120
  }
121
- function _assert_hoist(value) {}
122
- //#endregion
123
- //#region src/common/for.ts
124
- function forIn(obj, cb) {
125
- for (let key in obj) cb(key, obj[key]);
126
- }
127
- function forOf(list, cb) {
128
- if (list) {
129
- let i = 0;
130
- for (let item of list) cb(item, i++);
131
- }
132
- }
133
- function forTo(to, from, step, cb) {
134
- let start = from || 0, delta = step || 1;
135
- for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
136
- }
137
- function forUntil(until, from, step, cb) {
138
- let start = from || 0, delta = step || 1;
139
- for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
140
- }
141
121
  //#endregion
142
122
  //#region src/common/helpers.ts
143
123
  function _call(fn, v) {
@@ -165,6 +145,26 @@ function normalizeDynamicRenderer(value) {
165
145
  if ("a" in normalized) return normalized;
166
146
  }
167
147
  }
148
+ function _assert_hoist(value) {}
149
+ //#endregion
150
+ //#region src/common/for.ts
151
+ function forIn(obj, cb) {
152
+ for (let key in obj) cb(key, obj[key]);
153
+ }
154
+ function forOf(list, cb) {
155
+ if (list) {
156
+ let i = 0;
157
+ for (let item of list) cb(item, i++);
158
+ }
159
+ }
160
+ function forTo(to, from, step, cb) {
161
+ let start = from || 0, delta = step || 1;
162
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
163
+ }
164
+ function forUntil(until, from, step, cb) {
165
+ let start = from || 0, delta = step || 1;
166
+ for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
167
+ }
168
168
  //#endregion
169
169
  //#region src/common/opt.ts
170
170
  function toArray(opt) {
@@ -772,7 +772,7 @@ function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
772
772
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
773
773
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
774
774
  for (let name in events) events[name] = 0;
775
- switch (el.tagName) {
775
+ switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
776
776
  case "INPUT":
777
777
  if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
778
778
  else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
package/dist/dom.mjs CHANGED
@@ -117,26 +117,6 @@ function attrTags(first, attrs) {
117
117
  function* attrTagIterator() {
118
118
  yield this, yield* this[rest];
119
119
  }
120
- function _assert_hoist(value) {}
121
- //#endregion
122
- //#region src/common/for.ts
123
- function forIn(obj, cb) {
124
- for (let key in obj) cb(key, obj[key]);
125
- }
126
- function forOf(list, cb) {
127
- if (list) {
128
- let i = 0;
129
- for (let item of list) cb(item, i++);
130
- }
131
- }
132
- function forTo(to, from, step, cb) {
133
- let start = from || 0, delta = step || 1;
134
- for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
135
- }
136
- function forUntil(until, from, step, cb) {
137
- let start = from || 0, delta = step || 1;
138
- for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
139
- }
140
120
  //#endregion
141
121
  //#region src/common/helpers.ts
142
122
  function _call(fn, v) {
@@ -164,6 +144,26 @@ function normalizeDynamicRenderer(value) {
164
144
  if ("a" in normalized) return normalized;
165
145
  }
166
146
  }
147
+ function _assert_hoist(value) {}
148
+ //#endregion
149
+ //#region src/common/for.ts
150
+ function forIn(obj, cb) {
151
+ for (let key in obj) cb(key, obj[key]);
152
+ }
153
+ function forOf(list, cb) {
154
+ if (list) {
155
+ let i = 0;
156
+ for (let item of list) cb(item, i++);
157
+ }
158
+ }
159
+ function forTo(to, from, step, cb) {
160
+ let start = from || 0, delta = step || 1;
161
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
162
+ }
163
+ function forUntil(until, from, step, cb) {
164
+ let start = from || 0, delta = step || 1;
165
+ for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
166
+ }
167
167
  //#endregion
168
168
  //#region src/common/opt.ts
169
169
  function toArray(opt) {
@@ -771,7 +771,7 @@ function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
771
771
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
772
772
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
773
773
  for (let name in events) events[name] = 0;
774
- switch (el.tagName) {
774
+ switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
775
775
  case "INPUT":
776
776
  if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
777
777
  else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
@@ -40,7 +40,7 @@ export declare function getScopeById(scopeId: number | undefined): ScopeInternal
40
40
  export declare function _set_serialize_reason(reason: undefined | 0 | 1): void;
41
41
  export declare function _scope_reason(): 0 | 1 | undefined;
42
42
  export declare function _serialize_if(condition: undefined | 1 | Record<string, 1>, key: string): 1 | undefined;
43
- export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string): 1 | 0;
43
+ export declare function _serialize_guard(condition: undefined | 1 | Record<string, 1>, key: string): 0 | 1;
44
44
  export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: 0 | 1): string;
45
45
  export declare function _sep(shouldResume: 0 | 1): "" | "<!>";
46
46
  export declare function _el(scopeId: number, id: string): () => void;