marko 6.0.0-next.3.38 → 6.0.0-next.3.39
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 +134 -116
- package/dist/debug/dom.mjs +134 -116
- package/dist/dom/queue.d.ts +2 -2
- package/dist/dom/resume.d.ts +0 -1
- package/dist/dom/scope.d.ts +1 -1
- package/dist/dom/signals.d.ts +14 -6
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +112 -96
- package/dist/dom.mjs +112 -96
- package/dist/translator/index.js +32 -26
- package/dist/translator/util/signals.d.ts +2 -3
- package/package.json +1 -1
package/dist/dom.js
CHANGED
@@ -67,7 +67,7 @@ __export(dom_exports, {
|
|
67
67
|
props: () => props,
|
68
68
|
register: () => register,
|
69
69
|
registerBoundSignal: () => registerBoundSignal,
|
70
|
-
|
70
|
+
registerDynamicClosure: () => registerDynamicClosure,
|
71
71
|
resetAbortSignal: () => resetAbortSignal,
|
72
72
|
run: () => run,
|
73
73
|
setTagVar: () => setTagVar,
|
@@ -111,23 +111,6 @@ function forTo(to, from, step, cb) {
|
|
111
111
|
cb(start + i * delta);
|
112
112
|
}
|
113
113
|
|
114
|
-
// src/dom/schedule.ts
|
115
|
-
var port2 = /* @__PURE__ */ (() => {
|
116
|
-
let { port1, port2: port22 } = new MessageChannel();
|
117
|
-
return port1.onmessage = () => {
|
118
|
-
isScheduled = !1, run();
|
119
|
-
}, port22;
|
120
|
-
})(), isScheduled;
|
121
|
-
function schedule() {
|
122
|
-
isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
|
123
|
-
}
|
124
|
-
function flushAndWaitFrame() {
|
125
|
-
run(), requestAnimationFrame(triggerMacroTask);
|
126
|
-
}
|
127
|
-
function triggerMacroTask() {
|
128
|
-
port2.postMessage(0);
|
129
|
-
}
|
130
|
-
|
131
114
|
// src/common/helpers.ts
|
132
115
|
function classValue(value2) {
|
133
116
|
return toDelimitedString(value2, " ", stringifyClassObject);
|
@@ -224,19 +207,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
|
224
207
|
|
225
208
|
// src/dom/resume.ts
|
226
209
|
var registeredValues = {}, Render = class {
|
227
|
-
|
228
|
-
|
229
|
-
|
210
|
+
l = [];
|
211
|
+
m = {};
|
212
|
+
C = {
|
230
213
|
_: registeredValues
|
231
214
|
};
|
232
215
|
constructor(renders, runtimeId, renderId) {
|
233
|
-
this.
|
216
|
+
this.D = renders, this.E = runtimeId, this.n = renderId, this.o = renders[renderId], this.p();
|
234
217
|
}
|
235
218
|
w() {
|
236
|
-
this.
|
219
|
+
this.o.w(), this.p();
|
237
220
|
}
|
238
|
-
|
239
|
-
let data2 = this.
|
221
|
+
p() {
|
222
|
+
let data2 = this.o, serializeContext = this.C, scopeLookup = this.m, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
|
240
223
|
if (visits.length) {
|
241
224
|
let commentPrefixLen = data2.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
|
242
225
|
data2.v = [];
|
@@ -258,7 +241,7 @@ var registeredValues = {}, Render = class {
|
|
258
241
|
else if (token === "$" /* ClosestBranch */)
|
259
242
|
closestBranchMarkers.set(scopeId, visit);
|
260
243
|
else if (token === "[" /* BranchStart */)
|
261
|
-
this.e && (dataIndex && branchEnd(this.e, visit, visit), this.
|
244
|
+
this.e && (dataIndex && branchEnd(this.e, visit, visit), this.l.push(this.e)), this.e = scopeId, scope.a = visit;
|
262
245
|
else if (token === "]" /* BranchEnd */) {
|
263
246
|
scope[data3] = visit;
|
264
247
|
let curParent = visit.parentNode, startNode = branchEnd(
|
@@ -266,7 +249,7 @@ var registeredValues = {}, Render = class {
|
|
266
249
|
visit,
|
267
250
|
visit
|
268
251
|
).a;
|
269
|
-
curParent !== startNode.parentNode && curParent.prepend(startNode), this.e = this.
|
252
|
+
curParent !== startNode.parentNode && curParent.prepend(startNode), this.e = this.l.pop();
|
270
253
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
271
254
|
let next = data3.indexOf(" "), curNode = visit;
|
272
255
|
for (scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
@@ -287,7 +270,7 @@ var registeredValues = {}, Render = class {
|
|
287
270
|
let resumeData = resumes[i++];
|
288
271
|
if (typeof resumeData == "function") {
|
289
272
|
let scopes = resumeData(serializeContext), { $global } = scopeLookup;
|
290
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.
|
273
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.E, $global.renderId = this.n);
|
291
274
|
for (let scopeId in scopes)
|
292
275
|
if (scopeId !== "$") {
|
293
276
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
@@ -298,10 +281,10 @@ var registeredValues = {}, Render = class {
|
|
298
281
|
let parentBranchId = parentBranchIds.get(scopeId);
|
299
282
|
if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
300
283
|
let branch = scope, parentBranch = branch.c;
|
301
|
-
branch.f = +scopeId, scope.c = branch, parentBranch && (branch.
|
284
|
+
branch.f = +scopeId, scope.c = branch, parentBranch && (branch.q = parentBranch, (parentBranch.j ||= /* @__PURE__ */ new Set()).add(branch));
|
302
285
|
}
|
303
286
|
}
|
304
|
-
} else i === len || typeof resumes[i] != "string" ? delete this.
|
287
|
+
} else i === len || typeof resumes[i] != "string" ? delete this.D[this.n] : registeredValues[resumes[i++]](
|
305
288
|
scopeLookup[resumeData],
|
306
289
|
scopeLookup[resumeData]
|
307
290
|
);
|
@@ -338,9 +321,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
338
321
|
});
|
339
322
|
}
|
340
323
|
}
|
341
|
-
function registerSubscriber(id, signal) {
|
342
|
-
return register(id, signal.D), signal;
|
343
|
-
}
|
344
324
|
function nodeRef(id, key) {
|
345
325
|
return register(id, (scope) => () => scope[key]);
|
346
326
|
}
|
@@ -723,9 +703,10 @@ function toInsertNode(startNode, endNode) {
|
|
723
703
|
|
724
704
|
// src/dom/scope.ts
|
725
705
|
var pendingScopes = [];
|
726
|
-
function createScope($global) {
|
706
|
+
function createScope($global, closestBranch) {
|
727
707
|
let scope = {
|
728
708
|
g: 1,
|
709
|
+
c: closestBranch,
|
729
710
|
$global
|
730
711
|
};
|
731
712
|
return pendingScopes.push(scope), scope;
|
@@ -740,10 +721,10 @@ function getEmptyBranch(marker) {
|
|
740
721
|
return emptyBranch.a = emptyBranch.b = marker, emptyBranch;
|
741
722
|
}
|
742
723
|
function destroyBranch(branch) {
|
743
|
-
branch.
|
724
|
+
branch.q?.j?.delete(branch), destroyNestedBranches(branch);
|
744
725
|
}
|
745
726
|
function destroyNestedBranches(branch) {
|
746
|
-
branch.
|
727
|
+
branch.F = 1, branch.j?.forEach(destroyNestedBranches), branch.G?.forEach((scope) => {
|
747
728
|
for (let id in scope.h)
|
748
729
|
scope.h[id]?.abort();
|
749
730
|
});
|
@@ -845,9 +826,9 @@ function trimWalkString(walkString) {
|
|
845
826
|
return walkString.slice(0, end + 1);
|
846
827
|
}
|
847
828
|
function walk(startNode, walkCodes, branch) {
|
848
|
-
walker.currentNode = startNode, walkInternal(walkCodes, branch
|
829
|
+
walker.currentNode = startNode, walkInternal(0, walkCodes, branch), walker.currentNode = document;
|
849
830
|
}
|
850
|
-
function walkInternal(walkCodes, scope
|
831
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
851
832
|
let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
852
833
|
for (; value2 = walkCodes.charCodeAt(currentWalkIndex++); )
|
853
834
|
if (currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 >= 117 /* Multiplier */)
|
@@ -862,10 +843,13 @@ function walkInternal(walkCodes, scope, currentWalkIndex) {
|
|
862
843
|
else if (value2 >= 67 /* Next */)
|
863
844
|
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
864
845
|
walker.nextNode();
|
865
|
-
else if (value2 === 47 /* BeginChild */)
|
866
|
-
|
867
|
-
|
868
|
-
|
846
|
+
else if (value2 === 47 /* BeginChild */)
|
847
|
+
currentWalkIndex = walkInternal(
|
848
|
+
currentWalkIndex,
|
849
|
+
walkCodes,
|
850
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.c)
|
851
|
+
);
|
852
|
+
else {
|
869
853
|
if (value2 === 38 /* EndChild */)
|
870
854
|
return currentWalkIndex;
|
871
855
|
if (value2 === 32 /* Get */)
|
@@ -882,7 +866,7 @@ function walkInternal(walkCodes, scope, currentWalkIndex) {
|
|
882
866
|
function createBranchScopeWithRenderer(renderer, $global, parentScope, parentNode) {
|
883
867
|
let branch = createBranch(
|
884
868
|
$global,
|
885
|
-
renderer.
|
869
|
+
renderer.s || parentScope,
|
886
870
|
parentScope
|
887
871
|
);
|
888
872
|
return initBranch(renderer, branch, parentNode), branch;
|
@@ -903,11 +887,11 @@ function createBranchScopeWithTagNameOrRenderer(tagNameOrRenderer, $global, pare
|
|
903
887
|
}
|
904
888
|
function createBranch($global, ownerScope, parentScope) {
|
905
889
|
let branch = createScope($global), parentBranch = parentScope.c;
|
906
|
-
return branch._ = ownerScope, branch.c = branch, parentBranch ? (branch.f = parentBranch.f + 1, branch.
|
890
|
+
return branch._ = ownerScope, branch.c = branch, parentBranch ? (branch.f = parentBranch.f + 1, branch.q = parentBranch, (parentBranch.j ||= /* @__PURE__ */ new Set()).add(branch)) : branch.f = 1, branch;
|
907
891
|
}
|
908
892
|
function initBranch(renderer, branch, parentNode) {
|
909
893
|
let clone = renderer.k(parentNode.namespaceURI), cloneParent = clone.parentNode;
|
910
|
-
walk(cloneParent
|
894
|
+
cloneParent ? (walk(cloneParent.firstChild, renderer.t, branch), branch.a = cloneParent.firstChild, branch.b = cloneParent.lastChild) : (walk(clone, renderer.t, branch), branch.a = branch.b = clone), renderer.u && queueRender(branch, renderer.u);
|
911
895
|
}
|
912
896
|
function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
913
897
|
return (scope, attrsOrOp) => {
|
@@ -944,10 +928,10 @@ function createRendererWithOwner(template, rawWalks, setup, getArgs) {
|
|
944
928
|
return (owner) => ({
|
945
929
|
x: id,
|
946
930
|
y: template,
|
947
|
-
|
931
|
+
t: walks,
|
948
932
|
u: setup,
|
949
933
|
k: _clone,
|
950
|
-
|
934
|
+
s: owner,
|
951
935
|
get d() {
|
952
936
|
return args ||= getArgs?.();
|
953
937
|
}
|
@@ -1081,6 +1065,23 @@ function isDifferentRenderer(a, b) {
|
|
1081
1065
|
return a !== b && (a?.x || 0) !== b?.x;
|
1082
1066
|
}
|
1083
1067
|
|
1068
|
+
// src/dom/schedule.ts
|
1069
|
+
var port2 = /* @__PURE__ */ (() => {
|
1070
|
+
let { port1, port2: port22 } = new MessageChannel();
|
1071
|
+
return port1.onmessage = () => {
|
1072
|
+
isScheduled = !1, run();
|
1073
|
+
}, port22;
|
1074
|
+
})(), isScheduled;
|
1075
|
+
function schedule() {
|
1076
|
+
isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
|
1077
|
+
}
|
1078
|
+
function flushAndWaitFrame() {
|
1079
|
+
run(), requestAnimationFrame(triggerMacroTask);
|
1080
|
+
}
|
1081
|
+
function triggerMacroTask() {
|
1082
|
+
port2.postMessage(0);
|
1083
|
+
}
|
1084
|
+
|
1084
1085
|
// src/dom/signals.ts
|
1085
1086
|
var MARK = {}, CLEAN = {}, DIRTY = {};
|
1086
1087
|
function state(valueAccessor, fn, getIntersection) {
|
@@ -1088,63 +1089,81 @@ function state(valueAccessor, fn, getIntersection) {
|
|
1088
1089
|
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
1089
1090
|
scope,
|
1090
1091
|
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
1091
|
-
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : queueSource(scope, valueSignal, valueOrOp), valueOrOp);
|
1092
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : (schedule(), queueSource(scope, valueSignal, valueOrOp)), valueOrOp);
|
1092
1093
|
}
|
1093
1094
|
function value(valueAccessor, fn, getIntersection) {
|
1094
|
-
let markAccessor = valueAccessor + "#" /* Mark */, intersection2
|
1095
|
+
let markAccessor = valueAccessor + "#" /* Mark */, intersection2;
|
1095
1096
|
return (scope, valueOrOp) => {
|
1096
1097
|
if (valueOrOp === MARK)
|
1097
|
-
(scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && intersection2
|
1098
|
+
(scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
1098
1099
|
else if (valueOrOp !== DIRTY) {
|
1099
1100
|
let existing = scope[markAccessor] !== void 0;
|
1100
|
-
(scope[markAccessor] ||= 1) === 1 && (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp ? intersection2
|
1101
|
+
(scope[markAccessor] ||= 1) === 1 && (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp ? getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : (scope[valueAccessor] = valueOrOp, fn && fn(scope, valueOrOp), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY))), scope[markAccessor]--;
|
1101
1102
|
}
|
1102
1103
|
};
|
1103
1104
|
}
|
1104
1105
|
var accessorId = 0;
|
1105
1106
|
function intersection(count, fn, getIntersection) {
|
1106
|
-
let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2
|
1107
|
+
let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2;
|
1107
1108
|
return (scope, op) => {
|
1108
|
-
op === MARK ? (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && intersection2
|
1109
|
+
op === MARK ? (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK) : scope[markAccessor] === void 0 ? (scope[markAccessor] = count - 1, scope[dirtyAccessor] = !0) : --scope[markAccessor] === 0 ? op === DIRTY || scope[dirtyAccessor] ? (scope[dirtyAccessor] = !1, fn(scope), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY)) : getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : scope[dirtyAccessor] ||= op === DIRTY;
|
1109
1110
|
};
|
1110
1111
|
}
|
1111
|
-
function
|
1112
|
-
let
|
1113
|
-
return (scope, valueOrOp) => {
|
1114
|
-
valueOrOp === MARK ? intersection2?.(scope, MARK) : (fn && fn(scope, valueOrOp), intersection2?.(scope, DIRTY));
|
1115
|
-
};
|
1116
|
-
}
|
1117
|
-
function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
|
1118
|
-
let signal = closure(fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, helperSignal = (ownerScope, value2) => {
|
1112
|
+
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
|
1113
|
+
let childSignal = closure(valueAccessor, fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, ownerSignal = (ownerScope) => {
|
1119
1114
|
let loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
|
1120
1115
|
if (loopScopes !== emptyMarkerArray)
|
1121
1116
|
for (let scope of loopScopes)
|
1122
|
-
scope.g || queueSource(scope,
|
1117
|
+
scope.g || queueSource(scope, childSignal);
|
1123
1118
|
};
|
1124
|
-
return
|
1119
|
+
return ownerSignal._ = childSignal, ownerSignal;
|
1125
1120
|
}
|
1126
|
-
function conditionalClosure(ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
1127
|
-
let
|
1121
|
+
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
1122
|
+
let childSignal = closure(valueAccessor, fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
|
1128
1123
|
let ifScope = scope[scopeAccessor];
|
1129
|
-
ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope,
|
1124
|
+
ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, childSignal);
|
1130
1125
|
};
|
1131
|
-
return
|
1132
|
-
}
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1126
|
+
return ownerSignal._ = childSignal, ownerSignal;
|
1127
|
+
}
|
1128
|
+
function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1129
|
+
let subscribersAccessor = "?" /* Dynamic */ + accessorId++, childSignal = closure(
|
1130
|
+
valueAccessor,
|
1131
|
+
fn,
|
1132
|
+
getIntersection,
|
1133
|
+
getOwnerScope
|
1134
|
+
), ownerSignal = (ownerScope) => {
|
1135
|
+
let subscribers = ownerScope[subscribersAccessor];
|
1137
1136
|
if (subscribers)
|
1138
1137
|
for (let subscriber of subscribers)
|
1139
|
-
subscriber.g || queueSource(subscriber,
|
1140
|
-
}, setupSignal = (scope, value2) => {
|
1141
|
-
_signal(scope, value2), subscribe(scope);
|
1138
|
+
subscriber.g || queueSource(subscriber, childSignal);
|
1142
1139
|
}, subscribe = (scope) => {
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1140
|
+
let owner = getOwnerScope ? getOwnerScope(scope) : scope._, subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
|
1141
|
+
subscribers.has(scope) || (subscribers.add(scope), getAbortSignal(scope, -1).addEventListener(
|
1142
|
+
"abort",
|
1143
|
+
() => owner[subscribersAccessor].delete(scope)
|
1144
|
+
));
|
1145
|
+
};
|
1146
|
+
return ownerSignal.H = subscribe, ownerSignal._ = (scope) => {
|
1147
|
+
childSignal(scope), subscribe(scope);
|
1148
|
+
}, ownerSignal;
|
1149
|
+
}
|
1150
|
+
function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
|
1151
|
+
let signal = dynamicClosure(
|
1152
|
+
valueAccessor,
|
1153
|
+
fn,
|
1154
|
+
getIntersection,
|
1155
|
+
getOwnerScope
|
1156
|
+
);
|
1157
|
+
return register(id, signal.H), signal;
|
1158
|
+
}
|
1159
|
+
function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1160
|
+
let intersection2;
|
1161
|
+
return (scope, op) => {
|
1162
|
+
op || fn && fn(
|
1163
|
+
scope,
|
1164
|
+
(getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
|
1165
|
+
), getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
|
1146
1166
|
};
|
1147
|
-
return helperSignal._ = setupSignal, helperSignal.D = subscribe, helperSignal;
|
1148
1167
|
}
|
1149
1168
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1150
1169
|
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
@@ -1179,16 +1198,16 @@ function effect(id, fn) {
|
|
1179
1198
|
// src/dom/queue.ts
|
1180
1199
|
var pendingRenders = [], pendingEffects = [], rendering = !1;
|
1181
1200
|
function queueSource(scope, signal, value2) {
|
1182
|
-
schedule();
|
1183
1201
|
let prevRendering = rendering;
|
1184
|
-
|
1202
|
+
rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2);
|
1185
1203
|
}
|
1186
1204
|
function queueRender(scope, signal, value2) {
|
1187
1205
|
let i = pendingRenders.length, render = {
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1206
|
+
z: scope,
|
1207
|
+
I: signal,
|
1208
|
+
J: value2,
|
1209
|
+
A: scope.c?.f || 0,
|
1210
|
+
B: i
|
1192
1211
|
};
|
1193
1212
|
for (pendingRenders.push(render); i; ) {
|
1194
1213
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -1219,7 +1238,7 @@ function prepareEffects(fn) {
|
|
1219
1238
|
}
|
1220
1239
|
return preparedEffects;
|
1221
1240
|
}
|
1222
|
-
function runEffects(effects
|
1241
|
+
function runEffects(effects) {
|
1223
1242
|
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
1224
1243
|
let scope = effects[i], fn = effects[i + 1];
|
1225
1244
|
fn(scope, scope);
|
@@ -1241,15 +1260,12 @@ function runRenders() {
|
|
1241
1260
|
}
|
1242
1261
|
pendingRenders[i] = item;
|
1243
1262
|
}
|
1244
|
-
render.
|
1263
|
+
render.z.c?.F || render.I(render.z, render.J);
|
1245
1264
|
}
|
1246
1265
|
finishPendingScopes();
|
1247
1266
|
}
|
1248
1267
|
function comparePendingRenders(a, b) {
|
1249
|
-
return
|
1250
|
-
}
|
1251
|
-
function getBranchDepth(render) {
|
1252
|
-
return render.l.c?.f || 0;
|
1268
|
+
return a.A - b.A || a.B - b.B;
|
1253
1269
|
}
|
1254
1270
|
|
1255
1271
|
// src/dom/abort-signal.ts
|
@@ -1258,7 +1274,7 @@ function resetAbortSignal(scope, id) {
|
|
1258
1274
|
ctrl && (queueEffect(ctrl, abort), scope.h[id] = void 0);
|
1259
1275
|
}
|
1260
1276
|
function getAbortSignal(scope, id) {
|
1261
|
-
return scope.c && (scope.c.
|
1277
|
+
return scope.c && (scope.c.G ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
|
1262
1278
|
}
|
1263
1279
|
function abort(ctrl) {
|
1264
1280
|
ctrl.abort();
|
@@ -1303,7 +1319,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1303
1319
|
}) {
|
1304
1320
|
return Array.isArray(value2) && typeof value2[0] == "string" ? getRegisteredWithScope(
|
1305
1321
|
value2[0],
|
1306
|
-
value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.
|
1322
|
+
value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.m[value2[1]]
|
1307
1323
|
) : value2;
|
1308
1324
|
},
|
1309
1325
|
createRenderer(setup, clone, args) {
|
@@ -1320,7 +1336,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1320
1336
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1321
1337
|
}
|
1322
1338
|
if (component.effects = prepareEffects(() => {
|
1323
|
-
branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.
|
1339
|
+
branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.s, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
|
1324
1340
|
}), !existing)
|
1325
1341
|
return toInsertNode(branch.a, branch.b);
|
1326
1342
|
}
|
@@ -1362,14 +1378,14 @@ function mount(input = {}, reference, position) {
|
|
1362
1378
|
branch.a,
|
1363
1379
|
branch.b
|
1364
1380
|
), runEffects(effects), {
|
1365
|
-
update
|
1381
|
+
update(newInput) {
|
1366
1382
|
args && runEffects(
|
1367
1383
|
prepareEffects(() => {
|
1368
1384
|
args(branch, MARK), args(branch, [newInput]);
|
1369
1385
|
})
|
1370
1386
|
);
|
1371
1387
|
},
|
1372
|
-
destroy
|
1388
|
+
destroy() {
|
1373
1389
|
removeAndDestroyBranch(branch);
|
1374
1390
|
}
|
1375
1391
|
};
|