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