@kitnai/chat 0.7.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 +1626 -883
- package/dist/kitn-chat.es.js +36 -36
- package/dist/llms/llms-full.txt +303 -142
- 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 +356 -189
- package/frameworks/react/runtime.tsx +2 -2
- package/llms-full.txt +303 -142
- 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 -20
- 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 -22
- package/src/elements/chain-of-thought.tsx +3 -3
- package/src/elements/{kitn-chat-scope-picker.stories.tsx → chat-scope-picker.stories.tsx} +10 -19
- package/src/elements/chat-scope-picker.tsx +4 -4
- package/src/elements/{kitn-chat-workspace.stories.tsx → chat-workspace.stories.tsx} +15 -23
- package/src/elements/chat-workspace.tsx +2 -2
- package/src/elements/{kitn-chat.stories.tsx → chat.stories.tsx} +12 -20
- package/src/elements/chat.tsx +2 -2
- package/src/elements/{kitn-checkpoint.stories.tsx → checkpoint.stories.tsx} +11 -20
- package/src/elements/checkpoint.tsx +4 -4
- package/src/elements/{kitn-code-block.stories.tsx → code-block.stories.tsx} +10 -19
- 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 -19
- package/src/elements/context-meter.tsx +3 -3
- package/src/elements/{kitn-conversation-list.stories.tsx → conversation-list.stories.tsx} +12 -20
- package/src/elements/conversation-list.tsx +2 -2
- package/src/elements/css.ts +1 -1
- package/src/elements/define.tsx +10 -10
- package/src/elements/element-meta.json +1379 -733
- 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 -21
- package/src/elements/empty.tsx +3 -3
- package/src/elements/{kitn-feedback-bar.stories.tsx → feedback-bar.stories.tsx} +11 -20
- 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 -21
- 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 -19
- 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 -20
- package/src/elements/loader.tsx +3 -3
- package/src/elements/{kitn-markdown.stories.tsx → markdown.stories.tsx} +10 -19
- package/src/elements/markdown.tsx +3 -3
- package/src/elements/{kitn-message-skills.stories.tsx → message-skills.stories.tsx} +10 -19
- package/src/elements/message-skills.tsx +3 -3
- package/src/elements/{kitn-message.stories.tsx → message.stories.tsx} +12 -21
- package/src/elements/message.tsx +5 -5
- package/src/elements/{kitn-model-switcher.stories.tsx → model-switcher.stories.tsx} +10 -19
- package/src/elements/model-switcher.tsx +5 -5
- package/src/elements/{kitn-prompt-input.stories.tsx → prompt-input.stories.tsx} +14 -22
- package/src/elements/prompt-input.tsx +3 -3
- package/src/elements/{kitn-prompt-suggestions.stories.tsx → prompt-suggestions.stories.tsx} +13 -22
- package/src/elements/prompt-suggestions.tsx +4 -4
- package/src/elements/{kitn-reasoning.stories.tsx → reasoning.stories.tsx} +10 -19
- 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 -19
- package/src/elements/response-stream.tsx +4 -4
- package/src/elements/{kitn-source-list.stories.tsx → source-list.stories.tsx} +11 -20
- package/src/elements/{kitn-source.stories.tsx → source.stories.tsx} +12 -21
- 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 -19
- package/src/elements/text-shimmer.tsx +3 -3
- package/src/elements/{kitn-thinking-bar.stories.tsx → thinking-bar.stories.tsx} +11 -20
- package/src/elements/thinking-bar.tsx +5 -5
- package/src/elements/{kitn-tool.stories.tsx → tool.stories.tsx} +10 -19
- package/src/elements/tool.tsx +3 -3
- package/src/elements/{kitn-voice-input.stories.tsx → voice-input.stories.tsx} +10 -19
- 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 +32 -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
- package/src/stories/docs/element-spec.tsx +0 -86
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
2
|
import type { JSX } from 'solid-js';
|
|
3
3
|
import { Textarea } from './textarea';
|
|
4
|
+
import { componentDescription } from '../stories/docs/element-controls';
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'UI/Textarea',
|
|
@@ -9,13 +10,11 @@ const meta = {
|
|
|
9
10
|
parameters: {
|
|
10
11
|
layout: 'padded',
|
|
11
12
|
docs: {
|
|
12
|
-
description:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
].join('\n\n'),
|
|
18
|
-
},
|
|
13
|
+
description: componentDescription([
|
|
14
|
+
'A single-line-by-default textarea that auto-grows with its content up to an optional `maxHeight`, after which it scrolls. It is **transparent and borderless by design** — it is meant to drop into a composed input frame that owns the visual boundary and focus ring (the demos below wrap it exactly the way `PromptInput` / `<kc-prompt-input>` does, with `focus-within` on the frame). This is the editable surface behind `PromptInput`.',
|
|
15
|
+
'**When to use:** free-text entry that may span multiple lines — a chat composer, a comment box, an editable note.',
|
|
16
|
+
'**How to use:** drop it inside a framed container and use it like a native `<textarea>` (`value`, `placeholder`, `onInput`, …). Auto-resize is on by default; set `maxHeight` (px) to cap growth, or `autoResize={false}` for a fixed-height field.',
|
|
17
|
+
]),
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
argTypes: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
2
|
import { Tooltip } from './tooltip';
|
|
3
3
|
import { Button } from './button';
|
|
4
|
+
import { componentDescription } from '../stories/docs/element-controls';
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'UI/Tooltip',
|
|
@@ -9,14 +10,12 @@ const meta = {
|
|
|
9
10
|
parameters: {
|
|
10
11
|
layout: 'padded',
|
|
11
12
|
docs: {
|
|
12
|
-
description:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
].join('\n\n'),
|
|
19
|
-
},
|
|
13
|
+
description: componentDescription([
|
|
14
|
+
'A small floating label that appears on hover/focus of its trigger element, built with a DIY overlay-core implementation (no third-party dependency, no arrow).',
|
|
15
|
+
'**When to use:** to clarify the purpose of icon-only buttons or terse controls — short, supplementary hints that are not essential to complete the action.',
|
|
16
|
+
'**How to use:** wrap a single interactive `children` element and set `content` to the hint text. The child becomes the trigger.',
|
|
17
|
+
'**Placement:** toolbars, message action rows, and any compact icon control where a label would not otherwise fit.',
|
|
18
|
+
]),
|
|
20
19
|
controls: { exclude: ['use:eventListener'] },
|
|
21
20
|
},
|
|
22
21
|
},
|
|
@@ -59,7 +58,7 @@ export const Playground: Story = {
|
|
|
59
58
|
export const OnIconButton: Story = {
|
|
60
59
|
render: () => (
|
|
61
60
|
<Tooltip content="Add new item">
|
|
62
|
-
<Button variant="ghost" size="icon-sm">
|
|
61
|
+
<Button variant="ghost" size="icon-sm" aria-label="Add new item">
|
|
63
62
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
64
63
|
<line x1="12" y1="5" x2="12" y2="19" />
|
|
65
64
|
<line x1="5" y1="12" x2="19" y2="12" />
|
package/theme.css
CHANGED
|
@@ -9,51 +9,51 @@
|
|
|
9
9
|
@custom-variant dark (&:is(.dark *));
|
|
10
10
|
|
|
11
11
|
@theme {
|
|
12
|
-
--color-background: var(--
|
|
13
|
-
--color-foreground: var(--
|
|
14
|
-
--color-card: var(--
|
|
15
|
-
--color-card-foreground: var(--
|
|
16
|
-
--color-popover: var(--
|
|
17
|
-
--color-popover-foreground: var(--
|
|
18
|
-
--color-primary: var(--
|
|
19
|
-
--color-primary-foreground: var(--
|
|
20
|
-
--color-secondary: var(--
|
|
21
|
-
--color-secondary-foreground: var(--
|
|
22
|
-
--color-muted: var(--
|
|
23
|
-
--color-muted-foreground: var(--
|
|
24
|
-
--color-accent: var(--
|
|
25
|
-
--color-accent-foreground: var(--
|
|
26
|
-
--color-destructive: var(--
|
|
27
|
-
--color-destructive-foreground: var(--
|
|
28
|
-
--color-border: var(--
|
|
29
|
-
--color-input: var(--
|
|
12
|
+
--color-background: var(--kc-color-background, hsl(0 0% 100%));
|
|
13
|
+
--color-foreground: var(--kc-color-foreground, hsl(240 10% 3.9%));
|
|
14
|
+
--color-card: var(--kc-color-card, hsl(0 0% 100%));
|
|
15
|
+
--color-card-foreground: var(--kc-color-card-foreground, hsl(240 10% 3.9%));
|
|
16
|
+
--color-popover: var(--kc-color-popover, hsl(0 0% 100%));
|
|
17
|
+
--color-popover-foreground: var(--kc-color-popover-foreground, hsl(240 10% 3.9%));
|
|
18
|
+
--color-primary: var(--kc-color-primary, hsl(240 5.9% 10%));
|
|
19
|
+
--color-primary-foreground: var(--kc-color-primary-foreground, hsl(0 0% 98%));
|
|
20
|
+
--color-secondary: var(--kc-color-secondary, hsl(240 4.8% 95.9%));
|
|
21
|
+
--color-secondary-foreground: var(--kc-color-secondary-foreground, hsl(240 5.9% 10%));
|
|
22
|
+
--color-muted: var(--kc-color-muted, hsl(240 4.8% 95.9%));
|
|
23
|
+
--color-muted-foreground: var(--kc-color-muted-foreground, hsl(240 3.8% 43%));
|
|
24
|
+
--color-accent: var(--kc-color-accent, hsl(240 4.8% 95.9%));
|
|
25
|
+
--color-accent-foreground: var(--kc-color-accent-foreground, hsl(240 5.9% 10%));
|
|
26
|
+
--color-destructive: var(--kc-color-destructive, hsl(0 72% 45%));
|
|
27
|
+
--color-destructive-foreground: var(--kc-color-destructive-foreground, hsl(0 0% 98%));
|
|
28
|
+
--color-border: var(--kc-color-border, hsl(240 5.9% 90%));
|
|
29
|
+
--color-input: var(--kc-color-input, hsl(240 5.9% 90%));
|
|
30
30
|
/* Focus ring — a deliberate blue (not a neutral) so keyboard focus is always
|
|
31
31
|
obvious and on-brand in both modes. Light uses a strong blue; dark uses a
|
|
32
32
|
brighter one for contrast on dark surfaces. Both clear WCAG 2.1 non-text
|
|
33
|
-
contrast (≥3:1) against the kit's backgrounds. Override via --
|
|
34
|
-
--color-ring: var(--
|
|
33
|
+
contrast (≥3:1) against the kit's backgrounds. Override via --kc-color-ring. */
|
|
34
|
+
--color-ring: var(--kc-color-ring, hsl(217 91% 53%));
|
|
35
35
|
/* Custom scrollbars — thin, rounded, subtle; thumb strengthens on hover. A
|
|
36
36
|
consistent cross-platform look (the kit styles its OWN scroll regions inside
|
|
37
37
|
the shadow root; the track stays transparent so nothing is forced where no
|
|
38
|
-
scrollbar is needed). Override via --
|
|
39
|
-
--color-scrollbar-thumb: var(--
|
|
40
|
-
--color-scrollbar-thumb-hover: var(--
|
|
41
|
-
--color-sidebar: var(--
|
|
38
|
+
scrollbar is needed). Override via --kc-color-scrollbar-thumb(-hover). */
|
|
39
|
+
--color-scrollbar-thumb: var(--kc-color-scrollbar-thumb, hsl(240 5% 80%));
|
|
40
|
+
--color-scrollbar-thumb-hover: var(--kc-color-scrollbar-thumb-hover, hsl(240 4% 64%));
|
|
41
|
+
--color-sidebar: var(--kc-color-sidebar, hsl(0 0% 100%));
|
|
42
42
|
|
|
43
43
|
/* Inline `code` accent. Blue text on a translucent blue chip. */
|
|
44
|
-
--color-code-foreground: var(--
|
|
44
|
+
--color-code-foreground: var(--kc-color-code-foreground, hsl(224.3 76.3% 48%));
|
|
45
45
|
|
|
46
46
|
/* Tool/status chip hues. Each chip is hue text over a 15% translucent fill of
|
|
47
47
|
the SAME hue (set in tool.tsx). The bare hue is too light to reach WCAG AA
|
|
48
48
|
(4.5:1) on the faint fill in LIGHT mode, so the light values are darkened;
|
|
49
49
|
dark mode keeps brighter hues for AA on the dark fill. Override via
|
|
50
|
-
--
|
|
51
|
-
--color-tool-blue: var(--
|
|
52
|
-
--color-tool-amber: var(--
|
|
53
|
-
--color-tool-green: var(--
|
|
54
|
-
--color-tool-red: var(--
|
|
50
|
+
--kc-color-tool-* to retheme. */
|
|
51
|
+
--color-tool-blue: var(--kc-color-tool-blue, hsl(217 91% 38%));
|
|
52
|
+
--color-tool-amber: var(--kc-color-tool-amber, hsl(38 92% 28%));
|
|
53
|
+
--color-tool-green: var(--kc-color-tool-green, hsl(142 71% 26%));
|
|
54
|
+
--color-tool-red: var(--kc-color-tool-red, hsl(0 72% 42%));
|
|
55
55
|
|
|
56
|
-
--radius: var(--
|
|
56
|
+
--radius: var(--kc-radius, 0.6rem);
|
|
57
57
|
--radius-sm: calc(var(--radius) - 4px);
|
|
58
58
|
--radius-md: calc(var(--radius) - 2px);
|
|
59
59
|
--radius-lg: var(--radius);
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
|
|
62
62
|
/* Typography scale — semantic sizes shared by all components. Each generates a
|
|
63
63
|
Tailwind utility (text-caption / text-meta / text-body / text-title). To
|
|
64
|
-
restyle the kit's typography, override the namespaced --
|
|
65
|
-
:root (e.g. `--
|
|
66
|
-
var() fallback, exactly like the --
|
|
64
|
+
restyle the kit's typography, override the namespaced --kc-text-* token on
|
|
65
|
+
:root (e.g. `--kc-text-body: 0.9375rem`) — it pierces the Shadow DOM via the
|
|
66
|
+
var() fallback, exactly like the --kc-color-* tokens. The bare --text-*
|
|
67
67
|
names stay internal so a host's own --text-* can't collide. (Message/markdown/
|
|
68
68
|
input reading size also scales with the `proseSize` prop; these tokens cover
|
|
69
69
|
the fixed chrome & controls.) */
|
|
70
|
-
--text-caption: var(--
|
|
71
|
-
--text-meta: var(--
|
|
72
|
-
--text-body: var(--
|
|
73
|
-
--text-title: var(--
|
|
70
|
+
--text-caption: var(--kc-text-caption, 0.6875rem); --text-caption--line-height: 1rem; /* 11px — micro labels, badges, sub-counts */
|
|
71
|
+
--text-meta: var(--kc-text-meta, 0.75rem); --text-meta--line-height: 1.1rem; /* 12px — controls, toggles, switchers, captions */
|
|
72
|
+
--text-body: var(--kc-text-body, 0.875rem); --text-body--line-height: 1.45rem; /* 14px — primary reading text */
|
|
73
|
+
--text-title: var(--kc-text-title, 1rem); --text-title--line-height: 1.5rem; /* 16px — emphasis / headers */
|
|
74
74
|
|
|
75
75
|
@keyframes typing { 0%,100% { transform: translateY(0); opacity: .5 } 50% { transform: translateY(-2px); opacity: 1 } }
|
|
76
76
|
@keyframes loading-dots { 0%,100% { opacity: 0 } 50% { opacity: 1 } }
|
|
@@ -89,35 +89,35 @@
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.dark {
|
|
92
|
-
--color-background: var(--
|
|
93
|
-
--color-foreground: var(--
|
|
94
|
-
--color-card: var(--
|
|
95
|
-
--color-card-foreground: var(--
|
|
96
|
-
--color-popover: var(--
|
|
97
|
-
--color-popover-foreground: var(--
|
|
98
|
-
--color-primary: var(--
|
|
99
|
-
--color-primary-foreground: var(--
|
|
100
|
-
--color-secondary: var(--
|
|
101
|
-
--color-secondary-foreground: var(--
|
|
102
|
-
--color-muted: var(--
|
|
103
|
-
--color-muted-foreground: var(--
|
|
104
|
-
--color-accent: var(--
|
|
105
|
-
--color-accent-foreground: var(--
|
|
106
|
-
--color-destructive: var(--
|
|
107
|
-
--color-destructive-foreground: var(--
|
|
108
|
-
--color-border: var(--
|
|
109
|
-
--color-input: var(--
|
|
110
|
-
--color-ring: var(--
|
|
111
|
-
--color-scrollbar-thumb: var(--
|
|
112
|
-
--color-scrollbar-thumb-hover: var(--
|
|
113
|
-
--color-sidebar: var(--
|
|
114
|
-
--color-code-foreground: var(--
|
|
92
|
+
--color-background: var(--kc-color-background, hsl(50 2% 9%));
|
|
93
|
+
--color-foreground: var(--kc-color-foreground, hsl(0 0% 98%));
|
|
94
|
+
--color-card: var(--kc-color-card, hsl(45 4% 12%));
|
|
95
|
+
--color-card-foreground: var(--kc-color-card-foreground, hsl(0 0% 98%));
|
|
96
|
+
--color-popover: var(--kc-color-popover, hsl(45 4% 12%));
|
|
97
|
+
--color-popover-foreground: var(--kc-color-popover-foreground, hsl(0 0% 98%));
|
|
98
|
+
--color-primary: var(--kc-color-primary, hsl(0 0% 98%));
|
|
99
|
+
--color-primary-foreground: var(--kc-color-primary-foreground, hsl(45 4% 11%));
|
|
100
|
+
--color-secondary: var(--kc-color-secondary, hsl(45 4% 17%));
|
|
101
|
+
--color-secondary-foreground: var(--kc-color-secondary-foreground, hsl(0 0% 98%));
|
|
102
|
+
--color-muted: var(--kc-color-muted, hsl(45 4% 17%));
|
|
103
|
+
--color-muted-foreground: var(--kc-color-muted-foreground, hsl(45 4% 64%));
|
|
104
|
+
--color-accent: var(--kc-color-accent, hsl(45 4% 17%));
|
|
105
|
+
--color-accent-foreground: var(--kc-color-accent-foreground, hsl(0 0% 98%));
|
|
106
|
+
--color-destructive: var(--kc-color-destructive, hsl(0 62.8% 30.6%));
|
|
107
|
+
--color-destructive-foreground: var(--kc-color-destructive-foreground, hsl(0 0% 98%));
|
|
108
|
+
--color-border: var(--kc-color-border, hsl(45 4% 17%));
|
|
109
|
+
--color-input: var(--kc-color-input, hsl(45 4% 17%));
|
|
110
|
+
--color-ring: var(--kc-color-ring, hsl(217 91% 68%));
|
|
111
|
+
--color-scrollbar-thumb: var(--kc-color-scrollbar-thumb, hsl(45 3% 30%));
|
|
112
|
+
--color-scrollbar-thumb-hover: var(--kc-color-scrollbar-thumb-hover, hsl(45 3% 42%));
|
|
113
|
+
--color-sidebar: var(--kc-color-sidebar, hsl(50 2% 7%));
|
|
114
|
+
--color-code-foreground: var(--kc-color-code-foreground, hsl(213 94% 78%));
|
|
115
115
|
|
|
116
116
|
/* Tool/status chip hues — dark mode. Brighter hues reach AA on the dark fill. */
|
|
117
|
-
--color-tool-blue: var(--
|
|
118
|
-
--color-tool-amber: var(--
|
|
119
|
-
--color-tool-green: var(--
|
|
120
|
-
--color-tool-red: var(--
|
|
117
|
+
--color-tool-blue: var(--kc-color-tool-blue, hsl(217 91% 70%));
|
|
118
|
+
--color-tool-amber: var(--kc-color-tool-amber, hsl(38 92% 50%));
|
|
119
|
+
--color-tool-green: var(--kc-color-tool-green, hsl(142 71% 45%));
|
|
120
|
+
--color-tool-red: var(--kc-color-tool-red, hsl(0 84% 70%));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/* Self-contained markdown styling — replaces the typography plugin's `prose`.
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { For, Show } from 'solid-js';
|
|
2
|
-
import meta from '../../elements/element-meta.json';
|
|
3
|
-
|
|
4
|
-
type Prop = { name: string; type: string; default?: string; scalar: boolean; description: string };
|
|
5
|
-
type Event = { name: string; detail: string | null; description: string };
|
|
6
|
-
type Composed = { name: string; group: string; storyId?: string };
|
|
7
|
-
type ElementMeta = { tag: string; className: string; props: Prop[]; events: Event[]; composedFrom: Composed[]; tokens: string[] };
|
|
8
|
-
|
|
9
|
-
const all = meta as unknown as ElementMeta[];
|
|
10
|
-
|
|
11
|
-
const th = 'text-left font-semibold px-2 py-1.5 border-b border-border text-foreground';
|
|
12
|
-
const td = 'px-2 py-1.5 border-b border-border align-top text-muted-foreground';
|
|
13
|
-
const code = 'font-mono text-[0.85em] text-code-foreground';
|
|
14
|
-
|
|
15
|
-
export function ElementSpec(props: { tag: string }) {
|
|
16
|
-
const el = () => all.find((e) => e.tag === props.tag);
|
|
17
|
-
return (
|
|
18
|
-
<Show when={el()} fallback={<p>Unknown element: {props.tag}</p>}>
|
|
19
|
-
{(e) => (
|
|
20
|
-
<div class="text-sm space-y-6">
|
|
21
|
-
<section>
|
|
22
|
-
<h3 class="text-title font-semibold text-foreground mb-2">Properties</h3>
|
|
23
|
-
<table class="w-full border-collapse">
|
|
24
|
-
<thead><tr><th class={th}>Property</th><th class={th}>Attribute</th><th class={th}>Type / values</th><th class={th}>Default</th></tr></thead>
|
|
25
|
-
<tbody>
|
|
26
|
-
<For each={e().props}>{(p) => (
|
|
27
|
-
<tr>
|
|
28
|
-
<td class={td}><span class={code}>{p.name}</span></td>
|
|
29
|
-
<td class={td}>{p.scalar ? <span class={code}>{kebab(p.name)}</span> : <span class="opacity-50">— (property only)</span>}</td>
|
|
30
|
-
<td class={td}><span class={code}>{p.type}</span></td>
|
|
31
|
-
<td class={td}>{p.default ? <span class={code}>{p.default}</span> : '—'}</td>
|
|
32
|
-
</tr>
|
|
33
|
-
)}</For>
|
|
34
|
-
</tbody>
|
|
35
|
-
</table>
|
|
36
|
-
</section>
|
|
37
|
-
|
|
38
|
-
<Show when={e().events.length}>
|
|
39
|
-
<section>
|
|
40
|
-
<h3 class="text-title font-semibold text-foreground mb-2">Events</h3>
|
|
41
|
-
<p class="text-muted-foreground mb-2 text-xs">Non-bubbling <span class={code}>CustomEvent</span>s on the element; the payload is on <span class={code}>event.detail</span>.</p>
|
|
42
|
-
<table class="w-full border-collapse">
|
|
43
|
-
<thead><tr><th class={th}>Event</th><th class={th}>detail</th><th class={th}>Description</th></tr></thead>
|
|
44
|
-
<tbody>
|
|
45
|
-
<For each={e().events}>{(ev) => (
|
|
46
|
-
<tr>
|
|
47
|
-
<td class={td}><span class={code}>{ev.name}</span></td>
|
|
48
|
-
<td class={td}><span class={code}>{detailText(ev.detail)}</span></td>
|
|
49
|
-
<td class={td}>{ev.description}</td>
|
|
50
|
-
</tr>
|
|
51
|
-
)}</For>
|
|
52
|
-
</tbody>
|
|
53
|
-
</table>
|
|
54
|
-
</section>
|
|
55
|
-
</Show>
|
|
56
|
-
|
|
57
|
-
<Show when={e().composedFrom.length}>
|
|
58
|
-
<section>
|
|
59
|
-
<h3 class="text-title font-semibold text-foreground mb-2">Composed from</h3>
|
|
60
|
-
<p class="text-muted-foreground mb-2 text-xs">This element wraps these SolidJS components:</p>
|
|
61
|
-
<div class="flex flex-wrap gap-2">
|
|
62
|
-
<For each={e().composedFrom}>{(c) => (
|
|
63
|
-
<a class="rounded-md bg-muted px-2 py-1 text-xs text-foreground hover:bg-accent no-underline" href={`?path=/docs/${c.storyId}`}>
|
|
64
|
-
{c.group}/{c.name}
|
|
65
|
-
</a>
|
|
66
|
-
)}</For>
|
|
67
|
-
</div>
|
|
68
|
-
</section>
|
|
69
|
-
</Show>
|
|
70
|
-
|
|
71
|
-
<section>
|
|
72
|
-
<h3 class="text-title font-semibold text-foreground mb-2">Theming</h3>
|
|
73
|
-
<p class="text-muted-foreground text-xs">
|
|
74
|
-
Themed by the global design tokens — override any <span class={code}>--color-*</span> token to rebrand (see the <a href="?path=/docs/theming-token-reference--docs" class="text-primary">Token Reference</a>).
|
|
75
|
-
<Show when={e().tokens.length}>{' '}This element also reads:{' '}<For each={e().tokens}>{(t, i) => <><span class={code}>{t}</span>{i() < e().tokens.length - 1 ? ', ' : ''}</>}</For>.</Show>
|
|
76
|
-
</p>
|
|
77
|
-
</section>
|
|
78
|
-
</div>
|
|
79
|
-
)}
|
|
80
|
-
</Show>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function kebab(name: string) { return name.replace(/([A-Z])/g, '-$1').toLowerCase(); }
|
|
85
|
-
// Payloadless events (no detail, or an empty `Record<string, never>`) render as a dash.
|
|
86
|
-
function detailText(detail: string | null) { return !detail || detail === 'Record<string, never>' ? '—' : detail; }
|