@marko/runtime-tags 6.3.11 → 6.3.13
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 +18 -7
- package/dist/debug/dom.mjs +17 -8
- 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 +13 -5
- package/dist/dom.mjs +13 -5
- 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.`);
|
|
@@ -802,7 +802,8 @@ function init(runtimeId = "M") {
|
|
|
802
802
|
i--;
|
|
803
803
|
setParentBranch(orphanBranches.pop(), branch);
|
|
804
804
|
}
|
|
805
|
-
while (j && deferredOwners[
|
|
805
|
+
while (j && deferredOwners[j - 1]["#Id"] > branchId) {
|
|
806
|
+
j--;
|
|
806
807
|
const owner = deferredOwners.pop();
|
|
807
808
|
if (owner["#ClosestBranch"] !== owner) owner["#ClosestBranch"] = branch;
|
|
808
809
|
}
|
|
@@ -996,7 +997,12 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
996
997
|
setInputValue(el, restoreValue);
|
|
997
998
|
}
|
|
998
999
|
}
|
|
999
|
-
function
|
|
1000
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
1001
|
+
const el = scope[nodeAccessor];
|
|
1002
|
+
if (/i[ot]|e[cns]|^[bi]/.test(el.type)) _attr(el, "value", value);
|
|
1003
|
+
else _attr_input_value_default(scope, nodeAccessor, value);
|
|
1004
|
+
}
|
|
1005
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
1000
1006
|
const el = scope[nodeAccessor];
|
|
1001
1007
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1002
1008
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
@@ -1004,7 +1010,10 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
|
1004
1010
|
scope["ControlledValue:" + nodeAccessor] = normalizedValue;
|
|
1005
1011
|
scope["ControlledType:" + nodeAccessor] = valueChange ? 2 : 5;
|
|
1006
1012
|
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1007
|
-
else
|
|
1013
|
+
else setDefault(scope, nodeAccessor, normalizedValue);
|
|
1014
|
+
}
|
|
1015
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1016
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
1008
1017
|
}
|
|
1009
1018
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1010
1019
|
const el = scope[nodeAccessor];
|
|
@@ -1272,7 +1281,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1272
1281
|
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1273
1282
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1274
1283
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1275
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1284
|
+
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default);
|
|
1276
1285
|
skip = /^value(?:Change)?$/;
|
|
1277
1286
|
}
|
|
1278
1287
|
break;
|
|
@@ -2259,7 +2268,9 @@ exports._attr_input_checkedValue_script = _attr_input_checkedValue_script;
|
|
|
2259
2268
|
exports._attr_input_checked_default = _attr_input_checked_default;
|
|
2260
2269
|
exports._attr_input_checked_script = _attr_input_checked_script;
|
|
2261
2270
|
exports._attr_input_value = _attr_input_value;
|
|
2271
|
+
exports._attr_input_value_attribute_default = _attr_input_value_attribute_default;
|
|
2262
2272
|
exports._attr_input_value_default = _attr_input_value_default;
|
|
2273
|
+
exports._attr_input_value_dynamic_default = _attr_input_value_dynamic_default;
|
|
2263
2274
|
exports._attr_input_value_script = _attr_input_value_script;
|
|
2264
2275
|
exports._attr_nonce = _attr_nonce;
|
|
2265
2276
|
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.`);
|
|
@@ -800,7 +800,8 @@ function init(runtimeId = "M") {
|
|
|
800
800
|
i--;
|
|
801
801
|
setParentBranch(orphanBranches.pop(), branch);
|
|
802
802
|
}
|
|
803
|
-
while (j && deferredOwners[
|
|
803
|
+
while (j && deferredOwners[j - 1]["#Id"] > branchId) {
|
|
804
|
+
j--;
|
|
804
805
|
const owner = deferredOwners.pop();
|
|
805
806
|
if (owner["#ClosestBranch"] !== owner) owner["#ClosestBranch"] = branch;
|
|
806
807
|
}
|
|
@@ -994,7 +995,12 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
994
995
|
setInputValue(el, restoreValue);
|
|
995
996
|
}
|
|
996
997
|
}
|
|
997
|
-
function
|
|
998
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
999
|
+
const el = scope[nodeAccessor];
|
|
1000
|
+
if (/i[ot]|e[cns]|^[bi]/.test(el.type)) _attr(el, "value", value);
|
|
1001
|
+
else _attr_input_value_default(scope, nodeAccessor, value);
|
|
1002
|
+
}
|
|
1003
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
998
1004
|
const el = scope[nodeAccessor];
|
|
999
1005
|
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1000
1006
|
assertHandlerIsFunction("valueChange", valueChange);
|
|
@@ -1002,7 +1008,10 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
|
1002
1008
|
scope["ControlledValue:" + nodeAccessor] = normalizedValue;
|
|
1003
1009
|
scope["ControlledType:" + nodeAccessor] = valueChange ? 2 : 5;
|
|
1004
1010
|
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1005
|
-
else
|
|
1011
|
+
else setDefault(scope, nodeAccessor, normalizedValue);
|
|
1012
|
+
}
|
|
1013
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1014
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
1006
1015
|
}
|
|
1007
1016
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1008
1017
|
const el = scope[nodeAccessor];
|
|
@@ -1270,7 +1279,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1270
1279
|
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1271
1280
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1272
1281
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1273
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1282
|
+
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default);
|
|
1274
1283
|
skip = /^value(?:Change)?$/;
|
|
1275
1284
|
}
|
|
1276
1285
|
break;
|
|
@@ -2235,4 +2244,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
2235
2244
|
return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
|
|
2236
2245
|
}
|
|
2237
2246
|
//#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 };
|
|
2247
|
+
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
|
@@ -509,7 +509,8 @@ function init(runtimeId = "M") {
|
|
|
509
509
|
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "'" && (branch.a = startVisit);
|
|
510
510
|
} else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
511
511
|
for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
|
|
512
|
-
for (; j && deferredOwners[
|
|
512
|
+
for (; j && deferredOwners[j - 1].L > branchId;) {
|
|
513
|
+
j--;
|
|
513
514
|
let owner = deferredOwners.pop();
|
|
514
515
|
owner.F !== owner && (owner.F = branch);
|
|
515
516
|
}
|
|
@@ -632,9 +633,16 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
632
633
|
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
|
-
function
|
|
636
|
+
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
637
|
+
let el = scope[nodeAccessor];
|
|
638
|
+
/i[ot]|e[cns]|^[bi]/.test(el.type) ? _attr(el, "value", value) : _attr_input_value_default(scope, nodeAccessor, value);
|
|
639
|
+
}
|
|
640
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
636
641
|
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) :
|
|
642
|
+
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);
|
|
643
|
+
}
|
|
644
|
+
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
645
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
638
646
|
}
|
|
639
647
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
640
648
|
let el = scope[nodeAccessor];
|
|
@@ -830,7 +838,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
830
838
|
for (let name in events) events[name] = 0;
|
|
831
839
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && el.tagName) {
|
|
832
840
|
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)?$/);
|
|
841
|
+
"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
842
|
break;
|
|
835
843
|
case "SELECT":
|
|
836
844
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
@@ -1345,7 +1353,7 @@ function _load_race_trigger(...triggers) {
|
|
|
1345
1353
|
function getSelectorOrResolve(selector, resolve) {
|
|
1346
1354
|
return document.querySelector(selector) || resolve();
|
|
1347
1355
|
}
|
|
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", {
|
|
1356
|
+
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
1357
|
enumerable: !0,
|
|
1350
1358
|
get: function() {
|
|
1351
1359
|
return _dynamic_tag;
|
package/dist/dom.mjs
CHANGED
|
@@ -508,7 +508,8 @@ function init(runtimeId = "M") {
|
|
|
508
508
|
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "'" && (branch.a = startVisit);
|
|
509
509
|
} else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
510
510
|
for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
|
|
511
|
-
for (; j && deferredOwners[
|
|
511
|
+
for (; j && deferredOwners[j - 1].L > branchId;) {
|
|
512
|
+
j--;
|
|
512
513
|
let owner = deferredOwners.pop();
|
|
513
514
|
owner.F !== owner && (owner.F = branch);
|
|
514
515
|
}
|
|
@@ -631,9 +632,16 @@ function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
|
631
632
|
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
632
633
|
}
|
|
633
634
|
}
|
|
634
|
-
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) {
|
|
635
640
|
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) :
|
|
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);
|
|
637
645
|
}
|
|
638
646
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
639
647
|
let el = scope[nodeAccessor];
|
|
@@ -829,7 +837,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
829
837
|
for (let name in events) events[name] = 0;
|
|
830
838
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && el.tagName) {
|
|
831
839
|
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)?$/);
|
|
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)?$/);
|
|
833
841
|
break;
|
|
834
842
|
case "SELECT":
|
|
835
843
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
@@ -1345,4 +1353,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
1345
1353
|
return document.querySelector(selector) || resolve();
|
|
1346
1354
|
}
|
|
1347
1355
|
//#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 };
|
|
1356
|
+
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) {
|