marko 6.0.87 → 6.0.88

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 CHANGED
@@ -1754,8 +1754,10 @@ function _await(nodeAccessor, renderer) {
1754
1754
  );
1755
1755
  removeAndDestroyBranch(placeholderBranch);
1756
1756
  }
1757
- if (tryWithPlaceholder.___effects) {
1758
- runEffects(tryWithPlaceholder.___effects, true);
1757
+ const pendingEffects2 = tryWithPlaceholder.___effects;
1758
+ if (pendingEffects2) {
1759
+ tryWithPlaceholder.___effects = [];
1760
+ runEffects(pendingEffects2, true);
1759
1761
  }
1760
1762
  }
1761
1763
  }
@@ -2100,14 +2102,14 @@ function prepareEffects(fn) {
2100
2102
  }
2101
2103
  return preparedEffects;
2102
2104
  }
2103
- var runEffects = (effects) => {
2105
+ var runEffects = ((effects) => {
2104
2106
  for (let i = 0, scope; i < effects.length; ) {
2105
2107
  effects[i++](
2106
2108
  scope = effects[i++],
2107
2109
  scope
2108
2110
  );
2109
2111
  }
2110
- };
2112
+ });
2111
2113
  function runRenders() {
2112
2114
  while (pendingRenders.length) {
2113
2115
  const render = pendingRenders[0];
@@ -1654,8 +1654,10 @@ function _await(nodeAccessor, renderer) {
1654
1654
  );
1655
1655
  removeAndDestroyBranch(placeholderBranch);
1656
1656
  }
1657
- if (tryWithPlaceholder.___effects) {
1658
- runEffects(tryWithPlaceholder.___effects, true);
1657
+ const pendingEffects2 = tryWithPlaceholder.___effects;
1658
+ if (pendingEffects2) {
1659
+ tryWithPlaceholder.___effects = [];
1660
+ runEffects(pendingEffects2, true);
1659
1661
  }
1660
1662
  }
1661
1663
  }
@@ -2000,14 +2002,14 @@ function prepareEffects(fn) {
2000
2002
  }
2001
2003
  return preparedEffects;
2002
2004
  }
2003
- var runEffects = (effects) => {
2005
+ var runEffects = ((effects) => {
2004
2006
  for (let i = 0, scope; i < effects.length; ) {
2005
2007
  effects[i++](
2006
2008
  scope = effects[i++],
2007
2009
  scope
2008
2010
  );
2009
2011
  }
2010
- };
2012
+ });
2011
2013
  function runRenders() {
2012
2014
  while (pendingRenders.length) {
2013
2015
  const render = pendingRenders[0];
@@ -285,65 +285,64 @@ var WALKER_RUNTIME_CODE = true ? (
285
285
  },
286
286
  })
