@miragon/mcp-toolkit-ui 2.6.0 → 2.8.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 (511) hide show
  1. package/README.md +14 -5
  2. package/dist/app/adapt-data-widget.d.ts +1 -22
  3. package/dist/app/adapt-data-widget.d.ts.map +1 -1
  4. package/dist/app/adapt-data-widget.js +1 -35
  5. package/dist/app/adapt-data-widget.js.map +1 -1
  6. package/dist/app/builder/BuilderBanners.d.ts +7 -2
  7. package/dist/app/builder/BuilderBanners.d.ts.map +1 -1
  8. package/dist/app/builder/BuilderBanners.js +8 -3
  9. package/dist/app/builder/BuilderBanners.js.map +1 -1
  10. package/dist/app/builder/CanvasRow.d.ts +4 -2
  11. package/dist/app/builder/CanvasRow.d.ts.map +1 -1
  12. package/dist/app/builder/CanvasRow.js +29 -17
  13. package/dist/app/builder/CanvasRow.js.map +1 -1
  14. package/dist/app/builder/CatalogueSheet.d.ts.map +1 -1
  15. package/dist/app/builder/CatalogueSheet.js +14 -6
  16. package/dist/app/builder/CatalogueSheet.js.map +1 -1
  17. package/dist/app/builder/CellPropsSheet.d.ts +7 -3
  18. package/dist/app/builder/CellPropsSheet.d.ts.map +1 -1
  19. package/dist/app/builder/CellPropsSheet.js +10 -3
  20. package/dist/app/builder/CellPropsSheet.js.map +1 -1
  21. package/dist/app/builder/DiscardDialog.d.ts +18 -0
  22. package/dist/app/builder/DiscardDialog.d.ts.map +1 -0
  23. package/dist/app/builder/DiscardDialog.js +18 -0
  24. package/dist/app/builder/DiscardDialog.js.map +1 -0
  25. package/dist/app/builder/EmptyHint.d.ts +4 -0
  26. package/dist/app/builder/EmptyHint.d.ts.map +1 -1
  27. package/dist/app/builder/EmptyHint.js +6 -1
  28. package/dist/app/builder/EmptyHint.js.map +1 -1
  29. package/dist/app/builder/LayoutSurface.d.ts +33 -9
  30. package/dist/app/builder/LayoutSurface.d.ts.map +1 -1
  31. package/dist/app/builder/LayoutSurface.js +74 -23
  32. package/dist/app/builder/LayoutSurface.js.map +1 -1
  33. package/dist/app/builder/PipelineStrip.d.ts +5 -2
  34. package/dist/app/builder/PipelineStrip.d.ts.map +1 -1
  35. package/dist/app/builder/PipelineStrip.js +33 -15
  36. package/dist/app/builder/PipelineStrip.js.map +1 -1
  37. package/dist/app/builder/SaveDialog.d.ts +9 -1
  38. package/dist/app/builder/SaveDialog.d.ts.map +1 -1
  39. package/dist/app/builder/SaveDialog.js +9 -3
  40. package/dist/app/builder/SaveDialog.js.map +1 -1
  41. package/dist/app/builder/Toolbar.d.ts +14 -4
  42. package/dist/app/builder/Toolbar.d.ts.map +1 -1
  43. package/dist/app/builder/Toolbar.js +24 -7
  44. package/dist/app/builder/Toolbar.js.map +1 -1
  45. package/dist/app/builder/Workspace.d.ts +23 -3
  46. package/dist/app/builder/Workspace.d.ts.map +1 -1
  47. package/dist/app/builder/Workspace.js +58 -8
  48. package/dist/app/builder/Workspace.js.map +1 -1
  49. package/dist/app/builder/builder-model.d.ts +146 -3
  50. package/dist/app/builder/builder-model.d.ts.map +1 -1
  51. package/dist/app/builder/builder-model.js +196 -5
  52. package/dist/app/builder/builder-model.js.map +1 -1
  53. package/dist/app/builder/labels.d.ts +13 -62
  54. package/dist/app/builder/labels.d.ts.map +1 -1
  55. package/dist/app/builder/labels.js +9 -58
  56. package/dist/app/builder/labels.js.map +1 -1
  57. package/dist/app/builder/reveal.d.ts +10 -0
  58. package/dist/app/builder/reveal.d.ts.map +1 -0
  59. package/dist/app/builder/reveal.js +10 -0
  60. package/dist/app/builder/reveal.js.map +1 -0
  61. package/dist/app/builder/status-chip.d.ts.map +1 -1
  62. package/dist/app/builder/status-chip.js +3 -2
  63. package/dist/app/builder/status-chip.js.map +1 -1
  64. package/dist/app/builder/use-builder-catalogue.d.ts +5 -1
  65. package/dist/app/builder/use-builder-catalogue.d.ts.map +1 -1
  66. package/dist/app/builder/use-builder-catalogue.js +50 -17
  67. package/dist/app/builder/use-builder-catalogue.js.map +1 -1
  68. package/dist/app/builder/use-builder-session.d.ts +30 -0
  69. package/dist/app/builder/use-builder-session.d.ts.map +1 -0
  70. package/dist/app/builder/use-builder-session.js +58 -0
  71. package/dist/app/builder/use-builder-session.js.map +1 -0
  72. package/dist/app/builder/use-display-resolver.d.ts +17 -0
  73. package/dist/app/builder/use-display-resolver.d.ts.map +1 -0
  74. package/dist/app/builder/use-display-resolver.js +16 -0
  75. package/dist/app/builder/use-display-resolver.js.map +1 -0
  76. package/dist/app/builder/use-save-dashboard.d.ts +3 -1
  77. package/dist/app/builder/use-save-dashboard.d.ts.map +1 -1
  78. package/dist/app/builder/use-save-dashboard.js +3 -1
  79. package/dist/app/builder/use-save-dashboard.js.map +1 -1
  80. package/dist/app/index.d.ts +8 -3
  81. package/dist/app/index.d.ts.map +1 -1
  82. package/dist/app/index.js +8 -2
  83. package/dist/app/index.js.map +1 -1
  84. package/dist/app/layout-builder.d.ts +18 -25
  85. package/dist/app/layout-builder.d.ts.map +1 -1
  86. package/dist/app/layout-builder.js +84 -78
  87. package/dist/app/layout-builder.js.map +1 -1
  88. package/dist/app/mcp-app-view-chrome.d.ts +103 -20
  89. package/dist/app/mcp-app-view-chrome.d.ts.map +1 -1
  90. package/dist/app/mcp-app-view-chrome.js +125 -40
  91. package/dist/app/mcp-app-view-chrome.js.map +1 -1
  92. package/dist/app/mcp-app-view-states.d.ts +23 -0
  93. package/dist/app/mcp-app-view-states.d.ts.map +1 -0
  94. package/dist/app/mcp-app-view-states.js +55 -0
  95. package/dist/app/mcp-app-view-states.js.map +1 -0
  96. package/dist/app/mcp-app-view.d.ts +72 -5
  97. package/dist/app/mcp-app-view.d.ts.map +1 -1
  98. package/dist/app/mcp-app-view.js +241 -141
  99. package/dist/app/mcp-app-view.js.map +1 -1
  100. package/dist/app/mcp-toolkit-app.d.ts +8 -2
  101. package/dist/app/mcp-toolkit-app.d.ts.map +1 -1
  102. package/dist/app/mcp-toolkit-app.js +33 -4
  103. package/dist/app/mcp-toolkit-app.js.map +1 -1
  104. package/dist/app/mcp-use-host-bridge.d.ts +15 -6
  105. package/dist/app/mcp-use-host-bridge.d.ts.map +1 -1
  106. package/dist/app/mcp-use-host-bridge.js +51 -22
  107. package/dist/app/mcp-use-host-bridge.js.map +1 -1
  108. package/dist/app/model-context.d.ts +71 -0
  109. package/dist/app/model-context.d.ts.map +1 -0
  110. package/dist/app/model-context.js +101 -0
  111. package/dist/app/model-context.js.map +1 -0
  112. package/dist/app/use-build-mode-focus.d.ts +33 -0
  113. package/dist/app/use-build-mode-focus.d.ts.map +1 -0
  114. package/dist/app/use-build-mode-focus.js +59 -0
  115. package/dist/app/use-build-mode-focus.js.map +1 -0
  116. package/dist/app/use-view-actions.d.ts +31 -0
  117. package/dist/app/use-view-actions.d.ts.map +1 -0
  118. package/dist/app/use-view-actions.js +81 -0
  119. package/dist/app/use-view-actions.js.map +1 -0
  120. package/dist/app/use-view-lifecycle.d.ts +42 -0
  121. package/dist/app/use-view-lifecycle.d.ts.map +1 -0
  122. package/dist/app/use-view-lifecycle.js +81 -0
  123. package/dist/app/use-view-lifecycle.js.map +1 -0
  124. package/dist/app/view-lifecycle.d.ts +185 -0
  125. package/dist/app/view-lifecycle.d.ts.map +1 -0
  126. package/dist/app/view-lifecycle.js +207 -0
  127. package/dist/app/view-lifecycle.js.map +1 -0
  128. package/dist/app/widget-fixture.d.ts +10 -3
  129. package/dist/app/widget-fixture.d.ts.map +1 -1
  130. package/dist/app/widget-fixture.js +21 -8
  131. package/dist/app/widget-fixture.js.map +1 -1
  132. package/dist/app/widget-props-sheet.d.ts +6 -10
  133. package/dist/app/widget-props-sheet.d.ts.map +1 -1
  134. package/dist/app/widget-props-sheet.js +25 -20
  135. package/dist/app/widget-props-sheet.js.map +1 -1
  136. package/dist/app/widget-renderer.d.ts +41 -1
  137. package/dist/app/widget-renderer.d.ts.map +1 -1
  138. package/dist/app/widget-renderer.js +82 -31
  139. package/dist/app/widget-renderer.js.map +1 -1
  140. package/dist/components/DrillButton.d.ts +9 -6
  141. package/dist/components/DrillButton.d.ts.map +1 -1
  142. package/dist/components/DrillButton.js +9 -6
  143. package/dist/components/DrillButton.js.map +1 -1
  144. package/dist/components/EmptyState.d.ts +33 -0
  145. package/dist/components/EmptyState.d.ts.map +1 -0
  146. package/dist/components/EmptyState.js +19 -0
  147. package/dist/components/EmptyState.js.map +1 -0
  148. package/dist/components/ErrorState.d.ts +53 -0
  149. package/dist/components/ErrorState.d.ts.map +1 -0
  150. package/dist/components/ErrorState.js +77 -0
  151. package/dist/components/ErrorState.js.map +1 -0
  152. package/dist/components/FilterBar.d.ts +16 -5
  153. package/dist/components/FilterBar.d.ts.map +1 -1
  154. package/dist/components/FilterBar.js +13 -5
  155. package/dist/components/FilterBar.js.map +1 -1
  156. package/dist/components/GroupCard.d.ts.map +1 -1
  157. package/dist/components/GroupCard.js +2 -1
  158. package/dist/components/GroupCard.js.map +1 -1
  159. package/dist/components/KpiGrid.d.ts +70 -18
  160. package/dist/components/KpiGrid.d.ts.map +1 -1
  161. package/dist/components/KpiGrid.js +112 -23
  162. package/dist/components/KpiGrid.js.map +1 -1
  163. package/dist/components/ListFooter.d.ts +32 -4
  164. package/dist/components/ListFooter.d.ts.map +1 -1
  165. package/dist/components/ListFooter.js +35 -6
  166. package/dist/components/ListFooter.js.map +1 -1
  167. package/dist/components/PagedListFooter.d.ts +57 -0
  168. package/dist/components/PagedListFooter.d.ts.map +1 -0
  169. package/dist/components/PagedListFooter.js +27 -0
  170. package/dist/components/PagedListFooter.js.map +1 -0
  171. package/dist/components/Pills.d.ts +36 -12
  172. package/dist/components/Pills.d.ts.map +1 -1
  173. package/dist/components/Pills.js +29 -8
  174. package/dist/components/Pills.js.map +1 -1
  175. package/dist/components/SectionHeading.d.ts +3 -1
  176. package/dist/components/SectionHeading.d.ts.map +1 -1
  177. package/dist/components/SectionHeading.js +6 -2
  178. package/dist/components/SectionHeading.js.map +1 -1
  179. package/dist/components/Toast.d.ts +43 -0
  180. package/dist/components/Toast.d.ts.map +1 -0
  181. package/dist/components/Toast.js +106 -0
  182. package/dist/components/Toast.js.map +1 -0
  183. package/dist/components/WidgetHeader.d.ts +34 -10
  184. package/dist/components/WidgetHeader.d.ts.map +1 -1
  185. package/dist/components/WidgetHeader.js +11 -6
  186. package/dist/components/WidgetHeader.js.map +1 -1
  187. package/dist/hooks/index.d.ts +4 -4
  188. package/dist/hooks/index.d.ts.map +1 -1
  189. package/dist/hooks/index.js +1 -1
  190. package/dist/hooks/index.js.map +1 -1
  191. package/dist/hooks/tool-result-recovery-model.d.ts +155 -0
  192. package/dist/hooks/tool-result-recovery-model.d.ts.map +1 -0
  193. package/dist/hooks/tool-result-recovery-model.js +273 -0
  194. package/dist/hooks/tool-result-recovery-model.js.map +1 -0
  195. package/dist/hooks/use-tool-query.d.ts +56 -14
  196. package/dist/hooks/use-tool-query.d.ts.map +1 -1
  197. package/dist/hooks/use-tool-query.js +102 -25
  198. package/dist/hooks/use-tool-query.js.map +1 -1
  199. package/dist/hooks/use-tool-result-recovery.d.ts +61 -44
  200. package/dist/hooks/use-tool-result-recovery.d.ts.map +1 -1
  201. package/dist/hooks/use-tool-result-recovery.js +62 -110
  202. package/dist/hooks/use-tool-result-recovery.js.map +1 -1
  203. package/dist/hooks/use-view-data.d.ts +55 -7
  204. package/dist/hooks/use-view-data.d.ts.map +1 -1
  205. package/dist/hooks/use-view-data.js +81 -11
  206. package/dist/hooks/use-view-data.js.map +1 -1
  207. package/dist/hooks/use-view-tool-query.d.ts +12 -7
  208. package/dist/hooks/use-view-tool-query.d.ts.map +1 -1
  209. package/dist/hooks/use-view-tool-query.js +15 -14
  210. package/dist/hooks/use-view-tool-query.js.map +1 -1
  211. package/dist/index.d.ts +27 -13
  212. package/dist/index.d.ts.map +1 -1
  213. package/dist/index.js +29 -7
  214. package/dist/index.js.map +1 -1
  215. package/dist/lib/focus-return.d.ts +61 -0
  216. package/dist/lib/focus-return.d.ts.map +1 -0
  217. package/dist/lib/focus-return.js +46 -0
  218. package/dist/lib/focus-return.js.map +1 -0
  219. package/dist/lib/focus-ring.d.ts +18 -0
  220. package/dist/lib/focus-ring.d.ts.map +1 -0
  221. package/dist/lib/focus-ring.js +18 -0
  222. package/dist/lib/focus-ring.js.map +1 -0
  223. package/dist/lib/icon-stroke.d.ts +12 -0
  224. package/dist/lib/icon-stroke.d.ts.map +1 -0
  225. package/dist/lib/icon-stroke.js +12 -0
  226. package/dist/lib/icon-stroke.js.map +1 -0
  227. package/dist/lib/parse-tool-result.d.ts +23 -1
  228. package/dist/lib/parse-tool-result.d.ts.map +1 -1
  229. package/dist/lib/parse-tool-result.js +38 -2
  230. package/dist/lib/parse-tool-result.js.map +1 -1
  231. package/dist/lib/toast-model.d.ts +86 -0
  232. package/dist/lib/toast-model.d.ts.map +1 -0
  233. package/dist/lib/toast-model.js +102 -0
  234. package/dist/lib/toast-model.js.map +1 -0
  235. package/dist/lib/tone-utils.d.ts +95 -9
  236. package/dist/lib/tone-utils.d.ts.map +1 -1
  237. package/dist/lib/tone-utils.js +100 -9
  238. package/dist/lib/tone-utils.js.map +1 -1
  239. package/dist/lib/tool-query.d.ts +107 -0
  240. package/dist/lib/tool-query.d.ts.map +1 -0
  241. package/dist/lib/tool-query.js +182 -0
  242. package/dist/lib/tool-query.js.map +1 -0
  243. package/dist/lib/tool-result-observer.d.ts +108 -0
  244. package/dist/lib/tool-result-observer.d.ts.map +1 -0
  245. package/dist/lib/tool-result-observer.js +158 -0
  246. package/dist/lib/tool-result-observer.js.map +1 -0
  247. package/dist/lib/typography.d.ts +37 -0
  248. package/dist/lib/typography.d.ts.map +1 -0
  249. package/dist/lib/typography.js +41 -0
  250. package/dist/lib/typography.js.map +1 -0
  251. package/dist/lib/utils.d.ts.map +1 -1
  252. package/dist/lib/utils.js +11 -1
  253. package/dist/lib/utils.js.map +1 -1
  254. package/dist/locale/index.d.ts +3 -1
  255. package/dist/locale/index.d.ts.map +1 -1
  256. package/dist/locale/index.js +2 -1
  257. package/dist/locale/index.js.map +1 -1
  258. package/dist/locale/locale-provider.d.ts +42 -1
  259. package/dist/locale/locale-provider.d.ts.map +1 -1
  260. package/dist/locale/locale-provider.js +44 -3
  261. package/dist/locale/locale-provider.js.map +1 -1
  262. package/dist/locale/message-types.d.ts +336 -0
  263. package/dist/locale/message-types.d.ts.map +1 -0
  264. package/dist/locale/message-types.js +7 -0
  265. package/dist/locale/message-types.js.map +1 -0
  266. package/dist/locale/messages-de.d.ts +9 -0
  267. package/dist/locale/messages-de.d.ts.map +1 -0
  268. package/dist/locale/messages-de.js +185 -0
  269. package/dist/locale/messages-de.js.map +1 -0
  270. package/dist/locale/messages-en.d.ts +8 -0
  271. package/dist/locale/messages-en.d.ts.map +1 -0
  272. package/dist/locale/messages-en.js +184 -0
  273. package/dist/locale/messages-en.js.map +1 -0
  274. package/dist/locale/toolkit-messages.d.ts +57 -0
  275. package/dist/locale/toolkit-messages.d.ts.map +1 -0
  276. package/dist/locale/toolkit-messages.js +103 -0
  277. package/dist/locale/toolkit-messages.js.map +1 -0
  278. package/dist/primitives/alert.d.ts +1 -1
  279. package/dist/primitives/alert.d.ts.map +1 -1
  280. package/dist/primitives/alert.js +6 -2
  281. package/dist/primitives/alert.js.map +1 -1
  282. package/dist/primitives/badge.d.ts +1 -1
  283. package/dist/primitives/badge.d.ts.map +1 -1
  284. package/dist/primitives/badge.js +19 -6
  285. package/dist/primitives/badge.js.map +1 -1
  286. package/dist/primitives/button.d.ts +1 -1
  287. package/dist/primitives/button.d.ts.map +1 -1
  288. package/dist/primitives/button.js +12 -8
  289. package/dist/primitives/button.js.map +1 -1
  290. package/dist/primitives/card.js +4 -4
  291. package/dist/primitives/card.js.map +1 -1
  292. package/dist/primitives/dialog.d.ts +7 -3
  293. package/dist/primitives/dialog.d.ts.map +1 -1
  294. package/dist/primitives/dialog.js +22 -8
  295. package/dist/primitives/dialog.js.map +1 -1
  296. package/dist/primitives/input.d.ts.map +1 -1
  297. package/dist/primitives/input.js +4 -1
  298. package/dist/primitives/input.js.map +1 -1
  299. package/dist/primitives/scroll-area.js +1 -1
  300. package/dist/primitives/scroll-area.js.map +1 -1
  301. package/dist/primitives/select.d.ts.map +1 -1
  302. package/dist/primitives/select.js +6 -3
  303. package/dist/primitives/select.js.map +1 -1
  304. package/dist/primitives/sheet.d.ts +3 -1
  305. package/dist/primitives/sheet.d.ts.map +1 -1
  306. package/dist/primitives/sheet.js +17 -7
  307. package/dist/primitives/sheet.js.map +1 -1
  308. package/dist/primitives/skeleton.js +1 -1
  309. package/dist/primitives/skeleton.js.map +1 -1
  310. package/dist/primitives/switch.d.ts.map +1 -1
  311. package/dist/primitives/switch.js +2 -1
  312. package/dist/primitives/switch.js.map +1 -1
  313. package/dist/primitives/tabs.d.ts.map +1 -1
  314. package/dist/primitives/tabs.js +5 -3
  315. package/dist/primitives/tabs.js.map +1 -1
  316. package/dist/providers/query-provider.d.ts +32 -1
  317. package/dist/providers/query-provider.d.ts.map +1 -1
  318. package/dist/providers/query-provider.js +53 -4
  319. package/dist/providers/query-provider.js.map +1 -1
  320. package/dist/render-cases-primitives.js +1 -1
  321. package/dist/render-cases-primitives.js.map +1 -1
  322. package/dist/render-cases.d.ts.map +1 -1
  323. package/dist/render-cases.js +48 -6
  324. package/dist/render-cases.js.map +1 -1
  325. package/dist/render-effects.d.ts +42 -0
  326. package/dist/render-effects.d.ts.map +1 -0
  327. package/dist/render-effects.js +81 -0
  328. package/dist/render-effects.js.map +1 -0
  329. package/dist/render-scan.d.ts +25 -0
  330. package/dist/render-scan.d.ts.map +1 -0
  331. package/dist/render-scan.js +66 -0
  332. package/dist/render-scan.js.map +1 -0
  333. package/dist/theme/cd-tokens.d.ts +66 -0
  334. package/dist/theme/cd-tokens.d.ts.map +1 -0
  335. package/dist/theme/cd-tokens.js +64 -0
  336. package/dist/theme/cd-tokens.js.map +1 -0
  337. package/dist/theme/create-theme.d.ts +214 -39
  338. package/dist/theme/create-theme.d.ts.map +1 -1
  339. package/dist/theme/create-theme.js +204 -13
  340. package/dist/theme/create-theme.js.map +1 -1
  341. package/dist/theme/fonts.d.ts +38 -0
  342. package/dist/theme/fonts.d.ts.map +1 -0
  343. package/dist/theme/fonts.js +56 -0
  344. package/dist/theme/fonts.js.map +1 -0
  345. package/dist/theme/host-fonts.d.ts +39 -0
  346. package/dist/theme/host-fonts.d.ts.map +1 -0
  347. package/dist/theme/host-fonts.js +44 -0
  348. package/dist/theme/host-fonts.js.map +1 -0
  349. package/dist/theme/index.d.ts +8 -1
  350. package/dist/theme/index.d.ts.map +1 -1
  351. package/dist/theme/index.js +5 -1
  352. package/dist/theme/index.js.map +1 -1
  353. package/dist/theme/portal-container.d.ts +16 -0
  354. package/dist/theme/portal-container.d.ts.map +1 -0
  355. package/dist/theme/portal-container.js +19 -0
  356. package/dist/theme/portal-container.js.map +1 -0
  357. package/dist/theme/presets.d.ts +24 -9
  358. package/dist/theme/presets.d.ts.map +1 -1
  359. package/dist/theme/presets.js +44 -11
  360. package/dist/theme/presets.js.map +1 -1
  361. package/dist/theme/theme-provider.d.ts +27 -9
  362. package/dist/theme/theme-provider.d.ts.map +1 -1
  363. package/dist/theme/theme-provider.js +42 -20
  364. package/dist/theme/theme-provider.js.map +1 -1
  365. package/package.json +11 -5
  366. package/src/app/adapt-data-widget.tsx +2 -42
  367. package/src/app/builder/BuilderBanners.tsx +26 -13
  368. package/src/app/builder/CanvasRow.tsx +79 -32
  369. package/src/app/builder/CatalogueSheet.tsx +58 -35
  370. package/src/app/builder/CellPropsSheet.tsx +17 -2
  371. package/src/app/builder/DiscardDialog.tsx +59 -0
  372. package/src/app/builder/EmptyHint.tsx +16 -11
  373. package/src/app/builder/LayoutSurface.tsx +207 -67
  374. package/src/app/builder/PipelineStrip.tsx +265 -156
  375. package/src/app/builder/SaveDialog.tsx +25 -14
  376. package/src/app/builder/Toolbar.tsx +154 -57
  377. package/src/app/builder/Workspace.tsx +226 -56
  378. package/src/app/builder/builder-feedback.test.tsx +75 -0
  379. package/src/app/builder/builder-model.test.ts +5 -0
  380. package/src/app/builder/builder-model.ts +346 -6
  381. package/src/app/builder/builder-model.ux.test.ts +456 -0
  382. package/src/app/builder/builder-ux.test.tsx +844 -0
  383. package/src/app/builder/labels.ts +15 -121
  384. package/src/app/builder/reveal.ts +10 -0
  385. package/src/app/builder/status-chip.tsx +8 -4
  386. package/src/app/builder/use-builder-catalogue.ts +62 -19
  387. package/src/app/builder/use-builder-session.ts +68 -0
  388. package/src/app/builder/use-display-resolver.ts +24 -0
  389. package/src/app/builder/use-save-dashboard.ts +5 -0
  390. package/src/app/index.ts +20 -3
  391. package/src/app/layout-builder.tsx +193 -186
  392. package/src/app/mcp-app-view-chrome.test.tsx +487 -14
  393. package/src/app/mcp-app-view-chrome.tsx +328 -100
  394. package/src/app/mcp-app-view-states.tsx +140 -0
  395. package/src/app/mcp-app-view.effects.test.tsx +292 -0
  396. package/src/app/mcp-app-view.test.tsx +478 -0
  397. package/src/app/mcp-app-view.tsx +447 -190
  398. package/src/app/mcp-toolkit-app.test.tsx +40 -0
  399. package/src/app/mcp-toolkit-app.tsx +39 -8
  400. package/src/app/mcp-use-host-bridge.test.tsx +180 -0
  401. package/src/app/mcp-use-host-bridge.tsx +67 -24
  402. package/src/app/model-context.test.tsx +116 -0
  403. package/src/app/model-context.tsx +125 -0
  404. package/src/app/use-build-mode-focus.ts +62 -0
  405. package/src/app/use-view-actions.ts +89 -0
  406. package/src/app/use-view-lifecycle.ts +122 -0
  407. package/src/app/view-lifecycle.test.ts +443 -0
  408. package/src/app/view-lifecycle.ts +334 -0
  409. package/src/app/widget-fixture.effects.test.tsx +51 -0
  410. package/src/app/widget-fixture.render.test.tsx +81 -0
  411. package/src/app/widget-fixture.tsx +34 -11
  412. package/src/app/widget-props-sheet.tsx +67 -39
  413. package/src/app/widget-renderer.render.test.tsx +131 -0
  414. package/src/app/widget-renderer.tsx +136 -38
  415. package/src/components/DrillButton.tsx +24 -10
  416. package/src/components/EmptyState.tsx +83 -0
  417. package/src/components/ErrorState.tsx +204 -0
  418. package/src/components/FilterBar.test.tsx +82 -0
  419. package/src/components/FilterBar.tsx +56 -27
  420. package/src/components/GroupCard.tsx +3 -2
  421. package/src/components/KpiGrid.test.tsx +279 -0
  422. package/src/components/KpiGrid.tsx +329 -91
  423. package/src/components/ListFooter.test.tsx +116 -0
  424. package/src/components/ListFooter.tsx +110 -12
  425. package/src/components/PagedListFooter.test.tsx +140 -0
  426. package/src/components/PagedListFooter.tsx +107 -0
  427. package/src/components/Pills.test.tsx +77 -0
  428. package/src/components/Pills.tsx +78 -16
  429. package/src/components/SectionHeading.tsx +9 -3
  430. package/src/components/Toast.tsx +206 -0
  431. package/src/components/WidgetHeader.test.tsx +78 -0
  432. package/src/components/WidgetHeader.tsx +63 -16
  433. package/src/components/feedback-states.test.tsx +314 -0
  434. package/src/components/tone-figures.test.tsx +58 -0
  435. package/src/fonts.css +19 -0
  436. package/src/globals.css +9 -165
  437. package/src/hooks/index.ts +6 -3
  438. package/src/hooks/tool-result-recovery-model.test.ts +744 -0
  439. package/src/hooks/tool-result-recovery-model.ts +418 -0
  440. package/src/hooks/use-tool-query.effects.test.tsx +205 -0
  441. package/src/hooks/use-tool-query.ts +156 -33
  442. package/src/hooks/use-tool-result-recovery.effects.test.tsx +141 -0
  443. package/src/hooks/use-tool-result-recovery.test.ts +28 -5
  444. package/src/hooks/use-tool-result-recovery.ts +101 -131
  445. package/src/hooks/use-view-data.test.tsx +169 -0
  446. package/src/hooks/use-view-data.ts +131 -10
  447. package/src/hooks/use-view-tool-query.ts +25 -19
  448. package/src/i18n-coverage.test.tsx +425 -0
  449. package/src/index.ts +102 -13
  450. package/src/lib/focus-return.test.ts +288 -0
  451. package/src/lib/focus-return.ts +96 -0
  452. package/src/lib/focus-ring.ts +20 -0
  453. package/src/lib/icon-stroke.test.ts +59 -0
  454. package/src/lib/icon-stroke.ts +13 -0
  455. package/src/lib/parse-tool-result.test.ts +46 -1
  456. package/src/lib/parse-tool-result.ts +40 -2
  457. package/src/lib/toast-model.test.ts +233 -0
  458. package/src/lib/toast-model.ts +165 -0
  459. package/src/lib/tone-utils.test.ts +125 -16
  460. package/src/lib/tone-utils.ts +144 -15
  461. package/src/lib/tool-query.test.ts +569 -0
  462. package/src/lib/tool-query.ts +253 -0
  463. package/src/lib/tool-result-observer.test.ts +296 -0
  464. package/src/lib/tool-result-observer.ts +211 -0
  465. package/src/lib/typography.test.ts +45 -0
  466. package/src/lib/typography.ts +47 -0
  467. package/src/lib/utils.ts +12 -1
  468. package/src/locale/index.ts +14 -1
  469. package/src/locale/locale-provider.test.tsx +87 -0
  470. package/src/locale/locale-provider.tsx +90 -3
  471. package/src/locale/message-types.ts +337 -0
  472. package/src/locale/messages-de.ts +198 -0
  473. package/src/locale/messages-en.ts +196 -0
  474. package/src/locale/toolkit-messages.test.ts +349 -0
  475. package/src/locale/toolkit-messages.ts +143 -0
  476. package/src/no-hardcoded-copy.test.ts +432 -0
  477. package/src/primitives/alert.tsx +7 -2
  478. package/src/primitives/badge.tsx +19 -7
  479. package/src/primitives/button.tsx +13 -8
  480. package/src/primitives/card.tsx +4 -4
  481. package/src/primitives/dialog.tsx +42 -8
  482. package/src/primitives/input.tsx +5 -3
  483. package/src/primitives/scroll-area.tsx +1 -1
  484. package/src/primitives/select.tsx +7 -4
  485. package/src/primitives/sheet.tsx +33 -6
  486. package/src/primitives/skeleton.tsx +1 -1
  487. package/src/primitives/switch.tsx +4 -2
  488. package/src/primitives/tabs.tsx +9 -6
  489. package/src/providers/query-provider.test.tsx +154 -0
  490. package/src/providers/query-provider.tsx +66 -5
  491. package/src/render-cases-primitives.tsx +1 -1
  492. package/src/render-cases.tsx +82 -6
  493. package/src/render-effects.tsx +96 -0
  494. package/src/render-scan.ts +75 -0
  495. package/src/theme/cd-tokens.generated.css +48 -0
  496. package/src/theme/cd-tokens.test.ts +109 -0
  497. package/src/theme/cd-tokens.ts +67 -0
  498. package/src/theme/create-theme.test.ts +253 -5
  499. package/src/theme/create-theme.ts +341 -41
  500. package/src/theme/fonts.test.ts +85 -0
  501. package/src/theme/fonts.ts +72 -0
  502. package/src/theme/host-fonts.test.ts +135 -0
  503. package/src/theme/host-fonts.ts +52 -0
  504. package/src/theme/index.ts +15 -1
  505. package/src/theme/portal-container.ts +20 -0
  506. package/src/theme/presets.ts +44 -11
  507. package/src/theme/theme-css.test.ts +619 -0
  508. package/src/theme/theme-provider.test.tsx +82 -0
  509. package/src/theme/theme-provider.tsx +60 -24
  510. package/src/theme.css +344 -0
  511. package/ui-catalog.json +783 -49
