meowtail 0.0.0-stage → 0.1.0

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 (424) hide show
  1. package/ASSISTANT.md +52 -0
  2. package/JSON.md +48 -0
  3. package/LICENSE +21 -0
  4. package/README.md +474 -2
  5. package/THIRD_PARTY_NOTICES.md +27 -0
  6. package/dist/src/chat/assistant-composer.d.ts +8 -0
  7. package/dist/src/chat/assistant-composer.js +246 -0
  8. package/dist/src/chat/assistant-content.d.ts +20 -0
  9. package/dist/src/chat/assistant-content.js +66 -0
  10. package/dist/src/chat/assistant-draft.d.ts +5 -0
  11. package/dist/src/chat/assistant-draft.js +23 -0
  12. package/dist/src/chat/assistant-markdown.d.ts +11 -0
  13. package/dist/src/chat/assistant-markdown.js +33 -0
  14. package/dist/src/chat/assistant-question.d.ts +12 -0
  15. package/dist/src/chat/assistant-question.js +95 -0
  16. package/dist/src/chat/assistant-scroll.d.ts +7 -0
  17. package/dist/src/chat/assistant-scroll.js +72 -0
  18. package/dist/src/chat/assistant-types.d.ts +174 -0
  19. package/dist/src/chat/assistant-types.js +40 -0
  20. package/dist/src/chat/assistant.d.ts +9 -0
  21. package/dist/src/chat/assistant.js +294 -0
  22. package/dist/src/chat/attachments.d.ts +23 -0
  23. package/dist/src/chat/attachments.js +81 -0
  24. package/dist/src/chat/bubble.d.ts +17 -0
  25. package/dist/src/chat/bubble.js +18 -0
  26. package/dist/src/chat/composer.d.ts +36 -0
  27. package/dist/src/chat/composer.js +31 -0
  28. package/dist/src/chat/conversation-scroll.d.ts +9 -0
  29. package/dist/src/chat/conversation-scroll.js +36 -0
  30. package/dist/src/chat/conversation.d.ts +16 -0
  31. package/dist/src/chat/conversation.js +62 -0
  32. package/dist/src/chat/frame.d.ts +9 -0
  33. package/dist/src/chat/frame.js +6 -0
  34. package/dist/src/chat/header.d.ts +14 -0
  35. package/dist/src/chat/header.js +15 -0
  36. package/dist/src/chat/index.d.ts +15 -0
  37. package/dist/src/chat/index.js +15 -0
  38. package/dist/src/chat/message-actions.d.ts +9 -0
  39. package/dist/src/chat/message-actions.js +6 -0
  40. package/dist/src/chat/message-context.d.ts +2 -0
  41. package/dist/src/chat/message-context.js +2 -0
  42. package/dist/src/chat/message-list.d.ts +25 -0
  43. package/dist/src/chat/message-list.js +23 -0
  44. package/dist/src/chat/message.d.ts +24 -0
  45. package/dist/src/chat/message.js +36 -0
  46. package/dist/src/chat/process.d.ts +11 -0
  47. package/dist/src/chat/process.js +9 -0
  48. package/dist/src/chat/question.d.ts +15 -0
  49. package/dist/src/chat/question.js +7 -0
  50. package/dist/src/chat/sources.d.ts +15 -0
  51. package/dist/src/chat/sources.js +19 -0
  52. package/dist/src/chat/status.d.ts +18 -0
  53. package/dist/src/chat/status.js +16 -0
  54. package/dist/src/chat/tool-call.d.ts +21 -0
  55. package/dist/src/chat/tool-call.js +40 -0
  56. package/dist/src/clipboard.d.ts +2 -0
  57. package/dist/src/clipboard.js +44 -0
  58. package/dist/src/components/add-button.d.ts +4 -0
  59. package/dist/src/components/add-button.js +8 -0
  60. package/dist/src/components/alert.d.ts +20 -0
  61. package/dist/src/components/alert.js +16 -0
  62. package/dist/src/components/aspect-ratio.d.ts +11 -0
  63. package/dist/src/components/aspect-ratio.js +19 -0
  64. package/dist/src/components/badge.d.ts +18 -0
  65. package/dist/src/components/badge.js +16 -0
  66. package/dist/src/components/breadcrumb.d.ts +15 -0
  67. package/dist/src/components/breadcrumb.js +10 -0
  68. package/dist/src/components/button.d.ts +31 -0
  69. package/dist/src/components/button.js +26 -0
  70. package/dist/src/components/card-action.d.ts +9 -0
  71. package/dist/src/components/card-action.js +6 -0
  72. package/dist/src/components/card-content.d.ts +9 -0
  73. package/dist/src/components/card-content.js +6 -0
  74. package/dist/src/components/card-description.d.ts +9 -0
  75. package/dist/src/components/card-description.js +6 -0
  76. package/dist/src/components/card-footer.d.ts +9 -0
  77. package/dist/src/components/card-footer.js +6 -0
  78. package/dist/src/components/card-header.d.ts +9 -0
  79. package/dist/src/components/card-header.js +6 -0
  80. package/dist/src/components/card-title.d.ts +10 -0
  81. package/dist/src/components/card-title.js +6 -0
  82. package/dist/src/components/card.d.ts +17 -0
  83. package/dist/src/components/card.js +19 -0
  84. package/dist/src/components/checkbox.d.ts +18 -0
  85. package/dist/src/components/checkbox.js +44 -0
  86. package/dist/src/components/choice-group.d.ts +27 -0
  87. package/dist/src/components/choice-group.js +85 -0
  88. package/dist/src/components/choice-select.d.ts +31 -0
  89. package/dist/src/components/choice-select.js +353 -0
  90. package/dist/src/components/code-block.d.ts +13 -0
  91. package/dist/src/components/code-block.js +71 -0
  92. package/dist/src/components/container.d.ts +17 -0
  93. package/dist/src/components/container.js +16 -0
  94. package/dist/src/components/credential-source.d.ts +22 -0
  95. package/dist/src/components/credential-source.js +34 -0
  96. package/dist/src/components/description-list.d.ts +20 -0
  97. package/dist/src/components/description-list.js +13 -0
  98. package/dist/src/components/detail-section.d.ts +16 -0
  99. package/dist/src/components/detail-section.js +12 -0
  100. package/dist/src/components/dialog.d.ts +43 -0
  101. package/dist/src/components/dialog.js +29 -0
  102. package/dist/src/components/diff-block.d.ts +21 -0
  103. package/dist/src/components/diff-block.js +24 -0
  104. package/dist/src/components/disclosure.d.ts +15 -0
  105. package/dist/src/components/disclosure.js +14 -0
  106. package/dist/src/components/drawer.d.ts +19 -0
  107. package/dist/src/components/drawer.js +56 -0
  108. package/dist/src/components/empty-state.d.ts +19 -0
  109. package/dist/src/components/empty-state.js +11 -0
  110. package/dist/src/components/field-group.d.ts +13 -0
  111. package/dist/src/components/field-group.js +20 -0
  112. package/dist/src/components/field.d.ts +16 -0
  113. package/dist/src/components/field.js +48 -0
  114. package/dist/src/components/grid.d.ts +27 -0
  115. package/dist/src/components/grid.js +29 -0
  116. package/dist/src/components/hover-card.d.ts +22 -0
  117. package/dist/src/components/hover-card.js +147 -0
  118. package/dist/src/components/icon-button.d.ts +17 -0
  119. package/dist/src/components/icon-button.js +17 -0
  120. package/dist/src/components/icon-rail.d.ts +20 -0
  121. package/dist/src/components/icon-rail.js +14 -0
  122. package/dist/src/components/image-lightbox.d.ts +14 -0
  123. package/dist/src/components/image-lightbox.js +51 -0
  124. package/dist/src/components/image-preview.d.ts +16 -0
  125. package/dist/src/components/image-preview.js +42 -0
  126. package/dist/src/components/index.d.ts +88 -0
  127. package/dist/src/components/index.js +87 -0
  128. package/dist/src/components/inline.d.ts +14 -0
  129. package/dist/src/components/inline.js +23 -0
  130. package/dist/src/components/input.d.ts +10 -0
  131. package/dist/src/components/input.js +6 -0
  132. package/dist/src/components/item.d.ts +26 -0
  133. package/dist/src/components/item.js +19 -0
  134. package/dist/src/components/json-block.d.ts +18 -0
  135. package/dist/src/components/json-block.js +49 -0
  136. package/dist/src/components/json-tree.d.ts +16 -0
  137. package/dist/src/components/json-tree.js +76 -0
  138. package/dist/src/components/layout-item.d.ts +15 -0
  139. package/dist/src/components/layout-item.js +16 -0
  140. package/dist/src/components/layout-types.d.ts +18 -0
  141. package/dist/src/components/layout-types.js +13 -0
  142. package/dist/src/components/list-group.d.ts +30 -0
  143. package/dist/src/components/list-group.js +32 -0
  144. package/dist/src/components/menu.d.ts +45 -0
  145. package/dist/src/components/menu.js +227 -0
  146. package/dist/src/components/nav-item.d.ts +13 -0
  147. package/dist/src/components/nav-item.js +19 -0
  148. package/dist/src/components/output-block.d.ts +20 -0
  149. package/dist/src/components/output-block.js +66 -0
  150. package/dist/src/components/page-frame.d.ts +21 -0
  151. package/dist/src/components/page-frame.js +16 -0
  152. package/dist/src/components/page-header.d.ts +15 -0
  153. package/dist/src/components/page-header.js +9 -0
  154. package/dist/src/components/path-label.d.ts +11 -0
  155. package/dist/src/components/path-label.js +37 -0
  156. package/dist/src/components/path-picker.d.ts +18 -0
  157. package/dist/src/components/path-picker.js +83 -0
  158. package/dist/src/components/pill.d.ts +11 -0
  159. package/dist/src/components/pill.js +14 -0
  160. package/dist/src/components/popover.d.ts +31 -0
  161. package/dist/src/components/popover.js +232 -0
  162. package/dist/src/components/process-group.d.ts +17 -0
  163. package/dist/src/components/process-group.js +8 -0
  164. package/dist/src/components/process-step.d.ts +13 -0
  165. package/dist/src/components/process-step.js +7 -0
  166. package/dist/src/components/rail-item.d.ts +25 -0
  167. package/dist/src/components/rail-item.js +16 -0
  168. package/dist/src/components/rail-section.d.ts +18 -0
  169. package/dist/src/components/rail-section.js +11 -0
  170. package/dist/src/components/read-block.d.ts +24 -0
  171. package/dist/src/components/read-block.js +82 -0
  172. package/dist/src/components/region-layout-types.d.ts +19 -0
  173. package/dist/src/components/region-layout-types.js +78 -0
  174. package/dist/src/components/region-layout.d.ts +19 -0
  175. package/dist/src/components/region-layout.js +254 -0
  176. package/dist/src/components/resource-card.d.ts +22 -0
  177. package/dist/src/components/resource-card.js +20 -0
  178. package/dist/src/components/resource-link.d.ts +18 -0
  179. package/dist/src/components/resource-link.js +14 -0
  180. package/dist/src/components/risk-confirmation.d.ts +22 -0
  181. package/dist/src/components/risk-confirmation.js +45 -0
  182. package/dist/src/components/search-block.d.ts +28 -0
  183. package/dist/src/components/search-block.js +40 -0
  184. package/dist/src/components/search-input.d.ts +18 -0
  185. package/dist/src/components/search-input.js +13 -0
  186. package/dist/src/components/segmented-control.d.ts +24 -0
  187. package/dist/src/components/segmented-control.js +63 -0
  188. package/dist/src/components/select.d.ts +17 -0
  189. package/dist/src/components/select.js +6 -0
  190. package/dist/src/components/separator.d.ts +10 -0
  191. package/dist/src/components/separator.js +11 -0
  192. package/dist/src/components/shortcut-keys.d.ts +12 -0
  193. package/dist/src/components/shortcut-keys.js +7 -0
  194. package/dist/src/components/skeleton-boundary.d.ts +12 -0
  195. package/dist/src/components/skeleton-boundary.js +73 -0
  196. package/dist/src/components/skeleton.d.ts +17 -0
  197. package/dist/src/components/skeleton.js +15 -0
  198. package/dist/src/components/spinner.d.ts +10 -0
  199. package/dist/src/components/spinner.js +7 -0
  200. package/dist/src/components/stack.d.ts +13 -0
  201. package/dist/src/components/stack.js +22 -0
  202. package/dist/src/components/state-dot.d.ts +14 -0
  203. package/dist/src/components/state-dot.js +28 -0
  204. package/dist/src/components/status-dot.d.ts +34 -0
  205. package/dist/src/components/status-dot.js +25 -0
  206. package/dist/src/components/switch.d.ts +9 -0
  207. package/dist/src/components/switch.js +8 -0
  208. package/dist/src/components/tabs.d.ts +24 -0
  209. package/dist/src/components/tabs.js +90 -0
  210. package/dist/src/components/tag.d.ts +23 -0
  211. package/dist/src/components/tag.js +16 -0
  212. package/dist/src/components/terminal-block.d.ts +24 -0
  213. package/dist/src/components/terminal-block.js +103 -0
  214. package/dist/src/components/text-shimmer.d.ts +15 -0
  215. package/dist/src/components/text-shimmer.js +17 -0
  216. package/dist/src/components/textarea.d.ts +9 -0
  217. package/dist/src/components/textarea.js +6 -0
  218. package/dist/src/components/timeline.d.ts +26 -0
  219. package/dist/src/components/timeline.js +17 -0
  220. package/dist/src/components/toast.d.ts +14 -0
  221. package/dist/src/components/toast.js +7 -0
  222. package/dist/src/components/toolbar.d.ts +12 -0
  223. package/dist/src/components/toolbar.js +155 -0
  224. package/dist/src/components/tooltip.d.ts +19 -0
  225. package/dist/src/components/tooltip.js +81 -0
  226. package/dist/src/components/web-block.d.ts +24 -0
  227. package/dist/src/components/web-block.js +40 -0
  228. package/dist/src/components/window-title-bar.d.ts +25 -0
  229. package/dist/src/components/window-title-bar.js +16 -0
  230. package/dist/src/components/work-card.d.ts +21 -0
  231. package/dist/src/components/work-card.js +11 -0
  232. package/dist/src/icons/LUCIDE-LICENSE +43 -0
  233. package/dist/src/icons/README.md +9 -0
  234. package/dist/src/icons/doodle-cat.d.ts +5 -0
  235. package/dist/src/icons/doodle-cat.js +8 -0
  236. package/dist/src/icons/external-arrow.d.ts +2 -0
  237. package/dist/src/icons/external-arrow.js +5 -0
  238. package/dist/src/icons/file-type-icon.d.ts +29 -0
  239. package/dist/src/icons/file-type-icon.js +211 -0
  240. package/dist/src/icons/github.d.ts +2 -0
  241. package/dist/src/icons/github.js +5 -0
  242. package/dist/src/icons/icon.d.ts +51 -0
  243. package/dist/src/icons/icon.js +135 -0
  244. package/dist/src/icons/index.d.ts +10 -0
  245. package/dist/src/icons/index.js +10 -0
  246. package/dist/src/icons/meowland-mark.d.ts +5 -0
  247. package/dist/src/icons/meowland-mark.js +5 -0
  248. package/dist/src/icons/notes.d.ts +2 -0
  249. package/dist/src/icons/notes.js +5 -0
  250. package/dist/src/icons/plus.d.ts +2 -0
  251. package/dist/src/icons/plus.js +5 -0
  252. package/dist/src/icons/search.d.ts +2 -0
  253. package/dist/src/icons/search.js +5 -0
  254. package/dist/src/icons/tasks.d.ts +2 -0
  255. package/dist/src/icons/tasks.js +5 -0
  256. package/dist/src/index.d.ts +5 -0
  257. package/dist/src/index.js +5 -0
  258. package/dist/src/json/catalog.d.ts +169 -0
  259. package/dist/src/json/catalog.js +164 -0
  260. package/dist/src/json/index.d.ts +1 -0
  261. package/dist/src/json/index.js +1 -0
  262. package/dist/src/registry/index.d.ts +833 -0
  263. package/dist/src/registry/index.js +235 -0
  264. package/dist/src/registry.d.ts +1 -0
  265. package/dist/src/registry.js +1 -0
  266. package/dist/src/shared/dom-root.d.ts +3 -0
  267. package/dist/src/shared/dom-root.js +8 -0
  268. package/dist/src/shared/layout-style.d.ts +4 -0
  269. package/dist/src/shared/layout-style.js +13 -0
  270. package/dist/src/syntax-highlight.d.ts +26 -0
  271. package/dist/src/syntax-highlight.js +116 -0
  272. package/dist/src/theme/base.styles.d.ts +2 -0
  273. package/dist/src/theme/base.styles.js +26 -0
  274. package/dist/src/theme/chat/assistant.styles.d.ts +2 -0
  275. package/dist/src/theme/chat/assistant.styles.js +289 -0
  276. package/dist/src/theme/chat/attachments.styles.d.ts +1 -0
  277. package/dist/src/theme/chat/attachments.styles.js +255 -0
  278. package/dist/src/theme/chat/composer.styles.d.ts +1 -0
  279. package/dist/src/theme/chat/composer.styles.js +519 -0
  280. package/dist/src/theme/chat/conversation.styles.d.ts +1 -0
  281. package/dist/src/theme/chat/conversation.styles.js +57 -0
  282. package/dist/src/theme/chat/frame.styles.d.ts +1 -0
  283. package/dist/src/theme/chat/frame.styles.js +107 -0
  284. package/dist/src/theme/chat/header.styles.d.ts +1 -0
  285. package/dist/src/theme/chat/header.styles.js +93 -0
  286. package/dist/src/theme/chat/message.styles.d.ts +1 -0
  287. package/dist/src/theme/chat/message.styles.js +423 -0
  288. package/dist/src/theme/chat/question.styles.d.ts +1 -0
  289. package/dist/src/theme/chat/question.styles.js +57 -0
  290. package/dist/src/theme/chat/records.styles.d.ts +1 -0
  291. package/dist/src/theme/chat/records.styles.js +546 -0
  292. package/dist/src/theme/chat/status.styles.d.ts +1 -0
  293. package/dist/src/theme/chat/status.styles.js +75 -0
  294. package/dist/src/theme/components/alert.styles.d.ts +1 -0
  295. package/dist/src/theme/components/alert.styles.js +28 -0
  296. package/dist/src/theme/components/badge.styles.d.ts +1 -0
  297. package/dist/src/theme/components/badge.styles.js +66 -0
  298. package/dist/src/theme/components/breadcrumb.styles.d.ts +1 -0
  299. package/dist/src/theme/components/breadcrumb.styles.js +44 -0
  300. package/dist/src/theme/components/button.styles.d.ts +1 -0
  301. package/dist/src/theme/components/button.styles.js +143 -0
  302. package/dist/src/theme/components/card.styles.d.ts +1 -0
  303. package/dist/src/theme/components/card.styles.js +108 -0
  304. package/dist/src/theme/components/choice-group.styles.d.ts +1 -0
  305. package/dist/src/theme/components/choice-group.styles.js +87 -0
  306. package/dist/src/theme/components/choice-select.styles.d.ts +1 -0
  307. package/dist/src/theme/components/choice-select.styles.js +182 -0
  308. package/dist/src/theme/components/code-block.styles.d.ts +1 -0
  309. package/dist/src/theme/components/code-block.styles.js +77 -0
  310. package/dist/src/theme/components/description-list.styles.d.ts +1 -0
  311. package/dist/src/theme/components/description-list.styles.js +39 -0
  312. package/dist/src/theme/components/detail-section.styles.d.ts +1 -0
  313. package/dist/src/theme/components/detail-section.styles.js +43 -0
  314. package/dist/src/theme/components/dialog.styles.d.ts +1 -0
  315. package/dist/src/theme/components/dialog.styles.js +91 -0
  316. package/dist/src/theme/components/disclosure.styles.d.ts +1 -0
  317. package/dist/src/theme/components/disclosure.styles.js +79 -0
  318. package/dist/src/theme/components/drawer.styles.d.ts +2 -0
  319. package/dist/src/theme/components/drawer.styles.js +67 -0
  320. package/dist/src/theme/components/empty-state.styles.d.ts +1 -0
  321. package/dist/src/theme/components/empty-state.styles.js +51 -0
  322. package/dist/src/theme/components/field-group.styles.d.ts +1 -0
  323. package/dist/src/theme/components/field-group.styles.js +31 -0
  324. package/dist/src/theme/components/field.styles.d.ts +1 -0
  325. package/dist/src/theme/components/field.styles.js +31 -0
  326. package/dist/src/theme/components/hover-card.styles.d.ts +1 -0
  327. package/dist/src/theme/components/hover-card.styles.js +59 -0
  328. package/dist/src/theme/components/icon-rail.styles.d.ts +1 -0
  329. package/dist/src/theme/components/icon-rail.styles.js +236 -0
  330. package/dist/src/theme/components/image-lightbox.styles.d.ts +1 -0
  331. package/dist/src/theme/components/image-lightbox.styles.js +67 -0
  332. package/dist/src/theme/components/image-preview.styles.d.ts +1 -0
  333. package/dist/src/theme/components/image-preview.styles.js +68 -0
  334. package/dist/src/theme/components/item.styles.d.ts +1 -0
  335. package/dist/src/theme/components/item.styles.js +101 -0
  336. package/dist/src/theme/components/json.styles.d.ts +1 -0
  337. package/dist/src/theme/components/json.styles.js +127 -0
  338. package/dist/src/theme/components/layout.styles.d.ts +1 -0
  339. package/dist/src/theme/components/layout.styles.js +103 -0
  340. package/dist/src/theme/components/list-group.styles.d.ts +1 -0
  341. package/dist/src/theme/components/list-group.styles.js +98 -0
  342. package/dist/src/theme/components/menu.styles.d.ts +1 -0
  343. package/dist/src/theme/components/menu.styles.js +77 -0
  344. package/dist/src/theme/components/native-input.styles.d.ts +1 -0
  345. package/dist/src/theme/components/native-input.styles.js +113 -0
  346. package/dist/src/theme/components/nav-item.styles.d.ts +1 -0
  347. package/dist/src/theme/components/nav-item.styles.js +68 -0
  348. package/dist/src/theme/components/output-block.styles.d.ts +1 -0
  349. package/dist/src/theme/components/output-block.styles.js +226 -0
  350. package/dist/src/theme/components/page-frame.styles.d.ts +1 -0
  351. package/dist/src/theme/components/page-frame.styles.js +57 -0
  352. package/dist/src/theme/components/page-header.styles.d.ts +1 -0
  353. package/dist/src/theme/components/page-header.styles.js +39 -0
  354. package/dist/src/theme/components/path-label.styles.d.ts +1 -0
  355. package/dist/src/theme/components/path-label.styles.js +27 -0
  356. package/dist/src/theme/components/path-picker.styles.d.ts +1 -0
  357. package/dist/src/theme/components/path-picker.styles.js +33 -0
  358. package/dist/src/theme/components/pill.styles.d.ts +1 -0
  359. package/dist/src/theme/components/pill.styles.js +39 -0
  360. package/dist/src/theme/components/popover.styles.d.ts +1 -0
  361. package/dist/src/theme/components/popover.styles.js +49 -0
  362. package/dist/src/theme/components/process-group.styles.d.ts +1 -0
  363. package/dist/src/theme/components/process-group.styles.js +141 -0
  364. package/dist/src/theme/components/region-layout.styles.d.ts +1 -0
  365. package/dist/src/theme/components/region-layout.styles.js +57 -0
  366. package/dist/src/theme/components/resource-card.styles.d.ts +1 -0
  367. package/dist/src/theme/components/resource-card.styles.js +105 -0
  368. package/dist/src/theme/components/resource-card.tokens.d.ts +5 -0
  369. package/dist/src/theme/components/resource-card.tokens.js +6 -0
  370. package/dist/src/theme/components/resource-link.styles.d.ts +1 -0
  371. package/dist/src/theme/components/resource-link.styles.js +78 -0
  372. package/dist/src/theme/components/risk-confirmation.styles.d.ts +1 -0
  373. package/dist/src/theme/components/risk-confirmation.styles.js +9 -0
  374. package/dist/src/theme/components/search-input.styles.d.ts +1 -0
  375. package/dist/src/theme/components/search-input.styles.js +63 -0
  376. package/dist/src/theme/components/segmented-control.styles.d.ts +1 -0
  377. package/dist/src/theme/components/segmented-control.styles.js +63 -0
  378. package/dist/src/theme/components/separator.styles.d.ts +1 -0
  379. package/dist/src/theme/components/separator.styles.js +15 -0
  380. package/dist/src/theme/components/shortcut-keys.styles.d.ts +1 -0
  381. package/dist/src/theme/components/shortcut-keys.styles.js +34 -0
  382. package/dist/src/theme/components/skeleton.styles.d.ts +1 -0
  383. package/dist/src/theme/components/skeleton.styles.js +43 -0
  384. package/dist/src/theme/components/spinner.styles.d.ts +1 -0
  385. package/dist/src/theme/components/spinner.styles.js +27 -0
  386. package/dist/src/theme/components/state-dot.styles.d.ts +1 -0
  387. package/dist/src/theme/components/state-dot.styles.js +68 -0
  388. package/dist/src/theme/components/status-dot.styles.d.ts +1 -0
  389. package/dist/src/theme/components/status-dot.styles.js +72 -0
  390. package/dist/src/theme/components/tabs.styles.d.ts +1 -0
  391. package/dist/src/theme/components/tabs.styles.js +93 -0
  392. package/dist/src/theme/components/tag.styles.d.ts +1 -0
  393. package/dist/src/theme/components/tag.styles.js +55 -0
  394. package/dist/src/theme/components/text-shimmer.styles.d.ts +1 -0
  395. package/dist/src/theme/components/text-shimmer.styles.js +59 -0
  396. package/dist/src/theme/components/timeline.styles.d.ts +1 -0
  397. package/dist/src/theme/components/timeline.styles.js +87 -0
  398. package/dist/src/theme/components/toast.styles.d.ts +1 -0
  399. package/dist/src/theme/components/toast.styles.js +48 -0
  400. package/dist/src/theme/components/toggle.styles.d.ts +1 -0
  401. package/dist/src/theme/components/toggle.styles.js +85 -0
  402. package/dist/src/theme/components/toolbar.styles.d.ts +1 -0
  403. package/dist/src/theme/components/toolbar.styles.js +22 -0
  404. package/dist/src/theme/components/tooltip.styles.d.ts +1 -0
  405. package/dist/src/theme/components/tooltip.styles.js +26 -0
  406. package/dist/src/theme/components/web-block.styles.d.ts +1 -0
  407. package/dist/src/theme/components/web-block.styles.js +48 -0
  408. package/dist/src/theme/components/window-title-bar.styles.d.ts +6 -0
  409. package/dist/src/theme/components/window-title-bar.styles.js +57 -0
  410. package/dist/src/theme/components/work-card.styles.d.ts +1 -0
  411. package/dist/src/theme/components/work-card.styles.js +78 -0
  412. package/dist/src/theme/icons/icons.styles.d.ts +1 -0
  413. package/dist/src/theme/icons/icons.styles.js +29 -0
  414. package/dist/src/theme/index.d.ts +3 -0
  415. package/dist/src/theme/index.js +168 -0
  416. package/dist/src/theme/palette.d.ts +55 -0
  417. package/dist/src/theme/palette.js +56 -0
  418. package/dist/src/theme/shared/code-highlight.styles.d.ts +1 -0
  419. package/dist/src/theme/shared/code-highlight.styles.js +20 -0
  420. package/dist/src/theme/shared/code-highlight.tokens.d.ts +12 -0
  421. package/dist/src/theme/shared/code-highlight.tokens.js +13 -0
  422. package/dist/src/theme/tokens.d.ts +111 -0
  423. package/dist/src/theme/tokens.js +128 -0
  424. package/package.json +62 -4
