marko 6.0.0-next.3.70 → 6.0.0-next.3.72
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 +5 -5
- package/dist/debug/dom.js +96 -91
- package/dist/debug/dom.mjs +96 -91
- package/dist/debug/html.js +4 -3
- package/dist/debug/html.mjs +4 -3
- package/dist/dom/control-flow.d.ts +1 -1
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/resume.d.ts +1 -1
- package/dist/dom/schedule.d.ts +0 -1
- package/dist/dom.js +106 -99
- package/dist/dom.mjs +106 -99
- package/dist/html.js +4 -3
- package/dist/html.mjs +4 -3
- package/dist/translator/index.js +63 -72
- package/dist/translator/util/signals.d.ts +0 -1
- package/index.d.ts +22 -14
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -178,13 +178,13 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
178
178
|
}
|
179
179
|
if (resumes)
|
180
180
|
try {
|
181
|
-
render.r = [], isResuming =
|
181
|
+
render.r = [], isResuming = 1;
|
182
182
|
for (let i = 0; i < resumes.length; i++) {
|
183
183
|
let serialized = resumes[i];
|
184
184
|
if (typeof serialized == "function")
|
185
185
|
for (let scope of serialized(serializeContext))
|
186
186
|
if (!$global)
|
187
|
-
$global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.
|
187
|
+
$global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.o = 1e6;
|
188
188
|
else if (typeof scope == "number")
|
189
189
|
lastScopeId += scope;
|
190
190
|
else {
|
@@ -196,7 +196,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
196
196
|
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
197
197
|
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
198
198
|
let branch = scope, parentBranch = branch.k;
|
199
|
-
scope.k = branch, parentBranch && (branch.
|
199
|
+
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
200
200
|
branch
|
201
201
|
));
|
202
202
|
}
|
@@ -208,7 +208,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
208
208
|
);
|
209
209
|
}
|
210
210
|
} finally {
|
211
|
-
isResuming =
|
211
|
+
isResuming = 0;
|
212
212
|
}
|
213
213
|
}, render;
|
214
214
|
}
|
@@ -224,7 +224,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
224
224
|
set: initRuntime
|
225
225
|
});
|
226
226
|
}
|
227
|
-
var isResuming
|
227
|
+
var isResuming;
|
228
228
|
function register(id, obj) {
|
229
229
|
return registeredValues[id] = obj, obj;
|
230
230
|
}
|
@@ -629,34 +629,34 @@ function toInsertNode(startNode, endNode) {
|
|
629
629
|
var pendingScopes = [];
|
630
630
|
function createScope($global, closestBranch) {
|
631
631
|
let scope = {
|
632
|
-
m: $global.
|
633
|
-
|
632
|
+
m: $global.o++,
|
633
|
+
p: 1,
|
634
634
|
k: closestBranch,
|
635
635
|
$global
|
636
636
|
};
|
637
637
|
return pendingScopes.push(scope), scope;
|
638
638
|
}
|
639
639
|
function skipScope(scope) {
|
640
|
-
return scope.$global.
|
640
|
+
return scope.$global.o++;
|
641
641
|
}
|
642
642
|
function finishPendingScopes() {
|
643
643
|
for (let scope of pendingScopes)
|
644
|
-
scope.
|
644
|
+
scope.p = 0;
|
645
645
|
pendingScopes = [];
|
646
646
|
}
|
647
647
|
function findBranchWithKey(scope, key) {
|
648
648
|
let branch = scope.k;
|
649
649
|
for (; branch && !branch[key]; )
|
650
|
-
branch = branch.
|
650
|
+
branch = branch.t;
|
651
651
|
return branch;
|
652
652
|
}
|
653
653
|
function destroyBranch(branch) {
|
654
|
-
branch.
|
654
|
+
branch.t?.z?.delete(branch), destroyNestedBranches(branch);
|
655
655
|
}
|
656
656
|
function destroyNestedBranches(branch) {
|
657
|
-
branch.
|
658
|
-
for (let id in scope.
|
659
|
-
scope.
|
657
|
+
branch.A = 1, branch.z?.forEach(destroyNestedBranches), branch.J?.forEach((scope) => {
|
658
|
+
for (let id in scope.u)
|
659
|
+
scope.u[id]?.abort();
|
660
660
|
});
|
661
661
|
}
|
662
662
|
function removeAndDestroyBranch(branch) {
|
@@ -796,7 +796,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
796
796
|
// src/dom/renderer.ts
|
797
797
|
function createBranch($global, renderer, parentScope, parentNode) {
|
798
798
|
let branch = createScope($global), parentBranch = parentScope?.k;
|
799
|
-
return branch._ = renderer.
|
799
|
+
return branch._ = renderer.x || parentScope, branch.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(branch)), renderer.B?.(
|
800
800
|
branch,
|
801
801
|
parentNode.namespaceURI
|
802
802
|
), branch;
|
@@ -833,11 +833,11 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
833
833
|
return (owner) => ({
|
834
834
|
m: id,
|
835
835
|
B: clone,
|
836
|
-
|
836
|
+
x: owner,
|
837
837
|
C: setup,
|
838
838
|
l: params,
|
839
839
|
E: closures,
|
840
|
-
|
840
|
+
y: dynamicScopesAccessor
|
841
841
|
});
|
842
842
|
}
|
843
843
|
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
@@ -876,11 +876,11 @@ function createCloneableHTML(html2, ns) {
|
|
876
876
|
var port2 = /* @__PURE__ */ (() => {
|
877
877
|
let { port1, port2: port22 } = new MessageChannel();
|
878
878
|
return port1.onmessage = () => {
|
879
|
-
isScheduled =
|
879
|
+
isScheduled = 0, run();
|
880
880
|
}, port22;
|
881
881
|
})(), isScheduled;
|
882
882
|
function schedule() {
|
883
|
-
isScheduled || (isScheduled =
|
883
|
+
isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
|
884
884
|
}
|
885
885
|
function flushAndWaitFrame() {
|
886
886
|
run(), requestAnimationFrame(triggerMacroTask);
|
@@ -911,7 +911,7 @@ function value(valueAccessor, fn = () => {
|
|
911
911
|
}
|
912
912
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "m") {
|
913
913
|
return (scope) => {
|
914
|
-
scope.
|
914
|
+
scope.p ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
915
915
|
};
|
916
916
|
}
|
917
917
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
@@ -921,7 +921,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
921
921
|
ownerScope,
|
922
922
|
() => {
|
923
923
|
for (let scope of scopes)
|
924
|
-
!scope.
|
924
|
+
!scope.p && !scope.A && childSignal(scope);
|
925
925
|
},
|
926
926
|
-1,
|
927
927
|
0,
|
@@ -933,7 +933,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
933
933
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
934
934
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
935
935
|
let ifScope = scope[scopeAccessor];
|
936
|
-
ifScope && !ifScope.
|
936
|
+
ifScope && !ifScope.p && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
937
937
|
};
|
938
938
|
return ownerSignal._ = childSignal, ownerSignal;
|
939
939
|
}
|
@@ -951,7 +951,7 @@ function dynamicClosure(...closureSignals) {
|
|
951
951
|
return (scope) => {
|
952
952
|
if (scope[___scopeInstancesAccessor])
|
953
953
|
for (let childScope of scope[___scopeInstancesAccessor])
|
954
|
-
childScope.
|
954
|
+
childScope.p || queueRender(
|
955
955
|
childScope,
|
956
956
|
closureSignals[childScope[___signalIndexAccessor]],
|
957
957
|
-1
|
@@ -1011,49 +1011,63 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1011
1011
|
let tryWithPlaceholder = findBranchWithKey(
|
1012
1012
|
scope,
|
1013
1013
|
"d" /* PlaceholderContent */
|
1014
|
-
),
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
});
|
1039
|
-
tryWithPlaceholder ? (placeholderShown.add(pendingEffects), tryWithPlaceholder.q || (tryWithPlaceholder.q = 0, requestAnimationFrame(() => {
|
1040
|
-
if (tryWithPlaceholder.q && !tryWithPlaceholder.p) {
|
1041
|
-
let placeholderBranch = tryWithPlaceholder.c = createAndSetupBranch(
|
1042
|
-
scope.$global,
|
1043
|
-
tryWithPlaceholder.d,
|
1044
|
-
tryWithPlaceholder._,
|
1045
|
-
tryWithPlaceholder.h.parentNode
|
1046
|
-
);
|
1047
|
-
insertBranchBefore(
|
1048
|
-
placeholderBranch,
|
1049
|
-
tryWithPlaceholder.h.parentNode,
|
1050
|
-
tryWithPlaceholder.h
|
1051
|
-
), tempDetatchBranch(tryWithPlaceholder);
|
1052
|
-
}
|
1053
|
-
})), tryWithPlaceholder.q++) : awaitBranch && (awaitBranch.h.parentNode.insertBefore(
|
1014
|
+
), referenceNode = scope[nodeAccessor], awaitBranch = scope[branchAccessor];
|
1015
|
+
tryWithPlaceholder ? (placeholderShown.add(pendingEffects), !scope[promiseAccessor] && (tryWithPlaceholder.n = (tryWithPlaceholder.n || 0) + 1) === 1 && requestAnimationFrame(
|
1016
|
+
() => tryWithPlaceholder.n && runEffects(
|
1017
|
+
prepareEffects(
|
1018
|
+
() => queueRender(
|
1019
|
+
tryWithPlaceholder,
|
1020
|
+
() => {
|
1021
|
+
let placeholderBranch = tryWithPlaceholder.c = createAndSetupBranch(
|
1022
|
+
scope.$global,
|
1023
|
+
tryWithPlaceholder.d,
|
1024
|
+
tryWithPlaceholder._,
|
1025
|
+
tryWithPlaceholder.h.parentNode
|
1026
|
+
);
|
1027
|
+
insertBranchBefore(
|
1028
|
+
placeholderBranch,
|
1029
|
+
tryWithPlaceholder.h.parentNode,
|
1030
|
+
tryWithPlaceholder.h
|
1031
|
+
), tempDetatchBranch(tryWithPlaceholder);
|
1032
|
+
},
|
1033
|
+
-1
|
1034
|
+
)
|
1035
|
+
)
|
1036
|
+
)
|
1037
|
+
)) : awaitBranch && (awaitBranch.h.parentNode.insertBefore(
|
1054
1038
|
referenceNode,
|
1055
1039
|
awaitBranch.h
|
1056
1040
|
), tempDetatchBranch(awaitBranch));
|
1041
|
+
let thisPromise = scope[promiseAccessor] = promise.then(
|
1042
|
+
(data2) => {
|
1043
|
+
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, schedule(), queueRender(
|
1044
|
+
scope,
|
1045
|
+
() => {
|
1046
|
+
if ((!awaitBranch || !tryWithPlaceholder) && (insertBranchBefore(
|
1047
|
+
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1048
|
+
scope.$global,
|
1049
|
+
renderer,
|
1050
|
+
scope,
|
1051
|
+
referenceNode.parentNode
|
1052
|
+
),
|
1053
|
+
referenceNode.parentNode,
|
1054
|
+
referenceNode
|
1055
|
+
), referenceNode.remove()), renderer.l?.(awaitBranch, [data2]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.n)) {
|
1056
|
+
let placeholderBranch = tryWithPlaceholder.c;
|
1057
|
+
tryWithPlaceholder.c = 0, placeholderBranch && (insertBranchBefore(
|
1058
|
+
tryWithPlaceholder,
|
1059
|
+
placeholderBranch.h.parentNode,
|
1060
|
+
placeholderBranch.h
|
1061
|
+
), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
|
1062
|
+
}
|
1063
|
+
},
|
1064
|
+
-1
|
1065
|
+
));
|
1066
|
+
},
|
1067
|
+
(error) => {
|
1068
|
+
thisPromise === scope[promiseAccessor] && (tryWithPlaceholder && (tryWithPlaceholder.n = 0), scope[promiseAccessor] = 0, schedule(), queueRender(scope, renderCatch, -1, error));
|
1069
|
+
}
|
1070
|
+
);
|
1057
1071
|
};
|
1058
1072
|
}
|
1059
1073
|
function createTry(nodeAccessor, tryContent) {
|
@@ -1071,11 +1085,11 @@ function createTry(nodeAccessor, tryContent) {
|
|
1071
1085
|
));
|
1072
1086
|
};
|
1073
1087
|
}
|
1074
|
-
function renderCatch(scope, error
|
1088
|
+
function renderCatch(scope, error) {
|
1075
1089
|
let tryWithCatch = findBranchWithKey(scope, "b" /* CatchContent */);
|
1076
1090
|
if (tryWithCatch) {
|
1077
1091
|
let placeholderBranch = tryWithCatch.c;
|
1078
|
-
placeholderBranch && (tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
|
1092
|
+
placeholderBranch && (tryWithCatch.n = 0, tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
|
1079
1093
|
tryWithCatch._,
|
1080
1094
|
tryWithCatch.a,
|
1081
1095
|
tryWithCatch.b,
|
@@ -1084,11 +1098,7 @@ function renderCatch(scope, error, async) {
|
|
1084
1098
|
tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a],
|
1085
1099
|
[error]
|
1086
1100
|
);
|
1087
|
-
} else
|
1088
|
-
setTimeout(() => {
|
1089
|
-
throw error;
|
1090
|
-
});
|
1091
|
-
else
|
1101
|
+
} else
|
1092
1102
|
throw error;
|
1093
1103
|
}
|
1094
1104
|
function conditional(nodeAccessor, ...branches) {
|
@@ -1123,15 +1133,15 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1123
1133
|
0,
|
1124
1134
|
content,
|
1125
1135
|
createAndSetupBranch
|
1126
|
-
), content.
|
1136
|
+
), content.y && subscribeToScopeSet(
|
1137
|
+
content.x,
|
1127
1138
|
content.y,
|
1128
|
-
content.z,
|
1129
1139
|
scope[childScopeAccessor]["d" /* ConditionalScope */ + 0]
|
1130
1140
|
);
|
1131
1141
|
}
|
1132
|
-
} else normalizedRenderer?.
|
1142
|
+
} else normalizedRenderer?.y && subscribeToScopeSet(
|
1143
|
+
normalizedRenderer.x,
|
1133
1144
|
normalizedRenderer.y,
|
1134
|
-
normalizedRenderer.z,
|
1135
1145
|
scope[childScopeAccessor]
|
1136
1146
|
);
|
1137
1147
|
if (normalizedRenderer) {
|
@@ -1149,10 +1159,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1149
1159
|
normalizedRenderer._ ? args[0] : args
|
1150
1160
|
);
|
1151
1161
|
else {
|
1152
|
-
let inputWithContent = getContent ? {
|
1153
|
-
...args,
|
1154
|
-
content: getContent(scope)
|
1155
|
-
} : args || {};
|
1162
|
+
let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
|
1156
1163
|
normalizedRenderer.l(
|
1157
1164
|
scope[childScopeAccessor],
|
1158
1165
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
@@ -1225,21 +1232,21 @@ function byFirstArg(name) {
|
|
1225
1232
|
}
|
1226
1233
|
|
1227
1234
|
// src/dom/queue.ts
|
1228
|
-
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], rendering
|
1235
|
+
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], rendering, scopeKeyOffset = 1e3;
|
1229
1236
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.m) {
|
1230
1237
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1231
1238
|
if (existingRender)
|
1232
1239
|
existingRender.I = value2;
|
1233
1240
|
else {
|
1234
1241
|
let render = {
|
1235
|
-
|
1242
|
+
q: key,
|
1236
1243
|
D: scope,
|
1237
1244
|
L: signal,
|
1238
1245
|
I: value2
|
1239
1246
|
}, i = pendingRenders.push(render) - 1;
|
1240
1247
|
for (; i; ) {
|
1241
1248
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
1242
|
-
if (key - parent.
|
1249
|
+
if (key - parent.q >= 0) break;
|
1243
1250
|
pendingRenders[i] = parent, i = parentIndex;
|
1244
1251
|
}
|
1245
1252
|
signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
|
@@ -1251,9 +1258,9 @@ function queueEffect(scope, fn) {
|
|
1251
1258
|
function run() {
|
1252
1259
|
let effects = pendingEffects;
|
1253
1260
|
try {
|
1254
|
-
rendering =
|
1261
|
+
rendering = 1, runRenders();
|
1255
1262
|
} finally {
|
1256
|
-
pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering =
|
1263
|
+
pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = 0;
|
1257
1264
|
}
|
1258
1265
|
runEffects(effects);
|
1259
1266
|
}
|
@@ -1261,9 +1268,9 @@ function prepareEffects(fn) {
|
|
1261
1268
|
let prevRenders = pendingRenders, prevRendersLookup = pendingRendersLookup, prevEffects = pendingEffects, preparedEffects = pendingEffects = [];
|
1262
1269
|
pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map();
|
1263
1270
|
try {
|
1264
|
-
rendering =
|
1271
|
+
rendering = 1, fn(), runRenders();
|
1265
1272
|
} finally {
|
1266
|
-
rendering =
|
1273
|
+
rendering = 0, pendingRenders = prevRenders, pendingRendersLookup = prevRendersLookup, pendingEffects = prevEffects;
|
1267
1274
|
}
|
1268
1275
|
return preparedEffects;
|
1269
1276
|
}
|
@@ -1278,16 +1285,16 @@ function runRenders() {
|
|
1278
1285
|
for (; pendingRenders.length; ) {
|
1279
1286
|
let render = pendingRenders[0], item = pendingRenders.pop();
|
1280
1287
|
if (render !== item) {
|
1281
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).
|
1288
|
+
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).q;
|
1282
1289
|
for (; i < mid; ) {
|
1283
1290
|
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
1284
|
-
if (right < pendingRenders.length && pendingRenders[right].
|
1291
|
+
if (right < pendingRenders.length && pendingRenders[right].q - pendingRenders[bestChild].q < 0 && (bestChild = right), pendingRenders[bestChild].q - key >= 0)
|
1285
1292
|
break;
|
1286
1293
|
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
1287
1294
|
}
|
1288
1295
|
pendingRenders[i] = item;
|
1289
1296
|
}
|
1290
|
-
render.D.k?.
|
1297
|
+
render.D.k?.A || runRender(render);
|
1291
1298
|
}
|
1292
1299
|
finishPendingScopes();
|
1293
1300
|
}
|
@@ -1296,16 +1303,16 @@ var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
|
|
1296
1303
|
};
|
1297
1304
|
let handlePendingTry = (fn, scope, branch) => {
|
1298
1305
|
for (; branch; ) {
|
1299
|
-
if (branch.
|
1306
|
+
if (branch.n)
|
1300
1307
|
return (branch.H ||= []).push(fn, scope);
|
1301
|
-
branch = branch.
|
1308
|
+
branch = branch.t;
|
1302
1309
|
}
|
1303
1310
|
};
|
1304
1311
|
runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
|
1305
1312
|
if (checkPending || caughtError.has(effects)) {
|
1306
1313
|
let i = 0, fn, scope, branch;
|
1307
1314
|
for (; i < effects.length; )
|
1308
|
-
fn = effects[i++], scope = effects[i++], branch = scope.k, !branch?.
|
1315
|
+
fn = effects[i++], scope = effects[i++], branch = scope.k, !branch?.A && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope, scope);
|
1309
1316
|
} else
|
1310
1317
|
runEffects2(effects);
|
1311
1318
|
})(runEffects), runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
@@ -1319,11 +1326,11 @@ var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
|
|
1319
1326
|
|
1320
1327
|
// src/dom/abort-signal.ts
|
1321
1328
|
function resetAbortSignal(scope, id) {
|
1322
|
-
let ctrl = scope.
|
1323
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1329
|
+
let ctrl = scope.u?.[id];
|
1330
|
+
ctrl && (queueEffect(ctrl, abort), scope.u[id] = void 0);
|
1324
1331
|
}
|
1325
1332
|
function getAbortSignal(scope, id) {
|
1326
|
-
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.
|
1333
|
+
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.u ||= {})[id] ||= new AbortController()).signal;
|
1327
1334
|
}
|
1328
1335
|
function abort(ctrl) {
|
1329
1336
|
ctrl.abort();
|
@@ -1378,17 +1385,17 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1378
1385
|
render(out, component, renderer, args) {
|
1379
1386
|
let branch = component.scope;
|
1380
1387
|
branch || (branch = classIdToBranch.get(component.id), branch && (component.scope = branch, classIdToBranch.delete(component.id)));
|
1381
|
-
let existing
|
1388
|
+
let existing;
|
1382
1389
|
if (typeof args[0] == "object" && "renderBody" in args[0]) {
|
1383
1390
|
let input = args[0], normalizedInput = args[0] = {};
|
1384
1391
|
for (let key in input)
|
1385
1392
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1386
1393
|
}
|
1387
1394
|
if (component.effects = prepareEffects(() => {
|
1388
|
-
branch ? existing =
|
1395
|
+
branch ? existing = 1 : (out.global.o ||= 0, branch = component.scope = createAndSetupBranch(
|
1389
1396
|
out.global,
|
1390
1397
|
renderer,
|
1391
|
-
renderer.
|
1398
|
+
renderer.x,
|
1392
1399
|
document.body
|
1393
1400
|
)), renderer.l?.(branch, renderer._ ? args[0] : args);
|
1394
1401
|
}), !existing)
|
@@ -1410,12 +1417,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1410
1417
|
function mount(input = {}, reference, position) {
|
1411
1418
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1412
1419
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1413
|
-
|
1420
|
+
o: 0,
|
1414
1421
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1415
1422
|
renderId: DEFAULT_RENDER_ID,
|
1416
1423
|
...$global
|
1417
1424
|
}) : $global = {
|
1418
|
-
|
1425
|
+
o: 0,
|
1419
1426
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1420
1427
|
renderId: DEFAULT_RENDER_ID
|
1421
1428
|
}, position) {
|
package/dist/html.js
CHANGED
@@ -2002,9 +2002,9 @@ function render(input = {}) {
|
|
2002
2002
|
null,
|
2003
2003
|
null
|
2004
2004
|
);
|
2005
|
-
return head.render(this, input), new
|
2005
|
+
return head.render(this, input), new ServerRendered(head);
|
2006
2006
|
}
|
2007
|
-
var
|
2007
|
+
var ServerRendered = class {
|
2008
2008
|
#head;
|
2009
2009
|
#cachedPromise = null;
|
2010
2010
|
constructor(head) {
|
@@ -2058,11 +2058,12 @@ var ServerRenderResult = class {
|
|
2058
2058
|
);
|
2059
2059
|
}
|
2060
2060
|
toReadable() {
|
2061
|
+
let encoder = new TextEncoder();
|
2061
2062
|
return new ReadableStream({
|
2062
2063
|
start: (ctrl) => {
|
2063
2064
|
this.#read(
|
2064
2065
|
(html) => {
|
2065
|
-
ctrl.enqueue(html);
|
2066
|
+
ctrl.enqueue(encoder.encode(html));
|
2066
2067
|
},
|
2067
2068
|
(err) => {
|
2068
2069
|
ctrl.error(err);
|
package/dist/html.mjs
CHANGED
@@ -1923,9 +1923,9 @@ function render(input = {}) {
|
|
1923
1923
|
null,
|
1924
1924
|
null
|
1925
1925
|
);
|
1926
|
-
return head.render(this, input), new
|
1926
|
+
return head.render(this, input), new ServerRendered(head);
|
1927
1927
|
}
|
1928
|
-
var
|
1928
|
+
var ServerRendered = class {
|
1929
1929
|
#head;
|
1930
1930
|
#cachedPromise = null;
|
1931
1931
|
constructor(head) {
|
@@ -1979,11 +1979,12 @@ var ServerRenderResult = class {
|
|
1979
1979
|
);
|
1980
1980
|
}
|
1981
1981
|
toReadable() {
|
1982
|
+
let encoder = new TextEncoder();
|
1982
1983
|
return new ReadableStream({
|
1983
1984
|
start: (ctrl) => {
|
1984
1985
|
this.#read(
|
1985
1986
|
(html) => {
|
1986
|
-
ctrl.enqueue(html);
|
1987
|
+
ctrl.enqueue(encoder.encode(html));
|
1987
1988
|
},
|
1988
1989
|
(err) => {
|
1989
1990
|
ctrl.error(err);
|