@zonsh/ui 0.0.0 → 0.4.1

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 (425) hide show
  1. package/LICENSE +43 -0
  2. package/README.md +81 -1
  3. package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
  4. package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
  5. package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
  6. package/assets/illustrations/drawing/bracket-construction.svg +77 -0
  7. package/assets/illustrations/drawing/crescent-dark.svg +28 -0
  8. package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
  9. package/assets/illustrations/drawing/crescent-guides.svg +33 -0
  10. package/assets/illustrations/drawing/crescent.svg +28 -0
  11. package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
  12. package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
  13. package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
  14. package/assets/illustrations/drawing/eclipse.svg +187 -0
  15. package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
  16. package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
  17. package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
  18. package/assets/illustrations/drawing/elevation-guides.svg +31 -0
  19. package/assets/illustrations/drawing/horizon-dark.svg +30 -0
  20. package/assets/illustrations/drawing/horizon.svg +30 -0
  21. package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
  22. package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
  23. package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
  24. package/assets/illustrations/drawing/nib-study.svg +107 -0
  25. package/assets/illustrations/editorial/assistant-640.webp +0 -0
  26. package/assets/illustrations/editorial/assistant.webp +0 -0
  27. package/assets/illustrations/editorial/automation-640.webp +0 -0
  28. package/assets/illustrations/editorial/automation.webp +0 -0
  29. package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
  30. package/assets/illustrations/editorial/bracket-left.webp +0 -0
  31. package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
  32. package/assets/illustrations/editorial/bracket-right.webp +0 -0
  33. package/assets/illustrations/editorial/custom-software-640.webp +0 -0
  34. package/assets/illustrations/editorial/custom-software.webp +0 -0
  35. package/assets/illustrations/editorial/digitalization-640.webp +0 -0
  36. package/assets/illustrations/editorial/digitalization.webp +0 -0
  37. package/assets/illustrations/editorial/integration-640.webp +0 -0
  38. package/assets/illustrations/editorial/integration.webp +0 -0
  39. package/assets/illustrations/editorial/problem-640.webp +0 -0
  40. package/assets/illustrations/editorial/problem.webp +0 -0
  41. package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
  42. package/assets/illustrations/editorial/process-analysis.webp +0 -0
  43. package/assets/illustrations/editorial/process-concept-640.webp +0 -0
  44. package/assets/illustrations/editorial/process-concept.webp +0 -0
  45. package/assets/illustrations/editorial/process-development-640.webp +0 -0
  46. package/assets/illustrations/editorial/process-development.webp +0 -0
  47. package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
  48. package/assets/illustrations/editorial/process-discovery.webp +0 -0
  49. package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
  50. package/assets/illustrations/editorial/process-maintenance.webp +0 -0
  51. package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
  52. package/assets/illustrations/editorial/process-prototype.webp +0 -0
  53. package/assets/illustrations/editorial/process-testing-640.webp +0 -0
  54. package/assets/illustrations/editorial/process-testing.webp +0 -0
  55. package/assets/illustrations/iso/automation-dark.svg +6 -0
  56. package/assets/illustrations/iso/automation.svg +6 -0
  57. package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
  58. package/assets/illustrations/iso/bar-chart.svg +6 -0
  59. package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
  60. package/assets/illustrations/iso/brackets-classic.svg +6 -0
  61. package/assets/illustrations/iso/brackets-dark.svg +6 -0
  62. package/assets/illustrations/iso/brackets.svg +6 -0
  63. package/assets/illustrations/iso/city-dark.svg +6 -0
  64. package/assets/illustrations/iso/city.svg +6 -0
  65. package/assets/illustrations/iso/conveyor-dark.svg +6 -0
  66. package/assets/illustrations/iso/conveyor.svg +6 -0
  67. package/assets/illustrations/iso/database-dark.svg +6 -0
  68. package/assets/illustrations/iso/database.svg +6 -0
  69. package/assets/illustrations/iso/documents-dark.svg +6 -0
  70. package/assets/illustrations/iso/documents.svg +6 -0
  71. package/assets/illustrations/iso/inbox-dark.svg +6 -0
  72. package/assets/illustrations/iso/inbox.svg +6 -0
  73. package/assets/illustrations/iso/laptop-dark.svg +6 -0
  74. package/assets/illustrations/iso/laptop.svg +6 -0
  75. package/assets/illustrations/iso/monitor-dark.svg +6 -0
  76. package/assets/illustrations/iso/monitor.svg +6 -0
  77. package/assets/illustrations/iso/pipeline-dark.svg +6 -0
  78. package/assets/illustrations/iso/pipeline.svg +6 -0
  79. package/assets/illustrations/iso/platform-dark.svg +6 -0
  80. package/assets/illustrations/iso/platform.svg +6 -0
  81. package/assets/illustrations/iso/server-dark.svg +6 -0
  82. package/assets/illustrations/iso/server.svg +6 -0
  83. package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
  84. package/assets/illustrations/iso/spreadsheet.svg +6 -0
  85. package/assets/illustrations/iso/timeline-dark.svg +6 -0
  86. package/assets/illustrations/iso/timeline.svg +6 -0
  87. package/assets/illustrations/sheet/construction.svg +115 -0
  88. package/assets/illustrations/sheet/crescent.svg +40 -0
  89. package/assets/illustrations/sheet/limb.svg +42 -0
  90. package/assets/illustrations/sheet/stress-axis.svg +119 -0
  91. package/assets/illustrations/sheet/totality.svg +215 -0
  92. package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
  93. package/assets/logo-left.svg +1 -0
  94. package/assets/logo-right.svg +1 -0
  95. package/assets/logo.svg +1 -0
  96. package/dist/components/_overlay.d.ts +47 -0
  97. package/dist/components/_overlay.js +59 -0
  98. package/dist/components/accordion.d.ts +32 -0
  99. package/dist/components/accordion.js +39 -0
  100. package/dist/components/alert-dialog.d.ts +45 -0
  101. package/dist/components/alert-dialog.js +56 -0
  102. package/dist/components/alert.d.ts +35 -0
  103. package/dist/components/alert.js +42 -0
  104. package/dist/components/ascii-field.d.ts +34 -0
  105. package/dist/components/ascii-field.js +410 -0
  106. package/dist/components/aspect-ratio.d.ts +14 -0
  107. package/dist/components/aspect-ratio.js +17 -0
  108. package/dist/components/avatar.d.ts +42 -0
  109. package/dist/components/avatar.js +55 -0
  110. package/dist/components/badge.d.ts +70 -0
  111. package/dist/components/badge.js +62 -0
  112. package/dist/components/bottom-nav.d.ts +86 -0
  113. package/dist/components/bottom-nav.js +175 -0
  114. package/dist/components/breadcrumb.d.ts +31 -0
  115. package/dist/components/breadcrumb.js +37 -0
  116. package/dist/components/button-group.d.ts +30 -0
  117. package/dist/components/button-group.js +47 -0
  118. package/dist/components/button.d.ts +53 -0
  119. package/dist/components/button.js +130 -0
  120. package/dist/components/calendar.d.ts +26 -0
  121. package/dist/components/calendar.js +179 -0
  122. package/dist/components/card.d.ts +42 -0
  123. package/dist/components/card.js +76 -0
  124. package/dist/components/carousel.d.ts +109 -0
  125. package/dist/components/carousel.js +231 -0
  126. package/dist/components/chart.d.ts +189 -0
  127. package/dist/components/chart.js +323 -0
  128. package/dist/components/checkbox.d.ts +23 -0
  129. package/dist/components/checkbox.js +43 -0
  130. package/dist/components/code-block.d.ts +55 -0
  131. package/dist/components/code-block.js +100 -0
  132. package/dist/components/collapsible.d.ts +20 -0
  133. package/dist/components/collapsible.js +32 -0
  134. package/dist/components/color-picker.d.ts +107 -0
  135. package/dist/components/color-picker.js +428 -0
  136. package/dist/components/combobox.d.ts +99 -0
  137. package/dist/components/combobox.js +172 -0
  138. package/dist/components/command.d.ts +132 -0
  139. package/dist/components/command.js +257 -0
  140. package/dist/components/context-menu.d.ts +29 -0
  141. package/dist/components/context-menu.js +35 -0
  142. package/dist/components/conversation.d.ts +36 -0
  143. package/dist/components/conversation.js +303 -0
  144. package/dist/components/copy-button.d.ts +55 -0
  145. package/dist/components/copy-button.js +133 -0
  146. package/dist/components/data-table.d.ts +235 -0
  147. package/dist/components/data-table.js +655 -0
  148. package/dist/components/date-picker.d.ts +160 -0
  149. package/dist/components/date-picker.js +338 -0
  150. package/dist/components/dialog.d.ts +57 -0
  151. package/dist/components/dialog.js +95 -0
  152. package/dist/components/direction.d.ts +16 -0
  153. package/dist/components/direction.js +18 -0
  154. package/dist/components/drawer.d.ts +69 -0
  155. package/dist/components/drawer.js +79 -0
  156. package/dist/components/empty.d.ts +31 -0
  157. package/dist/components/empty.js +50 -0
  158. package/dist/components/feature-list.d.ts +54 -0
  159. package/dist/components/feature-list.js +43 -0
  160. package/dist/components/field.d.ts +34 -0
  161. package/dist/components/field.js +81 -0
  162. package/dist/components/file-drop.d.ts +77 -0
  163. package/dist/components/file-drop.js +258 -0
  164. package/dist/components/filter-bar.d.ts +153 -0
  165. package/dist/components/filter-bar.js +334 -0
  166. package/dist/components/form.d.ts +35 -0
  167. package/dist/components/form.js +56 -0
  168. package/dist/components/graph.d.ts +146 -0
  169. package/dist/components/graph.js +825 -0
  170. package/dist/components/illustration.d.ts +85 -0
  171. package/dist/components/illustration.js +165 -0
  172. package/dist/components/input-group.d.ts +138 -0
  173. package/dist/components/input-group.js +312 -0
  174. package/dist/components/input.d.ts +16 -0
  175. package/dist/components/input.js +25 -0
  176. package/dist/components/item.d.ts +64 -0
  177. package/dist/components/item.js +116 -0
  178. package/dist/components/kbd.d.ts +50 -0
  179. package/dist/components/kbd.js +45 -0
  180. package/dist/components/label.d.ts +12 -0
  181. package/dist/components/label.js +24 -0
  182. package/dist/components/layout.d.ts +136 -0
  183. package/dist/components/layout.js +162 -0
  184. package/dist/components/lightbox.d.ts +100 -0
  185. package/dist/components/lightbox.js +439 -0
  186. package/dist/components/locale.d.ts +44 -0
  187. package/dist/components/locale.js +37 -0
  188. package/dist/components/logo.d.ts +54 -0
  189. package/dist/components/logo.js +96 -0
  190. package/dist/components/menu.d.ts +60 -0
  191. package/dist/components/menu.js +140 -0
  192. package/dist/components/menubar.d.ts +62 -0
  193. package/dist/components/menubar.js +223 -0
  194. package/dist/components/message.d.ts +42 -0
  195. package/dist/components/message.js +59 -0
  196. package/dist/components/meter.d.ts +31 -0
  197. package/dist/components/meter.js +27 -0
  198. package/dist/components/money-input.d.ts +80 -0
  199. package/dist/components/money-input.js +253 -0
  200. package/dist/components/native-select.d.ts +26 -0
  201. package/dist/components/native-select.js +35 -0
  202. package/dist/components/navigation-menu.d.ts +42 -0
  203. package/dist/components/navigation-menu.js +97 -0
  204. package/dist/components/number-field.d.ts +55 -0
  205. package/dist/components/number-field.js +164 -0
  206. package/dist/components/otp-field.d.ts +48 -0
  207. package/dist/components/otp-field.js +102 -0
  208. package/dist/components/pagination.d.ts +37 -0
  209. package/dist/components/pagination.js +81 -0
  210. package/dist/components/pdf-viewer.d.ts +134 -0
  211. package/dist/components/pdf-viewer.js +996 -0
  212. package/dist/components/phone-input.d.ts +79 -0
  213. package/dist/components/phone-input.js +282 -0
  214. package/dist/components/popover.d.ts +33 -0
  215. package/dist/components/popover.js +48 -0
  216. package/dist/components/preview-card.d.ts +25 -0
  217. package/dist/components/preview-card.js +22 -0
  218. package/dist/components/progress.d.ts +27 -0
  219. package/dist/components/progress.js +25 -0
  220. package/dist/components/prompt-input.d.ts +156 -0
  221. package/dist/components/prompt-input.js +415 -0
  222. package/dist/components/quote.d.ts +22 -0
  223. package/dist/components/quote.js +15 -0
  224. package/dist/components/radio-group.d.ts +18 -0
  225. package/dist/components/radio-group.js +34 -0
  226. package/dist/components/rating.d.ts +73 -0
  227. package/dist/components/rating.js +124 -0
  228. package/dist/components/reasoning.d.ts +46 -0
  229. package/dist/components/reasoning.js +73 -0
  230. package/dist/components/resizable.d.ts +47 -0
  231. package/dist/components/resizable.js +44 -0
  232. package/dist/components/response.d.ts +41 -0
  233. package/dist/components/response.js +566 -0
  234. package/dist/components/scroll-area.d.ts +33 -0
  235. package/dist/components/scroll-area.js +31 -0
  236. package/dist/components/select.d.ts +35 -0
  237. package/dist/components/select.js +71 -0
  238. package/dist/components/separator.d.ts +14 -0
  239. package/dist/components/separator.js +17 -0
  240. package/dist/components/sidebar.d.ts +163 -0
  241. package/dist/components/sidebar.js +505 -0
  242. package/dist/components/site-header.d.ts +93 -0
  243. package/dist/components/site-header.js +121 -0
  244. package/dist/components/skeleton.d.ts +31 -0
  245. package/dist/components/skeleton.js +29 -0
  246. package/dist/components/slider.d.ts +24 -0
  247. package/dist/components/slider.js +131 -0
  248. package/dist/components/sortable.d.ts +178 -0
  249. package/dist/components/sortable.js +1258 -0
  250. package/dist/components/sources.d.ts +40 -0
  251. package/dist/components/sources.js +42 -0
  252. package/dist/components/spinner.d.ts +48 -0
  253. package/dist/components/spinner.js +75 -0
  254. package/dist/components/stat.d.ts +91 -0
  255. package/dist/components/stat.js +141 -0
  256. package/dist/components/stepper.d.ts +71 -0
  257. package/dist/components/stepper.js +101 -0
  258. package/dist/components/suggestions.d.ts +20 -0
  259. package/dist/components/suggestions.js +18 -0
  260. package/dist/components/switch.d.ts +14 -0
  261. package/dist/components/switch.js +26 -0
  262. package/dist/components/table.d.ts +172 -0
  263. package/dist/components/table.js +895 -0
  264. package/dist/components/tabs.d.ts +25 -0
  265. package/dist/components/tabs.js +162 -0
  266. package/dist/components/tag.d.ts +41 -0
  267. package/dist/components/tag.js +88 -0
  268. package/dist/components/tags-input.d.ts +56 -0
  269. package/dist/components/tags-input.js +271 -0
  270. package/dist/components/textarea.d.ts +13 -0
  271. package/dist/components/textarea.js +16 -0
  272. package/dist/components/theme.d.ts +55 -0
  273. package/dist/components/theme.js +120 -0
  274. package/dist/components/time-field.d.ts +70 -0
  275. package/dist/components/time-field.js +450 -0
  276. package/dist/components/timeline.d.ts +92 -0
  277. package/dist/components/timeline.js +108 -0
  278. package/dist/components/tippy.d.ts +48 -0
  279. package/dist/components/tippy.js +648 -0
  280. package/dist/components/toast.d.ts +88 -0
  281. package/dist/components/toast.js +205 -0
  282. package/dist/components/toggle-group.d.ts +41 -0
  283. package/dist/components/toggle-group.js +140 -0
  284. package/dist/components/toggle.d.ts +23 -0
  285. package/dist/components/toggle.js +35 -0
  286. package/dist/components/tool-call.d.ts +63 -0
  287. package/dist/components/tool-call.js +68 -0
  288. package/dist/components/toolbar.d.ts +17 -0
  289. package/dist/components/toolbar.js +39 -0
  290. package/dist/components/tooltip.d.ts +42 -0
  291. package/dist/components/tooltip.js +47 -0
  292. package/dist/components/tour.d.ts +127 -0
  293. package/dist/components/tour.js +648 -0
  294. package/dist/components/tree.d.ts +75 -0
  295. package/dist/components/tree.js +649 -0
  296. package/dist/components/typography.d.ts +134 -0
  297. package/dist/components/typography.js +176 -0
  298. package/dist/components/video-player.d.ts +284 -0
  299. package/dist/components/video-player.js +1392 -0
  300. package/dist/illustration.d.ts +2 -0
  301. package/dist/illustration.js +7 -0
  302. package/dist/index.d.ts +93 -0
  303. package/dist/index.js +94 -0
  304. package/dist/lib/cn.d.ts +20 -0
  305. package/dist/lib/cn.js +38 -0
  306. package/dist/lib/code-highlight.d.ts +18 -0
  307. package/dist/lib/code-highlight.js +174 -0
  308. package/dist/lib/code-theme.d.ts +19 -0
  309. package/dist/lib/code-theme.js +140 -0
  310. package/dist/lib/collapse-row.d.ts +9 -0
  311. package/dist/lib/collapse-row.js +129 -0
  312. package/dist/lib/digit-roll.d.ts +21 -0
  313. package/dist/lib/digit-roll.js +31 -0
  314. package/dist/lib/editorial-assets.d.ts +16 -0
  315. package/dist/lib/editorial-assets.js +56 -0
  316. package/dist/lib/field-errors.d.ts +28 -0
  317. package/dist/lib/field-errors.js +24 -0
  318. package/dist/lib/field-value.d.ts +13 -0
  319. package/dist/lib/field-value.js +44 -0
  320. package/dist/lib/figure/catalog.d.ts +127 -0
  321. package/dist/lib/figure/catalog.js +130 -0
  322. package/dist/lib/figure/figures/automation.d.ts +7 -0
  323. package/dist/lib/figure/figures/automation.js +143 -0
  324. package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
  325. package/dist/lib/figure/figures/bar-chart.js +99 -0
  326. package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
  327. package/dist/lib/figure/figures/brackets-classic.js +170 -0
  328. package/dist/lib/figure/figures/brackets.d.ts +8 -0
  329. package/dist/lib/figure/figures/brackets.js +84 -0
  330. package/dist/lib/figure/figures/city.d.ts +7 -0
  331. package/dist/lib/figure/figures/city.js +93 -0
  332. package/dist/lib/figure/figures/conveyor.d.ts +7 -0
  333. package/dist/lib/figure/figures/conveyor.js +97 -0
  334. package/dist/lib/figure/figures/database.d.ts +7 -0
  335. package/dist/lib/figure/figures/database.js +65 -0
  336. package/dist/lib/figure/figures/documents.d.ts +7 -0
  337. package/dist/lib/figure/figures/documents.js +83 -0
  338. package/dist/lib/figure/figures/inbox.d.ts +7 -0
  339. package/dist/lib/figure/figures/inbox.js +92 -0
  340. package/dist/lib/figure/figures/laptop.d.ts +7 -0
  341. package/dist/lib/figure/figures/laptop.js +67 -0
  342. package/dist/lib/figure/figures/monitor.d.ts +7 -0
  343. package/dist/lib/figure/figures/monitor.js +59 -0
  344. package/dist/lib/figure/figures/pipeline.d.ts +8 -0
  345. package/dist/lib/figure/figures/pipeline.js +117 -0
  346. package/dist/lib/figure/figures/platform.d.ts +7 -0
  347. package/dist/lib/figure/figures/platform.js +117 -0
  348. package/dist/lib/figure/figures/server.d.ts +7 -0
  349. package/dist/lib/figure/figures/server.js +115 -0
  350. package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
  351. package/dist/lib/figure/figures/spreadsheet.js +87 -0
  352. package/dist/lib/figure/figures/timeline.d.ts +7 -0
  353. package/dist/lib/figure/figures/timeline.js +65 -0
  354. package/dist/lib/figure/kernel.d.ts +152 -0
  355. package/dist/lib/figure/kernel.js +576 -0
  356. package/dist/lib/figure/parts.d.ts +42 -0
  357. package/dist/lib/figure/parts.js +126 -0
  358. package/dist/lib/form-reset.d.ts +11 -0
  359. package/dist/lib/form-reset.js +22 -0
  360. package/dist/lib/glide.d.ts +53 -0
  361. package/dist/lib/glide.js +138 -0
  362. package/dist/lib/graph-layout.d.ts +58 -0
  363. package/dist/lib/graph-layout.js +209 -0
  364. package/dist/lib/illustration-drawings.d.ts +89 -0
  365. package/dist/lib/illustration-drawings.js +539 -0
  366. package/dist/lib/illustration-info.d.ts +37 -0
  367. package/dist/lib/illustration-info.js +22 -0
  368. package/dist/lib/illustration-library.d.ts +87 -0
  369. package/dist/lib/illustration-library.js +352 -0
  370. package/dist/lib/logo-geometry.d.ts +29 -0
  371. package/dist/lib/logo-geometry.js +67 -0
  372. package/dist/lib/markdown-guard.d.ts +16 -0
  373. package/dist/lib/markdown-guard.js +123 -0
  374. package/dist/lib/merge-refs.d.ts +10 -0
  375. package/dist/lib/merge-refs.js +26 -0
  376. package/dist/lib/money.d.ts +73 -0
  377. package/dist/lib/money.js +343 -0
  378. package/dist/lib/motion.d.ts +6 -0
  379. package/dist/lib/motion.js +12 -0
  380. package/dist/lib/pdf-worker.d.ts +1 -0
  381. package/dist/lib/pdf-worker.js +6 -0
  382. package/dist/lib/pdf.d.ts +19 -0
  383. package/dist/lib/pdf.js +58 -0
  384. package/dist/lib/phone-countries.d.ts +1 -0
  385. package/dist/lib/phone-countries.js +281 -0
  386. package/dist/lib/phone.d.ts +90 -0
  387. package/dist/lib/phone.js +286 -0
  388. package/dist/lib/platform.d.ts +38 -0
  389. package/dist/lib/platform.js +75 -0
  390. package/dist/lib/room.d.ts +25 -0
  391. package/dist/lib/room.js +46 -0
  392. package/dist/lib/row-index.d.ts +15 -0
  393. package/dist/lib/row-index.js +136 -0
  394. package/dist/lib/table-fit.d.ts +143 -0
  395. package/dist/lib/table-fit.js +596 -0
  396. package/dist/lib/theme-script.d.ts +31 -0
  397. package/dist/lib/theme-script.js +49 -0
  398. package/dist/lib/tippy/pixels.d.ts +47 -0
  399. package/dist/lib/tippy/pixels.js +187 -0
  400. package/dist/lib/tippy/sprite.d.ts +86 -0
  401. package/dist/lib/tippy/sprite.js +753 -0
  402. package/dist/messages/de.d.ts +12 -0
  403. package/dist/messages/de.js +326 -0
  404. package/dist/styles/expressive.css +203 -0
  405. package/dist/styles/fonts.css +145 -0
  406. package/dist/styles/index.css +207 -0
  407. package/dist/styles/material.css +317 -0
  408. package/dist/styles/parts/ai.css +361 -0
  409. package/dist/styles/parts/brand.css +75 -0
  410. package/dist/styles/parts/controls.css +774 -0
  411. package/dist/styles/parts/data.css +222 -0
  412. package/dist/styles/parts/editorial.css +120 -0
  413. package/dist/styles/parts/feedback.css +340 -0
  414. package/dist/styles/parts/foundations.css +166 -0
  415. package/dist/styles/parts/graph.css +214 -0
  416. package/dist/styles/parts/inputs.css +261 -0
  417. package/dist/styles/parts/isometric.css +124 -0
  418. package/dist/styles/parts/navigation.css +424 -0
  419. package/dist/styles/parts/overlays.css +250 -0
  420. package/dist/styles/parts/pdf.css +154 -0
  421. package/dist/styles/parts/react-flow.css +519 -0
  422. package/dist/styles/tokens.css +299 -0
  423. package/dist/vite.d.ts +66 -0
  424. package/dist/vite.js +29 -0
  425. package/package.json +183 -5
