@kitnai/chat 0.6.0 → 0.8.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 +9 -9
- package/dist/custom-elements.json +1676 -881
- package/dist/kitn-chat.es.js +36 -36
- package/dist/llms/llms-full.txt +316 -155
- package/dist/llms/llms.txt +18 -18
- package/dist/schemas/card-envelope.schema.json +14 -0
- package/dist/schemas/card-event.schema.json +12 -0
- package/dist/schemas/confirm.schema.json +65 -0
- package/dist/schemas/embed.schema.json +65 -0
- package/dist/schemas/form.result.schema.json +7 -0
- package/dist/schemas/form.schema.json +33 -0
- package/dist/schemas/link.schema.json +56 -0
- package/dist/schemas/task-list.result.schema.json +16 -0
- package/dist/schemas/task-list.schema.json +78 -0
- package/dist/theme.tokens.css +65 -65
- package/dist/tsx-B8rCNbgL.js +1 -0
- package/dist/typescript-RycA9KXf.js +1 -0
- package/frameworks/react/index.tsx +382 -193
- package/frameworks/react/runtime.tsx +2 -2
- package/llms-full.txt +316 -155
- package/llms.txt +18 -18
- package/package.json +5 -2
- package/src/components/artifact.stories.tsx +138 -0
- package/src/components/artifact.tsx +581 -0
- package/src/components/attachments.stories.tsx +7 -8
- package/src/components/attachments.tsx +2 -2
- package/src/components/card.tsx +110 -0
- package/src/components/chain-of-thought.stories.tsx +7 -8
- package/src/components/chat-container.stories.tsx +7 -8
- package/src/components/chat-container.tsx +4 -0
- package/src/components/checkpoint.stories.tsx +7 -8
- package/src/components/code-block.stories.tsx +8 -9
- package/src/components/component-meta.json +3411 -0
- package/src/components/confirm-card.stories.tsx +74 -0
- package/src/components/confirm-card.tsx +299 -0
- package/src/components/context.stories.tsx +7 -8
- package/src/components/conversation-item.stories.tsx +7 -8
- package/src/components/conversation-item.tsx +2 -2
- package/src/components/conversation-list.stories.tsx +7 -8
- package/src/components/conversation-list.tsx +1 -1
- package/src/components/embed.tsx +196 -0
- package/src/components/empty.stories.tsx +8 -9
- package/src/components/feedback-bar.stories.tsx +7 -8
- package/src/components/file-tree.stories.tsx +73 -0
- package/src/components/file-tree.tsx +383 -0
- package/src/components/file-upload.stories.tsx +7 -8
- package/src/components/form-widgets.tsx +461 -0
- package/src/components/form.tsx +796 -0
- package/src/components/image.stories.tsx +7 -8
- package/src/components/link-card.tsx +194 -0
- package/src/components/loader.stories.tsx +7 -8
- package/src/components/markdown.stories.tsx +7 -8
- package/src/components/message-narrow.stories.tsx +12 -13
- package/src/components/message-skills.stories.tsx +16 -17
- package/src/components/message.stories.tsx +17 -18
- package/src/components/model-switcher.stories.tsx +7 -8
- package/src/components/prompt-input.stories.tsx +8 -9
- package/src/components/prompt-suggestion.stories.tsx +7 -8
- package/src/components/prompt-suggestion.tsx +3 -3
- package/src/components/reasoning.stories.tsx +7 -8
- package/src/components/scroll-button.stories.tsx +7 -8
- package/src/components/slash-command.stories.tsx +8 -9
- package/src/components/slash-command.tsx +2 -2
- package/src/components/source.stories.tsx +7 -8
- package/src/components/source.tsx +1 -1
- package/src/components/task-list-card.stories.tsx +78 -0
- package/src/components/task-list-card.tsx +388 -0
- package/src/components/text-shimmer.stories.tsx +7 -8
- package/src/components/thinking-bar.stories.tsx +7 -8
- package/src/components/tool.stories.tsx +7 -8
- package/src/components/tool.tsx +2 -2
- package/src/components/voice-input.stories.tsx +7 -8
- package/src/elements/artifact.stories.tsx +291 -0
- package/src/elements/artifact.tsx +72 -0
- package/src/elements/{kitn-attachments.stories.tsx → attachments.stories.tsx} +11 -11
- package/src/elements/attachments.tsx +4 -4
- package/src/elements/card.stories.tsx +118 -0
- package/src/elements/card.tsx +40 -0
- package/src/elements/catalog.stories.tsx +491 -0
- package/src/elements/{kitn-chain-of-thought.stories.tsx → chain-of-thought.stories.tsx} +13 -13
- package/src/elements/chain-of-thought.tsx +3 -3
- package/src/elements/{kitn-chat-scope-picker.stories.tsx → chat-scope-picker.stories.tsx} +10 -10
- package/src/elements/chat-scope-picker.tsx +4 -4
- package/src/elements/{kitn-chat-workspace.stories.tsx → chat-workspace.stories.tsx} +71 -29
- package/src/elements/chat-workspace.tsx +29 -3
- package/src/elements/{kitn-chat.stories.tsx → chat.stories.tsx} +61 -16
- package/src/elements/chat.tsx +23 -2
- package/src/elements/{kitn-checkpoint.stories.tsx → checkpoint.stories.tsx} +11 -11
- package/src/elements/checkpoint.tsx +4 -4
- package/src/elements/{kitn-code-block.stories.tsx → code-block.stories.tsx} +10 -10
- package/src/elements/code-block.tsx +3 -3
- package/src/elements/compiled.css +1 -1
- package/src/elements/composed-shell.stories.tsx +316 -0
- package/src/elements/confirm-card.stories.tsx +186 -0
- package/src/elements/confirm-card.tsx +45 -0
- package/src/elements/{kitn-context-meter.stories.tsx → context-meter.stories.tsx} +10 -10
- package/src/elements/context-meter.tsx +3 -3
- package/src/elements/{kitn-conversation-list.stories.tsx → conversation-list.stories.tsx} +35 -22
- package/src/elements/conversation-list.tsx +11 -2
- package/src/elements/css.ts +1 -1
- package/src/elements/define.tsx +10 -10
- package/src/elements/element-meta.json +2649 -0
- package/src/elements/element-types.d.ts +251 -125
- package/src/elements/embed.stories.tsx +197 -0
- package/src/elements/embed.tsx +35 -0
- package/src/elements/{kitn-empty.stories.tsx → empty.stories.tsx} +12 -12
- package/src/elements/empty.tsx +3 -3
- package/src/elements/{kitn-feedback-bar.stories.tsx → feedback-bar.stories.tsx} +11 -11
- package/src/elements/feedback-bar.tsx +4 -4
- package/src/elements/file-tree.stories.tsx +133 -0
- package/src/elements/file-tree.tsx +52 -0
- package/src/elements/{kitn-file-upload.stories.tsx → file-upload.stories.tsx} +12 -12
- package/src/elements/file-upload.tsx +4 -4
- package/src/elements/form.stories.tsx +204 -0
- package/src/elements/form.tsx +37 -0
- package/src/elements/{kitn-image.stories.tsx → image.stories.tsx} +10 -10
- package/src/elements/image.tsx +3 -3
- package/src/elements/link-card.stories.tsx +193 -0
- package/src/elements/link-card.tsx +34 -0
- package/src/elements/{kitn-loader.stories.tsx → loader.stories.tsx} +11 -11
- package/src/elements/loader.tsx +3 -3
- package/src/elements/{kitn-markdown.stories.tsx → markdown.stories.tsx} +10 -10
- package/src/elements/markdown.tsx +3 -3
- package/src/elements/{kitn-message-skills.stories.tsx → message-skills.stories.tsx} +10 -10
- package/src/elements/message-skills.tsx +3 -3
- package/src/elements/{kitn-message.stories.tsx → message.stories.tsx} +12 -12
- package/src/elements/message.tsx +5 -5
- package/src/elements/{kitn-model-switcher.stories.tsx → model-switcher.stories.tsx} +10 -10
- package/src/elements/model-switcher.tsx +5 -5
- package/src/elements/{kitn-prompt-input.stories.tsx → prompt-input.stories.tsx} +41 -19
- package/src/elements/prompt-input.tsx +5 -5
- package/src/elements/{kitn-prompt-suggestions.stories.tsx → prompt-suggestions.stories.tsx} +13 -13
- package/src/elements/prompt-suggestions.tsx +4 -4
- package/src/elements/{kitn-reasoning.stories.tsx → reasoning.stories.tsx} +10 -10
- package/src/elements/reasoning.tsx +4 -4
- package/src/elements/register.ts +11 -1
- package/src/elements/resizable.stories.tsx +200 -0
- package/src/elements/resizable.tsx +264 -0
- package/src/elements/{kitn-response-stream.stories.tsx → response-stream.stories.tsx} +10 -10
- package/src/elements/response-stream.tsx +4 -4
- package/src/elements/{kitn-source-list.stories.tsx → source-list.stories.tsx} +11 -11
- package/src/elements/{kitn-source.stories.tsx → source.stories.tsx} +12 -12
- package/src/elements/source.tsx +5 -5
- package/src/elements/styles.css +140 -1
- package/src/elements/task-list-card.stories.tsx +194 -0
- package/src/elements/task-list-card.tsx +40 -0
- package/src/elements/{kitn-text-shimmer.stories.tsx → text-shimmer.stories.tsx} +10 -10
- package/src/elements/text-shimmer.tsx +3 -3
- package/src/elements/{kitn-thinking-bar.stories.tsx → thinking-bar.stories.tsx} +11 -11
- package/src/elements/thinking-bar.tsx +5 -5
- package/src/elements/{kitn-tool.stories.tsx → tool.stories.tsx} +10 -10
- package/src/elements/tool.tsx +3 -3
- package/src/elements/{kitn-voice-input.stories.tsx → voice-input.stories.tsx} +10 -10
- package/src/elements/voice-input.tsx +4 -4
- package/src/index.ts +94 -2
- package/src/primitives/card-contract.ts +60 -0
- package/src/primitives/card-host.tsx +35 -0
- package/src/primitives/card-routing.ts +79 -0
- package/src/primitives/card-schemas/card-envelope.schema.json +14 -0
- package/src/primitives/card-schemas/card-event.schema.json +12 -0
- package/src/primitives/card-schemas/confirm.schema.json +65 -0
- package/src/primitives/card-schemas/embed.schema.json +65 -0
- package/src/primitives/card-schemas/form.result.schema.json +7 -0
- package/src/primitives/card-schemas/form.schema.json +33 -0
- package/src/primitives/card-schemas/link.schema.json +56 -0
- package/src/primitives/card-schemas/task-list.result.schema.json +16 -0
- package/src/primitives/card-schemas/task-list.schema.json +78 -0
- package/src/primitives/card-validate.ts +95 -0
- package/src/primitives/embed-providers.ts +254 -0
- package/src/primitives/highlighter.ts +4 -0
- package/src/primitives/link-preview.ts +87 -0
- package/src/primitives/pdf-preview.ts +121 -0
- package/src/stories/chat-panel-layout.stories.tsx +2 -1
- package/src/stories/chat-scene.tsx +22 -21
- package/src/stories/checkpoint-restore.stories.tsx +10 -10
- package/src/stories/conversation-with-reasoning.stories.tsx +4 -4
- package/src/stories/conversation-with-sources.stories.tsx +7 -7
- package/src/stories/docs/Accessibility.mdx +2 -2
- package/src/stories/docs/ForAIAgents.mdx +3 -3
- package/src/stories/docs/GettingStarted.mdx +2 -2
- package/src/stories/docs/Installation.mdx +2 -2
- package/src/stories/docs/Integrations.mdx +29 -29
- package/src/stories/docs/Introduction.mdx +3 -3
- package/src/stories/docs/Theming.mdx +2 -2
- package/src/stories/docs/element-controls.ts +60 -0
- package/src/stories/docs/theme-editor/theme-editor.tsx +1 -0
- package/src/stories/examples/ChoosingComponents.mdx +94 -0
- package/src/stories/examples/sample-data.ts +79 -0
- package/src/stories/message-actions.stories.tsx +13 -13
- package/src/stories/pattern-centered-conversation.stories.tsx +3 -3
- package/src/stories/pattern-docked-widget.stories.tsx +1 -1
- package/src/stories/pattern-empty-state.stories.tsx +3 -3
- package/src/stories/prompt-input-variants.stories.tsx +13 -13
- package/src/stories/streaming-response.stories.tsx +3 -3
- package/src/stories/typography.stories.tsx +4 -4
- package/src/ui/avatar.stories.tsx +7 -8
- package/src/ui/badge.stories.tsx +7 -8
- package/src/ui/button.stories.tsx +8 -9
- package/src/ui/button.tsx +1 -0
- package/src/ui/collapsible.stories.tsx +6 -7
- package/src/ui/dropdown.stories.tsx +6 -7
- package/src/ui/hover-card.stories.tsx +6 -7
- package/src/ui/resizable.stories.tsx +74 -9
- package/src/ui/resizable.tsx +351 -71
- package/src/ui/scroll-area.stories.tsx +6 -7
- package/src/ui/scroll-area.tsx +3 -1
- package/src/ui/separator.stories.tsx +7 -8
- package/src/ui/skeleton.stories.tsx +7 -8
- package/src/ui/textarea.stories.tsx +6 -7
- package/src/ui/tooltip.stories.tsx +8 -9
- package/theme.css +65 -65
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
2
|
import { onMount } from 'solid-js';
|
|
3
3
|
import './register'; // side effect: registers the custom elements
|
|
4
|
+
import { argTypesFor, specDescription } from '../stories/docs/element-controls';
|
|
4
5
|
|
|
5
6
|
// The web components are custom DOM elements, so declare the tags for JSX.
|
|
6
7
|
declare module 'solid-js' {
|
|
7
8
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
8
9
|
namespace JSX {
|
|
9
10
|
interface IntrinsicElements {
|
|
10
|
-
'
|
|
11
|
+
'kc-checkpoint': JSX.HTMLAttributes<HTMLElement>;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
/** Render the actual `<
|
|
16
|
+
/** Render the actual `<kc-checkpoint>` custom element configured by attributes. */
|
|
16
17
|
function CheckpointElement(props: { label?: string; tooltip?: string; variant?: string; size?: string }) {
|
|
17
18
|
let el: HTMLElement | undefined;
|
|
18
19
|
onMount(() => {
|
|
@@ -23,34 +24,33 @@ function CheckpointElement(props: { label?: string; tooltip?: string; variant?:
|
|
|
23
24
|
if (props.size) el.setAttribute('size', props.size);
|
|
24
25
|
el.addEventListener('select', () => console.log('checkpoint selected'));
|
|
25
26
|
});
|
|
26
|
-
return <
|
|
27
|
+
return <kc-checkpoint ref={(e) => (el = e as HTMLElement)} style={{ display: 'inline-block', padding: '16px' }} />;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const HTML_SNIPPET = `<!-- Works in any framework or plain HTML -->
|
|
30
|
-
<
|
|
31
|
+
<kc-checkpoint label="Restore" tooltip="Restore this checkpoint" variant="outline" size="sm"></kc-checkpoint>
|
|
31
32
|
|
|
32
33
|
<script type="module">
|
|
33
34
|
import '@kitnai/chat/elements'; // registers the custom elements
|
|
34
35
|
|
|
35
|
-
const cp = document.querySelector('
|
|
36
|
+
const cp = document.querySelector('kc-checkpoint');
|
|
36
37
|
// events are CustomEvents on the element (they do not bubble)
|
|
37
38
|
cp.addEventListener('select', () => console.log('restore checkpoint'));
|
|
38
39
|
</script>`;
|
|
39
40
|
|
|
40
41
|
const meta = {
|
|
41
|
-
title: 'Web Components/
|
|
42
|
+
title: 'Web Components/kc-checkpoint',
|
|
42
43
|
tags: ['autodocs'],
|
|
44
|
+
argTypes: argTypesFor('kc-checkpoint'),
|
|
43
45
|
parameters: {
|
|
44
46
|
layout: 'fullscreen',
|
|
45
47
|
docs: {
|
|
46
|
-
description:
|
|
47
|
-
|
|
48
|
-
'`<kitn-checkpoint>` is the framework-agnostic **web component** for a bookmark/checkpoint button (with an optional tooltip and label), isolated in **Shadow DOM**.',
|
|
48
|
+
description: specDescription('kc-checkpoint', [
|
|
49
|
+
'`<kc-checkpoint>` is the framework-agnostic **web component** for a bookmark/checkpoint button (with an optional tooltip and label), isolated in **Shadow DOM**.',
|
|
49
50
|
'**When to use:** marking a restore point in a conversation in a non-Solid app. In SolidJS, compose the `Checkpoint` primitives.',
|
|
50
51
|
"**How to use:** register once with `import '@kitnai/chat/elements'`, set `label`, `tooltip`, `variant` (`ghost` | `default` | `outline`), and `size` via attributes, and listen for the `select` **CustomEvent** on click.",
|
|
51
52
|
'See the **Code** tab for HTML usage.',
|
|
52
|
-
]
|
|
53
|
-
},
|
|
53
|
+
]),
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
} satisfies Meta;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Show } from 'solid-js';
|
|
2
|
-
import {
|
|
2
|
+
import { defineWebComponent } from './define';
|
|
3
3
|
import { Checkpoint, CheckpointIcon, CheckpointTrigger } from '../components/checkpoint';
|
|
4
4
|
|
|
5
5
|
interface Props extends Record<string, unknown> {
|
|
@@ -13,17 +13,17 @@ interface Props extends Record<string, unknown> {
|
|
|
13
13
|
size?: 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/** Events fired by `<
|
|
16
|
+
/** Events fired by `<kc-checkpoint>`. */
|
|
17
17
|
interface Events {
|
|
18
18
|
/** The checkpoint was clicked. */
|
|
19
19
|
select: void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* `<
|
|
23
|
+
* `<kc-checkpoint>` — a bookmark/checkpoint button (optional tooltip + label).
|
|
24
24
|
* Emits `select`.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
defineWebComponent<Props, Events>('kc-checkpoint', {
|
|
27
27
|
label: undefined,
|
|
28
28
|
tooltip: undefined,
|
|
29
29
|
variant: 'ghost',
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
2
|
import { onMount } from 'solid-js';
|
|
3
3
|
import './register'; // side effect: registers the custom elements
|
|
4
|
+
import { argTypesFor, specDescription } from '../stories/docs/element-controls';
|
|
4
5
|
|
|
5
6
|
// The web components are custom DOM elements, so declare the tags for JSX.
|
|
6
7
|
declare module 'solid-js' {
|
|
7
8
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
8
9
|
namespace JSX {
|
|
9
10
|
interface IntrinsicElements {
|
|
10
|
-
'
|
|
11
|
+
'kc-code-block': JSX.HTMLAttributes<HTMLElement>;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -22,7 +23,7 @@ const pythonCode = `def fib(n):
|
|
|
22
23
|
a, b = b, a + b
|
|
23
24
|
return a`;
|
|
24
25
|
|
|
25
|
-
/** Render the actual `<
|
|
26
|
+
/** Render the actual `<kc-code-block>` custom element with a `code` property. */
|
|
26
27
|
function CodeBlockElement(props: { code: string; language?: string }) {
|
|
27
28
|
let el: (HTMLElement & { code?: string }) | undefined;
|
|
28
29
|
onMount(() => {
|
|
@@ -32,7 +33,7 @@ function CodeBlockElement(props: { code: string; language?: string }) {
|
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
return (
|
|
35
|
-
<
|
|
36
|
+
<kc-code-block
|
|
36
37
|
ref={(e) => (el = e as HTMLElement)}
|
|
37
38
|
style={{ display: 'block', padding: '16px', 'max-width': '720px' }}
|
|
38
39
|
/>
|
|
@@ -40,7 +41,7 @@ function CodeBlockElement(props: { code: string; language?: string }) {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const HTML_SNIPPET = `<!-- Works in any framework or plain HTML -->
|
|
43
|
-
<
|
|
44
|
+
<kc-code-block id="code" language="ts" code-theme="github-dark-dimmed"></kc-code-block>
|
|
44
45
|
|
|
45
46
|
<script type="module">
|
|
46
47
|
import '@kitnai/chat/elements'; // registers the custom elements
|
|
@@ -50,19 +51,18 @@ const HTML_SNIPPET = `<!-- Works in any framework or plain HTML -->
|
|
|
50
51
|
</script>`;
|
|
51
52
|
|
|
52
53
|
const meta = {
|
|
53
|
-
title: 'Web Components/
|
|
54
|
+
title: 'Web Components/kc-code-block',
|
|
54
55
|
tags: ['autodocs'],
|
|
56
|
+
argTypes: argTypesFor('kc-code-block'),
|
|
55
57
|
parameters: {
|
|
56
58
|
layout: 'fullscreen',
|
|
57
59
|
docs: {
|
|
58
|
-
description:
|
|
59
|
-
|
|
60
|
-
'`<kitn-code-block>` is the framework-agnostic **web component** for a single syntax-highlighted code block, complete with a copy button, isolated in **Shadow DOM**.',
|
|
60
|
+
description: specDescription('kc-code-block', [
|
|
61
|
+
'`<kc-code-block>` is the framework-agnostic **web component** for a single syntax-highlighted code block, complete with a copy button, isolated in **Shadow DOM**.',
|
|
61
62
|
'**When to use:** dropping a highlighted snippet into a non-Solid app. In SolidJS, compose `CodeBlock` + `CodeBlockCode` directly.',
|
|
62
63
|
"**How to use:** register once with `import '@kitnai/chat/elements'`, set the source via the `code` **property** (`el.code = '...'`), and pick a grammar with the `language` attribute (defaults to `tsx`). Tune highlighting with `code-theme` / `code-highlight`.",
|
|
63
64
|
'See the **Code** tab for HTML usage.',
|
|
64
|
-
]
|
|
65
|
-
},
|
|
65
|
+
]),
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
} satisfies Meta;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineWebComponent } from './define';
|
|
2
2
|
import { CodeBlock, CodeBlockCode } from '../components/code-block';
|
|
3
3
|
import { ChatConfig, useChatConfig, type ProseSize } from '../primitives/chat-config';
|
|
4
4
|
|
|
@@ -16,10 +16,10 @@ interface Props extends Record<string, unknown> {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* `<
|
|
19
|
+
* `<kc-code-block>` — one syntax-highlighted code block (with a copy button).
|
|
20
20
|
* Code via the `code` property; `language`/`code-theme` via attributes.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
defineWebComponent<Props>('kc-code-block', {
|
|
23
23
|
code: '',
|
|
24
24
|
language: undefined,
|
|
25
25
|
codeTheme: 'github-dark-dimmed',
|