marko 6.0.2 → 6.0.4

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.
@@ -35,14 +35,14 @@ export declare function hoist(scopeId: number, id?: string): {
35
35
  };
36
36
  export declare function resumeClosestBranch(scopeId: number): void;
37
37
  export declare function withBranchId<T>(branchId: number, cb: () => T): T;
38
- export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1): void;
39
- export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, onlyChildInParent?: 1): void;
40
- export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1): void;
41
- export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, onlyChild?: 1): void;
42
- export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1): void;
43
- export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, onlyChild?: 1): void;
44
- export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 1): number | void;
45
- export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChild?: 1): number | void;
38
+ export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
39
+ export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
40
+ export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
41
+ export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
42
+ export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
43
+ export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
44
+ export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
45
+ export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
46
46
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
47
47
  export { writeScope };
48
48
  export declare function writeExistingScope(scopeId: number): ScopeInternals;
@@ -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
@@ -39,11 +39,11 @@ __export(html_exports, {
39
39
  escapeStyle: () => escapeStyle,
40
40
  escapeXML: () => escapeXML,
41
41
  forIn: () => forIn,
42
- forInBy: () => forInBy2,
42
+ forInBy: () => forInBy,
43
43
  forOf: () => forOf,
44
- forOfBy: () => forOfBy2,
44
+ forOfBy: () => forOfBy,
45
45
  forTo: () => forTo,
46
- forToBy: () => forToBy2,
46
+ forToBy: () => forToBy,
47
47
  fork: () => fork,
48
48
  getScopeById: () => getScopeById,
49
49
  hoist: () => hoist,
@@ -178,6 +178,17 @@ function forTo(to, from, step, cb) {
178
178
  cb(start + i * delta);
179
179
  }
180
180
 
181
+ // src/html/for.ts
182
+ function forOfBy(by, item, index) {
183
+ return by ? typeof by == "string" ? item[by] : by(item, index) : index;
184
+ }
185
+ function forInBy(by, name, value) {
186
+ return by ? by(name, value) : name;
187
+ }
188
+ function forToBy(by, index) {
189
+ return by ? by(index) : index;
190
+ }
191
+
181
192
  // src/html/inlined-runtimes.ts
182
193
  var WALKER_RUNTIME_CODE = '(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
183
194
 
@@ -1170,161 +1181,166 @@ var branchIdKey = Symbol();
1170
1181
  function withBranchId(branchId, cb) {
1171
1182
  return withContext(branchIdKey, branchId, cb);
1172
1183
  }
1173
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch) {
1174
- if (serializeBranch === 0)
1175
- return forOf(list, cb);
1176
- let loopScopes = /* @__PURE__ */ new Map();
1177
- forOf(list, (item, index) => {
1178
- let branchId = peekNextScopeId();
1179
- $chunk.writeHTML(
1180
- $chunk.boundary.state.mark(
1181
- "[" /* BranchStart */,
1182
- branchId + (index ? " " : "")
1183
- )
1184
- ), withBranchId(branchId, () => {
1185
- cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1184
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1185
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1186
+ if (resumeBranch) {
1187
+ let loopScopes = /* @__PURE__ */ new Map();
1188
+ forOf(list, (item, index) => {
1189
+ let branchId = peekNextScopeId();
1190
+ resumeMarker && $chunk.writeHTML(
1191
+ $chunk.boundary.state.mark(
1192
+ "[" /* BranchStart */,
1193
+ branchId + (index ? " " : "")
1194
+ )
1195
+ ), withBranchId(branchId, () => {
1196
+ cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1197
+ });
1198
+ }), loopScopes.size && writeScope(scopeId, {
1199
+ ["m" /* LoopScopeMap */ + accessor]: loopScopes
1186
1200
  });
1187
- }), loopScopes.size && writeScope(scopeId, {
1188
- ["m" /* LoopScopeMap */ + accessor]: loopScopes
1189
- }), $chunk.writeHTML(
1201
+ } else
1202
+ forOf(list, cb);
1203
+ resumeMarker && $chunk.writeHTML(
1190
1204
  $chunk.boundary.state.mark(
1191
1205
  "]" /* BranchEnd */,
1192
1206
  scopeId + " " + accessor
1193
1207
  )
1194
1208
  );
1195
1209
  }
1196
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, onlyChildInParent) {
1197
- if (serializeBranch === 0)
1198
- return forOf(list, cb);
1199
- let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
1200
- forOf(list, (item, index) => {
1201
- let branchId = peekNextScopeId();
1202
- branchIds = " " + branchId + branchIds, withBranchId(branchId, () => {
1203
- cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1210
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1211
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1212
+ if (resumeBranch) {
1213
+ let loopScopes = /* @__PURE__ */ new Map();
1214
+ forOf(list, (item, index) => {
1215
+ let branchId = peekNextScopeId();
1216
+ resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
1217
+ cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1218
+ });
1219
+ }), loopScopes.size && writeScope(scopeId, {
1220
+ ["m" /* LoopScopeMap */ + accessor]: loopScopes
1204
1221
  });
1205
- }), loopScopes.size && writeScope(scopeId, {
1206
- ["m" /* LoopScopeMap */ + accessor]: loopScopes
1207
- }), $chunk.writeHTML(
1222
+ } else
1223
+ forOf(list, cb);
1224
+ resumeMarker && $chunk.writeHTML(
1208
1225
  $chunk.boundary.state.mark(
1209
1226
  onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1210
1227
  scopeId + " " + accessor + branchIds
1211
1228
  )
1212
1229
  );
1213
1230
  }
1214
- function forOfBy(by, item, index) {
1215
- return by ? typeof by == "string" ? item[by] : by(item, index) : index;
1216
- }
1217
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch) {
1218
- if (serializeBranch === 0)
1219
- return forIn(obj, cb);
1220
- let loopScopes = /* @__PURE__ */ new Map(), sep = "";
1221
- forIn(obj, (key, value) => {
1222
- let branchId = peekNextScopeId();
1223
- $chunk.writeHTML(
1224
- $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1225
- ), sep = " ", withBranchId(branchId, () => {
1226
- cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1231
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1232
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1233
+ if (resumeBranch) {
1234
+ let loopScopes = /* @__PURE__ */ new Map(), sep = "";
1235
+ forIn(obj, (key, value) => {
1236
+ let branchId = peekNextScopeId();
1237
+ resumeMarker && ($chunk.writeHTML(
1238
+ $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1239
+ ), sep = " "), withBranchId(branchId, () => {
1240
+ cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1241
+ });
1242
+ }), loopScopes.size && writeScope(scopeId, {
1243
+ ["m" /* LoopScopeMap */ + accessor]: loopScopes
1227
1244
  });
1228
- }), loopScopes.size && writeScope(scopeId, {
1229
- ["m" /* LoopScopeMap */ + accessor]: loopScopes
1230
- }), $chunk.writeHTML(
1245
+ } else
1246
+ forIn(obj, cb);
1247
+ resumeMarker && $chunk.writeHTML(
1231
1248
  $chunk.boundary.state.mark(
1232
1249
  "]" /* BranchEnd */,
1233
1250
  scopeId + " " + accessor
1234
1251
  )
1235
1252
  );
1236
1253
  }
1237
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, onlyChild) {
1238
- if (serializeBranch === 0)
1239
- return forIn(obj, cb);
1240
- let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
1241
- forIn(obj, (key, value) => {
1242
- let branchId = peekNextScopeId();
1243
- branchIds = " " + branchId + branchIds, withBranchId(branchId, () => {
1244
- cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1254
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1255
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1256
+ if (resumeBranch) {
1257
+ let loopScopes = /* @__PURE__ */ new Map();
1258
+ forIn(obj, (key, value) => {
1259
+ let branchId = peekNextScopeId();
1260
+ resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
1261
+ cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1262
+ });
1263
+ }), loopScopes.size && writeScope(scopeId, {
1264
+ ["m" /* LoopScopeMap */ + accessor]: loopScopes
1245
1265
  });
1246
- }), loopScopes.size && writeScope(scopeId, {
1247
- ["m" /* LoopScopeMap */ + accessor]: loopScopes
1248
- }), $chunk.writeHTML(
1266
+ } else
1267
+ forIn(obj, cb);
1268
+ resumeMarker && $chunk.writeHTML(
1249
1269
  $chunk.boundary.state.mark(
1250
- onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1270
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1251
1271
  scopeId + " " + accessor + branchIds
1252
1272
  )
1253
1273
  );
1254
1274
  }
1255
- function forInBy(by, name, value) {
1256
- return by ? by(name, value) : name;
1257
- }
1258
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch) {
1259
- if (serializeBranch === 0)
1260
- return forTo(to, from, step, cb);
1261
- let loopScopes = /* @__PURE__ */ new Map(), sep = "";
1262
- forTo(to, from, step, (index) => {
1263
- let branchId = peekNextScopeId();
1264
- $chunk.writeHTML(
1265
- $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1266
- ), sep = " ", withBranchId(branchId, () => {
1267
- cb(index), loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
1275
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1276
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1277
+ if (resumeBranch) {
1278
+ let loopScopes = /* @__PURE__ */ new Map(), sep = "";
1279
+ forTo(to, from, step, (i) => {
1280
+ let branchId = peekNextScopeId();
1281
+ resumeMarker && ($chunk.writeHTML(
1282
+ $chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
1283
+ ), sep = " "), withBranchId(branchId, () => {
1284
+ cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
1285
+ });
1286
+ }), loopScopes.size && writeScope(scopeId, {
1287
+ ["m" /* LoopScopeMap */ + accessor]: loopScopes
1268
1288
  });
1269
- }), loopScopes.size && writeScope(scopeId, {
1270
- ["m" /* LoopScopeMap */ + accessor]: loopScopes
1271
- }), $chunk.writeHTML(
1289
+ } else
1290
+ forTo(to, from, step, cb);
1291
+ resumeMarker && $chunk.writeHTML(
1272
1292
  $chunk.boundary.state.mark(
1273
1293
  "]" /* BranchEnd */,
1274
1294
  scopeId + " " + accessor
1275
1295
  )
1276
1296
  );
1277
1297
  }
1278
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, onlyChild) {
1279
- if (serializeBranch === 0)
1280
- return forTo(to, from, step, cb);
1281
- let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
1282
- forTo(to, from, step, (index) => {
1283
- let branchId = peekNextScopeId();
1284
- branchIds = " " + branchId + branchIds, withBranchId(branchId, () => {
1285
- cb(index), loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
1298
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1299
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1300
+ if (resumeBranch) {
1301
+ let loopScopes = /* @__PURE__ */ new Map();
1302
+ forTo(to, from, step, (i) => {
1303
+ let branchId = peekNextScopeId();
1304
+ resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
1305
+ cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
1306
+ });
1307
+ }), loopScopes.size && writeScope(scopeId, {
1308
+ ["m" /* LoopScopeMap */ + accessor]: loopScopes
1286
1309
  });
1287
- }), loopScopes.size && writeScope(scopeId, {
1288
- ["m" /* LoopScopeMap */ + accessor]: loopScopes
1289
- }), $chunk.writeHTML(
1310
+ } else
1311
+ forTo(to, from, step, cb);
1312
+ resumeMarker && $chunk.writeHTML(
1290
1313
  $chunk.boundary.state.mark(
1291
- onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1314
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1292
1315
  scopeId + " " + accessor + branchIds
1293
1316
  )
1294
1317
  );
1295
1318
  }
1296
- function forToBy(by, index) {
1297
- return by ? by(index) : index;
1298
- }
1299
1319
  function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
1300
- if (serializeBranch === 0)
1301
- return cb();
1302
- let branchId = peekNextScopeId();
1303
- serializeMarker && $chunk.writeHTML(
1320
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
1321
+ resumeMarker && resumeBranch && $chunk.writeHTML(
1304
1322
  $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
1305
1323
  );
1306
- let branchIndex = withBranchId(branchId, cb);
1307
- branchIndex !== void 0 ? writeScope(scopeId, {
1308
- ["c" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
1324
+ let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
1325
+ resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
1326
+ ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1309
1327
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1310
- }) : nextScopeId(), serializeMarker && $chunk.writeHTML(
1328
+ }), resumeMarker && $chunk.writeHTML(
1311
1329
  $chunk.boundary.state.mark(
1312
1330
  "]" /* BranchEnd */,
1313
1331
  scopeId + " " + accessor
1314
1332
  )
1315
1333
  );
1316
1334
  }
1317
- function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChild) {
1318
- if (serializeBranch === 0)
1319
- return cb();
1320
- let branchId = peekNextScopeId(), branchIndex = withBranchId(branchId, cb), rendered = branchIndex !== void 0;
1321
- rendered ? writeScope(scopeId, {
1322
- ["c" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
1335
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1336
+ let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId(), branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1337
+ shouldWriteBranch && writeScope(scopeId, {
1338
+ ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1323
1339
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1324
- }) : nextScopeId(), serializeMarker && $chunk.writeHTML(
1340
+ }), resumeMarker && $chunk.writeHTML(
1325
1341
  $chunk.boundary.state.mark(
1326
- onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1327
- scopeId + " " + accessor + (rendered ? " " + branchId : "")
1342
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1343
+ scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1328
1344
  )
1329
1345
  );
1330
1346
  }
@@ -1432,7 +1448,7 @@ function tryCatch(content, catchContent) {
1432
1448
  let cur = body, writeMarker = !0;
1433
1449
  do {
1434
1450
  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;
1451
+ 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
1452
  } while (cur !== bodyNext);
1437
1453
  }
1438
1454
  let catchChunk = new Chunk(boundary, null, chunk.context);
@@ -1513,6 +1529,7 @@ var State2 = class {
1513
1529
  html = "";
1514
1530
  scripts = "";
1515
1531
  effects = "";
1532
+ lastEffect = "";
1516
1533
  async = !1;
1517
1534
  consumed = !1;
1518
1535
  reorderId = null;
@@ -1522,16 +1539,16 @@ var State2 = class {
1522
1539
  this.html += html;
1523
1540
  }
1524
1541
  writeEffect(scopeId, registryId) {
1525
- this.effects = concatEffects(
1542
+ this.lastEffect === registryId ? this.effects += "," + scopeId : this.effects = concatEffects(
1526
1543
  this.effects,
1527
- scopeId + ',"' + registryId + '"'
1528
- );
1544
+ '"' + registryId + '",' + scopeId
1545
+ ), this.lastEffect = registryId;
1529
1546
  }
1530
1547
  writeScript(script) {
1531
1548
  this.scripts = concatScripts(this.scripts, script);
1532
1549
  }
1533
1550
  append(chunk) {
1534
- this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts);
1551
+ 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
1552
  }
1536
1553
  flushPlaceholder() {
1537
1554
  if (this.placeholderBody) {
@@ -1551,11 +1568,11 @@ var State2 = class {
1551
1568
  consume() {
1552
1569
  let cur = this;
1553
1570
  if (cur.next && !cur.async) {
1554
- let html = "", effects = "", scripts = "";
1571
+ let html = "", effects = "", scripts = "", lastEffect = "";
1555
1572
  do
1556
- cur.flushPlaceholder(), html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), cur.consumed = !0, cur = cur.next;
1573
+ 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
1574
  while (cur.next && !cur.async);
1558
- cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts);
1575
+ cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1559
1576
  }
1560
1577
  return cur;
1561
1578
  }
@@ -1595,7 +1612,7 @@ var State2 = class {
1595
1612
  if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1596
1613
  "#" /* ReorderMarker */,
1597
1614
  cur.reorderId = state.nextReorderId()
1598
- ), cur.html = cur.effects = cur.scripts = "", cur.next = null), next)
1615
+ ), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next)
1599
1616
  cur = next;
1600
1617
  else
1601
1618
  break;
@@ -2024,8 +2041,8 @@ function NOOP2() {
2024
2041
  }
2025
2042
 
2026
2043
  // src/html/dynamic-tag.ts
2027
- var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, shouldResume) => {
2028
- let renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
2044
+ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
2045
+ let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
2029
2046
  if (typeof renderer == "string") {
2030
2047
  let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
2031
2048
  if (nextScopeId(), write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`), !voidElementsReg.test(renderer)) {
@@ -2061,7 +2078,7 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
2061
2078
  let input = inputIsArgs ? inputOrArgs[0] : inputOrArgs;
2062
2079
  return renderer(
2063
2080
  content ? { ...input, content } : input,
2064
- shouldResume
2081
+ shouldResume ? 1 : 0
2065
2082
  );
2066
2083
  }
2067
2084
  return inputIsArgs ? renderer(...inputOrArgs) : renderer(
@@ -2170,17 +2187,6 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
2170
2187
  register(RENDER_BODY_ID, fn);
2171
2188
  }
2172
2189
  };
2173
-
2174
- // src/html/for.ts
2175
- function forOfBy2(by, item, index) {
2176
- return by ? typeof by == "string" ? item[by] : by(item, index) : index;
2177
- }
2178
- function forInBy2(by, name, value) {
2179
- return by ? by(name, value) : name;
2180
- }
2181
- function forToBy2(by, index) {
2182
- return by ? by(index) : index;
2183
- }
2184
2190
  // Annotate the CommonJS export names for ESM import in node:
2185
2191
  0 && (module.exports = {
2186
2192
  $global,