@nuxt/ui 4.0.1 → 4.1.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.
Files changed (234) hide show
  1. package/.nuxt/ui/calendar.ts +221 -9
  2. package/.nuxt/ui/chat-message.ts +10 -3
  3. package/.nuxt/ui/command-palette.ts +12 -2
  4. package/.nuxt/ui/context-menu.ts +3 -1
  5. package/.nuxt/ui/dropdown-menu.ts +3 -1
  6. package/.nuxt/ui/empty.ts +83 -0
  7. package/.nuxt/ui/index.ts +1 -0
  8. package/.nuxt/ui/input-menu.ts +12 -2
  9. package/.nuxt/ui/input-number.ts +25 -14
  10. package/.nuxt/ui/kbd.ts +1 -1
  11. package/.nuxt/ui/prose/code-tree.ts +1 -1
  12. package/.nuxt/ui/prose/img.ts +2 -1
  13. package/.nuxt/ui/select-menu.ts +12 -2
  14. package/.nuxt/ui/select.ts +4 -2
  15. package/.nuxt/ui/table.ts +8 -2
  16. package/.nuxt/ui/tree.ts +25 -11
  17. package/cli/templates.mjs +14 -2
  18. package/dist/module.d.mts +15 -0
  19. package/dist/module.json +2 -2
  20. package/dist/module.mjs +5 -2
  21. package/dist/runtime/components/Accordion.d.vue.ts +7 -1
  22. package/dist/runtime/components/Accordion.vue +4 -4
  23. package/dist/runtime/components/Accordion.vue.d.ts +7 -1
  24. package/dist/runtime/components/Alert.d.vue.ts +4 -4
  25. package/dist/runtime/components/Alert.vue +1 -1
  26. package/dist/runtime/components/Alert.vue.d.ts +4 -4
  27. package/dist/runtime/components/AuthForm.d.vue.ts +3 -1
  28. package/dist/runtime/components/AuthForm.vue +1 -1
  29. package/dist/runtime/components/AuthForm.vue.d.ts +3 -1
  30. package/dist/runtime/components/Avatar.d.vue.ts +5 -4
  31. package/dist/runtime/components/Avatar.vue +10 -3
  32. package/dist/runtime/components/Avatar.vue.d.ts +5 -4
  33. package/dist/runtime/components/Badge.d.vue.ts +9 -3
  34. package/dist/runtime/components/Badge.vue +3 -3
  35. package/dist/runtime/components/Badge.vue.d.ts +9 -3
  36. package/dist/runtime/components/Banner.d.vue.ts +4 -2
  37. package/dist/runtime/components/Banner.vue +1 -1
  38. package/dist/runtime/components/Banner.vue.d.ts +4 -2
  39. package/dist/runtime/components/BlogPost.d.vue.ts +9 -3
  40. package/dist/runtime/components/BlogPost.vue +2 -2
  41. package/dist/runtime/components/BlogPost.vue.d.ts +9 -3
  42. package/dist/runtime/components/BlogPosts.d.vue.ts +22 -13
  43. package/dist/runtime/components/BlogPosts.vue +8 -2
  44. package/dist/runtime/components/BlogPosts.vue.d.ts +22 -13
  45. package/dist/runtime/components/Breadcrumb.d.vue.ts +19 -4
  46. package/dist/runtime/components/Breadcrumb.vue +8 -8
  47. package/dist/runtime/components/Breadcrumb.vue.d.ts +19 -4
  48. package/dist/runtime/components/Button.d.vue.ts +9 -3
  49. package/dist/runtime/components/Button.vue +3 -3
  50. package/dist/runtime/components/Button.vue.d.ts +9 -3
  51. package/dist/runtime/components/Calendar.d.vue.ts +4 -0
  52. package/dist/runtime/components/Calendar.vue +3 -1
  53. package/dist/runtime/components/Calendar.vue.d.ts +4 -0
  54. package/dist/runtime/components/ChangelogVersion.d.vue.ts +12 -4
  55. package/dist/runtime/components/ChangelogVersion.vue +3 -3
  56. package/dist/runtime/components/ChangelogVersion.vue.d.ts +12 -4
  57. package/dist/runtime/components/ChangelogVersions.d.vue.ts +8 -36
  58. package/dist/runtime/components/ChangelogVersions.vue +2 -2
  59. package/dist/runtime/components/ChangelogVersions.vue.d.ts +8 -36
  60. package/dist/runtime/components/ChatMessage.d.vue.ts +1 -0
  61. package/dist/runtime/components/ChatMessage.vue +1 -1
  62. package/dist/runtime/components/ChatMessage.vue.d.ts +1 -0
  63. package/dist/runtime/components/ChatMessages.d.vue.ts +14 -15
  64. package/dist/runtime/components/ChatMessages.vue +24 -8
  65. package/dist/runtime/components/ChatMessages.vue.d.ts +14 -15
  66. package/dist/runtime/components/CommandPalette.d.vue.ts +43 -12
  67. package/dist/runtime/components/CommandPalette.vue +134 -68
  68. package/dist/runtime/components/CommandPalette.vue.d.ts +43 -12
  69. package/dist/runtime/components/ContextMenu.d.vue.ts +28 -6
  70. package/dist/runtime/components/ContextMenu.vue +2 -0
  71. package/dist/runtime/components/ContextMenu.vue.d.ts +28 -6
  72. package/dist/runtime/components/ContextMenuContent.d.vue.ts +2 -3
  73. package/dist/runtime/components/ContextMenuContent.vue +21 -11
  74. package/dist/runtime/components/ContextMenuContent.vue.d.ts +2 -3
  75. package/dist/runtime/components/DashboardNavbar.d.vue.ts +9 -3
  76. package/dist/runtime/components/DashboardNavbar.vue +3 -3
  77. package/dist/runtime/components/DashboardNavbar.vue.d.ts +9 -3
  78. package/dist/runtime/components/DashboardSearch.d.vue.ts +3 -1
  79. package/dist/runtime/components/DashboardSearch.vue +2 -2
  80. package/dist/runtime/components/DashboardSearch.vue.d.ts +3 -1
  81. package/dist/runtime/components/DashboardSearchButton.vue +2 -2
  82. package/dist/runtime/components/DashboardSidebar.d.vue.ts +5 -1
  83. package/dist/runtime/components/DashboardSidebar.vue +4 -4
  84. package/dist/runtime/components/DashboardSidebar.vue.d.ts +5 -1
  85. package/dist/runtime/components/Drawer.vue +2 -5
  86. package/dist/runtime/components/DropdownMenu.d.vue.ts +28 -6
  87. package/dist/runtime/components/DropdownMenu.vue +2 -0
  88. package/dist/runtime/components/DropdownMenu.vue.d.ts +28 -6
  89. package/dist/runtime/components/DropdownMenuContent.d.vue.ts +8 -5
  90. package/dist/runtime/components/DropdownMenuContent.vue +21 -11
  91. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +8 -5
  92. package/dist/runtime/components/Empty.d.vue.ts +53 -0
  93. package/dist/runtime/components/Empty.vue +68 -0
  94. package/dist/runtime/components/Empty.vue.d.ts +53 -0
  95. package/dist/runtime/components/Error.d.vue.ts +0 -1
  96. package/dist/runtime/components/Error.vue +1 -1
  97. package/dist/runtime/components/Error.vue.d.ts +0 -1
  98. package/dist/runtime/components/FileUpload.d.vue.ts +6 -1
  99. package/dist/runtime/components/FileUpload.vue +8 -7
  100. package/dist/runtime/components/FileUpload.vue.d.ts +6 -1
  101. package/dist/runtime/components/FooterColumns.d.vue.ts +9 -2
  102. package/dist/runtime/components/FooterColumns.vue +2 -2
  103. package/dist/runtime/components/FooterColumns.vue.d.ts +9 -2
  104. package/dist/runtime/components/Header.d.vue.ts +4 -1
  105. package/dist/runtime/components/Header.vue +3 -3
  106. package/dist/runtime/components/Header.vue.d.ts +4 -1
  107. package/dist/runtime/components/Input.d.vue.ts +9 -3
  108. package/dist/runtime/components/Input.vue +3 -3
  109. package/dist/runtime/components/Input.vue.d.ts +9 -3
  110. package/dist/runtime/components/InputMenu.d.vue.ts +40 -10
  111. package/dist/runtime/components/InputMenu.vue +117 -65
  112. package/dist/runtime/components/InputMenu.vue.d.ts +40 -10
  113. package/dist/runtime/components/InputNumber.d.vue.ts +4 -2
  114. package/dist/runtime/components/InputNumber.vue +7 -5
  115. package/dist/runtime/components/InputNumber.vue.d.ts +4 -2
  116. package/dist/runtime/components/InputTags.d.vue.ts +10 -3
  117. package/dist/runtime/components/InputTags.vue +5 -5
  118. package/dist/runtime/components/InputTags.vue.d.ts +10 -3
  119. package/dist/runtime/components/Main.d.vue.ts +2 -4
  120. package/dist/runtime/components/Main.vue +1 -1
  121. package/dist/runtime/components/Main.vue.d.ts +2 -4
  122. package/dist/runtime/components/Modal.d.vue.ts +1 -4
  123. package/dist/runtime/components/Modal.vue +3 -6
  124. package/dist/runtime/components/Modal.vue.d.ts +1 -4
  125. package/dist/runtime/components/NavigationMenu.d.vue.ts +16 -4
  126. package/dist/runtime/components/NavigationMenu.vue +14 -7
  127. package/dist/runtime/components/NavigationMenu.vue.d.ts +16 -4
  128. package/dist/runtime/components/PageAnchors.d.vue.ts +9 -2
  129. package/dist/runtime/components/PageAnchors.vue +2 -2
  130. package/dist/runtime/components/PageAnchors.vue.d.ts +9 -2
  131. package/dist/runtime/components/PageCard.d.vue.ts +3 -1
  132. package/dist/runtime/components/PageCard.vue +1 -1
  133. package/dist/runtime/components/PageCard.vue.d.ts +3 -1
  134. package/dist/runtime/components/PageFeature.d.vue.ts +3 -1
  135. package/dist/runtime/components/PageFeature.vue +1 -1
  136. package/dist/runtime/components/PageFeature.vue.d.ts +3 -1
  137. package/dist/runtime/components/PageLinks.d.vue.ts +9 -2
  138. package/dist/runtime/components/PageLinks.vue +2 -2
  139. package/dist/runtime/components/PageLinks.vue.d.ts +9 -2
  140. package/dist/runtime/components/PageSection.d.vue.ts +3 -1
  141. package/dist/runtime/components/PageSection.vue +1 -1
  142. package/dist/runtime/components/PageSection.vue.d.ts +3 -1
  143. package/dist/runtime/components/Pagination.d.vue.ts +3 -1
  144. package/dist/runtime/components/Pagination.vue +1 -1
  145. package/dist/runtime/components/Pagination.vue.d.ts +3 -1
  146. package/dist/runtime/components/Popover.d.vue.ts +24 -23
  147. package/dist/runtime/components/Popover.vue +4 -4
  148. package/dist/runtime/components/Popover.vue.d.ts +24 -23
  149. package/dist/runtime/components/PricingPlan.d.vue.ts +9 -3
  150. package/dist/runtime/components/PricingPlan.vue +3 -3
  151. package/dist/runtime/components/PricingPlan.vue.d.ts +9 -3
  152. package/dist/runtime/components/PricingPlans.d.vue.ts +20 -13
  153. package/dist/runtime/components/PricingPlans.vue +7 -1
  154. package/dist/runtime/components/PricingPlans.vue.d.ts +20 -13
  155. package/dist/runtime/components/Select.d.vue.ts +20 -9
  156. package/dist/runtime/components/Select.vue +18 -9
  157. package/dist/runtime/components/Select.vue.d.ts +20 -9
  158. package/dist/runtime/components/SelectMenu.d.vue.ts +39 -11
  159. package/dist/runtime/components/SelectMenu.vue +114 -61
  160. package/dist/runtime/components/SelectMenu.vue.d.ts +39 -11
  161. package/dist/runtime/components/Separator.d.vue.ts +3 -1
  162. package/dist/runtime/components/Separator.vue +1 -1
  163. package/dist/runtime/components/Separator.vue.d.ts +3 -1
  164. package/dist/runtime/components/Slideover.d.vue.ts +1 -4
  165. package/dist/runtime/components/Slideover.vue +3 -6
  166. package/dist/runtime/components/Slideover.vue.d.ts +1 -4
  167. package/dist/runtime/components/Stepper.d.vue.ts +4 -1
  168. package/dist/runtime/components/Stepper.vue +1 -1
  169. package/dist/runtime/components/Stepper.vue.d.ts +4 -1
  170. package/dist/runtime/components/Table.d.vue.ts +21 -1
  171. package/dist/runtime/components/Table.vue +126 -60
  172. package/dist/runtime/components/Table.vue.d.ts +21 -1
  173. package/dist/runtime/components/Tabs.d.vue.ts +8 -3
  174. package/dist/runtime/components/Tabs.vue +3 -3
  175. package/dist/runtime/components/Tabs.vue.d.ts +8 -3
  176. package/dist/runtime/components/Textarea.d.vue.ts +9 -3
  177. package/dist/runtime/components/Textarea.vue +3 -3
  178. package/dist/runtime/components/Textarea.vue.d.ts +9 -3
  179. package/dist/runtime/components/Toast.d.vue.ts +4 -4
  180. package/dist/runtime/components/Toast.vue +1 -1
  181. package/dist/runtime/components/Toast.vue.d.ts +4 -4
  182. package/dist/runtime/components/Toaster.d.vue.ts +6 -0
  183. package/dist/runtime/components/Toaster.vue +6 -3
  184. package/dist/runtime/components/Toaster.vue.d.ts +6 -0
  185. package/dist/runtime/components/Tooltip.d.vue.ts +3 -1
  186. package/dist/runtime/components/Tooltip.vue +1 -1
  187. package/dist/runtime/components/Tooltip.vue.d.ts +3 -1
  188. package/dist/runtime/components/Tree.d.vue.ts +43 -5
  189. package/dist/runtime/components/Tree.vue +169 -81
  190. package/dist/runtime/components/Tree.vue.d.ts +43 -5
  191. package/dist/runtime/components/User.d.vue.ts +3 -1
  192. package/dist/runtime/components/User.vue +1 -1
  193. package/dist/runtime/components/User.vue.d.ts +3 -1
  194. package/dist/runtime/components/content/ContentNavigation.d.vue.ts +1 -0
  195. package/dist/runtime/components/content/ContentNavigation.vue +5 -5
  196. package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -0
  197. package/dist/runtime/components/content/ContentSearch.d.vue.ts +3 -1
  198. package/dist/runtime/components/content/ContentSearch.vue +4 -2
  199. package/dist/runtime/components/content/ContentSearch.vue.d.ts +3 -1
  200. package/dist/runtime/components/content/ContentSearchButton.vue +2 -2
  201. package/dist/runtime/components/content/ContentSurround.d.vue.ts +1 -0
  202. package/dist/runtime/components/content/ContentSurround.vue +4 -4
  203. package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -0
  204. package/dist/runtime/components/content/ContentToc.d.vue.ts +2 -0
  205. package/dist/runtime/components/content/ContentToc.vue +2 -2
  206. package/dist/runtime/components/content/ContentToc.vue.d.ts +2 -0
  207. package/dist/runtime/components/prose/Accordion.d.vue.ts +6 -0
  208. package/dist/runtime/components/prose/Accordion.vue +3 -2
  209. package/dist/runtime/components/prose/Accordion.vue.d.ts +6 -0
  210. package/dist/runtime/components/prose/CodeTree.vue +40 -36
  211. package/dist/runtime/components/prose/Collapsible.d.vue.ts +2 -2
  212. package/dist/runtime/components/prose/Collapsible.vue +2 -2
  213. package/dist/runtime/components/prose/Collapsible.vue.d.ts +2 -2
  214. package/dist/runtime/components/prose/Field.d.vue.ts +1 -1
  215. package/dist/runtime/components/prose/Field.vue.d.ts +1 -1
  216. package/dist/runtime/components/prose/Img.vue +14 -3
  217. package/dist/runtime/components/prose/Tabs.d.vue.ts +6 -0
  218. package/dist/runtime/components/prose/Tabs.vue +3 -2
  219. package/dist/runtime/components/prose/Tabs.vue.d.ts +6 -0
  220. package/dist/runtime/composables/useKbd.js +1 -1
  221. package/dist/runtime/composables/useToast.d.ts +3 -1
  222. package/dist/runtime/composables/useToast.js +4 -3
  223. package/dist/runtime/inertia/components/Link.vue +12 -7
  224. package/dist/runtime/locale/hr.d.ts +3 -0
  225. package/dist/runtime/locale/hr.js +129 -0
  226. package/dist/runtime/locale/index.d.ts +1 -0
  227. package/dist/runtime/locale/index.js +1 -0
  228. package/dist/runtime/types/index.d.ts +2 -1
  229. package/dist/runtime/types/index.js +2 -1
  230. package/dist/runtime/types/tv.d.ts +6 -0
  231. package/dist/shared/{ui.D-FDXAUi.mjs → ui.Cmctwxv6.mjs} +381 -48
  232. package/dist/unplugin.mjs +2 -1
  233. package/dist/vite.mjs +3 -2
  234. package/package.json +18 -17
