@frontmcp/ui 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 (292) hide show
  1. package/bridge/core/bridge-factory.d.ts +1 -0
  2. package/bridge/core/bridge-factory.d.ts.map +1 -1
  3. package/bridge/index.d.ts +1 -1
  4. package/bridge/index.d.ts.map +1 -1
  5. package/bridge/index.js +39 -881
  6. package/bundler/browser-components.d.ts +42 -0
  7. package/bundler/browser-components.d.ts.map +1 -0
  8. package/bundler/bundler.d.ts +78 -4
  9. package/bundler/bundler.d.ts.map +1 -1
  10. package/bundler/index.d.ts +8 -8
  11. package/bundler/index.d.ts.map +1 -1
  12. package/bundler/index.js +1315 -1854
  13. package/bundler/types.d.ts +188 -7
  14. package/bundler/types.d.ts.map +1 -1
  15. package/esm/bridge/{index.js → index.mjs} +40 -877
  16. package/esm/bundler/{index.js → index.mjs} +1391 -1895
  17. package/esm/{index.js → index.mjs} +215 -3091
  18. package/esm/layouts/{index.js → index.mjs} +3 -3
  19. package/esm/package.json +9 -8
  20. package/esm/react/index.mjs +1183 -0
  21. package/esm/renderers/index.mjs +611 -0
  22. package/esm/universal/{index.js → index.mjs} +266 -70
  23. package/index.d.ts +1 -4
  24. package/index.d.ts.map +1 -1
  25. package/index.js +208 -3113
  26. package/layouts/base.d.ts.map +1 -1
  27. package/layouts/index.js +3 -3
  28. package/layouts/presets.d.ts.map +1 -1
  29. package/package.json +9 -8
  30. package/react/Badge.d.ts.map +1 -1
  31. package/react/hooks/context.d.ts.map +1 -1
  32. package/react/index.d.ts +0 -1
  33. package/react/index.d.ts.map +1 -1
  34. package/react/index.js +57 -2001
  35. package/react/types.d.ts.map +1 -1
  36. package/renderers/index.d.ts +9 -4
  37. package/renderers/index.d.ts.map +1 -1
  38. package/renderers/index.js +328 -88
  39. package/renderers/mdx.renderer.d.ts +99 -0
  40. package/renderers/mdx.renderer.d.ts.map +1 -0
  41. package/renderers/react.renderer.d.ts +22 -13
  42. package/renderers/react.renderer.d.ts.map +1 -1
  43. package/renderers/transpiler.d.ts +49 -0
  44. package/renderers/transpiler.d.ts.map +1 -0
  45. package/universal/cached-runtime.d.ts +25 -1
  46. package/universal/cached-runtime.d.ts.map +1 -1
  47. package/universal/index.js +266 -70
  48. package/universal/runtime-builder.d.ts.map +1 -1
  49. package/universal/types.d.ts.map +1 -1
  50. package/web-components/elements/fmcp-input.d.ts.map +1 -1
  51. package/web-components/elements/fmcp-select.d.ts.map +1 -1
  52. package/web-components/index.d.ts +0 -1
  53. package/web-components/index.d.ts.map +1 -1
  54. package/bundler/cache.d.ts +0 -173
  55. package/bundler/cache.d.ts.map +0 -1
  56. package/bundler/file-cache/component-builder.d.ts +0 -167
  57. package/bundler/file-cache/component-builder.d.ts.map +0 -1
  58. package/bundler/file-cache/hash-calculator.d.ts +0 -155
  59. package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  60. package/bundler/file-cache/index.d.ts +0 -12
  61. package/bundler/file-cache/index.d.ts.map +0 -1
  62. package/bundler/file-cache/storage/filesystem.d.ts +0 -149
  63. package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  64. package/bundler/file-cache/storage/index.d.ts +0 -11
  65. package/bundler/file-cache/storage/index.d.ts.map +0 -1
  66. package/bundler/file-cache/storage/interface.d.ts +0 -152
  67. package/bundler/file-cache/storage/interface.d.ts.map +0 -1
  68. package/bundler/file-cache/storage/redis.d.ts +0 -139
  69. package/bundler/file-cache/storage/redis.d.ts.map +0 -1
  70. package/bundler/sandbox/enclave-adapter.d.ts +0 -121
  71. package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  72. package/bundler/sandbox/executor.d.ts +0 -14
  73. package/bundler/sandbox/executor.d.ts.map +0 -1
  74. package/bundler/sandbox/policy.d.ts +0 -62
  75. package/bundler/sandbox/policy.d.ts.map +0 -1
  76. package/esm/bridge/adapters/base-adapter.d.ts +0 -104
  77. package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
  78. package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
  79. package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
  80. package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
  81. package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
  82. package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
  83. package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
  84. package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
  85. package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
  86. package/esm/bridge/adapters/index.d.ts +0 -26
  87. package/esm/bridge/adapters/index.d.ts.map +0 -1
  88. package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
  89. package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
  90. package/esm/bridge/core/adapter-registry.d.ts +0 -122
  91. package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
  92. package/esm/bridge/core/bridge-factory.d.ts +0 -199
  93. package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
  94. package/esm/bridge/core/index.d.ts +0 -10
  95. package/esm/bridge/core/index.d.ts.map +0 -1
  96. package/esm/bridge/index.d.ts +0 -62
  97. package/esm/bridge/index.d.ts.map +0 -1
  98. package/esm/bridge/runtime/iife-generator.d.ts +0 -62
  99. package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
  100. package/esm/bridge/runtime/index.d.ts +0 -10
  101. package/esm/bridge/runtime/index.d.ts.map +0 -1
  102. package/esm/bridge/types.d.ts +0 -386
  103. package/esm/bridge/types.d.ts.map +0 -1
  104. package/esm/bundler/bundler.d.ts +0 -208
  105. package/esm/bundler/bundler.d.ts.map +0 -1
  106. package/esm/bundler/cache.d.ts +0 -173
  107. package/esm/bundler/cache.d.ts.map +0 -1
  108. package/esm/bundler/file-cache/component-builder.d.ts +0 -167
  109. package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
  110. package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
  111. package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  112. package/esm/bundler/file-cache/index.d.ts +0 -12
  113. package/esm/bundler/file-cache/index.d.ts.map +0 -1
  114. package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
  115. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  116. package/esm/bundler/file-cache/storage/index.d.ts +0 -11
  117. package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
  118. package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
  119. package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
  120. package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
  121. package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
  122. package/esm/bundler/index.d.ts +0 -43
  123. package/esm/bundler/index.d.ts.map +0 -1
  124. package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
  125. package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  126. package/esm/bundler/sandbox/executor.d.ts +0 -14
  127. package/esm/bundler/sandbox/executor.d.ts.map +0 -1
  128. package/esm/bundler/sandbox/policy.d.ts +0 -62
  129. package/esm/bundler/sandbox/policy.d.ts.map +0 -1
  130. package/esm/bundler/types.d.ts +0 -702
  131. package/esm/bundler/types.d.ts.map +0 -1
  132. package/esm/components/alert.d.ts +0 -66
  133. package/esm/components/alert.d.ts.map +0 -1
  134. package/esm/components/alert.schema.d.ts +0 -98
  135. package/esm/components/alert.schema.d.ts.map +0 -1
  136. package/esm/components/avatar.d.ts +0 -77
  137. package/esm/components/avatar.d.ts.map +0 -1
  138. package/esm/components/avatar.schema.d.ts +0 -170
  139. package/esm/components/avatar.schema.d.ts.map +0 -1
  140. package/esm/components/badge.d.ts +0 -64
  141. package/esm/components/badge.d.ts.map +0 -1
  142. package/esm/components/badge.schema.d.ts +0 -91
  143. package/esm/components/badge.schema.d.ts.map +0 -1
  144. package/esm/components/button.d.ts +0 -100
  145. package/esm/components/button.d.ts.map +0 -1
  146. package/esm/components/button.schema.d.ts +0 -120
  147. package/esm/components/button.schema.d.ts.map +0 -1
  148. package/esm/components/card.d.ts +0 -53
  149. package/esm/components/card.d.ts.map +0 -1
  150. package/esm/components/card.schema.d.ts +0 -93
  151. package/esm/components/card.schema.d.ts.map +0 -1
  152. package/esm/components/form.d.ts +0 -212
  153. package/esm/components/form.d.ts.map +0 -1
  154. package/esm/components/form.schema.d.ts +0 -365
  155. package/esm/components/form.schema.d.ts.map +0 -1
  156. package/esm/components/index.d.ts +0 -29
  157. package/esm/components/index.d.ts.map +0 -1
  158. package/esm/components/list.d.ts +0 -121
  159. package/esm/components/list.d.ts.map +0 -1
  160. package/esm/components/list.schema.d.ts +0 -129
  161. package/esm/components/list.schema.d.ts.map +0 -1
  162. package/esm/components/modal.d.ts +0 -100
  163. package/esm/components/modal.d.ts.map +0 -1
  164. package/esm/components/modal.schema.d.ts +0 -151
  165. package/esm/components/modal.schema.d.ts.map +0 -1
  166. package/esm/components/table.d.ts +0 -91
  167. package/esm/components/table.d.ts.map +0 -1
  168. package/esm/components/table.schema.d.ts +0 -123
  169. package/esm/components/table.schema.d.ts.map +0 -1
  170. package/esm/index.d.ts +0 -40
  171. package/esm/index.d.ts.map +0 -1
  172. package/esm/layouts/base.d.ts +0 -86
  173. package/esm/layouts/base.d.ts.map +0 -1
  174. package/esm/layouts/index.d.ts +0 -8
  175. package/esm/layouts/index.d.ts.map +0 -1
  176. package/esm/layouts/presets.d.ts +0 -134
  177. package/esm/layouts/presets.d.ts.map +0 -1
  178. package/esm/pages/consent.d.ts +0 -117
  179. package/esm/pages/consent.d.ts.map +0 -1
  180. package/esm/pages/error.d.ts +0 -101
  181. package/esm/pages/error.d.ts.map +0 -1
  182. package/esm/pages/index.d.ts +0 -9
  183. package/esm/pages/index.d.ts.map +0 -1
  184. package/esm/pages/index.js +0 -1036
  185. package/esm/react/Alert.d.ts +0 -101
  186. package/esm/react/Alert.d.ts.map +0 -1
  187. package/esm/react/Badge.d.ts +0 -100
  188. package/esm/react/Badge.d.ts.map +0 -1
  189. package/esm/react/Button.d.ts +0 -108
  190. package/esm/react/Button.d.ts.map +0 -1
  191. package/esm/react/Card.d.ts +0 -103
  192. package/esm/react/Card.d.ts.map +0 -1
  193. package/esm/react/hooks/context.d.ts +0 -179
  194. package/esm/react/hooks/context.d.ts.map +0 -1
  195. package/esm/react/hooks/index.d.ts +0 -42
  196. package/esm/react/hooks/index.d.ts.map +0 -1
  197. package/esm/react/hooks/tools.d.ts +0 -284
  198. package/esm/react/hooks/tools.d.ts.map +0 -1
  199. package/esm/react/index.d.ts +0 -80
  200. package/esm/react/index.d.ts.map +0 -1
  201. package/esm/react/index.js +0 -3124
  202. package/esm/react/types.d.ts +0 -105
  203. package/esm/react/types.d.ts.map +0 -1
  204. package/esm/react/utils.d.ts +0 -43
  205. package/esm/react/utils.d.ts.map +0 -1
  206. package/esm/render/index.d.ts +0 -8
  207. package/esm/render/index.d.ts.map +0 -1
  208. package/esm/render/prerender.d.ts +0 -57
  209. package/esm/render/prerender.d.ts.map +0 -1
  210. package/esm/renderers/index.d.ts +0 -21
  211. package/esm/renderers/index.d.ts.map +0 -1
  212. package/esm/renderers/index.js +0 -381
  213. package/esm/renderers/react.adapter.d.ts +0 -70
  214. package/esm/renderers/react.adapter.d.ts.map +0 -1
  215. package/esm/renderers/react.renderer.d.ts +0 -96
  216. package/esm/renderers/react.renderer.d.ts.map +0 -1
  217. package/esm/universal/UniversalApp.d.ts +0 -108
  218. package/esm/universal/UniversalApp.d.ts.map +0 -1
  219. package/esm/universal/cached-runtime.d.ts +0 -115
  220. package/esm/universal/cached-runtime.d.ts.map +0 -1
  221. package/esm/universal/context.d.ts +0 -122
  222. package/esm/universal/context.d.ts.map +0 -1
  223. package/esm/universal/index.d.ts +0 -57
  224. package/esm/universal/index.d.ts.map +0 -1
  225. package/esm/universal/renderers/html.renderer.d.ts +0 -37
  226. package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
  227. package/esm/universal/renderers/index.d.ts +0 -112
  228. package/esm/universal/renderers/index.d.ts.map +0 -1
  229. package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
  230. package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
  231. package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
  232. package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
  233. package/esm/universal/renderers/react.renderer.d.ts +0 -46
  234. package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
  235. package/esm/universal/runtime-builder.d.ts +0 -33
  236. package/esm/universal/runtime-builder.d.ts.map +0 -1
  237. package/esm/universal/store.d.ts +0 -135
  238. package/esm/universal/store.d.ts.map +0 -1
  239. package/esm/universal/types.d.ts +0 -199
  240. package/esm/universal/types.d.ts.map +0 -1
  241. package/esm/web-components/core/attribute-parser.d.ts +0 -82
  242. package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
  243. package/esm/web-components/core/base-element.d.ts +0 -197
  244. package/esm/web-components/core/base-element.d.ts.map +0 -1
  245. package/esm/web-components/core/index.d.ts +0 -9
  246. package/esm/web-components/core/index.d.ts.map +0 -1
  247. package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
  248. package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
  249. package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
  250. package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
  251. package/esm/web-components/elements/fmcp-button.d.ts +0 -117
  252. package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
  253. package/esm/web-components/elements/fmcp-card.d.ts +0 -53
  254. package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
  255. package/esm/web-components/elements/fmcp-input.d.ts +0 -96
  256. package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
  257. package/esm/web-components/elements/fmcp-select.d.ts +0 -100
  258. package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
  259. package/esm/web-components/elements/index.d.ts +0 -13
  260. package/esm/web-components/elements/index.d.ts.map +0 -1
  261. package/esm/web-components/index.d.ts +0 -50
  262. package/esm/web-components/index.d.ts.map +0 -1
  263. package/esm/web-components/register.d.ts +0 -57
  264. package/esm/web-components/register.d.ts.map +0 -1
  265. package/esm/web-components/types.d.ts +0 -122
  266. package/esm/web-components/types.d.ts.map +0 -1
  267. package/esm/widgets/index.d.ts +0 -8
  268. package/esm/widgets/index.d.ts.map +0 -1
  269. package/esm/widgets/index.js +0 -883
  270. package/esm/widgets/progress.d.ts +0 -133
  271. package/esm/widgets/progress.d.ts.map +0 -1
  272. package/esm/widgets/resource.d.ts +0 -163
  273. package/esm/widgets/resource.d.ts.map +0 -1
  274. package/pages/consent.d.ts +0 -117
  275. package/pages/consent.d.ts.map +0 -1
  276. package/pages/error.d.ts +0 -101
  277. package/pages/error.d.ts.map +0 -1
  278. package/pages/index.d.ts +0 -9
  279. package/pages/index.d.ts.map +0 -1
  280. package/pages/index.js +0 -1065
  281. package/react/utils.d.ts +0 -43
  282. package/react/utils.d.ts.map +0 -1
  283. package/widgets/index.d.ts +0 -8
  284. package/widgets/index.d.ts.map +0 -1
  285. package/widgets/index.js +0 -910
  286. package/widgets/progress.d.ts +0 -133
  287. package/widgets/progress.d.ts.map +0 -1
  288. package/widgets/resource.d.ts +0 -163
  289. package/widgets/resource.d.ts.map +0 -1
  290. /package/esm/components/{index.js → index.mjs} +0 -0
  291. /package/esm/render/{index.js → index.mjs} +0 -0
  292. /package/esm/web-components/{index.js → index.mjs} +0 -0
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Browser Components Builder
3
+ *
4
+ * Lazily transpiles the real React components from @frontmcp/ui/react
5
+ * into browser-compatible JavaScript using esbuild at first use.
6
+ *
7
+ * This ensures 100% parity with the actual React components while
8
+ * avoiding the overhead of manual code synchronization.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ /**
13
+ * Get browser-compatible UI components.
14
+ *
15
+ * On first call, transpiles the real React components using esbuild.
16
+ * Subsequent calls return the cached result.
17
+ *
18
+ * @returns JavaScript code that defines Card, Button, Badge, Alert on window
19
+ */
20
+ export declare function getBrowserComponents(): Promise<string>;
21
+ /**
22
+ * Get browser-compatible UI components synchronously.
23
+ *
24
+ * Returns cached components if available, otherwise returns null.
25
+ * Use getBrowserComponents() for async loading with transpilation.
26
+ *
27
+ * @returns Cached JavaScript code or null if not yet built
28
+ */
29
+ export declare function getBrowserComponentsSync(): string | null;
30
+ /**
31
+ * Pre-warm the browser components cache.
32
+ *
33
+ * Call this at application startup to avoid delay on first bundler call.
34
+ */
35
+ export declare function warmBrowserComponentsCache(): Promise<void>;
36
+ /**
37
+ * Clear the browser components cache.
38
+ *
39
+ * Useful for development when components change.
40
+ */
41
+ export declare function clearBrowserComponentsCache(): void;
42
+ //# sourceMappingURL=browser-components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-components.d.ts","sourceRoot":"","sources":["../../src/bundler/browser-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwbH;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAyB5D;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,CAExD;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- import type { BundleOptions, BundleResult, SSRBundleOptions, SSRResult, BundlerOptions, StaticHTMLOptions, StaticHTMLResult } from './types';
9
+ import type { BundleOptions, BundleResult, SSRBundleOptions, SSRResult, BundlerOptions, StaticHTMLOptions, StaticHTMLResult, MultiPlatformBuildOptions, MultiPlatformBuildResult } from './types';
10
10
  /**
11
11
  * In-memory bundler for JSX/TSX/MDX sources.
12
12
  *
@@ -97,6 +97,49 @@ export declare class InMemoryBundler {
97
97
  * ```
98
98
  */