@@ -1,19 +1,67 @@
1
+ import { type UseToolQueryOptions } from "../lib/tool-query.js";
1
2
  export interface ViewDataResult<T> {
2
3
  data: T | null;
3
4
  /** True while self-fetching with no data yet — the first paint of a cockpit cell. */
4
5
  loading: boolean;
5
6
  error: Error | null;
7
+ /**
8
+ * Fetch `tool` again now: the retry of an error state
9
+ * (`<ErrorState onRetry={refetch} … />`) or a manual refresh — a new read
10
+ * even while a failed fetch still waits on its retry backoff. In `"static"`
11
+ * mode host-pushed data, when present, stays what `data` returns.
12
+ */
13
+ refetch: () => void;
14
+ /** Failed attempts of the current fetch (0 once it succeeds). */
15
+ failureCount: number;
16
+ /**
17
+ * The current fetch's last failed attempt — set from the first failure on,
18
+ * while the query still retries (`error` waits for the last retry).
19
+ */
20
+ failureReason: Error | null;
21
+ /** A fetch is in flight (the first one or a refetch). */
22
+ isFetching: boolean;
23
+ /**
24
+ * `data` is a placeholder (`placeholderData`, e.g. `keepPreviousData`):
25
+ * the previous args' answer while the current args' fetch runs or failed.
26
+ */
27
+ isPlaceholderData: boolean;
6
28
  }
