@suzumiyaaoba/mdxr 0.1.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.
Files changed (236) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.mjs +2902 -0
  5. package/dist/components.d.mts +791 -0
  6. package/dist/components.mjs +2 -0
  7. package/dist/config-SI9IyFiC.mjs +184 -0
  8. package/dist/doc-context-CEqzMYKv.d.mts +568 -0
  9. package/dist/index.d.mts +20 -0
  10. package/dist/index.mjs +4 -0
  11. package/dist/ui-GKFD0mx5.mjs +15986 -0
  12. package/package.json +131 -0
  13. package/skill/SKILL.md +49 -0
  14. package/skill/references/components/charts.md +172 -0
  15. package/skill/references/components/document.md +98 -0
  16. package/skill/references/components/forms.md +35 -0
  17. package/skill/references/components/investigation.md +198 -0
  18. package/skill/references/components/layout.md +68 -0
  19. package/skill/references/components/output.md +158 -0
  20. package/skill/references/components/planning.md +155 -0
  21. package/skill/references/components/reports.md +252 -0
  22. package/skill/references/components/shadcn.md +19 -0
  23. package/skill/references/components.md +186 -0
  24. package/skill/references/extending.md +48 -0
  25. package/src/ask-sheet.ts +40 -0
  26. package/src/assets/css.ts +392 -0
  27. package/src/assets/scripts.ts +78 -0
  28. package/src/catalog.ts +287 -0
  29. package/src/cli.ts +178 -0
  30. package/src/client/doc-events.ts +1108 -0
  31. package/src/client/entry.ts +27 -0
  32. package/src/client-js.ts +47 -0
  33. package/src/component-map.ts +47 -0
  34. package/src/components/ui/accordion.tsx +77 -0
  35. package/src/components/ui/alert-dialog.tsx +185 -0
  36. package/src/components/ui/alert.tsx +76 -0
  37. package/src/components/ui/aspect-ratio.tsx +22 -0
  38. package/src/components/ui/attachment.tsx +208 -0
  39. package/src/components/ui/avatar.tsx +106 -0
  40. package/src/components/ui/badge.tsx +52 -0
  41. package/src/components/ui/breadcrumb.tsx +121 -0
  42. package/src/components/ui/bubble.tsx +128 -0
  43. package/src/components/ui/button-group.tsx +88 -0
  44. package/src/components/ui/button.tsx +58 -0
  45. package/src/components/ui/calendar.tsx +226 -0
  46. package/src/components/ui/card.tsx +102 -0
  47. package/src/components/ui/carousel.tsx +246 -0
  48. package/src/components/ui/chart.tsx +379 -0
  49. package/src/components/ui/checkbox.tsx +27 -0
  50. package/src/components/ui/collapsible.tsx +19 -0
  51. package/src/components/ui/combobox.tsx +298 -0
  52. package/src/components/ui/command.tsx +193 -0
  53. package/src/components/ui/context-menu.tsx +271 -0
  54. package/src/components/ui/dialog.tsx +159 -0
  55. package/src/components/ui/direction.tsx +4 -0
  56. package/src/components/ui/drawer.tsx +227 -0
  57. package/src/components/ui/dropdown-menu.tsx +269 -0
  58. package/src/components/ui/empty.tsx +104 -0
  59. package/src/components/ui/field.tsx +237 -0
  60. package/src/components/ui/fieldset.tsx +32 -0
  61. package/src/components/ui/frame.tsx +87 -0
  62. package/src/components/ui/hover-card.tsx +50 -0
  63. package/src/components/ui/input-group.tsx +159 -0
  64. package/src/components/ui/input-otp.tsx +83 -0
  65. package/src/components/ui/input.tsx +19 -0
  66. package/src/components/ui/item.tsx +202 -0
  67. package/src/components/ui/kbd.tsx +26 -0
  68. package/src/components/ui/label.tsx +19 -0
  69. package/src/components/ui/marker.tsx +71 -0
  70. package/src/components/ui/menubar.tsx +284 -0
  71. package/src/components/ui/message-scroller.tsx +128 -0
  72. package/src/components/ui/message.tsx +91 -0
  73. package/src/components/ui/meter.tsx +80 -0
  74. package/src/components/ui/native-select.tsx +64 -0
  75. package/src/components/ui/navigation-menu.tsx +170 -0
  76. package/src/components/ui/pagination.tsx +133 -0
  77. package/src/components/ui/popover.tsx +87 -0
  78. package/src/components/ui/progress.tsx +82 -0
  79. package/src/components/ui/questionnaire.tsx +328 -0
  80. package/src/components/ui/radio-group.tsx +35 -0
  81. package/src/components/ui/resizable.tsx +49 -0
  82. package/src/components/ui/scroll-area.tsx +50 -0
  83. package/src/components/ui/select.tsx +201 -0
  84. package/src/components/ui/separator.tsx +22 -0
  85. package/src/components/ui/sheet.tsx +135 -0
  86. package/src/components/ui/sidebar.tsx +730 -0
  87. package/src/components/ui/skeleton.tsx +13 -0
  88. package/src/components/ui/slider.tsx +51 -0
  89. package/src/components/ui/spinner.tsx +16 -0
  90. package/src/components/ui/switch.tsx +31 -0
  91. package/src/components/ui/table.tsx +113 -0
  92. package/src/components/ui/tabs.tsx +82 -0
  93. package/src/components/ui/textarea.tsx +17 -0
  94. package/src/components/ui/toast.tsx +229 -0
  95. package/src/components/ui/toggle-group.tsx +87 -0
  96. package/src/components/ui/toggle.tsx +43 -0
  97. package/src/components/ui/tooltip.tsx +65 -0
  98. package/src/components.ts +78 -0
  99. package/src/config.ts +56 -0
  100. package/src/define.ts +122 -0
  101. package/src/doc-context.ts +20 -0
  102. package/src/editor.ts +94 -0
  103. package/src/format-error.ts +78 -0
  104. package/src/guards.ts +84 -0
  105. package/src/hooks/use-mobile.ts +21 -0
  106. package/src/html.ts +91 -0
  107. package/src/hydrate/export-index.ts +232 -0
  108. package/src/hydrate/import-scan.ts +169 -0
  109. package/src/hydrate/plugins.ts +118 -0
  110. package/src/hydrate/runtime-module.ts +145 -0
  111. package/src/hydrate-runtime.ts +67 -0
  112. package/src/hydrate.ts +147 -0
  113. package/src/index.ts +16 -0
  114. package/src/init.ts +57 -0
  115. package/src/langs.ts +148 -0
  116. package/src/lines.ts +53 -0
  117. package/src/load-user-module.ts +191 -0
  118. package/src/mdx.ts +248 -0
  119. package/src/paths.ts +36 -0
  120. package/src/rehype/shiki.ts +533 -0
  121. package/src/remark/alerts.ts +53 -0
  122. package/src/remark/ast.ts +96 -0
  123. package/src/remark/callouts.ts +25 -0
  124. package/src/remark/code-file.ts +85 -0
  125. package/src/remark/code-meta.ts +21 -0
  126. package/src/remark/directives.ts +170 -0
  127. package/src/remark/file-paths.ts +64 -0
  128. package/src/remark/headings.ts +131 -0
  129. package/src/remark/no-js.ts +40 -0
  130. package/src/render.ts +337 -0
  131. package/src/serve.ts +322 -0
  132. package/src/styles/globals.css +134 -0
  133. package/src/styles/shadcn.css +641 -0
  134. package/src/tailwind.ts +119 -0
  135. package/src/ui/approvals.tsx +76 -0
  136. package/src/ui/ask-question.tsx +386 -0
  137. package/src/ui/ask.tsx +206 -0
  138. package/src/ui/attrs.ts +51 -0
  139. package/src/ui/audit.tsx +139 -0
  140. package/src/ui/bar-chart.tsx +334 -0
  141. package/src/ui/benchmarks.tsx +143 -0
  142. package/src/ui/bits.tsx +537 -0
  143. package/src/ui/board.tsx +173 -0
  144. package/src/ui/bridge.tsx +207 -0
  145. package/src/ui/bumps.tsx +178 -0
  146. package/src/ui/callout.tsx +106 -0
  147. package/src/ui/changes.tsx +89 -0
  148. package/src/ui/chart-bits.tsx +52 -0
  149. package/src/ui/chart.ts +577 -0
  150. package/src/ui/checks.tsx +203 -0
  151. package/src/ui/child-index.tsx +44 -0
  152. package/src/ui/children.ts +43 -0
  153. package/src/ui/chips.tsx +49 -0
  154. package/src/ui/cmd.tsx +27 -0
  155. package/src/ui/columns.tsx +31 -0
  156. package/src/ui/comments.tsx +544 -0
  157. package/src/ui/compare.tsx +67 -0
  158. package/src/ui/decision.tsx +79 -0
  159. package/src/ui/deps.tsx +78 -0
  160. package/src/ui/details.tsx +43 -0
  161. package/src/ui/diff-parse.ts +307 -0
  162. package/src/ui/diff.tsx +458 -0
  163. package/src/ui/diffstat.tsx +58 -0
  164. package/src/ui/due.tsx +65 -0
  165. package/src/ui/effort.tsx +29 -0
  166. package/src/ui/endpoints.tsx +118 -0
  167. package/src/ui/envvars.tsx +96 -0
  168. package/src/ui/figure.tsx +37 -0
  169. package/src/ui/file-icon.ts +1020 -0
  170. package/src/ui/file-link.ts +32 -0
  171. package/src/ui/file-ref.tsx +39 -0
  172. package/src/ui/files.tsx +112 -0
  173. package/src/ui/findings.tsx +85 -0
  174. package/src/ui/flow.tsx +73 -0
  175. package/src/ui/funnel.tsx +121 -0
  176. package/src/ui/gantt.tsx +443 -0
  177. package/src/ui/gauges.tsx +135 -0
  178. package/src/ui/glossary.tsx +29 -0
  179. package/src/ui/graph-layout.ts +149 -0
  180. package/src/ui/graph-specs.tsx +102 -0
  181. package/src/ui/graph.tsx +278 -0
  182. package/src/ui/grid.tsx +119 -0
  183. package/src/ui/hypothesis.tsx +94 -0
  184. package/src/ui/icon.tsx +80 -0
  185. package/src/ui/incident.tsx +130 -0
  186. package/src/ui/index.ts +342 -0
  187. package/src/ui/ins-del.tsx +41 -0
  188. package/src/ui/json.tsx +190 -0
  189. package/src/ui/layout.ts +9 -0
  190. package/src/ui/line-chart.tsx +251 -0
  191. package/src/ui/matrix.tsx +208 -0
  192. package/src/ui/meta.tsx +73 -0
  193. package/src/ui/option.tsx +64 -0
  194. package/src/ui/owner.tsx +40 -0
  195. package/src/ui/packages.tsx +104 -0
  196. package/src/ui/pathway.tsx +96 -0
  197. package/src/ui/phase.tsx +41 -0
  198. package/src/ui/pie-chart.tsx +170 -0
  199. package/src/ui/plan.tsx +77 -0
  200. package/src/ui/pre.tsx +175 -0
  201. package/src/ui/priority.tsx +51 -0
  202. package/src/ui/props.tsx +77 -0
  203. package/src/ui/quadrant.tsx +172 -0
  204. package/src/ui/radar.tsx +200 -0
  205. package/src/ui/ref.tsx +160 -0
  206. package/src/ui/release.tsx +178 -0
  207. package/src/ui/req.tsx +42 -0
  208. package/src/ui/review.tsx +133 -0
  209. package/src/ui/risk.tsx +67 -0
  210. package/src/ui/sankey.tsx +287 -0
  211. package/src/ui/scatter.tsx +237 -0
  212. package/src/ui/schema.tsx +113 -0
  213. package/src/ui/score.tsx +105 -0
  214. package/src/ui/search.tsx +120 -0
  215. package/src/ui/series.tsx +38 -0
  216. package/src/ui/severity.tsx +69 -0
  217. package/src/ui/shadcn.tsx +216 -0
  218. package/src/ui/spark.tsx +86 -0
  219. package/src/ui/stack.tsx +57 -0
  220. package/src/ui/stats.tsx +63 -0
  221. package/src/ui/status-badge.tsx +66 -0
  222. package/src/ui/statuspage.tsx +238 -0
  223. package/src/ui/steps.tsx +74 -0
  224. package/src/ui/summary.tsx +41 -0
  225. package/src/ui/symbol-ref.tsx +73 -0
  226. package/src/ui/terminal.tsx +117 -0
  227. package/src/ui/tests.tsx +218 -0
  228. package/src/ui/timeline.tsx +63 -0
  229. package/src/ui/toc.tsx +56 -0
  230. package/src/ui/tones.ts +187 -0
  231. package/src/ui/trace.tsx +69 -0
  232. package/src/ui/tree.tsx +281 -0
  233. package/src/ui/treemap.tsx +128 -0
  234. package/src/ui/venn.tsx +258 -0
  235. package/src/ui/verdict.tsx +78 -0
  236. package/src/ui/waterfall.tsx +142 -0
