@deepseek-ai/dsh-client-ui-primitives 0.2.2-alpha.3 → 0.2.2-rc.2

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 (412) hide show
  1. package/README.i18n.yaml +16 -16
  2. package/README.md +21 -14
  3. package/README.zh.md +21 -14
  4. package/lib/HoverCard.module.css +8 -3
  5. package/lib/JsonTree.module.css +7 -17
  6. package/lib/Menu.module.css +157 -37
  7. package/lib/Modal.module.css +16 -0
  8. package/lib/QuotePreview.module.css +37 -0
  9. package/lib/RiskConfirmation.module.css +11 -37
  10. package/lib/Toast.module.css +2 -3
  11. package/lib/Tooltip.module.css +2 -1
  12. package/lib/index.js +1447 -776
  13. package/lib/index.js.map +1 -0
  14. package/lib/markdown/CodeBlock.module.css +64 -0
  15. package/lib/markdown/MarkdownText.module.css +20 -1
  16. package/lib/types/AnimatedRows.d.ts +3 -0
  17. package/lib/types/AnimatedRows.d.ts.map +1 -0
  18. package/lib/types/AnimatedRows.js.map +1 -0
  19. package/lib/types/BrandWordmark.d.ts.map +1 -0
  20. package/lib/types/BrandWordmark.js.map +1 -0
  21. package/lib/types/Button.d.ts.map +1 -0
  22. package/lib/types/Button.js.map +1 -0
  23. package/lib/types/Checkbox.d.ts +3 -1
  24. package/lib/types/Checkbox.d.ts.map +1 -0
  25. package/lib/types/Checkbox.js.map +1 -0
  26. package/lib/types/CodeFileIcon.d.ts.map +1 -0
  27. package/lib/types/CodeFileIcon.js.map +1 -0
  28. package/lib/types/CodeToolbar.d.ts.map +1 -0
  29. package/lib/types/CodeToolbar.js.map +1 -0
  30. package/lib/types/CommandText.d.ts.map +1 -0
  31. package/lib/types/CommandText.js.map +1 -0
  32. package/lib/types/ConfigField.d.ts.map +1 -0
  33. package/lib/types/ConfigField.js.map +1 -0
  34. package/lib/types/ConnectionIndicator.d.ts.map +1 -0
  35. package/lib/types/ConnectionIndicator.js.map +1 -0
  36. package/lib/types/DetailDocument.d.ts.map +1 -0
  37. package/lib/types/DetailDocument.js.map +1 -0
  38. package/lib/types/DiffBlock.d.ts.map +1 -0
  39. package/lib/types/DiffBlock.js.map +1 -0
  40. package/lib/types/DisclosureRow.d.ts.map +1 -0
  41. package/lib/types/DisclosureRow.js.map +1 -0
  42. package/lib/types/DraggableImage.d.ts.map +1 -0
  43. package/lib/types/DraggableImage.js.map +1 -0
  44. package/lib/types/FileTypeIcon.d.ts.map +1 -0
  45. package/lib/types/FileTypeIcon.js.map +1 -0
  46. package/lib/types/FishLogo.d.ts.map +1 -0
  47. package/lib/types/FishLogo.js.map +1 -0
  48. package/lib/types/FoldToggle.d.ts.map +1 -0
  49. package/lib/types/FoldToggle.js.map +1 -0
  50. package/lib/types/HoverCard.d.ts.map +1 -0
  51. package/lib/types/HoverCard.js.map +1 -0
  52. package/lib/types/HoverCardGroup.d.ts.map +1 -0
  53. package/lib/types/HoverCardGroup.js.map +1 -0
  54. package/lib/types/ImageLightbox.d.ts.map +1 -0
  55. package/lib/types/ImageLightbox.js.map +1 -0
  56. package/lib/types/ImagePreview.d.ts.map +1 -0
  57. package/lib/types/ImagePreview.js.map +1 -0
  58. package/lib/types/InlineEditor.d.ts.map +1 -0
  59. package/lib/types/InlineEditor.js.map +1 -0
  60. package/lib/types/Input.d.ts.map +1 -0
  61. package/lib/types/Input.js.map +1 -0
  62. package/lib/types/JsonTree.d.ts.map +1 -0
  63. package/lib/types/JsonTree.js.map +1 -0
  64. package/lib/types/LinkIcon.d.ts.map +1 -0
  65. package/lib/types/LinkIcon.js.map +1 -0
  66. package/lib/types/Menu.d.ts +26 -14
  67. package/lib/types/Menu.d.ts.map +1 -0
  68. package/lib/types/Menu.js.map +1 -0
  69. package/lib/types/MenuGroup.d.ts.map +1 -0
  70. package/lib/types/MenuGroup.js.map +1 -0
  71. package/lib/types/MenuRow.d.ts +37 -0
  72. package/lib/types/MenuRow.d.ts.map +1 -0
  73. package/lib/types/MenuRow.js.map +1 -0
  74. package/lib/types/MenuSurface.d.ts.map +1 -0
  75. package/lib/types/MenuSurface.js.map +1 -0
  76. package/lib/types/Modal.d.ts +3 -1
  77. package/lib/types/Modal.d.ts.map +1 -0
  78. package/lib/types/Modal.js.map +1 -0
  79. package/lib/types/PathLabel.d.ts.map +1 -0
  80. package/lib/types/PathLabel.js.map +1 -0
  81. package/lib/types/PermissionIcon.d.ts.map +1 -0
  82. package/lib/types/PermissionIcon.js.map +1 -0
  83. package/lib/types/Pill.d.ts.map +1 -0
  84. package/lib/types/Pill.js.map +1 -0
  85. package/lib/types/QuotePreview.d.ts +17 -4
  86. package/lib/types/QuotePreview.d.ts.map +1 -0
  87. package/lib/types/QuotePreview.js.map +1 -0
  88. package/lib/types/ReadBlock.d.ts.map +1 -0
  89. package/lib/types/ReadBlock.js.map +1 -0
  90. package/lib/types/ReferenceIcon.d.ts.map +1 -0
  91. package/lib/types/ReferenceIcon.js.map +1 -0
  92. package/lib/types/RiskConfirmation.d.ts.map +1 -0
  93. package/lib/types/RiskConfirmation.js.map +1 -0
  94. package/lib/types/SearchBlock.d.ts.map +1 -0
  95. package/lib/types/SearchBlock.js.map +1 -0
  96. package/lib/types/SegmentedControl.d.ts.map +1 -0
  97. package/lib/types/SegmentedControl.js.map +1 -0
  98. package/lib/types/SegmentedTabs.d.ts.map +1 -0
  99. package/lib/types/SegmentedTabs.js.map +1 -0
  100. package/lib/types/ShortcutKeys.d.ts.map +1 -0
  101. package/lib/types/ShortcutKeys.js.map +1 -0
  102. package/lib/types/SiteGlyph.d.ts.map +1 -0
  103. package/lib/types/SiteGlyph.js.map +1 -0
  104. package/lib/types/StateDot.d.ts.map +1 -0
  105. package/lib/types/StateDot.js.map +1 -0
  106. package/lib/types/SubmenuPanel.d.ts +19 -0
  107. package/lib/types/SubmenuPanel.d.ts.map +1 -0
  108. package/lib/types/SubmenuPanel.js.map +1 -0
  109. package/lib/types/Switch.d.ts.map +1 -0
  110. package/lib/types/Switch.js.map +1 -0
  111. package/lib/types/Tag.d.ts.map +1 -0
  112. package/lib/types/Tag.js.map +1 -0
  113. package/lib/types/TerminalBlock.d.ts.map +1 -0
  114. package/lib/types/TerminalBlock.js.map +1 -0
  115. package/lib/types/TextShimmer.d.ts.map +1 -0
  116. package/lib/types/TextShimmer.js.map +1 -0
  117. package/lib/types/Toast.d.ts.map +1 -0
  118. package/lib/types/Toast.js.map +1 -0
  119. package/lib/types/Tooltip.d.ts.map +1 -0
  120. package/lib/types/Tooltip.js.map +1 -0
  121. package/lib/types/UserMessageBubble.d.ts.map +1 -0
  122. package/lib/types/UserMessageBubble.js.map +1 -0
  123. package/lib/types/WebBlock.d.ts.map +1 -0
  124. package/lib/types/WebBlock.js.map +1 -0
  125. package/lib/types/ZoomControls.d.ts.map +1 -0
  126. package/lib/types/ZoomControls.js.map +1 -0
  127. package/lib/types/ansi.d.ts.map +1 -0
  128. package/lib/types/ansi.js.map +1 -0
  129. package/lib/types/clipboard.d.ts.map +1 -0
  130. package/lib/types/clipboard.js.map +1 -0
  131. package/lib/types/code-file-icon-artwork.d.ts.map +1 -0
  132. package/lib/types/code-file-icon-artwork.js.map +1 -0
  133. package/lib/types/code-file-types.d.ts.map +1 -0
  134. package/lib/types/code-file-types.js.map +1 -0
  135. package/lib/types/code-highlighting.d.ts.map +1 -0
  136. package/lib/types/code-highlighting.js.map +1 -0
  137. package/lib/types/darwin-desktop.d.ts.map +1 -0
  138. package/lib/types/darwin-desktop.js.map +1 -0
  139. package/lib/types/document-zoom.d.ts.map +1 -0
  140. package/lib/types/document-zoom.js.map +1 -0
  141. package/lib/types/file-drag-actions.d.ts.map +1 -0
  142. package/lib/types/file-drag-actions.js.map +1 -0
  143. package/lib/types/file-size.d.ts.map +1 -0
  144. package/lib/types/file-size.js.map +1 -0
  145. package/lib/types/focus.d.ts.map +1 -0
  146. package/lib/types/focus.js.map +1 -0
  147. package/lib/types/guide-artwork.d.ts.map +1 -0
  148. package/lib/types/guide-artwork.js.map +1 -0
  149. package/lib/types/head-tail-cap.d.ts.map +1 -0
  150. package/lib/types/head-tail-cap.js.map +1 -0
  151. package/lib/types/icons/artwork.d.ts +12 -0
  152. package/lib/types/icons/artwork.d.ts.map +1 -0
  153. package/lib/types/icons/artwork.js.map +1 -0
  154. package/lib/types/icons/index.d.ts +12 -0
  155. package/lib/types/icons/index.d.ts.map +1 -0
  156. package/lib/types/icons/index.js.map +1 -0
  157. package/lib/types/icons/props.d.ts.map +1 -0
  158. package/lib/types/icons/props.js.map +1 -0
  159. package/lib/types/icons/shared-artwork.d.ts.map +1 -0
  160. package/lib/types/icons/shared-artwork.js.map +1 -0
  161. package/lib/types/image-drag.d.ts.map +1 -0
  162. package/lib/types/image-drag.js.map +1 -0
  163. package/lib/types/index.d.ts +5 -4
  164. package/lib/types/index.d.ts.map +1 -0
  165. package/lib/types/index.js.map +1 -0
  166. package/lib/types/input-modality.d.ts.map +1 -0
  167. package/lib/types/input-modality.js.map +1 -0
  168. package/lib/types/keyboard-composition.d.ts.map +1 -0
  169. package/lib/types/keyboard-composition.js.map +1 -0
  170. package/lib/types/markdown/CodeBlock.d.ts +8 -1
  171. package/lib/types/markdown/CodeBlock.d.ts.map +1 -0
  172. package/lib/types/markdown/CodeBlock.js.map +1 -0
  173. package/lib/types/markdown/FenceBlocks.d.ts +31 -0
  174. package/lib/types/markdown/FenceBlocks.d.ts.map +1 -0
  175. package/lib/types/markdown/FenceBlocks.js.map +1 -0
  176. package/lib/types/markdown/JsonBlock.d.ts.map +1 -0
  177. package/lib/types/markdown/JsonBlock.js.map +1 -0
  178. package/lib/types/markdown/MarkdownDelegate.d.ts +23 -1
  179. package/lib/types/markdown/MarkdownDelegate.d.ts.map +1 -0
  180. package/lib/types/markdown/MarkdownDelegate.js.map +1 -0
  181. package/lib/types/markdown/MarkdownText.d.ts +2 -0
  182. package/lib/types/markdown/MarkdownText.d.ts.map +1 -0
  183. package/lib/types/markdown/MarkdownText.js.map +1 -0
  184. package/lib/types/markdown/cjkFriendlyStrong.d.ts.map +1 -0
  185. package/lib/types/markdown/cjkFriendlyStrong.js.map +1 -0
  186. package/lib/types/markdown/copy-tex.d.ts +14 -0
  187. package/lib/types/markdown/copy-tex.d.ts.map +1 -0
  188. package/lib/types/markdown/copy-tex.js.map +1 -0
  189. package/lib/types/markdown/diff-fence.d.ts +58 -0
  190. package/lib/types/markdown/diff-fence.d.ts.map +1 -0
  191. package/lib/types/markdown/diff-fence.js.map +1 -0
  192. package/lib/types/markdown/file-link.d.ts.map +1 -0
  193. package/lib/types/markdown/file-link.js.map +1 -0
  194. package/lib/types/markdown/highlight.d.ts +18 -0
  195. package/lib/types/markdown/highlight.d.ts.map +1 -0
  196. package/lib/types/markdown/highlight.js.map +1 -0
  197. package/lib/types/markdown/incremental.d.ts.map +1 -0
  198. package/lib/types/markdown/incremental.js.map +1 -0
  199. package/lib/types/markdown/katex.d.ts.map +1 -0
  200. package/lib/types/markdown/katex.js.map +1 -0
  201. package/lib/types/markdown/local-image-syntax.d.ts.map +1 -0
  202. package/lib/types/markdown/local-image-syntax.js.map +1 -0
  203. package/lib/types/markdown/mathCompatibility.d.ts.map +1 -0
  204. package/lib/types/markdown/mathCompatibility.js.map +1 -0
  205. package/lib/types/markdown/parse.d.ts.map +1 -0
  206. package/lib/types/markdown/parse.js.map +1 -0
  207. package/lib/types/markdown/plain-text.d.ts.map +1 -0
  208. package/lib/types/markdown/plain-text.js.map +1 -0
  209. package/lib/types/markdown/quote-text.d.ts.map +1 -0
  210. package/lib/types/markdown/quote-text.js.map +1 -0
  211. package/lib/types/markdown/render.d.ts.map +1 -0
  212. package/lib/types/markdown/render.js.map +1 -0
  213. package/lib/types/markdown/useViewportHighlighting.d.ts.map +1 -0
  214. package/lib/types/markdown/useViewportHighlighting.js.map +1 -0
  215. package/lib/types/markdown/windows-path-destinations.d.ts.map +1 -0
  216. package/lib/types/markdown/windows-path-destinations.js.map +1 -0
  217. package/lib/types/menu-submenu-position.d.ts +15 -0
  218. package/lib/types/menu-submenu-position.d.ts.map +1 -0
  219. package/lib/types/menu-submenu-position.js.map +1 -0
  220. package/lib/types/overlay-top-margin.d.ts.map +1 -0
  221. package/lib/types/overlay-top-margin.js.map +1 -0
  222. package/lib/types/plugin-artwork.d.ts.map +1 -0
  223. package/lib/types/plugin-artwork.js.map +1 -0
  224. package/lib/types/pointer-grace.d.ts.map +1 -0
  225. package/lib/types/pointer-grace.js.map +1 -0
  226. package/lib/types/rank-by-name.d.ts.map +1 -0
  227. package/lib/types/rank-by-name.js.map +1 -0
  228. package/lib/types/relative-time.d.ts.map +1 -0
  229. package/lib/types/relative-time.js.map +1 -0
  230. package/lib/types/settings-form/SettingsForm.d.ts.map +1 -0
  231. package/lib/types/settings-form/SettingsForm.js.map +1 -0
  232. package/lib/types/settings-form/fields.d.ts.map +1 -0
  233. package/lib/types/settings-form/fields.js.map +1 -0
  234. package/lib/types/settings-form/form-model.d.ts.map +1 -0
  235. package/lib/types/settings-form/form-model.js.map +1 -0
  236. package/lib/types/tooltip-placement.d.ts.map +1 -0
  237. package/lib/types/tooltip-placement.js.map +1 -0
  238. package/lib/types/use-clipboard-copy.d.ts.map +1 -0
  239. package/lib/types/use-clipboard-copy.js.map +1 -0
  240. package/lib/types/useAnchoredMaxHeight.d.ts.map +1 -0
  241. package/lib/types/useAnchoredMaxHeight.js.map +1 -0
  242. package/lib/types/useDismissOnOutsidePointer.d.ts.map +1 -0
  243. package/lib/types/useDismissOnOutsidePointer.js.map +1 -0
  244. package/lib/types/useMenuSubmenu.d.ts +43 -0
  245. package/lib/types/useMenuSubmenu.d.ts.map +1 -0
  246. package/lib/types/useMenuSubmenu.js.map +1 -0
  247. package/lib/types/useModalLayer.d.ts.map +1 -0
  248. package/lib/types/useModalLayer.js.map +1 -0
  249. package/lib/types/useRowDragPreview.d.ts.map +1 -0
  250. package/lib/types/useRowDragPreview.js.map +1 -0
  251. package/lib/types/user-text.d.ts.map +1 -0
  252. package/lib/types/user-text.js.map +1 -0
  253. package/package.json +11 -8
  254. package/src/AnimatedRows.module.css +7 -0
  255. package/src/AnimatedRows.tsx +195 -0
  256. package/src/BrandWordmark.tsx +59 -0
  257. package/src/Button.module.css +84 -0
  258. package/src/Button.tsx +36 -0
  259. package/src/Checkbox.module.css +28 -0
  260. package/src/Checkbox.tsx +34 -0
  261. package/src/CodeCard.module.css +85 -0
  262. package/src/CodeFileIcon.tsx +28 -0
  263. package/src/CodeToolbar.tsx +62 -0
  264. package/src/CommandText.module.css +12 -0
  265. package/src/CommandText.tsx +46 -0
  266. package/src/ConfigField.module.css +12 -0
  267. package/src/ConfigField.tsx +53 -0
  268. package/src/ConnectionIndicator.module.css +120 -0
  269. package/src/ConnectionIndicator.tsx +103 -0
  270. package/src/DetailDocument.module.css +67 -0
  271. package/src/DetailDocument.tsx +120 -0
  272. package/src/DiffBlock.module.css +82 -0
  273. package/src/DiffBlock.tsx +221 -0
  274. package/src/DisclosureRow.module.css +115 -0
  275. package/src/DisclosureRow.tsx +124 -0
  276. package/src/DraggableImage.tsx +26 -0
  277. package/src/FileTypeIcon.module.css +50 -0
  278. package/src/FileTypeIcon.tsx +285 -0
  279. package/src/FishLogo.tsx +28 -0
  280. package/src/FoldToggle.tsx +33 -0
  281. package/src/HoverCard.module.css +108 -0
  282. package/src/HoverCard.tsx +356 -0
  283. package/src/HoverCardGroup.tsx +77 -0
  284. package/src/ImageLightbox.module.css +54 -0
  285. package/src/ImageLightbox.tsx +72 -0
  286. package/src/ImagePreview.module.css +24 -0
  287. package/src/ImagePreview.tsx +36 -0
  288. package/src/InlineEditor.module.css +23 -0
  289. package/src/InlineEditor.tsx +69 -0
  290. package/src/Input.module.css +38 -0
  291. package/src/Input.tsx +24 -0
  292. package/src/JsonTree.module.css +371 -0
  293. package/src/JsonTree.tsx +850 -0
  294. package/src/LinkIcon.tsx +118 -0
  295. package/src/Menu.module.css +443 -0
  296. package/src/Menu.tsx +553 -0
  297. package/src/MenuGroup.module.css +37 -0
  298. package/src/MenuGroup.tsx +103 -0
  299. package/src/MenuRow.tsx +89 -0
  300. package/src/MenuSurface.module.css +65 -0
  301. package/src/MenuSurface.tsx +54 -0
  302. package/src/Modal.module.css +147 -0
  303. package/src/Modal.tsx +96 -0
  304. package/src/PathLabel.module.css +28 -0
  305. package/src/PathLabel.tsx +41 -0
  306. package/src/PermissionIcon.tsx +119 -0
  307. package/src/Pill.module.css +30 -0
  308. package/src/Pill.tsx +36 -0
  309. package/src/QuotePreview.module.css +138 -0
  310. package/src/QuotePreview.tsx +133 -0
  311. package/src/ReadBlock.module.css +45 -0
  312. package/src/ReadBlock.tsx +151 -0
  313. package/src/ReferenceIcon.tsx +49 -0
  314. package/src/RiskConfirmation.module.css +47 -0
  315. package/src/RiskConfirmation.tsx +79 -0
  316. package/src/RowDragPreview.module.css +12 -0
  317. package/src/SearchBlock.module.css +114 -0
  318. package/src/SearchBlock.tsx +281 -0
  319. package/src/SegmentedControl.module.css +81 -0
  320. package/src/SegmentedControl.tsx +140 -0
  321. package/src/SegmentedTabs.module.css +77 -0
  322. package/src/SegmentedTabs.tsx +84 -0
  323. package/src/ShortcutKeys.module.css +33 -0
  324. package/src/ShortcutKeys.tsx +12 -0
  325. package/src/SiteGlyph.tsx +149 -0
  326. package/src/StateDot.module.css +100 -0
  327. package/src/StateDot.tsx +77 -0
  328. package/src/SubmenuPanel.tsx +51 -0
  329. package/src/Switch.module.css +49 -0
  330. package/src/Switch.tsx +42 -0
  331. package/src/Tag.module.css +57 -0
  332. package/src/Tag.tsx +42 -0
  333. package/src/TerminalBlock.module.css +207 -0
  334. package/src/TerminalBlock.tsx +294 -0
  335. package/src/TextShimmer.module.css +88 -0
  336. package/src/TextShimmer.tsx +58 -0
  337. package/src/Toast.module.css +102 -0
  338. package/src/Toast.tsx +101 -0
  339. package/src/Tooltip.module.css +68 -0
  340. package/src/Tooltip.tsx +273 -0
  341. package/src/UserMessageBubble.module.css +11 -0
  342. package/src/UserMessageBubble.tsx +16 -0
  343. package/src/WebBlock.module.css +153 -0
  344. package/src/WebBlock.tsx +196 -0
  345. package/src/ZoomControls.module.css +54 -0
  346. package/src/ZoomControls.tsx +92 -0
  347. package/src/ansi.ts +447 -0
  348. package/src/clipboard.ts +47 -0
  349. package/src/code-file-icon-artwork.manifest.json +71 -0
  350. package/src/code-file-icon-artwork.ts +60 -0
  351. package/src/code-file-types.ts +340 -0
  352. package/src/code-highlighting.ts +25 -0
  353. package/src/css-modules.d.ts +6 -0
  354. package/src/darwin-desktop.ts +11 -0
  355. package/src/document-zoom.ts +12 -0
  356. package/src/file-drag-actions.ts +29 -0
  357. package/src/file-size.ts +16 -0
  358. package/src/focus.ts +44 -0
  359. package/src/guide-artwork.tsx +32 -0
  360. package/src/head-tail-cap.ts +27 -0
  361. package/src/icons/artwork.ts +156 -0
  362. package/src/icons/index.tsx +634 -0
  363. package/src/icons/props.ts +8 -0
  364. package/src/icons/shared-artwork.tsx +71 -0
  365. package/src/image-drag.ts +84 -0
  366. package/src/index.ts +142 -0
  367. package/src/input-modality.ts +59 -0
  368. package/src/keyboard-composition.ts +36 -0
  369. package/src/markdown/CodeBlock.module.css +209 -0
  370. package/src/markdown/CodeBlock.tsx +268 -0
  371. package/src/markdown/FenceBlocks.tsx +51 -0
  372. package/src/markdown/JsonBlock.module.css +34 -0
  373. package/src/markdown/JsonBlock.tsx +36 -0
  374. package/src/markdown/MarkdownDelegate.tsx +102 -0
  375. package/src/markdown/MarkdownText.module.css +511 -0
  376. package/src/markdown/MarkdownText.tsx +218 -0
  377. package/src/markdown/cjkFriendlyStrong.ts +83 -0
  378. package/src/markdown/copy-tex.ts +53 -0
  379. package/src/markdown/diff-fence.ts +212 -0
  380. package/src/markdown/file-link.ts +45 -0
  381. package/src/markdown/highlight.ts +689 -0
  382. package/src/markdown/incremental.ts +360 -0
  383. package/src/markdown/katex.tsx +90 -0
  384. package/src/markdown/local-image-syntax.ts +29 -0
  385. package/src/markdown/mathCompatibility.ts +349 -0
  386. package/src/markdown/parse.ts +49 -0
  387. package/src/markdown/plain-text.ts +121 -0
  388. package/src/markdown/quote-text.ts +10 -0
  389. package/src/markdown/render.tsx +834 -0
  390. package/src/markdown/useViewportHighlighting.ts +72 -0
  391. package/src/markdown/windows-path-destinations.ts +34 -0
  392. package/src/menu-submenu-position.ts +20 -0
  393. package/src/overlay-top-margin.ts +18 -0
  394. package/src/plugin-artwork.tsx +110 -0
  395. package/src/pointer-grace.ts +47 -0
  396. package/src/rank-by-name.ts +93 -0
  397. package/src/relative-time.ts +36 -0
  398. package/src/settings-form/SettingsForm.module.css +53 -0
  399. package/src/settings-form/SettingsForm.tsx +74 -0
  400. package/src/settings-form/fields.module.css +153 -0
  401. package/src/settings-form/fields.tsx +151 -0
  402. package/src/settings-form/form-model.ts +393 -0
  403. package/src/tooltip-placement.ts +60 -0
  404. package/src/use-clipboard-copy.ts +44 -0
  405. package/src/useAnchoredMaxHeight.ts +45 -0
  406. package/src/useDismissOnOutsidePointer.ts +34 -0
  407. package/src/useMenuSubmenu.ts +182 -0
  408. package/src/useModalLayer.ts +108 -0
  409. package/src/useRowDragPreview.ts +76 -0
  410. package/src/user-text.module.css +46 -0
  411. package/src/user-text.tsx +67 -0
  412. package/lib/types/useAnchoredPosition.d.ts +0 -36
