@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,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as createPluginContext } from "./useLogger-
|
|
3
|
-
import { t as createTokens } from "./createTokens-
|
|
4
|
-
import { t as createGroup } from "./createGroup-
|
|
5
|
-
|
|
1
|
+
import { isArray, isBoolean, isFunction, isObject } from "./utilities/index.mjs";
|
|
2
|
+
import { o as createPluginContext } from "./useLogger-B70T4SgK.mjs";
|
|
3
|
+
import { t as createTokens } from "./createTokens-CMRBDlzN.mjs";
|
|
4
|
+
import { t as createGroup } from "./createGroup-Cf6lK9BR.mjs";
|
|
6
5
|
//#region src/composables/useFeatures/adapters/generic/index.ts
|
|
7
6
|
var FeaturesAdapter = class {};
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
8
|
//#region src/composables/useFeatures/index.ts
|
|
11
9
|
/**
|
|
@@ -117,6 +115,5 @@ const [createFeaturesContext, createFeaturesPlugin, useFeatures] = createPluginC
|
|
|
117
115
|
}
|
|
118
116
|
}
|
|
119
117
|
});
|
|
120
|
-
|
|
121
118
|
//#endregion
|
|
122
|
-
export { FeaturesAdapter as a, useFeatures as i, createFeaturesContext as n, createFeaturesPlugin as r, createFeatures as t };
|
|
119
|
+
export { FeaturesAdapter as a, useFeatures as i, createFeaturesContext as n, createFeaturesPlugin as r, createFeatures as t };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as createPluginContext } from "./useLogger-
|
|
3
|
-
import { t as createTokens } from "./createTokens-
|
|
4
|
-
import { t as createSingle } from "./createSingle-
|
|
5
|
-
import { t as toArray } from "./toArray-
|
|
6
|
-
import { t as Vuetify0LocaleAdapter } from "./v0-
|
|
7
|
-
|
|
1
|
+
import { isString } from "./utilities/index.mjs";
|
|
2
|
+
import { o as createPluginContext } from "./useLogger-B70T4SgK.mjs";
|
|
3
|
+
import { t as createTokens } from "./createTokens-CMRBDlzN.mjs";
|
|
4
|
+
import { t as createSingle } from "./createSingle-Bbcwcq4R.mjs";
|
|
5
|
+
import { t as toArray } from "./toArray-VdROPpy-.mjs";
|
|
6
|
+
import { t as Vuetify0LocaleAdapter } from "./v0-CHvU3jQE.mjs";
|
|
8
7
|
//#region src/composables/useLocale/index.ts
|
|
9
8
|
/**
|
|
10
9
|
* @module useLocale
|
|
@@ -80,6 +79,5 @@ function createLocaleFallback() {
|
|
|
80
79
|
};
|
|
81
80
|
}
|
|
82
81
|
const [createLocaleContext, createLocalePlugin, useLocale] = createPluginContext("v0:locale", (options) => createLocale(options), { fallback: () => createLocaleFallback() });
|
|
83
|
-
|
|
84
82
|
//#endregion
|
|
85
|
-
export { useLocale as a, createLocalePlugin as i, createLocaleContext as n, createLocaleFallback as r, createLocale as t };
|
|
83
|
+
export { useLocale as a, createLocalePlugin as i, createLocaleContext as n, createLocaleFallback as r, createLocale as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { s as __LOGGER_ENABLED__, t as IN_BROWSER } from "./globals-
|
|
2
|
-
import {
|
|
3
|
-
import { i as useContext, n as createContext, t as createTrinity } from "./createTrinity-
|
|
4
|
-
import { t as Vuetify0LoggerAdapter } from "./v0-
|
|
1
|
+
import { s as __LOGGER_ENABLED__, t as IN_BROWSER } from "./globals-BqRH_jdr.mjs";
|
|
2
|
+
import { isUndefined } from "./utilities/index.mjs";
|
|
3
|
+
import { i as useContext, n as createContext, t as createTrinity } from "./createTrinity-C_c8eedz.mjs";
|
|
4
|
+
import { t as Vuetify0LoggerAdapter } from "./v0-V-cQsuZD.mjs";
|
|
5
5
|
import { hasInjectionContext } from "vue";
|
|
6
|
-
|
|
7
6
|
//#region src/composables/createPlugin/index.ts
|
|
8
7
|
/**
|
|
9
8
|
* @module createPlugin
|
|
@@ -89,21 +88,21 @@ function createPluginContext(defaultNamespace, factory, config) {
|
|
|
89
88
|
const { namespace = defaultNamespace, ...options } = _options;
|
|
90
89
|
const [_use, _provide] = createContext(namespace);
|
|
91
90
|
const context = factory(options);
|
|
92
|
-
function provide
|
|
91
|
+
function provide(_context = context, app) {
|
|
93
92
|
return _provide(_context, app);
|
|
94
93
|
}
|
|
95
|
-
return createTrinity(_use, provide
|
|
94
|
+
return createTrinity(_use, provide, context);
|
|
96
95
|
}
|
|
97
96
|
function createXPlugin(_options = {}) {
|
|
98
97
|
const { namespace = defaultNamespace, ...options } = _options;
|
|
99
|
-
const [, provide
|
|
98
|
+
const [, provide, context] = createXContext({
|
|
100
99
|
...options,
|
|
101
100
|
namespace
|
|
102
101
|
});
|
|
103
102
|
return createPlugin({
|
|
104
103
|
namespace,
|
|
105
104
|
provide: (app) => {
|
|
106
|
-
provide
|
|
105
|
+
provide(context, app);
|
|
107
106
|
},
|
|
108
107
|
setup: config?.setup ? (app) => config.setup(context, app, options) : void 0
|
|
109
108
|
});
|
|
@@ -122,7 +121,6 @@ function createPluginContext(defaultNamespace, factory, config) {
|
|
|
122
121
|
useX
|
|
123
122
|
];
|
|
124
123
|
}
|
|
125
|
-
|
|
126
124
|
//#endregion
|
|
127
125
|
//#region src/composables/useLogger/index.ts
|
|
128
126
|
/**
|
|
@@ -170,7 +168,7 @@ function createLogger(options = {}) {
|
|
|
170
168
|
const { adapter = new Vuetify0LoggerAdapter({ prefix: options.prefix }), level: initialLevel = "info", enabled: initialEnabled = __LOGGER_ENABLED__ } = options;
|
|
171
169
|
let currentLevel = initialLevel;
|
|
172
170
|
let isEnabled = initialEnabled;
|
|
173
|
-
function value(level
|
|
171
|
+
function value(level) {
|
|
174
172
|
return {
|
|
175
173
|
trace: 0,
|
|
176
174
|
debug: 1,
|
|
@@ -179,11 +177,11 @@ function createLogger(options = {}) {
|
|
|
179
177
|
error: 4,
|
|
180
178
|
fatal: 5,
|
|
181
179
|
silent: 6
|
|
182
|
-
}[level
|
|
180
|
+
}[level] ?? 2;
|
|
183
181
|
}
|
|
184
|
-
function can(level
|
|
182
|
+
function can(level) {
|
|
185
183
|
if (!isEnabled) return false;
|
|
186
|
-
return value(level
|
|
184
|
+
return value(level) >= value(currentLevel);
|
|
187
185
|
}
|
|
188
186
|
function format(message) {
|
|
189
187
|
return message;
|
|
@@ -278,6 +276,5 @@ const [createLoggerContext, createLoggerPlugin, useLogger] = createPluginContext
|
|
|
278
276
|
if (!/* @__PURE__ */ isUndefined(process.env.NODE_ENV !== "production") && process.env.NODE_ENV !== "production" && IN_BROWSER) window.__v0Logger__ = context;
|
|
279
277
|
}
|
|
280
278
|
});
|
|
281
|
-
|
|
282
279
|
//#endregion
|
|
283
|
-
export { createPlugin as a, useLogger as i, createLoggerContext as n, createPluginContext as o, createLoggerPlugin as r, createLogger as t };
|
|
280
|
+
export { createPlugin as a, useLogger as i, createLoggerContext as n, createPluginContext as o, createLoggerPlugin as r, createLogger as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { o as createPluginContext } from "./useLogger-
|
|
2
|
-
import { t as createTokens } from "./createTokens-
|
|
3
|
-
import { t as toArray } from "./toArray-
|
|
4
|
-
import { t as Vuetify0PermissionAdapter } from "./v0-
|
|
5
|
-
|
|
1
|
+
import { o as createPluginContext } from "./useLogger-B70T4SgK.mjs";
|
|
2
|
+
import { t as createTokens } from "./createTokens-CMRBDlzN.mjs";
|
|
3
|
+
import { t as toArray } from "./toArray-VdROPpy-.mjs";
|
|
4
|
+
import { t as Vuetify0PermissionAdapter } from "./v0-B1QQGE4O.mjs";
|
|
6
5
|
//#region src/composables/usePermissions/index.ts
|
|
7
6
|
/**
|
|
8
7
|
* @module usePermissions
|
|
@@ -123,6 +122,5 @@ const [createPermissionsContext, createPermissionsPlugin, usePermissions] = crea
|
|
|
123
122
|
* app.mount('#app')
|
|
124
123
|
* ```
|
|
125
124
|
*/
|
|
126
|
-
|
|
127
125
|
//#endregion
|
|
128
|
-
export { usePermissions as i, createPermissionsContext as n, createPermissionsPlugin as r, createPermissions as t };
|
|
126
|
+
export { usePermissions as i, createPermissionsContext as n, createPermissionsPlugin as r, createPermissions as t };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { instanceExists, isFunction, isObject } from "./utilities/index.mjs";
|
|
2
|
+
import { o as createPluginContext } from "./useLogger-B70T4SgK.mjs";
|
|
3
|
+
import { a as useLocale } from "./useLocale-C8I_fNAS.mjs";
|
|
4
|
+
//#region src/composables/useRules/adapters/standard.ts
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for Standard Schema objects.
|
|
7
|
+
* Checks for the `~standard` property that all conforming libraries expose.
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to check.
|
|
10
|
+
* @returns `true` if the value conforms to the Standard Schema interface.
|
|
11
|
+
*/
|
|
12
|
+
function isStandardSchema(value) {
|
|
13
|
+
return /* @__PURE__ */ isObject(value) && "~standard" in value;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Converts a Standard Schema object into a `FormValidationRule`.
|
|
17
|
+
*
|
|
18
|
+
* Used internally by `resolve()` — both for schemas passed directly and for
|
|
19
|
+
* schemas returned by alias builders. Handles both sync and async validation.
|
|
20
|
+
* Returns the first issue message on failure.
|
|
21
|
+
*
|
|
22
|
+
* @param schema Any Standard Schema-conforming object (Zod v3.24+, Valibot, ArkType, etc.)
|
|
23
|
+
* @returns A `FormValidationRule` that resolves to `true` or an error string.
|
|
24
|
+
*
|
|
25
|
+
* @see https://standardschema.dev/
|
|
26
|
+
*/
|
|
27
|
+
function toRule(schema) {
|
|
28
|
+
return async (value) => {
|
|
29
|
+
let result = schema["~standard"].validate(value);
|
|
30
|
+
if (result instanceof Promise) result = await result;
|
|
31
|
+
return result.issues?.[0]?.message ?? true;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/composables/useRules/index.ts
|
|
36
|
+
/**
|
|
37
|
+
* @module useRules
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Validation rule composable with Standard Schema support.
|
|
41
|
+
*
|
|
42
|
+
* Key features:
|
|
43
|
+
* - Standard Schema auto-detection (Zod, Valibot, ArkType, etc.)
|
|
44
|
+
* - String alias resolution to FormValidationRule[] via predicate lookup
|
|
45
|
+
* - Custom alias registration (predicates, not builders)
|
|
46
|
+
* - Trinity pattern for DI
|
|
47
|
+
* - Plugin factory for app-level installation
|
|
48
|
+
*
|
|
49
|
+
* Validation return values:
|
|
50
|
+
* - `true` — validation passes
|
|
51
|
+
* - `string` — validation fails, the string IS the error message
|
|
52
|
+
* - `false` — validation fails, error message resolved from locale (`$rules.<name>`)
|
|
53
|
+
*
|
|
54
|
+
* Integrates with createValidation for rule resolution, useLocale for i18n.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Wraps an alias predicate so that `false` results are
|
|
58
|
+
* resolved to a locale-aware error message via `$rules.<name>`.
|
|
59
|
+
*
|
|
60
|
+
* - `true` → pass
|
|
61
|
+
* - `string` → fail with that message
|
|
62
|
+
* - `false` → fail, look up message from locale
|
|
63
|
+
*/
|
|
64
|
+
function resolveAlias(name, predicate, locale) {
|
|
65
|
+
return (value) => {
|
|
66
|
+
const result = predicate(value);
|
|
67
|
+
if (result instanceof Promise) return result.then((resolved) => {
|
|
68
|
+
if (resolved === true) return true;
|
|
69
|
+
if (resolved === false) return locale?.t(`$rules.${name}`) ?? name;
|
|
70
|
+
return resolved;
|
|
71
|
+
});
|
|
72
|
+
if (result === true) return true;
|
|
73
|
+
if (result === false) return locale?.t(`$rules.${name}`) ?? name;
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function createResolve(aliases, locale) {
|
|
78
|
+
return function resolve(rules) {
|
|
79
|
+
const result = [];
|
|
80
|
+
for (const rule of rules) {
|
|
81
|
+
if (/* @__PURE__ */ isFunction(rule)) {
|
|
82
|
+
result.push(rule);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (isStandardSchema(rule)) {
|
|
86
|
+
result.push(toRule(rule));
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const predicate = aliases[rule];
|
|
90
|
+
if (predicate) result.push(resolveAlias(rule, predicate, locale));
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new rules instance.
|
|
97
|
+
*
|
|
98
|
+
* @param options The options for the rules instance.
|
|
99
|
+
* @returns A new rules instance with resolve() and aliases.
|
|
100
|
+
*
|
|
101
|
+
* @see https://0.vuetifyjs.com/composables/plugins/use-rules
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* import { createRules } from '@vuetify/v0'
|
|
106
|
+
*
|
|
107
|
+
* const rules = createRules({
|
|
108
|
+
* aliases: {
|
|
109
|
+
* required: (v) => !!v || false,
|
|
110
|
+
* },
|
|
111
|
+
* })
|
|
112
|
+
*
|
|
113
|
+
* // Resolve alias strings to validation functions
|
|
114
|
+
* const resolved = rules.resolve(['required'])
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
function createRules(_options = {}) {
|
|
118
|
+
const { aliases: customAliases } = _options;
|
|
119
|
+
let locale;
|
|
120
|
+
try {
|
|
121
|
+
if (instanceExists()) locale = useLocale();
|
|
122
|
+
} catch {}
|
|
123
|
+
const aliases = { ...customAliases };
|
|
124
|
+
return {
|
|
125
|
+
resolve: createResolve(aliases, locale),
|
|
126
|
+
aliases
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates a fallback rules instance for use outside component scope.
|
|
131
|
+
* No locale lookup — `false` returns fall back to the alias name.
|
|
132
|
+
*
|
|
133
|
+
* @returns A standalone rules context with empty aliases.
|
|
134
|
+
*/
|
|
135
|
+
function createRulesFallback() {
|
|
136
|
+
const aliases = {};
|
|
137
|
+
return {
|
|
138
|
+
resolve: createResolve(aliases),
|
|
139
|
+
aliases
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const [createRulesContext, createRulesPlugin, useRules] = createPluginContext("v0:rules", (options) => createRules(options), { fallback: () => createRulesFallback() });
|
|
143
|
+
//#endregion
|
|
144
|
+
export { useRules as a, createRulesPlugin as i, createRulesContext as n, isStandardSchema as o, createRulesFallback as r, toRule as s, createRules as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { o as createPluginContext } from "./useLogger-
|
|
2
|
-
import { t as createTokens } from "./createTokens-
|
|
3
|
-
import { t as createSingle } from "./createSingle-
|
|
4
|
-
import { t as Vuetify0ThemeAdapter } from "./v0-
|
|
1
|
+
import { o as createPluginContext } from "./useLogger-B70T4SgK.mjs";
|
|
2
|
+
import { t as createTokens } from "./createTokens-CMRBDlzN.mjs";
|
|
3
|
+
import { t as createSingle } from "./createSingle-Bbcwcq4R.mjs";
|
|
4
|
+
import { t as Vuetify0ThemeAdapter } from "./v0-CGlkn5u7.mjs";
|
|
5
5
|
import { computed, shallowRef, toRef } from "vue";
|
|
6
|
-
|
|
7
6
|
//#region src/composables/useTheme/index.ts
|
|
8
7
|
/**
|
|
9
8
|
* @module useTheme
|
|
@@ -83,14 +82,14 @@ function createTheme(_options = {}) {
|
|
|
83
82
|
return resolved;
|
|
84
83
|
});
|
|
85
84
|
const isDark = toRef(() => registry.selectedItem.value?.dark ?? false);
|
|
86
|
-
function cycle(themes
|
|
87
|
-
const current = themes
|
|
88
|
-
const next = current === -1 ? 0 : (current + 1) % themes
|
|
89
|
-
registry.select(themes
|
|
85
|
+
function cycle(themes = names.value) {
|
|
86
|
+
const current = themes.indexOf(registry.selectedId.value ?? "");
|
|
87
|
+
const next = current === -1 ? 0 : (current + 1) % themes.length;
|
|
88
|
+
registry.select(themes[next]);
|
|
90
89
|
}
|
|
91
|
-
function resolve(colors
|
|
90
|
+
function resolve(colors) {
|
|
92
91
|
const resolved = {};
|
|
93
|
-
for (const [key, value] of Object.entries(colors
|
|
92
|
+
for (const [key, value] of Object.entries(colors)) resolved[key] = tokens.isAlias(value) ? tokens.resolve(value) : value;
|
|
94
93
|
return resolved;
|
|
95
94
|
}
|
|
96
95
|
function register(registration = {}) {
|
|
@@ -130,6 +129,5 @@ const [createThemeContext, createThemePlugin, useTheme] = createPluginContext("v
|
|
|
130
129
|
adapter.setup(app, context, target);
|
|
131
130
|
}
|
|
132
131
|
});
|
|
133
|
-
|
|
134
132
|
//#endregion
|
|
135
|
-
export { useTheme as i, createThemeContext as n, createThemePlugin as r, createTheme as t };
|
|
133
|
+
export { useTheme as i, createThemeContext as n, createThemePlugin as r, createTheme as t };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { _ as isUndefined, a as isArray, b as useId, c as isFunction, d as isNullOrUndefined, f as isNumber, g as isSymbol, h as isString, i as debounce, l as isNaN, m as isPrimitive, n as instanceName, o as isBoolean, p as isObject, r as clamp, s as isElement, t as instanceExists, u as isNull, v as mergeDeep, y as range } from "../index-UNwEBkQT.mjs";
|
|
1
|
+
import { _ as isUndefined, a as isArray, b as useId, c as isFunction, d as isNullOrUndefined, f as isNumber, g as isSymbol, h as isString, i as debounce, l as isNaN, m as isPrimitive, n as instanceName, o as isBoolean, p as isObject, r as clamp, s as isElement, t as instanceExists, u as isNull, v as mergeDeep, y as range } from "../index-MHkcqY_y.mjs";
|
|
3
2
|
export { clamp, debounce, instanceExists, instanceName, isArray, isBoolean, isElement, isFunction, isNaN, isNull, isNullOrUndefined, isNumber, isObject, isPrimitive, isString, isSymbol, isUndefined, mergeDeep, range, useId };
|