@kitnai/chat 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +50 -0
  2. package/dist/custom-elements.json +125 -73
  3. package/dist/kitn-chat.es.js +1 -1
  4. package/dist/llms/llms-full.txt +24 -24
  5. package/dist/theme.tokens.css +25 -1
  6. package/frameworks/react/index.tsx +46 -24
  7. package/llms-full.txt +24 -24
  8. package/package.json +1 -1
  9. package/src/elements/chat-workspace.tsx +28 -2
  10. package/src/elements/chat.tsx +22 -1
  11. package/src/elements/compiled.css +1 -1
  12. package/src/elements/conversation-list.tsx +10 -1
  13. package/src/elements/element-meta.json +2003 -0
  14. package/src/elements/kitn-attachments.stories.tsx +9 -0
  15. package/src/elements/kitn-chain-of-thought.stories.tsx +9 -0
  16. package/src/elements/kitn-chat-scope-picker.stories.tsx +9 -0
  17. package/src/elements/kitn-chat-workspace.stories.tsx +64 -14
  18. package/src/elements/kitn-chat.stories.tsx +58 -5
  19. package/src/elements/kitn-checkpoint.stories.tsx +9 -0
  20. package/src/elements/kitn-code-block.stories.tsx +9 -0
  21. package/src/elements/kitn-context-meter.stories.tsx +9 -0
  22. package/src/elements/kitn-conversation-list.stories.tsx +31 -10
  23. package/src/elements/kitn-empty.stories.tsx +9 -0
  24. package/src/elements/kitn-feedback-bar.stories.tsx +9 -0
  25. package/src/elements/kitn-file-upload.stories.tsx +9 -0
  26. package/src/elements/kitn-image.stories.tsx +9 -0
  27. package/src/elements/kitn-loader.stories.tsx +9 -0
  28. package/src/elements/kitn-markdown.stories.tsx +9 -0
  29. package/src/elements/kitn-message-skills.stories.tsx +9 -0
  30. package/src/elements/kitn-message.stories.tsx +9 -0
  31. package/src/elements/kitn-model-switcher.stories.tsx +9 -0
  32. package/src/elements/kitn-prompt-input.stories.tsx +35 -5
  33. package/src/elements/kitn-prompt-suggestions.stories.tsx +9 -0
  34. package/src/elements/kitn-reasoning.stories.tsx +9 -0
  35. package/src/elements/kitn-response-stream.stories.tsx +9 -0
  36. package/src/elements/kitn-source-list.stories.tsx +9 -0
  37. package/src/elements/kitn-source.stories.tsx +9 -0
  38. package/src/elements/kitn-text-shimmer.stories.tsx +9 -0
  39. package/src/elements/kitn-thinking-bar.stories.tsx +9 -0
  40. package/src/elements/kitn-tool.stories.tsx +9 -0
  41. package/src/elements/kitn-voice-input.stories.tsx +9 -0
  42. package/src/elements/prompt-input.tsx +2 -2
  43. package/src/elements/styles.css +21 -0
  44. package/src/stories/docs/element-controls.ts +28 -0
  45. package/src/stories/docs/element-spec.tsx +86 -0
  46. package/src/ui/scroll-area.tsx +1 -1
  47. package/theme.css +25 -1
@@ -240,14 +240,14 @@ _No events._
240
240
 
241
241
  | Event | `detail` type | Description |
242
242
  |---|---|---|
243
- | `messageaction` | `CustomEvent<unknown>` | |
244
- | `modelchange` | `CustomEvent<unknown>` | |
245
- | `search` | `CustomEvent<unknown>` | |
246
- | `slashselect` | `CustomEvent<unknown>` | |
247
- | `submit` | `CustomEvent<unknown>` | |
248
- | `suggestionclick` | `CustomEvent<unknown>` | |
249
- | `valuechange` | `CustomEvent<unknown>` | |
250
- | `voice` | `CustomEvent<unknown>` | |
243
+ | `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
244
+ | `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
245
+ | `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
246
+ | `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
247
+ | `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
248
+ | `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
249
+ | `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
250
+ | `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
251
251
 
252
252
  ---
253
253
 
@@ -306,17 +306,17 @@ _No events._
306
306
 
307
307
  | Event | `detail` type | Description |
308
308
  |---|---|---|
