marko 6.1.12 → 6.1.14

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,7 +19,132 @@ 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 ("id" in normalized) return normalized;
106
+ }
107
+ }
108
+ //#endregion
22
109
  //#region src/common/errors.ts
110
+ const lowercaseEventHandlerReg = /^on[a-z]/;
111
+ function assertValidAttrValue(name, value) {
112
+ 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.`);
113
+ if (typeof value === "function") {
114
+ if (name === "content" || /^on/i.test(name) || /Change$/.test(name)) return;
115
+ throw new Error(`The \`${name}\` attribute cannot be a function.`);
116
+ }
117
+ const unrenderable = describeUnrenderable(value);
118
+ if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
119
+ }
120
+ function assertValidTextValue(value) {
121
+ const unrenderable = describeUnrenderable(value);
122
+ if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
123
+ }
124
+ function describeUnrenderable(value) {
125
+ if (typeof value === "symbol") return "a symbol";
126
+ if (typeof value === "object" && value !== null) {
127
+ let stringified;
128
+ try {
129
+ stringified = `${value}`;
130
+ } catch {
131
+ stringified = "[object Object]";
132
+ }
133
+ 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}\``;
134
+ }
135
+ }
136
+ function assertValidLoopKey(key, seenKeys) {
137
+ 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}"`}.`);
138
+ if (seenKeys) {
139
+ 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.`);
140
+ seenKeys.add(key);
141
+ }
142
+ }
143
+ function assertValidAttrName(name) {
144
+ if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
145
+ const suggestion = getWrongAttrSuggestion(name);
146
+ if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
147
+ }
23
148
  function _el_read_error() {
24
149
  throw new Error("Element references can only be read in scripts and event handlers.");
25
150
  }
@@ -44,6 +169,9 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
44
169
  if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
45
170
  }
46
171
  }
172
+ function assertHandlerIsFunction(name, value) {
173
+ 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}".`);
174
+ }
47
175
  function assertValidTagName(tagName) {
48
176
  if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) throw new Error(`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`);
49
177
  }
@@ -64,27 +192,32 @@ const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
64
192
  //#endregion
65
193
  //#region src/html/content.ts
66
194
  function _unescaped(val) {
195
+ assertValidTextValue(val);
67
196
  return val ? val + "" : val === 0 ? "0" : "";
68
197
  }
69
198
  const unsafeXMLReg = /[<&]/g;
70
199
  const replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
71
200
  const escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
72
201
  function _escape(val) {
202
+ assertValidTextValue(val);
73
203
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
74
204
  }
75
205
  const unsafeScriptReg = /<\/script/gi;
76
206
  const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
77
207
  function _escape_script(val) {
208
+ assertValidTextValue(val);
78
209
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
79
210
  }
80
211
  const unsafeStyleReg = /<\/style/gi;
81
212
  const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
82
213
  function _escape_style(val) {
214
+ assertValidTextValue(val);
83
215
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
84
216
  }
85
217
  const unsafeCommentReg = />/g;
86
218
  const escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str;
87
219
  function _escape_comment(val) {
220
+ assertValidTextValue(val);
88
221
  return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
89
222
  }
90
223
  //#endregion
@@ -1150,6 +1283,7 @@ function isCircular(parent, ref) {
1150
1283
  }