@@ -1,7 +1,7 @@
1
1
  import type { AppConfig } from '@nuxt/schema';
2
2
  import type { SpringOptions } from 'motion-v';
3
3
  import theme from '#build/ui/changelog-versions';
4
- import type { ChangelogVersionProps } from '../types';
4
+ import type { ChangelogVersionProps, ChangelogVersionSlots } from '../types';
5
5
  import type { ComponentConfig } from '../types/tv';
6
6
  type ChangelogVersions = ComponentConfig<typeof theme, AppConfig, 'changelogVersions'>;
7
7
  export interface ChangelogVersionsProps<T extends ChangelogVersionProps = ChangelogVersionProps> {
@@ -26,43 +26,15 @@ export interface ChangelogVersionsProps<T extends ChangelogVersionProps = Change
26
26
  class?: any;
27
27
  ui?: ChangelogVersions['slots'];
28
28
  }
29
- export interface ChangelogVersionsSlots<T extends ChangelogVersionProps = ChangelogVersionProps> {
29
+ type ExtendSlotWithVersion<T extends ChangelogVersionProps, K extends keyof ChangelogVersionSlots> = ChangelogVersionSlots[K] extends (props: infer P) => any ? (props: P & {
30
+ version: T;
31
+ }) => any : ChangelogVersionSlots[K];
32
+ export type ChangelogVersionsSlots<T extends ChangelogVersionProps = ChangelogVersionProps> = {
33
+ [K in keyof ChangelogVersionSlots]: ExtendSlotWithVersion<T, K>;
34
+ } & {
30
35
  default(props?: {}): any;
31
36
  indicator(props?: {}): any;
32
- header(props: {
33
- version: T;
34
- }): any;
35
- badge(props: {
36
- version: T;
37
- }): any;
38
- date(props: {
39
- version: T;
40
- }): any;
41
- title(props: {
42
- version: T;
43
- }): any;
44
- description(props: {
45
- version: T;
46
- }): any;
47
- image(props: {
48
- version: T;
49
- }): any;
50
- body(props: {
51
- version: T;
52
- }): any;
53
- footer(props: {
54
- version: T;
55
- }): any;
56
- authors(props: {
57
- version: T;
58
- }): any;
59
- actions(props: {
60
- version: T;
61
- }): any;
62
- indicator(props: {
63
- version: T;
64
- }): any;
65
- }
37
+ };
66
38
  declare const __VLS_export: <T extends ChangelogVersionProps>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
