@vuetify/v0 0.0.2 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -13
- package/dist/browser/index.js +3347 -2056
- package/dist/components/index.d.ts +4 -7
- package/dist/components/index.js +6 -8
- package/dist/{components-Cc48kKWf.js → components-B5k361i-.js} +173 -190
- package/dist/composables/index.d.ts +3 -7
- package/dist/composables/index.js +4 -7
- package/dist/composables-CAbYjAkR.js +3746 -0
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +3 -3
- package/dist/{globals--2b7sF4-.js → globals-CHVv7nNV.js} +2 -2
- package/dist/{htmlElements-SjqYu0am.js → htmlElements-lF7PGahL.js} +1 -1
- package/dist/{index-z_zwVNP8.d.ts → index-BKc0YiL1.d.ts} +1 -1
- package/dist/index-BQfe0WBZ.d.ts +410 -0
- package/dist/index-BhPlroXd.d.ts +2764 -0
- package/dist/{index-LBy5OPMu.d.ts → index-C_lAPFXS.d.ts} +1 -1
- package/dist/{index-BozA2pze.d.ts → index-DIX3zaZG.d.ts} +3 -10
- package/dist/index.d.ts +6 -7
- package/dist/index.js +7 -10
- package/dist/types/index.d.ts +1 -1
- package/dist/utilities/index.d.ts +3 -3
- package/dist/utilities/index.js +2 -2
- package/dist/{utilities-D9rWEgQK.js → utilities-rsKHgU2m.js} +5 -32
- package/package.json +10 -38
- package/dist/composables-7Cbs2sdO.js +0 -1003
- package/dist/factories/index.d.ts +0 -2
- package/dist/factories/index.js +0 -3
- package/dist/factories-CPq2yMlr.js +0 -79
- package/dist/index-BnsMFYhs.d.ts +0 -1407
- package/dist/index-BqrLvboW.d.ts +0 -61
- package/dist/index-tUyghL98.d.ts +0 -19
- package/dist/transformers/index.d.ts +0 -2
- package/dist/transformers/index.js +0 -4
- package/dist/transformers-BAeg3QJF.js +0 -122
- package/dist/useTheme-DSYiiz0R.js +0 -1244
- /package/dist/{constants-DiTCgvMU.js → constants-De5c3_aB.js} +0 -0
|
@@ -0,0 +1,2764 @@
|
|
|
1
|
+
import { a as MaybeArray, i as ID } from "./index-C_lAPFXS.js";
|
|
2
|
+
import * as vue169 from "vue";
|
|
3
|
+
import { App, ComputedRef, InjectionKey, MaybeRef, MaybeRefOrGetter, Reactive, Ref, ShallowRef, UnwrapNestedRefs } from "vue";
|
|
4
|
+
|
|
5
|
+
//#region src/composables/createContext/index.d.ts
|
|
6
|
+
type ContextKey<Z> = InjectionKey<Z> | string;
|
|
7
|
+
/**
|
|
8
|
+
* Injects a context provided by an ancestor component.
|
|
9
|
+
*
|
|
10
|
+
* @param key The key of the context to inject.
|
|
11
|
+
* @template Z The type of the context.
|
|
12
|
+
* @returns The injected context.
|
|
13
|
+
* @throws An error if the context is not found.
|
|
14
|
+
*
|
|
15
|
+
* @see https://vuejs.org/api/composition-api-dependency-injection.html#inject
|
|
16
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const myContext = useContext<MyContext>('my-context')
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare function useContext<Z>(key: ContextKey<Z>): Z & ({} | null);
|
|
24
|
+
/**
|
|
25
|
+
* Provides a context to all descendant components.
|
|
26
|
+
*
|
|
27
|
+
* @param key The key of the context to provide.
|
|
28
|
+
* @param context The context to provide.
|
|
29
|
+
* @param app The Vue app instance to provide the context to.
|
|
30
|
+
* @template Z The type of the context.
|
|
31
|
+
* @returns The provided context.
|
|
32
|
+
*
|
|
33
|
+
* @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
|
|
34
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* provideContext<MyContext>('my-context', myContext)
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare function provideContext<Z>(key: ContextKey<Z>, context: Z, app?: App): Z;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new context for providing and injecting data.
|
|
44
|
+
*
|
|
45
|
+
* @param key The key of the context to create.
|
|
46
|
+
* @template Z The type of the context.
|
|
47
|
+
* @returns A tuple containing the `useContext` and `provideContext` functions.
|
|
48
|
+
*
|
|
49
|
+
* @see https://vuejs.org/api/composition-api-dependency-injection.html
|
|
50
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const [provideMyContext, useMyContext] = createContext<MyContext>('my-context')
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function createContext<Z>(_key: ContextKey<Z>): readonly [(key?: ContextKey<Z>) => Z & ({} | null), (context: Z, app?: App) => Z];
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/composables/createPlugin/index.d.ts
|
|
60
|
+
interface PluginOptions {
|
|
61
|
+
namespace: string;
|
|
62
|
+
provide: (app: App) => void;
|
|
63
|
+
setup?: (app: App) => void;
|
|
64
|
+
}
|
|
65
|
+
interface Plugin {
|
|
66
|
+
install: (app: App, ...options: any[]) => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new Vue plugin.
|
|
70
|
+
*
|
|
71
|
+
* @param options The plugin options.
|
|
72
|
+
* @returns A new Vue plugin.
|
|
73
|
+
*
|
|
74
|
+
* @see https://vuejs.org/guide/reusability/plugins.html
|
|
75
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-plugin
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* export const [useContext, provideContext] = createContext<MyContext>('my-plugin')
|
|
80
|
+
*
|
|
81
|
+
* const context = {}
|
|
82
|
+
*
|
|
83
|
+
* export const MyPlugin = createPlugin({
|
|
84
|
+
* namespace: 'my-plugin',
|
|
85
|
+
* provide: (app) => {
|
|
86
|
+
* provideContext(context, app)
|
|
87
|
+
* },
|
|
88
|
+
* setup: (app) => {
|
|
89
|
+
* // Optional setup logic
|
|
90
|
+
* },
|
|
91
|
+
* })
|
|
92
|
+
*/
|
|
93
|
+
declare function createPlugin<Z extends Plugin = Plugin>(options: PluginOptions): Z;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/composables/createTrinity/index.d.ts
|
|
96
|
+
type ContextTrinity<Z = unknown> = readonly [() => Z, (context?: Z, app?: App) => Z, Z];
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new trinity for a context composable and its provider.
|
|
99
|
+
*
|
|
100
|
+
* @param createContext The function that creates the context.
|
|
101
|
+
* @param provideContext The function that provides the context.
|
|
102
|
+
* @param context The context to provide.
|
|
103
|
+
* @template Z The type of the context.
|
|
104
|
+
* @returns A new trinity.
|
|
105
|
+
*
|
|
106
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-trinity
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* interface MyContext {
|
|
111
|
+
* foo: string
|
|
112
|
+
* bar: number
|
|
113
|
+
* }
|
|
114
|
+
*
|
|
115
|
+
* export function createMyFeature<E extends MyContext = MyContext>() {
|
|
116
|
+
* const [useContext, _provideContext] = createContext<E>('my-context')
|
|
117
|
+
*
|
|
118
|
+
* const context = { foo: 'hello', bar: 42 }
|
|
119
|
+
*
|
|
120
|
+
* function provideContext (_context: E = context, app?: App): E {
|
|
121
|
+
* return _provideContext(_context, app)
|
|
122
|
+
* }
|
|
123
|
+
*
|
|
124
|
+
* return createTrinity<E>(useContext, provideContext, context)
|
|
125
|
+
* }
|
|
126
|
+
*/
|
|
127
|
+
declare function createTrinity<Z = unknown>(createContext: () => Z, provideContext: (_context?: Z, app?: App) => Z, context: Z): ContextTrinity<Z>;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/composables/toArray/index.d.ts
|
|
130
|
+
/**
|
|
131
|
+
* Converts a value to an array.
|
|
132
|
+
*
|
|
133
|
+
* @param value The value to convert.
|
|
134
|
+
* @template Z The type of the value.
|
|
135
|
+
* @returns The converted array.
|
|
136
|
+
*
|
|
137
|
+
* @see https://0.vuetifyjs.com/composables/transformers/to-array
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* import { toArray } from '@vuetify/v0'
|
|
142
|
+
*
|
|
143
|
+
* const value = 'Example Value'
|
|
144
|
+
* const valueAsArray = toArray(value)
|
|
145
|
+
*
|
|
146
|
+
* console.log(valueAsArray) // ['Example Value']
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare function toArray<Z>(value: Z | Z[]): Z[];
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/composables/toReactive/index.d.ts
|
|
152
|
+
/**
|
|
153
|
+
* Converts a `MaybeRef` to a `UnwrapNestedRefs`.
|
|
154
|
+
*
|
|
155
|
+
* @param objectRef The object to convert.
|
|
156
|
+
* @template Z The type of the object.
|
|
157
|
+
* @returns The converted object.
|
|
158
|
+
*
|
|
159
|
+
* @see https://vuejs.org/api/reactivity-utilities.html#toreactive
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* import { ref } from 'vue'
|
|
164
|
+
* import { toReactive } from '@vuetify/v0'
|
|
165
|
+
*
|
|
166
|
+
* const state = ref({ name: 'John', age: 30 })
|
|
167
|
+
* const rstate = toReactive(state)
|
|
168
|
+
*
|
|
169
|
+
* console.log(rstate.name) // John
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
declare function toReactive<Z extends object>(objectRef: MaybeRef<Z>): UnwrapNestedRefs<Z>;
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/composables/useBreakpoints/index.d.ts
|
|
175
|
+
type BreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
176
|
+
interface BreakpointsContext {
|
|
177
|
+
breakpoints: Readonly<Record<BreakpointName, number>>;
|
|
178
|
+
name: Readonly<ShallowRef<BreakpointName>>;
|
|
179
|
+
width: Readonly<ShallowRef<number>>;
|
|
180
|
+
height: Readonly<ShallowRef<number>>;
|
|
181
|
+
isMobile: Readonly<ShallowRef<boolean>>;
|
|
182
|
+
xs: Readonly<ShallowRef<boolean>>;
|
|
183
|
+
sm: Readonly<ShallowRef<boolean>>;
|
|
184
|
+
md: Readonly<ShallowRef<boolean>>;
|
|
185
|
+
lg: Readonly<ShallowRef<boolean>>;
|
|
186
|
+
xl: Readonly<ShallowRef<boolean>>;
|
|
187
|
+
xxl: Readonly<ShallowRef<boolean>>;
|
|
188
|
+
smAndUp: Readonly<ShallowRef<boolean>>;
|
|
189
|
+
mdAndUp: Readonly<ShallowRef<boolean>>;
|
|
190
|
+
lgAndUp: Readonly<ShallowRef<boolean>>;
|
|
191
|
+
xlAndUp: Readonly<ShallowRef<boolean>>;
|
|
192
|
+
xxlAndUp: Readonly<ShallowRef<boolean>>;
|
|
193
|
+
smAndDown: Readonly<ShallowRef<boolean>>;
|
|
194
|
+
mdAndDown: Readonly<ShallowRef<boolean>>;
|
|
195
|
+
lgAndDown: Readonly<ShallowRef<boolean>>;
|
|
196
|
+
xlAndDown: Readonly<ShallowRef<boolean>>;
|
|
197
|
+
xxlAndDown: Readonly<ShallowRef<boolean>>;
|
|
198
|
+
update: () => void;
|
|
199
|
+
}
|
|
200
|
+
interface BreakpointsOptions extends BreakpointsPluginOptions {}
|
|
201
|
+
interface BreakpointsPluginOptions {
|
|
202
|
+
mobileBreakpoint?: BreakpointName | number;
|
|
203
|
+
breakpoints?: Partial<Record<BreakpointName, number>>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Creates a new breakpoints instance.
|
|
207
|
+
*
|
|
208
|
+
* @param namespace The namespace to use for the breakpoints instance.
|
|
209
|
+
* @param options The options for the breakpoints instance.
|
|
210
|
+
* @template E The type of the breakpoints context.
|
|
211
|
+
* @returns A new breakpoints instance.
|
|
212
|
+
*
|
|
213
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-breakpoints
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* import { createBreakpoints } from '@vuetify/v0'
|
|
218
|
+
*
|
|
219
|
+
* export const [useBreakpoints, provideBreakpoints] = createBreakpoints('v0:breakpoints', {
|
|
220
|
+
* mobileBreakpoint: 'sm',
|
|
221
|
+
* breakpoints: {
|
|
222
|
+
* xs: 0,
|
|
223
|
+
* sm: 680,
|
|
224
|
+
* md: 1024,
|
|
225
|
+
* lg: 1280,
|
|
226
|
+
* xl: 1920,
|
|
227
|
+
* xxl: 2560,
|
|
228
|
+
* },
|
|
229
|
+
* })
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
declare function createBreakpoints<E extends BreakpointsContext = BreakpointsContext>(namespace?: string, options?: BreakpointsOptions): ContextTrinity<E>;
|
|
233
|
+
/**
|
|
234
|
+
* Returns the current breakpoints instance.
|
|
235
|
+
*
|
|
236
|
+
* @returns The current breakpoints instance.
|
|
237
|
+
*
|
|
238
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-breakpoints
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```vue
|
|
242
|
+
* <script setup lang="ts">
|
|
243
|
+
* import { useBreakpoints } from '@vuetify/v0'
|
|
244
|
+
*
|
|
245
|
+
* const { isMobile, mdAndUp } = useBreakpoints()
|
|
246
|
+
* </script>
|
|
247
|
+
*
|
|
248
|
+
* <template>
|
|
249
|
+
* <div class="pa-4">
|
|
250
|
+
* <p v-if="isMobile.value">Mobile layout active</p>
|
|
251
|
+
* <p v-else-if="mdAndUp.value">Medium and up layout active</p>
|
|
252
|
+
* </div>
|
|
253
|
+
* </template>
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function useBreakpoints(): BreakpointsContext;
|
|
257
|
+
/**
|
|
258
|
+
* Creates a new breakpoints plugin.
|
|
259
|
+
*
|
|
260
|
+
* @param options The options for the breakpoints plugin.
|
|
261
|
+
* @template E The type of the breakpoints context.
|
|
262
|
+
* @returns A new breakpoints plugin.
|
|
263
|
+
*
|
|
264
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-breakpoints
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* import { createApp } from 'vue'
|
|
269
|
+
* import { createBreakpointsPlugin } from '@vuetify/v0'
|
|
270
|
+
* import App from './App.vue'
|
|
271
|
+
*
|
|
272
|
+
* const app = createApp(App)
|
|
273
|
+
*
|
|
274
|
+
* app.use(
|
|
275
|
+
* createBreakpointsPlugin({
|
|
276
|
+
* mobileBreakpoint: 'sm',
|
|
277
|
+
* breakpoints: {
|
|
278
|
+
* xs: 0,
|
|
279
|
+
* sm: 680,
|
|
280
|
+
* md: 1024,
|
|
281
|
+
* lg: 1280,
|
|
282
|
+
* xl: 1920,
|
|
283
|
+
* xxl: 2560,
|
|
284
|
+
* },
|
|
285
|
+
* })
|
|
286
|
+
* )
|
|
287
|
+
*
|
|
288
|
+
* app.mount('#app')
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
declare function createBreakpointsPlugin<E extends BreakpointsContext = BreakpointsContext>(options?: BreakpointsPluginOptions): Plugin;
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/composables/useEventListener/index.d.ts
|
|
294
|
+
type CleanupFunction = () => void;
|
|
295
|
+
type EventHandler<E = Event> = (event: E) => void;
|
|
296
|
+
/**
|
|
297
|
+
* Attaches an event listener to the window.
|
|
298
|
+
*
|
|
299
|
+
* @param target The window object.
|
|
300
|
+
* @param event The event to listen for.
|
|
301
|
+
* @param listener The event listener.
|
|
302
|
+
* @param options The event listener options.
|
|
303
|
+
* @template E The event type.
|
|
304
|
+
* @returns A function to remove the event listener.
|
|
305
|
+
*
|
|
306
|
+
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
307
|
+
*/
|
|
308
|
+
declare function useEventListener<E extends keyof WindowEventMap>(target: Window, event: MaybeRefOrGetter<MaybeArray<E>>, listener: MaybeRef<MaybeArray<(this: Window, event: WindowEventMap[E]) => any>>, options?: MaybeRefOrGetter<boolean | AddEventListenerOptions>): CleanupFunction;
|
|
309
|
+
/**
|
|
310
|
+
* Attaches an event listener to the document.
|
|
311
|
+
*
|
|
312
|
+
* @param target The document object.
|
|
313
|
+
* @param event The event to listen for.
|
|
314
|
+
* @param listener The event listener.
|
|
315
|
+
* @param options The event listener options.
|
|
316
|
+
* @template E The event type.
|
|
317
|
+
* @returns A function to remove the event listener.
|
|
318
|
+
*
|
|
319
|
+
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
320
|
+
*/
|
|
321
|
+
declare function useEventListener<E extends keyof DocumentEventMap>(target: Document, event: MaybeRefOrGetter<MaybeArray<E>>, listener: MaybeRef<MaybeArray<(this: Document, event: DocumentEventMap[E]) => any>>, options?: MaybeRefOrGetter<boolean | AddEventListenerOptions>): CleanupFunction;
|
|
322
|
+
/**
|
|
323
|
+
* Attaches an event listener to an HTML element.
|
|
324
|
+
*
|
|
325
|
+
* @param target The HTML element.
|
|
326
|
+
* @param event The event to listen for.
|
|
327
|
+
* @param listener The event listener.
|
|
328
|
+
* @param options The event listener options.
|
|
329
|
+
* @template E The event type.
|
|
330
|
+
* @returns A function to remove the event listener.
|
|
331
|
+
*
|
|
332
|
+
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
333
|
+
*/
|
|
334
|
+
declare function useEventListener<E extends keyof HTMLElementEventMap>(target: MaybeRefOrGetter<HTMLElement | null | undefined>, event: MaybeRefOrGetter<MaybeArray<E>>, listener: MaybeRef<MaybeArray<(this: HTMLElement, event: HTMLElementEventMap[E]) => any>>, options?: MaybeRefOrGetter<boolean | AddEventListenerOptions>): CleanupFunction;
|
|
335
|
+
/**
|
|
336
|
+
* Attaches an event listener to an event target.
|
|
337
|
+
*
|
|
338
|
+
* @param target The event target.
|
|
339
|
+
* @param event The event to listen for.
|
|
340
|
+
* @param listener The event listener.
|
|
341
|
+
* @param options The event listener options.
|
|
342
|
+
* @template EventType The event type.
|
|
343
|
+
* @returns A function to remove the event listener.
|
|
344
|
+
*
|
|
345
|
+
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
346
|
+
*/
|
|
347
|
+
declare function useEventListener<EventType = Event>(target: MaybeRefOrGetter<EventTarget | null | undefined>, event: MaybeRefOrGetter<MaybeArray<string>>, listener: MaybeRef<MaybeArray<EventHandler<EventType>>>, options?: MaybeRefOrGetter<boolean | AddEventListenerOptions>): CleanupFunction;
|
|
348
|
+
/**
|
|
349
|
+
* Attaches an event listener to the window.
|
|
350
|
+
*
|
|
351
|
+
* @param event The event to listen for.
|
|
352
|
+
* @param listener The event listener.
|
|
353
|
+
* @param options The event listener options.
|
|
354
|
+
* @template E The event type.
|
|
355
|
+
* @returns A function to remove the event listener.
|
|
356
|
+
*
|
|
357
|
+
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
358
|
+
*/
|
|
359
|
+
declare function useWindowEventListener<E extends keyof WindowEventMap>(event: MaybeRefOrGetter<MaybeArray<E>>, listener: MaybeRef<MaybeArray<(this: Window, event: WindowEventMap[E]) => any>>, options?: MaybeRefOrGetter<boolean | AddEventListenerOptions>): CleanupFunction;
|
|
360
|
+
/**
|
|
361
|
+
* Attaches an event listener to the document.
|
|
362
|
+
*
|
|
363
|
+
* @param event The event to listen for.
|
|
364
|
+
* @param listener The event listener.
|
|
365
|
+
* @param options The event listener options.
|
|
366
|
+
* @template E The event type.
|
|
367
|
+
* @returns A function to remove the event listener.
|
|
368
|
+
*
|
|
369
|
+
* @see https://0.vuetifyjs.com/composables/system/use-event-listener
|
|
370
|
+
*/
|
|
371
|
+
declare function useDocumentEventListener<E extends keyof DocumentEventMap>(event: MaybeRefOrGetter<MaybeArray<E>>, listener: MaybeRef<MaybeArray<(this: Document, event: DocumentEventMap[E]) => any>>, options?: MaybeRefOrGetter<boolean | AddEventListenerOptions>): CleanupFunction;
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/composables/useRegistry/index.d.ts
|
|
374
|
+
interface RegistryTicket {
|
|
375
|
+
/** The unique identifier. Is randomly generated if not provided. */
|
|
376
|
+
id: ID;
|
|
377
|
+
/**
|
|
378
|
+
* The index of the ticket in the registry.
|
|
379
|
+
*
|
|
380
|
+
* @remarks Automatically managed by the registry. Updated during reindexing. It's not recommended to manually set this.
|
|
381
|
+
*/
|
|
382
|
+
index: number;
|
|
383
|
+
/** The value associated with the ticket. If not provided, it defaults to the index. */
|
|
384
|
+
value: unknown;
|
|
385
|
+
/**
|
|
386
|
+
* Whether the value is derived from index.
|
|
387
|
+
*
|
|
388
|
+
* @remarks Set to true when no explicit value is provided during registration. It's not recommended to manually set this.
|
|
389
|
+
*/
|
|
390
|
+
valueIsIndex: boolean;
|
|
391
|
+
}
|
|
392
|
+
interface RegistryContext<Z extends RegistryTicket = RegistryTicket> {
|
|
393
|
+
/**
|
|
394
|
+
* The collection of tickets in the registry
|
|
395
|
+
*
|
|
396
|
+
* @template ID The type of the ticket ID.
|
|
397
|
+
* @template Z The type of the registry ticket.
|
|
398
|
+
*
|
|
399
|
+
* @remarks Exposed for read-only access and advanced use cases. **Warning:** Direct mutation may cause inconsistencies in indexes, catalogs, and caches. Always prefer using the provided methods (`register`, `unregister`, etc.) to maintain internal consistency.
|
|
400
|
+
*/
|
|
401
|
+
collection: Map<ID, Z>;
|
|
402
|
+
/**
|
|
403
|
+
* Clear the entire registry
|
|
404
|
+
*
|
|
405
|
+
* @remarks Removes all tickets from the registry. This operation invalidates cached results from `keys()`, `values()`, and `entries()`.
|
|
406
|
+
*
|
|
407
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#clear
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
412
|
+
*
|
|
413
|
+
* const registry = useRegistry()
|
|
414
|
+
*
|
|
415
|
+
* registry.register({ id: 'ticket-1' })
|
|
416
|
+
* registry.register({ id: 'ticket-2' })
|
|
417
|
+
*
|
|
418
|
+
* console.log(registry.size) // 2
|
|
419
|
+
*
|
|
420
|
+
* registry.clear()
|
|
421
|
+
*
|
|
422
|
+
* console.log(registry.size) // 0
|
|
423
|
+
* ```
|
|
424
|
+
*/
|
|
425
|
+
clear: () => void;
|
|
426
|
+
/**
|
|
427
|
+
* Check if a ticket exists by ID
|
|
428
|
+
*
|
|
429
|
+
* @param id The ID of the ticket to check.
|
|
430
|
+
* @remarks Calls `collection.has` internally.
|
|
431
|
+
*
|
|
432
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#has
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
437
|
+
*
|
|
438
|
+
* const registry = useRegistry()
|
|
439
|
+
*
|
|
440
|
+
* registry.register({ id: 'ticket-id' })
|
|
441
|
+
*
|
|
442
|
+
* const exists = registry.has('ticket-id') // true
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
has: (id: ID) => boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Get all registered IDs
|
|
448
|
+
*
|
|
449
|
+
* @remarks Calls `collection.keys` internally with caching. First call is O(n), subsequent calls are O(1) until cache invalidation.
|
|
450
|
+
*
|
|
451
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#keys
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
456
|
+
*
|
|
457
|
+
* const registry = useRegistry()
|
|
458
|
+
*
|
|
459
|
+
* registry.register({ id: 'ticket-1' })
|
|
460
|
+
* registry.register({ id: 'ticket-2' })
|
|
461
|
+
*
|
|
462
|
+
* const ids = registry.keys() // ['ticket-1', 'ticket-2']
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
keys: () => ID[];
|
|
466
|
+
/**
|
|
467
|
+
* Browse for an ID(s) by value
|
|
468
|
+
*
|
|
469
|
+
* @param value The value to browse for.
|
|
470
|
+
* @remarks Returns a single ID or an array of IDs if multiple tickets share the same value.
|
|
471
|
+
*
|
|
472
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#browse
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```ts
|
|
476
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
477
|
+
*
|
|
478
|
+
* const registry = useRegistry()
|
|
479
|
+
*
|
|
480
|
+
* registry.register({ id: 'ticket-1', value: 'common-value' })
|
|
481
|
+
* registry.register({ id: 'ticket-2', value: 'common-value' })
|
|
482
|
+
* registry.register({ id: 'ticket-3', value: 'unique-value' })
|
|
483
|
+
*
|
|
484
|
+
* const common = registry.browse('common-value') // ['ticket-1', 'ticket-2']
|
|
485
|
+
* const unique = registry.browse('unique-value') // 'ticket-3'
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
browse: (value: unknown) => ID | ID[] | undefined;
|
|
489
|
+
/**
|
|
490
|
+
* lookup a ticket by index number
|
|
491
|
+
*
|
|
492
|
+
* @param index The index number to lookup.
|
|
493
|
+
* @remarks Maps do not support indexing by default, this method provides a way to retrieve an ID based on its index in the registry.
|
|
494
|
+
*
|
|
495
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#lookup
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* const registry = useRegistry()
|
|
500
|
+
*
|
|
501
|
+
* registry.register({ id: 'ticket-1' })
|
|
502
|
+
* registry.register({ id: 'ticket-2' })
|
|
503
|
+
*
|
|
504
|
+
* const ticket1 = registry.lookup(0) // 'ticket-1'
|
|
505
|
+
* const ticket2 = registry.lookup(1) // 'ticket-2'
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
lookup: (index: number) => ID | undefined;
|
|
509
|
+
/**
|
|
510
|
+
* Get a ticket by ID
|
|
511
|
+
*
|
|
512
|
+
* @param id The ID of the ticket to retrieve.
|
|
513
|
+
* @remarks Calls `collection.get` internally.
|
|
514
|
+
*
|
|
515
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#get
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```ts
|
|
519
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
520
|
+
*
|
|
521
|
+
* const registry = useRegistry()
|
|
522
|
+
*
|
|
523
|
+
* registry.register({ id: 'ticket-id', value: 'some-value' })
|
|
524
|
+
*
|
|
525
|
+
* const ticket = registry.get('ticket-id') // { id: 'ticket-id', index: 0, value: 'some-value', ... }
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
get: (id: ID) => Z | undefined;
|
|
529
|
+
/**
|
|
530
|
+
* Update or insert a ticket by ID
|
|
531
|
+
*
|
|
532
|
+
* @param id The ID of the ticket to upsert.
|
|
533
|
+
* @param ticket The partial ticket data to update or insert.
|
|
534
|
+
* @remarks If the ticket exists, it will be updated with the provided data. If it doesn't exist, a new ticket will be created with the given ID and data. This operation invalidates cached results from `keys()`, `values()`, and `entries()`.
|
|
535
|
+
*
|
|
536
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#upsert
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```ts
|
|
540
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
541
|
+
*
|
|
542
|
+
* const registry = useRegistry()
|
|
543
|
+
*
|
|
544
|
+
* // Insert a new ticket
|
|
545
|
+
* const ticket = registry.upsert('ticket-id', { value: 'initial-value' })
|
|
546
|
+
*
|
|
547
|
+
* // Update the existing ticket
|
|
548
|
+
* const patched = registry.upsert('ticket-id', { value: 'updated-value' })
|
|
549
|
+
* ```
|
|
550
|
+
*/
|
|
551
|
+
upsert: (id: ID, ticket?: Partial<Z>) => Z;
|
|
552
|
+
/**
|
|
553
|
+
* Get all values of registered tickets
|
|
554
|
+
*
|
|
555
|
+
* @remarks Calls `collection.values` internally with caching. First call is O(n), subsequent calls are O(1) until cache invalidation.
|
|
556
|
+
*
|
|
557
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#values
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```ts
|
|
561
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
562
|
+
*
|
|
563
|
+
* const registry = useRegistry()
|
|
564
|
+
*
|
|
565
|
+
* registry.register({ id: 'ticket-1', value: 'value-1' })
|
|
566
|
+
* registry.register({ id: 'ticket-2', value: 'value-2' })
|
|
567
|
+
*
|
|
568
|
+
* const values = registry.values() // [{ id: 'ticket-1', ... }, { id: 'ticket-2', ... }]
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
values: () => Z[];
|
|
572
|
+
/**
|
|
573
|
+
* Get all entries of registered tickets
|
|
574
|
+
*
|
|
575
|
+
* @remarks Calls `collection.entries` internally with caching. First call is O(n), subsequent calls are O(1) until cache invalidation.
|
|
576
|
+
*
|
|
577
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#entries
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* ```ts
|
|
581
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
582
|
+
*
|
|
583
|
+
* const registry = useRegistry()
|
|
584
|
+
*
|
|
585
|
+
* registry.register({ id: 'ticket-1', value: 'value-1' })
|
|
586
|
+
* registry.register({ id: 'ticket-2', value: 'value-2' })
|
|
587
|
+
*
|
|
588
|
+
* const entries = registry.entries() // [['ticket-1', { id: 'ticket-1', ... }], ['ticket-2', { id: 'ticket-2', ... }]]
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
entries: () => [ID, Z][];
|
|
592
|
+
/**
|
|
593
|
+
* Register a new ticket
|
|
594
|
+
*
|
|
595
|
+
* @param ticket The partial ticket data to register.
|
|
596
|
+
* @remarks If no ID is provided, a unique ID will be generated automatically. If no value is provided, it defaults to the ticket's index. This operation invalidates cached results from `keys()`, `values()`, and `entries()`.
|
|
597
|
+
*
|
|
598
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#register
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* ```ts
|
|
602
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
603
|
+
*
|
|
604
|
+
* const registry = useRegistry()
|
|
605
|
+
*
|
|
606
|
+
* const ticket = registry.register()
|
|
607
|
+
*
|
|
608
|
+
* console.log(ticket) // { id: 'generated-id', index: 0, value: 0, valueIsIndex: true }
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
register: (ticket?: Partial<Z>) => Z;
|
|
612
|
+
/**
|
|
613
|
+
* Unregister an ticket by ID
|
|
614
|
+
*
|
|
615
|
+
* @param id The ID of the ticket to unregister.
|
|
616
|
+
* @remarks Removes the ticket from the registry and reindexes the remaining tickets. This operation invalidates cached results from `keys()`, `values()`, and `entries()`.
|
|
617
|
+
*
|
|
618
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#unregister
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```ts
|
|
622
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
623
|
+
*
|
|
624
|
+
* const registry = useRegistry()
|
|
625
|
+
*
|
|
626
|
+
* registry.register({ id: 'ticket-id' })
|
|
627
|
+
*
|
|
628
|
+
* registry.unregister('ticket-id')
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
unregister: (id: ID) => void;
|
|
632
|
+
/**
|
|
633
|
+
* Reset the index directory and update all tickets
|
|
634
|
+
*
|
|
635
|
+
* @remarks Rebuilds the internal index mapping and ensures all tickets have correct index values. This operation invalidates cached results from `keys()`, `values()`, and `entries()`.
|
|
636
|
+
*
|
|
637
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#reindex
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
642
|
+
*
|
|
643
|
+
* const registry = useRegistry()
|
|
644
|
+
*
|
|
645
|
+
* registry.register({ id: 'ticket-1' })
|
|
646
|
+
* registry.register({ id: 'ticket-2' })
|
|
647
|
+
*
|
|
648
|
+
* // After some operations that may affect indexing
|
|
649
|
+
* registry.reindex()
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
652
|
+
reindex: () => void;
|
|
653
|
+
/**
|
|
654
|
+
* Seek for a ticket based on direction and optional predicate
|
|
655
|
+
*
|
|
656
|
+
* @param direction The direction to seek ('first' or 'last'). Defaults to 'first'.
|
|
657
|
+
* @param from The index to start seeking from. Defaults to the beginning or end based on direction.
|
|
658
|
+
* @param predicate An optional function to test each ticket. The first ticket that satisfies the predicate will be returned.
|
|
659
|
+
* @remarks This method allows for flexible searching within the registry, either from the start or end, and can filter tickets based on custom criteria.
|
|
660
|
+
*
|
|
661
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#seek
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* ```ts
|
|
665
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
666
|
+
*
|
|
667
|
+
* const registry = useRegistry()
|
|
668
|
+
*
|
|
669
|
+
* registry.register({ id: 'ticket-1', value: 'apple' })
|
|
670
|
+
* registry.register({ id: 'ticket-2', value: 'banana' })
|
|
671
|
+
* registry.register({ id: 'ticket-3', value: 'cherry' })
|
|
672
|
+
*
|
|
673
|
+
* // Seek the first ticket
|
|
674
|
+
* const first = registry.seek('first')
|
|
675
|
+
*
|
|
676
|
+
* // Seek the last ticket
|
|
677
|
+
* const last = registry.seek('last')
|
|
678
|
+
*
|
|
679
|
+
* // Seek the first ticket with value 'banana'
|
|
680
|
+
* const banana = registry.seek('first', undefined, ticket => ticket.value === 'banana')
|
|
681
|
+
*
|
|
682
|
+
* // Seek from index 1 to find the next ticket with value starting with 'c'
|
|
683
|
+
* const cherry = registry.seek('first', 1, ticket => (ticket.value as string).startsWith('c'))
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
seek: (direction?: 'first' | 'last', from?: number, predicate?: (ticket: Z) => boolean) => Z | undefined;
|
|
687
|
+
/**
|
|
688
|
+
* Listen for registry events
|
|
689
|
+
*
|
|
690
|
+
* @param event The name of the event to listen for.
|
|
691
|
+
* @param cb The callback function to invoke when the event is emitted.
|
|
692
|
+
* @remarks Must be enabled via the `events` option when creating the registry.
|
|
693
|
+
* Supported events:
|
|
694
|
+
* - `register:ticket` - Emitted when a ticket is registered, receives the ticket as argument
|
|
695
|
+
* - `unregister:ticket` - Emitted when a ticket is unregistered, receives the ticket as argument
|
|
696
|
+
* - `update:ticket` - Emitted when a ticket is updated, receives the updated ticket as argument
|
|
697
|
+
* - `clear:registry` - Emitted when the registry is cleared
|
|
698
|
+
*
|
|
699
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#on
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```ts
|
|
703
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
704
|
+
*
|
|
705
|
+
* const registry = useRegistry({ events: true })
|
|
706
|
+
*
|
|
707
|
+
* registry.on('register:ticket', (ticket) => {
|
|
708
|
+
* console.log('Ticket registered:', ticket)
|
|
709
|
+
* })
|
|
710
|
+
*
|
|
711
|
+
* registry.register({ id: 'ticket-id' }) // Console: Ticket registered: { id: 'ticket-id', ... }
|
|
712
|
+
* ```
|
|
713
|
+
*/
|
|
714
|
+
on: (event: string, cb: Function) => void;
|
|
715
|
+
/**
|
|
716
|
+
* Stop listening for registry events
|
|
717
|
+
*
|
|
718
|
+
* @param event The name of the event to stop listening for.
|
|
719
|
+
* @param cb The callback function to remove.
|
|
720
|
+
* @remarks Must be enabled via the `events` option when creating the registry.
|
|
721
|
+
*
|
|
722
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#off
|
|
723
|
+
*
|
|
724
|
+
* @example
|
|
725
|
+
* ```ts
|
|
726
|
+
* import { onScopeDispose } from 'vue'
|
|
727
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
728
|
+
*
|
|
729
|
+
* const registry = useRegistry({ events: true })
|
|
730
|
+
*
|
|
731
|
+
* function onRegister(ticket) {
|
|
732
|
+
* console.log('Ticket registered:', ticket)
|
|
733
|
+
* }
|
|
734
|
+
*
|
|
735
|
+
* registry.on('register:ticket', onRegister)
|
|
736
|
+
*
|
|
737
|
+
* registry.register({ id: 'ticket-id' }) // Console: Ticket registered: { id: 'ticket-id', ... }
|
|
738
|
+
*
|
|
739
|
+
* onScopeDispose(() => {
|
|
740
|
+
* registry.off('register:ticket', onRegister)
|
|
741
|
+
* })
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
off: (event: string, cb: Function) => void;
|
|
745
|
+
/**
|
|
746
|
+
* Emit an event with data
|
|
747
|
+
*
|
|
748
|
+
* @param event The name of the event to emit.
|
|
749
|
+
* @param data The data to pass to event listeners.
|
|
750
|
+
* @remarks Must be enabled via the `events` option when creating the registry.
|
|
751
|
+
*
|
|
752
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#emit
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```ts
|
|
756
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
757
|
+
*
|
|
758
|
+
* const registry = useRegistry({ events: true })
|
|
759
|
+
*
|
|
760
|
+
* registry.on('custom-event', (data) => {
|
|
761
|
+
* console.log('Custom event received:', data)
|
|
762
|
+
* })
|
|
763
|
+
*
|
|
764
|
+
* registry.emit('custom-event', { message: 'Hello, World!' }) // Console: Custom event received: { message: 'Hello, World!' }
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
emit: (event: string, data: any) => void;
|
|
768
|
+
/**
|
|
769
|
+
* Clears the registry and removes all listeners
|
|
770
|
+
*
|
|
771
|
+
* @remarks Disposes of the registry by clearing all tickets and removing all event listeners.
|
|
772
|
+
*
|
|
773
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#dispose
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```ts
|
|
777
|
+
* import { onScopeDispose } from 'vue'
|
|
778
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
779
|
+
*
|
|
780
|
+
* const registry = useRegistry({ events: true })
|
|
781
|
+
*
|
|
782
|
+
* registry.register({ id: 'ticket-id' })
|
|
783
|
+
*
|
|
784
|
+
* onScopeDispose(() => {
|
|
785
|
+
* registry.dispose()
|
|
786
|
+
* })
|
|
787
|
+
* ```
|
|
788
|
+
*/
|
|
789
|
+
dispose: () => void;
|
|
790
|
+
/**
|
|
791
|
+
* Onboard multiple tickets at once
|
|
792
|
+
*
|
|
793
|
+
* @param registrations An array of partial ticket data to register.
|
|
794
|
+
* @remarks Registers multiple tickets in a single operation and returns the array of registered tickets.
|
|
795
|
+
*
|
|
796
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#onboard
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* ```ts
|
|
800
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
801
|
+
*
|
|
802
|
+
* const registry = useRegistry()
|
|
803
|
+
*
|
|
804
|
+
* const tickets = registry.onboard([
|
|
805
|
+
* { id: 'ticket-1', value: 'value-1' },
|
|
806
|
+
* { id: 'ticket-2', value: 'value-2' },
|
|
807
|
+
* ])
|
|
808
|
+
*
|
|
809
|
+
* console.log(tickets) // [{ id: 'ticket-1', ... }, { id: 'ticket-2', ... }]
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
onboard: (registrations: Partial<Z>[]) => Z[];
|
|
813
|
+
/**
|
|
814
|
+
* The number of tickets in the registry
|
|
815
|
+
*
|
|
816
|
+
* @remarks Reflects the current size of the internal ticket collection.
|
|
817
|
+
*
|
|
818
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry#size
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```ts
|
|
822
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
823
|
+
*
|
|
824
|
+
* const registry = useRegistry()
|
|
825
|
+
*
|
|
826
|
+
* registry.register({ id: 'ticket-1' })
|
|
827
|
+
* registry.register({ id: 'ticket-2' })
|
|
828
|
+
*
|
|
829
|
+
* console.log(registry.size) // 2
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
size: number;
|
|
833
|
+
}
|
|
834
|
+
interface RegistryOptions {
|
|
835
|
+
/**
|
|
836
|
+
* Enable event emission for registry operations
|
|
837
|
+
*
|
|
838
|
+
* @default false
|
|
839
|
+
* @remarks When enabled, the registry will emit events for operations like registration and unregistration. Listeners can be added using the `on` method.
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* ```ts
|
|
843
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
844
|
+
*
|
|
845
|
+
* const registry = useRegistry({ events: true })
|
|
846
|
+
*
|
|
847
|
+
* registry.on('register:ticket', (ticket) => {
|
|
848
|
+
* console.log('Ticket registered:', ticket)
|
|
849
|
+
* })
|
|
850
|
+
*
|
|
851
|
+
* registry.register({ id: 'ticket-id' }) // Console: Ticket registered: { id: 'ticket-id', ... }
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
events?: boolean;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Creates a new registry instance.
|
|
858
|
+
*
|
|
859
|
+
* @param options The options for the registry instance.
|
|
860
|
+
* @template Z The type of registry ticket that extends RegistryTicket. Use this to add custom properties to tickets.
|
|
861
|
+
* @template E The type of registry context that extends RegistryContext<Z>. Use this when extending the registry with additional methods.
|
|
862
|
+
* @returns A new registry instance.
|
|
863
|
+
*
|
|
864
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```ts
|
|
868
|
+
* import { useRegistry } from '@vuetify/v0'
|
|
869
|
+
*
|
|
870
|
+
* const registry = useRegistry()
|
|
871
|
+
*
|
|
872
|
+
* const ticket1 = registry.register({ id: 'user-1', value: { name: 'John' } })
|
|
873
|
+
* const ticket2 = registry.register({ id: 'user-2', value: { name: 'Jane' } })
|
|
874
|
+
*
|
|
875
|
+
* console.log(registry.size) // 2
|
|
876
|
+
* console.log(registry.get('user-1')) // { id: 'user-1', index: 0, value: { name: 'John' }, ... }
|
|
877
|
+
* ```
|
|
878
|
+
*/
|
|
879
|
+
declare function useRegistry<Z extends RegistryTicket = RegistryTicket, E extends RegistryContext<Z> = RegistryContext<Z>>(options?: RegistryOptions): E;
|
|
880
|
+
/**
|
|
881
|
+
* Creates a new registry context.
|
|
882
|
+
*
|
|
883
|
+
* @param namespace The namespace for the registry context.
|
|
884
|
+
* @param options The options for the registry context.
|
|
885
|
+
*
|
|
886
|
+
* @template Z The type of registry ticket that extends RegistryTicket. Use this to add custom properties to tickets.
|
|
887
|
+
* @template E The type of registry context that extends RegistryContext<Z>. Use this when extending the registry with additional methods.
|
|
888
|
+
*
|
|
889
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-registry
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```ts
|
|
893
|
+
* import { createRegistryContext } from '@vuetify/v0'
|
|
894
|
+
*
|
|
895
|
+
* export const [useItems, provideItems, items] = createRegistryContext('items')
|
|
896
|
+
*
|
|
897
|
+
* // In a parent component:
|
|
898
|
+
* provideItems()
|
|
899
|
+
*
|
|
900
|
+
* // In a child component:
|
|
901
|
+
* const items = useItems()
|
|
902
|
+
* items.register({ id: 'item-1', value: 'Value 1' })
|
|
903
|
+
* ```
|
|
904
|
+
*/
|
|
905
|
+
declare function createRegistryContext<Z extends RegistryTicket = RegistryTicket, E extends RegistryContext<Z> = RegistryContext<Z>>(namespace: string, options?: RegistryOptions): ContextTrinity<E>;
|
|
906
|
+
//#endregion
|
|
907
|
+
//#region src/composables/useSelection/index.d.ts
|
|
908
|
+
interface SelectionTicket extends RegistryTicket {
|
|
909
|
+
disabled: boolean;
|
|
910
|
+
isSelected: Readonly<Ref<boolean, boolean>>;
|
|
911
|
+
/** Select self */
|
|
912
|
+
select: () => void;
|
|
913
|
+
/** Unselect self */
|
|
914
|
+
unselect: () => void;
|
|
915
|
+
/** Toggle self on and off */
|
|
916
|
+
toggle: () => void;
|
|
917
|
+
}
|
|
918
|
+
interface SelectionContext<Z extends SelectionTicket> extends RegistryContext<Z> {
|
|
919
|
+
selectedIds: Reactive<Set<ID>>;
|
|
920
|
+
selectedItems: ComputedRef<Set<Z>>;
|
|
921
|
+
selectedValues: ComputedRef<Set<unknown>>;
|
|
922
|
+
/** Clear all selected IDs and reindexes */
|
|
923
|
+
reset: () => void;
|
|
924
|
+
/** Select a ticket by ID (Toggle ON) */
|
|
925
|
+
select: (id: ID) => void;
|
|
926
|
+
/** Unselect a ticket by ID (Toggle OFF) */
|
|
927
|
+
unselect: (id: ID) => void;
|
|
928
|
+
/** Toggles a ticket ON and OFF by ID */
|
|
929
|
+
toggle: (id: ID) => void;
|
|
930
|
+
/** Check if a ticket is selected by ID */
|
|
931
|
+
selected: (id: ID) => boolean;
|
|
932
|
+
/** Mandates selected ID based on "mandatory" Option */
|
|
933
|
+
mandate: () => void;
|
|
934
|
+
}
|
|
935
|
+
interface SelectionOptions extends RegistryOptions {
|
|
936
|
+
/** When true, newly registered items are automatically selected if not disabled */
|
|
937
|
+
enroll?: boolean;
|
|
938
|
+
mandatory?: boolean | 'force';
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Creates a new selection instance.
|
|
942
|
+
*
|
|
943
|
+
* @param options The options for the selection instance.
|
|
944
|
+
* @template Z The type of the selection ticket.
|
|
945
|
+
* @template E The type of the selection context.
|
|
946
|
+
* @returns A new selection instance.
|
|
947
|
+
*
|
|
948
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-selection
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* ```ts
|
|
952
|
+
* import { useSelection } from '@vuetify/v0'
|
|
953
|
+
*
|
|
954
|
+
* const selection = useSelection({ mandatory: true })
|
|
955
|
+
*
|
|
956
|
+
* selection.onboard([
|
|
957
|
+
* { id: 'item-1', value: 'Item 1' },
|
|
958
|
+
* { id: 'item-2', value: 'Item 2', disabled: true },
|
|
959
|
+
* { id: 'item-3', value: 'Item 3' },
|
|
960
|
+
* ])
|
|
961
|
+
*
|
|
962
|
+
* selection.select('item-1')
|
|
963
|
+
* selection.select('item-3')
|
|
964
|
+
*
|
|
965
|
+
* console.log(selection.selectedIds) // Set { 'item-1', 'item-3' }
|
|
966
|
+
* ```
|
|
967
|
+
*/
|
|
968
|
+
declare function useSelection<Z extends SelectionTicket = SelectionTicket, E extends SelectionContext<Z> = SelectionContext<Z>>(options?: SelectionOptions): E;
|
|
969
|
+
/**
|
|
970
|
+
* Creates a new selection context.
|
|
971
|
+
*
|
|
972
|
+
* @param namespace The namespace for the selection context.
|
|
973
|
+
* @param options The options for the selection context.
|
|
974
|
+
* @template Z The type of the selection ticket.
|
|
975
|
+
* @template E The type of the selection context.
|
|
976
|
+
* @returns A new selection context.
|
|
977
|
+
*
|
|
978
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-selection
|
|
979
|
+
*
|
|
980
|
+
* @example
|
|
981
|
+
* ```ts
|
|
982
|
+
* import { createSelectionContext } from '@vuetify/v0'
|
|
983
|
+
*
|
|
984
|
+
* export const [useCheckboxes, provideCheckboxes, checkboxes] = createSelectionContext('checkboxes')
|
|
985
|
+
*
|
|
986
|
+
* // In a parent component:
|
|
987
|
+
* provideCheckboxes()
|
|
988
|
+
*
|
|
989
|
+
* // In a child component:
|
|
990
|
+
* const checkboxes = useCheckboxes()
|
|
991
|
+
* checkboxes.select('checkbox-1')
|
|
992
|
+
* ```
|
|
993
|
+
*/
|
|
994
|
+
declare function createSelectionContext<Z extends SelectionTicket = SelectionTicket, E extends SelectionContext<Z> = SelectionContext<Z>>(namespace: string, options?: SelectionOptions): ContextTrinity<E>;
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/composables/useGroup/index.d.ts
|
|
997
|
+
interface GroupTicket extends SelectionTicket {}
|
|
998
|
+
interface GroupContext<Z extends GroupTicket> extends SelectionContext<Z> {
|
|
999
|
+
selectedIndexes: ComputedRef<Set<number>>;
|
|
1000
|
+
/** Select one or more Tickets by ID */
|
|
1001
|
+
select: (ids: ID | ID[]) => void;
|
|
1002
|
+
/** Unselect one or more Tickets by ID */
|
|
1003
|
+
unselect: (ids: ID | ID[]) => void;
|
|
1004
|
+
/** Toggle one or more Tickets ON and OFF by ID */
|
|
1005
|
+
toggle: (ids: ID | ID[]) => void;
|
|
1006
|
+
}
|
|
1007
|
+
interface GroupOptions extends SelectionOptions {}
|
|
1008
|
+
/**
|
|
1009
|
+
* Creates a new group instance.
|
|
1010
|
+
*
|
|
1011
|
+
* @param options The options for the group instance.
|
|
1012
|
+
* @template Z The type of the group ticket.
|
|
1013
|
+
* @template E The type of the group context.
|
|
1014
|
+
* @returns A new group instance.
|
|
1015
|
+
*
|
|
1016
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```ts
|
|
1020
|
+
* import { useGroup } from '@vuetify/v0'
|
|
1021
|
+
*
|
|
1022
|
+
* const group = useGroup()
|
|
1023
|
+
*
|
|
1024
|
+
* group.onboard([
|
|
1025
|
+
* { id: 'item-1', value: 'Item 1' },
|
|
1026
|
+
* { id: 'item-2', value: 'Item 2' },
|
|
1027
|
+
* { id: 'item-3', value: 'Item 3' },
|
|
1028
|
+
* ])
|
|
1029
|
+
*
|
|
1030
|
+
* group.select(['item-1', 'item-2'])
|
|
1031
|
+
*
|
|
1032
|
+
* console.log(group.selectedIds) // Set { 'item-1', 'item-2' }
|
|
1033
|
+
* ```
|
|
1034
|
+
*/
|
|
1035
|
+
declare function useGroup<Z extends GroupTicket = GroupTicket, E extends GroupContext<Z> = GroupContext<Z>>(options?: GroupOptions): E;
|
|
1036
|
+
/**
|
|
1037
|
+
* Creates a new group context.
|
|
1038
|
+
*
|
|
1039
|
+
* @param namespace The namespace for the group context.
|
|
1040
|
+
* @param options The options for the group context.
|
|
1041
|
+
* @template Z The type of the group ticket.
|
|
1042
|
+
* @template E The type of the group context.
|
|
1043
|
+
* @returns A new group context.
|
|
1044
|
+
*
|
|
1045
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-group
|
|
1046
|
+
*
|
|
1047
|
+
* @example
|
|
1048
|
+
* ```ts
|
|
1049
|
+
* import { createGroupContext } from '@vuetify/v0'
|
|
1050
|
+
*
|
|
1051
|
+
* export const [useMyGroup, provideMyGroup, myGroup] = createGroupContext('my-group')
|
|
1052
|
+
*
|
|
1053
|
+
* // In a parent component:
|
|
1054
|
+
* provideMyGroup()
|
|
1055
|
+
*
|
|
1056
|
+
* // In a child component:
|
|
1057
|
+
* const group = useMyGroup()
|
|
1058
|
+
* ```
|
|
1059
|
+
*/
|
|
1060
|
+
declare function createGroupContext<Z extends GroupTicket = GroupTicket, E extends GroupContext<Z> = GroupContext<Z>>(namespace: string, options?: GroupOptions): ContextTrinity<E>;
|
|
1061
|
+
//#endregion
|
|
1062
|
+
//#region src/composables/useTokens/index.d.ts
|
|
1063
|
+
interface TokenAlias<T = unknown> {
|
|
1064
|
+
[key: string]: unknown;
|
|
1065
|
+
$value: T;
|
|
1066
|
+
$type?: string;
|
|
1067
|
+
$description?: string;
|
|
1068
|
+
$extensions?: Record<string, unknown>;
|
|
1069
|
+
$deprecated?: boolean | string;
|
|
1070
|
+
}
|
|
1071
|
+
type TokenPrimitive = string | number | boolean;
|
|
1072
|
+
type TokenValue = TokenPrimitive | TokenAlias;
|
|
1073
|
+
interface TokenCollection {
|
|
1074
|
+
[key: string]: TokenValue | TokenCollection;
|
|
1075
|
+
}
|
|
1076
|
+
type FlatTokenCollection = {
|
|
1077
|
+
id: string;
|
|
1078
|
+
value: TokenValue;
|
|
1079
|
+
};
|
|
1080
|
+
interface TokenTicket extends RegistryTicket {}
|
|
1081
|
+
interface TokenContext<Z extends TokenTicket> extends RegistryContext<Z> {
|
|
1082
|
+
isAlias: (token: unknown) => token is string;
|
|
1083
|
+
resolve: (token: string | TokenAlias) => unknown | undefined;
|
|
1084
|
+
}
|
|
1085
|
+
interface TokenOptions {
|
|
1086
|
+
flat?: boolean;
|
|
1087
|
+
prefix?: string;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Creates a new token instance.
|
|
1091
|
+
*
|
|
1092
|
+
* @param tokens The tokens to use.
|
|
1093
|
+
* @param options The options for the token instance.
|
|
1094
|
+
* @template Z The type of the token ticket.
|
|
1095
|
+
* @template E The type of the token context.
|
|
1096
|
+
* @returns A new token instance.
|
|
1097
|
+
*
|
|
1098
|
+
* @see https://www.designtokens.org/tr/drafts/format/
|
|
1099
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-tokens
|
|
1100
|
+
*
|
|
1101
|
+
* @example
|
|
1102
|
+
* ```ts
|
|
1103
|
+
* import { useTokens } from '@vuetify/v0'
|
|
1104
|
+
*
|
|
1105
|
+
* const tokens = useTokens({
|
|
1106
|
+
* colors: {
|
|
1107
|
+
* primary: '#3b82f6',
|
|
1108
|
+
* secondary: '{colors.primary}', // Alias reference
|
|
1109
|
+
* },
|
|
1110
|
+
* })
|
|
1111
|
+
*
|
|
1112
|
+
* console.log(tokens.resolve('{colors.primary}')) // '#3b82f6'
|
|
1113
|
+
* console.log(tokens.resolve('{colors.secondary}')) // '#3b82f6'
|
|
1114
|
+
* ```
|
|
1115
|
+
*/
|
|
1116
|
+
declare function useTokens<Z extends TokenTicket = TokenTicket, E extends TokenContext<Z> = TokenContext<Z>>(tokens?: TokenCollection, options?: TokenOptions): E;
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates a new token context.
|
|
1119
|
+
*
|
|
1120
|
+
* @param namespace The namespace for the token context.
|
|
1121
|
+
* @param tokens The tokens to use.
|
|
1122
|
+
* @template Z The type of the token ticket.
|
|
1123
|
+
* @template E The type of the token context.
|
|
1124
|
+
* @returns A new token context.
|
|
1125
|
+
*
|
|
1126
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-tokens
|
|
1127
|
+
*
|
|
1128
|
+
* @example
|
|
1129
|
+
* ```ts
|
|
1130
|
+
* import { createTokensContext } from '@vuetify/v0'
|
|
1131
|
+
*
|
|
1132
|
+
* const myTokens = {
|
|
1133
|
+
* spacing: {
|
|
1134
|
+
* sm: '8px',
|
|
1135
|
+
* md: '16px',
|
|
1136
|
+
* lg: '24px',
|
|
1137
|
+
* },
|
|
1138
|
+
* }
|
|
1139
|
+
*
|
|
1140
|
+
* export const [useDesignTokens, provideDesignTokens, designTokens] = createTokensContext('design-tokens', myTokens)
|
|
1141
|
+
*
|
|
1142
|
+
* // In a parent component:
|
|
1143
|
+
* provideDesignTokens()
|
|
1144
|
+
*
|
|
1145
|
+
* // In a child component:
|
|
1146
|
+
* const tokens = useDesignTokens()
|
|
1147
|
+
*
|
|
1148
|
+
* console.log(tokens.resolve('{spacing.md}')) // '16px'
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
declare function createTokensContext<Z extends TokenTicket = TokenTicket, E extends TokenContext<Z> = TokenContext<Z>>(namespace: string, tokens?: TokenCollection): ContextTrinity<E>;
|
|
1152
|
+
//#endregion
|
|
1153
|
+
//#region src/composables/useFeatures/index.d.ts
|
|
1154
|
+
interface FeatureTicket extends GroupTicket {
|
|
1155
|
+
value: TokenValue;
|
|
1156
|
+
}
|
|
1157
|
+
interface FeatureContext<Z extends FeatureTicket = FeatureTicket> extends GroupContext<Z> {
|
|
1158
|
+
variation: (id: ID, fallback?: any) => any;
|
|
1159
|
+
}
|
|
1160
|
+
interface FeatureOptions extends FeaturePluginOptions {}
|
|
1161
|
+
interface FeaturePluginOptions {
|
|
1162
|
+
features?: Record<ID, boolean | TokenCollection>;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Creates a new features instance.
|
|
1166
|
+
*
|
|
1167
|
+
* @param namespace The namespace to use for the features instance.
|
|
1168
|
+
* @param options The options for the features instance.
|
|
1169
|
+
* @template Z The type of the feature ticket.
|
|
1170
|
+
* @template E The type of the feature context.
|
|
1171
|
+
* @returns A new features instance.
|
|
1172
|
+
*
|
|
1173
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-features
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* ```ts
|
|
1177
|
+
* import { createFeatures } from '@vuetify/v0'
|
|
1178
|
+
*
|
|
1179
|
+
* const [useFeatures, provideFeaturesContext] = createFeatures('v0:features', {
|
|
1180
|
+
* features: {
|
|
1181
|
+
* 'dark-mode': true,
|
|
1182
|
+
* 'theme-color': { $variation: 'blue' },
|
|
1183
|
+
* },
|
|
1184
|
+
* })
|
|
1185
|
+
* ```
|
|
1186
|
+
*/
|
|
1187
|
+
declare function createFeatures<Z extends FeatureTicket = FeatureTicket, E extends FeatureContext<Z> = FeatureContext<Z>>(namespace?: string, options?: FeatureOptions): ContextTrinity<E>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Returns the current features instance.
|
|
1190
|
+
*
|
|
1191
|
+
* @template Z The type of the feature ticket.
|
|
1192
|
+
* @returns The current features instance.
|
|
1193
|
+
*
|
|
1194
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-features
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```vue
|
|
1198
|
+
* <script setup lang="ts">
|
|
1199
|
+
* import { useFeatures } from '@vuetify/v0'
|
|
1200
|
+
*
|
|
1201
|
+
* const features = useFeatures()
|
|
1202
|
+
* </script>
|
|
1203
|
+
*
|
|
1204
|
+
* <template>
|
|
1205
|
+
* <div>
|
|
1206
|
+
* <p>Features: {{ features.get('dark-mode') }}</p>
|
|
1207
|
+
* <p>Theme Color: {{ features.variation('theme-color') }}</p>
|
|
1208
|
+
* </div>
|
|
1209
|
+
* </template>
|
|
1210
|
+
* ```
|
|
1211
|
+
*/
|
|
1212
|
+
declare function useFeatures<Z extends FeatureTicket = FeatureTicket>(): FeatureContext<Z>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Creates a new features plugin.
|
|
1215
|
+
*
|
|
1216
|
+
* @param options The options for the features plugin.
|
|
1217
|
+
* @template Z The type of the feature ticket.
|
|
1218
|
+
* @template E The type of the feature context.
|
|
1219
|
+
* @returns A new features plugin.
|
|
1220
|
+
*
|
|
1221
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-features
|
|
1222
|
+
*
|
|
1223
|
+
* @example
|
|
1224
|
+
* ```ts
|
|
1225
|
+
* import { createApp } from 'vue'
|
|
1226
|
+
* import { createFeaturesPlugin } from '@vuetify/v0'
|
|
1227
|
+
* import App from './App.vue'
|
|
1228
|
+
*
|
|
1229
|
+
* const app = createApp(App)
|
|
1230
|
+
*
|
|
1231
|
+
* app.use(
|
|
1232
|
+
* createFeaturesPlugin({
|
|
1233
|
+
* features: {
|
|
1234
|
+
* 'dark-mode': true,
|
|
1235
|
+
* 'theme-color': { $variation: 'blue' },
|
|
1236
|
+
* },
|
|
1237
|
+
* })
|
|
1238
|
+
* )
|
|
1239
|
+
*
|
|
1240
|
+
* app.mount('#app')
|
|
1241
|
+
* ```
|
|
1242
|
+
*/
|
|
1243
|
+
declare function createFeaturesPlugin<Z extends FeatureTicket = FeatureTicket, E extends FeatureContext<Z> = FeatureContext<Z>>(options?: FeaturePluginOptions): Plugin;
|
|
1244
|
+
//#endregion
|
|
1245
|
+
//#region src/composables/useFilter/index.d.ts
|
|
1246
|
+
type Primitive = string | number | boolean;
|
|
1247
|
+
type FilterQuery = MaybeRefOrGetter<Primitive | Primitive[]>;
|
|
1248
|
+
type FilterItem = Primitive | Record<string, any>;
|
|
1249
|
+
type FilterMode = 'some' | 'every' | 'union' | 'intersection';
|
|
1250
|
+
type FilterFunction = (query: Primitive | Primitive[], item: FilterItem) => boolean;
|
|
1251
|
+
interface UseFilterOptions {
|
|
1252
|
+
customFilter?: FilterFunction;
|
|
1253
|
+
keys?: string[];
|
|
1254
|
+
mode?: FilterMode;
|
|
1255
|
+
}
|
|
1256
|
+
interface UseFilterResult<Z extends FilterItem = FilterItem> {
|
|
1257
|
+
items: ComputedRef<Z[]>;
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* A reusable function for filtering an array of items.
|
|
1261
|
+
*
|
|
1262
|
+
* @param query The query to filter by.
|
|
1263
|
+
* @param items The items to filter.
|
|
1264
|
+
* @param options The filter options.
|
|
1265
|
+
* @template Z The type of the items.
|
|
1266
|
+
* @returns The filtered items.
|
|
1267
|
+
*
|
|
1268
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-filter
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```ts
|
|
1272
|
+
* import { ref } from 'vue'
|
|
1273
|
+
* import { useFilter } from '@vuetify/v0'
|
|
1274
|
+
*
|
|
1275
|
+
* const items = ref([
|
|
1276
|
+
* { name: 'John Doe', age: 30 },
|
|
1277
|
+
* { name: 'Jane Doe', age: 25 },
|
|
1278
|
+
* { name: 'Peter Jones', age: 40 },
|
|
1279
|
+
* ])
|
|
1280
|
+
*
|
|
1281
|
+
* const query = ref('doe')
|
|
1282
|
+
* const { items: filtered } = useFilter(query, items, { keys: ['name'] })
|
|
1283
|
+
*
|
|
1284
|
+
* console.log(filtered.value) // [ { name: 'John Doe', age: 30 }, { name: 'Jane Doe', age: 25 } ]
|
|
1285
|
+
* ```
|
|
1286
|
+
*/
|
|
1287
|
+
declare function useFilter<Z extends FilterItem>(query: FilterQuery, items: MaybeRef<Z[]>, options?: UseFilterOptions): UseFilterResult<Z>;
|
|
1288
|
+
//#endregion
|
|
1289
|
+
//#region src/composables/useForm/index.d.ts
|
|
1290
|
+
type FormValidationResult = string | true | Promise<string | true>;
|
|
1291
|
+
type FormValidationRule = (value: any) => FormValidationResult;
|
|
1292
|
+
type FormValue = Ref<any> | ShallowRef<any>;
|
|
1293
|
+
interface FormTicket extends RegistryTicket {
|
|
1294
|
+
validate: (silent?: boolean) => Promise<boolean>;
|
|
1295
|
+
reset: () => void;
|
|
1296
|
+
validateOn: 'submit' | 'change' | string;
|
|
1297
|
+
disabled: boolean;
|
|
1298
|
+
errors: ShallowRef<string[]>;
|
|
1299
|
+
rules: FormValidationRule[];
|
|
1300
|
+
isPristine: ShallowRef<boolean>;
|
|
1301
|
+
isValid: ShallowRef<boolean | null>;
|
|
1302
|
+
isValidating: ShallowRef<boolean>;
|
|
1303
|
+
}
|
|
1304
|
+
interface FormContext<Z extends FormTicket = FormTicket> extends RegistryContext<Z> {
|
|
1305
|
+
submit: (id?: ID | ID[]) => Promise<boolean>;
|
|
1306
|
+
reset: () => void;
|
|
1307
|
+
validateOn: 'submit' | 'change' | string;
|
|
1308
|
+
isValid: ComputedRef<boolean | null>;
|
|
1309
|
+
isValidating: ComputedRef<boolean>;
|
|
1310
|
+
}
|
|
1311
|
+
interface FormOptions extends RegistryOptions {
|
|
1312
|
+
validateOn?: 'submit' | 'change' | string;
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Creates a new form instance.
|
|
1316
|
+
*
|
|
1317
|
+
* @param options The options for the form instance.
|
|
1318
|
+
* @template Z The type of the form ticket.
|
|
1319
|
+
* @template E The type of the form context.
|
|
1320
|
+
* @returns A new form instance.
|
|
1321
|
+
*
|
|
1322
|
+
* @see https://0.vuetifyjs.com/composables/forms/use-form
|
|
1323
|
+
*
|
|
1324
|
+
* @example
|
|
1325
|
+
* ```ts
|
|
1326
|
+
* import { useForm } from '@vuetify/v0'
|
|
1327
|
+
*
|
|
1328
|
+
* const form = useForm()
|
|
1329
|
+
*
|
|
1330
|
+
* const username = form.register({
|
|
1331
|
+
* id: 'username',
|
|
1332
|
+
* value: '',
|
|
1333
|
+
* rules: [(v) => v.length > 0 || 'Username is required'],
|
|
1334
|
+
* })
|
|
1335
|
+
*
|
|
1336
|
+
* await form.submit()
|
|
1337
|
+
*
|
|
1338
|
+
* console.log(username.errors.value) // ['Username is required']
|
|
1339
|
+
*
|
|
1340
|
+
* form.reset()
|
|
1341
|
+
* ```
|
|
1342
|
+
*/
|
|
1343
|
+
declare function useForm<Z extends FormTicket = FormTicket, E extends FormContext<Z> = FormContext<Z>>(options?: FormOptions): E;
|
|
1344
|
+
//#endregion
|
|
1345
|
+
//#region src/composables/useHydration/index.d.ts
|
|
1346
|
+
interface HydrationContext {
|
|
1347
|
+
isHydrated: Readonly<ShallowRef<boolean>>;
|
|
1348
|
+
hydrate: () => void;
|
|
1349
|
+
}
|
|
1350
|
+
declare const useHydrationContext: (key?: ContextKey<HydrationContext>) => HydrationContext, provideHydrationContext: (context: HydrationContext, app?: App) => HydrationContext;
|
|
1351
|
+
/**
|
|
1352
|
+
* Creates a new hydration instance.
|
|
1353
|
+
*
|
|
1354
|
+
* @returns A new hydration instance.
|
|
1355
|
+
*
|
|
1356
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-hydration
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```ts
|
|
1360
|
+
* import { createHydration } from '@vuetify/v0'
|
|
1361
|
+
*
|
|
1362
|
+
* const [useHydration, provideHydration] = createHydration()
|
|
1363
|
+
* ```
|
|
1364
|
+
*/
|
|
1365
|
+
declare function createHydration(): HydrationContext;
|
|
1366
|
+
/**
|
|
1367
|
+
* Returns the current hydration instance.
|
|
1368
|
+
*
|
|
1369
|
+
* @returns The current hydration instance.
|
|
1370
|
+
*
|
|
1371
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-hydration
|
|
1372
|
+
*
|
|
1373
|
+
* @example
|
|
1374
|
+
* ```vue
|
|
1375
|
+
* <script setup lang="ts">
|
|
1376
|
+
* import { useHydration } from '@vuetify/v0'
|
|
1377
|
+
*
|
|
1378
|
+
* const hydration = useHydration()
|
|
1379
|
+
* </script>
|
|
1380
|
+
*
|
|
1381
|
+
* <template>
|
|
1382
|
+
* <div>
|
|
1383
|
+
* <p>Is hydrated: {{ hydration.isHydrated.value }}</p>
|
|
1384
|
+
* </div>
|
|
1385
|
+
* </template>
|
|
1386
|
+
* ```
|
|
1387
|
+
*/
|
|
1388
|
+
declare function useHydration(): HydrationContext;
|
|
1389
|
+
/**
|
|
1390
|
+
* Creates a new hydration plugin.
|
|
1391
|
+
*
|
|
1392
|
+
* @returns A new hydration plugin.
|
|
1393
|
+
*
|
|
1394
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-hydration
|
|
1395
|
+
*
|
|
1396
|
+
* @example
|
|
1397
|
+
* ```ts
|
|
1398
|
+
* import { createApp } from 'vue'
|
|
1399
|
+
* import { createHydrationPlugin } from '@vuetify/v0'
|
|
1400
|
+
* import App from './App.vue'
|
|
1401
|
+
*
|
|
1402
|
+
* const plugin = createHydrationPlugin()
|
|
1403
|
+
*
|
|
1404
|
+
* const app = createApp(App)
|
|
1405
|
+
*
|
|
1406
|
+
* app.use(plugin)
|
|
1407
|
+
*
|
|
1408
|
+
* app.mount('#app')
|
|
1409
|
+
* ```
|
|
1410
|
+
*/
|
|
1411
|
+
declare function createHydrationPlugin(): Plugin;
|
|
1412
|
+
//#endregion
|
|
1413
|
+
//#region src/composables/useIntersectionObserver/index.d.ts
|
|
1414
|
+
interface IntersectionObserverEntry {
|
|
1415
|
+
boundingClientRect: DOMRectReadOnly;
|
|
1416
|
+
intersectionRatio: number;
|
|
1417
|
+
intersectionRect: DOMRectReadOnly;
|
|
1418
|
+
isIntersecting: boolean;
|
|
1419
|
+
rootBounds: DOMRectReadOnly | null;
|
|
1420
|
+
target: Element;
|
|
1421
|
+
time: number;
|
|
1422
|
+
}
|
|
1423
|
+
interface IntersectionObserverOptions {
|
|
1424
|
+
immediate?: boolean;
|
|
1425
|
+
root?: Element | null;
|
|
1426
|
+
rootMargin?: string;
|
|
1427
|
+
threshold?: number | number[];
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* A composable that uses the Intersection Observer API to detect when an element
|
|
1431
|
+
* is visible in the viewport.
|
|
1432
|
+
*
|
|
1433
|
+
* @param target The element to observe.
|
|
1434
|
+
* @param callback The callback to execute when the element's intersection changes.
|
|
1435
|
+
* @param options The options for the Intersection Observer.
|
|
1436
|
+
* @returns An object with methods to control the observer.
|
|
1437
|
+
*
|
|
1438
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver
|
|
1439
|
+
* @see https://0.vuetifyjs.com/composables/system/use-intersection-observer
|
|
1440
|
+
*
|
|
1441
|
+
* @example
|
|
1442
|
+
* ```ts
|
|
1443
|
+
* import { ref } from 'vue'
|
|
1444
|
+
* import { useIntersectionObserver } from '@vuetify/v0'
|
|
1445
|
+
*
|
|
1446
|
+
* const target = ref<HTMLElement>()
|
|
1447
|
+
* const isVisible = ref(false)
|
|
1448
|
+
*
|
|
1449
|
+
* const { isIntersecting, pause, resume } = useIntersectionObserver(
|
|
1450
|
+
* target,
|
|
1451
|
+
* (entries) => {
|
|
1452
|
+
* const entry = entries[0]
|
|
1453
|
+
* if (entry) {
|
|
1454
|
+
* isVisible.value = entry.isIntersecting
|
|
1455
|
+
* console.log('Element is visible:', entry.isIntersecting)
|
|
1456
|
+
* }
|
|
1457
|
+
* },
|
|
1458
|
+
* { threshold: 0.5 }
|
|
1459
|
+
* )
|
|
1460
|
+
*
|
|
1461
|
+
* // Pause observation
|
|
1462
|
+
* pause()
|
|
1463
|
+
*
|
|
1464
|
+
* // Resume observation
|
|
1465
|
+
* resume()
|
|
1466
|
+
* ```
|
|
1467
|
+
*/
|
|
1468
|
+
declare function useIntersectionObserver(target: Ref<Element | undefined>, callback: (entries: IntersectionObserverEntry[]) => void, options?: IntersectionObserverOptions): {
|
|
1469
|
+
isIntersecting: Readonly<Ref<boolean, boolean>>;
|
|
1470
|
+
isPaused: Readonly<Ref<boolean, boolean>>;
|
|
1471
|
+
pause: () => void;
|
|
1472
|
+
resume: () => void;
|
|
1473
|
+
stop: () => void;
|
|
1474
|
+
};
|
|
1475
|
+
/**
|
|
1476
|
+
* A convenience composable that uses the Intersection Observer API to detect
|
|
1477
|
+
* when an element is visible in the viewport.
|
|
1478
|
+
*
|
|
1479
|
+
* @param target The element to observe.
|
|
1480
|
+
* @param options The options for the Intersection Observer.
|
|
1481
|
+
* @returns An object with the intersection state.
|
|
1482
|
+
*
|
|
1483
|
+
* @see https://0.vuetifyjs.com/composables/system/use-intersection-observer
|
|
1484
|
+
*
|
|
1485
|
+
* @example
|
|
1486
|
+
* ```ts
|
|
1487
|
+
* import { ref } from 'vue'
|
|
1488
|
+
* import { useElementIntersection } from '@vuetify/v0'
|
|
1489
|
+
*
|
|
1490
|
+
* const myElement = ref<HTMLElement>()
|
|
1491
|
+
* const { isIntersecting, intersectionRatio } = useElementIntersection(myElement, {
|
|
1492
|
+
* threshold: 0.5
|
|
1493
|
+
* })
|
|
1494
|
+
*
|
|
1495
|
+
* // Use in template to conditionally render or animate
|
|
1496
|
+
* watchEffect(() => {
|
|
1497
|
+
* if (isIntersecting.value) {
|
|
1498
|
+
* console.log('Element is visible!', intersectionRatio.value)
|
|
1499
|
+
* }
|
|
1500
|
+
* })
|
|
1501
|
+
* ```
|
|
1502
|
+
*/
|
|
1503
|
+
declare function useElementIntersection(target: Ref<Element | undefined>, options?: IntersectionObserverOptions): {
|
|
1504
|
+
isIntersecting: Readonly<Ref<boolean, boolean>>;
|
|
1505
|
+
intersectionRatio: Readonly<Ref<number, number>>;
|
|
1506
|
+
isPaused: Readonly<Ref<boolean, boolean>>;
|
|
1507
|
+
pause: () => void;
|
|
1508
|
+
resume: () => void;
|
|
1509
|
+
stop: () => void;
|
|
1510
|
+
};
|
|
1511
|
+
//#endregion
|
|
1512
|
+
//#region src/composables/useKeydown/index.d.ts
|
|
1513
|
+
interface KeyHandler {
|
|
1514
|
+
key: string;
|
|
1515
|
+
handler: (event: KeyboardEvent) => void;
|
|
1516
|
+
preventDefault?: boolean;
|
|
1517
|
+
stopPropagation?: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* A composable that adds a keydown event listener to the document.
|
|
1521
|
+
*
|
|
1522
|
+
* @param handlers The key handlers to add.
|
|
1523
|
+
* @returns An object with methods to start and stop listening.
|
|
1524
|
+
*
|
|
1525
|
+
* @see https://0.vuetifyjs.com/composables/system/use-keydown
|
|
1526
|
+
*
|
|
1527
|
+
* @example
|
|
1528
|
+
* ```ts
|
|
1529
|
+
* import { useKeydown } from '@vuetify/v0'
|
|
1530
|
+
*
|
|
1531
|
+
* const { startListening, stopListening } = useKeydown([
|
|
1532
|
+
* { key: 'Enter', handler: () => console.log('Enter pressed') },
|
|
1533
|
+
* { key: 'Escape', handler: () => console.log('Escape pressed'), preventDefault: true },
|
|
1534
|
+
* ])
|
|
1535
|
+
*
|
|
1536
|
+
* startListening()
|
|
1537
|
+
* stopListening()
|
|
1538
|
+
* ```
|
|
1539
|
+
*/
|
|
1540
|
+
declare function useKeydown(handlers: KeyHandler[] | KeyHandler): {
|
|
1541
|
+
startListening: () => void;
|
|
1542
|
+
stopListening: () => void;
|
|
1543
|
+
};
|
|
1544
|
+
//#endregion
|
|
1545
|
+
//#region src/composables/useSingle/index.d.ts
|
|
1546
|
+
interface SingleTicket extends SelectionTicket {}
|
|
1547
|
+
interface SingleContext<Z extends SingleTicket> extends SelectionContext<Z> {
|
|
1548
|
+
selectedId: ComputedRef<ID | undefined>;
|
|
1549
|
+
selectedIndex: ComputedRef<number>;
|
|
1550
|
+
selectedItem: ComputedRef<Z | undefined>;
|
|
1551
|
+
selectedValue: ComputedRef<unknown>;
|
|
1552
|
+
}
|
|
1553
|
+
interface SingleOptions extends SelectionOptions {}
|
|
1554
|
+
/**
|
|
1555
|
+
* Creates a new single selection instance.
|
|
1556
|
+
*
|
|
1557
|
+
* @param options The options for the single selection instance.
|
|
1558
|
+
* @template Z The type of the single selection ticket.
|
|
1559
|
+
* @template E The type of the single selection context.
|
|
1560
|
+
* @returns A new single selection instance.
|
|
1561
|
+
*
|
|
1562
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
1563
|
+
*
|
|
1564
|
+
* @example
|
|
1565
|
+
* ```ts
|
|
1566
|
+
* import { useSingle } from '@vuetify/v0'
|
|
1567
|
+
*
|
|
1568
|
+
* const single = useSingle()
|
|
1569
|
+
*
|
|
1570
|
+
* single.onboard([
|
|
1571
|
+
* { id: 'option-1', value: 'Option 1' },
|
|
1572
|
+
* { id: 'option-2', value: 'Option 2' },
|
|
1573
|
+
* ])
|
|
1574
|
+
*
|
|
1575
|
+
* single.select('option-1')
|
|
1576
|
+
*
|
|
1577
|
+
* console.log(single.selectedId.value) // 'option-1'
|
|
1578
|
+
* ```
|
|
1579
|
+
*/
|
|
1580
|
+
declare function useSingle<Z extends SingleTicket = SingleTicket, E extends SingleContext<Z> = SingleContext<Z>>(options?: SingleOptions): E;
|
|
1581
|
+
/**
|
|
1582
|
+
* Creates a new single selection context.
|
|
1583
|
+
*
|
|
1584
|
+
* @param namespace The namespace for the single selection context.
|
|
1585
|
+
* @param options The options for the single selection context.
|
|
1586
|
+
* @template Z The type of the single selection ticket.
|
|
1587
|
+
* @template E The type of the single selection context.
|
|
1588
|
+
* @returns A new single selection context.
|
|
1589
|
+
*
|
|
1590
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-single
|
|
1591
|
+
*
|
|
1592
|
+
* @example
|
|
1593
|
+
* ```ts
|
|
1594
|
+
* import { createSingleContext } from '@vuetify/v0'
|
|
1595
|
+
*
|
|
1596
|
+
* export const [useTabs, provideTabs, tabs] = createSingleContext('tabs', { mandatory: true })
|
|
1597
|
+
*
|
|
1598
|
+
* // In a parent component:
|
|
1599
|
+
* provideTabs()
|
|
1600
|
+
*
|
|
1601
|
+
* // In a child component:
|
|
1602
|
+
* const tabs = useTabs()
|
|
1603
|
+
* tabs.select('tab-1')
|
|
1604
|
+
* ```
|
|
1605
|
+
*/
|
|
1606
|
+
declare function createSingleContext<Z extends SingleTicket = SingleTicket, E extends SingleContext<Z> = SingleContext<Z>>(namespace: string, options?: SingleOptions): ContextTrinity<E>;
|
|
1607
|
+
//#endregion
|
|
1608
|
+
//#region src/composables/useLocale/adapters/adapter.d.ts
|
|
1609
|
+
interface LocaleAdapter {
|
|
1610
|
+
t: (message: string, ...params: unknown[]) => string;
|
|
1611
|
+
n: (value: number, locale: ID | undefined, ...params: unknown[]) => string;
|
|
1612
|
+
}
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/composables/useLocale/adapters/v0.d.ts
|
|
1615
|
+
/**
|
|
1616
|
+
* Vuetify0.x locale adapter implementation
|
|
1617
|
+
*
|
|
1618
|
+
* This adapter provides translation and number formatting
|
|
1619
|
+
* capabilities using the Intl API and supports both
|
|
1620
|
+
* numbered and named variables in translation strings.
|
|
1621
|
+
*/
|
|
1622
|
+
declare class Vuetify0LocaleAdapter implements LocaleAdapter {
|
|
1623
|
+
t(message: string, ...params: unknown[]): string;
|
|
1624
|
+
n(value: number, locale: ID | undefined, ...params: unknown[]): string;
|
|
1625
|
+
}
|
|
1626
|
+
//#endregion
|
|
1627
|
+
//#region src/composables/useLocale/index.d.ts
|
|
1628
|
+
type LocaleTicket = SingleTicket;
|
|
1629
|
+
interface LocaleContext<Z extends LocaleTicket> extends SingleContext<Z> {
|
|
1630
|
+
t: (key: string, ...params: unknown[]) => string;
|
|
1631
|
+
n: (value: number) => string;
|
|
1632
|
+
}
|
|
1633
|
+
interface LocaleOptions extends LocalePluginOptions {}
|
|
1634
|
+
interface LocalePluginOptions<Z extends TokenCollection = TokenCollection> {
|
|
1635
|
+
adapter?: LocaleAdapter;
|
|
1636
|
+
default?: ID;
|
|
1637
|
+
fallback?: ID;
|
|
1638
|
+
messages?: Record<ID, Z>;
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Creates a new locale instance.
|
|
1642
|
+
*
|
|
1643
|
+
* @param namespace The namespace for the locale instance.
|
|
1644
|
+
* @param options The options for the locale instance.
|
|
1645
|
+
* @template Z The type of the locale ticket.
|
|
1646
|
+
* @template E The type of the locale context.
|
|
1647
|
+
* @returns A new locale instance.
|
|
1648
|
+
*
|
|
1649
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
1650
|
+
*/
|
|
1651
|
+
declare function createLocale<Z extends LocaleTicket = LocaleTicket, E extends LocaleContext<Z> = LocaleContext<Z>>(namespace?: string, options?: LocaleOptions): ContextTrinity<E>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Returns the current locale instance.
|
|
1654
|
+
*
|
|
1655
|
+
* @returns The current locale instance.
|
|
1656
|
+
*
|
|
1657
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
1658
|
+
*/
|
|
1659
|
+
declare function useLocale(): LocaleContext<LocaleTicket>;
|
|
1660
|
+
/**
|
|
1661
|
+
* Creates a new locale plugin.
|
|
1662
|
+
*
|
|
1663
|
+
* @param options The options for the locale plugin.
|
|
1664
|
+
* @template Z The type of the locale ticket.
|
|
1665
|
+
* @template E The type of the locale context.
|
|
1666
|
+
* @template R The type of the token ticket.
|
|
1667
|
+
* @template O The type of the token context.
|
|
1668
|
+
* @returns A new locale plugin.
|
|
1669
|
+
*
|
|
1670
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-locale
|
|
1671
|
+
*/
|
|
1672
|
+
declare function createLocalePlugin<Z extends LocaleTicket = LocaleTicket, E extends LocaleContext<Z> = LocaleContext<Z>, R extends TokenTicket = TokenTicket, O extends TokenContext<R> = TokenContext<R>>(options?: LocalePluginOptions): Plugin;
|
|
1673
|
+
//#endregion
|
|
1674
|
+
//#region src/composables/useLogger/adapters/adapter.d.ts
|
|
1675
|
+
interface LoggerAdapter {
|
|
1676
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
1677
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
1678
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
1679
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
1680
|
+
trace?: (message: string, ...args: unknown[]) => void;
|
|
1681
|
+
fatal?: (message: string, ...args: unknown[]) => void;
|
|
1682
|
+
}
|
|
1683
|
+
//#endregion
|
|
1684
|
+
//#region src/composables/useLogger/adapters/consola.d.ts
|
|
1685
|
+
declare class ConsolaLoggerAdapter implements LoggerAdapter {
|
|
1686
|
+
private consola;
|
|
1687
|
+
constructor(consolaInstance: any);
|
|
1688
|
+
debug(message: string, ...args: unknown[]): void;
|
|
1689
|
+
info(message: string, ...args: unknown[]): void;
|
|
1690
|
+
warn(message: string, ...args: unknown[]): void;
|
|
1691
|
+
error(message: string, ...args: unknown[]): void;
|
|
1692
|
+
trace(message: string, ...args: unknown[]): void;
|
|
1693
|
+
fatal(message: string, ...args: unknown[]): void;
|
|
1694
|
+
}
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region src/composables/useLogger/adapters/pino.d.ts
|
|
1697
|
+
/**
|
|
1698
|
+
* Pino logger adapter implementation
|
|
1699
|
+
*
|
|
1700
|
+
* This adapter integrates with the Pino logging library,
|
|
1701
|
+
* providing high-performance structured logging optimized
|
|
1702
|
+
* for Node.js applications with minimal overhead.
|
|
1703
|
+
*/
|
|
1704
|
+
declare class PinoLoggerAdapter implements LoggerAdapter {
|
|
1705
|
+
private pino;
|
|
1706
|
+
constructor(pinoInstance: any);
|
|
1707
|
+
debug(message: string, ...args: unknown[]): void;
|
|
1708
|
+
info(message: string, ...args: unknown[]): void;
|
|
1709
|
+
warn(message: string, ...args: unknown[]): void;
|
|
1710
|
+
error(message: string, ...args: unknown[]): void;
|
|
1711
|
+
trace(message: string, ...args: unknown[]): void;
|
|
1712
|
+
fatal(message: string, ...args: unknown[]): void;
|
|
1713
|
+
private format;
|
|
1714
|
+
}
|
|
1715
|
+
//#endregion
|
|
1716
|
+
//#region src/composables/useLogger/adapters/v0.d.ts
|
|
1717
|
+
/**
|
|
1718
|
+
* Vuetify0.x logger adapter implementation
|
|
1719
|
+
*
|
|
1720
|
+
* This adapter provides console-based logging with proper formatting,
|
|
1721
|
+
* color coding, timestamps, and log level filtering for development
|
|
1722
|
+
* and production environments.
|
|
1723
|
+
*/
|
|
1724
|
+
declare class Vuetify0LoggerAdapter implements LoggerAdapter {
|
|
1725
|
+
private prefix;
|
|
1726
|
+
private colors;
|
|
1727
|
+
private timestamps;
|
|
1728
|
+
constructor(options?: {
|
|
1729
|
+
prefix?: string;
|
|
1730
|
+
colors?: boolean;
|
|
1731
|
+
timestamps?: boolean;
|
|
1732
|
+
});
|
|
1733
|
+
debug(message: string, ...args: unknown[]): void;
|
|
1734
|
+
info(message: string, ...args: unknown[]): void;
|
|
1735
|
+
warn(message: string, ...args: unknown[]): void;
|
|
1736
|
+
error(message: string, ...args: unknown[]): void;
|
|
1737
|
+
trace(message: string, ...args: unknown[]): void;
|
|
1738
|
+
fatal(message: string, ...args: unknown[]): void;
|
|
1739
|
+
private format;
|
|
1740
|
+
private timestamp;
|
|
1741
|
+
private style;
|
|
1742
|
+
private log;
|
|
1743
|
+
}
|
|
1744
|
+
//#endregion
|
|
1745
|
+
//#region src/composables/useLogger/types.d.ts
|
|
1746
|
+
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent';
|
|
1747
|
+
//#endregion
|
|
1748
|
+
//#region src/composables/useLogger/index.d.ts
|
|
1749
|
+
interface LoggerContext {
|
|
1750
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
1751
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
1752
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
1753
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
1754
|
+
trace: (message: string, ...args: unknown[]) => void;
|
|
1755
|
+
fatal: (message: string, ...args: unknown[]) => void;
|
|
1756
|
+
level: (level: LogLevel) => void;
|
|
1757
|
+
current: () => LogLevel;
|
|
1758
|
+
enabled: () => boolean;
|
|
1759
|
+
enable: () => void;
|
|
1760
|
+
disable: () => void;
|
|
1761
|
+
}
|
|
1762
|
+
interface LoggerOptions {
|
|
1763
|
+
adapter?: LoggerAdapter;
|
|
1764
|
+
level?: LogLevel;
|
|
1765
|
+
prefix?: string;
|
|
1766
|
+
enabled?: boolean;
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Creates a new logger instance.
|
|
1770
|
+
*
|
|
1771
|
+
* @param options The options for the logger instance.
|
|
1772
|
+
* @returns A new logger instance.
|
|
1773
|
+
*
|
|
1774
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1775
|
+
*/
|
|
1776
|
+
declare function createLogger(options?: LoggerOptions): LoggerContext;
|
|
1777
|
+
/**
|
|
1778
|
+
* Uses an existing or creates a new logger instance.
|
|
1779
|
+
*
|
|
1780
|
+
* @param namespace The namespace for the logger context.
|
|
1781
|
+
* @returns The logger instance.
|
|
1782
|
+
*
|
|
1783
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1784
|
+
*/
|
|
1785
|
+
declare function useLogger(namespace?: string): LoggerContext;
|
|
1786
|
+
/**
|
|
1787
|
+
* Creates a new logger plugin.
|
|
1788
|
+
*
|
|
1789
|
+
* @param options The options for the logger plugin.
|
|
1790
|
+
* @returns A new logger plugin.
|
|
1791
|
+
*
|
|
1792
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-logger
|
|
1793
|
+
*/
|
|
1794
|
+
declare function createLoggerPlugin(options?: LoggerOptions): Plugin;
|
|
1795
|
+
//#endregion
|
|
1796
|
+
//#region src/composables/useMutationObserver/index.d.ts
|
|
1797
|
+
interface MutationObserverRecord {
|
|
1798
|
+
type: 'attributes' | 'childList' | 'characterData';
|
|
1799
|
+
target: Node;
|
|
1800
|
+
addedNodes: NodeList;
|
|
1801
|
+
removedNodes: NodeList;
|
|
1802
|
+
previousSibling: Node | null;
|
|
1803
|
+
nextSibling: Node | null;
|
|
1804
|
+
attributeName: string | null;
|
|
1805
|
+
attributeNamespace: string | null;
|
|
1806
|
+
oldValue: string | null;
|
|
1807
|
+
}
|
|
1808
|
+
interface UseMutationObserverOptions {
|
|
1809
|
+
immediate?: boolean;
|
|
1810
|
+
childList?: boolean;
|
|
1811
|
+
attributes?: boolean;
|
|
1812
|
+
characterData?: boolean;
|
|
1813
|
+
subtree?: boolean;
|
|
1814
|
+
attributeOldValue?: boolean;
|
|
1815
|
+
characterDataOldValue?: boolean;
|
|
1816
|
+
attributeFilter?: string[];
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* A composable that uses the Mutation Observer API to detect changes in the DOM.
|
|
1820
|
+
*
|
|
1821
|
+
* @param target The element to observe.
|
|
1822
|
+
* @param callback The callback to execute when a mutation is observed.
|
|
1823
|
+
* @param options The options for the Mutation Observer.
|
|
1824
|
+
* @returns An object with methods to control the observer.
|
|
1825
|
+
*
|
|
1826
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
1827
|
+
* @see https://0.vuetifyjs.com/composables/system/use-mutation-observer
|
|
1828
|
+
*
|
|
1829
|
+
* @example
|
|
1830
|
+
* ```ts
|
|
1831
|
+
* import { ref } from 'vue'
|
|
1832
|
+
* import { useMutationObserver } from '@vuetify/v0'
|
|
1833
|
+
*
|
|
1834
|
+
* const container = ref<HTMLElement>()
|
|
1835
|
+
*
|
|
1836
|
+
* const { pause, resume, isPaused } = useMutationObserver(
|
|
1837
|
+
* container,
|
|
1838
|
+
* (mutations) => {
|
|
1839
|
+
* mutations.forEach((mutation) => {
|
|
1840
|
+
* if (mutation.type === 'childList') {
|
|
1841
|
+
* console.log('Children changed:', mutation.addedNodes, mutation.removedNodes)
|
|
1842
|
+
* } else if (mutation.type === 'attributes') {
|
|
1843
|
+
* console.log('Attribute changed:', mutation.attributeName)
|
|
1844
|
+
* }
|
|
1845
|
+
* })
|
|
1846
|
+
* },
|
|
1847
|
+
* {
|
|
1848
|
+
* childList: true,
|
|
1849
|
+
* attributes: true,
|
|
1850
|
+
* subtree: true
|
|
1851
|
+
* }
|
|
1852
|
+
* )
|
|
1853
|
+
*
|
|
1854
|
+
* // Pause observation
|
|
1855
|
+
* pause()
|
|
1856
|
+
*
|
|
1857
|
+
* // Resume observation
|
|
1858
|
+
* resume()
|
|
1859
|
+
* ```
|
|
1860
|
+
*/
|
|
1861
|
+
declare function useMutationObserver(target: Ref<Element | undefined>, callback: (entries: MutationObserverRecord[]) => void, options?: UseMutationObserverOptions): {
|
|
1862
|
+
isPaused: Readonly<Ref<boolean, boolean>>;
|
|
1863
|
+
pause: () => void;
|
|
1864
|
+
resume: () => void;
|
|
1865
|
+
stop: () => void;
|
|
1866
|
+
};
|
|
1867
|
+
//#endregion
|
|
1868
|
+
//#region src/composables/usePermissions/adapters/adapter.d.ts
|
|
1869
|
+
interface PermissionAdapterInterface {
|
|
1870
|
+
can: <Z extends PermissionTicket = PermissionTicket>(role: ID, action: string, subject: string, context: Record<string, any>, permissions: PermissionContext<Z>) => boolean;
|
|
1871
|
+
}
|
|
1872
|
+
declare abstract class PermissionAdapter implements PermissionAdapterInterface {
|
|
1873
|
+
abstract can<Z extends PermissionTicket = PermissionTicket>(role: ID, action: string, subject: string, context: Record<string, any>, permissions: PermissionContext<Z>): boolean;
|
|
1874
|
+
}
|
|
1875
|
+
//#endregion
|
|
1876
|
+
//#region src/composables/usePermissions/index.d.ts
|
|
1877
|
+
interface PermissionTicket extends TokenTicket {
|
|
1878
|
+
value: boolean | ((context: Record<string, any>) => boolean);
|
|
1879
|
+
}
|
|
1880
|
+
interface PermissionContext<Z extends PermissionTicket = PermissionTicket> extends TokenContext<Z> {
|
|
1881
|
+
can: (id: ID, action: string, subject: string, context?: Record<string, any>) => boolean;
|
|
1882
|
+
}
|
|
1883
|
+
interface PermissionOptions extends PermissionPluginOptions {}
|
|
1884
|
+
interface PermissionPluginOptions {
|
|
1885
|
+
adapter?: PermissionAdapter;
|
|
1886
|
+
permissions?: Record<ID, any>;
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Creates a new permissions instance.
|
|
1890
|
+
*
|
|
1891
|
+
* @param namespace The namespace for the permissions instance.
|
|
1892
|
+
* @param options The options for the permissions instance.
|
|
1893
|
+
* @template Z The type of the permission ticket.
|
|
1894
|
+
* @template E The type of the permission context.
|
|
1895
|
+
* @returns A new permissions instance.
|
|
1896
|
+
*
|
|
1897
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-permissions
|
|
1898
|
+
*
|
|
1899
|
+
* @example
|
|
1900
|
+
* ```ts
|
|
1901
|
+
* import { createPermissions } from '@vuetify/v0'
|
|
1902
|
+
*
|
|
1903
|
+
* const [usePermissions, providePermissions] = createPermissions('v0:permissions', {
|
|
1904
|
+
* permissions: {
|
|
1905
|
+
* admin: [['read', 'users']],
|
|
1906
|
+
* editor: [['edit', 'posts']],
|
|
1907
|
+
* },
|
|
1908
|
+
* })
|
|
1909
|
+
* ```
|
|
1910
|
+
*/
|
|
1911
|
+
declare function createPermissions<Z extends PermissionTicket = PermissionTicket, E extends PermissionContext<Z> = PermissionContext<Z>>(namespace?: string, options?: PermissionOptions): ContextTrinity<E>;
|
|
1912
|
+
/**
|
|
1913
|
+
* Returns the current permissions instance.
|
|
1914
|
+
*
|
|
1915
|
+
* @template Z The type of the permission ticket.
|
|
1916
|
+
* @returns The current permissions instance.
|
|
1917
|
+
*
|
|
1918
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
1919
|
+
*
|
|
1920
|
+
* @example
|
|
1921
|
+
* ```vue
|
|
1922
|
+
* <script setup lang="ts">
|
|
1923
|
+
* import { usePermissions } from '@vuetify/v0'
|
|
1924
|
+
*
|
|
1925
|
+
* const { can } = usePermissions()
|
|
1926
|
+
* </script>
|
|
1927
|
+
*
|
|
1928
|
+
* <template>
|
|
1929
|
+
* <div>
|
|
1930
|
+
* <p v-if="can('admin', 'read', 'users')">Admin access</p>
|
|
1931
|
+
* </div>
|
|
1932
|
+
* </template>
|
|
1933
|
+
* ```
|
|
1934
|
+
*/
|
|
1935
|
+
declare function usePermissions<Z extends PermissionTicket = PermissionTicket>(): PermissionContext<Z>;
|
|
1936
|
+
/**
|
|
1937
|
+
* Creates a new permissions plugin.
|
|
1938
|
+
*
|
|
1939
|
+
* @param options The options for the permissions plugin.
|
|
1940
|
+
* @template Z The type of the permission ticket.
|
|
1941
|
+
* @template E The type of the permission context.
|
|
1942
|
+
* @returns A new permissions plugin.
|
|
1943
|
+
*
|
|
1944
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
1945
|
+
*
|
|
1946
|
+
* @example
|
|
1947
|
+
* ```ts
|
|
1948
|
+
* import { createApp } from 'vue'
|
|
1949
|
+
* import { createPermissionsPlugin } from '@vuetify/v0'
|
|
1950
|
+
* import App from './App.vue'
|
|
1951
|
+
*
|
|
1952
|
+
* const app = createApp(App)
|
|
1953
|
+
*
|
|
1954
|
+
* app.use(
|
|
1955
|
+
* createPermissionsPlugin({
|
|
1956
|
+
* permissions: {
|
|
1957
|
+
* admin: [['read', 'users']],
|
|
1958
|
+
* editor: [['edit', 'posts']],
|
|
1959
|
+
* },
|
|
1960
|
+
* })
|
|
1961
|
+
* )
|
|
1962
|
+
*
|
|
1963
|
+
* app.mount('#app')
|
|
1964
|
+
* ```
|
|
1965
|
+
*/
|
|
1966
|
+
declare function createPermissionsPlugin<Z extends PermissionTicket = PermissionTicket, E extends PermissionContext<Z> = PermissionContext<Z>>(options?: PermissionOptions): Plugin;
|
|
1967
|
+
//#endregion
|
|
1968
|
+
//#region src/composables/useProxyModel/index.d.ts
|
|
1969
|
+
interface ProxyModelOptions {
|
|
1970
|
+
/** Whether to use deep reactivity for the model */
|
|
1971
|
+
deep?: boolean;
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Creates a proxy model that can be used to bind to a selection.
|
|
1975
|
+
*
|
|
1976
|
+
* @param registry The selection registry to bind to.
|
|
1977
|
+
* @param initial The initial value of the model.
|
|
1978
|
+
* @param options The options for the proxy model.
|
|
1979
|
+
* @param transformIn A function to transform the value before setting it.
|
|
1980
|
+
* @param transformOut A function to transform the value before getting it.
|
|
1981
|
+
* @template Z The type of the selection ticket.
|
|
1982
|
+
* @returns A proxy model that can be used to bind to a selection.
|
|
1983
|
+
*
|
|
1984
|
+
* @see https://0.vuetifyjs.com/composables/forms/use-proxy-model
|
|
1985
|
+
*
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```ts
|
|
1988
|
+
* import { useSelection, useProxyModel } from '@vuetify/v0'
|
|
1989
|
+
*
|
|
1990
|
+
* const registry = useSelection({ events: true })
|
|
1991
|
+
* registry.onboard([
|
|
1992
|
+
* { id: 'item-1', value: 'Item 1' },
|
|
1993
|
+
* { id: 'item-2', value: 'Item 2' },
|
|
1994
|
+
* ])
|
|
1995
|
+
*
|
|
1996
|
+
* const model = useProxyModel(registry, 'Item 1')
|
|
1997
|
+
* ```
|
|
1998
|
+
*/
|
|
1999
|
+
declare function useProxyModel<Z extends SelectionTicket>(registry: SelectionContext<Z>, initial?: unknown | unknown[], options?: ProxyModelOptions, _transformIn?: (val: unknown[] | unknown) => unknown[], _transformOut?: (val: unknown[]) => unknown | unknown[]): vue169.WritableComputedRef<unknown, unknown>;
|
|
2000
|
+
//#endregion
|
|
2001
|
+
//#region src/composables/useProxyRegistry/index.d.ts
|
|
2002
|
+
interface ProxyRegistryOptions {
|
|
2003
|
+
deep?: boolean;
|
|
2004
|
+
}
|
|
2005
|
+
interface ProxyRegistryContext<Z extends RegistryTicket = RegistryTicket> {
|
|
2006
|
+
keys: ID[];
|
|
2007
|
+
values: Z[];
|
|
2008
|
+
entries: [ID, Z][];
|
|
2009
|
+
size: number;
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Creates a proxy registry that provides reactive objects for registry data.
|
|
2013
|
+
*
|
|
2014
|
+
* @param registry The registry instance to proxy.
|
|
2015
|
+
* @param options The options for the proxy registry.
|
|
2016
|
+
* @template Z The type of the registry ticket.
|
|
2017
|
+
* @returns A proxy registry with reactive objects.
|
|
2018
|
+
*
|
|
2019
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-proxy-registry
|
|
2020
|
+
*
|
|
2021
|
+
* @example
|
|
2022
|
+
* ```ts
|
|
2023
|
+
* import { useRegistry, useProxyRegistry } from '@vuetify/v0'
|
|
2024
|
+
*
|
|
2025
|
+
* const registry = useRegistry({ events: true })
|
|
2026
|
+
* const proxy = useProxyRegistry(registry)
|
|
2027
|
+
*
|
|
2028
|
+
* registry.register({ value: 'Item 1' })
|
|
2029
|
+
* console.log(proxy.size) // 1
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
declare function useProxyRegistry<Z extends RegistryTicket = RegistryTicket>(registry: RegistryContext<Z>, options?: ProxyRegistryOptions): ProxyRegistryContext<Z>;
|
|
2033
|
+
//#endregion
|
|
2034
|
+
//#region src/composables/useQueue/index.d.ts
|
|
2035
|
+
interface QueueTicket extends RegistryTicket {
|
|
2036
|
+
/**
|
|
2037
|
+
* Timeout in milliseconds
|
|
2038
|
+
*
|
|
2039
|
+
* @remarks
|
|
2040
|
+
* - If `undefined`: Uses the default timeout from queue options (default: 3000ms)
|
|
2041
|
+
* - If `-1`: Ticket persists indefinitely until manually dismissed
|
|
2042
|
+
* - If a number: Ticket will be automatically removed after the specified milliseconds
|
|
2043
|
+
*/
|
|
2044
|
+
timeout?: number;
|
|
2045
|
+
/**
|
|
2046
|
+
* Whether the timeout is currently paused
|
|
2047
|
+
*
|
|
2048
|
+
* @remarks
|
|
2049
|
+
* - Set to `true` when the ticket is not the first in the queue or when manually paused
|
|
2050
|
+
* - When `true`, the timeout does not progress
|
|
2051
|
+
* - Automatically managed by the queue system
|
|
2052
|
+
*/
|
|
2053
|
+
isPaused: boolean;
|
|
2054
|
+
/**
|
|
2055
|
+
* Convenience method to dismiss this ticket from the queue
|
|
2056
|
+
*
|
|
2057
|
+
* @remarks
|
|
2058
|
+
* Equivalent to calling `queue.unregister(ticket.id)`
|
|
2059
|
+
*/
|
|
2060
|
+
dismiss: () => void;
|
|
2061
|
+
}
|
|
2062
|
+
interface QueueContext<Z extends QueueTicket = QueueTicket> extends RegistryContext<Z> {
|
|
2063
|
+
/**
|
|
2064
|
+
* Register a new ticket in the queue
|
|
2065
|
+
*
|
|
2066
|
+
* @param ticket The partial ticket data to register
|
|
2067
|
+
* @remarks
|
|
2068
|
+
* - If no ID is provided, a unique ID will be generated automatically
|
|
2069
|
+
* - If no timeout is provided, uses the default timeout from queue options (3000ms)
|
|
2070
|
+
* - First ticket in queue starts its timeout immediately
|
|
2071
|
+
* - Subsequent tickets are paused until they become first in queue
|
|
2072
|
+
* - Each ticket receives a `dismiss()` method for convenience
|
|
2073
|
+
*
|
|
2074
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue#register
|
|
2075
|
+
*
|
|
2076
|
+
* @example
|
|
2077
|
+
* ```ts
|
|
2078
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2079
|
+
*
|
|
2080
|
+
* const queue = useQueue()
|
|
2081
|
+
*
|
|
2082
|
+
* // Register with default timeout (3000ms)
|
|
2083
|
+
* const ticket1 = queue.register({ value: 'First' })
|
|
2084
|
+
*
|
|
2085
|
+
* // Register with custom timeout
|
|
2086
|
+
* const ticket2 = queue.register({ value: 'Second', timeout: 5000 })
|
|
2087
|
+
*
|
|
2088
|
+
* // Register persistent ticket (must be manually dismissed)
|
|
2089
|
+
* const ticket3 = queue.register({ value: 'Persistent', timeout: -1 })
|
|
2090
|
+
* ```
|
|
2091
|
+
*/
|
|
2092
|
+
register: (ticket?: Partial<Z>) => Z;
|
|
2093
|
+
/**
|
|
2094
|
+
* Unregister a ticket from the queue
|
|
2095
|
+
*
|
|
2096
|
+
* @param id The ID of the ticket to unregister. If not provided, the first ticket in the queue will be unregistered.
|
|
2097
|
+
* @remarks
|
|
2098
|
+
* - Removes the ticket from the queue and clears its timeout
|
|
2099
|
+
* - If the removed ticket was first in queue, automatically resumes the next ticket
|
|
2100
|
+
* - Returns the unregistered ticket or `undefined` if not found
|
|
2101
|
+
*
|
|
2102
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue#unregister
|
|
2103
|
+
*
|
|
2104
|
+
* @example
|
|
2105
|
+
* ```ts
|
|
2106
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2107
|
+
*
|
|
2108
|
+
* const queue = useQueue()
|
|
2109
|
+
*
|
|
2110
|
+
* const ticket1 = queue.register({ value: 'First' })
|
|
2111
|
+
* const ticket2 = queue.register({ value: 'Second' })
|
|
2112
|
+
*
|
|
2113
|
+
* // Unregister specific ticket
|
|
2114
|
+
* queue.unregister(ticket2.id)
|
|
2115
|
+
*
|
|
2116
|
+
* // Unregister first ticket in queue
|
|
2117
|
+
* const removed = queue.unregister()
|
|
2118
|
+
* console.log(removed?.value) // 'First'
|
|
2119
|
+
* ```
|
|
2120
|
+
*/
|
|
2121
|
+
unregister: (id?: ID) => Z | undefined;
|
|
2122
|
+
/**
|
|
2123
|
+
* Pause the timeout of the first ticket in the queue
|
|
2124
|
+
*
|
|
2125
|
+
* @remarks
|
|
2126
|
+
* - Pauses the timeout for the first ticket if it exists and is not already paused
|
|
2127
|
+
* - Returns the paused ticket or `undefined` if no pausable ticket exists
|
|
2128
|
+
* - The timeout will not progress while paused
|
|
2129
|
+
*
|
|
2130
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue#pause
|
|
2131
|
+
*
|
|
2132
|
+
* @example
|
|
2133
|
+
* ```ts
|
|
2134
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2135
|
+
*
|
|
2136
|
+
* const queue = useQueue({ timeout: 5000 })
|
|
2137
|
+
*
|
|
2138
|
+
* const ticket = queue.register({ value: 'Pausable ticket' })
|
|
2139
|
+
*
|
|
2140
|
+
* // Pause the first ticket's timeout
|
|
2141
|
+
* const paused = queue.pause()
|
|
2142
|
+
*
|
|
2143
|
+
* console.log(paused?.isPaused) // true
|
|
2144
|
+
* ```
|
|
2145
|
+
*/
|
|
2146
|
+
pause: () => Z | undefined;
|
|
2147
|
+
/**
|
|
2148
|
+
* Resume the timeout of the first paused ticket in the queue
|
|
2149
|
+
*
|
|
2150
|
+
* @remarks
|
|
2151
|
+
* - Resumes the timeout for the first ticket if it exists, is at index 0, and is currently paused
|
|
2152
|
+
* - Returns the resumed ticket or `undefined` if no resumable ticket exists
|
|
2153
|
+
* - The timeout will continue from its full duration (not from where it was paused)
|
|
2154
|
+
*
|
|
2155
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue#resume
|
|
2156
|
+
*
|
|
2157
|
+
* @example
|
|
2158
|
+
* ```ts
|
|
2159
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2160
|
+
*
|
|
2161
|
+
* const queue = useQueue({ timeout: 5000 })
|
|
2162
|
+
*
|
|
2163
|
+
* const ticket = queue.register({ value: 'Ticket' })
|
|
2164
|
+
* queue.pause()
|
|
2165
|
+
*
|
|
2166
|
+
* // Later, resume the paused ticket
|
|
2167
|
+
* const resumed = queue.resume()
|
|
2168
|
+
*
|
|
2169
|
+
* console.log(resumed?.isPaused) // false
|
|
2170
|
+
* ```
|
|
2171
|
+
*/
|
|
2172
|
+
resume: () => Z | undefined;
|
|
2173
|
+
/**
|
|
2174
|
+
* Clear the entire queue
|
|
2175
|
+
*
|
|
2176
|
+
* @remarks
|
|
2177
|
+
* - Removes all tickets from the queue
|
|
2178
|
+
* - Clears all active timeouts
|
|
2179
|
+
* - Resets the queue to an empty state
|
|
2180
|
+
*
|
|
2181
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue#clear
|
|
2182
|
+
*
|
|
2183
|
+
* @example
|
|
2184
|
+
* ```ts
|
|
2185
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2186
|
+
*
|
|
2187
|
+
* const queue = useQueue()
|
|
2188
|
+
*
|
|
2189
|
+
* queue.register({ value: 'First' })
|
|
2190
|
+
* queue.register({ value: 'Second' })
|
|
2191
|
+
*
|
|
2192
|
+
* console.log(queue.size) // 2
|
|
2193
|
+
*
|
|
2194
|
+
* queue.clear()
|
|
2195
|
+
*
|
|
2196
|
+
* console.log(queue.size) // 0
|
|
2197
|
+
* ```
|
|
2198
|
+
*/
|
|
2199
|
+
clear: () => void;
|
|
2200
|
+
/**
|
|
2201
|
+
* Dispose of the queue and clean up resources
|
|
2202
|
+
*
|
|
2203
|
+
* @remarks
|
|
2204
|
+
* - Clears all tickets and timeouts
|
|
2205
|
+
* - Removes all event listeners
|
|
2206
|
+
* - Should be called when the queue is no longer needed
|
|
2207
|
+
* - Automatically called on scope disposal
|
|
2208
|
+
*
|
|
2209
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue#dispose
|
|
2210
|
+
*
|
|
2211
|
+
* @example
|
|
2212
|
+
* ```ts
|
|
2213
|
+
* import { onScopeDispose } from 'vue'
|
|
2214
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2215
|
+
*
|
|
2216
|
+
* const queue = useQueue()
|
|
2217
|
+
*
|
|
2218
|
+
* queue.register({ value: 'Ticket' })
|
|
2219
|
+
*
|
|
2220
|
+
* onScopeDispose(() => {
|
|
2221
|
+
* queue.dispose()
|
|
2222
|
+
* })
|
|
2223
|
+
* ```
|
|
2224
|
+
*/
|
|
2225
|
+
dispose: () => void;
|
|
2226
|
+
}
|
|
2227
|
+
interface QueueOptions extends RegistryOptions {
|
|
2228
|
+
/**
|
|
2229
|
+
* Default timeout in milliseconds for tickets without explicit timeout
|
|
2230
|
+
*
|
|
2231
|
+
* @default 3000
|
|
2232
|
+
* @remarks
|
|
2233
|
+
* - Applied to tickets that don't specify their own timeout
|
|
2234
|
+
* - Can be overridden per ticket during registration
|
|
2235
|
+
*/
|
|
2236
|
+
timeout?: number;
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Creates a new queue instance
|
|
2240
|
+
*
|
|
2241
|
+
* @param options The options for the queue instance
|
|
2242
|
+
* @template Z The type of queue ticket that extends QueueTicket. Use this to add custom properties to tickets.
|
|
2243
|
+
* @template E The type of queue context that extends QueueContext<Z>. Use this when extending the queue with additional methods.
|
|
2244
|
+
* @returns A new queue instance
|
|
2245
|
+
*
|
|
2246
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-queue
|
|
2247
|
+
*
|
|
2248
|
+
* @example
|
|
2249
|
+
* ```ts
|
|
2250
|
+
* import { useQueue } from '@vuetify/v0'
|
|
2251
|
+
*
|
|
2252
|
+
* const queue = useQueue()
|
|
2253
|
+
*
|
|
2254
|
+
* // Register an ticket with default timeout (3000ms)
|
|
2255
|
+
* const ticket1 = queue.register({ value: 'Ticket 1' })
|
|
2256
|
+
*
|
|
2257
|
+
* // Register an ticket with custom timeout
|
|
2258
|
+
* const ticket2 = queue.register({ value: 'Ticket 2', timeout: 5000 })
|
|
2259
|
+
*
|
|
2260
|
+
* // Register a persistent ticket that must be manually dismissed
|
|
2261
|
+
* const ticket3 = queue.register({ value: 'Ticket 3', timeout: -1 })
|
|
2262
|
+
*
|
|
2263
|
+
* // Dismiss an ticket using the convenience method
|
|
2264
|
+
* ticket3.dismiss()
|
|
2265
|
+
*
|
|
2266
|
+
* console.log(queue.size) // 2
|
|
2267
|
+
* ```
|
|
2268
|
+
*/
|
|
2269
|
+
declare function useQueue<Z extends QueueTicket = QueueTicket, E extends QueueContext<Z> = QueueContext<Z>>(_options?: QueueOptions): E;
|
|
2270
|
+
//#endregion
|
|
2271
|
+
//#region src/composables/useResizeObserver/index.d.ts
|
|
2272
|
+
interface ResizeObserverEntry {
|
|
2273
|
+
contentRect: {
|
|
2274
|
+
width: number;
|
|
2275
|
+
height: number;
|
|
2276
|
+
top: number;
|
|
2277
|
+
left: number;
|
|
2278
|
+
};
|
|
2279
|
+
target: Element;
|
|
2280
|
+
}
|
|
2281
|
+
interface ResizeObserverOptions {
|
|
2282
|
+
immediate?: boolean;
|
|
2283
|
+
box?: 'content-box' | 'border-box';
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* A composable that uses the Resize Observer API to detect when an element's
|
|
2287
|
+
* size changes.
|
|
2288
|
+
*
|
|
2289
|
+
* @param target The element to observe.
|
|
2290
|
+
* @param callback The callback to execute when the element's size changes.
|
|
2291
|
+
* @param options The options for the Resize Observer.
|
|
2292
|
+
* @returns An object with methods to control the observer.
|
|
2293
|
+
*
|
|
2294
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver
|
|
2295
|
+
* @see https://0.vuetifyjs.com/composables/system/use-resize-observer
|
|
2296
|
+
*
|
|
2297
|
+
* @example
|
|
2298
|
+
* ```ts
|
|
2299
|
+
* import { ref } from 'vue'
|
|
2300
|
+
* import { useResizeObserver } from '@vuetify/v0'
|
|
2301
|
+
*
|
|
2302
|
+
* const el = ref<HTMLElement>()
|
|
2303
|
+
* const width = ref(0)
|
|
2304
|
+
* const height = ref(0)
|
|
2305
|
+
*
|
|
2306
|
+
* const { pause, resume, isPaused } = useResizeObserver(
|
|
2307
|
+
* el,
|
|
2308
|
+
* (entries) => {
|
|
2309
|
+
* const entry = entries[0]
|
|
2310
|
+
* if (entry) {
|
|
2311
|
+
* width.value = entry.contentRect.width
|
|
2312
|
+
* height.value = entry.contentRect.height
|
|
2313
|
+
* console.log('Size changed:', width.value, 'x', height.value)
|
|
2314
|
+
* }
|
|
2315
|
+
* },
|
|
2316
|
+
* { immediate: true }
|
|
2317
|
+
* )
|
|
2318
|
+
*
|
|
2319
|
+
* // Pause observation
|
|
2320
|
+
* pause()
|
|
2321
|
+
*
|
|
2322
|
+
* // Resume observation
|
|
2323
|
+
* resume()
|
|
2324
|
+
* ```
|
|
2325
|
+
*/
|
|
2326
|
+
declare function useResizeObserver(target: Ref<Element | undefined>, callback: (entries: ResizeObserverEntry[]) => void, options?: ResizeObserverOptions): {
|
|
2327
|
+
isPaused: Readonly<Ref<boolean, boolean>>;
|
|
2328
|
+
pause: () => void;
|
|
2329
|
+
resume: () => void;
|
|
2330
|
+
stop: () => void;
|
|
2331
|
+
};
|
|
2332
|
+
/**
|
|
2333
|
+
* A convenience composable that uses the Resize Observer API to track an
|
|
2334
|
+
* element's size.
|
|
2335
|
+
*
|
|
2336
|
+
* @param target The element to observe.
|
|
2337
|
+
* @returns An object with the element's width and height.
|
|
2338
|
+
*
|
|
2339
|
+
* @see https://0.vuetifyjs.com/composables/system/use-resize-observer#use-element-size
|
|
2340
|
+
*
|
|
2341
|
+
* @example
|
|
2342
|
+
* ```ts
|
|
2343
|
+
* import { ref, watchEffect } from 'vue'
|
|
2344
|
+
* import { useElementSize } from '@vuetify/v0'
|
|
2345
|
+
*
|
|
2346
|
+
* const box = ref<HTMLElement>()
|
|
2347
|
+
* const { width, height } = useElementSize(box)
|
|
2348
|
+
*
|
|
2349
|
+
* // Width and height are reactive refs
|
|
2350
|
+
* watchEffect(() => {
|
|
2351
|
+
* console.log('Box size:', width.value, 'x', height.value)
|
|
2352
|
+
* })
|
|
2353
|
+
* ```
|
|
2354
|
+
*/
|
|
2355
|
+
declare function useElementSize(target: Ref<Element | undefined>): {
|
|
2356
|
+
width: vue169.ShallowRef<number, number>;
|
|
2357
|
+
height: vue169.ShallowRef<number, number>;
|
|
2358
|
+
isPaused: Readonly<Ref<boolean, boolean>>;
|
|
2359
|
+
pause: () => void;
|
|
2360
|
+
resume: () => void;
|
|
2361
|
+
stop: () => void;
|
|
2362
|
+
};
|
|
2363
|
+
//#endregion
|
|
2364
|
+
//#region src/composables/useStep/index.d.ts
|
|
2365
|
+
interface StepTicket extends SingleTicket {}
|
|
2366
|
+
interface StepContext<Z extends StepTicket> extends SingleContext<Z> {
|
|
2367
|
+
/** Select the first Ticket in the collection */
|
|
2368
|
+
first: () => void;
|
|
2369
|
+
/** Select the last Ticket in the collection */
|
|
2370
|
+
last: () => void;
|
|
2371
|
+
/** Select the next Ticket based on current index */
|
|
2372
|
+
next: () => void;
|
|
2373
|
+
/** Select the previous Ticket based on current index */
|
|
2374
|
+
prev: () => void;
|
|
2375
|
+
/** Step through the collection by a given count */
|
|
2376
|
+
step: (count: number) => void;
|
|
2377
|
+
}
|
|
2378
|
+
interface StepOptions extends SingleOptions {}
|
|
2379
|
+
/**
|
|
2380
|
+
* Creates a new step instance.
|
|
2381
|
+
*
|
|
2382
|
+
* @param options The options for the step instance.
|
|
2383
|
+
* @template Z The type of the step ticket.
|
|
2384
|
+
* @template E The type of the step context.
|
|
2385
|
+
* @returns A new step instance.
|
|
2386
|
+
*
|
|
2387
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
2388
|
+
*
|
|
2389
|
+
* @example
|
|
2390
|
+
* ```ts
|
|
2391
|
+
* import { useStep } from '@vuetify/v0'
|
|
2392
|
+
*
|
|
2393
|
+
* const stepper = useStep()
|
|
2394
|
+
*
|
|
2395
|
+
* stepper.onboard([
|
|
2396
|
+
* { id: 'step-1', value: 'Account Info' },
|
|
2397
|
+
* { id: 'step-2', value: 'Payment' },
|
|
2398
|
+
* { id: 'step-3', value: 'Confirmation' },
|
|
2399
|
+
* ])
|
|
2400
|
+
*
|
|
2401
|
+
* stepper.first()
|
|
2402
|
+
* stepper.next() // Move to step-2
|
|
2403
|
+
*
|
|
2404
|
+
* console.log(stepper.selectedIndex.value) // 1
|
|
2405
|
+
* ```
|
|
2406
|
+
*/
|
|
2407
|
+
declare function useStep<Z extends StepTicket = StepTicket, E extends StepContext<Z> = StepContext<Z>>(options?: StepOptions): E;
|
|
2408
|
+
/**
|
|
2409
|
+
* Creates a new step context.
|
|
2410
|
+
*
|
|
2411
|
+
* @param namespace The namespace for the step context.
|
|
2412
|
+
* @param options The options for the step context.
|
|
2413
|
+
* @template Z The type of the step ticket.
|
|
2414
|
+
* @template E The type of the step context.
|
|
2415
|
+
* @returns A new step context.
|
|
2416
|
+
*
|
|
2417
|
+
* @see https://0.vuetifyjs.com/composables/selection/use-step
|
|
2418
|
+
*
|
|
2419
|
+
* @example
|
|
2420
|
+
* ```ts
|
|
2421
|
+
* import { createStepContext } from '@vuetify/v0'
|
|
2422
|
+
*
|
|
2423
|
+
* export const [useWizard, provideWizard, wizard] = createStepContext('wizard')
|
|
2424
|
+
*
|
|
2425
|
+
* // In a parent component:
|
|
2426
|
+
* provideWizard()
|
|
2427
|
+
*
|
|
2428
|
+
* // In a child component:
|
|
2429
|
+
* const wizard = useWizard()
|
|
2430
|
+
* wizard.next() // Progress to next step
|
|
2431
|
+
* ```
|
|
2432
|
+
*/
|
|
2433
|
+
declare function createStepContext<Z extends StepTicket = StepTicket, E extends StepContext<Z> = StepContext<Z>>(namespace: string, options?: StepOptions): ContextTrinity<E>;
|
|
2434
|
+
//#endregion
|
|
2435
|
+
//#region src/composables/useStorage/adapters/adapter.d.ts
|
|
2436
|
+
interface StorageAdapter$1 {
|
|
2437
|
+
getItem: (key: string) => string | null;
|
|
2438
|
+
setItem: (key: string, value: string) => void;
|
|
2439
|
+
removeItem: (key: string) => void;
|
|
2440
|
+
readonly length?: number;
|
|
2441
|
+
key?: (index: number) => string | null;
|
|
2442
|
+
}
|
|
2443
|
+
//#endregion
|
|
2444
|
+
//#region src/composables/useStorage/adapters/memory.d.ts
|
|
2445
|
+
/**
|
|
2446
|
+
* In-memory storage adapter that implements the StorageAdapter interface.
|
|
2447
|
+
* This adapter provides temporary storage that persists only for the current
|
|
2448
|
+
* session and is useful for testing or when persistent storage is not available.
|
|
2449
|
+
*/
|
|
2450
|
+
declare class MemoryAdapter implements StorageAdapter$1 {
|
|
2451
|
+
private store;
|
|
2452
|
+
get length(): number;
|
|
2453
|
+
getItem(key: string): string | null;
|
|
2454
|
+
setItem(key: string, value: string): void;
|
|
2455
|
+
removeItem(key: string): void;
|
|
2456
|
+
key(index: number): string;
|
|
2457
|
+
}
|
|
2458
|
+
//#endregion
|
|
2459
|
+
//#region src/composables/useStorage/adapters/index.d.ts
|
|
2460
|
+
type StorageType = 'localStorage' | 'sessionStorage' | 'memory';
|
|
2461
|
+
interface StorageAdapter {
|
|
2462
|
+
getItem: (key: string) => string | null;
|
|
2463
|
+
setItem: (key: string, value: string) => void;
|
|
2464
|
+
removeItem: (key: string) => void;
|
|
2465
|
+
readonly length?: number;
|
|
2466
|
+
key?: (index: number) => string | null;
|
|
2467
|
+
}
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region src/composables/useStorage/index.d.ts
|
|
2470
|
+
interface StorageContext {
|
|
2471
|
+
/** Check if a key exists in storage */
|
|
2472
|
+
has: (key: string) => boolean;
|
|
2473
|
+
/** Get a reactive ref for a storage key */
|
|
2474
|
+
get: <T>(key: string, defaultValue?: T) => Ref<T>;
|
|
2475
|
+
/** Set a value for a storage key */
|
|
2476
|
+
set: <T>(key: string, value: T) => void;
|
|
2477
|
+
/** Remove a key from storage */
|
|
2478
|
+
remove: (key: string) => void;
|
|
2479
|
+
/** Clear all keys from storage */
|
|
2480
|
+
clear: () => void;
|
|
2481
|
+
}
|
|
2482
|
+
interface StorageOptions {
|
|
2483
|
+
/** The storage adapter to use. Defaults to localStorage in browser, MemoryAdapter otherwise */
|
|
2484
|
+
adapter?: StorageAdapter;
|
|
2485
|
+
/** The prefix to use for all storage keys. Defaults to 'v0:' */
|
|
2486
|
+
prefix?: string;
|
|
2487
|
+
/** Custom serializer for reading and writing values. Defaults to JSON.parse/stringify */
|
|
2488
|
+
serializer?: {
|
|
2489
|
+
read: (value: string) => any;
|
|
2490
|
+
write: (value: any) => string;
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
declare const useStorageContext: (key?: ContextKey<StorageContext>) => StorageContext, provideStorageContext: (context: StorageContext, app?: App) => StorageContext;
|
|
2494
|
+
/**
|
|
2495
|
+
* Creates a new storage instance.
|
|
2496
|
+
*
|
|
2497
|
+
* @param options The options for the storage instance.
|
|
2498
|
+
* @template E The type of the storage context.
|
|
2499
|
+
* @returns A new storage instance.
|
|
2500
|
+
*
|
|
2501
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-storage
|
|
2502
|
+
*
|
|
2503
|
+
* @example
|
|
2504
|
+
* ```ts
|
|
2505
|
+
* import { createStorage } from '@vuetify/v0'
|
|
2506
|
+
*
|
|
2507
|
+
* const storage = createStorage()
|
|
2508
|
+
*
|
|
2509
|
+
* storage.set('username', 'MyUsername')
|
|
2510
|
+
*
|
|
2511
|
+
* const username = storage.get('username')
|
|
2512
|
+
*
|
|
2513
|
+
* console.log(username.value) // MyUsername
|
|
2514
|
+
*
|
|
2515
|
+
* storage.clear()
|
|
2516
|
+
* ```
|
|
2517
|
+
*/
|
|
2518
|
+
declare function createStorage<E extends StorageContext>(options?: StorageOptions): E;
|
|
2519
|
+
/**
|
|
2520
|
+
* Returns the current storage instance.
|
|
2521
|
+
*
|
|
2522
|
+
* @returns The current storage instance.
|
|
2523
|
+
*
|
|
2524
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-storage
|
|
2525
|
+
*
|
|
2526
|
+
* @example
|
|
2527
|
+
* ```vue
|
|
2528
|
+
* <script setup lang="ts">
|
|
2529
|
+
* import { useStorage } from '@vuetify/v0'
|
|
2530
|
+
*
|
|
2531
|
+
* const storage = useStorage()
|
|
2532
|
+
* const username = storage.get('username', 'Guest')
|
|
2533
|
+
* </script>
|
|
2534
|
+
*
|
|
2535
|
+
* <template>
|
|
2536
|
+
* <div>
|
|
2537
|
+
* <p>Username: {{ username }}</p>
|
|
2538
|
+
* </div>
|
|
2539
|
+
* </template>
|
|
2540
|
+
* ```
|
|
2541
|
+
*/
|
|
2542
|
+
declare function useStorage(): StorageContext;
|
|
2543
|
+
/**
|
|
2544
|
+
* Creates a new storage plugin.
|
|
2545
|
+
*
|
|
2546
|
+
* @param options The options for the storage plugin.
|
|
2547
|
+
* @returns A new storage plugin.
|
|
2548
|
+
*
|
|
2549
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-storage
|
|
2550
|
+
*
|
|
2551
|
+
* @example
|
|
2552
|
+
* ```ts
|
|
2553
|
+
* import { createApp } from 'vue'
|
|
2554
|
+
* import { createStoragePlugin } from '@vuetify/v0'
|
|
2555
|
+
* import App from './App.vue'
|
|
2556
|
+
*
|
|
2557
|
+
* const app = createApp(App)
|
|
2558
|
+
*
|
|
2559
|
+
* app.use(createStoragePlugin())
|
|
2560
|
+
*
|
|
2561
|
+
* app.mount('#app')
|
|
2562
|
+
* ```
|
|
2563
|
+
*/
|
|
2564
|
+
declare function createStoragePlugin(options?: StorageOptions): Plugin;
|
|
2565
|
+
//#endregion
|
|
2566
|
+
//#region src/composables/useTheme/adapters/adapter.d.ts
|
|
2567
|
+
interface ThemeAdapterInterface {
|
|
2568
|
+
update: (colors: Record<string, Colors>) => void;
|
|
2569
|
+
}
|
|
2570
|
+
declare abstract class ThemeAdapter implements ThemeAdapterInterface {
|
|
2571
|
+
stylesheetId: string;
|
|
2572
|
+
prefix: string;
|
|
2573
|
+
constructor(prefix: string);
|
|
2574
|
+
generate(colors: Record<string, Colors>): string;
|
|
2575
|
+
abstract update(colors: Record<string, Colors>): void;
|
|
2576
|
+
}
|
|
2577
|
+
//#endregion
|
|
2578
|
+
//#region src/composables/useTheme/adapters/v0.d.ts
|
|
2579
|
+
interface Vuetify0ThemeOptions {
|
|
2580
|
+
cspNonce?: string;
|
|
2581
|
+
stylesheetId?: string;
|
|
2582
|
+
prefix?: string;
|
|
2583
|
+
}
|
|
2584
|
+
/**
|
|
2585
|
+
* Theme adapter implementation for Vuetify v0 design system.
|
|
2586
|
+
* This adapter generates CSS custom properties and injects them into the DOM
|
|
2587
|
+
* as a stylesheet, allowing themes to be applied globally.
|
|
2588
|
+
*/
|
|
2589
|
+
declare class Vuetify0ThemeAdapter extends ThemeAdapter {
|
|
2590
|
+
cspNonce?: string;
|
|
2591
|
+
constructor(options?: Vuetify0ThemeOptions);
|
|
2592
|
+
update(colors: Record<ID, Colors>): void;
|
|
2593
|
+
upsert(styles: string): void;
|
|
2594
|
+
}
|
|
2595
|
+
//#endregion
|
|
2596
|
+
//#region src/composables/useTheme/index.d.ts
|
|
2597
|
+
type Colors = {
|
|
2598
|
+
[key: string]: string;
|
|
2599
|
+
};
|
|
2600
|
+
type ThemeColors = {
|
|
2601
|
+
[key: string]: Colors | string;
|
|
2602
|
+
};
|
|
2603
|
+
type ThemeRecord = {
|
|
2604
|
+
[key: string]: any;
|
|
2605
|
+
dark?: boolean;
|
|
2606
|
+
lazy?: boolean;
|
|
2607
|
+
colors: ThemeColors;
|
|
2608
|
+
};
|
|
2609
|
+
type ThemeTicket = SingleTicket & {
|
|
2610
|
+
lazy: boolean;
|
|
2611
|
+
dark: boolean;
|
|
2612
|
+
};
|
|
2613
|
+
interface ThemeContext<Z extends ThemeTicket> extends SingleContext<Z> {
|
|
2614
|
+
colors: ComputedRef<Record<string, Colors>>;
|
|
2615
|
+
cycle: (themes: ID[]) => void;
|
|
2616
|
+
}
|
|
2617
|
+
interface ThemeOptions extends ThemePluginOptions {}
|
|
2618
|
+
interface ThemePluginOptions<Z extends ThemeRecord = ThemeRecord> {
|
|
2619
|
+
adapter?: ThemeAdapter;
|
|
2620
|
+
default?: ID;
|
|
2621
|
+
palette?: TokenCollection;
|
|
2622
|
+
themes?: Record<ID, Z>;
|
|
2623
|
+
target?: string | HTMLElement | null;
|
|
2624
|
+
}
|
|
2625
|
+
/**
|
|
2626
|
+
* Creates a new theme instance.
|
|
2627
|
+
*
|
|
2628
|
+
* @param namespace The namespace for the theme instance.
|
|
2629
|
+
* @param options The options for the theme instance.
|
|
2630
|
+
* @template Z The type of the theme ticket.
|
|
2631
|
+
* @template E The type of the theme context.
|
|
2632
|
+
* @returns A new theme instance.
|
|
2633
|
+
*
|
|
2634
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-theme
|
|
2635
|
+
*
|
|
2636
|
+
* @example
|
|
2637
|
+
* ```ts
|
|
2638
|
+
* import { createTheme } from '@vuetify/v0'
|
|
2639
|
+
*
|
|
2640
|
+
* export const [useTheme, provideTheme] = createTheme('v0:theme', {
|
|
2641
|
+
* default: 'light',
|
|
2642
|
+
* themes: {
|
|
2643
|
+
* light: {
|
|
2644
|
+
* dark: false,
|
|
2645
|
+
* colors: {
|
|
2646
|
+
* primary: '#3b82f6',
|
|
2647
|
+
* },
|
|
2648
|
+
* },
|
|
2649
|
+
* dark: {
|
|
2650
|
+
* dark: true,
|
|
2651
|
+
* colors: {
|
|
2652
|
+
* primary: '#675496',
|
|
2653
|
+
* },
|
|
2654
|
+
* },
|
|
2655
|
+
* },
|
|
2656
|
+
* })
|
|
2657
|
+
* ```
|
|
2658
|
+
*/
|
|
2659
|
+
declare function createTheme<Z extends ThemeTicket = ThemeTicket, E extends ThemeContext<Z> = ThemeContext<Z>>(namespace?: string, options?: ThemeOptions): ContextTrinity<E>;
|
|
2660
|
+
/**
|
|
2661
|
+
* Returns the current theme instance.
|
|
2662
|
+
*
|
|
2663
|
+
* @returns The current theme instance.
|
|
2664
|
+
*
|
|
2665
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-theme
|
|
2666
|
+
*
|
|
2667
|
+
* @example
|
|
2668
|
+
* ```vue
|
|
2669
|
+
* <script setup lang="ts">
|
|
2670
|
+
* import { useTheme } from '@vuetify/v0'
|
|
2671
|
+
*
|
|
2672
|
+
* const theme = useTheme()
|
|
2673
|
+
* </script>
|
|
2674
|
+
*
|
|
2675
|
+
* <template>
|
|
2676
|
+
* <div>
|
|
2677
|
+
* <p>Current theme: {{ theme.selected.value }}</p>
|
|
2678
|
+
* </div>
|
|
2679
|
+
* </template>
|
|
2680
|
+
* ```
|
|
2681
|
+
*/
|
|
2682
|
+
declare function useTheme(): ThemeContext<ThemeTicket>;
|
|
2683
|
+
/**
|
|
2684
|
+
* Creates a new theme plugin.
|
|
2685
|
+
*
|
|
2686
|
+
* @param _options The options for the theme plugin.
|
|
2687
|
+
* @template Z The type of the theme ticket.
|
|
2688
|
+
* @template E The type of the theme context.
|
|
2689
|
+
* @returns A new theme plugin.
|
|
2690
|
+
*
|
|
2691
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-theme
|
|
2692
|
+
*
|
|
2693
|
+
* @example
|
|
2694
|
+
* ```ts
|
|
2695
|
+
* import { createApp } from 'vue'
|
|
2696
|
+
* import { createThemePlugin } from '@vuetify/v0'
|
|
2697
|
+
* import App from './App.vue'
|
|
2698
|
+
*
|
|
2699
|
+
* const app = createApp(App)
|
|
2700
|
+
*
|
|
2701
|
+
* app.use(
|
|
2702
|
+
* createThemePlugin({
|
|
2703
|
+
* default: 'light',
|
|
2704
|
+
* themes: {
|
|
2705
|
+
* light: {
|
|
2706
|
+
* dark: false,
|
|
2707
|
+
* colors: {
|
|
2708
|
+
* primary: '#3b82f6',
|
|
2709
|
+
* },
|
|
2710
|
+
* },
|
|
2711
|
+
* dark: {
|
|
2712
|
+
* dark: true,
|
|
2713
|
+
* colors: {
|
|
2714
|
+
* primary: '#675496',
|
|
2715
|
+
* },
|
|
2716
|
+
* },
|
|
2717
|
+
* },
|
|
2718
|
+
* })
|
|
2719
|
+
* )
|
|
2720
|
+
*
|
|
2721
|
+
* app.mount('#app')
|
|
2722
|
+
* ```
|
|
2723
|
+
*/
|
|
2724
|
+
declare function createThemePlugin<Z extends ThemeTicket = ThemeTicket, E extends ThemeContext<Z> = ThemeContext<Z>>(_options?: ThemePluginOptions): Plugin;
|
|
2725
|
+
//#endregion
|
|
2726
|
+
//#region src/composables/useTimeline/index.d.ts
|
|
2727
|
+
interface TimelineContext<Z extends TimelineTicket> extends RegistryContext<Z> {
|
|
2728
|
+
undo: () => Z | undefined;
|
|
2729
|
+
redo: () => Z | undefined;
|
|
2730
|
+
}
|
|
2731
|
+
interface TimelineTicket extends RegistryTicket {}
|
|
2732
|
+
interface TimelineOptions extends RegistryOptions {
|
|
2733
|
+
size?: number;
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Creates a new timeline instance.
|
|
2737
|
+
*
|
|
2738
|
+
* @param _options The options for the timeline instance.
|
|
2739
|
+
* @template Z The type of the timeline ticket.
|
|
2740
|
+
* @template E The type of the timeline context.
|
|
2741
|
+
* @returns A new timeline instance.
|
|
2742
|
+
*
|
|
2743
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-timeline
|
|
2744
|
+
*
|
|
2745
|
+
* @example
|
|
2746
|
+
* ```ts
|
|
2747
|
+
* import { useTimeline } from '@vuetify/v0'
|
|
2748
|
+
*
|
|
2749
|
+
* const timeline = useTimeline({ size: 3 })
|
|
2750
|
+
*
|
|
2751
|
+
* timeline.onboard([{ id: 'one' }, { id: 'two' }, { id: 'three' }])
|
|
2752
|
+
*
|
|
2753
|
+
* console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }, { id: 'three' }]
|
|
2754
|
+
*
|
|
2755
|
+
* timeline.undo()
|
|
2756
|
+
* console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }]
|
|
2757
|
+
*
|
|
2758
|
+
* timeline.redo()
|
|
2759
|
+
* console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }, { id: 'three' }]
|
|
2760
|
+
* ```
|
|
2761
|
+
*/
|
|
2762
|
+
declare function useTimeline<Z extends TimelineTicket = TimelineTicket, E extends TimelineContext<Z> = TimelineContext<Z>>(_options?: TimelineOptions): E;
|
|
2763
|
+
//#endregion
|
|
2764
|
+
export { PermissionAdapterInterface as $, provideContext as $n, useFilter as $t, createStepContext as A, createRegistryContext as An, IntersectionObserverOptions as At, ProxyRegistryContext as B, BreakpointsPluginOptions as Bn, FormOptions as Bt, useStorageContext as C, SelectionOptions as Cn, SingleOptions as Ct, StepContext as D, RegistryContext as Dn, KeyHandler as Dt, MemoryAdapter as E, useSelection as En, useSingle as Et, useResizeObserver as F, useEventListener as Fn, createHydrationPlugin as Ft, PermissionContext as G, toArray as Gn, useForm as Gt, useProxyRegistry as H, createBreakpointsPlugin as Hn, FormValidationResult as Ht, QueueContext as I, useWindowEventListener as In, provideHydrationContext as It, PermissionTicket as J, Plugin as Jn, FilterMode as Jt, PermissionOptions as K, ContextTrinity as Kn, FilterFunction as Kt, QueueOptions as L, BreakpointName as Ln, useHydration as Lt, ResizeObserverEntry as M, CleanupFunction as Mn, useIntersectionObserver as Mt, ResizeObserverOptions as N, EventHandler as Nn, HydrationContext as Nt, StepOptions as O, RegistryOptions as On, useKeydown as Ot, useElementSize as P, useDocumentEventListener as Pn, createHydration as Pt, PermissionAdapter as Q, createContext as Qn, UseFilterResult as Qt, QueueTicket as R, BreakpointsContext as Rn, useHydrationContext as Rt, useStorage as S, SelectionContext as Sn, SingleContext as St, StorageType as T, createSelectionContext as Tn, createSingleContext as Tt, ProxyModelOptions as U, useBreakpoints as Un, FormValidationRule as Ut, ProxyRegistryOptions as V, createBreakpoints as Vn, FormTicket as Vt, useProxyModel as W, toReactive as Wn, FormValue as Wt, createPermissionsPlugin as X, createPlugin as Xn, Primitive as Xt, createPermissions as Y, PluginOptions as Yn, FilterQuery as Yt, usePermissions as Z, ContextKey as Zn, UseFilterOptions as Zt, StorageContext as _, GroupContext as _n, createLocale as _t, Colors as a, createFeaturesPlugin as an, createLogger as at, createStoragePlugin as b, createGroupContext as bn, Vuetify0LocaleAdapter as bt, ThemeOptions as c, TokenAlias as cn, LogLevel as ct, ThemeTicket as d, TokenOptions as dn, ConsolaLoggerAdapter as dt, FeatureContext as en, useContext as er, MutationObserverRecord as et, createTheme as f, TokenPrimitive as fn, LoggerAdapter as ft, ThemeAdapter as g, useTokens as gn, LocaleTicket as gt, Vuetify0ThemeAdapter as h, createTokensContext as hn, LocalePluginOptions as ht, useTimeline as i, createFeatures as in, LoggerOptions as it, useStep as j, useRegistry as jn, useElementIntersection as jt, StepTicket as k, RegistryTicket as kn, IntersectionObserverEntry as kt, ThemePluginOptions as l, TokenCollection as ln, Vuetify0LoggerAdapter as lt, useTheme as m, TokenValue as mn, LocaleOptions as mt, TimelineOptions as n, FeaturePluginOptions as nn, useMutationObserver as nt, ThemeColors as o, useFeatures as on, createLoggerPlugin as ot, createThemePlugin as p, TokenTicket as pn, LocaleContext as pt, PermissionPluginOptions as q, createTrinity as qn, FilterItem as qt, TimelineTicket as r, FeatureTicket as rn, LoggerContext as rt, ThemeContext as s, FlatTokenCollection as sn, useLogger as st, TimelineContext as t, FeatureOptions as tn, UseMutationObserverOptions as tt, ThemeRecord as u, TokenContext as un, PinoLoggerAdapter as ut, StorageOptions as v, GroupOptions as vn, createLocalePlugin as vt, StorageAdapter as w, SelectionTicket as wn, SingleTicket as wt, provideStorageContext as x, useGroup as xn, LocaleAdapter as xt, createStorage as y, GroupTicket as yn, useLocale as yt, useQueue as z, BreakpointsOptions as zn, FormContext as zt };
|