@agimon-ai/doompi-web-components 0.0.1-alpha.4 → 0.0.1-alpha.40

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 (503) hide show
  1. package/README.md +7 -7
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.mts +18 -6
  4. package/dist/index.mjs +1 -1
  5. package/dist/src/components/Accordion.cjs +1 -1
  6. package/dist/src/components/Accordion.cjs.map +1 -1
  7. package/dist/src/components/Accordion.d.mts +5 -5
  8. package/dist/src/components/Accordion.d.mts.map +1 -1
  9. package/dist/src/components/Accordion.mjs +1 -1
  10. package/dist/src/components/Accordion.mjs.map +1 -1
  11. package/dist/src/components/AnsiText.cjs +4 -0
  12. package/dist/src/components/AnsiText.cjs.map +1 -0
  13. package/dist/src/components/AnsiText.d.mts +16 -0
  14. package/dist/src/components/AnsiText.d.mts.map +1 -0
  15. package/dist/src/components/AnsiText.mjs +4 -0
  16. package/dist/src/components/AnsiText.mjs.map +1 -0
  17. package/dist/src/components/Avatar.cjs +1 -1
  18. package/dist/src/components/Avatar.cjs.map +1 -1
  19. package/dist/src/components/Avatar.d.mts +4 -4
  20. package/dist/src/components/Avatar.d.mts.map +1 -1
  21. package/dist/src/components/Avatar.mjs +1 -1
  22. package/dist/src/components/Avatar.mjs.map +1 -1
  23. package/dist/src/components/Badge.cjs +1 -1
  24. package/dist/src/components/Badge.cjs.map +1 -1
  25. package/dist/src/components/Badge.d.mts +5 -6
  26. package/dist/src/components/Badge.d.mts.map +1 -1
  27. package/dist/src/components/Badge.mjs +1 -1
  28. package/dist/src/components/Badge.mjs.map +1 -1
  29. package/dist/src/components/Breadcrumb.cjs +1 -1
  30. package/dist/src/components/Breadcrumb.cjs.map +1 -1
  31. package/dist/src/components/Breadcrumb.d.mts +4 -5
  32. package/dist/src/components/Breadcrumb.d.mts.map +1 -1
  33. package/dist/src/components/Breadcrumb.mjs +1 -1
  34. package/dist/src/components/Breadcrumb.mjs.map +1 -1
  35. package/dist/src/components/Button.cjs +1 -1
  36. package/dist/src/components/Button.cjs.map +1 -1
  37. package/dist/src/components/Button.d.mts +6 -7
  38. package/dist/src/components/Button.d.mts.map +1 -1
  39. package/dist/src/components/Button.mjs +1 -1
  40. package/dist/src/components/Button.mjs.map +1 -1
  41. package/dist/src/components/Checkbox.cjs +1 -1
  42. package/dist/src/components/Checkbox.cjs.map +1 -1
  43. package/dist/src/components/Checkbox.d.mts +1 -1
  44. package/dist/src/components/Checkbox.d.mts.map +1 -1
  45. package/dist/src/components/Checkbox.mjs +1 -1
  46. package/dist/src/components/Checkbox.mjs.map +1 -1
  47. package/dist/src/components/CodeBlock.cjs +2 -0
  48. package/dist/src/components/CodeBlock.cjs.map +1 -0
  49. package/dist/src/components/CodeBlock.mjs +2 -0
  50. package/dist/src/components/CodeBlock.mjs.map +1 -0
  51. package/dist/src/components/CodeEditor.cjs +1 -1
  52. package/dist/src/components/CodeEditor.cjs.map +1 -1
  53. package/dist/src/components/CodeEditor.d.mts +1 -2
  54. package/dist/src/components/CodeEditor.d.mts.map +1 -1
  55. package/dist/src/components/CodeEditor.mjs +1 -1
  56. package/dist/src/components/CodeEditor.mjs.map +1 -1
  57. package/dist/src/components/CodeEditorView.cjs +1 -1
  58. package/dist/src/components/CodeEditorView.cjs.map +1 -1
  59. package/dist/src/components/CodeEditorView.mjs +1 -1
  60. package/dist/src/components/CodeEditorView.mjs.map +1 -1
  61. package/dist/src/components/Collapsible.cjs +1 -1
  62. package/dist/src/components/Collapsible.cjs.map +1 -1
  63. package/dist/src/components/Collapsible.d.mts +4 -4
  64. package/dist/src/components/Collapsible.d.mts.map +1 -1
  65. package/dist/src/components/Collapsible.mjs +1 -1
  66. package/dist/src/components/Collapsible.mjs.map +1 -1
  67. package/dist/src/components/Command.cjs +1 -1
  68. package/dist/src/components/Command.cjs.map +1 -1
  69. package/dist/src/components/Command.d.mts +11 -12
  70. package/dist/src/components/Command.d.mts.map +1 -1
  71. package/dist/src/components/Command.mjs +1 -1
  72. package/dist/src/components/Command.mjs.map +1 -1
  73. package/dist/src/components/CopyButton.cjs +2 -0
  74. package/dist/src/components/CopyButton.cjs.map +1 -0
  75. package/dist/src/components/CopyButton.mjs +2 -0
  76. package/dist/src/components/CopyButton.mjs.map +1 -0
  77. package/dist/src/components/Dialog.cjs +1 -1
  78. package/dist/src/components/Dialog.cjs.map +1 -1
  79. package/dist/src/components/Dialog.d.mts +15 -15
  80. package/dist/src/components/Dialog.d.mts.map +1 -1
  81. package/dist/src/components/Dialog.mjs +1 -1
  82. package/dist/src/components/Dialog.mjs.map +1 -1
  83. package/dist/src/components/Dot.cjs +1 -1
  84. package/dist/src/components/Dot.cjs.map +1 -1
  85. package/dist/src/components/Dot.d.mts +5 -6
  86. package/dist/src/components/Dot.d.mts.map +1 -1
  87. package/dist/src/components/Dot.mjs +1 -1
  88. package/dist/src/components/Dot.mjs.map +1 -1
  89. package/dist/src/components/Drawer.cjs +2 -0
  90. package/dist/src/components/Drawer.cjs.map +1 -0
  91. package/dist/src/components/Drawer.d.mts +17 -0
  92. package/dist/src/components/Drawer.d.mts.map +1 -0
  93. package/dist/src/components/Drawer.mjs +2 -0
  94. package/dist/src/components/Drawer.mjs.map +1 -0
  95. package/dist/src/components/DropdownMenu.cjs +1 -1
  96. package/dist/src/components/DropdownMenu.cjs.map +1 -1
  97. package/dist/src/components/DropdownMenu.d.mts +20 -20
  98. package/dist/src/components/DropdownMenu.d.mts.map +1 -1
  99. package/dist/src/components/DropdownMenu.mjs +1 -1
  100. package/dist/src/components/DropdownMenu.mjs.map +1 -1
  101. package/dist/src/components/EmptyState.cjs +1 -1
  102. package/dist/src/components/EmptyState.cjs.map +1 -1
  103. package/dist/src/components/EmptyState.d.mts +2 -3
  104. package/dist/src/components/EmptyState.d.mts.map +1 -1
  105. package/dist/src/components/EmptyState.mjs +1 -1
  106. package/dist/src/components/EmptyState.mjs.map +1 -1
  107. package/dist/src/components/HashlineLines.cjs +2 -0
  108. package/dist/src/components/HashlineLines.cjs.map +1 -0
  109. package/dist/src/components/HashlineLines.d.mts +23 -0
  110. package/dist/src/components/HashlineLines.d.mts.map +1 -0
  111. package/dist/src/components/HashlineLines.mjs +2 -0
  112. package/dist/src/components/HashlineLines.mjs.map +1 -0
  113. package/dist/src/components/Input.cjs +1 -1
  114. package/dist/src/components/Input.cjs.map +1 -1
  115. package/dist/src/components/Input.d.mts +6 -7
  116. package/dist/src/components/Input.d.mts.map +1 -1
  117. package/dist/src/components/Input.mjs +1 -1
  118. package/dist/src/components/Input.mjs.map +1 -1
  119. package/dist/src/components/Kbd.cjs +1 -1
  120. package/dist/src/components/Kbd.cjs.map +1 -1
  121. package/dist/src/components/Kbd.d.mts +1 -2
  122. package/dist/src/components/Kbd.d.mts.map +1 -1
  123. package/dist/src/components/Kbd.mjs +1 -1
  124. package/dist/src/components/Kbd.mjs.map +1 -1
  125. package/dist/src/components/Label.cjs +1 -1
  126. package/dist/src/components/Label.cjs.map +1 -1
  127. package/dist/src/components/Label.d.mts +1 -1
  128. package/dist/src/components/Label.d.mts.map +1 -1
  129. package/dist/src/components/Label.mjs +1 -1
  130. package/dist/src/components/Label.mjs.map +1 -1
  131. package/dist/src/components/Markdown.cjs +2 -1
  132. package/dist/src/components/Markdown.cjs.map +1 -1
  133. package/dist/src/components/Markdown.d.mts +12 -3
  134. package/dist/src/components/Markdown.d.mts.map +1 -1
  135. package/dist/src/components/Markdown.mjs +2 -1
  136. package/dist/src/components/Markdown.mjs.map +1 -1
  137. package/dist/src/components/MediaPreview.cjs +1 -1
  138. package/dist/src/components/MediaPreview.cjs.map +1 -1
  139. package/dist/src/components/MediaPreview.d.mts +39 -3
  140. package/dist/src/components/MediaPreview.d.mts.map +1 -1
  141. package/dist/src/components/MediaPreview.mjs +1 -1
  142. package/dist/src/components/MediaPreview.mjs.map +1 -1
  143. package/dist/src/components/MermaidDiagram.cjs +2 -0
  144. package/dist/src/components/MermaidDiagram.cjs.map +1 -0
  145. package/dist/src/components/MermaidDiagram.mjs +2 -0
  146. package/dist/src/components/MermaidDiagram.mjs.map +1 -0
  147. package/dist/src/components/MessageItem.cjs +1 -1
  148. package/dist/src/components/MessageItem.cjs.map +1 -1
  149. package/dist/src/components/MessageItem.d.mts +48 -17
  150. package/dist/src/components/MessageItem.d.mts.map +1 -1
  151. package/dist/src/components/MessageItem.mjs +1 -1
  152. package/dist/src/components/MessageItem.mjs.map +1 -1
  153. package/dist/src/components/MessageLines.cjs +1 -1
  154. package/dist/src/components/MessageLines.cjs.map +1 -1
  155. package/dist/src/components/MessageLines.d.mts +5 -6
  156. package/dist/src/components/MessageLines.d.mts.map +1 -1
  157. package/dist/src/components/MessageLines.mjs +1 -1
  158. package/dist/src/components/MessageLines.mjs.map +1 -1
  159. package/dist/src/components/OptionList.cjs +1 -1
  160. package/dist/src/components/OptionList.cjs.map +1 -1
  161. package/dist/src/components/OptionList.d.mts +9 -10
  162. package/dist/src/components/OptionList.d.mts.map +1 -1
  163. package/dist/src/components/OptionList.mjs +1 -1
  164. package/dist/src/components/OptionList.mjs.map +1 -1
  165. package/dist/src/components/Panel.cjs +1 -1
  166. package/dist/src/components/Panel.cjs.map +1 -1
  167. package/dist/src/components/Panel.d.mts +4 -5
  168. package/dist/src/components/Panel.d.mts.map +1 -1
  169. package/dist/src/components/Panel.mjs +1 -1
  170. package/dist/src/components/Panel.mjs.map +1 -1
  171. package/dist/src/components/PdfPreview.cjs +2 -0
  172. package/dist/src/components/PdfPreview.cjs.map +1 -0
  173. package/dist/src/components/PdfPreview.d.mts +52 -0
  174. package/dist/src/components/PdfPreview.d.mts.map +1 -0
  175. package/dist/src/components/PdfPreview.mjs +2 -0
  176. package/dist/src/components/PdfPreview.mjs.map +1 -0
  177. package/dist/src/components/Popover.cjs +1 -1
  178. package/dist/src/components/Popover.cjs.map +1 -1
  179. package/dist/src/components/Popover.d.mts +8 -8
  180. package/dist/src/components/Popover.d.mts.map +1 -1
  181. package/dist/src/components/Popover.mjs +1 -1
  182. package/dist/src/components/Popover.mjs.map +1 -1
  183. package/dist/src/components/Progress.cjs +1 -1
  184. package/dist/src/components/Progress.cjs.map +1 -1
  185. package/dist/src/components/Progress.d.mts +1 -1
  186. package/dist/src/components/Progress.d.mts.map +1 -1
  187. package/dist/src/components/Progress.mjs +1 -1
  188. package/dist/src/components/Progress.mjs.map +1 -1
  189. package/dist/src/components/RadioGroup.cjs +1 -1
  190. package/dist/src/components/RadioGroup.cjs.map +1 -1
  191. package/dist/src/components/RadioGroup.d.mts +4 -4
  192. package/dist/src/components/RadioGroup.d.mts.map +1 -1
  193. package/dist/src/components/RadioGroup.mjs +1 -1
  194. package/dist/src/components/RadioGroup.mjs.map +1 -1
  195. package/dist/src/components/ScrollArea.cjs +1 -1
  196. package/dist/src/components/ScrollArea.cjs.map +1 -1
  197. package/dist/src/components/ScrollArea.d.mts +3 -3
  198. package/dist/src/components/ScrollArea.d.mts.map +1 -1
  199. package/dist/src/components/ScrollArea.mjs +1 -1
  200. package/dist/src/components/ScrollArea.mjs.map +1 -1
  201. package/dist/src/components/SectionLabel.cjs +1 -1
  202. package/dist/src/components/SectionLabel.cjs.map +1 -1
  203. package/dist/src/components/SectionLabel.d.mts +1 -2
  204. package/dist/src/components/SectionLabel.d.mts.map +1 -1
  205. package/dist/src/components/SectionLabel.mjs +1 -1
  206. package/dist/src/components/SectionLabel.mjs.map +1 -1
  207. package/dist/src/components/Select.cjs +1 -1
  208. package/dist/src/components/Select.cjs.map +1 -1
  209. package/dist/src/components/Select.d.mts +9 -9
  210. package/dist/src/components/Select.d.mts.map +1 -1
  211. package/dist/src/components/Select.mjs +1 -1
  212. package/dist/src/components/Select.mjs.map +1 -1
  213. package/dist/src/components/Separator.cjs +1 -1
  214. package/dist/src/components/Separator.cjs.map +1 -1
  215. package/dist/src/components/Separator.d.mts +1 -1
  216. package/dist/src/components/Separator.d.mts.map +1 -1
  217. package/dist/src/components/Separator.mjs +1 -1
  218. package/dist/src/components/Separator.mjs.map +1 -1
  219. package/dist/src/components/Sheet.cjs +2 -0
  220. package/dist/src/components/Sheet.cjs.map +1 -0
  221. package/dist/src/components/Sheet.d.mts +35 -0
  222. package/dist/src/components/Sheet.d.mts.map +1 -0
  223. package/dist/src/components/Sheet.mjs +2 -0
  224. package/dist/src/components/Sheet.mjs.map +1 -0
  225. package/dist/src/components/Skeleton.cjs +1 -1
  226. package/dist/src/components/Skeleton.cjs.map +1 -1
  227. package/dist/src/components/Skeleton.d.mts +1 -2
  228. package/dist/src/components/Skeleton.d.mts.map +1 -1
  229. package/dist/src/components/Skeleton.mjs +1 -1
  230. package/dist/src/components/Skeleton.mjs.map +1 -1
  231. package/dist/src/components/Spinner.cjs +1 -1
  232. package/dist/src/components/Spinner.cjs.map +1 -1
  233. package/dist/src/components/Spinner.d.mts +2 -3
  234. package/dist/src/components/Spinner.d.mts.map +1 -1
  235. package/dist/src/components/Spinner.mjs +1 -1
  236. package/dist/src/components/Spinner.mjs.map +1 -1
  237. package/dist/src/components/StatusBadge.cjs +1 -1
  238. package/dist/src/components/StatusBadge.cjs.map +1 -1
  239. package/dist/src/components/StatusBadge.d.mts +6 -7
  240. package/dist/src/components/StatusBadge.d.mts.map +1 -1
  241. package/dist/src/components/StatusBadge.mjs +1 -1
  242. package/dist/src/components/StatusBadge.mjs.map +1 -1
  243. package/dist/src/components/StreamCursor.cjs +1 -1
  244. package/dist/src/components/StreamCursor.cjs.map +1 -1
  245. package/dist/src/components/StreamCursor.d.mts +1 -2
  246. package/dist/src/components/StreamCursor.d.mts.map +1 -1
  247. package/dist/src/components/StreamCursor.mjs +1 -1
  248. package/dist/src/components/StreamCursor.mjs.map +1 -1
  249. package/dist/src/components/Switch.cjs +1 -1
  250. package/dist/src/components/Switch.cjs.map +1 -1
  251. package/dist/src/components/Switch.d.mts +1 -1
  252. package/dist/src/components/Switch.d.mts.map +1 -1
  253. package/dist/src/components/Switch.mjs +1 -1
  254. package/dist/src/components/Switch.mjs.map +1 -1
  255. package/dist/src/components/SyntaxText.cjs +4 -0
  256. package/dist/src/components/SyntaxText.cjs.map +1 -0
  257. package/dist/src/components/SyntaxText.d.mts +50 -0
  258. package/dist/src/components/SyntaxText.d.mts.map +1 -0
  259. package/dist/src/components/SyntaxText.mjs +4 -0
  260. package/dist/src/components/SyntaxText.mjs.map +1 -0
  261. package/dist/src/components/Tabs.cjs +1 -1
  262. package/dist/src/components/Tabs.cjs.map +1 -1
  263. package/dist/src/components/Tabs.d.mts +11 -11
  264. package/dist/src/components/Tabs.d.mts.map +1 -1
  265. package/dist/src/components/Tabs.mjs +1 -1
  266. package/dist/src/components/Tabs.mjs.map +1 -1
  267. package/dist/src/components/TerminalView.cjs +2 -0
  268. package/dist/src/components/TerminalView.cjs.map +1 -0
  269. package/dist/src/components/TerminalView.d.mts +31 -0
  270. package/dist/src/components/TerminalView.d.mts.map +1 -0
  271. package/dist/src/components/TerminalView.mjs +2 -0
  272. package/dist/src/components/TerminalView.mjs.map +1 -0
  273. package/dist/src/components/Textarea.cjs +1 -1
  274. package/dist/src/components/Textarea.cjs.map +1 -1
  275. package/dist/src/components/Textarea.d.mts +3 -4
  276. package/dist/src/components/Textarea.d.mts.map +1 -1
  277. package/dist/src/components/Textarea.mjs +1 -1
  278. package/dist/src/components/Textarea.mjs.map +1 -1
  279. package/dist/src/components/Toast.cjs +1 -1
  280. package/dist/src/components/Toast.cjs.map +1 -1
  281. package/dist/src/components/Toast.d.mts +11 -11
  282. package/dist/src/components/Toast.d.mts.map +1 -1
  283. package/dist/src/components/Toast.mjs +1 -1
  284. package/dist/src/components/Toast.mjs.map +1 -1
  285. package/dist/src/components/ToolPathLink.cjs +2 -0
  286. package/dist/src/components/ToolPathLink.cjs.map +1 -0
  287. package/dist/src/components/ToolPathLink.d.mts +22 -0
  288. package/dist/src/components/ToolPathLink.d.mts.map +1 -0
  289. package/dist/src/components/ToolPathLink.mjs +2 -0
  290. package/dist/src/components/ToolPathLink.mjs.map +1 -0
  291. package/dist/src/components/Tooltip.cjs +1 -1
  292. package/dist/src/components/Tooltip.cjs.map +1 -1
  293. package/dist/src/components/Tooltip.d.mts +5 -5
  294. package/dist/src/components/Tooltip.d.mts.map +1 -1
  295. package/dist/src/components/Tooltip.mjs +1 -1
  296. package/dist/src/components/Tooltip.mjs.map +1 -1
  297. package/dist/src/icons/icons.cjs +1 -1
  298. package/dist/src/icons/icons.d.mts +2 -2
  299. package/dist/src/icons/icons.mjs +1 -1
  300. package/dist/src/lib/ansiSpans.cjs +2 -0
  301. package/dist/src/lib/ansiSpans.cjs.map +1 -0
  302. package/dist/src/lib/ansiSpans.d.mts +42 -0
  303. package/dist/src/lib/ansiSpans.d.mts.map +1 -0
  304. package/dist/src/lib/ansiSpans.mjs +2 -0
  305. package/dist/src/lib/ansiSpans.mjs.map +1 -0
  306. package/dist/src/lib/cn.d.mts +1 -2
  307. package/dist/src/lib/cn.d.mts.map +1 -1
  308. package/dist/src/lib/collapse.d.mts +2 -3
  309. package/dist/src/lib/collapse.d.mts.map +1 -1
  310. package/dist/src/lib/editorController.cjs +2 -0
  311. package/dist/src/lib/editorController.cjs.map +1 -0
  312. package/dist/src/lib/editorController.mjs +2 -0
  313. package/dist/src/lib/editorController.mjs.map +1 -0
  314. package/dist/src/lib/editorLanguage.d.mts +2 -3
  315. package/dist/src/lib/editorLanguage.d.mts.map +1 -1
  316. package/dist/src/lib/editorTheme.cjs +1 -1
  317. package/dist/src/lib/editorTheme.cjs.map +1 -1
  318. package/dist/src/lib/editorTheme.d.mts +76 -0
  319. package/dist/src/lib/editorTheme.d.mts.map +1 -0
  320. package/dist/src/lib/editorTheme.mjs +1 -1
  321. package/dist/src/lib/editorTheme.mjs.map +1 -1
  322. package/dist/src/lib/fenceGrammar.cjs +2 -0
  323. package/dist/src/lib/fenceGrammar.cjs.map +1 -0
  324. package/dist/src/lib/fenceGrammar.mjs +2 -0
  325. package/dist/src/lib/fenceGrammar.mjs.map +1 -0
  326. package/dist/src/lib/hashlineHighlight.cjs +3 -0
  327. package/dist/src/lib/hashlineHighlight.cjs.map +1 -0
  328. package/dist/src/lib/hashlineHighlight.d.mts +30 -0
  329. package/dist/src/lib/hashlineHighlight.d.mts.map +1 -0
  330. package/dist/src/lib/hashlineHighlight.mjs +3 -0
  331. package/dist/src/lib/hashlineHighlight.mjs.map +1 -0
  332. package/dist/src/lib/hashlineView.cjs +6 -0
  333. package/dist/src/lib/hashlineView.cjs.map +1 -0
  334. package/dist/src/lib/hashlineView.d.mts +60 -0
  335. package/dist/src/lib/hashlineView.d.mts.map +1 -0
  336. package/dist/src/lib/hashlineView.mjs +6 -0
  337. package/dist/src/lib/hashlineView.mjs.map +1 -0
  338. package/dist/src/lib/media.cjs.map +1 -1
  339. package/dist/src/lib/media.d.mts +1 -2
  340. package/dist/src/lib/media.d.mts.map +1 -1
  341. package/dist/src/lib/media.mjs.map +1 -1
  342. package/dist/src/lib/mediaPlayback.cjs +2 -0
  343. package/dist/src/lib/mediaPlayback.cjs.map +1 -0
  344. package/dist/src/lib/mediaPlayback.mjs +2 -0
  345. package/dist/src/lib/mediaPlayback.mjs.map +1 -0
  346. package/dist/src/lib/mermaidDiagram.cjs +2 -0
  347. package/dist/src/lib/mermaidDiagram.cjs.map +1 -0
  348. package/dist/src/lib/mermaidDiagram.mjs +2 -0
  349. package/dist/src/lib/mermaidDiagram.mjs.map +1 -0
  350. package/dist/src/lib/optionList.d.mts +4 -5
  351. package/dist/src/lib/optionList.d.mts.map +1 -1
  352. package/dist/src/lib/syntaxHighlight.cjs +3 -0
  353. package/dist/src/lib/syntaxHighlight.cjs.map +1 -0
  354. package/dist/src/lib/syntaxHighlight.d.mts +54 -0
  355. package/dist/src/lib/syntaxHighlight.d.mts.map +1 -0
  356. package/dist/src/lib/syntaxHighlight.mjs +3 -0
  357. package/dist/src/lib/syntaxHighlight.mjs.map +1 -0
  358. package/dist/src/lib/tone.cjs.map +1 -1
  359. package/dist/src/lib/tone.d.mts +4 -5
  360. package/dist/src/lib/tone.d.mts.map +1 -1
  361. package/dist/src/lib/tone.mjs.map +1 -1
  362. package/dist/src/theme/apply.cjs.map +1 -1
  363. package/dist/src/theme/apply.d.mts +5 -6
  364. package/dist/src/theme/apply.d.mts.map +1 -1
  365. package/dist/src/theme/apply.mjs.map +1 -1
  366. package/dist/src/theme/builtinThemes.cjs.map +1 -1
  367. package/dist/src/theme/builtinThemes.d.mts +4 -5
  368. package/dist/src/theme/builtinThemes.d.mts.map +1 -1
  369. package/dist/src/theme/builtinThemes.mjs.map +1 -1
  370. package/dist/src/theme/derive.cjs.map +1 -1
  371. package/dist/src/theme/derive.d.mts +4 -5
  372. package/dist/src/theme/derive.d.mts.map +1 -1
  373. package/dist/src/theme/derive.mjs.map +1 -1
  374. package/dist/src/theme/parse.cjs.map +1 -1
  375. package/dist/src/theme/parse.d.mts +1 -2
  376. package/dist/src/theme/parse.d.mts.map +1 -1
  377. package/dist/src/theme/parse.mjs.map +1 -1
  378. package/dist/src/theme/piTheme.cjs.map +1 -1
  379. package/dist/src/theme/piTheme.d.mts +2 -3
  380. package/dist/src/theme/piTheme.d.mts.map +1 -1
  381. package/dist/src/theme/piTheme.mjs.map +1 -1
  382. package/dist/src/theme/preference.d.mts +4 -5
  383. package/dist/src/theme/preference.d.mts.map +1 -1
  384. package/dist/src/types/editor.cjs.map +1 -1
  385. package/dist/src/types/editor.d.mts +39 -5
  386. package/dist/src/types/editor.d.mts.map +1 -1
  387. package/dist/src/types/editor.mjs.map +1 -1
  388. package/dist/src/types/theme.d.mts +11 -12
  389. package/dist/src/types/theme.d.mts.map +1 -1
  390. package/dist/src/types/tone.d.mts +10 -11
  391. package/dist/src/types/tone.d.mts.map +1 -1
  392. package/package.json +21 -17
  393. package/styles/preview.css +17 -0
  394. package/styles/tokens.css +72 -0
  395. package/dist/components/Accordion.d.cts +0 -11
  396. package/dist/components/Accordion.d.cts.map +0 -1
  397. package/dist/components/Avatar.d.cts +0 -10
  398. package/dist/components/Avatar.d.cts.map +0 -1
  399. package/dist/components/Badge.d.cts +0 -18
  400. package/dist/components/Badge.d.cts.map +0 -1
  401. package/dist/components/Breadcrumb.d.cts +0 -37
  402. package/dist/components/Breadcrumb.d.cts.map +0 -1
  403. package/dist/components/Button.d.cts +0 -25
  404. package/dist/components/Button.d.cts.map +0 -1
  405. package/dist/components/Checkbox.d.cts +0 -8
  406. package/dist/components/Checkbox.d.cts.map +0 -1
  407. package/dist/components/CodeEditor.d.cts +0 -6
  408. package/dist/components/CodeEditor.d.cts.map +0 -1
  409. package/dist/components/Collapsible.d.cts +0 -10
  410. package/dist/components/Collapsible.d.cts.map +0 -1
  411. package/dist/components/Command.d.cts +0 -42
  412. package/dist/components/Command.d.cts.map +0 -1
  413. package/dist/components/Dialog.d.cts +0 -39
  414. package/dist/components/Dialog.d.cts.map +0 -1
  415. package/dist/components/Dot.d.cts +0 -16
  416. package/dist/components/Dot.d.cts.map +0 -1
  417. package/dist/components/DropdownMenu.d.cts +0 -34
  418. package/dist/components/DropdownMenu.d.cts.map +0 -1
  419. package/dist/components/EmptyState.d.cts +0 -18
  420. package/dist/components/EmptyState.d.cts.map +0 -1
  421. package/dist/components/Input.d.cts +0 -20
  422. package/dist/components/Input.d.cts.map +0 -1
  423. package/dist/components/Kbd.d.cts +0 -7
  424. package/dist/components/Kbd.d.cts.map +0 -1
  425. package/dist/components/Label.d.cts +0 -8
  426. package/dist/components/Label.d.cts.map +0 -1
  427. package/dist/components/Markdown.d.cts +0 -8
  428. package/dist/components/Markdown.d.cts.map +0 -1
  429. package/dist/components/MediaPreview.d.cts +0 -25
  430. package/dist/components/MediaPreview.d.cts.map +0 -1
  431. package/dist/components/MessageItem.d.cts +0 -71
  432. package/dist/components/MessageItem.d.cts.map +0 -1
  433. package/dist/components/MessageLines.d.cts +0 -24
  434. package/dist/components/MessageLines.d.cts.map +0 -1
  435. package/dist/components/OptionList.d.cts +0 -50
  436. package/dist/components/OptionList.d.cts.map +0 -1
  437. package/dist/components/Panel.d.cts +0 -15
  438. package/dist/components/Panel.d.cts.map +0 -1
  439. package/dist/components/Popover.d.cts +0 -19
  440. package/dist/components/Popover.d.cts.map +0 -1
  441. package/dist/components/Progress.d.cts +0 -8
  442. package/dist/components/Progress.d.cts.map +0 -1
  443. package/dist/components/RadioGroup.d.cts +0 -15
  444. package/dist/components/RadioGroup.d.cts.map +0 -1
  445. package/dist/components/ScrollArea.d.cts +0 -13
  446. package/dist/components/ScrollArea.d.cts.map +0 -1
  447. package/dist/components/SectionLabel.d.cts +0 -7
  448. package/dist/components/SectionLabel.d.cts.map +0 -1
  449. package/dist/components/Select.d.cts +0 -19
  450. package/dist/components/Select.d.cts.map +0 -1
  451. package/dist/components/Separator.d.cts +0 -13
  452. package/dist/components/Separator.d.cts.map +0 -1
  453. package/dist/components/Skeleton.d.cts +0 -11
  454. package/dist/components/Skeleton.d.cts.map +0 -1
  455. package/dist/components/Spinner.d.cts +0 -15
  456. package/dist/components/Spinner.d.cts.map +0 -1
  457. package/dist/components/StatusBadge.d.cts +0 -24
  458. package/dist/components/StatusBadge.d.cts.map +0 -1
  459. package/dist/components/StreamCursor.d.cts +0 -7
  460. package/dist/components/StreamCursor.d.cts.map +0 -1
  461. package/dist/components/Switch.d.cts +0 -8
  462. package/dist/components/Switch.d.cts.map +0 -1
  463. package/dist/components/Tabs.d.cts +0 -36
  464. package/dist/components/Tabs.d.cts.map +0 -1
  465. package/dist/components/Textarea.d.cts +0 -10
  466. package/dist/components/Textarea.d.cts.map +0 -1
  467. package/dist/components/Toast.d.cts +0 -24
  468. package/dist/components/Toast.d.cts.map +0 -1
  469. package/dist/components/Tooltip.d.cts +0 -11
  470. package/dist/components/Tooltip.d.cts.map +0 -1
  471. package/dist/icons/icons.d.cts +0 -2
  472. package/dist/index.d.cts +0 -48
  473. package/dist/lib/cn.d.cts +0 -7
  474. package/dist/lib/cn.d.cts.map +0 -1
  475. package/dist/lib/collapse.d.cts +0 -15
  476. package/dist/lib/collapse.d.cts.map +0 -1
  477. package/dist/lib/editorLanguage.d.cts +0 -22
  478. package/dist/lib/editorLanguage.d.cts.map +0 -1
  479. package/dist/lib/media.d.cts +0 -12
  480. package/dist/lib/media.d.cts.map +0 -1
  481. package/dist/lib/optionList.d.cts +0 -22
  482. package/dist/lib/optionList.d.cts.map +0 -1
  483. package/dist/lib/tone.d.cts +0 -26
  484. package/dist/lib/tone.d.cts.map +0 -1
  485. package/dist/theme/apply.d.cts +0 -26
  486. package/dist/theme/apply.d.cts.map +0 -1
  487. package/dist/theme/builtinThemes.d.cts +0 -12
  488. package/dist/theme/builtinThemes.d.cts.map +0 -1
  489. package/dist/theme/derive.d.cts +0 -15
  490. package/dist/theme/derive.d.cts.map +0 -1
  491. package/dist/theme/parse.d.cts +0 -11
  492. package/dist/theme/parse.d.cts.map +0 -1
  493. package/dist/theme/piTheme.d.cts +0 -20
  494. package/dist/theme/piTheme.d.cts.map +0 -1
  495. package/dist/theme/preference.d.cts +0 -16
  496. package/dist/theme/preference.d.cts.map +0 -1
  497. package/dist/theme.d.cts +0 -8
  498. package/dist/types/editor.d.cts +0 -44
  499. package/dist/types/editor.d.cts.map +0 -1
  500. package/dist/types/theme.d.cts +0 -39
  501. package/dist/types/theme.d.cts.map +0 -1
  502. package/dist/types/tone.d.cts +0 -29
  503. package/dist/types/tone.d.cts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.cjs","names":["TooltipProvider","Tooltip","TooltipTrigger","cn","TooltipContent"],"sources":["../../../src/components/Breadcrumb.tsx"],"sourcesContent":["import { cn } from '../lib/cn.ts';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './Tooltip.tsx';\n\n/** The marker a collapsed run of segments is shown as. */\nexport const BREADCRUMB_ELLIPSIS = '…';\n\n/**\n * A path as breadcrumb segments, with the middle collapsed when it is deeper\n * than `keep` allows.\n *\n * The first segment and the last few are what place a leaf; the ones between\n * are what a reader skims past, so those are the ones that go. The leaf is\n * always the final segment and is never collapsed.\n */\nexport function breadcrumbSegments(path: string, keep = 4): string[] {\n const segments = path.split('/').filter((segment) => segment !== '');\n if (segments.length === 0) return [path];\n if (segments.length <= keep) return segments;\n // One leading segment for orientation, then the tail that names the leaf.\n return [segments[0] ?? '', BREADCRUMB_ELLIPSIS, ...segments.slice(segments.length - (keep - 2))];\n}\n\nexport interface BreadcrumbProps {\n /** The path to show, separated by forward slashes. */\n path: string;\n /** How many segments survive before the middle collapses. */\n keep?: number;\n /** Marks the trail so a test can find it. */\n 'data-testid'?: string;\n className?: string;\n}\n\n/**\n * A slash-separated path, shortened to fit and readable in full on hover.\n *\n * Two things shorten it, because they solve different problems. Collapsing the\n * middle keeps a deep path legible at any width, and truncation handles what is\n * left when the container is narrower than even that. Either one hides\n * something, so the whole path is always one hover away, wrapped rather than\n * clipped: a tooltip that truncates too would defeat the point of having one.\n *\n * The leaf carries the emphasis. A reader scanning a header is looking for the\n * file, and the directories are context for it.\n */\nexport function Breadcrumb({ path, keep, className, 'data-testid': testId }: BreadcrumbProps) {\n const segments = breadcrumbSegments(path, keep);\n const lastIndex = segments.length - 1;\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <span\n data-slot=\"breadcrumb\"\n data-testid={testId}\n title={undefined}\n className={cn('flex min-w-0 items-baseline gap-1 truncate font-mono text-[12px]', className)}\n >\n {segments.map((segment, index) => (\n // Segments repeat in a path (src/app/src), so the index is what\n // keeps two of the same name apart.\n <span key={`${segment}-${String(index)}`} className=\"flex min-w-0 items-baseline gap-1\">\n {index > 0 ? <span className=\"shrink-0 text-doom-faint\">/</span> : null}\n <span\n className={\n index === lastIndex ? 'truncate font-bold text-doom-hi' : 'shrink-0 truncate text-doom-faint'\n }\n >\n {segment}\n </span>\n </span>\n ))}\n </span>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-[32rem] break-all whitespace-normal\">{path}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"],"mappings":"+FAcA,SAAgB,EAAmB,EAAc,EAAO,EAAa,CACnE,IAAM,EAAW,EAAK,MAAM,GAAG,CAAC,CAAC,OAAQ,GAAY,IAAY,EAAE,EAInE,OAHI,EAAS,SAAW,EAAU,CAAC,CAAI,EACnC,EAAS,QAAU,EAAa,EAE7B,CAAC,EAAS,IAAM,OAAyB,GAAG,EAAS,MAAM,EAAS,QAAU,EAAO,EAAE,CAAC,CACjG,CAwBA,SAAgB,EAAW,CAAE,OAAM,OAAM,YAAW,cAAe,GAA2B,CAC5F,IAAM,EAAW,EAAmB,EAAM,CAAI,EACxC,EAAY,EAAS,OAAS,EAEpC,OACE,EAAA,EAAA,IAAA,CAACA,EAAAA,gBAAD,CAAA,UACE,EAAA,EAAA,KAAA,CAACC,EAAAA,QAAD,CAAA,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,QAAA,GACd,UAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,YAAU,aACV,cAAa,EACb,MAAO,IAAA,GACP,UAAWC,EAAAA,GAAG,mEAAoE,CAAS,EAE1F,SAAA,EAAS,KAAK,EAAS,KAGtB,EAAA,EAAA,KAAA,CAAC,OAAD,CAA0C,UAAU,oCAApD,SAAA,CACG,EAAQ,GAAI,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA2B,SAAA,GAAO,CAAA,EAAI,MACnE,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,UACE,IAAU,EAAY,kCAAoC,oCAG3D,SAAA,CACG,CAAA,CACF,CATK,EAAA,GAAG,EAAQ,GAAG,OAAO,CAAK,GAS/B,CACP,CACG,CAAA,CACQ,CAAA,GAChB,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,UAAU,4CAA6C,SAAA,CAAqB,CAAA,CACrF,CAAA,CAAA,CACM,CAAA,CAErB"}
1
+ {"version":3,"file":"Breadcrumb.cjs","names":["TooltipProvider","Tooltip","TooltipTrigger","cn","TooltipContent"],"sources":["../../../src/components/Breadcrumb.tsx"],"sourcesContent":["import { cn } from '../lib/cn';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './Tooltip';\n\n/** The marker a collapsed run of segments is shown as. */\nexport const BREADCRUMB_ELLIPSIS = '…';\n\n/**\n * A path as breadcrumb segments, with the middle collapsed when it is deeper\n * than `keep` allows.\n *\n * The first segment and the last few are what place a leaf; the ones between\n * are what a reader skims past, so those are the ones that go. The leaf is\n * always the final segment and is never collapsed.\n */\nexport function breadcrumbSegments(path: string, keep = 4): string[] {\n const segments = path.split('/').filter((segment) => segment !== '');\n if (segments.length === 0) return [path];\n if (segments.length <= keep) return segments;\n // One leading segment for orientation, then the tail that names the leaf.\n return [segments[0] ?? '', BREADCRUMB_ELLIPSIS, ...segments.slice(segments.length - (keep - 2))];\n}\n\nexport interface BreadcrumbProps {\n /** The path to show, separated by forward slashes. */\n path: string;\n /** How many segments survive before the middle collapses. */\n keep?: number;\n /** Marks the trail so a test can find it. */\n 'data-testid'?: string;\n className?: string;\n}\n\n/**\n * A slash-separated path, shortened to fit and readable in full on hover.\n *\n * Two things shorten it, because they solve different problems. Collapsing the\n * middle keeps a deep path legible at any width, and truncation handles what is\n * left when the container is narrower than even that. Either one hides\n * something, so the whole path is always one hover away, wrapped rather than\n * clipped: a tooltip that truncates too would defeat the point of having one.\n *\n * The leaf carries the emphasis. A reader scanning a header is looking for the\n * file, and the directories are context for it.\n */\nexport function Breadcrumb({ path, keep, className, 'data-testid': testId }: BreadcrumbProps) {\n const segments = breadcrumbSegments(path, keep);\n const lastIndex = segments.length - 1;\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <span\n data-slot=\"breadcrumb\"\n data-testid={testId}\n title={undefined}\n className={cn('flex min-w-0 items-baseline gap-1 truncate font-mono text-sm', className)}\n >\n {segments.map((segment, index) => (\n // Segments repeat in a path (src/app/src), so the index is what\n // keeps two of the same name apart.\n <span key={`${segment}-${String(index)}`} className=\"flex min-w-0 items-baseline gap-1\">\n {index > 0 ? <span className=\"shrink-0 text-doom-faint\">/</span> : null}\n <span\n className={\n index === lastIndex ? 'truncate font-bold text-doom-hi' : 'shrink-0 truncate text-doom-faint'\n }\n >\n {segment}\n </span>\n </span>\n ))}\n </span>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-[32rem] break-all whitespace-normal\">{path}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"],"mappings":"+FAcA,SAAgB,EAAmB,EAAc,EAAO,EAAa,CACnE,IAAM,EAAW,EAAK,MAAM,GAAG,CAAC,CAAC,OAAQ,GAAY,IAAY,EAAE,EAInE,OAHI,EAAS,SAAW,EAAU,CAAC,CAAI,EACnC,EAAS,QAAU,EAAa,EAE7B,CAAC,EAAS,IAAM,OAAyB,GAAG,EAAS,MAAM,EAAS,QAAU,EAAO,EAAE,CAAC,CACjG,CAwBA,SAAgB,EAAW,CAAE,OAAM,OAAM,YAAW,cAAe,GAA2B,CAC5F,IAAM,EAAW,EAAmB,EAAM,CAAI,EACxC,EAAY,EAAS,OAAS,EAEpC,MACE,iBAAA,EAAA,EAAA,IAAA,CAACA,EAAAA,gBAAD,CAAA,SACE,iBAAA,EAAA,EAAA,KAAA,CAACC,EAAAA,QAAD,CAAA,SAAA,CACE,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,QAAA,GACd,SAAA,iBAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,YAAU,aACV,cAAa,EACb,MAAO,IAAA,GACP,UAAWC,EAAAA,GAAG,+DAAgE,CAAS,EAEtF,SAAA,EAAS,KAAK,EAAS,IAGtB,iBAAA,EAAA,EAAA,KAAA,CAAC,OAAD,CAA0C,UAAU,oCAApD,SAAA,CACG,EAAQ,EAAI,iBAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA2B,SAAA,GAAO,CAAA,EAAI,KACnE,iBAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,UACE,IAAU,EAAY,kCAAoC,oCAG3D,SAAA,CACG,CAAA,CACF,CATK,EAAA,GAAG,EAAQ,GAAG,OAAO,CAAK,GAS/B,CACP,CACG,CAAA,CACQ,CAAA,EAChB,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,UAAU,4CAA6C,SAAA,CAAqB,CAAA,CACrF,CAAA,CAAA,CACM,CAAA,CAErB"}
@@ -1,6 +1,6 @@
1
1
  //#region src/components/Breadcrumb.d.ts
2
2
  /** The marker a collapsed run of segments is shown as. */
3
- declare const BREADCRUMB_ELLIPSIS = "…";
3
+ export declare const BREADCRUMB_ELLIPSIS = "…";
4
4
  /**
5
5
  * A path as breadcrumb segments, with the middle collapsed when it is deeper
6
6
  * than `keep` allows.
@@ -9,8 +9,8 @@ declare const BREADCRUMB_ELLIPSIS = "…";
9
9
  * are what a reader skims past, so those are the ones that go. The leaf is
10
10
  * always the final segment and is never collapsed.
11
11
  */
12
- declare function breadcrumbSegments(path: string, keep?: number): string[];
13
- interface BreadcrumbProps {
12
+ export declare function breadcrumbSegments(path: string, keep?: number): string[];
13
+ export interface BreadcrumbProps {
14
14
  /** The path to show, separated by forward slashes. */
15
15
  path: string;
16
16
  /** How many segments survive before the middle collapses. */
@@ -31,7 +31,6 @@ interface BreadcrumbProps {
31
31
  * The leaf carries the emphasis. A reader scanning a header is looking for the
32
32
  * file, and the directories are context for it.
33
33
  */
34
- declare function Breadcrumb({ path, keep, className, 'data-testid': testId }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function Breadcrumb({ path, keep, className, 'data-testid': testId }: BreadcrumbProps): import("react").JSX.Element;
35
35
  //#endregion
36
- export { BREADCRUMB_ELLIPSIS, Breadcrumb, BreadcrumbProps, breadcrumbSegments };
37
36
  //# sourceMappingURL=Breadcrumb.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.d.mts","names":[],"sources":["../../../src/components/Breadcrumb.tsx"],"mappings":";;cAIa;;;;;;;;;iBAUG,mBAAmB,cAAc;UAQhC;;EAEf;;EAEA;;EAEA;EACA;;;;;;;;;;;;;;iBAec,aAAa,MAAM,MAAM,0BAA0B,UAAU,8CAAe,IAAA"}
1
+ {"version":3,"file":"Breadcrumb.d.mts","names":[],"sources":["../../../src/components/Breadcrumb.tsx"],"mappings":";;qBAIa;;;;;;;;;wBAUG,mBAAmB,cAAc;iBAQhC;;EAEf;;EAEA;;EAEA;EACA;;;;;;;;;;;;;;wBAec,aAAa,MAAM,MAAM,0BAA0B,UAAU,kCAAe,IAAA"}
@@ -1,2 +1,2 @@
1
- import{cn as e}from"../lib/cn.mjs";import{Tooltip as t,TooltipContent as n,TooltipProvider as r,TooltipTrigger as i}from"./Tooltip.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";const s=`…`;function c(e,t=4){let n=e.split(`/`).filter(e=>e!==``);return n.length===0?[e]:n.length<=t?n:[n[0]??``,`…`,...n.slice(n.length-(t-2))]}function l({path:s,keep:l,className:u,"data-testid":d}){let f=c(s,l),p=f.length-1;return a(r,{children:o(t,{children:[a(i,{asChild:!0,children:a(`span`,{"data-slot":`breadcrumb`,"data-testid":d,title:void 0,className:e(`flex min-w-0 items-baseline gap-1 truncate font-mono text-[12px]`,u),children:f.map((e,t)=>o(`span`,{className:`flex min-w-0 items-baseline gap-1`,children:[t>0?a(`span`,{className:`shrink-0 text-doom-faint`,children:`/`}):null,a(`span`,{className:t===p?`truncate font-bold text-doom-hi`:`shrink-0 truncate text-doom-faint`,children:e})]},`${e}-${String(t)}`))})}),a(n,{className:`max-w-[32rem] break-all whitespace-normal`,children:s})]})})}export{s as BREADCRUMB_ELLIPSIS,l as Breadcrumb,c as breadcrumbSegments};
1
+ import{cn as e}from"../lib/cn.mjs";import{Tooltip as t,TooltipContent as n,TooltipProvider as r,TooltipTrigger as i}from"./Tooltip.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";const s=`…`;function c(e,t=4){let n=e.split(`/`).filter(e=>e!==``);return n.length===0?[e]:n.length<=t?n:[n[0]??``,`…`,...n.slice(n.length-(t-2))]}function l({path:s,keep:l,className:u,"data-testid":d}){let f=c(s,l),p=f.length-1;return/* @__PURE__ */ a(r,{children:/* @__PURE__ */ o(t,{children:[/* @__PURE__ */ a(i,{asChild:!0,children:/* @__PURE__ */ a(`span`,{"data-slot":`breadcrumb`,"data-testid":d,title:void 0,className:e(`flex min-w-0 items-baseline gap-1 truncate font-mono text-sm`,u),children:f.map((e,t)=>/* @__PURE__ */ o(`span`,{className:`flex min-w-0 items-baseline gap-1`,children:[t>0?/* @__PURE__ */ a(`span`,{className:`shrink-0 text-doom-faint`,children:`/`}):null,/* @__PURE__ */ a(`span`,{className:t===p?`truncate font-bold text-doom-hi`:`shrink-0 truncate text-doom-faint`,children:e})]},`${e}-${String(t)}`))})}),/* @__PURE__ */ a(n,{className:`max-w-[32rem] break-all whitespace-normal`,children:s})]})})}export{s as BREADCRUMB_ELLIPSIS,l as Breadcrumb,c as breadcrumbSegments};
2
2
  //# sourceMappingURL=Breadcrumb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.mjs","names":[],"sources":["../../../src/components/Breadcrumb.tsx"],"sourcesContent":["import { cn } from '../lib/cn.ts';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './Tooltip.tsx';\n\n/** The marker a collapsed run of segments is shown as. */\nexport const BREADCRUMB_ELLIPSIS = '…';\n\n/**\n * A path as breadcrumb segments, with the middle collapsed when it is deeper\n * than `keep` allows.\n *\n * The first segment and the last few are what place a leaf; the ones between\n * are what a reader skims past, so those are the ones that go. The leaf is\n * always the final segment and is never collapsed.\n */\nexport function breadcrumbSegments(path: string, keep = 4): string[] {\n const segments = path.split('/').filter((segment) => segment !== '');\n if (segments.length === 0) return [path];\n if (segments.length <= keep) return segments;\n // One leading segment for orientation, then the tail that names the leaf.\n return [segments[0] ?? '', BREADCRUMB_ELLIPSIS, ...segments.slice(segments.length - (keep - 2))];\n}\n\nexport interface BreadcrumbProps {\n /** The path to show, separated by forward slashes. */\n path: string;\n /** How many segments survive before the middle collapses. */\n keep?: number;\n /** Marks the trail so a test can find it. */\n 'data-testid'?: string;\n className?: string;\n}\n\n/**\n * A slash-separated path, shortened to fit and readable in full on hover.\n *\n * Two things shorten it, because they solve different problems. Collapsing the\n * middle keeps a deep path legible at any width, and truncation handles what is\n * left when the container is narrower than even that. Either one hides\n * something, so the whole path is always one hover away, wrapped rather than\n * clipped: a tooltip that truncates too would defeat the point of having one.\n *\n * The leaf carries the emphasis. A reader scanning a header is looking for the\n * file, and the directories are context for it.\n */\nexport function Breadcrumb({ path, keep, className, 'data-testid': testId }: BreadcrumbProps) {\n const segments = breadcrumbSegments(path, keep);\n const lastIndex = segments.length - 1;\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <span\n data-slot=\"breadcrumb\"\n data-testid={testId}\n title={undefined}\n className={cn('flex min-w-0 items-baseline gap-1 truncate font-mono text-[12px]', className)}\n >\n {segments.map((segment, index) => (\n // Segments repeat in a path (src/app/src), so the index is what\n // keeps two of the same name apart.\n <span key={`${segment}-${String(index)}`} className=\"flex min-w-0 items-baseline gap-1\">\n {index > 0 ? <span className=\"shrink-0 text-doom-faint\">/</span> : null}\n <span\n className={\n index === lastIndex ? 'truncate font-bold text-doom-hi' : 'shrink-0 truncate text-doom-faint'\n }\n >\n {segment}\n </span>\n </span>\n ))}\n </span>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-[32rem] break-all whitespace-normal\">{path}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"],"mappings":"0LAIA,MAAa,EAAsB,IAUnC,SAAgB,EAAmB,EAAc,EAAO,EAAa,CACnE,IAAM,EAAW,EAAK,MAAM,GAAG,CAAC,CAAC,OAAQ,GAAY,IAAY,EAAE,EAInE,OAHI,EAAS,SAAW,EAAU,CAAC,CAAI,EACnC,EAAS,QAAU,EAAa,EAE7B,CAAC,EAAS,IAAM,OAAyB,GAAG,EAAS,MAAM,EAAS,QAAU,EAAO,EAAE,CAAC,CACjG,CAwBA,SAAgB,EAAW,CAAE,OAAM,OAAM,YAAW,cAAe,GAA2B,CAC5F,IAAM,EAAW,EAAmB,EAAM,CAAI,EACxC,EAAY,EAAS,OAAS,EAEpC,OACE,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAgB,QAAA,GACd,SAAA,EAAC,OAAD,CACE,YAAU,aACV,cAAa,EACb,MAAO,IAAA,GACP,UAAW,EAAG,mEAAoE,CAAS,EAE1F,SAAA,EAAS,KAAK,EAAS,IAGtB,EAAC,OAAD,CAA0C,UAAU,oCAApD,SAAA,CACG,EAAQ,EAAI,EAAC,OAAD,CAAM,UAAU,2BAA2B,SAAA,GAAO,CAAA,EAAI,KACnE,EAAC,OAAD,CACE,UACE,IAAU,EAAY,kCAAoC,oCAG3D,SAAA,CACG,CAAA,CACF,CATK,EAAA,GAAG,EAAQ,GAAG,OAAO,CAAK,GAS/B,CACP,CACG,CAAA,CACQ,CAAA,EAChB,EAAC,EAAD,CAAgB,UAAU,4CAA6C,SAAA,CAAqB,CAAA,CACrF,CAAA,CAAA,CACM,CAAA,CAErB"}
1
+ {"version":3,"file":"Breadcrumb.mjs","names":[],"sources":["../../../src/components/Breadcrumb.tsx"],"sourcesContent":["import { cn } from '../lib/cn';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './Tooltip';\n\n/** The marker a collapsed run of segments is shown as. */\nexport const BREADCRUMB_ELLIPSIS = '…';\n\n/**\n * A path as breadcrumb segments, with the middle collapsed when it is deeper\n * than `keep` allows.\n *\n * The first segment and the last few are what place a leaf; the ones between\n * are what a reader skims past, so those are the ones that go. The leaf is\n * always the final segment and is never collapsed.\n */\nexport function breadcrumbSegments(path: string, keep = 4): string[] {\n const segments = path.split('/').filter((segment) => segment !== '');\n if (segments.length === 0) return [path];\n if (segments.length <= keep) return segments;\n // One leading segment for orientation, then the tail that names the leaf.\n return [segments[0] ?? '', BREADCRUMB_ELLIPSIS, ...segments.slice(segments.length - (keep - 2))];\n}\n\nexport interface BreadcrumbProps {\n /** The path to show, separated by forward slashes. */\n path: string;\n /** How many segments survive before the middle collapses. */\n keep?: number;\n /** Marks the trail so a test can find it. */\n 'data-testid'?: string;\n className?: string;\n}\n\n/**\n * A slash-separated path, shortened to fit and readable in full on hover.\n *\n * Two things shorten it, because they solve different problems. Collapsing the\n * middle keeps a deep path legible at any width, and truncation handles what is\n * left when the container is narrower than even that. Either one hides\n * something, so the whole path is always one hover away, wrapped rather than\n * clipped: a tooltip that truncates too would defeat the point of having one.\n *\n * The leaf carries the emphasis. A reader scanning a header is looking for the\n * file, and the directories are context for it.\n */\nexport function Breadcrumb({ path, keep, className, 'data-testid': testId }: BreadcrumbProps) {\n const segments = breadcrumbSegments(path, keep);\n const lastIndex = segments.length - 1;\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <span\n data-slot=\"breadcrumb\"\n data-testid={testId}\n title={undefined}\n className={cn('flex min-w-0 items-baseline gap-1 truncate font-mono text-sm', className)}\n >\n {segments.map((segment, index) => (\n // Segments repeat in a path (src/app/src), so the index is what\n // keeps two of the same name apart.\n <span key={`${segment}-${String(index)}`} className=\"flex min-w-0 items-baseline gap-1\">\n {index > 0 ? <span className=\"shrink-0 text-doom-faint\">/</span> : null}\n <span\n className={\n index === lastIndex ? 'truncate font-bold text-doom-hi' : 'shrink-0 truncate text-doom-faint'\n }\n >\n {segment}\n </span>\n </span>\n ))}\n </span>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-[32rem] break-all whitespace-normal\">{path}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"],"mappings":"0LAIA,MAAa,EAAsB,IAUnC,SAAgB,EAAmB,EAAc,EAAO,EAAa,CACnE,IAAM,EAAW,EAAK,MAAM,GAAG,CAAC,CAAC,OAAQ,GAAY,IAAY,EAAE,EAInE,OAHI,EAAS,SAAW,EAAU,CAAC,CAAI,EACnC,EAAS,QAAU,EAAa,EAE7B,CAAC,EAAS,IAAM,OAAyB,GAAG,EAAS,MAAM,EAAS,QAAU,EAAO,EAAE,CAAC,CACjG,CAwBA,SAAgB,EAAW,CAAE,OAAM,OAAM,YAAW,cAAe,GAA2B,CAC5F,IAAM,EAAW,EAAmB,EAAM,CAAI,EACxC,EAAY,EAAS,OAAS,EAEpC,MACE,kBAAC,EAAD,CAAA,SACE,kBAAC,EAAD,CAAA,SAAA,CACE,kBAAC,EAAD,CAAgB,QAAA,GACd,SAAA,kBAAC,OAAD,CACE,YAAU,aACV,cAAa,EACb,MAAO,IAAA,GACP,UAAW,EAAG,+DAAgE,CAAS,EAEtF,SAAA,EAAS,KAAK,EAAS,IAGtB,kBAAC,OAAD,CAA0C,UAAU,oCAApD,SAAA,CACG,EAAQ,EAAI,kBAAC,OAAD,CAAM,UAAU,2BAA2B,SAAA,GAAO,CAAA,EAAI,KACnE,kBAAC,OAAD,CACE,UACE,IAAU,EAAY,kCAAoC,oCAG3D,SAAA,CACG,CAAA,CACF,CATK,EAAA,GAAG,EAAQ,GAAG,OAAO,CAAK,GAS/B,CACP,CACG,CAAA,CACQ,CAAA,EAChB,kBAAC,EAAD,CAAgB,UAAU,4CAA6C,SAAA,CAAqB,CAAA,CACrF,CAAA,CAAA,CACM,CAAA,CAErB"}
@@ -1,2 +1,2 @@
1
- const e=require("../lib/cn.cjs"),t=require("./Spinner.cjs");let n=require("radix-ui"),r=require("react/jsx-runtime");const i=(0,require("class-variance-authority").cva)(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`bg-doom-blue font-bold text-doom-rail hover:brightness-110`,outline:`border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi`,ghost:`text-doom-dim hover:bg-doom-panel hover:text-doom-hi`,subtle:`bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi`,danger:`bg-doom-red font-bold text-doom-rail hover:brightness-110`,"danger-outline":`border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110`,success:`bg-doom-green font-bold text-doom-rail hover:brightness-110`,link:`text-doom-blue hover:underline`},size:{xs:`h-5 rounded px-1.5 text-[9px]`,sm:`h-6 px-2.5 text-[10px]`,md:`h-7 px-3 text-[11px]`,lg:`h-8 px-3.5 text-[12px]`,icon:`h-5 w-5 rounded p-0`,"icon-md":`h-7 w-7 p-0`,card:`h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal`}},defaultVariants:{variant:`outline`,size:`md`}});function a({className:a,variant:o,size:s,asChild:c=!1,loading:l=!1,loadingLabel:u,disabled:d,type:f,children:p,...m}){let h=c?n.Slot.Root:`button`,g=!c&&l;return(0,r.jsx)(h,{"data-slot":`button`,type:c?void 0:f??`button`,"aria-busy":g?!0:void 0,disabled:c?void 0:d??g,className:e.cn(i({variant:o,size:s}),a),...m,children:c?p:(0,r.jsxs)(r.Fragment,{children:[g?(0,r.jsx)(t.Spinner,{label:u}):null,p]})})}exports.Button=a,exports.buttonVariants=i;
1
+ const e=require("../lib/cn.cjs"),t=require("./Spinner.cjs");let n=require("radix-ui"),r=require("react/jsx-runtime");const i=(0,require("class-variance-authority").cva)(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`bg-doom-blue font-bold text-doom-rail hover:brightness-110`,outline:`border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi`,ghost:`text-doom-dim hover:bg-doom-panel hover:text-doom-hi`,subtle:`bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi`,danger:`bg-doom-red font-bold text-doom-rail hover:brightness-110`,"danger-outline":`border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110`,success:`bg-doom-green font-bold text-doom-rail hover:brightness-110`,link:`text-doom-blue hover:underline`},size:{xs:`h-5 rounded px-1.5 text-2xs`,sm:`h-6 px-2.5 text-xs`,md:`h-7 px-3 text-sm`,lg:`h-8 px-3.5 text-base`,icon:`h-5 w-5 rounded p-0`,"icon-md":`h-7 w-7 p-0`,card:`h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal`}},defaultVariants:{variant:`outline`,size:`md`}});function a({className:a,variant:o,size:s,asChild:c=!1,loading:l=!1,loadingLabel:u,disabled:d,type:f,children:p,...m}){let h=c?n.Slot.Root:`button`,g=!c&&l;return/* @__PURE__ */ (0,r.jsx)(h,{"data-slot":`button`,type:c?void 0:f??`button`,"aria-busy":g?!0:void 0,disabled:c?void 0:d??g,className:e.cn(i({variant:o,size:s}),a),...m,children:c?p:/* @__PURE__ */ (0,r.jsxs)(r.Fragment,{children:[g?/* @__PURE__ */ (0,r.jsx)(t.Spinner,{label:u}):null,p]})})}exports.Button=a,exports.buttonVariants=i;
2
2
  //# sourceMappingURL=Button.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.cjs","names":["cva","Slot","cn","Spinner"],"sources":["../../../src/components/Button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { Spinner } from './Spinner.tsx';\n\nexport const buttonVariants = cva(\n 'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n primary: 'bg-doom-blue font-bold text-doom-rail hover:brightness-110',\n outline: 'border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi',\n ghost: 'text-doom-dim hover:bg-doom-panel hover:text-doom-hi',\n subtle: 'bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi',\n danger: 'bg-doom-red font-bold text-doom-rail hover:brightness-110',\n 'danger-outline': 'border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110',\n success: 'bg-doom-green font-bold text-doom-rail hover:brightness-110',\n link: 'text-doom-blue hover:underline',\n },\n size: {\n xs: 'h-5 rounded px-1.5 text-[9px]',\n sm: 'h-6 px-2.5 text-[10px]',\n md: 'h-7 px-3 text-[11px]',\n lg: 'h-8 px-3.5 text-[12px]',\n icon: 'h-5 w-5 rounded p-0',\n 'icon-md': 'h-7 w-7 p-0',\n /**\n * A whole card that is one click target: a session in the rail, a run\n * in a panel. It keeps the button's focus ring and cursor and gives up\n * the button's single-line box, which is what a card-shaped <button>\n * would otherwise have to restate.\n */\n card: 'h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal',\n },\n },\n defaultVariants: { variant: 'outline', size: 'md' },\n },\n);\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;\n\nexport interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n /** Render the child element instead of a <button>, passing the classes down (shadcn's asChild). */\n asChild?: boolean;\n /**\n * Work is in flight: the button shows a spinner and stops accepting clicks.\n * Ignored under asChild, where the child owns its own content.\n */\n loading?: boolean;\n /** What the spinner announces while loading; omit it and the wait is silent. */\n loadingLabel?: string;\n}\n\n/** The one button: every variant is a theme token, so it recolours with the theme. */\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n loading = false,\n loadingLabel,\n disabled,\n type,\n children,\n ...props\n}: ButtonProps) {\n const Component = asChild ? Slot.Root : 'button';\n const busy = !asChild && loading;\n return (\n <Component\n data-slot=\"button\"\n type={asChild ? undefined : (type ?? 'button')}\n aria-busy={busy ? true : undefined}\n disabled={asChild ? undefined : (disabled ?? busy)}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {/* Slot takes exactly one child, so asChild hands its element straight through. */}\n {asChild ? (\n children\n ) : (\n <>\n {busy ? <Spinner label={loadingLabel} /> : null}\n {children}\n </>\n )}\n </Component>\n );\n}\n"],"mappings":"qHAMA,MAAa,GAAA,oCAAiBA,CAAAA,CAAAA,IAAAA,CAC5B,yUACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,6DACT,QAAS,uFACT,MAAO,uDACP,OAAQ,oEACR,OAAQ,4DACR,iBAAkB,4FAClB,QAAS,8DACT,KAAM,gCACR,EACA,KAAM,CACJ,GAAI,gCACJ,GAAI,yBACJ,GAAI,uBACJ,GAAI,yBACJ,KAAM,sBACN,UAAW,cAOX,KAAM,uGACR,CACF,EACA,gBAAiB,CAAE,QAAS,UAAW,KAAM,IAAK,CACpD,CACF,EAkBA,SAAgB,EAAO,CACrB,YACA,UACA,OACA,UAAU,GACV,UAAU,GACV,eACA,WACA,OACA,WACA,GAAG,GACW,CACd,IAAM,EAAY,EAAUC,EAAAA,KAAK,KAAO,SAClC,EAAO,CAAC,GAAW,EACzB,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,YAAU,SACV,KAAM,EAAU,IAAA,GAAa,GAAQ,SACrC,YAAW,EAAO,GAAO,IAAA,GACzB,SAAU,EAAU,IAAA,GAAa,GAAY,EAC7C,UAAWC,EAAAA,GAAG,EAAe,CAAE,UAAS,MAAK,CAAC,EAAG,CAAS,EAC1D,GAAI,EAGH,SAAA,EACC,GAEA,EAAA,EAAA,KAAA,CAAA,EAAA,SAAA,CAAA,SAAA,CACG,GAAO,EAAA,EAAA,IAAA,CAACC,EAAAA,QAAD,CAAS,MAAO,CAAe,CAAA,EAAI,KAC1C,CACD,CAAA,CAAA,CAEK,CAAA,CAEf"}
