marko 6.0.9 → 6.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/debug/dom.js +97 -84
- package/dist/debug/dom.mjs +97 -84
- package/dist/debug/html.js +98 -70
- package/dist/debug/html.mjs +98 -70
- package/dist/dom/resume.d.ts +0 -1
- package/dist/dom.js +95 -104
- package/dist/dom.mjs +95 -104
- package/dist/html/writer.d.ts +8 -8
- package/dist/html.js +64 -28
- package/dist/html.mjs +64 -28
- package/dist/translator/index.js +41 -62
- package/dist/translator/util/is-only-child-in-parent.d.ts +2 -2
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -2
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -120,50 +120,56 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
120
120
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
121
121
|
defineRuntime({
|
122
122
|
value: resumeRender = (renderId) => {
|
123
|
-
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length,
|
123
|
+
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, scopeLookup = render.s = {}, serializeContext = {
|
124
124
|
_: registeredValues
|
125
|
-
},
|
126
|
-
let
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
}, branches = branchesEnabled && /* @__PURE__ */ (() => {
|
126
|
+
let branchStack = [], branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), lastEndNode, currentBranchId, endBranch = (branchId, reference) => {
|
127
|
+
let branch = scopeLookup[branchId] ||= {}, endNode = reference, prevNode;
|
128
|
+
for (; (prevNode = endNode.previousSibling) !== branch.h && ~visits.indexOf(endNode = prevNode); ) ;
|
129
|
+
return branch.j = lastEndNode = endNode === lastEndNode ? reference.parentNode.insertBefore(new Text(), reference) : endNode, branch.h ||= lastEndNode, branchIds.add(branchId), branch;
|
130
|
+
};
|
131
|
+
return {
|
132
|
+
J() {
|
133
|
+
if (visitToken === "[" /* BranchStart */)
|
134
|
+
currentBranchId && visitDataIndex && (endBranch(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, visitScope.h = visit;
|
135
|
+
else if (visitToken === "]" /* BranchEnd */) {
|
136
|
+
let curParent = visit.parentNode, startNode = endBranch(
|
137
|
+
currentBranchId,
|
138
|
+
visit
|
139
|
+
).h;
|
140
|
+
visitScope[visitData] = visit, curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
|
141
|
+
} else {
|
142
|
+
let next = visitData.indexOf(" "), curNode = visit;
|
143
|
+
for (visitScope[~next ? visitData.slice(0, next) : visitData] = visitToken === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
144
|
+
let start = next + 1;
|
145
|
+
next = visitData.indexOf(" ", start);
|
146
|
+
let childScopeId = +visitData.slice(
|
147
|
+
start,
|
148
|
+
~next ? next : visitData.length
|
149
|
+
);
|
150
|
+
curNode = endBranch(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
o(scope) {
|
155
|
+
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
156
|
+
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
157
|
+
let branch = scope, parentBranch = branch.k;
|
158
|
+
scope.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch));
|
159
|
+
}
|
160
|
+
}
|
161
|
+
};
|
162
|
+
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText, visitData, visitDataIndex, visitToken, visitScope;
|
130
163
|
return render.w = () => {
|
131
164
|
try {
|
132
165
|
walk2(), isResuming = 1;
|
133
|
-
for (
|
134
|
-
|
166
|
+
for (visit of visits = render.v)
|
167
|
+
visitText = visit.data, visitDataIndex = visitText.indexOf(" ") + 1, scopeId = +visitText.slice(
|
135
168
|
commentPrefixLen + 1,
|
136
|
-
|
137
|
-
),
|
169
|
+
visitDataIndex ? visitDataIndex - 1 : visitText.length
|
170
|
+
), visitData = visitDataIndex ? visitText.slice(visitDataIndex) : "", visitToken = visitText[commentPrefixLen], visitScope = scopeLookup[scopeId] ||= {
|
138
171
|
m: scopeId
|
139
|
-
},
|
140
|
-
if (token === "*" /* Node */) {
|
141
|
-
let node = scope[data2] = visit.previousSibling;
|
142
|
-
scope["j" /* Getter */ + data2] = () => node;
|
143
|
-
} else if (branchesEnabled) {
|
144
|
-
if (token === "[" /* BranchStart */)
|
145
|
-
currentBranchId && dataIndex && (branchEnd(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, scope.h = visit;
|
146
|
-
else if (token === "]" /* BranchEnd */) {
|
147
|
-
scope[data2] = visit;
|
148
|
-
let curParent = visit.parentNode, startNode = branchEnd(
|
149
|
-
currentBranchId,
|
150
|
-
visit
|
151
|
-
).h;
|
152
|
-
curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
|
153
|
-
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
154
|
-
let next = data2.indexOf(" "), curNode = visit;
|
155
|
-
for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
156
|
-
let start = next + 1;
|
157
|
-
next = data2.indexOf(" ", start);
|
158
|
-
let childScopeId = +data2.slice(
|
159
|
-
start,
|
160
|
-
~next ? next : data2.length
|
161
|
-
);
|
162
|
-
curNode = branchEnd(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
|
163
|
-
}
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}
|
172
|
+
}, visitToken === "*" /* Node */ ? visitScope["j" /* Getter */ + visitData] = /* @__PURE__ */ ((node) => () => node)(visitScope[visitData] = visit.previousSibling) : branches && branches.J();
|
167
173
|
for (let serialized of resumes = render.r || [])
|
168
174
|
if (typeof serialized == "string")
|
169
175
|
lastEffect = serialized;
|
@@ -174,25 +180,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
174
180
|
);
|
175
181
|
else
|
176
182
|
for (let scope of serialized(serializeContext))
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
else {
|
182
|
-
let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
|
183
|
-
if (scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
184
|
-
scope,
|
185
|
-
prevScope
|
186
|
-
)), branchesEnabled) {
|
187
|
-
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
188
|
-
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
189
|
-
let branch = scope, parentBranch = branch.k;
|
190
|
-
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
191
|
-
branch
|
192
|
-
));
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
183
|
+
$global ? typeof scope == "number" ? lastScopeId += scope : (scopeId = ++lastScopeId, scope.$global = $global, scope.m = scopeId, scopeLookup[scopeId] !== scope && (scopeLookup[scopeId] = Object.assign(
|
184
|
+
scope,
|
185
|
+
scopeLookup[scopeId]
|
186
|
+
)), branches && branches.o(scope)) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.p = 1e6);
|
196
187
|
} finally {
|
197
188
|
isResuming = visits.length = resumes.length = 0;
|
198
189
|
}
|
@@ -625,29 +616,29 @@ function toInsertNode(startNode, endNode) {
|
|
625
616
|
// src/dom/scope.ts
|
626
617
|
function createScope($global, closestBranch) {
|
627
618
|
let scope = {
|
628
|
-
m: $global.
|
629
|
-
|
619
|
+
m: $global.p++,
|
620
|
+
q: 1,
|
630
621
|
k: closestBranch,
|
631
622
|
$global
|
632
623
|
};
|
633
624
|
return pendingScopes.push(scope), scope;
|
634
625
|
}
|
635
626
|
function skipScope(scope) {
|
636
|
-
return scope.$global.
|
627
|
+
return scope.$global.p++;
|
637
628
|
}
|
638
629
|
function findBranchWithKey(scope, key) {
|
639
630
|
let branch = scope.k;
|
640
631
|
for (; branch && !branch[key]; )
|
641
|
-
branch = branch.
|
632
|
+
branch = branch.u;
|
642
633
|
return branch;
|
643
634
|
}
|
644
635
|
function destroyBranch(branch) {
|
645
|
-
branch.
|
636
|
+
branch.u?.A?.delete(branch), destroyNestedBranches(branch);
|
646
637
|
}
|
647
638
|
function destroyNestedBranches(branch) {
|
648
|
-
branch.
|
649
|
-
for (let id in scope.
|
650
|
-
scope.
|
639
|
+
branch.B = 1, branch.A?.forEach(destroyNestedBranches), branch.K?.forEach((scope) => {
|
640
|
+
for (let id in scope.x)
|
641
|
+
scope.x[id]?.abort();
|
651
642
|
});
|
652
643
|
}
|
653
644
|
function removeAndDestroyBranch(branch) {
|
@@ -783,7 +774,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
783
774
|
// src/dom/renderer.ts
|
784
775
|
function createBranch($global, renderer, parentScope, parentNode) {
|
785
776
|
let branch = createScope($global), parentBranch = parentScope?.k;
|
786
|
-
return branch._ = renderer.
|
777
|
+
return branch._ = renderer.y || parentScope, branch.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch)), renderer.C?.(
|
787
778
|
branch,
|
788
779
|
parentNode.namespaceURI
|
789
780
|
), branch;
|
@@ -795,10 +786,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
795
786
|
);
|
796
787
|
}
|
797
788
|
function setupBranch(renderer, branch) {
|
798
|
-
return (renderer.
|
789
|
+
return (renderer.D || renderer.E) && queueRender(
|
799
790
|
branch,
|
800
791
|
(branch2) => {
|
801
|
-
renderer.
|
792
|
+
renderer.D?.(branch2), renderer.E?.(branch2);
|
802
793
|
},
|
803
794
|
-1
|
804
795
|
), branch;
|
@@ -819,12 +810,12 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
819
810
|
};
|
820
811
|
return (owner) => ({
|
821
812
|
m: id,
|
822
|
-
|
823
|
-
|
824
|
-
|
813
|
+
C: clone,
|
814
|
+
y: owner,
|
815
|
+
D: setup,
|
825
816
|
l: params,
|
826
817
|
E: closures,
|
827
|
-
|
818
|
+
z: dynamicScopesAccessor
|
828
819
|
});
|
829
820
|
}
|
830
821
|
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
@@ -895,7 +886,7 @@ function value(valueAccessor, fn = () => {
|
|
895
886
|
}
|
896
887
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "m") {
|
897
888
|
return (scope) => {
|
898
|
-
scope.
|
889
|
+
scope.q ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
899
890
|
};
|
900
891
|
}
|
901
892
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
@@ -905,7 +896,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
905
896
|
ownerScope,
|
906
897
|
() => {
|
907
898
|
for (let scope of scopes)
|
908
|
-
!scope.
|
899
|
+
!scope.q && !scope.B && childSignal(scope);
|
909
900
|
},
|
910
901
|
-1,
|
911
902
|
0,
|
@@ -917,7 +908,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
917
908
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
918
909
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
919
910
|
let ifScope = scope[scopeAccessor];
|
920
|
-
ifScope && !ifScope.
|
911
|
+
ifScope && !ifScope.q && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
921
912
|
};
|
922
913
|
return ownerSignal._ = childSignal, ownerSignal;
|
923
914
|
}
|
@@ -931,11 +922,11 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
931
922
|
function dynamicClosure(...closureSignals) {
|
932
923
|
let [{ F: ___scopeInstancesAccessor, G: ___signalIndexAccessor }] = closureSignals;
|
933
924
|
for (let i = closureSignals.length; i--; )
|
934
|
-
closureSignals[i].
|
925
|
+
closureSignals[i].L = i;
|
935
926
|
return (scope) => {
|
936
927
|
if (scope[___scopeInstancesAccessor])
|
937
928
|
for (let childScope of scope[___scopeInstancesAccessor])
|
938
|
-
childScope.
|
929
|
+
childScope.q || queueRender(
|
939
930
|
childScope,
|
940
931
|
closureSignals[childScope[___signalIndexAccessor]],
|
941
932
|
-1
|
@@ -944,7 +935,7 @@ function dynamicClosure(...closureSignals) {
|
|
944
935
|
}
|
945
936
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
946
937
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
947
|
-
scope[closureSignal.G] = closureSignal.
|
938
|
+
scope[closureSignal.G] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
|
948
939
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
949
940
|
closureSignal.F,
|
950
941
|
scope
|
@@ -1120,15 +1111,15 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1120
1111
|
0,
|
1121
1112
|
content,
|
1122
1113
|
createAndSetupBranch
|
1123
|
-
), content.
|
1124
|
-
content.x,
|
1114
|
+
), content.z && subscribeToScopeSet(
|
1125
1115
|
content.y,
|
1116
|
+
content.z,
|
1126
1117
|
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
1127
1118
|
);
|
1128
1119
|
}
|
1129
|
-
} else normalizedRenderer?.
|
1130
|
-
normalizedRenderer.x,
|
1120
|
+
} else normalizedRenderer?.z && subscribeToScopeSet(
|
1131
1121
|
normalizedRenderer.y,
|
1122
|
+
normalizedRenderer.z,
|
1132
1123
|
scope[childScopeAccessor]
|
1133
1124
|
);
|
1134
1125
|
if (normalizedRenderer) {
|
@@ -1226,14 +1217,14 @@ function queueRender(scope, signal, signalKey, value2, scopeKey = scope.m) {
|
|
1226
1217
|
existingRender.I = value2;
|
1227
1218
|
else {
|
1228
1219
|
let render = {
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1220
|
+
t: key,
|
1221
|
+
o: scope,
|
1222
|
+
M: signal,
|
1232
1223
|
I: value2
|
1233
1224
|
}, i = pendingRenders.push(render) - 1;
|
1234
1225
|
for (; i; ) {
|
1235
1226
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1236
|
-
if (key - parent.
|
1227
|
+
if (key - parent.t >= 0) break;
|
1237
1228
|
pendingRenders[i] = parent, i = parentIndex;
|
1238
1229
|
}
|
1239
1230
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
@@ -1272,54 +1263,54 @@ function runRenders() {
|
|
1272
1263
|
for (; pendingRenders.length; ) {
|
1273
1264
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
1274
1265
|
if (render !== item) {
|
1275
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
1266
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).t;
|
1276
1267
|
for (; i < mid; ) {
|
1277
1268
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1278
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
1269
|
+
if (right < pendingRenders.length && pendingRenders[right].t - pendingRenders[bestChild].t < 0 && (bestChild = right), pendingRenders[bestChild].t - key >= 0)
|
1279
1270
|
break;
|
1280
1271
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1281
1272
|
}
|
1282
1273
|
pendingRenders[i] = item;
|
1283
1274
|
}
|
1284
|
-
render.
|
1275
|
+
render.o.k?.B || runRender(render);
|
1285
1276
|
}
|
1286
1277
|
for (let scope of pendingScopes)
|
1287
|
-
scope.
|
1278
|
+
scope.q = 0;
|
1288
1279
|
pendingScopes = [];
|
1289
1280
|
}
|
1290
|
-
var runRender = (render) => render.
|
1281
|
+
var runRender = (render) => render.M(render.o, render.I), enableCatch = () => {
|
1291
1282
|
enableCatch = () => {
|
1292
1283
|
}, enableBranches();
|
1293
1284
|
let handlePendingTry = (fn, scope, branch) => {
|
1294
1285
|
for (; branch; ) {
|
1295
1286
|
if (branch.n)
|
1296
1287
|
return (branch.H ||= []).push(fn, scope);
|
1297
|
-
branch = branch.
|
1288
|
+
branch = branch.u;
|
1298
1289
|
}
|
1299
1290
|
};
|
1300
1291
|
runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
|
1301
1292
|
if (checkPending || caughtError.has(effects)) {
|
1302
1293
|
let i = 0, fn, scope, branch;
|
1303
1294
|
for (; i < effects.length; )
|
1304
|
-
fn = effects[i++], scope = effects[i++], branch = scope.k, !branch?.
|
1295
|
+
fn = effects[i++], scope = effects[i++], branch = scope.k, !branch?.B && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope, scope);
|
1305
1296
|
} else
|
1306
1297
|
runEffects2(effects);
|
1307
1298
|
})(runEffects), runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
1308
1299
|
try {
|
1309
1300
|
runRender2(render);
|
1310
1301
|
} catch (error) {
|
1311
|
-
renderCatch(render.
|
1302
|
+
renderCatch(render.o, error);
|
1312
1303
|
}
|
1313
1304
|
})(runRender);
|
1314
1305
|
};
|
1315
1306
|
|
1316
1307
|
// src/dom/abort-signal.ts
|
1317
1308
|
function resetAbortSignal(scope, id) {
|
1318
|
-
let ctrl = scope.
|
1319
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1309
|
+
let ctrl = scope.x?.[id];
|
1310
|
+
ctrl && (queueEffect(ctrl, abort), scope.x[id] = void 0);
|
1320
1311
|
}
|
1321
1312
|
function getAbortSignal(scope, id) {
|
1322
|
-
return scope.k && (scope.k.
|
1313
|
+
return scope.k && (scope.k.K ||= /* @__PURE__ */ new Set()).add(scope), ((scope.x ||= {})[id] ||= new AbortController()).signal;
|
1323
1314
|
}
|
1324
1315
|
function abort(ctrl) {
|
1325
1316
|
ctrl.abort();
|
@@ -1341,7 +1332,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1341
1332
|
register(RENDERER_REGISTER_ID, fn);
|
1342
1333
|
},
|
1343
1334
|
isRenderer(renderer) {
|
1344
|
-
return renderer.
|
1335
|
+
return renderer.C;
|
1345
1336
|
},
|
1346
1337
|
getStartNode(branch) {
|
1347
1338
|
return branch.h;
|
@@ -1366,7 +1357,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1366
1357
|
},
|
1367
1358
|
createRenderer(params, clone) {
|
1368
1359
|
let renderer = createRenderer(0, 0, 0, params);
|
1369
|
-
return renderer.
|
1360
|
+
return renderer.C = (branch) => {
|
1370
1361
|
let cloned = clone();
|
1371
1362
|
branch.h = cloned.startNode, branch.j = cloned.endNode;
|
1372
1363
|
}, renderer;
|
@@ -1381,10 +1372,10 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1381
1372
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1382
1373
|
}
|
1383
1374
|
if (component.effects = prepareEffects(() => {
|
1384
|
-
branch ? existing = 1 : (out.global.
|
1375
|
+
branch ? existing = 1 : (out.global.p ||= 0, branch = component.scope = createAndSetupBranch(
|
1385
1376
|
out.global,
|
1386
1377
|
renderer,
|
1387
|
-
renderer.
|
1378
|
+
renderer.y,
|
1388
1379
|
document.body
|
1389
1380
|
)), renderer.l?.(branch, renderer._ ? args[0] : args);
|
1390
1381
|
}), !existing)
|
@@ -1406,12 +1397,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1406
1397
|
function mount(input = {}, reference, position) {
|
1407
1398
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1408
1399
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1409
|
-
|
1400
|
+
p: 0,
|
1410
1401
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1411
1402
|
renderId: DEFAULT_RENDER_ID,
|
1412
1403
|
...$global
|
1413
1404
|
}) : $global = {
|
1414
|
-
|
1405
|
+
p: 0,
|
1415
1406
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1416
1407
|
renderId: DEFAULT_RENDER_ID
|
1417
1408
|
}, position) {
|
@@ -1431,7 +1422,7 @@ function mount(input = {}, reference, position) {
|
|
1431
1422
|
this,
|
1432
1423
|
void 0,
|
1433
1424
|
parentNode
|
1434
|
-
), this.
|
1425
|
+
), this.D?.(branch), args?.(branch, input);
|
1435
1426
|
});
|
1436
1427
|
return insertChildNodes(
|
1437
1428
|
parentNode,
|
package/dist/html/writer.d.ts
CHANGED
@@ -35,14 +35,14 @@ export declare function hoist(scopeId: number, id?: string): {
|
|
35
35
|
};
|
36
36
|
export declare function resumeClosestBranch(scopeId: number): void;
|
37
37
|
export declare function withBranchId<T>(branchId: number, cb: () => T): T;
|
38
|
-
export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
|
39
|
-
export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1,
|
40
|
-
export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
|
41
|
-
export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1,
|
42
|
-
export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
|
43
|
-
export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1,
|
44
|
-
export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
|
45
|
-
export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1,
|
38
|
+
export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
39
|
+
export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
40
|
+
export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
41
|
+
export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
42
|
+
export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
43
|
+
export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
44
|
+
export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
45
|
+
export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
|
46
46
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
47
47
|
export { writeScope };
|
48
48
|
export declare function writeExistingScope(scopeId: number): ScopeInternals;
|
package/dist/html.js
CHANGED
@@ -1172,7 +1172,7 @@ var branchIdKey = Symbol();
|
|
1172
1172
|
function withBranchId(branchId, cb) {
|
1173
1173
|
return withContext(branchIdKey, branchId, cb);
|
1174
1174
|
}
|
1175
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1175
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1176
1176
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1177
1177
|
if (resumeBranch) {
|
1178
1178
|
let loopScopes = /* @__PURE__ */ new Map();
|
@@ -1191,14 +1191,18 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
|
|
1191
1191
|
});
|
1192
1192
|
} else
|
1193
1193
|
forOf(list, cb);
|
1194
|
-
|
1195
|
-
|
1194
|
+
writeBranchEnd(
|
1195
|
+
scopeId,
|
1196
|
+
accessor,
|
1197
|
+
resumeMarker,
|
1198
|
+
parentEndTag,
|
1199
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1196
1200
|
"]" /* BranchEnd */,
|
1197
1201
|
scopeId + " " + accessor
|
1198
1202
|
)
|
1199
1203
|
);
|
1200
1204
|
}
|
1201
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker,
|
1205
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1202
1206
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1203
1207
|
if (resumeBranch) {
|
1204
1208
|
let loopScopes = /* @__PURE__ */ new Map();
|
@@ -1212,14 +1216,18 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
|
|
1212
1216
|
});
|
1213
1217
|
} else
|
1214
1218
|
forOf(list, cb);
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1219
|
+
writeBranchEnd(
|
1220
|
+
scopeId,
|
1221
|
+
accessor,
|
1222
|
+
resumeMarker,
|
1223
|
+
parentEndTag,
|
1224
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1225
|
+
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1218
1226
|
scopeId + " " + accessor + branchIds
|
1219
1227
|
)
|
1220
1228
|
);
|
1221
1229
|
}
|
1222
|
-
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1230
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1223
1231
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1224
1232
|
if (resumeBranch) {
|
1225
1233
|
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
@@ -1235,14 +1243,18 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
|
|
1235
1243
|
});
|
1236
1244
|
} else
|
1237
1245
|
forIn(obj, cb);
|
1238
|
-
|
1239
|
-
|
1246
|
+
writeBranchEnd(
|
1247
|
+
scopeId,
|
1248
|
+
accessor,
|
1249
|
+
resumeMarker,
|
1250
|
+
parentEndTag,
|
1251
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1240
1252
|
"]" /* BranchEnd */,
|
1241
1253
|
scopeId + " " + accessor
|
1242
1254
|
)
|
1243
1255
|
);
|
1244
1256
|
}
|
1245
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker,
|
1257
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1246
1258
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1247
1259
|
if (resumeBranch) {
|
1248
1260
|
let loopScopes = /* @__PURE__ */ new Map();
|
@@ -1256,14 +1268,18 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
|
|
1256
1268
|
});
|
1257
1269
|
} else
|
1258
1270
|
forIn(obj, cb);
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1271
|
+
writeBranchEnd(
|
1272
|
+
scopeId,
|
1273
|
+
accessor,
|
1274
|
+
resumeMarker,
|
1275
|
+
parentEndTag,
|
1276
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1277
|
+
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1262
1278
|
scopeId + " " + accessor + branchIds
|
1263
1279
|
)
|
1264
1280
|
);
|
1265
1281
|
}
|
1266
|
-
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1282
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1267
1283
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1268
1284
|
if (resumeBranch) {
|
1269
1285
|
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
@@ -1279,14 +1295,18 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
|
1279
1295
|
});
|
1280
1296
|
} else
|
1281
1297
|
forTo(to, from, step, cb);
|
1282
|
-
|
1283
|
-
|
1298
|
+
writeBranchEnd(
|
1299
|
+
scopeId,
|
1300
|
+
accessor,
|
1301
|
+
resumeMarker,
|
1302
|
+
parentEndTag,
|
1303
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1284
1304
|
"]" /* BranchEnd */,
|
1285
1305
|
scopeId + " " + accessor
|
1286
1306
|
)
|
1287
1307
|
);
|
1288
1308
|
}
|
1289
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker,
|
1309
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1290
1310
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1291
1311
|
if (resumeBranch) {
|
1292
1312
|
let loopScopes = /* @__PURE__ */ new Map();
|
@@ -1300,14 +1320,18 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
|
|
1300
1320
|
});
|
1301
1321
|
} else
|
1302
1322
|
forTo(to, from, step, cb);
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1323
|
+
writeBranchEnd(
|
1324
|
+
scopeId,
|
1325
|
+
accessor,
|
1326
|
+
resumeMarker,
|
1327
|
+
parentEndTag,
|
1328
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1329
|
+
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1306
1330
|
scopeId + " " + accessor + branchIds
|
1307
1331
|
)
|
1308
1332
|
);
|
1309
1333
|
}
|
1310
|
-
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
|
1334
|
+
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1311
1335
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
|
1312
1336
|
resumeMarker && resumeBranch && $chunk.writeHTML(
|
1313
1337
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
@@ -1316,25 +1340,37 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
|
|
1316
1340
|
resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
|
1317
1341
|
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1318
1342
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1319
|
-
}),
|
1320
|
-
|
1343
|
+
}), writeBranchEnd(
|
1344
|
+
scopeId,
|
1345
|
+
accessor,
|
1346
|
+
resumeMarker,
|
1347
|
+
parentEndTag,
|
1348
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1321
1349
|
"]" /* BranchEnd */,
|
1322
1350
|
scopeId + " " + accessor
|
1323
1351
|
)
|
1324
1352
|
);
|
1325
1353
|
}
|
1326
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker,
|
1354
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
|
1327
1355
|
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId(), branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1328
1356
|
shouldWriteBranch && writeScope(scopeId, {
|
1329
1357
|
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1330
1358
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1331
|
-
}),
|
1332
|
-
|
1333
|
-
|
1359
|
+
}), writeBranchEnd(
|
1360
|
+
scopeId,
|
1361
|
+
accessor,
|
1362
|
+
resumeMarker,
|
1363
|
+
parentEndTag,
|
1364
|
+
resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
|
1365
|
+
parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1334
1366
|
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1335
1367
|
)
|
1336
1368
|
);
|
1337
1369
|
}
|
1370
|
+
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
1371
|
+
let endTag = parentEndTag || "";
|
1372
|
+
resumeMarker ? mark ? $chunk.writeHTML(mark + endTag) : $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor)) : $chunk.writeHTML(endTag);
|
1373
|
+
}
|
1338
1374
|
var writeScope = (scopeId, partialScope) => {
|
1339
1375
|
let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
|
1340
1376
|
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
|