@nuxt/ui 4.7.0 → 4.8.0
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.css → ui.static.css} +0 -10
- package/LICENSE.md +1 -1
- package/cli/commands/make/component.mjs +6 -2
- package/cli/templates.mjs +46 -20
- package/cli/utils.mjs +19 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -4
- package/dist/runtime/components/Accordion.vue +15 -14
- package/dist/runtime/components/Alert.vue +20 -20
- package/dist/runtime/components/AuthForm.vue +37 -37
- package/dist/runtime/components/Avatar.d.vue.ts +4 -0
- package/dist/runtime/components/Avatar.vue +14 -12
- package/dist/runtime/components/Avatar.vue.d.ts +4 -0
- package/dist/runtime/components/AvatarGroup.d.vue.ts +4 -0
- package/dist/runtime/components/AvatarGroup.vue +11 -8
- package/dist/runtime/components/AvatarGroup.vue.d.ts +4 -0
- package/dist/runtime/components/Badge.vue +11 -11
- package/dist/runtime/components/Banner.vue +25 -23
- package/dist/runtime/components/BlogPost.d.vue.ts +1 -1
- package/dist/runtime/components/BlogPost.vue +30 -28
- package/dist/runtime/components/BlogPost.vue.d.ts +1 -1
- package/dist/runtime/components/BlogPosts.vue +6 -6
- package/dist/runtime/components/Breadcrumb.d.vue.ts +4 -0
- package/dist/runtime/components/Breadcrumb.vue +21 -18
- package/dist/runtime/components/Breadcrumb.vue.d.ts +4 -0
- package/dist/runtime/components/Button.vue +17 -16
- package/dist/runtime/components/Calendar.vue +21 -20
- package/dist/runtime/components/Card.vue +11 -11
- package/dist/runtime/components/Carousel.vue +23 -22
- package/dist/runtime/components/ChangelogVersion.vue +31 -29
- package/dist/runtime/components/ChangelogVersions.vue +8 -8
- package/dist/runtime/components/ChatMessage.d.vue.ts +6 -0
- package/dist/runtime/components/ChatMessage.vue +46 -36
- package/dist/runtime/components/ChatMessage.vue.d.ts +6 -0
- package/dist/runtime/components/ChatMessages.vue +14 -14
- package/dist/runtime/components/ChatPalette.vue +6 -6
- package/dist/runtime/components/ChatPrompt.d.vue.ts +7 -0
- package/dist/runtime/components/ChatPrompt.vue +22 -12
- package/dist/runtime/components/ChatPrompt.vue.d.ts +7 -0
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +3 -3
- package/dist/runtime/components/ChatPromptSubmit.vue +6 -6
- package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +3 -3
- package/dist/runtime/components/ChatReasoning.vue +20 -20
- package/dist/runtime/components/ChatShimmer.vue +7 -7
- package/dist/runtime/components/ChatTool.d.vue.ts +1 -1
- package/dist/runtime/components/ChatTool.vue +19 -19
- package/dist/runtime/components/ChatTool.vue.d.ts +1 -1
- package/dist/runtime/components/Checkbox.d.vue.ts +2 -0
- package/dist/runtime/components/Checkbox.vue +25 -24
- package/dist/runtime/components/Checkbox.vue.d.ts +2 -0
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.vue +17 -14
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Chip.vue +8 -8
- package/dist/runtime/components/Collapsible.vue +8 -7
- package/dist/runtime/components/ColorPicker.d.vue.ts +2 -0
- package/dist/runtime/components/ColorPicker.vue +10 -10
- package/dist/runtime/components/ColorPicker.vue.d.ts +2 -0
- package/dist/runtime/components/CommandPalette.d.vue.ts +5 -5
- package/dist/runtime/components/CommandPalette.vue +92 -69
- package/dist/runtime/components/CommandPalette.vue.d.ts +5 -5
- package/dist/runtime/components/Container.vue +4 -4
- package/dist/runtime/components/ContextMenu.vue +16 -15
- package/dist/runtime/components/DashboardGroup.d.vue.ts +1 -1
- package/dist/runtime/components/DashboardGroup.vue +6 -4
- package/dist/runtime/components/DashboardGroup.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardNavbar.vue +16 -16
- package/dist/runtime/components/DashboardPanel.vue +7 -7
- package/dist/runtime/components/DashboardResizeHandle.vue +5 -5
- package/dist/runtime/components/DashboardSearch.d.vue.ts +16 -1
- package/dist/runtime/components/DashboardSearch.vue +13 -11
- package/dist/runtime/components/DashboardSearch.vue.d.ts +16 -1
- package/dist/runtime/components/DashboardSearchButton.d.vue.ts +2 -2
- package/dist/runtime/components/DashboardSearchButton.vue +15 -15
- package/dist/runtime/components/DashboardSearchButton.vue.d.ts +2 -2
- package/dist/runtime/components/DashboardSidebar.d.vue.ts +1 -1
- package/dist/runtime/components/DashboardSidebar.vue +22 -22
- package/dist/runtime/components/DashboardSidebar.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardSidebarCollapse.d.vue.ts +1 -1
- package/dist/runtime/components/DashboardSidebarCollapse.vue +5 -5
- package/dist/runtime/components/DashboardSidebarCollapse.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardSidebarToggle.d.vue.ts +1 -1
- package/dist/runtime/components/DashboardSidebarToggle.vue +5 -5
- package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardToolbar.vue +6 -6
- package/dist/runtime/components/Drawer.d.vue.ts +1 -1
- package/dist/runtime/components/Drawer.vue +23 -22
- package/dist/runtime/components/Drawer.vue.d.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue +21 -20
- package/dist/runtime/components/Editor.vue +8 -7
- package/dist/runtime/components/EditorDragHandle.d.vue.ts +2 -2
- package/dist/runtime/components/EditorDragHandle.vue +8 -8
- package/dist/runtime/components/EditorDragHandle.vue.d.ts +2 -2
- package/dist/runtime/components/EditorToolbar.vue +10 -9
- package/dist/runtime/components/Empty.vue +14 -14
- package/dist/runtime/components/Error.d.vue.ts +9 -1
- package/dist/runtime/components/Error.vue +17 -10
- package/dist/runtime/components/Error.vue.d.ts +9 -1
- package/dist/runtime/components/FieldGroup.vue +4 -4
- package/dist/runtime/components/FileUpload.vue +36 -37
- package/dist/runtime/components/Footer.vue +10 -10
- package/dist/runtime/components/FooterColumns.vue +15 -15
- package/dist/runtime/components/Form.d.vue.ts +1 -1
- package/dist/runtime/components/Form.vue +5 -5
- package/dist/runtime/components/Form.vue.d.ts +1 -1
- package/dist/runtime/components/FormField.d.vue.ts +2 -1
- package/dist/runtime/components/FormField.vue +21 -21
- package/dist/runtime/components/FormField.vue.d.ts +2 -1
- package/dist/runtime/components/Header.vue +19 -19
- package/dist/runtime/components/Input.vue +19 -19
- package/dist/runtime/components/InputDate.vue +21 -20
- package/dist/runtime/components/InputMenu.d.vue.ts +52 -51
- package/dist/runtime/components/InputMenu.vue +66 -63
- package/dist/runtime/components/InputMenu.vue.d.ts +52 -51
- package/dist/runtime/components/InputNumber.vue +25 -24
- package/dist/runtime/components/InputTags.vue +26 -25
- package/dist/runtime/components/InputTime.vue +21 -20
- package/dist/runtime/components/Kbd.vue +5 -5
- package/dist/runtime/components/Link.d.vue.ts +11 -2
- package/dist/runtime/components/Link.vue +13 -4
- package/dist/runtime/components/Link.vue.d.ts +11 -2
- package/dist/runtime/components/Listbox.d.vue.ts +13 -9
- package/dist/runtime/components/Listbox.vue +34 -32
- package/dist/runtime/components/Listbox.vue.d.ts +13 -9
- package/dist/runtime/components/Main.vue +4 -4
- package/dist/runtime/components/Marquee.vue +5 -5
- package/dist/runtime/components/Modal.d.vue.ts +2 -2
- package/dist/runtime/components/Modal.vue +25 -24
- package/dist/runtime/components/Modal.vue.d.ts +2 -2
- package/dist/runtime/components/NavigationMenu.vue +66 -65
- package/dist/runtime/components/Page.vue +7 -7
- package/dist/runtime/components/PageAnchors.vue +11 -11
- package/dist/runtime/components/PageAside.vue +9 -9
- package/dist/runtime/components/PageBody.vue +4 -4
- package/dist/runtime/components/PageCTA.vue +18 -16
- package/dist/runtime/components/PageCard.vue +25 -23
- package/dist/runtime/components/PageColumns.vue +4 -4
- package/dist/runtime/components/PageFeature.vue +17 -15
- package/dist/runtime/components/PageGrid.vue +4 -4
- package/dist/runtime/components/PageHeader.vue +14 -14
- package/dist/runtime/components/PageHero.vue +20 -18
- package/dist/runtime/components/PageLinks.vue +12 -12
- package/dist/runtime/components/PageList.vue +4 -4
- package/dist/runtime/components/PageLogos.vue +16 -16
- package/dist/runtime/components/PageSection.d.vue.ts +1 -1
- package/dist/runtime/components/PageSection.vue +24 -22
- package/dist/runtime/components/PageSection.vue.d.ts +1 -1
- package/dist/runtime/components/Pagination.d.vue.ts +2 -2
- package/dist/runtime/components/Pagination.vue +23 -22
- package/dist/runtime/components/Pagination.vue.d.ts +2 -2
- package/dist/runtime/components/PinInput.vue +15 -14
- package/dist/runtime/components/Popover.vue +9 -8
- package/dist/runtime/components/PricingPlan.vue +36 -36
- package/dist/runtime/components/PricingPlans.vue +6 -6
- package/dist/runtime/components/PricingTable.vue +44 -44
- package/dist/runtime/components/Progress.d.vue.ts +1 -1
- package/dist/runtime/components/Progress.vue +12 -11
- package/dist/runtime/components/Progress.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.d.vue.ts +2 -0
- package/dist/runtime/components/RadioGroup.vue +28 -27
- package/dist/runtime/components/RadioGroup.vue.d.ts +2 -0
- package/dist/runtime/components/ScrollArea.vue +13 -13
- package/dist/runtime/components/Select.vue +38 -40
- package/dist/runtime/components/SelectMenu.d.vue.ts +46 -46
- package/dist/runtime/components/SelectMenu.vue +49 -48
- package/dist/runtime/components/SelectMenu.vue.d.ts +46 -46
- package/dist/runtime/components/Separator.d.vue.ts +9 -3
- package/dist/runtime/components/Separator.vue +29 -16
- package/dist/runtime/components/Separator.vue.d.ts +9 -3
- package/dist/runtime/components/Sidebar.vue +28 -28
- package/dist/runtime/components/Skeleton.vue +5 -5
- package/dist/runtime/components/Slideover.d.vue.ts +3 -3
- package/dist/runtime/components/Slideover.vue +24 -23
- package/dist/runtime/components/Slideover.vue.d.ts +3 -3
- package/dist/runtime/components/Slider.vue +16 -15
- package/dist/runtime/components/Stepper.vue +19 -18
- package/dist/runtime/components/Switch.d.vue.ts +2 -0
- package/dist/runtime/components/Switch.vue +26 -23
- package/dist/runtime/components/Switch.vue.d.ts +2 -0
- package/dist/runtime/components/Table.vue +26 -25
- package/dist/runtime/components/Tabs.vue +22 -21
- package/dist/runtime/components/Textarea.vue +19 -18
- package/dist/runtime/components/Theme.d.vue.ts +13 -5
- package/dist/runtime/components/Theme.vue +32 -4
- package/dist/runtime/components/Theme.vue.d.ts +13 -5
- package/dist/runtime/components/Timeline.vue +15 -15
- package/dist/runtime/components/Toast.vue +35 -34
- package/dist/runtime/components/Toaster.d.vue.ts +1 -1
- package/dist/runtime/components/Toaster.vue +10 -9
- package/dist/runtime/components/Toaster.vue.d.ts +1 -1
- package/dist/runtime/components/Tooltip.vue +13 -12
- package/dist/runtime/components/Tree.vue +24 -23
- package/dist/runtime/components/User.vue +23 -21
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue +5 -2
- package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeButton.vue +8 -6
- package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeImage.vue +4 -2
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue +1 -0
- package/dist/runtime/components/content/ContentNavigation.vue +31 -30
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +30 -3
- package/dist/runtime/components/content/ContentSearch.vue +66 -32
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +30 -3
- package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +2 -2
- package/dist/runtime/components/content/ContentSearchButton.vue +15 -15
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +2 -2
- package/dist/runtime/components/content/ContentSurround.vue +14 -12
- package/dist/runtime/components/content/ContentToc.vue +34 -33
- package/dist/runtime/components/prose/A.vue +4 -4
- package/dist/runtime/components/prose/Accordion.vue +4 -4
- package/dist/runtime/components/prose/AccordionItem.vue +5 -5
- package/dist/runtime/components/prose/Badge.vue +4 -4
- package/dist/runtime/components/prose/Blockquote.vue +4 -4
- package/dist/runtime/components/prose/Callout.vue +8 -8
- package/dist/runtime/components/prose/Card.vue +12 -12
- package/dist/runtime/components/prose/CardGroup.vue +4 -4
- package/dist/runtime/components/prose/Code.vue +4 -4
- package/dist/runtime/components/prose/CodeCollapse.vue +8 -8
- package/dist/runtime/components/prose/CodeGroup.vue +9 -9
- package/dist/runtime/components/prose/CodePreview.vue +6 -6
- package/dist/runtime/components/prose/CodeTree.vue +14 -14
- package/dist/runtime/components/prose/Collapsible.vue +7 -7
- package/dist/runtime/components/prose/Em.vue +4 -4
- package/dist/runtime/components/prose/Field.vue +13 -13
- package/dist/runtime/components/prose/FieldGroup.vue +4 -4
- package/dist/runtime/components/prose/H1.vue +5 -5
- package/dist/runtime/components/prose/H2.vue +7 -7
- package/dist/runtime/components/prose/H3.vue +7 -7
- package/dist/runtime/components/prose/H4.vue +5 -5
- package/dist/runtime/components/prose/Hr.vue +4 -4
- package/dist/runtime/components/prose/Icon.vue +4 -4
- package/dist/runtime/components/prose/Img.vue +17 -12
- package/dist/runtime/components/prose/Kbd.d.vue.ts +10 -2
- package/dist/runtime/components/prose/Kbd.vue +8 -5
- package/dist/runtime/components/prose/Kbd.vue.d.ts +10 -2
- package/dist/runtime/components/prose/Li.vue +4 -4
- package/dist/runtime/components/prose/Ol.vue +4 -4
- package/dist/runtime/components/prose/P.vue +4 -4
- package/dist/runtime/components/prose/Pre.vue +9 -9
- package/dist/runtime/components/prose/Prompt.vue +12 -12
- package/dist/runtime/components/prose/Steps.vue +4 -4
- package/dist/runtime/components/prose/Strong.vue +4 -4
- package/dist/runtime/components/prose/Table.vue +5 -5
- package/dist/runtime/components/prose/Tabs.vue +4 -4
- package/dist/runtime/components/prose/TabsItem.vue +5 -5
- package/dist/runtime/components/prose/Tbody.vue +4 -4
- package/dist/runtime/components/prose/Td.vue +4 -4
- package/dist/runtime/components/prose/Th.vue +4 -4
- package/dist/runtime/components/prose/Thead.vue +4 -4
- package/dist/runtime/components/prose/Tr.vue +4 -4
- package/dist/runtime/components/prose/Ul.vue +4 -4
- package/dist/runtime/composables/defineShortcuts.js +7 -2
- package/dist/runtime/composables/index.d.ts +1 -2
- package/dist/runtime/composables/index.js +1 -2
- package/dist/runtime/composables/useAvatarGroup.d.ts +12 -1
- package/dist/runtime/composables/useAvatarGroup.js +4 -2
- package/dist/runtime/composables/useComponentIcons.js +1 -1
- package/dist/runtime/composables/useComponentProps.d.ts +180 -0
- package/dist/runtime/composables/useComponentProps.js +59 -0
- package/dist/runtime/composables/useContentSearch.d.ts +4 -2
- package/dist/runtime/composables/useContentSearch.js +64 -7
- package/dist/runtime/composables/useFieldGroup.d.ts +9 -1
- package/dist/runtime/composables/useFormField.d.ts +21 -1
- package/dist/runtime/composables/useForwardProps.d.ts +13 -0
- package/dist/runtime/composables/useForwardProps.js +14 -0
- package/dist/runtime/composables/usePrefix.d.ts +6 -0
- package/dist/runtime/composables/usePrefix.js +11 -0
- package/dist/runtime/composables/useResizable.d.ts +4 -0
- package/dist/runtime/composables/useResizable.js +1 -1
- package/dist/runtime/locale/ar.js +1 -0
- package/dist/runtime/locale/az.js +1 -0
- package/dist/runtime/locale/be.js +1 -0
- package/dist/runtime/locale/bg.js +1 -0
- package/dist/runtime/locale/bn.js +1 -0
- package/dist/runtime/locale/ca.js +1 -0
- package/dist/runtime/locale/ckb.js +1 -0
- package/dist/runtime/locale/cs.js +1 -0
- package/dist/runtime/locale/da.js +1 -0
- package/dist/runtime/locale/de.js +1 -0
- package/dist/runtime/locale/de_ch.js +1 -0
- package/dist/runtime/locale/el.js +1 -0
- package/dist/runtime/locale/en.js +1 -0
- package/dist/runtime/locale/es.js +1 -0
- package/dist/runtime/locale/et.js +1 -0
- package/dist/runtime/locale/eu.js +1 -0
- package/dist/runtime/locale/fa_ir.js +1 -0
- package/dist/runtime/locale/fi.js +1 -0
- package/dist/runtime/locale/fr.js +1 -0
- package/dist/runtime/locale/gl.js +1 -0
- package/dist/runtime/locale/he.js +1 -0
- package/dist/runtime/locale/hi.js +1 -0
- package/dist/runtime/locale/hr.js +1 -0
- package/dist/runtime/locale/hu.js +1 -0
- package/dist/runtime/locale/hy.js +1 -0
- package/dist/runtime/locale/id.js +1 -0
- package/dist/runtime/locale/is.js +1 -0
- package/dist/runtime/locale/it.js +1 -0
- package/dist/runtime/locale/ja.js +1 -0
- package/dist/runtime/locale/ka.js +1 -0
- package/dist/runtime/locale/kk.js +1 -0
- package/dist/runtime/locale/km.js +1 -0
- package/dist/runtime/locale/ko.js +1 -0
- package/dist/runtime/locale/ky.js +1 -0
- package/dist/runtime/locale/lb.js +1 -0
- package/dist/runtime/locale/lo.js +1 -0
- package/dist/runtime/locale/lt.js +1 -0
- package/dist/runtime/locale/mn.js +1 -0
- package/dist/runtime/locale/ms.js +1 -0
- package/dist/runtime/locale/nb_no.js +1 -0
- package/dist/runtime/locale/nl.js +1 -0
- package/dist/runtime/locale/pl.js +1 -0
- package/dist/runtime/locale/pt.js +1 -0
- package/dist/runtime/locale/pt_br.js +1 -0
- package/dist/runtime/locale/ro.js +1 -0
- package/dist/runtime/locale/ru.js +1 -0
- package/dist/runtime/locale/sk.js +1 -0
- package/dist/runtime/locale/sl.js +1 -0
- package/dist/runtime/locale/sq.js +1 -0
- package/dist/runtime/locale/sv.js +1 -0
- package/dist/runtime/locale/th.js +1 -0
- package/dist/runtime/locale/tj.js +1 -0
- package/dist/runtime/locale/tr.js +1 -0
- package/dist/runtime/locale/ug_cn.js +1 -0
- package/dist/runtime/locale/uk.js +1 -0
- package/dist/runtime/locale/ur.js +1 -0
- package/dist/runtime/locale/uz.js +1 -0
- package/dist/runtime/locale/vi.js +1 -0
- package/dist/runtime/locale/zh_cn.js +1 -0
- package/dist/runtime/locale/zh_tw.js +1 -0
- package/dist/runtime/plugins/colors.js +1 -1
- package/dist/runtime/types/content.d.ts +1 -0
- package/dist/runtime/types/content.js +1 -0
- package/dist/runtime/types/form.d.ts +2 -2
- package/dist/runtime/types/locale.d.ts +1 -0
- package/dist/runtime/utils/dashboard.d.ts +1 -1
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/link.js +1 -0
- package/dist/runtime/utils/{fuse.d.ts → search.d.ts} +2 -1
- package/dist/runtime/utils/{fuse.js → search.js} +11 -2
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +1 -0
- package/dist/runtime/vue/overrides/inertia/Link.d.vue.ts +1 -1
- package/dist/runtime/vue/overrides/inertia/Link.vue +5 -0
- package/dist/runtime/vue/overrides/inertia/Link.vue.d.ts +1 -1
- package/dist/runtime/vue/overrides/none/Link.d.vue.ts +1 -1
- package/dist/runtime/vue/overrides/none/Link.vue.d.ts +1 -1
- package/dist/runtime/vue/overrides/vue-router/Link.d.vue.ts +1 -1
- package/dist/runtime/vue/overrides/vue-router/Link.vue.d.ts +1 -1
- package/dist/shared/{ui.BIQuJqNV.mjs → ui.CoJ8bnb0.mjs} +244 -83
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +27 -34
- package/dist/runtime/composables/useComponentUI.d.ts +0 -33
- package/dist/runtime/composables/useComponentUI.js +0 -13
- package/dist/runtime/composables/useResolvedVariants.d.ts +0 -21
- package/dist/runtime/composables/useResolvedVariants.js +0 -14
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { computed } from "vue";
|
|
7
7
|
import { useRuntimeConfig } from "#imports";
|
|
8
8
|
import ImageComponent from "#build/ui-image-component";
|
|
9
|
+
import { usePrefix } from "../../composables/usePrefix";
|
|
9
10
|
import { resolveBaseURL } from "../../utils";
|
|
10
11
|
defineOptions({ inheritAttrs: false });
|
|
11
12
|
const props = defineProps({
|
|
@@ -14,9 +15,10 @@ const props = defineProps({
|
|
|
14
15
|
});
|
|
15
16
|
const refinedLight = computed(() => resolveBaseURL(props.light, useRuntimeConfig().app.baseURL));
|
|
16
17
|
const refinedDark = computed(() => resolveBaseURL(props.dark, useRuntimeConfig().app.baseURL));
|
|
18
|
+
const prefix = usePrefix();
|
|
17
19
|
</script>
|
|
18
20
|
|
|
19
21
|
<template>
|
|
20
|
-
<component :is="ImageComponent" :src="refinedLight" class="dark:hidden" v-bind="$attrs" />
|
|
21
|
-
<component :is="ImageComponent" :src="refinedDark" class="hidden dark:block" v-bind="$attrs" />
|
|
22
|
+
<component :is="ImageComponent" :src="refinedLight" :class="prefix('dark:hidden')" v-bind="$attrs" />
|
|
23
|
+
<component :is="ImageComponent" :src="refinedDark" :class="prefix('hidden dark:block')" v-bind="$attrs" />
|
|
22
24
|
</template>
|
|
@@ -13,6 +13,7 @@ const props = defineProps({
|
|
|
13
13
|
as: { type: null, required: false },
|
|
14
14
|
color: { type: null, required: false },
|
|
15
15
|
size: { type: null, required: false },
|
|
16
|
+
highlight: { type: Boolean, required: false },
|
|
16
17
|
loading: { type: Boolean, required: false },
|
|
17
18
|
loadingIcon: { type: null, required: false },
|
|
18
19
|
label: { type: String, required: false },
|
|
@@ -4,10 +4,11 @@ import theme from "#build/ui/content/content-navigation";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
|
-
import { Primitive, AccordionRoot, AccordionItem, AccordionTrigger, AccordionContent
|
|
7
|
+
import { Primitive, AccordionRoot, AccordionItem, AccordionTrigger, AccordionContent } from "reka-ui";
|
|
8
|
+
import { useForwardProps } from "../../composables/useForwardProps";
|
|
8
9
|
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
9
10
|
import { useRoute, useAppConfig } from "#imports";
|
|
10
|
-
import {
|
|
11
|
+
import { useComponentProps } from "../../composables/useComponentProps";
|
|
11
12
|
import { pickLinkProps } from "../../utils/link";
|
|
12
13
|
import { tv } from "../../utils/tv";
|
|
13
14
|
import { mapContentNavigationItem } from "../../utils/content";
|
|
@@ -17,7 +18,7 @@ import ULinkBase from "../LinkBase.vue";
|
|
|
17
18
|
import UBadge from "../Badge.vue";
|
|
18
19
|
import UIcon from "../Icon.vue";
|
|
19
20
|
defineOptions({ inheritAttrs: false });
|
|
20
|
-
const
|
|
21
|
+
const _props = defineProps({
|
|
21
22
|
as: { type: null, required: false, default: "nav" },
|
|
22
23
|
defaultOpen: { type: Boolean, required: false, default: void 0 },
|
|
23
24
|
trailingIcon: { type: null, required: false },
|
|
@@ -36,10 +37,10 @@ const props = defineProps({
|
|
|
36
37
|
});
|
|
37
38
|
const emits = defineEmits(["update:modelValue"]);
|
|
38
39
|
const slots = defineSlots();
|
|
39
|
-
const
|
|
40
|
+
const props = useComponentProps("contentNavigation", _props);
|
|
41
|
+
const rootProps = useForwardProps(reactivePick(props, "collapsible", "type", "unmountOnHide"), emits);
|
|
40
42
|
const route = useRoute();
|
|
41
43
|
const appConfig = useAppConfig();
|
|
42
|
-
const uiProp = useComponentUI("contentNavigation", props);
|
|
43
44
|
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate();
|
|
44
45
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentNavigation || {} })({
|
|
45
46
|
color: props.color,
|
|
@@ -75,68 +76,68 @@ const defaultValue = computed(() => {
|
|
|
75
76
|
<DefineLinkTemplate v-slot="{ link, active }">
|
|
76
77
|
<slot name="link" :link="link" :active="active" :ui="ui">
|
|
77
78
|
<slot name="link-leading" :link="link" :active="active" :ui="ui">
|
|
78
|
-
<UIcon v-if="link.icon" :name="link.icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [
|
|
79
|
+
<UIcon v-if="link.icon" :name="link.icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, link.ui?.linkLeadingIcon], active })" />
|
|
79
80
|
</slot>
|
|
80
81
|
|
|
81
|
-
<span v-if="link.title || !!slots['link-title']" data-slot="linkTitle" :class="ui.linkTitle({ class: [
|
|
82
|
+
<span v-if="link.title || !!slots['link-title']" data-slot="linkTitle" :class="ui.linkTitle({ class: [props.ui?.linkTitle, link.ui?.linkTitle], active })">
|
|
82
83
|
<slot name="link-title" :link="link" :active="active" :ui="ui">
|
|
83
84
|
{{ link.title }}
|
|
84
85
|
</slot>
|
|
85
86
|
|
|
86
|
-
<UIcon v-if="link.target === '_blank'" :name="appConfig.ui.icons.external" data-slot="linkTitleExternalIcon" :class="ui.linkTitleExternalIcon({ class: [
|
|
87
|
+
<UIcon v-if="link.target === '_blank'" :name="appConfig.ui.icons.external" data-slot="linkTitleExternalIcon" :class="ui.linkTitleExternalIcon({ class: [props.ui?.linkTitleExternalIcon, link.ui?.linkTitleExternalIcon], active })" />
|
|
87
88
|
</span>
|
|
88
89
|
|
|
89
|
-
<span v-if="link.badge || link.badge === 0 || link.children?.length && !disabled || link.trailingIcon || !!slots['link-trailing']" data-slot="linkTrailing" :class="ui.linkTrailing({ class: [
|
|
90
|
+
<span v-if="link.badge || link.badge === 0 || link.children?.length && !disabled || link.trailingIcon || !!slots['link-trailing']" data-slot="linkTrailing" :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, link.ui?.linkTrailing] })">
|
|
90
91
|
<slot name="link-trailing" :link="link" :active="active" :ui="ui">
|
|
91
92
|
<UBadge
|
|
92
93
|
v-if="link.badge || link.badge === 0"
|
|
93
94
|
color="neutral"
|
|
94
95
|
variant="outline"
|
|
95
|
-
:size="
|
|
96
|
+
:size="props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
|
|
96
97
|
v-bind="typeof link.badge === 'string' || typeof link.badge === 'number' ? { label: link.badge } : link.badge"
|
|
97
98
|
data-slot="linkTrailingBadge"
|
|
98
|
-
:class="ui.linkTrailingBadge({ class:
|
|
99
|
+
:class="ui.linkTrailingBadge({ class: props.ui?.linkTrailingBadge })"
|
|
99
100
|
/>
|
|
100
|
-
<UIcon v-if="link.children?.length && !disabled" :name="link.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" data-slot="linkTrailingIcon" :class="ui.linkTrailingIcon({ class: [
|
|
101
|
-
<UIcon v-else-if="link.trailingIcon" :name="link.trailingIcon" data-slot="linkTrailingIcon" :class="ui.linkTrailingIcon({ class: [
|
|
101
|
+
<UIcon v-if="link.children?.length && !disabled" :name="link.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown" data-slot="linkTrailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, link.ui?.linkTrailingIcon] })" />
|
|
102
|
+
<UIcon v-else-if="link.trailingIcon" :name="link.trailingIcon" data-slot="linkTrailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, link.ui?.linkTrailingIcon] })" />
|
|
102
103
|
</slot>
|
|
103
104
|
</span>
|
|
104
105
|
</slot>
|
|
105
106
|
</DefineLinkTemplate>
|
|
106
107
|
|
|
107
|
-
<Primitive :as="as" v-bind="$attrs" :as-child="level > 0" data-slot="root" :class="ui.root({ class: [
|
|
108
|
-
<AccordionRoot as="ul" :disabled="disabled" v-bind="rootProps" :default-value="defaultValue" :class="level > 0 ? ui.listWithChildren({ class:
|
|
109
|
-
<template v-for="(link, index) in navigation" :key="index">
|
|
108
|
+
<Primitive :as="props.as" v-bind="$attrs" :as-child="props.level > 0" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
109
|
+
<AccordionRoot as="ul" :disabled="disabled" v-bind="rootProps" :default-value="defaultValue" :class="props.level > 0 ? ui.listWithChildren({ class: props.ui?.listWithChildren }) : ui.list({ class: props.ui?.list })">
|
|
110
|
+
<template v-for="(link, index) in props.navigation" :key="index">
|
|
110
111
|
<AccordionItem
|
|
111
112
|
v-if="link.children?.length"
|
|
112
113
|
as="li"
|
|
113
114
|
:disabled="!!link.disabled"
|
|
114
115
|
data-slot="itemWithChildren"
|
|
115
|
-
:class="ui.itemWithChildren({ class: [
|
|
116
|
+
:class="ui.itemWithChildren({ class: [props.ui?.itemWithChildren, link.ui?.itemWithChildren], level: props.level > 0 })"
|
|
116
117
|
:value="String(index)"
|
|
117
118
|
>
|
|
118
119
|
<AccordionTrigger
|
|
119
120
|
as="button"
|
|
120
121
|
:class="[
|
|
121
|
-
ui.link({ class: [
|
|
122
|
-
ui.trigger({ class: [
|
|
122
|
+
ui.link({ class: [props.ui?.link, link.ui?.link, link.class], active: link.active, disabled: !!link.disabled || disabled }),
|
|
123
|
+
ui.trigger({ class: [props.ui?.trigger, link.ui?.trigger], disabled: !!link.disabled || disabled })
|
|
123
124
|
]"
|
|
124
125
|
>
|
|
125
126
|
<ReuseLinkTemplate :link="link" :active="link.active || false" />
|
|
126
127
|
</AccordionTrigger>
|
|
127
128
|
|
|
128
|
-
<AccordionContent data-slot="content" :class="ui.content({ class: [
|
|
129
|
+
<AccordionContent data-slot="content" :class="ui.content({ class: [props.ui?.content, link.ui?.content] })">
|
|
129
130
|
<UContentNavigation
|
|
130
131
|
v-bind="rootProps"
|
|
131
132
|
:navigation="link.children"
|
|
132
|
-
:default-open="defaultOpen"
|
|
133
|
-
:level="level + 1"
|
|
134
|
-
:trailing-icon="trailingIcon"
|
|
135
|
-
:color="color"
|
|
136
|
-
:variant="variant"
|
|
137
|
-
:highlight="highlight"
|
|
138
|
-
:highlight-color="highlightColor"
|
|
139
|
-
:ui="
|
|
133
|
+
:default-open="props.defaultOpen"
|
|
134
|
+
:level="props.level + 1"
|
|
135
|
+
:trailing-icon="props.trailingIcon"
|
|
136
|
+
:color="props.color"
|
|
137
|
+
:variant="props.variant"
|
|
138
|
+
:highlight="props.highlight"
|
|
139
|
+
:highlight-color="props.highlightColor"
|
|
140
|
+
:ui="props.ui"
|
|
140
141
|
>
|
|
141
142
|
<template v-for="(_, name) in slots" #[name]="slotData">
|
|
142
143
|
<slot :name="name" v-bind="{ ...slotData, link: slotData.link }" />
|
|
@@ -145,9 +146,9 @@ const defaultValue = computed(() => {
|
|
|
145
146
|
</AccordionContent>
|
|
146
147
|
</AccordionItem>
|
|
147
148
|
|
|
148
|
-
<li v-else data-slot="item" :class="ui.item({ class: [
|
|
149
|
+
<li v-else data-slot="item" :class="ui.item({ class: [props.ui?.item, link.ui?.item], level: props.level > 0 })">
|
|
149
150
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(mapContentNavigationItem(link))" custom>
|
|
150
|
-
<ULinkBase v-bind="slotProps" data-slot="link" :class="ui.link({ class: [
|
|
151
|
+
<ULinkBase v-bind="slotProps" data-slot="link" :class="ui.link({ class: [props.ui?.link, link.ui?.link, link.class], active, disabled: !!link.disabled, level: props.level > 0 })">
|
|
151
152
|
<ReuseLinkTemplate :link="link" :active="active" />
|
|
152
153
|
</ULinkBase>
|
|
153
154
|
</ULink>
|
|
@@ -22,6 +22,21 @@ export interface ContentSearchFile {
|
|
|
22
22
|
level: number;
|
|
23
23
|
content: string;
|
|
24
24
|
}
|
|
25
|
+
export interface ContentSearchResult extends ContentSearchFile {
|
|
26
|
+
snippets?: {
|
|
27
|
+
title?: string;
|
|
28
|
+
content?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ContentSearchOptions {
|
|
32
|
+
limit?: number;
|
|
33
|
+
snippet?: {
|
|
34
|
+
columns?: ('title' | 'content')[];
|
|
35
|
+
around?: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type ContentSearchStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
39
|
+
export type ContentSearchFn = (query: string, opts?: ContentSearchOptions) => Promise<ContentSearchResult[]>;
|
|
25
40
|
export interface ContentSearchItem extends Omit<LinkProps, 'custom'>, CommandPaletteItem {
|
|
26
41
|
level?: number;
|
|
27
42
|
/**
|
|
@@ -56,8 +71,9 @@ export interface ContentSearchProps<T extends ContentSearchLink = ContentSearchL
|
|
|
56
71
|
fuseOptions: {
|
|
57
72
|
ignoreLocation: true,
|
|
58
73
|
includeMatches: true,
|
|
74
|
+
useTokenSearch: true,
|
|
59
75
|
threshold: 0.1,
|
|
60
|
-
keys: ['label', 'suffix']
|
|
76
|
+
keys: ['label', 'description', 'suffix']
|
|
61
77
|
},
|
|
62
78
|
resultLimit: 12,
|
|
63
79
|
matchAllWhenSearchEmpty: true
|
|
@@ -65,8 +81,19 @@ export interface ContentSearchProps<T extends ContentSearchLink = ContentSearchL
|
|
|
65
81
|
*/
|
|
66
82
|
fuse?: UseFuseOptions<T>;
|
|
67
83
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
84
|
+
* Async search function (e.g. from [`useSearchCollection`](https://content.nuxt.com/docs/utils/use-search-collection)).
|
|
85
|
+
* When provided, ContentSearch calls it on each keystroke and uses the results instead of Fuse.
|
|
86
|
+
* Results are mapped, sanitized, and grouped by navigation internally.
|
|
87
|
+
*/
|
|
88
|
+
search?: ContentSearchFn;
|
|
89
|
+
/**
|
|
90
|
+
* Status of the async search index (e.g. from `useSearchCollection`).
|
|
91
|
+
* When the status transitions to `'ready'`, the search is automatically re-triggered if there's a pending term.
|
|
92
|
+
*/
|
|
93
|
+
searchStatus?: ContentSearchStatus;
|
|
94
|
+
/**
|
|
95
|
+
* Delay (in milliseconds) before the search is triggered (debounced).
|
|
96
|
+
* Keeps the input responsive by only running the search after typing settles.
|
|
70
97
|
* Set to `0` to disable.
|
|
71
98
|
* @defaultValue 100
|
|
72
99
|
*/
|
|
@@ -3,19 +3,19 @@ import theme from "#build/ui/content/content-search";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed, useTemplateRef } from "vue";
|
|
7
|
-
import { useForwardProps } from "reka-ui";
|
|
6
|
+
import { computed, shallowRef, useTemplateRef, watch } from "vue";
|
|
8
7
|
import { defu } from "defu";
|
|
9
|
-
import { reactivePick } from "@vueuse/core";
|
|
8
|
+
import { reactivePick, refDebounced } from "@vueuse/core";
|
|
10
9
|
import { useAppConfig, useColorMode, defineShortcuts } from "#imports";
|
|
11
|
-
import {
|
|
10
|
+
import { useComponentProps } from "../../composables/useComponentProps";
|
|
11
|
+
import { useForwardProps } from "../../composables/useForwardProps";
|
|
12
12
|
import { useContentSearch } from "../../composables/useContentSearch";
|
|
13
13
|
import { useLocale } from "../../composables/useLocale";
|
|
14
14
|
import { omit, transformUI } from "../../utils";
|
|
15
15
|
import { tv } from "../../utils/tv";
|
|
16
16
|
import UModal from "../Modal.vue";
|
|
17
17
|
import UCommandPalette from "../CommandPalette.vue";
|
|
18
|
-
const
|
|
18
|
+
const _props = defineProps({
|
|
19
19
|
size: { type: null, required: false },
|
|
20
20
|
close: { type: [Boolean, Object], required: false, default: true },
|
|
21
21
|
shortcut: { type: String, required: false, default: "meta_k" },
|
|
@@ -23,6 +23,8 @@ const props = defineProps({
|
|
|
23
23
|
navigation: { type: Array, required: false },
|
|
24
24
|
files: { type: Array, required: false },
|
|
25
25
|
fuse: { type: Object, required: false },
|
|
26
|
+
search: { type: Function, required: false },
|
|
27
|
+
searchStatus: { type: String, required: false },
|
|
26
28
|
searchDelay: { type: Number, required: false, default: 100 },
|
|
27
29
|
colorMode: { type: Boolean, required: false, default: true },
|
|
28
30
|
class: { type: null, required: false },
|
|
@@ -45,44 +47,72 @@ const props = defineProps({
|
|
|
45
47
|
groups: { type: Array, required: false }
|
|
46
48
|
});
|
|
47
49
|
const slots = defineSlots();
|
|
50
|
+
const props = useComponentProps("contentSearch", _props);
|
|
48
51
|
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
49
52
|
const { t } = useLocale();
|
|
50
|
-
const { open, mapNavigationItems, postFilter } = useContentSearch();
|
|
53
|
+
const { open, mapNavigationItems, mapLinks, mapSearchResults, postFilter } = useContentSearch();
|
|
51
54
|
const colorMode = useColorMode();
|
|
52
55
|
const appConfig = useAppConfig();
|
|
53
|
-
const uiProp = useComponentUI("contentSearch", props);
|
|
54
56
|
const commandPaletteProps = useForwardProps(reactivePick(props, "size", "icon", "placeholder", "autofocus", "loading", "loadingIcon", "close", "closeIcon", "searchDelay"));
|
|
55
57
|
const modalProps = useForwardProps(reactivePick(props, "overlay", "transition", "content", "dismissible", "fullscreen", "modal", "portal"));
|
|
56
58
|
const getProxySlots = () => omit(slots, ["content"]);
|
|
57
59
|
const fuse = computed(() => defu({}, props.fuse, {
|
|
58
60
|
fuseOptions: {
|
|
59
|
-
includeMatches: true
|
|
60
|
-
|
|
61
|
+
includeMatches: true,
|
|
62
|
+
useTokenSearch: true
|
|
63
|
+
},
|
|
64
|
+
resultLimit: 12
|
|
61
65
|
}));
|
|
62
66
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentSearch || {} })({
|
|
63
67
|
size: props.size,
|
|
64
68
|
fullscreen: props.fullscreen
|
|
65
69
|
}));
|
|
66
70
|
const commandPaletteRef = useTemplateRef("commandPaletteRef");
|
|
67
|
-
const
|
|
71
|
+
const debouncedSearchTerm = refDebounced(searchTerm, () => props.searchDelay);
|
|
72
|
+
const rawSearchResults = shallowRef([]);
|
|
73
|
+
const searchResults = computed(() => mapSearchResults(rawSearchResults.value, props.navigation));
|
|
74
|
+
let searchRequestId = 0;
|
|
75
|
+
async function runSearch(term) {
|
|
76
|
+
const requestId = ++searchRequestId;
|
|
77
|
+
if (!props.search || !term) {
|
|
78
|
+
rawSearchResults.value = [];
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const results = await props.search(term, {
|
|
83
|
+
limit: fuse.value.resultLimit,
|
|
84
|
+
snippet: { columns: ["title", "content"], around: 20 }
|
|
85
|
+
});
|
|
86
|
+
if (requestId !== searchRequestId) return;
|
|
87
|
+
rawSearchResults.value = results;
|
|
88
|
+
} catch (err) {
|
|
89
|
+
if (requestId !== searchRequestId) return;
|
|
90
|
+
console.error("[ContentSearch] search failed:", err);
|
|
91
|
+
rawSearchResults.value = [];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
watch(debouncedSearchTerm, runSearch);
|
|
95
|
+
watch(() => props.search, () => {
|
|
96
|
+
if (debouncedSearchTerm.value) {
|
|
97
|
+
runSearch(debouncedSearchTerm.value);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
watch(() => props.searchStatus, (status) => {
|
|
101
|
+
if (status === "ready" && debouncedSearchTerm.value) {
|
|
102
|
+
runSearch(debouncedSearchTerm.value);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const linksGroup = computed(() => {
|
|
68
106
|
if (!props.links?.length) {
|
|
69
|
-
return
|
|
107
|
+
return null;
|
|
70
108
|
}
|
|
71
|
-
return props.links
|
|
72
|
-
...link,
|
|
73
|
-
suffix: link.description,
|
|
74
|
-
description: void 0,
|
|
75
|
-
icon: link.icon || appConfig.ui.icons.file,
|
|
76
|
-
children: void 0
|
|
77
|
-
}, ...link.children?.map((child) => ({
|
|
78
|
-
...child,
|
|
79
|
-
prefix: link.label + " >",
|
|
80
|
-
suffix: child.description,
|
|
81
|
-
description: void 0,
|
|
82
|
-
icon: child.icon || link.icon || appConfig.ui.icons.file
|
|
83
|
-
})) || []]);
|
|
109
|
+
return { id: "links", label: t("contentSearch.links"), items: mapLinks(props.links) };
|
|
84
110
|
});
|
|
85
|
-
const
|
|
111
|
+
const searchGroups = computed(() => {
|
|
112
|
+
if (!searchTerm.value || !searchResults.value.length) return [];
|
|
113
|
+
return [{ id: "search", label: t("contentSearch.search"), items: searchResults.value, ignoreFilter: true }];
|
|
114
|
+
});
|
|
115
|
+
const navigationGroups = computed(() => {
|
|
86
116
|
if (!props.navigation?.length) {
|
|
87
117
|
return [];
|
|
88
118
|
}
|
|
@@ -130,10 +160,14 @@ const themeGroup = computed(() => {
|
|
|
130
160
|
});
|
|
131
161
|
const groups = computed(() => {
|
|
132
162
|
const groups2 = [];
|
|
133
|
-
if (
|
|
134
|
-
groups2.push(
|
|
163
|
+
if (linksGroup.value) {
|
|
164
|
+
groups2.push(linksGroup.value);
|
|
165
|
+
}
|
|
166
|
+
if (props.search) {
|
|
167
|
+
groups2.push(...searchGroups.value);
|
|
168
|
+
} else {
|
|
169
|
+
groups2.push(...navigationGroups.value);
|
|
135
170
|
}
|
|
136
|
-
groups2.push(...mappedNavigationGroups.value);
|
|
137
171
|
groups2.push(...props.groups || []);
|
|
138
172
|
if (themeGroup.value) {
|
|
139
173
|
groups2.push(themeGroup.value);
|
|
@@ -161,11 +195,11 @@ defineExpose({
|
|
|
161
195
|
<template>
|
|
162
196
|
<UModal
|
|
163
197
|
v-model:open="open"
|
|
164
|
-
:title="title || t('contentSearch.title')"
|
|
165
|
-
:description="description || t('contentSearch.description')"
|
|
198
|
+
:title="props.title || t('contentSearch.title')"
|
|
199
|
+
:description="props.description || t('contentSearch.description')"
|
|
166
200
|
v-bind="modalProps"
|
|
167
201
|
data-slot="modal"
|
|
168
|
-
:class="ui.modal({ class: [
|
|
202
|
+
:class="ui.modal({ class: [props.ui?.modal, props.class] })"
|
|
169
203
|
>
|
|
170
204
|
<template #content="contentData">
|
|
171
205
|
<slot name="content" v-bind="contentData">
|
|
@@ -176,7 +210,7 @@ defineExpose({
|
|
|
176
210
|
:groups="groups"
|
|
177
211
|
:fuse="fuse"
|
|
178
212
|
:input="{ fixed: true }"
|
|
179
|
-
:ui="transformUI(omit(ui, ['modal']),
|
|
213
|
+
:ui="transformUI(omit(ui, ['modal']), props.ui)"
|
|
180
214
|
@update:model-value="onSelect"
|
|
181
215
|
@update:open="open = $event"
|
|
182
216
|
>
|
|
@@ -22,6 +22,21 @@ export interface ContentSearchFile {
|
|
|
22
22
|
level: number;
|
|
23
23
|
content: string;
|
|
24
24
|
}
|
|
25
|
+
export interface ContentSearchResult extends ContentSearchFile {
|
|
26
|
+
snippets?: {
|
|
27
|
+
title?: string;
|
|
28
|
+
content?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ContentSearchOptions {
|
|
32
|
+
limit?: number;
|
|
33
|
+
snippet?: {
|
|
34
|
+
columns?: ('title' | 'content')[];
|
|
35
|
+
around?: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type ContentSearchStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
39
|
+
export type ContentSearchFn = (query: string, opts?: ContentSearchOptions) => Promise<ContentSearchResult[]>;
|
|
25
40
|
export interface ContentSearchItem extends Omit<LinkProps, 'custom'>, CommandPaletteItem {
|
|
26
41
|
level?: number;
|
|
27
42
|
/**
|
|
@@ -56,8 +71,9 @@ export interface ContentSearchProps<T extends ContentSearchLink = ContentSearchL
|
|
|
56
71
|
fuseOptions: {
|
|
57
72
|
ignoreLocation: true,
|
|
58
73
|
includeMatches: true,
|
|
74
|
+
useTokenSearch: true,
|
|
59
75
|
threshold: 0.1,
|
|
60
|
-
keys: ['label', 'suffix']
|
|
76
|
+
keys: ['label', 'description', 'suffix']
|
|
61
77
|
},
|
|
62
78
|
resultLimit: 12,
|
|
63
79
|
matchAllWhenSearchEmpty: true
|
|
@@ -65,8 +81,19 @@ export interface ContentSearchProps<T extends ContentSearchLink = ContentSearchL
|
|
|
65
81
|
*/
|
|
66
82
|
fuse?: UseFuseOptions<T>;
|
|
67
83
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
84
|
+
* Async search function (e.g. from [`useSearchCollection`](https://content.nuxt.com/docs/utils/use-search-collection)).
|
|
85
|
+
* When provided, ContentSearch calls it on each keystroke and uses the results instead of Fuse.
|
|
86
|
+
* Results are mapped, sanitized, and grouped by navigation internally.
|
|
87
|
+
*/
|
|
88
|
+
search?: ContentSearchFn;
|
|
89
|
+
/**
|
|
90
|
+
* Status of the async search index (e.g. from `useSearchCollection`).
|
|
91
|
+
* When the status transitions to `'ready'`, the search is automatically re-triggered if there's a pending term.
|
|
92
|
+
*/
|
|
93
|
+
searchStatus?: ContentSearchStatus;
|
|
94
|
+
/**
|
|
95
|
+
* Delay (in milliseconds) before the search is triggered (debounced).
|
|
96
|
+
* Keeps the input responsive by only running the search after typing settles.
|
|
70
97
|
* Set to `0` to disable.
|
|
71
98
|
* @defaultValue 100
|
|
72
99
|
*/
|
|
@@ -47,10 +47,10 @@ export interface ContentSearchButtonProps extends Omit<ButtonProps, LinkPropsKey
|
|
|
47
47
|
declare const _default: typeof __VLS_export;
|
|
48
48
|
export default _default;
|
|
49
49
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ContentSearchButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ContentSearchButtonProps> & Readonly<{}>, {
|
|
50
|
-
color: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
51
|
-
collapsed: boolean;
|
|
50
|
+
color: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
52
51
|
tooltip: boolean | TooltipProps;
|
|
53
52
|
kbds: KbdProps["value"][] | KbdProps[];
|
|
53
|
+
collapsed: boolean;
|
|
54
54
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
|
|
55
55
|
type __VLS_WithSlots<T, S> = T & {
|
|
56
56
|
new (): {
|
|
@@ -4,11 +4,11 @@ import theme from "#build/ui/content/content-search-button";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed, toRef } from "vue";
|
|
7
|
-
import { useForwardProps } from "reka-ui";
|
|
8
7
|
import { defu } from "defu";
|
|
9
8
|
import { reactiveOmit, createReusableTemplate } from "@vueuse/core";
|
|
10
9
|
import { useAppConfig } from "#imports";
|
|
11
|
-
import {
|
|
10
|
+
import { useComponentProps } from "../../composables/useComponentProps";
|
|
11
|
+
import { useForwardProps } from "../../composables/useForwardProps";
|
|
12
12
|
import { useContentSearch } from "../../composables/useContentSearch";
|
|
13
13
|
import { useLocale } from "../../composables/useLocale";
|
|
14
14
|
import { omit, transformUI } from "../../utils";
|
|
@@ -17,7 +17,7 @@ import UButton from "../Button.vue";
|
|
|
17
17
|
import UKbd from "../Kbd.vue";
|
|
18
18
|
import UTooltip from "../Tooltip.vue";
|
|
19
19
|
defineOptions({ inheritAttrs: false });
|
|
20
|
-
const
|
|
20
|
+
const _props = defineProps({
|
|
21
21
|
icon: { type: null, required: false },
|
|
22
22
|
label: { type: String, required: false },
|
|
23
23
|
color: { type: null, required: false, default: "neutral" },
|
|
@@ -48,6 +48,7 @@ const props = defineProps({
|
|
|
48
48
|
viewTransition: { type: Boolean, required: false }
|
|
49
49
|
});
|
|
50
50
|
const slots = defineSlots();
|
|
51
|
+
const props = useComponentProps("contentSearchButton", _props);
|
|
51
52
|
const [DefineButtonTemplate, ReuseButtonTemplate] = createReusableTemplate();
|
|
52
53
|
const getProxySlots = () => omit(slots, ["trailing"]);
|
|
53
54
|
const buttonProps = useForwardProps(reactiveOmit(props, "icon", "label", "variant", "collapsed", "tooltip", "kbds", "class", "ui"));
|
|
@@ -55,7 +56,6 @@ const tooltipProps = toRef(() => defu(typeof props.tooltip === "boolean" ? {} :
|
|
|
55
56
|
const { t } = useLocale();
|
|
56
57
|
const { open } = useContentSearch();
|
|
57
58
|
const appConfig = useAppConfig();
|
|
58
|
-
const uiProp = useComponentUI("contentSearchButton", props);
|
|
59
59
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentSearchButton || {} })({
|
|
60
60
|
collapsed: props.collapsed
|
|
61
61
|
}));
|
|
@@ -64,19 +64,19 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentSearch
|
|
|
64
64
|
<template>
|
|
65
65
|
<DefineButtonTemplate>
|
|
66
66
|
<UButton
|
|
67
|
-
:icon="icon || appConfig.ui.icons.search"
|
|
68
|
-
:label="label || t('contentSearchButton.label')"
|
|
69
|
-
:variant="variant || (collapsed ? 'ghost' : 'outline')"
|
|
67
|
+
:icon="props.icon || appConfig.ui.icons.search"
|
|
68
|
+
:label="props.label || t('contentSearchButton.label')"
|
|
69
|
+
:variant="props.variant || (props.collapsed ? 'ghost' : 'outline')"
|
|
70
70
|
v-bind="{
|
|
71
71
|
...buttonProps,
|
|
72
|
-
...collapsed ? {
|
|
72
|
+
...props.collapsed ? {
|
|
73
73
|
'square': true,
|
|
74
|
-
'aria-label': label || t('contentSearchButton.label')
|
|
74
|
+
'aria-label': props.label || t('contentSearchButton.label')
|
|
75
75
|
} : {},
|
|
76
76
|
...$attrs
|
|
77
77
|
}"
|
|
78
|
-
:class="ui.base({ class: [
|
|
79
|
-
:ui="transformUI(ui,
|
|
78
|
+
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
79
|
+
:ui="transformUI(ui, props.ui)"
|
|
80
80
|
@click="open = true"
|
|
81
81
|
>
|
|
82
82
|
<template v-for="(_, name) in getProxySlots()" #[name]="slotData">
|
|
@@ -84,10 +84,10 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentSearch
|
|
|
84
84
|
</template>
|
|
85
85
|
|
|
86
86
|
<template #trailing="{ ui: uiProxy }">
|
|
87
|
-
<div data-slot="trailing" :class="ui.trailing({ class:
|
|
87
|
+
<div data-slot="trailing" :class="ui.trailing({ class: props.ui?.trailing })">
|
|
88
88
|
<slot name="trailing" :ui="uiProxy">
|
|
89
|
-
<template v-if="kbds?.length">
|
|
90
|
-
<UKbd v-for="(kbd, index) in kbds" :key="index" variant="subtle" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
89
|
+
<template v-if="props.kbds?.length">
|
|
90
|
+
<UKbd v-for="(kbd, index) in props.kbds" :key="index" variant="subtle" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
91
91
|
</template>
|
|
92
92
|
</slot>
|
|
93
93
|
</div>
|
|
@@ -95,7 +95,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentSearch
|
|
|
95
95
|
</UButton>
|
|
96
96
|
</DefineButtonTemplate>
|
|
97
97
|
|
|
98
|
-
<UTooltip v-if="collapsed && tooltip" :text="label || t('contentSearchButton.label')" v-bind="tooltipProps">
|
|
98
|
+
<UTooltip v-if="props.collapsed && props.tooltip" :text="props.label || t('contentSearchButton.label')" v-bind="tooltipProps">
|
|
99
99
|
<ReuseButtonTemplate />
|
|
100
100
|
</UTooltip>
|
|
101
101
|
<ReuseButtonTemplate v-else />
|
|
@@ -47,10 +47,10 @@ export interface ContentSearchButtonProps extends Omit<ButtonProps, LinkPropsKey
|
|
|
47
47
|
declare const _default: typeof __VLS_export;
|
|
48
48
|
export default _default;
|
|
49
49
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ContentSearchButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ContentSearchButtonProps> & Readonly<{}>, {
|
|
50
|
-
color: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
51
|
-
collapsed: boolean;
|
|
50
|
+
color: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
52
51
|
tooltip: boolean | TooltipProps;
|
|
53
52
|
kbds: KbdProps["value"][] | KbdProps[];
|
|
53
|
+
collapsed: boolean;
|
|
54
54
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
|
|
55
55
|
type __VLS_WithSlots<T, S> = T & {
|
|
56
56
|
new (): {
|
|
@@ -7,13 +7,14 @@ import { computed } from "vue";
|
|
|
7
7
|
import { Primitive } from "reka-ui";
|
|
8
8
|
import { createReusableTemplate } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
10
|
-
import {
|
|
10
|
+
import { useComponentProps } from "../../composables/useComponentProps";
|
|
11
11
|
import { useLocale } from "../../composables/useLocale";
|
|
12
|
+
import { usePrefix } from "../../composables/usePrefix";
|
|
12
13
|
import { tv } from "../../utils/tv";
|
|
13
14
|
import ULink from "../Link.vue";
|
|
14
15
|
import UIcon from "../Icon.vue";
|
|
15
16
|
defineOptions({ inheritAttrs: false });
|
|
16
|
-
const
|
|
17
|
+
const _props = defineProps({
|
|
17
18
|
as: { type: null, required: false },
|
|
18
19
|
prevIcon: { type: null, required: false },
|
|
19
20
|
nextIcon: { type: null, required: false },
|
|
@@ -22,9 +23,10 @@ const props = defineProps({
|
|
|
22
23
|
ui: { type: Object, required: false }
|
|
23
24
|
});
|
|
24
25
|
defineSlots();
|
|
26
|
+
const props = useComponentProps("contentSurround", _props);
|
|
25
27
|
const { dir } = useLocale();
|
|
26
28
|
const appConfig = useAppConfig();
|
|
27
|
-
const
|
|
29
|
+
const prefix = usePrefix();
|
|
28
30
|
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate({
|
|
29
31
|
props: {
|
|
30
32
|
link: Object,
|
|
@@ -39,32 +41,32 @@ const nextIcon = computed(() => props.nextIcon || (dir.value === "rtl" ? appConf
|
|
|
39
41
|
|
|
40
42
|
<template>
|
|
41
43
|
<DefineLinkTemplate v-slot="{ link, icon, direction }">
|
|
42
|
-
<ULink v-if="link" :to="link.path" raw data-slot="link" :class="ui.link({ class: [
|
|
44
|
+
<ULink v-if="link" :to="link.path" raw data-slot="link" :class="ui.link({ class: [props.ui?.link, link.ui?.link, link.class], direction })">
|
|
43
45
|
<slot name="link" :link="link" :ui="ui">
|
|
44
|
-
<div data-slot="linkLeading" :class="ui.linkLeading({ class: [
|
|
46
|
+
<div data-slot="linkLeading" :class="ui.linkLeading({ class: [props.ui?.linkLeading, link.ui?.linkLeading] })">
|
|
45
47
|
<slot name="link-leading" :link="link" :ui="ui">
|
|
46
|
-
<UIcon :name="link.icon || icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [
|
|
48
|
+
<UIcon :name="link.icon || icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, link.ui?.linkLeadingIcon], direction })" />
|
|
47
49
|
</slot>
|
|
48
50
|
</div>
|
|
49
51
|
|
|
50
|
-
<p data-slot="linkTitle" :class="ui.linkTitle({ class: [
|
|
52
|
+
<p data-slot="linkTitle" :class="ui.linkTitle({ class: [props.ui?.linkTitle, link.ui?.linkTitle] })">
|
|
51
53
|
<slot name="link-title" :link="link" :ui="ui">
|
|
52
54
|
{{ link.title }}
|
|
53
55
|
</slot>
|
|
54
56
|
</p>
|
|
55
57
|
|
|
56
|
-
<p data-slot="linkDescription" :class="ui.linkDescription({ class: [
|
|
58
|
+
<p data-slot="linkDescription" :class="ui.linkDescription({ class: [props.ui?.linkDescription, link.ui?.linkDescription] })">
|
|
57
59
|
<slot name="link-description" :link="link" :ui="ui">
|
|
58
60
|
{{ link.description }}
|
|
59
61
|
</slot>
|
|
60
62
|
</p>
|
|
61
63
|
</slot>
|
|
62
64
|
</ULink>
|
|
63
|
-
<span v-else class="hidden sm:block"> </span>
|
|
65
|
+
<span v-else :class="prefix('hidden sm:block')"> </span>
|
|
64
66
|
</DefineLinkTemplate>
|
|
65
67
|
|
|
66
|
-
<Primitive v-if="surround" :as="as" v-bind="$attrs" data-slot="root" :class="ui.root({ class: [
|
|
67
|
-
<ReuseLinkTemplate :link="surround[0]" :icon="prevIcon" direction="left" />
|
|
68
|
-
<ReuseLinkTemplate :link="surround[1]" :icon="nextIcon" direction="right" />
|
|
68
|
+
<Primitive v-if="props.surround" :as="props.as" v-bind="$attrs" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
69
|
+
<ReuseLinkTemplate :link="props.surround[0]" :icon="prevIcon" direction="left" />
|
|
70
|
+
<ReuseLinkTemplate :link="props.surround[1]" :icon="nextIcon" direction="right" />
|
|
69
71
|
</Primitive>
|
|
70
72
|
</template>
|