marko 6.0.159 → 6.0.161

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.
package/dist/debug/dom.js CHANGED
@@ -365,6 +365,7 @@ function handleDelegated(ev) {
365
365
  }
366
366
 
367
367
  // src/dom/resolve-cursor-position.ts
368
+ var R = /[^\p{L}\p{N}]/gu;
368
369
  function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
369
370
  if (
370
371
  // If initial position is null or false then
@@ -375,26 +376,17 @@ function resolveCursorPosition(inputType2, initialPosition, initialValue, update
375
376
  ) {
376
377
  const before = initialValue.slice(0, initialPosition);
377
378
  const after = initialValue.slice(initialPosition);
378
- if (updatedValue.startsWith(before)) {
379
- return initialPosition;
380
- } else if (updatedValue.endsWith(after)) {
381
- return updatedValue.length - after.length;
382
- } else {
383
- const relevantChars = stripSpacesAndPunctuation(before).length;
384
- let pos = 0;
385
- let relevantIndex = 0;
386
- while (relevantIndex < relevantChars) {
387
- if (stripSpacesAndPunctuation(updatedValue[pos])) relevantIndex++;
388
- pos++;
389
- }
390
- return pos;
379
+ if (updatedValue.startsWith(before)) return initialPosition;
380
+ if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
381
+ let count = before.replace(R, "").length;
382
+ let pos = 0;
383
+ while (count && updatedValue[pos]) {
384
+ if (updatedValue[pos++].replace(R, "")) count--;
391
385
  }
386
+ return pos;
392
387
  }
393
388
  return -1;
394
389
  }
395
- function stripSpacesAndPunctuation(str) {
396
- return str.replace(/[^\p{L}\p{N}]/gu, "");
397
- }
398
390
 
399
391
  // src/dom/parse-html.ts
400
392
  var parsers = {};
@@ -1089,9 +1081,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
1089
1081
  /* read scope id */
1090
1082
  ));
1091
1083
  if (visitType === "*" /* Node */) {
1084
+ const prev = visit.previousSibling;
1092
1085
  visitScope[nextToken(
1093
1086
  /* read accessor */
1094
- )] = visit.previousSibling;
1087
+ )] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
1095
1088
  } else if (branchesEnabled) {
1096
1089
  visitBranches();
1097
1090
  }
@@ -1515,13 +1508,13 @@ function _attr_nonce(scope, nodeAccessor) {
1515
1508
  _attr(scope[nodeAccessor], "nonce", scope["$global" /* Global */].cspNonce);
1516
1509
  }
1517
1510
  function _text(node, value) {
1518
- const normalizedValue = normalizeString(value);
1511
+ const normalizedValue = _to_text(value);
1519
1512
  if (node.data !== normalizedValue) {
1520
1513
  node.data = normalizedValue;
1521
1514
  }
1522
1515
  }
1523
1516
  function _text_content(node, value) {
1524
- const normalizedValue = normalizeString(value);
1517
+ const normalizedValue = _to_text(value);
1525
1518
  if (node.textContent !== normalizedValue) {
1526
1519
  node.textContent = normalizedValue;
1527
1520
  }
@@ -1737,9 +1730,6 @@ function normalizeAttrValue(value) {
1737
1730
  return value === true ? "" : value + "";
1738
1731
  }
1739
1732
  }
1740
- function normalizeString(value) {
1741
- return value || value === 0 ? value + "" : "\u200D";
1742
- }
1743
1733
  function _lifecycle(scope, thisObj, index = 0) {
1744
1734
  const accessor = "Lifecycle:" /* Lifecycle */ + index;
1745
1735
  const instance = scope[accessor];
@@ -249,6 +249,7 @@ function handleDelegated(ev) {
249
249
  }
250
250
 
251
251
  // src/dom/resolve-cursor-position.ts
252
+ var R = /[^\p{L}\p{N}]/gu;
252
253
  function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
253
254
  if (
254
255
  // If initial position is null or false then
@@ -259,26 +260,17 @@ function resolveCursorPosition(inputType2, initialPosition, initialValue, update
259
260
  ) {
260
261
  const before = initialValue.slice(0, initialPosition);
261
262
  const after = initialValue.slice(initialPosition);
262
- if (updatedValue.startsWith(before)) {
263
- return initialPosition;
264
- } else if (updatedValue.endsWith(after)) {
265
- return updatedValue.length - after.length;
266
- } else {
267
- const relevantChars = stripSpacesAndPunctuation(before).length;
268
- let pos = 0;
269
- let relevantIndex = 0;
270
- while (relevantIndex < relevantChars) {
271
- if (stripSpacesAndPunctuation(updatedValue[pos])) relevantIndex++;
272
- pos++;
273
- }
274
- return pos;
263
+ if (updatedValue.startsWith(before)) return initialPosition;
264
+ if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
265
+ let count = before.replace(R, "").length;
266
+ let pos = 0;
267
+ while (count && updatedValue[pos]) {
268
+ if (updatedValue[pos++].replace(R, "")) count--;
275
269
  }
270
+ return pos;
276
271
  }
277
272
  return -1;
278
273
  }
279
- function stripSpacesAndPunctuation(str) {
280
- return str.replace(/[^\p{L}\p{N}]/gu, "");
281
- }
282
274
 
283
275
  // src/dom/parse-html.ts
284
276
  var parsers = {};
@@ -973,9 +965,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
973
965
  /* read scope id */
974
966
  ));
975
967
  if (visitType === "*" /* Node */) {
968
+ const prev = visit.previousSibling;
976
969
  visitScope[nextToken(
977
970
  /* read accessor */
978
- )] = visit.previousSibling;
971
+ )] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
979
972
  } else if (branchesEnabled) {
980
973
  visitBranches();
981
974
  }
