marko 6.0.87 → 6.0.89

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,65 @@ 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
+ nextSibling = node.nextSibling;
312
+ onNextSibling = () => placeholders[id].c();
335
313
  }
336
- };
314
+ } else if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
315
+ nextSibling = node.nextSibling;
316
+ onNextSibling = () => {
317
+ node.remove();
318
+ placeholderRoot || replace(id, node);
319
+ placeholder.c();
320
+ };
321
+ placeholder =
322
+ placeholders[id] ||
323
+ (placeholderRoot = placeholders[id] =
324
+ {
325
+ i: runtime.l[id] ? 1 : 2,
326
+ c(start = runtime.l["^" + id]) {
327
+ if (--placeholderRoot.i) return 1;
328
+ for (
329
+ ;
330
+ (nextSibling =
331
+ runtime.l[id].previousSibling || start).remove(),
332
+ start != nextSibling;
337
333
 
338
- // repurpose "op" for callbacks ...carefully
339
- if (op = runtime.j[id]) {
340
- placeholderCallback = placeholder.c;
341
- placeholder.c = () => placeholderCallback() + op(runtime.r);
334
+ );
335
+ replace(id, node);
336
+ },
337
+ });
338
+ // repurpose "op" for callbacks ...carefully
339
+ if ((op = runtime.j[id])) {
340
+ placeholderCb = placeholder.c;
341
+ placeholder.c = () => placeholderCb() || op(runtime.r);
342
+ }
342
343
  }
343
- }
344
- };
344
+ };
345
345
  })`
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)))}})`;
346
+ ) : `(e=>{if(e.j)return;let i,l,r,t={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),"#"==n?(t[a]=l).i++:"!"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):"T"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l["^"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})`;
347
347
 
348
348
  // src/html/serializer.ts
349
349
  var kTouchedIterator = Symbol();
