@aevantec/litevue 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) 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 +67 -125
  5. package/dist/litevue-plugins.dev.mjs +67 -124
  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 +122 -159
  10. package/dist/litevue.dev.mjs +122 -158
  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 +5 -39
  26. package/dist/plugins/media.dev.mjs +5 -38
  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 +41 -61
  31. package/dist/plugins/morph.dev.mjs +41 -60
  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 +24 -26
  36. package/dist/plugins/navigate.dev.mjs +24 -25
  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 -10
  41. package/dist/plugins/persist.dev.mjs +2 -9
  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 +5 -6
  54. package/dist/types/app.d.ts +5 -6
  55. package/dist/types/block.d.mts +0 -4
  56. package/dist/types/block.d.ts +0 -4
  57. package/dist/types/context.d.mts +1 -6
  58. package/dist/types/context.d.ts +1 -6
  59. package/dist/types/devtools-panel/chrome.d.mts +5 -7
  60. package/dist/types/devtools-panel/chrome.d.ts +5 -7
  61. package/dist/types/devtools-panel/menu.d.mts +10 -0
  62. package/dist/types/devtools-panel/menu.d.ts +10 -0
  63. package/dist/types/devtools-panel/plugins.d.mts +0 -4
  64. package/dist/types/devtools-panel/plugins.d.ts +0 -4
  65. package/dist/types/devtools-panel/styles.d.mts +3 -15
  66. package/dist/types/devtools-panel/styles.d.ts +3 -15
  67. package/dist/types/devtools-panel/values.d.mts +1 -20
  68. package/dist/types/devtools-panel/values.d.ts +1 -20
  69. package/dist/types/devtools.d.mts +0 -7
  70. package/dist/types/devtools.d.ts +0 -7
  71. package/dist/types/directives/on.d.mts +0 -1
  72. package/dist/types/directives/on.d.ts +0 -1
  73. package/dist/types/directives/show.d.mts +1 -0
  74. package/dist/types/directives/show.d.ts +1 -0
  75. package/dist/types/errors.d.mts +1 -8
  76. package/dist/types/errors.d.ts +1 -8
  77. package/dist/types/eval.d.mts +0 -3
  78. package/dist/types/eval.d.ts +0 -3
  79. package/dist/types/lazy.d.mts +0 -10
  80. package/dist/types/lazy.d.ts +0 -10
  81. package/dist/types/magics.d.mts +0 -9
  82. package/dist/types/magics.d.ts +0 -9
  83. package/dist/types/ownership.d.mts +0 -19
  84. package/dist/types/ownership.d.ts +0 -19
  85. package/dist/types/plugins/media/index.d.mts +0 -5
  86. package/dist/types/plugins/media/index.d.ts +0 -5
  87. package/dist/types/plugins/morph/index.d.mts +0 -8
  88. package/dist/types/plugins/morph/index.d.ts +0 -8
  89. package/dist/types/scheduler.d.mts +0 -5
  90. package/dist/types/scheduler.d.ts +0 -5
  91. package/dist/types/store.d.mts +5 -1
  92. package/dist/types/store.d.ts +5 -1
  93. package/dist/types/utils.d.mts +0 -5
  94. package/dist/types/utils.d.ts +0 -5
  95. package/dist/types/warn.d.mts +0 -12
  96. package/dist/types/warn.d.ts +0 -12
  97. 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
  }
@@ -170,12 +170,12 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
170
170
  return () => {
171
171
  clearTimeout(endTimer);
172
172
  clear();
173
+ if (shown === false) elem.style.display = "none";
173
174
  };
174
175
  });
175
176
  };
176
177
  // src/plugins/persist/index.ts
177
178
  var PREFIX = "litevue:";
178
- /** Custom storages registered by name, usable as a directive modifier. */
179
179
  var registry = Object.create(null);
180
180
  var defaultStorage = "local";