309
- | `conversationselect` | `CustomEvent<unknown>` | |
310
- | `messageaction` | `CustomEvent<unknown>` | |
311
- | `modelchange` | `CustomEvent<unknown>` | |
312
- | `newchat` | `CustomEvent<unknown>` | |
313
- | `search` | `CustomEvent<unknown>` | |
314
- | `sidebartoggle` | `CustomEvent<unknown>` | |
315
- | `slashselect` | `CustomEvent<unknown>` | |
316
- | `submit` | `CustomEvent<unknown>` | |
317
- | `suggestionclick` | `CustomEvent<unknown>` | |
318
- | `valuechange` | `CustomEvent<unknown>` | |
319
- | `voice` | `CustomEvent<unknown>` | |
309
+ | `conversationselect` | `CustomEvent<{ id: string }>` | A conversation was selected in the sidebar. |
310
+ | `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
311
+ | `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
312
+ | `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
313
+ | `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
314
+ | `sidebartoggle` | `CustomEvent<{ collapsed: false \| true }>` | The sidebar was collapsed or expanded. |
315
+ | `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
316
+ | `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
317
+ | `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
318
+ | `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
319
+ | `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
320
320
 
321
321
  ---
322
322
 
@@ -381,9 +381,9 @@ _No events._
381
381
 
382
382
  | Event | `detail` type | Description |
383
383
  |---|---|---|
384
- | `newchat` | `CustomEvent<unknown>` | |
385
- | `select` | `CustomEvent<unknown>` | |
386
- | `togglesidebar` | `CustomEvent<unknown>` | |
384
+ | `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
385
+ | `select` | `CustomEvent<{ id: string }>` | A conversation was selected. |
386
+ | `togglesidebar` | `CustomEvent<Record<string, never>>` | The sidebar toggle was clicked. |
387
387
 
388
388
  ---
389
389
 
@@ -555,12 +555,12 @@ _No events._
555
555
 
556
556
  | Event | `detail` type | Description |
557
557
  |---|---|---|
558
- | `search` | `CustomEvent<undefined>` | The Search (Globe) toolbar button was clicked. |
558
+ | `search` | `CustomEvent<Record<string, never>>` | The Search (Globe) toolbar button was clicked. |
559
559
  | `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
560
560
  | `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | The user submitted the prompt (Enter or send button) with its attachments. |