@@ -1399,13 +1392,13 @@ function _attr_nonce(scope, nodeAccessor) {
1399
1392
  _attr(scope[nodeAccessor], "nonce", scope["$global" /* Global */].cspNonce);
1400
1393
  }
1401
1394
  function _text(node, value) {
1402
- const normalizedValue = normalizeString(value);
1395
+ const normalizedValue = _to_text(value);
1403
1396
  if (node.data !== normalizedValue) {
1404
1397
  node.data = normalizedValue;
1405
1398
  }
1406
1399
  }
1407
1400
  function _text_content(node, value) {
1408
- const normalizedValue = normalizeString(value);
1401
+ const normalizedValue = _to_text(value);
1409
1402
  if (node.textContent !== normalizedValue) {
1410
1403
  node.textContent = normalizedValue;
1411
1404
  }
@@ -1621,9 +1614,6 @@ function normalizeAttrValue(value) {
1621
1614
  return value === true ? "" : value + "";
1622
1615
  }
1623
1616
  }
1624
- function normalizeString(value) {
1625
- return value || value === 0 ? value + "" : "\u200D";
1626
- }
1627
1617
  function _lifecycle(scope, thisObj, index = 0) {
1628
1618
  const accessor = "Lifecycle:" /* Lifecycle */ + index;
1629
1619
  const instance = scope[accessor];
@@ -49,7 +49,6 @@ __export(html_exports, {
49
49
  _escape: () => _escape,
50
50
  _escape_script: () => _escape_script,
51
51
  _escape_style: () => _escape_style,
52
- _escape_text: () => _escape_text,
53
52
  _existing_scope: () => _existing_scope,
54
53
  _for_in: () => _for_in,
55
54
  _for_of: () => _for_of,
@@ -255,9 +254,6 @@ var unsafeXMLReg = /[<&]/g;
255
254
  var replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
256
255
  var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
257
256
  function _escape(val) {
258
- return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
259
- }
260
- function _escape_text(val) {
261
257
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
262
258
  }
263
259
  var unsafeScriptReg = /<\/script/g;
@@ -2943,7 +2939,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2943
2939
  valueChange
2944
2940
  );
2945
2941
  }
2946
- return _escape_text(value);
2942
+ return _escape(value);
2947
2943
  }
2948
2944
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
2949
2945
  if (valueChange) {
@@ -3770,7 +3766,6 @@ function NOOP3() {
3770
3766
  _escape,
3771
3767
  _escape_script,
3772
3768
  _escape_style,
3773
- _escape_text,
3774
3769
  _existing_scope,
3775
3770
  _for_in,
3776
3771
  _for_of,
@@ -162,9 +162,6 @@ var unsafeXMLReg = /[<&]/g;
162
162
  var replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
163
163
  var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
164
164
  function _escape(val) {
165
- return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
166
- }
167
- function _escape_text(val) {
168
165
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
169
166
  }
170
167
  var unsafeScriptReg = /<\/script/g;
@@ -2850,7 +2847,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2850
2847
  valueChange
2851
2848
  );
2852
2849
  }
2853
- return _escape_text(value);
2850
+ return _escape(value);
2854
2851
  }
2855
2852
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
2856
2853
  if (valueChange) {
@@ -3676,7 +3673,6 @@ export {
3676
3673
  _escape,
3677
3674
  _escape_script,
3678
3675
  _escape_style,
3679
- _escape_text,
3680
3676
  _existing_scope,
3681
3677
  _for_in,
3682
3678
  _for_of,
package/dist/dom.js CHANGED
@@ -224,6 +224,7 @@ function handleDelegated(ev) {
224
224
  }
225
225
 
226
226
  // src/dom/resolve-cursor-position.ts
227
+ var R = /[^\p{L}\p{N}]/gu;
227
228
  function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
228
229
  if (
229
230
  // If initial position is null or false then
@@ -233,22 +234,15 @@ function resolveCursorPosition(inputType2, initialPosition, initialValue, update
233
234
  /kw/.test(inputType2))
234
235
  ) {
235
236
  let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
236
- if (updatedValue.startsWith(before))
237
- return initialPosition;
238
- if (updatedValue.endsWith(after))
239
- return updatedValue.length - after.length;
240
- {
241
- let relevantChars = stripSpacesAndPunctuation(before).length, pos = 0, relevantIndex = 0;
242
- for (; relevantIndex < relevantChars; )
243
- stripSpacesAndPunctuation(updatedValue[pos]) && relevantIndex++, pos++;
244
- return pos;
245
- }
237
+ if (updatedValue.startsWith(before)) return initialPosition;
238
+ if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
239
+ let count = before.replace(R, "").length, pos = 0;
240
+ for (; count && updatedValue[pos]; )
241
+ updatedValue[pos++].replace(R, "") && count--;
242
+ return pos;
246
243
  }
247
244
  return -1;
248
245
  }
249
- function stripSpacesAndPunctuation(str) {
250
- return str.replace(/[^\p{L}\p{N}]/gu, "");
251
- }
252
246
 
253
247
  // src/dom/parse-html.ts
254
248
  var parsers = {};
@@ -639,11 +633,14 @@ function init(runtimeId = "M") {
639
633
  scope.G
640
634
  ))) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId);
641
635
  for (visit of visits = render.v)
