@kitn.ai/ui 0.15.0 → 0.16.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 -0
- package/bin/mcp.js +22 -0
- package/dist/bash-InADTalH.js +6 -1
- package/dist/components/artifact.d.ts +58 -0
- package/dist/components/attachments.d.ts +67 -0
- package/dist/components/card-fallback.d.ts +10 -0
- package/dist/components/card-renderer.d.ts +13 -0
- package/dist/components/card.d.ts +28 -0
- package/dist/components/chain-of-thought.d.ts +29 -0
- package/dist/components/chat-container.d.ts +19 -0
- package/dist/components/chat-scope-picker.d.ts +9 -0
- package/dist/components/chat-thread.d.ts +93 -0
- package/dist/components/checkpoint.d.ts +20 -0
- package/dist/components/choice-card.d.ts +77 -0
- package/dist/components/code-block.d.ts +16 -0
- package/dist/components/confirm-card.d.ts +57 -0
- package/dist/components/context.d.ts +65 -0
- package/dist/components/conversation-item.d.ts +8 -0
- package/dist/components/conversation-list.d.ts +11 -0
- package/dist/components/embed.d.ts +21 -0
- package/dist/components/empty.d.ts +43 -0
- package/dist/components/feedback-bar.d.ts +45 -0
- package/dist/components/file-tree.d.ts +57 -0
- package/dist/components/file-upload.d.ts +16 -0
- package/dist/components/form-widgets.d.ts +31 -0
- package/dist/components/form.d.ts +103 -0
- package/dist/components/image.d.ts +12 -0
- package/dist/components/link-preview.d.ts +23 -0
- package/dist/components/loader.d.ts +60 -0
- package/dist/components/markdown.d.ts +8 -0
- package/dist/components/message-skills.d.ts +15 -0
- package/dist/components/message.d.ts +54 -0
- package/dist/components/model-switcher.d.ts +8 -0
- package/dist/components/prompt-input.d.ts +38 -0
- package/dist/components/prompt-suggestion.d.ts +13 -0
- package/dist/components/reasoning.d.ts +20 -0
- package/dist/components/response-stream.d.ts +14 -0
- package/dist/components/scroll-button.d.ts +7 -0
- package/dist/components/slash-command.d.ts +15 -0
- package/dist/components/source.d.ts +23 -0
- package/dist/components/tasks-card.d.ts +71 -0
- package/dist/components/text-shimmer.d.ts +9 -0
- package/dist/components/thinking-bar.d.ts +10 -0
- package/dist/components/tool.d.ts +16 -0
- package/dist/components/use-card-resolution.d.ts +12 -0
- package/dist/components/voice-input.d.ts +7 -0
- package/dist/core-AYMC6_lb.js +5874 -12
- package/dist/css-M7EaDHN_.js +6 -1
- package/dist/elements/artifact.d.ts +1 -0
- package/dist/elements/attachments.d.ts +1 -0
- package/dist/elements/card.d.ts +1 -0
- package/dist/elements/cards.d.ts +0 -0
- package/dist/elements/chain-of-thought.d.ts +13 -0
- package/dist/elements/chat-scope-picker.d.ts +1 -0
- package/dist/elements/chat-types.d.ts +41 -0
- package/dist/elements/chat-workspace.d.ts +1 -0
- package/dist/elements/chat.d.ts +1 -0
- package/dist/elements/checkpoint.d.ts +1 -0
- package/dist/elements/choice.d.ts +1 -0
- package/dist/elements/code-block.d.ts +1 -0
- package/dist/elements/confirm-card.d.ts +1 -0
- package/dist/elements/context-meter.d.ts +1 -0
- package/dist/elements/conversation-list.d.ts +11 -0
- package/dist/elements/css.d.ts +1 -0
- package/dist/elements/default-input.d.ts +40 -0
- package/dist/elements/define.d.ts +42 -0
- package/dist/elements/embed.d.ts +1 -0
- package/dist/elements/empty.d.ts +1 -0
- package/dist/elements/feedback-bar.d.ts +1 -0
- package/dist/elements/file-tree.d.ts +1 -0
- package/dist/elements/file-upload.d.ts +1 -0
- package/dist/elements/form.d.ts +1 -0
- package/dist/elements/image.d.ts +1 -0
- package/dist/elements/link-preview.d.ts +1 -0
- package/dist/elements/loader.d.ts +1 -0
- package/dist/elements/markdown.d.ts +1 -0
- package/dist/elements/message-skills.d.ts +17 -0
- package/dist/elements/message.d.ts +1 -0
- package/dist/elements/model-switcher.d.ts +11 -0
- package/dist/elements/popover.d.ts +1 -0
- package/dist/elements/prompt-input.d.ts +9 -0
- package/dist/elements/prompt-suggestions.d.ts +7 -0
- package/dist/elements/reasoning.d.ts +1 -0
- package/dist/elements/register-impl.d.ts +0 -0
- package/dist/elements/register.d.ts +3 -0
- package/dist/elements/remote.d.ts +1 -0
- package/dist/elements/resizable.d.ts +17 -0
- package/dist/elements/response-stream.d.ts +1 -0
- package/dist/elements/scroll-button.d.ts +1 -0
- package/dist/elements/source.d.ts +18 -0
- package/dist/elements/switch.d.ts +1 -0
- package/dist/elements/tasks.d.ts +1 -0
- package/dist/elements/text-shimmer.d.ts +1 -0
- package/dist/elements/thinking-bar.d.ts +1 -0
- package/dist/elements/tool.d.ts +1 -0
- package/dist/elements/voice-input.d.ts +1 -0
- package/dist/elements.d.ts +732 -0
- package/dist/engine-javascript-vq0WuIJl.js +2516 -14
- package/dist/github-dark-dimmed-DUshB20C.js +4 -1
- package/dist/github-light-JYsPkUQd.js +4 -1
- package/dist/html-CPZ3oZQ7.js +10 -1
- package/dist/index.d.ts +112 -2
- package/dist/index.js +13551 -0
- package/dist/javascript-C25yR2R2.js +6 -1
- package/dist/json-DxJze_jm.js +6 -1
- package/dist/kitn-chat.es.js +1 -77
- package/dist/llms/llms-full.txt +1 -1
- package/dist/llms/llms.txt +1 -1
- package/dist/mcp.es.js +2140 -0
- package/dist/primitives/card-contract.d.ts +103 -0
- package/dist/primitives/card-host.d.ts +12 -0
- package/dist/primitives/card-registry.d.ts +17 -0
- package/dist/primitives/card-resolution.d.ts +8 -0
- package/dist/primitives/card-routing.d.ts +12 -0
- package/dist/primitives/card-validate.d.ts +25 -0
- package/dist/primitives/chat-config.d.ts +31 -0
- package/dist/primitives/controllable.d.ts +13 -0
- package/dist/primitives/embed-providers.d.ts +65 -0
- package/dist/primitives/highlighter.d.ts +23 -0
- package/dist/primitives/link-preview.d.ts +47 -0
- package/dist/primitives/pdf-preview.d.ts +50 -0
- package/dist/primitives/use-auto-resize.d.ts +8 -0
- package/dist/primitives/use-resize-observer.d.ts +1 -0
- package/dist/primitives/use-stick-to-bottom.d.ts +5 -0
- package/dist/primitives/use-text-stream.d.ts +19 -0
- package/dist/primitives/use-voice-recorder.d.ts +9 -0
- package/dist/react/index.d.ts +1118 -0
- package/dist/react/runtime.d.ts +15 -0
- package/dist/react.js +265 -0
- package/dist/register-impl-wCsFPoh9.js +77 -0
- package/dist/register-ujhr1nBS.js +1 -0
- package/dist/remote/host-embed.d.ts +33 -0
- package/dist/remote/index.d.ts +2 -0
- package/dist/remote/origin.d.ts +5 -0
- package/dist/remote/provider-runtime.d.ts +27 -0
- package/dist/remote/provider.d.ts +2 -0
- package/dist/remote/validate.d.ts +4 -0
- package/dist/remote/version.d.ts +4 -0
- package/dist/remote/wire.d.ts +53 -0
- package/dist/svelte--5p79yCD.js +15 -1
- package/dist/tsx-B8rCNbgL.js +6 -1
- package/dist/types.d.ts +42 -0
- package/dist/typescript-RycA9KXf.js +6 -1
- package/dist/ui/action-icons.d.ts +11 -0
- package/dist/ui/avatar.d.ts +8 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/collapsible.d.ts +27 -0
- package/dist/ui/dropdown.d.ts +20 -0
- package/dist/ui/hover-card.d.ts +28 -0
- package/dist/ui/overlay.d.ts +67 -0
- package/dist/ui/popover.d.ts +32 -0
- package/dist/ui/resizable.d.ts +76 -0
- package/dist/ui/scroll-area.d.ts +5 -0
- package/dist/ui/separator.d.ts +5 -0
- package/dist/ui/skeleton.d.ts +5 -0
- package/dist/ui/switch.d.ts +19 -0
- package/dist/ui/textarea.d.ts +6 -0
- package/dist/ui/tooltip.d.ts +8 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/vue-BmIZj4XD.js +33 -1
- package/frameworks/react/index.tsx +4 -0
- package/frameworks/react/runtime.tsx +16 -2
- package/llms-full.txt +1 -1
- package/llms.txt +1 -1
- package/package.json +29 -11
- package/src/agent-tooling/archetypes.ts +46 -0
- package/src/agent-tooling/integrations/cloudflare.ts +88 -0
- package/src/agent-tooling/integrations/langgraph.ts +60 -0
- package/src/agent-tooling/integrations/mastra.ts +27 -0
- package/src/agent-tooling/integrations/mock.ts +34 -0
- package/src/agent-tooling/integrations/ollama.ts +47 -0
- package/src/agent-tooling/integrations/openrouter.ts +26 -0
- package/src/agent-tooling/integrations/pi.ts +40 -0
- package/src/agent-tooling/integrations/pydantic-ai.ts +52 -0
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +44 -0
- package/src/agent-tooling/mcp/manifest.ts +128 -0
- package/src/agent-tooling/mcp/server.ts +59 -0
- package/src/agent-tooling/mcp/stdio.ts +18 -0
- package/src/agent-tooling/mcp/tools/debug.ts +305 -0
- package/src/agent-tooling/mcp/tools/reference.ts +132 -0
- package/src/agent-tooling/mcp/tools/scaffold.ts +1627 -0
- package/src/agent-tooling/mcp/tools/theme.ts +340 -0
- package/src/agent-tooling/mcp/tools/types.ts +14 -0
- package/src/agent-tooling/registry.ts +41 -0
- package/src/agent-tooling/types.ts +30 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/define.tsx +7 -1
- package/src/elements/element-types.d.ts +2 -1
- package/src/elements/register-impl.ts +55 -0
- package/src/elements/register.ts +17 -51
- package/theme.css +4 -2
- package/src/components/artifact.stories.tsx +0 -138
- package/src/components/attachments.stories.tsx +0 -303
- package/src/components/attachments.test.tsx +0 -64
- package/src/components/chain-of-thought.stories.tsx +0 -211
- package/src/components/chat-container.stories.tsx +0 -187
- package/src/components/chat-thread.test.tsx +0 -58
- package/src/components/checkpoint.stories.tsx +0 -102
- package/src/components/code-block.stories.tsx +0 -150
- package/src/components/confirm-card.stories.tsx +0 -74
- package/src/components/context.stories.tsx +0 -229
- package/src/components/context.test.tsx +0 -133
- package/src/components/conversation-item.stories.tsx +0 -125
- package/src/components/conversation-list.stories.tsx +0 -133
- package/src/components/default-input.test.tsx +0 -111
- package/src/components/empty.stories.tsx +0 -434
- package/src/components/feedback-bar.stories.tsx +0 -138
- package/src/components/feedback-bar.test.tsx +0 -103
- package/src/components/file-tree.stories.tsx +0 -73
- package/src/components/file-upload.stories.tsx +0 -156
- package/src/components/image.stories.tsx +0 -89
- package/src/components/loader.stories.tsx +0 -181
- package/src/components/markdown.stories.tsx +0 -180
- package/src/components/message-action-bar.test.tsx +0 -128
- package/src/components/message-narrow.stories.tsx +0 -329
- package/src/components/message-skills.stories.tsx +0 -211
- package/src/components/message.stories.tsx +0 -281
- package/src/components/model-switcher.stories.tsx +0 -123
- package/src/components/model-switcher.test.tsx +0 -65
- package/src/components/prompt-input.stories.tsx +0 -222
- package/src/components/prompt-suggestion.stories.tsx +0 -142
- package/src/components/reasoning.stories.tsx +0 -140
- package/src/components/resizable.test.tsx +0 -226
- package/src/components/scroll-button.stories.tsx +0 -100
- package/src/components/slash-command.stories.tsx +0 -163
- package/src/components/source-list.test.tsx +0 -152
- package/src/components/source.stories.tsx +0 -124
- package/src/components/tasks-card.stories.tsx +0 -78
- package/src/components/text-shimmer.stories.tsx +0 -87
- package/src/components/thinking-bar.stories.tsx +0 -87
- package/src/components/tool.stories.tsx +0 -153
- package/src/components/voice-input.stories.tsx +0 -83
- package/src/elements/artifact.stories.tsx +0 -506
- package/src/elements/attachments.stories.tsx +0 -190
- package/src/elements/card.stories.tsx +0 -113
- package/src/elements/cards.stories.tsx +0 -59
- package/src/elements/catalog.stories.tsx +0 -491
- package/src/elements/chain-of-thought.declarative.test.tsx +0 -153
- package/src/elements/chain-of-thought.stories.tsx +0 -113
- package/src/elements/chat-scope-picker.stories.tsx +0 -73
- package/src/elements/chat-workspace.stories.tsx +0 -288
- package/src/elements/chat.stories.tsx +0 -151
- package/src/elements/checkpoint.stories.tsx +0 -72
- package/src/elements/choice.stories.tsx +0 -240
- package/src/elements/code-block.stories.tsx +0 -83
- package/src/elements/composed-shell.stories.tsx +0 -316
- package/src/elements/confirm-card.stories.tsx +0 -227
- package/src/elements/context-meter.stories.tsx +0 -151
- package/src/elements/conversation-list.declarative.test.tsx +0 -137
- package/src/elements/conversation-list.stories.tsx +0 -243
- package/src/elements/embed.stories.tsx +0 -213
- package/src/elements/empty.stories.tsx +0 -111
- package/src/elements/feedback-bar.stories.tsx +0 -114
- package/src/elements/file-tree.stories.tsx +0 -134
- package/src/elements/file-upload.stories.tsx +0 -82
- package/src/elements/form.stories.tsx +0 -248
- package/src/elements/image.stories.tsx +0 -71
- package/src/elements/link-preview.stories.tsx +0 -209
- package/src/elements/loader.stories.tsx +0 -88
- package/src/elements/markdown.stories.tsx +0 -76
- package/src/elements/message-skills.declarative.test.tsx +0 -104
- package/src/elements/message-skills.stories.tsx +0 -114
- package/src/elements/message.stories.tsx +0 -218
- package/src/elements/model-switcher.declarative.test.tsx +0 -130
- package/src/elements/model-switcher.stories.tsx +0 -198
- package/src/elements/popover.stories.tsx +0 -80
- package/src/elements/prompt-input-slash-command.test.tsx +0 -128
- package/src/elements/prompt-input-stoppable.test.tsx +0 -88
- package/src/elements/prompt-input-toolbar-actions.test.tsx +0 -120
- package/src/elements/prompt-input.stories.tsx +0 -331
- package/src/elements/prompt-suggestions.declarative.test.tsx +0 -164
- package/src/elements/prompt-suggestions.stories.tsx +0 -213
- package/src/elements/reasoning.stories.tsx +0 -77
- package/src/elements/remote.stories.tsx +0 -314
- package/src/elements/resizable.stories.tsx +0 -426
- package/src/elements/response-stream.stories.tsx +0 -79
- package/src/elements/scroll-button.stories.tsx +0 -202
- package/src/elements/scroll-button.test.tsx +0 -148
- package/src/elements/source-list.stories.tsx +0 -143
- package/src/elements/source.stories.tsx +0 -88
- package/src/elements/switch.stories.tsx +0 -56
- package/src/elements/tasks.stories.tsx +0 -237
- package/src/elements/text-shimmer.stories.tsx +0 -64
- package/src/elements/thinking-bar.stories.tsx +0 -72
- package/src/elements/tool.stories.tsx +0 -89
- package/src/elements/voice-input.stories.tsx +0 -88
- package/src/primitives/controllable.test.ts +0 -47
- package/src/stories/chat-panel-layout.stories.tsx +0 -145
- package/src/stories/chat-scene.tsx +0 -571
- package/src/stories/checkpoint-restore.stories.tsx +0 -256
- package/src/stories/context-usage.stories.tsx +0 -212
- package/src/stories/conversation-with-reasoning.stories.tsx +0 -182
- package/src/stories/conversation-with-sources.stories.tsx +0 -471
- package/src/stories/docs/Accessibility.mdx +0 -119
- package/src/stories/docs/ChildElements.mdx +0 -269
- package/src/stories/docs/ForAIAgents.mdx +0 -162
- package/src/stories/docs/GettingStarted.mdx +0 -65
- package/src/stories/docs/Installation.mdx +0 -83
- package/src/stories/docs/Introduction.mdx +0 -50
- package/src/stories/docs/SolidJsAdvanced.mdx +0 -17
- package/src/stories/docs/Theming.mdx +0 -85
- package/src/stories/docs/element-controls.ts +0 -121
- package/src/stories/docs/frameworks/Angular.mdx +0 -245
- package/src/stories/docs/frameworks/Html.mdx +0 -227
- package/src/stories/docs/frameworks/Overview.mdx +0 -47
- package/src/stories/docs/frameworks/React.mdx +0 -227
- package/src/stories/docs/frameworks/Solid.mdx +0 -173
- package/src/stories/docs/frameworks/Svelte.mdx +0 -194
- package/src/stories/docs/frameworks/Vue.mdx +0 -238
- package/src/stories/docs/generative-ui-overview.mdx +0 -186
- package/src/stories/docs/recipes/SpeechToText.mdx +0 -7
- package/src/stories/docs/recipes/Streaming.mdx +0 -68
- package/src/stories/docs/recipes/TextToSpeech.mdx +0 -35
- package/src/stories/docs/theme-editor/canvas.tsx +0 -32
- package/src/stories/docs/theme-editor/inspector.tsx +0 -66
- package/src/stories/docs/theme-editor/presets.test.ts +0 -32
- package/src/stories/docs/theme-editor/presets.ts +0 -64
- package/src/stories/docs/theme-editor/theme-css.test.ts +0 -19
- package/src/stories/docs/theme-editor/theme-css.ts +0 -15
- package/src/stories/docs/theme-editor/theme-editor.tsx +0 -146
- package/src/stories/docs/theme-tokens.tsx +0 -174
- package/src/stories/examples/ChoosingComponents.mdx +0 -106
- package/src/stories/examples/sample-data.ts +0 -79
- package/src/stories/examples/usage/checkpoint-restore.ts +0 -156
- package/src/stories/examples/usage/context-usage.ts +0 -591
- package/src/stories/examples/usage/conversation-with-reasoning.ts +0 -224
- package/src/stories/examples/usage/conversation-with-sources.ts +0 -589
- package/src/stories/examples/usage/empty-state.ts +0 -144
- package/src/stories/examples/usage/full-chat-app.ts +0 -277
- package/src/stories/examples/usage/index.ts +0 -63
- package/src/stories/examples/usage/message-actions.ts +0 -704
- package/src/stories/examples/usage/pattern-centered-conversation.ts +0 -446
- package/src/stories/examples/usage/pattern-chat-panel-layout.ts +0 -442
- package/src/stories/examples/usage/pattern-docked-widget.ts +0 -479
- package/src/stories/examples/usage/prompt-input-variants.ts +0 -1356
- package/src/stories/examples/usage/streaming-response.ts +0 -687
- package/src/stories/examples/usage/types.ts +0 -33
- package/src/stories/full-chat.stories.tsx +0 -18
- package/src/stories/message-actions.stories.tsx +0 -230
- package/src/stories/pattern-centered-conversation.stories.tsx +0 -93
- package/src/stories/pattern-docked-widget.stories.tsx +0 -93
- package/src/stories/pattern-empty-state.stories.tsx +0 -76
- package/src/stories/prompt-input-variants.stories.tsx +0 -456
- package/src/stories/streaming-response.stories.tsx +0 -438
- package/src/stories/theme-editor.stories.tsx +0 -16
- package/src/stories/token-reference.stories.tsx +0 -18
- package/src/stories/typography.stories.tsx +0 -78
- package/src/ui/avatar.stories.tsx +0 -103
- package/src/ui/badge.stories.tsx +0 -86
- package/src/ui/button.stories.tsx +0 -145
- package/src/ui/collapsible.stories.tsx +0 -69
- package/src/ui/dropdown.stories.tsx +0 -59
- package/src/ui/hover-card.stories.tsx +0 -77
- package/src/ui/hover-card.test.tsx +0 -30
- package/src/ui/overlay.stories.tsx +0 -115
- package/src/ui/popover.stories.tsx +0 -81
- package/src/ui/popover.test.tsx +0 -99
- package/src/ui/resizable.stories.tsx +0 -236
- package/src/ui/scroll-area.stories.tsx +0 -50
- package/src/ui/separator.stories.tsx +0 -81
- package/src/ui/skeleton.stories.tsx +0 -337
- package/src/ui/switch.stories.tsx +0 -51
- package/src/ui/switch.test.tsx +0 -59
- package/src/ui/textarea.stories.tsx +0 -76
- package/src/ui/tooltip.stories.tsx +0 -74
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Bumped on any BREAKING change to the shapes below. Additive/optional fields do not bump it. */
|
|
2
|
+
export declare const CARD_CONTRACT_VERSION: "1";
|
|
3
|
+
/** A card the agent/server asks the chat to render. `data` conforms to the card
|
|
4
|
+
* type's own published JSON Schema (one schema per `type`). */
|
|
5
|
+
export interface CardEnvelope<TType extends string = string, TData = unknown> {
|
|
6
|
+
type: TType;
|
|
7
|
+
id: string;
|
|
8
|
+
data: TData;
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Set when the user has resolved this card; renders the chromed read-only view. */
|
|
11
|
+
resolution?: CardResolution;
|
|
12
|
+
}
|
|
13
|
+
/** Context the host pushes to every card; updated when it changes (theme, etc.). */
|
|
14
|
+
export interface CardContext {
|
|
15
|
+
theme: {
|
|
16
|
+
mode: 'light' | 'dark';
|
|
17
|
+
tokens?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
locale: string;
|
|
20
|
+
conversationId?: string;
|
|
21
|
+
/** Remote (iframe) cards only: short-lived signed token. Never long-lived. */
|
|
22
|
+
authToken?: string;
|
|
23
|
+
/** Host-resolved a11y prefs (e.g. reduced-motion, which doesn't cross the iframe). */
|
|
24
|
+
a11y?: {
|
|
25
|
+
reducedMotion?: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Everything a card can ask the host to do. The host authorizes + routes each. */
|
|
29
|
+
export type CardEvent = {
|
|
30
|
+
kind: 'ready';
|
|
31
|
+
cardId: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'submit';
|
|
34
|
+
cardId: string;
|
|
35
|
+
data: unknown;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'action';
|
|
38
|
+
cardId: string;
|
|
39
|
+
action: string;
|
|
40
|
+
payload?: unknown;
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'send-prompt';
|
|
43
|
+
cardId: string;
|
|
44
|
+
text: string;
|
|
45
|
+
mode?: 'compose' | 'send';
|
|
46
|
+
context?: unknown;
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'open';
|
|
49
|
+
cardId: string;
|
|
50
|
+
url: string;
|
|
51
|
+
target?: 'tab' | 'artifact';
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'resize';
|
|
54
|
+
cardId: string;
|
|
55
|
+
height: number;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'state';
|
|
58
|
+
cardId: string;
|
|
59
|
+
patch: unknown;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'dismiss';
|
|
62
|
+
cardId: string;
|
|
63
|
+
} | {
|
|
64
|
+
kind: 'error';
|
|
65
|
+
cardId: string;
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
export type CardEventKind = CardEvent['kind'];
|
|
69
|
+
/** How a card was resolved by the user — the re-hydration channel for the chromed
|
|
70
|
+
* read-only state. Mirrors the two terminal CardEvents (minus `cardId`): the
|
|
71
|
+
* resolution is just the event that resolved the card. `at` is optional ISO-8601
|
|
72
|
+
* provenance (data only; never rendered). Additive — does not bump the contract
|
|
73
|
+
* version. */
|
|
74
|
+
export type CardResolution = {
|
|
75
|
+
kind: 'action';
|
|
76
|
+
action: string;
|
|
77
|
+
payload?: unknown;
|
|
78
|
+
at?: string;
|
|
79
|
+
} | {
|
|
80
|
+
kind: 'submit';
|
|
81
|
+
data: unknown;
|
|
82
|
+
at?: string;
|
|
83
|
+
};
|
|
84
|
+
/** What every card is handed (via native context or the iframe bridge). */
|
|
85
|
+
export interface CardHost {
|
|
86
|
+
context(): CardContext;
|
|
87
|
+
emit(event: CardEvent): void;
|
|
88
|
+
}
|
|
89
|
+
/** How the host routes each verb. Consumers supply handlers; defaults applied otherwise. */
|
|
90
|
+
export interface CardPolicy {
|
|
91
|
+
onSubmit?: (cardId: string, data: unknown) => void;
|
|
92
|
+
onAction?: (cardId: string, action: string, payload?: unknown) => void;
|
|
93
|
+
onSendPrompt?: (text: string, opts: {
|
|
94
|
+
mode: 'compose' | 'send';
|
|
95
|
+
context?: unknown;
|
|
96
|
+
}) => void;
|
|
97
|
+
onOpen?: (url: string, target: 'tab' | 'artifact') => void;
|
|
98
|
+
onState?: (cardId: string, patch: unknown) => void;
|
|
99
|
+
onDismiss?: (cardId: string) => void;
|
|
100
|
+
onError?: (cardId: string, message: string) => void;
|
|
101
|
+
/** Cap on send-prompt: 'compose' (default) forbids silent sends. 'send' to allow. */
|
|
102
|
+
maxSendPromptMode?: 'compose' | 'send';
|
|
103
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
import { CardContext, CardHost, CardPolicy } from './card-contract';
|
|
3
|
+
export interface CardProviderProps {
|
|
4
|
+
/** Ambient context, static or a reactive getter. */
|
|
5
|
+
context: CardContext | (() => CardContext);
|
|
6
|
+
/** Routing policy applied to every emitted event. */
|
|
7
|
+
policy?: CardPolicy;
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare function CardProvider(props: CardProviderProps): JSX.Element;
|
|
11
|
+
/** Read the current CardHost. `undefined` when no provider is present (bare card). */
|
|
12
|
+
export declare function useCardHost(): CardHost | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from 'solid-js';
|
|
2
|
+
import { CardEnvelope, CardHost } from './card-contract';
|
|
3
|
+
/** Solid renderer for one envelope. `host` is the resolved CardHost so each wrapper
|
|
4
|
+
* can bridge its card's emit convention (form/confirm/tasks take `host`;
|
|
5
|
+
* link/embed take `onEmit`). */
|
|
6
|
+
export type CardComponent = Component<{
|
|
7
|
+
envelope: CardEnvelope;
|
|
8
|
+
host?: CardHost;
|
|
9
|
+
}>;
|
|
10
|
+
export type CardComponentMap = Record<string, CardComponent>;
|
|
11
|
+
/** Web-component layer: envelope type → kai-* tag name. */
|
|
12
|
+
export type CardTagMap = Record<string, string>;
|
|
13
|
+
export declare const BUILTIN_CARD_TAGS: CardTagMap;
|
|
14
|
+
export declare const BUILTIN_CARD_COMPONENTS: CardComponentMap;
|
|
15
|
+
/** Built-ins with the consumer's overrides merged on top (consumer wins). */
|
|
16
|
+
export declare function mergeCardComponents(types?: CardComponentMap): CardComponentMap;
|
|
17
|
+
export declare function mergeCardTags(types?: CardTagMap): CardTagMap;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CardEnvelope, CardEvent, CardResolution } from './card-contract';
|
|
2
|
+
/** Map a terminal CardEvent (`action` | `submit`) to a CardResolution.
|
|
3
|
+
* Returns undefined for every non-terminal verb (ready/error/resize/state/…). */
|
|
4
|
+
export declare function resolutionFromEvent(event: CardEvent): CardResolution | undefined;
|
|
5
|
+
/** Return a new cards array with the envelope matching `event.cardId` stamped with its
|
|
6
|
+
* resolution. Non-terminal events or an unknown cardId return the SAME array reference
|
|
7
|
+
* (cheap no-op; safe to call on every event). Never mutates the input. */
|
|
8
|
+
export declare function applyResolution(cards: CardEnvelope[], event: CardEvent): CardEnvelope[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CardEvent, CardPolicy } from './card-contract';
|
|
2
|
+
/** The single contract event name. */
|
|
3
|
+
export declare const CARD_EVENT_NAME = "kai-card";
|
|
4
|
+
/** Dispatch a CardEvent as the bubbling, composed `kai-card` event a host listener
|
|
5
|
+
* routes. NB: this is deliberately different from defineWebComponent's built-in
|
|
6
|
+
* non-bubbling dispatch. */
|
|
7
|
+
export declare function emitCardEvent(element: HTMLElement, event: CardEvent): void;
|
|
8
|
+
/** Apply the contract's policy to one event. The ONE place routing lives. */
|
|
9
|
+
export declare function routeCardEvent(policy: CardPolicy | undefined, event: CardEvent): void;
|
|
10
|
+
/** Attach a host-level `kai-card` listener that routes every bubbling card event
|
|
11
|
+
* through `policy`. Returns an unsubscribe fn. For the bare-element path. */
|
|
12
|
+
export declare function listenForCardEvents(root: HTMLElement | Document, policy: CardPolicy): () => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface JsonSchema {
|
|
2
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
|
|
3
|
+
const?: unknown;
|
|
4
|
+
enum?: unknown[];
|
|
5
|
+
required?: string[];
|
|
6
|
+
properties?: Record<string, JsonSchema>;
|
|
7
|
+
items?: JsonSchema;
|
|
8
|
+
minimum?: number;
|
|
9
|
+
maximum?: number;
|
|
10
|
+
exclusiveMinimum?: number;
|
|
11
|
+
exclusiveMaximum?: number;
|
|
12
|
+
minLength?: number;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
pattern?: string;
|
|
15
|
+
minItems?: number;
|
|
16
|
+
maxItems?: number;
|
|
17
|
+
uniqueItems?: boolean;
|
|
18
|
+
[key: `x-${string}`]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface ValidationResult {
|
|
21
|
+
valid: boolean;
|
|
22
|
+
errors: string[];
|
|
23
|
+
}
|
|
24
|
+
/** Validate `value` against the lean JSON-Schema subset. */
|
|
25
|
+
export declare function validateAgainstSchema(schema: JsonSchema, value: unknown): ValidationResult;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Accessor, JSX } from 'solid-js';
|
|
2
|
+
export type ProseSize = 'xs' | 'sm' | 'base' | 'lg';
|
|
3
|
+
export interface ChatConfigValue {
|
|
4
|
+
/** Prose/text size for messages, markdown, and UI elements */
|
|
5
|
+
proseSize: Accessor<ProseSize>;
|
|
6
|
+
/** Shiki theme for code blocks */
|
|
7
|
+
codeTheme: Accessor<string>;
|
|
8
|
+
/** Node the kit's overlays portal into; undefined → document.body */
|
|
9
|
+
portalMount: Accessor<HTMLElement | undefined>;
|
|
10
|
+
/** Whether code blocks are syntax-highlighted; false → plain text, no Shiki loaded */
|
|
11
|
+
codeHighlight: Accessor<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export interface ChatConfigProps {
|
|
14
|
+
proseSize?: ProseSize;
|
|
15
|
+
codeTheme?: string;
|
|
16
|
+
portalMount?: HTMLElement;
|
|
17
|
+
codeHighlight?: boolean;
|
|
18
|
+
children: JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Provides chat-wide appearance settings to all child components.
|
|
22
|
+
* Set once at the top level — MessageContent, Markdown, CodeBlock,
|
|
23
|
+
* ConversationList, and PromptInput all read from this.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ChatConfig(props: ChatConfigProps): JSX.Element;
|
|
26
|
+
/** Read the current chat config. Returns defaults if no provider is present. */
|
|
27
|
+
export declare function useChatConfig(): ChatConfigValue;
|
|
28
|
+
/** Maps prose size to Tailwind prose class */
|
|
29
|
+
export declare function proseClass(size: ProseSize): string;
|
|
30
|
+
/** Maps prose size to a text class for non-prose elements (sidebar, input) */
|
|
31
|
+
export declare function textClass(size: ProseSize): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* The controlled/uncontrolled state pattern, as a reusable signal.
|
|
4
|
+
*
|
|
5
|
+
* `controlled` is an accessor for the controlling prop: when it returns a value,
|
|
6
|
+
* that value wins (controlled mode); when it returns `undefined`, the component
|
|
7
|
+
* manages its own state seeded from `initial` (uncontrolled mode). The returned
|
|
8
|
+
* setter always writes the internal value — harmless (masked) while controlled,
|
|
9
|
+
* authoritative while uncontrolled — so a single call site works in both modes.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors `props.value ?? internal()` used elsewhere in the kit, without effects.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createControllableSignal(controlled: Accessor<boolean | undefined>, initial: boolean): [Accessor<boolean>, (value: boolean) => void];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CardEnvelope } from './card-contract';
|
|
2
|
+
/** Media provider for an embed card. */
|
|
3
|
+
export type EmbedProvider = 'youtube' | 'vimeo' | 'generic';
|
|
4
|
+
/** Lazy media-embed payload (YouTube / Vimeo / generic player URL). */
|
|
5
|
+
export interface EmbedCardData {
|
|
6
|
+
/** Media provider. 'generic' frames `url` directly. */
|
|
7
|
+
provider: EmbedProvider;
|
|
8
|
+
/** Provider video id (youtube/vimeo) when not parsing from `url`. */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Full media/watch/embed URL. */
|
|
11
|
+
url?: string;
|
|
12
|
+
/** Accessible iframe title + poster label. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Thumbnail before play; derived for youtube/vimeo when omitted. */
|
|
15
|
+
poster?: string;
|
|
16
|
+
/** Start offset, seconds. */
|
|
17
|
+
start?: number;
|
|
18
|
+
/** Player aspect ratio. Default '16:9'. */
|
|
19
|
+
aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16';
|
|
20
|
+
}
|
|
21
|
+
/** The full envelope an agent/server emits for an embed card. */
|
|
22
|
+
export type EmbedCardEnvelope = CardEnvelope<'embed', EmbedCardData>;
|
|
23
|
+
/** The `type` discriminator for embed cards. */
|
|
24
|
+
export declare const EMBED_CARD_TYPE: "embed";
|
|
25
|
+
export interface ResolvedEmbed {
|
|
26
|
+
/** The iframe src loaded on play (already including autoplay/start params). */
|
|
27
|
+
embedUrl: string;
|
|
28
|
+
/** Poster/thumbnail to show before play (derived when not supplied). */
|
|
29
|
+
posterUrl?: string;
|
|
30
|
+
/** sandbox attribute for the player iframe. */
|
|
31
|
+
sandbox: string;
|
|
32
|
+
/** allow attribute (fullscreen, encrypted-media, picture-in-picture, …). */
|
|
33
|
+
allow: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* App opt-in: allow `generic` embeds whose origin is in this list. Origins are
|
|
37
|
+
* normalized via the URL parser (scheme + host + port). Only https origins are
|
|
38
|
+
* accepted (a non-https origin is ignored). Call once at app startup.
|
|
39
|
+
*/
|
|
40
|
+
export declare function configureEmbedAllowlist(origins: string[]): void;
|
|
41
|
+
/** True when `url`'s origin has been allowlisted for `generic` embeds. */
|
|
42
|
+
export declare function isGenericOriginAllowed(url: string): boolean;
|
|
43
|
+
/** Test-only: clear the generic allowlist so tests stay isolated. */
|
|
44
|
+
export declare function __resetEmbedAllowlistForTests(): void;
|
|
45
|
+
/** Extract a YouTube id from a watch / youtu.be / shorts / embed URL. */
|
|
46
|
+
export declare function parseYouTubeId(url: string): string | undefined;
|
|
47
|
+
/** Extract a Vimeo id from a vimeo.com/<id> (or player.vimeo.com/video/<id>) URL. */
|
|
48
|
+
export declare function parseVimeoId(url: string): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve an EmbedCardData to an embeddable player URL + poster + sandbox/allow.
|
|
51
|
+
* Throws (with a human message) on a missing/invalid provider id, a non-https
|
|
52
|
+
* generic URL, or a generic origin not in the app allowlist — the card turns these
|
|
53
|
+
* into an inline error + an `error` event.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveEmbed(data: EmbedCardData): ResolvedEmbed;
|
|
56
|
+
/**
|
|
57
|
+
* The canonical "watch on the provider" URL for the optional fallback affordance
|
|
58
|
+
* (emitted as `open`/target:'tab' when an embed is blocked). Returns `undefined`
|
|
59
|
+
* when there is nothing useful to link to.
|
|
60
|
+
*/
|
|
61
|
+
export declare function watchUrl(data: EmbedCardData): string | undefined;
|
|
62
|
+
/** Human-readable provider label for the fallback affordance ("Open on YouTube"). */
|
|
63
|
+
export declare function providerLabel(provider: EmbedProvider): string;
|
|
64
|
+
/** CSS aspect-ratio value for a card's aspectRatio (default 16:9). */
|
|
65
|
+
export declare function aspectRatioValue(aspectRatio: EmbedCardData['aspectRatio']): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type Loader = () => Promise<unknown>;
|
|
2
|
+
export interface CodeHighlightingOptions {
|
|
3
|
+
/** Turn highlighting on/off globally. When false, code renders as plain text. */
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
/** Register/override language loaders, e.g. `{ ruby: () => import('@shikijs/langs/ruby') }`. */
|
|
6
|
+
languages?: Record<string, Loader>;
|
|
7
|
+
/** Register/override theme loaders. */
|
|
8
|
+
themes?: Record<string, Loader>;
|
|
9
|
+
/** Map short names to canonical language keys, e.g. `{ vue: 'html' }`. */
|
|
10
|
+
aliases?: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Highlight `code` as `lang` with `theme`, returning HTML. Loads only what's
|
|
14
|
+
* needed, on demand. Falls back to escaped plain `<pre><code>` when highlighting
|
|
15
|
+
* is disabled, the language has no registered loader, or anything fails.
|
|
16
|
+
*/
|
|
17
|
+
export declare function highlight(code: string, lang: string, theme: string): Promise<string>;
|
|
18
|
+
/** Register additional languages/themes/aliases, or disable highlighting entirely. */
|
|
19
|
+
export declare function configureCodeHighlighting(options: CodeHighlightingOptions): void;
|
|
20
|
+
export declare function isCodeHighlightingEnabled(): boolean;
|
|
21
|
+
/** Test helper — reset the singleton and registries to defaults. */
|
|
22
|
+
export declare function __resetCodeHighlightingForTests(): void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CardEnvelope } from './card-contract';
|
|
2
|
+
/** Rich link / Open-Graph preview payload. The card renders from this; it never fetches. */
|
|
3
|
+
export interface LinkPreviewData {
|
|
4
|
+
/** Canonical destination; opened via the contract `open` verb. */
|
|
5
|
+
url: string;
|
|
6
|
+
/** og:title — falls back to the domain. */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** og:description — clamped to 3 lines. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** og:image — degrades gracefully when missing/broken. */
|
|
11
|
+
image?: string;
|
|
12
|
+
/** Alt for the preview image (defaults to title / decorative). */
|
|
13
|
+
imageAlt?: string;
|
|
14
|
+
/** Site favicon. */
|
|
15
|
+
favicon?: string;
|
|
16
|
+
/** Display domain; derived from `url` when omitted. */
|
|
17
|
+
domain?: string;
|
|
18
|
+
/** og:site_name; preferred over `domain` when present. */
|
|
19
|
+
siteName?: string;
|
|
20
|
+
}
|
|
21
|
+
/** The full envelope an agent/server emits for a link preview card. */
|
|
22
|
+
export type LinkPreviewEnvelope = CardEnvelope<'link', LinkPreviewData>;
|
|
23
|
+
/** The `type` discriminator for link preview cards. */
|
|
24
|
+
export declare const LINK_PREVIEW_TYPE: "link";
|
|
25
|
+
/** App-supplied resolver: a bare URL → (partial) OG metadata. Usually hits YOUR backend. */
|
|
26
|
+
export type LinkMetadataFetcher = (url: string) => Promise<Partial<LinkPreviewData>>;
|
|
27
|
+
/**
|
|
28
|
+
* App opt-in: supply a function (usually hitting YOUR backend/proxy) that resolves
|
|
29
|
+
* a bare URL to OG metadata. CORS forbids reading cross-origin HTML in the browser,
|
|
30
|
+
* so there is intentionally NO default network implementation.
|
|
31
|
+
*/
|
|
32
|
+
export declare function configureLinkPreview(opts: {
|
|
33
|
+
fetchMetadata: LinkMetadataFetcher;
|
|
34
|
+
}): void;
|
|
35
|
+
/** True when an app has registered a fetcher (the bare-URL path is available). */
|
|
36
|
+
export declare function hasLinkPreviewFetcher(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Used by LinkPreview ONLY when the envelope lacks metadata AND a fetcher is set.
|
|
39
|
+
* Returns the merged metadata or throws (card shows its fallback/error state).
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveLinkMetadata(url: string): Promise<Partial<LinkPreviewData>>;
|
|
42
|
+
/** Test-only: clear the configured fetcher so tests stay isolated. */
|
|
43
|
+
export declare function __resetLinkPreviewForTests(): void;
|
|
44
|
+
/** Derive a clean display domain from a URL (strips a leading `www.`). `undefined` if unparseable. */
|
|
45
|
+
export declare function deriveDomain(url: string): string | undefined;
|
|
46
|
+
/** True when `url` is a syntactically valid http(s) URL (the only renderable link schemes). */
|
|
47
|
+
export declare function isRenderableLink(url: string): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Minimal shape of the pdf.js module + objects we rely on. */
|
|
2
|
+
export interface PdfViewportLike {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface PdfPageLike {
|
|
7
|
+
getViewport(opts: {
|
|
8
|
+
scale: number;
|
|
9
|
+
}): PdfViewportLike;
|
|
10
|
+
render(opts: {
|
|
11
|
+
canvasContext: CanvasRenderingContext2D | null;
|
|
12
|
+
viewport: PdfViewportLike;
|
|
13
|
+
}): {
|
|
14
|
+
promise: Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface PdfDocumentLike {
|
|
18
|
+
numPages: number;
|
|
19
|
+
getPage(n: number): Promise<PdfPageLike>;
|
|
20
|
+
}
|
|
21
|
+
export interface PdfjsLike {
|
|
22
|
+
getDocument(src: {
|
|
23
|
+
url: string;
|
|
24
|
+
}): {
|
|
25
|
+
promise: Promise<PdfDocumentLike>;
|
|
26
|
+
};
|
|
27
|
+
GlobalWorkerOptions: {
|
|
28
|
+
workerSrc: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface PdfPreviewOptions {
|
|
32
|
+
/** Turn inline PDF rendering on/off globally. When false, always show the card. */
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
/** Override the pdf.js module loader (self-host / CSP / version pin). */
|
|
35
|
+
load?: () => Promise<PdfjsLike>;
|
|
36
|
+
/** Worker URL. Default = the matching jsDelivr worker for the pinned version. */
|
|
37
|
+
workerSrc?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function configurePdfPreview(options: PdfPreviewOptions): void;
|
|
40
|
+
export declare function isPdfPreviewEnabled(): boolean;
|
|
41
|
+
export declare function __resetPdfPreviewForTests(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Render EVERY page of the PDF at `url` into `container` as stacked <canvas>
|
|
44
|
+
* elements fit to `pxWidth` CSS pixels (rendered at devicePixelRatio for
|
|
45
|
+
* crispness). Clears `container` first. Resolves `{ pages }`. THROWS on
|
|
46
|
+
* load / CORS / parse failure — the caller catches and shows the fallback card.
|
|
47
|
+
*/
|
|
48
|
+
export declare function renderPdfInto(url: string, container: HTMLElement, pxWidth: number): Promise<{
|
|
49
|
+
pages: number;
|
|
50
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function observeContentHeight(el: Element, onHeight: (height: number) => void): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UseTextStreamOptions {
|
|
2
|
+
mode: 'typewriter' | 'fade';
|
|
3
|
+
speed?: number;
|
|
4
|
+
characterChunkSize?: number;
|
|
5
|
+
fadeDuration?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TextStreamSegment {
|
|
8
|
+
text: string;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function useTextStream(options: UseTextStreamOptions): {
|
|
12
|
+
displayedText: import('solid-js').Accessor<string>;
|
|
13
|
+
isComplete: import('solid-js').Accessor<boolean>;
|
|
14
|
+
segments: import('solid-js').Accessor<TextStreamSegment[]>;
|
|
15
|
+
startStreaming: (source: string | AsyncIterable<string>) => void;
|
|
16
|
+
pause: () => void;
|
|
17
|
+
resume: () => void;
|
|
18
|
+
reset: () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface UseVoiceRecorderOptions {
|
|
2
|
+
mimeType?: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function useVoiceRecorder(options?: UseVoiceRecorderOptions): {
|
|
5
|
+
isRecording: import('solid-js').Accessor<boolean>;
|
|
6
|
+
error: import('solid-js').Accessor<string | null>;
|
|
7
|
+
start: () => Promise<Blob>;
|
|
8
|
+
stop: () => void;
|
|
9
|
+
};
|