@nuxt/ui 3.0.0-alpha.8 → 3.0.0-beta.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 +122 -95
- package/.nuxt/ui/avatar-group.ts +14 -2
- package/.nuxt/ui/avatar.ts +16 -4
- package/.nuxt/ui/badge.ts +139 -93
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button-group.ts +13 -0
- package/.nuxt/ui/button.ts +167 -136
- package/.nuxt/ui/calendar.ts +103 -0
- package/.nuxt/ui/card.ts +27 -1
- package/.nuxt/ui/carousel.ts +9 -7
- package/.nuxt/ui/checkbox.ts +45 -27
- package/.nuxt/ui/chip.ts +44 -15
- package/.nuxt/ui/color-picker.ts +47 -0
- package/.nuxt/ui/command-palette.ts +28 -18
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/context-menu.ts +64 -46
- package/.nuxt/ui/drawer.ts +83 -15
- package/.nuxt/ui/dropdown-menu.ts +65 -47
- package/.nuxt/ui/form-field.ts +15 -7
- package/.nuxt/ui/index.ts +7 -1
- package/.nuxt/ui/input-menu.ts +150 -116
- package/.nuxt/ui/input-number.ts +235 -0
- package/.nuxt/ui/input.ts +111 -76
- package/.nuxt/ui/kbd.ts +18 -6
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +8 -7
- package/.nuxt/ui/navigation-menu.ts +244 -131
- package/.nuxt/ui/pin-input.ts +171 -0
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +111 -72
- package/.nuxt/ui/radio-group.ts +45 -22
- package/.nuxt/ui/select-menu.ts +127 -96
- package/.nuxt/ui/select.ts +120 -84
- package/.nuxt/ui/separator.ts +60 -31
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +17 -9
- package/.nuxt/ui/slider.ts +61 -38
- package/.nuxt/ui/stepper.ts +202 -0
- package/.nuxt/ui/switch.ts +40 -22
- package/.nuxt/ui/table.ts +49 -31
- package/.nuxt/ui/tabs.ts +101 -73
- package/.nuxt/ui/textarea.ts +111 -76
- package/.nuxt/ui/toast.ts +53 -33
- package/.nuxt/ui/toaster.ts +31 -15
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui/tree.ts +154 -0
- package/.nuxt/ui.css +92 -0
- package/README.md +69 -18
- package/cli/commands/{init.mjs → make/component.mjs} +16 -4
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/package.json +2 -2
- package/cli/templates.mjs +62 -12
- package/cli/utils.mjs +14 -0
- package/dist/module.cjs +9 -170
- package/dist/module.d.cts +5 -15
- package/dist/module.d.mts +5 -15
- package/dist/module.d.ts +5 -15
- package/dist/module.json +2 -2
- package/dist/module.mjs +12 -167
- package/dist/runtime/components/Accordion.vue +8 -39
- package/dist/runtime/components/Alert.vue +25 -21
- package/dist/runtime/components/App.vue +15 -15
- package/dist/runtime/components/Avatar.vue +33 -21
- package/dist/runtime/components/AvatarGroup.vue +5 -7
- package/dist/runtime/components/Badge.vue +10 -8
- package/dist/runtime/components/Breadcrumb.vue +13 -34
- package/dist/runtime/components/Button.vue +5 -8
- package/dist/runtime/components/ButtonGroup.vue +5 -7
- package/dist/runtime/components/Calendar.vue +194 -0
- package/dist/runtime/components/Card.vue +10 -9
- package/dist/runtime/components/Carousel.vue +26 -17
- package/dist/runtime/components/Checkbox.vue +32 -38
- package/dist/runtime/components/Chip.vue +6 -8
- package/dist/runtime/components/Collapsible.vue +10 -11
- package/dist/runtime/components/ColorPicker.vue +297 -0
- package/dist/runtime/components/CommandPalette.vue +114 -98
- package/dist/runtime/components/Container.vue +4 -7
- package/dist/runtime/components/ContextMenu.vue +16 -69
- package/dist/runtime/components/ContextMenuContent.vue +14 -10
- package/dist/runtime/components/Drawer.vue +23 -12
- package/dist/runtime/components/DropdownMenu.vue +18 -59
- package/dist/runtime/components/DropdownMenuContent.vue +14 -10
- package/dist/runtime/components/Form.vue +78 -49
- package/dist/runtime/components/FormField.vue +28 -15
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -7
- package/dist/runtime/components/InputMenu.vue +133 -66
- package/dist/runtime/components/InputNumber.vue +197 -0
- package/dist/runtime/components/Kbd.vue +5 -6
- package/dist/runtime/components/Link.vue +24 -13
- package/dist/runtime/components/LinkBase.vue +1 -1
- package/dist/runtime/components/Modal.vue +56 -34
- package/dist/runtime/components/NavigationMenu.vue +129 -112
- package/dist/runtime/components/OverlayProvider.vue +28 -0
- package/dist/runtime/components/Pagination.vue +18 -14
- package/dist/runtime/components/PinInput.vue +95 -0
- package/dist/runtime/components/Popover.vue +28 -14
- package/dist/runtime/components/Progress.vue +28 -12
- package/dist/runtime/components/RadioGroup.vue +9 -12
- package/dist/runtime/components/Select.vue +61 -35
- package/dist/runtime/components/SelectMenu.vue +201 -130
- package/dist/runtime/components/Separator.vue +6 -5
- package/dist/runtime/components/Skeleton.vue +4 -7
- package/dist/runtime/components/Slideover.vue +56 -33
- package/dist/runtime/components/Slider.vue +8 -7
- package/dist/runtime/components/Stepper.vue +170 -0
- package/dist/runtime/components/Switch.vue +19 -23
- package/dist/runtime/components/Table.vue +157 -32
- package/dist/runtime/components/Tabs.vue +12 -31
- package/dist/runtime/components/Textarea.vue +18 -9
- package/dist/runtime/components/Toast.vue +39 -25
- package/dist/runtime/components/Toaster.vue +31 -24
- package/dist/runtime/components/Tooltip.vue +9 -12
- package/dist/runtime/components/Tree.vue +196 -0
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +2 -2
- package/dist/runtime/composables/useFormField.d.ts +11 -4
- package/dist/runtime/composables/useFormField.js +19 -9
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useOverlay.d.ts +30 -0
- package/dist/runtime/composables/useOverlay.js +70 -0
- package/dist/runtime/composables/useToast.d.ts +4 -3
- package/dist/runtime/composables/useToast.js +20 -6
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -1
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +55 -0
- package/dist/runtime/locale/az.d.ts +2 -0
- package/dist/runtime/locale/az.js +54 -0
- package/dist/runtime/locale/bn.d.ts +2 -0
- package/dist/runtime/locale/bn.js +54 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +54 -0
- package/dist/runtime/locale/da.d.ts +2 -0
- package/dist/runtime/locale/da.js +54 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +54 -0
- package/dist/runtime/locale/el.d.ts +2 -0
- package/dist/runtime/locale/el.js +54 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +54 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +54 -0
- package/dist/runtime/locale/et.d.ts +2 -0
- package/dist/runtime/locale/et.js +54 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +55 -0
- package/dist/runtime/locale/fi.d.ts +2 -0
- package/dist/runtime/locale/fi.js +54 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +54 -0
- package/dist/runtime/locale/he.d.ts +2 -0
- package/dist/runtime/locale/he.js +53 -0
- package/dist/runtime/locale/hi.d.ts +2 -0
- package/dist/runtime/locale/hi.js +54 -0
- package/dist/runtime/locale/hu.d.ts +2 -0
- package/dist/runtime/locale/hu.js +54 -0
- package/dist/runtime/locale/id.d.ts +2 -0
- package/dist/runtime/locale/id.js +54 -0
- package/dist/runtime/locale/index.d.ts +34 -0
- package/dist/runtime/locale/index.js +34 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +54 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +54 -0
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.js +54 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +54 -0
- package/dist/runtime/locale/nb_no.d.ts +2 -0
- package/dist/runtime/locale/nb_no.js +54 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +54 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +54 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +54 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +54 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +54 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +54 -0
- package/dist/runtime/locale/sv.d.ts +2 -0
- package/dist/runtime/locale/sv.js +54 -0
- package/dist/runtime/locale/th.d.ts +2 -0
- package/dist/runtime/locale/th.js +54 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +54 -0
- package/dist/runtime/locale/uk.d.ts +2 -0
- package/dist/runtime/locale/uk.js +54 -0
- package/dist/runtime/locale/vi.d.ts +2 -0
- package/dist/runtime/locale/vi.js +54 -0
- package/dist/runtime/locale/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/zh_cn.js +54 -0
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/zh_tw.js +54 -0
- package/dist/runtime/plugins/colors.js +8 -5
- package/dist/runtime/types/form.d.ts +29 -15
- package/dist/runtime/types/form.js +2 -2
- package/dist/runtime/types/index.d.ts +8 -0
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +56 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +7 -3
- package/dist/runtime/utils/form.d.ts +5 -9
- package/dist/runtime/utils/form.js +113 -50
- package/dist/runtime/utils/index.d.ts +1 -1
- package/dist/runtime/utils/index.js +15 -2
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Link.vue +87 -23
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +2 -0
- package/dist/runtime/vue/plugins/head.d.ts +1 -1
- package/dist/runtime/vue/plugins/head.js +3 -3
- package/dist/runtime/vue/stubs.d.ts +19 -0
- package/dist/runtime/vue/stubs.js +37 -0
- package/dist/shared/{ui.BufKhDiD.mjs → ui.DSPu6Y8j.mjs} +1071 -409
- package/dist/shared/{ui.BU7wzH0D.cjs → ui.DfK2RX6G.cjs} +1074 -409
- package/dist/unplugin.cjs +62 -26
- package/dist/unplugin.d.cts +17 -3
- package/dist/unplugin.d.mts +17 -3
- package/dist/unplugin.d.ts +17 -3
- package/dist/unplugin.mjs +61 -25
- package/dist/vite.cjs +3 -2
- package/dist/vite.d.cts +2 -0
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.mjs +3 -2
- package/package.json +110 -67
- package/dist/chunks/component-meta.cjs +0 -73264
- package/dist/chunks/component-meta.mjs +0 -73262
- package/dist/client/devtools/200.html +0 -1
- package/dist/client/devtools/404.html +0 -1
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/Bj9hdafK.js +0 -1
- package/dist/client/devtools/_nuxt/DM3_wAgz.js +0 -62
- package/dist/client/devtools/_nuxt/builds/latest.json +0 -1
- package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +0 -1
- package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +0 -24
- package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +0 -1
- package/dist/client/devtools/_nuxt/hKiujHsR.js +0 -1
- package/dist/client/devtools/favicon.svg +0 -1
- package/dist/client/devtools/index.html +0 -1
- package/dist/devtools/runtime/DevtoolsRenderer.vue +0 -53
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +0 -7
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +0 -8
- package/dist/devtools/runtime/examples/CardExample.vue +0 -13
- package/dist/devtools/runtime/examples/CarouselExample.vue +0 -13
- package/dist/devtools/runtime/examples/ChipExample.vue +0 -5
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +0 -8
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +0 -29
- package/dist/devtools/runtime/examples/ContainerExample.vue +0 -5
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/DrawerExample.vue +0 -8
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/FormExample.vue +0 -30
- package/dist/devtools/runtime/examples/FormFieldExample.vue +0 -5
- package/dist/devtools/runtime/examples/LinkExample.vue +0 -5
- package/dist/devtools/runtime/examples/ModalExample.vue +0 -8
- package/dist/devtools/runtime/examples/PopoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/SkeletonExample.vue +0 -3
- package/dist/devtools/runtime/examples/SlideoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/ToasterExample.vue +0 -11
- package/dist/devtools/runtime/examples/TooltipExample.vue +0 -5
- package/dist/runtime/components/ModalProvider.vue +0 -12
- package/dist/runtime/components/SlideoverProvider.vue +0 -12
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +0 -7
- package/dist/runtime/composables/extendDevtoolsMeta.js +0 -2
- package/dist/runtime/composables/useModal.d.ts +0 -17
- package/dist/runtime/composables/useModal.js +0 -46
- package/dist/runtime/composables/useSlideover.d.ts +0 -17
- package/dist/runtime/composables/useSlideover.js +0 -46
- package/dist/runtime/plugins/modal.d.ts +0 -2
- package/dist/runtime/plugins/modal.js +0 -10
- package/dist/runtime/plugins/slideover.d.ts +0 -2
- package/dist/runtime/plugins/slideover.js +0 -10
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type Messages = {
|
|
2
|
+
inputMenu: {
|
|
3
|
+
noMatch: string;
|
|
4
|
+
noData: string;
|
|
5
|
+
create: string;
|
|
6
|
+
};
|
|
7
|
+
calendar: {
|
|
8
|
+
prevYear: string;
|
|
9
|
+
nextYear: string;
|
|
10
|
+
prevMonth: string;
|
|
11
|
+
nextMonth: string;
|
|
12
|
+
};
|
|
13
|
+
inputNumber: {
|
|
14
|
+
increment: string;
|
|
15
|
+
decrement: string;
|
|
16
|
+
};
|
|
17
|
+
commandPalette: {
|
|
18
|
+
placeholder: string;
|
|
19
|
+
noMatch: string;
|
|
20
|
+
noData: string;
|
|
21
|
+
close: string;
|
|
22
|
+
};
|
|
23
|
+
selectMenu: {
|
|
24
|
+
noMatch: string;
|
|
25
|
+
noData: string;
|
|
26
|
+
create: string;
|
|
27
|
+
search: string;
|
|
28
|
+
};
|
|
29
|
+
toast: {
|
|
30
|
+
close: string;
|
|
31
|
+
};
|
|
32
|
+
carousel: {
|
|
33
|
+
prev: string;
|
|
34
|
+
next: string;
|
|
35
|
+
goto: string;
|
|
36
|
+
};
|
|
37
|
+
modal: {
|
|
38
|
+
close: string;
|
|
39
|
+
};
|
|
40
|
+
slideover: {
|
|
41
|
+
close: string;
|
|
42
|
+
};
|
|
43
|
+
alert: {
|
|
44
|
+
close: string;
|
|
45
|
+
};
|
|
46
|
+
table: {
|
|
47
|
+
noData: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type Direction = 'ltr' | 'rtl';
|
|
51
|
+
export type Locale = {
|
|
52
|
+
name: string;
|
|
53
|
+
code: string;
|
|
54
|
+
dir: Direction;
|
|
55
|
+
messages: Messages;
|
|
56
|
+
};
|
|
File without changes
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
1
2
|
export interface TightMap<O = any> {
|
|
2
3
|
[key: string]: TightMap | O;
|
|
3
4
|
}
|
|
4
5
|
export type DeepPartial<T, O = any> = {
|
|
5
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P], O> : T[P];
|
|
6
|
+
[P in keyof T]?: T[P] extends Array<string> ? string : T[P] extends object ? DeepPartial<T[P], O> : T[P];
|
|
6
7
|
} & {
|
|
7
8
|
[key: string]: O | TightMap<O>;
|
|
8
9
|
};
|
|
@@ -10,8 +11,6 @@ export type DynamicSlots<T extends {
|
|
|
10
11
|
slot?: string;
|
|
11
12
|
}, SlotProps, Slot = T['slot']> = Record<string, SlotProps> & (Slot extends string ? Record<Slot, SlotProps> : Record<string, never>);
|
|
12
13
|
export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extends Record<string, any> ? MaybeObject[Key] : never;
|
|
13
|
-
export type AcceptableValue = string | number | boolean | Record<string, any>;
|
|
14
|
-
export type ArrayOrWrapped<T> = T extends any[] ? T : Array<T>;
|
|
15
14
|
export type PartialString<T> = {
|
|
16
15
|
[K in keyof T]?: string;
|
|
17
16
|
};
|
|
@@ -22,3 +21,8 @@ export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
|
22
21
|
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
|
23
22
|
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>];
|
|
24
23
|
};
|
|
24
|
+
export type MaybeMultipleModelValue<T, M extends boolean = false> = (T extends infer U ? M extends true ? U[] : U : never);
|
|
25
|
+
export type StringOrVNode = string | VNode | (() => VNode);
|
|
26
|
+
export type EmitsToProps<T> = {
|
|
27
|
+
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
28
|
+
};
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import type { ZodSchema } from 'zod';
|
|
3
3
|
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi';
|
|
4
4
|
import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup';
|
|
5
5
|
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
6
6
|
import type { Struct } from 'superstruct';
|
|
7
|
-
import type {
|
|
7
|
+
import type { FormSchema, ValidateReturnSchema } from '../types/form';
|
|
8
8
|
export declare function isYupSchema(schema: any): schema is YupObjectSchema<any>;
|
|
9
9
|
export declare function isYupError(error: any): error is YupError;
|
|
10
|
-
export declare function getYupErrors(state: any, schema: YupObjectSchema<any>): Promise<FormError[]>;
|
|
11
10
|
export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
|
|
12
11
|
export declare function isZodSchema(schema: any): schema is ZodSchema;
|
|
13
|
-
export declare function getZodErrors(state: any, schema: ZodSchema): Promise<FormError[]>;
|
|
14
12
|
export declare function isJoiSchema(schema: any): schema is JoiSchema;
|
|
15
13
|
export declare function isJoiError(error: any): error is JoiError;
|
|
16
|
-
export declare function getJoiErrors(state: any, schema: JoiSchema): Promise<FormError[]>;
|
|
17
14
|
export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function getSuperStructErrors(state: any, schema: Struct<any, any>): Promise<FormError[]>;
|
|
15
|
+
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
16
|
+
export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
17
|
+
export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
@@ -4,87 +4,150 @@ export function isYupSchema(schema) {
|
|
|
4
4
|
export function isYupError(error) {
|
|
5
5
|
return error.inner !== void 0;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export function isSuperStructSchema(schema) {
|
|
8
|
+
return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
|
|
9
|
+
}
|
|
10
|
+
export function isZodSchema(schema) {
|
|
11
|
+
return schema.parse !== void 0;
|
|
12
|
+
}
|
|
13
|
+
export function isJoiSchema(schema) {
|
|
14
|
+
return schema.validateAsync !== void 0 && schema.id !== void 0;
|
|
15
|
+
}
|
|
16
|
+
export function isJoiError(error) {
|
|
17
|
+
return error.isJoi === true;
|
|
18
|
+
}
|
|
19
|
+
export function isValibotSchema(schema) {
|
|
20
|
+
return "_run" in schema || typeof schema === "function" && "schema" in schema;
|
|
21
|
+
}
|
|
22
|
+
export function isStandardSchema(schema) {
|
|
23
|
+
return "~standard" in schema;
|
|
24
|
+
}
|
|
25
|
+
export async function validateStandardSchema(state, schema) {
|
|
26
|
+
const result = await schema["~standard"].validate(state);
|
|
27
|
+
if (result.issues) {
|
|
28
|
+
return {
|
|
29
|
+
errors: result.issues?.map((issue) => ({
|
|
30
|
+
name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
|
|
31
|
+
message: issue.message
|
|
32
|
+
})) || [],
|
|
33
|
+
result: null
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
errors: null,
|
|
38
|
+
result: result.value
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async function validateYupSchema(state, schema) {
|
|
8
42
|
try {
|
|
9
|
-
await schema.validate(state, { abortEarly: false });
|
|
10
|
-
return
|
|
43
|
+
const result = await schema.validate(state, { abortEarly: false });
|
|
44
|
+
return {
|
|
45
|
+
errors: null,
|
|
46
|
+
result
|
|
47
|
+
};
|
|
11
48
|
} catch (error) {
|
|
12
49
|
if (isYupError(error)) {
|
|
13
|
-
|
|
50
|
+
const errors = error.inner.map((issue) => ({
|
|
14
51
|
name: issue.path ?? "",
|
|
15
52
|
message: issue.message
|
|
16
53
|
}));
|
|
54
|
+
return {
|
|
55
|
+
errors,
|
|
56
|
+
result: null
|
|
57
|
+
};
|
|
17
58
|
} else {
|
|
18
59
|
throw error;
|
|
19
60
|
}
|
|
20
61
|
}
|
|
21
62
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
63
|
+
async function validateSuperstructSchema(state, schema) {
|
|
64
|
+
const [err, result] = schema.validate(state);
|
|
65
|
+
if (err) {
|
|
66
|
+
const errors = err.failures().map((error) => ({
|
|
67
|
+
message: error.message,
|
|
68
|
+
name: error.path.join(".")
|
|
69
|
+
}));
|
|
70
|
+
return {
|
|
71
|
+
errors,
|
|
72
|
+
result: null
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
errors: null,
|
|
77
|
+
result
|
|
78
|
+
};
|
|
27
79
|
}
|
|
28
|
-
|
|
80
|
+
async function validateZodSchema(state, schema) {
|
|
29
81
|
const result = await schema.safeParseAsync(state);
|
|
30
82
|
if (result.success === false) {
|
|
31
|
-
|
|
83
|
+
const errors = result.error.issues.map((issue) => ({
|
|
32
84
|
name: issue.path.join("."),
|
|
33
85
|
message: issue.message
|
|
34
86
|
}));
|
|
87
|
+
return {
|
|
88
|
+
errors,
|
|
89
|
+
result: null
|
|
90
|
+
};
|
|
35
91
|
}
|
|
36
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
result: result.data,
|
|
94
|
+
errors: null
|
|
95
|
+
};
|
|
37
96
|
}
|
|
38
|
-
|
|
39
|
-
return schema.validateAsync !== void 0 && schema.id !== void 0;
|
|
40
|
-
}
|
|
41
|
-
export function isJoiError(error) {
|
|
42
|
-
return error.isJoi === true;
|
|
43
|
-
}
|
|
44
|
-
export async function getJoiErrors(state, schema) {
|
|
97
|
+
async function validateJoiSchema(state, schema) {
|
|
45
98
|
try {
|
|
46
|
-
await schema.validateAsync(state, { abortEarly: false });
|
|
47
|
-
return
|
|
99
|
+
const result = await schema.validateAsync(state, { abortEarly: false });
|
|
100
|
+
return {
|
|
101
|
+
errors: null,
|
|
102
|
+
result
|
|
103
|
+
};
|
|
48
104
|
} catch (error) {
|
|
49
105
|
if (isJoiError(error)) {
|
|
50
|
-
|
|
51
|
-
name:
|
|
52
|
-
message:
|
|
106
|
+
const errors = error.details.map((issue) => ({
|
|
107
|
+
name: issue.path.join("."),
|
|
108
|
+
message: issue.message
|
|
53
109
|
}));
|
|
110
|
+
return {
|
|
111
|
+
errors,
|
|
112
|
+
result: null
|
|
113
|
+
};
|
|
54
114
|
} else {
|
|
55
115
|
throw error;
|
|
56
116
|
}
|
|
57
117
|
}
|
|
58
118
|
}
|
|
59
|
-
|
|
60
|
-
return "_run" in schema || typeof schema === "function" && "schema" in schema;
|
|
61
|
-
}
|
|
62
|
-
export async function getValibotErrors(state, schema) {
|
|
119
|
+
async function validateValibotSchema(state, schema) {
|
|
63
120
|
const result = await ("_run" in schema ? schema._run({ typed: false, value: state }, {}) : schema(state));
|
|
64
|
-
|
|
65
|
-
|
|
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) => ({
|
|
66
129
|
name: issue.path?.map((item) => item.key).join(".") || "",
|
|
67
130
|
message: issue.message
|
|
68
|
-
}))
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
export async function getStandardErrors(state, schema) {
|
|
74
|
-
const result = await schema["~validate"]({ value: state });
|
|
75
|
-
return result.issues?.map((issue) => ({
|
|
76
|
-
name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
|
|
77
|
-
message: issue.message
|
|
78
|
-
})) || [];
|
|
131
|
+
}));
|
|
132
|
+
return {
|
|
133
|
+
errors,
|
|
134
|
+
result: null
|
|
135
|
+
};
|
|
79
136
|
}
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
137
|
+
export function validateSchema(state, schema) {
|
|
138
|
+
if (isZodSchema(schema)) {
|
|
139
|
+
return validateZodSchema(state, schema);
|
|
140
|
+
} else if (isJoiSchema(schema)) {
|
|
141
|
+
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
|
+
} else if (isYupSchema(schema)) {
|
|
147
|
+
return validateYupSchema(state, schema);
|
|
148
|
+
} else if (isSuperStructSchema(schema)) {
|
|
149
|
+
return validateSuperstructSchema(state, schema);
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error("Form validation failed: Unsupported form schema");
|
|
88
152
|
}
|
|
89
|
-
return [];
|
|
90
153
|
}
|
|
@@ -3,4 +3,4 @@ export declare function omit<Data extends object, Keys extends keyof Data>(data:
|
|
|
3
3
|
export declare function get(object: Record<string, any> | undefined, path: (string | number)[] | string, defaultValue?: any): any;
|
|
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
|
-
export declare function
|
|
6
|
+
export declare function compare<T>(value?: T, currentValue?: T, comparator?: string | ((a: T, b: T) => boolean)): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isEqual } from "ohash";
|
|
1
2
|
export function pick(data, keys) {
|
|
2
3
|
const result = {};
|
|
3
4
|
for (const key of keys) {
|
|
@@ -45,6 +46,18 @@ export function looseToNumber(val) {
|
|
|
45
46
|
const n = Number.parseFloat(val);
|
|
46
47
|
return Number.isNaN(n) ? val : n;
|
|
47
48
|
}
|
|
48
|
-
export function
|
|
49
|
-
|
|
49
|
+
export function compare(value, currentValue, comparator) {
|
|
50
|
+
if (value === void 0 || currentValue === void 0) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === "string") {
|
|
54
|
+
return value === currentValue;
|
|
55
|
+
}
|
|
56
|
+
if (typeof comparator === "function") {
|
|
57
|
+
return comparator(value, currentValue);
|
|
58
|
+
}
|
|
59
|
+
if (typeof comparator === "string") {
|
|
60
|
+
return get(value, comparator) === get(currentValue, comparator);
|
|
61
|
+
}
|
|
62
|
+
return isEqual(value, currentValue);
|
|
50
63
|
}
|
|
@@ -6,13 +6,13 @@ export declare function pickLinkProps(link: LinkProps & {
|
|
|
6
6
|
replace: any;
|
|
7
7
|
type: any;
|
|
8
8
|
title: any;
|
|
9
|
+
exact: any;
|
|
9
10
|
active: any;
|
|
10
11
|
activeClass: any;
|
|
11
12
|
ariaCurrentValue: any;
|
|
12
13
|
ariaLabel: any;
|
|
13
14
|
as: any;
|
|
14
15
|
disabled: any;
|
|
15
|
-
exact: any;
|
|
16
16
|
exactActiveClass: any;
|
|
17
17
|
exactHash: any;
|
|
18
18
|
exactQuery: any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { Locale, Direction } from '../types/locale';
|
|
3
|
+
import type { MaybeRef } from '@vueuse/core';
|
|
4
|
+
export type TranslatorOption = Record<string, string | number>;
|
|
5
|
+
export type Translator = (path: string, option?: TranslatorOption) => string;
|
|
6
|
+
export type LocaleContext = {
|
|
7
|
+
locale: Ref<Locale>;
|
|
8
|
+
lang: Ref<string>;
|
|
9
|
+
dir: Ref<Direction>;
|
|
10
|
+
code: Ref<string>;
|
|
11
|
+
t: Translator;
|
|
12
|
+
};
|
|
13
|
+
export declare function buildTranslator(locale: MaybeRef<Locale>): Translator;
|
|
14
|
+
export declare function translate(path: string, option: undefined | TranslatorOption, locale: Locale): string;
|
|
15
|
+
export declare function buildLocaleContext(locale: MaybeRef<Locale>): LocaleContext;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { computed, isRef, ref, unref } from "vue";
|
|
2
|
+
import { get } from "./index.js";
|
|
3
|
+
export function buildTranslator(locale) {
|
|
4
|
+
return (path, option) => translate(path, option, unref(locale));
|
|
5
|
+
}
|
|
6
|
+
export function translate(path, option, locale) {
|
|
7
|
+
const prop = get(locale, `messages.${path}`, path);
|
|
8
|
+
return prop.replace(
|
|
9
|
+
/\{(\w+)\}/g,
|
|
10
|
+
(_, key) => `${option?.[key] ?? `{${key}}`}`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
export function buildLocaleContext(locale) {
|
|
14
|
+
const lang = computed(() => unref(locale).name);
|
|
15
|
+
const code = computed(() => unref(locale).code);
|
|
16
|
+
const dir = computed(() => unref(locale).dir);
|
|
17
|
+
const localeRef = isRef(locale) ? locale : ref(locale);
|
|
18
|
+
return {
|
|
19
|
+
lang,
|
|
20
|
+
code,
|
|
21
|
+
dir,
|
|
22
|
+
locale: localeRef,
|
|
23
|
+
t: buildTranslator(locale)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tv: import("tailwind-variants").CreateTV<boolean | (string | number | symbol)[] | {} | undefined>;
|
|
@@ -5,11 +5,11 @@ export interface IconProps {
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { Icon } from '@iconify/vue'
|
|
8
|
+
import { Icon as IconifyIcon } from '@iconify/vue'
|
|
9
9
|
|
|
10
10
|
defineProps<IconProps>()
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<
|
|
14
|
+
<IconifyIcon :icon="name.replace(/^i-/, '')" />
|
|
15
15
|
</template>
|
|
@@ -52,9 +52,9 @@ interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
|
|
|
52
52
|
noPrefetch?: boolean
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const appConfigLink = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
56
56
|
|
|
57
|
-
const link = tv({ extend: tv(theme), ...(
|
|
57
|
+
const link = tv({ extend: tv(theme), ...(appConfigLink.ui?.link || {}) })
|
|
58
58
|
|
|
59
59
|
export interface LinkProps extends NuxtLinkProps {
|
|
60
60
|
/**
|
|
@@ -73,7 +73,7 @@ export interface LinkProps extends NuxtLinkProps {
|
|
|
73
73
|
/** Will only be active if the current route is an exact match. */
|
|
74
74
|
exact?: boolean
|
|
75
75
|
/** Will only be active if the current route query is an exact match. */
|
|
76
|
-
exactQuery?: boolean
|
|
76
|
+
exactQuery?: boolean | 'partial'
|
|
77
77
|
/** Will only be active if the current route hash is an exact match. */
|
|
78
78
|
exactHash?: boolean
|
|
79
79
|
/** The class to apply when the link is inactive. */
|
|
@@ -90,9 +90,9 @@ export interface LinkSlots {
|
|
|
90
90
|
</script>
|
|
91
91
|
|
|
92
92
|
<script setup lang="ts">
|
|
93
|
-
import { computed } from 'vue'
|
|
94
|
-
import { isEqual } from 'ohash'
|
|
95
|
-
import { useForwardProps } from '
|
|
93
|
+
import { computed, getCurrentInstance } from 'vue'
|
|
94
|
+
import { isEqual, diff } from 'ohash'
|
|
95
|
+
import { useForwardProps } from 'reka-ui'
|
|
96
96
|
import { reactiveOmit } from '@vueuse/core'
|
|
97
97
|
import { hasProtocol } from 'ufo'
|
|
98
98
|
import { useRoute } from '#imports'
|
|
@@ -109,8 +109,23 @@ const props = withDefaults(defineProps<LinkProps>(), {
|
|
|
109
109
|
})
|
|
110
110
|
defineSlots<LinkSlots>()
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
const
|
|
112
|
+
// Check if vue-router is available by checking for the injection key
|
|
113
|
+
const hasRouter = computed(() => {
|
|
114
|
+
const app = getCurrentInstance()?.appContext.app
|
|
115
|
+
return !!(app?.config?.globalProperties?.$router)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// Only try to get route if router exists
|
|
119
|
+
const route = computed(() => {
|
|
120
|
+
if (!hasRouter.value) return null
|
|
121
|
+
try {
|
|
122
|
+
return useRoute()
|
|
123
|
+
} catch {
|
|
124
|
+
return null
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, 'as', 'type', 'disabled', 'active', 'exact', 'exactQuery', 'exactHash', 'activeClass', 'inactiveClass', 'to', 'raw', 'class'))
|
|
114
129
|
|
|
115
130
|
const ui = computed(() => tv({
|
|
116
131
|
extend: link,
|
|
@@ -122,21 +137,37 @@ const ui = computed(() => tv({
|
|
|
122
137
|
}
|
|
123
138
|
}))
|
|
124
139
|
|
|
125
|
-
|
|
140
|
+
function isPartiallyEqual(item1: any, item2: any) {
|
|
141
|
+
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
142
|
+
if (q.type === 'added') {
|
|
143
|
+
filtered.push(q.key)
|
|
144
|
+
}
|
|
145
|
+
return filtered
|
|
146
|
+
}, [] as string[])
|
|
147
|
+
return isEqual(item1, item2, { excludeKeys: key => diffedKeys.includes(key) })
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const isExternal = computed(() => {
|
|
151
|
+
if (!props.to) return false
|
|
152
|
+
return typeof props.to === 'string' && hasProtocol(props.to, { acceptRelative: true })
|
|
153
|
+
})
|
|
126
154
|
|
|
127
155
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
128
156
|
if (props.active !== undefined) {
|
|
129
157
|
return props.active
|
|
130
158
|
}
|
|
131
159
|
|
|
132
|
-
if (!props.to) {
|
|
160
|
+
if (!props.to || !route.value) {
|
|
133
161
|
return false
|
|
134
162
|
}
|
|
135
163
|
|
|
136
|
-
if (props.exactQuery
|
|
137
|
-
return false
|
|
164
|
+
if (props.exactQuery === 'partial') {
|
|
165
|
+
if (!isPartiallyEqual(linkRoute.query, route.value.query)) return false
|
|
166
|
+
} else if (props.exactQuery === true) {
|
|
167
|
+
if (!isEqual(linkRoute.query, route.value.query)) return false
|
|
138
168
|
}
|
|
139
|
-
|
|
169
|
+
|
|
170
|
+
if (props.exactHash && linkRoute.hash !== route.value.hash) {
|
|
140
171
|
return false
|
|
141
172
|
}
|
|
142
173
|
|
|
@@ -151,7 +182,7 @@ function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
|
151
182
|
return false
|
|
152
183
|
}
|
|
153
184
|
|
|
154
|
-
function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
185
|
+
function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
|
|
155
186
|
const active = isLinkActive({ route, isActive, isExactActive })
|
|
156
187
|
|
|
157
188
|
if (props.raw) {
|
|
@@ -163,7 +194,39 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
|
163
194
|
</script>
|
|
164
195
|
|
|
165
196
|
<template>
|
|
166
|
-
<
|
|
197
|
+
<template v-if="hasRouter && !isExternal">
|
|
198
|
+
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to || '#'" custom>
|
|
199
|
+
<template v-if="custom">
|
|
200
|
+
<slot
|
|
201
|
+
v-bind="{
|
|
202
|
+
...$attrs,
|
|
203
|
+
as,
|
|
204
|
+
type,
|
|
205
|
+
disabled,
|
|
206
|
+
href: to ? href : undefined,
|
|
207
|
+
navigate,
|
|
208
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
209
|
+
}"
|
|
210
|
+
/>
|
|
211
|
+
</template>
|
|
212
|
+
<ULinkBase
|
|
213
|
+
v-else
|
|
214
|
+
v-bind="{
|
|
215
|
+
...$attrs,
|
|
216
|
+
as,
|
|
217
|
+
type,
|
|
218
|
+
disabled,
|
|
219
|
+
href: to ? href : undefined,
|
|
220
|
+
navigate
|
|
221
|
+
}"
|
|
222
|
+
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
223
|
+
>
|
|
224
|
+
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
225
|
+
</ULinkBase>
|
|
226
|
+
</RouterLink>
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<template v-else>
|
|
167
230
|
<template v-if="custom">
|
|
168
231
|
<slot
|
|
169
232
|
v-bind="{
|
|
@@ -171,9 +234,9 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
|
171
234
|
as,
|
|
172
235
|
type,
|
|
173
236
|
disabled,
|
|
174
|
-
href: to
|
|
175
|
-
|
|
176
|
-
active:
|
|
237
|
+
href: to,
|
|
238
|
+
target: isExternal ? '_blank' : undefined,
|
|
239
|
+
active: false
|
|
177
240
|
}"
|
|
178
241
|
/>
|
|
179
242
|
</template>
|
|
@@ -184,12 +247,13 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
|
184
247
|
as,
|
|
185
248
|
type,
|
|
186
249
|
disabled,
|
|
187
|
-
href:
|
|
188
|
-
|
|
250
|
+
href: (to as string),
|
|
251
|
+
target: isExternal ? '_blank' : undefined
|
|
189
252
|
}"
|
|
190
|
-
:
|
|
253
|
+
:is-external="isExternal"
|
|
254
|
+
:class="resolveLinkClass()"
|
|
191
255
|
>
|
|
192
|
-
<slot :active="
|
|
256
|
+
<slot :active="false" />
|
|
193
257
|
</ULinkBase>
|
|
194
|
-
</
|
|
258
|
+
</template>
|
|
195
259
|
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAppConfig: () => any;
|
|
@@ -2,7 +2,26 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
3
|
export { useHead } from '@unhead/vue';
|
|
4
4
|
export { useRoute, useRouter } from 'vue-router';
|
|
5
|
+
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
6
|
+
export { useLocale } from '../composables/useLocale';
|
|
7
|
+
export declare const useColorMode: () => {
|
|
8
|
+
forced: boolean;
|
|
9
|
+
preference?: undefined;
|
|
10
|
+
readonly value?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
preference: "system" | "light" | "dark";
|
|
13
|
+
readonly value: import("@vueuse/core").BasicColorMode;
|
|
14
|
+
forced: boolean;
|
|
15
|
+
};
|
|
5
16
|
export declare const useAppConfig: () => any;
|
|
17
|
+
export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
|
|
18
|
+
value: Ref<T, T>;
|
|
19
|
+
get: () => T;
|
|
20
|
+
set: () => void;
|
|
21
|
+
update: () => void;
|
|
22
|
+
refresh: () => Promise<Awaited<T>>;
|
|
23
|
+
remove: () => void;
|
|
24
|
+
};
|
|
6
25
|
export declare const useState: <T>(key: string, init: () => T) => Ref<T>;
|
|
7
26
|
export declare function useNuxtApp(): {
|
|
8
27
|
isHydrating: boolean;
|