marko 6.0.2 → 6.0.3

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
@@ -276,6 +276,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
276
276
  };
277
277
  const branchIds = /* @__PURE__ */ new Set();
278
278
  const parentBranchIds = /* @__PURE__ */ new Map();
279
+ let lastEffect;
279
280
  let currentBranchId;
280
281
  let $global;
281
282
  let lastScopeId = 0;
@@ -361,7 +362,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
361
362
  render.r = [];
362
363
  isResuming = 1;
363
364
  for (let i = 0; i < resumes.length; i++) {
364
- const serialized = resumes[i];
365
+ let serialized = resumes[i];
365
366
  if (typeof serialized === "function") {
366
367
  for (const scope of serialized(serializeContext)) {
367
368
  if (!$global) {
@@ -403,7 +404,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
403
404
  }
404
405
  }
405
406
  } else {
406
- registeredValues[resumes[++i]](
407
+ if (typeof serialized === "string") {
408
+ lastEffect = serialized;
409
+ serialized = resumes[++i];
410
+ }
411
+ registeredValues[lastEffect](
407
412
  scopeLookup[serialized],
408
413
  scopeLookup[serialized]
409
414
  );
@@ -188,6 +188,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
188
188
  };
189
189
  const branchIds = /* @__PURE__ */ new Set();
190
190
  const parentBranchIds = /* @__PURE__ */ new Map();
191
+ let lastEffect;
191
192
  let currentBranchId;
192
193
  let $global;
193
194
  let lastScopeId = 0;
@@ -273,7 +274,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
273
274
  render.r = [];
274
275
  isResuming = 1;
275
276
  for (let i = 0; i < resumes.length; i++) {
276
- const serialized = resumes[i];
277
+ let serialized = resumes[i];
277
278
  if (typeof serialized === "function") {
278
279
  for (const scope of serialized(serializeContext)) {
279
280
  if (!$global) {
@@ -315,7 +316,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
315
316
  }
316
317
  }
317
318
  } else {
318
- registeredValues[resumes[++i]](
319
+ if (typeof serialized === "string") {
320
+ lastEffect = serialized;
321
+ serialized = resumes[++i];
322
+ }
323
+ registeredValues[lastEffect](
319
324
  scopeLookup[serialized],
320
325
  scopeLookup[serialized]
321
326
  );
@@ -2197,7 +2197,7 @@ function tryCatch(content, catchContent) {
2197
2197
  cur.async = false;
2198
2198
  cur.next = bodyNext;
2199
2199
  cur.html = endMarker;
2200
- cur.scripts = cur.effects = "";
2200
+ cur.scripts = cur.effects = cur.lastEffect = "";
2201
2201
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
2202
2202
  }
2203
2203
  cur = next;
@@ -2328,6 +2328,7 @@ var Chunk = class {
2328
2328
  html = "";
2329
2329
  scripts = "";
2330
2330
  effects = "";
2331
+ lastEffect = "";
2331
2332
  async = false;
2332
2333
  consumed = false;
2333
2334
  reorderId = null;
@@ -2337,10 +2338,15 @@ var Chunk = class {
2337
2338
  this.html += html;
2338
2339
  }
2339
2340
  writeEffect(scopeId, registryId) {
2340
- this.effects = concatEffects(
2341
- this.effects,
2342
- scopeId + ',"' + registryId + '"'
2343
- );
2341
+ if (this.lastEffect === registryId) {
2342
+ this.effects += "," + scopeId;
2343
+ } else {
2344
+ this.effects = concatEffects(
2345
+ this.effects,
2346
+ '"' + registryId + '",' + scopeId
2347
+ );
2348
+ }
2349
+ this.lastEffect = registryId;
2344
2350
  }
2345
2351
  writeScript(script) {
2346
2352
  this.scripts = concatScripts(this.scripts, script);
@@ -2349,6 +2355,7 @@ var Chunk = class {
2349
2355
  this.html += chunk.html;
2350
2356
  this.effects = concatEffects(this.effects, chunk.effects);
2351
2357
  this.scripts = concatScripts(this.scripts, chunk.scripts);
2358
+ this.lastEffect = chunk.lastEffect || this.lastEffect;
2352
2359
  }
2353
2360
  flushPlaceholder() {
2354
2361
  if (this.placeholderBody) {
@@ -2378,17 +2385,20 @@ var Chunk = class {
2378
2385
  let html = "";
2379
2386
  let effects = "";
2380
2387
  let scripts = "";
2388
+ let lastEffect = "";
2381
2389
  do {
2382
2390
  cur.flushPlaceholder();
2383
2391
  html += cur.html;
2384
2392
  effects = concatEffects(effects, cur.effects);
2385
2393
  scripts = concatScripts(scripts, cur.scripts);
2394
+ lastEffect = cur.lastEffect || lastEffect;
2386
2395
  cur.consumed = true;
2387
2396
  cur = cur.next;
2388
2397
  } while (cur.next && !cur.async);
2389
2398
  cur.html = html + cur.html;
2390
2399
  cur.effects = concatEffects(effects, cur.effects);
2391
2400
  cur.scripts = concatScripts(scripts, cur.scripts);
2401
+ cur.lastEffect = lastEffect;
2392
2402
  }
2393
2403
  return cur;
2394
2404
  }
@@ -2467,7 +2477,7 @@ var Chunk = class {
2467
2477
  "#" /* ReorderMarker */,
2468
2478
  cur.reorderId = state.nextReorderId()
2469
2479
  );
2470
- cur.html = cur.effects = cur.scripts = "";
2480
+ cur.html = cur.effects = cur.scripts = cur.lastEffect = "";
2471
2481
  cur.next = null;
2472
2482
  }
2473
2483
  if (next) {
@@ -2112,7 +2112,7 @@ function tryCatch(content, catchContent) {
2112
2112
  cur.async = false;
2113
2113
  cur.next = bodyNext;
2114
2114
  cur.html = endMarker;
2115
- cur.scripts = cur.effects = "";
2115
+ cur.scripts = cur.effects = cur.lastEffect = "";
2116
2116
  cur.placeholderBody = cur.placeholderRender = cur.reorderId = null;
2117
2117
  }
2118
2118
  cur = next;
@@ -2243,6 +2243,7 @@ var Chunk = class {
2243
2243
  html = "";
2244
2244
  scripts = "";
2245
2245
  effects = "";
2246
+ lastEffect = "";
2246
2247
  async = false;
2247
2248
  consumed = false;
2248
2249
  reorderId = null;
@@ -2252,10 +2253,15 @@ var Chunk = class {
2252
2253
  this.html += html;
2253
2254
  }
2254
2255
  writeEffect(scopeId, registryId) {
2255
- this.effects = concatEffects(
2256
- this.effects,
2257
- scopeId + ',"' + registryId + '"'
2258
- );
2256
+ if (this.lastEffect === registryId) {
2257
+ this.effects += "," + scopeId;
2258
+ } else {
2259
+ this.effects = concatEffects(
2260
+ this.effects,
2261
+ '"' + registryId + '",' + scopeId
2262
+ );
2263
+ }
2264
+ this.lastEffect = registryId;
2259
2265
  }
2260
2266
  writeScript(script) {
2261
2267
  this.scripts = concatScripts(this.scripts, script);
@@ -2264,6 +2270,7 @@ var Chunk = class {
2264
2270
  this.html += chunk.html;
2265
2271
  this.effects = concatEffects(this.effects, chunk.effects);
2266
2272
  this.scripts = concatScripts(this.scripts, chunk.scripts);
2273
+ this.lastEffect = chunk.lastEffect || this.lastEffect;
2267
2274
  }
2268
2275
  flushPlaceholder() {
2269
2276
  if (this.placeholderBody) {
@@ -2293,17 +2300,20 @@ var Chunk = class {
2293
2300
  let html = "";
2294
2301
  let effects = "";
2295
2302
  let scripts = "";
2303
+ let lastEffect = "";
2296
2304
  do {
2297
2305
  cur.flushPlaceholder();
2298
2306
  html += cur.html;
2299
2307
  effects = concatEffects(effects, cur.effects);
2300
2308
  scripts = concatScripts(scripts, cur.scripts);
2309
+ lastEffect = cur.lastEffect || lastEffect;
2301
2310
  cur.consumed = true;
2302
2311
  cur = cur.next;
2303
2312
  } while (cur.next && !cur.async);
2304
2313
  cur.html = html + cur.html;
2305
2314
  cur.effects = concatEffects(effects, cur.effects);
2306
2315
  cur.scripts = concatScripts(scripts, cur.scripts);
2316
+ cur.lastEffect = lastEffect;
2307
2317
  }
2308
2318
  return cur;
2309
2319
  }
@@ -2382,7 +2392,7 @@ var Chunk = class {
2382
2392
  "#" /* ReorderMarker */,
2383
2393
  cur.reorderId = state.nextReorderId()
2384
2394
  );
2385
- cur.html = cur.effects = cur.scripts = "";
2395
+ cur.html = cur.effects = cur.scripts = cur.lastEffect = "";
2386
2396
  cur.next = null;
2387
2397
  }
2388
2398
  if (next) {
package/dist/dom.js CHANGED
@@ -213,7 +213,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
213
213
  value: resumeRender = (renderId) => {
214
214
  let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
215
215
  _: registeredValues
216
- }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId, $global, lastScopeId = 0;
216
+ }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), lastEffect, currentBranchId, $global, lastScopeId = 0;
217
217
  return render.w = () => {
218
218
  walk2.call(render);
219
219
  let visits = render.v, resumes = render.r;
@@ -287,7 +287,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
287
287
  }
288
288
  }
289
289
  else
290
- registeredValues[resumes[++i]](
290
+ typeof serialized == "string" && (lastEffect = serialized, serialized = resumes[++i]), registeredValues[lastEffect](
291
291
  scopeLookup[serialized],
292
292
  scopeLookup[serialized]
293
293
  );
package/dist/dom.mjs CHANGED
@@ -128,7 +128,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
128
128
  value: resumeRender = (renderId) => {
129
129
  let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, commentPrefixLen = render.i.length, branchStack = [], scopeLookup = render.s = {}, serializeContext = {
130
130
  _: registeredValues
131
- }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), currentBranchId, $global, lastScopeId = 0;
131
+ }, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map(), lastEffect, currentBranchId, $global, lastScopeId = 0;
132
132
  return render.w = () => {
133
133
  walk2.call(render);
134
134
  let visits = render.v, resumes = render.r;
@@ -202,7 +202,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
202
202
  }
203
203
  }
204
204
  else
205
- registeredValues[resumes[++i]](
205
+ typeof serialized == "string" && (lastEffect = serialized, serialized = resumes[++i]), registeredValues[lastEffect](
206
206
  scopeLookup[serialized],
207
207
  scopeLookup[serialized]
208
208
  );
@@ -108,6 +108,7 @@ export declare class Chunk {
108
108
  html: string;
109
109
  scripts: string;
110
110
  effects: string;
111
+ lastEffect: string;
111
112
  async: boolean;
112
113
  consumed: boolean;
113
114
  reorderId: string | null;
package/dist/html.js CHANGED
@@ -1432,7 +1432,7 @@ function tryCatch(content, catchContent) {
1432
1432
  let cur = body, writeMarker = !0;
1433
1433
  do {
1434
1434
  let next = cur.next;
1435
- 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.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1435
+ 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;
1436
1436
  } while (cur !== bodyNext);
1437
1437
  }
1438
1438
  let catchChunk = new Chunk(boundary, null, chunk.context);
@@ -1513,6 +1513,7 @@ var State2 = class {
1513
1513
  html = "";
1514
1514
  scripts = "";
1515
1515
  effects = "";
1516
+ lastEffect = "";
1516
1517
  async = !1;
1517
1518
  consumed = !1;
1518
1519
  reorderId = null;
@@ -1522,16 +1523,16 @@ var State2 = class {
1522
1523
  this.html += html;
1523
1524
  }
1524
1525
  writeEffect(scopeId, registryId) {
1525
- this.effects = concatEffects(
1526
+ this.lastEffect === registryId ? this.effects += "," + scopeId : this.effects = concatEffects(
1526
1527
  this.effects,
1527
- scopeId + ',"' + registryId + '"'
1528
- );
1528
+ '"' + registryId + '",' + scopeId
1529
+ ), this.lastEffect = registryId;
1529
1530
  }
1530
1531
  writeScript(script) {
1531
1532
  this.scripts = concatScripts(this.scripts, script);
1532
1533
  }
1533
1534
  append(chunk) {
1534
- this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts);
1535
+ this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
1535
1536
  }
1536
1537
  flushPlaceholder() {
1537
1538
  if (this.placeholderBody) {
@@ -1551,11 +1552,11 @@ var State2 = class {
1551
1552
  consume() {
1552
1553
  let cur = this;
1553
1554
  if (cur.next && !cur.async) {
1554
- let html = "", effects = "", scripts = "";
1555
+ let html = "", effects = "", scripts = "", lastEffect = "";
1555
1556
  do
1556
- cur.flushPlaceholder(), html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), cur.consumed = !0, cur = cur.next;
1557
+ 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;
1557
1558
  while (cur.next && !cur.async);
1558
- cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts);
1559
+ cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1559
1560
  }
1560
1561
  return cur;
1561
1562
  }
@@ -1595,7 +1596,7 @@ var State2 = class {
1595
1596
  if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1596
1597
  "#" /* ReorderMarker */,
1597
1598
  cur.reorderId = state.nextReorderId()
1598
- ), cur.html = cur.effects = cur.scripts = "", cur.next = null), next)
1599
+ ), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next)
1599
1600
  cur = next;
1600
1601
  else
1601
1602
  break;
package/dist/html.mjs CHANGED
@@ -1350,7 +1350,7 @@ function tryCatch(content, catchContent) {
1350
1350
  let cur = body, writeMarker = !0;
1351
1351
  do {
1352
1352
  let next = cur.next;
1353
- 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.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1353
+ 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;
1354
1354
  } while (cur !== bodyNext);
1355
1355
  }
1356
1356
  let catchChunk = new Chunk(boundary, null, chunk.context);
@@ -1431,6 +1431,7 @@ var State2 = class {
1431
1431
  html = "";
1432
1432
  scripts = "";
1433
1433
  effects = "";
1434
+ lastEffect = "";
1434
1435
  async = !1;
1435
1436
  consumed = !1;
1436
1437
  reorderId = null;
@@ -1440,16 +1441,16 @@ var State2 = class {
1440
1441
  this.html += html;
1441
1442
  }
1442
1443
  writeEffect(scopeId, registryId) {
1443
- this.effects = concatEffects(
1444
+ this.lastEffect === registryId ? this.effects += "," + scopeId : this.effects = concatEffects(
1444
1445
  this.effects,
1445
- scopeId + ',"' + registryId + '"'
1446
- );
1446
+ '"' + registryId + '",' + scopeId
1447
+ ), this.lastEffect = registryId;
1447
1448
  }
1448
1449
  writeScript(script) {
1449
1450
  this.scripts = concatScripts(this.scripts, script);
1450
1451
  }
1451
1452
  append(chunk) {
1452
- this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts);
1453
+ this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
1453
1454
  }
1454
1455
  flushPlaceholder() {
1455
1456
  if (this.placeholderBody) {
@@ -1469,11 +1470,11 @@ var State2 = class {
1469
1470
  consume() {
1470
1471
  let cur = this;
1471
1472
  if (cur.next && !cur.async) {
1472
- let html = "", effects = "", scripts = "";
1473
+ let html = "", effects = "", scripts = "", lastEffect = "";
1473
1474
  do
1474
- cur.flushPlaceholder(), html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), cur.consumed = !0, cur = cur.next;
1475
+ 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;
1475
1476
  while (cur.next && !cur.async);
1476
- cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts);
1477
+ cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1477
1478
  }
1478
1479
  return cur;
1479
1480
  }
@@ -1513,7 +1514,7 @@ var State2 = class {
1513
1514
  if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1514
1515
  "#" /* ReorderMarker */,
1515
1516
  cur.reorderId = state.nextReorderId()
1516
- ), cur.html = cur.effects = cur.scripts = "", cur.next = null), next)
1517
+ ), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next)
1517
1518
  cur = next;
1518
1519
  else
1519
1520
  break;
@@ -6405,7 +6405,7 @@ var for_default = {
6405
6405
  forAttrs.by || import_compiler33.types.numericLiteral(0),
6406
6406
  getScopeIdIdentifier(tagSection),
6407
6407
  getScopeAccessorLiteral(nodeBinding),
6408
- branchSerializeReason !== true && markerSerializeReason && markerSerializeReason !== true && !bindingUtil.isSuperset(
6408
+ branchSerializeReason === true || markerSerializeReason === true ? import_compiler33.types.numericLiteral(1) : markerSerializeReason && !bindingUtil.isSuperset(
6409
6409
  branchSerializeReason,
6410
6410
  markerSerializeReason
6411
6411
  ) ? import_compiler33.types.logicalExpression(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",