@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,49 @@
1
+ import type { ReactNode } from 'react'
2
+ import { ICON_MEDIUM_STROKE, ICON_REGULAR_STROKE } from './icons/index.tsx'
3
+ import type { IconProps } from './icons/props.ts'
4
+ import {
5
+ BrowseOutlineArtwork, ChatLinesOutlineArtwork, FolderCloseArtwork,
6
+ } from './icons/shared-artwork.tsx'
7
+
8
+ /** Reference domains with distinct composer and transcript glyphs. */
9
+ export type ReferenceIconKind = 'session' | 'file' | 'folder'
10
+
11
+ /** Props shared by inline reference glyphs. */
12
+ export interface ReferenceIconProps extends IconProps {
13
+ kind: ReferenceIconKind
14
+ }
15
+
16
+ interface WeightedReferenceIconProps extends ReferenceIconProps {
17
+ strokeWidth: number
18
+ }
19
+
20
+ /**
21
+ * Render the icon that identifies one inline reference domain.
22
+ * @param props - Reference kind, optional size, and optional CSS class.
23
+ * @returns The corresponding decorative current-color SVG glyph.
24
+ */
25
+ function ReferenceIconArtwork({ kind, size = 16, className, strokeWidth }: WeightedReferenceIconProps): ReactNode {
26
+ switch (kind) {
27
+ case 'session': return <ChatLinesOutlineArtwork size={size} className={className} strokeWidth={strokeWidth} />
28
+ case 'file': return <BrowseOutlineArtwork size={size} className={className} strokeWidth={strokeWidth} />
29
+ case 'folder': return <FolderCloseArtwork size={size} className={className} strokeWidth={strokeWidth} />
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Render a regular one-pixel reference icon.
35
+ * @param props - Reference kind, size, and optional class.
36
+ * @returns The regular decorative reference glyph.
37
+ */
38
+ export function ReferenceIconRegular(props: ReferenceIconProps): ReactNode {
39
+ return <ReferenceIconArtwork {...props} strokeWidth={ICON_REGULAR_STROKE} />
40
+ }
41
+
42
+ /**
43
+ * Render a medium 1.3px reference icon.
44
+ * @param props - Reference kind, size, and optional class.
45
+ * @returns The medium decorative reference glyph.
46
+ */
47
+ export function ReferenceIconMedium(props: ReferenceIconProps): ReactNode {
48
+ return <ReferenceIconArtwork {...props} strokeWidth={ICON_MEDIUM_STROKE} />
49
+ }
@@ -0,0 +1,47 @@
1
+ .confirmation {
2
+ width: min(440px, 100%);
3
+ max-height: 100%;
4
+ overflow: hidden;
5
+ }
6
+
7
+ .confirmationContent {
8
+ min-height: 0;
9
+ overflow-y: auto;
10
+ overscroll-behavior: contain;
11
+ }
12
+
13
+ @supports (height: 100dvh) {
14
+ .confirmation {
15
+ max-height: calc(100dvh - 48px);
16
+ }
17
+ }
18
+
19
+ .description {
20
+ margin: 0;
21
+ color: var(--dsw-alias-label-secondary);
22
+ font-size: 14px;
23
+ line-height: 22px;
24
+ }
25
+
26
+ .confirmation .acknowledgement {
27
+ align-items: flex-start;
28
+ margin-top: 16px;
29
+ color: var(--dsw-alias-label-secondary);
30
+ font-size: 14px;
31
+ font-weight: 400;
32
+ line-height: 20px;
33
+ }
34
+
35
+ .confirmation .acknowledgement input {
36
+ width: 14px;
37
+ height: 14px;
38
+ margin-top: 3px;
39
+ }
40
+
41
+ .modalAction {
42
+ min-width: 72px;
43
+ }
44
+
45
+ .confirmAction {
46
+ min-width: 136px;
47
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Controlled risk acknowledgement dialog shared by product surfaces that
3
+ * must gate a sensitive action behind an explicit checkbox.
4
+ */
5
+ import { Button } from './Button.tsx'
6
+ import { Checkbox } from './Checkbox.tsx'
7
+ import { Modal } from './Modal.tsx'
8
+ import css from './RiskConfirmation.module.css'
9
+
10
+ export interface RiskConfirmationProps {
11
+ open: boolean
12
+ title: string
13
+ description: string
14
+ acknowledgeLabel: string
15
+ cancelLabel: string
16
+ closeLabel: string
17
+ confirmLabel: string
18
+ acknowledged: boolean
19
+ disabled?: boolean
20
+ onAcknowledgedChange: (acknowledged: boolean) => void
21
+ onCancel: () => void
22
+ onConfirm: () => void
23
+ }
24
+
25
+ /**
26
+ * Render one in-page confirmation whose primary action is unavailable until
27
+ * the caller-controlled acknowledgement is checked.
28
+ */
29
+ export function RiskConfirmation({
30
+ open,
31
+ title,
32
+ description,
33
+ acknowledgeLabel,
34
+ cancelLabel,
35
+ closeLabel,
36
+ confirmLabel,
37
+ acknowledged,
38
+ disabled = false,
39
+ onAcknowledgedChange,
40
+ onCancel,
41
+ onConfirm,
42
+ }: RiskConfirmationProps) {
43
+ return (
44
+ <Modal
45
+ open={open}
46
+ onClose={onCancel}
47
+ title={title}
48
+ tone="warning"
49
+ closeLabel={closeLabel}
50
+ className={css.confirmation ?? ''}
51
+ contentClassName={css.confirmationContent ?? ''}
52
+ footer={(
53
+ <>
54
+ <Button variant="outline" className={css.modalAction} onClick={onCancel}>
55
+ {cancelLabel}
56
+ </Button>
57
+ <Button
58
+ variant="primary"
59
+ className={css.confirmAction}
60
+ disabled={disabled || !acknowledged}
61
+ onClick={onConfirm}
62
+ >
63
+ {confirmLabel}
64
+ </Button>
65
+ </>
66
+ )}
67
+ >
68
+ <p className={css.description}>{description}</p>
69
+ <Checkbox
70
+ className={css.acknowledgement}
71
+ checked={acknowledged}
72
+ disabled={disabled}
73
+ modalAutofocus
74
+ label={acknowledgeLabel}
75
+ onChange={onAcknowledgedChange}
76
+ />
77
+ </Modal>
78
+ )
79
+ }
@@ -0,0 +1,12 @@
1
+ .preview {
2
+ position: fixed;
3
+ top: 0;
4
+ pointer-events: none;
5
+ }
6
+
7
+ .preview > :first-child {
8
+ box-sizing: border-box;
9
+ margin: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ }
@@ -0,0 +1,114 @@
1
+ .block {
2
+ --dsl-search-radius: var(--dsw-radius-lg);
3
+ --dsl-search-line-height: 22px;
4
+
5
+ position: relative;
6
+ margin: 16px 0;
7
+ color: var(--dsw-alias-label-primary);
8
+ background: var(--dsw-alias-markdown-code-block);
9
+ border-radius: var(--dsl-search-radius);
10
+ }
11
+
12
+ .header {
13
+ display: flex;
14
+ align-items: center;
15
+ gap: 12px;
16
+ padding: 9px 14px;
17
+ background: var(--dsw-alias-markdown-code-block-banner);
18
+ border-top-left-radius: var(--dsl-search-radius);
19
+ border-top-right-radius: var(--dsl-search-radius);
20
+ }
21
+
22
+ .summary {
23
+ flex: 1;
24
+ min-width: 0;
25
+ overflow: hidden;
26
+ text-overflow: ellipsis;
27
+ white-space: nowrap;
28
+ font: var(--dsw-font-xs-13);
29
+ color: var(--dsw-alias-label-secondary);
30
+ }
31
+
32
+ .copyButton {
33
+ flex: none;
34
+ background-color: transparent;
35
+ border: none;
36
+ padding: 0;
37
+ margin: 0;
38
+ color: var(--dsw-alias-label-secondary);
39
+ cursor: pointer;
40
+ font: var(--dsw-font-xs-13);
41
+ }
42
+
43
+ .body {
44
+ padding: 8px 14px 12px 0;
45
+ font: var(--dsw-font-markdown-code-block);
46
+ overflow-x: auto;
47
+ overflow-y: hidden;
48
+ }
49
+
50
+ /* No wrapping: a match line or a path keeps its content on one row and scrolls
51
+ sideways instead of folding. */
52
+ .line {
53
+ min-height: var(--dsl-search-line-height);
54
+ padding-left: 14px;
55
+ white-space: pre;
56
+ }
57
+
58
+ /* The 1-based line number ahead of a grep match line, dimmed so the match text
59
+ stays the salient content. */
60
+ .lineNumber {
61
+ color: var(--dsw-alias-label-tertiary);
62
+ }
63
+
64
+ /* A file group's header: a bold path label plus its match count, the whole row
65
+ the collapse control. */
66
+ .fileHeader {
67
+ display: flex;
68
+ align-items: baseline;
69
+ gap: 8px;
70
+ width: 100%;
71
+ min-height: var(--dsl-search-line-height);
72
+ padding: 0 14px;
73
+ border: none;
74
+ background-color: transparent;
75
+ cursor: pointer;
76
+ font: inherit;
77
+ text-align: left;
78
+ }
79
+
80
+ .filePath {
81
+ min-width: 0;
82
+ font-weight: 600;
83
+ color: var(--dsw-alias-label-primary);
84
+ white-space: pre;
85
+ }
86
+
87
+ .fileCount {
88
+ flex: none;
89
+ color: var(--dsw-alias-label-tertiary);
90
+ }
91
+
92
+ .expand {
93
+ display: block;
94
+ width: 100%;
95
+ padding: 0 14px;
96
+ border: none;
97
+ background-color: transparent;
98
+ color: var(--dsw-alias-label-tertiary);
99
+ cursor: pointer;
100
+ font: inherit;
101
+ text-align: left;
102
+ }
103
+
104
+ @media (hover: hover) {
105
+ .expand:hover {
106
+ color: var(--dsw-alias-label-secondary);
107
+ }
108
+ }
109
+
110
+ .empty {
111
+ padding: 12px 14px;
112
+ font: var(--dsw-font-markdown-code-block);
113
+ color: var(--dsw-alias-label-tertiary);
114
+ }
@@ -0,0 +1,281 @@
1
+ import { useCallback, useState, type ReactNode } from 'react'
2
+ import clsx from 'clsx'
3
+ import { headTailCap } from './head-tail-cap.ts'
4
+ import { useClipboardCopy } from './use-clipboard-copy.ts'
5
+ import css from './SearchBlock.module.css'
6
+
7
+ /**
8
+ * Result rows shown before the height cap collapses the middle. Matches
9
+ * {@link DEFAULT_TERMINAL_MAX_LINES} so a search card and a terminal card cut a
10
+ * long result at the same place.
11
+ */
12
+ export const DEFAULT_SEARCH_MAX_LINES = 16
13
+
14
+ /** One matched line inside a {@link SearchFileGroup}: its 1-based line number and text. */
15
+ export interface SearchBlockLineMatch {
16
+ /** 1-based line number of the match within its file. */
17
+ lineNumber: number
18
+ /** The matched line text, as the tool surfaced it. */
19
+ line: string
20
+ }
21
+
22
+ /** One file's grouped matches, in first-seen file order. */
23
+ export interface SearchFileGroup {
24
+ /** The file the matches belong to (the display path). */
25
+ path: string
26
+ /** The file's matched lines, in output order. */
27
+ matches: SearchBlockLineMatch[]
28
+ }
29
+
30
+ /** Fields both search shapes carry (the render site positions; this component draws). */
31
+ interface SearchBlockCommon {
32
+ /** Localized chrome supplied by the owning render site. */
33
+ labels: SearchBlockLabels
34
+ /**
35
+ * Whether the tool capped the inline result: the shape carries only the
36
+ * retained results, not every result the search found. The banner summary
37
+ * folds the pre-cap `total` in (`显示 X / 共 N …`) so the card never presents a
38
+ * capped result as complete.
39
+ */
40
+ truncated: boolean
41
+ /** Total results the search found before capping (equals the retained count when not `truncated`). */
42
+ total: number
43
+ /** Height cap in rows before the middle collapses (default {@link DEFAULT_SEARCH_MAX_LINES}). */
44
+ maxLines?: number | undefined
45
+ /** Extra class merged onto the wrapper. */
46
+ className?: string | undefined
47
+ }
48
+
49
+ /** Localized chrome for {@link SearchBlock}. */
50
+ export interface SearchBlockLabels {
51
+ pathsSummary: (shown: number, total: number, truncated: boolean) => string
52
+ matchesSummary: (shown: number, total: number, files: number, truncated: boolean) => string
53
+ copy: string
54
+ copied: string
55
+ noResults: string
56
+ collapseAria: string
57
+ expandAria: (hidden: number) => string
58
+ collapse: string
59
+ expand: (hidden: number) => string
60
+ }
61
+
62
+ /** Props for the grouped-matches (`grep`) shape. */
63
+ export interface SearchMatchesBlockProps extends SearchBlockCommon {
64
+ kind: 'matches'
65
+ /** Matched lines grouped by file, in first-seen file order. */
66
+ files: SearchFileGroup[]
67
+ }
68
+
69
+ /** Props for the flat-path (`glob`) shape. */
70
+ export interface SearchPathsBlockProps extends SearchBlockCommon {
71
+ kind: 'paths'
72
+ /** The discovered paths, in the tool's result order (the retained page when `truncated`). */
73
+ paths: string[]
74
+ }
75
+
76
+ /** {@link SearchBlock} props: one card, two `kind`-discriminated shapes. */
77
+ export type SearchBlockProps = SearchMatchesBlockProps | SearchPathsBlockProps
78
+
79
+ /**
80
+ * One flattened render row. A matches card produces a `file` header row per
81
+ * group followed by a `match` row per retained line while the group is
82
+ * expanded; a paths card produces one `path` row per path. The height cap
83
+ * counts these rows uniformly, so a file header costs one row exactly as a
84
+ * match line or a path does.
85
+ */
86
+ type SearchRow =
87
+ | { type: 'file'; path: string; count: number; index: number; collapsed: boolean }
88
+ | { type: 'match'; lineNumber: number; line: string; key: string; fileIndex: number }
89
+ | { type: 'path'; path: string }
90
+
91
+ /**
92
+ * The plain-text form the copy control writes: the whole structured result
93
+ * regardless of the height cap or which groups are collapsed, so the clipboard
94
+ * carries the result rather than what the card happens to be showing.
95
+ * @param props - the card's props.
96
+ * @returns the copyable text, or the empty string for an empty result.
97
+ */
98
+ function copyText(props: SearchBlockProps): string {
99
+ if (props.kind === 'paths') return props.paths.join('\n')
100
+ return props.files
101
+ .map(file => [file.path, ...file.matches.map(m => `${m.lineNumber}: ${m.line}`)].join('\n'))
102
+ .join('\n\n')
103
+ }
104
+
105
+ /**
106
+ * Number of retained results the card holds: the matched-line count across all
107
+ * files for a matches card, the path count for a paths card. This is the count
108
+ * the banner summary reports against `total` when the result was capped.
109
+ * @param props - the card's props.
110
+ * @returns the retained result count.
111
+ */
112
+ function shownCount(props: SearchBlockProps): number {
113
+ return props.kind === 'paths'
114
+ ? props.paths.length
115
+ : props.files.reduce((sum, file) => sum + file.matches.length, 0)
116
+ }
117
+
118
+ /**
119
+ * The banner summary. When the search was capped it reads `显示 X / 共 N …` so
120
+ * the retained count and the pre-cap total sit in one clause (mirroring the read
121
+ * card's `显示 X / Y 行`); when it was not capped it is a plain count of what the
122
+ * card holds. The unit — `处匹配 · K 个文件` for grep, `个路径` for glob — trails
123
+ * the count either way.
124
+ * @param props - the card's props.
125
+ * @param shown - the retained result count from {@link shownCount}.
126
+ * @param truncated - whether the search was capped.
127
+ * @param total - the pre-cap total the truncation clause reports.
128
+ * @returns the summary text.
129
+ */
130
+ function summaryText(props: SearchBlockProps, shown: number, truncated: boolean, total: number): string {
131
+ return props.kind === 'paths'
132
+ ? props.labels.pathsSummary(shown, total, truncated)
133
+ : props.labels.matchesSummary(shown, total, props.files.length, truncated)
134
+ }
135
+
136
+ /**
137
+ * Flatten a card's shape into its render rows, dropping a collapsed file
138
+ * group's match rows.
139
+ * @param props - the card's props.
140
+ * @param collapsed - the set of collapsed file-group indices (matches only).
141
+ * @returns the flattened rows in output order.
142
+ */
143
+ function toRows(props: SearchBlockProps, collapsed: ReadonlySet<number>): SearchRow[] {
144
+ if (props.kind === 'paths') return props.paths.map((path): SearchRow => ({ type: 'path', path }))
145
+ const rows: SearchRow[] = []
146
+ props.files.forEach((file, index) => {
147
+ const isCollapsed = collapsed.has(index)
148
+ rows.push({ type: 'file', path: file.path, count: file.matches.length, index, collapsed: isCollapsed })
149
+ if (isCollapsed) return
150
+ for (const match of file.matches) {
151
+ rows.push({ type: 'match', lineNumber: match.lineNumber, line: match.line, key: `${index}:${match.lineNumber}`, fileIndex: index })
152
+ }
153
+ })
154
+ return rows
155
+ }
156
+
157
+ /**
158
+ * A stable React key for a flattened render row: the group-scoped match key, a
159
+ * file-index-scoped header key, or the path itself. Rows of different types
160
+ * never collide, since each key carries its type prefix or the group index.
161
+ * @param row - the flattened row.
162
+ * @returns the key.
163
+ */
164
+ function rowKey(row: SearchRow): string {
165
+ switch (row.type) {
166
+ case 'match': return `match:${row.key}`
167
+ case 'file': return `file:${row.index}`
168
+ case 'path': return `path:${row.path}`
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Render a completed search as a grouped-matches or flat-path card.
174
+ * @param props - see {@link SearchBlockProps}.
175
+ * @returns the search block element.
176
+ */
177
+ export function SearchBlock(props: SearchBlockProps) {
178
+ const { truncated, total, maxLines = DEFAULT_SEARCH_MAX_LINES, className } = props
179
+ const [expanded, setExpanded] = useState(false)
180
+ const [collapsed, setCollapsed] = useState<ReadonlySet<number>>(() => new Set())
181
+
182
+ // `props` is a fresh object each render, so memoizing on it never hits; the
183
+ // flatten is cheap, so it runs inline keyed on the collapse set instead.
184
+ const rows = toRows(props, collapsed)
185
+ const shown = shownCount(props)
186
+ const empty = rows.length === 0
187
+ const { copied, onCopy } = useClipboardCopy(copyText(props))
188
+
189
+ const onToggle = useCallback(() => { setExpanded(value => !value) }, [])
190
+
191
+ const toggleFile = useCallback((index: number) => {
192
+ setCollapsed((prev) => {
193
+ const next = new Set(prev)
194
+ if (next.has(index)) next.delete(index)
195
+ else next.add(index)
196
+ return next
197
+ })
198
+ }, [])
199
+
200
+ const { hidden, capped, headLines, tailLines } = headTailCap(rows.length, maxLines, expanded)
201
+ const head = capped ? rows.slice(0, headLines) : rows
202
+ const naturalTail = capped ? rows.slice(rows.length - tailLines) : []
203
+ // When the tail slice begins inside a file's matches, its own header sits
204
+ // above the cut and is not shown, so those rows could not be attributed to a
205
+ // file. Restore the owning header at the top of the tail — unless the head
206
+ // slice already carries it (a single large file), where it would duplicate.
207
+ const tailLead = naturalTail[0]
208
+ const tailHeader = tailLead?.type === 'match'
209
+ && !head.some(row => row.type === 'file' && row.index === tailLead.fileIndex)
210
+ ? rows.find((row): row is Extract<SearchRow, { type: 'file' }> =>
211
+ row.type === 'file' && row.index === tailLead.fileIndex)
212
+ : undefined
213
+ // The restored header is itself a row. Left extra it would push the card to
214
+ // maxLines + 1 and overstate `hidden` by one, so it consumes a tail slot: drop
215
+ // the tail's first row (the match whose header this is) for it. Visible rows
216
+ // hold at maxLines and `hidden` stays exact; the dropped match joins the
217
+ // hidden middle.
218
+ const tail = tailHeader === undefined ? naturalTail : naturalTail.slice(1)
219
+
220
+ const renderRow = (row: SearchRow): ReactNode => {
221
+ if (row.type === 'path') return <div className={css.line}>{row.path}</div>
222
+ if (row.type === 'match') {
223
+ return (
224
+ <div className={css.line}>
225
+ <span className={css.lineNumber}>{row.lineNumber}: </span>
226
+ {row.line}
227
+ </div>
228
+ )
229
+ }
230
+ return (
231
+ <button
232
+ type="button"
233
+ className={css.fileHeader}
234
+ aria-expanded={!row.collapsed}
235
+ onClick={() => { toggleFile(row.index) }}
236
+ >
237
+ <span className={css.filePath}>{row.path}</span>
238
+ <span className={css.fileCount}>{row.count}</span>
239
+ </button>
240
+ )
241
+ }
242
+
243
+ return (
244
+ <div className={clsx(css.block, className)} data-search={props.kind}>
245
+ <div className={css.header}>
246
+ <span className={css.summary}>{summaryText(props, shown, truncated, total)}</span>
247
+ {!empty && (
248
+ <button type="button" className={css.copyButton} onClick={onCopy}>
249
+ {copied ? props.labels.copied : props.labels.copy}
250
+ </button>
251
+ )}
252
+ </div>
253
+ {empty
254
+ ? <div className={css.empty}>{props.labels.noResults}</div>
255
+ : (
256
+ <div className={css.body}>
257
+ {head.map(row => (
258
+ <div key={rowKey(row)}>{renderRow(row)}</div>
259
+ ))}
260
+ {hidden > 0 && (
261
+ <button
262
+ type="button"
263
+ className={css.expand}
264
+ aria-expanded={expanded}
265
+ aria-label={expanded ? props.labels.collapseAria : props.labels.expandAria(hidden)}
266
+ onClick={onToggle}
267
+ >
268
+ {expanded ? props.labels.collapse : props.labels.expand(hidden)}
269
+ </button>
270
+ )}
271
+ {tailHeader !== undefined && (
272
+ <div key={`tailHeader:${rowKey(tailHeader)}`}>{renderRow(tailHeader)}</div>
273
+ )}
274
+ {tail.map(row => (
275
+ <div key={rowKey(row)}>{renderRow(row)}</div>
276
+ ))}
277
+ </div>
278
+ )}
279
+ </div>
280
+ )
281
+ }
@@ -0,0 +1,81 @@
1
+ /* The track is the same translucent fill the hover state uses, so it reads as
2
+ * a place rather than a second button; the one raised part is the indicator,
3
+ * a white pill that slides under the selected segment. Its stroke rides inside
4
+ * the soft elevation shadow (border: 0), the way every elevated surface draws
5
+ * its edge, so the elevation gate keeps it off the alias-border set.
6
+ *
7
+ * Segments are equal-width grid tracks sized to the widest label, which is
8
+ * what lets one indicator be placed arithmetically: the tablist carries the
9
+ * segment count and the selected index as custom properties, and the indicator
10
+ * derives its width and offset from them instead of measuring the DOM. */
11
+ .control {
12
+ position: relative;
13
+ display: inline-grid;
14
+ grid-auto-flow: column;
15
+ grid-auto-columns: 1fr;
16
+ gap: 2px;
17
+ padding: 4px;
18
+ border-radius: var(--dsw-radius-md);
19
+ background: var(--dsw-alias-interactive-bg-hover);
20
+ }
21
+
22
+ .indicator {
23
+ position: absolute;
24
+ top: 4px;
25
+ left: 4px;
26
+ width: calc((100% - 8px - 2px * (var(--dsh-segment-count) - 1)) / var(--dsh-segment-count));
27
+ height: calc(100% - 8px);
28
+ border: 0;
29
+ border-radius: var(--dsw-radius-sm);
30
+ background: var(--dsw-alias-bg-layer-1);
31
+ box-shadow: var(--dsw-elevation-soft);
32
+ transform: translateX(calc(var(--dsh-segment-index) * (100% + 2px)));
33
+ transition: transform 160ms ease;
34
+ pointer-events: none;
35
+ }
36
+
37
+ .tab {
38
+ box-sizing: border-box;
39
+ position: relative;
40
+ z-index: 1;
41
+ height: 28px;
42
+ padding: 0 16px;
43
+ border: 0;
44
+ border-radius: var(--dsw-radius-sm);
45
+ background: transparent;
46
+ color: var(--dsw-alias-label-secondary);
47
+ font: inherit;
48
+ font-size: 13px;
49
+ line-height: 20px;
50
+ font-weight: 500;
51
+ white-space: nowrap;
52
+ cursor: pointer;
53
+ transition: color 120ms ease;
54
+ }
55
+
56
+ .tab[aria-selected='true'] {
57
+ color: var(--dsw-alias-label-primary);
58
+ }
59
+
60
+ @media (hover: hover) {
61
+ .tab:hover:not(:disabled) {
62
+ color: var(--dsw-alias-label-primary);
63
+ }
64
+ }
65
+
66
+ .tab:disabled {
67
+ cursor: default;
68
+ opacity: 0.4;
69
+ }
70
+
71
+ .tab:focus-visible {
72
+ outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
73
+ outline-offset: -2px;
74
+ }
75
+
76
+ @media (prefers-reduced-motion: reduce) {
77
+ .indicator,
78
+ .tab {
79
+ transition: none;
80
+ }
81
+ }