marko 6.0.0-next.3.36 → 6.0.0-next.3.38

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.
@@ -25,6 +25,7 @@ export declare enum ResumeSymbol {
25
25
  BranchStart = "[",
26
26
  BranchEnd = "]",
27
27
  BranchSingleNode = "|",
28
+ BranchSingleNodeOnlyChildInParent = "=",
28
29
  ClosestBranch = "$"
29
30
  }
30
31
  export declare enum AccessorChar {
package/dist/debug/dom.js CHANGED
@@ -29,7 +29,6 @@ __export(dom_exports, {
29
29
  compat: () => compat,
30
30
  conditional: () => conditional,
31
31
  conditionalClosure: () => conditionalClosure,
32
- conditionalOnlyChild: () => conditionalOnlyChild,
33
32
  controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
34
33
  controllable_detailsOrDialog_open_effect: () => controllable_detailsOrDialog_open_effect,
35
34
  controllable_input_checked: () => controllable_input_checked,
@@ -47,6 +46,7 @@ __export(dom_exports, {
47
46
  createTemplate: () => createTemplate,
48
47
  data: () => data,
49
48
  dynamicClosure: () => dynamicClosure,
49
+ dynamicTag: () => dynamicTag,
50
50
  dynamicTagAttrs: () => dynamicTagAttrs,
51
51
  effect: () => effect,
52
52
  forIn: () => forIn,
@@ -239,20 +239,13 @@ function on(element, type, handler) {
239
239
  if (!handlersByElement.has(element)) {
240
240
  defaultDelegator(element, type, handleDelegated);
241
241
  }
242
- handlersByElement.set(element, handler || void 0);
242
+ handlersByElement.set(element, handler || null);
243
243
  }
244
244
  function createDelegator() {
245
- const delegatedEventsByRoot = /* @__PURE__ */ new WeakMap();
245
+ const kEvents = Symbol();
246
246
  return function ensureDelegated(node, type, handler) {
247
247
  const root = node.getRootNode();
248
- let delegatedEvents = delegatedEventsByRoot.get(root);
249
- if (!delegatedEvents) {
250
- delegatedEventsByRoot.set(root, delegatedEvents = /* @__PURE__ */ new Set());
251
- }
252
- if (!delegatedEvents.has(type)) {
253
- delegatedEvents.add(type);
254
- root.addEventListener(type, handler, true);
255
- }
248
+ (root[kEvents] ||= {})[type] ||= (root.addEventListener(type, handler, true), 1);
256
249
  };
257
250
  }
258
251
  function handleDelegated(ev) {
@@ -386,9 +379,10 @@ var Render = class {
386
379
  curParent.prepend(startNode);
387
380
  }
388
381
  this.___currentScopeId = this.___scopeStack.pop();
389
- } else if (token === "|" /* BranchSingleNode */) {
382
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
390
383
  let next = data3.indexOf(" ");
391
- let curNode = scope[~next ? data3.slice(0, next) : data3] = visit;
384
+ let curNode = visit;
385
+ scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
392
386
  while (~next) {
393
387
  const start = next + 1;
394
388
  next = data3.indexOf(" ", start);
@@ -627,7 +621,7 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
627
621
  }
628
622
  function controllable_select_value_effect(scope, nodeAccessor) {
629
623
  const el = scope[nodeAccessor];
630
- syncControllable(el, "input", hasSelectChanged, () => {
624
+ const onChange = () => {
631
625
  const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
632
626
  if (valueChange) {
633
627
  scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
@@ -643,7 +637,19 @@ function controllable_select_value_effect(scope, nodeAccessor) {
643
637
  );
644
638
  }
645
639
  }
646
- });
640
+ };
641
+ if (!controllableHandlers.has(el)) {
642
+ new MutationObserver(() => {
643
+ const value2 = scope[nodeAccessor + ":" /* ControlledValue */];
644
+ if (Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) {
645
+ onChange();
646
+ }
647
+ }).observe(el, {
648
+ childList: true,
649
+ subtree: true
650
+ });
651
+ }
652
+ syncControllable(el, "input", hasSelectChanged, onChange);
647
653
  }
648
654
  function setSelectOptions(el, value2, valueChange) {
649
655
  if (Array.isArray(value2)) {
@@ -726,25 +732,27 @@ function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
726
732
  scope[nodeAccessor].defaultChecked = checked;
727
733
  }
728
734
  }
729
- var delegateFormControl = createDelegator();
730
- var formChangeHandlers = /* @__PURE__ */ new WeakMap();
735
+ var controllableDelegate = createDelegator();
736
+ var controllableHandlers = /* @__PURE__ */ new WeakMap();
731
737
  function syncControllable(el, event, hasChanged, onChange) {
732
- formChangeHandlers.set(el, onChange);
733
- delegateFormControl(el, event, onFormChange);
734
- if (el.form) {
735
- delegateFormControl(el.form, "reset", onFormReset);
736
- }
737
- if (isResuming && hasChanged(el)) {
738
- queueMicrotask(onChange);
738
+ if (!controllableHandlers.has(el)) {
739
+ controllableDelegate(el, event, handleChange);
740
+ if (el.form) {
741
+ controllableDelegate(el.form, "reset", handleFormReset);
742
+ }
743
+ if (isResuming && hasChanged(el)) {
744
+ queueMicrotask(onChange);
745
+ }
739
746
  }
747
+ controllableHandlers.set(el, onChange);
740
748
  }
741
- function onFormChange(ev) {
742
- formChangeHandlers.get(ev.target)?.(ev);
749
+ function handleChange(ev) {
750
+ controllableHandlers.get(ev.target)?.(ev);
743
751
  }
744
- function onFormReset(ev) {
752
+ function handleFormReset(ev) {
745
753
  const handlers = [];
746
754
  for (const el of ev.target.elements) {
747
- const handler = formChangeHandlers.get(el);
755
+ const handler = controllableHandlers.get(el);
748
756
  if (handler && hasFormElementChanged(el)) {
749
757
  handlers.push(handler);
750
758
  }
@@ -1407,7 +1415,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
1407
1415
  "A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
1408
1416
  );
1409
1417
  }
1410
- setConditionalRendererOnlyChild(childScope, nodeAccessor2, content);
1418
+ setConditionalRendererOnlyChild(
1419
+ childScope,
1420
+ nodeAccessor2,
1421
+ content,
1422
+ createBranchScopeWithTagNameOrRenderer
1423
+ );
1411
1424
  attrs(childScope, nodeAccessor2, attrsOrOp());
1412
1425
  } else if (renderer.___args) {
1413
1426
  const attributes = attrsOrOp();
@@ -1435,7 +1448,6 @@ function createRendererWithOwner(template, rawWalks, setup, getArgs) {
1435
1448
  ___setup: setup,
1436
1449
  ___clone: _clone,
1437
1450
  ___owner: owner,
1438
- ___sourceNode: void 0,
1439
1451
  get ___args() {
1440
1452
  return args ||= getArgs?.();
1441
1453
  }
@@ -1460,11 +1472,23 @@ function createCloneableHTML(html2, ns) {
1460
1472
  }
1461
1473
 
1462
1474
  // src/dom/control-flow.ts
1463
- function patchConditionals(fn) {
1464
- conditional = fn(conditional);
1465
- conditionalOnlyChild = fn(conditionalOnlyChild);
1475
+ function conditional(nodeAccessor, ...branches) {
1476
+ const branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1477
+ return (scope, newBranchIndexOrOp) => {
1478
+ if (newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN) {
1479
+ (scope[nodeAccessor].nodeType > 1 /* Element */ ? setConditionalRenderer : setConditionalRendererOnlyChild)(
1480
+ scope,
1481
+ nodeAccessor,
1482
+ branches[scope[branchAccessor] = newBranchIndexOrOp],
1483
+ createBranchScopeWithRenderer
1484
+ );
1485
+ }
1486
+ };
1487
+ }
1488
+ function patchDynamicTag(fn) {
1489
+ dynamicTag = fn(dynamicTag);
1466
1490
  }
1467
- var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1491
+ var dynamicTag = function dynamicTag2(nodeAccessor, fn, getIntersection) {
1468
1492
  const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1469
1493
  let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1470
1494
  return (scope, newRendererOrOp) => {
@@ -1475,7 +1499,12 @@ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1475
1499
  const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1476
1500
  if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
1477
1501
  scope[rendererAccessor] = normalizedRenderer;
1478
- setConditionalRenderer(scope, nodeAccessor, normalizedRenderer);
1502
+ setConditionalRenderer(
1503
+ scope,
1504
+ nodeAccessor,
1505
+ normalizedRenderer,
1506
+ createBranchScopeWithTagNameOrRenderer
1507
+ );
1479
1508
  fn && fn(scope);
1480
1509
  op = DIRTY;
1481
1510
  } else {
@@ -1485,56 +1514,28 @@ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1485
1514
  intersection2?.(scope, op);
1486
1515
  };
1487
1516
  };
1488
- function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
1517
+ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1489
1518
  const prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]);
1490
- const newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
1519
+ const newBranch = newRenderer ? createBranch2(
1491
1520
  newRenderer,
1492
1521
  scope.$global,
1493
1522
  scope,
1494
1523
  prevBranch.___endNode.parentNode
1495
1524
  ) : getEmptyBranch(scope[nodeAccessor]);
1496
- insertBranchBefore(
1497
- newBranch,
1498
- prevBranch.___endNode.parentNode,
1499
- prevBranch.___endNode.nextSibling
1500
- );
1501
- removeAndDestroyBranch(prevBranch);
1502
- scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
1525
+ if (prevBranch !== newBranch) {
1526
+ insertBranchBefore(
1527
+ newBranch,
1528
+ prevBranch.___endNode.parentNode,
1529
+ prevBranch.___endNode.nextSibling
1530
+ );
1531
+ removeAndDestroyBranch(prevBranch);
1532
+ scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
1533
+ }
1503
1534
  }
1504
- var conditionalOnlyChild = function conditional3(nodeAccessor, fn, getIntersection) {
1505
- const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1506
- let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1507
- return (scope, newRendererOrOp) => {
1508
- if (newRendererOrOp === DIRTY) return;
1509
- let currentRenderer = scope[rendererAccessor];
1510
- let op = newRendererOrOp;
1511
- if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1512
- const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1513
- if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
1514
- currentRenderer = scope[rendererAccessor] = normalizedRenderer;
1515
- setConditionalRendererOnlyChild(
1516
- scope,
1517
- nodeAccessor,
1518
- normalizedRenderer
1519
- );
1520
- fn && fn(scope);
1521
- op = DIRTY;
1522
- } else {
1523
- op = CLEAN;
1524
- }
1525
- }
1526
- intersection2?.(scope, op);
1527
- };
1528
- };
1529
- function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
1535
+ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
1530
1536
  const prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */];
1531
1537
  const referenceNode = scope[nodeAccessor];
1532
- const newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
1533
- newRenderer,
1534
- scope.$global,
1535
- scope,
1536
- referenceNode
1537
- ) : void 0;
1538
+ const newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
1538
1539
  referenceNode.textContent = "";
1539
1540
  if (newBranch) {
1540
1541
  insertBranchBefore(newBranch, referenceNode, null);
@@ -1543,10 +1544,10 @@ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
1543
1544
  scope[nodeAccessor + "!" /* ConditionalScope */] = newBranch;
1544
1545
  }
1545
1546
  var emptyMarkerMap = /* @__PURE__ */ new Map([
1546
- [Symbol(), getEmptyBranch(void 0)]
1547
+ [Symbol(), /* @__PURE__ */ getEmptyBranch(0)]
1547
1548
  ]);
1548
1549
  var emptyMarkerArray = [
1549
- /* @__PURE__ */ getEmptyBranch(void 0)
1550
+ /* @__PURE__ */ getEmptyBranch(0)
1550
1551
  ];
1551
1552
  var emptyMap = /* @__PURE__ */ new Map();
1552
1553
  var emptyArray = [];
@@ -1764,14 +1765,14 @@ function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
1764
1765
  helperSignal._ = signal;
1765
1766
  return helperSignal;
1766
1767
  }
1767
- function conditionalClosure(ownerConditionalNodeAccessor, getRenderer, fn, getIntersection) {
1768
+ function conditionalClosure(ownerConditionalNodeAccessor, branch, fn, getIntersection) {
1768
1769
  const signal = closure(fn, getIntersection);
1769
1770
  const scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */;
1770
- const rendererAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */;
1771
+ const branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */;
1771
1772
  const helperSignal = (scope, value2) => {
1772
- const conditionalScope = scope[scopeAccessor];
1773
- if (conditionalScope && !conditionalScope.___pending && scope[rendererAccessor]?.___id === getRenderer().___id) {
1774
- queueSource(conditionalScope, signal, value2);
1773
+ const ifScope = scope[scopeAccessor];
1774
+ if (ifScope && !ifScope.___pending && scope[branchAccessor] === branch) {
1775
+ queueSource(ifScope, signal, value2);
1775
1776
  }
1776
1777
  };
1777
1778
  helperSignal._ = signal;
@@ -1973,7 +1974,7 @@ var RENDER_BODY_ID = prefix + (true ? "renderBody" : "b");
1973
1974
  // src/dom/compat.ts
1974
1975
  var classIdToBranch = /* @__PURE__ */ new Map();
1975
1976
  var compat = {
1976
- patchConditionals,
1977
+ patchConditionals: patchDynamicTag,
1977
1978
  queueEffect,
1978
1979
  init(warp10Noop) {
1979
1980
  register(SET_SCOPE_REGISTER_ID, (branch) => {
@@ -1988,7 +1989,7 @@ var compat = {
1988
1989
  return value2 === MARK || value2 === CLEAN || value2 === DIRTY;
1989
1990
  },
1990
1991
  isRenderer(renderer) {
1991
- return renderer.___clone !== void 0;
1992
+ return renderer.___clone;
1992
1993
  },
1993
1994
  getStartNode(branch) {
1994
1995
  return branch.___startNode;
@@ -2018,7 +2019,7 @@ var compat = {
2018
2019
  return value2;
2019
2020
  },
2020
2021
  createRenderer(setup, clone, args) {
2021
- const renderer = createRenderer("", void 0, setup, args && (() => args));
2022
+ const renderer = createRenderer("", 0, setup, args && (() => args));
2022
2023
  renderer.___clone = clone;
2023
2024
  return renderer;
2024
2025
  },
@@ -153,20 +153,13 @@ function on(element, type, handler) {
153
153
  if (!handlersByElement.has(element)) {
154
154
  defaultDelegator(element, type, handleDelegated);
155
155
  }
156
- handlersByElement.set(element, handler || void 0);
156
+ handlersByElement.set(element, handler || null);
157
157
  }
158
158
  function createDelegator() {
159
- const delegatedEventsByRoot = /* @__PURE__ */ new WeakMap();
159
+ const kEvents = Symbol();
160
160
  return function ensureDelegated(node, type, handler) {
161
161
  const root = node.getRootNode();
162
- let delegatedEvents = delegatedEventsByRoot.get(root);
163
- if (!delegatedEvents) {
164
- delegatedEventsByRoot.set(root, delegatedEvents = /* @__PURE__ */ new Set());
165
- }
166
- if (!delegatedEvents.has(type)) {
167
- delegatedEvents.add(type);
168
- root.addEventListener(type, handler, true);
169
- }
162
+ (root[kEvents] ||= {})[type] ||= (root.addEventListener(type, handler, true), 1);
170
163
  };
171
164
  }
172
165
  function handleDelegated(ev) {
@@ -300,9 +293,10 @@ var Render = class {
300
293
  curParent.prepend(startNode);
301
294
  }
302
295
  this.___currentScopeId = this.___scopeStack.pop();
303
- } else if (token === "|" /* BranchSingleNode */) {
296
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
304
297
  let next = data3.indexOf(" ");
305
- let curNode = scope[~next ? data3.slice(0, next) : data3] = visit;
298
+ let curNode = visit;
299
+ scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
306
300
  while (~next) {
307
301
  const start = next + 1;
308
302
  next = data3.indexOf(" ", start);
@@ -541,7 +535,7 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
541
535
  }
542
536
  function controllable_select_value_effect(scope, nodeAccessor) {
543
537
  const el = scope[nodeAccessor];
544
- syncControllable(el, "input", hasSelectChanged, () => {
538
+ const onChange = () => {
545
539
  const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
546
540
  if (valueChange) {
547
541
  scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */;
@@ -557,7 +551,19 @@ function controllable_select_value_effect(scope, nodeAccessor) {
557
551
  );
558
552
  }
559
553
  }
560
- });
554
+ };
555
+ if (!controllableHandlers.has(el)) {
556
+ new MutationObserver(() => {
557
+ const value2 = scope[nodeAccessor + ":" /* ControlledValue */];
558
+ if (Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) {
559
+ onChange();
560
+ }
561
+ }).observe(el, {
562
+ childList: true,
563
+ subtree: true
564
+ });
565
+ }
566
+ syncControllable(el, "input", hasSelectChanged, onChange);
561
567
  }
562
568
  function setSelectOptions(el, value2, valueChange) {
563
569
  if (Array.isArray(value2)) {
@@ -640,25 +646,27 @@ function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
640
646
  scope[nodeAccessor].defaultChecked = checked;
641
647
  }
642
648
  }
643
- var delegateFormControl = createDelegator();
644
- var formChangeHandlers = /* @__PURE__ */ new WeakMap();
649
+ var controllableDelegate = createDelegator();
650
+ var controllableHandlers = /* @__PURE__ */ new WeakMap();
645
651
  function syncControllable(el, event, hasChanged, onChange) {
646
- formChangeHandlers.set(el, onChange);
647
- delegateFormControl(el, event, onFormChange);
648
- if (el.form) {
649
- delegateFormControl(el.form, "reset", onFormReset);
650
- }
651
- if (isResuming && hasChanged(el)) {
652
- queueMicrotask(onChange);
652
+ if (!controllableHandlers.has(el)) {
653
+ controllableDelegate(el, event, handleChange);
654
+ if (el.form) {
655
+ controllableDelegate(el.form, "reset", handleFormReset);
656
+ }
657
+ if (isResuming && hasChanged(el)) {
658
+ queueMicrotask(onChange);
659
+ }
653
660
  }
661
+ controllableHandlers.set(el, onChange);
654
662
  }
655
- function onFormChange(ev) {
656
- formChangeHandlers.get(ev.target)?.(ev);
663
+ function handleChange(ev) {
664
+ controllableHandlers.get(ev.target)?.(ev);
657
665
  }
658
- function onFormReset(ev) {
666
+ function handleFormReset(ev) {
659
667
  const handlers = [];
660
668
  for (const el of ev.target.elements) {
661
- const handler = formChangeHandlers.get(el);
669
+ const handler = controllableHandlers.get(el);
662
670
  if (handler && hasFormElementChanged(el)) {
663
671
  handlers.push(handler);
664
672
  }
@@ -1321,7 +1329,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
1321
1329
  "A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
1322
1330
  );
1323
1331
  }
1324
- setConditionalRendererOnlyChild(childScope, nodeAccessor2, content);
1332
+ setConditionalRendererOnlyChild(
1333
+ childScope,
1334
+ nodeAccessor2,
1335
+ content,
1336
+ createBranchScopeWithTagNameOrRenderer
1337
+ );
1325
1338
  attrs(childScope, nodeAccessor2, attrsOrOp());
1326
1339
  } else if (renderer.___args) {
1327
1340
  const attributes = attrsOrOp();
@@ -1349,7 +1362,6 @@ function createRendererWithOwner(template, rawWalks, setup, getArgs) {
1349
1362
  ___setup: setup,
1350
1363
  ___clone: _clone,
1351
1364
  ___owner: owner,
1352
- ___sourceNode: void 0,
1353
1365
  get ___args() {
1354
1366
  return args ||= getArgs?.();
1355
1367
  }
@@ -1374,11 +1386,23 @@ function createCloneableHTML(html2, ns) {
1374
1386
  }
1375
1387
 
1376
1388
  // src/dom/control-flow.ts
1377
- function patchConditionals(fn) {
1378
- conditional = fn(conditional);
1379
- conditionalOnlyChild = fn(conditionalOnlyChild);
1389
+ function conditional(nodeAccessor, ...branches) {
1390
+ const branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1391
+ return (scope, newBranchIndexOrOp) => {
1392
+ if (newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN) {
1393
+ (scope[nodeAccessor].nodeType > 1 /* Element */ ? setConditionalRenderer : setConditionalRendererOnlyChild)(
1394
+ scope,
1395
+ nodeAccessor,
1396
+ branches[scope[branchAccessor] = newBranchIndexOrOp],
1397
+ createBranchScopeWithRenderer
1398
+ );
1399
+ }
1400
+ };
1401
+ }
1402
+ function patchDynamicTag(fn) {
1403
+ dynamicTag = fn(dynamicTag);
1380
1404
  }
1381
- var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1405
+ var dynamicTag = function dynamicTag2(nodeAccessor, fn, getIntersection) {
1382
1406
  const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1383
1407
  let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1384
1408
  return (scope, newRendererOrOp) => {
@@ -1389,7 +1413,12 @@ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1389
1413
  const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1390
1414
  if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
1391
1415
  scope[rendererAccessor] = normalizedRenderer;
1392
- setConditionalRenderer(scope, nodeAccessor, normalizedRenderer);
1416
+ setConditionalRenderer(
1417
+ scope,
1418
+ nodeAccessor,
1419
+ normalizedRenderer,
1420
+ createBranchScopeWithTagNameOrRenderer
1421
+ );
1393
1422
  fn && fn(scope);
1394
1423
  op = DIRTY;
1395
1424
  } else {
@@ -1399,56 +1428,28 @@ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
1399
1428
  intersection2?.(scope, op);
1400
1429
  };
1401
1430
  };
1402
- function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
1431
+ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1403
1432
  const prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]);
1404
- const newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
1433
+ const newBranch = newRenderer ? createBranch2(
1405
1434
  newRenderer,
1406
1435
  scope.$global,
1407
1436
  scope,
1408
1437
  prevBranch.___endNode.parentNode
1409
1438
  ) : getEmptyBranch(scope[nodeAccessor]);
1410
- insertBranchBefore(
1411
- newBranch,
1412
- prevBranch.___endNode.parentNode,
1413
- prevBranch.___endNode.nextSibling
1414
- );
1415
- removeAndDestroyBranch(prevBranch);
1416
- scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
1439
+ if (prevBranch !== newBranch) {
1440
+ insertBranchBefore(
1441
+ newBranch,
1442
+ prevBranch.___endNode.parentNode,
1443
+ prevBranch.___endNode.nextSibling
1444
+ );
1445
+ removeAndDestroyBranch(prevBranch);
1446
+ scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
1447
+ }
1417
1448
  }
1418
- var conditionalOnlyChild = function conditional3(nodeAccessor, fn, getIntersection) {
1419
- const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1420
- let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1421
- return (scope, newRendererOrOp) => {
1422
- if (newRendererOrOp === DIRTY) return;
1423
- let currentRenderer = scope[rendererAccessor];
1424
- let op = newRendererOrOp;
1425
- if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1426
- const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1427
- if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
1428
- currentRenderer = scope[rendererAccessor] = normalizedRenderer;
1429
- setConditionalRendererOnlyChild(
1430
- scope,
1431
- nodeAccessor,
1432
- normalizedRenderer
1433
- );
1434
- fn && fn(scope);
1435
- op = DIRTY;
1436
- } else {
1437
- op = CLEAN;
1438
- }
1439
- }
1440
- intersection2?.(scope, op);
1441
- };
1442
- };
1443
- function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
1449
+ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
1444
1450
  const prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */];
1445
1451
  const referenceNode = scope[nodeAccessor];
1446
- const newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
1447
- newRenderer,
1448
- scope.$global,
1449
- scope,
1450
- referenceNode
1451
- ) : void 0;
1452
+ const newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
1452
1453
  referenceNode.textContent = "";
1453
1454
  if (newBranch) {
1454
1455
  insertBranchBefore(newBranch, referenceNode, null);
@@ -1457,10 +1458,10 @@ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
1457
1458
  scope[nodeAccessor + "!" /* ConditionalScope */] = newBranch;
1458
1459
  }
1459
1460
  var emptyMarkerMap = /* @__PURE__ */ new Map([
1460
- [Symbol(), getEmptyBranch(void 0)]
1461
+ [Symbol(), /* @__PURE__ */ getEmptyBranch(0)]
1461
1462
  ]);
1462
1463
  var emptyMarkerArray = [
1463
- /* @__PURE__ */ getEmptyBranch(void 0)
1464
+ /* @__PURE__ */ getEmptyBranch(0)
1464
1465
  ];
1465
1466
  var emptyMap = /* @__PURE__ */ new Map();
1466
1467
  var emptyArray = [];
@@ -1678,14 +1679,14 @@ function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
1678
1679
  helperSignal._ = signal;
1679
1680
  return helperSignal;
1680
1681
  }
1681
- function conditionalClosure(ownerConditionalNodeAccessor, getRenderer, fn, getIntersection) {
1682
+ function conditionalClosure(ownerConditionalNodeAccessor, branch, fn, getIntersection) {
1682
1683
  const signal = closure(fn, getIntersection);
1683
1684
  const scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */;
1684
- const rendererAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */;
1685
+ const branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */;
1685
1686
  const helperSignal = (scope, value2) => {
1686
- const conditionalScope = scope[scopeAccessor];
1687
- if (conditionalScope && !conditionalScope.___pending && scope[rendererAccessor]?.___id === getRenderer().___id) {
1688
- queueSource(conditionalScope, signal, value2);
1687
+ const ifScope = scope[scopeAccessor];
1688
+ if (ifScope && !ifScope.___pending && scope[branchAccessor] === branch) {
1689
+ queueSource(ifScope, signal, value2);
1689
1690
  }
1690
1691
  };
1691
1692
  helperSignal._ = signal;
@@ -1887,7 +1888,7 @@ var RENDER_BODY_ID = prefix + (true ? "renderBody" : "b");
1887
1888
  // src/dom/compat.ts
1888
1889
  var classIdToBranch = /* @__PURE__ */ new Map();
1889
1890
  var compat = {
1890
- patchConditionals,
1891
+ patchConditionals: patchDynamicTag,
1891
1892
  queueEffect,
1892
1893
  init(warp10Noop) {
1893
1894
  register(SET_SCOPE_REGISTER_ID, (branch) => {
@@ -1902,7 +1903,7 @@ var compat = {
1902
1903
  return value2 === MARK || value2 === CLEAN || value2 === DIRTY;
1903
1904
  },
1904
1905
  isRenderer(renderer) {
1905
- return renderer.___clone !== void 0;
1906
+ return renderer.___clone;
1906
1907
  },
1907
1908
  getStartNode(branch) {
1908
1909
  return branch.___startNode;
@@ -1932,7 +1933,7 @@ var compat = {
1932
1933
  return value2;
1933
1934
  },
1934
1935
  createRenderer(setup, clone, args) {
1935
- const renderer = createRenderer("", void 0, setup, args && (() => args));
1936
+ const renderer = createRenderer("", 0, setup, args && (() => args));
1936
1937
  renderer.___clone = clone;
1937
1938
  return renderer;
1938
1939
  },
@@ -2057,7 +2058,6 @@ export {
2057
2058
  compat,
2058
2059
  conditional,
2059
2060
  conditionalClosure,
2060
- conditionalOnlyChild,
2061
2061
  controllable_detailsOrDialog_open,
2062
2062
  controllable_detailsOrDialog_open_effect,
2063
2063
  controllable_input_checked,
@@ -2075,6 +2075,7 @@ export {
2075
2075
  createTemplate,
2076
2076
  data,
2077
2077
  dynamicClosure,
2078
+ dynamicTag,
2078
2079
  dynamicTagAttrs,
2079
2080
  effect,
2080
2081
  forIn,