@miragon/mcp-toolkit-ui 2.6.0 → 2.7.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 (348) hide show
  1. package/README.md +7 -1
  2. package/dist/app/builder/BuilderBanners.d.ts +7 -2
  3. package/dist/app/builder/BuilderBanners.d.ts.map +1 -1
  4. package/dist/app/builder/BuilderBanners.js +8 -3
  5. package/dist/app/builder/BuilderBanners.js.map +1 -1
  6. package/dist/app/builder/CanvasRow.d.ts.map +1 -1
  7. package/dist/app/builder/CanvasRow.js +12 -14
  8. package/dist/app/builder/CanvasRow.js.map +1 -1
  9. package/dist/app/builder/CatalogueSheet.d.ts.map +1 -1
  10. package/dist/app/builder/CatalogueSheet.js +6 -5
  11. package/dist/app/builder/CatalogueSheet.js.map +1 -1
  12. package/dist/app/builder/EmptyHint.d.ts +4 -0
  13. package/dist/app/builder/EmptyHint.d.ts.map +1 -1
  14. package/dist/app/builder/EmptyHint.js +6 -1
  15. package/dist/app/builder/EmptyHint.js.map +1 -1
  16. package/dist/app/builder/LayoutSurface.js +3 -3
  17. package/dist/app/builder/LayoutSurface.js.map +1 -1
  18. package/dist/app/builder/PipelineStrip.d.ts +3 -1
  19. package/dist/app/builder/PipelineStrip.d.ts.map +1 -1
  20. package/dist/app/builder/PipelineStrip.js +11 -6
  21. package/dist/app/builder/PipelineStrip.js.map +1 -1
  22. package/dist/app/builder/SaveDialog.d.ts.map +1 -1
  23. package/dist/app/builder/SaveDialog.js +2 -2
  24. package/dist/app/builder/SaveDialog.js.map +1 -1
  25. package/dist/app/builder/Toolbar.d.ts +3 -1
  26. package/dist/app/builder/Toolbar.d.ts.map +1 -1
  27. package/dist/app/builder/Toolbar.js +9 -3
  28. package/dist/app/builder/Toolbar.js.map +1 -1
  29. package/dist/app/builder/Workspace.js +2 -2
  30. package/dist/app/builder/Workspace.js.map +1 -1
  31. package/dist/app/builder/builder-model.d.ts +3 -2
  32. package/dist/app/builder/builder-model.d.ts.map +1 -1
  33. package/dist/app/builder/builder-model.js +5 -4
  34. package/dist/app/builder/builder-model.js.map +1 -1
  35. package/dist/app/builder/labels.d.ts +13 -62
  36. package/dist/app/builder/labels.d.ts.map +1 -1
  37. package/dist/app/builder/labels.js +9 -58
  38. package/dist/app/builder/labels.js.map +1 -1
  39. package/dist/app/builder/status-chip.d.ts.map +1 -1
  40. package/dist/app/builder/status-chip.js +3 -2
  41. package/dist/app/builder/status-chip.js.map +1 -1
  42. package/dist/app/builder/use-builder-catalogue.d.ts +1 -0
  43. package/dist/app/builder/use-builder-catalogue.d.ts.map +1 -1
  44. package/dist/app/builder/use-builder-catalogue.js +6 -0
  45. package/dist/app/builder/use-builder-catalogue.js.map +1 -1
  46. package/dist/app/builder/use-save-dashboard.d.ts +3 -1
  47. package/dist/app/builder/use-save-dashboard.d.ts.map +1 -1
  48. package/dist/app/builder/use-save-dashboard.js +3 -1
  49. package/dist/app/builder/use-save-dashboard.js.map +1 -1
  50. package/dist/app/index.d.ts +1 -1
  51. package/dist/app/index.d.ts.map +1 -1
  52. package/dist/app/index.js.map +1 -1
  53. package/dist/app/layout-builder.d.ts +7 -2
  54. package/dist/app/layout-builder.d.ts.map +1 -1
  55. package/dist/app/layout-builder.js +17 -5
  56. package/dist/app/layout-builder.js.map +1 -1
  57. package/dist/app/mcp-app-view-chrome.d.ts +94 -20
  58. package/dist/app/mcp-app-view-chrome.d.ts.map +1 -1
  59. package/dist/app/mcp-app-view-chrome.js +109 -40
  60. package/dist/app/mcp-app-view-chrome.js.map +1 -1
  61. package/dist/app/mcp-app-view-states.d.ts +15 -0
  62. package/dist/app/mcp-app-view-states.d.ts.map +1 -0
  63. package/dist/app/mcp-app-view-states.js +34 -0
  64. package/dist/app/mcp-app-view-states.js.map +1 -0
  65. package/dist/app/mcp-app-view.d.ts +40 -5
  66. package/dist/app/mcp-app-view.d.ts.map +1 -1
  67. package/dist/app/mcp-app-view.js +174 -128
  68. package/dist/app/mcp-app-view.js.map +1 -1
  69. package/dist/app/mcp-toolkit-app.d.ts +2 -1
  70. package/dist/app/mcp-toolkit-app.d.ts.map +1 -1
  71. package/dist/app/mcp-toolkit-app.js +25 -3
  72. package/dist/app/mcp-toolkit-app.js.map +1 -1
  73. package/dist/app/use-view-lifecycle.d.ts +38 -0
  74. package/dist/app/use-view-lifecycle.d.ts.map +1 -0
  75. package/dist/app/use-view-lifecycle.js +79 -0
  76. package/dist/app/use-view-lifecycle.js.map +1 -0
  77. package/dist/app/view-lifecycle.d.ts +109 -0
  78. package/dist/app/view-lifecycle.d.ts.map +1 -0
  79. package/dist/app/view-lifecycle.js +120 -0
  80. package/dist/app/view-lifecycle.js.map +1 -0
  81. package/dist/app/widget-props-sheet.d.ts +3 -9
  82. package/dist/app/widget-props-sheet.d.ts.map +1 -1
  83. package/dist/app/widget-props-sheet.js +6 -13
  84. package/dist/app/widget-props-sheet.js.map +1 -1
  85. package/dist/app/widget-renderer.d.ts +41 -1
  86. package/dist/app/widget-renderer.d.ts.map +1 -1
  87. package/dist/app/widget-renderer.js +82 -31
  88. package/dist/app/widget-renderer.js.map +1 -1
  89. package/dist/components/DrillButton.d.ts.map +1 -1
  90. package/dist/components/DrillButton.js +2 -1
  91. package/dist/components/DrillButton.js.map +1 -1
  92. package/dist/components/EmptyState.d.ts +33 -0
  93. package/dist/components/EmptyState.d.ts.map +1 -0
  94. package/dist/components/EmptyState.js +17 -0
  95. package/dist/components/EmptyState.js.map +1 -0
  96. package/dist/components/ErrorState.d.ts +50 -0
  97. package/dist/components/ErrorState.d.ts.map +1 -0
  98. package/dist/components/ErrorState.js +60 -0
  99. package/dist/components/ErrorState.js.map +1 -0
  100. package/dist/components/FilterBar.d.ts +1 -1
  101. package/dist/components/FilterBar.d.ts.map +1 -1
  102. package/dist/components/FilterBar.js +7 -4
  103. package/dist/components/FilterBar.js.map +1 -1
  104. package/dist/components/GroupCard.d.ts.map +1 -1
  105. package/dist/components/GroupCard.js +2 -1
  106. package/dist/components/GroupCard.js.map +1 -1
  107. package/dist/components/KpiGrid.d.ts +10 -3
  108. package/dist/components/KpiGrid.d.ts.map +1 -1
  109. package/dist/components/KpiGrid.js +31 -9
  110. package/dist/components/KpiGrid.js.map +1 -1
  111. package/dist/components/ListFooter.d.ts +3 -2
  112. package/dist/components/ListFooter.d.ts.map +1 -1
  113. package/dist/components/ListFooter.js +14 -4
  114. package/dist/components/ListFooter.js.map +1 -1
  115. package/dist/components/Pills.d.ts +10 -6
  116. package/dist/components/Pills.d.ts.map +1 -1
  117. package/dist/components/Pills.js +12 -6
  118. package/dist/components/Pills.js.map +1 -1
  119. package/dist/components/Toast.d.ts +37 -0
  120. package/dist/components/Toast.d.ts.map +1 -0
  121. package/dist/components/Toast.js +91 -0
  122. package/dist/components/Toast.js.map +1 -0
  123. package/dist/components/WidgetHeader.js +1 -1
  124. package/dist/hooks/use-tool-result-recovery.d.ts +23 -1
  125. package/dist/hooks/use-tool-result-recovery.d.ts.map +1 -1
  126. package/dist/hooks/use-tool-result-recovery.js +21 -7
  127. package/dist/hooks/use-tool-result-recovery.js.map +1 -1
  128. package/dist/hooks/use-view-data.d.ts +6 -0
  129. package/dist/hooks/use-view-data.d.ts.map +1 -1
  130. package/dist/hooks/use-view-data.js +6 -1
  131. package/dist/hooks/use-view-data.js.map +1 -1
  132. package/dist/index.d.ts +12 -5
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +14 -4
  135. package/dist/index.js.map +1 -1
  136. package/dist/lib/focus-ring.d.ts +18 -0
  137. package/dist/lib/focus-ring.d.ts.map +1 -0
  138. package/dist/lib/focus-ring.js +18 -0
  139. package/dist/lib/focus-ring.js.map +1 -0
  140. package/dist/lib/icon-stroke.d.ts +12 -0
  141. package/dist/lib/icon-stroke.d.ts.map +1 -0
  142. package/dist/lib/icon-stroke.js +12 -0
  143. package/dist/lib/icon-stroke.js.map +1 -0
  144. package/dist/lib/toast-model.d.ts +46 -0
  145. package/dist/lib/toast-model.d.ts.map +1 -0
  146. package/dist/lib/toast-model.js +36 -0
  147. package/dist/lib/toast-model.js.map +1 -0
  148. package/dist/lib/tone-utils.d.ts +43 -9
  149. package/dist/lib/tone-utils.d.ts.map +1 -1
  150. package/dist/lib/tone-utils.js +36 -7
  151. package/dist/lib/tone-utils.js.map +1 -1
  152. package/dist/locale/index.d.ts +3 -1
  153. package/dist/locale/index.d.ts.map +1 -1
  154. package/dist/locale/index.js +2 -1
  155. package/dist/locale/index.js.map +1 -1
  156. package/dist/locale/locale-provider.d.ts +42 -1
  157. package/dist/locale/locale-provider.d.ts.map +1 -1
  158. package/dist/locale/locale-provider.js +44 -3
  159. package/dist/locale/locale-provider.js.map +1 -1
  160. package/dist/locale/message-types.d.ts +223 -0
  161. package/dist/locale/message-types.d.ts.map +1 -0
  162. package/dist/locale/message-types.js +7 -0
  163. package/dist/locale/message-types.js.map +1 -0
  164. package/dist/locale/messages-de.d.ts +9 -0
  165. package/dist/locale/messages-de.d.ts.map +1 -0
  166. package/dist/locale/messages-de.js +151 -0
  167. package/dist/locale/messages-de.js.map +1 -0
  168. package/dist/locale/messages-en.d.ts +8 -0
  169. package/dist/locale/messages-en.d.ts.map +1 -0
  170. package/dist/locale/messages-en.js +150 -0
  171. package/dist/locale/messages-en.js.map +1 -0
  172. package/dist/locale/toolkit-messages.d.ts +39 -0
  173. package/dist/locale/toolkit-messages.d.ts.map +1 -0
  174. package/dist/locale/toolkit-messages.js +50 -0
  175. package/dist/locale/toolkit-messages.js.map +1 -0
  176. package/dist/primitives/alert.d.ts.map +1 -1
  177. package/dist/primitives/alert.js +4 -2
  178. package/dist/primitives/alert.js.map +1 -1
  179. package/dist/primitives/badge.d.ts +1 -1
  180. package/dist/primitives/badge.d.ts.map +1 -1
  181. package/dist/primitives/badge.js +14 -6
  182. package/dist/primitives/badge.js.map +1 -1
  183. package/dist/primitives/button.d.ts.map +1 -1
  184. package/dist/primitives/button.js +12 -8
  185. package/dist/primitives/button.js.map +1 -1
  186. package/dist/primitives/card.js +4 -4
  187. package/dist/primitives/card.js.map +1 -1
  188. package/dist/primitives/dialog.d.ts +7 -3
  189. package/dist/primitives/dialog.d.ts.map +1 -1
  190. package/dist/primitives/dialog.js +14 -7
  191. package/dist/primitives/dialog.js.map +1 -1
  192. package/dist/primitives/input.d.ts.map +1 -1
  193. package/dist/primitives/input.js +4 -1
  194. package/dist/primitives/input.js.map +1 -1
  195. package/dist/primitives/scroll-area.js +1 -1
  196. package/dist/primitives/scroll-area.js.map +1 -1
  197. package/dist/primitives/select.d.ts.map +1 -1
  198. package/dist/primitives/select.js +5 -2
  199. package/dist/primitives/select.js.map +1 -1
  200. package/dist/primitives/sheet.d.ts +3 -1
  201. package/dist/primitives/sheet.d.ts.map +1 -1
  202. package/dist/primitives/sheet.js +12 -6
  203. package/dist/primitives/sheet.js.map +1 -1
  204. package/dist/primitives/skeleton.js +1 -1
  205. package/dist/primitives/skeleton.js.map +1 -1
  206. package/dist/primitives/switch.d.ts.map +1 -1
  207. package/dist/primitives/switch.js +2 -1
  208. package/dist/primitives/switch.js.map +1 -1
  209. package/dist/primitives/tabs.d.ts.map +1 -1
  210. package/dist/primitives/tabs.js +5 -3
  211. package/dist/primitives/tabs.js.map +1 -1
  212. package/dist/render-cases.d.ts.map +1 -1
  213. package/dist/render-cases.js +20 -2
  214. package/dist/render-cases.js.map +1 -1
  215. package/dist/render-scan.d.ts +25 -0
  216. package/dist/render-scan.d.ts.map +1 -0
  217. package/dist/render-scan.js +66 -0
  218. package/dist/render-scan.js.map +1 -0
  219. package/dist/theme/cd-tokens.d.ts +66 -0
  220. package/dist/theme/cd-tokens.d.ts.map +1 -0
  221. package/dist/theme/cd-tokens.js +64 -0
  222. package/dist/theme/cd-tokens.js.map +1 -0
  223. package/dist/theme/create-theme.d.ts +196 -39
  224. package/dist/theme/create-theme.d.ts.map +1 -1
  225. package/dist/theme/create-theme.js +189 -13
  226. package/dist/theme/create-theme.js.map +1 -1
  227. package/dist/theme/fonts.d.ts +38 -0
  228. package/dist/theme/fonts.d.ts.map +1 -0
  229. package/dist/theme/fonts.js +56 -0
  230. package/dist/theme/fonts.js.map +1 -0
  231. package/dist/theme/host-fonts.d.ts +39 -0
  232. package/dist/theme/host-fonts.d.ts.map +1 -0
  233. package/dist/theme/host-fonts.js +44 -0
  234. package/dist/theme/host-fonts.js.map +1 -0
  235. package/dist/theme/index.d.ts +8 -1
  236. package/dist/theme/index.d.ts.map +1 -1
  237. package/dist/theme/index.js +5 -1
  238. package/dist/theme/index.js.map +1 -1
  239. package/dist/theme/portal-container.d.ts +16 -0
  240. package/dist/theme/portal-container.d.ts.map +1 -0
  241. package/dist/theme/portal-container.js +19 -0
  242. package/dist/theme/portal-container.js.map +1 -0
  243. package/dist/theme/presets.d.ts +24 -9
  244. package/dist/theme/presets.d.ts.map +1 -1
  245. package/dist/theme/presets.js +44 -11
  246. package/dist/theme/presets.js.map +1 -1
  247. package/dist/theme/theme-provider.d.ts +27 -9
  248. package/dist/theme/theme-provider.d.ts.map +1 -1
  249. package/dist/theme/theme-provider.js +42 -20
  250. package/dist/theme/theme-provider.js.map +1 -1
  251. package/package.json +9 -4
  252. package/src/app/builder/BuilderBanners.tsx +26 -13
  253. package/src/app/builder/CanvasRow.tsx +22 -21
  254. package/src/app/builder/CatalogueSheet.tsx +16 -14
  255. package/src/app/builder/EmptyHint.tsx +16 -11
  256. package/src/app/builder/LayoutSurface.tsx +7 -7
  257. package/src/app/builder/PipelineStrip.tsx +26 -17
  258. package/src/app/builder/SaveDialog.tsx +11 -12
  259. package/src/app/builder/Toolbar.tsx +19 -7
  260. package/src/app/builder/Workspace.tsx +5 -3
  261. package/src/app/builder/builder-feedback.test.tsx +75 -0
  262. package/src/app/builder/builder-model.test.ts +5 -0
  263. package/src/app/builder/builder-model.ts +5 -4
  264. package/src/app/builder/labels.ts +15 -121
  265. package/src/app/builder/status-chip.tsx +8 -4
  266. package/src/app/builder/use-builder-catalogue.ts +6 -0
  267. package/src/app/builder/use-save-dashboard.ts +5 -0
  268. package/src/app/index.ts +8 -1
  269. package/src/app/layout-builder.tsx +23 -3
  270. package/src/app/mcp-app-view-chrome.test.tsx +347 -14
  271. package/src/app/mcp-app-view-chrome.tsx +278 -100
  272. package/src/app/mcp-app-view-states.tsx +100 -0
  273. package/src/app/mcp-app-view.test.tsx +258 -0
  274. package/src/app/mcp-app-view.tsx +292 -185
  275. package/src/app/mcp-toolkit-app.tsx +31 -7
  276. package/src/app/use-view-lifecycle.ts +116 -0
  277. package/src/app/view-lifecycle.test.ts +227 -0
  278. package/src/app/view-lifecycle.ts +174 -0
  279. package/src/app/widget-props-sheet.tsx +13 -26
  280. package/src/app/widget-renderer.render.test.tsx +131 -0
  281. package/src/app/widget-renderer.tsx +136 -38
  282. package/src/components/DrillButton.tsx +2 -1
  283. package/src/components/EmptyState.tsx +81 -0
  284. package/src/components/ErrorState.tsx +182 -0
  285. package/src/components/FilterBar.tsx +9 -6
  286. package/src/components/GroupCard.tsx +3 -2
  287. package/src/components/KpiGrid.tsx +75 -44
  288. package/src/components/ListFooter.tsx +17 -6
  289. package/src/components/Pills.tsx +20 -11
  290. package/src/components/Toast.tsx +188 -0
  291. package/src/components/WidgetHeader.tsx +1 -1
  292. package/src/components/feedback-states.test.tsx +225 -0
  293. package/src/components/tone-figures.test.tsx +54 -0
  294. package/src/fonts.css +19 -0
  295. package/src/globals.css +9 -165
  296. package/src/hooks/use-tool-result-recovery.test.ts +25 -1
  297. package/src/hooks/use-tool-result-recovery.ts +34 -6
  298. package/src/hooks/use-view-data.test.tsx +60 -0
  299. package/src/hooks/use-view-data.ts +12 -1
  300. package/src/i18n-coverage.test.tsx +323 -0
  301. package/src/index.ts +57 -5
  302. package/src/lib/focus-ring.ts +20 -0
  303. package/src/lib/icon-stroke.test.ts +59 -0
  304. package/src/lib/icon-stroke.ts +13 -0
  305. package/src/lib/toast-model.test.ts +68 -0
  306. package/src/lib/toast-model.ts +63 -0
  307. package/src/lib/tone-utils.test.ts +47 -14
  308. package/src/lib/tone-utils.ts +61 -13
  309. package/src/locale/index.ts +13 -1
  310. package/src/locale/locale-provider.test.tsx +87 -0
  311. package/src/locale/locale-provider.tsx +90 -3
  312. package/src/locale/message-types.ts +221 -0
  313. package/src/locale/messages-de.ts +159 -0
  314. package/src/locale/messages-en.ts +157 -0
  315. package/src/locale/toolkit-messages.test.ts +216 -0
  316. package/src/locale/toolkit-messages.ts +82 -0
  317. package/src/no-hardcoded-copy.test.ts +432 -0
  318. package/src/primitives/alert.tsx +4 -2
  319. package/src/primitives/badge.tsx +14 -7
  320. package/src/primitives/button.tsx +13 -8
  321. package/src/primitives/card.tsx +4 -4
  322. package/src/primitives/dialog.tsx +32 -7
  323. package/src/primitives/input.tsx +5 -3
  324. package/src/primitives/scroll-area.tsx +1 -1
  325. package/src/primitives/select.tsx +6 -3
  326. package/src/primitives/sheet.tsx +26 -6
  327. package/src/primitives/skeleton.tsx +1 -1
  328. package/src/primitives/switch.tsx +4 -2
  329. package/src/primitives/tabs.tsx +9 -6
  330. package/src/render-cases.tsx +45 -1
  331. package/src/render-scan.ts +75 -0
  332. package/src/theme/cd-tokens.generated.css +48 -0
  333. package/src/theme/cd-tokens.test.ts +107 -0
  334. package/src/theme/cd-tokens.ts +67 -0
  335. package/src/theme/create-theme.test.ts +243 -5
  336. package/src/theme/create-theme.ts +313 -41
  337. package/src/theme/fonts.test.ts +85 -0
  338. package/src/theme/fonts.ts +72 -0
  339. package/src/theme/host-fonts.test.ts +135 -0
  340. package/src/theme/host-fonts.ts +52 -0
  341. package/src/theme/index.ts +15 -1
  342. package/src/theme/portal-container.ts +20 -0
  343. package/src/theme/presets.ts +44 -11
  344. package/src/theme/theme-css.test.ts +568 -0
  345. package/src/theme/theme-provider.test.tsx +82 -0
  346. package/src/theme/theme-provider.tsx +60 -24
  347. package/src/theme.css +314 -0
  348. package/ui-catalog.json +344 -17
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAGvD,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;AAgB1B,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,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"}
@@ -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 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 const FOCUS_RING_INSET = "outline-hidden focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset";
18
+ //# sourceMappingURL=focus-ring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["../../src/lib/focus-ring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GACrB,+HAA+H,CAAA;AAEjI,oGAAoG;AACpG,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uFAAuF,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Lucide stroke widths of the toolkit's chrome (CI §11, on the 24 px grid).
3
+ * Set once through `LucideProvider`: `McpAppView` applies {@link ICON_STROKE}
4
+ * to everything it renders (its toast stack included), dense bars narrow it
5
+ * to {@link DENSE_ICON_STROKE}. Icons of a consumer's own `lucide-react` follow
6
+ * the provider only when they resolve to the same module instance (dedupe it).
7
+ */
8
+ /** Default stroke of the toolkit's icons. */
9
+ export declare const ICON_STROKE = 2.5;
10
+ /** Stroke in dense chrome bars (the view toolbar, the builder's bars). */
11
+ export declare const DENSE_ICON_STROKE = 2;
12
+ //# sourceMappingURL=icon-stroke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-stroke.d.ts","sourceRoot":"","sources":["../../src/lib/icon-stroke.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,IAAI,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Lucide stroke widths of the toolkit's chrome (CI §11, on the 24 px grid).
3
+ * Set once through `LucideProvider`: `McpAppView` applies {@link ICON_STROKE}
4
+ * to everything it renders (its toast stack included), dense bars narrow it
5
+ * to {@link DENSE_ICON_STROKE}. Icons of a consumer's own `lucide-react` follow
6
+ * the provider only when they resolve to the same module instance (dedupe it).
7
+ */
8
+ /** Default stroke of the toolkit's icons. */
9
+ export const ICON_STROKE = 2.5;
10
+ /** Stroke in dense chrome bars (the view toolbar, the builder's bars). */
11
+ export const DENSE_ICON_STROKE = 2;
12
+ //# sourceMappingURL=icon-stroke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-stroke.js","sourceRoot":"","sources":["../../src/lib/icon-stroke.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;AAE9B,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Pure model behind `ToastProvider` / `useToast`: the toast list as a reducer
3
+ * plus the timing rules, so both are testable without a DOM (the house path,
4
+ * FITNESS.md) and the component stays a thin view over them.
5
+ */
6
+ /** Status tone of a toast — the four status roles (`--success` … `--info`). */
7
+ export type ToastTone = "success" | "warning" | "danger" | "info";
8
+ /** What a caller passes to `useToast().show(...)`. */
9
+ export interface ToastOptions {
10
+ /** Status tone; drives the edge, the icon and the default duration. Default `"info"`. */
11
+ tone?: ToastTone;
12
+ /** The message. Say what happened, in one short sentence ("Job retried."). */
13
+ title: string;
14
+ /** Optional second line (what you can do next, or the affected object). */
15
+ description?: string;
16
+ /** Auto-dismiss after this many ms. Defaults per {@link toastDuration}. */
17
+ duration?: number;
18
+ }
19
+ /** A toast as it sits in the list. */
20
+ export interface ToastItem {
21
+ id: number;
22
+ tone: ToastTone;
23
+ title: string;
24
+ description?: string;
25
+ duration: number;
26
+ }
27
+ /** Default lifetime of a toast (CI §8: about 2.8 s). */
28
+ export declare const TOAST_DURATION_MS = 2800;
29
+ /** Lifetime of an error toast (CI §8: about 5 s) — long enough to read the reason. */
30
+ export declare const TOAST_ERROR_DURATION_MS = 5000;
31
+ /** At most this many toasts stack; the oldest leaves first. */
32
+ export declare const MAX_VISIBLE_TOASTS = 3;
33
+ /** The lifetime of a toast: an explicit positive duration, else the tone's default. */
34
+ export declare function toastDuration(tone: ToastTone, explicit?: number): number;
35
+ /** Normalise caller options into a list item. */
36
+ export declare function createToast(id: number, options: ToastOptions): ToastItem;
37
+ export type ToastAction = {
38
+ type: "add";
39
+ toast: ToastItem;
40
+ } | {
41
+ type: "dismiss";
42
+ id: number;
43
+ };
44
+ /** Add appends (dropping the oldest beyond {@link MAX_VISIBLE_TOASTS}); dismiss removes by id. */
45
+ export declare function toastReducer(state: readonly ToastItem[], action: ToastAction): ToastItem[];
46
+ //# sourceMappingURL=toast-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-model.d.ts","sourceRoot":"","sources":["../../src/lib/toast-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEjE,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,yFAAyF;IACzF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,sCAAsC;AACtC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,OAAO,CAAA;AACrC,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,OAAO,CAAA;AAC3C,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED,iDAAiD;AACjD,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,SAAS,CASxE;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7F,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,CAI1F"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Pure model behind `ToastProvider` / `useToast`: the toast list as a reducer
3
+ * plus the timing rules, so both are testable without a DOM (the house path,
4
+ * FITNESS.md) and the component stays a thin view over them.
5
+ */
6
+ /** Default lifetime of a toast (CI §8: about 2.8 s). */
7
+ export const TOAST_DURATION_MS = 2800;
8
+ /** Lifetime of an error toast (CI §8: about 5 s) — long enough to read the reason. */
9
+ export const TOAST_ERROR_DURATION_MS = 5000;
10
+ /** At most this many toasts stack; the oldest leaves first. */
11
+ export const MAX_VISIBLE_TOASTS = 3;
12
+ /** The lifetime of a toast: an explicit positive duration, else the tone's default. */
13
+ export function toastDuration(tone, explicit) {
14
+ if (explicit !== undefined && Number.isFinite(explicit) && explicit > 0)
15
+ return explicit;
16
+ return tone === "danger" ? TOAST_ERROR_DURATION_MS : TOAST_DURATION_MS;
17
+ }
18
+ /** Normalise caller options into a list item. */
19
+ export function createToast(id, options) {
20
+ const tone = options.tone ?? "info";
21
+ return {
22
+ id,
23
+ tone,
24
+ title: options.title,
25
+ ...(options.description ? { description: options.description } : {}),
26
+ duration: toastDuration(tone, options.duration),
27
+ };
28
+ }
29
+ /** Add appends (dropping the oldest beyond {@link MAX_VISIBLE_TOASTS}); dismiss removes by id. */
30
+ export function toastReducer(state, action) {
31
+ if (action.type === "add")
32
+ return [...state, action.toast].slice(-MAX_VISIBLE_TOASTS);
33
+ const next = state.filter((t) => t.id !== action.id);
34
+ return next.length === state.length ? state : next;
35
+ }
36
+ //# sourceMappingURL=toast-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-model.js","sourceRoot":"","sources":["../../src/lib/toast-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,wDAAwD;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AACrC,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAC3C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC,uFAAuF;AACvF,MAAM,UAAU,aAAa,CAAC,IAAe,EAAE,QAAiB;IAC9D,IAAI,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAA;IACxF,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,iBAAiB,CAAA;AACxE,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,OAAqB;IAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAA;IACnC,OAAO;QACL,EAAE;QACF,IAAI;QACJ,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,QAAQ,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;KAChD,CAAA;AACH,CAAC;AAID,kGAAkG;AAClG,MAAM,UAAU,YAAY,CAAC,KAA2B,EAAE,MAAmB;IAC3E,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK;QAAE,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAAA;IACrF,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CAAA;IACpD,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAE,KAAqB,CAAC,CAAC,CAAC,IAAI,CAAA;AACrE,CAAC"}
@@ -1,18 +1,52 @@
1
1
  /**
2
2
  * Single source of truth for the semantic "tones" used across the tone-aware
3
- * components (`Pills`, `KpiGrid`, `WidgetHeader`, …).
3
+ * components (`Pills`, `KpiGrid`, `WidgetHeader`, `Badge`, …).
4
4
  *
5
- * Each tone maps to the status tokens defined in `globals.css`
6
- * (`--danger`, `--warning`, `--success`, `--info`) plus the shadcn neutral ramp
7
- * for the `neutral` tone. All tokens carry light + dark values, so these class
8
- * strings re-theme automatically — change a tone in one place instead of
9
- * hand-rolling `tone === "x" ? "…" : "…"` ternaries at every call site.
5
+ * Every status tone has THREE roles (Miragon CI §3.3), each its own token in
6
+ * `theme.css` with light and dark values:
7
+ *
8
+ * | Role | Token | Map |
9
+ * | ---------------------------- | --------------- | -------------- |
10
+ * | fill, dot, border, icon | `--<tone>` | `TONE_DOT`, `TONE_BORDER`, `TONE_ICON` |
11
+ * | tint (badge/banner surface) | `--<tone>-soft` | `TONE_SOFT` (text on it: the foreground) |
12
+ * | text on a plain surface | `--<tone>-ink` | `TONE_TEXT` |
13
+ *
14
+ * Status is never text in its own colour: success and warning reach only
15
+ * 1.67:1 / 1.83:1 on white, so their ink is the foreground and the tone shows
16
+ * as a dot, icon or border NEXT to the text. On a tint the text is always the
17
+ * foreground (CI §3.3: "-soft: Text darauf --cd-schwarz, Rand in der
18
+ * Statusfarbe"), so pair `TONE_SOFT` with `TONE_BORDER`. `TONE_TEXT` is for
19
+ * a tone's words on a plain surface (a field error); figures — counts, KPI
20
+ * values, trends — never take it: they stay in the foreground next to a
21
+ * `TONE_DOT`. In dark mode the colours are the `-hell` values and the tints
22
+ * are transparent (no tinted fills on dark). The `neutral` tone reuses the
23
+ * muted ramp.
24
+ *
25
+ * Change a tone here, in one place, instead of hand-rolling
26
+ * `tone === "x" ? "…" : "…"` ternaries at every call site.
10
27
  */
