marko 6.0.0-next.3.39 → 6.0.0-next.3.41
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 +810 -863
- package/dist/debug/dom.mjs +810 -863
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom/control-flow.d.ts +1 -2
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom.js +308 -334
- package/dist/dom.mjs +308 -334
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/translator/index.js +8 -1
- package/package.json +1 -1
package/dist/dom.js
CHANGED
@@ -158,26 +158,20 @@ function normalizeDynamicRenderer(value2) {
|
|
158
158
|
}
|
159
159
|
|
160
160
|
// src/dom/event.ts
|
161
|
-
var
|
161
|
+
var defaultDelegator = createDelegator();
|
162
162
|
function on(element, type, handler) {
|
163
|
-
|
164
|
-
handlersByElement || elementHandlersByEvent.set(type, handlersByElement = /* @__PURE__ */ new WeakMap()), handlersByElement.has(element) || defaultDelegator(element, type, handleDelegated), handlersByElement.set(element, handler || null);
|
163
|
+
element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
|
165
164
|
}
|
166
165
|
function createDelegator() {
|
167
166
|
let kEvents = Symbol();
|
168
167
|
return function(node, type, handler) {
|
169
|
-
|
170
|
-
(root[kEvents] ||= {})[type] ||= (root.addEventListener(type, handler, !0), 1);
|
168
|
+
((node = node.getRootNode())[kEvents] ||= {})[type] ||= (node.addEventListener(type, handler, !0), 1);
|
171
169
|
};
|
172
170
|
}
|
173
171
|
function handleDelegated(ev) {
|
174
172
|
let target = !rendering && ev.target;
|
175
|
-
|
176
|
-
|
177
|
-
if (handlersByElement.get(target)?.(ev, target), ev.bubbles)
|
178
|
-
for (; (target = target.parentNode) && !ev.cancelBubble; )
|
179
|
-
handlersByElement.get(target)?.(ev, target);
|
180
|
-
}
|
173
|
+
for (; target; )
|
174
|
+
target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
181
175
|
}
|
182
176
|
|
183
177
|
// src/dom/resolve-cursor-position.ts
|
@@ -357,9 +351,16 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
357
351
|
let checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
358
352
|
if (checkedValueChange) {
|
359
353
|
let oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
360
|
-
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */, checkedValueChange(
|
354
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */, checkedValueChange(
|
361
355
|
Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0
|
362
|
-
), run(), scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */
|
356
|
+
), run(), scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */)
|
357
|
+
if (el.name && el.type[0] === "r")
|
358
|
+
for (let radio of el.getRootNode().querySelectorAll(
|
359
|
+
`[type=radio][name=${CSS.escape(el.name)}]`
|
360
|
+
))
|
361
|
+
radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
|
362
|
+
else
|
363
|
+
el.checked = !el.checked;
|
363
364
|
}
|
364
365
|
});
|
365
366
|
}
|
@@ -398,7 +399,7 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
398
399
|
valueChange
|
399
400
|
));
|
400
401
|
};
|
401
|
-
|
402
|
+
el._ || new MutationObserver(() => {
|
402
403
|
let value2 = scope[nodeAccessor + ":" /* ControlledValue */];
|
403
404
|
(Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) && onChange();
|
404
405
|
}).observe(el, {
|
@@ -456,19 +457,17 @@ function setValueAndUpdateSelection(el, value2) {
|
|
456
457
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
457
458
|
scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange, checkedChange ? (scope[nodeAccessor + "=" /* ControlledType */] = type, scope[nodeAccessor].checked = checked) : (scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
|
458
459
|
}
|
459
|
-
var controllableDelegate = createDelegator()
|
460
|
+
var controllableDelegate = createDelegator();
|
460
461
|
function syncControllable(el, event, hasChanged, onChange) {
|
461
|
-
|
462
|
+
el._ || (controllableDelegate(el, event, handleChange), el.form && controllableDelegate(el.form, "reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange)), el._ = onChange;
|
462
463
|
}
|
463
464
|
function handleChange(ev) {
|
464
|
-
|
465
|
+
ev.target._?.(ev);
|
465
466
|
}
|
466
467
|
function handleFormReset(ev) {
|
467
468
|
let handlers = [];
|
468
|
-
for (let el of ev.target.elements)
|
469
|
-
|
470
|
-
handler && hasFormElementChanged(el) && handlers.push(handler);
|
471
|
-
}
|
469
|
+
for (let el of ev.target.elements)
|
470
|
+
el._ && hasFormElementChanged(el) && handlers.push(el._);
|
472
471
|
requestAnimationFrame(() => {
|
473
472
|
if (!ev.defaultPrevented)
|
474
473
|
for (let change of handlers)
|
@@ -716,10 +715,6 @@ function finishPendingScopes() {
|
|
716
715
|
scope.g = 0;
|
717
716
|
pendingScopes = [];
|
718
717
|
}
|
719
|
-
var emptyBranch = createScope({});
|
720
|
-
function getEmptyBranch(marker) {
|
721
|
-
return emptyBranch.a = emptyBranch.b = marker, emptyBranch;
|
722
|
-
}
|
723
718
|
function destroyBranch(branch) {
|
724
719
|
branch.q?.j?.delete(branch), destroyNestedBranches(branch);
|
725
720
|
}
|
@@ -741,6 +736,222 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
741
736
|
);
|
742
737
|
}
|
743
738
|
|
739
|
+
// src/dom/schedule.ts
|
740
|
+
var port2 = /* @__PURE__ */ (() => {
|
741
|
+
let { port1, port2: port22 } = new MessageChannel();
|
742
|
+
return port1.onmessage = () => {
|
743
|
+
isScheduled = !1, run();
|
744
|
+
}, port22;
|
745
|
+
})(), isScheduled;
|
746
|
+
function schedule() {
|
747
|
+
isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
|
748
|
+
}
|
749
|
+
function flushAndWaitFrame() {
|
750
|
+
run(), requestAnimationFrame(triggerMacroTask);
|
751
|
+
}
|
752
|
+
function triggerMacroTask() {
|
753
|
+
port2.postMessage(0);
|
754
|
+
}
|
755
|
+
|
756
|
+
// src/dom/signals.ts
|
757
|
+
var MARK = {}, CLEAN = {}, DIRTY = {};
|
758
|
+
function state(valueAccessor, fn, getIntersection) {
|
759
|
+
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
760
|
+
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
761
|
+
scope,
|
762
|
+
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
763
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : (schedule(), queueSource(scope, valueSignal, valueOrOp)), valueOrOp);
|
764
|
+
}
|
765
|
+
function value(valueAccessor, fn, getIntersection) {
|
766
|
+
let markAccessor = valueAccessor + "#" /* Mark */, intersection2;
|
767
|
+
return (scope, valueOrOp) => {
|
768
|
+
if (valueOrOp === MARK)
|
769
|
+
(scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
770
|
+
else if (valueOrOp !== DIRTY) {
|
771
|
+
let existing = scope[markAccessor] !== void 0;
|
772
|
+
(scope[markAccessor] ||= 1) === 1 && (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp ? getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : (scope[valueAccessor] = valueOrOp, fn && fn(scope, valueOrOp), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY))), scope[markAccessor]--;
|
773
|
+
}
|
774
|
+
};
|
775
|
+
}
|
776
|
+
var accessorId = 0;
|
777
|
+
function intersection(count, fn, getIntersection) {
|
778
|
+
let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2;
|
779
|
+
return (scope, op) => {
|
780
|
+
op === MARK ? (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK) : scope[markAccessor] === void 0 ? (scope[markAccessor] = count - 1, scope[dirtyAccessor] = !0) : --scope[markAccessor] === 0 ? op === DIRTY || scope[dirtyAccessor] ? (scope[dirtyAccessor] = !1, fn(scope), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY)) : getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : scope[dirtyAccessor] ||= op === DIRTY;
|
781
|
+
};
|
782
|
+
}
|
783
|
+
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
|
784
|
+
let childSignal = closure(valueAccessor, fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, ownerSignal = (ownerScope) => {
|
785
|
+
for (let scope of ownerScope[loopScopeAccessor] || ownerScope[loopScopeMapAccessor]?.values() || [])
|
786
|
+
scope.g || queueSource(scope, childSignal);
|
787
|
+
};
|
788
|
+
return ownerSignal._ = childSignal, ownerSignal;
|
789
|
+
}
|
790
|
+
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
791
|
+
let childSignal = closure(valueAccessor, fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
|
792
|
+
let ifScope = scope[scopeAccessor];
|
793
|
+
ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, childSignal);
|
794
|
+
};
|
795
|
+
return ownerSignal._ = childSignal, ownerSignal;
|
796
|
+
}
|
797
|
+
function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
798
|
+
let subscribersAccessor = "?" /* Dynamic */ + accessorId++, childSignal = closure(
|
799
|
+
valueAccessor,
|
800
|
+
fn,
|
801
|
+
getIntersection,
|
802
|
+
getOwnerScope
|
803
|
+
), ownerSignal = (ownerScope) => {
|
804
|
+
let subscribers = ownerScope[subscribersAccessor];
|
805
|
+
if (subscribers)
|
806
|
+
for (let subscriber of subscribers)
|
807
|
+
subscriber.g || queueSource(subscriber, childSignal);
|
808
|
+
}, subscribe = (scope) => {
|
809
|
+
let owner = getOwnerScope ? getOwnerScope(scope) : scope._, subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
|
810
|
+
subscribers.has(scope) || (subscribers.add(scope), getAbortSignal(scope, -1).addEventListener(
|
811
|
+
"abort",
|
812
|
+
() => subscribers.delete(scope)
|
813
|
+
));
|
814
|
+
};
|
815
|
+
return ownerSignal.H = subscribe, ownerSignal._ = (scope) => {
|
816
|
+
childSignal(scope), subscribe(scope);
|
817
|
+
}, ownerSignal;
|
818
|
+
}
|
819
|
+
function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
|
820
|
+
let signal = dynamicClosure(
|
821
|
+
valueAccessor,
|
822
|
+
fn,
|
823
|
+
getIntersection,
|
824
|
+
getOwnerScope
|
825
|
+
);
|
826
|
+
return register(id, signal.H), signal;
|
827
|
+
}
|
828
|
+
function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
829
|
+
let intersection2;
|
830
|
+
return (scope, op) => {
|
831
|
+
op || fn && fn(
|
832
|
+
scope,
|
833
|
+
(getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
|
834
|
+
), getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
|
835
|
+
};
|
836
|
+
}
|
837
|
+
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
838
|
+
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
839
|
+
}
|
840
|
+
var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
|
841
|
+
function setTagVarChange(scope, changeHandler) {
|
842
|
+
scope["@" /* TagVariableChange */] = changeHandler;
|
843
|
+
}
|
844
|
+
var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
|
845
|
+
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
846
|
+
function nextTagId({ $global }) {
|
847
|
+
let id = tagIdsByGlobal.get($global) || 0;
|
848
|
+
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
849
|
+
}
|
850
|
+
function inChild(childAccessor, signal) {
|
851
|
+
return (scope, valueOrOp) => {
|
852
|
+
signal(scope[childAccessor], valueOrOp);
|
853
|
+
};
|
854
|
+
}
|
855
|
+
function intersections(signals) {
|
856
|
+
return (scope, op) => {
|
857
|
+
for (let signal of signals)
|
858
|
+
signal(scope, op);
|
859
|
+
};
|
860
|
+
}
|
861
|
+
function effect(id, fn) {
|
862
|
+
return register(id, fn), (scope) => {
|
863
|
+
queueEffect(scope, fn);
|
864
|
+
};
|
865
|
+
}
|
866
|
+
|
867
|
+
// src/dom/queue.ts
|
868
|
+
var pendingRenders = [], pendingEffects = [], rendering = !1;
|
869
|
+
function queueSource(scope, signal, value2) {
|
870
|
+
let prevRendering = rendering;
|
871
|
+
rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2);
|
872
|
+
}
|
873
|
+
function queueRender(scope, signal, value2) {
|
874
|
+
let i = pendingRenders.length, render = {
|
875
|
+
s: scope,
|
876
|
+
I: signal,
|
877
|
+
J: value2,
|
878
|
+
t: scope.c?.f || 0,
|
879
|
+
u: i
|
880
|
+
};
|
881
|
+
for (pendingRenders.push(render); i; ) {
|
882
|
+
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
883
|
+
if (comparePendingRenders(render, parent) >= 0) break;
|
884
|
+
pendingRenders[i] = parent, i = parentIndex;
|
885
|
+
}
|
886
|
+
pendingRenders[i] = render;
|
887
|
+
}
|
888
|
+
function queueEffect(scope, fn) {
|
889
|
+
pendingEffects.push(scope, fn);
|
890
|
+
}
|
891
|
+
function run() {
|
892
|
+
let effects = pendingEffects;
|
893
|
+
try {
|
894
|
+
rendering = !0, runRenders();
|
895
|
+
} finally {
|
896
|
+
pendingRenders = [], pendingEffects = [], rendering = !1;
|
897
|
+
}
|
898
|
+
runEffects(effects);
|
899
|
+
}
|
900
|
+
function prepareEffects(fn) {
|
901
|
+
let prevRenders = pendingRenders, prevEffects = pendingEffects, preparedEffects = pendingEffects = [];
|
902
|
+
pendingRenders = [];
|
903
|
+
try {
|
904
|
+
rendering = !0, fn(), runRenders();
|
905
|
+
} finally {
|
906
|
+
rendering = !1, pendingRenders = prevRenders, pendingEffects = prevEffects;
|
907
|
+
}
|
908
|
+
return preparedEffects;
|
909
|
+
}
|
910
|
+
function runEffects(effects) {
|
911
|
+
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
912
|
+
let scope = effects[i], fn = effects[i + 1];
|
913
|
+
fn(scope, scope);
|
914
|
+
}
|
915
|
+
}
|
916
|
+
function runRenders() {
|
917
|
+
for (; pendingRenders.length; ) {
|
918
|
+
let render = pendingRenders[0], next = pendingRenders.pop();
|
919
|
+
if (render !== next) {
|
920
|
+
let i = 0, mid = pendingRenders.length >> 1, item = pendingRenders[0] = next;
|
921
|
+
for (; i < mid; ) {
|
922
|
+
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
923
|
+
if (right < pendingRenders.length && comparePendingRenders(
|
924
|
+
pendingRenders[right],
|
925
|
+
pendingRenders[bestChild]
|
926
|
+
) < 0 && (bestChild = right), comparePendingRenders(pendingRenders[bestChild], item) >= 0)
|
927
|
+
break;
|
928
|
+
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
929
|
+
}
|
930
|
+
pendingRenders[i] = item;
|
931
|
+
}
|
932
|
+
render.s.c?.F || render.I(render.s, render.J);
|
933
|
+
}
|
934
|
+
finishPendingScopes();
|
935
|
+
}
|
936
|
+
function comparePendingRenders(a, b) {
|
937
|
+
return a.t - b.t || a.u - b.u;
|
938
|
+
}
|
939
|
+
|
940
|
+
// src/dom/abort-signal.ts
|
941
|
+
function resetAbortSignal(scope, id) {
|
942
|
+
let ctrl = scope.h?.[id];
|
943
|
+
ctrl && (queueEffect(ctrl, abort), scope.h[id] = void 0);
|
944
|
+
}
|
945
|
+
function getAbortSignal(scope, id) {
|
946
|
+
return scope.c && (scope.c.G ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
|
947
|
+
}
|
948
|
+
function abort(ctrl) {
|
949
|
+
ctrl.abort();
|
950
|
+
}
|
951
|
+
|
952
|
+
// src/common/compat-meta.ts
|
953
|
+
var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID = prefix + "s", RENDER_BODY_ID = prefix + "b";
|
954
|
+
|
744
955
|
// src/dom/reconcile.ts
|
745
956
|
var WRONG_POS = 2147483647;
|
746
957
|
function reconcile(parent, oldBranches, newBranches, afterReference) {
|
@@ -796,9 +1007,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
796
1007
|
}
|
797
1008
|
}
|
798
1009
|
function longestIncreasingSubsequence(a) {
|
799
|
-
let p = a.slice(), result = [];
|
800
|
-
result.push(0);
|
801
|
-
let u, v;
|
1010
|
+
let p = a.slice(), result = [0], u, v;
|
802
1011
|
for (let i = 0, il = a.length; i < il; ++i) {
|
803
1012
|
if (a[i] === -1)
|
804
1013
|
continue;
|
@@ -826,47 +1035,46 @@ function trimWalkString(walkString) {
|
|
826
1035
|
return walkString.slice(0, end + 1);
|
827
1036
|
}
|
828
1037
|
function walk(startNode, walkCodes, branch) {
|
829
|
-
walker.currentNode = startNode, walkInternal(0, walkCodes, branch)
|
1038
|
+
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
830
1039
|
}
|
831
1040
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
832
1041
|
let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
833
|
-
for (;
|
834
|
-
if (currentMultiplier = storedMultiplier, storedMultiplier = 0, value2
|
835
|
-
|
836
|
-
else if (value2
|
837
|
-
|
838
|
-
walker.
|
839
|
-
walker.nextSibling();
|
840
|
-
} else if (value2 >= 97 /* Over */)
|
841
|
-
for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
|
842
|
-
walker.nextSibling();
|
843
|
-
else if (value2 >= 67 /* Next */)
|
844
|
-
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
845
|
-
walker.nextNode();
|
846
|
-
else if (value2 === 47 /* BeginChild */)
|
847
|
-
currentWalkIndex = walkInternal(
|
848
|
-
currentWalkIndex,
|
849
|
-
walkCodes,
|
850
|
-
scope[currentScopeIndex++] = createScope(scope.$global, scope.c)
|
1042
|
+
for (; currentWalkIndex < walkCodes.length; )
|
1043
|
+
if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */)
|
1044
|
+
scope[currentScopeIndex++] = walker.currentNode;
|
1045
|
+
else if (value2 === 37 /* Replace */)
|
1046
|
+
walker.currentNode.replaceWith(
|
1047
|
+
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
851
1048
|
);
|
852
1049
|
else {
|
853
1050
|
if (value2 === 38 /* EndChild */)
|
854
1051
|
return currentWalkIndex;
|
855
|
-
if (value2 ===
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
1052
|
+
if (value2 === 47 /* BeginChild */)
|
1053
|
+
currentWalkIndex = walkInternal(
|
1054
|
+
currentWalkIndex,
|
1055
|
+
walkCodes,
|
1056
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.c)
|
1057
|
+
);
|
1058
|
+
else if (value2 < 92)
|
1059
|
+
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
1060
|
+
walker.nextNode();
|
1061
|
+
else if (value2 < 107)
|
1062
|
+
for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
|
1063
|
+
walker.nextSibling();
|
1064
|
+
else if (value2 < 117) {
|
1065
|
+
for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
|
1066
|
+
walker.parentNode();
|
1067
|
+
walker.nextSibling();
|
1068
|
+
} else
|
1069
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
861
1070
|
}
|
862
|
-
return currentWalkIndex;
|
863
1071
|
}
|
864
1072
|
|
865
1073
|
// src/dom/renderer.ts
|
866
1074
|
function createBranchScopeWithRenderer(renderer, $global, parentScope, parentNode) {
|
867
1075
|
let branch = createBranch(
|
868
1076
|
$global,
|
869
|
-
renderer.
|
1077
|
+
renderer.x || parentScope,
|
870
1078
|
parentScope
|
871
1079
|
);
|
872
1080
|
return initBranch(renderer, branch, parentNode), branch;
|
@@ -891,7 +1099,7 @@ function createBranch($global, ownerScope, parentScope) {
|
|
891
1099
|
}
|
892
1100
|
function initBranch(renderer, branch, parentNode) {
|
893
1101
|
let clone = renderer.k(parentNode.namespaceURI), cloneParent = clone.parentNode;
|
894
|
-
cloneParent ? (walk(cloneParent.firstChild, renderer.
|
1102
|
+
cloneParent ? (walk(cloneParent.firstChild, renderer.y, branch), branch.a = cloneParent.firstChild, branch.b = cloneParent.lastChild) : (walk(clone, renderer.y, branch), branch.a = branch.b = clone), renderer.z && queueRender(branch, renderer.z);
|
895
1103
|
}
|
896
1104
|
function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
897
1105
|
return (scope, attrsOrOp) => {
|
@@ -903,7 +1111,7 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
903
1111
|
return renderer.d?.(childScope, attrsOrOp);
|
904
1112
|
let content = getContent?.(scope);
|
905
1113
|
if (typeof renderer == "string")
|
906
|
-
|
1114
|
+
setConditionalRenderer(
|
907
1115
|
childScope,
|
908
1116
|
0,
|
909
1117
|
content,
|
@@ -926,12 +1134,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
926
1134
|
function createRendererWithOwner(template, rawWalks, setup, getArgs) {
|
927
1135
|
let args, id = {}, walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
|
928
1136
|
return (owner) => ({
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
1137
|
+
A: id,
|
1138
|
+
B: template,
|
1139
|
+
y: walks,
|
1140
|
+
z: setup,
|
933
1141
|
k: _clone,
|
934
|
-
|
1142
|
+
x: owner,
|
935
1143
|
get d() {
|
936
1144
|
return args ||= getArgs?.();
|
937
1145
|
}
|
@@ -941,8 +1149,8 @@ function createRenderer(template, walks, setup, getArgs) {
|
|
941
1149
|
return createRendererWithOwner(template, walks, setup, getArgs)();
|
942
1150
|
}
|
943
1151
|
function _clone(ns) {
|
944
|
-
return ((cloneCache[ns] ||= {})[this.
|
945
|
-
this.
|
1152
|
+
return ((cloneCache[ns] ||= {})[this.B] ||= createCloneableHTML(
|
1153
|
+
this.B,
|
946
1154
|
ns
|
947
1155
|
))();
|
948
1156
|
}
|
@@ -956,7 +1164,7 @@ function createCloneableHTML(html2, ns) {
|
|
956
1164
|
function conditional(nodeAccessor, ...branches) {
|
957
1165
|
let branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
958
1166
|
return (scope, newBranchIndexOrOp) => {
|
959
|
-
newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN &&
|
1167
|
+
newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN && setConditionalRenderer(
|
960
1168
|
scope,
|
961
1169
|
nodeAccessor,
|
962
1170
|
branches[scope[branchAccessor] = newBranchIndexOrOp],
|
@@ -972,40 +1180,21 @@ var dynamicTag = function(nodeAccessor, fn, getIntersection) {
|
|
972
1180
|
return (scope, newRendererOrOp) => {
|
973
1181
|
if (newRendererOrOp === DIRTY) return;
|
974
1182
|
let currentRenderer = scope[rendererAccessor], op = newRendererOrOp;
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
intersection2?.(scope, op);
|
1183
|
+
newRendererOrOp !== MARK && newRendererOrOp !== CLEAN && (isDifferentRenderer(
|
1184
|
+
currentRenderer,
|
1185
|
+
scope[rendererAccessor] = normalizeDynamicRenderer(newRendererOrOp)
|
1186
|
+
) ? (setConditionalRenderer(
|
1187
|
+
scope,
|
1188
|
+
nodeAccessor,
|
1189
|
+
scope[rendererAccessor],
|
1190
|
+
createBranchScopeWithTagNameOrRenderer
|
1191
|
+
), fn && fn(scope), op = DIRTY) : op = CLEAN), intersection2?.(scope, op);
|
985
1192
|
};
|
986
1193
|
};
|
987
1194
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
988
|
-
let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] ||
|
989
|
-
|
990
|
-
|
991
|
-
scope,
|
992
|
-
prevBranch.b.parentNode
|
993
|
-
) : getEmptyBranch(scope[nodeAccessor]);
|
994
|
-
prevBranch !== newBranch && (insertBranchBefore(
|
995
|
-
newBranch,
|
996
|
-
prevBranch.b.parentNode,
|
997
|
-
prevBranch.b.nextSibling
|
998
|
-
), removeAndDestroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch);
|
999
|
-
}
|
1000
|
-
function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
|
1001
|
-
let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], referenceNode = scope[nodeAccessor], newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
|
1002
|
-
referenceNode.textContent = "", newBranch && insertBranchBefore(newBranch, referenceNode, null), prevBranch && destroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newBranch;
|
1003
|
-
}
|
1004
|
-
var emptyMarkerMap = /* @__PURE__ */ new Map([
|
1005
|
-
[Symbol(), /* @__PURE__ */ getEmptyBranch(0)]
|
1006
|
-
]), emptyMarkerArray = [
|
1007
|
-
/* @__PURE__ */ getEmptyBranch(0)
|
1008
|
-
], emptyMap = /* @__PURE__ */ new Map(), emptyArray = [];
|
1195
|
+
let referenceNode = scope[nodeAccessor], prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.a || referenceNode).parentNode : referenceNode, newBranch = scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && createBranch2(newRenderer, scope.$global, scope, parentNode);
|
1196
|
+
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.a) : parentNode.insertBefore(referenceNode, prevBranch.a), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
1197
|
+
}
|
1009
1198
|
function loopOf(nodeAccessor, renderer) {
|
1010
1199
|
return loop(
|
1011
1200
|
nodeAccessor,
|
@@ -1035,24 +1224,27 @@ function loopTo(nodeAccessor, renderer) {
|
|
1035
1224
|
function loop(nodeAccessor, renderer, forEach) {
|
1036
1225
|
let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, params = renderer.d;
|
1037
1226
|
return (scope, valueOrOp) => {
|
1038
|
-
if (valueOrOp
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1227
|
+
if (valueOrOp !== DIRTY)
|
1228
|
+
if (valueOrOp === MARK || valueOrOp === CLEAN) {
|
1229
|
+
if (params)
|
1230
|
+
for (let branch of scope[loopScopeAccessor] || scope[nodeAccessor + "(" /* LoopScopeMap */]?.values() || [])
|
1231
|
+
params(branch, valueOrOp);
|
1232
|
+
} else {
|
1233
|
+
let referenceNode = scope[nodeAccessor], oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */], oldArray = oldMap ? scope[nodeAccessor + "!" /* LoopScopeArray */] || [
|
1234
|
+
...oldMap.values()
|
1235
|
+
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].a.parentNode : referenceNode, newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map(), newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
|
1236
|
+
forEach(valueOrOp, (key, args) => {
|
1237
|
+
let branch = oldMap?.get(key) || createBranchScopeWithRenderer(
|
1238
|
+
renderer,
|
1239
|
+
scope.$global,
|
1240
|
+
scope,
|
1241
|
+
parentNode
|
1242
|
+
);
|
1243
|
+
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1244
|
+
});
|
1245
|
+
let afterReference = null;
|
1246
|
+
referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].b.nextSibling, newArray.length || parentNode.insertBefore(referenceNode, afterReference)) : newArray.length && (afterReference = referenceNode.nextSibling, referenceNode.remove())), reconcile(parentNode, oldArray, newArray, afterReference);
|
1247
|
+
}
|
1056
1248
|
};
|
1057
1249
|
}
|
1058
1250
|
function bySecondArg(_item, index) {
|
@@ -1062,226 +1254,8 @@ function byFirstArg(name) {
|
|
1062
1254
|
return name;
|
1063
1255
|
}
|
1064
1256
|
function isDifferentRenderer(a, b) {
|
1065
|
-
return a !== b && (a?.
|
1066
|
-
}
|
1067
|
-
|
1068
|
-
// src/dom/schedule.ts
|
1069
|
-
var port2 = /* @__PURE__ */ (() => {
|
1070
|
-
let { port1, port2: port22 } = new MessageChannel();
|
1071
|
-
return port1.onmessage = () => {
|
1072
|
-
isScheduled = !1, run();
|
1073
|
-
}, port22;
|
1074
|
-
})(), isScheduled;
|
1075
|
-
function schedule() {
|
1076
|
-
isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
|
1077
|
-
}
|
1078
|
-
function flushAndWaitFrame() {
|
1079
|
-
run(), requestAnimationFrame(triggerMacroTask);
|
1080
|
-
}
|
1081
|
-
function triggerMacroTask() {
|
1082
|
-
port2.postMessage(0);
|
1083
|
-
}
|
1084
|
-
|
1085
|
-
// src/dom/signals.ts
|
1086
|
-
var MARK = {}, CLEAN = {}, DIRTY = {};
|
1087
|
-
function state(valueAccessor, fn, getIntersection) {
|
1088
|
-
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
1089
|
-
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
1090
|
-
scope,
|
1091
|
-
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
1092
|
-
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : (schedule(), queueSource(scope, valueSignal, valueOrOp)), valueOrOp);
|
1093
|
-
}
|
1094
|
-
function value(valueAccessor, fn, getIntersection) {
|
1095
|
-
let markAccessor = valueAccessor + "#" /* Mark */, intersection2;
|
1096
|
-
return (scope, valueOrOp) => {
|
1097
|
-
if (valueOrOp === MARK)
|
1098
|
-
(scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
1099
|
-
else if (valueOrOp !== DIRTY) {
|
1100
|
-
let existing = scope[markAccessor] !== void 0;
|
1101
|
-
(scope[markAccessor] ||= 1) === 1 && (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp ? getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : (scope[valueAccessor] = valueOrOp, fn && fn(scope, valueOrOp), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY))), scope[markAccessor]--;
|
1102
|
-
}
|
1103
|
-
};
|
1104
|
-
}
|
1105
|
-
var accessorId = 0;
|
1106
|
-
function intersection(count, fn, getIntersection) {
|
1107
|
-
let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2;
|
1108
|
-
return (scope, op) => {
|
1109
|
-
op === MARK ? (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK) : scope[markAccessor] === void 0 ? (scope[markAccessor] = count - 1, scope[dirtyAccessor] = !0) : --scope[markAccessor] === 0 ? op === DIRTY || scope[dirtyAccessor] ? (scope[dirtyAccessor] = !1, fn(scope), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY)) : getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : scope[dirtyAccessor] ||= op === DIRTY;
|
1110
|
-
};
|
1111
|
-
}
|
1112
|
-
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
|
1113
|
-
let childSignal = closure(valueAccessor, fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, ownerSignal = (ownerScope) => {
|
1114
|
-
let loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
|
1115
|
-
if (loopScopes !== emptyMarkerArray)
|
1116
|
-
for (let scope of loopScopes)
|
1117
|
-
scope.g || queueSource(scope, childSignal);
|
1118
|
-
};
|
1119
|
-
return ownerSignal._ = childSignal, ownerSignal;
|
1120
|
-
}
|
1121
|
-
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
1122
|
-
let childSignal = closure(valueAccessor, fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
|
1123
|
-
let ifScope = scope[scopeAccessor];
|
1124
|
-
ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, childSignal);
|
1125
|
-
};
|
1126
|
-
return ownerSignal._ = childSignal, ownerSignal;
|
1127
|
-
}
|
1128
|
-
function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1129
|
-
let subscribersAccessor = "?" /* Dynamic */ + accessorId++, childSignal = closure(
|
1130
|
-
valueAccessor,
|
1131
|
-
fn,
|
1132
|
-
getIntersection,
|
1133
|
-
getOwnerScope
|
1134
|
-
), ownerSignal = (ownerScope) => {
|
1135
|
-
let subscribers = ownerScope[subscribersAccessor];
|
1136
|
-
if (subscribers)
|
1137
|
-
for (let subscriber of subscribers)
|
1138
|
-
subscriber.g || queueSource(subscriber, childSignal);
|
1139
|
-
}, subscribe = (scope) => {
|
1140
|
-
let owner = getOwnerScope ? getOwnerScope(scope) : scope._, subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
|
1141
|
-
subscribers.has(scope) || (subscribers.add(scope), getAbortSignal(scope, -1).addEventListener(
|
1142
|
-
"abort",
|
1143
|
-
() => owner[subscribersAccessor].delete(scope)
|
1144
|
-
));
|
1145
|
-
};
|
1146
|
-
return ownerSignal.H = subscribe, ownerSignal._ = (scope) => {
|
1147
|
-
childSignal(scope), subscribe(scope);
|
1148
|
-
}, ownerSignal;
|
1149
|
-
}
|
1150
|
-
function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
|
1151
|
-
let signal = dynamicClosure(
|
1152
|
-
valueAccessor,
|
1153
|
-
fn,
|
1154
|
-
getIntersection,
|
1155
|
-
getOwnerScope
|
1156
|
-
);
|
1157
|
-
return register(id, signal.H), signal;
|
1158
|
-
}
|
1159
|
-
function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1160
|
-
let intersection2;
|
1161
|
-
return (scope, op) => {
|
1162
|
-
op || fn && fn(
|
1163
|
-
scope,
|
1164
|
-
(getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
|
1165
|
-
), getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
|
1166
|
-
};
|
1167
|
-
}
|
1168
|
-
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1169
|
-
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
1257
|
+
return a !== b && (a?.A || 0) !== b?.A;
|
1170
1258
|
}
|
1171
|
-
var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
|
1172
|
-
function setTagVarChange(scope, changeHandler) {
|
1173
|
-
scope["@" /* TagVariableChange */] = changeHandler;
|
1174
|
-
}
|
1175
|
-
var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
|
1176
|
-
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1177
|
-
function nextTagId({ $global }) {
|
1178
|
-
let id = tagIdsByGlobal.get($global) || 0;
|
1179
|
-
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
1180
|
-
}
|
1181
|
-
function inChild(childAccessor, signal) {
|
1182
|
-
return (scope, valueOrOp) => {
|
1183
|
-
signal(scope[childAccessor], valueOrOp);
|
1184
|
-
};
|
1185
|
-
}
|
1186
|
-
function intersections(signals) {
|
1187
|
-
return (scope, op) => {
|
1188
|
-
for (let signal of signals)
|
1189
|
-
signal(scope, op);
|
1190
|
-
};
|
1191
|
-
}
|
1192
|
-
function effect(id, fn) {
|
1193
|
-
return register(id, fn), (scope) => {
|
1194
|
-
queueEffect(scope, fn);
|
1195
|
-
};
|
1196
|
-
}
|
1197
|
-
|
1198
|
-
// src/dom/queue.ts
|
1199
|
-
var pendingRenders = [], pendingEffects = [], rendering = !1;
|
1200
|
-
function queueSource(scope, signal, value2) {
|
1201
|
-
let prevRendering = rendering;
|
1202
|
-
rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2);
|
1203
|
-
}
|
1204
|
-
function queueRender(scope, signal, value2) {
|
1205
|
-
let i = pendingRenders.length, render = {
|
1206
|
-
z: scope,
|
1207
|
-
I: signal,
|
1208
|
-
J: value2,
|
1209
|
-
A: scope.c?.f || 0,
|
1210
|
-
B: i
|
1211
|
-
};
|
1212
|
-
for (pendingRenders.push(render); i; ) {
|
1213
|
-
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1214
|
-
if (comparePendingRenders(render, parent) >= 0) break;
|
1215
|
-
pendingRenders[i] = parent, i = parentIndex;
|
1216
|
-
}
|
1217
|
-
pendingRenders[i] = render;
|
1218
|
-
}
|
1219
|
-
function queueEffect(scope, fn) {
|
1220
|
-
pendingEffects.push(scope, fn);
|
1221
|
-
}
|
1222
|
-
function run() {
|
1223
|
-
let effects = pendingEffects;
|
1224
|
-
try {
|
1225
|
-
rendering = !0, runRenders();
|
1226
|
-
} finally {
|
1227
|
-
pendingRenders = [], pendingEffects = [], rendering = !1;
|
1228
|
-
}
|
1229
|
-
runEffects(effects);
|
1230
|
-
}
|
1231
|
-
function prepareEffects(fn) {
|
1232
|
-
let prevRenders = pendingRenders, prevEffects = pendingEffects, preparedEffects = pendingEffects = [];
|
1233
|
-
pendingRenders = [];
|
1234
|
-
try {
|
1235
|
-
rendering = !0, fn(), runRenders();
|
1236
|
-
} finally {
|
1237
|
-
rendering = !1, pendingRenders = prevRenders, pendingEffects = prevEffects;
|
1238
|
-
}
|
1239
|
-
return preparedEffects;
|
1240
|
-
}
|
1241
|
-
function runEffects(effects) {
|
1242
|
-
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
1243
|
-
let scope = effects[i], fn = effects[i + 1];
|
1244
|
-
fn(scope, scope);
|
1245
|
-
}
|
1246
|
-
}
|
1247
|
-
function runRenders() {
|
1248
|
-
for (; pendingRenders.length; ) {
|
1249
|
-
let render = pendingRenders[0], next = pendingRenders.pop();
|
1250
|
-
if (render !== next) {
|
1251
|
-
let i = 0, mid = pendingRenders.length >> 1, item = pendingRenders[0] = next;
|
1252
|
-
for (; i < mid; ) {
|
1253
|
-
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1254
|
-
if (right < pendingRenders.length && comparePendingRenders(
|
1255
|
-
pendingRenders[right],
|
1256
|
-
pendingRenders[bestChild]
|
1257
|
-
) < 0 && (bestChild = right), comparePendingRenders(pendingRenders[bestChild], item) >= 0)
|
1258
|
-
break;
|
1259
|
-
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1260
|
-
}
|
1261
|
-
pendingRenders[i] = item;
|
1262
|
-
}
|
1263
|
-
render.z.c?.F || render.I(render.z, render.J);
|
1264
|
-
}
|
1265
|
-
finishPendingScopes();
|
1266
|
-
}
|
1267
|
-
function comparePendingRenders(a, b) {
|
1268
|
-
return a.A - b.A || a.B - b.B;
|
1269
|
-
}
|
1270
|
-
|
1271
|
-
// src/dom/abort-signal.ts
|
1272
|
-
function resetAbortSignal(scope, id) {
|
1273
|
-
let ctrl = scope.h?.[id];
|
1274
|
-
ctrl && (queueEffect(ctrl, abort), scope.h[id] = void 0);
|
1275
|
-
}
|
1276
|
-
function getAbortSignal(scope, id) {
|
1277
|
-
return scope.c && (scope.c.G ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
|
1278
|
-
}
|
1279
|
-
function abort(ctrl) {
|
1280
|
-
ctrl.abort();
|
1281
|
-
}
|
1282
|
-
|
1283
|
-
// src/common/compat-meta.ts
|
1284
|
-
var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID = prefix + "s", RENDER_BODY_ID = prefix + "b";
|
1285
1259
|
|
1286
1260
|
// src/dom/compat.ts
|
1287
1261
|
var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
@@ -1336,7 +1310,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1336
1310
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1337
1311
|
}
|
1338
1312
|
if (component.effects = prepareEffects(() => {
|
1339
|
-
branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.
|
1313
|
+
branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.x, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
|
1340
1314
|
}), !existing)
|
1341
1315
|
return toInsertNode(branch.a, branch.b);
|
1342
1316
|
}
|