@vuetify/v0 0.0.16 → 0.0.20
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/README.md +125 -47
- package/dist/browser/index.js +1801 -1604
- package/dist/components/index.d.mts +4 -4
- package/dist/components/index.mjs +6 -6
- package/dist/{components-Dk00OFL2.mjs → components-D590hSY0.mjs} +151 -54
- package/dist/composables/index.d.mts +4 -4
- package/dist/composables/index.mjs +5 -5
- package/dist/{composables-YOUVfUsn.mjs → composables-FE6B8JUW.mjs} +370 -303
- package/dist/constants/index.d.mts +1 -1
- package/dist/constants/index.mjs +3 -3
- package/dist/{globals-Rnihe4SF.mjs → globals-exvZ8fiO.mjs} +1 -1
- package/dist/index-4jSy8KIt.d.mts +73 -0
- package/dist/{index-BzW68rBC.d.mts → index-BYyEPh1S.d.mts} +227 -17
- package/dist/index-CjzlIAtF.d.mts +296 -0
- package/dist/{index-BeJMYhId.d.mts → index-DahjxaTj.d.mts} +899 -136
- package/dist/{index-BulceeMA.d.mts → index-Gr6XPRWt.d.mts} +50 -18
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +8 -8
- package/dist/types/index.d.mts +1 -1
- package/dist/{useStep-Bqhi_DDs.mjs → useStep-Dw7XloDM.mjs} +1067 -1258
- package/dist/utilities/index.d.mts +2 -2
- package/dist/utilities/index.mjs +1 -1
- package/dist/utilities-BrFKLHFS.mjs +363 -0
- package/package.json +3 -3
- package/dist/index-BXN7M6o_.d.mts +0 -71
- package/dist/index-Bd3J4RNS.d.mts +0 -11
- package/dist/utilities-DQWf_4V_.mjs +0 -139
- /package/dist/{constants-BWV0uYsM.mjs → constants-DypzAkYp.mjs} +0 -0
- /package/dist/{htmlElements-BYo-fMlZ.mjs → htmlElements-CXObxj0V.mjs} +0 -0
- /package/dist/{index-B6lIRI3i.d.mts → index-B9mKi4pr.d.mts} +0 -0
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { a as isBoolean, c as isNull, d as isObject, g as mergeDeep, h as isUndefined, l as isNullOrUndefined, o as isFunction, p as isString, r as genId, t as clamp, u as isNumber } from "./utilities-
|
|
2
|
-
import {
|
|
3
|
-
import { i as SUPPORTS_MUTATION_OBSERVER, n as SUPPORTS_INTERSECTION_OBSERVER, t as IN_BROWSER } from "./globals-
|
|
4
|
-
import { computed, effectScope, isRef, onScopeDispose, reactive, readonly, ref, shallowReadonly, shallowRef, toRef, toValue, unref, watch } from "vue";
|
|
1
|
+
import { a as isBoolean, c as isNull, d as isObject, g as mergeDeep, h as isUndefined, l as isNullOrUndefined, o as isFunction, p as isString, r as genId, t as clamp, u as isNumber } from "./utilities-BrFKLHFS.mjs";
|
|
2
|
+
import { J as createTrinity, P as toArray, S as createTokens, T as createSingle, Y as createContext, Z as useContext, d as useResizeObserver, g as useHydration, k as createGroup, q as createPlugin, z as useRegistry } from "./useStep-Dw7XloDM.mjs";
|
|
3
|
+
import { i as SUPPORTS_MUTATION_OBSERVER, n as SUPPORTS_INTERSECTION_OBSERVER, t as IN_BROWSER } from "./globals-exvZ8fiO.mjs";
|
|
4
|
+
import { computed, effectScope, isRef, onScopeDispose, reactive, readonly, ref, shallowReadonly, shallowRef, toRef, toValue, unref, watch, watchEffect } from "vue";
|
|
5
5
|
|
|
6
6
|
//#region src/composables/toReactive/index.ts
|
|
7
7
|
/**
|
|
8
|
-
* @module toReactive
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Utility function to convert values and refs into reactive proxies with ref unwrapping.
|
|
12
|
-
*
|
|
13
|
-
* Key features:
|
|
14
|
-
* - Automatic ref unwrapping
|
|
15
|
-
* - Deep reactive proxying
|
|
16
|
-
* - Map and Set support with ref unwrapping
|
|
17
|
-
* - Nested object/array reactivity
|
|
18
|
-
* - Type preservation
|
|
19
|
-
*
|
|
20
|
-
* Perfect for creating reactive versions of plain objects while automatically unwrapping refs.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
8
|
* Converts a `MaybeRef` to a `UnwrapNestedRefs`.
|
|
24
9
|
*
|
|
25
10
|
* @param objectRef The object to convert.
|
|
@@ -140,21 +125,6 @@ function toReactive(objectRef) {
|
|
|
140
125
|
//#endregion
|
|
141
126
|
//#region src/composables/useEventListener/index.ts
|
|
142
127
|
/**
|
|
143
|
-
* @module useEventListener
|
|
144
|
-
*
|
|
145
|
-
* @remarks
|
|
146
|
-
* Event listener composable with automatic cleanup on scope disposal.
|
|
147
|
-
*
|
|
148
|
-
* Key features:
|
|
149
|
-
* - Supports Window, Document, and HTMLElement targets
|
|
150
|
-
* - Reactive targets, events, and listeners
|
|
151
|
-
* - Event options support (capture, passive, once)
|
|
152
|
-
* - Automatic removeEventListener on unmount
|
|
153
|
-
* - Multiple overloads for type safety
|
|
154
|
-
*
|
|
155
|
-
* Perfect for safely managing event listeners in Vue components.
|
|
156
|
-
*/
|
|
157
|
-
/**
|
|
158
128
|
* Attaches an event listener to a target.
|
|
159
129
|
*
|
|
160
130
|
* @param target The target to attach the event listener to.
|
|
@@ -209,7 +179,7 @@ function useEventListener(target, event, listener, options) {
|
|
|
209
179
|
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
210
180
|
*/
|
|
211
181
|
function useWindowEventListener(event, listener, options) {
|
|
212
|
-
return useEventListener(window, event, listener, options);
|
|
182
|
+
return IN_BROWSER ? useEventListener(window, event, listener, options) : () => {};
|
|
213
183
|
}
|
|
214
184
|
/**
|
|
215
185
|
* Attaches an event listener to the document.
|
|
@@ -223,30 +193,12 @@ function useWindowEventListener(event, listener, options) {
|
|
|
223
193
|
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
224
194
|
*/
|
|
225
195
|
function useDocumentEventListener(event, listener, options) {
|
|
226
|
-
return useEventListener(document, event, listener, options);
|
|
196
|
+
return IN_BROWSER ? useEventListener(document, event, listener, options) : () => {};
|
|
227
197
|
}
|
|
228
198
|
|
|
229
199
|
//#endregion
|
|
230
200
|
//#region src/composables/useBreakpoints/index.ts
|
|
231
201
|
/**
|
|
232
|
-
* @module useBreakpoints
|
|
233
|
-
*
|
|
234
|
-
* @see https://0.vuetifyjs.com/composables/plugins/use-breakpoints
|
|
235
|
-
*
|
|
236
|
-
* @remarks
|
|
237
|
-
* Responsive breakpoint detection composable with window resize handling.
|
|
238
|
-
*
|
|
239
|
-
* Key features:
|
|
240
|
-
* - Window matchMedia integration
|
|
241
|
-
* - Six built-in breakpoints (xs, sm, md, lg, xl, xxl)
|
|
242
|
-
* - Automatic resize listener with cleanup
|
|
243
|
-
* - SSR-safe (checks IN_BROWSER)
|
|
244
|
-
* - Hydration-aware
|
|
245
|
-
* - Custom breakpoint configuration
|
|
246
|
-
*
|
|
247
|
-
* Perfect for responsive layouts and conditional rendering based on screen size.
|
|
248
|
-
*/
|
|
249
|
-
/**
|
|
250
202
|
* Creates default breakpoint configuration.
|
|
251
203
|
*
|
|
252
204
|
* @returns The default breakpoint configuration object.
|
|
@@ -390,7 +342,7 @@ function createBreakpoints(_options = {}) {
|
|
|
390
342
|
* ```
|
|
391
343
|
*/
|
|
392
344
|
function createBreakpointsContext(_options = {}) {
|
|
393
|
-
const { namespace = "v0:breakpoints"
|
|
345
|
+
const { namespace = "v0:breakpoints", ...options } = _options;
|
|
394
346
|
const [useBreakpointsContext, _provideBreakpointsContext] = createContext(namespace);
|
|
395
347
|
const context = createBreakpoints(options);
|
|
396
348
|
function provideBreakpointsContext(_context = context, app) {
|
|
@@ -434,7 +386,7 @@ function createBreakpointsContext(_options = {}) {
|
|
|
434
386
|
* ```
|
|
435
387
|
*/
|
|
436
388
|
function createBreakpointsPlugin(_options = {}) {
|
|
437
|
-
const { namespace = "v0:breakpoints"
|
|
389
|
+
const { namespace = "v0:breakpoints", ...options } = _options;
|
|
438
390
|
const [, provideBreakpointsContext, context] = createBreakpointsContext({
|
|
439
391
|
...options,
|
|
440
392
|
namespace
|
|
@@ -492,25 +444,217 @@ function useBreakpoints(namespace = "v0:breakpoints") {
|
|
|
492
444
|
}
|
|
493
445
|
|
|
494
446
|
//#endregion
|
|
495
|
-
//#region src/composables/
|
|
447
|
+
//#region src/composables/useClickOutside/index.ts
|
|
496
448
|
/**
|
|
497
|
-
*
|
|
449
|
+
* Detects clicks outside of the specified element(s).
|
|
498
450
|
*
|
|
499
|
-
*
|
|
451
|
+
* Uses two-phase detection (pointerdown → pointerup) to prevent false positives
|
|
452
|
+
* when users drag from inside to outside an element.
|
|
453
|
+
*
|
|
454
|
+
* @param target Element ref(s) to detect clicks outside of. Accepts a single ref/getter or array of refs/getters.
|
|
455
|
+
* @param handler Callback invoked when a click outside is detected.
|
|
456
|
+
* @param options Configuration options.
|
|
457
|
+
* @returns An object with methods to control the listener.
|
|
458
|
+
*
|
|
459
|
+
* @see https://0.vuetifyjs.com/composables/system/use-click-outside
|
|
500
460
|
*
|
|
501
|
-
* @
|
|
502
|
-
*
|
|
461
|
+
* @example Native element ref
|
|
462
|
+
* ```ts
|
|
463
|
+
* const menuRef = useTemplateRef<HTMLElement>('menu')
|
|
503
464
|
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
* - Token features with $variation support
|
|
507
|
-
* - Auto-selection of enabled features
|
|
508
|
-
* - Multi-select support for feature combinations
|
|
509
|
-
* - Perfect for A/B testing, progressive rollout, feature toggles
|
|
465
|
+
* useClickOutside(menuRef, () => { isOpen.value = false })
|
|
466
|
+
* ```
|
|
510
467
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
468
|
+
* @example Component ref (e.g., Atom)
|
|
469
|
+
* ```ts
|
|
470
|
+
* const atomRef = useTemplateRef<AtomExpose>('atom')
|
|
471
|
+
*
|
|
472
|
+
* // Pass the exposed element TemplateRef via getter
|
|
473
|
+
* useClickOutside(
|
|
474
|
+
* () => atomRef.value?.element,
|
|
475
|
+
* () => { isOpen.value = false }
|
|
476
|
+
* )
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @example Multiple targets
|
|
480
|
+
* ```ts
|
|
481
|
+
* const popoverRef = useTemplateRef<AtomExpose>('popover')
|
|
482
|
+
* const anchorRef = useTemplateRef<HTMLElement>('anchor')
|
|
483
|
+
*
|
|
484
|
+
* useClickOutside(
|
|
485
|
+
* [() => popoverRef.value?.element, anchorRef],
|
|
486
|
+
* () => { isOpen.value = false }
|
|
487
|
+
* )
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* @example Ignoring elements (CSS selectors or refs)
|
|
491
|
+
* ```ts
|
|
492
|
+
* useClickOutside(
|
|
493
|
+
* () => navRef.value?.element,
|
|
494
|
+
* () => { isOpen.value = false },
|
|
495
|
+
* { ignore: ['[data-app-bar]'] }
|
|
496
|
+
* )
|
|
497
|
+
* ```
|
|
513
498
|
*/
|
|
499
|
+
function useClickOutside(target, handler, options = {}) {
|
|
500
|
+
const { capture = true, touchScrollThreshold = 30, detectIframe = false, ignore = [] } = options;
|
|
501
|
+
const isPaused = shallowRef(false);
|
|
502
|
+
const isActive = toRef(() => !isPaused.value);
|
|
503
|
+
let initialTarget = null;
|
|
504
|
+
let startPosition = {
|
|
505
|
+
x: 0,
|
|
506
|
+
y: 0
|
|
507
|
+
};
|
|
508
|
+
let cleanupPointerDown;
|
|
509
|
+
let cleanupPointerUp;
|
|
510
|
+
let cleanupBlur;
|
|
511
|
+
/**
|
|
512
|
+
* Resolve target(s) to an array of HTMLElements.
|
|
513
|
+
*/
|
|
514
|
+
function getTargets() {
|
|
515
|
+
return (Array.isArray(target) ? target : [target]).map((source) => toValue(source)).filter((el) => !/* @__PURE__ */ isNullOrUndefined(el));
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Resolve ignore targets to a tuple of [selectors, elements].
|
|
519
|
+
* Called once per event to avoid repeated toValue() calls in hot path.
|
|
520
|
+
*/
|
|
521
|
+
function resolveIgnoreTargets() {
|
|
522
|
+
const ignoreTargets = toValue(ignore);
|
|
523
|
+
if (ignoreTargets.length === 0) return [[], []];
|
|
524
|
+
const selectors = [];
|
|
525
|
+
const elements = [];
|
|
526
|
+
for (const ignoreTarget of ignoreTargets) if (/* @__PURE__ */ isString(ignoreTarget)) selectors.push(ignoreTarget);
|
|
527
|
+
else {
|
|
528
|
+
const ignoreEl = toValue(ignoreTarget);
|
|
529
|
+
if (ignoreEl) elements.push(ignoreEl);
|
|
530
|
+
}
|
|
531
|
+
return [selectors, elements];
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Check if an element matches resolved ignore targets.
|
|
535
|
+
*/
|
|
536
|
+
function isIgnored(el, selectors, elements) {
|
|
537
|
+
if (!el) return false;
|
|
538
|
+
for (const selector of selectors) try {
|
|
539
|
+
if (el.matches(selector) || !/* @__PURE__ */ isNull(el.closest(selector))) return true;
|
|
540
|
+
} catch {}
|
|
541
|
+
for (const ignoreEl of elements) if (ignoreEl === el || ignoreEl.contains(el)) return true;
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Check if any element in the event path should be ignored.
|
|
546
|
+
*/
|
|
547
|
+
function shouldIgnore(path) {
|
|
548
|
+
const [selectors, elements] = resolveIgnoreTargets();
|
|
549
|
+
if (selectors.length === 0 && elements.length === 0) return false;
|
|
550
|
+
return path.some((node) => node instanceof Element && isIgnored(node, selectors, elements));
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Check if the event target is outside all target elements.
|
|
554
|
+
*/
|
|
555
|
+
function isOutside(eventTarget) {
|
|
556
|
+
if (!eventTarget) return false;
|
|
557
|
+
if (!(eventTarget instanceof Node)) return false;
|
|
558
|
+
const targets = getTargets();
|
|
559
|
+
if (targets.length === 0) return false;
|
|
560
|
+
return targets.every((el) => {
|
|
561
|
+
return el !== eventTarget && !el.contains(eventTarget);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Validate that the target is still in the DOM.
|
|
566
|
+
*/
|
|
567
|
+
function isValidTarget(eventTarget) {
|
|
568
|
+
if (!(eventTarget instanceof Element)) return false;
|
|
569
|
+
if (!eventTarget.isConnected) return false;
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Handle pointerdown - store initial target and position.
|
|
574
|
+
*/
|
|
575
|
+
function onPointerDown(event) {
|
|
576
|
+
if (isPaused.value) return;
|
|
577
|
+
if (event.defaultPrevented) return;
|
|
578
|
+
initialTarget = event.composedPath()[0] ?? event.target;
|
|
579
|
+
startPosition = {
|
|
580
|
+
x: event.clientX,
|
|
581
|
+
y: event.clientY
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Handle pointerup - check if it's an outside click.
|
|
586
|
+
*/
|
|
587
|
+
function onPointerUp(event) {
|
|
588
|
+
if (isPaused.value) return;
|
|
589
|
+
if (event.defaultPrevented) return;
|
|
590
|
+
if (!initialTarget) return;
|
|
591
|
+
const pointerdownTarget = initialTarget;
|
|
592
|
+
initialTarget = null;
|
|
593
|
+
if (!isValidTarget(pointerdownTarget)) return;
|
|
594
|
+
const path = event.composedPath();
|
|
595
|
+
const pointerupTarget = path[0] ?? event.target;
|
|
596
|
+
if (event.pointerType === "touch") {
|
|
597
|
+
const dx = Math.abs(event.clientX - startPosition.x);
|
|
598
|
+
const dy = Math.abs(event.clientY - startPosition.y);
|
|
599
|
+
if (dx >= touchScrollThreshold || dy >= touchScrollThreshold) return;
|
|
600
|
+
}
|
|
601
|
+
if (isOutside(pointerdownTarget) && isOutside(pointerupTarget) && !shouldIgnore(path)) handler(event);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Handle window blur - detect focus moving to iframe.
|
|
605
|
+
*/
|
|
606
|
+
function onBlur(event) {
|
|
607
|
+
if (isPaused.value) return;
|
|
608
|
+
if (event.defaultPrevented) return;
|
|
609
|
+
if (document.activeElement instanceof HTMLIFrameElement) {
|
|
610
|
+
const iframeIsOutside = getTargets().every((el) => !el.contains(document.activeElement));
|
|
611
|
+
const [selectors, elements] = resolveIgnoreTargets();
|
|
612
|
+
if (iframeIsOutside && !isIgnored(document.activeElement, selectors, elements)) handler(event);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function setup() {
|
|
616
|
+
cleanupPointerDown = useDocumentEventListener("pointerdown", onPointerDown, capture);
|
|
617
|
+
cleanupPointerUp = useDocumentEventListener("pointerup", onPointerUp, capture);
|
|
618
|
+
if (!detectIframe) return;
|
|
619
|
+
cleanupBlur = useWindowEventListener("blur", onBlur, capture);
|
|
620
|
+
}
|
|
621
|
+
function cleanup() {
|
|
622
|
+
cleanupPointerDown?.();
|
|
623
|
+
cleanupPointerUp?.();
|
|
624
|
+
cleanupBlur?.();
|
|
625
|
+
cleanupPointerDown = void 0;
|
|
626
|
+
cleanupPointerUp = void 0;
|
|
627
|
+
cleanupBlur = void 0;
|
|
628
|
+
}
|
|
629
|
+
function pause() {
|
|
630
|
+
if (isPaused.value) return;
|
|
631
|
+
isPaused.value = true;
|
|
632
|
+
initialTarget = null;
|
|
633
|
+
cleanup();
|
|
634
|
+
}
|
|
635
|
+
function resume() {
|
|
636
|
+
if (!isPaused.value) return;
|
|
637
|
+
isPaused.value = false;
|
|
638
|
+
setup();
|
|
639
|
+
}
|
|
640
|
+
function stop() {
|
|
641
|
+
isPaused.value = true;
|
|
642
|
+
initialTarget = null;
|
|
643
|
+
cleanup();
|
|
644
|
+
}
|
|
645
|
+
setup();
|
|
646
|
+
onScopeDispose(stop, true);
|
|
647
|
+
return {
|
|
648
|
+
isActive: shallowReadonly(isActive),
|
|
649
|
+
isPaused: shallowReadonly(isPaused),
|
|
650
|
+
pause,
|
|
651
|
+
resume,
|
|
652
|
+
stop
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/composables/useFeatures/index.ts
|
|
514
658
|
/**
|
|
515
659
|
* Creates a new features instance.
|
|
516
660
|
*
|
|
@@ -535,7 +679,7 @@ function useBreakpoints(namespace = "v0:breakpoints") {
|
|
|
535
679
|
* ```
|
|
536
680
|
*/
|
|
537
681
|
function createFeatures(_options = {}) {
|
|
538
|
-
const { features
|
|
682
|
+
const { features, ...options } = _options;
|
|
539
683
|
const tokens = createTokens(features, { flat: true });
|
|
540
684
|
const registry = createGroup(options);
|
|
541
685
|
for (const [id, { value }] of tokens.entries()) register({
|
|
@@ -589,7 +733,7 @@ function createFeatures(_options = {}) {
|
|
|
589
733
|
* ```
|
|
590
734
|
*/
|
|
591
735
|
function createFeaturesContext(_options = {}) {
|
|
592
|
-
const { namespace = "v0:features"
|
|
736
|
+
const { namespace = "v0:features", ...options } = _options;
|
|
593
737
|
const [useFeaturesContext, _provideFeaturesContext] = createContext(namespace);
|
|
594
738
|
const context = createFeatures(options);
|
|
595
739
|
function provideFeaturesContext(_context = context, app) {
|
|
@@ -628,7 +772,7 @@ function createFeaturesContext(_options = {}) {
|
|
|
628
772
|
* ```
|
|
629
773
|
*/
|
|
630
774
|
function createFeaturesPlugin(_options = {}) {
|
|
631
|
-
const { namespace = "v0:features"
|
|
775
|
+
const { namespace = "v0:features", ...options } = _options;
|
|
632
776
|
const [, provideFeaturesContext, context] = createFeaturesContext({
|
|
633
777
|
...options,
|
|
634
778
|
namespace
|
|
@@ -671,21 +815,6 @@ function useFeatures(namespace = "v0:features") {
|
|
|
671
815
|
|
|
672
816
|
//#endregion
|
|
673
817
|
//#region src/composables/useFilter/index.ts
|
|
674
|
-
/**
|
|
675
|
-
* @module useFilter
|
|
676
|
-
*
|
|
677
|
-
* @remarks
|
|
678
|
-
* Reactive array filtering composable with multiple filter modes.
|
|
679
|
-
*
|
|
680
|
-
* Key features:
|
|
681
|
-
* - Four filter modes: some, every, union, intersection
|
|
682
|
-
* - Case-insensitive filtering
|
|
683
|
-
* - Custom filter functions
|
|
684
|
-
* - Reactive updates
|
|
685
|
-
* - Perfect for search, multi-criteria filtering
|
|
686
|
-
*
|
|
687
|
-
* Filters arrays based on query strings with configurable matching strategies.
|
|
688
|
-
*/
|
|
689
818
|
function defaultFilter(query, item, keys, mode = "some") {
|
|
690
819
|
const queries = Array.isArray(query) ? query.map((q) => String(q).toLowerCase()) : [String(query).toLowerCase()];
|
|
691
820
|
function match(value, q) {
|
|
@@ -699,6 +828,89 @@ function defaultFilter(query, item, keys, mode = "some") {
|
|
|
699
828
|
return false;
|
|
700
829
|
}
|
|
701
830
|
/**
|
|
831
|
+
* Creates a filter context with pre-configured options.
|
|
832
|
+
*
|
|
833
|
+
* @param options The filter options
|
|
834
|
+
* @template Z The type of the items
|
|
835
|
+
* @template E The type of the filter context
|
|
836
|
+
* @returns A filter context
|
|
837
|
+
*
|
|
838
|
+
* @see https://0.vuetifyjs.com/composables/utilities/use-filter
|
|
839
|
+
*
|
|
840
|
+
* @example
|
|
841
|
+
* ```ts
|
|
842
|
+
* import { createFilter } from '@vuetify/v0'
|
|
843
|
+
*
|
|
844
|
+
* const filter = createFilter({
|
|
845
|
+
* mode: 'intersection',
|
|
846
|
+
* keys: ['name', 'email'],
|
|
847
|
+
* })
|
|
848
|
+
*
|
|
849
|
+
* const { items } = filter.apply(query, users)
|
|
850
|
+
* ```
|
|
851
|
+
*/
|
|
852
|
+
function createFilter(options = {}) {
|
|
853
|
+
const { customFilter, keys, mode = "some" } = options;
|
|
854
|
+
const filterFunction = customFilter ?? ((q, i) => defaultFilter(q, i, keys, mode));
|
|
855
|
+
const query = toRef("");
|
|
856
|
+
function apply(_query, items) {
|
|
857
|
+
const itemsRef = isRef(items) ? items : toRef(() => items);
|
|
858
|
+
const queryRef = toRef(_query);
|
|
859
|
+
return { items: computed(() => {
|
|
860
|
+
const q = toValue(queryRef);
|
|
861
|
+
query.value = q;
|
|
862
|
+
const queries = (Array.isArray(q) ? q : [q]).filter((q$1) => String(q$1).trim());
|
|
863
|
+
if (queries.length === 0) return itemsRef.value;
|
|
864
|
+
const queryParam = queries.length === 1 ? queries[0] : queries;
|
|
865
|
+
return itemsRef.value.filter((item) => filterFunction(queryParam, item));
|
|
866
|
+
}) };
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
mode,
|
|
870
|
+
keys,
|
|
871
|
+
customFilter,
|
|
872
|
+
query,
|
|
873
|
+
apply
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Creates a filter context with dependency injection support.
|
|
878
|
+
*
|
|
879
|
+
* @param options The filter context options
|
|
880
|
+
* @template Z The type of the items
|
|
881
|
+
* @template E The type of the filter context
|
|
882
|
+
* @returns A trinity tuple: [useContext, provideContext, defaultContext]
|
|
883
|
+
*
|
|
884
|
+
* @see https://0.vuetifyjs.com/composables/utilities/use-filter
|
|
885
|
+
*
|
|
886
|
+
* @example
|
|
887
|
+
* ```ts
|
|
888
|
+
* import { createFilterContext } from '@vuetify/v0'
|
|
889
|
+
*
|
|
890
|
+
* export const [useSearchFilter, provideSearchFilter, searchFilter] = createFilterContext({
|
|
891
|
+
* namespace: 'app:search',
|
|
892
|
+
* mode: 'union',
|
|
893
|
+
* keys: ['title', 'description'],
|
|
894
|
+
* })
|
|
895
|
+
*
|
|
896
|
+
* // In parent component
|
|
897
|
+
* provideSearchFilter()
|
|
898
|
+
*
|
|
899
|
+
* // In child component
|
|
900
|
+
* const filter = useSearchFilter()
|
|
901
|
+
* const { items } = filter.apply(query, products)
|
|
902
|
+
* ```
|
|
903
|
+
*/
|
|
904
|
+
function createFilterContext(_options = {}) {
|
|
905
|
+
const { namespace = "v0:filter", ...options } = _options;
|
|
906
|
+
const [useFilterContext$1, _provideFilterContext] = createContext(namespace);
|
|
907
|
+
const context = createFilter(options);
|
|
908
|
+
function provideFilterContext(_context = context, app) {
|
|
909
|
+
return _provideFilterContext(_context, app);
|
|
910
|
+
}
|
|
911
|
+
return createTrinity(useFilterContext$1, provideFilterContext, context);
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
702
914
|
* A reusable function for filtering an array of items.
|
|
703
915
|
*
|
|
704
916
|
* @param query The query to filter by.
|
|
@@ -727,37 +939,34 @@ function defaultFilter(query, item, keys, mode = "some") {
|
|
|
727
939
|
* ```
|
|
728
940
|
*/
|
|
729
941
|
function useFilter(query, items, options = {}) {
|
|
730
|
-
|
|
731
|
-
const filterFunction = customFilter ?? ((q, i) => defaultFilter(q, i, keys, mode));
|
|
732
|
-
const itemsRef = isRef(items) ? items : toRef(() => items);
|
|
733
|
-
const queryRef = toRef(query);
|
|
734
|
-
return { items: computed(() => {
|
|
735
|
-
const q = toValue(queryRef);
|
|
736
|
-
const queries = (Array.isArray(q) ? q : [q]).filter((q$1) => String(q$1).trim());
|
|
737
|
-
if (queries.length === 0) return itemsRef.value;
|
|
738
|
-
const queryParam = queries.length === 1 ? queries[0] : queries;
|
|
739
|
-
return itemsRef.value.filter((item) => filterFunction(queryParam, item));
|
|
740
|
-
}) };
|
|
942
|
+
return createFilter(options).apply(query, items);
|
|
741
943
|
}
|
|
742
|
-
|
|
743
|
-
//#endregion
|
|
744
|
-
//#region src/composables/useForm/index.ts
|
|
745
944
|
/**
|
|
746
|
-
*
|
|
945
|
+
* Returns the current filter context from dependency injection.
|
|
946
|
+
*
|
|
947
|
+
* @param namespace The namespace for the filter context. Defaults to `'v0:filter'`.
|
|
948
|
+
* @template Z The type of the items.
|
|
949
|
+
* @template E The type of the filter context.
|
|
950
|
+
* @returns The current filter context.
|
|
747
951
|
*
|
|
748
|
-
* @
|
|
749
|
-
* Form validation composable with async rule support and multiple validation modes.
|
|
952
|
+
* @see https://0.vuetifyjs.com/composables/utilities/use-filter
|
|
750
953
|
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
* - isPristine tracking
|
|
756
|
-
* - Silent validation mode
|
|
757
|
-
* - Form-level validation and reset
|
|
954
|
+
* @example
|
|
955
|
+
* ```vue
|
|
956
|
+
* <script setup lang="ts">
|
|
957
|
+
* import { useFilterContext } from '@vuetify/v0'
|
|
758
958
|
*
|
|
759
|
-
*
|
|
959
|
+
* const filter = useFilterContext()
|
|
960
|
+
* const { items } = filter.apply(query, products)
|
|
961
|
+
* <\/script>
|
|
962
|
+
* ```
|
|
760
963
|
*/
|
|
964
|
+
function useFilterContext(namespace = "v0:filter") {
|
|
965
|
+
return useContext(namespace);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region src/composables/useForm/index.ts
|
|
761
970
|
/**
|
|
762
971
|
* Creates a new form instance.
|
|
763
972
|
*
|
|
@@ -926,7 +1135,7 @@ function createForm(options) {
|
|
|
926
1135
|
* ```
|
|
927
1136
|
*/
|
|
928
1137
|
function createFormContext(_options = {}) {
|
|
929
|
-
const { namespace = "v0:form"
|
|
1138
|
+
const { namespace = "v0:form", ...options } = _options;
|
|
930
1139
|
const [useFormContext, _provideFormContext] = createContext(namespace);
|
|
931
1140
|
const context = createForm(options);
|
|
932
1141
|
function provideFormContext(_context = context, app) {
|
|
@@ -964,22 +1173,6 @@ function useForm(namespace = "v0:form") {
|
|
|
964
1173
|
//#endregion
|
|
965
1174
|
//#region src/composables/useIntersectionObserver/index.ts
|
|
966
1175
|
/**
|
|
967
|
-
* @module useIntersectionObserver
|
|
968
|
-
*
|
|
969
|
-
* @remarks
|
|
970
|
-
* IntersectionObserver composable with lifecycle management.
|
|
971
|
-
*
|
|
972
|
-
* Key features:
|
|
973
|
-
* - IntersectionObserver API wrapper
|
|
974
|
-
* - Pause/resume/stop functionality
|
|
975
|
-
* - Automatic cleanup on unmount
|
|
976
|
-
* - SSR-safe (checks SUPPORTS_INTERSECTION_OBSERVER)
|
|
977
|
-
* - Hydration-aware
|
|
978
|
-
* - Immediate callback option
|
|
979
|
-
*
|
|
980
|
-
* Perfect for lazy loading, infinite scroll, and visibility detection.
|
|
981
|
-
*/
|
|
982
|
-
/**
|
|
983
1176
|
* A composable that uses the Intersection Observer API to detect when an element
|
|
984
1177
|
* is visible in the viewport.
|
|
985
1178
|
*
|
|
@@ -1020,12 +1213,14 @@ function useForm(namespace = "v0:form") {
|
|
|
1020
1213
|
*/
|
|
1021
1214
|
function useIntersectionObserver(target, callback, options = {}) {
|
|
1022
1215
|
const { isHydrated } = useHydration();
|
|
1216
|
+
const targetRef = isRef(target) ? target : shallowRef(target);
|
|
1023
1217
|
const observer = shallowRef();
|
|
1024
1218
|
const isPaused = shallowRef(false);
|
|
1025
1219
|
const isIntersecting = shallowRef(false);
|
|
1026
1220
|
const isActive = toRef(() => !!observer.value);
|
|
1027
1221
|
function setup() {
|
|
1028
|
-
if (
|
|
1222
|
+
if (observer.value === null) return;
|
|
1223
|
+
if (!isHydrated.value || !SUPPORTS_INTERSECTION_OBSERVER || !targetRef.value || isPaused.value) return;
|
|
1029
1224
|
observer.value = new IntersectionObserver((entries) => {
|
|
1030
1225
|
const transformedEntries = entries.map((entry) => ({
|
|
1031
1226
|
boundingClientRect: entry.boundingClientRect,
|
|
@@ -1039,26 +1234,29 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
1039
1234
|
const latestEntry = transformedEntries.at(-1);
|
|
1040
1235
|
if (latestEntry) isIntersecting.value = latestEntry.isIntersecting;
|
|
1041
1236
|
callback(transformedEntries);
|
|
1237
|
+
if (options.once && latestEntry?.isIntersecting) stop();
|
|
1042
1238
|
}, {
|
|
1043
1239
|
root: options.root || null,
|
|
1044
1240
|
rootMargin: options.rootMargin || "0px",
|
|
1045
1241
|
threshold: options.threshold || 0
|
|
1046
1242
|
});
|
|
1047
|
-
observer.value.observe(
|
|
1243
|
+
observer.value.observe(targetRef.value);
|
|
1048
1244
|
if (options.immediate) callback([{
|
|
1049
|
-
boundingClientRect:
|
|
1245
|
+
boundingClientRect: targetRef.value.getBoundingClientRect(),
|
|
1050
1246
|
intersectionRatio: 0,
|
|
1051
1247
|
intersectionRect: new DOMRect(0, 0, 0, 0),
|
|
1052
1248
|
isIntersecting: false,
|
|
1053
1249
|
rootBounds: null,
|
|
1054
|
-
target:
|
|
1250
|
+
target: targetRef.value,
|
|
1055
1251
|
time: performance.now()
|
|
1056
1252
|
}]);
|
|
1057
1253
|
}
|
|
1058
|
-
|
|
1254
|
+
watchEffect(() => {
|
|
1255
|
+
const hydrated = isHydrated.value;
|
|
1256
|
+
const target$1 = targetRef.value;
|
|
1059
1257
|
cleanup();
|
|
1060
|
-
setup();
|
|
1061
|
-
}
|
|
1258
|
+
if (hydrated && target$1) setup();
|
|
1259
|
+
});
|
|
1062
1260
|
function cleanup() {
|
|
1063
1261
|
if (observer.value) {
|
|
1064
1262
|
observer.value.disconnect();
|
|
@@ -1076,6 +1274,7 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
1076
1274
|
}
|
|
1077
1275
|
function stop() {
|
|
1078
1276
|
cleanup();
|
|
1277
|
+
observer.value = null;
|
|
1079
1278
|
}
|
|
1080
1279
|
onScopeDispose(stop, true);
|
|
1081
1280
|
return {
|
|
@@ -1147,20 +1346,6 @@ function useElementIntersection(target, options = {}) {
|
|
|
1147
1346
|
//#endregion
|
|
1148
1347
|
//#region src/composables/useKeydown/index.ts
|
|
1149
1348
|
/**
|
|
1150
|
-
* @module useKeydown
|
|
1151
|
-
*
|
|
1152
|
-
* @remarks
|
|
1153
|
-
* Keydown event listener composable with key filtering.
|
|
1154
|
-
*
|
|
1155
|
-
* Key features:
|
|
1156
|
-
* - Key-specific event handling
|
|
1157
|
-
* - preventDefault and stopPropagation options
|
|
1158
|
-
* - Automatic cleanup on scope disposal
|
|
1159
|
-
* - Built on useEventListener for consistent event handling
|
|
1160
|
-
*
|
|
1161
|
-
* Simplified wrapper around useEventListener for keyboard interactions.
|
|
1162
|
-
*/
|
|
1163
|
-
/**
|
|
1164
1349
|
* A composable that adds a keydown event listener to the document.
|
|
1165
1350
|
*
|
|
1166
1351
|
* @param handlers The key handlers to add.
|
|
@@ -1172,6 +1357,10 @@ function useElementIntersection(target, options = {}) {
|
|
|
1172
1357
|
* ```ts
|
|
1173
1358
|
* import { useKeydown } from '@vuetify/v0'
|
|
1174
1359
|
*
|
|
1360
|
+
* // Single handler
|
|
1361
|
+
* useKeydown({ key: 'Escape', handler: () => console.log('Escape pressed') })
|
|
1362
|
+
*
|
|
1363
|
+
* // Multiple handlers
|
|
1175
1364
|
* const { isActive, start, stop } = useKeydown([
|
|
1176
1365
|
* { key: 'Enter', handler: () => console.log('Enter pressed') },
|
|
1177
1366
|
* { key: 'Escape', handler: () => console.log('Escape pressed'), preventDefault: true },
|
|
@@ -1216,22 +1405,6 @@ function useKeydown(handlers) {
|
|
|
1216
1405
|
//#endregion
|
|
1217
1406
|
//#region src/composables/useMutationObserver/index.ts
|
|
1218
1407
|
/**
|
|
1219
|
-
* @module useMutationObserver
|
|
1220
|
-
*
|
|
1221
|
-
* @remarks
|
|
1222
|
-
* MutationObserver composable with lifecycle management.
|
|
1223
|
-
*
|
|
1224
|
-
* Key features:
|
|
1225
|
-
* - MutationObserver API wrapper
|
|
1226
|
-
* - Pause/resume/stop functionality
|
|
1227
|
-
* - Automatic cleanup on unmount
|
|
1228
|
-
* - SSR-safe (checks SUPPORTS_MUTATION_OBSERVER)
|
|
1229
|
-
* - Hydration-aware
|
|
1230
|
-
* - Configurable observation options (childList, attributes, characterData, etc.)
|
|
1231
|
-
*
|
|
1232
|
-
* Perfect for detecting DOM changes and responding to mutations.
|
|
1233
|
-
*/
|
|
1234
|
-
/**
|
|
1235
1408
|
* A composable that uses the Mutation Observer API to detect changes in the DOM.
|
|
1236
1409
|
*
|
|
1237
1410
|
* @param target The element to observe.
|
|
@@ -1278,7 +1451,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1278
1451
|
const { isHydrated } = useHydration();
|
|
1279
1452
|
const observer = shallowRef();
|
|
1280
1453
|
const isPaused = shallowRef(false);
|
|
1281
|
-
const isActive =
|
|
1454
|
+
const isActive = toRef(() => !!observer.value);
|
|
1282
1455
|
const observerOptions = {
|
|
1283
1456
|
childList: options.childList ?? true,
|
|
1284
1457
|
attributes: options.attributes ?? false,
|
|
@@ -1289,6 +1462,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1289
1462
|
attributeFilter: options.attributeFilter
|
|
1290
1463
|
};
|
|
1291
1464
|
function setup() {
|
|
1465
|
+
if (observer.value === null) return;
|
|
1292
1466
|
if (!isHydrated.value || !SUPPORTS_MUTATION_OBSERVER || !target.value || isPaused.value) return;
|
|
1293
1467
|
observer.value = new MutationObserver((mutations) => {
|
|
1294
1468
|
callback(mutations.map((mutation) => ({
|
|
@@ -1302,6 +1476,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1302
1476
|
attributeNamespace: mutation.attributeNamespace,
|
|
1303
1477
|
oldValue: mutation.oldValue
|
|
1304
1478
|
})));
|
|
1479
|
+
if (options.once) stop();
|
|
1305
1480
|
});
|
|
1306
1481
|
observer.value.observe(target.value, observerOptions);
|
|
1307
1482
|
if (options.immediate) {
|
|
@@ -1322,12 +1497,15 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1322
1497
|
attributeNamespace: null,
|
|
1323
1498
|
oldValue: null
|
|
1324
1499
|
}]);
|
|
1500
|
+
if (options.once) stop();
|
|
1325
1501
|
}
|
|
1326
1502
|
}
|
|
1327
|
-
|
|
1503
|
+
watchEffect(() => {
|
|
1504
|
+
const hydrated = isHydrated.value;
|
|
1505
|
+
const el = target.value;
|
|
1328
1506
|
cleanup();
|
|
1329
|
-
setup();
|
|
1330
|
-
}
|
|
1507
|
+
if (hydrated && el) setup();
|
|
1508
|
+
});
|
|
1331
1509
|
function cleanup() {
|
|
1332
1510
|
if (observer.value) {
|
|
1333
1511
|
observer.value.disconnect();
|
|
@@ -1344,6 +1522,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1344
1522
|
}
|
|
1345
1523
|
function stop() {
|
|
1346
1524
|
cleanup();
|
|
1525
|
+
observer.value = null;
|
|
1347
1526
|
}
|
|
1348
1527
|
onScopeDispose(stop, true);
|
|
1349
1528
|
return {
|
|
@@ -1376,23 +1555,6 @@ var Vuetify0PermissionAdapter = class extends PermissionAdapter {
|
|
|
1376
1555
|
//#endregion
|
|
1377
1556
|
//#region src/composables/usePermissions/index.ts
|
|
1378
1557
|
/**
|
|
1379
|
-
* @module usePermissions
|
|
1380
|
-
*
|
|
1381
|
-
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
1382
|
-
*
|
|
1383
|
-
* @remarks
|
|
1384
|
-
* Permission management composable with support for RBAC and ABAC patterns.
|
|
1385
|
-
*
|
|
1386
|
-
* Key features:
|
|
1387
|
-
* - Role-Based Access Control (RBAC) support
|
|
1388
|
-
* - Attribute-Based Access Control (ABAC) with context
|
|
1389
|
-
* - Functional permission conditions
|
|
1390
|
-
* - Token-based permission storage
|
|
1391
|
-
* - Adapter pattern for custom permission systems
|
|
1392
|
-
*
|
|
1393
|
-
* Built on useTokens for flexible permission configuration.
|
|
1394
|
-
*/
|
|
1395
|
-
/**
|
|
1396
1558
|
* Creates a new permissions instance.
|
|
1397
1559
|
*
|
|
1398
1560
|
* @param options The options for the permissions instance.
|
|
@@ -1416,7 +1578,7 @@ var Vuetify0PermissionAdapter = class extends PermissionAdapter {
|
|
|
1416
1578
|
* ```
|
|
1417
1579
|
*/
|
|
1418
1580
|
function createPermissions(_options = {}) {
|
|
1419
|
-
const { adapter = new Vuetify0PermissionAdapter(), permissions = {}
|
|
1581
|
+
const { adapter = new Vuetify0PermissionAdapter(), permissions = {}, ...options } = _options;
|
|
1420
1582
|
const record = {};
|
|
1421
1583
|
for (const role in permissions) {
|
|
1422
1584
|
if (!record[role]) record[role] = {};
|
|
@@ -1458,7 +1620,7 @@ function createPermissions(_options = {}) {
|
|
|
1458
1620
|
* ```
|
|
1459
1621
|
*/
|
|
1460
1622
|
function createPermissionsContext(_options = {}) {
|
|
1461
|
-
const { namespace = "v0:permissions"
|
|
1623
|
+
const { namespace = "v0:permissions", ...options } = _options;
|
|
1462
1624
|
const [usePermissionsContext, _providePermissionsContext] = createContext(namespace);
|
|
1463
1625
|
const context = createPermissions(options);
|
|
1464
1626
|
function providePermissionsContext(_context = context, app) {
|
|
@@ -1497,7 +1659,7 @@ function createPermissionsContext(_options = {}) {
|
|
|
1497
1659
|
* ```
|
|
1498
1660
|
*/
|
|
1499
1661
|
function createPermissionsPlugin(_options = {}) {
|
|
1500
|
-
const { namespace = "v0:permissions"
|
|
1662
|
+
const { namespace = "v0:permissions", ...options } = _options;
|
|
1501
1663
|
const [, providePermissionContext, context] = createPermissionsContext({
|
|
1502
1664
|
...options,
|
|
1503
1665
|
namespace
|
|
@@ -1539,21 +1701,6 @@ function usePermissions(namespace = "v0:permissions") {
|
|
|
1539
1701
|
//#endregion
|
|
1540
1702
|
//#region src/composables/useQueue/index.ts
|
|
1541
1703
|
/**
|
|
1542
|
-
* @module useQueue
|
|
1543
|
-
*
|
|
1544
|
-
* @remarks
|
|
1545
|
-
* A queue composable for managing time-based collections with:
|
|
1546
|
-
* - Automatic timeout-based removal
|
|
1547
|
-
* - Pause/resume functionality
|
|
1548
|
-
* - FIFO (First In, First Out) ordering
|
|
1549
|
-
* - Manual dismissal support
|
|
1550
|
-
* - Queue progression management
|
|
1551
|
-
*
|
|
1552
|
-
* Built on top of useRegistry, the queue automatically manages timeouts for tickets,
|
|
1553
|
-
* ensuring only the first ticket in the queue is active at any time. When an ticket
|
|
1554
|
-
* expires or is removed, the next ticket in the queue automatically becomes active.
|
|
1555
|
-
*/
|
|
1556
|
-
/**
|
|
1557
1704
|
* Creates a new queue instance
|
|
1558
1705
|
*
|
|
1559
1706
|
* @param options The options for the queue instance
|
|
@@ -1585,7 +1732,7 @@ function usePermissions(namespace = "v0:permissions") {
|
|
|
1585
1732
|
* ```
|
|
1586
1733
|
*/
|
|
1587
1734
|
function createQueue(_options = {}) {
|
|
1588
|
-
const { timeout: _timeout = 3e3
|
|
1735
|
+
const { timeout: _timeout = 3e3, ...options } = _options;
|
|
1589
1736
|
const registry = useRegistry({
|
|
1590
1737
|
...options,
|
|
1591
1738
|
events: true
|
|
@@ -1680,7 +1827,6 @@ function createQueue(_options = {}) {
|
|
|
1680
1827
|
/**
|
|
1681
1828
|
* Creates a new queue context.
|
|
1682
1829
|
*
|
|
1683
|
-
* @param namespace The namespace for the queue context.
|
|
1684
1830
|
* @param options The options for the queue context.
|
|
1685
1831
|
* @template Z The type of the queue ticket.
|
|
1686
1832
|
* @template E The type of the queue context.
|
|
@@ -1692,13 +1838,13 @@ function createQueue(_options = {}) {
|
|
|
1692
1838
|
* ```ts
|
|
1693
1839
|
* import { createQueueContext } from '@vuetify/v0'
|
|
1694
1840
|
*
|
|
1695
|
-
* export const [useQueue, provideQueue] = createQueueContext(
|
|
1841
|
+
* export const [useQueue, provideQueue, context] = createQueueContext({
|
|
1696
1842
|
* timeout: 5000,
|
|
1697
1843
|
* })
|
|
1698
1844
|
* ```
|
|
1699
1845
|
*/
|
|
1700
|
-
function createQueueContext(_options) {
|
|
1701
|
-
const { namespace
|
|
1846
|
+
function createQueueContext(_options = {}) {
|
|
1847
|
+
const { namespace = "v0:queue", ...options } = _options;
|
|
1702
1848
|
const [useQueueContext, _provideQueueContext] = createContext(namespace);
|
|
1703
1849
|
const context = createQueue(options);
|
|
1704
1850
|
function provideQueueContext(_context = context, app) {
|
|
@@ -1756,21 +1902,6 @@ var MemoryAdapter = class {
|
|
|
1756
1902
|
//#endregion
|
|
1757
1903
|
//#region src/composables/useStorage/index.ts
|
|
1758
1904
|
/**
|
|
1759
|
-
* @module useStorage
|
|
1760
|
-
*
|
|
1761
|
-
* @remarks
|
|
1762
|
-
* Reactive storage composable with adapter pattern for localStorage, sessionStorage, or memory.
|
|
1763
|
-
*
|
|
1764
|
-
* Key features:
|
|
1765
|
-
* - Reactive refs that sync with storage
|
|
1766
|
-
* - localStorage, sessionStorage, and memory adapters
|
|
1767
|
-
* - Custom serialization support
|
|
1768
|
-
* - SSR fallback to memory adapter
|
|
1769
|
-
* - Automatic cleanup on remove/clear
|
|
1770
|
-
*
|
|
1771
|
-
* Uses adapter pattern to abstract storage implementation details.
|
|
1772
|
-
*/
|
|
1773
|
-
/**
|
|
1774
1905
|
* Creates a new storage instance.
|
|
1775
1906
|
*
|
|
1776
1907
|
* @param options The options for the storage instance.
|
|
@@ -1856,7 +1987,7 @@ function createStorage(options = {}) {
|
|
|
1856
1987
|
};
|
|
1857
1988
|
}
|
|
1858
1989
|
function createStorageContext(_options = {}) {
|
|
1859
|
-
const { namespace = "v0:storage"
|
|
1990
|
+
const { namespace = "v0:storage", ...options } = _options;
|
|
1860
1991
|
const [useStorageContext, _provideStorageContext] = createContext(namespace);
|
|
1861
1992
|
const context = createStorage(options);
|
|
1862
1993
|
function provideStorageContext(_context = context, app) {
|
|
@@ -1886,7 +2017,7 @@ function createStorageContext(_options = {}) {
|
|
|
1886
2017
|
* ```
|
|
1887
2018
|
*/
|
|
1888
2019
|
function createStoragePlugin(_options = {}) {
|
|
1889
|
-
const { namespace = "v0:storage"
|
|
2020
|
+
const { namespace = "v0:storage", ...options } = _options;
|
|
1890
2021
|
const [, provideStorageContext, context] = createStorageContext({
|
|
1891
2022
|
...options,
|
|
1892
2023
|
namespace
|
|
@@ -2007,24 +2138,6 @@ var Vuetify0ThemeAdapter = class extends ThemeAdapter {
|
|
|
2007
2138
|
//#endregion
|
|
2008
2139
|
//#region src/composables/useTheme/index.ts
|
|
2009
2140
|
/**
|
|
2010
|
-
* @module useTheme
|
|
2011
|
-
*
|
|
2012
|
-
* @see https://0.vuetifyjs.com/composables/plugins/use-theme
|
|
2013
|
-
*
|
|
2014
|
-
* @remarks
|
|
2015
|
-
* Theme management composable with token resolution and CSS variable injection.
|
|
2016
|
-
*
|
|
2017
|
-
* Key features:
|
|
2018
|
-
* - Single-selection theme switching (extends createSingle)
|
|
2019
|
-
* - Token alias resolution via useTokens
|
|
2020
|
-
* - Lazy theme loading (compute colors only when selected)
|
|
2021
|
-
* - CSS variable generation via adapter pattern
|
|
2022
|
-
* - SSR support with head integration
|
|
2023
|
-
* - Theme cycling
|
|
2024
|
-
*
|
|
2025
|
-
* Integrates with createSingle for selection and useTokens for color resolution.
|
|
2026
|
-
*/
|
|
2027
|
-
/**
|
|
2028
2141
|
* Creates a new theme instance.
|
|
2029
2142
|
*
|
|
2030
2143
|
* @param options The options for the theme instance.
|
|
@@ -2059,14 +2172,14 @@ var Vuetify0ThemeAdapter = class extends ThemeAdapter {
|
|
|
2059
2172
|
* ```
|
|
2060
2173
|
*/
|
|
2061
2174
|
function createTheme(_options = {}) {
|
|
2062
|
-
const { themes = {}, palette = {}
|
|
2175
|
+
const { themes = {}, palette = {}, ...options } = _options;
|
|
2063
2176
|
const tokens = createTokens({
|
|
2064
2177
|
palette,
|
|
2065
2178
|
...themes
|
|
2066
2179
|
}, { flat: true });
|
|
2067
2180
|
const registry = createSingle(options);
|
|
2068
2181
|
for (const id in themes) {
|
|
2069
|
-
const { colors: value
|
|
2182
|
+
const { colors: value, ...theme } = themes[id];
|
|
2070
2183
|
register({
|
|
2071
2184
|
id,
|
|
2072
2185
|
value,
|
|
@@ -2148,7 +2261,7 @@ function createTheme(_options = {}) {
|
|
|
2148
2261
|
* ```
|
|
2149
2262
|
*/
|
|
2150
2263
|
function createThemeContext(_options = {}) {
|
|
2151
|
-
const { namespace = "v0:theme"
|
|
2264
|
+
const { namespace = "v0:theme", ...options } = _options;
|
|
2152
2265
|
const [useThemeContext, _provideThemeContext] = createContext(namespace);
|
|
2153
2266
|
const context = createTheme(options);
|
|
2154
2267
|
function provideThemeContext(_context = context, app) {
|
|
@@ -2198,7 +2311,7 @@ function createThemeContext(_options = {}) {
|
|
|
2198
2311
|
* ```
|
|
2199
2312
|
*/
|
|
2200
2313
|
function createThemePlugin(_options = {}) {
|
|
2201
|
-
const { adapter = new Vuetify0ThemeAdapter(), namespace = "v0:theme", palette = {}, themes = {}, target
|
|
2314
|
+
const { adapter = new Vuetify0ThemeAdapter(), namespace = "v0:theme", palette = {}, themes = {}, target, ...options } = _options;
|
|
2202
2315
|
const [, provideThemeContext, context] = createThemeContext({
|
|
2203
2316
|
...options,
|
|
2204
2317
|
namespace,
|
|
@@ -2245,21 +2358,6 @@ function useTheme(namespace = "v0:theme") {
|
|
|
2245
2358
|
//#endregion
|
|
2246
2359
|
//#region src/composables/useTimeline/index.ts
|
|
2247
2360
|
/**
|
|
2248
|
-
* @module useTimeline
|
|
2249
|
-
*
|
|
2250
|
-
* @remarks
|
|
2251
|
-
* Bounded undo/redo system with overflow management.
|
|
2252
|
-
*
|
|
2253
|
-
* Key features:
|
|
2254
|
-
* - Fixed-size history (default: 10 items)
|
|
2255
|
-
* - Undo/redo stack management
|
|
2256
|
-
* - Overflow queue (preserves oldest items)
|
|
2257
|
-
* - Automatic reindexing after operations
|
|
2258
|
-
* - Perfect for command pattern, history tracking
|
|
2259
|
-
*
|
|
2260
|
-
* Extends useRegistry with temporal navigation capabilities.
|
|
2261
|
-
*/
|
|
2262
|
-
/**
|
|
2263
2361
|
* Creates a new timeline instance.
|
|
2264
2362
|
*
|
|
2265
2363
|
* @param _options The options for the timeline instance.
|
|
@@ -2287,7 +2385,7 @@ function useTheme(namespace = "v0:theme") {
|
|
|
2287
2385
|
* ```
|
|
2288
2386
|
*/
|
|
2289
2387
|
function createTimeline(_options = {}) {
|
|
2290
|
-
const { size = 10
|
|
2388
|
+
const { size = 10, ...options } = _options;
|
|
2291
2389
|
const registry = useRegistry(options);
|
|
2292
2390
|
const stack = [];
|
|
2293
2391
|
const overflow = [];
|
|
@@ -2362,7 +2460,7 @@ function createTimeline(_options = {}) {
|
|
|
2362
2460
|
* ```
|
|
2363
2461
|
*/
|
|
2364
2462
|
function createTimelineContext(_options = {}) {
|
|
2365
|
-
const { namespace = "v0:timeline"
|
|
2463
|
+
const { namespace = "v0:timeline", ...options } = _options;
|
|
2366
2464
|
const [useTimelineContext, _provideTimelineContext] = createContext(namespace);
|
|
2367
2465
|
const context = createTimeline(options);
|
|
2368
2466
|
function provideTimelineContext(_context = context, app) {
|
|
@@ -2394,24 +2492,6 @@ function useTimeline(namespace = "v0:timeline") {
|
|
|
2394
2492
|
//#endregion
|
|
2395
2493
|
//#region src/composables/useToggleScope/index.ts
|
|
2396
2494
|
/**
|
|
2397
|
-
* @module useToggleScope
|
|
2398
|
-
*
|
|
2399
|
-
* @remarks
|
|
2400
|
-
* Conditionally manages an effect scope based on a reactive boolean condition.
|
|
2401
|
-
* When the source becomes true, creates and runs an effect scope. When false, stops the scope.
|
|
2402
|
-
* All reactive effects created within the scoped function are automatically cleaned up on deactivation.
|
|
2403
|
-
*
|
|
2404
|
-
* Key features:
|
|
2405
|
-
* - Uses Vue's effectScope for efficient reactive effect lifecycle management
|
|
2406
|
-
* - Automatic cleanup when condition becomes false
|
|
2407
|
-
* - Supports optional reset callback for scope restart capability
|
|
2408
|
-
* - Handles rapid toggling and parent scope disposal safely
|
|
2409
|
-
* - SSR-safe (effectScope is part of Vue core)
|
|
2410
|
-
*
|
|
2411
|
-
* Perfect for conditional side effects, feature flags, and performance optimization
|
|
2412
|
-
* by only running reactive effects when needed.
|
|
2413
|
-
*/
|
|
2414
|
-
/**
|
|
2415
2495
|
* Conditionally manages an effect scope based on a reactive boolean source.
|
|
2416
2496
|
*
|
|
2417
2497
|
* @param source A reactive boolean value or getter that controls the scope lifecycle
|
|
@@ -2493,24 +2573,6 @@ function useToggleScope(source, fn) {
|
|
|
2493
2573
|
//#endregion
|
|
2494
2574
|
//#region src/composables/useVirtual/index.ts
|
|
2495
2575
|
/**
|
|
2496
|
-
* @module useVirtual
|
|
2497
|
-
*
|
|
2498
|
-
* @remarks
|
|
2499
|
-
* Virtual scrolling composable for efficiently rendering large lists.
|
|
2500
|
-
*
|
|
2501
|
-
* Key features:
|
|
2502
|
-
* - Renders only visible items (viewport + overscan)
|
|
2503
|
-
* - Dynamic or fixed item heights
|
|
2504
|
-
* - SSR-safe (checks IN_BROWSER)
|
|
2505
|
-
* - Bidirectional scrolling (forward/reverse for chat apps)
|
|
2506
|
-
* - Scroll anchoring (maintains position across data changes)
|
|
2507
|
-
* - Edge detection for infinite scroll
|
|
2508
|
-
* - iOS momentum and elastic scrolling
|
|
2509
|
-
* - Configurable overscan (extra items rendered for smooth scrolling)
|
|
2510
|
-
*
|
|
2511
|
-
* Perfect for large data sets, chat apps, and infinite scroll implementations.
|
|
2512
|
-
*/
|
|
2513
|
-
/**
|
|
2514
2576
|
* Virtual scrolling composable for efficiently rendering large lists
|
|
2515
2577
|
*
|
|
2516
2578
|
* @param items Reactive array of items to virtualize
|
|
@@ -2747,6 +2809,11 @@ function useVirtual(items, _options = {}) {
|
|
|
2747
2809
|
element.value.scrollTop = totalHeight;
|
|
2748
2810
|
}
|
|
2749
2811
|
}
|
|
2812
|
+
onScopeDispose(() => {
|
|
2813
|
+
cancelAnimationFrame(raf);
|
|
2814
|
+
cancelAnimationFrame(rebuildRaf);
|
|
2815
|
+
cancelAnimationFrame(edgeRaf);
|
|
2816
|
+
}, true);
|
|
2750
2817
|
return {
|
|
2751
2818
|
element,
|
|
2752
2819
|
items: computedItems,
|
|
@@ -2762,4 +2829,4 @@ function useVirtual(items, _options = {}) {
|
|
|
2762
2829
|
}
|
|
2763
2830
|
|
|
2764
2831
|
//#endregion
|
|
2765
|
-
export { useForm as A,
|
|
2832
|
+
export { useForm as A, createBreakpoints as B, PermissionAdapter as C, useIntersectionObserver as D, useElementIntersection as E, createFeatures as F, useEventListener as G, createBreakpointsPlugin as H, createFeaturesContext as I, useWindowEventListener as K, createFeaturesPlugin as L, createFilterContext as M, useFilter as N, createForm as O, useFilterContext as P, useFeatures as R, usePermissions as S, useKeydown as T, useBreakpoints as U, createBreakpointsContext as V, useDocumentEventListener as W, createQueueContext as _, useTimeline as a, createPermissionsContext as b, createThemePlugin as c, createStorage as d, createStorageContext as f, createQueue as g, MemoryAdapter as h, createTimelineContext as i, createFilter as j, createFormContext as k, useTheme as l, useStorage as m, useToggleScope as n, createTheme as o, createStoragePlugin as p, toReactive as q, createTimeline as r, createThemeContext as s, useVirtual as t, Vuetify0ThemeAdapter as u, useQueue as v, useMutationObserver as w, createPermissionsPlugin as x, createPermissions as y, useClickOutside as z };
|