@aevantec/litevue 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -1
- 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 +120 -81
- package/dist/litevue-plugins.dev.mjs +120 -80
- 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 +132 -48
- package/dist/litevue.dev.mjs +132 -47
- 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 +3 -4
- package/dist/plugins/media.dev.mjs +3 -3
- 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 +58 -19
- package/dist/plugins/morph.dev.mjs +58 -18
- 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 +49 -36
- package/dist/plugins/navigate.dev.mjs +49 -35
- 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 +8 -11
- package/dist/plugins/persist.dev.mjs +8 -10
- 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 +3 -1
- package/dist/types/app.d.ts +3 -1
- package/dist/types/context.d.mts +1 -1
- package/dist/types/context.d.ts +1 -1
- package/dist/types/devtools-panel/chrome.d.mts +6 -5
- package/dist/types/devtools-panel/chrome.d.ts +6 -5
- package/dist/types/devtools-panel/menu.d.mts +12 -0
- package/dist/types/devtools-panel/menu.d.ts +12 -0
- package/dist/types/devtools-panel/styles.d.mts +5 -2
- package/dist/types/devtools-panel/styles.d.ts +5 -2
- package/dist/types/devtools-panel/values.d.mts +17 -5
- package/dist/types/devtools-panel/values.d.ts +17 -5
- 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 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/plugins/focus/index.d.mts +1 -1
- package/dist/types/plugins/focus/index.d.ts +1 -1
- package/dist/types/plugins/morph/index.d.mts +6 -0
- package/dist/types/plugins/morph/index.d.ts +6 -0
- package/dist/types/store.d.mts +5 -1
- package/dist/types/store.d.ts +5 -1
- package/package.json +3 -3
|
@@ -33,7 +33,7 @@ var tokens = {
|
|
|
33
33
|
a: /[a-zA-Z]/,
|
|
34
34
|
"*": /[a-zA-Z0-9]/
|
|
35
35
|
};
|
|
36
|
-
var format = (value, mask) => {
|
|
36
|
+
var format = (value, mask, end) => {
|
|
37
37
|
let out = "";
|
|
38
38
|
let literals = "";
|
|
39
39
|
let vi = 0;
|
|
@@ -41,7 +41,7 @@ var format = (value, mask) => {
|
|
|
41
41
|
const re = tokens[mask[mi]];
|
|
42
42
|
if (re) {
|
|
43
43
|
while (vi < value.length && !re.test(value[vi])) vi++;
|
|
44
|
-
if (vi >= value.length)
|
|
44
|
+
if (vi >= value.length) return out;
|
|
45
45
|
out += literals + value[vi++];
|
|
46
46
|
literals = "";
|
|
47
47
|
} else {
|
|
@@ -49,7 +49,7 @@ var format = (value, mask) => {
|
|
|
49
49
|
if (value[vi] === mask[mi]) vi++;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
return out;
|
|
52
|
+
return end ? out + literals : out;
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* v-mask="(999) 999-9999" — formats the input's value as the user types.
|
|
@@ -60,23 +60,27 @@ var format = (value, mask) => {
|
|
|
60
60
|
var mask = (app) => {
|
|
61
61
|
app.directive("mask", ({ el, exp }) => {
|
|
62
62
|
const input = el;
|
|
63
|
-
const apply = () => {
|
|
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)) {
|
|
81
|
+
el.dispatchEvent(new Event("input"));
|
|
82
|
+
el.dispatchEvent(new Event("change"));
|
|
83
|
+
}
|
|
80
84
|
});
|
|
81
85
|
return () => {
|
|
82
86
|
live = false;
|
|
@@ -113,7 +117,6 @@ var transition = (app) => {
|
|
|
113
117
|
const name = arg || "v";
|
|
114
118
|
const cls = (phase) => `${name}-${phase}`;
|
|
115
119
|
let seq = 0;
|
|
116
|
-
let first = true;
|
|
117
120
|
let endTimer;
|
|
118
121
|
const clear = () => {
|
|
119
122
|
elem.classList.remove(cls("enter-from"), cls("enter-active"), cls("enter-to"), cls("leave-from"), cls("leave-active"), cls("leave-to"));
|
|
@@ -138,7 +141,11 @@ var transition = (app) => {
|
|
|
138
141
|
Promise.resolve().then(() => {
|
|
139
142
|
if (live) run("enter");
|
|
140
143
|
});
|
|
141
|
-
elem.__leave = () =>
|
|
144
|
+
elem.__leave = () => {
|
|
145
|
+
live = false;
|
|
146
|
+
elem.__leaving = 1;
|
|
147
|
+
return new Promise((resolve) => run("leave", resolve));
|
|
148
|
+
};
|
|
142
149
|
return () => {
|
|
143
150
|
live = false;
|
|
144
151
|
clearTimeout(endTimer);
|
|
@@ -147,24 +154,24 @@ var transition = (app) => {
|
|
|
147
154
|
};
|
|
148
155
|
}
|
|
149
156
|
const display = elem.style.display == "none" ? "" : elem.style.display;
|
|
157
|
+
let shown;
|
|
150
158
|
effect(() => {
|
|
151
159
|
const show = !!get();
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (show && modifiers?.appear) run("enter");
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
160
|
+
if (show === shown) return;
|
|
161
|
+
const animate = shown != null;
|
|
162
|
+
shown = show;
|
|
158
163
|
if (show) {
|
|
159
164
|
elem.style.display = display;
|
|
160
|
-
run("enter");
|
|
161
|
-
} else run("leave", () => {
|
|
165
|
+
if (animate || modifiers?.appear) run("enter");
|
|
166
|
+
} else if (animate) run("leave", () => {
|
|
162
167
|
elem.style.display = "none";
|
|
163
168
|
});
|
|
169
|
+
else elem.style.display = "none";
|
|
164
170
|
});
|
|
165
171
|
return () => {
|
|
166
172
|
clearTimeout(endTimer);
|
|
167
173
|
clear();
|
|
174
|
+
if (shown === false) elem.style.display = "none";
|
|
168
175
|
};
|
|
169
176
|
});
|
|
170
177
|
};
|
|
@@ -182,7 +189,7 @@ var builtin = (name) => {
|
|
|
182
189
|
var resolve$1 = (storage) => {
|
|
183
190
|
const target = storage ?? defaultStorage;
|
|
184
191
|
if (typeof target !== "string") return target;
|
|
185
|
-
return registry[target] ?? builtin(target);
|
|
192
|
+
return registry[target.toLowerCase()] ?? builtin(target);
|
|
186
193
|
};
|
|
187
194
|
/**
|
|
188
195
|
* Register a custom storage under a name, selectable anywhere — including as a
|
|
@@ -193,7 +200,7 @@ var resolve$1 = (storage) => {
|
|
|
193
200
|
* <div v-persist.memory="scratch">…</div>
|
|
194
201
|
*/
|
|
195
202
|
var registerStorage = (name, storage) => {
|
|
196
|
-
registry[name] = storage;
|
|
203
|
+
registry[name.toLowerCase()] = storage;
|
|
197
204
|
};
|
|
198
205
|
/**
|
|
199
206
|
* Switch the storage used when none is specified. Accepts a registered name
|
|
@@ -224,7 +231,7 @@ var sync = (target, key, keys, storage, run) => {
|
|
|
224
231
|
try {
|
|
225
232
|
const saved = JSON.parse(storage.getItem(key) || "null");
|
|
226
233
|
if (saved) {
|
|
227
|
-
for (const k of fields) if (k
|
|
234
|
+
for (const k of fields) if ({}.hasOwnProperty.call(saved, k)) target[k] = saved[k];
|
|
228
235
|
}
|
|
229
236
|
} catch {}
|
|
230
237
|
return run(() => {
|
|
@@ -252,16 +259,14 @@ var persist = (app) => {
|
|
|
252
259
|
app.directive("persist", ({ ctx, el, exp, arg, modifiers, effect }) => {
|
|
253
260
|
const key = PREFIX + (exp || el.id);
|
|
254
261
|
if (key === PREFIX) console.error(`v-persist needs a key: v-persist="my-key".`);
|
|
255
|
-
let storage;
|
|
256
|
-
for (const name in modifiers
|
|
257
|
-
if (resolve$1(name))
|
|
258
|
-
storage = name;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
262
|
+
let storage = modifiers ? void 0 : resolve$1();
|
|
263
|
+
for (const name in modifiers) {
|
|
264
|
+
if (storage = resolve$1(name)) break;
|
|
261
265
|
console.error(`v-persist: unknown storage ".${name}" — use .local, .session, or a name passed to registerStorage().`);
|
|
262
266
|
}
|
|
263
267
|
const keys = arg ? arg.split(",").map((k) => k.trim()).filter(Boolean) : void 0;
|
|
264
|
-
|
|
268
|
+
for (const k of keys || []) if (!(k in ctx.scope)) console.warn(`v-persist: "${k}" is not in the scope, so it is not persisted. Attribute names are lowercase; list lowercase keys, or use persistStore() with keys.`);
|
|
269
|
+
sync(ctx.scope, key, keys, storage, effect);
|
|
265
270
|
});
|
|
266
271
|
};
|
|
267
272
|
/**
|
|
@@ -292,7 +297,7 @@ var isTabStop = (e, _, all) => e.type !== "radio" || !e.name || e === (all.find(
|
|
|
292
297
|
/**
|
|
293
298
|
* Focus utilities.
|
|
294
299
|
*
|
|
295
|
-
* v-focus="expression" — focuses the element
|
|
300
|
+
* v-focus="expression" — focuses the element when the expression becomes truthy,
|
|
296
301
|
* on mount included, making it an autofocus.
|
|
297
302
|
* - .select also select the text (inputs/textareas)
|
|
298
303
|
*
|
|
@@ -303,8 +308,9 @@ var isTabStop = (e, _, all) => e.type !== "radio" || !e.name || e === (all.find(
|
|
|
303
308
|
var focus = (app) => {
|
|
304
309
|
app.directive("focus", ({ el, get, effect, modifiers }) => {
|
|
305
310
|
let live = true;
|
|
311
|
+
let on = false;
|
|
306
312
|
effect(() => {
|
|
307
|
-
|
|
313
|
+
if (on === (on = !!get())) return;
|
|
308
314
|
Promise.resolve().then(() => {
|
|
309
315
|
if (live && on) {
|
|
310
316
|
el.focus();
|
|
@@ -319,9 +325,9 @@ var focus = (app) => {
|
|
|
319
325
|
app.directive("trap", ({ el, get, effect }) => {
|
|
320
326
|
let active = false;
|
|
321
327
|
let prevFocus = null;
|
|
322
|
-
const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
|
|
328
|
+
const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.tabIndex >= 0 && !e.matches(":disabled,[inert],[inert] *") && e.checkVisibility?.({ visibilityProperty: true }) !== false).filter(isTabStop);
|
|
323
329
|
const onKeydown = (e) => {
|
|
324
|
-
if (e.key !== "Tab" || traps.at(-1) !==
|
|
330
|
+
if (e.key !== "Tab" || traps.at(-1) !== el) return;
|
|
325
331
|
const els = focusables();
|
|
326
332
|
if (!els.length) {
|
|
327
333
|
e.preventDefault();
|
|
@@ -333,17 +339,14 @@ var focus = (app) => {
|
|
|
333
339
|
if (!el.contains(current)) {
|
|
334
340
|
e.preventDefault();
|
|
335
341
|
first.focus();
|
|
336
|
-
} else if (e.shiftKey
|
|
337
|
-
e.preventDefault();
|
|
338
|
-
last.focus();
|
|
339
|
-
} else if (!e.shiftKey && current === last) {
|
|
342
|
+
} else if (!((e.shiftKey ? first : last).compareDocumentPosition(current) & (e.shiftKey ? 4 : 2))) {
|
|
340
343
|
e.preventDefault();
|
|
341
|
-
first.focus();
|
|
344
|
+
(e.shiftKey ? last : first).focus();
|
|
342
345
|
}
|
|
343
346
|
};
|
|
344
347
|
const release = () => {
|
|
345
348
|
active = false;
|
|
346
|
-
traps.splice(traps.indexOf(
|
|
349
|
+
traps.splice(traps.indexOf(el), 1);
|
|
347
350
|
document.removeEventListener("keydown", onKeydown, true);
|
|
348
351
|
if (prevFocus && prevFocus.focus) prevFocus.focus();
|
|
349
352
|
};
|
|
@@ -352,10 +355,10 @@ var focus = (app) => {
|
|
|
352
355
|
if (on && !active) {
|
|
353
356
|
active = true;
|
|
354
357
|
prevFocus = document.activeElement;
|
|
355
|
-
traps.
|
|
358
|
+
traps.splice(traps.findIndex((t) => el.contains(t)) >>> 0, 0, el);
|
|
356
359
|
document.addEventListener("keydown", onKeydown, true);
|
|
357
360
|
Promise.resolve().then(() => {
|
|
358
|
-
if (active) (focusables()[0] || el).focus();
|
|
361
|
+
if (active && traps.at(-1) === el) (focusables()[0] || el).focus();
|
|
359
362
|
});
|
|
360
363
|
} else if (!on && active) release();
|
|
361
364
|
});
|
|
@@ -389,8 +392,7 @@ var collapse = (app) => {
|
|
|
389
392
|
];
|
|
390
393
|
const before = owned.map((k) => elem.style[k]);
|
|
391
394
|
const hide = (hidden) => elem.style.visibility = hidden ? "hidden" : before[3];
|
|
392
|
-
|
|
393
|
-
let first = true;
|
|
395
|
+
let shown;
|
|
394
396
|
let seq = 0;
|
|
395
397
|
const timers = /* @__PURE__ */ new Set();
|
|
396
398
|
const later = (fn, ms) => {
|
|
@@ -402,27 +404,25 @@ var collapse = (app) => {
|
|
|
402
404
|
};
|
|
403
405
|
effect(() => {
|
|
404
406
|
const show = !!get();
|
|
407
|
+
if (show === shown) return;
|
|
405
408
|
const id = ++seq;
|
|
406
|
-
if (first) {
|
|
407
|
-
first = false;
|
|
408
|
-
if (!show) elem.style.height = "0px";
|
|
409
|
-
hide(!show);
|
|
410
|
-
later(() => {
|
|
411
|
-
elem.style.transition = `height ${duration}ms ease, visibility ${duration}ms`;
|
|
412
|
-
});
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
409
|
hide(!show);
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
410
|
+
elem.style.overflow = show && shown == null ? before[0] : "hidden";
|
|
411
|
+
if (shown == null) later(() => {
|
|
412
|
+
elem.style.transition = `height ${duration}ms ease, visibility ${duration}ms`;
|
|
413
|
+
});
|
|
414
|
+
else {
|
|
415
|
+
elem.style.height = before[1] || elem.scrollHeight + "px";
|
|
416
|
+
if (show) later(() => {
|
|
417
|
+
if (id === seq) {
|
|
418
|
+
elem.style.height = before[1];
|
|
419
|
+
elem.style.overflow = before[0];
|
|
420
|
+
}
|
|
420
421
|
}, duration);
|
|
421
|
-
|
|
422
|
-
elem.style.height = elem.scrollHeight + "px";
|
|
423
|
-
elem.offsetHeight;
|
|
424
|
-
elem.style.height = "0px";
|
|
422
|
+
else elem.offsetHeight;
|
|
425
423
|
}
|
|
424
|
+
if (!show) elem.style.height = "0px";
|
|
425
|
+
shown = show;
|
|
426
426
|
});
|
|
427
427
|
return () => {
|
|
428
428
|
timers.forEach(clearTimeout);
|
|
@@ -436,7 +436,8 @@ var collapse = (app) => {
|
|
|
436
436
|
* logs an unknown-directive error, and registering one would have the walker
|
|
437
437
|
* strip it, leaving nothing for the next morph. Matches `data-morph-skip`.
|
|
438
438
|
*/
|
|
439
|
-
var preserved = (node, opts) => node.nodeType === 1 && (node.hasAttribute("data-morph-preserve") || !!opts.preserve?.(node));
|
|
439
|
+
var preserved = (node, opts) => node.nodeType === 1 && (node.hasAttribute("data-morph-preserve") || node.__marker || !!opts.preserve?.(node));
|
|
440
|
+
var LAZY = "[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]";
|
|
440
441
|
var dirRE = /^(?:v-|:|@)/;
|
|
441
442
|
var bindRE = /^(?::|v-bind:)/;
|
|
442
443
|
var clientStyleRE = /^v-(?!scope|on:)/;
|
|
@@ -481,12 +482,17 @@ var release = (node, ctx) => (ctx || ctxIn(node))?.dispose?.(node);
|
|
|
481
482
|
var boundAttrs = (to) => {
|
|
482
483
|
const owned = /* @__PURE__ */ new Set();
|
|
483
484
|
if (to.matches("details,dialog")) owned.add("open");
|
|
484
|
-
for (const { name } of to.attributes) if (bindRE.test(name))
|
|
485
|
-
|
|
485
|
+
for (const { name } of to.attributes) if (bindRE.test(name)) {
|
|
486
|
+
const attr = name.replace(bindRE, "").split(".")[0];
|
|
487
|
+
owned.add(/\.camel\b/.test(name) ? attr.replace(/-(\w)/g, (_, c) => c.toUpperCase()) : attr);
|
|
488
|
+
} else if (/^v-model\b/.test(name)) {
|
|
486
489
|
owned.add("value");
|
|
487
490
|
owned.add("checked");
|
|
488
491
|
} else if (name === "v-bind") owned.add("*");
|
|
489
|
-
else if (clientStyleRE.test(name))
|
|
492
|
+
else if (clientStyleRE.test(name)) {
|
|
493
|
+
owned.add("style");
|
|
494
|
+
name == "v-popover" && owned.add("popover");
|
|
495
|
+
}
|
|
490
496
|
return owned;
|
|
491
497
|
};
|
|
492
498
|
/**
|
|
@@ -501,8 +507,25 @@ var ownsChildren = (to) => {
|
|
|
501
507
|
for (let c = to.firstElementChild; c; c = c.nextElementSibling) if (isBlockRoot(c)) return true;
|
|
502
508
|
return false;
|
|
503
509
|
};
|
|
504
|
-
var
|
|
510
|
+
var FIELD_PROPS = [
|
|
511
|
+
"Value",
|
|
512
|
+
"Checked",
|
|
513
|
+
"Selected"
|
|
514
|
+
];
|
|
515
|
+
var syncValues = (from, to, owned) => {
|
|
516
|
+
const ctl = boundAttrs(to.closest("select") || to);
|
|
517
|
+
if (owned.has("*") || ctl.has("*") || ctl.has("value") || from.type == "output" || from.type == "textarea" && to.value.includes("{{")) return;
|
|
518
|
+
for (const name of FIELD_PROPS) {
|
|
519
|
+
const prop = name.toLowerCase();
|
|
520
|
+
const init = "default" + name;
|
|
521
|
+
const src = name == "Selected" ? init : prop;
|
|
522
|
+
if (!owned.has(prop) && init in from && from[prop] !== to[src]) from[prop] = to[src];
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
var patchAttrs = (from, to, values) => {
|
|
505
526
|
const owned = boundAttrs(to);
|
|
527
|
+
if (from.__anchor) owned.add("style");
|
|
528
|
+
if (values) syncValues(from, to, owned);
|
|
506
529
|
const bound = Object(from.__bound);
|
|
507
530
|
for (const { name, value } of to.attributes) {
|
|
508
531
|
if (dirRE.test(name) || owned.has(name) || name in bound) continue;
|
|
@@ -522,7 +545,8 @@ var patchNode = (from, to, ctx, opts) => {
|
|
|
522
545
|
if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx, opts);
|
|
523
546
|
if (from.nodeType === 3 || from.nodeType === 8) {
|
|
524
547
|
const data = to.data;
|
|
525
|
-
if (isInterpolation(data, ctx)) return;
|
|
548
|
+
if (isInterpolation(data, ctx) && from.parentNode?.nodeName != "SCRIPT") return;
|
|
549
|
+
if (!from.data) return replaceNode(from, to, ctx, opts);
|
|
526
550
|
if (from.data !== data) from.data = data;
|
|
527
551
|
return;
|
|
528
552
|
}
|
|
@@ -531,8 +555,10 @@ var patchNode = (from, to, ctx, opts) => {
|
|
|
531
555
|
const b = to;
|
|
532
556
|
if (a.tagName !== b.tagName) return replaceNode(from, to, ctx, opts);
|
|
533
557
|
if (opts.skip?.(a, b) || a.hasAttribute("data-morph-skip")) return;
|
|
534
|
-
|
|
535
|
-
|
|
558
|
+
if (a.matches(LAZY)) return a.isEqualNode(b) ? void 0 : replaceNode(from, to, ctx, opts);
|
|
559
|
+
patchAttrs(a, b, opts.values);
|
|
560
|
+
if (a.tagName == "TEMPLATE" && !a.content.isEqualNode(b.content)) a.innerHTML = b.innerHTML;
|
|
561
|
+
if (!ownsChildren(b) && !Object.getOwnPropertyDescriptor(Object(a.__ctx?.scope), "$template")) patchChildren(a, b, a.__ctx || ctx, opts);
|
|
536
562
|
};
|
|
537
563
|
var replaceNode = (from, to, ctx, opts) => {
|
|
538
564
|
if (preserved(from, opts)) return;
|
|
@@ -542,6 +568,7 @@ var replaceNode = (from, to, ctx, opts) => {
|
|
|
542
568
|
from.parentNode.replaceChild(fresh, from);
|
|
543
569
|
opts.afterNodeRemoved?.(from);
|
|
544
570
|
mountNew(fresh, ctx);
|
|
571
|
+
return fresh;
|
|
545
572
|
};
|
|
546
573
|
/**
|
|
547
574
|
* Bind never-walked markup with the scope it was inserted into. The walker
|
|
@@ -549,6 +576,7 @@ var replaceNode = (from, to, ctx, opts) => {
|
|
|
549
576
|
* copy of the core into the plugins bundle.
|
|
550
577
|
*/
|
|
551
578
|
var mountNew = (node, ctx) => {
|
|
579
|
+
if (node.parentElement?.closest(LAZY)) return;
|
|
552
580
|
const target = ctx || nearestCtx(node.parentNode);
|
|
553
581
|
target?.walk?.(node, target);
|
|
554
582
|
};
|
|
@@ -562,6 +590,15 @@ var patchChildren = (from, to, ctx, opts) => {
|
|
|
562
590
|
keyed.set(k, n);
|
|
563
591
|
}
|
|
564
592
|
const keyOf = (n) => n && n.nodeType === 1 ? key(n) : null;
|
|
593
|
+
const wanted = /* @__PURE__ */ new Set();
|
|
594
|
+
for (let n = to.firstChild; n; n = n.nextSibling) wanted.add(keyOf(n));
|
|
595
|
+
const drop = (node) => {
|
|
596
|
+
if (!preserved(node, opts)) {
|
|
597
|
+
release(node, ctx);
|
|
598
|
+
from.removeChild(node);
|
|
599
|
+
opts.afterNodeRemoved?.(node);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
565
602
|
let oldChild = from.firstChild;
|
|
566
603
|
let newChild = to.firstChild;
|
|
567
604
|
const insert = (node) => {
|
|
@@ -573,7 +610,8 @@ var patchChildren = (from, to, ctx, opts) => {
|
|
|
573
610
|
while (newChild) {
|
|
574
611
|
const nextNew = newChild.nextSibling;
|
|
575
612
|
const wantKey = keyOf(newChild);
|
|
576
|
-
if (
|
|
613
|
+
if (oldChild?.data === "" && newChild.hasAttribute?.("v-teleport")) oldChild = oldChild.nextSibling;
|
|
614
|
+
else if (wantKey != null) {
|
|
577
615
|
const match = keyed.get(wantKey);
|
|
578
616
|
if (match) {
|
|
579
617
|
if (match === oldChild) oldChild = oldChild.nextSibling;
|
|
@@ -589,16 +627,17 @@ var patchChildren = (from, to, ctx, opts) => {
|
|
|
589
627
|
const nextOld = oldChild.nextSibling;
|
|
590
628
|
patchNode(oldChild, newChild, ctx, opts);
|
|
591
629
|
oldChild = nextOld;
|
|
630
|
+
} else if (oldChild && !wanted.has(keyOf(oldChild))) {
|
|
631
|
+
const nextOld = oldChild.nextSibling;
|
|
632
|
+
drop(oldChild);
|
|
633
|
+
oldChild = nextOld;
|
|
634
|
+
continue;
|
|
592
635
|
} else insert(newChild);
|
|
593
636
|
newChild = nextNew;
|
|
594
637
|
}
|
|
595
638
|
while (oldChild) {
|
|
596
639
|
const next = oldChild.nextSibling;
|
|
597
|
-
|
|
598
|
-
release(oldChild, ctx);
|
|
599
|
-
from.removeChild(oldChild);
|
|
600
|
-
opts.afterNodeRemoved?.(oldChild);
|
|
601
|
-
}
|
|
640
|
+
drop(oldChild);
|
|
602
641
|
oldChild = next;
|
|
603
642
|
}
|
|
604
643
|
};
|
|
@@ -610,18 +649,19 @@ var morph = (from, to, opts = {}) => {
|
|
|
610
649
|
let target;
|
|
611
650
|
if (typeof to === "string") {
|
|
612
651
|
const holder = document.createElement("template");
|
|
613
|
-
|
|
614
|
-
|
|
652
|
+
const svg = from instanceof SVGElement;
|
|
653
|
+
holder.innerHTML = svg ? `<svg>${to.trim()}</svg>` : to.trim();
|
|
654
|
+
const content = svg ? holder.content.firstChild : holder.content;
|
|
615
655
|
target = content.childNodes.length === 1 && content.firstElementChild ? content.firstElementChild : (() => {
|
|
616
656
|
const wrapper = from.cloneNode(false);
|
|
617
|
-
wrapper.
|
|
657
|
+
wrapper.append(...content.childNodes);
|
|
618
658
|
return wrapper;
|
|
619
659
|
})();
|
|
620
660
|
} else target = to;
|
|
621
661
|
if (target) {
|
|
622
662
|
const patch = () => {
|
|
623
663
|
const restore = captureFocus();
|
|
624
|
-
patchNode(from, target, nearestCtx(from), opts);
|
|
664
|
+
from = patchNode(from, target, nearestCtx(from.parentNode), opts) || from;
|
|
625
665
|
restore();
|
|
626
666
|
};
|
|
627
667
|
opts.transition && document.startViewTransition ? document.startViewTransition(patch) : patch();
|
|
@@ -671,7 +711,7 @@ var DEFAULT_BREAKPOINTS = {
|
|
|
671
711
|
* replaces rather than merges, so adjusting one breakpoint means spreading
|
|
672
712
|
* this rather than retyping all five.
|
|
673
713
|
*/
|
|
674
|
-
var defaultBreakpoints = Object.freeze({ ...DEFAULT_BREAKPOINTS });
|
|
714
|
+
var defaultBreakpoints = /* @__PURE__ */ Object.freeze({ ...DEFAULT_BREAKPOINTS });
|
|
675
715
|
var ALIASES = {
|
|
676
716
|
mobile: "base",
|
|
677
717
|
tablet: "md",
|
|
@@ -687,7 +727,7 @@ var NUMERIC = /^\d+$/;
|
|
|
687
727
|
* MediaQueryList rather than mirrored, since registering a query inside a
|
|
688
728
|
* running effect would write a dependency it just read and re-run it.
|
|
689
729
|
*/
|
|
690
|
-
var state = reactive({
|
|
730
|
+
var state = /* @__PURE__ */ reactive({
|
|
691
731
|
bp: "base",
|
|
692
732
|
tick: 0
|
|
693
733
|
});
|
|
@@ -814,7 +854,7 @@ var aliasPx = (alias) => {
|
|
|
814
854
|
return DEFAULT_BREAKPOINTS[name];
|
|
815
855
|
};
|
|
816
856
|
var mqFn = (map, fallback) => resolve(map, fallback);
|
|
817
|
-
var mq = Object.defineProperties(mqFn, {
|
|
857
|
+
var mq = /* @__PURE__ */ Object.defineProperties(mqFn, {
|
|
818
858
|
props: { value: (maps) => {
|
|
819
859
|
trackAll();
|
|
820
860
|
const out = {};
|
|
@@ -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)=>{let i="",r="",o=0;for(let s=0;s<t.length;s++){const a=n[t[s]];if(a){for(;o<e.length&&!a.test(e[o]);)o++;if(o>=e.length)break;i+=r+e[o++],r=""}else r+=t[s],e[o]===t[s]&&o++}return i},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)t in n&&(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")||!!t.preserve?.(e)),p=/^(?:v-|:|@)/,h=/^(?::|v-bind:)/,v=/^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=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),E=(e,t)=>{const n=(e=>{const t=new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)h.test(n)?t.add(n.replace(h,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):v.test(n)&&t.add("style");return t})(t),i=Object(e.__bound);for(const{name:r,value:o}of t.attributes)p.test(r)||n.has(r)||r in i||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has("*")||n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},S=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return O(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const i=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(i,n))return;return void(e.data!==i&&(e.data=i))}if(1!==e.nodeType)return;const r=e,o=t;if(r.tagName!==o.tagName)return O(e,t,n,i);i.skip?.(r,o)||r.hasAttribute("data-morph-skip")||(E(r,o),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||x(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(x(t))return!0;return!1})(o)||L(r,o,r.__ctx||n,i))},O=(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)=>{const n=t||y(e.parentNode);n?.walk?.(e,n)},L=(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(null!=r){const t=o.get(r);t?(t===a?a=a.nextSibling:e.insertBefore(t,a),o.delete(r),S(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;S(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=T();S(e,i,y(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},T=()=>{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{}}},$={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j=Object.freeze({...$}),N={mobile:"base",tablet:"md",desktop:"lg"},P=/^\d+$/,q=(0,t.reactive)({bp:"base",tick:0}),C={...$},D=["base"],M=!1,z=[],R=new Map,B=()=>"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)}),V=()=>{for(let e=z.length-1;e>=0;e--)if(z[e].mql.matches)return D[e+1];return"base"},H=()=>{z.forEach(e=>e.off()),z=[];const e=Object.keys(C).filter(e=>C[e]>0).sort((e,t)=>C[e]-C[t]);D=["base",...e],B()&&(z=e.map(e=>{const t=window.matchMedia(`(min-width: ${C[e]}px)`);return I(t,()=>{q.bp=V()})}),q.bp=V())},J=()=>{M||(M=!0,H()),q.tick},K=e=>{if(!B())return!1;let t=R.get(e);t?R.delete(e):t=I(window.matchMedia(e),()=>q.tick++),R.set(e,t);for(const[n,i]of R){if(R.size<=64)break;i.off(),R.delete(n)}return t.mql.matches},W=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(P.test(e))return Number(e);const t=void 0===C[e]?N[e]:void 0;return void 0!==t?"base"===t?0:C[t]:C[e]},Z=e=>{if(e<=0)return!0;const t=D.findIndex(t=>"base"!==t&&C[t]===e);return-1!==t?D.indexOf(q.bp)>=t:(q.tick,K(`(min-width: ${e}px)`))},F=new Set,G=(e,t)=>{if(J(),!e||"object"!=typeof e)return t;let n,i=-1;for(const r of Object.keys(e)){const t=W(r);void 0!==t?t>=i&&Z(t)&&(i=t,n=e[r]):(D.join(", "),Object.keys(N).join(", "))}return void 0!==n?n:t},Q=e=>{const t=N[e],n=C[t];return void 0!==n?n:$[t]},U=Object.defineProperties((e,t)=>G(e,t),{props:{value:e=>{J();const t={};for(const n of Object.keys(e))t[n]=G(e[n]);return t}},breakpoint:{get:()=>(J(),q.bp),enumerable:!0},device:{get:()=>(J(),Z(Q("tablet"))?Z(Q("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{J();const t=W(e);return void 0!==t&&Z(t)}},match:{value:e=>(J(),K(e))},configure:{value:({breakpoints:e})=>{e&&(C={...e},M&&(H(),q.tick++))}}}),X=()=>{z.forEach(e=>e.off()),R.forEach(e=>e.off()),z=[],R.clear(),M=!1};return e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const r=e;let o=250;for(const m in i||{}){const e=/^duration-(\d+)$/.exec(m);e&&(o=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>r.style[e]),c=e=>r.style.visibility=e?"hidden":a[3];r.style.overflow="hidden";let l=!0,d=0;const f=new Set,u=(e,t)=>{const n=setTimeout(()=>{f.delete(n),e()},t);f.add(n)};return n(()=>{const e=!!t(),n=++d;if(l)return l=!1,e||(r.style.height="0px"),c(!e),void u(()=>{r.style.transition=`height ${o}ms ease, visibility ${o}ms`});c(!e),e?(r.style.height=r.scrollHeight+"px",u(()=>{n===d&&(r.style.height="")},o)):(r.style.height=r.scrollHeight+"px",r.offsetHeight,r.style.height="0px")}),()=>{f.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;return n(()=>{const n=!!t();Promise.resolve().then(()=>{r&&n&&(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=()=>{const{value:e,selectionStart:o}=r,s=i(e,t);if(s===e)return!1;if(r.value=s,null!=o&&document.activeElement===r){let a=i(e.slice(0,o),t).length;for(;a<s.length&&!n[t[a]];)a++;r.setSelectionRange(a,a)}return!0};e.addEventListener("input",o),o();let s=!0;return Promise.resolve().then(()=>{s&&o()&&e.dispatchEvent(new Event("input"))}),()=>{s=!1,e.removeEventListener("input",o)}})},e.media=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&U.configure(t),e.scope.$mq=U,e.scope.$mqProps=U.props,e.scope.$mqAtLeast=U.atLeast,e.scope.$mqMatch=U.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>U.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>U.device,enumerable:!0,configurable:!0}),()=>{X(),q.tick++}),e.morph=_,e.morphPlugin=e=>{e.scope.$morph=_},e.mq=U,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;for(const s in r||{})if(l(s)){c=s;break}const f=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;d(e.scope,a,f,l(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=()=>{X(),C={...$},D=["base",...Object.keys(C).sort((e,t)=>C[e]-C[t])],M=!1,F.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,u=!0;const m=()=>{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;m(),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&&(m(),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=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(d),m(),delete a.__leave}}const h="none"==a.style.display?"":a.style.display;return n(()=>{const e=!!t();if(u)return u=!1,a.style.display=e?h:"none",void(e&&r?.appear&&p("enter"));e?(a.style.display=h,p("enter")):p("leave",()=>{a.style.display="none"})}),()=>{clearTimeout(d),m()}})},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]",v=/^(?:v-|:|@)/,h=/^(?::|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(h.test(n)){const e=n.replace(h,"").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"],L=(e,t,n)=>{const i=E(t);e.__anchor&&i.add("style"),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)v.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 A(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)):A(e,t,n,i)}if(1!==e.nodeType)return;const r=e,o=t;if(r.tagName!==o.tagName)return A(e,t,n,i);if(!i.skip?.(r,o)&&!r.hasAttribute("data-morph-skip")){if(r.matches(m))return r.isEqualNode(o)?void 0:A(e,t,n,i);L(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")||N(r,o,r.__ctx||n,i)}},A=(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)},N=(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),T(t,d,n,i)):f(d)}else if(l&&null==s(l)){if(p(l,i)&&!p(d,i)){l=l.nextSibling;continue}const e=l.nextSibling;T(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=T(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?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(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,a.__leaving=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 v;return n(()=>{const e=!!t();if(e===v)return;const n=null!=v;v=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===v&&(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)=>{let n="",i="",o=0;for(let s=0;s<t.length;s++){const c=r[t[s]];if(c){for(;o<e.length&&!c.test(e[o]);)o++;if(o>=e.length)break;n+=i+e[o++],i=""}else i+=t[s],e[o]===t[s]&&o++}return n},s=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,i=()=>{const{value:e,selectionStart:i}=n,s=o(e,t);if(s===e)return!1;if(n.value=s,null!=i&&document.activeElement===n){let c=o(e.slice(0,i),t).length;for(;c<s.length&&!r[t[c]];)c++;n.setSelectionRange(c,c)}return!0};e.addEventListener("input",i),i();let s=!0;return Promise.resolve().then(()=>{s&&i()&&e.dispatchEvent(new Event("input"))}),()=>{s=!1,e.removeEventListener("input",i)}})},c=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),l=(e,t)=>{const n=e.split(","),i=t.split(",");let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,c(n[o])+c(i[o%i.length]));return r},a=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:r,exp:o})=>{const s=e,c=i||"v",a=e=>`${c}-${e}`;let d,f=0,u=!0;const m=()=>{s.classList.remove(a("enter-from"),a("enter-active"),a("enter-to"),a("leave-from"),a("leave-active"),a("leave-to"))},p=(e,t)=>{const n=++f;m(),s.classList.add(a(e+"-from"),a(e+"-active")),s.offsetWidth,s.classList.remove(a(e+"-from")),s.classList.add(a(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(l(t.transitionDuration,t.transitionDelay),l(t.animationDuration,t.animationDelay))})(s))};if(!o){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),s.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(d),m(),delete s.__leave}}const v="none"==s.style.display?"":s.style.display;return n(()=>{const e=!!t();if(u)return u=!1,s.style.display=e?v:"none",void(e&&r?.appear&&p("enter"));e?(s.style.display=v,p("enter")):p("leave",()=>{s.style.display="none"})}),()=>{clearTimeout(d),m()}})},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)t in n&&(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 c;for(const a in r||{})if(m(a)){c=a;break}const l=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;h(e.scope,s,l,m(c),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;return n(()=>{const n=!!t();Promise.resolve().then(()=>{r&&n&&(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],c=document.activeElement;e.contains(c)?!t.shiftKey||c!==i&&c!==e?t.shiftKey||c!==r||(t.preventDefault(),i.focus()):(t.preventDefault(),r.focus()):(t.preventDefault(),i.focus())},c=()=>{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&&c()}),()=>{i&&c()}})},x=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const r=e;let o=250;for(const m in i||{}){const e=/^duration-(\d+)$/.exec(m);e&&(o=+e[1])}const s=["overflow","height","transition","visibility"],c=s.map(e=>r.style[e]),l=e=>r.style.visibility=e?"hidden":c[3];r.style.overflow="hidden";let a=!0,d=0;const f=/* @__PURE__ */new Set,u=(e,t)=>{const n=setTimeout(()=>{f.delete(n),e()},t);f.add(n)};return n(()=>{const e=!!t(),n=++d;if(a)return a=!1,e||(r.style.height="0px"),l(!e),void u(()=>{r.style.transition=`height ${o}ms ease, visibility ${o}ms`});l(!e),e?(r.style.height=r.scrollHeight+"px",u(()=>{n===d&&(r.style.height="")},o)):(r.style.height=r.scrollHeight+"px",r.offsetHeight,r.style.height="0px")}),()=>{f.forEach(clearTimeout),s.forEach((e,t)=>r.style[e]=c[t])}})},E=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),S=/^(?:v-|:|@)/,A=/^(?::|v-bind:)/,O=/^v-(?!scope|on:)/,_=["id","data-key","data-id"],L=e=>{for(const t of _){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},$=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},T=e=>e.__ctx||[...e.children||[]].map(T).find(Boolean),j=(e,t)=>(t||T(e))?.dispose?.(e),N=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),q=(e,t)=>{const n=(e=>{const t=/* @__PURE__ */new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)A.test(n)?t.add(n.replace(A,"").split(".")[0]):"v-model"===n?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):O.test(n)&&t.add("style");return t})(t),i=Object(e.__bound);for(const{name:r,value:o}of t.attributes)S.test(r)||n.has(r)||r in i||e.getAttribute(r)!==o&&e.setAttribute(r,o);for(const{name:r}of[...e.attributes])n.has("*")||n.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},C=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return P(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const i=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(i,n))return;return void(e.data!==i&&(e.data=i))}if(1!==e.nodeType)return;const r=e,o=t;if(r.tagName!==o.tagName)return P(e,t,n,i);i.skip?.(r,o)||r.hasAttribute("data-morph-skip")||(q(r,o),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||N(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(N(t))return!0;return!1})(o)||M(r,o,r.__ctx||n,i))},P=(e,t,n,i)=>{if(E(e,i))return;const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(j(e,n),e.parentNode.replaceChild(r,e),i.afterNodeRemoved?.(e),D(r,n))},D=(e,t)=>{const n=t||$(e.parentNode);n?.walk?.(e,n)},M=(e,t,n,i)=>{const r=i.key||L,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 c=e.firstChild,l=t.firstChild;const a=t=>{const r=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(r)&&(e.insertBefore(r,c),D(r,n))};for(;l;){const t=l.nextSibling,r=s(l);if(null!=r){const t=o.get(r);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),o.delete(r),C(t,l,n,i)):a(l)}else if(c&&null==s(c)){if(E(c,i)&&!E(l,i)){c=c.nextSibling;continue}const e=c.nextSibling;C(c,l,n,i),c=e}else a(l);l=t}for(;c;){const t=c.nextSibling;E(c,i)||(j(c,n),e.removeChild(c),i.afterNodeRemoved?.(c)),c=t}},R=(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=z();C(e,i,$(e),n),t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},z=()=>{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{}}},I=e=>{e.scope.$morph=R},B={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},H=Object.freeze({...B}),V={mobile:"base",tablet:"md",desktop:"lg"},J=/^\d+$/,K=e({bp:"base",tick:0}),W={...B},Z=["base"],F=!1,G=[],Q=/* @__PURE__ */new Map,U=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,X=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),Y=()=>{for(let e=G.length-1;e>=0;e--)if(G[e].mql.matches)return Z[e+1];return"base"},ee=()=>{G.forEach(e=>e.off()),G=[];const e=Object.keys(W).filter(e=>W[e]>0).sort((e,t)=>W[e]-W[t]);Z=["base",...e],U()&&(G=e.map(e=>{const t=window.matchMedia(`(min-width: ${W[e]}px)`);return X(t,()=>{K.bp=Y()})}),K.bp=Y())},te=()=>{F||(F=!0,ee()),K.tick},ne=e=>{if(!U())return!1;let t=Q.get(e);t?Q.delete(e):t=X(window.matchMedia(e),()=>K.tick++),Q.set(e,t);for(const[n,i]of Q){if(Q.size<=64)break;i.off(),Q.delete(n)}return t.mql.matches},ie=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(J.test(e))return Number(e);const t=void 0===W[e]?V[e]:void 0;return void 0!==t?"base"===t?0:W[t]:W[e]},re=e=>{if(e<=0)return!0;const t=Z.findIndex(t=>"base"!==t&&W[t]===e);return-1!==t?Z.indexOf(K.bp)>=t:(K.tick,ne(`(min-width: ${e}px)`))},oe=/* @__PURE__ */new Set,se=(e,t)=>{if(te(),!e||"object"!=typeof e)return t;let n,i=-1;for(const r of Object.keys(e)){const t=ie(r);void 0!==t?t>=i&&re(t)&&(i=t,n=e[r]):(Z.join(", "),Object.keys(V).join(", "))}return void 0!==n?n:t},ce=e=>{const t=V[e],n=W[t];return void 0!==n?n:B[t]},le=Object.defineProperties((e,t)=>se(e,t),{props:{value:e=>{te();const t={};for(const n of Object.keys(e))t[n]=se(e[n]);return t}},breakpoint:{get:()=>(te(),K.bp),enumerable:!0},device:{get:()=>(te(),re(ce("tablet"))?re(ce("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{te();const t=ie(e);return void 0!==t&&re(t)}},match:{value:e=>(te(),ne(e))},configure:{value:({breakpoints:e})=>{e&&(W={...e},F&&(ee(),K.tick++))}}}),ae=()=>{G.forEach(e=>e.off()),Q.forEach(e=>e.off()),G=[],Q.clear(),F=!1},de=()=>{ae(),W={...B},Z=["base",...Object.keys(W).sort((e,t)=>W[e]-W[t])],F=!1,oe.clear(),K.bp="base",K.tick=0},fe=(e,t)=>(t?.breakpoints&&JSON.stringify(t.breakpoints),t&&le.configure(t),e.scope.$mq=le,e.scope.$mqProps=le.props,e.scope.$mqAtLeast=le.atLeast,e.scope.$mqMatch=le.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>le.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>le.device,enumerable:!0,configurable:!0}),()=>{ae(),K.tick++}),ue=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,H as defaultBreakpoints,w as focus,i as intersect,s as mask,fe as media,R as morph,I as morphPlugin,le as mq,b as persist,y as persistStore,p as registerStorage,de as resetMedia,ue as resize,v as setDefaultStorage,a as transition};
|
|
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 o=new IntersectionObserver(e=>{for(const r of e){const e=n?.full?r.intersectionRatio>=1:r.isIntersecting,s=n?.leave?i&&!e:e&&!i;i=e,s&&(t(),n?.once&&o.disconnect())}},{threshold:n?.full?1:0});return o.observe(e),()=>o.disconnect()})},o={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},r=(e,t,n)=>{let i="",r="",s=0;for(let a=0;a<t.length;a++){const n=o[t[a]];if(n){for(;s<e.length&&!n.test(e[s]);)s++;if(s>=e.length)return i;i+=r+e[s++],r=""}else r+=t[a],e[s]===t[a]&&s++}return n?i+r:i},s=e=>{e.directive("mask",({el:e,exp:t})=>{const n=e,i=e=>{const{value:i,selectionStart:s}=n,a=e?.inputType,c=r(i,t,!a?.startsWith("del"));if(c===i)return!1;if(n.value=c,null!=s&&document.activeElement===n){let e=r(i.slice(0,s),t).length;if(!e||!a?.endsWith("Backward"))for(;e<c.length&&!o[t[e]];)e++;n.setSelectionRange(e,e)}return!0};e.addEventListener("input",i);const s=i();let a=!0;return Promise.resolve().then(()=>{a&&(i()||s)&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{a=!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 o=0;for(let r=0;r<n.length;r++)o=Math.max(o,a(n[r])+a(i[r%i.length]));return o},l=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:o,exp:r})=>{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"))},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,s.__leaving=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||o?.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,i,o)=>{if(!i)return o(()=>{});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 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 r)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of r)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:o,effect:r})=>{const s=d+(n||t.id);let a=o?void 0:p();for(const l in o)if(a=p(l))break;const c=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;h(e.scope,s,c,a,r)})},y=(e,i={})=>{const o=t(e);if(!o)return()=>{};const r=p(i.storage);return h(o,d+(i.key??e),i.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:i})=>{let o=!0,r=!1;return n(()=>{r!==(r=!!t())&&Promise.resolve().then(()=>{o&&r&&(e.focus(),i?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let i=!1,o=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 i=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?(t.shiftKey?i:o).compareDocumentPosition(s)&(t.shiftKey?4:2)||(t.preventDefault(),(t.shiftKey?o:i).focus()):(t.preventDefault(),i.focus())},a=()=>{i=!1,g.splice(g.indexOf(e),1),document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!i?(i=!0,o=document.activeElement,g.splice(g.findIndex(t=>e.contains(t))>>>0,0,e),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{i&&g.at(-1)===e&&(r()[0]||e).focus()})):!n&&i&&a()}),()=>{i&&a()}})},k=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const o=e;let r=250;for(const u in i||{}){const e=/^duration-(\d+)$/.exec(u);e&&(r=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>o.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 i;i=!e,o.style.visibility=i?"hidden":a[3],o.style.overflow=e&&null==c?a[0]:"hidden",null==c?f(()=>{o.style.transition=`height ${r}ms ease, visibility ${r}ms`}):(o.style.height=a[1]||o.scrollHeight+"px",e?f(()=>{n===l&&(o.style.height=a[1],o.style.overflow=a[0])},r):o.offsetHeight),e||(o.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>o.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-|:|@)/,L=/^(?::|v-bind:)/,T=/^v-(?!scope|on:)/,A=["id","data-key","data-id"],O=e=>{for(const t of A){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},N=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(L.test(n)){const e=n.replace(L,"").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("*"):T.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 i=P(t);e.__anchor&&i.add("style"),n&&((e,t,n)=>{const i=P(t.closest("select")||t);if(!(n.has("*")||i.has("*")||i.has("value")||"output"==e.type||"textarea"==e.type&&t.value.includes("{{")))for(const o of q){const i=o.toLowerCase(),r="default"+o,s="Selected"==o?r:i;!n.has(i)&&r in e&&e[i]!==t[s]&&(e[i]=t[s])}})(e,t,i);const o=Object(e.__bound);for(const{name:r,value:s}of t.attributes)_.test(r)||i.has(r)||r in o||e.getAttribute(r)!==s&&e.setAttribute(r,s);for(const{name:r}of[...e.attributes])i.has("*")||i.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},D=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return R(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const o=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(o,n)&&"SCRIPT"!=e.parentNode?.nodeName)return;return e.data?void(e.data!==o&&(e.data=o)):R(e,t,n,i)}if(1!==e.nodeType)return;const o=e,r=t;if(o.tagName!==r.tagName)return R(e,t,n,i);if(!i.skip?.(o,r)&&!o.hasAttribute("data-morph-skip")){if(o.matches(S))return o.isEqualNode(r)?void 0:R(e,t,n,i);M(o,r,i.values),"TEMPLATE"!=o.tagName||o.content.isEqualNode(r.content)||(o.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(o.__ctx?.scope),"$template")||I(o,r,o.__ctx||n,i)}},R=(e,t,n,i)=>{if(E(e,i))return;const o=t.cloneNode(!0);return!1!==i.beforeNodeAdded?.(o)?(C(e,n),e.parentNode.replaceChild(o,e),i.afterNodeRemoved?.(e),z(o,n),o):void 0},z=(e,t)=>{if(e.parentElement?.closest(S))return;const n=t||N(e.parentNode);n?.walk?.(e,n)},I=(e,t,n,i)=>{const o=i.key||O,r=/* @__PURE__ */new Map;for(let u=e.firstChild;u;u=u.nextSibling)if(1===u.nodeType){const e=o(u);if(null==e)continue;r.set(e,u)}const s=e=>e&&1===e.nodeType?o(e):null,a=/* @__PURE__ */new Set;for(let u=t.firstChild;u;u=u.nextSibling)a.add(s(u));const c=t=>{E(t,i)||(C(t,n),e.removeChild(t),i.afterNodeRemoved?.(t))};let l=e.firstChild,d=t.firstChild;const f=t=>{const o=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(o)&&(e.insertBefore(o,l),z(o,n))};for(;d;){const t=d.nextSibling,o=s(d);if(""===l?.data&&d.hasAttribute?.("v-teleport"))l=l.nextSibling;else if(null!=o){const t=r.get(o);t?(t===l?l=l.nextSibling:e.insertBefore(t,l),r.delete(o),D(t,d,n,i)):f(d)}else if(l&&null==s(l)){if(E(l,i)&&!E(d,i)){l=l.nextSibling;continue}const e=l.nextSibling;D(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}},B=(e,t,n={})=>{let i;if("string"==typeof t){const n=document.createElement("template"),o=e instanceof SVGElement;n.innerHTML=o?`<svg>${t.trim()}</svg>`:t.trim();const r=o?n.content.firstChild:n.content;i=1===r.childNodes.length&&r.firstElementChild?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.append(...r.childNodes),t})()}else i=t;if(i){const t=()=>{const t=H();e=D(e,i,N(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,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{}}},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?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),ne=()=>{for(let e=X.length-1;e>=0;e--)if(X[e].mql.matches)return U[e+1];return"base"},ie=()=>{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())},oe=()=>{Q||(Q=!0,ie()),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,i]of Y){if(Y.size<=64)break;i.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(oe(),!e||"object"!=typeof e)return t;let n,i=-1;for(const o of Object.keys(e)){const t=se(o);void 0!==t&&(t>=i&&ae(t)&&(i=t,n=e[o]))}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=>{oe();const t={};for(const n of Object.keys(e))t[n]=ce(e[n]);return t}},breakpoint:{get:()=>(oe(),F.bp),enumerable:!0},device:{get:()=>(oe(),ae(le("tablet"))?ae(le("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{oe();const t=se(e);return void 0!==t&&ae(t)}},match:{value:e=>(oe(),re(e))},configure:{value:({breakpoints:e})=>{e&&(G={...e},Q&&(ie(),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:i})=>{const o=t(`(($width, $height) => { ${n} })`);if(i?.window||i?.visual){const e=i.visual&&window.visualViewport||window,t=()=>o(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;o(e.width,e.height)}});return r.observe(e),()=>r.disconnect()})};export{k as collapse,K as defaultBreakpoints,x as focus,i 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};
|