181
181
  var builtin = (name) => {
@@ -187,7 +187,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
187
187
  var resolve$1 = (storage) => {
188
188
  const target = storage ?? defaultStorage;
189
189
  if (typeof target !== "string") return target;
190
- return registry[target] ?? builtin(target);
190
+ return registry[target.toLowerCase()] ?? builtin(target);
191
191
  };
192
192
  /**
193
193
  * Register a custom storage under a name, selectable anywhere — including as a
@@ -198,7 +198,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
198
198
  * <div v-persist.memory="scratch">…</div>
199
199
  */
200
200
  var registerStorage = (name, storage) => {
201
- registry[name] = storage;
201
+ registry[name.toLowerCase()] = storage;
202
202
  };
203
203
  /**
204
204
  * Switch the storage used when none is specified. Accepts a registered name
@@ -209,11 +209,6 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
209
209
  var setDefaultStorage = (storage) => {
210
210
  defaultStorage = storage;
211
211
  };
212
- /**
213
- * Which own properties of `target` can round-trip through storage. Methods are
214
- * behavior, not state; getter-only properties are derived and would throw on
215
- * restore. An explicit list is filtered too, so naming a getter is a no-op.
216
- */
217
212
  var persistable = (target, keys) => (keys ?? Object.keys(target)).filter((k) => {
218
213
  if (k[0] === "$") return false;
219
214
  const desc = Object.getOwnPropertyDescriptor(target, k);
@@ -222,7 +217,6 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
222
217
  if (raw && raw.__v_isRef === true && raw.__v_isReadonly === true) return false;
223
218
  return typeof target[k] !== "function";
224
219
  });
225
- /** Restore saved values, then keep storage in sync with every change. */
226
220
  var sync = (target, key, keys, storage, run) => {
227
221
  if (!storage) return run(() => {});
228
222
  const fields = persistable(target, keys);
@@ -323,9 +317,9 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
323
317
  app.directive("trap", ({ el, get, effect }) => {
324
318
  let active = false;
325
319
  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);
320
+ const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert],[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
327
321
  const onKeydown = (e) => {
328
- if (e.key !== "Tab" || traps.at(-1) !== onKeydown) return;
322
+ if (e.key !== "Tab" || traps.at(-1) !== el) return;
329
323
  const els = focusables();
330
324
  if (!els.length) {
331
325
  e.preventDefault();
@@ -337,17 +331,14 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
337
331
  if (!el.contains(current)) {
338
332
  e.preventDefault();
339
333
  first.focus();
340
- } else if (e.shiftKey && (current === first || current === el)) {
341
- e.preventDefault();
342
- last.focus();
343
- } else if (!e.shiftKey && current === last) {
334
+ } else if (!((e.shiftKey ? first : last).compareDocumentPosition(current) & (e.shiftKey ? 4 : 2))) {
344
335
  e.preventDefault();
345
- first.focus();
336
+ (e.shiftKey ? last : first).focus();
346
337
  }
347
338
  };
348
339
  const release = () => {
349
340
  active = false;
350
- traps.splice(traps.indexOf(onKeydown), 1);
341
+ traps.splice(traps.indexOf(el), 1);
351
342
  document.removeEventListener("keydown", onKeydown, true);
352
343
  if (prevFocus && prevFocus.focus) prevFocus.focus();
353
344
  };
@@ -356,10 +347,10 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
356
347
  if (on && !active) {
357
348
  active = true;
358
349
  prevFocus = document.activeElement;
359
- traps.push(onKeydown);
350
+ traps.splice(traps.findIndex((t) => el.contains(t)) >>> 0, 0, el);
360
351
  document.addEventListener("keydown", onKeydown, true);
361
352
  Promise.resolve().then(() => {
362
- if (active) (focusables()[0] || el).focus();
353
+ if (active && traps.at(-1) === el) (focusables()[0] || el).focus();
363
354
  });
364
355
  } else if (!on && active) release();
365
356
  });
@@ -393,7 +384,6 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
393
384
  ];
394
385
  const before = owned.map((k) => elem.style[k]);
395
386
  const hide = (hidden) => elem.style.visibility = hidden ? "hidden" : before[3];
396
- elem.style.overflow = "hidden";
397
387
  let shown;
398
388
  let seq = 0;
399
389
  const timers = /* @__PURE__ */ new Set();
@@ -409,13 +399,17 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
409
399
  if (show === shown) return;
410
400
  const id = ++seq;
411
401
  hide(!show);
402
+ elem.style.overflow = show && shown == null ? before[0] : "hidden";
412
403
  if (shown == null) later(() => {
413
404
  elem.style.transition = `height ${duration}ms ease, visibility ${duration}ms`;
414
405
  });
415
406
  else {
416
- elem.style.height = elem.scrollHeight + "px";
407
+ elem.style.height = before[1] || elem.scrollHeight + "px";
417
408
  if (show) later(() => {
418
- if (id === seq) elem.style.height = "";
409
+ if (id === seq) {
410
+ elem.style.height = before[1];
411
+ elem.style.overflow = before[0];
412
+ }
419
413
  }, duration);
420
414
  else elem.offsetHeight;
421
415
  }
@@ -429,21 +423,11 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
429
423
  });
