@karimsa/mdxserve 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +233 -2
- package/client/App.tsx +7 -0
- package/client/CodeBlock.tsx +395 -0
- package/client/CrossFade.tsx +72 -0
- package/client/DocContext.ts +14 -0
- package/client/DocView.tsx +107 -0
- package/client/ErrorBox.tsx +23 -0
- package/client/Heading.tsx +31 -0
- package/client/HomeEmptyState.tsx +101 -0
- package/client/HomeView.tsx +78 -0
- package/client/ListingView.tsx +663 -0
- package/client/MdSection.tsx +234 -0
- package/client/MdSectionEditor.tsx +233 -0
- package/client/Mermaid.tsx +435 -0
- package/client/RenderErrorBoundary.tsx +40 -0
- package/client/Table.tsx +14 -0
- package/client/TaskCheckbox.tsx +38 -0
- package/client/api.ts +138 -0
- package/client/app.css +372 -0
- package/client/builtins/Badge.tsx +109 -0
- package/client/builtins/Button.tsx +111 -0
- package/client/builtins/Callout.tsx +97 -0
- package/client/builtins/Card.tsx +111 -0
- package/client/builtins/Chart.tsx +875 -0
- package/client/builtins/Diff.tsx +722 -0
- package/client/builtins/Dropdown.tsx +417 -0
- package/client/builtins/FileTree.tsx +87 -0
- package/client/builtins/Kbd.tsx +18 -0
- package/client/builtins/Screenshot.tsx +209 -0
- package/client/builtins/Sparkline.tsx +63 -0
- package/client/builtins/Tabs.tsx +169 -0
- package/client/builtins/Tooltip.tsx +52 -0
- package/client/builtins/chart-data.ts +133 -0
- package/client/builtins/index.ts +167 -0
- package/client/design/base/editor.css +151 -0
- package/client/design/base/prose.css +143 -0
- package/client/design/base/reset.css +79 -0
- package/client/design/tokens/colors.css +188 -0
- package/client/design/tokens/elevation.css +42 -0
- package/client/design/tokens/fonts.css +6 -0
- package/client/design/tokens/motion.css +76 -0
- package/client/design/tokens/spacing.css +34 -0
- package/client/design/tokens/typography.css +56 -0
- package/client/doc-module-cache.ts +17 -0
- package/client/editor-link.ts +27 -0
- package/client/entry.tsx +51 -0
- package/client/export-doc.ts +80 -0
- package/client/export-save.ts +96 -0
- package/client/favicon.svg +1 -0
- package/client/file-system-access.d.ts +29 -0
- package/client/format.ts +17 -0
- package/client/hooks.ts +34 -0
- package/client/lucide-icons.d.ts +9 -0
- package/client/mdx-components-base.ts +32 -0
- package/client/mdx-components.ts +18 -0
- package/client/mermaid-chart.ts +109 -0
- package/client/mermaid-direction.ts +73 -0
- package/client/motion.ts +104 -0
- package/client/platform.ts +16 -0
- package/client/route-path.ts +15 -0
- package/client/router.ts +452 -0
- package/client/shell/AppShell.tsx +401 -0
- package/client/shell/Footer.tsx +33 -0
- package/client/shell/NotFoundView.tsx +22 -0
- package/client/shell/Sidebar.tsx +169 -0
- package/client/shell/StandaloneShell.tsx +65 -0
- package/client/shell/TocRail.tsx +53 -0
- package/client/shell/TopBar.tsx +117 -0
- package/client/shell/use-doc-width.ts +61 -0
- package/client/shell/useToc.ts +77 -0
- package/client/ssr-entry.tsx +22 -0
- package/client/standalone-entry.tsx +51 -0
- package/client/state.ts +90 -0
- package/client/theme.ts +65 -0
- package/client/ui/Breadcrumb.tsx +49 -0
- package/client/ui/ConfirmDeleteDialog.tsx +113 -0
- package/client/ui/ExpandModal.tsx +342 -0
- package/client/ui/Icon.tsx +114 -0
- package/client/ui/IconButton.tsx +63 -0
- package/client/ui/Kbd.tsx +17 -0
- package/client/ui/PageNav.tsx +77 -0
- package/client/ui/ResizeHandle.tsx +201 -0
- package/client/ui/SearchDialog.tsx +187 -0
- package/client/ui/Tag.tsx +44 -0
- package/client/ui/Toast.tsx +189 -0
- package/client/ui/TocList.tsx +71 -0
- package/client/ui/icon-set.ts +102 -0
- package/client/ui/toast-count.ts +28 -0
- package/dist/cli.js +5091 -0
- package/dist/registry.json +703 -0
- package/dist/render-worker.js +145 -0
- package/package.json +113 -5
- package/skills/mdxserve/SKILL.md +178 -0
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Callout",
|
|
6
|
+
"description": "A boxed aside with an icon, used to draw attention to a note or warning inline with the text.",
|
|
7
|
+
"whenToUse": "Use to highlight a tip, note, or warning that should stand out from surrounding prose. Prefer `tone=\"warn\"` for caveats or risks, `tone=\"danger\"` for breaking changes, `tone=\"tip\"` or `tone=\"ok\"` for positive asides, and the default `tone=\"note\"` for general notes; add `title` when the callout needs a short heading. (`type` is a deprecated alias for `tone`.)",
|
|
8
|
+
"props": {
|
|
9
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"tone": {
|
|
13
|
+
"default": "note",
|
|
14
|
+
"description": "Visual intent and icon: note (info), tip (lightbulb), ok (success), warn (caution), or danger (breaking).",
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": [
|
|
17
|
+
"note",
|
|
18
|
+
"tip",
|
|
19
|
+
"ok",
|
|
20
|
+
"warn",
|
|
21
|
+
"danger"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"type": {
|
|
25
|
+
"description": "Deprecated alias for `tone` (info→note, warn→warn). Prefer `tone`.",
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": [
|
|
28
|
+
"info",
|
|
29
|
+
"warn"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"title": {
|
|
33
|
+
"description": "Optional bold heading shown above the body; defaults to the tone's label.",
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"children": "Callout body; any MDX/Markdown content."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "Button",
|
|
42
|
+
"description": "A clickable button or link with primary/secondary/ghost/danger styles and a small tap animation.",
|
|
43
|
+
"whenToUse": "Use for a call to action inside MDX/JSX content — a link styled as a button (`href`) or an interactive action (`onClick`, JSX only). Prefer `variant=\"primary\"` for the main action on a page, `secondary` or `ghost` for less prominent actions, and `danger` for destructive ones. `icon`/`iconRight` take a lucide icon name.",
|
|
44
|
+
"props": {
|
|
45
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"variant": {
|
|
49
|
+
"default": "primary",
|
|
50
|
+
"description": "Visual style: primary (filled teal), secondary (outlined), ghost (text-only), or danger (outlined, danger tone).",
|
|
51
|
+
"type": "string",
|
|
52
|
+
"enum": [
|
|
53
|
+
"primary",
|
|
54
|
+
"secondary",
|
|
55
|
+
"ghost",
|
|
56
|
+
"danger"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"size": {
|
|
60
|
+
"default": "md",
|
|
61
|
+
"description": "Height/padding/text size.",
|
|
62
|
+
"type": "string",
|
|
63
|
+
"enum": [
|
|
64
|
+
"sm",
|
|
65
|
+
"md",
|
|
66
|
+
"lg"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"icon": {
|
|
70
|
+
"description": "Lucide icon name rendered before the label.",
|
|
71
|
+
"type": "string"
|
|
72
|
+
},
|
|
73
|
+
"iconRight": {
|
|
74
|
+
"description": "Lucide icon name rendered after the label.",
|
|
75
|
+
"type": "string"
|
|
76
|
+
},
|
|
77
|
+
"href": {
|
|
78
|
+
"description": "If set, renders as a link (`<a>`) instead of a `<button>`.",
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"onClick": {
|
|
82
|
+
"description": "Click handler (MDX/JSX only)."
|
|
83
|
+
},
|
|
84
|
+
"disabled": {
|
|
85
|
+
"default": false,
|
|
86
|
+
"description": "Disables the button and dims it.",
|
|
87
|
+
"type": "boolean"
|
|
88
|
+
},
|
|
89
|
+
"autoFocus": {
|
|
90
|
+
"description": "Focus the button on mount.",
|
|
91
|
+
"type": "boolean"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"children": "Button label/content."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "Tooltip",
|
|
99
|
+
"description": "Wraps inline content in a hover/focus tooltip (via tippy.js) that shows a short bit of text.",
|
|
100
|
+
"whenToUse": "Use to add a short explanation to a word, phrase, or another inline component (e.g. a `Badge`) without cluttering the surrounding prose. Keep `content` brief — it's not meant for long-form text.",
|
|
101
|
+
"props": {
|
|
102
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
103
|
+
"type": "object",
|
|
104
|
+
"properties": {
|
|
105
|
+
"content": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"description": "Tooltip text shown on hover/focus."
|
|
108
|
+
},
|
|
109
|
+
"placement": {
|
|
110
|
+
"default": "top",
|
|
111
|
+
"description": "Preferred side of the target.",
|
|
112
|
+
"type": "string",
|
|
113
|
+
"enum": [
|
|
114
|
+
"top",
|
|
115
|
+
"bottom",
|
|
116
|
+
"left",
|
|
117
|
+
"right"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"delay": {
|
|
121
|
+
"default": 100,
|
|
122
|
+
"description": "Delay in milliseconds before the tooltip appears.",
|
|
123
|
+
"type": "number"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"required": [
|
|
127
|
+
"content"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"children": "The element the tooltip is attached to."
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "Tabs",
|
|
134
|
+
"description": "A tabbed container that switches between panels of content, each declared with a `Tab` child.",
|
|
135
|
+
"whenToUse": "Use to present a few alternative or sequential views of content (e.g. per-language code samples, per-OS instructions) without showing them all at once. Each direct child should be a `Tab` with a `label`; the panel content cross-fades and the underline animates between tabs.",
|
|
136
|
+
"props": {
|
|
137
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
138
|
+
"type": "object",
|
|
139
|
+
"properties": {
|
|
140
|
+
"defaultValue": {
|
|
141
|
+
"description": "Value of the tab selected initially; defaults to the first tab.",
|
|
142
|
+
"type": "string"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"children": "One or more `<Tab>` elements."
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "Tab",
|
|
150
|
+
"description": "A single labeled panel within a `Tabs` container.",
|
|
151
|
+
"whenToUse": "Only as a direct child of `<Tabs>`. `label` is required; `value` defaults to a slug of `label`.",
|
|
152
|
+
"props": {
|
|
153
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
154
|
+
"type": "object",
|
|
155
|
+
"properties": {
|
|
156
|
+
"label": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"description": "Tab label shown in the tab list."
|
|
159
|
+
},
|
|
160
|
+
"value": {
|
|
161
|
+
"description": "Stable identifier for this tab; defaults to a slug of `label`.",
|
|
162
|
+
"type": "string"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"required": [
|
|
166
|
+
"label"
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
"children": "Tab panel content; any MDX/Markdown content."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "Badge",
|
|
173
|
+
"description": "A small inline pill for a status, tag, or label, with tone/variant/dot options.",
|
|
174
|
+
"whenToUse": "Use inline with text (or inside a table cell) to call out a short status or category, e.g. a version, state, or tag. Prefer `variant=\"soft\"` (the default) for most uses; `solid` for emphasis, `outline` for a quieter look; set `dot` for a status indicator. Tones: `neutral`, `teal`, `info`, `ok`, `warn`, `danger`, `note`. (`color` is a deprecated alias for `tone`.)",
|
|
175
|
+
"props": {
|
|
176
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
177
|
+
"type": "object",
|
|
178
|
+
"properties": {
|
|
179
|
+
"tone": {
|
|
180
|
+
"default": "neutral",
|
|
181
|
+
"description": "Tone of the badge.",
|
|
182
|
+
"type": "string",
|
|
183
|
+
"enum": [
|
|
184
|
+
"neutral",
|
|
185
|
+
"teal",
|
|
186
|
+
"info",
|
|
187
|
+
"ok",
|
|
188
|
+
"warn",
|
|
189
|
+
"danger",
|
|
190
|
+
"note"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"color": {
|
|
194
|
+
"description": "Deprecated alias for `tone` (gray→neutral, sky→info, green→ok, amber→warn, red→danger, violet→note). Prefer `tone`.",
|
|
195
|
+
"type": "string",
|
|
196
|
+
"enum": [
|
|
197
|
+
"gray",
|
|
198
|
+
"sky",
|
|
199
|
+
"green",
|
|
200
|
+
"amber",
|
|
201
|
+
"red",
|
|
202
|
+
"violet"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"variant": {
|
|
206
|
+
"default": "soft",
|
|
207
|
+
"description": "Fill style.",
|
|
208
|
+
"type": "string",
|
|
209
|
+
"enum": [
|
|
210
|
+
"soft",
|
|
211
|
+
"solid",
|
|
212
|
+
"outline"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"dot": {
|
|
216
|
+
"default": false,
|
|
217
|
+
"description": "Show a leading status dot.",
|
|
218
|
+
"type": "boolean"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"children": "Badge label."
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "Diff",
|
|
226
|
+
"description": "Renders the difference between two code snippets with GitHub-style unified or side-by-side views.",
|
|
227
|
+
"whenToUse": "Use for before/after API changes, config migrations, or 'change this to that' instructions. Prefer a plain fence when only showing the final code.",
|
|
228
|
+
"props": {
|
|
229
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
230
|
+
"type": "object",
|
|
231
|
+
"properties": {
|
|
232
|
+
"before": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"description": "Original text."
|
|
235
|
+
},
|
|
236
|
+
"after": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"description": "New text."
|
|
239
|
+
},
|
|
240
|
+
"language": {
|
|
241
|
+
"description": "Label only, shown in the header when `title` isn't set. Shown as a label; the diff is colored by change, not by syntax — Shiki runs at build time for fenced code blocks, not for runtime strings passed to this component.",
|
|
242
|
+
"type": "string"
|
|
243
|
+
},
|
|
244
|
+
"title": {
|
|
245
|
+
"description": "Filename or heading shown in the header; takes precedence over `language`.",
|
|
246
|
+
"type": "string"
|
|
247
|
+
},
|
|
248
|
+
"view": {
|
|
249
|
+
"default": "unified",
|
|
250
|
+
"description": "Initial view.",
|
|
251
|
+
"type": "string",
|
|
252
|
+
"enum": [
|
|
253
|
+
"unified",
|
|
254
|
+
"split"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
"context": {
|
|
258
|
+
"default": 3,
|
|
259
|
+
"description": "Unchanged lines kept around each change; longer unchanged runs collapse into an expandable separator.",
|
|
260
|
+
"type": "integer",
|
|
261
|
+
"minimum": 0,
|
|
262
|
+
"maximum": 9007199254740991
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"required": [
|
|
266
|
+
"before",
|
|
267
|
+
"after"
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"name": "Card",
|
|
273
|
+
"description": "A bordered content card with an optional icon, title, description, and meta line.",
|
|
274
|
+
"whenToUse": "Use for a link or highlighted block that needs more visual weight than a plain link — a related page, an external resource, a next step. Set `href` (or `interactive`) to enable the hover lift and trailing arrow. Group several inside `CardGrid` for a responsive layout.",
|
|
275
|
+
"props": {
|
|
276
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
277
|
+
"type": "object",
|
|
278
|
+
"properties": {
|
|
279
|
+
"title": {
|
|
280
|
+
"description": "Card heading.",
|
|
281
|
+
"type": "string"
|
|
282
|
+
},
|
|
283
|
+
"description": {
|
|
284
|
+
"description": "One-sentence body text below the title.",
|
|
285
|
+
"type": "string"
|
|
286
|
+
},
|
|
287
|
+
"icon": {
|
|
288
|
+
"description": "Lucide icon name shown above the title.",
|
|
289
|
+
"type": "string"
|
|
290
|
+
},
|
|
291
|
+
"meta": {
|
|
292
|
+
"description": "Small uppercase mono line at the bottom, e.g. \"3 pages\".",
|
|
293
|
+
"type": "string"
|
|
294
|
+
},
|
|
295
|
+
"href": {
|
|
296
|
+
"description": "Renders the card as a link and enables the hover lift.",
|
|
297
|
+
"type": "string"
|
|
298
|
+
},
|
|
299
|
+
"interactive": {
|
|
300
|
+
"default": false,
|
|
301
|
+
"description": "Enables the hover lift without a link.",
|
|
302
|
+
"type": "boolean"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"children": "Extra content rendered below the description/meta."
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "CardGrid",
|
|
310
|
+
"description": "A responsive 2- or 3-column grid for laying out `Card` elements.",
|
|
311
|
+
"whenToUse": "Wrap 2 or more `Card` elements to lay them out side by side; set `columns=\"3\"` for a wider grid.",
|
|
312
|
+
"props": {
|
|
313
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
314
|
+
"type": "object",
|
|
315
|
+
"properties": {
|
|
316
|
+
"columns": {
|
|
317
|
+
"default": "2",
|
|
318
|
+
"description": "Maximum columns at the widest breakpoint; fewer on narrower screens.",
|
|
319
|
+
"type": "string",
|
|
320
|
+
"enum": [
|
|
321
|
+
"2",
|
|
322
|
+
"3"
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"children": "One or more `<Card>` elements."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "Kbd",
|
|
331
|
+
"description": "A small styled key cap for keyboard shortcuts.",
|
|
332
|
+
"whenToUse": "Use inline for a literal keystroke, e.g. `<Kbd>⌘</Kbd><Kbd>K</Kbd>`. Not for regular inline code — use a backtick fence for that.",
|
|
333
|
+
"props": {
|
|
334
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
335
|
+
"type": "object",
|
|
336
|
+
"properties": {}
|
|
337
|
+
},
|
|
338
|
+
"children": "Key label, e.g. a letter, `esc`, or a unicode symbol such as `⌘`."
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"name": "FileTree",
|
|
342
|
+
"description": "A collapsible file/folder tree, for showing a project layout.",
|
|
343
|
+
"whenToUse": "Use to show the shape of a directory a reader needs to navigate, e.g. 'here's what the generated project looks like'. Pass `nodes` as a plain JSON array of `{ name, path?, children?, open? }`; set `activePath` to highlight one row.",
|
|
344
|
+
"props": {
|
|
345
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
346
|
+
"type": "object",
|
|
347
|
+
"properties": {
|
|
348
|
+
"nodes": {
|
|
349
|
+
"default": [],
|
|
350
|
+
"description": "Tree of files/folders to render.",
|
|
351
|
+
"type": "array",
|
|
352
|
+
"items": {
|
|
353
|
+
"$ref": "#/$defs/__schema0"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"activePath": {
|
|
357
|
+
"description": "`path` of the row to highlight as active.",
|
|
358
|
+
"type": "string"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"$defs": {
|
|
362
|
+
"__schema0": {
|
|
363
|
+
"type": "object",
|
|
364
|
+
"properties": {
|
|
365
|
+
"name": {
|
|
366
|
+
"type": "string",
|
|
367
|
+
"description": "File or folder name shown in the row."
|
|
368
|
+
},
|
|
369
|
+
"path": {
|
|
370
|
+
"description": "Route/identifier used to match `activePath`.",
|
|
371
|
+
"type": "string"
|
|
372
|
+
},
|
|
373
|
+
"children": {
|
|
374
|
+
"description": "Child nodes; presence makes this row a folder.",
|
|
375
|
+
"type": "array",
|
|
376
|
+
"items": {
|
|
377
|
+
"$ref": "#/$defs/__schema0"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
"open": {
|
|
381
|
+
"description": "Folder starts expanded unless this is `false`.",
|
|
382
|
+
"type": "boolean"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"required": [
|
|
386
|
+
"name"
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "Chart",
|
|
394
|
+
"description": "A bar, line, area or histogram chart rendered as inline SVG, framed like a code block.",
|
|
395
|
+
"whenToUse": "For bar, line and area: `data` is `[{ label, <series>: number }, ...]`; `series` lists which keys to plot (defaults to `[\"value\"]`), for small, self-contained datasets (four series or fewer) that are clearer as a shape than a table. Set `orientation=\"horizontal\"` on a bar chart when labels are long or there are more than ~6 categories. For a histogram, set `type=\"histogram\"` and pass raw numbers as `values`; leave `data`/`series` off and optionally cap the bin count with `bins`. Prefer a table once there's more data than a chart can read at a glance.",
|
|
396
|
+
"props": {
|
|
397
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
398
|
+
"type": "object",
|
|
399
|
+
"properties": {
|
|
400
|
+
"type": {
|
|
401
|
+
"default": "bar",
|
|
402
|
+
"description": "Chart shape. `histogram` bins `values` on the client and ignores `data`/`series`.",
|
|
403
|
+
"type": "string",
|
|
404
|
+
"enum": [
|
|
405
|
+
"bar",
|
|
406
|
+
"line",
|
|
407
|
+
"area",
|
|
408
|
+
"histogram"
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
"orientation": {
|
|
412
|
+
"default": "vertical",
|
|
413
|
+
"description": "Bar layout direction; ignored for `line`/`area`/`histogram`. Readers can flip it from the chart header for their own view only.",
|
|
414
|
+
"type": "string",
|
|
415
|
+
"enum": [
|
|
416
|
+
"vertical",
|
|
417
|
+
"horizontal"
|
|
418
|
+
]
|
|
419
|
+
},
|
|
420
|
+
"data": {
|
|
421
|
+
"default": [],
|
|
422
|
+
"description": "One object per x position: `{ label, <series>: number }`.",
|
|
423
|
+
"type": "array",
|
|
424
|
+
"items": {
|
|
425
|
+
"allOf": [
|
|
426
|
+
{
|
|
427
|
+
"type": "object",
|
|
428
|
+
"propertyNames": {
|
|
429
|
+
"type": "string"
|
|
430
|
+
},
|
|
431
|
+
"additionalProperties": {
|
|
432
|
+
"anyOf": [
|
|
433
|
+
{
|
|
434
|
+
"type": "string"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"type": "number"
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"type": "object",
|
|
444
|
+
"properties": {
|
|
445
|
+
"label": {
|
|
446
|
+
"type": "string"
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
"required": [
|
|
450
|
+
"label"
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"series": {
|
|
457
|
+
"description": "Keys of `data` entries to plot. Defaults to `[\"value\"]`.",
|
|
458
|
+
"type": "array",
|
|
459
|
+
"items": {
|
|
460
|
+
"type": "string"
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
"values": {
|
|
464
|
+
"default": [],
|
|
465
|
+
"description": "Raw numbers to bin for `type=\"histogram\"`; ignored otherwise.",
|
|
466
|
+
"type": "array",
|
|
467
|
+
"items": {
|
|
468
|
+
"type": "number"
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"bins": {
|
|
472
|
+
"description": "Histogram bin count. Defaults to a Sturges estimate, capped at 20.",
|
|
473
|
+
"type": "integer",
|
|
474
|
+
"exclusiveMinimum": 0,
|
|
475
|
+
"maximum": 9007199254740991
|
|
476
|
+
},
|
|
477
|
+
"height": {
|
|
478
|
+
"default": 220,
|
|
479
|
+
"description": "SVG height in px.",
|
|
480
|
+
"type": "number"
|
|
481
|
+
},
|
|
482
|
+
"filename": {
|
|
483
|
+
"description": "Header label; defaults to the chart type.",
|
|
484
|
+
"type": "string"
|
|
485
|
+
},
|
|
486
|
+
"caption": {
|
|
487
|
+
"description": "Caption shown below the chart on a hairline rule.",
|
|
488
|
+
"type": "string"
|
|
489
|
+
},
|
|
490
|
+
"xLabel": {
|
|
491
|
+
"description": "Caption for the horizontal axis, rendered as uppercase mono — the categories on a vertical bar, line or area chart; the values on a horizontal bar chart or a histogram.",
|
|
492
|
+
"type": "string"
|
|
493
|
+
},
|
|
494
|
+
"yLabel": {
|
|
495
|
+
"description": "Caption for the vertical axis, rendered as uppercase mono — the values on a vertical bar, line or area chart; the categories on a horizontal bar chart; the count on a histogram.",
|
|
496
|
+
"type": "string"
|
|
497
|
+
},
|
|
498
|
+
"unit": {
|
|
499
|
+
"description": "Suffix appended to axis tick and tooltip values, e.g. \"ms\" or \"%\". On a histogram it labels the value axis (x); y is a count.",
|
|
500
|
+
"type": "string"
|
|
501
|
+
},
|
|
502
|
+
"legend": {
|
|
503
|
+
"default": true,
|
|
504
|
+
"description": "Show the series legend in the header when there's more than one series.",
|
|
505
|
+
"type": "boolean"
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"name": "Sparkline",
|
|
512
|
+
"description": "A tiny inline trend line with no axes or labels.",
|
|
513
|
+
"whenToUse": "Use inline (e.g. in a sentence or table cell) to show the shape of a trend without a full chart — 'requests over the last hour ' next to a Sparkline. Needs at least two `values`.",
|
|
514
|
+
"props": {
|
|
515
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
516
|
+
"type": "object",
|
|
517
|
+
"properties": {
|
|
518
|
+
"values": {
|
|
519
|
+
"type": "array",
|
|
520
|
+
"items": {
|
|
521
|
+
"type": "number"
|
|
522
|
+
},
|
|
523
|
+
"description": "Series to plot; at least two numbers."
|
|
524
|
+
},
|
|
525
|
+
"width": {
|
|
526
|
+
"default": 84,
|
|
527
|
+
"description": "SVG width in px.",
|
|
528
|
+
"type": "number"
|
|
529
|
+
},
|
|
530
|
+
"height": {
|
|
531
|
+
"default": 20,
|
|
532
|
+
"description": "SVG height in px.",
|
|
533
|
+
"type": "number"
|
|
534
|
+
},
|
|
535
|
+
"color": {
|
|
536
|
+
"default": "var(--chart-1)",
|
|
537
|
+
"description": "Any CSS color, typically a `--chart-1`..`--chart-6` token.",
|
|
538
|
+
"type": "string"
|
|
539
|
+
},
|
|
540
|
+
"fill": {
|
|
541
|
+
"default": true,
|
|
542
|
+
"description": "Tinted area under the line.",
|
|
543
|
+
"type": "boolean"
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
"required": [
|
|
547
|
+
"values"
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"name": "Dropdown",
|
|
553
|
+
"description": "A menu-style picker: a button that opens a popover list of options — a plain form control, or a content switcher when given `Option` children.",
|
|
554
|
+
"whenToUse": "Pass `options` (strings or `{ value, label }`) for a form-style select, e.g. a settings picker. Pass `Option` children instead — each with a `label` and its own content — to switch between longer or more numerous panels of content; prefer `Tabs` when there are only 2-4 visible alternatives, and `Dropdown` once the list gets longer than fits comfortably as tabs.",
|
|
555
|
+
"props": {
|
|
556
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
557
|
+
"type": "object",
|
|
558
|
+
"properties": {
|
|
559
|
+
"label": {
|
|
560
|
+
"description": "Label shown above the control.",
|
|
561
|
+
"type": "string"
|
|
562
|
+
},
|
|
563
|
+
"icon": {
|
|
564
|
+
"description": "Lucide icon name; renders an icon-only trigger instead of the labelled control. `label` becomes the accessible name.",
|
|
565
|
+
"type": "string"
|
|
566
|
+
},
|
|
567
|
+
"options": {
|
|
568
|
+
"description": "Strings, or { value, label, description? } objects, for a plain picker. Omit this and use `Option` children instead for a content-switching dropdown.",
|
|
569
|
+
"type": "array",
|
|
570
|
+
"items": {
|
|
571
|
+
"anyOf": [
|
|
572
|
+
{
|
|
573
|
+
"type": "string",
|
|
574
|
+
"description": "Option value and label, both the same string."
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"type": "object",
|
|
578
|
+
"properties": {
|
|
579
|
+
"value": {
|
|
580
|
+
"type": "string",
|
|
581
|
+
"description": "Value reported for this option."
|
|
582
|
+
},
|
|
583
|
+
"label": {
|
|
584
|
+
"type": "string",
|
|
585
|
+
"description": "Text shown for this option."
|
|
586
|
+
},
|
|
587
|
+
"description": {
|
|
588
|
+
"description": "One short line shown under the label in the menu.",
|
|
589
|
+
"type": "string"
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
"required": [
|
|
593
|
+
"value",
|
|
594
|
+
"label"
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
"value": {
|
|
601
|
+
"description": "Selected value (controlled) — requires `onChange` to update it.",
|
|
602
|
+
"type": "string"
|
|
603
|
+
},
|
|
604
|
+
"defaultValue": {
|
|
605
|
+
"description": "Initially selected value (uncontrolled). Defaults to the first option.",
|
|
606
|
+
"type": "string"
|
|
607
|
+
},
|
|
608
|
+
"placeholder": {
|
|
609
|
+
"description": "Text shown on the trigger while nothing is selected.",
|
|
610
|
+
"type": "string"
|
|
611
|
+
},
|
|
612
|
+
"size": {
|
|
613
|
+
"default": "md",
|
|
614
|
+
"description": "Control height: sm (28px) or md (34px).",
|
|
615
|
+
"type": "string",
|
|
616
|
+
"enum": [
|
|
617
|
+
"sm",
|
|
618
|
+
"md"
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
"disabled": {
|
|
622
|
+
"default": false,
|
|
623
|
+
"description": "Disables the control.",
|
|
624
|
+
"type": "boolean"
|
|
625
|
+
},
|
|
626
|
+
"onChange": {
|
|
627
|
+
"description": "Called with the new value whenever the selection changes (JSX only)."
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
"children": "One or more `<Option>` elements. When present, `Dropdown` acts as a content switcher: the menu picks which option's content renders below, cross-faded."
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"name": "Option",
|
|
635
|
+
"description": "A single labeled option within a `Dropdown` content switcher.",
|
|
636
|
+
"whenToUse": "Only as a direct child of `<Dropdown>`. `label` is required; `value` defaults to a slug of `label`.",
|
|
637
|
+
"props": {
|
|
638
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
639
|
+
"type": "object",
|
|
640
|
+
"properties": {
|
|
641
|
+
"label": {
|
|
642
|
+
"type": "string",
|
|
643
|
+
"description": "Option label shown in the menu."
|
|
644
|
+
},
|
|
645
|
+
"value": {
|
|
646
|
+
"description": "Stable identifier for this option; defaults to a slug of `label`.",
|
|
647
|
+
"type": "string"
|
|
648
|
+
},
|
|
649
|
+
"description": {
|
|
650
|
+
"description": "One short line shown under the label in the menu.",
|
|
651
|
+
"type": "string"
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
"required": [
|
|
655
|
+
"label"
|
|
656
|
+
]
|
|
657
|
+
},
|
|
658
|
+
"children": "Panel content shown when this option is selected; any MDX/Markdown content."
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
"name": "Screenshot",
|
|
662
|
+
"description": "An image framed as a macOS window — traffic-light buttons, an optional title, a raised border — for app and UI screenshots.",
|
|
663
|
+
"whenToUse": "Use instead of a plain Markdown image when the picture is a screenshot of an app, web page, or terminal, so it reads as a window rather than a bare bitmap. `src` resolves like a Markdown image; add `title` for the window name and `caption` for a note below. The title bar's expand control opens the image full-screen with pan and zoom, so a dense screenshot can stay small inline. Keep plain `` for diagrams, logos, and photos.",
|
|
664
|
+
"props": {
|
|
665
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
666
|
+
"type": "object",
|
|
667
|
+
"properties": {
|
|
668
|
+
"src": {
|
|
669
|
+
"type": "string",
|
|
670
|
+
"description": "Image URL, relative to the document like a Markdown image."
|
|
671
|
+
},
|
|
672
|
+
"alt": {
|
|
673
|
+
"default": "",
|
|
674
|
+
"description": "Accessible description of the image.",
|
|
675
|
+
"type": "string"
|
|
676
|
+
},
|
|
677
|
+
"title": {
|
|
678
|
+
"description": "Window title shown centred in the title bar, e.g. the app or page name.",
|
|
679
|
+
"type": "string"
|
|
680
|
+
},
|
|
681
|
+
"caption": {
|
|
682
|
+
"description": "Caption shown below the image on a hairline rule.",
|
|
683
|
+
"type": "string"
|
|
684
|
+
},
|
|
685
|
+
"width": {
|
|
686
|
+
"description": "Max width of the window (px or any CSS length); defaults to the full column.",
|
|
687
|
+
"anyOf": [
|
|
688
|
+
{
|
|
689
|
+
"type": "number"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"type": "string"
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
"required": [
|
|
698
|
+
"src"
|
|
699
|
+
]
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
]
|
|
703
|
+
}
|