@vuetify/v0 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -13
- package/dist/browser/index.js +884 -808
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.js +5 -6
- package/dist/{components-Cc48kKWf.js → components-DVuB4lnH.js} +14 -187
- package/dist/composables/index.d.ts +4 -4
- package/dist/composables/index.js +6 -6
- package/dist/{composables-7Cbs2sdO.js → composables-yeVk-ULz.js} +368 -101
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +2 -2
- package/dist/{factories-CPq2yMlr.js → factories-BEpawPUw.js} +32 -15
- package/dist/{globals--2b7sF4-.js → globals-DZvNEOB4.js} +1 -1
- package/dist/{index-BqrLvboW.d.ts → index-Ckt12ON6.d.ts} +38 -24
- package/dist/{index-BnsMFYhs.d.ts → index-D0L_ydyW.d.ts} +364 -375
- package/dist/{index-z_zwVNP8.d.ts → index-DVKeyWc5.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/transformers/index.js +1 -1
- package/dist/{transformers-BAeg3QJF.js → transformers-CWrxLIkw.js} +1 -1
- package/dist/{useTheme-DSYiiz0R.js → useTheme-DCXkw_kv.js} +153 -189
- package/package.json +12 -38
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createContext, createPlugin, createTrinity, useContext } from "./factories-
|
|
2
|
-
import { createTokensContext,
|
|
3
|
-
import { isArray, isFunction } from "./utilities-D9rWEgQK.js";
|
|
4
|
-
import { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER } from "./globals
|
|
5
|
-
import { toArray } from "./transformers-
|
|
6
|
-
import { computed,
|
|
1
|
+
import { createContext, createPlugin, createTrinity, useContext } from "./factories-BEpawPUw.js";
|
|
2
|
+
import { createTokensContext, useHydration, useLogger, useRegistry, useSelection, useSingle, useTokens } from "./useTheme-DCXkw_kv.js";
|
|
3
|
+
import { isArray, isBoolean, isFunction, isObject } from "./utilities-D9rWEgQK.js";
|
|
4
|
+
import { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER } from "./globals-DZvNEOB4.js";
|
|
5
|
+
import { toArray } from "./transformers-CWrxLIkw.js";
|
|
6
|
+
import { computed, getCurrentScope, isRef, onMounted, onScopeDispose, onUnmounted, readonly, ref, shallowRef, toRaw, toRef, toValue, unref, watch } from "vue";
|
|
7
7
|
|
|
8
8
|
//#region src/composables/useEventListener/index.ts
|
|
9
9
|
function useEventListener(target, event, listener, options) {
|
|
@@ -12,10 +12,10 @@ function useEventListener(target, event, listener, options) {
|
|
|
12
12
|
for (const fn of cleanups) fn();
|
|
13
13
|
cleanups.length = 0;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
function register(el, event$1, listener$1, options$1) {
|
|
16
16
|
el.addEventListener(event$1, listener$1, options$1);
|
|
17
17
|
return () => el.removeEventListener(event$1, listener$1, options$1);
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
const stopWatcher = watch(() => [
|
|
20
20
|
toValue(target),
|
|
21
21
|
toValue(event),
|
|
@@ -65,6 +65,132 @@ function useDocumentEventListener(event, listener, options) {
|
|
|
65
65
|
return useEventListener(document, event, listener, options);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/composables/useGroup/index.ts
|
|
70
|
+
/**
|
|
71
|
+
* Creates a group selection context for managing collections of items where multiple selections can be made.
|
|
72
|
+
* This function extends the selection functionality with group selection capabilities.
|
|
73
|
+
*
|
|
74
|
+
* @param options Optional configuration for group selection behavior.
|
|
75
|
+
* @template Z The type of items managed by the group selection.
|
|
76
|
+
* @template E The type of the group selection context.
|
|
77
|
+
* @returns The group selection context object.
|
|
78
|
+
*/
|
|
79
|
+
function useGroup(options) {
|
|
80
|
+
const registry = useSelection(options);
|
|
81
|
+
const selectedIndexes = computed(() => {
|
|
82
|
+
return new Set(Array.from(registry.selectedItems.value).map((item) => item?.index));
|
|
83
|
+
});
|
|
84
|
+
function select(ids) {
|
|
85
|
+
for (const id of toArray(ids)) registry.select(id);
|
|
86
|
+
}
|
|
87
|
+
function unselect(ids) {
|
|
88
|
+
for (const id of toArray(ids)) registry.unselect(id);
|
|
89
|
+
}
|
|
90
|
+
function toggle(ids) {
|
|
91
|
+
for (const id of toArray(ids)) registry.toggle(id);
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
...registry,
|
|
95
|
+
select,
|
|
96
|
+
unselect,
|
|
97
|
+
toggle,
|
|
98
|
+
selectedIndexes
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Creates a group selection registry context with full injection/provision control.
|
|
103
|
+
* Returns the complete trinity for advanced usage scenarios.
|
|
104
|
+
*
|
|
105
|
+
* @param namespace The namespace for the group selection registry context
|
|
106
|
+
* @param options Optional configuration for group selection behavior.
|
|
107
|
+
* @template Z The structure of the registry group selection items.
|
|
108
|
+
* @template E The available methods for the group's context.
|
|
109
|
+
* @returns A tuple containing the inject function, provide function, and the group selection context.
|
|
110
|
+
*/
|
|
111
|
+
function createGroupContext(namespace, options) {
|
|
112
|
+
const [useGroupContext, _provideGroupContext] = createContext(namespace);
|
|
113
|
+
const context = useGroup(options);
|
|
114
|
+
function provideGroupContext(_context = context, app) {
|
|
115
|
+
return _provideGroupContext(_context, app);
|
|
116
|
+
}
|
|
117
|
+
return createTrinity(useGroupContext, provideGroupContext, context);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/composables/useFeatures/index.ts
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param namespace The namespace for the feature context
|
|
125
|
+
* @param options Configure initial features to register
|
|
126
|
+
* @template Z The type of feature ticket
|
|
127
|
+
* @template E The type of feature context
|
|
128
|
+
* @returns A context trinity for the features context
|
|
129
|
+
*
|
|
130
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-features
|
|
131
|
+
*/
|
|
132
|
+
function createFeatures(namespace = "v0:features", options = {}) {
|
|
133
|
+
const [useFeaturesContext, _provideFeaturesContext] = createContext(namespace);
|
|
134
|
+
const tokens = useTokens(options.features, { flat: true });
|
|
135
|
+
const registry = useGroup();
|
|
136
|
+
for (const [id, { value }] of tokens.entries()) register({
|
|
137
|
+
id,
|
|
138
|
+
value
|
|
139
|
+
});
|
|
140
|
+
function variation(id, fallback = null) {
|
|
141
|
+
const ticket = registry.get(id);
|
|
142
|
+
if (!ticket) return fallback;
|
|
143
|
+
return isObject(ticket.value) ? ticket.value.$variation ?? fallback : fallback;
|
|
144
|
+
}
|
|
145
|
+
function register(registration = {}) {
|
|
146
|
+
const item = {
|
|
147
|
+
value: false,
|
|
148
|
+
...registration
|
|
149
|
+
};
|
|
150
|
+
const ticket = registry.register(item);
|
|
151
|
+
if (isBoolean(ticket.value) || isObject(ticket.value) && isBoolean(ticket.value.$value) && ticket.value.$value === true) registry.select(ticket.id);
|
|
152
|
+
return ticket;
|
|
153
|
+
}
|
|
154
|
+
const context = {
|
|
155
|
+
...registry,
|
|
156
|
+
variation,
|
|
157
|
+
register
|
|
158
|
+
};
|
|
159
|
+
function provideFeaturesContext(_context = context, app) {
|
|
160
|
+
return _provideFeaturesContext(_context, app);
|
|
161
|
+
}
|
|
162
|
+
return createTrinity(useFeaturesContext, provideFeaturesContext, context);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Simple hook to access the theme context.
|
|
166
|
+
*
|
|
167
|
+
* @returns The features context containing current theme state and utilities.
|
|
168
|
+
*
|
|
169
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-features
|
|
170
|
+
*/
|
|
171
|
+
function useFeatures() {
|
|
172
|
+
return useContext("v0:features");
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Creates a Vue plugin for feature management with variation support.
|
|
176
|
+
*
|
|
177
|
+
* @param options Configuration for initial features to register.
|
|
178
|
+
* @template Z The type of feature ticket.
|
|
179
|
+
* @template E The type of feature context.
|
|
180
|
+
* @returns A Vue plugin object with install method.
|
|
181
|
+
*
|
|
182
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-features
|
|
183
|
+
*/
|
|
184
|
+
function createFeaturesPlugin(options = {}) {
|
|
185
|
+
const [, provideFeaturesContext, context] = createFeatures("v0:features", options);
|
|
186
|
+
return createPlugin({
|
|
187
|
+
namespace: "v0:features",
|
|
188
|
+
provide: (app) => {
|
|
189
|
+
provideFeaturesContext(context, app);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
68
194
|
//#endregion
|
|
69
195
|
//#region src/composables/useFilter/index.ts
|
|
70
196
|
function defaultFilter(query, item, keys, mode = "some") {
|
|
@@ -72,8 +198,7 @@ function defaultFilter(query, item, keys, mode = "some") {
|
|
|
72
198
|
function match(value, q) {
|
|
73
199
|
return String(value).toLowerCase().includes(q);
|
|
74
200
|
}
|
|
75
|
-
const
|
|
76
|
-
const stringValues = values.map((v) => String(v).toLowerCase());
|
|
201
|
+
const stringValues = (typeof item === "object" && item !== null ? keys?.length ? keys.map((k) => item[k]) : Object.values(item) : [item]).map((v) => String(v).toLowerCase());
|
|
77
202
|
if (mode === "some") return stringValues.some((val) => match(val, queries[0]));
|
|
78
203
|
if (mode === "every") return stringValues.every((val) => match(val, queries[0]));
|
|
79
204
|
if (mode === "union") return queries.some((q) => stringValues.some((val) => match(val, q)));
|
|
@@ -99,14 +224,13 @@ function useFilter(query, items, options = {}) {
|
|
|
99
224
|
const filterFunction = customFilter ?? ((q, i) => defaultFilter(q, i, keys, mode));
|
|
100
225
|
const itemsRef = isRef(items) ? items : toRef(() => items);
|
|
101
226
|
const queryRef = toRefOrGetter(query);
|
|
102
|
-
|
|
227
|
+
return { items: computed(() => {
|
|
103
228
|
const q = toValue(queryRef);
|
|
104
229
|
const queries = (Array.isArray(q) ? q : [q]).filter((q$1) => String(q$1).trim());
|
|
105
230
|
if (queries.length === 0) return itemsRef.value;
|
|
106
231
|
const queryParam = queries.length === 1 ? queries[0] : queries;
|
|
107
232
|
return itemsRef.value.filter((item) => filterFunction(queryParam, item));
|
|
108
|
-
});
|
|
109
|
-
return { items: filteredItems };
|
|
233
|
+
}) };
|
|
110
234
|
}
|
|
111
235
|
|
|
112
236
|
//#endregion
|
|
@@ -141,12 +265,8 @@ function useForm(options) {
|
|
|
141
265
|
}
|
|
142
266
|
async function validate(id) {
|
|
143
267
|
const validating = toArray(id);
|
|
144
|
-
if (validatesOn("submit"))
|
|
145
|
-
|
|
146
|
-
return results.every(Boolean);
|
|
147
|
-
}
|
|
148
|
-
const tickets = validating.map((id$1) => registry.get(id$1)).filter(Boolean);
|
|
149
|
-
return tickets.every((ticket) => ticket.isValid.value === true);
|
|
268
|
+
if (validatesOn("submit")) return (await Promise.all(validating.map(async (id$1) => await registry.get(id$1)?.validate() ?? true))).every(Boolean);
|
|
269
|
+
return validating.map((id$1) => registry.get(id$1)).filter(Boolean).every((ticket) => ticket.isValid.value === true);
|
|
150
270
|
}
|
|
151
271
|
function register(registration) {
|
|
152
272
|
const model = shallowRef(registration.value == null ? "" : toValue(registration.value));
|
|
@@ -170,8 +290,7 @@ function useForm(options) {
|
|
|
170
290
|
if (rules.length === 0) return true;
|
|
171
291
|
isValidating$1.value = true;
|
|
172
292
|
try {
|
|
173
|
-
const
|
|
174
|
-
const errorMessages = results.filter((result) => typeof result === "string");
|
|
293
|
+
const errorMessages = (await Promise.all(rules.map((rule) => rule(model.value)))).filter((result) => typeof result === "string");
|
|
175
294
|
if (!silent) {
|
|
176
295
|
errors.value = errorMessages;
|
|
177
296
|
isValid$1.value = errorMessages.length === 0;
|
|
@@ -261,9 +380,8 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
261
380
|
});
|
|
262
381
|
observer.value.observe(el);
|
|
263
382
|
if (options.immediate) {
|
|
264
|
-
const rect = el.getBoundingClientRect();
|
|
265
383
|
const syntheticEntry = {
|
|
266
|
-
boundingClientRect:
|
|
384
|
+
boundingClientRect: el.getBoundingClientRect(),
|
|
267
385
|
intersectionRatio: 0,
|
|
268
386
|
intersectionRect: new DOMRect(0, 0, 0, 0),
|
|
269
387
|
isIntersecting: false,
|
|
@@ -296,9 +414,8 @@ function useIntersectionObserver(target, callback, options = {}) {
|
|
|
296
414
|
});
|
|
297
415
|
observer.value.observe(target.value);
|
|
298
416
|
if (options.immediate) {
|
|
299
|
-
const rect = target.value.getBoundingClientRect();
|
|
300
417
|
const syntheticEntry = {
|
|
301
|
-
boundingClientRect:
|
|
418
|
+
boundingClientRect: target.value.getBoundingClientRect(),
|
|
302
419
|
intersectionRatio: 0,
|
|
303
420
|
intersectionRect: new DOMRect(0, 0, 0, 0),
|
|
304
421
|
isIntersecting: false,
|
|
@@ -395,72 +512,6 @@ function useKeydown(handlers) {
|
|
|
395
512
|
};
|
|
396
513
|
}
|
|
397
514
|
|
|
398
|
-
//#endregion
|
|
399
|
-
//#region src/composables/useLayout/index.ts
|
|
400
|
-
function useLayout(_options = {}) {
|
|
401
|
-
const { enroll = true, events = true,...options } = _options;
|
|
402
|
-
const registry = useGroup({
|
|
403
|
-
enroll,
|
|
404
|
-
events,
|
|
405
|
-
...options
|
|
406
|
-
});
|
|
407
|
-
const sizes = shallowReactive(/* @__PURE__ */ new Map());
|
|
408
|
-
const height = shallowRef(0);
|
|
409
|
-
const width = shallowRef(0);
|
|
410
|
-
const bounds = {
|
|
411
|
-
top: computed(() => sum("top")),
|
|
412
|
-
bottom: computed(() => sum("bottom")),
|
|
413
|
-
left: computed(() => sum("left")),
|
|
414
|
-
right: computed(() => sum("right"))
|
|
415
|
-
};
|
|
416
|
-
const main = {
|
|
417
|
-
x: computed(() => bounds.left.value),
|
|
418
|
-
y: computed(() => bounds.top.value),
|
|
419
|
-
width: computed(() => width.value - bounds.left.value - bounds.right.value),
|
|
420
|
-
height: computed(() => height.value - bounds.top.value - bounds.bottom.value)
|
|
421
|
-
};
|
|
422
|
-
function sum(position) {
|
|
423
|
-
let total = 0;
|
|
424
|
-
for (const item of registry.values()) if (item.position === position && item.isActive.value) total += sizes.get(item.id) ?? item.value ?? 0;
|
|
425
|
-
return total;
|
|
426
|
-
}
|
|
427
|
-
function register(registration) {
|
|
428
|
-
const item = {
|
|
429
|
-
position: registration.position,
|
|
430
|
-
order: registration.order ?? 0,
|
|
431
|
-
...registration
|
|
432
|
-
};
|
|
433
|
-
const ticket = registry.register(item);
|
|
434
|
-
sizes.set(ticket.id, ticket.value);
|
|
435
|
-
return ticket;
|
|
436
|
-
}
|
|
437
|
-
if (IN_BROWSER && getCurrentInstance()) {
|
|
438
|
-
function resize() {
|
|
439
|
-
height.value = window.innerHeight;
|
|
440
|
-
width.value = window.innerWidth;
|
|
441
|
-
}
|
|
442
|
-
onMounted(() => {
|
|
443
|
-
resize();
|
|
444
|
-
window.addEventListener("resize", resize);
|
|
445
|
-
});
|
|
446
|
-
onUnmounted(() => {
|
|
447
|
-
window.removeEventListener("resize", resize);
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
registry.on("unregister", (item) => {
|
|
451
|
-
sizes.delete(item.id);
|
|
452
|
-
});
|
|
453
|
-
return {
|
|
454
|
-
...registry,
|
|
455
|
-
register,
|
|
456
|
-
bounds,
|
|
457
|
-
main,
|
|
458
|
-
sizes,
|
|
459
|
-
height,
|
|
460
|
-
width
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
|
|
464
515
|
//#endregion
|
|
465
516
|
//#region src/composables/useLocale/adapters/v0.ts
|
|
466
517
|
/**
|
|
@@ -553,7 +604,7 @@ function createLocale(namespace = "v0:locale", options = {}) {
|
|
|
553
604
|
* @returns The locale context containing translation and formatting functions.
|
|
554
605
|
*/
|
|
555
606
|
function useLocale() {
|
|
556
|
-
return useContext("v0:locale")
|
|
607
|
+
return useContext("v0:locale");
|
|
557
608
|
}
|
|
558
609
|
/**
|
|
559
610
|
* Creates a Vue plugin for internationalization with locale management and translation support.
|
|
@@ -632,7 +683,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
632
683
|
forEach: () => {},
|
|
633
684
|
*[Symbol.iterator]() {}
|
|
634
685
|
};
|
|
635
|
-
|
|
686
|
+
callback([{
|
|
636
687
|
type: "childList",
|
|
637
688
|
target: el,
|
|
638
689
|
addedNodes: emptyNodeList,
|
|
@@ -642,8 +693,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
642
693
|
attributeName: null,
|
|
643
694
|
attributeNamespace: null,
|
|
644
695
|
oldValue: null
|
|
645
|
-
};
|
|
646
|
-
callback([syntheticEntry]);
|
|
696
|
+
}]);
|
|
647
697
|
}
|
|
648
698
|
}, { immediate: true });
|
|
649
699
|
function setup() {
|
|
@@ -710,6 +760,91 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
710
760
|
};
|
|
711
761
|
}
|
|
712
762
|
|
|
763
|
+
//#endregion
|
|
764
|
+
//#region src/composables/usePermissions/adapters/adapter.ts
|
|
765
|
+
var PermissionAdapter = class {};
|
|
766
|
+
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/composables/usePermissions/adapters/v0.ts
|
|
769
|
+
var Vuetify0PermissionAdapter = class extends PermissionAdapter {
|
|
770
|
+
constructor() {
|
|
771
|
+
super();
|
|
772
|
+
}
|
|
773
|
+
can(role, action, subject, context, permissions) {
|
|
774
|
+
const access = `${role}.${action}.${subject}`;
|
|
775
|
+
const ticket = permissions.get(access);
|
|
776
|
+
if (!ticket || !ticket.value) return false;
|
|
777
|
+
return isFunction(ticket.value) ? ticket.value(context) : ticket.value;
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/composables/usePermissions/index.ts
|
|
783
|
+
/**
|
|
784
|
+
*
|
|
785
|
+
* @param namespace The namespace for the permissions context
|
|
786
|
+
* @param options Configure initial permissions and adapter
|
|
787
|
+
* @template Z The type of permission ticket
|
|
788
|
+
* @template E The type of permission context
|
|
789
|
+
* @returns A context trinity for the permissions context
|
|
790
|
+
*
|
|
791
|
+
* @see https://0.vuetifyjs.com/composables/plugins/create-permissions
|
|
792
|
+
*/
|
|
793
|
+
function createPermissions(namespace = "v0:permissions", options = {}) {
|
|
794
|
+
const { adapter = new Vuetify0PermissionAdapter(), permissions = {} } = options;
|
|
795
|
+
const [usePermissionsContext, _providePermissionsContext] = createContext(namespace);
|
|
796
|
+
const record = {};
|
|
797
|
+
for (const role in permissions) {
|
|
798
|
+
if (!record[role]) record[role] = {};
|
|
799
|
+
for (const [actions, subjects, condition = true] of permissions[role]) for (const action of toArray(actions)) for (const subject of toArray(subjects)) {
|
|
800
|
+
if (!record[role][action]) record[role][action] = {};
|
|
801
|
+
record[role][action][subject] = condition;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const tokens = useTokens(record);
|
|
805
|
+
function can(id, action, subject, context$1 = {}) {
|
|
806
|
+
return adapter.can(id, action, subject, context$1, tokens);
|
|
807
|
+
}
|
|
808
|
+
const context = {
|
|
809
|
+
...tokens,
|
|
810
|
+
can
|
|
811
|
+
};
|
|
812
|
+
function providePermissionsContext(_context = context, app) {
|
|
813
|
+
return _providePermissionsContext(_context, app);
|
|
814
|
+
}
|
|
815
|
+
return createTrinity(usePermissionsContext, providePermissionsContext, context);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Simple hook to access the permissions context
|
|
819
|
+
*
|
|
820
|
+
* @returns The permissions context
|
|
821
|
+
* @template Z The type of permission ticket
|
|
822
|
+
*
|
|
823
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
824
|
+
*/
|
|
825
|
+
function usePermissions() {
|
|
826
|
+
return useContext("v0:permissions");
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Factory function to create a permissions plugin
|
|
830
|
+
*
|
|
831
|
+
* @param options Configuration options for the permissions plugin
|
|
832
|
+
* @template Z The type of permission ticket
|
|
833
|
+
* @template E The type of permission context
|
|
834
|
+
* @returns A Vue plugin object for permissions management
|
|
835
|
+
*
|
|
836
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-permissions
|
|
837
|
+
*/
|
|
838
|
+
function createPermissionsPlugin(options = {}) {
|
|
839
|
+
const [, providePermissionContext, context] = createPermissions("v0:permissions", options);
|
|
840
|
+
return createPlugin({
|
|
841
|
+
namespace: "v0:permissions",
|
|
842
|
+
provide: (app) => {
|
|
843
|
+
providePermissionContext(context, app);
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
|
|
713
848
|
//#endregion
|
|
714
849
|
//#region src/composables/useProxyModel/index.ts
|
|
715
850
|
/**
|
|
@@ -722,8 +857,7 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
722
857
|
*/
|
|
723
858
|
function useProxyModel(registry, initial, options, _transformIn, _transformOut) {
|
|
724
859
|
const logger = useLogger();
|
|
725
|
-
const
|
|
726
|
-
const internal = reactivity(initial ? toArray(initial) : []);
|
|
860
|
+
const internal = (options?.deep ? ref : shallowRef)(initial ? toArray(initial) : []);
|
|
727
861
|
const isModelArray = isArray(initial);
|
|
728
862
|
function transformIn(val) {
|
|
729
863
|
if (isFunction(_transformIn)) return _transformIn(val);
|
|
@@ -753,8 +887,9 @@ function useProxyModel(registry, initial, options, _transformIn, _transformOut)
|
|
|
753
887
|
const currentIds = new Set(toValue(registry.selectedIds));
|
|
754
888
|
const targetIds = /* @__PURE__ */ new Set();
|
|
755
889
|
for (const value of toArray(val)) {
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
890
|
+
const ids = registry.browse(value);
|
|
891
|
+
if (isArray(ids)) for (const single of ids) targetIds.add(single);
|
|
892
|
+
else if (ids) targetIds.add(ids);
|
|
758
893
|
else logger.warn("Unable to find id for value", value);
|
|
759
894
|
}
|
|
760
895
|
watcher.pause();
|
|
@@ -892,6 +1027,83 @@ function useElementSize(target) {
|
|
|
892
1027
|
};
|
|
893
1028
|
}
|
|
894
1029
|
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region src/composables/useStep/index.ts
|
|
1032
|
+
/**
|
|
1033
|
+
* Creates a step selection context for managing collections where users can navigate through items sequentially.
|
|
1034
|
+
* This function extends the single selection functionality with stepping navigation.
|
|
1035
|
+
*
|
|
1036
|
+
* @param options Optional configuration for step behavior.
|
|
1037
|
+
* @template Z The type of items managed by the step selection.
|
|
1038
|
+
* @template E The type of the step selection context.
|
|
1039
|
+
* @returns The step selection context object.
|
|
1040
|
+
*/
|
|
1041
|
+
function useStep(options) {
|
|
1042
|
+
const registry = useSingle(options);
|
|
1043
|
+
function first() {
|
|
1044
|
+
if (registry.size === 0) return;
|
|
1045
|
+
registry.selectedIds.clear();
|
|
1046
|
+
registry.select(registry.lookup(0));
|
|
1047
|
+
}
|
|
1048
|
+
function last() {
|
|
1049
|
+
const size = registry.size;
|
|
1050
|
+
if (size === 0) return;
|
|
1051
|
+
registry.selectedIds.clear();
|
|
1052
|
+
registry.select(registry.lookup(size - 1));
|
|
1053
|
+
}
|
|
1054
|
+
function next() {
|
|
1055
|
+
step(1);
|
|
1056
|
+
}
|
|
1057
|
+
function prev() {
|
|
1058
|
+
step(-1);
|
|
1059
|
+
}
|
|
1060
|
+
function wrapped(length, index) {
|
|
1061
|
+
return (index + length) % length;
|
|
1062
|
+
}
|
|
1063
|
+
function step(count = 1) {
|
|
1064
|
+
const length = registry.size;
|
|
1065
|
+
if (!length) return;
|
|
1066
|
+
const direction = Math.sign(count || 1);
|
|
1067
|
+
let hops = 0;
|
|
1068
|
+
let index = wrapped(length, registry.selectedIndex.value + count);
|
|
1069
|
+
let id = registry.lookup(index);
|
|
1070
|
+
while (id !== void 0 && registry.get(id)?.disabled && hops < length) {
|
|
1071
|
+
index = wrapped(length, index + direction);
|
|
1072
|
+
id = registry.lookup(index);
|
|
1073
|
+
hops++;
|
|
1074
|
+
}
|
|
1075
|
+
if (id === void 0 || hops === length) return;
|
|
1076
|
+
registry.selectedIds.clear();
|
|
1077
|
+
registry.select(id);
|
|
1078
|
+
}
|
|
1079
|
+
return {
|
|
1080
|
+
...registry,
|
|
1081
|
+
first,
|
|
1082
|
+
last,
|
|
1083
|
+
next,
|
|
1084
|
+
prev,
|
|
1085
|
+
step
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Creates a step selection registry context with full injection/provision control.
|
|
1090
|
+
* Returns the complete trinity for advanced usage scenarios.
|
|
1091
|
+
*
|
|
1092
|
+
* @param namespace The namespace for the step selection registry context
|
|
1093
|
+
* @param options Optional configuration for step selection behavior.
|
|
1094
|
+
* @template Z The structure of the registry step selection items.
|
|
1095
|
+
* @template E The available methods for the step's context.
|
|
1096
|
+
* @returns A tuple containing the inject function, provide function, and the step selection context.
|
|
1097
|
+
*/
|
|
1098
|
+
function createStepContext(namespace, options) {
|
|
1099
|
+
const [useStepContext, _provideStepContext] = createContext(namespace);
|
|
1100
|
+
const context = useStep(options);
|
|
1101
|
+
function provideStepContext(_context = context, app) {
|
|
1102
|
+
return _provideStepContext(_context, app);
|
|
1103
|
+
}
|
|
1104
|
+
return createTrinity(useStepContext, provideStepContext, context);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
895
1107
|
//#endregion
|
|
896
1108
|
//#region src/composables/useStorage/adapters/memory.ts
|
|
897
1109
|
/**
|
|
@@ -914,7 +1126,7 @@ var MemoryAdapter = class {
|
|
|
914
1126
|
this.store.delete(key);
|
|
915
1127
|
}
|
|
916
1128
|
key(index) {
|
|
917
|
-
return Array.from(this.store.keys())[index];
|
|
1129
|
+
return String(Array.from(this.store.keys())[index] ?? "");
|
|
918
1130
|
}
|
|
919
1131
|
};
|
|
920
1132
|
|
|
@@ -1000,4 +1212,59 @@ function createStoragePlugin(options = {}) {
|
|
|
1000
1212
|
}
|
|
1001
1213
|
|
|
1002
1214
|
//#endregion
|
|
1003
|
-
|
|
1215
|
+
//#region src/composables/useTimeline/index.ts
|
|
1216
|
+
/**
|
|
1217
|
+
* Creates a registry with timeline capabilities (undo/redo)
|
|
1218
|
+
*
|
|
1219
|
+
* @param _options Optional configuration for timeline
|
|
1220
|
+
* @template Z The type of ticket to be stored in the timeline
|
|
1221
|
+
* @template E The type of the timeline context
|
|
1222
|
+
* @returns The timeline context object
|
|
1223
|
+
*
|
|
1224
|
+
* @see https://0.vuetifyjs.com/composables/registration/use-timeline
|
|
1225
|
+
*/
|
|
1226
|
+
function useTimeline(_options = {}) {
|
|
1227
|
+
const { size = 10,...options } = _options;
|
|
1228
|
+
const registry = useRegistry(options);
|
|
1229
|
+
const undoTimeline = [];
|
|
1230
|
+
const redoTimeline = [];
|
|
1231
|
+
function register(item) {
|
|
1232
|
+
if (registry.size < size) return registry.register({ ...item });
|
|
1233
|
+
const id = registry.lookup(0);
|
|
1234
|
+
const removing = registry.get(id);
|
|
1235
|
+
if (redoTimeline.length === size) redoTimeline.shift();
|
|
1236
|
+
redoTimeline.push(removing);
|
|
1237
|
+
registry.unregister(id);
|
|
1238
|
+
const ticket = registry.register({ ...item });
|
|
1239
|
+
registry.reindex();
|
|
1240
|
+
return ticket;
|
|
1241
|
+
}
|
|
1242
|
+
function redo() {
|
|
1243
|
+
if (undoTimeline.length === 0) return;
|
|
1244
|
+
registry.register(undoTimeline.pop());
|
|
1245
|
+
registry.reindex();
|
|
1246
|
+
}
|
|
1247
|
+
function undo() {
|
|
1248
|
+
const id = registry.lookup(registry.size - 1);
|
|
1249
|
+
if (!id) return;
|
|
1250
|
+
undoTimeline.push(registry.get(id));
|
|
1251
|
+
registry.unregister(id);
|
|
1252
|
+
restore();
|
|
1253
|
+
}
|
|
1254
|
+
function restore() {
|
|
1255
|
+
const value = redoTimeline.pop();
|
|
1256
|
+
const restored = value ? [value, ...registry.values()] : [...registry.values()];
|
|
1257
|
+
registry.clear();
|
|
1258
|
+
registry.onboard(restored);
|
|
1259
|
+
registry.reindex();
|
|
1260
|
+
}
|
|
1261
|
+
return {
|
|
1262
|
+
...registry,
|
|
1263
|
+
register,
|
|
1264
|
+
undo,
|
|
1265
|
+
redo
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
//#endregion
|
|
1270
|
+
export { createFeatures, createFeaturesPlugin, createGroupContext, createLocale, createLocalePlugin, createPermissions, createPermissionsPlugin, createStepContext, createStorage, createStoragePlugin, provideStorageContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFeatures, useFilter, useForm, useGroup, useIntersectionObserver, useKeydown, useLocale, useMutationObserver, usePermissions, useProxyModel, useResizeObserver, useStep, useStorage, useStorageContext, useTimeline, useWindowEventListener };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { COMMON_ELEMENTS, HTMLElementName, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, SelfClosingElement, __LOGGER_ENABLED__, isSelfClosingTag, version } from "../index-
|
|
1
|
+
import { COMMON_ELEMENTS, HTMLElementName, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, SelfClosingElement, __LOGGER_ENABLED__, isSelfClosingTag, version } from "../index-DVKeyWc5.js";
|
|
2
2
|
export { COMMON_ELEMENTS, HTMLElementName, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, SelfClosingElement, __LOGGER_ENABLED__, isSelfClosingTag, version };
|
package/dist/constants/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { COMMON_ELEMENTS, SELF_CLOSING_TAGS, isSelfClosingTag } from "../htmlElements-SjqYu0am.js";
|
|
2
|
-
import { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, __LOGGER_ENABLED__, version } from "../globals
|
|
2
|
+
import { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, __LOGGER_ENABLED__, version } from "../globals-DZvNEOB4.js";
|
|
3
3
|
import "../constants-DiTCgvMU.js";
|
|
4
4
|
|
|
5
5
|
export { COMMON_ELEMENTS, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, __LOGGER_ENABLED__, isSelfClosingTag, version };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ContextKey, ContextTrinity, Plugin, PluginOptions, createContext, createPlugin, createTrinity, useContext } from "../index-
|
|
2
|
-
export { ContextKey, ContextTrinity, Plugin, PluginOptions, createContext, createPlugin, createTrinity, useContext };
|
|
1
|
+
import { ContextKey, ContextTrinity, Plugin, PluginOptions, createContext, createPlugin, createTrinity, provideContext, useContext } from "../index-Ckt12ON6.js";
|
|
2
|
+
export { ContextKey, ContextTrinity, Plugin, PluginOptions, createContext, createPlugin, createTrinity, provideContext, useContext };
|
package/dist/factories/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createContext, createPlugin, createTrinity, useContext } from "../factories-
|
|
1
|
+
import { createContext, createPlugin, createTrinity, provideContext, useContext } from "../factories-BEpawPUw.js";
|
|
2
2
|
|
|
3
|
-
export { createContext, createPlugin, createTrinity, useContext };
|
|
3
|
+
export { createContext, createPlugin, createTrinity, provideContext, useContext };
|