430
424
  };
431
425
  // src/plugins/morph/index.ts
432
- /**
433
- * A `data-` attribute rather than `v-preserve`: an unrecognised `v-` attribute
434
- * logs an unknown-directive error, and registering one would have the walker
435
- * strip it, leaving nothing for the next morph. Matches `data-morph-skip`.
436
- */
437
426
  var preserved = (node, opts) => node.nodeType === 1 && (node.hasAttribute("data-morph-preserve") || node.__marker || !!opts.preserve?.(node));
427
+ var LAZY = "[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]";
438
428
  var dirRE = /^(?:v-|:|@)/;
439
429
  var bindRE = /^(?::|v-bind:)/;
440
430
  var clientStyleRE = /^v-(?!scope|on:)/;
441
- /**
442
- * Attributes tried in order when no `key` option is given. All three express
443
- * identity, so none repeat among siblings the way `name` does on a radio group
444
- * — hence its absence. The attribute name is part of the key, so `id="5"` and
445
- * `data-id="5"` stay distinct.
446
- */
447
431
  var KEY_ATTRS = [
448
432
  "id",
449
433
  "data-key",
@@ -456,44 +440,28 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
456
440
  }
457
441
  return null;
458
442
  };
459
- /**
460
- * The nearest stashed context, walking up from a live node. `v-scope` elements
461
- * record theirs during walk, so inserted markup binds with the scope it landed
462
- * in rather than the root.
463
- */
464
443
  var nearestCtx = (node) => {
465
444
  for (let el = node; el; el = el.parentElement) if (el.__ctx) return el.__ctx;
466
445
  };
467
- /**
468
- * Disposal is per node, so any context can release any subtree. Outside every
469
- * scope there is no parent context to ask, but a root inside the subtree has
470
- * one; without this, its effects and listeners outlive it.
471
- */
472
446
  var ctxIn = (n) => n.__ctx || [...n.children || []].map(ctxIn).find(Boolean);
473
447
  var release = (node, ctx) => (ctx || ctxIn(node))?.dispose?.(node);
474
- /**
475
- * Attributes the client owns, read from the *incoming* markup — it still
476
- * carries the directives the live DOM had stripped. `:class` there means the
477
- * live `class` is bound and must survive the server's static value.
478
- */
479
448
  var boundAttrs = (to) => {
480
449
  const owned = /* @__PURE__ */ new Set();
481
450
  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") {
451
+ for (const { name } of to.attributes) if (bindRE.test(name)) {
452
+ const attr = name.replace(bindRE, "").split(".")[0];
453
+ owned.add(/\.camel\b/.test(name) ? attr.replace(/-(\w)/g, (_, c) => c.toUpperCase()) : attr);
454
+ } else if (/^v-model\b/.test(name)) {
484
455
  owned.add("value");
485
456
  owned.add("checked");
486
457
  } else if (name === "v-bind") owned.add("*");
487
- else if (clientStyleRE.test(name)) owned.add("style");
458
+ else if (clientStyleRE.test(name)) {
459
+ owned.add("style");
460
+ name == "v-popover" && owned.add("popover");
461
+ }
488
462
  return owned;
489
463
  };