99
99
  bundleToStaticHTML(options: StaticHTMLOptions): Promise<StaticHTMLResult>;
100
+ /**
101
+ * Bundle a component to static HTML for all target platforms at once.
102
+ *
103
+ * This method is optimized for efficiency:
104
+ * - Transpiles the component source code only once
105
+ * - Generates platform-specific HTML variations from the shared transpiled code
106
+ * - Returns complete platform metadata ready for MCP responses
107
+ *
108
+ * @param options - Multi-platform build options
109
+ * @returns Multi-platform build result with all platforms
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * const result = await bundler.bundleToStaticHTMLAll({
114
+ * source: `
115
+ * import { Card, useToolOutput } from '@frontmcp/ui/react';
116
+ * export default function Weather() {
117
+ * const output = useToolOutput();
118
+ * return <Card title="Weather">{output?.temperature}°F</Card>;
119
+ * }
120
+ * `,
121
+ * toolName: 'get_weather',
122
+ * output: { temperature: 72 },
123
+ * });
124
+ *
125
+ * // Access platform-specific results
126
+ * const openaiHtml = result.platforms.openai.html;
127
+ * const claudeHtml = result.platforms.claude.html;
128
+ *
129
+ * // Get metadata for MCP response
130
+ * const openaiMeta = result.platforms.openai.meta;
131
+ * ```
132
+ */
133
+ bundleToStaticHTMLAll(options: MultiPlatformBuildOptions): Promise<MultiPlatformBuildResult>;
134
+ /**
135
+ * Build for a specific platform with pre-transpiled code.
136
+ * Internal helper for bundleToStaticHTMLAll.
137
+ */
138
+ private buildForPlatform;
139
+ /**
140
+ * Map TargetPlatform to AIPlatformType for metadata generation.
141
+ */
142
+ private mapTargetPlatformToAIPlatform;
100
143
  /**
101
144
  * Bundle to static HTML with universal rendering mode.
102
145
  * Uses the universal renderer that can handle multiple content types.
@@ -136,7 +179,7 @@ export declare class InMemoryBundler {
136
179
  /**
137
180
  * Get cache statistics.
138
181
  */
