marko 6.0.0-next.3.52 → 6.0.0-next.3.54
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 +18 -19
- package/dist/debug/dom.mjs +18 -19
- package/dist/dom.js +39 -40
- package/dist/dom.mjs +39 -40
- package/dist/translator/index.js +12 -12
- package/dist/translator/util/references.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -245,30 +245,29 @@ var Render = class {
|
|
245
245
|
_: registeredValues
|
246
246
|
};
|
247
247
|
constructor(renders, runtimeId, renderId) {
|
248
|
+
Object.assign(this, renders[renderId]);
|
248
249
|
this.___renders = renders;
|
249
250
|
this.___runtimeId = runtimeId;
|
250
251
|
this.___renderId = renderId;
|
251
|
-
this.
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
this.___data.w();
|
252
|
+
this.w = /* @__PURE__ */ ((w) => () => {
|
253
|
+
w();
|
254
|
+
this.___resume();
|
255
|
+
})(this.w);
|
256
256
|
this.___resume();
|
257
257
|
}
|
258
258
|
___resume() {
|
259
|
-
const data2 = this.___data;
|
260
259
|
const serializeContext = this.___serializeContext;
|
261
260
|
const scopeLookup = this.___scopeLookup;
|
262
|
-
const visits =
|
261
|
+
const visits = this.v;
|
263
262
|
const branchIds = /* @__PURE__ */ new Set();
|
264
263
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
265
264
|
if (visits.length) {
|
266
|
-
const commentPrefix =
|
265
|
+
const commentPrefix = this.i;
|
267
266
|
const commentPrefixLen = commentPrefix.length;
|
268
267
|
const closestBranchMarkers = /* @__PURE__ */ new Map();
|
269
268
|
const visitNodes = new Set(visits);
|
270
269
|
let lastEndNode;
|
271
|
-
|
270
|
+
this.v = [];
|
272
271
|
const branchEnd = (branchId, visit, reference) => {
|
273
272
|
const branch = scopeLookup[branchId] ||= {};
|
274
273
|
let endNode = reference;
|
@@ -296,11 +295,11 @@ var Render = class {
|
|
296
295
|
dataIndex ? dataIndex - 1 : commentText.length
|
297
296
|
);
|
298
297
|
const scope = scopeLookup[scopeId] ||= { ___id: +scopeId };
|
299
|
-
const
|
298
|
+
const data2 = dataIndex ? commentText.slice(dataIndex) : "";
|
300
299
|
const token = commentText[commentPrefixLen];
|
301
300
|
if (token === "*" /* Node */) {
|
302
|
-
const node = scope[
|
303
|
-
scope[
|
301
|
+
const node = scope[data2] = visit.previousSibling;
|
302
|
+
scope[data2 + ">" /* Getter */] = () => node;
|
304
303
|
} else if (token === "$" /* ClosestBranch */) {
|
305
304
|
closestBranchMarkers.set(scopeId, visit);
|
306
305
|
} else if (token === "[" /* BranchStart */) {
|
@@ -313,7 +312,7 @@ var Render = class {
|
|
313
312
|
this.___currentScopeId = scopeId;
|
314
313
|
scope.___startNode = visit;
|
315
314
|
} else if (token === "]" /* BranchEnd */) {
|
316
|
-
scope[
|
315
|
+
scope[data2] = visit;
|
317
316
|
const curParent = visit.parentNode;
|
318
317
|
const startNode = branchEnd(
|
319
318
|
this.___currentScopeId,
|
@@ -325,21 +324,21 @@ var Render = class {
|
|
325
324
|
}
|
326
325
|
this.___currentScopeId = this.___scopeStack.pop();
|
327
326
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
328
|
-
let next =
|
327
|
+
let next = data2.indexOf(" ");
|
329
328
|
let curNode = visit;
|
330
|
-
scope[~next ?
|
329
|
+
scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
|
331
330
|
while (~next) {
|
332
331
|
const start = next + 1;
|
333
|
-
next =
|
334
|
-
const childScopeId =
|
332
|
+
next = data2.indexOf(" ", start);
|
333
|
+
const childScopeId = data2.slice(start, ~next ? next : data2.length);
|
335
334
|
curNode = branchEnd(childScopeId, visit, curNode).___endNode;
|
336
335
|
}
|
337
336
|
}
|
338
337
|
}
|
339
338
|
}
|
340
|
-
const resumes =
|
339
|
+
const resumes = this.r;
|
341
340
|
if (resumes) {
|
342
|
-
|
341
|
+
this.r = [];
|
343
342
|
const len = resumes.length;
|
344
343
|
let i = 0;
|
345
344
|
try {
|
package/dist/debug/dom.mjs
CHANGED
@@ -160,30 +160,29 @@ var Render = class {
|
|
160
160
|
_: registeredValues
|
161
161
|
};
|
162
162
|
constructor(renders, runtimeId, renderId) {
|
163
|
+
Object.assign(this, renders[renderId]);
|
163
164
|
this.___renders = renders;
|
164
165
|
this.___runtimeId = runtimeId;
|
165
166
|
this.___renderId = renderId;
|
166
|
-
this.
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
this.___data.w();
|
167
|
+
this.w = /* @__PURE__ */ ((w) => () => {
|
168
|
+
w();
|
169
|
+
this.___resume();
|
170
|
+
})(this.w);
|
171
171
|
this.___resume();
|
172
172
|
}
|
173
173
|
___resume() {
|
174
|
-
const data2 = this.___data;
|
175
174
|
const serializeContext = this.___serializeContext;
|
176
175
|
const scopeLookup = this.___scopeLookup;
|
177
|
-
const visits =
|
176
|
+
const visits = this.v;
|
178
177
|
const branchIds = /* @__PURE__ */ new Set();
|
179
178
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
180
179
|
if (visits.length) {
|
181
|
-
const commentPrefix =
|
180
|
+
const commentPrefix = this.i;
|
182
181
|
const commentPrefixLen = commentPrefix.length;
|
183
182
|
const closestBranchMarkers = /* @__PURE__ */ new Map();
|
184
183
|
const visitNodes = new Set(visits);
|
185
184
|
let lastEndNode;
|
186
|
-
|
185
|
+
this.v = [];
|
187
186
|
const branchEnd = (branchId, visit, reference) => {
|
188
187
|
const branch = scopeLookup[branchId] ||= {};
|
189
188
|
let endNode = reference;
|
@@ -211,11 +210,11 @@ var Render = class {
|
|
211
210
|
dataIndex ? dataIndex - 1 : commentText.length
|
212
211
|
);
|
213
212
|
const scope = scopeLookup[scopeId] ||= { ___id: +scopeId };
|
214
|
-
const
|
213
|
+
const data2 = dataIndex ? commentText.slice(dataIndex) : "";
|
215
214
|
const token = commentText[commentPrefixLen];
|
216
215
|
if (token === "*" /* Node */) {
|
217
|
-
const node = scope[
|
218
|
-
scope[
|
216
|
+
const node = scope[data2] = visit.previousSibling;
|
217
|
+
scope[data2 + ">" /* Getter */] = () => node;
|
219
218
|
} else if (token === "$" /* ClosestBranch */) {
|
220
219
|
closestBranchMarkers.set(scopeId, visit);
|
221
220
|
} else if (token === "[" /* BranchStart */) {
|
@@ -228,7 +227,7 @@ var Render = class {
|
|
228
227
|
this.___currentScopeId = scopeId;
|
229
228
|
scope.___startNode = visit;
|
230
229
|
} else if (token === "]" /* BranchEnd */) {
|
231
|
-
scope[
|
230
|
+
scope[data2] = visit;
|
232
231
|
const curParent = visit.parentNode;
|
233
232
|
const startNode = branchEnd(
|
234
233
|
this.___currentScopeId,
|
@@ -240,21 +239,21 @@ var Render = class {
|
|
240
239
|
}
|
241
240
|
this.___currentScopeId = this.___scopeStack.pop();
|
242
241
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
243
|
-
let next =
|
242
|
+
let next = data2.indexOf(" ");
|
244
243
|
let curNode = visit;
|
245
|
-
scope[~next ?
|
244
|
+
scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
|
246
245
|
while (~next) {
|
247
246
|
const start = next + 1;
|
248
|
-
next =
|
249
|
-
const childScopeId =
|
247
|
+
next = data2.indexOf(" ", start);
|
248
|
+
const childScopeId = data2.slice(start, ~next ? next : data2.length);
|
250
249
|
curNode = branchEnd(childScopeId, visit, curNode).___endNode;
|
251
250
|
}
|
252
251
|
}
|
253
252
|
}
|
254
253
|
}
|
255
|
-
const resumes =
|
254
|
+
const resumes = this.r;
|
256
255
|
if (resumes) {
|
257
|
-
|
256
|
+
this.r = [];
|
258
257
|
const len = resumes.length;
|
259
258
|
let i = 0;
|
260
259
|
try {
|
package/dist/dom.js
CHANGED
@@ -201,20 +201,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
|
201
201
|
var registeredValues = {}, Render = class {
|
202
202
|
q = [];
|
203
203
|
s = {};
|
204
|
-
|
204
|
+
E = {
|
205
205
|
_: registeredValues
|
206
206
|
};
|
207
207
|
constructor(renders, runtimeId, renderId) {
|
208
|
-
this.
|
208
|
+
Object.assign(this, renders[renderId]), this.F = renders, this.G = runtimeId, this.t = renderId, this.w = /* @__PURE__ */ ((w) => () => {
|
209
|
+
w(), this.u();
|
210
|
+
})(this.w), this.u();
|
209
211
|
}
|
210
|
-
|
211
|
-
this.
|
212
|
-
}
|
213
|
-
x() {
|
214
|
-
let data2 = this.u, serializeContext = this.F, scopeLookup = this.s, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
|
212
|
+
u() {
|
213
|
+
let serializeContext = this.E, scopeLookup = this.s, visits = this.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
|
215
214
|
if (visits.length) {
|
216
|
-
let commentPrefixLen =
|
217
|
-
|
215
|
+
let commentPrefixLen = this.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
|
216
|
+
this.v = [];
|
218
217
|
let branchEnd = (branchId, visit, reference) => {
|
219
218
|
let branch = scopeLookup[branchId] ||= {}, endNode = reference;
|
220
219
|
for (; visitNodes.has(endNode = endNode.previousSibling); ) ;
|
@@ -227,16 +226,16 @@ var registeredValues = {}, Render = class {
|
|
227
226
|
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
|
228
227
|
commentPrefixLen + 1,
|
229
228
|
dataIndex ? dataIndex - 1 : commentText.length
|
230
|
-
), scope = scopeLookup[scopeId] ||= { d: +scopeId },
|
229
|
+
), scope = scopeLookup[scopeId] ||= { d: +scopeId }, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
231
230
|
if (token === "*" /* Node */) {
|
232
|
-
let node = scope[
|
233
|
-
scope[
|
231
|
+
let node = scope[data2] = visit.previousSibling;
|
232
|
+
scope[data2 + ">" /* Getter */] = () => node;
|
234
233
|
} else if (token === "$" /* ClosestBranch */)
|
235
234
|
closestBranchMarkers.set(scopeId, visit);
|
236
235
|
else if (token === "[" /* BranchStart */)
|
237
236
|
this.f && (dataIndex && branchEnd(this.f, visit, visit), this.q.push(this.f)), this.f = scopeId, scope.a = visit;
|
238
237
|
else if (token === "]" /* BranchEnd */) {
|
239
|
-
scope[
|
238
|
+
scope[data2] = visit;
|
240
239
|
let curParent = visit.parentNode, startNode = branchEnd(
|
241
240
|
this.f,
|
242
241
|
visit,
|
@@ -244,26 +243,26 @@ var registeredValues = {}, Render = class {
|
|
244
243
|
).a;
|
245
244
|
curParent !== startNode.parentNode && curParent.prepend(startNode), this.f = this.q.pop();
|
246
245
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
247
|
-
let next =
|
248
|
-
for (scope[~next ?
|
246
|
+
let next = data2.indexOf(" "), curNode = visit;
|
247
|
+
for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
249
248
|
let start = next + 1;
|
250
|
-
next =
|
251
|
-
let childScopeId =
|
249
|
+
next = data2.indexOf(" ", start);
|
250
|
+
let childScopeId = data2.slice(start, ~next ? next : data2.length);
|
252
251
|
curNode = branchEnd(childScopeId, visit, curNode).b;
|
253
252
|
}
|
254
253
|
}
|
255
254
|
}
|
256
255
|
}
|
257
|
-
let resumes =
|
256
|
+
let resumes = this.r;
|
258
257
|
if (resumes) {
|
259
|
-
|
258
|
+
this.r = [];
|
260
259
|
let len = resumes.length, i = 0;
|
261
260
|
try {
|
262
261
|
for (isResuming = !0; i < len; ) {
|
263
262
|
let resumeData = resumes[i++];
|
264
263
|
if (typeof resumeData == "function") {
|
265
264
|
let scopes = resumeData(serializeContext), { $global } = scopeLookup;
|
266
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.
|
265
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.G, $global.renderId = this.t, $global.g = 1e6);
|
267
266
|
for (let scopeId in scopes)
|
268
267
|
if (scopeId !== "$") {
|
269
268
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
@@ -274,10 +273,10 @@ var registeredValues = {}, Render = class {
|
|
274
273
|
let parentBranchId = parentBranchIds.get(scopeId);
|
275
274
|
if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
276
275
|
let branch = scope, parentBranch = branch.c;
|
277
|
-
scope.c = branch, parentBranch && (branch.
|
276
|
+
scope.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch));
|
278
277
|
}
|
279
278
|
}
|
280
|
-
} else i === len || typeof resumes[i] != "string" ? delete this.
|
279
|
+
} else i === len || typeof resumes[i] != "string" ? delete this.F[this.t] : registeredValues[resumes[i++]](
|
281
280
|
scopeLookup[resumeData],
|
282
281
|
scopeLookup[resumeData]
|
283
282
|
);
|
@@ -729,10 +728,10 @@ function finishPendingScopes() {
|
|
729
728
|
pendingScopes = [];
|
730
729
|
}
|
731
730
|
function destroyBranch(branch) {
|
732
|
-
branch.
|
731
|
+
branch.x?.n?.delete(branch), destroyNestedBranches(branch);
|
733
732
|
}
|
734
733
|
function destroyNestedBranches(branch) {
|
735
|
-
branch.
|
734
|
+
branch.y = 1, branch.n?.forEach(destroyNestedBranches), branch.H?.forEach((scope) => {
|
736
735
|
for (let id in scope.k)
|
737
736
|
scope.k[id]?.abort();
|
738
737
|
});
|
@@ -754,13 +753,13 @@ var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendi
|
|
754
753
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.d) {
|
755
754
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
756
755
|
if (existingRender)
|
757
|
-
existingRender.
|
756
|
+
existingRender.z = value2;
|
758
757
|
else {
|
759
758
|
let render = {
|
760
759
|
j: key,
|
761
|
-
|
762
|
-
|
763
|
-
|
760
|
+
A: scope,
|
761
|
+
I: signal,
|
762
|
+
z: value2
|
764
763
|
}, i = pendingRenders.push(render) - 1;
|
765
764
|
for (; i; ) {
|
766
765
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -812,7 +811,7 @@ function runRenders() {
|
|
812
811
|
}
|
813
812
|
pendingRenders[i] = item;
|
814
813
|
}
|
815
|
-
render.
|
814
|
+
render.A.c?.y || render.I(render.A, render.z);
|
816
815
|
}
|
817
816
|
finishPendingScopes();
|
818
817
|
}
|
@@ -823,7 +822,7 @@ function resetAbortSignal(scope, id) {
|
|
823
822
|
ctrl && (queueEffect(ctrl, abort), scope.k[id] = void 0);
|
824
823
|
}
|
825
824
|
function getAbortSignal(scope, id) {
|
826
|
-
return scope.c && (scope.c.
|
825
|
+
return scope.c && (scope.c.H ||= /* @__PURE__ */ new Set()).add(scope), ((scope.k ||= {})[id] ||= new AbortController()).signal;
|
827
826
|
}
|
828
827
|
function abort(ctrl) {
|
829
828
|
ctrl.abort();
|
@@ -949,7 +948,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
949
948
|
// src/dom/renderer.ts
|
950
949
|
function createBranch($global, renderer, parentScope, parentNode) {
|
951
950
|
let branch = createScope($global), parentBranch = parentScope?.c;
|
952
|
-
return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.
|
951
|
+
return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch)), renderer.o?.(
|
953
952
|
branch,
|
954
953
|
parentNode.namespaceURI
|
955
954
|
), branch;
|
@@ -961,10 +960,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
961
960
|
);
|
962
961
|
}
|
963
962
|
function setupBranch(renderer, branch) {
|
964
|
-
return (renderer.p || renderer.
|
963
|
+
return (renderer.p || renderer.B) && queueRender(
|
965
964
|
branch,
|
966
965
|
(branch2) => {
|
967
|
-
renderer.p?.(branch2), renderer.
|
966
|
+
renderer.p?.(branch2), renderer.B?.(branch2);
|
968
967
|
},
|
969
968
|
-1
|
970
969
|
), branch;
|
@@ -989,7 +988,7 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
989
988
|
l: owner,
|
990
989
|
p: setup,
|
991
990
|
e: params,
|
992
|
-
|
991
|
+
B: closures,
|
993
992
|
m: dynamicScopesAccessor
|
994
993
|
});
|
995
994
|
}
|
@@ -1074,7 +1073,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1074
1073
|
ownerScope,
|
1075
1074
|
() => {
|
1076
1075
|
for (let scope of scopes)
|
1077
|
-
!scope.h && !scope.
|
1076
|
+
!scope.h && !scope.y && childSignal(scope);
|
1078
1077
|
},
|
1079
1078
|
-1,
|
1080
1079
|
0,
|
@@ -1098,9 +1097,9 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1098
1097
|
));
|
1099
1098
|
}
|
1100
1099
|
function dynamicClosure(...closureSignals) {
|
1101
|
-
let [{
|
1100
|
+
let [{ C: ___scopeInstancesAccessor, D: ___signalIndexAccessor }] = closureSignals;
|
1102
1101
|
for (let i = closureSignals.length; i--; )
|
1103
|
-
closureSignals[i].
|
1102
|
+
closureSignals[i].J = i;
|
1104
1103
|
return (scope) => {
|
1105
1104
|
if (scope[___scopeInstancesAccessor])
|
1106
1105
|
for (let childScope of scope[___scopeInstancesAccessor])
|
@@ -1113,13 +1112,13 @@ function dynamicClosure(...closureSignals) {
|
|
1113
1112
|
}
|
1114
1113
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1115
1114
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
1116
|
-
scope[closureSignal.
|
1115
|
+
scope[closureSignal.D] = closureSignal.J, childSignal(scope), subscribeToScopeSet(
|
1117
1116
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1118
|
-
closureSignal.
|
1117
|
+
closureSignal.C,
|
1119
1118
|
scope
|
1120
1119
|
);
|
1121
1120
|
};
|
1122
|
-
return closureSignal.
|
1121
|
+
return closureSignal.C = valueAccessor + "!" /* ClosureScopes */, closureSignal.D = valueAccessor + "(" /* ClosureSignalIndex */, closureSignal;
|
1123
1122
|
}
|
1124
1123
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1125
1124
|
return (scope) => {
|
package/dist/dom.mjs
CHANGED
@@ -119,20 +119,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
|
119
119
|
var registeredValues = {}, Render = class {
|
120
120
|
q = [];
|
121
121
|
s = {};
|
122
|
-
|
122
|
+
E = {
|
123
123
|
_: registeredValues
|
124
124
|
};
|
125
125
|
constructor(renders, runtimeId, renderId) {
|
126
|
-
this.
|
126
|
+
Object.assign(this, renders[renderId]), this.F = renders, this.G = runtimeId, this.t = renderId, this.w = /* @__PURE__ */ ((w) => () => {
|
127
|
+
w(), this.u();
|
128
|
+
})(this.w), this.u();
|
127
129
|
}
|
128
|
-
|
129
|
-
this.
|
130
|
-
}
|
131
|
-
x() {
|
132
|
-
let data2 = this.u, serializeContext = this.F, scopeLookup = this.s, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
|
130
|
+
u() {
|
131
|
+
let serializeContext = this.E, scopeLookup = this.s, visits = this.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
|
133
132
|
if (visits.length) {
|
134
|
-
let commentPrefixLen =
|
135
|
-
|
133
|
+
let commentPrefixLen = this.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
|
134
|
+
this.v = [];
|
136
135
|
let branchEnd = (branchId, visit, reference) => {
|
137
136
|
let branch = scopeLookup[branchId] ||= {}, endNode = reference;
|
138
137
|
for (; visitNodes.has(endNode = endNode.previousSibling); ) ;
|
@@ -145,16 +144,16 @@ var registeredValues = {}, Render = class {
|
|
145
144
|
let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
|
146
145
|
commentPrefixLen + 1,
|
147
146
|
dataIndex ? dataIndex - 1 : commentText.length
|
148
|
-
), scope = scopeLookup[scopeId] ||= { d: +scopeId },
|
147
|
+
), scope = scopeLookup[scopeId] ||= { d: +scopeId }, data2 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
|
149
148
|
if (token === "*" /* Node */) {
|
150
|
-
let node = scope[
|
151
|
-
scope[
|
149
|
+
let node = scope[data2] = visit.previousSibling;
|
150
|
+
scope[data2 + ">" /* Getter */] = () => node;
|
152
151
|
} else if (token === "$" /* ClosestBranch */)
|
153
152
|
closestBranchMarkers.set(scopeId, visit);
|
154
153
|
else if (token === "[" /* BranchStart */)
|
155
154
|
this.f && (dataIndex && branchEnd(this.f, visit, visit), this.q.push(this.f)), this.f = scopeId, scope.a = visit;
|
156
155
|
else if (token === "]" /* BranchEnd */) {
|
157
|
-
scope[
|
156
|
+
scope[data2] = visit;
|
158
157
|
let curParent = visit.parentNode, startNode = branchEnd(
|
159
158
|
this.f,
|
160
159
|
visit,
|
@@ -162,26 +161,26 @@ var registeredValues = {}, Render = class {
|
|
162
161
|
).a;
|
163
162
|
curParent !== startNode.parentNode && curParent.prepend(startNode), this.f = this.q.pop();
|
164
163
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
165
|
-
let next =
|
166
|
-
for (scope[~next ?
|
164
|
+
let next = data2.indexOf(" "), curNode = visit;
|
165
|
+
for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
167
166
|
let start = next + 1;
|
168
|
-
next =
|
169
|
-
let childScopeId =
|
167
|
+
next = data2.indexOf(" ", start);
|
168
|
+
let childScopeId = data2.slice(start, ~next ? next : data2.length);
|
170
169
|
curNode = branchEnd(childScopeId, visit, curNode).b;
|
171
170
|
}
|
172
171
|
}
|
173
172
|
}
|
174
173
|
}
|
175
|
-
let resumes =
|
174
|
+
let resumes = this.r;
|
176
175
|
if (resumes) {
|
177
|
-
|
176
|
+
this.r = [];
|
178
177
|
let len = resumes.length, i = 0;
|
179
178
|
try {
|
180
179
|
for (isResuming = !0; i < len; ) {
|
181
180
|
let resumeData = resumes[i++];
|
182
181
|
if (typeof resumeData == "function") {
|
183
182
|
let scopes = resumeData(serializeContext), { $global } = scopeLookup;
|
184
|
-
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.
|
183
|
+
$global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.G, $global.renderId = this.t, $global.g = 1e6);
|
185
184
|
for (let scopeId in scopes)
|
186
185
|
if (scopeId !== "$") {
|
187
186
|
let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
|
@@ -192,10 +191,10 @@ var registeredValues = {}, Render = class {
|
|
192
191
|
let parentBranchId = parentBranchIds.get(scopeId);
|
193
192
|
if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
|
194
193
|
let branch = scope, parentBranch = branch.c;
|
195
|
-
scope.c = branch, parentBranch && (branch.
|
194
|
+
scope.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch));
|
196
195
|
}
|
197
196
|
}
|
198
|
-
} else i === len || typeof resumes[i] != "string" ? delete this.
|
197
|
+
} else i === len || typeof resumes[i] != "string" ? delete this.F[this.t] : registeredValues[resumes[i++]](
|
199
198
|
scopeLookup[resumeData],
|
200
199
|
scopeLookup[resumeData]
|
201
200
|
);
|
@@ -647,10 +646,10 @@ function finishPendingScopes() {
|
|
647
646
|
pendingScopes = [];
|
648
647
|
}
|
649
648
|
function destroyBranch(branch) {
|
650
|
-
branch.
|
649
|
+
branch.x?.n?.delete(branch), destroyNestedBranches(branch);
|
651
650
|
}
|
652
651
|
function destroyNestedBranches(branch) {
|
653
|
-
branch.
|
652
|
+
branch.y = 1, branch.n?.forEach(destroyNestedBranches), branch.H?.forEach((scope) => {
|
654
653
|
for (let id in scope.k)
|
655
654
|
scope.k[id]?.abort();
|
656
655
|
});
|
@@ -672,13 +671,13 @@ var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendi
|
|
672
671
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.d) {
|
673
672
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
674
673
|
if (existingRender)
|
675
|
-
existingRender.
|
674
|
+
existingRender.z = value2;
|
676
675
|
else {
|
677
676
|
let render = {
|
678
677
|
j: key,
|
679
|
-
|
680
|
-
|
681
|
-
|
678
|
+
A: scope,
|
679
|
+
I: signal,
|
680
|
+
z: value2
|
682
681
|
}, i = pendingRenders.push(render) - 1;
|
683
682
|
for (; i; ) {
|
684
683
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -730,7 +729,7 @@ function runRenders() {
|
|
730
729
|
}
|
731
730
|
pendingRenders[i] = item;
|
732
731
|
}
|
733
|
-
render.
|
732
|
+
render.A.c?.y || render.I(render.A, render.z);
|
734
733
|
}
|
735
734
|
finishPendingScopes();
|
736
735
|
}
|
@@ -741,7 +740,7 @@ function resetAbortSignal(scope, id) {
|
|
741
740
|
ctrl && (queueEffect(ctrl, abort), scope.k[id] = void 0);
|
742
741
|
}
|
743
742
|
function getAbortSignal(scope, id) {
|
744
|
-
return scope.c && (scope.c.
|
743
|
+
return scope.c && (scope.c.H ||= /* @__PURE__ */ new Set()).add(scope), ((scope.k ||= {})[id] ||= new AbortController()).signal;
|
745
744
|
}
|
746
745
|
function abort(ctrl) {
|
747
746
|
ctrl.abort();
|
@@ -867,7 +866,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
867
866
|
// src/dom/renderer.ts
|
868
867
|
function createBranch($global, renderer, parentScope, parentNode) {
|
869
868
|
let branch = createScope($global), parentBranch = parentScope?.c;
|
870
|
-
return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.
|
869
|
+
return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch)), renderer.o?.(
|
871
870
|
branch,
|
872
871
|
parentNode.namespaceURI
|
873
872
|
), branch;
|
@@ -879,10 +878,10 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
879
878
|
);
|
880
879
|
}
|
881
880
|
function setupBranch(renderer, branch) {
|
882
|
-
return (renderer.p || renderer.
|
881
|
+
return (renderer.p || renderer.B) && queueRender(
|
883
882
|
branch,
|
884
883
|
(branch2) => {
|
885
|
-
renderer.p?.(branch2), renderer.
|
884
|
+
renderer.p?.(branch2), renderer.B?.(branch2);
|
886
885
|
},
|
887
886
|
-1
|
888
887
|
), branch;
|
@@ -907,7 +906,7 @@ function createContent(id, template, walks, setup, params, closures, dynamicScop
|
|
907
906
|
l: owner,
|
908
907
|
p: setup,
|
909
908
|
e: params,
|
910
|
-
|
909
|
+
B: closures,
|
911
910
|
m: dynamicScopesAccessor
|
912
911
|
});
|
913
912
|
}
|
@@ -992,7 +991,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
992
991
|
ownerScope,
|
993
992
|
() => {
|
994
993
|
for (let scope of scopes)
|
995
|
-
!scope.h && !scope.
|
994
|
+
!scope.h && !scope.y && childSignal(scope);
|
996
995
|
},
|
997
996
|
-1,
|
998
997
|
0,
|
@@ -1016,9 +1015,9 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1016
1015
|
));
|
1017
1016
|
}
|
1018
1017
|
function dynamicClosure(...closureSignals) {
|
1019
|
-
let [{
|
1018
|
+
let [{ C: ___scopeInstancesAccessor, D: ___signalIndexAccessor }] = closureSignals;
|
1020
1019
|
for (let i = closureSignals.length; i--; )
|
1021
|
-
closureSignals[i].
|
1020
|
+
closureSignals[i].J = i;
|
1022
1021
|
return (scope) => {
|
1023
1022
|
if (scope[___scopeInstancesAccessor])
|
1024
1023
|
for (let childScope of scope[___scopeInstancesAccessor])
|
@@ -1031,13 +1030,13 @@ function dynamicClosure(...closureSignals) {
|
|
1031
1030
|
}
|
1032
1031
|
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1033
1032
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
|
1034
|
-
scope[closureSignal.
|
1033
|
+
scope[closureSignal.D] = closureSignal.J, childSignal(scope), subscribeToScopeSet(
|
1035
1034
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1036
|
-
closureSignal.
|
1035
|
+
closureSignal.C,
|
1037
1036
|
scope
|
1038
1037
|
);
|
1039
1038
|
};
|
1040
|
-
return closureSignal.
|
1039
|
+
return closureSignal.C = valueAccessor + "!" /* ClosureScopes */, closureSignal.D = valueAccessor + "(" /* ClosureSignalIndex */, closureSignal;
|
1041
1040
|
}
|
1042
1041
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1043
1042
|
return (scope) => {
|
package/dist/translator/index.js
CHANGED
@@ -3567,6 +3567,7 @@ function createBinding(name2, type, section, upstreamAlias, upstreamExpression,
|
|
3567
3567
|
closureSections: void 0,
|
3568
3568
|
excludeProperties: void 0,
|
3569
3569
|
serialize: false,
|
3570
|
+
sources: /* @__PURE__ */ new Set(),
|
3570
3571
|
aliases: /* @__PURE__ */ new Set(),
|
3571
3572
|
hoists: /* @__PURE__ */ new Map(),
|
3572
3573
|
propertyAliases: /* @__PURE__ */ new Map(),
|
@@ -3955,6 +3956,7 @@ function finalizeReferences() {
|
|
3955
3956
|
for (const binding of bindings) {
|
3956
3957
|
const { name: name2, section } = binding;
|
3957
3958
|
if (binding.type !== 0 /* dom */) {
|
3959
|
+
resolveBindingSources(binding);
|
3958
3960
|
if (find(section.bindings, ({ name: name3 }) => name3 === binding.name)) {
|
3959
3961
|
binding.name = currentProgramPath.scope.generateUid(name2);
|
3960
3962
|
}
|
@@ -3991,12 +3993,10 @@ function finalizeReferences() {
|
|
3991
3993
|
for (let j = i + 1; j < numReferences; j++) {
|
3992
3994
|
const binding1 = intersection[i];
|
3993
3995
|
const binding2 = intersection[j];
|
3994
|
-
|
3995
|
-
const sources2 = getSourceBindings(binding2);
|
3996
|
-
if (!binding1.serialize && !isSuperset(sources1, sources2)) {
|
3996
|
+
if (!binding1.serialize && !isSuperset(binding1.sources, binding2.sources)) {
|
3997
3997
|
binding1.serialize = true;
|
3998
3998
|
}
|
3999
|
-
if (!binding2.serialize && !isSuperset(
|
3999
|
+
if (!binding2.serialize && !isSuperset(binding2.sources, binding1.sources)) {
|
4000
4000
|
binding2.serialize = true;
|
4001
4001
|
}
|
4002
4002
|
}
|
@@ -4049,7 +4049,7 @@ function getMaxOwnSourceOffset(intersection, section) {
|
|
4049
4049
|
let scopeOffset;
|
4050
4050
|
for (const binding of intersection) {
|
4051
4051
|
if (binding.section === section) {
|
4052
|
-
for (const sourceBinding of
|
4052
|
+
for (const sourceBinding of binding.sources) {
|
4053
4053
|
if (sourceBinding.scopeOffset && (!scopeOffset || scopeOffset.id < sourceBinding.scopeOffset.id)) {
|
4054
4054
|
scopeOffset = sourceBinding.scopeOffset;
|
4055
4055
|
}
|
@@ -4067,11 +4067,10 @@ function isSuperset(set, subset) {
|
|
4067
4067
|
}
|
4068
4068
|
return true;
|
4069
4069
|
}
|
4070
|
-
function
|
4070
|
+
function resolveBindingSources(binding) {
|
4071
4071
|
const derived = /* @__PURE__ */ new Set();
|
4072
|
-
const sources =
|
4072
|
+
const { sources } = binding;
|
4073
4073
|
crawl(binding);
|
4074
|
-
return sources;
|
4075
4074
|
function crawl(binding2) {
|
4076
4075
|
if (binding2.type === 4 /* derived */ || binding2.type === 3 /* param */) {
|
4077
4076
|
let alias;
|
@@ -5288,10 +5287,13 @@ var native_tag_default = {
|
|
5288
5287
|
} else {
|
5289
5288
|
tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
|
5290
5289
|
}
|
5290
|
+
const shouldMark = nodeRef2 && (extra[kSerializeMarker] || extra[kSerializeMarker] === void 0 && (isStatefulReferences(extra.referencedBindings) || tag.node.attributes.some(
|
5291
|
+
(attr2) => isStatefulReferences(attr2.value.extra?.referencedBindings)
|
5292
|
+
)));
|
5291
5293
|
if (!openTagOnly && !selectArgs) {
|
5292
5294
|
writeTo(
|
5293
5295
|
tag,
|
5294
|
-
isHTML && (tagName === "html" || tagName === "body")
|
5296
|
+
isHTML && !shouldMark && (tagName === "html" || tagName === "body")
|
5295
5297
|
)`</${tag.node.name}>`;
|
5296
5298
|
}
|
5297
5299
|
if (isHTML && extra.tagNameNullable) {
|
@@ -5299,9 +5301,7 @@ var native_tag_default = {
|
|
5299
5301
|
import_compiler29.types.ifStatement(tag.node.name, consumeHTML(tag))
|
5300
5302
|
)[0].skip();
|
5301
5303
|
}
|
5302
|
-
if (
|
5303
|
-
(attr2) => isStatefulReferences(attr2.value.extra?.referencedBindings)
|
5304
|
-
)))) {
|
5304
|
+
if (shouldMark) {
|
5305
5305
|
markNode(tag, nodeRef2);
|
5306
5306
|
}
|
5307
5307
|
exit2(tag);
|
@@ -21,6 +21,7 @@ export type Binding = {
|
|
21
21
|
section: Section;
|
22
22
|
closureSections: Opt<Section>;
|
23
23
|
serialize: boolean;
|
24
|
+
sources: Set<Binding>;
|
24
25
|
aliases: Set<Binding>;
|
25
26
|
hoists: Map<Section, Binding>;
|
26
27
|
property: string | undefined;
|
@@ -72,7 +73,6 @@ export declare const intersectionMeta: WeakMap<Intersection, {
|
|
72
73
|
id: number;
|
73
74
|
scopeOffset: Binding | undefined;
|
74
75
|
}>;
|
75
|
-
export declare function getSourceBindings(binding: Binding): Set<Binding>;
|
76
76
|
export declare const bindingUtil: Sorted<Binding>;
|
77
77
|
export declare function addReadToExpression(path: t.NodePath, binding: Binding, node?: t.Identifier | t.MemberExpression): ReferencedExtra;
|
78
78
|
export declare function dropReferences(node: t.Node | t.Node[]): void;
|