1
+ {"version":3,"file":"Button.cjs","names":["cva","Slot","cn","Spinner"],"sources":["../../../src/components/Button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { Spinner } from './Spinner';\n\nexport const buttonVariants = cva(\n 'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n primary: 'bg-doom-blue font-bold text-doom-rail hover:brightness-110',\n outline: 'border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi',\n ghost: 'text-doom-dim hover:bg-doom-panel hover:text-doom-hi',\n subtle: 'bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi',\n danger: 'bg-doom-red font-bold text-doom-rail hover:brightness-110',\n 'danger-outline': 'border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110',\n success: 'bg-doom-green font-bold text-doom-rail hover:brightness-110',\n link: 'text-doom-blue hover:underline',\n },\n size: {\n xs: 'h-5 rounded px-1.5 text-2xs',\n sm: 'h-6 px-2.5 text-xs',\n md: 'h-7 px-3 text-sm',\n lg: 'h-8 px-3.5 text-base',\n icon: 'h-5 w-5 rounded p-0',\n 'icon-md': 'h-7 w-7 p-0',\n /**\n * A whole card that is one click target: a session in the rail, a run\n * in a panel. It keeps the button's focus ring and cursor and gives up\n * the button's single-line box, which is what a card-shaped <button>\n * would otherwise have to restate.\n */\n card: 'h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal',\n },\n },\n defaultVariants: { variant: 'outline', size: 'md' },\n },\n);\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;\n\nexport interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n /** Render the child element instead of a <button>, passing the classes down (shadcn's asChild). */\n asChild?: boolean;\n /**\n * Work is in flight: the button shows a spinner and stops accepting clicks.\n * Ignored under asChild, where the child owns its own content.\n */\n loading?: boolean;\n /** What the spinner announces while loading; omit it and the wait is silent. */\n loadingLabel?: string;\n}\n\n/** The one button: every variant is a theme token, so it recolours with the theme. */\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n loading = false,\n loadingLabel,\n disabled,\n type,\n children,\n ...props\n}: ButtonProps) {\n const Component = asChild ? Slot.Root : 'button';\n const busy = !asChild && loading;\n return (\n <Component\n data-slot=\"button\"\n type={asChild ? undefined : (type ?? 'button')}\n aria-busy={busy ? true : undefined}\n disabled={asChild ? undefined : (disabled ?? busy)}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {/* Slot takes exactly one child, so asChild hands its element straight through. */}\n {asChild ? (\n children\n ) : (\n <>\n {busy ? <Spinner label={loadingLabel} /> : null}\n {children}\n </>\n )}\n </Component>\n );\n}\n"],"mappings":"qHAOA,MAAa,GAAA,oCAAiBA,CAAAA,CAAAA,IAAAA,CAC5B,yUACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,6DACT,QAAS,uFACT,MAAO,uDACP,OAAQ,oEACR,OAAQ,4DACR,iBAAkB,4FAClB,QAAS,8DACT,KAAM,gCACR,EACA,KAAM,CACJ,GAAI,8BACJ,GAAI,qBACJ,GAAI,mBACJ,GAAI,uBACJ,KAAM,sBACN,UAAW,cAOX,KAAM,uGACR,CACF,EACA,gBAAiB,CAAE,QAAS,UAAW,KAAM,IAAK,CACpD,CACF,EAkBA,SAAgB,EAAO,CACrB,YACA,UACA,OACA,UAAU,GACV,UAAU,GACV,eACA,WACA,OACA,WACA,GAAG,GACW,CACd,IAAM,EAAY,EAAUC,EAAAA,KAAK,KAAO,SAClC,EAAO,CAAC,GAAW,EACzB,MACE,iBAAA,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,YAAU,SACV,KAAM,EAAU,IAAA,GAAa,GAAQ,SACrC,YAAW,EAAO,GAAO,IAAA,GACzB,SAAU,EAAU,IAAA,GAAa,GAAY,EAC7C,UAAWC,EAAAA,GAAG,EAAe,CAAE,UAAS,MAAK,CAAC,EAAG,CAAS,EAC1D,GAAI,EAGH,SAAA,EACC,EAEA,iBAAA,EAAA,EAAA,KAAA,CAAA,EAAA,SAAA,CAAA,SAAA,CACG,EAAO,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,QAAD,CAAS,MAAO,CAAe,CAAA,EAAI,KAC1C,CACD,CAAA,CAAA,CAEK,CAAA,CAEf"}
@@ -1,13 +1,13 @@
1
- import { VariantProps } from "class-variance-authority";
2
1
  import { ComponentProps } from "react";
