@aevantec/litevue 0.6.1 → 0.6.2

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.
Files changed (71) hide show
  1. package/dist/litevue-devtools.iife.js +1 -1
  2. package/dist/litevue-devtools.mjs +1 -1
  3. package/dist/litevue-devtools.umd.js +1 -1
  4. package/dist/litevue-plugins.dev.iife.js +64 -41
  5. package/dist/litevue-plugins.dev.mjs +64 -40
  6. package/dist/litevue-plugins.iife.js +1 -1
  7. package/dist/litevue-plugins.mjs +1 -1
  8. package/dist/litevue-plugins.umd.js +1 -1
  9. package/dist/litevue.dev.iife.js +121 -39
  10. package/dist/litevue.dev.mjs +121 -38
  11. package/dist/litevue.iife.js +1 -1
  12. package/dist/litevue.mjs +1 -1
  13. package/dist/litevue.umd.js +1 -1
  14. package/dist/plugins/collapse.iife.js +1 -1
  15. package/dist/plugins/collapse.mjs +1 -1
  16. package/dist/plugins/collapse.umd.js +1 -1
  17. package/dist/plugins/focus.iife.js +1 -1
  18. package/dist/plugins/focus.mjs +1 -1
  19. package/dist/plugins/focus.umd.js +1 -1
  20. package/dist/plugins/intersect.iife.js +1 -1
  21. package/dist/plugins/intersect.umd.js +1 -1
  22. package/dist/plugins/mask.iife.js +1 -1
  23. package/dist/plugins/mask.mjs +1 -1
  24. package/dist/plugins/mask.umd.js +1 -1
  25. package/dist/plugins/media.dev.iife.js +3 -4
  26. package/dist/plugins/media.dev.mjs +3 -3
  27. package/dist/plugins/media.iife.js +1 -1
  28. package/dist/plugins/media.mjs +1 -1
  29. package/dist/plugins/media.umd.js +1 -1
  30. package/dist/plugins/morph.dev.iife.js +39 -19
  31. package/dist/plugins/morph.dev.mjs +39 -18
  32. package/dist/plugins/morph.iife.js +1 -1
  33. package/dist/plugins/morph.mjs +1 -1
  34. package/dist/plugins/morph.umd.js +1 -1
  35. package/dist/plugins/navigate.dev.iife.js +26 -19
  36. package/dist/plugins/navigate.dev.mjs +26 -18
  37. package/dist/plugins/navigate.iife.js +1 -1
  38. package/dist/plugins/navigate.mjs +1 -1
  39. package/dist/plugins/navigate.umd.js +1 -1
  40. package/dist/plugins/persist.dev.iife.js +2 -3
  41. package/dist/plugins/persist.dev.mjs +2 -2
  42. package/dist/plugins/persist.iife.js +1 -1
  43. package/dist/plugins/persist.mjs +1 -1
  44. package/dist/plugins/persist.umd.js +1 -1
  45. package/dist/plugins/popover.iife.js +1 -1
  46. package/dist/plugins/popover.mjs +1 -1
  47. package/dist/plugins/popover.umd.js +1 -1
  48. package/dist/plugins/resize.iife.js +1 -1
  49. package/dist/plugins/resize.umd.js +1 -1
  50. package/dist/plugins/transition.iife.js +1 -1
  51. package/dist/plugins/transition.mjs +1 -1
  52. package/dist/plugins/transition.umd.js +1 -1
  53. package/dist/types/app.d.mts +3 -1
  54. package/dist/types/app.d.ts +3 -1
  55. package/dist/types/context.d.mts +1 -1
  56. package/dist/types/context.d.ts +1 -1
  57. package/dist/types/devtools-panel/chrome.d.mts +6 -5
  58. package/dist/types/devtools-panel/chrome.d.ts +6 -5
  59. package/dist/types/devtools-panel/menu.d.mts +12 -0
  60. package/dist/types/devtools-panel/menu.d.ts +12 -0
  61. package/dist/types/devtools-panel/styles.d.mts +5 -2
  62. package/dist/types/devtools-panel/styles.d.ts +5 -2
  63. package/dist/types/devtools-panel/values.d.mts +11 -5
  64. package/dist/types/devtools-panel/values.d.ts +11 -5
  65. package/dist/types/directives/show.d.mts +1 -0
  66. package/dist/types/directives/show.d.ts +1 -0
  67. package/dist/types/errors.d.mts +1 -1
  68. package/dist/types/errors.d.ts +1 -1
  69. package/dist/types/store.d.mts +5 -1
  70. package/dist/types/store.d.ts +5 -1
  71. package/package.json +3 -3
