@nuxt/ui 4.7.1 → 4.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/{ui.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 +16 -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 +25 -12
- 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 +9 -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 +6 -5
- package/dist/runtime/components/Form.vue.d.ts +1 -1
- package/dist/runtime/components/FormField.d.vue.ts +1 -0
- package/dist/runtime/components/FormField.vue +21 -21
- package/dist/runtime/components/FormField.vue.d.ts +1 -0
- package/dist/runtime/components/Header.vue +19 -19
- package/dist/runtime/components/Icon.vue +2 -1
- 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 +2 -2
- package/dist/runtime/components/Link.vue.d.ts +2 -2
- package/dist/runtime/components/LinkBase.d.vue.ts +1 -1
- package/dist/runtime/components/LinkBase.vue.d.ts +1 -1
- 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 +31 -4
- package/dist/runtime/components/content/ContentSearch.vue +78 -33
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +31 -4
- 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 +12 -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 +7 -6
- 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/types/tv.d.ts +13 -7
- package/dist/runtime/types/utils.d.ts +3 -0
- package/dist/runtime/utils/dashboard.d.ts +1 -1
- 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 +2 -2
- package/dist/runtime/vue/overrides/inertia/Link.vue +5 -0
- package/dist/runtime/vue/overrides/inertia/Link.vue.d.ts +2 -2
- package/dist/runtime/vue/overrides/inertia/LinkBase.d.vue.ts +1 -1
- package/dist/runtime/vue/overrides/inertia/LinkBase.vue.d.ts +1 -1
- package/dist/runtime/vue/overrides/none/Link.d.vue.ts +2 -2
- package/dist/runtime/vue/overrides/none/Link.vue.d.ts +2 -2
- package/dist/runtime/vue/overrides/vue-router/Link.d.vue.ts +2 -2
- package/dist/runtime/vue/overrides/vue-router/Link.vue.d.ts +2 -2
- package/dist/shared/{ui.C6mn7iap.mjs → ui.BzjkAvk7.mjs} +244 -78
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +46 -53
- 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,18 +6,19 @@ import theme from "#build/ui/chat-message";
|
|
|
6
6
|
import { computed } from "vue";
|
|
7
7
|
import { Primitive } from "reka-ui";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
|
-
import {
|
|
9
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
10
10
|
import { omit } from "../utils";
|
|
11
11
|
import { tv } from "../utils/tv";
|
|
12
12
|
import UButton from "./Button.vue";
|
|
13
13
|
import UTooltip from "./Tooltip.vue";
|
|
14
14
|
import UAvatar from "./Avatar.vue";
|
|
15
15
|
import UIcon from "./Icon.vue";
|
|
16
|
-
const
|
|
16
|
+
const _props = defineProps({
|
|
17
17
|
as: { type: null, required: false, default: "article" },
|
|
18
18
|
icon: { type: null, required: false },
|
|
19
19
|
avatar: { type: Object, required: false },
|
|
20
20
|
variant: { type: null, required: false },
|
|
21
|
+
color: { type: null, required: false },
|
|
21
22
|
side: { type: null, required: false },
|
|
22
23
|
actions: { type: Array, required: false },
|
|
23
24
|
compact: { type: Boolean, required: false },
|
|
@@ -30,13 +31,14 @@ const props = defineProps({
|
|
|
30
31
|
parts: { type: Array, required: true }
|
|
31
32
|
});
|
|
32
33
|
const slots = defineSlots();
|
|
34
|
+
const props = useComponentProps("chatMessage", _props);
|
|
33
35
|
const appConfig = useAppConfig();
|
|
34
|
-
const uiProp = useComponentUI("chatMessage", props);
|
|
35
36
|
const fileParts = computed(() => props.parts?.filter((part) => part.type === "file") ?? []);
|
|
36
37
|
const textParts = computed(() => props.parts?.filter((part) => part.type === "text") ?? []);
|
|
37
|
-
const messageProps = computed(() => omit(props, ["as", "icon", "avatar", "variant", "side", "actions", "compact", "class", "ui", "content"]));
|
|
38
|
+
const messageProps = computed(() => omit(props, ["as", "icon", "avatar", "variant", "color", "side", "actions", "compact", "class", "ui", "content"]));
|
|
38
39
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatMessage || {} })({
|
|
39
40
|
variant: props.variant,
|
|
41
|
+
color: props.color,
|
|
40
42
|
side: props.side,
|
|
41
43
|
leading: !!props.icon || !!props.avatar || !!slots.leading,
|
|
42
44
|
actions: !!props.actions || !!slots.actions,
|
|
@@ -45,44 +47,52 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatMessage |
|
|
|
45
47
|
</script>
|
|
46
48
|
|
|
47
49
|
<template>
|
|
48
|
-
<Primitive :as="as" :data-role="role" data-slot="root" :class="ui.root({ class: [
|
|
49
|
-
<div v-if="!!slots.files && fileParts.length" data-slot="
|
|
50
|
-
<slot name="
|
|
50
|
+
<Primitive :as="props.as" :data-role="props.role" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
51
|
+
<div v-if="!!slots.files && fileParts.length || !!slots.header" data-slot="header" :class="ui.header({ class: props.ui?.header })">
|
|
52
|
+
<slot name="header" v-bind="{ ...messageProps }">
|
|
53
|
+
<div v-if="!!slots.files && fileParts.length" data-slot="files" :class="ui.files({ class: props.ui?.files })">
|
|
54
|
+
<slot name="files" v-bind="{ ...messageProps, parts: fileParts }" />
|
|
55
|
+
</div>
|
|
56
|
+
</slot>
|
|
51
57
|
</div>
|
|
52
58
|
|
|
53
|
-
<div data-slot="container" :class="ui.container({ class:
|
|
54
|
-
<div v-if="icon || avatar || !!slots.leading" data-slot="leading" :class="ui.leading({ class:
|
|
55
|
-
<slot name="leading" v-bind="{ ...messageProps, avatar, ui }">
|
|
56
|
-
<UIcon v-if="icon" :name="icon" data-slot="leadingIcon" :class="ui.leadingIcon({ class:
|
|
57
|
-
<UAvatar v-else-if="avatar" :size="
|
|
59
|
+
<div data-slot="container" :class="ui.container({ class: props.ui?.container })">
|
|
60
|
+
<div v-if="props.icon || props.avatar || !!slots.leading" data-slot="leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
61
|
+
<slot name="leading" v-bind="{ ...messageProps, avatar: props.avatar, ui }">
|
|
62
|
+
<UIcon v-if="props.icon" :name="props.icon" data-slot="leadingIcon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
63
|
+
<UAvatar v-else-if="props.avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="props.avatar" data-slot="leadingAvatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
58
64
|
</slot>
|
|
59
65
|
</div>
|
|
60
66
|
|
|
61
|
-
<div v-if="content || textParts.length || !!slots.content" data-slot="
|
|
62
|
-
<slot name="
|
|
63
|
-
<
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
<div v-if="props.content || textParts.length || !!slots.content || props.actions || !!slots.actions || !!slots.body" data-slot="body" :class="ui.body({ class: props.ui?.body })">
|
|
68
|
+
<slot name="body" v-bind="{ ...messageProps }">
|
|
69
|
+
<div v-if="props.content || textParts.length || !!slots.content" data-slot="content" :class="ui.content({ class: props.ui?.content })">
|
|
70
|
+
<slot name="content" v-bind="{ ...messageProps, content: props.content }">
|
|
71
|
+
<template v-if="props.content">
|
|
72
|
+
{{ props.content }}
|
|
73
|
+
</template>
|
|
74
|
+
<template v-else>
|
|
75
|
+
<template v-for="(part, index) in textParts" :key="`${props.id}-${part.type}-${index}`">
|
|
76
|
+
{{ part.text }}
|
|
77
|
+
</template>
|
|
78
|
+
</template>
|
|
79
|
+
</slot>
|
|
80
|
+
</div>
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
<div v-if="props.actions || !!slots.actions" data-slot="actions" :class="ui.actions({ class: props.ui?.actions })">
|
|
83
|
+
<slot name="actions" v-bind="{ ...messageProps, actions: props.actions }">
|
|
84
|
+
<UTooltip v-for="(action, index) in props.actions" :key="index" :text="action.label">
|
|
85
|
+
<UButton
|
|
86
|
+
size="sm"
|
|
87
|
+
color="neutral"
|
|
88
|
+
variant="ghost"
|
|
89
|
+
v-bind="omit(action, ['onClick'])"
|
|
90
|
+
:label="undefined"
|
|
91
|
+
@click="typeof action.onClick === 'function' ? action.onClick($event, messageProps) : void 0"
|
|
92
|
+
/>
|
|
93
|
+
</UTooltip>
|
|
94
|
+
</slot>
|
|
95
|
+
</div>
|
|
86
96
|
</slot>
|
|
87
97
|
</div>
|
|
88
98
|
</div>
|
|
@@ -22,6 +22,10 @@ export interface ChatMessageProps<TMetadata = unknown, TDataParts extends UIData
|
|
|
22
22
|
* @defaultValue 'naked'
|
|
23
23
|
*/
|
|
24
24
|
variant?: ChatMessage['variants']['variant'];
|
|
25
|
+
/**
|
|
26
|
+
* @defaultValue 'neutral'
|
|
27
|
+
*/
|
|
28
|
+
color?: ChatMessage['variants']['color'];
|
|
25
29
|
/**
|
|
26
30
|
* @defaultValue 'left'
|
|
27
31
|
*/
|
|
@@ -49,6 +53,7 @@ export interface ChatMessageProps<TMetadata = unknown, TDataParts extends UIData
|
|
|
49
53
|
ui?: ChatMessage['slots'];
|
|
50
54
|
}
|
|
51
55
|
export interface ChatMessageSlots<TMetadata = unknown, TDataParts extends UIDataTypes = UIDataTypes, TTools extends UITools = UITools> {
|
|
56
|
+
header?(props: UIMessage<TMetadata, TDataParts, TTools>): VNode[];
|
|
52
57
|
leading?(props: UIMessage<TMetadata, TDataParts, TTools> & {
|
|
53
58
|
avatar: ChatMessageProps<TMetadata, TDataParts, TTools>['avatar'];
|
|
54
59
|
ui: ChatMessage['ui'];
|
|
@@ -56,6 +61,7 @@ export interface ChatMessageSlots<TMetadata = unknown, TDataParts extends UIData
|
|
|
56
61
|
files?(props: Omit<UIMessage<TMetadata, TDataParts, TTools>, 'parts'> & {
|
|
57
62
|
parts: FileUIPart[];
|
|
58
63
|
}): VNode[];
|
|
64
|
+
body?(props: UIMessage<TMetadata, TDataParts, TTools>): VNode[];
|
|
59
65
|
content?(props: UIMessage<TMetadata, TDataParts, TTools> & {
|
|
60
66
|
content?: string;
|
|
61
67
|
}): VNode[];
|
|
@@ -8,12 +8,12 @@ import { Presence } from "reka-ui";
|
|
|
8
8
|
import { defu } from "defu";
|
|
9
9
|
import { useElementBounding, useEventListener, useMutationObserver, watchThrottled } from "@vueuse/core";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
|
-
import {
|
|
11
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
12
12
|
import { omit } from "../utils";
|
|
13
13
|
import { tv } from "../utils/tv";
|
|
14
14
|
import UChatMessage from "./ChatMessage.vue";
|
|
15
15
|
import UButton from "./Button.vue";
|
|
16
|
-
const
|
|
16
|
+
const _props = defineProps({
|
|
17
17
|
messages: { type: null, required: false },
|
|
18
18
|
status: { type: String, required: false },
|
|
19
19
|
shouldAutoScroll: { type: Boolean, required: false, default: false },
|
|
@@ -28,6 +28,7 @@ const props = defineProps({
|
|
|
28
28
|
ui: { type: Object, required: false }
|
|
29
29
|
});
|
|
30
30
|
const slots = defineSlots();
|
|
31
|
+
const props = useComponentProps("chatMessages", _props);
|
|
31
32
|
const getProxySlots = () => omit(slots, ["default", "indicator", "viewport"]);
|
|
32
33
|
const showIndicator = computed(() => {
|
|
33
34
|
if (props.status === "submitted") return true;
|
|
@@ -36,7 +37,6 @@ const showIndicator = computed(() => {
|
|
|
36
37
|
return lastMessage?.role === "assistant" && !lastMessage.parts?.length;
|
|
37
38
|
});
|
|
38
39
|
const appConfig = useAppConfig();
|
|
39
|
-
const uiProp = useComponentUI("chatMessages", props);
|
|
40
40
|
const userProps = toRef(() => defu(props.user, { side: "right", variant: "soft" }));
|
|
41
41
|
const assistantProps = toRef(() => defu(props.assistant, { side: "left", variant: "naked" }));
|
|
42
42
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatMessages || {} })({
|
|
@@ -188,18 +188,18 @@ onMounted(() => {
|
|
|
188
188
|
<template>
|
|
189
189
|
<div
|
|
190
190
|
ref="el"
|
|
191
|
-
:data-status="status"
|
|
191
|
+
:data-status="props.status"
|
|
192
192
|
data-slot="root"
|
|
193
|
-
:class="ui.root({ class: [
|
|
193
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
194
194
|
:style="{ '--last-message-height': `${lastMessageHeight}px` }"
|
|
195
195
|
>
|
|
196
196
|
<slot>
|
|
197
|
-
<template v-for="message in messages" :key="message.id">
|
|
197
|
+
<template v-for="message in props.messages" :key="message.id">
|
|
198
198
|
<UChatMessage
|
|
199
199
|
v-if="message.parts?.length"
|
|
200
200
|
v-bind="{ ...message.role === 'user' ? userProps : assistantProps, ...message }"
|
|
201
201
|
:ref="(el) => registerMessageRef(message.id, el)"
|
|
202
|
-
:compact="compact"
|
|
202
|
+
:compact="props.compact"
|
|
203
203
|
>
|
|
204
204
|
<template v-for="(_, name) in getProxySlots()" #[name]="slotData">
|
|
205
205
|
<slot :name="name" v-bind="{ ...slotData, message }" />
|
|
@@ -213,11 +213,11 @@ onMounted(() => {
|
|
|
213
213
|
id="indicator"
|
|
214
214
|
role="assistant"
|
|
215
215
|
v-bind="{ ...assistantProps, actions: void 0, parts: [] }"
|
|
216
|
-
:compact="compact"
|
|
216
|
+
:compact="props.compact"
|
|
217
217
|
>
|
|
218
218
|
<template #content>
|
|
219
219
|
<slot name="indicator" :ui="ui">
|
|
220
|
-
<div data-slot="indicator" :class="ui.indicator({ class:
|
|
220
|
+
<div data-slot="indicator" :class="ui.indicator({ class: props.ui?.indicator })">
|
|
221
221
|
<span />
|
|
222
222
|
<span />
|
|
223
223
|
<span />
|
|
@@ -227,16 +227,16 @@ onMounted(() => {
|
|
|
227
227
|
</UChatMessage>
|
|
228
228
|
|
|
229
229
|
<Presence :present="showAutoScroll">
|
|
230
|
-
<div :data-state="showAutoScroll ? 'open' : 'closed'" data-slot="viewport" :class="ui.viewport({ class:
|
|
230
|
+
<div :data-state="showAutoScroll ? 'open' : 'closed'" data-slot="viewport" :class="ui.viewport({ class: props.ui?.viewport })">
|
|
231
231
|
<slot name="viewport" :ui="ui" :on-click="onAutoScrollClick">
|
|
232
232
|
<UButton
|
|
233
|
-
v-if="autoScroll"
|
|
234
|
-
:icon="autoScrollIcon || appConfig.ui.icons.arrowDown"
|
|
233
|
+
v-if="props.autoScroll"
|
|
234
|
+
:icon="props.autoScrollIcon || appConfig.ui.icons.arrowDown"
|
|
235
235
|
color="neutral"
|
|
236
236
|
variant="outline"
|
|
237
|
-
v-bind="typeof autoScroll === 'object' ? autoScroll : {}"
|
|
237
|
+
v-bind="typeof props.autoScroll === 'object' ? props.autoScroll : {}"
|
|
238
238
|
data-slot="autoScroll"
|
|
239
|
-
:class="ui.autoScroll({ class:
|
|
239
|
+
:class="ui.autoScroll({ class: props.ui?.autoScroll })"
|
|
240
240
|
@click="onAutoScrollClick"
|
|
241
241
|
/>
|
|
242
242
|
</slot>
|
|
@@ -6,28 +6,28 @@ import theme from "#build/ui/chat-palette";
|
|
|
6
6
|
import { computed } from "vue";
|
|
7
7
|
import { Primitive, Slot } from "reka-ui";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
|
-
import {
|
|
9
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
10
10
|
import { tv } from "../utils/tv";
|
|
11
|
-
const
|
|
11
|
+
const _props = defineProps({
|
|
12
12
|
as: { type: null, required: false },
|
|
13
13
|
class: { type: null, required: false },
|
|
14
14
|
ui: { type: Object, required: false }
|
|
15
15
|
});
|
|
16
16
|
const slots = defineSlots();
|
|
17
|
+
const props = useComponentProps("chatPalette", _props);
|
|
17
18
|
const appConfig = useAppConfig();
|
|
18
|
-
const uiProp = useComponentUI("chatPalette", props);
|
|
19
19
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatPalette || {} })());
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
|
-
<Primitive :as="as" data-slot="root" :class="ui.root({ class: [
|
|
24
|
-
<div data-slot="content" :class="ui.content({ class:
|
|
23
|
+
<Primitive :as="props.as" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
24
|
+
<div data-slot="content" :class="ui.content({ class: props.ui?.content })">
|
|
25
25
|
<Slot compact>
|
|
26
26
|
<slot />
|
|
27
27
|
</Slot>
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
<Slot v-if="!!slots.prompt" data-slot="prompt" :class="ui.prompt({ class:
|
|
30
|
+
<Slot v-if="!!slots.prompt" data-slot="prompt" :class="ui.prompt({ class: props.ui?.prompt })">
|
|
31
31
|
<slot name="prompt" />
|
|
32
32
|
</Slot>
|
|
33
33
|
</Primitive>
|
|
@@ -19,6 +19,12 @@ export interface ChatPromptProps extends Pick<TextareaProps, 'rows' | 'autofocus
|
|
|
19
19
|
* @defaultValue 'outline'
|
|
20
20
|
*/
|
|
21
21
|
variant?: ChatPrompt['variants']['variant'];
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, pressing `Enter` submits and `Shift+Enter` inserts a newline.
|
|
24
|
+
* When `false`, pressing `Enter` inserts a newline and `Ctrl+Enter` / `Cmd+Enter` submits.
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
submitOnEnter?: boolean;
|
|
22
28
|
error?: Error;
|
|
23
29
|
class?: any;
|
|
24
30
|
ui?: ChatPrompt['slots'] & TextareaProps['ui'];
|
|
@@ -52,6 +58,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatPr
|
|
|
52
58
|
autofocus: boolean;
|
|
53
59
|
rows: number;
|
|
54
60
|
autoresize: boolean;
|
|
61
|
+
submitOnEnter: boolean;
|
|
55
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ChatPromptSlots>;
|
|
56
63
|
type __VLS_WithSlots<T, S> = T & {
|
|
57
64
|
new (): {
|
|
@@ -4,20 +4,22 @@ import theme from "#build/ui/chat-prompt";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed, toRef, useTemplateRef } from "vue";
|
|
7
|
-
import { Primitive
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
10
|
-
import {
|
|
10
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
11
|
+
import { useForwardProps } from "../composables/useForwardProps";
|
|
11
12
|
import { useIMEGuard } from "../composables/useIMEGuard";
|
|
12
13
|
import { useLocale } from "../composables/useLocale";
|
|
13
14
|
import { omit, transformUI } from "../utils";
|
|
14
15
|
import { tv } from "../utils/tv";
|
|
15
16
|
import UTextarea from "./Textarea.vue";
|
|
16
17
|
defineOptions({ inheritAttrs: false });
|
|
17
|
-
const
|
|
18
|
+
const _props = defineProps({
|
|
18
19
|
as: { type: null, required: false, default: "form" },
|
|
19
20
|
placeholder: { type: String, required: false },
|
|
20
21
|
variant: { type: null, required: false },
|
|
22
|
+
submitOnEnter: { type: Boolean, required: false, default: true },
|
|
21
23
|
error: { type: Error, required: false },
|
|
22
24
|
class: { type: null, required: false },
|
|
23
25
|
ui: { type: Object, required: false },
|
|
@@ -35,10 +37,10 @@ const props = defineProps({
|
|
|
35
37
|
});
|
|
36
38
|
const emits = defineEmits(["submit", "close"]);
|
|
37
39
|
const slots = defineSlots();
|
|
40
|
+
const props = useComponentProps("chatPrompt", _props);
|
|
38
41
|
const model = defineModel({ type: String, ...{ default: "" } });
|
|
39
42
|
const { t } = useLocale();
|
|
40
43
|
const appConfig = useAppConfig();
|
|
41
|
-
const uiProp = useComponentUI("chatPrompt", props);
|
|
42
44
|
const textareaProps = useForwardProps(reactivePick(props, "rows", "autofocus", "autofocusDelay", "autoresize", "autoresizeDelay", "maxrows", "icon", "avatar", "loading", "loadingIcon"));
|
|
43
45
|
const getProxySlots = () => omit(slots, ["header", "footer"]);
|
|
44
46
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatPrompt || {} })({
|
|
@@ -58,29 +60,37 @@ function blur(e) {
|
|
|
58
60
|
const { onKeydown: onEnter, onCompositionEnd } = useIMEGuard((event) => {
|
|
59
61
|
submit(event);
|
|
60
62
|
});
|
|
63
|
+
function handleEnter(event) {
|
|
64
|
+
if (props.submitOnEnter) {
|
|
65
|
+
if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) return;
|
|
66
|
+
} else {
|
|
67
|
+
if (!event.ctrlKey && !event.metaKey) return;
|
|
68
|
+
}
|
|
69
|
+
onEnter(event);
|
|
70
|
+
}
|
|
61
71
|
defineExpose({
|
|
62
72
|
textareaRef: toRef(() => textareaRef.value?.textareaRef)
|
|
63
73
|
});
|
|
64
74
|
</script>
|
|
65
75
|
|
|
66
76
|
<template>
|
|
67
|
-
<Primitive :as="as" data-slot="root" :class="ui.root({ class: [
|
|
68
|
-
<div v-if="!!slots.header" data-slot="header" :class="ui.header({ class:
|
|
77
|
+
<Primitive :as="props.as" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })" @submit.prevent="submit">
|
|
78
|
+
<div v-if="!!slots.header" data-slot="header" :class="ui.header({ class: props.ui?.header })">
|
|
69
79
|
<slot name="header" />
|
|
70
80
|
</div>
|
|
71
81
|
|
|
72
82
|
<UTextarea
|
|
73
83
|
ref="textareaRef"
|
|
74
84
|
v-model="model"
|
|
75
|
-
:placeholder="placeholder
|
|
76
|
-
:disabled="Boolean(error) || disabled"
|
|
85
|
+
:placeholder="props.placeholder ?? t('chatPrompt.placeholder')"
|
|
86
|
+
:disabled="Boolean(props.error) || props.disabled"
|
|
77
87
|
variant="none"
|
|
78
88
|
fixed
|
|
79
89
|
v-bind="{ ...textareaProps, ...$attrs }"
|
|
80
|
-
:ui="transformUI(omit(ui, ['root', 'body', 'header', 'footer']),
|
|
90
|
+
:ui="transformUI(omit(ui, ['root', 'body', 'header', 'footer']), props.ui)"
|
|
81
91
|
data-slot="body"
|
|
82
|
-
:class="ui.body({ class:
|
|
83
|
-
@keydown.enter
|
|
92
|
+
:class="ui.body({ class: props.ui?.body })"
|
|
93
|
+
@keydown.enter="handleEnter"
|
|
84
94
|
@compositionend="onCompositionEnd"
|
|
85
95
|
@keydown.esc="blur"
|
|
86
96
|
>
|
|
@@ -89,7 +99,7 @@ defineExpose({
|
|
|
89
99
|
</template>
|
|
90
100
|
</UTextarea>
|
|
91
101
|
|
|
92
|
-
<div v-if="!!slots.footer" data-slot="footer" :class="ui.footer({ class:
|
|
102
|
+
<div v-if="!!slots.footer" data-slot="footer" :class="ui.footer({ class: props.ui?.footer })">
|
|
93
103
|
<slot name="footer" />
|
|
94
104
|
</div>
|
|
95
105
|
</Primitive>
|
|
@@ -19,6 +19,12 @@ export interface ChatPromptProps extends Pick<TextareaProps, 'rows' | 'autofocus
|
|
|
19
19
|
* @defaultValue 'outline'
|
|
20
20
|
*/
|
|
21
21
|
variant?: ChatPrompt['variants']['variant'];
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, pressing `Enter` submits and `Shift+Enter` inserts a newline.
|
|
24
|
+
* When `false`, pressing `Enter` inserts a newline and `Ctrl+Enter` / `Cmd+Enter` submits.
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
submitOnEnter?: boolean;
|
|
22
28
|
error?: Error;
|
|
23
29
|
class?: any;
|
|
24
30
|
ui?: ChatPrompt['slots'] & TextareaProps['ui'];
|
|
@@ -52,6 +58,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatPr
|
|
|
52
58
|
autofocus: boolean;
|
|
53
59
|
rows: number;
|
|
54
60
|
autoresize: boolean;
|
|
61
|
+
submitOnEnter: boolean;
|
|
55
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ChatPromptSlots>;
|
|
56
63
|
type __VLS_WithSlots<T, S> = T & {
|
|
57
64
|
new (): {
|
|
@@ -87,11 +87,11 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatPr
|
|
|
87
87
|
onReload?: ((event: MouseEvent) => any) | undefined;
|
|
88
88
|
}>, {
|
|
89
89
|
status: ChatStatus;
|
|
90
|
-
streamingColor: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
90
|
+
streamingColor: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
91
91
|
streamingVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
92
|
-
submittedColor: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
92
|
+
submittedColor: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
93
93
|
submittedVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
94
|
-
errorColor: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
94
|
+
errorColor: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
95
95
|
errorVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
|
|
97
97
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -4,16 +4,16 @@ import theme from "#build/ui/chat-prompt-submit";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
|
-
import { useForwardProps } from "reka-ui";
|
|
8
7
|
import { reactiveOmit } from "@vueuse/core";
|
|
9
8
|
import { useAppConfig } from "#imports";
|
|
10
|
-
import {
|
|
9
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
10
|
+
import { useForwardProps } from "../composables/useForwardProps";
|
|
11
11
|
import { useLocale } from "../composables/useLocale";
|
|
12
12
|
import { transformUI } from "../utils";
|
|
13
13
|
import { tv } from "../utils/tv";
|
|
14
14
|
import UButton from "./Button.vue";
|
|
15
15
|
defineOptions({ inheritAttrs: false });
|
|
16
|
-
const
|
|
16
|
+
const _props = defineProps({
|
|
17
17
|
status: { type: String, required: false, default: "ready" },
|
|
18
18
|
icon: { type: null, required: false },
|
|
19
19
|
color: { type: null, required: false },
|
|
@@ -52,9 +52,9 @@ const props = defineProps({
|
|
|
52
52
|
});
|
|
53
53
|
const emits = defineEmits(["stop", "reload"]);
|
|
54
54
|
const slots = defineSlots();
|
|
55
|
+
const props = useComponentProps("chatPromptSubmit", _props);
|
|
55
56
|
const { t } = useLocale();
|
|
56
57
|
const appConfig = useAppConfig();
|
|
57
|
-
const uiProp = useComponentUI("chatPromptSubmit", props);
|
|
58
58
|
const buttonProps = useForwardProps(reactiveOmit(props, "icon", "color", "variant", "status", "disabled", "streamingIcon", "streamingColor", "streamingVariant", "submittedIcon", "submittedColor", "submittedVariant", "errorIcon", "errorColor", "errorVariant", "class", "ui"));
|
|
59
59
|
const disabled = computed(() => props.status === "ready" ? props.disabled : false);
|
|
60
60
|
const statusButtonProps = computed(() => ({
|
|
@@ -101,8 +101,8 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatPromptSub
|
|
|
101
101
|
'aria-label': t('chatPromptSubmit.label'),
|
|
102
102
|
...$attrs
|
|
103
103
|
}"
|
|
104
|
-
:class="ui.base({ class: [
|
|
105
|
-
:ui="transformUI(ui,
|
|
104
|
+
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
105
|
+
:ui="transformUI(ui, props.ui)"
|
|
106
106
|
>
|
|
107
107
|
<template v-for="(_, name) in slots" #[name]="slotData">
|
|
108
108
|
<slot :name="name" v-bind="slotData" />
|
|
@@ -87,11 +87,11 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatPr
|
|
|
87
87
|
onReload?: ((event: MouseEvent) => any) | undefined;
|
|
88
88
|
}>, {
|
|
89
89
|
status: ChatStatus;
|
|
90
|
-
streamingColor: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
90
|
+
streamingColor: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
91
91
|
streamingVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
92
|
-
submittedColor: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
92
|
+
submittedColor: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
93
93
|
submittedVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
94
|
-
errorColor: "error" | "primary" | "secondary" | "success" | "info" | "warning"
|
|
94
|
+
errorColor: "error" | "neutral" | "primary" | "secondary" | "success" | "info" | "warning";
|
|
95
95
|
errorVariant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ButtonSlots>;
|
|
97
97
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -6,13 +6,13 @@ import theme from "#build/ui/chat-reasoning";
|
|
|
6
6
|
import { ref, computed, watch, onUnmounted, nextTick, useTemplateRef } from "vue";
|
|
7
7
|
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent } from "reka-ui";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
|
-
import {
|
|
9
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
10
10
|
import { useLocale } from "../composables/useLocale";
|
|
11
11
|
import { useScrollShadow } from "../composables/useScrollShadow";
|
|
12
12
|
import { tv } from "../utils/tv";
|
|
13
13
|
import UIcon from "./Icon.vue";
|
|
14
14
|
import UChatShimmer from "./ChatShimmer.vue";
|
|
15
|
-
const
|
|
15
|
+
const _props = defineProps({
|
|
16
16
|
text: { type: String, required: false },
|
|
17
17
|
streaming: { type: Boolean, required: false, default: false },
|
|
18
18
|
duration: { type: Number, required: false },
|
|
@@ -30,9 +30,9 @@ const props = defineProps({
|
|
|
30
30
|
});
|
|
31
31
|
const emits = defineEmits(["update:open"]);
|
|
32
32
|
defineSlots();
|
|
33
|
+
const props = useComponentProps("chatReasoning", _props);
|
|
33
34
|
const { t, code } = useLocale();
|
|
34
35
|
const appConfig = useAppConfig();
|
|
35
|
-
const uiProp = useComponentUI("chatReasoning", props);
|
|
36
36
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatReasoning || {} })({
|
|
37
37
|
chevron: props.chevron
|
|
38
38
|
}));
|
|
@@ -112,49 +112,49 @@ watch(() => props.text, () => {
|
|
|
112
112
|
v-if="hasContent"
|
|
113
113
|
v-slot="{ open: isOpen }"
|
|
114
114
|
:open="resolvedOpen"
|
|
115
|
-
:disabled="disabled"
|
|
116
|
-
:unmount-on-hide="unmountOnHide"
|
|
115
|
+
:disabled="props.disabled"
|
|
116
|
+
:unmount-on-hide="props.unmountOnHide"
|
|
117
117
|
data-slot="root"
|
|
118
|
-
:class="ui.root({ class: [
|
|
118
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
119
119
|
@update:open="setOpen"
|
|
120
120
|
>
|
|
121
121
|
<CollapsibleTrigger as-child :disabled="!hasContent">
|
|
122
122
|
<button
|
|
123
123
|
type="button"
|
|
124
124
|
data-slot="trigger"
|
|
125
|
-
:class="ui.trigger({ class:
|
|
125
|
+
:class="ui.trigger({ class: props.ui?.trigger })"
|
|
126
126
|
>
|
|
127
|
-
<span v-if="icon || hasContent && chevron === 'leading'" data-slot="leading" :class="ui.leading({ class:
|
|
127
|
+
<span v-if="props.icon || hasContent && props.chevron === 'leading'" data-slot="leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
128
128
|
<UIcon
|
|
129
|
-
v-if="icon"
|
|
130
|
-
:name="icon"
|
|
129
|
+
v-if="props.icon"
|
|
130
|
+
:name="props.icon"
|
|
131
131
|
data-slot="leadingIcon"
|
|
132
|
-
:class="ui.leadingIcon({ class:
|
|
132
|
+
:class="ui.leadingIcon({ class: props.ui?.leadingIcon, alone: !(hasContent && props.chevron === 'leading') })"
|
|
133
133
|
/>
|
|
134
134
|
<UIcon
|
|
135
|
-
v-if="hasContent && chevron === 'leading'"
|
|
135
|
+
v-if="hasContent && props.chevron === 'leading'"
|
|
136
136
|
:name="chevronIconName"
|
|
137
137
|
data-slot="chevronIcon"
|
|
138
|
-
:class="ui.chevronIcon({ class:
|
|
138
|
+
:class="ui.chevronIcon({ class: props.ui?.chevronIcon, alone: !props.icon })"
|
|
139
139
|
/>
|
|
140
140
|
</span>
|
|
141
141
|
|
|
142
|
-
<UChatShimmer v-if="streaming" :text="thinkingText" v-bind="props.shimmer" data-slot="label" :class="ui.label({ class:
|
|
143
|
-
<span v-else data-slot="label" :class="ui.label({ class:
|
|
142
|
+
<UChatShimmer v-if="props.streaming" :text="thinkingText" v-bind="props.shimmer" data-slot="label" :class="ui.label({ class: props.ui?.label })" />
|
|
143
|
+
<span v-else data-slot="label" :class="ui.label({ class: props.ui?.label })">{{ thinkingText }}</span>
|
|
144
144
|
|
|
145
145
|
<UIcon
|
|
146
|
-
v-if="hasContent && chevron === 'trailing'"
|
|
146
|
+
v-if="hasContent && props.chevron === 'trailing'"
|
|
147
147
|
:name="chevronIconName"
|
|
148
148
|
data-slot="trailingIcon"
|
|
149
|
-
:class="ui.trailingIcon({ class:
|
|
149
|
+
:class="ui.trailingIcon({ class: props.ui?.trailingIcon })"
|
|
150
150
|
/>
|
|
151
151
|
</button>
|
|
152
152
|
</CollapsibleTrigger>
|
|
153
153
|
|
|
154
|
-
<CollapsibleContent data-slot="content" :class="ui.content({ class:
|
|
155
|
-
<div ref="bodyRef" data-slot="body" :class="ui.body({ class:
|
|
154
|
+
<CollapsibleContent data-slot="content" :class="ui.content({ class: props.ui?.content })">
|
|
155
|
+
<div ref="bodyRef" data-slot="body" :class="ui.body({ class: props.ui?.body })" :style="scrollShadowStyle">
|
|
156
156
|
<slot :open="isOpen">
|
|
157
|
-
{{ text }}
|
|
157
|
+
{{ props.text }}
|
|
158
158
|
</slot>
|
|
159
159
|
</div>
|
|
160
160
|
</CollapsibleContent>
|
|
@@ -6,9 +6,9 @@ import theme from "#build/ui/chat-shimmer";
|
|
|
6
6
|
import { computed } from "vue";
|
|
7
7
|
import { Primitive } from "reka-ui";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
|
-
import {
|
|
9
|
+
import { useComponentProps } from "../composables/useComponentProps";
|
|
10
10
|
import { tv } from "../utils/tv";
|
|
11
|
-
const
|
|
11
|
+
const _props = defineProps({
|
|
12
12
|
as: { type: null, required: false, default: "span" },
|
|
13
13
|
text: { type: String, required: true },
|
|
14
14
|
duration: { type: Number, required: false, default: 2 },
|
|
@@ -16,22 +16,22 @@ const props = defineProps({
|
|
|
16
16
|
class: { type: null, required: false },
|
|
17
17
|
ui: { type: Object, required: false }
|
|
18
18
|
});
|
|
19
|
+
const props = useComponentProps("chatShimmer", _props);
|
|
19
20
|
const appConfig = useAppConfig();
|
|
20
|
-
const uiProp = useComponentUI("chatShimmer", props);
|
|
21
21
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatShimmer || {} }));
|
|
22
22
|
const spread = computed(() => props.text.length * props.spread);
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
26
|
<Primitive
|
|
27
|
-
:as="as"
|
|
27
|
+
:as="props.as"
|
|
28
28
|
:style="{
|
|
29
29
|
'--spread': `${spread}px`,
|
|
30
|
-
'--duration': `${duration}s`
|
|
30
|
+
'--duration': `${props.duration}s`
|
|
31
31
|
}"
|
|
32
32
|
data-slot="base"
|
|
33
|
-
:class="ui({ class: [
|
|
33
|
+
:class="ui({ class: [props.ui?.base, props.class] })"
|
|
34
34
|
>
|
|
35
|
-
{{ text }}
|
|
35
|
+
{{ props.text }}
|
|
36
36
|
</Primitive>
|
|
37
37
|
</template>
|
|
@@ -74,9 +74,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatTo
|
|
|
74
74
|
}, string, import("vue").PublicProps, Readonly<ChatToolProps> & Readonly<{
|
|
75
75
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
76
76
|
}>, {
|
|
77
|
+
open: boolean;
|
|
77
78
|
loading: boolean;
|
|
78
79
|
variant: ChatTool["variants"]["variant"];
|
|
79
|
-
open: boolean;
|
|
80
80
|
streaming: boolean;
|
|
81
81
|
unmountOnHide: boolean;
|
|
82
82
|
chevron: "leading" | "trailing";
|