642
- lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken(
636
+ if (lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken(
643
637
  /* read scope id */
644
- )), visitType === "*" /* Node */ ? visitScope[nextToken(
645
- /* read accessor */
646
- )] = visit.previousSibling : branchesEnabled && visitBranches();
638
+ )), visitType === "*" /* Node */) {
639
+ let prev = visit.previousSibling;
640
+ visitScope[nextToken(
641
+ /* read accessor */
642
+ )] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
643
+ } else branchesEnabled && visitBranches();
647
644
  return embedEnabled && (render.n ||= visit?.parentNode.insertBefore(
648
645
  new Text(),
649
646
  visit.nextSibling
@@ -919,11 +916,11 @@ function _attr_nonce(scope, nodeAccessor) {
919
916
  _attr(scope[nodeAccessor], "nonce", scope.$.cspNonce);
920
917
  }
921
918
  function _text(node, value) {
922
- let normalizedValue = normalizeString(value);
919
+ let normalizedValue = _to_text(value);
923
920
  node.data !== normalizedValue && (node.data = normalizedValue);
924
921
  }
925
922
  function _text_content(node, value) {
926
- let normalizedValue = normalizeString(value);
923
+ let normalizedValue = _to_text(value);
927
924
  node.textContent !== normalizedValue && (node.textContent = normalizedValue);
928
925
  }
929
926
  function _attrs(scope, nodeAccessor, nextAttrs) {
@@ -1083,9 +1080,6 @@ function normalizeAttrValue(value) {
1083
1080
  if (value || value === 0)
1084
1081
  return value === !0 ? "" : value + "";
1085
1082
  }
1086
- function normalizeString(value) {
1087
- return value || value === 0 ? value + "" : "\u200D";
1088
- }
1089
1083
  function _lifecycle(scope, thisObj, index = 0) {
1090
1084
  let accessor = "K" /* Lifecycle */ + index, instance = scope[accessor];
1091
1085
  instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, thisObj.onMount?.(), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
package/dist/dom.mjs CHANGED
@@ -111,6 +111,7 @@ function handleDelegated(ev) {
111
111
  }
112
112
 
113
113
  // src/dom/resolve-cursor-position.ts
114
+ var R = /[^\p{L}\p{N}]/gu;
114
115
  function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
115
116
  if (
116
117
  // If initial position is null or false then
@@ -120,22 +121,15 @@ function resolveCursorPosition(inputType2, initialPosition, initialValue, update
120
121
  /kw/.test(inputType2))
121
122
  ) {
122
123
  let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
123
- if (updatedValue.startsWith(before))
124
- return initialPosition;
125
- if (updatedValue.endsWith(after))
126
- return updatedValue.length - after.length;
127
- {
128
- let relevantChars = stripSpacesAndPunctuation(before).length, pos = 0, relevantIndex = 0;
129
- for (; relevantIndex < relevantChars; )
130
- stripSpacesAndPunctuation(updatedValue[pos]) && relevantIndex++, pos++;
131
- return pos;
132
- }
124
+ if (updatedValue.startsWith(before)) return initialPosition;
125
+ if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
126
+ let count = before.replace(R, "").length, pos = 0;
127
+ for (; count && updatedValue[pos]; )
128
+ updatedValue[pos++].replace(R, "") && count--;
129
+ return pos;
133
130
  }
134
131
  return -1;
135
132
  }
136
- function stripSpacesAndPunctuation(str) {
137
- return str.replace(/[^\p{L}\p{N}]/gu, "");
138
- }
139
133
 
140
134
  // src/dom/parse-html.ts
141
135
  var parsers = {};
@@ -526,11 +520,14 @@ function init(runtimeId = "M") {
526
520
  scope.G
527
521
  ))) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId);
528
522
  for (visit of visits = render.v)
