@misoto22/folio 0.0.0 → 0.16.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 (686) hide show
  1. package/AGENTS.md +88 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +208 -2
  5. package/bin/folio-design.mjs +277 -0
  6. package/bin/migrate-legacy.mjs +81 -0
  7. package/dist/agent/Accordion.md +65 -0
  8. package/dist/agent/Actions.md +49 -0
  9. package/dist/agent/Alert.md +65 -0
  10. package/dist/agent/AppShell.md +69 -0
  11. package/dist/agent/ArchitectureFigure.md +72 -0
  12. package/dist/agent/AreaChart.md +94 -0
  13. package/dist/agent/Article.md +65 -0
  14. package/dist/agent/AspectRatio.md +58 -0
  15. package/dist/agent/Avatar.md +53 -0
  16. package/dist/agent/Badge.md +62 -0
  17. package/dist/agent/BarChart.md +93 -0
  18. package/dist/agent/BarList.md +67 -0
  19. package/dist/agent/BigNumber.md +70 -0
  20. package/dist/agent/BoxPlot.md +82 -0
  21. package/dist/agent/Breadcrumb.md +55 -0
  22. package/dist/agent/BulletChart.md +71 -0
  23. package/dist/agent/Button.md +81 -0
  24. package/dist/agent/Calendar.md +77 -0
  25. package/dist/agent/CalendarHeatmap.md +75 -0
  26. package/dist/agent/Card.md +72 -0
  27. package/dist/agent/Checkbox.md +57 -0
  28. package/dist/agent/Code.md +51 -0
  29. package/dist/agent/CodeBlock.md +77 -0
  30. package/dist/agent/Collapsible.md +68 -0
  31. package/dist/agent/Collection.md +169 -0
  32. package/dist/agent/ColorPicker.md +76 -0
  33. package/dist/agent/Combobox.md +77 -0
  34. package/dist/agent/Command.md +122 -0
  35. package/dist/agent/ComposedChart.md +82 -0
  36. package/dist/agent/Contact.md +90 -0
  37. package/dist/agent/Content.md +70 -0
  38. package/dist/agent/ContextMenu.md +93 -0
  39. package/dist/agent/Conversation.md +247 -0
  40. package/dist/agent/DataflowFigure.md +49 -0
  41. package/dist/agent/DatePicker.md +104 -0
  42. package/dist/agent/DescriptionList.md +69 -0
  43. package/dist/agent/Diagram.md +71 -0
  44. package/dist/agent/DiagramCanvas.md +71 -0
  45. package/dist/agent/DiagramExportMenu.md +65 -0
  46. package/dist/agent/DiagramInspector.md +73 -0
  47. package/dist/agent/DiagramLegend.md +56 -0
  48. package/dist/agent/DiagramMinimap.md +69 -0
  49. package/dist/agent/DiagramToolbar.md +70 -0
  50. package/dist/agent/Dialog.md +76 -0
  51. package/dist/agent/DropdownMenu.md +110 -0
  52. package/dist/agent/EmptyState.md +63 -0
  53. package/dist/agent/ErrorState.md +67 -0
  54. package/dist/agent/Evidence.md +165 -0
  55. package/dist/agent/Facet.md +107 -0
  56. package/dist/agent/Field.md +79 -0
  57. package/dist/agent/FigureBand.md +49 -0
  58. package/dist/agent/FloatingIconButton.md +61 -0
  59. package/dist/agent/FunnelChart.md +75 -0
  60. package/dist/agent/Heading.md +65 -0
  61. package/dist/agent/Heatmap.md +78 -0
  62. package/dist/agent/Histogram.md +88 -0
  63. package/dist/agent/Input.md +52 -0
  64. package/dist/agent/Kbd.md +48 -0
  65. package/dist/agent/LifecycleFigure.md +50 -0
  66. package/dist/agent/LineChart.md +85 -0
  67. package/dist/agent/LinkArrow.md +49 -0
  68. package/dist/agent/Markdown.md +69 -0
  69. package/dist/agent/Media.md +261 -0
  70. package/dist/agent/Metric.md +70 -0
  71. package/dist/agent/Metrics.md +114 -0
  72. package/dist/agent/Music.md +86 -0
  73. package/dist/agent/NativeSelect.md +62 -0
  74. package/dist/agent/NavItem.md +56 -0
  75. package/dist/agent/NumberField.md +73 -0
  76. package/dist/agent/PageHeader.md +69 -0
  77. package/dist/agent/Pagination.md +70 -0
  78. package/dist/agent/PieChart.md +80 -0
  79. package/dist/agent/Popover.md +80 -0
  80. package/dist/agent/Portfolio.md +93 -0
  81. package/dist/agent/PortfolioIndex.md +34 -0
  82. package/dist/agent/Progress.md +58 -0
  83. package/dist/agent/RadarChart.md +79 -0
  84. package/dist/agent/RadialChart.md +81 -0
  85. package/dist/agent/RadioGroup.md +66 -0
  86. package/dist/agent/Reading.md +233 -0
  87. package/dist/agent/Recovery.md +72 -0
  88. package/dist/agent/SankeyChart.md +85 -0
  89. package/dist/agent/ScatterChart.md +80 -0
  90. package/dist/agent/ScrollArea.md +62 -0
  91. package/dist/agent/SearchPalette.md +51 -0
  92. package/dist/agent/SearchableMenu.md +69 -0
  93. package/dist/agent/Select.md +102 -0
  94. package/dist/agent/Separator.md +60 -0
  95. package/dist/agent/SequenceFigure.md +51 -0
  96. package/dist/agent/Sheet.md +82 -0
  97. package/dist/agent/Sidebar.md +194 -0
  98. package/dist/agent/SiteNavigation.md +62 -0
  99. package/dist/agent/SiteShell.md +67 -0
  100. package/dist/agent/Skeleton.md +96 -0
  101. package/dist/agent/Slider.md +67 -0
  102. package/dist/agent/Sparkline.md +68 -0
  103. package/dist/agent/Spinner.md +62 -0
  104. package/dist/agent/StatusDot.md +56 -0
  105. package/dist/agent/StatusPill.md +55 -0
  106. package/dist/agent/Steps.md +68 -0
  107. package/dist/agent/Switch.md +50 -0
  108. package/dist/agent/Table.md +111 -0
  109. package/dist/agent/Tabs.md +71 -0
  110. package/dist/agent/Tag.md +67 -0
  111. package/dist/agent/Text.md +66 -0
  112. package/dist/agent/Textarea.md +46 -0
  113. package/dist/agent/Timeline.md +114 -0
  114. package/dist/agent/Timestamp.md +65 -0
  115. package/dist/agent/Toast.md +51 -0
  116. package/dist/agent/ToggleGroup.md +67 -0
  117. package/dist/agent/Toolbar.md +72 -0
  118. package/dist/agent/Tooltip.md +74 -0
  119. package/dist/agent/TreemapChart.md +76 -0
  120. package/dist/agent/WaterfallChart.md +86 -0
  121. package/dist/agent/WorkflowFigure.md +51 -0
  122. package/dist/agent/catalog.json +8006 -0
  123. package/dist/agent/index.md +182 -0
  124. package/dist/article.css +407 -0
  125. package/dist/charts/AreaChart/AreaChart.d.ts +198 -0
  126. package/dist/charts/AreaChart/AreaChart.js +479 -0
  127. package/dist/charts/AreaChart/AreaChart.js.map +1 -0
  128. package/dist/charts/BarChart/BarChart.d.ts +190 -0
  129. package/dist/charts/BarChart/BarChart.js +599 -0
  130. package/dist/charts/BarChart/BarChart.js.map +1 -0
  131. package/dist/charts/BarList/BarList.d.ts +65 -0
  132. package/dist/charts/BarList/BarList.js +79 -0
  133. package/dist/charts/BarList/BarList.js.map +1 -0
  134. package/dist/charts/BigNumber/BigNumber.d.ts +72 -0
  135. package/dist/charts/BigNumber/BigNumber.js +51 -0
  136. package/dist/charts/BigNumber/BigNumber.js.map +1 -0
  137. package/dist/charts/BoxPlot/BoxPlot.d.ts +177 -0
  138. package/dist/charts/BoxPlot/BoxPlot.js +497 -0
  139. package/dist/charts/BoxPlot/BoxPlot.js.map +1 -0
  140. package/dist/charts/BulletChart/BulletChart.d.ts +100 -0
  141. package/dist/charts/BulletChart/BulletChart.js +197 -0
  142. package/dist/charts/BulletChart/BulletChart.js.map +1 -0
  143. package/dist/charts/CalendarHeatmap/CalendarHeatmap.d.ts +106 -0
  144. package/dist/charts/CalendarHeatmap/CalendarHeatmap.js +103 -0
  145. package/dist/charts/CalendarHeatmap/CalendarHeatmap.js.map +1 -0
  146. package/dist/charts/ComposedChart/ComposedChart.d.ts +178 -0
  147. package/dist/charts/ComposedChart/ComposedChart.js +667 -0
  148. package/dist/charts/ComposedChart/ComposedChart.js.map +1 -0
  149. package/dist/charts/Facet/Facet.d.ts +240 -0
  150. package/dist/charts/Facet/Facet.js +133 -0
  151. package/dist/charts/Facet/Facet.js.map +1 -0
  152. package/dist/charts/Facet/panels.d.ts +187 -0
  153. package/dist/charts/Facet/panels.js +203 -0
  154. package/dist/charts/Facet/panels.js.map +1 -0
  155. package/dist/charts/FunnelChart/FunnelChart.d.ts +106 -0
  156. package/dist/charts/FunnelChart/FunnelChart.js +137 -0
  157. package/dist/charts/FunnelChart/FunnelChart.js.map +1 -0
  158. package/dist/charts/Heatmap/Heatmap.d.ts +101 -0
  159. package/dist/charts/Heatmap/Heatmap.js +125 -0
  160. package/dist/charts/Heatmap/Heatmap.js.map +1 -0
  161. package/dist/charts/Histogram/Histogram.d.ts +188 -0
  162. package/dist/charts/Histogram/Histogram.js +382 -0
  163. package/dist/charts/Histogram/Histogram.js.map +1 -0
  164. package/dist/charts/LineChart/LineChart.d.ts +174 -0
  165. package/dist/charts/LineChart/LineChart.js +485 -0
  166. package/dist/charts/LineChart/LineChart.js.map +1 -0
  167. package/dist/charts/PieChart/PieChart.d.ts +140 -0
  168. package/dist/charts/PieChart/PieChart.js +317 -0
  169. package/dist/charts/PieChart/PieChart.js.map +1 -0
  170. package/dist/charts/RadarChart/RadarChart.d.ts +135 -0
  171. package/dist/charts/RadarChart/RadarChart.js +303 -0
  172. package/dist/charts/RadarChart/RadarChart.js.map +1 -0
  173. package/dist/charts/RadialChart/RadialChart.d.ts +142 -0
  174. package/dist/charts/RadialChart/RadialChart.js +279 -0
  175. package/dist/charts/RadialChart/RadialChart.js.map +1 -0
  176. package/dist/charts/SankeyChart/SankeyChart.d.ts +149 -0
  177. package/dist/charts/SankeyChart/SankeyChart.js +509 -0
  178. package/dist/charts/SankeyChart/SankeyChart.js.map +1 -0
  179. package/dist/charts/ScatterChart/ScatterChart.d.ts +149 -0
  180. package/dist/charts/ScatterChart/ScatterChart.js +275 -0
  181. package/dist/charts/ScatterChart/ScatterChart.js.map +1 -0
  182. package/dist/charts/Sparkline/Sparkline.d.ts +53 -0
  183. package/dist/charts/Sparkline/Sparkline.js +95 -0
  184. package/dist/charts/Sparkline/Sparkline.js.map +1 -0
  185. package/dist/charts/TreemapChart/TreemapChart.d.ts +98 -0
  186. package/dist/charts/TreemapChart/TreemapChart.js +127 -0
  187. package/dist/charts/TreemapChart/TreemapChart.js.map +1 -0
  188. package/dist/charts/WaterfallChart/WaterfallChart.d.ts +164 -0
  189. package/dist/charts/WaterfallChart/WaterfallChart.js +321 -0
  190. package/dist/charts/WaterfallChart/WaterfallChart.js.map +1 -0
  191. package/dist/charts/index.d.ts +43 -0
  192. package/dist/charts/index.js +130 -0
  193. package/dist/charts/index.js.map +1 -0
  194. package/dist/charts/lib/annotations.d.ts +103 -0
  195. package/dist/charts/lib/annotations.js +99 -0
  196. package/dist/charts/lib/annotations.js.map +1 -0
  197. package/dist/charts/lib/axis.d.ts +18 -0
  198. package/dist/charts/lib/axis.js +21 -0
  199. package/dist/charts/lib/axis.js.map +1 -0
  200. package/dist/charts/lib/background.d.ts +33 -0
  201. package/dist/charts/lib/background.js +173 -0
  202. package/dist/charts/lib/background.js.map +1 -0
  203. package/dist/charts/lib/brush.d.ts +94 -0
  204. package/dist/charts/lib/brush.js +535 -0
  205. package/dist/charts/lib/brush.js.map +1 -0
  206. package/dist/charts/lib/chart.d.ts +94 -0
  207. package/dist/charts/lib/chart.js +149 -0
  208. package/dist/charts/lib/chart.js.map +1 -0
  209. package/dist/charts/lib/dot.d.ts +29 -0
  210. package/dist/charts/lib/dot.js +78 -0
  211. package/dist/charts/lib/dot.js.map +1 -0
  212. package/dist/charts/lib/empty.d.ts +31 -0
  213. package/dist/charts/lib/empty.js +24 -0
  214. package/dist/charts/lib/empty.js.map +1 -0
  215. package/dist/charts/lib/export.d.ts +94 -0
  216. package/dist/charts/lib/export.js +62 -0
  217. package/dist/charts/lib/export.js.map +1 -0
  218. package/dist/charts/lib/figure.d.ts +81 -0
  219. package/dist/charts/lib/figure.js +62 -0
  220. package/dist/charts/lib/figure.js.map +1 -0
  221. package/dist/charts/lib/format.d.ts +46 -0
  222. package/dist/charts/lib/format.js +56 -0
  223. package/dist/charts/lib/format.js.map +1 -0
  224. package/dist/charts/lib/legend.d.ts +45 -0
  225. package/dist/charts/lib/legend.js +117 -0
  226. package/dist/charts/lib/legend.js.map +1 -0
  227. package/dist/charts/lib/loading.d.ts +48 -0
  228. package/dist/charts/lib/loading.js +105 -0
  229. package/dist/charts/lib/loading.js.map +1 -0
  230. package/dist/charts/lib/paint.d.ts +154 -0
  231. package/dist/charts/lib/paint.js +551 -0
  232. package/dist/charts/lib/paint.js.map +1 -0
  233. package/dist/charts/lib/scale.d.ts +23 -0
  234. package/dist/charts/lib/scale.js +13 -0
  235. package/dist/charts/lib/scale.js.map +1 -0
  236. package/dist/charts/lib/selection.d.ts +20 -0
  237. package/dist/charts/lib/selection.js +18 -0
  238. package/dist/charts/lib/selection.js.map +1 -0
  239. package/dist/charts/lib/sonify-control.d.ts +163 -0
  240. package/dist/charts/lib/sonify-control.js +172 -0
  241. package/dist/charts/lib/sonify-control.js.map +1 -0
  242. package/dist/charts/lib/sonify.d.ts +248 -0
  243. package/dist/charts/lib/sonify.js +262 -0
  244. package/dist/charts/lib/sonify.js.map +1 -0
  245. package/dist/charts/lib/toolbar.d.ts +144 -0
  246. package/dist/charts/lib/toolbar.js +156 -0
  247. package/dist/charts/lib/toolbar.js.map +1 -0
  248. package/dist/charts/lib/tooltip.d.ts +59 -0
  249. package/dist/charts/lib/tooltip.js +135 -0
  250. package/dist/charts/lib/tooltip.js.map +1 -0
  251. package/dist/charts/lib/values.d.ts +56 -0
  252. package/dist/charts/lib/values.js +71 -0
  253. package/dist/charts/lib/values.js.map +1 -0
  254. package/dist/charts/lib/zoom.d.ts +139 -0
  255. package/dist/charts/lib/zoom.js +314 -0
  256. package/dist/charts/lib/zoom.js.map +1 -0
  257. package/dist/components/Accordion/Accordion.d.ts +34 -0
  258. package/dist/components/Accordion/Accordion.js +43 -0
  259. package/dist/components/Accordion/Accordion.js.map +1 -0
  260. package/dist/components/Alert/Alert.d.ts +32 -0
  261. package/dist/components/Alert/Alert.js +49 -0
  262. package/dist/components/Alert/Alert.js.map +1 -0
  263. package/dist/components/AppShell/AppShell.d.ts +58 -0
  264. package/dist/components/AppShell/AppShell.js +126 -0
  265. package/dist/components/AppShell/AppShell.js.map +1 -0
  266. package/dist/components/Article/Article.d.ts +58 -0
  267. package/dist/components/Article/Article.js +34 -0
  268. package/dist/components/Article/Article.js.map +1 -0
  269. package/dist/components/AspectRatio/AspectRatio.d.ts +46 -0
  270. package/dist/components/AspectRatio/AspectRatio.js +33 -0
  271. package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
  272. package/dist/components/Avatar/Avatar.d.ts +38 -0
  273. package/dist/components/Avatar/Avatar.js +44 -0
  274. package/dist/components/Avatar/Avatar.js.map +1 -0
  275. package/dist/components/Badge/Badge.d.ts +30 -0
  276. package/dist/components/Badge/Badge.js +29 -0
  277. package/dist/components/Badge/Badge.js.map +1 -0
  278. package/dist/components/Breadcrumb/Breadcrumb.d.ts +37 -0
  279. package/dist/components/Breadcrumb/Breadcrumb.js +46 -0
  280. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
  281. package/dist/components/Button/Button.d.ts +70 -0
  282. package/dist/components/Button/Button.js +95 -0
  283. package/dist/components/Button/Button.js.map +1 -0
  284. package/dist/components/Calendar/Calendar.d.ts +54 -0
  285. package/dist/components/Calendar/Calendar.js +369 -0
  286. package/dist/components/Calendar/Calendar.js.map +1 -0
  287. package/dist/components/Card/Card.d.ts +55 -0
  288. package/dist/components/Card/Card.js +64 -0
  289. package/dist/components/Card/Card.js.map +1 -0
  290. package/dist/components/Checkbox/Checkbox.d.ts +26 -0
  291. package/dist/components/Checkbox/Checkbox.js +34 -0
  292. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  293. package/dist/components/Code/Code.d.ts +30 -0
  294. package/dist/components/Code/Code.js +21 -0
  295. package/dist/components/Code/Code.js.map +1 -0
  296. package/dist/components/CodeBlock/CodeBlock.d.ts +145 -0
  297. package/dist/components/CodeBlock/CodeBlock.js +114 -0
  298. package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
  299. package/dist/components/Collapsible/Collapsible.d.ts +45 -0
  300. package/dist/components/Collapsible/Collapsible.js +60 -0
  301. package/dist/components/Collapsible/Collapsible.js.map +1 -0
  302. package/dist/components/ColorPicker/ColorPicker.d.ts +67 -0
  303. package/dist/components/ColorPicker/ColorPicker.js +334 -0
  304. package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
  305. package/dist/components/Combobox/Combobox.d.ts +77 -0
  306. package/dist/components/Combobox/Combobox.js +170 -0
  307. package/dist/components/Combobox/Combobox.js.map +1 -0
  308. package/dist/components/Command/Command.d.ts +125 -0
  309. package/dist/components/Command/Command.js +204 -0
  310. package/dist/components/Command/Command.js.map +1 -0
  311. package/dist/components/ContextMenu/ContextMenu.d.ts +63 -0
  312. package/dist/components/ContextMenu/ContextMenu.js +109 -0
  313. package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
  314. package/dist/components/DatePicker/DatePicker.d.ts +130 -0
  315. package/dist/components/DatePicker/DatePicker.js +257 -0
  316. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  317. package/dist/components/DescriptionList/DescriptionList.d.ts +73 -0
  318. package/dist/components/DescriptionList/DescriptionList.js +35 -0
  319. package/dist/components/DescriptionList/DescriptionList.js.map +1 -0
  320. package/dist/components/Diagram/Diagram.d.ts +86 -0
  321. package/dist/components/Diagram/Diagram.js +211 -0
  322. package/dist/components/Diagram/Diagram.js.map +1 -0
  323. package/dist/components/Dialog/Dialog.d.ts +63 -0
  324. package/dist/components/Dialog/Dialog.js +90 -0
  325. package/dist/components/Dialog/Dialog.js.map +1 -0
  326. package/dist/components/DropdownMenu/DropdownMenu.d.ts +87 -0
  327. package/dist/components/DropdownMenu/DropdownMenu.js +120 -0
  328. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
  329. package/dist/components/EmptyState/EmptyState.d.ts +55 -0
  330. package/dist/components/EmptyState/EmptyState.js +32 -0
  331. package/dist/components/EmptyState/EmptyState.js.map +1 -0
  332. package/dist/components/ErrorState/ErrorState.d.ts +55 -0
  333. package/dist/components/ErrorState/ErrorState.js +41 -0
  334. package/dist/components/ErrorState/ErrorState.js.map +1 -0
  335. package/dist/components/Field/Field.d.ts +111 -0
  336. package/dist/components/Field/Field.js +95 -0
  337. package/dist/components/Field/Field.js.map +1 -0
  338. package/dist/components/Field/field-control.d.ts +31 -0
  339. package/dist/components/Field/field-control.js +12 -0
  340. package/dist/components/Field/field-control.js.map +1 -0
  341. package/dist/components/FigureBand/FigureBand.d.ts +31 -0
  342. package/dist/components/FigureBand/FigureBand.js +51 -0
  343. package/dist/components/FigureBand/FigureBand.js.map +1 -0
  344. package/dist/components/FloatingIconButton/FloatingIconButton.d.ts +29 -0
  345. package/dist/components/FloatingIconButton/FloatingIconButton.js +34 -0
  346. package/dist/components/FloatingIconButton/FloatingIconButton.js.map +1 -0
  347. package/dist/components/Heading/Heading.d.ts +62 -0
  348. package/dist/components/Heading/Heading.js +44 -0
  349. package/dist/components/Heading/Heading.js.map +1 -0
  350. package/dist/components/Input/Input.d.ts +22 -0
  351. package/dist/components/Input/Input.js +21 -0
  352. package/dist/components/Input/Input.js.map +1 -0
  353. package/dist/components/Kbd/Kbd.d.ts +27 -0
  354. package/dist/components/Kbd/Kbd.js +21 -0
  355. package/dist/components/Kbd/Kbd.js.map +1 -0
  356. package/dist/components/LinkArrow/LinkArrow.d.ts +24 -0
  357. package/dist/components/LinkArrow/LinkArrow.js +24 -0
  358. package/dist/components/LinkArrow/LinkArrow.js.map +1 -0
  359. package/dist/components/Markdown/Markdown.d.ts +139 -0
  360. package/dist/components/Markdown/Markdown.js +135 -0
  361. package/dist/components/Markdown/Markdown.js.map +1 -0
  362. package/dist/components/Markdown/inline.d.ts +29 -0
  363. package/dist/components/Markdown/inline.js +74 -0
  364. package/dist/components/Markdown/inline.js.map +1 -0
  365. package/dist/components/Markdown/nodes.d.ts +65 -0
  366. package/dist/components/Markdown/nodes.js +1 -0
  367. package/dist/components/Markdown/nodes.js.map +1 -0
  368. package/dist/components/Markdown/parse.d.ts +24 -0
  369. package/dist/components/Markdown/parse.js +110 -0
  370. package/dist/components/Markdown/parse.js.map +1 -0
  371. package/dist/components/Markdown/slug.d.ts +15 -0
  372. package/dist/components/Markdown/slug.js +7 -0
  373. package/dist/components/Markdown/slug.js.map +1 -0
  374. package/dist/components/Metric/Metric.d.ts +61 -0
  375. package/dist/components/Metric/Metric.js +51 -0
  376. package/dist/components/Metric/Metric.js.map +1 -0
  377. package/dist/components/NativeSelect/NativeSelect.d.ts +33 -0
  378. package/dist/components/NativeSelect/NativeSelect.js +44 -0
  379. package/dist/components/NativeSelect/NativeSelect.js.map +1 -0
  380. package/dist/components/NavItem/NavItem.d.ts +39 -0
  381. package/dist/components/NavItem/NavItem.js +31 -0
  382. package/dist/components/NavItem/NavItem.js.map +1 -0
  383. package/dist/components/NumberField/NumberField.d.ts +69 -0
  384. package/dist/components/NumberField/NumberField.js +162 -0
  385. package/dist/components/NumberField/NumberField.js.map +1 -0
  386. package/dist/components/PageHeader/PageHeader.d.ts +92 -0
  387. package/dist/components/PageHeader/PageHeader.js +37 -0
  388. package/dist/components/PageHeader/PageHeader.js.map +1 -0
  389. package/dist/components/Pagination/Pagination.d.ts +67 -0
  390. package/dist/components/Pagination/Pagination.js +112 -0
  391. package/dist/components/Pagination/Pagination.js.map +1 -0
  392. package/dist/components/Popover/Popover.d.ts +39 -0
  393. package/dist/components/Popover/Popover.js +57 -0
  394. package/dist/components/Popover/Popover.js.map +1 -0
  395. package/dist/components/Progress/Progress.d.ts +43 -0
  396. package/dist/components/Progress/Progress.js +57 -0
  397. package/dist/components/Progress/Progress.js.map +1 -0
  398. package/dist/components/RadioGroup/RadioGroup.d.ts +49 -0
  399. package/dist/components/RadioGroup/RadioGroup.js +53 -0
  400. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  401. package/dist/components/ScrollArea/ScrollArea.d.ts +46 -0
  402. package/dist/components/ScrollArea/ScrollArea.js +54 -0
  403. package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
  404. package/dist/components/SearchableMenu/SearchableMenu.d.ts +68 -0
  405. package/dist/components/SearchableMenu/SearchableMenu.js +101 -0
  406. package/dist/components/SearchableMenu/SearchableMenu.js.map +1 -0
  407. package/dist/components/Select/Select.d.ts +87 -0
  408. package/dist/components/Select/Select.js +130 -0
  409. package/dist/components/Select/Select.js.map +1 -0
  410. package/dist/components/Separator/Separator.d.ts +48 -0
  411. package/dist/components/Separator/Separator.js +43 -0
  412. package/dist/components/Separator/Separator.js.map +1 -0
  413. package/dist/components/Sheet/Sheet.d.ts +43 -0
  414. package/dist/components/Sheet/Sheet.js +79 -0
  415. package/dist/components/Sheet/Sheet.js.map +1 -0
  416. package/dist/components/Sidebar/Sidebar.d.ts +357 -0
  417. package/dist/components/Sidebar/Sidebar.js +447 -0
  418. package/dist/components/Sidebar/Sidebar.js.map +1 -0
  419. package/dist/components/Skeleton/Skeleton.d.ts +70 -0
  420. package/dist/components/Skeleton/Skeleton.js +44 -0
  421. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  422. package/dist/components/Slider/Slider.d.ts +74 -0
  423. package/dist/components/Slider/Slider.js +143 -0
  424. package/dist/components/Slider/Slider.js.map +1 -0
  425. package/dist/components/Spinner/Spinner.d.ts +58 -0
  426. package/dist/components/Spinner/Spinner.js +49 -0
  427. package/dist/components/Spinner/Spinner.js.map +1 -0
  428. package/dist/components/StatusDot/StatusDot.d.ts +29 -0
  429. package/dist/components/StatusDot/StatusDot.js +44 -0
  430. package/dist/components/StatusDot/StatusDot.js.map +1 -0
  431. package/dist/components/StatusPill/StatusPill.d.ts +30 -0
  432. package/dist/components/StatusPill/StatusPill.js +37 -0
  433. package/dist/components/StatusPill/StatusPill.js.map +1 -0
  434. package/dist/components/Steps/Steps.d.ts +65 -0
  435. package/dist/components/Steps/Steps.js +25 -0
  436. package/dist/components/Steps/Steps.js.map +1 -0
  437. package/dist/components/Switch/Switch.d.ts +23 -0
  438. package/dist/components/Switch/Switch.js +23 -0
  439. package/dist/components/Switch/Switch.js.map +1 -0
  440. package/dist/components/Table/Table.d.ts +116 -0
  441. package/dist/components/Table/Table.js +137 -0
  442. package/dist/components/Table/Table.js.map +1 -0
  443. package/dist/components/Tabs/Tabs.d.ts +37 -0
  444. package/dist/components/Tabs/Tabs.js +205 -0
  445. package/dist/components/Tabs/Tabs.js.map +1 -0
  446. package/dist/components/Tag/Tag.d.ts +87 -0
  447. package/dist/components/Tag/Tag.js +62 -0
  448. package/dist/components/Tag/Tag.js.map +1 -0
  449. package/dist/components/Text/Text.d.ts +62 -0
  450. package/dist/components/Text/Text.js +30 -0
  451. package/dist/components/Text/Text.js.map +1 -0
  452. package/dist/components/Textarea/Textarea.d.ts +20 -0
  453. package/dist/components/Textarea/Textarea.js +32 -0
  454. package/dist/components/Textarea/Textarea.js.map +1 -0
  455. package/dist/components/Timestamp/Timestamp.d.ts +59 -0
  456. package/dist/components/Timestamp/Timestamp.js +56 -0
  457. package/dist/components/Timestamp/Timestamp.js.map +1 -0
  458. package/dist/components/Toast/Toast.d.ts +32 -0
  459. package/dist/components/Toast/Toast.js +64 -0
  460. package/dist/components/Toast/Toast.js.map +1 -0
  461. package/dist/components/ToggleGroup/ToggleGroup.d.ts +46 -0
  462. package/dist/components/ToggleGroup/ToggleGroup.js +88 -0
  463. package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -0
  464. package/dist/components/Toolbar/Toolbar.d.ts +55 -0
  465. package/dist/components/Toolbar/Toolbar.js +43 -0
  466. package/dist/components/Toolbar/Toolbar.js.map +1 -0
  467. package/dist/components/Tooltip/Tooltip.d.ts +43 -0
  468. package/dist/components/Tooltip/Tooltip.js +40 -0
  469. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  470. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.d.ts +55 -0
  471. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js +175 -0
  472. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js.map +1 -0
  473. package/dist/diagrams/DataflowFigure/DataflowFigure.d.ts +28 -0
  474. package/dist/diagrams/DataflowFigure/DataflowFigure.js +148 -0
  475. package/dist/diagrams/DataflowFigure/DataflowFigure.js.map +1 -0
  476. package/dist/diagrams/DiagramCanvas/DiagramCanvas.d.ts +78 -0
  477. package/dist/diagrams/DiagramCanvas/DiagramCanvas.js +229 -0
  478. package/dist/diagrams/DiagramCanvas/DiagramCanvas.js.map +1 -0
  479. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.d.ts +106 -0
  480. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js +123 -0
  481. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js.map +1 -0
  482. package/dist/diagrams/DiagramInspector/DiagramInspector.d.ts +70 -0
  483. package/dist/diagrams/DiagramInspector/DiagramInspector.js +94 -0
  484. package/dist/diagrams/DiagramInspector/DiagramInspector.js.map +1 -0
  485. package/dist/diagrams/DiagramLegend/DiagramLegend.d.ts +42 -0
  486. package/dist/diagrams/DiagramLegend/DiagramLegend.js +35 -0
  487. package/dist/diagrams/DiagramLegend/DiagramLegend.js.map +1 -0
  488. package/dist/diagrams/DiagramMinimap/DiagramMinimap.d.ts +77 -0
  489. package/dist/diagrams/DiagramMinimap/DiagramMinimap.js +106 -0
  490. package/dist/diagrams/DiagramMinimap/DiagramMinimap.js.map +1 -0
  491. package/dist/diagrams/DiagramToolbar/DiagramToolbar.d.ts +48 -0
  492. package/dist/diagrams/DiagramToolbar/DiagramToolbar.js +53 -0
  493. package/dist/diagrams/DiagramToolbar/DiagramToolbar.js.map +1 -0
  494. package/dist/diagrams/LifecycleFigure/LifecycleFigure.d.ts +31 -0
  495. package/dist/diagrams/LifecycleFigure/LifecycleFigure.js +234 -0
  496. package/dist/diagrams/LifecycleFigure/LifecycleFigure.js.map +1 -0
  497. package/dist/diagrams/SequenceFigure/SequenceFigure.d.ts +38 -0
  498. package/dist/diagrams/SequenceFigure/SequenceFigure.js +261 -0
  499. package/dist/diagrams/SequenceFigure/SequenceFigure.js.map +1 -0
  500. package/dist/diagrams/WorkflowFigure/WorkflowFigure.d.ts +36 -0
  501. package/dist/diagrams/WorkflowFigure/WorkflowFigure.js +259 -0
  502. package/dist/diagrams/WorkflowFigure/WorkflowFigure.js.map +1 -0
  503. package/dist/diagrams/index.d.ts +17 -0
  504. package/dist/diagrams/index.js +29 -0
  505. package/dist/diagrams/index.js.map +1 -0
  506. package/dist/diagrams/lib/dev.d.ts +61 -0
  507. package/dist/diagrams/lib/dev.js +96 -0
  508. package/dist/diagrams/lib/dev.js.map +1 -0
  509. package/dist/diagrams/lib/frame.d.ts +138 -0
  510. package/dist/diagrams/lib/frame.js +131 -0
  511. package/dist/diagrams/lib/frame.js.map +1 -0
  512. package/dist/diagrams/lib/geometry.d.ts +114 -0
  513. package/dist/diagrams/lib/geometry.js +113 -0
  514. package/dist/diagrams/lib/geometry.js.map +1 -0
  515. package/dist/diagrams/lib/legend.d.ts +32 -0
  516. package/dist/diagrams/lib/legend.js +84 -0
  517. package/dist/diagrams/lib/legend.js.map +1 -0
  518. package/dist/diagrams/lib/marks.d.ts +207 -0
  519. package/dist/diagrams/lib/marks.js +480 -0
  520. package/dist/diagrams/lib/marks.js.map +1 -0
  521. package/dist/diagrams/lib/route.d.ts +106 -0
  522. package/dist/diagrams/lib/route.js +201 -0
  523. package/dist/diagrams/lib/route.js.map +1 -0
  524. package/dist/diagrams/lib/wires.d.ts +59 -0
  525. package/dist/diagrams/lib/wires.js +94 -0
  526. package/dist/diagrams/lib/wires.js.map +1 -0
  527. package/dist/diagrams/spec.d.ts +405 -0
  528. package/dist/diagrams/spec.js +1 -0
  529. package/dist/diagrams/spec.js.map +1 -0
  530. package/dist/fonts/hanken-grotesk-300.woff2 +0 -0
  531. package/dist/fonts/hanken-grotesk-400.woff2 +0 -0
  532. package/dist/fonts/hanken-grotesk-500.woff2 +0 -0
  533. package/dist/fonts/hanken-grotesk-600.woff2 +0 -0
  534. package/dist/fonts/hanken-grotesk-700.woff2 +0 -0
  535. package/dist/fonts/ibm-plex-mono-400.woff2 +0 -0
  536. package/dist/fonts/ibm-plex-mono-500.woff2 +0 -0
  537. package/dist/fonts/ibm-plex-mono-600.woff2 +0 -0
  538. package/dist/fonts/newsreader-300.woff2 +0 -0
  539. package/dist/fonts/newsreader-400.woff2 +0 -0
  540. package/dist/fonts/newsreader-500.woff2 +0 -0
  541. package/dist/fonts/newsreader-600.woff2 +0 -0
  542. package/dist/fonts.css +96 -0
  543. package/dist/index.d.ts +97 -0
  544. package/dist/index.js +80 -0
  545. package/dist/index.js.map +1 -0
  546. package/dist/keyframes.css +300 -0
  547. package/dist/lib/cn.d.ts +21 -0
  548. package/dist/lib/cn.js +9 -0
  549. package/dist/lib/cn.js.map +1 -0
  550. package/dist/lib/color.d.ts +80 -0
  551. package/dist/lib/color.js +189 -0
  552. package/dist/lib/color.js.map +1 -0
  553. package/dist/lib/control.d.ts +32 -0
  554. package/dist/lib/control.js +14 -0
  555. package/dist/lib/control.js.map +1 -0
  556. package/dist/lib/index.d.ts +4 -0
  557. package/dist/lib/index.js +11 -0
  558. package/dist/lib/index.js.map +1 -0
  559. package/dist/lib/numeric.d.ts +35 -0
  560. package/dist/lib/numeric.js +29 -0
  561. package/dist/lib/numeric.js.map +1 -0
  562. package/dist/lib/overlay-container.d.ts +48 -0
  563. package/dist/lib/overlay-container.js +15 -0
  564. package/dist/lib/overlay-container.js.map +1 -0
  565. package/dist/lib/slot-content.d.ts +8 -0
  566. package/dist/lib/slot-content.js +17 -0
  567. package/dist/lib/slot-content.js.map +1 -0
  568. package/dist/lib/step-rail.d.ts +45 -0
  569. package/dist/lib/step-rail.js +47 -0
  570. package/dist/lib/step-rail.js.map +1 -0
  571. package/dist/lib/svg-export.d.ts +138 -0
  572. package/dist/lib/svg-export.js +198 -0
  573. package/dist/lib/svg-export.js.map +1 -0
  574. package/dist/lib/useClipboardCopy.d.ts +30 -0
  575. package/dist/lib/useClipboardCopy.js +37 -0
  576. package/dist/lib/useClipboardCopy.js.map +1 -0
  577. package/dist/lib/useSelectionIndicator.d.ts +29 -0
  578. package/dist/lib/useSelectionIndicator.js +49 -0
  579. package/dist/lib/useSelectionIndicator.js.map +1 -0
  580. package/dist/lib/warn.d.ts +73 -0
  581. package/dist/lib/warn.js +38 -0
  582. package/dist/lib/warn.js.map +1 -0
  583. package/dist/semantic.css +193 -0
  584. package/dist/styles.css +98 -0
  585. package/dist/themes.css +514 -0
  586. package/dist/tokens/brand.d.ts +47 -0
  587. package/dist/tokens/brand.js +38 -0
  588. package/dist/tokens/brand.js.map +1 -0
  589. package/dist/tokens.css +652 -0
  590. package/dist/tokens.d.ts +198 -0
  591. package/dist/tokens.js +1020 -0
  592. package/dist/tokens.json +1019 -0
  593. package/dist/website/Actions/Actions.d.ts +34 -0
  594. package/dist/website/Actions/Actions.js +29 -0
  595. package/dist/website/Actions/Actions.js.map +1 -0
  596. package/dist/website/Collection/Collection.d.ts +128 -0
  597. package/dist/website/Collection/Collection.js +162 -0
  598. package/dist/website/Collection/Collection.js.map +1 -0
  599. package/dist/website/Contact/Contact.d.ts +87 -0
  600. package/dist/website/Contact/Contact.js +94 -0
  601. package/dist/website/Contact/Contact.js.map +1 -0
  602. package/dist/website/Content/CodePanel.d.ts +27 -0
  603. package/dist/website/Content/CodePanel.js +30 -0
  604. package/dist/website/Content/CodePanel.js.map +1 -0
  605. package/dist/website/Content/Content.d.ts +29 -0
  606. package/dist/website/Content/Content.js +38 -0
  607. package/dist/website/Content/Content.js.map +1 -0
  608. package/dist/website/Conversation/Conversation.d.ts +193 -0
  609. package/dist/website/Conversation/Conversation.js +252 -0
  610. package/dist/website/Conversation/Conversation.js.map +1 -0
  611. package/dist/website/Evidence/Evidence.d.ts +116 -0
  612. package/dist/website/Evidence/Evidence.js +142 -0
  613. package/dist/website/Evidence/Evidence.js.map +1 -0
  614. package/dist/website/Media/Media.d.ts +173 -0
  615. package/dist/website/Media/Media.js +225 -0
  616. package/dist/website/Media/Media.js.map +1 -0
  617. package/dist/website/Media/MediaLightbox.d.ts +18 -0
  618. package/dist/website/Media/MediaLightbox.js +38 -0
  619. package/dist/website/Media/MediaLightbox.js.map +1 -0
  620. package/dist/website/Metrics/Metrics.d.ts +74 -0
  621. package/dist/website/Metrics/Metrics.js +96 -0
  622. package/dist/website/Metrics/Metrics.js.map +1 -0
  623. package/dist/website/Music/Music.d.ts +60 -0
  624. package/dist/website/Music/Music.js +80 -0
  625. package/dist/website/Music/Music.js.map +1 -0
  626. package/dist/website/Portfolio/FrameLayout.d.ts +9 -0
  627. package/dist/website/Portfolio/FrameLayout.js +42 -0
  628. package/dist/website/Portfolio/FrameLayout.js.map +1 -0
  629. package/dist/website/Portfolio/Portfolio.d.ts +49 -0
  630. package/dist/website/Portfolio/Portfolio.js +66 -0
  631. package/dist/website/Portfolio/Portfolio.js.map +1 -0
  632. package/dist/website/Portfolio/QuestionCard.d.ts +22 -0
  633. package/dist/website/Portfolio/QuestionCard.js +33 -0
  634. package/dist/website/Portfolio/QuestionCard.js.map +1 -0
  635. package/dist/website/PortfolioIndex/PortfolioIndex.d.ts +21 -0
  636. package/dist/website/PortfolioIndex/PortfolioIndex.js +31 -0
  637. package/dist/website/PortfolioIndex/PortfolioIndex.js.map +1 -0
  638. package/dist/website/Reading/Reading.d.ts +203 -0
  639. package/dist/website/Reading/Reading.js +357 -0
  640. package/dist/website/Reading/Reading.js.map +1 -0
  641. package/dist/website/Recovery/Recovery.d.ts +39 -0
  642. package/dist/website/Recovery/Recovery.js +96 -0
  643. package/dist/website/Recovery/Recovery.js.map +1 -0
  644. package/dist/website/SearchPalette/SearchPalette.d.ts +59 -0
  645. package/dist/website/SearchPalette/SearchPalette.js +120 -0
  646. package/dist/website/SearchPalette/SearchPalette.js.map +1 -0
  647. package/dist/website/SiteNavigation/SiteNavigation.d.ts +46 -0
  648. package/dist/website/SiteNavigation/SiteNavigation.js +101 -0
  649. package/dist/website/SiteNavigation/SiteNavigation.js.map +1 -0
  650. package/dist/website/SiteShell/SiteShell.d.ts +45 -0
  651. package/dist/website/SiteShell/SiteShell.js +46 -0
  652. package/dist/website/SiteShell/SiteShell.js.map +1 -0
  653. package/dist/website/Timeline/Timeline.d.ts +80 -0
  654. package/dist/website/Timeline/Timeline.js +99 -0
  655. package/dist/website/Timeline/Timeline.js.map +1 -0
  656. package/dist/website/index.d.ts +27 -0
  657. package/dist/website/index.js +21 -0
  658. package/dist/website/index.js.map +1 -0
  659. package/dist/website-actions.css +6 -0
  660. package/dist/website-base.css +46 -0
  661. package/dist/website-collection.css +89 -0
  662. package/dist/website-contact.css +29 -0
  663. package/dist/website-content.css +17 -0
  664. package/dist/website-controls.css +91 -0
  665. package/dist/website-conversation.css +115 -0
  666. package/dist/website-evidence.css +56 -0
  667. package/dist/website-media.css +227 -0
  668. package/dist/website-metrics.css +15 -0
  669. package/dist/website-music.css +27 -0
  670. package/dist/website-portfolio.css +94 -0
  671. package/dist/website-reading.css +159 -0
  672. package/dist/website-recovery.css +28 -0
  673. package/dist/website-search.css +26 -0
  674. package/dist/website-shell.css +89 -0
  675. package/dist/website-timeline.css +43 -0
  676. package/dist/website.css +25 -0
  677. package/llms.txt +35 -0
  678. package/package.json +163 -5
  679. package/skills/folio-design/SKILL.md +228 -0
  680. package/skills/folio-design/evals/claims.json +95 -0
  681. package/skills/folio-design/evals/evals.json +84 -0
  682. package/skills/folio-design/rules/a11y.md +167 -0
  683. package/skills/folio-design/rules/composition.md +108 -0
  684. package/skills/folio-design/rules/forms.md +135 -0
  685. package/skills/folio-design/rules/naming.md +155 -0
  686. package/skills/folio-design/rules/tokens.md +133 -0
