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.
@@ -21,5 +21,6 @@ export declare enum AccessorProp {
21
21
  PlaceholderBranch = "c",
22
22
  PlaceholderContent = "d",
23
23
  TagVariable = "e",
24
- TagVariableChange = "f"
24
+ TagVariableChange = "f",
25
+ ClosestBranchId = "g"
25
26
  }
@@ -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
  }
@@ -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 scopeStack = [];
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
- const closestBranchMarkers = /* @__PURE__ */ new Map();
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
- render.v = [];
289
- const branchEnd = (branchId, visit, reference) => {
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 visits) {
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 (currentScopeId) {
330
- if (dataIndex) {
331
- branchEnd(currentScopeId, visit, visit);
332
- }
333
- scopeStack.push(currentScopeId);
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
- currentScopeId = scopeId;
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
- currentScopeId,
342
- visit,
333
+ currentBranchId,
343
334
  visit
344
335
  ).___startNode;
345
336
  if (curParent !== startNode.parentNode) {
346
337
  curParent.prepend(startNode);
347
338
  }
348
- currentScopeId = scopeStack.pop();
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, visit, curNode).___endNode;
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
  }
@@ -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 scopeStack = [];
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
- const closestBranchMarkers = /* @__PURE__ */ new Map();
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
- render.v = [];
201
- const branchEnd = (branchId, visit, reference) => {
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 visits) {
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 (currentScopeId) {
242
- if (dataIndex) {
243
- branchEnd(currentScopeId, visit, visit);
244
- }
245
- scopeStack.push(currentScopeId);
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
- currentScopeId = scopeId;
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
- currentScopeId,
254
- visit,
245
+ currentBranchId,
255
246
  visit
256
247
  ).___startNode;
257
248
  if (curParent !== startNode.parentNode) {
258
249
  curParent.prepend(startNode);
259
250
  }
260
- currentScopeId = scopeStack.pop();
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, visit, curNode).___endNode;
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
  }
@@ -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
- $chunk.writeHTML(
1746
- $chunk.boundary.state.mark("$" /* ClosestBranch */, "" + scopeId)
1747
- );
1745
+ writeScope(scopeId, {
1746
+ ["#ClosestBranchId" /* ClosestBranchId */]: branchId
1747
+ });
1748
1748
  }
1749
1749
  }
1750
1750
  var branchIdKey = Symbol();
@@ -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
- $chunk.writeHTML(
1662
- $chunk.boundary.state.mark("$" /* ClosestBranch */, "" + scopeId)
1663
- );
1661
+ writeScope(scopeId, {
1662
+ ["#ClosestBranchId" /* ClosestBranchId */]: branchId
1663
+ });
1664
1664
  }
1665
1665
  }
1666
1666
  var branchIdKey = Symbol();