@svadmin/ai-elements 0.1.0 → 0.3.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/README.md +45 -9
- package/dist/ai.css +35 -1
- package/dist/components/ChatDialog.svelte +93 -35
- package/dist/components/ChatDialog.svelte.d.ts +6 -0
- package/dist/components/Conversation.svelte +37 -17
- package/dist/components/Conversation.svelte.d.ts +3 -2
- package/dist/components/ConversationContent.svelte +29 -4
- package/dist/components/ConversationContent.svelte.d.ts +3 -2
- package/dist/components/ConversationEmptyState.svelte +33 -7
- package/dist/components/ConversationEmptyState.svelte.d.ts +4 -2
- package/dist/components/ConversationScrollButton.svelte +47 -2
- package/dist/components/ConversationScrollButton.svelte.d.ts +8 -2
- package/dist/components/Message.svelte +30 -16
- package/dist/components/Message.svelte.d.ts +5 -5
- package/dist/components/MessageContent.svelte +23 -4
- package/dist/components/MessageContent.svelte.d.ts +3 -2
- package/dist/components/Reasoning.svelte +51 -9
- package/dist/components/Reasoning.svelte.d.ts +4 -3
- package/dist/components/action/Action.svelte +48 -0
- package/dist/components/action/Action.svelte.d.ts +13 -0
- package/dist/components/action/Actions.svelte +12 -0
- package/dist/components/action/Actions.svelte.d.ts +9 -0
- package/dist/components/action/index.d.ts +4 -0
- package/dist/components/action/index.js +2 -0
- package/dist/components/artifact/ArtifactAction.svelte +43 -7
- package/dist/components/artifact/ArtifactAction.svelte.d.ts +5 -0
- package/dist/components/artifact/ArtifactClose.svelte +26 -6
- package/dist/components/artifact/ArtifactClose.svelte.d.ts +5 -2
- package/dist/components/artifact/index.d.ts +1 -0
- package/dist/components/audio-player/AudioPlayerControlBar.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerDurationDisplay.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerElement.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerMuteButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerPlayButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerSeekBackwardButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerSeekForwardButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerTimeDisplay.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerTimeRange.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerVolumeRange.svelte +0 -1
- package/dist/components/checkpoint/index.d.ts +2 -2
- package/dist/components/code/Code.svelte +16 -0
- package/dist/components/code/Code.svelte.d.ts +10 -0
- package/dist/components/code/index.d.ts +23 -0
- package/dist/components/code/index.js +14 -0
- package/dist/components/code-block/CodeBlock.svelte +23 -4
- package/dist/components/code-block/CodeBlock.svelte.d.ts +8 -4
- package/dist/components/code-block/CodeBlockContent.svelte +7 -1
- package/dist/components/code-block/CodeBlockContent.svelte.d.ts +1 -0
- package/dist/components/code-block/CodeBlockLine.svelte +3 -1
- package/dist/components/code-block/CodeBlockLine.svelte.d.ts +1 -0
- package/dist/components/code-block/CodeBlockOverflow.svelte +32 -0
- package/dist/components/code-block/CodeBlockOverflow.svelte.d.ts +13 -0
- package/dist/components/code-block/index.d.ts +3 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/context/Context.svelte +46 -5
- package/dist/components/context/Context.svelte.d.ts +5 -1
- package/dist/components/conversation/index.d.ts +4 -0
- package/dist/components/file-tree/FileTree.svelte +35 -16
- package/dist/components/file-tree/FileTree.svelte.d.ts +7 -1
- package/dist/components/file-tree/FileTreeFile.svelte +3 -3
- package/dist/components/file-tree/FileTreeFile.svelte.d.ts +1 -0
- package/dist/components/file-tree/context.svelte.d.ts +2 -0
- package/dist/components/inline-citation/InlineCitation.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCardBody.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselHeader.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselIndex.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselNext.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselPrev.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationQuote.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationText.svelte +0 -1
- package/dist/components/jsx-preview/JSXPreviewContent.svelte +43 -31
- package/dist/components/jsx-preview/index.d.ts +1 -1
- package/dist/components/jsx-preview/parser.d.ts +18 -8
- package/dist/components/jsx-preview/parser.js +1 -1
- package/dist/components/message/MessageAction.svelte +45 -9
- package/dist/components/message/MessageAction.svelte.d.ts +2 -2
- package/dist/components/message/MessageAttachment.svelte +64 -0
- package/dist/components/message/MessageAttachment.svelte.d.ts +18 -0
- package/dist/components/message/MessageAttachmentPreview.svelte +51 -0
- package/dist/components/message/MessageAttachmentPreview.svelte.d.ts +9 -0
- package/dist/components/message/MessageAttachments.svelte +25 -0
- package/dist/components/message/MessageAttachments.svelte.d.ts +9 -0
- package/dist/components/message/MessageResponse.svelte +26 -8
- package/dist/components/message/MessageResponse.svelte.d.ts +5 -5
- package/dist/components/message/index.d.ts +8 -0
- package/dist/components/message/index.js +3 -0
- package/dist/components/prompt-input/PromptInput.svelte +17 -4
- package/dist/components/prompt-input/PromptInput.svelte.d.ts +3 -1
- package/dist/components/prompt-input/PromptInputActionAddAttachments.svelte +0 -1
- package/dist/components/prompt-input/PromptInputActionMenuContent.svelte +0 -1
- package/dist/components/prompt-input/PromptInputActionMenuTrigger.svelte +0 -1
- package/dist/components/prompt-input/PromptInputAttachment.svelte +31 -0
- package/dist/components/prompt-input/PromptInputAttachment.svelte.d.ts +9 -0
- package/dist/components/prompt-input/PromptInputAttachmentImagePreview.svelte +34 -0
- package/dist/components/prompt-input/PromptInputAttachmentImagePreview.svelte.d.ts +9 -0
- package/dist/components/prompt-input/PromptInputAttachments.svelte +22 -0
- package/dist/components/prompt-input/PromptInputAttachments.svelte.d.ts +10 -0
- package/dist/components/prompt-input/PromptInputBody.svelte +0 -1
- package/dist/components/prompt-input/PromptInputButton.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommand.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandEmpty.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandGroup.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandInput.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandList.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandSeparator.svelte +0 -1
- package/dist/components/prompt-input/PromptInputFooter.svelte +0 -1
- package/dist/components/prompt-input/PromptInputHeader.svelte +0 -1
- package/dist/components/prompt-input/PromptInputHoverCardContent.svelte +0 -1
- package/dist/components/prompt-input/PromptInputHoverCardTrigger.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSelectContent.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSelectItem.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSelectTrigger.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSubmit.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTab.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabBody.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabItem.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabLabel.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabsList.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTextarea.svelte +3 -3
- package/dist/components/prompt-input/PromptInputToolbar.svelte +14 -0
- package/dist/components/prompt-input/PromptInputToolbar.svelte.d.ts +9 -0
- package/dist/components/prompt-input/PromptInputTools.svelte +0 -1
- package/dist/components/prompt-input/context.svelte.d.ts +1 -0
- package/dist/components/prompt-input/index.d.ts +8 -0
- package/dist/components/prompt-input/index.js +4 -0
- package/dist/components/reasoning/index.d.ts +1 -0
- package/dist/components/response/index.d.ts +2 -0
- package/dist/components/response/index.js +1 -0
- package/dist/components/sandbox/SandboxHeader.svelte +13 -4
- package/dist/components/sandbox/SandboxHeader.svelte.d.ts +6 -5
- package/dist/components/sandbox/SandboxTabContent.svelte +1 -1
- package/dist/components/sandbox/SandboxTabs.svelte +2 -2
- package/dist/components/sandbox/SandboxTabs.svelte.d.ts +1 -0
- package/dist/components/sandbox/SandboxTabsTrigger.svelte +12 -2
- package/dist/components/sandbox/SandboxTabsTrigger.svelte.d.ts +4 -5
- package/dist/components/sandbox/context.svelte.d.ts +2 -0
- package/dist/components/snippet/index.d.ts +2 -2
- package/dist/components/stack-trace/StackTrace.svelte +6 -4
- package/dist/components/stack-trace/StackTrace.svelte.d.ts +2 -1
- package/dist/components/stack-trace/StackTraceCopyButton.svelte +48 -2
- package/dist/components/stack-trace/StackTraceHeader.svelte +37 -2
- package/dist/components/stack-trace/StackTraceHeader.svelte.d.ts +2 -2
- package/dist/components/suggestion/index.d.ts +1 -1
- package/dist/components/terminal/AnsiText.svelte +42 -0
- package/dist/components/terminal/AnsiText.svelte.d.ts +6 -0
- package/dist/components/terminal/Terminal.svelte +20 -10
- package/dist/components/terminal/Terminal.svelte.d.ts +2 -1
- package/dist/components/terminal/TerminalContent.svelte +2 -2
- package/dist/components/terminal/ansi.d.ts +12 -0
- package/dist/components/terminal/ansi.js +76 -0
- package/dist/components/tool/ToolHeader.svelte +4 -16
- package/dist/components/tool/ToolStatusBadge.svelte +4 -3
- package/dist/components/tool/index.d.ts +1 -1
- package/dist/components/tool/status.d.ts +4 -1
- package/dist/components/tool/status.js +7 -7
- package/dist/components/transcription/Transcription.svelte +22 -14
- package/dist/components/transcription/Transcription.svelte.d.ts +2 -1
- package/dist/components/transcription/TranscriptionSegment.svelte +1 -1
- package/dist/components/transcription/context.svelte.d.ts +1 -0
- package/dist/components/voice-selector/VoiceSelectorAccent.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorAge.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorAttributes.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorBullet.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorContent.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorDescription.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorDialog.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorEmpty.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorGender.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorGroup.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorInput.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorList.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorName.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorPreview.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorRoot.svelte.d.ts +1 -1
- package/dist/components/voice-selector/VoiceSelectorSeparator.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorShortcut.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorTrigger.svelte +0 -1
- package/dist/components/workflow/index.d.ts +6 -0
- package/dist/components/workflow/index.js +3 -0
- package/dist/components/workflow/node/index.d.ts +1 -0
- package/dist/components/workflow/node/index.js +1 -0
- package/dist/components/workflow/panel/index.d.ts +1 -0
- package/dist/components/workflow/panel/index.js +1 -0
- package/dist/components/workflow/toolbar/index.d.ts +1 -0
- package/dist/components/workflow/toolbar/index.js +1 -0
- package/dist/context.svelte.d.ts +1 -0
- package/dist/contracts.d.ts +1 -1
- package/dist/generated-components.d.ts +2 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.js +8 -4
- package/dist/internal/Tooltip.svelte +124 -0
- package/dist/internal/Tooltip.svelte.d.ts +12 -0
- package/dist/parity-manifest.js +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -58,9 +58,10 @@ The packed-package verification loads the root entry through `vite.ssrLoadModule
|
|
|
58
58
|
import {
|
|
59
59
|
Conversation,
|
|
60
60
|
Message,
|
|
61
|
-
|
|
61
|
+
MessageContent,
|
|
62
|
+
MessageResponse,
|
|
63
|
+
messageText,
|
|
62
64
|
PromptInput,
|
|
63
|
-
Response,
|
|
64
65
|
} from '@svadmin/ai-elements';
|
|
65
66
|
|
|
66
67
|
let prompt = $state('');
|
|
@@ -74,10 +75,10 @@ The packed-package verification loads the root entry through `vite.ssrLoadModule
|
|
|
74
75
|
</script>
|
|
75
76
|
|
|
76
77
|
<Conversation>
|
|
77
|
-
<Message {message}>
|
|
78
|
-
<
|
|
79
|
-
<
|
|
80
|
-
</
|
|
78
|
+
<Message from={message.role} data-message-id={message.id}>
|
|
79
|
+
<MessageContent>
|
|
80
|
+
<MessageResponse content={messageText(message)} />
|
|
81
|
+
</MessageContent>
|
|
81
82
|
</Message>
|
|
82
83
|
</Conversation>
|
|
83
84
|
|
|
@@ -87,7 +88,9 @@ The packed-package verification loads the root entry through `vite.ssrLoadModule
|
|
|
87
88
|
Messages use the `ChatMessagePart` contract from `@svadmin/core`, including text, reasoning, tool calls/results, sources, images, files, approvals, and generated components.
|
|
88
89
|
|
|
89
90
|
Generated components use TypeBox as their runtime boundary. The schema also
|
|
90
|
-
drives the Svelte component prop type
|
|
91
|
+
drives the Svelte component prop type. Root object schemas are strict by
|
|
92
|
+
default, so undeclared model-provided props are rejected even when the caller
|
|
93
|
+
does not set `additionalProperties: false`:
|
|
91
94
|
|
|
92
95
|
```ts
|
|
93
96
|
import { Type } from '@sinclair/typebox';
|
|
@@ -100,11 +103,42 @@ export const componentRegistry = {
|
|
|
100
103
|
schema: Type.Object({
|
|
101
104
|
warehouse: Type.String(),
|
|
102
105
|
count: Type.Number(),
|
|
103
|
-
}
|
|
106
|
+
}),
|
|
104
107
|
}),
|
|
105
108
|
};
|
|
106
109
|
```
|
|
107
110
|
|
|
111
|
+
Admin tools use the same TypeBox boundary. Call tools through
|
|
112
|
+
`executeAdminTool` so untrusted model arguments are decoded before the tool
|
|
113
|
+
implementation runs:
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { Type } from '@sinclair/typebox';
|
|
117
|
+
import { defineAdminTool, executeAdminTool } from '@svadmin/core';
|
|
118
|
+
|
|
119
|
+
const searchInventory = defineAdminTool({
|
|
120
|
+
name: 'searchInventory',
|
|
121
|
+
description: 'Search inventory by warehouse',
|
|
122
|
+
parameters: Type.Object({
|
|
123
|
+
warehouse: Type.String(),
|
|
124
|
+
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 100 })),
|
|
125
|
+
}),
|
|
126
|
+
readOnly: true,
|
|
127
|
+
execute: async ({ warehouse, limit }) => inventory.search({ warehouse, limit }),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
await executeAdminTool(searchInventory, modelArguments);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Upstream parity
|
|
134
|
+
|
|
135
|
+
`AI_ELEMENT_PARITY` pins the audited `vercel/ai-elements` commit and verifies
|
|
136
|
+
the 49-family, 398-export package surface. Export presence, behavior, and visual
|
|
137
|
+
fidelity are tracked independently: an exact export name is not proof of
|
|
138
|
+
interaction or pixel parity. `JSXPreview` intentionally uses a restricted,
|
|
139
|
+
TypeBox-validated parser instead of executing arbitrary JSX. `Tool.getStatusBadge`
|
|
140
|
+
returns Svelte-renderable status metadata instead of a React element.
|
|
141
|
+
|
|
108
142
|
## AdminApp Integration
|
|
109
143
|
|
|
110
144
|
Pass providers through the owning Svelte tree and render the assistant through
|
|
@@ -125,4 +159,6 @@ the `AdminApp` snippet:
|
|
|
125
159
|
|
|
126
160
|
History is in-memory by default. A non-empty `persistKey` enables
|
|
127
161
|
`localStorage`; include a stable, non-secret user identity in the key. Use
|
|
128
|
-
`onPersist` and `onRestore` for host-managed persistence.
|
|
162
|
+
`onPersist` and `onRestore` for host-managed persistence. If restoration fails,
|
|
163
|
+
the dialog blocks writes for that history scope instead of overwriting remote
|
|
164
|
+
history; use `onPersistenceError` to report the failed operation.
|
package/dist/ai.css
CHANGED
|
@@ -56,6 +56,39 @@
|
|
|
56
56
|
border-color: var(--border, currentColor);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
.svadmin-ai__icon-button {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
width: 2rem;
|
|
62
|
+
height: 2rem;
|
|
63
|
+
min-height: 2rem;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
border: 1px solid transparent;
|
|
67
|
+
border-radius: min(var(--radius, 0.5rem), 0.375rem);
|
|
68
|
+
padding: 0;
|
|
69
|
+
background: transparent;
|
|
70
|
+
color: var(--muted-foreground, currentColor);
|
|
71
|
+
font: inherit;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.svadmin-ai__icon-button:hover:not(:disabled) {
|
|
77
|
+
border-color: var(--border, currentColor);
|
|
78
|
+
background: var(--muted, transparent);
|
|
79
|
+
color: var(--foreground, currentColor);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.svadmin-ai__icon-button:focus-visible {
|
|
83
|
+
outline: 2px solid var(--ring, currentColor);
|
|
84
|
+
outline-offset: 2px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.svadmin-ai__icon-button:disabled {
|
|
88
|
+
cursor: not-allowed;
|
|
89
|
+
opacity: 0.5;
|
|
90
|
+
}
|
|
91
|
+
|
|
59
92
|
.svadmin-ai__button--danger {
|
|
60
93
|
background: var(--destructive, currentColor);
|
|
61
94
|
color: var(--destructive-foreground, Canvas);
|
|
@@ -102,5 +135,6 @@
|
|
|
102
135
|
}
|
|
103
136
|
|
|
104
137
|
@media (prefers-reduced-motion: reduce) {
|
|
105
|
-
.svadmin-ai__button
|
|
138
|
+
.svadmin-ai__button,
|
|
139
|
+
.svadmin-ai__icon-button { transition: none; }
|
|
106
140
|
}
|
|
@@ -39,6 +39,13 @@
|
|
|
39
39
|
GeneratedComponentRegistry,
|
|
40
40
|
} from '../generated-components.js';
|
|
41
41
|
|
|
42
|
+
export type ChatPersistenceOperation = 'restore' | 'persist';
|
|
43
|
+
|
|
44
|
+
export interface ChatPersistenceErrorDetail {
|
|
45
|
+
operation: ChatPersistenceOperation;
|
|
46
|
+
error: unknown;
|
|
47
|
+
}
|
|
48
|
+
|
|
42
49
|
type ResolvedGeneratedComponent = {
|
|
43
50
|
component: Component<GeneratedProps>;
|
|
44
51
|
props: GeneratedProps;
|
|
@@ -51,6 +58,7 @@
|
|
|
51
58
|
persistKey?: string;
|
|
52
59
|
onPersist?: (messages: ChatMessage[]) => void;
|
|
53
60
|
onRestore?: () => ChatMessage[];
|
|
61
|
+
onPersistenceError?: (detail: ChatPersistenceErrorDetail) => void;
|
|
54
62
|
/** 定向接收 `svadmin:ask-ai` 事件的稳定作用域。 */
|
|
55
63
|
scope?: string;
|
|
56
64
|
/** 所属 Layout 作用域,用于仲裁全局快捷键。 */
|
|
@@ -69,11 +77,16 @@
|
|
|
69
77
|
type PersistSnapshot = {
|
|
70
78
|
key: string;
|
|
71
79
|
messages: ChatMessage[];
|
|
80
|
+
errorHandler?: (detail: ChatPersistenceErrorDetail) => void;
|
|
72
81
|
} & (
|
|
73
82
|
| { sink: 'callback'; callback: (messages: ChatMessage[]) => void }
|
|
74
83
|
| { sink: 'storage'; storage: Storage | null }
|
|
75
84
|
);
|
|
76
85
|
|
|
86
|
+
type RestoreResult =
|
|
87
|
+
| { ok: true; messages: ChatMessage[] }
|
|
88
|
+
| { ok: false; error: unknown };
|
|
89
|
+
|
|
77
90
|
type ApprovalEntry = {
|
|
78
91
|
agent: AgentProvider;
|
|
79
92
|
controller: AbortController;
|
|
@@ -95,6 +108,7 @@
|
|
|
95
108
|
persistKey,
|
|
96
109
|
onPersist,
|
|
97
110
|
onRestore,
|
|
111
|
+
onPersistenceError,
|
|
98
112
|
scope,
|
|
99
113
|
ownerScope,
|
|
100
114
|
componentRegistry = {},
|
|
@@ -148,6 +162,8 @@
|
|
|
148
162
|
let restoredCallback: Props['onRestore'];
|
|
149
163
|
let previousPersistCallback: Props['onPersist'];
|
|
150
164
|
let hasPersistCallbackSnapshot = false;
|
|
165
|
+
let persistBlockedScope: string | null = null;
|
|
166
|
+
let persistenceError = $state<string | null>(null);
|
|
151
167
|
let statusAnnouncement = $state('');
|
|
152
168
|
|
|
153
169
|
const historyScopeToken = $derived.by(() => {
|
|
@@ -266,11 +282,19 @@
|
|
|
266
282
|
|
|
267
283
|
function getChatStorage(): Storage | null {
|
|
268
284
|
if (typeof window === 'undefined') return null;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
285
|
+
return window.localStorage;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function reportPersistenceError(
|
|
289
|
+
operation: ChatPersistenceOperation,
|
|
290
|
+
error: unknown,
|
|
291
|
+
errorHandler = onPersistenceError,
|
|
292
|
+
): void {
|
|
293
|
+
persistenceError = operation === 'restore'
|
|
294
|
+
? 'Conversation history could not be restored. New messages will not be saved until restoration succeeds.'
|
|
295
|
+
: 'Conversation history could not be saved.';
|
|
296
|
+
statusAnnouncement = persistenceError;
|
|
297
|
+
errorHandler?.({ operation, error });
|
|
274
298
|
}
|
|
275
299
|
|
|
276
300
|
function flushPersist(snapshot: PersistSnapshot): void {
|
|
@@ -280,8 +304,8 @@
|
|
|
280
304
|
} else if (snapshot.key) {
|
|
281
305
|
snapshot.storage?.setItem(snapshot.key, JSON.stringify(snapshot.messages));
|
|
282
306
|
}
|
|
283
|
-
} catch {
|
|
284
|
-
|
|
307
|
+
} catch (error) {
|
|
308
|
+
reportPersistenceError('persist', error, snapshot.errorHandler);
|
|
285
309
|
}
|
|
286
310
|
}
|
|
287
311
|
|
|
@@ -305,6 +329,7 @@
|
|
|
305
329
|
}
|
|
306
330
|
|
|
307
331
|
function schedulePersist(nextMessages: ChatMessage[]): void {
|
|
332
|
+
if (persistBlockedScope === historyScopeToken) return;
|
|
308
333
|
const persistedMessages = cloneMessages(nextMessages);
|
|
309
334
|
const callback = onPersist;
|
|
310
335
|
let snapshot: PersistSnapshot;
|
|
@@ -315,15 +340,24 @@
|
|
|
315
340
|
key: restoredPersistKey ?? resolvedPersistKey,
|
|
316
341
|
messages: persistedMessages,
|
|
317
342
|
callback,
|
|
343
|
+
errorHandler: onPersistenceError,
|
|
318
344
|
};
|
|
319
345
|
} else {
|
|
320
346
|
const key = restoredPersistKey;
|
|
321
347
|
if (key === null || !key || key !== resolvedPersistKey) return;
|
|
348
|
+
let storage: Storage | null;
|
|
349
|
+
try {
|
|
350
|
+
storage = getChatStorage();
|
|
351
|
+
} catch (error) {
|
|
352
|
+
reportPersistenceError('persist', error);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
322
355
|
snapshot = {
|
|
323
356
|
sink: 'storage',
|
|
324
357
|
key,
|
|
325
358
|
messages: persistedMessages,
|
|
326
|
-
storage
|
|
359
|
+
storage,
|
|
360
|
+
errorHandler: onPersistenceError,
|
|
327
361
|
};
|
|
328
362
|
}
|
|
329
363
|
|
|
@@ -496,14 +530,18 @@
|
|
|
496
530
|
return restored;
|
|
497
531
|
}
|
|
498
532
|
|
|
499
|
-
function readStoredMessages(key: string):
|
|
500
|
-
|
|
501
|
-
if (!key || !storage) return [];
|
|
533
|
+
function readStoredMessages(key: string): RestoreResult {
|
|
534
|
+
if (!key) return { ok: true, messages: [] };
|
|
502
535
|
try {
|
|
536
|
+
const storage = getChatStorage();
|
|
537
|
+
if (!storage) return { ok: true, messages: [] };
|
|
503
538
|
const stored = storage.getItem(key);
|
|
504
|
-
return
|
|
505
|
-
|
|
506
|
-
|
|
539
|
+
return {
|
|
540
|
+
ok: true,
|
|
541
|
+
messages: stored === null ? [] : parseStoredMessages(JSON.parse(stored) as unknown),
|
|
542
|
+
};
|
|
543
|
+
} catch (error) {
|
|
544
|
+
return { ok: false, error };
|
|
507
545
|
}
|
|
508
546
|
}
|
|
509
547
|
|
|
@@ -632,17 +670,26 @@
|
|
|
632
670
|
restoredHistoryScope = null;
|
|
633
671
|
restoredPersistKey = null;
|
|
634
672
|
restoredCallback = restore;
|
|
673
|
+
persistBlockedScope = null;
|
|
674
|
+
persistenceError = null;
|
|
635
675
|
|
|
636
676
|
if (restore) {
|
|
637
|
-
let restored: ChatMessage[];
|
|
638
677
|
try {
|
|
639
|
-
|
|
640
|
-
} catch {
|
|
641
|
-
|
|
678
|
+
finishRestore(scopeToken, key, parseStoredMessages(restore()), true);
|
|
679
|
+
} catch (error) {
|
|
680
|
+
persistBlockedScope = scopeToken;
|
|
681
|
+
finishRestore(scopeToken, key, []);
|
|
682
|
+
reportPersistenceError('restore', error);
|
|
642
683
|
}
|
|
643
|
-
finishRestore(scopeToken, key, restored, true);
|
|
644
684
|
} else {
|
|
645
|
-
|
|
685
|
+
const restored = readStoredMessages(key);
|
|
686
|
+
if (!restored.ok) {
|
|
687
|
+
persistBlockedScope = scopeToken;
|
|
688
|
+
finishRestore(scopeToken, key, []);
|
|
689
|
+
reportPersistenceError('restore', restored.error);
|
|
690
|
+
} else {
|
|
691
|
+
finishRestore(scopeToken, key, restored.messages);
|
|
692
|
+
}
|
|
646
693
|
}
|
|
647
694
|
});
|
|
648
695
|
});
|
|
@@ -1025,6 +1072,8 @@
|
|
|
1025
1072
|
function clearChat(): void {
|
|
1026
1073
|
invalidateActiveRun({ persist: false });
|
|
1027
1074
|
cancelPendingPersist();
|
|
1075
|
+
persistBlockedScope = null;
|
|
1076
|
+
persistenceError = null;
|
|
1028
1077
|
replaceMessages([], false);
|
|
1029
1078
|
statusAnnouncement = 'Conversation cleared.';
|
|
1030
1079
|
const key = restoredPersistKey ?? resolvedPersistKey;
|
|
@@ -1034,8 +1083,8 @@
|
|
|
1034
1083
|
} else if (key) {
|
|
1035
1084
|
try {
|
|
1036
1085
|
getChatStorage()?.removeItem(key);
|
|
1037
|
-
} catch {
|
|
1038
|
-
|
|
1086
|
+
} catch (error) {
|
|
1087
|
+
reportPersistenceError('persist', error);
|
|
1039
1088
|
}
|
|
1040
1089
|
}
|
|
1041
1090
|
}
|
|
@@ -1124,14 +1173,14 @@
|
|
|
1124
1173
|
aria-label="AI assistant"
|
|
1125
1174
|
aria-busy={isStreaming}
|
|
1126
1175
|
>
|
|
1127
|
-
<header class="flex shrink-0 items-center justify-between gap-3 border-b border-border/70 bg-
|
|
1176
|
+
<header class="flex shrink-0 items-center justify-between gap-3 border-b border-border/70 bg-card px-4 py-3 text-card-foreground">
|
|
1128
1177
|
<div class="flex min-w-0 items-center gap-2">
|
|
1129
|
-
<span class="flex size-8 shrink-0 items-center justify-center rounded-
|
|
1130
|
-
<Bot size={
|
|
1178
|
+
<span class="flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground" aria-hidden="true">
|
|
1179
|
+
<Bot size={16} />
|
|
1131
1180
|
</span>
|
|
1132
1181
|
<div class="min-w-0">
|
|
1133
1182
|
<h2 class="truncate text-sm font-semibold">AI assistant</h2>
|
|
1134
|
-
<p class="truncate text-xs
|
|
1183
|
+
<p class="svadmin-ai__muted truncate text-xs" aria-live="polite">
|
|
1135
1184
|
{isStreaming ? 'Generating response' : (chatContext.currentResource ?? 'Workspace')}
|
|
1136
1185
|
</p>
|
|
1137
1186
|
</div>
|
|
@@ -1140,8 +1189,9 @@
|
|
|
1140
1189
|
{#if messages.length > 0}
|
|
1141
1190
|
<button
|
|
1142
1191
|
type="button"
|
|
1143
|
-
class="svadmin-
|
|
1192
|
+
class="svadmin-ai__icon-button"
|
|
1144
1193
|
aria-label="Clear conversation"
|
|
1194
|
+
title="Clear conversation"
|
|
1145
1195
|
onclick={clearChat}
|
|
1146
1196
|
>
|
|
1147
1197
|
<Trash2 size={15} aria-hidden="true" />
|
|
@@ -1149,8 +1199,9 @@
|
|
|
1149
1199
|
{/if}
|
|
1150
1200
|
<button
|
|
1151
1201
|
type="button"
|
|
1152
|
-
class="svadmin-
|
|
1202
|
+
class="svadmin-ai__icon-button"
|
|
1153
1203
|
aria-label={minimized ? 'Expand AI assistant' : 'Minimize AI assistant'}
|
|
1204
|
+
title={minimized ? 'Expand AI assistant' : 'Minimize AI assistant'}
|
|
1154
1205
|
aria-expanded={!minimized}
|
|
1155
1206
|
onclick={() => { minimized = !minimized; }}
|
|
1156
1207
|
>
|
|
@@ -1162,8 +1213,9 @@
|
|
|
1162
1213
|
</button>
|
|
1163
1214
|
<button
|
|
1164
1215
|
type="button"
|
|
1165
|
-
class="svadmin-
|
|
1216
|
+
class="svadmin-ai__icon-button"
|
|
1166
1217
|
aria-label="Close AI assistant"
|
|
1218
|
+
title="Close AI assistant"
|
|
1167
1219
|
onclick={closeDialog}
|
|
1168
1220
|
>
|
|
1169
1221
|
<X size={15} aria-hidden="true" />
|
|
@@ -1172,13 +1224,19 @@
|
|
|
1172
1224
|
</header>
|
|
1173
1225
|
|
|
1174
1226
|
{#if !minimized}
|
|
1227
|
+
{#if persistenceError}
|
|
1228
|
+
<div class="border-b border-destructive/25 bg-destructive/10 px-4 py-2 text-xs text-destructive" role="alert">
|
|
1229
|
+
{persistenceError}
|
|
1230
|
+
</div>
|
|
1231
|
+
{/if}
|
|
1175
1232
|
<Conversation {messages} {isStreaming} class="min-h-0 flex-1 rounded-none border-0">
|
|
1176
|
-
<ConversationContent class="
|
|
1233
|
+
<ConversationContent class="gap-2">
|
|
1177
1234
|
{#if messages.length === 0}
|
|
1178
|
-
<ConversationEmptyState
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1235
|
+
<ConversationEmptyState>
|
|
1236
|
+
<div class="space-y-1">
|
|
1237
|
+
<h3 class="text-sm font-medium">How can I help?</h3>
|
|
1238
|
+
<p class="svadmin-ai__muted text-sm">Ask about the current resource, record, or workflow.</p>
|
|
1239
|
+
</div>
|
|
1182
1240
|
<div class="mt-3 flex w-full max-w-72 flex-col gap-2">
|
|
1183
1241
|
{#each suggestions as suggestion (suggestion)}
|
|
1184
1242
|
<button
|
|
@@ -1194,7 +1252,7 @@
|
|
|
1194
1252
|
{/if}
|
|
1195
1253
|
|
|
1196
1254
|
{#each messages as message (message.id)}
|
|
1197
|
-
<Message {message}>
|
|
1255
|
+
<Message from={message.role} id={message.id}>
|
|
1198
1256
|
<MessageContent class={message.role === 'user' ? 'bg-primary text-primary-foreground' : ''}>
|
|
1199
1257
|
{#if message.parts.length === 0 && message.status === 'streaming'}
|
|
1200
1258
|
<p class="svadmin-ai__muted text-sm">Thinking...</p>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type Component } from 'svelte';
|
|
2
2
|
import type { ChatMessage } from '../contracts.js';
|
|
3
3
|
import { type GeneratedComponentRegistry as ComponentRegistry } from '../generated-components.js';
|
|
4
|
+
export type ChatPersistenceOperation = 'restore' | 'persist';
|
|
5
|
+
export interface ChatPersistenceErrorDetail {
|
|
6
|
+
operation: ChatPersistenceOperation;
|
|
7
|
+
error: unknown;
|
|
8
|
+
}
|
|
4
9
|
type Props = {
|
|
5
10
|
/** 在布局工具栏内渲染紧凑启动按钮。 */
|
|
6
11
|
docked?: boolean;
|
|
@@ -8,6 +13,7 @@ type Props = {
|
|
|
8
13
|
persistKey?: string;
|
|
9
14
|
onPersist?: (messages: ChatMessage[]) => void;
|
|
10
15
|
onRestore?: () => ChatMessage[];
|
|
16
|
+
onPersistenceError?: (detail: ChatPersistenceErrorDetail) => void;
|
|
11
17
|
/** 定向接收 `svadmin:ask-ai` 事件的稳定作用域。 */
|
|
12
18
|
scope?: string;
|
|
13
19
|
/** 所属 Layout 作用域,用于仲裁全局快捷键。 */
|
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import {
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
import type { ChatMessage } from '../contracts.js';
|
|
5
|
-
import { provideConversationContext } from '../context.svelte.js';
|
|
6
|
-
import { cn } from '../utils.js';
|
|
7
5
|
|
|
8
|
-
type
|
|
6
|
+
export type ConversationProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'class'> & {
|
|
9
7
|
messages?: ChatMessage[];
|
|
10
8
|
isStreaming?: boolean;
|
|
11
9
|
class?: string;
|
|
12
10
|
children?: Snippet;
|
|
13
11
|
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { untrack } from 'svelte';
|
|
16
|
+
import { provideConversationContext } from '../context.svelte.js';
|
|
17
|
+
import { cn } from '../utils.js';
|
|
14
18
|
|
|
15
|
-
let {
|
|
19
|
+
let {
|
|
20
|
+
messages = [],
|
|
21
|
+
isStreaming = false,
|
|
22
|
+
class: className = '',
|
|
23
|
+
children,
|
|
24
|
+
'aria-label': ariaLabel = 'Conversation',
|
|
25
|
+
...rest
|
|
26
|
+
}: ConversationProps = $props();
|
|
16
27
|
let contentElement = $state<HTMLElement | null>(null);
|
|
17
|
-
let
|
|
28
|
+
let isAtBottom = $state(true);
|
|
18
29
|
|
|
19
30
|
function scrollToBottom(): void {
|
|
20
|
-
|
|
31
|
+
const element = contentElement;
|
|
32
|
+
if (!element) return;
|
|
33
|
+
isAtBottom = true;
|
|
34
|
+
if (typeof element.scrollTo === 'function') element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
|
|
35
|
+
else element.scrollTop = element.scrollHeight;
|
|
21
36
|
}
|
|
22
37
|
|
|
23
38
|
function updateScrollState(): void {
|
|
24
39
|
const element = contentElement;
|
|
25
40
|
if (!element) return;
|
|
26
|
-
|
|
41
|
+
isAtBottom = element.scrollHeight - element.scrollTop - element.clientHeight <= 48;
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
function registerContent(element: HTMLElement | null): void {
|
|
@@ -38,6 +53,7 @@
|
|
|
38
53
|
provideConversationContext({
|
|
39
54
|
get messages() { return messages; },
|
|
40
55
|
get isStreaming() { return isStreaming; },
|
|
56
|
+
get isAtBottom() { return isAtBottom; },
|
|
41
57
|
scrollToBottom,
|
|
42
58
|
registerContent,
|
|
43
59
|
});
|
|
@@ -46,19 +62,23 @@
|
|
|
46
62
|
void messages;
|
|
47
63
|
void isStreaming;
|
|
48
64
|
queueMicrotask(() => {
|
|
49
|
-
|
|
65
|
+
const element = contentElement;
|
|
66
|
+
if (element && isAtBottom) {
|
|
67
|
+
if (typeof element.scrollTo === 'function') element.scrollTo({ top: element.scrollHeight });
|
|
68
|
+
else element.scrollTop = element.scrollHeight;
|
|
69
|
+
}
|
|
50
70
|
updateScrollState();
|
|
51
71
|
});
|
|
52
72
|
});
|
|
53
73
|
</script>
|
|
54
74
|
|
|
55
|
-
<section
|
|
75
|
+
<section
|
|
76
|
+
{...rest}
|
|
77
|
+
class={cn('svadmin-ai svadmin-ai__surface relative flex min-h-0 flex-col overflow-hidden', className)}
|
|
78
|
+
aria-label={ariaLabel}
|
|
79
|
+
data-slot="conversation"
|
|
80
|
+
>
|
|
56
81
|
{@render children?.()}
|
|
57
|
-
{#if showScrollButton}
|
|
58
|
-
<button type="button" class="svadmin-ai__button svadmin-ai__button--ghost mx-auto mb-2" aria-label="Scroll to latest message" onclick={scrollToBottom}>
|
|
59
|
-
↓ Latest
|
|
60
|
-
</button>
|
|
61
|
-
{/if}
|
|
62
82
|
</section>
|
|
63
83
|
|
|
64
|
-
|
|
84
|
+
<svelte:window onresize={updateScrollState} />
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
import type { ChatMessage } from '../contracts.js';
|
|
3
|
-
type
|
|
4
|
+
export type ConversationProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'class'> & {
|
|
4
5
|
messages?: ChatMessage[];
|
|
5
6
|
isStreaming?: boolean;
|
|
6
7
|
class?: string;
|
|
7
8
|
children?: Snippet;
|
|
8
9
|
};
|
|
9
|
-
declare const Conversation: import("svelte").Component<
|
|
10
|
+
declare const Conversation: import("svelte").Component<ConversationProps, {}, "">;
|
|
10
11
|
type Conversation = ReturnType<typeof Conversation>;
|
|
11
12
|
export default Conversation;
|
|
@@ -1,17 +1,42 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export type ConversationContentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
3
12
|
import { useConversationContext } from '../context.svelte.js';
|
|
4
13
|
import { cn } from '../utils.js';
|
|
5
|
-
|
|
6
|
-
let {
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
class: className = '',
|
|
17
|
+
children,
|
|
18
|
+
role = 'log',
|
|
19
|
+
'aria-live': ariaLive,
|
|
20
|
+
'aria-busy': ariaBusy,
|
|
21
|
+
...rest
|
|
22
|
+
}: ConversationContentProps = $props();
|
|
7
23
|
let contentElement = $state<HTMLElement | null>(null);
|
|
8
24
|
const conversation = useConversationContext();
|
|
25
|
+
|
|
9
26
|
$effect(() => {
|
|
10
27
|
conversation.registerContent(contentElement);
|
|
11
28
|
return () => conversation.registerContent(null);
|
|
12
29
|
});
|
|
13
30
|
</script>
|
|
14
31
|
|
|
15
|
-
<div
|
|
32
|
+
<div
|
|
33
|
+
{...rest}
|
|
34
|
+
bind:this={contentElement}
|
|
35
|
+
class={cn('flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-4', className)}
|
|
36
|
+
{role}
|
|
37
|
+
aria-live={ariaLive ?? (conversation.isStreaming ? 'off' : 'polite')}
|
|
38
|
+
aria-busy={ariaBusy ?? conversation.isStreaming}
|
|
39
|
+
data-slot="conversation-content"
|
|
40
|
+
>
|
|
16
41
|
{@render children?.()}
|
|
17
42
|
</div>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export type ConversationContentProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
|
|
3
4
|
class?: string;
|
|
4
5
|
children?: Snippet;
|
|
5
6
|
};
|
|
6
|
-
declare const ConversationContent: import("svelte").Component<
|
|
7
|
+
declare const ConversationContent: import("svelte").Component<ConversationContentProps, {}, "">;
|
|
7
8
|
type ConversationContent = ReturnType<typeof ConversationContent>;
|
|
8
9
|
export default ConversationContent;
|
|
@@ -1,11 +1,37 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script module lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export type ConversationEmptyStateProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'title'> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon?: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
3
15
|
import { cn } from '../utils.js';
|
|
4
|
-
|
|
5
|
-
let {
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
title = 'No messages yet',
|
|
19
|
+
description = 'Start a conversation to see messages here',
|
|
20
|
+
icon,
|
|
21
|
+
class: className = '',
|
|
22
|
+
children,
|
|
23
|
+
...rest
|
|
24
|
+
}: ConversationEmptyStateProps = $props();
|
|
6
25
|
</script>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
|
|
27
|
+
<div {...rest} class={cn('flex size-full min-h-48 flex-col items-center justify-center gap-3 p-8 text-center', className)} data-slot="conversation-empty-state">
|
|
28
|
+
{#if children}
|
|
29
|
+
{@render children()}
|
|
30
|
+
{:else}
|
|
31
|
+
{#if icon}<div class="text-muted-foreground" data-slot="conversation-empty-state-icon">{@render icon()}</div>{/if}
|
|
32
|
+
<div class="space-y-1">
|
|
33
|
+
<h3 class="text-sm font-medium">{title}</h3>
|
|
34
|
+
{#if description}<p class="svadmin-ai__muted text-sm">{description}</p>{/if}
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
11
37
|
</div>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export type ConversationEmptyStateProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'title'> & {
|
|
3
4
|
title?: string;
|
|
4
5
|
description?: string;
|
|
6
|
+
icon?: Snippet;
|
|
5
7
|
class?: string;
|
|
6
8
|
children?: Snippet;
|
|
7
9
|
};
|
|
8
|
-
declare const ConversationEmptyState: import("svelte").Component<
|
|
10
|
+
declare const ConversationEmptyState: import("svelte").Component<ConversationEmptyStateProps, {}, "">;
|
|
9
11
|
type ConversationEmptyState = ReturnType<typeof ConversationEmptyState>;
|
|
10
12
|
export default ConversationEmptyState;
|