@@ -0,0 +1,189 @@
1
+ const clamp = (n, min = 0, max = 1) => Math.max(min, Math.min(max, n));
2
+ const wrapHue = (h) => (h % 360 + 360) % 360;
3
+ const multiply = (m, v) => m.map((row) => row.reduce((n, x, i) => n + x * (v[i] ?? 0), 0));
4
+ const linearize = (v) => Math.abs(v) <= 0.04045 ? v / 12.92 : Math.sign(v) * ((Math.abs(v) + 0.055) / 1.055) ** 2.4;
5
+ const encode = (v) => Math.abs(v) <= 31308e-7 ? 12.92 * v : Math.sign(v) * (1.055 * Math.abs(v) ** (1 / 2.4) - 0.055);
6
+ const RGB_XYZ = [
7
+ [0.4123907993, 0.3575843394, 0.1804807884],
8
+ [0.2126390059, 0.7151686788, 0.0721923154],
9
+ [0.0193308187, 0.1191947798, 0.9505321522]
10
+ ];
11
+ const P3_XYZ = [
12
+ [0.4865709486, 0.2656676932, 0.1982172852],
13
+ [0.2289745641, 0.6917385218, 0.0792869141],
14
+ [0, 0.0451133819, 1.0439443689]
15
+ ];
16
+ const XYZ_RGB = [
17
+ [3.2409699419, -1.5373831776, -0.4986107603],
18
+ [-0.9692436363, 1.8759675015, 0.0415550574],
19
+ [0.0556300797, -0.2039769589, 1.0569715142]
20
+ ];
21
+ const XYZ_P3 = [
22
+ [2.4934969119, -0.9313836179, -0.4027107845],
23
+ [-0.8294889696, 1.7626640603, 0.0236246858],
24
+ [0.0358458302, -0.0761723893, 0.956884524]
25
+ ];
26
+ const XYZ_LMS = [
27
+ [0.819022438, 0.3619062601, -0.1288737815],
28
+ [0.0329836539, 0.9292868616, 0.0361446664],
29
+ [0.0481771894, 0.2642395318, 0.6335478285]
30
+ ];
31
+ const LMS_XYZ = [
32
+ [1.2268798734, -0.5578149966, 0.2813910502],
33
+ [-0.0405757626, 1.1122868294, -0.0717110667],
34
+ [-0.0763729497, -0.421493324, 1.5869240244]
35
+ ];
36
+ function rgbToColor(rgb, a = 1, space = "srgb") {
37
+ const xyz = multiply(space === "p3" ? P3_XYZ : RGB_XYZ, rgb.map(linearize));
38
+ const [l, m, s] = multiply(XYZ_LMS, xyz).map(Math.cbrt);
39
+ const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
40
+ const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
41
+ const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
42
+ const c = Math.hypot(A, B);
43
+ const grey = c < 1e-7;
44
+ return {
45
+ l: clamp(L),
46
+ c: grey ? 0 : c,
47
+ h: grey ? 0 : wrapHue(Math.atan2(B, A) * 180 / Math.PI),
48
+ a: clamp(a)
49
+ };
50
+ }
51
+ function colorToRgb(color, space = "srgb") {
52
+ const a = color.c * Math.cos(color.h * Math.PI / 180);
53
+ const b = color.c * Math.sin(color.h * Math.PI / 180);
54
+ const lms = [
55
+ (color.l + 0.3963377774 * a + 0.2158037573 * b) ** 3,
56
+ (color.l - 0.1055613458 * a - 0.0638541728 * b) ** 3,
57
+ (color.l - 0.0894841775 * a - 1.291485548 * b) ** 3
58
+ ];
59
+ return multiply(space === "p3" ? XYZ_P3 : XYZ_RGB, multiply(LMS_XYZ, lms)).map(encode);
60
+ }
61
+ function inGamut(color, space = "srgb") {
62
+ return colorToRgb(color, space).every((n) => n >= -1e-5 && n <= 1.00001);
63
+ }
64
+ function fitGamut(color, space = "srgb") {
65
+ if (inGamut(color, space)) return color;
66
+ let lo = 0;
67
+ let hi = color.c;
68
+ for (let i = 0; i < 20; i++) {
69
+ const mid = (lo + hi) / 2;
70
+ if (inGamut({ ...color, c: mid }, space)) lo = mid;
71
+ else hi = mid;
72
+ }
73
+ return { ...color, c: lo };
74
+ }
75
+ function maxChroma(l, h, space = "srgb") {
76
+ if (l <= 0 || l >= 1) return 0;
77
+ return fitGamut({ l, c: 0.5, h, a: 1 }, space).c;
78
+ }
79
+ function colorFormat(value) {
80
+ const text = value.trim();
81
+ if (/^oklch\(/i.test(text)) return "oklch";
82
+ if (/^color\(display-p3\s/i.test(text)) return "p3";
83
+ return "hex";
84
+ }
85
+ const round = (v, digits = 4) => Number(v.toFixed(digits));
86
+ function formatColor(color, format) {
87
+ const alpha = color.a < 1 ? ` / ${round(color.a)}` : "";
88
+ if (format === "oklch") {
89
+ return `oklch(${round(color.l)} ${round(color.c)} ${round(color.h, 2)}${alpha})`;
90
+ }
91
+ const space = format === "p3" ? "p3" : "srgb";
92
+ const rgb = colorToRgb(fitGamut(color, space), space);
93
+ if (format === "p3") {
94
+ return `color(display-p3 ${rgb.map((n) => round(clamp(n), 5)).join(" ")}${alpha})`;
95
+ }
96
+ const bytes = rgb.map((n) => Math.round(clamp(n) * 255));
97
+ if (color.a < 1) bytes.push(Math.round(color.a * 255));
98
+ return `#${bytes.map((n) => n.toString(16).padStart(2, "0")).join("")}`;
99
+ }
100
+ const NUMBER = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|deg|grad|rad|turn)?$/i;
101
+ function number(value, percentScale = 1, hue = false) {
102
+ const match = NUMBER.exec(value);
103
+ if (!match) return null;
104
+ const n = parseFloat(value);
105
+ if (!Number.isFinite(n)) return null;
106
+ const unit = match[1]?.toLowerCase();
107
+ if (hue) {
108
+ if (unit === "rad") return n * 180 / Math.PI;
109
+ if (unit === "turn") return n * 360;
110
+ if (unit === "grad") return n * 0.9;
111
+ return !unit || unit === "deg" ? n : null;
112
+ }
113
+ if (unit === "%") return n * percentScale / 100;
114
+ return unit ? null : n;
115
+ }
116
+ function parseColor(value) {
117
+ const text = value.trim().toLowerCase();
118
+ if (text === "transparent") return { l: 0, c: 0, h: 0, a: 0 };
119
+ if (/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/.test(text)) {
120
+ const short = text.slice(1);
121
+ const hex = short.length <= 4 ? [...short].map((c) => c + c).join("") : short;
122
+ const bytes = (hex.match(/../g) ?? []).map((c) => parseInt(c, 16) / 255);
123
+ return rgbToColor(bytes.slice(0, 3), bytes[3] ?? 1);
124
+ }
125
+ const match = /^(oklch|rgb|rgba|hsl|hsla|color)\(([^()]*)\)$/.exec(text);
126
+ if (!match) return null;
127
+ const kind = match[1] ?? "";
128
+ let body = (match[2] ?? "").trim();
129
+ const p3 = kind === "color";
130
+ if (p3) {
131
+ if (!body.startsWith("display-p3 ")) return null;
132
+ body = body.slice(11).trim();
133
+ }
134
+ const legacy = body.includes(",");
135
+ if (legacy && (p3 || kind === "oklch" || body.includes("/"))) return null;
136
+ const parts = legacy ? body.split(",").map((x) => x.trim()) : body.split(/\s*\/\s*/);
137
+ if (!legacy && parts.length > 2) return null;
138
+ const channels = legacy ? parts.slice(0, 3) : (parts[0] ?? "").split(/\s+/);
139
+ if (channels.length !== 3) return null;
140
+ if (legacy && parts.length !== 3 && parts.length !== 4) return null;
141
+ if (legacy && kind.startsWith("rgb") && channels.some((c) => c.endsWith("%")) && !channels.every((c) => c.endsWith("%"))) {
142
+ return null;
143
+ }
144
+ const alphaText = legacy ? parts[3] : parts[1];
145
+ const alpha = alphaText === void 0 ? 1 : number(alphaText);
146
+ if (alpha === null) return null;
147
+ if (kind === "oklch") {
148
+ const l = number(channels[0] ?? "");
149
+ const c = number(channels[1] ?? "", 0.4);
150
+ const h = number(channels[2] ?? "", 1, true);
151
+ if (l === null || c === null || h === null) return null;
152
+ return { l: clamp(l), c: Math.max(0, c), h: wrapHue(h), a: clamp(alpha) };
153
+ }
154
+ if (kind.startsWith("hsl")) {
155
+ const h = number(channels[0] ?? "", 1, true);
156
+ const s = number(channels[1] ?? "");
157
+ const l = number(channels[2] ?? "");
158
+ if (h === null || s === null || l === null) return null;
159
+ if (!channels[1]?.endsWith("%") || !channels[2]?.endsWith("%")) return null;
160
+ const sat = clamp(s);
161
+ const light = clamp(l);
162
+ const amount = sat * Math.min(light, 1 - light);
163
+ const channel = (n) => {
164
+ const k = (n + wrapHue(h) / 30) % 12;
165
+ return light - amount * Math.max(-1, Math.min(k - 3, 9 - k, 1));
166
+ };
167
+ return rgbToColor([channel(0), channel(8), channel(4)], alpha);
168
+ }
169
+ const values = channels.map((c) => number(c, p3 ? 1 : 255));
170
+ if (values.some((n) => n === null)) return null;
171
+ return rgbToColor(
172
+ values.map((n) => p3 ? n ?? 0 : clamp((n ?? 0) / 255)),
173
+ alpha,
174
+ p3 ? "p3" : "srgb"
175
+ );
176
+ }
177
+ export {
178
+ clamp,
179
+ colorFormat,
180
+ colorToRgb,
181
+ fitGamut,
182
+ formatColor,
183
+ inGamut,
184
+ maxChroma,
185
+ parseColor,
186
+ rgbToColor,
187
+ wrapHue
188
+ };
189
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/color.ts"],"sourcesContent":["/**\n * CSS colour maths, with no dependency and no DOM.\n *\n * Adapted from DialKit (https://github.com/joshpuckett/dialkit), MIT licensed:\n *\n * Copyright (c) 2026 Josh Puckett\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * The working space is OKLCH, and that is the substantive choice here rather\n * than an implementation detail. A picker built on HSV hands a reader two\n * colours at the same \"lightness\" where one of them is visibly darker, because\n * HSV's lightness is a property of the numbers rather than of the eye. Every\n * decision in `ColorPicker` — where the handle sits, what the hue strip looks\n * like at this lightness, which colours are reachable at all — depends on a\n * space that is perceptually uniform, and OKLCH is the one CSS ships.\n *\n * The matrices are the CSS Color 4 reference implementation's, D65.\n * https://www.w3.org/TR/css-color-4/#color-conversion-code\n */\n\n/** A colour in OKLCH: lightness 0–1, chroma, hue in degrees, alpha 0–1. */\nexport interface Color {\n l: number\n c: number\n h: number\n a: number\n}\n\n/** The notations this module reads and writes. */\nexport type ColorFormat = 'hex' | 'oklch' | 'p3'\n\n/** The two RGB gamuts a colour can be fitted to. */\nexport type ColorSpace = 'srgb' | 'p3'\n\ntype Triple = [number, number, number]\n\nexport const clamp = (n: number, min = 0, max = 1) => Math.max(min, Math.min(max, n))\n\nexport const wrapHue = (h: number) => ((h % 360) + 360) % 360\n\nconst multiply = (m: number[][], v: Triple): Triple =>\n m.map((row) => row.reduce((n, x, i) => n + x * (v[i] ?? 0), 0)) as Triple\n\n/** sRGB transfer function, undone. Signed, so an out-of-gamut channel survives. */\nconst linearize = (v: number) =>\n Math.abs(v) <= 0.04045 ? v / 12.92 : Math.sign(v) * ((Math.abs(v) + 0.055) / 1.055) ** 2.4\n\nconst encode = (v: number) =>\n Math.abs(v) <= 0.0031308 ? 12.92 * v : Math.sign(v) * (1.055 * Math.abs(v) ** (1 / 2.4) - 0.055)\n\nconst RGB_XYZ = [\n [0.4123907993, 0.3575843394, 0.1804807884],\n [0.2126390059, 0.7151686788, 0.0721923154],\n [0.0193308187, 0.1191947798, 0.9505321522],\n]\nconst P3_XYZ = [\n [0.4865709486, 0.2656676932, 0.1982172852],\n [0.2289745641, 0.6917385218, 0.0792869141],\n [0, 0.0451133819, 1.0439443689],\n]\nconst XYZ_RGB = [\n [3.2409699419, -1.5373831776, -0.4986107603],\n [-0.9692436363, 1.8759675015, 0.0415550574],\n [0.0556300797, -0.2039769589, 1.0569715142],\n]\nconst XYZ_P3 = [\n [2.4934969119, -0.9313836179, -0.4027107845],\n [-0.8294889696, 1.7626640603, 0.0236246858],\n [0.0358458302, -0.0761723893, 0.956884524],\n]\nconst XYZ_LMS = [\n [0.819022438, 0.3619062601, -0.1288737815],\n [0.0329836539, 0.9292868616, 0.0361446664],\n [0.0481771894, 0.2642395318, 0.6335478285],\n]\nconst LMS_XYZ = [\n [1.2268798734, -0.5578149966, 0.2813910502],\n [-0.0405757626, 1.1122868294, -0.0717110667],\n [-0.0763729497, -0.421493324, 1.5869240244],\n]\n\n/** Gamma-encoded RGB in 0–1 to OKLCH. */\nexport function rgbToColor(rgb: Triple, a = 1, space: ColorSpace = 'srgb'): Color {\n const xyz = multiply(space === 'p3' ? P3_XYZ : RGB_XYZ, rgb.map(linearize) as Triple)\n const [l, m, s] = multiply(XYZ_LMS, xyz).map(Math.cbrt) as Triple\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s\n const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s\n const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s\n const c = Math.hypot(A, B)\n // Below the threshold the hue is the angle of rounding error, not a hue. Left\n // in, a slider dragged to pure white would spin the strip through 360°.\n const grey = c < 1e-7\n return {\n l: clamp(L),\n c: grey ? 0 : c,\n h: grey ? 0 : wrapHue((Math.atan2(B, A) * 180) / Math.PI),\n a: clamp(a),\n }\n}\n\n/** OKLCH to gamma-encoded RGB in 0–1. May fall outside it — see `fitGamut`. */\nexport function colorToRgb(color: Color, space: ColorSpace = 'srgb'): Triple {\n const a = color.c * Math.cos((color.h * Math.PI) / 180)\n const b = color.c * Math.sin((color.h * Math.PI) / 180)\n const lms: Triple = [\n (color.l + 0.3963377774 * a + 0.2158037573 * b) ** 3,\n (color.l - 0.1055613458 * a - 0.0638541728 * b) ** 3,\n (color.l - 0.0894841775 * a - 1.291485548 * b) ** 3,\n ]\n return multiply(space === 'p3' ? XYZ_P3 : XYZ_RGB, multiply(LMS_XYZ, lms)).map(encode) as Triple\n}\n\nexport function inGamut(color: Color, space: ColorSpace = 'srgb'): boolean {\n return colorToRgb(color, space).every((n) => n >= -0.00001 && n <= 1.00001)\n}\n\n/**\n * Brings a colour inside a gamut by giving up CHROMA, and nothing else.\n *\n * The naive fix is to clip each channel at 0 and 1, which changes the hue and\n * the lightness together — a vivid blue clipped that way comes back purple and\n * darker. Bisecting on chroma keeps both, so what a reader loses is only the\n * saturation the display could never have shown them.\n */\nexport function fitGamut(color: Color, space: ColorSpace = 'srgb'): Color {\n if (inGamut(color, space)) return color\n let lo = 0\n let hi = color.c\n // Twenty halvings of a chroma under 0.5 lands well inside a 24-bit step.\n for (let i = 0; i < 20; i++) {\n const mid = (lo + hi) / 2\n if (inGamut({ ...color, c: mid }, space)) lo = mid\n else hi = mid\n }\n return { ...color, c: lo }\n}\n\n/** The most chroma a gamut holds at this lightness and hue — the plane's edge. */\nexport function maxChroma(l: number, h: number, space: ColorSpace = 'srgb'): number {\n if (l <= 0 || l >= 1) return 0\n return fitGamut({ l, c: 0.5, h, a: 1 }, space).c\n}\n\n/** Which notation a string is written in. Anything unrecognised reads as hex. */\nexport function colorFormat(value: string): ColorFormat {\n const text = value.trim()\n if (/^oklch\\(/i.test(text)) return 'oklch'\n if (/^color\\(display-p3\\s/i.test(text)) return 'p3'\n return 'hex'\n}\n\nconst round = (v: number, digits = 4) => Number(v.toFixed(digits))\n\n/**\n * A colour as a CSS string.\n *\n * Hex and Display P3 are bounded output spaces, so the colour is fitted on the\n * way out; OKLCH is not, and writing an out-of-gamut OKLCH is legitimate — the\n * browser fits it to whatever the display actually has.\n */\nexport function formatColor(color: Color, format: ColorFormat): string {\n const alpha = color.a < 1 ? ` / ${round(color.a)}` : ''\n if (format === 'oklch') {\n return `oklch(${round(color.l)} ${round(color.c)} ${round(color.h, 2)}${alpha})`\n }\n const space: ColorSpace = format === 'p3' ? 'p3' : 'srgb'\n const rgb = colorToRgb(fitGamut(color, space), space)\n if (format === 'p3') {\n return `color(display-p3 ${rgb.map((n) => round(clamp(n), 5)).join(' ')}${alpha})`\n }\n const bytes = rgb.map((n) => Math.round(clamp(n) * 255))\n if (color.a < 1) bytes.push(Math.round(color.a * 255))\n return `#${bytes.map((n) => n.toString(16).padStart(2, '0')).join('')}`\n}\n\nconst NUMBER = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?(%|deg|grad|rad|turn)?$/i\n\n/** One CSS numeric token, in the unit its channel allows. */\nfunction number(value: string, percentScale = 1, hue = false): number | null {\n const match = NUMBER.exec(value)\n if (!match) return null\n const n = parseFloat(value)\n if (!Number.isFinite(n)) return null\n const unit = match[1]?.toLowerCase()\n if (hue) {\n if (unit === 'rad') return (n * 180) / Math.PI\n if (unit === 'turn') return n * 360\n if (unit === 'grad') return n * 0.9\n return !unit || unit === 'deg' ? n : null\n }\n if (unit === '%') return (n * percentScale) / 100\n return unit ? null : n\n}\n\n/**\n * An absolute CSS colour as OKLCH, or `null` when the string is not one.\n *\n * Hex, `rgb()`, `hsl()`, `oklch()` and `color(display-p3 …)`, in both the\n * comma and the space syntax. Named colours are deliberately absent: resolving\n * them needs a table of a hundred and forty-eight entries or a DOM, and a\n * picker that accepts \"rebeccapurple\" but not \"papayawhip\" is worse than one\n * that accepts neither.\n */\nexport function parseColor(value: string): Color | null {\n const text = value.trim().toLowerCase()\n if (text === 'transparent') return { l: 0, c: 0, h: 0, a: 0 }\n\n if (/^#(?:[\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$/.test(text)) {\n const short = text.slice(1)\n const hex = short.length <= 4 ? [...short].map((c) => c + c).join('') : short\n const bytes = (hex.match(/../g) ?? []).map((c) => parseInt(c, 16) / 255)\n return rgbToColor(bytes.slice(0, 3) as Triple, bytes[3] ?? 1)\n }\n\n const match = /^(oklch|rgb|rgba|hsl|hsla|color)\\(([^()]*)\\)$/.exec(text)\n if (!match) return null\n const kind = match[1] ?? ''\n let body = (match[2] ?? '').trim()\n\n const p3 = kind === 'color'\n if (p3) {\n if (!body.startsWith('display-p3 ')) return null\n body = body.slice(11).trim()\n }\n\n // The comma syntax is the legacy one, and it never applied to `oklch()` or\n // `color()`; mixing it with the modern `/` alpha is not a colour either.\n const legacy = body.includes(',')\n if (legacy && (p3 || kind === 'oklch' || body.includes('/'))) return null\n\n const parts = legacy ? body.split(',').map((x) => x.trim()) : body.split(/\\s*\\/\\s*/)\n if (!legacy && parts.length > 2) return null\n const channels = legacy ? parts.slice(0, 3) : (parts[0] ?? '').split(/\\s+/)\n if (channels.length !== 3) return null\n if (legacy && parts.length !== 3 && parts.length !== 4) return null\n // Legacy rgb() is all percentages or all numbers, never a mixture.\n if (\n legacy &&\n kind.startsWith('rgb') &&\n channels.some((c) => c.endsWith('%')) &&\n !channels.every((c) => c.endsWith('%'))\n ) {\n return null\n }\n\n const alphaText = legacy ? parts[3] : parts[1]\n const alpha = alphaText === undefined ? 1 : number(alphaText)\n if (alpha === null) return null\n\n if (kind === 'oklch') {\n const l = number(channels[0] ?? '')\n // 100% chroma is 0.4 by the specification, not 1.\n const c = number(channels[1] ?? '', 0.4)\n const h = number(channels[2] ?? '', 1, true)\n if (l === null || c === null || h === null) return null\n return { l: clamp(l), c: Math.max(0, c), h: wrapHue(h), a: clamp(alpha) }\n }\n\n if (kind.startsWith('hsl')) {\n const h = number(channels[0] ?? '', 1, true)\n const s = number(channels[1] ?? '')\n const l = number(channels[2] ?? '')\n if (h === null || s === null || l === null) return null\n if (!channels[1]?.endsWith('%') || !channels[2]?.endsWith('%')) return null\n const sat = clamp(s)\n const light = clamp(l)\n const amount = sat * Math.min(light, 1 - light)\n const channel = (n: number) => {\n const k = (n + wrapHue(h) / 30) % 12\n return light - amount * Math.max(-1, Math.min(k - 3, 9 - k, 1))\n }\n return rgbToColor([channel(0), channel(8), channel(4)], alpha)\n }\n\n const values = channels.map((c) => number(c, p3 ? 1 : 255))\n if (values.some((n) => n === null)) return null\n return rgbToColor(\n values.map((n) => (p3 ? (n ?? 0) : clamp((n ?? 0) / 255))) as Triple,\n alpha,\n p3 ? 'p3' : 'srgb',\n )\n}\n"],"mappings":"AA6CO,MAAM,QAAQ,CAAC,GAAW,MAAM,GAAG,MAAM,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC;AAE7E,MAAM,UAAU,CAAC,OAAgB,IAAI,MAAO,OAAO;AAE1D,MAAM,WAAW,CAAC,GAAe,MAC/B,EAAE,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC;AAGhE,MAAM,YAAY,CAAC,MACjB,KAAK,IAAI,CAAC,KAAK,UAAU,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,SAAS,UAAU;AAEzF,MAAM,SAAS,CAAC,MACd,KAAK,IAAI,CAAC,KAAK,WAAY,QAAQ,IAAI,KAAK,KAAK,CAAC,KAAK,QAAQ,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO;AAE5F,MAAM,UAAU;AAAA,EACd,CAAC,cAAc,cAAc,YAAY;AAAA,EACzC,CAAC,cAAc,cAAc,YAAY;AAAA,EACzC,CAAC,cAAc,cAAc,YAAY;AAC3C;AACA,MAAM,SAAS;AAAA,EACb,CAAC,cAAc,cAAc,YAAY;AAAA,EACzC,CAAC,cAAc,cAAc,YAAY;AAAA,EACzC,CAAC,GAAG,cAAc,YAAY;A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AAM,CAAC;AACnB,UAAM,QAAQ,MAAM,CAAC;AACrB,UAAM,SAAS,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK;AAC9C,UAAM,UAAU,CAAC,MAAc;AAC7B,YAAM,KAAK,IAAI,QAAQ,CAAC,IAAI,MAAM;AAClC,aAAO,QAAQ,SAAS,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;AAAA,IAChE;AACA,WAAO,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,KAAK;AAAA,EAC/D;AAEA,QAAM,SAAS,SAAS,IAAI,CAAC,MAAM,OAAO,GAAG,KAAK,IAAI,GAAG,CAAC;AAC1D,MAAI,OAAO,KAAK,CAAC,MAAM,MAAM,IAAI,EAAG,QAAO;AAC3C,SAAO;AAAA,IACL,OAAO,IAAI,CAAC,MAAO,KAAM,KAAK,IAAK,OAAO,KAAK,KAAK,GAAG,CAAE;AAAA,IACzD;AAAA,IACA,KAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The one text-control look, shared by Input, Textarea and Select.
3
+ *
4
+ * These three had each carried their own copy of the class string. Three copies
5
+ * drift: the padding stayed in step, but the focus treatment and the disabled
6
+ * opacity did not, and a form ended up with a select that dimmed differently
7
+ * from the input beside it. One export, three consumers.
8
+ *
9
+ * The padding comes from the density tokens, so a subtree marked
10
+ * `data-density="compact"` tightens its fields along with its buttons.
11
+ * Mobile text stays at 16px so iOS does not zoom the viewport on focus.
12
+ *
13
+ * The border COLOUR is deliberately not in here. It is toggled per control so
14
+ * the invalid state reliably wins over the resting border rather than relying
15
+ * on which utility Tailwind happened to emit last.
16
+ */
17
+ declare const CONTROL_BASE = "min-h-(--control-h-md) w-full rounded-(--radius) border bg-(--paper) px-(--field-px) py-(--field-py) text-base md:text-sm text-(--ink) transition-colors duration-(--duration-fast) placeholder:text-(--ink-3-aa) hover:border-(--rule-hard) focus:border-(--ink) disabled:opacity-(--disabled-opacity) disabled:pointer-events-none";
18
+ /** Resting vs invalid border, named so a call site never writes the colour. */
19
+ declare const CONTROL_BORDER: {
20
+ readonly resting: "border-(--rule-2)";
21
+ readonly invalid: "border-(--danger)";
22
+ };
23
+ /**
24
+ * Reads the invalid state from either spelling.
25
+ *
26
+ * `invalid` is the ergonomic prop; `aria-invalid` is what a form library sets.
27
+ * A control that honours only one of them silently loses the error styling for
28
+ * whichever half of the ecosystem it did not anticipate.
29
+ */
30
+ declare function isInvalid(invalid?: boolean, ariaInvalid?: boolean | 'true' | 'false' | string): boolean;
31
+
32
+ export { CONTROL_BASE, CONTROL_BORDER, isInvalid };
@@ -0,0 +1,14 @@
1
+ const CONTROL_BASE = "min-h-(--control-h-md) w-full rounded-(--radius) border bg-(--paper) px-(--field-px) py-(--field-py) text-base md:text-sm text-(--ink) transition-colors duration-(--duration-fast) placeholder:text-(--ink-3-aa) hover:border-(--rule-hard) focus:border-(--ink) disabled:opacity-(--disabled-opacity) disabled:pointer-events-none";
2
+ const CONTROL_BORDER = {
3
+ resting: "border-(--rule-2)",
4
+ invalid: "border-(--danger)"
5
+ };
6
+ function isInvalid(invalid, ariaInvalid) {
7
+ return invalid === true || ariaInvalid === true || ariaInvalid === "true";
8
+ }
9
+ export {
10
+ CONTROL_BASE,
11
+ CONTROL_BORDER,
12
+ isInvalid
13
+ };
14
+ //# sourceMappingURL=control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/control.ts"],"sourcesContent":["/**\n * The one text-control look, shared by Input, Textarea and Select.\n *\n * These three had each carried their own copy of the class string. Three copies\n * drift: the padding stayed in step, but the focus treatment and the disabled\n * opacity did not, and a form ended up with a select that dimmed differently\n * from the input beside it. One export, three consumers.\n *\n * The padding comes from the density tokens, so a subtree marked\n * `data-density=\"compact\"` tightens its fields along with its buttons.\n * Mobile text stays at 16px so iOS does not zoom the viewport on focus.\n *\n * The border COLOUR is deliberately not in here. It is toggled per control so\n * the invalid state reliably wins over the resting border rather than relying\n * on which utility Tailwind happened to emit last.\n */\nexport const CONTROL_BASE =\n 'min-h-(--control-h-md) w-full rounded-(--radius) border bg-(--paper) px-(--field-px) py-(--field-py) text-base md:text-sm text-(--ink) transition-colors duration-(--duration-fast) placeholder:text-(--ink-3-aa) hover:border-(--rule-hard) focus:border-(--ink) disabled:opacity-(--disabled-opacity) disabled:pointer-events-none'\n\n/** Resting vs invalid border, named so a call site never writes the colour. */\nexport const CONTROL_BORDER = {\n resting: 'border-(--rule-2)',\n invalid: 'border-(--danger)',\n} as const\n\n/**\n * Reads the invalid state from either spelling.\n *\n * `invalid` is the ergonomic prop; `aria-invalid` is what a form library sets.\n * A control that honours only one of them silently loses the error styling for\n * whichever half of the ecosystem it did not anticipate.\n */\nexport function isInvalid(invalid?: boolean, ariaInvalid?: boolean | 'true' | 'false' | string): boolean {\n return invalid === true || ariaInvalid === true || ariaInvalid === 'true'\n}\n"],"mappings":"AAgBO,MAAM,eACX;AAGK,MAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,SAAS;AACX;AASO,SAAS,UAAU,SAAmB,aAA4D;AACvG,SAAO,YAAY,QAAQ,gBAAgB,QAAQ,gBAAgB;AACrE;","names":[]}
@@ -0,0 +1,4 @@
1
+ export { cn } from './cn.js';
2
+ export { CONTROL_BASE, CONTROL_BORDER, isInvalid } from './control.js';
3
+ export { IndicatorStyle, useSelectionIndicator } from './useSelectionIndicator.js';
4
+ import 'clsx';
@@ -0,0 +1,11 @@
1
+ import { cn } from "./cn.js";
2
+ import { CONTROL_BASE, CONTROL_BORDER, isInvalid } from "./control.js";
3
+ import { useSelectionIndicator } from "./useSelectionIndicator.js";
4
+ export {
5
+ CONTROL_BASE,
6
+ CONTROL_BORDER,
7
+ cn,
8
+ isInvalid,
9
+ useSelectionIndicator
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["export { cn } from './cn'\nexport { CONTROL_BASE, CONTROL_BORDER, isInvalid } from './control'\nexport { useSelectionIndicator } from './useSelectionIndicator'\nexport type { IndicatorStyle } from './useSelectionIndicator'\n"],"mappings":"AAAA,SAAS,UAAU;AACnB,SAAS,cAAc,gBAAgB,iBAAiB;AACxD,SAAS,6BAA6B;","names":[]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The three things a numeric control has to do to a typed number, in one place.
3
+ *
4
+ * `Slider` and `NumberField` both take a number from a keyboard and both have
5
+ * to reconcile it with `min`, `max` and `step`. Written twice they drift, and
6
+ * they drift in the direction nobody tests: a slider that snaps 0.1 + 0.2 to
7
+ * `0.30000000000000004` and a field beside it that prints `0.3`.
8
+ *
9
+ * The step base is `min`, not zero, because that is what the HTML step
10
+ * algorithm uses — a range from 5 to 100 stepping by 10 lands on 15, not on 10.
11
+ */
12
+ /**
13
+ * Decimal places implied by a step.
14
+ *
15
+ * Snapping is arithmetic on binary floats, so a value that should be exactly
16
+ * one step from the last one usually is not. Rounding the result to the step's
17
+ * own precision is what stops that reaching a readout — and the step's own
18
+ * precision is the most a caller can have meant.
19
+ */
20
+ declare function decimalsForStep(step: number): number;
21
+ /** Rounds to the nearest step from `min`, at the step's own precision. */
22
+ declare function snapToStep(value: number, step: number, min?: number): number;
23
+ /** Holds a value inside a range. An inverted range yields its own lower bound. */
24
+ declare function clampToRange(value: number, min: number, max: number): number;
25
+ /**
26
+ * A typed string as a number, or `null` when it is not one yet.
27
+ *
28
+ * `null` rather than `NaN` because the caller has to tell "not a number" from
29
+ * "not finished being typed" and act the same way on both: leave the committed
30
+ * value alone. `Number('')` is `0`, which is the trap this exists for — an
31
+ * emptied box would otherwise commit zero on every keystroke that cleared it.
32
+ */
33
+ declare function parseNumber(text: string): number | null;
34
+
35
+ export { clampToRange, decimalsForStep, parseNumber, snapToStep };
@@ -0,0 +1,29 @@
1
+ function decimalsForStep(step) {
2
+ if (!Number.isFinite(step) || step <= 0) return 0;
3
+ const text = String(step);
4
+ const exponential = /e-(\d+)$/i.exec(text);
5
+ if (exponential) return Number(exponential[1]);
6
+ return text.split(".")[1]?.length ?? 0;
7
+ }
8
+ function snapToStep(value, step, min = 0) {
9
+ if (!Number.isFinite(step) || step <= 0) return value;
10
+ const base = Number.isFinite(min) ? min : 0;
11
+ const snapped = base + Math.round((value - base) / step) * step;
12
+ return Number(snapped.toFixed(decimalsForStep(step)));
13
+ }
14
+ function clampToRange(value, min, max) {
15
+ return Math.min(Math.max(value, min), max);
16
+ }
17
+ function parseNumber(text) {
18
+ const trimmed = text.trim();
19
+ if (trimmed === "") return null;
20
+ const value = Number(trimmed);
21
+ return Number.isFinite(value) ? value : null;
22
+ }
23
+ export {
24
+ clampToRange,
25
+ decimalsForStep,
26
+ parseNumber,
27
+ snapToStep
28
+ };
29
+ //# sourceMappingURL=numeric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/numeric.ts"],"sourcesContent":["/**\n * The three things a numeric control has to do to a typed number, in one place.\n *\n * `Slider` and `NumberField` both take a number from a keyboard and both have\n * to reconcile it with `min`, `max` and `step`. Written twice they drift, and\n * they drift in the direction nobody tests: a slider that snaps 0.1 + 0.2 to\n * `0.30000000000000004` and a field beside it that prints `0.3`.\n *\n * The step base is `min`, not zero, because that is what the HTML step\n * algorithm uses — a range from 5 to 100 stepping by 10 lands on 15, not on 10.\n */\n\n/**\n * Decimal places implied by a step.\n *\n * Snapping is arithmetic on binary floats, so a value that should be exactly\n * one step from the last one usually is not. Rounding the result to the step's\n * own precision is what stops that reaching a readout — and the step's own\n * precision is the most a caller can have meant.\n */\nexport function decimalsForStep(step: number): number {\n if (!Number.isFinite(step) || step <= 0) return 0\n const text = String(step)\n // Exponential notation carries its precision in the exponent, and `1e-7` has\n // no '.' to split on — `String(0.0000001)` is exactly that.\n const exponential = /e-(\\d+)$/i.exec(text)\n if (exponential) return Number(exponential[1])\n return text.split('.')[1]?.length ?? 0\n}\n\n/** Rounds to the nearest step from `min`, at the step's own precision. */\nexport function snapToStep(value: number, step: number, min = 0): number {\n if (!Number.isFinite(step) || step <= 0) return value\n const base = Number.isFinite(min) ? min : 0\n const snapped = base + Math.round((value - base) / step) * step\n return Number(snapped.toFixed(decimalsForStep(step)))\n}\n\n/** Holds a value inside a range. An inverted range yields its own lower bound. */\nexport function clampToRange(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max)\n}\n\n/**\n * A typed string as a number, or `null` when it is not one yet.\n *\n * `null` rather than `NaN` because the caller has to tell \"not a number\" from\n * \"not finished being typed\" and act the same way on both: leave the committed\n * value alone. `Number('')` is `0`, which is the trap this exists for — an\n * emptied box would otherwise commit zero on every keystroke that cleared it.\n */\nexport function parseNumber(text: string): number | null {\n const trimmed = text.trim()\n if (trimmed === '') return null\n const value = Number(trimmed)\n return Number.isFinite(value) ? value : null\n}\n"],"mappings":"AAoBO,SAAS,gBAAgB,MAAsB;AACpD,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,QAAQ,EAAG,QAAO;AAChD,QAAM,OAAO,OAAO,IAAI;AAGxB,QAAM,cAAc,YAAY,KAAK,IAAI;AACzC,MAAI,YAAa,QAAO,OAAO,YAAY,CAAC,CAAC;AAC7C,SAAO,KAAK,MAAM,GAAG,EAAE,CAAC,GAAG,UAAU;AACvC;AAGO,SAAS,WAAW,OAAe,MAAc,MAAM,GAAW;AACvE,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,QAAQ,EAAG,QAAO;AAChD,QAAM,OAAO,OAAO,SAAS,GAAG,IAAI,MAAM;AAC1C,QAAM,UAAU,OAAO,KAAK,OAAO,QAAQ,QAAQ,IAAI,IAAI;AAC3D,SAAO,OAAO,QAAQ,QAAQ,gBAAgB,IAAI,CAAC,CAAC;AACtD;AAGO,SAAS,aAAa,OAAe,KAAa,KAAqB;AAC5E,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC3C;AAUO,SAAS,YAAY,MAA6B;AACvD,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,YAAY,GAAI,QAAO;AAC3B,QAAM,QAAQ,OAAO,OAAO;AAC5B,SAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;","names":[]}
@@ -0,0 +1,48 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface OverlayContainerProps {
5
+ /** The element overlays should render into. `null` restores the default. */
6
+ container: HTMLElement | null;
7
+ children: ReactNode;
8
+ }
9
+ /**
10
+ * Redirects every overlay in the subtree — popover, select, menu, tooltip,
11
+ * dialog, sheet — into a given element instead of `document.body`.
12
+ *
13
+ * Two problems, one cause. An overlay portalled to the body is positioned
14
+ * against the VIEWPORT, so inside a bounded frame (a documentation example, a
15
+ * device preview, a canvas) it flips and shifts against edges the reader cannot
16
+ * see, and lands outside the box it belongs to. It also leaves the subtree, so
17
+ * `dir="rtl"` and `data-density` set on that frame stop reaching it.
18
+ *
19
+ * Naming the container fixes both: the panel renders inside the frame,
20
+ * inherits what the frame declares, and collides with the frame's edges.
21
+ *
22
+ * The container must be positioned (`relative` is enough) for the panel to be
23
+ * placed against it rather than against the nearest positioned ancestor. The
24
+ * modal surfaces need it for a second reason: they place themselves with
25
+ * `position: fixed`, which resolves against the VIEWPORT whatever element they
26
+ * are portalled into, so a named container switches them to `absolute` — and
27
+ * an unpositioned container would then hand them the wrong box.
28
+ *
29
+ * @example
30
+ * const [frame, setFrame] = useState<HTMLElement | null>(null)
31
+ * <div ref={setFrame} className="relative" data-density="compact">
32
+ * <OverlayContainer container={frame}>{children}</OverlayContainer>
33
+ * </div>
34
+ */
35
+ declare function OverlayContainer({ container, children }: OverlayContainerProps): react.JSX.Element;
36
+ /**
37
+ * The element overlays in this subtree should render into, or `null` for the
38
+ * document body.
39
+ *
40
+ * Every portal in the library reads this. That sentence was false for a
41
+ * release: `Dialog` and `Sheet` rendered the Radix portal with no container and
42
+ * never called this hook, and their props derive from `Content`, which has no
43
+ * `container` — so a caller could not pass one either, and every modal example
44
+ * on the documentation site escaped the preview card it was drawn in.
45
+ */
46
+ declare function useOverlayContainer(): HTMLElement | null;
47
+
48
+ export { OverlayContainer, type OverlayContainerProps, useOverlayContainer };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext } from "react";
4
+ const OverlayContainerContext = createContext(null);
5
+ function OverlayContainer({ container, children }) {
6
+ return /* @__PURE__ */ jsx(OverlayContainerContext, { value: container, children });
7
+ }
8
+ function useOverlayContainer() {
9
+ return useContext(OverlayContainerContext);
10
+ }
11
+ export {
12
+ OverlayContainer,
13
+ useOverlayContainer
14
+ };
15
+ //# sourceMappingURL=overlay-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/overlay-container.tsx"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport type { ReactNode } from 'react'\n\nconst OverlayContainerContext = createContext<HTMLElement | null>(null)\n\nexport interface OverlayContainerProps {\n /** The element overlays should render into. `null` restores the default. */\n container: HTMLElement | null\n children: ReactNode\n}\n\n/**\n * Redirects every overlay in the subtree — popover, select, menu, tooltip,\n * dialog, sheet — into a given element instead of `document.body`.\n *\n * Two problems, one cause. An overlay portalled to the body is positioned\n * against the VIEWPORT, so inside a bounded frame (a documentation example, a\n * device preview, a canvas) it flips and shifts against edges the reader cannot\n * see, and lands outside the box it belongs to. It also leaves the subtree, so\n * `dir=\"rtl\"` and `data-density` set on that frame stop reaching it.\n *\n * Naming the container fixes both: the panel renders inside the frame,\n * inherits what the frame declares, and collides with the frame's edges.\n *\n * The container must be positioned (`relative` is enough) for the panel to be\n * placed against it rather than against the nearest positioned ancestor. The\n * modal surfaces need it for a second reason: they place themselves with\n * `position: fixed`, which resolves against the VIEWPORT whatever element they\n * are portalled into, so a named container switches them to `absolute` — and\n * an unpositioned container would then hand them the wrong box.\n *\n * @example\n * const [frame, setFrame] = useState<HTMLElement | null>(null)\n * <div ref={setFrame} className=\"relative\" data-density=\"compact\">\n * <OverlayContainer container={frame}>{children}</OverlayContainer>\n * </div>\n */\nexport function OverlayContainer({ container, children }: OverlayContainerProps) {\n return <OverlayContainerContext value={container}>{children}</OverlayContainerContext>\n}\n\n/**\n * The element overlays in this subtree should render into, or `null` for the\n * document body.\n *\n * Every portal in the library reads this. That sentence was false for a\n * release: `Dialog` and `Sheet` rendered the Radix portal with no container and\n * never called this hook, and their props derive from `Content`, which has no\n * `container` — so a caller could not pass one either, and every modal example\n * on the documentation site escaped the preview card it was drawn in.\n */\nexport function useOverlayContainer(): HTMLElement | null {\n return useContext(OverlayContainerContext)\n}\n"],"mappings":";AAwCS;AAtCT,SAAS,eAAe,kBAAkB;AAG1C,MAAM,0BAA0B,cAAkC,IAAI;AAkC/D,SAAS,iBAAiB,EAAE,WAAW,SAAS,GAA0B;AAC/E,SAAO,oBAAC,2BAAwB,OAAO,WAAY,UAAS;AAC9D;AAYO,SAAS,sBAA0C;AACxD,SAAO,WAAW,uBAAuB;AAC3C;","names":[]}
@@ -0,0 +1,8 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+
3
+ /** Resolve suspended server elements through React's public children API. */
4
+ declare function resolveSlotElement<Props>(element: ReactElement<Props>): ReactElement<Props>;
5
+ /** Replace a host slot's content after resolving its element; retain navigation props. */
6
+ declare function replaceSlotContent<Props>(element: ReactElement<Props>, content: ReactNode): ReactElement<Props>;
7
+
8
+ export { replaceSlotContent, resolveSlotElement };
@@ -0,0 +1,17 @@
1
+ import { Children, cloneElement, isValidElement } from "react";
2
+ function resolveSlotElement(element) {
3
+ const children = Children.toArray(element);
4
+ const resolved = children[0];
5
+ if (children.length !== 1 || !isValidElement(resolved)) {
6
+ throw new Error("A slot must resolve to exactly one React element.");
7
+ }
8
+ return resolved;
9
+ }
10
+ function replaceSlotContent(element, content) {
11
+ return cloneElement(resolveSlotElement(element), void 0, content);
12
+ }
13
+ export {
14
+ replaceSlotContent,
15
+ resolveSlotElement
16
+ };
17
+ //# sourceMappingURL=slot-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/slot-content.ts"],"sourcesContent":["import { Children, cloneElement, isValidElement, type ReactElement, type ReactNode } from 'react'\n\n/** Resolve suspended server elements through React's public children API. */\nexport function resolveSlotElement<Props>(element: ReactElement<Props>): ReactElement<Props> {\n const children = Children.toArray(element)\n const resolved = children[0]\n if (children.length !== 1 || !isValidElement<Props>(resolved)) {\n throw new Error('A slot must resolve to exactly one React element.')\n }\n return resolved\n}\n\n/** Replace a host slot's content after resolving its element; retain navigation props. */\nexport function replaceSlotContent<Props>(element: ReactElement<Props>, content: ReactNode): ReactElement<Props> {\n return cloneElement(resolveSlotElement(element), undefined, content)\n}\n"],"mappings":"AAAA,SAAS,UAAU,cAAc,sBAAyD;AAGnF,SAAS,mBAA0B,SAAmD;AAC3F,QAAM,WAAW,SAAS,QAAQ,OAAO;AACzC,QAAM,WAAW,SAAS,CAAC;AAC3B,MAAI,SAAS,WAAW,KAAK,CAAC,eAAsB,QAAQ,GAAG;AAC7D,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACrE;AACA,SAAO;AACT;AAGO,SAAS,mBAA0B,SAA8B,SAAyC;AAC/G,SAAO,aAAa,mBAAmB,OAAO,GAAG,QAAW,OAAO;AACrE;","names":[]}
@@ -0,0 +1,45 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+
4
+ /**
5
+ * The list a rail's items sit in.
6
+ *
7
+ * One number for the marker, because three rules depend on it: the marker's
8
+ * own box, where the connector starts, and where it is centred. Written as a
9
+ * property rather than repeated as a literal so a caller can move all three at
10
+ * once.
11
+ */
12
+ declare const STEP_RAIL_LIST_CLASS = "m-0 flex list-none flex-col p-0 [--step-size:2rem]";
13
+ interface StepRailItemProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children'> {
14
+ /**
15
+ * `li` inside a real `<ol>`; `div` for a host that carries the list as ARIA
16
+ * roles so article prose does not restyle it as a bulleted list.
17
+ */
18
+ as?: 'li' | 'div';
19
+ /** What the marker prints: a count, a host counter, or nothing. */
20
+ marker: ReactNode;
21
+ /** Classes for the marker, after its resting or filled look. */
22
+ markerClassName?: string;
23
+ /** Draws the marker filled. Visual only; the caller decides what it announces. */
24
+ filled?: boolean;
25
+ /** The last item draws no connector below its marker. */
26
+ last: boolean;
27
+ title: ReactNode;
28
+ note?: ReactNode;
29
+ /** Anything that belongs under the note, inside the same column. */
30
+ children?: ReactNode;
31
+ }
32
+ /**
33
+ * One stop on a numbered rail: marker, connector, name and note.
34
+ *
35
+ * Internal. It is the single rendering shared by the core `Steps` and the
36
+ * website `StepSequence`, so the two cannot drift apart in geometry or type.
37
+ * Neither entry point exports it.
38
+ *
39
+ * The connector is drawn on the ITEM rather than as a full-height line behind
40
+ * the markers, so it starts under one and stops above the next — and the last
41
+ * step has no tail hanging off it.
42
+ */
43
+ declare function StepRailItem({ as: Item, marker, markerClassName, filled, last, title, note, children, className, ...rest }: StepRailItemProps): react.JSX.Element;
44
+
45
+ export { STEP_RAIL_LIST_CLASS, StepRailItem, type StepRailItemProps };
@@ -0,0 +1,47 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "./cn.js";
3
+ const STEP_RAIL_LIST_CLASS = "m-0 flex list-none flex-col p-0 [--step-size:2rem]";
4
+ function StepRailItem({
5
+ as: Item = "li",
6
+ marker,
7
+ markerClassName,
8
+ filled = false,
9
+ last,
10
+ title,
11
+ note,
12
+ children,
13
+ className,
14
+ ...rest
15
+ }) {
16
+ return /* @__PURE__ */ jsxs(Item, { ...rest, className: cn("relative flex gap-4 pb-7 last:pb-0", className), children: [
17
+ !last && /* @__PURE__ */ jsx(
18
+ "span",
19
+ {
20
+ "aria-hidden": true,
21
+ className: "absolute start-[calc(var(--step-size)/2)] top-(--step-size) bottom-0 w-px -translate-x-1/2 bg-(--rule-2) rtl:translate-x-1/2"
22
+ }
23
+ ),
24
+ /* @__PURE__ */ jsx(
25
+ "span",
26
+ {
27
+ "aria-hidden": true,
28
+ className: cn(
29
+ "relative z-1 grid size-(--step-size) shrink-0 place-items-center rounded-full border text-[12px] tabular-nums",
30
+ filled ? "border-(--accent) bg-(--accent) text-(--accent-foreground)" : "border-(--rule-2) bg-(--paper) text-(--ink-3-aa)",
31
+ markerClassName
32
+ ),
33
+ children: marker
34
+ }
35
+ ),
36
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1 pt-1", children: [
37
+ /* @__PURE__ */ jsx("span", { className: "font-sans text-[15px] leading-tight text-(--ink)", children: title }),
38
+ note !== void 0 && note !== null && /* @__PURE__ */ jsx("span", { className: "mono-meta leading-[1.6] text-(--ink-3-aa)", children: note }),
39
+ children
40
+ ] })
41
+ ] });
42
+ }
43
+ export {
44
+ STEP_RAIL_LIST_CLASS,
45
+ StepRailItem
46
+ };
47
+ //# sourceMappingURL=step-rail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/step-rail.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react'\nimport { cn } from './cn'\n\n/**\n * The list a rail's items sit in.\n *\n * One number for the marker, because three rules depend on it: the marker's\n * own box, where the connector starts, and where it is centred. Written as a\n * property rather than repeated as a literal so a caller can move all three at\n * once.\n */\nexport const STEP_RAIL_LIST_CLASS = 'm-0 flex list-none flex-col p-0 [--step-size:2rem]'\n\nexport interface StepRailItemProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children'> {\n /**\n * `li` inside a real `<ol>`; `div` for a host that carries the list as ARIA\n * roles so article prose does not restyle it as a bulleted list.\n */\n as?: 'li' | 'div'\n /** What the marker prints: a count, a host counter, or nothing. */\n marker: ReactNode\n /** Classes for the marker, after its resting or filled look. */\n markerClassName?: string\n /** Draws the marker filled. Visual only; the caller decides what it announces. */\n filled?: boolean\n /** The last item draws no connector below its marker. */\n last: boolean\n title: ReactNode\n note?: ReactNode\n /** Anything that belongs under the note, inside the same column. */\n children?: ReactNode\n}\n\n/**\n * One stop on a numbered rail: marker, connector, name and note.\n *\n * Internal. It is the single rendering shared by the core `Steps` and the\n * website `StepSequence`, so the two cannot drift apart in geometry or type.\n * Neither entry point exports it.\n *\n * The connector is drawn on the ITEM rather than as a full-height line behind\n * the markers, so it starts under one and stops above the next — and the last\n * step has no tail hanging off it.\n */\nexport function StepRailItem({\n as: Item = 'li',\n marker,\n markerClassName,\n filled = false,\n last,\n title,\n note,\n children,\n className,\n ...rest\n}: StepRailItemProps) {\n return (\n <Item {...rest} className={cn('relative flex gap-4 pb-7 last:pb-0', className)}>\n {/* Absolute, so it spans the gap between this marker and the next without\n taking part in the row's own layout — and simply absent on the last\n row rather than drawn and then hidden. */}\n {!last && (\n <span\n aria-hidden\n className=\"absolute start-[calc(var(--step-size)/2)] top-(--step-size) bottom-0 w-px -translate-x-1/2 bg-(--rule-2) rtl:translate-x-1/2\"\n />\n )}\n <span\n aria-hidden\n className={cn(\n 'relative z-1 grid size-(--step-size) shrink-0 place-items-center rounded-full border text-[12px] tabular-nums',\n filled\n ? 'border-(--accent) bg-(--accent) text-(--accent-foreground)'\n : 'border-(--rule-2) bg-(--paper) text-(--ink-3-aa)',\n markerClassName,\n )}\n >\n {marker}\n </span>\n <div className=\"flex min-w-0 flex-col gap-1 pt-1\">\n <span className=\"font-sans text-[15px] leading-tight text-(--ink)\">{title}</span>\n {note !== undefined && note !== null && (\n <span className=\"mono-meta leading-[1.6] text-(--ink-3-aa)\">{note}</span>\n )}\n {children}\n </div>\n </Item>\n )\n}\n"],"mappings":"AA8DQ,cAiBF,YAjBE;AA7DR,SAAS,UAAU;AAUZ,MAAM,uBAAuB;AAiC7B,SAAS,aAAa;AAAA,EAC3B,IAAI,OAAO;AAAA,EACX;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,SACE,qBAAC,QAAM,GAAG,MAAM,WAAW,GAAG,sCAAsC,SAAS,GAI1E;AAAA,KAAC,QACA;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,QACX,WAAU;AAAA;AAAA,IACZ;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,QACX,WAAW;AAAA,UACT;AAAA,UACA,SACI,+DACA;AAAA,UACJ;AAAA,QACF;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA,qBAAC,SAAI,WAAU,oCACb;AAAA,0BAAC,UAAK,WAAU,oDAAoD,iBAAM;AAAA,MACzE,SAAS,UAAa,SAAS,QAC9B,oBAAC,UAAK,WAAU,6CAA6C,gBAAK;AAAA,MAEnE;AAAA,OACH;AAAA,KACF;AAEJ;","names":[]}