29
+ /**
30
+ * How {@link useViewData} treats host-pushed `initialData`.
31
+ *
32
+ * - `"static"` (default): returned verbatim; the feed query stays off while
33
+ * it is present.
34
+ * - `"seed"`: it becomes the feed query's cached answer, and the query stays
35
+ * live (once `ready`): an invalidation after a write, a `refetch` or a
36
+ * retry re-reads the feed. A fresh seed is not refetched on mount (it is
37
+ * younger than `staleTime`); a payload delivered anew (content not seeded
38
+ * for the key before) replaces the cached answer, while a re-rendered or
39
+ * remounted old one never rolls a refetched answer back.
40
+ */
41
+ export type ViewDataMode = "static" | "seed";
42
+ /**
43
+ * Options of {@link useViewData}: TanStack's query options for the feed
44
+ * (`retry`, `retryDelay`, `staleTime`, `placeholderData` /
45
+ * `keepPreviousData`, `enabled` as an extra gate next to `ready`, …),
46
+ * plus how host data seeds it.
47
+ */
48
+ export type UseViewDataOptions<T> = Omit<UseToolQueryOptions<T>, "initialData" | "select"> & {
49
+ initialDataMode?: ViewDataMode;
50
+ };
7
51
  /**
8
52
  * The seam that lets one widget component serve both modes without a duplicate UI.
9
53
  *
10
54
  * Standalone (a `*_show_*` widget) the agent's tool result is handed in via
11
- * `initialData` (from the view's stepData, e.g. through `adaptDataWidget`) and
12
- * returned verbatim. Embedded in a self-fetching cockpit only scope params are
13
- * passed, so the component fetches `tool` with `args` under `key` — disabled
14
- * unless data is absent AND `ready` (i.e. the required id/key is present).
15
- * Sibling widgets sharing `key` dedupe to a single call, so a composed view of
16
- * N widgets over one data feed fetches once.
55
+ * `initialData` (from the view's stepData, e.g. through `adaptDataWidget`).
56
+ * Embedded in a self-fetching cockpit only scope params are passed, so the
57
+ * component fetches `tool` with `args` under `key`, gated on `ready` (i.e.
58
+ * the required id/key is present). Sibling widgets sharing `key` and `args`
59
+ * dedupe to a single call, so a composed view of N widgets over one data
60
+ * feed fetches once.
61
+ *
62
+ * By default host data is returned verbatim and switches the query off;
63
+ * `initialDataMode: "seed"` keeps the query live over it instead (see
64
+ * {@link ViewDataMode}). `options` passes TanStack's query options through.
17
65
  */
