@nuxt/ui 3.0.0-alpha.1 → 3.0.0-alpha.10
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 +20 -0
- package/.nuxt/ui/alert.ts +242 -0
- package/.nuxt/ui/avatar-group.ts +40 -0
- package/.nuxt/ui/avatar.ts +42 -0
- package/.nuxt/ui/badge.ts +194 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +16 -0
- package/.nuxt/ui/button.ts +344 -0
- package/.nuxt/ui/calendar.ts +85 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +41 -0
- package/.nuxt/ui/checkbox.ts +105 -0
- package/.nuxt/ui/chip.ts +67 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/color-picker.ts +39 -0
- package/.nuxt/ui/command-palette.ts +50 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +198 -0
- package/.nuxt/ui/drawer.ts +55 -0
- package/.nuxt/ui/dropdown-menu.ts +199 -0
- package/.nuxt/ui/form-field.ts +40 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +48 -0
- package/.nuxt/ui/input-menu.ts +410 -0
- package/.nuxt/ui/input-number.ts +204 -0
- package/.nuxt/ui/input.ts +263 -0
- package/.nuxt/ui/kbd.ts +19 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +390 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/pin-input.ts +145 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +258 -0
- package/.nuxt/ui/radio-group.ts +112 -0
- package/.nuxt/ui/select-menu.ts +316 -0
- package/.nuxt/ui/select.ts +315 -0
- package/.nuxt/ui/separator.ts +143 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +63 -0
- package/.nuxt/ui/slider.ts +148 -0
- package/.nuxt/ui/stepper.ts +180 -0
- package/.nuxt/ui/switch.ts +113 -0
- package/.nuxt/ui/table.ts +129 -0
- package/.nuxt/ui/tabs.ts +227 -0
- package/.nuxt/ui/textarea.ts +263 -0
- package/.nuxt/ui/toast.ts +66 -0
- package/.nuxt/ui/toaster.ts +75 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/README.md +75 -54
- package/cli/commands/{init.mjs → make/component.mjs} +5 -5
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/templates.mjs +52 -7
- package/cli/utils.mjs +14 -0
- package/dist/chunks/component-meta.cjs +82802 -0
- package/dist/chunks/component-meta.mjs +82800 -0
- package/dist/client/devtools/200.html +1 -0
- package/dist/client/devtools/404.html +1 -0
- 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/B1fTd_Rf.js +1 -0
- package/dist/client/devtools/_nuxt/CSUxkedg.js +1 -0
- package/dist/client/devtools/_nuxt/CbRTGpb7.js +1 -0
- package/dist/client/devtools/_nuxt/YQTlxbcT.js +53 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/b3465abc-0a92-4ee7-ba6b-e5174891fcc0.json +1 -0
- package/dist/client/devtools/_nuxt/entry.DXXceQev.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.BJpkZFyY.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.D3i9VDlt.css +1 -0
- package/dist/client/devtools/favicon.svg +1 -0
- package/dist/client/devtools/index.html +1 -0
- package/dist/devtools/runtime/DevtoolsRenderer.vue +54 -0
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
- package/dist/devtools/runtime/examples/CardExample.vue +13 -0
- package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
- package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
- package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/FormExample.vue +30 -0
- package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
- package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
- package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
- package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
- package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/StepperExample.vue +44 -0
- package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
- package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
- package/dist/module.cjs +223 -4
- package/dist/module.d.cts +54 -0
- package/dist/module.d.mts +38 -7
- package/dist/module.d.ts +38 -7
- package/dist/module.json +2 -1
- package/dist/module.mjs +179 -2568
- package/dist/runtime/components/Accordion.vue +49 -8
- package/dist/runtime/components/Alert.vue +13 -6
- package/dist/runtime/components/App.vue +20 -7
- package/dist/runtime/components/Avatar.vue +33 -9
- package/dist/runtime/components/AvatarGroup.vue +4 -1
- package/dist/runtime/components/Badge.vue +34 -4
- package/dist/runtime/components/Breadcrumb.vue +52 -13
- package/dist/runtime/components/Button.vue +45 -6
- package/dist/runtime/components/ButtonGroup.vue +5 -2
- package/dist/runtime/components/Calendar.vue +190 -0
- package/dist/runtime/components/Card.vue +4 -1
- package/dist/runtime/components/Carousel.vue +322 -0
- package/dist/runtime/components/Checkbox.vue +28 -33
- package/dist/runtime/components/Chip.vue +9 -2
- package/dist/runtime/components/Collapsible.vue +7 -4
- package/dist/runtime/components/ColorPicker.vue +265 -0
- package/dist/runtime/components/CommandPalette.vue +122 -96
- package/dist/runtime/components/Container.vue +4 -1
- package/dist/runtime/components/ContextMenu.vue +101 -14
- package/dist/runtime/components/ContextMenuContent.vue +48 -18
- package/dist/runtime/components/Drawer.vue +22 -11
- package/dist/runtime/components/DropdownMenu.vue +91 -16
- package/dist/runtime/components/DropdownMenuContent.vue +50 -18
- package/dist/runtime/components/Form.vue +49 -32
- package/dist/runtime/components/FormField.vue +18 -6
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -6
- package/dist/runtime/components/InputMenu.vue +152 -65
- package/dist/runtime/components/InputNumber.vue +192 -0
- package/dist/runtime/components/Kbd.vue +3 -1
- package/dist/runtime/components/Link.vue +71 -8
- package/dist/runtime/components/LinkBase.vue +10 -7
- package/dist/runtime/components/Modal.vue +23 -11
- package/dist/runtime/components/NavigationMenu.vue +170 -75
- package/dist/runtime/components/Pagination.vue +31 -15
- package/dist/runtime/components/PinInput.vue +96 -0
- package/dist/runtime/components/Popover.vue +26 -7
- package/dist/runtime/components/Progress.vue +25 -8
- package/dist/runtime/components/RadioGroup.vue +28 -7
- package/dist/runtime/components/Select.vue +79 -32
- package/dist/runtime/components/SelectMenu.vue +164 -80
- package/dist/runtime/components/Separator.vue +3 -3
- package/dist/runtime/components/Skeleton.vue +4 -1
- package/dist/runtime/components/Slideover.vue +23 -11
- package/dist/runtime/components/Slider.vue +3 -3
- package/dist/runtime/components/Stepper.vue +171 -0
- package/dist/runtime/components/Switch.vue +16 -16
- package/dist/runtime/components/Table.vue +262 -0
- package/dist/runtime/components/Tabs.vue +42 -15
- package/dist/runtime/components/Textarea.vue +9 -3
- package/dist/runtime/components/Toast.vue +13 -5
- package/dist/runtime/components/Toaster.vue +31 -16
- package/dist/runtime/components/Tooltip.vue +9 -6
- 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 -8
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
- package/dist/runtime/composables/useFormField.d.ts +8 -4
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/composables/useKbd.d.ts +10 -3
- package/dist/runtime/composables/useKbd.js +14 -8
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useModal.d.ts +2 -2
- package/dist/runtime/composables/useSlideover.d.ts +2 -2
- package/dist/runtime/composables/useToast.d.ts +2 -2
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -0
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +53 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +52 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +52 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +52 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +52 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +53 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +52 -0
- package/dist/runtime/locale/index.d.ts +19 -0
- package/dist/runtime/locale/index.js +19 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +52 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +52 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +52 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +52 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +52 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +52 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +52 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +52 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +52 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +52 -0
- package/dist/runtime/locale/zh_hans.d.ts +2 -0
- package/dist/runtime/locale/zh_hans.js +52 -0
- package/dist/runtime/locale/zh_hant.d.ts +2 -0
- package/dist/runtime/locale/zh_hant.js +52 -0
- package/dist/runtime/plugins/colors.js +12 -8
- package/dist/runtime/types/form.d.ts +9 -2
- package/dist/runtime/types/index.d.ts +50 -42
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +54 -0
- package/dist/runtime/types/utils.d.ts +8 -3
- package/dist/runtime/utils/form.d.ts +7 -5
- package/dist/runtime/utils/form.js +117 -28
- package/dist/runtime/utils/index.d.ts +2 -1
- package/dist/runtime/utils/index.js +16 -0
- package/dist/runtime/utils/link.d.ts +5 -3
- package/dist/runtime/utils/link.js +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Link.vue +208 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/ui.CwmIkD_Y.cjs +3269 -0
- package/dist/shared/ui.D_93iuwH.mjs +3262 -0
- package/dist/unplugin.cjs +192 -0
- package/dist/unplugin.d.cts +49 -0
- package/dist/unplugin.d.mts +49 -0
- package/dist/unplugin.d.ts +49 -0
- package/dist/unplugin.mjs +181 -0
- package/dist/vite.cjs +22 -0
- package/dist/vite.d.cts +13 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.mjs +20 -0
- package/package.json +98 -31
- package/vue-plugin.d.ts +5 -0
- package/cli/node_modules/.ignored/citty/LICENSE +0 -36
- package/cli/node_modules/.ignored/citty/README.md +0 -134
- package/cli/node_modules/.ignored/citty/dist/index.cjs +0 -475
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.mjs +0 -463
- package/cli/node_modules/.ignored/citty/package.json +0 -49
- package/cli/node_modules/.ignored/consola/LICENSE +0 -47
- package/cli/node_modules/.ignored/consola/README.md +0 -318
- package/cli/node_modules/.ignored/consola/core.d.ts +0 -1
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +0 -32
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +0 -24
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +0 -80
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +0 -7
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +0 -72
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +0 -436
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +0 -429
- package/cli/node_modules/.ignored/consola/dist/core.cjs +0 -415
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +0 -124
- package/cli/node_modules/.ignored/consola/dist/core.mjs +0 -410
- package/cli/node_modules/.ignored/consola/dist/index.cjs +0 -21
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/index.mjs +0 -8
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +0 -62
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +0 -636
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +0 -645
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +0 -65
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +0 -308
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +0 -169
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +0 -284
- package/cli/node_modules/.ignored/consola/lib/index.cjs +0 -9
- package/cli/node_modules/.ignored/consola/package.json +0 -101
- package/cli/node_modules/.ignored/consola/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/pathe/LICENSE +0 -44
- package/cli/node_modules/.ignored/pathe/README.md +0 -69
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +0 -23
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +0 -1
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +0 -238
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +0 -221
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +0 -58
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +0 -54
- package/cli/node_modules/.ignored/pathe/package.json +0 -48
- package/cli/node_modules/.ignored/pathe/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/scule/LICENSE +0 -21
- package/cli/node_modules/.ignored/scule/README.md +0 -149
- package/cli/node_modules/.ignored/scule/dist/index.cjs +0 -92
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.mjs +0 -80
- package/cli/node_modules/.ignored/scule/package.json +0 -43
- package/cli/node_modules/.package-lock.json +0 -33
- package/dist/runtime/types/component.d.ts +0 -17
- /package/dist/runtime/types/{component.js → locale.js} +0 -0
|
@@ -2,7 +2,7 @@ export interface TightMap<O = any> {
|
|
|
2
2
|
[key: string]: TightMap | O;
|
|
3
3
|
}
|
|
4
4
|
export type DeepPartial<T, O = any> = {
|
|
5
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P], O> : T[P];
|
|
5
|
+
[P in keyof T]?: T[P] extends Array<string> ? string : T[P] extends object ? DeepPartial<T[P], O> : T[P];
|
|
6
6
|
} & {
|
|
7
7
|
[key: string]: O | TightMap<O>;
|
|
8
8
|
};
|
|
@@ -10,8 +10,13 @@ export type DynamicSlots<T extends {
|
|
|
10
10
|
slot?: string;
|
|
11
11
|
}, SlotProps, Slot = T['slot']> = Record<string, SlotProps> & (Slot extends string ? Record<Slot, SlotProps> : Record<string, never>);
|
|
12
12
|
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
13
|
export type PartialString<T> = {
|
|
16
14
|
[K in keyof T]?: string;
|
|
17
15
|
};
|
|
16
|
+
export type MaybeArrayOfArray<T> = T[] | T[][];
|
|
17
|
+
export type MaybeArrayOfArrayItem<I> = I extends Array<infer T> ? T extends Array<infer U> ? U : T : never;
|
|
18
|
+
export type SelectModelValue<T, V, M extends boolean = false, DV = T> = (T extends Record<string, any> ? V extends keyof T ? T[V] : DV : T) extends infer U ? M extends true ? U[] : U : never;
|
|
19
|
+
export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
20
|
+
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
|
21
|
+
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>];
|
|
22
|
+
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
1
2
|
import type { ZodSchema } from 'zod';
|
|
2
3
|
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi';
|
|
3
4
|
import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup';
|
|
4
5
|
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
5
|
-
import type {
|
|
6
|
+
import type { Struct } from 'superstruct';
|
|
7
|
+
import type { FormSchema, ValidateReturnSchema } from '../types/form';
|
|
6
8
|
export declare function isYupSchema(schema: any): schema is YupObjectSchema<any>;
|
|
7
9
|
export declare function isYupError(error: any): error is YupError;
|
|
8
|
-
export declare function
|
|
10
|
+
export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
|
|
9
11
|
export declare function isZodSchema(schema: any): schema is ZodSchema;
|
|
10
|
-
export declare function getZodErrors(state: any, schema: ZodSchema): Promise<FormError[]>;
|
|
11
12
|
export declare function isJoiSchema(schema: any): schema is JoiSchema;
|
|
12
13
|
export declare function isJoiError(error: any): error is JoiError;
|
|
13
|
-
export declare function getJoiErrors(state: any, schema: JoiSchema): Promise<FormError[]>;
|
|
14
14
|
export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
16
|
+
export declare function validateStandarSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
17
|
+
export declare function parseSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
@@ -4,63 +4,152 @@ 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 validateStandarSchema(state, schema) {
|
|
26
|
+
const result = await schema["~standard"].validate({
|
|
27
|
+
value: state
|
|
28
|
+
});
|
|
29
|
+
if (result.issues) {
|
|
30
|
+
return {
|
|
31
|
+
errors: result.issues?.map((issue) => ({
|
|
32
|
+
name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
|
|
33
|
+
message: issue.message
|
|
34
|
+
})) || [],
|
|
35
|
+
result: null
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
errors: null,
|
|
40
|
+
result: result.value
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async function validateYupSchema(state, schema) {
|
|
8
44
|
try {
|
|
9
|
-
await schema.validate(state, { abortEarly: false });
|
|
10
|
-
return
|
|
45
|
+
const result = await schema.validate(state, { abortEarly: false });
|
|
46
|
+
return {
|
|
47
|
+
errors: null,
|
|
48
|
+
result
|
|
49
|
+
};
|
|
11
50
|
} catch (error) {
|
|
12
51
|
if (isYupError(error)) {
|
|
13
|
-
|
|
52
|
+
const errors = error.inner.map((issue) => ({
|
|
14
53
|
name: issue.path ?? "",
|
|
15
54
|
message: issue.message
|
|
16
55
|
}));
|
|
56
|
+
return {
|
|
57
|
+
errors,
|
|
58
|
+
result: null
|
|
59
|
+
};
|
|
17
60
|
} else {
|
|
18
61
|
throw error;
|
|
19
62
|
}
|
|
20
63
|
}
|
|
21
64
|
}
|
|
22
|
-
|
|
23
|
-
|
|
65
|
+
async function validateSuperstructSchema(state, schema) {
|
|
66
|
+
const [err, result] = schema.validate(state);
|
|
67
|
+
if (err) {
|
|
68
|
+
const errors = err.failures().map((error) => ({
|
|
69
|
+
message: error.message,
|
|
70
|
+
name: error.path.join(".")
|
|
71
|
+
}));
|
|
72
|
+
return {
|
|
73
|
+
errors,
|
|
74
|
+
result: null
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
errors: null,
|
|
79
|
+
result
|
|
80
|
+
};
|
|
24
81
|
}
|
|
25
|
-
|
|
82
|
+
async function validateZodSchema(state, schema) {
|
|
26
83
|
const result = await schema.safeParseAsync(state);
|
|
27
84
|
if (result.success === false) {
|
|
28
|
-
|
|
85
|
+
const errors = result.error.issues.map((issue) => ({
|
|
29
86
|
name: issue.path.join("."),
|
|
30
87
|
message: issue.message
|
|
31
88
|
}));
|
|
89
|
+
return {
|
|
90
|
+
errors,
|
|
91
|
+
result: null
|
|
92
|
+
};
|
|
32
93
|
}
|
|
33
|
-
return
|
|
94
|
+
return {
|
|
95
|
+
result: result.data,
|
|
96
|
+
errors: null
|
|
97
|
+
};
|
|
34
98
|
}
|
|
35
|
-
|
|
36
|
-
return schema.validateAsync !== void 0 && schema.id !== void 0;
|
|
37
|
-
}
|
|
38
|
-
export function isJoiError(error) {
|
|
39
|
-
return error.isJoi === true;
|
|
40
|
-
}
|
|
41
|
-
export async function getJoiErrors(state, schema) {
|
|
99
|
+
async function validateJoiSchema(state, schema) {
|
|
42
100
|
try {
|
|
43
|
-
await schema.validateAsync(state, { abortEarly: false });
|
|
44
|
-
return
|
|
101
|
+
const result = await schema.validateAsync(state, { abortEarly: false });
|
|
102
|
+
return {
|
|
103
|
+
errors: null,
|
|
104
|
+
result
|
|
105
|
+
};
|
|
45
106
|
} catch (error) {
|
|
46
107
|
if (isJoiError(error)) {
|
|
47
|
-
|
|
48
|
-
name:
|
|
49
|
-
message:
|
|
108
|
+
const errors = error.details.map((issue) => ({
|
|
109
|
+
name: issue.path.join("."),
|
|
110
|
+
message: issue.message
|
|
50
111
|
}));
|
|
112
|
+
return {
|
|
113
|
+
errors,
|
|
114
|
+
result: null
|
|
115
|
+
};
|
|
51
116
|
} else {
|
|
52
117
|
throw error;
|
|
53
118
|
}
|
|
54
119
|
}
|
|
55
120
|
}
|
|
56
|
-
|
|
57
|
-
return "_run" in schema || typeof schema === "function" && "schema" in schema;
|
|
58
|
-
}
|
|
59
|
-
export async function getValibotError(state, schema) {
|
|
121
|
+
async function validateValibotSchema(state, schema) {
|
|
60
122
|
const result = await ("_run" in schema ? schema._run({ typed: false, value: state }, {}) : schema(state));
|
|
61
|
-
|
|
62
|
-
|
|
123
|
+
if (!result.issues || result.issues.length === 0) {
|
|
124
|
+
const output = "output" in result ? result.output : "value" in result ? result.value : null;
|
|
125
|
+
return {
|
|
126
|
+
errors: null,
|
|
127
|
+
result: output
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const errors = result.issues.map((issue) => ({
|
|
63
131
|
name: issue.path?.map((item) => item.key).join(".") || "",
|
|
64
132
|
message: issue.message
|
|
65
|
-
}))
|
|
133
|
+
}));
|
|
134
|
+
return {
|
|
135
|
+
errors,
|
|
136
|
+
result: null
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export function parseSchema(state, schema) {
|
|
140
|
+
if (isZodSchema(schema)) {
|
|
141
|
+
return validateZodSchema(state, schema);
|
|
142
|
+
} else if (isJoiSchema(schema)) {
|
|
143
|
+
return validateJoiSchema(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 if (isStandardSchema(schema)) {
|
|
151
|
+
return validateStandarSchema(state, schema);
|
|
152
|
+
} else {
|
|
153
|
+
throw new Error("Form validation failed: Unsupported form schema");
|
|
154
|
+
}
|
|
66
155
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function pick<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Pick<Data, Keys>;
|
|
2
2
|
export declare function omit<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Omit<Data, Keys>;
|
|
3
|
-
export declare function get(object: Record<string, any
|
|
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 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,3 +46,18 @@ export function looseToNumber(val) {
|
|
|
45
46
|
const n = Number.parseFloat(val);
|
|
46
47
|
return Number.isNaN(n) ? val : n;
|
|
47
48
|
}
|
|
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);
|
|
63
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type { LinkProps } from '../types
|
|
1
|
+
import type { LinkProps } from '../types';
|
|
2
2
|
export declare function pickLinkProps(link: LinkProps & {
|
|
3
3
|
ariaLabel?: string;
|
|
4
|
+
title?: string;
|
|
4
5
|
}): {
|
|
6
|
+
replace: any;
|
|
5
7
|
type: any;
|
|
8
|
+
title: any;
|
|
9
|
+
exact: any;
|
|
6
10
|
active: any;
|
|
7
11
|
activeClass: any;
|
|
8
12
|
ariaCurrentValue: any;
|
|
9
13
|
ariaLabel: any;
|
|
10
14
|
as: any;
|
|
11
15
|
disabled: any;
|
|
12
|
-
exact: any;
|
|
13
16
|
exactActiveClass: any;
|
|
14
17
|
exactHash: any;
|
|
15
18
|
exactQuery: any;
|
|
@@ -21,7 +24,6 @@ export declare function pickLinkProps(link: LinkProps & {
|
|
|
21
24
|
prefetch: any;
|
|
22
25
|
prefetchedClass: any;
|
|
23
26
|
rel: any;
|
|
24
|
-
replace: any;
|
|
25
27
|
target: any;
|
|
26
28
|
to: any;
|
|
27
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
2
|
export function pickLinkProps(link) {
|
|
3
|
-
return reactivePick(link, "active", "activeClass", "ariaCurrentValue", "ariaLabel", "as", "disabled", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "href", "inactiveClass", "noPrefetch", "noRel", "prefetch", "prefetchedClass", "rel", "replace", "target", "to", "type");
|
|
3
|
+
return reactivePick(link, "active", "activeClass", "ariaCurrentValue", "ariaLabel", "as", "disabled", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "href", "inactiveClass", "noPrefetch", "noRel", "prefetch", "prefetchedClass", "rel", "replace", "target", "to", "type", "title");
|
|
4
4
|
}
|
|
@@ -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,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
name: string
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { Icon } from '@iconify/vue'
|
|
9
|
+
|
|
10
|
+
defineProps<IconProps>()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<Icon :icon="name.replace(/^i-/, '')" />
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ButtonHTMLAttributes } from 'vue'
|
|
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 appConfig = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
56
|
+
|
|
57
|
+
const link = tv({ extend: tv(theme), ...(appConfig.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
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { computed } from 'vue'
|
|
94
|
+
import { isEqual, diff } from 'ohash'
|
|
95
|
+
import { useForwardProps } from 'reka-ui'
|
|
96
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
97
|
+
import { hasProtocol } from 'ufo'
|
|
98
|
+
import { useRoute } from '#imports'
|
|
99
|
+
import { RouterLink } from 'vue-router'
|
|
100
|
+
|
|
101
|
+
defineOptions({ inheritAttrs: false })
|
|
102
|
+
|
|
103
|
+
const props = withDefaults(defineProps<LinkProps>(), {
|
|
104
|
+
as: 'button',
|
|
105
|
+
type: 'button',
|
|
106
|
+
active: undefined,
|
|
107
|
+
activeClass: '',
|
|
108
|
+
inactiveClass: ''
|
|
109
|
+
})
|
|
110
|
+
defineSlots<LinkSlots>()
|
|
111
|
+
|
|
112
|
+
const route = useRoute()
|
|
113
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, 'as', 'type', 'disabled', 'active', 'exact', 'exactQuery', 'exactHash', 'activeClass', 'inactiveClass', 'to', 'raw', 'class'))
|
|
114
|
+
|
|
115
|
+
const ui = computed(() => tv({
|
|
116
|
+
extend: link,
|
|
117
|
+
variants: {
|
|
118
|
+
active: {
|
|
119
|
+
true: props.activeClass,
|
|
120
|
+
false: props.inactiveClass
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}))
|
|
124
|
+
|
|
125
|
+
function isPartiallyEqual(item1: any, item2: any) {
|
|
126
|
+
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
127
|
+
if (q.type === 'added') {
|
|
128
|
+
filtered.push(q.key)
|
|
129
|
+
}
|
|
130
|
+
return filtered
|
|
131
|
+
}, [] as string[])
|
|
132
|
+
return isEqual(item1, item2, { excludeKeys: key => diffedKeys.includes(key) })
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const isExternal = computed(() => typeof props.to === 'string' && hasProtocol(props.to, { acceptRelative: true }))
|
|
136
|
+
|
|
137
|
+
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
138
|
+
if (props.active !== undefined) {
|
|
139
|
+
return props.active
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!props.to) {
|
|
143
|
+
return false
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (props.exactQuery === 'partial') {
|
|
147
|
+
if (!isPartiallyEqual(linkRoute.query, route.query)) return false
|
|
148
|
+
} else if (props.exactQuery === true) {
|
|
149
|
+
if (!isEqual(linkRoute.query, route.query)) return false
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
153
|
+
return false
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (props.exact && isExactActive) {
|
|
157
|
+
return true
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!props.exact && isActive) {
|
|
161
|
+
return true
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return false
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
168
|
+
const active = isLinkActive({ route, isActive, isExactActive })
|
|
169
|
+
|
|
170
|
+
if (props.raw) {
|
|
171
|
+
return [props.class, active ? props.activeClass : props.inactiveClass]
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return ui.value({ class: props.class, active, disabled: props.disabled })
|
|
175
|
+
}
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<template>
|
|
179
|
+
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to || '#'" custom>
|
|
180
|
+
<template v-if="custom">
|
|
181
|
+
<slot
|
|
182
|
+
v-bind="{
|
|
183
|
+
...$attrs,
|
|
184
|
+
as,
|
|
185
|
+
type,
|
|
186
|
+
disabled,
|
|
187
|
+
href: to ? (isExternal ? to as string : href) : undefined,
|
|
188
|
+
navigate,
|
|
189
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
190
|
+
}"
|
|
191
|
+
/>
|
|
192
|
+
</template>
|
|
193
|
+
<ULinkBase
|
|
194
|
+
v-else
|
|
195
|
+
v-bind="{
|
|
196
|
+
...$attrs,
|
|
197
|
+
as,
|
|
198
|
+
type,
|
|
199
|
+
disabled,
|
|
200
|
+
href: to ? (isExternal ? to as string : href) : undefined,
|
|
201
|
+
navigate
|
|
202
|
+
}"
|
|
203
|
+
:class="resolveLinkClass({ route: linkRoute, isActive: isActive, isExactActive: isExactActive })"
|
|
204
|
+
>
|
|
205
|
+
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
206
|
+
</ULinkBase>
|
|
207
|
+
</RouterLink>
|
|
208
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { NuxtApp } from '#app';
|
|
3
|
+
export { useHead } from '@unhead/vue';
|
|
4
|
+
export { useRoute, useRouter } from 'vue-router';
|
|
5
|
+
export declare const useAppConfig: () => any;
|
|
6
|
+
export declare const useState: <T>(key: string, init: () => T) => Ref<T>;
|
|
7
|
+
export declare function useNuxtApp(): {
|
|
8
|
+
isHydrating: boolean;
|
|
9
|
+
payload: {
|
|
10
|
+
serverRendered: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare function defineNuxtPlugin(plugin: (nuxtApp: NuxtApp) => void): {
|
|
14
|
+
install(app: import("vue").App<any>): void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import appConfig from "#build/app.config";
|
|
3
|
+
export { useHead } from "@unhead/vue";
|
|
4
|
+
export { useRoute, useRouter } from "vue-router";
|
|
5
|
+
export const useAppConfig = () => appConfig;
|
|
6
|
+
const state = {};
|
|
7
|
+
export const useState = (key, init) => {
|
|
8
|
+
if (state[key]) {
|
|
9
|
+
return state[key];
|
|
10
|
+
}
|
|
11
|
+
const value = ref(init());
|
|
12
|
+
state[key] = value;
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
export function useNuxtApp() {
|
|
16
|
+
return {
|
|
17
|
+
isHydrating: true,
|
|
18
|
+
payload: { serverRendered: false }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function defineNuxtPlugin(plugin) {
|
|
22
|
+
return {
|
|
23
|
+
install(app) {
|
|
24
|
+
plugin({ vueApp: app });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|