@@ -2260,6 +2260,7 @@ function tryCatch(content, catchContent) {
2260
2260
  writeMarker = false;
2261
2261
  cur.async = false;
2262
2262
  cur.next = bodyNext;
2263
+ cur.needsWalk = true;
2263
2264
  cur.html = endMarker;
2264
2265
  cur.scripts = cur.effects = cur.lastEffect = "";
2265
2266
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
@@ -2390,6 +2391,7 @@ var Chunk = class {
2390
2391
  lastEffect = "";
2391
2392
  async = false;
2392
2393
  consumed = false;
2394
+ needsWalk = false;
2393
2395
  reorderId = null;
2394
2396
  placeholderBody = null;
2395
2397
  placeholderRender = null;
@@ -2440,6 +2442,7 @@ var Chunk = class {
2440
2442
  }
2441
2443
  consume() {
2442
2444
  let cur = this;
2445
+ let needsWalk = cur.needsWalk;
2443
2446
  if (cur.next && !cur.async) {
2444
2447
  let html = "";
2445
2448
  let effects = "";
@@ -2447,6 +2450,7 @@ var Chunk = class {
2447
2450
  let lastEffect = "";
2448
2451
  do {
2449
2452
  cur.flushPlaceholder();
2453
+ needsWalk ||= cur.needsWalk;
2450
2454
  html += cur.html;
2451
2455
  effects = concatEffects(effects, cur.effects);
2452
2456
  scripts = concatScripts(scripts, cur.scripts);
@@ -2454,6 +2458,7 @@ var Chunk = class {
2454
2458
  cur.consumed = true;
2455
2459
  cur = cur.next;
2456
2460
  } while (cur.next && !cur.async);
2461
+ cur.needsWalk = needsWalk;
2457
2462
  cur.html = html + cur.html;
2458
2463
  cur.effects = concatEffects(effects, cur.effects);
2459
2464
  cur.scripts = concatScripts(scripts, cur.scripts);
@@ -2479,8 +2484,8 @@ var Chunk = class {
2479
2484
  const { state } = boundary;
2480
2485
  const { $global: $global2, runtimePrefix, nonceAttr } = state;
2481
2486
  let { html, scripts } = this;
2482
- let hasWalk = state.walkOnNextFlush;
2483
- if (hasWalk) state.walkOnNextFlush = false;
2487
+ let needsWalk = state.walkOnNextFlush;
2488
+ if (needsWalk) state.walkOnNextFlush = false;
2484
2489
  if (state.needsMainRuntime && !state.hasMainRuntime) {
2485
2490
  state.hasMainRuntime = true;
2486
2491
  scripts = concatScripts(
@@ -2489,7 +2494,7 @@ var Chunk = class {
2489
2494
  );
2490
2495
  }
2491
2496
  if (effects) {
2492
- hasWalk = true;
2497
+ needsWalk = true;
2493
2498
  state.resumes = state.resumes ? state.resumes + "," + effects : effects;
2494
2499
  }
2495
2500
  if (state.resumes) {
@@ -2507,7 +2512,7 @@ var Chunk = class {
2507
2512
  }
2508
2513
  }
2509
2514
  if (state.writeReorders) {
2510
- hasWalk = true;
2515
+ needsWalk = true;
2511
2516
  if (!state.hasReorderRuntime) {
2512
2517
  state.hasReorderRuntime = true;
2513
2518
  html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>";
@@ -2565,7 +2570,7 @@ var Chunk = class {
2565
2570
  }
2566
2571
  state.writeReorders = null;
2567
2572
  }
2568
- if (hasWalk) {
2573
+ if (needsWalk) {
2569
2574
  scripts = concatScripts(scripts, runtimePrefix + ".w()");
2570
2575
  }
2571
2576
  this.html = html;
@@ -2574,9 +2579,14 @@ var Chunk = class {
2574
2579
  return this;
2575
2580
  }
2576
2581
  flushHTML() {
2577
- this.flushScript();
2578
- const { boundary, scripts } = this;
2582
+ const { boundary } = this;
2579
2583
  const { state } = boundary;
2584
+ if (this.needsWalk) {
2585
+ this.needsWalk = false;
2586
+ state.walkOnNextFlush = true;
2587
+ }
2588
+ this.flushScript();
2589
+ const { scripts } = this;
2580
2590
  const { $global: $global2, nonceAttr } = state;
2581
2591
  const { __flush__ } = $global2;
2582
2592
  let { html } = this;
@@ -196,65 +196,65 @@ 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
+ nextSibling = node.nextSibling;
223
+ onNextSibling = () => placeholders[id].c();
246
224
  }
247
- };
225
+ } else if (node.tagName == "T" && (id = node.getAttribute(runtime.i))) {
226
+ nextSibling = node.nextSibling;
227
+ onNextSibling = () => {
228
+ node.remove();
229
+ placeholderRoot || replace(id, node);
230
+ placeholder.c();
231
+ };
232
+ placeholder =
233
+ placeholders[id] ||
234
+ (placeholderRoot = placeholders[id] =
235
+ {
236
+ i: runtime.l[id] ? 1 : 2,
237
+ c(start = runtime.l["^" + id]) {
238
+ if (--placeholderRoot.i) return 1;
239
+ for (
240
+ ;
241
+ (nextSibling =
242
+ runtime.l[id].previousSibling || start).remove(),
243
+ start != nextSibling;
248
244
 
249
- // repurpose "op" for callbacks ...carefully
250
- if (op = runtime.j[id]) {
251
- placeholderCallback = placeholder.c;
252
- placeholder.c = () => placeholderCallback() + op(runtime.r);
245
+ );
246
+ replace(id, node);
247
+ },
248
+ });
249
+ // repurpose "op" for callbacks ...carefully
250
+ if ((op = runtime.j[id])) {
251
+ placeholderCb = placeholder.c;
252
+ placeholder.c = () => placeholderCb() || op(runtime.r);
253
+ }
253
254
  }
254
- }
255
- };
255
+ };
256
256
  })`
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)))}})`;
257
+ ) : `(e=>{if(e.j)return;let i,l,r,t={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),"#"==n?(t[a]=l).i++:"!"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):"T"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l["^"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})`;
258
258
 
259
259
  // src/html/serializer.ts
260
260
  var kTouchedIterator = Symbol();
@@ -2171,6 +2171,7 @@ function tryCatch(content, catchContent) {
2171
2171
  writeMarker = false;
2172
2172
  cur.async = false;
2173
2173
  cur.next = bodyNext;
2174
+ cur.needsWalk = true;
2174
2175
  cur.html = endMarker;
2175
2176
  cur.scripts = cur.effects = cur.lastEffect = "";
2176
2177
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
@@ -2301,6 +2302,7 @@ var Chunk = class {
2301
2302
  lastEffect = "";
2302
2303
  async = false;
2303
2304
  consumed = false;
2305
+ needsWalk = false;
2304
2306
  reorderId = null;
2305
2307
  placeholderBody = null;
2306
2308
  placeholderRender = null;
@@ -2351,6 +2353,7 @@ var Chunk = class {
2351
2353
  }
2352
2354
  consume() {
2353
2355
  let cur = this;
2356
+ let needsWalk = cur.needsWalk;
2354
2357
  if (cur.next && !cur.async) {
2355
2358
  let html = "";
2356
2359
  let effects = "";
@@ -2358,6 +2361,7 @@ var Chunk = class {
2358
2361
  let lastEffect = "";
2359
2362
  do {
2360
2363
  cur.flushPlaceholder();
2364
+ needsWalk ||= cur.needsWalk;
2361
2365
  html += cur.html;
2362
2366
  effects = concatEffects(effects, cur.effects);
2363
2367
  scripts = concatScripts(scripts, cur.scripts);
@@ -2365,6 +2369,7 @@ var Chunk = class {
2365
2369
  cur.consumed = true;
2366
2370
  cur = cur.next;
2367
2371
  } while (cur.next && !cur.async);
2372
+ cur.needsWalk = needsWalk;
2368
2373
  cur.html = html + cur.html;
2369
2374
  cur.effects = concatEffects(effects, cur.effects);
2370
2375
  cur.scripts = concatScripts(scripts, cur.scripts);
@@ -2390,8 +2395,8 @@ var Chunk = class {
2390
2395
  const { state } = boundary;
2391
2396
  const { $global: $global2, runtimePrefix, nonceAttr } = state;
2392
2397
  let { html, scripts } = this;
2393
- let hasWalk = state.walkOnNextFlush;
2394
- if (hasWalk) state.walkOnNextFlush = false;
2398
+ let needsWalk = state.walkOnNextFlush;
2399
+ if (needsWalk) state.walkOnNextFlush = false;
2395
2400
  if (state.needsMainRuntime && !state.hasMainRuntime) {
2396
2401
  state.hasMainRuntime = true;
2397
2402
  scripts = concatScripts(
@@ -2400,7 +2405,7 @@ var Chunk = class {
2400
2405
  );
2401
2406
  }
2402
2407
  if (effects) {
2403
- hasWalk = true;
2408
+ needsWalk = true;
2404
2409
  state.resumes = state.resumes ? state.resumes + "," + effects : effects;
2405
2410
  }
2406
2411
  if (state.resumes) {
@@ -2418,7 +2423,7 @@ var Chunk = class {
2418
2423
  }
2419
2424
  }
2420
2425
  if (state.writeReorders) {
2421
- hasWalk = true;
2426
+ needsWalk = true;
2422
2427
  if (!state.hasReorderRuntime) {
2423
2428
  state.hasReorderRuntime = true;
2424
2429
  html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>";
@@ -2476,7 +2481,7 @@ var Chunk = class {
2476
2481
  }
2477
2482
  state.writeReorders = null;
2478
2483
  }
2479
- if (hasWalk) {
2484
+ if (needsWalk) {
2480
2485
  scripts = concatScripts(scripts, runtimePrefix + ".w()");
2481
2486
  }
2482
2487
  this.html = html;
@@ -2485,9 +2490,14 @@ var Chunk = class {
2485
2490
  return this;
2486
2491
  }
2487
2492
  flushHTML() {
2488
- this.flushScript();
2489
- const { boundary, scripts } = this;
2493
+ const { boundary } = this;
2490
2494
  const { state } = boundary;
2495
+ if (this.needsWalk) {
2496
+ this.needsWalk = false;
2497
+ state.walkOnNextFlush = true;
2498
+ }
2499
+ this.flushScript();
2500
+ const { scripts } = this;
2491
2501
  const { $global: $global2, nonceAttr } = state;
2492
2502
  const { __flush__ } = $global2;
2493
2503
  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,l,r,t={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),"#"==n?(t[a]=l).i++:"!"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):"T"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l["^"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(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,l,r,t={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),"#"==n?(t[a]=l).i++:"!"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):"T"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l["^"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(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.89",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",