@frontmcp/uipack 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/CLAUDE.md +88 -105
  2. package/README.md +1 -0
  3. package/adapters/index.d.ts +1 -1
  4. package/adapters/index.d.ts.map +1 -1
  5. package/adapters/index.js +35 -2
  6. package/adapters/platform-meta.d.ts +29 -0
  7. package/adapters/platform-meta.d.ts.map +1 -1
  8. package/base-template/default-base-template.d.ts +0 -1
  9. package/base-template/default-base-template.d.ts.map +1 -1
  10. package/base-template/index.js +32 -37
  11. package/build/builders/base-builder.d.ts +122 -0
  12. package/build/builders/base-builder.d.ts.map +1 -0
  13. package/build/builders/esbuild-config.d.ts +94 -0
  14. package/build/builders/esbuild-config.d.ts.map +1 -0
  15. package/build/builders/hybrid-builder.d.ts +93 -0
  16. package/build/builders/hybrid-builder.d.ts.map +1 -0
  17. package/build/builders/index.d.ts +17 -0
  18. package/build/builders/index.d.ts.map +1 -0
  19. package/build/builders/inline-builder.d.ts +83 -0
  20. package/build/builders/inline-builder.d.ts.map +1 -0
  21. package/build/builders/static-builder.d.ts +78 -0
  22. package/build/builders/static-builder.d.ts.map +1 -0
  23. package/build/builders/types.d.ts +341 -0
  24. package/build/builders/types.d.ts.map +1 -0
  25. package/build/cdn-resources.d.ts +3 -2
  26. package/build/cdn-resources.d.ts.map +1 -1
  27. package/build/hybrid-data.d.ts +127 -0
  28. package/build/hybrid-data.d.ts.map +1 -0
  29. package/build/index.d.ts +4 -0
  30. package/build/index.d.ts.map +1 -1
  31. package/build/index.js +1885 -171
  32. package/build/ui-components-browser.d.ts +64 -0
  33. package/build/ui-components-browser.d.ts.map +1 -0
  34. package/build/widget-manifest.d.ts.map +1 -1
  35. package/bundler/file-cache/component-builder.d.ts.map +1 -1
  36. package/bundler/file-cache/storage/redis.d.ts.map +1 -1
  37. package/bundler/index.js +6 -4
  38. package/dependency/cdn-registry.d.ts +1 -1
  39. package/dependency/cdn-registry.d.ts.map +1 -1
  40. package/dependency/import-map.d.ts.map +1 -1
  41. package/dependency/index.js +93 -121
  42. package/dependency/resolver.d.ts.map +1 -1
  43. package/esm/adapters/{index.js → index.mjs} +34 -2
  44. package/esm/base-template/{index.js → index.mjs} +32 -37
  45. package/esm/build/{index.js → index.mjs} +1855 -170
  46. package/esm/bundler/{index.js → index.mjs} +6 -4
  47. package/esm/dependency/{index.js → index.mjs} +93 -121
  48. package/esm/handlebars/{index.js → index.mjs} +0 -1
  49. package/esm/{index.js → index.mjs} +2516 -830
  50. package/esm/package.json +7 -6
  51. package/esm/registry/{index.js → index.mjs} +196 -264
  52. package/esm/renderers/{index.js → index.mjs} +106 -200
  53. package/esm/runtime/{index.js → index.mjs} +44 -35
  54. package/esm/styles/{index.js → index.mjs} +6 -6
  55. package/esm/theme/{index.js → index.mjs} +90 -42
  56. package/esm/tool-template/{index.js → index.mjs} +35 -28
  57. package/esm/typings/{index.js → index.mjs} +157 -1
  58. package/esm/utils/{index.js → index.mjs} +24 -0
  59. package/esm/validation/{index.js → index.mjs} +0 -1
  60. package/handlebars/expression-extractor.d.ts.map +1 -1
  61. package/handlebars/index.d.ts.map +1 -1
  62. package/handlebars/index.js +0 -1
  63. package/index.d.ts +2 -1
  64. package/index.d.ts.map +1 -1
  65. package/index.js +2545 -835
  66. package/package.json +7 -6
  67. package/preview/claude-preview.d.ts +67 -0
  68. package/preview/claude-preview.d.ts.map +1 -0
  69. package/preview/generic-preview.d.ts +67 -0
  70. package/preview/generic-preview.d.ts.map +1 -0
  71. package/preview/index.d.ts +36 -0
  72. package/preview/index.d.ts.map +1 -0
  73. package/preview/openai-preview.d.ts +70 -0
  74. package/preview/openai-preview.d.ts.map +1 -0
  75. package/preview/types.d.ts +185 -0
  76. package/preview/types.d.ts.map +1 -0
  77. package/registry/index.js +196 -264
  78. package/registry/render-template.d.ts.map +1 -1
  79. package/renderers/index.d.ts +2 -2
  80. package/renderers/index.d.ts.map +1 -1
  81. package/renderers/index.js +110 -204
  82. package/renderers/mdx-client.renderer.d.ts +124 -0
  83. package/renderers/mdx-client.renderer.d.ts.map +1 -0
  84. package/renderers/registry.d.ts +2 -2
  85. package/renderers/registry.d.ts.map +1 -1
  86. package/renderers/types.d.ts +3 -2
  87. package/renderers/types.d.ts.map +1 -1
  88. package/renderers/utils/transpiler.d.ts +8 -27
  89. package/renderers/utils/transpiler.d.ts.map +1 -1
  90. package/runtime/index.js +44 -35
  91. package/runtime/mcp-bridge.d.ts.map +1 -1
  92. package/runtime/renderer-runtime.d.ts.map +1 -1
  93. package/runtime/wrapper.d.ts.map +1 -1
  94. package/styles/index.js +6 -6
  95. package/styles/variants.d.ts +1 -1
  96. package/styles/variants.d.ts.map +1 -1
  97. package/theme/cdn.d.ts.map +1 -1
  98. package/theme/css-to-theme.d.ts +91 -0
  99. package/theme/css-to-theme.d.ts.map +1 -0
  100. package/theme/index.d.ts +2 -1
  101. package/theme/index.d.ts.map +1 -1
  102. package/theme/index.js +92 -43
  103. package/theme/platforms.d.ts +1 -6
  104. package/theme/platforms.d.ts.map +1 -1
  105. package/theme/theme.d.ts.map +1 -1
  106. package/tool-template/builder.d.ts.map +1 -1
  107. package/tool-template/index.js +35 -28
  108. package/typings/index.d.ts +4 -4
  109. package/typings/index.d.ts.map +1 -1
  110. package/typings/index.js +162 -1
  111. package/typings/schemas.d.ts +30 -0
  112. package/typings/schemas.d.ts.map +1 -1
  113. package/typings/type-fetcher.d.ts +74 -1
  114. package/typings/type-fetcher.d.ts.map +1 -1
  115. package/typings/types.d.ts +72 -1
  116. package/typings/types.d.ts.map +1 -1
  117. package/utils/escape-html.d.ts +44 -0
  118. package/utils/escape-html.d.ts.map +1 -1
  119. package/utils/index.d.ts +1 -1
  120. package/utils/index.d.ts.map +1 -1
  121. package/utils/index.js +26 -0
  122. package/validation/index.js +0 -1
  123. package/validation/template-validator.d.ts.map +1 -1
  124. package/esm/adapters/index.d.ts +0 -13
  125. package/esm/adapters/index.d.ts.map +0 -1
  126. package/esm/adapters/platform-meta.d.ts +0 -166
  127. package/esm/adapters/platform-meta.d.ts.map +0 -1
  128. package/esm/adapters/response-builder.d.ts +0 -108
  129. package/esm/adapters/response-builder.d.ts.map +0 -1
  130. package/esm/adapters/serving-mode.d.ts +0 -107
  131. package/esm/adapters/serving-mode.d.ts.map +0 -1
  132. package/esm/base-template/bridge.d.ts +0 -90
  133. package/esm/base-template/bridge.d.ts.map +0 -1
  134. package/esm/base-template/default-base-template.d.ts +0 -92
  135. package/esm/base-template/default-base-template.d.ts.map +0 -1
  136. package/esm/base-template/index.d.ts +0 -15
  137. package/esm/base-template/index.d.ts.map +0 -1
  138. package/esm/base-template/polyfills.d.ts +0 -31
  139. package/esm/base-template/polyfills.d.ts.map +0 -1
  140. package/esm/base-template/theme-styles.d.ts +0 -74
  141. package/esm/base-template/theme-styles.d.ts.map +0 -1
  142. package/esm/bridge-runtime/iife-generator.d.ts +0 -62
  143. package/esm/bridge-runtime/iife-generator.d.ts.map +0 -1
  144. package/esm/bridge-runtime/index.d.ts +0 -10
  145. package/esm/bridge-runtime/index.d.ts.map +0 -1
  146. package/esm/build/cdn-resources.d.ts +0 -243
  147. package/esm/build/cdn-resources.d.ts.map +0 -1
  148. package/esm/build/index.d.ts +0 -295
  149. package/esm/build/index.d.ts.map +0 -1
  150. package/esm/build/widget-manifest.d.ts +0 -362
  151. package/esm/build/widget-manifest.d.ts.map +0 -1
  152. package/esm/bundler/cache.d.ts +0 -173
  153. package/esm/bundler/cache.d.ts.map +0 -1
  154. package/esm/bundler/file-cache/component-builder.d.ts +0 -167
  155. package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
  156. package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
  157. package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  158. package/esm/bundler/file-cache/index.d.ts +0 -12
  159. package/esm/bundler/file-cache/index.d.ts.map +0 -1
  160. package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
  161. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  162. package/esm/bundler/file-cache/storage/index.d.ts +0 -11
  163. package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
  164. package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
  165. package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
  166. package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
  167. package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
  168. package/esm/bundler/index.d.ts +0 -35
  169. package/esm/bundler/index.d.ts.map +0 -1
  170. package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
  171. package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  172. package/esm/bundler/sandbox/executor.d.ts +0 -14
  173. package/esm/bundler/sandbox/executor.d.ts.map +0 -1
  174. package/esm/bundler/sandbox/policy.d.ts +0 -62
  175. package/esm/bundler/sandbox/policy.d.ts.map +0 -1
  176. package/esm/bundler/types.d.ts +0 -702
  177. package/esm/bundler/types.d.ts.map +0 -1
  178. package/esm/dependency/cdn-registry.d.ts +0 -98
  179. package/esm/dependency/cdn-registry.d.ts.map +0 -1
  180. package/esm/dependency/import-map.d.ts +0 -186
  181. package/esm/dependency/import-map.d.ts.map +0 -1
  182. package/esm/dependency/import-parser.d.ts +0 -82
  183. package/esm/dependency/import-parser.d.ts.map +0 -1
  184. package/esm/dependency/index.d.ts +0 -17
  185. package/esm/dependency/index.d.ts.map +0 -1
  186. package/esm/dependency/resolver.d.ts +0 -164
  187. package/esm/dependency/resolver.d.ts.map +0 -1
  188. package/esm/dependency/schemas.d.ts +0 -486
  189. package/esm/dependency/schemas.d.ts.map +0 -1
  190. package/esm/dependency/template-loader.d.ts +0 -204
  191. package/esm/dependency/template-loader.d.ts.map +0 -1
  192. package/esm/dependency/template-processor.d.ts +0 -118
  193. package/esm/dependency/template-processor.d.ts.map +0 -1
  194. package/esm/dependency/types.d.ts +0 -739
  195. package/esm/dependency/types.d.ts.map +0 -1
  196. package/esm/handlebars/expression-extractor.d.ts +0 -147
  197. package/esm/handlebars/expression-extractor.d.ts.map +0 -1
  198. package/esm/handlebars/helpers.d.ts +0 -339
  199. package/esm/handlebars/helpers.d.ts.map +0 -1
  200. package/esm/handlebars/index.d.ts +0 -195
  201. package/esm/handlebars/index.d.ts.map +0 -1
  202. package/esm/index.d.ts +0 -50
  203. package/esm/index.d.ts.map +0 -1
  204. package/esm/registry/index.d.ts +0 -46
  205. package/esm/registry/index.d.ts.map +0 -1
  206. package/esm/registry/render-template.d.ts +0 -91
  207. package/esm/registry/render-template.d.ts.map +0 -1
  208. package/esm/registry/tool-ui.registry.d.ts +0 -294
  209. package/esm/registry/tool-ui.registry.d.ts.map +0 -1
  210. package/esm/registry/uri-utils.d.ts +0 -56
  211. package/esm/registry/uri-utils.d.ts.map +0 -1
  212. package/esm/renderers/cache.d.ts +0 -145
  213. package/esm/renderers/cache.d.ts.map +0 -1
  214. package/esm/renderers/html.renderer.d.ts +0 -123
  215. package/esm/renderers/html.renderer.d.ts.map +0 -1
  216. package/esm/renderers/index.d.ts +0 -36
  217. package/esm/renderers/index.d.ts.map +0 -1
  218. package/esm/renderers/mdx.renderer.d.ts +0 -120
  219. package/esm/renderers/mdx.renderer.d.ts.map +0 -1
  220. package/esm/renderers/registry.d.ts +0 -133
  221. package/esm/renderers/registry.d.ts.map +0 -1
  222. package/esm/renderers/types.d.ts +0 -342
  223. package/esm/renderers/types.d.ts.map +0 -1
  224. package/esm/renderers/utils/detect.d.ts +0 -107
  225. package/esm/renderers/utils/detect.d.ts.map +0 -1
  226. package/esm/renderers/utils/hash.d.ts +0 -40
  227. package/esm/renderers/utils/hash.d.ts.map +0 -1
  228. package/esm/renderers/utils/index.d.ts +0 -9
  229. package/esm/renderers/utils/index.d.ts.map +0 -1
  230. package/esm/renderers/utils/transpiler.d.ts +0 -89
  231. package/esm/renderers/utils/transpiler.d.ts.map +0 -1
  232. package/esm/runtime/adapters/html.adapter.d.ts +0 -59
  233. package/esm/runtime/adapters/html.adapter.d.ts.map +0 -1
  234. package/esm/runtime/adapters/index.d.ts +0 -26
  235. package/esm/runtime/adapters/index.d.ts.map +0 -1
  236. package/esm/runtime/adapters/mdx.adapter.d.ts +0 -73
  237. package/esm/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  238. package/esm/runtime/adapters/types.d.ts +0 -95
  239. package/esm/runtime/adapters/types.d.ts.map +0 -1
  240. package/esm/runtime/csp.d.ts +0 -48
  241. package/esm/runtime/csp.d.ts.map +0 -1
  242. package/esm/runtime/index.d.ts +0 -17
  243. package/esm/runtime/index.d.ts.map +0 -1
  244. package/esm/runtime/mcp-bridge.d.ts +0 -101
  245. package/esm/runtime/mcp-bridge.d.ts.map +0 -1
  246. package/esm/runtime/renderer-runtime.d.ts +0 -133
  247. package/esm/runtime/renderer-runtime.d.ts.map +0 -1
  248. package/esm/runtime/sanitizer.d.ts +0 -172
  249. package/esm/runtime/sanitizer.d.ts.map +0 -1
  250. package/esm/runtime/types.d.ts +0 -415
  251. package/esm/runtime/types.d.ts.map +0 -1
  252. package/esm/runtime/wrapper.d.ts +0 -421
  253. package/esm/runtime/wrapper.d.ts.map +0 -1
  254. package/esm/styles/index.d.ts +0 -8
  255. package/esm/styles/index.d.ts.map +0 -1
  256. package/esm/styles/variants.d.ts +0 -51
  257. package/esm/styles/variants.d.ts.map +0 -1
  258. package/esm/theme/cdn.d.ts +0 -195
  259. package/esm/theme/cdn.d.ts.map +0 -1
  260. package/esm/theme/index.d.ts +0 -18
  261. package/esm/theme/index.d.ts.map +0 -1
  262. package/esm/theme/platforms.d.ts +0 -107
  263. package/esm/theme/platforms.d.ts.map +0 -1
  264. package/esm/theme/presets/github-openai.d.ts +0 -50
  265. package/esm/theme/presets/github-openai.d.ts.map +0 -1
  266. package/esm/theme/presets/index.d.ts +0 -11
  267. package/esm/theme/presets/index.d.ts.map +0 -1
  268. package/esm/theme/theme.d.ts +0 -396
  269. package/esm/theme/theme.d.ts.map +0 -1
  270. package/esm/tool-template/builder.d.ts +0 -213
  271. package/esm/tool-template/builder.d.ts.map +0 -1
  272. package/esm/tool-template/index.d.ts +0 -16
  273. package/esm/tool-template/index.d.ts.map +0 -1
  274. package/esm/types/index.d.ts +0 -14
  275. package/esm/types/index.d.ts.map +0 -1
  276. package/esm/types/ui-config.d.ts +0 -641
  277. package/esm/types/ui-config.d.ts.map +0 -1
  278. package/esm/types/ui-runtime.d.ts +0 -1008
  279. package/esm/types/ui-runtime.d.ts.map +0 -1
  280. package/esm/typings/cache/cache-adapter.d.ts +0 -125
  281. package/esm/typings/cache/cache-adapter.d.ts.map +0 -1
  282. package/esm/typings/cache/index.d.ts +0 -10
  283. package/esm/typings/cache/index.d.ts.map +0 -1
  284. package/esm/typings/cache/memory-cache.d.ts +0 -92
  285. package/esm/typings/cache/memory-cache.d.ts.map +0 -1
  286. package/esm/typings/dts-parser.d.ts +0 -90
  287. package/esm/typings/dts-parser.d.ts.map +0 -1
  288. package/esm/typings/index.d.ts +0 -48
  289. package/esm/typings/index.d.ts.map +0 -1
  290. package/esm/typings/schemas.d.ts +0 -232
  291. package/esm/typings/schemas.d.ts.map +0 -1
  292. package/esm/typings/type-fetcher.d.ts +0 -89
  293. package/esm/typings/type-fetcher.d.ts.map +0 -1
  294. package/esm/typings/types.d.ts +0 -320
  295. package/esm/typings/types.d.ts.map +0 -1
  296. package/esm/utils/escape-html.d.ts +0 -58
  297. package/esm/utils/escape-html.d.ts.map +0 -1
  298. package/esm/utils/index.d.ts +0 -10
  299. package/esm/utils/index.d.ts.map +0 -1
  300. package/esm/utils/safe-stringify.d.ts +0 -30
  301. package/esm/utils/safe-stringify.d.ts.map +0 -1
  302. package/esm/validation/error-box.d.ts +0 -56
  303. package/esm/validation/error-box.d.ts.map +0 -1
  304. package/esm/validation/index.d.ts +0 -13
  305. package/esm/validation/index.d.ts.map +0 -1
  306. package/esm/validation/schema-paths.d.ts +0 -118
  307. package/esm/validation/schema-paths.d.ts.map +0 -1
  308. package/esm/validation/template-validator.d.ts +0 -143
  309. package/esm/validation/template-validator.d.ts.map +0 -1
  310. package/esm/validation/wrapper.d.ts +0 -97
  311. package/esm/validation/wrapper.d.ts.map +0 -1
  312. package/renderers/mdx.renderer.d.ts +0 -120
  313. package/renderers/mdx.renderer.d.ts.map +0 -1
  314. /package/esm/bridge-runtime/{index.js → index.mjs} +0 -0
  315. /package/esm/types/{index.js → index.mjs} +0 -0