287
287
  ), self[runtimeId]))`
288
- ) : `(e=>(self[e]||(self[e]=(l,s=e+l,f=s.length,o={},d=[],n=document,t=n.createTreeWalker(n,129))=>n=self[e][l]={i:s,d:n,l:o,v:d,x(){},w(e,l,a){for(;e=t.nextNode();)n.x(l=(l=e.data)&&!l.indexOf(s)&&(o[a=l.slice(f+1)]=e,l[f]),a,e),l>"#"&&d.push(e)}}),self[e]))`;
288
+ ) : `(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>"#"&&d.push(e)}}),self[e]))`;
289
289
  var REORDER_RUNTIME_CODE = true ? (
290
290
  /* js */
291
291
  `((runtime) => {
292
- if (runtime.j) return;
293
- let onNextSibling,
294
- placeholder,
295
- nextSibling,
296
- placeholders = {},
297
- replace = (marker, container) => {
298
- marker.replaceWith(...container.childNodes);
299
- container.remove();
300
- };
301
- runtime.d.head.append(
302
- runtime.d.querySelector("style[" + runtime.i + "]") || "",
303
- );
304
- runtime.j = {};
305
- runtime.x = (op, id, node, start, placeholderCallback) => {
306
- if (op == "#") {
307
- (placeholders[id] = placeholder).i++;
308
- } else if (node == nextSibling) {
309
- onNextSibling();
310
- }
311
-
312
- if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
313
- start = runtime.l["^" + id];
314
-
315
- if (start) {
316
- placeholders[id] = {
317
- i: 1,
318
- c(end = runtime.l[id] || node) {
319
- for (
320
- ;
321
- (nextSibling = end.previousSibling || start).remove(),
322
- start != nextSibling;
323
- );
324
- replace(end, node);
325
- },
326
- };
292
+ if (runtime.j) return;
293
+ let onNextSibling,
294
+ placeholder,
295
+ nextSibling,
296
+ placeholders = {},
297
+ replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);
298
+ runtime.d.head.append(
299
+ runtime.d.querySelector("style[" + runtime.i + "]") || ""
300
+ );
301
+ runtime.j = {};
302
+ runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {
303
+ if (node == nextSibling) {
304
+ onNextSibling();
327
305
  }
328
306
 
329
- nextSibling = node.nextSibling;
330
- placeholder = placeholders[id];
331
- onNextSibling = () => {
332
- start || replace(runtime.l[id], node);
333
- if (!--placeholder.i) {
334
- placeholder.c();
307
+ if (op == "#") {
308
+ (placeholders[id] = placeholder).i++;
309
+ } else if (op == "!") {
310
+ if (runtime.l[id] && placeholders[id]) {
311
+ placeholders[id].c();
335
312
  }
336
- };
313
+ } else if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
314
+ nextSibling = node.nextSibling;
315
+ onNextSibling = () => {
316
+ node.remove();
317
+ placeholderRoot || replace(id, node);
318
+ placeholder.c();
319
+ };
320
+ placeholder =
321
+ placeholders[id] ||
322
+ (placeholderRoot = placeholders[id] =
323
+ {
324
+ i: runtime.l[id] ? 1 : 2,
325
+ c(start = runtime.l["^" + id]) {
326
+ if (--placeholderRoot.i) return 1;
327
+ for (
328
+ ;
329
+ (nextSibling =
330
+ runtime.l[id].previousSibling || start).remove(),
331
+ start != nextSibling;
337
332
 
338
- // repurpose "op" for callbacks ...carefully
339
- if (op = runtime.j[id]) {
340
- placeholderCallback = placeholder.c;
341
- placeholder.c = () => placeholderCallback() + op(runtime.r);
333
+ );
334
+ replace(id, node);
335
+ },
336
+ });
337
+ // repurpose "op" for callbacks ...carefully
338
+ if ((op = runtime.j[id])) {
339
+ placeholderCb = placeholder.c;
340
+ placeholder.c = () => placeholderCb() || op(runtime.r);
341
+ }
342
342
  }
343
- }
344
- };
343
+ };
345
344
  })`
346
- ) : `(e=>{if(e.j)return;let i,o,l,r={},t=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(c,d,n,a,g)=>{"#"==c?(r[d]=o).i++:n==l&&i(),"T"==n.tagName&&(d=n.getAttribute(e.i))&&((a=e.l["^"+d])&&(r[d]={i:1,c(i=e.l[d]||n){for(;(l=i.previousSibling||a).remove(),a!=l;);t(i,n)}}),l=n.nextSibling,o=r[d],i=()=>{a||t(e.l[d],n),--o.i||o.c()},(c=e.j[d])&&(g=o.c,o.c=()=>g()+c(e.r)))}})`;
345
+ ) : `(e=>{if(e.j)return;let i,r,l,t={},c=(i,r)=>e.l[i].replaceWith(...r.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(a,d,n,o,u)=>{n==l&&i(),"#"==a?(t[d]=r).i++:"!"==a?e.l[d]&&t[d]&&t[d].c():"T"==n.tagName&&(d=n.getAttribute(e.i))&&(l=n.nextSibling,i=()=>{n.remove(),o||c(d,n),r.c()},r=t[d]||(o=t[d]={i:e.l[d]?1:2,c(i=e.l["^"+d]){if(--o.i)return 1;for(;(l=e.l[d].previousSibling||i).remove(),i!=l;);c(d,n)}}),(a=e.j[d])&&(u=r.c,r.c=()=>u()||a(e.r)))}})`;
347
346
 
348
347
  // src/html/serializer.ts
349
348
  var kTouchedIterator = Symbol();
@@ -2260,6 +2259,7 @@ function tryCatch(content, catchContent) {
2260
2259
  writeMarker = false;
2261
2260
  cur.async = false;
2262
2261
  cur.next = bodyNext;
2262
+ cur.needsWalk = true;
2263
2263
  cur.html = endMarker;
2264
2264
  cur.scripts = cur.effects = cur.lastEffect = "";
2265
2265
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
@@ -2390,6 +2390,7 @@ var Chunk = class {
2390
2390
  lastEffect = "";
2391
2391
  async = false;
2392
2392
  consumed = false;
2393
+ needsWalk = false;
2393
2394
  reorderId = null;
2394
2395
  placeholderBody = null;
2395
2396
  placeholderRender = null;
@@ -2440,6 +2441,7 @@ var Chunk = class {
2440
2441
  }
2441
2442
  consume() {
2442
2443
  let cur = this;
2444
+ let needsWalk = cur.needsWalk;
2443
2445
  if (cur.next && !cur.async) {
2444
2446
  let html = "";
2445
2447
  let effects = "";
@@ -2447,6 +2449,7 @@ var Chunk = class {
2447
2449
  let lastEffect = "";
2448
2450
  do {
2449
2451
  cur.flushPlaceholder();
2452
+ needsWalk ||= cur.needsWalk;
2450
2453
  html += cur.html;
2451
2454
  effects = concatEffects(effects, cur.effects);
2452
2455
  scripts = concatScripts(scripts, cur.scripts);
@@ -2454,6 +2457,7 @@ var Chunk = class {
2454
2457
  cur.consumed = true;
2455
2458
  cur = cur.next;
2456
2459
  } while (cur.next && !cur.async);
2460
+ cur.needsWalk = needsWalk;
2457
2461
  cur.html = html + cur.html;
2458
2462
  cur.effects = concatEffects(effects, cur.effects);
2459
2463
  cur.scripts = concatScripts(scripts, cur.scripts);
@@ -2479,8 +2483,8 @@ var Chunk = class {
2479
2483
  const { state } = boundary;
2480
2484
  const { $global: $global2, runtimePrefix, nonceAttr } = state;
2481
2485
  let { html, scripts } = this;
2482
- let hasWalk = state.walkOnNextFlush;
2483
- if (hasWalk) state.walkOnNextFlush = false;
2486
+ let needsWalk = state.walkOnNextFlush;
2487
+ if (needsWalk) state.walkOnNextFlush = false;
2484
2488
  if (state.needsMainRuntime && !state.hasMainRuntime) {
2485
2489
  state.hasMainRuntime = true;
2486
2490
  scripts = concatScripts(
@@ -2489,7 +2493,7 @@ var Chunk = class {
2489
2493
  );
2490
2494
  }
2491
2495
  if (effects) {
2492
- hasWalk = true;
2496
+ needsWalk = true;
2493
2497
  state.resumes = state.resumes ? state.resumes + "," + effects : effects;
2494
2498
  }
2495
2499
  if (state.resumes) {
@@ -2507,7 +2511,7 @@ var Chunk = class {
2507
2511
  }
2508
2512
  }
2509
2513
  if (state.writeReorders) {
2510
- hasWalk = true;
2514
+ needsWalk = true;
2511
2515
  if (!state.hasReorderRuntime) {
2512
2516
  state.hasReorderRuntime = true;
2513
2517
  html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>";
@@ -2565,7 +2569,7 @@ var Chunk = class {
2565
2569
  }
2566
2570
  state.writeReorders = null;
2567
2571
  }
2568
- if (hasWalk) {
2572
+ if (needsWalk) {
2569
2573
  scripts = concatScripts(scripts, runtimePrefix + ".w()");
2570
2574
  }
2571
2575
  this.html = html;
@@ -2574,9 +2578,14 @@ var Chunk = class {
2574
2578
  return this;
2575
2579
  }
2576
2580
  flushHTML() {
2577
- this.flushScript();
2578
- const { boundary, scripts } = this;
2581
+ const { boundary } = this;
2579
2582
  const { state } = boundary;
2583
+ if (this.needsWalk) {
2584
+ this.needsWalk = false;
2585
+ state.walkOnNextFlush = true;
2586
+ }
2587
+ this.flushScript();
2588
+ const { scripts } = this;
2580
2589
  const { $global: $global2, nonceAttr } = state;
2581
2590
  const { __flush__ } = $global2;
2582
2591
  let { html } = this;
@@ -196,65 +196,64 @@ var WALKER_RUNTIME_CODE = true ? (
196
196
  },
197
197
  })
198
198
  ), self[runtimeId]))`
199
- ) : `(e=>(self[e]||(self[e]=(l,s=e+l,f=s.length,o={},d=[],n=document,t=n.createTreeWalker(n,129))=>n=self[e][l]={i:s,d:n,l:o,v:d,x(){},w(e,l,a){for(;e=t.nextNode();)n.x(l=(l=e.data)&&!l.indexOf(s)&&(o[a=l.slice(f+1)]=e,l[f]),a,e),l>"#"&&d.push(e)}}),self[e]))`;
199
+ ) : `(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>"#"&&d.push(e)}}),self[e]))`;
200
200
  var REORDER_RUNTIME_CODE = true ? (
201
201
  /* js */
202
202
  `((runtime) => {
203
- if (runtime.j) return;
204
- let onNextSibling,
205
- placeholder,
206
- nextSibling,
207
- placeholders = {},
208
- replace = (marker, container) => {
209
- marker.replaceWith(...container.childNodes);
210
- container.remove();
211
- };
212
- runtime.d.head.append(
213
- runtime.d.querySelector("style[" + runtime.i + "]") || "",
214
- );
215
- runtime.j = {};
216
- runtime.x = (op, id, node, start, placeholderCallback) => {
217
- if (op == "#") {
218
- (placeholders[id] = placeholder).i++;
219
- } else if (node == nextSibling) {
220
- onNextSibling();
221
- }
222
-
223
- if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
224
- start = runtime.l["^" + id];
225
-
226
- if (start) {
227
- placeholders[id] = {
228
- i: 1,
229
- c(end = runtime.l[id] || node) {
230
- for (
231
- ;
232
- (nextSibling = end.previousSibling || start).remove(),
233
- start != nextSibling;
234
- );
235
- replace(end, node);
236
- },
237
- };
203
+ if (runtime.j) return;
204
+ let onNextSibling,
205
+ placeholder,
206
+ nextSibling,
207
+ placeholders = {},
208
+ replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);
209
+ runtime.d.head.append(
210
+ runtime.d.querySelector("style[" + runtime.i + "]") || ""
211
+ );
212
+ runtime.j = {};
213
+ runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {
214
+ if (node == nextSibling) {
215
+ onNextSibling();
238
216
  }
239
217
 
240
- nextSibling = node.nextSibling;
241
- placeholder = placeholders[id];
242
- onNextSibling = () => {
243
- start || replace(runtime.l[id], node);
244
- if (!--placeholder.i) {
245
- placeholder.c();
218
+ if (op == "#") {
219
+ (placeholders[id] = placeholder).i++;
220
+ } else if (op == "!") {
221
+ if (runtime.l[id] && placeholders[id]) {
222
+ placeholders[id].c();
246
223
  }
247
- };
224
+ } else if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
225
+ nextSibling = node.nextSibling;
226
+ onNextSibling = () => {
227
+ node.remove();
228
+ placeholderRoot || replace(id, node);
229
+ placeholder.c();
230
+ };
231
+ placeholder =
232
+ placeholders[id] ||
233
+ (placeholderRoot = placeholders[id] =
234
+ {
235
+ i: runtime.l[id] ? 1 : 2,
236
+ c(start = runtime.l["^" + id]) {
237
+ if (--placeholderRoot.i) return 1;
238
+ for (
239
+ ;
240
+ (nextSibling =
241
+ runtime.l[id].previousSibling || start).remove(),
242
+ start != nextSibling;
248
243
 
249
- // repurpose "op" for callbacks ...carefully
250
- if (op = runtime.j[id]) {
251
- placeholderCallback = placeholder.c;
252
- placeholder.c = () => placeholderCallback() + op(runtime.r);
244
+ );
245
+ replace(id, node);
246
+ },
247
+ });
248
+ // repurpose "op" for callbacks ...carefully
249
+ if ((op = runtime.j[id])) {
250
+ placeholderCb = placeholder.c;
251
+ placeholder.c = () => placeholderCb() || op(runtime.r);
252
+ }
253
253
  }
254
- }
255
- };
254
+ };
256
255
  })`
257
- ) : `(e=>{if(e.j)return;let i,o,l,r={},t=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(c,d,n,a,g)=>{"#"==c?(r[d]=o).i++:n==l&&i(),"T"==n.tagName&&(d=n.getAttribute(e.i))&&((a=e.l["^"+d])&&(r[d]={i:1,c(i=e.l[d]||n){for(;(l=i.previousSibling||a).remove(),a!=l;);t(i,n)}}),l=n.nextSibling,o=r[d],i=()=>{a||t(e.l[d],n),--o.i||o.c()},(c=e.j[d])&&(g=o.c,o.c=()=>g()+c(e.r)))}})`;
256
+ ) : `(e=>{if(e.j)return;let i,r,l,t={},c=(i,r)=>e.l[i].replaceWith(...r.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(a,d,n,o,u)=>{n==l&&i(),"#"==a?(t[d]=r).i++:"!"==a?e.l[d]&&t[d]&&t[d].c():"T"==n.tagName&&(d=n.getAttribute(e.i))&&(l=n.nextSibling,i=()=>{n.remove(),o||c(d,n),r.c()},r=t[d]||(o=t[d]={i:e.l[d]?1:2,c(i=e.l["^"+d]){if(--o.i)return 1;for(;(l=e.l[d].previousSibling||i).remove(),i!=l;);c(d,n)}}),(a=e.j[d])&&(u=r.c,r.c=()=>u()||a(e.r)))}})`;
258
257
 