@@ -1,5 +1,4 @@
1
1
  var LiteVuePlugins = (function(exports, _aevantec_litevue) {
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  // src/plugins/intersect/index.ts
4
3
  /**
5
4
  * v-intersect="expression" — evaluates the expression when the element
@@ -63,21 +62,22 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
63
62
  const input = el;
64
63
  const apply = (e) => {
65
64
  const { value, selectionStart: at } = input;
66
- const masked = format(value, exp, !e?.inputType?.startsWith("del"));
65
+ const type = e?.inputType;
66
+ const masked = format(value, exp, !type?.startsWith("del"));
67
67
  if (masked === value) return false;
68
68
  input.value = masked;
69
69
  if (at != null && document.activeElement === input) {
70
70
  let to = format(value.slice(0, at), exp).length;
71
- while (to < masked.length && !tokens[exp[to]]) to++;
71
+ if (!to || !type?.endsWith("Backward")) while (to < masked.length && !tokens[exp[to]]) to++;
72
72
  input.setSelectionRange(to, to);
73
73
  }
74
74
  return true;
75
75
  };
76
76
  el.addEventListener("input", apply);
77
- apply();
77
+ const dirty = apply();
78
78
  let live = true;
79
79
  Promise.resolve().then(() => {
80
- if (live && apply()) {
80
+ if (live && (apply() || dirty)) {
81
81
  el.dispatchEvent(new Event("input"));
82
82
  el.dispatchEvent(new Event("change"));
83
83
  }
@@ -143,6 +143,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
143
143
  });
144
144
  elem.__leave = () => {
145
145
  live = false;
146
+ elem.__leaving = 1;
146
147
  return new Promise((resolve) => run("leave", resolve));
147
148
  };
148
149
  return () => {
@@ -170,6 +171,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
170
171
  return () => {
171
172
  clearTimeout(endTimer);
172
173
  clear();
174
+ if (shown === false) elem.style.display = "none";
173
175
  };
174
176
  });
175
177
  };
@@ -187,7 +189,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
187
189
  var resolve$1 = (storage) => {
188
190
  const target = storage ?? defaultStorage;
189
191
  if (typeof target !== "string") return target;
190
- return registry[target] ?? builtin(target);
192
+ return registry[target.toLowerCase()] ?? builtin(target);
191
193
  };
192
194
  /**
193
195
  * Register a custom storage under a name, selectable anywhere — including as a
@@ -198,7 +200,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
198
200
  * <div v-persist.memory="scratch">…</div>
199
201
  */
200
202
  var registerStorage = (name, storage) => {
201
- registry[name] = storage;
203
+ registry[name.toLowerCase()] = storage;
202
204
  };
203
205
  /**
204
206
  * Switch the storage used when none is specified. Accepts a registered name
@@ -323,9 +325,9 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
323
325
  app.directive("trap", ({ el, get, effect }) => {
324
326
  let active = false;
325
327
  let prevFocus = null;
326
- const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
328
+ const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert],[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
327
329
  const onKeydown = (e) => {
328
- if (e.key !== "Tab" || traps.at(-1) !== onKeydown) return;
330
+ if (e.key !== "Tab" || traps.at(-1) !== el) return;
329
331
  const els = focusables();
330
332
  if (!els.length) {
331
333
  e.preventDefault();
@@ -337,17 +339,14 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
337
339
  if (!el.contains(current)) {
338
340
  e.preventDefault();
339
341
  first.focus();
340
- } else if (e.shiftKey && (current === first || current === el)) {
342
+ } else if (!((e.shiftKey ? first : last).compareDocumentPosition(current) & (e.shiftKey ? 4 : 2))) {
341
343
  e.preventDefault();
342
- last.focus();
343
- } else if (!e.shiftKey && current === last) {
344
- e.preventDefault();
345
- first.focus();
344
+ (e.shiftKey ? last : first).focus();
346
345
  }
347
346
  };
348
347
  const release = () => {
349
348
  active = false;
350
- traps.splice(traps.indexOf(onKeydown), 1);
349
+ traps.splice(traps.indexOf(el), 1);
351
350
  document.removeEventListener("keydown", onKeydown, true);
352
351
  if (prevFocus && prevFocus.focus) prevFocus.focus();
353
352
  };
@@ -356,10 +355,10 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
356
355
  if (on && !active) {
357
356
  active = true;
358
357
  prevFocus = document.activeElement;
359
- traps.push(onKeydown);
358
+ traps.splice(traps.findIndex((t) => el.contains(t)) >>> 0, 0, el);
360
359
  document.addEventListener("keydown", onKeydown, true);
361
360
  Promise.resolve().then(() => {
362
- if (active) (focusables()[0] || el).focus();
361
+ if (active && traps.at(-1) === el) (focusables()[0] || el).focus();
363
362
  });
364
363
  } else if (!on && active) release();
365
364
  });
@@ -393,7 +392,6 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
393
392
  ];
394
393
  const before = owned.map((k) => elem.style[k]);
395
394
  const hide = (hidden) => elem.style.visibility = hidden ? "hidden" : before[3];
396
- elem.style.overflow = "hidden";
397
395
  let shown;
398
396
  let seq = 0;
399
397
  const timers = /* @__PURE__ */ new Set();
@@ -409,13 +407,17 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
409
407
  if (show === shown) return;
410
408
  const id = ++seq;
411
409
  hide(!show);
410
+ elem.style.overflow = show && shown == null ? before[0] : "hidden";
412
411
  if (shown == null) later(() => {
413
412
  elem.style.transition = `height ${duration}ms ease, visibility ${duration}ms`;
414
413
  });
415
414
  else {
416
- elem.style.height = elem.scrollHeight + "px";
415
+ elem.style.height = before[1] || elem.scrollHeight + "px";
417
416
  if (show) later(() => {
418
- if (id === seq) elem.style.height = "";
417
+ if (id === seq) {
418
+ elem.style.height = before[1];
419
+ elem.style.overflow = before[0];
420
+ }
419
421
  }, duration);
420
422
  else elem.offsetHeight;
421
423
  }
@@ -435,6 +437,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
435
437
  * strip it, leaving nothing for the next morph. Matches `data-morph-skip`.
436
438
  */
437
439
  var preserved = (node, opts) => node.nodeType === 1 && (node.hasAttribute("data-morph-preserve") || node.__marker || !!opts.preserve?.(node));
440
+ var LAZY = "[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]";
438
441
  var dirRE = /^(?:v-|:|@)/;
439
442
  var bindRE = /^(?::|v-bind:)/;
440
443
  var clientStyleRE = /^v-(?!scope|on:)/;
@@ -479,12 +482,17 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
479
482
  var boundAttrs = (to) => {
480
483
  const owned = /* @__PURE__ */ new Set();
481
484
  if (to.matches("details,dialog")) owned.add("open");
482
- for (const { name } of to.attributes) if (bindRE.test(name)) owned.add(name.replace(bindRE, "").split(".")[0]);
483
- else if (name === "v-model") {
485
+ for (const { name } of to.attributes) if (bindRE.test(name)) {
486
+ const attr = name.replace(bindRE, "").split(".")[0];
487
+ owned.add(/\.camel\b/.test(name) ? attr.replace(/-(\w)/g, (_, c) => c.toUpperCase()) : attr);
488
+ } else if (/^v-model\b/.test(name)) {
484
489
  owned.add("value");
485
490
  owned.add("checked");
486
491
  } else if (name === "v-bind") owned.add("*");
487
- else if (clientStyleRE.test(name)) owned.add("style");
492
+ else if (clientStyleRE.test(name)) {
493
+ owned.add("style");
494
+ name == "v-popover" && owned.add("popover");
495
+ }
488
496
  return owned;
489
497
  };
490
498
  /**
@@ -506,15 +514,17 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
506
514
  ];
507
515
  var syncValues = (from, to, owned) => {
508
516
  const ctl = boundAttrs(to.closest("select") || to);
509
- if (owned.has("*") || ctl.has("*") || ctl.has("value")) return;
517
+ if (owned.has("*") || ctl.has("*") || ctl.has("value") || from.type == "output" || from.type == "textarea" && to.value.includes("{{")) return;
510
518
  for (const name of FIELD_PROPS) {
511
519
  const prop = name.toLowerCase();
512
520
  const init = "default" + name;
513
- if (!owned.has(prop) && init in from && from[prop] !== to[init]) from[prop] = to[init];
521
+ const src = name == "Selected" ? init : prop;
522
+ if (!owned.has(prop) && init in from && from[prop] !== to[src]) from[prop] = to[src];
514
523
  }
515
524
  };
516
525
  var patchAttrs = (from, to, values) => {
517
526
  const owned = boundAttrs(to);
527
+ if (from.__anchor) owned.add("style");
518
528
  if (values) syncValues(from, to, owned);
519
529
  const bound = Object(from.__bound);
520
530
  for (const { name, value } of to.attributes) {
@@ -535,7 +545,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
535
545
  if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx, opts);
536
546
  if (from.nodeType === 3 || from.nodeType === 8) {
537
547
  const data = to.data;
538
- if (isInterpolation(data, ctx)) return;
548
+ if (isInterpolation(data, ctx) && from.parentNode?.nodeName != "SCRIPT") return;
539
549
  if (!from.data) return replaceNode(from, to, ctx, opts);
540
550
  if (from.data !== data) from.data = data;
541
551
  return;
@@ -545,9 +555,10 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
545
555
  const b = to;
546
556
  if (a.tagName !== b.tagName) return replaceNode(from, to, ctx, opts);
547
557
  if (opts.skip?.(a, b) || a.hasAttribute("data-morph-skip")) return;
558
+ if (a.matches(LAZY)) return a.isEqualNode(b) ? void 0 : replaceNode(from, to, ctx, opts);
548
559
  patchAttrs(a, b, opts.values);
549
- if (a.tagName == "TEMPLATE") a.innerHTML = b.innerHTML;
550
- if (!ownsChildren(b) && !a.__ctx?.scope.$template) patchChildren(a, b, a.__ctx || ctx, opts);
560
+ if (a.tagName == "TEMPLATE" && !a.content.isEqualNode(b.content)) a.innerHTML = b.innerHTML;
561
+ if (!ownsChildren(b) && !Object.getOwnPropertyDescriptor(Object(a.__ctx?.scope), "$template")) patchChildren(a, b, a.__ctx || ctx, opts);
551
562
  };
552
563
  var replaceNode = (from, to, ctx, opts) => {
553
564
  if (preserved(from, opts)) return;
@@ -557,6 +568,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
557
568
  from.parentNode.replaceChild(fresh, from);
558
569
  opts.afterNodeRemoved?.(from);
559
570
  mountNew(fresh, ctx);
571
+ return fresh;
560
572
  };
561
573
  /**
562
574
  * Bind never-walked markup with the scope it was inserted into. The walker
@@ -564,7 +576,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
564
576
  * copy of the core into the plugins bundle.
565
577
  */
566
578
  var mountNew = (node, ctx) => {
567
- if (node.parentElement?.closest("[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]")) return;
579
+ if (node.parentElement?.closest(LAZY)) return;
568
580
  const target = ctx || nearestCtx(node.parentNode);
569
581
  target?.walk?.(node, target);
570
582
  };
@@ -578,6 +590,15 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
578
590
  keyed.set(k, n);
579
591
  }
580
592
  const keyOf = (n) => n && n.nodeType === 1 ? key(n) : null;
593
+ const wanted = /* @__PURE__ */ new Set();
594
+ for (let n = to.firstChild; n; n = n.nextSibling) wanted.add(keyOf(n));
595
+ const drop = (node) => {
596
+ if (!preserved(node, opts)) {
597
+ release(node, ctx);
598
+ from.removeChild(node);
599
+ opts.afterNodeRemoved?.(node);
600
+ }
601
+ };
581
602
  let oldChild = from.firstChild;
582
603
  let newChild = to.firstChild;
583
604
  const insert = (node) => {
@@ -606,16 +627,17 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
606
627
  const nextOld = oldChild.nextSibling;
607
628
  patchNode(oldChild, newChild, ctx, opts);
608
629
  oldChild = nextOld;
630
+ } else if (oldChild && !wanted.has(keyOf(oldChild))) {
631
+ const nextOld = oldChild.nextSibling;
632
+ drop(oldChild);
633
+ oldChild = nextOld;
634
+ continue;
609
635
  } else insert(newChild);
610
636
  newChild = nextNew;
611
637
  }
612
638
  while (oldChild) {
613
639
  const next = oldChild.nextSibling;
614
- if (!preserved(oldChild, opts)) {
615
- release(oldChild, ctx);
616
- from.removeChild(oldChild);
617
- opts.afterNodeRemoved?.(oldChild);
618
- }
640
+ drop(oldChild);
619
641
  oldChild = next;
620
642
  }
621
643
  };
