@misoto22/design 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/AGENTS.md +87 -0
  2. package/CLAUDE.md +1 -0
  3. package/README.md +62 -5
  4. package/bin/misoto22-design.mjs +59 -13
  5. package/dist/agent/Accordion.md +24 -1
  6. package/dist/agent/Alert.md +23 -1
  7. package/dist/agent/AppShell.md +30 -2
  8. package/dist/agent/ArchitectureFigure.md +71 -0
  9. package/dist/agent/AreaChart.md +27 -2
  10. package/dist/agent/Article.md +26 -3
  11. package/dist/agent/AspectRatio.md +57 -0
  12. package/dist/agent/Avatar.md +25 -5
  13. package/dist/agent/Badge.md +22 -1
  14. package/dist/agent/BarChart.md +29 -2
  15. package/dist/agent/BarList.md +27 -1
  16. package/dist/agent/BigNumber.md +26 -2
  17. package/dist/agent/BoxPlot.md +24 -1
  18. package/dist/agent/Breadcrumb.md +24 -2
  19. package/dist/agent/BulletChart.md +23 -1
  20. package/dist/agent/Button.md +25 -1
  21. package/dist/agent/Calendar.md +37 -3
  22. package/dist/agent/Card.md +24 -2
  23. package/dist/agent/Checkbox.md +23 -2
  24. package/dist/agent/Code.md +50 -0
  25. package/dist/agent/CodeBlock.md +74 -0
  26. package/dist/agent/Collapsible.md +22 -1
  27. package/dist/agent/Combobox.md +29 -3
  28. package/dist/agent/Command.md +25 -2
  29. package/dist/agent/ComposedChart.md +26 -2
  30. package/dist/agent/ContextMenu.md +37 -4
  31. package/dist/agent/DataflowFigure.md +48 -0
  32. package/dist/agent/DatePicker.md +34 -6
  33. package/dist/agent/DescriptionList.md +68 -0
  34. package/dist/agent/Diagram.md +27 -3
  35. package/dist/agent/DiagramCanvas.md +70 -0
  36. package/dist/agent/DiagramExportMenu.md +64 -0
  37. package/dist/agent/DiagramInspector.md +72 -0
  38. package/dist/agent/DiagramLegend.md +55 -0
  39. package/dist/agent/DiagramMinimap.md +68 -0
  40. package/dist/agent/DiagramToolbar.md +69 -0
  41. package/dist/agent/Dialog.md +26 -3
  42. package/dist/agent/DropdownMenu.md +45 -6
  43. package/dist/agent/EmptyState.md +26 -1
  44. package/dist/agent/ErrorState.md +27 -2
  45. package/dist/agent/Facet.md +25 -1
  46. package/dist/agent/Field.md +45 -4
  47. package/dist/agent/FigureBand.md +24 -1
  48. package/dist/agent/FloatingIconButton.md +23 -1
  49. package/dist/agent/FunnelChart.md +23 -1
  50. package/dist/agent/Heading.md +64 -0
  51. package/dist/agent/Heatmap.md +25 -1
  52. package/dist/agent/Histogram.md +26 -2
  53. package/dist/agent/Input.md +22 -1
  54. package/dist/agent/Kbd.md +19 -1
  55. package/dist/agent/LifecycleFigure.md +49 -0
  56. package/dist/agent/LineChart.md +26 -2
  57. package/dist/agent/LinkArrow.md +20 -1
  58. package/dist/agent/Markdown.md +68 -0
  59. package/dist/agent/NativeSelect.md +23 -2
  60. package/dist/agent/NavItem.md +21 -1
  61. package/dist/agent/Pagination.md +28 -2
  62. package/dist/agent/PieChart.md +26 -2
  63. package/dist/agent/Popover.md +23 -1
  64. package/dist/agent/Progress.md +27 -3
  65. package/dist/agent/RadarChart.md +26 -2
  66. package/dist/agent/RadialChart.md +26 -3
  67. package/dist/agent/RadioGroup.md +23 -2
  68. package/dist/agent/SankeyChart.md +25 -2
  69. package/dist/agent/ScatterChart.md +27 -2
  70. package/dist/agent/ScrollArea.md +24 -3
  71. package/dist/agent/SearchableMenu.md +23 -1
  72. package/dist/agent/Select.md +29 -3
  73. package/dist/agent/Separator.md +28 -4
  74. package/dist/agent/SequenceFigure.md +50 -0
  75. package/dist/agent/Sheet.md +25 -2
  76. package/dist/agent/Skeleton.md +24 -2
  77. package/dist/agent/Slider.md +27 -4
  78. package/dist/agent/Sparkline.md +23 -1
  79. package/dist/agent/Spinner.md +24 -2
  80. package/dist/agent/StatusDot.md +20 -1
  81. package/dist/agent/StatusPill.md +28 -2
  82. package/dist/agent/Steps.md +24 -1
  83. package/dist/agent/Switch.md +21 -1
  84. package/dist/agent/Table.md +26 -3
  85. package/dist/agent/Tabs.md +24 -2
  86. package/dist/agent/Tag.md +40 -9
  87. package/dist/agent/Text.md +65 -0
  88. package/dist/agent/Textarea.md +20 -1
  89. package/dist/agent/Timestamp.md +64 -0
  90. package/dist/agent/Toast.md +26 -2
  91. package/dist/agent/ToggleGroup.md +24 -2
  92. package/dist/agent/Toolbar.md +71 -0
  93. package/dist/agent/Tooltip.md +23 -1
  94. package/dist/agent/TreemapChart.md +24 -1
  95. package/dist/agent/WaterfallChart.md +24 -1
  96. package/dist/agent/WorkflowFigure.md +50 -0
  97. package/dist/agent/catalog.json +6086 -1009
  98. package/dist/agent/index.md +27 -4
  99. package/dist/article.css +16 -4
  100. package/dist/charts/AreaChart/AreaChart.d.ts +9 -2
  101. package/dist/charts/AreaChart/AreaChart.js +12 -13
  102. package/dist/charts/AreaChart/AreaChart.js.map +1 -1
  103. package/dist/charts/BarChart/BarChart.d.ts +14 -3
  104. package/dist/charts/BarChart/BarChart.js +20 -12
  105. package/dist/charts/BarChart/BarChart.js.map +1 -1
  106. package/dist/charts/BarList/BarList.d.ts +9 -1
  107. package/dist/charts/BarList/BarList.js +9 -1
  108. package/dist/charts/BarList/BarList.js.map +1 -1
  109. package/dist/charts/BigNumber/BigNumber.d.ts +19 -3
  110. package/dist/charts/BigNumber/BigNumber.js +25 -5
  111. package/dist/charts/BigNumber/BigNumber.js.map +1 -1
  112. package/dist/charts/BoxPlot/BoxPlot.js +4 -2
  113. package/dist/charts/BoxPlot/BoxPlot.js.map +1 -1
  114. package/dist/charts/BulletChart/BulletChart.js +28 -7
  115. package/dist/charts/BulletChart/BulletChart.js.map +1 -1
  116. package/dist/charts/ComposedChart/ComposedChart.d.ts +9 -2
  117. package/dist/charts/ComposedChart/ComposedChart.js +10 -10
  118. package/dist/charts/ComposedChart/ComposedChart.js.map +1 -1
  119. package/dist/charts/FunnelChart/FunnelChart.d.ts +7 -2
  120. package/dist/charts/FunnelChart/FunnelChart.js +6 -16
  121. package/dist/charts/FunnelChart/FunnelChart.js.map +1 -1
  122. package/dist/charts/Heatmap/Heatmap.d.ts +17 -3
  123. package/dist/charts/Heatmap/Heatmap.js +20 -11
  124. package/dist/charts/Heatmap/Heatmap.js.map +1 -1
  125. package/dist/charts/Histogram/Histogram.d.ts +24 -1
  126. package/dist/charts/Histogram/Histogram.js +43 -11
  127. package/dist/charts/Histogram/Histogram.js.map +1 -1
  128. package/dist/charts/LineChart/LineChart.d.ts +9 -2
  129. package/dist/charts/LineChart/LineChart.js +11 -12
  130. package/dist/charts/LineChart/LineChart.js.map +1 -1
  131. package/dist/charts/PieChart/PieChart.d.ts +15 -3
  132. package/dist/charts/PieChart/PieChart.js +14 -6
  133. package/dist/charts/PieChart/PieChart.js.map +1 -1
  134. package/dist/charts/RadarChart/RadarChart.d.ts +15 -3
  135. package/dist/charts/RadarChart/RadarChart.js +11 -9
  136. package/dist/charts/RadarChart/RadarChart.js.map +1 -1
  137. package/dist/charts/RadialChart/RadialChart.d.ts +22 -4
  138. package/dist/charts/RadialChart/RadialChart.js +28 -6
  139. package/dist/charts/RadialChart/RadialChart.js.map +1 -1
  140. package/dist/charts/SankeyChart/SankeyChart.d.ts +16 -4
  141. package/dist/charts/SankeyChart/SankeyChart.js +14 -6
  142. package/dist/charts/SankeyChart/SankeyChart.js.map +1 -1
  143. package/dist/charts/ScatterChart/ScatterChart.d.ts +24 -3
  144. package/dist/charts/ScatterChart/ScatterChart.js +21 -15
  145. package/dist/charts/ScatterChart/ScatterChart.js.map +1 -1
  146. package/dist/charts/Sparkline/Sparkline.js +5 -3
  147. package/dist/charts/Sparkline/Sparkline.js.map +1 -1
  148. package/dist/charts/TreemapChart/TreemapChart.d.ts +7 -2
  149. package/dist/charts/TreemapChart/TreemapChart.js +20 -11
  150. package/dist/charts/TreemapChart/TreemapChart.js.map +1 -1
  151. package/dist/charts/WaterfallChart/WaterfallChart.js +4 -2
  152. package/dist/charts/WaterfallChart/WaterfallChart.js.map +1 -1
  153. package/dist/charts/index.d.ts +2 -1
  154. package/dist/charts/lib/export.d.ts +34 -43
  155. package/dist/charts/lib/export.js +16 -158
  156. package/dist/charts/lib/export.js.map +1 -1
  157. package/dist/charts/lib/figure.d.ts +21 -1
  158. package/dist/charts/lib/figure.js +5 -2
  159. package/dist/charts/lib/figure.js.map +1 -1
  160. package/dist/charts/lib/scale.d.ts +23 -0
  161. package/dist/charts/lib/scale.js +13 -0
  162. package/dist/charts/lib/scale.js.map +1 -0
  163. package/dist/charts/lib/selection.d.ts +20 -0
  164. package/dist/charts/lib/selection.js +18 -0
  165. package/dist/charts/lib/selection.js.map +1 -0
  166. package/dist/charts/lib/toolbar.d.ts +1 -0
  167. package/dist/components/Accordion/Accordion.js +8 -1
  168. package/dist/components/Accordion/Accordion.js.map +1 -1
  169. package/dist/components/AppShell/AppShell.d.ts +6 -0
  170. package/dist/components/AppShell/AppShell.js +34 -4
  171. package/dist/components/AppShell/AppShell.js.map +1 -1
  172. package/dist/components/Article/Article.d.ts +11 -4
  173. package/dist/components/Article/Article.js +13 -0
  174. package/dist/components/Article/Article.js.map +1 -1
  175. package/dist/components/AspectRatio/AspectRatio.d.ts +46 -0
  176. package/dist/components/AspectRatio/AspectRatio.js +33 -0
  177. package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
  178. package/dist/components/Avatar/Avatar.d.ts +12 -3
  179. package/dist/components/Avatar/Avatar.js +6 -1
  180. package/dist/components/Avatar/Avatar.js.map +1 -1
  181. package/dist/components/Breadcrumb/Breadcrumb.d.ts +6 -0
  182. package/dist/components/Breadcrumb/Breadcrumb.js +15 -0
  183. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  184. package/dist/components/Button/Button.js +14 -0
  185. package/dist/components/Button/Button.js.map +1 -1
  186. package/dist/components/Calendar/Calendar.d.ts +29 -3
  187. package/dist/components/Calendar/Calendar.js +60 -12
  188. package/dist/components/Calendar/Calendar.js.map +1 -1
  189. package/dist/components/Card/Card.d.ts +6 -0
  190. package/dist/components/Card/Card.js +1 -1
  191. package/dist/components/Card/Card.js.map +1 -1
  192. package/dist/components/Checkbox/Checkbox.d.ts +5 -2
  193. package/dist/components/Checkbox/Checkbox.js +12 -2
  194. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  195. package/dist/components/Code/Code.d.ts +30 -0
  196. package/dist/components/Code/Code.js +21 -0
  197. package/dist/components/Code/Code.js.map +1 -0
  198. package/dist/components/CodeBlock/CodeBlock.d.ts +141 -0
  199. package/dist/components/CodeBlock/CodeBlock.js +123 -0
  200. package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
  201. package/dist/components/Collapsible/Collapsible.js +10 -2
  202. package/dist/components/Collapsible/Collapsible.js.map +1 -1
  203. package/dist/components/Combobox/Combobox.d.ts +15 -1
  204. package/dist/components/Combobox/Combobox.js +25 -5
  205. package/dist/components/Combobox/Combobox.js.map +1 -1
  206. package/dist/components/Command/Command.d.ts +4 -2
  207. package/dist/components/Command/Command.js +13 -1
  208. package/dist/components/Command/Command.js.map +1 -1
  209. package/dist/components/ContextMenu/ContextMenu.d.ts +30 -5
  210. package/dist/components/ContextMenu/ContextMenu.js +32 -2
  211. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  212. package/dist/components/DatePicker/DatePicker.d.ts +36 -4
  213. package/dist/components/DatePicker/DatePicker.js +55 -12
  214. package/dist/components/DatePicker/DatePicker.js.map +1 -1
  215. package/dist/components/DescriptionList/DescriptionList.d.ts +73 -0
  216. package/dist/components/DescriptionList/DescriptionList.js +35 -0
  217. package/dist/components/DescriptionList/DescriptionList.js.map +1 -0
  218. package/dist/components/Diagram/Diagram.d.ts +8 -3
  219. package/dist/components/Diagram/Diagram.js +82 -10
  220. package/dist/components/Diagram/Diagram.js.map +1 -1
  221. package/dist/components/Dialog/Dialog.d.ts +18 -3
  222. package/dist/components/Dialog/Dialog.js +20 -2
  223. package/dist/components/Dialog/Dialog.js.map +1 -1
  224. package/dist/components/DropdownMenu/DropdownMenu.d.ts +49 -11
  225. package/dist/components/DropdownMenu/DropdownMenu.js +32 -2
  226. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  227. package/dist/components/EmptyState/EmptyState.d.ts +25 -1
  228. package/dist/components/EmptyState/EmptyState.js +3 -1
  229. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  230. package/dist/components/ErrorState/ErrorState.d.ts +22 -1
  231. package/dist/components/ErrorState/ErrorState.js +11 -2
  232. package/dist/components/ErrorState/ErrorState.js.map +1 -1
  233. package/dist/components/Field/Field.d.ts +70 -3
  234. package/dist/components/Field/Field.js +53 -12
  235. package/dist/components/Field/Field.js.map +1 -1
  236. package/dist/components/Field/field-control.d.ts +31 -0
  237. package/dist/components/Field/field-control.js +12 -0
  238. package/dist/components/Field/field-control.js.map +1 -0
  239. package/dist/components/FloatingIconButton/FloatingIconButton.js +2 -0
  240. package/dist/components/FloatingIconButton/FloatingIconButton.js.map +1 -1
  241. package/dist/components/Heading/Heading.d.ts +62 -0
  242. package/dist/components/Heading/Heading.js +44 -0
  243. package/dist/components/Heading/Heading.js.map +1 -0
  244. package/dist/components/Markdown/Markdown.d.ts +139 -0
  245. package/dist/components/Markdown/Markdown.js +135 -0
  246. package/dist/components/Markdown/Markdown.js.map +1 -0
  247. package/dist/components/Markdown/inline.d.ts +29 -0
  248. package/dist/components/Markdown/inline.js +74 -0
  249. package/dist/components/Markdown/inline.js.map +1 -0
  250. package/dist/components/Markdown/nodes.d.ts +65 -0
  251. package/dist/components/Markdown/nodes.js +1 -0
  252. package/dist/components/Markdown/nodes.js.map +1 -0
  253. package/dist/components/Markdown/parse.d.ts +24 -0
  254. package/dist/components/Markdown/parse.js +110 -0
  255. package/dist/components/Markdown/parse.js.map +1 -0
  256. package/dist/components/Markdown/slug.d.ts +15 -0
  257. package/dist/components/Markdown/slug.js +7 -0
  258. package/dist/components/Markdown/slug.js.map +1 -0
  259. package/dist/components/NativeSelect/NativeSelect.d.ts +6 -0
  260. package/dist/components/NativeSelect/NativeSelect.js +2 -3
  261. package/dist/components/NativeSelect/NativeSelect.js.map +1 -1
  262. package/dist/components/Pagination/Pagination.d.ts +24 -1
  263. package/dist/components/Pagination/Pagination.js +6 -3
  264. package/dist/components/Pagination/Pagination.js.map +1 -1
  265. package/dist/components/Progress/Progress.d.ts +17 -5
  266. package/dist/components/Progress/Progress.js +18 -6
  267. package/dist/components/Progress/Progress.js.map +1 -1
  268. package/dist/components/RadioGroup/RadioGroup.d.ts +6 -0
  269. package/dist/components/RadioGroup/RadioGroup.js +11 -1
  270. package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
  271. package/dist/components/ScrollArea/ScrollArea.d.ts +15 -0
  272. package/dist/components/ScrollArea/ScrollArea.js +2 -2
  273. package/dist/components/ScrollArea/ScrollArea.js.map +1 -1
  274. package/dist/components/SearchableMenu/SearchableMenu.d.ts +11 -2
  275. package/dist/components/SearchableMenu/SearchableMenu.js +24 -2
  276. package/dist/components/SearchableMenu/SearchableMenu.js.map +1 -1
  277. package/dist/components/Select/Select.d.ts +18 -2
  278. package/dist/components/Select/Select.js +20 -3
  279. package/dist/components/Select/Select.js.map +1 -1
  280. package/dist/components/Separator/Separator.d.ts +21 -3
  281. package/dist/components/Separator/Separator.js +9 -1
  282. package/dist/components/Separator/Separator.js.map +1 -1
  283. package/dist/components/Sheet/Sheet.d.ts +3 -0
  284. package/dist/components/Sheet/Sheet.js +11 -2
  285. package/dist/components/Sheet/Sheet.js.map +1 -1
  286. package/dist/components/Skeleton/Skeleton.d.ts +8 -1
  287. package/dist/components/Skeleton/Skeleton.js +1 -1
  288. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  289. package/dist/components/Slider/Slider.d.ts +21 -3
  290. package/dist/components/Slider/Slider.js +54 -27
  291. package/dist/components/Slider/Slider.js.map +1 -1
  292. package/dist/components/Spinner/Spinner.d.ts +8 -0
  293. package/dist/components/Spinner/Spinner.js +3 -2
  294. package/dist/components/Spinner/Spinner.js.map +1 -1
  295. package/dist/components/StatusPill/StatusPill.d.ts +5 -0
  296. package/dist/components/StatusPill/StatusPill.js +6 -0
  297. package/dist/components/StatusPill/StatusPill.js.map +1 -1
  298. package/dist/components/Table/Table.d.ts +6 -0
  299. package/dist/components/Table/Table.js +3 -1
  300. package/dist/components/Table/Table.js.map +1 -1
  301. package/dist/components/Tag/Tag.d.ts +68 -9
  302. package/dist/components/Tag/Tag.js +50 -10
  303. package/dist/components/Tag/Tag.js.map +1 -1
  304. package/dist/components/Text/Text.d.ts +62 -0
  305. package/dist/components/Text/Text.js +30 -0
  306. package/dist/components/Text/Text.js.map +1 -0
  307. package/dist/components/Timestamp/Timestamp.d.ts +59 -0
  308. package/dist/components/Timestamp/Timestamp.js +56 -0
  309. package/dist/components/Timestamp/Timestamp.js.map +1 -0
  310. package/dist/components/Toast/Toast.d.ts +9 -1
  311. package/dist/components/Toast/Toast.js +27 -4
  312. package/dist/components/Toast/Toast.js.map +1 -1
  313. package/dist/components/ToggleGroup/ToggleGroup.d.ts +6 -1
  314. package/dist/components/ToggleGroup/ToggleGroup.js +11 -1
  315. package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
  316. package/dist/components/Toolbar/Toolbar.d.ts +55 -0
  317. package/dist/components/Toolbar/Toolbar.js +43 -0
  318. package/dist/components/Toolbar/Toolbar.js.map +1 -0
  319. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.d.ts +55 -0
  320. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js +175 -0
  321. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js.map +1 -0
  322. package/dist/diagrams/DataflowFigure/DataflowFigure.d.ts +28 -0
  323. package/dist/diagrams/DataflowFigure/DataflowFigure.js +148 -0
  324. package/dist/diagrams/DataflowFigure/DataflowFigure.js.map +1 -0
  325. package/dist/diagrams/DiagramCanvas/DiagramCanvas.d.ts +78 -0
  326. package/dist/diagrams/DiagramCanvas/DiagramCanvas.js +229 -0
  327. package/dist/diagrams/DiagramCanvas/DiagramCanvas.js.map +1 -0
  328. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.d.ts +106 -0
  329. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js +123 -0
  330. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js.map +1 -0
  331. package/dist/diagrams/DiagramInspector/DiagramInspector.d.ts +70 -0
  332. package/dist/diagrams/DiagramInspector/DiagramInspector.js +94 -0
  333. package/dist/diagrams/DiagramInspector/DiagramInspector.js.map +1 -0
  334. package/dist/diagrams/DiagramLegend/DiagramLegend.d.ts +42 -0
  335. package/dist/diagrams/DiagramLegend/DiagramLegend.js +35 -0
  336. package/dist/diagrams/DiagramLegend/DiagramLegend.js.map +1 -0
  337. package/dist/diagrams/DiagramMinimap/DiagramMinimap.d.ts +77 -0
  338. package/dist/diagrams/DiagramMinimap/DiagramMinimap.js +106 -0
  339. package/dist/diagrams/DiagramMinimap/DiagramMinimap.js.map +1 -0
  340. package/dist/diagrams/DiagramToolbar/DiagramToolbar.d.ts +48 -0
  341. package/dist/diagrams/DiagramToolbar/DiagramToolbar.js +53 -0
  342. package/dist/diagrams/DiagramToolbar/DiagramToolbar.js.map +1 -0
  343. package/dist/diagrams/LifecycleFigure/LifecycleFigure.d.ts +31 -0
  344. package/dist/diagrams/LifecycleFigure/LifecycleFigure.js +234 -0
  345. package/dist/diagrams/LifecycleFigure/LifecycleFigure.js.map +1 -0
  346. package/dist/diagrams/SequenceFigure/SequenceFigure.d.ts +38 -0
  347. package/dist/diagrams/SequenceFigure/SequenceFigure.js +261 -0
  348. package/dist/diagrams/SequenceFigure/SequenceFigure.js.map +1 -0
  349. package/dist/diagrams/WorkflowFigure/WorkflowFigure.d.ts +36 -0
  350. package/dist/diagrams/WorkflowFigure/WorkflowFigure.js +259 -0
  351. package/dist/diagrams/WorkflowFigure/WorkflowFigure.js.map +1 -0
  352. package/dist/diagrams/index.d.ts +17 -0
  353. package/dist/diagrams/index.js +29 -0
  354. package/dist/diagrams/index.js.map +1 -0
  355. package/dist/diagrams/lib/dev.d.ts +61 -0
  356. package/dist/diagrams/lib/dev.js +96 -0
  357. package/dist/diagrams/lib/dev.js.map +1 -0
  358. package/dist/diagrams/lib/frame.d.ts +138 -0
  359. package/dist/diagrams/lib/frame.js +131 -0
  360. package/dist/diagrams/lib/frame.js.map +1 -0
  361. package/dist/diagrams/lib/geometry.d.ts +114 -0
  362. package/dist/diagrams/lib/geometry.js +113 -0
  363. package/dist/diagrams/lib/geometry.js.map +1 -0
  364. package/dist/diagrams/lib/legend.d.ts +32 -0
  365. package/dist/diagrams/lib/legend.js +84 -0
  366. package/dist/diagrams/lib/legend.js.map +1 -0
  367. package/dist/diagrams/lib/marks.d.ts +207 -0
  368. package/dist/diagrams/lib/marks.js +480 -0
  369. package/dist/diagrams/lib/marks.js.map +1 -0
  370. package/dist/diagrams/lib/route.d.ts +85 -0
  371. package/dist/diagrams/lib/route.js +178 -0
  372. package/dist/diagrams/lib/route.js.map +1 -0
  373. package/dist/diagrams/lib/wires.d.ts +59 -0
  374. package/dist/diagrams/lib/wires.js +90 -0
  375. package/dist/diagrams/lib/wires.js.map +1 -0
  376. package/dist/diagrams/spec.d.ts +405 -0
  377. package/dist/diagrams/spec.js +1 -0
  378. package/dist/diagrams/spec.js.map +1 -0
  379. package/dist/index.d.ts +16 -4
  380. package/dist/index.js +9 -0
  381. package/dist/index.js.map +1 -1
  382. package/dist/keyframes.css +57 -3
  383. package/dist/lib/overlay-container.d.ts +14 -4
  384. package/dist/lib/overlay-container.js.map +1 -1
  385. package/dist/lib/svg-export.d.ts +138 -0
  386. package/dist/lib/svg-export.js +198 -0
  387. package/dist/lib/svg-export.js.map +1 -0
  388. package/dist/lib/warn.d.ts +73 -0
  389. package/dist/lib/warn.js +38 -0
  390. package/dist/lib/warn.js.map +1 -0
  391. package/dist/semantic.css +51 -6
  392. package/dist/styles.css +1 -1
  393. package/dist/tokens.css +20 -2
  394. package/dist/tokens.d.ts +17 -1
  395. package/dist/tokens.js +121 -36
  396. package/dist/tokens.json +121 -36
  397. package/llms.txt +35 -0
  398. package/package.json +9 -2
  399. package/skills/misoto22-design/SKILL.md +21 -7
  400. package/skills/misoto22-design/evals/evals.json +84 -0
  401. package/skills/misoto22-design/rules/a11y.md +55 -3
  402. package/skills/misoto22-design/rules/forms.md +5 -0
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { X } from "lucide-react";
4
+ import { cn } from "../../lib/cn.js";
5
+ function DiagramInspector({
6
+ eyebrow,
7
+ title,
8
+ description,
9
+ facts = [],
10
+ links = [],
11
+ actions,
12
+ onClose,
13
+ className,
14
+ floating
15
+ }) {
16
+ return /* @__PURE__ */ jsxs(
17
+ "section",
18
+ {
19
+ "aria-label": `${title} details`,
20
+ "aria-live": "polite",
21
+ className: cn(
22
+ "flex flex-col gap-3 rounded-(--radius-lg) border border-(--rule-2) bg-(--panel-bg) p-4",
23
+ floating && "absolute bottom-3 start-3 z-(--z-sticky) w-72 max-w-[calc(100%-1.5rem)]",
24
+ className
25
+ ),
26
+ children: [
27
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
28
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
29
+ eyebrow && /* @__PURE__ */ jsx("span", { className: "eyebrow text-(--ink-3-aa)", children: eyebrow }),
30
+ /* @__PURE__ */ jsx("h3", { className: "m-0 font-sans text-[15px] leading-tight font-normal text-(--ink)", children: title })
31
+ ] }),
32
+ onClose && /* @__PURE__ */ jsx(
33
+ "button",
34
+ {
35
+ type: "button",
36
+ onClick: onClose,
37
+ "aria-label": "Clear the selection",
38
+ className: "-me-1 -mt-1 flex size-7 shrink-0 items-center justify-center rounded-(--radius-xs) text-(--ink-3-aa) transition-colors duration-(--duration-fast) hover:bg-(--stone) hover:text-(--ink) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--ring)",
39
+ children: /* @__PURE__ */ jsx(X, { size: 14, strokeWidth: 1.5, "aria-hidden": true })
40
+ }
41
+ )
42
+ ] }),
43
+ description && /* @__PURE__ */ jsx("p", { className: "m-0 text-[13px] leading-[1.55] text-(--ink-2)", children: description }),
44
+ facts.length > 0 && // A definition list, because that is what this is: each row is a term
45
+ // and its value, and a grid of divs tells a screen reader nothing about
46
+ // which value belongs to which label.
47
+ /* @__PURE__ */ jsx("dl", { className: "m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5", children: facts.map((fact, index) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
48
+ /* @__PURE__ */ jsx("dt", { className: "mono-meta text-(--ink-3-aa)", children: fact.label }),
49
+ /* @__PURE__ */ jsx(
50
+ "dd",
51
+ {
52
+ className: cn(
53
+ "m-0 min-w-0 break-words text-[13px] leading-snug text-(--ink)",
54
+ fact.mono && "font-mono text-[12px]"
55
+ ),
56
+ children: fact.value
57
+ }
58
+ )
59
+ ] }, index)) }),
60
+ links.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 border-t border-(--rule) pt-3", children: [
61
+ /* @__PURE__ */ jsx("span", { className: "eyebrow text-(--ink-3-aa)", children: "Relationships" }),
62
+ /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col gap-0.5 p-0", children: links.map((link, index) => {
63
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
64
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "font-mono text-[12px] text-(--ink-3-aa)", children: link.direction === "out" ? "\u2192" : "\u2190" }),
65
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: link.direction === "out" ? "to" : "from" }),
66
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-[13px] text-(--ink)", children: link.peer }),
67
+ link.label && /* @__PURE__ */ jsx("span", { className: "mono-meta shrink-0 text-(--ink-3-aa)", children: link.label })
68
+ ] });
69
+ const row = "flex w-full items-baseline gap-2 rounded-(--radius-xs) px-1 py-1 text-start";
70
+ return /* @__PURE__ */ jsx("li", { children: link.onSelect ? /* @__PURE__ */ jsx(
71
+ "button",
72
+ {
73
+ type: "button",
74
+ onClick: link.onSelect,
75
+ className: cn(
76
+ row,
77
+ "transition-colors duration-(--duration-fast) hover:bg-(--stone) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--ring)"
78
+ ),
79
+ children: body
80
+ }
81
+ ) : /* @__PURE__ */ jsx("span", { className: row, children: body }) }, link.id ?? index);
82
+ }) })
83
+ ] }),
84
+ actions && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 pt-1", children: actions })
85
+ ]
86
+ }
87
+ );
88
+ }
89
+ var DiagramInspector_default = DiagramInspector;
90
+ export {
91
+ DiagramInspector,
92
+ DiagramInspector_default as default
93
+ };
94
+ //# sourceMappingURL=DiagramInspector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/DiagramInspector/DiagramInspector.tsx"],"sourcesContent":["'use client'\n\nimport type { ReactNode } from 'react'\nimport { X } from 'lucide-react'\nimport { cn } from '../../lib/cn'\n\n/** One fact about the selected thing: a short label and its value. */\nexport interface InspectorFact {\n label: string\n value: ReactNode\n /** Sets the value in mono — an id, a path, a version, a port. */\n mono?: boolean\n}\n\n/** A relationship the selected thing takes part in. */\nexport interface InspectorLink {\n id?: string\n /** Which way it runs, relative to the selected node. */\n direction: 'in' | 'out'\n label: string\n /** What sits at the other end. */\n peer: string\n onSelect?: () => void\n}\n\nexport interface DiagramInspectorProps {\n /** The kicker over the title — what KIND of thing this panel is showing. */\n eyebrow?: string\n title: string\n description?: ReactNode\n facts?: InspectorFact[]\n links?: InspectorLink[]\n /** Buttons under the facts — copy a link, open the source. */\n actions?: ReactNode\n onClose?: () => void\n className?: string\n /** Renders as a floating panel over the surface rather than in the flow. */\n floating?: boolean\n}\n\n/**\n * What the reader just picked, written out.\n *\n * A diagram can hold about eight words per node before it stops being a diagram\n * and starts being a document with lines drawn on it. Everything past those\n * eight — the port, the owning team, the file it was read out of, the six\n * relationships it takes part in — belongs beside the picture rather than\n * inside it, and this is that place.\n *\n * NOT A DIALOG, and that is deliberate. An inspector is a REGION that changes\n * with the selection, not a modal. Giving it `role=\"dialog\"` would trap focus\n * and demand dismissal for something the reader never opened — they clicked a\n * node, and the panel followed. So it is a labelled region with\n * `aria-live=\"polite\"`, which is what makes a screen reader announce the new\n * selection without stealing the cursor from whatever the reader was doing.\n *\n * The relationships are real buttons when they carry `onSelect`, which is how\n * the diagram becomes navigable from the keyboard: a reader can walk the graph\n * peer by peer without ever touching the picture.\n *\n * @example\n * <DiagramInspector\n * eyebrow=\"Service\"\n * title=\"API Server\"\n * description=\"FastAPI, behind the load balancer.\"\n * facts={[\n * { label: 'Port', value: '8000', mono: true },\n * { label: 'Id', value: 'api', mono: true },\n * ]}\n * links={[{ direction: 'out', label: 'SQL', peer: 'PostgreSQL' }]}\n * onClose={() => setSelected(null)}\n * />\n */\nexport function DiagramInspector({\n eyebrow,\n title,\n description,\n facts = [],\n links = [],\n actions,\n onClose,\n className,\n floating,\n}: DiagramInspectorProps) {\n return (\n <section\n aria-label={`${title} details`}\n aria-live=\"polite\"\n className={cn(\n 'flex flex-col gap-3 rounded-(--radius-lg) border border-(--rule-2) bg-(--panel-bg) p-4',\n floating && 'absolute bottom-3 start-3 z-(--z-sticky) w-72 max-w-[calc(100%-1.5rem)]',\n className,\n )}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col gap-1\">\n {eyebrow && <span className=\"eyebrow text-(--ink-3-aa)\">{eyebrow}</span>}\n <h3 className=\"m-0 font-sans text-[15px] leading-tight font-normal text-(--ink)\">\n {title}\n </h3>\n </div>\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Clear the selection\"\n className=\"-me-1 -mt-1 flex size-7 shrink-0 items-center justify-center rounded-(--radius-xs) text-(--ink-3-aa) transition-colors duration-(--duration-fast) hover:bg-(--stone) hover:text-(--ink) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--ring)\"\n >\n <X size={14} strokeWidth={1.5} aria-hidden />\n </button>\n )}\n </div>\n\n {description && (\n <p className=\"m-0 text-[13px] leading-[1.55] text-(--ink-2)\">{description}</p>\n )}\n\n {facts.length > 0 && (\n // A definition list, because that is what this is: each row is a term\n // and its value, and a grid of divs tells a screen reader nothing about\n // which value belongs to which label.\n <dl className=\"m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5\">\n {/* Keyed by position, not by the label: two rows named \"Source\" is a\n specification a caller is entitled to write — a node read out of\n two files — and keying by the label made the second one collide\n with the first rather than appear under it. */}\n {facts.map((fact, index) => (\n <div key={index} className=\"contents\">\n <dt className=\"mono-meta text-(--ink-3-aa)\">{fact.label}</dt>\n <dd\n className={cn(\n 'm-0 min-w-0 break-words text-[13px] leading-snug text-(--ink)',\n fact.mono && 'font-mono text-[12px]',\n )}\n >\n {fact.value}\n </dd>\n </div>\n ))}\n </dl>\n )}\n\n {links.length > 0 && (\n <div className=\"flex flex-col gap-1 border-t border-(--rule) pt-3\">\n <span className=\"eyebrow text-(--ink-3-aa)\">Relationships</span>\n <ul className=\"m-0 flex list-none flex-col gap-0.5 p-0\">\n {links.map((link, index) => {\n const body = (\n <>\n {/* The arrow is hidden from assistive tech and the direction\n spelled out instead: a screen reader reading \"→\" aloud is\n either silence or the word \"arrow\", and neither says which\n way the relationship runs. */}\n <span aria-hidden className=\"font-mono text-[12px] text-(--ink-3-aa)\">\n {link.direction === 'out' ? '→' : '←'}\n </span>\n <span className=\"sr-only\">\n {link.direction === 'out' ? 'to' : 'from'}\n </span>\n <span className=\"min-w-0 flex-1 truncate text-[13px] text-(--ink)\">\n {link.peer}\n </span>\n {link.label && (\n <span className=\"mono-meta shrink-0 text-(--ink-3-aa)\">{link.label}</span>\n )}\n </>\n )\n\n const row = 'flex w-full items-baseline gap-2 rounded-(--radius-xs) px-1 py-1 text-start'\n\n return (\n <li key={link.id ?? index}>\n {link.onSelect ? (\n <button\n type=\"button\"\n onClick={link.onSelect}\n className={cn(\n row,\n 'transition-colors duration-(--duration-fast) hover:bg-(--stone) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--ring)',\n )}\n >\n {body}\n </button>\n ) : (\n <span className={row}>{body}</span>\n )}\n </li>\n )\n })}\n </ul>\n </div>\n )}\n\n {actions && <div className=\"flex flex-wrap items-center gap-2 pt-1\">{actions}</div>}\n </section>\n )\n}\n\nexport default DiagramInspector\n"],"mappings":";AA+FQ,SAqDQ,UApDM,KADd;AA5FR,SAAS,SAAS;AAClB,SAAS,UAAU;AAqEZ,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,cAAY,GAAG,KAAK;AAAA,MACpB,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,WAAU,0CACb;AAAA,+BAAC,SAAI,WAAU,+BACZ;AAAA,uBAAW,oBAAC,UAAK,WAAU,6BAA6B,mBAAQ;AAAA,YACjE,oBAAC,QAAG,WAAU,oEACX,iBACH;AAAA,aACF;AAAA,UACC,WACC;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS;AAAA,cACT,cAAW;AAAA,cACX,WAAU;AAAA,cAEV,8BAAC,KAAE,MAAM,IAAI,aAAa,KAAK,eAAW,MAAC;AAAA;AAAA,UAC7C;AAAA,WAEJ;AAAA,QAEC,eACC,oBAAC,OAAE,WAAU,iDAAiD,uBAAY;AAAA,QAG3E,MAAM,SAAS;AAAA;AAAA;AAAA,QAId,oBAAC,QAAG,WAAU,mDAKX,gBAAM,IAAI,CAAC,MAAM,UAChB,qBAAC,SAAgB,WAAU,YACzB;AAAA,8BAAC,QAAG,WAAU,+BAA+B,eAAK,OAAM;AAAA,UACxD;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA,KAAK,QAAQ;AAAA,cACf;AAAA,cAEC,eAAK;AAAA;AAAA,UACR;AAAA,aATQ,KAUV,CACD,GACH;AAAA,QAGD,MAAM,SAAS,KACd,qBAAC,SAAI,WAAU,qDACb;AAAA,8BAAC,UAAK,WAAU,6BAA4B,2BAAa;AAAA,UACzD,oBAAC,QAAG,WAAU,2CACX,gBAAM,IAAI,CAAC,MAAM,UAAU;AAC1B,kBAAM,OACJ,iCAKE;AAAA,kCAAC,UAAK,eAAW,MAAC,WAAU,2CACzB,eAAK,cAAc,QAAQ,WAAM,UACpC;AAAA,cACA,oBAAC,UAAK,WAAU,WACb,eAAK,cAAc,QAAQ,OAAO,QACrC;AAAA,cACA,oBAAC,UAAK,WAAU,oDACb,eAAK,MACR;AAAA,cACC,KAAK,SACJ,oBAAC,UAAK,WAAU,wCAAwC,eAAK,OAAM;AAAA,eAEvE;AAGF,kBAAM,MAAM;AAEZ,mBACE,oBAAC,QACE,eAAK,WACJ;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,KAAK;AAAA,gBACd,WAAW;AAAA,kBACT;AAAA,kBACA;AAAA,gBACF;AAAA,gBAEC;AAAA;AAAA,YACH,IAEA,oBAAC,UAAK,WAAW,KAAM,gBAAK,KAbvB,KAAK,MAAM,KAepB;AAAA,UAEJ,CAAC,GACH;AAAA,WACF;AAAA,QAGD,WAAW,oBAAC,SAAI,WAAU,0CAA0C,mBAAQ;AAAA;AAAA;AAAA,EAC/E;AAEJ;AAEA,IAAO,2BAAQ;","names":[]}
@@ -0,0 +1,42 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface DiagramLegendEntry {
5
+ /** Stable key, and what a caller keys its own data by. */
6
+ key: string;
7
+ label: string;
8
+ /**
9
+ * The drawn mark, as SVG children on a 14 × 14 grid.
10
+ *
11
+ * Markup rather than a name from a fixed list, because the whole point of a
12
+ * key is that it shows the SAME mark the figure drew — and a figure that
13
+ * invented a new one would have to add it here too. `kindLegend`,
14
+ * `variantLegend` and `stateLegend` build the standard sets out of the
15
+ * renderers' own drawing code, so those can never drift.
16
+ */
17
+ sample: ReactNode;
18
+ }
19
+ interface DiagramLegendProps {
20
+ entries: DiagramLegendEntry[];
21
+ /** The kicker before the row. Pass null for a bare row. */
22
+ title?: string | null;
23
+ className?: string;
24
+ }
25
+ /**
26
+ * The key: which drawn form means which kind of thing.
27
+ *
28
+ * Not optional furniture in a monochrome system, and this is the one place that
29
+ * has to be said plainly. When the difference between a queue and a cache is a
30
+ * sigil rather than a colour, the key is the only place a reader is told what
31
+ * the sigil means — a figure whose forms are undocumented is a figure whose
32
+ * forms might as well not have been drawn.
33
+ *
34
+ * A `<ul>` rather than a row of `<span>`s: it is a list of pairs, and the count
35
+ * is part of what a screen reader should say about it.
36
+ *
37
+ * @example
38
+ * <DiagramLegend entries={kindLegend(['backend', 'database'])} />
39
+ */
40
+ declare function DiagramLegend({ entries, title, className }: DiagramLegendProps): react.JSX.Element | null;
41
+
42
+ export { DiagramLegend, type DiagramLegendEntry, type DiagramLegendProps, DiagramLegend as default };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../lib/cn.js";
4
+ function DiagramLegend({ entries, title = "Key", className }) {
5
+ if (entries.length === 0) return null;
6
+ return /* @__PURE__ */ jsxs(
7
+ "div",
8
+ {
9
+ className: cn(
10
+ "flex flex-wrap items-baseline gap-x-5 gap-y-2 border-t border-(--rule) pt-3",
11
+ className
12
+ ),
13
+ children: [
14
+ title && /* @__PURE__ */ jsx("span", { className: "eyebrow text-(--ink-3-aa)", children: title }),
15
+ /* @__PURE__ */ jsx(
16
+ "ul",
17
+ {
18
+ className: "m-0 flex list-none flex-wrap items-center gap-x-4 gap-y-2 p-0",
19
+ "aria-label": title ?? "Key",
20
+ children: entries.map((entry) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
21
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 14 14", className: "size-4 shrink-0", "aria-hidden": "true", children: entry.sample }),
22
+ /* @__PURE__ */ jsx("span", { className: "mono-meta text-(--ink-2)", children: entry.label })
23
+ ] }, entry.key))
24
+ }
25
+ )
26
+ ]
27
+ }
28
+ );
29
+ }
30
+ var DiagramLegend_default = DiagramLegend;
31
+ export {
32
+ DiagramLegend,
33
+ DiagramLegend_default as default
34
+ };
35
+ //# sourceMappingURL=DiagramLegend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/DiagramLegend/DiagramLegend.tsx"],"sourcesContent":["'use client'\n\nimport type { ReactNode } from 'react'\nimport { cn } from '../../lib/cn'\n\nexport interface DiagramLegendEntry {\n /** Stable key, and what a caller keys its own data by. */\n key: string\n label: string\n /**\n * The drawn mark, as SVG children on a 14 × 14 grid.\n *\n * Markup rather than a name from a fixed list, because the whole point of a\n * key is that it shows the SAME mark the figure drew — and a figure that\n * invented a new one would have to add it here too. `kindLegend`,\n * `variantLegend` and `stateLegend` build the standard sets out of the\n * renderers' own drawing code, so those can never drift.\n */\n sample: ReactNode\n}\n\nexport interface DiagramLegendProps {\n entries: DiagramLegendEntry[]\n /** The kicker before the row. Pass null for a bare row. */\n title?: string | null\n className?: string\n}\n\n/**\n * The key: which drawn form means which kind of thing.\n *\n * Not optional furniture in a monochrome system, and this is the one place that\n * has to be said plainly. When the difference between a queue and a cache is a\n * sigil rather than a colour, the key is the only place a reader is told what\n * the sigil means — a figure whose forms are undocumented is a figure whose\n * forms might as well not have been drawn.\n *\n * A `<ul>` rather than a row of `<span>`s: it is a list of pairs, and the count\n * is part of what a screen reader should say about it.\n *\n * @example\n * <DiagramLegend entries={kindLegend(['backend', 'database'])} />\n */\nexport function DiagramLegend({ entries, title = 'Key', className }: DiagramLegendProps) {\n if (entries.length === 0) return null\n\n return (\n <div\n className={cn(\n 'flex flex-wrap items-baseline gap-x-5 gap-y-2 border-t border-(--rule) pt-3',\n className,\n )}\n >\n {title && <span className=\"eyebrow text-(--ink-3-aa)\">{title}</span>}\n <ul\n className=\"m-0 flex list-none flex-wrap items-center gap-x-4 gap-y-2 p-0\"\n aria-label={title ?? 'Key'}\n >\n {entries.map((entry) => (\n <li key={entry.key} className=\"flex items-center gap-2\">\n <svg viewBox=\"0 0 14 14\" className=\"size-4 shrink-0\" aria-hidden=\"true\">\n {entry.sample}\n </svg>\n <span className=\"mono-meta text-(--ink-2)\">{entry.label}</span>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nexport default DiagramLegend\n"],"mappings":";AAqDgB,cAMN,YANM;AAlDhB,SAAS,UAAU;AAwCZ,SAAS,cAAc,EAAE,SAAS,QAAQ,OAAO,UAAU,GAAuB;AACvF,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA,iBAAS,oBAAC,UAAK,WAAU,6BAA6B,iBAAM;AAAA,QAC7D;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,cAAY,SAAS;AAAA,YAEpB,kBAAQ,IAAI,CAAC,UACZ,qBAAC,QAAmB,WAAU,2BAC5B;AAAA,kCAAC,SAAI,SAAQ,aAAY,WAAU,mBAAkB,eAAY,QAC9D,gBAAM,QACT;AAAA,cACA,oBAAC,UAAK,WAAU,4BAA4B,gBAAM,OAAM;AAAA,iBAJjD,MAAM,GAKf,CACD;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,wBAAQ;","names":[]}
@@ -0,0 +1,77 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { CanvasView } from '../DiagramCanvas/DiagramCanvas.js';
4
+
5
+ interface DiagramMinimapProps {
6
+ /** The whole artwork, at its natural size in CSS pixels. */
7
+ content: {
8
+ width: number;
9
+ height: number;
10
+ };
11
+ /**
12
+ * The frame the artwork is being looked at through, in CSS pixels.
13
+ *
14
+ * Optional because a `DiagramCanvas` now reports its own frame on every view
15
+ * it emits: wire `onViewChange` straight through and this is already right.
16
+ * Pass it only for a frame this component cannot be told about.
17
+ */
18
+ frame?: {
19
+ width: number;
20
+ height: number;
21
+ };
22
+ /** Where that frame currently sits — a `DiagramCanvas`'s `onViewChange`. */
23
+ view: CanvasView;
24
+ /** A miniature of the artwork. Usually the same figure, rendered again. */
25
+ children?: ReactNode;
26
+ /** Called with a point in CONTENT coordinates when the reader picks one. */
27
+ onSeek?: (x: number, y: number) => void;
28
+ /** How wide the map is, in CSS pixels. Height follows the aspect ratio. */
29
+ width?: number;
30
+ className?: string;
31
+ label?: string;
32
+ }
33
+ /**
34
+ * Where you are in something bigger than the window.
35
+ *
36
+ * Two things at once, and both are needed: a miniature of the whole artwork,
37
+ * and a rectangle showing which part of it the frame is currently over. The
38
+ * miniature alone answers "what is there"; the rectangle answers "and where am
39
+ * I", which is the question a reader who has just panned twice actually has.
40
+ *
41
+ * THE RECTANGLE IS DERIVED, never stored. Its position comes out of the
42
+ * canvas's own view — the same three numbers the canvas is already transforming
43
+ * by — divided by the map's scale, and clamped to the plate: a viewport that
44
+ * has been panned past the edge of the artwork is a viewport half over blank
45
+ * paper, and drawing the rectangle out there claims the map extends somewhere
46
+ * it does not. Keeping a second copy of "where the viewport is" is how a
47
+ * minimap comes to disagree with the thing it is a map of, and a map that
48
+ * disagrees is worse than none.
49
+ *
50
+ * NOTHING IS DRAWN UNTIL THE ARTWORK HAS A SIZE. `content` is usually a
51
+ * measurement, and a measurement's first value is zero — so the scale would be
52
+ * 1, the miniature would be the artwork's top-left corner at full size, and the
53
+ * rectangle would sit over it meaning nothing. An empty plate for one frame is
54
+ * the honest version of "not yet".
55
+ *
56
+ * CLICKING RECENTRES rather than jumping. `onSeek` reports a point in CONTENT
57
+ * coordinates, which is what a canvas's `centerOn` takes. The minimap does not
58
+ * move anything itself: it has no authority over the view, it only says where
59
+ * the reader pointed. A drag keeps seeking, and only a drag that STARTED on the
60
+ * map does — a button held down somewhere else and dragged across is not this
61
+ * component's gesture to answer.
62
+ *
63
+ * @example
64
+ * const canvas = useRef<DiagramCanvasHandle>(null)
65
+ * const [view, setView] = useState({ scale: 1, x: 0, y: 0 })
66
+ * // …
67
+ * <DiagramMinimap
68
+ * content={{ width: 1400, height: 620 }}
69
+ * view={view}
70
+ * onSeek={(x, y) => canvas.current?.centerOn(x, y)}
71
+ * >
72
+ * <ArchitectureFigure spec={spec} heading={false} legend="hidden" cards={false} />
73
+ * </DiagramMinimap>
74
+ */
75
+ declare function DiagramMinimap({ content, frame, view, children, onSeek, width, className, label, }: DiagramMinimapProps): react.JSX.Element;
76
+
77
+ export { DiagramMinimap, type DiagramMinimapProps, DiagramMinimap as default };
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { cn } from "../../lib/cn.js";
5
+ function DiagramMinimap({
6
+ content,
7
+ frame,
8
+ view,
9
+ children,
10
+ onSeek,
11
+ width = 200,
12
+ className,
13
+ label = "Diagram overview"
14
+ }) {
15
+ const dragging = useRef(false);
16
+ const measured = content.width > 0 && content.height > 0;
17
+ const scale = measured ? width / content.width : 0;
18
+ const height = measured ? Math.max(1, content.height * scale) : Math.round(width / 2);
19
+ const box = frame ?? view.frame;
20
+ const rect = measured && box ? clamp(box, view, scale, width, height) : null;
21
+ function seek(event) {
22
+ if (!onSeek || !measured) return;
23
+ const map = event.currentTarget.getBoundingClientRect();
24
+ onSeek((event.clientX - map.left) / scale, (event.clientY - map.top) / scale);
25
+ }
26
+ return /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ className: cn(
30
+ "relative overflow-hidden rounded-(--radius) border border-(--rule-2) bg-(--panel-bg)",
31
+ className
32
+ ),
33
+ style: { width, height },
34
+ role: "group",
35
+ "aria-label": label,
36
+ children: [
37
+ measured && /* @__PURE__ */ jsx(
38
+ "div",
39
+ {
40
+ "aria-hidden": "true",
41
+ className: "pointer-events-none absolute start-0 top-0 origin-top-left",
42
+ style: { width: content.width, transform: `scale(${scale})` },
43
+ children
44
+ }
45
+ ),
46
+ /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ "data-seek": "",
50
+ className: cn("absolute inset-0", onSeek && measured && "cursor-crosshair"),
51
+ onPointerDown: (event) => {
52
+ dragging.current = true;
53
+ event.currentTarget.setPointerCapture(event.pointerId);
54
+ seek(event);
55
+ },
56
+ onPointerMove: (event) => {
57
+ if (dragging.current && event.buttons === 1) seek(event);
58
+ },
59
+ onPointerUp: (event) => {
60
+ dragging.current = false;
61
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
62
+ event.currentTarget.releasePointerCapture(event.pointerId);
63
+ }
64
+ },
65
+ onPointerCancel: () => {
66
+ dragging.current = false;
67
+ },
68
+ children: rect && /* @__PURE__ */ jsx(
69
+ "div",
70
+ {
71
+ "aria-hidden": "true",
72
+ "data-viewport": "",
73
+ className: "absolute rounded-[2px] border border-(--accent) bg-(--accent-wash)",
74
+ style: {
75
+ left: `${rect.x}px`,
76
+ top: `${rect.y}px`,
77
+ width: `${rect.w}px`,
78
+ height: `${rect.h}px`
79
+ }
80
+ }
81
+ )
82
+ }
83
+ )
84
+ ]
85
+ }
86
+ );
87
+ }
88
+ function clamp(frame, view, scale, width, height) {
89
+ const x = -view.x / view.scale * scale;
90
+ const y = -view.y / view.scale * scale;
91
+ const left = Math.min(Math.max(x, 0), width);
92
+ const top = Math.min(Math.max(y, 0), height);
93
+ return {
94
+ x: left,
95
+ y: top,
96
+ // Floored at a few pixels so a deep zoom still leaves something to see.
97
+ w: Math.max(4, Math.min(x + frame.width / view.scale * scale, width) - left),
98
+ h: Math.max(4, Math.min(y + frame.height / view.scale * scale, height) - top)
99
+ };
100
+ }
101
+ var DiagramMinimap_default = DiagramMinimap;
102
+ export {
103
+ DiagramMinimap,
104
+ DiagramMinimap_default as default
105
+ };
106
+ //# sourceMappingURL=DiagramMinimap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/DiagramMinimap/DiagramMinimap.tsx"],"sourcesContent":["'use client'\n\nimport { useRef, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react'\nimport { cn } from '../../lib/cn'\nimport type { CanvasView } from '../DiagramCanvas/DiagramCanvas'\n\nexport interface DiagramMinimapProps {\n /** The whole artwork, at its natural size in CSS pixels. */\n content: { width: number; height: number }\n /**\n * The frame the artwork is being looked at through, in CSS pixels.\n *\n * Optional because a `DiagramCanvas` now reports its own frame on every view\n * it emits: wire `onViewChange` straight through and this is already right.\n * Pass it only for a frame this component cannot be told about.\n */\n frame?: { width: number; height: number }\n /** Where that frame currently sits — a `DiagramCanvas`'s `onViewChange`. */\n view: CanvasView\n /** A miniature of the artwork. Usually the same figure, rendered again. */\n children?: ReactNode\n /** Called with a point in CONTENT coordinates when the reader picks one. */\n onSeek?: (x: number, y: number) => void\n /** How wide the map is, in CSS pixels. Height follows the aspect ratio. */\n width?: number\n className?: string\n label?: string\n}\n\n/**\n * Where you are in something bigger than the window.\n *\n * Two things at once, and both are needed: a miniature of the whole artwork,\n * and a rectangle showing which part of it the frame is currently over. The\n * miniature alone answers \"what is there\"; the rectangle answers \"and where am\n * I\", which is the question a reader who has just panned twice actually has.\n *\n * THE RECTANGLE IS DERIVED, never stored. Its position comes out of the\n * canvas's own view — the same three numbers the canvas is already transforming\n * by — divided by the map's scale, and clamped to the plate: a viewport that\n * has been panned past the edge of the artwork is a viewport half over blank\n * paper, and drawing the rectangle out there claims the map extends somewhere\n * it does not. Keeping a second copy of \"where the viewport is\" is how a\n * minimap comes to disagree with the thing it is a map of, and a map that\n * disagrees is worse than none.\n *\n * NOTHING IS DRAWN UNTIL THE ARTWORK HAS A SIZE. `content` is usually a\n * measurement, and a measurement's first value is zero — so the scale would be\n * 1, the miniature would be the artwork's top-left corner at full size, and the\n * rectangle would sit over it meaning nothing. An empty plate for one frame is\n * the honest version of \"not yet\".\n *\n * CLICKING RECENTRES rather than jumping. `onSeek` reports a point in CONTENT\n * coordinates, which is what a canvas's `centerOn` takes. The minimap does not\n * move anything itself: it has no authority over the view, it only says where\n * the reader pointed. A drag keeps seeking, and only a drag that STARTED on the\n * map does — a button held down somewhere else and dragged across is not this\n * component's gesture to answer.\n *\n * @example\n * const canvas = useRef<DiagramCanvasHandle>(null)\n * const [view, setView] = useState({ scale: 1, x: 0, y: 0 })\n * // …\n * <DiagramMinimap\n * content={{ width: 1400, height: 620 }}\n * view={view}\n * onSeek={(x, y) => canvas.current?.centerOn(x, y)}\n * >\n * <ArchitectureFigure spec={spec} heading={false} legend=\"hidden\" cards={false} />\n * </DiagramMinimap>\n */\nexport function DiagramMinimap({\n content,\n frame,\n view,\n children,\n onSeek,\n width = 200,\n className,\n label = 'Diagram overview',\n}: DiagramMinimapProps) {\n const dragging = useRef(false)\n\n const measured = content.width > 0 && content.height > 0\n const scale = measured ? width / content.width : 0\n // Half the width is a neutral plate to hold the space, not a claim about the\n // artwork's shape — nothing here knows it yet.\n const height = measured ? Math.max(1, content.height * scale) : Math.round(width / 2)\n\n const box = frame ?? view.frame\n const rect = measured && box ? clamp(box, view, scale, width, height) : null\n\n function seek(event: ReactPointerEvent<HTMLDivElement>) {\n if (!onSeek || !measured) return\n const map = event.currentTarget.getBoundingClientRect()\n onSeek((event.clientX - map.left) / scale, (event.clientY - map.top) / scale)\n }\n\n return (\n <div\n className={cn(\n 'relative overflow-hidden rounded-(--radius) border border-(--rule-2) bg-(--panel-bg)',\n className,\n )}\n style={{ width, height }}\n role=\"group\"\n aria-label={label}\n >\n {/* The miniature is decorative: the figure it mirrors already publishes\n its own accessible summary, and a second copy would read the whole\n diagram out twice. */}\n {measured && (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute start-0 top-0 origin-top-left\"\n style={{ width: content.width, transform: `scale(${scale})` }}\n >\n {children}\n </div>\n )}\n\n <div\n data-seek=\"\"\n className={cn('absolute inset-0', onSeek && measured && 'cursor-crosshair')}\n onPointerDown={(event) => {\n dragging.current = true\n event.currentTarget.setPointerCapture(event.pointerId)\n seek(event)\n }}\n onPointerMove={(event) => {\n if (dragging.current && event.buttons === 1) seek(event)\n }}\n onPointerUp={(event) => {\n dragging.current = false\n if (event.currentTarget.hasPointerCapture(event.pointerId)) {\n event.currentTarget.releasePointerCapture(event.pointerId)\n }\n }}\n onPointerCancel={() => {\n dragging.current = false\n }}\n >\n {rect && (\n <div\n aria-hidden=\"true\"\n data-viewport=\"\"\n className=\"absolute rounded-[2px] border border-(--accent) bg-(--accent-wash)\"\n style={{\n left: `${rect.x}px`,\n top: `${rect.y}px`,\n width: `${rect.w}px`,\n height: `${rect.h}px`,\n }}\n />\n )}\n </div>\n </div>\n )\n}\n\n/**\n * The frame's rectangle in map space, cut to the map.\n *\n * `view.x` is how far the stage has been pushed, so the content coordinate at\n * the frame's top-left corner is its negation over the zoom. The intersection\n * with the plate is what keeps the rectangle a statement about the artwork: a\n * frame wider than the whole diagram used to draw a box hanging off both edges,\n * which reads as \"there is more over there\" and there is not.\n */\nfunction clamp(\n frame: { width: number; height: number },\n view: CanvasView,\n scale: number,\n width: number,\n height: number,\n): { x: number; y: number; w: number; h: number } {\n const x = (-view.x / view.scale) * scale\n const y = (-view.y / view.scale) * scale\n const left = Math.min(Math.max(x, 0), width)\n const top = Math.min(Math.max(y, 0), height)\n return {\n x: left,\n y: top,\n // Floored at a few pixels so a deep zoom still leaves something to see.\n w: Math.max(4, Math.min(x + (frame.width / view.scale) * scale, width) - left),\n h: Math.max(4, Math.min(y + (frame.height / view.scale) * scale, height) - top),\n }\n}\n\nexport default DiagramMinimap\n"],"mappings":";AAmGI,SAaI,KAbJ;AAjGJ,SAAS,cAAsE;AAC/E,SAAS,UAAU;AAoEZ,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,QAAQ;AACV,GAAwB;AACtB,QAAM,WAAW,OAAO,KAAK;AAE7B,QAAM,WAAW,QAAQ,QAAQ,KAAK,QAAQ,SAAS;AACvD,QAAM,QAAQ,WAAW,QAAQ,QAAQ,QAAQ;AAGjD,QAAM,SAAS,WAAW,KAAK,IAAI,GAAG,QAAQ,SAAS,KAAK,IAAI,KAAK,MAAM,QAAQ,CAAC;AAEpF,QAAM,MAAM,SAAS,KAAK;AAC1B,QAAM,OAAO,YAAY,MAAM,MAAM,KAAK,MAAM,OAAO,OAAO,MAAM,IAAI;AAExE,WAAS,KAAK,OAA0C;AACtD,QAAI,CAAC,UAAU,CAAC,SAAU;AAC1B,UAAM,MAAM,MAAM,cAAc,sBAAsB;AACtD,YAAQ,MAAM,UAAU,IAAI,QAAQ,QAAQ,MAAM,UAAU,IAAI,OAAO,KAAK;AAAA,EAC9E;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO,EAAE,OAAO,OAAO;AAAA,MACvB,MAAK;AAAA,MACL,cAAY;AAAA,MAKX;AAAA,oBACC;AAAA,UAAC;AAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,YACV,OAAO,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,KAAK,IAAI;AAAA,YAE3D;AAAA;AAAA,QACH;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC,aAAU;AAAA,YACV,WAAW,GAAG,oBAAoB,UAAU,YAAY,kBAAkB;AAAA,YAC1E,eAAe,CAAC,UAAU;AACxB,uBAAS,UAAU;AACnB,oBAAM,cAAc,kBAAkB,MAAM,SAAS;AACrD,mBAAK,KAAK;AAAA,YACZ;AAAA,YACA,eAAe,CAAC,UAAU;AACxB,kBAAI,SAAS,WAAW,MAAM,YAAY,EAAG,MAAK,KAAK;AAAA,YACzD;AAAA,YACA,aAAa,CAAC,UAAU;AACtB,uBAAS,UAAU;AACnB,kBAAI,MAAM,cAAc,kBAAkB,MAAM,SAAS,GAAG;AAC1D,sBAAM,cAAc,sBAAsB,MAAM,SAAS;AAAA,cAC3D;AAAA,YACF;AAAA,YACA,iBAAiB,MAAM;AACrB,uBAAS,UAAU;AAAA,YACrB;AAAA,YAEC,kBACC;AAAA,cAAC;AAAA;AAAA,gBACC,eAAY;AAAA,gBACZ,iBAAc;AAAA,gBACd,WAAU;AAAA,gBACV,OAAO;AAAA,kBACL,MAAM,GAAG,KAAK,CAAC;AAAA,kBACf,KAAK,GAAG,KAAK,CAAC;AAAA,kBACd,OAAO,GAAG,KAAK,CAAC;AAAA,kBAChB,QAAQ,GAAG,KAAK,CAAC;AAAA,gBACnB;AAAA;AAAA,YACF;AAAA;AAAA,QAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;AAWA,SAAS,MACP,OACA,MACA,OACA,OACA,QACgD;AAChD,QAAM,IAAK,CAAC,KAAK,IAAI,KAAK,QAAS;AACnC,QAAM,IAAK,CAAC,KAAK,IAAI,KAAK,QAAS;AACnC,QAAM,OAAO,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK;AAC3C,QAAM,MAAM,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,MAAM;AAC3C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA;AAAA,IAEH,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,IAAK,MAAM,QAAQ,KAAK,QAAS,OAAO,KAAK,IAAI,IAAI;AAAA,IAC7E,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,IAAK,MAAM,SAAS,KAAK,QAAS,OAAO,MAAM,IAAI,GAAG;AAAA,EAChF;AACF;AAEA,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,48 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+
4
+ interface DiagramToolbarProps extends Omit<ComponentProps<'div'>, 'children'> {
5
+ children: ReactNode;
6
+ /** Where it sits. `floating` pins it over the surface it acts on. */
7
+ placement?: 'inline' | 'floating';
8
+ /** Which corner a floating bar pins to. */
9
+ align?: 'start' | 'end';
10
+ label: string;
11
+ }
12
+ /**
13
+ * A bar of actions that belong to the surface underneath them.
14
+ *
15
+ * The package already has `FloatingIconButton` for ONE pinned action. This is
16
+ * the container for several — which is a different problem, because several
17
+ * pinned buttons need to read as one object rather than as a scatter: one
18
+ * plate, one border, hairlines between the groups, and a single `role="toolbar"`
19
+ * so a screen reader announces a toolbar instead of six unrelated buttons.
20
+ *
21
+ * `role="toolbar"` also changes the keyboard contract, and callers should know
22
+ * what they are opting into: arrow keys are expected to move between the
23
+ * controls and Tab is expected to leave the bar. This component does not
24
+ * implement roving focus for you — a bar of three buttons where Tab visits all
25
+ * three is honest and fine — so pass `placement="inline"` and skip the role by
26
+ * using a plain `<div>` if that is not what you want.
27
+ *
28
+ * @example
29
+ * <DiagramToolbar label="Diagram actions" placement="floating">
30
+ * <DiagramToolbarGroup>
31
+ * <Button size="sm" variant="ghost">Theme</Button>
32
+ * </DiagramToolbarGroup>
33
+ * <DiagramToolbarGroup>
34
+ * <DiagramExportMenu targetRef={svg} title="Request path" />
35
+ * </DiagramToolbarGroup>
36
+ * </DiagramToolbar>
37
+ */
38
+ declare function DiagramToolbar({ children, className, placement, align, label, ...rest }: DiagramToolbarProps): react.JSX.Element;
39
+ /**
40
+ * One run of related controls inside the bar.
41
+ *
42
+ * Separated by a hairline rather than by space, because a gap large enough to
43
+ * read as a group boundary is also large enough to stop the bar reading as one
44
+ * object — which is the whole reason the controls were collected into a bar.
45
+ */
46
+ declare function DiagramToolbarGroup({ children, className, ...rest }: ComponentProps<'div'>): react.JSX.Element;
47
+
48
+ export { DiagramToolbar, DiagramToolbarGroup, type DiagramToolbarProps, DiagramToolbar as default };
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { cn } from "../../lib/cn.js";
4
+ function DiagramToolbar({
5
+ children,
6
+ className,
7
+ placement = "inline",
8
+ align = "end",
9
+ label,
10
+ ...rest
11
+ }) {
12
+ return /* @__PURE__ */ jsx(
13
+ "div",
14
+ {
15
+ role: "toolbar",
16
+ "aria-label": label,
17
+ "aria-orientation": "horizontal",
18
+ className: cn(
19
+ "flex items-center gap-1 rounded-(--radius) border border-(--rule-2) bg-(--panel-bg) p-1",
20
+ placement === "floating" && "absolute top-3 z-(--z-sticky)",
21
+ placement === "floating" && (align === "end" ? "end-3" : "start-3"),
22
+ className
23
+ ),
24
+ ...rest,
25
+ children
26
+ }
27
+ );
28
+ }
29
+ function DiagramToolbarGroup({
30
+ children,
31
+ className,
32
+ ...rest
33
+ }) {
34
+ return /* @__PURE__ */ jsx(
35
+ "div",
36
+ {
37
+ className: cn(
38
+ "flex items-center gap-0.5",
39
+ "border-s border-(--rule) ps-1 first:border-s-0 first:ps-0",
40
+ className
41
+ ),
42
+ ...rest,
43
+ children
44
+ }
45
+ );
46
+ }
47
+ var DiagramToolbar_default = DiagramToolbar;
48
+ export {
49
+ DiagramToolbar,
50
+ DiagramToolbarGroup,
51
+ DiagramToolbar_default as default
52
+ };
53
+ //# sourceMappingURL=DiagramToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/DiagramToolbar/DiagramToolbar.tsx"],"sourcesContent":["'use client'\n\nimport type { ComponentProps, ReactNode } from 'react'\nimport { cn } from '../../lib/cn'\n\nexport interface DiagramToolbarProps extends Omit<ComponentProps<'div'>, 'children'> {\n children: ReactNode\n /** Where it sits. `floating` pins it over the surface it acts on. */\n placement?: 'inline' | 'floating'\n /** Which corner a floating bar pins to. */\n align?: 'start' | 'end'\n label: string\n}\n\n/**\n * A bar of actions that belong to the surface underneath them.\n *\n * The package already has `FloatingIconButton` for ONE pinned action. This is\n * the container for several — which is a different problem, because several\n * pinned buttons need to read as one object rather than as a scatter: one\n * plate, one border, hairlines between the groups, and a single `role=\"toolbar\"`\n * so a screen reader announces a toolbar instead of six unrelated buttons.\n *\n * `role=\"toolbar\"` also changes the keyboard contract, and callers should know\n * what they are opting into: arrow keys are expected to move between the\n * controls and Tab is expected to leave the bar. This component does not\n * implement roving focus for you — a bar of three buttons where Tab visits all\n * three is honest and fine — so pass `placement=\"inline\"` and skip the role by\n * using a plain `<div>` if that is not what you want.\n *\n * @example\n * <DiagramToolbar label=\"Diagram actions\" placement=\"floating\">\n * <DiagramToolbarGroup>\n * <Button size=\"sm\" variant=\"ghost\">Theme</Button>\n * </DiagramToolbarGroup>\n * <DiagramToolbarGroup>\n * <DiagramExportMenu targetRef={svg} title=\"Request path\" />\n * </DiagramToolbarGroup>\n * </DiagramToolbar>\n */\nexport function DiagramToolbar({\n children,\n className,\n placement = 'inline',\n align = 'end',\n label,\n ...rest\n}: DiagramToolbarProps) {\n return (\n <div\n role=\"toolbar\"\n aria-label={label}\n aria-orientation=\"horizontal\"\n className={cn(\n 'flex items-center gap-1 rounded-(--radius) border border-(--rule-2) bg-(--panel-bg) p-1',\n placement === 'floating' && 'absolute top-3 z-(--z-sticky)',\n placement === 'floating' && (align === 'end' ? 'end-3' : 'start-3'),\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\n/**\n * One run of related controls inside the bar.\n *\n * Separated by a hairline rather than by space, because a gap large enough to\n * read as a group boundary is also large enough to stop the bar reading as one\n * object — which is the whole reason the controls were collected into a bar.\n */\nexport function DiagramToolbarGroup({\n children,\n className,\n ...rest\n}: ComponentProps<'div'>) {\n return (\n <div\n className={cn(\n 'flex items-center gap-0.5',\n 'border-s border-(--rule) ps-1 first:border-s-0 first:ps-0',\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nexport default DiagramToolbar\n"],"mappings":";AAiDI;AA9CJ,SAAS,UAAU;AAqCZ,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,oBAAiB;AAAA,MACjB,WAAW;AAAA,QACT;AAAA,QACA,cAAc,cAAc;AAAA,QAC5B,cAAc,eAAe,UAAU,QAAQ,UAAU;AAAA,QACzD;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AASO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,31 @@
1
+ import * as react from 'react';
2
+ import { FigureChrome } from '../lib/frame.js';
3
+ import { LifecycleSpec } from '../spec.js';
4
+ import '../lib/geometry.js';
5
+
6
+ interface LifecycleFigureProps extends FigureChrome {
7
+ spec: LifecycleSpec;
8
+ }
9
+ /**
10
+ * A state machine: what something can BE, and what moves it.
11
+ *
12
+ * The one figure here that spends colour, and it spends exactly the two tokens
13
+ * this system reserves for state: `--success` on a terminal success,
14
+ * `--danger` on a terminal failure. Nothing else in the package is allowed
15
+ * those two, and a lifecycle diagram is the case they were reserved for — the
16
+ * whole point of the picture is which end a run came out of.
17
+ *
18
+ * The other six kinds are carried by shape, so a greyscale print loses the two
19
+ * outcomes' hue and keeps every other distinction: a start is a filled cap, a
20
+ * decision is a diamond, a wait is a dashed frame, an external is a plate with
21
+ * a cut corner.
22
+ *
23
+ * A RECOVERABLE FAILURE IS A FAILURE WITH A WAY BACK. `type: "failure"` says
24
+ * how a state is drawn; a transition OUT of it is what says whether the run is
25
+ * over. A retryable error and a terminal one look identical until you follow
26
+ * the arrows, which is correct — the difference between them is a real edge in
27
+ * the machine, not an adjective on a box.
28
+ */
29
+ declare function LifecycleFigure({ spec, className, legend, cards, heading, activeIds, onSelectNode, }: LifecycleFigureProps): react.JSX.Element;
30
+
31
+ export { LifecycleFigure, type LifecycleFigureProps, LifecycleFigure as default };