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.mjs
CHANGED
@@ -75,26 +75,20 @@ function normalizeDynamicRenderer(value2) {
|
|
75
75
|
}
|
76
76
|
|
77
77
|
// src/dom/event.ts
|
78
|
-
var
|
78
|
+
var defaultDelegator = createDelegator();
|
79
79
|
function on(element, type, handler) {
|
80
|
-
|
81
|
-
handlersByElement || elementHandlersByEvent.set(type, handlersByElement = /* @__PURE__ */ new WeakMap()), handlersByElement.has(element) || defaultDelegator(element, type, handleDelegated), handlersByElement.set(element, handler || null);
|
80
|
+
element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
|
82
81
|
}
|
83
82
|
function createDelegator() {
|
84
83
|
let kEvents = Symbol();
|
85
84
|
return function(node, type, handler) {
|
86
|
-
|
87
|
-
(root[kEvents] ||= {})[type] ||= (root.addEventListener(type, handler, !0), 1);
|
85
|
+
((node = node.getRootNode())[kEvents] ||= {})[type] ||= (node.addEventListener(type, handler, !0), 1);
|
88
86
|
};
|
89
87
|
}
|
90
88
|
function handleDelegated(ev) {
|
91
89
|
let target = !rendering && ev.target;
|
92
|
-
|
93
|
-
|
94
|
-
if (handlersByElement.get(target)?.(ev, target), ev.bubbles)
|
95
|
-
for (; (target = target.parentNode) && !ev.cancelBubble; )
|
96
|
-
handlersByElement.get(target)?.(ev, target);
|
97
|
-
}
|
90
|
+
for (; target; )
|
91
|
+
target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
98
92
|
}
|
99
93
|
|
100
94
|
// src/dom/resolve-cursor-position.ts
|
@@ -274,9 +268,16 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
274
268
|
let checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
275
269
|
if (checkedValueChange) {
|
276
270
|
let oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
277
|
-
scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */, checkedValueChange(
|
271
|
+
if (scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */, checkedValueChange(
|
278
272
|
Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0
|
279
|
-
), run(), scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */
|
273
|
+
), run(), scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */)
|
274
|
+
if (el.name && el.type[0] === "r")
|
275
|
+
for (let radio of el.getRootNode().querySelectorAll(
|
276
|
+
`[type=radio][name=${CSS.escape(el.name)}]`
|
277
|
+
))
|
278
|
+
radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
|
279
|
+
else
|
280
|
+
el.checked = !el.checked;
|
280
281
|
}
|
281
282
|
});
|
282
283
|
}
|
@@ -315,7 +316,7 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
315
316
|
valueChange
|
316
317
|
));
|
317
318
|
};
|
318
|
-
|
319
|
+
el._ || new MutationObserver(() => {
|
319
320
|
let value2 = scope[nodeAccessor + ":" /* ControlledValue */];
|
320
321
|
(Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) && onChange();
|
321
322
|
}).observe(el, {
|
@@ -373,19 +374,17 @@ function setValueAndUpdateSelection(el, value2) {
|
|
373
374
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
374
375
|
scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange, checkedChange ? (scope[nodeAccessor + "=" /* ControlledType */] = type, scope[nodeAccessor].checked = checked) : (scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
|
375
376
|
}
|
376
|
-
var controllableDelegate = createDelegator()
|
377
|
+
var controllableDelegate = createDelegator();
|
377
378
|
function syncControllable(el, event, hasChanged, onChange) {
|
378
|
-
|
379
|
+
el._ || (controllableDelegate(el, event, handleChange), el.form && controllableDelegate(el.form, "reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange)), el._ = onChange;
|
379
380
|
}
|
380
381
|
function handleChange(ev) {
|
381
|
-
|
382
|
+
ev.target._?.(ev);
|
382
383
|
}
|
383
384
|
function handleFormReset(ev) {
|
384
385
|
let handlers = [];
|
385
|
-
for (let el of ev.target.elements)
|
386
|
-
|
387
|
-
handler && hasFormElementChanged(el) && handlers.push(handler);
|
388
|
-
}
|
386
|
+
for (let el of ev.target.elements)
|
387
|
+
el._ && hasFormElementChanged(el) && handlers.push(el._);
|
389
388
|
requestAnimationFrame(() => {
|
390
389
|
if (!ev.defaultPrevented)
|
391
390
|
for (let change of handlers)
|
@@ -633,10 +632,6 @@ function finishPendingScopes() {
|
|
633
632
|
scope.g = 0;
|
634
633
|
pendingScopes = [];
|
635
634
|
}
|
636
|
-
var emptyBranch = createScope({});
|
637
|
-
function getEmptyBranch(marker) {
|
638
|
-
return emptyBranch.a = emptyBranch.b = marker, emptyBranch;
|
639
|
-
}
|
640
635
|
function destroyBranch(branch) {
|
641
636
|
branch.q?.j?.delete(branch), destroyNestedBranches(branch);
|
642
637
|
}
|
@@ -658,6 +653,222 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
658
653
|
);
|
659
654
|
}
|
660
655
|
|
656
|
+
// src/dom/schedule.ts
|
657
|
+
var port2 = /* @__PURE__ */ (() => {
|
658
|
+
let { port1, port2: port22 } = new MessageChannel();
|
659
|
+
return port1.onmessage = () => {
|
660
|
+
isScheduled = !1, run();
|
661
|
+
}, port22;
|
662
|
+
})(), isScheduled;
|
663
|
+
function schedule() {
|
664
|
+
isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
|
665
|
+
}
|
666
|
+
function flushAndWaitFrame() {
|
667
|
+
run(), requestAnimationFrame(triggerMacroTask);
|
668
|
+
}
|
669
|
+
function triggerMacroTask() {
|
670
|
+
port2.postMessage(0);
|
671
|
+
}
|
672
|
+
|
673
|
+
// src/dom/signals.ts
|
674
|
+
var MARK = {}, CLEAN = {}, DIRTY = {};
|
675
|
+
function state(valueAccessor, fn, getIntersection) {
|
676
|
+
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
677
|
+
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
678
|
+
scope,
|
679
|
+
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
680
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : (schedule(), queueSource(scope, valueSignal, valueOrOp)), valueOrOp);
|
681
|
+
}
|
682
|
+
function value(valueAccessor, fn, getIntersection) {
|
683
|
+
let markAccessor = valueAccessor + "#" /* Mark */, intersection2;
|
684
|
+
return (scope, valueOrOp) => {
|
685
|
+
if (valueOrOp === MARK)
|
686
|
+
(scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
687
|
+
else if (valueOrOp !== DIRTY) {
|
688
|
+
let existing = scope[markAccessor] !== void 0;
|
689
|
+
(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]--;
|
690
|
+
}
|
691
|
+
};
|
692
|
+
}
|
693
|
+
var accessorId = 0;
|
694
|
+
function intersection(count, fn, getIntersection) {
|
695
|
+
let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2;
|
696
|
+
return (scope, op) => {
|
697
|
+
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;
|
698
|
+
};
|
699
|
+
}
|
700
|
+
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
|
701
|
+
let childSignal = closure(valueAccessor, fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, ownerSignal = (ownerScope) => {
|
702
|
+
for (let scope of ownerScope[loopScopeAccessor] || ownerScope[loopScopeMapAccessor]?.values() || [])
|
703
|
+
scope.g || queueSource(scope, childSignal);
|
704
|
+
};
|
705
|
+
return ownerSignal._ = childSignal, ownerSignal;
|
706
|
+
}
|
707
|
+
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
708
|
+
let childSignal = closure(valueAccessor, fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
|
709
|
+
let ifScope = scope[scopeAccessor];
|
710
|
+
ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, childSignal);
|
711
|
+
};
|
712
|
+
return ownerSignal._ = childSignal, ownerSignal;
|
713
|
+
}
|
714
|
+
function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
715
|
+
let subscribersAccessor = "?" /* Dynamic */ + accessorId++, childSignal = closure(
|
716
|
+
valueAccessor,
|
717
|
+
fn,
|
718
|
+
getIntersection,
|
719
|
+
getOwnerScope
|
720
|
+
), ownerSignal = (ownerScope) => {
|
721
|
+
let subscribers = ownerScope[subscribersAccessor];
|
722
|
+
if (subscribers)
|
723
|
+
for (let subscriber of subscribers)
|
724
|
+
subscriber.g || queueSource(subscriber, childSignal);
|
725
|
+
}, subscribe = (scope) => {
|
726
|
+
let owner = getOwnerScope ? getOwnerScope(scope) : scope._, subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
|
727
|
+
subscribers.has(scope) || (subscribers.add(scope), getAbortSignal(scope, -1).addEventListener(
|
728
|
+
"abort",
|
729
|
+
() => subscribers.delete(scope)
|
730
|
+
));
|
731
|
+
};
|
732
|
+
return ownerSignal.H = subscribe, ownerSignal._ = (scope) => {
|
733
|
+
childSignal(scope), subscribe(scope);
|
734
|
+
}, ownerSignal;
|
735
|
+
}
|
736
|
+
function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
|
737
|
+
let signal = dynamicClosure(
|
738
|
+
valueAccessor,
|
739
|
+
fn,
|
740
|
+
getIntersection,
|
741
|
+
getOwnerScope
|
742
|
+
);
|
743
|
+
return register(id, signal.H), signal;
|
744
|
+
}
|
745
|
+
function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
746
|
+
let intersection2;
|
747
|
+
return (scope, op) => {
|
748
|
+
op || fn && fn(
|
749
|
+
scope,
|
750
|
+
(getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
|
751
|
+
), getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
|
752
|
+
};
|
753
|
+
}
|
754
|
+
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
755
|
+
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
756
|
+
}
|
757
|
+
var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
|
758
|
+
function setTagVarChange(scope, changeHandler) {
|
759
|
+
scope["@" /* TagVariableChange */] = changeHandler;
|
760
|
+
}
|
761
|
+
var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
|
762
|
+
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
763
|
+
function nextTagId({ $global }) {
|
764
|
+
let id = tagIdsByGlobal.get($global) || 0;
|
765
|
+
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
766
|
+
}
|
767
|
+
function inChild(childAccessor, signal) {
|
768
|
+
return (scope, valueOrOp) => {
|
769
|
+
signal(scope[childAccessor], valueOrOp);
|
770
|
+
};
|
771
|
+
}
|
772
|
+
function intersections(signals) {
|
773
|
+
return (scope, op) => {
|
774
|
+
for (let signal of signals)
|
775
|
+
signal(scope, op);
|
776
|
+
};
|
777
|
+
}
|
778
|
+
function effect(id, fn) {
|
779
|
+
return register(id, fn), (scope) => {
|
780
|
+
queueEffect(scope, fn);
|
781
|
+
};
|
782
|
+
}
|
783
|
+
|
784
|
+
// src/dom/queue.ts
|
785
|
+
var pendingRenders = [], pendingEffects = [], rendering = !1;
|
786
|
+
function queueSource(scope, signal, value2) {
|
787
|
+
let prevRendering = rendering;
|
788
|
+
rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2);
|
789
|
+
}
|
790
|
+
function queueRender(scope, signal, value2) {
|
791
|
+
let i = pendingRenders.length, render = {
|
792
|
+
s: scope,
|
793
|
+
I: signal,
|
794
|
+
J: value2,
|
795
|
+
t: scope.c?.f || 0,
|
796
|
+
u: i
|
797
|
+
};
|
798
|
+
for (pendingRenders.push(render); i; ) {
|
799
|
+
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
800
|
+
if (comparePendingRenders(render, parent) >= 0) break;
|
801
|
+
pendingRenders[i] = parent, i = parentIndex;
|
802
|
+
}
|
803
|
+
pendingRenders[i] = render;
|
804
|
+
}
|
805
|
+
function queueEffect(scope, fn) {
|
806
|
+
pendingEffects.push(scope, fn);
|
807
|
+
}
|
808
|
+
function run() {
|
809
|
+
let effects = pendingEffects;
|
810
|
+
try {
|
811
|
+
rendering = !0, runRenders();
|
812
|
+
} finally {
|
813
|
+
pendingRenders = [], pendingEffects = [], rendering = !1;
|
814
|
+
}
|
815
|
+
runEffects(effects);
|
816
|
+
}
|
817
|
+
function prepareEffects(fn) {
|
818
|
+
let prevRenders = pendingRenders, prevEffects = pendingEffects, preparedEffects = pendingEffects = [];
|
819
|
+
pendingRenders = [];
|
820
|
+
try {
|
821
|
+
rendering = !0, fn(), runRenders();
|
822
|
+
} finally {
|
823
|
+
rendering = !1, pendingRenders = prevRenders, pendingEffects = prevEffects;
|
824
|
+
}
|
825
|
+
return preparedEffects;
|
826
|
+
}
|
827
|
+
function runEffects(effects) {
|
828
|
+
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
829
|
+
let scope = effects[i], fn = effects[i + 1];
|
830
|
+
fn(scope, scope);
|
831
|
+
}
|
832
|
+
}
|
833
|
+
function runRenders() {
|
834
|
+
for (; pendingRenders.length; ) {
|
835
|
+
let render = pendingRenders[0], next = pendingRenders.pop();
|
836
|
+
if (render !== next) {
|
837
|
+
let i = 0, mid = pendingRenders.length >> 1, item = pendingRenders[0] = next;
|
838
|
+
for (; i < mid; ) {
|
839
|
+
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
840
|
+
if (right < pendingRenders.length && comparePendingRenders(
|
841
|
+
pendingRenders[right],
|
842
|
+
pendingRenders[bestChild]
|
843
|
+
) < 0 && (bestChild = right), comparePendingRenders(pendingRenders[bestChild], item) >= 0)
|
844
|
+
break;
|
845
|
+
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
846
|
+
}
|
847
|
+
pendingRenders[i] = item;
|
848
|
+
}
|
849
|
+
render.s.c?.F || render.I(render.s, render.J);
|
850
|
+
}
|
851
|
+
finishPendingScopes();
|
852
|
+
}
|
853
|
+
function comparePendingRenders(a, b) {
|
854
|
+
return a.t - b.t || a.u - b.u;
|
855
|
+
}
|
856
|
+
|
857
|
+
// src/dom/abort-signal.ts
|
858
|
+
function resetAbortSignal(scope, id) {
|
859
|
+
let ctrl = scope.h?.[id];
|
860
|
+
ctrl && (queueEffect(ctrl, abort), scope.h[id] = void 0);
|
861
|
+
}
|
862
|
+
function getAbortSignal(scope, id) {
|
863
|
+
return scope.c && (scope.c.G ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
|
864
|
+
}
|
865
|
+
function abort(ctrl) {
|
866
|
+
ctrl.abort();
|
867
|
+
}
|
868
|
+
|
869
|
+
// src/common/compat-meta.ts
|
870
|
+
var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID = prefix + "s", RENDER_BODY_ID = prefix + "b";
|
871
|
+
|
661
872
|
// src/dom/reconcile.ts
|
662
873
|
var WRONG_POS = 2147483647;
|
663
874
|
function reconcile(parent, oldBranches, newBranches, afterReference) {
|
@@ -713,9 +924,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
713
924
|
}
|
714
925
|
}
|
715
926
|
function longestIncreasingSubsequence(a) {
|
716
|
-
let p = a.slice(), result = [];
|
717
|
-
result.push(0);
|
718
|
-
let u, v;
|
927
|
+
let p = a.slice(), result = [0], u, v;
|
719
928
|
for (let i = 0, il = a.length; i < il; ++i) {
|
720
929
|
if (a[i] === -1)
|
721
930
|
continue;
|
@@ -743,47 +952,46 @@ function trimWalkString(walkString) {
|
|
743
952
|
return walkString.slice(0, end + 1);
|
744
953
|
}
|
745
954
|
function walk(startNode, walkCodes, branch) {
|
746
|
-
walker.currentNode = startNode, walkInternal(0, walkCodes, branch)
|
955
|
+
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
747
956
|
}
|
748
957
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
749
958
|
let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
750
|
-
for (;
|
751
|
-
if (currentMultiplier = storedMultiplier, storedMultiplier = 0, value2
|
752
|
-
|
753
|
-
else if (value2
|
754
|
-
|
755
|
-
walker.
|
756
|
-
walker.nextSibling();
|
757
|
-
} else if (value2 >= 97 /* Over */)
|
758
|
-
for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
|
759
|
-
walker.nextSibling();
|
760
|
-
else if (value2 >= 67 /* Next */)
|
761
|
-
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
762
|
-
walker.nextNode();
|
763
|
-
else if (value2 === 47 /* BeginChild */)
|
764
|
-
currentWalkIndex = walkInternal(
|
765
|
-
currentWalkIndex,
|
766
|
-
walkCodes,
|
767
|
-
scope[currentScopeIndex++] = createScope(scope.$global, scope.c)
|
959
|
+
for (; currentWalkIndex < walkCodes.length; )
|
960
|
+
if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */)
|
961
|
+
scope[currentScopeIndex++] = walker.currentNode;
|
962
|
+
else if (value2 === 37 /* Replace */)
|
963
|
+
walker.currentNode.replaceWith(
|
964
|
+
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
768
965
|
);
|
769
966
|
else {
|
770
967
|
if (value2 === 38 /* EndChild */)
|
771
968
|
return currentWalkIndex;
|
772
|
-
if (value2 ===
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
969
|
+
if (value2 === 47 /* BeginChild */)
|
970
|
+
currentWalkIndex = walkInternal(
|
971
|
+
currentWalkIndex,
|
972
|
+
walkCodes,
|
973
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.c)
|
974
|
+
);
|
975
|
+
else if (value2 < 92)
|
976
|
+
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
977
|
+
walker.nextNode();
|
978
|
+
else if (value2 < 107)
|
979
|
+
for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
|
980
|
+
walker.nextSibling();
|
981
|
+
else if (value2 < 117) {
|
982
|
+
for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
|
983
|
+
walker.parentNode();
|
984
|
+
walker.nextSibling();
|
985
|
+
} else
|
986
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
778
987
|
}
|
779
|
-
return currentWalkIndex;
|
780
988
|
}
|
781
989
|
|
782
990
|
// src/dom/renderer.ts
|
783
991
|
function createBranchScopeWithRenderer(renderer, $global, parentScope, parentNode) {
|
784
992
|
let branch = createBranch(
|
785
993
|
$global,
|
786
|
-
renderer.
|
994
|
+
renderer.x || parentScope,
|
787
995
|
parentScope
|
788
996
|
);
|
789
997
|
return initBranch(renderer, branch, parentNode), branch;
|
@@ -808,7 +1016,7 @@ function createBranch($global, ownerScope, parentScope) {
|
|
808
1016
|
}
|
809
1017
|
function initBranch(renderer, branch, parentNode) {
|
810
1018
|
let clone = renderer.k(parentNode.namespaceURI), cloneParent = clone.parentNode;
|
811
|
-
cloneParent ? (walk(cloneParent.firstChild, renderer.
|
1019
|
+
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);
|
812
1020
|
}
|
813
1021
|
function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
814
1022
|
return (scope, attrsOrOp) => {
|
@@ -820,7 +1028,7 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
820
1028
|
return renderer.d?.(childScope, attrsOrOp);
|
821
1029
|
let content = getContent?.(scope);
|
822
1030
|
if (typeof renderer == "string")
|
823
|
-
|
1031
|
+
setConditionalRenderer(
|
824
1032
|
childScope,
|
825
1033
|
0,
|
826
1034
|
content,
|
@@ -843,12 +1051,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
843
1051
|
function createRendererWithOwner(template, rawWalks, setup, getArgs) {
|
844
1052
|
let args, id = {}, walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
|
845
1053
|
return (owner) => ({
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
1054
|
+
A: id,
|
1055
|
+
B: template,
|
1056
|
+
y: walks,
|
1057
|
+
z: setup,
|
850
1058
|
k: _clone,
|
851
|
-
|
1059
|
+
x: owner,
|
852
1060
|
get d() {
|
853
1061
|
return args ||= getArgs?.();
|
854
1062
|
}
|
@@ -858,8 +1066,8 @@ function createRenderer(template, walks, setup, getArgs) {
|
|
858
1066
|
return createRendererWithOwner(template, walks, setup, getArgs)();
|
859
1067
|
}
|
860
1068
|
function _clone(ns) {
|
861
|
-
return ((cloneCache[ns] ||= {})[this.
|
862
|
-
this.
|
1069
|
+
return ((cloneCache[ns] ||= {})[this.B] ||= createCloneableHTML(
|
1070
|
+
this.B,
|
863
1071
|
ns
|
864
1072
|
))();
|
865
1073
|
}
|
@@ -873,7 +1081,7 @@ function createCloneableHTML(html2, ns) {
|
|
873
1081
|
function conditional(nodeAccessor, ...branches) {
|
874
1082
|
let branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
875
1083
|
return (scope, newBranchIndexOrOp) => {
|
876
|
-
newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN &&
|
1084
|
+
newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN && setConditionalRenderer(
|
877
1085
|
scope,
|
878
1086
|
nodeAccessor,
|
879
1087
|
branches[scope[branchAccessor] = newBranchIndexOrOp],
|
@@ -889,40 +1097,21 @@ var dynamicTag = function(nodeAccessor, fn, getIntersection) {
|
|
889
1097
|
return (scope, newRendererOrOp) => {
|
890
1098
|
if (newRendererOrOp === DIRTY) return;
|
891
1099
|
let currentRenderer = scope[rendererAccessor], op = newRendererOrOp;
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
intersection2?.(scope, op);
|
1100
|
+
newRendererOrOp !== MARK && newRendererOrOp !== CLEAN && (isDifferentRenderer(
|
1101
|
+
currentRenderer,
|
1102
|
+
scope[rendererAccessor] = normalizeDynamicRenderer(newRendererOrOp)
|
1103
|
+
) ? (setConditionalRenderer(
|
1104
|
+
scope,
|
1105
|
+
nodeAccessor,
|
1106
|
+
scope[rendererAccessor],
|
1107
|
+
createBranchScopeWithTagNameOrRenderer
|
1108
|
+
), fn && fn(scope), op = DIRTY) : op = CLEAN), intersection2?.(scope, op);
|
902
1109
|
};
|
903
1110
|
};
|
904
1111
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
905
|
-
let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] ||
|
906
|
-
|
907
|
-
|
908
|
-
scope,
|
909
|
-
prevBranch.b.parentNode
|
910
|
-
) : getEmptyBranch(scope[nodeAccessor]);
|
911
|
-
prevBranch !== newBranch && (insertBranchBefore(
|
912
|
-
newBranch,
|
913
|
-
prevBranch.b.parentNode,
|
914
|
-
prevBranch.b.nextSibling
|
915
|
-
), removeAndDestroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch);
|
916
|
-
}
|
917
|
-
function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
|
918
|
-
let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], referenceNode = scope[nodeAccessor], newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
|
919
|
-
referenceNode.textContent = "", newBranch && insertBranchBefore(newBranch, referenceNode, null), prevBranch && destroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newBranch;
|
920
|
-
}
|
921
|
-
var emptyMarkerMap = /* @__PURE__ */ new Map([
|
922
|
-
[Symbol(), /* @__PURE__ */ getEmptyBranch(0)]
|
923
|
-
]), emptyMarkerArray = [
|
924
|
-
/* @__PURE__ */ getEmptyBranch(0)
|
925
|
-
], emptyMap = /* @__PURE__ */ new Map(), emptyArray = [];
|
1112
|
+
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);
|
1113
|
+
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());
|
1114
|
+
}
|
926
1115
|
function loopOf(nodeAccessor, renderer) {
|
927
1116
|
return loop(
|
928
1117
|
nodeAccessor,
|
@@ -952,24 +1141,27 @@ function loopTo(nodeAccessor, renderer) {
|
|
952
1141
|
function loop(nodeAccessor, renderer, forEach) {
|
953
1142
|
let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, params = renderer.d;
|
954
1143
|
return (scope, valueOrOp) => {
|
955
|
-
if (valueOrOp
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
1144
|
+
if (valueOrOp !== DIRTY)
|
1145
|
+
if (valueOrOp === MARK || valueOrOp === CLEAN) {
|
1146
|
+
if (params)
|
1147
|
+
for (let branch of scope[loopScopeAccessor] || scope[nodeAccessor + "(" /* LoopScopeMap */]?.values() || [])
|
1148
|
+
params(branch, valueOrOp);
|
1149
|
+
} else {
|
1150
|
+
let referenceNode = scope[nodeAccessor], oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */], oldArray = oldMap ? scope[nodeAccessor + "!" /* LoopScopeArray */] || [
|
1151
|
+
...oldMap.values()
|
1152
|
+
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].a.parentNode : referenceNode, newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map(), newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
|
1153
|
+
forEach(valueOrOp, (key, args) => {
|
1154
|
+
let branch = oldMap?.get(key) || createBranchScopeWithRenderer(
|
1155
|
+
renderer,
|
1156
|
+
scope.$global,
|
1157
|
+
scope,
|
1158
|
+
parentNode
|
1159
|
+
);
|
1160
|
+
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1161
|
+
});
|
1162
|
+
let afterReference = null;
|
1163
|
+
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);
|
1164
|
+
}
|
973
1165
|
};
|
974
1166
|
}
|
975
1167
|
function bySecondArg(_item, index) {
|
@@ -979,226 +1171,8 @@ function byFirstArg(name) {
|
|
979
1171
|
return name;
|
980
1172
|
}
|
981
1173
|
function isDifferentRenderer(a, b) {
|
982
|
-
return a !== b && (a?.
|
983
|
-
}
|
984
|
-
|
985
|
-
// src/dom/schedule.ts
|
986
|
-
var port2 = /* @__PURE__ */ (() => {
|
987
|
-
let { port1, port2: port22 } = new MessageChannel();
|
988
|
-
return port1.onmessage = () => {
|
989
|
-
isScheduled = !1, run();
|
990
|
-
}, port22;
|
991
|
-
})(), isScheduled;
|
992
|
-
function schedule() {
|
993
|
-
isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
|
994
|
-
}
|
995
|
-
function flushAndWaitFrame() {
|
996
|
-
run(), requestAnimationFrame(triggerMacroTask);
|
997
|
-
}
|
998
|
-
function triggerMacroTask() {
|
999
|
-
port2.postMessage(0);
|
1000
|
-
}
|
1001
|
-
|
1002
|
-
// src/dom/signals.ts
|
1003
|
-
var MARK = {}, CLEAN = {}, DIRTY = {};
|
1004
|
-
function state(valueAccessor, fn, getIntersection) {
|
1005
|
-
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
1006
|
-
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
1007
|
-
scope,
|
1008
|
-
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
1009
|
-
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : (schedule(), queueSource(scope, valueSignal, valueOrOp)), valueOrOp);
|
1010
|
-
}
|
1011
|
-
function value(valueAccessor, fn, getIntersection) {
|
1012
|
-
let markAccessor = valueAccessor + "#" /* Mark */, intersection2;
|
1013
|
-
return (scope, valueOrOp) => {
|
1014
|
-
if (valueOrOp === MARK)
|
1015
|
-
(scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
1016
|
-
else if (valueOrOp !== DIRTY) {
|
1017
|
-
let existing = scope[markAccessor] !== void 0;
|
1018
|
-
(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]--;
|
1019
|
-
}
|
1020
|
-
};
|
1021
|
-
}
|
1022
|
-
var accessorId = 0;
|
1023
|
-
function intersection(count, fn, getIntersection) {
|
1024
|
-
let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2;
|
1025
|
-
return (scope, op) => {
|
1026
|
-
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;
|
1027
|
-
};
|
1028
|
-
}
|
1029
|
-
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
|
1030
|
-
let childSignal = closure(valueAccessor, fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, ownerSignal = (ownerScope) => {
|
1031
|
-
let loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
|
1032
|
-
if (loopScopes !== emptyMarkerArray)
|
1033
|
-
for (let scope of loopScopes)
|
1034
|
-
scope.g || queueSource(scope, childSignal);
|
1035
|
-
};
|
1036
|
-
return ownerSignal._ = childSignal, ownerSignal;
|
1037
|
-
}
|
1038
|
-
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
1039
|
-
let childSignal = closure(valueAccessor, fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
|
1040
|
-
let ifScope = scope[scopeAccessor];
|
1041
|
-
ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, childSignal);
|
1042
|
-
};
|
1043
|
-
return ownerSignal._ = childSignal, ownerSignal;
|
1044
|
-
}
|
1045
|
-
function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1046
|
-
let subscribersAccessor = "?" /* Dynamic */ + accessorId++, childSignal = closure(
|
1047
|
-
valueAccessor,
|
1048
|
-
fn,
|
1049
|
-
getIntersection,
|
1050
|
-
getOwnerScope
|
1051
|
-
), ownerSignal = (ownerScope) => {
|
1052
|
-
let subscribers = ownerScope[subscribersAccessor];
|
1053
|
-
if (subscribers)
|
1054
|
-
for (let subscriber of subscribers)
|
1055
|
-
subscriber.g || queueSource(subscriber, childSignal);
|
1056
|
-
}, subscribe = (scope) => {
|
1057
|
-
let owner = getOwnerScope ? getOwnerScope(scope) : scope._, subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
|
1058
|
-
subscribers.has(scope) || (subscribers.add(scope), getAbortSignal(scope, -1).addEventListener(
|
1059
|
-
"abort",
|
1060
|
-
() => owner[subscribersAccessor].delete(scope)
|
1061
|
-
));
|
1062
|
-
};
|
1063
|
-
return ownerSignal.H = subscribe, ownerSignal._ = (scope) => {
|
1064
|
-
childSignal(scope), subscribe(scope);
|
1065
|
-
}, ownerSignal;
|
1066
|
-
}
|
1067
|
-
function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
|
1068
|
-
let signal = dynamicClosure(
|
1069
|
-
valueAccessor,
|
1070
|
-
fn,
|
1071
|
-
getIntersection,
|
1072
|
-
getOwnerScope
|
1073
|
-
);
|
1074
|
-
return register(id, signal.H), signal;
|
1075
|
-
}
|
1076
|
-
function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1077
|
-
let intersection2;
|
1078
|
-
return (scope, op) => {
|
1079
|
-
op || fn && fn(
|
1080
|
-
scope,
|
1081
|
-
(getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
|
1082
|
-
), getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
|
1083
|
-
};
|
1084
|
-
}
|
1085
|
-
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1086
|
-
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
1174
|
+
return a !== b && (a?.A || 0) !== b?.A;
|
1087
1175
|
}
|
1088
|
-
var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
|
1089
|
-
function setTagVarChange(scope, changeHandler) {
|
1090
|
-
scope["@" /* TagVariableChange */] = changeHandler;
|
1091
|
-
}
|
1092
|
-
var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
|
1093
|
-
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1094
|
-
function nextTagId({ $global }) {
|
1095
|
-
let id = tagIdsByGlobal.get($global) || 0;
|
1096
|
-
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
1097
|
-
}
|
1098
|
-
function inChild(childAccessor, signal) {
|
1099
|
-
return (scope, valueOrOp) => {
|
1100
|
-
signal(scope[childAccessor], valueOrOp);
|
1101
|
-
};
|
1102
|
-
}
|
1103
|
-
function intersections(signals) {
|
1104
|
-
return (scope, op) => {
|
1105
|
-
for (let signal of signals)
|
1106
|
-
signal(scope, op);
|
1107
|
-
};
|
1108
|
-
}
|
1109
|
-
function effect(id, fn) {
|
1110
|
-
return register(id, fn), (scope) => {
|
1111
|
-
queueEffect(scope, fn);
|
1112
|
-
};
|
1113
|
-
}
|
1114
|
-
|
1115
|
-
// src/dom/queue.ts
|
1116
|
-
var pendingRenders = [], pendingEffects = [], rendering = !1;
|
1117
|
-
function queueSource(scope, signal, value2) {
|
1118
|
-
let prevRendering = rendering;
|
1119
|
-
rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2);
|
1120
|
-
}
|
1121
|
-
function queueRender(scope, signal, value2) {
|
1122
|
-
let i = pendingRenders.length, render = {
|
1123
|
-
z: scope,
|
1124
|
-
I: signal,
|
1125
|
-
J: value2,
|
1126
|
-
A: scope.c?.f || 0,
|
1127
|
-
B: i
|
1128
|
-
};
|
1129
|
-
for (pendingRenders.push(render); i; ) {
|
1130
|
-
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1131
|
-
if (comparePendingRenders(render, parent) >= 0) break;
|
1132
|
-
pendingRenders[i] = parent, i = parentIndex;
|
1133
|
-
}
|
1134
|
-
pendingRenders[i] = render;
|
1135
|
-
}
|
1136
|
-
function queueEffect(scope, fn) {
|
1137
|
-
pendingEffects.push(scope, fn);
|
1138
|
-
}
|
1139
|
-
function run() {
|
1140
|
-
let effects = pendingEffects;
|
1141
|
-
try {
|
1142
|
-
rendering = !0, runRenders();
|
1143
|
-
} finally {
|
1144
|
-
pendingRenders = [], pendingEffects = [], rendering = !1;
|
1145
|
-
}
|
1146
|
-
runEffects(effects);
|
1147
|
-
}
|
1148
|
-
function prepareEffects(fn) {
|
1149
|
-
let prevRenders = pendingRenders, prevEffects = pendingEffects, preparedEffects = pendingEffects = [];
|
1150
|
-
pendingRenders = [];
|
1151
|
-
try {
|
1152
|
-
rendering = !0, fn(), runRenders();
|
1153
|
-
} finally {
|
1154
|
-
rendering = !1, pendingRenders = prevRenders, pendingEffects = prevEffects;
|
1155
|
-
}
|
1156
|
-
return preparedEffects;
|
1157
|
-
}
|
1158
|
-
function runEffects(effects) {
|
1159
|
-
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
1160
|
-
let scope = effects[i], fn = effects[i + 1];
|
1161
|
-
fn(scope, scope);
|
1162
|
-
}
|
1163
|
-
}
|
1164
|
-
function runRenders() {
|
1165
|
-
for (; pendingRenders.length; ) {
|
1166
|
-
let render = pendingRenders[0], next = pendingRenders.pop();
|
1167
|
-
if (render !== next) {
|
1168
|
-
let i = 0, mid = pendingRenders.length >> 1, item = pendingRenders[0] = next;
|
1169
|
-
for (; i < mid; ) {
|
1170
|
-
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1171
|
-
if (right < pendingRenders.length && comparePendingRenders(
|
1172
|
-
pendingRenders[right],
|
1173
|
-
pendingRenders[bestChild]
|
1174
|
-
) < 0 && (bestChild = right), comparePendingRenders(pendingRenders[bestChild], item) >= 0)
|
1175
|
-
break;
|
1176
|
-
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1177
|
-
}
|
1178
|
-
pendingRenders[i] = item;
|
1179
|
-
}
|
1180
|
-
render.z.c?.F || render.I(render.z, render.J);
|
1181
|
-
}
|
1182
|
-
finishPendingScopes();
|
1183
|
-
}
|
1184
|
-
function comparePendingRenders(a, b) {
|
1185
|
-
return a.A - b.A || a.B - b.B;
|
1186
|
-
}
|
1187
|
-
|
1188
|
-
// src/dom/abort-signal.ts
|
1189
|
-
function resetAbortSignal(scope, id) {
|
1190
|
-
let ctrl = scope.h?.[id];
|
1191
|
-
ctrl && (queueEffect(ctrl, abort), scope.h[id] = void 0);
|
1192
|
-
}
|
1193
|
-
function getAbortSignal(scope, id) {
|
1194
|
-
return scope.c && (scope.c.G ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
|
1195
|
-
}
|
1196
|
-
function abort(ctrl) {
|
1197
|
-
ctrl.abort();
|
1198
|
-
}
|
1199
|
-
|
1200
|
-
// src/common/compat-meta.ts
|
1201
|
-
var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID = prefix + "s", RENDER_BODY_ID = prefix + "b";
|
1202
1176
|
|
1203
1177
|
// src/dom/compat.ts
|
1204
1178
|
var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
@@ -1253,7 +1227,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1253
1227
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1254
1228
|
}
|
1255
1229
|
if (component.effects = prepareEffects(() => {
|
1256
|
-
branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.
|
1230
|
+
branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.x, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
|
1257
1231
|
}), !existing)
|
1258
1232
|
return toInsertNode(branch.a, branch.b);
|
1259
1233
|
}
|