@kitnai/chat 0.8.1 → 0.9.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/custom-elements.json +247 -0
- package/dist/kitn-chat.es.js +29 -29
- package/dist/llms/llms-full.txt +32 -4
- package/dist/llms/llms.txt +3 -3
- package/frameworks/react/index.tsx +47 -5
- package/llms-full.txt +32 -4
- package/llms.txt +3 -3
- package/package.json +1 -1
- package/src/components/artifact.tsx +241 -82
- package/src/components/card-fallback.tsx +28 -0
- package/src/components/card-renderer.tsx +52 -0
- package/src/components/component-meta.json +169 -12
- package/src/elements/artifact.stories.tsx +214 -0
- package/src/elements/artifact.tsx +95 -30
- package/src/elements/cards.stories.tsx +54 -0
- package/src/elements/cards.tsx +91 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/element-meta.json +156 -0
- package/src/elements/element-types.d.ts +34 -0
- package/src/elements/register.ts +1 -0
- package/src/elements/resizable.d.ts +27 -0
- package/src/elements/resizable.stories.tsx +226 -1
- package/src/elements/resizable.tsx +208 -3
- package/src/index.ts +10 -0
- package/src/primitives/card-registry.tsx +58 -0
- package/src/stories/docs/generative-ui-overview.mdx +59 -0
- package/src/ui/resizable.tsx +33 -4
package/dist/llms/llms-full.txt
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @kitnai/chat
|
|
5
5
|
|
|
6
|
-
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML.
|
|
6
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 39 `kitn-*` custom elements: streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -37,7 +37,7 @@ Drop an element into any framework (React, Vue, plain HTML). Data in via JS prop
|
|
|
37
37
|
- `<kc-prompt-input>` — standalone composer with send button.
|
|
38
38
|
|
|
39
39
|
**Layer 2 — composable primitives** (`import { … } from '@kitnai/chat'`):
|
|
40
|
-
All
|
|
40
|
+
All 39 elements are also exported individually. Use them for custom layouts or features `<kc-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
41
41
|
|
|
42
42
|
## Key rules for the web components
|
|
43
43
|
|
|
@@ -99,7 +99,7 @@ For Tailwind builds: `@import "@kitnai/chat/theme.css"` in your CSS.
|
|
|
99
99
|
|
|
100
100
|
## Docs
|
|
101
101
|
|
|
102
|
-
- Full element reference (all
|
|
102
|
+
- Full element reference (all 39 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
103
103
|
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitnai/chat/dist/custom-elements.json
|
|
104
104
|
- Working examples: https://github.com/kitn-ai/chat/tree/main/examples
|
|
105
105
|
- Storybook: https://storybook.kitn.dev
|
|
@@ -173,7 +173,7 @@ The same rule applies to every array/object property (`models`, `context`, `sugg
|
|
|
173
173
|
|
|
174
174
|
---
|
|
175
175
|
|
|
176
|
-
## Element reference (
|
|
176
|
+
## Element reference (39 elements, generated from custom-elements.json)
|
|
177
177
|
|
|
178
178
|
Every element also accepts the `theme` attribute. Array/object properties are marked with a `—` attribute: they must be set as JS properties.
|
|
179
179
|
|
|
@@ -189,12 +189,23 @@ Every element also accepts the `theme` attribute. Array/object properties are ma
|
|
|
189
189
|
| `activeFile` | `active-file` | `undefined \| string` | Selected file path — syncs the tree highlight, Code source, and preview. |
|
|
190
190
|
| `sandbox` | `sandbox` | `undefined \| string` | iframe `sandbox` override. Secure default `allow-scripts allow-forms` (NOT `allow-same-origin`). |
|
|
191
191
|
| `iframeTitle` | `iframe-title` | `undefined \| string` | Accessible title for the preview iframe. |
|
|
192
|
+
| `maximized` | `maximized` | `undefined \| false \| true` | Reflects the artifact's own maximized view-state (usually driven by the protocol). |
|
|
193
|
+
| `expandable` | `expandable` | `undefined \| false \| true` | Show the expand-to-fill button (OPT-IN). |
|
|
194
|
+
| `openInTab` | `open-in-tab` | `undefined \| false \| true` | Show the open-in-new-tab button (OPT-IN). |
|
|
195
|
+
| `noNav` | `no-nav` | `undefined \| false \| true` | Hide back/forward. |
|
|
196
|
+
| `noReload` | `no-reload` | `undefined \| false \| true` | Hide reload. |
|
|
197
|
+
| `noHome` | `no-home` | `undefined \| false \| true` | Hide home. |
|
|
198
|
+
| `noPathField` | `no-path-field` | `undefined \| false \| true` | Hide the address field. |
|
|
199
|
+
| `noTabs` | `no-tabs` | `undefined \| false \| true` | Hide the Preview\|Code toggle. |
|
|
200
|
+
| `standalone` | `standalone` | `undefined \| false \| true` | Standalone chrome: rounded corners + border (else square, borderless in-panel). |
|
|
201
|
+
| `readonlyPath` | `readonly-path` | `undefined \| false \| true` | Show the address but make it read-only (visible, nav-tracking, non-editable). |
|
|
192
202
|
|
|
193
203
|
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
194
204
|
|
|
195
205
|
| Event | `detail` type | Description |
|
|
196
206
|
|---|---|---|
|
|
197
207
|
| `fileselect` | `CustomEvent<{ path: string }>` | Fired when a file is selected. `detail.path`. |
|
|
208
|
+
| `maximizechange` | `CustomEvent<{ maximized: false \| true }>` | Artifact's own maximize button toggled (consumer-observable; non-bubbling). |
|
|
198
209
|
| `navigate` | `CustomEvent<{ url: string }>` | Fired when the preview navigates. `detail.url` = the new location. |
|
|
199
210
|
| `tabchange` | `CustomEvent<{ tab: "preview" \| "code" }>` | Fired when the Preview\|Code tab changes. `detail.tab`. |
|
|
200
211
|
|
|
@@ -236,6 +247,20 @@ _No events._
|
|
|
236
247
|
|
|
237
248
|
---
|
|
238
249
|
|
|
250
|
+
### `kc-cards` / `KcCards`
|
|
251
|
+
|
|
252
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
253
|
+
|
|
254
|
+
| Property | Attribute | Type | Description |
|
|
255
|
+
|---|---|---|---|
|
|
256
|
+
| `cards` | — | `undefined \| { type: string; id: string; data: unknown; title?: undefined \| string }[]` | The stream of card envelopes to render. Set as a JS PROPERTY: `el.cards = [...]`. |
|
|
257
|
+
| `types` | — | `undefined \| Record<string, string>` | Optional type→tag overrides/additions (merged over the built-ins). Property: `el.types`. Typed as a plain string map (not the `CardTagMap` alias) so the generated React wrapper inlines it instead of emitting an unresolved named type. |
|
|
258
|
+
| `policy` | — | `undefined \| { onSubmitData?: undefined \| (cardId: string, data: unknown) => void; onAction?: undefined \| (cardId: string, action: string, payload?: unknown) => void; onSendPrompt?: undefined \| (text: string, opts: { mode: "compose" \| "send"; context?: unknown; }) => void; onOpen?: undefined \| (url: string, target: "tab" \| "artifact") => void; onState?: undefined \| (cardId: string, patch: unknown) => void; onDismiss?: undefined \| (cardId: string) => void; onError?: undefined \| (cardId: string, message: string) => void; maxSendPromptMode?: undefined \| "compose" \| "send" }` | Optional CardPolicy handling child events. Property: `el.policy`. |
|
|
259
|
+
|
|
260
|
+
_No events._
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
239
264
|
### `kc-chain-of-thought` / `KcChainOfThought`
|
|
240
265
|
|
|
241
266
|
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
@@ -621,12 +646,14 @@ _No events._
|
|
|
621
646
|
| Property | Attribute | Type | Description |
|
|
622
647
|
|---|---|---|---|
|
|
623
648
|
| `orientation` | `orientation` | `undefined \| "horizontal" \| "vertical"` | Layout axis: `horizontal` (row, default) or `vertical` (column). |
|
|
649
|
+
| `maximizedIndex` | — | `undefined \| null \| number` | Which item index is maximized (null = none). Declarative source of truth. |
|
|
624
650
|
|
|
625
651
|
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
626
652
|
|
|
627
653
|
| Event | `detail` type | Description |
|
|
628
654
|
|---|---|---|
|
|
629
655
|
| `change` | `CustomEvent<{ sizes: number[] }>` | Fired on drag-end / keyboard resize / visibility change. `detail.sizes` = panel sizes in percent. |
|
|
656
|
+
| `maximizechange` | `CustomEvent<{ maximized: false \| true; index: null \| number }>` | Observe layout maximize state. |
|
|
630
657
|
|
|
631
658
|
---
|
|
632
659
|
|
|
@@ -647,6 +674,7 @@ _No events._
|
|
|
647
674
|
| Event | `detail` type | Description |
|
|
648
675
|
|---|---|---|
|
|
649
676
|
| `change` | `CustomEvent<unknown>` | |
|
|
677
|
+
| `maximizechange` | `CustomEvent<unknown>` | |
|
|
650
678
|
|
|
651
679
|
---
|
|
652
680
|
|
package/dist/llms/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AUTO-GENERATED by scripts/gen-llms.mjs — do not edit by hand. Run `npm run build`. -->
|
|
2
2
|
# @kitnai/chat
|
|
3
3
|
|
|
4
|
-
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML.
|
|
4
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 39 `kitn-*` custom elements: streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
@@ -35,7 +35,7 @@ Drop an element into any framework (React, Vue, plain HTML). Data in via JS prop
|
|
|
35
35
|
- `<kc-prompt-input>` — standalone composer with send button.
|
|
36
36
|
|
|
37
37
|
**Layer 2 — composable primitives** (`import { … } from '@kitnai/chat'`):
|
|
38
|
-
All
|
|
38
|
+
All 39 elements are also exported individually. Use them for custom layouts or features `<kc-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
39
39
|
|
|
40
40
|
## Key rules for the web components
|
|
41
41
|
|
|
@@ -97,7 +97,7 @@ For Tailwind builds: `@import "@kitnai/chat/theme.css"` in your CSS.
|
|
|
97
97
|
|
|
98
98
|
## Docs
|
|
99
99
|
|
|
100
|
-
- Full element reference (all
|
|
100
|
+
- Full element reference (all 39 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
101
101
|
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitnai/chat/dist/custom-elements.json
|
|
102
102
|
- Working examples: https://github.com/kitn-ai/chat/tree/main/examples
|
|
103
103
|
- Storybook: https://storybook.kitn.dev
|
|
@@ -18,8 +18,30 @@ export interface KcArtifactProps extends WebComponentProps {
|
|
|
18
18
|
sandbox?: string;
|
|
19
19
|
/** Accessible title for the preview iframe. */
|
|
20
20
|
iframeTitle?: string;
|
|
21
|
+
/** Reflects the artifact's own maximized view-state (usually driven by the protocol). */
|
|
22
|
+
maximized?: boolean;
|
|
23
|
+
/** Show the expand-to-fill button (OPT-IN). */
|
|
24
|
+
expandable?: boolean;
|
|
25
|
+
/** Show the open-in-new-tab button (OPT-IN). */
|
|
26
|
+
openInTab?: boolean;
|
|
27
|
+
/** Hide back/forward. */
|
|
28
|
+
noNav?: boolean;
|
|
29
|
+
/** Hide reload. */
|
|
30
|
+
noReload?: boolean;
|
|
31
|
+
/** Hide home. */
|
|
32
|
+
noHome?: boolean;
|
|
33
|
+
/** Hide the address field. */
|
|
34
|
+
noPathField?: boolean;
|
|
35
|
+
/** Hide the Preview|Code toggle. */
|
|
36
|
+
noTabs?: boolean;
|
|
37
|
+
/** Standalone chrome: rounded corners + border (else square, borderless in-panel). */
|
|
38
|
+
standalone?: boolean;
|
|
39
|
+
/** Show the address but make it read-only (visible, nav-tracking, non-editable). */
|
|
40
|
+
readonlyPath?: boolean;
|
|
21
41
|
/** Fired when a file is selected. `detail.path`. */
|
|
22
42
|
onFileselect?: (event: CustomEvent<{ path: string }>) => void;
|
|
43
|
+
/** Artifact's own maximize button toggled (consumer-observable; non-bubbling). */
|
|
44
|
+
onMaximizechange?: (event: CustomEvent<{ maximized: boolean }>) => void;
|
|
23
45
|
/** Fired when the preview navigates. `detail.url` = the new location. */
|
|
24
46
|
onNavigate?: (event: CustomEvent<{ url: string }>) => void;
|
|
25
47
|
/** Fired when the Preview|Code tab changes. `detail.tab`. */
|
|
@@ -28,8 +50,8 @@ export interface KcArtifactProps extends WebComponentProps {
|
|
|
28
50
|
|
|
29
51
|
export const KcArtifact = createWebComponent<KcArtifactProps>(
|
|
30
52
|
'kc-artifact',
|
|
31
|
-
["theme","src","files","tab","activeFile","sandbox","iframeTitle"],
|
|
32
|
-
{ onFileselect: 'fileselect', onNavigate: 'navigate', onTabchange: 'tabchange' },
|
|
53
|
+
["theme","src","files","tab","activeFile","sandbox","iframeTitle","maximized","expandable","openInTab","noNav","noReload","noHome","noPathField","noTabs","standalone","readonlyPath"],
|
|
54
|
+
{ onFileselect: 'fileselect', onMaximizechange: 'maximizechange', onNavigate: 'navigate', onTabchange: 'tabchange' },
|
|
33
55
|
);
|
|
34
56
|
|
|
35
57
|
export interface KcAttachmentsProps extends WebComponentProps {
|
|
@@ -72,6 +94,21 @@ export const KcCard = createWebComponent<KcCardProps>(
|
|
|
72
94
|
{ },
|
|
73
95
|
);
|
|
74
96
|
|
|
97
|
+
export interface KcCardsProps extends WebComponentProps {
|
|
98
|
+
/** The stream of card envelopes to render. Set as a JS PROPERTY: `el.cards = [...]`. */
|
|
99
|
+
cards?: { type: string; id: string; data: unknown; title?: string }[];
|
|
100
|
+
/** Optional type→tag overrides/additions (merged over the built-ins). Property: `el.types`. Typed as a plain string map (not the `CardTagMap` alias) so the generated React wrapper inlines it instead of emitting an unresolved named type. */
|
|
101
|
+
types?: Record<string, string>;
|
|
102
|
+
/** Optional CardPolicy handling child events. Property: `el.policy`. */
|
|
103
|
+
policy?: { onSubmitData?: (cardId: string, data: unknown) => void; onAction?: (cardId: string, action: string, payload?: unknown) => void; onSendPrompt?: (text: string, opts: { mode: "compose" | "send"; context?: unknown; }) => void; onOpen?: (url: string, target: "tab" | "artifact") => void; onState?: (cardId: string, patch: unknown) => void; onDismiss?: (cardId: string) => void; onError?: (cardId: string, message: string) => void; maxSendPromptMode?: "compose" | "send" };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const KcCards = createWebComponent<KcCardsProps>(
|
|
107
|
+
'kc-cards',
|
|
108
|
+
["theme","cards","types","policy"],
|
|
109
|
+
{ },
|
|
110
|
+
);
|
|
111
|
+
|
|
75
112
|
export interface KcChainOfThoughtProps extends WebComponentProps {
|
|
76
113
|
/** The reasoning steps. Set as a JS property. Compound sub-parts collapse to this one data model (Route 1). */
|
|
77
114
|
steps: { label: string; content?: undefined | string }[];
|
|
@@ -498,14 +535,18 @@ export const KcReasoning = createWebComponent<KcReasoningProps>(
|
|
|
498
535
|
export interface KcResizableProps extends WebComponentProps {
|
|
499
536
|
/** Layout axis: `horizontal` (row, default) or `vertical` (column). */
|
|
500
537
|
orientation?: "horizontal" | "vertical";
|
|
538
|
+
/** Which item index is maximized (null = none). Declarative source of truth. */
|
|
539
|
+
maximizedIndex?: null | number;
|
|
501
540
|
/** Fired on drag-end / keyboard resize / visibility change. `detail.sizes` = panel sizes in percent. */
|
|
502
541
|
onChange?: (event: CustomEvent<{ sizes: number[] }>) => void;
|
|
542
|
+
/** Observe layout maximize state. */
|
|
543
|
+
onMaximizechange?: (event: CustomEvent<{ maximized: boolean; index: null | number }>) => void;
|
|
503
544
|
}
|
|
504
545
|
|
|
505
546
|
export const KcResizable = createWebComponent<KcResizableProps>(
|
|
506
547
|
'kc-resizable',
|
|
507
|
-
["theme","orientation"],
|
|
508
|
-
{ onChange: 'change' },
|
|
548
|
+
["theme","orientation","maximizedIndex"],
|
|
549
|
+
{ onChange: 'change', onMaximizechange: 'maximizechange' },
|
|
509
550
|
);
|
|
510
551
|
|
|
511
552
|
export interface KcResizableItemProps extends WebComponentProps {
|
|
@@ -520,12 +561,13 @@ export interface KcResizableItemProps extends WebComponentProps {
|
|
|
520
561
|
/** Hide this panel; its divider is dropped and the rest reflow. */
|
|
521
562
|
hidden?: boolean;
|
|
522
563
|
onChange?: (event: CustomEvent<unknown>) => void;
|
|
564
|
+
onMaximizechange?: (event: CustomEvent<unknown>) => void;
|
|
523
565
|
}
|
|
524
566
|
|
|
525
567
|
export const KcResizableItem = createWebComponent<KcResizableItemProps>(
|
|
526
568
|
'kc-resizable-item',
|
|
527
569
|
["theme","size","min","max","locked","hidden"],
|
|
528
|
-
{ onChange: 'change' },
|
|
570
|
+
{ onChange: 'change', onMaximizechange: 'maximizechange' },
|
|
529
571
|
);
|
|
530
572
|
|
|
531
573
|
export interface KcResponseStreamProps extends WebComponentProps {
|
package/llms-full.txt
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @kitnai/chat
|
|
5
5
|
|
|
6
|
-
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML.
|
|
6
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 39 `kitn-*` custom elements: streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -37,7 +37,7 @@ Drop an element into any framework (React, Vue, plain HTML). Data in via JS prop
|
|
|
37
37
|
- `<kc-prompt-input>` — standalone composer with send button.
|
|
38
38
|
|
|
39
39
|
**Layer 2 — composable primitives** (`import { … } from '@kitnai/chat'`):
|
|
40
|
-
All
|
|
40
|
+
All 39 elements are also exported individually. Use them for custom layouts or features `<kc-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
41
41
|
|
|
42
42
|
## Key rules for the web components
|
|
43
43
|
|
|
@@ -99,7 +99,7 @@ For Tailwind builds: `@import "@kitnai/chat/theme.css"` in your CSS.
|
|
|
99
99
|
|
|
100
100
|
## Docs
|
|
101
101
|
|
|
102
|
-
- Full element reference (all
|
|
102
|
+
- Full element reference (all 39 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
103
103
|
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitnai/chat/dist/custom-elements.json
|
|
104
104
|
- Working examples: https://github.com/kitn-ai/chat/tree/main/examples
|
|
105
105
|
- Storybook: https://storybook.kitn.dev
|
|
@@ -173,7 +173,7 @@ The same rule applies to every array/object property (`models`, `context`, `sugg
|
|
|
173
173
|
|
|
174
174
|
---
|
|
175
175
|
|
|
176
|
-
## Element reference (
|
|
176
|
+
## Element reference (39 elements, generated from custom-elements.json)
|
|
177
177
|
|
|
178
178
|
Every element also accepts the `theme` attribute. Array/object properties are marked with a `—` attribute: they must be set as JS properties.
|
|
179
179
|
|
|
@@ -189,12 +189,23 @@ Every element also accepts the `theme` attribute. Array/object properties are ma
|
|
|
189
189
|
| `activeFile` | `active-file` | `undefined \| string` | Selected file path — syncs the tree highlight, Code source, and preview. |
|
|
190
190
|
| `sandbox` | `sandbox` | `undefined \| string` | iframe `sandbox` override. Secure default `allow-scripts allow-forms` (NOT `allow-same-origin`). |
|
|
191
191
|
| `iframeTitle` | `iframe-title` | `undefined \| string` | Accessible title for the preview iframe. |
|
|
192
|
+
| `maximized` | `maximized` | `undefined \| false \| true` | Reflects the artifact's own maximized view-state (usually driven by the protocol). |
|
|
193
|
+
| `expandable` | `expandable` | `undefined \| false \| true` | Show the expand-to-fill button (OPT-IN). |
|
|
194
|
+
| `openInTab` | `open-in-tab` | `undefined \| false \| true` | Show the open-in-new-tab button (OPT-IN). |
|
|
195
|
+
| `noNav` | `no-nav` | `undefined \| false \| true` | Hide back/forward. |
|
|
196
|
+
| `noReload` | `no-reload` | `undefined \| false \| true` | Hide reload. |
|
|
197
|
+
| `noHome` | `no-home` | `undefined \| false \| true` | Hide home. |
|
|
198
|
+
| `noPathField` | `no-path-field` | `undefined \| false \| true` | Hide the address field. |
|
|
199
|
+
| `noTabs` | `no-tabs` | `undefined \| false \| true` | Hide the Preview\|Code toggle. |
|
|
200
|
+
| `standalone` | `standalone` | `undefined \| false \| true` | Standalone chrome: rounded corners + border (else square, borderless in-panel). |
|
|
201
|
+
| `readonlyPath` | `readonly-path` | `undefined \| false \| true` | Show the address but make it read-only (visible, nav-tracking, non-editable). |
|
|
192
202
|
|
|
193
203
|
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
194
204
|
|
|
195
205
|
| Event | `detail` type | Description |
|
|
196
206
|
|---|---|---|
|
|
197
207
|
| `fileselect` | `CustomEvent<{ path: string }>` | Fired when a file is selected. `detail.path`. |
|
|
208
|
+
| `maximizechange` | `CustomEvent<{ maximized: false \| true }>` | Artifact's own maximize button toggled (consumer-observable; non-bubbling). |
|
|
198
209
|
| `navigate` | `CustomEvent<{ url: string }>` | Fired when the preview navigates. `detail.url` = the new location. |
|
|
199
210
|
| `tabchange` | `CustomEvent<{ tab: "preview" \| "code" }>` | Fired when the Preview\|Code tab changes. `detail.tab`. |
|
|
200
211
|
|
|
@@ -236,6 +247,20 @@ _No events._
|
|
|
236
247
|
|
|
237
248
|
---
|
|
238
249
|
|
|
250
|
+
### `kc-cards` / `KcCards`
|
|
251
|
+
|
|
252
|
+
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
253
|
+
|
|
254
|
+
| Property | Attribute | Type | Description |
|
|
255
|
+
|---|---|---|---|
|
|
256
|
+
| `cards` | — | `undefined \| { type: string; id: string; data: unknown; title?: undefined \| string }[]` | The stream of card envelopes to render. Set as a JS PROPERTY: `el.cards = [...]`. |
|
|
257
|
+
| `types` | — | `undefined \| Record<string, string>` | Optional type→tag overrides/additions (merged over the built-ins). Property: `el.types`. Typed as a plain string map (not the `CardTagMap` alias) so the generated React wrapper inlines it instead of emitting an unresolved named type. |
|
|
258
|
+
| `policy` | — | `undefined \| { onSubmitData?: undefined \| (cardId: string, data: unknown) => void; onAction?: undefined \| (cardId: string, action: string, payload?: unknown) => void; onSendPrompt?: undefined \| (text: string, opts: { mode: "compose" \| "send"; context?: unknown; }) => void; onOpen?: undefined \| (url: string, target: "tab" \| "artifact") => void; onState?: undefined \| (cardId: string, patch: unknown) => void; onDismiss?: undefined \| (cardId: string) => void; onError?: undefined \| (cardId: string, message: string) => void; maxSendPromptMode?: undefined \| "compose" \| "send" }` | Optional CardPolicy handling child events. Property: `el.policy`. |
|
|
259
|
+
|
|
260
|
+
_No events._
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
239
264
|
### `kc-chain-of-thought` / `KcChainOfThought`
|
|
240
265
|
|
|
241
266
|
**Properties** (every element also accepts `theme="light|dark|auto"`; only scalar props work as HTML attributes):
|
|
@@ -621,12 +646,14 @@ _No events._
|
|
|
621
646
|
| Property | Attribute | Type | Description |
|
|
622
647
|
|---|---|---|---|
|
|
623
648
|
| `orientation` | `orientation` | `undefined \| "horizontal" \| "vertical"` | Layout axis: `horizontal` (row, default) or `vertical` (column). |
|
|
649
|
+
| `maximizedIndex` | — | `undefined \| null \| number` | Which item index is maximized (null = none). Declarative source of truth. |
|
|
624
650
|
|
|
625
651
|
**Events** (non-bubbling `CustomEvent`s — listen directly on the element):
|
|
626
652
|
|
|
627
653
|
| Event | `detail` type | Description |
|
|
628
654
|
|---|---|---|
|
|
629
655
|
| `change` | `CustomEvent<{ sizes: number[] }>` | Fired on drag-end / keyboard resize / visibility change. `detail.sizes` = panel sizes in percent. |
|
|
656
|
+
| `maximizechange` | `CustomEvent<{ maximized: false \| true; index: null \| number }>` | Observe layout maximize state. |
|
|
630
657
|
|
|
631
658
|
---
|
|
632
659
|
|
|
@@ -647,6 +674,7 @@ _No events._
|
|
|
647
674
|
| Event | `detail` type | Description |
|
|
648
675
|
|---|---|---|
|
|
649
676
|
| `change` | `CustomEvent<unknown>` | |
|
|
677
|
+
| `maximizechange` | `CustomEvent<unknown>` | |
|
|
650
678
|
|
|
651
679
|
---
|
|
652
680
|
|
package/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AUTO-GENERATED by scripts/gen-llms.mjs — do not edit by hand. Run `npm run build`. -->
|
|
2
2
|
# @kitnai/chat
|
|
3
3
|
|
|
4
|
-
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML.
|
|
4
|
+
> Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. 39 `kitn-*` custom elements: streaming responses, markdown + code rendering, reasoning/tool panels, attachments, conversation sidebar, voice input. Zero framework dependency for consumers; the SolidJS runtime it is authored in is bundled in, so the host needs nothing.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
@@ -35,7 +35,7 @@ Drop an element into any framework (React, Vue, plain HTML). Data in via JS prop
|
|
|
35
35
|
- `<kc-prompt-input>` — standalone composer with send button.
|
|
36
36
|
|
|
37
37
|
**Layer 2 — composable primitives** (`import { … } from '@kitnai/chat'`):
|
|
38
|
-
All
|
|
38
|
+
All 39 elements are also exported individually. Use them for custom layouts or features `<kc-chat>` does not expose (ChainOfThought, FeedbackBar, ThinkingBar, VoiceInput, …). Your bundler tree-shakes the rest.
|
|
39
39
|
|
|
40
40
|
## Key rules for the web components
|
|
41
41
|
|
|
@@ -97,7 +97,7 @@ For Tailwind builds: `@import "@kitnai/chat/theme.css"` in your CSS.
|
|
|
97
97
|
|
|
98
98
|
## Docs
|
|
99
99
|
|
|
100
|
-
- Full element reference (all
|
|
100
|
+
- Full element reference (all 39 elements, every prop/event): ./llms-full.txt — https://kitn.dev/llms-full.txt
|
|
101
101
|
- Machine-readable Custom Elements Manifest: https://unpkg.com/@kitnai/chat/dist/custom-elements.json
|
|
102
102
|
- Working examples: https://github.com/kitn-ai/chat/tree/main/examples
|
|
103
103
|
- Storybook: https://storybook.kitn.dev
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitnai/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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": [
|