18
- export declare function useViewData<T>(initialData: T | null | undefined, key: ReadonlyArray<unknown>, tool: string, args: Record<string, unknown>, ready: boolean): ViewDataResult<T>;
66
+ export declare function useViewData<T>(initialData: T | null | undefined, key: ReadonlyArray<unknown>, tool: string, args: Record<string, unknown>, ready: boolean, options?: UseViewDataOptions<T>): ViewDataResult<T>;
19
67
  //# sourceMappingURL=use-view-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-view-data.d.ts","sourceRoot":"","sources":["../../src/hooks/use-view-data.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACd,qFAAqF;IACrF,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACjC,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC,EAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,OAAO,GACb,cAAc,CAAC,CAAC,CAAC,CAInB"}
1
+ {"version":3,"file":"use-view-data.d.ts","sourceRoot":"","sources":["../../src/hooks/use-view-data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG9E,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACd,qFAAqF;IACrF,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,aAAa,EAAE,KAAK,GAAG,IAAI,CAAA;IAC3B,yDAAyD;IACzD,UAAU,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC,GAAG;IAC3F,eAAe,CAAC,EAAE,YAAY,CAAA;CAC/B,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACjC,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC,EAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC9B,cAAc,CAAC,CAAC,CAAC,CA0BnB"}
@@ -1,18 +1,88 @@
1
- import { useToolQuery } from "./use-tool-query.js";
1
+ import { useCallback, useState } from "react";
2
+ import { hashKey, useQueryClient } from "@tanstack/react-query";
3
+ import { seedToolQuery } from "../lib/tool-query.js";
4
+ import { useToolQuery, useToolQueryKey } from "./use-tool-query.js";
2
5
  /**
3
6
  * The seam that lets one widget component serve both modes without a duplicate UI.
4
7
  *
5
8
  * Standalone (a `*_show_*` widget) the agent's tool result is handed in via
6
- * `initialData` (from the view's stepData, e.g. through `adaptDataWidget`) and
7
- * returned verbatim. Embedded in a self-fetching cockpit only scope params are
8
- * passed, so the component fetches `tool` with `args` under `key` — disabled
9
- * unless data is absent AND `ready` (i.e. the required id/key is present).
10
- * Sibling widgets sharing `key` dedupe to a single call, so a composed view of
11
- * N widgets over one data feed fetches once.
9
+ * `initialData` (from the view's stepData, e.g. through `adaptDataWidget`).
10
+ * Embedded in a self-fetching cockpit only scope params are passed, so the
11
+ * component fetches `tool` with `args` under `key`, gated on `ready` (i.e.
12
+ * the required id/key is present). Sibling widgets sharing `key` and `args`
13
+ * dedupe to a single call, so a composed view of N widgets over one data
14
+ * feed fetches once.
15
+ *
16
+ * By default host data is returned verbatim and switches the query off;
17
+ * `initialDataMode: "seed"` keeps the query live over it instead (see
18
+ * {@link ViewDataMode}). `options` passes TanStack's query options through.
19
+ */
20
+ export function useViewData(initialData, key, tool, args, ready, options) {
21
+ const { initialDataMode = "static", enabled, ...queryOptions } = options ?? {};
22
+ const seeding = initialDataMode === "seed";
23
+ const cacheKey = useStableKey(useToolQueryKey(key, tool, args));
24
+ useSeed(seeding ? initialData : null, cacheKey, queryOptions.initialDataUpdatedAt);
25
+ const active = ready && enabled !== false;
26
+ const fetches = active && (seeding || !initialData);
27
+ const query = useToolQuery([...key], tool, args, {
28
+ ...queryOptions,
29
+ enabled: typeof enabled === "function" ? (q) => fetches && enabled(q) : fetches,
30
+ });
31
+ const data = seeding ? (query.data ?? initialData) : (initialData ?? query.data);
32
+ const refetch = useFreshRefetch(cacheKey, query.refetch);
33
+ return {
34
+ data: data ?? null,
35
+ // The query's own verdict: a function `enabled` that returns false idles
36
+ // like `enabled: false`, never an endless skeleton.
37
+ loading: !data && query.isEnabled && !query.isError,
38
+ error: query.error,
39
+ refetch,
40
+ failureCount: query.failureCount,
41
+ failureReason: query.failureReason,
42
+ isFetching: query.isFetching,
43
+ isPlaceholderData: query.isPlaceholderData,
44
+ };
45
+ }
46
+ /** `key`, kept by content: callers build `key`/`args` anew every render. */
47
+ function useStableKey(key) {
48
+ const id = hashKey(key);
49
+ const [stable, setStable] = useState({ id, key });
50
+ if (stable.id !== id)
51
+ setStable({ id, key });
52
+ return stable.id === id ? stable.key : key;
53
+ }
54
+ /**
55
+ * `"seed"` mode: write the host's payload into the feed's cache entry in the
56
+ * render phase, before the query's observer reads the cache — what TanStack's
57
+ * own `initialData` does (see {@link seedToolQuery} for when it wins over a
58
+ * cached answer). The last processed seed skips the content check while the
59
+ * same object comes in render after render.
60
+ */
61
+ function useSeed(seed, cacheKey, updatedAt) {
62
+ const client = useQueryClient();
63
+ const keyId = hashKey(cacheKey);
64
+ const [seen, setSeen] = useState(null);
65
+ if (seed == null || (seen?.seed === seed && seen.keyId === keyId))
66
+ return;
67
+ const at = typeof updatedAt === "function" ? updatedAt() : updatedAt;
68
+ const written = seedToolQuery(client, cacheKey, seed, at);
69
+ // Only a real change re-renders: an equal new object per render must not loop.
70
+ if (written || seen?.keyId !== keyId)
71
+ setSeen({ seed, keyId });
72
+ }
73
+ /**
74
+ * A refetch that reads anew at once. TanStack restarts an in-flight fetch only
75
+ * over data (`cancelRefetch`); a key without data joins the running retry
76
+ * chain and waits out its backoff. So cancel that chain first, then read.
12
77
  */
13
- export function useViewData(initialData, key, tool, args, ready) {
14
- const query = useToolQuery([...key], tool, args, { enabled: !initialData && ready });
15
- const data = initialData ?? query.data ?? null;
16
- return { data, loading: !data && ready && !query.isError, error: query.error ?? null };
78
+ function useFreshRefetch(cacheKey, refetchQuery) {
79
+ const client = useQueryClient();
80
+ return useCallback(() => {
81
+ if (client.getQueryData(cacheKey) !== undefined) {
82
+ void refetchQuery();
83
+ return;
84
+ }
85
+ void client.cancelQueries({ queryKey: cacheKey, exact: true }).then(() => refetchQuery());
86
+ }, [client, cacheKey, refetchQuery]);
17
87
  }
18
88
  //# sourceMappingURL=use-view-data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-view-data.js","sourceRoot":"","sources":["../../src/hooks/use-view-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AASlD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CACzB,WAAiC,EACjC,GAA2B,EAC3B,IAAY,EACZ,IAA6B,EAC7B,KAAc;IAEd,MAAM,KAAK,GAAG,YAAY,CAAI,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,WAAW,IAAI,KAAK,EAAE,CAAC,CAAA;IACvF,MAAM,IAAI,GAAG,WAAW,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,CAAA;IAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC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- export interface UseViewToolQueryOptions {
3
- enabled?: boolean;
4
- }
2
+ import { type UseToolQueryOptions } from "../lib/tool-query.js";
3
+ /**
4
+ * Options of {@link useViewToolQuery}: TanStack's query options, passed
5
+ * through like `useToolQuery`'s (`enabled`, `retry`, `staleTime`,
6
+ * `placeholderData`, `initialData`, …).
7
+ */
8
+ export type UseViewToolQueryOptions<T = unknown> = UseToolQueryOptions<T>;
5
9
  /**
6
10
  * Self-fetch hook for `*_show_*` widget tools — the envelope-unwrapping sibling
7
11
  * of {@link useToolQuery}. A widget tool's text channel carries only a model
@@ -10,9 +14,10 @@ export interface UseViewToolQueryOptions {
10
14
  * envelope; this hook decodes via {@link parseViewToolResult} (single-step →
11
15
  * flat data, multi-step → keyed by step id) instead.
12
16
  *
13
- * `args` is appended to the effective query key — same queryKey-vs-args
14
- * contract as {@link useToolQuery}, so sibling widgets sharing a query key
15
- * collapse to a single deduped tool call.
17
+ * Same key and options contract as {@link useToolQuery}: the effective key is
18
+ * `[...queryKey, args]` (`[...queryKey, toolName, args]` under an
19
+ * `AppQueryProvider` with `toolNameInQueryKey`), so sibling widgets sharing a
20
+ * query key and args collapse to a single deduped tool call.
16
21
  */
17
- export declare function useViewToolQuery<T = unknown>(queryKey: unknown[], toolName: string, args: object, opts?: UseViewToolQueryOptions): UseQueryResult<T, Error>;
22
+ export declare function useViewToolQuery<T = unknown>(queryKey: readonly unknown[], toolName: string, args: object, opts?: UseViewToolQueryOptions<T>): UseQueryResult<T, Error>;
18
23
  //# sourceMappingURL=use-view-tool-query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-view-tool-query.d.ts","sourceRoot":"","sources":["../../src/hooks/use-view-tool-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAIrE,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,uBAAuB,GAC7B,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC,CAY1B"}
1
+ {"version":3,"file":"use-view-tool-query.d.ts","sourceRoot":"","sources":["../../src/hooks/use-view-tool-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGrE,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAGjF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,GAAG,OAAO,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAA;AAEzE;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAChC,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC,CAY1B"}
@@ -1,6 +1,8 @@
1
1
  import { useQuery } from "@tanstack/react-query";
2
- import { useCallTool } from "../providers/query-provider.js";
2
+ import { useCallTool, useToolNameInQueryKey } from "../providers/query-provider.js";
3
3
  import { parseViewToolResult } from "../lib/parse-tool-result.js";
4
+ import { toolQueryOptions } from "../lib/tool-query.js";
5
+ import { useRefetchOnTransport, useToolKeyGuard } from "./use-tool-query.js";
4
6
  /**
5
7
  * Self-fetch hook for `*_show_*` widget tools — the envelope-unwrapping sibling
6
8
  * of {@link useToolQuery}. A widget tool's text channel carries only a model
@@ -9,21 +11,20 @@ import { parseViewToolResult } from "../lib/parse-tool-result.js";
9
11
  * envelope; this hook decodes via {@link parseViewToolResult} (single-step →
10
12
  * flat data, multi-step → keyed by step id) instead.
11
13
  *
12
- * `args` is appended to the effective query key — same queryKey-vs-args
13
- * contract as {@link useToolQuery}, so sibling widgets sharing a query key
14
- * collapse to a single deduped tool call.
14
+ * Same key and options contract as {@link useToolQuery}: the effective key is
15
+ * `[...queryKey, args]` (`[...queryKey, toolName, args]` under an
16
+ * `AppQueryProvider` with `toolNameInQueryKey`), so sibling widgets sharing a
17
+ * query key and args collapse to a single deduped tool call.
15
18
  */
16
19
  export function useViewToolQuery(queryKey, toolName, args, opts) {
17
20
  const callTool = useCallTool();
18
- return useQuery({
19
- queryKey: [...queryKey, args],
20
- queryFn: async () => {
21
- if (!callTool)
22
- throw new Error("callTool not available");
23
- const result = await callTool(toolName, args);
24
- return parseViewToolResult(result);
25
- },
26
- enabled: !!callTool && (opts?.enabled ?? true),
27
- });
21
+ const toolNameInKey = useToolNameInQueryKey();
22
+ useToolKeyGuard(queryKey, toolName, args);
23
+ const query = useQuery(toolQueryOptions(queryKey, toolName, args, callTool, opts, {
24
+ decode: parseViewToolResult,
25
+ toolNameInKey,
26
+ }));
27
+ useRefetchOnTransport(callTool, query);
28
+ return query;
28
29
  }
29
30
  //# sourceMappingURL=use-view-tool-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-view-tool-query.js","sourceRoot":"","sources":["../../src/hooks/use-view-tool-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAMjE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAmB,EACnB,QAAgB,EAChB,IAAY,EACZ,IAA8B;IAE9B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAE9B,OAAO,QAAQ,CAAW;QACxB,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,IAAI,CAAC;QAC7B,OAA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K,CAAA;AACd,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,21 +13,27 @@ export { Switch } from "./primitives/switch.js";
13
13
  export { ScrollArea, ScrollBar } from "./primitives/scroll-area.js";
14
14
  export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, } from "./primitives/sheet.js";
15
15
  export { useIsMobile } from "./hooks/use-mobile.js";
16
- export { useToolQuery, useToolMutation } from "./hooks/use-tool-query.js";
17
- export type { UseToolQueryOptions } from "./hooks/use-tool-query.js";
16
+ export { useToolQuery, useToolQueryKey, useToolMutation } from "./hooks/use-tool-query.js";
17
+ export type { UseToolQueryOptions, UseToolMutationOptions } from "./hooks/use-tool-query.js";
18
+ export { toolQueryKey, shouldRetryToolCall } from "./lib/tool-query.js";
19
+ export { ToolResultError, isToolError } from "./lib/parse-tool-result.js";
20
+ export { keepPreviousData } from "@tanstack/react-query";
18
21
  export { useDebouncedValue } from "./hooks/use-debounced-value.js";
19
- export { TONE_SOFT, TONE_DOT, TONE_TEXT } from "./lib/tone-utils.js";
20
- export type { ToneVariant } from "./lib/tone-utils.js";
22
+ export { TONE_VARIANTS, TONE_ALIASES, resolveTone, isToneVariant, TONE_SOFT, TONE_TINT, TONE_DOT, TONE_INK, TONE_TEXT, TONE_BORDER, TONE_ICON, } from "./lib/tone-utils.js";
23
+ export type { ToneVariant, ToneAlias, ToneName } from "./lib/tone-utils.js";
24
+ export { TYPE_SCALE, TYPE_STEPS, TYPE_FLOOR_PX, MICRO_LABEL } from "./lib/typography.js";
25
+ export type { TypeStep } from "./lib/typography.js";
26
+ export { FOCUS_RING, FOCUS_RING_INSET } from "./lib/focus-ring.js";
21
27
  export { GridLayout, GridItem } from "./components/GridLayout.js";
22
28
  export type { GridLayoutProps, GridItemProps } from "./components/GridLayout.js";
23
- export { KpiGrid } from "./components/KpiGrid.js";
24
- export type { KpiGridProps, KpiGridHeader, KpiCell } from "./components/KpiGrid.js";
25
- export { LivePill, CountPill } from "./components/Pills.js";
26
- export type { LivePillProps, CountPillProps } from "./components/Pills.js";
29
+ export { KpiGrid, KpiGridSkeleton } from "./components/KpiGrid.js";
30
+ export type { KpiGridProps, KpiGridHeader, KpiCell, KpiGridSkeletonProps, } from "./components/KpiGrid.js";
31
+ export { LivePill, CountPill, StatusBadge } from "./components/Pills.js";
32
+ export type { LivePillProps, CountPillProps, StatusBadgeProps, StatusBadgeText, } from "./components/Pills.js";
27
33
  export { SectionHeading } from "./components/SectionHeading.js";
28
34
  export type { SectionHeadingProps } from "./components/SectionHeading.js";
29
35
  export { WidgetHeader } from "./components/WidgetHeader.js";
30
- export type { WidgetHeaderProps } from "./components/WidgetHeader.js";
36
+ export type { WidgetHeaderProps, WidgetHeadingLevel } from "./components/WidgetHeader.js";
31
37
  export { GroupCard } from "./components/GroupCard.js";
32
38
  export type { GroupCardProps } from "./components/GroupCard.js";
33
39
  export { FilterBar } from "./components/FilterBar.js";
@@ -36,11 +42,19 @@ export { DrillButton } from "./components/DrillButton.js";
36
42
  export type { DrillButtonProps } from "./components/DrillButton.js";
37
43
  export { ListFooter } from "./components/ListFooter.js";
38
44
  export type { ListFooterProps } from "./components/ListFooter.js";
45
+ export { PagedListFooter } from "./components/PagedListFooter.js";
46
+ export type { PagedListFooterProps, PagedListState } from "./components/PagedListFooter.js";
47
+ export { ToastProvider, useToast } from "./components/Toast.js";
48
+ export type { ToastApi, ToastOptions, ToastTone } from "./components/Toast.js";
49
+ export { EmptyState } from "./components/EmptyState.js";
50
+ export type { EmptyStateProps, StateHeadingLevel } from "./components/EmptyState.js";
51
+ export { ErrorState } from "./components/ErrorState.js";
52
+ export type { ErrorStateProps, ErrorStateTone } from "./components/ErrorState.js";
39
53
  export { AppQueryProvider, useCallTool, queryClient } from "./providers/query-provider.js";
40
- export { createTheme, ThemeProvider, useTheme, themePresets } from "./theme/index.js";
41
- export type { ThemeTokens, ThemeDefinition, ThemeVars, CreateThemeOptions, ThemeMode, ThemeContextValue, ThemeProviderProps, ThemePresetId, } from "./theme/index.js";
42
- export { LocaleProvider, useLocale, useTranslate } from "./locale/index.js";
43
- export type { LocaleContextValue, LocaleProviderProps, BoundTranslate } from "./locale/index.js";
54
+ export { createTheme, resolveThemeVars, ROLE_TOKENS, ThemeProvider, useTheme, usePortalContainer, themePresets, CD_TOKENS, CD_TOKENS_VERSION, fontFaces, GEIST_FONT_FILES, adoptHostFontVariables, HOST_FONT_VARIABLES, } from "./theme/index.js";
55
+ export type { ThemeTokens, ThemeDefinition, ThemeVars, CreateThemeOptions, ThemeMode, ThemeContextValue, ThemeProviderProps, ThemePresetId, CdTokenName, FontFacesOptions, InlineStyleTarget, } from "./theme/index.js";
56
+ export { LocaleProvider, useLocale, useTranslate, useToolkitMessages, TOOLKIT_MESSAGES, formatCount, resolveToolkitMessages, } from "./locale/index.js";
57
+ export type { LocaleContextValue, LocaleProviderProps, BoundTranslate, BuilderMessages, CommonMessages, FilterBarMessages, ListFooterMessages, PropsSheetMessages, RendererMessages, ToolkitLocale, ToolkitMessages, ToolkitMessagesOverride, ViewMessages, } from "./locale/index.js";
44
58
  export { cn } from "./lib/utils.js";
45
59
  export { parseToolResult, parseViewToolResult } from "./lib/parse-tool-result.js";
46
60
  export type { ParseToolResultOptions } from "./lib/parse-tool-result.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD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AM,mBAAmB,CAAA;AAQ1B,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACjF,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA"}
