@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
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
|
-
import { createSignal } from 'solid-js';
|
|
3
|
-
import { FileTree, type FileTreeFile } from './file-tree';
|
|
4
|
-
import { componentDescription } from '../stories/docs/element-controls';
|
|
5
|
-
|
|
6
|
-
const FILES: FileTreeFile[] = [
|
|
7
|
-
{ path: 'index.html', type: 'html' },
|
|
8
|
-
{ path: 'about.html', type: 'html' },
|
|
9
|
-
{ path: 'css/site.css', type: 'other', language: 'css' },
|
|
10
|
-
{ path: 'src/app.ts', type: 'other', language: 'ts' },
|
|
11
|
-
{ path: 'src/lib/format.ts', type: 'other', language: 'ts' },
|
|
12
|
-
{ path: 'src/lib/parse.ts', type: 'other', language: 'ts' },
|
|
13
|
-
{ path: 'assets/logo.svg', type: 'image' },
|
|
14
|
-
{ path: 'assets/report.pdf', type: 'pdf' },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
const meta = {
|
|
18
|
-
title: 'Solid (Advanced)/Elements/FileTree',
|
|
19
|
-
component: FileTree,
|
|
20
|
-
tags: ['autodocs'],
|
|
21
|
-
parameters: {
|
|
22
|
-
layout: 'padded',
|
|
23
|
-
docs: {
|
|
24
|
-
description: componentDescription([
|
|
25
|
-
'A collapsible, keyboard-navigable file explorer built from a flat list of `/`-delimited paths — nested folders are derived automatically. ARIA `tree`/`treeitem`.',
|
|
26
|
-
'**When to use:** any file/folder tree — the Code tab of `Artifact` uses it, and it is exported for standalone reuse (project explorers, attachment browsers, doc outlines).',
|
|
27
|
-
'**How to use:** pass `files` (`{ path, url?, code?, language?, type? }[]`); folders come from `/` in each path and `type` picks the icon. Control highlight via `activeFile`, initial open folders via `defaultExpanded`, and handle `onSelect(path, file)`. Arrow keys navigate; Enter/Space selects or toggles.',
|
|
28
|
-
'**Placement:** a sidebar/explorer column.',
|
|
29
|
-
]),
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
argTypes: {
|
|
33
|
-
files: { control: false },
|
|
34
|
-
activeFile: { control: 'text' },
|
|
35
|
-
},
|
|
36
|
-
args: { files: FILES, activeFile: 'src/app.ts' },
|
|
37
|
-
render: (args) => (
|
|
38
|
-
<div class="w-64 h-80 overflow-auto rounded-lg border border-border scrollbar-thin">
|
|
39
|
-
<FileTree files={args.files} activeFile={args.activeFile} />
|
|
40
|
-
</div>
|
|
41
|
-
),
|
|
42
|
-
} satisfies Meta<typeof FileTree>;
|
|
43
|
-
|
|
44
|
-
export default meta;
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
const IMPORT = `import { FileTree } from '@kitn.ai/ui';`;
|
|
48
|
-
const src = (code: string) => ({
|
|
49
|
-
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const Playground: Story = {
|
|
53
|
-
...src(`<FileTree files={files} activeFile="src/app.ts" onSelect={(p) => set(p)} />`),
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/** Drives selection from `onSelect` — the controlled pattern. */
|
|
57
|
-
export const Interactive: Story = {
|
|
58
|
-
render: () => {
|
|
59
|
-
const [active, setActive] = createSignal('src/lib/format.ts');
|
|
60
|
-
return (
|
|
61
|
-
<div class="flex flex-col gap-2">
|
|
62
|
-
<div class="w-64 h-80 overflow-auto rounded-lg border border-border scrollbar-thin">
|
|
63
|
-
<FileTree files={FILES} activeFile={active()} onSelect={(p) => setActive(p)} />
|
|
64
|
-
</div>
|
|
65
|
-
<span class="text-sm text-muted-foreground">
|
|
66
|
-
Selected: <code>{active()}</code>
|
|
67
|
-
</span>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
},
|
|
71
|
-
...src(`const [active, setActive] = createSignal('src/lib/format.ts');
|
|
72
|
-
<FileTree files={files} activeFile={active()} onSelect={setActive} />`),
|
|
73
|
-
};
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
|
-
import { fn } from 'storybook/test';
|
|
3
|
-
import { createSignal, For } from 'solid-js';
|
|
4
|
-
import { FileUpload, FileUploadTrigger, FileUploadContent } from './file-upload';
|
|
5
|
-
import { Upload } from 'lucide-solid';
|
|
6
|
-
import { componentDescription } from '../stories/docs/element-controls';
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title: 'Solid (Advanced)/Elements/FileUpload',
|
|
10
|
-
component: FileUpload,
|
|
11
|
-
tags: ['autodocs'],
|
|
12
|
-
parameters: {
|
|
13
|
-
layout: 'padded',
|
|
14
|
-
docs: {
|
|
15
|
-
controls: { exclude: ['use:eventListener'] },
|
|
16
|
-
description: componentDescription([
|
|
17
|
-
'A headless file-upload root that handles window-wide drag-and-drop plus a hidden file input, composed with `FileUploadTrigger` (opens the picker) and `FileUploadContent` (full-screen drop overlay).',
|
|
18
|
-
'**When to use:** to let users attach files to a chat — via a button click or by dragging files anywhere onto the page.',
|
|
19
|
-
'**How to use:** wrap a `FileUploadTrigger` and optional `FileUploadContent` in `FileUpload`, and read selected files from `onFilesAdded`. Set `multiple`, `accept`, or `disabled` as needed.',
|
|
20
|
-
'**Placement:** in the prompt input area or composer toolbar where attachments are added.',
|
|
21
|
-
]),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
argTypes: {
|
|
25
|
-
multiple: {
|
|
26
|
-
control: 'boolean',
|
|
27
|
-
description: 'Allow selecting / dropping more than one file.',
|
|
28
|
-
table: { defaultValue: { summary: 'true' } },
|
|
29
|
-
},
|
|
30
|
-
accept: {
|
|
31
|
-
control: 'text',
|
|
32
|
-
description: 'Accepted file types, forwarded to the file input (e.g. `image/*`).',
|
|
33
|
-
},
|
|
34
|
-
disabled: {
|
|
35
|
-
control: 'boolean',
|
|
36
|
-
description: 'Disables the file input and suppresses the drop overlay.',
|
|
37
|
-
},
|
|
38
|
-
onFilesAdded: {
|
|
39
|
-
action: 'filesAdded',
|
|
40
|
-
description: 'Fired with the selected/dropped `File[]` (capped to one when `multiple` is false).',
|
|
41
|
-
table: { category: 'Events' },
|
|
42
|
-
},
|
|
43
|
-
children: {
|
|
44
|
-
control: false,
|
|
45
|
-
description: 'Trigger and overlay composition (`FileUploadTrigger`, `FileUploadContent`).',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
args: {
|
|
49
|
-
multiple: true,
|
|
50
|
-
onFilesAdded: fn(),
|
|
51
|
-
},
|
|
52
|
-
render: (args) => (
|
|
53
|
-
<FileUpload {...args}>
|
|
54
|
-
<FileUploadTrigger class="inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground hover:bg-primary/90">
|
|
55
|
-
<Upload class="size-4" />
|
|
56
|
-
Upload files
|
|
57
|
-
</FileUploadTrigger>
|
|
58
|
-
<FileUploadContent class="flex flex-col items-center gap-2">
|
|
59
|
-
<Upload class="size-12 text-muted-foreground" />
|
|
60
|
-
<p class="text-lg font-medium">Drop files here</p>
|
|
61
|
-
</FileUploadContent>
|
|
62
|
-
</FileUpload>
|
|
63
|
-
),
|
|
64
|
-
} satisfies Meta<typeof FileUpload>;
|
|
65
|
-
|
|
66
|
-
export default meta;
|
|
67
|
-
type Story = StoryObj<typeof meta>;
|
|
68
|
-
|
|
69
|
-
const IMPORT = `import { FileUpload, FileUploadTrigger, FileUploadContent } from '@kitn.ai/ui';`;
|
|
70
|
-
const src = (code: string) => ({
|
|
71
|
-
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
/** Interactive playground — toggle multiple/disabled and watch the `filesAdded` action. */
|
|
75
|
-
export const Playground: Story = {
|
|
76
|
-
...src(`<FileUpload onFilesAdded={(files) => console.log(files)}>
|
|
77
|
-
<FileUploadTrigger class="...">
|
|
78
|
-
<Upload class="size-4" /> Upload files
|
|
79
|
-
</FileUploadTrigger>
|
|
80
|
-
<FileUploadContent class="...">
|
|
81
|
-
<Upload class="size-12" />
|
|
82
|
-
<p>Drop files here</p>
|
|
83
|
-
</FileUploadContent>
|
|
84
|
-
</FileUpload>`),
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/** Multi-file upload with a live list of selected files (showcase). */
|
|
88
|
-
export const Default: Story = {
|
|
89
|
-
render: () => {
|
|
90
|
-
const [files, setFiles] = createSignal<File[]>([]);
|
|
91
|
-
return (
|
|
92
|
-
<div class="space-y-4">
|
|
93
|
-
<FileUpload onFilesAdded={(f) => setFiles((prev) => [...prev, ...f])}>
|
|
94
|
-
<FileUploadTrigger class="inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground hover:bg-primary/90">
|
|
95
|
-
<Upload class="size-4" />
|
|
96
|
-
Upload files
|
|
97
|
-
</FileUploadTrigger>
|
|
98
|
-
<FileUploadContent class="flex flex-col items-center gap-2">
|
|
99
|
-
<Upload class="size-12 text-muted-foreground" />
|
|
100
|
-
<p class="text-lg font-medium">Drop files here</p>
|
|
101
|
-
</FileUploadContent>
|
|
102
|
-
</FileUpload>
|
|
103
|
-
<div class="space-y-1">
|
|
104
|
-
<For each={files()}>
|
|
105
|
-
{(file) => (
|
|
106
|
-
<div class="text-sm text-muted-foreground">
|
|
107
|
-
{file.name} ({(file.size / 1024).toFixed(1)} KB)
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
</For>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
},
|
|
115
|
-
...src(`<FileUpload onFilesAdded={(f) => setFiles((prev) => [...prev, ...f])}>
|
|
116
|
-
<FileUploadTrigger class="...">
|
|
117
|
-
<Upload class="size-4" /> Upload files
|
|
118
|
-
</FileUploadTrigger>
|
|
119
|
-
<FileUploadContent class="...">
|
|
120
|
-
<Upload class="size-12" />
|
|
121
|
-
<p>Drop files here</p>
|
|
122
|
-
</FileUploadContent>
|
|
123
|
-
</FileUpload>`),
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
/** Single-file, image-only upload (showcase). */
|
|
127
|
-
export const SingleFile: Story = {
|
|
128
|
-
render: () => {
|
|
129
|
-
const [file, setFile] = createSignal<File | null>(null);
|
|
130
|
-
return (
|
|
131
|
-
<div class="space-y-4">
|
|
132
|
-
<FileUpload
|
|
133
|
-
onFilesAdded={(f) => setFile(f[0] ?? null)}
|
|
134
|
-
multiple={false}
|
|
135
|
-
accept="image/*"
|
|
136
|
-
>
|
|
137
|
-
<FileUploadTrigger class="rounded-md bg-muted px-4 py-2 text-sm hover:bg-muted/80">
|
|
138
|
-
Choose image
|
|
139
|
-
</FileUploadTrigger>
|
|
140
|
-
<FileUploadContent>
|
|
141
|
-
<p class="text-lg font-medium">Drop an image here</p>
|
|
142
|
-
</FileUploadContent>
|
|
143
|
-
</FileUpload>
|
|
144
|
-
<div class="text-sm text-muted-foreground">
|
|
145
|
-
{file() ? `Selected: ${file()!.name}` : 'No file selected'}
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
},
|
|
150
|
-
...src(`<FileUpload onFilesAdded={(f) => setFile(f[0] ?? null)} multiple={false} accept="image/*">
|
|
151
|
-
<FileUploadTrigger class="...">Choose image</FileUploadTrigger>
|
|
152
|
-
<FileUploadContent>
|
|
153
|
-
<p>Drop an image here</p>
|
|
154
|
-
</FileUploadContent>
|
|
155
|
-
</FileUpload>`),
|
|
156
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
|
-
import { Image } from './image';
|
|
3
|
-
import { componentDescription } from '../stories/docs/element-controls';
|
|
4
|
-
|
|
5
|
-
// Compact SVG chat typing icon as base64
|
|
6
|
-
const chatIconBase64 =
|
|
7
|
-
'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4Ij48cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHJ4PSIxMCIgZmlsbD0iIzdjM2FlZCIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iMjQiIHI9IjQiIGZpbGw9IiNmZmYiLz48Y2lyY2xlIGN4PSIyNCIgY3k9IjI0IiByPSI0IiBmaWxsPSIjZmZmIi8+PGNpcmNsZSBjeD0iMzIiIGN5PSIyNCIgcj0iNCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==';
|
|
8
|
-
|
|
9
|
-
const meta = {
|
|
10
|
-
title: 'Solid (Advanced)/Elements/Image',
|
|
11
|
-
component: Image,
|
|
12
|
-
tags: ['autodocs'],
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: 'padded',
|
|
15
|
-
docs: {
|
|
16
|
-
controls: { exclude: ['use:eventListener'] },
|
|
17
|
-
description: componentDescription([
|
|
18
|
-
'Renders an image from a `base64` string or a `uint8Array`, building a data URL or object URL automatically; shows a pulsing placeholder until a source is available.',
|
|
19
|
-
'**When to use:** to display model-generated or attached images supplied as raw bytes / base64 (the `GeneratedImageLike` shape) rather than a remote URL.',
|
|
20
|
-
'**How to use:** pass `base64` + `mediaType` (or `uint8Array` + `mediaType`) and an `alt` description; size and style via `class`.',
|
|
21
|
-
'**Placement:** inside assistant messages, attachment previews, or anywhere a generated image needs to be shown.',
|
|
22
|
-
]),
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
argTypes: {
|
|
26
|
-
base64: {
|
|
27
|
-
control: 'text',
|
|
28
|
-
description: 'Base64-encoded image data. Combined with `mediaType` to form a data URL.',
|
|
29
|
-
},
|
|
30
|
-
uint8Array: {
|
|
31
|
-
control: 'object',
|
|
32
|
-
description: 'Raw image bytes. Combined with `mediaType` to form an object URL.',
|
|
33
|
-
},
|
|
34
|
-
mediaType: {
|
|
35
|
-
control: 'text',
|
|
36
|
-
description: 'MIME type of the image data, e.g. `image/png` or `image/svg+xml`.',
|
|
37
|
-
table: { defaultValue: { summary: 'image/png' } },
|
|
38
|
-
},
|
|
39
|
-
alt: {
|
|
40
|
-
control: 'text',
|
|
41
|
-
description: 'Alternative text describing the image (also used on the placeholder).',
|
|
42
|
-
},
|
|
43
|
-
class: {
|
|
44
|
-
control: 'text',
|
|
45
|
-
description: 'Additional CSS classes for the image / placeholder element.',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
args: {
|
|
49
|
-
base64: chatIconBase64,
|
|
50
|
-
mediaType: 'image/svg+xml',
|
|
51
|
-
alt: 'Compact gradient chat icon',
|
|
52
|
-
class: 'h-24 w-24 rounded-md',
|
|
53
|
-
},
|
|
54
|
-
render: (args) => <Image {...args} />,
|
|
55
|
-
} satisfies Meta<typeof Image>;
|
|
56
|
-
|
|
57
|
-
export default meta;
|
|
58
|
-
type Story = StoryObj<typeof meta>;
|
|
59
|
-
|
|
60
|
-
const IMPORT = `import { Image } from '@kitn.ai/ui';`;
|
|
61
|
-
const src = (code: string) => ({
|
|
62
|
-
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
/** Interactive playground — swap the base64 data, media type, and sizing classes. */
|
|
66
|
-
export const Playground: Story = {
|
|
67
|
-
...src(`<Image
|
|
68
|
-
base64={chatIconBase64}
|
|
69
|
-
mediaType="image/svg+xml"
|
|
70
|
-
alt="Compact gradient chat icon"
|
|
71
|
-
class="h-24 w-24 rounded-md"
|
|
72
|
-
/>`),
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const Basic: Story = {
|
|
76
|
-
args: { class: 'h-24 w-24 rounded-md' },
|
|
77
|
-
...src(`<Image base64={chatIconBase64} mediaType="image/svg+xml" alt="Compact gradient chat icon" class="h-24 w-24 rounded-md" />`),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const CustomSize: Story = {
|
|
81
|
-
args: { alt: 'Large preview', class: 'h-64 w-64 rounded-lg' },
|
|
82
|
-
...src(`<Image base64={chatIconBase64} mediaType="image/svg+xml" alt="Large preview" class="h-64 w-64 rounded-lg" />`),
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/** Placeholder state shown while no `base64`/`uint8Array` source is available (showcase). */
|
|
86
|
-
export const Placeholder: Story = {
|
|
87
|
-
render: () => <Image alt="Loading image" class="h-24 w-24 rounded-md" />,
|
|
88
|
-
...src(`<Image alt="Loading image" class="h-24 w-24 rounded-md" />`),
|
|
89
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
|
-
import { For } from 'solid-js';
|
|
3
|
-
import { Loader, type LoaderVariant, type LoaderSize } from './loader';
|
|
4
|
-
import { componentDescription } from '../stories/docs/element-controls';
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: 'Solid (Advanced)/Elements/Loader',
|
|
8
|
-
component: Loader,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'padded',
|
|
12
|
-
docs: {
|
|
13
|
-
controls: { exclude: ['use:eventListener'] },
|
|
14
|
-
description: componentDescription([
|
|
15
|
-
'A loading indicator with twelve animated **variants** (spinners, dots, bars, terminal, and text-based) in three **sizes**.',
|
|
16
|
-
'**When to use:** while waiting on an async operation — a streaming response, a tool call, or any pending state.',
|
|
17
|
-
'**How to use:** pick a `variant` and `size`. Text variants (`text-blink`, `text-shimmer`, `loading-dots`) display the `text` prop (defaults to "Thinking").',
|
|
18
|
-
'**Placement:** inside assistant message bubbles, send-button states, empty states, or anywhere an in-progress signal is needed.',
|
|
19
|
-
]),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
variant: {
|
|
24
|
-
control: 'select',
|
|
25
|
-
options: [
|
|
26
|
-
'circular', 'classic', 'pulse', 'pulse-dot', 'dots', 'typing',
|
|
27
|
-
'wave', 'bars', 'terminal', 'text-blink', 'text-shimmer', 'loading-dots',
|
|
28
|
-
],
|
|
29
|
-
description: 'Animation style of the loader.',
|
|
30
|
-
table: { defaultValue: { summary: 'circular' } },
|
|
31
|
-
},
|
|
32
|
-
size: {
|
|
33
|
-
control: 'select',
|
|
34
|
-
options: ['sm', 'md', 'lg'],
|
|
35
|
-
description: 'Loader size preset.',
|
|
36
|
-
table: { defaultValue: { summary: 'md' } },
|
|
37
|
-
},
|
|
38
|
-
text: {
|
|
39
|
-
control: 'text',
|
|
40
|
-
description: 'Label shown by the text variants (`text-blink`, `text-shimmer`, `loading-dots`).',
|
|
41
|
-
table: { defaultValue: { summary: 'Thinking' } },
|
|
42
|
-
},
|
|
43
|
-
class: {
|
|
44
|
-
control: 'text',
|
|
45
|
-
description: 'Additional CSS classes for the loader element.',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
args: {
|
|
49
|
-
variant: 'circular',
|
|
50
|
-
size: 'md',
|
|
51
|
-
text: 'Thinking',
|
|
52
|
-
},
|
|
53
|
-
render: (args) => <Loader {...args} />,
|
|
54
|
-
} satisfies Meta<typeof Loader>;
|
|
55
|
-
|
|
56
|
-
export default meta;
|
|
57
|
-
type Story = StoryObj<typeof meta>;
|
|
58
|
-
|
|
59
|
-
const IMPORT = `import { Loader } from '@kitn.ai/ui';`;
|
|
60
|
-
const src = (code: string) => ({
|
|
61
|
-
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
/** Interactive playground — switch variant, size, and text to explore every loader. */
|
|
65
|
-
export const Playground: Story = {
|
|
66
|
-
...src(`<Loader variant="circular" size="md" />`),
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const Classic: Story = {
|
|
70
|
-
args: { variant: 'classic' },
|
|
71
|
-
...src(`<Loader variant="classic" size="md" />`),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const Pulse: Story = {
|
|
75
|
-
args: { variant: 'pulse' },
|
|
76
|
-
...src(`<Loader variant="pulse" size="md" />`),
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const PulseDot: Story = {
|
|
80
|
-
args: { variant: 'pulse-dot' },
|
|
81
|
-
...src(`<Loader variant="pulse-dot" size="md" />`),
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const Dots: Story = {
|
|
85
|
-
args: { variant: 'dots' },
|
|
86
|
-
...src(`<Loader variant="dots" size="md" />`),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const Typing: Story = {
|
|
90
|
-
args: { variant: 'typing' },
|
|
91
|
-
...src(`<Loader variant="typing" size="md" />`),
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const Wave: Story = {
|
|
95
|
-
args: { variant: 'wave' },
|
|
96
|
-
...src(`<Loader variant="wave" size="md" />`),
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const Bars: Story = {
|
|
100
|
-
args: { variant: 'bars' },
|
|
101
|
-
...src(`<Loader variant="bars" size="md" />`),
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const Terminal: Story = {
|
|
105
|
-
args: { variant: 'terminal' },
|
|
106
|
-
...src(`<Loader variant="terminal" size="md" />`),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const TextBlink: Story = {
|
|
110
|
-
args: { variant: 'text-blink', text: 'Thinking' },
|
|
111
|
-
...src(`<Loader variant="text-blink" text="Thinking" size="md" />`),
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const TextShimmer: Story = {
|
|
115
|
-
args: { variant: 'text-shimmer', text: 'Analyzing' },
|
|
116
|
-
...src(`<Loader variant="text-shimmer" text="Analyzing" size="md" />`),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const LoadingDots: Story = {
|
|
120
|
-
args: { variant: 'loading-dots', text: 'Processing' },
|
|
121
|
-
...src(`<Loader variant="loading-dots" text="Processing" size="md" />`),
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const allVariants: LoaderVariant[] = [
|
|
125
|
-
'circular', 'classic', 'pulse', 'pulse-dot', 'dots', 'typing',
|
|
126
|
-
'wave', 'bars', 'terminal', 'text-blink', 'text-shimmer', 'loading-dots',
|
|
127
|
-
];
|
|
128
|
-
|
|
129
|
-
const allSizes: LoaderSize[] = ['sm', 'md', 'lg'];
|
|
130
|
-
|
|
131
|
-
/** Every variant across every size (showcase — not driven by controls). */
|
|
132
|
-
export const AllVariantsGrid: Story = {
|
|
133
|
-
render: () => (
|
|
134
|
-
<div class="space-y-6">
|
|
135
|
-
<For each={allVariants}>
|
|
136
|
-
{(variant) => (
|
|
137
|
-
<div class="flex items-center gap-6">
|
|
138
|
-
<span class="w-28 text-sm text-muted-foreground font-mono">{variant}</span>
|
|
139
|
-
<For each={allSizes}>
|
|
140
|
-
{(size) => (
|
|
141
|
-
<div class="flex items-center justify-center w-24 h-10">
|
|
142
|
-
<Loader
|
|
143
|
-
variant={variant}
|
|
144
|
-
size={size}
|
|
145
|
-
text={['text-blink', 'text-shimmer', 'loading-dots'].includes(variant) ? 'Loading' : undefined}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
)}
|
|
149
|
-
</For>
|
|
150
|
-
</div>
|
|
151
|
-
)}
|
|
152
|
-
</For>
|
|
153
|
-
</div>
|
|
154
|
-
),
|
|
155
|
-
...src(`<Loader variant="circular" size="sm" />
|
|
156
|
-
<Loader variant="circular" size="md" />
|
|
157
|
-
<Loader variant="circular" size="lg" />`),
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
/** A single variant rendered at all three sizes (showcase). */
|
|
161
|
-
export const AllSizes: Story = {
|
|
162
|
-
render: () => (
|
|
163
|
-
<div class="flex items-end gap-6">
|
|
164
|
-
<div class="text-center space-y-2">
|
|
165
|
-
<Loader variant="circular" size="sm" />
|
|
166
|
-
<p class="text-xs text-muted-foreground">Small</p>
|
|
167
|
-
</div>
|
|
168
|
-
<div class="text-center space-y-2">
|
|
169
|
-
<Loader variant="circular" size="md" />
|
|
170
|
-
<p class="text-xs text-muted-foreground">Medium</p>
|
|
171
|
-
</div>
|
|
172
|
-
<div class="text-center space-y-2">
|
|
173
|
-
<Loader variant="circular" size="lg" />
|
|
174
|
-
<p class="text-xs text-muted-foreground">Large</p>
|
|
175
|
-
</div>
|
|
176
|
-
</div>
|
|
177
|
-
),
|
|
178
|
-
...src(`<Loader variant="circular" size="sm" />
|
|
179
|
-
<Loader variant="circular" size="md" />
|
|
180
|
-
<Loader variant="circular" size="lg" />`),
|
|
181
|
-
};
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
|
-
import { Markdown } from './markdown';
|
|
3
|
-
import { componentDescription } from '../stories/docs/element-controls';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Solid (Advanced)/Elements/Markdown',
|
|
7
|
-
component: Markdown,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: 'padded',
|
|
11
|
-
docs: {
|
|
12
|
-
controls: { exclude: ['use:eventListener'] },
|
|
13
|
-
description: componentDescription([
|
|
14
|
-
'Renders a Markdown string to styled HTML (GFM enabled — tables, lists, blockquotes), splitting fenced code into highlighted `CodeBlock`s.',
|
|
15
|
-
'**When to use:** to display assistant message content, documentation, or any rich text authored in Markdown.',
|
|
16
|
-
'**How to use:** pass the Markdown string as `content`; optionally set `codeTheme` for code fences and `class` for the prose container. Prose sizing follows the surrounding `ChatConfig`.',
|
|
17
|
-
'**Placement:** inside `MessageContent`, response panels, or anywhere formatted text is shown.',
|
|
18
|
-
]),
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
content: {
|
|
23
|
-
control: 'text',
|
|
24
|
-
description: 'The Markdown source string to render.',
|
|
25
|
-
},
|
|
26
|
-
id: {
|
|
27
|
-
control: 'text',
|
|
28
|
-
description: 'Optional stable id used for block keys (auto-generated if omitted).',
|
|
29
|
-
},
|
|
30
|
-
codeTheme: {
|
|
31
|
-
control: 'text',
|
|
32
|
-
description: 'Shiki theme name applied to fenced code blocks (falls back to the chat config theme).',
|
|
33
|
-
},
|
|
34
|
-
class: {
|
|
35
|
-
control: 'text',
|
|
36
|
-
description: 'Additional CSS classes for the prose container.',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
args: {
|
|
40
|
-
content: 'This is a simple paragraph of text rendered through the **Markdown** component.',
|
|
41
|
-
},
|
|
42
|
-
render: (args) => <Markdown {...args} />,
|
|
43
|
-
} satisfies Meta<typeof Markdown>;
|
|
44
|
-
|
|
45
|
-
export default meta;
|
|
46
|
-
type Story = StoryObj<typeof meta>;
|
|
47
|
-
|
|
48
|
-
const IMPORT = `import { Markdown } from '@kitn.ai/ui';`;
|
|
49
|
-
const src = (code: string) => ({
|
|
50
|
-
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/** Interactive playground — edit the `content` control to render any Markdown. */
|
|
54
|
-
export const Playground: Story = {
|
|
55
|
-
...src(`<Markdown content="This is a simple paragraph of **Markdown** text." />`),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const PlainText: Story = {
|
|
59
|
-
args: {
|
|
60
|
-
content: 'This is a simple paragraph of text rendered through the Markdown component.',
|
|
61
|
-
},
|
|
62
|
-
...src(`<Markdown content="This is a simple paragraph of text rendered through the Markdown component." />`),
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const Headings: Story = {
|
|
66
|
-
args: {
|
|
67
|
-
content: `# Heading 1
|
|
68
|
-
## Heading 2
|
|
69
|
-
### Heading 3
|
|
70
|
-
#### Heading 4
|
|
71
|
-
|
|
72
|
-
Some text below the headings.`,
|
|
73
|
-
},
|
|
74
|
-
...src(`<Markdown content={\`# Heading 1
|
|
75
|
-
## Heading 2
|
|
76
|
-
### Heading 3
|
|
77
|
-
|
|
78
|
-
Some text below the headings.\`} />`),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const CodeBlocks: Story = {
|
|
82
|
-
args: {
|
|
83
|
-
content: `Here is some inline \`code\` in a paragraph.
|
|
84
|
-
|
|
85
|
-
\`\`\`typescript
|
|
86
|
-
const x: number = 42;
|
|
87
|
-
console.log(x);
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
And another block:
|
|
91
|
-
|
|
92
|
-
\`\`\`python
|
|
93
|
-
print("hello world")
|
|
94
|
-
\`\`\``,
|
|
95
|
-
},
|
|
96
|
-
...src(`<Markdown content={\`Here is some inline \\\`code\\\` in a paragraph.
|
|
97
|
-
|
|
98
|
-
\\\`\\\`\\\`typescript
|
|
99
|
-
const x: number = 42;
|
|
100
|
-
console.log(x);
|
|
101
|
-
\\\`\\\`\\\`\`} />`),
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const Lists: Story = {
|
|
105
|
-
args: {
|
|
106
|
-
content: `### Unordered List
|
|
107
|
-
- First item
|
|
108
|
-
- Second item
|
|
109
|
-
- Nested item
|
|
110
|
-
- Another nested
|
|
111
|
-
- Third item
|
|
112
|
-
|
|
113
|
-
### Ordered List
|
|
114
|
-
1. Step one
|
|
115
|
-
2. Step two
|
|
116
|
-
3. Step three`,
|
|
117
|
-
},
|
|
118
|
-
...src(`<Markdown content={\`### Unordered List
|
|
119
|
-
- First item
|
|
120
|
-
- Second item
|
|
121
|
-
- Nested item
|
|
122
|
-
|
|
123
|
-
### Ordered List
|
|
124
|
-
1. Step one
|
|
125
|
-
2. Step two\`} />`),
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export const GFMTable: Story = {
|
|
129
|
-
args: {
|
|
130
|
-
content: `### Comparison Table
|
|
131
|
-
|
|
132
|
-
| Feature | SolidJS | React | Svelte |
|
|
133
|
-
|---------|---------|-------|--------|
|
|
134
|
-
| Reactivity | Fine-grained | Virtual DOM | Compiler |
|
|
135
|
-
| Bundle Size | ~7KB | ~40KB | ~2KB |
|
|
136
|
-
| Performance | Excellent | Good | Excellent |
|
|
137
|
-
| Learning Curve | Moderate | Moderate | Easy |`,
|
|
138
|
-
},
|
|
139
|
-
...src(`<Markdown content={\`| Feature | SolidJS | React |
|
|
140
|
-
|---------|---------|-------|
|
|
141
|
-
| Reactivity | Fine-grained | Virtual DOM |
|
|
142
|
-
| Bundle Size | ~7KB | ~40KB |\`} />`),
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export const RichContent: Story = {
|
|
146
|
-
args: {
|
|
147
|
-
class: 'max-w-2xl',
|
|
148
|
-
content: `# Project Overview
|
|
149
|
-
|
|
150
|
-
This is a **comprehensive** guide to building modern web applications.
|
|
151
|
-
|
|
152
|
-
## Key Technologies
|
|
153
|
-
|
|
154
|
-
- **SolidJS** -- Reactive UI framework
|
|
155
|
-
- **TypeScript** -- Type-safe JavaScript
|
|
156
|
-
- **Tailwind CSS** -- Utility-first styling
|
|
157
|
-
|
|
158
|
-
## Getting Started
|
|
159
|
-
|
|
160
|
-
\`\`\`bash
|
|
161
|
-
pnpm create solid
|
|
162
|
-
cd my-app
|
|
163
|
-
pnpm install
|
|
164
|
-
pnpm dev
|
|
165
|
-
\`\`\`
|
|
166
|
-
|
|
167
|
-
> **Note:** Make sure you have Node.js 18+ installed.
|
|
168
|
-
|
|
169
|
-
## Architecture
|
|
170
|
-
|
|
171
|
-
| Layer | Technology | Purpose |
|
|
172
|
-
|-------|-----------|---------|
|
|
173
|
-
| UI | SolidJS | Components |
|
|
174
|
-
| State | Signals | Reactivity |
|
|
175
|
-
| Styling | Tailwind | Design |
|
|
176
|
-
|
|
177
|
-
For more info, visit [solidjs.com](https://solidjs.com).`,
|
|
178
|
-
},
|
|
179
|
-
...src(`<Markdown class="max-w-2xl" content={richMarkdown} />`),
|
|
180
|
-
};
|