139
- getCacheStats(): import("./cache").CacheStats;
182
+ getCacheStats(): import("@frontmcp/uipack/bundler").CacheStats;
140
183
  /**
141
184
  * Clear the cache.
142
185
  */
@@ -173,19 +216,51 @@ export declare class InMemoryBundler {
173
216
  * Build the <head> section for static HTML.
174
217
  */
175
218
  private buildStaticHTMLHead;
219
+ /**
220
+ * Build theme CSS variables as a :root style block.
221
+ * Uses DEFAULT_THEME if no theme is provided.
222
+ */
223
+ private buildThemeStyleBlock;
176
224
  /**
177
225
  * Build React runtime scripts for static HTML.
178
226
  */
179
227
  private buildReactRuntimeScripts;
180
228
  /**
181
229
  * Build FrontMCP runtime (hooks and UI components).
230
+ * Uses esbuild to transpile real React components at first use, then caches.
231
+ * Falls back to manual implementation if esbuild fails.
182
232
  * Always inlined for reliability across platforms.
183
233
  */
184
234
  private buildFrontMCPRuntime;
185
235
  /**
186
236
  * Build data injection script for tool input/output.
237
+ * Dispatches to mode-specific builders based on buildMode.
187
238
  */
188
239
  private buildDataInjectionScript;
240
+ /**
241
+ * Build static data injection - data baked in at build time (current default).
242
+ */
243
+ private buildStaticDataScript;
244
+ /**
245
+ * Build dynamic data injection - platform-aware.
246
+ * For OpenAI (ESM): subscribes to platform events for updates.
247
+ * For non-OpenAI (UMD/Claude): uses placeholders for data injection.
248
+ */
249
+ private buildDynamicDataScript;
250
+ /**
251
+ * Build dynamic data injection for non-OpenAI platforms using placeholders.
252
+ * Similar to hybrid mode but with platform-appropriate loading/error states.
253
+ */
254
+ private buildDynamicWithPlaceholdersScript;
255
+ /**
256
+ * Build dynamic data injection for OpenAI using subscription pattern.
257
+ */
258
+ private buildDynamicWithSubscriptionScript;
259
+ /**
260
+ * Build hybrid data injection - shell with placeholders for runtime injection.
261
+ * Use injectHybridData() or injectHybridDataFull() from @frontmcp/uipack to replace the placeholders.
262
+ */
263
+ private buildHybridDataScript;
189
264
  /**
190
265
  * Build component render script.
191
266
  * Wraps CommonJS code with module/exports shim to capture the component.
@@ -203,6 +278,5 @@ export declare class InMemoryBundler {
203
278
  * @returns New bundler instance
204
279
  */
205
280
  export declare function createBundler(options?: BundlerOptions): InMemoryBundler;
206
- export { SecurityError } from './sandbox/policy';
207
- export { ExecutionError } from './sandbox/executor';
281
+ export { SecurityError, ExecutionError } from '@frontmcp/uipack/bundler';
208
282
  //# sourceMappingURL=bundler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../src/bundler/bundler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,cAAc,EAId,iBAAiB,EACjB,gBAAgB,EAIjB,MAAM,SAAS,CAAC;AAkGjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;gBAErC,OAAO,GAAE,cAAmB;IAkBxC;;;;;OAKG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAmE3D;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IA6D9D;;;;;;OAMG;IACG,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAuB1G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA+D/E;;;;;;OAMG;YACW,2BAA2B;IAsGzC;;;;;OAKG;IACH,OAAO,CAAC,iCAAiC;IA+EzC;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAuCrC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAQnC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA2DhC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAuClC;;OAEG;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B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAgC5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkC9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA+C3B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAqEhC;;;;;OAKG;YACW,oBAAoB;IAyIlC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAgC7B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAiB9B;;;OAGG;IACH,OAAO,CAAC,kCAAkC;IA8E1C;;OAEG;IACH,OAAO,CAAC,kCAAkC;IAqG1C;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA+E7B;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA6ElC;;OAEG;IACH,OAAO,CAAC,kBAAkB;CA4B3B;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAEvE;AAGD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
@@ -32,12 +32,12 @@
32
32
  * @packageDocumentation
33
33
  */
34
34
  export { InMemoryBundler, createBundler, SecurityError, ExecutionError } from './bundler';
35
- export type { SourceType, OutputFormat, BundleOptions, SSRBundleOptions, BundlerOptions, EsbuildTransformOptions, BundleResult, SSRResult, BundleMetrics, SecurityPolicy, SecurityViolation, CacheEntry, TransformContext, TargetPlatform, StaticHTMLExternalConfig, StaticHTMLOptions, StaticHTMLResult, } from './types';
36
- export { DEFAULT_SECURITY_POLICY, DEFAULT_BUNDLE_OPTIONS, DEFAULT_BUNDLER_OPTIONS, DEFAULT_STATIC_HTML_OPTIONS, STATIC_HTML_CDN, getCdnTypeForPlatform, } from './types';
37
- export { BundlerCache, hashContent, createCacheKey } from './cache';
38
- export type { CacheOptions, CacheStats } from './cache';
39
- export { validateSource, validateImports, validateSize, mergePolicy, throwOnViolations } from './sandbox/policy';
40
- export { executeCode, executeDefault, isExecutionError } from './sandbox/executor';
41
- export type { ExecutionContext, ExecutionResult } from './sandbox/executor';
42
- export { type BuildCacheStorage, type StorageOptions, type CacheEntry as FileCacheEntry, type CacheEntryMetadata, DEFAULT_STORAGE_OPTIONS, calculateManifestSize, FilesystemStorage, createFilesystemStorage, type FilesystemStorageOptions, RedisStorage, createRedisStorage, type RedisStorageOptions, type RedisClient, sha256, sha256Buffer, hashFile, hashFiles, calculateComponentHash, calculateQuickHash, generateBuildId, buildIdFromHash, type ComponentHashOptions, type ComponentHashResult, ComponentBuilder, createFilesystemBuilder, createRedisBuilder, type ComponentBuildOptions, type ComponentBuildResult, } from './file-cache';
35
+ export type { SourceType, OutputFormat, BundleOptions, SSRBundleOptions, BundlerOptions, EsbuildTransformOptions, BundleResult, SSRResult, BundleMetrics, SecurityPolicy, SecurityViolation, CacheEntry, TransformContext, TargetPlatform, ConcretePlatform, StaticHTMLExternalConfig, StaticHTMLOptions, StaticHTMLResult, MultiPlatformBuildOptions, PlatformBuildResult, MultiPlatformBuildResult, BuildMode, DynamicModeOptions, HybridModeOptions, } from './types';
36
+ export { DEFAULT_SECURITY_POLICY, DEFAULT_BUNDLE_OPTIONS, DEFAULT_BUNDLER_OPTIONS, DEFAULT_STATIC_HTML_OPTIONS, STATIC_HTML_CDN, getCdnTypeForPlatform, ALL_PLATFORMS, HYBRID_DATA_PLACEHOLDER, HYBRID_INPUT_PLACEHOLDER, } from './types';
37
+ export { BundlerCache, hashContent, createCacheKey } from '@frontmcp/uipack/bundler';
38
+ export type { CacheOptions, CacheStats } from '@frontmcp/uipack/bundler';
39
+ export { validateSource, validateImports, validateSize, mergePolicy, throwOnViolations, } from '@frontmcp/uipack/bundler';
40
+ export { executeCode, executeDefault, isExecutionError } from '@frontmcp/uipack/bundler';
41
+ export type { ExecutionContext, ExecutionResult } from '@frontmcp/uipack/bundler';
42
+ export { type BuildCacheStorage, type StorageOptions, type CacheEntry as FileCacheEntry, type CacheEntryMetadata, DEFAULT_STORAGE_OPTIONS, calculateManifestSize, FilesystemStorage, createFilesystemStorage, type FilesystemStorageOptions, RedisStorage, createRedisStorage, type RedisStorageOptions, type RedisClient, sha256, sha256Buffer, hashFile, hashFiles, calculateComponentHash, calculateQuickHash, generateBuildId, buildIdFromHash, type ComponentHashOptions, type ComponentHashResult, ComponentBuilder, createFilesystemBuilder, createRedisBuilder, type ComponentBuildOptions, type ComponentBuildResult, } from '@frontmcp/uipack/bundler';
43
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAM1F,YAAY,EAEV,UAAU,EACV,YAAY,EAEZ,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EAEvB,YAAY,EACZ,SAAS,EACT,aAAa,EAEb,cAAc,EACd,iBAAiB,EAEjB,UAAU,EAEV,gBAAgB,EAEhB,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EAEvB,2BAA2B,EAC3B,eAAe,EACf,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEpE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAMjH,OAAO,EAAE,WAAW,EAAE,cAA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