259
258
  // src/html/serializer.ts
260
259
  var kTouchedIterator = Symbol();
@@ -2171,6 +2170,7 @@ function tryCatch(content, catchContent) {
2171
2170
  writeMarker = false;
2172
2171
  cur.async = false;
2173
2172
  cur.next = bodyNext;
2173
+ cur.needsWalk = true;
2174
2174
  cur.html = endMarker;
2175
2175
  cur.scripts = cur.effects = cur.lastEffect = "";
2176
2176
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
@@ -2301,6 +2301,7 @@ var Chunk = class {
2301
2301
  lastEffect = "";
2302
2302
  async = false;
2303
2303
  consumed = false;
2304
+ needsWalk = false;
2304
2305
  reorderId = null;
2305
2306
  placeholderBody = null;
2306
2307
  placeholderRender = null;
@@ -2351,6 +2352,7 @@ var Chunk = class {
2351
2352
  }
2352
2353
  consume() {
2353
2354
  let cur = this;
2355
+ let needsWalk = cur.needsWalk;
2354
2356
  if (cur.next && !cur.async) {
2355
2357
  let html = "";
2356
2358
  let effects = "";
@@ -2358,6 +2360,7 @@ var Chunk = class {
2358
2360
  let lastEffect = "";
2359
2361
  do {
2360
2362
  cur.flushPlaceholder();
2363
+ needsWalk ||= cur.needsWalk;
2361
2364
  html += cur.html;
2362
2365
  effects = concatEffects(effects, cur.effects);
2363
2366
  scripts = concatScripts(scripts, cur.scripts);
@@ -2365,6 +2368,7 @@ var Chunk = class {
2365
2368
  cur.consumed = true;
2366
2369
  cur = cur.next;
2367
2370
  } while (cur.next && !cur.async);
2371
+ cur.needsWalk = needsWalk;
2368
2372
  cur.html = html + cur.html;
2369
2373
  cur.effects = concatEffects(effects, cur.effects);
2370
2374
  cur.scripts = concatScripts(scripts, cur.scripts);
@@ -2390,8 +2394,8 @@ var Chunk = class {
2390
2394
  const { state } = boundary;
2391
2395
  const { $global: $global2, runtimePrefix, nonceAttr } = state;
2392
2396
  let { html, scripts } = this;
2393
- let hasWalk = state.walkOnNextFlush;
2394
- if (hasWalk) state.walkOnNextFlush = false;
2397
+ let needsWalk = state.walkOnNextFlush;
2398
+ if (needsWalk) state.walkOnNextFlush = false;
2395
2399
  if (state.needsMainRuntime && !state.hasMainRuntime) {
2396
2400
  state.hasMainRuntime = true;
2397
2401
  scripts = concatScripts(
@@ -2400,7 +2404,7 @@ var Chunk = class {
2400
2404
  );
2401
2405
  }
2402
2406
  if (effects) {
2403
- hasWalk = true;
2407
+ needsWalk = true;
2404
2408
  state.resumes = state.resumes ? state.resumes + "," + effects : effects;
2405
2409
  }
2406
2410
  if (state.resumes) {
@@ -2418,7 +2422,7 @@ var Chunk = class {
2418
2422
  }
2419
2423
  }
2420
2424
  if (state.writeReorders) {
2421
- hasWalk = true;
2425
+ needsWalk = true;
2422
2426
  if (!state.hasReorderRuntime) {
2423
2427
  state.hasReorderRuntime = true;
2424
2428
  html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>";
@@ -2476,7 +2480,7 @@ var Chunk = class {
2476
2480
  }
2477
2481
  state.writeReorders = null;
2478
2482
  }
2479
- if (hasWalk) {
2483
+ if (needsWalk) {
2480
2484
  scripts = concatScripts(scripts, runtimePrefix + ".w()");
2481
2485
  }
2482
2486
  this.html = html;
@@ -2485,9 +2489,14 @@ var Chunk = class {
2485
2489
  return this;
2486
2490
  }
2487
2491
  flushHTML() {
2488
- this.flushScript();
2489
- const { boundary, scripts } = this;
2492
+ const { boundary } = this;
2490
2493
  const { state } = boundary;
2494
+ if (this.needsWalk) {
2495
+ this.needsWalk = false;
2496
+ state.walkOnNextFlush = true;
2497
+ }
2498
+ this.flushScript();
2499
+ const { scripts } = this;
2491
2500
  const { $global: $global2, nonceAttr } = state;
2492
2501
  const { __flush__ } = $global2;
2493
2502
  let { html } = this;
@@ -10,6 +10,6 @@ export declare function queueRender<T>(scope: Scope, signal: Signal<T>, signalKe
10
10
  export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
11
11
  export declare function run(): void;
12
12
  export declare function prepareEffects(fn: () => void): unknown[];
13
- export declare let runEffects: (effects: unknown[]) => void;
13
+ export declare let runEffects: (effects: unknown[], checkPending?: boolean) => void;
14
14
  export declare let _enable_catch: () => void;
15
15
  export {};
package/dist/dom.js CHANGED
@@ -1142,7 +1142,9 @@ function _await(nodeAccessor, renderer) {
1142
1142
  tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
1143
1143
  tryWithPlaceholder.h.parentNode,
1144
1144
  placeholderBranch.h
1145
- ), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
1145
+ ), removeAndDestroyBranch(placeholderBranch));
1146
+ let pendingEffects2 = tryWithPlaceholder.H;
1147
+ pendingEffects2 && (tryWithPlaceholder.H = [], runEffects(pendingEffects2, !0));
1146
1148
  }
1147
1149
  },
1148
1150
  -1
@@ -1372,13 +1374,13 @@ function prepareEffects(fn) {
1372
1374
  }
1373
1375
  return preparedEffects;
1374
1376
  }
1375
- var runEffects = (effects) => {
1377
+ var runEffects = ((effects) => {
1376
1378
  for (let i = 0, scope; i < effects.length; )
1377
1379
  effects[i++](
1378
1380
  scope = effects[i++],
1379
1381
  scope
1380
1382
  );
1381
- };
1383
+ });
1382
1384
  function runRenders() {
1383
1385
  for (; pendingRenders.length; ) {
1384
1386
  let render = pendingRenders[0], item = pendingRenders.pop();
package/dist/dom.mjs CHANGED
@@ -1045,7 +1045,9 @@ function _await(nodeAccessor, renderer) {
1045
1045
  tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
1046
1046
  tryWithPlaceholder.h.parentNode,
1047
1047
  placeholderBranch.h
1048
- ), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
1048
+ ), removeAndDestroyBranch(placeholderBranch));
1049
+ let pendingEffects2 = tryWithPlaceholder.H;
1050
+ pendingEffects2 && (tryWithPlaceholder.H = [], runEffects(pendingEffects2, !0));
1049
1051
  }
1050
1052
  },
1051
1053
  -1
@@ -1275,13 +1277,13 @@ function prepareEffects(fn) {
1275
1277
  }
1276
1278
  return preparedEffects;
1277
1279
  }
1278
- var runEffects = (effects) => {
1280
+ var runEffects = ((effects) => {
1279
1281
  for (let i = 0, scope; i < effects.length; )
1280
1282
  effects[i++](
1281
1283
  scope = effects[i++],
1282
1284
  scope
1283
1285
  );
1284
- };
1286
+ });
1285
1287
  function runRenders() {
1286
1288
  for (; pendingRenders.length; ) {
1287
1289
  let render = pendingRenders[0], item = pendingRenders.pop();
@@ -116,6 +116,7 @@ export declare class Chunk {
116
116
  lastEffect: string;
117
117
  async: boolean;
118
118
  consumed: boolean;
119
+ needsWalk: boolean;
119
120
  reorderId: string | null;
120
121
  placeholderBody: Chunk | null;
121
122
  placeholderRender: (() => void) | null;
package/dist/html.js CHANGED
@@ -195,7 +195,7 @@ function forStepBy(by, index) {
195
195
  }
196
196
 
197
197
  // src/html/inlined-runtimes.ts
198
- var WALKER_RUNTIME_CODE = '(e=>(self[e]||(self[e]=(l,s=e+l,f=s.length,o={},d=[],n=document,t=n.createTreeWalker(n,129))=>n=self[e][l]={i:s,d:n,l:o,v:d,x(){},w(e,l,a){for(;e=t.nextNode();)n.x(l=(l=e.data)&&!l.indexOf(s)&&(o[a=l.slice(f+1)]=e,l[f]),a,e),l>"#"&&d.push(e)}}),self[e]))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,o,l,r={},t=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(c,d,n,a,g)=>{"#"==c?(r[d]=o).i++:n==l&&i(),"T"==n.tagName&&(d=n.getAttribute(e.i))&&((a=e.l["^"+d])&&(r[d]={i:1,c(i=e.l[d]||n){for(;(l=i.previousSibling||a).remove(),a!=l;);t(i,n)}}),l=n.nextSibling,o=r[d],i=()=>{a||t(e.l[d],n),--o.i||o.c()},(c=e.j[d])&&(g=o.c,o.c=()=>g()+c(e.r)))}})';
198
+ var WALKER_RUNTIME_CODE = '(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>"#"&&d.push(e)}}),self[e]))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,r,l,t={},c=(i,r)=>e.l[i].replaceWith(...r.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(a,d,n,o,u)=>{n==l&&i(),"#"==a?(t[d]=r).i++:"!"==a?e.l[d]&&t[d]&&t[d].c():"T"==n.tagName&&(d=n.getAttribute(e.i))&&(l=n.nextSibling,i=()=>{n.remove(),o||c(d,n),r.c()},r=t[d]||(o=t[d]={i:e.l[d]?1:2,c(i=e.l["^"+d]){if(--o.i)return 1;for(;(l=e.l[d].previousSibling||i).remove(),i!=l;);c(d,n)}}),(a=e.j[d])&&(u=r.c,r.c=()=>u()||a(e.r)))}})';
199
199
 
200
200
  // src/html/serializer.ts
201
201
  var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {
@@ -1461,7 +1461,7 @@ function tryCatch(content, catchContent) {
1461
1461
  let cur = body, writeMarker = !0;
1462
1462
  do {
1463
1463
  let next = cur.next;
1464
- cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1464
+ cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.needsWalk = !0, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1465
1465
  } while (cur !== bodyNext);
1466
1466
  }
1467
1467
  let catchChunk = new Chunk(boundary, null, chunk.context);
@@ -1546,6 +1546,7 @@ var State2 = class {
1546
1546
  lastEffect = "";
1547
1547
  async = !1;
1548
1548
  consumed = !1;
1549
+ needsWalk = !1;
1549
1550
  reorderId = null;
1550
1551
  placeholderBody = null;
1551
1552
  placeholderRender = null;
@@ -1580,13 +1581,13 @@ var State2 = class {
1580
1581
  }
1581
1582
  }
1582
1583
  consume() {
1583
- let cur = this;
1584
+ let cur = this, needsWalk = cur.needsWalk;
1584
1585
  if (cur.next && !cur.async) {
1585
1586
  let html = "", effects = "", scripts = "", lastEffect = "";
1586
1587
  do
1587
- cur.flushPlaceholder(), html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
1588
+ cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
1588
1589
  while (cur.next && !cur.async);
1589
- cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1590
+ cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1590
1591
  }
1591
1592
  return cur;
1592
1593
  }
@@ -1602,18 +1603,18 @@ var State2 = class {
1602
1603
  }
1603
1604
  }
1604
1605
  flushScript() {
1605
- let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, hasWalk = state.walkOnNextFlush;
1606
- if (hasWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
1606
+ let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
1607
+ if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
1607
1608
  scripts,
1608
1609
  WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
1609
- )), effects && (hasWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
1610
+ )), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
1610
1611
  scripts,
1611
1612
  runtimePrefix + ".r.push(" + state.resumes + ")"
1612
1613
  ) : (state.hasWrittenResume = !0, scripts = concatScripts(
1613
1614
  scripts,
1614
1615
  runtimePrefix + ".r=[" + state.resumes + "]"
1615
1616
  ))), state.writeReorders) {
1616
- hasWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
1617
+ needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
1617
1618
  scripts,
1618
1619
  REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
1619
1620
  ));
@@ -1643,11 +1644,12 @@ var State2 = class {
1643
1644
  }
1644
1645
  state.writeReorders = null;
1645
1646
  }
1646
- return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
1647
+ return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
1647
1648
  }