package/dist/index.js CHANGED
@@ -17,35 +17,57 @@ export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHe
17
17
  // NOTE: the view-tool hooks (`useViewToolQuery`, `useViewData`) are exported
18
18
  // from the `./hooks` subpath only — see `packages/ui/src/hooks/index.ts`.
19
19
  export { useIsMobile } from "./hooks/use-mobile.js";
20
- export { useToolQuery, useToolMutation } from "./hooks/use-tool-query.js";
20
+ export { useToolQuery, useToolQueryKey, useToolMutation } from "./hooks/use-tool-query.js";
21
+ // The query layer's contract: the effective cache key, the opt-in retry
22
+ // policy (no retry of a tool's own isError answer), and TanStack's
23
+ // keepPreviousData for `placeholderData`, so a consumer needs no direct
24
+ // @tanstack/react-query import for the common options.
25
+ export { toolQueryKey, shouldRetryToolCall } from "./lib/tool-query.js";
26
+ export { ToolResultError, isToolError } from "./lib/parse-tool-result.js";
27
+ export { keepPreviousData } from "@tanstack/react-query";
21
28
  export { useDebouncedValue } from "./hooks/use-debounced-value.js";
22
29
  // Tone token system — the semantic status tones (ToneVariant + TONE_* maps)
23
- // behind the tone-aware components below. Pure data + class strings.
24
- export { TONE_SOFT, TONE_DOT, TONE_TEXT } from "./lib/tone-utils.js";
30
+ // behind the tone-aware components below. Pure data + class strings. ONE
31
+ // vocabulary (TONE_VARIANTS; retired names map through resolveTone). Three
32
+ // roles per tone: colour (TONE_DOT/TONE_BORDER/TONE_ICON), tint (TONE_SOFT,
33
+ // foreground text on it; TONE_TINT alone), text on a plain surface (TONE_INK,
34
+ // the -ink role; TONE_TEXT is its deprecated name).
35
+ export { TONE_VARIANTS, TONE_ALIASES, resolveTone, isToneVariant, TONE_SOFT, TONE_TINT, TONE_DOT, TONE_INK, TONE_TEXT, TONE_BORDER, TONE_ICON, } from "./lib/tone-utils.js";
36
+ // The type scale (CI §4): text-title/section/body/dense/small utilities, 13 px floor.
37
+ export { TYPE_SCALE, TYPE_STEPS, TYPE_FLOOR_PX, MICRO_LABEL } from "./lib/typography.js";
38
+ // The kit's opaque focus ring as class strings, for custom controls.
39
+ export { FOCUS_RING, FOCUS_RING_INSET } from "./lib/focus-ring.js";
25
40
  // Composed components — focused widget building blocks assembled from the
