@leap-online/jolt 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/README.md +51 -2
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/dist/components/accordion/accordion.svelte +150 -0
- package/dist/components/accordion/accordion.svelte.d.ts +32 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/alert.svelte +75 -0
- package/dist/components/alert/alert.svelte.d.ts +24 -0
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/app-shell/app-shell.svelte +53 -0
- package/dist/components/app-shell/app-shell.svelte.d.ts +13 -0
- package/dist/components/app-shell/index.d.ts +2 -0
- package/dist/components/app-shell/index.js +1 -0
- package/dist/components/attachment/attachment-list.svelte +77 -0
- package/dist/components/attachment/attachment-list.svelte.d.ts +15 -0
- package/dist/components/attachment/attachment.svelte +119 -0
- package/dist/components/attachment/attachment.svelte.d.ts +14 -0
- package/dist/components/attachment/format.d.ts +1 -0
- package/dist/components/attachment/format.js +9 -0
- package/dist/components/attachment/index.d.ts +3 -0
- package/dist/components/attachment/index.js +2 -0
- package/dist/components/attachment/preview.d.ts +9 -0
- package/dist/components/attachment/preview.js +191 -0
- package/dist/components/attachment/types.d.ts +12 -0
- package/dist/components/attachment/types.js +1 -0
- package/dist/components/avatar/avatar.svelte +115 -0
- package/dist/components/avatar/avatar.svelte.d.ts +18 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar-group/avatar-group.svelte +79 -0
- package/dist/components/avatar-group/avatar-group.svelte.d.ts +19 -0
- package/dist/components/avatar-group/index.d.ts +1 -0
- package/dist/components/avatar-group/index.js +1 -0
- package/dist/components/badge/badge.svelte +83 -0
- package/dist/components/badge/badge.svelte.d.ts +39 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/breadcrumb/breadcrumb.svelte +165 -0
- package/dist/components/breadcrumb/breadcrumb.svelte.d.ts +24 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/button.svelte +77 -0
- package/dist/components/button/button.svelte.d.ts +29 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/calendar/calendar.svelte +512 -0
- package/dist/components/calendar/calendar.svelte.d.ts +4 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/calendar/types.d.ts +31 -0
- package/dist/components/calendar/types.js +1 -0
- package/dist/components/card/card.svelte +65 -0
- package/dist/components/card/card.svelte.d.ts +15 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/chat/chat-actions.svelte +183 -0
- package/dist/components/chat/chat-actions.svelte.d.ts +21 -0
- package/dist/components/chat/chat-attachments.svelte +41 -0
- package/dist/components/chat/chat-attachments.svelte.d.ts +12 -0
- package/dist/components/chat/chat-composer.svelte +165 -0
- package/dist/components/chat/chat-composer.svelte.d.ts +21 -0
- package/dist/components/chat/chat-loader.svelte +23 -0
- package/dist/components/chat/chat-loader.svelte.d.ts +7 -0
- package/dist/components/chat/chat-markdown.svelte +16 -0
- package/dist/components/chat/chat-markdown.svelte.d.ts +7 -0
- package/dist/components/chat/chat-message.svelte +114 -0
- package/dist/components/chat/chat-message.svelte.d.ts +18 -0
- package/dist/components/chat/chat-reasoning.svelte +52 -0
- package/dist/components/chat/chat-reasoning.svelte.d.ts +11 -0
- package/dist/components/chat/chat-sources.svelte +54 -0
- package/dist/components/chat/chat-sources.svelte.d.ts +10 -0
- package/dist/components/chat/chat-suggestions.svelte +44 -0
- package/dist/components/chat/chat-suggestions.svelte.d.ts +10 -0
- package/dist/components/chat/chat-tool-call.svelte +182 -0
- package/dist/components/chat/chat-tool-call.svelte.d.ts +26 -0
- package/dist/components/chat/chat-viewport.svelte +105 -0
- package/dist/components/chat/chat-viewport.svelte.d.ts +14 -0
- package/dist/components/chat/chat.svelte +113 -0
- package/dist/components/chat/chat.svelte.d.ts +27 -0
- package/dist/components/chat/index.d.ts +16 -0
- package/dist/components/chat/index.js +12 -0
- package/dist/components/chat/types.d.ts +19 -0
- package/dist/components/chat/types.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +99 -0
- package/dist/components/checkbox/checkbox.svelte.d.ts +20 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/code-block/code-block.svelte +53 -0
- package/dist/components/code-block/code-block.svelte.d.ts +12 -0
- package/dist/components/code-block/index.d.ts +1 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/collapsible.svelte +79 -0
- package/dist/components/collapsible/collapsible.svelte.d.ts +17 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/combobox/combobox.svelte +272 -0
- package/dist/components/combobox/combobox.svelte.d.ts +25 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/combobox/types.d.ts +42 -0
- package/dist/components/combobox/types.js +1 -0
- package/dist/components/command-palette/command-palette.svelte +143 -0
- package/dist/components/command-palette/command-palette.svelte.d.ts +31 -0
- package/dist/components/command-palette/index.d.ts +2 -0
- package/dist/components/command-palette/index.js +1 -0
- package/dist/components/confirm-dialog/confirm-dialog.svelte +107 -0
- package/dist/components/confirm-dialog/confirm-dialog.svelte.d.ts +20 -0
- package/dist/components/confirm-dialog/index.d.ts +1 -0
- package/dist/components/confirm-dialog/index.js +1 -0
- package/dist/components/context-menu/context-menu.svelte +175 -0
- package/dist/components/context-menu/context-menu.svelte.d.ts +22 -0
- package/dist/components/context-menu/index.d.ts +1 -0
- package/dist/components/context-menu/index.js +1 -0
- package/dist/components/copy-button/copy-button.svelte +130 -0
- package/dist/components/copy-button/copy-button.svelte.d.ts +19 -0
- package/dist/components/copy-button/index.d.ts +1 -0
- package/dist/components/copy-button/index.js +1 -0
- package/dist/components/data-table/data-table.svelte +146 -0
- package/dist/components/data-table/data-table.svelte.d.ts +43 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/date-picker.svelte +95 -0
- package/dist/components/date-picker/date-picker.svelte.d.ts +24 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/date-range-picker.svelte +117 -0
- package/dist/components/date-range-picker/date-range-picker.svelte.d.ts +28 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/description-list/description-list.svelte +108 -0
- package/dist/components/description-list/description-list.svelte.d.ts +29 -0
- package/dist/components/description-list/index.d.ts +1 -0
- package/dist/components/description-list/index.js +1 -0
- package/dist/components/dialog/dialog.svelte +98 -0
- package/dist/components/dialog/dialog.svelte.d.ts +16 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.svelte +197 -0
- package/dist/components/dropdown-menu/dropdown-menu.svelte.d.ts +29 -0
- package/dist/components/dropdown-menu/index.d.ts +1 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/email-input/email-input.svelte +21 -0
- package/dist/components/email-input/email-input.svelte.d.ts +5 -0
- package/dist/components/email-input/email.d.ts +10 -0
- package/dist/components/email-input/email.js +15 -0
- package/dist/components/email-input/index.d.ts +1 -0
- package/dist/components/email-input/index.js +1 -0
- package/dist/components/empty-state/empty-state.svelte +46 -0
- package/dist/components/empty-state/empty-state.svelte.d.ts +14 -0
- package/dist/components/empty-state/index.d.ts +1 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/feed-item/feed-item.svelte +104 -0
- package/dist/components/feed-item/feed-item.svelte.d.ts +16 -0
- package/dist/components/feed-item/index.d.ts +1 -0
- package/dist/components/feed-item/index.js +1 -0
- package/dist/components/field/checkbox-field.svelte +50 -0
- package/dist/components/field/checkbox-field.svelte.d.ts +4 -0
- package/dist/components/field/field.svelte +71 -0
- package/dist/components/field/field.svelte.d.ts +21 -0
- package/dist/components/field/index.d.ts +5 -0
- package/dist/components/field/index.js +4 -0
- package/dist/components/field/select-field.svelte +55 -0
- package/dist/components/field/select-field.svelte.d.ts +25 -0
- package/dist/components/field/text-field.svelte +48 -0
- package/dist/components/field/text-field.svelte.d.ts +4 -0
- package/dist/components/field/textarea-field.svelte +45 -0
- package/dist/components/field/textarea-field.svelte.d.ts +4 -0
- package/dist/components/field/types.d.ts +74 -0
- package/dist/components/field/types.js +1 -0
- package/dist/components/file-upload/file-upload.svelte +202 -0
- package/dist/components/file-upload/file-upload.svelte.d.ts +15 -0
- package/dist/components/file-upload/index.d.ts +1 -0
- package/dist/components/file-upload/index.js +1 -0
- package/dist/components/hover-card/hover-card.svelte +64 -0
- package/dist/components/hover-card/hover-card.svelte.d.ts +20 -0
- package/dist/components/hover-card/index.d.ts +1 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/inline-edit/index.d.ts +1 -0
- package/dist/components/inline-edit/index.js +1 -0
- package/dist/components/inline-edit/inline-edit.svelte +207 -0
- package/dist/components/inline-edit/inline-edit.svelte.d.ts +17 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/input.svelte +36 -0
- package/dist/components/input/input.svelte.d.ts +8 -0
- package/dist/components/kbd/index.d.ts +1 -0
- package/dist/components/kbd/index.js +1 -0
- package/dist/components/kbd/kbd.svelte +33 -0
- package/dist/components/kbd/kbd.svelte.d.ts +10 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/label/label.svelte +25 -0
- package/dist/components/label/label.svelte.d.ts +8 -0
- package/dist/components/lightbox/index.d.ts +2 -0
- package/dist/components/lightbox/index.js +1 -0
- package/dist/components/lightbox/lightbox.svelte +264 -0
- package/dist/components/lightbox/lightbox.svelte.d.ts +4 -0
- package/dist/components/lightbox/types.d.ts +41 -0
- package/dist/components/lightbox/types.js +1 -0
- package/dist/components/loader/index.d.ts +1 -0
- package/dist/components/loader/index.js +1 -0
- package/dist/components/loader/loader.svelte +78 -0
- package/dist/components/loader/loader.svelte.d.ts +10 -0
- package/dist/components/markdown/markdown.svelte +52 -0
- package/dist/components/markdown/markdown.svelte.d.ts +7 -0
- package/dist/components/menubar/index.d.ts +3 -0
- package/dist/components/menubar/index.js +1 -0
- package/dist/components/menubar/menubar.svelte +180 -0
- package/dist/components/menubar/menubar.svelte.d.ts +4 -0
- package/dist/components/menubar/types.d.ts +26 -0
- package/dist/components/menubar/types.js +1 -0
- package/dist/components/multi-select/index.d.ts +2 -0
- package/dist/components/multi-select/index.js +1 -0
- package/dist/components/multi-select/multi-select.svelte +273 -0
- package/dist/components/multi-select/multi-select.svelte.d.ts +25 -0
- package/dist/components/multi-select/types.d.ts +32 -0
- package/dist/components/multi-select/types.js +1 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +1 -0
- package/dist/components/navigation-menu/navigation-menu.svelte +125 -0
- package/dist/components/navigation-menu/navigation-menu.svelte.d.ts +4 -0
- package/dist/components/navigation-menu/types.d.ts +40 -0
- package/dist/components/navigation-menu/types.js +1 -0
- package/dist/components/page-header/index.d.ts +1 -0
- package/dist/components/page-header/index.js +1 -0
- package/dist/components/page-header/page-header.svelte +44 -0
- package/dist/components/page-header/page-header.svelte.d.ts +11 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/pagination/pagination.svelte +105 -0
- package/dist/components/pagination/pagination.svelte.d.ts +20 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover.svelte +67 -0
- package/dist/components/popover/popover.svelte.d.ts +20 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.svelte +81 -0
- package/dist/components/progress/progress.svelte.d.ts +16 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/radio-group/radio-group.svelte +140 -0
- package/dist/components/radio-group/radio-group.svelte.d.ts +32 -0
- package/dist/components/reaction-bar/index.d.ts +1 -0
- package/dist/components/reaction-bar/index.js +1 -0
- package/dist/components/reaction-bar/reaction-bar.svelte +99 -0
- package/dist/components/reaction-bar/reaction-bar.svelte.d.ts +18 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-area/scroll-area.svelte +81 -0
- package/dist/components/scroll-area/scroll-area.svelte.d.ts +15 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/select.svelte +183 -0
- package/dist/components/select/select.svelte.d.ts +25 -0
- package/dist/components/select/types.d.ts +38 -0
- package/dist/components/select/types.js +1 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.svelte +25 -0
- package/dist/components/separator/separator.svelte.d.ts +8 -0
- package/dist/components/severity-dot/index.d.ts +1 -0
- package/dist/components/severity-dot/index.js +1 -0
- package/dist/components/severity-dot/severity-dot.svelte +55 -0
- package/dist/components/severity-dot/severity-dot.svelte.d.ts +12 -0
- package/dist/components/sheet/index.d.ts +2 -0
- package/dist/components/sheet/index.js +1 -0
- package/dist/components/sheet/sheet.svelte +111 -0
- package/dist/components/sheet/sheet.svelte.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/sidebar/sidebar.svelte +124 -0
- package/dist/components/sidebar/sidebar.svelte.d.ts +4 -0
- package/dist/components/sidebar/types.d.ts +28 -0
- package/dist/components/sidebar/types.js +1 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.svelte +17 -0
- package/dist/components/skeleton/skeleton.svelte.d.ts +6 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/slider.svelte +194 -0
- package/dist/components/slider/slider.svelte.d.ts +25 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.svelte +32 -0
- package/dist/components/spinner/spinner.svelte.d.ts +9 -0
- package/dist/components/split-button/index.d.ts +1 -0
- package/dist/components/split-button/index.js +1 -0
- package/dist/components/split-button/split-button.svelte +87 -0
- package/dist/components/split-button/split-button.svelte.d.ts +21 -0
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/switch/switch.svelte +78 -0
- package/dist/components/switch/switch.svelte.d.ts +17 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/table.svelte +71 -0
- package/dist/components/table/table.svelte.d.ts +25 -0
- package/dist/components/table/types.d.ts +19 -0
- package/dist/components/table/types.js +1 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tabs/tabs.svelte +117 -0
- package/dist/components/tabs/tabs.svelte.d.ts +30 -0
- package/dist/components/tags-input/index.d.ts +2 -0
- package/dist/components/tags-input/index.js +1 -0
- package/dist/components/tags-input/parse.d.ts +6 -0
- package/dist/components/tags-input/parse.js +24 -0
- package/dist/components/tags-input/tags-input.svelte +181 -0
- package/dist/components/tags-input/tags-input.svelte.d.ts +4 -0
- package/dist/components/tags-input/types.d.ts +21 -0
- package/dist/components/tags-input/types.js +1 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/textarea.svelte +35 -0
- package/dist/components/textarea/textarea.svelte.d.ts +8 -0
- package/dist/components/time-ago/index.d.ts +1 -0
- package/dist/components/time-ago/index.js +1 -0
- package/dist/components/time-ago/time-ago.svelte +48 -0
- package/dist/components/time-ago/time-ago.svelte.d.ts +9 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/time-picker/time-picker.svelte +255 -0
- package/dist/components/time-picker/time-picker.svelte.d.ts +4 -0
- package/dist/components/time-picker/types.d.ts +23 -0
- package/dist/components/time-picker/types.js +1 -0
- package/dist/components/toast/index.d.ts +4 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/toast.svelte +68 -0
- package/dist/components/toast/toast.svelte.d.ts +16 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/toggle/toggle-variants.d.ts +14 -0
- package/dist/components/toggle/toggle-variants.js +19 -0
- package/dist/components/toggle/toggle.svelte +57 -0
- package/dist/components/toggle/toggle.svelte.d.ts +19 -0
- package/dist/components/toggle-group/index.d.ts +2 -0
- package/dist/components/toggle-group/index.js +1 -0
- package/dist/components/toggle-group/toggle-group.svelte +163 -0
- package/dist/components/toggle-group/toggle-group.svelte.d.ts +32 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.svelte +65 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +18 -0
- package/dist/components/tree-view/index.d.ts +3 -0
- package/dist/components/tree-view/index.js +2 -0
- package/dist/components/tree-view/move-tree-node.d.ts +7 -0
- package/dist/components/tree-view/move-tree-node.js +57 -0
- package/dist/components/tree-view/tree-view.svelte +553 -0
- package/dist/components/tree-view/tree-view.svelte.d.ts +4 -0
- package/dist/components/tree-view/types.d.ts +45 -0
- package/dist/components/tree-view/types.js +1 -0
- package/dist/form/create-form.svelte.d.ts +23 -0
- package/dist/form/create-form.svelte.js +68 -0
- package/dist/form/index.d.ts +4 -0
- package/dist/form/index.js +2 -0
- package/dist/form/superform-errors.d.ts +6 -0
- package/dist/form/superform-errors.js +13 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +71 -0
- package/dist/styles/theme.css +385 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +1 -0
- package/dist/types/menu.d.ts +51 -0
- package/dist/types/menu.js +1 -0
- package/dist/utils/clipboard.d.ts +13 -0
- package/dist/utils/clipboard.js +22 -0
- package/dist/utils/cls.d.ts +5 -0
- package/dist/utils/cls.js +8 -0
- package/dist/utils/format.d.ts +24 -0
- package/dist/utils/format.js +82 -0
- package/dist/utils/highlight.d.ts +4 -0
- package/dist/utils/highlight.js +82 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/package.json +123 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type Props = {
|
|
3
|
+
label?: string;
|
|
4
|
+
duration?: string;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const ChatReasoning: import("svelte").Component<Props, {}, "open">;
|
|
10
|
+
type ChatReasoning = ReturnType<typeof ChatReasoning>;
|
|
11
|
+
export default ChatReasoning;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ChatSource } from './types.js';
|
|
3
|
+
|
|
4
|
+
export type Props = {
|
|
5
|
+
sources: ChatSource[];
|
|
6
|
+
title?: string;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { BookOpenIcon, ExternalLinkIcon } from '@lucide/svelte';
|
|
14
|
+
import { cls } from '../../utils/index.js';
|
|
15
|
+
|
|
16
|
+
let { sources, title = 'Sources', ariaLabel = 'Sources', class: className }: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<section
|
|
20
|
+
aria-label={ariaLabel}
|
|
21
|
+
data-slot="chat-sources"
|
|
22
|
+
class={cls('flex flex-col gap-2 text-xs', className)}
|
|
23
|
+
>
|
|
24
|
+
<div class="flex items-center gap-1.5 text-muted-foreground">
|
|
25
|
+
<BookOpenIcon class="size-3.5" />
|
|
26
|
+
<span class="font-medium">{title}</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="flex flex-wrap gap-1.5">
|
|
30
|
+
{#each sources as source, index (source.href ?? `${source.label}-${index}`)}
|
|
31
|
+
{#if source.href}
|
|
32
|
+
<a
|
|
33
|
+
href={source.href}
|
|
34
|
+
target="_blank"
|
|
35
|
+
rel="noreferrer"
|
|
36
|
+
title={source.description}
|
|
37
|
+
data-slot="chat-source"
|
|
38
|
+
class="inline-flex max-w-full items-center gap-1 rounded-md border bg-background px-2 py-1 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden"
|
|
39
|
+
>
|
|
40
|
+
<span class="truncate">{source.label}</span>
|
|
41
|
+
<ExternalLinkIcon class="size-3 shrink-0" />
|
|
42
|
+
</a>
|
|
43
|
+
{:else}
|
|
44
|
+
<span
|
|
45
|
+
title={source.description}
|
|
46
|
+
data-slot="chat-source"
|
|
47
|
+
class="inline-flex max-w-full items-center gap-1 rounded-md border bg-background px-2 py-1 text-muted-foreground"
|
|
48
|
+
>
|
|
49
|
+
<span class="truncate">{source.label}</span>
|
|
50
|
+
</span>
|
|
51
|
+
{/if}
|
|
52
|
+
{/each}
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatSource } from './types.js';
|
|
2
|
+
export type Props = {
|
|
3
|
+
sources: ChatSource[];
|
|
4
|
+
title?: string;
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const ChatSources: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ChatSources = ReturnType<typeof ChatSources>;
|
|
10
|
+
export default ChatSources;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type Props = {
|
|
3
|
+
suggestions: string[];
|
|
4
|
+
title?: string;
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
onSelect?: (suggestion: string) => void;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { cls } from '../../utils/index.js';
|
|
13
|
+
import { Button } from '../button/index.js';
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
suggestions,
|
|
17
|
+
title = 'Try asking',
|
|
18
|
+
ariaLabel = 'Suggested prompts',
|
|
19
|
+
onSelect,
|
|
20
|
+
class: className,
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<section
|
|
25
|
+
aria-label={ariaLabel}
|
|
26
|
+
data-slot="chat-suggestions"
|
|
27
|
+
class={cls('flex flex-col gap-2', className)}
|
|
28
|
+
>
|
|
29
|
+
{#if title}
|
|
30
|
+
<p class="text-xs font-medium text-muted-foreground">{title}</p>
|
|
31
|
+
{/if}
|
|
32
|
+
|
|
33
|
+
<div class="flex flex-wrap gap-2">
|
|
34
|
+
{#each suggestions as suggestion (suggestion)}
|
|
35
|
+
<Button
|
|
36
|
+
variant="outline"
|
|
37
|
+
class="h-auto min-h-10 justify-start px-4 py-2.5 text-left text-sm whitespace-normal"
|
|
38
|
+
onclick={() => onSelect?.(suggestion)}
|
|
39
|
+
>
|
|
40
|
+
{suggestion}
|
|
41
|
+
</Button>
|
|
42
|
+
{/each}
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Props = {
|
|
2
|
+
suggestions: string[];
|
|
3
|
+
title?: string;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
onSelect?: (suggestion: string) => void;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const ChatSuggestions: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ChatSuggestions = ReturnType<typeof ChatSuggestions>;
|
|
10
|
+
export default ChatSuggestions;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { MenuEntry } from '../../types/menu.js';
|
|
4
|
+
|
|
5
|
+
export type ChatToolStatus =
|
|
6
|
+
'pending' | 'awaiting-approval' | 'running' | 'success' | 'denied' | 'error';
|
|
7
|
+
|
|
8
|
+
export type ChatToolApprovalScope = 'once' | 'always';
|
|
9
|
+
|
|
10
|
+
export type Props = {
|
|
11
|
+
name: string;
|
|
12
|
+
status?: ChatToolStatus;
|
|
13
|
+
summary?: string;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
approvalDescription?: string;
|
|
17
|
+
allowLabel?: string;
|
|
18
|
+
alwaysAllowLabel?: string;
|
|
19
|
+
denyLabel?: string;
|
|
20
|
+
approvalGroupLabel?: string;
|
|
21
|
+
allowMenuLabel?: string;
|
|
22
|
+
approvalMenuLabel?: string;
|
|
23
|
+
allowOptions?: MenuEntry[];
|
|
24
|
+
approvalMenu?: MenuEntry[];
|
|
25
|
+
onApprove?: (scope: ChatToolApprovalScope) => void;
|
|
26
|
+
onDeny?: () => void;
|
|
27
|
+
class?: string;
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import {
|
|
33
|
+
ChevronDownIcon,
|
|
34
|
+
CircleCheckIcon,
|
|
35
|
+
CircleIcon,
|
|
36
|
+
CircleXIcon,
|
|
37
|
+
EllipsisIcon,
|
|
38
|
+
LoaderCircleIcon,
|
|
39
|
+
ShieldQuestionMarkIcon,
|
|
40
|
+
ShieldXIcon,
|
|
41
|
+
WrenchIcon,
|
|
42
|
+
} from '@lucide/svelte';
|
|
43
|
+
import { Collapsible as BitsCollapsible } from 'bits-ui';
|
|
44
|
+
import { cls } from '../../utils/index.js';
|
|
45
|
+
import { Button } from '../button/index.js';
|
|
46
|
+
import { DropdownMenu } from '../dropdown-menu/index.js';
|
|
47
|
+
import { SplitButton } from '../split-button/index.js';
|
|
48
|
+
|
|
49
|
+
let {
|
|
50
|
+
name,
|
|
51
|
+
status = 'success',
|
|
52
|
+
summary,
|
|
53
|
+
open = $bindable(false),
|
|
54
|
+
children,
|
|
55
|
+
approvalDescription,
|
|
56
|
+
allowLabel = 'Allow',
|
|
57
|
+
alwaysAllowLabel = 'Always allow',
|
|
58
|
+
denyLabel = 'Deny',
|
|
59
|
+
approvalGroupLabel = 'Tool approval',
|
|
60
|
+
allowMenuLabel = 'More allow options',
|
|
61
|
+
approvalMenuLabel = 'More tool options',
|
|
62
|
+
allowOptions,
|
|
63
|
+
approvalMenu,
|
|
64
|
+
onApprove,
|
|
65
|
+
onDeny,
|
|
66
|
+
class: className,
|
|
67
|
+
}: Props = $props();
|
|
68
|
+
|
|
69
|
+
const statusLabels: Record<ChatToolStatus, string> = {
|
|
70
|
+
pending: 'Pending',
|
|
71
|
+
'awaiting-approval': 'Awaiting approval',
|
|
72
|
+
running: 'Running',
|
|
73
|
+
denied: 'Denied',
|
|
74
|
+
success: 'Complete',
|
|
75
|
+
error: 'Failed',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const statusLabel = $derived(statusLabels[status]);
|
|
79
|
+
const hasApprovalActions = $derived(
|
|
80
|
+
Boolean(onApprove || onDeny || (approvalMenu?.length ?? 0) > 0),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const allowMenuItems = $derived<MenuEntry[]>([
|
|
84
|
+
{ label: alwaysAllowLabel, onSelect: () => onApprove?.('always') },
|
|
85
|
+
...(allowOptions ?? []),
|
|
86
|
+
]);
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<BitsCollapsible.Root
|
|
90
|
+
bind:open
|
|
91
|
+
data-slot="chat-tool-call"
|
|
92
|
+
class={cls('w-full overflow-hidden rounded-lg border bg-card', className)}
|
|
93
|
+
>
|
|
94
|
+
<BitsCollapsible.Trigger
|
|
95
|
+
class="group flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden"
|
|
96
|
+
>
|
|
97
|
+
<WrenchIcon class="size-4 shrink-0 text-muted-foreground" />
|
|
98
|
+
<span class="font-medium">{name}</span>
|
|
99
|
+
{#if summary}
|
|
100
|
+
<span class="min-w-0 truncate text-muted-foreground">{summary}</span>
|
|
101
|
+
{/if}
|
|
102
|
+
<span class="ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground">
|
|
103
|
+
{#if status === 'running'}
|
|
104
|
+
<LoaderCircleIcon class="size-3.5 animate-spin" />
|
|
105
|
+
{:else if status === 'success'}
|
|
106
|
+
<CircleCheckIcon class="size-3.5" />
|
|
107
|
+
{:else if status === 'denied'}
|
|
108
|
+
<ShieldXIcon class="size-3.5" />
|
|
109
|
+
{:else if status === 'error'}
|
|
110
|
+
<CircleXIcon class="size-3.5" />
|
|
111
|
+
{:else if status === 'awaiting-approval'}
|
|
112
|
+
<ShieldQuestionMarkIcon class="size-3.5 text-brand-strong" />
|
|
113
|
+
{:else}
|
|
114
|
+
<CircleIcon class="size-3.5" />
|
|
115
|
+
{/if}
|
|
116
|
+
<span>{statusLabel}</span>
|
|
117
|
+
</span>
|
|
118
|
+
<ChevronDownIcon
|
|
119
|
+
class="size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"
|
|
120
|
+
/>
|
|
121
|
+
</BitsCollapsible.Trigger>
|
|
122
|
+
|
|
123
|
+
{#if status === 'awaiting-approval' && (approvalDescription || hasApprovalActions)}
|
|
124
|
+
<div data-slot="chat-tool-approval" class="border-t bg-muted/40 px-3 py-3">
|
|
125
|
+
<div class="grid gap-2.5">
|
|
126
|
+
{#if approvalDescription}
|
|
127
|
+
<p class="text-xs leading-relaxed text-muted-foreground">
|
|
128
|
+
{approvalDescription}
|
|
129
|
+
</p>
|
|
130
|
+
{/if}
|
|
131
|
+
|
|
132
|
+
{#if hasApprovalActions}
|
|
133
|
+
<div
|
|
134
|
+
role="group"
|
|
135
|
+
aria-label={approvalGroupLabel}
|
|
136
|
+
class="flex flex-wrap items-center justify-end gap-2"
|
|
137
|
+
>
|
|
138
|
+
{#if approvalMenu?.length}
|
|
139
|
+
<DropdownMenu items={approvalMenu} align="end">
|
|
140
|
+
{#snippet trigger(triggerProps)}
|
|
141
|
+
<Button
|
|
142
|
+
{...triggerProps}
|
|
143
|
+
variant="ghost"
|
|
144
|
+
size="icon"
|
|
145
|
+
class="size-8"
|
|
146
|
+
aria-label={approvalMenuLabel}
|
|
147
|
+
>
|
|
148
|
+
<EllipsisIcon />
|
|
149
|
+
</Button>
|
|
150
|
+
{/snippet}
|
|
151
|
+
</DropdownMenu>
|
|
152
|
+
{/if}
|
|
153
|
+
|
|
154
|
+
{#if onDeny}
|
|
155
|
+
<Button size="sm" variant="outline" onclick={onDeny}>
|
|
156
|
+
{denyLabel}
|
|
157
|
+
</Button>
|
|
158
|
+
{/if}
|
|
159
|
+
|
|
160
|
+
{#if onApprove}
|
|
161
|
+
<SplitButton
|
|
162
|
+
label={allowLabel}
|
|
163
|
+
items={allowMenuItems}
|
|
164
|
+
size="sm"
|
|
165
|
+
menuLabel={allowMenuLabel}
|
|
166
|
+
onAction={() => onApprove?.('once')}
|
|
167
|
+
/>
|
|
168
|
+
{/if}
|
|
169
|
+
</div>
|
|
170
|
+
{/if}
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
{/if}
|
|
174
|
+
|
|
175
|
+
<BitsCollapsible.Content
|
|
176
|
+
class="overflow-hidden border-t data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down"
|
|
177
|
+
>
|
|
178
|
+
<div class="p-3 text-sm">
|
|
179
|
+
{@render children?.()}
|
|
180
|
+
</div>
|
|
181
|
+
</BitsCollapsible.Content>
|
|
182
|
+
</BitsCollapsible.Root>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { MenuEntry } from '../../types/menu.js';
|
|
3
|
+
export type ChatToolStatus = 'pending' | 'awaiting-approval' | 'running' | 'success' | 'denied' | 'error';
|
|
4
|
+
export type ChatToolApprovalScope = 'once' | 'always';
|
|
5
|
+
export type Props = {
|
|
6
|
+
name: string;
|
|
7
|
+
status?: ChatToolStatus;
|
|
8
|
+
summary?: string;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
approvalDescription?: string;
|
|
12
|
+
allowLabel?: string;
|
|
13
|
+
alwaysAllowLabel?: string;
|
|
14
|
+
denyLabel?: string;
|
|
15
|
+
approvalGroupLabel?: string;
|
|
16
|
+
allowMenuLabel?: string;
|
|
17
|
+
approvalMenuLabel?: string;
|
|
18
|
+
allowOptions?: MenuEntry[];
|
|
19
|
+
approvalMenu?: MenuEntry[];
|
|
20
|
+
onApprove?: (scope: ChatToolApprovalScope) => void;
|
|
21
|
+
onDeny?: () => void;
|
|
22
|
+
class?: string;
|
|
23
|
+
};
|
|
24
|
+
declare const ChatToolCall: import("svelte").Component<Props, {}, "open">;
|
|
25
|
+
type ChatToolCall = ReturnType<typeof ChatToolCall>;
|
|
26
|
+
export default ChatToolCall;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export type Props = {
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
autoScroll?: boolean;
|
|
8
|
+
stickToBottomThreshold?: number;
|
|
9
|
+
class?: string;
|
|
10
|
+
contentClass?: string;
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { ChevronDownIcon } from '@lucide/svelte';
|
|
16
|
+
import { cls } from '../../utils/index.js';
|
|
17
|
+
import { Button } from '../button/index.js';
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
ariaLabel,
|
|
22
|
+
autoScroll = true,
|
|
23
|
+
stickToBottomThreshold = 24,
|
|
24
|
+
class: className,
|
|
25
|
+
contentClass,
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
let viewport = $state<HTMLDivElement | null>(null);
|
|
29
|
+
let content = $state<HTMLDivElement | null>(null);
|
|
30
|
+
let isPinned = $state(true);
|
|
31
|
+
let hasOverflow = $state(false);
|
|
32
|
+
|
|
33
|
+
const showScrollButton = $derived(hasOverflow && !isPinned);
|
|
34
|
+
|
|
35
|
+
function updateOverflow(): void {
|
|
36
|
+
if (!viewport) return;
|
|
37
|
+
hasOverflow = viewport.scrollHeight > viewport.clientHeight + 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function scrollToBottom(behavior: ScrollBehavior = 'smooth'): void {
|
|
41
|
+
if (!viewport) return;
|
|
42
|
+
viewport.scrollTo({ top: viewport.scrollHeight, behavior });
|
|
43
|
+
isPinned = true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleScroll(): void {
|
|
47
|
+
if (!viewport) return;
|
|
48
|
+
const distance = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;
|
|
49
|
+
isPinned = distance <= stickToBottomThreshold;
|
|
50
|
+
updateOverflow();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
$effect(() => {
|
|
54
|
+
if (!viewport || !content) return;
|
|
55
|
+
const observer = new ResizeObserver(() => {
|
|
56
|
+
updateOverflow();
|
|
57
|
+
if (autoScroll && isPinned) scrollToBottom('auto');
|
|
58
|
+
});
|
|
59
|
+
observer.observe(content);
|
|
60
|
+
updateOverflow();
|
|
61
|
+
return () => observer.disconnect();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$effect(() => {
|
|
65
|
+
if (!autoScroll || !viewport || !content) return;
|
|
66
|
+
const frame = requestAnimationFrame(() => scrollToBottom('auto'));
|
|
67
|
+
return () => cancelAnimationFrame(frame);
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div
|
|
72
|
+
data-slot="chat-viewport"
|
|
73
|
+
style:height="100%"
|
|
74
|
+
class={cls('relative min-h-0 overflow-hidden', className)}
|
|
75
|
+
>
|
|
76
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
77
|
+
<div
|
|
78
|
+
bind:this={viewport}
|
|
79
|
+
role="log"
|
|
80
|
+
tabindex="0"
|
|
81
|
+
aria-label={ariaLabel}
|
|
82
|
+
aria-live="polite"
|
|
83
|
+
onscroll={handleScroll}
|
|
84
|
+
data-slot="chat-viewport-scroll"
|
|
85
|
+
style:height="100%"
|
|
86
|
+
style:overflow-y="auto"
|
|
87
|
+
class={cls('overscroll-contain', contentClass)}
|
|
88
|
+
>
|
|
89
|
+
<div bind:this={content}>
|
|
90
|
+
{@render children?.()}
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
{#if showScrollButton}
|
|
95
|
+
<Button
|
|
96
|
+
variant="secondary"
|
|
97
|
+
size="icon"
|
|
98
|
+
aria-label="Scroll to latest message"
|
|
99
|
+
class="absolute bottom-3 left-1/2 size-8 -translate-x-1/2 rounded-full shadow-md"
|
|
100
|
+
onclick={() => scrollToBottom()}
|
|
101
|
+
>
|
|
102
|
+
<ChevronDownIcon />
|
|
103
|
+
</Button>
|
|
104
|
+
{/if}
|
|
105
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type Props = {
|
|
3
|
+
children?: Snippet;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
autoScroll?: boolean;
|
|
6
|
+
stickToBottomThreshold?: number;
|
|
7
|
+
class?: string;
|
|
8
|
+
contentClass?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const ChatViewport: import("svelte").Component<Props, {
|
|
11
|
+
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
12
|
+
}, "">;
|
|
13
|
+
type ChatViewport = ReturnType<typeof ChatViewport>;
|
|
14
|
+
export default ChatViewport;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ChatFeedback } from './chat-actions.svelte';
|
|
4
|
+
import type { ChatMessageData } from './types.js';
|
|
5
|
+
|
|
6
|
+
export type Props = {
|
|
7
|
+
messages: ChatMessageData[];
|
|
8
|
+
value?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
inputLabel?: string;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
empty?: Snippet;
|
|
14
|
+
message?: Snippet<[ChatMessageData]>;
|
|
15
|
+
toolbar?: Snippet;
|
|
16
|
+
onSend?: (value: string) => void;
|
|
17
|
+
onStop?: () => void;
|
|
18
|
+
onFiles?: (files: File[]) => void;
|
|
19
|
+
onCopy?: (message: ChatMessageData) => void;
|
|
20
|
+
onRegenerate?: (message: ChatMessageData) => void;
|
|
21
|
+
onFeedback?: (message: ChatMessageData, feedback: ChatFeedback) => void;
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
class?: string;
|
|
24
|
+
viewportClass?: string;
|
|
25
|
+
contentClass?: string;
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import { cls } from '../../utils/index.js';
|
|
31
|
+
import ChatActions from './chat-actions.svelte';
|
|
32
|
+
import ChatComposer from './chat-composer.svelte';
|
|
33
|
+
import ChatMarkdown from './chat-markdown.svelte';
|
|
34
|
+
import ChatMessage from './chat-message.svelte';
|
|
35
|
+
import ChatViewport from './chat-viewport.svelte';
|
|
36
|
+
|
|
37
|
+
let {
|
|
38
|
+
messages,
|
|
39
|
+
value = $bindable(''),
|
|
40
|
+
placeholder,
|
|
41
|
+
inputLabel,
|
|
42
|
+
loading,
|
|
43
|
+
disabled,
|
|
44
|
+
empty,
|
|
45
|
+
message: messageSnippet,
|
|
46
|
+
onSend,
|
|
47
|
+
onStop,
|
|
48
|
+
onFiles,
|
|
49
|
+
onCopy,
|
|
50
|
+
onRegenerate,
|
|
51
|
+
onFeedback,
|
|
52
|
+
toolbar,
|
|
53
|
+
ariaLabel = 'Conversation',
|
|
54
|
+
class: className,
|
|
55
|
+
viewportClass,
|
|
56
|
+
contentClass,
|
|
57
|
+
}: Props = $props();
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<div data-slot="chat" class={cls('flex h-full min-h-0 flex-col gap-3', className)}>
|
|
61
|
+
<ChatViewport {ariaLabel} class={cls('flex-1', viewportClass)}>
|
|
62
|
+
{#if messages.length === 0 && empty}
|
|
63
|
+
<div class="flex min-h-full items-center justify-center p-6">
|
|
64
|
+
{@render empty()}
|
|
65
|
+
</div>
|
|
66
|
+
{:else}
|
|
67
|
+
<div class={cls('grid gap-4 p-4', contentClass)}>
|
|
68
|
+
{#each messages as chatMessage (chatMessage.id)}
|
|
69
|
+
<ChatMessage
|
|
70
|
+
role={chatMessage.role}
|
|
71
|
+
name={chatMessage.name}
|
|
72
|
+
avatarSrc={chatMessage.avatarSrc}
|
|
73
|
+
initials={chatMessage.initials}
|
|
74
|
+
timestamp={chatMessage.timestamp}
|
|
75
|
+
status={chatMessage.status}
|
|
76
|
+
>
|
|
77
|
+
{#if messageSnippet}
|
|
78
|
+
{@render messageSnippet(chatMessage)}
|
|
79
|
+
{:else}
|
|
80
|
+
<ChatMarkdown content={chatMessage.content} />
|
|
81
|
+
{/if}
|
|
82
|
+
|
|
83
|
+
{#snippet actions()}
|
|
84
|
+
<ChatActions
|
|
85
|
+
content={chatMessage.content}
|
|
86
|
+
feedback={null}
|
|
87
|
+
onCopy={onCopy ? () => onCopy(chatMessage) : undefined}
|
|
88
|
+
onRegenerate={chatMessage.role === 'assistant' && onRegenerate
|
|
89
|
+
? () => onRegenerate(chatMessage)
|
|
90
|
+
: undefined}
|
|
91
|
+
onFeedback={onFeedback
|
|
92
|
+
? (feedback) => onFeedback(chatMessage, feedback)
|
|
93
|
+
: undefined}
|
|
94
|
+
/>
|
|
95
|
+
{/snippet}
|
|
96
|
+
</ChatMessage>
|
|
97
|
+
{/each}
|
|
98
|
+
</div>
|
|
99
|
+
{/if}
|
|
100
|
+
</ChatViewport>
|
|
101
|
+
|
|
102
|
+
<ChatComposer
|
|
103
|
+
bind:value
|
|
104
|
+
{placeholder}
|
|
105
|
+
{inputLabel}
|
|
106
|
+
{loading}
|
|
107
|
+
{disabled}
|
|
108
|
+
{onSend}
|
|
109
|
+
{onStop}
|
|
110
|
+
{onFiles}
|
|
111
|
+
{toolbar}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ChatFeedback } from './chat-actions.svelte';
|
|
3
|
+
import type { ChatMessageData } from './types.js';
|
|
4
|
+
export type Props = {
|
|
5
|
+
messages: ChatMessageData[];
|
|
6
|
+
value?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
inputLabel?: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
empty?: Snippet;
|
|
12
|
+
message?: Snippet<[ChatMessageData]>;
|
|
13
|
+
toolbar?: Snippet;
|
|
14
|
+
onSend?: (value: string) => void;
|
|
15
|
+
onStop?: () => void;
|
|
16
|
+
onFiles?: (files: File[]) => void;
|
|
17
|
+
onCopy?: (message: ChatMessageData) => void;
|
|
18
|
+
onRegenerate?: (message: ChatMessageData) => void;
|
|
19
|
+
onFeedback?: (message: ChatMessageData, feedback: ChatFeedback) => void;
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
viewportClass?: string;
|
|
23
|
+
contentClass?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const Chat: import("svelte").Component<Props, {}, "value">;
|
|
26
|
+
type Chat = ReturnType<typeof Chat>;
|
|
27
|
+
export default Chat;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { default as Chat, type Props as ChatProps } from './chat.svelte';
|
|
2
|
+
export { default as ChatActions, type Props as ChatActionsProps, type ChatFeedback, } from './chat-actions.svelte';
|
|
3
|
+
export { default as ChatAttachments, type Props as ChatAttachmentsProps, } from './chat-attachments.svelte';
|
|
4
|
+
export { default as ChatComposer, type Props as ChatComposerProps } from './chat-composer.svelte';
|
|
5
|
+
export { default as ChatLoader, type Props as ChatLoaderProps } from './chat-loader.svelte';
|
|
6
|
+
export { default as ChatMarkdown, type Props as ChatMarkdownProps } from './chat-markdown.svelte';
|
|
7
|
+
export { default as ChatMessage, type Props as ChatMessageProps } from './chat-message.svelte';
|
|
8
|
+
export { default as ChatReasoning, type Props as ChatReasoningProps, } from './chat-reasoning.svelte';
|
|
9
|
+
export { default as ChatSources, type Props as ChatSourcesProps } from './chat-sources.svelte';
|
|
10
|
+
export { default as ChatSuggestions, type Props as ChatSuggestionsProps, } from './chat-suggestions.svelte';
|
|
11
|
+
export { type ChatToolApprovalScope, default as ChatToolCall, type Props as ChatToolCallProps, type ChatToolStatus, } from './chat-tool-call.svelte';
|
|
12
|
+
export { default as ChatViewport, type Props as ChatViewportProps } from './chat-viewport.svelte';
|
|
13
|
+
export type { ChatMessageStatus, ChatRole } from './types.js';
|
|
14
|
+
export type { ChatMessageData } from './types.js';
|
|
15
|
+
export type { ChatSource } from './types.js';
|
|
16
|
+
export type { ChatAttachment } from './types.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Chat } from './chat.svelte';
|
|
2
|
+
export { default as ChatActions, } from './chat-actions.svelte';
|
|
3
|
+
export { default as ChatAttachments, } from './chat-attachments.svelte';
|
|
4
|
+
export { default as ChatComposer } from './chat-composer.svelte';
|
|
5
|
+
export { default as ChatLoader } from './chat-loader.svelte';
|
|
6
|
+
export { default as ChatMarkdown } from './chat-markdown.svelte';
|
|
7
|
+
export { default as ChatMessage } from './chat-message.svelte';
|
|
8
|
+
export { default as ChatReasoning, } from './chat-reasoning.svelte';
|
|
9
|
+
export { default as ChatSources } from './chat-sources.svelte';
|
|
10
|
+
export { default as ChatSuggestions, } from './chat-suggestions.svelte';
|
|
11
|
+
export { default as ChatToolCall, } from './chat-tool-call.svelte';
|
|
12
|
+
export { default as ChatViewport } from './chat-viewport.svelte';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AttachmentItem } from '../attachment/types.js';
|
|
2
|
+
export type ChatRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
3
|
+
export type ChatMessageStatus = 'sending' | 'streaming' | 'complete' | 'error';
|
|
4
|
+
export type ChatMessageData = {
|
|
5
|
+
id: string;
|
|
6
|
+
role: ChatRole;
|
|
7
|
+
content: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
avatarSrc?: string;
|
|
10
|
+
initials?: string;
|
|
11
|
+
timestamp?: string;
|
|
12
|
+
status?: ChatMessageStatus;
|
|
13
|
+
};
|
|
14
|
+
export type ChatSource = {
|
|
15
|
+
label: string;
|
|
16
|
+
href?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
};
|
|
19
|
+
export type ChatAttachment = AttachmentItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|