1151
1284
  function toObjectKey(name) {
1152
1285
  if (name === "") return "\"\"";
1286
+ if (name === "__proto__") return "[\"__proto__\"]";
1153
1287
  const startChar = name[0];
1154
1288
  if (isDigit(startChar)) {
1155
1289
  if (startChar === "0") {
@@ -1162,7 +1296,7 @@ function toObjectKey(name) {
1162
1296
  }
1163
1297
  function toAccess(accessor) {
1164
1298
  const start = accessor[0];
1165
- return start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
1299
+ return start === "[" ? accessor : start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
1166
1300
  }
1167
1301
  function quote(str, startPos) {
1168
1302
  let result = "";
@@ -1304,55 +1438,6 @@ function patchIteratorNext(proto) {
1304
1438
  proto.next[kTouchedIterator] = true;
1305
1439
  }
1306
1440
  //#endregion
1307
- //#region src/common/helpers.ts
1308
- const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
1309
- function stringifyClassObject(name, value) {
1310
- return value ? name : "";
1311
- }
1312
- function stringifyStyleObject(name, value) {
1313
- return value || value === 0 ? name + ":" + value : "";
1314
- }
1315
- const toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
1316
- let str = "";
1317
- let sep = "";
1318
- let part;
1319
- if (val) if (typeof val !== "object") str += val;
1320
- else if (Array.isArray(val)) for (const v of val) {
1321
- part = toDelimitedString(v, delimiter, stringify);
1322
- if (part) {
1323
- str += sep + part;
1324
- sep = delimiter;
1325
- }
1326
- }
1327
- else for (const name in val) {
1328
- part = stringify(name, val[name]);
1329
- if (part) {
1330
- str += sep + part;
1331
- sep = delimiter;
1332
- }
1333
- }
1334
- return str;
1335
- };
1336
- function isEventHandler(name) {
1337
- return /^on[A-Z-]/.test(name);
1338
- }
1339
- function getEventHandlerName(name) {
1340
- return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
1341
- }
1342
- function isVoid(value) {
1343
- return value == null || value === false;
1344
- }
1345
- function isNotVoid(value) {
1346
- return value != null && value !== false;
1347
- }
1348
- function normalizeDynamicRenderer(value) {
1349
- if (value) {
1350
- if (typeof value === "string") return value;
1351
- const normalized = value.content || value.default || value;
1352
- if ("id" in normalized) return normalized;
1353
- }
1354
- }
1355
- //#endregion
1356
1441
  //#region src/common/for.ts
1357
1442
  function forIn(obj, cb) {
1358
1443
  for (const key in obj) cb(key, obj[key]);
@@ -1395,19 +1480,13 @@ function concat(opt, other) {
1395
1480
  //#endregion
1396
1481
  //#region src/html/for.ts
1397
1482
  function forOfBy(by, item, index) {
1398
- if (by) {
1399
- if (typeof by === "string") return item[by];
1400
- return by(item, index);
1401
- }
1402
- return index;
1483
+ return by ? typeof by === "string" ? item[by] : by(item, index) : index;
1403
1484
  }
1404
1485
  function forInBy(by, name, value) {
1405
- if (by) return by(name, value);
1406
- return name;
1486
+ return by ? by(name, value) : name;
1407
1487
  }
1408
1488
  function forStepBy(by, index) {
1409
- if (by) return by(index);
1410
- return index;
1489
+ return by ? by(index) : index;
1411
1490
  }
1412
1491
  //#endregion
1413
1492
  //#region src/html/inlined-runtimes.debug.ts
@@ -1668,20 +1747,31 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1668
1747
  }) : forIn(obj, cb), scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1669
1748
  }
1670
1749
  function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1671
- forBranches(by, (each) => each ? forTo(to, from, step, (i) => {
1672
- const itemKey = forStepBy(by, i);
1673
- each(itemKey, itemKey === i, () => cb(i));
1674
- }) : forTo(to, from, step, cb), scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1750
+ forBranches(by, (each) => {
1751
+ let index = 0;
1752
+ return each ? forTo(to, from, step, (value) => {
1753
+ const itemKey = forStepBy(by, value);
1754
+ each(itemKey, itemKey === index++, () => cb(value));
1755
+ }) : forTo(to, from, step, cb);
1756
+ }, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1675
1757
  }
1676
1758
  function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1677
- forBranches(by, (each) => each ? forUntil(to, from, step, (i) => {
1678
- const itemKey = forStepBy(by, i);
1679
- each(itemKey, itemKey === i, () => cb(i));
1680
- }) : forUntil(to, from, step, cb), scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1759
+ forBranches(by, (each) => {
1760
+ let index = 0;
1761
+ return each ? forUntil(to, from, step, (value) => {
1762
+ const itemKey = forStepBy(by, value);
1763
+ each(itemKey, itemKey === index++, () => cb(value));
1764
+ }) : forUntil(to, from, step, cb);
1765
+ }, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
1681
1766
  }
1682
1767
  function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1768
+ var seenKeys = /* @__PURE__ */ new Set();
1683
1769
  if (serializeBranch === 0) {
1684
- iterate(0);
1770
+ if (by) iterate((itemKey, _sameAsIndex, render) => {
1771
+ assertValidLoopKey(itemKey, seenKeys);
1772
+ render();
1773
+ });
1774
+ else iterate(0);
1685
1775
  writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, "");
1686
1776
  return;
1687
1777
  }
@@ -1690,13 +1780,9 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
1690
1780
  const resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0);
1691
1781
  let flushBranchIds = "";
1692
1782
  let loopScopes;
1693
- var seenKeys = /* @__PURE__ */ new Set();
1694
1783
  iterate((itemKey, sameAsIndex, render) => {
1695
1784
  const branchId = _peek_scope_id();
1696
- if (by) {
1697
- 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);
1698
- seenKeys.add(itemKey);
1699
- }
1785
+ if (by) assertValidLoopKey(itemKey, seenKeys);
1700
1786
  if (resumeMarker) if (singleNode) flushBranchIds = " " + branchId + flushBranchIds;
1701
1787
  else {
1702
1788
  $chunk.writeHTML(state.mark("[", flushBranchIds));
@@ -2368,12 +2454,24 @@ function _attr_style(value) {
2368
2454
  }
2369
2455
  function _attr_option_value(value) {
2370
2456
  const valueAttr = _attr("value", value);
2371
- return normalizedValueMatches(getContext(kSelectedValue), value) ? valueAttr + " selected" : valueAttr;
2457
+ if (normalizedValueMatches(getContext(kSelectedValue), value)) {
2458
+ {
2459
+ const matched = getContext(kSelectedValueMatched);
2460
+ if (matched) matched.value = true;
2461
+ }
2462
+ return valueAttr + " selected";
2463
+ }
2464
+ return valueAttr;
2372
2465
  }
2373
2466
  const kSelectedValue = Symbol("selectedValue");
2467
+ const kSelectedValueMatched = Symbol("selectedValueMatched");
2374
2468
  function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
2375
2469
  if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange);
2376
- if (content) withContext(kSelectedValue, value, content);
2470
+ if (content) if (valueChange) {
2471
+ const matched = { value: false };
2472
+ withContext(kSelectedValue, value, () => withContext(kSelectedValueMatched, matched, content));
2473
+ 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);
2474
+ } else withContext(kSelectedValue, value, content);
2377
2475
  }
2378
2476
  function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2379
2477
  if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange);
