@nuxt/ui 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/ui/button.ts +36 -36
- package/.nuxt/ui/calendar.ts +1 -1
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/drawer.ts +8 -5
- package/.nuxt/ui/navigation-menu.ts +2 -2
- package/.nuxt/ui/switch.ts +1 -1
- package/.nuxt/ui/tabs.ts +1 -1
- package/.nuxt/ui.css +1 -1
- package/README.md +11 -11
- package/cli/package.json +1 -1
- package/dist/module.cjs +2 -2
- package/dist/module.d.cts +8 -7
- package/dist/module.d.mts +8 -7
- package/dist/module.d.ts +8 -7
- package/dist/module.json +2 -2
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +11 -8
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/App.vue +1 -1
- package/dist/runtime/components/Avatar.vue +7 -5
- package/dist/runtime/components/Breadcrumb.vue +13 -10
- package/dist/runtime/components/Button.vue +1 -1
- package/dist/runtime/components/Calendar.vue +40 -11
- package/dist/runtime/components/Carousel.vue +7 -3
- package/dist/runtime/components/ColorPicker.vue +2 -0
- package/dist/runtime/components/CommandPalette.vue +14 -11
- package/dist/runtime/components/ContextMenu.vue +31 -17
- package/dist/runtime/components/ContextMenuContent.vue +22 -15
- package/dist/runtime/components/Drawer.vue +10 -15
- package/dist/runtime/components/DropdownMenu.vue +29 -16
- package/dist/runtime/components/DropdownMenuContent.vue +22 -15
- package/dist/runtime/components/Form.vue +22 -1
- package/dist/runtime/components/FormField.vue +6 -0
- package/dist/runtime/components/InputMenu.vue +93 -55
- package/dist/runtime/components/Link.vue +3 -0
- package/dist/runtime/components/LinkBase.vue +1 -0
- package/dist/runtime/components/Modal.vue +11 -8
- package/dist/runtime/components/NavigationMenu.vue +53 -27
- package/dist/runtime/components/PinInput.vue +2 -0
- package/dist/runtime/components/Popover.vue +3 -2
- package/dist/runtime/components/RadioGroup.vue +25 -14
- package/dist/runtime/components/Select.vue +70 -43
- package/dist/runtime/components/SelectMenu.vue +84 -49
- package/dist/runtime/components/Slideover.vue +11 -8
- package/dist/runtime/components/Stepper.vue +13 -10
- package/dist/runtime/components/Table.vue +8 -3
- package/dist/runtime/components/Tabs.vue +8 -5
- package/dist/runtime/components/Toast.vue +2 -2
- package/dist/runtime/components/Tooltip.vue +3 -2
- package/dist/runtime/components/Tree.vue +48 -32
- package/dist/runtime/composables/defineLocale.js +1 -0
- package/dist/runtime/composables/useFormField.js +1 -1
- package/dist/runtime/composables/useKbd.js +1 -1
- package/dist/runtime/composables/useLocale.js +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +3 -2
- package/dist/runtime/composables/useOverlay.js +1 -1
- package/dist/runtime/locale/ca.d.ts +3 -0
- package/dist/runtime/locale/ca.js +54 -0
- package/dist/runtime/locale/ckb.d.ts +3 -0
- package/dist/runtime/locale/ckb.js +55 -0
- package/dist/runtime/locale/hy.d.ts +3 -0
- package/dist/runtime/locale/hy.js +54 -0
- package/dist/runtime/locale/index.d.ts +6 -0
- package/dist/runtime/locale/index.js +6 -0
- package/dist/runtime/locale/ro.d.ts +3 -0
- package/dist/runtime/locale/ro.js +54 -0
- package/dist/runtime/locale/ur.d.ts +3 -0
- package/dist/runtime/locale/ur.js +55 -0
- package/dist/runtime/locale/uz.d.ts +3 -0
- package/dist/runtime/locale/uz.js +54 -0
- package/dist/runtime/plugins/colors.js +19 -15
- package/dist/runtime/types/form.d.ts +2 -3
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/utils.d.ts +28 -8
- package/dist/runtime/utils/form.d.ts +0 -4
- package/dist/runtime/utils/form.js +2 -47
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +3 -0
- package/dist/runtime/utils/link.d.ts +2 -25
- package/dist/runtime/utils/link.js +31 -1
- package/dist/runtime/utils/tv.js +1 -1
- package/dist/runtime/vue/components/Link.vue +3 -0
- package/dist/runtime/vue/plugins/head.js +3 -0
- package/dist/runtime/vue/stubs.d.ts +7 -3
- package/dist/runtime/vue/stubs.js +12 -4
- package/dist/shared/{ui.COBs1u5H.cjs → ui.BL-XB3u1.cjs} +26 -26
- package/dist/shared/{ui.yjbGE7Dx.mjs → ui.BkNUP964.mjs} +26 -26
- package/dist/types.d.mts +7 -1
- package/dist/types.d.ts +7 -1
- package/dist/unplugin.cjs +6 -2
- package/dist/unplugin.d.cts +2 -1
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.d.ts +2 -1
- package/dist/unplugin.mjs +6 -2
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +46 -29
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineLocale } from "../composables/defineLocale.js";
|
|
2
|
+
export default defineLocale({
|
|
3
|
+
name: "O\u02BBzbek",
|
|
4
|
+
code: "uz",
|
|
5
|
+
messages: {
|
|
6
|
+
inputMenu: {
|
|
7
|
+
noMatch: "Mos keluvchi natija topilmadi",
|
|
8
|
+
noData: "Ma\u02BClumot yo\u02BBq",
|
|
9
|
+
create: '"{label}" yaratish'
|
|
10
|
+
},
|
|
11
|
+
calendar: {
|
|
12
|
+
prevYear: "Oldingi yil",
|
|
13
|
+
nextYear: "Keyingi yil",
|
|
14
|
+
prevMonth: "Oldingi oy",
|
|
15
|
+
nextMonth: "Keyingi oy"
|
|
16
|
+
},
|
|
17
|
+
inputNumber: {
|
|
18
|
+
increment: "Qo\u02BBshish",
|
|
19
|
+
decrement: "Ayirish"
|
|
20
|
+
},
|
|
21
|
+
commandPalette: {
|
|
22
|
+
placeholder: "Buyruq kiriting yoki qidiring...",
|
|
23
|
+
noMatch: "Mos keluvchi natija topilmadi",
|
|
24
|
+
noData: "Ma\u02BClumot yo\u02BBq",
|
|
25
|
+
close: "Yopish"
|
|
26
|
+
},
|
|
27
|
+
selectMenu: {
|
|
28
|
+
noMatch: "Mos keluvchi natija topilmadi",
|
|
29
|
+
noData: "Ma\u02BClumot yo\u02BBq",
|
|
30
|
+
create: '"{label}" yaratish',
|
|
31
|
+
search: "Qidirish..."
|
|
32
|
+
},
|
|
33
|
+
toast: {
|
|
34
|
+
close: "Yopish"
|
|
35
|
+
},
|
|
36
|
+
carousel: {
|
|
37
|
+
prev: "Ortga",
|
|
38
|
+
next: "Oldinga",
|
|
39
|
+
goto: "{slide}-slaydga o\u2018tish"
|
|
40
|
+
},
|
|
41
|
+
modal: {
|
|
42
|
+
close: "Yopish"
|
|
43
|
+
},
|
|
44
|
+
slideover: {
|
|
45
|
+
close: "Yopish"
|
|
46
|
+
},
|
|
47
|
+
alert: {
|
|
48
|
+
close: "Yopish"
|
|
49
|
+
},
|
|
50
|
+
table: {
|
|
51
|
+
noData: "Ma\u02BClumot yo\u02BBq"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
+
import colors from "tailwindcss/colors";
|
|
2
3
|
import { defineNuxtPlugin, useAppConfig, useNuxtApp, useHead } from "#imports";
|
|
4
|
+
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
5
|
+
function getColor(color, shade) {
|
|
6
|
+
if (color in colors && typeof colors[color] === "object" && shade in colors[color]) {
|
|
7
|
+
return colors[color][shade];
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
function generateShades(key, value) {
|
|
12
|
+
return `${shades.map((shade) => `--ui-color-${key}-${shade}: var(--color-${value === "neutral" ? "old-neutral" : value}-${shade}, ${getColor(value, shade)});`).join("\n ")}`;
|
|
13
|
+
}
|
|
14
|
+
function generateColor(key, shade) {
|
|
15
|
+
return `--ui-${key}: var(--ui-color-${key}-${shade});`;
|
|
16
|
+
}
|
|
3
17
|
export default defineNuxtPlugin(() => {
|
|
4
18
|
const appConfig = useAppConfig();
|
|
5
19
|
const nuxtApp = useNuxtApp();
|
|
6
|
-
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
7
|
-
function generateShades(key, value) {
|
|
8
|
-
return `${shades.map((shade) => `--ui-color-${key}-${shade}: var(--color-${value === "neutral" ? "old-neutral" : value}-${shade});`).join("\n ")}`;
|
|
9
|
-
}
|
|
10
|
-
function generateColor(key, shade) {
|
|
11
|
-
return `--ui-${key}: var(--ui-color-${key}-${shade});`;
|
|
12
|
-
}
|
|
13
20
|
const root = computed(() => {
|
|
14
|
-
const { neutral, ...
|
|
21
|
+
const { neutral, ...colors2 } = appConfig.ui.colors;
|
|
15
22
|
return `@layer base {
|
|
16
23
|
:root {
|
|
17
24
|
${Object.entries(appConfig.ui.colors).map(([key, value]) => generateShades(key, value)).join("\n ")}
|
|
18
25
|
}
|
|
19
26
|
:root, .light {
|
|
20
|
-
${Object.keys(
|
|
27
|
+
${Object.keys(colors2).map((key) => generateColor(key, 500)).join("\n ")}
|
|
21
28
|
}
|
|
22
29
|
.dark {
|
|
23
|
-
${Object.keys(
|
|
30
|
+
${Object.keys(colors2).map((key) => generateColor(key, 400)).join("\n ")}
|
|
24
31
|
}
|
|
25
32
|
}`;
|
|
26
33
|
});
|
|
@@ -28,8 +35,7 @@ export default defineNuxtPlugin(() => {
|
|
|
28
35
|
style: [{
|
|
29
36
|
innerHTML: () => root.value,
|
|
30
37
|
tagPriority: -2,
|
|
31
|
-
id: "nuxt-ui-colors"
|
|
32
|
-
type: "text/css"
|
|
38
|
+
id: "nuxt-ui-colors"
|
|
33
39
|
}]
|
|
34
40
|
};
|
|
35
41
|
if (import.meta.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
|
|
@@ -41,7 +47,5 @@ export default defineNuxtPlugin(() => {
|
|
|
41
47
|
innerHTML: "document.head.removeChild(document.querySelector('[data-nuxt-ui-colors]'))"
|
|
42
48
|
}];
|
|
43
49
|
}
|
|
44
|
-
|
|
45
|
-
useHead(headData);
|
|
46
|
-
}
|
|
50
|
+
useHead(headData);
|
|
47
51
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import type { ComputedRef, DeepReadonly, Ref } from 'vue';
|
|
3
|
-
import type { ZodSchema } from 'zod';
|
|
4
3
|
import type { Schema as JoiSchema } from 'joi';
|
|
5
4
|
import type { ObjectSchema as YupObjectSchema } from 'yup';
|
|
6
|
-
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
7
5
|
import type { GetObjectField } from './utils';
|
|
8
6
|
import type { Struct as SuperstructSchema } from 'superstruct';
|
|
9
7
|
export interface Form<T extends object> {
|
|
@@ -24,7 +22,7 @@ export interface Form<T extends object> {
|
|
|
24
22
|
touchedFields: DeepReadonly<Set<keyof T>>;
|
|
25
23
|
blurredFields: DeepReadonly<Set<keyof T>>;
|
|
26
24
|
}
|
|
27
|
-
export type FormSchema<T extends object> =
|
|
25
|
+
export type FormSchema<T extends object> = YupObjectSchema<T> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
|
|
28
26
|
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
29
27
|
export interface FormError<P extends string = string> {
|
|
30
28
|
name?: P;
|
|
@@ -70,6 +68,7 @@ export interface FormFieldInjectedOptions<T> {
|
|
|
70
68
|
errorPattern?: RegExp;
|
|
71
69
|
hint?: string;
|
|
72
70
|
description?: string;
|
|
71
|
+
help?: string;
|
|
73
72
|
ariaId: string;
|
|
74
73
|
}
|
|
75
74
|
export interface ValidateReturnSchema<T> {
|
|
@@ -6,6 +6,7 @@ export * from '../components/AvatarGroup.vue';
|
|
|
6
6
|
export * from '../components/Badge.vue';
|
|
7
7
|
export * from '../components/Breadcrumb.vue';
|
|
8
8
|
export * from '../components/Button.vue';
|
|
9
|
+
export * from '../components/ButtonGroup.vue';
|
|
9
10
|
export * from '../components/Calendar.vue';
|
|
10
11
|
export * from '../components/Card.vue';
|
|
11
12
|
export * from '../components/Carousel.vue';
|
|
@@ -20,6 +21,7 @@ export * from '../components/Drawer.vue';
|
|
|
20
21
|
export * from '../components/DropdownMenu.vue';
|
|
21
22
|
export * from '../components/Form.vue';
|
|
22
23
|
export * from '../components/FormField.vue';
|
|
24
|
+
export * from '../components/Icon.vue';
|
|
23
25
|
export * from '../components/Input.vue';
|
|
24
26
|
export * from '../components/InputMenu.vue';
|
|
25
27
|
export * from '../components/InputNumber.vue';
|
|
@@ -6,6 +6,7 @@ export * from "../components/AvatarGroup.vue";
|
|
|
6
6
|
export * from "../components/Badge.vue";
|
|
7
7
|
export * from "../components/Breadcrumb.vue";
|
|
8
8
|
export * from "../components/Button.vue";
|
|
9
|
+
export * from "../components/ButtonGroup.vue";
|
|
9
10
|
export * from "../components/Calendar.vue";
|
|
10
11
|
export * from "../components/Card.vue";
|
|
11
12
|
export * from "../components/Carousel.vue";
|
|
@@ -20,6 +21,7 @@ export * from "../components/Drawer.vue";
|
|
|
20
21
|
export * from "../components/DropdownMenu.vue";
|
|
21
22
|
export * from "../components/Form.vue";
|
|
22
23
|
export * from "../components/FormField.vue";
|
|
24
|
+
export * from "../components/Icon.vue";
|
|
23
25
|
export * from "../components/Input.vue";
|
|
24
26
|
export * from "../components/InputMenu.vue";
|
|
25
27
|
export * from "../components/InputNumber.vue";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AcceptableValue as _AcceptableValue } from 'reka-ui';
|
|
1
2
|
import type { VNode } from 'vue';
|
|
2
3
|
export interface TightMap<O = any> {
|
|
3
4
|
[key: string]: TightMap | O;
|
|
@@ -9,20 +10,39 @@ export type DeepPartial<T, O = any> = {
|
|
|
9
10
|
};
|
|
10
11
|
export type DynamicSlots<T extends {
|
|
11
12
|
slot?: string;
|
|
12
|
-
},
|
|
13
|
+
}, S extends string | undefined = undefined, D extends object = {}> = {
|
|
14
|
+
[K in T['slot'] as K extends string ? S extends string ? (K | `${K}-${S}`) : K : never]?: (props: {
|
|
15
|
+
item: Extract<T, {
|
|
16
|
+
slot: K extends `${infer Base}-${S}` ? Base : K;
|
|
17
|
+
}>;
|
|
18
|
+
} & D) => any;
|
|
19
|
+
};
|
|
13
20
|
export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extends Record<string, any> ? MaybeObject[Key] : never;
|
|
14
21
|
export type PartialString<T> = {
|
|
15
22
|
[K in keyof T]?: string;
|
|
16
23
|
};
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
export type AcceptableValue = Exclude<_AcceptableValue, Record<string, any>>;
|
|
25
|
+
export type ArrayOrNested<T> = T[] | T[][];
|
|
26
|
+
export type NestedItem<T> = T extends Array<infer I> ? NestedItem<I> : T;
|
|
27
|
+
type AllKeys<T> = T extends any ? keyof T : never;
|
|
28
|
+
type NonCommonKeys<T extends object> = Exclude<AllKeys<T>, keyof T>;
|
|
29
|
+
type PickTypeOf<T, K extends string | number | symbol> = K extends AllKeys<T> ? T extends {
|
|
30
|
+
[k in K]?: any;
|
|
31
|
+
} ? T[K] : undefined : never;
|
|
32
|
+
export type MergeTypes<T extends object> = {
|
|
33
|
+
[k in keyof T]: PickTypeOf<T, k>;
|
|
34
|
+
} & {
|
|
35
|
+
[k in NonCommonKeys<T>]?: PickTypeOf<T, k>;
|
|
36
|
+
};
|
|
37
|
+
export type GetItemKeys<I> = keyof Extract<NestedItem<I>, object>;
|
|
38
|
+
export type GetItemValue<I, VK extends GetItemKeys<I> | undefined, T extends NestedItem<I> = NestedItem<I>> = T extends object ? VK extends undefined ? T : VK extends keyof T ? T[VK] : never : T;
|
|
39
|
+
export type GetModelValue<T, VK extends GetItemKeys<T> | undefined, M extends boolean> = M extends true ? GetItemValue<T, VK>[] : GetItemValue<T, VK>;
|
|
40
|
+
export type GetModelValueEmits<T, VK extends GetItemKeys<T> | undefined, M extends boolean> = {
|
|
41
|
+
/** Event handler called when the value changes. */
|
|
42
|
+
'update:modelValue': [payload: GetModelValue<T, VK, M>];
|
|
23
43
|
};
|
|
24
|
-
export type MaybeMultipleModelValue<T, M extends boolean = false> = (T extends infer U ? M extends true ? U[] : U : never);
|
|
25
44
|
export type StringOrVNode = string | VNode | (() => VNode);
|
|
26
45
|
export type EmitsToProps<T> = {
|
|
27
46
|
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
28
47
|
};
|
|
48
|
+
export {};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
import type { ZodSchema } from 'zod';
|
|
3
2
|
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi';
|
|
4
3
|
import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup';
|
|
5
|
-
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
6
4
|
import type { Struct } from 'superstruct';
|
|
7
5
|
import type { FormSchema, ValidateReturnSchema } from '../types/form';
|
|
8
6
|
export declare function isYupSchema(schema: any): schema is YupObjectSchema<any>;
|
|
9
7
|
export declare function isYupError(error: any): error is YupError;
|
|
10
8
|
export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
|
|
11
|
-
export declare function isZodSchema(schema: any): schema is ZodSchema;
|
|
12
9
|
export declare function isJoiSchema(schema: any): schema is JoiSchema;
|
|
13
10
|
export declare function isJoiError(error: any): error is JoiError;
|
|
14
|
-
export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
|
|
15
11
|
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
16
12
|
export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
17
13
|
export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
@@ -7,18 +7,12 @@ export function isYupError(error) {
|
|
|
7
7
|
export function isSuperStructSchema(schema) {
|
|
8
8
|
return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
|
|
9
9
|
}
|
|
10
|
-
export function isZodSchema(schema) {
|
|
11
|
-
return schema.parse !== void 0;
|
|
12
|
-
}
|
|
13
10
|
export function isJoiSchema(schema) {
|
|
14
11
|
return schema.validateAsync !== void 0 && schema.id !== void 0;
|
|
15
12
|
}
|
|
16
13
|
export function isJoiError(error) {
|
|
17
14
|
return error.isJoi === true;
|
|
18
15
|
}
|
|
19
|
-
export function isValibotSchema(schema) {
|
|
20
|
-
return "_run" in schema || typeof schema === "function" && "schema" in schema;
|
|
21
|
-
}
|
|
22
16
|
export function isStandardSchema(schema) {
|
|
23
17
|
return "~standard" in schema;
|
|
24
18
|
}
|
|
@@ -77,23 +71,6 @@ async function validateSuperstructSchema(state, schema) {
|
|
|
77
71
|
result
|
|
78
72
|
};
|
|
79
73
|
}
|
|
80
|
-
async function validateZodSchema(state, schema) {
|
|
81
|
-
const result = await schema.safeParseAsync(state);
|
|
82
|
-
if (result.success === false) {
|
|
83
|
-
const errors = result.error.issues.map((issue) => ({
|
|
84
|
-
name: issue.path.join("."),
|
|
85
|
-
message: issue.message
|
|
86
|
-
}));
|
|
87
|
-
return {
|
|
88
|
-
errors,
|
|
89
|
-
result: null
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
result: result.data,
|
|
94
|
-
errors: null
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
74
|
async function validateJoiSchema(state, schema) {
|
|
98
75
|
try {
|
|
99
76
|
const result = await schema.validateAsync(state, { abortEarly: false });
|
|
@@ -116,33 +93,11 @@ async function validateJoiSchema(state, schema) {
|
|
|
116
93
|
}
|
|
117
94
|
}
|
|
118
95
|
}
|
|
119
|
-
async function validateValibotSchema(state, schema) {
|
|
120
|
-
const result = await ("_run" in schema ? schema._run({ typed: false, value: state }, {}) : schema(state));
|
|
121
|
-
if (!result.issues || result.issues.length === 0) {
|
|
122
|
-
const output = "output" in result ? result.output : "value" in result ? result.value : null;
|
|
123
|
-
return {
|
|
124
|
-
errors: null,
|
|
125
|
-
result: output
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
const errors = result.issues.map((issue) => ({
|
|
129
|
-
name: issue.path?.map((item) => item.key).join(".") || "",
|
|
130
|
-
message: issue.message
|
|
131
|
-
}));
|
|
132
|
-
return {
|
|
133
|
-
errors,
|
|
134
|
-
result: null
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
96
|
export function validateSchema(state, schema) {
|
|
138
|
-
if (
|
|
139
|
-
return
|
|
97
|
+
if (isStandardSchema(schema)) {
|
|
98
|
+
return validateStandardSchema(state, schema);
|
|
140
99
|
} else if (isJoiSchema(schema)) {
|
|
141
100
|
return validateJoiSchema(state, schema);
|
|
142
|
-
} else if (isStandardSchema(schema)) {
|
|
143
|
-
return validateStandardSchema(state, schema);
|
|
144
|
-
} else if (isValibotSchema(schema)) {
|
|
145
|
-
return validateValibotSchema(state, schema);
|
|
146
101
|
} else if (isYupSchema(schema)) {
|
|
147
102
|
return validateYupSchema(state, schema);
|
|
148
103
|
} else if (isSuperStructSchema(schema)) {
|
|
@@ -4,3 +4,4 @@ export declare function get(object: Record<string, any> | undefined, path: (stri
|
|
|
4
4
|
export declare function set(object: Record<string, any>, path: (string | number)[] | string, value: any): void;
|
|
5
5
|
export declare function looseToNumber(val: any): any;
|
|
6
6
|
export declare function compare<T>(value?: T, currentValue?: T, comparator?: string | ((a: T, b: T) => boolean)): boolean;
|
|
7
|
+
export declare function isArrayOfArray<A>(item: A[] | A[][]): item is A[][];
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import type { LinkProps } from '../types';
|
|
2
2
|
export declare function pickLinkProps(link: LinkProps & {
|
|
3
|
-
|
|
4
|
-
title?: string;
|
|
3
|
+
[key: string]: any;
|
|
5
4
|
}): {
|
|
6
|
-
|
|
7
|
-
type: any;
|
|
8
|
-
title: any;
|
|
9
|
-
exact: any;
|
|
10
|
-
active: any;
|
|
11
|
-
activeClass: any;
|
|
12
|
-
ariaCurrentValue: any;
|
|
13
|
-
ariaLabel: any;
|
|
14
|
-
as: any;
|
|
15
|
-
disabled: any;
|
|
16
|
-
exactActiveClass: any;
|
|
17
|
-
exactHash: any;
|
|
18
|
-
exactQuery: any;
|
|
19
|
-
external: any;
|
|
20
|
-
href: any;
|
|
21
|
-
inactiveClass: any;
|
|
22
|
-
noPrefetch: any;
|
|
23
|
-
noRel: any;
|
|
24
|
-
prefetch: any;
|
|
25
|
-
prefetchedClass: any;
|
|
26
|
-
rel: any;
|
|
27
|
-
target: any;
|
|
28
|
-
to: any;
|
|
5
|
+
[x: string]: any;
|
|
29
6
|
};
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
2
|
export function pickLinkProps(link) {
|
|
3
|
-
|
|
3
|
+
const keys = Object.keys(link);
|
|
4
|
+
const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
|
|
5
|
+
const dataKeys = keys.filter((key) => key.startsWith("data-"));
|
|
6
|
+
const propsToInclude = [
|
|
7
|
+
"active",
|
|
8
|
+
"activeClass",
|
|
9
|
+
"ariaCurrentValue",
|
|
10
|
+
"as",
|
|
11
|
+
"disabled",
|
|
12
|
+
"exact",
|
|
13
|
+
"exactActiveClass",
|
|
14
|
+
"exactHash",
|
|
15
|
+
"exactQuery",
|
|
16
|
+
"external",
|
|
17
|
+
"href",
|
|
18
|
+
"inactiveClass",
|
|
19
|
+
"noPrefetch",
|
|
20
|
+
"noRel",
|
|
21
|
+
"prefetch",
|
|
22
|
+
"prefetchedClass",
|
|
23
|
+
"rel",
|
|
24
|
+
"replace",
|
|
25
|
+
"target",
|
|
26
|
+
"to",
|
|
27
|
+
"type",
|
|
28
|
+
"title",
|
|
29
|
+
"onClick",
|
|
30
|
+
...ariaKeys,
|
|
31
|
+
...dataKeys
|
|
32
|
+
];
|
|
33
|
+
return reactivePick(link, ...propsToInclude);
|
|
4
34
|
}
|
package/dist/runtime/utils/tv.js
CHANGED
|
@@ -103,6 +103,7 @@ defineOptions({ inheritAttrs: false })
|
|
|
103
103
|
const props = withDefaults(defineProps<LinkProps>(), {
|
|
104
104
|
as: 'button',
|
|
105
105
|
type: 'button',
|
|
106
|
+
ariaCurrentValue: 'page',
|
|
106
107
|
active: undefined,
|
|
107
108
|
activeClass: '',
|
|
108
109
|
inactiveClass: ''
|
|
@@ -204,6 +205,7 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
|
|
|
204
205
|
<slot
|
|
205
206
|
v-bind="{
|
|
206
207
|
...$attrs,
|
|
208
|
+
...(exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {}),
|
|
207
209
|
as,
|
|
208
210
|
type,
|
|
209
211
|
disabled,
|
|
@@ -217,6 +219,7 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
|
|
|
217
219
|
v-else
|
|
218
220
|
v-bind="{
|
|
219
221
|
...$attrs,
|
|
222
|
+
...(exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {}),
|
|
220
223
|
as,
|
|
221
224
|
type,
|
|
222
225
|
disabled,
|
|
@@ -7,8 +7,8 @@ export { defineLocale } from '../composables/defineLocale';
|
|
|
7
7
|
export { useLocale } from '../composables/useLocale';
|
|
8
8
|
export declare const useColorMode: () => {
|
|
9
9
|
forced: boolean;
|
|
10
|
-
preference?:
|
|
11
|
-
readonly value?:
|
|
10
|
+
preference?: "system" | "light" | "dark";
|
|
11
|
+
readonly value?: import("@vueuse/core").BasicColorMode;
|
|
12
12
|
} | {
|
|
13
13
|
preference: "system" | "light" | "dark";
|
|
14
14
|
readonly value: import("@vueuse/core").BasicColorMode;
|
|
@@ -26,11 +26,15 @@ export declare const useCookie: <T = string>(_name: string, _options?: Record<st
|
|
|
26
26
|
export declare const useState: <T>(key: string, init: () => T) => Ref<T>;
|
|
27
27
|
export declare function useNuxtApp(): {
|
|
28
28
|
isHydrating: boolean;
|
|
29
|
-
isVue: boolean;
|
|
30
29
|
payload: {
|
|
31
30
|
serverRendered: boolean;
|
|
32
31
|
};
|
|
32
|
+
hooks: import("hookable").Hookable<Record<string, any>, string>;
|
|
33
|
+
hook: <NameT extends string>(name: NameT, function_: any, options?: {
|
|
34
|
+
allowDeprecated?: boolean;
|
|
35
|
+
}) => () => void;
|
|
33
36
|
};
|
|
37
|
+
export declare function useRuntimeHook(name: string, fn: (...args: any[]) => void): void;
|
|
34
38
|
export declare function defineNuxtPlugin(plugin: (nuxtApp: NuxtApp) => void): {
|
|
35
39
|
install(app: import("vue").App<any>): void;
|
|
36
40
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { ref, onScopeDispose } from "vue";
|
|
2
|
+
import { createHooks } from "hookable";
|
|
2
3
|
import appConfig from "#build/app.config";
|
|
3
4
|
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
4
5
|
export { useHead } from "@unhead/vue";
|
|
@@ -50,17 +51,24 @@ export const useState = (key, init) => {
|
|
|
50
51
|
state[key] = value;
|
|
51
52
|
return value;
|
|
52
53
|
};
|
|
54
|
+
const hooks = createHooks();
|
|
53
55
|
export function useNuxtApp() {
|
|
54
56
|
return {
|
|
55
57
|
isHydrating: true,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
payload: { serverRendered: false },
|
|
59
|
+
hooks,
|
|
60
|
+
hook: hooks.hook
|
|
58
61
|
};
|
|
59
62
|
}
|
|
63
|
+
export function useRuntimeHook(name, fn) {
|
|
64
|
+
const nuxtApp = useNuxtApp();
|
|
65
|
+
const unregister = nuxtApp.hook(name, fn);
|
|
66
|
+
onScopeDispose(unregister);
|
|
67
|
+
}
|
|
60
68
|
export function defineNuxtPlugin(plugin) {
|
|
61
69
|
return {
|
|
62
70
|
install(app) {
|
|
63
|
-
plugin({ vueApp: app });
|
|
71
|
+
app.runWithContext(() => plugin({ vueApp: app }));
|
|
64
72
|
}
|
|
65
73
|
};
|
|
66
74
|
}
|