1648
1649
  flushHTML() {
1649
- this.flushScript();
1650
- let { boundary, scripts } = this, { state } = boundary, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
1650
+ let { boundary } = this, { state } = boundary;
1651
+ this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
1652
+ let { scripts } = this, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
1651
1653
  return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, html = __flush__($global2, html)), boundary.count || (html += state.trailerHTML), html;
1652
1654
  }
1653
1655
  };
package/dist/html.mjs CHANGED
@@ -109,7 +109,7 @@ function forStepBy(by, index) {
109
109
  }
110
110
 
111
111
  // src/html/inlined-runtimes.ts
112
- var WALKER_RUNTIME_CODE = '(e=>(self[e]||(self[e]=(l,s=e+l,f=s.length,o={},d=[],n=document,t=n.createTreeWalker(n,129))=>n=self[e][l]={i:s,d:n,l:o,v:d,x(){},w(e,l,a){for(;e=t.nextNode();)n.x(l=(l=e.data)&&!l.indexOf(s)&&(o[a=l.slice(f+1)]=e,l[f]),a,e),l>"#"&&d.push(e)}}),self[e]))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,o,l,r={},t=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(c,d,n,a,g)=>{"#"==c?(r[d]=o).i++:n==l&&i(),"T"==n.tagName&&(d=n.getAttribute(e.i))&&((a=e.l["^"+d])&&(r[d]={i:1,c(i=e.l[d]||n){for(;(l=i.previousSibling||a).remove(),a!=l;);t(i,n)}}),l=n.nextSibling,o=r[d],i=()=>{a||t(e.l[d],n),--o.i||o.c()},(c=e.j[d])&&(g=o.c,o.c=()=>g()+c(e.r)))}})';
112
+ var WALKER_RUNTIME_CODE = '(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>"#"&&d.push(e)}}),self[e]))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,r,l,t={},c=(i,r)=>e.l[i].replaceWith(...r.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(a,d,n,o,u)=>{n==l&&i(),"#"==a?(t[d]=r).i++:"!"==a?e.l[d]&&t[d]&&t[d].c():"T"==n.tagName&&(d=n.getAttribute(e.i))&&(l=n.nextSibling,i=()=>{n.remove(),o||c(d,n),r.c()},r=t[d]||(o=t[d]={i:e.l[d]?1:2,c(i=e.l["^"+d]){if(--o.i)return 1;for(;(l=e.l[d].previousSibling||i).remove(),i!=l;);c(d,n)}}),(a=e.j[d])&&(u=r.c,r.c=()=>u()||a(e.r)))}})';
113
113
 