2
+ import { VariantProps } from "class-variance-authority";
3
3
  //#region src/components/Button.d.ts
4
- declare const buttonVariants: (props?: ({
4
+ export declare const buttonVariants: (props?: ({
5
5
  variant?: "danger" | "danger-outline" | "ghost" | "link" | "outline" | "primary" | "subtle" | "success" | null | undefined;
6
6
  size?: "card" | "icon" | "icon-md" | "lg" | "md" | "sm" | "xs" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
- type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;
9
- type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;
10
- interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
8
+ export type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;
9
+ export type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;
10
+ export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
11
11
  /** Render the child element instead of a <button>, passing the classes down (shadcn's asChild). */
12
12
  asChild?: boolean;
13
13
  /**
@@ -19,7 +19,6 @@ interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof butt
19
19
  loadingLabel?: string;
20
20
  }
21
21
  /** The one button: every variant is a theme token, so it recolours with the theme. */
22
- declare function Button({ className, variant, size, asChild, loading, loadingLabel, disabled, type, children, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function Button({ className, variant, size, asChild, loading, loadingLabel, disabled, type, children, ...props }: ButtonProps): import("react").JSX.Element;
23
23
  //#endregion
24
- export { Button, ButtonProps, ButtonSize, ButtonVariant, buttonVariants };
25
24
  //# sourceMappingURL=Button.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.mts","names":[],"sources":["../../../src/components/Button.tsx"],"mappings":";;;cAMa,iBAAc;;;6CAgC1B;KAEW,gBAAgB,YAAY,oBAAoB;KAChD,aAAa,YAAY,oBAAoB;UAExC,oBAAoB,0BAA0B,oBAAoB;;EAEjF;;;;;EAKA;;EAEA;;;iBAIc,SACd,WACA,SACA,MACA,SACA,SACA,cACA,UACA,MACA,aACG,SACF,0CAAW,IAAA"}
1
+ {"version":3,"file":"Button.d.mts","names":[],"sources":["../../../src/components/Button.tsx"],"mappings":";;;qBAOa,iBAAc;;;6CAgC1B;YAEW,gBAAgB,YAAY,oBAAoB;YAChD,aAAa,YAAY,oBAAoB;iBAExC,oBAAoB,0BAA0B,oBAAoB;;EAEjF;;;;;EAKA;;EAEA;;;wBAIc,SACd,WACA,SACA,MACA,SACA,SACA,cACA,UACA,MACA,aACG,SACF,8BAAW,IAAA"}
@@ -1,2 +1,2 @@
1
- import{cn as e}from"../lib/cn.mjs";import{Spinner as t}from"./Spinner.mjs";import{Slot as n}from"radix-ui";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";import{cva as o}from"class-variance-authority";const s=o(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`bg-doom-blue font-bold text-doom-rail hover:brightness-110`,outline:`border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi`,ghost:`text-doom-dim hover:bg-doom-panel hover:text-doom-hi`,subtle:`bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi`,danger:`bg-doom-red font-bold text-doom-rail hover:brightness-110`,"danger-outline":`border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110`,success:`bg-doom-green font-bold text-doom-rail hover:brightness-110`,link:`text-doom-blue hover:underline`},size:{xs:`h-5 rounded px-1.5 text-[9px]`,sm:`h-6 px-2.5 text-[10px]`,md:`h-7 px-3 text-[11px]`,lg:`h-8 px-3.5 text-[12px]`,icon:`h-5 w-5 rounded p-0`,"icon-md":`h-7 w-7 p-0`,card:`h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal`}},defaultVariants:{variant:`outline`,size:`md`}});function c({className:o,variant:c,size:l,asChild:u=!1,loading:d=!1,loadingLabel:f,disabled:p,type:m,children:h,...g}){let _=u?n.Root:`button`,v=!u&&d;return i(_,{"data-slot":`button`,type:u?void 0:m??`button`,"aria-busy":v?!0:void 0,disabled:u?void 0:p??v,className:e(s({variant:c,size:l}),o),...g,children:u?h:a(r,{children:[v?i(t,{label:f}):null,h]})})}export{c as Button,s as buttonVariants};
1
+ import{cn as e}from"../lib/cn.mjs";import{Spinner as t}from"./Spinner.mjs";import{Slot as n}from"radix-ui";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";import{cva as o}from"class-variance-authority";const s=o(`inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`bg-doom-blue font-bold text-doom-rail hover:brightness-110`,outline:`border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi`,ghost:`text-doom-dim hover:bg-doom-panel hover:text-doom-hi`,subtle:`bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi`,danger:`bg-doom-red font-bold text-doom-rail hover:brightness-110`,"danger-outline":`border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110`,success:`bg-doom-green font-bold text-doom-rail hover:brightness-110`,link:`text-doom-blue hover:underline`},size:{xs:`h-5 rounded px-1.5 text-2xs`,sm:`h-6 px-2.5 text-xs`,md:`h-7 px-3 text-sm`,lg:`h-8 px-3.5 text-base`,icon:`h-5 w-5 rounded p-0`,"icon-md":`h-7 w-7 p-0`,card:`h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal`}},defaultVariants:{variant:`outline`,size:`md`}});function c({className:o,variant:c,size:l,asChild:u=!1,loading:d=!1,loadingLabel:f,disabled:p,type:m,children:h,...g}){let _=u?n.Root:`button`,v=!u&&d;return/* @__PURE__ */ i(_,{"data-slot":`button`,type:u?void 0:m??`button`,"aria-busy":v?!0:void 0,disabled:u?void 0:p??v,className:e(s({variant:c,size:l}),o),...g,children:u?h:/* @__PURE__ */ a(r,{children:[v?/* @__PURE__ */ i(t,{label:f}):null,h]})})}export{c as Button,s as buttonVariants};
2
2
  //# sourceMappingURL=Button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","names":[],"sources":["../../../src/components/Button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { Spinner } from './Spinner.tsx';\n\nexport const buttonVariants = cva(\n 'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n primary: 'bg-doom-blue font-bold text-doom-rail hover:brightness-110',\n outline: 'border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi',\n ghost: 'text-doom-dim hover:bg-doom-panel hover:text-doom-hi',\n subtle: 'bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi',\n danger: 'bg-doom-red font-bold text-doom-rail hover:brightness-110',\n 'danger-outline': 'border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110',\n success: 'bg-doom-green font-bold text-doom-rail hover:brightness-110',\n link: 'text-doom-blue hover:underline',\n },\n size: {\n xs: 'h-5 rounded px-1.5 text-[9px]',\n sm: 'h-6 px-2.5 text-[10px]',\n md: 'h-7 px-3 text-[11px]',\n lg: 'h-8 px-3.5 text-[12px]',\n icon: 'h-5 w-5 rounded p-0',\n 'icon-md': 'h-7 w-7 p-0',\n /**\n * A whole card that is one click target: a session in the rail, a run\n * in a panel. It keeps the button's focus ring and cursor and gives up\n * the button's single-line box, which is what a card-shaped <button>\n * would otherwise have to restate.\n */\n card: 'h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal',\n },\n },\n defaultVariants: { variant: 'outline', size: 'md' },\n },\n);\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;\n\nexport interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n /** Render the child element instead of a <button>, passing the classes down (shadcn's asChild). */\n asChild?: boolean;\n /**\n * Work is in flight: the button shows a spinner and stops accepting clicks.\n * Ignored under asChild, where the child owns its own content.\n */\n loading?: boolean;\n /** What the spinner announces while loading; omit it and the wait is silent. */\n loadingLabel?: string;\n}\n\n/** The one button: every variant is a theme token, so it recolours with the theme. */\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n loading = false,\n loadingLabel,\n disabled,\n type,\n children,\n ...props\n}: ButtonProps) {\n const Component = asChild ? Slot.Root : 'button';\n const busy = !asChild && loading;\n return (\n <Component\n data-slot=\"button\"\n type={asChild ? undefined : (type ?? 'button')}\n aria-busy={busy ? true : undefined}\n disabled={asChild ? undefined : (disabled ?? busy)}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {/* Slot takes exactly one child, so asChild hands its element straight through. */}\n {asChild ? (\n children\n ) : (\n <>\n {busy ? <Spinner label={loadingLabel} /> : null}\n {children}\n </>\n )}\n </Component>\n );\n}\n"],"mappings":"0NAMA,MAAa,EAAiB,EAC5B,yUACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,6DACT,QAAS,uFACT,MAAO,uDACP,OAAQ,oEACR,OAAQ,4DACR,iBAAkB,4FAClB,QAAS,8DACT,KAAM,gCACR,EACA,KAAM,CACJ,GAAI,gCACJ,GAAI,yBACJ,GAAI,uBACJ,GAAI,yBACJ,KAAM,sBACN,UAAW,cAOX,KAAM,uGACR,CACF,EACA,gBAAiB,CAAE,QAAS,UAAW,KAAM,IAAK,CACpD,CACF,EAkBA,SAAgB,EAAO,CACrB,YACA,UACA,OACA,UAAU,GACV,UAAU,GACV,eACA,WACA,OACA,WACA,GAAG,GACW,CACd,IAAM,EAAY,EAAU,EAAK,KAAO,SAClC,EAAO,CAAC,GAAW,EACzB,OACE,EAAC,EAAD,CACE,YAAU,SACV,KAAM,EAAU,IAAA,GAAa,GAAQ,SACrC,YAAW,EAAO,GAAO,IAAA,GACzB,SAAU,EAAU,IAAA,GAAa,GAAY,EAC7C,UAAW,EAAG,EAAe,CAAE,UAAS,MAAK,CAAC,EAAG,CAAS,EAC1D,GAAI,EAGH,SAAA,EACC,EAEA,EAAA,EAAA,CAAA,SAAA,CACG,EAAO,EAAC,EAAD,CAAS,MAAO,CAAe,CAAA,EAAI,KAC1C,CACD,CAAA,CAAA,CAEK,CAAA,CAEf"}
1
+ {"version":3,"file":"Button.mjs","names":[],"sources":["../../../src/components/Button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { Spinner } from './Spinner';\n\nexport const buttonVariants = cva(\n 'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-mono transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n primary: 'bg-doom-blue font-bold text-doom-rail hover:brightness-110',\n outline: 'border border-doom-border text-doom-dim hover:border-doom-blue/50 hover:text-doom-hi',\n ghost: 'text-doom-dim hover:bg-doom-panel hover:text-doom-hi',\n subtle: 'bg-doom-panel text-doom-dim hover:bg-doom-deep hover:text-doom-hi',\n danger: 'bg-doom-red font-bold text-doom-rail hover:brightness-110',\n 'danger-outline': 'border border-doom-edge-red bg-doom-tint-red font-bold text-doom-red hover:brightness-110',\n success: 'bg-doom-green font-bold text-doom-rail hover:brightness-110',\n link: 'text-doom-blue hover:underline',\n },\n size: {\n xs: 'h-5 rounded px-1.5 text-2xs',\n sm: 'h-6 px-2.5 text-xs',\n md: 'h-7 px-3 text-sm',\n lg: 'h-8 px-3.5 text-base',\n icon: 'h-5 w-5 rounded p-0',\n 'icon-md': 'h-7 w-7 p-0',\n /**\n * A whole card that is one click target: a session in the rail, a run\n * in a panel. It keeps the button's focus ring and cursor and gives up\n * the button's single-line box, which is what a card-shaped <button>\n * would otherwise have to restate.\n */\n card: 'h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal',\n },\n },\n defaultVariants: { variant: 'outline', size: 'md' },\n },\n);\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;\n\nexport interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n /** Render the child element instead of a <button>, passing the classes down (shadcn's asChild). */\n asChild?: boolean;\n /**\n * Work is in flight: the button shows a spinner and stops accepting clicks.\n * Ignored under asChild, where the child owns its own content.\n */\n loading?: boolean;\n /** What the spinner announces while loading; omit it and the wait is silent. */\n loadingLabel?: string;\n}\n\n/** The one button: every variant is a theme token, so it recolours with the theme. */\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n loading = false,\n loadingLabel,\n disabled,\n type,\n children,\n ...props\n}: ButtonProps) {\n const Component = asChild ? Slot.Root : 'button';\n const busy = !asChild && loading;\n return (\n <Component\n data-slot=\"button\"\n type={asChild ? undefined : (type ?? 'button')}\n aria-busy={busy ? true : undefined}\n disabled={asChild ? undefined : (disabled ?? busy)}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {/* Slot takes exactly one child, so asChild hands its element straight through. */}\n {asChild ? (\n children\n ) : (\n <>\n {busy ? <Spinner label={loadingLabel} /> : null}\n {children}\n </>\n )}\n </Component>\n );\n}\n"],"mappings":"0NAOA,MAAa,EAAiB,EAC5B,yUACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,6DACT,QAAS,uFACT,MAAO,uDACP,OAAQ,oEACR,OAAQ,4DACR,iBAAkB,4FAClB,QAAS,8DACT,KAAM,gCACR,EACA,KAAM,CACJ,GAAI,8BACJ,GAAI,qBACJ,GAAI,mBACJ,GAAI,uBACJ,KAAM,sBACN,UAAW,cAOX,KAAM,uGACR,CACF,EACA,gBAAiB,CAAE,QAAS,UAAW,KAAM,IAAK,CACpD,CACF,EAkBA,SAAgB,EAAO,CACrB,YACA,UACA,OACA,UAAU,GACV,UAAU,GACV,eACA,WACA,OACA,WACA,GAAG,GACW,CACd,IAAM,EAAY,EAAU,EAAK,KAAO,SAClC,EAAO,CAAC,GAAW,EACzB,MACE,kBAAC,EAAD,CACE,YAAU,SACV,KAAM,EAAU,IAAA,GAAa,GAAQ,SACrC,YAAW,EAAO,GAAO,IAAA,GACzB,SAAU,EAAU,IAAA,GAAa,GAAY,EAC7C,UAAW,EAAG,EAAe,CAAE,UAAS,MAAK,CAAC,EAAG,CAAS,EAC1D,GAAI,EAGH,SAAA,EACC,EAEA,kBAAA,EAAA,CAAA,SAAA,CACG,EAAO,kBAAC,EAAD,CAAS,MAAO,CAAe,CAAA,EAAI,KAC1C,CACD,CAAA,CAAA,CAEK,CAAA,CAEf"}
@@ -1,2 +1,2 @@
1
- require("../icons/icons.cjs");const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime"),r=require("lucide-react");function i({className:i,...a}){return(0,n.jsx)(t.Checkbox.Root,{"data-slot":`checkbox`,className:e.cn(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue`,i),...a,children:(0,n.jsx)(t.Checkbox.Indicator,{"data-slot":`checkbox-indicator`,className:`text-doom-blue`,children:(0,n.jsx)(r.Check,{className:`h-2.5 w-2.5`})})})}exports.Checkbox=i;
1
+ require("../icons/icons.cjs");const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime"),r=require("lucide-react");function i({className:i,...a}){return/* @__PURE__ */ (0,n.jsx)(t.Checkbox.Root,{"data-slot":`checkbox`,className:e.cn(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue`,i),...a,children:/* @__PURE__ */ (0,n.jsx)(t.Checkbox.Indicator,{"data-slot":`checkbox-indicator`,className:`text-doom-blue`,children:/* @__PURE__ */ (0,n.jsx)(r.Check,{className:`h-2.5 w-2.5`})})})}exports.Checkbox=i;
2
2
  //# sourceMappingURL=Checkbox.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.cjs","names":["CheckboxPrimitive","cn","CheckIcon"],"sources":["../../../src/components/Checkbox.tsx"],"sourcesContent":["import { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\nimport { CheckIcon } from '../icons/icons.ts';\nimport { cn } from '../lib/cn.ts';\n\n/** A box that is on, off, or indeterminate; the tick is the accent on the deep well. */\nexport function Checkbox({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"text-doom-blue\">\n <CheckIcon className=\"h-2.5 w-2.5\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n"],"mappings":"kJAMA,SAAgB,EAAS,CAAE,YAAW,GAAG,GAAwD,CAC/F,OACE,EAAA,EAAA,IAAA,CAACA,EAAAA,SAAkB,KAAnB,CACE,YAAU,WACV,UAAWC,EAAAA,GACT,mVACA,CACF,EACA,GAAI,EAEJ,UAAA,EAAA,EAAA,IAAA,CAACD,EAAAA,SAAkB,UAAnB,CAA6B,YAAU,qBAAqB,UAAU,iBACpE,UAAA,EAAA,EAAA,IAAA,CAACE,EAAAA,MAAD,CAAW,UAAU,aAAe,CAAA,CACT,CAAA,CACP,CAAA,CAE5B"}
1
+ {"version":3,"file":"Checkbox.cjs","names":["CheckboxPrimitive","cn","CheckIcon"],"sources":["../../../src/components/Checkbox.tsx"],"sourcesContent":["import { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { CheckIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\n\n/** A box that is on, off, or indeterminate; the tick is the accent on the deep well. */\nexport function Checkbox({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"text-doom-blue\">\n <CheckIcon className=\"h-2.5 w-2.5\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n"],"mappings":"kJAOA,SAAgB,EAAS,CAAE,YAAW,GAAG,GAAwD,CAC/F,MACE,iBAAA,EAAA,EAAA,IAAA,CAACA,EAAAA,SAAkB,KAAnB,CACE,YAAU,WACV,UAAWC,EAAAA,GACT,gVACA,CACF,EACA,GAAI,EAEJ,SAAA,iBAAA,EAAA,EAAA,IAAA,CAACD,EAAAA,SAAkB,UAAnB,CAA6B,YAAU,qBAAqB,UAAU,iBACpE,SAAA,iBAAA,EAAA,EAAA,IAAA,CAACE,EAAAA,MAAD,CAAW,UAAU,aAAe,CAAA,CACT,CAAA,CACP,CAAA,CAE5B"}
@@ -2,7 +2,7 @@ import { Checkbox } from "radix-ui";
2
2
  import { ComponentProps } from "react";
3
3
  //#region src/components/Checkbox.d.ts
4
4
  /** A box that is on, off, or indeterminate; the tick is the accent on the deep well. */
5
- declare function Checkbox$1({ className, ...props }: ComponentProps<typeof Checkbox.Root>): import("react/jsx-runtime").JSX.Element;
5
+ declare function Checkbox$1({ className, ...props }: ComponentProps<typeof Checkbox.Root>): import("react").JSX.Element;
6
6
  //#endregion
7
7
  export { Checkbox$1 as Checkbox };
8
8
  //# sourceMappingURL=Checkbox.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.mts","names":[],"sources":["../../../src/components/Checkbox.tsx"],"mappings":";;;;iBAMgB,aAAW,cAAc,SAAS,sBAAsB,SAAkB,oCAAK,IAAA"}
1
+ {"version":3,"file":"Checkbox.d.mts","names":[],"sources":["../../../src/components/Checkbox.tsx"],"mappings":";;;;iBAOgB,aAAW,cAAc,SAAS,sBAAsB,SAAkB,wBAAK,IAAA"}
@@ -1,2 +1,2 @@
1
- import{CheckIcon as e}from"../icons/icons.mjs";import{cn as t}from"../lib/cn.mjs";import{Checkbox as n}from"radix-ui";import{jsx as r}from"react/jsx-runtime";function i({className:i,...a}){return r(n.Root,{"data-slot":`checkbox`,className:t(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue`,i),...a,children:r(n.Indicator,{"data-slot":`checkbox-indicator`,className:`text-doom-blue`,children:r(e,{className:`h-2.5 w-2.5`})})})}export{i as Checkbox};
1
+ import{CheckIcon as e}from"../icons/icons.mjs";import{cn as t}from"../lib/cn.mjs";import{Checkbox as n}from"radix-ui";import{jsx as r}from"react/jsx-runtime";function i({className:i,...a}){return/* @__PURE__ */ r(n.Root,{"data-slot":`checkbox`,className:t(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue`,i),...a,children:/* @__PURE__ */ r(n.Indicator,{"data-slot":`checkbox-indicator`,className:`text-doom-blue`,children:/* @__PURE__ */ r(e,{className:`h-2.5 w-2.5`})})})}export{i as Checkbox};
2
2
  //# sourceMappingURL=Checkbox.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","names":["Checkbox","CheckboxPrimitive"],"sources":["../../../src/components/Checkbox.tsx"],"sourcesContent":["import { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\nimport { CheckIcon } from '../icons/icons.ts';\nimport { cn } from '../lib/cn.ts';\n\n/** A box that is on, off, or indeterminate; the tick is the accent on the deep well. */\nexport function Checkbox({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-[3px] border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"text-doom-blue\">\n <CheckIcon className=\"h-2.5 w-2.5\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n"],"mappings":"8JAMA,SAAgBA,EAAS,CAAE,YAAW,GAAG,GAAwD,CAC/F,OACE,EAACC,EAAkB,KAAnB,CACE,YAAU,WACV,UAAW,EACT,mVACA,CACF,EACA,GAAI,EAEJ,SAAA,EAACA,EAAkB,UAAnB,CAA6B,YAAU,qBAAqB,UAAU,iBACpE,SAAA,EAAC,EAAD,CAAW,UAAU,aAAe,CAAA,CACT,CAAA,CACP,CAAA,CAE5B"}
1
+ {"version":3,"file":"Checkbox.mjs","names":["Checkbox","CheckboxPrimitive"],"sources":["../../../src/components/Checkbox.tsx"],"sourcesContent":["import { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { CheckIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\n\n/** A box that is on, off, or indeterminate; the tick is the accent on the deep well. */\nexport function Checkbox({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-doom-border bg-doom-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-doom-blue/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-doom-blue data-[state=indeterminate]:border-doom-blue',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"text-doom-blue\">\n <CheckIcon className=\"h-2.5 w-2.5\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n"],"mappings":"8JAOA,SAAgBA,EAAS,CAAE,YAAW,GAAG,GAAwD,CAC/F,MACE,kBAACC,EAAkB,KAAnB,CACE,YAAU,WACV,UAAW,EACT,gVACA,CACF,EACA,GAAI,EAEJ,SAAA,kBAACA,EAAkB,UAAnB,CAA6B,YAAU,qBAAqB,UAAU,iBACpE,SAAA,kBAAC,EAAD,CAAW,UAAU,aAAe,CAAA,CACT,CAAA,CACP,CAAA,CAE5B"}
@@ -0,0 +1,2 @@
1
+ const e=require("./SyntaxText.cjs"),t=require("../lib/fenceGrammar.cjs"),n=require("./CopyButton.cjs"),r=require("./MermaidDiagram.cjs");let i=require("react/jsx-runtime");function a({text:a,className:o}){let s=t.fenceLanguageOf(o),c=s===`mermaid`?/* @__PURE__ */ (0,i.jsx)(r.MermaidDiagram,{code:a}):/* @__PURE__ */ (0,i.jsx)(e.SyntaxText,{text:a,grammar:t.fenceGrammarOf(s),className:`overflow-x-auto text-sm leading-relaxed text-doom-text`});return/* @__PURE__ */ (0,i.jsxs)(`div`,{"data-slot":`code-block`,"data-language":s??``,className:`relative rounded border border-doom-border bg-doom-deep p-2.5`,children:[c,/* @__PURE__ */ (0,i.jsx)(n.CopyButton,{text:a,className:`absolute top-1.5 right-1.5`})]})}exports.CodeBlock=a;
2
+ //# sourceMappingURL=CodeBlock.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlock.cjs","names":["fenceLanguageOf","MermaidDiagram","SyntaxText","fenceGrammarOf","CopyButton"],"sources":["../../../src/components/CodeBlock.tsx"],"sourcesContent":["import { fenceGrammarOf, fenceLanguageOf, MERMAID_LANGUAGE } from '../lib/fenceGrammar';\nimport { CopyButton } from './CopyButton';\nimport { MermaidDiagram } from './MermaidDiagram';\nimport { SyntaxText } from './SyntaxText';\n\n/**\n * A fenced code block: coloured, copyable, and a picture when it is mermaid.\n *\n * DESIGN PATTERNS:\n * - The fence's own word picks the grammar, and an unknown word means plain\n * text rather than a guess at the wrong language.\n * - Colour and the diagram both arrive asynchronously, so the block always has\n * the source on screen from the first frame of a streaming reply.\n *\n * AVOID:\n * - Reading the language anywhere but the fence. A block in a message has no\n * path, and guessing from the body colours prose as code.\n */\n\nexport interface CodeBlockProps {\n /** The block's source, without the fence lines. */\n text: string;\n /** The `language-*` class react-markdown puts on the inner <code>. */\n className?: string | undefined;\n}\n\nexport function CodeBlock({ text, className }: CodeBlockProps) {\n const language = fenceLanguageOf(className);\n const body =\n language === MERMAID_LANGUAGE ? (\n <MermaidDiagram code={text} />\n ) : (\n <SyntaxText\n text={text}\n grammar={fenceGrammarOf(language)}\n className=\"overflow-x-auto text-sm leading-relaxed text-doom-text\"\n />\n );\n return (\n <div\n data-slot=\"code-block\"\n data-language={language ?? ''}\n className=\"relative rounded border border-doom-border bg-doom-deep p-2.5\"\n >\n {body}\n <CopyButton text={text} className=\"absolute top-1.5 right-1.5\" />\n </div>\n );\n}\n"],"mappings":"4KA0BA,SAAgB,EAAU,CAAE,OAAM,aAA6B,CAC7D,IAAM,EAAWA,EAAAA,gBAAgB,CAAS,EACpC,EACJ,IAAA,UACE,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAgB,KAAM,CAAO,CAAA,EAE7B,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CACQ,OACN,QAASC,EAAAA,eAAe,CAAQ,EAChC,UAAU,wDACX,CAAA,EAEL,MACE,iBAAA,EAAA,EAAA,KAAA,CAAC,MAAD,CACE,YAAU,aACV,gBAAe,GAAY,GAC3B,UAAU,gEAHZ,SAAA,CAKG,EACD,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAkB,OAAM,UAAU,4BAA8B,CAAA,CAC7D,GAET"}
@@ -0,0 +1,2 @@
1
+ import{SyntaxText as e}from"./SyntaxText.mjs";import{fenceGrammarOf as t,fenceLanguageOf as n}from"../lib/fenceGrammar.mjs";import{CopyButton as r}from"./CopyButton.mjs";import{MermaidDiagram as i}from"./MermaidDiagram.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s({text:s,className:c}){let l=n(c),u=l===`mermaid`?/* @__PURE__ */ a(i,{code:s}):/* @__PURE__ */ a(e,{text:s,grammar:t(l),className:`overflow-x-auto text-sm leading-relaxed text-doom-text`});return/* @__PURE__ */ o(`div`,{"data-slot":`code-block`,"data-language":l??``,className:`relative rounded border border-doom-border bg-doom-deep p-2.5`,children:[u,/* @__PURE__ */ a(r,{text:s,className:`absolute top-1.5 right-1.5`})]})}export{s as CodeBlock};
2
+ //# sourceMappingURL=CodeBlock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlock.mjs","names":[],"sources":["../../../src/components/CodeBlock.tsx"],"sourcesContent":["import { fenceGrammarOf, fenceLanguageOf, MERMAID_LANGUAGE } from '../lib/fenceGrammar';\nimport { CopyButton } from './CopyButton';\nimport { MermaidDiagram } from './MermaidDiagram';\nimport { SyntaxText } from './SyntaxText';\n\n/**\n * A fenced code block: coloured, copyable, and a picture when it is mermaid.\n *\n * DESIGN PATTERNS:\n * - The fence's own word picks the grammar, and an unknown word means plain\n * text rather than a guess at the wrong language.\n * - Colour and the diagram both arrive asynchronously, so the block always has\n * the source on screen from the first frame of a streaming reply.\n *\n * AVOID:\n * - Reading the language anywhere but the fence. A block in a message has no\n * path, and guessing from the body colours prose as code.\n */\n\nexport interface CodeBlockProps {\n /** The block's source, without the fence lines. */\n text: string;\n /** The `language-*` class react-markdown puts on the inner <code>. */\n className?: string | undefined;\n}\n\nexport function CodeBlock({ text, className }: CodeBlockProps) {\n const language = fenceLanguageOf(className);\n const body =\n language === MERMAID_LANGUAGE ? (\n <MermaidDiagram code={text} />\n ) : (\n <SyntaxText\n text={text}\n grammar={fenceGrammarOf(language)}\n className=\"overflow-x-auto text-sm leading-relaxed text-doom-text\"\n />\n );\n return (\n <div\n data-slot=\"code-block\"\n data-language={language ?? ''}\n className=\"relative rounded border border-doom-border bg-doom-deep p-2.5\"\n >\n {body}\n <CopyButton text={text} className=\"absolute top-1.5 right-1.5\" />\n </div>\n );\n}\n"],"mappings":"kRA0BA,SAAgB,EAAU,CAAE,OAAM,aAA6B,CAC7D,IAAM,EAAW,EAAgB,CAAS,EACpC,EACJ,IAAA,UACE,kBAAC,EAAD,CAAgB,KAAM,CAAO,CAAA,EAE7B,kBAAC,EAAD,CACQ,OACN,QAAS,EAAe,CAAQ,EAChC,UAAU,wDACX,CAAA,EAEL,MACE,kBAAC,MAAD,CACE,YAAU,aACV,gBAAe,GAAY,GAC3B,UAAU,gEAHZ,SAAA,CAKG,EACD,kBAAC,EAAD,CAAkB,OAAM,UAAU,4BAA8B,CAAA,CAC7D,GAET"}
@@ -1,2 +1,2 @@
1
- const e=require("../lib/cn.cjs"),t=require("./Skeleton.cjs");let n=require("react/jsx-runtime"),r=require("react");const i=(0,r.lazy)(async()=>({default:(await Promise.resolve().then(()=>require("./CodeEditorView.cjs"))).CodeEditorView}));function a({className:a,...o}){return(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)(t.Skeleton,{className:e.cn(`min-h-0`,a)}),children:(0,n.jsx)(i,{className:a,...o})})}exports.CodeEditor=a;
1
+ const e=require("../lib/cn.cjs"),t=require("./Skeleton.cjs");let n=require("react/jsx-runtime"),r=require("react");const i=(0,r.lazy)(async()=>({default:(await Promise.resolve().then(()=>require("./CodeEditorView.cjs"))).CodeEditorView}));function a({className:a,...o}){return/* @__PURE__ */ (0,n.jsx)(r.Suspense,{fallback:/* @__PURE__ */ (0,n.jsx)(t.Skeleton,{className:e.cn(`min-h-0`,a)}),children:/* @__PURE__ */ (0,n.jsx)(i,{className:a,...o})})}exports.CodeEditor=a;
2
2
  //# sourceMappingURL=CodeEditor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.cjs","names":["lazy","Suspense","Skeleton","cn"],"sources":["../../../src/components/CodeEditor.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport type { CodeEditorProps } from '../types/editor.ts';\nimport { Skeleton } from './Skeleton.tsx';\n\n/**\n * A code editor: line numbers, syntax colour, folding, undo, and a search\n * panel on the usual keys.\n *\n * The editor arrives as its own chunk. The cockpit is one bundle that every\n * session downloads, most of them without ever opening a file, and it is read\n * over a tunnel as often as over localhost; an editor nobody opened has no\n * business in that first load. What this module holds is the boundary, so the\n * cost is paid on the first render that asks for an editor and never again.\n */\nconst CodeEditorView = lazy(async () => ({ default: (await import('./CodeEditorView.tsx')).CodeEditorView }));\n\nexport function CodeEditor({ className, ...props }: CodeEditorProps) {\n return (\n <Suspense fallback={<Skeleton className={cn('min-h-0', className)} />}>\n <CodeEditorView className={className} {...props} />\n </Suspense>\n );\n}\n"],"mappings":"mHAeA,MAAM,GAAA,EAAiBA,EAAAA,KAAAA,CAAK,UAAa,CAAE,SAAU,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAM,sBAAA,CAAA,EAAA,CAAgC,cAAe,EAAE,EAE5G,SAAgB,EAAW,CAAE,YAAW,GAAG,GAA0B,CACnE,OACE,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CAAU,UAAU,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CAAU,UAAWC,EAAAA,GAAG,UAAW,CAAS,CAAI,CAAA,EAClE,UAAA,EAAA,EAAA,IAAA,CAAC,EAAD,CAA2B,YAAW,GAAI,CAAQ,CAAA,CAC1C,CAAA,CAEd"}
1
+ {"version":3,"file":"CodeEditor.cjs","names":["lazy","Suspense","Skeleton","cn"],"sources":["../../../src/components/CodeEditor.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\n\nimport { cn } from '../lib/cn';\nimport type { CodeEditorProps } from '../types/editor';\nimport { Skeleton } from './Skeleton';\n\n/**\n * A code editor: line numbers, syntax colour, folding, undo, and a search\n * panel on the usual keys.\n *\n * The editor arrives as its own chunk. The cockpit is one bundle that every\n * session downloads, most of them without ever opening a file, and it is read\n * over a tunnel as often as over localhost; an editor nobody opened has no\n * business in that first load. What this module holds is the boundary, so the\n * cost is paid on the first render that asks for an editor and never again.\n */\nconst CodeEditorView = lazy(async () => ({ default: (await import('./CodeEditorView')).CodeEditorView }));\n\nexport function CodeEditor({ className, ...props }: CodeEditorProps) {\n return (\n <Suspense fallback={<Skeleton className={cn('min-h-0', className)} />}>\n <CodeEditorView className={className} {...props} />\n </Suspense>\n );\n}\n"],"mappings":"mHAgBA,MAAM,GAAA,EAAiBA,EAAAA,KAAAA,CAAK,UAAa,CAAE,SAAU,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAM,sBAAA,CAAA,EAAA,CAA4B,cAAe,EAAE,EAExG,SAAgB,EAAW,CAAE,YAAW,GAAG,GAA0B,CACnE,MACE,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CAAU,SAAU,iBAAA,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CAAU,UAAWC,EAAAA,GAAG,UAAW,CAAS,CAAI,CAAA,EAClE,SAAA,iBAAA,EAAA,EAAA,IAAA,CAAC,EAAD,CAA2B,YAAW,GAAI,CAAQ,CAAA,CAC1C,CAAA,CAEd"}
@@ -1,6 +1,5 @@
1
1
  import { CodeEditorProps } from "../types/editor.mjs";
2
2
  //#region src/components/CodeEditor.d.ts
3
- declare function CodeEditor({ className, ...props }: CodeEditorProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function CodeEditor({ className, ...props }: CodeEditorProps): import("react").JSX.Element;
4
4
  //#endregion
5
- export { CodeEditor };
6
5
  //# sourceMappingURL=CodeEditor.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.d.mts","names":[],"sources":["../../../src/components/CodeEditor.tsx"],"mappings":";;iBAiBgB,aAAa,cAAc,SAAS,8CAAe,IAAA"}
1
+ {"version":3,"file":"CodeEditor.d.mts","names":[],"sources":["../../../src/components/CodeEditor.tsx"],"mappings":";;wBAkBgB,aAAa,cAAc,SAAS,kCAAe,IAAA"}
@@ -1,2 +1,2 @@
1
- import{cn as e}from"../lib/cn.mjs";import{Skeleton as t}from"./Skeleton.mjs";import{jsx as n}from"react/jsx-runtime";import{Suspense as r,lazy as i}from"react";const a=i(async()=>({default:(await import(`./CodeEditorView.mjs`)).CodeEditorView}));function o({className:i,...o}){return n(r,{fallback:n(t,{className:e(`min-h-0`,i)}),children:n(a,{className:i,...o})})}export{o as CodeEditor};
1
+ import{cn as e}from"../lib/cn.mjs";import{Skeleton as t}from"./Skeleton.mjs";import{jsx as n}from"react/jsx-runtime";import{Suspense as r,lazy as i}from"react";const a=i(async()=>({default:(await import(`./CodeEditorView.mjs`)).CodeEditorView}));function o({className:i,...o}){return/* @__PURE__ */ n(r,{fallback:/* @__PURE__ */ n(t,{className:e(`min-h-0`,i)}),children:/* @__PURE__ */ n(a,{className:i,...o})})}export{o as CodeEditor};
2
2
  //# sourceMappingURL=CodeEditor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.mjs","names":[],"sources":["../../../src/components/CodeEditor.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport type { CodeEditorProps } from '../types/editor.ts';\nimport { Skeleton } from './Skeleton.tsx';\n\n/**\n * A code editor: line numbers, syntax colour, folding, undo, and a search\n * panel on the usual keys.\n *\n * The editor arrives as its own chunk. The cockpit is one bundle that every\n * session downloads, most of them without ever opening a file, and it is read\n * over a tunnel as often as over localhost; an editor nobody opened has no\n * business in that first load. What this module holds is the boundary, so the\n * cost is paid on the first render that asks for an editor and never again.\n */\nconst CodeEditorView = lazy(async () => ({ default: (await import('./CodeEditorView.tsx')).CodeEditorView }));\n\nexport function CodeEditor({ className, ...props }: CodeEditorProps) {\n return (\n <Suspense fallback={<Skeleton className={cn('min-h-0', className)} />}>\n <CodeEditorView className={className} {...props} />\n </Suspense>\n );\n}\n"],"mappings":"gKAeA,MAAM,EAAiB,EAAK,UAAa,CAAE,SAAU,MAAM,OAAO,wBAAA,CAAyB,cAAe,EAAE,EAE5G,SAAgB,EAAW,CAAE,YAAW,GAAG,GAA0B,CACnE,OACE,EAAC,EAAD,CAAU,SAAU,EAAC,EAAD,CAAU,UAAW,EAAG,UAAW,CAAS,CAAI,CAAA,EAClE,SAAA,EAAC,EAAD,CAA2B,YAAW,GAAI,CAAQ,CAAA,CAC1C,CAAA,CAEd"}
1
+ {"version":3,"file":"CodeEditor.mjs","names":[],"sources":["../../../src/components/CodeEditor.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\n\nimport { cn } from '../lib/cn';\nimport type { CodeEditorProps } from '../types/editor';\nimport { Skeleton } from './Skeleton';\n\n/**\n * A code editor: line numbers, syntax colour, folding, undo, and a search\n * panel on the usual keys.\n *\n * The editor arrives as its own chunk. The cockpit is one bundle that every\n * session downloads, most of them without ever opening a file, and it is read\n * over a tunnel as often as over localhost; an editor nobody opened has no\n * business in that first load. What this module holds is the boundary, so the\n * cost is paid on the first render that asks for an editor and never again.\n */\nconst CodeEditorView = lazy(async () => ({ default: (await import('./CodeEditorView')).CodeEditorView }));\n\nexport function CodeEditor({ className, ...props }: CodeEditorProps) {\n return (\n <Suspense fallback={<Skeleton className={cn('min-h-0', className)} />}>\n <CodeEditorView className={className} {...props} />\n </Suspense>\n );\n}\n"],"mappings":"gKAgBA,MAAM,EAAiB,EAAK,UAAa,CAAE,SAAU,MAAM,OAAO,wBAAA,CAAqB,cAAe,EAAE,EAExG,SAAgB,EAAW,CAAE,YAAW,GAAG,GAA0B,CACnE,MACE,kBAAC,EAAD,CAAU,SAAU,kBAAC,EAAD,CAAU,UAAW,EAAG,UAAW,CAAS,CAAI,CAAA,EAClE,SAAA,kBAAC,EAAD,CAA2B,YAAW,GAAI,CAAQ,CAAA,CAC1C,CAAA,CAEd"}
@@ -1,2 +1,2 @@
1
- const e=require("../lib/cn.cjs"),t=require("../lib/editorLanguage.cjs"),n=require("../lib/editorTheme.cjs");let r=require("react/jsx-runtime"),i=require("react"),a=require("@codemirror/commands"),o=require("@codemirror/language"),s=require("@codemirror/search"),c=require("@codemirror/state"),l=require("@codemirror/view"),u=require("@lezer/highlight");const d=l.EditorView.theme(n.DOOM_EDITOR_STYLES),f=o.HighlightStyle.define([{tag:u.tags.comment,...n.DOOM_SYNTAX_STYLES.comment},{tag:u.tags.keyword,...n.DOOM_SYNTAX_STYLES.keyword},{tag:[u.tags.atom,u.tags.bool,u.tags.null,u.tags.self],...n.DOOM_SYNTAX_STYLES.constant},{tag:u.tags.number,...n.DOOM_SYNTAX_STYLES.literal},{tag:[u.tags.string,u.tags.special(u.tags.string),u.tags.character],...n.DOOM_SYNTAX_STYLES.string},{tag:u.tags.regexp,...n.DOOM_SYNTAX_STYLES.regexp},{tag:u.tags.operator,...n.DOOM_SYNTAX_STYLES.operator},{tag:u.tags.punctuation,...n.DOOM_SYNTAX_STYLES.punctuation},{tag:u.tags.variableName,...n.DOOM_SYNTAX_STYLES.variable},{tag:u.tags.propertyName,...n.DOOM_SYNTAX_STYLES.property},{tag:[u.tags.function(u.tags.variableName),u.tags.function(u.tags.propertyName)],...n.DOOM_SYNTAX_STYLES.callable},{tag:[u.tags.typeName,u.tags.className,u.tags.namespace],...n.DOOM_SYNTAX_STYLES.type},{tag:u.tags.tagName,...n.DOOM_SYNTAX_STYLES.tag},{tag:u.tags.attributeName,...n.DOOM_SYNTAX_STYLES.attribute},{tag:[u.tags.meta,u.tags.processingInstruction],...n.DOOM_SYNTAX_STYLES.meta},{tag:u.tags.heading,...n.DOOM_SYNTAX_STYLES.heading},{tag:[u.tags.link,u.tags.url],...n.DOOM_SYNTAX_STYLES.link},{tag:u.tags.emphasis,...n.DOOM_SYNTAX_STYLES.emphasis},{tag:u.tags.strong,...n.DOOM_SYNTAX_STYLES.strong},{tag:u.tags.strikethrough,...n.DOOM_SYNTAX_STYLES.strikethrough},{tag:u.tags.invalid,...n.DOOM_SYNTAX_STYLES.invalid}]),p=[(0,l.lineNumbers)(),(0,l.highlightActiveLineGutter)(),(0,o.foldGutter)(),(0,l.highlightActiveLine)(),(0,l.drawSelection)(),(0,l.rectangularSelection)(),(0,o.indentOnInput)(),(0,o.bracketMatching)(),(0,a.history)(),(0,s.search)({top:!0}),(0,s.highlightSelectionMatches)(),l.keymap.of([...a.defaultKeymap,...a.historyKeymap,...s.searchKeymap,...o.foldKeymap,a.indentWithTab]),(0,o.syntaxHighlighting)(f),d];function m({value:n,path:a,readOnly:o=!1,lineWrapping:s=!0,className:u,onChange:d,onSelect:f,"data-testid":m}){let h=(0,i.useRef)(null),g=(0,i.useRef)(null),_=(0,i.useRef)({onChange:d,onSelect:f}),v=(0,i.useRef)({language:new c.Compartment,readOnly:new c.Compartment,wrapping:new c.Compartment});return(0,i.useEffect)(()=>{_.current={onChange:d,onSelect:f}}),(0,i.useEffect)(()=>{let e=h.current;if(e===null)return;let{language:t,readOnly:r,wrapping:i}=v.current,a=new l.EditorView({parent:e,state:c.EditorState.create({doc:n,extensions:[...p,t.of([]),r.of([]),i.of([]),l.EditorView.updateListener.of(e=>{if(e.docChanged&&_.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=_.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t({text:e.state.sliceDoc(n.from,n.to),startLine:e.state.doc.lineAt(n.from).number,endLine:e.state.doc.lineAt(n.to).number})})]})});return g.current=a,()=>{a.destroy(),g.current=null}},[]),(0,i.useEffect)(()=>{let e=g.current;e!==null&&e.state.doc.toString()!==n&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:n}})},[n]),(0,i.useEffect)(()=>{g.current?.dispatch({effects:v.current.readOnly.reconfigure([c.EditorState.readOnly.of(o),l.EditorView.editable.of(!o)])})},[o]),(0,i.useEffect)(()=>{g.current?.dispatch({effects:v.current.wrapping.reconfigure(s?l.EditorView.lineWrapping:[])})},[s]),(0,i.useEffect)(()=>{let e=a===void 0?void 0:t.grammarKeyOf(a),{language:n}=v.current;if(e===void 0){g.current?.dispatch({effects:n.reconfigure([])});return}let r=!1;return t.loadGrammar(e).then(e=>{r||g.current?.dispatch({effects:n.reconfigure(e)})}).catch(()=>{r||g.current?.dispatch({effects:n.reconfigure([])})}),()=>{r=!0}},[a]),(0,r.jsx)(`div`,{ref:h,"data-testid":m,className:e.cn(`min-h-0 overflow-hidden`,u)})}exports.CodeEditorView=m;
1
+ const e=require("../lib/cn.cjs"),t=require("../lib/editorLanguage.cjs"),n=require("../lib/editorTheme.cjs"),r=require("../lib/editorController.cjs");let i=require("react/jsx-runtime"),a=require("react"),o=require("@codemirror/commands"),s=require("@codemirror/language"),c=require("@codemirror/search"),l=require("@codemirror/state"),u=require("@codemirror/view"),d=require("@lezer/highlight");function f(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return{text:e.state.sliceDoc(r,i),from:r,to:i,startLine:e.state.doc.lineAt(r).number,endLine:e.state.doc.lineAt(i).number}}function p(e,t){let n=e.posAtCoords({x:t.left,y:t.top}),r=e.posAtCoords({x:t.right,y:t.bottom});return n===null||r===null?null:f(e,n,r)}const m=u.EditorView.theme(n.DOOM_EDITOR_STYLES),h=s.HighlightStyle.define([{tag:d.tags.comment,...n.DOOM_SYNTAX_STYLES.comment},{tag:d.tags.keyword,...n.DOOM_SYNTAX_STYLES.keyword},{tag:[d.tags.atom,d.tags.bool,d.tags.null,d.tags.self],...n.DOOM_SYNTAX_STYLES.constant},{tag:d.tags.number,...n.DOOM_SYNTAX_STYLES.literal},{tag:[d.tags.string,d.tags.special(d.tags.string),d.tags.character],...n.DOOM_SYNTAX_STYLES.string},{tag:d.tags.regexp,...n.DOOM_SYNTAX_STYLES.regexp},{tag:d.tags.operator,...n.DOOM_SYNTAX_STYLES.operator},{tag:d.tags.punctuation,...n.DOOM_SYNTAX_STYLES.punctuation},{tag:d.tags.variableName,...n.DOOM_SYNTAX_STYLES.variable},{tag:d.tags.propertyName,...n.DOOM_SYNTAX_STYLES.property},{tag:[d.tags.function(d.tags.variableName),d.tags.function(d.tags.propertyName)],...n.DOOM_SYNTAX_STYLES.callable},{tag:[d.tags.typeName,d.tags.className,d.tags.namespace],...n.DOOM_SYNTAX_STYLES.type},{tag:d.tags.tagName,...n.DOOM_SYNTAX_STYLES.tag},{tag:d.tags.attributeName,...n.DOOM_SYNTAX_STYLES.attribute},{tag:[d.tags.meta,d.tags.processingInstruction],...n.DOOM_SYNTAX_STYLES.meta},{tag:d.tags.heading,...n.DOOM_SYNTAX_STYLES.heading},{tag:[d.tags.link,d.tags.url],...n.DOOM_SYNTAX_STYLES.link},{tag:d.tags.emphasis,...n.DOOM_SYNTAX_STYLES.emphasis},{tag:d.tags.strong,...n.DOOM_SYNTAX_STYLES.strong},{tag:d.tags.strikethrough,...n.DOOM_SYNTAX_STYLES.strikethrough},{tag:d.tags.invalid,...n.DOOM_SYNTAX_STYLES.invalid}]),g=l.StateEffect.define(),_=l.StateField.define({create:()=>u.Decoration.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(g)&&(n=e.value);return n},provide:e=>u.EditorView.decorations.from(e)}),v=l.StateEffect.define(),y=l.StateField.define({create:()=>u.Decoration.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(v)&&(n=e.value);return n},provide:e=>u.EditorView.decorations.from(e)});var b=class extends u.WidgetType{label;constructor(e){super(),this.label=e}eq(e){return e.label===this.label}toDOM(){let e=document.createElement(`span`);return e.className=`cm-marked-region-label`,e.dataset.authorRegionLabel=this.label,e.textContent=this.label,e}};const x=u.EditorView.baseTheme({".cm-marked-region":{backgroundColor:`var(--doom-tint-yellow)`,borderBottom:`1px solid var(--doom-edge-yellow)`},".cm-marked-region-label":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:`16px`,height:`16px`,marginRight:`4px`,borderRadius:`999px`,backgroundColor:`var(--doom-yellow)`,color:`var(--doom-deep)`,fontSize:`9px`,fontWeight:`700`,lineHeight:`1`,verticalAlign:`text-bottom`}}),S=[(0,u.lineNumbers)(),(0,u.highlightActiveLineGutter)(),(0,s.foldGutter)(),(0,u.highlightActiveLine)(),(0,u.drawSelection)(),(0,u.rectangularSelection)(),(0,s.indentOnInput)(),(0,s.bracketMatching)(),(0,o.history)(),(0,c.search)({top:!0}),(0,c.highlightSelectionMatches)(),u.keymap.of([...o.defaultKeymap,...o.historyKeymap,...c.searchKeymap,...s.foldKeymap,o.indentWithTab]),(0,s.syntaxHighlighting)(h),_,y,x,m];function C({value:n,path:o,readOnly:s=!1,lineWrapping:c=!0,className:d,onChange:m,onSelect:h,controllerRef:_,"data-testid":y}){let x=(0,a.useRef)(null),C=(0,a.useRef)(null),w=(0,a.useRef)({onChange:m,onSelect:h}),T=(0,a.useRef)(n),E=(0,a.useRef)({language:new l.Compartment,readOnly:new l.Compartment,wrapping:new l.Compartment});return(0,a.useEffect)(()=>{w.current={onChange:m,onSelect:h}}),(0,a.useLayoutEffect)(()=>{let e=x.current;if(e===null)return;let{language:t,readOnly:n,wrapping:r}=E.current,i=new u.EditorView({parent:e,state:l.EditorState.create({doc:T.current,extensions:[...S,t.of([]),n.of([]),r.of([]),u.EditorView.updateListener.of(e=>{if(e.docChanged&&w.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=w.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t(f(e.view,n.from,n.to))})]})});return C.current=i,()=>{i.destroy(),C.current=null}},[]),(0,a.useImperativeHandle)(_,()=>({focus:()=>C.current?.focus(),revealAndSelect:e=>{let t=C.current;if(t===null)return;let[n]=r.boundedEditorRanges(t.state.doc.length,[e]);n!==void 0&&t.dispatch({selection:{anchor:n.from,head:n.to},effects:u.EditorView.scrollIntoView(n.from,{y:`center`})})},applyEdits:e=>{let t=C.current;t!==null&&e.length!==0&&t.dispatch({changes:r.boundedEditorEdits(t.state.doc.length,e)})},setClosedRanges:e=>{let t=C.current;if(t===null)return;let n=r.boundedEditorRanges(t.state.doc.length,e).map(e=>e.from===e.to?u.Decoration.line({attributes:{class:`cm-closed-tone`,"data-tone":`closed`}}).range(t.state.doc.lineAt(e.from).from):u.Decoration.mark({class:`cm-closed-tone`,attributes:{"data-tone":`closed`}}).range(e.from,e.to));t.dispatch({effects:g.of(u.Decoration.set(n))})},setMarkedRanges:e=>{let t=C.current;if(t===null)return;let n=e.flatMap(e=>{let[n]=r.boundedEditorRanges(t.state.doc.length,[e]);return n===void 0||n.from===n.to?[]:[u.Decoration.widget({widget:new b(e.label),side:-1}).range(n.from),u.Decoration.mark({class:`cm-marked-region`,attributes:{"data-author-region":e.label}}).range(n.from,n.to)]});t.dispatch({effects:v.of(u.Decoration.set(n,!0))})},resolveViewportRegion:e=>{let t=C.current;return t===null?null:p(t,e)}}),[]),(0,a.useEffect)(()=>{let e=C.current;e!==null&&e.state.doc.toString()!==n&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:n}})},[n]),(0,a.useEffect)(()=>{C.current?.dispatch({effects:E.current.readOnly.reconfigure([l.EditorState.readOnly.of(s),u.EditorView.editable.of(!s)])})},[s]),(0,a.useEffect)(()=>{C.current?.dispatch({effects:E.current.wrapping.reconfigure(c?u.EditorView.lineWrapping:[])})},[c]),(0,a.useEffect)(()=>{let e=o===void 0?void 0:t.grammarKeyOf(o),{language:n}=E.current;if(e===void 0){C.current?.dispatch({effects:n.reconfigure([])});return}let r=!1;return t.loadGrammar(e).then(e=>{r||C.current?.dispatch({effects:n.reconfigure(e)})}).catch(()=>{r||C.current?.dispatch({effects:n.reconfigure([])})}),()=>{r=!0}},[o]),/* @__PURE__ */ (0,i.jsx)(`div`,{ref:x,"data-testid":y,className:e.cn(`min-h-0 overflow-hidden`,d)})}exports.CodeEditorView=C,exports.resolveEditorViewportRegion=p;
2
2
  //# sourceMappingURL=CodeEditorView.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditorView.cjs","names":["EditorView","DOOM_EDITOR_STYLES","HighlightStyle","tags","DOOM_SYNTAX_STYLES","lineNumbers","highlightActiveLineGutter","foldGutter","highlightActiveLine","drawSelection","rectangularSelection","indentOnInput","bracketMatching","history","search","highlightSelectionMatches","keymap","defaultKeymap","historyKeymap","searchKeymap","foldKeymap","indentWithTab","syntaxHighlighting","useRef","Compartment","EditorState","grammarKeyOf","loadGrammar","cn"],"sources":["../../../src/components/CodeEditorView.tsx"],"sourcesContent":["import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n HighlightStyle,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { highlightSelectionMatches, search, searchKeymap } from '@codemirror/search';\nimport { Compartment, EditorState } from '@codemirror/state';\nimport {\n drawSelection,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n keymap,\n lineNumbers,\n rectangularSelection,\n} from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { useEffect, useRef } from 'react';\nimport { cn } from '../lib/cn.ts';\nimport { grammarKeyOf, loadGrammar } from '../lib/editorLanguage.ts';\nimport { DOOM_EDITOR_STYLES, DOOM_SYNTAX_STYLES } from '../lib/editorTheme.ts';\nimport type { CodeEditorProps } from '../types/editor.ts';\n\n/**\n * The editor itself, mounted on a real CodeMirror view.\n *\n * Nothing imports this module directly: `CodeEditor` reaches it through a lazy\n * import so the whole editor, and every grammar under it, stays out of the\n * cockpit's first load. Behaviour lives here rather than in that wrapper so\n * the split costs one file and no indirection.\n *\n * The three things a caller can change after mount each sit in their own\n * compartment. Reconfiguring one is a transaction; rebuilding the editor would\n * throw away the undo history, the scroll position and the cursor, which is\n * what a reader loses if a parent re-render is allowed to remount this.\n */\n\n/** Not a colour or a layout choice: how CodeMirror is told to draw the doom palette. */\nconst DOOM_THEME = EditorView.theme(DOOM_EDITOR_STYLES);\n\nconst DOOM_HIGHLIGHT = HighlightStyle.define([\n { tag: tags.comment, ...DOOM_SYNTAX_STYLES.comment },\n { tag: tags.keyword, ...DOOM_SYNTAX_STYLES.keyword },\n { tag: [tags.atom, tags.bool, tags.null, tags.self], ...DOOM_SYNTAX_STYLES.constant },\n { tag: tags.number, ...DOOM_SYNTAX_STYLES.literal },\n { tag: [tags.string, tags.special(tags.string), tags.character], ...DOOM_SYNTAX_STYLES.string },\n { tag: tags.regexp, ...DOOM_SYNTAX_STYLES.regexp },\n { tag: tags.operator, ...DOOM_SYNTAX_STYLES.operator },\n { tag: tags.punctuation, ...DOOM_SYNTAX_STYLES.punctuation },\n { tag: tags.variableName, ...DOOM_SYNTAX_STYLES.variable },\n { tag: tags.propertyName, ...DOOM_SYNTAX_STYLES.property },\n { tag: [tags.function(tags.variableName), tags.function(tags.propertyName)], ...DOOM_SYNTAX_STYLES.callable },\n { tag: [tags.typeName, tags.className, tags.namespace], ...DOOM_SYNTAX_STYLES.type },\n { tag: tags.tagName, ...DOOM_SYNTAX_STYLES.tag },\n { tag: tags.attributeName, ...DOOM_SYNTAX_STYLES.attribute },\n { tag: [tags.meta, tags.processingInstruction], ...DOOM_SYNTAX_STYLES.meta },\n { tag: tags.heading, ...DOOM_SYNTAX_STYLES.heading },\n { tag: [tags.link, tags.url], ...DOOM_SYNTAX_STYLES.link },\n { tag: tags.emphasis, ...DOOM_SYNTAX_STYLES.emphasis },\n { tag: tags.strong, ...DOOM_SYNTAX_STYLES.strong },\n { tag: tags.strikethrough, ...DOOM_SYNTAX_STYLES.strikethrough },\n { tag: tags.invalid, ...DOOM_SYNTAX_STYLES.invalid },\n]);\n\n/** Everything that never changes for the life of an editor. */\nconst FIXED_EXTENSIONS = [\n lineNumbers(),\n highlightActiveLineGutter(),\n foldGutter(),\n highlightActiveLine(),\n drawSelection(),\n rectangularSelection(),\n indentOnInput(),\n bracketMatching(),\n history(),\n search({ top: true }),\n highlightSelectionMatches(),\n // Tab indents rather than leaving the editor. That trades a keyboard user's\n // escape route for the behaviour every other editor has, so it is last in\n // the keymap and Escape then Tab still moves focus out.\n keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...foldKeymap, indentWithTab]),\n syntaxHighlighting(DOOM_HIGHLIGHT),\n DOOM_THEME,\n];\n\nexport function CodeEditorView({\n value,\n path,\n readOnly = false,\n lineWrapping = true,\n className,\n onChange,\n onSelect,\n 'data-testid': testId,\n}: CodeEditorProps) {\n const host = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | null>(null);\n // The callbacks are new objects on every parent render. Reading them through\n // a ref is what lets the editor be built once and still call the current\n // pair, rather than being rebuilt whenever the parent re-renders.\n const handlers = useRef({ onChange, onSelect });\n const compartments = useRef({\n language: new Compartment(),\n readOnly: new Compartment(),\n wrapping: new Compartment(),\n });\n\n useEffect(() => {\n handlers.current = { onChange, onSelect };\n });\n\n useEffect(() => {\n const parent = host.current;\n if (parent === null) return;\n const { language, readOnly: readOnlyPart, wrapping } = compartments.current;\n const editor = new EditorView({\n parent,\n state: EditorState.create({\n // The initial document only; every later change arrives as a\n // transaction from the effect below.\n doc: value,\n extensions: [\n ...FIXED_EXTENSIONS,\n language.of([]),\n readOnlyPart.of([]),\n wrapping.of([]),\n EditorView.updateListener.of((update) => {\n if (update.docChanged) handlers.current.onChange?.(update.state.doc.toString());\n if (!update.selectionSet && !update.docChanged) return;\n const report = handlers.current.onSelect;\n if (report === undefined) return;\n const range = update.state.selection.main;\n report({\n text: update.state.sliceDoc(range.from, range.to),\n startLine: update.state.doc.lineAt(range.from).number,\n endLine: update.state.doc.lineAt(range.to).number,\n });\n }),\n ],\n }),\n });\n view.current = editor;\n return () => {\n editor.destroy();\n view.current = null;\n };\n // Built once. `value` seeds the document and the sync effect owns it after that.\n }, []);\n\n useEffect(() => {\n const editor = view.current;\n // A caller that echoes onChange back into `value` would otherwise replace\n // the document on every keystroke and drop the cursor to the end.\n if (editor === null || editor.state.doc.toString() === value) return;\n editor.dispatch({ changes: { from: 0, to: editor.state.doc.length, insert: value } });\n }, [value]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.readOnly.reconfigure([\n EditorState.readOnly.of(readOnly),\n EditorView.editable.of(!readOnly),\n ]),\n });\n }, [readOnly]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.wrapping.reconfigure(lineWrapping ? EditorView.lineWrapping : []),\n });\n }, [lineWrapping]);\n\n useEffect(() => {\n const key = path === undefined ? undefined : grammarKeyOf(path);\n const { language } = compartments.current;\n if (key === undefined) {\n view.current?.dispatch({ effects: language.reconfigure([]) });\n return;\n }\n let cancelled = false;\n void loadGrammar(key)\n .then((grammar) => {\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure(grammar) });\n })\n .catch(() => {\n // A grammar is a separate chunk over the network, and the cockpit is\n // often read through a tunnel. Losing it costs syntax colour, not the\n // file, so fall back to plain text rather than failing the pane.\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure([]) });\n });\n return () => {\n cancelled = true;\n };\n }, [path]);\n\n return <div ref={host} data-testid={testId} className={cn('min-h-0 overflow-hidden', className)} />;\n}\n"],"mappings":"iWA0CA,MAAM,EAAaA,EAAAA,WAAW,MAAMC,EAAAA,kBAAkB,EAEhD,EAAiBC,EAAAA,eAAe,OAAO,CAC3C,CAAE,IAAKC,EAAAA,KAAK,QAAS,GAAGC,EAAAA,mBAA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GAEF,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,IAAK,EAAM,cAAa,EAAQ,UAAWC,EAAAA,GAAG,0BAA2B,CAAS,CAAI,CAAA,CACpG"}