26
41
  // primitives. Pure (React + primitives + cn), so they live in the root barrel.
27
42
  export { GridLayout, GridItem } from "./components/GridLayout.js";
28
- export { KpiGrid } from "./components/KpiGrid.js";
29
- export { LivePill, CountPill } from "./components/Pills.js";
43
+ export { KpiGrid, KpiGridSkeleton } from "./components/KpiGrid.js";
44
+ export { LivePill, CountPill, StatusBadge } from "./components/Pills.js";
30
45
  export { SectionHeading } from "./components/SectionHeading.js";
31
46
  export { WidgetHeader } from "./components/WidgetHeader.js";
32
47
  export { GroupCard } from "./components/GroupCard.js";
33
48
  export { FilterBar } from "./components/FilterBar.js";
34
49
  export { DrillButton } from "./components/DrillButton.js";
35
50
  export { ListFooter } from "./components/ListFooter.js";
51
+ export { PagedListFooter } from "./components/PagedListFooter.js";
52
+ // Feedback and states — one pattern each for toasts, empty and error states.
53
+ export { ToastProvider, useToast } from "./components/Toast.js";
54
+ export { EmptyState } from "./components/EmptyState.js";
55
+ export { ErrorState } from "./components/ErrorState.js";
36
56
  // Providers
