marko 6.0.0-next.3.53 → 6.0.0-next.3.55
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 +19 -19
- package/dist/debug/dom.mjs +19 -19
- package/dist/dom.js +36 -37
- package/dist/dom.mjs +36 -37
- package/dist/translator/index.js +7 -8
- package/dist/translator/util/references.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -245,30 +245,30 @@ 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
|
-
this.___resume();
|
253
|
-
}
|
254
|
-
w() {
|
255
|
-
this.___data.w();
|
252
|
+
this.___walk = this.w;
|
256
253
|
this.___resume();
|
254
|
+
this.w = () => {
|
255
|
+
this.___walk();
|
256
|
+
this.___resume();
|
257
|
+
};
|
257
258
|
}
|
258
259
|
___resume() {
|
259
|
-
const data2 = this.___data;
|
260
260
|
const serializeContext = this.___serializeContext;
|
261
261
|
const scopeLookup = this.___scopeLookup;
|
262
|
-
const visits =
|
262
|
+
const visits = this.v;
|
263
263
|
const branchIds = /* @__PURE__ */ new Set();
|
264
264
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
265
265
|
if (visits.length) {
|
266
|
-
const commentPrefix =
|
266
|
+
const commentPrefix = this.i;
|
267
267
|
const commentPrefixLen = commentPrefix.length;
|
268
268
|
const closestBranchMarkers = /* @__PURE__ */ new Map();
|
269
269
|
const visitNodes = new Set(visits);
|
270
270
|
let lastEndNode;
|
271
|
-
|
271
|
+
this.v = [];
|
272
272
|
const branchEnd = (branchId, visit, reference) => {
|
273
273
|
const branch = scopeLookup[branchId] ||= {};
|
274
274
|
let endNode = reference;
|
@@ -296,11 +296,11 @@ var Render = class {
|
|
296
296
|
dataIndex ? dataIndex - 1 : commentText.length
|
297
297
|
);
|
298
298
|
const scope = scopeLookup[scopeId] ||= { ___id: +scopeId };
|
299
|
-
const
|
299
|
+
const data2 = dataIndex ? commentText.slice(dataIndex) : "";
|
300
300
|
const token = commentText[commentPrefixLen];
|
301
301
|
if (token === "*" /* Node */) {
|
302
|
-
const node = scope[
|
303
|
-
scope[
|
302
|
+
const node = scope[data2] = visit.previousSibling;
|
303
|
+
scope[data2 + ">" /* Getter */] = () => node;
|
304
304
|
} else if (token === "$" /* ClosestBranch */) {
|
305
305
|
closestBranchMarkers.set(scopeId, visit);
|
306
306
|
} else if (token === "[" /* BranchStart */) {
|
@@ -313,7 +313,7 @@ var Render = class {
|
|
313
313
|
this.___currentScopeId = scopeId;
|
314
314
|
scope.___startNode = visit;
|
315
315
|
} else if (token === "]" /* BranchEnd */) {
|
316
|
-
scope[
|
316
|
+
scope[data2] = visit;
|
317
317
|
const curParent = visit.parentNode;
|
318
318
|
const startNode = branchEnd(
|
319
319
|
this.___currentScopeId,
|
@@ -325,21 +325,21 @@ var Render = class {
|
|
325
325
|
}
|
326
326
|
this.___currentScopeId = this.___scopeStack.pop();
|
327
327
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
328
|
-
let next =
|
328
|
+
let next = data2.indexOf(" ");
|
329
329
|
let curNode = visit;
|
330
|
-
scope[~next ?
|
330
|
+
scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
|
331
331
|
while (~next) {
|
332
332
|
const start = next + 1;
|
333
|
-
next =
|
334
|
-
const childScopeId =
|
333
|
+
next = data2.indexOf(" ", start);
|
334
|
+
const childScopeId = data2.slice(start, ~next ? next : data2.length);
|
335
335
|
curNode = branchEnd(childScopeId, visit, curNode).___endNode;
|
336
336
|
}
|
337
337
|
}
|
338
338
|
}
|
339
339
|
}
|
340
|
-
const resumes =
|
340
|
+
const resumes = this.r;
|
341
341
|
if (resumes) {
|
342
|
-
|
342
|
+
this.r = [];
|
343
343
|
const len = resumes.length;
|
344
344
|
let i = 0;
|
345
345
|
try {
|
package/dist/debug/dom.mjs
CHANGED
@@ -160,30 +160,30 @@ 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
|
-
this.___resume();
|
168
|
-
}
|
169
|
-
w() {
|
170
|
-
this.___data.w();
|
167
|
+
this.___walk = this.w;
|
171
168
|
this.___resume();
|
169
|
+
this.w = () => {
|
170
|
+
this.___walk();
|
171
|
+
this.___resume();
|
172
|
+
};
|
172
173
|
}
|
173
174
|
___resume() {
|
174
|
-
const data2 = this.___data;
|
175
175
|
const serializeContext = this.___serializeContext;
|
176
176
|
const scopeLookup = this.___scopeLookup;
|
177
|
-
const visits =
|
177
|
+
const visits = this.v;
|
178
178
|
const branchIds = /* @__PURE__ */ new Set();
|
179
179
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
180
180
|
if (visits.length) {
|
181
|
-
const commentPrefix =
|
181
|
+
const commentPrefix = this.i;
|
182
182
|
const commentPrefixLen = commentPrefix.length;
|
183
183
|
const closestBranchMarkers = /* @__PURE__ */ new Map();
|
184
184
|
const visitNodes = new Set(visits);
|
185
185
|
let lastEndNode;
|
186
|
-
|
186
|
+
this.v = [];
|
187
187
|
const branchEnd = (branchId, visit, reference) => {
|
188
188
|
const branch = scopeLookup[branchId] ||= {};
|
189
189
|
let endNode = reference;
|
@@ -211,11 +211,11 @@ var Render = class {
|
|
211
211
|
dataIndex ? dataIndex - 1 : commentText.length
|
212
212
|
);
|
213
213
|
const scope = scopeLookup[scopeId] ||= { ___id: +scopeId };
|
214
|
-
const
|
214
|
+
const data2 = dataIndex ? commentText.slice(dataIndex) : "";
|
215
215
|
const token = commentText[commentPrefixLen];
|
216
216
|
if (token === "*" /* Node */) {
|
217
|
-
const node = scope[
|
218
|
-
scope[
|
217
|
+
const node = scope[data2] = visit.previousSibling;
|
218
|
+
scope[data2 + ">" /* Getter */] = () => node;
|
219
219
|
} else if (token === "$" /* ClosestBranch */) {
|
220
220
|
closestBranchMarkers.set(scopeId, visit);
|
221
221
|
} else if (token === "[" /* BranchStart */) {
|
@@ -228,7 +228,7 @@ var Render = class {
|
|
228
228
|
this.___currentScopeId = scopeId;
|
229
229
|
scope.___startNode = visit;
|
230
230
|
} else if (token === "]" /* BranchEnd */) {
|
231
|
-
scope[
|
231
|
+
scope[data2] = visit;
|
232
232
|
const curParent = visit.parentNode;
|
233
233
|
const startNode = branchEnd(
|
234
234
|
this.___currentScopeId,
|
@@ -240,21 +240,21 @@ var Render = class {
|
|
240
240
|
}
|
241
241
|
this.___currentScopeId = this.___scopeStack.pop();
|
242
242
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
243
|
-
let next =
|
243
|
+
let next = data2.indexOf(" ");
|
244
244
|
let curNode = visit;
|
245
|
-
scope[~next ?
|
245
|
+
scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
|
246
246
|
while (~next) {
|
247
247
|
const start = next + 1;
|
248
|
-
next =
|
249
|
-
const childScopeId =
|
248
|
+
next = data2.indexOf(" ", start);
|
249
|
+
const childScopeId = data2.slice(start, ~next ? next : data2.length);
|
250
250
|
curNode = branchEnd(childScopeId, visit, curNode).___endNode;
|
251
251
|
}
|
252
252
|
}
|
253
253
|
}
|
254
254
|
}
|
255
|
-
const resumes =
|
255
|
+
const resumes = this.r;
|
256
256
|
if (resumes) {
|
257
|
-
|
257
|
+
this.r = [];
|
258
258
|
const len = resumes.length;
|
259
259
|
let i = 0;
|
260
260
|
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.H = this.w, this.u(), this.w = () => {
|
209
|
+
this.H(), this.u();
|
210
|
+
};
|
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.I?.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
|
-
|
760
|
+
A: scope,
|
762
761
|
J: signal,
|
763
|
-
|
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.J(render.A, render.z);
|
816
815
|
}
|
817
816
|
finishPendingScopes();
|
818
817
|
}
|
@@ -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,7 +1097,7 @@ 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
1102
|
closureSignals[i].K = i;
|
1104
1103
|
return (scope) => {
|
@@ -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.K, 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.H = this.w, this.u(), this.w = () => {
|
127
|
+
this.H(), this.u();
|
128
|
+
};
|
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.I?.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
|
-
|
678
|
+
A: scope,
|
680
679
|
J: signal,
|
681
|
-
|
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.J(render.A, render.z);
|
734
733
|
}
|
735
734
|
finishPendingScopes();
|
736
735
|
}
|
@@ -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,7 +1015,7 @@ 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
1020
|
closureSignals[i].K = i;
|
1022
1021
|
return (scope) => {
|
@@ -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.K, 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;
|
@@ -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;
|