@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.
- package/dist/litevue-devtools.iife.js +1 -1
- package/dist/litevue-devtools.mjs +1 -1
- package/dist/litevue-devtools.umd.js +1 -1
- package/dist/litevue-plugins.dev.iife.js +67 -125
- package/dist/litevue-plugins.dev.mjs +67 -124
- package/dist/litevue-plugins.iife.js +1 -1
- package/dist/litevue-plugins.mjs +1 -1
- package/dist/litevue-plugins.umd.js +1 -1
- package/dist/litevue.dev.iife.js +122 -159
- package/dist/litevue.dev.mjs +122 -158
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/collapse.iife.js +1 -1
- package/dist/plugins/collapse.mjs +1 -1
- package/dist/plugins/collapse.umd.js +1 -1
- package/dist/plugins/focus.iife.js +1 -1
- package/dist/plugins/focus.mjs +1 -1
- package/dist/plugins/focus.umd.js +1 -1
- package/dist/plugins/intersect.iife.js +1 -1
- package/dist/plugins/intersect.umd.js +1 -1
- package/dist/plugins/mask.iife.js +1 -1
- package/dist/plugins/mask.mjs +1 -1
- package/dist/plugins/mask.umd.js +1 -1
- package/dist/plugins/media.dev.iife.js +5 -39
- package/dist/plugins/media.dev.mjs +5 -38
- package/dist/plugins/media.iife.js +1 -1
- package/dist/plugins/media.mjs +1 -1
- package/dist/plugins/media.umd.js +1 -1
- package/dist/plugins/morph.dev.iife.js +41 -61
- package/dist/plugins/morph.dev.mjs +41 -60
- package/dist/plugins/morph.iife.js +1 -1
- package/dist/plugins/morph.mjs +1 -1
- package/dist/plugins/morph.umd.js +1 -1
- package/dist/plugins/navigate.dev.iife.js +24 -26
- package/dist/plugins/navigate.dev.mjs +24 -25
- package/dist/plugins/navigate.iife.js +1 -1
- package/dist/plugins/navigate.mjs +1 -1
- package/dist/plugins/navigate.umd.js +1 -1
- package/dist/plugins/persist.dev.iife.js +2 -10
- package/dist/plugins/persist.dev.mjs +2 -9
- package/dist/plugins/persist.iife.js +1 -1
- package/dist/plugins/persist.mjs +1 -1
- package/dist/plugins/persist.umd.js +1 -1
- package/dist/plugins/popover.iife.js +1 -1
- package/dist/plugins/popover.mjs +1 -1
- package/dist/plugins/popover.umd.js +1 -1
- package/dist/plugins/resize.iife.js +1 -1
- package/dist/plugins/resize.umd.js +1 -1
- package/dist/plugins/transition.iife.js +1 -1
- package/dist/plugins/transition.mjs +1 -1
- package/dist/plugins/transition.umd.js +1 -1
- package/dist/types/app.d.mts +5 -6
- package/dist/types/app.d.ts +5 -6
- package/dist/types/block.d.mts +0 -4
- package/dist/types/block.d.ts +0 -4
- package/dist/types/context.d.mts +1 -6
- package/dist/types/context.d.ts +1 -6
- package/dist/types/devtools-panel/chrome.d.mts +5 -7
- package/dist/types/devtools-panel/chrome.d.ts +5 -7
- package/dist/types/devtools-panel/menu.d.mts +10 -0
- package/dist/types/devtools-panel/menu.d.ts +10 -0
- package/dist/types/devtools-panel/plugins.d.mts +0 -4
- package/dist/types/devtools-panel/plugins.d.ts +0 -4
- package/dist/types/devtools-panel/styles.d.mts +3 -15
- package/dist/types/devtools-panel/styles.d.ts +3 -15
- package/dist/types/devtools-panel/values.d.mts +1 -20
- package/dist/types/devtools-panel/values.d.ts +1 -20
- package/dist/types/devtools.d.mts +0 -7
- package/dist/types/devtools.d.ts +0 -7
- package/dist/types/directives/on.d.mts +0 -1
- package/dist/types/directives/on.d.ts +0 -1
- package/dist/types/directives/show.d.mts +1 -0
- package/dist/types/directives/show.d.ts +1 -0
- package/dist/types/errors.d.mts +1 -8
- package/dist/types/errors.d.ts +1 -8
- package/dist/types/eval.d.mts +0 -3
- package/dist/types/eval.d.ts +0 -3
- package/dist/types/lazy.d.mts +0 -10
- package/dist/types/lazy.d.ts +0 -10
- package/dist/types/magics.d.mts +0 -9
- package/dist/types/magics.d.ts +0 -9
- package/dist/types/ownership.d.mts +0 -19
- package/dist/types/ownership.d.ts +0 -19
- package/dist/types/plugins/media/index.d.mts +0 -5
- package/dist/types/plugins/media/index.d.ts +0 -5
- package/dist/types/plugins/morph/index.d.mts +0 -8
- package/dist/types/plugins/morph/index.d.ts +0 -8
- package/dist/types/scheduler.d.mts +0 -5
- package/dist/types/scheduler.d.ts +0 -5
- package/dist/types/store.d.mts +5 -1
- package/dist/types/store.d.ts +5 -1
- package/dist/types/utils.d.mts +0 -5
- package/dist/types/utils.d.ts +0 -5
- package/dist/types/warn.d.mts +0 -12
- package/dist/types/warn.d.ts +0 -12
- package/package.json +3 -3
|
@@ -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
|
|
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
|
}
|
|
@@ -169,12 +170,12 @@ var transition = (app) => {
|
|
|
169
170
|
return () => {
|
|
170
171
|
clearTimeout(endTimer);
|
|
171
172
|
clear();
|
|
173
|
+
if (shown === false) elem.style.display = "none";
|
|
172
174
|
};
|
|
173
175
|
});
|
|
174
176
|
};
|
|
175
177
|
// src/plugins/persist/index.ts
|
|
176
178
|
var PREFIX = "litevue:";
|
|
177
|
-
/** Custom storages registered by name, usable as a directive modifier. */
|
|
178
179
|
var registry = Object.create(null);
|
|
179
180
|
var defaultStorage = "local";
|
|
180
181
|
var builtin = (name) => {
|
|
@@ -186,7 +187,7 @@ var builtin = (name) => {
|
|
|
186
187
|
var resolve$1 = (storage) => {
|
|
187
188
|
const target = storage ?? defaultStorage;
|
|
188
189
|
if (typeof target !== "string") return target;
|
|
189
|
-
return registry[target] ?? builtin(target);
|
|
190
|
+
return registry[target.toLowerCase()] ?? builtin(target);
|
|
190
191
|
};
|
|
191
192
|
/**
|
|
192
193
|
* Register a custom storage under a name, selectable anywhere — including as a
|
|
@@ -197,7 +198,7 @@ var resolve$1 = (storage) => {
|
|
|
197
198
|
* <div v-persist.memory="scratch">…</div>
|
|
198
199
|
*/
|
|
199
200
|
var registerStorage = (name, storage) => {
|
|
200
|
-
registry[name] = storage;
|
|
201
|
+
registry[name.toLowerCase()] = storage;
|
|
201
202
|
};
|
|
202
203
|
/**
|
|
203
204
|
* Switch the storage used when none is specified. Accepts a registered name
|
|
@@ -208,11 +209,6 @@ var registerStorage = (name, storage) => {
|
|
|
208
209
|
var setDefaultStorage = (storage) => {
|
|
209
210
|
defaultStorage = storage;
|
|
210
211
|
};
|
|
211
|
-
/**
|
|
212
|
-
* Which own properties of `target` can round-trip through storage. Methods are
|
|
213
|
-
* behavior, not state; getter-only properties are derived and would throw on
|
|
214
|
-
* restore. An explicit list is filtered too, so naming a getter is a no-op.
|
|
215
|
-
*/
|
|
216
212
|
var persistable = (target, keys) => (keys ?? Object.keys(target)).filter((k) => {
|
|
217
213
|
if (k[0] === "$") return false;
|
|
218
214
|
const desc = Object.getOwnPropertyDescriptor(target, k);
|
|
@@ -221,7 +217,6 @@ var persistable = (target, keys) => (keys ?? Object.keys(target)).filter((k) =>
|
|
|
221
217
|
if (raw && raw.__v_isRef === true && raw.__v_isReadonly === true) return false;
|
|
222
218
|
return typeof target[k] !== "function";
|
|
223
219
|
});
|
|
224
|
-
/** Restore saved values, then keep storage in sync with every change. */
|
|
225
220
|
var sync = (target, key, keys, storage, run) => {
|
|
226
221
|
if (!storage) return run(() => {});
|
|
227
222
|
const fields = persistable(target, keys);
|
|
@@ -322,9 +317,9 @@ var focus = (app) => {
|
|
|
322
317
|
app.directive("trap", ({ el, get, effect }) => {
|
|
323
318
|
let active = false;
|
|
324
319
|
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);
|
|
320
|
+
const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert],[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
|
|
326
321
|
const onKeydown = (e) => {
|
|
327
|
-
if (e.key !== "Tab" || traps.at(-1) !==
|
|
322
|
+
if (e.key !== "Tab" || traps.at(-1) !== el) return;
|
|
328
323
|
const els = focusables();
|
|
329
324
|
if (!els.length) {
|
|
330
325
|
e.preventDefault();
|
|
@@ -336,17 +331,14 @@ var focus = (app) => {
|
|
|
336
331
|
if (!el.contains(current)) {
|
|
337
332
|
e.preventDefault();
|
|
338
333
|
first.focus();
|
|
339
|
-
} else if (e.shiftKey
|
|
340
|
-
e.preventDefault();
|
|
341
|
-
last.focus();
|
|
342
|
-
} else if (!e.shiftKey && current === last) {
|
|
334
|
+
} else if (!((e.shiftKey ? first : last).compareDocumentPosition(current) & (e.shiftKey ? 4 : 2))) {
|
|
343
335
|
e.preventDefault();
|
|
344
|
-
first.focus();
|
|
336
|
+
(e.shiftKey ? last : first).focus();
|
|
345
337
|
}
|
|
346
338
|
};
|
|
347
339
|
const release = () => {
|
|
348
340
|
active = false;
|
|
349
|
-
traps.splice(traps.indexOf(
|
|
341
|
+
traps.splice(traps.indexOf(el), 1);
|
|
350
342
|
document.removeEventListener("keydown", onKeydown, true);
|
|
351
343
|
if (prevFocus && prevFocus.focus) prevFocus.focus();
|
|
352
344
|
};
|
|
@@ -355,10 +347,10 @@ var focus = (app) => {
|
|
|
355
347
|
if (on && !active) {
|
|
356
348
|
active = true;
|
|
357
349
|
prevFocus = document.activeElement;
|
|
358
|
-
traps.
|
|
350
|
+
traps.splice(traps.findIndex((t) => el.contains(t)) >>> 0, 0, el);
|
|
359
351
|
document.addEventListener("keydown", onKeydown, true);
|
|
360
352
|
Promise.resolve().then(() => {
|
|
361
|
-
if (active) (focusables()[0] || el).focus();
|
|
353
|
+
if (active && traps.at(-1) === el) (focusables()[0] || el).focus();
|
|
362
354
|
});
|
|
363
355
|
} else if (!on && active) release();
|
|
364
356
|
});
|
|
@@ -392,7 +384,6 @@ var collapse = (app) => {
|
|
|
392
384
|
];
|
|
393
385
|
const before = owned.map((k) => elem.style[k]);
|
|
394
386
|
const hide = (hidden) => elem.style.visibility = hidden ? "hidden" : before[3];
|
|
395
|
-
elem.style.overflow = "hidden";
|
|
396
387
|
let shown;
|
|
397
388
|
let seq = 0;
|
|
398
389
|
const timers = /* @__PURE__ */ new Set();
|
|
@@ -408,13 +399,17 @@ var collapse = (app) => {
|
|
|
408
399
|
if (show === shown) return;
|
|
409
400
|
const id = ++seq;
|
|
410
401
|
hide(!show);
|
|
402
|
+
elem.style.overflow = show && shown == null ? before[0] : "hidden";
|
|
411
403
|
if (shown == null) later(() => {
|
|
412
404
|
elem.style.transition = `height ${duration}ms ease, visibility ${duration}ms`;
|
|
413
405
|
});
|
|
414
406
|
else {
|
|
415
|
-
elem.style.height = elem.scrollHeight + "px";
|
|
407
|
+
elem.style.height = before[1] || elem.scrollHeight + "px";
|
|
416
408
|
if (show) later(() => {
|
|
417
|
-
if (id === seq)
|
|
409
|
+
if (id === seq) {
|
|
410
|
+
elem.style.height = before[1];
|
|
411
|
+
elem.style.overflow = before[0];
|
|
412
|
+
}
|
|
418
413
|
}, duration);
|
|
419
414
|
else elem.offsetHeight;
|
|
420
415
|
}
|
|
@@ -428,21 +423,11 @@ var collapse = (app) => {
|
|
|
428
423
|
});
|
|
429
424
|
};
|
|
430
425
|
// src/plugins/morph/index.ts
|
|
431
|
-
/**
|
|
432
|
-
* A `data-` attribute rather than `v-preserve`: an unrecognised `v-` attribute
|
|
433
|
-
* logs an unknown-directive error, and registering one would have the walker
|
|
434
|
-
* strip it, leaving nothing for the next morph. Matches `data-morph-skip`.
|
|
435
|
-
*/
|
|
436
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]";
|
|
437
428
|
var dirRE = /^(?:v-|:|@)/;
|
|
438
429
|
var bindRE = /^(?::|v-bind:)/;
|
|
439
430
|
var clientStyleRE = /^v-(?!scope|on:)/;
|
|
440
|
-
/**
|
|
441
|
-
* Attributes tried in order when no `key` option is given. All three express
|
|
442
|
-
* identity, so none repeat among siblings the way `name` does on a radio group
|
|
443
|
-
* — hence its absence. The attribute name is part of the key, so `id="5"` and
|
|
444
|
-
* `data-id="5"` stay distinct.
|
|
445
|
-
*/
|
|
446
431
|
var KEY_ATTRS = [
|
|
447
432
|
"id",
|
|
448
433
|
"data-key",
|
|
@@ -455,44 +440,28 @@ var defaultKey = (el) => {
|
|
|
455
440
|
}
|
|
456
441
|
return null;
|
|
457
442
|
};
|
|
458
|
-
/**
|
|
459
|
-
* The nearest stashed context, walking up from a live node. `v-scope` elements
|
|
460
|
-
* record theirs during walk, so inserted markup binds with the scope it landed
|
|
461
|
-
* in rather than the root.
|
|
462
|
-
*/
|
|
463
443
|
var nearestCtx = (node) => {
|
|
464
444
|
for (let el = node; el; el = el.parentElement) if (el.__ctx) return el.__ctx;
|
|
465
445
|
};
|
|
466
|
-
/**
|
|
467
|
-
* Disposal is per node, so any context can release any subtree. Outside every
|
|
468
|
-
* scope there is no parent context to ask, but a root inside the subtree has
|
|
469
|
-
* one; without this, its effects and listeners outlive it.
|
|
470
|
-
*/
|
|
471
446
|
var ctxIn = (n) => n.__ctx || [...n.children || []].map(ctxIn).find(Boolean);
|
|
472
447
|
var release = (node, ctx) => (ctx || ctxIn(node))?.dispose?.(node);
|
|
473
|
-
/**
|
|
474
|
-
* Attributes the client owns, read from the *incoming* markup — it still
|
|
475
|
-
* carries the directives the live DOM had stripped. `:class` there means the
|
|
476
|
-
* live `class` is bound and must survive the server's static value.
|
|
477
|
-
*/
|
|
478
448
|
var boundAttrs = (to) => {
|
|
479
449
|
const owned = /* @__PURE__ */ new Set();
|
|
480
450
|
if (to.matches("details,dialog")) owned.add("open");
|
|
481
|
-
for (const { name } of to.attributes) if (bindRE.test(name))
|
|
482
|
-
|
|
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)) {
|
|
483
455
|
owned.add("value");
|
|
484
456
|
owned.add("checked");
|
|
485
457
|
} else if (name === "v-bind") owned.add("*");
|
|
486
|
-
else if (clientStyleRE.test(name))
|
|
458
|
+
else if (clientStyleRE.test(name)) {
|
|
459
|
+
owned.add("style");
|
|
460
|
+
name == "v-popover" && owned.add("popover");
|
|
461
|
+
}
|
|
487
462
|
return owned;
|
|
488
463
|
};
|
|
489
|
-
/**
|
|
490
|
-
* `v-for` and `v-if` render into Blocks: the live DOM holds anchors plus the
|
|
491
|
-
* clones the data produced, while the server still sends one template. Matched
|
|
492
|
-
* positionally, the rest would be deleted as "no longer sent".
|
|
493
|
-
*/
|
|
494
464
|
var isBlockRoot = (el) => el.hasAttribute("v-for") || el.hasAttribute("v-if") || el.hasAttribute("v-else") || el.hasAttribute("v-else-if");
|
|
495
|
-
/** True when the client, not the server, decides this element's contents. */
|
|
496
465
|
var ownsChildren = (to) => {
|
|
497
466
|
if (to.hasAttribute("v-text") || to.hasAttribute("v-html") || to.hasAttribute("v-pre") || to.hasAttribute("v-once") || isBlockRoot(to)) return true;
|
|
498
467
|
for (let c = to.firstElementChild; c; c = c.nextElementSibling) if (isBlockRoot(c)) return true;
|
|
@@ -505,15 +474,18 @@ var FIELD_PROPS = [
|
|
|
505
474
|
];
|
|
506
475
|
var syncValues = (from, to, owned) => {
|
|
507
476
|
const ctl = boundAttrs(to.closest("select") || to);
|
|
508
|
-
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;
|
|
509
478
|
for (const name of FIELD_PROPS) {
|
|
510
479
|
const prop = name.toLowerCase();
|
|
511
480
|
const init = "default" + name;
|
|
512
|
-
|
|
481
|
+
const src = name == "Selected" ? init : prop;
|
|
482
|
+
if (!owned.has(prop) && init in from && from[prop] !== to[src]) from[prop] = to[src];
|
|
513
483
|
}
|
|
514
484
|
};
|
|
515
485
|
var patchAttrs = (from, to, values) => {
|
|
516
486
|
const owned = boundAttrs(to);
|
|
487
|
+
if (from.__anchor) owned.add("style");
|
|
488
|
+
for (const name of from.constructor.morphOwnedAttributes || []) owned.add(name);
|
|
517
489
|
if (values) syncValues(from, to, owned);
|
|
518
490
|
const bound = Object(from.__bound);
|
|
519
491
|
for (const { name, value } of to.attributes) {
|
|
@@ -525,16 +497,12 @@ var patchAttrs = (from, to, values) => {
|
|
|
525
497
|
from.removeAttribute(name);
|
|
526
498
|
}
|
|
527
499
|
};
|
|
528
|
-
/**
|
|
529
|
-
* Incoming text still holding `{{ }}` is rendered by a text directive on the
|
|
530
|
-
* live side, so the live value wins.
|
|
531
|
-
*/
|
|
532
500
|
var isInterpolation = (data, ctx) => data.includes(ctx ? ctx.delimiters[0] : "{{");
|
|
533
501
|
var patchNode = (from, to, ctx, opts) => {
|
|
534
502
|
if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx, opts);
|
|
535
503
|
if (from.nodeType === 3 || from.nodeType === 8) {
|
|
536
504
|
const data = to.data;
|
|
537
|
-
if (isInterpolation(data, ctx)) return;
|
|
505
|
+
if (isInterpolation(data, ctx) && from.parentNode?.nodeName != "SCRIPT") return;
|
|
538
506
|
if (!from.data) return replaceNode(from, to, ctx, opts);
|
|
539
507
|
if (from.data !== data) from.data = data;
|
|
540
508
|
return;
|
|
@@ -544,9 +512,10 @@ var patchNode = (from, to, ctx, opts) => {
|
|
|
544
512
|
const b = to;
|
|
545
513
|
if (a.tagName !== b.tagName) return replaceNode(from, to, ctx, opts);
|
|
546
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);
|
|
547
516
|
patchAttrs(a, b, opts.values);
|
|
548
|
-
if (a.tagName == "TEMPLATE") a.innerHTML = b.innerHTML;
|
|
549
|
-
if (!ownsChildren(b) && !a.__ctx?.scope
|
|
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);
|
|
550
519
|
};
|
|
551
520
|
var replaceNode = (from, to, ctx, opts) => {
|
|
552
521
|
if (preserved(from, opts)) return;
|
|
@@ -556,14 +525,10 @@ var replaceNode = (from, to, ctx, opts) => {
|
|
|
556
525
|
from.parentNode.replaceChild(fresh, from);
|
|
557
526
|
opts.afterNodeRemoved?.(from);
|
|
558
527
|
mountNew(fresh, ctx);
|
|
528
|
+
return fresh;
|
|
559
529
|
};
|
|
560
|
-
/**
|
|
561
|
-
* Bind never-walked markup with the scope it was inserted into. The walker
|
|
562
|
-
* comes off the context, not an import, so this plugin doesn't pull a second
|
|
563
|
-
* copy of the core into the plugins bundle.
|
|
564
|
-
*/
|
|
565
530
|
var mountNew = (node, ctx) => {
|
|
566
|
-
if (node.parentElement?.closest(
|
|
531
|
+
if (node.parentElement?.closest(LAZY)) return;
|
|
567
532
|
const target = ctx || nearestCtx(node.parentNode);
|
|
568
533
|
target?.walk?.(node, target);
|
|
569
534
|
};
|
|
@@ -577,6 +542,15 @@ var patchChildren = (from, to, ctx, opts) => {
|
|
|
577
542
|
keyed.set(k, n);
|
|
578
543
|
}
|
|
579
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
|
+
};
|
|
580
554
|
let oldChild = from.firstChild;
|
|
581
555
|
let newChild = to.firstChild;
|
|
582
556
|
const insert = (node) => {
|
|
@@ -597,7 +571,7 @@ var patchChildren = (from, to, ctx, opts) => {
|
|
|
597
571
|
keyed.delete(wantKey);
|
|
598
572
|
patchNode(match, newChild, ctx, opts);
|
|
599
573
|
} else insert(newChild);
|
|
600
|
-
} else if (oldChild && keyOf(oldChild) == null) {
|
|
574
|
+
} else if (oldChild && (keyOf(oldChild) == null || !wanted.has(keyOf(oldChild)) && oldChild.tagName === newChild.tagName)) {
|
|
601
575
|
if (preserved(oldChild, opts) && !preserved(newChild, opts)) {
|
|
602
576
|
oldChild = oldChild.nextSibling;
|
|
603
577
|
continue;
|
|
@@ -605,16 +579,17 @@ var patchChildren = (from, to, ctx, opts) => {
|
|
|
605
579
|
const nextOld = oldChild.nextSibling;
|
|
606
580
|
patchNode(oldChild, newChild, ctx, opts);
|
|
607
581
|
oldChild = nextOld;
|
|
582
|
+
} else if (oldChild && !wanted.has(keyOf(oldChild))) {
|
|
583
|
+
const nextOld = oldChild.nextSibling;
|
|
584
|
+
drop(oldChild);
|
|
585
|
+
oldChild = nextOld;
|
|
586
|
+
continue;
|
|
608
587
|
} else insert(newChild);
|
|
609
588
|
newChild = nextNew;
|
|
610
589
|
}
|
|
611
590
|
while (oldChild) {
|
|
612
591
|
const next = oldChild.nextSibling;
|
|
613
|
-
|
|
614
|
-
release(oldChild, ctx);
|
|
615
|
-
from.removeChild(oldChild);
|
|
616
|
-
opts.afterNodeRemoved?.(oldChild);
|
|
617
|
-
}
|
|
592
|
+
drop(oldChild);
|
|
618
593
|
oldChild = next;
|
|
619
594
|
}
|
|
620
595
|
};
|
|
@@ -626,18 +601,19 @@ var morph = (from, to, opts = {}) => {
|
|
|
626
601
|
let target;
|
|
627
602
|
if (typeof to === "string") {
|
|
628
603
|
const holder = document.createElement("template");
|
|
629
|
-
|
|
630
|
-
|
|
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;
|
|
631
607
|
target = content.childNodes.length === 1 && content.firstElementChild ? content.firstElementChild : (() => {
|
|
632
608
|
const wrapper = from.cloneNode(false);
|
|
633
|
-
wrapper.
|
|
609
|
+
wrapper.append(...content.childNodes);
|
|
634
610
|
return wrapper;
|
|
635
611
|
})();
|
|
636
612
|
} else target = to;
|
|
637
613
|
if (target) {
|
|
638
614
|
const patch = () => {
|
|
639
615
|
const restore = captureFocus();
|
|
640
|
-
patchNode(from, target, nearestCtx(from), opts);
|
|
616
|
+
from = patchNode(from, target, nearestCtx(from.parentNode), opts) || from;
|
|
641
617
|
restore();
|
|
642
618
|
};
|
|
643
619
|
opts.transition && document.startViewTransition ? document.startViewTransition(patch) : patch();
|
|
@@ -687,23 +663,14 @@ var DEFAULT_BREAKPOINTS = {
|
|
|
687
663
|
* replaces rather than merges, so adjusting one breakpoint means spreading
|
|
688
664
|
* this rather than retyping all five.
|
|
689
665
|
*/
|
|
690
|
-
var defaultBreakpoints = Object.freeze({ ...DEFAULT_BREAKPOINTS });
|
|
666
|
+
var defaultBreakpoints = /* @__PURE__ */ Object.freeze({ ...DEFAULT_BREAKPOINTS });
|
|
691
667
|
var ALIASES = {
|
|
692
668
|
mobile: "base",
|
|
693
669
|
tablet: "md",
|
|
694
670
|
desktop: "lg"
|
|
695
671
|
};
|
|
696
672
|
var NUMERIC = /^\d+$/;
|
|
697
|
-
|
|
698
|
-
* Two reactive primitives, deliberately:
|
|
699
|
-
*
|
|
700
|
-
* - `bp`, one string, so named keys / `atLeast` / `device` cost each consumer
|
|
701
|
-
* a single dependency however many responsive maps the page declares.
|
|
702
|
-
* - `tick`, for arbitrary `match()` queries. Their results are read off the
|
|
703
|
-
* MediaQueryList rather than mirrored, since registering a query inside a
|
|
704
|
-
* running effect would write a dependency it just read and re-run it.
|
|
705
|
-
*/
|
|
706
|
-
var state = reactive({
|
|
673
|
+
var state = /* @__PURE__ */ reactive({
|
|
707
674
|
bp: "base",
|
|
708
675
|
tick: 0
|
|
709
676
|
});
|
|
@@ -716,17 +683,10 @@ var querySubs = /* @__PURE__ */ new Map();
|
|
|
716
683
|
var MAX_QUERIES = 64;
|
|
717
684
|
var supported = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
|
|
718
685
|
var subscribe = (mql, cb) => {
|
|
719
|
-
|
|
720
|
-
mql.addEventListener("change", cb);
|
|
721
|
-
return {
|
|
722
|
-
mql,
|
|
723
|
-
off: () => mql.removeEventListener("change", cb)
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
mql.addListener(cb);
|
|
686
|
+
mql.addEventListener("change", cb);
|
|
727
687
|
return {
|
|
728
688
|
mql,
|
|
729
|
-
off: () => mql.
|
|
689
|
+
off: () => mql.removeEventListener("change", cb)
|
|
730
690
|
};
|
|
731
691
|
};
|
|
732
692
|
var currentBp = () => {
|
|
@@ -746,26 +706,15 @@ var buildScale = () => {
|
|
|
746
706
|
});
|
|
747
707
|
state.bp = currentBp();
|
|
748
708
|
};
|
|
749
|
-
/**
|
|
750
|
-
* Started by the first read, not by `app.use()`, so `mq` works in a plain
|
|
751
|
-
* module with no app mounted — otherwise it would report a frozen 'base'.
|
|
752
|
-
*/
|
|
753
709
|
var activate = () => {
|
|
754
710
|
if (active) return;
|
|
755
711
|
active = true;
|
|
756
712
|
buildScale();
|
|
757
713
|
};
|
|
758
|
-
/**
|
|
759
|
-
* Entry point for every public read: activates, and depends on `tick` so
|
|
760
|
-
* `configure()` can invalidate all of them. `bp` alone is not enough — a key
|
|
761
|
-
* absent from the current scale returns false without touching reactive state,
|
|
762
|
-
* so that effect could never recover once a later scale defined the key.
|
|
763
|
-
*/
|
|
764
714
|
var trackAll = () => {
|
|
765
715
|
activate();
|
|
766
716
|
state.tick;
|
|
767
717
|
};
|
|
768
|
-
/** SSR and jsdom have no matchMedia; every query reads false and bp stays base. */
|
|
769
718
|
var rawMatch = (query) => {
|
|
770
719
|
if (!supported()) return false;
|
|
771
720
|
let sub = querySubs.get(query);
|
|
@@ -779,7 +728,6 @@ var rawMatch = (query) => {
|
|
|
779
728
|
}
|
|
780
729
|
return sub.mql.matches;
|
|
781
730
|
};
|
|
782
|
-
/** A key's lower bound in pixels, or undefined if it names nothing. */
|
|
783
731
|
var keyToPx = (key) => {
|
|
784
732
|
if (typeof key === "number") return key;
|
|
785
733
|
if (key === "base") return 0;
|
|
@@ -830,7 +778,7 @@ var aliasPx = (alias) => {
|
|
|
830
778
|
return DEFAULT_BREAKPOINTS[name];
|
|
831
779
|
};
|
|
832
780
|
var mqFn = (map, fallback) => resolve(map, fallback);
|
|
833
|
-
var mq = Object.defineProperties(mqFn, {
|
|
781
|
+
var mq = /* @__PURE__ */ Object.defineProperties(mqFn, {
|
|
834
782
|
props: { value: (maps) => {
|
|
835
783
|
trackAll();
|
|
836
784
|
const out = {};
|
|
@@ -874,11 +822,6 @@ var mq = Object.defineProperties(mqFn, {
|
|
|
874
822
|
}
|
|
875
823
|
} }
|
|
876
824
|
});
|
|
877
|
-
/**
|
|
878
|
-
* Drops every live subscription; `activate()` rebuilds them on the next read.
|
|
879
|
-
* The scale is deliberately left alone — a page that configured one still
|
|
880
|
-
* wants it.
|
|
881
|
-
*/
|
|
882
825
|
var releaseSubscriptions = () => {
|
|
883
826
|
scaleSubs.forEach((s) => s.off());
|
|
884
827
|
querySubs.forEach((s) => s.off());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var LiteVuePlugins=function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=(e,t,i)=>{let r="",o="",s=0;for(let a=0;a<t.length;a++){const i=n[t[a]];if(i){for(;s<e.length&&!i.test(e[s]);)s++;if(s>=e.length)return r;r+=o+e[s++],o=""}else o+=t[a],e[s]===t[a]&&s++}return i?r+o:r},r=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),o=(e,t)=>{const n=e.split(","),i=t.split(",");let o=0;for(let s=0;s<n.length;s++)o=Math.max(o,r(n[s])+r(i[s%i.length]));return o},s="litevue:",a=Object.create(null),c="local",l=e=>{const t=e??c;return"string"!=typeof t?t:a[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},d=(e,t,n,i,r)=>{if(!i)return r(()=>{});const o=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const i=n&&n.value;return(!i||!0!==i.__v_isRef||!0!==i.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(i.getItem(t)||"null");if(n)for(const t of o)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return r(()=>{const n={};for(const t of o)n[t]=e[t];try{i.setItem(t,JSON.stringify(n))}catch{}})},f=[],u=(e,t,n)=>"radio"!==e.type||!e.name||e===(n.find(t=>"radio"===t.type&&t.name===e.name&&t.checked)||n.find(t=>"radio"===t.type&&t.name===e.name)),m=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||e.__marker||!!t.preserve?.(e)),p=/^(?:v-|:|@)/,v=/^(?::|v-bind:)/,h=/^v-(?!scope|on:)/,b=["id","data-key","data-id"],g=e=>{for(const t of b){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},y=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},k=e=>e.__ctx||[...e.children||[]].map(k).find(Boolean),w=(e,t)=>(t||k(e))?.dispose?.(e),x=e=>{const t=new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)v.test(n)?t.add(n.replace(v,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):h.test(n)&&t.add("style");return t},E=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),S=["Value","Checked","Selected"],L=(e,t,n)=>{const i=x(t);n&&((e,t,n)=>{const i=x(t.closest("select")||t);if(!(n.has("*")||i.has("*")||i.has("value")))for(const r of S){const i=r.toLowerCase(),o="default"+r;!n.has(i)&&o in e&&e[i]!==t[o]&&(e[i]=t[o])}})(e,t,i);const r=Object(e.__bound);for(const{name:o,value:s}of t.attributes)p.test(o)||i.has(o)||o in r||e.getAttribute(o)!==s&&e.setAttribute(o,s);for(const{name:o}of[...e.attributes])i.has("*")||i.has(o)||t.hasAttribute(o)||e.removeAttribute(o)},T=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return _(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return e.data?void(e.data!==r&&(e.data=r)):_(e,t,n,i)}if(1!==e.nodeType)return;const r=e,o=t;if(r.tagName!==o.tagName)return _(e,t,n,i);i.skip?.(r,o)||r.hasAttribute("data-morph-skip")||(L(r,o,i.values),"TEMPLATE"==r.tagName&&(r.innerHTML=o.innerHTML),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||E(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(E(t))return!0;return!1})(o)||r.__ctx?.scope.$template||O(r,o,r.__ctx||n,i))},_=(e,t,n,i)=>{if(m(e,i))return;const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(w(e,n),e.parentNode.replaceChild(r,e),i.afterNodeRemoved?.(e),A(r,n))},A=(e,t)=>{if(e.parentElement?.closest("[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]"))return;const n=t||y(e.parentNode);n?.walk?.(e,n)},O=(e,t,n,i)=>{const r=i.key||g,o=new Map;for(let d=e.firstChild;d;d=d.nextSibling)if(1===d.nodeType){const e=r(d);if(null==e)continue;o.set(e,d)}const s=e=>e&&1===e.nodeType?r(e):null;let a=e.firstChild,c=t.firstChild;const l=t=>{const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(e.insertBefore(r,a),A(r,n))};for(;c;){const t=c.nextSibling,r=s(c);if(""===a?.data&&c.hasAttribute?.("v-teleport"))a=a.nextSibling;else if(null!=r){const t=o.get(r);t?(t===a?a=a.nextSibling:e.insertBefore(t,a),o.delete(r),T(t,c,n,i)):l(c)}else if(a&&null==s(a)){if(m(a,i)&&!m(c,i)){a=a.nextSibling;continue}const e=a.nextSibling;T(a,c,n,i),a=e}else l(c);c=t}for(;a;){const t=a.nextSibling;m(a,i)||(w(a,n),e.removeChild(a),i.afterNodeRemoved?.(a)),a=t}},$=(e,t,n={})=>{let i;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const r=n.content;i=1===r.childNodes.length&&r.firstElementChild?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(r),t})()}else i=t;if(i){const t=()=>{const t=j();T(e,i,y(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},j=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,i=null;try{n=t.selectionStart,i=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,i)}catch{}}},N={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},P=Object.freeze({...N}),M={mobile:"base",tablet:"md",desktop:"lg"},C=/^\d+$/,q=(0,t.reactive)({bp:"base",tick:0}),D={...N},z=["base"],R=!1,V=[],B=new Map,H=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,I=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),J=()=>{for(let e=V.length-1;e>=0;e--)if(V[e].mql.matches)return z[e+1];return"base"},W=()=>{V.forEach(e=>e.off()),V=[];const e=Object.keys(D).filter(e=>D[e]>0).sort((e,t)=>D[e]-D[t]);z=["base",...e],H()&&(V=e.map(e=>{const t=window.matchMedia(`(min-width: ${D[e]}px)`);return I(t,()=>{q.bp=J()})}),q.bp=J())},K=()=>{R||(R=!0,W()),q.tick},Z=e=>{if(!H())return!1;let t=B.get(e);t?B.delete(e):t=I(window.matchMedia(e),()=>q.tick++),B.set(e,t);for(const[n,i]of B){if(B.size<=64)break;i.off(),B.delete(n)}return t.mql.matches},F=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(C.test(e))return Number(e);const t=void 0===D[e]?M[e]:void 0;return void 0!==t?"base"===t?0:D[t]:D[e]},G=e=>{if(e<=0)return!0;const t=z.findIndex(t=>"base"!==t&&D[t]===e);return-1!==t?z.indexOf(q.bp)>=t:(q.tick,Z(`(min-width: ${e}px)`))},Q=new Set,U=(e,t)=>{if(K(),!e||"object"!=typeof e)return t;let n,i=-1;for(const r of Object.keys(e)){const t=F(r);void 0!==t?t>=i&&G(t)&&(i=t,n=e[r]):(z.join(", "),Object.keys(M).join(", "))}return void 0!==n?n:t},X=e=>{const t=M[e],n=D[t];return void 0!==n?n:N[t]},Y=Object.defineProperties((e,t)=>U(e,t),{props:{value:e=>{K();const t={};for(const n of Object.keys(e))t[n]=U(e[n]);return t}},breakpoint:{get:()=>(K(),q.bp),enumerable:!0},device:{get:()=>(K(),G(X("tablet"))?G(X("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{K();const t=F(e);return void 0!==t&&G(t)}},match:{value:e=>(K(),Z(e))},configure:{value:({breakpoints:e})=>{e&&(D={...e},R&&(W(),q.tick++))}}}),ee=()=>{V.forEach(e=>e.off()),B.forEach(e=>e.off()),V=[],B.clear(),R=!1};return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const r=e;let o=250;for(const u in i||{}){const e=/^duration-(\d+)$/.exec(u);e&&(o=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>r.style[e]);let c;r.style.overflow="hidden";let l=0;const d=new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t();if(e===c)return;const n=++l;var i;i=!e,r.style.visibility=i?"hidden":a[3],null==c?f(()=>{r.style.transition=`height ${o}ms ease, visibility ${o}ms`}):(r.style.height=r.scrollHeight+"px",e?f(()=>{n===l&&(r.style.height="")},o):r.offsetHeight),e||(r.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>r.style[e]=a[t])}})},e.defaultBreakpoints=P,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:i})=>{let r=!0,o=!1;return n(()=>{o!==(o=!!t())&&Promise.resolve().then(()=>{r&&o&&(e.focus(),i?.select&&e.select&&e.select())})}),()=>{r=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let i=!1,r=null;const o=()=>[...e.querySelectorAll("a[href],area[href],button,input:not([type=hidden]),select,textarea,summary,iframe,audio[controls],video[controls],[contenteditable],[tabindex]")].filter(e=>e.tabIndex>=0&&!e.matches(":disabled,[inert] *")&&!1!==e.checkVisibility?.({visibilityProperty:!0})).filter(u),s=t=>{if("Tab"!==t.key||f.at(-1)!==s)return;const n=o();if(!n.length)return void t.preventDefault();const i=n[0],r=n[n.length-1],a=document.activeElement;e.contains(a)?!t.shiftKey||a!==i&&a!==e?t.shiftKey||a!==r||(t.preventDefault(),i.focus()):(t.preventDefault(),r.focus()):(t.preventDefault(),i.focus())},a=()=>{i=!1,f.splice(f.indexOf(s),1),document.removeEventListener("keydown",s,!0),r&&r.focus&&r.focus()};return n(()=>{const n=!!t();n&&!i?(i=!0,r=document.activeElement,f.push(s),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{i&&(o()[0]||e).focus()})):!n&&i&&a()}),()=>{i&&a()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{let i=!1;const r=new IntersectionObserver(e=>{for(const o of e){const e=n?.full?o.intersectionRatio>=1:o.isIntersecting,s=n?.leave?i&&!e:e&&!i;i=e,s&&(t(),n?.once&&r.disconnect())}},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const r=e,o=e=>{const{value:o,selectionStart:s}=r,a=i(o,t,!e?.inputType?.startsWith("del"));if(a===o)return!1;if(r.value=a,null!=s&&document.activeElement===r){let e=i(o.slice(0,s),t).length;for(;e<a.length&&!n[t[e]];)e++;r.setSelectionRange(e,e)}return!0};e.addEventListener("input",o),o();let s=!0;return Promise.resolve().then(()=>{s&&o()&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{s=!1,e.removeEventListener("input",o)}})},e.media=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&Y.configure(t),e.scope.$mq=Y,e.scope.$mqProps=Y.props,e.scope.$mqAtLeast=Y.atLeast,e.scope.$mqMatch=Y.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>Y.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>Y.device,enumerable:!0,configurable:!0}),()=>{ee(),q.tick++}),e.morph=$,e.morphPlugin=e=>{e.scope.$morph=$},e.mq=Y,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:i,modifiers:r,effect:o})=>{const a=s+(n||t.id);let c=r?void 0:l();for(const s in r)if(c=l(s))break;const f=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;d(e.scope,a,f,c,o)})},e.persistStore=(e,n={})=>{const i=(0,t.store)(e);if(!i)return()=>{};const r=l(n.storage);return d(i,s+(n.key??e),n.keys,r,t.watchEffect)},e.registerStorage=(e,t)=>{a[e]=t},e.resetMedia=()=>{ee(),D={...N},z=["base",...Object.keys(D).sort((e,t)=>D[e]-D[t])],R=!1,Q.clear(),q.bp="base",q.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:i})=>{const r=t(`(($width, $height) => { ${n} })`);if(i?.window||i?.visual){const e=i.visual&&window.visualViewport||window,t=()=>r(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:r,exp:s})=>{const a=e,c=i||"v",l=e=>`${c}-${e}`;let d,f=0;const u=()=>{a.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},m=(e,t)=>{const n=++f;u(),a.classList.add(l(e+"-from"),l(e+"-active")),a.offsetWidth,a.classList.remove(l(e+"-from")),a.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(a))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&m("enter")}),a.__leave=()=>(e=!1,new Promise(e=>m("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete a.__leave}}const p="none"==a.style.display?"":a.style.display;let v;return n(()=>{const e=!!t();if(e===v)return;const n=null!=v;v=e,e?(a.style.display=p,(n||r?.appear)&&m("enter")):n?m("leave",()=>{a.style.display="none"}):a.style.display="none"}),()=>{clearTimeout(d),u()}})},e}({},LiteVue);
|
|
1
|
+
var LiteVuePlugins=function(e,t){var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=(e,t,i)=>{let r="",o="",s=0;for(let a=0;a<t.length;a++){const i=n[t[a]];if(i){for(;s<e.length&&!i.test(e[s]);)s++;if(s>=e.length)return r;r+=o+e[s++],o=""}else o+=t[a],e[s]===t[a]&&s++}return i?r+o:r},r=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),o=(e,t)=>{const n=e.split(","),i=t.split(",");let o=0;for(let s=0;s<n.length;s++)o=Math.max(o,r(n[s])+r(i[s%i.length]));return o},s="litevue:",a=Object.create(null),c="local",l=e=>{const t=e??c;return"string"!=typeof t?t:a[t.toLowerCase()]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},d=(e,t,n,i,r)=>{if(!i)return r(()=>{});const o=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const i=n&&n.value;return(!i||!0!==i.__v_isRef||!0!==i.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(i.getItem(t)||"null");if(n)for(const t of o)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return r(()=>{const n={};for(const t of o)n[t]=e[t];try{i.setItem(t,JSON.stringify(n))}catch{}})},f=[],u=(e,t,n)=>"radio"!==e.type||!e.name||e===(n.find(t=>"radio"===t.type&&t.name===e.name&&t.checked)||n.find(t=>"radio"===t.type&&t.name===e.name)),p=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||e.__marker||!!t.preserve?.(e)),m="[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]",h=/^(?:v-|:|@)/,v=/^(?::|v-bind:)/,b=/^v-(?!scope|on:)/,g=["id","data-key","data-id"],y=e=>{for(const t of g){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},w=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},k=e=>e.__ctx||[...e.children||[]].map(k).find(Boolean),x=(e,t)=>(t||k(e))?.dispose?.(e),E=e=>{const t=new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)if(v.test(n)){const e=n.replace(v,"").split(".")[0];t.add(/\.camel\b/.test(n)?e.replace(/-(\w)/g,(e,t)=>t.toUpperCase()):e)}else/^v-model\b/.test(n)?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):b.test(n)&&(t.add("style"),"v-popover"==n&&t.add("popover"));return t},S=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),_=["Value","Checked","Selected"],A=(e,t,n)=>{const i=E(t);e.__anchor&&i.add("style");for(const o of e.constructor.morphOwnedAttributes||[])i.add(o);n&&((e,t,n)=>{const i=E(t.closest("select")||t);if(!(n.has("*")||i.has("*")||i.has("value")||"output"==e.type||"textarea"==e.type&&t.value.includes("{{")))for(const r of _){const i=r.toLowerCase(),o="default"+r,s="Selected"==r?o:i;!n.has(i)&&o in e&&e[i]!==t[s]&&(e[i]=t[s])}})(e,t,i);const r=Object(e.__bound);for(const{name:o,value:s}of t.attributes)h.test(o)||i.has(o)||o in r||e.getAttribute(o)!==s&&e.setAttribute(o,s);for(const{name:o}of[...e.attributes])i.has("*")||i.has(o)||t.hasAttribute(o)||e.removeAttribute(o)},L=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return N(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n)&&"SCRIPT"!=e.parentNode?.nodeName)return;return e.data?void(e.data!==r&&(e.data=r)):N(e,t,n,i)}if(1!==e.nodeType)return;const r=e,o=t;if(r.tagName!==o.tagName)return N(e,t,n,i);if(!i.skip?.(r,o)&&!r.hasAttribute("data-morph-skip")){if(r.matches(m))return r.isEqualNode(o)?void 0:N(e,t,n,i);A(r,o,i.values),"TEMPLATE"!=r.tagName||r.content.isEqualNode(o.content)||(r.innerHTML=o.innerHTML),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||S(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(S(t))return!0;return!1})(o)||Object.getOwnPropertyDescriptor(Object(r.__ctx?.scope),"$template")||T(r,o,r.__ctx||n,i)}},N=(e,t,n,i)=>{if(p(e,i))return;const r=t.cloneNode(!0);return!1!==i.beforeNodeAdded?.(r)?(x(e,n),e.parentNode.replaceChild(r,e),i.afterNodeRemoved?.(e),O(r,n),r):void 0},O=(e,t)=>{if(e.parentElement?.closest(m))return;const n=t||w(e.parentNode);n?.walk?.(e,n)},T=(e,t,n,i)=>{const r=i.key||y,o=new Map;for(let u=e.firstChild;u;u=u.nextSibling)if(1===u.nodeType){const e=r(u);if(null==e)continue;o.set(e,u)}const s=e=>e&&1===e.nodeType?r(e):null,a=new Set;for(let u=t.firstChild;u;u=u.nextSibling)a.add(s(u));const c=t=>{p(t,i)||(x(t,n),e.removeChild(t),i.afterNodeRemoved?.(t))};let l=e.firstChild,d=t.firstChild;const f=t=>{const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(e.insertBefore(r,l),O(r,n))};for(;d;){const t=d.nextSibling,r=s(d);if(""===l?.data&&d.hasAttribute?.("v-teleport"))l=l.nextSibling;else if(null!=r){const t=o.get(r);t?(t===l?l=l.nextSibling:e.insertBefore(t,l),o.delete(r),L(t,d,n,i)):f(d)}else if(l&&(null==s(l)||!a.has(s(l))&&l.tagName===d.tagName)){if(p(l,i)&&!p(d,i)){l=l.nextSibling;continue}const e=l.nextSibling;L(l,d,n,i),l=e}else{if(l&&!a.has(s(l))){const e=l.nextSibling;c(l),l=e;continue}f(d)}d=t}for(;l;){const e=l.nextSibling;c(l),l=e}},$=(e,t,n={})=>{let i;if("string"==typeof t){const n=document.createElement("template"),r=e instanceof SVGElement;n.innerHTML=r?`<svg>${t.trim()}</svg>`:t.trim();const o=r?n.content.firstChild:n.content;i=1===o.childNodes.length&&o.firstElementChild?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.append(...o.childNodes),t})()}else i=t;if(i){const t=()=>{const t=C();e=L(e,i,w(e.parentNode),n)||e,t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},C=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,i=null;try{n=t.selectionStart,i=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,i)}catch{}}},P={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j=Object.freeze({...P}),q={mobile:"base",tablet:"md",desktop:"lg"},M=/^\d+$/,D=(0,t.reactive)({bp:"base",tick:0}),R={...P},z=["base"],I=!1,V=[],B=new Map,H=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,W=(e,t)=>(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}),K=()=>{for(let e=V.length-1;e>=0;e--)if(V[e].mql.matches)return z[e+1];return"base"},J=()=>{V.forEach(e=>e.off()),V=[];const e=Object.keys(R).filter(e=>R[e]>0).sort((e,t)=>R[e]-R[t]);z=["base",...e],H()&&(V=e.map(e=>{const t=window.matchMedia(`(min-width: ${R[e]}px)`);return W(t,()=>{D.bp=K()})}),D.bp=K())},Z=()=>{I||(I=!0,J()),D.tick},F=e=>{if(!H())return!1;let t=B.get(e);t?B.delete(e):t=W(window.matchMedia(e),()=>D.tick++),B.set(e,t);for(const[n,i]of B){if(B.size<=64)break;i.off(),B.delete(n)}return t.mql.matches},G=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(M.test(e))return Number(e);const t=void 0===R[e]?q[e]:void 0;return void 0!==t?"base"===t?0:R[t]:R[e]},U=e=>{if(e<=0)return!0;const t=z.findIndex(t=>"base"!==t&&R[t]===e);return-1!==t?z.indexOf(D.bp)>=t:(D.tick,F(`(min-width: ${e}px)`))},Q=(e,t)=>{if(Z(),!e||"object"!=typeof e)return t;let n,i=-1;for(const r of Object.keys(e)){const t=G(r);void 0!==t&&(t>=i&&U(t)&&(i=t,n=e[r]))}return void 0!==n?n:t},X=e=>{const t=q[e],n=R[t];return void 0!==n?n:P[t]},Y=(e,t)=>Q(e,t),ee=Object.defineProperties(Y,{props:{value:e=>{Z();const t={};for(const n of Object.keys(e))t[n]=Q(e[n]);return t}},breakpoint:{get:()=>(Z(),D.bp),enumerable:!0},device:{get:()=>(Z(),U(X("tablet"))?U(X("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{Z();const t=G(e);return void 0!==t&&U(t)}},match:{value:e=>(Z(),F(e))},configure:{value:({breakpoints:e})=>{e&&(R={...e},I&&(J(),D.tick++))}}}),te=()=>{V.forEach(e=>e.off()),B.forEach(e=>e.off()),V=[],B.clear(),I=!1};return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const r=e;let o=250;for(const u in i||{}){const e=/^duration-(\d+)$/.exec(u);e&&(o=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>r.style[e]);let c,l=0;const d=new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t();if(e===c)return;const n=++l;var i;i=!e,r.style.visibility=i?"hidden":a[3],r.style.overflow=e&&null==c?a[0]:"hidden",null==c?f(()=>{r.style.transition=`height ${o}ms ease, visibility ${o}ms`}):(r.style.height=a[1]||r.scrollHeight+"px",e?f(()=>{n===l&&(r.style.height=a[1],r.style.overflow=a[0])},o):r.offsetHeight),e||(r.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>r.style[e]=a[t])}})},e.defaultBreakpoints=j,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:i})=>{let r=!0,o=!1;return n(()=>{o!==(o=!!t())&&Promise.resolve().then(()=>{r&&o&&(e.focus(),i?.select&&e.select&&e.select())})}),()=>{r=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let i=!1,r=null;const o=()=>[...e.querySelectorAll("a[href],area[href],button,input:not([type=hidden]),select,textarea,summary,iframe,audio[controls],video[controls],[contenteditable],[tabindex]")].filter(e=>e.tabIndex>=0&&!e.matches(":disabled,[inert],[inert] *")&&!1!==e.checkVisibility?.({visibilityProperty:!0})).filter(u),s=t=>{if("Tab"!==t.key||f.at(-1)!==e)return;const n=o();if(!n.length)return void t.preventDefault();const i=n[0],r=n[n.length-1],s=document.activeElement;e.contains(s)?(t.shiftKey?i:r).compareDocumentPosition(s)&(t.shiftKey?4:2)||(t.preventDefault(),(t.shiftKey?r:i).focus()):(t.preventDefault(),i.focus())},a=()=>{i=!1,f.splice(f.indexOf(e),1),document.removeEventListener("keydown",s,!0),r&&r.focus&&r.focus()};return n(()=>{const n=!!t();n&&!i?(i=!0,r=document.activeElement,f.splice(f.findIndex(t=>e.contains(t))>>>0,0,e),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{i&&f.at(-1)===e&&(o()[0]||e).focus()})):!n&&i&&a()}),()=>{i&&a()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{let i=!1;const r=new IntersectionObserver(e=>{for(const o of e){const e=n?.full?o.intersectionRatio>=1:o.isIntersecting,s=n?.leave?i&&!e:e&&!i;i=e,s&&(t(),n?.once&&r.disconnect())}},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const r=e,o=e=>{const{value:o,selectionStart:s}=r,a=e?.inputType,c=i(o,t,!a?.startsWith("del"));if(c===o)return!1;if(r.value=c,null!=s&&document.activeElement===r){let e=i(o.slice(0,s),t).length;if(!e||!a?.endsWith("Backward"))for(;e<c.length&&!n[t[e]];)e++;r.setSelectionRange(e,e)}return!0};e.addEventListener("input",o);const s=o();let a=!0;return Promise.resolve().then(()=>{a&&(o()||s)&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{a=!1,e.removeEventListener("input",o)}})},e.media=(e,t)=>(t&&ee.configure(t),e.scope.$mq=ee,e.scope.$mqProps=ee.props,e.scope.$mqAtLeast=ee.atLeast,e.scope.$mqMatch=ee.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>ee.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>ee.device,enumerable:!0,configurable:!0}),()=>{te(),D.tick++}),e.morph=$,e.morphPlugin=e=>{e.scope.$morph=$},e.mq=ee,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:i,modifiers:r,effect:o})=>{const a=s+(n||t.id);let c=r?void 0:l();for(const s in r)if(c=l(s))break;const f=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;d(e.scope,a,f,c,o)})},e.persistStore=(e,n={})=>{const i=(0,t.store)(e);if(!i)return()=>{};const r=l(n.storage);return d(i,s+(n.key??e),n.keys,r,t.watchEffect)},e.registerStorage=(e,t)=>{a[e.toLowerCase()]=t},e.resetMedia=()=>{te(),R={...P},z=["base",...Object.keys(R).sort((e,t)=>R[e]-R[t])],I=!1,D.bp="base",D.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:i})=>{const r=t(`(($width, $height) => { ${n} })`);if(i?.window||i?.visual){const e=i.visual&&window.visualViewport||window,t=()=>r(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:r,exp:s})=>{const a=e,c=i||"v",l=e=>`${c}-${e}`;let d,f=0;const u=()=>{a.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++f;u(),a.classList.add(l(e+"-from"),l(e+"-active")),a.offsetWidth,a.classList.remove(l(e+"-from")),a.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(o(t.transitionDuration,t.transitionDelay),o(t.animationDuration,t.animationDelay))})(a))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),a.__leave=()=>(e=!1,new Promise(e=>p("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete a.__leave}}const m="none"==a.style.display?"":a.style.display;let h;return n(()=>{const e=!!t();if(e===h)return;const n=null!=h;h=e,e?(a.style.display=m,(n||r?.appear)&&p("enter")):n?p("leave",()=>{a.style.display="none"}):a.style.display="none"}),()=>{clearTimeout(d),u(),!1===h&&(a.style.display="none")}})},e}({},LiteVue);
|
package/dist/litevue-plugins.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as e,store as t,watchEffect as n}from"@aevantec/litevue";var i=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{let i=!1;const r=new IntersectionObserver(e=>{for(const o of e){const e=n?.full?o.intersectionRatio>=1:o.isIntersecting,s=n?.leave?i&&!e:e&&!i;i=e,s&&(t(),n?.once&&r.disconnect())}},{threshold:n?.full?1:0});return r.observe(e),()=>r.disconnect()})},r={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},o=(e,t,n)=>{let i="",o="",s=0;for(let a=0;a<t.length;a++){const n=r[t[a]];if(n){for(;s<e.length&&!n.test(e[s]);)s++;if(s>=e.length)return i;i+=o+e[s++],o=""}else o+=t[a],e[s]===t[a]&&s++}return n?i+o:i},s=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,i=e=>{const{value:i,selectionStart:s}=n,a=o(i,t,!e?.inputType?.startsWith("del"));if(a===i)return!1;if(n.value=a,null!=s&&document.activeElement===n){let e=o(i.slice(0,s),t).length;for(;e<a.length&&!r[t[e]];)e++;n.setSelectionRange(e,e)}return!0};e.addEventListener("input",i),i();let s=!0;return Promise.resolve().then(()=>{s&&i()&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{s=!1,e.removeEventListener("input",i)}})},a=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),c=(e,t)=>{const n=e.split(","),i=t.split(",");let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,a(n[o])+a(i[o%i.length]));return r},l=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:r,exp:o})=>{const s=e,a=i||"v",l=e=>`${a}-${e}`;let d,f=0;const u=()=>{s.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},m=(e,t)=>{const n=++f;u(),s.classList.add(l(e+"-from"),l(e+"-active")),s.offsetWidth,s.classList.remove(l(e+"-from")),s.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(c(t.transitionDuration,t.transitionDelay),c(t.animationDuration,t.animationDelay))})(s))};if(!o){let e=!0;return Promise.resolve().then(()=>{e&&m("enter")}),s.__leave=()=>(e=!1,new Promise(e=>m("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete s.__leave}}const p="none"==s.style.display?"":s.style.display;let v;return n(()=>{const e=!!t();if(e===v)return;const n=null!=v;v=e,e?(s.style.display=p,(n||r?.appear)&&m("enter")):n?m("leave",()=>{s.style.display="none"}):s.style.display="none"}),()=>{clearTimeout(d),u()}})},d="litevue:",f=Object.create(null),u="local",m=e=>{const t=e??u;return"string"!=typeof t?t:f[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},p=(e,t)=>{f[e]=t},v=e=>{u=e},h=(e,t,n,i,r)=>{if(!i)return r(()=>{});const o=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const i=n&&n.value;return(!i||!0!==i.__v_isRef||!0!==i.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(i.getItem(t)||"null");if(n)for(const t of o)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return r(()=>{const n={};for(const t of o)n[t]=e[t];try{i.setItem(t,JSON.stringify(n))}catch{}})},b=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:i,modifiers:r,effect:o})=>{const s=d+(n||t.id);let a=r?void 0:m();for(const l in r)if(a=m(l))break;const c=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;h(e.scope,s,c,a,o)})},y=(e,i={})=>{const r=t(e);if(!r)return()=>{};const o=m(i.storage);return h(r,d+(i.key??e),i.keys,o,n)},g=[],k=(e,t,n)=>"radio"!==e.type||!e.name||e===(n.find(t=>"radio"===t.type&&t.name===e.name&&t.checked)||n.find(t=>"radio"===t.type&&t.name===e.name)),w=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:i})=>{let r=!0,o=!1;return n(()=>{o!==(o=!!t())&&Promise.resolve().then(()=>{r&&o&&(e.focus(),i?.select&&e.select&&e.select())})}),()=>{r=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let i=!1,r=null;const o=()=>[...e.querySelectorAll("a[href],area[href],button,input:not([type=hidden]),select,textarea,summary,iframe,audio[controls],video[controls],[contenteditable],[tabindex]")].filter(e=>e.tabIndex>=0&&!e.matches(":disabled,[inert] *")&&!1!==e.checkVisibility?.({visibilityProperty:!0})).filter(k),s=t=>{if("Tab"!==t.key||g.at(-1)!==s)return;const n=o();if(!n.length)return void t.preventDefault();const i=n[0],r=n[n.length-1],a=document.activeElement;e.contains(a)?!t.shiftKey||a!==i&&a!==e?t.shiftKey||a!==r||(t.preventDefault(),i.focus()):(t.preventDefault(),r.focus()):(t.preventDefault(),i.focus())},a=()=>{i=!1,g.splice(g.indexOf(s),1),document.removeEventListener("keydown",s,!0),r&&r.focus&&r.focus()};return n(()=>{const n=!!t();n&&!i?(i=!0,r=document.activeElement,g.push(s),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{i&&(o()[0]||e).focus()})):!n&&i&&a()}),()=>{i&&a()}})},x=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const r=e;let o=250;for(const u in i||{}){const e=/^duration-(\d+)$/.exec(u);e&&(o=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>r.style[e]);let c;r.style.overflow="hidden";let l=0;const d=/* @__PURE__ */new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t();if(e===c)return;const n=++l;var i;i=!e,r.style.visibility=i?"hidden":a[3],null==c?f(()=>{r.style.transition=`height ${o}ms ease, visibility ${o}ms`}):(r.style.height=r.scrollHeight+"px",e?f(()=>{n===l&&(r.style.height="")},o):r.offsetHeight),e||(r.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>r.style[e]=a[t])}})},E=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||e.__marker||!!t.preserve?.(e)),S=/^(?:v-|:|@)/,_=/^(?::|v-bind:)/,A=/^v-(?!scope|on:)/,L=["id","data-key","data-id"],T=e=>{for(const t of L){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},O=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},$=e=>e.__ctx||[...e.children||[]].map($).find(Boolean),N=(e,t)=>(t||$(e))?.dispose?.(e),j=e=>{const t=/* @__PURE__ */new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)_.test(n)?t.add(n.replace(_,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):A.test(n)&&t.add("style");return t},C=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),P=["Value","Checked","Selected"],M=(e,t,n)=>{const i=j(t);n&&((e,t,n)=>{const i=j(t.closest("select")||t);if(!(n.has("*")||i.has("*")||i.has("value")))for(const r of P){const i=r.toLowerCase(),o="default"+r;!n.has(i)&&o in e&&e[i]!==t[o]&&(e[i]=t[o])}})(e,t,i);const r=Object(e.__bound);for(const{name:o,value:s}of t.attributes)S.test(o)||i.has(o)||o in r||e.getAttribute(o)!==s&&e.setAttribute(o,s);for(const{name:o}of[...e.attributes])i.has("*")||i.has(o)||t.hasAttribute(o)||e.removeAttribute(o)},q=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return D(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return e.data?void(e.data!==r&&(e.data=r)):D(e,t,n,i)}if(1!==e.nodeType)return;const r=e,o=t;if(r.tagName!==o.tagName)return D(e,t,n,i);i.skip?.(r,o)||r.hasAttribute("data-morph-skip")||(M(r,o,i.values),"TEMPLATE"==r.tagName&&(r.innerHTML=o.innerHTML),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||C(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(C(t))return!0;return!1})(o)||r.__ctx?.scope.$template||z(r,o,r.__ctx||n,i))},D=(e,t,n,i)=>{if(E(e,i))return;const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(N(e,n),e.parentNode.replaceChild(r,e),i.afterNodeRemoved?.(e),R(r,n))},R=(e,t)=>{if(e.parentElement?.closest("[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]"))return;const n=t||O(e.parentNode);n?.walk?.(e,n)},z=(e,t,n,i)=>{const r=i.key||T,o=/* @__PURE__ */new Map;for(let d=e.firstChild;d;d=d.nextSibling)if(1===d.nodeType){const e=r(d);if(null==e)continue;o.set(e,d)}const s=e=>e&&1===e.nodeType?r(e):null;let a=e.firstChild,c=t.firstChild;const l=t=>{const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(e.insertBefore(r,a),R(r,n))};for(;c;){const t=c.nextSibling,r=s(c);if(""===a?.data&&c.hasAttribute?.("v-teleport"))a=a.nextSibling;else if(null!=r){const t=o.get(r);t?(t===a?a=a.nextSibling:e.insertBefore(t,a),o.delete(r),q(t,c,n,i)):l(c)}else if(a&&null==s(a)){if(E(a,i)&&!E(c,i)){a=a.nextSibling;continue}const e=a.nextSibling;q(a,c,n,i),a=e}else l(c);c=t}for(;a;){const t=a.nextSibling;E(a,i)||(N(a,n),e.removeChild(a),i.afterNodeRemoved?.(a)),a=t}},H=(e,t,n={})=>{let i;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const r=n.content;i=1===r.childNodes.length&&r.firstElementChild?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(r),t})()}else i=t;if(i){const t=()=>{const t=I();q(e,i,O(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},I=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,i=null;try{n=t.selectionStart,i=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,i)}catch{}}},B=e=>{e.scope.$morph=H},V={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},J=Object.freeze({...V}),W={mobile:"base",tablet:"md",desktop:"lg"},K=/^\d+$/,Z=e({bp:"base",tick:0}),F={...V},G=["base"],Q=!1,U=[],X=/* @__PURE__ */new Map,Y=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,ee=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),te=()=>{for(let e=U.length-1;e>=0;e--)if(U[e].mql.matches)return G[e+1];return"base"},ne=()=>{U.forEach(e=>e.off()),U=[];const e=Object.keys(F).filter(e=>F[e]>0).sort((e,t)=>F[e]-F[t]);G=["base",...e],Y()&&(U=e.map(e=>{const t=window.matchMedia(`(min-width: ${F[e]}px)`);return ee(t,()=>{Z.bp=te()})}),Z.bp=te())},ie=()=>{Q||(Q=!0,ne()),Z.tick},re=e=>{if(!Y())return!1;let t=X.get(e);t?X.delete(e):t=ee(window.matchMedia(e),()=>Z.tick++),X.set(e,t);for(const[n,i]of X){if(X.size<=64)break;i.off(),X.delete(n)}return t.mql.matches},oe=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(K.test(e))return Number(e);const t=void 0===F[e]?W[e]:void 0;return void 0!==t?"base"===t?0:F[t]:F[e]},se=e=>{if(e<=0)return!0;const t=G.findIndex(t=>"base"!==t&&F[t]===e);return-1!==t?G.indexOf(Z.bp)>=t:(Z.tick,re(`(min-width: ${e}px)`))},ae=/* @__PURE__ */new Set,ce=(e,t)=>{if(ie(),!e||"object"!=typeof e)return t;let n,i=-1;for(const r of Object.keys(e)){const t=oe(r);void 0!==t?t>=i&&se(t)&&(i=t,n=e[r]):(G.join(", "),Object.keys(W).join(", "))}return void 0!==n?n:t},le=e=>{const t=W[e],n=F[t];return void 0!==n?n:V[t]},de=Object.defineProperties((e,t)=>ce(e,t),{props:{value:e=>{ie();const t={};for(const n of Object.keys(e))t[n]=ce(e[n]);return t}},breakpoint:{get:()=>(ie(),Z.bp),enumerable:!0},device:{get:()=>(ie(),se(le("tablet"))?se(le("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{ie();const t=oe(e);return void 0!==t&&se(t)}},match:{value:e=>(ie(),re(e))},configure:{value:({breakpoints:e})=>{e&&(F={...e},Q&&(ne(),Z.tick++))}}}),fe=()=>{U.forEach(e=>e.off()),X.forEach(e=>e.off()),U=[],X.clear(),Q=!1},ue=()=>{fe(),F={...V},G=["base",...Object.keys(F).sort((e,t)=>F[e]-F[t])],Q=!1,ae.clear(),Z.bp="base",Z.tick=0},me=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&de.configure(t),e.scope.$mq=de,e.scope.$mqProps=de.props,e.scope.$mqAtLeast=de.atLeast,e.scope.$mqMatch=de.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>de.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>de.device,enumerable:!0,configurable:!0}),()=>{fe(),Z.tick++}),pe=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:i})=>{const r=t(`(($width, $height) => { ${n} })`);if(i?.window||i?.visual){const e=i.visual&&window.visualViewport||window,t=()=>r(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const o=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return o.observe(e),()=>o.disconnect()})};export{x as collapse,J as defaultBreakpoints,w as focus,i as intersect,s as mask,me as media,H as morph,B as morphPlugin,de as mq,b as persist,y as persistStore,p as registerStorage,ue as resetMedia,pe as resize,v as setDefaultStorage,l as transition};
|
|
1
|
+
import{reactive as e,store as t,watchEffect as n}from"@aevantec/litevue";var o=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{let o=!1;const i=new IntersectionObserver(e=>{for(const r of e){const e=n?.full?r.intersectionRatio>=1:r.isIntersecting,s=n?.leave?o&&!e:e&&!o;o=e,s&&(t(),n?.once&&i.disconnect())}},{threshold:n?.full?1:0});return i.observe(e),()=>i.disconnect()})},i={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},r=(e,t,n)=>{let o="",r="",s=0;for(let a=0;a<t.length;a++){const n=i[t[a]];if(n){for(;s<e.length&&!n.test(e[s]);)s++;if(s>=e.length)return o;o+=r+e[s++],r=""}else r+=t[a],e[s]===t[a]&&s++}return n?o+r:o},s=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,o=e=>{const{value:o,selectionStart:s}=n,a=e?.inputType,c=r(o,t,!a?.startsWith("del"));if(c===o)return!1;if(n.value=c,null!=s&&document.activeElement===n){let e=r(o.slice(0,s),t).length;if(!e||!a?.endsWith("Backward"))for(;e<c.length&&!i[t[e]];)e++;n.setSelectionRange(e,e)}return!0};e.addEventListener("input",o);const s=o();let a=!0;return Promise.resolve().then(()=>{a&&(o()||s)&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{a=!1,e.removeEventListener("input",o)}})},a=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),c=(e,t)=>{const n=e.split(","),o=t.split(",");let i=0;for(let r=0;r<n.length;r++)i=Math.max(i,a(n[r])+a(o[r%o.length]));return i},l=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:o,modifiers:i,exp:r})=>{const s=e,a=o||"v",l=e=>`${a}-${e}`;let d,f=0;const u=()=>{s.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++f;u(),s.classList.add(l(e+"-from"),l(e+"-active")),s.offsetWidth,s.classList.remove(l(e+"-from")),s.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(c(t.transitionDuration,t.transitionDelay),c(t.animationDuration,t.animationDelay))})(s))};if(!r){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),s.__leave=()=>(e=!1,new Promise(e=>p("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete s.__leave}}const m="none"==s.style.display?"":s.style.display;let v;return n(()=>{const e=!!t();if(e===v)return;const n=null!=v;v=e,e?(s.style.display=m,(n||i?.appear)&&p("enter")):n?p("leave",()=>{s.style.display="none"}):s.style.display="none"}),()=>{clearTimeout(d),u(),!1===v&&(s.style.display="none")}})},d="litevue:",f=Object.create(null),u="local",p=e=>{const t=e??u;return"string"!=typeof t?t:f[t.toLowerCase()]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},m=(e,t)=>{f[e.toLowerCase()]=t},v=e=>{u=e},h=(e,t,n,o,i)=>{if(!o)return i(()=>{});const r=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const o=n&&n.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(o.getItem(t)||"null");if(n)for(const t of r)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return i(()=>{const n={};for(const t of r)n[t]=e[t];try{o.setItem(t,JSON.stringify(n))}catch{}})},b=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:o,modifiers:i,effect:r})=>{const s=d+(n||t.id);let a=i?void 0:p();for(const l in i)if(a=p(l))break;const c=o?o.split(",").map(e=>e.trim()).filter(Boolean):void 0;h(e.scope,s,c,a,r)})},y=(e,o={})=>{const i=t(e);if(!i)return()=>{};const r=p(o.storage);return h(i,d+(o.key??e),o.keys,r,n)},g=[],w=(e,t,n)=>"radio"!==e.type||!e.name||e===(n.find(t=>"radio"===t.type&&t.name===e.name&&t.checked)||n.find(t=>"radio"===t.type&&t.name===e.name)),x=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:o})=>{let i=!0,r=!1;return n(()=>{r!==(r=!!t())&&Promise.resolve().then(()=>{i&&r&&(e.focus(),o?.select&&e.select&&e.select())})}),()=>{i=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let o=!1,i=null;const r=()=>[...e.querySelectorAll("a[href],area[href],button,input:not([type=hidden]),select,textarea,summary,iframe,audio[controls],video[controls],[contenteditable],[tabindex]")].filter(e=>e.tabIndex>=0&&!e.matches(":disabled,[inert],[inert] *")&&!1!==e.checkVisibility?.({visibilityProperty:!0})).filter(w),s=t=>{if("Tab"!==t.key||g.at(-1)!==e)return;const n=r();if(!n.length)return void t.preventDefault();const o=n[0],i=n[n.length-1],s=document.activeElement;e.contains(s)?(t.shiftKey?o:i).compareDocumentPosition(s)&(t.shiftKey?4:2)||(t.preventDefault(),(t.shiftKey?i:o).focus()):(t.preventDefault(),o.focus())},a=()=>{o=!1,g.splice(g.indexOf(e),1),document.removeEventListener("keydown",s,!0),i&&i.focus&&i.focus()};return n(()=>{const n=!!t();n&&!o?(o=!0,i=document.activeElement,g.splice(g.findIndex(t=>e.contains(t))>>>0,0,e),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{o&&g.at(-1)===e&&(r()[0]||e).focus()})):!n&&o&&a()}),()=>{o&&a()}})},k=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:o})=>{const i=e;let r=250;for(const u in o||{}){const e=/^duration-(\d+)$/.exec(u);e&&(r=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>i.style[e]);let c,l=0;const d=/* @__PURE__ */new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t();if(e===c)return;const n=++l;var o;o=!e,i.style.visibility=o?"hidden":a[3],i.style.overflow=e&&null==c?a[0]:"hidden",null==c?f(()=>{i.style.transition=`height ${r}ms ease, visibility ${r}ms`}):(i.style.height=a[1]||i.scrollHeight+"px",e?f(()=>{n===l&&(i.style.height=a[1],i.style.overflow=a[0])},r):i.offsetHeight),e||(i.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>i.style[e]=a[t])}})},E=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||e.__marker||!!t.preserve?.(e)),S="[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]",_=/^(?:v-|:|@)/,A=/^(?::|v-bind:)/,N=/^v-(?!scope|on:)/,O=["id","data-key","data-id"],T=e=>{for(const t of O){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},L=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},$=e=>e.__ctx||[...e.children||[]].map($).find(Boolean),C=(e,t)=>(t||$(e))?.dispose?.(e),P=e=>{const t=/* @__PURE__ */new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)if(A.test(n)){const e=n.replace(A,"").split(".")[0];t.add(/\.camel\b/.test(n)?e.replace(/-(\w)/g,(e,t)=>t.toUpperCase()):e)}else/^v-model\b/.test(n)?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):N.test(n)&&(t.add("style"),"v-popover"==n&&t.add("popover"));return t},j=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),q=["Value","Checked","Selected"],M=(e,t,n)=>{const o=P(t);e.__anchor&&o.add("style");for(const r of e.constructor.morphOwnedAttributes||[])o.add(r);n&&((e,t,n)=>{const o=P(t.closest("select")||t);if(!(n.has("*")||o.has("*")||o.has("value")||"output"==e.type||"textarea"==e.type&&t.value.includes("{{")))for(const i of q){const o=i.toLowerCase(),r="default"+i,s="Selected"==i?r:o;!n.has(o)&&r in e&&e[o]!==t[s]&&(e[o]=t[s])}})(e,t,o);const i=Object(e.__bound);for(const{name:r,value:s}of t.attributes)_.test(r)||o.has(r)||r in i||e.getAttribute(r)!==s&&e.setAttribute(r,s);for(const{name:r}of[...e.attributes])o.has("*")||o.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},D=(e,t,n,o)=>{if(e.nodeType!==t.nodeType)return R(e,t,n,o);if(3===e.nodeType||8===e.nodeType){const i=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(i,n)&&"SCRIPT"!=e.parentNode?.nodeName)return;return e.data?void(e.data!==i&&(e.data=i)):R(e,t,n,o)}if(1!==e.nodeType)return;const i=e,r=t;if(i.tagName!==r.tagName)return R(e,t,n,o);if(!o.skip?.(i,r)&&!i.hasAttribute("data-morph-skip")){if(i.matches(S))return i.isEqualNode(r)?void 0:R(e,t,n,o);M(i,r,o.values),"TEMPLATE"!=i.tagName||i.content.isEqualNode(r.content)||(i.innerHTML=r.innerHTML),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||j(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(j(t))return!0;return!1})(r)||Object.getOwnPropertyDescriptor(Object(i.__ctx?.scope),"$template")||I(i,r,i.__ctx||n,o)}},R=(e,t,n,o)=>{if(E(e,o))return;const i=t.cloneNode(!0);return!1!==o.beforeNodeAdded?.(i)?(C(e,n),e.parentNode.replaceChild(i,e),o.afterNodeRemoved?.(e),z(i,n),i):void 0},z=(e,t)=>{if(e.parentElement?.closest(S))return;const n=t||L(e.parentNode);n?.walk?.(e,n)},I=(e,t,n,o)=>{const i=o.key||T,r=/* @__PURE__ */new Map;for(let u=e.firstChild;u;u=u.nextSibling)if(1===u.nodeType){const e=i(u);if(null==e)continue;r.set(e,u)}const s=e=>e&&1===e.nodeType?i(e):null,a=/* @__PURE__ */new Set;for(let u=t.firstChild;u;u=u.nextSibling)a.add(s(u));const c=t=>{E(t,o)||(C(t,n),e.removeChild(t),o.afterNodeRemoved?.(t))};let l=e.firstChild,d=t.firstChild;const f=t=>{const i=t.cloneNode(!0);!1!==o.beforeNodeAdded?.(i)&&(e.insertBefore(i,l),z(i,n))};for(;d;){const t=d.nextSibling,i=s(d);if(""===l?.data&&d.hasAttribute?.("v-teleport"))l=l.nextSibling;else if(null!=i){const t=r.get(i);t?(t===l?l=l.nextSibling:e.insertBefore(t,l),r.delete(i),D(t,d,n,o)):f(d)}else if(l&&(null==s(l)||!a.has(s(l))&&l.tagName===d.tagName)){if(E(l,o)&&!E(d,o)){l=l.nextSibling;continue}const e=l.nextSibling;D(l,d,n,o),l=e}else{if(l&&!a.has(s(l))){const e=l.nextSibling;c(l),l=e;continue}f(d)}d=t}for(;l;){const e=l.nextSibling;c(l),l=e}},B=(e,t,n={})=>{let o;if("string"==typeof t){const n=document.createElement("template"),i=e instanceof SVGElement;n.innerHTML=i?`<svg>${t.trim()}</svg>`:t.trim();const r=i?n.content.firstChild:n.content;o=1===r.childNodes.length&&r.firstElementChild?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.append(...r.childNodes),t})()}else o=t;if(o){const t=()=>{const t=H();e=D(e,o,L(e.parentNode),n)||e,t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},H=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,o=null;try{n=t.selectionStart,o=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,o)}catch{}}},V=e=>{e.scope.$morph=B},W={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},K=/* @__PURE__ */Object.freeze({...W}),J={mobile:"base",tablet:"md",desktop:"lg"},Z=/^\d+$/,F=/* @__PURE__ */e({bp:"base",tick:0}),G={...W},U=["base"],Q=!1,X=[],Y=/* @__PURE__ */new Map,ee=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,te=(e,t)=>(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}),ne=()=>{for(let e=X.length-1;e>=0;e--)if(X[e].mql.matches)return U[e+1];return"base"},oe=()=>{X.forEach(e=>e.off()),X=[];const e=Object.keys(G).filter(e=>G[e]>0).sort((e,t)=>G[e]-G[t]);U=["base",...e],ee()&&(X=e.map(e=>{const t=window.matchMedia(`(min-width: ${G[e]}px)`);return te(t,()=>{F.bp=ne()})}),F.bp=ne())},ie=()=>{Q||(Q=!0,oe()),F.tick},re=e=>{if(!ee())return!1;let t=Y.get(e);t?Y.delete(e):t=te(window.matchMedia(e),()=>F.tick++),Y.set(e,t);for(const[n,o]of Y){if(Y.size<=64)break;o.off(),Y.delete(n)}return t.mql.matches},se=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(Z.test(e))return Number(e);const t=void 0===G[e]?J[e]:void 0;return void 0!==t?"base"===t?0:G[t]:G[e]},ae=e=>{if(e<=0)return!0;const t=U.findIndex(t=>"base"!==t&&G[t]===e);return-1!==t?U.indexOf(F.bp)>=t:(F.tick,re(`(min-width: ${e}px)`))},ce=(e,t)=>{if(ie(),!e||"object"!=typeof e)return t;let n,o=-1;for(const i of Object.keys(e)){const t=se(i);void 0!==t&&(t>=o&&ae(t)&&(o=t,n=e[i]))}return void 0!==n?n:t},le=e=>{const t=J[e],n=G[t];return void 0!==n?n:W[t]},de=(e,t)=>ce(e,t),fe=/* @__PURE__ */Object.defineProperties(de,{props:{value:e=>{ie();const t={};for(const n of Object.keys(e))t[n]=ce(e[n]);return t}},breakpoint:{get:()=>(ie(),F.bp),enumerable:!0},device:{get:()=>(ie(),ae(le("tablet"))?ae(le("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{ie();const t=se(e);return void 0!==t&&ae(t)}},match:{value:e=>(ie(),re(e))},configure:{value:({breakpoints:e})=>{e&&(G={...e},Q&&(oe(),F.tick++))}}}),ue=()=>{X.forEach(e=>e.off()),Y.forEach(e=>e.off()),X=[],Y.clear(),Q=!1},pe=()=>{ue(),G={...W},U=["base",...Object.keys(G).sort((e,t)=>G[e]-G[t])],Q=!1,F.bp="base",F.tick=0},me=(e,t)=>(t&&fe.configure(t),e.scope.$mq=fe,e.scope.$mqProps=fe.props,e.scope.$mqAtLeast=fe.atLeast,e.scope.$mqMatch=fe.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>fe.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>fe.device,enumerable:!0,configurable:!0}),()=>{ue(),F.tick++}),ve=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:o})=>{const i=t(`(($width, $height) => { ${n} })`);if(o?.window||o?.visual){const e=o.visual&&window.visualViewport||window,t=()=>i(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const r=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;i(e.width,e.height)}});return r.observe(e),()=>r.disconnect()})};export{k as collapse,K as defaultBreakpoints,x as focus,o as intersect,s as mask,me as media,B as morph,V as morphPlugin,fe as mq,b as persist,y as persistStore,m as registerStorage,pe as resetMedia,ve as resize,v as setDefaultStorage,l as transition};
|