marko 6.0.0-next.3.24 → 6.0.0-next.3.25
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 +1 -0
- package/dist/debug/dom.mjs +1 -0
- package/dist/dom.js +26 -25
- package/dist/dom.mjs +26 -25
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -1892,6 +1892,7 @@ function runRenders() {
|
|
1892
1892
|
finishPendingScopes();
|
1893
1893
|
}
|
1894
1894
|
function comparePendingRenders(a, b) {
|
1895
|
+
if (a.___scope.___pending || b.___scope.___pending) return 0;
|
1895
1896
|
const aStart = ownerStartNode(a.___scope);
|
1896
1897
|
const bStart = ownerStartNode(b.___scope);
|
1897
1898
|
return aStart === bStart ? 0 : aStart ? bStart ? aStart.compareDocumentPosition(bStart) & 2 ? -1 : 1 : -1 : 1;
|
package/dist/debug/dom.mjs
CHANGED
@@ -1805,6 +1805,7 @@ function runRenders() {
|
|
1805
1805
|
finishPendingScopes();
|
1806
1806
|
}
|
1807
1807
|
function comparePendingRenders(a, b) {
|
1808
|
+
if (a.___scope.___pending || b.___scope.___pending) return 0;
|
1808
1809
|
const aStart = ownerStartNode(a.___scope);
|
1809
1810
|
const bStart = ownerStartNode(b.___scope);
|
1810
1811
|
return aStart === bStart ? 0 : aStart ? bStart ? aStart.compareDocumentPosition(bStart) & 2 ? -1 : 1 : -1 : 1;
|
package/dist/dom.js
CHANGED
@@ -133,14 +133,14 @@ function triggerMacroTask() {
|
|
133
133
|
var pendingScopes = [];
|
134
134
|
function createScope($global) {
|
135
135
|
let scope = {
|
136
|
-
|
136
|
+
e: 1,
|
137
137
|
$global
|
138
138
|
};
|
139
139
|
return pendingScopes.push(scope), scope;
|
140
140
|
}
|
141
141
|
function finishPendingScopes() {
|
142
142
|
for (let scope of pendingScopes)
|
143
|
-
scope.
|
143
|
+
scope.e = 0;
|
144
144
|
pendingScopes = [];
|
145
145
|
}
|
146
146
|
var emptyScope = createScope({});
|
@@ -150,8 +150,8 @@ function getEmptyScope(marker) {
|
|
150
150
|
function destroyBranch(branch) {
|
151
151
|
if (branch.y = 1, branch.m?.forEach(destroyBranch), branch.n)
|
152
152
|
for (let scope of branch.n)
|
153
|
-
for (let id in scope.
|
154
|
-
scope.
|
153
|
+
for (let id in scope.j)
|
154
|
+
scope.j[id]?.abort();
|
155
155
|
}
|
156
156
|
function removeAndDestroyBranch(branch) {
|
157
157
|
destroyBranch(branch);
|
@@ -376,15 +376,15 @@ var registeredValues = {}, Render = class {
|
|
376
376
|
else if (token === "$" /* ClosestBranch */)
|
377
377
|
closestBranchMarkers.set(scopeId, visit);
|
378
378
|
else if (token === "[" /* BranchStart */)
|
379
|
-
this.
|
379
|
+
this.h && (dataIndex && branchEnd(this.h, visit, visit), this.o.push(this.h)), this.h = scopeId, scope.a = visit;
|
380
380
|
else if (token === "]" /* BranchEnd */) {
|
381
381
|
scope[data3] = visit;
|
382
382
|
let curParent = visit.parentNode, startNode = branchEnd(
|
383
|
-
this.
|
383
|
+
this.h,
|
384
384
|
visit,
|
385
385
|
visit
|
386
386
|
).a;
|
387
|
-
curParent !== startNode.parentNode && curParent.prepend(startNode), this.
|
387
|
+
curParent !== startNode.parentNode && curParent.prepend(startNode), this.h = this.o.pop();
|
388
388
|
} else if (token === "|" /* BranchSingleNode */) {
|
389
389
|
let next = data3.indexOf(" "), curNode = scope[~next ? data3.slice(0, next) : data3] = visit;
|
390
390
|
for (; ~next; ) {
|
@@ -902,13 +902,13 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
902
902
|
return;
|
903
903
|
let childScope = scope[nodeAccessor + "!" /* ConditionalScope */];
|
904
904
|
if (attrsOrOp === MARK || attrsOrOp === CLEAN)
|
905
|
-
return renderer.
|
905
|
+
return renderer.f?.(childScope, attrsOrOp);
|
906
906
|
let content = getContent?.(scope);
|
907
907
|
if (typeof renderer == "string")
|
908
908
|
setConditionalRendererOnlyChild(childScope, 0, content), attrs(childScope, 0, attrsOrOp());
|
909
|
-
else if (renderer.
|
909
|
+
else if (renderer.f) {
|
910
910
|
let attributes = attrsOrOp();
|
911
|
-
renderer.
|
911
|
+
renderer.f(
|
912
912
|
childScope,
|
913
913
|
inputIsArgs ? attributes : [
|
914
914
|
content ? {
|
@@ -923,14 +923,14 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
923
923
|
function createRendererWithOwner(template, rawWalks, setup, getArgs) {
|
924
924
|
let args, id = {}, walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
|
925
925
|
return (owner) => ({
|
926
|
-
|
926
|
+
k: id,
|
927
927
|
F: template,
|
928
928
|
E: walks,
|
929
929
|
x: setup,
|
930
930
|
l: _clone,
|
931
931
|
u: owner,
|
932
932
|
G: void 0,
|
933
|
-
get
|
933
|
+
get f() {
|
934
934
|
return args ||= getArgs?.();
|
935
935
|
}
|
936
936
|
});
|
@@ -1020,7 +1020,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1020
1020
|
);
|
1021
1021
|
}
|
1022
1022
|
function loop(nodeAccessor, renderer, forEach) {
|
1023
|
-
let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, params = renderer.
|
1023
|
+
let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, params = renderer.f;
|
1024
1024
|
return (scope, valueOrOp) => {
|
1025
1025
|
if (valueOrOp === DIRTY) return;
|
1026
1026
|
if (valueOrOp === MARK || valueOrOp === CLEAN) {
|
@@ -1053,7 +1053,7 @@ function byFirstArg(name) {
|
|
1053
1053
|
return name;
|
1054
1054
|
}
|
1055
1055
|
function isDifferentRenderer(a, b) {
|
1056
|
-
return a !== b && (a?.
|
1056
|
+
return a !== b && (a?.k || 0) !== b?.k;
|
1057
1057
|
}
|
1058
1058
|
|
1059
1059
|
// src/dom/signals.ts
|
@@ -1094,14 +1094,14 @@ function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
|
|
1094
1094
|
let loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
|
1095
1095
|
if (loopScopes !== emptyMarkerArray)
|
1096
1096
|
for (let scope of loopScopes)
|
1097
|
-
scope.
|
1097
|
+
scope.e || queueSource(scope, signal, value2);
|
1098
1098
|
};
|
1099
1099
|
return helperSignal._ = signal, helperSignal;
|
1100
1100
|
}
|
1101
1101
|
function conditionalClosure(ownerConditionalNodeAccessor, getRenderer, fn, getIntersection) {
|
1102
1102
|
let signal = closure(fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, rendererAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, helperSignal = (scope, value2) => {
|
1103
1103
|
let conditionalScope = scope[scopeAccessor];
|
1104
|
-
conditionalScope && !conditionalScope.
|
1104
|
+
conditionalScope && !conditionalScope.e && scope[rendererAccessor]?.k === getRenderer().k && queueSource(conditionalScope, signal, value2);
|
1105
1105
|
};
|
1106
1106
|
return helperSignal._ = signal, helperSignal;
|
1107
1107
|
}
|
@@ -1111,7 +1111,7 @@ function dynamicClosure(ownerValueAccessor, fn, getOwnerScope = defaultGetOwnerS
|
|
1111
1111
|
let subscribers = ownerScope[ownerSubscribersAccessor];
|
1112
1112
|
if (subscribers)
|
1113
1113
|
for (let subscriber of subscribers)
|
1114
|
-
subscriber.
|
1114
|
+
subscriber.e || queueSource(subscriber, _signal, value2);
|
1115
1115
|
}, setupSignal = (scope, value2) => {
|
1116
1116
|
_signal(scope, value2), subscribe(scope);
|
1117
1117
|
}, subscribe = (scope) => {
|
@@ -1160,7 +1160,7 @@ function queueSource(scope, signal, value2) {
|
|
1160
1160
|
}
|
1161
1161
|
function queueRender(scope, signal, value2) {
|
1162
1162
|
let nextRender = {
|
1163
|
-
|
1163
|
+
g: scope,
|
1164
1164
|
H: signal,
|
1165
1165
|
I: value2,
|
1166
1166
|
d: void 0
|
@@ -1206,11 +1206,12 @@ function runEffects(effects = pendingEffects) {
|
|
1206
1206
|
}
|
1207
1207
|
function runRenders() {
|
1208
1208
|
for (; pendingRender; )
|
1209
|
-
pendingRender.
|
1209
|
+
pendingRender.g.b?.y || pendingRender.H(pendingRender.g, pendingRender.I), pendingRender = pendingRender.d;
|
1210
1210
|
finishPendingScopes();
|
1211
1211
|
}
|
1212
1212
|
function comparePendingRenders(a, b) {
|
1213
|
-
|
1213
|
+
if (a.g.e || b.g.e) return 0;
|
1214
|
+
let aStart = ownerStartNode(a.g), bStart = ownerStartNode(b.g);
|
1214
1215
|
return aStart === bStart ? 0 : aStart ? bStart ? aStart.compareDocumentPosition(bStart) & 2 ? -1 : 1 : -1 : 1;
|
1215
1216
|
}
|
1216
1217
|
function ownerStartNode(scope) {
|
@@ -1219,11 +1220,11 @@ function ownerStartNode(scope) {
|
|
1219
1220
|
|
1220
1221
|
// src/dom/abort-signal.ts
|
1221
1222
|
function resetAbortSignal(scope, id) {
|
1222
|
-
let ctrl = scope.
|
1223
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1223
|
+
let ctrl = scope.j?.[id];
|
1224
|
+
ctrl && (queueEffect(ctrl, abort), scope.j[id] = void 0);
|
1224
1225
|
}
|
1225
1226
|
function getAbortSignal(scope, id) {
|
1226
|
-
return scope.b && (scope.b.n ||= /* @__PURE__ */ new Set()).add(scope), ((scope.
|
1227
|
+
return scope.b && (scope.b.n ||= /* @__PURE__ */ new Set()).add(scope), ((scope.j ||= {})[id] ||= new AbortController()).signal;
|
1227
1228
|
}
|
1228
1229
|
function abort(ctrl) {
|
1229
1230
|
ctrl.abort();
|
@@ -1278,7 +1279,7 @@ var classIdToScope = /* @__PURE__ */ new Map(), compat = {
|
|
1278
1279
|
render(out, component, renderer, args) {
|
1279
1280
|
let scope = component.scope;
|
1280
1281
|
scope || (scope = classIdToScope.get(component.id), scope && (component.scope = scope, classIdToScope.delete(component.id)));
|
1281
|
-
let applyArgs = renderer.
|
1282
|
+
let applyArgs = renderer.f || noop, existing = !1;
|
1282
1283
|
if (typeof args[0] == "object" && "renderBody" in args[0]) {
|
1283
1284
|
let input = args[0], normalizedInput = args[0] = {};
|
1284
1285
|
for (let key in input)
|
@@ -1308,7 +1309,7 @@ function mount(input = {}, reference, position) {
|
|
1308
1309
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1309
1310
|
renderId: DEFAULT_RENDER_ID
|
1310
1311
|
};
|
1311
|
-
let args = this.
|
1312
|
+
let args = this.f, effects = prepareEffects(() => {
|
1312
1313
|
branch = createScope($global), dom = initRenderer(this, branch), args && args(branch, [input]);
|
1313
1314
|
});
|
1314
1315
|
switch (position) {
|
package/dist/dom.mjs
CHANGED
@@ -49,14 +49,14 @@ function triggerMacroTask() {
|
|
49
49
|
var pendingScopes = [];
|
50
50
|
function createScope($global) {
|
51
51
|
let scope = {
|
52
|
-
|
52
|
+
e: 1,
|
53
53
|
$global
|
54
54
|
};
|
55
55
|
return pendingScopes.push(scope), scope;
|
56
56
|
}
|
57
57
|
function finishPendingScopes() {
|
58
58
|
for (let scope of pendingScopes)
|
59
|
-
scope.
|
59
|
+
scope.e = 0;
|
60
60
|
pendingScopes = [];
|
61
61
|
}
|
62
62
|
var emptyScope = createScope({});
|
@@ -66,8 +66,8 @@ function getEmptyScope(marker) {
|
|
66
66
|
function destroyBranch(branch) {
|
67
67
|
if (branch.y = 1, branch.m?.forEach(destroyBranch), branch.n)
|
68
68
|
for (let scope of branch.n)
|
69
|
-
for (let id in scope.
|
70
|
-
scope.
|
69
|
+
for (let id in scope.j)
|
70
|
+
scope.j[id]?.abort();
|
71
71
|
}
|
72
72
|
function removeAndDestroyBranch(branch) {
|
73
73
|
destroyBranch(branch);
|
@@ -292,15 +292,15 @@ var registeredValues = {}, Render = class {
|
|
292
292
|
else if (token === "$" /* ClosestBranch */)
|
293
293
|
closestBranchMarkers.set(scopeId, visit);
|
294
294
|
else if (token === "[" /* BranchStart */)
|
295
|
-
this.
|
295
|
+
this.h && (dataIndex && branchEnd(this.h, visit, visit), this.o.push(this.h)), this.h = scopeId, scope.a = visit;
|
296
296
|
else if (token === "]" /* BranchEnd */) {
|
297
297
|
scope[data3] = visit;
|
298
298
|
let curParent = visit.parentNode, startNode = branchEnd(
|
299
|
-
this.
|
299
|
+
this.h,
|
300
300
|
visit,
|
301
301
|
visit
|
302
302
|
).a;
|
303
|
-
curParent !== startNode.parentNode && curParent.prepend(startNode), this.
|
303
|
+
curParent !== startNode.parentNode && curParent.prepend(startNode), this.h = this.o.pop();
|
304
304
|
} else if (token === "|" /* BranchSingleNode */) {
|
305
305
|
let next = data3.indexOf(" "), curNode = scope[~next ? data3.slice(0, next) : data3] = visit;
|
306
306
|
for (; ~next; ) {
|
@@ -818,13 +818,13 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
818
818
|
return;
|
819
819
|
let childScope = scope[nodeAccessor + "!" /* ConditionalScope */];
|
820
820
|
if (attrsOrOp === MARK || attrsOrOp === CLEAN)
|
821
|
-
return renderer.
|
821
|
+
return renderer.f?.(childScope, attrsOrOp);
|
822
822
|
let content = getContent?.(scope);
|
823
823
|
if (typeof renderer == "string")
|
824
824
|
setConditionalRendererOnlyChild(childScope, 0, content), attrs(childScope, 0, attrsOrOp());
|
825
|
-
else if (renderer.
|
825
|
+
else if (renderer.f) {
|
826
826
|
let attributes = attrsOrOp();
|
827
|
-
renderer.
|
827
|
+
renderer.f(
|
828
828
|
childScope,
|
829
829
|
inputIsArgs ? attributes : [
|
830
830
|
content ? {
|
@@ -839,14 +839,14 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
839
839
|
function createRendererWithOwner(template, rawWalks, setup, getArgs) {
|
840
840
|
let args, id = {}, walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
|
841
841
|
return (owner) => ({
|
842
|
-
|
842
|
+
k: id,
|
843
843
|
F: template,
|
844
844
|
E: walks,
|
845
845
|
x: setup,
|
846
846
|
l: _clone,
|
847
847
|
u: owner,
|
848
848
|
G: void 0,
|
849
|
-
get
|
849
|
+
get f() {
|
850
850
|
return args ||= getArgs?.();
|
851
851
|
}
|
852
852
|
});
|
@@ -936,7 +936,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
936
936
|
);
|
937
937
|
}
|
938
938
|
function loop(nodeAccessor, renderer, forEach) {
|
939
|
-
let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, params = renderer.
|
939
|
+
let loopScopeAccessor = nodeAccessor + "!" /* LoopScopeArray */, params = renderer.f;
|
940
940
|
return (scope, valueOrOp) => {
|
941
941
|
if (valueOrOp === DIRTY) return;
|
942
942
|
if (valueOrOp === MARK || valueOrOp === CLEAN) {
|
@@ -969,7 +969,7 @@ function byFirstArg(name) {
|
|
969
969
|
return name;
|
970
970
|
}
|
971
971
|
function isDifferentRenderer(a, b) {
|
972
|
-
return a !== b && (a?.
|
972
|
+
return a !== b && (a?.k || 0) !== b?.k;
|
973
973
|
}
|
974
974
|
|
975
975
|
// src/dom/signals.ts
|
@@ -1010,14 +1010,14 @@ function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
|
|
1010
1010
|
let loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
|
1011
1011
|
if (loopScopes !== emptyMarkerArray)
|
1012
1012
|
for (let scope of loopScopes)
|
1013
|
-
scope.
|
1013
|
+
scope.e || queueSource(scope, signal, value2);
|
1014
1014
|
};
|
1015
1015
|
return helperSignal._ = signal, helperSignal;
|
1016
1016
|
}
|
1017
1017
|
function conditionalClosure(ownerConditionalNodeAccessor, getRenderer, fn, getIntersection) {
|
1018
1018
|
let signal = closure(fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, rendererAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, helperSignal = (scope, value2) => {
|
1019
1019
|
let conditionalScope = scope[scopeAccessor];
|
1020
|
-
conditionalScope && !conditionalScope.
|
1020
|
+
conditionalScope && !conditionalScope.e && scope[rendererAccessor]?.k === getRenderer().k && queueSource(conditionalScope, signal, value2);
|
1021
1021
|
};
|
1022
1022
|
return helperSignal._ = signal, helperSignal;
|
1023
1023
|
}
|
@@ -1027,7 +1027,7 @@ function dynamicClosure(ownerValueAccessor, fn, getOwnerScope = defaultGetOwnerS
|
|
1027
1027
|
let subscribers = ownerScope[ownerSubscribersAccessor];
|
1028
1028
|
if (subscribers)
|
1029
1029
|
for (let subscriber of subscribers)
|
1030
|
-
subscriber.
|
1030
|
+
subscriber.e || queueSource(subscriber, _signal, value2);
|
1031
1031
|
}, setupSignal = (scope, value2) => {
|
1032
1032
|
_signal(scope, value2), subscribe(scope);
|
1033
1033
|
}, subscribe = (scope) => {
|
@@ -1076,7 +1076,7 @@ function queueSource(scope, signal, value2) {
|
|
1076
1076
|
}
|
1077
1077
|
function queueRender(scope, signal, value2) {
|
1078
1078
|
let nextRender = {
|
1079
|
-
|
1079
|
+
g: scope,
|
1080
1080
|
H: signal,
|
1081
1081
|
I: value2,
|
1082
1082
|
d: void 0
|
@@ -1122,11 +1122,12 @@ function runEffects(effects = pendingEffects) {
|
|
1122
1122
|
}
|
1123
1123
|
function runRenders() {
|
1124
1124
|
for (; pendingRender; )
|
1125
|
-
pendingRender.
|
1125
|
+
pendingRender.g.b?.y || pendingRender.H(pendingRender.g, pendingRender.I), pendingRender = pendingRender.d;
|
1126
1126
|
finishPendingScopes();
|
1127
1127
|
}
|
1128
1128
|
function comparePendingRenders(a, b) {
|
1129
|
-
|
1129
|
+
if (a.g.e || b.g.e) return 0;
|
1130
|
+
let aStart = ownerStartNode(a.g), bStart = ownerStartNode(b.g);
|
1130
1131
|
return aStart === bStart ? 0 : aStart ? bStart ? aStart.compareDocumentPosition(bStart) & 2 ? -1 : 1 : -1 : 1;
|
1131
1132
|
}
|
1132
1133
|
function ownerStartNode(scope) {
|
@@ -1135,11 +1136,11 @@ function ownerStartNode(scope) {
|
|
1135
1136
|
|
1136
1137
|
// src/dom/abort-signal.ts
|
1137
1138
|
function resetAbortSignal(scope, id) {
|
1138
|
-
let ctrl = scope.
|
1139
|
-
ctrl && (queueEffect(ctrl, abort), scope.
|
1139
|
+
let ctrl = scope.j?.[id];
|
1140
|
+
ctrl && (queueEffect(ctrl, abort), scope.j[id] = void 0);
|
1140
1141
|
}
|
1141
1142
|
function getAbortSignal(scope, id) {
|
1142
|
-
return scope.b && (scope.b.n ||= /* @__PURE__ */ new Set()).add(scope), ((scope.
|
1143
|
+
return scope.b && (scope.b.n ||= /* @__PURE__ */ new Set()).add(scope), ((scope.j ||= {})[id] ||= new AbortController()).signal;
|
1143
1144
|
}
|
1144
1145
|
function abort(ctrl) {
|
1145
1146
|
ctrl.abort();
|
@@ -1194,7 +1195,7 @@ var classIdToScope = /* @__PURE__ */ new Map(), compat = {
|
|
1194
1195
|
render(out, component, renderer, args) {
|
1195
1196
|
let scope = component.scope;
|
1196
1197
|
scope || (scope = classIdToScope.get(component.id), scope && (component.scope = scope, classIdToScope.delete(component.id)));
|
1197
|
-
let applyArgs = renderer.
|
1198
|
+
let applyArgs = renderer.f || noop, existing = !1;
|
1198
1199
|
if (typeof args[0] == "object" && "renderBody" in args[0]) {
|
1199
1200
|
let input = args[0], normalizedInput = args[0] = {};
|
1200
1201
|
for (let key in input)
|
@@ -1224,7 +1225,7 @@ function mount(input = {}, reference, position) {
|
|
1224
1225
|
runtimeId: DEFAULT_RUNTIME_ID,
|
1225
1226
|
renderId: DEFAULT_RENDER_ID
|
1226
1227
|
};
|
1227
|
-
let args = this.
|
1228
|
+
let args = this.f, effects = prepareEffects(() => {
|
1228
1229
|
branch = createScope($global), dom = initRenderer(this, branch), args && args(branch, [input]);
|
1229
1230
|
});
|
1230
1231
|
switch (position) {
|