marko 6.3.23 → 6.3.25
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/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/walk-range-size.d.ts +1 -1
- package/dist/debug/dom.js +149 -127
- package/dist/debug/dom.mjs +141 -128
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom/controllable.d.ts +22 -1
- package/dist/dom/dom.d.ts +5 -4
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +100 -88
- package/dist/dom.mjs +99 -87
- package/dist/html.js +2 -2
- package/dist/html.mjs +2 -2
- package/dist/translator/index.js +72 -11
- package/dist/translator/util/walks.d.ts +3 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +9 -0
- package/package.json +3 -3
package/dist/dom.js
CHANGED
|
@@ -14,13 +14,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
14
14
|
} else if (value === 37 || value === 49) walker.currentNode.replaceWith(walker.currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
15
15
|
else if (value === 38) return currentWalkIndex;
|
|
16
16
|
else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
17
|
-
else if (value < 92) for (value =
|
|
17
|
+
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) walker.nextNode();
|
|
18
18
|
else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walker.nextSibling();
|
|
19
19
|
else if (value < 117) {
|
|
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 = "", _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
23
|
+
}, cloneCache = {}, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, inputType = "", controllableScripts = {}, controllableRenders = {}, _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) => {
|
|
@@ -595,6 +595,26 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
|
595
595
|
el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
|
+
/** Filled by the latches a compiled page emits, so a page carries only the
|
|
599
|
+
* control kinds its tags can be (`_attrs_script` resolves the kind at run time). */
|
|
600
|
+
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
601
|
+
* a statically named tag passes its claim to `_attrs` instead. */
|
|
602
|
+
function _enable_controllable_input() {
|
|
603
|
+
controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
|
|
604
|
+
}
|
|
605
|
+
function _enable_controllable_textarea() {
|
|
606
|
+
controllableScripts[2] = _attr_input_value_script;
|
|
607
|
+
}
|
|
608
|
+
function _enable_controllable_select() {
|
|
609
|
+
controllableScripts[3] = _attr_select_value_script;
|
|
610
|
+
}
|
|
611
|
+
function _enable_controllable_open() {
|
|
612
|
+
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
613
|
+
}
|
|
614
|
+
/** A run-time tag name can be any controllable, so its page enables them all. */
|
|
615
|
+
function _enable_controllable() {
|
|
616
|
+
_enable_controllable_input(), _enable_controllable_select(), _enable_controllable_open(), controllableRenders.INPUT = _controllable_input, controllableRenders.TEXTAREA = _controllable_textarea, controllableRenders.SELECT = _controllable_select, controllableRenders.DETAILS = controllableRenders.DIALOG = _controllable_open;
|
|
617
|
+
}
|
|
598
618
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
599
619
|
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
600
620
|
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
@@ -692,12 +712,12 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
692
712
|
break;
|
|
693
713
|
}
|
|
694
714
|
}
|
|
695
|
-
syncControllableFormInput(el, hasSelectChanged, onChange),
|
|
696
|
-
let value = scope["G" + nodeAccessor];
|
|
697
|
-
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) && onChange();
|
|
698
|
-
}).observe(el, {
|
|
715
|
+
syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
|
|
699
716
|
childList: !0,
|
|
700
717
|
subtree: !0
|
|
718
|
+
}, () => {
|
|
719
|
+
let value = scope["G" + nodeAccessor];
|
|
720
|
+
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) && onChange();
|
|
701
721
|
});
|
|
702
722
|
}
|
|
703
723
|
function setSelectValue(el, value, multiple) {
|
|
@@ -716,17 +736,20 @@ function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
|
716
736
|
}
|
|
717
737
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
718
738
|
let el = scope[nodeAccessor];
|
|
719
|
-
|
|
739
|
+
observeOnce(scope, nodeAccessor, {
|
|
740
|
+
attributes: !0,
|
|
741
|
+
attributeFilter: ["open"]
|
|
742
|
+
}, () => {
|
|
720
743
|
let openChange = scope["E" + nodeAccessor];
|
|
721
744
|
if (openChange && el.open === !scope["G" + nodeAccessor]) {
|
|
722
745
|
let newValue = el.open;
|
|
723
746
|
el.open = !newValue, openChange(newValue), run();
|
|
724
747
|
}
|
|
725
|
-
}).observe(el, {
|
|
726
|
-
attributes: !0,
|
|
727
|
-
attributeFilter: ["open"]
|
|
728
748
|
});
|
|
729
749
|
}
|
|
750
|
+
function observeOnce(scope, nodeAccessor, init, callback) {
|
|
751
|
+
(scope["N" + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
752
|
+
}
|
|
730
753
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
731
754
|
el._ = onChange, delegate("input", handleChange), el.form && delegate("reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
|
|
732
755
|
}
|
|
@@ -759,6 +782,18 @@ function updateList(arr, val, push) {
|
|
|
759
782
|
let index = arr.indexOf(val);
|
|
760
783
|
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
|
761
784
|
}
|
|
785
|
+
function _controllable_input(scope, nodeAccessor, nextAttrs) {
|
|
786
|
+
return "checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), /^(?:value|checked(?:Value)?)(?:Change)?$/) : _controllable_textarea(scope, nodeAccessor, nextAttrs, _attr_input_value_dynamic_default);
|
|
787
|
+
}
|
|
788
|
+
function _controllable_textarea(scope, nodeAccessor, nextAttrs, dynamicDefault) {
|
|
789
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) return _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, dynamicDefault), /^value(?:Change)?$/;
|
|
790
|
+
}
|
|
791
|
+
function _controllable_select(scope, nodeAccessor, nextAttrs) {
|
|
792
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) return _attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), /^value(?:Change)?$/;
|
|
793
|
+
}
|
|
794
|
+
function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
795
|
+
if ("open" in nextAttrs || "openChange" in nextAttrs) return _attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), /^open(?:Change)?$/;
|
|
796
|
+
}
|
|
762
797
|
//#endregion
|
|
763
798
|
//#region src/dom/dom.ts
|
|
764
799
|
function _to_text(value) {
|
|
@@ -807,21 +842,21 @@ function _text_content(node, value) {
|
|
|
807
842
|
let normalizedValue = _to_text(value);
|
|
808
843
|
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
|
809
844
|
}
|
|
810
|
-
function _attrs(scope, nodeAccessor, nextAttrs) {
|
|
845
|
+
function _attrs(scope, nodeAccessor, nextAttrs, controllable) {
|
|
811
846
|
let el = scope[nodeAccessor];
|
|
812
847
|
for (let i = el.attributes.length; i--;) {
|
|
813
848
|
let { name } = el.attributes.item(i);
|
|
814
849
|
nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)) || el.removeAttribute(name);
|
|
815
850
|
}
|
|
816
|
-
attrsInternal(scope, nodeAccessor, nextAttrs);
|
|
851
|
+
attrsInternal(scope, nodeAccessor, nextAttrs, controllable);
|
|
817
852
|
}
|
|
818
|
-
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
|
819
|
-
_attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
853
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs, controllable) {
|
|
854
|
+
_attrs(scope, nodeAccessor, nextAttrs, controllable), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
820
855
|
}
|
|
821
856
|
function hasAttrAlias(element, attr, nextAttrs) {
|
|
822
857
|
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
|
823
858
|
}
|
|
824
|
-
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
859
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
825
860
|
let el = scope[nodeAccessor], partial = {};
|
|
826
861
|
for (let i = el.attributes.length; i--;) {
|
|
827
862
|
let { name } = el.attributes.item(i);
|
|
@@ -831,29 +866,16 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
|
831
866
|
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
832
867
|
skip[key] || (partial[key] = nextAttrs[name]);
|
|
833
868
|
}
|
|
834
|
-
attrsInternal(scope, nodeAccessor, partial);
|
|
869
|
+
attrsInternal(scope, nodeAccessor, partial, controllable);
|
|
835
870
|
}
|
|
836
|
-
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
|
837
|
-
_attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
871
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
872
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
838
873
|
}
|
|
839
|
-
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
840
|
-
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor]
|
|
874
|
+
function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
875
|
+
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
841
876
|
for (let name in events) events[name] = 0;
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
"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)?$/);
|
|
845
|
-
break;
|
|
846
|
-
case "SELECT":
|
|
847
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
848
|
-
break;
|
|
849
|
-
case "TEXTAREA":
|
|
850
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
851
|
-
break;
|
|
852
|
-
case "DETAILS":
|
|
853
|
-
case "DIALOG":
|
|
854
|
-
("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), skip = /^open(?:Change)?$/);
|
|
855
|
-
break;
|
|
856
|
-
}
|
|
877
|
+
scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0;
|
|
878
|
+
let skip = nextAttrs && (controllable || controllableRenders[el.tagName])?.(scope, nodeAccessor, nextAttrs);
|
|
857
879
|
for (let name in nextAttrs) {
|
|
858
880
|
let value = nextAttrs[name];
|
|
859
881
|
switch (name) {
|
|
@@ -876,23 +898,7 @@ function _attr_content(scope, nodeAccessor, value) {
|
|
|
876
898
|
}
|
|
877
899
|
function _attrs_script(scope, nodeAccessor) {
|
|
878
900
|
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
879
|
-
|
|
880
|
-
case 0:
|
|
881
|
-
_attr_input_checked_script(scope, nodeAccessor);
|
|
882
|
-
break;
|
|
883
|
-
case 1:
|
|
884
|
-
_attr_input_checkedValue_script(scope, nodeAccessor);
|
|
885
|
-
break;
|
|
886
|
-
case 2:
|
|
887
|
-
_attr_input_value_script(scope, nodeAccessor);
|
|
888
|
-
break;
|
|
889
|
-
case 3:
|
|
890
|
-
_attr_select_value_script(scope, nodeAccessor);
|
|
891
|
-
break;
|
|
892
|
-
case 4:
|
|
893
|
-
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
|
894
|
-
break;
|
|
895
|
-
}
|
|
901
|
+
controllableScripts[scope["F" + nodeAccessor]]?.(scope, nodeAccessor);
|
|
896
902
|
for (let name in events) _on(el, name, events[name]);
|
|
897
903
|
}
|
|
898
904
|
function _html(scope, value, accessor) {
|
|
@@ -934,37 +940,42 @@ function toInsertNode(startNode, endNode) {
|
|
|
934
940
|
function _await_promise(nodeAccessor, params) {
|
|
935
941
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
936
942
|
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
|
|
937
|
-
|
|
943
|
+
_enable_catch();
|
|
944
|
+
let resolveAwait = (scope, referenceNode, value) => {
|
|
945
|
+
let awaitBranch = scope[branchAccessor];
|
|
946
|
+
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
947
|
+
}, awaitPromise = (scope, promise) => {
|
|
948
|
+
!isPromise(promise) && scope[promiseAccessor] && (promise = Promise.resolve(promise));
|
|
949
|
+
let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
|
|
950
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
951
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
938
954
|
if (!isPromise(promise)) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
scope[branchAccessor] ? resolve() : scope[promiseAccessor] = resolve;
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
promise = Promise.resolve(promise);
|
|
955
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
956
|
+
return;
|
|
945
957
|
}
|
|
946
|
-
let
|
|
947
|
-
placeholderShown.add(pendingEffects), tryPlaceholder
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
if (
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
} else dismissPlaceholder(tryBranch);
|
|
958
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
959
|
-
}
|
|
960
|
-
}), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
958
|
+
let awaitCounter = tryBranch.O;
|
|
959
|
+
placeholderShown.add(pendingEffects), !tryPlaceholder && !awaitCounter?.i && (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
960
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
961
|
+
let anchor = scope[nodeAccessor];
|
|
962
|
+
if (anchor.parentNode) {
|
|
963
|
+
let detachedParent = scope[branchAccessor].S.parentNode;
|
|
964
|
+
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
965
|
+
}
|
|
966
|
+
} else dismissPlaceholder(tryBranch);
|
|
967
|
+
})), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
961
968
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
962
|
-
}, -1)))))
|
|
969
|
+
}, -1)))));
|
|
963
970
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
964
971
|
if (thisPromise === scope[promiseAccessor]) {
|
|
965
972
|
let referenceNode = scope[nodeAccessor];
|
|
966
|
-
scope[promiseAccessor] = 0,
|
|
967
|
-
|
|
973
|
+
if (scope[promiseAccessor] = 0, scope.F?.H === 0) {
|
|
974
|
+
awaitCounter.c(), run();
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
queueAsyncRender(scope, () => {
|
|
978
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
968
979
|
let pendingRenders = awaitBranch.W;
|
|
969
980
|
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
970
981
|
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
@@ -983,10 +994,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
983
994
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
984
995
|
});
|
|
985
996
|
};
|
|
986
|
-
|
|
987
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
988
|
-
let awaitBranch = scope[branchAccessor];
|
|
989
|
-
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
997
|
+
return awaitPromise;
|
|
990
998
|
}
|
|
991
999
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
992
1000
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
@@ -1001,15 +1009,19 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1001
1009
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
1002
1010
|
if (!tryBranch) return;
|
|
1003
1011
|
let awaitCounter = tryBranch.O;
|
|
1004
|
-
return awaitCounter?.i || (awaitCounter = tryBranch.
|
|
1012
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1013
|
+
insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1014
|
+
}, -1)))), awaitCounter;
|
|
1015
|
+
}
|
|
1016
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1017
|
+
let awaitCounter = tryBranch.O = {
|
|
1005
1018
|
i: 0,
|
|
1006
1019
|
c() {
|
|
1007
1020
|
if (--awaitCounter.i) return 1;
|
|
1008
|
-
|
|
1021
|
+
done(), queueEffect(tryBranch, runPendingEffects);
|
|
1009
1022
|
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
}, -1)))), awaitCounter;
|
|
1023
|
+
};
|
|
1024
|
+
return awaitCounter;
|
|
1013
1025
|
}
|
|
1014
1026
|
function runPendingEffects(scope) {
|
|
1015
1027
|
let effects = scope.J;
|
|
@@ -1357,9 +1369,9 @@ function _load_race_trigger(...triggers) {
|
|
|
1357
1369
|
function getSelectorOrResolve(selector, resolve) {
|
|
1358
1370
|
return document.querySelector(selector) || resolve();
|
|
1359
1371
|
}
|
|
1360
|
-
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", {
|
|
1372
|
+
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, exports._controllable_input = _controllable_input, exports._controllable_open = _controllable_open, exports._controllable_select = _controllable_select, exports._controllable_textarea = _controllable_textarea, Object.defineProperty(exports, "_dynamic_tag", {
|
|
1361
1373
|
enumerable: !0,
|
|
1362
1374
|
get: function() {
|
|
1363
1375
|
return _dynamic_tag;
|
|
1364
1376
|
}
|
|
1365
|
-
}), exports._dynamic_tag_content = _dynamic_tag_content, exports._el = _el, exports._el_read = _el_read, exports._enable_catch = _enable_catch, exports._for_closure = _for_closure, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_selector = _for_selector, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_resume = _hoist_resume, exports._html = _html, exports._id = _id, exports._if = _if, exports._if_closure = _if_closure, exports._let = _let, exports._let_change = _let_change, exports._lifecycle = _lifecycle, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = _on, exports._or = _or, exports._resume = _resume, exports._resume_dynamic_tag = _resume_dynamic_tag, exports._return = _return, exports._return_change = _return_change, exports._script = _script, exports._show = _show, exports._style_rule_item = _style_rule_item, exports._style_shell = _style_shell, exports._template = _template, exports._text = _text, exports._text_content = _text_content, exports._to_text = _to_text, exports._try = _try, exports._var = _var, exports._var_change = _var_change, exports._var_resume = _var_resume, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.init = init, exports.initEmbedded = initEmbedded, exports.ready = ready, exports.run = run;
|
|
1377
|
+
}), exports._dynamic_tag_content = _dynamic_tag_content, exports._el = _el, exports._el_read = _el_read, exports._enable_catch = _enable_catch, exports._enable_controllable = _enable_controllable, exports._enable_controllable_input = _enable_controllable_input, exports._enable_controllable_open = _enable_controllable_open, exports._enable_controllable_select = _enable_controllable_select, exports._enable_controllable_textarea = _enable_controllable_textarea, exports._for_closure = _for_closure, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_selector = _for_selector, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_resume = _hoist_resume, exports._html = _html, exports._id = _id, exports._if = _if, exports._if_closure = _if_closure, exports._let = _let, exports._let_change = _let_change, exports._lifecycle = _lifecycle, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = _on, exports._or = _or, exports._resume = _resume, exports._resume_dynamic_tag = _resume_dynamic_tag, exports._return = _return, exports._return_change = _return_change, exports._script = _script, exports._show = _show, exports._style_rule_item = _style_rule_item, exports._style_shell = _style_shell, exports._template = _template, exports._text = _text, exports._text_content = _text_content, exports._to_text = _to_text, exports._try = _try, exports._var = _var, exports._var_change = _var_change, exports._var_resume = _var_resume, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.init = init, exports.initEmbedded = initEmbedded, exports.ready = ready, exports.run = run;
|
package/dist/dom.mjs
CHANGED
|
@@ -14,13 +14,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
14
14
|
} else if (value === 37 || value === 49) walker.currentNode.replaceWith(walker.currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
15
15
|
else if (value === 38) return currentWalkIndex;
|
|
16
16
|
else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
17
|
-
else if (value < 92) for (value =
|
|
17
|
+
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) walker.nextNode();
|
|
18
18
|
else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walker.nextSibling();
|
|
19
19
|
else if (value < 117) {
|
|
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 = "", _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
23
|
+
}, cloneCache = {}, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, inputType = "", controllableScripts = {}, controllableRenders = {}, _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) => {
|
|
@@ -594,6 +594,26 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
|
594
594
|
el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
+
/** Filled by the latches a compiled page emits, so a page carries only the
|
|
598
|
+
* control kinds its tags can be (`_attrs_script` resolves the kind at run time). */
|
|
599
|
+
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
600
|
+
* a statically named tag passes its claim to `_attrs` instead. */
|
|
601
|
+
function _enable_controllable_input() {
|
|
602
|
+
controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
|
|
603
|
+
}
|
|
604
|
+
function _enable_controllable_textarea() {
|
|
605
|
+
controllableScripts[2] = _attr_input_value_script;
|
|
606
|
+
}
|
|
607
|
+
function _enable_controllable_select() {
|
|
608
|
+
controllableScripts[3] = _attr_select_value_script;
|
|
609
|
+
}
|
|
610
|
+
function _enable_controllable_open() {
|
|
611
|
+
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
612
|
+
}
|
|
613
|
+
/** A run-time tag name can be any controllable, so its page enables them all. */
|
|
614
|
+
function _enable_controllable() {
|
|
615
|
+
_enable_controllable_input(), _enable_controllable_select(), _enable_controllable_open(), controllableRenders.INPUT = _controllable_input, controllableRenders.TEXTAREA = _controllable_textarea, controllableRenders.SELECT = _controllable_select, controllableRenders.DETAILS = controllableRenders.DIALOG = _controllable_open;
|
|
616
|
+
}
|
|
597
617
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
598
618
|
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
599
619
|
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
@@ -691,12 +711,12 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
691
711
|
break;
|
|
692
712
|
}
|
|
693
713
|
}
|
|
694
|
-
syncControllableFormInput(el, hasSelectChanged, onChange),
|
|
695
|
-
let value = scope["G" + nodeAccessor];
|
|
696
|
-
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) && onChange();
|
|
697
|
-
}).observe(el, {
|
|
714
|
+
syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
|
|
698
715
|
childList: !0,
|
|
699
716
|
subtree: !0
|
|
717
|
+
}, () => {
|
|
718
|
+
let value = scope["G" + nodeAccessor];
|
|
719
|
+
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) && onChange();
|
|
700
720
|
});
|
|
701
721
|
}
|
|
702
722
|
function setSelectValue(el, value, multiple) {
|
|
@@ -715,17 +735,20 @@ function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
|
715
735
|
}
|
|
716
736
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
717
737
|
let el = scope[nodeAccessor];
|
|
718
|
-
|
|
738
|
+
observeOnce(scope, nodeAccessor, {
|
|
739
|
+
attributes: !0,
|
|
740
|
+
attributeFilter: ["open"]
|
|
741
|
+
}, () => {
|
|
719
742
|
let openChange = scope["E" + nodeAccessor];
|
|
720
743
|
if (openChange && el.open === !scope["G" + nodeAccessor]) {
|
|
721
744
|
let newValue = el.open;
|
|
722
745
|
el.open = !newValue, openChange(newValue), run();
|
|
723
746
|
}
|
|
724
|
-
}).observe(el, {
|
|
725
|
-
attributes: !0,
|
|
726
|
-
attributeFilter: ["open"]
|
|
727
747
|
});
|
|
728
748
|
}
|
|
749
|
+
function observeOnce(scope, nodeAccessor, init, callback) {
|
|
750
|
+
(scope["N" + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
751
|
+
}
|
|
729
752
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
730
753
|
el._ = onChange, delegate("input", handleChange), el.form && delegate("reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
|
|
731
754
|
}
|
|
@@ -758,6 +781,18 @@ function updateList(arr, val, push) {
|
|
|
758
781
|
let index = arr.indexOf(val);
|
|
759
782
|
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
|
760
783
|
}
|
|
784
|
+
function _controllable_input(scope, nodeAccessor, nextAttrs) {
|
|
785
|
+
return "checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), /^(?:value|checked(?:Value)?)(?:Change)?$/) : _controllable_textarea(scope, nodeAccessor, nextAttrs, _attr_input_value_dynamic_default);
|
|
786
|
+
}
|
|
787
|
+
function _controllable_textarea(scope, nodeAccessor, nextAttrs, dynamicDefault) {
|
|
788
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) return _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, dynamicDefault), /^value(?:Change)?$/;
|
|
789
|
+
}
|
|
790
|
+
function _controllable_select(scope, nodeAccessor, nextAttrs) {
|
|
791
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) return _attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), /^value(?:Change)?$/;
|
|
792
|
+
}
|
|
793
|
+
function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
794
|
+
if ("open" in nextAttrs || "openChange" in nextAttrs) return _attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), /^open(?:Change)?$/;
|
|
795
|
+
}
|
|
761
796
|
//#endregion
|
|
762
797
|
//#region src/dom/dom.ts
|
|
763
798
|
function _to_text(value) {
|
|
@@ -806,21 +841,21 @@ function _text_content(node, value) {
|
|
|
806
841
|
let normalizedValue = _to_text(value);
|
|
807
842
|
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
|
808
843
|
}
|
|
809
|
-
function _attrs(scope, nodeAccessor, nextAttrs) {
|
|
844
|
+
function _attrs(scope, nodeAccessor, nextAttrs, controllable) {
|
|
810
845
|
let el = scope[nodeAccessor];
|
|
811
846
|
for (let i = el.attributes.length; i--;) {
|
|
812
847
|
let { name } = el.attributes.item(i);
|
|
813
848
|
nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)) || el.removeAttribute(name);
|
|
814
849
|
}
|
|
815
|
-
attrsInternal(scope, nodeAccessor, nextAttrs);
|
|
850
|
+
attrsInternal(scope, nodeAccessor, nextAttrs, controllable);
|
|
816
851
|
}
|
|
817
|
-
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
|
818
|
-
_attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
852
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs, controllable) {
|
|
853
|
+
_attrs(scope, nodeAccessor, nextAttrs, controllable), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
819
854
|
}
|
|
820
855
|
function hasAttrAlias(element, attr, nextAttrs) {
|
|
821
856
|
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
|
822
857
|
}
|
|
823
|
-
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
858
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
824
859
|
let el = scope[nodeAccessor], partial = {};
|
|
825
860
|
for (let i = el.attributes.length; i--;) {
|
|
826
861
|
let { name } = el.attributes.item(i);
|
|
@@ -830,29 +865,16 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
|
830
865
|
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
831
866
|
skip[key] || (partial[key] = nextAttrs[name]);
|
|
832
867
|
}
|
|
833
|
-
attrsInternal(scope, nodeAccessor, partial);
|
|
868
|
+
attrsInternal(scope, nodeAccessor, partial, controllable);
|
|
834
869
|
}
|
|
835
|
-
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
|
836
|
-
_attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
870
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
871
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
837
872
|
}
|
|
838
|
-
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
839
|
-
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor]
|
|
873
|
+
function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
874
|
+
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
840
875
|
for (let name in events) events[name] = 0;
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
"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)?$/);
|
|
844
|
-
break;
|
|
845
|
-
case "SELECT":
|
|
846
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
847
|
-
break;
|
|
848
|
-
case "TEXTAREA":
|
|
849
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
850
|
-
break;
|
|
851
|
-
case "DETAILS":
|
|
852
|
-
case "DIALOG":
|
|
853
|
-
("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), skip = /^open(?:Change)?$/);
|
|
854
|
-
break;
|
|
855
|
-
}
|
|
876
|
+
scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0;
|
|
877
|
+
let skip = nextAttrs && (controllable || controllableRenders[el.tagName])?.(scope, nodeAccessor, nextAttrs);
|
|
856
878
|
for (let name in nextAttrs) {
|
|
857
879
|
let value = nextAttrs[name];
|
|
858
880
|
switch (name) {
|
|
@@ -875,23 +897,7 @@ function _attr_content(scope, nodeAccessor, value) {
|
|
|
875
897
|
}
|
|
876
898
|
function _attrs_script(scope, nodeAccessor) {
|
|
877
899
|
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
878
|
-
|
|
879
|
-
case 0:
|
|
880
|
-
_attr_input_checked_script(scope, nodeAccessor);
|
|
881
|
-
break;
|
|
882
|
-
case 1:
|
|
883
|
-
_attr_input_checkedValue_script(scope, nodeAccessor);
|
|
884
|
-
break;
|
|
885
|
-
case 2:
|
|
886
|
-
_attr_input_value_script(scope, nodeAccessor);
|
|
887
|
-
break;
|
|
888
|
-
case 3:
|
|
889
|
-
_attr_select_value_script(scope, nodeAccessor);
|
|
890
|
-
break;
|
|
891
|
-
case 4:
|
|
892
|
-
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
|
893
|
-
break;
|
|
894
|
-
}
|
|
900
|
+
controllableScripts[scope["F" + nodeAccessor]]?.(scope, nodeAccessor);
|
|
895
901
|
for (let name in events) _on(el, name, events[name]);
|
|
896
902
|
}
|
|
897
903
|
function _html(scope, value, accessor) {
|
|
@@ -933,37 +939,42 @@ function toInsertNode(startNode, endNode) {
|
|
|
933
939
|
function _await_promise(nodeAccessor, params) {
|
|
934
940
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
935
941
|
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
|
|
936
|
-
|
|
942
|
+
_enable_catch();
|
|
943
|
+
let resolveAwait = (scope, referenceNode, value) => {
|
|
944
|
+
let awaitBranch = scope[branchAccessor];
|
|
945
|
+
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
946
|
+
}, awaitPromise = (scope, promise) => {
|
|
947
|
+
!isPromise(promise) && scope[promiseAccessor] && (promise = Promise.resolve(promise));
|
|
948
|
+
let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
|
|
949
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
950
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
937
953
|
if (!isPromise(promise)) {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
scope[branchAccessor] ? resolve() : scope[promiseAccessor] = resolve;
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
|
-
promise = Promise.resolve(promise);
|
|
954
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
955
|
+
return;
|
|
944
956
|
}
|
|
945
|
-
let
|
|
946
|
-
placeholderShown.add(pendingEffects), tryPlaceholder
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
if (
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
} else dismissPlaceholder(tryBranch);
|
|
957
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
958
|
-
}
|
|
959
|
-
}), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
957
|
+
let awaitCounter = tryBranch.O;
|
|
958
|
+
placeholderShown.add(pendingEffects), !tryPlaceholder && !awaitCounter?.i && (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
959
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
960
|
+
let anchor = scope[nodeAccessor];
|
|
961
|
+
if (anchor.parentNode) {
|
|
962
|
+
let detachedParent = scope[branchAccessor].S.parentNode;
|
|
963
|
+
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
964
|
+
}
|
|
965
|
+
} else dismissPlaceholder(tryBranch);
|
|
966
|
+
})), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
960
967
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
961
|
-
}, -1)))))
|
|
968
|
+
}, -1)))));
|
|
962
969
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
963
970
|
if (thisPromise === scope[promiseAccessor]) {
|
|
964
971
|
let referenceNode = scope[nodeAccessor];
|
|
965
|
-
scope[promiseAccessor] = 0,
|
|
966
|
-
|
|
972
|
+
if (scope[promiseAccessor] = 0, scope.F?.H === 0) {
|
|
973
|
+
awaitCounter.c(), run();
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
queueAsyncRender(scope, () => {
|
|
977
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
967
978
|
let pendingRenders = awaitBranch.W;
|
|
968
979
|
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
969
980
|
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
@@ -982,10 +993,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
982
993
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
983
994
|
});
|
|
984
995
|
};
|
|
985
|
-
|
|
986
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
987
|
-
let awaitBranch = scope[branchAccessor];
|
|
988
|
-
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
996
|
+
return awaitPromise;
|
|
989
997
|
}
|
|
990
998
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
991
999
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
@@ -1000,15 +1008,19 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1000
1008
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
1001
1009
|
if (!tryBranch) return;
|
|
1002
1010
|
let awaitCounter = tryBranch.O;
|
|
1003
|
-
return awaitCounter?.i || (awaitCounter = tryBranch.
|
|
1011
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1012
|
+
insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1013
|
+
}, -1)))), awaitCounter;
|
|
1014
|
+
}
|
|
1015
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1016
|
+
let awaitCounter = tryBranch.O = {
|
|
1004
1017
|
i: 0,
|
|
1005
1018
|
c() {
|
|
1006
1019
|
if (--awaitCounter.i) return 1;
|
|
1007
|
-
|
|
1020
|
+
done(), queueEffect(tryBranch, runPendingEffects);
|
|
1008
1021
|
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
}, -1)))), awaitCounter;
|
|
1022
|
+
};
|
|
1023
|
+
return awaitCounter;
|
|
1012
1024
|
}
|
|
1013
1025
|
function runPendingEffects(scope) {
|
|
1014
1026
|
let effects = scope.J;
|
|
@@ -1357,4 +1369,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
1357
1369
|
return document.querySelector(selector) || resolve();
|
|
1358
1370
|
}
|
|
1359
1371
|
//#endregion
|
|
1360
|
-
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 };
|
|
1372
|
+
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, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _enable_controllable, _enable_controllable_input, _enable_controllable_open, _enable_controllable_select, _enable_controllable_textarea, _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 };
|