marko 6.1.18 → 6.1.20
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 +35 -39
- package/dist/debug/dom.mjs +35 -39
- package/dist/debug/html.js +37 -25
- package/dist/debug/html.mjs +37 -25
- package/dist/dom/event.d.ts +1 -1
- package/dist/dom.js +18 -30
- package/dist/dom.mjs +18 -30
- package/dist/html/attrs.d.ts +6 -6
- package/dist/html.js +29 -26
- package/dist/html.mjs +29 -26
- package/dist/translator/index.js +47 -38
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
- package/package.json +1 -1
package/dist/dom.js
CHANGED
|
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36),
|
|
7
|
+
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), R = /[^\p{L}\p{N}]/gu, parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
8
|
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(resetControllers);
|
|
9
9
|
}, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), walker = /* @__PURE__ */ document.createTreeWalker(document), walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
10
10
|
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
@@ -20,7 +20,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
20
20
|
for (value = 10 * currentMultiplier + value - 107; value--;) walker.parentNode();
|
|
21
21
|
walker.nextSibling();
|
|
22
22
|
} else storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
23
|
-
}, cloneCache = {}, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, inputType = "",
|
|
23
|
+
}, cloneCache = {}, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, inputType = "", _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
24
24
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
25
25
|
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
|
|
26
26
|
return enableBranches(), (scope, newRenderer, getInput) => {
|
|
@@ -98,7 +98,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
98
98
|
},
|
|
99
99
|
render(out, component, renderer, args) {
|
|
100
100
|
let branch = component.scope, created = 0;
|
|
101
|
-
if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), typeof args[0] == "object" && "renderBody" in args[0]) {
|
|
101
|
+
if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), args[0] && typeof args[0] == "object" && "renderBody" in args[0]) {
|
|
102
102
|
let input = args[0], normalizedInput = args[0] = {};
|
|
103
103
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
104
104
|
}
|
|
@@ -182,14 +182,7 @@ function push(opt, item) {
|
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/dom/event.ts
|
|
184
184
|
function _on(element, type, handler) {
|
|
185
|
-
element["$" + type] === void 0 &&
|
|
186
|
-
}
|
|
187
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
188
|
-
function createDelegator() {
|
|
189
|
-
let kEvents = Symbol();
|
|
190
|
-
return function(node, type, handler) {
|
|
191
|
-
((node = node.getRootNode())[kEvents] ||= {})[type] ||= (node.addEventListener(type, handler, !0), 1);
|
|
192
|
-
};
|
|
185
|
+
element["$" + type] === void 0 && delegate(type, handleDelegated), element["$" + type] = handler || null;
|
|
193
186
|
}
|
|
194
187
|
function handleDelegated(ev) {
|
|
195
188
|
let target = !rendering && ev.target;
|
|
@@ -577,7 +570,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
577
570
|
let checkedValueChange = scope["E" + nodeAccessor];
|
|
578
571
|
if (checkedValueChange) {
|
|
579
572
|
let oldValue = scope["G" + nodeAccessor], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
580
|
-
if (el.name && el.type[0] === "r") for (let radio of
|
|
573
|
+
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
|
|
581
574
|
else el.checked = !el.checked;
|
|
582
575
|
checkedValueChange(newValue), run();
|
|
583
576
|
}
|
|
@@ -603,7 +596,7 @@ function _attr_input_value_script(scope, nodeAccessor) {
|
|
|
603
596
|
}
|
|
604
597
|
function setInputValue(el, value) {
|
|
605
598
|
if (el.value !== value) {
|
|
606
|
-
let updatedPosition = resolveCursorPosition(inputType,
|
|
599
|
+
let updatedPosition = resolveCursorPosition(inputType, document.activeElement === el && el.selectionStart, el.value, el.value = value);
|
|
607
600
|
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
|
608
601
|
}
|
|
609
602
|
}
|
|
@@ -675,7 +668,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
|
675
668
|
});
|
|
676
669
|
}
|
|
677
670
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
678
|
-
el._ = onChange,
|
|
671
|
+
el._ = onChange, delegate("input", handleChange), el.form && delegate("reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
|
|
679
672
|
}
|
|
680
673
|
function handleChange(ev) {
|
|
681
674
|
ev.target._?.(ev);
|
|
@@ -780,11 +773,10 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
780
773
|
for (let name in events) events[name] = 0;
|
|
781
774
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
|
|
782
775
|
case "INPUT":
|
|
783
|
-
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange)
|
|
784
|
-
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value)
|
|
785
|
-
else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange)
|
|
776
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/;
|
|
777
|
+
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
778
|
+
else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/;
|
|
786
779
|
else break;
|
|
787
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
788
780
|
break;
|
|
789
781
|
case "SELECT":
|
|
790
782
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
@@ -1231,25 +1223,21 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
1231
1223
|
};
|
|
1232
1224
|
}
|
|
1233
1225
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1234
|
-
let parent = marker.parentNode
|
|
1235
|
-
syncGen(branch), renderer.b(branch, parent.namespaceURI), setupBranch(renderer, branch), applyLoad(branch, () => {
|
|
1226
|
+
let parent = marker.parentNode, values = branch.X, insert = () => {
|
|
1236
1227
|
insertBranchBefore(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
1237
|
-
}
|
|
1228
|
+
}, remaining;
|
|
1229
|
+
if (syncGen(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) for (let [promise, entry] of values) promise.then((signal) => {
|
|
1230
|
+
entry.b = signal, --remaining || queueAsyncRender(branch, (branch) => {
|
|
1231
|
+
syncGen(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
|
|
1232
|
+
});
|
|
1233
|
+
}, () => 0);
|
|
1234
|
+
else setupBranch(renderer, branch), insert();
|
|
1238
1235
|
}
|
|
1239
1236
|
function loadFailed(scope, awaitCounter) {
|
|
1240
1237
|
return (error) => {
|
|
1241
1238
|
awaitCounter && (awaitCounter.i = 0), queueAsyncRender(scope, renderCatch, error);
|
|
1242
1239
|
};
|
|
1243
1240
|
}
|
|
1244
|
-
function applyLoad(scope, insert) {
|
|
1245
|
-
let values = scope.X, remaining;
|
|
1246
|
-
if (scope.X = 0, remaining = values?.size) for (let [promise, entry] of values) promise.then((signal) => {
|
|
1247
|
-
entry.b = signal, --remaining || queueAsyncRender(scope, (scope) => {
|
|
1248
|
-
syncGen(scope), values.forEach((e) => e.b._(scope, e.a)), insert();
|
|
1249
|
-
});
|
|
1250
|
-
}, () => 0);
|
|
1251
|
-
else insert();
|
|
1252
|
-
}
|
|
1253
1241
|
function _load_signal(load) {
|
|
1254
1242
|
let pending, signal;
|
|
1255
1243
|
return (scope, value) => {
|
package/dist/dom.mjs
CHANGED
|
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36),
|
|
7
|
+
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), R = /[^\p{L}\p{N}]/gu, parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
8
|
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(resetControllers);
|
|
9
9
|
}, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), walker = /* @__PURE__ */ document.createTreeWalker(document), walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
10
10
|
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
@@ -20,7 +20,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
20
20
|
for (value = 10 * currentMultiplier + value - 107; value--;) walker.parentNode();
|
|
21
21
|
walker.nextSibling();
|
|
22
22
|
} else storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
23
|
-
}, cloneCache = {}, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, inputType = "",
|
|
23
|
+
}, cloneCache = {}, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, inputType = "", _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
24
24
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
25
25
|
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
|
|
26
26
|
return enableBranches(), (scope, newRenderer, getInput) => {
|
|
@@ -98,7 +98,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
98
98
|
},
|
|
99
99
|
render(out, component, renderer, args) {
|
|
100
100
|
let branch = component.scope, created = 0;
|
|
101
|
-
if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), typeof args[0] == "object" && "renderBody" in args[0]) {
|
|
101
|
+
if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), args[0] && typeof args[0] == "object" && "renderBody" in args[0]) {
|
|
102
102
|
let input = args[0], normalizedInput = args[0] = {};
|
|
103
103
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
104
104
|
}
|
|
@@ -181,14 +181,7 @@ function push(opt, item) {
|
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region src/dom/event.ts
|
|
183
183
|
function _on(element, type, handler) {
|
|
184
|
-
element["$" + type] === void 0 &&
|
|
185
|
-
}
|
|
186
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
187
|
-
function createDelegator() {
|
|
188
|
-
let kEvents = Symbol();
|
|
189
|
-
return function(node, type, handler) {
|
|
190
|
-
((node = node.getRootNode())[kEvents] ||= {})[type] ||= (node.addEventListener(type, handler, !0), 1);
|
|
191
|
-
};
|
|
184
|
+
element["$" + type] === void 0 && delegate(type, handleDelegated), element["$" + type] = handler || null;
|
|
192
185
|
}
|
|
193
186
|
function handleDelegated(ev) {
|
|
194
187
|
let target = !rendering && ev.target;
|
|
@@ -576,7 +569,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
576
569
|
let checkedValueChange = scope["E" + nodeAccessor];
|
|
577
570
|
if (checkedValueChange) {
|
|
578
571
|
let oldValue = scope["G" + nodeAccessor], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
579
|
-
if (el.name && el.type[0] === "r") for (let radio of
|
|
572
|
+
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
|
|
580
573
|
else el.checked = !el.checked;
|
|
581
574
|
checkedValueChange(newValue), run();
|
|
582
575
|
}
|
|
@@ -602,7 +595,7 @@ function _attr_input_value_script(scope, nodeAccessor) {
|
|
|
602
595
|
}
|
|
603
596
|
function setInputValue(el, value) {
|
|
604
597
|
if (el.value !== value) {
|
|
605
|
-
let updatedPosition = resolveCursorPosition(inputType,
|
|
598
|
+
let updatedPosition = resolveCursorPosition(inputType, document.activeElement === el && el.selectionStart, el.value, el.value = value);
|
|
606
599
|
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
|
607
600
|
}
|
|
608
601
|
}
|
|
@@ -674,7 +667,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
|
674
667
|
});
|
|
675
668
|
}
|
|
676
669
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
677
|
-
el._ = onChange,
|
|
670
|
+
el._ = onChange, delegate("input", handleChange), el.form && delegate("reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
|
|
678
671
|
}
|
|
679
672
|
function handleChange(ev) {
|
|
680
673
|
ev.target._?.(ev);
|
|
@@ -779,11 +772,10 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
779
772
|
for (let name in events) events[name] = 0;
|
|
780
773
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
|
|
781
774
|
case "INPUT":
|
|
782
|
-
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange)
|
|
783
|
-
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value)
|
|
784
|
-
else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange)
|
|
775
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/;
|
|
776
|
+
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
777
|
+
else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/;
|
|
785
778
|
else break;
|
|
786
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
787
779
|
break;
|
|
788
780
|
case "SELECT":
|
|
789
781
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
@@ -1230,25 +1222,21 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
1230
1222
|
};
|
|
1231
1223
|
}
|
|
1232
1224
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1233
|
-
let parent = marker.parentNode
|
|
1234
|
-
syncGen(branch), renderer.b(branch, parent.namespaceURI), setupBranch(renderer, branch), applyLoad(branch, () => {
|
|
1225
|
+
let parent = marker.parentNode, values = branch.X, insert = () => {
|
|
1235
1226
|
insertBranchBefore(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
1236
|
-
}
|
|
1227
|
+
}, remaining;
|
|
1228
|
+
if (syncGen(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) for (let [promise, entry] of values) promise.then((signal) => {
|
|
1229
|
+
entry.b = signal, --remaining || queueAsyncRender(branch, (branch) => {
|
|
1230
|
+
syncGen(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
|
|
1231
|
+
});
|
|
1232
|
+
}, () => 0);
|
|
1233
|
+
else setupBranch(renderer, branch), insert();
|
|
1237
1234
|
}
|
|
1238
1235
|
function loadFailed(scope, awaitCounter) {
|
|
1239
1236
|
return (error) => {
|
|
1240
1237
|
awaitCounter && (awaitCounter.i = 0), queueAsyncRender(scope, renderCatch, error);
|
|
1241
1238
|
};
|
|
1242
1239
|
}
|
|
1243
|
-
function applyLoad(scope, insert) {
|
|
1244
|
-
let values = scope.X, remaining;
|
|
1245
|
-
if (scope.X = 0, remaining = values?.size) for (let [promise, entry] of values) promise.then((signal) => {
|
|
1246
|
-
entry.b = signal, --remaining || queueAsyncRender(scope, (scope) => {
|
|
1247
|
-
syncGen(scope), values.forEach((e) => e.b._(scope, e.a)), insert();
|
|
1248
|
-
});
|
|
1249
|
-
}, () => 0);
|
|
1250
|
-
else insert();
|
|
1251
|
-
}
|
|
1252
1240
|
function _load_signal(load) {
|
|
1253
1241
|
let pending, signal;
|
|
1254
1242
|
return (scope, value) => {
|
package/dist/html/attrs.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { type Accessor } from "../common/types";
|
|
|
2
2
|
export declare function _attr_class(value: unknown): string;
|
|
3
3
|
export declare function _attr_style(value: unknown): string;
|
|
4
4
|
export declare function _attr_option_value(value: unknown): string;
|
|
5
|
-
export declare function _attr_select_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, content?: () => void): void;
|
|
6
|
-
export declare function _attr_textarea_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown): string;
|
|
7
|
-
export declare function _attr_input_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown): string;
|
|
8
|
-
export declare function _attr_input_checked(scopeId: number, nodeAccessor: Accessor, checked: unknown, checkedChange: unknown): "" | " checked";
|
|
9
|
-
export declare function _attr_input_checkedValue(scopeId: number, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown): string;
|
|
10
|
-
export declare function _attr_details_or_dialog_open(scopeId: number, nodeAccessor: Accessor, open: unknown, openChange: unknown): "" | " open";
|
|
5
|
+
export declare function _attr_select_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, content?: () => void, serializeType?: 1): void;
|
|
6
|
+
export declare function _attr_textarea_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, serializeType?: 1): string;
|
|
7
|
+
export declare function _attr_input_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, serializeType?: 1): string;
|
|
8
|
+
export declare function _attr_input_checked(scopeId: number, nodeAccessor: Accessor, checked: unknown, checkedChange: unknown, serializeType?: 1): "" | " checked";
|
|
9
|
+
export declare function _attr_input_checkedValue(scopeId: number, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown, serializeType?: 1): string;
|
|
10
|
+
export declare function _attr_details_or_dialog_open(scopeId: number, nodeAccessor: Accessor, open: unknown, openChange: unknown, serializeType?: 1): "" | " open";
|
|
11
11
|
export declare function _attr_nonce(): string;
|
|
12
12
|
export declare function _attr(name: string, value: unknown): string;
|
|
13
13
|
export declare function _attrs(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string): string;
|
package/dist/html.js
CHANGED
|
@@ -238,7 +238,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
242
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
243
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
244
|
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
@@ -247,10 +247,10 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
247
247
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
248
248
|
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
249
249
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
250
|
-
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange));
|
|
250
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
251
251
|
else if (renderContent) {
|
|
252
252
|
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
253
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
253
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
254
254
|
}
|
|
255
255
|
_html(`</${renderer}>`);
|
|
256
256
|
}
|
|
@@ -691,7 +691,8 @@ function writeDate(state, val) {
|
|
|
691
691
|
return state.buf.push("new Date(" + +val + ")"), !0;
|
|
692
692
|
}
|
|
693
693
|
function writeRegExp(state, val) {
|
|
694
|
-
|
|
694
|
+
let { source } = val;
|
|
695
|
+
return state.buf.push("/" + (source.includes("<") ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
695
696
|
}
|
|
696
697
|
function writePromise(state, val, ref) {
|
|
697
698
|
let { boundary, channel } = state;
|
|
@@ -760,7 +761,7 @@ function writeWeakMap(state) {
|
|
|
760
761
|
}
|
|
761
762
|
function writeError(state, val, ref) {
|
|
762
763
|
let result = "new " + val.constructor.name + "(" + quote(val.message + "", 0);
|
|
763
|
-
return val.cause ? (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})"))
|
|
764
|
+
return val.cause === void 0 ? state.buf.push(result + ")") : (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})")), !0;
|
|
764
765
|
}
|
|
765
766
|
function writeAggregateError(state, val, ref) {
|
|
766
767
|
return state.buf.push("new AggregateError("), writeProp(state, val.errors, ref, "errors"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), !0;
|
|
@@ -1611,24 +1612,24 @@ function _attr_style(value) {
|
|
|
1611
1612
|
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1612
1613
|
}
|
|
1613
1614
|
function _attr_option_value(value) {
|
|
1614
|
-
let valueAttr = _attr("value", value);
|
|
1615
|
-
return normalizedValueMatches(
|
|
1615
|
+
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1616
|
+
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1616
1617
|
}
|
|
1617
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
1618
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange), content && withContext(kSelectedValue, value, content);
|
|
1618
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1619
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value, content);
|
|
1619
1620
|
}
|
|
1620
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1621
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _escape(value);
|
|
1621
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1622
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _escape(value);
|
|
1622
1623
|
}
|
|
1623
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1624
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _attr("value", value);
|
|
1624
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1625
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1625
1626
|
}
|
|
1626
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1627
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange), isNotVoid(checked) ? " checked" : "";
|
|
1627
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1628
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1628
1629
|
}
|
|
1629
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1630
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1630
1631
|
let valueAttr = _attr("value", value);
|
|
1631
|
-
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1632
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1632
1633
|
}
|
|
1633
1634
|
function getCheckedValueRef(checkedValue) {
|
|
1634
1635
|
if (Array.isArray(checkedValue)) {
|
|
@@ -1636,9 +1637,9 @@ function getCheckedValueRef(checkedValue) {
|
|
|
1636
1637
|
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1637
1638
|
}
|
|
1638
1639
|
}
|
|
1639
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1640
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1640
1641
|
let normalizedOpen = isNotVoid(open);
|
|
1641
|
-
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange), normalizedOpen ? " open" : "";
|
|
1642
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1642
1643
|
}
|
|
1643
1644
|
function _attr_nonce() {
|
|
1644
1645
|
return getChunk().boundary.state.nonceAttr;
|
|
@@ -1650,11 +1651,10 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1650
1651
|
let result = "", skip = /[\s/>"'=]/, events;
|
|
1651
1652
|
switch (tagName) {
|
|
1652
1653
|
case "input":
|
|
1653
|
-
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange)
|
|
1654
|
-
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value)
|
|
1655
|
-
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange)
|
|
1654
|
+
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/;
|
|
1655
|
+
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1656
|
+
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1656
1657
|
else break;
|
|
1657
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1658
1658
|
break;
|
|
1659
1659
|
case "select":
|
|
1660
1660
|
case "textarea":
|
|
@@ -1665,7 +1665,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1665
1665
|
break;
|
|
1666
1666
|
case "details":
|
|
1667
1667
|
case "dialog":
|
|
1668
|
-
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1668
|
+
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1669
1669
|
break;
|
|
1670
1670
|
}
|
|
1671
1671
|
for (let name in data) {
|
|
@@ -1698,11 +1698,14 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1698
1698
|
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1699
1699
|
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1700
1700
|
}
|
|
1701
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1702
|
-
writeScope(scopeId, {
|
|
1701
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1702
|
+
writeScope(scopeId, serializeType ? {
|
|
1703
1703
|
["F" + nodeAccessor]: type,
|
|
1704
1704
|
["G" + nodeAccessor]: value,
|
|
1705
1705
|
["E" + nodeAccessor]: valueChange
|
|
1706
|
+
} : {
|
|
1707
|
+
["G" + nodeAccessor]: value,
|
|
1708
|
+
["E" + nodeAccessor]: valueChange
|
|
1706
1709
|
});
|
|
1707
1710
|
}
|
|
1708
1711
|
function stringAttr(name, value) {
|
package/dist/html.mjs
CHANGED
|
@@ -238,7 +238,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
242
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
243
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
244
|
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
@@ -247,10 +247,10 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
247
247
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
248
248
|
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
249
249
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
250
|
-
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange));
|
|
250
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
251
251
|
else if (renderContent) {
|
|
252
252
|
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
253
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
253
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
254
254
|
}
|
|
255
255
|
_html(`</${renderer}>`);
|
|
256
256
|
}
|
|
@@ -690,7 +690,8 @@ function writeDate(state, val) {
|
|
|
690
690
|
return state.buf.push("new Date(" + +val + ")"), !0;
|
|
691
691
|
}
|
|
692
692
|
function writeRegExp(state, val) {
|
|
693
|
-
|
|
693
|
+
let { source } = val;
|
|
694
|
+
return state.buf.push("/" + (source.includes("<") ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
694
695
|
}
|
|
695
696
|
function writePromise(state, val, ref) {
|
|
696
697
|
let { boundary, channel } = state;
|
|
@@ -759,7 +760,7 @@ function writeWeakMap(state) {
|
|
|
759
760
|
}
|
|
760
761
|
function writeError(state, val, ref) {
|
|
761
762
|
let result = "new " + val.constructor.name + "(" + quote(val.message + "", 0);
|
|
762
|
-
return val.cause ? (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})"))
|
|
763
|
+
return val.cause === void 0 ? state.buf.push(result + ")") : (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})")), !0;
|
|
763
764
|
}
|
|
764
765
|
function writeAggregateError(state, val, ref) {
|
|
765
766
|
return state.buf.push("new AggregateError("), writeProp(state, val.errors, ref, "errors"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), !0;
|
|
@@ -1610,24 +1611,24 @@ function _attr_style(value) {
|
|
|
1610
1611
|
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1611
1612
|
}
|
|
1612
1613
|
function _attr_option_value(value) {
|
|
1613
|
-
let valueAttr = _attr("value", value);
|
|
1614
|
-
return normalizedValueMatches(
|
|
1614
|
+
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1615
|
+
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1615
1616
|
}
|
|
1616
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
1617
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange), content && withContext(kSelectedValue, value, content);
|
|
1617
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1618
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value, content);
|
|
1618
1619
|
}
|
|
1619
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1620
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _escape(value);
|
|
1620
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1621
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _escape(value);
|
|
1621
1622
|
}
|
|
1622
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1623
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _attr("value", value);
|
|
1623
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1624
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1624
1625
|
}
|
|
1625
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1626
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange), isNotVoid(checked) ? " checked" : "";
|
|
1626
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1627
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1627
1628
|
}
|
|
1628
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1629
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1629
1630
|
let valueAttr = _attr("value", value);
|
|
1630
|
-
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1631
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1631
1632
|
}
|
|
1632
1633
|
function getCheckedValueRef(checkedValue) {
|
|
1633
1634
|
if (Array.isArray(checkedValue)) {
|
|
@@ -1635,9 +1636,9 @@ function getCheckedValueRef(checkedValue) {
|
|
|
1635
1636
|
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1636
1637
|
}
|
|
1637
1638
|
}
|
|
1638
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1639
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1639
1640
|
let normalizedOpen = isNotVoid(open);
|
|
1640
|
-
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange), normalizedOpen ? " open" : "";
|
|
1641
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1641
1642
|
}
|
|
1642
1643
|
function _attr_nonce() {
|
|
1643
1644
|
return getChunk().boundary.state.nonceAttr;
|
|
@@ -1649,11 +1650,10 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1649
1650
|
let result = "", skip = /[\s/>"'=]/, events;
|
|
1650
1651
|
switch (tagName) {
|
|
1651
1652
|
case "input":
|
|
1652
|
-
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange)
|
|
1653
|
-
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value)
|
|
1654
|
-
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange)
|
|
1653
|
+
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/;
|
|
1654
|
+
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1655
|
+
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1655
1656
|
else break;
|
|
1656
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1657
1657
|
break;
|
|
1658
1658
|
case "select":
|
|
1659
1659
|
case "textarea":
|
|
@@ -1664,7 +1664,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1664
1664
|
break;
|
|
1665
1665
|
case "details":
|
|
1666
1666
|
case "dialog":
|
|
1667
|
-
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1667
|
+
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1668
1668
|
break;
|
|
1669
1669
|
}
|
|
1670
1670
|
for (let name in data) {
|
|
@@ -1697,11 +1697,14 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1697
1697
|
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1698
1698
|
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1699
1699
|
}
|
|
1700
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1701
|
-
writeScope(scopeId, {
|
|
1700
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1701
|
+
writeScope(scopeId, serializeType ? {
|
|
1702
1702
|
["F" + nodeAccessor]: type,
|
|
1703
1703
|
["G" + nodeAccessor]: value,
|
|
1704
1704
|
["E" + nodeAccessor]: valueChange
|
|
1705
|
+
} : {
|
|
1706
|
+
["G" + nodeAccessor]: value,
|
|
1707
|
+
["E" + nodeAccessor]: valueChange
|
|
1705
1708
|
});
|
|
1706
1709
|
}
|
|
1707
1710
|
function stringAttr(name, value) {
|