@vuetify/v0 0.0.7 → 0.0.8
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.md +21 -0
- package/README.md +62 -189
- package/dist/browser/index.js +1072 -535
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +4 -4
- package/dist/{components-ClYPFhaF.js → components-BJF0Dsww.js} +4 -188
- package/dist/composables/index.d.ts +2 -2
- package/dist/composables/index.js +3 -3
- package/dist/{composables-DkRocfS_.js → composables-D-M1DZRo.js} +1071 -352
- package/dist/constants/index.js +1 -1
- package/dist/{globals-BQnaatWT.js → globals-B2jAuapu.js} +1 -1
- package/dist/{index-BoDCUSPn.d.ts → index-Bcj8Vovs.d.ts} +1104 -251
- package/dist/index-DoTdnxOm.d.ts +241 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/index-BVouO8cc.d.ts +0 -410
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, createBlock, createCommentVNode, createPropsRestProxy, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, inject, isRef, mergeModels, mergeProps, normalizeProps, normalizeStyle, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, renderSlot, resolveDynamicComponent, shallowReactive, shallowReadonly, shallowRef, toRef, toValue, unref, useAttrs, useId, useModel, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
|
|
2
2
|
|
|
3
3
|
//#region src/constants/htmlElements.ts
|
|
4
4
|
const selfClosingTags = [
|
|
@@ -120,20 +120,25 @@ var Atom_default = Atom_vue_vue_type_script_setup_true_lang_default;
|
|
|
120
120
|
* Injects a context provided by an ancestor component.
|
|
121
121
|
*
|
|
122
122
|
* @param key The key of the context to inject.
|
|
123
|
+
* @param defaultValue Optional default value if context is not found.
|
|
123
124
|
* @template Z The type of the context.
|
|
124
125
|
* @returns The injected context.
|
|
125
|
-
* @throws An error if the context is not found.
|
|
126
|
+
* @throws An error if the context is not found and no default is provided.
|
|
126
127
|
*
|
|
127
128
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html#inject
|
|
128
|
-
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
129
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context#use-context
|
|
129
130
|
*
|
|
130
131
|
* @example
|
|
131
132
|
* ```ts
|
|
132
|
-
*
|
|
133
|
+
* // Without default value
|
|
134
|
+
* const context = useContext<MyContext>('my-context')
|
|
135
|
+
*
|
|
136
|
+
* // With default value
|
|
137
|
+
* const context = useContext<MyContext>('my-context', defaultContext)
|
|
133
138
|
* ```
|
|
134
139
|
*/
|
|
135
|
-
function useContext(key) {
|
|
136
|
-
const context = inject(key,
|
|
140
|
+
function useContext(key, defaultValue) {
|
|
141
|
+
const context = inject(key, defaultValue);
|
|
137
142
|
if (context === void 0) throw new Error(`Context "${String(key)}" not found. Ensure it's provided by an ancestor.`);
|
|
138
143
|
return context;
|
|
139
144
|
}
|
|
@@ -142,43 +147,58 @@ function useContext(key) {
|
|
|
142
147
|
*
|
|
143
148
|
* @param key The key of the context to provide.
|
|
144
149
|
* @param context The context to provide.
|
|
145
|
-
* @param app
|
|
150
|
+
* @param app Optional Vue app instance to provide the context at app level instead of component level.
|
|
146
151
|
* @template Z The type of the context.
|
|
147
152
|
* @returns The provided context.
|
|
148
153
|
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* When `app` parameter is provided, the context is made available to all components in the app.
|
|
156
|
+
* When omitted, the context is provided at the current component level and available to descendants only.
|
|
157
|
+
*
|
|
149
158
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
|
|
150
|
-
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
159
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context#provide-context
|
|
151
160
|
*
|
|
152
161
|
* @example
|
|
153
162
|
* ```ts
|
|
154
|
-
*
|
|
163
|
+
* // Component-level provision
|
|
164
|
+
* provideContext<MyContext>('my-context', context)
|
|
165
|
+
*
|
|
166
|
+
* // App-level provision (typically used in plugins)
|
|
167
|
+
* const app = createApp()
|
|
168
|
+
* provideContext<MyContext>('my-context', context, app)
|
|
155
169
|
* ```
|
|
156
170
|
*/
|
|
157
171
|
function provideContext(key, context, app) {
|
|
158
|
-
app
|
|
172
|
+
if (app) app.provide(key, context);
|
|
173
|
+
else provide(key, context);
|
|
159
174
|
return context;
|
|
160
175
|
}
|
|
161
176
|
/**
|
|
162
177
|
* Creates a new context for providing and injecting data.
|
|
163
178
|
*
|
|
164
179
|
* @param key The key of the context to create.
|
|
180
|
+
* @param defaultValue Optional default value if context is not found.
|
|
165
181
|
* @template Z The type of the context.
|
|
166
182
|
* @returns A tuple containing the `useContext` and `provideContext` functions.
|
|
167
183
|
*
|
|
168
184
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html
|
|
169
|
-
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
185
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context#create-context
|
|
170
186
|
*
|
|
171
187
|
* @example
|
|
172
188
|
* ```ts
|
|
173
|
-
*
|
|
189
|
+
* // Without default value
|
|
190
|
+
* const [useMyContext, provideMyContext] = createContext<MyContext>('my-context')
|
|
191
|
+
*
|
|
192
|
+
* // With default value
|
|
193
|
+
* const [useMyContext, provideMyContext] = createContext<MyContext>('my-context', defaultContext)
|
|
174
194
|
* ```
|
|
175
195
|
*/
|
|
176
|
-
function createContext(_key) {
|
|
196
|
+
function createContext(_key, defaultValue) {
|
|
177
197
|
function _provideContext(context, app) {
|
|
178
198
|
return provideContext(_key, context, app);
|
|
179
199
|
}
|
|
180
200
|
function _useContext(key = _key) {
|
|
181
|
-
return useContext(key);
|
|
201
|
+
return useContext(key, defaultValue);
|
|
182
202
|
}
|
|
183
203
|
return [_useContext, _provideContext];
|
|
184
204
|
}
|
|
@@ -191,8 +211,7 @@ function createContext(_key) {
|
|
|
191
211
|
* @param options The plugin options.
|
|
192
212
|
* @returns A new Vue plugin.
|
|
193
213
|
*
|
|
194
|
-
* @see https://
|
|
195
|
-
* @see https://0.vuetifyjs.com/composables/foundation/create-plugin
|
|
214
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-plugin#create-plugin
|
|
196
215
|
*
|
|
197
216
|
* @example
|
|
198
217
|
* ```ts
|
|
@@ -224,13 +243,21 @@ function createPlugin(options) {
|
|
|
224
243
|
/**
|
|
225
244
|
* Creates a new trinity for a context composable and its provider.
|
|
226
245
|
*
|
|
227
|
-
* @param createContext The function that
|
|
228
|
-
* @param provideContext The function that provides the context.
|
|
229
|
-
* @param context The context to
|
|
246
|
+
* @param createContext The function that retrieves/uses the context (typically named `useContext`).
|
|
247
|
+
* @param provideContext The function that provides the context to descendants.
|
|
248
|
+
* @param context The default context instance to use when no custom context is provided.
|
|
230
249
|
* @template Z The type of the context.
|
|
231
|
-
* @returns A
|
|
250
|
+
* @returns A readonly tuple containing: [useContext function, provideContext wrapper function, default context instance].
|
|
251
|
+
*
|
|
252
|
+
* @remarks The trinity pattern is a foundational pattern used throughout the codebase for creating reusable context systems. It provides three related elements:
|
|
253
|
+
*
|
|
254
|
+
* 1. A function to retrieve/use the context
|
|
255
|
+
* 2. A function to provide the context (with default value support)
|
|
256
|
+
* 3. The default context instance
|
|
257
|
+
*
|
|
258
|
+
* The returned tuple is readonly (using `as const`) to ensure proper type inference.
|
|
232
259
|
*
|
|
233
|
-
* @see https://0.vuetifyjs.com/composables/foundation/create-trinity
|
|
260
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-trinity#create-trinity
|
|
234
261
|
*
|
|
235
262
|
* @example
|
|
236
263
|
* ```ts
|
|
@@ -250,6 +277,7 @@ function createPlugin(options) {
|
|
|
250
277
|
*
|
|
251
278
|
* return createTrinity<E>(useContext, provideContext, context)
|
|
252
279
|
* }
|
|
280
|
+
* ```
|
|
253
281
|
*/
|
|
254
282
|
function createTrinity(createContext$1, provideContext$1, context) {
|
|
255
283
|
return [
|
|
@@ -351,7 +379,7 @@ function toArray(value) {
|
|
|
351
379
|
* @template Z The type of the object.
|
|
352
380
|
* @returns The converted object.
|
|
353
381
|
*
|
|
354
|
-
* @see https://
|
|
382
|
+
* @see https://0.vuetifyjs.com/composables/transformers/to-reactive
|
|
355
383
|
*
|
|
356
384
|
* @example
|
|
357
385
|
* ```ts
|
|
@@ -464,7 +492,6 @@ function toReactive(objectRef) {
|
|
|
464
492
|
|
|
465
493
|
//#endregion
|
|
466
494
|
//#region src/composables/useHydration/index.ts
|
|
467
|
-
const [useHydrationContext, provideHydrationContext] = createContext("v0:hydration");
|
|
468
495
|
/**
|
|
469
496
|
* Creates a new hydration instance.
|
|
470
497
|
*
|
|
@@ -476,7 +503,10 @@ const [useHydrationContext, provideHydrationContext] = createContext("v0:hydrati
|
|
|
476
503
|
* ```ts
|
|
477
504
|
* import { createHydration } from '@vuetify/v0'
|
|
478
505
|
*
|
|
479
|
-
* const
|
|
506
|
+
* const hydration = createHydration()
|
|
507
|
+
* console.log(hydration.isHydrated.value) // false
|
|
508
|
+
* hydration.hydrate()
|
|
509
|
+
* console.log(hydration.isHydrated.value) // true
|
|
480
510
|
* ```
|
|
481
511
|
*/
|
|
482
512
|
function createHydration() {
|
|
@@ -490,33 +520,37 @@ function createHydration() {
|
|
|
490
520
|
};
|
|
491
521
|
}
|
|
492
522
|
/**
|
|
493
|
-
*
|
|
523
|
+
* Creates a new hydration context trinity.
|
|
494
524
|
*
|
|
495
|
-
* @
|
|
525
|
+
* @param options Options for creating the hydration context.
|
|
526
|
+
* @template E The type of the hydration context.
|
|
527
|
+
* @returns A new hydration context trinity.
|
|
496
528
|
*
|
|
497
529
|
* @see https://0.vuetifyjs.com/composables/plugins/use-hydration
|
|
498
530
|
*
|
|
499
531
|
* @example
|
|
500
|
-
* ```
|
|
501
|
-
*
|
|
502
|
-
* import { useHydration } from '@vuetify/v0'
|
|
503
|
-
*
|
|
504
|
-
* const hydration = useHydration()
|
|
505
|
-
* <\/script>
|
|
532
|
+
* ```ts
|
|
533
|
+
* import { createHydrationContext } from '@vuetify/v0'
|
|
506
534
|
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
* </div>
|
|
511
|
-
* </template>
|
|
535
|
+
* export const [useHydrationContext, provideHydrationContext, context] = createHydrationContext({
|
|
536
|
+
* namespace: 'app:hydration',
|
|
537
|
+
* })
|
|
512
538
|
* ```
|
|
513
539
|
*/
|
|
514
|
-
function
|
|
515
|
-
|
|
540
|
+
function createHydrationContext(_options = {}) {
|
|
541
|
+
const { namespace = "v0:hydration" } = _options;
|
|
542
|
+
const [useHydrationContext, _provideHydrationContext] = createContext(namespace);
|
|
543
|
+
const context = createHydration();
|
|
544
|
+
function provideHydrationContext(_context = context, app) {
|
|
545
|
+
return _provideHydrationContext(_context, app);
|
|
546
|
+
}
|
|
547
|
+
return createTrinity(useHydrationContext, provideHydrationContext, context);
|
|
516
548
|
}
|
|
517
549
|
/**
|
|
518
550
|
* Creates a new hydration plugin.
|
|
519
551
|
*
|
|
552
|
+
* @param options The options for the hydration plugin.
|
|
553
|
+
* @template E The type of the hydration context.
|
|
520
554
|
* @returns A new hydration plugin.
|
|
521
555
|
*
|
|
522
556
|
* @see https://0.vuetifyjs.com/composables/plugins/use-hydration
|
|
@@ -527,19 +561,21 @@ function useHydration() {
|
|
|
527
561
|
* import { createHydrationPlugin } from '@vuetify/v0'
|
|
528
562
|
* import App from './App.vue'
|
|
529
563
|
*
|
|
530
|
-
* const plugin = createHydrationPlugin()
|
|
531
|
-
*
|
|
532
564
|
* const app = createApp(App)
|
|
533
565
|
*
|
|
534
|
-
* app.use(
|
|
566
|
+
* app.use(createHydrationPlugin())
|
|
535
567
|
*
|
|
536
568
|
* app.mount('#app')
|
|
537
569
|
* ```
|
|
538
570
|
*/
|
|
539
|
-
function createHydrationPlugin() {
|
|
540
|
-
const
|
|
571
|
+
function createHydrationPlugin(_options = {}) {
|
|
572
|
+
const { namespace = "v0:hydration",...options } = _options;
|
|
573
|
+
const [, provideHydrationContext, context] = createHydrationContext({
|
|
574
|
+
...options,
|
|
575
|
+
namespace
|
|
576
|
+
});
|
|
541
577
|
return createPlugin({
|
|
542
|
-
namespace
|
|
578
|
+
namespace,
|
|
543
579
|
provide: (app) => {
|
|
544
580
|
provideHydrationContext(context, app);
|
|
545
581
|
},
|
|
@@ -551,6 +587,32 @@ function createHydrationPlugin() {
|
|
|
551
587
|
}
|
|
552
588
|
});
|
|
553
589
|
}
|
|
590
|
+
/**
|
|
591
|
+
* Returns the current hydration instance.
|
|
592
|
+
*
|
|
593
|
+
* @param namespace The namespace for the hydration context. Defaults to `v0:hydration`.
|
|
594
|
+
* @returns The current hydration instance.
|
|
595
|
+
*
|
|
596
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-hydration
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```vue
|
|
600
|
+
* <script setup lang="ts">
|
|
601
|
+
* import { useHydration } from '@vuetify/v0'
|
|
602
|
+
*
|
|
603
|
+
* const hydration = useHydration()
|
|
604
|
+
* <\/script>
|
|
605
|
+
*
|
|
606
|
+
* <template>
|
|
607
|
+
* <div>
|
|
608
|
+
* <p>Is hydrated: {{ hydration.isHydrated.value }}</p>
|
|
609
|
+
* </div>
|
|
610
|
+
* </template>
|
|
611
|
+
* ```
|
|
612
|
+
*/
|
|
613
|
+
function useHydration(namespace = "v0:hydration") {
|
|
614
|
+
return useContext(namespace);
|
|
615
|
+
}
|
|
554
616
|
|
|
555
617
|
//#endregion
|
|
556
618
|
//#region src/constants/globals.ts
|
|
@@ -560,7 +622,7 @@ const SUPPORTS_MATCH_MEDIA = IN_BROWSER && "matchMedia" in window && typeof wind
|
|
|
560
622
|
const SUPPORTS_OBSERVER = IN_BROWSER && "ResizeObserver" in window;
|
|
561
623
|
const SUPPORTS_INTERSECTION_OBSERVER = IN_BROWSER && "IntersectionObserver" in window;
|
|
562
624
|
const SUPPORTS_MUTATION_OBSERVER = IN_BROWSER && "MutationObserver" in window;
|
|
563
|
-
const version = "0.0.
|
|
625
|
+
const version = "0.0.8";
|
|
564
626
|
const __LOGGER_ENABLED__ = false;
|
|
565
627
|
|
|
566
628
|
//#endregion
|
|
@@ -586,7 +648,6 @@ function createDefaultBreakpoints() {
|
|
|
586
648
|
/**
|
|
587
649
|
* Creates a new breakpoints instance.
|
|
588
650
|
*
|
|
589
|
-
* @param namespace The namespace to use for the breakpoints instance.
|
|
590
651
|
* @param options The options for the breakpoints instance.
|
|
591
652
|
* @template E The type of the breakpoints context.
|
|
592
653
|
* @returns A new breakpoints instance.
|
|
@@ -597,7 +658,8 @@ function createDefaultBreakpoints() {
|
|
|
597
658
|
* ```ts
|
|
598
659
|
* import { createBreakpoints } from '@vuetify/v0'
|
|
599
660
|
*
|
|
600
|
-
* export const [useBreakpoints, provideBreakpoints] = createBreakpoints(
|
|
661
|
+
* export const [useBreakpoints, provideBreakpoints] = createBreakpoints({
|
|
662
|
+
* namespace: 'v0:breakpoints',
|
|
601
663
|
* mobileBreakpoint: 'sm',
|
|
602
664
|
* breakpoints: {
|
|
603
665
|
* xs: 0,
|
|
@@ -610,12 +672,11 @@ function createDefaultBreakpoints() {
|
|
|
610
672
|
* })
|
|
611
673
|
* ```
|
|
612
674
|
*/
|
|
613
|
-
function createBreakpoints(
|
|
614
|
-
const
|
|
615
|
-
const
|
|
616
|
-
const sorted = Object.entries(breakpoints).sort((a, b) => a[1] - b[1]);
|
|
675
|
+
function createBreakpoints(_options = {}) {
|
|
676
|
+
const { mobileBreakpoint, breakpoints } = /* @__PURE__ */ mergeDeep(createDefaultBreakpoints(), _options);
|
|
677
|
+
const sorted = Object.entries(breakpoints).toSorted((a, b) => a[1] - b[1]);
|
|
617
678
|
const names = sorted.map(([n]) => n);
|
|
618
|
-
const mb =
|
|
679
|
+
const mb = /* @__PURE__ */ isNumber(mobileBreakpoint) ? mobileBreakpoint : breakpoints[mobileBreakpoint] ?? breakpoints.md;
|
|
619
680
|
const name = shallowRef("xs");
|
|
620
681
|
const width = shallowRef(0);
|
|
621
682
|
const height = shallowRef(0);
|
|
@@ -665,21 +726,7 @@ function createBreakpoints(namespace = "v0:breakpoints", options = {}) {
|
|
|
665
726
|
xlAndDown.value = index <= 4;
|
|
666
727
|
xxlAndDown.value = index <= 5;
|
|
667
728
|
}
|
|
668
|
-
|
|
669
|
-
const { isHydrated } = useHydration();
|
|
670
|
-
if (isHydrated.value) update();
|
|
671
|
-
watch(isHydrated, (hydrated) => {
|
|
672
|
-
if (hydrated) update();
|
|
673
|
-
}, { immediate: true });
|
|
674
|
-
});
|
|
675
|
-
if (IN_BROWSER) {
|
|
676
|
-
function listener() {
|
|
677
|
-
update();
|
|
678
|
-
}
|
|
679
|
-
window.addEventListener("resize", listener, { passive: true });
|
|
680
|
-
onScopeDispose(() => window.removeEventListener("resize", listener), true);
|
|
681
|
-
}
|
|
682
|
-
const context = {
|
|
729
|
+
return {
|
|
683
730
|
breakpoints,
|
|
684
731
|
name: readonly(name),
|
|
685
732
|
width: readonly(width),
|
|
@@ -703,36 +750,34 @@ function createBreakpoints(namespace = "v0:breakpoints", options = {}) {
|
|
|
703
750
|
xxlAndDown: readonly(xxlAndDown),
|
|
704
751
|
update
|
|
705
752
|
};
|
|
706
|
-
function provideBreakpointsContext(_context = context, app) {
|
|
707
|
-
return _provideBreakpointsContext(_context, app);
|
|
708
|
-
}
|
|
709
|
-
return createTrinity(useBreakpointsContext, provideBreakpointsContext, context);
|
|
710
753
|
}
|
|
711
754
|
/**
|
|
712
|
-
*
|
|
755
|
+
* Creates a new breakpoints context.
|
|
713
756
|
*
|
|
714
|
-
* @
|
|
757
|
+
* @param options The options for the breakpoints context.
|
|
758
|
+
* @template E The type of the breakpoints context.
|
|
759
|
+
* @returns A new breakpoints context.
|
|
715
760
|
*
|
|
716
761
|
* @see https://0.vuetifyjs.com/composables/plugins/use-breakpoints
|
|
717
762
|
*
|
|
718
763
|
* @example
|
|
719
|
-
* ```
|
|
720
|
-
*
|
|
721
|
-
* import { useBreakpoints } from '@vuetify/v0'
|
|
722
|
-
*
|
|
723
|
-
* const { isMobile, mdAndUp } = useBreakpoints()
|
|
724
|
-
* <\/script>
|
|
764
|
+
* ```ts
|
|
765
|
+
* import { createBreakpointsContext } from '@vuetify/v0'
|
|
725
766
|
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
* </div>
|
|
731
|
-
* </template>
|
|
767
|
+
* export const [useBreakpoints, provideBreakpoints, context] = createBreakpointsContext({
|
|
768
|
+
* namespace: 'v0:breakpoints',
|
|
769
|
+
* mobileBreakpoint: 'sm',
|
|
770
|
+
* })
|
|
732
771
|
* ```
|
|
733
772
|
*/
|
|
734
|
-
function
|
|
735
|
-
|
|
773
|
+
function createBreakpointsContext(_options = {}) {
|
|
774
|
+
const { namespace = "v0:breakpoints",...options } = _options;
|
|
775
|
+
const [useBreakpointsContext, _provideBreakpointsContext] = createContext(namespace);
|
|
776
|
+
const context = createBreakpoints(options);
|
|
777
|
+
function provideBreakpointsContext(_context = context, app) {
|
|
778
|
+
return _provideBreakpointsContext(_context, app);
|
|
779
|
+
}
|
|
780
|
+
return createTrinity(useBreakpointsContext, provideBreakpointsContext, context);
|
|
736
781
|
}
|
|
737
782
|
/**
|
|
738
783
|
* Creates a new breakpoints plugin.
|
|
@@ -753,6 +798,7 @@ function useBreakpoints() {
|
|
|
753
798
|
*
|
|
754
799
|
* app.use(
|
|
755
800
|
* createBreakpointsPlugin({
|
|
801
|
+
* namespace: 'v0:breakpoints',
|
|
756
802
|
* mobileBreakpoint: 'sm',
|
|
757
803
|
* breakpoints: {
|
|
758
804
|
* xs: 0,
|
|
@@ -768,20 +814,63 @@ function useBreakpoints() {
|
|
|
768
814
|
* app.mount('#app')
|
|
769
815
|
* ```
|
|
770
816
|
*/
|
|
771
|
-
function createBreakpointsPlugin(
|
|
772
|
-
const
|
|
817
|
+
function createBreakpointsPlugin(_options = {}) {
|
|
818
|
+
const { namespace = "v0:breakpoints",...options } = _options;
|
|
819
|
+
const [, provideBreakpointsContext, context] = createBreakpointsContext({
|
|
820
|
+
...options,
|
|
821
|
+
namespace
|
|
822
|
+
});
|
|
773
823
|
return createPlugin({
|
|
774
|
-
namespace
|
|
824
|
+
namespace,
|
|
775
825
|
provide: (app) => {
|
|
776
826
|
provideBreakpointsContext(context, app);
|
|
777
827
|
},
|
|
778
828
|
setup: (app) => {
|
|
779
829
|
app.mixin({ mounted() {
|
|
780
|
-
|
|
830
|
+
if (this.$parent !== null) return;
|
|
831
|
+
const hydration = useHydration();
|
|
832
|
+
function listener() {
|
|
833
|
+
context.update();
|
|
834
|
+
}
|
|
835
|
+
const unwatch = watch(hydration.isHydrated, (hydrated) => {
|
|
836
|
+
if (hydrated) listener();
|
|
837
|
+
}, { immediate: true });
|
|
838
|
+
window.addEventListener("resize", listener, { passive: true });
|
|
839
|
+
onScopeDispose(() => {
|
|
840
|
+
window.removeEventListener("resize", listener);
|
|
841
|
+
unwatch();
|
|
842
|
+
}, true);
|
|
781
843
|
} });
|
|
782
844
|
}
|
|
783
845
|
});
|
|
784
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* Returns the current breakpoints instance.
|
|
849
|
+
*
|
|
850
|
+
* @param namespace The namespace for the breakpoints context. Defaults to `v0:breakpoints`.
|
|
851
|
+
* @returns The current breakpoints instance.
|
|
852
|
+
*
|
|
853
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-breakpoints
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* ```vue
|
|
857
|
+
* <script setup lang="ts">
|
|
858
|
+
* import { useBreakpoints } from '@vuetify/v0'
|
|
859
|
+
*
|
|
860
|
+
* const { isMobile, mdAndUp } = useBreakpoints()
|
|
861
|
+
* <\/script>
|
|
862
|
+
*
|
|
863
|
+
* <template>
|
|
864
|
+
* <div class="pa-4">
|
|
865
|
+
* <p v-if="isMobile.value">Mobile layout active</p>
|
|
866
|
+
* <p v-else-if="mdAndUp.value">Medium and up layout active</p>
|
|
867
|
+
* </div>
|
|
868
|
+
* </template>
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
function useBreakpoints(namespace = "v0:breakpoints") {
|
|
872
|
+
return useContext(namespace);
|
|
873
|
+
}
|
|
785
874
|
|
|
786
875
|
//#endregion
|
|
787
876
|
//#region src/composables/useEventListener/index.ts
|
|
@@ -922,7 +1011,7 @@ var PinoLoggerAdapter = class {
|
|
|
922
1011
|
}
|
|
923
1012
|
format(message, ...args) {
|
|
924
1013
|
if (args.length === 0) return { msg: message };
|
|
925
|
-
if (args.length === 1 &&
|
|
1014
|
+
if (args.length === 1 && /* @__PURE__ */ isObject(args[0])) return {
|
|
926
1015
|
...args[0],
|
|
927
1016
|
msg: message
|
|
928
1017
|
};
|
|
@@ -995,14 +1084,13 @@ var Vuetify0LoggerAdapter = class {
|
|
|
995
1084
|
log(level, method, message, ...args) {
|
|
996
1085
|
const [formattedMessage, ...restArgs] = this.format(level, message, ...args);
|
|
997
1086
|
const style = this.style(level);
|
|
998
|
-
if (IN_BROWSER && style &&
|
|
999
|
-
else if (
|
|
1087
|
+
if (IN_BROWSER && style && /* @__PURE__ */ isFunction(console[method])) console[method](`%c${formattedMessage}`, style, ...restArgs);
|
|
1088
|
+
else if (/* @__PURE__ */ isFunction(console[method])) console[method](formattedMessage, ...restArgs);
|
|
1000
1089
|
}
|
|
1001
1090
|
};
|
|
1002
1091
|
|
|
1003
1092
|
//#endregion
|
|
1004
1093
|
//#region src/composables/useLogger/index.ts
|
|
1005
|
-
const [useLoggerContext, provideLoggerContext] = createContext("v0:logger");
|
|
1006
1094
|
/**
|
|
1007
1095
|
* Creates a new logger instance.
|
|
1008
1096
|
*
|
|
@@ -1010,6 +1098,22 @@ const [useLoggerContext, provideLoggerContext] = createContext("v0:logger");
|
|
|
1010
1098
|
* @returns A new logger instance.
|
|
1011
1099
|
*
|
|
1012
1100
|
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1101
|
+
*
|
|
1102
|
+
* @example
|
|
1103
|
+
* ```ts
|
|
1104
|
+
* import { createLogger } from '@vuetify/v0'
|
|
1105
|
+
*
|
|
1106
|
+
* const logger = createLogger({
|
|
1107
|
+
* level: 'debug',
|
|
1108
|
+
* prefix: '[MyApp]',
|
|
1109
|
+
* })
|
|
1110
|
+
*
|
|
1111
|
+
* logger.info('This is an info message')
|
|
1112
|
+
* logger.debug('This is a debug message')
|
|
1113
|
+
* logger.error('This is an error message')
|
|
1114
|
+
* logger.level('debug')
|
|
1115
|
+
* logger.debug('This debug message will now be logged')
|
|
1116
|
+
* ```
|
|
1013
1117
|
*/
|
|
1014
1118
|
function createLogger(options = {}) {
|
|
1015
1119
|
const { adapter = new Vuetify0LoggerAdapter({ prefix: options.prefix }), level: initialLevel = "info", enabled: initialEnabled = __LOGGER_ENABLED__ } = options;
|
|
@@ -1099,18 +1203,32 @@ function createFallbackLogger(namespace = "v0:logger") {
|
|
|
1099
1203
|
};
|
|
1100
1204
|
}
|
|
1101
1205
|
/**
|
|
1102
|
-
*
|
|
1206
|
+
* Creates a new logger context.
|
|
1103
1207
|
*
|
|
1104
|
-
* @param
|
|
1105
|
-
* @
|
|
1208
|
+
* @param options The options for the logger context.
|
|
1209
|
+
* @template E The type of the logger context.
|
|
1210
|
+
* @returns A new logger context.
|
|
1106
1211
|
*
|
|
1107
1212
|
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1213
|
+
*
|
|
1214
|
+
* @example
|
|
1215
|
+
* ```ts
|
|
1216
|
+
* import { createLoggerContext } from '@vuetify/v0'
|
|
1217
|
+
*
|
|
1218
|
+
* export const [useAppLogger, provideAppLogger, appLogger] = createLoggerContext({
|
|
1219
|
+
* namespace: 'app:logger',
|
|
1220
|
+
* level: 'debug',
|
|
1221
|
+
* })
|
|
1222
|
+
* ```
|
|
1108
1223
|
*/
|
|
1109
|
-
function
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1224
|
+
function createLoggerContext(_options = {}) {
|
|
1225
|
+
const { namespace = "v0:logger",...options } = _options;
|
|
1226
|
+
const [useLoggerContext, _provideLoggerContext] = createContext(namespace);
|
|
1227
|
+
const context = createLogger(options);
|
|
1228
|
+
function provideLoggerContext(_context = context, app) {
|
|
1229
|
+
return _provideLoggerContext(_context, app);
|
|
1230
|
+
}
|
|
1231
|
+
return createTrinity(useLoggerContext, provideLoggerContext, context);
|
|
1114
1232
|
}
|
|
1115
1233
|
/**
|
|
1116
1234
|
* Creates a new logger plugin.
|
|
@@ -1119,17 +1237,69 @@ function useLogger(namespace) {
|
|
|
1119
1237
|
* @returns A new logger plugin.
|
|
1120
1238
|
*
|
|
1121
1239
|
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* import { createApp } from 'vue'
|
|
1244
|
+
* import { createLoggerPlugin } from '@vuetify/v0'
|
|
1245
|
+
* import App from './App.vue'
|
|
1246
|
+
*
|
|
1247
|
+
* const app = createApp(App)
|
|
1248
|
+
*
|
|
1249
|
+
* app.use(
|
|
1250
|
+
* createLoggerPlugin({
|
|
1251
|
+
* level: 'debug',
|
|
1252
|
+
* prefix: '[MyApp]',
|
|
1253
|
+
* })
|
|
1254
|
+
* )
|
|
1255
|
+
*
|
|
1256
|
+
* app.mount('#app')
|
|
1257
|
+
* ```
|
|
1122
1258
|
*/
|
|
1123
|
-
function createLoggerPlugin(
|
|
1124
|
-
const
|
|
1259
|
+
function createLoggerPlugin(_options = {}) {
|
|
1260
|
+
const { namespace = "v0:logger",...options } = _options;
|
|
1261
|
+
const [, provideLoggerContext, context] = createLoggerContext({
|
|
1262
|
+
...options,
|
|
1263
|
+
namespace
|
|
1264
|
+
});
|
|
1125
1265
|
return createPlugin({
|
|
1126
|
-
namespace
|
|
1266
|
+
namespace,
|
|
1127
1267
|
provide: (app) => {
|
|
1128
1268
|
provideLoggerContext(context, app);
|
|
1129
1269
|
},
|
|
1130
1270
|
setup: (_app) => {}
|
|
1131
1271
|
});
|
|
1132
1272
|
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Uses an existing or creates a new logger instance.
|
|
1275
|
+
*
|
|
1276
|
+
* @param namespace The namespace for the logger context. Defaults to `'v0:logger'`.
|
|
1277
|
+
* @returns The logger instance.
|
|
1278
|
+
*
|
|
1279
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1280
|
+
*
|
|
1281
|
+
* @example
|
|
1282
|
+
* ```ts
|
|
1283
|
+
* import { useLogger } from '@vuetify/v0'
|
|
1284
|
+
*
|
|
1285
|
+
* const logger = useLogger()
|
|
1286
|
+
*
|
|
1287
|
+
* logger.info('This is an info message')
|
|
1288
|
+
* logger.debug('This is a debug message')
|
|
1289
|
+
* logger.error('This is an error message')
|
|
1290
|
+
* logger.level('debug')
|
|
1291
|
+
* logger.debug('This debug message will now be logged')
|
|
1292
|
+
* ```
|
|
1293
|
+
*/
|
|
1294
|
+
function useLogger(namespace = "v0:logger") {
|
|
1295
|
+
const fallback = createFallbackLogger(namespace);
|
|
1296
|
+
if (!getCurrentInstance()) return fallback;
|
|
1297
|
+
try {
|
|
1298
|
+
return useContext(namespace, fallback);
|
|
1299
|
+
} catch {
|
|
1300
|
+
return fallback;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1133
1303
|
|
|
1134
1304
|
//#endregion
|
|
1135
1305
|
//#region src/composables/useRegistry/index.ts
|
|
@@ -1141,7 +1311,7 @@ function createLoggerPlugin(options = {}) {
|
|
|
1141
1311
|
* @template E The type of registry context that extends RegistryContext<Z>. Use this when extending the registry with additional methods.
|
|
1142
1312
|
* @returns A new registry instance.
|
|
1143
1313
|
*
|
|
1144
|
-
* @see https://0.vuetifyjs.com/composables/registration/use-registry
|
|
1314
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#use-registry
|
|
1145
1315
|
*
|
|
1146
1316
|
* @example
|
|
1147
1317
|
* ```ts
|
|
@@ -1380,11 +1550,11 @@ function useRegistry(options) {
|
|
|
1380
1550
|
*
|
|
1381
1551
|
* @param namespace The namespace for the registry context.
|
|
1382
1552
|
* @param options The options for the registry context.
|
|
1383
|
-
*
|
|
1384
1553
|
* @template Z The type of registry ticket that extends RegistryTicket. Use this to add custom properties to tickets.
|
|
1385
1554
|
* @template E The type of registry context that extends RegistryContext<Z>. Use this when extending the registry with additional methods.
|
|
1555
|
+
* @returns A new registry context.
|
|
1386
1556
|
*
|
|
1387
|
-
* @see https://0.vuetifyjs.com/composables/registration/use-registry
|
|
1557
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#create-registry-context
|
|
1388
1558
|
*
|
|
1389
1559
|
* @example
|
|
1390
1560
|
* ```ts
|
|
@@ -1400,7 +1570,8 @@ function useRegistry(options) {
|
|
|
1400
1570
|
* items.register({ id: 'item-1', value: 'Value 1' })
|
|
1401
1571
|
* ```
|
|
1402
1572
|
*/
|
|
1403
|
-
function createRegistryContext(
|
|
1573
|
+
function createRegistryContext(_options) {
|
|
1574
|
+
const { namespace,...options } = _options;
|
|
1404
1575
|
const [useRegistryContext, _provideRegistryContext] = createContext(namespace);
|
|
1405
1576
|
const context = useRegistry(options);
|
|
1406
1577
|
function provideRegistryContext(_context = context, app) {
|
|
@@ -1412,20 +1583,37 @@ function createRegistryContext(namespace, options) {
|
|
|
1412
1583
|
//#endregion
|
|
1413
1584
|
//#region src/composables/useSelection/index.ts
|
|
1414
1585
|
/**
|
|
1415
|
-
* Creates a new selection instance.
|
|
1586
|
+
* Creates a new selection instance for managing multiple selected items.
|
|
1587
|
+
*
|
|
1588
|
+
* Extends `useRegistry` with selection tracking via a reactive `Set` of selected IDs.
|
|
1589
|
+
* Supports disabled items, mandatory selection enforcement, and auto-enrollment.
|
|
1416
1590
|
*
|
|
1417
1591
|
* @param options The options for the selection instance.
|
|
1418
1592
|
* @template Z The type of the selection ticket.
|
|
1419
1593
|
* @template E The type of the selection context.
|
|
1420
|
-
* @returns A new selection instance.
|
|
1594
|
+
* @returns A new selection instance with selection management methods.
|
|
1595
|
+
*
|
|
1596
|
+
* @remarks
|
|
1597
|
+
* **Key Features:**
|
|
1598
|
+
* - Multi-selection support (unlike `useSingle` which enforces single selection)
|
|
1599
|
+
* - Set-based `selectedIds` tracking for efficient lookups
|
|
1600
|
+
* - Computed `selectedItems` and `selectedValues` for reactive access
|
|
1601
|
+
* - Each ticket gets `isSelected`, `select()`, `unselect()`, and `toggle()` methods
|
|
1602
|
+
* - Disabled items cannot be selected
|
|
1603
|
+
* - Mandatory mode prevents deselecting the last item
|
|
1604
|
+
* - Force mode auto-selects first non-disabled item on registration
|
|
1605
|
+
* - Enroll option auto-selects all non-disabled items on registration
|
|
1606
|
+
*
|
|
1607
|
+
* **Inheritance Chain:**
|
|
1608
|
+
* `useRegistry` → `createSelection` → `createSingle`/`createGroup` → `createStep`
|
|
1421
1609
|
*
|
|
1422
1610
|
* @see https://0.vuetifyjs.com/composables/selection/use-selection
|
|
1423
1611
|
*
|
|
1424
1612
|
* @example
|
|
1425
1613
|
* ```ts
|
|
1426
|
-
* import {
|
|
1614
|
+
* import { createSelection } from '@vuetify/v0'
|
|
1427
1615
|
*
|
|
1428
|
-
* const selection =
|
|
1616
|
+
* const selection = createSelection({ mandatory: true })
|
|
1429
1617
|
*
|
|
1430
1618
|
* selection.onboard([
|
|
1431
1619
|
* { id: 'item-1', value: 'Item 1' },
|
|
@@ -1437,9 +1625,10 @@ function createRegistryContext(namespace, options) {
|
|
|
1437
1625
|
* selection.select('item-3')
|
|
1438
1626
|
*
|
|
1439
1627
|
* console.log(selection.selectedIds) // Set { 'item-1', 'item-3' }
|
|
1628
|
+
* console.log(Array.from(selection.selectedValues.value)) // ['Item 1', 'Item 3']
|
|
1440
1629
|
* ```
|
|
1441
1630
|
*/
|
|
1442
|
-
function
|
|
1631
|
+
function createSelection(options) {
|
|
1443
1632
|
const registry$1 = useRegistry(options);
|
|
1444
1633
|
const selectedIds = shallowReactive(/* @__PURE__ */ new Set());
|
|
1445
1634
|
const enroll = options?.enroll ?? false;
|
|
@@ -1543,46 +1732,103 @@ function useSelection(options) {
|
|
|
1543
1732
|
* checkboxes.select('checkbox-1')
|
|
1544
1733
|
* ```
|
|
1545
1734
|
*/
|
|
1546
|
-
function createSelectionContext(
|
|
1735
|
+
function createSelectionContext(_options) {
|
|
1736
|
+
const { namespace,...options } = _options;
|
|
1547
1737
|
const [useSelectionContext, _provideSelectionContext] = createContext(namespace);
|
|
1548
|
-
const context =
|
|
1738
|
+
const context = createSelection(options);
|
|
1549
1739
|
function provideSelectionContext(_context = context, app) {
|
|
1550
1740
|
return _provideSelectionContext(_context, app);
|
|
1551
1741
|
}
|
|
1552
1742
|
return createTrinity(useSelectionContext, provideSelectionContext, context);
|
|
1553
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Returns the current selection instance.
|
|
1746
|
+
*
|
|
1747
|
+
* @param namespace The namespace for the selection context. Defaults to `'v0:selection'`.
|
|
1748
|
+
* @returns The current selection instance.
|
|
1749
|
+
*
|
|
1750
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-selection
|
|
1751
|
+
*
|
|
1752
|
+
* @example
|
|
1753
|
+
* ```vue
|
|
1754
|
+
* <script setup lang="ts">
|
|
1755
|
+
* import { useSelection } from '@vuetify/v0'
|
|
1756
|
+
*
|
|
1757
|
+
* const selection = useSelection()
|
|
1758
|
+
* <\/script>
|
|
1759
|
+
*
|
|
1760
|
+
* <template>
|
|
1761
|
+
* <div>
|
|
1762
|
+
* <p>Selected: {{ selection.selectedIds.size }}</p>
|
|
1763
|
+
* </div>
|
|
1764
|
+
* </template>
|
|
1765
|
+
* ```
|
|
1766
|
+
*/
|
|
1767
|
+
function useSelection(namespace = "v0:selection") {
|
|
1768
|
+
return useContext(namespace);
|
|
1769
|
+
}
|
|
1554
1770
|
|
|
1555
1771
|
//#endregion
|
|
1556
1772
|
//#region src/composables/useGroup/index.ts
|
|
1557
1773
|
/**
|
|
1558
|
-
* Creates a new group instance.
|
|
1774
|
+
* Creates a new group instance with batch selection operations.
|
|
1775
|
+
*
|
|
1776
|
+
* Extends `createSelection` to support selecting, unselecting, and toggling multiple items
|
|
1777
|
+
* at once by passing an array of IDs. Adds `selectedIndexes` computed property.
|
|
1559
1778
|
*
|
|
1560
1779
|
* @param options The options for the group instance.
|
|
1561
1780
|
* @template Z The type of the group ticket.
|
|
1562
1781
|
* @template E The type of the group context.
|
|
1563
|
-
* @returns A new group instance.
|
|
1782
|
+
* @returns A new group instance with batch selection support.
|
|
1783
|
+
*
|
|
1784
|
+
* @remarks
|
|
1785
|
+
* **Key Differences from `createSelection`:**
|
|
1786
|
+
* - `select()` accepts `ID | ID[]` for batch operations
|
|
1787
|
+
* - `unselect()` accepts `ID | ID[]` for batch operations
|
|
1788
|
+
* - `toggle()` accepts `ID | ID[]` for batch operations
|
|
1789
|
+
* - Adds `selectedIndexes` computed Set for getting selected item indexes
|
|
1790
|
+
* - Perfect for checkboxes, multi-select dropdowns, and bulk operations
|
|
1791
|
+
*
|
|
1792
|
+
* **Batch Operations:**
|
|
1793
|
+
* - Single ID: `group.select('item-1')`
|
|
1794
|
+
* - Array of IDs: `group.select(['item-1', 'item-2', 'item-3'])`
|
|
1795
|
+
* - Uses `toArray()` utility internally to normalize input
|
|
1796
|
+
* - Disabled items are automatically skipped in batch operations
|
|
1797
|
+
* - Non-existent IDs are silently ignored
|
|
1798
|
+
*
|
|
1799
|
+
* **Inheritance Chain:**
|
|
1800
|
+
* `useRegistry` → `createSelection` → `createGroup`
|
|
1801
|
+
*
|
|
1802
|
+
* **Used By:**
|
|
1803
|
+
* - `createFeatures` for feature flag management with multiple selections
|
|
1564
1804
|
*
|
|
1565
1805
|
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
1566
1806
|
*
|
|
1567
1807
|
* @example
|
|
1568
1808
|
* ```ts
|
|
1569
|
-
* import {
|
|
1809
|
+
* import { createGroup } from '@vuetify/v0'
|
|
1570
1810
|
*
|
|
1571
|
-
* const
|
|
1811
|
+
* const checkboxes = createGroup()
|
|
1572
1812
|
*
|
|
1573
|
-
*
|
|
1574
|
-
* { id: '
|
|
1575
|
-
* { id: '
|
|
1576
|
-
* { id: '
|
|
1813
|
+
* checkboxes.onboard([
|
|
1814
|
+
* { id: 'option-a', value: 'Option A' },
|
|
1815
|
+
* { id: 'option-b', value: 'Option B' },
|
|
1816
|
+
* { id: 'option-c', value: 'Option C' },
|
|
1577
1817
|
* ])
|
|
1578
1818
|
*
|
|
1579
|
-
*
|
|
1819
|
+
* // Select multiple items at once
|
|
1820
|
+
* checkboxes.select(['option-a', 'option-c'])
|
|
1821
|
+
*
|
|
1822
|
+
* console.log(checkboxes.selectedIds) // Set { 'option-a', 'option-c' }
|
|
1823
|
+
* console.log(Array.from(checkboxes.selectedIndexes.value)) // [0, 2]
|
|
1580
1824
|
*
|
|
1581
|
-
*
|
|
1825
|
+
* // Toggle operations
|
|
1826
|
+
* checkboxes.toggle(['option-a', 'option-b'])
|
|
1827
|
+
* console.log(checkboxes.selectedIds) // Set { 'option-b', 'option-c' }
|
|
1582
1828
|
* ```
|
|
1583
1829
|
*/
|
|
1584
|
-
function
|
|
1585
|
-
const registry$1 =
|
|
1830
|
+
function createGroup(options) {
|
|
1831
|
+
const registry$1 = createSelection(options);
|
|
1586
1832
|
const selectedIndexes = computed(() => {
|
|
1587
1833
|
return new Set(Array.from(registry$1.selectedItems.value).map((item) => item?.index));
|
|
1588
1834
|
});
|
|
@@ -1630,14 +1876,41 @@ function useGroup(options) {
|
|
|
1630
1876
|
* const group = useMyGroup()
|
|
1631
1877
|
* ```
|
|
1632
1878
|
*/
|
|
1633
|
-
function createGroupContext(
|
|
1879
|
+
function createGroupContext(_options) {
|
|
1880
|
+
const { namespace,...options } = _options;
|
|
1634
1881
|
const [useGroupContext, _provideGroupContext] = createContext(namespace);
|
|
1635
|
-
const context =
|
|
1882
|
+
const context = createGroup(options);
|
|
1636
1883
|
function provideGroupContext(_context = context, app) {
|
|
1637
1884
|
return _provideGroupContext(_context, app);
|
|
1638
1885
|
}
|
|
1639
1886
|
return createTrinity(useGroupContext, provideGroupContext, context);
|
|
1640
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Returns the current group instance.
|
|
1890
|
+
*
|
|
1891
|
+
* @param namespace The namespace for the group context. Defaults to `'v0:group'`.
|
|
1892
|
+
* @returns The current group instance.
|
|
1893
|
+
*
|
|
1894
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
1895
|
+
*
|
|
1896
|
+
* @example
|
|
1897
|
+
* ```vue
|
|
1898
|
+
* <script setup lang="ts">
|
|
1899
|
+
* import { useGroup } from '@vuetify/v0'
|
|
1900
|
+
*
|
|
1901
|
+
* const group = useGroup()
|
|
1902
|
+
* <\/script>
|
|
1903
|
+
*
|
|
1904
|
+
* <template>
|
|
1905
|
+
* <div>
|
|
1906
|
+
* <p>Selected: {{ group.selectedIds.size }}</p>
|
|
1907
|
+
* </div>
|
|
1908
|
+
* </template>
|
|
1909
|
+
* ```
|
|
1910
|
+
*/
|
|
1911
|
+
function useGroup(namespace) {
|
|
1912
|
+
return useContext(namespace);
|
|
1913
|
+
}
|
|
1641
1914
|
|
|
1642
1915
|
//#endregion
|
|
1643
1916
|
//#region src/composables/useTokens/index.ts
|
|
@@ -1668,9 +1941,9 @@ function createGroupContext(namespace, options) {
|
|
|
1668
1941
|
* console.log(tokens.resolve('{colors.secondary}')) // '#3b82f6'
|
|
1669
1942
|
* ```
|
|
1670
1943
|
*/
|
|
1671
|
-
function
|
|
1944
|
+
function createTokens(tokens = {}, options = {}) {
|
|
1672
1945
|
const logger = useLogger();
|
|
1673
|
-
const registry$1 = useRegistry();
|
|
1946
|
+
const registry$1 = useRegistry(options);
|
|
1674
1947
|
const cache = /* @__PURE__ */ new Map();
|
|
1675
1948
|
registry$1.onboard(flatten(tokens, options.prefix, !!options.flat));
|
|
1676
1949
|
function isAlias(token) {
|
|
@@ -1679,12 +1952,18 @@ function useTokens(tokens = {}, options = {}) {
|
|
|
1679
1952
|
function isTokenAlias(value) {
|
|
1680
1953
|
return /* @__PURE__ */ isObject(value) && "$value" in value;
|
|
1681
1954
|
}
|
|
1682
|
-
function resolve(token) {
|
|
1955
|
+
function resolve(token, visited = /* @__PURE__ */ new Set()) {
|
|
1683
1956
|
const cacheKey = /* @__PURE__ */ isString(token) ? token : JSON.stringify(token);
|
|
1684
1957
|
const cached = cache.get(cacheKey);
|
|
1685
1958
|
if (cached !== void 0) return cached;
|
|
1686
1959
|
const reference = isTokenAlias(token) ? token.$value : token;
|
|
1687
1960
|
const clean = /* @__PURE__ */ isString(reference) && isAlias(reference) ? reference.slice(1, -1) : String(reference);
|
|
1961
|
+
if (visited.has(clean)) {
|
|
1962
|
+
logger.warn(`Circular alias detected for "${clean}"`);
|
|
1963
|
+
cache.set(cacheKey, void 0);
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
visited.add(clean);
|
|
1688
1967
|
let found = registry$1.get(clean);
|
|
1689
1968
|
let segments = [];
|
|
1690
1969
|
if (!found && clean.includes(".")) {
|
|
@@ -1725,9 +2004,9 @@ function useTokens(tokens = {}, options = {}) {
|
|
|
1725
2004
|
result = current;
|
|
1726
2005
|
} else if (isTokenAlias(current)) {
|
|
1727
2006
|
const inner = current.$value;
|
|
1728
|
-
if (/* @__PURE__ */ isString(inner) && isAlias(inner)) return resolve(inner);
|
|
2007
|
+
if (/* @__PURE__ */ isString(inner) && isAlias(inner)) return resolve(inner, visited);
|
|
1729
2008
|
result = inner;
|
|
1730
|
-
} else if (/* @__PURE__ */ isString(current) && isAlias(current)) return resolve(current);
|
|
2009
|
+
} else if (/* @__PURE__ */ isString(current) && isAlias(current)) return resolve(current, visited);
|
|
1731
2010
|
else result = current;
|
|
1732
2011
|
cache.set(cacheKey, result);
|
|
1733
2012
|
return result;
|
|
@@ -1756,34 +2035,47 @@ function useTokens(tokens = {}, options = {}) {
|
|
|
1756
2035
|
* ```ts
|
|
1757
2036
|
* import { createTokensContext } from '@vuetify/v0'
|
|
1758
2037
|
*
|
|
1759
|
-
* const
|
|
1760
|
-
*
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
1766
|
-
*
|
|
1767
|
-
*
|
|
1768
|
-
*
|
|
1769
|
-
* // In a parent component:
|
|
1770
|
-
* provideDesignTokens()
|
|
1771
|
-
*
|
|
1772
|
-
* // In a child component:
|
|
1773
|
-
* const tokens = useDesignTokens()
|
|
1774
|
-
*
|
|
1775
|
-
* console.log(tokens.resolve('{spacing.md}')) // '16px'
|
|
2038
|
+
* export const [useTokens, provideTokens, context] = createTokensContext({
|
|
2039
|
+
* namespace: 'v0:tokens',
|
|
2040
|
+
* tokens: {
|
|
2041
|
+
* colors: {
|
|
2042
|
+
* primary: '#3b82f6',
|
|
2043
|
+
* secondary: '{colors.primary}', // Alias reference
|
|
2044
|
+
* },
|
|
2045
|
+
* },
|
|
2046
|
+
* })
|
|
1776
2047
|
* ```
|
|
1777
2048
|
*/
|
|
1778
|
-
function createTokensContext(
|
|
2049
|
+
function createTokensContext(_options) {
|
|
2050
|
+
const { namespace, tokens = {},...options } = _options;
|
|
1779
2051
|
const [useTokensContext, _provideTokensContext] = createContext(namespace);
|
|
1780
|
-
const context =
|
|
2052
|
+
const context = createTokens(tokens, options);
|
|
1781
2053
|
function provideTokensContext(_context = context, app) {
|
|
1782
2054
|
return _provideTokensContext(_context, app);
|
|
1783
2055
|
}
|
|
1784
2056
|
return createTrinity(useTokensContext, provideTokensContext, context);
|
|
1785
2057
|
}
|
|
1786
2058
|
/**
|
|
2059
|
+
* Returns the current tokens instance.
|
|
2060
|
+
*
|
|
2061
|
+
* @param namespace The namespace for the tokens context. Defaults to `'v0:tokens'`.
|
|
2062
|
+
* @returns The current tokens instance.
|
|
2063
|
+
*
|
|
2064
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-tokens
|
|
2065
|
+
*
|
|
2066
|
+
* @example
|
|
2067
|
+
* ```vue
|
|
2068
|
+
* <script setup lang="ts">
|
|
2069
|
+
* import { useTokens } from '@vuetify/v0'
|
|
2070
|
+
*
|
|
2071
|
+
* const tokens = useTokens()
|
|
2072
|
+
* <\/script>
|
|
2073
|
+
* ```
|
|
2074
|
+
*/
|
|
2075
|
+
function useTokens(namespace = "v0:tokens") {
|
|
2076
|
+
return useContext(namespace);
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
1787
2079
|
* Flattens a nested collection of tokens into a flat array of tokens.
|
|
1788
2080
|
* Each token is represented by an object containing its ID & value.
|
|
1789
2081
|
* @param tokens The collection of tokens to flatten.
|
|
@@ -1864,19 +2156,19 @@ function flatten(tokens, prefix = "", flat = false) {
|
|
|
1864
2156
|
/**
|
|
1865
2157
|
* Creates a new features instance.
|
|
1866
2158
|
*
|
|
1867
|
-
* @param namespace The namespace to use for the features instance.
|
|
1868
2159
|
* @param options The options for the features instance.
|
|
1869
2160
|
* @template Z The type of the feature ticket.
|
|
1870
2161
|
* @template E The type of the feature context.
|
|
1871
2162
|
* @returns A new features instance.
|
|
1872
2163
|
*
|
|
1873
|
-
* @see https://0.vuetifyjs.com/composables/plugins/
|
|
2164
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-features
|
|
1874
2165
|
*
|
|
1875
2166
|
* @example
|
|
1876
2167
|
* ```ts
|
|
1877
2168
|
* import { createFeatures } from '@vuetify/v0'
|
|
1878
2169
|
*
|
|
1879
|
-
* const [useFeatures, provideFeaturesContext] = createFeatures(
|
|
2170
|
+
* const [useFeatures, provideFeaturesContext, context] = createFeatures({
|
|
2171
|
+
* namespace: 'v0:features',
|
|
1880
2172
|
* features: {
|
|
1881
2173
|
* 'dark-mode': true,
|
|
1882
2174
|
* 'theme-color': { $variation: 'blue' },
|
|
@@ -1884,10 +2176,10 @@ function flatten(tokens, prefix = "", flat = false) {
|
|
|
1884
2176
|
* })
|
|
1885
2177
|
* ```
|
|
1886
2178
|
*/
|
|
1887
|
-
function createFeatures(
|
|
1888
|
-
const
|
|
1889
|
-
const tokens =
|
|
1890
|
-
const registry$1 =
|
|
2179
|
+
function createFeatures(_options = {}) {
|
|
2180
|
+
const { features,...options } = _options;
|
|
2181
|
+
const tokens = createTokens(features, { flat: true });
|
|
2182
|
+
const registry$1 = createGroup(options);
|
|
1891
2183
|
for (const [id, { value }] of tokens.entries()) register({
|
|
1892
2184
|
id,
|
|
1893
2185
|
value
|
|
@@ -1906,7 +2198,7 @@ function createFeatures(namespace = "v0:features", options = {}) {
|
|
|
1906
2198
|
if (/* @__PURE__ */ isBoolean(ticket.value) && ticket.value === true || /* @__PURE__ */ isObject(ticket.value) && /* @__PURE__ */ isBoolean(ticket.value.$value) && ticket.value.$value === true) registry$1.select(ticket.id);
|
|
1907
2199
|
return ticket;
|
|
1908
2200
|
}
|
|
1909
|
-
|
|
2201
|
+
return {
|
|
1910
2202
|
...registry$1,
|
|
1911
2203
|
variation,
|
|
1912
2204
|
register,
|
|
@@ -1914,37 +2206,38 @@ function createFeatures(namespace = "v0:features", options = {}) {
|
|
|
1914
2206
|
return registry$1.size;
|
|
1915
2207
|
}
|
|
1916
2208
|
};
|
|
1917
|
-
function provideFeaturesContext(_context = context, app) {
|
|
1918
|
-
return _provideFeaturesContext(_context, app);
|
|
1919
|
-
}
|
|
1920
|
-
return createTrinity(useFeaturesContext, provideFeaturesContext, context);
|
|
1921
2209
|
}
|
|
1922
2210
|
/**
|
|
1923
|
-
*
|
|
2211
|
+
* Creates a new features context.
|
|
1924
2212
|
*
|
|
2213
|
+
* @param options The options for the features context.
|
|
1925
2214
|
* @template Z The type of the feature ticket.
|
|
1926
|
-
* @
|
|
2215
|
+
* @template E The type of the feature context.
|
|
2216
|
+
* @returns A new features context.
|
|
1927
2217
|
*
|
|
1928
|
-
* @see https://0.vuetifyjs.com/composables/plugins/
|
|
2218
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-features
|
|
1929
2219
|
*
|
|
1930
2220
|
* @example
|
|
1931
|
-
* ```
|
|
1932
|
-
*
|
|
1933
|
-
* import { useFeatures } from '@vuetify/v0'
|
|
1934
|
-
*
|
|
1935
|
-
* const features = useFeatures()
|
|
1936
|
-
* <\/script>
|
|
2221
|
+
* ```ts
|
|
2222
|
+
* import { createFeaturesContext } from '@vuetify/v0'
|
|
1937
2223
|
*
|
|
1938
|
-
*
|
|
1939
|
-
*
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
1943
|
-
*
|
|
2224
|
+
* export const [useFeatures, provideFeatures, context] = createFeaturesContext({
|
|
2225
|
+
* namespace: 'app:features',
|
|
2226
|
+
* features: {
|
|
2227
|
+
* 'dark-mode': true,
|
|
2228
|
+
* 'theme-color': { $variation: 'blue' },
|
|
2229
|
+
* },
|
|
2230
|
+
* })
|
|
1944
2231
|
* ```
|
|
1945
2232
|
*/
|
|
1946
|
-
function
|
|
1947
|
-
|
|
2233
|
+
function createFeaturesContext(_options = {}) {
|
|
2234
|
+
const { namespace = "v0:features",...options } = _options;
|
|
2235
|
+
const [useFeaturesContext, _provideFeaturesContext] = createContext(namespace);
|
|
2236
|
+
const context = createFeatures(options);
|
|
2237
|
+
function provideFeaturesContext(_context = context, app) {
|
|
2238
|
+
return _provideFeaturesContext(_context, app);
|
|
2239
|
+
}
|
|
2240
|
+
return createTrinity(useFeaturesContext, provideFeaturesContext, context);
|
|
1948
2241
|
}
|
|
1949
2242
|
/**
|
|
1950
2243
|
* Creates a new features plugin.
|
|
@@ -1954,7 +2247,7 @@ function useFeatures() {
|
|
|
1954
2247
|
* @template E The type of the feature context.
|
|
1955
2248
|
* @returns A new features plugin.
|
|
1956
2249
|
*
|
|
1957
|
-
* @see https://0.vuetifyjs.com/composables/plugins/
|
|
2250
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-features
|
|
1958
2251
|
*
|
|
1959
2252
|
* @example
|
|
1960
2253
|
* ```ts
|
|
@@ -1976,15 +2269,47 @@ function useFeatures() {
|
|
|
1976
2269
|
* app.mount('#app')
|
|
1977
2270
|
* ```
|
|
1978
2271
|
*/
|
|
1979
|
-
function createFeaturesPlugin(
|
|
1980
|
-
const
|
|
2272
|
+
function createFeaturesPlugin(_options = {}) {
|
|
2273
|
+
const { namespace = "v0:features",...options } = _options;
|
|
2274
|
+
const [, provideFeaturesContext, context] = createFeaturesContext({
|
|
2275
|
+
...options,
|
|
2276
|
+
namespace
|
|
2277
|
+
});
|
|
1981
2278
|
return createPlugin({
|
|
1982
|
-
namespace
|
|
2279
|
+
namespace,
|
|
1983
2280
|
provide: (app) => {
|
|
1984
2281
|
provideFeaturesContext(context, app);
|
|
1985
2282
|
}
|
|
1986
2283
|
});
|
|
1987
2284
|
}
|
|
2285
|
+
/**
|
|
2286
|
+
* Returns the current features instance.
|
|
2287
|
+
*
|
|
2288
|
+
* @param namespace The namespace for the features context. Defaults to `v0:features`.
|
|
2289
|
+
* @template Z The type of the feature ticket.
|
|
2290
|
+
* @returns The current features instance.
|
|
2291
|
+
*
|
|
2292
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-features
|
|
2293
|
+
*
|
|
2294
|
+
* @example
|
|
2295
|
+
* ```vue
|
|
2296
|
+
* <script setup lang="ts">
|
|
2297
|
+
* import { useFeatures } from '@vuetify/v0'
|
|
2298
|
+
*
|
|
2299
|
+
* const features = useFeatures()
|
|
2300
|
+
* <\/script>
|
|
2301
|
+
*
|
|
2302
|
+
* <template>
|
|
2303
|
+
* <div>
|
|
2304
|
+
* <p>Features: {{ features.get('dark-mode') }}</p>
|
|
2305
|
+
* <p>Theme Color: {{ features.variation('theme-color') }}</p>
|
|
2306
|
+
* </div>
|
|
2307
|
+
* </template>
|
|
2308
|
+
* ```
|
|
2309
|
+
*/
|
|
2310
|
+
function useFeatures(namespace = "v0:features") {
|
|
2311
|
+
return useContext(namespace);
|
|
2312
|
+
}
|
|
1988
2313
|
|
|
1989
2314
|
//#endregion
|
|
1990
2315
|
//#region src/composables/useFilter/index.ts
|
|
@@ -1993,7 +2318,7 @@ function defaultFilter(query, item, keys, mode = "some") {
|
|
|
1993
2318
|
function match(value, q) {
|
|
1994
2319
|
return String(value).toLowerCase().includes(q);
|
|
1995
2320
|
}
|
|
1996
|
-
const stringValues = (
|
|
2321
|
+
const stringValues = (/* @__PURE__ */ isObject(item) ? keys?.length ? keys.map((k) => item[k]) : Object.values(item) : [item]).map((v) => String(v).toLowerCase());
|
|
1997
2322
|
if (mode === "some") return stringValues.some((val) => match(val, queries[0]));
|
|
1998
2323
|
if (mode === "every") return stringValues.every((val) => match(val, queries[0]));
|
|
1999
2324
|
if (mode === "union") return queries.some((q) => stringValues.some((val) => match(val, q)));
|
|
@@ -2056,9 +2381,9 @@ function useFilter(query, items, options = {}) {
|
|
|
2056
2381
|
*
|
|
2057
2382
|
* @example
|
|
2058
2383
|
* ```ts
|
|
2059
|
-
* import {
|
|
2384
|
+
* import { createForm } from '@vuetify/v0'
|
|
2060
2385
|
*
|
|
2061
|
-
* const form =
|
|
2386
|
+
* const form = createForm()
|
|
2062
2387
|
*
|
|
2063
2388
|
* const username = form.register({
|
|
2064
2389
|
* id: 'username',
|
|
@@ -2073,7 +2398,7 @@ function useFilter(query, items, options = {}) {
|
|
|
2073
2398
|
* form.reset()
|
|
2074
2399
|
* ```
|
|
2075
2400
|
*/
|
|
2076
|
-
function
|
|
2401
|
+
function createForm(options) {
|
|
2077
2402
|
const registry$1 = useRegistry(options);
|
|
2078
2403
|
const validateOn = options?.validateOn || "submit";
|
|
2079
2404
|
function parse(value) {
|
|
@@ -2128,7 +2453,7 @@ function useForm(options) {
|
|
|
2128
2453
|
if (rules.length === 0) return isValid$1.value = true;
|
|
2129
2454
|
isValidating$1.value = true;
|
|
2130
2455
|
try {
|
|
2131
|
-
const errorMessages = (await Promise.all(rules.map((rule) => rule(model.value)))).filter((result) =>
|
|
2456
|
+
const errorMessages = (await Promise.all(rules.map((rule) => rule(model.value)))).filter((result) => /* @__PURE__ */ isString(result));
|
|
2132
2457
|
if (!silent) {
|
|
2133
2458
|
errors.value = errorMessages;
|
|
2134
2459
|
isValid$1.value = errorMessages.length === 0;
|
|
@@ -2180,6 +2505,68 @@ function useForm(options) {
|
|
|
2180
2505
|
}
|
|
2181
2506
|
};
|
|
2182
2507
|
}
|
|
2508
|
+
/**
|
|
2509
|
+
* Creates a new form context.
|
|
2510
|
+
*
|
|
2511
|
+
* @param namespace The namespace for the form context.
|
|
2512
|
+
* @param options The options for the form context.
|
|
2513
|
+
* @template Z The type of the form ticket.
|
|
2514
|
+
* @template E The type of the form context.
|
|
2515
|
+
* @returns A new form context.
|
|
2516
|
+
*
|
|
2517
|
+
* @see https://0.vuetifyjs.com/composables/forms/use-form
|
|
2518
|
+
*
|
|
2519
|
+
* @example
|
|
2520
|
+
* ```ts
|
|
2521
|
+
* import { createFormContext } from '@vuetify/v0'
|
|
2522
|
+
*
|
|
2523
|
+
* export const [useMyForm, provideMyForm, myForm] = createFormContext('my-form', {
|
|
2524
|
+
* validateOn: 'change',
|
|
2525
|
+
* })
|
|
2526
|
+
*
|
|
2527
|
+
* // In a parent component:
|
|
2528
|
+
* provideMyForm()
|
|
2529
|
+
*
|
|
2530
|
+
* // In a child component:
|
|
2531
|
+
* const form = useMyForm()
|
|
2532
|
+
* form.register({ id: 'field', value: ref(''), rules: [...] })
|
|
2533
|
+
* ```
|
|
2534
|
+
*/
|
|
2535
|
+
function createFormContext(_options) {
|
|
2536
|
+
const { namespace,...options } = _options;
|
|
2537
|
+
const [useFormContext, _provideFormContext] = createContext(namespace);
|
|
2538
|
+
const context = createForm(options);
|
|
2539
|
+
function provideFormContext(_context = context, app) {
|
|
2540
|
+
return _provideFormContext(_context, app);
|
|
2541
|
+
}
|
|
2542
|
+
return createTrinity(useFormContext, provideFormContext, context);
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Returns the current form instance.
|
|
2546
|
+
*
|
|
2547
|
+
* @param namespace The namespace for the form context. Defaults to `'v0:form'`.
|
|
2548
|
+
* @returns The current form instance.
|
|
2549
|
+
*
|
|
2550
|
+
* @see https://0.vuetifyjs.com/composables/forms/use-form
|
|
2551
|
+
*
|
|
2552
|
+
* @example
|
|
2553
|
+
* ```vue
|
|
2554
|
+
* <script setup lang="ts">
|
|
2555
|
+
* import { useForm } from '@vuetify/v0'
|
|
2556
|
+
*
|
|
2557
|
+
* const form = useForm()
|
|
2558
|
+
* <\/script>
|
|
2559
|
+
*
|
|
2560
|
+
* <template>
|
|
2561
|
+
* <div>
|
|
2562
|
+
* <p>Form is {{ form.isValid.value ? 'valid' : 'invalid' }}</p>
|
|
2563
|
+
* </div>
|
|
2564
|
+
* </template>
|
|
2565
|
+
* ```
|
|
2566
|
+
*/
|
|
2567
|
+
function useForm(namespace = "v0:form") {
|
|
2568
|
+
return useContext(namespace);
|
|
2569
|
+
}
|
|
2183
2570
|
|
|
2184
2571
|
//#endregion
|
|
2185
2572
|
//#region src/composables/useIntersectionObserver/index.ts
|
|
@@ -2395,33 +2782,57 @@ function useKeydown(handlers) {
|
|
|
2395
2782
|
//#endregion
|
|
2396
2783
|
//#region src/composables/useSingle/index.ts
|
|
2397
2784
|
/**
|
|
2398
|
-
* Creates a new single selection instance.
|
|
2785
|
+
* Creates a new single selection instance that enforces only one selected item at a time.
|
|
2786
|
+
*
|
|
2787
|
+
* Extends `createSelection` by automatically clearing previous selections when a new item is selected.
|
|
2788
|
+
* Adds computed singular properties: `selectedId`, `selectedItem`, `selectedIndex`, `selectedValue`.
|
|
2399
2789
|
*
|
|
2400
2790
|
* @param options The options for the single selection instance.
|
|
2401
2791
|
* @template Z The type of the single selection ticket.
|
|
2402
2792
|
* @template E The type of the single selection context.
|
|
2403
|
-
* @returns A new single selection instance.
|
|
2793
|
+
* @returns A new single selection instance with single-selection enforcement.
|
|
2794
|
+
*
|
|
2795
|
+
* @remarks
|
|
2796
|
+
* **Key Differences from `createSelection`:**
|
|
2797
|
+
* - Automatically clears `selectedIds` before selecting a new item (enforces single selection)
|
|
2798
|
+
* - Provides singular computed properties instead of plural sets
|
|
2799
|
+
* - Perfect for tabs, radio buttons, theme selectors, and other single-choice UI components
|
|
2800
|
+
*
|
|
2801
|
+
* **Computed Properties:**
|
|
2802
|
+
* - `selectedId`: The ID of the selected item (undefined if none selected)
|
|
2803
|
+
* - `selectedItem`: The selected ticket object (undefined if none selected)
|
|
2804
|
+
* - `selectedIndex`: The index of the selected item (-1 if none selected)
|
|
2805
|
+
* - `selectedValue`: The value of the selected item (undefined if none selected)
|
|
2806
|
+
*
|
|
2807
|
+
* **Inheritance Chain:**
|
|
2808
|
+
* `useRegistry` → `createSelection` → `createSingle` → `createStep`
|
|
2404
2809
|
*
|
|
2405
2810
|
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
2406
2811
|
*
|
|
2407
2812
|
* @example
|
|
2408
2813
|
* ```ts
|
|
2409
|
-
* import {
|
|
2814
|
+
* import { createSingle } from '@vuetify/v0'
|
|
2410
2815
|
*
|
|
2411
|
-
* const
|
|
2816
|
+
* const tabs = createSingle({ mandatory: true })
|
|
2412
2817
|
*
|
|
2413
|
-
*
|
|
2414
|
-
* { id: '
|
|
2415
|
-
* { id: '
|
|
2818
|
+
* tabs.onboard([
|
|
2819
|
+
* { id: 'home', value: 'Home' },
|
|
2820
|
+
* { id: 'about', value: 'About' },
|
|
2821
|
+
* { id: 'contact', value: 'Contact' },
|
|
2416
2822
|
* ])
|
|
2417
2823
|
*
|
|
2418
|
-
*
|
|
2824
|
+
* tabs.first() // Select first tab
|
|
2419
2825
|
*
|
|
2420
|
-
* console.log(
|
|
2826
|
+
* console.log(tabs.selectedId.value) // 'home'
|
|
2827
|
+
* console.log(tabs.selectedIndex.value) // 0
|
|
2828
|
+
*
|
|
2829
|
+
* tabs.select('about') // Switch to about tab
|
|
2830
|
+
* console.log(tabs.selectedId.value) // 'about'
|
|
2831
|
+
* console.log(tabs.selectedIds.size) // 1 (always enforces single selection)
|
|
2421
2832
|
* ```
|
|
2422
2833
|
*/
|
|
2423
|
-
function
|
|
2424
|
-
const registry$1 =
|
|
2834
|
+
function createSingle(options) {
|
|
2835
|
+
const registry$1 = createSelection(options);
|
|
2425
2836
|
const mandatory = options?.mandatory ?? false;
|
|
2426
2837
|
const selectedId = computed(() => registry$1.selectedIds.values().next().value);
|
|
2427
2838
|
const selectedItem = computed(() => registry$1.selectedItems.value.values().next().value);
|
|
@@ -2480,14 +2891,41 @@ function useSingle(options) {
|
|
|
2480
2891
|
* tabs.select('tab-1')
|
|
2481
2892
|
* ```
|
|
2482
2893
|
*/
|
|
2483
|
-
function createSingleContext(
|
|
2894
|
+
function createSingleContext(_options) {
|
|
2895
|
+
const { namespace,...options } = _options;
|
|
2484
2896
|
const [useSingleContext, _provideSingleContext] = createContext(namespace);
|
|
2485
|
-
const context =
|
|
2897
|
+
const context = createSingle(options);
|
|
2486
2898
|
function provideSingleContext(_context = context, app) {
|
|
2487
2899
|
return _provideSingleContext(_context, app);
|
|
2488
2900
|
}
|
|
2489
2901
|
return createTrinity(useSingleContext, provideSingleContext, context);
|
|
2490
2902
|
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Returns the current single selection instance.
|
|
2905
|
+
*
|
|
2906
|
+
* @param namespace The namespace for the single selection context. Defaults to `'v0:single'`.
|
|
2907
|
+
* @returns The current single selection instance.
|
|
2908
|
+
*
|
|
2909
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
2910
|
+
*
|
|
2911
|
+
* @example
|
|
2912
|
+
* ```vue
|
|
2913
|
+
* <script setup lang="ts">
|
|
2914
|
+
* import { useSingle } from '@vuetify/v0'
|
|
2915
|
+
*
|
|
2916
|
+
* const tabs = useSingle()
|
|
2917
|
+
* <\/script>
|
|
2918
|
+
*
|
|
2919
|
+
* <template>
|
|
2920
|
+
* <div>
|
|
2921
|
+
* <p>Selected: {{ tabs.selectedId }}</p>
|
|
2922
|
+
* </div>
|
|
2923
|
+
* </template>
|
|
2924
|
+
* ```
|
|
2925
|
+
*/
|
|
2926
|
+
function useSingle(namespace = "v0:single") {
|
|
2927
|
+
return useContext(namespace);
|
|
2928
|
+
}
|
|
2491
2929
|
|
|
2492
2930
|
//#endregion
|
|
2493
2931
|
//#region src/composables/useLocale/adapters/v0.ts
|
|
@@ -2501,7 +2939,7 @@ function createSingleContext(namespace, options) {
|
|
|
2501
2939
|
var Vuetify0LocaleAdapter = class {
|
|
2502
2940
|
t(message, ...params) {
|
|
2503
2941
|
let resolvedMessage = message;
|
|
2504
|
-
if (params.length > 0 &&
|
|
2942
|
+
if (params.length > 0 && /* @__PURE__ */ isObject(params[0])) {
|
|
2505
2943
|
const variables = params[0];
|
|
2506
2944
|
resolvedMessage = resolvedMessage.replace(/{([a-zA-Z][a-zA-Z0-9_]*)}/g, (match, name) => {
|
|
2507
2945
|
return variables[name] === void 0 ? match : String(variables[name]);
|
|
@@ -2527,7 +2965,6 @@ var Vuetify0LocaleAdapter = class {
|
|
|
2527
2965
|
/**
|
|
2528
2966
|
* Creates a new locale instance.
|
|
2529
2967
|
*
|
|
2530
|
-
* @param namespace The namespace for the locale instance.
|
|
2531
2968
|
* @param options The options for the locale instance.
|
|
2532
2969
|
* @template Z The type of the locale ticket.
|
|
2533
2970
|
* @template E The type of the locale context.
|
|
@@ -2535,11 +2972,10 @@ var Vuetify0LocaleAdapter = class {
|
|
|
2535
2972
|
*
|
|
2536
2973
|
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
2537
2974
|
*/
|
|
2538
|
-
function createLocale(
|
|
2539
|
-
const { adapter = new Vuetify0LocaleAdapter(), messages = {} } =
|
|
2540
|
-
const
|
|
2541
|
-
const
|
|
2542
|
-
const registry$1 = useSingle();
|
|
2975
|
+
function createLocale(_options = {}) {
|
|
2976
|
+
const { adapter = new Vuetify0LocaleAdapter(), messages = {},...options } = _options;
|
|
2977
|
+
const tokens = createTokens(messages, { flat: true });
|
|
2978
|
+
const registry$1 = createSingle(options);
|
|
2543
2979
|
for (const id in messages) {
|
|
2544
2980
|
registry$1.register({
|
|
2545
2981
|
id,
|
|
@@ -2551,7 +2987,7 @@ function createLocale(namespace = "v0:locale", options = {}) {
|
|
|
2551
2987
|
const locale = registry$1.selectedId.value;
|
|
2552
2988
|
if (!locale) return key;
|
|
2553
2989
|
const message = (registry$1.get(locale)?.value)?.[key];
|
|
2554
|
-
const template =
|
|
2990
|
+
const template = /* @__PURE__ */ isString(message) ? resolve(locale, message) : key;
|
|
2555
2991
|
return adapter.t(template, ...params);
|
|
2556
2992
|
}
|
|
2557
2993
|
function n(value, ...params) {
|
|
@@ -2565,16 +3001,16 @@ function createLocale(namespace = "v0:locale", options = {}) {
|
|
|
2565
3001
|
const target = prefixTicket ? prefix : locale;
|
|
2566
3002
|
const name = prefixTicket ? path : key;
|
|
2567
3003
|
const resolved = (registry$1.get(target)?.value)?.[name];
|
|
2568
|
-
if (
|
|
3004
|
+
if (/* @__PURE__ */ isString(resolved)) return resolve(target, resolved);
|
|
2569
3005
|
const alias = `{${key}}`;
|
|
2570
3006
|
if (tokens.isAlias(alias)) {
|
|
2571
3007
|
const result = tokens.resolve(alias);
|
|
2572
|
-
return
|
|
3008
|
+
return /* @__PURE__ */ isString(result) ? result : match;
|
|
2573
3009
|
}
|
|
2574
3010
|
return match;
|
|
2575
3011
|
});
|
|
2576
3012
|
}
|
|
2577
|
-
|
|
3013
|
+
return {
|
|
2578
3014
|
...registry$1,
|
|
2579
3015
|
t,
|
|
2580
3016
|
n,
|
|
@@ -2582,20 +3018,45 @@ function createLocale(namespace = "v0:locale", options = {}) {
|
|
|
2582
3018
|
return registry$1.size;
|
|
2583
3019
|
}
|
|
2584
3020
|
};
|
|
2585
|
-
function provideLocaleContext(_context = context, app) {
|
|
2586
|
-
return _provideLocaleContext(_context, app);
|
|
2587
|
-
}
|
|
2588
|
-
return createTrinity(useLocaleContext, provideLocaleContext, context);
|
|
2589
3021
|
}
|
|
2590
3022
|
/**
|
|
2591
|
-
*
|
|
3023
|
+
* Creates a new locale context.
|
|
2592
3024
|
*
|
|
2593
|
-
* @
|
|
3025
|
+
* @param options The options for the locale context.
|
|
3026
|
+
* @template Z The type of the locale ticket.
|
|
3027
|
+
* @template E The type of the locale context.
|
|
3028
|
+
* @returns A new locale context.
|
|
2594
3029
|
*
|
|
2595
3030
|
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
3031
|
+
*
|
|
3032
|
+
* @example
|
|
3033
|
+
* ```ts
|
|
3034
|
+
* import { createLocaleContext } from '@vuetify/v0'
|
|
3035
|
+
*
|
|
3036
|
+
* export const [useAppLocale, provideAppLocale, appLocale] = createLocaleContext({
|
|
3037
|
+
* namespace: 'app:locale',
|
|
3038
|
+
* messages: {
|
|
3039
|
+
* en: { hello: 'Hello' },
|
|
3040
|
+
* es: { hello: 'Hola' },
|
|
3041
|
+
* },
|
|
3042
|
+
* })
|
|
3043
|
+
*
|
|
3044
|
+
* // In a parent component:
|
|
3045
|
+
* provideAppLocale()
|
|
3046
|
+
*
|
|
3047
|
+
* // In a child component:
|
|
3048
|
+
* const locale = useAppLocale()
|
|
3049
|
+
* locale.select('es')
|
|
3050
|
+
* ```
|
|
2596
3051
|
*/
|
|
2597
|
-
function
|
|
2598
|
-
|
|
3052
|
+
function createLocaleContext(_options = {}) {
|
|
3053
|
+
const { namespace = "v0:locale",...options } = _options;
|
|
3054
|
+
const [useLocaleContext, _provideLocaleContext] = createContext(namespace);
|
|
3055
|
+
const context = createLocale(options);
|
|
3056
|
+
function provideLocaleContext(_context = context, app) {
|
|
3057
|
+
return _provideLocaleContext(_context, app);
|
|
3058
|
+
}
|
|
3059
|
+
return createTrinity(useLocaleContext, provideLocaleContext, context);
|
|
2599
3060
|
}
|
|
2600
3061
|
/**
|
|
2601
3062
|
* Creates a new locale plugin.
|
|
@@ -2610,19 +3071,30 @@ function useLocale() {
|
|
|
2610
3071
|
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
2611
3072
|
*/
|
|
2612
3073
|
function createLocalePlugin(_options = {}) {
|
|
2613
|
-
const { adapter = new Vuetify0LocaleAdapter(), messages = {},...options } = _options;
|
|
2614
|
-
const [, provideLocaleContext,
|
|
3074
|
+
const { namespace = "v0:locale", adapter = new Vuetify0LocaleAdapter(), messages = {},...options } = _options;
|
|
3075
|
+
const [, provideLocaleContext, context] = createLocaleContext({
|
|
2615
3076
|
...options,
|
|
3077
|
+
namespace,
|
|
2616
3078
|
adapter,
|
|
2617
3079
|
messages
|
|
2618
3080
|
});
|
|
2619
3081
|
return createPlugin({
|
|
2620
|
-
namespace
|
|
3082
|
+
namespace,
|
|
2621
3083
|
provide: (app) => {
|
|
2622
|
-
provideLocaleContext(
|
|
3084
|
+
provideLocaleContext(context, app);
|
|
2623
3085
|
}
|
|
2624
3086
|
});
|
|
2625
3087
|
}
|
|
3088
|
+
/**
|
|
3089
|
+
* Returns the current locale instance.
|
|
3090
|
+
*
|
|
3091
|
+
* @returns The current locale instance.
|
|
3092
|
+
*
|
|
3093
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
3094
|
+
*/
|
|
3095
|
+
function useLocale(namespace = "v0:locale") {
|
|
3096
|
+
return useContext(namespace);
|
|
3097
|
+
}
|
|
2626
3098
|
|
|
2627
3099
|
//#endregion
|
|
2628
3100
|
//#region src/composables/useMutationObserver/index.ts
|
|
@@ -2771,19 +3243,19 @@ var Vuetify0PermissionAdapter = class extends PermissionAdapter {
|
|
|
2771
3243
|
/**
|
|
2772
3244
|
* Creates a new permissions instance.
|
|
2773
3245
|
*
|
|
2774
|
-
* @param namespace The namespace for the permissions instance.
|
|
2775
3246
|
* @param options The options for the permissions instance.
|
|
2776
3247
|
* @template Z The type of the permission ticket.
|
|
2777
3248
|
* @template E The type of the permission context.
|
|
2778
3249
|
* @returns A new permissions instance.
|
|
2779
3250
|
*
|
|
2780
|
-
* @see https://0.vuetifyjs.com/composables/plugins/
|
|
3251
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
2781
3252
|
*
|
|
2782
3253
|
* @example
|
|
2783
3254
|
* ```ts
|
|
2784
3255
|
* import { createPermissions } from '@vuetify/v0'
|
|
2785
3256
|
*
|
|
2786
|
-
* const [usePermissions, providePermissions] = createPermissions(
|
|
3257
|
+
* const [usePermissions, providePermissions] = createPermissions({
|
|
3258
|
+
* namespace: 'v0:permissions',
|
|
2787
3259
|
* permissions: {
|
|
2788
3260
|
* admin: [['read', 'users']],
|
|
2789
3261
|
* editor: [['edit', 'posts']],
|
|
@@ -2791,9 +3263,8 @@ var Vuetify0PermissionAdapter = class extends PermissionAdapter {
|
|
|
2791
3263
|
* })
|
|
2792
3264
|
* ```
|
|
2793
3265
|
*/
|
|
2794
|
-
function createPermissions(
|
|
2795
|
-
const { adapter = new Vuetify0PermissionAdapter(), permissions = {} } =
|
|
2796
|
-
const [usePermissionsContext, _providePermissionsContext] = createContext(namespace);
|
|
3266
|
+
function createPermissions(_options = {}) {
|
|
3267
|
+
const { adapter = new Vuetify0PermissionAdapter(), permissions = {},...options } = _options;
|
|
2797
3268
|
const record = {};
|
|
2798
3269
|
for (const role in permissions) {
|
|
2799
3270
|
if (!record[role]) record[role] = {};
|
|
@@ -2802,44 +3273,46 @@ function createPermissions(namespace = "v0:permissions", options = {}) {
|
|
|
2802
3273
|
record[role][action][subject] = condition;
|
|
2803
3274
|
}
|
|
2804
3275
|
}
|
|
2805
|
-
const tokens =
|
|
2806
|
-
function can(id, action, subject, context
|
|
2807
|
-
return adapter.can(id, action, subject, context
|
|
3276
|
+
const tokens = createTokens(record, options);
|
|
3277
|
+
function can(id, action, subject, context = {}) {
|
|
3278
|
+
return adapter.can(id, action, subject, context, tokens);
|
|
2808
3279
|
}
|
|
2809
|
-
|
|
3280
|
+
return {
|
|
2810
3281
|
...tokens,
|
|
2811
3282
|
can
|
|
2812
3283
|
};
|
|
2813
|
-
function providePermissionsContext(_context = context, app) {
|
|
2814
|
-
return _providePermissionsContext(_context, app);
|
|
2815
|
-
}
|
|
2816
|
-
return createTrinity(usePermissionsContext, providePermissionsContext, context);
|
|
2817
3284
|
}
|
|
2818
3285
|
/**
|
|
2819
|
-
*
|
|
3286
|
+
* Creates a new permissions context.
|
|
2820
3287
|
*
|
|
3288
|
+
* @param options The options for the permissions context.
|
|
2821
3289
|
* @template Z The type of the permission ticket.
|
|
2822
|
-
* @
|
|
3290
|
+
* @template E The type of the permission context.
|
|
3291
|
+
* @returns A new permissions context.
|
|
2823
3292
|
*
|
|
2824
3293
|
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
2825
3294
|
*
|
|
2826
3295
|
* @example
|
|
2827
|
-
* ```
|
|
2828
|
-
*
|
|
2829
|
-
* import { usePermissions } from '@vuetify/v0'
|
|
2830
|
-
*
|
|
2831
|
-
* const { can } = usePermissions()
|
|
2832
|
-
* <\/script>
|
|
3296
|
+
* ```ts
|
|
3297
|
+
* import { createPermissionsContext } from '@vuetify/v0'
|
|
2833
3298
|
*
|
|
2834
|
-
*
|
|
2835
|
-
*
|
|
2836
|
-
*
|
|
2837
|
-
*
|
|
2838
|
-
*
|
|
3299
|
+
* export const [usePermissions, providePermissions, context] = createPermissionsContext({
|
|
3300
|
+
* namespace: 'app:permissions',
|
|
3301
|
+
* permissions: {
|
|
3302
|
+
* admin: [['read', 'users'], ['edit', 'users']],
|
|
3303
|
+
* editor: [['edit', 'posts']],
|
|
3304
|
+
* },
|
|
3305
|
+
* })
|
|
2839
3306
|
* ```
|
|
2840
3307
|
*/
|
|
2841
|
-
function
|
|
2842
|
-
|
|
3308
|
+
function createPermissionsContext(_options = {}) {
|
|
3309
|
+
const { namespace = "v0:permissions",...options } = _options;
|
|
3310
|
+
const [usePermissionsContext, _providePermissionsContext] = createContext(namespace);
|
|
3311
|
+
const context = createPermissions(options);
|
|
3312
|
+
function providePermissionsContext(_context = context, app) {
|
|
3313
|
+
return _providePermissionsContext(_context, app);
|
|
3314
|
+
}
|
|
3315
|
+
return createTrinity(usePermissionsContext, providePermissionsContext, context);
|
|
2843
3316
|
}
|
|
2844
3317
|
/**
|
|
2845
3318
|
* Creates a new permissions plugin.
|
|
@@ -2871,15 +3344,45 @@ function usePermissions() {
|
|
|
2871
3344
|
* app.mount('#app')
|
|
2872
3345
|
* ```
|
|
2873
3346
|
*/
|
|
2874
|
-
function createPermissionsPlugin(
|
|
2875
|
-
const
|
|
3347
|
+
function createPermissionsPlugin(_options = {}) {
|
|
3348
|
+
const { namespace = "v0:permissions",...options } = _options;
|
|
3349
|
+
const [, providePermissionContext, context] = createPermissionsContext({
|
|
3350
|
+
...options,
|
|
3351
|
+
namespace
|
|
3352
|
+
});
|
|
2876
3353
|
return createPlugin({
|
|
2877
|
-
namespace
|
|
3354
|
+
namespace,
|
|
2878
3355
|
provide: (app) => {
|
|
2879
3356
|
providePermissionContext(context, app);
|
|
2880
3357
|
}
|
|
2881
3358
|
});
|
|
2882
3359
|
}
|
|
3360
|
+
/**
|
|
3361
|
+
* Returns the current permissions instance.
|
|
3362
|
+
*
|
|
3363
|
+
* @template Z The type of the permission ticket.
|
|
3364
|
+
* @returns The current permissions instance.
|
|
3365
|
+
*
|
|
3366
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
3367
|
+
*
|
|
3368
|
+
* @example
|
|
3369
|
+
* ```vue
|
|
3370
|
+
* <script setup lang="ts">
|
|
3371
|
+
* import { usePermissions } from '@vuetify/v0'
|
|
3372
|
+
*
|
|
3373
|
+
* const { can } = usePermissions()
|
|
3374
|
+
* <\/script>
|
|
3375
|
+
*
|
|
3376
|
+
* <template>
|
|
3377
|
+
* <div>
|
|
3378
|
+
* <p v-if="can('admin', 'read', 'users')">Admin access</p>
|
|
3379
|
+
* </div>
|
|
3380
|
+
* </template>
|
|
3381
|
+
* ```
|
|
3382
|
+
*/
|
|
3383
|
+
function usePermissions(namespace = "v0:permissions") {
|
|
3384
|
+
return useContext(namespace);
|
|
3385
|
+
}
|
|
2883
3386
|
|
|
2884
3387
|
//#endregion
|
|
2885
3388
|
//#region src/composables/useProxyModel/index.ts
|
|
@@ -2898,9 +3401,9 @@ function createPermissionsPlugin(options = {}) {
|
|
|
2898
3401
|
*
|
|
2899
3402
|
* @example
|
|
2900
3403
|
* ```ts
|
|
2901
|
-
* import {
|
|
3404
|
+
* import { createSelection, useProxyModel } from '@vuetify/v0'
|
|
2902
3405
|
*
|
|
2903
|
-
* const registry =
|
|
3406
|
+
* const registry = createSelection({ events: true })
|
|
2904
3407
|
* registry.onboard([
|
|
2905
3408
|
* { id: 'item-1', value: 'Item 1' },
|
|
2906
3409
|
* { id: 'item-2', value: 'Item 2' },
|
|
@@ -3037,7 +3540,7 @@ function useProxyRegistry(registry$1, options) {
|
|
|
3037
3540
|
registry$1.on("update:ticket", update);
|
|
3038
3541
|
registry$1.on("clear:registry", update);
|
|
3039
3542
|
onScopeDispose(() => {
|
|
3040
|
-
registry$1.off("register:
|
|
3543
|
+
registry$1.off("register:ticket", update);
|
|
3041
3544
|
registry$1.off("unregister:ticket", update);
|
|
3042
3545
|
registry$1.off("update:ticket", update);
|
|
3043
3546
|
registry$1.off("clear:registry", update);
|
|
@@ -3078,8 +3581,8 @@ function useProxyRegistry(registry$1, options) {
|
|
|
3078
3581
|
* console.log(queue.size) // 2
|
|
3079
3582
|
* ```
|
|
3080
3583
|
*/
|
|
3081
|
-
function
|
|
3082
|
-
const { timeout: _timeout = 3e3,...options } = _options
|
|
3584
|
+
function createQueue(_options = {}) {
|
|
3585
|
+
const { timeout: _timeout = 3e3,...options } = _options;
|
|
3083
3586
|
const registry$1 = useRegistry({
|
|
3084
3587
|
...options,
|
|
3085
3588
|
events: true
|
|
@@ -3160,6 +3663,55 @@ function useQueue(_options) {
|
|
|
3160
3663
|
}
|
|
3161
3664
|
};
|
|
3162
3665
|
}
|
|
3666
|
+
/**
|
|
3667
|
+
* Creates a new queue context.
|
|
3668
|
+
*
|
|
3669
|
+
* @param namespace The namespace for the queue context.
|
|
3670
|
+
* @param options The options for the queue context.
|
|
3671
|
+
* @template Z The type of the queue ticket.
|
|
3672
|
+
* @template E The type of the queue context.
|
|
3673
|
+
* @returns A new queue context.
|
|
3674
|
+
*
|
|
3675
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue
|
|
3676
|
+
*
|
|
3677
|
+
* @example
|
|
3678
|
+
* ```ts
|
|
3679
|
+
* import { createQueueContext } from '@vuetify/v0'
|
|
3680
|
+
*
|
|
3681
|
+
* export const [useQueue, provideQueue] = createQueueContext('v0:queue', {
|
|
3682
|
+
* timeout: 5000,
|
|
3683
|
+
* })
|
|
3684
|
+
* ```
|
|
3685
|
+
*/
|
|
3686
|
+
function createQueueContext(_options) {
|
|
3687
|
+
const { namespace,...options } = _options;
|
|
3688
|
+
const [useQueueContext, _provideQueueContext] = createContext(namespace);
|
|
3689
|
+
const context = createQueue(options);
|
|
3690
|
+
function provideQueueContext(_context = context, app) {
|
|
3691
|
+
return _provideQueueContext(_context, app);
|
|
3692
|
+
}
|
|
3693
|
+
return createTrinity(useQueueContext, provideQueueContext, context);
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3696
|
+
* Returns the current queue instance.
|
|
3697
|
+
*
|
|
3698
|
+
* @param namespace The namespace for the queue context. Defaults to `'v0:queue'`.
|
|
3699
|
+
* @returns The current queue instance.
|
|
3700
|
+
*
|
|
3701
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue
|
|
3702
|
+
*
|
|
3703
|
+
* @example
|
|
3704
|
+
* ```vue
|
|
3705
|
+
* <script setup lang="ts">
|
|
3706
|
+
* import { useQueue } from '@vuetify/v0'
|
|
3707
|
+
*
|
|
3708
|
+
* const queue = useQueue()
|
|
3709
|
+
* <\/script>
|
|
3710
|
+
* ```
|
|
3711
|
+
*/
|
|
3712
|
+
function useQueue(namespace = "v0:queue") {
|
|
3713
|
+
return useContext(namespace);
|
|
3714
|
+
}
|
|
3163
3715
|
|
|
3164
3716
|
//#endregion
|
|
3165
3717
|
//#region src/composables/useResizeObserver/index.ts
|
|
@@ -3315,35 +3867,66 @@ function useElementSize(target) {
|
|
|
3315
3867
|
//#endregion
|
|
3316
3868
|
//#region src/composables/useStep/index.ts
|
|
3317
3869
|
/**
|
|
3318
|
-
* Creates a new step instance.
|
|
3870
|
+
* Creates a new step instance with circular navigation through items.
|
|
3871
|
+
*
|
|
3872
|
+
* Extends `createSingle` with `first()`, `last()`, `next()`, `prev()`, and `step(count)` methods
|
|
3873
|
+
* for sequential navigation. Automatically wraps around at boundaries (circular navigation).
|
|
3319
3874
|
*
|
|
3320
3875
|
* @param options The options for the step instance.
|
|
3321
3876
|
* @template Z The type of the step ticket.
|
|
3322
3877
|
* @template E The type of the step context.
|
|
3323
|
-
* @returns A new step instance.
|
|
3878
|
+
* @returns A new step instance with navigation methods.
|
|
3879
|
+
*
|
|
3880
|
+
* @remarks
|
|
3881
|
+
* **Key Features:**
|
|
3882
|
+
* - **Circular Navigation**: Wrapping at start/end boundaries
|
|
3883
|
+
* - **Disabled Item Skipping**: Automatically skips disabled items during navigation
|
|
3884
|
+
* - **Bidirectional**: Forward (`next`, positive `step`) and backward (`prev`, negative `step`)
|
|
3885
|
+
* - **Safe Edge Cases**: Handles empty registries and all-disabled scenarios gracefully
|
|
3886
|
+
*
|
|
3887
|
+
* **Navigation Methods:**
|
|
3888
|
+
* - `first()`: Select first non-disabled item
|
|
3889
|
+
* - `last()`: Select last non-disabled item
|
|
3890
|
+
* - `next()`: Move to next item (wraps to first)
|
|
3891
|
+
* - `prev()`: Move to previous item (wraps to last)
|
|
3892
|
+
* - `step(count)`: Move by `count` positions (negative for backward)
|
|
3893
|
+
*
|
|
3894
|
+
* **Wrapping Behavior:**
|
|
3895
|
+
* - Uses modulo arithmetic for circular wrapping: `((index % length) + length) % length`
|
|
3896
|
+
* - Works correctly with negative indexes and large step counts
|
|
3897
|
+
* - Continues searching if landing on disabled items (up to registry length iterations)
|
|
3898
|
+
* - Returns early if all items are disabled to prevent infinite loops
|
|
3899
|
+
*
|
|
3900
|
+
* **Inheritance Chain:**
|
|
3901
|
+
* `useRegistry` → `createSelection` → `createSingle` → `createStep`
|
|
3324
3902
|
*
|
|
3325
3903
|
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
3326
3904
|
*
|
|
3327
3905
|
* @example
|
|
3328
3906
|
* ```ts
|
|
3329
|
-
* import {
|
|
3907
|
+
* import { createStep } from '@vuetify/v0'
|
|
3330
3908
|
*
|
|
3331
|
-
* const
|
|
3909
|
+
* const wizard = createStep({ mandatory: true })
|
|
3332
3910
|
*
|
|
3333
|
-
*
|
|
3334
|
-
* { id: '
|
|
3335
|
-
* { id: '
|
|
3336
|
-
* { id: '
|
|
3911
|
+
* wizard.onboard([
|
|
3912
|
+
* { id: 'account', value: 'Account Info' },
|
|
3913
|
+
* { id: 'payment', value: 'Payment Details' },
|
|
3914
|
+
* { id: 'review', value: 'Review', disabled: true },
|
|
3915
|
+
* { id: 'confirm', value: 'Confirmation' },
|
|
3337
3916
|
* ])
|
|
3338
3917
|
*
|
|
3339
|
-
*
|
|
3340
|
-
*
|
|
3918
|
+
* wizard.first() // Select 'account'
|
|
3919
|
+
* console.log(wizard.selectedId.value) // 'account'
|
|
3341
3920
|
*
|
|
3342
|
-
*
|
|
3921
|
+
* wizard.next() // Move to 'payment'
|
|
3922
|
+
* wizard.next() // Skip disabled 'review', move to 'confirm'
|
|
3923
|
+
* wizard.next() // Wrap around to 'account'
|
|
3924
|
+
*
|
|
3925
|
+
* wizard.step(-2) // Go back 2 steps (wraps correctly)
|
|
3343
3926
|
* ```
|
|
3344
3927
|
*/
|
|
3345
|
-
function
|
|
3346
|
-
const registry$1 =
|
|
3928
|
+
function createStep(options) {
|
|
3929
|
+
const registry$1 = createSingle(options);
|
|
3347
3930
|
function first() {
|
|
3348
3931
|
const ticket = registry$1.seek("first");
|
|
3349
3932
|
if (ticket) registry$1.select(ticket.id);
|
|
@@ -3414,14 +3997,42 @@ function useStep(options) {
|
|
|
3414
3997
|
* wizard.next() // Progress to next step
|
|
3415
3998
|
* ```
|
|
3416
3999
|
*/
|
|
3417
|
-
function createStepContext(
|
|
4000
|
+
function createStepContext(_options) {
|
|
4001
|
+
const { namespace,...options } = _options;
|
|
3418
4002
|
const [useStepContext, _provideStepContext] = createContext(namespace);
|
|
3419
|
-
const context =
|
|
4003
|
+
const context = createStep(options);
|
|
3420
4004
|
function provideStepContext(_context = context, app) {
|
|
3421
4005
|
return _provideStepContext(_context, app);
|
|
3422
4006
|
}
|
|
3423
4007
|
return createTrinity(useStepContext, provideStepContext, context);
|
|
3424
4008
|
}
|
|
4009
|
+
/**
|
|
4010
|
+
* Returns the current step instance.
|
|
4011
|
+
*
|
|
4012
|
+
* @param namespace The namespace for the step context. Defaults to `'v0:step'`.
|
|
4013
|
+
* @returns The current step instance.
|
|
4014
|
+
*
|
|
4015
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
4016
|
+
*
|
|
4017
|
+
* @example
|
|
4018
|
+
* ```vue
|
|
4019
|
+
* <script setup lang="ts">
|
|
4020
|
+
* import { useStep } from '@vuetify/v0'
|
|
4021
|
+
*
|
|
4022
|
+
* const wizard = useStep()
|
|
4023
|
+
* <\/script>
|
|
4024
|
+
*
|
|
4025
|
+
* <template>
|
|
4026
|
+
* <div>
|
|
4027
|
+
* <p>Current step: {{ wizard.selectedIndex }}</p>
|
|
4028
|
+
* <button @click="wizard.next()">Next</button>
|
|
4029
|
+
* </div>
|
|
4030
|
+
* </template>
|
|
4031
|
+
* ```
|
|
4032
|
+
*/
|
|
4033
|
+
function useStep(namespace = "v0:step") {
|
|
4034
|
+
return useContext(namespace);
|
|
4035
|
+
}
|
|
3425
4036
|
|
|
3426
4037
|
//#endregion
|
|
3427
4038
|
//#region src/composables/useStorage/adapters/memory.ts
|
|
@@ -3537,31 +4148,14 @@ function createStorage(options = {}) {
|
|
|
3537
4148
|
clear
|
|
3538
4149
|
};
|
|
3539
4150
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
* ```vue
|
|
3549
|
-
* <script setup lang="ts">
|
|
3550
|
-
* import { useStorage } from '@vuetify/v0'
|
|
3551
|
-
*
|
|
3552
|
-
* const storage = useStorage()
|
|
3553
|
-
* const username = storage.get('username', 'Guest')
|
|
3554
|
-
* <\/script>
|
|
3555
|
-
*
|
|
3556
|
-
* <template>
|
|
3557
|
-
* <div>
|
|
3558
|
-
* <p>Username: {{ username }}</p>
|
|
3559
|
-
* </div>
|
|
3560
|
-
* </template>
|
|
3561
|
-
* ```
|
|
3562
|
-
*/
|
|
3563
|
-
function useStorage() {
|
|
3564
|
-
return useStorageContext();
|
|
4151
|
+
function createStorageContext(_options = {}) {
|
|
4152
|
+
const { namespace = "v0:storage",...options } = _options;
|
|
4153
|
+
const [useStorageContext$1, _provideStorageContext] = createContext(namespace);
|
|
4154
|
+
const context = createStorage(options);
|
|
4155
|
+
function provideStorageContext$1(_context = context, app) {
|
|
4156
|
+
return _provideStorageContext(_context, app);
|
|
4157
|
+
}
|
|
4158
|
+
return createTrinity(useStorageContext$1, provideStorageContext$1, context);
|
|
3565
4159
|
}
|
|
3566
4160
|
/**
|
|
3567
4161
|
* Creates a new storage plugin.
|
|
@@ -3584,15 +4178,46 @@ function useStorage() {
|
|
|
3584
4178
|
* app.mount('#app')
|
|
3585
4179
|
* ```
|
|
3586
4180
|
*/
|
|
3587
|
-
function createStoragePlugin(
|
|
3588
|
-
const
|
|
4181
|
+
function createStoragePlugin(_options = {}) {
|
|
4182
|
+
const { namespace = "v0:storage",...options } = _options;
|
|
4183
|
+
const [, provideStorageContext$1, context] = createStorageContext({
|
|
4184
|
+
...options,
|
|
4185
|
+
namespace
|
|
4186
|
+
});
|
|
3589
4187
|
return createPlugin({
|
|
3590
|
-
namespace
|
|
4188
|
+
namespace,
|
|
3591
4189
|
provide: (app) => {
|
|
3592
|
-
provideStorageContext(context, app);
|
|
4190
|
+
provideStorageContext$1(context, app);
|
|
3593
4191
|
}
|
|
3594
4192
|
});
|
|
3595
4193
|
}
|
|
4194
|
+
/**
|
|
4195
|
+
* Returns the current storage instance.
|
|
4196
|
+
*
|
|
4197
|
+
* @param namespace The namespace for the storage context. Defaults to `'v0:storage'`.
|
|
4198
|
+
* @returns The current storage instance.
|
|
4199
|
+
*
|
|
4200
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-storage
|
|
4201
|
+
*
|
|
4202
|
+
* @example
|
|
4203
|
+
* ```vue
|
|
4204
|
+
* <script setup lang="ts">
|
|
4205
|
+
* import { useStorage } from '@vuetify/v0'
|
|
4206
|
+
*
|
|
4207
|
+
* const storage = useStorage()
|
|
4208
|
+
* const username = storage.get('username', 'Guest')
|
|
4209
|
+
* <\/script>
|
|
4210
|
+
*
|
|
4211
|
+
* <template>
|
|
4212
|
+
* <div>
|
|
4213
|
+
* <p>Username: {{ username }}</p>
|
|
4214
|
+
* </div>
|
|
4215
|
+
* </template>
|
|
4216
|
+
* ```
|
|
4217
|
+
*/
|
|
4218
|
+
function useStorage(namespace = "v0:storage") {
|
|
4219
|
+
return useContext(namespace);
|
|
4220
|
+
}
|
|
3596
4221
|
|
|
3597
4222
|
//#endregion
|
|
3598
4223
|
//#region src/composables/useTheme/adapters/adapter.ts
|
|
@@ -3650,7 +4275,6 @@ var Vuetify0ThemeAdapter = class extends ThemeAdapter {
|
|
|
3650
4275
|
/**
|
|
3651
4276
|
* Creates a new theme instance.
|
|
3652
4277
|
*
|
|
3653
|
-
* @param namespace The namespace for the theme instance.
|
|
3654
4278
|
* @param options The options for the theme instance.
|
|
3655
4279
|
* @template Z The type of the theme ticket.
|
|
3656
4280
|
* @template E The type of the theme context.
|
|
@@ -3662,7 +4286,8 @@ var Vuetify0ThemeAdapter = class extends ThemeAdapter {
|
|
|
3662
4286
|
* ```ts
|
|
3663
4287
|
* import { createTheme } from '@vuetify/v0'
|
|
3664
4288
|
*
|
|
3665
|
-
* export const [useTheme, provideTheme] = createTheme(
|
|
4289
|
+
* export const [useTheme, provideTheme] = createTheme({
|
|
4290
|
+
* namespace: 'v0:theme',
|
|
3666
4291
|
* default: 'light',
|
|
3667
4292
|
* themes: {
|
|
3668
4293
|
* light: {
|
|
@@ -3681,14 +4306,13 @@ var Vuetify0ThemeAdapter = class extends ThemeAdapter {
|
|
|
3681
4306
|
* })
|
|
3682
4307
|
* ```
|
|
3683
4308
|
*/
|
|
3684
|
-
function createTheme(
|
|
3685
|
-
const { themes = {}, palette = {} } =
|
|
3686
|
-
const
|
|
3687
|
-
const tokens = useTokens({
|
|
4309
|
+
function createTheme(_options = {}) {
|
|
4310
|
+
const { themes = {}, palette = {},...options } = _options;
|
|
4311
|
+
const tokens = createTokens({
|
|
3688
4312
|
palette,
|
|
3689
4313
|
...themes
|
|
3690
4314
|
}, { flat: true });
|
|
3691
|
-
const registry$1 =
|
|
4315
|
+
const registry$1 = createSingle(options);
|
|
3692
4316
|
for (const id in themes) {
|
|
3693
4317
|
const { colors: value,...theme } = themes[id];
|
|
3694
4318
|
register({
|
|
@@ -3725,7 +4349,7 @@ function createTheme(namespace = "v0:theme", options = {}) {
|
|
|
3725
4349
|
};
|
|
3726
4350
|
return registry$1.register(item);
|
|
3727
4351
|
}
|
|
3728
|
-
|
|
4352
|
+
return {
|
|
3729
4353
|
...registry$1,
|
|
3730
4354
|
colors,
|
|
3731
4355
|
register,
|
|
@@ -3734,40 +4358,54 @@ function createTheme(namespace = "v0:theme", options = {}) {
|
|
|
3734
4358
|
return registry$1.size;
|
|
3735
4359
|
}
|
|
3736
4360
|
};
|
|
3737
|
-
function provideThemeContext(_context = context, app) {
|
|
3738
|
-
return _provideThemeContext(_context, app);
|
|
3739
|
-
}
|
|
3740
|
-
return createTrinity(useThemeContext, provideThemeContext, context);
|
|
3741
4361
|
}
|
|
3742
4362
|
/**
|
|
3743
|
-
*
|
|
4363
|
+
* Creates a new theme context trinity.
|
|
3744
4364
|
*
|
|
3745
|
-
* @
|
|
4365
|
+
* @param options The options for the theme context.
|
|
4366
|
+
* @template Z The type of the theme ticket.
|
|
4367
|
+
* @template E The type of the theme context.
|
|
4368
|
+
* @returns A new theme context trinity.
|
|
3746
4369
|
*
|
|
3747
4370
|
* @see https://0.vuetifyjs.com/composables/plugins/use-theme
|
|
3748
4371
|
*
|
|
3749
4372
|
* @example
|
|
3750
|
-
* ```
|
|
3751
|
-
*
|
|
3752
|
-
* import { useTheme } from '@vuetify/v0'
|
|
3753
|
-
*
|
|
3754
|
-
* const theme = useTheme()
|
|
3755
|
-
* <\/script>
|
|
4373
|
+
* ```ts
|
|
4374
|
+
* import { createThemeContext } from '@vuetify/v0'
|
|
3756
4375
|
*
|
|
3757
|
-
*
|
|
3758
|
-
*
|
|
3759
|
-
*
|
|
3760
|
-
*
|
|
3761
|
-
*
|
|
4376
|
+
* export const [useThemeContext, provideThemeContext, context] = createThemeContext({
|
|
4377
|
+
* namespace: 'v0:theme',
|
|
4378
|
+
* default: 'light',
|
|
4379
|
+
* themes: {
|
|
4380
|
+
* light: {
|
|
4381
|
+
* dark: false,
|
|
4382
|
+
* colors: {
|
|
4383
|
+
* primary: '#3b82f6',
|
|
4384
|
+
* },
|
|
4385
|
+
* },
|
|
4386
|
+
* dark: {
|
|
4387
|
+
* dark: true,
|
|
4388
|
+
* colors: {
|
|
4389
|
+
* primary: '#675496',
|
|
4390
|
+
* },
|
|
4391
|
+
* },
|
|
4392
|
+
* },
|
|
4393
|
+
* })
|
|
3762
4394
|
* ```
|
|
3763
4395
|
*/
|
|
3764
|
-
function
|
|
3765
|
-
|
|
4396
|
+
function createThemeContext(_options = {}) {
|
|
4397
|
+
const { namespace = "v0:theme",...options } = _options;
|
|
4398
|
+
const [useThemeContext, _provideThemeContext] = createContext(namespace);
|
|
4399
|
+
const context = createTheme(options);
|
|
4400
|
+
function provideThemeContext(_context = context, app) {
|
|
4401
|
+
return _provideThemeContext(_context, app);
|
|
4402
|
+
}
|
|
4403
|
+
return createTrinity(useThemeContext, provideThemeContext, context);
|
|
3766
4404
|
}
|
|
3767
4405
|
/**
|
|
3768
4406
|
* Creates a new theme plugin.
|
|
3769
4407
|
*
|
|
3770
|
-
* @param
|
|
4408
|
+
* @param options The options for the theme plugin.
|
|
3771
4409
|
* @template Z The type of the theme ticket.
|
|
3772
4410
|
* @template E The type of the theme context.
|
|
3773
4411
|
* @returns A new theme plugin.
|
|
@@ -3806,27 +4444,28 @@ function useTheme() {
|
|
|
3806
4444
|
* ```
|
|
3807
4445
|
*/
|
|
3808
4446
|
function createThemePlugin(_options = {}) {
|
|
3809
|
-
const { adapter = new Vuetify0ThemeAdapter(), palette = {}, themes = {}, target,...options } = _options;
|
|
3810
|
-
const [, provideThemeContext,
|
|
4447
|
+
const { adapter = new Vuetify0ThemeAdapter(), namespace = "v0:theme", palette = {}, themes = {}, target,...options } = _options;
|
|
4448
|
+
const [, provideThemeContext, context] = createThemeContext({
|
|
3811
4449
|
...options,
|
|
4450
|
+
namespace,
|
|
3812
4451
|
themes,
|
|
3813
4452
|
palette
|
|
3814
4453
|
});
|
|
3815
4454
|
return createPlugin({
|
|
3816
|
-
namespace
|
|
4455
|
+
namespace,
|
|
3817
4456
|
provide: (app) => {
|
|
3818
|
-
provideThemeContext(
|
|
4457
|
+
provideThemeContext(context, app);
|
|
3819
4458
|
},
|
|
3820
4459
|
setup: (app) => {
|
|
3821
4460
|
if (IN_BROWSER) {
|
|
3822
|
-
onScopeDispose(watch(
|
|
4461
|
+
onScopeDispose(watch(context.colors, (colors) => {
|
|
3823
4462
|
adapter.update(colors);
|
|
3824
4463
|
}, { immediate: true }), true);
|
|
3825
4464
|
if (target === null) return;
|
|
3826
|
-
const targetEl = target instanceof HTMLElement ? target :
|
|
4465
|
+
const targetEl = target instanceof HTMLElement ? target : /* @__PURE__ */ isString(target) ? document.querySelector(target) : app._container || document.querySelector("#app") || document.body;
|
|
3827
4466
|
if (!targetEl) return;
|
|
3828
4467
|
let prevClass = "";
|
|
3829
|
-
onScopeDispose(watch(
|
|
4468
|
+
onScopeDispose(watch(context.selectedId, (id) => {
|
|
3830
4469
|
if (!id) return;
|
|
3831
4470
|
const themeClass = `${adapter.prefix}-theme--${id}`;
|
|
3832
4471
|
if (prevClass) targetEl.classList.remove(prevClass);
|
|
@@ -3836,11 +4475,11 @@ function createThemePlugin(_options = {}) {
|
|
|
3836
4475
|
} else {
|
|
3837
4476
|
const head = app._context?.provides?.usehead ?? app._context?.provides?.head;
|
|
3838
4477
|
if (head?.push) {
|
|
3839
|
-
const id =
|
|
4478
|
+
const id = context.selectedId.value;
|
|
3840
4479
|
head.push({
|
|
3841
4480
|
htmlAttrs: { class: id ? `${adapter.prefix}-theme--${id}` : "" },
|
|
3842
4481
|
style: [{
|
|
3843
|
-
innerHTML: adapter.generate(
|
|
4482
|
+
innerHTML: adapter.generate(context.colors.value),
|
|
3844
4483
|
id: adapter.stylesheetId
|
|
3845
4484
|
}]
|
|
3846
4485
|
});
|
|
@@ -3849,6 +4488,32 @@ function createThemePlugin(_options = {}) {
|
|
|
3849
4488
|
}
|
|
3850
4489
|
});
|
|
3851
4490
|
}
|
|
4491
|
+
/**
|
|
4492
|
+
* Returns the current theme instance.
|
|
4493
|
+
*
|
|
4494
|
+
* @param namespace The namespace for the theme context. Defaults to `v0:theme`.
|
|
4495
|
+
* @returns The current theme instance.
|
|
4496
|
+
*
|
|
4497
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-theme
|
|
4498
|
+
*
|
|
4499
|
+
* @example
|
|
4500
|
+
* ```vue
|
|
4501
|
+
* <script setup lang="ts">
|
|
4502
|
+
* import { useTheme } from '@vuetify/v0'
|
|
4503
|
+
*
|
|
4504
|
+
* const theme = useTheme()
|
|
4505
|
+
* <\/script>
|
|
4506
|
+
*
|
|
4507
|
+
* <template>
|
|
4508
|
+
* <div>
|
|
4509
|
+
* <p>Current theme: {{ theme.selected.value }}</p>
|
|
4510
|
+
* </div>
|
|
4511
|
+
* </template>
|
|
4512
|
+
* ```
|
|
4513
|
+
*/
|
|
4514
|
+
function useTheme(namespace = "v0:theme") {
|
|
4515
|
+
return useContext(namespace);
|
|
4516
|
+
}
|
|
3852
4517
|
|
|
3853
4518
|
//#endregion
|
|
3854
4519
|
//#region src/composables/useTimeline/index.ts
|
|
@@ -3879,7 +4544,7 @@ function createThemePlugin(_options = {}) {
|
|
|
3879
4544
|
* console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }, { id: 'three' }]
|
|
3880
4545
|
* ```
|
|
3881
4546
|
*/
|
|
3882
|
-
function
|
|
4547
|
+
function createTimeline(_options = {}) {
|
|
3883
4548
|
const { size = 10,...options } = _options;
|
|
3884
4549
|
const registry$1 = useRegistry(options);
|
|
3885
4550
|
const stack = [];
|
|
@@ -3926,10 +4591,66 @@ function useTimeline(_options = {}) {
|
|
|
3926
4591
|
}
|
|
3927
4592
|
};
|
|
3928
4593
|
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Creates a new timeline plugin.
|
|
4596
|
+
*
|
|
4597
|
+
* @param namespace The namespace for the timeline plugin.
|
|
4598
|
+
* @param options The options for the timeline plugin.
|
|
4599
|
+
* @template Z The type of the timeline ticket.
|
|
4600
|
+
* @template E The type of the timeline context.
|
|
4601
|
+
* @returns A new timeline plugin.
|
|
4602
|
+
*
|
|
4603
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-timeline
|
|
4604
|
+
*
|
|
4605
|
+
* @example
|
|
4606
|
+
* ```ts
|
|
4607
|
+
* import { createTimelineContext } from '@vuetify/v0'
|
|
4608
|
+
*
|
|
4609
|
+
* export const [useTimeline, provideTimeline, context] = createTimelineContext('v0:timeline', { size: 5 })
|
|
4610
|
+
* context.register({ id: 'example' })
|
|
4611
|
+
*
|
|
4612
|
+
* // In a parent component
|
|
4613
|
+
* provideTimeline()
|
|
4614
|
+
*
|
|
4615
|
+
* // In a child component
|
|
4616
|
+
* const timeline = useTimeline()
|
|
4617
|
+
*
|
|
4618
|
+
* console.log(timeline.values()) // [{ id: 'example' }]
|
|
4619
|
+
* ```
|
|
4620
|
+
*/
|
|
4621
|
+
function createTimelineContext(_options) {
|
|
4622
|
+
const { namespace,...options } = _options;
|
|
4623
|
+
const [useTimelineContext, _provideTimelineContext] = createContext(namespace);
|
|
4624
|
+
const context = createTimeline(options);
|
|
4625
|
+
function provideTimelineContext(_context = context, app) {
|
|
4626
|
+
return _provideTimelineContext(_context, app);
|
|
4627
|
+
}
|
|
4628
|
+
return createTrinity(useTimelineContext, provideTimelineContext, context);
|
|
4629
|
+
}
|
|
4630
|
+
/**
|
|
4631
|
+
* Returns the current timeline instance.
|
|
4632
|
+
*
|
|
4633
|
+
* @param namespace The namespace for the timeline context. Defaults to `'v0:timeline'`.
|
|
4634
|
+
* @returns The current timeline instance.
|
|
4635
|
+
*
|
|
4636
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-timeline
|
|
4637
|
+
*
|
|
4638
|
+
* @example
|
|
4639
|
+
* ```vue
|
|
4640
|
+
* <script setup lang="ts">
|
|
4641
|
+
* import { useTimeline } from '@vuetify/v0'
|
|
4642
|
+
*
|
|
4643
|
+
* const timeline = useTimeline()
|
|
4644
|
+
* <\/script>
|
|
4645
|
+
* ```
|
|
4646
|
+
*/
|
|
4647
|
+
function useTimeline(namespace = "v0:timeline") {
|
|
4648
|
+
return useContext(namespace);
|
|
4649
|
+
}
|
|
3929
4650
|
|
|
3930
4651
|
//#endregion
|
|
3931
4652
|
//#region src/components/Avatar/AvatarRoot.vue?vue&type=script&setup=true&lang.ts
|
|
3932
|
-
const [useAvatarContext, provideAvatarContext, registry] = createRegistryContext("avatar");
|
|
4653
|
+
const [useAvatarContext, provideAvatarContext, registry] = createRegistryContext({ namespace: "avatar" });
|
|
3933
4654
|
var AvatarRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
3934
4655
|
name: "AvatarRoot",
|
|
3935
4656
|
__name: "AvatarRoot",
|
|
@@ -4083,143 +4804,6 @@ const Avatar = {
|
|
|
4083
4804
|
Root: AvatarRoot_default
|
|
4084
4805
|
};
|
|
4085
4806
|
|
|
4086
|
-
//#endregion
|
|
4087
|
-
//#region src/components/Breakpoints/BreakpointsItem.vue?vue&type=script&setup=true&lang.ts
|
|
4088
|
-
var BreakpointsItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4089
|
-
name: "BreakpointsItem",
|
|
4090
|
-
__name: "BreakpointsItem",
|
|
4091
|
-
setup(__props) {
|
|
4092
|
-
const breakpointsContext = useBreakpoints();
|
|
4093
|
-
return (_ctx, _cache) => {
|
|
4094
|
-
return openBlock(), createElementBlock(Fragment, null, [_ctx.$slots.xs && unref(breakpointsContext).xs ? renderSlot(_ctx.$slots, "xs", normalizeProps(mergeProps({ key: 0 }, unref(breakpointsContext)))) : _ctx.$slots.sm && unref(breakpointsContext).sm ? renderSlot(_ctx.$slots, "sm", normalizeProps(mergeProps({ key: 1 }, unref(breakpointsContext)))) : _ctx.$slots.md && unref(breakpointsContext).md ? renderSlot(_ctx.$slots, "md", normalizeProps(mergeProps({ key: 2 }, unref(breakpointsContext)))) : _ctx.$slots.lg && unref(breakpointsContext).lg ? renderSlot(_ctx.$slots, "lg", normalizeProps(mergeProps({ key: 3 }, unref(breakpointsContext)))) : _ctx.$slots.xl && unref(breakpointsContext).xl ? renderSlot(_ctx.$slots, "xl", normalizeProps(mergeProps({ key: 4 }, unref(breakpointsContext)))) : _ctx.$slots.xxl && unref(breakpointsContext).xxl ? renderSlot(_ctx.$slots, "xxl", normalizeProps(mergeProps({ key: 5 }, unref(breakpointsContext)))) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(breakpointsContext))))], 64);
|
|
4095
|
-
};
|
|
4096
|
-
}
|
|
4097
|
-
});
|
|
4098
|
-
|
|
4099
|
-
//#endregion
|
|
4100
|
-
//#region src/components/Breakpoints/BreakpointsItem.vue
|
|
4101
|
-
var BreakpointsItem_default = BreakpointsItem_vue_vue_type_script_setup_true_lang_default;
|
|
4102
|
-
|
|
4103
|
-
//#endregion
|
|
4104
|
-
//#region src/components/Breakpoints/BreakpointsRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4105
|
-
var BreakpointsRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4106
|
-
name: "BreakpointsRoot",
|
|
4107
|
-
__name: "BreakpointsRoot",
|
|
4108
|
-
props: {
|
|
4109
|
-
mobileBreakpoint: {},
|
|
4110
|
-
breakpoints: {}
|
|
4111
|
-
},
|
|
4112
|
-
setup(__props) {
|
|
4113
|
-
const [, provideBreakpointsContext, context] = createBreakpoints("v0:breakpoints", __props);
|
|
4114
|
-
provideBreakpointsContext(context);
|
|
4115
|
-
return (_ctx, _cache) => {
|
|
4116
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(context))));
|
|
4117
|
-
};
|
|
4118
|
-
}
|
|
4119
|
-
});
|
|
4120
|
-
|
|
4121
|
-
//#endregion
|
|
4122
|
-
//#region src/components/Breakpoints/BreakpointsRoot.vue
|
|
4123
|
-
var BreakpointsRoot_default = BreakpointsRoot_vue_vue_type_script_setup_true_lang_default;
|
|
4124
|
-
|
|
4125
|
-
//#endregion
|
|
4126
|
-
//#region src/components/Breakpoints/index.ts
|
|
4127
|
-
const Breakpoints = {
|
|
4128
|
-
Item: BreakpointsItem_default,
|
|
4129
|
-
Root: BreakpointsRoot_default
|
|
4130
|
-
};
|
|
4131
|
-
|
|
4132
|
-
//#endregion
|
|
4133
|
-
//#region src/components/Context/ContextItem.vue?vue&type=script&setup=true&lang.ts
|
|
4134
|
-
var ContextItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4135
|
-
name: "ContextItem",
|
|
4136
|
-
__name: "ContextItem",
|
|
4137
|
-
props: {
|
|
4138
|
-
contextKey: {},
|
|
4139
|
-
value: {}
|
|
4140
|
-
},
|
|
4141
|
-
setup(__props) {
|
|
4142
|
-
let contextValue;
|
|
4143
|
-
if (__props.value !== void 0) contextValue = __props.value;
|
|
4144
|
-
else if (__props.contextKey) {
|
|
4145
|
-
const [injectContext] = createContext(__props.contextKey);
|
|
4146
|
-
contextValue = injectContext();
|
|
4147
|
-
} else throw new Error("Context component requires either a \"value\" prop or a \"contextKey\" prop");
|
|
4148
|
-
const bindableProps = toRef(() => ({ value: contextValue }));
|
|
4149
|
-
return (_ctx, _cache) => {
|
|
4150
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(bindableProps.value)));
|
|
4151
|
-
};
|
|
4152
|
-
}
|
|
4153
|
-
});
|
|
4154
|
-
|
|
4155
|
-
//#endregion
|
|
4156
|
-
//#region src/components/Context/ContextItem.vue
|
|
4157
|
-
var ContextItem_default = ContextItem_vue_vue_type_script_setup_true_lang_default;
|
|
4158
|
-
|
|
4159
|
-
//#endregion
|
|
4160
|
-
//#region src/components/Context/ContextRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4161
|
-
var ContextRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4162
|
-
name: "ContextRoot",
|
|
4163
|
-
__name: "ContextRoot",
|
|
4164
|
-
props: {
|
|
4165
|
-
contextKey: {},
|
|
4166
|
-
value: {}
|
|
4167
|
-
},
|
|
4168
|
-
setup(__props) {
|
|
4169
|
-
const [, provideContext$1] = createContext(__props.contextKey);
|
|
4170
|
-
provideContext$1(__props.value);
|
|
4171
|
-
return (_ctx, _cache) => {
|
|
4172
|
-
return renderSlot(_ctx.$slots, "default");
|
|
4173
|
-
};
|
|
4174
|
-
}
|
|
4175
|
-
});
|
|
4176
|
-
|
|
4177
|
-
//#endregion
|
|
4178
|
-
//#region src/components/Context/ContextRoot.vue
|
|
4179
|
-
var ContextRoot_default = ContextRoot_vue_vue_type_script_setup_true_lang_default;
|
|
4180
|
-
|
|
4181
|
-
//#endregion
|
|
4182
|
-
//#region src/components/Context/index.ts
|
|
4183
|
-
const Context = {
|
|
4184
|
-
Item: ContextItem_default,
|
|
4185
|
-
Root: ContextRoot_default
|
|
4186
|
-
};
|
|
4187
|
-
|
|
4188
|
-
//#endregion
|
|
4189
|
-
//#region src/components/Hydration/Hydration.vue?vue&type=script&setup=true&lang.ts
|
|
4190
|
-
var Hydration_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4191
|
-
name: "Hydration",
|
|
4192
|
-
__name: "Hydration",
|
|
4193
|
-
setup(__props) {
|
|
4194
|
-
const hydrationContext = useHydration();
|
|
4195
|
-
return (_ctx, _cache) => {
|
|
4196
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(hydrationContext))));
|
|
4197
|
-
};
|
|
4198
|
-
}
|
|
4199
|
-
});
|
|
4200
|
-
|
|
4201
|
-
//#endregion
|
|
4202
|
-
//#region src/components/Hydration/Hydration.vue
|
|
4203
|
-
var Hydration_default = Hydration_vue_vue_type_script_setup_true_lang_default;
|
|
4204
|
-
|
|
4205
|
-
//#endregion
|
|
4206
|
-
//#region src/components/Hydration/HydrationRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4207
|
-
var HydrationRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4208
|
-
name: "HydrationRoot",
|
|
4209
|
-
__name: "HydrationRoot",
|
|
4210
|
-
setup(__props) {
|
|
4211
|
-
const hydrationContext = createHydration();
|
|
4212
|
-
provideHydrationContext(hydrationContext);
|
|
4213
|
-
return (_ctx, _cache) => {
|
|
4214
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(hydrationContext))));
|
|
4215
|
-
};
|
|
4216
|
-
}
|
|
4217
|
-
});
|
|
4218
|
-
|
|
4219
|
-
//#endregion
|
|
4220
|
-
//#region src/components/Hydration/HydrationRoot.vue
|
|
4221
|
-
var HydrationRoot_default = HydrationRoot_vue_vue_type_script_setup_true_lang_default;
|
|
4222
|
-
|
|
4223
4807
|
//#endregion
|
|
4224
4808
|
//#region src/components/Popover/PopoverRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4225
4809
|
const [usePopoverContext, providePopoverContext] = createContext("Popover");
|
|
@@ -4371,51 +4955,4 @@ const Popover = {
|
|
|
4371
4955
|
};
|
|
4372
4956
|
|
|
4373
4957
|
//#endregion
|
|
4374
|
-
|
|
4375
|
-
var ThemeItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4376
|
-
name: "ThemeItem",
|
|
4377
|
-
__name: "ThemeItem",
|
|
4378
|
-
setup(__props) {
|
|
4379
|
-
const themeContext = useTheme();
|
|
4380
|
-
return (_ctx, _cache) => {
|
|
4381
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(themeContext))));
|
|
4382
|
-
};
|
|
4383
|
-
}
|
|
4384
|
-
});
|
|
4385
|
-
|
|
4386
|
-
//#endregion
|
|
4387
|
-
//#region src/components/Theme/ThemeItem.vue
|
|
4388
|
-
var ThemeItem_default = ThemeItem_vue_vue_type_script_setup_true_lang_default;
|
|
4389
|
-
|
|
4390
|
-
//#endregion
|
|
4391
|
-
//#region src/components/Theme/ThemeRoot.vue?vue&type=script&setup=true&lang.ts
|
|
4392
|
-
var ThemeRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
4393
|
-
name: "ThemeRoot",
|
|
4394
|
-
__name: "ThemeRoot",
|
|
4395
|
-
props: {
|
|
4396
|
-
namespace: { default: "v0:theme" },
|
|
4397
|
-
themes: { default: () => [] }
|
|
4398
|
-
},
|
|
4399
|
-
setup(__props) {
|
|
4400
|
-
const [provideThemeContext] = createTheme(__props.namespace);
|
|
4401
|
-
const themeContext = provideThemeContext();
|
|
4402
|
-
for (const theme of __props.themes) themeContext.register(theme);
|
|
4403
|
-
return (_ctx, _cache) => {
|
|
4404
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(themeContext))));
|
|
4405
|
-
};
|
|
4406
|
-
}
|
|
4407
|
-
});
|
|
4408
|
-
|
|
4409
|
-
//#endregion
|
|
4410
|
-
//#region src/components/Theme/ThemeRoot.vue
|
|
4411
|
-
var ThemeRoot_default = ThemeRoot_vue_vue_type_script_setup_true_lang_default;
|
|
4412
|
-
|
|
4413
|
-
//#endregion
|
|
4414
|
-
//#region src/components/Theme/index.ts
|
|
4415
|
-
const Theme = {
|
|
4416
|
-
Item: ThemeItem_default,
|
|
4417
|
-
Root: ThemeRoot_default
|
|
4418
|
-
};
|
|
4419
|
-
|
|
4420
|
-
//#endregion
|
|
4421
|
-
export { Atom_default as Atom, Avatar, Breakpoints, COMMON_ELEMENTS, ConsolaLoggerAdapter, Context, Hydration_default as Hydration, HydrationRoot_default as HydrationRoot, IN_BROWSER, MemoryAdapter, PermissionAdapter, PinoLoggerAdapter, Popover, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, Theme, Vuetify0LocaleAdapter, Vuetify0LoggerAdapter, Vuetify0ThemeAdapter, __LOGGER_ENABLED__, createBreakpoints, createBreakpointsPlugin, createContext, createFeatures, createFeaturesPlugin, createGroupContext, createHydration, createHydrationPlugin, createLocale, createLocalePlugin, createLogger, createLoggerPlugin, createPermissions, createPermissionsPlugin, createPlugin, createRegistryContext, createSelectionContext, createSingleContext, createStepContext, createStorage, createStoragePlugin, createTheme, createThemePlugin, createTokensContext, createTrinity, genId, isArray, isBoolean, isFunction, isNullOrUndefined, isNumber, isObject, isPrimitive, isSelfClosingTag, isString, isUndefined, mergeDeep, provideAvatarContext, provideContext, provideHydrationContext, providePopoverContext, provideStorageContext, registry, toArray, toReactive, useAvatarContext, useBreakpoints, useContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFeatures, useFilter, useForm, useGroup, useHydration, useHydrationContext, useIntersectionObserver, useKeydown, useLocale, useLogger, useMutationObserver, usePermissions, usePopoverContext, useProxyModel, useProxyRegistry, useQueue, useRegistry, useResizeObserver, useSelection, useSingle, useStep, useStorage, useStorageContext, useTheme, useTimeline, useTokens, useWindowEventListener, version };
|
|
4958
|
+
export { Atom_default as Atom, Avatar, COMMON_ELEMENTS, ConsolaLoggerAdapter, IN_BROWSER, MemoryAdapter, PermissionAdapter, PinoLoggerAdapter, Popover, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, Vuetify0LocaleAdapter, Vuetify0LoggerAdapter, Vuetify0ThemeAdapter, __LOGGER_ENABLED__, createBreakpoints, createBreakpointsContext, createBreakpointsPlugin, createContext, createFeatures, createFeaturesContext, createFeaturesPlugin, createForm, createFormContext, createGroup, createGroupContext, createHydration, createHydrationContext, createHydrationPlugin, createLocale, createLocaleContext, createLocalePlugin, createLogger, createLoggerContext, createLoggerPlugin, createPermissions, createPermissionsContext, createPermissionsPlugin, createPlugin, createQueue, createQueueContext, createRegistryContext, createSelection, createSelectionContext, createSingle, createSingleContext, createStep, createStepContext, createStorage, createStorageContext, createStoragePlugin, createTheme, createThemeContext, createThemePlugin, createTimeline, createTimelineContext, createTokens, createTokensContext, createTrinity, genId, isArray, isBoolean, isFunction, isNullOrUndefined, isNumber, isObject, isPrimitive, isSelfClosingTag, isString, isUndefined, mergeDeep, provideAvatarContext, provideContext, providePopoverContext, provideStorageContext, registry, toArray, toReactive, useAvatarContext, useBreakpoints, useContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFeatures, useFilter, useForm, useGroup, useHydration, useIntersectionObserver, useKeydown, useLocale, useLogger, useMutationObserver, usePermissions, usePopoverContext, useProxyModel, useProxyRegistry, useQueue, useRegistry, useResizeObserver, useSelection, useSingle, useStep, useStorage, useStorageContext, useTheme, useTimeline, useTokens, useWindowEventListener, version };
|