marko 6.0.0-next.3.51 → 6.0.0-next.3.53
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/types.d.ts +6 -7
- package/dist/debug/dom.js +81 -55
- package/dist/debug/dom.mjs +81 -55
- package/dist/dom/compat.d.ts +1 -1
- package/dist/dom/renderer.d.ts +8 -5
- package/dist/dom/signals.d.ts +5 -9
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +117 -95
- package/dist/dom.mjs +117 -95
- package/dist/translator/index.js +199 -146
- package/dist/translator/util/references.d.ts +3 -2
- package/dist/translator/util/sections.d.ts +6 -1
- package/dist/translator/util/signals.d.ts +2 -3
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -119,17 +119,17 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
|
119
119
|
var registeredValues = {}, Render = class {
|
120
120
|
q = [];
|
121
121
|
s = {};
|
122
|
-
|
122
|
+
F = {
|
123
123
|
_: registeredValues
|
124
124
|
};
|
125
125
|
constructor(renders, runtimeId, renderId) {
|
126
|
-
this.
|
126
|
+
this.G = renders, this.H = runtimeId, this.t = renderId, this.u = renders[renderId], this.x();
|
127
127
|
}
|
128
128
|
w() {
|
129
129
|
this.u.w(), this.x();
|
130
130
|
}
|
131
131
|
x() {
|
132
|
-
let data2 = this.u, serializeContext = this.
|
132
|
+
let data2 = this.u, serializeContext = this.F, scopeLookup = this.s, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
|
133
133
|
if (visits.length) {
|
134
134
|
let commentPrefixLen = data2.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
|
135
135
|
data2.v = [];
|
@@ -145,22 +145,22 @@ var registeredValues = {}, Render = class {
|
|
145
145
|
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
|
146
146
|
commentPrefixLen + 1,
|
147
147
|
dataIndex ? dataIndex - 1 : commentText.length
|
148
|
-
), scope = scopeLookup[scopeId] ||= {
|
148
|
+
), scope = scopeLookup[scopeId] ||= { d: +scopeId }, data3 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
149
149
|
if (token === "*" /* Node */) {
|
150
150
|
let node = scope[data3] = visit.previousSibling;
|
151
151
|
scope[data3 + ">" /* Getter */] = () => node;
|
152
152
|
} else if (token === "$" /* ClosestBranch */)
|
153
153
|
closestBranchMarkers.set(scopeId, visit);
|
154
154
|
else if (token === "[" /* BranchStart */)
|
155
|
-
this.
|
155
|
+
this.f && (dataIndex && branchEnd(this.f, visit, visit), this.q.push(this.f)), this.f = scopeId, scope.a = visit;
|
156
156
|
else if (token === "]" /* BranchEnd */) {
|
157
157
|
scope[data3] = visit;
|
158
158
|
let curParent = visit.parentNode, startNode = branchEnd(
|
159
|
-
this.
|
159
|
+
this.f,
|
160
160
|
visit,
|
161
161
|
visit
|
162
162
|
).a;
|
163
|
-
curParent !== startNode.parentNode && curParent.prepend(startNode), this.
|
163
|
+
curParent !== startNode.parentNode && curParent.prepend(startNode), this.f = this.q.pop();
|
164
164
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
165
165
|
let next = data3.indexOf(" "), curNode = visit;
|
166
166
|
for (scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
@@ -181,21 +181,21 @@ var registeredValues = {}, Render = class {
|
|
181
181
|
let resumeData = resumes[i++];
|
182
182
|
if (typeof resumeData == "function") {
|
183
183
|
let scopes = resumeData(serializeContext), { $global } = scopeLookup;
|
184
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.
|
184
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.H, $global.renderId = this.t, $global.g = 1e6);
|
185
185
|
for (let scopeId in scopes)
|
186
186
|
if (scopeId !== "$") {
|
187
187
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
188
|
-
scope.$global = $global, scope.
|
188
|
+
scope.$global = $global, scope.d = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
189
189
|
scope,
|
190
190
|
prevScope
|
191
191
|
));
|
192
192
|
let parentBranchId = parentBranchIds.get(scopeId);
|
193
193
|
if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
194
194
|
let branch = scope, parentBranch = branch.c;
|
195
|
-
scope.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.
|
195
|
+
scope.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch));
|
196
196
|
}
|
197
197
|
}
|
198
|
-
} else i === len || typeof resumes[i] != "string" ? delete this.
|
198
|
+
} else i === len || typeof resumes[i] != "string" ? delete this.G[this.t] : registeredValues[resumes[i++]](
|
199
199
|
scopeLookup[resumeData],
|
200
200
|
scopeLookup[resumeData]
|
201
201
|
);
|
@@ -631,28 +631,28 @@ function toInsertNode(startNode, endNode) {
|
|
631
631
|
var pendingScopes = [];
|
632
632
|
function createScope($global, closestBranch) {
|
633
633
|
let scope = {
|
634
|
-
|
635
|
-
|
634
|
+
d: $global.g++,
|
635
|
+
h: 1,
|
636
636
|
c: closestBranch,
|
637
637
|
$global
|
638
638
|
};
|
639
639
|
return pendingScopes.push(scope), scope;
|
640
640
|
}
|
641
641
|
function skipScope(scope) {
|
642
|
-
return scope.$global.
|
642
|
+
return scope.$global.g++;
|
643
643
|
}
|
644
644
|
function finishPendingScopes() {
|
645
645
|
for (let scope of pendingScopes)
|
646
|
-
scope.
|
646
|
+
scope.h = 0;
|
647
647
|
pendingScopes = [];
|
648
648
|
}
|
649
649
|
function destroyBranch(branch) {
|
650
|
-
branch.y?.
|
650
|
+
branch.y?.n?.delete(branch), destroyNestedBranches(branch);
|
651
651
|
}
|
652
652
|
function destroyNestedBranches(branch) {
|
653
|
-
branch.z = 1, branch.
|
654
|
-
for (let id in scope.
|
655
|
-
scope.
|
653
|
+
branch.z = 1, branch.n?.forEach(destroyNestedBranches), branch.I?.forEach((scope) => {
|
654
|
+
for (let id in scope.k)
|
655
|
+
scope.k[id]?.abort();
|
656
656
|
});
|
657
657
|
}
|
658
658
|
function removeAndDestroyBranch(branch) {
|
@@ -669,20 +669,20 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
669
669
|
|
670
670
|
// src/dom/queue.ts
|
671
671
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = !1, scopeKeyOffset = 1e3;
|
672
|
-
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.
|
672
|
+
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.d) {
|
673
673
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
674
674
|
if (existingRender)
|
675
675
|
existingRender.A = value2;
|
676
676
|
else {
|
677
677
|
let render = {
|
678
|
-
|
678
|
+
j: key,
|
679
679
|
B: scope,
|
680
|
-
|
680
|
+
J: signal,
|
681
681
|
A: value2
|
682
682
|
}, i = pendingRenders.push(render) - 1;
|
683
683
|
for (; i; ) {
|
684
684
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
685
|
-
if (key - parent.
|
685
|
+
if (key - parent.j >= 0) break;
|
686
686
|
pendingRenders[i] = parent, i = parentIndex;
|
687
687
|
}
|
688
688
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
@@ -721,27 +721,27 @@ function runRenders() {
|
|
721
721
|
for (; pendingRenders.length; ) {
|
722
722
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
723
723
|
if (render !== item) {
|
724
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
724
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).j;
|
725
725
|
for (; i < mid; ) {
|
726
726
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
727
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
727
|
+
if (right < pendingRenders.length && pendingRenders[right].j - pendingRenders[bestChild].j < 0 && (bestChild = right), pendingRenders[bestChild].j - key >= 0)
|
728
728
|
break;
|
729
729
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
730
730
|
}
|
731
731
|
pendingRenders[i] = item;
|
732
732
|
}
|
733
|
-
render.B.c?.z || render.
|
733
|
+
render.B.c?.z || render.J(render.B, render.A);
|
734
734
|
}
|
735
735
|
finishPendingScopes();
|
736
736
|
}
|
737
737
|
|
738
738
|
// src/dom/abort-signal.ts
|
739
739
|
function resetAbortSignal(scope, id) {
|
740
|
-
let ctrl = scope.
|
741
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
740
|
+
let ctrl = scope.k?.[id];
|
741
|
+
ctrl && (queueEffect(ctrl, abort), scope.k[id] = void 0);
|
742
742
|
}
|
743
743
|
function getAbortSignal(scope, id) {
|
744
|
-
return scope.c && (scope.c.
|
744
|
+
return scope.c && (scope.c.I ||= /* @__PURE__ */ new Set()).add(scope), ((scope.k ||= {})[id] ||= new AbortController()).signal;
|
745
745
|
}
|
746
746
|
function abort(ctrl) {
|
747
747
|
ctrl.abort();
|
@@ -867,14 +867,29 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
867
867
|
// src/dom/renderer.ts
|
868
868
|
function createBranch($global, renderer, parentScope, parentNode) {
|
869
869
|
let branch = createScope($global), parentBranch = parentScope?.c;
|
870
|
-
return branch._ = renderer.
|
870
|
+
return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch)), renderer.o?.(
|
871
871
|
branch,
|
872
872
|
parentNode.namespaceURI
|
873
873
|
), branch;
|
874
874
|
}
|
875
|
-
function
|
876
|
-
|
877
|
-
|
875
|
+
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
876
|
+
return setupBranch(
|
877
|
+
renderer,
|
878
|
+
createBranch($global, renderer, parentScope, parentNode)
|
879
|
+
);
|
880
|
+
}
|
881
|
+
function setupBranch(renderer, branch) {
|
882
|
+
return (renderer.p || renderer.C) && queueRender(
|
883
|
+
branch,
|
884
|
+
(branch2) => {
|
885
|
+
renderer.p?.(branch2), renderer.C?.(branch2);
|
886
|
+
},
|
887
|
+
-1
|
888
|
+
), branch;
|
889
|
+
}
|
890
|
+
function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
891
|
+
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures ||= void 0;
|
892
|
+
let clone = template ? (branch, ns) => {
|
878
893
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
879
894
|
template,
|
880
895
|
ns
|
@@ -887,24 +902,31 @@ function createContent(id, template, walks, setup, getArgs, dynamicScopesAccesso
|
|
887
902
|
);
|
888
903
|
};
|
889
904
|
return (owner) => ({
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
}
|
905
|
+
d: id,
|
906
|
+
o: clone,
|
907
|
+
l: owner,
|
908
|
+
p: setup,
|
909
|
+
e: params,
|
910
|
+
C: closures,
|
911
|
+
m: dynamicScopesAccessor
|
898
912
|
});
|
899
913
|
}
|
900
|
-
function registerContent(id, template, walks, setup,
|
914
|
+
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
901
915
|
return register(
|
902
916
|
id,
|
903
|
-
createContent(
|
917
|
+
createContent(
|
918
|
+
id,
|
919
|
+
template,
|
920
|
+
walks,
|
921
|
+
setup,
|
922
|
+
params,
|
923
|
+
closures,
|
924
|
+
dynamicScopesAccessor
|
925
|
+
)
|
904
926
|
);
|
905
927
|
}
|
906
|
-
function createRenderer(template, walks, setup,
|
907
|
-
return createContent("", template, walks, setup,
|
928
|
+
function createRenderer(template, walks, setup, params, closures) {
|
929
|
+
return createContent("", template, walks, setup, params, closures)();
|
908
930
|
}
|
909
931
|
var cloneCache = {};
|
910
932
|
function createCloneableHTML(html2, ns) {
|
@@ -958,10 +980,9 @@ function value(valueAccessor, fn = () => {
|
|
958
980
|
(!(valueAccessor in scope) || scope[valueAccessor] !== value2) && (scope[valueAccessor] = value2, fn(scope, value2));
|
959
981
|
};
|
960
982
|
}
|
961
|
-
|
962
|
-
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "e") {
|
983
|
+
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "d") {
|
963
984
|
return (scope) => {
|
964
|
-
scope.
|
985
|
+
scope.h ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
965
986
|
};
|
966
987
|
}
|
967
988
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
@@ -971,11 +992,11 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
971
992
|
ownerScope,
|
972
993
|
() => {
|
973
994
|
for (let scope of scopes)
|
974
|
-
!scope.
|
995
|
+
!scope.h && !scope.z && childSignal(scope);
|
975
996
|
},
|
976
997
|
-1,
|
977
998
|
0,
|
978
|
-
firstScope.
|
999
|
+
firstScope.d
|
979
1000
|
);
|
980
1001
|
};
|
981
1002
|
return ownerSignal._ = childSignal, ownerSignal;
|
@@ -983,7 +1004,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
983
1004
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
984
1005
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
|
985
1006
|
let ifScope = scope[scopeAccessor];
|
986
|
-
ifScope && !ifScope.
|
1007
|
+
ifScope && !ifScope.h && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
987
1008
|
};
|
988
1009
|
return ownerSignal._ = childSignal, ownerSignal;
|
989
1010
|
}
|
@@ -994,24 +1015,29 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
994
1015
|
() => ownerScope[accessor].delete(scope)
|
995
1016
|
));
|
996
1017
|
}
|
997
|
-
function dynamicClosure(
|
998
|
-
let
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
}, ownerSignal;
|
1018
|
+
function dynamicClosure(...closureSignals) {
|
1019
|
+
let [{ D: ___scopeInstancesAccessor, E: ___signalIndexAccessor }] = closureSignals;
|
1020
|
+
for (let i = closureSignals.length; i--; )
|
1021
|
+
closureSignals[i].K = i;
|
1022
|
+
return (scope) => {
|
1023
|
+
if (scope[___scopeInstancesAccessor])
|
1024
|
+
for (let childScope of scope[___scopeInstancesAccessor])
|
1025
|
+
childScope.h || queueRender(
|
1026
|
+
childScope,
|
1027
|
+
closureSignals[childScope[___signalIndexAccessor]],
|
1028
|
+
-1
|
1029
|
+
);
|
1030
|
+
};
|
1011
1031
|
}
|
1012
|
-
function
|
1013
|
-
let
|
1014
|
-
|
1032
|
+
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1033
|
+
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
1034
|
+
scope[closureSignal.E] = closureSignal.K, childSignal(scope), subscribeToScopeSet(
|
1035
|
+
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1036
|
+
closureSignal.D,
|
1037
|
+
scope
|
1038
|
+
);
|
1039
|
+
};
|
1040
|
+
return closureSignal.D = valueAccessor + "!" /* ClosureScopes */, closureSignal.E = valueAccessor + "(" /* ClosureSignalIndex */, closureSignal;
|
1015
1041
|
}
|
1016
1042
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1017
1043
|
return (scope) => {
|
@@ -1068,7 +1094,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1068
1094
|
let childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */, rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1069
1095
|
return (scope, newRenderer, getInput) => {
|
1070
1096
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1071
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.
|
1097
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.d || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
|
1072
1098
|
if (setConditionalRenderer(
|
1073
1099
|
scope,
|
1074
1100
|
nodeAccessor,
|
@@ -1082,15 +1108,15 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1082
1108
|
0,
|
1083
1109
|
content,
|
1084
1110
|
createAndSetupBranch
|
1085
|
-
), content.
|
1111
|
+
), content.m && subscribeToScopeSet(
|
1112
|
+
content.l,
|
1086
1113
|
content.m,
|
1087
|
-
content.n,
|
1088
1114
|
scope[childScopeAccessor][0 + "!" /* ConditionalScope */]
|
1089
1115
|
);
|
1090
1116
|
}
|
1091
|
-
} else normalizedRenderer?.
|
1117
|
+
} else normalizedRenderer?.m && subscribeToScopeSet(
|
1118
|
+
normalizedRenderer.l,
|
1092
1119
|
normalizedRenderer.m,
|
1093
|
-
normalizedRenderer.n,
|
1094
1120
|
scope[childScopeAccessor]
|
1095
1121
|
);
|
1096
1122
|
if (normalizedRenderer) {
|
@@ -1101,9 +1127,9 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1101
1127
|
0,
|
1102
1128
|
(inputIsArgs ? args[0] : args) || {}
|
1103
1129
|
);
|
1104
|
-
else if (normalizedRenderer.
|
1130
|
+
else if (normalizedRenderer.e)
|
1105
1131
|
if (inputIsArgs)
|
1106
|
-
normalizedRenderer.
|
1132
|
+
normalizedRenderer.e(
|
1107
1133
|
scope[childScopeAccessor],
|
1108
1134
|
normalizedRenderer._ ? args[0] : args
|
1109
1135
|
);
|
@@ -1112,7 +1138,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1112
1138
|
...args,
|
1113
1139
|
content: getContent(scope)
|
1114
1140
|
} : args || {};
|
1115
|
-
normalizedRenderer.
|
1141
|
+
normalizedRenderer.e(
|
1116
1142
|
scope[childScopeAccessor],
|
1117
1143
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1118
1144
|
);
|
@@ -1151,7 +1177,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1151
1177
|
);
|
1152
1178
|
}
|
1153
1179
|
function loop(nodeAccessor, renderer, forEach) {
|
1154
|
-
let params = renderer.
|
1180
|
+
let params = renderer.e;
|
1155
1181
|
return (scope, value2) => {
|
1156
1182
|
let referenceNode = scope[nodeAccessor], oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */], oldArray = oldMap ? scope[nodeAccessor + "!" /* LoopScopeArray */] || [
|
1157
1183
|
...oldMap.values()
|
@@ -1164,10 +1190,6 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1164
1190
|
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);
|
1165
1191
|
};
|
1166
1192
|
}
|
1167
|
-
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
1168
|
-
let branch = createBranch($global, renderer, parentScope, parentNode);
|
1169
|
-
return renderer.d && queueRender(branch, renderer.d, -1), branch;
|
1170
|
-
}
|
1171
1193
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
1172
1194
|
let branch = createBranch(
|
1173
1195
|
$global,
|
@@ -1178,7 +1200,7 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
1178
1200
|
return typeof tagNameOrRenderer == "string" ? branch[0] = branch.a = branch.b = document.createElementNS(
|
1179
1201
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1180
1202
|
tagNameOrRenderer
|
1181
|
-
) :
|
1203
|
+
) : setupBranch(tagNameOrRenderer, branch), branch;
|
1182
1204
|
}
|
1183
1205
|
function bySecondArg(_item, index) {
|
1184
1206
|
return index;
|
@@ -1200,7 +1222,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1200
1222
|
register(RENDERER_REGISTER_ID, fn);
|
1201
1223
|
},
|
1202
1224
|
isRenderer(renderer) {
|
1203
|
-
return renderer.
|
1225
|
+
return renderer.o;
|
1204
1226
|
},
|
1205
1227
|
getStartNode(branch) {
|
1206
1228
|
return branch.a;
|
@@ -1223,9 +1245,9 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1223
1245
|
value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
|
1224
1246
|
) : value2;
|
1225
1247
|
},
|
1226
|
-
createRenderer(
|
1227
|
-
let renderer = createRenderer(0, 0, 0,
|
1228
|
-
return renderer.
|
1248
|
+
createRenderer(params, clone) {
|
1249
|
+
let renderer = createRenderer(0, 0, 0, params);
|
1250
|
+
return renderer.o = (branch) => {
|
1229
1251
|
let cloned = clone();
|
1230
1252
|
branch.a = cloned.startNode, branch.b = cloned.endNode;
|
1231
1253
|
}, renderer;
|
@@ -1240,12 +1262,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1240
1262
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1241
1263
|
}
|
1242
1264
|
if (component.effects = prepareEffects(() => {
|
1243
|
-
branch ? existing = !0 : (out.global.
|
1265
|
+
branch ? existing = !0 : (out.global.g ||= 0, branch = component.scope = createAndSetupBranch(
|
1244
1266
|
out.global,
|
1245
1267
|
renderer,
|
1246
|
-
renderer.
|
1268
|
+
renderer.l,
|
1247
1269
|
document.body
|
1248
|
-
)
|
1270
|
+
)), renderer.e?.(branch, renderer._ ? args[0] : args);
|
1249
1271
|
}), !existing)
|
1250
1272
|
return toInsertNode(branch.a, branch.b);
|
1251
1273
|
}
|
@@ -1258,19 +1280,19 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1258
1280
|
template,
|
1259
1281
|
walks,
|
1260
1282
|
setup,
|
1261
|
-
inputSignal
|
1283
|
+
inputSignal
|
1262
1284
|
)();
|
1263
1285
|
return renderer.mount = mount, renderer._ = renderer, register(id, renderer);
|
1264
1286
|
};
|
1265
1287
|
function mount(input = {}, reference, position) {
|
1266
1288
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1267
1289
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1268
|
-
|
1290
|
+
g: 0,
|
1269
1291
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1270
1292
|
renderId: DEFAULT_RENDER_ID,
|
1271
1293
|
...$global
|
1272
1294
|
}) : $global = {
|
1273
|
-
|
1295
|
+
g: 0,
|
1274
1296
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1275
1297
|
renderId: DEFAULT_RENDER_ID
|
1276
1298
|
}, position) {
|
@@ -1284,13 +1306,13 @@ function mount(input = {}, reference, position) {
|
|
1284
1306
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
1285
1307
|
break;
|
1286
1308
|
}
|
1287
|
-
let args = this.
|
1309
|
+
let args = this.e, effects = prepareEffects(() => {
|
1288
1310
|
branch = createBranch(
|
1289
1311
|
$global,
|
1290
1312
|
this,
|
1291
1313
|
void 0,
|
1292
1314
|
parentNode
|
1293
|
-
), this.
|
1315
|
+
), this.p?.(branch), args?.(branch, input);
|
1294
1316
|
});
|
1295
1317
|
return insertChildNodes(
|
1296
1318
|
parentNode,
|
@@ -1337,6 +1359,7 @@ export {
|
|
1337
1359
|
createTemplate,
|
1338
1360
|
data,
|
1339
1361
|
dynamicClosure,
|
1362
|
+
dynamicClosureRead,
|
1340
1363
|
dynamicTag,
|
1341
1364
|
effect,
|
1342
1365
|
forIn,
|
@@ -1360,7 +1383,6 @@ export {
|
|
1360
1383
|
register,
|
1361
1384
|
registerBoundSignal,
|
1362
1385
|
registerContent,
|
1363
|
-
registerDynamicClosure,
|
1364
1386
|
resetAbortSignal,
|
1365
1387
|
run,
|
1366
1388
|
setTagVar,
|