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.js
CHANGED
@@ -226,9 +226,9 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
226
226
|
endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
227
227
|
new Text(),
|
228
228
|
reference
|
229
|
-
)), branch.
|
229
|
+
)), branch.h = lastEndNode = endNode, branch.g ||= endNode;
|
230
230
|
for (let [markerScopeId, markerNode] of closestBranchMarkers)
|
231
|
-
branch.
|
231
|
+
branch.g.compareDocumentPosition(markerNode) & 4 && reference.compareDocumentPosition(markerNode) & 2 && (parentBranchIds.set(markerScopeId, branchId), closestBranchMarkers.delete(markerScopeId));
|
232
232
|
return branchIds.add(branchId), closestBranchMarkers.set(branchId, visit), branch;
|
233
233
|
};
|
234
234
|
for (let visit of visits) {
|
@@ -236,7 +236,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
236
236
|
commentPrefixLen + 1,
|
237
237
|
dataIndex ? dataIndex - 1 : commentText.length
|
238
238
|
), scope = scopeLookup[scopeId] ||= {
|
239
|
-
|
239
|
+
l: +scopeId
|
240
240
|
}, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
241
241
|
if (token === "*" /* Node */) {
|
242
242
|
let node = scope[data2] = visit.previousSibling;
|
@@ -244,14 +244,14 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
244
244
|
} else if (token === "$" /* ClosestBranch */)
|
245
245
|
closestBranchMarkers.set(scopeId, visit);
|
246
246
|
else if (token === "[" /* BranchStart */)
|
247
|
-
currentScopeId && (dataIndex && branchEnd(currentScopeId, visit, visit), scopeStack.push(currentScopeId)), currentScopeId = scopeId, scope.
|
247
|
+
currentScopeId && (dataIndex && branchEnd(currentScopeId, visit, visit), scopeStack.push(currentScopeId)), currentScopeId = scopeId, scope.g = visit;
|
248
248
|
else if (token === "]" /* BranchEnd */) {
|
249
249
|
scope[data2] = visit;
|
250
250
|
let curParent = visit.parentNode, startNode = branchEnd(
|
251
251
|
currentScopeId,
|
252
252
|
visit,
|
253
253
|
visit
|
254
|
-
).
|
254
|
+
).g;
|
255
255
|
curParent !== startNode.parentNode && curParent.prepend(startNode), currentScopeId = scopeStack.pop();
|
256
256
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
257
257
|
let next = data2.indexOf(" "), curNode = visit;
|
@@ -262,7 +262,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
262
262
|
start,
|
263
263
|
~next ? next : data2.length
|
264
264
|
);
|
265
|
-
curNode = branchEnd(childScopeId, visit, curNode).
|
265
|
+
curNode = branchEnd(childScopeId, visit, curNode).h;
|
266
266
|
}
|
267
267
|
}
|
268
268
|
}
|
@@ -274,18 +274,18 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
274
274
|
let serialized = resumes[i];
|
275
275
|
if (typeof serialized == "function") {
|
276
276
|
let scopes = serialized(serializeContext), { $global } = scopeLookup;
|
277
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.
|
277
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.m = 1e6);
|
278
278
|
for (let scopeId in scopes)
|
279
279
|
if (scopeId !== "$") {
|
280
280
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
281
|
-
scope.$global = $global, scope.
|
281
|
+
scope.$global = $global, scope.l = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
282
282
|
scope,
|
283
283
|
prevScope
|
284
284
|
));
|
285
285
|
let parentBranchId = parentBranchIds.get(scopeId);
|
286
|
-
if (parentBranchId && (scope.
|
287
|
-
let branch = scope, parentBranch = branch.
|
288
|
-
scope.
|
286
|
+
if (parentBranchId && (scope.j = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
287
|
+
let branch = scope, parentBranch = branch.j;
|
288
|
+
scope.j = branch, parentBranch && (branch.n = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
289
289
|
branch
|
290
290
|
));
|
291
291
|
}
|
@@ -718,47 +718,47 @@ function toInsertNode(startNode, endNode) {
|
|
718
718
|
var pendingScopes = [];
|
719
719
|
function createScope($global, closestBranch) {
|
720
720
|
let scope = {
|
721
|
-
|
722
|
-
|
723
|
-
|
721
|
+
l: $global.m++,
|
722
|
+
o: 1,
|
723
|
+
j: closestBranch,
|
724
724
|
$global
|
725
725
|
};
|
726
726
|
return pendingScopes.push(scope), scope;
|
727
727
|
}
|
728
728
|
function skipScope(scope) {
|
729
|
-
return scope.$global.
|
729
|
+
return scope.$global.m++;
|
730
730
|
}
|
731
731
|
function finishPendingScopes() {
|
732
732
|
for (let scope of pendingScopes)
|
733
|
-
scope.
|
733
|
+
scope.o = 0;
|
734
734
|
pendingScopes = [];
|
735
735
|
}
|
736
736
|
function destroyBranch(branch) {
|
737
|
-
branch.
|
737
|
+
branch.n?.z?.delete(branch), destroyNestedBranches(branch);
|
738
738
|
}
|
739
739
|
function destroyNestedBranches(branch) {
|
740
|
-
branch.
|
741
|
-
for (let id in scope.
|
742
|
-
scope.
|
740
|
+
branch.q = 1, branch.z?.forEach(destroyNestedBranches), branch.H?.forEach((scope) => {
|
741
|
+
for (let id in scope.t)
|
742
|
+
scope.t[id]?.abort();
|
743
743
|
});
|
744
744
|
}
|
745
745
|
function removeAndDestroyBranch(branch) {
|
746
|
-
destroyBranch(branch), removeChildNodes(branch.
|
746
|
+
destroyBranch(branch), removeChildNodes(branch.g, branch.h);
|
747
747
|
}
|
748
748
|
function insertBranchBefore(branch, parentNode, nextSibling) {
|
749
749
|
insertChildNodes(
|
750
750
|
parentNode,
|
751
751
|
nextSibling,
|
752
|
-
branch.
|
753
|
-
branch.
|
752
|
+
branch.g,
|
753
|
+
branch.h
|
754
754
|
);
|
755
755
|
}
|
756
756
|
function tempDetatchBranch(branch) {
|
757
757
|
insertChildNodes(
|
758
758
|
new DocumentFragment(),
|
759
759
|
null,
|
760
|
-
branch.
|
761
|
-
branch.
|
760
|
+
branch.g,
|
761
|
+
branch.h
|
762
762
|
);
|
763
763
|
}
|
764
764
|
|
@@ -780,7 +780,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
780
780
|
}
|
781
781
|
if (oldStart > oldEnd) {
|
782
782
|
if (newStart <= newEnd) {
|
783
|
-
k = newEnd + 1, nextSibling = k < newBranches.length ? newBranches[k].
|
783
|
+
k = newEnd + 1, nextSibling = k < newBranches.length ? newBranches[k].g : afterReference;
|
784
784
|
do
|
785
785
|
insertBranchBefore(newBranches[newStart++], parent, nextSibling);
|
786
786
|
while (newStart <= newEnd);
|
@@ -809,10 +809,10 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
809
809
|
if (pos === WRONG_POS) {
|
810
810
|
let seq = longestIncreasingSubsequence(sources);
|
811
811
|
for (j = seq.length - 1, k = newBranches.length, i = newLength - 1; i >= 0; --i)
|
812
|
-
sources[i] === -1 ? (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].
|
812
|
+
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;
|
813
813
|
} else if (synced !== newLength)
|
814
814
|
for (k = newBranches.length, i = newLength - 1; i >= 0; --i)
|
815
|
-
sources[i] === -1 && (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].
|
815
|
+
sources[i] === -1 && (pos = i + newStart, newBranch = newBranches[pos++], nextSibling = pos < k ? newBranches[pos].g : afterReference, insertBranchBefore(newBranch, parent, nextSibling));
|
816
816
|
}
|
817
817
|
}
|
818
818
|
}
|
@@ -859,7 +859,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
859
859
|
currentWalkIndex = walkInternal(
|
860
860
|
currentWalkIndex,
|
861
861
|
walkCodes,
|
862
|
-
scope[currentScopeIndex++] = createScope(scope.$global, scope.
|
862
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.j)
|
863
863
|
), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
864
864
|
else if (value2 < 92)
|
865
865
|
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
@@ -878,8 +878,8 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
878
878
|
|
879
879
|
// src/dom/renderer.ts
|
880
880
|
function createBranch($global, renderer, parentScope, parentNode) {
|
881
|
-
let branch = createScope($global), parentBranch = parentScope?.
|
882
|
-
return branch._ = renderer.
|
881
|
+
let branch = createScope($global), parentBranch = parentScope?.j;
|
882
|
+
return branch._ = renderer.u || parentScope, branch.j = branch, parentBranch && (branch.n = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(branch)), renderer.A?.(
|
883
883
|
branch,
|
884
884
|
parentNode.namespaceURI
|
885
885
|
), branch;
|
@@ -891,10 +891,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
891
891
|
);
|
892
892
|
}
|
893
893
|
function setupBranch(renderer, branch) {
|
894
|
-
return (renderer.
|
894
|
+
return (renderer.B || renderer.D) && queueRender(
|
895
895
|
branch,
|
896
896
|
(branch2) => {
|
897
|
-
renderer.
|
897
|
+
renderer.B?.(branch2), renderer.D?.(branch2);
|
898
898
|
},
|
899
899
|
-1
|
900
900
|
), branch;
|
@@ -908,19 +908,19 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
908
908
|
))(branch, walks);
|
909
909
|
} : (branch) => {
|
910
910
|
walk(
|
911
|
-
branch.
|
911
|
+
branch.g = branch.h = new Text(),
|
912
912
|
walks,
|
913
913
|
branch
|
914
914
|
);
|
915
915
|
};
|
916
916
|
return (owner) => ({
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
917
|
+
l: id,
|
918
|
+
A: clone,
|
919
|
+
u: owner,
|
920
|
+
B: setup,
|
921
|
+
k: params,
|
922
|
+
D: closures,
|
923
|
+
x: dynamicScopesAccessor
|
924
924
|
});
|
925
925
|
}
|
926
926
|
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
@@ -945,13 +945,13 @@ function createCloneableHTML(html2, ns) {
|
|
945
945
|
let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
|
946
946
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
947
947
|
walk(
|
948
|
-
branch.
|
948
|
+
branch.g = branch.h = firstChild.cloneNode(!0),
|
949
949
|
walks,
|
950
950
|
branch
|
951
951
|
);
|
952
952
|
} : (branch, walks) => {
|
953
953
|
let clone = parent.cloneNode(!0);
|
954
|
-
walk(clone.firstChild, walks, branch), branch.
|
954
|
+
walk(clone.firstChild, walks, branch), branch.g = clone.firstChild, branch.h = clone.lastChild;
|
955
955
|
};
|
956
956
|
}
|
957
957
|
|
@@ -976,7 +976,7 @@ function triggerMacroTask() {
|
|
976
976
|
function state(valueAccessor, fn) {
|
977
977
|
if (0)
|
978
978
|
var id;
|
979
|
-
let valueChangeAccessor = "
|
979
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value2) => {
|
980
980
|
scope[valueAccessor] !== value2 && (scope[valueAccessor] = value2, fn(scope, value2));
|
981
981
|
};
|
982
982
|
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(
|
@@ -992,9 +992,9 @@ function value(valueAccessor, fn = () => {
|
|
992
992
|
(!(valueAccessor in scope) || scope[valueAccessor] !== value2) && (scope[valueAccessor] = value2, fn(scope, value2));
|
993
993
|
};
|
994
994
|
}
|
995
|
-
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "
|
995
|
+
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
996
996
|
return (scope) => {
|
997
|
-
scope.
|
997
|
+
scope.o ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
998
998
|
};
|
999
999
|
}
|
1000
1000
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
@@ -1004,11 +1004,11 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1004
1004
|
ownerScope,
|
1005
1005
|
() => {
|
1006
1006
|
for (let scope of scopes)
|
1007
|
-
!scope.
|
1007
|
+
!scope.o && !scope.q && childSignal(scope);
|
1008
1008
|
},
|
1009
1009
|
-1,
|
1010
1010
|
0,
|
1011
|
-
firstScope.
|
1011
|
+
firstScope.l
|
1012
1012
|
);
|
1013
1013
|
};
|
1014
1014
|
return ownerSignal._ = childSignal, ownerSignal;
|
@@ -1016,7 +1016,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1016
1016
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
1017
1017
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
1018
1018
|
let ifScope = scope[scopeAccessor];
|
1019
|
-
ifScope && !ifScope.
|
1019
|
+
ifScope && !ifScope.o && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
1020
1020
|
};
|
1021
1021
|
return ownerSignal._ = childSignal, ownerSignal;
|
1022
1022
|
}
|
@@ -1028,13 +1028,13 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1028
1028
|
));
|
1029
1029
|
}
|
1030
1030
|
function dynamicClosure(...closureSignals) {
|
1031
|
-
let [{
|
1031
|
+
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
1032
1032
|
for (let i = closureSignals.length; i--; )
|
1033
|
-
closureSignals[i].
|
1033
|
+
closureSignals[i].I = i;
|
1034
1034
|
return (scope) => {
|
1035
1035
|
if (scope[___scopeInstancesAccessor])
|
1036
1036
|
for (let childScope of scope[___scopeInstancesAccessor])
|
1037
|
-
childScope.
|
1037
|
+
childScope.o || queueRender(
|
1038
1038
|
childScope,
|
1039
1039
|
closureSignals[childScope[___signalIndexAccessor]],
|
1040
1040
|
-1
|
@@ -1043,13 +1043,13 @@ function dynamicClosure(...closureSignals) {
|
|
1043
1043
|
}
|
1044
1044
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1045
1045
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
1046
|
-
scope[closureSignal.
|
1046
|
+
scope[closureSignal.F] = closureSignal.I, childSignal(scope), subscribeToScopeSet(
|
1047
1047
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1048
|
-
closureSignal.
|
1048
|
+
closureSignal.E,
|
1049
1049
|
scope
|
1050
1050
|
);
|
1051
1051
|
};
|
1052
|
-
return closureSignal.
|
1052
|
+
return closureSignal.E = "a" /* ClosureScopes */ + valueAccessor, closureSignal.F = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
|
1053
1053
|
}
|
1054
1054
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1055
1055
|
return (scope) => {
|
@@ -1057,13 +1057,13 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
1057
1057
|
};
|
1058
1058
|
}
|
1059
1059
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1060
|
-
scope[childAccessor]
|
1060
|
+
scope[childAccessor].e = (value2) => tagVarSignal2(scope, value2);
|
1061
1061
|
}
|
1062
|
-
var tagVarSignal = (scope, value2) => scope
|
1062
|
+
var tagVarSignal = (scope, value2) => scope.e?.(value2);
|
1063
1063
|
function setTagVarChange(scope, changeHandler) {
|
1064
|
-
scope
|
1064
|
+
scope.f = changeHandler;
|
1065
1065
|
}
|
1066
|
-
var tagVarSignalChange = (scope, value2) => scope
|
1066
|
+
var tagVarSignalChange = (scope, value2) => scope.f?.(value2), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1067
1067
|
function nextTagId({ $global }) {
|
1068
1068
|
let id = tagIdsByGlobal.get($global) || 0;
|
1069
1069
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
@@ -1091,11 +1091,11 @@ function hoist(...path) {
|
|
1091
1091
|
function awaitTag(nodeAccessor, renderer) {
|
1092
1092
|
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1093
1093
|
return (scope, promise) => {
|
1094
|
-
let tryBranch = scope.
|
1095
|
-
for (; tryBranch && !tryBranch
|
1096
|
-
tryBranch = tryBranch.
|
1094
|
+
let tryBranch = scope.j, awaitBranch = scope[branchAccessor], referenceNode = scope[nodeAccessor], namespaceNode = (awaitBranch?.g ?? referenceNode).parentNode;
|
1095
|
+
for (; tryBranch && !tryBranch.d; )
|
1096
|
+
tryBranch = tryBranch.n;
|
1097
1097
|
let thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
1098
|
-
if (scope.
|
1098
|
+
if (scope.j?.q || scope[promiseAccessor] !== thisPromise)
|
1099
1099
|
return;
|
1100
1100
|
scope[promiseAccessor] = void 0;
|
1101
1101
|
let effects = prepareEffects(() => {
|
@@ -1108,15 +1108,15 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1108
1108
|
),
|
1109
1109
|
referenceNode.parentNode,
|
1110
1110
|
referenceNode
|
1111
|
-
), referenceNode.remove()), renderer.
|
1111
|
+
), referenceNode.remove()), renderer.k?.(awaitBranch, [data2]);
|
1112
1112
|
});
|
1113
1113
|
if (tryBranch) {
|
1114
|
-
if (!--tryBranch.
|
1115
|
-
let placeholderBranch = tryBranch
|
1114
|
+
if (!--tryBranch.y) {
|
1115
|
+
let placeholderBranch = tryBranch.c;
|
1116
1116
|
placeholderBranch ? (insertBranchBefore(
|
1117
1117
|
tryBranch,
|
1118
|
-
placeholderBranch.
|
1119
|
-
placeholderBranch.
|
1118
|
+
placeholderBranch.g.parentNode,
|
1119
|
+
placeholderBranch.g
|
1120
1120
|
), removeAndDestroyBranch(placeholderBranch)) : insertBranchBefore(
|
1121
1121
|
tryBranch,
|
1122
1122
|
referenceNode.parentNode,
|
@@ -1126,38 +1126,38 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1126
1126
|
} else
|
1127
1127
|
runEffects(effects);
|
1128
1128
|
}).catch((error) => {
|
1129
|
-
let tryBranch2 = scope.
|
1130
|
-
for (; tryBranch2 && !tryBranch2
|
1131
|
-
tryBranch2 = tryBranch2.
|
1129
|
+
let tryBranch2 = scope.j;
|
1130
|
+
for (; tryBranch2 && !tryBranch2.b; )
|
1131
|
+
tryBranch2 = tryBranch2.n;
|
1132
1132
|
tryBranch2 ? (setConditionalRenderer(
|
1133
1133
|
tryBranch2._,
|
1134
|
-
tryBranch2
|
1135
|
-
tryBranch2
|
1134
|
+
tryBranch2.a,
|
1135
|
+
tryBranch2.b,
|
1136
1136
|
createAndSetupBranch
|
1137
|
-
), tryBranch2
|
1138
|
-
tryBranch2._["d" /* ConditionalScope */ + tryBranch2
|
1137
|
+
), tryBranch2.b.k?.(
|
1138
|
+
tryBranch2._["d" /* ConditionalScope */ + tryBranch2.a],
|
1139
1139
|
[error]
|
1140
1140
|
)) : setTimeout(() => {
|
1141
1141
|
throw error;
|
1142
1142
|
});
|
1143
1143
|
});
|
1144
|
-
tryBranch ? (tryBranch.
|
1145
|
-
if (tryBranch.
|
1146
|
-
let placeholderBranch = tryBranch
|
1144
|
+
tryBranch ? (tryBranch.y || (tryBranch.y = 0, requestAnimationFrame(() => {
|
1145
|
+
if (tryBranch.y && !tryBranch.q) {
|
1146
|
+
let placeholderBranch = tryBranch.c = createAndSetupBranch(
|
1147
1147
|
scope.$global,
|
1148
|
-
tryBranch
|
1148
|
+
tryBranch.d,
|
1149
1149
|
tryBranch._,
|
1150
|
-
tryBranch.
|
1150
|
+
tryBranch.g.parentNode
|
1151
1151
|
);
|
1152
1152
|
insertBranchBefore(
|
1153
1153
|
placeholderBranch,
|
1154
|
-
tryBranch.
|
1155
|
-
tryBranch.
|
1154
|
+
tryBranch.g.parentNode,
|
1155
|
+
tryBranch.g
|
1156
1156
|
), tempDetatchBranch(tryBranch);
|
1157
1157
|
}
|
1158
|
-
})), tryBranch.
|
1158
|
+
})), tryBranch.y++) : awaitBranch && (awaitBranch.g.parentNode.insertBefore(
|
1159
1159
|
referenceNode,
|
1160
|
-
awaitBranch.
|
1160
|
+
awaitBranch.g
|
1161
1161
|
), tempDetatchBranch(awaitBranch));
|
1162
1162
|
};
|
1163
1163
|
}
|
@@ -1171,7 +1171,7 @@ function createTry(nodeAccessor, tryContent) {
|
|
1171
1171
|
createAndSetupBranch
|
1172
1172
|
);
|
1173
1173
|
let branch = scope[branchAccessor];
|
1174
|
-
branch && (branch
|
1174
|
+
branch && (branch.a = nodeAccessor, branch.b = normalizeDynamicRenderer(input.catch), branch.d = normalizeDynamicRenderer(
|
1175
1175
|
input.placeholder
|
1176
1176
|
));
|
1177
1177
|
};
|
@@ -1194,7 +1194,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1194
1194
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1195
1195
|
return (scope, newRenderer, getInput) => {
|
1196
1196
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1197
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.
|
1197
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.l || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
|
1198
1198
|
if (setConditionalRenderer(
|
1199
1199
|
scope,
|
1200
1200
|
nodeAccessor,
|
@@ -1208,15 +1208,15 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1208
1208
|
0,
|
1209
1209
|
content,
|
1210
1210
|
createAndSetupBranch
|
1211
|
-
), content.
|
1212
|
-
content.
|
1213
|
-
content.
|
1211
|
+
), content.x && subscribeToScopeSet(
|
1212
|
+
content.u,
|
1213
|
+
content.x,
|
1214
1214
|
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
1215
1215
|
);
|
1216
1216
|
}
|
1217
|
-
} else normalizedRenderer?.
|
1218
|
-
normalizedRenderer.
|
1219
|
-
normalizedRenderer.
|
1217
|
+
} else normalizedRenderer?.x && subscribeToScopeSet(
|
1218
|
+
normalizedRenderer.u,
|
1219
|
+
normalizedRenderer.x,
|
1220
1220
|
scope[childScopeAccessor]
|
1221
1221
|
);
|
1222
1222
|
if (normalizedRenderer) {
|
@@ -1227,9 +1227,9 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1227
1227
|
0,
|
1228
1228
|
(inputIsArgs ? args[0] : args) || {}
|
1229
1229
|
);
|
1230
|
-
else if (normalizedRenderer.
|
1230
|
+
else if (normalizedRenderer.k)
|
1231
1231
|
if (inputIsArgs)
|
1232
|
-
normalizedRenderer.
|
1232
|
+
normalizedRenderer.k(
|
1233
1233
|
scope[childScopeAccessor],
|
1234
1234
|
normalizedRenderer._ ? args[0] : args
|
1235
1235
|
);
|
@@ -1238,7 +1238,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1238
1238
|
...args,
|
1239
1239
|
content: getContent(scope)
|
1240
1240
|
} : args || {};
|
1241
|
-
normalizedRenderer.
|
1241
|
+
normalizedRenderer.k(
|
1242
1242
|
scope[childScopeAccessor],
|
1243
1243
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1244
1244
|
);
|
@@ -1247,8 +1247,8 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1247
1247
|
};
|
1248
1248
|
};
|
1249
1249
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
1250
|
-
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.
|
1251
|
-
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.
|
1250
|
+
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);
|
1251
|
+
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());
|
1252
1252
|
}
|
1253
1253
|
function loopOf(nodeAccessor, renderer) {
|
1254
1254
|
return loop(
|
@@ -1277,17 +1277,17 @@ function loopTo(nodeAccessor, renderer) {
|
|
1277
1277
|
);
|
1278
1278
|
}
|
1279
1279
|
function loop(nodeAccessor, renderer, forEach) {
|
1280
|
-
let params = renderer.
|
1280
|
+
let params = renderer.k;
|
1281
1281
|
return (scope, value2) => {
|
1282
1282
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1283
1283
|
...oldMap.values()
|
1284
|
-
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].
|
1284
|
+
] : [], 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] = [];
|
1285
1285
|
forEach(value2, (key, args) => {
|
1286
1286
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1287
1287
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1288
1288
|
});
|
1289
1289
|
let afterReference = null;
|
1290
|
-
referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].
|
1290
|
+
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);
|
1291
1291
|
};
|
1292
1292
|
}
|
1293
1293
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
@@ -1297,7 +1297,7 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
1297
1297
|
parentScope,
|
1298
1298
|
parentNode
|
1299
1299
|
);
|
1300
|
-
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.
|
1300
|
+
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.g = branch.h = document.createElementNS(
|
1301
1301
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1302
1302
|
tagNameOrRenderer
|
1303
1303
|
) : setupBranch(tagNameOrRenderer, branch), branch;
|
@@ -1311,20 +1311,20 @@ function byFirstArg(name) {
|
|
1311
1311
|
|
1312
1312
|
// src/dom/queue.ts
|
1313
1313
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = !1, scopeKeyOffset = 1e3;
|
1314
|
-
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.
|
1314
|
+
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.l) {
|
1315
1315
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1316
1316
|
if (existingRender)
|
1317
|
-
existingRender.
|
1317
|
+
existingRender.G = value2;
|
1318
1318
|
else {
|
1319
1319
|
let render = {
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1320
|
+
p: key,
|
1321
|
+
C: scope,
|
1322
|
+
J: signal,
|
1323
|
+
G: value2
|
1324
1324
|
}, i = pendingRenders.push(render) - 1;
|
1325
1325
|
for (; i; ) {
|
1326
1326
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1327
|
-
if (key - parent.
|
1327
|
+
if (key - parent.p >= 0) break;
|
1328
1328
|
pendingRenders[i] = parent, i = parentIndex;
|
1329
1329
|
}
|
1330
1330
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
@@ -1363,36 +1363,36 @@ function runRenders() {
|
|
1363
1363
|
for (; pendingRenders.length; ) {
|
1364
1364
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
1365
1365
|
if (render !== item) {
|
1366
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
1366
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).p;
|
1367
1367
|
for (; i < mid; ) {
|
1368
1368
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1369
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
1369
|
+
if (right < pendingRenders.length && pendingRenders[right].p - pendingRenders[bestChild].p < 0 && (bestChild = right), pendingRenders[bestChild].p - key >= 0)
|
1370
1370
|
break;
|
1371
1371
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1372
1372
|
}
|
1373
1373
|
pendingRenders[i] = item;
|
1374
1374
|
}
|
1375
|
-
render.
|
1375
|
+
render.C.j?.q || runRender(render);
|
1376
1376
|
}
|
1377
1377
|
finishPendingScopes();
|
1378
1378
|
}
|
1379
|
-
var runRender = (render) => render.
|
1379
|
+
var runRender = (render) => render.J(render.C, render.G), enableCatch = () => {
|
1380
1380
|
enableCatch = () => {
|
1381
1381
|
}, runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
1382
1382
|
try {
|
1383
1383
|
runRender2(render);
|
1384
1384
|
} catch (error) {
|
1385
|
-
let branch = render.
|
1386
|
-
for (; branch && !branch
|
1387
|
-
branch = branch.
|
1385
|
+
let branch = render.C.j;
|
1386
|
+
for (; branch && !branch.b; )
|
1387
|
+
branch = branch.n;
|
1388
1388
|
if (branch)
|
1389
1389
|
setConditionalRenderer(
|
1390
1390
|
branch._,
|
1391
|
-
branch
|
1392
|
-
branch
|
1391
|
+
branch.a,
|
1392
|
+
branch.b,
|
1393
1393
|
createAndSetupBranch
|
1394
|
-
), branch
|
1395
|
-
branch._["d" /* ConditionalScope */ + branch
|
1394
|
+
), branch.b.k?.(
|
1395
|
+
branch._["d" /* ConditionalScope */ + branch.a],
|
1396
1396
|
[error]
|
1397
1397
|
);
|
1398
1398
|
else
|
@@ -1403,11 +1403,11 @@ var runRender = (render) => render.D(render.u, render.A), enableCatch = () => {
|
|
1403
1403
|
|
1404
1404
|
// src/dom/abort-signal.ts
|
1405
1405
|
function resetAbortSignal(scope, id) {
|
1406
|
-
let ctrl = scope.
|
1407
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1406
|
+
let ctrl = scope.t?.[id];
|
1407
|
+
ctrl && (queueEffect(ctrl, abort), scope.t[id] = void 0);
|
1408
1408
|
}
|
1409
1409
|
function getAbortSignal(scope, id) {
|
1410
|
-
return scope.
|
1410
|
+
return scope.j && (scope.j.H ||= /* @__PURE__ */ new Set()).add(scope), ((scope.t ||= {})[id] ||= new AbortController()).signal;
|
1411
1411
|
}
|
1412
1412
|
function abort(ctrl) {
|
1413
1413
|
ctrl.abort();
|
@@ -1429,13 +1429,13 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1429
1429
|
register(RENDERER_REGISTER_ID, fn);
|
1430
1430
|
},
|
1431
1431
|
isRenderer(renderer) {
|
1432
|
-
return renderer.
|
1432
|
+
return renderer.A;
|
1433
1433
|
},
|
1434
1434
|
getStartNode(branch) {
|
1435
|
-
return branch.
|
1435
|
+
return branch.g;
|
1436
1436
|
},
|
1437
1437
|
setScopeNodes(branch, startNode, endNode) {
|
1438
|
-
branch.
|
1438
|
+
branch.g = startNode, branch.h = endNode;
|
1439
1439
|
},
|
1440
1440
|
runComponentEffects() {
|
1441
1441
|
runEffects(this.effects);
|
@@ -1454,9 +1454,9 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1454
1454
|
},
|
1455
1455
|
createRenderer(params, clone) {
|
1456
1456
|
let renderer = createRenderer(0, 0, 0, params);
|
1457
|
-
return renderer.
|
1457
|
+
return renderer.A = (branch) => {
|
1458
1458
|
let cloned = clone();
|
1459
|
-
branch.
|
1459
|
+
branch.g = cloned.startNode, branch.h = cloned.endNode;
|
1460
1460
|
}, renderer;
|
1461
1461
|
},
|
1462
1462
|
render(out, component, renderer, args) {
|
@@ -1469,14 +1469,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1469
1469
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1470
1470
|
}
|
1471
1471
|
if (component.effects = prepareEffects(() => {
|
1472
|
-
branch ? existing = !0 : (out.global.
|
1472
|
+
branch ? existing = !0 : (out.global.m ||= 0, branch = component.scope = createAndSetupBranch(
|
1473
1473
|
out.global,
|
1474
1474
|
renderer,
|
1475
|
-
renderer.
|
1475
|
+
renderer.u,
|
1476
1476
|
document.body
|
1477
|
-
)), renderer.
|
1477
|
+
)), renderer.k?.(branch, renderer._ ? args[0] : args);
|
1478
1478
|
}), !existing)
|
1479
|
-
return toInsertNode(branch.
|
1479
|
+
return toInsertNode(branch.g, branch.h);
|
1480
1480
|
}
|
1481
1481
|
};
|
1482
1482
|
|
@@ -1494,12 +1494,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1494
1494
|
function mount(input = {}, reference, position) {
|
1495
1495
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1496
1496
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1497
|
-
|
1497
|
+
m: 0,
|
1498
1498
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1499
1499
|
renderId: DEFAULT_RENDER_ID,
|
1500
1500
|
...$global
|
1501
1501
|
}) : $global = {
|
1502
|
-
|
1502
|
+
m: 0,
|
1503
1503
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1504
1504
|
renderId: DEFAULT_RENDER_ID
|
1505
1505
|
}, position) {
|
@@ -1513,19 +1513,19 @@ function mount(input = {}, reference, position) {
|
|
1513
1513
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
1514
1514
|
break;
|
1515
1515
|
}
|
1516
|
-
let args = this.
|
1516
|
+
let args = this.k, effects = prepareEffects(() => {
|
1517
1517
|
branch = createBranch(
|
1518
1518
|
$global,
|
1519
1519
|
this,
|
1520
1520
|
void 0,
|
1521
1521
|
parentNode
|
1522
|
-
), this.
|
1522
|
+
), this.B?.(branch), args?.(branch, input);
|
1523
1523
|
});
|
1524
1524
|
return insertChildNodes(
|
1525
1525
|
parentNode,
|
1526
1526
|
nextSibling,
|
1527
|
-
branch.
|
1528
|
-
branch.
|
1527
|
+
branch.g,
|
1528
|
+
branch.h
|
1529
1529
|
), runEffects(effects), {
|
1530
1530
|
update(newInput) {
|
1531
1531
|
args && runEffects(
|