114
114
  // src/html/serializer.ts
115
115
  var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {
@@ -1375,7 +1375,7 @@ function tryCatch(content, catchContent) {
1375
1375
  let cur = body, writeMarker = !0;
1376
1376
  do {
1377
1377
  let next = cur.next;
1378
- cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1378
+ cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.needsWalk = !0, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1379
1379
  } while (cur !== bodyNext);
1380
1380
  }
1381
1381
  let catchChunk = new Chunk(boundary, null, chunk.context);
@@ -1460,6 +1460,7 @@ var State2 = class {
1460
1460
  lastEffect = "";
1461
1461
  async = !1;
1462
1462
  consumed = !1;
1463
+ needsWalk = !1;
1463
1464
  reorderId = null;
1464
1465
  placeholderBody = null;
1465
1466
  placeholderRender = null;
@@ -1494,13 +1495,13 @@ var State2 = class {
1494
1495
  }
1495
1496
  }
1496
1497
  consume() {
1497
- let cur = this;
1498
+ let cur = this, needsWalk = cur.needsWalk;
1498
1499
  if (cur.next && !cur.async) {
1499
1500
  let html = "", effects = "", scripts = "", lastEffect = "";
1500
1501
  do
1501
- cur.flushPlaceholder(), html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
1502
+ cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
1502
1503
  while (cur.next && !cur.async);
1503
- cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1504
+ cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1504
1505
  }
1505
1506
  return cur;
1506
1507
  }
@@ -1516,18 +1517,18 @@ var State2 = class {
1516
1517
  }
1517
1518
  }
