@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
@@ -0,0 +1,71 @@
1
+ import type { IconProps } from './props.ts'
2
+
3
+ interface WeightedArtworkProps extends IconProps {
4
+ strokeWidth: number
5
+ }
6
+
7
+ /**
8
+ * Render conversation geometry — the chat bubble around two text lines —
9
+ * for session reference icons; it matches the `queue-outline` product glyph.
10
+ * @param props - Size, optional CSS class, and inherited stroke width.
11
+ * @returns The decorative SVG artwork.
12
+ */
13
+ export const ChatLinesOutlineArtwork = ({ size = 16, className, strokeWidth }: WeightedArtworkProps) => (
14
+ <svg width={size} height={size} className={className} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" strokeWidth={strokeWidth}>
15
+ <path d="M5 6.75H11" stroke="currentColor" />
16
+ <path d="M5 9H8" stroke="currentColor" />
17
+ <path d="M2.37067 11.2497C1.5872 9.89252 1.32042 8.29798 1.61945 6.7597C1.91847 5.22141 2.76317 3.84293 3.99801 2.87809C5.23285 1.91325 6.7747 1.427 8.33964 1.50888C9.90458 1.59076 11.3873 2.23526 12.5147 3.32369C13.6422 4.41232 14.3384 5.8717 14.4751 7.43304C14.6118 8.99438 14.1797 10.5525 13.2585 11.8205C12.3372 13.0885 10.9889 13.9809 9.4617 14.3334C8.18666 14.6277 6.8587 14.529 5.64964 14.0601C5.17095 13.8745 4.76937 13.4929 4.26509 13.3963C3.67389 13.2832 2.95232 13.5595 2.0377 14.3334" stroke="currentColor" />
18
+ </svg>
19
+ )
20
+
21
+ /**
22
+ * Render globe geometry for link icons; it matches the `globe-outline` product glyph.
23
+ * @param props - Size, optional CSS class, and inherited stroke width.
24
+ * @returns The decorative SVG artwork.
25
+ */
26
+ export const GlobeOutlineArtwork = ({ size = 14, className, strokeWidth }: WeightedArtworkProps) => (
27
+ <svg width={size} height={size} className={className} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" strokeWidth={strokeWidth}>
28
+ <path d="M7.99986 14.0887C11.3626 14.0887 14.0886 11.3627 14.0886 7.99998C14.0886 4.63727 11.3626 1.91125 7.99986 1.91125C4.63715 1.91125 1.91113 4.63727 1.91113 7.99998C1.91113 11.3627 4.63715 14.0887 7.99986 14.0887Z" stroke="currentColor" />
29
+ <path d="M2.34619 8H13.6538" stroke="currentColor" strokeLinecap="square" />
30
+ <path d="M7.99976 14.0889C9.23509 14.0889 10.1743 11.3629 10.1743 8.00006C10.1743 4.63739 9.23509 1.91138 7.99976 1.91138" stroke="currentColor" />
31
+ <path d="M7.99973 14.0889C6.76445 14.0889 5.8252 11.3629 5.8252 8.00006C5.8252 4.63739 6.76445 1.91138 7.99973 1.91138" stroke="currentColor" />
32
+ </svg>
33
+ )
34
+
35
+ /**
36
+ * Render code-bracket geometry for link icons; it matches the `inspect-outline` product glyph.
37
+ * @param props - Size, optional CSS class, and inherited stroke width.
38
+ * @returns The decorative SVG artwork.
39
+ */
40
+ export const CodeBracketsArtwork = ({ size = 14, className, strokeWidth }: WeightedArtworkProps) => (
41
+ <svg width={size} height={size} className={className} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" strokeWidth={strokeWidth}>
42
+ <path d="M4.67398 4.25061L1.36094 7.86484C1.29085 7.9413 1.29085 8.05866 1.36094 8.13513L4.67398 11.7494" stroke="currentColor" />
43
+ <path d="M11.3262 4.25061L14.6392 7.86484C14.7093 7.9413 14.7093 8.05866 14.6392 8.13513L11.3262 11.7494" stroke="currentColor" />
44
+ <path d="M9.56222 3.62573L6.43774 12.3743" stroke="currentColor" />
45
+ </svg>
46
+ )
47
+
48
+ /**
49
+ * Render document-browse geometry for reference icons; it matches the `browse-outline` product glyph.
50
+ * @param props - Size, optional CSS class, and inherited stroke width.
51
+ * @returns The decorative SVG artwork.
52
+ */
53
+ export const BrowseOutlineArtwork = ({ size = 16, className, strokeWidth }: WeightedArtworkProps) => (
54
+ <svg width={size} height={size} className={className} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" strokeWidth={strokeWidth}>
55
+ <path d="M4.9375 5.90295H11.0625" stroke="currentColor" />
56
+ <path d="M4.9375 9.02991H8.27841" stroke="currentColor" />
57
+ <path d="M12.5 1.32617C13.3039 1.32617 14 1.95171 14 2.77637V13.2246C13.9996 14.0489 13.3036 14.6738 12.5 14.6738H3.5C2.69637 14.6738 2.00042 14.0489 2 13.2246V2.77637C2 1.95171 2.69613 1.32617 3.5 1.32617H12.5ZM3.5 2.32617C3.1993 2.32617 3 2.55186 3 2.77637V13.2246C3.00044 13.4489 3.19963 13.6738 3.5 13.6738H12.5C12.8004 13.6738 12.9996 13.4489 13 13.2246V2.77637C13 2.55186 12.8007 2.32617 12.5 2.32617H3.5Z" fill="currentColor" />
58
+ </svg>
59
+ )
60
+
61
+ /**
62
+ * Render closed-folder geometry for reference and link icons; it matches the `folder-close` product glyph.
63
+ * @param props - Size, optional CSS class, and inherited stroke width.
64
+ * @returns The decorative SVG artwork.
65
+ */
66
+ export const FolderCloseArtwork = ({ size = 16, className, strokeWidth }: WeightedArtworkProps) => (
67
+ <svg width={size} height={size} className={className} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" strokeWidth={strokeWidth}>
68
+ <path d="M1.50439 3.11059C1.50439 2.55831 1.95211 2.1106 2.50439 2.1106H5.43389C5.67773 2.1106 5.91318 2.19969 6.09593 2.36113L7.71649 3.79265C7.89924 3.95409 8.1347 4.04319 8.3785 4.04319H13.4958C14.0481 4.04319 14.4958 4.4909 14.4958 5.04319V12.8894C14.4958 13.4417 14.0481 13.8894 13.4958 13.8894H2.50439C1.95211 13.8894 1.50439 13.4417 1.50439 12.8894V4.04319V3.11059Z" stroke="currentColor" />
69
+ <path d="M3.63501 7.66614H12.3647" stroke="currentColor" />
70
+ </svg>
71
+ )
@@ -0,0 +1,84 @@
1
+ /** Image gestures delegate file preparation and transport to the owning feature. */
2
+ import { useCallback, useEffect, useMemo, useRef, type DragEvent, type MouseEvent, type PointerEvent, type ImgHTMLAttributes } from 'react'
3
+ import type { FileDragActions, FileDragSource, PreparedFileDrag } from './file-drag-actions.ts'
4
+
5
+ interface Preparation { abort: AbortController; prepared?: PreparedFileDrag; failed: boolean }
6
+ type ImageGestures = Required<Pick<ImgHTMLAttributes<HTMLImageElement>,
7
+ 'onPointerEnter' | 'onPointerDown' | 'onPointerLeave' | 'onDragStart' | 'onDragEnd' | 'onClickCapture'>>
8
+
9
+ /**
10
+ * Prepare resource-backed images on primary press, other images also on hover; release on leave.
11
+ * Releasing inside the image retains preparation for the next gesture; cancelled drags never start late.
12
+ * @param actions - stable file preparation and error callbacks.
13
+ * @param src - displayed image URL.
14
+ * @param name - proposed export name.
15
+ * @param original - already loaded original bytes.
16
+ * @param resourceAddress - verifiable reference to an unmodified local original.
17
+ * @returns image gesture handlers; overflowing images remain owned by their pan handler.
18
+ */
19
+ export function useImageDrag(
20
+ actions: FileDragActions, src: string, name: string, original?: File, resourceAddress?: string,
21
+ ): ImageGestures {
22
+ const source = useMemo<FileDragSource>(() => original === undefined
23
+ ? { kind: 'url', url: src, name, mediaType: '', resourceAddress }
24
+ : { kind: 'blob', blob: original, name, mediaType: original.type, resourceAddress }, [src, name, original, resourceAddress])
25
+ const state = useRef<Preparation>()
26
+ const dragged = useRef(false)
27
+ const release = useCallback((): void => {
28
+ const previous = state.current
29
+ state.current = undefined
30
+ previous?.abort.abort()
31
+ previous?.prepared?.release()
32
+ }, [])
33
+ useEffect(() => release, [release, source, actions])
34
+ const prepare = useCallback((image: HTMLImageElement): void => {
35
+ if (src === '' || state.current !== undefined) return
36
+ const current: Preparation = { abort: new AbortController(), failed: false }
37
+ state.current = current
38
+ window.addEventListener('pointerup', (event) => {
39
+ if (event.target !== image) release()
40
+ }, { signal: current.abort.signal })
41
+ window.addEventListener('blur', release, { once: true, signal: current.abort.signal })
42
+ void actions.prepare(source, current.abort.signal).then((prepared) => {
43
+ if (current.abort.signal.aborted) prepared.release()
44
+ else current.prepared = prepared
45
+ }, (_error: unknown) => {
46
+ // Speculation stays quiet; only a later failed gesture presents retry feedback.
47
+ current.failed = true
48
+ })
49
+ }, [src, actions, source, release])
50
+ const intent = useCallback((event: PointerEvent<HTMLImageElement>): void => {
51
+ if (!event.defaultPrevented && event.currentTarget.draggable
52
+ && (resourceAddress === undefined || event.type === 'pointerdown')) prepare(event.currentTarget)
53
+ }, [prepare, resourceAddress])
54
+ const onDragStart = useCallback((event: DragEvent<HTMLImageElement>): void => {
55
+ if (event.defaultPrevented || src === '') return
56
+ dragged.current = true
57
+ const current = state.current
58
+ if (current?.prepared !== undefined) {
59
+ if (!current.prepared.start(event.dataTransfer, event.currentTarget)) { event.preventDefault(); release() }
60
+ return
61
+ }
62
+ const url = new URL(src, location.href)
63
+ if (original === undefined && (url.protocol === 'https:' || url.protocol === 'http:') && url.origin !== location.origin) return
64
+ event.preventDefault()
65
+ if (current?.failed === true) { actions.reportFailure(); release() }
66
+ prepare(event.currentTarget)
67
+ }, [src, original, actions, prepare, release])
68
+ const onPointerDown = useCallback((event: PointerEvent<HTMLImageElement>): void => {
69
+ dragged.current = false
70
+ if (event.button === 0) intent(event)
71
+ }, [intent])
72
+ const onPointerLeave = useCallback((event: PointerEvent<HTMLImageElement>): void => {
73
+ // Browsers may leave a small image before dispatching its dragstart.
74
+ if (event.buttons !== 1) release()
75
+ }, [release])
76
+ const onClickCapture = useCallback((event: MouseEvent): void => {
77
+ if (event.detail === 0) { dragged.current = false; return }
78
+ if (!dragged.current) return
79
+ event.preventDefault()
80
+ event.stopPropagation()
81
+ dragged.current = false
82
+ }, [])
83
+ return { onPointerEnter: intent, onPointerDown, onPointerLeave, onDragStart, onDragEnd: release, onClickCapture }
84
+ }
package/src/index.ts ADDED
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Cordis-free React primitives styled only through `--dsw-*` tokens.
3
+ */
4
+
5
+ export type { CodeToolbarLabels } from './CodeToolbar.tsx'
6
+ export { UserMessageBubble } from './UserMessageBubble.tsx'
7
+ export type { UserMessageBubbleProps } from './UserMessageBubble.tsx'
8
+ export { StateDot } from './StateDot.tsx'
9
+ export type { StateDotState } from './StateDot.tsx'
10
+ export { DisclosureRow } from './DisclosureRow.tsx'
11
+ export type { DisclosureRowProps } from './DisclosureRow.tsx'
12
+ export { AnimatedRows } from './AnimatedRows.tsx'
13
+ export type { AnimatedRowsProps } from './AnimatedRows.tsx'
14
+ export { useRowDragPreview } from './useRowDragPreview.ts'
15
+ export { TextShimmer } from './TextShimmer.tsx'
16
+ export type { TextShimmerProps } from './TextShimmer.tsx'
17
+ export { Button } from './Button.tsx'
18
+ export type { ButtonVariant } from './Button.tsx'
19
+ export { ZoomControls } from './ZoomControls.tsx'
20
+ export type { ZoomControlsHandle } from './ZoomControls.tsx'
21
+ export { DOCUMENT_ZOOM } from './document-zoom.ts'
22
+ export type { DocumentZoomLabels } from './document-zoom.ts'
23
+ export { Pill } from './Pill.tsx'
24
+ export { SegmentedTabs } from './SegmentedTabs.tsx'
25
+ export type { SegmentedTab } from './SegmentedTabs.tsx'
26
+ export { Tag } from './Tag.tsx'
27
+ export type { TagTone } from './Tag.tsx'
28
+ export { PathLabel } from './PathLabel.tsx'
29
+ export { Switch } from './Switch.tsx'
30
+ export { SegmentedControl } from './SegmentedControl.tsx'
31
+ export type { SegmentedControlOption } from './SegmentedControl.tsx'
32
+ export { Checkbox } from './Checkbox.tsx'
33
+ export { Input } from './Input.tsx'
34
+ export { InlineEditor } from './InlineEditor.tsx'
35
+ export { Menu, MenuItemButton } from './Menu.tsx'
36
+ export { MenuSurface, MENU_TRANSITION_MS } from './MenuSurface.tsx'
37
+ export type { MenuSurfaceProps } from './MenuSurface.tsx'
38
+ export { MenuGroup, observeStickyMenuGroups } from './MenuGroup.tsx'
39
+ export type { MenuItemButtonProps, MenuEntry, MenuItem, MenuSeparator, MenuLabel } from './Menu.tsx'
40
+ export { useAnchoredMaxHeight } from './useAnchoredMaxHeight.ts'
41
+ export { useDismissOnOutsidePointer } from './useDismissOnOutsidePointer.ts'
42
+ export { HoverCard } from './HoverCard.tsx'
43
+ export { HoverCardGroup } from './HoverCardGroup.tsx'
44
+ export { usePointerGrace } from './pointer-grace.ts'
45
+ export { ShortcutKeys } from './ShortcutKeys.tsx'
46
+ export { observeComposition } from './keyboard-composition.ts'
47
+ export { focusWithoutRing, isMobileDevice } from './focus.ts'
48
+ export { closeTopModal, isBehindModal, modalSelector, useModalLayer } from './useModalLayer.ts'
49
+ export { Modal } from './Modal.tsx'
50
+ export { RiskConfirmation } from './RiskConfirmation.tsx'
51
+ export type { RiskConfirmationProps } from './RiskConfirmation.tsx'
52
+ export { ConnectionIndicator } from './ConnectionIndicator.tsx'
53
+ export type { ConnectionIndicatorState } from './ConnectionIndicator.tsx'
54
+ export { FishLogo, FISH_LOGO_PATH, FISH_LOGO_VIEWBOX } from './FishLogo.tsx'
55
+ export { BrandWordmark } from './BrandWordmark.tsx'
56
+ export type { BrandWordmarkProps } from './BrandWordmark.tsx'
57
+ export {
58
+ PermissionIconAutoReviewMedium, PermissionIconAutoReviewRegular,
59
+ PermissionIconFullAccessMedium, PermissionIconFullAccessRegular,
60
+ PermissionIconReadOnlyMedium, PermissionIconReadOnlyRegular,
61
+ PermissionIconWorkspaceWriteMedium, PermissionIconWorkspaceWriteRegular,
62
+ } from './PermissionIcon.tsx'
63
+ export { ReferenceIconMedium, ReferenceIconRegular } from './ReferenceIcon.tsx'
64
+ export type { ReferenceIconKind, ReferenceIconProps } from './ReferenceIcon.tsx'
65
+ export { LinkIconMedium, LinkIconRegular, classifyLinkPath } from './LinkIcon.tsx'
66
+ export type { LinkIconKind, LinkIconProps } from './LinkIcon.tsx'
67
+ export { FileTypeIcon, classifyFileType, fileExtension } from './FileTypeIcon.tsx'
68
+ export type {
69
+ CodeFileType, FileType, FileTypeIconProps, FileTypeKind, FileTypeProjectContext,
70
+ } from './FileTypeIcon.tsx'
71
+ export { UserTextRun, ReferenceChip, type UserTextRunProps, type ReferenceChipProps } from './user-text.tsx'
72
+ export { Tooltip } from './Tooltip.tsx'
73
+ export type { TooltipSide } from './Tooltip.tsx'
74
+ export { pointerModality } from './input-modality.ts'
75
+ export { Toast } from './Toast.tsx'
76
+ export { fileSizeText } from './file-size.ts'
77
+ export { writeClipboard } from './clipboard.ts'
78
+ export type { FileDragActions, FileDragSource, PreparedFileDrag } from './file-drag-actions.ts'
79
+ export { DraggableImage } from './DraggableImage.tsx'
80
+ export type { DraggableImageProps } from './DraggableImage.tsx'
81
+ export { useClipboardCopy } from './use-clipboard-copy.ts'
82
+ export type { ClipboardCopyState } from './use-clipboard-copy.ts'
83
+ export { SettingsForm } from './settings-form/SettingsForm.tsx'
84
+ export type { SettingsFormLabels, SettingsFormProps } from './settings-form/SettingsForm.tsx'
85
+ export { SettingsSecretField, SettingsValueField } from './settings-form/fields.tsx'
86
+ export type { SettingsFieldProps } from './settings-form/fields.tsx'
87
+ export { SettingsFormModel, settingsNumberField, settingsTextField } from './settings-form/form-model.ts'
88
+ export type {
89
+ SettingsFieldSpec, SettingsFieldState, SettingsFieldWrite, SettingsFormActions, SettingsFormPathOp, SettingsFormScope,
90
+ SettingsFormScopeSnapshot, SettingsFormShell, SettingsSecretSpec,
91
+ } from './settings-form/form-model.ts'
92
+ export { CODE_HIGHLIGHT_EXTENSIONS, languageForPath, useCodeHighlighter } from './code-highlighting.ts'
93
+ export type { CodeHighlighter, HighlightSpan } from './code-highlighting.ts'
94
+ export { relativeTime } from './relative-time.ts'
95
+ export { rankByName } from './rank-by-name.ts'
96
+ export { isDarwinDesktop } from './darwin-desktop.ts'
97
+ export type { RelativeTime, RelativeTimeUnit } from './relative-time.ts'
98
+ export { JsonTree } from './JsonTree.tsx'
99
+ export type { JsonTreeProps, JsonTreeLabels } from './JsonTree.tsx'
100
+ export { TerminalBlock, DEFAULT_TERMINAL_MAX_LINES } from './TerminalBlock.tsx'
101
+ export { CommandText } from './CommandText.tsx'
102
+ export type { CommandTextProps } from './CommandText.tsx'
103
+ export type { TerminalBlockProps, TerminalBlockLabels } from './TerminalBlock.tsx'
104
+ export { ReadBlock, DEFAULT_READ_MAX_LINES } from './ReadBlock.tsx'
105
+ export type { ReadBlockProps, ReadBlockLine, ReadBlockLabels } from './ReadBlock.tsx'
106
+ export { DiffBlock, DEFAULT_DIFF_MAX_LINES, diffTotals } from './DiffBlock.tsx'
107
+ export type { DiffBlockProps, DiffHunk, DiffBlockLabels } from './DiffBlock.tsx'
108
+ export { SearchBlock, DEFAULT_SEARCH_MAX_LINES } from './SearchBlock.tsx'
109
+ export type {
110
+ SearchBlockProps, SearchMatchesBlockProps, SearchPathsBlockProps, SearchFileGroup, SearchBlockLineMatch,
111
+ SearchBlockLabels,
112
+ } from './SearchBlock.tsx'
113
+ export { WebBlock } from './WebBlock.tsx'
114
+ export type {
115
+ WebBlockProps, WebSearchBlockProps, WebFetchBlockProps, WebSourceView, WebBlockLabels,
116
+ } from './WebBlock.tsx'
117
+ export { CodeBlock } from './markdown/CodeBlock.tsx'
118
+ export type { CodeBlockProps } from './markdown/CodeBlock.tsx'
119
+ export { FenceCodeBlock, FenceMathBlock } from './markdown/FenceBlocks.tsx'
120
+ export type { FenceCodeBlockProps } from './markdown/FenceBlocks.tsx'
121
+ export { JsonBlock } from './markdown/JsonBlock.tsx'
122
+ export { MarkdownDelegateProvider, useMarkdownDelegate } from './markdown/MarkdownDelegate.tsx'
123
+ export type { MarkdownDelegate, MarkdownDelegateProviderProps, MarkdownExternalLinkHandler, MarkdownDelegateFenceInfo } from './markdown/MarkdownDelegate.tsx'
124
+ export { DetailDocument, detailDocumentState, useDetailDocumentLabels } from './DetailDocument.tsx'
125
+ export type { DetailDocumentCopy, DetailDocumentLabels, DetailDocumentRead, DetailDocumentState } from './DetailDocument.tsx'
126
+ export { MarkdownText } from './markdown/MarkdownText.tsx'
127
+ export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, MarkdownPathImages } from './markdown/MarkdownText.tsx'
128
+ export { extractMarkdownPlainText } from './markdown/plain-text.ts'
129
+ export type { MarkdownPlainTextMode, MarkdownPlainTextOptions } from './markdown/plain-text.ts'
130
+ export * from './icons/index.tsx'
131
+ export {
132
+ PluginArtworkTerminal, PluginArtworkLoop, PluginArtworkSubagent, PluginArtworkSearch, PluginArtworkDefault,
133
+ } from './plugin-artwork.tsx'
134
+ export { GuideArtworkBrowser, GuideArtworkFiles } from './guide-artwork.tsx'
135
+ export { ImageLightbox } from './ImageLightbox.tsx'
136
+ export type { ImageLightboxLabels } from './ImageLightbox.tsx'
137
+
138
+ export { QuotePreview } from './QuotePreview.tsx'
139
+ export type { QuotePreviewProps, QuotePreviewRemoval, QuoteSummary } from './QuotePreview.tsx'
140
+ export { formatQuoteText } from './markdown/quote-text.ts'
141
+
142
+ export type { MarkdownMenuTarget } from './markdown/MarkdownDelegate.tsx'
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Document-wide input tracking shared by tooltips and focus-ring styles.
3
+ * Tooltips follow the last input; rings follow navigation or a key followed by
4
+ * focus on a different control. Modifiers and refocusing alone keep rings silent.
5
+ * Module-level listeners live for the document lifetime; Node imports are inert.
6
+ */
7
+
8
+ /** Modality values published on the document element. */
9
+ export const INPUT_MODALITY = { pointer: 'pointer', keyboard: 'keyboard' } as const
10
+
11
+ /** Attribute carrying whether focus navigation last owned focus. */
12
+ export const INPUT_MODALITY_ATTRIBUTE = 'data-input-modality'
13
+
14
+ const FOCUS_NAVIGATION = new Set(['Tab', 'Home', 'End', 'PageUp', 'PageDown'])
15
+
16
+ let pointer = false
17
+ let pointerOwnsFocus = false
18
+ let keyFocusOrigin: EventTarget | undefined
19
+
20
+ function publish(): void {
21
+ document.documentElement.setAttribute(INPUT_MODALITY_ATTRIBUTE, pointerOwnsFocus ? INPUT_MODALITY.pointer : INPUT_MODALITY.keyboard)
22
+ }
23
+
24
+ /**
25
+ * Whether the last input came from a pointer, independently of ring visibility.
26
+ * @returns True after pointer input; false after any key.
27
+ */
28
+ export function pointerModality(): boolean {
29
+ return pointer
30
+ }
31
+
32
+ if (typeof window !== 'undefined') {
33
+ window.addEventListener('pointerdown', () => {
34
+ pointer = true
35
+ pointerOwnsFocus = true
36
+ keyFocusOrigin = undefined
37
+ publish()
38
+ }, true)
39
+ window.addEventListener('keydown', (event) => {
40
+ pointer = false
41
+ if (event.isComposing) {
42
+ keyFocusOrigin = undefined
43
+ return
44
+ }
45
+ // composedPath preserves the real control inside an open shadow root.
46
+ keyFocusOrigin = event.composedPath()[0]
47
+ if (!FOCUS_NAVIGATION.has(event.key) && !event.key.startsWith('Arrow')) return
48
+ pointerOwnsFocus = false
49
+ publish()
50
+ }, true)
51
+ window.addEventListener('focusin', (event) => {
52
+ if (keyFocusOrigin === undefined || event.composedPath()[0] === keyFocusOrigin) return
53
+ keyFocusOrigin = undefined
54
+ if (!pointerOwnsFocus) return
55
+ pointerOwnsFocus = false
56
+ publish()
57
+ }, true)
58
+ window.addEventListener('blur', () => { keyFocusOrigin = undefined })
59
+ }
@@ -0,0 +1,36 @@
1
+ /** Composition lifetime for local keyboard handlers, including a late closing keydown. */
2
+
3
+ /**
4
+ * Observe composition until its closing key is released or consumed.
5
+ * @param document - document whose input events belong to the caller.
6
+ * @returns an event guard and a disposer for all listeners.
7
+ */
8
+ export function observeComposition(document: Document): {
9
+ guards(event: KeyboardEvent): boolean
10
+ dispose(): void
11
+ } {
12
+ let composing = false
13
+ let ended = false
14
+ const start = (): void => { composing = true }
15
+ const end = (): void => { composing = false; ended = true }
16
+ const release = (): void => { ended = false }
17
+ const blur = (): void => { composing = false; ended = false }
18
+ document.addEventListener('compositionstart', start, true)
19
+ document.addEventListener('compositionend', end, true)
20
+ document.addEventListener('keyup', release, true)
21
+ document.defaultView?.addEventListener('blur', blur)
22
+ return {
23
+ guards: (event) => {
24
+ // oxlint-disable-next-line typescript/no-deprecated -- IME 229 covers engines without isComposing.
25
+ const guarded = composing || ended || event.isComposing || event.keyCode === 229
26
+ ended = false
27
+ return guarded
28
+ },
29
+ dispose: () => {
30
+ document.removeEventListener('compositionstart', start, true)
31
+ document.removeEventListener('compositionend', end, true)
32
+ document.removeEventListener('keyup', release, true)
33
+ document.defaultView?.removeEventListener('blur', blur)
34
+ },
35
+ }
36
+ }
@@ -0,0 +1,209 @@
1
+ /* Visual baseline: deepsuite `@deepseek/md` code-block.css. Highlight colors
2
+ stay on the existing shiki `--shiki-*` sheet (not Prism highlight.css). */
3
+
4
+ .block {
5
+ --dsl-code-block-banner-background-color: var(--dsw-alias-markdown-code-block-banner);
6
+ --dsl-code-block-border-radius: var(--dsw-radius-lg);
7
+ /* Local 11/18 instead of the shared --dsw-font-xs-13: the banner scales
8
+ with the markdown 0.875 ladder without shrinking every other xs-13 use. */
9
+ --dsl-code-block-banner-font: 11px/18px var(--dsw-font-family);
10
+ --dsl-code-block-content-font: var(--dsw-font-markdown-code-block);
11
+ --dsl-code-block-background: var(--dsw-alias-markdown-code-block);
12
+
13
+ position: relative;
14
+ margin: 16px 0;
15
+ color: var(--dsw-alias-label-primary);
16
+ background: var(--dsl-code-block-background);
17
+ border-radius: var(--dsl-code-block-border-radius);
18
+ }
19
+
20
+ .block:not(:last-child) {
21
+ margin-bottom: 11px;
22
+ }
23
+
24
+ .bannerWrap {
25
+ position: sticky;
26
+ top: 0;
27
+ z-index: 6;
28
+ background-color: var(--dsw-alias-bg-base);
29
+ border-top-left-radius: var(--dsl-code-block-border-radius);
30
+ border-top-right-radius: var(--dsl-code-block-border-radius);
31
+ }
32
+
33
+ .banner {
34
+ background: var(--dsl-code-block-banner-background-color);
35
+ padding: 9px 14px;
36
+ display: flex;
37
+ justify-content: space-between;
38
+ align-items: center;
39
+ gap: 12px;
40
+ font: var(--dsl-code-block-banner-font);
41
+ border-top-left-radius: var(--dsl-code-block-border-radius);
42
+ border-top-right-radius: var(--dsl-code-block-border-radius);
43
+ }
44
+
45
+ .infostring {
46
+ color: var(--dsw-alias-label-primary);
47
+ font-family: var(--ds-font-family-code);
48
+ font-size: 11px;
49
+ line-height: 18px;
50
+ min-width: 0;
51
+ overflow: hidden;
52
+ text-overflow: ellipsis;
53
+ white-space: nowrap;
54
+ }
55
+
56
+ .action {
57
+ display: flex;
58
+ align-items: center;
59
+ flex-shrink: 0;
60
+ }
61
+
62
+ .copyButton {
63
+ background-color: rgb(255 255 255 / 0);
64
+ border: none;
65
+ padding: 0;
66
+ margin: 0;
67
+ color: inherit;
68
+ cursor: pointer;
69
+ font: inherit;
70
+ }
71
+
72
+ /* Consumers may turn the stable content node into a viewport without changing
73
+ the default CodeBlock layout. */
74
+ .content {
75
+ display: contents;
76
+ }
77
+
78
+ .block :where(pre) {
79
+ font: var(--dsl-code-block-content-font);
80
+ padding: 16px;
81
+ margin: 0 !important;
82
+ overflow-x: auto;
83
+ white-space: pre-wrap;
84
+ word-break: break-all;
85
+ background: var(--dsl-code-block-background);
86
+ /* Bottom radii live on <pre>: overflow:hidden on .block would kill the
87
+ sticky banner, and this opaque fill otherwise squares off the wrapper. */
88
+ border-bottom-left-radius: var(--dsl-code-block-border-radius);
89
+ border-bottom-right-radius: var(--dsl-code-block-border-radius);
90
+ }
91
+
92
+ /* Shiki inlines its theme background var; route it to the repo token. */
93
+ .block :where(pre.shiki) {
94
+ background: var(--dsl-code-block-background) !important;
95
+ }
96
+
97
+ .block :where(pre) code {
98
+ font: inherit;
99
+ background: none;
100
+ padding: 0;
101
+ }
102
+
103
+ .plain {
104
+ color: var(--dsw-alias-label-primary);
105
+ }
106
+
107
+ .card :where(pre) {
108
+ padding: 6px 22px 20px;
109
+ word-break: normal;
110
+ overflow-wrap: anywhere;
111
+ }
112
+
113
+ .card[data-code-wrap='false'] {
114
+ --dsl-code-block-line-white-space: pre;
115
+ }
116
+
117
+ .card[data-code-wrap='false'] :where(pre) {
118
+ white-space: pre;
119
+ overflow-wrap: normal;
120
+ }
121
+
122
+ .numbered :where(pre) code {
123
+ display: block;
124
+ counter-reset: source-line;
125
+ white-space: normal;
126
+ }
127
+
128
+ .numbered :where(pre) code > :global(.line) {
129
+ position: relative;
130
+ display: block;
131
+ min-height: 1lh;
132
+ padding-inline-start: calc(var(--dsl-code-block-line-number-width) + 12px);
133
+ counter-increment: source-line;
134
+ white-space: var(--dsl-code-block-line-white-space, pre-wrap);
135
+ }
136
+
137
+ .numbered :where(pre) code > :global(.line)::before {
138
+ position: absolute;
139
+ inset-inline-start: 0;
140
+ width: var(--dsl-code-block-line-number-width);
141
+ color: var(--dsw-alias-label-tertiary);
142
+ text-align: end;
143
+ content: counter(source-line);
144
+ user-select: none;
145
+ }
146
+
147
+ /* Diff fences paint full-bleed rows with the Sidebar file diff's row colors;
148
+ the row's own inline padding keeps the marker clear of the inset bar. */
149
+ .diffFence :where(pre) {
150
+ padding: 8px 0 16px;
151
+ }
152
+
153
+ .diffLine {
154
+ display: inline-block;
155
+ width: 100%;
156
+ }
157
+
158
+ /* Numbered gutters already make `.line` a full-width block; keep the padding
159
+ box intact instead of stacking a second 100% width on it. */
160
+ .numbered .diffLine {
161
+ display: block;
162
+ width: auto;
163
+ }
164
+
165
+ .diffFence .diffLine {
166
+ padding: 0 16px;
167
+ box-sizing: border-box;
168
+ }
169
+
170
+ /* A non-wrapping fence scrolls horizontally: rows cover the scrollable width,
171
+ not just the visible box, so the fill and left bar survive scrolling. */
172
+ .diffFence[data-code-wrap='false'] .diffLine {
173
+ width: max-content;
174
+ min-width: 100%;
175
+ }
176
+
177
+ .diffAdd {
178
+ background: var(--dsw-alias-file-diff-added-bg);
179
+ box-shadow: inset 3px 0 0 var(--dsw-alias-file-diff-added-marker);
180
+ }
181
+
182
+ .diffDel {
183
+ background: var(--dsw-alias-file-diff-deleted-bg);
184
+ box-shadow: inset 3px 0 0 var(--dsw-alias-file-diff-deleted-marker);
185
+ }
186
+
187
+ .diffMarker {
188
+ margin-inline-end: 1ch;
189
+ }
190
+
191
+ .diffAdd .diffMarker {
192
+ color: var(--dsw-alias-file-diff-added-marker);
193
+ }
194
+
195
+ .diffDel .diffMarker {
196
+ color: var(--dsw-alias-file-diff-deleted-marker);
197
+ }
198
+
199
+ .diffContext {
200
+ color: var(--dsw-alias-label-secondary);
201
+ }
202
+
203
+ .diffHunk {
204
+ color: var(--dsw-alias-label-secondary);
205
+ }
206
+
207
+ .diffMeta {
208
+ color: var(--dsw-alias-label-tertiary);
209
+ }