@marko/runtime-tags 6.0.110 → 6.0.112

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
@@ -535,19 +535,20 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
535
535
  const serializeContext = {
536
536
  _: registeredValues
537
537
  };
538
- const visitBranches = branchesEnabled && /* @__PURE__ */ (() => {
539
- let curBranchScopes;
540
- const branchScopesStack = [];
541
- const branchStarts = [];
542
- const orphanBranches = [];
543
- const endBranch = (accessor, singleNode) => {
544
- const parent = visit.parentNode;
545
- let startVisit = visit;
546
- let i = orphanBranches.length;
547
- let branchId;
548
- let branch;
549
- let childBranch;
550
- let endedBranches;
538
+ const visitBranches = branchesEnabled && /* @__PURE__ */ ((branchScopesStack = [], branchStarts = [], orphanBranches = [], curBranchScopes) => {
539
+ return (branchId, branch, childBranch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length) => {
540
+ if (visitType !== "[" /* BranchStart */) {
541
+ visitScope["Getter:" /* Getter */ + nextToken(
542
+ /* read accessor */
543
+ )] = /* @__PURE__ */ ((node) => () => node)(
544
+ visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? parent : visit
545
+ );
546
+ accessor = "BranchScopes:" /* BranchScopes */ + lastToken;
547
+ singleNode = visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */;
548
+ nextToken(
549
+ /* read optional first branchId */
550
+ );
551
+ }
551
552
  while (branchId = +lastToken) {
552
553
  (endedBranches ||= []).push(
553
554
  branch = scopeLookup[branchId] ||= {
@@ -592,33 +593,16 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
592
593
  visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
593
594
  }
594
595
  }
595
- };
596
- return () => {
597
596
  if (visitType === "[" /* BranchStart */) {
598
- if (lastToken) {
599
- endBranch();
600
- } else {
597
+ if (!endedBranches) {
601
598
  branchScopesStack.push(curBranchScopes);
602
599
  curBranchScopes = void 0;
603
600
  }
604
601
  branchStarts.push(visit);
605
- } else {
606
- visitScope["Getter:" /* Getter */ + nextToken(
607
- /* read accessor */
608
- )] = /* @__PURE__ */ ((node) => () => node)(
609
- visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
610
- );
611
- endBranch(
612
- "BranchScopes:" /* BranchScopes */ + lastToken,
613
- (nextToken(
614
- /* read optional first branchId */
615
- ), visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */)
616
- );
617
602
  }
618
603
  };
619
604
  })();
620
605
  let $global;
621
- let lastScopeId = 0;
622
606
  let lastEffect;
623
607
  let visits;
624
608
  let resumes;
@@ -628,12 +612,13 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
628
612
  let visitScope;
629
613
  let lastToken;
630
614
  let lastTokenIndex;
615
+ let lastScopeId = 0;
631
616
  const nextToken = () => lastToken = visitText.slice(
632
617
  lastTokenIndex,
633
618
  // eslint-disable-next-line no-cond-assign
634
619
  (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
635
620
  );
636
- render.w = () => {
621
+ render.w = (effects = []) => {
637
622
  try {
638
623
  walk2();
639
624
  isResuming = 1;
@@ -641,11 +626,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
641
626
  if (typeof serialized === "string") {
642
627
  lastEffect = serialized;
643
628
  } else if (typeof serialized === "number") {
644
- queueEffect(
629
+ effects.push(
630
+ registeredValues[lastEffect],
645
631
  scopeLookup[serialized] ||= {
646
632
  ["#Id" /* Id */]: serialized
647
- },
648
- registeredValues[lastEffect]
633
+ }
649
634
  );
650
635
  } else {
651
636
  for (const scope of serialized(serializeContext)) {
@@ -680,7 +665,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
680
665
  visitBranches();
681
666
  }
682
667
  }
683
- run();
668
+ runEffects(effects);
684
669
  } finally {
685
670
  isResuming = visits.length = resumes.length = 0;
686
671
  }
@@ -432,19 +432,20 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
432
432
  const serializeContext = {
433
433
  _: registeredValues
434
434
  };
435
- const visitBranches = branchesEnabled && /* @__PURE__ */ (() => {
436
- let curBranchScopes;
437
- const branchScopesStack = [];
438
- const branchStarts = [];
439
- const orphanBranches = [];
440
- const endBranch = (accessor, singleNode) => {
441
- const parent = visit.parentNode;
442
- let startVisit = visit;
443
- let i = orphanBranches.length;
444
- let branchId;
445
- let branch;
446
- let childBranch;
447
- let endedBranches;
435
+ const visitBranches = branchesEnabled && /* @__PURE__ */ ((branchScopesStack = [], branchStarts = [], orphanBranches = [], curBranchScopes) => {
436
+ return (branchId, branch, childBranch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length) => {
437
+ if (visitType !== "[" /* BranchStart */) {
438
+ visitScope["Getter:" /* Getter */ + nextToken(
439
+ /* read accessor */
440
+ )] = /* @__PURE__ */ ((node) => () => node)(
441
+ visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? parent : visit
442
+ );
443
+ accessor = "BranchScopes:" /* BranchScopes */ + lastToken;
444
+ singleNode = visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */;
445
+ nextToken(
446
+ /* read optional first branchId */
447
+ );
448
+ }
448
449
  while (branchId = +lastToken) {
449
450
  (endedBranches ||= []).push(
450
451
  branch = scopeLookup[branchId] ||= {
@@ -489,33 +490,16 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
489
490
  visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
490
491
  }
491
492
  }
492
- };
493
- return () => {
494
493
  if (visitType === "[" /* BranchStart */) {
495
- if (lastToken) {
496
- endBranch();
497
- } else {
494
+ if (!endedBranches) {
498
495
  branchScopesStack.push(curBranchScopes);
499
496
  curBranchScopes = void 0;
500
497
  }
501
498
  branchStarts.push(visit);
502
- } else {
503
- visitScope["Getter:" /* Getter */ + nextToken(
504
- /* read accessor */
505
- )] = /* @__PURE__ */ ((node) => () => node)(
506
- visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
507
- );
508
- endBranch(
509
- "BranchScopes:" /* BranchScopes */ + lastToken,
510
- (nextToken(
511
- /* read optional first branchId */
512
- ), visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */)
513
- );
514
499
  }
515
500
  };
516
501
  })();
517
502
  let $global;
518
- let lastScopeId = 0;
519
503
  let lastEffect;
520
504
  let visits;
521
505
  let resumes;
@@ -525,12 +509,13 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
525
509
  let visitScope;
526
510
  let lastToken;
527
511
  let lastTokenIndex;
512
+ let lastScopeId = 0;
528
513
  const nextToken = () => lastToken = visitText.slice(
529
514
  lastTokenIndex,
530
515
  // eslint-disable-next-line no-cond-assign
531
516
  (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
532
517
  );
533
- render.w = () => {
518
+ render.w = (effects = []) => {
534
519
  try {
535
520
  walk2();
536
521
  isResuming = 1;
@@ -538,11 +523,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
538
523
  if (typeof serialized === "string") {
539
524
  lastEffect = serialized;
540
525
  } else if (typeof serialized === "number") {
541
- queueEffect(
526
+ effects.push(
527
+ registeredValues[lastEffect],
542
528
  scopeLookup[serialized] ||= {
543
529
  ["#Id" /* Id */]: serialized
544
- },
545
- registeredValues[lastEffect]
530
+ }
546
531
  );
547
532
  } else {
548
533
  for (const scope of serialized(serializeContext)) {
@@ -577,7 +562,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
577
562
  visitBranches();
578
563
  }
579
564
  }
580
- run();
565
+ runEffects(effects);
581
566
  } finally {
582
567
  isResuming = visits.length = resumes.length = 0;
583
568
  }
@@ -30,6 +30,7 @@ __export(html_exports, {
30
30
  _attr_input_checked: () => _attr_input_checked,
31
31
  _attr_input_checkedValue: () => _attr_input_checkedValue,
32
32
  _attr_input_value: () => _attr_input_value,
33
+ _attr_nonce: () => _attr_nonce,
33
34
  _attr_option_value: () => _attr_option_value,
34
35
  _attr_select_value: () => _attr_select_value,
35
36
  _attr_style: () => _attr_style,
@@ -2929,6 +2930,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
2929
2930
  }
2930
2931
  return _attr("open", open);
2931
2932
  }
2933
+ function _attr_nonce() {
2934
+ return getChunk().boundary.state.nonceAttr;
2935
+ }
2932
2936
  function _attr(name, value) {
2933
2937
  return isVoid(value) ? "" : nonVoidAttr(name, value);
2934
2938
  }
@@ -3620,6 +3624,7 @@ function NOOP3() {
3620
3624
  _attr_input_checked,
3621
3625
  _attr_input_checkedValue,
3622
3626
  _attr_input_value,
3627
+ _attr_nonce,
3623
3628
  _attr_option_value,
3624
3629
  _attr_select_value,
3625
3630
  _attr_style,
@@ -2837,6 +2837,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
2837
2837
  }
2838
2838
  return _attr("open", open);
2839
2839
  }
2840
+ function _attr_nonce() {
2841
+ return getChunk().boundary.state.nonceAttr;
2842
+ }
2840
2843
  function _attr(name, value) {
2841
2844
  return isVoid(value) ? "" : nonVoidAttr(name, value);
2842
2845
  }
@@ -3527,6 +3530,7 @@ export {
3527
3530
  _attr_input_checked,
3528
3531
  _attr_input_checkedValue,
3529
3532
  _attr_input_value,
3533
+ _attr_nonce,
3530
3534
  _attr_option_value,
3531
3535
  _attr_select_value,
3532
3536
  _attr_style,
package/dist/dom.js CHANGED
@@ -342,60 +342,51 @@ function init(runtimeId = "M") {
342
342
  value: resumeRender = ((renderId) => {
343
343
  let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, scopeLookup = render.s = {}, serializeContext = {
344
344
  _: registeredValues
345
- }, visitBranches = branchesEnabled && /* @__PURE__ */ (() => {
346
- let curBranchScopes, branchScopesStack = [], branchStarts = [], orphanBranches = [], endBranch = (accessor, singleNode) => {
347
- let parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, branchId, branch, childBranch, endedBranches;
348
- for (; branchId = +lastToken; ) {
349
- if ((endedBranches ||= []).push(
350
- branch = scopeLookup[branchId] ||= {
351
- L: branchId
352
- }
353
- ), branch.F = branch, singleNode) {
354
- for (; startVisit.previousSibling && ~visits.indexOf(
355
- startVisit = startVisit.previousSibling
356
- ); ) ;
357
- branch.K = branch.S = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch.a = startVisit);
358
- } else
359
- curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
360
- for (; i && orphanBranches[--i].L > branchId; )
361
- (childBranch = orphanBranches.pop()).N = branch, (branch.D ||= /* @__PURE__ */ new Set()).add(
362
- childBranch
363
- );
364
- nextToken(
365
- /* read optional next branchId */
345
+ }, visitBranches = branchesEnabled && /* @__PURE__ */ ((branchScopesStack = [], branchStarts = [], orphanBranches = [], curBranchScopes) => (branchId, branch, childBranch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length) => {
346
+ for (visitType !== "[" /* BranchStart */ && (visitScope["J" /* Getter */ + nextToken(
347
+ /* read accessor */
348
+ )] = /* @__PURE__ */ ((node) => () => node)(
349
+ visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? parent : visit
350
+ ), accessor = "A" /* BranchScopes */ + lastToken, singleNode = visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */, nextToken(
351
+ /* read optional first branchId */
352
+ )); branchId = +lastToken; ) {
353
+ if ((endedBranches ||= []).push(
354
+ branch = scopeLookup[branchId] ||= {
355
+ L: branchId
356
+ }
357
+ ), branch.F = branch, singleNode) {
358
+ for (; startVisit.previousSibling && ~visits.indexOf(
359
+ startVisit = startVisit.previousSibling
360
+ ); ) ;
361
+ branch.K = branch.S = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch.a = startVisit);
362
+ } else
363
+ curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
364
+ for (; i && orphanBranches[--i].L > branchId; )
365
+ (childBranch = orphanBranches.pop()).N = branch, (branch.D ||= /* @__PURE__ */ new Set()).add(
366
+ childBranch
366
367
  );
367
- }
368
- endedBranches && (orphanBranches.push(...endedBranches), singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]));
369
- };
370
- return () => {
371
- visitType === "[" /* BranchStart */ ? (lastToken ? endBranch() : (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : (visitScope["J" /* Getter */ + nextToken(
372
- /* read accessor */
373
- )] = /* @__PURE__ */ ((node) => () => node)(
374
- visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
375
- ), endBranch(
376
- "A" /* BranchScopes */ + lastToken,
377
- (nextToken(
378
- /* read optional first branchId */
379
- ), visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */)
380
- ));
381
- };
382
- })(), $global, lastScopeId = 0, lastEffect, visits, resumes, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, nextToken = () => lastToken = visitText.slice(
368
+ nextToken(
369
+ /* read optional next branchId */
370
+ );
371
+ }
372
+ endedBranches && (orphanBranches.push(...endedBranches), singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0])), visitType === "[" /* BranchStart */ && (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit));
373
+ })(), $global, lastEffect, visits, resumes, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, lastScopeId = 0, nextToken = () => lastToken = visitText.slice(
383
374
  lastTokenIndex,
384
375
  // eslint-disable-next-line no-cond-assign
385
376
  (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
386
377
  );
387
- return render.w = () => {
378
+ return render.w = (effects = []) => {
388
379
  try {
389
380
  walk2(), isResuming = 1;
390
381
  for (let serialized of resumes = render.r || [])
391
382
  if (typeof serialized == "string")
392
383
  lastEffect = serialized;
393
384
  else if (typeof serialized == "number")
394
- queueEffect(
385
+ effects.push(
386
+ registeredValues[lastEffect],
395
387
  scopeLookup[serialized] ||= {
396
388
  L: serialized
397
- },
398
- registeredValues[lastEffect]
389
+ }
399
390
  );
400
391
  else
401
392
  for (let scope of serialized(serializeContext))
@@ -406,7 +397,7 @@ function init(runtimeId = "M") {
406
397
  )] ||= {
407
398
  L: +lastToken
408
399
  }, visitType === "*" /* Node */ ? visitScope["J" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && visitBranches();
409
- run();
400
+ runEffects(effects);
410
401
  } finally {
411
402
  isResuming = visits.length = resumes.length = 0;
412
403
  }
package/dist/dom.mjs CHANGED
@@ -242,60 +242,51 @@ function init(runtimeId = "M") {
242
242
  value: resumeRender = ((renderId) => {
243
243
  let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, scopeLookup = render.s = {}, serializeContext = {
244
244
  _: registeredValues
245
- }, visitBranches = branchesEnabled && /* @__PURE__ */ (() => {
246
- let curBranchScopes, branchScopesStack = [], branchStarts = [], orphanBranches = [], endBranch = (accessor, singleNode) => {
247
- let parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, branchId, branch, childBranch, endedBranches;
248
- for (; branchId = +lastToken; ) {
249
- if ((endedBranches ||= []).push(
250
- branch = scopeLookup[branchId] ||= {
251
- L: branchId
252
- }
253
- ), branch.F = branch, singleNode) {
254
- for (; startVisit.previousSibling && ~visits.indexOf(
255
- startVisit = startVisit.previousSibling
256
- ); ) ;
257
- branch.K = branch.S = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch.a = startVisit);
258
- } else
259
- curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
260
- for (; i && orphanBranches[--i].L > branchId; )
261
- (childBranch = orphanBranches.pop()).N = branch, (branch.D ||= /* @__PURE__ */ new Set()).add(
262
- childBranch
263
- );
264
- nextToken(
265
- /* read optional next branchId */
245
+ }, visitBranches = branchesEnabled && /* @__PURE__ */ ((branchScopesStack = [], branchStarts = [], orphanBranches = [], curBranchScopes) => (branchId, branch, childBranch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length) => {
246
+ for (visitType !== "[" /* BranchStart */ && (visitScope["J" /* Getter */ + nextToken(
247
+ /* read accessor */
248
+ )] = /* @__PURE__ */ ((node) => () => node)(
249
+ visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? parent : visit
250
+ ), accessor = "A" /* BranchScopes */ + lastToken, singleNode = visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */, nextToken(
251
+ /* read optional first branchId */
252
+ )); branchId = +lastToken; ) {
253
+ if ((endedBranches ||= []).push(
254
+ branch = scopeLookup[branchId] ||= {
255
+ L: branchId
256
+ }
257
+ ), branch.F = branch, singleNode) {
258
+ for (; startVisit.previousSibling && ~visits.indexOf(
259
+ startVisit = startVisit.previousSibling
260
+ ); ) ;
261
+ branch.K = branch.S = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch.a = startVisit);
262
+ } else
263
+ curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
264
+ for (; i && orphanBranches[--i].L > branchId; )
265
+ (childBranch = orphanBranches.pop()).N = branch, (branch.D ||= /* @__PURE__ */ new Set()).add(
266
+ childBranch
266
267
  );
267
- }
268
- endedBranches && (orphanBranches.push(...endedBranches), singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]));
269
- };
270
- return () => {
271
- visitType === "[" /* BranchStart */ ? (lastToken ? endBranch() : (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : (visitScope["J" /* Getter */ + nextToken(
272
- /* read accessor */
273
- )] = /* @__PURE__ */ ((node) => () => node)(
274
- visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
275
- ), endBranch(
276
- "A" /* BranchScopes */ + lastToken,
277
- (nextToken(
278
- /* read optional first branchId */
279
- ), visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */)
280
- ));
281
- };
282
- })(), $global, lastScopeId = 0, lastEffect, visits, resumes, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, nextToken = () => lastToken = visitText.slice(
268
+ nextToken(
269
+ /* read optional next branchId */
270
+ );
271
+ }
272
+ endedBranches && (orphanBranches.push(...endedBranches), singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0])), visitType === "[" /* BranchStart */ && (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit));
273
+ })(), $global, lastEffect, visits, resumes, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, lastScopeId = 0, nextToken = () => lastToken = visitText.slice(
283
274
  lastTokenIndex,
284
275
  // eslint-disable-next-line no-cond-assign
285
276
  (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
286
277
  );
287
- return render.w = () => {
278
+ return render.w = (effects = []) => {
288
279
  try {
289
280
  walk2(), isResuming = 1;
290
281
  for (let serialized of resumes = render.r || [])
291
282
  if (typeof serialized == "string")
292
283
  lastEffect = serialized;
293
284
  else if (typeof serialized == "number")
294
- queueEffect(
285
+ effects.push(
286
+ registeredValues[lastEffect],
295
287
  scopeLookup[serialized] ||= {
296
288
  L: serialized
297
- },
298
- registeredValues[lastEffect]
289
+ }
299
290
  );
300
291
  else
301
292
  for (let scope of serialized(serializeContext))
@@ -306,7 +297,7 @@ function init(runtimeId = "M") {
306
297
  )] ||= {
307
298
  L: +lastToken
308
299
  }, visitType === "*" /* Node */ ? visitScope["J" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && visitBranches();
309
- run();
300
+ runEffects(effects);
310
301
  } finally {
311
302
  isResuming = visits.length = resumes.length = 0;
312
303
  }
@@ -8,6 +8,7 @@ export declare function _attr_input_value(scopeId: number, nodeAccessor: Accesso
8
8
  export declare function _attr_input_checked(scopeId: number, nodeAccessor: Accessor, checked: unknown, checkedChange: unknown): string;
9
9
  export declare function _attr_input_checkedValue(scopeId: number, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown): string;
10
10
  export declare function _attr_details_or_dialog_open(scopeId: number, nodeAccessor: Accessor, open: unknown, openChange: unknown): string;
11
+ export declare function _attr_nonce(): string;
11
12
  export declare function _attr(name: string, value: unknown): string;
12
13
  export declare function _attrs(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string): string;
13
14
  export declare function _attrs_content(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string, serializeReason?: 1 | 0): void;
package/dist/html.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
3
- export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
3
+ export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
4
4
  export { compat } from "./html/compat";
5
5
  export { _escape, _escape_script, _escape_style, _escape_textarea_value, _unescaped, } from "./html/content";
6
6
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
package/dist/html.js CHANGED
@@ -27,6 +27,7 @@ __export(html_exports, {
27
27
  _attr_input_checked: () => _attr_input_checked,
28
28
  _attr_input_checkedValue: () => _attr_input_checkedValue,
29
29
  _attr_input_value: () => _attr_input_value,
30
+ _attr_nonce: () => _attr_nonce,
30
31
  _attr_option_value: () => _attr_option_value,
31
32
  _attr_select_value: () => _attr_select_value,
32
33
  _attr_style: () => _attr_style,
@@ -1820,6 +1821,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
1820
1821
  openChange
1821
1822
  ), _attr("open", open);
1822
1823
  }
1824
+ function _attr_nonce() {
1825
+ return getChunk().boundary.state.nonceAttr;
1826
+ }
1823
1827
  function _attr(name, value) {
1824
1828
  return isVoid(value) ? "" : nonVoidAttr(name, value);
1825
1829
  }
@@ -2301,6 +2305,7 @@ function NOOP3() {
2301
2305
  _attr_input_checked,
2302
2306
  _attr_input_checkedValue,
2303
2307
  _attr_input_value,
2308
+ _attr_nonce,
2304
2309
  _attr_option_value,
2305
2310
  _attr_select_value,
2306
2311
  _attr_style,
package/dist/html.mjs CHANGED
@@ -1731,6 +1731,9 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
1731
1731
  openChange
1732
1732
  ), _attr("open", open);
1733
1733
  }
1734
+ function _attr_nonce() {
1735
+ return getChunk().boundary.state.nonceAttr;
1736
+ }
1734
1737
  function _attr(name, value) {
1735
1738
  return isVoid(value) ? "" : nonVoidAttr(name, value);
1736
1739
  }
@@ -2211,6 +2214,7 @@ export {
2211
2214
  _attr_input_checked,
2212
2215
  _attr_input_checkedValue,
2213
2216
  _attr_input_value,
2217
+ _attr_nonce,
2214
2218
  _attr_option_value,
2215
2219
  _attr_select_value,
2216
2220
  _attr_style,
@@ -9832,8 +9832,11 @@ var html_script_default = {
9832
9832
  visit(tag, 32 /* Get */);
9833
9833
  }
9834
9834
  write`<script`;
9835
- const usedAttrs = getUsedAttrs2(tag.node);
9836
- const { staticAttrs, skipExpression, spreadExpression } = usedAttrs;
9835
+ const usedAttrs = getUsedAttrs2(tag.node, isHTML);
9836
+ const { hasNonce, staticAttrs, skipExpression, spreadExpression } = usedAttrs;
9837
+ if (isHTML && !hasNonce && !spreadExpression) {
9838
+ write`${callRuntime("_attr_nonce")}`;
9839
+ }
9837
9840
  for (const attr of staticAttrs) {
9838
9841
  const { name: name2, value } = attr;
9839
9842
  const { confident, computed } = value.extra || {};
@@ -10022,7 +10025,7 @@ var html_script_default = {
10022
10025
  }
10023
10026
  ]
10024
10027
  };
10025
- function getUsedAttrs2(tag) {
10028
+ function getUsedAttrs2(tag, injectNonce) {
10026
10029
  const seen = {};
10027
10030
  const { attributes } = tag;
10028
10031
  const maybeStaticAttrs = /* @__PURE__ */ new Set();
@@ -10030,6 +10033,7 @@ function getUsedAttrs2(tag) {
10030
10033
  let skipExpression;
10031
10034
  let spreadProps;
10032
10035
  let skipProps;
10036
+ let hasNonce = false;
10033
10037
  for (let i = attributes.length; i--; ) {
10034
10038
  const attr = attributes[i];
10035
10039
  const { value } = attr;
@@ -10040,6 +10044,9 @@ function getUsedAttrs2(tag) {
10040
10044
  spreadProps.push(import_compiler44.types.spreadElement(value));
10041
10045
  } else if (!seen[attr.name]) {
10042
10046
  seen[attr.name] = attr;
10047
+ if (attr.name === "nonce") {
10048
+ hasNonce = true;
10049
+ }
10043
10050
  if (spreadProps) {
10044
10051
  spreadProps.push(toObjectProperty(attr.name, attr.value));
10045
10052
  } else {
@@ -10056,9 +10063,18 @@ function getUsedAttrs2(tag) {
10056
10063
  if (skipProps) {
10057
10064
  skipExpression = import_compiler44.types.objectExpression(skipProps);
10058
10065
  }
10066
+ if (injectNonce && !hasNonce) {
10067
+ spreadProps.unshift(
10068
+ import_compiler44.types.objectProperty(
10069
+ import_compiler44.types.identifier("nonce"),
10070
+ import_compiler44.types.memberExpression(callRuntime("$global"), import_compiler44.types.identifier("cspNonce"))
10071
+ )
10072
+ );
10073
+ }
10059
10074
  spreadExpression = propsToExpression(spreadProps);
10060
10075
  }
10061
10076
  return {
10077
+ hasNonce,
10062
10078
  staticAttrs,
10063
10079
  spreadExpression,
10064
10080
  skipExpression
@@ -10173,8 +10189,11 @@ var html_style_default = {
10173
10189
  visit(tag, 32 /* Get */);
10174
10190
  }
10175
10191
  write`<style`;
10176
- const usedAttrs = getUsedAttrs3(tag.node);
10177
- const { staticAttrs, skipExpression, spreadExpression } = usedAttrs;
10192
+ const usedAttrs = getUsedAttrs3(tag.node, isHTML);
10193
+ const { hasNonce, staticAttrs, skipExpression, spreadExpression } = usedAttrs;
10194
+ if (isHTML && !hasNonce && !spreadExpression) {
10195
+ write`${callRuntime("_attr_nonce")}`;
10196
+ }
10178
10197
  for (const attr of staticAttrs) {
10179
10198
  const { name: name2, value } = attr;
10180
10199
  const { confident, computed } = value.extra || {};
@@ -10358,7 +10377,7 @@ var html_style_default = {
10358
10377
  }
10359
10378
  ]
10360
10379
  };
10361
- function getUsedAttrs3(tag) {
10380
+ function getUsedAttrs3(tag, injectNonce) {
10362
10381
  const seen = {};
10363
10382
  const { attributes } = tag;
10364
10383
  const maybeStaticAttrs = /* @__PURE__ */ new Set();
@@ -10366,6 +10385,7 @@ function getUsedAttrs3(tag) {
10366
10385
  let skipExpression;
10367
10386
  let spreadProps;
10368
10387
  let skipProps;
10388
+ let hasNonce = false;
10369
10389
  for (let i = attributes.length; i--; ) {
10370
10390
  const attr = attributes[i];
10371
10391
  const { value } = attr;
@@ -10376,6 +10396,9 @@ function getUsedAttrs3(tag) {
10376
10396
  spreadProps.push(import_compiler45.types.spreadElement(value));
10377
10397
  } else if (!seen[attr.name]) {
10378
10398
  seen[attr.name] = attr;
10399
+ if (attr.name === "nonce") {
10400
+ hasNonce = true;
10401
+ }
10379
10402
  if (spreadProps) {
10380
10403
  spreadProps.push(toObjectProperty(attr.name, attr.value));
10381
10404
  } else {
@@ -10392,9 +10415,18 @@ function getUsedAttrs3(tag) {
10392
10415
  if (skipProps) {
10393
10416
  skipExpression = import_compiler45.types.objectExpression(skipProps);
10394
10417
  }
10418
+ if (injectNonce && !hasNonce) {
10419
+ spreadProps.unshift(
10420
+ import_compiler45.types.objectProperty(
10421
+ import_compiler45.types.identifier("nonce"),
10422
+ import_compiler45.types.memberExpression(callRuntime("$global"), import_compiler45.types.identifier("cspNonce"))
10423
+ )
10424
+ );
10425
+ }
10395
10426
  spreadExpression = propsToExpression(spreadProps);
10396
10427
  }
10397
10428
  return {
10429
+ hasNonce,
10398
10430
  staticAttrs,
10399
10431
  spreadExpression,
10400
10432
  skipExpression
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "6.0.110",
3
+ "version": "6.0.112",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",