1518
1519
  flushScript() {
1519
- let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, hasWalk = state.walkOnNextFlush;
1520
- if (hasWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
1520
+ let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
1521
+ if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
1521
1522
  scripts,
1522
1523
  WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
1523
- )), effects && (hasWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
1524
+ )), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
1524
1525
  scripts,
1525
1526
  runtimePrefix + ".r.push(" + state.resumes + ")"
1526
1527
  ) : (state.hasWrittenResume = !0, scripts = concatScripts(
1527
1528
  scripts,
1528
1529
  runtimePrefix + ".r=[" + state.resumes + "]"
1529
1530
  ))), state.writeReorders) {
1530
- hasWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
1531
+ needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
1531
1532
  scripts,
1532
1533
  REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
1533
1534
  ));
@@ -1557,11 +1558,12 @@ var State2 = class {
1557
1558
  }
1558
1559
  state.writeReorders = null;
1559
1560
  }
1560
- return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
1561
+ return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
1561
1562
  }
1562
1563
  flushHTML() {
1563
- this.flushScript();
1564
- let { boundary, scripts } = this, { state } = boundary, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
1564
+ let { boundary } = this, { state } = boundary;
1565
+ this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
1566
+ let { scripts } = this, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
1565
1567
  return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, html = __flush__($global2, html)), boundary.count || (html += state.trailerHTML), html;
1566
1568
  }
1567
1569
  };
@@ -4674,9 +4674,11 @@ function preAnalyze(program) {
4674
4674
  }
4675
4675
  }
4676
4676
  function normalizeBody(state, body) {
4677
- for (const child of body) {
4678
- if (child.isMarkoTag()) {
4679
- normalizeTag(state, child);
4677
+ if (body?.length) {
4678
+ for (const child of body) {
4679
+ if (child.isMarkoTag()) {
4680
+ normalizeTag(state, child);
4681
+ }
4680
4682
  }
4681
4683
  }
4682
4684
  }
@@ -4684,6 +4686,7 @@ function normalizeTag(state, tag) {
4684
4686
  const { node } = tag;
4685
4687
  const { name: name2, attributes } = node;
4686
4688
  normalizeBody(state, tag.get("body").get("body"));
4689
+ normalizeBody(state, tag.get("attributeTags"));
4687
4690
  if (node.var) {
4688
4691
  const insertions = getAssignmentInsertions(node.var);
4689
4692
  if (insertions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.87",
3
+ "version": "6.0.88",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",