490
- /**
491
- * `v-for` and `v-if` render into Blocks: the live DOM holds anchors plus the
492
- * clones the data produced, while the server still sends one template. Matched
493
- * positionally, the rest would be deleted as "no longer sent".
494
- */
495
464
  var isBlockRoot = (el) => el.hasAttribute("v-for") || el.hasAttribute("v-if") || el.hasAttribute("v-else") || el.hasAttribute("v-else-if");
496
- /** True when the client, not the server, decides this element's contents. */
497
465
  var ownsChildren = (to) => {
498
466
  if (to.hasAttribute("v-text") || to.hasAttribute("v-html") || to.hasAttribute("v-pre") || to.hasAttribute("v-once") || isBlockRoot(to)) return true;
499
467
  for (let c = to.firstElementChild; c; c = c.nextElementSibling) if (isBlockRoot(c)) return true;
@@ -506,15 +474,18 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
506
474
  ];
507
475
  var syncValues = (from, to, owned) => {
508
476
  const ctl = boundAttrs(to.closest("select") || to);
509
- if (owned.has("*") || ctl.has("*") || ctl.has("value")) return;
477
+ if (owned.has("*") || ctl.has("*") || ctl.has("value") || from.type == "output" || from.type == "textarea" && to.value.includes("{{")) return;
510
478
  for (const name of FIELD_PROPS) {
511
479
  const prop = name.toLowerCase();
512
480
  const init = "default" + name;
513
- if (!owned.has(prop) && init in from && from[prop] !== to[init]) from[prop] = to[init];
481
+ const src = name == "Selected" ? init : prop;
482
+ if (!owned.has(prop) && init in from && from[prop] !== to[src]) from[prop] = to[src];
514
483
  }
515
484
  };
516
485
  var patchAttrs = (from, to, values) => {
517
486
  const owned = boundAttrs(to);
487
+ if (from.__anchor) owned.add("style");
488
+ for (const name of from.constructor.morphOwnedAttributes || []) owned.add(name);
518
489
  if (values) syncValues(from, to, owned);
519
490
  const bound = Object(from.__bound);
520
491
  for (const { name, value } of to.attributes) {
@@ -526,16 +497,12 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
526
497
  from.removeAttribute(name);
527
498
  }
528
499
  };
529
- /**
530
- * Incoming text still holding `{{ }}` is rendered by a text directive on the
531
- * live side, so the live value wins.
532
- */
533
500
  var isInterpolation = (data, ctx) => data.includes(ctx ? ctx.delimiters[0] : "{{");
534
501
  var patchNode = (from, to, ctx, opts) => {
535
502
  if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx, opts);
536
503
  if (from.nodeType === 3 || from.nodeType === 8) {
537
504
  const data = to.data;
538
- if (isInterpolation(data, ctx)) return;
505
+ if (isInterpolation(data, ctx) && from.parentNode?.nodeName != "SCRIPT") return;
539
506
  if (!from.data) return replaceNode(from, to, ctx, opts);
540
507
  if (from.data !== data) from.data = data;
541
508
  return;
@@ -545,9 +512,10 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
545
512
  const b = to;
546
513
  if (a.tagName !== b.tagName) return replaceNode(from, to, ctx, opts);
547
514
  if (opts.skip?.(a, b) || a.hasAttribute("data-morph-skip")) return;
515
+ if (a.matches(LAZY)) return a.isEqualNode(b) ? void 0 : replaceNode(from, to, ctx, opts);
548
516
  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);
517
+ if (a.tagName == "TEMPLATE" && !a.content.isEqualNode(b.content)) a.innerHTML = b.innerHTML;
518
+ if (!ownsChildren(b) && !Object.getOwnPropertyDescriptor(Object(a.__ctx?.scope), "$template")) patchChildren(a, b, a.__ctx || ctx, opts);
551
519
  };
552
520
  var replaceNode = (from, to, ctx, opts) => {
553
521
  if (preserved(from, opts)) return;
@@ -557,14 +525,10 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
557
525
  from.parentNode.replaceChild(fresh, from);
558
526
  opts.afterNodeRemoved?.(from);
559
527
  mountNew(fresh, ctx);
528
+ return fresh;
560
529
  };