37
57
  export { AppQueryProvider, useCallTool, queryClient } from "./providers/query-provider.js";
38
58
  // Theming / white-label token system. Browser-safe (React + DOM only, no
39
59
  // `mcp-use/react`), so it belongs in this root barrel: a consumer can re-skin
40
60
  // the toolkit's primitives from a single switch without pulling in the host
41
61
  // runtime. See packages/ui/src/theme/ and docs/guides/white-labeling.md.
42
- export { createTheme, ThemeProvider, useTheme, themePresets } from "./theme/index.js";
62
+ // The defaults are the Miragon theme (theme.css over the vendored --cd-*
63
+ // corporate-design tokens); a brand overrides the ROLE_TOKENS only.
64
+ export { createTheme, resolveThemeVars, ROLE_TOKENS, ThemeProvider, useTheme, usePortalContainer, themePresets, CD_TOKENS, CD_TOKENS_VERSION, fontFaces, GEIST_FONT_FILES, adoptHostFontVariables, HOST_FONT_VARIABLES, } from "./theme/index.js";
43
65
  // i18n / localization. Browser-safe (React only, no `mcp-use/react`), so it
44
66
  // belongs in this root barrel: a consumer wraps its widget tree in
45
67
  // <LocaleProvider locale=… translator=…> and reads the active locale with
