@urbicon-ui/blocks 6.35.0 → 6.36.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/dist/components/Chat/Chat/Chat.svelte +53 -0
- package/dist/components/Chat/Chat/Chat.svelte.d.ts +4 -0
- package/dist/components/Chat/Chat/chat.variants.d.ts +20 -0
- package/dist/components/Chat/Chat/chat.variants.js +15 -0
- package/dist/components/Chat/Chat/index.d.ts +47 -0
- package/dist/components/Chat/Chat/index.js +2 -0
- package/dist/components/Chat/ChatMessage/ChatMessage.svelte +342 -0
- package/dist/components/Chat/ChatMessage/ChatMessage.svelte.d.ts +4 -0
- package/dist/components/Chat/ChatMessage/chat-message.variants.d.ts +138 -0
- package/dist/components/Chat/ChatMessage/chat-message.variants.js +118 -0
- package/dist/components/Chat/ChatMessage/index.d.ts +102 -0
- package/dist/components/Chat/ChatMessage/index.js +2 -0
- package/dist/components/Chat/ChatMessageList/ChatMessageList.svelte +301 -0
- package/dist/components/Chat/ChatMessageList/ChatMessageList.svelte.d.ts +6 -0
- package/dist/components/Chat/ChatMessageList/chat-message-list.variants.d.ts +23 -0
- package/dist/components/Chat/ChatMessageList/chat-message-list.variants.js +32 -0
- package/dist/components/Chat/ChatMessageList/chat-scroll.d.ts +45 -0
- package/dist/components/Chat/ChatMessageList/chat-scroll.js +52 -0
- package/dist/components/Chat/ChatMessageList/index.d.ts +93 -0
- package/dist/components/Chat/ChatMessageList/index.js +3 -0
- package/dist/components/Chat/CitationChip/CitationChip.svelte +107 -0
- package/dist/components/Chat/CitationChip/CitationChip.svelte.d.ts +4 -0
- package/dist/components/Chat/CitationChip/citation-chip.variants.d.ts +40 -0
- package/dist/components/Chat/CitationChip/citation-chip.variants.js +42 -0
- package/dist/components/Chat/CitationChip/index.d.ts +69 -0
- package/dist/components/Chat/CitationChip/index.js +2 -0
- package/dist/components/Chat/CodeBlock/CodeBlock.svelte +120 -0
- package/dist/components/Chat/CodeBlock/CodeBlock.svelte.d.ts +4 -0
- package/dist/components/Chat/CodeBlock/code-block.variants.d.ts +40 -0
- package/dist/components/Chat/CodeBlock/code-block.variants.js +51 -0
- package/dist/components/Chat/CodeBlock/index.d.ts +55 -0
- package/dist/components/Chat/CodeBlock/index.js +2 -0
- package/dist/components/Chat/PromptInput/PromptInput.svelte +432 -0
- package/dist/components/Chat/PromptInput/PromptInput.svelte.d.ts +4 -0
- package/dist/components/Chat/PromptInput/index.d.ts +165 -0
- package/dist/components/Chat/PromptInput/index.js +2 -0
- package/dist/components/Chat/PromptInput/prompt-input.variants.d.ts +90 -0
- package/dist/components/Chat/PromptInput/prompt-input.variants.js +102 -0
- package/dist/components/Chat/ReasoningDisclosure/ReasoningDisclosure.svelte +107 -0
- package/dist/components/Chat/ReasoningDisclosure/ReasoningDisclosure.svelte.d.ts +4 -0
- package/dist/components/Chat/ReasoningDisclosure/index.d.ts +85 -0
- package/dist/components/Chat/ReasoningDisclosure/index.js +2 -0
- package/dist/components/Chat/ReasoningDisclosure/reasoning-disclosure.variants.d.ts +20 -0
- package/dist/components/Chat/ReasoningDisclosure/reasoning-disclosure.variants.js +31 -0
- package/dist/components/Chat/StreamingMarkdown/MdBlock.svelte +99 -0
- package/dist/components/Chat/StreamingMarkdown/MdBlock.svelte.d.ts +9 -0
- package/dist/components/Chat/StreamingMarkdown/MdInline.svelte +82 -0
- package/dist/components/Chat/StreamingMarkdown/MdInline.svelte.d.ts +9 -0
- package/dist/components/Chat/StreamingMarkdown/StreamingMarkdown.svelte +118 -0
- package/dist/components/Chat/StreamingMarkdown/StreamingMarkdown.svelte.d.ts +4 -0
- package/dist/components/Chat/StreamingMarkdown/index.d.ts +86 -0
- package/dist/components/Chat/StreamingMarkdown/index.js +2 -0
- package/dist/components/Chat/StreamingMarkdown/md-context.d.ts +58 -0
- package/dist/components/Chat/StreamingMarkdown/md-context.js +1 -0
- package/dist/components/Chat/StreamingMarkdown/streaming-markdown.variants.d.ts +145 -0
- package/dist/components/Chat/StreamingMarkdown/streaming-markdown.variants.js +73 -0
- package/dist/components/Chat/ToolCallCard/ToolCallCard.svelte +174 -0
- package/dist/components/Chat/ToolCallCard/ToolCallCard.svelte.d.ts +4 -0
- package/dist/components/Chat/ToolCallCard/index.d.ts +84 -0
- package/dist/components/Chat/ToolCallCard/index.js +2 -0
- package/dist/components/Chat/ToolCallCard/tool-call-card.variants.d.ts +38 -0
- package/dist/components/Chat/ToolCallCard/tool-call-card.variants.js +38 -0
- package/dist/components/Chat/chat.types.d.ts +82 -0
- package/dist/components/Chat/chat.types.js +7 -0
- package/dist/components/Chat/index.d.ts +22 -0
- package/dist/components/Chat/index.js +14 -0
- package/dist/components/Chat/markdown/blocks.d.ts +54 -0
- package/dist/components/Chat/markdown/blocks.js +462 -0
- package/dist/components/Chat/markdown/inline.d.ts +31 -0
- package/dist/components/Chat/markdown/inline.js +446 -0
- package/dist/components/Chat/markdown/repair.d.ts +23 -0
- package/dist/components/Chat/markdown/repair.js +337 -0
- package/dist/components/Chat/markdown/streaming-harness.d.ts +23 -0
- package/dist/components/Chat/markdown/streaming-harness.js +62 -0
- package/dist/components/Chat/markdown/types.d.ts +139 -0
- package/dist/components/Chat/markdown/types.js +13 -0
- package/dist/components/Chat/markdown/url-policy.d.ts +33 -0
- package/dist/components/Chat/markdown/url-policy.js +109 -0
- package/dist/components/FileUpload/FileUpload.svelte +35 -123
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +1 -1
- package/dist/components/FileUpload/index.d.ts +2 -28
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/primitives/Collapsible/Collapsible.svelte +5 -0
- package/dist/primitives/SplitPane/SplitPane.svelte +293 -0
- package/dist/primitives/SplitPane/SplitPane.svelte.d.ts +4 -0
- package/dist/primitives/SplitPane/index.d.ts +88 -0
- package/dist/primitives/SplitPane/index.js +2 -0
- package/dist/primitives/SplitPane/split-pane.utils.d.ts +73 -0
- package/dist/primitives/SplitPane/split-pane.utils.js +94 -0
- package/dist/primitives/SplitPane/split-pane.variants.d.ts +40 -0
- package/dist/primitives/SplitPane/split-pane.variants.js +56 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +1 -0
- package/dist/utils/file-intake.d.ts +78 -0
- package/dist/utils/file-intake.js +144 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type SlotNames, type VariantProps } from '../../../utils/variants.js';
|
|
2
|
+
export declare const chatMessageVariants: ((props?: {
|
|
3
|
+
layout?: "bubble" | "plain" | undefined;
|
|
4
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
5
|
+
density?: "comfortable" | "compact" | undefined;
|
|
6
|
+
} | undefined) => {
|
|
7
|
+
root: (props?: ({
|
|
8
|
+
layout?: "bubble" | "plain" | undefined;
|
|
9
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
10
|
+
density?: "comfortable" | "compact" | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
13
|
+
}) | undefined) => string;
|
|
14
|
+
container: (props?: ({
|
|
15
|
+
layout?: "bubble" | "plain" | undefined;
|
|
16
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
17
|
+
density?: "comfortable" | "compact" | undefined;
|
|
18
|
+
} & {
|
|
19
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
20
|
+
}) | undefined) => string;
|
|
21
|
+
header: (props?: ({
|
|
22
|
+
layout?: "bubble" | "plain" | undefined;
|
|
23
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
24
|
+
density?: "comfortable" | "compact" | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
27
|
+
}) | undefined) => string;
|
|
28
|
+
roleName: (props?: ({
|
|
29
|
+
layout?: "bubble" | "plain" | undefined;
|
|
30
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
31
|
+
density?: "comfortable" | "compact" | undefined;
|
|
32
|
+
} & {
|
|
33
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
34
|
+
}) | undefined) => string;
|
|
35
|
+
avatar: (props?: ({
|
|
36
|
+
layout?: "bubble" | "plain" | undefined;
|
|
37
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
38
|
+
density?: "comfortable" | "compact" | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
41
|
+
}) | undefined) => string;
|
|
42
|
+
bubble: (props?: ({
|
|
43
|
+
layout?: "bubble" | "plain" | undefined;
|
|
44
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
45
|
+
density?: "comfortable" | "compact" | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
48
|
+
}) | undefined) => string;
|
|
49
|
+
partsFlow: (props?: ({
|
|
50
|
+
layout?: "bubble" | "plain" | undefined;
|
|
51
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
52
|
+
density?: "comfortable" | "compact" | undefined;
|
|
53
|
+
} & {
|
|
54
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
55
|
+
}) | undefined) => string;
|
|
56
|
+
attachment: (props?: ({
|
|
57
|
+
layout?: "bubble" | "plain" | undefined;
|
|
58
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
59
|
+
density?: "comfortable" | "compact" | undefined;
|
|
60
|
+
} & {
|
|
61
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
62
|
+
}) | undefined) => string;
|
|
63
|
+
attachmentIcon: (props?: ({
|
|
64
|
+
layout?: "bubble" | "plain" | undefined;
|
|
65
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
66
|
+
density?: "comfortable" | "compact" | undefined;
|
|
67
|
+
} & {
|
|
68
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
69
|
+
}) | undefined) => string;
|
|
70
|
+
attachmentName: (props?: ({
|
|
71
|
+
layout?: "bubble" | "plain" | undefined;
|
|
72
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
73
|
+
density?: "comfortable" | "compact" | undefined;
|
|
74
|
+
} & {
|
|
75
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
76
|
+
}) | undefined) => string;
|
|
77
|
+
attachmentSize: (props?: ({
|
|
78
|
+
layout?: "bubble" | "plain" | undefined;
|
|
79
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
80
|
+
density?: "comfortable" | "compact" | undefined;
|
|
81
|
+
} & {
|
|
82
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
83
|
+
}) | undefined) => string;
|
|
84
|
+
sourcesFooter: (props?: ({
|
|
85
|
+
layout?: "bubble" | "plain" | undefined;
|
|
86
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
87
|
+
density?: "comfortable" | "compact" | undefined;
|
|
88
|
+
} & {
|
|
89
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
90
|
+
}) | undefined) => string;
|
|
91
|
+
placeholder: (props?: ({
|
|
92
|
+
layout?: "bubble" | "plain" | undefined;
|
|
93
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
94
|
+
density?: "comfortable" | "compact" | undefined;
|
|
95
|
+
} & {
|
|
96
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
97
|
+
}) | undefined) => string;
|
|
98
|
+
statusAlert: (props?: ({
|
|
99
|
+
layout?: "bubble" | "plain" | undefined;
|
|
100
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
101
|
+
density?: "comfortable" | "compact" | undefined;
|
|
102
|
+
} & {
|
|
103
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
104
|
+
}) | undefined) => string;
|
|
105
|
+
footer: (props?: ({
|
|
106
|
+
layout?: "bubble" | "plain" | undefined;
|
|
107
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
108
|
+
density?: "comfortable" | "compact" | undefined;
|
|
109
|
+
} & {
|
|
110
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
111
|
+
}) | undefined) => string;
|
|
112
|
+
actions: (props?: ({
|
|
113
|
+
layout?: "bubble" | "plain" | undefined;
|
|
114
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
115
|
+
density?: "comfortable" | "compact" | undefined;
|
|
116
|
+
} & {
|
|
117
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
118
|
+
}) | undefined) => string;
|
|
119
|
+
actionButton: (props?: ({
|
|
120
|
+
layout?: "bubble" | "plain" | undefined;
|
|
121
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
122
|
+
density?: "comfortable" | "compact" | undefined;
|
|
123
|
+
} & {
|
|
124
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
125
|
+
}) | undefined) => string;
|
|
126
|
+
metadata: (props?: ({
|
|
127
|
+
layout?: "bubble" | "plain" | undefined;
|
|
128
|
+
role?: "user" | "system" | "assistant" | undefined;
|
|
129
|
+
density?: "comfortable" | "compact" | undefined;
|
|
130
|
+
} & {
|
|
131
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
132
|
+
}) | undefined) => string;
|
|
133
|
+
}) & {
|
|
134
|
+
readonly config: import("../../../utils/variants.js").TVConfig;
|
|
135
|
+
};
|
|
136
|
+
export type ChatMessageVariants = VariantProps<typeof chatMessageVariants>;
|
|
137
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
138
|
+
export type ChatMessageSlots = SlotNames<typeof chatMessageVariants>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { tv } from '../../../utils/variants.js';
|
|
2
|
+
export const chatMessageVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
// Group scope drives the hover/focus reveal of the action bar. `min-w-0`
|
|
5
|
+
// so long code/markdown scrolls inside the message, never the page.
|
|
6
|
+
root: ['group/message flex w-full min-w-0 flex-col'],
|
|
7
|
+
// Bubble layout: avatar beside the bubble. Plain layout ignores this and
|
|
8
|
+
// uses `header` + `content` instead.
|
|
9
|
+
container: ['flex min-w-0 items-start gap-3'],
|
|
10
|
+
// Plain-layout header row: avatar + role name above the full-width content.
|
|
11
|
+
header: ['flex min-w-0 items-center gap-2'],
|
|
12
|
+
roleName: ['text-sm font-medium text-text-secondary select-none'],
|
|
13
|
+
avatar: ['shrink-0'],
|
|
14
|
+
// The content bubble (bubble layout) / the full-width column (plain layout).
|
|
15
|
+
bubble: ['min-w-0 max-w-full'],
|
|
16
|
+
// Vertical stack of the rendered parts.
|
|
17
|
+
partsFlow: ['flex min-w-0 flex-col'],
|
|
18
|
+
// reasoning and tool-call parts render through ReasoningDisclosure /
|
|
19
|
+
// ToolCallCard (own slotClasses there); override via partRenderers.
|
|
20
|
+
// attachments
|
|
21
|
+
attachment: [
|
|
22
|
+
'inline-flex max-w-full items-center gap-2 rounded-modify border border-border-subtle bg-surface-base px-2.5 py-1.5 text-sm no-underline',
|
|
23
|
+
'transition-[color,background-color] duration-[var(--blocks-duration-fast)] ease-out'
|
|
24
|
+
],
|
|
25
|
+
attachmentIcon: ['shrink-0 text-text-tertiary'],
|
|
26
|
+
attachmentName: ['min-w-0 truncate text-text-primary'],
|
|
27
|
+
attachmentSize: ['shrink-0 text-xs text-text-tertiary'],
|
|
28
|
+
// sources footer
|
|
29
|
+
sourcesFooter: ['flex flex-wrap items-center gap-1.5 pt-1'],
|
|
30
|
+
// streaming placeholder (zero parts)
|
|
31
|
+
placeholder: ['py-1'],
|
|
32
|
+
// status alert
|
|
33
|
+
statusAlert: ['mt-1'],
|
|
34
|
+
// footer row holding actions + metadata
|
|
35
|
+
footer: ['flex items-center gap-2'],
|
|
36
|
+
actions: [
|
|
37
|
+
'flex items-center gap-1 opacity-0',
|
|
38
|
+
'transition-opacity duration-[var(--blocks-duration-fast)] ease-out',
|
|
39
|
+
'group-hover/message:opacity-100 group-focus-within/message:opacity-100'
|
|
40
|
+
],
|
|
41
|
+
actionButton: [
|
|
42
|
+
'inline-flex items-center justify-center rounded-modify p-1.5',
|
|
43
|
+
'text-text-tertiary cursor-pointer',
|
|
44
|
+
'transition-[color,background-color] duration-[var(--blocks-duration-fast)] ease-out',
|
|
45
|
+
'hover:bg-surface-hover hover:text-text-primary',
|
|
46
|
+
'focus-visible:outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1'
|
|
47
|
+
],
|
|
48
|
+
metadata: ['text-xs text-text-tertiary']
|
|
49
|
+
},
|
|
50
|
+
variants: {
|
|
51
|
+
layout: {
|
|
52
|
+
bubble: {},
|
|
53
|
+
// Document-like: full-width content under an avatar + role header row.
|
|
54
|
+
plain: {
|
|
55
|
+
bubble: 'w-full',
|
|
56
|
+
partsFlow: 'gap-3'
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
role: {
|
|
60
|
+
user: {},
|
|
61
|
+
assistant: {},
|
|
62
|
+
system: {}
|
|
63
|
+
},
|
|
64
|
+
density: {
|
|
65
|
+
comfortable: {
|
|
66
|
+
root: 'gap-1.5',
|
|
67
|
+
partsFlow: 'gap-2'
|
|
68
|
+
},
|
|
69
|
+
compact: {
|
|
70
|
+
root: 'gap-1',
|
|
71
|
+
partsFlow: 'gap-1.5'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
compoundVariants: [
|
|
76
|
+
// ── bubble layout: role tint + alignment ────────────────────────────────
|
|
77
|
+
{
|
|
78
|
+
layout: 'bubble',
|
|
79
|
+
role: 'user',
|
|
80
|
+
class: {
|
|
81
|
+
// Reverse so the (avatar-less) bubble packs to the right edge.
|
|
82
|
+
container: 'flex-row-reverse',
|
|
83
|
+
bubble: 'max-w-[85%] rounded-contain bg-primary-subtle'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
layout: 'bubble',
|
|
88
|
+
role: 'assistant',
|
|
89
|
+
class: {
|
|
90
|
+
bubble: 'max-w-[85%] rounded-contain bg-surface-elevated'
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
layout: 'bubble',
|
|
95
|
+
role: 'system',
|
|
96
|
+
class: {
|
|
97
|
+
container: 'justify-center',
|
|
98
|
+
bubble: 'max-w-[90%] rounded-contain border border-border-subtle bg-surface-base text-sm text-text-secondary'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
// ── bubble layout: density padding ──────────────────────────────────────
|
|
102
|
+
{
|
|
103
|
+
layout: 'bubble',
|
|
104
|
+
density: 'comfortable',
|
|
105
|
+
class: { bubble: 'px-3.5 py-2.5' }
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
layout: 'bubble',
|
|
109
|
+
density: 'compact',
|
|
110
|
+
class: { bubble: 'px-3 py-2' }
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
defaultVariants: {
|
|
114
|
+
layout: 'bubble',
|
|
115
|
+
role: 'assistant',
|
|
116
|
+
density: 'comfortable'
|
|
117
|
+
}
|
|
118
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ChatMessageData, ChatMessagePart, ChatRole } from '../chat.types.js';
|
|
4
|
+
import type { MarkdownUrlPolicy } from '../markdown/types.js';
|
|
5
|
+
import type { ChatMessageSlots, ChatMessageVariants } from './chat-message.variants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Per-part snippet overrides keyed by part `type`. When a renderer exists for a
|
|
8
|
+
* part's type it replaces the built-in rendering for that part (one level up
|
|
9
|
+
* from StreamingMarkdown's node `renderers`) — this is how P3 swaps in
|
|
10
|
+
* ToolCallCard / ReasoningDisclosure and P4 adds A2UIView without touching this
|
|
11
|
+
* component. `source` is intentionally not overridable here: sources are
|
|
12
|
+
* collected into the citation footer, not rendered inline.
|
|
13
|
+
*/
|
|
14
|
+
export type ChatPartRenderers = {
|
|
15
|
+
[K in Exclude<ChatMessagePart['type'], 'source'>]?: Snippet<[
|
|
16
|
+
Extract<ChatMessagePart, {
|
|
17
|
+
type: K;
|
|
18
|
+
}>
|
|
19
|
+
]>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @description Renders one `ChatMessageData` — its ordered parts (markdown text via
|
|
23
|
+
* StreamingMarkdown, reasoning, tool-call status lines, policy-checked attachment
|
|
24
|
+
* chips) plus a citation footer, streaming placeholder, error/aborted Alert, a
|
|
25
|
+
* hover-revealed copy/regenerate action bar and a timestamp. `layout="bubble"`
|
|
26
|
+
* (default) tints and aligns per role; `layout="plain"` is a document-like
|
|
27
|
+
* full-width Claude-style column. Untrusted URLs never render as inline media —
|
|
28
|
+
* only as `urlPolicy`-checked download links. Compose many of these under
|
|
29
|
+
* ChatMessageList; the consumer owns the `ChatMessageData[]`.
|
|
30
|
+
*
|
|
31
|
+
* @tag ai
|
|
32
|
+
* @tag display
|
|
33
|
+
* @related ChatMessageList
|
|
34
|
+
* @related StreamingMarkdown
|
|
35
|
+
* @stability experimental
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```svelte
|
|
39
|
+
* <ChatMessage message={msg} onRegenerate={() => regenerate(msg.id)} />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export interface ChatMessageProps extends Omit<ChatMessageVariants, 'role'>, Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
43
|
+
/** The message to render. The component never mutates it. */
|
|
44
|
+
message: ChatMessageData;
|
|
45
|
+
/**
|
|
46
|
+
* URL policy applied to attachment links and forwarded to StreamingMarkdown /
|
|
47
|
+
* CitationChip. Strict by default (untrusted LLM/server output). Keep it
|
|
48
|
+
* referentially stable to avoid re-parsing streamed markdown.
|
|
49
|
+
*/
|
|
50
|
+
urlPolicy?: MarkdownUrlPolicy;
|
|
51
|
+
/** Provide to render a "Regenerate" action. Called on click. */
|
|
52
|
+
onRegenerate?: () => void;
|
|
53
|
+
/** Provide to render a "Retry" button in the error/aborted Alert. Called on click. */
|
|
54
|
+
onRetry?: () => void;
|
|
55
|
+
/** Avatar override. Receives the message role; default is the Avatar primitive with a role icon. */
|
|
56
|
+
avatar?: Snippet<[{
|
|
57
|
+
role: ChatRole;
|
|
58
|
+
}]>;
|
|
59
|
+
/** Action-bar override. Receives the message; default is copy (+ regenerate when `onRegenerate` is set). */
|
|
60
|
+
actions?: Snippet<[{
|
|
61
|
+
message: ChatMessageData;
|
|
62
|
+
}]>;
|
|
63
|
+
/** Metadata override. Receives the message; default is `createdAt` as a `<time>` element. */
|
|
64
|
+
metadata?: Snippet<[{
|
|
65
|
+
message: ChatMessageData;
|
|
66
|
+
}]>;
|
|
67
|
+
/** Per-part-type render overrides (see `ChatPartRenderers`). */
|
|
68
|
+
partRenderers?: ChatPartRenderers;
|
|
69
|
+
/** Display names per role, shown in the `plain`-layout header. */
|
|
70
|
+
roleLabels?: Partial<Record<ChatRole, string>>;
|
|
71
|
+
/** Accessible label / tooltip for the copy action. @default 'Copy message' */
|
|
72
|
+
copyLabel?: string;
|
|
73
|
+
/** Accessible label shown briefly after a successful copy. @default 'Copied' */
|
|
74
|
+
copiedLabel?: string;
|
|
75
|
+
/** Accessible label / tooltip for the regenerate action. @default 'Regenerate' */
|
|
76
|
+
regenerateLabel?: string;
|
|
77
|
+
/** Label for the retry button in the error/aborted Alert. @default 'Retry' */
|
|
78
|
+
retryLabel?: string;
|
|
79
|
+
/** Alert title for `status === 'error'`. @default 'Something went wrong' */
|
|
80
|
+
errorLabel?: string;
|
|
81
|
+
/** Alert title for `status === 'aborted'`. @default 'Generation stopped' */
|
|
82
|
+
abortedLabel?: string;
|
|
83
|
+
/** Extra classes merged onto the root element. */
|
|
84
|
+
class?: string;
|
|
85
|
+
/** Remove all default tv classes. */
|
|
86
|
+
unstyled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Per-slot class overrides. Slots: root | container | header | roleName | avatar |
|
|
89
|
+
* bubble | partsFlow | attachment | attachmentIcon | attachmentName | attachmentSize |
|
|
90
|
+
* sourcesFooter | placeholder | statusAlert | footer | actions | actionButton |
|
|
91
|
+
* metadata. Reasoning and tool-call parts render through ReasoningDisclosure /
|
|
92
|
+
* ToolCallCard, which take their own `slotClasses`.
|
|
93
|
+
*/
|
|
94
|
+
slotClasses?: Partial<Record<ChatMessageSlots, string>>;
|
|
95
|
+
/**
|
|
96
|
+
* Apply a named preset registered via `<BlocksProvider presets={{ ChatMessage: {...} }}>`.
|
|
97
|
+
* Prefer this over `class` overrides for reusable custom looks.
|
|
98
|
+
*/
|
|
99
|
+
preset?: string;
|
|
100
|
+
}
|
|
101
|
+
export { default as ChatMessage } from './ChatMessage.svelte';
|
|
102
|
+
export { type ChatMessageSlots, type ChatMessageVariants, chatMessageVariants } from './chat-message.variants.js';
|