561
- /**
562
- * Bind never-walked markup with the scope it was inserted into. The walker
563
- * comes off the context, not an import, so this plugin doesn't pull a second
564
- * copy of the core into the plugins bundle.
565
- */
566
530
  var mountNew = (node, ctx) => {
567
- if (node.parentElement?.closest("[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]")) return;
531
+ if (node.parentElement?.closest(LAZY)) return;
568
532
  const target = ctx || nearestCtx(node.parentNode);
569
533
  target?.walk?.(node, target);
570
534
  };
@@ -578,6 +542,15 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
578
542
  keyed.set(k, n);
579
543
  }
580
544
  const keyOf = (n) => n && n.nodeType === 1 ? key(n) : null;
545
+ const wanted = /* @__PURE__ */ new Set();
546
+ for (let n = to.firstChild; n; n = n.nextSibling) wanted.add(keyOf(n));
547
+ const drop = (node) => {
548
+ if (!preserved(node, opts)) {
549
+ release(node, ctx);
550
+ from.removeChild(node);
551
+ opts.afterNodeRemoved?.(node);
552
+ }
553
+ };
581
554
  let oldChild = from.firstChild;
582
555
  let newChild = to.firstChild;
583
556
  const insert = (node) => {
@@ -598,7 +571,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
598
571
  keyed.delete(wantKey);
599
572
  patchNode(match, newChild, ctx, opts);
600
573
  } else insert(newChild);
601
- } else if (oldChild && keyOf(oldChild) == null) {
574
+ } else if (oldChild && (keyOf(oldChild) == null || !wanted.has(keyOf(oldChild)) && oldChild.tagName === newChild.tagName)) {
602
575
  if (preserved(oldChild, opts) && !preserved(newChild, opts)) {
603
576
  oldChild = oldChild.nextSibling;
604
577
  continue;
@@ -606,16 +579,17 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
606
579
  const nextOld = oldChild.nextSibling;
607
580
  patchNode(oldChild, newChild, ctx, opts);
608
581
  oldChild = nextOld;
582
+ } else if (oldChild && !wanted.has(keyOf(oldChild))) {
583
+ const nextOld = oldChild.nextSibling;
584
+ drop(oldChild);
585
+ oldChild = nextOld;
586
+ continue;
609
587
  } else insert(newChild);
610
588
  newChild = nextNew;
611
589
  }
612
590
  while (oldChild) {
613
591
  const next = oldChild.nextSibling;
614
- if (!preserved(oldChild, opts)) {
615
- release(oldChild, ctx);
616
- from.removeChild(oldChild);
617
- opts.afterNodeRemoved?.(oldChild);
618
- }
592
+ drop(oldChild);
619
593
  oldChild = next;
620
594
  }
621
595
  };
@@ -627,18 +601,19 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
627
601
  let target;
628
602
  if (typeof to === "string") {
629
603
  const holder = document.createElement("template");
630
- holder.innerHTML = to.trim();
631
- const content = holder.content;
604
+ const svg = from instanceof SVGElement;
605
+ holder.innerHTML = svg ? `<svg>${to.trim()}</svg>` : to.trim();
606
+ const content = svg ? holder.content.firstChild : holder.content;
632
607
  target = content.childNodes.length === 1 && content.firstElementChild ? content.firstElementChild : (() => {
633
608
  const wrapper = from.cloneNode(false);
634
- wrapper.appendChild(content);
609
+ wrapper.append(...content.childNodes);
635
610
  return wrapper;
636
611
  })();
637
612
  } else target = to;
