@vuetify/v0 0.0.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2588 @@
1
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createPropsRestProxy, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, inject, isRef, mergeModels, mergeProps, normalizeProps, normalizeStyle, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, ref, renderSlot, resolveDynamicComponent, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toValue, unref, useAttrs, useId, useModel, useTemplateRef, watch, withCtx } from "vue";
2
+
3
+ //#region src/constants/htmlElements.ts
4
+ const selfClosingTags = [
5
+ "area",
6
+ "base",
7
+ "br",
8
+ "col",
9
+ "embed",
10
+ "hr",
11
+ "img",
12
+ "input",
13
+ "link",
14
+ "meta",
15
+ "source",
16
+ "track",
17
+ "wbr"
18
+ ];
19
+ /**
20
+ * Set of HTML elements that are self-closing (void elements)
21
+ * These elements cannot have children and don't need closing tags
22
+ */
23
+ const SELF_CLOSING_TAGS = new Set(selfClosingTags);
24
+ /**
25
+ * Check if an element is self-closing
26
+ */
27
+ function isSelfClosingTag(tag) {
28
+ return SELF_CLOSING_TAGS.has(tag.toLowerCase());
29
+ }
30
+
31
+ //#endregion
32
+ //#region src/components/Atom/Atom.vue?vue&type=script&setup=true&lang.ts
33
+ var Atom_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
34
+ name: "Atom",
35
+ __name: "Atom",
36
+ props: {
37
+ as: { default: "div" },
38
+ renderless: {
39
+ type: Boolean,
40
+ default: false
41
+ }
42
+ },
43
+ setup(__props, { expose: __expose }) {
44
+ const element = useTemplateRef("element");
45
+ __expose({ element });
46
+ const attrs = useAttrs();
47
+ const isSelfClosing = toRef(() => typeof __props.as === "string" && isSelfClosingTag(__props.as));
48
+ const slotProps = toRef(() => attrs);
49
+ return (_ctx, _cache) => {
50
+ return _ctx.renderless || _ctx.as === null ? renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 0 }, slotProps.value))) : !isSelfClosing.value ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ key: 1 }, slotProps.value, {
51
+ ref_key: "element",
52
+ ref: element
53
+ }), {
54
+ default: withCtx(() => [!isSelfClosing.value ? renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 0 }, slotProps.value))) : createCommentVNode("v-if", true)]),
55
+ _: 3
56
+ }, 16)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
57
+ key: 2,
58
+ ref_key: "element",
59
+ ref: element
60
+ }, slotProps.value), null, 16));
61
+ };
62
+ }
63
+ });
64
+
65
+ //#endregion
66
+ //#region src/components/Atom/Atom.vue
67
+ var Atom_default = Atom_vue_vue_type_script_setup_true_lang_default;
68
+
69
+ //#endregion
70
+ //#region src/factories/createContext/index.ts
71
+ /**
72
+ * A simple wrapper for tapping into a v0 namespace
73
+ * @param key The provided string or InjectionKey
74
+ * @template Z The type values for the context.
75
+ * @returns A function that retrieves context
76
+ * @throws Error if namespace is not found.
77
+ *
78
+ * @see https://vuejs.org/api/composition-api-dependency-injection.html#inject
79
+ */
80
+ function useContext(key) {
81
+ return function(namespace) {
82
+ const context = inject(namespace || key, void 0);
83
+ if (context === void 0) throw new Error(`Context "${String(key)}" not found. Ensure it's provided by an ancestor.`);
84
+ return context;
85
+ };
86
+ }
87
+ /**
88
+ * A simple wrapper for Vues provide & inject systems
89
+ * to create context for managing application state
90
+ * @param key The provided string or InjectionKey
91
+ * @template Z The type values for the context.
92
+ * @returns A tuple containing provide/inject
93
+ *
94
+ * @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
95
+ * @see https://0.vuetifyjs.com/composables/foundation/create-context
96
+ */
97
+ function createContext(key) {
98
+ function provideContext(context, app) {
99
+ app?.provide(key, context) ?? provide(key, context);
100
+ return context;
101
+ }
102
+ return [useContext(key), provideContext];
103
+ }
104
+
105
+ //#endregion
106
+ //#region src/factories/createPlugin/index.ts
107
+ /**
108
+ * A universal plugin factory to reduce boilerplate code for Vue plugin creation
109
+ * @param options Configurable object with namespace and provide/setup methods
110
+ * @returns A Vue plugin object with install method that runs app w/ context
111
+ *
112
+ * @see https://vuejs.org/api/application.html#app-runwithcontext
113
+ * @see https://0.vuetifyjs.com/factories/create-plugin
114
+ */
115
+ function createPlugin(options) {
116
+ return { install(app) {
117
+ app.runWithContext(() => {
118
+ options.provide(app);
119
+ options.setup?.(app);
120
+ });
121
+ } };
122
+ }
123
+
124
+ //#endregion
125
+ //#region src/composables/useHydration/index.ts
126
+ const [useHydrationContext, provideHydrationContext] = createContext("v0:hydration");
127
+ /**
128
+ * Creates a hydration context for tracking client-side hydration state in SSR applications.
129
+ * This function provides a way to determine when the application has been fully hydrated
130
+ * on the client side, which is essential for SSR/SSG compatibility.
131
+ *
132
+ * @returns A hydration context object with reactive state and hydration control.
133
+ */
134
+ function createHydration() {
135
+ const isHydrated = shallowRef(false);
136
+ function hydrate() {
137
+ isHydrated.value = true;
138
+ }
139
+ return {
140
+ isHydrated: shallowReadonly(isHydrated),
141
+ hydrate
142
+ };
143
+ }
144
+ /**
145
+ * Simple hook to access the hydration context.
146
+ *
147
+ * @returns The hydration context containing hydration state and controls.
148
+ */
149
+ function useHydration() {
150
+ return useHydrationContext();
151
+ }
152
+ /**
153
+ * Creates a Vue plugin for hydration state management in SSR/SSG applications.
154
+ * This plugin automatically detects when the root component is mounted and
155
+ * triggers the hydration process, ensuring proper client-side hydration timing.
156
+ *
157
+ * @returns A Vue plugin object with install method.
158
+ */
159
+ function createHydrationPlugin() {
160
+ const context = createHydration();
161
+ return createPlugin({
162
+ namespace: "v0:hydration",
163
+ provide: (app) => {
164
+ provideHydrationContext(context, app);
165
+ },
166
+ setup: (app) => {
167
+ app.mixin({ mounted() {
168
+ if (this.$parent !== null) return;
169
+ context.hydrate();
170
+ } });
171
+ }
172
+ });
173
+ }
174
+
175
+ //#endregion
176
+ //#region src/utilities/helpers.ts
177
+ /* @__NO_SIDE_EFFECTS__ */
178
+ function isFunction(item) {
179
+ return typeof item === "function";
180
+ }
181
+ /* @__NO_SIDE_EFFECTS__ */
182
+ function isString(item) {
183
+ return typeof item === "string";
184
+ }
185
+ /* @__NO_SIDE_EFFECTS__ */
186
+ function isNumber(item) {
187
+ return typeof item === "number";
188
+ }
189
+ /* @__NO_SIDE_EFFECTS__ */
190
+ function isBoolean(item) {
191
+ return typeof item === "boolean";
192
+ }
193
+ /* @__NO_SIDE_EFFECTS__ */
194
+ function isObject(item) {
195
+ return typeof item === "object" && item !== null && !Array.isArray(item);
196
+ }
197
+ /* @__NO_SIDE_EFFECTS__ */
198
+ function isArray(item) {
199
+ return Array.isArray(item);
200
+ }
201
+ /* @__NO_SIDE_EFFECTS__ */
202
+ function isNullOrUndefined(item) {
203
+ return item == null;
204
+ }
205
+ /* @__NO_SIDE_EFFECTS__ */
206
+ function isPrimitive(item) {
207
+ return typeof item === "string" || typeof item === "number" || typeof item === "boolean";
208
+ }
209
+ /* @__NO_SIDE_EFFECTS__ */
210
+ function mergeDeep(target, ...sources) {
211
+ if (sources.length === 0) return target;
212
+ const source = sources.shift();
213
+ if (/* @__PURE__ */ isObject(target) && /* @__PURE__ */ isObject(source)) {
214
+ for (const key in source) if (Object.prototype.hasOwnProperty.call(source, key)) {
215
+ const sourceValue = source[key];
216
+ const targetValue = target[key];
217
+ if (/* @__PURE__ */ isObject(sourceValue)) {
218
+ if (!/* @__PURE__ */ isObject(targetValue)) Object.assign(target, { [key]: {} });
219
+ } else Object.assign(target, { [key]: sourceValue });
220
+ }
221
+ }
222
+ return /* @__PURE__ */ mergeDeep(target, ...sources);
223
+ }
224
+ /* @__NO_SIDE_EFFECTS__ */
225
+ function genId() {
226
+ return Math.random().toString(36).slice(2, 9);
227
+ }
228
+
229
+ //#endregion
230
+ //#region src/constants/globals.ts
231
+ const IN_BROWSER = typeof window !== "undefined";
232
+ const SUPPORTS_TOUCH = IN_BROWSER && ("ontouchstart" in window || window.navigator.maxTouchPoints > 0);
233
+ const SUPPORTS_MATCH_MEDIA = IN_BROWSER && "matchMedia" in window && typeof window.matchMedia === "function";
234
+ const SUPPORTS_OBSERVER = IN_BROWSER && "ResizeObserver" in window;
235
+ const SUPPORTS_INTERSECTION_OBSERVER = IN_BROWSER && "IntersectionObserver" in window;
236
+ const SUPPORTS_MUTATION_OBSERVER = IN_BROWSER && "MutationObserver" in window;
237
+ const __LOGGER_ENABLED__ = process.env.NODE_ENV !== "production" || process.env.VITE_LOGGER_ENABLED === "true";
238
+
239
+ //#endregion
240
+ //#region src/composables/useBreakpoints/index.ts
241
+ const [useBreakpointsContext, provideBreakpointsContext] = createContext("v0:breakpoints");
242
+ /**
243
+ * Simple hook to access the breakpoints context.
244
+ *
245
+ * @returns The breakpoints context containing current breakpoint information.
246
+ */
247
+ function useBreakpoints() {
248
+ return useBreakpointsContext();
249
+ }
250
+ /**
251
+ * Creates default breakpoint configuration.
252
+ *
253
+ * @returns The default breakpoint configuration object.
254
+ */
255
+ function createDefaultBreakpoints() {
256
+ return {
257
+ mobileBreakpoint: "md",
258
+ breakpoints: {
259
+ xs: 0,
260
+ sm: 600,
261
+ md: 960,
262
+ lg: 1280,
263
+ xl: 1920,
264
+ xxl: 2560
265
+ }
266
+ };
267
+ }
268
+ /**
269
+ * Creates a reactive breakpoints system for responsive behavior management.
270
+ * This function provides access to viewport dimensions, breakpoint detection, and helper flags
271
+ * for determining current screen size and implementing responsive logic.
272
+ *
273
+ * @param options Optional configuration for breakpoint thresholds and mobile breakpoint.
274
+ * @returns A breakpoints context object with reactive state and utility methods.
275
+ */
276
+ function createBreakpoints(options = {}) {
277
+ const defaults = createDefaultBreakpoints();
278
+ const { mobileBreakpoint, breakpoints } = mergeDeep(defaults, options);
279
+ const sorted = Object.entries(breakpoints).sort((a, b) => a[1] - b[1]);
280
+ const names = sorted.map(([n]) => n);
281
+ const mb = typeof mobileBreakpoint === "number" ? mobileBreakpoint : breakpoints[mobileBreakpoint] ?? breakpoints.md;
282
+ const state = shallowReactive({
283
+ breakpoints,
284
+ name: "xs",
285
+ width: 0,
286
+ height: 0,
287
+ isMobile: true,
288
+ xs: true,
289
+ sm: false,
290
+ md: false,
291
+ lg: false,
292
+ xl: false,
293
+ xxl: false,
294
+ smAndUp: false,
295
+ mdAndUp: false,
296
+ lgAndUp: false,
297
+ xlAndUp: false,
298
+ xxlAndUp: false,
299
+ smAndDown: true,
300
+ mdAndDown: true,
301
+ lgAndDown: true,
302
+ xlAndDown: true,
303
+ xxlAndDown: true,
304
+ update
305
+ });
306
+ function update() {
307
+ if (!IN_BROWSER) return;
308
+ state.width = window.innerWidth;
309
+ state.height = window.innerHeight;
310
+ let current = "xs";
311
+ for (let i = sorted.length - 1; i >= 0; i--) if (state.width >= sorted[i][1]) {
312
+ current = sorted[i][0];
313
+ break;
314
+ }
315
+ state.name = current;
316
+ const index = names.indexOf(current);
317
+ state.isMobile = state.width < mb;
318
+ state.xs = index === 0;
319
+ state.sm = index === 1;
320
+ state.md = index === 2;
321
+ state.lg = index === 3;
322
+ state.xl = index === 4;
323
+ state.xxl = index === 5;
324
+ state.smAndUp = index >= 1;
325
+ state.mdAndUp = index >= 2;
326
+ state.lgAndUp = index >= 3;
327
+ state.xlAndUp = index >= 4;
328
+ state.xxlAndUp = index >= 5;
329
+ state.smAndDown = index <= 1;
330
+ state.mdAndDown = index <= 2;
331
+ state.lgAndDown = index <= 3;
332
+ state.xlAndDown = index <= 4;
333
+ state.xxlAndDown = index <= 5;
334
+ }
335
+ if (getCurrentInstance()) onMounted(() => {
336
+ const { isHydrated } = useHydration();
337
+ if (isHydrated.value) update();
338
+ watch(isHydrated, (hydrated) => {
339
+ if (hydrated) update();
340
+ }, { immediate: true });
341
+ });
342
+ if (IN_BROWSER) {
343
+ function listener() {
344
+ update();
345
+ }
346
+ window.addEventListener("resize", listener, { passive: true });
347
+ if (getCurrentInstance()) onScopeDispose(() => window.removeEventListener("resize", listener));
348
+ }
349
+ return state;
350
+ }
351
+ /**
352
+ * Creates a Vue plugin for managing responsive breakpoints with automatic updates.
353
+ * This plugin sets up breakpoint tracking and updates the context when the window
354
+ * is resized, providing reactive breakpoint state throughout the application.
355
+ *
356
+ * @param options Optional configuration for breakpoint thresholds and mobile breakpoint.
357
+ * @returns A Vue plugin object with install method.
358
+ */
359
+ function createBreakpointsPlugin(options = {}) {
360
+ const context = createBreakpoints(options);
361
+ return createPlugin({
362
+ namespace: "v0:breakpoints",
363
+ provide: (app) => {
364
+ provideBreakpointsContext(context, app);
365
+ },
366
+ setup: (app) => {
367
+ app.mixin({ mounted() {
368
+ context.update();
369
+ } });
370
+ }
371
+ });
372
+ }
373
+
374
+ //#endregion
375
+ //#region src/components/Breakpoints/BreakpointsItem.vue?vue&type=script&setup=true&lang.ts
376
+ var BreakpointsItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
377
+ name: "BreakpointsItem",
378
+ __name: "BreakpointsItem",
379
+ setup(__props) {
380
+ const breakpointsContext = useBreakpoints();
381
+ return (_ctx, _cache) => {
382
+ return openBlock(), createElementBlock(Fragment, null, [_ctx.$slots.xs && unref(breakpointsContext).xs ? renderSlot(_ctx.$slots, "xs", normalizeProps(mergeProps({ key: 0 }, unref(breakpointsContext)))) : _ctx.$slots.sm && unref(breakpointsContext).sm ? renderSlot(_ctx.$slots, "sm", normalizeProps(mergeProps({ key: 1 }, unref(breakpointsContext)))) : _ctx.$slots.md && unref(breakpointsContext).md ? renderSlot(_ctx.$slots, "md", normalizeProps(mergeProps({ key: 2 }, unref(breakpointsContext)))) : _ctx.$slots.lg && unref(breakpointsContext).lg ? renderSlot(_ctx.$slots, "lg", normalizeProps(mergeProps({ key: 3 }, unref(breakpointsContext)))) : _ctx.$slots.xl && unref(breakpointsContext).xl ? renderSlot(_ctx.$slots, "xl", normalizeProps(mergeProps({ key: 4 }, unref(breakpointsContext)))) : _ctx.$slots.xxl && unref(breakpointsContext).xxl ? renderSlot(_ctx.$slots, "xxl", normalizeProps(mergeProps({ key: 5 }, unref(breakpointsContext)))) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(breakpointsContext))))], 64);
383
+ };
384
+ }
385
+ });
386
+
387
+ //#endregion
388
+ //#region src/components/Breakpoints/BreakpointsItem.vue
389
+ var BreakpointsItem_default = BreakpointsItem_vue_vue_type_script_setup_true_lang_default;
390
+
391
+ //#endregion
392
+ //#region src/components/Breakpoints/BreakpointsRoot.vue?vue&type=script&setup=true&lang.ts
393
+ var BreakpointsRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
394
+ name: "BreakpointsRoot",
395
+ __name: "BreakpointsRoot",
396
+ props: {
397
+ mobileBreakpoint: {},
398
+ breakpoints: {}
399
+ },
400
+ setup(__props) {
401
+ const props = __props;
402
+ const breakpointsContext = createBreakpoints(props);
403
+ provideBreakpointsContext(breakpointsContext);
404
+ return (_ctx, _cache) => {
405
+ return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(breakpointsContext))));
406
+ };
407
+ }
408
+ });
409
+
410
+ //#endregion
411
+ //#region src/components/Breakpoints/BreakpointsRoot.vue
412
+ var BreakpointsRoot_default = BreakpointsRoot_vue_vue_type_script_setup_true_lang_default;
413
+
414
+ //#endregion
415
+ //#region src/components/Breakpoints/index.ts
416
+ const Breakpoints = {
417
+ Item: BreakpointsItem_default,
418
+ Root: BreakpointsRoot_default
419
+ };
420
+
421
+ //#endregion
422
+ //#region src/components/Context/ContextItem.vue?vue&type=script&setup=true&lang.ts
423
+ var ContextItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
424
+ name: "ContextItem",
425
+ __name: "ContextItem",
426
+ props: {
427
+ contextKey: {},
428
+ value: {}
429
+ },
430
+ setup(__props) {
431
+ let contextValue;
432
+ if (__props.value !== void 0) contextValue = __props.value;
433
+ else if (__props.contextKey) {
434
+ const [injectContext] = createContext(__props.contextKey);
435
+ contextValue = injectContext();
436
+ } else throw new Error("Context component requires either a \"value\" prop or a \"contextKey\" prop");
437
+ const bindableProps = toRef(() => ({ value: contextValue }));
438
+ return (_ctx, _cache) => {
439
+ return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(bindableProps.value)));
440
+ };
441
+ }
442
+ });
443
+
444
+ //#endregion
445
+ //#region src/components/Context/ContextItem.vue
446
+ var ContextItem_default = ContextItem_vue_vue_type_script_setup_true_lang_default;
447
+
448
+ //#endregion
449
+ //#region src/components/Context/ContextRoot.vue?vue&type=script&setup=true&lang.ts
450
+ var ContextRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
451
+ name: "ContextRoot",
452
+ __name: "ContextRoot",
453
+ props: {
454
+ contextKey: {},
455
+ value: {}
456
+ },
457
+ setup(__props) {
458
+ const [, provideContext] = createContext(__props.contextKey);
459
+ provideContext(__props.value);
460
+ return (_ctx, _cache) => {
461
+ return renderSlot(_ctx.$slots, "default");
462
+ };
463
+ }
464
+ });
465
+
466
+ //#endregion
467
+ //#region src/components/Context/ContextRoot.vue
468
+ var ContextRoot_default = ContextRoot_vue_vue_type_script_setup_true_lang_default;
469
+
470
+ //#endregion
471
+ //#region src/components/Context/index.ts
472
+ const Context = {
473
+ Item: ContextItem_default,
474
+ Root: ContextRoot_default
475
+ };
476
+
477
+ //#endregion
478
+ //#region src/composables/useLogger/adapters/consola.ts
479
+ var ConsolaLoggerAdapter = class {
480
+ consola;
481
+ constructor(consolaInstance) {
482
+ if (!consolaInstance) throw new Error("Consola instance is required for ConsolaLoggerAdapter");
483
+ this.consola = consolaInstance;
484
+ }
485
+ debug(message, ...args) {
486
+ this.consola.debug(message, ...args);
487
+ }
488
+ info(message, ...args) {
489
+ this.consola.info(message, ...args);
490
+ }
491
+ warn(message, ...args) {
492
+ this.consola.warn(message, ...args);
493
+ }
494
+ error(message, ...args) {
495
+ this.consola.error(message, ...args);
496
+ }
497
+ trace(message, ...args) {
498
+ if (this.consola.trace) this.consola.trace(message, ...args);
499
+ else this.consola.debug(message, ...args);
500
+ }
501
+ fatal(message, ...args) {
502
+ if (this.consola.fatal) this.consola.fatal(message, ...args);
503
+ else this.consola.error("[FATAL]", message, ...args);
504
+ }
505
+ };
506
+
507
+ //#endregion
508
+ //#region src/composables/useLogger/adapters/pino.ts
509
+ /**
510
+ * Pino logger adapter implementation
511
+ *
512
+ * This adapter integrates with the Pino logging library,
513
+ * providing high-performance structured logging optimized
514
+ * for Node.js applications with minimal overhead.
515
+ */
516
+ var PinoLoggerAdapter = class {
517
+ pino;
518
+ constructor(pinoInstance) {
519
+ if (!pinoInstance) throw new Error("Pino instance is required for PinoLoggerAdapter");
520
+ this.pino = pinoInstance;
521
+ }
522
+ debug(message, ...args) {
523
+ this.pino.debug(this.format(message, ...args));
524
+ }
525
+ info(message, ...args) {
526
+ this.pino.info(this.format(message, ...args));
527
+ }
528
+ warn(message, ...args) {
529
+ this.pino.warn(this.format(message, ...args));
530
+ }
531
+ error(message, ...args) {
532
+ this.pino.error(this.format(message, ...args));
533
+ }
534
+ trace(message, ...args) {
535
+ this.pino.trace(this.format(message, ...args));
536
+ }
537
+ fatal(message, ...args) {
538
+ this.pino.fatal(this.format(message, ...args));
539
+ }
540
+ format(message, ...args) {
541
+ if (args.length === 0) return { msg: message };
542
+ if (args.length === 1 && typeof args[0] === "object" && args[0] !== null) return {
543
+ ...args[0],
544
+ msg: message
545
+ };
546
+ return {
547
+ msg: message,
548
+ args
549
+ };
550
+ }
551
+ };
552
+
553
+ //#endregion
554
+ //#region src/composables/useLogger/adapters/v0.ts
555
+ /**
556
+ * Vuetify0.x logger adapter implementation
557
+ *
558
+ * This adapter provides console-based logging with proper formatting,
559
+ * color coding, timestamps, and log level filtering for development
560
+ * and production environments.
561
+ */
562
+ var Vuetify0LoggerAdapter = class {
563
+ prefix;
564
+ colors;
565
+ timestamps;
566
+ constructor(options = {}) {
567
+ this.prefix = options.prefix || "v0";
568
+ this.colors = options.colors !== false;
569
+ this.timestamps = options.timestamps !== false;
570
+ }
571
+ debug(message, ...args) {
572
+ this.log("debug", "debug", message, ...args);
573
+ }
574
+ info(message, ...args) {
575
+ this.log("info", "info", message, ...args);
576
+ }
577
+ warn(message, ...args) {
578
+ this.log("warn", "warn", message, ...args);
579
+ }
580
+ error(message, ...args) {
581
+ this.log("error", "error", message, ...args);
582
+ }
583
+ trace(message, ...args) {
584
+ this.log("trace", "trace", message, ...args);
585
+ }
586
+ fatal(message, ...args) {
587
+ this.log("fatal", "error", message, ...args);
588
+ }
589
+ format(level, message, ...args) {
590
+ const timestamp = this.timestamps ? this.timestamp() : "";
591
+ const prefixTag = `[${this.prefix} ${level.toLowerCase()}]`;
592
+ const formattedMessage = [
593
+ timestamp,
594
+ prefixTag,
595
+ message
596
+ ].filter(Boolean).join(" ");
597
+ return [formattedMessage, ...args];
598
+ }
599
+ timestamp() {
600
+ if (!IN_BROWSER) return (/* @__PURE__ */ new Date()).toISOString();
601
+ const now$1 = /* @__PURE__ */ new Date();
602
+ return now$1.toTimeString().split(" ")[0];
603
+ }
604
+ style(level) {
605
+ if (!this.colors || !IN_BROWSER) return "";
606
+ const styles = {
607
+ trace: "color: #64748b",
608
+ debug: "color: #3b82f6",
609
+ info: "color: #10b981",
610
+ warn: "color: #f59e0b",
611
+ error: "color: #ef4444",
612
+ fatal: "color: #dc2626; font-weight: bold",
613
+ silent: ""
614
+ };
615
+ return styles[level] || "";
616
+ }
617
+ log(level, method, message, ...args) {
618
+ const [formattedMessage, ...restArgs] = this.format(level, message, ...args);
619
+ const style = this.style(level);
620
+ if (IN_BROWSER && style && typeof console[method] === "function") console[method](`%c${formattedMessage}`, style, ...restArgs);
621
+ else if (typeof console[method] === "function") console[method](formattedMessage, ...restArgs);
622
+ }
623
+ };
624
+
625
+ //#endregion
626
+ //#region src/composables/useLogger/index.ts
627
+ const [useLoggerContext, provideLoggerContext] = createContext("v0:logger");
628
+ /**
629
+ * Creates a logger context for application logging with configurable adapters and levels.
630
+ * This function provides a consistent logging interface that can be configured with
631
+ * different adapters and optimized for production builds with conditional compilation.
632
+ *
633
+ * @param options Configuration for the logger adapter, level, and behavior.
634
+ * @returns A logger context object with logging methods and controls.
635
+ */
636
+ function createLogger(options = {}) {
637
+ const { adapter = new Vuetify0LoggerAdapter({ prefix: options.prefix }), level: initialLevel = "info", enabled: initialEnabled = __LOGGER_ENABLED__ } = options;
638
+ const currentLevel = shallowRef(initialLevel);
639
+ const isEnabled = shallowRef(initialEnabled);
640
+ function value(level$1) {
641
+ const levels = {
642
+ trace: 0,
643
+ debug: 1,
644
+ info: 2,
645
+ warn: 3,
646
+ error: 4,
647
+ fatal: 5,
648
+ silent: 6
649
+ };
650
+ return levels[level$1] ?? 2;
651
+ }
652
+ function can(level$1) {
653
+ if (!isEnabled.value) return false;
654
+ return value(level$1) >= value(currentLevel.value);
655
+ }
656
+ function format(message) {
657
+ return message;
658
+ }
659
+ function debug(message, ...args) {
660
+ if (can("debug")) adapter.debug(format(message), ...args);
661
+ }
662
+ function info(message, ...args) {
663
+ if (can("info")) adapter.info(format(message), ...args);
664
+ }
665
+ function warn(message, ...args) {
666
+ if (can("warn")) adapter.warn(format(message), ...args);
667
+ }
668
+ function error(message, ...args) {
669
+ if (can("error")) adapter.error(format(message), ...args);
670
+ }
671
+ function trace(message, ...args) {
672
+ if (can("trace")) adapter.trace?.(format(message), ...args);
673
+ }
674
+ function fatal(message, ...args) {
675
+ if (can("fatal")) adapter.fatal?.(format(message), ...args);
676
+ }
677
+ function level(newLevel) {
678
+ currentLevel.value = newLevel;
679
+ }
680
+ function current() {
681
+ return currentLevel.value;
682
+ }
683
+ function enabled() {
684
+ return isEnabled.value;
685
+ }
686
+ function enable() {
687
+ isEnabled.value = true;
688
+ }
689
+ function disable() {
690
+ isEnabled.value = false;
691
+ }
692
+ return {
693
+ debug,
694
+ info,
695
+ warn,
696
+ error,
697
+ trace,
698
+ fatal,
699
+ level,
700
+ current,
701
+ enabled,
702
+ enable,
703
+ disable
704
+ };
705
+ }
706
+ function createFallbackLogger(namespace = "v0:logger") {
707
+ function format(message, type) {
708
+ return `[${namespace} ${type}] ${message}`;
709
+ }
710
+ return {
711
+ debug: (message, ...args) => console.log(format(message, "debug"), ...args),
712
+ info: (message, ...args) => console.log(format(message, "info"), ...args),
713
+ warn: (message, ...args) => console.log(format(message, "warn"), ...args),
714
+ error: (message, ...args) => console.log(format(message, "error"), ...args),
715
+ trace: (message, ...args) => console.log(format(message, "trace"), ...args),
716
+ fatal: (message, ...args) => console.log(format(message, "fatal"), ...args),
717
+ level: () => {},
718
+ current: () => "info",
719
+ enabled: () => true,
720
+ enable: () => {},
721
+ disable: () => {}
722
+ };
723
+ }
724
+ function useLogger(namespace) {
725
+ if (getCurrentInstance()) try {
726
+ return useLoggerContext(namespace);
727
+ } catch (error) {
728
+ if (process.env.NODE_ENV !== "production" && IN_BROWSER && namespace) console.warn(error);
729
+ }
730
+ return createFallbackLogger(namespace);
731
+ }
732
+ function createLoggerPlugin(options = {}) {
733
+ const context = createLogger(options);
734
+ return createPlugin({
735
+ namespace: "v0:logger",
736
+ provide: (app) => {
737
+ provideLoggerContext(context, app);
738
+ },
739
+ setup: (_app) => {
740
+ if (process.env.NODE_ENV !== "production" && IN_BROWSER) window.__v0Logger__ = context;
741
+ }
742
+ });
743
+ }
744
+
745
+ //#endregion
746
+ //#region src/composables/useRegistry/index.ts
747
+ /**
748
+ * Creates a registry for managing collections of items with registration and lookup capabilities.
749
+ * This function provides the foundation for item management systems with ID-based, value-based,
750
+ * and index-based access patterns.
751
+ *
752
+ * @param options Optional configuration for enabling events.
753
+ * @template Z The type of items managed by the registry.
754
+ * @template E The type of the registry context.
755
+ * @returns The registry context object.
756
+ */
757
+ function useRegistry(options) {
758
+ const logger = useLogger();
759
+ const collection = /* @__PURE__ */ new Map();
760
+ const catalog = /* @__PURE__ */ new Map();
761
+ const directory = /* @__PURE__ */ new Map();
762
+ const cache = /* @__PURE__ */ new Map();
763
+ const listeners = /* @__PURE__ */ new Map();
764
+ function emit(event, data) {
765
+ if (!options?.events) return;
766
+ const cbs = listeners.get(event);
767
+ if (!cbs) return;
768
+ for (const cb of cbs) cb(data);
769
+ }
770
+ function on(event, cb) {
771
+ if (!listeners.has(event)) listeners.set(event, /* @__PURE__ */ new Set());
772
+ listeners.get(event).add(cb);
773
+ }
774
+ function off(event, cb) {
775
+ listeners.get(event)?.delete(cb);
776
+ }
777
+ function dispose() {
778
+ if (listeners.size > 0) listeners.clear();
779
+ clear();
780
+ }
781
+ function get(id) {
782
+ return collection.get(id);
783
+ }
784
+ function browse(value) {
785
+ return catalog.get(value);
786
+ }
787
+ function lookup(index) {
788
+ return directory.get(index);
789
+ }
790
+ function has(id) {
791
+ return collection.has(id);
792
+ }
793
+ function assign(value, id) {
794
+ const bucket = catalog.get(value);
795
+ if (bucket) {
796
+ if (isArray(bucket)) {
797
+ if (!bucket.includes(id)) bucket.push(id);
798
+ } else if (bucket !== id) catalog.set(value, [bucket, id]);
799
+ } else catalog.set(value, id);
800
+ }
801
+ function unassign(value, id) {
802
+ const bucket = catalog.get(value);
803
+ if (!bucket) return;
804
+ if (isArray(bucket)) {
805
+ const next = bucket.filter((v) => v !== id);
806
+ if (next.length === 0) catalog.delete(value);
807
+ else if (next.length === 1) catalog.set(value, next[0]);
808
+ else catalog.set(value, next);
809
+ } else if (bucket === id) catalog.delete(value);
810
+ }
811
+ function keys() {
812
+ const cached = cache.get("keys");
813
+ if (cached != void 0) return cached;
814
+ const keys$1 = Array.from(collection.keys());
815
+ cache.set("keys", keys$1);
816
+ return keys$1;
817
+ }
818
+ function values() {
819
+ const cached = cache.get("values");
820
+ if (cached != void 0) return cached;
821
+ const values$1 = Array.from(collection.values());
822
+ cache.set("values", values$1);
823
+ return values$1;
824
+ }
825
+ function entries() {
826
+ const cached = cache.get("entries");
827
+ if (cached != void 0) return cached;
828
+ const entries$1 = Array.from(collection.entries());
829
+ cache.set("entries", entries$1);
830
+ return entries$1;
831
+ }
832
+ function clear() {
833
+ if (collection.size > 0) collection.clear();
834
+ if (catalog.size > 0) catalog.clear();
835
+ if (directory.size > 0) directory.clear();
836
+ invalidate();
837
+ }
838
+ function invalidate() {
839
+ if (cache.size === 0) return;
840
+ cache.clear();
841
+ }
842
+ function reindex() {
843
+ if (catalog.size > 0) catalog.clear();
844
+ if (directory.size > 0) directory.clear();
845
+ let index = 0;
846
+ for (const item of values()) {
847
+ if (item.index !== index) {
848
+ item.index = index;
849
+ if (item.valueIsIndex) item.value = index;
850
+ }
851
+ directory.set(index, item.id);
852
+ assign(item.value, item.id);
853
+ index++;
854
+ }
855
+ invalidate();
856
+ }
857
+ function register(registration = {}) {
858
+ const size = collection.size;
859
+ const id = registration.id ?? genId();
860
+ if (has(id)) {
861
+ logger.warn(`Item with id "${id}" already exists in the registry. Skipping registration.`);
862
+ return get(id);
863
+ }
864
+ const item = {
865
+ ...registration,
866
+ id,
867
+ index: registration.index ?? size,
868
+ value: registration.value ?? size,
869
+ valueIsIndex: registration.valueIsIndex ?? registration.value == null
870
+ };
871
+ collection.set(item.id, item);
872
+ directory.set(item.index, item.id);
873
+ assign(item.value, item.id);
874
+ invalidate();
875
+ emit("register", item);
876
+ return item;
877
+ }
878
+ function unregister(id) {
879
+ const item = collection.get(id);
880
+ if (!item) return;
881
+ collection.delete(item.id);
882
+ directory.delete(item.index);
883
+ unassign(item.value, item.id);
884
+ emit("unregister", item);
885
+ reindex();
886
+ }
887
+ return {
888
+ collection,
889
+ emit,
890
+ on,
891
+ off,
892
+ dispose,
893
+ has,
894
+ keys,
895
+ clear,
896
+ browse,
897
+ entries,
898
+ values,
899
+ lookup,
900
+ get,
901
+ register,
902
+ unregister,
903
+ reindex,
904
+ onboard(registrations) {
905
+ return registrations.map((registration) => this.register(registration));
906
+ },
907
+ get size() {
908
+ return collection.size;
909
+ }
910
+ };
911
+ }
912
+
913
+ //#endregion
914
+ //#region src/composables/useSelection/index.ts
915
+ /**
916
+ * Creates a selection context for managing collections of selectable items.
917
+ * This function extends the registry functionality with selection state management.
918
+ *
919
+ * @param options Optional configuration for selection behavior.
920
+ * @template Z The type of items managed by the selection.
921
+ * @template E The type of the selection context.
922
+ * @returns The selection context object.
923
+ */
924
+ function useSelection(options) {
925
+ const registry = useRegistry(options);
926
+ const selectedIds = shallowReactive(/* @__PURE__ */ new Set());
927
+ const enroll = options?.enroll ?? false;
928
+ const mandatory = options?.mandatory ?? false;
929
+ const selectedItems = computed(() => {
930
+ return new Set(Array.from(selectedIds).map((id) => registry.get(id)));
931
+ });
932
+ const selectedValues = computed(() => {
933
+ return new Set(Array.from(selectedItems.value).map((item) => item?.value));
934
+ });
935
+ function mandate() {
936
+ if (!mandatory || registry.selectedIds.size > 0 || registry.size === 0) return;
937
+ select(registry.lookup(0));
938
+ }
939
+ function select(id) {
940
+ const item = registry.get(id);
941
+ if (!item || item.disabled) return;
942
+ selectedIds.add(id);
943
+ }
944
+ function unselect(id) {
945
+ if (mandatory && selectedIds.size === 1) return;
946
+ selectedIds.delete(id);
947
+ }
948
+ function toggle(id) {
949
+ if (selectedIds.has(id)) unselect(id);
950
+ else select(id);
951
+ }
952
+ function register(registration = {}) {
953
+ const id = registration.id ?? genId();
954
+ const item = {
955
+ disabled: false,
956
+ ...registration,
957
+ id,
958
+ isActive: toRef(() => selectedIds.has(id)),
959
+ select: () => select(id),
960
+ unselect: () => unselect(id),
961
+ toggle: () => toggle(id)
962
+ };
963
+ const ticket = registry.register(item);
964
+ if (enroll && !item.disabled) selectedIds.add(ticket.id);
965
+ if (mandatory === "force") mandate();
966
+ return ticket;
967
+ }
968
+ function unregister(id) {
969
+ selectedIds.delete(id);
970
+ registry.unregister(id);
971
+ }
972
+ function reset() {
973
+ registry.clear();
974
+ registry.reindex();
975
+ registry.mandate();
976
+ }
977
+ return {
978
+ ...registry,
979
+ selectedIds,
980
+ selectedItems,
981
+ selectedValues,
982
+ register,
983
+ unregister,
984
+ reset,
985
+ mandate,
986
+ select,
987
+ unselect,
988
+ toggle
989
+ };
990
+ }
991
+
992
+ //#endregion
993
+ //#region src/utilities/benchmark.ts
994
+ function now() {
995
+ if (typeof performance !== "undefined") return performance.now();
996
+ return Date.now();
997
+ }
998
+ async function run(name, fn, samples = 100) {
999
+ if (!(process.env.NODE_ENV !== "production")) {
1000
+ fn();
1001
+ return {
1002
+ name,
1003
+ duration: 0,
1004
+ ops: Infinity
1005
+ };
1006
+ }
1007
+ const times = [];
1008
+ for (let i = 0; i < 5; i++) fn();
1009
+ for (let i = 0; i < samples; i++) {
1010
+ const start = now();
1011
+ fn();
1012
+ times.push(now() - start);
1013
+ }
1014
+ const duration = times.reduce((a, b) => a + b, 0) / times.length;
1015
+ const ops = Math.round(1e3 / duration);
1016
+ return {
1017
+ name,
1018
+ duration,
1019
+ ops
1020
+ };
1021
+ }
1022
+
1023
+ //#endregion
1024
+ //#region src/transformers/toArray/index.ts
1025
+ /* @__NO_SIDE_EFFECTS__ */
1026
+ function toArray(value) {
1027
+ return isNullOrUndefined(value) ? [] : Array.isArray(value) ? value : [value];
1028
+ }
1029
+
1030
+ //#endregion
1031
+ //#region src/transformers/toReactive/index.ts
1032
+ /**
1033
+ * Converts an object to a reactive reference using Vue's reactivity system.
1034
+ * This function creates a reactive version of the provided object,
1035
+ * making its properties automatically track dependencies and trigger re-renders
1036
+ * when they change.
1037
+ *
1038
+ * @param objectRef - A reference to an object that should be made reactive.
1039
+ * @template Z The type of the object that extends object.
1040
+ * @returns A reactive reference to the object.
1041
+ */
1042
+ function toReactive(objectRef) {
1043
+ if (!isRef(objectRef)) return reactive(objectRef);
1044
+ const target = objectRef.value;
1045
+ if (target instanceof Map) {
1046
+ const mapProxy = new Proxy(/* @__PURE__ */ new Map(), { get(_, p) {
1047
+ const map = objectRef.value;
1048
+ if (p === "get") return (key) => unref(map.get(key));
1049
+ if (p === "set") return (key, value) => {
1050
+ const existingValue = map.get(key);
1051
+ if (isRef(existingValue)) existingValue.value = unref(value);
1052
+ else map.set(key, value);
1053
+ return mapProxy;
1054
+ };
1055
+ if (p === "has") return (key) => map.has(key);
1056
+ if (p === "delete") return (key) => map.delete(key);
1057
+ if (p === "clear") return () => map.clear();
1058
+ if (p === "size") return map.size;
1059
+ if (p === "keys") return () => map.keys();
1060
+ if (p === "values") return function* () {
1061
+ for (const value of map.values()) yield unref(value);
1062
+ };
1063
+ if (p === "entries") return function* () {
1064
+ for (const [key, value] of map.entries()) yield [key, unref(value)];
1065
+ };
1066
+ if (p === "forEach") return (callback, thisArg) => {
1067
+ for (const [key, value] of map.entries()) callback.call(thisArg, unref(value), key, mapProxy);
1068
+ };
1069
+ if (p === Symbol.iterator) return function* () {
1070
+ for (const [key, value] of map.entries()) yield [key, unref(value)];
1071
+ };
1072
+ return Reflect.get(map, p);
1073
+ } });
1074
+ return reactive(mapProxy);
1075
+ }
1076
+ if (target instanceof Set) {
1077
+ const setProxy = new Proxy(/* @__PURE__ */ new Set(), { get(_, p) {
1078
+ const set = objectRef.value;
1079
+ if (p === "add") return (value) => {
1080
+ set.add(value);
1081
+ return setProxy;
1082
+ };
1083
+ if (p === "has") return (value) => set.has(value);
1084
+ if (p === "delete") return (value) => set.delete(value);
1085
+ if (p === "clear") return () => set.clear();
1086
+ if (p === "size") return set.size;
1087
+ if (p === "keys" || p === "values") return function* () {
1088
+ for (const value of set.values()) yield unref(value);
1089
+ };
1090
+ if (p === "entries") return function* () {
1091
+ for (const value of set.values()) {
1092
+ const unreffedValue = unref(value);
1093
+ yield [unreffedValue, unreffedValue];
1094
+ }
1095
+ };
1096
+ if (p === "forEach") return (callback, thisArg) => {
1097
+ for (const value of set) {
1098
+ const unreffedValue = unref(value);
1099
+ callback.call(thisArg, unreffedValue, unreffedValue, setProxy);
1100
+ }
1101
+ };
1102
+ if (p === Symbol.iterator) return function* () {
1103
+ for (const value of set.values()) yield unref(value);
1104
+ };
1105
+ return Reflect.get(set, p);
1106
+ } });
1107
+ return reactive(setProxy);
1108
+ }
1109
+ const proxy = new Proxy({}, {
1110
+ get(_, p, receiver) {
1111
+ return unref(Reflect.get(objectRef.value, p, receiver));
1112
+ },
1113
+ set(_, p, value) {
1114
+ const currentTarget = objectRef.value;
1115
+ currentTarget[p] = value;
1116
+ return true;
1117
+ },
1118
+ deleteProperty(_, p) {
1119
+ return Reflect.deleteProperty(objectRef.value, p);
1120
+ },
1121
+ has(_, p) {
1122
+ return Reflect.has(objectRef.value, p);
1123
+ },
1124
+ ownKeys() {
1125
+ return Object.keys(objectRef.value);
1126
+ },
1127
+ getOwnPropertyDescriptor(_, p) {
1128
+ const desc = Reflect.getOwnPropertyDescriptor(objectRef.value, p);
1129
+ if (!desc) return void 0;
1130
+ const newDesc = {
1131
+ ...desc,
1132
+ configurable: true
1133
+ };
1134
+ if ("value" in newDesc) newDesc.value = unref(newDesc.value);
1135
+ return newDesc;
1136
+ }
1137
+ });
1138
+ return reactive(proxy);
1139
+ }
1140
+
1141
+ //#endregion
1142
+ //#region src/composables/useGroup/index.ts
1143
+ /**
1144
+ * Creates a group selection context for managing collections of items where multiple selections can be made.
1145
+ * This function extends the selection functionality with group selection capabilities.
1146
+ *
1147
+ * @param options Optional configuration for group selection behavior.
1148
+ * @template Z The type of items managed by the group selection.
1149
+ * @template E The type of the group selection context.
1150
+ * @returns The group selection context object.
1151
+ */
1152
+ function useGroup(options) {
1153
+ const registry = useSelection(options);
1154
+ const selectedIndexes = computed(() => {
1155
+ return new Set(Array.from(registry.selectedItems.value).map((item) => item?.index));
1156
+ });
1157
+ function select(ids) {
1158
+ for (const id of toArray(ids)) registry.select(id);
1159
+ }
1160
+ function unselect(ids) {
1161
+ for (const id of toArray(ids)) registry.unselect(id);
1162
+ }
1163
+ function toggle(ids) {
1164
+ for (const id of toArray(ids)) registry.toggle(id);
1165
+ }
1166
+ return {
1167
+ ...registry,
1168
+ select,
1169
+ unselect,
1170
+ toggle,
1171
+ selectedIndexes
1172
+ };
1173
+ }
1174
+
1175
+ //#endregion
1176
+ //#region src/components/Group/GroupItem.vue?vue&type=script&setup=true&lang.ts
1177
+ var GroupItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1178
+ name: "GroupItem",
1179
+ __name: "GroupItem",
1180
+ props: {
1181
+ id: { default: () => useId() },
1182
+ value: {},
1183
+ disabled: { type: Boolean },
1184
+ namespace: { default: "group" }
1185
+ },
1186
+ setup(__props) {
1187
+ const [useGroupContext] = useGroup(__props.namespace);
1188
+ const group = useGroupContext();
1189
+ if (!group) throw new Error(`Failed to get group context at namespace "${__props.namespace}"`);
1190
+ const { isActive, toggle, index } = group.register({
1191
+ id: __props.id,
1192
+ value: __props.value,
1193
+ disabled: __props.disabled
1194
+ });
1195
+ onUnmounted(() => {
1196
+ group.unregister(__props.id);
1197
+ });
1198
+ return (_ctx, _cache) => {
1199
+ return renderSlot(_ctx.$slots, "default", {
1200
+ index: unref(index),
1201
+ isActive: unref(isActive),
1202
+ toggle: unref(toggle)
1203
+ });
1204
+ };
1205
+ }
1206
+ });
1207
+
1208
+ //#endregion
1209
+ //#region src/components/Group/GroupItem.vue
1210
+ var GroupItem_default = GroupItem_vue_vue_type_script_setup_true_lang_default;
1211
+
1212
+ //#endregion
1213
+ //#region src/components/Group/GroupRoot.vue?vue&type=script&setup=true&lang.ts
1214
+ var GroupRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1215
+ name: "GroupRoot",
1216
+ __name: "GroupRoot",
1217
+ props: /* @__PURE__ */ mergeModels({
1218
+ namespace: { default: "group" },
1219
+ enroll: { type: Boolean },
1220
+ mandatory: { type: [Boolean, String] },
1221
+ events: { type: Boolean }
1222
+ }, {
1223
+ "modelValue": {},
1224
+ "modelModifiers": {}
1225
+ }),
1226
+ emits: ["update:modelValue"],
1227
+ setup(__props) {
1228
+ const props = createPropsRestProxy(__props, ["namespace"]);
1229
+ const model = useModel(__props, "modelValue");
1230
+ const [, provideGroupContext] = useGroup(__props.namespace, props);
1231
+ const { register, unregister, reset, mandate, select } = provideGroupContext(model);
1232
+ return (_ctx, _cache) => {
1233
+ return renderSlot(_ctx.$slots, "default", {
1234
+ mandate: unref(mandate),
1235
+ model: model.value,
1236
+ register: unref(register),
1237
+ reset: unref(reset),
1238
+ select: unref(select),
1239
+ unregister: unref(unregister)
1240
+ });
1241
+ };
1242
+ }
1243
+ });
1244
+
1245
+ //#endregion
1246
+ //#region src/components/Group/GroupRoot.vue
1247
+ var GroupRoot_default = GroupRoot_vue_vue_type_script_setup_true_lang_default;
1248
+
1249
+ //#endregion
1250
+ //#region src/components/Group/index.ts
1251
+ const Group = {
1252
+ Item: GroupItem_default,
1253
+ Root: GroupRoot_default
1254
+ };
1255
+
1256
+ //#endregion
1257
+ //#region src/components/Hydration/Hydration.vue?vue&type=script&setup=true&lang.ts
1258
+ var Hydration_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1259
+ name: "Hydration",
1260
+ __name: "Hydration",
1261
+ setup(__props) {
1262
+ const hydrationContext = useHydration();
1263
+ return (_ctx, _cache) => {
1264
+ return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(hydrationContext))));
1265
+ };
1266
+ }
1267
+ });
1268
+
1269
+ //#endregion
1270
+ //#region src/components/Hydration/Hydration.vue
1271
+ var Hydration_default = Hydration_vue_vue_type_script_setup_true_lang_default;
1272
+
1273
+ //#endregion
1274
+ //#region src/components/Hydration/HydrationRoot.vue?vue&type=script&setup=true&lang.ts
1275
+ var HydrationRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1276
+ name: "HydrationRoot",
1277
+ __name: "HydrationRoot",
1278
+ setup(__props) {
1279
+ const hydrationContext = createHydration();
1280
+ provideHydrationContext(hydrationContext);
1281
+ return (_ctx, _cache) => {
1282
+ return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(hydrationContext))));
1283
+ };
1284
+ }
1285
+ });
1286
+
1287
+ //#endregion
1288
+ //#region src/components/Hydration/HydrationRoot.vue
1289
+ var HydrationRoot_default = HydrationRoot_vue_vue_type_script_setup_true_lang_default;
1290
+
1291
+ //#endregion
1292
+ //#region src/components/Popover/PopoverRoot.vue?vue&type=script&setup=true&lang.ts
1293
+ const [usePopoverContext, providePopoverContext] = createContext("Popover");
1294
+ var PopoverRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1295
+ name: "PopoverRoot",
1296
+ __name: "PopoverRoot",
1297
+ props: /* @__PURE__ */ mergeModels({
1298
+ id: {},
1299
+ as: { default: null },
1300
+ renderless: { type: Boolean }
1301
+ }, {
1302
+ "modelValue": {
1303
+ type: Boolean,
1304
+ default: false
1305
+ },
1306
+ "modelModifiers": {}
1307
+ }),
1308
+ emits: ["update:modelValue"],
1309
+ setup(__props) {
1310
+ const props = createPropsRestProxy(__props, ["as"]);
1311
+ const isActive = useModel(__props, "modelValue");
1312
+ const id = toRef(() => props.id ?? useId());
1313
+ function toggle() {
1314
+ isActive.value = !isActive.value;
1315
+ }
1316
+ const bindableProps = toRef(() => ({
1317
+ id,
1318
+ isActive,
1319
+ toggle
1320
+ }));
1321
+ providePopoverContext({
1322
+ isActive,
1323
+ toggle,
1324
+ id: id.value
1325
+ });
1326
+ return (_ctx, _cache) => {
1327
+ return openBlock(), createBlock(unref(Atom_default), mergeProps({
1328
+ as: _ctx.as,
1329
+ renderless: _ctx.renderless
1330
+ }, bindableProps.value), {
1331
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(bindableProps.value)))]),
1332
+ _: 3
1333
+ }, 16, ["as", "renderless"]);
1334
+ };
1335
+ }
1336
+ });
1337
+
1338
+ //#endregion
1339
+ //#region src/components/Popover/PopoverRoot.vue
1340
+ var PopoverRoot_default = PopoverRoot_vue_vue_type_script_setup_true_lang_default;
1341
+
1342
+ //#endregion
1343
+ //#region src/components/Popover/PopoverAnchor.vue?vue&type=script&setup=true&lang.ts
1344
+ var PopoverAnchor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1345
+ name: "PopoverAnchor",
1346
+ __name: "PopoverAnchor",
1347
+ props: {
1348
+ target: {},
1349
+ as: { default: "button" },
1350
+ renderless: { type: Boolean }
1351
+ },
1352
+ setup(__props) {
1353
+ const props = createPropsRestProxy(__props, ["as"]);
1354
+ const context = usePopoverContext();
1355
+ const popovertarget = toRef(() => props.target ?? context.id);
1356
+ const style = toRef(() => ({ anchorName: `--${popovertarget.value}` }));
1357
+ return (_ctx, _cache) => {
1358
+ return openBlock(), createBlock(unref(Atom_default), {
1359
+ as: _ctx.as,
1360
+ "data-popover-open": unref(context).isActive.value ? "" : void 0,
1361
+ popovertarget: popovertarget.value,
1362
+ style: normalizeStyle(style.value),
1363
+ type: _ctx.as === "button" ? "button" : void 0
1364
+ }, {
1365
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1366
+ _: 3
1367
+ }, 8, [
1368
+ "as",
1369
+ "data-popover-open",
1370
+ "popovertarget",
1371
+ "style",
1372
+ "type"
1373
+ ]);
1374
+ };
1375
+ }
1376
+ });
1377
+
1378
+ //#endregion
1379
+ //#region src/components/Popover/PopoverAnchor.vue
1380
+ var PopoverAnchor_default = PopoverAnchor_vue_vue_type_script_setup_true_lang_default;
1381
+
1382
+ //#endregion
1383
+ //#region src/components/Popover/PopoverContent.vue?vue&type=script&setup=true&lang.ts
1384
+ var PopoverContent_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1385
+ name: "PopoverContent",
1386
+ __name: "PopoverContent",
1387
+ props: {
1388
+ id: {},
1389
+ positionArea: { default: "bottom" },
1390
+ positionTry: { default: "most-width bottom" },
1391
+ as: {},
1392
+ renderless: { type: Boolean }
1393
+ },
1394
+ emits: ["beforetoggle"],
1395
+ setup(__props, { emit: __emit }) {
1396
+ const props = createPropsRestProxy(__props, ["positionArea", "positionTry"]);
1397
+ const emit = __emit;
1398
+ const context = usePopoverContext();
1399
+ const ref$1 = useTemplateRef("ref");
1400
+ const id = toRef(() => props.id ?? context.id);
1401
+ const style = toRef(() => ({
1402
+ positionArea: __props.positionArea,
1403
+ positionAnchor: `--${id.value}`,
1404
+ positionTry: __props.positionTry
1405
+ }));
1406
+ onMounted(() => {
1407
+ if (context.isActive.value) ref$1.value?.element?.showPopover();
1408
+ });
1409
+ function onBeforeToggle(e) {
1410
+ context.isActive.value = e.newState === "open";
1411
+ emit("beforetoggle", e);
1412
+ }
1413
+ return (_ctx, _cache) => {
1414
+ return openBlock(), createBlock(unref(Atom_default), {
1415
+ id: id.value,
1416
+ ref_key: "ref",
1417
+ ref: ref$1,
1418
+ popover: "",
1419
+ style: normalizeStyle(style.value),
1420
+ onBeforetoggle: onBeforeToggle
1421
+ }, {
1422
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1423
+ _: 3
1424
+ }, 8, ["id", "style"]);
1425
+ };
1426
+ }
1427
+ });
1428
+
1429
+ //#endregion
1430
+ //#region src/components/Popover/PopoverContent.vue
1431
+ var PopoverContent_default = PopoverContent_vue_vue_type_script_setup_true_lang_default;
1432
+
1433
+ //#endregion
1434
+ //#region src/components/Popover/index.ts
1435
+ const Popover = {
1436
+ Root: PopoverRoot_default,
1437
+ Anchor: PopoverAnchor_default,
1438
+ Content: PopoverContent_default
1439
+ };
1440
+
1441
+ //#endregion
1442
+ //#region src/composables/useSingle/index.ts
1443
+ /**
1444
+ * Creates a single selection context for managing collections where only one item can be selected.
1445
+ * This function extends the selection functionality with single-selection constraints.
1446
+ *
1447
+ * @param options Optional configuration for single selection behavior.
1448
+ * @template Z The type of items managed by the single selection.
1449
+ * @template E The type of the single selection context.
1450
+ * @returns The single selection context object.
1451
+ */
1452
+ function useSingle(options) {
1453
+ const registry = useSelection(options);
1454
+ const mandatory = options?.mandatory ?? true;
1455
+ const selectedId = computed(() => registry.selectedIds.values().next().value);
1456
+ const selectedItem = computed(() => registry.selectedItems.value.values().next().value);
1457
+ const selectedIndex = computed(() => selectedItem.value?.index ?? -1);
1458
+ const selectedValue = computed(() => selectedItem.value?.value);
1459
+ function select(id) {
1460
+ const item = registry.get(id);
1461
+ if (!item || item.disabled) return;
1462
+ registry.selectedIds.clear();
1463
+ registry.selectedIds.add(id);
1464
+ }
1465
+ function unselect(id) {
1466
+ if (mandatory && registry.selectedIds.size === 1) return;
1467
+ registry.selectedIds.delete(id);
1468
+ }
1469
+ function toggle(id) {
1470
+ if (registry.selectedIds.has(id)) unselect(id);
1471
+ else select(id);
1472
+ }
1473
+ return {
1474
+ ...registry,
1475
+ selectedId,
1476
+ selectedItem,
1477
+ selectedIndex,
1478
+ selectedValue,
1479
+ select,
1480
+ unselect,
1481
+ toggle
1482
+ };
1483
+ }
1484
+
1485
+ //#endregion
1486
+ //#region src/composables/useStep/index.ts
1487
+ /**
1488
+ * Creates a step selection context for managing collections where users can navigate through items sequentially.
1489
+ * This function extends the single selection functionality with stepping navigation.
1490
+ *
1491
+ * @param options Optional configuration for step behavior.
1492
+ * @template Z The type of items managed by the step selection.
1493
+ * @template E The type of the step selection context.
1494
+ * @returns The step selection context object.
1495
+ */
1496
+ function useStep(options) {
1497
+ const registry = useSingle(options);
1498
+ function first() {
1499
+ if (registry.size === 0) return;
1500
+ registry.selectedIds.clear();
1501
+ registry.select(registry.lookup(0));
1502
+ }
1503
+ function last() {
1504
+ const size = registry.size;
1505
+ if (size === 0) return;
1506
+ registry.selectedIds.clear();
1507
+ registry.select(registry.lookup(size - 1));
1508
+ }
1509
+ function next() {
1510
+ step(1);
1511
+ }
1512
+ function prev() {
1513
+ step(-1);
1514
+ }
1515
+ function wrapped(length, index) {
1516
+ return (index + length) % length;
1517
+ }
1518
+ function step(count = 1) {
1519
+ const length = registry.size;
1520
+ if (!length) return;
1521
+ const direction = Math.sign(count || 1);
1522
+ let hops = 0;
1523
+ let index = wrapped(length, registry.selectedIndex.value + count);
1524
+ let id = registry.lookup(index);
1525
+ while (id !== void 0 && registry.get(id)?.disabled && hops < length) {
1526
+ index = wrapped(length, index + direction);
1527
+ id = registry.lookup(index);
1528
+ hops++;
1529
+ }
1530
+ if (id === void 0 || hops === length) return;
1531
+ registry.selectedIds.clear();
1532
+ registry.select(id);
1533
+ }
1534
+ return {
1535
+ ...registry,
1536
+ first,
1537
+ last,
1538
+ next,
1539
+ prev,
1540
+ step
1541
+ };
1542
+ }
1543
+
1544
+ //#endregion
1545
+ //#region src/components/Step/StepItem.vue?vue&type=script&setup=true&lang.ts
1546
+ var StepItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1547
+ name: "StepItem",
1548
+ __name: "StepItem",
1549
+ props: {
1550
+ id: { default: () => useId() },
1551
+ value: {},
1552
+ disabled: { type: Boolean },
1553
+ namespace: { default: "step" }
1554
+ },
1555
+ setup(__props) {
1556
+ const [useStepContext] = useStep(__props.namespace);
1557
+ const step = useStepContext();
1558
+ if (!step) throw new Error(`Failed to get step context at namespace "${__props.namespace}"`);
1559
+ const { index, isActive, toggle } = step.register({
1560
+ id: __props.id,
1561
+ value: __props.value,
1562
+ disabled: __props.disabled
1563
+ });
1564
+ onUnmounted(() => {
1565
+ step.unregister(__props.id);
1566
+ });
1567
+ return (_ctx, _cache) => {
1568
+ return renderSlot(_ctx.$slots, "default", {
1569
+ index: unref(index),
1570
+ isActive: unref(isActive),
1571
+ toggle: unref(toggle)
1572
+ });
1573
+ };
1574
+ }
1575
+ });
1576
+
1577
+ //#endregion
1578
+ //#region src/components/Step/StepItem.vue
1579
+ var StepItem_default = StepItem_vue_vue_type_script_setup_true_lang_default;
1580
+
1581
+ //#endregion
1582
+ //#region src/components/Step/StepRoot.vue?vue&type=script&setup=true&lang.ts
1583
+ var StepRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1584
+ name: "StepRoot",
1585
+ __name: "StepRoot",
1586
+ props: /* @__PURE__ */ mergeModels({
1587
+ namespace: { default: "step" },
1588
+ enroll: { type: Boolean },
1589
+ mandatory: { type: [Boolean, String] },
1590
+ events: { type: Boolean }
1591
+ }, {
1592
+ "modelValue": {},
1593
+ "modelModifiers": {}
1594
+ }),
1595
+ emits: ["update:modelValue"],
1596
+ setup(__props) {
1597
+ const props = createPropsRestProxy(__props, ["namespace"]);
1598
+ const model = useModel(__props, "modelValue");
1599
+ const [, provideStepContext] = useStep(__props.namespace, props);
1600
+ const { register, unregister, reset, mandate, select, first, last, next, prev, step } = provideStepContext(model);
1601
+ return (_ctx, _cache) => {
1602
+ return renderSlot(_ctx.$slots, "default", {
1603
+ first: unref(first),
1604
+ last: unref(last),
1605
+ mandate: unref(mandate),
1606
+ model: model.value,
1607
+ next: unref(next),
1608
+ prev: unref(prev),
1609
+ register: unref(register),
1610
+ reset: unref(reset),
1611
+ select: unref(select),
1612
+ step: unref(step),
1613
+ unregister: unref(unregister)
1614
+ });
1615
+ };
1616
+ }
1617
+ });
1618
+
1619
+ //#endregion
1620
+ //#region src/components/Step/StepRoot.vue
1621
+ var StepRoot_default = StepRoot_vue_vue_type_script_setup_true_lang_default;
1622
+
1623
+ //#endregion
1624
+ //#region src/components/Step/index.ts
1625
+ const Step = {
1626
+ Item: StepItem_default,
1627
+ Root: StepRoot_default
1628
+ };
1629
+
1630
+ //#endregion
1631
+ //#region src/factories/createTrinity/index.ts
1632
+ /**
1633
+ * A tuple containing Vue's provide/inject and a context object
1634
+ * @param createContext The function that creates the context
1635
+ * @param provideContext The function that provides context
1636
+ * @param context The underlying context object singleton
1637
+ * @template Z The type parameter for the context value
1638
+ * @template E The vmodel type for the context state.
1639
+ * @returns [createContext, provideContext, context]
1640
+ *
1641
+ * @see https://0.vuetifyjs.com/composables/foundation/create-trinity
1642
+ */
1643
+ function createTrinity(createContext$1, provideContext, context) {
1644
+ return [
1645
+ createContext$1,
1646
+ (_context = context, app) => provideContext(_context, app),
1647
+ context
1648
+ ];
1649
+ }
1650
+
1651
+ //#endregion
1652
+ //#region src/composables/useTokens/index.ts
1653
+ /**
1654
+ * Creates a token registry for managing design token collections with alias resolution.
1655
+ * Returns the token context directly for simple usage.
1656
+ *
1657
+ * @param tokens A collection of tokens to initialize with
1658
+ * @template Z The structure of the registry token items.
1659
+ * @template E The available methods for the token's context.
1660
+ * @returns The token context object.
1661
+ */
1662
+ function useTokens(tokens = {}) {
1663
+ const logger = useLogger();
1664
+ const registry = useRegistry();
1665
+ const cache = /* @__PURE__ */ new Map();
1666
+ registry.onboard(flatten(tokens));
1667
+ function isAlias(token) {
1668
+ return isString(token) && token.length > 2 && token[0] === "{" && token.at(-1) === "}";
1669
+ }
1670
+ function isTokenAlias(value) {
1671
+ return isObject(value) && "$value" in value;
1672
+ }
1673
+ function resolve(token) {
1674
+ const cached = cache.get(token);
1675
+ if (cached !== void 0) return cached;
1676
+ const reference = isTokenAlias(token) ? token.$value : token;
1677
+ const cleaned = isAlias(reference) ? reference.slice(1, -1) : reference;
1678
+ const found = registry.get(cleaned);
1679
+ if (found?.value === void 0) {
1680
+ logger.warn(`Alias not found for "${reference}"`);
1681
+ cache.set(token, void 0);
1682
+ return void 0;
1683
+ }
1684
+ let result;
1685
+ if (isTokenAlias(found.value)) result = resolve(found.value.$value);
1686
+ else if (isAlias(found.value)) result = resolve(found.value);
1687
+ else result = String(found.value);
1688
+ cache.set(token, result);
1689
+ return result;
1690
+ }
1691
+ return {
1692
+ ...registry,
1693
+ resolve
1694
+ };
1695
+ }
1696
+ /**
1697
+ * Creates a token registry context with full injection/provision control.
1698
+ * Returns the complete trinity for advanced usage scenarios.
1699
+ *
1700
+ * @param namespace The namespace for the token registry context
1701
+ * @param tokens An optional collection of tokens to initialize
1702
+ * @template Z The structure of the registry token items.
1703
+ * @template E The available methods for the token's context.
1704
+ * @returns A tuple containing the inject function, provide function, and the token context.
1705
+ */
1706
+ function createTokensContext(namespace, tokens = {}) {
1707
+ const [useTokensContext, _provideTokensContext] = createContext(namespace);
1708
+ const context = useTokens(tokens);
1709
+ function provideTokensContext(_context = context, app) {
1710
+ return _provideTokensContext(_context, app);
1711
+ }
1712
+ return createTrinity(useTokensContext, provideTokensContext, context);
1713
+ }
1714
+ /**
1715
+ * Flattens a nested collection of tokens into a flat array of tokens.
1716
+ * Each token is represented by an object containing its ID & value.
1717
+ * @param tokens The collection of tokens to flatten.
1718
+ * @param prefix An optional prefix to prepend to each token ID.
1719
+ * @returns An array of flattened tokens, each with an ID and value.
1720
+ */
1721
+ function flatten(tokens, prefix = "") {
1722
+ const flattened = [];
1723
+ const stack = [{
1724
+ tokens,
1725
+ prefix
1726
+ }];
1727
+ while (stack.length > 0) {
1728
+ const { tokens: currentTokens, prefix: currentPrefix } = stack.pop();
1729
+ for (const key in currentTokens) {
1730
+ const value = currentTokens[key];
1731
+ const id = currentPrefix ? `${currentPrefix}.${key}` : key;
1732
+ if (isPrimitive(value)) flattened.push({
1733
+ id,
1734
+ value: String(value)
1735
+ });
1736
+ else if (isObject(value) && "$value" in value) flattened.push({
1737
+ id,
1738
+ value
1739
+ });
1740
+ else if (isObject(value)) stack.push({
1741
+ tokens: value,
1742
+ prefix: id
1743
+ });
1744
+ }
1745
+ }
1746
+ return flattened;
1747
+ }
1748
+
1749
+ //#endregion
1750
+ //#region src/composables/useTheme/adapters/adapter.ts
1751
+ var ThemeAdapter = class {
1752
+ prefix;
1753
+ constructor(prefix) {
1754
+ this.prefix = prefix;
1755
+ }
1756
+ generate(colors) {
1757
+ let css = "";
1758
+ for (const theme in colors) {
1759
+ const themeColors = colors[theme];
1760
+ if (!themeColors) continue;
1761
+ const vars = Object.entries(themeColors).map(([key, val]) => ` --${this.prefix}-${key}: ${val};`).join("\n");
1762
+ css += `.${this.prefix}-theme--${theme} {\n${vars}\n}\n`;
1763
+ }
1764
+ return css;
1765
+ }
1766
+ };
1767
+
1768
+ //#endregion
1769
+ //#region src/composables/useTheme/adapters/v0.ts
1770
+ /**
1771
+ * Theme adapter implementation for Vuetify v0 design system.
1772
+ * This adapter generates CSS custom properties and injects them into the DOM
1773
+ * as a stylesheet, allowing themes to be applied globally.
1774
+ */
1775
+ var Vuetify0ThemeAdapter = class extends ThemeAdapter {
1776
+ cspNonce;
1777
+ stylesheetId = "v0-theme-stylesheet";
1778
+ constructor(options = {}) {
1779
+ super(options.prefix ?? "v0");
1780
+ this.cspNonce = options.cspNonce;
1781
+ this.stylesheetId = options.stylesheetId ?? this.stylesheetId;
1782
+ }
1783
+ update(colors) {
1784
+ if (!IN_BROWSER) return;
1785
+ this.upsert(this.generate(colors));
1786
+ }
1787
+ upsert(styles) {
1788
+ if (!IN_BROWSER) return;
1789
+ let styleEl = document.querySelector(`#${this.stylesheetId}`);
1790
+ if (!styleEl) {
1791
+ styleEl = document.createElement("style");
1792
+ styleEl.id = this.stylesheetId.startsWith("#") ? this.stylesheetId.slice(1) : this.stylesheetId;
1793
+ if (this.cspNonce) styleEl.setAttribute("nonce", this.cspNonce);
1794
+ document.head.append(styleEl);
1795
+ }
1796
+ styleEl.textContent = styles;
1797
+ }
1798
+ };
1799
+
1800
+ //#endregion
1801
+ //#region src/composables/useTheme/index.ts
1802
+ /**
1803
+ * Creates a theme registry for managing theme selections with dynamic color resolution.
1804
+ * Supports token-based color systems and lazy theme loading for optimal performance.
1805
+ *
1806
+ * @param namespace The namespace for the theme context.
1807
+ * @param options Configuration including adapter and themes.
1808
+ * @template Z The type of theme context.
1809
+ * @template E The type of theme items managed by the registry.
1810
+ * @returns A tuple containing inject, provide functions and the theme context.
1811
+ */
1812
+ function createTheme(namespace = "v0:theme", options = {}) {
1813
+ const { themes = {}, palette = {} } = options;
1814
+ const [useThemeContext, _provideThemeContext] = createContext(namespace);
1815
+ const registry = useSingle();
1816
+ for (const id in themes) {
1817
+ register({
1818
+ id,
1819
+ value: themes[id].colors,
1820
+ dark: themes[id].dark ?? false,
1821
+ lazy: themes[id].lazy ?? false
1822
+ });
1823
+ if (id === options.default && !registry.selectedId.value) registry.select(id);
1824
+ }
1825
+ const names = computed(() => registry.keys());
1826
+ const colors = computed(() => {
1827
+ const resolved = {};
1828
+ for (const theme of registry.values()) {
1829
+ if (theme.lazy && theme.id !== registry.selectedId.value) continue;
1830
+ resolved[String(theme.id)] = resolve(theme.id, theme.value);
1831
+ }
1832
+ return resolved;
1833
+ });
1834
+ function cycle(themes$1 = names.value) {
1835
+ const current = themes$1.indexOf(registry.selectedId.value ?? "");
1836
+ const next = current === -1 ? 0 : (current + 1) % themes$1.length;
1837
+ registry.select(themes$1[next]);
1838
+ }
1839
+ function resolve(themeId, colors$1) {
1840
+ const resolved = {};
1841
+ for (const [key, value] of Object.entries(colors$1)) resolved[key] = resolveTokenReference(themeId, value);
1842
+ return resolved;
1843
+ }
1844
+ function resolveTokenReference(themeId, value) {
1845
+ return value.replace(/{([a-zA-Z0-9.-_]+)}/g, (match, tokenKey) => {
1846
+ if (palette[tokenKey]) return isString(palette[tokenKey]) ? palette[tokenKey] : match;
1847
+ const [targetTheme, ...colorPath] = tokenKey.split(".");
1848
+ const colorKey = colorPath.join(".");
1849
+ if (targetTheme && colorKey) {
1850
+ const targetColors = themes[targetTheme];
1851
+ const resolved$1 = targetColors?.[colorKey];
1852
+ return isString(resolved$1) ? resolveTokenReference(targetTheme, resolved$1) : match;
1853
+ }
1854
+ const currentColors = themes[themeId];
1855
+ const resolved = currentColors?.[tokenKey];
1856
+ return isString(resolved) ? resolveTokenReference(themeId, resolved) : match;
1857
+ });
1858
+ }
1859
+ function register(registration = {}) {
1860
+ const item = {
1861
+ lazy: false,
1862
+ dark: false,
1863
+ ...registration
1864
+ };
1865
+ return registry.register(item);
1866
+ }
1867
+ const context = {
1868
+ ...registry,
1869
+ colors,
1870
+ register,
1871
+ cycle
1872
+ };
1873
+ function provideThemeContext(_context = context, app) {
1874
+ return _provideThemeContext(_context, app);
1875
+ }
1876
+ return createTrinity(useThemeContext, provideThemeContext, context);
1877
+ }
1878
+ /**
1879
+ * Simple hook to access the theme context.
1880
+ *
1881
+ * @returns The theme context containing current theme state and utilities.
1882
+ */
1883
+ function useTheme() {
1884
+ return useContext("v0:theme")();
1885
+ }
1886
+ /**
1887
+ * Creates a Vue plugin for theme management with automatic color system updates.
1888
+ * Integrates with token system for dynamic color resolution and provides reactive
1889
+ * theme switching capabilities throughout the application.
1890
+ *
1891
+ * @param options Configuration for themes, palette, and adapter.
1892
+ * @template Z The type of theme context.
1893
+ * @template E The type of theme items.
1894
+ * @template R The type of token context.
1895
+ * @template O The type of token items.
1896
+ * @returns A Vue plugin object with install method.
1897
+ */
1898
+ function createThemePlugin(_options = {}) {
1899
+ const { adapter = new Vuetify0ThemeAdapter(), palette = {}, themes = {},...options } = _options;
1900
+ const [, provideThemeTokenContext, tokensContext] = createTokensContext("v0:theme:tokens", {
1901
+ palette,
1902
+ ...themes
1903
+ });
1904
+ const [, provideThemeContext, themeContext] = createTheme("v0:theme", {
1905
+ ...options,
1906
+ themes,
1907
+ palette
1908
+ });
1909
+ function update(colors) {
1910
+ adapter.update(colors);
1911
+ }
1912
+ return createPlugin({
1913
+ namespace: "v0:theme",
1914
+ provide: (app) => {
1915
+ provideThemeContext(themeContext, app);
1916
+ provideThemeTokenContext(tokensContext, app);
1917
+ },
1918
+ setup: () => {
1919
+ if (IN_BROWSER) watch(themeContext.colors, update, {
1920
+ immediate: true,
1921
+ deep: true
1922
+ });
1923
+ else update(themeContext.colors.value);
1924
+ }
1925
+ });
1926
+ }
1927
+
1928
+ //#endregion
1929
+ //#region src/components/Theme/ThemeItem.vue?vue&type=script&setup=true&lang.ts
1930
+ var ThemeItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1931
+ name: "ThemeItem",
1932
+ __name: "ThemeItem",
1933
+ setup(__props) {
1934
+ const themeContext = useTheme();
1935
+ return (_ctx, _cache) => {
1936
+ return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(themeContext))));
1937
+ };
1938
+ }
1939
+ });
1940
+
1941
+ //#endregion
1942
+ //#region src/components/Theme/ThemeItem.vue
1943
+ var ThemeItem_default = ThemeItem_vue_vue_type_script_setup_true_lang_default;
1944
+
1945
+ //#endregion
1946
+ //#region src/components/Theme/ThemeRoot.vue?vue&type=script&setup=true&lang.ts
1947
+ var ThemeRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
1948
+ name: "ThemeRoot",
1949
+ __name: "ThemeRoot",
1950
+ props: /* @__PURE__ */ mergeModels({
1951
+ namespace: { default: "v0:theme" },
1952
+ themes: { default: () => [] }
1953
+ }, {
1954
+ "modelValue": { default: "default" },
1955
+ "modelModifiers": {}
1956
+ }),
1957
+ emits: ["update:modelValue"],
1958
+ setup(__props) {
1959
+ const model = useModel(__props, "modelValue");
1960
+ const [provideThemeContext] = createTheme(__props.namespace);
1961
+ const themeContext = provideThemeContext(model);
1962
+ for (const theme of __props.themes) themeContext.register(theme);
1963
+ return (_ctx, _cache) => {
1964
+ return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(themeContext))));
1965
+ };
1966
+ }
1967
+ });
1968
+
1969
+ //#endregion
1970
+ //#region src/components/Theme/ThemeRoot.vue
1971
+ var ThemeRoot_default = ThemeRoot_vue_vue_type_script_setup_true_lang_default;
1972
+
1973
+ //#endregion
1974
+ //#region src/components/Theme/index.ts
1975
+ const Theme = {
1976
+ Item: ThemeItem_default,
1977
+ Root: ThemeRoot_default
1978
+ };
1979
+
1980
+ //#endregion
1981
+ //#region src/composables/useEventListener/index.ts
1982
+ function useEventListener(target, event, listener, options) {
1983
+ const cleanups = [];
1984
+ function cleanup() {
1985
+ for (const fn of cleanups) fn();
1986
+ cleanups.length = 0;
1987
+ }
1988
+ const register = (el, event$1, listener$1, options$1) => {
1989
+ el.addEventListener(event$1, listener$1, options$1);
1990
+ return () => el.removeEventListener(event$1, listener$1, options$1);
1991
+ };
1992
+ const stopWatcher = watch(() => [
1993
+ toValue(target),
1994
+ toValue(event),
1995
+ unref(listener),
1996
+ toValue(options)
1997
+ ], ([el, events, listeners, opts]) => {
1998
+ cleanup();
1999
+ if (!el) return;
2000
+ const eventList = toArray(events);
2001
+ const listenerList = toArray(listeners);
2002
+ for (const event$1 of eventList) for (const listenerFn of listenerList) cleanups.push(register(el, event$1, listenerFn, opts));
2003
+ }, {
2004
+ immediate: true,
2005
+ flush: "post"
2006
+ });
2007
+ function stop() {
2008
+ stopWatcher();
2009
+ cleanup();
2010
+ }
2011
+ onScopeDispose(stop, true);
2012
+ return stop;
2013
+ }
2014
+ /**
2015
+ * Convenience function for attaching event listeners to the window object.
2016
+ * This function provides a simplified API by pre-binding the window target,
2017
+ * making it easier to handle window-specific events with automatic cleanup.
2018
+ *
2019
+ * @param event Event name(s) to listen for from WindowEventMap.
2020
+ * @param listener Event handler function(s) with proper window event typing.
2021
+ * @param options Optional event listener configuration.
2022
+ * @returns Function to manually remove all attached listeners.
2023
+ */
2024
+ function useWindowEventListener(event, listener, options) {
2025
+ return useEventListener(window, event, listener, options);
2026
+ }
2027
+ /**
2028
+ * Convenience function for attaching event listeners to the document object.
2029
+ * This function provides a simplified API by pre-binding the document target,
2030
+ * making it easier to handle document-specific events with automatic cleanup.
2031
+ *
2032
+ * @param event Event name(s) to listen for from DocumentEventMap.
2033
+ * @param listener Event handler function(s) with proper document event typing.
2034
+ * @param options Optional event listener configuration.
2035
+ * @returns Function to manually remove all attached listeners.
2036
+ */
2037
+ function useDocumentEventListener(event, listener, options) {
2038
+ return useEventListener(document, event, listener, options);
2039
+ }
2040
+
2041
+ //#endregion
2042
+ //#region src/composables/useFilter/index.ts
2043
+ function defaultFilter(query, item, keys, mode = "some") {
2044
+ const queries = Array.isArray(query) ? query.map((q) => String(q).toLowerCase()) : [String(query).toLowerCase()];
2045
+ function match(value, q) {
2046
+ return String(value).toLowerCase().includes(q);
2047
+ }
2048
+ const values = typeof item === "object" && item !== null ? keys?.length ? keys.map((k) => item[k]) : Object.values(item) : [item];
2049
+ const stringValues = values.map((v) => String(v).toLowerCase());
2050
+ if (mode === "some") return stringValues.some((val) => match(val, queries[0]));
2051
+ if (mode === "every") return stringValues.every((val) => match(val, queries[0]));
2052
+ if (mode === "union") return queries.some((q) => stringValues.some((val) => match(val, q)));
2053
+ if (mode === "intersection") return queries.every((q) => stringValues.some((val) => match(val, q)));
2054
+ return false;
2055
+ }
2056
+ function toRefOrGetter(value) {
2057
+ return isRef(value) ? value : typeof value === "function" ? toRef(value) : toRef(() => value);
2058
+ }
2059
+ /**
2060
+ * Creates a reactive filter for arrays based on query matching with configurable search modes.
2061
+ * Supports 'some' (any field matches), 'every' (all fields match), 'union' (any query matches),
2062
+ * and 'intersection' (all queries match) filtering strategies.
2063
+ *
2064
+ * @param query Filter query to match against items.
2065
+ * @param items Collection of items to filter.
2066
+ * @param options Optional configuration for the filter behavior.
2067
+ * @template Z The type of the items being filtered.
2068
+ * @returns A computed reference to the filtered items based on the query and options.
2069
+ */
2070
+ function useFilter(query, items, options = {}) {
2071
+ const { customFilter, keys, mode = "some" } = options;
2072
+ const filterFunction = customFilter ?? ((q, i) => defaultFilter(q, i, keys, mode));
2073
+ const itemsRef = isRef(items) ? items : toRef(() => items);
2074
+ const queryRef = toRefOrGetter(query);
2075
+ const filteredItems = computed(() => {
2076
+ const q = toValue(queryRef);
2077
+ const queries = (Array.isArray(q) ? q : [q]).filter((q$1) => String(q$1).trim());
2078
+ if (queries.length === 0) return itemsRef.value;
2079
+ const queryParam = queries.length === 1 ? queries[0] : queries;
2080
+ return itemsRef.value.filter((item) => filterFunction(queryParam, item));
2081
+ });
2082
+ return { items: filteredItems };
2083
+ }
2084
+
2085
+ //#endregion
2086
+ //#region src/composables/useForm/index.ts
2087
+ function useForm(options) {
2088
+ const registry = useRegistry(options);
2089
+ const validateOn = options?.validateOn || "submit";
2090
+ function parse(value) {
2091
+ return value.toLowerCase().split(/\s+/);
2092
+ }
2093
+ function validatesOn(event) {
2094
+ return parse(validateOn).includes(event);
2095
+ }
2096
+ const isValidating = computed(() => {
2097
+ for (const ticket of registry.collection.values()) if (ticket.isValidating.value) return true;
2098
+ return false;
2099
+ });
2100
+ const isValid = computed(() => {
2101
+ let hasFields = false;
2102
+ for (const ticket of registry.values()) {
2103
+ hasFields = true;
2104
+ if (ticket.isValid.value === false) return false;
2105
+ if (ticket.isValid.value === null) return null;
2106
+ }
2107
+ return hasFields ? true : null;
2108
+ });
2109
+ function reset() {
2110
+ for (const ticket of registry.values()) ticket.reset();
2111
+ }
2112
+ async function submit() {
2113
+ return validate(registry.keys());
2114
+ }
2115
+ async function validate(id) {
2116
+ const validating = toArray(id);
2117
+ if (validatesOn("submit")) {
2118
+ const results = await Promise.all(validating.map(async (id$1) => await registry.get(id$1)?.validate() ?? true));
2119
+ return results.every(Boolean);
2120
+ }
2121
+ const tickets = validating.map((id$1) => registry.get(id$1)).filter(Boolean);
2122
+ return tickets.every((ticket) => ticket.isValid.value === true);
2123
+ }
2124
+ function register(registration) {
2125
+ const model = shallowRef(registration.value == null ? "" : toValue(registration.value));
2126
+ const rules = registration.rules || [];
2127
+ const errors = shallowRef([]);
2128
+ const isValidating$1 = shallowRef(false);
2129
+ const initialValue = model.value;
2130
+ const triggers = registration.validateOn || validateOn;
2131
+ const isPristine = shallowRef(true);
2132
+ const isValid$1 = shallowRef(null);
2133
+ function _validatesOn(event) {
2134
+ return parse(triggers).includes(event);
2135
+ }
2136
+ function _reset() {
2137
+ model.value = initialValue;
2138
+ errors.value = [];
2139
+ isPristine.value = true;
2140
+ isValid$1.value = null;
2141
+ }
2142
+ async function validate$1(silent = false) {
2143
+ if (rules.length === 0) return true;
2144
+ isValidating$1.value = true;
2145
+ try {
2146
+ const results = await Promise.all(rules.map((rule) => rule(model.value)));
2147
+ const errorMessages = results.filter((result) => typeof result === "string");
2148
+ if (!silent) {
2149
+ errors.value = errorMessages;
2150
+ isValid$1.value = errorMessages.length === 0;
2151
+ isPristine.value = toValue(model) === initialValue;
2152
+ }
2153
+ return errorMessages.length === 0;
2154
+ } finally {
2155
+ isValidating$1.value = false;
2156
+ }
2157
+ }
2158
+ const item = {
2159
+ ...registration,
2160
+ rules,
2161
+ errors,
2162
+ disabled: registration.disabled || false,
2163
+ validateOn: triggers,
2164
+ isValidating: isValidating$1,
2165
+ isPristine,
2166
+ isValid: isValid$1,
2167
+ reset: _reset,
2168
+ validate: validate$1
2169
+ };
2170
+ const ticket = registry.register(item);
2171
+ Object.defineProperty(ticket, "value", {
2172
+ get() {
2173
+ return model.value;
2174
+ },
2175
+ set(val) {
2176
+ model.value = val;
2177
+ isPristine.value = val === initialValue;
2178
+ isValid$1.value = null;
2179
+ if (_validatesOn("change")) validate$1();
2180
+ },
2181
+ enumerable: true,
2182
+ configurable: true
2183
+ });
2184
+ return ticket;
2185
+ }
2186
+ return {
2187
+ ...registry,
2188
+ register,
2189
+ reset,
2190
+ submit,
2191
+ validateOn,
2192
+ isValid,
2193
+ isValidating
2194
+ };
2195
+ }
2196
+
2197
+ //#endregion
2198
+ //#region src/composables/useKeydown/index.ts
2199
+ /**
2200
+ * Sets up global keyboard event listeners for specified key handlers with automatic cleanup.
2201
+ * This composable automatically starts listening when mounted and cleans up when the scope
2202
+ * is disposed, providing a clean way to handle global keyboard interactions.
2203
+ *
2204
+ * @param handlers A single handler or array of handlers to register for keydown events.
2205
+ * @returns Object with methods to manually start and stop listening for keydown events.
2206
+ */
2207
+ function useKeydown(handlers) {
2208
+ const keyHandlers = Array.isArray(handlers) ? handlers : [handlers];
2209
+ function onKeydown(event) {
2210
+ const handler = keyHandlers.find((h$1) => h$1.key === event.key);
2211
+ if (handler) {
2212
+ if (handler.preventDefault) event.preventDefault();
2213
+ if (handler.stopPropagation) event.stopPropagation();
2214
+ handler.handler(event);
2215
+ }
2216
+ }
2217
+ function startListening() {
2218
+ document.addEventListener("keydown", onKeydown);
2219
+ }
2220
+ function stopListening() {
2221
+ document.removeEventListener("keydown", onKeydown);
2222
+ }
2223
+ if (getCurrentScope()) onMounted(startListening);
2224
+ onScopeDispose(stopListening, true);
2225
+ return {
2226
+ startListening,
2227
+ stopListening
2228
+ };
2229
+ }
2230
+
2231
+ //#endregion
2232
+ //#region src/composables/useLayout/index.ts
2233
+ function useLayout(_options = {}) {
2234
+ const { enroll = true, events = true,...options } = _options;
2235
+ const registry = useGroup({
2236
+ enroll,
2237
+ events,
2238
+ ...options
2239
+ });
2240
+ const sizes = shallowReactive(/* @__PURE__ */ new Map());
2241
+ const height = shallowRef(0);
2242
+ const width = shallowRef(0);
2243
+ const bounds = {
2244
+ top: computed(() => sum("top")),
2245
+ bottom: computed(() => sum("bottom")),
2246
+ left: computed(() => sum("left")),
2247
+ right: computed(() => sum("right"))
2248
+ };
2249
+ const main = {
2250
+ x: computed(() => bounds.left.value),
2251
+ y: computed(() => bounds.top.value),
2252
+ width: computed(() => width.value - bounds.left.value - bounds.right.value),
2253
+ height: computed(() => height.value - bounds.top.value - bounds.bottom.value)
2254
+ };
2255
+ function sum(position) {
2256
+ let total = 0;
2257
+ for (const item of registry.values()) if (item.position === position && item.isActive.value) total += sizes.get(item.id) ?? item.value ?? 0;
2258
+ return total;
2259
+ }
2260
+ function register(registration) {
2261
+ const item = {
2262
+ position: registration.position,
2263
+ order: registration.order ?? 0,
2264
+ ...registration
2265
+ };
2266
+ const ticket = registry.register(item);
2267
+ sizes.set(ticket.id, ticket.value);
2268
+ return ticket;
2269
+ }
2270
+ if (IN_BROWSER && getCurrentInstance()) {
2271
+ function resize() {
2272
+ height.value = window.innerHeight;
2273
+ width.value = window.innerWidth;
2274
+ }
2275
+ onMounted(() => {
2276
+ resize();
2277
+ window.addEventListener("resize", resize);
2278
+ });
2279
+ onUnmounted(() => {
2280
+ window.removeEventListener("resize", resize);
2281
+ });
2282
+ }
2283
+ registry.on("unregister", (item) => {
2284
+ sizes.delete(item.id);
2285
+ });
2286
+ return {
2287
+ ...registry,
2288
+ register,
2289
+ bounds,
2290
+ main,
2291
+ sizes,
2292
+ height,
2293
+ width
2294
+ };
2295
+ }
2296
+
2297
+ //#endregion
2298
+ //#region src/composables/useLocale/adapters/v0.ts
2299
+ /**
2300
+ * Vuetify0.x locale adapter implementation
2301
+ *
2302
+ * This adapter provides translation and number formatting
2303
+ * capabilities using the Intl API and supports both
2304
+ * numbered and named variables in translation strings.
2305
+ */
2306
+ var Vuetify0LocaleAdapter = class {
2307
+ t(message, ...params) {
2308
+ let resolvedMessage = message;
2309
+ if (params.length > 0 && typeof params[0] === "object" && params[0] !== null && !Array.isArray(params[0])) {
2310
+ const variables = params[0];
2311
+ resolvedMessage = resolvedMessage.replace(/{([a-zA-Z][a-zA-Z0-9_]*)}/g, (match, name) => {
2312
+ return variables[name] === void 0 ? match : String(variables[name]);
2313
+ });
2314
+ params = params.slice(1);
2315
+ }
2316
+ resolvedMessage = resolvedMessage.replace(/\{(\d+)\}/g, (match, index) => {
2317
+ const idx = Number.parseInt(index, 10);
2318
+ if (params[idx] !== void 0) return String(params[idx]);
2319
+ return match;
2320
+ });
2321
+ return resolvedMessage;
2322
+ }
2323
+ n(value, locale, ...params) {
2324
+ if (!IN_BROWSER || !locale) return value.toString();
2325
+ const options = params[0];
2326
+ return new Intl.NumberFormat(String(locale), options).format(value);
2327
+ }
2328
+ };
2329
+
2330
+ //#endregion
2331
+ //#region src/composables/useLocale/index.ts
2332
+ /**
2333
+ * Creates a locale registry for managing internationalization with translations and number formatting.
2334
+ * Supports message resolution with token references and locale-specific number formatting.
2335
+ *
2336
+ * @param namespace The namespace for the locale context.
2337
+ * @param options Configuration including adapter and messages.
2338
+ * @template Z The type of the locale context.
2339
+ * @template E The type of the locale items managed by the registry.
2340
+ * @returns An array containing the inject function, provide function, and the locale context.
2341
+ */
2342
+ function createLocale(namespace = "v0:locale", options = {}) {
2343
+ const { adapter = new Vuetify0LocaleAdapter(), messages = {} } = options;
2344
+ const [useLocaleContext, _provideLocaleContext] = createContext(namespace);
2345
+ const registry = useSingle();
2346
+ for (const id in messages) {
2347
+ registry.register({
2348
+ value: messages[id],
2349
+ id
2350
+ });
2351
+ if (id === options.default && !registry.selectedId.value) registry.select(id);
2352
+ }
2353
+ function t(key, ...params) {
2354
+ const locale = registry.selectedId.value;
2355
+ if (!locale) return key;
2356
+ const message = messages[locale]?.[key];
2357
+ const template = typeof message === "string" ? resolve(locale, message) : key;
2358
+ return adapter.t(template, ...params);
2359
+ }
2360
+ function n(value, ...params) {
2361
+ return adapter.n(value, registry.selectedId.value, ...params);
2362
+ }
2363
+ function resolve(locale, str) {
2364
+ return str.replace(/{([a-zA-Z0-9.-_]+)}/g, (match, linkedKey) => {
2365
+ const [linkedLocale, ...rest] = linkedKey.split(".");
2366
+ const keyPath = rest.join(".");
2367
+ const targetLocale = messages[linkedLocale] ? linkedLocale : locale;
2368
+ const targetKey = messages[linkedLocale] ? keyPath : linkedKey;
2369
+ const resolved = messages[targetLocale]?.[targetKey];
2370
+ return typeof resolved === "string" ? resolve(targetLocale, resolved) : match;
2371
+ });
2372
+ }
2373
+ const context = {
2374
+ ...registry,
2375
+ t,
2376
+ n
2377
+ };
2378
+ function provideLocaleContext(_context = context, app) {
2379
+ return _provideLocaleContext(_context, app);
2380
+ }
2381
+ return createTrinity(useLocaleContext, provideLocaleContext, context);
2382
+ }
2383
+ /**
2384
+ * Simple hook to access the locale context.
2385
+ *
2386
+ * @returns The locale context containing translation and formatting functions.
2387
+ */
2388
+ function useLocale() {
2389
+ return useContext("v0:locale")();
2390
+ }
2391
+ /**
2392
+ * Creates a Vue plugin for internationalization with locale management and translation support.
2393
+ * Integrates with token system for message resolution and provides app-wide locale context.
2394
+ *
2395
+ * @param options Configuration for adapter, default locale, and messages.
2396
+ * @template Z The type of the locale context.
2397
+ * @template E The type of the locale items managed by the registry.
2398
+ * @template R The type of the token context.
2399
+ * @template O The type of the token items managed by the registry.
2400
+ * @returns Vue install function for the plugin
2401
+ */
2402
+ function createLocalePlugin(options = {}) {
2403
+ const { adapter = new Vuetify0LocaleAdapter(), messages = {} } = options;
2404
+ const [, provideLocaleTokenContext, tokensContext] = createTokensContext("v0:locale:tokens", messages);
2405
+ const [, provideLocaleContext, localeContext] = createLocale("v0:locale", {
2406
+ adapter,
2407
+ messages
2408
+ });
2409
+ return createPlugin({
2410
+ namespace: "v0:locale",
2411
+ provide: (app) => {
2412
+ provideLocaleContext(localeContext, app);
2413
+ provideLocaleTokenContext(tokensContext, app);
2414
+ }
2415
+ });
2416
+ }
2417
+
2418
+ //#endregion
2419
+ //#region src/composables/useProxyModel/index.ts
2420
+ /**
2421
+ * Creates a proxy model for two-way binding with a selection context.
2422
+ *
2423
+ * @param registry SelectionContext | GroupContext | SingleContext | StepContext
2424
+ * @template Z The type of items managed by the selection.
2425
+ * @template E The type of the selection context.
2426
+ * @returns The proxy model for two-way binding with the selection context.
2427
+ */
2428
+ function useProxyModel(registry, initial, options, _transformIn, _transformOut) {
2429
+ const logger = useLogger();
2430
+ const reactivity = options?.deep ? ref : shallowRef;
2431
+ const internal = reactivity(initial ? toArray(initial) : []);
2432
+ const isModelArray = isArray(initial);
2433
+ function transformIn(val) {
2434
+ if (isFunction(_transformIn)) return _transformIn(val);
2435
+ return toArray(val);
2436
+ }
2437
+ function transformOut(val) {
2438
+ if (isFunction(_transformOut)) return _transformOut(val);
2439
+ return isModelArray ? val : val[0];
2440
+ }
2441
+ const model = computed({
2442
+ get() {
2443
+ return transformOut(internal.value);
2444
+ },
2445
+ set(val) {
2446
+ internal.value = transformIn(val);
2447
+ }
2448
+ });
2449
+ const watcher = watch(registry.selectedIds, (val, oldVal) => {
2450
+ if (toRaw(val).symmetricDifference(toRaw(oldVal)).size === 0) return;
2451
+ if (val.size === 0) {
2452
+ model.value = [];
2453
+ return;
2454
+ }
2455
+ model.value = Array.from(registry.selectedValues.value);
2456
+ });
2457
+ watch(model, (val) => {
2458
+ const currentIds = new Set(toValue(registry.selectedIds));
2459
+ const targetIds = /* @__PURE__ */ new Set();
2460
+ for (const value of toArray(val)) {
2461
+ const id = registry.browse(value);
2462
+ if (id) targetIds.add(id);
2463
+ else logger.warn("Unable to find id for value", value);
2464
+ }
2465
+ watcher.pause();
2466
+ if (isModelArray) {
2467
+ for (const id of currentIds.difference(targetIds)) registry.selectedIds.delete(id);
2468
+ for (const id of targetIds.difference(currentIds)) registry.selectedIds.add(id);
2469
+ } else {
2470
+ const next = targetIds.values().next().value;
2471
+ const last = currentIds.values().next().value;
2472
+ registry.selectedIds.delete(last);
2473
+ registry.selectedIds.add(next);
2474
+ }
2475
+ watcher.resume();
2476
+ });
2477
+ return model;
2478
+ }
2479
+
2480
+ //#endregion
2481
+ //#region src/composables/useStorage/adapters/memory.ts
2482
+ /**
2483
+ * In-memory storage adapter that implements the StorageAdapter interface.
2484
+ * This adapter provides temporary storage that persists only for the current
2485
+ * session and is useful for testing or when persistent storage is not available.
2486
+ */
2487
+ var MemoryAdapter = class {
2488
+ store = /* @__PURE__ */ new Map();
2489
+ get length() {
2490
+ return this.store.size;
2491
+ }
2492
+ getItem(key) {
2493
+ return this.store.get(key) ?? null;
2494
+ }
2495
+ setItem(key, value) {
2496
+ this.store.set(key, value);
2497
+ }
2498
+ removeItem(key) {
2499
+ this.store.delete(key);
2500
+ }
2501
+ key(index) {
2502
+ return Array.from(this.store.keys())[index];
2503
+ }
2504
+ };
2505
+
2506
+ //#endregion
2507
+ //#region src/composables/useStorage/index.ts
2508
+ const [useStorageContext, provideStorageContext] = createContext("v0:storage");
2509
+ /**
2510
+ * Creates a reactive storage system with automatic persistence and cross-adapter support.
2511
+ * This function provides a consistent interface for storing and retrieving reactive values
2512
+ * that automatically sync with the underlying storage adapter (localStorage, memory, etc.).
2513
+ *
2514
+ * @param options Optional configuration for storage adapter, prefix, and serialization.
2515
+ * @template E The type of the storage context.
2516
+ * @returns A storage context object with get, set, remove, and clear methods.
2517
+ */
2518
+ function createStorage(options = {}) {
2519
+ const { adapter = IN_BROWSER ? window.localStorage : new MemoryAdapter(), prefix = "v0:", serializer = {
2520
+ read: JSON.parse,
2521
+ write: JSON.stringify
2522
+ } } = options;
2523
+ const cache = /* @__PURE__ */ new Map();
2524
+ function get(key, defaultValue) {
2525
+ const prefixedKey = `${prefix}${key}`;
2526
+ if (cache.has(prefixedKey)) return cache.get(prefixedKey);
2527
+ const storedValue = adapter?.getItem(prefixedKey);
2528
+ let initialValue = defaultValue;
2529
+ if (storedValue) try {
2530
+ initialValue = serializer.read(storedValue);
2531
+ } catch (error) {
2532
+ console.error(`[v0:storage] Failed to parse stored value for key "${prefixedKey}":`, error);
2533
+ }
2534
+ const valueRef = ref(initialValue);
2535
+ watch(valueRef, (newValue) => {
2536
+ if (newValue === void 0 || newValue === null) adapter?.removeItem(prefixedKey);
2537
+ else adapter?.setItem(prefixedKey, serializer.write(newValue));
2538
+ }, { deep: true });
2539
+ cache.set(prefixedKey, valueRef);
2540
+ return valueRef;
2541
+ }
2542
+ function set(key, value) {
2543
+ const valueRef = get(key);
2544
+ valueRef.value = value;
2545
+ }
2546
+ function remove(key) {
2547
+ const prefixedKey = `${prefix}${key}`;
2548
+ adapter?.removeItem(prefixedKey);
2549
+ cache.delete(prefixedKey);
2550
+ }
2551
+ function clear() {
2552
+ for (const key of cache.keys()) adapter?.removeItem(key);
2553
+ cache.clear();
2554
+ }
2555
+ return {
2556
+ get,
2557
+ set,
2558
+ remove,
2559
+ clear
2560
+ };
2561
+ }
2562
+ /**
2563
+ * Simple hook to access the storage context.
2564
+ *
2565
+ * @returns The storage context containing reactive storage methods.
2566
+ */
2567
+ function useStorage() {
2568
+ return useStorageContext();
2569
+ }
2570
+ /**
2571
+ * Creates a Vue plugin for reactive storage capabilities with automatic persistence.
2572
+ * Provides app-wide access to reactive storage that syncs with the configured adapter.
2573
+ *
2574
+ * @param options Optional configuration for the storage system.
2575
+ * @returns A Vue plugin object with install method.
2576
+ */
2577
+ function createStoragePlugin(options = {}) {
2578
+ const context = createStorage(options);
2579
+ return createPlugin({
2580
+ namespace: "v0:storage",
2581
+ provide: (app) => {
2582
+ provideStorageContext(context, app);
2583
+ }
2584
+ });
2585
+ }
2586
+
2587
+ //#endregion
2588
+ export { Atom_default as Atom, Breakpoints, ConsolaLoggerAdapter, Context, Group, Hydration_default as Hydration, HydrationRoot_default as HydrationRoot, PinoLoggerAdapter, Popover, Step, Theme, Vuetify0LoggerAdapter, createBreakpoints, createBreakpointsPlugin, createContext, createHydration, createHydrationPlugin, createLocale, createLocalePlugin, createLogger, createLoggerPlugin, createPlugin, createStorage, createStoragePlugin, createTheme, createThemePlugin, createTokensContext, createTrinity, genId, isArray, isBoolean, isFunction, isNullOrUndefined, isNumber, isObject, isPrimitive, isString, mergeDeep, provideBreakpointsContext, provideHydrationContext, providePopoverContext, provideStorageContext, run, toArray, toReactive, useBreakpoints, useBreakpointsContext, useContext, useDocumentEventListener, useEventListener, useFilter, useForm, useGroup, useHydration, useHydrationContext, useKeydown, useLayout, useLocale, useLogger, usePopoverContext, useProxyModel, useRegistry, useSelection, useSingle, useStep, useStorage, useStorageContext, useTheme, useTokens, useWindowEventListener };