@marko/runtime-tags 6.3.11 → 6.3.12
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 +16 -6
- package/dist/debug/dom.mjs +15 -7
- package/dist/debug/html.js +3 -3
- package/dist/debug/html.mjs +3 -3
- package/dist/dom/controllable.d.ts +3 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +11 -4
- package/dist/dom.mjs +11 -4
- package/dist/translator/index.js +53 -10
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -177,12 +177,12 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
177
177
|
if (attrs) {
|
|
178
178
|
let exclusiveAttrs;
|
|
179
179
|
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
180
|
-
if (attrs
|
|
180
|
+
if ("checkedValue" in attrs) {
|
|
181
181
|
(exclusiveAttrs ||= []).push("checkedValue");
|
|
182
|
-
if (attrs
|
|
182
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
183
183
|
} else if (attrs.checkedValueChange) {
|
|
184
184
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
185
|
-
if (attrs
|
|
185
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
186
186
|
}
|
|
187
187
|
if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
|
|
188
188
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
@@ -996,7 +996,12 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
996
996
|
setInputValue(el, restoreValue);
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
1000
|
+
const el = scope[nodeAccessor];
|
|
1001
|
+
if (/i[ot]|e[cns]|^[bi]/.test(el.type)) _attr(el, "value", value);
|
|
1002
|
+
else _attr_input_value_default(scope, nodeAccessor, value);
|
|
1003
|
+
}
|
|
1004
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
1000
1005
|
const el = scope[nodeAccessor];
|
|
1001
1006
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1002
1007
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
@@ -1004,7 +1009,10 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
|
1004
1009
|
scope["ControlledValue:" + nodeAccessor] = normalizedValue;
|
|
1005
1010
|
scope["ControlledType:" + nodeAccessor] = valueChange ? 2 : 5;
|
|
1006
1011
|
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1007
|
-
else
|
|
1012
|
+
else setDefault(scope, nodeAccessor, normalizedValue);
|
|
1013
|
+
}
|
|
1014
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1015
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
1008
1016
|
}
|
|
1009
1017
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1010
1018
|
const el = scope[nodeAccessor];
|
|
@@ -1272,7 +1280,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1272
1280
|
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1273
1281
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1274
1282
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1275
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1283
|
+
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default);
|
|
1276
1284
|
skip = /^value(?:Change)?$/;
|
|
1277
1285
|
}
|
|
1278
1286
|
break;
|
|
@@ -2259,7 +2267,9 @@ exports._attr_input_checkedValue_script = _attr_input_checkedValue_script;
|
|
|
2259
2267
|
exports._attr_input_checked_default = _attr_input_checked_default;
|
|
2260
2268
|
exports._attr_input_checked_script = _attr_input_checked_script;
|
|
2261
2269
|
exports._attr_input_value = _attr_input_value;
|
|
2270
|
+
exports._attr_input_value_attribute_default = _attr_input_value_attribute_default;
|
|
2262
2271
|
exports._attr_input_value_default = _attr_input_value_default;
|
|
2272
|
+
exports._attr_input_value_dynamic_default = _attr_input_value_dynamic_default;
|
|
2263
2273
|
exports._attr_input_value_script = _attr_input_value_script;
|
|
2264
2274
|
exports._attr_nonce = _attr_nonce;
|
|
2265
2275
|
exports._attr_select_value = _attr_select_value;
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -175,12 +175,12 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
175
175
|
if (attrs) {
|
|
176
176
|
let exclusiveAttrs;
|
|
177
177
|
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
178
|
-
if (attrs
|
|
178
|
+
if ("checkedValue" in attrs) {
|
|
179
179
|
(exclusiveAttrs ||= []).push("checkedValue");
|
|
180
|
-
if (attrs
|
|
180
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
181
181
|
} else if (attrs.checkedValueChange) {
|
|
182
182
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
183
|
-
if (attrs
|
|
183
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
184
184
|
}
|
|
185
185
|
if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
|
|
186
186
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
@@ -994,7 +994,12 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
994
994
|
setInputValue(el, restoreValue);
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
998
|
+
const el = scope[nodeAccessor];
|
|
999
|
+
if (/i[ot]|e[cns]|^[bi]/.test(el.type)) _attr(el, "value", value);
|
|
1000
|
+
else _attr_input_value_default(scope, nodeAccessor, value);
|
|
1001
|
+
}
|
|
1002
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
998
1003
|
const el = scope[nodeAccessor];
|
|
999
1004
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1000
1005
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
@@ -1002,7 +1007,10 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
|
1002
1007
|
scope["ControlledValue:" + nodeAccessor] = normalizedValue;
|
|
1003
1008
|
scope["ControlledType:" + nodeAccessor] = valueChange ? 2 : 5;
|
|
1004
1009
|
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1005
|
-
else
|
|
1010
|
+
else setDefault(scope, nodeAccessor, normalizedValue);
|
|
1011
|
+
}
|
|
1012
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1013
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
1006
1014
|
}
|
|
1007
1015
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1008
1016
|
const el = scope[nodeAccessor];
|
|
@@ -1270,7 +1278,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1270
1278
|
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1271
1279
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1272
1280
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1273
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1281
|
+
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default);
|
|
1274
1282
|
skip = /^value(?:Change)?$/;
|
|
1275
1283
|
}
|
|
1276
1284
|
break;
|
|
@@ -2235,4 +2243,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
2235
2243
|
return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
|
|
2236
2244
|
}
|
|
2237
2245
|
//#endregion
|
|
2238
|
-
export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
|
|
2246
|
+
export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
|
package/dist/debug/html.js
CHANGED
|
@@ -176,12 +176,12 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
176
176
|
if (attrs) {
|
|
177
177
|
let exclusiveAttrs;
|
|
178
178
|
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
179
|
-
if (attrs
|
|
179
|
+
if ("checkedValue" in attrs) {
|
|
180
180
|
(exclusiveAttrs ||= []).push("checkedValue");
|
|
181
|
-
if (attrs
|
|
181
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
182
182
|
} else if (attrs.checkedValueChange) {
|
|
183
183
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
184
|
-
if (attrs
|
|
184
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
185
185
|
}
|
|
186
186
|
if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
|
|
187
187
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
package/dist/debug/html.mjs
CHANGED
|
@@ -174,12 +174,12 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
174
174
|
if (attrs) {
|
|
175
175
|
let exclusiveAttrs;
|
|
176
176
|
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
177
|
-
if (attrs
|
|
177
|
+
if ("checkedValue" in attrs) {
|
|
178
178
|
(exclusiveAttrs ||= []).push("checkedValue");
|
|
179
|
-
if (attrs
|
|
179
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
180
180
|
} else if (attrs.checkedValueChange) {
|
|
181
181
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
182
|
-
if (attrs
|
|
182
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
183
183
|
}
|
|
184
184
|
if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
|
|
185
185
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
@@ -6,7 +6,9 @@ export declare function _attr_input_checkedValue_default(scope: Scope, nodeAcces
|
|
|
6
6
|
export declare function _attr_input_checkedValue(scope: Scope, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown): void;
|
|
7
7
|
export declare function _attr_input_checkedValue_script(scope: Scope, nodeAccessor: Accessor): void;
|
|
8
8
|
export declare function _attr_input_value_default(scope: Scope, nodeAccessor: Accessor, value: unknown): void;
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function _attr_input_value_dynamic_default(scope: Scope, nodeAccessor: Accessor, value: unknown): void;
|
|
10
|
+
export declare function _attr_input_value(scope: Scope, nodeAccessor: Accessor, value: unknown, valueChange: unknown, setDefault?: typeof _attr_input_value_default): void;
|
|
11
|
+
export declare function _attr_input_value_attribute_default(scope: Scope, nodeAccessor: Accessor, value: unknown): void;
|
|
10
12
|
export declare function _attr_input_value_script(scope: Scope, nodeAccessor: Accessor): void;
|
|
11
13
|
export declare function _attr_select_value_default(scope: Scope, nodeAccessor: Accessor, value: unknown): void;
|
|
12
14
|
export declare function _attr_select_value(scope: Scope, nodeAccessor: Accessor, value: unknown, valueChange: unknown): void;
|
package/dist/dom.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { _call } from "./common/helpers";
|
|
|
5
5
|
export { $signal, $signalReset } from "./dom/abort-signal";
|
|
6
6
|
export { compat } from "./dom/compat";
|
|
7
7
|
export { _await_content, _await_promise, _dynamic_tag, _dynamic_tag_content, _for_in, _for_of, _for_to, _for_until, _if, _resume_dynamic_tag, _show, _try, } from "./dom/control-flow";
|
|
8
|
-
export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_default, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_default, _attr_input_value_script, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_input_value as _attr_textarea_value, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script as _attr_textarea_value_script, } from "./dom/controllable";
|
|
8
|
+
export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_default, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_input_value as _attr_textarea_value, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script as _attr_textarea_value_script, } from "./dom/controllable";
|
|
9
9
|
export { _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_nonce, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _html, _lifecycle, _style_rule_item, _style_shell, _text, _text_content, _to_text, } from "./dom/dom";
|
|
10
10
|
export { _on } from "./dom/event";
|
|
11
11
|
export { _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, } from "./dom/load";
|
package/dist/dom.js
CHANGED
|
@@ -632,9 +632,16 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
632
632
|
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
636
|
+
let el = scope[nodeAccessor];
|
|
637
|
+
/i[ot]|e[cns]|^[bi]/.test(el.type) ? _attr(el, "value", value) : _attr_input_value_default(scope, nodeAccessor, value);
|
|
638
|
+
}
|
|
639
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
636
640
|
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
637
|
-
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) :
|
|
641
|
+
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
|
|
642
|
+
}
|
|
643
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
644
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
638
645
|
}
|
|
639
646
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
640
647
|
let el = scope[nodeAccessor];
|
|
@@ -830,7 +837,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
830
837
|
for (let name in events) events[name] = 0;
|
|
831
838
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && el.tagName) {
|
|
832
839
|
case "INPUT":
|
|
833
|
-
"checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/) : ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
840
|
+
"checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/) : ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default), skip = /^value(?:Change)?$/);
|
|
834
841
|
break;
|
|
835
842
|
case "SELECT":
|
|
836
843
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
@@ -1345,7 +1352,7 @@ function _load_race_trigger(...triggers) {
|
|
|
1345
1352
|
function getSelectorOrResolve(selector, resolve) {
|
|
1346
1353
|
return document.querySelector(selector) || resolve();
|
|
1347
1354
|
}
|
|
1348
|
-
exports.$signal = $signal, exports.$signalReset = $signalReset, exports._assert_hoist = _assert_hoist, exports._assert_init = _assert_init, exports._attr = _attr, exports._attr_class = _attr_class, exports._attr_class_item = _attr_class_item, exports._attr_class_items = _attr_class_items, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_details_open_default = _attr_details_or_dialog_open_default, exports._attr_dialog_open_default = _attr_details_or_dialog_open_default, exports._attr_details_open_script = _attr_details_or_dialog_open_script, exports._attr_dialog_open_script = _attr_details_or_dialog_open_script, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_checkedValue_default = _attr_input_checkedValue_default, exports._attr_input_checkedValue_script = _attr_input_checkedValue_script, exports._attr_input_checked_default = _attr_input_checked_default, exports._attr_input_checked_script = _attr_input_checked_script, exports._attr_input_value = _attr_input_value, exports._attr_textarea_value = _attr_input_value, exports._attr_input_value_default = _attr_input_value_default, exports._attr_textarea_value_default = _attr_input_value_default, exports._attr_input_value_script = _attr_input_value_script, exports._attr_textarea_value_script = _attr_input_value_script, exports._attr_nonce = _attr_nonce, exports._attr_select_value = _attr_select_value, exports._attr_select_value_default = _attr_select_value_default, exports._attr_select_value_script = _attr_select_value_script, exports._attr_style = _attr_style, exports._attr_style_item = _attr_style_item, exports._attr_style_items = _attr_style_items, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_script = _attrs_script, exports._await_content = _await_content, exports._await_promise = _await_promise, exports._call = _call, exports._child_setup = _child_setup, exports._closure = _closure, exports._closure_get = _closure_get, exports._const = _const, exports._content = _content, exports._content_closures = _content_closures, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
1355
|
+
exports.$signal = $signal, exports.$signalReset = $signalReset, exports._assert_hoist = _assert_hoist, exports._assert_init = _assert_init, exports._attr = _attr, exports._attr_class = _attr_class, exports._attr_class_item = _attr_class_item, exports._attr_class_items = _attr_class_items, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_details_open_default = _attr_details_or_dialog_open_default, exports._attr_dialog_open_default = _attr_details_or_dialog_open_default, exports._attr_details_open_script = _attr_details_or_dialog_open_script, exports._attr_dialog_open_script = _attr_details_or_dialog_open_script, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_checkedValue_default = _attr_input_checkedValue_default, exports._attr_input_checkedValue_script = _attr_input_checkedValue_script, exports._attr_input_checked_default = _attr_input_checked_default, exports._attr_input_checked_script = _attr_input_checked_script, exports._attr_input_value = _attr_input_value, exports._attr_textarea_value = _attr_input_value, exports._attr_input_value_attribute_default = _attr_input_value_attribute_default, exports._attr_input_value_default = _attr_input_value_default, exports._attr_textarea_value_default = _attr_input_value_default, exports._attr_input_value_dynamic_default = _attr_input_value_dynamic_default, exports._attr_input_value_script = _attr_input_value_script, exports._attr_textarea_value_script = _attr_input_value_script, exports._attr_nonce = _attr_nonce, exports._attr_select_value = _attr_select_value, exports._attr_select_value_default = _attr_select_value_default, exports._attr_select_value_script = _attr_select_value_script, exports._attr_style = _attr_style, exports._attr_style_item = _attr_style_item, exports._attr_style_items = _attr_style_items, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_script = _attrs_script, exports._await_content = _await_content, exports._await_promise = _await_promise, exports._call = _call, exports._child_setup = _child_setup, exports._closure = _closure, exports._closure_get = _closure_get, exports._const = _const, exports._content = _content, exports._content_closures = _content_closures, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
1349
1356
|
enumerable: !0,
|
|
1350
1357
|
get: function() {
|
|
1351
1358
|
return _dynamic_tag;
|
package/dist/dom.mjs
CHANGED
|
@@ -631,9 +631,16 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
631
631
|
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
635
|
+
let el = scope[nodeAccessor];
|
|
636
|
+
/i[ot]|e[cns]|^[bi]/.test(el.type) ? _attr(el, "value", value) : _attr_input_value_default(scope, nodeAccessor, value);
|
|
637
|
+
}
|
|
638
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
635
639
|
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
636
|
-
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) :
|
|
640
|
+
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
|
|
641
|
+
}
|
|
642
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
643
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
637
644
|
}
|
|
638
645
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
639
646
|
let el = scope[nodeAccessor];
|
|
@@ -829,7 +836,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
829
836
|
for (let name in events) events[name] = 0;
|
|
830
837
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && el.tagName) {
|
|
831
838
|
case "INPUT":
|
|
832
|
-
"checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/) : ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
839
|
+
"checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/) : ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default), skip = /^value(?:Change)?$/);
|
|
833
840
|
break;
|
|
834
841
|
case "SELECT":
|
|
835
842
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
@@ -1345,4 +1352,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
1345
1352
|
return document.querySelector(selector) || resolve();
|
|
1346
1353
|
}
|
|
1347
1354
|
//#endregion
|
|
1348
|
-
export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
|
|
1355
|
+
export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
|
package/dist/translator/index.js
CHANGED
|
@@ -1697,12 +1697,12 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
|
1697
1697
|
if (attrs) {
|
|
1698
1698
|
let exclusiveAttrs;
|
|
1699
1699
|
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
1700
|
-
if (attrs
|
|
1700
|
+
if ("checkedValue" in attrs) {
|
|
1701
1701
|
(exclusiveAttrs ||= []).push("checkedValue");
|
|
1702
|
-
if (attrs
|
|
1702
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
1703
1703
|
} else if (attrs.checkedValueChange) {
|
|
1704
1704
|
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
1705
|
-
if (attrs
|
|
1705
|
+
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
1706
1706
|
}
|
|
1707
1707
|
if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
|
|
1708
1708
|
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
@@ -4572,9 +4572,11 @@ var native_tag_default = {
|
|
|
4572
4572
|
if (injectNonce) addStatement("render", tagSection, void 0, _marko_compiler.types.expressionStatement(callRuntime("_attr_nonce", scopeIdentifier, getScopeAccessorLiteral(nodeBinding))), void 0, true);
|
|
4573
4573
|
if (staticControllable) {
|
|
4574
4574
|
const hasChangeHandler = !!staticControllable.attrs[1];
|
|
4575
|
+
const defaultHelper = getDOMControllableDefaultHelper(staticControllable);
|
|
4575
4576
|
const referencedBindings = staticControllable.attrs.find(Boolean).value.extra?.referencedBindings;
|
|
4576
4577
|
const values = (hasChangeHandler ? staticControllable.attrs : staticControllable.attrs.toSpliced(1, 1)).map((attr) => attr?.value);
|
|
4577
|
-
|
|
4578
|
+
if (hasChangeHandler && defaultHelper !== `${staticControllable.helper}_default`) values.push(importRuntime(defaultHelper));
|
|
4579
|
+
addStatement("render", tagSection, referencedBindings, _marko_compiler.types.expressionStatement(callRuntime(hasChangeHandler ? staticControllable.helper : defaultHelper, scopeIdentifier, visitAccessor, ...values)));
|
|
4578
4580
|
if (hasChangeHandler) addStatement("effect", tagSection, void 0, _marko_compiler.types.expressionStatement(callRuntime(`${staticControllable.helper}_script`, scopeIdentifier, visitAccessor)));
|
|
4579
4581
|
}
|
|
4580
4582
|
for (const attr of staticAttrs) {
|
|
@@ -4684,11 +4686,16 @@ function getRelatedControllable(tagName, attrs) {
|
|
|
4684
4686
|
attrs.value
|
|
4685
4687
|
]
|
|
4686
4688
|
};
|
|
4687
|
-
if (attrs.value || attrs.valueChange)
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4689
|
+
if (attrs.value || attrs.valueChange) {
|
|
4690
|
+
const valueMode = getInputValueMode(attrs.type);
|
|
4691
|
+
if (valueMode === "attribute" && !attrs.valueChange) break;
|
|
4692
|
+
return {
|
|
4693
|
+
special: false,
|
|
4694
|
+
helper: "_attr_input_value",
|
|
4695
|
+
attrs: [attrs.value, attrs.valueChange],
|
|
4696
|
+
valueMode
|
|
4697
|
+
};
|
|
4698
|
+
}
|
|
4692
4699
|
break;
|
|
4693
4700
|
case "select":
|
|
4694
4701
|
if (attrs.value || attrs.valueChange) return {
|
|
@@ -4714,6 +4721,23 @@ function getRelatedControllable(tagName, attrs) {
|
|
|
4714
4721
|
break;
|
|
4715
4722
|
}
|
|
4716
4723
|
}
|
|
4724
|
+
function getInputValueMode(typeAttr) {
|
|
4725
|
+
if (!typeAttr) return;
|
|
4726
|
+
const type = evaluate(typeAttr.value);
|
|
4727
|
+
if (!type.confident) return "dynamic";
|
|
4728
|
+
if (typeof type.computed === "string") switch (type.computed.toLowerCase()) {
|
|
4729
|
+
case "button":
|
|
4730
|
+
case "checkbox":
|
|
4731
|
+
case "hidden":
|
|
4732
|
+
case "image":
|
|
4733
|
+
case "radio":
|
|
4734
|
+
case "reset":
|
|
4735
|
+
case "submit": return "attribute";
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
function getDOMControllableDefaultHelper(controllable) {
|
|
4739
|
+
return controllable.helper === "_attr_input_value" && controllable.valueMode ? `_attr_input_value_${controllable.valueMode}_default` : `${controllable.helper}_default`;
|
|
4740
|
+
}
|
|
4717
4741
|
function getUsedAttrs(tagName, tag) {
|
|
4718
4742
|
const seen = Object.create(null);
|
|
4719
4743
|
const { attributes } = tag;
|
|
@@ -7889,7 +7913,10 @@ var html_comment_default = {
|
|
|
7889
7913
|
const nodeBinding = tagExtra[kNodeBinding$1];
|
|
7890
7914
|
const write = writeTo(tag);
|
|
7891
7915
|
if (isOutputHTML()) {
|
|
7892
|
-
|
|
7916
|
+
const { body } = tag.node.body;
|
|
7917
|
+
if (nodeBinding && isEmptiableCommentBody(body)) if (body.length) write`${_marko_compiler.types.logicalExpression("||", buildCommentValue(body), _marko_compiler.types.stringLiteral(" "))}`;
|
|
7918
|
+
else write` `;
|
|
7919
|
+
else for (const child of body) if (_marko_compiler.types.isMarkoText(child)) write`${escapeCommentText(child.value)}`;
|
|
7893
7920
|
else if (_marko_compiler.types.isMarkoPlaceholder(child)) write`${callRuntime(child.escape ? "_escape_comment" : "_unescaped", child.value)}`;
|
|
7894
7921
|
} else {
|
|
7895
7922
|
const textLiteral = bodyToTextLiteral(tag.node.body);
|
|
@@ -7909,6 +7936,21 @@ var html_comment_default = {
|
|
|
7909
7936
|
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-comment"
|
|
7910
7937
|
}]
|
|
7911
7938
|
};
|
|
7939
|
+
function isEmptiableCommentBody(body) {
|
|
7940
|
+
for (const child of body) if (!_marko_compiler.types.isMarkoPlaceholder(child) || isNonEmptyLiteral(child.value)) return false;
|
|
7941
|
+
return true;
|
|
7942
|
+
}
|
|
7943
|
+
function isNonEmptyLiteral(value) {
|
|
7944
|
+
return _marko_compiler.types.isStringLiteral(value) ? !!value.value : _marko_compiler.types.isNumericLiteral(value);
|
|
7945
|
+
}
|
|
7946
|
+
function buildCommentValue(body) {
|
|
7947
|
+
let value;
|
|
7948
|
+
for (const child of body) {
|
|
7949
|
+
const part = callRuntime(child.escape ? "_escape_comment" : "_unescaped", child.value);
|
|
7950
|
+
value = value ? _marko_compiler.types.binaryExpression("+", value, part) : part;
|
|
7951
|
+
}
|
|
7952
|
+
return value;
|
|
7953
|
+
}
|
|
7912
7954
|
//#endregion
|
|
7913
7955
|
//#region src/translator/core/html-script.ts
|
|
7914
7956
|
var html_script_default = {
|
|
@@ -8881,6 +8923,7 @@ var import_declaration_default = {
|
|
|
8881
8923
|
if (!(tagImport && (0, _marko_compiler_babel_utils.loadFileForImport)(file, value))) throw importDecl.buildCodeFrameError("Unable to resolve marko file for load import.");
|
|
8882
8924
|
if ((node.importKind || "value") !== "value") throw importDecl.buildCodeFrameError("Invalid load import.");
|
|
8883
8925
|
for (const specifier of importDecl.get("specifiers")) if (!_marko_compiler.types.isImportDefaultSpecifier(specifier.node)) throw specifier.buildCodeFrameError("Invalid load import, only a default specifier is allowed.");
|
|
8926
|
+
if (!node.specifiers.some(_marko_compiler.types.isImportDefaultSpecifier)) throw importDecl.buildCodeFrameError("Invalid load import, a default specifier is required.");
|
|
8884
8927
|
}
|
|
8885
8928
|
},
|
|
8886
8929
|
translate: { exit(importDecl) {
|