638
613
  if (target) {
639
614
  const patch = () => {
640
615
  const restore = captureFocus();
641
- patchNode(from, target, nearestCtx(from), opts);
616
+ from = patchNode(from, target, nearestCtx(from.parentNode), opts) || from;
642
617
  restore();
643
618
  };
644
619
  opts.transition && document.startViewTransition ? document.startViewTransition(patch) : patch();
@@ -688,23 +663,14 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
688
663
  * replaces rather than merges, so adjusting one breakpoint means spreading
689
664
  * this rather than retyping all five.
690
665
  */
691
- var defaultBreakpoints = Object.freeze({ ...DEFAULT_BREAKPOINTS });
666
+ var defaultBreakpoints = /* @__PURE__ */ Object.freeze({ ...DEFAULT_BREAKPOINTS });
692
667
  var ALIASES = {
693
668
  mobile: "base",
694
669
  tablet: "md",
695
670
  desktop: "lg"
696
671
  };
697
672
  var NUMERIC = /^\d+$/;
698
- /**
699
- * Two reactive primitives, deliberately:
700
- *
701
- * - `bp`, one string, so named keys / `atLeast` / `device` cost each consumer
702
- * a single dependency however many responsive maps the page declares.
703
- * - `tick`, for arbitrary `match()` queries. Their results are read off the
704
- * MediaQueryList rather than mirrored, since registering a query inside a
705
- * running effect would write a dependency it just read and re-run it.
706
- */
707
- var state = (0, _aevantec_litevue.reactive)({
673
+ var state = /* @__PURE__ */ (0, _aevantec_litevue.reactive)({
708
674
  bp: "base",
709
675
  tick: 0
710
676
  });
@@ -717,17 +683,10 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
717
683
  var MAX_QUERIES = 64;
718
684
  var supported = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
719
685
  var subscribe = (mql, cb) => {
720
- if (mql.addEventListener) {
721
- mql.addEventListener("change", cb);
722
- return {
723
- mql,
724
- off: () => mql.removeEventListener("change", cb)
725
- };
726
- }
727
- mql.addListener(cb);
686
+ mql.addEventListener("change", cb);
728
687
  return {
729
688
  mql,
730
- off: () => mql.removeListener(cb)
689
+ off: () => mql.removeEventListener("change", cb)
731
690
  };
732
691
  };
733
692
  var currentBp = () => {
@@ -747,26 +706,15 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
747
706
  });
748
707
  state.bp = currentBp();
749
708
  };
750
- /**
751
- * Started by the first read, not by `app.use()`, so `mq` works in a plain
752
- * module with no app mounted — otherwise it would report a frozen 'base'.
753
- */
754
709
  var activate = () => {
755
710
  if (active) return;
756
711
  active = true;
757
712
  buildScale();
758
713
  };
759
- /**
760
- * Entry point for every public read: activates, and depends on `tick` so
761
- * `configure()` can invalidate all of them. `bp` alone is not enough — a key
762
- * absent from the current scale returns false without touching reactive state,
763
- * so that effect could never recover once a later scale defined the key.
764
- */
765
714
  var trackAll = () => {
766
715
  activate();
767
716
  state.tick;
768
717
  };
769
- /** SSR and jsdom have no matchMedia; every query reads false and bp stays base. */
770
718
  var rawMatch = (query) => {
771
719
  if (!supported()) return false;
772
720
  let sub = querySubs.get(query);
@@ -780,7 +728,6 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
780
728
  }
781
729
  return sub.mql.matches;
782
730
  };
783
- /** A key's lower bound in pixels, or undefined if it names nothing. */
784
731
  var keyToPx = (key) => {
785
732
  if (typeof key === "number") return key;
786
733
  if (key === "base") return 0;
@@ -831,7 +778,7 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
831
778
  return DEFAULT_BREAKPOINTS[name];
832
779
  };
833
780
  var mqFn = (map, fallback) => resolve(map, fallback);
834
- var mq = Object.defineProperties(mqFn, {
781
+ var mq = /* @__PURE__ */ Object.defineProperties(mqFn, {
835
782
  props: { value: (maps) => {
836
783
  trackAll();
837
784
  const out = {};
@@ -875,11 +822,6 @@ var LiteVuePlugins = (function(exports, _aevantec_litevue) {
875
822
  }
876
823
  } }
877
824
  });
878
- /**
879
- * Drops every live subscription; `activate()` rebuilds them on the next read.
880
- * The scale is deliberately left alone — a page that configured one still
881
- * wants it.
882
- */
883
825
  var releaseSubscriptions = () => {
884
826
  scaleSubs.forEach((s) => s.off());
885
827
  querySubs.forEach((s) => s.off());