11
28
  export type ToneVariant = "neutral" | "info" | "success" | "warning" | "danger";
12
- /** Tinted background + readable foreground — badges, icon tiles, pills. */
29
+ /**
30
+ * Tinted surface + its text (the foreground: CI §3.3) — badges, pills,
31
+ * banners. Pair it with {@link TONE_BORDER}: the rim carries the tone, and in
32
+ * dark mode (no tints) it is all that does.
33
+ */
13
34
  export declare const TONE_SOFT: Record<ToneVariant, string>;
14
- /** Solid dot color — status dots next to a label. */
35
+ /** Solid dot colour — a status dot next to a label. */
15
36
  export declare const TONE_DOT: Record<ToneVariant, string>;
16
- /** Foreground-only color — metric values, inline emphasis. */
37
+ /**
38
+ * The tone's TEXT colour (its `-ink` role) for words on a plain surface — a
39
+ * field error, a "missing" label. Success and warning resolve to the
40
+ * foreground on light: pair the text with a {@link TONE_DOT} or
41
+ * {@link TONE_ICON} to show the tone. Never on a tint (use {@link TONE_SOFT})
42
+ * and never for figures (they stay in the foreground next to a dot).
43
+ */
17
44
  export declare const TONE_TEXT: Record<ToneVariant, string>;
