marko 6.0.0-next.3.61 → 6.0.0-next.3.63
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/accessor.d.ts +8 -7
- package/dist/common/accessor.debug.d.ts +7 -6
- package/dist/debug/dom.js +20 -20
- package/dist/debug/dom.mjs +20 -20
- package/dist/debug/html.js +83 -38
- package/dist/debug/html.mjs +83 -38
- package/dist/dom.js +137 -137
- package/dist/dom.mjs +137 -137
- package/dist/html.js +38 -23
- package/dist/html.mjs +38 -23
- package/dist/translator/index.js +14 -12
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -141,9 +141,9 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
141
141
|
endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
142
142
|
new Text(),
|
143
143
|
reference
|
144
|
-
)), branch.
|
144
|
+
)), branch.h = lastEndNode = endNode, branch.g ||= endNode;
|
145
145
|
for (let [markerScopeId, markerNode] of closestBranchMarkers)
|
146
|
-
branch.
|
146
|
+
branch.g.compareDocumentPosition(markerNode) & 4 && reference.compareDocumentPosition(markerNode) & 2 && (parentBranchIds.set(markerScopeId, branchId), closestBranchMarkers.delete(markerScopeId));
|
147
147
|
return branchIds.add(branchId), closestBranchMarkers.set(branchId, visit), branch;
|
148
148
|
};
|
149
149
|
for (let visit of visits) {
|
@@ -151,7 +151,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
151
151
|
commentPrefixLen + 1,
|
152
152
|
dataIndex ? dataIndex - 1 : commentText.length
|
153
153
|
), scope = scopeLookup[scopeId] ||= {
|
154
|
-
|
154
|
+
l: +scopeId
|
155
155
|
}, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
156
156
|
if (token === "*" /* Node */) {
|
157
157
|
let node = scope[data2] = visit.previousSibling;
|
@@ -159,14 +159,14 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
159
159
|
} else if (token === "$" /* ClosestBranch */)
|
160
160
|
closestBranchMarkers.set(scopeId, visit);
|
161
161
|
else if (token === "[" /* BranchStart */)
|
162
|
-
currentScopeId && (dataIndex && branchEnd(currentScopeId, visit, visit), scopeStack.push(currentScopeId)), currentScopeId = scopeId, scope.
|
162
|
+
currentScopeId && (dataIndex && branchEnd(currentScopeId, visit, visit), scopeStack.push(currentScopeId)), currentScopeId = scopeId, scope.g = visit;
|
163
163
|
else if (token === "]" /* BranchEnd */) {
|
164
164
|
scope[data2] = visit;
|
165
165
|
let curParent = visit.parentNode, startNode = branchEnd(
|
166
166
|
currentScopeId,
|
167
167
|
visit,
|
168
168
|
visit
|
169
|
-
).
|
169
|
+
).g;
|
170
170
|
curParent !== startNode.parentNode && curParent.prepend(startNode), currentScopeId = scopeStack.pop();
|
171
171
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
172
172
|
let next = data2.indexOf(" "), curNode = visit;
|
@@ -177,7 +177,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
177
177
|
start,
|
178
178
|
~next ? next : data2.length
|
179
179
|
);
|
180
|
-
curNode = branchEnd(childScopeId, visit, curNode).
|
180
|
+
curNode = branchEnd(childScopeId, visit, curNode).h;
|
181
181
|
}
|
182
182
|
}
|
183
183
|
}
|
@@ -189,18 +189,18 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
189
189
|
let serialized = resumes[i];
|
190
190
|
if (typeof serialized == "function") {
|
191
191
|
let scopes = serialized(serializeContext), { $global } = scopeLookup;
|
192
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.
|
192
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.m = 1e6);
|
193
193
|
for (let scopeId in scopes)
|
194
194
|
if (scopeId !== "$") {
|
195
195
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
196
|
-
scope.$global = $global, scope.
|
196
|
+
scope.$global = $global, scope.l = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
197
197
|
scope,
|
198
198
|
prevScope
|
199
199
|
));
|
200
200
|
let parentBranchId = parentBranchIds.get(scopeId);
|
201
|
-
if (parentBranchId && (scope.
|
202
|
-
let branch = scope, parentBranch = branch.
|
203
|
-
scope.
|
201
|
+
if (parentBranchId && (scope.j = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
202
|
+
let branch = scope, parentBranch = branch.j;
|
203
|
+
scope.j = branch, parentBranch && (branch.n = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
204
204
|
branch
|
205
205
|
));
|
206
206
|
}
|
@@ -633,47 +633,47 @@ function toInsertNode(startNode, endNode) {
|
|
633
633
|
var pendingScopes = [];
|
634
634
|
function createScope($global, closestBranch) {
|
635
635
|
let scope = {
|
636
|
-
|
637
|
-
|
638
|
-
|
636
|
+
l: $global.m++,
|
637
|
+
o: 1,
|
638
|
+
j: closestBranch,
|
639
639
|
$global
|
640
640
|
};
|
641
641
|
return pendingScopes.push(scope), scope;
|
642
642
|
}
|
643
643
|
function skipScope(scope) {
|
644
|
-
return scope.$global.
|
644
|
+
return scope.$global.m++;
|
645
645
|
}
|
646
646
|
function finishPendingScopes() {
|
647
647
|
for (let scope of pendingScopes)
|
648
|
-
scope.
|
648
|
+
scope.o = 0;
|
649
649
|
pendingScopes = [];
|
650
650
|
}
|
651
651
|
function destroyBranch(branch) {
|
652
|
-
branch.
|
652
|
+
branch.n?.z?.delete(branch), destroyNestedBranches(branch);
|
653
653
|
}
|
654
654
|
function destroyNestedBranches(branch) {
|
655
|
-
branch.
|
656
|
-
for (let id in scope.
|
657
|
-
scope.
|
655
|
+
branch.q = 1, branch.z?.forEach(destroyNestedBranches), branch.H?.forEach((scope) => {
|
656
|
+
for (let id in scope.t)
|
657
|
+
scope.t[id]?.abort();
|
658
658
|
});
|
659
659
|
}
|
660
660
|
function removeAndDestroyBranch(branch) {
|
661
|
-
destroyBranch(branch), removeChildNodes(branch.
|
661
|
+
destroyBranch(branch), removeChildNodes(branch.g, branch.h);
|
662
662
|
}
|
663
663
|
function insertBranchBefore(branch, parentNode, nextSibling) {
|
664
664
|
insertChildNodes(
|
665
665
|
parentNode,
|
666
666
|
nextSibling,
|
667
|
-
branch.
|
668
|
-
branch.
|
667
|
+
branch.g,
|
668
|
+
branch.h
|
669
669
|
);
|
670
670
|
}
|
671
671
|
function tempDetatchBranch(branch) {
|
672
672
|
insertChildNodes(
|
673
673
|
new DocumentFragment(),
|
674
674
|
null,
|
675
|
-
branch.
|
676
|
-
branch.
|
675
|
+
branch.g,
|
676
|
+
branch.h
|
677
677
|
);
|
678
678
|
}
|
679
679
|
|
@@ -695,7 +695,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
695
695
|
}
|
696
696
|
if (oldStart > oldEnd) {
|
697
697
|
if (newStart <= newEnd) {
|
698
|
-
k = newEnd + 1, nextSibling = k < newBranches.length ? newBranches[k].
|
698
|
+
k = newEnd + 1, nextSibling = k < newBranches.length ? newBranches[k].g : afterReference;
|
699
699
|
do
|
700
700
|
insertBranchBefore(newBranches[newStart++], parent, nextSibling);
|
701
701
|
while (newStart <= newEnd);
|
@@ -724,10 +724,10 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
724
724
|
if (pos === WRONG_POS) {
|
725
725
|
let seq = longestIncreasingSubsequence(sources);
|
726
726
|
for (j = seq.length - 1, k = newBranches.length, i = newLength - 1; i >= 0; --i)
|
727
|
-
sources[i] === -1 ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].
|
727
|
+
sources[i] === -1 ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling)) : j < 0 || i !== seq[j] ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling)) : --j;
|
728
728
|
} else if (synced !== newLength)
|
729
729
|
for (k = newBranches.length, i = newLength - 1; i >= 0; --i)
|
730
|
-
sources[i] === -1 && (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].
|
730
|
+
sources[i] === -1 && (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling));
|
731
731
|
}
|
732
732
|
}
|
733
733
|
}
|
@@ -774,7 +774,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
774
774
|
currentWalkIndex = walkInternal(
|
775
775
|
currentWalkIndex,
|
776
776
|
walkCodes,
|
777
|
-
scope[currentScopeIndex++] = createScope(scope.$global, scope.
|
777
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.j)
|
778
778
|
), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
779
779
|
else if (value2 < 92)
|
780
780
|
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
@@ -793,8 +793,8 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
793
793
|
|
794
794
|
// src/dom/renderer.ts
|
795
795
|
function createBranch($global, renderer, parentScope, parentNode) {
|
796
|
-
let branch = createScope($global), parentBranch = parentScope?.
|
797
|
-
return branch._ = renderer.
|
796
|
+
let branch = createScope($global), parentBranch = parentScope?.j;
|
797
|
+
return branch._ = renderer.u || parentScope, branch.j = branch, parentBranch && (branch.n = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(branch)), renderer.A?.(
|
798
798
|
branch,
|
799
799
|
parentNode.namespaceURI
|
800
800
|
), branch;
|
@@ -806,10 +806,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
806
806
|
);
|
807
807
|
}
|
808
808
|
function setupBranch(renderer, branch) {
|
809
|
-
return (renderer.
|
809
|
+
return (renderer.B || renderer.D) && queueRender(
|
810
810
|
branch,
|
811
811
|
(branch2) => {
|
812
|
-
renderer.
|
812
|
+
renderer.B?.(branch2), renderer.D?.(branch2);
|
813
813
|
},
|
814
814
|
-1
|
815
815
|
), branch;
|
@@ -823,19 +823,19 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
823
823
|
))(branch, walks);
|
824
824
|
} : (branch) => {
|
825
825
|
walk(
|
826
|
-
branch.
|
826
|
+
branch.g = branch.h = new Text(),
|
827
827
|
walks,
|
828
828
|
branch
|
829
829
|
);
|
830
830
|
};
|
831
831
|
return (owner) => ({
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
832
|
+
l: id,
|
833
|
+
A: clone,
|
834
|
+
u: owner,
|
835
|
+
B: setup,
|
836
|
+
k: params,
|
837
|
+
D: closures,
|
838
|
+
x: dynamicScopesAccessor
|
839
839
|
});
|
840
840
|
}
|
841
841
|
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
@@ -860,13 +860,13 @@ function createCloneableHTML(html2, ns) {
|
|
860
860
|
let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
|
861
861
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
862
862
|
walk(
|
863
|
-
branch.
|
863
|
+
branch.g = branch.h = firstChild.cloneNode(!0),
|
864
864
|
walks,
|
865
865
|
branch
|
866
866
|
);
|
867
867
|
} : (branch, walks) => {
|
868
868
|
let clone = parent.cloneNode(!0);
|
869
|
-
walk(clone.firstChild, walks, branch), branch.
|
869
|
+
walk(clone.firstChild, walks, branch), branch.g = clone.firstChild, branch.h = clone.lastChild;
|
870
870
|
};
|
871
871
|
}
|
872
872
|
|
@@ -891,7 +891,7 @@ function triggerMacroTask() {
|
|
891
891
|
function state(valueAccessor, fn) {
|
892
892
|
if (0)
|
893
893
|
var id;
|
894
|
-
let valueChangeAccessor = "
|
894
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value2) => {
|
895
895
|
scope[valueAccessor] !== value2 && (scope[valueAccessor] = value2, fn(scope, value2));
|
896
896
|
};
|
897
897
|
return (scope, value2, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value2 || !(valueAccessor in scope)) && (scope[valueAccessor] = value2, fn(scope, value2)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value2) : (schedule(), queueRender(
|
@@ -907,9 +907,9 @@ function value(valueAccessor, fn = () => {
|
|
907
907
|
(!(valueAccessor in scope) || scope[valueAccessor] !== value2) && (scope[valueAccessor] = value2, fn(scope, value2));
|
908
908
|
};
|
909
909
|
}
|
910
|
-
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "
|
910
|
+
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
911
911
|
return (scope) => {
|
912
|
-
scope.
|
912
|
+
scope.o ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
913
913
|
};
|
914
914
|
}
|
915
915
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
@@ -919,11 +919,11 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
919
919
|
ownerScope,
|
920
920
|
() => {
|
921
921
|
for (let scope of scopes)
|
922
|
-
!scope.
|
922
|
+
!scope.o && !scope.q && childSignal(scope);
|
923
923
|
},
|
924
924
|
-1,
|
925
925
|
0,
|
926
|
-
firstScope.
|
926
|
+
firstScope.l
|
927
927
|
);
|
928
928
|
};
|
929
929
|
return ownerSignal._ = childSignal, ownerSignal;
|
@@ -931,7 +931,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
931
931
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
932
932
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
933
933
|
let ifScope = scope[scopeAccessor];
|
934
|
-
ifScope && !ifScope.
|
934
|
+
ifScope && !ifScope.o && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
935
935
|
};
|
936
936
|
return ownerSignal._ = childSignal, ownerSignal;
|
937
937
|
}
|
@@ -943,13 +943,13 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
943
943
|
));
|
944
944
|
}
|
945
945
|
function dynamicClosure(...closureSignals) {
|
946
|
-
let [{
|
946
|
+
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
947
947
|
for (let i = closureSignals.length; i--; )
|
948
|
-
closureSignals[i].
|
948
|
+
closureSignals[i].I = i;
|
949
949
|
return (scope) => {
|
950
950
|
if (scope[___scopeInstancesAccessor])
|
951
951
|
for (let childScope of scope[___scopeInstancesAccessor])
|
952
|
-
childScope.
|
952
|
+
childScope.o || queueRender(
|
953
953
|
childScope,
|
954
954
|
closureSignals[childScope[___signalIndexAccessor]],
|
955
955
|
-1
|
@@ -958,13 +958,13 @@ function dynamicClosure(...closureSignals) {
|
|
958
958
|
}
|
959
959
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
960
960
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
961
|
-
scope[closureSignal.
|
961
|
+
scope[closureSignal.F] = closureSignal.I, childSignal(scope), subscribeToScopeSet(
|
962
962
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
963
|
-
closureSignal.
|
963
|
+
closureSignal.E,
|
964
964
|
scope
|
965
965
|
);
|
966
966
|
};
|
967
|
-
return closureSignal.
|
967
|
+
return closureSignal.E = "a" /* ClosureScopes */ + valueAccessor, closureSignal.F = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
|
968
968
|
}
|
969
969
|
function closure(valueAccessor, fn, getOwnerScope) {
|
970
970
|
return (scope) => {
|
@@ -972,13 +972,13 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
972
972
|
};
|
973
973
|
}
|
974
974
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
975
|
-
scope[childAccessor]
|
975
|
+
scope[childAccessor].e = (value2) => tagVarSignal2(scope, value2);
|
976
976
|
}
|
977
|
-
var tagVarSignal = (scope, value2) => scope
|
977
|
+
var tagVarSignal = (scope, value2) => scope.e?.(value2);
|
978
978
|
function setTagVarChange(scope, changeHandler) {
|
979
|
-
scope
|
979
|
+
scope.f = changeHandler;
|
980
980
|
}
|
981
|
-
var tagVarSignalChange = (scope, value2) => scope
|
981
|
+
var tagVarSignalChange = (scope, value2) => scope.f?.(value2), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
982
982
|
function nextTagId({ $global }) {
|
983
983
|
let id = tagIdsByGlobal.get($global) || 0;
|
984
984
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
@@ -1006,11 +1006,11 @@ function hoist(...path) {
|
|
1006
1006
|
function awaitTag(nodeAccessor, renderer) {
|
1007
1007
|
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1008
1008
|
return (scope, promise) => {
|
1009
|
-
let tryBranch = scope.
|
1010
|
-
for (; tryBranch && !tryBranch
|
1011
|
-
tryBranch = tryBranch.
|
1009
|
+
let tryBranch = scope.j, awaitBranch = scope[branchAccessor], referenceNode = scope[nodeAccessor], namespaceNode = (awaitBranch?.g ?? referenceNode).parentNode;
|
1010
|
+
for (; tryBranch && !tryBranch.d; )
|
1011
|
+
tryBranch = tryBranch.n;
|
1012
1012
|
let thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
1013
|
-
if (scope.
|
1013
|
+
if (scope.j?.q || scope[promiseAccessor] !== thisPromise)
|
1014
1014
|
return;
|
1015
1015
|
scope[promiseAccessor] = void 0;
|
1016
1016
|
let effects = prepareEffects(() => {
|
@@ -1023,15 +1023,15 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1023
1023
|
),
|
1024
1024
|
referenceNode.parentNode,
|
1025
1025
|
referenceNode
|
1026
|
-
), referenceNode.remove()), renderer.
|
1026
|
+
), referenceNode.remove()), renderer.k?.(awaitBranch, [data2]);
|
1027
1027
|
});
|
1028
1028
|
if (tryBranch) {
|
1029
|
-
if (!--tryBranch.
|
1030
|
-
let placeholderBranch = tryBranch
|
1029
|
+
if (!--tryBranch.y) {
|
1030
|
+
let placeholderBranch = tryBranch.c;
|
1031
1031
|
placeholderBranch ? (insertBranchBefore(
|
1032
1032
|
tryBranch,
|
1033
|
-
placeholderBranch.
|
1034
|
-
placeholderBranch.
|
1033
|
+
placeholderBranch.g.parentNode,
|
1034
|
+
placeholderBranch.g
|
1035
1035
|
), removeAndDestroyBranch(placeholderBranch)) : insertBranchBefore(
|
1036
1036
|
tryBranch,
|
1037
1037
|
referenceNode.parentNode,
|
@@ -1041,38 +1041,38 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1041
1041
|
} else
|
1042
1042
|
runEffects(effects);
|
1043
1043
|
}).catch((error) => {
|
1044
|
-
let tryBranch2 = scope.
|
1045
|
-
for (; tryBranch2 && !tryBranch2
|
1046
|
-
tryBranch2 = tryBranch2.
|
1044
|
+
let tryBranch2 = scope.j;
|
1045
|
+
for (; tryBranch2 && !tryBranch2.b; )
|
1046
|
+
tryBranch2 = tryBranch2.n;
|
1047
1047
|
tryBranch2 ? (setConditionalRenderer(
|
1048
1048
|
tryBranch2._,
|
1049
|
-
tryBranch2
|
1050
|
-
tryBranch2
|
1049
|
+
tryBranch2.a,
|
1050
|
+
tryBranch2.b,
|
1051
1051
|
createAndSetupBranch
|
1052
|
-
), tryBranch2
|
1053
|
-
tryBranch2._["d" /* ConditionalScope */ + tryBranch2
|
1052
|
+
), tryBranch2.b.k?.(
|
1053
|
+
tryBranch2._["d" /* ConditionalScope */ + tryBranch2.a],
|
1054
1054
|
[error]
|
1055
1055
|
)) : setTimeout(() => {
|
1056
1056
|
throw error;
|
1057
1057
|
});
|
1058
1058
|
});
|
1059
|
-
tryBranch ? (tryBranch.
|
1060
|
-
if (tryBranch.
|
1061
|
-
let placeholderBranch = tryBranch
|
1059
|
+
tryBranch ? (tryBranch.y || (tryBranch.y = 0, requestAnimationFrame(() => {
|
1060
|
+
if (tryBranch.y && !tryBranch.q) {
|
1061
|
+
let placeholderBranch = tryBranch.c = createAndSetupBranch(
|
1062
1062
|
scope.$global,
|
1063
|
-
tryBranch
|
1063
|
+
tryBranch.d,
|
1064
1064
|
tryBranch._,
|
1065
|
-
tryBranch.
|
1065
|
+
tryBranch.g.parentNode
|
1066
1066
|
);
|
1067
1067
|
insertBranchBefore(
|
1068
1068
|
placeholderBranch,
|
1069
|
-
tryBranch.
|
1070
|
-
tryBranch.
|
1069
|
+
tryBranch.g.parentNode,
|
1070
|
+
tryBranch.g
|
1071
1071
|
), tempDetatchBranch(tryBranch);
|
1072
1072
|
}
|
1073
|
-
})), tryBranch.
|
1073
|
+
})), tryBranch.y++) : awaitBranch && (awaitBranch.g.parentNode.insertBefore(
|
1074
1074
|
referenceNode,
|
1075
|
-
awaitBranch.
|
1075
|
+
awaitBranch.g
|
1076
1076
|
), tempDetatchBranch(awaitBranch));
|
1077
1077
|
};
|
1078
1078
|
}
|
@@ -1086,7 +1086,7 @@ function createTry(nodeAccessor, tryContent) {
|
|
1086
1086
|
createAndSetupBranch
|
1087
1087
|
);
|
1088
1088
|
let branch = scope[branchAccessor];
|
1089
|
-
branch && (branch
|
1089
|
+
branch && (branch.a = nodeAccessor, branch.b = normalizeDynamicRenderer(input.catch), branch.d = normalizeDynamicRenderer(
|
1090
1090
|
input.placeholder
|
1091
1091
|
));
|
1092
1092
|
};
|
@@ -1109,7 +1109,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1109
1109
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1110
1110
|
return (scope, newRenderer, getInput) => {
|
1111
1111
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1112
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.
|
1112
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.l || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
|
1113
1113
|
if (setConditionalRenderer(
|
1114
1114
|
scope,
|
1115
1115
|
nodeAccessor,
|
@@ -1123,15 +1123,15 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1123
1123
|
0,
|
1124
1124
|
content,
|
1125
1125
|
createAndSetupBranch
|
1126
|
-
), content.
|
1127
|
-
content.
|
1128
|
-
content.
|
1126
|
+
), content.x && subscribeToScopeSet(
|
1127
|
+
content.u,
|
1128
|
+
content.x,
|
1129
1129
|
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
1130
1130
|
);
|
1131
1131
|
}
|
1132
|
-
} else normalizedRenderer?.
|
1133
|
-
normalizedRenderer.
|
1134
|
-
normalizedRenderer.
|
1132
|
+
} else normalizedRenderer?.x && subscribeToScopeSet(
|
1133
|
+
normalizedRenderer.u,
|
1134
|
+
normalizedRenderer.x,
|
1135
1135
|
scope[childScopeAccessor]
|
1136
1136
|
);
|
1137
1137
|
if (normalizedRenderer) {
|
@@ -1142,9 +1142,9 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1142
1142
|
0,
|
1143
1143
|
(inputIsArgs ? args[0] : args) || {}
|
1144
1144
|
);
|
1145
|
-
else if (normalizedRenderer.
|
1145
|
+
else if (normalizedRenderer.k)
|
1146
1146
|
if (inputIsArgs)
|
1147
|
-
normalizedRenderer.
|
1147
|
+
normalizedRenderer.k(
|
1148
1148
|
scope[childScopeAccessor],
|
1149
1149
|
normalizedRenderer._ ? args[0] : args
|
1150
1150
|
);
|
@@ -1153,7 +1153,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1153
1153
|
...args,
|
1154
1154
|
content: getContent(scope)
|
1155
1155
|
} : args || {};
|
1156
|
-
normalizedRenderer.
|
1156
|
+
normalizedRenderer.k(
|
1157
1157
|
scope[childScopeAccessor],
|
1158
1158
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1159
1159
|
);
|
@@ -1162,8 +1162,8 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1162
1162
|
};
|
1163
1163
|
};
|
1164
1164
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
1165
|
-
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.
|
1166
|
-
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.
|
1165
|
+
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.g || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
|
1166
|
+
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.g) : parentNode.insertBefore(referenceNode, prevBranch.g), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
1167
1167
|
}
|
1168
1168
|
function loopOf(nodeAccessor, renderer) {
|
1169
1169
|
return loop(
|
@@ -1192,17 +1192,17 @@ function loopTo(nodeAccessor, renderer) {
|
|
1192
1192
|
);
|
1193
1193
|
}
|
1194
1194
|
function loop(nodeAccessor, renderer, forEach) {
|
1195
|
-
let params = renderer.
|
1195
|
+
let params = renderer.k;
|
1196
1196
|
return (scope, value2) => {
|
1197
1197
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1198
1198
|
...oldMap.values()
|
1199
|
-
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].
|
1199
|
+
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].g.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
|
1200
1200
|
forEach(value2, (key, args) => {
|
1201
1201
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1202
1202
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1203
1203
|
});
|
1204
1204
|
let afterReference = null;
|
1205
|
-
referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].
|
1205
|
+
referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].h.nextSibling, newArray.length || parentNode.insertBefore(referenceNode, afterReference)) : newArray.length && (afterReference = referenceNode.nextSibling, referenceNode.remove())), reconcile(parentNode, oldArray, newArray, afterReference);
|
1206
1206
|
};
|
1207
1207
|
}
|
1208
1208
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
@@ -1212,7 +1212,7 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
1212
1212
|
parentScope,
|
1213
1213
|
parentNode
|
1214
1214
|
);
|
1215
|
-
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.
|
1215
|
+
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.g = branch.h = document.createElementNS(
|
1216
1216
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1217
1217
|
tagNameOrRenderer
|
1218
1218
|
) : setupBranch(tagNameOrRenderer, branch), branch;
|
@@ -1226,20 +1226,20 @@ function byFirstArg(name) {
|
|
1226
1226
|
|
1227
1227
|
// src/dom/queue.ts
|
1228
1228
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = !1, scopeKeyOffset = 1e3;
|
1229
|
-
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.
|
1229
|
+
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.l) {
|
1230
1230
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1231
1231
|
if (existingRender)
|
1232
|
-
existingRender.
|
1232
|
+
existingRender.G = value2;
|
1233
1233
|
else {
|
1234
1234
|
let render = {
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1235
|
+
p: key,
|
1236
|
+
C: scope,
|
1237
|
+
J: signal,
|
1238
|
+
G: value2
|
1239
1239
|
}, i = pendingRenders.push(render) - 1;
|
1240
1240
|
for (; i; ) {
|
1241
1241
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1242
|
-
if (key - parent.
|
1242
|
+
if (key - parent.p >= 0) break;
|
1243
1243
|
pendingRenders[i] = parent, i = parentIndex;
|
1244
1244
|
}
|
1245
1245
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
@@ -1278,36 +1278,36 @@ function runRenders() {
|
|
1278
1278
|
for (; pendingRenders.length; ) {
|
1279
1279
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
1280
1280
|
if (render !== item) {
|
1281
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
1281
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).p;
|
1282
1282
|
for (; i < mid; ) {
|
1283
1283
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1284
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
1284
|
+
if (right < pendingRenders.length && pendingRenders[right].p - pendingRenders[bestChild].p < 0 && (bestChild = right), pendingRenders[bestChild].p - key >= 0)
|
1285
1285
|
break;
|
1286
1286
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1287
1287
|
}
|
1288
1288
|
pendingRenders[i] = item;
|
1289
1289
|
}
|
1290
|
-
render.
|
1290
|
+
render.C.j?.q || runRender(render);
|
1291
1291
|
}
|
1292
1292
|
finishPendingScopes();
|
1293
1293
|
}
|
1294
|
-
var runRender = (render) => render.
|
1294
|
+
var runRender = (render) => render.J(render.C, render.G), enableCatch = () => {
|
1295
1295
|
enableCatch = () => {
|
1296
1296
|
}, runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
1297
1297
|
try {
|
1298
1298
|
runRender2(render);
|
1299
1299
|
} catch (error) {
|
1300
|
-
let branch = render.
|
1301
|
-
for (; branch && !branch
|
1302
|
-
branch = branch.
|
1300
|
+
let branch = render.C.j;
|
1301
|
+
for (; branch && !branch.b; )
|
1302
|
+
branch = branch.n;
|
1303
1303
|
if (branch)
|
1304
1304
|
setConditionalRenderer(
|
1305
1305
|
branch._,
|
1306
|
-
branch
|
1307
|
-
branch
|
1306
|
+
branch.a,
|
1307
|
+
branch.b,
|
1308
1308
|
createAndSetupBranch
|
1309
|
-
), branch
|
1310
|
-
branch._["d" /* ConditionalScope */ + branch
|
1309
|
+
), branch.b.k?.(
|
1310
|
+
branch._["d" /* ConditionalScope */ + branch.a],
|
1311
1311
|
[error]
|
1312
1312
|
);
|
1313
1313
|
else
|
@@ -1318,11 +1318,11 @@ var runRender = (render) => render.D(render.u, render.A), enableCatch = () => {
|
|
1318
1318
|
|
1319
1319
|
// src/dom/abort-signal.ts
|
1320
1320
|
function resetAbortSignal(scope, id) {
|
1321
|
-
let ctrl = scope.
|
1322
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1321
|
+
let ctrl = scope.t?.[id];
|
1322
|
+
ctrl && (queueEffect(ctrl, abort), scope.t[id] = void 0);
|
1323
1323
|
}
|
1324
1324
|
function getAbortSignal(scope, id) {
|
1325
|
-
return scope.
|
1325
|
+
return scope.j && (scope.j.H ||= /* @__PURE__ */ new Set()).add(scope), ((scope.t ||= {})[id] ||= new AbortController()).signal;
|
1326
1326
|
}
|
1327
1327
|
function abort(ctrl) {
|
1328
1328
|
ctrl.abort();
|
@@ -1344,13 +1344,13 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1344
1344
|
register(RENDERER_REGISTER_ID, fn);
|
1345
1345
|
},
|
1346
1346
|
isRenderer(renderer) {
|
1347
|
-
return renderer.
|
1347
|
+
return renderer.A;
|
1348
1348
|
},
|
1349
1349
|
getStartNode(branch) {
|
1350
|
-
return branch.
|
1350
|
+
return branch.g;
|
1351
1351
|
},
|
1352
1352
|
setScopeNodes(branch, startNode, endNode) {
|
1353
|
-
branch.
|
1353
|
+
branch.g = startNode, branch.h = endNode;
|
1354
1354
|
},
|
1355
1355
|
runComponentEffects() {
|
1356
1356
|
runEffects(this.effects);
|
@@ -1369,9 +1369,9 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1369
1369
|
},
|
1370
1370
|
createRenderer(params, clone) {
|
1371
1371
|
let renderer = createRenderer(0, 0, 0, params);
|
1372
|
-
return renderer.
|
1372
|
+
return renderer.A = (branch) => {
|
1373
1373
|
let cloned = clone();
|
1374
|
-
branch.
|
1374
|
+
branch.g = cloned.startNode, branch.h = cloned.endNode;
|
1375
1375
|
}, renderer;
|
1376
1376
|
},
|
1377
1377
|
render(out, component, renderer, args) {
|
@@ -1384,14 +1384,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1384
1384
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1385
1385
|
}
|
1386
1386
|
if (component.effects = prepareEffects(() => {
|
1387
|
-
branch ? existing = !0 : (out.global.
|
1387
|
+
branch ? existing = !0 : (out.global.m ||= 0, branch = component.scope = createAndSetupBranch(
|
1388
1388
|
out.global,
|
1389
1389
|
renderer,
|
1390
|
-
renderer.
|
1390
|
+
renderer.u,
|
1391
1391
|
document.body
|
1392
|
-
)), renderer.
|
1392
|
+
)), renderer.k?.(branch, renderer._ ? args[0] : args);
|
1393
1393
|
}), !existing)
|
1394
|
-
return toInsertNode(branch.
|
1394
|
+
return toInsertNode(branch.g, branch.h);
|
1395
1395
|
}
|
1396
1396
|
};
|
1397
1397
|
|
@@ -1409,12 +1409,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1409
1409
|
function mount(input = {}, reference, position) {
|
1410
1410
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1411
1411
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1412
|
-
|
1412
|
+
m: 0,
|
1413
1413
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1414
1414
|
renderId: DEFAULT_RENDER_ID,
|
1415
1415
|
...$global
|
1416
1416
|
}) : $global = {
|
1417
|
-
|
1417
|
+
m: 0,
|
1418
1418
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1419
1419
|
renderId: DEFAULT_RENDER_ID
|
1420
1420
|
}, position) {
|
@@ -1428,19 +1428,19 @@ function mount(input = {}, reference, position) {
|
|
1428
1428
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
1429
1429
|
break;
|
1430
1430
|
}
|
1431
|
-
let args = this.
|
1431
|
+
let args = this.k, effects = prepareEffects(() => {
|
1432
1432
|
branch = createBranch(
|
1433
1433
|
$global,
|
1434
1434
|
this,
|
1435
1435
|
void 0,
|
1436
1436
|
parentNode
|
1437
|
-
), this.
|
1437
|
+
), this.B?.(branch), args?.(branch, input);
|
1438
1438
|
});
|
1439
1439
|
return insertChildNodes(
|
1440
1440
|
parentNode,
|
1441
1441
|
nextSibling,
|
1442
|
-
branch.
|
1443
|
-
branch.
|
1442
|
+
branch.g,
|
1443
|
+
branch.h
|
1444
1444
|
), runEffects(effects), {
|
1445
1445
|
update(newInput) {
|
1446
1446
|
args && runEffects(
|