@@ -0,0 +1,8 @@
1
+ import { type AssistantViewProps } from "./assistant-types.js";
2
+ export declare const assistantComposerContract: {
3
+ readonly name: "assistant-composer";
4
+ readonly parts: readonly ["root", "choices", "feedback", "file"];
5
+ };
6
+ export declare const AssistantComposer: import("meowjsx").Component<{
7
+ options: AssistantViewProps;
8
+ }, "assistant-composer", "choices" | "feedback" | "file" | "root">;
@@ -0,0 +1,246 @@
1
+ import { defineComponent, h, unwrap } from "meowjsx";
2
+ import { ChatComposer } from "./composer.js";
3
+ import { ChatAttachments } from "./attachments.js";
4
+ import { Button } from "../components/button.js";
5
+ import { ChoiceSelect } from "../components/choice-select.js";
6
+ import { Icon } from "../icons/icon.js";
7
+ import { assistantDerived } from "./assistant-content.js";
8
+ import { consumeAssistantDraft, snapshotAssistantDraft } from "./assistant-draft.js";
9
+ import { assistantCopy as defaultAssistantCopy, } from "./assistant-types.js";
10
+ export const assistantComposerContract = {
11
+ name: "assistant-composer",
12
+ parts: ["root", "choices", "feedback", "file"],
13
+ };
14
+ export const AssistantComposer = defineComponent(assistantComposerContract, ({ options }, context) => {
15
+ const assistantCopy = { ...defaultAssistantCopy, ...options.labels };
16
+ const controlled = options.draft !== undefined;
17
+ if (controlled && !options.onDraftChange && !options.readOnly)
18
+ throw new Error("A controlled Assistant draft requires onDraftChange or readOnly");
19
+ const local = context.signal(options.defaultDraft ?? { text: "", attachments: [] });
20
+ const draft = assistantDerived(context, () => controlled ? unwrap(options.draft) : local.value);
21
+ const text = assistantDerived(context, () => draft.value.text);
22
+ const pending = context.signal(false);
23
+ const attaching = context.signal(false);
24
+ const feedback = context.signal("");
25
+ const disabled = assistantDerived(context, () => options.readOnly || unwrap(options.disabled ?? false));
26
+ const submitDisabled = assistantDerived(context, () => disabled.value ||
27
+ pending.value ||
28
+ !options.onSubmit ||
29
+ (!draft.value.text.trim() && !draft.value.attachments.length));
30
+ let textVersion = 0;
31
+ let previousText = draft.value.text;
32
+ let disposed = false;
33
+ let textarea;
34
+ let fileInput;
35
+ const urls = new Set();
36
+ context.effect(() => {
37
+ if (previousText !== draft.value.text) {
38
+ previousText = draft.value.text;
39
+ textVersion++;
40
+ }
41
+ });
42
+ const change = (next, accepted = false) => {
43
+ if (!accepted && disabled.value)
44
+ return;
45
+ if (!controlled)
46
+ local.value = next;
47
+ options.onDraftChange?.(next);
48
+ };
49
+ const resize = () => {
50
+ if (!textarea)
51
+ return;
52
+ textarea.style.height = "auto";
53
+ textarea.style.height = `${textarea.scrollHeight}px`;
54
+ };
55
+ const send = async (event) => {
56
+ event.preventDefault();
57
+ if (pending.value || submitDisabled.value || !options.onSubmit)
58
+ return;
59
+ const snapshot = snapshotAssistantDraft(draft.value);
60
+ const version = textVersion;
61
+ pending.value = true;
62
+ feedback.value = "";
63
+ try {
64
+ const result = await options.onSubmit(snapshot);
65
+ if (disposed)
66
+ return;
67
+ if (result?.accepted === true) {
68
+ change(consumeAssistantDraft(draft.value, snapshot, version === textVersion), true);
69
+ }
70
+ else
71
+ feedback.value = assistantCopy.rejected;
72
+ }
73
+ catch {
74
+ if (!disposed)
75
+ feedback.value = assistantCopy.submitError;
76
+ }
77
+ finally {
78
+ if (!disposed) {
79
+ pending.value = false;
80
+ resize();
81
+ }
82
+ }
83
+ };
84
+ const attach = async (event) => {
85
+ const files = [...(event.currentTarget.files ?? [])];
86
+ event.currentTarget.value = "";
87
+ if (!files.length || disabled.value || attaching.value)
88
+ return;
89
+ attaching.value = true;
90
+ feedback.value = "";
91
+ try {
92
+ const result = options.onAttach
93
+ ? await options.onAttach(files)
94
+ : files.map((file) => {
95
+ const url = URL.createObjectURL(file);
96
+ urls.add(url);
97
+ return {
98
+ id: url,
99
+ name: file.name,
100
+ mediaType: file.type || "application/octet-stream",
101
+ sizeBytes: file.size,
102
+ url,
103
+ file,
104
+ };
105
+ });
106
+ if (!disposed && result)
107
+ change({ ...draft.value, attachments: [...draft.value.attachments, ...result] });
108
+ }
109
+ catch {
110
+ if (!disposed)
111
+ feedback.value = assistantCopy.attachError;
112
+ }
113
+ finally {
114
+ if (!disposed)
115
+ attaching.value = false;
116
+ }
117
+ };
118
+ context.onCleanup(() => {
119
+ disposed = true;
120
+ for (const url of urls)
121
+ URL.revokeObjectURL(url);
122
+ });
123
+ const localModel = context.signal(unwrap(options.models ?? [])[0]?.value ?? "");
124
+ const localReasoning = context.signal(unwrap(options.reasoningOptions ?? [])[0]?.value ?? "");
125
+ const choices = context.part("choices", "div", null, assistantDerived(context, () => {
126
+ const models = unwrap(options.models ?? []);
127
+ return models.length
128
+ ? h(ChoiceSelect, {
129
+ options: models,
130
+ value: options.model ?? localModel,
131
+ "aria-label": assistantCopy.model,
132
+ onValueChange: (value) => {
133
+ if (options.model === undefined)
134
+ localModel.value = value;
135
+ options.onModelChange?.(value);
136
+ },
137
+ placement: "top",
138
+ matchTriggerWidth: false,
139
+ })
140
+ : null;
141
+ }), assistantDerived(context, () => {
142
+ const reasoning = unwrap(options.reasoningOptions ?? []);
143
+ return reasoning.length
144
+ ? h(ChoiceSelect, {
145
+ options: reasoning,
146
+ value: options.reasoning ?? localReasoning,
147
+ "aria-label": assistantCopy.reasoning,
148
+ onValueChange: (value) => {
149
+ if (options.reasoning === undefined)
150
+ localReasoning.value = value;
151
+ options.onReasoningChange?.(value);
152
+ },
153
+ placement: "top",
154
+ matchTriggerWidth: false,
155
+ })
156
+ : null;
157
+ }), options.composerTrailing);
158
+ return context.part("root", "div", null, h(ChatComposer, {
159
+ value: text,
160
+ placeholder: assistantCopy.placeholder,
161
+ inputLabel: assistantCopy.composer,
162
+ submitLabel: assistantCopy.send,
163
+ submitDisabled,
164
+ trailing: choices,
165
+ attachments: assistantDerived(context, () => draft.value.attachments.length
166
+ ? h(ChatAttachments, {
167
+ items: draft.value.attachments.map((attachment) => ({
168
+ ...attachment,
169
+ onRemove: disabled.value
170
+ ? undefined
171
+ : () => change({
172
+ ...draft.value,
173
+ attachments: draft.value.attachments.filter((item) => item !== attachment),
174
+ }),
175
+ })),
176
+ })
177
+ : null),
178
+ hint: assistantDerived(context, () => unwrap(options.disabledReason ?? "")),
179
+ onSubmit: send,
180
+ onInput: (event) => {
181
+ textVersion++;
182
+ change({ ...draft.value, text: event.target.value });
183
+ resize();
184
+ },
185
+ onKeyDown: (event) => {
186
+ if (event.target === textarea &&
187
+ event.key === "Enter" &&
188
+ !event.shiftKey &&
189
+ !event.isComposing &&
190
+ event.keyCode !== 229)
191
+ void send(event);
192
+ },
193
+ ref: (form) => {
194
+ let active = true;
195
+ let stop;
196
+ const observer = new ResizeObserver(resize);
197
+ observer.observe(form);
198
+ // Host refs run before children mount; find the native input after this tree is mounted.
199
+ queueMicrotask(() => {
200
+ if (!active || disposed || !form.isConnected)
201
+ return;
202
+ textarea = form.querySelector("textarea");
203
+ stop = context.effect(() => {
204
+ const value = text.value;
205
+ textarea.disabled = !!disabled.value;
206
+ textarea.readOnly = !!options.readOnly;
207
+ queueMicrotask(() => {
208
+ if (!disposed && textarea) {
209
+ if (textarea.value !== value)
210
+ textarea.value = value;
211
+ resize();
212
+ }
213
+ });
214
+ });
215
+ resize();
216
+ });
217
+ return () => {
218
+ active = false;
219
+ stop?.();
220
+ observer.disconnect();
221
+ textarea = undefined;
222
+ };
223
+ },
224
+ children: options.allowAttachments === false
225
+ ? []
226
+ : [
227
+ h(Button, {
228
+ variant: "quiet",
229
+ size: "small",
230
+ "aria-label": assistantCopy.attach,
231
+ disabled: assistantDerived(context, () => disabled.value || attaching.value),
232
+ onClick: () => fileInput?.click(),
233
+ children: h(Icon, { name: "paperclip" }),
234
+ }),
235
+ context.part("file", "input", {
236
+ type: "file",
237
+ multiple: true,
238
+ hidden: true,
239
+ onChange: attach,
240
+ ref: (element) => {
241
+ fileInput = element;
242
+ },
243
+ }),
244
+ ],
245
+ }), context.part("feedback", "p", { role: "status", hidden: assistantDerived(context, () => !feedback.value) }, feedback));
246
+ });
@@ -0,0 +1,20 @@
1
+ import { type LifecycleScope, type Signal } from "meowjsx";
2
+ import type { AssistantMessage, AssistantMessagePart, AssistantProcessStep, AssistantViewProps } from "./assistant-types.js";
3
+ /** All derived values live in their owning component lifecycle. */
4
+ export declare function assistantDerived<T>(context: Pick<LifecycleScope, "signal" | "effect">, read: () => T): import("meowjsx").WritableSignal<T>;
5
+ export declare const assistantStepsContract: {
6
+ readonly name: "assistant-steps";
7
+ readonly parts: readonly ["root", "step", "label", "description", "status"];
8
+ };
9
+ export declare const AssistantSteps: import("meowjsx").Component<{
10
+ steps: Signal<readonly AssistantProcessStep[]>;
11
+ }, "assistant-steps", "description" | "label" | "root" | "status" | "step">;
12
+ export declare const AssistantPartView: import("meowjsx").Component<{
13
+ value: Signal<AssistantMessagePart>;
14
+ message: Signal<AssistantMessage>;
15
+ renderPart?: AssistantViewProps["renderPart"];
16
+ }, "assistant-part", "root">;
17
+ export declare const AssistantMessageView: import("meowjsx").Component<{
18
+ value: Signal<AssistantMessage>;
19
+ renderPart?: AssistantViewProps["renderPart"];
20
+ }, "assistant-message", "root">;
@@ -0,0 +1,66 @@
1
+ import { defineComponent, h, keyed, unwrap, } from "meowjsx";
2
+ import { ChatMessage } from "./message.js";
3
+ import { ChatAttachments } from "./attachments.js";
4
+ import { ProcessGroup } from "../components/process-group.js";
5
+ import { CodeBlock } from "../components/code-block.js";
6
+ import { StatusDot } from "../components/status-dot.js";
7
+ import { AssistantMarkdown } from "./assistant-markdown.js";
8
+ /** All derived values live in their owning component lifecycle. */
9
+ export function assistantDerived(context, read) {
10
+ const value = context.signal(read());
11
+ context.effect(() => {
12
+ value.value = read();
13
+ });
14
+ return value;
15
+ }
16
+ export const assistantStepsContract = {
17
+ name: "assistant-steps",
18
+ parts: ["root", "step", "label", "description", "status"],
19
+ };
20
+ const AssistantStep = defineComponent(assistantStepsContract, ({ value }, context) => context.part("step", "li", null, h(StatusDot, { state: assistantDerived(context, () => value.value.tone ?? "unknown") }), context.part("label", "div", null, h("strong", null, assistantDerived(context, () => value.value.title)), context.part("description", "p", { hidden: assistantDerived(context, () => !value.value.description) }, assistantDerived(context, () => value.value.description ?? ""))), context.part("status", "span", null, assistantDerived(context, () => value.value.statusText ?? ""))));
21
+ export const AssistantSteps = defineComponent(assistantStepsContract, ({ steps }, context) => context.part("root", "ol", null, keyed(steps, (step) => step.id, (value) => h(AssistantStep, { value }))));
22
+ export const AssistantPartView = defineComponent({ name: "assistant-part", parts: ["root"] }, ({ value, message, renderPart }, context) => {
23
+ // The keyed identity includes kind, so this component's structural variant is stable.
24
+ const initial = value.value;
25
+ const custom = renderPart
26
+ ? assistantDerived(context, () => renderPart(value.value, message.value))
27
+ : undefined;
28
+ let fallback;
29
+ if (initial.kind === "text") {
30
+ fallback = h(AssistantMarkdown, {
31
+ text: assistantDerived(context, () => value.value.text),
32
+ });
33
+ }
34
+ else if (initial.kind === "process") {
35
+ fallback = h(ProcessGroup, {
36
+ title: assistantDerived(context, () => value.value.title),
37
+ status: assistantDerived(context, () => value.value.statusText),
38
+ open: initial.defaultOpen ?? false,
39
+ children: h(AssistantSteps, {
40
+ steps: assistantDerived(context, () => value.value.steps),
41
+ }),
42
+ });
43
+ }
44
+ else if (initial.kind === "code") {
45
+ // CodeBlock owns its copy/wrap/highlight lifecycle. Replace only this block on code changes.
46
+ fallback = assistantDerived(context, () => {
47
+ const part = value.value;
48
+ return h(CodeBlock, { code: part.code, language: part.language });
49
+ });
50
+ }
51
+ else {
52
+ fallback = assistantDerived(context, () => h(ChatAttachments, { items: value.value.items }));
53
+ }
54
+ const content = custom ? assistantDerived(context, () => unwrap(custom) ?? fallback) : fallback;
55
+ return context.part("root", "div", { "data-assistant-part-id": initial.id, "data-kind": initial.kind }, content);
56
+ });
57
+ export const AssistantMessageView = defineComponent({ name: "assistant-message", parts: ["root"] }, ({ value, renderPart }, context) => {
58
+ const parts = assistantDerived(context, () => value.value.parts);
59
+ return context.part("root", "div", { "data-assistant-message-id": value.value.id }, h(ChatMessage, {
60
+ role: value.value.role,
61
+ author: "",
62
+ header: h("div", { "data-assistant-message-header": true }, h("strong", null, assistantDerived(context, () => value.value.author)), h("time", null, assistantDerived(context, () => value.value.timestamp ?? "")), h("span", { role: "status" }, assistantDerived(context, () => value.value.status && value.value.status !== "complete" ? value.value.status : ""))),
63
+ surface: "none",
64
+ children: keyed(parts, (part) => `${part.id}:${part.kind}`, (part) => h(AssistantPartView, { value: part, message: value, renderPart })),
65
+ }));
66
+ });
@@ -0,0 +1,5 @@
1
+ import type { AssistantDraft } from "./assistant-types.js";
2
+ /** Isolate submitted metadata from later in-place host edits; keep File and action identities. */
3
+ export declare function snapshotAssistantDraft(draft: AssistantDraft): AssistantDraft;
4
+ /** Consume only the fields accepted by this submission, never a later edit or attachment. */
5
+ export declare function consumeAssistantDraft(current: AssistantDraft, submitted: AssistantDraft, textUnchanged: boolean): AssistantDraft;
@@ -0,0 +1,23 @@
1
+ /** Isolate submitted metadata from later in-place host edits; keep File and action identities. */
2
+ export function snapshotAssistantDraft(draft) {
3
+ return {
4
+ text: draft.text,
5
+ attachments: draft.attachments.map((attachment) => ({ ...attachment })),
6
+ };
7
+ }
8
+ /** Consume only the fields accepted by this submission, never a later edit or attachment. */
9
+ export function consumeAssistantDraft(current, submitted, textUnchanged) {
10
+ const accepted = new Map(submitted.attachments.map((attachment) => [attachment.id, attachment]));
11
+ return {
12
+ text: textUnchanged && current.text === submitted.text ? "" : current.text,
13
+ attachments: current.attachments.filter((attachment) => {
14
+ const original = accepted.get(attachment.id);
15
+ return (!original ||
16
+ original.url !== attachment.url ||
17
+ original.file !== attachment.file ||
18
+ original.name !== attachment.name ||
19
+ original.mediaType !== attachment.mediaType ||
20
+ original.sizeBytes !== attachment.sizeBytes);
21
+ }),
22
+ };
23
+ }
@@ -0,0 +1,11 @@
1
+ import { type Signal } from "meowjsx";
2
+ export declare function assistantSafeLink(href: string): string | undefined;
3
+ /** Raw HTML and images are text. Only explicit safe external links become navigation. */
4
+ export declare const assistantMarkdown: (text: string) => string;
5
+ export declare const assistantMarkdownContract: {
6
+ readonly name: "assistant-markdown";
7
+ readonly parts: readonly ["root"];
8
+ };
9
+ export declare const AssistantMarkdown: import("meowjsx").Component<{
10
+ text: Signal<string>;
11
+ }, "assistant-markdown", "root">;
@@ -0,0 +1,33 @@
1
+ import { defineComponent } from "meowjsx";
2
+ import { Marked, Renderer } from "marked";
3
+ const escape = (text) => text.replace(/[&<>"']/g, (value) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[value]);
4
+ export function assistantSafeLink(href) {
5
+ try {
6
+ const url = new URL(href);
7
+ return ["http:", "https:", "mailto:"].includes(url.protocol) ? url.href : undefined;
8
+ }
9
+ catch {
10
+ return undefined;
11
+ }
12
+ }
13
+ const renderer = new Renderer();
14
+ renderer.html = ({ text }) => escape(text);
15
+ renderer.image = ({ text }) => escape(text);
16
+ renderer.link = function ({ href, title, tokens }) {
17
+ const label = this.parser.parseInline(tokens);
18
+ const link = assistantSafeLink(href);
19
+ return link
20
+ ? `<a href="${escape(link)}" target="_blank" rel="noreferrer"${title ? ` title="${escape(title)}"` : ""}>${label}</a>`
21
+ : label;
22
+ };
23
+ const markdown = new Marked({ renderer, gfm: true, breaks: true });
24
+ /** Raw HTML and images are text. Only explicit safe external links become navigation. */
25
+ export const assistantMarkdown = (text) => markdown.parse(text, { async: false });
26
+ export const assistantMarkdownContract = { name: "assistant-markdown", parts: ["root"] };
27
+ export const AssistantMarkdown = defineComponent(assistantMarkdownContract, ({ text }, context) => {
28
+ const html = context.signal({ __html: assistantMarkdown(text.value) });
29
+ context.effect(() => {
30
+ html.value = { __html: assistantMarkdown(text.value) };
31
+ });
32
+ return context.part("root", "div", { dangerouslySetInnerHTML: html });
33
+ });
@@ -0,0 +1,12 @@
1
+ import { type Signal } from "meowjsx";
2
+ import { type AssistantLabels, type AssistantQuestion, type AssistantViewProps } from "./assistant-types.js";
3
+ export declare const assistantQuestionContract: {
4
+ readonly name: "assistant-question";
5
+ readonly parts: readonly ["root", "answer", "options"];
6
+ };
7
+ export declare const AssistantQuestionView: import("meowjsx").Component<{
8
+ value: Signal<AssistantQuestion>;
9
+ onAnswer?: AssistantViewProps["onAnswer"];
10
+ onDismiss?: AssistantViewProps["onDismissQuestion"];
11
+ labels?: Partial<AssistantLabels>;
12
+ }, "assistant-question", "answer" | "options" | "root">;
@@ -0,0 +1,95 @@
1
+ import { defineComponent, h } from "meowjsx";
2
+ import { ChatQuestion } from "./question.js";
3
+ import { Button } from "../components/button.js";
4
+ import { Select } from "../components/select.js";
5
+ import { assistantDerived } from "./assistant-content.js";
6
+ import { assistantCopy as defaultAssistantCopy, } from "./assistant-types.js";
7
+ export const assistantQuestionContract = {
8
+ name: "assistant-question",
9
+ parts: ["root", "answer", "options"],
10
+ };
11
+ export const AssistantQuestionView = defineComponent(assistantQuestionContract, ({ value, onAnswer, onDismiss, labels }, context) => {
12
+ const assistantCopy = { ...defaultAssistantCopy, ...labels };
13
+ const answer = context.signal("");
14
+ const sending = context.signal(false);
15
+ const error = context.signal("");
16
+ const disabled = assistantDerived(context, () => sending.value || value.value.state !== "open" || !onAnswer);
17
+ let disposed = false;
18
+ context.onCleanup(() => {
19
+ disposed = true;
20
+ });
21
+ const submit = async (event) => {
22
+ event.preventDefault();
23
+ if (sending.value || disabled.value || !answer.value.trim() || !onAnswer)
24
+ return;
25
+ sending.value = true;
26
+ error.value = "";
27
+ try {
28
+ await onAnswer(value.value.id, answer.value);
29
+ }
30
+ catch {
31
+ if (!disposed)
32
+ error.value = assistantCopy.answerError;
33
+ }
34
+ finally {
35
+ if (!disposed)
36
+ sending.value = false;
37
+ }
38
+ // Question state and answer acceptance remain facts supplied by the host.
39
+ };
40
+ return context.part("root", "form", { onSubmit: submit }, h(ChatQuestion, {
41
+ question: assistantDerived(context, () => value.value.title),
42
+ label: assistantCopy.questions,
43
+ description: assistantDerived(context, () => value.value.description),
44
+ feedback: assistantDerived(context, () => error.value ||
45
+ value.value.feedback ||
46
+ (value.value.state === "submitting"
47
+ ? assistantCopy.questionSubmitting
48
+ : value.value.state === "answered"
49
+ ? assistantCopy.questionAnswered
50
+ : value.value.state === "unavailable"
51
+ ? assistantCopy.questionUnavailable
52
+ : "")),
53
+ children: [
54
+ context.part("options", "div", { hidden: assistantDerived(context, () => !value.value.options?.length) }, h(Select, {
55
+ value: answer,
56
+ disabled,
57
+ "aria-label": value.value.title,
58
+ onChange: (event) => {
59
+ answer.value = event.currentTarget.value;
60
+ },
61
+ children: assistantDerived(context, () => [
62
+ h("option", { value: "" }, assistantCopy.answerPlaceholder),
63
+ ...(value.value.options ?? []).map((option) => h("option", { value: option.value }, option.label)),
64
+ ]),
65
+ })),
66
+ context.part("answer", "textarea", {
67
+ value: answer,
68
+ rows: 2,
69
+ "aria-label": `${assistantCopy.answer}: ${value.value.title}`,
70
+ placeholder: assistantCopy.answerPlaceholder,
71
+ disabled,
72
+ onInput: (event) => {
73
+ answer.value = event.currentTarget.value;
74
+ },
75
+ }),
76
+ ],
77
+ actions: [
78
+ h(Button, {
79
+ type: "submit",
80
+ size: "small",
81
+ disabled: assistantDerived(context, () => disabled.value || !answer.value.trim()),
82
+ children: assistantCopy.answer,
83
+ }),
84
+ onDismiss
85
+ ? h(Button, {
86
+ variant: "quiet",
87
+ size: "small",
88
+ disabled: assistantDerived(context, () => sending.value || value.value.state !== "open"),
89
+ onClick: () => onDismiss(value.value.id),
90
+ children: assistantCopy.dismiss,
91
+ })
92
+ : null,
93
+ ],
94
+ }));
95
+ });
@@ -0,0 +1,7 @@
1
+ /** The transcript has exactly one scroll owner. The latest control belongs to this viewport. */
2
+ export declare function assistantScroll(viewport: HTMLElement, content: HTMLElement, onLatest: (latest: boolean) => void): {
3
+ beforeUpdate: () => void;
4
+ afterUpdate: () => void;
5
+ latest(): void;
6
+ dispose(): void;
7
+ };
@@ -0,0 +1,72 @@
1
+ /** The transcript has exactly one scroll owner. The latest control belongs to this viewport. */
2
+ export function assistantScroll(viewport, content, onLatest) {
3
+ let following = true;
4
+ let anchor;
5
+ let top = viewport.scrollTop;
6
+ let restoring = false;
7
+ const rows = () => [...content.querySelectorAll("[data-assistant-message-id]")];
8
+ const atLatest = () => viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop <= 24;
9
+ const capture = () => {
10
+ top = viewport.scrollTop;
11
+ const origin = viewport.getBoundingClientRect().top;
12
+ const row = rows().find((item) => item.getBoundingClientRect().bottom > origin);
13
+ anchor = row
14
+ ? { id: row.dataset.assistantMessageId, offset: row.getBoundingClientRect().top - origin }
15
+ : undefined;
16
+ };
17
+ const restore = () => {
18
+ if (!viewport.clientHeight)
19
+ return;
20
+ restoring = true;
21
+ if (following)
22
+ viewport.scrollTop = Math.max(0, viewport.scrollHeight - viewport.clientHeight);
23
+ else {
24
+ const row = anchor && rows().find((item) => item.dataset.assistantMessageId === anchor.id);
25
+ viewport.scrollTop =
26
+ row && anchor
27
+ ? viewport.scrollTop +
28
+ row.getBoundingClientRect().top -
29
+ viewport.getBoundingClientRect().top -
30
+ anchor.offset
31
+ : top;
32
+ }
33
+ capture();
34
+ onLatest(atLatest());
35
+ restoring = false;
36
+ };
37
+ const scroll = () => {
38
+ if (restoring)
39
+ return;
40
+ following = atLatest();
41
+ capture();
42
+ onLatest(following);
43
+ };
44
+ const inspectDisclosure = (event) => {
45
+ const summary = event.target instanceof Element ? event.target.closest("summary") : null;
46
+ if (!summary || !content.contains(summary))
47
+ return;
48
+ // Expanding an earlier process is a reading action, not a request to follow its new height.
49
+ following = false;
50
+ capture();
51
+ };
52
+ viewport.addEventListener("scroll", scroll, { passive: true });
53
+ viewport.addEventListener("click", inspectDisclosure);
54
+ const observer = new ResizeObserver(restore);
55
+ observer.observe(viewport);
56
+ observer.observe(content);
57
+ restore();
58
+ return {
59
+ beforeUpdate: capture,
60
+ afterUpdate: restore,
61
+ latest() {
62
+ following = true;
63
+ restore();
64
+ viewport.focus({ preventScroll: true });
65
+ },
66
+ dispose() {
67
+ observer.disconnect();
68
+ viewport.removeEventListener("scroll", scroll);
69
+ viewport.removeEventListener("click", inspectDisclosure);
70
+ },
71
+ };
72
+ }