@@ -2456,7 +2554,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2456
2554
  break;
2457
2555
  default:
2458
2556
  if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
2459
- if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
2557
+ assertValidAttrName(name);
2460
2558
  if (isEventHandler(name)) {
2461
2559
  if (!events) {
2462
2560
  events = {};
@@ -2487,6 +2585,7 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
2487
2585
  _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2488
2586
  }
2489
2587
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
2588
+ assertHandlerIsFunction("valueChange", valueChange);
2490
2589
  writeScope(scopeId, {
2491
2590
  ["ControlledType:" + nodeAccessor]: type,
2492
2591
  ["ControlledValue:" + nodeAccessor]: value,
@@ -2497,6 +2596,7 @@ function stringAttr(name, value) {
2497
2596
  return value && " " + name + attrAssignment(value);
2498
2597
  }
2499
2598
  function nonVoidAttr(name, value) {
2599
+ assertValidAttrValue(name, value);
2500
2600
  switch (typeof value) {
2501
2601
  case "string": return " " + name + attrAssignment(value);
2502
2602
  case "boolean": return " " + name;
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) {
@@ -770,8 +770,9 @@ function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
770
770
  _attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
771
771
  }
772
772
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
773
- let el = scope[nodeAccessor], events, skip;
774
- switch (el.tagName) {
773
+ let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
774
+ for (let name in events) events[name] = 0;
775
+ switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
775
776
  case "INPUT":
776
777
  if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
777
778
  else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
@@ -955,7 +956,7 @@ function _if(nodeAccessor, ...branchesArgs) {
955
956
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
956
957
  for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
957
958
  return enableBranches(), (scope, newBranch) => {
958
- newBranch !== scope[branchAccessor] && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
959
+ newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
959
960
  };
960
961
  }
961
962
  function patchDynamicTag(fn) {
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) {
@@ -769,8 +769,9 @@ function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
769
769
  _attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
770
770
  }
771
771
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
772
- let el = scope[nodeAccessor], events, skip;
773
- switch (el.tagName) {
772
+ let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
773
+ for (let name in events) events[name] = 0;
774
+ switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
774
775
  case "INPUT":
775
776
  if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
776
777
  else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
@@ -954,7 +955,7 @@ function _if(nodeAccessor, ...branchesArgs) {
954
955
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
955
956
  for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
956
957
  return enableBranches(), (scope, newBranch) => {
957
- newBranch !== scope[branchAccessor] && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
958
+ newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
958
959
  };
959
960
  }
960
961
  function patchDynamicTag(fn) {
@@ -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;