@@ -0,0 +1,566 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Lexer, Marked } from "marked";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/cn.js";
6
+ import { capNesting, overBudget } from "../lib/markdown-guard.js";
7
+ import { CodeBlock } from "./code-block.js";
8
+ import { useMessages } from "./locale.js";
9
+ const defaultMessages = { done: "Done", todo: "To do" };
10
+ /** The task boxes the renderer writes, named in English (see `checkbox` below). */
11
+ const TASK_BOX = /<input type="checkbox" disabled( checked)? aria-label="(?:Done|To do)">/g;
12
+ /** A block's HTML with its task boxes named in `text`'s words. */
13
+ function nameTaskBoxes(html, text) {
14
+ if (text === defaultMessages || !html.includes('type="checkbox"'))
15
+ return html;
16
+ return html.replace(TASK_BOX, (_, checked) => `<input type="checkbox" disabled${checked ?? ""} aria-label="${escapeHtml(checked ? text.done : text.todo)}">`);
17
+ }
18
+ /* ── Rendering ─────────────────────────────────────────────────────────────── */
19
+ const ESCAPES = {
20
+ "&": "&amp;",
21
+ "<": "&lt;",
22
+ ">": "&gt;",
23
+ '"': "&quot;",
24
+ "'": "&#39;",
25
+ };
26
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
27
+ /** Text as marked escapes it: `<>"'`, and any `&` that does not start an entity, so `&copy;` still shows ©. */
28
+ const escapeText = (text) => text.replace(/[<>"']|&(?!(?:#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, (c) => ESCAPES[c]);
29
+ /** Links a reply may carry: web, mail, in-page and relative. `javascript:`, `data:` and the rest are dropped. */
30
+ const SAFE_URL = /^(?:https?:|mailto:|#|\/(?!\/)|\.{1,2}\/)/i;
31
+ /**
32
+ * The URL a reply's link or image may point to, or null. A backslash, a space or a control
33
+ * character is refused outright: browsers read `/\evil.com` and `/<tab>/evil.com` as
34
+ * `//evil.com`, another site, which would slip past the same-site rule.
35
+ */
36
+ function safeUrl(href) {
37
+ // eslint-disable-next-line no-control-regex
38
+ if (/[\\\u0000- \u007f]/.test(href) || !SAFE_URL.test(href))
39
+ return null;
40
+ return href;
41
+ }
42
+ /*
43
+ * Model output is untrusted: it can repeat whatever was in the pages, files and prompts the model
44
+ * read, including text written to attack the app that shows it. Raw HTML in it is shown as text,
45
+ * links keep only safe URLs (external ones open in a new tab without an opener), and images become
46
+ * links, so a reply never loads a remote file — or sends data out in an image URL — on its own.
47
+ */
48
+ const markdown = new Marked({
49
+ gfm: true,
50
+ renderer: {
51
+ html({ text }) {
52
+ return escapeHtml(text);
53
+ },
54
+ // After an inline pre, code, kbd or script tag, marked passes the text on unescaped (its
55
+ // `escaped` flag): never trust it, or an img with an onerror later in the reply would run.
56
+ text(token) {
57
+ return "tokens" in token && token.tokens
58
+ ? this.parser.parseInline(token.tokens)
59
+ : escapeText(token.text);
60
+ },
61
+ link({ href, title, tokens }) {
62
+ const text = this.parser.parseInline(tokens);
63
+ const url = safeUrl(href);
64
+ if (!url)
65
+ return text;
66
+ const external = /^https?:/i.test(url);
67
+ return `<a href="${escapeHtml(url)}"${title ? ` title="${escapeHtml(title)}"` : ""}${external ? ' target="_blank" rel="noopener noreferrer"' : ""}>${text}</a>`;
68
+ },
69
+ image({ href, text, tokens }) {
70
+ // The alt text as plain text: its markdown read, its entities shown once.
71
+ const alt = tokens ? this.parser.parseInline(tokens, this.parser.textRenderer) : text;
72
+ const label = escapeText(alt || href);
73
+ const url = safeUrl(href);
74
+ if (!url)
75
+ return label;
76
+ return `<a href="${escapeHtml(url)}" target="_blank" rel="noopener noreferrer">${label}</a>`;
77
+ },
78
+ // Fenced code inside a list item or quote stays in this HTML and scrolls sideways: a tab stop,
79
+ // as CodeBlock's own `<pre>` is, so the keyboard can scroll it.
80
+ code({ text, lang }) {
81
+ const language = lang?.match(/^\S*/)?.[0];
82
+ const code = `${escapeHtml(text.replace(/\n$/, ""))}\n`;
83
+ return `<pre tabindex="0"><code${language ? ` class="language-${escapeHtml(language)}"` : ""}>${code}</code></pre>\n`;
84
+ },
85
+ // A task list item's box: the checkbox's own look (ai.css), named for what it says.
86
+ checkbox({ checked }) {
87
+ return `<input type="checkbox" disabled${checked ? ' checked aria-label="Done"' : ' aria-label="To do"'}> `;
88
+ },
89
+ },
90
+ extensions: [
91
+ {
92
+ // A paragraph (or a heading, a cell) the guard kept from the parser: the text as written,
93
+ // its line breaks kept.
94
+ name: "plain",
95
+ renderer: ({ text }) => escapeHtml(text).replace(/\n/g, "<br>"),
96
+ },
97
+ ],
98
+ });
99
+ /**
100
+ * marked's lexer, guarded: an inline run that would take the parser too long (lib/markdown-guard)
101
+ * is not parsed but kept whole, as one `plain` token. Any other run is lexed exactly as before.
102
+ * Only whole runs are judged — a paragraph, a heading, a cell — not the emphasis and link text
103
+ * marked lexes again inside them, which their run's estimate already counts.
104
+ */
105
+ class GuardedLexer extends Lexer {
106
+ depth = 0;
107
+ inlineTokens(src, tokens = []) {
108
+ if (this.depth === 0 && overBudget(src)) {
109
+ tokens.push({ type: "plain", raw: src, text: src });
110
+ return tokens;
111
+ }
112
+ this.depth++;
113
+ try {
114
+ return super.inlineTokens(src, tokens);
115
+ }
116
+ finally {
117
+ this.depth--;
118
+ }
119
+ }
120
+ }
121
+ /**
122
+ * A fence line, after what holds it: a quote's `>`, a list item's marker or indent. List markers
123
+ * count only when a space follows them.
124
+ */
125
+ const FENCE = /^((?:[ \t]*(?:>|(?:[-+*]|\d{1,9}[.)])(?=[ \t])))*[ \t]*)(`{3,}|~{3,})(.*)$/;
126
+ /** A fence's prefix as the lines inside it continue: a list marker becomes its width in spaces. */
127
+ const continuation = (prefix) => prefix.replace(/[-+*]|\d{1,9}[.)]/g, (m) => " ".repeat(m.length));
128
+ /** How far in a prefix reaches, quotes left out. */
129
+ const indentOf = (prefix) => continuation(prefix).replace(/>/g, "").replace(/\t/g, " ").length;
130
+ /**
131
+ * The code fence opened and not yet closed (with what continues its lines, to close it in the
132
+ * same list item or quote), and where the last closed one ends. A closer indented more than three
133
+ * columns past its opener is content, as in CommonMark.
134
+ */
135
+ function fences(text) {
136
+ let open = null;
137
+ let end = 0;
138
+ let offset = 0;
139
+ for (const line of text.split("\n")) {
140
+ const fence = FENCE.exec(line);
141
+ if (fence) {
142
+ const [, prefix = "", run = "", rest = ""] = fence;
143
+ if (!open) {
144
+ if (!(run[0] === "`" && rest.includes("`")))
145
+ open = { prefix: continuation(prefix), run, indent: indentOf(prefix) };
146
+ }
147
+ else if (run[0] === open.run[0] &&
148
+ run.length >= open.run.length &&
149
+ !rest.trim() &&
150
+ indentOf(prefix) <= open.indent + 3) {
151
+ open = null;
152
+ end = offset + line.length + 1;
153
+ }
154
+ }
155
+ offset += line.length + 1;
156
+ }
157
+ return { open, end };
158
+ }
159
+ /**
160
+ * A link or image whose URL is still arriving, `[text](https://exa`, as its text: what
161
+ * `/!?\[([^\]\n]*)\]\([^)\s]*$/` replaces with `$1`, found without a pattern that would backtrack
162
+ * over a long line on every frame.
163
+ */
164
+ function openLink(text) {
165
+ // The URL so far: the run at the end with no `)` or space in it, and no line break either.
166
+ let from = text.length;
167
+ while (from > 0 && !/[)\s]/.test(text[from - 1]))
168
+ from--;
169
+ const line = text.lastIndexOf("\n", from - 1);
170
+ for (let close = text.indexOf("](", from); close !== -1; close = text.indexOf("](", close + 1)) {
171
+ // Its text: from the first `[` after the last `]` or line break before it.
172
+ const start = Math.max(text.lastIndexOf("]", close - 1), line) + 1;
173
+ const open = text.slice(start, close).indexOf("[");
174
+ if (open === -1)
175
+ continue;
176
+ const at = start + open - (text[start + open - 1] === "!" ? 1 : 0);
177
+ return text.slice(0, at) + text.slice(start + open + 1, close);
178
+ }
179
+ return text;
180
+ }
181
+ /**
182
+ * A line of `-` or `=` under a line of text would make that line a heading: it is left out until
183
+ * what follows it arrives. What `/(\S[^\n]*\n[ \t>]*) {0,3}[-=]+[ \t]*$/` replaces with `$1`,
184
+ * without backtracking over a long line.
185
+ */
186
+ function underline(text) {
187
+ const cut = text.lastIndexOf("\n");
188
+ const rule = cut === -1 ? null : /^[ \t>]*(?=[-=]+[ \t]*$)/.exec(text.slice(cut + 1));
189
+ if (!rule || !/\S/.test(text.slice(text.lastIndexOf("\n", cut - 1) + 1, cut)))
190
+ return text;
191
+ return text.slice(0, cut + 1 + rule[0].length);
192
+ }
193
+ /** Puts a closing marker before any trailing space: `**word **` would not close. */
194
+ const close = (text, marker) => {
195
+ const space = /\s*$/.exec(text)[0];
196
+ return text.slice(0, text.length - space.length) + marker + space;
197
+ };
198
+ /**
199
+ * Closes what a reply cut off mid-stream would leave open, so it renders as it will look once
200
+ * finished: a code fence (with its own fence, dropping a closing one still being typed), a link or
201
+ * image whose URL is still arriving, an inline code span, bold and bold italic. A marker that has
202
+ * only just opened, with nothing after it yet — or a line of `-` that would turn the line above
203
+ * into a heading — is left out until what follows arrives: closing it at once would draw `****`,
204
+ * a rule or a heading.
205
+ */
206
+ function complete(text) {
207
+ const { open, end } = fences(text);
208
+ if (open) {
209
+ const partial = new RegExp(`\n[ \t>]*[${open.run[0]}]{1,${open.run.length}}$`);
210
+ const body = text.replace(partial, "");
211
+ return `${body}${body.endsWith("\n") ? "" : "\n"}${open.prefix}${open.run}`;
212
+ }
213
+ let out = underline(openLink(text).replace(/(^|[\s([{"'])(?:[*_]{1,3}`{0,2}|`{1,2})$/, "$1"));
214
+ // The paragraph being written — never reaching back into a code block that just closed.
215
+ const start = Math.max(out.lastIndexOf("\n\n") + 1, end);
216
+ if ((out.slice(start).match(/`/g)?.length ?? 0) % 2 === 1)
217
+ out += "`";
218
+ // Code spans stand in as a word: their `**` is literal, and bold around one still closes.
219
+ const plain = out.slice(start).replace(/`[^`]*`/g, "x");
220
+ // Bold and italic at once, opened and not closed yet, or its closer only half typed.
221
+ const both = /(^|\s)\*\*\*(?=\S)[^*]*?(\**)$/.exec(plain);
222
+ if (both && both[2].length < 3)
223
+ return close(out, "*".repeat(3 - both[2].length));
224
+ if ((plain.match(/\*\*/g)?.length ?? 0) % 2 === 1) {
225
+ // A single `*` at the end is half of the closer — unless it closes an italic of its own.
226
+ const singles = plain.replace(/\*\*/g, "").match(/\*/g)?.length ?? 0;
227
+ const half = /[^*]\*$/.test(plain) && singles % 2 === 1;
228
+ out = close(out, half ? "*" : "**");
229
+ }
230
+ return out;
231
+ }
232
+ /**
233
+ * One block per top-level token — a paragraph, a list, a table, a code fence — so that while a
234
+ * reply streams in only its last block is redrawn, and text above it stays put (and selectable).
235
+ *
236
+ * The blocks before the last two are final: while the reply grows, the next render keeps them and
237
+ * parses only the text after them, so a word costs as little at the end of a long reply as at its
238
+ * start. Not once the reply defines a link reference (`[a]: https://…`), which reaches back to the
239
+ * links above it: then all of it is parsed each time.
240
+ */
241
+ function render(source, live, parsed) {
242
+ try {
243
+ // Line breaks as marked reads them, so the tokens' text adds up to this one.
244
+ const text = capNesting((live ? complete(source) : source).replace(/\r\n?/g, "\n"));
245
+ const reuse = parsed.current && text.startsWith(parsed.current.text) ? parsed.current : null;
246
+ const from = reuse ? reuse.text.length : 0;
247
+ const tokens = new GuardedLexer(markdown.defaults).lex(text.slice(from));
248
+ const links = Object.keys(tokens.links).length > 0;
249
+ if (reuse && links) {
250
+ parsed.current = null;
251
+ return render(source, live, parsed);
252
+ }
253
+ const blocks = reuse ? reuse.blocks.slice() : [];
254
+ const settled = tokens.length - 2;
255
+ let covered = from;
256
+ let kept = blocks.length;
257
+ tokens.forEach((token, i) => {
258
+ if (token.type === "code") {
259
+ const code = token;
260
+ blocks.push({ kind: "code", text: code.text, lang: code.lang || undefined });
261
+ }
262
+ else if (token.type !== "space") {
263
+ const html = markdown.parser([token]);
264
+ if (html.trim())
265
+ blocks.push({ kind: "html", html, table: token.type === "table" });
266
+ }
267
+ if (i < settled) {
268
+ covered += token.raw.length;
269
+ kept = blocks.length;
270
+ }
271
+ });
272
+ parsed.current = links ? null : { text: text.slice(0, covered), blocks: blocks.slice(0, kept) };
273
+ return blocks;
274
+ }
275
+ catch {
276
+ parsed.current = null;
277
+ // Should the parser fail anyway (the guard keeps nesting shallow, but this is model output):
278
+ // the reply as plain text, rather than an error that takes the conversation down with it.
279
+ return [{ kind: "html", html: `<p>${escapeHtml(source).replace(/\n/g, "<br>")}</p>`, table: false }];
280
+ }
281
+ }
282
+ /** A code block redraws only when its own code changes, not on every frame of the text after it. */
283
+ const ResponseCode = React.memo(CodeBlock);
284
+ /* ── The paced reveal ──────────────────────────────────────────────────────── */
285
+ /*
286
+ * Models stream in bursts: forty characters, a pause, eighty more. Shown as they arrive, the text
287
+ * jerks. Instead the reply is revealed at an even pace on every frame — the pace the text has been
288
+ * arriving at (an average of the last bursts) plus a share of whatever is waiting, so it never
289
+ * falls far behind — a whole word at a time. Each new word comes into focus: from transparent,
290
+ * blurred and a little low, to sharp and in place, over BLUR_MS. When the stream ends, what is
291
+ * left is revealed quickly.
292
+ *
293
+ * The timing follows what is on screen, not the markdown source: after every frame that drew
294
+ * more, it notes how many visible characters there are and when. Syntax (`**`, `|`, a code
295
+ * fence) and code blocks, which take no part, never make a word that is already there come in again.
296
+ */
297
+ /** How long a new word takes to come into focus. */
298
+ const BLUR_MS = 520;
299
+ /** At most this many trailing characters take part; any before them show settled. */
300
+ const BLUR_CHARS = 360;
301
+ /** The slowest pace, in characters per second, so a slow stream still flows. */
302
+ const MIN_PACE = 32;
303
+ const reducedMotion = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
304
+ const commonPrefix = (a, b) => {
305
+ let i = 0;
306
+ while (i < a.length && i < b.length && a[i] === b[i])
307
+ i++;
308
+ return i;
309
+ };
310
+ /** How many characters of a text the reveal counts: spaces are left out. */
311
+ const visibleLength = (text) => text.replace(/\s/g, "").length;
312
+ /** Each markdown block's visible length, with the text it was counted from. */
313
+ const blockLengths = new WeakMap();
314
+ const smoothstep = (t) => t * t * (3 - 2 * t);
315
+ const graphemeSegmenter = typeof Intl !== "undefined" && "Segmenter" in Intl
316
+ ? new Intl.Segmenter(undefined, { granularity: "grapheme" })
317
+ : null;
318
+ /** Where the character (grapheme) that `index` falls in starts: an emoji or an accented letter stays whole. */
319
+ function graphemeStart(text, index) {
320
+ if (graphemeSegmenter)
321
+ return graphemeSegmenter.segment(text).containing(index)?.index ?? index;
322
+ const code = text.charCodeAt(index);
323
+ return code >= 0xdc00 && code <= 0xdfff ? index - 1 : index;
324
+ }
325
+ /**
326
+ * The text nodes the reveal may touch, in order: only the markdown's, which this component writes
327
+ * as HTML and owns. Code blocks are React's own nodes; splitting them would duplicate text on the next update.
328
+ */
329
+ function textNodes(root) {
330
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
331
+ acceptNode: (node) => {
332
+ if (!node.parentElement?.closest('[data-slot="response-markdown"]'))
333
+ return NodeFilter.FILTER_REJECT;
334
+ return /\S/.test(node.data) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
335
+ },
336
+ });
337
+ const nodes = [];
338
+ while (walker.nextNode())
339
+ nodes.push(walker.currentNode);
340
+ return nodes;
341
+ }
342
+ /** Puts back the text a previous frame wrapped, where the markup did not change since. */
343
+ function unwrapWords(root) {
344
+ const parents = new Set();
345
+ for (const span of root.querySelectorAll("[data-word]")) {
346
+ if (span.parentNode)
347
+ parents.add(span.parentNode);
348
+ span.replaceWith(...span.childNodes);
349
+ }
350
+ for (const parent of parents)
351
+ parent.normalize();
352
+ }
353
+ /** Wraps each word that ends after visible position `from` in a span, newest first. Spaces stay unwrapped. */
354
+ function wrapWords(nodes, total, from) {
355
+ const words = [];
356
+ let end = total;
357
+ for (let k = nodes.length - 1; k >= 0 && end > from; k--) {
358
+ const node = nodes[k];
359
+ // The node's words, last first: a run of non-space characters each.
360
+ const runs = [...node.data.matchAll(/\S+/g)];
361
+ for (let j = runs.length - 1; j >= 0 && end > from; j--) {
362
+ const run = runs[j];
363
+ node.splitText(run.index + run[0].length);
364
+ const piece = node.splitText(run.index);
365
+ const span = document.createElement("span");
366
+ span.setAttribute("data-word", "");
367
+ piece.replaceWith(span);
368
+ span.append(piece);
369
+ words.push({ span, end });
370
+ end -= visibleLength(run[0]);
371
+ }
372
+ }
373
+ return words;
374
+ }
375
+ /**
376
+ * Response — an assistant's reply, rendered from markdown in the brand's reading type: Licht Sans at
377
+ * 15px, Licht Light headings, mono inline code, hairline tables and rules, and fenced code as a
378
+ * `CodeBlock`, coloured by its language.
379
+ *
380
+ * While `streaming`, the reply writes itself out evenly at the pace it is arriving, a word at a
381
+ * time, each word coming into focus from a soft blur as it rises into place; half-written
382
+ * markdown renders as it will end up. Raw HTML in the markdown is shown as text, unsafe link
383
+ * targets are dropped and images become links, because model output is untrusted; a paragraph that
384
+ * would take the parser too long shows as plain text.
385
+ * The rule people break: rendering the reply with their own `dangerouslySetInnerHTML` and none of these rules.
386
+ */
387
+ export function Response({ children, streaming = false, smooth = true, highlight = true, className, ...props }) {
388
+ const root = React.useRef(null);
389
+ const [shown, setShown] = React.useState(children.length);
390
+ const pace = React.useRef({
391
+ shown: children.length,
392
+ text: children,
393
+ streaming,
394
+ rate: 0,
395
+ arrivedAt: 0,
396
+ stamps: [],
397
+ settled: -1,
398
+ frame: 0,
399
+ last: 0,
400
+ });
401
+ const words = React.useRef([]);
402
+ /** What the last render parsed: kept, and grown from, while the reply grows. */
403
+ const parsed = React.useRef(null);
404
+ const paced = smooth && !reducedMotion();
405
+ /** Draws each new word for the time since it appeared. */
406
+ const paint = React.useCallback((now) => {
407
+ const { stamps, settled } = pace.current;
408
+ // Words run newest first and stamps oldest first: walk the stamps back alongside.
409
+ let s = stamps.length - 1;
410
+ for (const { span, end } of words.current) {
411
+ while (s > 0 && stamps[s - 1].count >= end)
412
+ s--;
413
+ const at = end > settled && s >= 0 && stamps[s].count >= end ? stamps[s].at : undefined;
414
+ const e = at == null ? 1 : smoothstep(Math.min(1, (now - at) / BLUR_MS));
415
+ const style = span.style;
416
+ if (e >= 1) {
417
+ style.cssText = "";
418
+ continue;
419
+ }
420
+ style.opacity = String(e);
421
+ style.filter = `blur(${((1 - e) * 5).toFixed(2)}px)`;
422
+ // Relative, so the rise works on an inline word without breaking how the line wraps.
423
+ style.position = "relative";
424
+ style.top = `${((1 - e) * 0.3).toFixed(3)}em`;
425
+ }
426
+ }, []);
427
+ const tick = React.useCallback((now) => {
428
+ const p = pace.current;
429
+ const dt = Math.min(0.05, (now - (p.last || now)) / 1000);
430
+ p.last = now;
431
+ const target = p.text.length;
432
+ if (p.shown < target) {
433
+ const backlog = target - p.shown;
434
+ const speed = p.streaming
435
+ ? Math.max(MIN_PACE, p.rate * 0.95 + backlog * 2.2)
436
+ : Math.max(MIN_PACE * 4, backlog * 6);
437
+ const before = Math.floor(p.shown);
438
+ p.shown = Math.min(target, p.shown + speed * dt);
439
+ const after = Math.floor(p.shown);
440
+ if (after !== before)
441
+ setShown(after);
442
+ }
443
+ while (p.stamps.length && now - p.stamps[0].at >= BLUR_MS)
444
+ p.settled = Math.max(p.settled, p.stamps.shift().count);
445
+ paint(now);
446
+ if (p.shown < target || p.stamps.length) {
447
+ p.frame = requestAnimationFrame(tick);
448
+ return;
449
+ }
450
+ p.frame = 0;
451
+ p.last = 0;
452
+ // All in focus: put the text back as it was written, without the reveal's spans.
453
+ if (root.current && words.current.length)
454
+ unwrapWords(root.current);
455
+ words.current = [];
456
+ }, [paint]);
457
+ const run = React.useCallback(() => {
458
+ const p = pace.current;
459
+ if (p.frame)
460
+ return;
461
+ p.last = 0;
462
+ p.frame = requestAnimationFrame(tick);
463
+ }, [tick]);
464
+ // New text: learn the pace it arrives at, and keep the reveal running.
465
+ React.useEffect(() => {
466
+ const p = pace.current;
467
+ p.streaming = streaming;
468
+ const previous = p.text;
469
+ p.text = children;
470
+ if (!paced) {
471
+ p.shown = children.length;
472
+ setShown(children.length);
473
+ return;
474
+ }
475
+ const now = performance.now();
476
+ if (!children.startsWith(previous)) {
477
+ // Not a continuation (a new reply, a regenerated one): start again from what they share,
478
+ // which is already written.
479
+ p.shown = Math.min(p.shown, commonPrefix(previous, children));
480
+ p.stamps = [];
481
+ p.settled = -1;
482
+ p.rate = 0;
483
+ setShown(Math.floor(p.shown));
484
+ }
485
+ else if (children.length > previous.length) {
486
+ const added = children.length - previous.length;
487
+ const since = p.arrivedAt ? (now - p.arrivedAt) / 1000 : 0.25;
488
+ const instant = added / Math.max(0.03, since);
489
+ p.rate = p.rate ? p.rate * 0.7 + instant * 0.3 : instant;
490
+ }
491
+ p.arrivedAt = now;
492
+ if (p.shown < children.length)
493
+ run();
494
+ }, [children, streaming, paced, run]);
495
+ React.useEffect(() => () => {
496
+ const p = pace.current;
497
+ cancelAnimationFrame(p.frame);
498
+ p.frame = 0;
499
+ }, []);
500
+ // A text that does not continue the last one shows only what they share until the reveal catches up.
501
+ const previous = pace.current.text;
502
+ let limit = children.startsWith(previous) ? shown : Math.min(shown, commonPrefix(previous, children));
503
+ if (limit < children.length) {
504
+ // Whole words: up to the last space, never into a word (nor half an emoji).
505
+ limit = Math.max(0, children.slice(0, graphemeStart(children, limit)).search(/\s\S*$/));
506
+ }
507
+ const visible = paced ? children.slice(0, limit) : children;
508
+ const live = streaming || visible.length < children.length;
509
+ const blocks = React.useMemo(() => render(visible, live, parsed), [visible, live]);
510
+ const text = useMessages("response", defaultMessages);
511
+ // After each render: count what is on screen, stamp what is new, wrap the new words and paint them.
512
+ React.useLayoutEffect(() => {
513
+ const el = root.current;
514
+ if (!el)
515
+ return;
516
+ const p = pace.current;
517
+ if (words.current.length)
518
+ unwrapWords(el);
519
+ words.current = [];
520
+ if (!paced) {
521
+ p.stamps = [];
522
+ p.settled = -1;
523
+ return;
524
+ }
525
+ // Counted block by block, each counted once while its text stays the same: a long reply's
526
+ // settled blocks cost nothing per frame.
527
+ const markdownBlocks = [...el.querySelectorAll(':scope > [data-slot="response-markdown"]')];
528
+ const lengths = markdownBlocks.map((block) => {
529
+ const text = block.textContent ?? "";
530
+ const known = blockLengths.get(block);
531
+ if (known && known.text === text)
532
+ return known.length;
533
+ const length = visibleLength(text);
534
+ blockLengths.set(block, { text, length });
535
+ return length;
536
+ });
537
+ const total = lengths.reduce((sum, length) => sum + length, 0);
538
+ const drawn = p.stamps.at(-1)?.count ?? p.settled;
539
+ // The first frame counted: what is there is already written.
540
+ if (p.settled < 0)
541
+ p.settled = total;
542
+ else if (total > drawn)
543
+ p.stamps.push({ count: total, at: performance.now() });
544
+ else if (total < drawn) {
545
+ // The markup drew shorter (a row of pipes became a table): keep the clock in step.
546
+ for (const stamp of p.stamps)
547
+ stamp.count = Math.min(stamp.count, total);
548
+ p.settled = Math.min(p.settled, total);
549
+ }
550
+ if (!p.stamps.length)
551
+ return;
552
+ // Only the blocks the new words are in.
553
+ const from = Math.max(p.settled, total - BLUR_CHARS);
554
+ let first = markdownBlocks.length;
555
+ for (let tail = 0; first > 0 && tail < total - from;)
556
+ tail += lengths[--first];
557
+ const nodes = markdownBlocks.slice(first).flatMap(textNodes);
558
+ words.current = wrapWords(nodes, total, from);
559
+ paint(performance.now());
560
+ run();
561
+ });
562
+ return (_jsx("div", { ref: root, "data-slot": "response", "data-streaming": live ? "" : undefined, "aria-busy": live || undefined, className: cn("min-w-0 text-[15px] leading-relaxed text-foreground-soft", className), ...props, children: blocks.map((block, index) => block.kind === "code" ? (_jsx(ResponseCode, { code: block.text, language: block.lang, highlight: highlight, className: "my-4 first:mt-0 last:mb-0" }, index)) : (_jsx("div", { "data-slot": "response-markdown", "data-table": block.table ? "" : undefined,
563
+ // A table is a block of its own that scrolls sideways when it is wider than the reply,
564
+ // so its cells never break inside a word. Focusable, so the keyboard can scroll it.
565
+ tabIndex: block.table ? 0 : undefined, className: block.table ? "focus-ring" : "contents", dangerouslySetInnerHTML: { __html: nameTaskBoxes(block.html, text) } }, index))) }));
566
+ }
@@ -0,0 +1,33 @@
1
+ import { ScrollArea as BaseScrollArea } from "@base-ui/react/scroll-area";
2
+ export interface ScrollAreaProps extends BaseScrollArea.Root.Props {
3
+ /** Which scrollbars to render. Defaults to `vertical`. */
4
+ orientation?: "vertical" | "horizontal" | "both";
5
+ /** Fade the content out at edges that have more to scroll. Defaults to `true`. */
6
+ fade?: boolean;
7
+ /**
8
+ * Draw the scrollbar. Defaults to `true`. Sidebars pass `false`: they scroll without a bar,
9
+ * and the edge fade says there is more.
10
+ */
11
+ scrollbar?: boolean;
12
+ /** Class for the scrolling viewport (padding usually goes on the content instead). */
13
+ viewportClassName?: string;
14
+ /** Class for the content wrapper inside the viewport. */
15
+ contentClassName?: string;
16
+ /**
17
+ * Render the viewport as another part, so that part is the element that scrolls: a Select,
18
+ * Combobox or Autocomplete list, which scrolls its highlighted item into view itself. Give it
19
+ * `data-has-overflow-y:pe-3` so its rows stop beside the bar instead of running under it.
20
+ */
21
+ viewportRender?: BaseScrollArea.Viewport.Props["render"];
22
+ }
23
+ /**
24
+ * ScrollArea — a scrolling region with a thin, quiet scrollbar.
25
+ *
26
+ * The thumb is a 4px round bar in `--field-edge` that appears while the pointer is over the
27
+ * area or while scrolling. Edges with more content fade out using Base UI's overflow CSS
28
+ * variables, so the fade grows as you scroll away from an edge. The rule people break:
29
+ * nesting scroll areas or putting the main page in one. Let the page scroll natively; use
30
+ * this for bounded panels (a sidebar, a code listing, a long select). Sidebars never show a
31
+ * scrollbar: pass `scrollbar={false}`.
32
+ */
33
+ export declare function ScrollArea({ orientation, fade, scrollbar, viewportClassName, contentClassName, viewportRender, className, children, ...props }: ScrollAreaProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ScrollArea as BaseScrollArea } from "@base-ui/react/scroll-area";
4
+ import { cn, sx } from "../lib/cn.js";
5
+ function ScrollAreaScrollbar({ orientation }) {
6
+ return (_jsx(BaseScrollArea.Scrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn("m-1 flex touch-none rounded-full opacity-0 transition-opacity duration-(--duration) ease-(--ease) select-none", "pointer-events-none data-hovering:pointer-events-auto data-hovering:opacity-100 data-scrolling:pointer-events-auto data-scrolling:opacity-100", "data-[orientation=horizontal]:h-1 data-[orientation=vertical]:w-1"), children: _jsx(BaseScrollArea.Thumb, { "data-slot": "scroll-area-thumb", className: "rounded-full bg-field-edge transition-colors duration-(--duration) ease-(--ease) hover:bg-control-focus data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full" }) }));
7
+ }
8
+ /**
9
+ * ScrollArea — a scrolling region with a thin, quiet scrollbar.
10
+ *
11
+ * The thumb is a 4px round bar in `--field-edge` that appears while the pointer is over the
12
+ * area or while scrolling. Edges with more content fade out using Base UI's overflow CSS
13
+ * variables, so the fade grows as you scroll away from an edge. The rule people break:
14
+ * nesting scroll areas or putting the main page in one. Let the page scroll natively; use
15
+ * this for bounded panels (a sidebar, a code listing, a long select). Sidebars never show a
16
+ * scrollbar: pass `scrollbar={false}`.
17
+ */
18
+ export function ScrollArea({ orientation = "vertical", fade = true, scrollbar = true, viewportClassName, contentClassName, viewportRender, className, children, ...props }) {
19
+ const fadeAxis = !fade
20
+ ? undefined
21
+ : orientation === "both"
22
+ ? "both"
23
+ : orientation === "horizontal"
24
+ ? "x"
25
+ : "y";
26
+ return (_jsxs(BaseScrollArea.Root, { "data-slot": "scroll-area", className: sx("relative min-h-0 overflow-hidden", className), ...props, children: [_jsx(BaseScrollArea.Viewport, { "data-slot": "scroll-area-viewport", "data-scroll-viewport": "", "data-fade": fadeAxis, render: viewportRender, className: cn("size-full max-h-[inherit] overscroll-contain focus-ring", viewportClassName), children: _jsx(BaseScrollArea.Content, { "data-slot": "scroll-area-content",
27
+ // Base UI keeps the content at least as wide as what is in it (min-width: fit-content), so a
28
+ // long word or a row that does not wrap would widen a vertical area past its box, with no
29
+ // bar to scroll it back: there, the content keeps the box's width and wraps or truncates.
30
+ className: cn(orientation === "vertical" ? "min-w-0!" : "min-w-fit", contentClassName), children: children }) }), scrollbar && orientation !== "horizontal" && _jsx(ScrollAreaScrollbar, { orientation: "vertical" }), scrollbar && orientation !== "vertical" && _jsx(ScrollAreaScrollbar, { orientation: "horizontal" }), scrollbar && orientation === "both" && _jsx(BaseScrollArea.Corner, { "data-slot": "scroll-area-corner" })] }));
31
+ }
@@ -0,0 +1,35 @@
1
+ import { Select as BaseSelect } from "@base-ui/react/select";
2
+ import * as React from "react";
3
+ /**
4
+ * Select — pick one option from a list. Use `ToggleGroup` instead when there are 2–5 short
5
+ * options and seeing them side by side is the point.
6
+ *
7
+ * Pass `items` to `<Select>` so `<SelectValue>` can render the selected label.
8
+ */
9
+ export declare function Select<Value, Multiple extends boolean | undefined = false>({ inputRef, ...props }: BaseSelect.Root.Props<Value, Multiple>): React.JSX.Element;
10
+ declare const triggerSizes: {
11
+ readonly sm: "min-h-(--control-h-sm) px-2.5 text-[13px]";
12
+ readonly default: "min-h-(--control-h) ps-3.5 pe-2.5 text-[15px]";
13
+ };
14
+ export interface SelectTriggerProps extends BaseSelect.Trigger.Props {
15
+ size?: keyof typeof triggerSizes;
16
+ }
17
+ export declare function SelectTrigger({ size, className, children, ...props }: SelectTriggerProps): React.JSX.Element;
18
+ export declare function SelectValue({ className, ...props }: BaseSelect.Value.Props): React.JSX.Element;
19
+ export interface SelectContentProps extends BaseSelect.Popup.Props {
20
+ /**
21
+ * Open over the trigger, with the chosen option laid exactly on the value, as a macOS menu
22
+ * does — instead of as a list below it. Mouse only: opened by touch, or with too little room
23
+ * around the trigger, it opens below as usual.
24
+ */
25
+ alignItemWithTrigger?: boolean;
26
+ /** Positioner props: side, align, sideOffset … */
27
+ positioner?: Omit<BaseSelect.Positioner.Props, "children">;
28
+ }
29
+ export declare function SelectContent({ className, children, alignItemWithTrigger, positioner, dir, ...props }: SelectContentProps): React.JSX.Element;
30
+ export declare function SelectItem({ className, children, ...props }: BaseSelect.Item.Props): React.JSX.Element;
31
+ export declare function SelectGroup({ className, ...props }: BaseSelect.Group.Props): React.JSX.Element;
32
+ export declare function SelectGroupLabel({ className, ...props }: BaseSelect.GroupLabel.Props): React.JSX.Element;
33
+ export declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof BaseSelect.Separator>): React.JSX.Element;
34
+ export declare const SelectLabel: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
35
+ export {};