45
+ /** Border colour in the tone — the rim of a tinted badge, banner or toast. */
46
+ export declare const TONE_BORDER: Record<ToneVariant, string>;
47
+ /**
48
+ * Icon colour in the tone (SVG `currentColor`). For icons only — never for
49
+ * text: an icon next to its label carries the tone, the label stays readable.
50
+ */
51
+ export declare const TONE_ICON: Record<ToneVariant, string>;
18
52
  //# sourceMappingURL=tone-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tone-utils.d.ts","sourceRoot":"","sources":["../../src/lib/tone-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;AAE/E,2EAA2E;AAC3E,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMjD,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMhD,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMjD,CAAA"}
1
+ {"version":3,"file":"tone-utils.d.ts","sourceRoot":"","sources":["../../src/lib/tone-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMjD,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMhD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMjD,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMnD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMjD,CAAA"}
@@ -1,12 +1,16 @@
1
- /** Tinted background + readable foreground — badges, icon tiles, pills. */
1
+ /**
2
+ * Tinted surface + its text (the foreground: CI §3.3) — badges, pills,
3
+ * banners. Pair it with {@link TONE_BORDER}: the rim carries the tone, and in
4
+ * dark mode (no tints) it is all that does.
5
+ */
2
6
  export const TONE_SOFT = {
3
7
  neutral: "bg-muted text-muted-foreground",
4
- info: "bg-info-soft text-info",
5
- success: "bg-success-soft text-success",
6
- warning: "bg-warning-soft text-warning",
7
- danger: "bg-danger-soft text-danger",
8
+ info: "bg-info-soft text-foreground",
9
+ success: "bg-success-soft text-foreground",
10
+ warning: "bg-warning-soft text-foreground",
11
+ danger: "bg-danger-soft text-foreground",
8
12
  };
9
- /** Solid dot color — status dots next to a label. */
13
+ /** Solid dot colour — a status dot next to a label. */
10
14
  export const TONE_DOT = {
11
15
  neutral: "bg-muted-foreground",
12
16
  info: "bg-info",
@@ -14,9 +18,34 @@ export const TONE_DOT = {
14
18
  warning: "bg-warning",
15
19
  danger: "bg-danger",
16
20
  };
17
- /** Foreground-only color — metric values, inline emphasis. */
21
+ /**
22
+ * The tone's TEXT colour (its `-ink` role) for words on a plain surface — a
23
+ * field error, a "missing" label. Success and warning resolve to the
24
+ * foreground on light: pair the text with a {@link TONE_DOT} or
25
+ * {@link TONE_ICON} to show the tone. Never on a tint (use {@link TONE_SOFT})
26
+ * and never for figures (they stay in the foreground next to a dot).
27
+ */
18
28
  export const TONE_TEXT = {
19
29
  neutral: "text-foreground",
30
+ info: "text-info-ink",
31
+ success: "text-success-ink",
32
+ warning: "text-warning-ink",
33
+ danger: "text-danger-ink",
34
+ };
35
+ /** Border colour in the tone — the rim of a tinted badge, banner or toast. */
36
+ export const TONE_BORDER = {
37
+ neutral: "border-border",
38
+ info: "border-info",
39
+ success: "border-success",
40
+ warning: "border-warning",
41
+ danger: "border-danger",
42
+ };
43
+ /**
44
+ * Icon colour in the tone (SVG `currentColor`). For icons only — never for
45
+ * text: an icon next to its label carries the tone, the label stays readable.
46
+ */
47
+ export const TONE_ICON = {
48
+ neutral: "text-muted-foreground",
20
49
  info: "text-info",
21
50
  success: "text-success",
22
51
  warning: "text-warning",
@@ -1 +1 @@
1
- {"version":3,"file":"tone-utils.js","sourceRoot":"","sources":["../../src/lib/tone-utils.ts"],"names":[],"mappings":"AAYA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAgC;IACpD,OAAO,EAAE,gCAAgC;IACzC,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,8BAA8B;IACvC,OAAO,EAAE,8BAA8B;IACvC,MAAM,EAAE,4BAA4B;CACrC,CAAA;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,QAAQ,GAAgC;IACnD,OAAO,EAAE,qBAAqB;IAC9B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;CACpB,CAAA;AAED,8DAA8D;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAgC;IACpD,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;CACtB,CAAA"}
1
+ {"version":3,"file":"tone-utils.js","sourceRoot":"","sources":["../../src/lib/tone-utils.ts"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAgC;IACpD,OAAO,EAAE,gCAAgC;IACzC,IAAI,EAAE,8BAA8B;IACpC,OAAO,EAAE,iCAAiC;IAC1C,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,gCAAgC;CACzC,CAAA;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,QAAQ,GAAgC;IACnD,OAAO,EAAE,qBAAqB;IAC9B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;CACpB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAgC;IACpD,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,iBAAiB;CAC1B,CAAA;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAgC;IACtD,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,eAAe;CACxB,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAgC;IACpD,OAAO,EAAE,uBAAuB;IAChC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;CACtB,CAAA"}
@@ -1,3 +1,5 @@
1
- export { LocaleProvider, useLocale, useTranslate } from "./locale-provider.js";
1
+ export { LocaleProvider, useLocale, useTranslate, useToolkitMessages } from "./locale-provider.js";
2
2
  export type { LocaleContextValue, LocaleProviderProps, BoundTranslate } from "./locale-provider.js";
3
+ export { TOOLKIT_MESSAGES, formatCount, resolveToolkitMessages } from "./toolkit-messages.js";
4
+ export type { BuilderMessages, CommonMessages, ListFooterMessages, PropsSheetMessages, RendererMessages, ToolkitLocale, ToolkitMessages, ToolkitMessagesOverride, ViewMessages, } from "./toolkit-messages.js";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAC9E,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAClG,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnG,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC7F,YAAY,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,uBAAuB,EACvB,YAAY,GACb,MAAM,uBAAuB,CAAA"}
@@ -3,5 +3,6 @@
3
3
  // <LocaleProvider> and reads the active locale with useLocale/useTranslate,
4
4
  // without pulling in the host runtime. Pairs with `createTranslator` from
5
5
  // `@miragon/mcp-toolkit-core`.
6
- export { LocaleProvider, useLocale, useTranslate } from "./locale-provider.js";
6
+ export { LocaleProvider, useLocale, useTranslate, useToolkitMessages } from "./locale-provider.js";
7
+ export { TOOLKIT_MESSAGES, formatCount, resolveToolkitMessages } from "./toolkit-messages.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,+BAA+B;AAC/B,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,+BAA+B;AAC/B,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAElG,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { Translate } from "@miragon/mcp-toolkit-core";
3
+ import { type ToolkitMessages, type ToolkitMessagesOverride } from "./toolkit-messages.js";
3
4
  /**
4
5
  * A locale-bound translate: the active locale is already applied, so call sites
5
6
  * only pass a key (+ params). Obtained from {@link useTranslate}.
@@ -11,6 +12,14 @@ export interface LocaleContextValue {
11
12
  locale: string;
12
13
  /** Translate a key in the active locale. */
13
14
  t: BoundTranslate;
15
+ /**
16
+ * The toolkit's own strings for the active locale (its shipped `en`/`de`
17
+ * catalog, English for any other locale) with the provider's
18
+ * `toolkitMessages` override applied. Read it with {@link useToolkitMessages}.
19
+ * Optional on the type (a hand-built value may omit it); `LocaleProvider`
20
+ * always sets it.
21
+ */
22
+ messages?: ToolkitMessages;
14
23
  }
15
24
  /** Read the active locale tag from the nearest {@link LocaleProvider}. */
16
25
  export declare function useLocale(): string;
@@ -20,6 +29,32 @@ export declare function useLocale(): string;
20
29
  * render their keys instead of throwing.
21
30
  */
22
31
  export declare function useTranslate(): BoundTranslate;
32
+ /**
33
+ * The toolkit's own UI strings for the nearest {@link LocaleProvider}'s locale
34
+ * (English outside a provider). Every toolkit component reads its captions,
35
+ * labels and accessible names here, so a German locale renders no English
36
+ * toolkit chrome.
37
+ */
38
+ export declare function useToolkitMessages(): ToolkitMessages;
39
+ /**
40
+ * The locale the toolkit's own text is in: the nearest {@link LocaleProvider}'s,
41
+ * else a {@link ToolkitLocaleFallback}'s (the host's, inside `McpAppView`),
42
+ * else `"en"`. Toolkit components format their numbers with it, so a count
43
+ * always matches the language of the sentence around it. Internal: consumer
44
+ * widgets read {@link useLocale}.
45
+ */
46
+ export declare function useToolkitLocale(): string;
47
+ /**
48
+ * Binds ONLY the toolkit's own strings and number format to `locale` for a
49
+ * subtree — the fallback `McpAppView` mounts with the host's locale. It is not
50
+ * a {@link LocaleProvider}: {@link useLocale} and {@link useTranslate} keep
51
+ * their outside-a-provider behaviour (`"en"`, echoed keys) for consumer
52
+ * widgets, and any `LocaleProvider` above or below wins over it.
53
+ */
54
+ export declare function ToolkitLocaleFallback({ locale, children, }: {
55
+ locale: string;
56
+ children: ReactNode;
57
+ }): ReactNode;
23
58
  export interface LocaleProviderProps {
24
59
  /** The active locale tag (e.g. `"en"`, `"de"`). */
25
60
  locale: string;
@@ -29,6 +64,12 @@ export interface LocaleProviderProps {
29
64
  * consumer wires the locale before any catalog exists.
30
65
  */
31
66
  translator?: Translate;
67
+ /**
68
+ * Override individual toolkit strings for this subtree, per catalog section
69
+ * (e.g. `{ listFooter: { loadMore: "Show more" } }`). Omitted entries keep the
70
+ * shipped `en`/`de` catalog of `locale`.
71
+ */
72
+ toolkitMessages?: ToolkitMessagesOverride;
32
73
  children: ReactNode;
33
74
  }
34
75
  /**
@@ -46,5 +87,5 @@ export interface LocaleProviderProps {
46
87
  * <YourWidget />
47
88
  * </LocaleProvider>
48
89
  */
49
- export declare function LocaleProvider({ locale, translator, children }: LocaleProviderProps): ReactNode;
90
+ export declare function LocaleProvider({ locale, translator, toolkitMessages, children, }: LocaleProviderProps): ReactNode;
50
91
  //# sourceMappingURL=locale-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale-provider.d.ts","sourceRoot":"","sources":["../../src/locale/locale-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAA;AAEtF,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,CAAC,EAAE,cAAc,CAAA;CAClB;AAeD,0EAA0E;AAC1E,wBAAgB,SAAS,IAAI,MA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pC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,SAAS,CAUZ;AAED,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,uBAAuB,CAAA;IACzC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,UAAU,EACV,eAAe,EACf,QAAQ,GACT,EAAE,mBAAmB,GAAG,SAAS,CAUjC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useMemo } from "react";
3
+ import { resolveToolkitMessages, } from "./toolkit-messages.js";
3
4
  const DEFAULT_LOCALE = "en";
4
5
  /**
5
6
  * Default used when a widget renders *outside* a {@link LocaleProvider} (e.g. a
@@ -8,8 +9,13 @@ const DEFAULT_LOCALE = "en";
8
9
  * missing wrapper echoes the key (visible + greppable) instead of crashing a
9
10
  * widget that is perfectly renderable in English.
10
11
  */
11
- const DEFAULT_VALUE = { locale: DEFAULT_LOCALE, t: (key) => key };
12
+ const DEFAULT_VALUE = {
13
+ locale: DEFAULT_LOCALE,
14
+ t: (key) => key,
15
+ messages: resolveToolkitMessages(DEFAULT_LOCALE),
16
+ };
12
17
  const LocaleContext = createContext(null);
18
+ const ToolkitLocaleFallbackContext = createContext(null);
13
19
  /** Read the active locale tag from the nearest {@link LocaleProvider}. */
14
20
  export function useLocale() {
15
21
  return useContext(LocaleContext)?.locale ?? DEFAULT_VALUE.locale;
@@ -22,6 +28,40 @@ export function useLocale() {
22
28
  export function useTranslate() {
23
29
  return useContext(LocaleContext)?.t ?? DEFAULT_VALUE.t;
24
30
  }
31
+ /**
32
+ * The toolkit's own UI strings for the nearest {@link LocaleProvider}'s locale
33
+ * (English outside a provider). Every toolkit component reads its captions,
34
+ * labels and accessible names here, so a German locale renders no English
35
+ * toolkit chrome.
36
+ */
37
+ export function useToolkitMessages() {
38
+ const provided = useContext(LocaleContext);
39
+ const fallback = useContext(ToolkitLocaleFallbackContext);
40
+ return provided?.messages ?? fallback?.messages ?? DEFAULT_VALUE.messages;
41
+ }
42
+ /**
43
+ * The locale the toolkit's own text is in: the nearest {@link LocaleProvider}'s,
44
+ * else a {@link ToolkitLocaleFallback}'s (the host's, inside `McpAppView`),
45
+ * else `"en"`. Toolkit components format their numbers with it, so a count
46
+ * always matches the language of the sentence around it. Internal: consumer
47
+ * widgets read {@link useLocale}.
48
+ */
49
+ export function useToolkitLocale() {
50
+ const provided = useContext(LocaleContext);
51
+ const fallback = useContext(ToolkitLocaleFallbackContext);
52
+ return provided?.locale ?? fallback?.locale ?? DEFAULT_VALUE.locale;
53
+ }
54
+ /**
55
+ * Binds ONLY the toolkit's own strings and number format to `locale` for a
56
+ * subtree — the fallback `McpAppView` mounts with the host's locale. It is not
57
+ * a {@link LocaleProvider}: {@link useLocale} and {@link useTranslate} keep
58
+ * their outside-a-provider behaviour (`"en"`, echoed keys) for consumer
59
+ * widgets, and any `LocaleProvider` above or below wins over it.
60
+ */
61
+ export function ToolkitLocaleFallback({ locale, children, }) {
62
+ const value = useMemo(() => ({ locale, messages: resolveToolkitMessages(locale) }), [locale]);
63
+ return (_jsx(ToolkitLocaleFallbackContext.Provider, { value: value, children: children }));
64
+ }
25
65
  /**
26
66
  * Provide the active locale (and an optional translator) to a subtree. Widgets
27
67
  * read it with {@link useLocale} / {@link useTranslate}. Pure React (no
@@ -37,11 +77,12 @@ export function useTranslate() {
37
77
  * <YourWidget />
38
78
  * </LocaleProvider>
39
79
  */
40
- export function LocaleProvider({ locale, translator, children }) {
80
+ export function LocaleProvider({ locale, translator, toolkitMessages, children, }) {
41
81
  const value = useMemo(() => ({
42
82
  locale,
43
83
  t: translator ? (key, params) => translator(locale, key, params) : (key) => key,
44
- }), [locale, translator]);
84
+ messages: resolveToolkitMessages(locale, toolkitMessages),
85
+ }), [locale, translator, toolkitMessages]);
45
86
  return _jsx(LocaleContext.Provider, { value: value, children: children });
46
87
  }
47
88
  //# sourceMappingURL=locale-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale-provider.js","sourceRoot":"","sources":["../../src/locale/locale-provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAA;AAiB1E,MAAM,cAAc,GAAG,IAAI,CAAA;AAE3B;;;;;;GAMG;AACH,MAAM,aAAa,GAAuB,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAA;AAErF,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAA;AAEpE,0EAA0E;AAC1E,MAAM,UAAU,SAAS;IACvB,OAAO,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,CAAA;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,aAAa,CAAC,CAAC,CAAA;AACxD,CAAC;AAcD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAuB;IAClF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;KAChF,CAAC,EACF,CAAC,MAAM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