@assistant-ui/mcp-docs-server 0.2.2 → 0.2.3
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/.docs/organized/code-examples/waterfall.md +2 -2
- package/.docs/organized/code-examples/with-a2a.md +4 -3
- package/.docs/organized/code-examples/with-ag-ui.md +5 -4
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +12 -11
- package/.docs/organized/code-examples/with-artifacts.md +10 -9
- package/.docs/organized/code-examples/with-assistant-transport.md +4 -3
- package/.docs/organized/code-examples/with-browser-extension.md +3 -3
- package/.docs/organized/code-examples/with-chain-of-thought.md +14 -12
- package/.docs/organized/code-examples/with-cloud-standalone.md +5 -5
- package/.docs/organized/code-examples/with-cloud.md +9 -8
- package/.docs/organized/code-examples/with-custom-thread-list.md +8 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +12 -11
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +12 -11
- package/.docs/organized/code-examples/with-eve.md +5 -4
- package/.docs/organized/code-examples/with-expo.md +214 -31
- package/.docs/organized/code-examples/with-external-store.md +4 -3
- package/.docs/organized/code-examples/with-ffmpeg.md +9 -8
- package/.docs/organized/code-examples/with-generative-ui.md +13 -15
- package/.docs/organized/code-examples/with-google-adk.md +4 -3
- package/.docs/organized/code-examples/with-heat-graph.md +2 -2
- package/.docs/organized/code-examples/with-image-generation.md +7 -6
- package/.docs/organized/code-examples/with-interactables.md +9 -8
- package/.docs/organized/code-examples/with-langchain.md +6 -5
- package/.docs/organized/code-examples/with-langgraph.md +6 -5
- package/.docs/organized/code-examples/with-livekit.md +13 -12
- package/.docs/organized/code-examples/with-mcp.md +11 -9
- package/.docs/organized/code-examples/with-nuxt.md +502 -502
- package/.docs/organized/code-examples/with-opencode.md +3 -3
- package/.docs/organized/code-examples/with-openui.md +14 -13
- package/.docs/organized/code-examples/with-pi.md +5 -4
- package/.docs/organized/code-examples/with-react-hook-form.md +13 -10
- package/.docs/organized/code-examples/with-react-ink-web.md +64 -14
- package/.docs/organized/code-examples/with-react-ink.md +3 -2
- package/.docs/organized/code-examples/with-react-router.md +6 -5
- package/.docs/organized/code-examples/with-resumable-stream.md +10 -9
- package/.docs/organized/code-examples/with-store.md +2 -2
- package/.docs/organized/code-examples/with-svelte.md +3 -3
- package/.docs/organized/code-examples/with-sveltekit.md +9 -9
- package/.docs/organized/code-examples/with-tanstack.md +8 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +4 -3
- package/.docs/organized/code-examples/with-virtualized-thread.md +5 -4
- package/.docs/organized/code-examples/with-vue.md +2 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +24 -24
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +19 -19
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +22 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +3 -0
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +2 -0
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +2 -2
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/dictation.mdx +1 -1
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- package/.docs/raw/docs/guides/message-timing.mdx +11 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
- package/.docs/raw/docs/guides/speech.mdx +1 -1
- package/.docs/raw/docs/guides/suggestions.mdx +2 -2
- package/.docs/raw/docs/guides/voice.mdx +1 -1
- package/.docs/raw/docs/ink/hooks.mdx +1 -1
- package/.docs/raw/docs/ink/index.mdx +3 -2
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/index.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
- package/.docs/raw/docs/primitives/attachment.mdx +1 -1
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
- package/.docs/raw/docs/primitives/composer.mdx +1 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -1
- package/.docs/raw/docs/primitives/message.mdx +1 -1
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +1 -1
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +1 -1
- package/.docs/raw/docs/react-native/adapters.mdx +1 -1
- package/.docs/raw/docs/react-native/index.mdx +2 -2
- package/.docs/raw/docs/react-native/migration.mdx +2 -2
- package/.docs/raw/docs/react-native/primitives.mdx +142 -5
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +13 -1
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +5 -5
- package/.docs/raw/docs/runtimes/langchain.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +1 -1
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +2 -2
- package/.docs/raw/docs/tools/generative-ui.mdx +2 -2
- package/.docs/raw/docs/tools/interactables.mdx +3 -3
- package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
- package/.docs/raw/docs/tools/mcp.mdx +2 -2
- package/.docs/raw/docs/tools/openui.mdx +2 -2
- package/.docs/raw/docs/tools/tool-ui.mdx +17 -5
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +2 -2
- package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
- package/.docs/raw/docs/ui/attachment.mdx +30 -10
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -1
- package/.docs/raw/docs/ui/directive-text.mdx +1 -1
- package/.docs/raw/docs/ui/file.mdx +1 -1
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +1 -1
- package/.docs/raw/docs/ui/markdown.mdx +40 -1
- package/.docs/raw/docs/ui/mermaid.mdx +1 -1
- package/.docs/raw/docs/ui/message-timing.mdx +1 -1
- package/.docs/raw/docs/ui/model-selector.mdx +4 -4
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
- package/.docs/raw/docs/ui/quote.mdx +3 -3
- package/.docs/raw/docs/ui/reasoning.mdx +31 -3
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
- package/.docs/raw/docs/ui/sources.mdx +10 -1
- package/.docs/raw/docs/ui/streamdown.mdx +2 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread-list.mdx +40 -1
- package/.docs/raw/docs/ui/thread.mdx +49 -2
- package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
- package/.docs/raw/docs/ui/tool-group.mdx +1 -1
- package/.docs/raw/docs/ui/voice.mdx +1 -1
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/xulux/catalog-client.d.ts.map +1 -1
- package/dist/xulux/catalog-client.js +51 -6
- package/dist/xulux/catalog-client.js.map +1 -1
- package/dist/xulux/types.d.ts +7 -7
- package/dist/xulux/types.d.ts.map +1 -1
- package/dist/xulux/types.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/tests/docs.test.ts +10 -7
- package/src/tools/tests/path-traversal.test.ts +5 -2
- package/src/tools/tests/xulux-templates.test.ts +63 -0
- package/src/xulux/catalog-client.ts +68 -23
- package/src/xulux/types.ts +17 -13
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- package/.docs/raw/docs/ui/number-roll.mdx +0 -154
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Diff Viewer"
|
|
3
|
-
description: Render code diffs with syntax highlighting for additions and deletions.
|
|
4
|
-
links:
|
|
5
|
-
- label: parse-diff
|
|
6
|
-
url: https://github.com/sergeyt/parse-diff
|
|
7
|
-
- label: diff
|
|
8
|
-
url: https://github.com/kpdecker/jsdiff
|
|
9
|
-
platforms: ["react"]
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
13
|
-
import {
|
|
14
|
-
DiffViewerSample,
|
|
15
|
-
DiffViewerSplitSample,
|
|
16
|
-
DiffViewerViewModesSample,
|
|
17
|
-
DiffViewerVariantsSample,
|
|
18
|
-
DiffViewerSizesSample,
|
|
19
|
-
} from "@/components/docs/samples/diff-viewer";
|
|
20
|
-
|
|
21
|
-
<Callout>
|
|
22
|
-
This is a **standalone component** that does not depend on the assistant-ui runtime.
|
|
23
|
-
</Callout>
|
|
24
|
-
|
|
25
|
-
<DiffViewerViewModesSample />
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
<InstallCommand shadcn={["diff-viewer"]} />
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
```tsx
|
|
34
|
-
import { DiffViewer } from "@/components/assistant-ui/diff-viewer";
|
|
35
|
-
|
|
36
|
-
// With a unified diff patch
|
|
37
|
-
<DiffViewer patch={diffString} />
|
|
38
|
-
|
|
39
|
-
// With file comparison
|
|
40
|
-
<DiffViewer
|
|
41
|
-
oldFile={{ content: "old content", name: "file.txt" }}
|
|
42
|
-
newFile={{ content: "new content", name: "file.txt" }}
|
|
43
|
-
/>
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### As Markdown Language Override
|
|
47
|
-
|
|
48
|
-
Integrate with `MarkdownTextPrimitive` to render diff code blocks:
|
|
49
|
-
|
|
50
|
-
```tsx title="/components/assistant-ui/markdown-text.tsx"
|
|
51
|
-
import { DiffViewer } from "@/components/assistant-ui/diff-viewer"; // [!code ++]
|
|
52
|
-
|
|
53
|
-
const MarkdownTextImpl = () => {
|
|
54
|
-
return (
|
|
55
|
-
<MarkdownTextPrimitive
|
|
56
|
-
remarkPlugins={[remarkGfm]}
|
|
57
|
-
className="aui-md"
|
|
58
|
-
components={defaultComponents}
|
|
59
|
-
componentsByLanguage={{ // [!code ++]
|
|
60
|
-
diff: { // [!code ++]
|
|
61
|
-
SyntaxHighlighter: ({ code }) => <DiffViewer patch={code} /> // [!code ++]
|
|
62
|
-
}, // [!code ++]
|
|
63
|
-
}} // [!code ++]
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const MarkdownText = memo(MarkdownTextImpl);
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Examples
|
|
72
|
-
|
|
73
|
-
### Unified View
|
|
74
|
-
|
|
75
|
-
Shows all changes in a single column with `+`/`-` indicators. This is the default mode.
|
|
76
|
-
|
|
77
|
-
<DiffViewerSample />
|
|
78
|
-
|
|
79
|
-
```tsx
|
|
80
|
-
<DiffViewer patch={diffString} viewMode="unified" />
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Split View
|
|
84
|
-
|
|
85
|
-
Shows old content on the left, new content on the right side-by-side.
|
|
86
|
-
|
|
87
|
-
<DiffViewerSplitSample />
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
<DiffViewer patch={diffString} viewMode="split" />
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Interactive Mode Toggle
|
|
94
|
-
|
|
95
|
-
<PreviewCode file="components/docs/samples/diff-viewer" name="DiffViewerViewModesSample">
|
|
96
|
-
<DiffViewerViewModesSample />
|
|
97
|
-
</PreviewCode>
|
|
98
|
-
|
|
99
|
-
### Variants
|
|
100
|
-
|
|
101
|
-
<DiffViewerVariantsSample />
|
|
102
|
-
|
|
103
|
-
### Sizes
|
|
104
|
-
|
|
105
|
-
<DiffViewerSizesSample />
|
|
106
|
-
|
|
107
|
-
### Theming
|
|
108
|
-
|
|
109
|
-
DiffViewer uses CSS variables for colors. Override them in your CSS:
|
|
110
|
-
|
|
111
|
-
```css
|
|
112
|
-
[data-slot="diff-viewer"] {
|
|
113
|
-
--diff-add-bg: rgba(46, 160, 67, 0.15);
|
|
114
|
-
--diff-add-text: #1a7f37;
|
|
115
|
-
--diff-add-text-dark: #3fb950;
|
|
116
|
-
--diff-del-bg: rgba(248, 81, 73, 0.15);
|
|
117
|
-
--diff-del-text: #cf222e;
|
|
118
|
-
--diff-del-text-dark: #f85149;
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
| Variable | Description |
|
|
123
|
-
|----------|-------------|
|
|
124
|
-
| `--diff-add-bg` | Background for added lines |
|
|
125
|
-
| `--diff-add-text` | Text color for added lines (light mode) |
|
|
126
|
-
| `--diff-add-text-dark` | Text color for added lines (dark mode) |
|
|
127
|
-
| `--diff-del-bg` | Background for deleted lines |
|
|
128
|
-
| `--diff-del-text` | Text color for deleted lines (light mode) |
|
|
129
|
-
| `--diff-del-text-dark` | Text color for deleted lines (dark mode) |
|
|
130
|
-
|
|
131
|
-
## API Reference
|
|
132
|
-
|
|
133
|
-
### DiffViewer
|
|
134
|
-
|
|
135
|
-
The main component for rendering diffs.
|
|
136
|
-
|
|
137
|
-
<ParametersTable
|
|
138
|
-
type="DiffViewerProps"
|
|
139
|
-
parameters={[
|
|
140
|
-
{
|
|
141
|
-
name: "patch",
|
|
142
|
-
type: "string",
|
|
143
|
-
description: "Unified diff string (e.g., output from git diff).",
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "code",
|
|
147
|
-
type: "string",
|
|
148
|
-
description: "Alias for patch (for markdown integration).",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
name: "oldFile",
|
|
152
|
-
type: "{ content: string; name?: string }",
|
|
153
|
-
description: "Old file for direct comparison.",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: "newFile",
|
|
157
|
-
type: "{ content: string; name?: string }",
|
|
158
|
-
description: "New file for direct comparison.",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: "viewMode",
|
|
162
|
-
type: '"unified" | "split"',
|
|
163
|
-
default: '"unified"',
|
|
164
|
-
description: "Display mode for the diff.",
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "variant",
|
|
168
|
-
type: '"default" | "ghost" | "muted"',
|
|
169
|
-
default: '"default"',
|
|
170
|
-
description: "Visual style variant.",
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "size",
|
|
174
|
-
type: '"sm" | "default" | "lg"',
|
|
175
|
-
default: '"default"',
|
|
176
|
-
description: "Font size.",
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: "showLineNumbers",
|
|
180
|
-
type: "boolean",
|
|
181
|
-
default: "true",
|
|
182
|
-
description: "Show line numbers.",
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: "showIcon",
|
|
186
|
-
type: "boolean",
|
|
187
|
-
default: "true",
|
|
188
|
-
description: "Show file extension badge in header.",
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "showStats",
|
|
192
|
-
type: "boolean",
|
|
193
|
-
default: "true",
|
|
194
|
-
description: "Show addition/deletion counts in header.",
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: "className",
|
|
198
|
-
type: "string",
|
|
199
|
-
description: "Additional CSS classes.",
|
|
200
|
-
},
|
|
201
|
-
]}
|
|
202
|
-
/>
|
|
203
|
-
|
|
204
|
-
### Composable API
|
|
205
|
-
|
|
206
|
-
| Component | Description |
|
|
207
|
-
|-----------|-------------|
|
|
208
|
-
| `DiffViewer` | Main component that renders the diff. |
|
|
209
|
-
| `DiffViewerFile` | Wrapper for each file in multi-file diffs. |
|
|
210
|
-
| `DiffViewerHeader` | File name header with icon and stats. |
|
|
211
|
-
| `DiffViewerContent` | Scrollable content area. |
|
|
212
|
-
| `DiffViewerLine` | Individual line in unified mode. |
|
|
213
|
-
| `DiffViewerSplitLine` | Side-by-side line pair in split mode. |
|
|
214
|
-
| `DiffViewerFileBadge` | File extension badge (e.g., "TS"). |
|
|
215
|
-
| `DiffViewerStats` | Addition/deletion count display. |
|
|
216
|
-
|
|
217
|
-
### Style Variants (CVA)
|
|
218
|
-
|
|
219
|
-
| Export | Description |
|
|
220
|
-
|--------|-------------|
|
|
221
|
-
| `diffViewerVariants` | Styles for the root container. |
|
|
222
|
-
| `diffLineVariants` | Background styles for diff lines. |
|
|
223
|
-
| `diffLineTextVariants` | Text color styles for diff lines. |
|
|
224
|
-
|
|
225
|
-
```tsx
|
|
226
|
-
import {
|
|
227
|
-
diffViewerVariants,
|
|
228
|
-
diffLineVariants,
|
|
229
|
-
diffLineTextVariants,
|
|
230
|
-
} from "@/components/assistant-ui/diff-viewer";
|
|
231
|
-
|
|
232
|
-
// Use variants directly
|
|
233
|
-
<div className={diffViewerVariants({ variant: "ghost", size: "sm" })}>
|
|
234
|
-
Custom diff container
|
|
235
|
-
</div>
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Utilities
|
|
239
|
-
|
|
240
|
-
| Export | Description |
|
|
241
|
-
|--------|-------------|
|
|
242
|
-
| `parsePatch(patch)` | Parse unified diff string into structured data. |
|
|
243
|
-
| `computeDiff(old, new)` | Compute diff between two strings. |
|
|
244
|
-
| `ParsedLine` | Type for a single diff line. |
|
|
245
|
-
| `ParsedFile` | Type for a parsed file with lines and stats. |
|
|
246
|
-
| `SplitLinePair` | Type for a side-by-side line pair. |
|
|
247
|
-
|
|
248
|
-
## Styling
|
|
249
|
-
|
|
250
|
-
### Data Attributes
|
|
251
|
-
|
|
252
|
-
Use data attributes for custom styling:
|
|
253
|
-
|
|
254
|
-
| Attribute | Values | Description |
|
|
255
|
-
|-----------|--------|-------------|
|
|
256
|
-
| `data-slot` | `"diff-viewer"`, `"diff-viewer-header"`, `"diff-viewer-line"`, etc. | Component identification |
|
|
257
|
-
| `data-type` | `"add"`, `"del"`, `"normal"`, `"empty"` | Line type |
|
|
258
|
-
| `data-view-mode` | `"unified"`, `"split"` | Current view mode |
|
|
259
|
-
| `data-variant` | `"default"`, `"ghost"`, `"muted"` | Current variant |
|
|
260
|
-
|
|
261
|
-
### Custom CSS Example
|
|
262
|
-
|
|
263
|
-
```css
|
|
264
|
-
[data-slot="diff-viewer"][data-view-mode="split"] {
|
|
265
|
-
/* Custom split view styles */
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
[data-slot="diff-viewer-line"][data-type="add"] {
|
|
269
|
-
/* Custom addition styles */
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
[data-slot="diff-viewer-line"][data-type="del"] {
|
|
273
|
-
/* Custom deletion styles */
|
|
274
|
-
}
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
## Related Components
|
|
278
|
-
|
|
279
|
-
- [Markdown](/docs/ui/markdown) - Rich text rendering where diff viewer can be integrated
|
|
280
|
-
- [Syntax Highlighting](/docs/ui/syntax-highlighting) - Code highlighting for other languages
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Dot Matrix
|
|
3
|
-
description: Tiny 5x5 dot-matrix indicator with 20 state-specific blink patterns.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
8
|
-
import {
|
|
9
|
-
DotMatrixSample,
|
|
10
|
-
DotMatrixLifecycleSample,
|
|
11
|
-
DotMatrixInlineSample,
|
|
12
|
-
DotMatrixSizesSample,
|
|
13
|
-
} from "@/components/docs/samples/dot-matrix";
|
|
14
|
-
|
|
15
|
-
<Callout>
|
|
16
|
-
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
17
|
-
</Callout>
|
|
18
|
-
|
|
19
|
-
<DotMatrixSample />
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
<InstallCommand shadcn={["dot-matrix"]} />
|
|
24
|
-
|
|
25
|
-
This adds a `/components/assistant-ui/dot-matrix.tsx` file to your project, which you can adjust as needed. The component has no dependencies beyond React.
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { DotMatrix } from "@/components/assistant-ui/dot-matrix";
|
|
31
|
-
|
|
32
|
-
export function RunIndicator({ isRunning }: { isRunning: boolean }) {
|
|
33
|
-
return <DotMatrix state={isRunning ? "loading" : "success"} />;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Dots inherit the surrounding text color, so the matrix renders dark dots on light backgrounds and light dots on dark backgrounds without configuration. Every state is a combination of a dot pattern, a motion, and a color, and switching states cross-fades each dot into its new pattern.
|
|
38
|
-
|
|
39
|
-
## States
|
|
40
|
-
|
|
41
|
-
| State | Pattern |
|
|
42
|
-
|-------|---------|
|
|
43
|
-
| `idle` | Dim static grid |
|
|
44
|
-
| `loading` | Randomized twinkle (default) |
|
|
45
|
-
| `thinking` | Diagonal wave |
|
|
46
|
-
| `streaming` | Falling rain, per-column streaks |
|
|
47
|
-
| `searching` | Horizontal sweep |
|
|
48
|
-
| `syncing` | Rotating sweep around the center |
|
|
49
|
-
| `connecting` | Ripple expanding from the center |
|
|
50
|
-
| `waiting` | Ellipsis dots blinking in sequence |
|
|
51
|
-
| `uploading` | Wave rising upward |
|
|
52
|
-
| `downloading` | Wave falling downward |
|
|
53
|
-
| `listening` | Slow equalizer columns |
|
|
54
|
-
| `speaking` | Fast equalizer columns |
|
|
55
|
-
| `recording` | Red center dot breathing |
|
|
56
|
-
| `success` | Green check glyph, static |
|
|
57
|
-
| `error` | Red cross glyph, blinking |
|
|
58
|
-
| `warning` | Amber exclamation glyph, slow blink |
|
|
59
|
-
| `info` | Blue info glyph, static |
|
|
60
|
-
| `paused` | Pause bars glyph, static |
|
|
61
|
-
| `stopped` | Square glyph, static |
|
|
62
|
-
| `offline` | Very dim static grid |
|
|
63
|
-
|
|
64
|
-
The component exports `dotMatrixStates` (the ordered list above) and the `DotMatrixState` union type, so UIs can enumerate or map states without duplicating the list. New states are added by extending the `STATES` record in the component source with a glyph and a per-dot blink function.
|
|
65
|
-
|
|
66
|
-
## Examples
|
|
67
|
-
|
|
68
|
-
### State Lifecycle
|
|
69
|
-
|
|
70
|
-
Drive the `state` prop from your run status; the matrix morphs between patterns instead of swapping components.
|
|
71
|
-
|
|
72
|
-
<PreviewCode file="components/docs/samples/dot-matrix" name="DotMatrixLifecycleSample">
|
|
73
|
-
<DotMatrixLifecycleSample />
|
|
74
|
-
</PreviewCode>
|
|
75
|
-
|
|
76
|
-
### Inline With Text
|
|
77
|
-
|
|
78
|
-
At the default `size-4` the matrix aligns with text like an icon, and the dots adapt to inverted surfaces through `currentColor`.
|
|
79
|
-
|
|
80
|
-
<PreviewCode file="components/docs/samples/dot-matrix" name="DotMatrixInlineSample">
|
|
81
|
-
<DotMatrixInlineSample />
|
|
82
|
-
</PreviewCode>
|
|
83
|
-
|
|
84
|
-
### Sizes
|
|
85
|
-
|
|
86
|
-
The matrix is an SVG, so any size utility scales it crisply.
|
|
87
|
-
|
|
88
|
-
<DotMatrixSizesSample />
|
|
89
|
-
|
|
90
|
-
## How It Works
|
|
91
|
-
|
|
92
|
-
The grid is a 5x5 SVG of `currentColor` circles. Blinking is a single CSS keyframe animation whose high/low opacity bounds come from registered per-dot CSS variables; the animation runs in every state (static states collapse the bounds) and the bounds carry a transition, which is what makes state changes cross-fade per dot. The randomized loading rhythm uses deterministic per-dot delays and durations, so server and client render identical markup and no JavaScript runs after render. With `prefers-reduced-motion`, the dots hold their resting opacity instead of blinking.
|
|
93
|
-
|
|
94
|
-
The root is a `role="status"` live region whose text content is the state name (or the `label` prop), so screen readers announce state changes; the SVG itself is `aria-hidden`.
|
|
95
|
-
|
|
96
|
-
## API Reference
|
|
97
|
-
|
|
98
|
-
### DotMatrix
|
|
99
|
-
|
|
100
|
-
<ParametersTable
|
|
101
|
-
type="DotMatrixProps"
|
|
102
|
-
parameters={[
|
|
103
|
-
{
|
|
104
|
-
name: "state",
|
|
105
|
-
type: "DotMatrixState",
|
|
106
|
-
default: '"loading"',
|
|
107
|
-
description:
|
|
108
|
-
"One of the 20 built-in states listed above, controlling pattern, motion, and color.",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "label",
|
|
112
|
-
type: "string",
|
|
113
|
-
description:
|
|
114
|
-
"Accessible label announced by screen readers. Defaults to the state name.",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "className",
|
|
118
|
-
type: "string",
|
|
119
|
-
description:
|
|
120
|
-
"Additional CSS classes. Use size utilities to scale and text color utilities to recolor.",
|
|
121
|
-
},
|
|
122
|
-
]}
|
|
123
|
-
/>
|
|
124
|
-
|
|
125
|
-
### Styling
|
|
126
|
-
|
|
127
|
-
Color follows `currentColor`, so `className="text-blue-500"` recolors the whole matrix; the outcome states (`success`, `error`, `warning`, `info`, `recording`, and the muted static states) set their own color which a `className` can override. Dots are targetable via `[data-slot="dot-matrix"]` and `[data-slot="dot-matrix-dot"]`, and the current state is exposed as `data-state` on the root.
|
|
128
|
-
|
|
129
|
-
## Related Components
|
|
130
|
-
|
|
131
|
-
- [Number Roll](/docs/ui/number-roll) - Animated rolling number
|
|
132
|
-
- [Badge](/docs/ui/badge) - Small status and metadata labels
|
|
133
|
-
- [Voice](/docs/ui/voice) - Voice activity visualization
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Number Roll
|
|
3
|
-
description: Animated number that rolls digits odometer-style when the value changes.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
8
|
-
import {
|
|
9
|
-
NumberRollSample,
|
|
10
|
-
NumberRollCompactSample,
|
|
11
|
-
NumberRollFormatSample,
|
|
12
|
-
NumberRollLiveSample,
|
|
13
|
-
} from "@/components/docs/samples/number-roll";
|
|
14
|
-
|
|
15
|
-
<Callout>
|
|
16
|
-
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
17
|
-
</Callout>
|
|
18
|
-
|
|
19
|
-
<NumberRollSample />
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
<InstallCommand shadcn={["number-roll"]} />
|
|
24
|
-
|
|
25
|
-
This adds a `/components/assistant-ui/number-roll.tsx` file to your project, which you can adjust as needed. The component has no dependencies beyond React.
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { NumberRoll } from "@/components/assistant-ui/number-roll";
|
|
31
|
-
|
|
32
|
-
export function TokenCounter({ count }: { count: number }) {
|
|
33
|
-
return <NumberRoll value={count} format={{ notation: "compact" }} />;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
When `value` changes, each digit rolls in place to its new value. Formatting is handled by `Intl.NumberFormat`, so structural changes animate too: when `700` becomes `1.1K` with compact notation, the surviving ones digit rolls from 0 to 1 while the leading `70` slides out and the decimal point, fraction digit, and `K` suffix slide in.
|
|
38
|
-
|
|
39
|
-
## Examples
|
|
40
|
-
|
|
41
|
-
### Compact Notation
|
|
42
|
-
|
|
43
|
-
Pass any `Intl.NumberFormatOptions` via the `format` prop. Crossing a compact-notation threshold animates the formatting change instead of remounting the whole string.
|
|
44
|
-
|
|
45
|
-
<PreviewCode file="components/docs/samples/number-roll" name="NumberRollCompactSample">
|
|
46
|
-
<NumberRollCompactSample />
|
|
47
|
-
</PreviewCode>
|
|
48
|
-
|
|
49
|
-
### Formats and Locales
|
|
50
|
-
|
|
51
|
-
Currencies, percentages, suffixes, and non-English locales all work through the same `Intl.NumberFormat` pipeline. Compact thresholds and suffixes are locale-dependent (`1.2万` in `zh-CN`), so never hardcode them.
|
|
52
|
-
|
|
53
|
-
<PreviewCode file="components/docs/samples/number-roll" name="NumberRollFormatSample">
|
|
54
|
-
<NumberRollFormatSample />
|
|
55
|
-
</PreviewCode>
|
|
56
|
-
|
|
57
|
-
### Live Counter
|
|
58
|
-
|
|
59
|
-
Rapid successive updates retarget the in-flight roll smoothly, which makes the component suitable for streaming token counts and other live metrics.
|
|
60
|
-
|
|
61
|
-
<PreviewCode file="components/docs/samples/number-roll" name="NumberRollLiveSample">
|
|
62
|
-
<NumberRollLiveSample />
|
|
63
|
-
</PreviewCode>
|
|
64
|
-
|
|
65
|
-
## How It Works
|
|
66
|
-
|
|
67
|
-
The value is formatted with `Intl.NumberFormat.formatToParts` and split into keyed parts. Integer digits are keyed by place value counted from the right, so when `999` becomes `1,000` the existing columns keep their identity and roll in place while only the new leading digit and separator enter. Symbols (decimal point, group separators, currency signs, compact suffixes) cross-fade and collapse via animated `grid-template-columns`.
|
|
68
|
-
|
|
69
|
-
Each digit renders a strip of 0 to 9 and animates a registered CSS custom property; CSS `mod()` math wraps the strip into an endless ribbon, so rolling from 9 to 0 continues in the trend direction instead of spinning backwards. There is no JavaScript animation loop and no animation library dependency.
|
|
70
|
-
|
|
71
|
-
In browsers without CSS `mod()` support, and during server rendering, the component renders the plain formatted string. With `prefers-reduced-motion`, values swap instantly without rolling. When server rendering, pass an explicit `locales`: the server's default locale can differ from the visitor's browser locale, and a mismatched formatted string causes a React hydration error. Locales whose default numbering system is non-Latin (such as `ar-EG`) cross-fade their digits as symbols instead of rolling.
|
|
72
|
-
|
|
73
|
-
The formatted value is exposed to screen readers as plain text while the animated digits are `aria-hidden`. Value changes are not announced automatically; wrap the component in an `aria-live` region if you need announcements.
|
|
74
|
-
|
|
75
|
-
## API Reference
|
|
76
|
-
|
|
77
|
-
### NumberRoll
|
|
78
|
-
|
|
79
|
-
<ParametersTable
|
|
80
|
-
type="NumberRollProps"
|
|
81
|
-
parameters={[
|
|
82
|
-
{
|
|
83
|
-
name: "value",
|
|
84
|
-
type: "number",
|
|
85
|
-
required: true,
|
|
86
|
-
description: "The number to display.",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "format",
|
|
90
|
-
type: "Intl.NumberFormatOptions",
|
|
91
|
-
description:
|
|
92
|
-
"Number formatting options, e.g. `{ notation: \"compact\" }` or `{ style: \"currency\", currency: \"USD\" }`.",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "locales",
|
|
96
|
-
type: "Intl.LocalesArgument",
|
|
97
|
-
description:
|
|
98
|
-
"Locale(s) passed to `Intl.NumberFormat`. Pass an explicit value in server-rendered apps so the server and client format identically.",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "prefix",
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "Static text rendered before the number.",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: "suffix",
|
|
107
|
-
type: "string",
|
|
108
|
-
description: "Static text rendered after the number.",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "trend",
|
|
112
|
-
type: '"auto" | "up" | "down"',
|
|
113
|
-
default: '"auto"',
|
|
114
|
-
description:
|
|
115
|
-
"Roll direction. `auto` follows the sign of the value change; `up` and `down` force a direction, wrapping digits through 9/0 as needed.",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "duration",
|
|
119
|
-
type: "number",
|
|
120
|
-
default: "500",
|
|
121
|
-
description:
|
|
122
|
-
"Digit roll duration in milliseconds. Enter/exit fades run at 60% of this value.",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "className",
|
|
126
|
-
type: "string",
|
|
127
|
-
description: "Additional CSS classes.",
|
|
128
|
-
},
|
|
129
|
-
]}
|
|
130
|
-
/>
|
|
131
|
-
|
|
132
|
-
### Styling
|
|
133
|
-
|
|
134
|
-
The root applies `tabular-nums` so digits keep a constant width while rolling; the font you use must provide tabular figures for the layout to stay stable. Size and color are inherited from the surrounding text, so style it like any span:
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
<NumberRoll value={value} className="text-4xl font-semibold" />
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Change the animation speed via the `duration` prop; it drives both the CSS timing and the cleanup that unmounts exited characters, so overriding the duration variable in CSS alone would remove them mid-fade. The fade and easing variables are safe to override via the `style` prop (the defaults are set as inline styles, so plain `className` overrides do not apply):
|
|
141
|
-
|
|
142
|
-
| Variable | Default | Description |
|
|
143
|
-
|----------|---------|-------------|
|
|
144
|
-
| `--aui-number-roll-duration` | `500ms` (from the `duration` prop) | Digit roll duration. |
|
|
145
|
-
| `--aui-number-roll-fade` | 60% of the duration | Enter/exit fade and width-collapse duration. |
|
|
146
|
-
| `--aui-number-roll-ease` | `cubic-bezier(0.23, 1, 0.32, 1)` | Digit roll easing. |
|
|
147
|
-
|
|
148
|
-
Parts are targetable via data attributes: `[data-slot="number-roll"]`, `[data-slot="number-roll-part"]`, `[data-slot="number-roll-digit"]`, and `[data-slot="number-roll-symbol"]`.
|
|
149
|
-
|
|
150
|
-
## Related Components
|
|
151
|
-
|
|
152
|
-
- [Context Display](/docs/ui/context-display) - Live token usage ring and bar
|
|
153
|
-
- [Message Timing](/docs/ui/message-timing) - Streaming stats badge
|
|
154
|
-
- [Badge](/docs/ui/badge) - Small status and metadata labels
|