67
39
  props: __VLS_PrettifyLocal<ChangelogVersionsProps<T>> & import("vue").PublicProps;
68
40
  expose: (exposed: {}) => void;
@@ -50,6 +50,7 @@ export interface ChatMessageProps extends UIMessage {
50
50
  export interface ChatMessageSlots {
51
51
  leading(props: {
52
52
  avatar: ChatMessageProps['avatar'];
53
+ ui: ChatMessage['ui'];
53
54
  }): any;
54
55
  content(props: ChatMessageProps): any;
55
56
  actions(props: {
@@ -43,7 +43,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.chatMessage |
43
43
  <Primitive :as="as" :data-role="role" :class="ui.root({ class: [props.ui?.root, props.class] })">
44
44
  <div :class="ui.container({ class: props.ui?.container })">
45
45
  <div v-if="icon || avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
46
- <slot name="leading" :avatar="avatar">
46
+ <slot name="leading" :avatar="avatar" :ui="ui">
47
47
  <UIcon v-if="icon" :name="icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
48
48
  <UAvatar v-else-if="avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
49
49
  </slot>
@@ -50,6 +50,7 @@ export interface ChatMessageProps extends UIMessage {
50
50
  export interface ChatMessageSlots {
51
51
  leading(props: {
52
52
  avatar: ChatMessageProps['avatar'];
53
+ ui: ChatMessage['ui'];
53
54
  }): any;
54
55
  content(props: ChatMessageProps): any;
55
56
  actions(props: {
@@ -1,7 +1,7 @@
1
1
  import type { AppConfig } from '@nuxt/schema';
2
2
  import type { UIMessage, ChatStatus } from 'ai';
3
3
  import theme from '#build/ui/chat-messages';
4
- import type { ButtonProps, ChatMessageProps, IconProps } from '../types';
4
+ import type { ButtonProps, ChatMessageProps, ChatMessageSlots, IconProps } from '../types';
5
5
  import type { ComponentConfig } from '../types/tv';
6
6
  type ChatMessages = ComponentConfig<typeof theme, AppConfig, 'chatMessages'>;
7
7
  export interface ChatMessagesProps {
@@ -33,12 +33,12 @@ export interface ChatMessagesProps {
33
33
  * The `user` messages props.
34
34
  * `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
35
35
  */
36
- user?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions'>;
36
+ user?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
37
37
  /**
38
38
  * The `assistant` messages props.
39
39
  * `{ side: 'left', variant: 'naked' }`{lang="ts-type"}
40
40
  */
41
- assistant?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions'>;
41
+ assistant?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
42
42
  /**
43
43
  * Render the messages in a compact style.
44
44
  * This is done automatically when used inside a `UChatPalette`{lang="ts-type"}.
@@ -53,22 +53,21 @@ export interface ChatMessagesProps {
53
53
  class?: any;
54
54
  ui?: ChatMessages['slots'];
55
55
  }
56
- export interface ChatMessagesSlots {
56
+ type ExtendSlotWithVersion<K extends keyof ChatMessageSlots> = ChatMessageSlots[K] extends (props: infer P) => any ? (props: P & {
57
+ message: UIMessage;
58
+ }) => any : ChatMessageSlots[K];
59
+ export type ChatMessagesSlots = {
60
+ [K in keyof ChatMessageSlots]: ExtendSlotWithVersion<K>;
61
+ } & {
57
62
  default(props?: {}): any;
58
- indicator(props?: {}): any;
63
+ indicator(props: {
64
+ ui: ChatMessages['ui'];
65
+ }): any;
59
66
  viewport(props: {
67
+ ui: ChatMessages['ui'];
60
68
  onClick: () => void;
61
69
  }): any;
62
- content(props: {
63
- message: UIMessage;
64
- }): any;
65
- leading(props: {
66
- message: UIMessage;
67
- }): any;
68
- actions(props: {
69
- message: UIMessage;
70
- }): any;
71
- }
70
+ };
72
71
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatMessagesProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ChatMessagesProps> & Readonly<{}>, {
73
72
  autoScroll: boolean | Partial<ButtonProps>;
74
73
  shouldAutoScroll: boolean;
@@ -40,6 +40,8 @@ const messagesRefs = ref(/* @__PURE__ */ new Map());
40
40
  const showAutoScroll = ref(false);
41
41
  const lastMessageHeight = ref(0);
42
42
  const lastMessageSubmitted = ref(false);
43
+ const lastScrollTop = ref(0);
44
+ const userScrolledUp = ref(false);
43
45
  function registerMessageRef(id, element) {
44
46
  const elInstance = element?.$el;
45
47
  if (elInstance) {
@@ -66,12 +68,17 @@ watchThrottled([() => props.messages, () => props.status], ([_, status]) => {
66
68
  if (status !== "streaming") {
67
69
  return;
68
70
  }
69
- if (props.shouldAutoScroll) {
70
- requestAnimationFrame(() => nextTick(scrollToBottom));
71
- } else {
71
+ if (!props.shouldAutoScroll) {
72
72
  checkScrollPosition();
73
+ return;
73
74
  }
74
- }, { deep: true, throttle: 100, leading: true });
75
+ nextTick(() => {
76
+ if (!parent.value || userScrolledUp.value) return;
77
+ if (parent.value.scrollHeight - parent.value.scrollTop - parent.value.clientHeight < 150) {
78
+ scrollToBottom(false);
79
+ }
80
+ });
81
+ }, { deep: true, throttle: 50, leading: true });
75
82
  watch(() => props.status, (status) => {
76
83
  if (status !== "submitted") {
77
84
  return;
@@ -80,6 +87,7 @@ watch(() => props.status, (status) => {
80
87
  if (!lastMessage || lastMessage.role !== "user") {
81
88
  return;
82
89
  }
90
+ userScrolledUp.value = false;
83
91
  nextTick(() => {
84
92
  lastMessageSubmitted.value = true;
85
93
  updateLastMessageHeight();
@@ -96,8 +104,15 @@ function checkScrollPosition() {
96
104
  const scrollHeight = parent.value.scrollHeight;
97
105
  const threshold = 100;
98
106
  showAutoScroll.value = scrollHeight - scrollPosition >= threshold;
107
+ if (parent.value.scrollTop < lastScrollTop.value) {
108
+ userScrolledUp.value = true;
109
+ } else if (scrollHeight - scrollPosition < threshold) {
110
+ userScrolledUp.value = false;
111
+ }
112
+ lastScrollTop.value = parent.value.scrollTop;
99
113
  }
100
114
  function onAutoScrollClick() {
115
+ userScrolledUp.value = false;
101
116
  scrollToBottom();
102
117
  }
103
118
  function getScrollParent(node) {
@@ -141,6 +156,7 @@ onMounted(() => {
141
156
  if (!parent.value) {
142
157
  return;
143
158
  }
159
+ lastScrollTop.value = parent.value.scrollTop;
144
160
  setTimeout(() => {
145
161
  if (props.shouldScrollToBottom) {
146
162
  scrollToBottom(false);
@@ -168,8 +184,8 @@ onMounted(() => {
168
184
  :ref="(el) => registerMessageRef(message.id, el)"
169
185
  :compact="compact"
170
186
  >
171
- <template v-for="(_, name) in getProxySlots()" #[name]>
172
- <slot :name="name" v-bind="{ message }" />
187
+ <template v-for="(_, name) in getProxySlots()" #[name]="slotData">
188
+ <slot :name="name" v-bind="slotData" :message="message" />
173
189
  </template>
174
190
  </UChatMessage>
175
191
  </slot>
@@ -182,7 +198,7 @@ onMounted(() => {
182
198
  :compact="compact"
183
199
  >
184
200
  <template #content>
185
- <slot name="indicator">
201
+ <slot name="indicator" :ui="ui">
186
202
  <div :class="ui.indicator({ class: props.ui?.indicator })">
187
203
  <span />
188
204
  <span />
@@ -194,7 +210,7 @@ onMounted(() => {
194
210
 
195
211
  <Presence :present="showAutoScroll">
196
212
  <div :data-state="showAutoScroll ? 'open' : 'closed'" :class="ui.viewport({ class: props.ui?.viewport })">
197
- <slot name="viewport" :on-click="onAutoScrollClick">
213
+ <slot name="viewport" :ui="ui" :on-click="onAutoScrollClick">
198
214
  <UButton
199
215
  v-if="autoScroll"
200
216
  :icon="autoScrollIcon || appConfig.ui.icons.arrowDown"
@@ -1,7 +1,7 @@
1
1
  import type { AppConfig } from '@nuxt/schema';
2
2
  import type { UIMessage, ChatStatus } from 'ai';
3
3
  import theme from '#build/ui/chat-messages';
4
- import type { ButtonProps, ChatMessageProps, IconProps } from '../types';
4
+ import type { ButtonProps, ChatMessageProps, ChatMessageSlots, IconProps } from '../types';
5
5
  import type { ComponentConfig } from '../types/tv';
6
6
  type ChatMessages = ComponentConfig<typeof theme, AppConfig, 'chatMessages'>;
7
7
  export interface ChatMessagesProps {
@@ -33,12 +33,12 @@ export interface ChatMessagesProps {
33
33
  * The `user` messages props.
34
34
  * `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
35
35
  */
36
- user?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions'>;
36
+ user?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
37
37
  /**
38
38
  * The `assistant` messages props.
39
39
  * `{ side: 'left', variant: 'naked' }`{lang="ts-type"}
40
40
  */
41
- assistant?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions'>;
41
+ assistant?: Pick<ChatMessageProps, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
42
42
  /**
43
43
  * Render the messages in a compact style.
44
44
  * This is done automatically when used inside a `UChatPalette`{lang="ts-type"}.
@@ -53,22 +53,21 @@ export interface ChatMessagesProps {
53
53
  class?: any;
54
54
  ui?: ChatMessages['slots'];
55
55
  }
56
- export interface ChatMessagesSlots {
56
+ type ExtendSlotWithVersion<K extends keyof ChatMessageSlots> = ChatMessageSlots[K] extends (props: infer P) => any ? (props: P & {
57
+ message: UIMessage;
58
+ }) => any : ChatMessageSlots[K];
59
+ export type ChatMessagesSlots = {
60
+ [K in keyof ChatMessageSlots]: ExtendSlotWithVersion<K>;
61
+ } & {
57
62
  default(props?: {}): any;
58
- indicator(props?: {}): any;
63
+ indicator(props: {
64
+ ui: ChatMessages['ui'];
65
+ }): any;
59
66
  viewport(props: {
67
+ ui: ChatMessages['ui'];
60
68
  onClick: () => void;
61
69
  }): any;
62
- content(props: {
63
- message: UIMessage;
64
- }): any;
65
- leading(props: {
66
- message: UIMessage;
67
- }): any;
68
- actions(props: {
69
- message: UIMessage;
70
- }): any;
71
- }
70
+ };
72
71
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ChatMessagesProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ChatMessagesProps> & Readonly<{}>, {
73
72
  autoScroll: boolean | Partial<ButtonProps>;
74
73
  shouldAutoScroll: boolean;
@@ -11,6 +11,7 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
11
11
  prefix?: string;
12
12
  label?: string;
13
13
  suffix?: string;
14
+ description?: string;
14
15
  /**
15
16
  * @IconifyIcon
16
17
  */
@@ -27,9 +28,9 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
27
28
  */
28
29
  placeholder?: string;
29
30
  children?: CommandPaletteItem[];
30
- onSelect?(e?: Event): void;
31
+ onSelect?: (e: Event) => void;
31
32
  class?: any;
32
- ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>;
33
+ ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>;
33
34
  [key: string]: any;
34
35
  }
35
36
  export interface CommandPaletteGroup<T extends CommandPaletteItem = CommandPaletteItem> {
@@ -63,6 +64,12 @@ export interface CommandPaletteProps<G extends CommandPaletteGroup<T> = CommandP
63
64
  * @IconifyIcon
64
65
  */
65
66
  icon?: IconProps['name'];
67
+ /**
68
+ * The icon displayed on the right side of the input.
69
+ * @defaultValue appConfig.ui.icons.search
70
+ * @IconifyIcon
71
+ */
72
+ trailingIcon?: IconProps['name'];
66
73
  /**
67
74
  * The icon displayed when an item is selected.
68
75
  * @defaultValue appConfig.ui.icons.check
@@ -74,7 +81,7 @@ export interface CommandPaletteProps<G extends CommandPaletteGroup<T> = CommandP
74
81
  * @defaultValue appConfig.ui.icons.chevronRight
75
82
  * @IconifyIcon
76
83
  */
77
- trailingIcon?: IconProps['name'];
84
+ childrenIcon?: IconProps['name'];
78
85
  /**
79
86
  * The placeholder text for the input.
80
87
  * @defaultValue t('commandPalette.placeholder')
@@ -124,11 +131,39 @@ export interface CommandPaletteProps<G extends CommandPaletteGroup<T> = CommandP
124
131
  }
125
132
  */
126
133
  fuse?: UseFuseOptions<T>;
134
+ /**
135
+ * Enable virtualization for large lists.
136
+ * Note: when enabled, all groups are flattened into a single list due to a limitation of Reka UI (https://github.com/unovue/reka-ui/issues/1885).
137
+ * @defaultValue false
138
+ */
139
+ virtualize?: boolean | {
140
+ /**
141
+ * Number of items rendered outside the visible area
142
+ * @defaultValue 12
143
+ */
144
+ overscan?: number;
145
+ /**
146
+ * Estimated size (in px) of each item
147
+ * @defaultValue 32
148
+ */
149
+ estimateSize?: number;
150
+ };
127
151
  /**
128
152
  * The key used to get the label from the item.
129
153
  * @defaultValue 'label'
130
154
  */
131
155
  labelKey?: GetItemKeys<T>;
156
+ /**
157
+ * The key used to get the description from the item.
158
+ * @defaultValue 'description'
159
+ */
160
+ descriptionKey?: GetItemKeys<T>;
161
+ /**
162
+ * Whether to preserve the order of groups as defined in the `groups` prop when filtering.
163
+ * When `false`, groups will appear based on item matches.
164
+ * @defaultValue false
165
+ */
166
+ preserveGroupOrder?: boolean;
132
167
  class?: any;
133
168
  ui?: CommandPalette['slots'];
134
169
  }
@@ -138,29 +173,25 @@ export type CommandPaletteEmits<T extends CommandPaletteItem = CommandPaletteIte
138
173
  type SlotProps<T> = (props: {
139
174
  item: T;
140
175
  index: number;
176
+ ui: CommandPalette['ui'];
141
177
  }) => any;
142
178
  export type CommandPaletteSlots<G extends CommandPaletteGroup<T> = CommandPaletteGroup<any>, T extends CommandPaletteItem = CommandPaletteItem> = {
143
179
  'empty'(props: {
144
180
  searchTerm?: string;
145
181
  }): any;
146
182
  'footer'(props: {
147
- ui: {
148
- [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string;
149
- };
183
+ ui: CommandPalette['ui'];
150
184
  }): any;
151
185
  'back'(props: {
152
- ui: {
153
- [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string;
154
- };
186
+ ui: CommandPalette['ui'];
155
187
  }): any;
156
188
  'close'(props: {
157
- ui: {
158
- [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string;
159
- };
189
+ ui: CommandPalette['ui'];
160
190
  }): any;
161
191
  'item': SlotProps<T>;
162
192
  'item-leading': SlotProps<T>;
163
193
  'item-label': SlotProps<T>;
194
+ 'item-description': SlotProps<T>;
164
195
  'item-trailing': SlotProps<T>;
165
196
  } & Record<string, SlotProps<G>> & Record<string, SlotProps<T>>;
166
197
  declare const __VLS_export: <G extends CommandPaletteGroup<T>, T extends CommandPaletteItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{