package/registry/index.js CHANGED
@@ -34,9 +34,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  function getCachedScript(url) {
35
35
  return scriptCache.get(url);
36
36
  }
37
- function isScriptCached(url) {
38
- return scriptCache.has(url);
39
- }
40
37
  function buildFontPreconnect() {
41
38
  return CDN.fonts.preconnect.map((url, i) => `<link rel="preconnect" href="${url}"${i > 0 ? " crossorigin" : ""}>`).join("\n ");
42
39
  }
@@ -69,8 +66,9 @@ function buildCdnScripts(options = {}) {
69
66
  const scripts = [];
70
67
  if (inline) {
71
68
  if (tailwind) {
72
- if (isScriptCached(CDN.tailwind)) {
73
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.tailwind)));
69
+ const cached = getCachedScript(CDN.tailwind);
70
+ if (cached) {
71
+ scripts.push(buildInlineScriptTag(cached));
74
72
  } else {
75
73
  console.warn(
76
74
  "[frontmcp/ui] Inline mode requested but Tailwind script not cached. Call fetchAndCacheScripts() first."
@@ -78,8 +76,9 @@ function buildCdnScripts(options = {}) {
78
76
  }
79
77
  }
80
78
  if (htmx) {
81
- if (isScriptCached(CDN.htmx.url)) {
82
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.htmx.url)));
79
+ const cached = getCachedScript(CDN.htmx.url);
80
+ if (cached) {
81
+ scripts.push(buildInlineScriptTag(cached));
83
82
  } else {
84
83
  console.warn(
85
84
  "[frontmcp/ui] Inline mode requested but HTMX script not cached. Call fetchAndCacheScripts() first."
@@ -87,8 +86,9 @@ function buildCdnScripts(options = {}) {
87
86
  }
88
87
  }
89
88
  if (alpine) {
90
- if (isScriptCached(CDN.alpine.url)) {
91
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.alpine.url)));
89
+ const cached = getCachedScript(CDN.alpine.url);
90
+ if (cached) {
91
+ scripts.push(buildInlineScriptTag(cached));
92
92
  } else {
93
93
  console.warn(
94
94
  "[frontmcp/ui] Inline mode requested but Alpine.js script not cached. Call fetchAndCacheScripts() first."
@@ -96,8 +96,9 @@ function buildCdnScripts(options = {}) {
96
96
  }
97
97
  }
98
98
  if (icons) {
99
- if (isScriptCached(CDN.icons.url)) {
100
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.icons.url)));
99
+ const cached = getCachedScript(CDN.icons.url);
100
+ if (cached) {
101
+ scripts.push(buildInlineScriptTag(cached));
101
102
  } else {
102
103
  console.warn(
103
104
  "[frontmcp/ui] Inline mode requested but Lucide icons script not cached. Call fetchAndCacheScripts() first."
@@ -192,11 +193,12 @@ var init_platforms = __esm({
192
193
  id: "claude",
193
194
  name: "Claude (Artifacts)",
194
195
  supportsWidgets: true,
196
+ // Claude Artifacts support interactive widgets
195
197
  supportsTailwind: true,
196
198
  supportsHtmx: false,
197
199
  // Network blocked, HTMX won't work for API calls
198
- networkMode: "blocked",
199
- scriptStrategy: "inline",
200
+ networkMode: "limited",
201
+ scriptStrategy: "cdn",
200
202
  maxInlineSize: 100 * 1024,
201
203
  // 100KB limit for artifacts
202
204
  cspRestrictions: ["script-src 'unsafe-inline'", "connect-src 'none'"],
@@ -462,17 +464,30 @@ function emitColorScale(lines, name, scale) {
462
464
  if (value) lines.push(`--color-${name}-${shade}: ${value};`);
463
465
  }
464
466
  }
467
+ function emitColorWithOpacityVariants(lines, name, value) {
468
+ lines.push(`--color-${name}: ${value};`);
469
+ for (const opacity of OPACITY_VARIANTS) {
470
+ lines.push(`--color-${name}-${opacity}: color-mix(in oklch, ${value} ${opacity}%, transparent);`);
471
+ }
472
+ }
473
+ function emitBrandColorWithVariants(lines, name, value) {
474
+ lines.push(`--color-${name}: ${value};`);
475
+ lines.push(`--color-${name}-hover: color-mix(in oklch, ${value} 85%, black);`);
476
+ for (const opacity of OPACITY_VARIANTS) {
477
+ lines.push(`--color-${name}-${opacity}: color-mix(in oklch, ${value} ${opacity}%, transparent);`);
478
+ }
479
+ }
465
480
  function buildThemeCss(theme) {
466
481
  const lines = [];
467
482
  const semantic = theme.colors.semantic;
468
483
  if (typeof semantic.primary === "string") {
469
- lines.push(`--color-primary: ${semantic.primary};`);
484
+ emitBrandColorWithVariants(lines, "primary", semantic.primary);
470
485
  } else if (semantic.primary) {
471
486
  emitColorScale(lines, "primary", semantic.primary);
472
487
  }
473
488
  if (semantic.secondary) {
474
489
  if (typeof semantic.secondary === "string") {
475
- lines.push(`--color-secondary: ${semantic.secondary};`);
490
+ emitBrandColorWithVariants(lines, "secondary", semantic.secondary);
476
491
  } else {
477
492
  emitColorScale(lines, "secondary", semantic.secondary);
478
493
  }
@@ -491,10 +506,10 @@ function buildThemeCss(theme) {
491
506
  emitColorScale(lines, "neutral", semantic.neutral);
492
507
  }
493
508
  }
494
- if (semantic.success) lines.push(`--color-success: ${semantic.success};`);
495
- if (semantic.warning) lines.push(`--color-warning: ${semantic.warning};`);
496
- if (semantic.danger) lines.push(`--color-danger: ${semantic.danger};`);
497
- if (semantic.info) lines.push(`--color-info: ${semantic.info};`);
509
+ if (semantic.success) emitColorWithOpacityVariants(lines, "success", semantic.success);
510
+ if (semantic.warning) emitColorWithOpacityVariants(lines, "warning", semantic.warning);
511
+ if (semantic.danger) emitColorWithOpacityVariants(lines, "danger", semantic.danger);
512
+ if (semantic.info) emitColorWithOpacityVariants(lines, "info", semantic.info);
498
513
  const surface = theme.colors.surface;
499
514
  if (surface?.background) lines.push(`--color-background: ${surface.background};`);
500
515
  if (surface?.surface) lines.push(`--color-surface: ${surface.surface};`);
@@ -536,10 +551,11 @@ function buildThemeCss(theme) {
536
551
  }
537
552
  return lines.join("\n ");
538
553
  }
554
+ var OPACITY_VARIANTS;
539
555
  var init_theme = __esm({
540
556
  "libs/uipack/src/theme/theme.ts"() {
541
557
  "use strict";
542
- init_presets();
558
+ OPACITY_VARIANTS = [10, 20, 30, 50, 70, 90];
543
559
  }
544
560
  });
545
561
 
@@ -554,13 +570,6 @@ var init_theme2 = __esm({
554
570
  }
555
571
  });
556
572
 
557
- // libs/uipack/src/utils/safe-stringify.ts
558
- var init_safe_stringify = __esm({
559
- "libs/uipack/src/utils/safe-stringify.ts"() {
560
- "use strict";
561
- }
562
- });
563
-
564
573
  // libs/uipack/src/utils/escape-html.ts
565
574
  function escapeHtml(str) {
566
575
  if (str === null || str === void 0) {
@@ -569,6 +578,12 @@ function escapeHtml(str) {
569
578
  const s = String(str);
570
579
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
571
580
  }
581
+ function escapeJsString(str) {
582
+ return str.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
583
+ }
584
+ function escapeScriptClose(jsonString) {
585
+ return jsonString.replace(/<\//g, "<\\/");
586
+ }
572
587
  var init_escape_html = __esm({
573
588
  "libs/uipack/src/utils/escape-html.ts"() {
574
589
  "use strict";
@@ -579,7 +594,6 @@ var init_escape_html = __esm({
579
594
  var init_utils = __esm({
580
595
  "libs/uipack/src/utils/index.ts"() {
581
596
  "use strict";
582
- init_safe_stringify();
583
597
  init_escape_html();
584
598
  }
585
599
  });
@@ -1163,7 +1177,6 @@ var init_helpers = __esm({
1163
1177
  // libs/uipack/src/handlebars/expression-extractor.ts
1164
1178
  function extractExpressions(template) {
1165
1179
  const expressions = [];
1166
- const lines = template.split("\n");
1167
1180
  const positionMap = buildPositionMap(template);
1168
1181
  let match;
1169
1182
  EXPRESSION_REGEX.lastIndex = 0;
@@ -1861,74 +1874,32 @@ var init_registry = __esm({
1861
1874
  }
1862
1875
  });
1863
1876
 
1864
- // libs/uipack/src/renderers/mdx.renderer.ts
1865
- function buildMdxHydrationScript() {
1866
- return `
1867
- <script>
1868
- (function() {
1869
- // MDX hydration requires React and component definitions
1870
- if (typeof React === 'undefined' || typeof ReactDOM === 'undefined') {
1871
- console.warn('[FrontMCP] React not available for MDX hydration');
1872
- return;
1873
- }
1874
-
1875
- // Find all elements marked for MDX hydration
1876
- document.querySelectorAll('[data-mdx-hydrate]').forEach(function(root) {
1877
- var propsJson = root.getAttribute('data-props');
1878
- var props = propsJson ? JSON.parse(propsJson) : {};
1879
-
1880
- // MDX content is pre-rendered, hydration mainly attaches event handlers
1881
- // For full interactivity, components need to be available client-side
1882
- if (window.__frontmcp_mdx_content) {
1883
- try {
1884
- ReactDOM.hydrateRoot(root, React.createElement(
1885
- window.__frontmcp_mdx_content,
1886
- props
1887
- ));
1888
- } catch (e) {
1889
- console.error('[FrontMCP] MDX hydration failed', e);
1890
- }
1891
- }
1892
- });
1893
- })();
1894
- </script>
1895
- `;
1877
+ // libs/uipack/src/renderers/mdx-client.renderer.ts
1878
+ function buildReactCdnUrls(version = "19") {
1879
+ return {
1880
+ react: `https://esm.sh/react@${version}`,
1881
+ reactDom: `https://esm.sh/react-dom@${version}/client`,
1882
+ jsxRuntime: `https://esm.sh/react@${version}/jsx-runtime`
1883
+ };
1896
1884
  }
1897
- var REACT_CDN, INLINE_MDX_PLACEHOLDER, MdxRenderer, mdxRenderer;
1898
- var init_mdx_renderer = __esm({
1899
- "libs/uipack/src/renderers/mdx.renderer.ts"() {
1885
+ var DEFAULT_CDN, MdxClientRenderer, mdxClientRenderer;
1886
+ var init_mdx_client_renderer = __esm({
1887
+ "libs/uipack/src/renderers/mdx-client.renderer.ts"() {
1900
1888
  "use strict";
1901
1889
  init_detect();
1902
1890
  init_hash();
1903
1891
  init_cache();
1904
- REACT_CDN = {
1905
- react: "https://unpkg.com/react@18/umd/react.production.min.js",
1906
- reactDom: "https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
1892
+ init_utils();
1893
+ DEFAULT_CDN = {
1894
+ mdx: "https://esm.sh/@mdx-js/mdx@3",
1895
+ ...buildReactCdnUrls("19")
1907
1896
  };
1908
- INLINE_MDX_PLACEHOLDER = `
1909
- // MDX runtime not available inline yet.
1910
- // For blocked-network platforms, use pre-rendered HTML templates.
1911
- console.warn('[FrontMCP] MDX hydration not available on this platform.');
1912
- `;
1913
- MdxRenderer = class {
1914
- type = "mdx";
1915
- priority = 10;
1916
- // Between HTML (0) and React (20)
1917
- /**
1918
- * Lazy-loaded modules.
1919
- */
1920
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1921
- React = null;
1922
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1923
- ReactDOMServer = null;
1924
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1925
- jsxRuntime = null;
1926
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1927
- mdxEvaluate = null;
1897
+ MdxClientRenderer = class {
1898
+ type = "mdx-client";
1899
+ priority = 8;
1900
+ // Lower than server-side MDX (10)
1928
1901
  /**
1929
1902
  * Check if this renderer can handle the given template.
1930
- *
1931
- * Accepts strings containing MDX syntax (Markdown + JSX).
1932
1903
  */
1933
1904
  canHandle(template) {
1934
1905
  if (typeof template !== "string") {
@@ -1937,11 +1908,9 @@ console.warn('[FrontMCP] MDX hydration not available on this platform.');
1937
1908
  return containsMdxSyntax(template);
1938
1909
  }
1939
1910
  /**
1940
- * Transpile MDX to executable JavaScript.
1941
- *
1942
- * Uses @mdx-js/mdx to compile MDX source to a module.
1943
- * Note: For MDX, we use evaluate() which combines compile + run,
1944
- * so this method just returns the source hash for caching purposes.
1911
+ * Prepare MDX template for rendering.
1912
+ * Caches the template hash for deduplication. Actual MDX compilation
1913
+ * happens client-side via CDN-loaded @mdx-js/mdx in the browser.
1945
1914
  */
1946
1915
  async transpile(template, _options) {
1947
1916
  const hash = hashString(template);
@@ -1951,7 +1920,6 @@ console.warn('[FrontMCP] MDX hydration not available on this platform.');
1951
1920
  }
1952
1921
  const transpileResult = {
1953
1922
  code: template,
1954
- // Store original MDX for evaluate()
1955
1923
  hash,
1956
1924
  cached: false
1957
1925
  };
@@ -1959,37 +1927,20 @@ console.warn('[FrontMCP] MDX hydration not available on this platform.');
1959
1927
  return transpileResult;
1960
1928
  }
1961
1929
  /**
1962
- * Render MDX template to HTML string.
1930
+ * Render MDX template to HTML with CDN scripts.
1963
1931
  *
1964
- * Uses @mdx-js/mdx's evaluate() for clean compilation + execution,
1965
- * then renders the resulting React component to HTML via SSR.
1932
+ * The returned HTML includes:
1933
+ * - A container div for the rendered content
1934
+ * - Script tags that load React and MDX from CDN
1935
+ * - Inline script that compiles and renders the MDX
1966
1936
  */
1967
1937
  async render(template, context, options) {
1968
- await this.loadReact();
1969
- await this.loadMdx();
1970
- if (!this.mdxEvaluate) {
1971
- throw new Error("MDX compilation requires @mdx-js/mdx. Install it: npm install @mdx-js/mdx");
1972
- }
1973
- const templateHash = hashString(template);
1974
- const cacheKey = `mdx-component:${templateHash}`;
1975
- let Content = componentCache.get(cacheKey);
1976
- if (!Content) {
1977
- const result = await this.mdxEvaluate(template, {
1978
- ...this.jsxRuntime,
1979
- Fragment: this.React.Fragment,
1980
- development: false
1981
- });
1982
- Content = result.default;
1983
- componentCache.set(cacheKey, Content);
1984
- }
1985
- const mdxComponents = {
1986
- // User-provided components from tool config
1987
- ...options?.mdxComponents,
1988
- // Wrapper that provides context to the content
1989
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1990
- wrapper: ({ children }) => {
1991
- return this.React.createElement("div", { className: "mdx-content" }, children);
1992
- }
1938
+ const containerId = options?.containerId || "mdx-content";
1939
+ const showLoading = options?.showLoading !== false;
1940
+ const loadingMessage = options?.loadingMessage || "Loading...";
1941
+ const cdn = {
1942
+ ...DEFAULT_CDN,
1943
+ ...options?.cdn
1993
1944
  };
1994
1945
  const props = {
1995
1946
  input: context.input,
@@ -1997,82 +1948,80 @@ console.warn('[FrontMCP] MDX hydration not available on this platform.');
1997
1948
  structuredContent: context.structuredContent,
1998
1949
  helpers: context.helpers
1999
1950
  };
1951
+ const reservedProps = /* @__PURE__ */ new Set(["input", "output", "structuredContent", "helpers", "components"]);
1952
+ const outputProps = typeof context.output === "object" && context.output !== null ? Object.fromEntries(Object.entries(context.output).filter(([key]) => !reservedProps.has(key))) : {};
2000
1953
  const spreadProps = {
2001
- ...props,
2002
- ...typeof context.output === "object" && context.output !== null ? context.output : {}
1954
+ ...outputProps,
1955
+ ...props
2003
1956
  };
2004
- const element = this.React.createElement(Content, {
2005
- components: mdxComponents,
2006
- ...spreadProps
2007
- });
2008
- const html = this.ReactDOMServer.renderToString(element);
2009
- if (options?.hydrate) {
2010
- const escapedProps = JSON.stringify(props).replace(/&/g, "&amp;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2011
- return `<div data-mdx-hydrate="true" data-props='${escapedProps}'>${html}</div>`;
2012
- }
2013
- return html;
1957
+ const escapedMdx = escapeScriptClose(JSON.stringify(template));
1958
+ const escapedProps = escapeScriptClose(JSON.stringify(spreadProps));
1959
+ const safeContainerId = escapeJsString(containerId);
1960
+ const loadingHtml = showLoading ? `<div class="mdx-loading">${escapeHtml(loadingMessage)}</div>` : "";
1961
+ return `
1962
+ <div id="${escapeHtml(containerId)}">${loadingHtml}</div>
1963
+ <script type="module">
1964
+ (async function() {
1965
+ try {
1966
+ // Load dependencies from CDN
1967
+ const [
1968
+ { evaluate },
1969
+ runtime,
1970
+ React,
1971
+ { createRoot }
1972
+ ] = await Promise.all([
1973
+ import('${cdn.mdx}'),
1974
+ import('${cdn.jsxRuntime}'),
1975
+ import('${cdn.react}'),
1976
+ import('${cdn.reactDom}')
1977
+ ]);
1978
+
1979
+ // MDX content and props
1980
+ const mdxSource = ${escapedMdx};
1981
+ const props = ${escapedProps};
1982
+
1983
+ // Compile and evaluate MDX
1984
+ const { default: Content } = await evaluate(mdxSource, {
1985
+ ...runtime,
1986
+ Fragment: React.Fragment,
1987
+ development: false
1988
+ });
1989
+
1990
+ // Render to DOM
1991
+ const container = document.getElementById('${safeContainerId}');
1992
+ if (container) {
1993
+ const root = createRoot(container);
1994
+ root.render(React.createElement(Content, props));
1995
+ }
1996
+ } catch (error) {
1997
+ console.error('[FrontMCP] MDX client rendering failed:', error);
1998
+ const container = document.getElementById('${safeContainerId}');
1999
+ if (container) {
2000
+ container.innerHTML = '<div class="mdx-error">Failed to render MDX content</div>';
2001
+ }
2002
+ }
2003
+ })();
2004
+ </script>
2005
+ `;
2014
2006
  }
2015
2007
  /**
2016
- * Get runtime scripts for client-side functionality.
2008
+ * Get runtime scripts - not needed for client renderer since scripts are inline.
2017
2009
  */
2018
2010
  getRuntimeScripts(platform) {
2019
2011
  if (platform.networkMode === "blocked") {
2020
2012
  return {
2021
2013
  headScripts: "",
2022
- inlineScripts: INLINE_MDX_PLACEHOLDER,
2014
+ inlineScripts: `console.warn('[FrontMCP] Client-side MDX rendering requires network access. Use @frontmcp/ui for SSR.');`,
2023
2015
  isInline: true
2024
2016
  };
2025
2017
  }
2026
2018
  return {
2027
- headScripts: `
2028
- <script crossorigin src="${REACT_CDN.react}"></script>
2029
- <script crossorigin src="${REACT_CDN.reactDom}"></script>
2030
- `,
2019
+ headScripts: "",
2031
2020
  isInline: false
2032
2021
  };
2033
2022
  }
2034
- /**
2035
- * Load React and ReactDOMServer modules.
2036
- */
2037
- async loadReact() {
2038
- if (this.React && this.ReactDOMServer && this.jsxRuntime) {
2039
- return;
2040
- }
2041
- try {
2042
- const [react, reactDomServer, jsxRuntime] = await Promise.all([
2043
- import("react"),
2044
- import("react-dom/server"),
2045
- import("react/jsx-runtime")
2046
- ]);
2047
- this.React = react;
2048
- this.ReactDOMServer = reactDomServer;
2049
- this.jsxRuntime = jsxRuntime;
2050
- } catch {
2051
- throw new Error("React is required for MdxRenderer. Install react and react-dom: npm install react react-dom");
2052
- }
2053
- }
2054
- /**
2055
- * Load @mdx-js/mdx evaluate function.
2056
- *
2057
- * evaluate() is the cleanest way to run MDX - it combines
2058
- * compile and run in a single step, handling all the runtime
2059
- * injection automatically.
2060
- */
2061
- async loadMdx() {
2062
- if (this.mdxEvaluate) {
2063
- return;
2064
- }
2065
- try {
2066
- const mdx = await import("@mdx-js/mdx");
2067
- this.mdxEvaluate = mdx.evaluate;
2068
- } catch {
2069
- console.warn(
2070
- "[@frontmcp/ui] @mdx-js/mdx not available. MDX rendering disabled. Install @mdx-js/mdx to enable: npm install @mdx-js/mdx"
2071
- );
2072
- }
2073
- }
2074
2023
  };
2075
- mdxRenderer = new MdxRenderer();
2024
+ mdxClientRenderer = new MdxClientRenderer();
2076
2025
  }
2077
2026
  });
2078
2027
 
@@ -2137,43 +2086,15 @@ async function isSwcAvailable() {
2137
2086
  const transform = await loadSwcTransform();
2138
2087
  return transform !== null;
2139
2088
  }
2140
- async function executeTranspiledCode(code, context = {}) {
2141
- let React;
2142
- let jsxRuntime;
2143
- try {
2144
- React = await import("react");
2145
- jsxRuntime = await import("react/jsx-runtime");
2146
- } catch {
2147
- throw new Error("React is required for JSX templates. Install react: npm install react react-dom");
2148
- }
2149
- const exports2 = {};
2150
- const module2 = { exports: exports2 };
2151
- const require2 = (id) => {
2152
- switch (id) {
2153
- case "react":
2154
- return React;
2155
- case "react/jsx-runtime":
2156
- return jsxRuntime;
2157
- case "react/jsx-dev-runtime":
2158
- return jsxRuntime;
2159
- default:
2160
- if (context[id]) {
2161
- return context[id];
2162
- }
2163
- throw new Error(`Module '${id}' not available in JSX template context`);
2164
- }
2165
- };
2166
- try {
2167
- const fn = new Function("exports", "require", "module", "__filename", "__dirname", "React", "context", code);
2168
- fn(exports2, require2, module2, "template.js", "/", React, context);
2169
- return module2.exports["default"] || module2.exports[Object.keys(module2.exports)[0]] || module2.exports;
2170
- } catch (error) {
2171
- throw new Error(`Failed to execute transpiled JSX: ${error instanceof Error ? error.message : String(error)}`);
2172
- }
2089
+ async function executeTranspiledCode(_code, _context = {}) {
2090
+ throw new Error(
2091
+ 'executeTranspiledCode has been moved to @frontmcp/ui/renderers. Install @frontmcp/ui and import from there: import { executeTranspiledCode } from "@frontmcp/ui/renderers"'
2092
+ );
2173
2093
  }
2174
- async function transpileAndExecute(source, context = {}) {
2175
- const result = await transpileJsx(source);
2176
- return executeTranspiledCode(result.code, context);
2094
+ async function transpileAndExecute(_source, _context = {}) {
2095
+ throw new Error(
2096
+ 'transpileAndExecute has been moved to @frontmcp/ui/renderers. Install @frontmcp/ui and import from there: import { transpileAndExecute } from "@frontmcp/ui/renderers"'
2097
+ );
2177
2098
  }
2178
2099
  var DEFAULT_SWC_OPTIONS, swcTransform;
2179
2100
  var init_transpiler = __esm({
@@ -2205,10 +2126,11 @@ var init_utils2 = __esm({
2205
2126
  var renderers_exports = {};
2206
2127
  __export(renderers_exports, {
2207
2128
  HtmlRenderer: () => HtmlRenderer,
2208
- MdxRenderer: () => MdxRenderer,
2129
+ MdxClientRenderer: () => MdxClientRenderer,
2209
2130
  RendererRegistry: () => RendererRegistry,
2210
2131
  TranspileCache: () => TranspileCache,
2211
- buildMdxHydrationScript: () => buildMdxHydrationScript,
2132
+ buildReactCdnUrls: () => buildReactCdnUrls,
2133
+ componentCache: () => componentCache,
2212
2134
  containsJsx: () => containsJsx,
2213
2135
  containsMdxSyntax: () => containsMdxSyntax,
2214
2136
  detectTemplateType: () => detectTemplateType,
@@ -2221,8 +2143,7 @@ __export(renderers_exports, {
2221
2143
  isReactComponent: () => isReactComponent,
2222
2144
  isSwcAvailable: () => isSwcAvailable,
2223
2145
  isTemplateBuilderFunction: () => isTemplateBuilderFunction,
2224
- mdxRenderer: () => mdxRenderer,
2225
- renderCache: () => renderCache,
2146
+ mdxClientRenderer: () => mdxClientRenderer,
2226
2147
  rendererRegistry: () => rendererRegistry,
2227
2148
  transpileAndExecute: () => transpileAndExecute,
2228
2149
  transpileCache: () => transpileCache,
@@ -2234,7 +2155,7 @@ var init_renderers = __esm({
2234
2155
  init_cache();
2235
2156
  init_registry();
2236
2157
  init_html_renderer();
2237
- init_mdx_renderer();
2158
+ init_mdx_client_renderer();
2238
2159
  init_utils2();
2239
2160
  }
2240
2161
  });
@@ -3121,9 +3042,6 @@ var BRIDGE_SCRIPT_TAGS = {
3121
3042
  gemini: `<script>${generatePlatformBundle("gemini")}</script>`
3122
3043
  };
3123
3044
 
3124
- // libs/uipack/src/runtime/mcp-bridge.ts
3125
- var FRONTMCP_BRIDGE_RUNTIME = BRIDGE_SCRIPT_TAGS.universal;
3126
-
3127
3045
  // libs/uipack/src/runtime/csp.ts
3128
3046
  var DEFAULT_CDN_DOMAINS = [
3129
3047
  "https://cdn.jsdelivr.net",
@@ -4569,12 +4487,12 @@ function containsMdxSyntax2(source) {
4569
4487
  }
4570
4488
  async function renderMdxContent(mdxContent, context, mdxComponents) {
4571
4489
  try {
4572
- const { mdxRenderer: mdxRenderer2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
4573
- const html = await mdxRenderer2.render(mdxContent, context, { mdxComponents });
4490
+ const { mdxClientRenderer: mdxClientRenderer2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
4491
+ const html = await mdxClientRenderer2.render(mdxContent, context, { mdxComponents });
4574
4492
  return html;
4575
4493
  } catch (error) {
4576
4494
  console.error(
4577
- "[@frontmcp/ui] MDX rendering failed:",
4495
+ "[@frontmcp/uipack] MDX rendering failed:",
4578
4496
  error instanceof Error ? error.stack || error.message : String(error)
4579
4497
  );
4580
4498
  const escaped = mdxContent.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -4628,13 +4546,17 @@ async function renderToolTemplateAsync(options) {
4628
4546
  if (isReactComponent2(template)) {
4629
4547
  const componentName = template.displayName || template.name || "UnknownComponent";
4630
4548
  try {
4549
+ const reactPkg = "react";
4550
+ const reactDomServerPkg = "react-dom/server";
4631
4551
  const [React, ReactDOMServer] = await Promise.all([
4632
- import("react").catch(() => {
4633
- throw new Error("React is required for React component templates. Install react as a dependency.");
4552
+ import(reactPkg).catch(() => {
4553
+ throw new Error(
4554
+ "React is required for React component templates. Either install react as a dependency, or use @frontmcp/ui for React component support."
4555
+ );
4634
4556
  }),
4635
- import("react-dom/server").catch(() => {
4557
+ import(reactDomServerPkg).catch(() => {
4636
4558
  throw new Error(
4637
- "react-dom/server is required for React component templates. Install react-dom as a dependency."
4559
+ "react-dom/server is required for React component templates. Either install react-dom as a dependency, or use @frontmcp/ui for React component support."
4638
4560
  );
4639
4561
  })
4640
4562
  ]);
@@ -4738,20 +4660,19 @@ function buildOpenAIMeta(meta, uiConfig) {
4738
4660
  }
4739
4661
  return meta;
4740
4662
  }
4741
- function buildOpenAICSP(csp) {
4742
- const result = {};
4743
- if (csp.connectDomains?.length) {
4744
- result.connect_domains = csp.connectDomains;
4745
- }
4746
- if (csp.resourceDomains?.length) {
4747
- result.resource_domains = csp.resourceDomains;
4748
- }
4749
- return result;
4750
- }
4751
4663
  function buildClaudeMeta(meta, uiConfig) {
4752
4664
  if (uiConfig.widgetDescription) {
4753
4665
  meta["claude/widgetDescription"] = uiConfig.widgetDescription;
4754
4666
  }
4667
+ if (uiConfig.displayMode) {
4668
+ meta["claude/displayMode"] = uiConfig.displayMode;
4669
+ }
4670
+ if (uiConfig.widgetAccessible) {
4671
+ meta["claude/widgetAccessible"] = true;
4672
+ }
4673
+ if (uiConfig.prefersBorder !== void 0) {
4674
+ meta["claude/prefersBorder"] = uiConfig.prefersBorder;
4675
+ }
4755
4676
  return meta;
4756
4677
  }
4757
4678
  function buildGeminiMeta(meta, uiConfig) {
@@ -4766,12 +4687,34 @@ function buildIDEMeta(meta, uiConfig) {
4766
4687
  }
4767
4688
  return meta;
4768
4689
  }
4690
+ function buildFrontMCPCSP(csp) {
4691
+ const result = {};
4692
+ if (csp.connectDomains?.length) {
4693
+ result.connectDomains = csp.connectDomains;
4694
+ }
4695
+ if (csp.resourceDomains?.length) {
4696
+ result.resourceDomains = csp.resourceDomains;
4697
+ }
4698
+ return result;
4699
+ }
4769
4700
  function buildGenericMeta(meta, uiConfig) {
4770
4701
  if (uiConfig.widgetAccessible) {
4771
- meta["openai/widgetAccessible"] = true;
4702
+ meta["frontmcp/widgetAccessible"] = true;
4772
4703
  }
4773
4704
  if (uiConfig.csp) {
4774
- meta["openai/widgetCSP"] = buildOpenAICSP(uiConfig.csp);
4705
+ meta["frontmcp/widgetCSP"] = buildFrontMCPCSP(uiConfig.csp);
4706
+ }
4707
+ if (uiConfig.displayMode) {
4708
+ meta["frontmcp/displayMode"] = uiConfig.displayMode;
4709
+ }
4710
+ if (uiConfig.widgetDescription) {
4711
+ meta["frontmcp/widgetDescription"] = uiConfig.widgetDescription;
4712
+ }
4713
+ if (uiConfig.prefersBorder !== void 0) {
4714
+ meta["frontmcp/prefersBorder"] = uiConfig.prefersBorder;
4715
+ }
4716
+ if (uiConfig.sandboxDomain) {
4717
+ meta["frontmcp/domain"] = uiConfig.sandboxDomain;
4775
4718
  }
4776
4719
  return meta;
4777
4720
  }
@@ -4812,14 +4755,6 @@ function buildExtAppsMeta(meta, uiConfig) {
4812
4755
  return meta;
4813
4756
  }
4814
4757
 
4815
- // libs/uipack/src/adapters/response-builder.ts
4816
- init_utils();
4817
-
4818
- // libs/uipack/src/build/index.ts
4819
- init_registry();
4820
- init_renderers();
4821
- init_theme2();
4822
-
4823
4758
  // libs/uipack/src/types/ui-runtime.ts
4824
4759
  function isUIType(value) {
4825
4760
  return typeof value === "string" && ["html", "react", "mdx", "markdown", "auto"].includes(value);
@@ -4856,7 +4791,7 @@ var DEFAULT_CSP_BY_TYPE = {
4856
4791
  };
4857
4792
 
4858
4793
  // libs/uipack/src/build/cdn-resources.ts
4859
- var REACT_CDN2 = {
4794
+ var REACT_CDN = {
4860
4795
  url: "https://esm.sh/react@19",
4861
4796
  crossorigin: "anonymous"
4862
4797
  };
@@ -4889,13 +4824,13 @@ function getDefaultAssets(uiType, mode = "cdn") {
4889
4824
  case "react":
4890
4825
  return {
4891
4826
  ...baseAssets,
4892
- react: REACT_CDN2,
4827
+ react: REACT_CDN,
4893
4828
  reactDom: REACT_DOM_CDN
4894
4829
  };
4895
4830
  case "mdx":
4896
4831
  return {
4897
4832
  ...baseAssets,
4898
- react: REACT_CDN2,
4833
+ react: REACT_CDN,
4899
4834
  reactDom: REACT_DOM_CDN,
4900
4835
  mdxRuntime: MDX_RUNTIME_CDN,
4901
4836
  markdown: MARKED_CDN
@@ -4913,7 +4848,7 @@ function getDefaultAssets(uiType, mode = "cdn") {
4913
4848
  case "auto":
4914
4849
  return {
4915
4850
  ...baseAssets,
4916
- react: REACT_CDN2,
4851
+ react: REACT_CDN,
4917
4852
  reactDom: REACT_DOM_CDN,
4918
4853
  markdown: MARKED_CDN,
4919
4854
  handlebars: HANDLEBARS_CDN
@@ -4963,9 +4898,6 @@ function detectFormatFromPath(pathOrUrl) {
4963
4898
  return "html";
4964
4899
  }
4965
4900
 
4966
- // libs/uipack/src/validation/error-box.ts
4967
- init_utils();
4968
-
4969
4901
  // libs/uipack/src/validation/schema-paths.ts
4970
4902
  var import_zod = require("zod");
4971
4903
  function extractSchemaPaths(schema, prefix = "output", options = {}) {
@@ -5397,7 +5329,7 @@ var URL_CACHE_TTL_MS = 5 * 60 * 1e3;
5397
5329
 
5398
5330
  // libs/uipack/src/dependency/template-processor.ts
5399
5331
  init_handlebars();
5400
- init_mdx_renderer();
5332
+ init_mdx_client_renderer();
5401
5333
  init_utils();
5402
5334
  function safeInputToRecord(input) {
5403
5335
  if (input && typeof input === "object" && !Array.isArray(input)) {
@@ -5510,7 +5442,7 @@ async function processTemplate(resolved, options) {
5510
5442
  structuredContent: context.structuredContent,
5511
5443
  helpers: defaultHelpers
5512
5444
  };
5513
- const html = await mdxRenderer.render(processedContent, templateContext);
5445
+ const html = await mdxClientRenderer.render(processedContent, templateContext);
5514
5446
  return {
5515
5447
  html,
5516
5448
  format: "mdx"
@@ -5605,7 +5537,7 @@ async function generateHash(content) {
5605
5537
  return Math.abs(hash).toString(16).padStart(8, "0");
5606
5538
  }
5607
5539
  async function buildToolWidgetManifest(options) {
5608
- const { toolName, uiConfig, schema, theme, sampleInput, sampleOutput, outputSchema, inputSchema } = options;
5540
+ const { toolName, uiConfig, schema, theme: _theme, sampleInput, sampleOutput, outputSchema, inputSchema } = options;
5609
5541
  const uiType = isUIType(uiConfig.uiType) ? uiConfig.uiType : detectUIType(uiConfig.template);
5610
5542
  const displayMode = uiConfig.displayMode ?? "inline";
5611
5543
  const bundlingMode = uiConfig.bundlingMode ?? "static";
@@ -5743,7 +5675,7 @@ function ensureRenderersRegistered() {
5743
5675
  return;
5744
5676
  }
5745
5677
  if (!rendererRegistry.has("mdx")) {
5746
- rendererRegistry.register(mdxRenderer);
5678
+ rendererRegistry.register(mdxClientRenderer);
5747
5679
  }
5748
5680
  renderersInitialized = true;
5749
5681
  }