package/src/ansi.ts ADDED
@@ -0,0 +1,447 @@
1
+ // Strip control sequences that anser does not consume before resolving SGR
2
+ // runs, so they cannot reach the DOM as literal characters.
3
+
4
+ import Anser from 'anser'
5
+ import type { CSSProperties } from 'react'
6
+
7
+ /**
8
+ * The subset of one anser JSON chunk this module reads. anser's own types
9
+ * declare `fg`/`bg` as `string`, but its parser leaves them `null` for a run
10
+ * that sets no color, so the null is spelled out here.
11
+ */
12
+ interface AnsiChunk {
13
+ /** Run text with its SGR codes already removed. */
14
+ content: string
15
+ /** Foreground as an `r, g, b` triple, or null when the run sets none. */
16
+ fg: string | null
17
+ /** Background as an `r, g, b` triple, or null when the run sets none. */
18
+ bg: string | null
19
+ /** SGR attributes in effect for the run, in the order they were declared. */
20
+ decorations: readonly string[]
21
+ }
22
+
23
+ /** One run of terminal text; `style` is undefined for text that carries no SGR state. */
24
+ export interface AnsiSpan {
25
+ /** The run's plain text, free of escape sequences and newlines. */
26
+ text: string
27
+ /** Resolved inline style, or undefined when the run needs no wrapper. */
28
+ style: CSSProperties | undefined
29
+ }
30
+
31
+ /** The spans of one output line, in order. */
32
+ export type AnsiLine = readonly AnsiSpan[]
33
+
34
+ /**
35
+ * The 8/16 basic ANSI colors, keyed by the whitespace-free `r,g,b` triple
36
+ * anser emits for them, mapped onto the theme tokens that carry the same
37
+ * semantic. Black and white both resolve to the primary label color so text
38
+ * stays legible under either theme instead of matching the surface it sits
39
+ * on; bright black takes the tertiary label color (the muted-gray role).
40
+ * Cyan and bright cyan take two static blues: the design system has no cyan,
41
+ * and anser's literal bright cyan is unreadable on the light theme's code
42
+ * surface. Magenta has no token equivalent and falls through to anser's
43
+ * literal rgb, as do all 256-palette and truecolor values.
44
+ */
45
+ const TOKEN_BY_BASIC_RGB: Record<string, string> = {
46
+ '0,0,0': 'var(--dsw-alias-label-primary)',
47
+ '255,255,255': 'var(--dsw-alias-label-primary)',
48
+ '85,85,85': 'var(--dsw-alias-label-tertiary)',
49
+ '187,0,0': 'var(--dsw-alias-state-error-primary)',
50
+ '255,85,85': 'var(--dsw-alias-state-error-secondary)',
51
+ '0,187,0': 'var(--dsw-alias-state-success-primary)',
52
+ '0,255,0': 'var(--dsw-alias-state-success-secondary)',
53
+ '187,187,0': 'var(--dsw-alias-state-warn-primary)',
54
+ '255,255,85': 'var(--dsw-alias-state-warn-secondary)',
55
+ '0,0,187': 'var(--dsw-alias-state-business-primary)',
56
+ '85,85,255': 'var(--dsw-static-blue-400)',
57
+ '0,187,187': 'var(--dsw-static-blue-600)',
58
+ '85,255,255': 'var(--dsw-static-blue-500)',
59
+ }
60
+
61
+ /**
62
+ * CSS for each SGR attribute anser reports. `blink` is deliberately absent —
63
+ * animated text is not reproduced. `reverse` never arrives here: anser
64
+ * consumes it by swapping the run's foreground and background. Underline and
65
+ * strikethrough share `textDecoration`, so in a run declaring both, the
66
+ * later declaration wins.
67
+ */
68
+ const STYLE_BY_DECORATION: Record<string, CSSProperties | undefined> = {
69
+ bold: { fontWeight: 700 },
70
+ dim: { opacity: 0.7 },
71
+ italic: { fontStyle: 'italic' },
72
+ underline: { textDecoration: 'underline' },
73
+ strikethrough: { textDecoration: 'line-through' },
74
+ hidden: { visibility: 'hidden' },
75
+ }
76
+
77
+ /** OSC strings (window title, hyperlinks), with or without their terminator. */
78
+ const OSC_SEQUENCE = /\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)?/g
79
+
80
+ /** Escape sequences other than CSI: charset selection, single-shift, reset. */
81
+ const NON_CSI_ESCAPE = /\u001b(?!\[)[\u0020-\u002f]*[\u0030-\u007e]?/g
82
+
83
+ /**
84
+ * C0 controls with no display meaning here. Tab, newline, backspace and ESC
85
+ * survive: the first two for layout, backspace for the cursor replay, ESC
86
+ * for anser's CSI split.
87
+ */
88
+ const INERT_CONTROL = /[\u0000-\u0007\u000b-\u001a\u001c-\u001f\u007f]/g
89
+
90
+ /**
91
+ * Lines whose cursor movements have to be replayed: a carriage return, a
92
+ * backspace, or an erase-in-line. The erase pattern matches the SAME CSI shape
93
+ * `replayLine` parses (parameters may carry `;` and intermediate bytes), so a
94
+ * form like `\x1b[1;2K` cannot slip past this guard and skip its own erase.
95
+ */
96
+ const NEEDS_REPLAY = /\r|\u0008|\u001b\[[\u0030-\u003f]*[\u0020-\u002f]*K/
97
+
98
+ /** SGR sequences alone, for folding state through a line that needs no replay. */
99
+ const SGR_SEQUENCE = /\u001b\[([\u0030-\u003f]*)[\u0020-\u002f]*m/g
100
+
101
+ /** Terminal tab stop width; a tab advances to the next multiple of this. */
102
+ const TAB_WIDTH = 8
103
+
104
+ /**
105
+ * Combining marks and other zero-width code points: a terminal advances no
106
+ * column for them, so `e` + U+0301 occupies one cell and a two-column redraw
107
+ * covers both code points.
108
+ */
109
+ const ZERO_WIDTH = /^[\p{Mn}\p{Me}\p{Cf}\u200b-\u200f\u2060]$/u
110
+
111
+ /**
112
+ * Characters a terminal advances two columns for: CJK scripts, fullwidth forms,
113
+ * CJK punctuation, and characters with emoji presentation. Text-presentation
114
+ * symbols (`\u2713`, `\u26a0` and the rest of U+2600-U+27BF) are ONE column and
115
+ * must stay out of this set.
116
+ */
117
+ const WIDE_CHAR = new RegExp(
118
+ '\\p{Script=Han}|\\p{Script=Hiragana}|\\p{Script=Katakana}|\\p{Script=Hangul}'
119
+ // Emoji presentation only: the U+2600-U+27BF symbol block is mostly SINGLE
120
+ // width — `\u2713` (the check every progress line writes, this fixture
121
+ // included) advances one column, verified against a real terminal, so taking
122
+ // the whole block as wide misaligned exactly the output this card exists for.
123
+ + '|\\p{Emoji_Presentation}'
124
+ + '|[\\uff01-\\uff60\\u3000-\\u303e]',
125
+ 'u',
126
+ )
127
+
128
+ /**
129
+ * Whether a character occupies two terminal columns (CJK, fullwidth forms,
130
+ * emoji). Covers the ranges a command's output realistically carries; a
131
+ * narrower guess would misalign the columns this card exists to preserve.
132
+ * @param char - one character from the output.
133
+ * @returns true when the terminal advances two columns for it.
134
+ */
135
+ function isWide(char: string): boolean {
136
+ const code = char.codePointAt(0)
137
+ if (code === undefined || code < 0x1100) return false
138
+ return WIDE_CHAR.test(char)
139
+ }
140
+
141
+ /**
142
+ * A cell's graphic state, normalized. Held as fields rather than as the raw
143
+ * sequence history because a terminal tracks CURRENT state, not a transcript:
144
+ * accumulating sequences made each state boundary re-emit the whole chain, so
145
+ * output that switches color without a full reset emitted O(n^2) characters
146
+ * (3200 such cells produced 25 MB and eventually a `RangeError`). It also makes
147
+ * the attribute closers every chalk-based tool writes — `39`, `49`, `22`, `23`,
148
+ * `24`, `27`, `29` — actually close their attribute instead of appending to it.
149
+ */
150
+ interface SgrState {
151
+ fg: string
152
+ bg: string
153
+ /** Attribute parameters in force, e.g. `1` (bold) or `4` (underline). */
154
+ attrs: readonly string[]
155
+ }
156
+
157
+ /** The default state: no color, no attributes. */
158
+ const SGR_NONE: SgrState = { fg: '', bg: '', attrs: [] }
159
+
160
+ /** Attribute closers, mapped to the opener parameters each one turns off. */
161
+ const ATTR_CLOSERS: Record<string, readonly string[]> = {
162
+ 22: ['1', '2'], 23: ['3'], 24: ['4'], 25: ['5', '6'], 27: ['7'], 28: ['8'], 29: ['9'],
163
+ }
164
+
165
+ /**
166
+ * Fold one SGR sequence's parameters into the state it produces.
167
+ * @param state - state in force before the sequence.
168
+ * @param params - the sequence's raw parameter string (`31`, `1;4`, `38;5;208`).
169
+ * @returns the state the sequence leaves in force.
170
+ */
171
+ function foldSgr(state: SgrState, params: string): SgrState {
172
+ const codes = params === '' ? ['0'] : params.split(';')
173
+ let next = state
174
+ for (let index = 0; index < codes.length; index++) {
175
+ const code = String(codes[index])
176
+ if (code === '' || code === '0') { next = SGR_NONE; continue }
177
+ // Extended color: `38;5;N` / `38;2;R;G;B` and the `48` background pair
178
+ // consume their own arguments, so they are taken whole.
179
+ if (code === '38' || code === '48') {
180
+ const kind = codes[index + 1] ?? ''
181
+ const span = kind === '2' ? 4 : kind === '5' ? 2 : 0
182
+ const value = codes.slice(index, index + span + 1).join(';')
183
+ next = code === '38' ? { ...next, fg: value } : { ...next, bg: value }
184
+ index += span
185
+ continue
186
+ }
187
+ const closes = ATTR_CLOSERS[code]
188
+ if (closes !== undefined) {
189
+ next = { ...next, attrs: next.attrs.filter(attr => !closes.includes(attr)) }
190
+ continue
191
+ }
192
+ const numeric = Number(code)
193
+ if (code === '39') { next = { ...next, fg: '' }; continue }
194
+ if (code === '49') { next = { ...next, bg: '' }; continue }
195
+ if ((numeric >= 30 && numeric <= 37) || (numeric >= 90 && numeric <= 97)) { next = { ...next, fg: code }; continue }
196
+ if ((numeric >= 40 && numeric <= 47) || (numeric >= 100 && numeric <= 107)) { next = { ...next, bg: code }; continue }
197
+ if (!next.attrs.includes(code)) next = { ...next, attrs: [...next.attrs, code] }
198
+ }
199
+ return next
200
+ }
201
+
202
+ /**
203
+ * Render a state as the one canonical sequence that establishes it from the
204
+ * default, so a boundary emits a bounded string no matter how the state was
205
+ * reached.
206
+ * @param state - the state to open.
207
+ * @returns the SGR sequence, or the empty string for the default state.
208
+ */
209
+ function openSgr(state: SgrState): string {
210
+ const codes = [...state.attrs]
211
+ if (state.fg !== '') codes.push(state.fg)
212
+ if (state.bg !== '') codes.push(state.bg)
213
+ return codes.length === 0 ? '' : `\u001b[${codes.join(';')}m`
214
+ }
215
+
216
+ /** Whether two states are the same, so a boundary is only emitted on a change. */
217
+ function sameSgr(a: SgrState, b: SgrState): boolean {
218
+ return a.fg === b.fg && a.bg === b.bg && a.attrs.length === b.attrs.length
219
+ && a.attrs.every((attr, index) => attr === b.attrs[index])
220
+ }
221
+
222
+ /**
223
+ * Replay one line's cursor movements the way a terminal paints it, into a
224
+ * column buffer. Carriage return and backspace only MOVE the cursor — neither
225
+ * erases anything — so what a reader sees is whatever each column last had
226
+ * written to it. That distinction is the whole point of doing this as a buffer
227
+ * rather than as string surgery: `100%\rOK` shows `OK0%` because the redraw is
228
+ * shorter than the frame beneath it, and a trailing `abc\b` still shows `abc`
229
+ * because nothing ever overwrote the `c`.
230
+ *
231
+ * A CSI sequence occupies no column; it changes the state that the NEXT writes
232
+ * are stamped with, which is how a terminal stores color per cell. `red bad`
233
+ * then three backspaces then `ok` therefore shows `okd` with the `d` still red:
234
+ * `ok` overwrote two cells and the third kept the state it was written with.
235
+ * The columns are re-emitted as runs, so anser sees that same styling.
236
+ * @param line - one output line, still carrying its CSI sequences.
237
+ * @param entrySgr - SGR state in force when the line begins, since a newline
238
+ * does not reset it.
239
+ * @returns the line as the terminal would have it after every movement, plus the
240
+ * SGR state at its end for the next line to enter with.
241
+ */
242
+ function replayLine(line: string, entrySgr: SgrState): { text: string; sgr: SgrState } {
243
+ // Same shape anser splits on, so a sequence is one unit here as well.
244
+ const csi = /\u001b\[([\u0030-\u003f]*)[\u0020-\u002f]*([\u0040-\u007e])/g
245
+ /** Per column: the state in force when it was written, and its character. */
246
+ const columns: (Cell | undefined)[] = []
247
+ let cursor = 0
248
+ // State is tracked exactly as a terminal tracks it: each cell is stamped with
249
+ // whatever was in force at the moment of the write, so a later redraw cannot
250
+ // restyle the cells it does not reach. It enters carrying the previous line's
251
+ // state, since a newline does not reset it.
252
+ let sgr = entrySgr
253
+ let at = 0
254
+
255
+ /** Clear a cell and, for a wide pair, its partner: a terminal erases both. */
256
+ const clear = (index: number, fill: string): void => {
257
+ const cell = columns[index]
258
+ if (cell?.spacer === true && index > 0) columns[index - 1] = { sgr, char: fill }
259
+ else if (cell !== undefined && isWide(cell.char) && columns[index + 1]?.spacer === true) {
260
+ columns[index + 1] = { sgr, char: fill }
261
+ }
262
+ columns[index] = { sgr, char: fill }
263
+ }
264
+
265
+ const consume = (chunk: string): void => {
266
+ for (const char of chunk) {
267
+ if (char === '\r') { cursor = 0; continue }
268
+ if (char === '\u0008') { cursor = Math.max(0, cursor - 1); continue }
269
+ if (char === '\t') {
270
+ // A tab advances to the next 8-column stop, leaving the cells it skips
271
+ // as they were — which is how a redraw can leave a tabbed column
272
+ // standing. Column alignment is the whole point of this card.
273
+ const stop = cursor + TAB_WIDTH - (cursor % TAB_WIDTH)
274
+ for (; cursor < stop; cursor++) columns[cursor] ??= { sgr, char: ' ' }
275
+ continue
276
+ }
277
+ if (ZERO_WIDTH.test(char)) {
278
+ // No column of its own: it attaches to the cell already written, so a
279
+ // redraw that covers that cell covers the mark with it. With no cell to
280
+ // attach to (line start, or straight after a redraw to column 0) a
281
+ // terminal shows nothing rather than a lone accent.
282
+ const base = cursor > 0 ? columns[cursor - 1] : undefined
283
+ if (base !== undefined) columns[cursor - 1] = { sgr: base.sgr, char: base.char + char }
284
+ continue
285
+ }
286
+ // Writing over either half of a wide pair blanks the other half, since a
287
+ // terminal cannot leave one cell of a two-cell glyph standing.
288
+ clear(cursor, ' ')
289
+ columns[cursor] = { sgr, char }
290
+ cursor++
291
+ // A wide character occupies two columns; the trailing one is a spacer,
292
+ // marked so that overwriting the lead cell leaves a blank behind instead
293
+ // of closing the gap and shifting everything after it left.
294
+ if (isWide(char)) { columns[cursor] = { sgr, char: '', spacer: true }; cursor++ }
295
+ }
296
+ }
297
+
298
+ for (const match of line.matchAll(csi)) {
299
+ consume(line.slice(at, match.index))
300
+ at = match.index + match[0].length
301
+ // Both groups are mandatory in the pattern, so destructuring types them as
302
+ // strings without a fallback that could never run.
303
+ const params = String(match[1])
304
+ const final = String(match[2])
305
+ if (final === 'K') {
306
+ // Erase in line: the fixed companion of `\r` in every spinner and progress
307
+ // bar. Without it a shorter redraw leaves the previous frame's tail
308
+ // standing, which is text the terminal never showed. `1` blanks from the
309
+ // line start THROUGH the cursor column (inclusive, per the CSI spec)
310
+ // rather than dropping those cells, since the cursor does not move and a
311
+ // later write can still land past them. Only the FIRST parameter selects
312
+ // the mode; a terminal ignores the rest (`1;2K` erases exactly as `1K`).
313
+ const mode = String(params.split(';')[0])
314
+ if (mode === '1') for (let index = 0; index <= cursor; index++) clear(index, ' ')
315
+ else columns.length = mode === '2' ? 0 : cursor
316
+ continue
317
+ }
318
+ // Only SGR carries graphic state; every other final byte is a cursor or
319
+ // erase action that must not affect a cell's style.
320
+ if (final !== 'm') continue
321
+ sgr = foldSgr(sgr, params)
322
+ }
323
+ consume(line.slice(at))
324
+
325
+ // Re-emit the columns, opening a run only where its state changes, so anser
326
+ // sees the same styling a terminal shows. Each boundary emits ONE canonical
327
+ // sequence for the state it opens, which is what keeps the output linear in
328
+ // the number of cells however the state was reached.
329
+ let out = ''
330
+ let active = entrySgr
331
+ for (let index = 0; index < columns.length; index++) {
332
+ const column = columns[index] ?? { sgr: SGR_NONE, char: ' ' }
333
+ if (!sameSgr(column.sgr, active)) {
334
+ if (!sameSgr(active, SGR_NONE)) out += '\u001b[0m'
335
+ out += openSgr(column.sgr)
336
+ active = column.sgr
337
+ }
338
+ // A spacer still holds its column. While its lead cell survives, the wide
339
+ // glyph spans both and the spacer emits nothing; once a later write replaced
340
+ // that lead, the terminal blanks the spacer instead of closing the gap, so
341
+ // emitting nothing would shift everything after it one column left.
342
+ const leadIntact = index > 0 && isWide(columns[index - 1]?.char ?? '')
343
+ out += column.spacer === true && !leadIntact ? ' ' : column.char
344
+ }
345
+ // Converge to the state the SCAN ended in, not the last written cell's: a
346
+ // sequence after the final write (the `\x1b[0m` closing a colored line) changes
347
+ // no cell yet still ends the run, and it has to reach both the DOM and the
348
+ // next line. Without this a line ending in a reset leaked its color onward.
349
+ if (!sameSgr(active, sgr)) {
350
+ if (!sameSgr(active, SGR_NONE)) out += '\u001b[0m'
351
+ out += openSgr(sgr)
352
+ }
353
+ return { text: out, sgr }
354
+ }
355
+
356
+ /** One replayed column: the state it was written with, and its character. */
357
+ interface Cell {
358
+ sgr: SgrState
359
+ char: string
360
+ /** The trailing half of a wide character's two-column pair. */
361
+ spacer?: boolean
362
+ }
363
+
364
+ /**
365
+ * Replay every line's cursor movements. A `\r` that only terminates a CRLF line
366
+ * is dropped first, so those lines keep their text instead of being redrawn onto
367
+ * themselves. SGR state threads across lines: a newline does not reset it, so a
368
+ * run opened before a redraw still colors the lines after it.
369
+ * @param text - output text, already free of OSC and non-CSI escapes.
370
+ * @returns the text with each line painted as the terminal would.
371
+ */
372
+ function applyCursorMovements(text: string): string {
373
+ const replayed: string[] = []
374
+ let sgr = SGR_NONE
375
+ for (const raw of text.split('\n')) {
376
+ const line = raw.replace(/\r+$/, '')
377
+ if (NEEDS_REPLAY.test(line)) {
378
+ const result = replayLine(line, sgr)
379
+ replayed.push(result.text)
380
+ sgr = result.sgr
381
+ continue
382
+ }
383
+ // No cursor movement: the line needs no column buffer, and painting one
384
+ // would allocate a cell per character of output this card never redraws —
385
+ // an `ls -R` or a 5k-line log. Only its own SGR has to be folded, so a later
386
+ // line that DOES replay enters with the right state.
387
+ replayed.push(line)
388
+ for (const match of line.matchAll(SGR_SEQUENCE)) sgr = foldSgr(sgr, String(match[1]))
389
+ }
390
+ return replayed.join('\n')
391
+ }
392
+
393
+ /**
394
+ * Remove every escape sequence and control character that carries no color,
395
+ * leaving CSI sequences for anser and `\n`/`\t` for layout. Cursor movements
396
+ * (carriage return, backspace) replay first, since their effect on the visible
397
+ * text must land before the characters that expressed them are dropped.
398
+ * @param text - raw command output.
399
+ * @returns text whose only remaining escapes are CSI sequences.
400
+ */
401
+ function sanitize(text: string): string {
402
+ const escaped = text.replace(OSC_SEQUENCE, '').replace(NON_CSI_ESCAPE, '')
403
+ return applyCursorMovements(escaped).replace(INERT_CONTROL, '')
404
+ }
405
+
406
+ /**
407
+ * Resolve one run's colors and decorations.
408
+ * @param chunk - the anser chunk to style.
409
+ * @returns the run's inline style, or undefined when it carries no SGR state.
410
+ */
411
+ function resolveStyle(chunk: AnsiChunk): CSSProperties | undefined {
412
+ const style: CSSProperties = {}
413
+ const background = chunk.bg === null ? undefined : `rgb(${chunk.bg})`
414
+ if (background !== undefined) style.backgroundColor = background
415
+ if (chunk.fg !== null) {
416
+ const literal = `rgb(${chunk.fg})`
417
+ // A run that paints its own background keeps anser's literal pair so the
418
+ // authored foreground/background contrast survives; a foreground-only run
419
+ // maps onto a theme token, which adapts to light and dark surfaces.
420
+ style.color = background === undefined
421
+ ? TOKEN_BY_BASIC_RGB[chunk.fg.replace(/\s+/g, '')] ?? literal
422
+ : literal
423
+ }
424
+ for (const decoration of chunk.decorations) Object.assign(style, STYLE_BY_DECORATION[decoration])
425
+ return Object.keys(style).length === 0 ? undefined : style
426
+ }
427
+
428
+ /**
429
+ * Parse command output into styled spans grouped by line.
430
+ * @param text - raw output text, which may contain ANSI escape sequences.
431
+ * @returns one entry per output line (always at least one, possibly empty).
432
+ */
433
+ export function parseAnsiLines(text: string): AnsiLine[] {
434
+ let current: AnsiSpan[] = []
435
+ const lines: AnsiSpan[][] = [current]
436
+ for (const chunk of Anser.ansiToJson(sanitize(text), { json: true, remove_empty: true })) {
437
+ const style = resolveStyle(chunk)
438
+ for (const [index, part] of chunk.content.split('\n').entries()) {
439
+ if (index > 0) {
440
+ current = []
441
+ lines.push(current)
442
+ }
443
+ if (part !== '') current.push({ text: part, style })
444
+ }
445
+ }
446
+ return lines
447
+ }
@@ -0,0 +1,47 @@
1
+ // Host clipboard write shared by Web UI copy controls. Success feedback stays
2
+ // with each control; this helper only reports whether the host accepted a write.
3
+
4
+ /**
5
+ * Write text to the host clipboard, preferring the async Clipboard API and
6
+ * falling back to `execCommand('copy')` on hosts (jsdom, insecure contexts)
7
+ * that omit it.
8
+ * @param text - the exact text to place on the clipboard.
9
+ * @returns true only when the host accepted the write.
10
+ */
11
+ export async function writeClipboard(text: string): Promise<boolean> {
12
+ // lib.dom types clipboard non-optional, but insecure contexts omit it —
13
+ // that runtime gap is exactly what this guard detects.
14
+ /* oxlint-disable-next-line typescript/no-unnecessary-condition */
15
+ if (navigator.clipboard?.writeText) {
16
+ try {
17
+ await navigator.clipboard.writeText(text)
18
+ return true
19
+ } catch {
20
+ // Denied permissions / iframe policy — do not claim success.
21
+ return false
22
+ }
23
+ }
24
+ // jsdom and older hosts: best-effort execCommand path when present.
25
+ // execCommand('copy') is the only clipboard fallback where the async API
26
+ // is missing; deprecated but deliberately retained.
27
+ /* oxlint-disable typescript/no-deprecated */
28
+ const exec = typeof document.execCommand === 'function'
29
+ ? document.execCommand.bind(document)
30
+ : undefined
31
+ if (exec === undefined) return false
32
+ const el = document.createElement('textarea')
33
+ el.value = text
34
+ el.setAttribute('readonly', '')
35
+ el.style.position = 'fixed'
36
+ el.style.left = '-9999px'
37
+ document.body.appendChild(el)
38
+ el.select()
39
+ try {
40
+ return exec('copy')
41
+ } catch {
42
+ return false
43
+ } finally {
44
+ el.remove()
45
+ }
46
+ /* oxlint-enable typescript/no-deprecated */
47
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "version": 1,
3
+ "owner": "DeepSeek Harness product design",
4
+ "sources": [
5
+ {
6
+ "name": "square-icons-export",
7
+ "kind": "internal-design-export",
8
+ "sha256": "9b90bec3e20d99f179126d0981da01bcffa14060a284a844a0073472919e230e",
9
+ "icons": [
10
+ "angular",
11
+ "c",
12
+ "clojure",
13
+ "cmake",
14
+ "cpp",
15
+ "csharp",
16
+ "css",
17
+ "dart",
18
+ "docker",
19
+ "elixir",
20
+ "env",
21
+ "erlang",
22
+ "flutter",
23
+ "git",
24
+ "go",
25
+ "graphql",
26
+ "haskell",
27
+ "ini",
28
+ "java",
29
+ "javascript",
30
+ "json",
31
+ "kotlin",
32
+ "lua",
33
+ "makefile",
34
+ "node",
35
+ "objective-c",
36
+ "perl",
37
+ "php",
38
+ "powershell",
39
+ "protobuf",
40
+ "python",
41
+ "r",
42
+ "react",
43
+ "ruby",
44
+ "rust",
45
+ "scala",
46
+ "shell",
47
+ "solidity",
48
+ "sql",
49
+ "svelte",
50
+ "toml",
51
+ "typescript",
52
+ "vue",
53
+ "wasm",
54
+ "xml",
55
+ "yaml",
56
+ "zig"
57
+ ]
58
+ },
59
+ {
60
+ "name": "swift-square-icon",
61
+ "kind": "internal-design-export",
62
+ "sha256": "2afa6d5db27f6f9da5a2011613410891ef904f55420187bb7cc88a350daaa0bf",
63
+ "icons": [
64
+ "swift"
65
+ ]
66
+ }
67
+ ],
68
+ "excluded": [
69
+ "markdown"
70
+ ]
71
+ }