529
- lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken(
523
+ if (lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken(
530
524
  /* read scope id */
531
- )), visitType === "*" /* Node */ ? visitScope[nextToken(
532
- /* read accessor */
533
- )] = visit.previousSibling : branchesEnabled && visitBranches();
525
+ )), visitType === "*" /* Node */) {
526
+ let prev = visit.previousSibling;
527
+ visitScope[nextToken(
528
+ /* read accessor */
529
+ )] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
530
+ } else branchesEnabled && visitBranches();
534
531
  return embedEnabled && (render.n ||= visit?.parentNode.insertBefore(
535
532
  new Text(),
536
533
  visit.nextSibling
@@ -806,11 +803,11 @@ function _attr_nonce(scope, nodeAccessor) {
806
803
  _attr(scope[nodeAccessor], "nonce", scope.$.cspNonce);
807
804
  }
808
805
  function _text(node, value) {
809
- let normalizedValue = normalizeString(value);
806
+ let normalizedValue = _to_text(value);
810
807
  node.data !== normalizedValue && (node.data = normalizedValue);
811
808
  }
812
809
  function _text_content(node, value) {
813
- let normalizedValue = normalizeString(value);
810
+ let normalizedValue = _to_text(value);
814
811
  node.textContent !== normalizedValue && (node.textContent = normalizedValue);
815
812
  }
816
813
  function _attrs(scope, nodeAccessor, nextAttrs) {
@@ -970,9 +967,6 @@ function normalizeAttrValue(value) {
970
967
  if (value || value === 0)
971
968
  return value === !0 ? "" : value + "";
972
969
  }
973
- function normalizeString(value) {
974
- return value || value === 0 ? value + "" : "\u200D";
975
- }
976
970
  function _lifecycle(scope, thisObj, index = 0) {
977
971
  let accessor = "K" /* Lifecycle */ + index, instance = scope[accessor];
978
972
  instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, thisObj.onMount?.(), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
@@ -1,5 +1,4 @@
1
1
  export declare function _unescaped(val: unknown): string;
2
2
  export declare function _escape(val: unknown): string;
3
- export declare function _escape_text(val: unknown): string;
4
3
  export declare function _escape_script(val: unknown): string;
5
4
  export declare function _escape_style(val: unknown): string;
package/dist/html.d.ts CHANGED
@@ -2,7 +2,7 @@ export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
3
3
  export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
4
4
  export { compat } from "./html/compat";
5
- export { _escape, _escape_script, _escape_style, _escape_text, _unescaped, } from "./html/content";
5
+ export { _escape, _escape_script, _escape_style, _unescaped, } from "./html/content";
6
6
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
7
7
  export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
8
8
  export { _template } from "./html/template";
package/dist/html.js CHANGED
@@ -46,7 +46,6 @@ __export(html_exports, {
46
46
  _escape: () => _escape,
47
47
  _escape_script: () => _escape_script,
48
48
  _escape_style: () => _escape_style,
49
- _escape_text: () => _escape_text,
50
49
  _existing_scope: () => _existing_scope,
51
50
  _for_in: () => _for_in,
52
51
  _for_of: () => _for_of,
@@ -158,9 +157,6 @@ function _unescaped(val) {
158
157
  }
159
158
  var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
160
159
  function _escape(val) {
161
- return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
162
- }
163
- function _escape_text(val) {
164
160
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
165
161
  }
166
162
  var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
@@ -1818,7 +1814,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
1818
1814
  nodeAccessor,
1819
1815
  void 0,
1820
1816
  valueChange
1821
- ), _escape_text(value);
1817
+ ), _escape(value);
1822
1818
  }
1823
1819
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
1824
1820
  return valueChange && writeControlledScope(
@@ -2400,7 +2396,6 @@ function NOOP3() {
2400
2396
  _escape,
2401
2397
  _escape_script,
2402
2398
  _escape_style,
2403
- _escape_text,
2404
2399
  _existing_scope,
2405
2400
  _for_in,
2406
2401
  _for_of,
package/dist/html.mjs CHANGED
@@ -68,9 +68,6 @@ function _unescaped(val) {
68
68
  }
69
69
  var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
70
70
  function _escape(val) {
71
- return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
72
- }
73
- function _escape_text(val) {
74
71
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
75
72
  }
76
73
  var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
@@ -1728,7 +1725,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
1728
1725
  nodeAccessor,
1729
1726
  void 0,
1730
1727
  valueChange
1731
- ), _escape_text(value);
1728
+ ), _escape(value);
1732
1729
  }
1733
1730
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
1734
1731
  return valueChange && writeControlledScope(
@@ -2309,7 +2306,6 @@ export {
2309
2306
  _escape,
2310
2307
  _escape_script,
2311
2308
  _escape_style,
2312
- _escape_text,
2313
2309
  _existing_scope,
2314
2310
  _for_in,
2315
2311
  _for_of,
@@ -1358,6 +1358,9 @@ var scopeExprsBySection = /* @__PURE__ */ new WeakMap();
1358
1358
  var propExprsBySection = /* @__PURE__ */ new WeakMap();
1359
1359
  var serializePropsByBinding = /* @__PURE__ */ new WeakMap();
1360
1360
  var serializePropByModifier = {};
1361
+ function isSameReason(a, b) {
1362
+ return a === b || (a && b ? a !== true && b !== true && compareSources(a, b) === 0 : false);
1363
+ }
1361
1364
  function isForceSerialized(section, prop, prefix2) {
1362
1365
  return true === (prop ? section.serializeReasons.get(getPropKey(section, prop, prefix2)) : section.serializeReason);
1363
1366
  }
@@ -2367,7 +2370,7 @@ var unsafeXMLReg = /[<&]/g;
2367
2370
  var replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
2368
2371
  var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
2369
2372
  function _escape(val) {
2370
- return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
2373
+ return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
2371
2374
  }
2372
2375
  var unsafeScriptReg = /<\/script/g;
2373
2376
  var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
@@ -2774,32 +2777,34 @@ function withLeadingComment(node, value) {
2774
2777
  }
2775
2778
 
2776
2779
  // src/translator/util/serialize-guard.ts
2780
+ var sourcesUtil = new Sorted(compareSources);
2781
+ var [getSectionReasonState] = createSectionState(
2782
+ "serializeReasonState",
2783
+ (section) => ({
2784
+ if: createTypeState(),
2785
+ guard: createTypeState(),
2786
+ declarators: [
2787
+ import_compiler14.types.variableDeclarator(
2788
+ import_compiler14.types.identifier(getSharedUid(`scope${section.id}_reason`, section)),
2789
+ callRuntime("_scope_reason")
2790
+ )
2791
+ ]
2792
+ })
2793
+ );
2794
+ function getScopeReasonDeclaration(section) {
2795
+ return import_compiler14.types.variableDeclaration(
2796
+ "const",
2797
+ getSectionReasonState(section).declarators
2798
+ );
2799
+ }
2777
2800
  function getSerializeGuard(section, reason, optional) {
2778
- if (!isReasonDynamic(reason)) {
2801
+ if (!isReasonDynamic(reason) || isCrossSection(section, reason)) {
2779
2802
  return reason ? optional ? void 0 : withLeadingComment(
2780
2803
  import_compiler14.types.numericLiteral(1),
2781
2804
  getDebugNames(reason === true ? void 0 : reason.state)
2782
2805
  ) : import_compiler14.types.numericLiteral(0);
2783
2806
  }
2784
- let expr;
2785
- for (const [paramsSection, params] of groupParamsBySection(reason.param)) {
2786
- if (!isSameOrChildSection(paramsSection, section)) {
2787
- return optional ? void 0 : withLeadingComment(import_compiler14.types.numericLiteral(1), getDebugNames(params));
2788
- }
2789
- const serializeIdentifier = import_compiler14.types.identifier(
2790
- getSharedUid(`scope${paramsSection.id}_reason`, paramsSection)
2791
- );
2792
- const guard = paramsSection.paramReasonGroups ? callRuntime(
2793
- "_serialize_guard",
2794
- serializeIdentifier,
2795
- withLeadingComment(
2796
- import_compiler14.types.numericLiteral(getParamReasonGroupIndex(paramsSection, params)),
2797
- getDebugNames(params)
2798
- )
2799
- ) : serializeIdentifier;
2800
- expr = expr ? import_compiler14.types.logicalExpression("||", expr, guard) : guard;
2801
- }
2802
- return expr;
2807
+ return getOrHoist(reason, true);
2803
2808
  }
2804
2809
  function getSerializeGuardForAny(section, reasons, optional) {
2805
2810
  if (!reasons || reasons === true) {
@@ -2819,28 +2824,81 @@ function getSerializeGuardForAny(section, reasons, optional) {
2819
2824
  return expr;
2820
2825
  }
2821
2826
  function getExprIfSerialized(section, reason, expr) {
2822
- if (!isReasonDynamic(reason)) {
2827
+ if (!isReasonDynamic(reason) || isCrossSection(section, reason)) {
2823
2828
  return reason && expr;
2824
2829
  }
2825
- let orExpr;
2826
- for (const [paramsSection, params] of groupParamsBySection(reason.param)) {
2827
- if (!isSameOrChildSection(paramsSection, section)) {
2830
+ const guard = getOrHoist(reason, false);
2831
+ return guard ? import_compiler14.types.logicalExpression("&&", guard, expr) : expr;
2832
+ }
2833
+ function getOrHoist(reason, isGuard) {
2834
+ const onlySection = getOnlySection(reason.param);
2835
+ if (onlySection) {
2836
+ const state = getSectionReasonState(onlySection);
2837
+ const tracking = isGuard ? state.guard : state.if;
2838
+ const existingFound = sourcesUtil.find(tracking.hoistedReasons, reason);
2839
+ if (existingFound) {
2840
+ return import_compiler14.types.identifier(tracking.names.get(existingFound));
2841
+ }
2842
+ const guard = buildGuardExpr(onlySection, reason.param, isGuard);
2843
+ const seenFound = sourcesUtil.find(tracking.seenReasons, reason);
2844
+ if (!seenFound) {
2845
+ const expr = import_compiler14.types.parenthesizedExpression(guard);
2846
+ tracking.pending.set(reason, expr);
2847
+ tracking.seenReasons = sourcesUtil.add(tracking.seenReasons, reason);
2828
2848
  return expr;
2829
2849
  }
2830
- const serializeIdentifier = import_compiler14.types.identifier(
2831
- getSharedUid(`scope${paramsSection.id}_reason`, paramsSection)
2850
+ const name2 = generateUid(
2851
+ `${isGuard ? "sg" : "si"}__${getDebugNamesAsIdentifier(reason.param)}`
2832
2852
  );
2833
- const guard = paramsSection.paramReasonGroups ? callRuntime(
2834
- "_serialize_if",
2835
- serializeIdentifier,
2836
- withLeadingComment(
2837
- import_compiler14.types.numericLiteral(getParamReasonGroupIndex(paramsSection, params)),
2838
- getDebugNames(params)
2839
- )
2840
- ) : serializeIdentifier;
2841
- orExpr = orExpr ? import_compiler14.types.logicalExpression("||", orExpr, guard) : guard;
2853
+ tracking.hoistedReasons = sourcesUtil.add(tracking.hoistedReasons, reason);
2854
+ tracking.names.set(reason, name2);
2855
+ state.declarators.push(import_compiler14.types.variableDeclarator(import_compiler14.types.identifier(name2), guard));
2856
+ const pendingParen = tracking.pending.get(seenFound);
2857
+ if (pendingParen) {
2858
+ pendingParen.expression = import_compiler14.types.identifier(name2);
2859
+ tracking.pending.delete(seenFound);
2860
+ }
2861
+ return import_compiler14.types.parenthesizedExpression(import_compiler14.types.identifier(name2));
2842
2862
  }
2843
- return import_compiler14.types.logicalExpression("&&", orExpr, expr);
2863
+ let orExpr;
2864
+ for (const [paramsSection, params] of groupParamsBySection(reason.param)) {
2865
+ const expr = buildGuardExpr(paramsSection, params, isGuard);
2866
+ orExpr = orExpr ? import_compiler14.types.logicalExpression("||", orExpr, expr) : expr;
2867
+ }
2868
+ return orExpr;
2869
+ }
2870
+ function buildGuardExpr(paramsSection, params, isGuard) {
2871
+ const serializeIdentifier = import_compiler14.types.identifier(
2872
+ getSharedUid(`scope${paramsSection.id}_reason`, paramsSection)
2873
+ );
2874
+ return paramsSection.paramReasonGroups ? callRuntime(
2875
+ isGuard ? "_serialize_guard" : "_serialize_if",
2876
+ serializeIdentifier,
2877
+ withLeadingComment(
2878
+ import_compiler14.types.numericLiteral(getParamReasonGroupIndex(paramsSection, params)),
2879
+ getDebugNames(params)
2880
+ )
2881
+ ) : serializeIdentifier;
2882
+ }
2883
+ function getOnlySection(params) {
2884
+ if (params === void 0) return void 0;
2885
+ if (!Array.isArray(params)) return params.section;
2886
+ const { section } = params[0];
2887
+ return section === params[params.length - 1].section ? section : void 0;
2888
+ }
2889
+ function isCrossSection(section, reason) {
2890
+ return some(
2891
+ reason.param,
2892
+ (param) => !isSameOrChildSection(param.section, section)
2893
+ );
2894
+ }
2895
+ function createTypeState() {
2896
+ return {
2897
+ names: /* @__PURE__ */ new Map(),
2898
+ pending: /* @__PURE__ */ new Map(),
2899
+ seenReasons: void 0,
2900
+ hoistedReasons: void 0
2901
+ };
2844
2902
  }
2845
2903
 
2846
2904
  // src/translator/util/walks.ts
@@ -3448,7 +3506,7 @@ function getBindingGetterIdentifier(binding, getterSection) {
3448
3506
  }
3449
3507
  return identifier;
3450
3508
  }
3451
- function getSignal(section, referencedBindings, name2 = generateSignalName(referencedBindings)) {
3509
+ function getSignal(section, referencedBindings, name2) {
3452
3510
  if (referencedBindings && !Array.isArray(referencedBindings)) {
3453
3511
  if (referencedBindings.type === 6 /* constant */) {
3454
3512
  return getSignal(section, void 0);
@@ -3463,12 +3521,13 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
3463
3521
  const signals = getSignals(section);
3464
3522
  let signal = signals.get(referencedBindings);
3465
3523
  if (!signal) {
3524
+ const signalName = name2 ?? (referencedBindings ? getDebugNamesAsIdentifier(referencedBindings) : "setup");
3466
3525
  const exportName = referencedBindings ? !Array.isArray(referencedBindings) && referencedBindings.section === section && referencedBindings.export : !section.parent && (0, import_babel_utils15.getProgram)().node.extra.domExports?.setup;
3467
3526
  signals.set(
3468
3527
  referencedBindings,
3469
3528
  signal = {
3470
3529
  identifier: exportName ? import_compiler22.types.identifier(exportName) : generateUidIdentifier(
3471
- section.name ? `${section.name}__${name2}` : name2
3530
+ section.name ? `${section.name}__${signalName}` : signalName
3472
3531
  ),
3473
3532
  referencedBindings,
3474
3533
  section,
@@ -3803,26 +3862,6 @@ function subscribe(references, subscriber) {
3803
3862
  });
3804
3863
  }
3805
3864
  }
3806
- function generateSignalName(referencedBindings) {
3807
- let name2;
3808
- if (referencedBindings) {
3809
- if (Array.isArray(referencedBindings)) {
3810
- name2 = "";
3811
- for (const ref of referencedBindings) {
3812
- if (name2) {
3813
- name2 += `__OR__${ref.name.replace(/^\$/, "")}`;
3814
- } else {
3815
- name2 = ref.name;
3816
- }
3817
- }
3818
- } else {
3819
- name2 = referencedBindings.name;
3820
- }
3821
- } else {
3822
- name2 = "setup";
3823
- }
3824
- return name2;
3825
- }
3826
3865
  function replaceNullishAndEmptyFunctionsWith0(args) {
3827
3866
  const len = args.length;
3828
3867
  let finalLen = void 0;
@@ -4170,6 +4209,10 @@ function writeHTMLResumeStatements(path7) {
4170
4209
  const serializedLookup = getSerializedAccessors(section);
4171
4210
  const serializedProperties = [];
4172
4211
  const sectionSerializeReason = nonAnalyzedForceSerializedSection.has(section) ? true : section.serializeReason;
4212
+ const ifSerialized = (reason, expr) => {
4213
+ if (isSameReason(sectionSerializeReason, reason)) return expr;
4214
+ return getExprIfSerialized(section, reason, expr);
4215
+ };
4173
4216
  let debugVars;
4174
4217
  const writeSerializedBinding = (binding) => {
4175
4218
  const reason = getSerializeReason(section, binding);
@@ -4179,11 +4222,7 @@ function writeHTMLResumeStatements(path7) {
4179
4222
  serializedProperties.push(
4180
4223
  toObjectProperty(
4181
4224
  accessor,
4182
- sectionSerializeReason && (sectionSerializeReason === reason || sectionSerializeReason !== true && reason !== true && compareSources(sectionSerializeReason, reason) === 0) ? getDeclaredBindingExpression(binding) : getExprIfSerialized(
4183
- section,
4184
- reason,
4185
- getDeclaredBindingExpression(binding)
4186
- )
4225
+ ifSerialized(reason, getDeclaredBindingExpression(binding))
4187
4226
  )
4188
4227
  );
4189
4228
  if (debug) {
@@ -4209,22 +4248,21 @@ function writeHTMLResumeStatements(path7) {
4209
4248
  const ownerAccessor = getAccessorProp().Owner;
4210
4249
  const ownerReason = getSerializeReason(section, ownerAccessor);
4211
4250
  if (ownerReason) {
4212
- const getOwnerExpr = callRuntime(
4213
- "_scope_with_id",
4214
- getScopeIdIdentifier(section.parent)
4215
- );
4216
4251
  serializedLookup.delete(ownerAccessor);
4217
4252
  serializedProperties.push(
4218
4253
  toObjectProperty(
4219
4254
  ownerAccessor,
4220
- sectionSerializeReason && (sectionSerializeReason === ownerReason || sectionSerializeReason !== true && ownerReason !== true && compareSources(sectionSerializeReason, ownerReason) === 0) ? getOwnerExpr : getExprIfSerialized(section, ownerReason, getOwnerExpr)
4255
+ ifSerialized(
4256
+ ownerReason,
4257
+ callRuntime("_scope_with_id", getScopeIdIdentifier(section.parent))
4258
+ )
4221
4259
  )
4222
4260
  );
4223
4261
  }
4224
4262
  }
4225
4263
  for (const [key, { expression, reason }] of serializedLookup) {
4226
4264
  serializedProperties.push(
4227
- toObjectProperty(key, getExprIfSerialized(section, reason, expression))
4265
+ toObjectProperty(key, ifSerialized(reason, expression))
4228
4266
  );
4229
4267
  }
4230
4268
  if (sectionSerializeReason) {
@@ -4437,11 +4475,22 @@ function getBuildAssignment(extra) {
4437
4475
  const { assignmentTo, assignment } = extra;
4438
4476
  if (assignmentTo) {
4439
4477
  return (section, value) => {
4440
- const replacement = callRuntime(
4441
- "_call",
4442
- createScopeReadExpression(assignmentTo, section),
4443
- value
4444
- );
4478
+ let scopeRead;
4479
+ if (assignmentTo.pruned) {
4480
+ let cur = assignmentTo;
4481
+ const props = [];
4482
+ while (cur.pruned && cur.property !== void 0 && cur.upstreamAlias) {
4483
+ props.push(cur.property);
4484
+ cur = cur.upstreamAlias;
4485
+ }
4486
+ scopeRead = createScopeReadExpression(cur, section);
4487
+ for (let i = props.length; i--; ) {
4488
+ scopeRead = toMemberExpression(scopeRead, props[i], false);
4489
+ }
4490
+ } else {
4491
+ scopeRead = createScopeReadExpression(assignmentTo, section);
4492
+ }
4493
+ const replacement = callRuntime("_call", scopeRead, value);
4445
4494
  updateExpressions.add(replacement);
4446
4495
  return replacement;
4447
4496
  };
@@ -4768,14 +4817,7 @@ var html_default = {
4768
4817
  }
4769
4818
  }
4770
4819
  if (dynamicSerializeReason) {
4771
- renderContent.push(
4772
- import_compiler24.types.variableDeclaration("const", [
4773
- import_compiler24.types.variableDeclarator(
4774
- import_compiler24.types.identifier(getSharedUid(`scope${section.id}_reason`, section)),
4775
- callRuntime("_scope_reason")
4776
- )
4777
- ])
4778
- );
4820
+ renderContent.push(getScopeReasonDeclaration(section));
4779
4821
  } else {
4780
4822
  renderContent.push(import_compiler24.types.expressionStatement(callRuntime("_scope_reason")));
4781
4823
  }
@@ -5859,7 +5901,7 @@ var native_tag_default = {
5859
5901
  valueChange
5860
5902
  );
5861
5903
  } else if (value) {
5862
- writeAtStartOfBody = callRuntime("_escape_text", value);
5904
+ writeAtStartOfBody = callRuntime("_escape", value);
5863
5905
  }
5864
5906
  }
5865
5907
  for (const attr of staticAttrs) {
@@ -6518,7 +6560,7 @@ function getTextOnlyEscapeHelper(tagName) {
6518
6560
  case "style":
6519
6561
  return "_escape_style";
6520
6562
  default:
6521
- return "_escape_text";
6563
+ return "_escape";
6522
6564
  }
6523
6565
  }
6524
6566
  function trackDelimitedAttrValue(expr, meta) {
@@ -7326,16 +7368,7 @@ function buildContent(body) {
7326
7368
  }
7327
7369
  }
7328
7370
  if (dynamicSerializeReason) {
7329
- body.node.body.unshift(
7330
- import_compiler35.types.variableDeclaration("const", [
7331
- import_compiler35.types.variableDeclarator(
7332
- import_compiler35.types.identifier(
7333
- getSharedUid(`scope${bodySection.id}_reason`, bodySection)
7334
- ),
7335
- callRuntime("_scope_reason")
7336
- )
7337
- ])
7338
- );
7371
+ body.node.body.unshift(getScopeReasonDeclaration(bodySection));
7339
7372
  } else {
7340
7373
  body.node.body.unshift(
7341
7374
  import_compiler35.types.expressionStatement(callRuntime("_scope_reason"))
@@ -8875,7 +8908,6 @@ function trackAssignment(assignment, binding) {
8875
8908
  true
8876
8909
  );
8877
8910
  idExtra.assignmentTo = changeBinding;
8878
- changeBinding.pruned = false;
8879
8911
  addReadToExpression(id, changeBinding, void 0);
8880
8912
  }
8881
8913
  }
@@ -9685,6 +9717,29 @@ function getDebugName(binding) {
9685
9717
  function getDebugNames(refs) {
9686
9718
  return mapToString(refs, ", ", getDebugName);
9687
9719
  }
9720
+ function getDebugNamesAsIdentifier(refs) {
9721
+ return mapToString(refs, "__OR__", getDebugNameAsIdentifier);
9722
+ }
9723
+ function getDebugNameAsIdentifier(binding) {
9724
+ let root = binding;
9725
+ let access = "";
9726
+ if (binding.type === 2 /* input */) {
9727
+ while (root.upstreamAlias !== root.section.params && root.excludeProperties === void 0) {
9728
+ if (root.property !== void 0) {
9729
+ access = `_${root.property.replace(/[^a-z0-9_$]/gi, "_") + access}`;
9730
+ }
9731
+ root = root.upstreamAlias;
9732
+ }
9733
+ } else {
9734
+ while (!(root.loc || root.declared) && root.upstreamAlias && root.excludeProperties === void 0) {
9735
+ if (root.property !== void 0) {
9736
+ access = `_${root.property.replace(/[^a-z0-9_$]/gi, "_") + access}`;
9737
+ }
9738
+ root = root.upstreamAlias;
9739
+ }
9740
+ }
9741
+ return root.name + access;
9742
+ }
9688
9743
  function getSectionInstancesAccessor(section) {
9689
9744
  return section.sectionAccessor ? section.sectionAccessor.prefix + getScopeAccessor(section.sectionAccessor.binding) : getAccessorPrefix().ClosureScopes + section.id;
9690
9745
  }
@@ -9942,7 +9997,12 @@ function resolveReferencedBindings(expr, reads, intersectionsBySection) {
9942
9997
  hoistedBindings = bindingUtil.add(hoistedBindings, binding);
9943
9998
  }
9944
9999
  } else {
9945
- if (extra.assignmentTo !== binding) {
10000
+ if (extra.assignmentTo === binding) {
10001
+ const upstreamRoot = binding.upstreamAlias && findClosestReference(binding.upstreamAlias, rootBindings);
10002
+ if (upstreamRoot) {
10003
+ binding = upstreamRoot;
10004
+ }
10005
+ } else {
9946
10006
  extra.section = expr.section;
9947
10007
  ({ binding } = extra.read ??= resolveExpressionReference(
9948
10008
  rootBindings,
@@ -10761,7 +10821,7 @@ var html_comment_default = {
10761
10821
  if (import_compiler45.types.isMarkoText(child)) {
10762
10822
  write`${child.value}`;
10763
10823
  } else if (import_compiler45.types.isMarkoPlaceholder(child)) {
10764
- write`${callRuntime("_escape_text", child.value)}`;
10824
+ write`${callRuntime("_escape", child.value)}`;
10765
10825
  }
10766
10826
  }
10767
10827
  } else {
@@ -137,6 +137,8 @@ export declare function getDebugScopeAccess(binding: Binding): {
137
137
  };
138
138
  export declare function getDebugName(binding: Binding): string;
139
139
  export declare function getDebugNames(refs: ReferencedBindings): string;
140
+ export declare function getDebugNamesAsIdentifier(refs: ReferencedBindings): string;
141
+ export declare function getDebugNameAsIdentifier(binding: Binding): string;
140
142
  export declare function getSectionInstancesAccessor(section: Section): string;
141
143
  export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral | t.NumericLiteral | undefined;
142
144
  export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression, signal?: Signal): t.Expression | undefined;
@@ -1,6 +1,7 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Section } from "./sections";
3
3
  import { type SerializeReason, type SerializeReasons } from "./serialize-reasons";
4
+ export declare function getScopeReasonDeclaration(section: Section): t.VariableDeclaration;
4
5
  export declare function getSerializeGuard(section: Section, reason: undefined | SerializeReason, optional: boolean): t.Expression | undefined;
5
6
  export declare function getSerializeGuardForAny(section: Section, reasons: undefined | SerializeReasons, optional: boolean): t.Expression | undefined;
6
- export declare function getExprIfSerialized<T extends undefined | SerializeReason, U extends t.Expression>(section: Section, reason: T, expr: U): T extends {} ? U : undefined;
7
+ export declare function getExprIfSerialized<T extends undefined | SerializeReason, R extends T extends {} ? t.Expression : undefined>(section: Section, reason: T, expr: t.Expression): R;
@@ -8,6 +8,7 @@ export type SerializeReason = true | Sources;
8
8
  export type SerializeKey = symbol & {
9
9
  __serialize_key__: 1;
10
10
  };
11
+ export declare function isSameReason(a: SerializeReason | undefined, b: SerializeReason | undefined): boolean;
11
12
  export declare function isForceSerialized(section: Section, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): boolean;
12
13
  export declare function addSerializeReason(section: Section, reason: undefined | false | SerializeReason, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
13
14
  export declare function addSerializeExpr(section: Section, expr: boolean | Opt<t.NodeExtra>, prop?: Binding | AccessorProp | symbol, prefix?: AccessorPrefix | symbol): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.159",
3
+ "version": "6.0.161",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
package/tags-html.d.ts CHANGED
@@ -627,6 +627,26 @@ declare global {
627
627
  clear?: AttrString;
628
628
  }
629
629
  interface Button extends HTMLAttributes<HTMLButtonElement> {
630
+ /**
631
+ * Specifies the action to be performed on an element being controlled specified via the commandfor attribute.
632
+ * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-command
633
+ */
634
+ command?:
635
+ | AttrMissing
636
+ | "show-modal"
637
+ | "close"
638
+ | "request-close"
639
+ | "show-popover"
640
+ | "hide-popover"
641
+ | "toggle-popover"
642
+ | (string & {});
643
+
644
+ /**
645
+ * Specifies the id of the element being controlled
646
+ * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-button-commandfor
647
+ */
648
+ commandfor?: AttrString;
649
+
630
650
  /**
631
651
  * Specifies whether the button should be disabled.
632
652
  * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-disabled
@@ -1665,6 +1685,13 @@ declare global {
1665
1685
  | "Refresh"
1666
1686
  | "X-UA-Compatible";
1667
1687
 
1688
+ /**
1689
+ * Specifies which media the metadata applies to (valid media query list).
1690
+ * Only has effect when name is "theme-color".
1691
+ * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-media
1692
+ */
1693
+ media?: AttrString;
1694
+
1668
1695
  /**
1669
1696
  * Specifies the metadata name for the content attribute.
1670
1697
  * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-name