@@ -627,18 +649,19 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
627
649
  let target;
628
650
  if (typeof to === "string") {
629
651
  const holder = document.createElement("template");
630
- holder.innerHTML = to.trim();
631
- const content = holder.content;
652
+ const svg = from instanceof SVGElement;
653
+ holder.innerHTML = svg ? `<svg>${to.trim()}</svg>` : to.trim();
654
+ const content = svg ? holder.content.firstChild : holder.content;
632
655
  target = content.childNodes.length === 1 && content.firstElementChild ? content.firstElementChild : (() => {
633
656
  const wrapper = from.cloneNode(false);
634
- wrapper.appendChild(content);
657
+ wrapper.append(...content.childNodes);
635
658
  return wrapper;
636
659
  })();
637
660
  } else target = to;
638
661
  if (target) {
639
662
  const patch = () => {
640
663
  const restore = captureFocus();
641
- patchNode(from, target, nearestCtx(from), opts);
664
+ from = patchNode(from, target, nearestCtx(from.parentNode), opts) || from;
642
665
  restore();
643
666
  };
644
667
  opts.transition && document.startViewTransition ? document.startViewTransition(patch) : patch();
@@ -688,7 +711,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
688
711
  * replaces rather than merges, so adjusting one breakpoint means spreading
689
712
  * this rather than retyping all five.
690
713
  */
691
- var defaultBreakpoints = Object.freeze({ ...DEFAULT_BREAKPOINTS });
714
+ var defaultBreakpoints = /* @__PURE__ */ Object.freeze({ ...DEFAULT_BREAKPOINTS });
692
715
  var ALIASES = {
693
716
  mobile: "base",
694
717
  tablet: "md",
@@ -704,7 +727,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
704
727
  * MediaQueryList rather than mirrored, since registering a query inside a
705
728
  * running effect would write a dependency it just read and re-run it.
706
729
  */
707
- var state = (0, _aevantec_litevue.reactive)({
730
+ var state = /* @__PURE__ */ (0, _aevantec_litevue.reactive)({
708
731
  bp: "base",
709
732
  tick: 0
710
733
  });
@@ -831,7 +854,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
831
854
  return DEFAULT_BREAKPOINTS[name];
832
855
  };
833
856
  var mqFn = (map, fallback) => resolve(map, fallback);
834
- var mq = Object.defineProperties(mqFn, {
857
+ var mq = /* @__PURE__ */ Object.defineProperties(mqFn, {
835
858
  props: { value: (maps) => {
836
859
  trackAll();
837
860
  const out = {};
@@ -62,21 +62,22 @@ var mask = (app) => {
62
62
  const input = el;
63
63
  const apply = (e) => {
64
64
  const { value, selectionStart: at } = input;
65
- const masked = format(value, exp, !e?.inputType?.startsWith("del"));
65
+ const type = e?.inputType;
66
+ const masked = format(value, exp, !type?.startsWith("del"));
66
67
  if (masked === value) return false;
67
68
  input.value = masked;
68
69
  if (at != null && document.activeElement === input) {
69
70
  let to = format(value.slice(0, at), exp).length;
70
- while (to < masked.length && !tokens[exp[to]]) to++;
71
+ if (!to || !type?.endsWith("Backward")) while (to < masked.length && !tokens[exp[to]]) to++;
71
72
  input.setSelectionRange(to, to);
72
73
  }
73
74
  return true;
74
75
  };
75
76
  el.addEventListener("input", apply);
76
- apply();
77
+ const dirty = apply();
77
78
  let live = true;
78
79
  Promise.resolve().then(() => {
79
- if (live && apply()) {
80
+ if (live && (apply() || dirty)) {
80
81
  el.dispatchEvent(new Event("input"));
81
82
  el.dispatchEvent(new Event("change"));
82
83
  }
@@ -142,6 +143,7 @@ var transition = (app) => {
142
143
  });
143
144
  elem.__leave = () => {
144
145
  live = false;
146
+ elem.__leaving = 1;
145
147
  return new Promise((resolve) => run("leave", resolve));
146
148
  };
147
149
  return () => {
@@ -169,6 +171,7 @@ var transition = (app) => {
169
171
  return () => {
170
172
  clearTimeout(endTimer);
171
173
  clear();
174
+ if (shown === false) elem.style.display = "none";
172
175
  };
173
176
  });
174
177
  };
@@ -186,7 +189,7 @@ var builtin = (name) => {
186
189
  var resolve$1 = (storage) => {
187
190
  const target = storage ?? defaultStorage;
188
191
  if (typeof target !== "string") return target;
189
- return registry[target] ?? builtin(target);
192
+ return registry[target.toLowerCase()] ?? builtin(target);
190
193
  };
191
194
  /**
192
195
  * Register a custom storage under a name, selectable anywhere — including as a
@@ -197,7 +200,7 @@ var resolve$1 = (storage) => {
197
200
  * <div v-persist.memory="scratch">…</div>
198
201
  */
199
202
  var registerStorage = (name, storage) => {
200
- registry[name] = storage;
203
+ registry[name.toLowerCase()] = storage;
201
204
  };
202
205
  /**
203
206
  * Switch the storage used when none is specified. Accepts a registered name
@@ -322,9 +325,9 @@ var focus = (app) => {
322
325
  app.directive("trap", ({ el, get, effect }) => {
323
326
  let active = false;
324
327
  let prevFocus = null;
325
- const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
328
+ const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert],[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
326
329
  const onKeydown = (e) => {
327
- if (e.key !== "Tab" || traps.at(-1) !== onKeydown) return;
330
+ if (e.key !== "Tab" || traps.at(-1) !== el) return;
328
331
  const els = focusables();
329
332
  if (!els.length) {
330
333
  e.preventDefault();
@@ -336,17 +339,14 @@ var focus = (app) => {
336
339
  if (!el.contains(current)) {
337
340
  e.preventDefault();
338
341
  first.focus();
339
- } else if (e.shiftKey && (current === first || current === el)) {
342
+ } else if (!((e.shiftKey ? first : last).compareDocumentPosition(current) & (e.shiftKey ? 4 : 2))) {
340
343
  e.preventDefault();
341
- last.focus();
342
- } else if (!e.shiftKey && current === last) {
343
- e.preventDefault();
344
- first.focus();
344
+ (e.shiftKey ? last : first).focus();
345
345
  }
346
346
  };
347
347
  const release = () => {
348
348
  active = false;
349
- traps.splice(traps.indexOf(onKeydown), 1);
349
+ traps.splice(traps.indexOf(el), 1);
350
350
  document.removeEventListener("keydown", onKeydown, true);
351
351
  if (prevFocus && prevFocus.focus) prevFocus.focus();
352
352
  };
@@ -355,10 +355,10 @@ var focus = (app) => {
355
355
  if (on && !active) {
356
356
  active = true;
357
357
  prevFocus = document.activeElement;
358
- traps.push(onKeydown);
358
+ traps.splice(traps.findIndex((t) => el.contains(t)) >>> 0, 0, el);
359
359
  document.addEventListener("keydown", onKeydown, true);
360
360
  Promise.resolve().then(() => {
361
- if (active) (focusables()[0] || el).focus();
361
+ if (active && traps.at(-1) === el) (focusables()[0] || el).focus();
362
362
  });
363
363
  } else if (!on && active) release();
364
364
  });
@@ -392,7 +392,6 @@ var collapse = (app) => {
392
392
  ];
393
393
  const before = owned.map((k) => elem.style[k]);
394
394
  const hide = (hidden) => elem.style.visibility = hidden ? "hidden" : before[3];
395
- elem.style.overflow = "hidden";
396
395
  let shown;
397
396
  let seq = 0;
398
397
  const timers = /* @__PURE__ */ new Set();
@@ -408,13 +407,17 @@ var collapse = (app) => {
408
407
  if (show === shown) return;
409
408
  const id = ++seq;
410
409
  hide(!show);
410
+ elem.style.overflow = show && shown == null ? before[0] : "hidden";
411
411
  if (shown == null) later(() => {
412
412
  elem.style.transition = `height ${duration}ms ease, visibility ${duration}ms`;
413
413
  });
414
414
  else {
415
- elem.style.height = elem.scrollHeight + "px";
415
+ elem.style.height = before[1] || elem.scrollHeight + "px";
416
416
  if (show) later(() => {
417
- if (id === seq) elem.style.height = "";
417
+ if (id === seq) {
418
+ elem.style.height = before[1];
419
+ elem.style.overflow = before[0];
420
+ }
418
421
  }, duration);
419
422
  else elem.offsetHeight;
420
423
  }
@@ -434,6 +437,7 @@ var collapse = (app) => {
434
437
  * strip it, leaving nothing for the next morph. Matches `data-morph-skip`.
435
438
  */
436
439
  var preserved = (node, opts) => node.nodeType === 1 && (node.hasAttribute("data-morph-preserve") || node.__marker || !!opts.preserve?.(node));
440
+ var LAZY = "[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]";
437
441
  var dirRE = /^(?:v-|:|@)/;
438
442
  var bindRE = /^(?::|v-bind:)/;
439
443
  var clientStyleRE = /^v-(?!scope|on:)/;
@@ -478,12 +482,17 @@ var release = (node, ctx) => (ctx || ctxIn(node))?.dispose?.(node);
478
482
  var boundAttrs = (to) => {
479
483
  const owned = /* @__PURE__ */ new Set();
480
484
  if (to.matches("details,dialog")) owned.add("open");
481
- for (const { name } of to.attributes) if (bindRE.test(name)) owned.add(name.replace(bindRE, "").split(".")[0]);
482
- else if (name === "v-model") {
485
+ for (const { name } of to.attributes) if (bindRE.test(name)) {
486
+ const attr = name.replace(bindRE, "").split(".")[0];
487
+ owned.add(/\.camel\b/.test(name) ? attr.replace(/-(\w)/g, (_, c) => c.toUpperCase()) : attr);
488
+ } else if (/^v-model\b/.test(name)) {
483
489
  owned.add("value");
484
490
  owned.add("checked");
485
491
  } else if (name === "v-bind") owned.add("*");
486
- else if (clientStyleRE.test(name)) owned.add("style");
492
+ else if (clientStyleRE.test(name)) {
493
+ owned.add("style");
494
+ name == "v-popover" && owned.add("popover");
495
+ }
487
496
  return owned;
488
497
  };
489
498
  /**
@@ -505,15 +514,17 @@ var FIELD_PROPS = [
505
514
  ];
506
515
  var syncValues = (from, to, owned) => {
507
516
  const ctl = boundAttrs(to.closest("select") || to);
508
- if (owned.has("*") || ctl.has("*") || ctl.has("value")) return;
517
+ if (owned.has("*") || ctl.has("*") || ctl.has("value") || from.type == "output" || from.type == "textarea" && to.value.includes("{{")) return;
509
518
  for (const name of FIELD_PROPS) {
510
519
  const prop = name.toLowerCase();
511
520
  const init = "default" + name;
512
- if (!owned.has(prop) && init in from && from[prop] !== to[init]) from[prop] = to[init];
521
+ const src = name == "Selected" ? init : prop;
522
+ if (!owned.has(prop) && init in from && from[prop] !== to[src]) from[prop] = to[src];
513
523
  }
514
524
  };
515
525
  var patchAttrs = (from, to, values) => {
516
526
  const owned = boundAttrs(to);
527
+ if (from.__anchor) owned.add("style");
517
528
  if (values) syncValues(from, to, owned);
518
529
  const bound = Object(from.__bound);
519
530
  for (const { name, value } of to.attributes) {
@@ -534,7 +545,7 @@ var patchNode = (from, to, ctx, opts) => {
534
545
  if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx, opts);
535
546
  if (from.nodeType === 3 || from.nodeType === 8) {
536
547
  const data = to.data;
537
- if (isInterpolation(data, ctx)) return;
548
+ if (isInterpolation(data, ctx) && from.parentNode?.nodeName != "SCRIPT") return;
538
549
  if (!from.data) return replaceNode(from, to, ctx, opts);
539
550
  if (from.data !== data) from.data = data;
540
551
  return;
@@ -544,9 +555,10 @@ var patchNode = (from, to, ctx, opts) => {
544
555
  const b = to;
545
556
  if (a.tagName !== b.tagName) return replaceNode(from, to, ctx, opts);
546
557
  if (opts.skip?.(a, b) || a.hasAttribute("data-morph-skip")) return;
558
+ if (a.matches(LAZY)) return a.isEqualNode(b) ? void 0 : replaceNode(from, to, ctx, opts);
547
559
  patchAttrs(a, b, opts.values);
548
- if (a.tagName == "TEMPLATE") a.innerHTML = b.innerHTML;
549
- if (!ownsChildren(b) && !a.__ctx?.scope.$template) patchChildren(a, b, a.__ctx || ctx, opts);
560
+ if (a.tagName == "TEMPLATE" && !a.content.isEqualNode(b.content)) a.innerHTML = b.innerHTML;
561
+ if (!ownsChildren(b) && !Object.getOwnPropertyDescriptor(Object(a.__ctx?.scope), "$template")) patchChildren(a, b, a.__ctx || ctx, opts);
550
562
  };
551
563
  var replaceNode = (from, to, ctx, opts) => {
552
564
  if (preserved(from, opts)) return;
@@ -556,6 +568,7 @@ var replaceNode = (from, to, ctx, opts) => {
556
568
  from.parentNode.replaceChild(fresh, from);
557
569
  opts.afterNodeRemoved?.(from);
558
570
  mountNew(fresh, ctx);
571
+ return fresh;
559
572
  };
560
573
  /**
561
574
  * Bind never-walked markup with the scope it was inserted into. The walker
@@ -563,7 +576,7 @@ var replaceNode = (from, to, ctx, opts) => {
563
576
  * copy of the core into the plugins bundle.
564
577
  */
565
578
  var mountNew = (node, ctx) => {
566
- if (node.parentElement?.closest("[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]")) return;
579
+ if (node.parentElement?.closest(LAZY)) return;
567
580
  const target = ctx || nearestCtx(node.parentNode);
568
581
  target?.walk?.(node, target);
569
582
  };
@@ -577,6 +590,15 @@ var patchChildren = (from, to, ctx, opts) => {
577
590
  keyed.set(k, n);
578
591
  }
579
592
  const keyOf = (n) => n && n.nodeType === 1 ? key(n) : null;
593
+ const wanted = /* @__PURE__ */ new Set();
594
+ for (let n = to.firstChild; n; n = n.nextSibling) wanted.add(keyOf(n));
595
+ const drop = (node) => {
596
+ if (!preserved(node, opts)) {
597
+ release(node, ctx);
598
+ from.removeChild(node);
599
+ opts.afterNodeRemoved?.(node);
600
+ }
601
+ };
580
602
  let oldChild = from.firstChild;
581
603
  let newChild = to.firstChild;
582
604
  const insert = (node) => {
@@ -605,16 +627,17 @@ var patchChildren = (from, to, ctx, opts) => {
605
627
  const nextOld = oldChild.nextSibling;
606
628
  patchNode(oldChild, newChild, ctx, opts);
607
629
  oldChild = nextOld;
630
+ } else if (oldChild && !wanted.has(keyOf(oldChild))) {
631
+ const nextOld = oldChild.nextSibling;
632
+ drop(oldChild);
633
+ oldChild = nextOld;
634
+ continue;
608
635
  } else insert(newChild);
609
636
  newChild = nextNew;
610
637
  }
611
638
  while (oldChild) {
612
639
  const next = oldChild.nextSibling;
613
- if (!preserved(oldChild, opts)) {
614
- release(oldChild, ctx);
615
- from.removeChild(oldChild);
616
- opts.afterNodeRemoved?.(oldChild);
617
- }
640
+ drop(oldChild);
618
641
  oldChild = next;
619
642
  }
620
643
  };
@@ -626,18 +649,19 @@ var morph = (from, to, opts = {}) => {
626
649
  let target;
627
650
  if (typeof to === "string") {
628
651
  const holder = document.createElement("template");
629
- holder.innerHTML = to.trim();
630
- const content = holder.content;
652
+ const svg = from instanceof SVGElement;
653
+ holder.innerHTML = svg ? `<svg>${to.trim()}</svg>` : to.trim();
654
+ const content = svg ? holder.content.firstChild : holder.content;
631
655
  target = content.childNodes.length === 1 && content.firstElementChild ? content.firstElementChild : (() => {
632
656
  const wrapper = from.cloneNode(false);
633
- wrapper.appendChild(content);
657
+ wrapper.append(...content.childNodes);
634
658
  return wrapper;
635
659
  })();
636
660
  } else target = to;
637
661
  if (target) {
638
662
  const patch = () => {
639
663
  const restore = captureFocus();
640
- patchNode(from, target, nearestCtx(from), opts);
664
+ from = patchNode(from, target, nearestCtx(from.parentNode), opts) || from;
641
665
  restore();
642
666
  };
643
667
  opts.transition && document.startViewTransition ? document.startViewTransition(patch) : patch();
@@ -687,7 +711,7 @@ var DEFAULT_BREAKPOINTS = {
687
711
  * replaces rather than merges, so adjusting one breakpoint means spreading
688
712
  * this rather than retyping all five.
689
713
  */
690
- var defaultBreakpoints = Object.freeze({ ...DEFAULT_BREAKPOINTS });
714
+ var defaultBreakpoints = /* @__PURE__ */ Object.freeze({ ...DEFAULT_BREAKPOINTS });
691
715
  var ALIASES = {
692
716
  mobile: "base",
693
717
  tablet: "md",
@@ -703,7 +727,7 @@ var NUMERIC = /^\d+$/;
703
727
  * MediaQueryList rather than mirrored, since registering a query inside a
704
728
  * running effect would write a dependency it just read and re-run it.
705
729
  */
706
- var state = reactive({
730
+ var state = /* @__PURE__ */ reactive({
707
731
  bp: "base",
708
732
  tick: 0
709
733
  });
@@ -830,7 +854,7 @@ var aliasPx = (alias) => {
830
854
  return DEFAULT_BREAKPOINTS[name];
831
855
  };
832
856
  var mqFn = (map, fallback) => resolve(map, fallback);
833
- var mq = Object.defineProperties(mqFn, {
857
+ var mq = /* @__PURE__ */ Object.defineProperties(mqFn, {
834
858
  props: { value: (maps) => {
835
859
  trackAll();
836
860
  const out = {};