@nuxt/ui 3.0.2 → 3.1.1
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/accordion.ts +2 -2
- package/.nuxt/ui/alert.ts +29 -29
- package/.nuxt/ui/avatar-group.ts +1 -1
- package/.nuxt/ui/avatar.ts +3 -3
- package/.nuxt/ui/badge.ts +33 -33
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button.ts +43 -43
- package/.nuxt/ui/calendar.ts +17 -17
- package/.nuxt/ui/card.ts +5 -5
- package/.nuxt/ui/carousel.ts +6 -6
- package/.nuxt/ui/checkbox-group.ts +61 -0
- package/.nuxt/ui/checkbox.ts +140 -27
- package/.nuxt/ui/chip.ts +8 -8
- package/.nuxt/ui/color-picker.ts +3 -3
- package/.nuxt/ui/command-palette.ts +14 -14
- package/.nuxt/ui/context-menu.ts +33 -33
- package/.nuxt/ui/drawer.ts +10 -10
- package/.nuxt/ui/dropdown-menu.ts +34 -34
- package/.nuxt/ui/form-field.ts +6 -6
- package/.nuxt/ui/index.ts +1 -0
- package/.nuxt/ui/input-menu.ts +42 -42
- package/.nuxt/ui/input-number.ts +20 -20
- package/.nuxt/ui/input.ts +23 -23
- package/.nuxt/ui/kbd.ts +4 -4
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +5 -5
- package/.nuxt/ui/navigation-menu.ts +78 -80
- package/.nuxt/ui/pin-input.ts +20 -20
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +17 -17
- package/.nuxt/ui/radio-group.ts +250 -35
- package/.nuxt/ui/select-menu.ts +36 -33
- package/.nuxt/ui/select.ts +32 -32
- package/.nuxt/ui/separator.ts +8 -8
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +4 -4
- package/.nuxt/ui/slider.ts +16 -16
- package/.nuxt/ui/stepper.ts +18 -18
- package/.nuxt/ui/switch.ts +20 -20
- package/.nuxt/ui/table.ts +15 -15
- package/.nuxt/ui/tabs.ts +32 -32
- package/.nuxt/ui/textarea.ts +40 -35
- package/.nuxt/ui/toast.ts +24 -24
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui/tree.ts +18 -18
- package/.nuxt/ui.css +63 -12
- package/README.md +15 -0
- package/cli/templates.mjs +18 -17
- package/dist/module.json +5 -5
- package/dist/module.mjs +12 -7
- package/dist/runtime/components/Accordion.vue +36 -93
- package/dist/runtime/components/Accordion.vue.d.ts +75 -0
- package/dist/runtime/components/Alert.vue +37 -100
- package/dist/runtime/components/Alert.vue.d.ts +81 -0
- package/dist/runtime/components/App.vue +28 -34
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +42 -75
- package/dist/runtime/components/Avatar.vue.d.ts +39 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +31 -0
- package/dist/runtime/components/Badge.vue +33 -62
- package/dist/runtime/components/Badge.vue.d.ts +41 -0
- package/dist/runtime/components/Breadcrumb.vue +37 -90
- package/dist/runtime/components/Breadcrumb.vue.d.ts +64 -0
- package/dist/runtime/components/Button.vue +95 -104
- package/dist/runtime/components/Button.vue.d.ts +48 -0
- package/dist/runtime/components/ButtonGroup.vue +20 -46
- package/dist/runtime/components/ButtonGroup.vue.d.ts +34 -0
- package/dist/runtime/components/Calendar.vue +67 -150
- package/dist/runtime/components/Calendar.vue.d.ts +111 -0
- package/dist/runtime/components/Card.vue +18 -40
- package/dist/runtime/components/Card.vue.d.ts +29 -0
- package/dist/runtime/components/Carousel.vue +112 -234
- package/dist/runtime/components/Carousel.vue.d.ts +122 -0
- package/dist/runtime/components/Checkbox.vue +52 -93
- package/dist/runtime/components/Checkbox.vue.d.ts +73 -0
- package/dist/runtime/components/CheckboxGroup.vue +121 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +78 -0
- package/dist/runtime/components/Chip.vue +26 -69
- package/dist/runtime/components/Chip.vue.d.ts +57 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +35 -0
- package/dist/runtime/components/ColorPicker.vue +111 -197
- package/dist/runtime/components/ColorPicker.vue.d.ts +48 -0
- package/dist/runtime/components/CommandPalette.vue +96 -237
- package/dist/runtime/components/CommandPalette.vue.d.ts +161 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +18 -0
- package/dist/runtime/components/ContextMenu.vue +34 -133
- package/dist/runtime/components/ContextMenu.vue.d.ts +107 -0
- package/dist/runtime/components/ContextMenuContent.vue +73 -81
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +65 -0
- package/dist/runtime/components/Drawer.vue +49 -83
- package/dist/runtime/components/Drawer.vue.d.ts +78 -0
- package/dist/runtime/components/DropdownMenu.vue +39 -142
- package/dist/runtime/components/DropdownMenu.vue.d.ts +117 -0
- package/dist/runtime/components/DropdownMenuContent.vue +78 -88
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +68 -0
- package/dist/runtime/components/Form.vue +135 -220
- package/dist/runtime/components/Form.vue.d.ts +69 -0
- package/dist/runtime/components/FormField.vue +35 -77
- package/dist/runtime/components/FormField.vue.d.ts +61 -0
- package/dist/runtime/components/Icon.vue +12 -19
- package/dist/runtime/components/Icon.vue.d.ts +8 -0
- package/dist/runtime/components/Input.vue +82 -140
- package/dist/runtime/components/Input.vue.d.ts +76 -0
- package/dist/runtime/components/InputMenu.vue +185 -332
- package/dist/runtime/components/InputMenu.vue.d.ts +324 -0
- package/dist/runtime/components/InputNumber.vue +71 -133
- package/dist/runtime/components/InputNumber.vue.d.ts +182 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +34 -0
- package/dist/runtime/components/Link.vue +98 -176
- package/dist/runtime/components/Link.vue.d.ts +93 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/components/Modal.vue +53 -116
- package/dist/runtime/components/Modal.vue.d.ts +93 -0
- package/dist/runtime/components/NavigationMenu.vue +77 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +139 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +46 -140
- package/dist/runtime/components/Pagination.vue.d.ts +119 -0
- package/dist/runtime/components/PinInput.vue +61 -78
- package/dist/runtime/components/PinInput.vue.d.ts +57 -0
- package/dist/runtime/components/Popover.vue +47 -84
- package/dist/runtime/components/Popover.vue.d.ts +63 -0
- package/dist/runtime/components/Progress.vue +70 -131
- package/dist/runtime/components/Progress.vue.d.ts +66 -0
- package/dist/runtime/components/RadioGroup.vue +70 -132
- package/dist/runtime/components/RadioGroup.vue.d.ts +91 -0
- package/dist/runtime/components/Select.vue +110 -224
- package/dist/runtime/components/Select.vue.d.ts +145 -0
- package/dist/runtime/components/SelectMenu.vue +161 -310
- package/dist/runtime/components/SelectMenu.vue.d.ts +196 -0
- package/dist/runtime/components/Separator.vue +29 -71
- package/dist/runtime/components/Separator.vue.d.ts +54 -0
- package/dist/runtime/components/Skeleton.vue +21 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +17 -0
- package/dist/runtime/components/Slideover.vue +53 -120
- package/dist/runtime/components/Slideover.vue.d.ts +94 -0
- package/dist/runtime/components/Slider.vue +46 -84
- package/dist/runtime/components/Slider.vue.d.ts +52 -0
- package/dist/runtime/components/Stepper.vue +45 -115
- package/dist/runtime/components/Stepper.vue.d.ts +83 -0
- package/dist/runtime/components/Switch.vue +45 -93
- package/dist/runtime/components/Switch.vue.d.ts +70 -0
- package/dist/runtime/components/Table.vue +163 -267
- package/dist/runtime/components/Table.vue.d.ts +183 -0
- package/dist/runtime/components/Tabs.vue +41 -107
- package/dist/runtime/components/Tabs.vue.d.ts +88 -0
- package/dist/runtime/components/Textarea.vue +113 -158
- package/dist/runtime/components/Textarea.vue.d.ts +78 -0
- package/dist/runtime/components/Toast.vue +49 -110
- package/dist/runtime/components/Toast.vue.d.ts +157 -0
- package/dist/runtime/components/Toaster.vue +70 -107
- package/dist/runtime/components/Toaster.vue.d.ts +38 -0
- package/dist/runtime/components/Tooltip.vue +38 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +50 -0
- package/dist/runtime/components/Tree.vue +59 -166
- package/dist/runtime/components/Tree.vue.d.ts +111 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +6 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useKbd.d.ts +1 -0
- package/dist/runtime/composables/useKbd.js +4 -3
- package/dist/runtime/composables/useOverlay.d.ts +14 -8
- package/dist/runtime/composables/useOverlay.js +20 -7
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/inertia/components/Link.vue +146 -0
- package/dist/runtime/inertia/components/Link.vue.d.ts +63 -0
- package/dist/runtime/inertia/stubs.d.ts +43 -0
- package/dist/runtime/inertia/stubs.js +82 -0
- package/dist/runtime/locale/bg.d.ts +3 -0
- package/dist/runtime/locale/bg.js +54 -0
- package/dist/runtime/locale/index.d.ts +5 -1
- package/dist/runtime/locale/index.js +5 -1
- package/dist/runtime/locale/kk.d.ts +3 -0
- package/dist/runtime/locale/kk.js +54 -0
- package/dist/runtime/locale/tj.d.ts +3 -0
- package/dist/runtime/locale/tj.js +54 -0
- package/dist/runtime/locale/ug_cn.d.ts +3 -0
- package/dist/runtime/locale/ug_cn.js +55 -0
- package/dist/runtime/types/form.d.ts +4 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/tv.d.ts +53 -0
- package/dist/runtime/types/tv.js +0 -0
- package/dist/runtime/types/utils.d.ts +7 -17
- package/dist/runtime/types/utils.js +1 -0
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/link.js +1 -0
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Icon.vue +7 -8
- package/dist/runtime/vue/components/Icon.vue.d.ts +5 -0
- package/dist/runtime/vue/components/Link.vue +118 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +93 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{ui.BkNUP964.mjs → ui.CbtTMMzt.mjs} +631 -366
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.d.mts +6 -2
- package/dist/unplugin.mjs +25 -4
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +96 -54
- package/dist/module.cjs +0 -62
- package/dist/module.d.cts +0 -45
- package/dist/module.d.ts +0 -45
- package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -232
- package/dist/unplugin.d.cts +0 -62
- package/dist/unplugin.d.ts +0 -62
- package/dist/vite.cjs +0 -23
- package/dist/vite.d.cts +0 -15
- package/dist/vite.d.ts +0 -15
|
@@ -11,6 +11,7 @@ export * from "../components/Calendar.vue";
|
|
|
11
11
|
export * from "../components/Card.vue";
|
|
12
12
|
export * from "../components/Carousel.vue";
|
|
13
13
|
export * from "../components/Checkbox.vue";
|
|
14
|
+
export * from "../components/CheckboxGroup.vue";
|
|
14
15
|
export * from "../components/Chip.vue";
|
|
15
16
|
export * from "../components/Collapsible.vue";
|
|
16
17
|
export * from "../components/ColorPicker.vue";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ClassValue, TVVariants, TVCompoundVariants, TVDefaultVariants } from 'tailwind-variants';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the AppConfig object based on the tailwind-variants configuration.
|
|
4
|
+
*/
|
|
5
|
+
export type TVConfig<T extends Record<string, any>> = {
|
|
6
|
+
[P in keyof T]?: {
|
|
7
|
+
[K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'compoundVariants' | 'defaultVariants' ? K : never]?: K extends 'base' ? ClassValue : K extends 'slots' ? {
|
|
8
|
+
[S in keyof T[P]['slots']]?: ClassValue;
|
|
9
|
+
} : K extends 'variants' ? TVVariants<T[P]['slots'], ClassValue, T[P]['variants']> : K extends 'compoundVariants' ? TVCompoundVariants<T[P]['variants'], T[P]['slots'], ClassValue, object, undefined> : K extends 'defaultVariants' ? TVDefaultVariants<T[P]['variants'], T[P]['slots'], object, undefined> : never;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Utility type to flatten intersection types for better IDE hover information.
|
|
14
|
+
* @template T The type to flatten.
|
|
15
|
+
*/
|
|
16
|
+
type Id<T> = {} & {
|
|
17
|
+
[P in keyof T]: T[P];
|
|
18
|
+
};
|
|
19
|
+
type ComponentVariants<T extends {
|
|
20
|
+
variants?: Record<string, Record<string, any>>;
|
|
21
|
+
}> = {
|
|
22
|
+
[K in keyof T['variants']]: keyof T['variants'][K];
|
|
23
|
+
};
|
|
24
|
+
type ComponentSlots<T extends {
|
|
25
|
+
slots?: Record<string, any>;
|
|
26
|
+
}> = Id<{
|
|
27
|
+
[K in keyof T['slots']]?: ClassValue;
|
|
28
|
+
}>;
|
|
29
|
+
type GetComponentAppConfig<A, U extends string, K extends string> = A extends Record<U, Record<K, any>> ? A[U][K] : {};
|
|
30
|
+
type ComponentAppConfig<T, A extends Record<string, any>, K extends string, U extends string = 'ui' | 'uiPro' | 'uiPro.prose'> = A & (U extends 'uiPro.prose' ? {
|
|
31
|
+
uiPro?: {
|
|
32
|
+
prose?: {
|
|
33
|
+
[k in K]?: Partial<T>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
} : {
|
|
37
|
+
[key in Exclude<U, 'uiPro.prose'>]?: {
|
|
38
|
+
[k in K]?: Partial<T>;
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Defines the configuration shape expected for a component.
|
|
43
|
+
* @template T The component's theme imported from `#build/ui/*`.
|
|
44
|
+
* @template A The base AppConfig type from `@nuxt/schema`.
|
|
45
|
+
* @template K The key identifying the component (e.g., 'badge').
|
|
46
|
+
* @template U The top-level key in AppConfig ('ui' or 'uiPro').
|
|
47
|
+
*/
|
|
48
|
+
export type ComponentConfig<T extends Record<string, any>, A extends Record<string, any>, K extends string, U extends 'ui' | 'uiPro' | 'uiPro.prose' = 'ui'> = {
|
|
49
|
+
AppConfig: ComponentAppConfig<T, A, K, U>;
|
|
50
|
+
variants: ComponentVariants<T & GetComponentAppConfig<A, U, K>>;
|
|
51
|
+
slots: ComponentSlots<T>;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
File without changes
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import type { AcceptableValue as _AcceptableValue } from 'reka-ui';
|
|
2
1
|
import type { VNode } from 'vue';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export type DeepPartial<T, O = any> = {
|
|
7
|
-
[P in keyof T]?: T[P] extends Array<string> ? string : T[P] extends object ? DeepPartial<T[P], O> : T[P];
|
|
8
|
-
} & {
|
|
9
|
-
[key: string]: O | TightMap<O>;
|
|
10
|
-
};
|
|
2
|
+
import type { AcceptableValue as _AcceptableValue } from 'reka-ui';
|
|
3
|
+
export type DynamicSlotsKeys<Name extends string | undefined, Suffix extends string | undefined = undefined> = (Name extends string ? Suffix extends string ? Name | `${Name}-${Suffix}` : Name : never);
|
|
11
4
|
export type DynamicSlots<T extends {
|
|
12
5
|
slot?: string;
|
|
13
|
-
},
|
|
14
|
-
[K in T['slot']
|
|
6
|
+
}, Suffix extends string | undefined = undefined, ExtraProps extends object = {}> = {
|
|
7
|
+
[K in DynamicSlotsKeys<T['slot'], Suffix>]: (props: {
|
|
15
8
|
item: Extract<T, {
|
|
16
|
-
slot: K extends `${infer Base}-${
|
|
9
|
+
slot: K extends `${infer Base}-${Suffix}` ? Base : K;
|
|
17
10
|
}>;
|
|
18
|
-
} &
|
|
11
|
+
} & ExtraProps) => any;
|
|
19
12
|
};
|
|
20
13
|
export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extends Record<string, any> ? MaybeObject[Key] : never;
|
|
21
|
-
export type PartialString<T> = {
|
|
22
|
-
[K in keyof T]?: string;
|
|
23
|
-
};
|
|
24
14
|
export type AcceptableValue = Exclude<_AcceptableValue, Record<string, any>>;
|
|
25
15
|
export type ArrayOrNested<T> = T[] | T[][];
|
|
26
16
|
export type NestedItem<T> = T extends Array<infer I> ? NestedItem<I> : T;
|
|
@@ -45,4 +35,4 @@ export type StringOrVNode = string | VNode | (() => VNode);
|
|
|
45
35
|
export type EmitsToProps<T> = {
|
|
46
36
|
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
47
37
|
};
|
|
48
|
-
export
|
|
38
|
+
export * from './tv';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tv.js";
|
package/dist/runtime/utils/tv.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
export interface IconProps {
|
|
3
|
-
name: string
|
|
4
|
-
}
|
|
5
|
-
</script>
|
|
1
|
+
<script>
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
import { Icon as IconifyIcon } from '@iconify/vue'
|
|
3
|
+
</script>
|
|
9
4
|
|
|
10
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Icon as IconifyIcon } from "@iconify/vue";
|
|
7
|
+
defineProps({
|
|
8
|
+
name: { type: String, required: true }
|
|
9
|
+
});
|
|
11
10
|
</script>
|
|
12
11
|
|
|
13
12
|
<template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface IconProps {
|
|
2
|
+
name: string;
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -1,200 +1,116 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import { tv } from 'tailwind-variants'
|
|
4
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import _appConfig from '#build/app.config'
|
|
6
|
-
import type { RouterLinkProps, RouteLocationRaw } from 'vue-router'
|
|
7
|
-
import theme from '#build/ui/link'
|
|
8
|
-
|
|
9
|
-
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
10
|
-
/**
|
|
11
|
-
* Route Location the link should navigate to when clicked on.
|
|
12
|
-
*/
|
|
13
|
-
to?: RouteLocationRaw // need to manually type to avoid breaking typedPages
|
|
14
|
-
/**
|
|
15
|
-
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
16
|
-
*/
|
|
17
|
-
href?: NuxtLinkProps['to']
|
|
18
|
-
/**
|
|
19
|
-
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
20
|
-
*/
|
|
21
|
-
external?: boolean
|
|
22
|
-
/**
|
|
23
|
-
* Where to display the linked URL, as the name for a browsing context.
|
|
24
|
-
*/
|
|
25
|
-
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null
|
|
26
|
-
/**
|
|
27
|
-
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
28
|
-
*/
|
|
29
|
-
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null
|
|
30
|
-
/**
|
|
31
|
-
* If set to true, no rel attribute will be added to the link
|
|
32
|
-
*/
|
|
33
|
-
noRel?: boolean
|
|
34
|
-
/**
|
|
35
|
-
* A class to apply to links that have been prefetched.
|
|
36
|
-
*/
|
|
37
|
-
prefetchedClass?: string
|
|
38
|
-
/**
|
|
39
|
-
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
40
|
-
*/
|
|
41
|
-
prefetch?: boolean
|
|
42
|
-
/**
|
|
43
|
-
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
44
|
-
*/
|
|
45
|
-
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
46
|
-
visibility: boolean
|
|
47
|
-
interaction: boolean
|
|
48
|
-
}>
|
|
49
|
-
/**
|
|
50
|
-
* Escape hatch to disable `prefetch` attribute.
|
|
51
|
-
*/
|
|
52
|
-
noPrefetch?: boolean
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const appConfigLink = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
56
|
-
|
|
57
|
-
const link = tv({ extend: tv(theme), ...(appConfigLink.ui?.link || {}) })
|
|
58
|
-
|
|
59
|
-
export interface LinkProps extends NuxtLinkProps {
|
|
60
|
-
/**
|
|
61
|
-
* The element or component this component should render as when not a link.
|
|
62
|
-
* @defaultValue 'button'
|
|
63
|
-
*/
|
|
64
|
-
as?: any
|
|
65
|
-
/**
|
|
66
|
-
* The type of the button when not a link.
|
|
67
|
-
* @defaultValue 'button'
|
|
68
|
-
*/
|
|
69
|
-
type?: ButtonHTMLAttributes['type']
|
|
70
|
-
disabled?: boolean
|
|
71
|
-
/** Force the link to be active independent of the current route. */
|
|
72
|
-
active?: boolean
|
|
73
|
-
/** Will only be active if the current route is an exact match. */
|
|
74
|
-
exact?: boolean
|
|
75
|
-
/** Will only be active if the current route query is an exact match. */
|
|
76
|
-
exactQuery?: boolean | 'partial'
|
|
77
|
-
/** Will only be active if the current route hash is an exact match. */
|
|
78
|
-
exactHash?: boolean
|
|
79
|
-
/** The class to apply when the link is inactive. */
|
|
80
|
-
inactiveClass?: string
|
|
81
|
-
custom?: boolean
|
|
82
|
-
/** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
|
|
83
|
-
raw?: boolean
|
|
84
|
-
class?: any
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface LinkSlots {
|
|
88
|
-
default(props: { active: boolean }): any
|
|
89
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/link";
|
|
90
3
|
</script>
|
|
91
4
|
|
|
92
|
-
<script setup
|
|
93
|
-
import { computed, getCurrentInstance } from
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import { RouterLink } from
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const props =
|
|
104
|
-
as:
|
|
105
|
-
type:
|
|
106
|
-
|
|
107
|
-
active:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, getCurrentInstance } from "vue";
|
|
7
|
+
import { defu } from "defu";
|
|
8
|
+
import { isEqual, diff } from "ohash/utils";
|
|
9
|
+
import { useForwardProps } from "reka-ui";
|
|
10
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
11
|
+
import { hasProtocol } from "ufo";
|
|
12
|
+
import { useRoute, RouterLink } from "vue-router";
|
|
13
|
+
import { useAppConfig } from "#imports";
|
|
14
|
+
import { tv } from "../../utils/tv";
|
|
15
|
+
defineOptions({ inheritAttrs: false });
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
as: { type: null, required: false, default: "button" },
|
|
18
|
+
type: { type: null, required: false, default: "button" },
|
|
19
|
+
disabled: { type: Boolean, required: false },
|
|
20
|
+
active: { type: Boolean, required: false, default: void 0 },
|
|
21
|
+
exact: { type: Boolean, required: false },
|
|
22
|
+
exactQuery: { type: [Boolean, String], required: false },
|
|
23
|
+
exactHash: { type: Boolean, required: false },
|
|
24
|
+
inactiveClass: { type: String, required: false, default: "" },
|
|
25
|
+
custom: { type: Boolean, required: false },
|
|
26
|
+
raw: { type: Boolean, required: false },
|
|
27
|
+
class: { type: null, required: false },
|
|
28
|
+
to: { type: null, required: false },
|
|
29
|
+
href: { type: null, required: false },
|
|
30
|
+
external: { type: Boolean, required: false },
|
|
31
|
+
target: { type: [String, Object, null], required: false },
|
|
32
|
+
rel: { type: [String, Object, null], required: false },
|
|
33
|
+
noRel: { type: Boolean, required: false },
|
|
34
|
+
prefetchedClass: { type: String, required: false },
|
|
35
|
+
prefetch: { type: Boolean, required: false },
|
|
36
|
+
prefetchOn: { type: [String, Object], required: false },
|
|
37
|
+
noPrefetch: { type: Boolean, required: false },
|
|
38
|
+
activeClass: { type: String, required: false, default: "" },
|
|
39
|
+
exactActiveClass: { type: String, required: false },
|
|
40
|
+
ariaCurrentValue: { type: String, required: false, default: "page" },
|
|
41
|
+
viewTransition: { type: Boolean, required: false },
|
|
42
|
+
replace: { type: Boolean, required: false }
|
|
43
|
+
});
|
|
44
|
+
defineSlots();
|
|
114
45
|
const hasRouter = computed(() => {
|
|
115
|
-
const app = getCurrentInstance()?.appContext.app
|
|
116
|
-
return !!
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
// Only try to get route if router exists
|
|
46
|
+
const app = getCurrentInstance()?.appContext.app;
|
|
47
|
+
return !!app?.config?.globalProperties?.$router;
|
|
48
|
+
});
|
|
120
49
|
const route = computed(() => {
|
|
121
|
-
if (!hasRouter.value) return null
|
|
50
|
+
if (!hasRouter.value) return null;
|
|
122
51
|
try {
|
|
123
|
-
return useRoute()
|
|
52
|
+
return useRoute();
|
|
124
53
|
} catch {
|
|
125
|
-
return null
|
|
54
|
+
return null;
|
|
126
55
|
}
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props,
|
|
130
|
-
|
|
56
|
+
});
|
|
57
|
+
const appConfig = useAppConfig();
|
|
58
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "raw", "class"));
|
|
131
59
|
const ui = computed(() => tv({
|
|
132
|
-
extend:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
60
|
+
extend: tv(theme),
|
|
61
|
+
...defu({
|
|
62
|
+
variants: {
|
|
63
|
+
active: {
|
|
64
|
+
true: props.activeClass,
|
|
65
|
+
false: props.inactiveClass
|
|
66
|
+
}
|
|
137
67
|
}
|
|
138
|
-
}
|
|
139
|
-
}))
|
|
140
|
-
|
|
141
|
-
function isPartiallyEqual(item1: any, item2: any) {
|
|
68
|
+
}, appConfig.ui?.link || {})
|
|
69
|
+
}));
|
|
70
|
+
function isPartiallyEqual(item1, item2) {
|
|
142
71
|
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
143
|
-
if (q.type ===
|
|
144
|
-
filtered.add(q.key)
|
|
72
|
+
if (q.type === "added") {
|
|
73
|
+
filtered.add(q.key);
|
|
145
74
|
}
|
|
146
|
-
return filtered
|
|
147
|
-
}, new Set
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return isEqual(item1Filtered, item2Filtered)
|
|
75
|
+
return filtered;
|
|
76
|
+
}, /* @__PURE__ */ new Set());
|
|
77
|
+
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
78
|
+
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
79
|
+
return isEqual(item1Filtered, item2Filtered);
|
|
153
80
|
}
|
|
154
|
-
|
|
155
81
|
const isExternal = computed(() => {
|
|
156
|
-
if (!props.to) return false
|
|
157
|
-
return typeof props.to ===
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return props.active
|
|
82
|
+
if (!props.to) return false;
|
|
83
|
+
return typeof props.to === "string" && hasProtocol(props.to, { acceptRelative: true });
|
|
84
|
+
});
|
|
85
|
+
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
86
|
+
if (props.active !== void 0) {
|
|
87
|
+
return props.active;
|
|
163
88
|
}
|
|
164
|
-
|
|
165
89
|
if (!props.to || !route.value) {
|
|
166
|
-
return false
|
|
90
|
+
return false;
|
|
167
91
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (!isPartiallyEqual(linkRoute.query, route.value.query)) return false
|
|
92
|
+
if (props.exactQuery === "partial") {
|
|
93
|
+
if (!isPartiallyEqual(linkRoute.query, route.value.query)) return false;
|
|
171
94
|
} else if (props.exactQuery === true) {
|
|
172
|
-
if (!isEqual(linkRoute.query, route.value.query)) return false
|
|
95
|
+
if (!isEqual(linkRoute.query, route.value.query)) return false;
|
|
173
96
|
}
|
|
174
|
-
|
|
175
97
|
if (props.exactHash && linkRoute.hash !== route.value.hash) {
|
|
176
|
-
return false
|
|
98
|
+
return false;
|
|
177
99
|
}
|
|
178
|
-
|
|
179
100
|
if (props.exact && isExactActive) {
|
|
180
|
-
return true
|
|
101
|
+
return true;
|
|
181
102
|
}
|
|
182
|
-
|
|
183
103
|
if (!props.exact && isActive) {
|
|
184
|
-
return true
|
|
104
|
+
return true;
|
|
185
105
|
}
|
|
186
|
-
|
|
187
|
-
return false
|
|
106
|
+
return false;
|
|
188
107
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const active = isLinkActive({ route, isActive, isExactActive })
|
|
192
|
-
|
|
108
|
+
function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
109
|
+
const active = isLinkActive({ route: route2, isActive, isExactActive });
|
|
193
110
|
if (props.raw) {
|
|
194
|
-
return [props.class, active ? props.activeClass : props.inactiveClass]
|
|
111
|
+
return [props.class, active ? props.activeClass : props.inactiveClass];
|
|
195
112
|
}
|
|
196
|
-
|
|
197
|
-
return ui.value({ class: props.class, active, disabled: props.disabled })
|
|
113
|
+
return ui.value({ class: props.class, active, disabled: props.disabled });
|
|
198
114
|
}
|
|
199
115
|
</script>
|
|
200
116
|
|
|
@@ -204,28 +120,28 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
|
|
|
204
120
|
<template v-if="custom">
|
|
205
121
|
<slot
|
|
206
122
|
v-bind="{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
123
|
+
...$attrs,
|
|
124
|
+
...exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {},
|
|
125
|
+
as,
|
|
126
|
+
type,
|
|
127
|
+
disabled,
|
|
128
|
+
href: to ? href : void 0,
|
|
129
|
+
navigate,
|
|
130
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
131
|
+
}"
|
|
216
132
|
/>
|
|
217
133
|
</template>
|
|
218
134
|
<ULinkBase
|
|
219
135
|
v-else
|
|
220
136
|
v-bind="{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
137
|
+
...$attrs,
|
|
138
|
+
...exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {},
|
|
139
|
+
as,
|
|
140
|
+
type,
|
|
141
|
+
disabled,
|
|
142
|
+
href: to ? href : void 0,
|
|
143
|
+
navigate
|
|
144
|
+
}"
|
|
229
145
|
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
230
146
|
>
|
|
231
147
|
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
@@ -237,26 +153,26 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
|
|
|
237
153
|
<template v-if="custom">
|
|
238
154
|
<slot
|
|
239
155
|
v-bind="{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
156
|
+
...$attrs,
|
|
157
|
+
as,
|
|
158
|
+
type,
|
|
159
|
+
disabled,
|
|
160
|
+
href: to,
|
|
161
|
+
target: isExternal ? '_blank' : void 0,
|
|
162
|
+
active: false
|
|
163
|
+
}"
|
|
248
164
|
/>
|
|
249
165
|
</template>
|
|
250
166
|
<ULinkBase
|
|
251
167
|
v-else
|
|
252
168
|
v-bind="{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
169
|
+
...$attrs,
|
|
170
|
+
as,
|
|
171
|
+
type,
|
|
172
|
+
disabled,
|
|
173
|
+
href: to,
|
|
174
|
+
target: isExternal ? '_blank' : void 0
|
|
175
|
+
}"
|
|
260
176
|
:is-external="isExternal"
|
|
261
177
|
:class="resolveLinkClass()"
|
|
262
178
|
>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'vue';
|
|
2
|
+
import type { RouterLinkProps, RouteLocationRaw } from 'vue-router';
|
|
3
|
+
interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
4
|
+
/**
|
|
5
|
+
* Route Location the link should navigate to when clicked on.
|
|
6
|
+
*/
|
|
7
|
+
to?: RouteLocationRaw;
|
|
8
|
+
/**
|
|
9
|
+
* An alias for `to`. If used with `to`, `href` will be ignored
|
|
10
|
+
*/
|
|
11
|
+
href?: NuxtLinkProps['to'];
|
|
12
|
+
/**
|
|
13
|
+
* Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
|
|
14
|
+
*/
|
|
15
|
+
external?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Where to display the linked URL, as the name for a browsing context.
|
|
18
|
+
*/
|
|
19
|
+
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null;
|
|
20
|
+
/**
|
|
21
|
+
* A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
|
|
22
|
+
*/
|
|
23
|
+
rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null;
|
|
24
|
+
/**
|
|
25
|
+
* If set to true, no rel attribute will be added to the link
|
|
26
|
+
*/
|
|
27
|
+
noRel?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* A class to apply to links that have been prefetched.
|
|
30
|
+
*/
|
|
31
|
+
prefetchedClass?: string;
|
|
32
|
+
/**
|
|
33
|
+
* When enabled will prefetch middleware, layouts and payloads of links in the viewport.
|
|
34
|
+
*/
|
|
35
|
+
prefetch?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
|
|
38
|
+
*/
|
|
39
|
+
prefetchOn?: 'visibility' | 'interaction' | Partial<{
|
|
40
|
+
visibility: boolean;
|
|
41
|
+
interaction: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Escape hatch to disable `prefetch` attribute.
|
|
45
|
+
*/
|
|
46
|
+
noPrefetch?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface LinkProps extends NuxtLinkProps {
|
|
49
|
+
/**
|
|
50
|
+
* The element or component this component should render as when not a link.
|
|
51
|
+
* @defaultValue 'button'
|
|
52
|
+
*/
|
|
53
|
+
as?: any;
|
|
54
|
+
/**
|
|
55
|
+
* The type of the button when not a link.
|
|
56
|
+
* @defaultValue 'button'
|
|
57
|
+
*/
|
|
58
|
+
type?: ButtonHTMLAttributes['type'];
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/** Force the link to be active independent of the current route. */
|
|
61
|
+
active?: boolean;
|
|
62
|
+
/** Will only be active if the current route is an exact match. */
|
|
63
|
+
exact?: boolean;
|
|
64
|
+
/** Will only be active if the current route query is an exact match. */
|
|
65
|
+
exactQuery?: boolean | 'partial';
|
|
66
|
+
/** Will only be active if the current route hash is an exact match. */
|
|
67
|
+
exactHash?: boolean;
|
|
68
|
+
/** The class to apply when the link is inactive. */
|
|
69
|
+
inactiveClass?: string;
|
|
70
|
+
custom?: boolean;
|
|
71
|
+
/** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
|
|
72
|
+
raw?: boolean;
|
|
73
|
+
class?: any;
|
|
74
|
+
}
|
|
75
|
+
export interface LinkSlots {
|
|
76
|
+
default(props: {
|
|
77
|
+
active: boolean;
|
|
78
|
+
}): any;
|
|
79
|
+
}
|
|
80
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkProps> & Readonly<{}>, {
|
|
81
|
+
type: "reset" | "submit" | "button";
|
|
82
|
+
as: any;
|
|
83
|
+
activeClass: string;
|
|
84
|
+
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
85
|
+
active: boolean;
|
|
86
|
+
inactiveClass: string;
|
|
87
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
88
|
+
export default _default;
|
|
89
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
90
|
+
new (): {
|
|
91
|
+
$slots: S;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -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?: undefined;
|
|
11
|
+
readonly value?: undefined;
|
|
12
12
|
} | {
|
|
13
13
|
preference: "system" | "light" | "dark";
|
|
14
14
|
readonly value: import("@vueuse/core").BasicColorMode;
|