46
68
  // useLocale/useTranslate. Pairs with `createTranslator` from
47
69
  // `@miragon/mcp-toolkit-core`. See packages/ui/src/locale/.
48
- export { LocaleProvider, useLocale, useTranslate } from "./locale/index.js";
70
+ export { LocaleProvider, useLocale, useTranslate, useToolkitMessages, TOOLKIT_MESSAGES, formatCount, resolveToolkitMessages, } from "./locale/index.js";
49
71
  // NOTE: MCP App shell (McpAppView, WidgetRenderer) is exported from the
50
72
  // `./app` subpath only. Keeping it out of the main barrel prevents consumers
51
73
  // that only need primitives (e.g. an admin portal) from pulling `mcp-use/react`
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,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EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAGjE,6EAA6E;AAC7E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAGvD,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAE1F,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,yEAAyE;AACzE,oEAAoE;AACpE,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AAezB,4EAA4E;AAC5E,mEAAmE;AACnE,0EAA0E;AAC1E,6DAA6D;AAC7D,4DAA4D;AAC5D,OAAO,EACL,cAAc,EACd,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,sBAAsB,GACvB,MAAM,mBAAmB,CAAA;AAiB1B,wEAAwE;AACxE,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAE/E,QAAQ;AACR,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Focus return for the kit's dialogs and sheets (CI §12: focus goes back to
3
+ * where it came from).
4
+ *
5
+ * A Radix dialog returns the focus only to its `Trigger`. The kit's overlays
6
+ * mostly open from React state, without one (the builder's Save, Discard and
7
+ * Catalogue, a cell's props sheet), and Radix then cancels its focus scope's
8
+ * own restore and focuses nothing: closing them by keyboard left the focus on
9
+ * the document body. `DialogContent` and `SheetContent` therefore note the
10
+ * element that has the focus as they open and hand the focus back to it when
11
+ * they close and the focus went with them, while that element is still in the
12
+ * document. A consumer's own `onCloseAutoFocus` that calls `preventDefault()`
13
+ * keeps full control.
14
+ */
15
+ /** The part of an element the hand-back needs (structural, so it tests without a DOM). */
16
+ export interface FocusReturnTarget {
17
+ readonly isConnected: boolean;
18
+ focus: () => void;
19
+ }
20
+ /** The part of Radix's auto-focus events the hand-back reads. */
21
+ export interface AutoFocusEventLike {
22
+ readonly defaultPrevented: boolean;
23
+ preventDefault: () => void;
24
+ }
25
+ /** One overlay's hand-back, from {@link createFocusReturn}. */
26
+ export interface FocusReturn {
27
+ /**
28
+ * Notes the element that has the focus as the overlay opens. The document
29
+ * body is no target: a pointer that opened it without focusing anything
30
+ * (Safari does not focus a clicked button) leaves Radix's default in place.
31
+ */
32
+ capture: (active: FocusReturnTarget | null, body: unknown) => void;
33
+ /**
34
+ * Hands the focus back to the noted element when the overlay closes and the
35
+ * focus went with it (`focusLost`: it sits on the body). It leaves the focus
36
+ * where it is when a handler before it prevented that, when the focus
37
+ * already sits elsewhere (a click outside a non-modal overlay, a hand-off
38
+ * that moved it) or when the element left the document (an Apply or
39
+ * Discard that unmounted the builder). Forgets the element either way.
40
+ */
41
+ restore: (event: AutoFocusEventLike, focusLost: boolean) => void;
42
+ }
43
+ /** A {@link FocusReturn} with nothing noted yet. */
44
+ export declare function createFocusReturn(): FocusReturn;
45
+ /**
46
+ * The `onOpenAutoFocus` / `onCloseAutoFocus` pair of a Radix dialog content
47
+ * with the focus hand-back of {@link createFocusReturn} composed in: it notes
48
+ * the opener BEFORE the consumer's open handler runs (that one may move the
49
+ * focus) and hands it back AFTER the consumer's close handler (whose
50
+ * `preventDefault()` keeps it out). Radix fires the open event only when the
51
+ * focus is outside the content as it mounts, so an element inside it must not
52
+ * take the focus itself (`autoFocus`): Radix focuses the first one anyway.
53
+ */
54
+ export declare function useFocusReturn<E extends AutoFocusEventLike>(handlers: {
55
+ onOpenAutoFocus?: (event: E) => void;
56
+ onCloseAutoFocus?: (event: E) => void;
57
+ }): {
58
+ onOpenAutoFocus: (event: E) => void;
59
+ onCloseAutoFocus: (event: E) => void;
60
+ };
61
+ //# sourceMappingURL=focus-return.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-return.d.ts","sourceRoot":"","sources":["../../src/lib/focus-return.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,0FAA0F;AAC1F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAClC,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B;AAED,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAClE;;;;;;;OAOG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;CACjE;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,IAAI,WAAW,CAc/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,kBAAkB,EAAE,QAAQ,EAAE;IACrE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IACpC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;CACtC,GAAG;IAAE,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;CAAE,CAahF"}
@@ -0,0 +1,46 @@
1
+ import { useState } from "react";
2
+ /** A {@link FocusReturn} with nothing noted yet. */
3
+ export function createFocusReturn() {
4
+ let opener = null;
5
+ return {
6
+ capture: (active, body) => {
7
+ opener = active === body ? null : active;
8
+ },
9
+ restore: (event, focusLost) => {
10
+ const target = opener;
11
+ opener = null;
12
+ if (event.defaultPrevented || !focusLost || target === null || !target.isConnected)
13
+ return;
14
+ event.preventDefault();
15
+ target.focus();
16
+ },
17
+ };
18
+ }
19
+ /**
20
+ * The `onOpenAutoFocus` / `onCloseAutoFocus` pair of a Radix dialog content
21
+ * with the focus hand-back of {@link createFocusReturn} composed in: it notes
22
+ * the opener BEFORE the consumer's open handler runs (that one may move the
23
+ * focus) and hands it back AFTER the consumer's close handler (whose
24
+ * `preventDefault()` keeps it out). Radix fires the open event only when the
25
+ * focus is outside the content as it mounts, so an element inside it must not
26
+ * take the focus itself (`autoFocus`): Radix focuses the first one anyway.
27
+ */
28
+ export function useFocusReturn(handlers) {
29
+ const [focusReturn] = useState(createFocusReturn);
30
+ return {
31
+ onOpenAutoFocus: (event) => {
32
+ focusReturn.capture(activeElementOf(document), document.body);
33
+ handlers.onOpenAutoFocus?.(event);
34
+ },
35
+ onCloseAutoFocus: (event) => {
36
+ handlers.onCloseAutoFocus?.(event);
37
+ const active = document.activeElement;
38
+ focusReturn.restore(event, active === null || active === document.body);
39
+ },
40
+ };
41
+ }
42
+ function activeElementOf(doc) {
43
+ const active = doc.activeElement;
44
+ return active && "focus" in active ? active : null;
45
+ }
46
+ //# sourceMappingURL=focus-return.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-return.js","sourceRoot":"","sources":["../../src/lib/focus-return.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAgDhC,oDAAoD;AACpD,MAAM,UAAU,iBAAiB;IAC/B,IAAI,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CAAC,aAAa,CAAA;IAChC,OAAO,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC,CAAC,CAAE,MAAsB,CAAC,CAAC,CAAC,IAAI,CAAA;AACrE,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The toolkit's focus indicator as Tailwind classes: an opaque 2px ring in the
3
+ * `--focus` role (blau-link on light, blau-hell on dark — 3:1 or more against
4
+ * every surface, see `theme/theme-css.test.ts`), offset from the control so it
5
+ * reads on any fill. Every interactive kit control uses it; spread it into a
6
+ * custom control's `className` so keyboard focus looks the same everywhere.
7
+ * (`theme.css` also gives every element without its own ring an opaque
8
+ * `:focus-visible` outline in the same colour.)
9
+ *
10
+ * The ring is a box-shadow, which forced-colors mode (Windows High Contrast)
11
+ * drops. `outline-hidden` — never `outline-none` — hides the outline only
12
+ * outside that mode and keeps a transparent 2px outline in it, which the
13
+ * browser paints in the system colour, so focus stays visible there too.
14
+ */
15
+ export declare const FOCUS_RING = "outline-hidden focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background";
16
+ /** {@link FOCUS_RING} drawn inside the element — for cells and rows flush with a container edge. */
17
+ export declare const FOCUS_RING_INSET = "outline-hidden focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset";
18
+ //# sourceMappingURL=focus-ring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-ring.d.ts","sourceRoot":"","sources":["../../src/lib/focus-ring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,kIAC0G,CAAA;AAEjI,oGAAoG;AACpG,eAAO,MAAM,gBAAgB,0FAC4D,CAAA"}