561
561
  | `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion was clicked while `suggestion-mode="fill"`. |
562
562
  | `valuechange` | `CustomEvent<{ value: string }>` | The input text changed (fires on every keystroke). |
563
- | `voice` | `CustomEvent<undefined>` | The Voice (Mic) toolbar button was clicked. |
563
+ | `voice` | `CustomEvent<Record<string, never>>` | The Voice (Mic) toolbar button was clicked. |
564
564
 
565
565
  ---
566
566
 
@@ -26,6 +26,12 @@
26
26
  brighter one for contrast on dark surfaces. Both clear WCAG 2.1 non-text
27
27
  contrast (≥3:1) against the kit's backgrounds. Override via --kitn-color-ring. */
28
28
  --color-ring: var(--kitn-color-ring, hsl(217 91% 53%));
29
+ /* Custom scrollbars — thin, rounded, subtle; thumb strengthens on hover. A
30
+ consistent cross-platform look (the kit styles its OWN scroll regions inside
31
+ the shadow root; the track stays transparent so nothing is forced where no
32
+ scrollbar is needed). Override via --kitn-color-scrollbar-thumb(-hover). */
33
+ --color-scrollbar-thumb: var(--kitn-color-scrollbar-thumb, hsl(240 5% 80%));
34
+ --color-scrollbar-thumb-hover: var(--kitn-color-scrollbar-thumb-hover, hsl(240 4% 64%));
29
35
  --color-sidebar: var(--kitn-color-sidebar, hsl(0 0% 100%));
30
36
  /* Inline `code` accent. Blue text on a translucent blue chip. */
31
37
  --color-code-foreground: var(--kitn-color-code-foreground, hsl(224.3 76.3% 48%));
@@ -91,6 +97,8 @@
91
97
  --color-border: var(--kitn-color-border, hsl(45 4% 17%));
92
98
  --color-input: var(--kitn-color-input, hsl(45 4% 17%));
93
99
  --color-ring: var(--kitn-color-ring, hsl(217 91% 68%));
100
+ --color-scrollbar-thumb: var(--kitn-color-scrollbar-thumb, hsl(45 3% 30%));
101
+ --color-scrollbar-thumb-hover: var(--kitn-color-scrollbar-thumb-hover, hsl(45 3% 42%));
94
102
  --color-sidebar: var(--kitn-color-sidebar, hsl(50 2% 7%));
95
103
  --color-code-foreground: var(--kitn-color-code-foreground, hsl(213 94% 78%));
96
104
 
@@ -134,4 +142,20 @@
134
142
  .chat-markdown th, .chat-markdown td { border: 1px solid var(--color-border); padding: 0.4em 0.6em; text-align: left; }
135
143
  .chat-markdown th { font-weight: 600; background: color-mix(in oklab, var(--color-muted-foreground) 8%, transparent); }
136
144
 
137
- .scrollbar-thin { scrollbar-width: thin; scrollbar-color: var(--color-muted) transparent; }
145
+ /* Cross-platform thin scrollbar utility (Firefox + WebKit). Used by ScrollArea
146
+ and any scroll region in the SolidJS-component build (web components also get
147
+ this globally inside their shadow root — see src/elements/styles.css). */
148
+ .scrollbar-thin {
149
+ scrollbar-width: thin;
150
+ scrollbar-color: var(--color-scrollbar-thumb) transparent;
151
+ }
152
+ .scrollbar-thin::-webkit-scrollbar { width: 8px; height: 8px; }
153
+ .scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
154
+ .scrollbar-thin::-webkit-scrollbar-thumb {
155
+ background-color: var(--color-scrollbar-thumb);
156
+ border-radius: 9999px;
157
+ border: 2px solid transparent;
158
+ background-clip: padding-box;
159
+ }
160
+ .scrollbar-thin::-webkit-scrollbar-thumb:hover { background-color: var(--color-scrollbar-thumb-hover); }
161
+ .scrollbar-thin::-webkit-scrollbar-corner { background: transparent; }
@@ -78,14 +78,22 @@ export interface KitnChatProps extends KitnBaseProps {
78
78
  slashActiveIds?: string[];
79
79
  /** Single-line palette rows. */
80
80
  slashCompact?: boolean;
81
- onMessageaction?: (event: CustomEvent<unknown>) => void;
82
- onModelchange?: (event: CustomEvent<unknown>) => void;
83
- onSearch?: (event: CustomEvent<unknown>) => void;
84
- onSlashselect?: (event: CustomEvent<unknown>) => void;
85
- onSubmit?: (event: CustomEvent<unknown>) => void;
86
- onSuggestionclick?: (event: CustomEvent<unknown>) => void;
87
- onValuechange?: (event: CustomEvent<unknown>) => void;
88
- onVoice?: (event: CustomEvent<unknown>) => void;
81
+ /** An action button on a message was clicked. */
82
+ onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
83
+ /** The header model switcher changed. */
84
+ onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
85
+ /** The Search button was clicked. */
86
+ onSearch?: (event: CustomEvent<Record<string, never>>) => void;
87
+ /** A slash command was chosen from the palette. */
88
+ onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
89
+ /** User submitted a message. */
90
+ onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
91
+ /** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
92
+ onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
93
+ /** Fired on every input change. */
94
+ onValuechange?: (event: CustomEvent<{ value: string }>) => void;
95
+ /** The Mic / voice button was clicked. */
96
+ onVoice?: (event: CustomEvent<Record<string, never>>) => void;
89
97
  }
90
98
 
91
99
  export const KitnChat = createKitnComponent<KitnChatProps>(
@@ -146,17 +154,28 @@ export interface KitnChatWorkspaceProps extends KitnBaseProps {
146
154
  sidebarMaxWidth?: number;
147
155
  /** Initial collapsed state of the sidebar (default false). */
148
156
  sidebarCollapsed?: boolean;
149
- onConversationselect?: (event: CustomEvent<unknown>) => void;
150
- onMessageaction?: (event: CustomEvent<unknown>) => void;
151
- onModelchange?: (event: CustomEvent<unknown>) => void;
152
- onNewchat?: (event: CustomEvent<unknown>) => void;
153
- onSearch?: (event: CustomEvent<unknown>) => void;
154
- onSidebartoggle?: (event: CustomEvent<unknown>) => void;
155
- onSlashselect?: (event: CustomEvent<unknown>) => void;
156
- onSubmit?: (event: CustomEvent<unknown>) => void;
157
- onSuggestionclick?: (event: CustomEvent<unknown>) => void;
158
- onValuechange?: (event: CustomEvent<unknown>) => void;
159
- onVoice?: (event: CustomEvent<unknown>) => void;
157
+ /** A conversation was selected in the sidebar. */
158
+ onConversationselect?: (event: CustomEvent<{ id: string }>) => void;
159
+ /** An action button on a message was clicked. */
160
+ onMessageaction?: (event: CustomEvent<{ messageId: string; action: "copy" | "like" | "dislike" | "regenerate" | "edit" }>) => void;
161
+ /** The header model switcher changed. */
162
+ onModelchange?: (event: CustomEvent<{ modelId: string }>) => void;
163
+ /** The "New chat" button was clicked. */
164
+ onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
165
+ /** The Search button was clicked. */
166
+ onSearch?: (event: CustomEvent<Record<string, never>>) => void;
167
+ /** The sidebar was collapsed or expanded. */
168
+ onSidebartoggle?: (event: CustomEvent<{ collapsed: boolean }>) => void;
169
+ /** A slash command was chosen from the palette. */
170
+ onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
171
+ /** User submitted a message. */
172
+ onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
173
+ /** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
174
+ onSuggestionclick?: (event: CustomEvent<{ value: string }>) => void;
175
+ /** Fired on every input change. */
176
+ onValuechange?: (event: CustomEvent<{ value: string }>) => void;
177
+ /** The Mic / voice button was clicked. */
178
+ onVoice?: (event: CustomEvent<Record<string, never>>) => void;
160
179
  }
161
180
 
162
181
  export const KitnChatWorkspace = createKitnComponent<KitnChatWorkspaceProps>(
@@ -221,9 +240,12 @@ export interface KitnConversationListProps extends KitnBaseProps {
221
240
  conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
222
241
  /** The id of the currently-open conversation, highlighted in the list. */
223
242
  activeId?: string;
224
- onNewchat?: (event: CustomEvent<unknown>) => void;
225
- onSelect?: (event: CustomEvent<unknown>) => void;
226
- onTogglesidebar?: (event: CustomEvent<unknown>) => void;
243
+ /** The "New chat" button was clicked. */
244
+ onNewchat?: (event: CustomEvent<Record<string, never>>) => void;
245
+ /** A conversation was selected. */
246
+ onSelect?: (event: CustomEvent<{ id: string }>) => void;
247
+ /** The sidebar toggle was clicked. */
248
+ onTogglesidebar?: (event: CustomEvent<Record<string, never>>) => void;
227
249
  }
228
250
 
229
251
  export const KitnConversationList = createKitnComponent<KitnConversationListProps>(
@@ -407,7 +429,7 @@ export interface KitnPromptInputProps extends KitnBaseProps {
407
429
  /** Attachments to seed the input with (so a consumer can pre-populate staged files without an upload). Set as a JS property; the element then manages its own attachment state from there (add via the paperclip, remove per chip). */
408
430
  attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[];
409
431
  /** The Search (Globe) toolbar button was clicked. */
410
- onSearch?: (event: CustomEvent<undefined>) => void;
432
+ onSearch?: (event: CustomEvent<Record<string, never>>) => void;
411
433
  /** A slash command was chosen from the palette. */
412
434
  onSlashselect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
413
435
  /** The user submitted the prompt (Enter or send button) with its attachments. */
@@ -417,7 +439,7 @@ export interface KitnPromptInputProps extends KitnBaseProps {
417
439
  /** The input text changed (fires on every keystroke). */
418
440
  onValuechange?: (event: CustomEvent<{ value: string }>) => void;
419
441
  /** The Voice (Mic) toolbar button was clicked. */
420
- onVoice?: (event: CustomEvent<undefined>) => void;
442
+ onVoice?: (event: CustomEvent<Record<string, never>>) => void;
421
443
  }
422
444
 
423
445
  export const KitnPromptInput = createKitnComponent<KitnPromptInputProps>(
package/llms-full.txt CHANGED
@@ -240,14 +240,14 @@ _No events._
240
240
 
241
241
  | Event | `detail` type | Description |
242
242
  |---|---|---|
243
- | `messageaction` | `CustomEvent<unknown>` | |
244
- | `modelchange` | `CustomEvent<unknown>` | |
245
- | `search` | `CustomEvent<unknown>` | |
246
- | `slashselect` | `CustomEvent<unknown>` | |
247
- | `submit` | `CustomEvent<unknown>` | |
248
- | `suggestionclick` | `CustomEvent<unknown>` | |
249
- | `valuechange` | `CustomEvent<unknown>` | |
250
- | `voice` | `CustomEvent<unknown>` | |
243
+ | `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
244
+ | `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
245
+ | `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
246
+ | `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
247
+ | `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
248
+ | `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
249
+ | `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
250
+ | `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
251
251
 
252
252
  ---
253
253
 
@@ -306,17 +306,17 @@ _No events._
306
306
 
307
307
  | Event | `detail` type | Description |
308
308
  |---|---|---|
309
- | `conversationselect` | `CustomEvent<unknown>` | |
310
- | `messageaction` | `CustomEvent<unknown>` | |
311
- | `modelchange` | `CustomEvent<unknown>` | |
312
- | `newchat` | `CustomEvent<unknown>` | |
313
- | `search` | `CustomEvent<unknown>` | |
314
- | `sidebartoggle` | `CustomEvent<unknown>` | |
315
- | `slashselect` | `CustomEvent<unknown>` | |
316
- | `submit` | `CustomEvent<unknown>` | |
317
- | `suggestionclick` | `CustomEvent<unknown>` | |
318
- | `valuechange` | `CustomEvent<unknown>` | |
319
- | `voice` | `CustomEvent<unknown>` | |
309
+ | `conversationselect` | `CustomEvent<{ id: string }>` | A conversation was selected in the sidebar. |
310
+ | `messageaction` | `CustomEvent<{ messageId: string; action: "copy" \| "like" \| "dislike" \| "regenerate" \| "edit" }>` | An action button on a message was clicked. |
311
+ | `modelchange` | `CustomEvent<{ modelId: string }>` | The header model switcher changed. |
312
+ | `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
313
+ | `search` | `CustomEvent<Record<string, never>>` | The Search button was clicked. |
314
+ | `sidebartoggle` | `CustomEvent<{ collapsed: false \| true }>` | The sidebar was collapsed or expanded. |
315
+ | `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
316
+ | `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | User submitted a message. |
317
+ | `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion chip was clicked (only in `suggestion-mode="fill"`). |
318
+ | `valuechange` | `CustomEvent<{ value: string }>` | Fired on every input change. |
319
+ | `voice` | `CustomEvent<Record<string, never>>` | The Mic / voice button was clicked. |
320
320
 
321
321
  ---
322
322
 
@@ -381,9 +381,9 @@ _No events._
381
381
 
382
382
  | Event | `detail` type | Description |
383
383
  |---|---|---|
384
- | `newchat` | `CustomEvent<unknown>` | |
385
- | `select` | `CustomEvent<unknown>` | |
386
- | `togglesidebar` | `CustomEvent<unknown>` | |
384
+ | `newchat` | `CustomEvent<Record<string, never>>` | The "New chat" button was clicked. |
385
+ | `select` | `CustomEvent<{ id: string }>` | A conversation was selected. |
386
+ | `togglesidebar` | `CustomEvent<Record<string, never>>` | The sidebar toggle was clicked. |
387
387
 
388
388
  ---
389
389
 
@@ -555,12 +555,12 @@ _No events._
555
555
 
556
556
  | Event | `detail` type | Description |
557
557
  |---|---|---|
558
- | `search` | `CustomEvent<undefined>` | The Search (Globe) toolbar button was clicked. |
558
+ | `search` | `CustomEvent<Record<string, never>>` | The Search (Globe) toolbar button was clicked. |
559
559
  | `slashselect` | `CustomEvent<{ command: { id: string; label: string; description?: undefined \| string; category?: undefined \| string } }>` | A slash command was chosen from the palette. |
560
560
  | `submit` | `CustomEvent<{ value: string; attachments: { id: string; type: "file" \| "source-document"; filename?: undefined \| string; mediaType?: undefined \| string; url?: undefined \| string; title?: undefined \| string }[] }>` | The user submitted the prompt (Enter or send button) with its attachments. |
561
561
  | `suggestionclick` | `CustomEvent<{ value: string }>` | A suggestion was clicked while `suggestion-mode="fill"`. |
562
562
  | `valuechange` | `CustomEvent<{ value: string }>` | The input text changed (fires on every keystroke). |
563
- | `voice` | `CustomEvent<undefined>` | The Voice (Mic) toolbar button was clicked. |
563
+ | `voice` | `CustomEvent<Record<string, never>>` | The Voice (Mic) toolbar button was clicked. |
564
564
 
565
565
  ---
566
566
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitnai/chat",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.",
6
6
  "keywords": [
@@ -5,8 +5,9 @@ import { ConversationList } from '../components/conversation-list';
5
5
  import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '../ui/resizable';
6
6
  import { Button } from '../ui/button';
7
7
  import { PanelLeftOpen } from 'lucide-solid';
8
+ import type { AttachmentData } from '../components/attachments';
8
9
  import type { SlashCommandItem } from '../components/slash-command';
9
- import type { ChatMessage } from './chat-types';
10
+ import type { ChatMessage, ChatMessageAction } from './chat-types';
10
11
  import type { ProseSize } from '../primitives/chat-config';
11
12
  import type { ModelOption, ConversationGroup, ConversationSummary } from '../types';
12
13
 
@@ -47,7 +48,32 @@ interface Props extends Record<string, unknown> {
47
48
  sidebarCollapsed?: boolean;
48
49
  }
49
50
 
50
- defineKitnElement<Props>('kitn-chat-workspace', {
51
+ interface Events {
52
+ /** A conversation was selected in the sidebar. */
53
+ conversationselect: { id: string };
54
+ /** The "New chat" button was clicked. */
55
+ newchat: Record<string, never>;
56
+ /** The sidebar was collapsed or expanded. */
57
+ sidebartoggle: { collapsed: boolean };
58
+ /** User submitted a message. */
59
+ submit: { value: string; attachments: AttachmentData[] };
60
+ /** Fired on every input change. */
61
+ valuechange: { value: string };
62
+ /** The header model switcher changed. */
63
+ modelchange: { modelId: string };
64
+ /** An action button on a message was clicked. */
65
+ messageaction: { messageId: string; action: ChatMessageAction };
66
+ /** The Search button was clicked. */
67
+ search: Record<string, never>;
68
+ /** The Mic / voice button was clicked. */
69
+ voice: Record<string, never>;
70
+ /** A slash command was chosen from the palette. */
71
+ slashselect: { command: SlashCommandItem };
72
+ /** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
73
+ suggestionclick: { value: string };
74
+ }
75
+
76
+ defineKitnElement<Props, Events>('kitn-chat-workspace', {
51
77
  groups: [], conversations: [], activeId: undefined, messages: [],
52
78
  value: undefined, placeholder: 'Send a message...', loading: false,
53
79
  suggestions: undefined, suggestionMode: 'submit', proseSize: 'sm',
@@ -1,14 +1,35 @@
1
1
  import { defineKitnElement } from './define';
2
2
  import { ChatThread, type ChatThreadProps, type ChatThreadContextUsage } from '../components/chat-thread';
3
+ import type { AttachmentData } from '../components/attachments';
3
4
  import type { SlashCommandItem } from '../components/slash-command';
4
5
  import type { ProseSize } from '../primitives/chat-config';
6
+ import type { ChatMessageAction } from './chat-types';
5
7
  import type { ModelOption } from '../types';
6
8
 
7
9
  type Props = Omit<ChatThreadProps,
8
10
  'class' | 'onValueChange' | 'onSubmit' | 'onSuggestionClick' | 'onModelChange'
9
11
  | 'onMessageAction' | 'onSearch' | 'onVoice' | 'onSlashSelect'> & Record<string, unknown>;
10
12
 
11
- defineKitnElement<Props>('kitn-chat', {
13
+ interface Events {
14
+ /** User submitted a message. */
15
+ submit: { value: string; attachments: AttachmentData[] };
16
+ /** Fired on every input change. */
17
+ valuechange: { value: string };
18
+ /** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
19
+ suggestionclick: { value: string };
20
+ /** An action button on a message was clicked. */
21
+ messageaction: { messageId: string; action: ChatMessageAction };
22
+ /** The header model switcher changed. */
23
+ modelchange: { modelId: string };
24
+ /** A slash command was chosen from the palette. */
25
+ slashselect: { command: SlashCommandItem };
26
+ /** The Search button was clicked. */
27
+ search: Record<string, never>;
28
+ /** The Mic / voice button was clicked. */
29
+ voice: Record<string, never>;
30
+ }
31
+
32
+ defineKitnElement<Props, Events>('kitn-chat', {
12
33
  messages: [], value: undefined, placeholder: 'Send a message...', loading: false,
13
34
  suggestions: undefined, suggestionMode: 'submit', proseSize: 'sm',
14
35
  codeTheme: 'github-dark-dimmed', codeHighlight: true, chatTitle: undefined,