marko 6.0.0-next.3.64 → 6.0.0-next.3.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/accessor.d.ts +2 -1
- package/dist/common/accessor.debug.d.ts +2 -1
- package/dist/common/types.d.ts +1 -2
- package/dist/debug/dom.js +18 -26
- package/dist/debug/dom.mjs +18 -26
- package/dist/debug/html.js +3 -3
- package/dist/debug/html.mjs +3 -3
- package/dist/dom.js +128 -134
- package/dist/dom.mjs +128 -134
- package/dist/html.js +6 -6
- package/dist/html.mjs +6 -6
- package/dist/translator/index.js +2 -0
- package/package.json +1 -1
@@ -21,5 +21,6 @@ export declare enum AccessorProp {
|
|
21
21
|
PlaceholderBranch = "#PlaceholderBranch",
|
22
22
|
PlaceholderContent = "#PlaceholderContent",
|
23
23
|
TagVariable = "#TagVariable",
|
24
|
-
TagVariableChange = "#TagVariableChange"
|
24
|
+
TagVariableChange = "#TagVariableChange",
|
25
|
+
ClosestBranchId = "#ClosestBranchId"
|
25
26
|
}
|
package/dist/common/types.d.ts
CHANGED
@@ -29,8 +29,7 @@ export declare enum ResumeSymbol {
|
|
29
29
|
BranchStart = "[",
|
30
30
|
BranchEnd = "]",
|
31
31
|
BranchSingleNode = "|",
|
32
|
-
BranchSingleNodeOnlyChildInParent = "="
|
33
|
-
ClosestBranch = "$"
|
32
|
+
BranchSingleNodeOnlyChildInParent = "="
|
34
33
|
}
|
35
34
|
export { AccessorPrefix, AccessorProp } from "./accessor.debug";
|
36
35
|
export declare enum NodeType {
|
package/dist/debug/dom.js
CHANGED
@@ -269,15 +269,14 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
269
269
|
const render = resumeRender[renderId] = renders2[renderId] || renders2(renderId);
|
270
270
|
const walk2 = render.w;
|
271
271
|
const commentPrefixLen = render.i.length;
|
272
|
-
const
|
272
|
+
const branchStack = [];
|
273
273
|
const scopeLookup = render.s = {};
|
274
274
|
const serializeContext = {
|
275
275
|
_: registeredValues
|
276
276
|
};
|
277
277
|
const branchIds = /* @__PURE__ */ new Set();
|
278
278
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
279
|
-
|
280
|
-
let currentScopeId;
|
279
|
+
let currentBranchId;
|
281
280
|
render.w = () => {
|
282
281
|
walk2.call(render);
|
283
282
|
const visits = render.v;
|
@@ -285,8 +284,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
285
284
|
if (visits.length) {
|
286
285
|
const visitNodes = new Set(visits);
|
287
286
|
let lastEndNode;
|
288
|
-
|
289
|
-
const branchEnd = (branchId,
|
287
|
+
visits.length = 0;
|
288
|
+
const branchEnd = (branchId, reference) => {
|
290
289
|
const branch = scopeLookup[branchId] ||= {};
|
291
290
|
let endNode = reference;
|
292
291
|
while (visitNodes.has(endNode = endNode.previousSibling)) ;
|
@@ -298,17 +297,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
298
297
|
}
|
299
298
|
branch.___endNode = lastEndNode = endNode;
|
300
299
|
branch.___startNode ||= endNode;
|
301
|
-
for (const [markerScopeId, markerNode] of closestBranchMarkers) {
|
302
|
-
if (branch.___startNode.compareDocumentPosition(markerNode) & 4 && reference.compareDocumentPosition(markerNode) & 2) {
|
303
|
-
parentBranchIds.set(markerScopeId, branchId);
|
304
|
-
closestBranchMarkers.delete(markerScopeId);
|
305
|
-
}
|
306
|
-
}
|
307
300
|
branchIds.add(branchId);
|
308
|
-
closestBranchMarkers.set(branchId, visit);
|
309
301
|
return branch;
|
310
302
|
};
|
311
|
-
for (const visit of
|
303
|
+
for (const visit of visitNodes) {
|
312
304
|
const commentText = visit.data;
|
313
305
|
const dataIndex = commentText.indexOf(" ") + 1;
|
314
306
|
const scopeId = commentText.slice(
|
@@ -323,29 +315,28 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
323
315
|
if (token === "*" /* Node */) {
|
324
316
|
const node = scope[data2] = visit.previousSibling;
|
325
317
|
scope["Getter:" /* Getter */ + data2] = () => node;
|
326
|
-
} else if (token === "$" /* ClosestBranch */) {
|
327
|
-
closestBranchMarkers.set(scopeId, visit);
|
328
318
|
} else if (token === "[" /* BranchStart */) {
|
329
|
-
if (
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
319
|
+
if (currentBranchId && dataIndex) {
|
320
|
+
branchEnd(currentBranchId, visit);
|
321
|
+
currentBranchId = branchStack.pop();
|
322
|
+
}
|
323
|
+
if (currentBranchId) {
|
324
|
+
branchStack.push(currentBranchId);
|
325
|
+
parentBranchIds.set(scopeId, currentBranchId);
|
334
326
|
}
|
335
|
-
|
327
|
+
currentBranchId = scopeId;
|
336
328
|
scope.___startNode = visit;
|
337
329
|
} else if (token === "]" /* BranchEnd */) {
|
338
330
|
scope[data2] = visit;
|
339
331
|
const curParent = visit.parentNode;
|
340
332
|
const startNode = branchEnd(
|
341
|
-
|
342
|
-
visit,
|
333
|
+
currentBranchId,
|
343
334
|
visit
|
344
335
|
).___startNode;
|
345
336
|
if (curParent !== startNode.parentNode) {
|
346
337
|
curParent.prepend(startNode);
|
347
338
|
}
|
348
|
-
|
339
|
+
currentBranchId = branchStack.pop();
|
349
340
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
350
341
|
let next = data2.indexOf(" ");
|
351
342
|
let curNode = visit;
|
@@ -357,7 +348,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
357
348
|
start,
|
358
349
|
~next ? next : data2.length
|
359
350
|
);
|
360
|
-
curNode = branchEnd(childScopeId,
|
351
|
+
curNode = branchEnd(childScopeId, curNode).___endNode;
|
352
|
+
parentBranchIds.set(childScopeId, scopeId);
|
361
353
|
}
|
362
354
|
}
|
363
355
|
}
|
@@ -389,7 +381,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
389
381
|
prevScope
|
390
382
|
);
|
391
383
|
}
|
392
|
-
const parentBranchId = parentBranchIds.get(scopeId);
|
384
|
+
const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
|
393
385
|
if (parentBranchId) {
|
394
386
|
scope.___closestBranch = scopes[parentBranchId];
|
395
387
|
}
|
package/dist/debug/dom.mjs
CHANGED
@@ -181,15 +181,14 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
181
181
|
const render = resumeRender[renderId] = renders2[renderId] || renders2(renderId);
|
182
182
|
const walk2 = render.w;
|
183
183
|
const commentPrefixLen = render.i.length;
|
184
|
-
const
|
184
|
+
const branchStack = [];
|
185
185
|
const scopeLookup = render.s = {};
|
186
186
|
const serializeContext = {
|
187
187
|
_: registeredValues
|
188
188
|
};
|
189
189
|
const branchIds = /* @__PURE__ */ new Set();
|
190
190
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
191
|
-
|
192
|
-
let currentScopeId;
|
191
|
+
let currentBranchId;
|
193
192
|
render.w = () => {
|
194
193
|
walk2.call(render);
|
195
194
|
const visits = render.v;
|
@@ -197,8 +196,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
197
196
|
if (visits.length) {
|
198
197
|
const visitNodes = new Set(visits);
|
199
198
|
let lastEndNode;
|
200
|
-
|
201
|
-
const branchEnd = (branchId,
|
199
|
+
visits.length = 0;
|
200
|
+
const branchEnd = (branchId, reference) => {
|
202
201
|
const branch = scopeLookup[branchId] ||= {};
|
203
202
|
let endNode = reference;
|
204
203
|
while (visitNodes.has(endNode = endNode.previousSibling)) ;
|
@@ -210,17 +209,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
210
209
|
}
|
211
210
|
branch.___endNode = lastEndNode = endNode;
|
212
211
|
branch.___startNode ||= endNode;
|
213
|
-
for (const [markerScopeId, markerNode] of closestBranchMarkers) {
|
214
|
-
if (branch.___startNode.compareDocumentPosition(markerNode) & 4 && reference.compareDocumentPosition(markerNode) & 2) {
|
215
|
-
parentBranchIds.set(markerScopeId, branchId);
|
216
|
-
closestBranchMarkers.delete(markerScopeId);
|
217
|
-
}
|
218
|
-
}
|
219
212
|
branchIds.add(branchId);
|
220
|
-
closestBranchMarkers.set(branchId, visit);
|
221
213
|
return branch;
|
222
214
|
};
|
223
|
-
for (const visit of
|
215
|
+
for (const visit of visitNodes) {
|
224
216
|
const commentText = visit.data;
|
225
217
|
const dataIndex = commentText.indexOf(" ") + 1;
|
226
218
|
const scopeId = commentText.slice(
|
@@ -235,29 +227,28 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
235
227
|
if (token === "*" /* Node */) {
|
236
228
|
const node = scope[data2] = visit.previousSibling;
|
237
229
|
scope["Getter:" /* Getter */ + data2] = () => node;
|
238
|
-
} else if (token === "$" /* ClosestBranch */) {
|
239
|
-
closestBranchMarkers.set(scopeId, visit);
|
240
230
|
} else if (token === "[" /* BranchStart */) {
|
241
|
-
if (
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
231
|
+
if (currentBranchId && dataIndex) {
|
232
|
+
branchEnd(currentBranchId, visit);
|
233
|
+
currentBranchId = branchStack.pop();
|
234
|
+
}
|
235
|
+
if (currentBranchId) {
|
236
|
+
branchStack.push(currentBranchId);
|
237
|
+
parentBranchIds.set(scopeId, currentBranchId);
|
246
238
|
}
|
247
|
-
|
239
|
+
currentBranchId = scopeId;
|
248
240
|
scope.___startNode = visit;
|
249
241
|
} else if (token === "]" /* BranchEnd */) {
|
250
242
|
scope[data2] = visit;
|
251
243
|
const curParent = visit.parentNode;
|
252
244
|
const startNode = branchEnd(
|
253
|
-
|
254
|
-
visit,
|
245
|
+
currentBranchId,
|
255
246
|
visit
|
256
247
|
).___startNode;
|
257
248
|
if (curParent !== startNode.parentNode) {
|
258
249
|
curParent.prepend(startNode);
|
259
250
|
}
|
260
|
-
|
251
|
+
currentBranchId = branchStack.pop();
|
261
252
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
262
253
|
let next = data2.indexOf(" ");
|
263
254
|
let curNode = visit;
|
@@ -269,7 +260,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
269
260
|
start,
|
270
261
|
~next ? next : data2.length
|
271
262
|
);
|
272
|
-
curNode = branchEnd(childScopeId,
|
263
|
+
curNode = branchEnd(childScopeId, curNode).___endNode;
|
264
|
+
parentBranchIds.set(childScopeId, scopeId);
|
273
265
|
}
|
274
266
|
}
|
275
267
|
}
|
@@ -301,7 +293,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
301
293
|
prevScope
|
302
294
|
);
|
303
295
|
}
|
304
|
-
const parentBranchId = parentBranchIds.get(scopeId);
|
296
|
+
const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
|
305
297
|
if (parentBranchId) {
|
306
298
|
scope.___closestBranch = scopes[parentBranchId];
|
307
299
|
}
|
package/dist/debug/html.js
CHANGED
@@ -1742,9 +1742,9 @@ function hoist(scopeId, id) {
|
|
1742
1742
|
function resumeClosestBranch(scopeId) {
|
1743
1743
|
const branchId = $chunk.context?.[branchIdKey];
|
1744
1744
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1745
|
-
|
1746
|
-
|
1747
|
-
);
|
1745
|
+
writeScope(scopeId, {
|
1746
|
+
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1747
|
+
});
|
1748
1748
|
}
|
1749
1749
|
}
|
1750
1750
|
var branchIdKey = Symbol();
|
package/dist/debug/html.mjs
CHANGED
@@ -1658,9 +1658,9 @@ function hoist(scopeId, id) {
|
|
1658
1658
|
function resumeClosestBranch(scopeId) {
|
1659
1659
|
const branchId = $chunk.context?.[branchIdKey];
|
1660
1660
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1661
|
-
|
1662
|
-
|
1663
|
-
);
|
1661
|
+
writeScope(scopeId, {
|
1662
|
+
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1663
|
+
});
|
1664
1664
|
}
|
1665
1665
|
}
|
1666
1666
|
var branchIdKey = Symbol();
|