1
+ {"version":3,"file":"CodeEditorView.cjs","names":["EditorView","DOOM_EDITOR_STYLES","HighlightStyle","tags","DOOM_SYNTAX_STYLES","StateEffect","StateField","Decoration","WidgetType","lineNumbers","highlightActiveLineGutter","foldGutter","highlightActiveLine","drawSelection","rectangularSelection","indentOnInput","bracketMatching","history","search","highlightSelectionMatches","keymap","defaultKeymap","historyKeymap","searchKeymap","foldKeymap","indentWithTab","syntaxHighlighting","useRef","Compartment","EditorState","boundedEditorRanges","boundedEditorEdits","grammarKeyOf","loadGrammar","cn"],"sources":["../../../src/components/CodeEditorView.tsx"],"sourcesContent":["import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n HighlightStyle,\n indentOnInput,\n syntaxHighlighting,\n} from '@codemirror/language';\nimport { highlightSelectionMatches, search, searchKeymap } from '@codemirror/search';\nimport { Compartment, EditorState, StateEffect, StateField } from '@codemirror/state';\nimport {\n Decoration,\n type DecorationSet,\n drawSelection,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n keymap,\n lineNumbers,\n rectangularSelection,\n WidgetType,\n} from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { boundedEditorEdits, boundedEditorRanges } from '../lib/editorController';\nimport { grammarKeyOf, loadGrammar } from '../lib/editorLanguage';\nimport { DOOM_EDITOR_STYLES, DOOM_SYNTAX_STYLES } from '../lib/editorTheme';\nimport type { CodeEditorProps, EditorSelectionRange, EditorViewportRectangle } from '../types/editor';\n\nfunction selectionRange(editor: { readonly state: EditorState }, from: number, to: number): EditorSelectionRange {\n const start = Math.min(from, to);\n const end = Math.max(from, to);\n return {\n text: editor.state.sliceDoc(start, end),\n from: start,\n to: end,\n startLine: editor.state.doc.lineAt(start).number,\n endLine: editor.state.doc.lineAt(end).number,\n };\n}\n\nexport function resolveEditorViewportRegion(\n editor: {\n readonly state: EditorState;\n posAtCoords(coords: { x: number; y: number }): number | null;\n },\n rectangle: EditorViewportRectangle,\n): EditorSelectionRange | null {\n const start = editor.posAtCoords({ x: rectangle.left, y: rectangle.top });\n const end = editor.posAtCoords({ x: rectangle.right, y: rectangle.bottom });\n if (start === null || end === null) return null;\n return selectionRange(editor, start, end);\n}\n/**\n * The editor itself, mounted on a real CodeMirror view.\n *\n * Nothing imports this module directly: `CodeEditor` reaches it through a lazy\n * import so the whole editor, and every grammar under it, stays out of the\n * cockpit's first load. Behaviour lives here rather than in that wrapper so\n * the split costs one file and no indirection.\n *\n * The three things a caller can change after mount each sit in their own\n * compartment. Reconfiguring one is a transaction; rebuilding the editor would\n * throw away the undo history, the scroll position and the cursor, which is\n * what a reader loses if a parent re-render is allowed to remount this.\n */\n\n/** Not a colour or a layout choice: how CodeMirror is told to draw the doom palette. */\nconst DOOM_THEME = EditorView.theme(DOOM_EDITOR_STYLES);\n\nconst DOOM_HIGHLIGHT = HighlightStyle.define([\n { tag: tags.comment, ...DOOM_SYNTAX_STYLES.comment },\n { tag: tags.keyword, ...DOOM_SYNTAX_STYLES.keyword },\n { tag: [tags.atom, tags.bool, tags.null, tags.self], ...DOOM_SYNTAX_STYLES.constant },\n { tag: tags.number, ...DOOM_SYNTAX_STYLES.literal },\n { tag: [tags.string, tags.special(tags.string), tags.character], ...DOOM_SYNTAX_STYLES.string },\n { tag: tags.regexp, ...DOOM_SYNTAX_STYLES.regexp },\n { tag: tags.operator, ...DOOM_SYNTAX_STYLES.operator },\n { tag: tags.punctuation, ...DOOM_SYNTAX_STYLES.punctuation },\n { tag: tags.variableName, ...DOOM_SYNTAX_STYLES.variable },\n { tag: tags.propertyName, ...DOOM_SYNTAX_STYLES.property },\n { tag: [tags.function(tags.variableName), tags.function(tags.propertyName)], ...DOOM_SYNTAX_STYLES.callable },\n { tag: [tags.typeName, tags.className, tags.namespace], ...DOOM_SYNTAX_STYLES.type },\n { tag: tags.tagName, ...DOOM_SYNTAX_STYLES.tag },\n { tag: tags.attributeName, ...DOOM_SYNTAX_STYLES.attribute },\n { tag: [tags.meta, tags.processingInstruction], ...DOOM_SYNTAX_STYLES.meta },\n { tag: tags.heading, ...DOOM_SYNTAX_STYLES.heading },\n { tag: [tags.link, tags.url], ...DOOM_SYNTAX_STYLES.link },\n { tag: tags.emphasis, ...DOOM_SYNTAX_STYLES.emphasis },\n { tag: tags.strong, ...DOOM_SYNTAX_STYLES.strong },\n { tag: tags.strikethrough, ...DOOM_SYNTAX_STYLES.strikethrough },\n { tag: tags.invalid, ...DOOM_SYNTAX_STYLES.invalid },\n]);\n\nconst setClosedDecorations = StateEffect.define<DecorationSet>();\nconst closedDecorations = StateField.define<DecorationSet>({\n create: () => Decoration.none,\n update: (decorations, transaction) => {\n let next = decorations.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(setClosedDecorations)) next = effect.value;\n }\n return next;\n },\n provide: (field) => EditorView.decorations.from(field),\n});\n\nconst setMarkedDecorations = StateEffect.define<DecorationSet>();\nconst markedDecorations = StateField.define<DecorationSet>({\n create: () => Decoration.none,\n update: (decorations, transaction) => {\n let next = decorations.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(setMarkedDecorations)) next = effect.value;\n }\n return next;\n },\n provide: (field) => EditorView.decorations.from(field),\n});\n\nclass MarkedRangeLabel extends WidgetType {\n constructor(private readonly label: string) {\n super();\n }\n\n eq(other: MarkedRangeLabel): boolean {\n return other.label === this.label;\n }\n\n toDOM(): HTMLElement {\n const label = document.createElement('span');\n label.className = 'cm-marked-region-label';\n label.dataset.authorRegionLabel = this.label;\n label.textContent = this.label;\n return label;\n }\n}\n\nconst MARKED_REGION_THEME = EditorView.baseTheme({\n '.cm-marked-region': {\n backgroundColor: 'var(--doom-tint-yellow)',\n borderBottom: '1px solid var(--doom-edge-yellow)',\n },\n '.cm-marked-region-label': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '16px',\n height: '16px',\n marginRight: '4px',\n borderRadius: '999px',\n backgroundColor: 'var(--doom-yellow)',\n color: 'var(--doom-deep)',\n fontSize: '9px',\n fontWeight: '700',\n lineHeight: '1',\n verticalAlign: 'text-bottom',\n },\n});\n\n/** Everything that never changes for the life of an editor. */\nconst FIXED_EXTENSIONS = [\n lineNumbers(),\n highlightActiveLineGutter(),\n foldGutter(),\n highlightActiveLine(),\n drawSelection(),\n rectangularSelection(),\n indentOnInput(),\n bracketMatching(),\n history(),\n search({ top: true }),\n highlightSelectionMatches(),\n // Tab indents rather than leaving the editor. That trades a keyboard user's\n // escape route for the behaviour every other editor has, so it is last in\n // the keymap and Escape then Tab still moves focus out.\n keymap.of([...defaultKeymap, ...historyKeymap, ...searchKeymap, ...foldKeymap, indentWithTab]),\n syntaxHighlighting(DOOM_HIGHLIGHT),\n closedDecorations,\n markedDecorations,\n MARKED_REGION_THEME,\n DOOM_THEME,\n];\n\nexport function CodeEditorView({\n value,\n path,\n readOnly = false,\n lineWrapping = true,\n className,\n onChange,\n onSelect,\n controllerRef,\n 'data-testid': testId,\n}: CodeEditorProps) {\n const host = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | null>(null);\n // The callbacks are new objects on every parent render. Reading them through\n // a ref is what lets the editor be built once and still call the current\n // pair, rather than being rebuilt whenever the parent re-renders.\n const handlers = useRef({ onChange, onSelect });\n // The document is seeded once from the value of the first render; the sync effect\n // below owns every later change.\n const initialValue = useRef(value);\n const compartments = useRef({\n language: new Compartment(),\n readOnly: new Compartment(),\n wrapping: new Compartment(),\n });\n\n useEffect(() => {\n handlers.current = { onChange, onSelect };\n });\n\n useLayoutEffect(() => {\n const parent = host.current;\n if (parent === null) return;\n const { language, readOnly: readOnlyPart, wrapping } = compartments.current;\n const editor = new EditorView({\n parent,\n state: EditorState.create({\n // The initial document only; every later change arrives as a\n // transaction from the effect below.\n doc: initialValue.current,\n extensions: [\n ...FIXED_EXTENSIONS,\n language.of([]),\n readOnlyPart.of([]),\n wrapping.of([]),\n EditorView.updateListener.of((update) => {\n if (update.docChanged) handlers.current.onChange?.(update.state.doc.toString());\n if (!update.selectionSet && !update.docChanged) return;\n const report = handlers.current.onSelect;\n if (report === undefined) return;\n const range = update.state.selection.main;\n report(selectionRange(update.view, range.from, range.to));\n }),\n ],\n }),\n });\n view.current = editor;\n return () => {\n editor.destroy();\n view.current = null;\n };\n // Built once.\n }, []);\n\n useImperativeHandle(\n controllerRef,\n () => ({\n focus: () => view.current?.focus(),\n revealAndSelect: (range) => {\n const editor = view.current;\n if (editor === null) return;\n const [bounded] = boundedEditorRanges(editor.state.doc.length, [range]);\n if (bounded === undefined) return;\n editor.dispatch({\n selection: { anchor: bounded.from, head: bounded.to },\n effects: EditorView.scrollIntoView(bounded.from, { y: 'center' }),\n });\n },\n applyEdits: (edits) => {\n const editor = view.current;\n if (editor === null || edits.length === 0) return;\n editor.dispatch({ changes: boundedEditorEdits(editor.state.doc.length, edits) });\n },\n setClosedRanges: (ranges) => {\n const editor = view.current;\n if (editor === null) return;\n const bounded = boundedEditorRanges(editor.state.doc.length, ranges);\n const decorations = bounded.map((range) =>\n range.from === range.to\n ? Decoration.line({ attributes: { class: 'cm-closed-tone', 'data-tone': 'closed' } }).range(\n editor.state.doc.lineAt(range.from).from,\n )\n : Decoration.mark({ class: 'cm-closed-tone', attributes: { 'data-tone': 'closed' } }).range(\n range.from,\n range.to,\n ),\n );\n editor.dispatch({ effects: setClosedDecorations.of(Decoration.set(decorations)) });\n },\n setMarkedRanges: (ranges) => {\n const editor = view.current;\n if (editor === null) return;\n const decorations = ranges.flatMap((range) => {\n const [bounded] = boundedEditorRanges(editor.state.doc.length, [range]);\n if (bounded === undefined || bounded.from === bounded.to) return [];\n return [\n Decoration.widget({ widget: new MarkedRangeLabel(range.label), side: -1 }).range(bounded.from),\n Decoration.mark({\n class: 'cm-marked-region',\n attributes: { 'data-author-region': range.label },\n }).range(bounded.from, bounded.to),\n ];\n });\n editor.dispatch({ effects: setMarkedDecorations.of(Decoration.set(decorations, true)) });\n },\n resolveViewportRegion: (rectangle) => {\n const editor = view.current;\n return editor === null ? null : resolveEditorViewportRegion(editor, rectangle);\n },\n }),\n [],\n );\n\n useEffect(() => {\n const editor = view.current;\n // A caller that echoes onChange back into `value` would otherwise replace\n // the document on every keystroke and drop the cursor to the end.\n if (editor === null || editor.state.doc.toString() === value) return;\n editor.dispatch({ changes: { from: 0, to: editor.state.doc.length, insert: value } });\n }, [value]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.readOnly.reconfigure([\n EditorState.readOnly.of(readOnly),\n EditorView.editable.of(!readOnly),\n ]),\n });\n }, [readOnly]);\n\n useEffect(() => {\n view.current?.dispatch({\n effects: compartments.current.wrapping.reconfigure(lineWrapping ? EditorView.lineWrapping : []),\n });\n }, [lineWrapping]);\n\n useEffect(() => {\n const key = path === undefined ? undefined : grammarKeyOf(path);\n const { language } = compartments.current;\n if (key === undefined) {\n view.current?.dispatch({ effects: language.reconfigure([]) });\n return;\n }\n let cancelled = false;\n void loadGrammar(key)\n .then((grammar) => {\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure(grammar) });\n })\n .catch(() => {\n // A grammar is a separate chunk over the network, and the cockpit is\n // often read through a tunnel. Losing it costs syntax colour, not the\n // file, so fall back to plain text rather than failing the pane.\n if (!cancelled) view.current?.dispatch({ effects: language.reconfigure([]) });\n });\n return () => {\n cancelled = true;\n };\n }, [path]);\n\n return <div ref={host} data-testid={testId} className={cn('min-h-0 overflow-hidden', className)} />;\n}\n"],"mappings":"0YAgCA,SAAS,EAAe,EAAyC,EAAc,EAAkC,CAC/G,IAAM,EAAQ,KAAK,IAAI,EAAM,CAAE,EACzB,EAAM,KAAK,IAAI,EAAM,CAAE,EAC7B,MAAO,CACL,KAAM,EAAO,MAAM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A,GAAG,0BAA2B,CAAS,CAAI,CAAA,CACpG"}
@@ -1,2 +1,2 @@
1
- import{cn as e}from"../lib/cn.mjs";import{grammarKeyOf as t,loadGrammar as n}from"../lib/editorLanguage.mjs";import{DOOM_EDITOR_STYLES as r,DOOM_SYNTAX_STYLES as i}from"../lib/editorTheme.mjs";import{jsx as a}from"react/jsx-runtime";import{useEffect as o,useRef as s}from"react";import{defaultKeymap as c,history as l,historyKeymap as u,indentWithTab as d}from"@codemirror/commands";import{HighlightStyle as f,bracketMatching as p,foldGutter as m,foldKeymap as h,indentOnInput as g,syntaxHighlighting as _}from"@codemirror/language";import{highlightSelectionMatches as v,search as y,searchKeymap as b}from"@codemirror/search";import{Compartment as x,EditorState as S}from"@codemirror/state";import{EditorView as C,drawSelection as w,highlightActiveLine as T,highlightActiveLineGutter as E,keymap as D,lineNumbers as O,rectangularSelection as k}from"@codemirror/view";import{tags as A}from"@lezer/highlight";const j=C.theme(r),M=f.define([{tag:A.comment,...i.comment},{tag:A.keyword,...i.keyword},{tag:[A.atom,A.bool,A.null,A.self],...i.constant},{tag:A.number,...i.literal},{tag:[A.string,A.special(A.string),A.character],...i.string},{tag:A.regexp,...i.regexp},{tag:A.operator,...i.operator},{tag:A.punctuation,...i.punctuation},{tag:A.variableName,...i.variable},{tag:A.propertyName,...i.property},{tag:[A.function(A.variableName),A.function(A.propertyName)],...i.callable},{tag:[A.typeName,A.className,A.namespace],...i.type},{tag:A.tagName,...i.tag},{tag:A.attributeName,...i.attribute},{tag:[A.meta,A.processingInstruction],...i.meta},{tag:A.heading,...i.heading},{tag:[A.link,A.url],...i.link},{tag:A.emphasis,...i.emphasis},{tag:A.strong,...i.strong},{tag:A.strikethrough,...i.strikethrough},{tag:A.invalid,...i.invalid}]),N=[O(),E(),m(),T(),w(),k(),g(),p(),l(),y({top:!0}),v(),D.of([...c,...u,...b,...h,d]),_(M),j];function P({value:r,path:i,readOnly:c=!1,lineWrapping:l=!0,className:u,onChange:d,onSelect:f,"data-testid":p}){let m=s(null),h=s(null),g=s({onChange:d,onSelect:f}),_=s({language:new x,readOnly:new x,wrapping:new x});return o(()=>{g.current={onChange:d,onSelect:f}}),o(()=>{let e=m.current;if(e===null)return;let{language:t,readOnly:n,wrapping:i}=_.current,a=new C({parent:e,state:S.create({doc:r,extensions:[...N,t.of([]),n.of([]),i.of([]),C.updateListener.of(e=>{if(e.docChanged&&g.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=g.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t({text:e.state.sliceDoc(n.from,n.to),startLine:e.state.doc.lineAt(n.from).number,endLine:e.state.doc.lineAt(n.to).number})})]})});return h.current=a,()=>{a.destroy(),h.current=null}},[]),o(()=>{let e=h.current;e!==null&&e.state.doc.toString()!==r&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:r}})},[r]),o(()=>{h.current?.dispatch({effects:_.current.readOnly.reconfigure([S.readOnly.of(c),C.editable.of(!c)])})},[c]),o(()=>{h.current?.dispatch({effects:_.current.wrapping.reconfigure(l?C.lineWrapping:[])})},[l]),o(()=>{let e=i===void 0?void 0:t(i),{language:r}=_.current;if(e===void 0){h.current?.dispatch({effects:r.reconfigure([])});return}let a=!1;return n(e).then(e=>{a||h.current?.dispatch({effects:r.reconfigure(e)})}).catch(()=>{a||h.current?.dispatch({effects:r.reconfigure([])})}),()=>{a=!0}},[i]),a(`div`,{ref:m,"data-testid":p,className:e(`min-h-0 overflow-hidden`,u)})}export{P as CodeEditorView};
1
+ import{cn as e}from"../lib/cn.mjs";import{grammarKeyOf as t,loadGrammar as n}from"../lib/editorLanguage.mjs";import{DOOM_EDITOR_STYLES as r,DOOM_SYNTAX_STYLES as i}from"../lib/editorTheme.mjs";import{boundedEditorEdits as a,boundedEditorRanges as o}from"../lib/editorController.mjs";import{jsx as s}from"react/jsx-runtime";import{useEffect as c,useImperativeHandle as l,useLayoutEffect as u,useRef as d}from"react";import{defaultKeymap as f,history as p,historyKeymap as m,indentWithTab as h}from"@codemirror/commands";import{HighlightStyle as g,bracketMatching as _,foldGutter as v,foldKeymap as y,indentOnInput as b,syntaxHighlighting as x}from"@codemirror/language";import{highlightSelectionMatches as S,search as C,searchKeymap as w}from"@codemirror/search";import{Compartment as T,EditorState as E,StateEffect as D,StateField as O}from"@codemirror/state";import{Decoration as k,EditorView as A,WidgetType as j,drawSelection as M,highlightActiveLine as N,highlightActiveLineGutter as P,keymap as F,lineNumbers as I,rectangularSelection as L}from"@codemirror/view";import{tags as R}from"@lezer/highlight";function z(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return{text:e.state.sliceDoc(r,i),from:r,to:i,startLine:e.state.doc.lineAt(r).number,endLine:e.state.doc.lineAt(i).number}}function B(e,t){let n=e.posAtCoords({x:t.left,y:t.top}),r=e.posAtCoords({x:t.right,y:t.bottom});return n===null||r===null?null:z(e,n,r)}const V=A.theme(r),H=g.define([{tag:R.comment,...i.comment},{tag:R.keyword,...i.keyword},{tag:[R.atom,R.bool,R.null,R.self],...i.constant},{tag:R.number,...i.literal},{tag:[R.string,R.special(R.string),R.character],...i.string},{tag:R.regexp,...i.regexp},{tag:R.operator,...i.operator},{tag:R.punctuation,...i.punctuation},{tag:R.variableName,...i.variable},{tag:R.propertyName,...i.property},{tag:[R.function(R.variableName),R.function(R.propertyName)],...i.callable},{tag:[R.typeName,R.className,R.namespace],...i.type},{tag:R.tagName,...i.tag},{tag:R.attributeName,...i.attribute},{tag:[R.meta,R.processingInstruction],...i.meta},{tag:R.heading,...i.heading},{tag:[R.link,R.url],...i.link},{tag:R.emphasis,...i.emphasis},{tag:R.strong,...i.strong},{tag:R.strikethrough,...i.strikethrough},{tag:R.invalid,...i.invalid}]),U=D.define(),W=O.define({create:()=>k.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(U)&&(n=e.value);return n},provide:e=>A.decorations.from(e)}),G=D.define(),K=O.define({create:()=>k.none,update:(e,t)=>{let n=e.map(t.changes);for(let e of t.effects)e.is(G)&&(n=e.value);return n},provide:e=>A.decorations.from(e)});var q=class extends j{label;constructor(e){super(),this.label=e}eq(e){return e.label===this.label}toDOM(){let e=document.createElement(`span`);return e.className=`cm-marked-region-label`,e.dataset.authorRegionLabel=this.label,e.textContent=this.label,e}};const J=A.baseTheme({".cm-marked-region":{backgroundColor:`var(--doom-tint-yellow)`,borderBottom:`1px solid var(--doom-edge-yellow)`},".cm-marked-region-label":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:`16px`,height:`16px`,marginRight:`4px`,borderRadius:`999px`,backgroundColor:`var(--doom-yellow)`,color:`var(--doom-deep)`,fontSize:`9px`,fontWeight:`700`,lineHeight:`1`,verticalAlign:`text-bottom`}}),Y=[I(),P(),v(),N(),M(),L(),b(),_(),p(),C({top:!0}),S(),F.of([...f,...m,...w,...y,h]),x(H),W,K,J,V];function X({value:r,path:i,readOnly:f=!1,lineWrapping:p=!0,className:m,onChange:h,onSelect:g,controllerRef:_,"data-testid":v}){let y=d(null),b=d(null),x=d({onChange:h,onSelect:g}),S=d(r),C=d({language:new T,readOnly:new T,wrapping:new T});return c(()=>{x.current={onChange:h,onSelect:g}}),u(()=>{let e=y.current;if(e===null)return;let{language:t,readOnly:n,wrapping:r}=C.current,i=new A({parent:e,state:E.create({doc:S.current,extensions:[...Y,t.of([]),n.of([]),r.of([]),A.updateListener.of(e=>{if(e.docChanged&&x.current.onChange?.(e.state.doc.toString()),!e.selectionSet&&!e.docChanged)return;let t=x.current.onSelect;if(t===void 0)return;let n=e.state.selection.main;t(z(e.view,n.from,n.to))})]})});return b.current=i,()=>{i.destroy(),b.current=null}},[]),l(_,()=>({focus:()=>b.current?.focus(),revealAndSelect:e=>{let t=b.current;if(t===null)return;let[n]=o(t.state.doc.length,[e]);n!==void 0&&t.dispatch({selection:{anchor:n.from,head:n.to},effects:A.scrollIntoView(n.from,{y:`center`})})},applyEdits:e=>{let t=b.current;t!==null&&e.length!==0&&t.dispatch({changes:a(t.state.doc.length,e)})},setClosedRanges:e=>{let t=b.current;if(t===null)return;let n=o(t.state.doc.length,e).map(e=>e.from===e.to?k.line({attributes:{class:`cm-closed-tone`,"data-tone":`closed`}}).range(t.state.doc.lineAt(e.from).from):k.mark({class:`cm-closed-tone`,attributes:{"data-tone":`closed`}}).range(e.from,e.to));t.dispatch({effects:U.of(k.set(n))})},setMarkedRanges:e=>{let t=b.current;if(t===null)return;let n=e.flatMap(e=>{let[n]=o(t.state.doc.length,[e]);return n===void 0||n.from===n.to?[]:[k.widget({widget:new q(e.label),side:-1}).range(n.from),k.mark({class:`cm-marked-region`,attributes:{"data-author-region":e.label}}).range(n.from,n.to)]});t.dispatch({effects:G.of(k.set(n,!0))})},resolveViewportRegion:e=>{let t=b.current;return t===null?null:B(t,e)}}),[]),c(()=>{let e=b.current;e!==null&&e.state.doc.toString()!==r&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:r}})},[r]),c(()=>{b.current?.dispatch({effects:C.current.readOnly.reconfigure([E.readOnly.of(f),A.editable.of(!f)])})},[f]),c(()=>{b.current?.dispatch({effects:C.current.wrapping.reconfigure(p?A.lineWrapping:[])})},[p]),c(()=>{let e=i===void 0?void 0:t(i),{language:r}=C.current;if(e===void 0){b.current?.dispatch({effects:r.reconfigure([])});return}let a=!1;return n(e).then(e=>{a||b.current?.dispatch({effects:r.reconfigure(e)})}).catch(()=>{a||b.current?.dispatch({effects:r.reconfigure([])})}),()=>{a=!0}},[i]),/* @__PURE__ */ s(`div`,{ref:y,"data-testid":v,className:e(`min-h-0 overflow-hidden`,m)})}export{X as CodeEditorView,B as resolveEditorViewportRegion};
2
2
  //# sourceMappingURL=CodeEditorView.mjs.map