@vuetify/v0 0.1.5 → 0.1.7
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 +0 -1
- package/dist/{adapter-Cmeg49W9.mjs → adapter-B4zE-hA5.mjs} +10 -15
- package/dist/adapter-CqP9Z4JU.d.mts +1087 -0
- package/dist/{adapter-D2JoR-4d.d.mts → adapter-DIx4Rntl.d.mts} +6 -49
- package/dist/adapters-BjeDmKc6.mjs +1 -0
- package/dist/adapters-Bv5aRv3l.mjs +1 -0
- package/dist/adapters-C66XaKkw.mjs +1 -0
- package/dist/adapters-DkVblyML.mjs +1 -0
- package/dist/adapters-uJLWGQJl.mjs +1 -0
- package/dist/browser/index.js +2251 -826
- package/dist/components/index.d.mts +2 -20
- package/dist/components/index.mjs +34 -39
- package/dist/{components-BbbGkTcN.mjs → components-CACff-Lt.mjs} +1154 -317
- package/dist/composables/index.d.mts +18 -17
- package/dist/composables/index.mjs +34 -37
- package/dist/{consola-DiUk9j3y.d.mts → consola-BVzYzeLH.d.mts} +1 -1
- package/dist/{consola-GBy8XRuL.mjs → consola-Ceox8BWi.mjs} +1 -2
- package/dist/constants/index.d.mts +1 -1
- package/dist/constants/index.mjs +3 -5
- package/dist/{createDataTable-cNf6DdHz.mjs → createDataTable-CLI4TALE.mjs} +9 -11
- package/dist/{createGroup-BrZPZudL.mjs → createGroup-Cf6lK9BR.mjs} +7 -9
- package/dist/{createPagination-Wc_vRGNQ.mjs → createPagination-Bu8vE0JW.mjs} +3 -5
- package/dist/{createSelection-BURpoE3p.mjs → createSelection-DvOR2tKk.mjs} +216 -63
- package/dist/{createSingle-BE1vHaZy.mjs → createSingle-Bbcwcq4R.mjs} +3 -5
- package/dist/{createTokens-jwf8-iGn.mjs → createTokens-CMRBDlzN.mjs} +41 -26
- package/dist/{createTrinity-DkwPrPRS.mjs → createTrinity-C_c8eedz.mjs} +10 -13
- package/dist/data-table/adapters/client/index.d.mts +1 -2
- package/dist/data-table/adapters/client/index.mjs +7 -9
- package/dist/data-table/adapters/index.d.mts +4 -4
- package/dist/data-table/adapters/index.mjs +10 -12
- package/dist/data-table/adapters/server/index.d.mts +1 -2
- package/dist/data-table/adapters/server/index.mjs +5 -7
- package/dist/data-table/adapters/virtual/index.d.mts +1 -2
- package/dist/data-table/adapters/virtual/index.mjs +7 -9
- package/dist/data-table/index.d.mts +5 -6
- package/dist/data-table/index.mjs +22 -25
- package/dist/date/index.d.mts +1 -3
- package/dist/date/index.mjs +3932 -3943
- package/dist/features/adapters/flagsmith/index.d.mts +2 -4
- package/dist/features/adapters/flagsmith/index.mjs +2 -3
- package/dist/features/adapters/launchdarkly/index.d.mts +1 -3
- package/dist/features/adapters/launchdarkly/index.mjs +2 -3
- package/dist/features/adapters/posthog/index.d.mts +1 -3
- package/dist/features/adapters/posthog/index.mjs +3 -4
- package/dist/features/index.d.mts +2 -16
- package/dist/features/index.mjs +13 -18
- package/dist/{flagsmith-CHmpPGR7.mjs → flagsmith-CrWUeIhT.mjs} +1 -2
- package/dist/{globals-vN-O052q.mjs → globals-BqRH_jdr.mjs} +2 -3
- package/dist/{htmlElements-d8iBCGpO.mjs → htmlElements-DcYtv0hg.mjs} +7 -10
- package/dist/index-8sflFIN8.d.mts +856 -0
- package/dist/{index-BTMzRHep.d.mts → index-BE848tZ2.d.mts} +938 -889
- package/dist/{index-DRax9EgT.d.mts → index-CKbxWC4t.d.mts} +1358 -542
- package/dist/index-CeNfBYuo.d.mts +46 -0
- package/dist/{index-DdWxDPX3.d.mts → index-CmCMrlt3.d.mts} +3 -3
- package/dist/{index-BFBN5Zl3.d.mts → index-Dor6eAEc.d.mts} +0 -1
- package/dist/{index-UNwEBkQT.d.mts → index-MHkcqY_y.d.mts} +1 -2
- package/dist/{index-BuOz3Rgm.d.mts → index-dJKXAO5D.d.mts} +1 -2
- package/dist/index.d.mts +22 -20
- package/dist/index.mjs +38 -40
- package/dist/json/attributes.json +196 -12
- package/dist/json/importMap.json +40 -0
- package/dist/json/tags.json +86 -0
- package/dist/json/web-types.json +605 -13
- package/dist/{launchdarkly-W8t8ZANX.mjs → launchdarkly-jF2KZGoH.mjs} +1 -2
- package/dist/locale/adapters/index.d.mts +1 -2
- package/dist/locale/adapters/index.mjs +4 -6
- package/dist/locale/adapters/v0/index.d.mts +1 -2
- package/dist/locale/adapters/v0/index.mjs +3 -5
- package/dist/locale/index.d.mts +2 -16
- package/dist/locale/index.mjs +14 -17
- package/dist/logger/adapters/consola/index.d.mts +1 -2
- package/dist/logger/adapters/consola/index.mjs +2 -3
- package/dist/logger/adapters/index.d.mts +4 -4
- package/dist/logger/adapters/index.mjs +6 -8
- package/dist/logger/adapters/pino/index.d.mts +1 -2
- package/dist/logger/adapters/pino/index.mjs +3 -5
- package/dist/logger/adapters/v0/index.d.mts +1 -2
- package/dist/logger/adapters/v0/index.mjs +3 -5
- package/dist/logger/index.d.mts +5 -16
- package/dist/logger/index.mjs +8 -10
- package/dist/{memory-BsZGbGnG.mjs → memory-XCMtkld1.mjs} +1 -2
- package/dist/palettes/ant/generate/index.d.mts +9 -0
- package/dist/palettes/ant/generate/index.mjs +98 -0
- package/dist/palettes/ant/index.d.mts +6 -0
- package/dist/palettes/ant/index.mjs +149 -0
- package/dist/palettes/index.d.mts +12 -0
- package/dist/palettes/index.mjs +1 -0
- package/dist/palettes/leonardo/generate/index.d.mts +10 -0
- package/dist/palettes/leonardo/generate/index.mjs +120 -0
- package/dist/palettes/material/generate/index.d.mts +10 -0
- package/dist/palettes/material/generate/index.mjs +103 -0
- package/dist/palettes/material/index.d.mts +6 -0
- package/dist/palettes/material/index.mjs +173 -0
- package/dist/palettes/md1/index.d.mts +6 -0
- package/dist/palettes/md1/index.mjs +261 -0
- package/dist/palettes/md2/index.d.mts +6 -0
- package/dist/palettes/md2/index.mjs +297 -0
- package/dist/palettes/radix/index.d.mts +6 -0
- package/dist/palettes/radix/index.mjs +439 -0
- package/dist/palettes/tailwind/index.d.mts +6 -0
- package/dist/palettes/tailwind/index.mjs +291 -0
- package/dist/permissions/adapters/index.d.mts +2 -17
- package/dist/permissions/adapters/index.mjs +4 -6
- package/dist/permissions/adapters/v0/index.d.mts +1 -17
- package/dist/permissions/adapters/v0/index.mjs +3 -5
- package/dist/permissions/index.d.mts +1 -16
- package/dist/permissions/index.mjs +12 -15
- package/dist/{pino-DFxkZLiu.mjs → pino-B7tJ3m18.mjs} +2 -4
- package/dist/{pino-p-jDkNQd.d.mts → pino-Bzighnkd.d.mts} +1 -2
- package/dist/{posthog-BOUoZTTf.mjs → posthog-DbPqmaAp.mjs} +2 -4
- package/dist/rules/index.d.mts +2 -0
- package/dist/rules/index.mjs +15 -0
- package/dist/{server-C2R2POGE.mjs → server-CZ6ahbEH.mjs} +2 -4
- package/dist/{server-B-HWxaTQ.d.mts → server-Ch9J86tb.d.mts} +1 -2
- package/dist/storage/adapters/index.d.mts +2 -2
- package/dist/storage/adapters/index.mjs +2 -3
- package/dist/storage/adapters/memory/index.d.mts +1 -1
- package/dist/storage/adapters/memory/index.mjs +2 -3
- package/dist/storage/index.d.mts +3 -16
- package/dist/storage/index.mjs +33 -37
- package/dist/theme/adapters/index.d.mts +1 -16
- package/dist/theme/adapters/index.mjs +4 -6
- package/dist/theme/adapters/v0/index.d.mts +1 -16
- package/dist/theme/adapters/v0/index.mjs +3 -5
- package/dist/theme/index.d.mts +1 -16
- package/dist/theme/index.mjs +13 -16
- package/dist/{toArray-VIn8vYt3.mjs → toArray-VdROPpy-.mjs} +2 -4
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/{useClickOutside-DIi0kjN5.mjs → useClickOutside-YOGwKo7v.mjs} +603 -287
- package/dist/{useFeatures-6O7EPJUS.mjs → useFeatures-BGDgUrdr.mjs} +5 -8
- package/dist/{useLocale-DHjbekzS.mjs → useLocale-C8I_fNAS.mjs} +7 -9
- package/dist/{useLogger-BXqiUvt2.mjs → useLogger-B70T4SgK.mjs} +13 -16
- package/dist/{usePermissions-DFacFVqO.mjs → usePermissions-afVt2qR7.mjs} +5 -7
- package/dist/useRules-7C92Xzyt.mjs +144 -0
- package/dist/{useTheme-D0_1mjTw.mjs → useTheme-jp2wL2FJ.mjs} +11 -13
- package/dist/utilities/index.d.mts +1 -2
- package/dist/utilities/index.mjs +426 -4
- package/dist/{v0-BNXo1ecc.d.mts → v0-1bfmyZ5_.d.mts} +2 -2
- package/dist/{v0-BOxb3nD1.d.mts → v0-1xxC39wf.d.mts} +1 -2
- package/dist/{v0-BYqmw3qM.mjs → v0-B1QQGE4O.mjs} +2 -5
- package/dist/{v0-DHMoZ7dS.d.mts → v0-CAKa6tzG.d.mts} +1 -1
- package/dist/{v0-Dwufx8ae.mjs → v0-CGlkn5u7.mjs} +3 -6
- package/dist/{v0-CfSj99gF.mjs → v0-CHvU3jQE.mjs} +3 -5
- package/dist/{v0-BPzPP8C5.d.mts → v0-CdUL2eOn.d.mts} +1 -2
- package/dist/{v0-C8DBv9mh.mjs → v0-V-cQsuZD.mjs} +3 -5
- package/dist/{v0-Dc5mcpQs.mjs → v0-YAqbXudL.mjs} +3 -5
- package/dist/{virtual-A4e1yrdn.d.mts → virtual-DwBiFA25.d.mts} +1 -2
- package/dist/{virtual-BoTGK6HT.mjs → virtual-eDNVH1fz.mjs} +3 -5
- package/package.json +39 -11
- package/dist/adapter-DcwxFryd.d.mts +0 -97
- package/dist/adapters-BGJKsBrw.mjs +0 -1
- package/dist/adapters-BQ-Lr3PW.mjs +0 -1
- package/dist/adapters-DEXpW9If.mjs +0 -1
- package/dist/adapters-Q9WaOsJp.mjs +0 -1
- package/dist/adapters-SSDVth5e.mjs +0 -1
- package/dist/constants-B8pMSkcW.mjs +0 -1
- package/dist/utilities-Dx8wzGa5.mjs +0 -429
- /package/dist/{adapter-CJIj5ySf.d.mts → adapter-JTFG3Jn8.d.mts} +0 -0
- /package/dist/{index-Bv1VN_j5.d.mts → index-B5ZDDkXv.d.mts} +0 -0
- /package/dist/{index-BDTbJClL.d.mts → index-NsE5nARK.d.mts} +0 -0
- /package/dist/{memory-DVjquu_v.d.mts → memory-BTtRdnNn.d.mts} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { a as SUPPORTS_OBSERVER, i as SUPPORTS_MUTATION_OBSERVER, n as SUPPORTS_INTERSECTION_OBSERVER, r as SUPPORTS_MATCH_MEDIA, t as IN_BROWSER } from "./globals-
|
|
2
|
-
import {
|
|
3
|
-
import { i as useContext, n as createContext, t as createTrinity } from "./createTrinity-
|
|
4
|
-
import { a as createPlugin, i as useLogger, o as createPluginContext } from "./useLogger-
|
|
5
|
-
import { i as createRegistry } from "./createTokens-
|
|
6
|
-
import { t as createSelection } from "./createSelection-
|
|
7
|
-
import { t as createSingle } from "./createSingle-
|
|
8
|
-
import { t as createGroup } from "./createGroup-
|
|
9
|
-
import { t as toArray } from "./toArray-
|
|
10
|
-
import { a as useLocale } from "./useLocale-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
1
|
+
import { a as SUPPORTS_OBSERVER, i as SUPPORTS_MUTATION_OBSERVER, n as SUPPORTS_INTERSECTION_OBSERVER, r as SUPPORTS_MATCH_MEDIA, t as IN_BROWSER } from "./globals-BqRH_jdr.mjs";
|
|
2
|
+
import { clamp, instanceExists, isElement, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isString, isUndefined, mergeDeep, useId as useId$1 } from "./utilities/index.mjs";
|
|
3
|
+
import { i as useContext, n as createContext, t as createTrinity } from "./createTrinity-C_c8eedz.mjs";
|
|
4
|
+
import { a as createPlugin, i as useLogger, o as createPluginContext } from "./useLogger-B70T4SgK.mjs";
|
|
5
|
+
import { i as createRegistry } from "./createTokens-CMRBDlzN.mjs";
|
|
6
|
+
import { i as createModel, t as createSelection } from "./createSelection-DvOR2tKk.mjs";
|
|
7
|
+
import { t as createSingle } from "./createSingle-Bbcwcq4R.mjs";
|
|
8
|
+
import { t as createGroup } from "./createGroup-Cf6lK9BR.mjs";
|
|
9
|
+
import { t as toArray } from "./toArray-VdROPpy-.mjs";
|
|
10
|
+
import { a as useLocale } from "./useLocale-C8I_fNAS.mjs";
|
|
11
|
+
import { a as useRules, o as isStandardSchema, s as toRule } from "./useRules-7C92Xzyt.mjs";
|
|
12
|
+
import { t as MemoryAdapter } from "./memory-XCMtkld1.mjs";
|
|
13
|
+
import { computed, effectScope, isRef, nextTick, onScopeDispose, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, toRef, toValue, unref, watch, watchEffect } from "vue";
|
|
14
14
|
//#region src/composables/createBreadcrumbs/index.ts
|
|
15
15
|
/**
|
|
16
16
|
* @module createBreadcrumbs
|
|
@@ -154,7 +154,6 @@ function createBreadcrumbsContext(_options = {}) {
|
|
|
154
154
|
function useBreadcrumbs(namespace = "v0:breadcrumbs") {
|
|
155
155
|
return useContext(namespace);
|
|
156
156
|
}
|
|
157
|
-
|
|
158
157
|
//#endregion
|
|
159
158
|
//#region src/composables/useHydration/index.ts
|
|
160
159
|
/**
|
|
@@ -244,7 +243,6 @@ const [createHydrationContext, createHydrationPlugin, useHydration] = createPlug
|
|
|
244
243
|
} });
|
|
245
244
|
}
|
|
246
245
|
});
|
|
247
|
-
|
|
248
246
|
//#endregion
|
|
249
247
|
//#region src/composables/toElement/index.ts
|
|
250
248
|
/**
|
|
@@ -279,7 +277,6 @@ function toElement(target) {
|
|
|
279
277
|
if (raw instanceof Element) return raw;
|
|
280
278
|
if ("$el" in raw) return raw.$el;
|
|
281
279
|
}
|
|
282
|
-
|
|
283
280
|
//#endregion
|
|
284
281
|
//#region src/composables/createObserver/index.ts
|
|
285
282
|
/**
|
|
@@ -365,7 +362,6 @@ function createObserver(target, userCallback, config) {
|
|
|
365
362
|
stop
|
|
366
363
|
};
|
|
367
364
|
}
|
|
368
|
-
|
|
369
365
|
//#endregion
|
|
370
366
|
//#region src/composables/useResizeObserver/index.ts
|
|
371
367
|
/**
|
|
@@ -503,7 +499,6 @@ function useElementSize(target) {
|
|
|
503
499
|
stop
|
|
504
500
|
};
|
|
505
501
|
}
|
|
506
|
-
|
|
507
502
|
//#endregion
|
|
508
503
|
//#region src/composables/createOverflow/index.ts
|
|
509
504
|
/**
|
|
@@ -696,30 +691,28 @@ function createOverflowContext(_options = {}) {
|
|
|
696
691
|
function useOverflow(namespace = "v0:overflow") {
|
|
697
692
|
return useContext(namespace);
|
|
698
693
|
}
|
|
699
|
-
|
|
700
694
|
//#endregion
|
|
701
695
|
//#region src/composables/useProxyModel/index.ts
|
|
702
696
|
/**
|
|
703
697
|
* @module useProxyModel
|
|
704
698
|
*
|
|
705
699
|
* @remarks
|
|
706
|
-
* Proxy composable for bidirectional sync between
|
|
700
|
+
* Proxy composable for bidirectional sync between a model context and v-model.
|
|
707
701
|
*
|
|
708
702
|
* Key features:
|
|
709
703
|
* - Bidirectional synchronization
|
|
710
704
|
* - Array and single-value modes
|
|
711
705
|
* - Automatic cleanup on scope disposal
|
|
712
|
-
* -
|
|
706
|
+
* - Works with any ModelContext (Selection, Slider, etc.)
|
|
713
707
|
*
|
|
714
|
-
* Bridges the gap between
|
|
708
|
+
* Bridges the gap between model composables and Vue's v-model.
|
|
715
709
|
*/
|
|
716
710
|
/**
|
|
717
|
-
* Syncs a ref with a
|
|
711
|
+
* Syncs a ref with a model context bidirectionally.
|
|
718
712
|
*
|
|
719
|
-
* @param
|
|
713
|
+
* @param context The model context to bind to.
|
|
720
714
|
* @param model The ref to sync.
|
|
721
715
|
* @param options The options for the proxy model.
|
|
722
|
-
* @template Z The type of the selection ticket.
|
|
723
716
|
* @returns A function to stop the sync.
|
|
724
717
|
*
|
|
725
718
|
* @see https://0.vuetifyjs.com/composables/forms/use-proxy-model
|
|
@@ -738,8 +731,8 @@ function useOverflow(namespace = "v0:overflow") {
|
|
|
738
731
|
* const stop = useProxyModel(registry, model)
|
|
739
732
|
* ```
|
|
740
733
|
*/
|
|
741
|
-
function useProxyModel(
|
|
742
|
-
const multiple = options?.multiple ?? false;
|
|
734
|
+
function useProxyModel(context, model, options) {
|
|
735
|
+
const multiple = options?.multiple ?? context.multiple ?? false;
|
|
743
736
|
const _transformIn = options?.transformIn;
|
|
744
737
|
const _transformOut = options?.transformOut;
|
|
745
738
|
function transformIn(val) {
|
|
@@ -750,39 +743,20 @@ function useProxyModel(registry, model, options) {
|
|
|
750
743
|
if (/* @__PURE__ */ isFunction(_transformOut)) return _transformOut(val);
|
|
751
744
|
return toValue(multiple) ? val : val[0];
|
|
752
745
|
}
|
|
746
|
+
const applyOptions = toValue(multiple) === toValue(context.multiple ?? false) ? void 0 : { multiple: toValue(multiple) };
|
|
753
747
|
const modelAsArray = transformIn(model);
|
|
754
748
|
const pending = new Set(modelAsArray);
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
if (ids) {
|
|
759
|
-
for (const id of ids) registry.select(id);
|
|
760
|
-
pending.delete(value);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
const registryWatch = watch(registry.selectedValues, (val) => {
|
|
749
|
+
context.apply(modelAsArray, applyOptions);
|
|
750
|
+
for (const value of modelAsArray) if (Array.from(context.selectedValues.value).includes(value)) pending.delete(value);
|
|
751
|
+
const contextWatch = watch(context.selectedValues, (val) => {
|
|
764
752
|
modelWatch.pause();
|
|
765
753
|
model.value = transformOut(Array.from(toValue(val)));
|
|
766
754
|
modelWatch.resume();
|
|
767
755
|
}, { flush: "sync" });
|
|
768
756
|
const modelWatch = watch(model, (val) => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
for (const value of transformIn(val)) {
|
|
773
|
-
const ids = registry.browse(toRaw(value));
|
|
774
|
-
if (ids) for (const id of ids) targetIds.add(id);
|
|
775
|
-
}
|
|
776
|
-
if (toValue(multiple)) {
|
|
777
|
-
for (const id of currentIds.difference(targetIds)) registry.selectedIds.delete(id);
|
|
778
|
-
for (const id of targetIds.difference(currentIds)) registry.selectedIds.add(id);
|
|
779
|
-
} else {
|
|
780
|
-
const next = targetIds.values().next().value;
|
|
781
|
-
const last = currentIds.values().next().value;
|
|
782
|
-
if (!/* @__PURE__ */ isUndefined(last)) registry.unselect(last);
|
|
783
|
-
if (!/* @__PURE__ */ isUndefined(next)) registry.select(next);
|
|
784
|
-
}
|
|
785
|
-
registryWatch.resume();
|
|
757
|
+
contextWatch.pause();
|
|
758
|
+
context.apply(transformIn(val), applyOptions);
|
|
759
|
+
contextWatch.resume();
|
|
786
760
|
}, {
|
|
787
761
|
flush: "sync",
|
|
788
762
|
deep: toValue(multiple)
|
|
@@ -790,23 +764,22 @@ function useProxyModel(registry, model, options) {
|
|
|
790
764
|
function onRegister(data) {
|
|
791
765
|
const ticket = data;
|
|
792
766
|
if (!pending.has(ticket.value) || toValue(ticket.disabled)) return;
|
|
793
|
-
|
|
767
|
+
contextWatch.pause();
|
|
794
768
|
modelWatch.pause();
|
|
795
|
-
|
|
769
|
+
context.select?.(ticket.id);
|
|
796
770
|
pending.delete(ticket.value);
|
|
797
771
|
modelWatch.resume();
|
|
798
|
-
|
|
772
|
+
contextWatch.resume();
|
|
799
773
|
}
|
|
800
|
-
|
|
774
|
+
context.on?.("register:ticket", onRegister);
|
|
801
775
|
function stop() {
|
|
802
|
-
|
|
776
|
+
contextWatch();
|
|
803
777
|
modelWatch();
|
|
804
|
-
|
|
778
|
+
context.off?.("register:ticket", onRegister);
|
|
805
779
|
}
|
|
806
780
|
onScopeDispose(stop, true);
|
|
807
781
|
return stop;
|
|
808
782
|
}
|
|
809
|
-
|
|
810
783
|
//#endregion
|
|
811
784
|
//#region src/composables/toReactive/index.ts
|
|
812
785
|
/**
|
|
@@ -941,7 +914,6 @@ function toReactive(objectRef) {
|
|
|
941
914
|
}
|
|
942
915
|
}));
|
|
943
916
|
}
|
|
944
|
-
|
|
945
917
|
//#endregion
|
|
946
918
|
//#region src/composables/useBreakpoints/index.ts
|
|
947
919
|
/**
|
|
@@ -1008,30 +980,42 @@ function createDefaultBreakpoints() {
|
|
|
1008
980
|
* ```
|
|
1009
981
|
*/
|
|
1010
982
|
function createBreakpoints(_options = {}) {
|
|
1011
|
-
const {
|
|
983
|
+
const { ssr, ...options } = _options;
|
|
984
|
+
const { mobileBreakpoint, breakpoints } = /* @__PURE__ */ mergeDeep(createDefaultBreakpoints(), options);
|
|
1012
985
|
const sorted = Object.entries(breakpoints).toSorted((a, b) => a[1] - b[1]);
|
|
1013
986
|
const names = sorted.map(([n]) => n);
|
|
1014
987
|
const mb = /* @__PURE__ */ isNumber(mobileBreakpoint) ? mobileBreakpoint : breakpoints[mobileBreakpoint] ?? breakpoints.md;
|
|
1015
|
-
const
|
|
1016
|
-
const
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
const
|
|
1027
|
-
const
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1030
|
-
const
|
|
1031
|
-
const
|
|
1032
|
-
const
|
|
1033
|
-
const
|
|
1034
|
-
const
|
|
988
|
+
const isSSR = !IN_BROWSER && !!ssr;
|
|
989
|
+
const initialWidth = isSSR ? ssr.clientWidth : 0;
|
|
990
|
+
const initialHeight = isSSR ? ssr.clientHeight ?? 0 : 0;
|
|
991
|
+
let initialName = "xs";
|
|
992
|
+
if (isSSR) {
|
|
993
|
+
for (let i = sorted.length - 1; i >= 0; i--) if (initialWidth >= sorted[i][1]) {
|
|
994
|
+
initialName = sorted[i][0];
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
const initialIndex = names.indexOf(initialName);
|
|
999
|
+
const name = shallowRef(initialName);
|
|
1000
|
+
const width = shallowRef(initialWidth);
|
|
1001
|
+
const height = shallowRef(initialHeight);
|
|
1002
|
+
const isMobile = shallowRef(isSSR ? initialWidth < mb : true);
|
|
1003
|
+
const xs = shallowRef(initialIndex === 0);
|
|
1004
|
+
const sm = shallowRef(initialIndex === 1);
|
|
1005
|
+
const md = shallowRef(initialIndex === 2);
|
|
1006
|
+
const lg = shallowRef(initialIndex === 3);
|
|
1007
|
+
const xl = shallowRef(initialIndex === 4);
|
|
1008
|
+
const xxl = shallowRef(initialIndex === 5);
|
|
1009
|
+
const smAndUp = shallowRef(initialIndex >= 1);
|
|
1010
|
+
const mdAndUp = shallowRef(initialIndex >= 2);
|
|
1011
|
+
const lgAndUp = shallowRef(initialIndex >= 3);
|
|
1012
|
+
const xlAndUp = shallowRef(initialIndex >= 4);
|
|
1013
|
+
const xxlAndUp = shallowRef(initialIndex >= 5);
|
|
1014
|
+
const smAndDown = shallowRef(initialIndex <= 1);
|
|
1015
|
+
const mdAndDown = shallowRef(initialIndex <= 2);
|
|
1016
|
+
const lgAndDown = shallowRef(initialIndex <= 3);
|
|
1017
|
+
const xlAndDown = shallowRef(initialIndex <= 4);
|
|
1018
|
+
const xxlAndDown = shallowRef(initialIndex <= 5);
|
|
1035
1019
|
function update() {
|
|
1036
1020
|
if (!IN_BROWSER) return;
|
|
1037
1021
|
width.value = window.innerWidth;
|
|
@@ -1083,10 +1067,12 @@ function createBreakpoints(_options = {}) {
|
|
|
1083
1067
|
lgAndDown: readonly(lgAndDown),
|
|
1084
1068
|
xlAndDown: readonly(xlAndDown),
|
|
1085
1069
|
xxlAndDown: readonly(xxlAndDown),
|
|
1070
|
+
ssr: isSSR,
|
|
1086
1071
|
update
|
|
1087
1072
|
};
|
|
1088
1073
|
}
|
|
1089
|
-
function createBreakpointsFallback() {
|
|
1074
|
+
function createBreakpointsFallback(options = {}) {
|
|
1075
|
+
if (options.ssr) return createBreakpoints(options);
|
|
1090
1076
|
return {
|
|
1091
1077
|
breakpoints: createDefaultBreakpoints().breakpoints,
|
|
1092
1078
|
name: readonly(shallowRef("xs")),
|
|
@@ -1109,12 +1095,14 @@ function createBreakpointsFallback() {
|
|
|
1109
1095
|
lgAndDown: readonly(shallowRef(false)),
|
|
1110
1096
|
xlAndDown: readonly(shallowRef(false)),
|
|
1111
1097
|
xxlAndDown: readonly(shallowRef(false)),
|
|
1098
|
+
ssr: false,
|
|
1112
1099
|
update: () => {}
|
|
1113
1100
|
};
|
|
1114
1101
|
}
|
|
1115
1102
|
const [createBreakpointsContext, createBreakpointsPlugin, useBreakpoints] = createPluginContext("v0:breakpoints", (options) => createBreakpoints(options), {
|
|
1116
1103
|
fallback: () => createBreakpointsFallback(),
|
|
1117
1104
|
setup: (context, app, _options) => {
|
|
1105
|
+
if (IN_BROWSER) context.update();
|
|
1118
1106
|
app.mixin({ mounted() {
|
|
1119
1107
|
if (!/* @__PURE__ */ isNull(this.$parent)) return;
|
|
1120
1108
|
const hydration = useHydration();
|
|
@@ -1132,7 +1120,6 @@ const [createBreakpointsContext, createBreakpointsPlugin, useBreakpoints] = crea
|
|
|
1132
1120
|
} });
|
|
1133
1121
|
}
|
|
1134
1122
|
});
|
|
1135
|
-
|
|
1136
1123
|
//#endregion
|
|
1137
1124
|
//#region src/composables/useDate/index.ts
|
|
1138
1125
|
/**
|
|
@@ -1342,160 +1329,98 @@ function useDate(namespace = "v0:date") {
|
|
|
1342
1329
|
if (!instanceExists()) throw new Error("[v0] useDate() must be called inside a Vue component with createDatePlugin installed.\n\nExample:\n import { Vuetify0DateAdapter } from '@vuetify/v0/date'\n import { createDatePlugin } from '@vuetify/v0'\n\n app.use(createDatePlugin({ adapter: new Vuetify0DateAdapter() }))");
|
|
1343
1330
|
return useContext(namespace);
|
|
1344
1331
|
}
|
|
1345
|
-
|
|
1346
1332
|
//#endregion
|
|
1347
1333
|
//#region src/composables/createForm/index.ts
|
|
1348
1334
|
/**
|
|
1349
1335
|
* @module createForm
|
|
1350
1336
|
*
|
|
1351
1337
|
* @remarks
|
|
1352
|
-
* Form
|
|
1338
|
+
* Form composable that coordinates validation across multiple fields.
|
|
1353
1339
|
*
|
|
1354
1340
|
* Key features:
|
|
1355
|
-
* -
|
|
1356
|
-
* -
|
|
1357
|
-
* -
|
|
1358
|
-
* -
|
|
1359
|
-
* -
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1341
|
+
* - Pure registry of ValidationContext instances
|
|
1342
|
+
* - Validations auto-register via useForm() injection
|
|
1343
|
+
* - Form-level submit, reset, and aggregate state
|
|
1344
|
+
* - Exposes disabled/readonly refs for component consumption
|
|
1345
|
+
* - Trinity pattern for DI
|
|
1346
|
+
*
|
|
1347
|
+
* Per-field validation logic lives in createValidation.
|
|
1348
|
+
* createForm is the mothership — it coordinates, not creates.
|
|
1363
1349
|
*/
|
|
1364
1350
|
/**
|
|
1365
1351
|
* Creates a new form instance.
|
|
1366
1352
|
*
|
|
1353
|
+
* A form is a pure registry of validation contexts. Validations register
|
|
1354
|
+
* themselves via `useForm()` injection. The form coordinates submit, reset,
|
|
1355
|
+
* and aggregate state across all registered validations.
|
|
1356
|
+
*
|
|
1367
1357
|
* @param options The options for the form instance.
|
|
1368
|
-
* @
|
|
1369
|
-
* @template E The type of the form context.
|
|
1370
|
-
* @returns A new form instance.
|
|
1358
|
+
* @returns A new form context.
|
|
1371
1359
|
*
|
|
1372
1360
|
* @see https://0.vuetifyjs.com/composables/forms/create-form
|
|
1373
1361
|
*
|
|
1374
1362
|
* @example
|
|
1375
1363
|
* ```ts
|
|
1376
|
-
* import { createForm } from '@vuetify/v0'
|
|
1364
|
+
* import { createForm, createValidation } from '@vuetify/v0'
|
|
1377
1365
|
*
|
|
1378
1366
|
* const form = createForm()
|
|
1379
1367
|
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1368
|
+
* // Validations register themselves — form is just the coordinator
|
|
1369
|
+
* const validation = createValidation()
|
|
1370
|
+
* const email = validation.register({
|
|
1371
|
+
* id: 'email',
|
|
1382
1372
|
* value: '',
|
|
1383
|
-
* rules: [
|
|
1373
|
+
* rules: ['required', 'email'],
|
|
1384
1374
|
* })
|
|
1385
1375
|
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
* console.log(username.errors.value) // ['Username is required']
|
|
1376
|
+
* form.register({ value: validation })
|
|
1389
1377
|
*
|
|
1378
|
+
* await form.submit()
|
|
1390
1379
|
* form.reset()
|
|
1391
1380
|
* ```
|
|
1392
1381
|
*/
|
|
1393
1382
|
function createForm(options) {
|
|
1394
1383
|
const registry = createRegistry(options);
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1384
|
+
const disabled = shallowRef(false);
|
|
1385
|
+
const readonly = shallowRef(false);
|
|
1386
|
+
if (!/* @__PURE__ */ isNullOrUndefined(options?.disabled)) disabled.value = toValue(options.disabled) ?? false;
|
|
1387
|
+
if (!/* @__PURE__ */ isNullOrUndefined(options?.readonly)) readonly.value = toValue(options.readonly) ?? false;
|
|
1399
1388
|
const isValidating = computed(() => {
|
|
1400
|
-
for (const ticket of registry.values()) if (ticket.isValidating.value) return true;
|
|
1389
|
+
for (const ticket of registry.values()) if (ticket.value.isValidating.value) return true;
|
|
1401
1390
|
return false;
|
|
1402
1391
|
});
|
|
1403
1392
|
const isValid = computed(() => {
|
|
1393
|
+
let hasNull = false;
|
|
1404
1394
|
let hasFields = false;
|
|
1405
1395
|
for (const ticket of registry.values()) {
|
|
1406
1396
|
hasFields = true;
|
|
1407
|
-
if (ticket.isValid.value === false) return false;
|
|
1408
|
-
if (/* @__PURE__ */ isNull(ticket.isValid.value))
|
|
1397
|
+
if (ticket.value.isValid.value === false) return false;
|
|
1398
|
+
if (/* @__PURE__ */ isNull(ticket.value.isValid.value)) hasNull = true;
|
|
1409
1399
|
}
|
|
1410
|
-
|
|
1400
|
+
if (!hasFields) return null;
|
|
1401
|
+
return hasNull ? null : true;
|
|
1411
1402
|
});
|
|
1412
|
-
function reset() {
|
|
1413
|
-
for (const ticket of registry.values()) ticket.reset();
|
|
1414
|
-
}
|
|
1415
|
-
async function submit() {
|
|
1416
|
-
return validate([...registry.keys()]);
|
|
1417
|
-
}
|
|
1418
|
-
async function validate(id) {
|
|
1419
|
-
const validating = toArray(id);
|
|
1420
|
-
return (await Promise.all(validating.map(async (id$1) => await registry.get(id$1)?.validate() ?? true))).every(Boolean);
|
|
1421
|
-
}
|
|
1422
1403
|
function register(registration) {
|
|
1423
|
-
|
|
1424
|
-
const rules = registration.rules || [];
|
|
1425
|
-
const errors = shallowRef([]);
|
|
1426
|
-
const isValidating$1 = shallowRef(false);
|
|
1427
|
-
const initialValue = model.value;
|
|
1428
|
-
const triggers = registration.validateOn || validateOn;
|
|
1429
|
-
const isPristine = shallowRef(true);
|
|
1430
|
-
const isValid$1 = shallowRef(null);
|
|
1431
|
-
function _validatesOn(event) {
|
|
1432
|
-
return parse(triggers).includes(event);
|
|
1433
|
-
}
|
|
1434
|
-
function _reset() {
|
|
1435
|
-
model.value = initialValue;
|
|
1436
|
-
errors.value = [];
|
|
1437
|
-
isPristine.value = true;
|
|
1438
|
-
isValid$1.value = null;
|
|
1439
|
-
isValidating$1.value = false;
|
|
1440
|
-
validationGeneration++;
|
|
1441
|
-
}
|
|
1442
|
-
let validationGeneration = 0;
|
|
1443
|
-
async function validate$1(silent = false) {
|
|
1444
|
-
if (rules.length === 0) return isValid$1.value = true;
|
|
1445
|
-
const generation = ++validationGeneration;
|
|
1446
|
-
isValidating$1.value = true;
|
|
1447
|
-
try {
|
|
1448
|
-
const results = await Promise.all(rules.map((rule) => rule(model.value)));
|
|
1449
|
-
if (generation !== validationGeneration) return isValid$1.value ?? false;
|
|
1450
|
-
const errorMessages = results.filter((result) => /* @__PURE__ */ isString(result));
|
|
1451
|
-
if (!silent) {
|
|
1452
|
-
errors.value = errorMessages;
|
|
1453
|
-
isValid$1.value = errorMessages.length === 0;
|
|
1454
|
-
isPristine.value = toValue(model) === initialValue;
|
|
1455
|
-
}
|
|
1456
|
-
return errorMessages.length === 0;
|
|
1457
|
-
} finally {
|
|
1458
|
-
if (generation === validationGeneration) isValidating$1.value = false;
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
const item = {
|
|
1462
|
-
...registration,
|
|
1463
|
-
rules,
|
|
1464
|
-
errors,
|
|
1465
|
-
disabled: registration.disabled || false,
|
|
1466
|
-
validateOn: triggers,
|
|
1467
|
-
isValidating: isValidating$1,
|
|
1468
|
-
isPristine,
|
|
1469
|
-
isValid: isValid$1,
|
|
1470
|
-
reset: _reset,
|
|
1471
|
-
validate: validate$1
|
|
1472
|
-
};
|
|
1473
|
-
const ticket = registry.register(item);
|
|
1474
|
-
Object.defineProperty(ticket, "value", {
|
|
1475
|
-
get() {
|
|
1476
|
-
return model.value;
|
|
1477
|
-
},
|
|
1478
|
-
set(val) {
|
|
1479
|
-
model.value = val;
|
|
1480
|
-
isPristine.value = val === initialValue;
|
|
1481
|
-
isValid$1.value = null;
|
|
1482
|
-
if (_validatesOn("change")) validate$1();
|
|
1483
|
-
},
|
|
1484
|
-
enumerable: true,
|
|
1485
|
-
configurable: true
|
|
1486
|
-
});
|
|
1487
|
-
return ticket;
|
|
1404
|
+
return registry.register(registration);
|
|
1488
1405
|
}
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1406
|
+
function reset() {
|
|
1407
|
+
for (const ticket of registry.values()) for (const field of ticket.value.values()) field.reset();
|
|
1408
|
+
}
|
|
1409
|
+
async function submit(id) {
|
|
1410
|
+
const ids = id ? toArray(id) : [...registry.keys()];
|
|
1411
|
+
return (await Promise.all(ids.map(async (id) => {
|
|
1412
|
+
const ticket = registry.get(id);
|
|
1413
|
+
if (!ticket) return true;
|
|
1414
|
+
return (await Promise.all([...ticket.value.values()].map((field) => field.validate()))).every(Boolean);
|
|
1415
|
+
}))).every(Boolean);
|
|
1491
1416
|
}
|
|
1492
1417
|
return {
|
|
1493
1418
|
...registry,
|
|
1494
1419
|
register,
|
|
1495
|
-
onboard,
|
|
1496
|
-
reset,
|
|
1497
1420
|
submit,
|
|
1498
|
-
|
|
1421
|
+
reset,
|
|
1422
|
+
disabled,
|
|
1423
|
+
readonly,
|
|
1499
1424
|
isValid,
|
|
1500
1425
|
isValidating,
|
|
1501
1426
|
get size() {
|
|
@@ -1504,12 +1429,10 @@ function createForm(options) {
|
|
|
1504
1429
|
};
|
|
1505
1430
|
}
|
|
1506
1431
|
/**
|
|
1507
|
-
* Creates a new form context.
|
|
1432
|
+
* Creates a new form context using the Trinity pattern.
|
|
1508
1433
|
*
|
|
1509
1434
|
* @param options The options for the form context.
|
|
1510
|
-
* @
|
|
1511
|
-
* @template E The type of the form context.
|
|
1512
|
-
* @returns A new form context.
|
|
1435
|
+
* @returns A Trinity tuple: [useFormContext, provideFormContext, formContext]
|
|
1513
1436
|
*
|
|
1514
1437
|
* @see https://0.vuetifyjs.com/composables/forms/create-form
|
|
1515
1438
|
*
|
|
@@ -1517,21 +1440,7 @@ function createForm(options) {
|
|
|
1517
1440
|
* ```ts
|
|
1518
1441
|
* import { createFormContext } from '@vuetify/v0'
|
|
1519
1442
|
*
|
|
1520
|
-
*
|
|
1521
|
-
* export const [useMyForm, provideMyForm, myForm] = createFormContext({ validateOn: 'change' })
|
|
1522
|
-
*
|
|
1523
|
-
* // Or with custom namespace
|
|
1524
|
-
* export const [useMyForm, provideMyForm, myForm] = createFormContext({
|
|
1525
|
-
* namespace: 'my-form',
|
|
1526
|
-
* validateOn: 'change',
|
|
1527
|
-
* })
|
|
1528
|
-
*
|
|
1529
|
-
* // In a parent component:
|
|
1530
|
-
* provideMyForm()
|
|
1531
|
-
*
|
|
1532
|
-
* // In a child component:
|
|
1533
|
-
* const form = useMyForm()
|
|
1534
|
-
* form.register({ id: 'field', value: ref(''), rules: [...] })
|
|
1443
|
+
* export const [useMyForm, provideMyForm, myForm] = createFormContext()
|
|
1535
1444
|
* ```
|
|
1536
1445
|
*/
|
|
1537
1446
|
function createFormContext(_options = {}) {
|
|
@@ -1547,7 +1456,7 @@ function createFormContext(_options = {}) {
|
|
|
1547
1456
|
* Returns the current form instance.
|
|
1548
1457
|
*
|
|
1549
1458
|
* @param namespace The namespace for the form context. Defaults to `'v0:form'`.
|
|
1550
|
-
* @returns The current form instance.
|
|
1459
|
+
* @returns The current form instance, or undefined if not provided.
|
|
1551
1460
|
*
|
|
1552
1461
|
* @see https://0.vuetifyjs.com/composables/forms/create-form
|
|
1553
1462
|
*
|
|
@@ -1558,18 +1467,15 @@ function createFormContext(_options = {}) {
|
|
|
1558
1467
|
*
|
|
1559
1468
|
* const form = useForm()
|
|
1560
1469
|
* <\/script>
|
|
1561
|
-
*
|
|
1562
|
-
* <template>
|
|
1563
|
-
* <div>
|
|
1564
|
-
* <p>Form is {{ form.isValid.value ? 'valid' : 'invalid' }}</p>
|
|
1565
|
-
* </div>
|
|
1566
|
-
* </template>
|
|
1567
1470
|
* ```
|
|
1568
1471
|
*/
|
|
1569
1472
|
function useForm(namespace = "v0:form") {
|
|
1570
|
-
|
|
1473
|
+
try {
|
|
1474
|
+
return useContext(namespace);
|
|
1475
|
+
} catch {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1571
1478
|
}
|
|
1572
|
-
|
|
1573
1479
|
//#endregion
|
|
1574
1480
|
//#region src/composables/useHotkey/aliases.ts
|
|
1575
1481
|
/**
|
|
@@ -1591,6 +1497,9 @@ const keyAliasMap = {
|
|
|
1591
1497
|
space: " ",
|
|
1592
1498
|
return: "enter",
|
|
1593
1499
|
del: "delete",
|
|
1500
|
+
plus: "+",
|
|
1501
|
+
slash: "/",
|
|
1502
|
+
underscore: "_",
|
|
1594
1503
|
minus: "-",
|
|
1595
1504
|
hyphen: "-"
|
|
1596
1505
|
};
|
|
@@ -1598,7 +1507,6 @@ function normalizeKey(key) {
|
|
|
1598
1507
|
const lowerKey = key.toLowerCase();
|
|
1599
1508
|
return keyAliasMap[lowerKey] ?? lowerKey;
|
|
1600
1509
|
}
|
|
1601
|
-
|
|
1602
1510
|
//#endregion
|
|
1603
1511
|
//#region src/composables/useHotkey/parsing.ts
|
|
1604
1512
|
const logger = useLogger();
|
|
@@ -1636,7 +1544,7 @@ function splitKeyCombination(combination, isInternal = false) {
|
|
|
1636
1544
|
"++",
|
|
1637
1545
|
"//",
|
|
1638
1546
|
"__"
|
|
1639
|
-
].some((v) => combination.startsWith(v)) || combination.includes("++") || combination.includes("__") || combination === "+" || combination === "_" || combination.length > 1 && (combination.endsWith("+") || combination.endsWith("_")) && combination.at(-2) !== combination.at(-1) || combination === "++" || combination === "--" || combination === "__") {
|
|
1547
|
+
].some((v) => combination.startsWith(v)) || combination.includes("++") || combination.includes("//") || combination.includes("__") || combination === "+" || combination === "/" || combination === "_" || combination.length > 1 && (combination.endsWith("+") || combination.endsWith("/") || combination.endsWith("_")) && combination.at(-2) !== combination.at(-1) || combination === "++" || combination === "--" || combination === "__") {
|
|
1640
1548
|
if (!isInternal) logger.warn(`Invalid hotkey combination: "${combination}" has invalid structure`);
|
|
1641
1549
|
return emptyResult;
|
|
1642
1550
|
}
|
|
@@ -1702,7 +1610,11 @@ function splitKeySequence(str) {
|
|
|
1702
1610
|
logger.warn("Invalid hotkey sequence: empty string provided");
|
|
1703
1611
|
return [];
|
|
1704
1612
|
}
|
|
1705
|
-
const hasInvalidStart = str.startsWith("-") && ![
|
|
1613
|
+
const hasInvalidStart = str.startsWith("-") && ![
|
|
1614
|
+
"-",
|
|
1615
|
+
"---",
|
|
1616
|
+
"--+"
|
|
1617
|
+
].includes(str);
|
|
1706
1618
|
const hasInvalidEnd = str.endsWith("-") && !str.endsWith("+-") && !str.endsWith("_-") && str !== "-" && str !== "---";
|
|
1707
1619
|
if (hasInvalidStart || hasInvalidEnd) {
|
|
1708
1620
|
logger.warn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
|
|
@@ -1751,7 +1663,6 @@ function splitKeySequence(str) {
|
|
|
1751
1663
|
/* v8 ignore stop */
|
|
1752
1664
|
return collapsed;
|
|
1753
1665
|
}
|
|
1754
|
-
|
|
1755
1666
|
//#endregion
|
|
1756
1667
|
//#region src/composables/useHotkey/index.ts
|
|
1757
1668
|
/**
|
|
@@ -1942,7 +1853,6 @@ function matchesKeyGroup(e, group, platformIsMac) {
|
|
|
1942
1853
|
if (/* @__PURE__ */ isUndefined(actualKey)) return modifiersMatch;
|
|
1943
1854
|
return modifiersMatch && e.key.toLowerCase() === actualKey.toLowerCase();
|
|
1944
1855
|
}
|
|
1945
|
-
|
|
1946
1856
|
//#endregion
|
|
1947
1857
|
//#region src/composables/useIntersectionObserver/index.ts
|
|
1948
1858
|
/**
|
|
@@ -2101,7 +2011,6 @@ function useElementIntersection(target, options = {}) {
|
|
|
2101
2011
|
stop
|
|
2102
2012
|
};
|
|
2103
2013
|
}
|
|
2104
|
-
|
|
2105
2014
|
//#endregion
|
|
2106
2015
|
//#region src/composables/useLazy/index.ts
|
|
2107
2016
|
/**
|
|
@@ -2186,7 +2095,6 @@ function useLazy(active, options = {}) {
|
|
|
2186
2095
|
onAfterLeave
|
|
2187
2096
|
};
|
|
2188
2097
|
}
|
|
2189
|
-
|
|
2190
2098
|
//#endregion
|
|
2191
2099
|
//#region src/composables/useMediaQuery/index.ts
|
|
2192
2100
|
/**
|
|
@@ -2303,7 +2211,6 @@ function usePrefersReducedMotion() {
|
|
|
2303
2211
|
function usePrefersContrast() {
|
|
2304
2212
|
return useMediaQuery("(prefers-contrast: more)");
|
|
2305
2213
|
}
|
|
2306
|
-
|
|
2307
2214
|
//#endregion
|
|
2308
2215
|
//#region src/composables/useMutationObserver/index.ts
|
|
2309
2216
|
/**
|
|
@@ -2414,7 +2321,6 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
2414
2321
|
onceIncludesImmediate: true
|
|
2415
2322
|
});
|
|
2416
2323
|
}
|
|
2417
|
-
|
|
2418
2324
|
//#endregion
|
|
2419
2325
|
//#region src/composables/createNested/strategies.ts
|
|
2420
2326
|
/**
|
|
@@ -2456,7 +2362,6 @@ const singleOpenStrategy = {
|
|
|
2456
2362
|
},
|
|
2457
2363
|
onClose: void 0
|
|
2458
2364
|
};
|
|
2459
|
-
|
|
2460
2365
|
//#endregion
|
|
2461
2366
|
//#region src/composables/createNested/index.ts
|
|
2462
2367
|
/**
|
|
@@ -2523,7 +2428,7 @@ function createNested(_options = {}) {
|
|
|
2523
2428
|
const multipleOption = _options.multiple ?? true;
|
|
2524
2429
|
const resolvedOpenStrategy = openStrategy ?? resolveOpenStrategy(openMode);
|
|
2525
2430
|
const group = createGroup(options);
|
|
2526
|
-
const logger
|
|
2431
|
+
const logger = useLogger();
|
|
2527
2432
|
const children = shallowReactive(/* @__PURE__ */ new Map());
|
|
2528
2433
|
const parents = shallowReactive(/* @__PURE__ */ new Map());
|
|
2529
2434
|
const openedIds = shallowReactive(/* @__PURE__ */ new Set());
|
|
@@ -2807,7 +2712,7 @@ function createNested(_options = {}) {
|
|
|
2807
2712
|
const id = registration.id ?? /* @__PURE__ */ useId$1();
|
|
2808
2713
|
const parentId = registration.parentId;
|
|
2809
2714
|
const nested = registration.children;
|
|
2810
|
-
if (!/* @__PURE__ */ isUndefined(parentId) && !group.has(parentId)) logger
|
|
2715
|
+
if (!/* @__PURE__ */ isUndefined(parentId) && !group.has(parentId)) logger.warn(`Parent with id "${parentId}" does not exist. Registering "${id}" without parent.`);
|
|
2811
2716
|
if (!/* @__PURE__ */ isUndefined(parentId) && group.has(parentId)) {
|
|
2812
2717
|
if (batching) {
|
|
2813
2718
|
pendingParents.set(id, parentId);
|
|
@@ -2866,9 +2771,9 @@ function createNested(_options = {}) {
|
|
|
2866
2771
|
if (!group.has(id)) return;
|
|
2867
2772
|
const parentId = parents.get(id);
|
|
2868
2773
|
if (!/* @__PURE__ */ isUndefined(parentId)) {
|
|
2869
|
-
const siblings
|
|
2870
|
-
if (siblings
|
|
2871
|
-
const filtered = siblings
|
|
2774
|
+
const siblings = children.get(parentId);
|
|
2775
|
+
if (siblings) {
|
|
2776
|
+
const filtered = siblings.filter((sid) => sid !== id);
|
|
2872
2777
|
if (filtered.length === 0) children.delete(parentId);
|
|
2873
2778
|
else children.set(parentId, filtered);
|
|
2874
2779
|
}
|
|
@@ -2928,10 +2833,15 @@ function createNested(_options = {}) {
|
|
|
2928
2833
|
openedIds.clear();
|
|
2929
2834
|
activeIds.clear();
|
|
2930
2835
|
rootIds.clear();
|
|
2931
|
-
group.
|
|
2836
|
+
group.clear();
|
|
2932
2837
|
}
|
|
2933
2838
|
function reset() {
|
|
2934
|
-
clear();
|
|
2839
|
+
children.clear();
|
|
2840
|
+
parents.clear();
|
|
2841
|
+
openedIds.clear();
|
|
2842
|
+
activeIds.clear();
|
|
2843
|
+
rootIds.clear();
|
|
2844
|
+
group.reset();
|
|
2935
2845
|
}
|
|
2936
2846
|
const context = {
|
|
2937
2847
|
...group,
|
|
@@ -3021,7 +2931,6 @@ function createNestedContext(_options = {}) {
|
|
|
3021
2931
|
function useNested(namespace = "v0:nested") {
|
|
3022
2932
|
return useContext(namespace);
|
|
3023
2933
|
}
|
|
3024
|
-
|
|
3025
2934
|
//#endregion
|
|
3026
2935
|
//#region src/composables/createQueue/index.ts
|
|
3027
2936
|
/**
|
|
@@ -3086,7 +2995,7 @@ function createQueue(_options = {}) {
|
|
|
3086
2995
|
}, ticket.timeout);
|
|
3087
2996
|
timeouts.set(ticket.id, timeout);
|
|
3088
2997
|
}
|
|
3089
|
-
function clearTimeout
|
|
2998
|
+
function clearTimeout(id) {
|
|
3090
2999
|
const timeout = timeouts.get(id);
|
|
3091
3000
|
if (timeout) {
|
|
3092
3001
|
globalThis.clearTimeout(timeout);
|
|
@@ -3111,7 +3020,7 @@ function createQueue(_options = {}) {
|
|
|
3111
3020
|
const ticket = /* @__PURE__ */ isUndefined(id) ? registry.seek("first") : registry.get(id);
|
|
3112
3021
|
if (!ticket) return void 0;
|
|
3113
3022
|
const wasFirst = ticket.index === 0;
|
|
3114
|
-
clearTimeout
|
|
3023
|
+
clearTimeout(ticket.id);
|
|
3115
3024
|
registry.unregister(ticket.id);
|
|
3116
3025
|
if (wasFirst) resume();
|
|
3117
3026
|
return ticket;
|
|
@@ -3122,7 +3031,7 @@ function createQueue(_options = {}) {
|
|
|
3122
3031
|
const ticket = registry.get(id);
|
|
3123
3032
|
if (!ticket) continue;
|
|
3124
3033
|
if (ticket.index === 0) hadFirst = true;
|
|
3125
|
-
clearTimeout
|
|
3034
|
+
clearTimeout(ticket.id);
|
|
3126
3035
|
}
|
|
3127
3036
|
registry.offboard(ids);
|
|
3128
3037
|
if (hadFirst) resume();
|
|
@@ -3130,7 +3039,7 @@ function createQueue(_options = {}) {
|
|
|
3130
3039
|
function pause() {
|
|
3131
3040
|
const ticket = registry.seek("first");
|
|
3132
3041
|
if (!ticket || ticket.isPaused) return void 0;
|
|
3133
|
-
clearTimeout
|
|
3042
|
+
clearTimeout(ticket.id);
|
|
3134
3043
|
return registry.upsert(ticket.id, { isPaused: true });
|
|
3135
3044
|
}
|
|
3136
3045
|
function resume() {
|
|
@@ -3141,7 +3050,7 @@ function createQueue(_options = {}) {
|
|
|
3141
3050
|
return updated;
|
|
3142
3051
|
}
|
|
3143
3052
|
function clear() {
|
|
3144
|
-
for (const id of timeouts.keys()) clearTimeout
|
|
3053
|
+
for (const id of timeouts.keys()) clearTimeout(id);
|
|
3145
3054
|
registry.clear();
|
|
3146
3055
|
}
|
|
3147
3056
|
function dispose() {
|
|
@@ -3215,7 +3124,254 @@ function createQueueContext(_options = {}) {
|
|
|
3215
3124
|
function useQueue(namespace = "v0:queue") {
|
|
3216
3125
|
return useContext(namespace);
|
|
3217
3126
|
}
|
|
3218
|
-
|
|
3127
|
+
//#endregion
|
|
3128
|
+
//#region src/composables/useRtl/adapters/v0.ts
|
|
3129
|
+
var Vuetify0RtlAdapter = class {
|
|
3130
|
+
setup(app, context, target) {
|
|
3131
|
+
if (IN_BROWSER) {
|
|
3132
|
+
if (/* @__PURE__ */ isNull(target)) return;
|
|
3133
|
+
const targetEl = target instanceof HTMLElement ? target : /* @__PURE__ */ isString(target) ? document.querySelector(target) : document.documentElement;
|
|
3134
|
+
if (!targetEl) return;
|
|
3135
|
+
targetEl.dir = context.isRtl.value ? "rtl" : "ltr";
|
|
3136
|
+
onScopeDispose(watch(context.isRtl, (value) => {
|
|
3137
|
+
targetEl.dir = value ? "rtl" : "ltr";
|
|
3138
|
+
}), true);
|
|
3139
|
+
} else {
|
|
3140
|
+
const head = app._context?.provides?.usehead ?? app._context?.provides?.head;
|
|
3141
|
+
if (head?.push) head.push({ htmlAttrs: { dir: context.isRtl.value ? "rtl" : "ltr" } });
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
};
|
|
3145
|
+
//#endregion
|
|
3146
|
+
//#region src/composables/useRtl/index.ts
|
|
3147
|
+
/**
|
|
3148
|
+
* @module useRtl
|
|
3149
|
+
*
|
|
3150
|
+
* @remarks
|
|
3151
|
+
* RTL (right-to-left) direction composable with adapter pattern.
|
|
3152
|
+
*
|
|
3153
|
+
* Key features:
|
|
3154
|
+
* - Reactive boolean direction state
|
|
3155
|
+
* - Plugin trinity pattern (createRtlContext, createRtlPlugin, useRtl)
|
|
3156
|
+
* - Adapter pattern for DOM integration (dir attribute)
|
|
3157
|
+
* - Subtree overrides via context provision
|
|
3158
|
+
*
|
|
3159
|
+
* Independent from useLocale — Vuetify connects them via adapter.
|
|
3160
|
+
*/
|
|
3161
|
+
/**
|
|
3162
|
+
* Creates a new RTL direction instance.
|
|
3163
|
+
*
|
|
3164
|
+
* @param options The options for the RTL instance.
|
|
3165
|
+
* @returns A new RTL context with reactive direction state.
|
|
3166
|
+
*
|
|
3167
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-rtl
|
|
3168
|
+
*/
|
|
3169
|
+
function createRtl(options = {}) {
|
|
3170
|
+
const isRtl = shallowRef(options.default ?? false);
|
|
3171
|
+
function toggle() {
|
|
3172
|
+
isRtl.value = !isRtl.value;
|
|
3173
|
+
}
|
|
3174
|
+
return {
|
|
3175
|
+
isRtl,
|
|
3176
|
+
toggle
|
|
3177
|
+
};
|
|
3178
|
+
}
|
|
3179
|
+
function createRtlFallback() {
|
|
3180
|
+
return {
|
|
3181
|
+
isRtl: shallowRef(false),
|
|
3182
|
+
toggle: () => {}
|
|
3183
|
+
};
|
|
3184
|
+
}
|
|
3185
|
+
const [createRtlContext, createRtlPlugin, useRtl] = createPluginContext("v0:rtl", (options) => createRtl(options), {
|
|
3186
|
+
fallback: () => createRtlFallback(),
|
|
3187
|
+
setup: (context, app, { adapter = new Vuetify0RtlAdapter(), target }) => {
|
|
3188
|
+
adapter.setup(app, context, target);
|
|
3189
|
+
}
|
|
3190
|
+
});
|
|
3191
|
+
//#endregion
|
|
3192
|
+
//#region src/composables/createSlider/index.ts
|
|
3193
|
+
/**
|
|
3194
|
+
* @module createSlider
|
|
3195
|
+
*
|
|
3196
|
+
* @see https://0.vuetifyjs.com/composables/forms/create-slider
|
|
3197
|
+
*
|
|
3198
|
+
* @remarks
|
|
3199
|
+
* Composable for managing slider state: value math, step snapping,
|
|
3200
|
+
* percentage conversion, and multi-thumb value operations.
|
|
3201
|
+
*
|
|
3202
|
+
* Extends createModel for useProxyModel compatibility:
|
|
3203
|
+
* - createRegistry → createModel → createSlider (ticket-per-thumb)
|
|
3204
|
+
*
|
|
3205
|
+
* Each thumb is a model ticket with a `shallowRef<number>` value.
|
|
3206
|
+
* Values are derived from ordered tickets, not a standalone ref.
|
|
3207
|
+
*
|
|
3208
|
+
* Designed for single-thumb, range, and multi-thumb sliders.
|
|
3209
|
+
* Also reusable for color picker tracks, media scrubbers,
|
|
3210
|
+
* gradient editors, and other 1D value-on-track controls.
|
|
3211
|
+
*/
|
|
3212
|
+
/**
|
|
3213
|
+
* Creates slider state with value math, step snapping, and multi-thumb support.
|
|
3214
|
+
*
|
|
3215
|
+
* Extends createModel for useProxyModel compatibility. Each thumb is a model
|
|
3216
|
+
* ticket with a shallowRef<number> value. Values are derived from the ordered
|
|
3217
|
+
* tickets, enabling proper registration/unregistration lifecycle.
|
|
3218
|
+
*
|
|
3219
|
+
* @param options Slider configuration.
|
|
3220
|
+
* @returns Slider context with values, math functions, and thumb operations.
|
|
3221
|
+
*
|
|
3222
|
+
* @see https://0.vuetifyjs.com/composables/forms/create-slider
|
|
3223
|
+
* @see {@link createModel} for the base model composable.
|
|
3224
|
+
*
|
|
3225
|
+
* @example Single thumb
|
|
3226
|
+
* ```ts
|
|
3227
|
+
* import { createSlider } from '@vuetify/v0'
|
|
3228
|
+
*
|
|
3229
|
+
* const slider = createSlider({ min: 0, max: 100, step: 5 })
|
|
3230
|
+
* const ticket = slider.register({ value: 50 })
|
|
3231
|
+
* slider.up(0) // values: [55]
|
|
3232
|
+
* slider.fromValue(50) // 50
|
|
3233
|
+
* ```
|
|
3234
|
+
*
|
|
3235
|
+
* @example Range slider
|
|
3236
|
+
* ```ts
|
|
3237
|
+
* import { createSlider } from '@vuetify/v0'
|
|
3238
|
+
*
|
|
3239
|
+
* const slider = createSlider({ min: 0, max: 100, step: 1, range: true })
|
|
3240
|
+
* slider.register({ value: 25 })
|
|
3241
|
+
* slider.register({ value: 75 })
|
|
3242
|
+
* slider.set(0, 30) // values: [30, 75]
|
|
3243
|
+
* slider.set(1, 60) // values: [30, 60]
|
|
3244
|
+
* ```
|
|
3245
|
+
*
|
|
3246
|
+
* @example Custom pointer interaction (media scrubber)
|
|
3247
|
+
* ```ts
|
|
3248
|
+
* import { createSlider } from '@vuetify/v0'
|
|
3249
|
+
*
|
|
3250
|
+
* const slider = createSlider({ min: 0, max: 217, step: 0.1 })
|
|
3251
|
+
* slider.register({ value: 0 })
|
|
3252
|
+
*
|
|
3253
|
+
* // pointer → fromPercent → set → fromValue → UI
|
|
3254
|
+
* const percent = (clientX - rect.left) / rect.width * 100
|
|
3255
|
+
* slider.set(0, slider.fromPercent(percent))
|
|
3256
|
+
* const position = slider.fromValue(slider.values.value[0])
|
|
3257
|
+
* ```
|
|
3258
|
+
*/
|
|
3259
|
+
function createSlider(options = {}) {
|
|
3260
|
+
const { min = 0, max = 100, step = 1, disabled: disabledProp = false, readonly: readonlyProp = false, orientation: orientationProp = "horizontal", inverted: invertedProp = false, minStepsBetweenThumbs = 0, crossover = false, range = false } = options;
|
|
3261
|
+
const model = createModel({
|
|
3262
|
+
disabled: disabledProp,
|
|
3263
|
+
multiple: true,
|
|
3264
|
+
events: true
|
|
3265
|
+
});
|
|
3266
|
+
const disabled = toRef(() => toValue(disabledProp));
|
|
3267
|
+
const readonly = toRef(() => toValue(readonlyProp));
|
|
3268
|
+
const orientation = toRef(() => toValue(orientationProp));
|
|
3269
|
+
const inverted = toRef(() => toValue(invertedProp));
|
|
3270
|
+
const extent = max - min;
|
|
3271
|
+
let pending = null;
|
|
3272
|
+
const thumbs = computed(() => Array.from(model.selectedItems.value).toSorted((a, b) => a.index - b.index));
|
|
3273
|
+
const values = computed(() => thumbs.value.map((t) => toValue(t.value)));
|
|
3274
|
+
const selectedValues = computed(() => values.value);
|
|
3275
|
+
function snap(value) {
|
|
3276
|
+
if (step <= 0) return /* @__PURE__ */ clamp(value, min, max);
|
|
3277
|
+
const clamped = /* @__PURE__ */ clamp(value, min, max);
|
|
3278
|
+
return /* @__PURE__ */ clamp(min + Math.round((clamped - min) / step) * step, min, max);
|
|
3279
|
+
}
|
|
3280
|
+
function fromValue(value) {
|
|
3281
|
+
if (extent === 0) return 0;
|
|
3282
|
+
const p = (value - min) / extent * 100;
|
|
3283
|
+
return inverted.value ? 100 - p : p;
|
|
3284
|
+
}
|
|
3285
|
+
function fromPercent(p) {
|
|
3286
|
+
return snap(min + (inverted.value ? 100 - p : p) / 100 * extent);
|
|
3287
|
+
}
|
|
3288
|
+
function register(input) {
|
|
3289
|
+
const initialValue = /* @__PURE__ */ isObject(input) ? input.value : input;
|
|
3290
|
+
const thumbIndex = thumbs.value.length;
|
|
3291
|
+
const pendingValue = pending?.[thumbIndex];
|
|
3292
|
+
const val = /* @__PURE__ */ isUndefined(pendingValue) ? snap(initialValue ?? min) : snap(pendingValue);
|
|
3293
|
+
const ticket = model.register({ value: shallowRef(val) });
|
|
3294
|
+
if (!model.selectedIds.has(ticket.id)) model.selectedIds.add(ticket.id);
|
|
3295
|
+
if (pending && thumbs.value.length >= pending.length) pending = null;
|
|
3296
|
+
return ticket;
|
|
3297
|
+
}
|
|
3298
|
+
function apply(incoming, _options) {
|
|
3299
|
+
const snapped = incoming.map((v) => snap(Number(v)));
|
|
3300
|
+
if (thumbs.value.length === 0) {
|
|
3301
|
+
pending = snapped;
|
|
3302
|
+
return;
|
|
3303
|
+
}
|
|
3304
|
+
for (let index = 0; index < snapped.length; index++) {
|
|
3305
|
+
const ticket = thumbs.value[index];
|
|
3306
|
+
if (!ticket || !isRef(ticket.value)) continue;
|
|
3307
|
+
let constrained = snapped[index];
|
|
3308
|
+
if (!crossover) {
|
|
3309
|
+
const gap = minStepsBetweenThumbs * step;
|
|
3310
|
+
const prev = index > 0 ? snapped[index - 1] : void 0;
|
|
3311
|
+
const following = index < snapped.length - 1 ? snapped[index + 1] : void 0;
|
|
3312
|
+
if (!/* @__PURE__ */ isUndefined(prev)) constrained = Math.max(constrained, prev + gap);
|
|
3313
|
+
if (!/* @__PURE__ */ isUndefined(following)) constrained = Math.min(constrained, following - gap);
|
|
3314
|
+
}
|
|
3315
|
+
ticket.value.value = /* @__PURE__ */ clamp(constrained, min, max);
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
function set(index, value) {
|
|
3319
|
+
if (readonly.value) return;
|
|
3320
|
+
const snapped = snap(value);
|
|
3321
|
+
const current = values.value;
|
|
3322
|
+
let constrained = snapped;
|
|
3323
|
+
if (!crossover) {
|
|
3324
|
+
const gap = minStepsBetweenThumbs * step;
|
|
3325
|
+
const prev = current[index - 1];
|
|
3326
|
+
const following = current[index + 1];
|
|
3327
|
+
if (index > 0 && !/* @__PURE__ */ isUndefined(prev)) constrained = Math.max(constrained, prev + gap);
|
|
3328
|
+
if (index < current.length - 1 && !/* @__PURE__ */ isUndefined(following)) constrained = Math.min(constrained, following - gap);
|
|
3329
|
+
}
|
|
3330
|
+
constrained = /* @__PURE__ */ clamp(constrained, min, max);
|
|
3331
|
+
const ticket = thumbs.value[index];
|
|
3332
|
+
if (ticket && isRef(ticket.value)) ticket.value.value = constrained;
|
|
3333
|
+
}
|
|
3334
|
+
function up(index, multiplier = 1) {
|
|
3335
|
+
set(index, (values.value[index] ?? min) + step * multiplier);
|
|
3336
|
+
}
|
|
3337
|
+
function down(index, multiplier = 1) {
|
|
3338
|
+
set(index, (values.value[index] ?? min) - step * multiplier);
|
|
3339
|
+
}
|
|
3340
|
+
function floor(index) {
|
|
3341
|
+
set(index, min);
|
|
3342
|
+
}
|
|
3343
|
+
function ceil(index) {
|
|
3344
|
+
set(index, max);
|
|
3345
|
+
}
|
|
3346
|
+
return {
|
|
3347
|
+
...model,
|
|
3348
|
+
values,
|
|
3349
|
+
selectedValues,
|
|
3350
|
+
apply,
|
|
3351
|
+
range,
|
|
3352
|
+
min,
|
|
3353
|
+
max,
|
|
3354
|
+
step,
|
|
3355
|
+
minStepsBetweenThumbs,
|
|
3356
|
+
crossover,
|
|
3357
|
+
disabled,
|
|
3358
|
+
readonly,
|
|
3359
|
+
orientation,
|
|
3360
|
+
inverted,
|
|
3361
|
+
register,
|
|
3362
|
+
snap,
|
|
3363
|
+
fromValue,
|
|
3364
|
+
fromPercent,
|
|
3365
|
+
set,
|
|
3366
|
+
up,
|
|
3367
|
+
down,
|
|
3368
|
+
floor,
|
|
3369
|
+
ceil,
|
|
3370
|
+
get size() {
|
|
3371
|
+
return model.size;
|
|
3372
|
+
}
|
|
3373
|
+
};
|
|
3374
|
+
}
|
|
3219
3375
|
//#endregion
|
|
3220
3376
|
//#region src/composables/useStack/index.ts
|
|
3221
3377
|
/**
|
|
@@ -3266,9 +3422,9 @@ function createStack(_options = {}) {
|
|
|
3266
3422
|
});
|
|
3267
3423
|
const isActive = toRef(() => selection.selectedIds.size > 0);
|
|
3268
3424
|
const top = toRef(() => {
|
|
3269
|
-
const ids
|
|
3270
|
-
if (ids
|
|
3271
|
-
return selection.get(ids
|
|
3425
|
+
const ids = Array.from(selection.selectedIds);
|
|
3426
|
+
if (ids.length === 0) return void 0;
|
|
3427
|
+
return selection.get(ids.at(-1));
|
|
3272
3428
|
});
|
|
3273
3429
|
const scrimZIndex = toRef(() => {
|
|
3274
3430
|
const ticket = top.value;
|
|
@@ -3442,7 +3598,6 @@ function useStack(namespace = "v0:stack") {
|
|
|
3442
3598
|
return fallback;
|
|
3443
3599
|
}
|
|
3444
3600
|
}
|
|
3445
|
-
|
|
3446
3601
|
//#endregion
|
|
3447
3602
|
//#region src/composables/createStep/index.ts
|
|
3448
3603
|
/**
|
|
@@ -3643,7 +3798,6 @@ function createStepContext(_options = {}) {
|
|
|
3643
3798
|
function useStep(namespace = "v0:step") {
|
|
3644
3799
|
return useContext(namespace);
|
|
3645
3800
|
}
|
|
3646
|
-
|
|
3647
3801
|
//#endregion
|
|
3648
3802
|
//#region src/composables/useStorage/index.ts
|
|
3649
3803
|
/**
|
|
@@ -3689,31 +3843,50 @@ function createStorage(options = {}) {
|
|
|
3689
3843
|
const { adapter = IN_BROWSER ? window.localStorage : new MemoryAdapter(), prefix = "v0:", serializer = {
|
|
3690
3844
|
read: JSON.parse,
|
|
3691
3845
|
write: JSON.stringify
|
|
3692
|
-
} } = options;
|
|
3846
|
+
}, ttl } = options;
|
|
3693
3847
|
const cache = /* @__PURE__ */ new Map();
|
|
3694
3848
|
const watchers = /* @__PURE__ */ new Map();
|
|
3695
3849
|
function has(key) {
|
|
3696
3850
|
const prefixedKey = `${prefix}${key}`;
|
|
3697
3851
|
return cache.has(prefixedKey);
|
|
3698
3852
|
}
|
|
3699
|
-
function
|
|
3700
|
-
const
|
|
3701
|
-
if (
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3853
|
+
function readStored(prefixedKey) {
|
|
3854
|
+
const raw = adapter?.getItem(prefixedKey);
|
|
3855
|
+
if (!raw) return void 0;
|
|
3856
|
+
try {
|
|
3857
|
+
const parsed = serializer.read(raw);
|
|
3858
|
+
if (ttl && /* @__PURE__ */ isObject(parsed) && "__ttl" in parsed && "__v" in parsed) {
|
|
3859
|
+
if (Date.now() - parsed.__t > ttl) {
|
|
3860
|
+
adapter?.removeItem(prefixedKey);
|
|
3861
|
+
return;
|
|
3862
|
+
}
|
|
3863
|
+
return parsed.__v;
|
|
3864
|
+
}
|
|
3865
|
+
return parsed;
|
|
3706
3866
|
} catch (error) {
|
|
3707
3867
|
console.error(`[v0:storage] Failed to parse stored value for key "${prefixedKey}":`, error);
|
|
3868
|
+
return;
|
|
3708
3869
|
}
|
|
3709
|
-
|
|
3870
|
+
}
|
|
3871
|
+
function writeStored(prefixedKey, value) {
|
|
3872
|
+
const wrapped = ttl ? {
|
|
3873
|
+
__ttl: 1,
|
|
3874
|
+
__v: value,
|
|
3875
|
+
__t: Date.now()
|
|
3876
|
+
} : value;
|
|
3877
|
+
try {
|
|
3878
|
+
adapter?.setItem(prefixedKey, serializer.write(wrapped));
|
|
3879
|
+
} catch (error) {
|
|
3880
|
+
console.error(`[v0:storage] Failed to write key "${prefixedKey}":`, error);
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
function get(key, defaultValue) {
|
|
3884
|
+
const prefixedKey = `${prefix}${key}`;
|
|
3885
|
+
if (cache.has(prefixedKey)) return cache.get(prefixedKey);
|
|
3886
|
+
const valueRef = ref(readStored(prefixedKey) ?? defaultValue);
|
|
3710
3887
|
const stop = watch(valueRef, (newValue) => {
|
|
3711
3888
|
if (/* @__PURE__ */ isNullOrUndefined(newValue)) adapter?.removeItem(prefixedKey);
|
|
3712
|
-
else
|
|
3713
|
-
adapter?.setItem(prefixedKey, serializer.write(newValue));
|
|
3714
|
-
} catch (error) {
|
|
3715
|
-
console.error(`[v0:storage] Failed to write key "${prefixedKey}":`, error);
|
|
3716
|
-
}
|
|
3889
|
+
else writeStored(prefixedKey, newValue);
|
|
3717
3890
|
}, { deep: true });
|
|
3718
3891
|
watchers.set(prefixedKey, stop);
|
|
3719
3892
|
cache.set(prefixedKey, valueRef);
|
|
@@ -3747,14 +3920,10 @@ function createStorage(options = {}) {
|
|
|
3747
3920
|
const valueRef = cache.get(e.key);
|
|
3748
3921
|
if (!valueRef) return;
|
|
3749
3922
|
watchers.get(e.key)?.();
|
|
3750
|
-
valueRef.value = e.newValue
|
|
3923
|
+
valueRef.value = /* @__PURE__ */ isNullOrUndefined(e.newValue) ? void 0 : readStored(e.key);
|
|
3751
3924
|
const stop = watch(valueRef, (newValue) => {
|
|
3752
3925
|
if (/* @__PURE__ */ isNullOrUndefined(newValue)) adapter?.removeItem(e.key);
|
|
3753
|
-
else
|
|
3754
|
-
adapter?.setItem(e.key, serializer.write(newValue));
|
|
3755
|
-
} catch (error) {
|
|
3756
|
-
console.error(`[v0:storage] Failed to write key "${e.key}":`, error);
|
|
3757
|
-
}
|
|
3926
|
+
else writeStored(e.key, newValue);
|
|
3758
3927
|
}, { deep: true });
|
|
3759
3928
|
watchers.set(e.key, stop);
|
|
3760
3929
|
});
|
|
@@ -3770,7 +3939,6 @@ function createStorageFallback() {
|
|
|
3770
3939
|
return createStorage({ adapter: new MemoryAdapter() });
|
|
3771
3940
|
}
|
|
3772
3941
|
const [createStorageContext, createStoragePlugin, useStorage] = createPluginContext("v0:storage", (options) => createStorage(options), { fallback: () => createStorageFallback() });
|
|
3773
|
-
|
|
3774
3942
|
//#endregion
|
|
3775
3943
|
//#region src/composables/createTimeline/index.ts
|
|
3776
3944
|
/**
|
|
@@ -3919,7 +4087,159 @@ function createTimelineContext(_options = {}) {
|
|
|
3919
4087
|
function useTimeline(namespace = "v0:timeline") {
|
|
3920
4088
|
return useContext(namespace);
|
|
3921
4089
|
}
|
|
3922
|
-
|
|
4090
|
+
//#endregion
|
|
4091
|
+
//#region src/composables/createValidation/index.ts
|
|
4092
|
+
/**
|
|
4093
|
+
* @module createValidation
|
|
4094
|
+
*
|
|
4095
|
+
* @remarks
|
|
4096
|
+
* Per-field validation lifecycle composable.
|
|
4097
|
+
*
|
|
4098
|
+
* Key features:
|
|
4099
|
+
* - Auto-register with parent form via useForm() injection
|
|
4100
|
+
* - Async rule support with generation-based race safety
|
|
4101
|
+
* - Silent validation mode
|
|
4102
|
+
* - Tri-state isValid (null/true/false)
|
|
4103
|
+
* - isPristine tracking
|
|
4104
|
+
*
|
|
4105
|
+
* Uses useRules() to resolve alias strings via shared context.
|
|
4106
|
+
*/
|
|
4107
|
+
/**
|
|
4108
|
+
* Resolves raw rule inputs to FormValidationRule[].
|
|
4109
|
+
* Uses the provided RulesContext if available, otherwise handles
|
|
4110
|
+
* functions and Standard Schema objects directly.
|
|
4111
|
+
*/
|
|
4112
|
+
function resolveRules(raw, context) {
|
|
4113
|
+
if (context) return context.resolve(raw);
|
|
4114
|
+
return raw.filter((r) => /* @__PURE__ */ isFunction(r) || isStandardSchema(r)).map((r) => isStandardSchema(r) ? toRule(r) : r);
|
|
4115
|
+
}
|
|
4116
|
+
/**
|
|
4117
|
+
* Creates a new validation instance.
|
|
4118
|
+
*
|
|
4119
|
+
* @param options The options for the validation instance.
|
|
4120
|
+
* @returns A new validation context with register(), aggregate state, etc.
|
|
4121
|
+
*
|
|
4122
|
+
* @see https://0.vuetifyjs.com/composables/forms/create-validation
|
|
4123
|
+
*
|
|
4124
|
+
* @example
|
|
4125
|
+
* ```ts
|
|
4126
|
+
* import { createValidation } from '@vuetify/v0'
|
|
4127
|
+
*
|
|
4128
|
+
* const validation = createValidation()
|
|
4129
|
+
*
|
|
4130
|
+
* const field = validation.register({
|
|
4131
|
+
* id: 'email',
|
|
4132
|
+
* value: '',
|
|
4133
|
+
* rules: [(v) => !!v || 'Required'],
|
|
4134
|
+
* })
|
|
4135
|
+
*
|
|
4136
|
+
* await field.validate()
|
|
4137
|
+
*
|
|
4138
|
+
* console.log(field.errors.value) // ['Required']
|
|
4139
|
+
*
|
|
4140
|
+
* field.reset()
|
|
4141
|
+
* ```
|
|
4142
|
+
*/
|
|
4143
|
+
function createValidation(options = {}) {
|
|
4144
|
+
const registry = createRegistry(options);
|
|
4145
|
+
const rules = useRules();
|
|
4146
|
+
const isValidating = computed(() => {
|
|
4147
|
+
for (const ticket of registry.values()) if (ticket.isValidating.value) return true;
|
|
4148
|
+
return false;
|
|
4149
|
+
});
|
|
4150
|
+
const isValid = computed(() => {
|
|
4151
|
+
let hasNull = false;
|
|
4152
|
+
let hasFields = false;
|
|
4153
|
+
for (const ticket of registry.values()) {
|
|
4154
|
+
hasFields = true;
|
|
4155
|
+
if (ticket.isValid.value === false) return false;
|
|
4156
|
+
if (/* @__PURE__ */ isNull(ticket.isValid.value)) hasNull = true;
|
|
4157
|
+
}
|
|
4158
|
+
if (!hasFields) return null;
|
|
4159
|
+
return hasNull ? null : true;
|
|
4160
|
+
});
|
|
4161
|
+
function register(registration = {}) {
|
|
4162
|
+
const model = shallowRef(/* @__PURE__ */ isNullOrUndefined(registration.value) ? "" : toValue(registration.value));
|
|
4163
|
+
const resolved = resolveRules(registration.rules || [], rules);
|
|
4164
|
+
const errors = shallowRef([]);
|
|
4165
|
+
const isFieldValidating = shallowRef(false);
|
|
4166
|
+
const initialValue = model.value;
|
|
4167
|
+
const isPristine = shallowRef(true);
|
|
4168
|
+
const isFieldValid = shallowRef(null);
|
|
4169
|
+
function reset() {
|
|
4170
|
+
model.value = initialValue;
|
|
4171
|
+
errors.value = [];
|
|
4172
|
+
isPristine.value = true;
|
|
4173
|
+
isFieldValid.value = null;
|
|
4174
|
+
isFieldValidating.value = false;
|
|
4175
|
+
validationGeneration++;
|
|
4176
|
+
}
|
|
4177
|
+
let validationGeneration = 0;
|
|
4178
|
+
async function validate(silent = false) {
|
|
4179
|
+
if (resolved.length === 0) return isFieldValid.value = true;
|
|
4180
|
+
const generation = ++validationGeneration;
|
|
4181
|
+
isFieldValidating.value = true;
|
|
4182
|
+
try {
|
|
4183
|
+
const results = await Promise.all(resolved.map((rule) => rule(model.value)));
|
|
4184
|
+
if (generation !== validationGeneration) return isFieldValid.value ?? false;
|
|
4185
|
+
const errorMessages = results.filter((result) => /* @__PURE__ */ isString(result) || result === false).map((result) => result === false ? "Validation failed" : result);
|
|
4186
|
+
if (!silent) {
|
|
4187
|
+
errors.value = errorMessages;
|
|
4188
|
+
isFieldValid.value = errorMessages.length === 0;
|
|
4189
|
+
isPristine.value = model.value === initialValue;
|
|
4190
|
+
}
|
|
4191
|
+
return errorMessages.length === 0;
|
|
4192
|
+
} finally {
|
|
4193
|
+
if (generation === validationGeneration) isFieldValidating.value = false;
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
const item = {
|
|
4197
|
+
...registration,
|
|
4198
|
+
rules: resolved,
|
|
4199
|
+
errors,
|
|
4200
|
+
disabled: registration.disabled || false,
|
|
4201
|
+
isValidating: isFieldValidating,
|
|
4202
|
+
isPristine,
|
|
4203
|
+
isValid: isFieldValid,
|
|
4204
|
+
reset,
|
|
4205
|
+
validate
|
|
4206
|
+
};
|
|
4207
|
+
const ticket = registry.register(item);
|
|
4208
|
+
Object.defineProperty(ticket, "value", {
|
|
4209
|
+
get() {
|
|
4210
|
+
return model.value;
|
|
4211
|
+
},
|
|
4212
|
+
set(val) {
|
|
4213
|
+
model.value = val;
|
|
4214
|
+
isPristine.value = val === initialValue;
|
|
4215
|
+
isFieldValid.value = null;
|
|
4216
|
+
},
|
|
4217
|
+
enumerable: true,
|
|
4218
|
+
configurable: true
|
|
4219
|
+
});
|
|
4220
|
+
return ticket;
|
|
4221
|
+
}
|
|
4222
|
+
function onboard(registrations) {
|
|
4223
|
+
return registry.batch(() => registrations.map((r) => register(r)));
|
|
4224
|
+
}
|
|
4225
|
+
const context = {
|
|
4226
|
+
...registry,
|
|
4227
|
+
register,
|
|
4228
|
+
onboard,
|
|
4229
|
+
isValid,
|
|
4230
|
+
isValidating,
|
|
4231
|
+
get size() {
|
|
4232
|
+
return registry.size;
|
|
4233
|
+
}
|
|
4234
|
+
};
|
|
4235
|
+
const form = useForm();
|
|
4236
|
+
const ticket = form?.register({ value: context });
|
|
4237
|
+
onScopeDispose(() => {
|
|
4238
|
+
if (!ticket || !form) return;
|
|
4239
|
+
form.unregister(ticket.id);
|
|
4240
|
+
}, true);
|
|
4241
|
+
return context;
|
|
4242
|
+
}
|
|
3923
4243
|
//#endregion
|
|
3924
4244
|
//#region src/composables/useToggleScope/index.ts
|
|
3925
4245
|
/**
|
|
@@ -4016,7 +4336,6 @@ function useToggleScope(source, fn) {
|
|
|
4016
4336
|
onScopeDispose(stop, true);
|
|
4017
4337
|
return controls;
|
|
4018
4338
|
}
|
|
4019
|
-
|
|
4020
4339
|
//#endregion
|
|
4021
4340
|
//#region src/composables/createVirtual/index.ts
|
|
4022
4341
|
/**
|
|
@@ -4160,10 +4479,10 @@ function createVirtual(items, _options = {}) {
|
|
|
4160
4479
|
function rebuild() {
|
|
4161
4480
|
const length = items.value.length;
|
|
4162
4481
|
const newOffsets = offsets.value.length === length ? offsets.value : Array.from({ length });
|
|
4163
|
-
let offset
|
|
4482
|
+
let offset = 0;
|
|
4164
4483
|
for (let i = 0; i < length; i++) {
|
|
4165
|
-
newOffsets[i] = offset
|
|
4166
|
-
offset
|
|
4484
|
+
newOffsets[i] = offset;
|
|
4485
|
+
offset += heights.value[i] || itemHeight.value;
|
|
4167
4486
|
}
|
|
4168
4487
|
if (offsets.value !== newOffsets) offsets.value = newOffsets;
|
|
4169
4488
|
update();
|
|
@@ -4217,10 +4536,10 @@ function createVirtual(items, _options = {}) {
|
|
|
4217
4536
|
}
|
|
4218
4537
|
/* v8 ignore stop */
|
|
4219
4538
|
}
|
|
4220
|
-
function resize(index, height
|
|
4221
|
-
if (heights.value[index] === height
|
|
4222
|
-
heights.value[index] = height
|
|
4223
|
-
if (!itemHeight.value) itemHeight.value = height
|
|
4539
|
+
function resize(index, height) {
|
|
4540
|
+
if (heights.value[index] === height) return;
|
|
4541
|
+
heights.value[index] = height;
|
|
4542
|
+
if (!itemHeight.value) itemHeight.value = height;
|
|
4224
4543
|
if (IN_BROWSER) {
|
|
4225
4544
|
cancelAnimationFrame(rebuildRaf);
|
|
4226
4545
|
rebuildRaf = requestAnimationFrame(rebuild);
|
|
@@ -4364,7 +4683,6 @@ function createVirtualContext(items, _options = {}) {
|
|
|
4364
4683
|
function useVirtual(namespace = "v0:virtual") {
|
|
4365
4684
|
return useContext(namespace);
|
|
4366
4685
|
}
|
|
4367
|
-
|
|
4368
4686
|
//#endregion
|
|
4369
4687
|
//#region src/composables/useEventListener/index.ts
|
|
4370
4688
|
/**
|
|
@@ -4399,9 +4717,9 @@ function useEventListener(target, event, listener, options) {
|
|
|
4399
4717
|
for (const fn of cleanups) fn();
|
|
4400
4718
|
cleanups.length = 0;
|
|
4401
4719
|
}
|
|
4402
|
-
function register(el, event
|
|
4403
|
-
el.addEventListener(event
|
|
4404
|
-
return () => el.removeEventListener(event
|
|
4720
|
+
function register(el, event, listener, options) {
|
|
4721
|
+
el.addEventListener(event, listener, options);
|
|
4722
|
+
return () => el.removeEventListener(event, listener, options);
|
|
4405
4723
|
}
|
|
4406
4724
|
const stopWatcher = watch(() => [
|
|
4407
4725
|
toValue(target),
|
|
@@ -4413,7 +4731,7 @@ function useEventListener(target, event, listener, options) {
|
|
|
4413
4731
|
if (!el) return;
|
|
4414
4732
|
const eventList = toArray(events);
|
|
4415
4733
|
const listenerList = toArray(listeners);
|
|
4416
|
-
for (const event
|
|
4734
|
+
for (const event of eventList) for (const listenerFn of listenerList) cleanups.push(register(el, event, listenerFn, opts));
|
|
4417
4735
|
}, {
|
|
4418
4736
|
immediate: true,
|
|
4419
4737
|
flush: "post"
|
|
@@ -4453,7 +4771,6 @@ function useWindowEventListener(event, listener, options) {
|
|
|
4453
4771
|
function useDocumentEventListener(event, listener, options) {
|
|
4454
4772
|
return IN_BROWSER ? useEventListener(document, event, listener, options) : () => {};
|
|
4455
4773
|
}
|
|
4456
|
-
|
|
4457
4774
|
//#endregion
|
|
4458
4775
|
//#region src/composables/useClickOutside/index.ts
|
|
4459
4776
|
/**
|
|
@@ -4711,6 +5028,5 @@ function useClickOutside(target, handler, options = {}) {
|
|
|
4711
5028
|
stop
|
|
4712
5029
|
};
|
|
4713
5030
|
}
|
|
4714
|
-
|
|
4715
5031
|
//#endregion
|
|
4716
|
-
export {
|
|
5032
|
+
export { createDatePlugin as $, Vuetify0RtlAdapter as A, useMediaQuery as B, useStack as C, createRtlFallback as D, createRtlContext as E, createNestedContext as F, useElementIntersection as G, usePrefersDark as H, useNested as I, createForm as J, useIntersectionObserver as K, multipleOpenStrategy as L, createQueueContext as M, useQueue as N, createRtlPlugin as O, createNested as P, createDateContext as Q, singleOpenStrategy as R, createStackPlugin as S, createRtl as T, usePrefersReducedMotion as U, usePrefersContrast as V, useLazy as W, useForm as X, createFormContext as Y, createDate as Z, createStep as _, useHydration as _t, createVirtual as a, toReactive as at, createStack as b, useBreadcrumbs as bt, useToggleScope as c, createOverflowContext as ct, createTimelineContext as d, useResizeObserver as dt, useDate as et, useTimeline as f, toElement as ft, useStorage as g, createHydrationPlugin as gt, createStoragePlugin as h, createHydrationContext as ht, useWindowEventListener as i, useBreakpoints as it, createQueue as j, useRtl as k, createValidation as l, useOverflow as lt, createStorageContext as m, createHydration as mt, useDocumentEventListener as n, createBreakpointsContext as nt, createVirtualContext as o, useProxyModel as ot, createStorage as p, createFallbackHydration as pt, useHotkey as q, useEventListener as r, createBreakpointsPlugin as rt, useVirtual as s, createOverflow as st, useClickOutside as t, createBreakpoints as tt, createTimeline as u, useElementSize as ut, createStepContext as v, createBreadcrumbs as vt, createSlider as w, createStackContext as x, useStep as y, createBreadcrumbsContext as yt, useMutationObserver as z };
|