package/package.json ADDED
@@ -0,0 +1,131 @@
1
+ {
2
+ "name": "@suzumiyaaoba/mdxr",
3
+ "version": "0.1.0",
4
+ "description": "Render agent-authored MDX documents (plans, reports) to standalone HTML with a semantic component catalog",
5
+ "keywords": [
6
+ "agents",
7
+ "cli",
8
+ "documentation",
9
+ "html",
10
+ "mdx",
11
+ "renderer",
12
+ "static-site"
13
+ ],
14
+ "homepage": "https://github.com/SuzumiyaAoba/mdxr#readme",
15
+ "bugs": "https://github.com/SuzumiyaAoba/mdxr/issues",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/SuzumiyaAoba/mdxr.git"
20
+ },
21
+ "bin": {
22
+ "mdxr": "./dist/cli.mjs"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "skill",
27
+ "src"
28
+ ],
29
+ "type": "module",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.mts",
33
+ "default": "./dist/index.mjs"
34
+ },
35
+ "./components": {
36
+ "types": "./dist/components.d.mts",
37
+ "default": "./dist/components.mjs"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "@base-ui/react": "^1.8.0",
46
+ "@dagrejs/dagre": "^3.1.1",
47
+ "@iconify-json/lucide": "1.2.130",
48
+ "@iconify-json/vscode-icons": "1.2.77",
49
+ "@iconify/react": "6.0.2",
50
+ "@iconify/tailwind4": "1.2.3",
51
+ "@mdx-js/mdx": "^3.1.1",
52
+ "@shadcn/react": "^0.3.1",
53
+ "@shikijs/transformers": "4.4.3",
54
+ "@tailwindcss/node": "^4.3.3",
55
+ "@tailwindcss/oxide": "^4.3.3",
56
+ "@tailwindcss/typography": "^0.5.16",
57
+ "cac": "^7.0.0",
58
+ "class-variance-authority": "^0.7.1",
59
+ "cmdk": "^1.1.1",
60
+ "cn": "^0.3.0",
61
+ "date-fns": "^4.4.0",
62
+ "embla-carousel-react": "^8.6.0",
63
+ "esbuild": "^0.28.2",
64
+ "input-otp": "^1.5.0",
65
+ "katex": "^0.18.7",
66
+ "lucide-react": "^1.45.0",
67
+ "react": "^19.3.0",
68
+ "react-day-picker": "^10.0.1",
69
+ "react-dom": "^19.3.0",
70
+ "react-resizable-panels": "^4.12.4",
71
+ "recharts": "^3.8.0",
72
+ "rehype-katex": "^7.0.1",
73
+ "remark-directive": "^4.0.0",
74
+ "remark-frontmatter": "^5.0.0",
75
+ "remark-gfm": "^4.0.1",
76
+ "remark-math": "^6.0.0",
77
+ "shiki": "^4.4.3",
78
+ "tailwindcss": "^4.3.3",
79
+ "tw-animate-css": "^1.4.0",
80
+ "unist-util-visit": "^5.0.0",
81
+ "unist-util-visit-parents": "6.0.2",
82
+ "valibot": "^1.5.0",
83
+ "vfile": "^6.0.3",
84
+ "vfile-matter": "^5.0.1"
85
+ },
86
+ "devDependencies": {
87
+ "@chromatic-com/storybook": "^5.3.1",
88
+ "@fontsource-variable/geist": "^5.3.0",
89
+ "@storybook/addon-a11y": "^10.6.0",
90
+ "@storybook/addon-docs": "^10.6.0",
91
+ "@storybook/addon-vitest": "^10.6.0",
92
+ "@storybook/react-vite": "^10.6.0",
93
+ "@tailwindcss/vite": "^4.3.3",
94
+ "@types/hast": "^3.0.5",
95
+ "@types/mdast": "^4.0.4",
96
+ "@types/mdx": "^2.0.14",
97
+ "@types/node": "^22.15.0",
98
+ "@types/react": "^19.3.0",
99
+ "@types/react-dom": "^19.3.0",
100
+ "@types/unist": "^3.0.3",
101
+ "@vitest/browser-playwright": "4.1.11",
102
+ "@vitest/coverage-v8": "4.1.11",
103
+ "lefthook": "^2.1.14",
104
+ "oxfmt": "^0.68.0",
105
+ "oxlint": "^1.83.0",
106
+ "oxlint-plugin-complexity": "2.1.8",
107
+ "oxlint-tsgolint": "^7.0.2001",
108
+ "playwright": "^1.63.0",
109
+ "react-doctor": "^0.9.14",
110
+ "storybook": "^10.6.0",
111
+ "typescript": "^5.8.0",
112
+ "ultracite": "7.11.1",
113
+ "vite": "npm:@voidzero-dev/vite-plus-core@^0.3.2",
114
+ "vite-plus": "^0.3.2",
115
+ "vitest": "4.1.11"
116
+ },
117
+ "engines": {
118
+ "node": ">=20"
119
+ },
120
+ "scripts": {
121
+ "build": "vp pack",
122
+ "build:examples": "pnpm build && node scripts/render-examples.ts",
123
+ "test": "vp test",
124
+ "typecheck": "tsc --noEmit",
125
+ "check": "ultracite check",
126
+ "fix": "ultracite fix",
127
+ "storybook": "storybook dev -p 6006",
128
+ "build-storybook": "storybook build",
129
+ "react-doctor": "react-doctor"
130
+ }
131
+ }
package/skill/SKILL.md ADDED
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: mdxr
3
+ description: Write rich plan/report documents as MDX using the mdxr component catalog, then render them to standalone HTML with `npx @suzumiyaaoba/mdxr render`. Use when creating plan files, status reports, reviews, or any structured document meant to be viewed as a styled HTML page.
4
+ ---
5
+
6
+ # mdxr — agent-authored documents rendered to HTML
7
+
8
+ Write documents as **Markdown + a small set of JSX components** (MDX). Do NOT write raw HTML: `mdxr render` compiles the document deterministically, so markup, styling and scripts are never emitted by the model.
9
+
10
+ ## Workflow
11
+
12
+ 1. Write the document as `*.mdx` using Markdown plus the components below.
13
+ 2. Render: `npx @suzumiyaaoba/mdxr render plan.mdx -o plan.html`
14
+ 3. Or pipe MDX directly: `cat plan.mdx | npx @suzumiyaaoba/mdxr render > plan.html` (`mdxr render -` also reads stdin; `-o out.html` writes a file).
15
+ 4. On errors, the message includes `file:line:col` — fix and re-run. `npx @suzumiyaaoba/mdxr render plan.mdx --format json` prints machine-readable errors.
16
+ 5. Preview while editing: `npx @suzumiyaaoba/mdxr serve plan.mdx` — or pipe: `cat plan.mdx | npx @suzumiyaaoba/mdxr serve`
17
+
18
+ ## Rules
19
+
20
+ - **No JS in documents.** `import`/`export` and `{expressions}` are rejected. All attributes are strings: `<Step status="done">`, not `status={...}`.
21
+ - Prefer plain Markdown for prose; use components only for structure.
22
+ - If a needed component is missing, run `npx @suzumiyaaoba/mdxr catalog --json` to see the full catalog, then define it in the project's component file — see `references/extending.md` for the extension mechanism.
23
+ - For component usage, read `references/components.md` (the index — includes a syntax cheatsheet), then only the `references/components/*.md` detail file(s) the document needs.
24
+
25
+ ## Component categories
26
+
27
+ | Category | Covers | Details |
28
+ | --- | --- | --- |
29
+ | Document scaffolding | `<Plan>` root, meta row, callouts, TOC, glossary, refs, code blocks | `references/components/document.md` |
30
+ | Planning & status | phases, steps, timeline, gantt, decisions, risks, board, matrix, stats | `references/components/planning.md` |
31
+ | Code investigation | findings, hypotheses, terminal, traces, searches, files, flows, trees | `references/components/investigation.md` |
32
+ | Output artifacts | diff cards, graphs, tests, endpoints, JSON, waterfalls | `references/components/output.md` |
33
+ | Reports | code review, CI checks, vuln/dep audits, metrics, schema/env docs, status/release/incident | `references/components/reports.md` |
34
+ | Data visualization | bar/line/pie/scatter/radar/funnel/quadrant/bridge/treemap/sankey/venn | `references/components/charts.md` |
35
+ | Layout | columns, grid, row, stack, before/after panels | `references/components/layout.md` |
36
+ | Reader input | `<Ask>` question forms with copyable Markdown answers | `references/components/forms.md` |
37
+ | shadcn/ui | `Button`, `Card`, `Table`, `Tabs`, … — interactive via hydration | `references/components/shadcn.md` |
38
+
39
+ ## Common syntax
40
+
41
+ | Write | Get |
42
+ | --- | --- |
43
+ | `:::note` / `:::warning` / `:::decision` / `> [!NOTE]` | `<Callout>` |
44
+ | `:::phase{title="…" status="doing"}` | `<Phase>` heading with status badge |
45
+ | ` ```ts title="src/x.ts" ` | highlighted code block + filename bar |
46
+ | ` ```diff ` / ` ```mermaid ` / ` ```console ` | diff cards / diagram / terminal transcript |
47
+ | `` `src/x.ts` `` naming a real file | `<FileRef>` chip with editor link |
48
+ | `- [ ]` / `- [x]` | styled task list |
49
+ | frontmatter `status:` / `date:` / `owner:` | document header badge + meta row |
@@ -0,0 +1,172 @@
1
+ # Charts — quantitative data visualizations
2
+
3
+ Index: [../components.md](../components.md). MDX attributes are always strings; `children` is Markdown.
4
+
5
+ Every chart renders a static SVG/HTML panel at render time — no client JS, no CDN. Containers share the same frame: an icon + `title` caption bar and an optional right-side figure (range or total + `unit`). Data comes from typed child elements (`<Bar>`, `<Slice>`, …); anything else renders below the chart.
6
+
7
+ Shared conventions:
8
+
9
+ - Numeric attrs accept numbers or numeric strings (`value="42"`); comma lists (`values="1,2,3"`, `labels="Mon,Tue"`) split on `,`.
10
+ - `tone="sky|emerald|amber|violet|teal|indigo|orange|red"` pins an item's color; without it the palette cycles by position.
11
+ - `unit="ms"` (etc.) labels values in axes, legends and tooltips; `title` sets the caption.
12
+ - Standalone children (outside their container) degrade to a small `name value` chip instead of failing.
13
+
14
+ ### `<BarChart title direction series stacked max unit>` / `<Bar name value values note tone>` / `:::barchart`
15
+
16
+ Categorical comparison. `<Bar name value>` needs `name` and `value` (or `values` for multi-series). `direction="horizontal"` flips to labeled rows for long names. `series="a,b"` names the `values` slots (legend + per-slot colors); `stacked` sums them into one column instead of grouping. `max` overrides the axis ceiling (defaults to a "nice" bound over the data).
17
+
18
+ ```mdx
19
+ <BarChart title="deploys per quarter" unit="deploys">
20
+ <Bar name="Q1" value="18" />
21
+ <Bar name="Q2" value="26" note="launch" />
22
+ <Bar name="Q3" tone="emerald" value="34" />
23
+ </BarChart>
24
+ ```
25
+
26
+ ```mdx
27
+ <BarChart series="this year,last year" title="latency by endpoint" unit="ms">
28
+ <Bar name="/users" values="42,58" />
29
+ <Bar name="/search" values="120,210" />
30
+ </BarChart>
31
+ ```
32
+
33
+ ### `<LineChart title labels area min max unit>` / `<Series name values tone dash>` / `:::linechart`
34
+
35
+ Trend lines over evenly-spaced categories. `labels="Mon,Tue,…"` names the x slots; each `<Series values="…">` aligns with them (extra points extend the axis). The y domain snaps to round bounds — `min`/`max` pin it. `area` adds a soft fill under each line; `dash` on a series draws it dashed (baselines/targets).
36
+
37
+ ```mdx
38
+ <LineChart labels="Mon,Tue,Wed,Thu,Fri" title="p95 latency" unit="ms">
39
+ <Series name="api" values="120,118,132,125,110" />
40
+ <Series name="edge" tone="emerald" values="60,58,64,70,55" />
41
+ </LineChart>
42
+ ```
43
+
44
+ ### `<PieChart title donut unit>` / `<Slice name value note tone>` / `:::piechart`
45
+
46
+ Part-of-whole share. `<Slice name value>` rows fill the legend with name · value · %; `donut` cuts a center hole carrying the total. Empty or all-zero data renders a neutral ring.
47
+
48
+ ```mdx
49
+ <PieChart donut title="build minutes" unit="min">
50
+ <Slice name="compile" value="38" />
51
+ <Slice name="tests" value="27" />
52
+ <Slice name="lint" value="9" />
53
+ </PieChart>
54
+ ```
55
+
56
+ ### `<Scatter title x y>` / `<Point x y name size tone>` / `:::scatter`
57
+
58
+ Two-variable correlation on auto-scaled numeric axes — `x`/`y` on the container name them. `<Point>` needs `x` and `y`; `name` labels the dot, `size` turns it into a bubble (radius ∝ √size).
59
+
60
+ ```mdx
61
+ <Scatter title="latency vs payload" x="payload kb" y="latency ms">
62
+ <Point x="12" y="40" />
63
+ <Point name="bulk export" size="90" tone="amber" x="140" y="210" />
64
+ </Scatter>
65
+ ```
66
+
67
+ ### `<Radar title axes max unit>` / `<Series>` / `:::radar`
68
+
69
+ Spider chart for multivariate comparison — needs ≥3 axes. `axes="Perf,DX,Tests"` names the corners; each `<Series>` becomes a polygon. `max` fixes the ring scale (default: largest value snapped up); ring gridlines sit at quarter steps.
70
+
71
+ ```mdx
72
+ <Radar axes="Perf,DX,Tests,Docs,Security" title="service health">
73
+ <Series name="api" values="80,65,90,40,70" />
74
+ <Series name="web" tone="emerald" values="60,85,55,70,60" />
75
+ </Radar>
76
+ ```
77
+
78
+ ### `<Funnel title unit>` / `<Stage name value note tone>` / `:::funnel`
79
+
80
+ Stage-by-stage narrowing — centered bars shrink through `<Stage>` rows in order. Each row shows the value plus its share of the first stage; the left column carries the conversion from the previous stage when it drops.
81
+
82
+ ```mdx
83
+ <Funnel title="signup funnel" unit="users">
84
+ <Stage name="visited" value="12800" />
85
+ <Stage name="signed up" value="3400" />
86
+ <Stage name="paid" tone="emerald" value="420" />
87
+ </Funnel>
88
+ ```
89
+
90
+ ### `<Quadrant title x y quadrants>` / `<Pin name x y note tone>` / `:::quadrant`
91
+
92
+ 2-axis positioning map — `<Pin>` items on a 0–100 square split by midlines. `x`/`y` name the axes; `quadrants="TL,TR,BL,BR"` labels the four regions (top-left → top-right → bottom-left → bottom-right).
93
+
94
+ ```mdx
95
+ <Quadrant
96
+ title="capability map"
97
+ x="adoption"
98
+ y="impact"
99
+ quadrants="invest,bet,maintain,drop"
100
+ >
101
+ <Pin name="mdxr" tone="sky" x="78" y="85" />
102
+ <Pin name="legacy" tone="red" x="15" y="15" />
103
+ </Quadrant>
104
+ ```
105
+
106
+ ### `<Bridge title unit>` / `<Delta name value note total>` / `:::bridge`
107
+
108
+ Running-total waterfall — a start pillar carried to an end pillar by signed `<Delta>` contributions. Deltas float from the previous sum to the new one (emerald up / red down); `total` re-anchors the running sum at its `value` as a neutral pillar. Connector ticks link each column to the previous total.
109
+
110
+ ```mdx
111
+ <Bridge title="FY revenue bridge" unit="M$">
112
+ <Delta name="FY24" total value="120" />
113
+ <Delta name="new sales" value="48" />
114
+ <Delta name="churn" value="-15" />
115
+ <Delta name="FY25" total value="175" />
116
+ </Bridge>
117
+ ```
118
+
119
+ ### `<Treemap title unit>` / `<Tile name value note tone>` / `:::treemap`
120
+
121
+ Part-of-whole areas packed by the squarified algorithm — `<Tile>` area ∝ `value`. Labels carry the name plus value and share percent (small tiles drop the number line).
122
+
123
+ ```mdx
124
+ <Treemap title="bundle by workspace" unit="kB">
125
+ <Tile name="ui" value="184" />
126
+ <Tile name="vendor" note="react+mdx" value="260" />
127
+ <Tile name="cli" value="72" />
128
+ </Treemap>
129
+ ```
130
+
131
+ ### `<Sankey title stages unit>` / `<Link from to value label>` + `<Node id label stage>` / `:::sankey`
132
+
133
+ Quantity splitting/merging across stage columns — ribbon thickness ∝ `<Link value>`. Nodes are implicit from link endpoints; `<Node>` children (the same element `<Graph>` uses) rename them via `label`, pin a column via `stage`, or recolor via `tone`. Stage columns come from longest-path layering when not pinned; `stages="A,B,C"` titles the columns. Cycles fall back to stage 0.
134
+
135
+ ```mdx
136
+ <Sankey stages="source,grid,use" title="energy flow" unit="TWh">
137
+ <Link from="solar" to="grid" value="40" />
138
+ <Link from="wind" to="grid" value="35" />
139
+ <Link from="grid" to="homes" value="55" />
140
+ <Link from="grid" to="industry" value="20" />
141
+ </Sankey>
142
+ ```
143
+
144
+ ### `<Venn title unit>` / `<Set name value tone>` + `<Overlap sets value>` / `:::venn`
145
+
146
+ Set overlaps — 2 or 3 `<Set>` circles (uniform size; a Venn is not to scale). `<Overlap sets="a,b" value>` prints a value at the intersection named by comma-joined set names.
147
+
148
+ ```mdx
149
+ <Venn title="skill coverage" unit="devs">
150
+ <Set name="frontend" value="14" />
151
+ <Set name="backend" value="18" />
152
+ <Overlap sets="frontend,backend" value="6" />
153
+ </Venn>
154
+ ```
155
+
156
+ ## Choosing
157
+
158
+ | Data shape | Component |
159
+ | --- | --- |
160
+ | Category comparison, single or grouped/stacked series | `<BarChart>` |
161
+ | Trend over ordered slots, one or more series | `<LineChart>` |
162
+ | Shares of a total (≤ ~8 parts) | `<PieChart>` or `<Treemap>` (many/uneven parts) |
163
+ | Two numeric variables, optional bubble | `<Scatter>` |
164
+ | Multivariate profile on 3+ shared axes | `<Radar>` |
165
+ | Sequential narrowing / conversion | `<Funnel>` |
166
+ | 0–100 positioning on two named axes | `<Quadrant>` |
167
+ | Start→deltas→end reconciliation | `<Bridge>` |
168
+ | Flow splitting/merging between columns | `<Sankey>` |
169
+ | 2–3 set membership overlap | `<Venn>` |
170
+ | Timing offsets on a shared clock | `<Waterfall>` (output.md) |
171
+ | Date-based schedule | `<Gantt>` (planning.md) |
172
+ | Arbitrary node/edge topology | `<Graph>` (output.md) |
@@ -0,0 +1,98 @@
1
+ # Document scaffolding
2
+
3
+ Index: [../components.md](../components.md). MDX attributes are always strings; `children` is Markdown.
4
+
5
+ ### `<Plan title="…" status="…" date owner version updated>`
6
+
7
+ Document root. Renders a title header with an optional status badge and a metadata row. If frontmatter `title:` exists, a header is generated automatically — frontmatter `status:`, `date:`, `owner:`, `version:` and `updated:` are picked up too.
8
+
9
+ ```mdx
10
+ <Plan title="Renderer rewrite" status="doing" owner="@alice" date="2026-09-10" version="v3">
11
+ ```
12
+
13
+ ### `<Meta date owner version updated>` / `<MetaItem label="…" icon="…">`
14
+
15
+ Document metadata row (muted line: `Date: … · Owner: …`). Usable anywhere, not only inside `<Plan>`. For custom entries nest `<MetaItem label="Spec" icon="lucide:tag">…</MetaItem>` — `MetaItem` children may contain Markdown links; `icon` takes any Iconify name (`lucide` bundled, prefix optional).
16
+
17
+ ### `<Callout kind="…" title="…">`
18
+
19
+ Highlighted block. `:::note`, `:::warning`, `> [!NOTE]` produce the same output. Kinds: `note` `tip` `important` `warning` `caution` `danger` `decision` `goal` `nongoal` `question` `answer` — `goal`/`nongoal`/`question` cover plan-doc conventions, `answer` is the conclusion block of an investigation report. `:::non-goal` and `> [!NON-GOAL]` are aliases of `nongoal`.
20
+
21
+ ### `<Details summary="…" open>`
22
+
23
+ Collapsible section on a native `<details>` element — opens/closes even without client JS (unlike the shadcn `Collapsible`, which needs the hydration bundle). `open` starts it expanded.
24
+
25
+ ### `<Toc depth="3" min="2" title="Contents" open />` / `:::toc`
26
+
27
+ Table of contents auto-built from the document's headings (h2–h3 by default — h1 is the document title). Headings always get slug `id`s, so `[link](#slug)` deep links work anywhere. Renders as a collapsible outline — numbered top-level entries, guide-lined nesting — on a native `<details>` (works without JS); `open="false"` starts it folded.
28
+
29
+ ### `<Glossary>` / `<Term name="…">`
30
+
31
+ Definition list (`<dl>`) for domain terms. `name` is the term; children are the definition.
32
+
33
+ ### `<Figure src="…" alt="…" caption="…">`
34
+
35
+ Image with an optional caption (children work too). Use for screenshots or diagrams mermaid can't express.
36
+
37
+ ### `<Ref href="…" title="…">` / `<Issue repo="o/r" number="12">` / `<PR repo="o/r" number="5">` / `<Commit repo="o/r" sha="…">`
38
+
39
+ `Ref` is a linked reference card (use for a "References" section). `Issue`/`PR`/`Commit` are inline chips linking to `github.com/{repo}/issues|pull|commit/{id}` — `repo` may also be `host/owner/repo` or a full URL for GitHub Enterprise. `Commit` displays the first 7 chars of `sha`, children become the title; `href` overrides the URL.
40
+
41
+ ### `<Cmd>`
42
+
43
+ Inline command chip — terminal icon + copy button.
44
+
45
+ ```mdx
46
+ Run <Cmd>pnpm build</Cmd> then <Cmd>mdxr render plan.mdx</Cmd>.
47
+ ```
48
+
49
+ ### `<Icon name="lucide:rocket" label className />`
50
+
51
+ Inline Iconify icon rendered as SVG — no runtime fetch. The `lucide` and `vscode-icons` sets are bundled; the `lucide:` prefix may be omitted (`name="check"`). Unknown names are render-time validation errors. Decorative by default (`aria-hidden`); pass `label` to expose it as an image with `aria-label`. Size and color come from `className` (`h-4 w-4 text-teal-500`).
52
+
53
+ Status badges, step markers, callouts, chips and the file tree all carry appropriate icons automatically.
54
+
55
+ ```mdx
56
+ Launch checklist <Icon name="lucide:rocket" className="h-4 w-4" />
57
+ ```
58
+
59
+ Icons also work as CSS classes (mask-image, single-color) on any element:
60
+
61
+ ```mdx
62
+ <span className="icon-[lucide--github] h-5 w-5" />
63
+ ```
64
+
65
+ ### Fenced code
66
+
67
+ ````
68
+ ```ts title="src/cli.ts"
69
+ …
70
+ ```
71
+ ````
72
+
73
+ renders a framed block with filename + copy button; the header carries a file-type icon picked from the filename (or language), and links to the file in your editor when it exists on disk (see "File links" in [../components.md](../components.md)). Code is syntax-highlighted with Shiki (light/dark dual theme), so always tag the fence with a language (`ts`, `python`, `diff`, …). ` ```mermaid ` renders a diagram.
74
+
75
+ The fence meta also controls line presentation:
76
+
77
+ ````
78
+ ```ts {1,3-4} ln title="src/cli.ts"
79
+ …
80
+ ```
81
+ ````
82
+
83
+ - `{1,3-4}` highlights those lines; `/pattern/` highlights every match (word highlight).
84
+ - `ln` shows line numbers (also `line-numbers`, `lineNumbers`, `showLineNumbers`).
85
+
86
+ Inside the code, `// [!code …]` markers annotate lines and are stripped from output:
87
+
88
+ | Marker | Effect |
89
+ | --- | --- |
90
+ | `// [!code hl]` / `// [!code highlight]` | highlight the line |
91
+ | `// [!code ++]` / `// [!code --]` | green/red diff rows (works in any language) |
92
+ | `// [!code warning]` / `// [!code error]` | amber/red line bands |
93
+ | `// [!code focus]` | dim all other lines |
94
+ | `// [!code word:foo]` | highlight every `foo` occurrence |
95
+
96
+ ### Math
97
+
98
+ `$…$` inline and `$$…$$` blocks render via KaTeX (stylesheet from CDN, only linked when math is present).
@@ -0,0 +1,35 @@
1
+ # Reader input components
2
+
3
+ Index: [../components.md](../components.md). MDX attributes are always strings; `children` is Markdown.
4
+
5
+ ### `<Ask title description>` / `<Question name type label>` / `<Choice value checked>`
6
+
7
+ Question block that asks the reader for input — open decisions in a plan, sign-off toggles, free-form answers. Built on **native** form controls (unlike the shadcn set), so every field is interactive in the static document. Answers render live as a Markdown sheet in the block's output pane — `# title` then `- **label**: answer` per question — which "Copy answers" copies to the clipboard and "Save .md" downloads as a file the user can keep or paste back.
8
+
9
+ `<Question>` `type`: `choice` (radio cards), `multi` (checkbox cards), `select` (dropdown), `text`, `textarea`, `toggle` (switch). Default: `choice` when it has `<Choice>` children, else `text`. `name` is the answer key; `label`, `description`, `required`, `placeholder`, `value` (text default), `rows` (textarea), `checked` (toggle) are supported.
10
+
11
+ ```mdx
12
+ <Ask title="確認事項" description="プランに反映します">
13
+ <Question name="approach" type="choice" label="実装方針" required>
14
+ <Choice value="gradual" checked>
15
+ 段階的移行
16
+ </Choice>
17
+ <Choice value="rewrite" description="ロールバック経路が必要">
18
+ 一括書き換え
19
+ </Choice>
20
+ </Question>
21
+ <Question name="scope" type="multi" label="含める範囲">
22
+ <Choice value="api" checked>
23
+ API
24
+ </Choice>
25
+ <Choice value="ui">UI</Choice>
26
+ </Question>
27
+ <Question name="prio" type="select" label="優先度" placeholder="選択">
28
+ <Choice value="high">高</Choice>
29
+ <Choice value="mid">中</Choice>
30
+ </Question>
31
+ <Question name="deadline" type="text" label="期限" placeholder="YYYY-MM-DD" />
32
+ <Question name="notes" type="textarea" label="補足" rows="2" />
33
+ <Question name="preview" type="toggle" label="プレビュー環境を作る" checked />
34
+ </Ask>
35
+ ```