@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
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Base Builder
3
+ *
4
+ * Abstract base class for Static, Hybrid, and Inline builders.
5
+ * Provides common functionality for template detection, transpilation,
6
+ * and HTML generation.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import type { BuilderOptions, CdnMode, TemplateDetection, TranspileOptions, TranspileResult } from './types';
11
+ import type { UITemplateConfig, TemplateContext, TemplateBuilderFn } from '../../types';
12
+ import type { ThemeConfig } from '../../theme';
13
+ /**
14
+ * Abstract base builder class.
15
+ *
16
+ * Provides common functionality:
17
+ * - Template type detection
18
+ * - Component transpilation via esbuild
19
+ * - Theme CSS generation
20
+ * - HTML document scaffolding
21
+ */
22
+ export declare abstract class BaseBuilder {
23
+ /**
24
+ * CDN loading mode.
25
+ */
26
+ protected readonly cdnMode: CdnMode;
27
+ /**
28
+ * Whether to minify output.
29
+ */
30
+ protected readonly minify: boolean;
31
+ /**
32
+ * Theme configuration.
33
+ */
34
+ protected readonly theme: ThemeConfig;
35
+ /**
36
+ * Whether to include source maps.
37
+ */
38
+ protected readonly sourceMaps: boolean;
39
+ constructor(options?: BuilderOptions);
40
+ /**
41
+ * Detect the type of a template.
42
+ *
43
+ * @param template - Template to detect
44
+ * @returns Detection result with type and renderer info
45
+ */
46
+ protected detectTemplate<In = unknown, Out = unknown>(template: UITemplateConfig<In, Out>['template']): TemplateDetection;
47
+ /**
48
+ * Transpile a component using esbuild.
49
+ *
50
+ * @param source - Source code to transpile
51
+ * @param options - Transpile options
52
+ * @returns Transpile result
53
+ */
54
+ protected transpile(source: string, options?: TranspileOptions): Promise<TranspileResult>;
55
+ /**
56
+ * Render an HTML template.
57
+ *
58
+ * @param template - HTML template (string or function)
59
+ * @param context - Template context with input/output
60
+ * @returns Rendered HTML string
61
+ */
62
+ protected renderHtmlTemplate<In = unknown, Out = unknown>(template: string | TemplateBuilderFn<In, Out>, context: TemplateContext<In, Out>): string;
63
+ /**
64
+ * Build the <head> section of the HTML document.
65
+ *
66
+ * @param options - Head options
67
+ * @returns HTML head content
68
+ */
69
+ protected buildHead(options: {
70
+ title: string;
71
+ includeBridge?: boolean;
72
+ includeCdn?: boolean;
73
+ includeTheme?: boolean;
74
+ customStyles?: string;
75
+ }): string;
76
+ /**
77
+ * Build data injection script.
78
+ *
79
+ * @param options - Injection options
80
+ * @returns Script tag with data injection
81
+ */
82
+ protected buildDataInjectionScript(options: {
83
+ toolName: string;
84
+ input?: unknown;
85
+ output?: unknown;
86
+ usePlaceholders?: boolean;
87
+ }): string;
88
+ /**
89
+ * Wrap content in a complete HTML document.
90
+ *
91
+ * @param options - Wrap options
92
+ * @returns Complete HTML document
93
+ */
94
+ protected wrapInHtmlDocument(options: {
95
+ head: string;
96
+ body: string;
97
+ bodyClass?: string;
98
+ }): string;
99
+ /**
100
+ * Calculate content hash.
101
+ *
102
+ * @param content - Content to hash
103
+ * @returns Hash string
104
+ */
105
+ protected calculateHash(content: string): Promise<string>;
106
+ /**
107
+ * Estimate gzipped size.
108
+ *
109
+ * @param content - Content to estimate
110
+ * @returns Estimated gzipped size in bytes
111
+ */
112
+ protected estimateGzipSize(content: string): number;
113
+ /**
114
+ * Create template context.
115
+ *
116
+ * @param input - Tool input
117
+ * @param output - Tool output
118
+ * @returns Template context
119
+ */
120
+ protected createContext<In = unknown, Out = unknown>(input: In, output: Out): TemplateContext<In, Out>;
121
+ }
122
+ //# sourceMappingURL=base-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/base-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW/C;;;;;;;;GAQG;AACH,8BAAsB,WAAW;IAC/B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAEtC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;gBAE3B,OAAO,GAAE,cAAmB;IAWxC;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EAClD,QAAQ,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAC9C,iBAAiB;IA4DpB;;;;;;OAMG;cACa,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC;IAgB3B;;;;;;OAMG;IACH,SAAS,CAAC,kBAAkB,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACtD,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAAC,EAAE,EAAE,GAAG,CAAC,EAC7C,OAAO,EAAE,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC,GAChC,MAAM;IAYT;;;;;OAKG;IACH,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,MAAM;IAsDV;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,CAAC,OAAO,EAAE;QAC1C,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,MAAM;IAwBV;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,MAAM;IAgBV;;;;;OAKG;cACa,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB/D;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAKnD;;;;;;OAMG;IACH,SAAS,CAAC,aAAa,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACjD,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,GAAG,GACV,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC;CAgC5B"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * esbuild Configuration for Builders
3
+ *
4
+ * Shared esbuild configuration for component transpilation.
5
+ * Supports externalization for hybrid mode and inline bundling.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { TransformOptions } from 'esbuild';
10
+ import type { TranspileOptions } from './types';
11
+ /**
12
+ * Default packages to externalize in hybrid mode.
13
+ * These packages are loaded from the vendor shell's CDN scripts.
14
+ */
15
+ export declare const DEFAULT_EXTERNALS: string[];
16
+ /**
17
+ * Global variable mappings for externalized packages.
18
+ * Used to create namespace polyfills in the component chunk.
19
+ */
20
+ export declare const EXTERNAL_GLOBALS: Record<string, string>;
21
+ /**
22
+ * Create esbuild transform options for component transpilation.
23
+ *
24
+ * @param options - Transpile options
25
+ * @returns esbuild transform options
26
+ */
27
+ export declare function createTransformConfig(options?: TranspileOptions): TransformOptions;
28
+ /**
29
+ * Create esbuild transform options for externalized component chunks.
30
+ *
31
+ * This configuration produces code that:
32
+ * 1. Imports React/deps from external globals
33
+ * 2. Uses ESM format for dynamic import
34
+ * 3. Has all FrontMCP UI components externalized
35
+ *
36
+ * @param options - Transpile options
37
+ * @returns esbuild transform options with externalization
38
+ */
39
+ export declare function createExternalizedConfig(options?: TranspileOptions): TransformOptions;
40
+ /**
41
+ * Create JavaScript banner that defines external namespace objects.
42
+ *
43
+ * This banner is prepended to the transpiled code and provides
44
+ * the global variables that the externalized imports reference.
45
+ *
46
+ * @param externals - List of external package names
47
+ * @returns JavaScript banner code
48
+ */
49
+ export declare function createExternalsBanner(externals: string[]): string;
50
+ /**
51
+ * Create inline bundle configuration.
52
+ *
53
+ * This configuration bundles everything together for inline mode,
54
+ * including React and all dependencies.
55
+ *
56
+ * @param options - Transpile options
57
+ * @returns esbuild transform options for inline bundling
58
+ */
59
+ export declare function createInlineConfig(options?: TranspileOptions): TransformOptions;
60
+ /**
61
+ * CDN URLs for external dependencies.
62
+ */
63
+ export declare const CDN_URLS: {
64
+ readonly react: "https://esm.sh/react@19";
65
+ readonly reactDom: "https://esm.sh/react-dom@19";
66
+ readonly reactJsxRuntime: "https://esm.sh/react@19/jsx-runtime";
67
+ readonly frontmcpUI: "https://esm.sh/@frontmcp/ui";
68
+ readonly tailwind: "https://cdn.tailwindcss.com";
69
+ };
70
+ /**
71
+ * Cloudflare CDN URLs (for Claude compatibility).
72
+ */
73
+ export declare const CLOUDFLARE_CDN_URLS: {
74
+ readonly react: "https://cdnjs.cloudflare.com/ajax/libs/react/19.0.0/umd/react.production.min.js";
75
+ readonly reactDom: "https://cdnjs.cloudflare.com/ajax/libs/react-dom/19.0.0/umd/react-dom.production.min.js";
76
+ readonly tailwind: "https://cdn.tailwindcss.com";
77
+ };
78
+ /**
79
+ * Generate CDN script tags for the vendor shell.
80
+ *
81
+ * @param useCloudflare - Use Cloudflare CDN (for Claude)
82
+ * @returns HTML script tags
83
+ */
84
+ export declare function generateCdnScriptTags(useCloudflare?: boolean): string;
85
+ /**
86
+ * Generate global namespace setup script.
87
+ *
88
+ * This script exposes React and other modules as globals
89
+ * for the externalized component chunks to use.
90
+ *
91
+ * @returns JavaScript code to set up globals
92
+ */
93
+ export declare function generateGlobalsSetupScript(): string;
94
+ //# sourceMappingURL=esbuild-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild-config.d.ts","sourceRoot":"","sources":["../../../src/build/builders/esbuild-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,UAO7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMnD,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,gBAAqB,GAAG,gBAAgB,CAkBtF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,gBAAqB,GAAG,gBAAgB,CAWzF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAejE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,gBAAqB,GAAG,gBAAgB,CAMnF;AAMD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,UAAQ,GAAG,MAAM,CA0BnE;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAiBnD"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Hybrid Builder
3
+ *
4
+ * Builds vendor shell (cached, shared) + component chunks (per-tool).
5
+ * Optimal for OpenAI where shell is fetched once via resource URI and cached.
6
+ *
7
+ * Build Phase:
8
+ * - Vendor shell: React, Bridge, UI components from CDN
9
+ * - Component chunks: Transpiled with externalized dependencies
10
+ *
11
+ * Preview Phase:
12
+ * - OpenAI: Shell via resource://, component in tool response
13
+ * - Claude: Combine shell + component (inline delivery)
14
+ * - Generic: Same as OpenAI with frontmcp namespace
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ import { BaseBuilder } from './base-builder';
19
+ import type { BuilderOptions, BuildToolOptions, HybridBuildResult, IHybridBuilder } from './types';
20
+ import type { UITemplateConfig } from '../../types';
21
+ /**
22
+ * Hybrid builder for creating vendor shells and component chunks.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const builder = new HybridBuilder({ cdnMode: 'cdn' });
27
+ *
28
+ * // Build vendor shell (cached, shared across all tools)
29
+ * const vendorShell = await builder.buildVendorShell();
30
+ *
31
+ * // Build component chunk per tool
32
+ * const componentChunk = await builder.buildComponentChunk(WeatherWidget);
33
+ *
34
+ * // For Claude, combine into inline HTML
35
+ * const html = builder.combineForInline(vendorShell, componentChunk, input, output);
36
+ * ```
37
+ */
38
+ export declare class HybridBuilder extends BaseBuilder implements IHybridBuilder {
39
+ readonly mode: "hybrid";
40
+ /**
41
+ * Cached vendor shell.
42
+ */
43
+ private vendorShellCache;
44
+ constructor(options?: BuilderOptions);
45
+ /**
46
+ * Build a hybrid result with vendor shell and component chunk.
47
+ *
48
+ * @param options - Build options
49
+ * @returns Hybrid build result
50
+ */
51
+ build<In = unknown, Out = unknown>(options: BuildToolOptions<In, Out>): Promise<HybridBuildResult>;
52
+ /**
53
+ * Build the vendor shell (shared across all tools).
54
+ *
55
+ * The vendor shell contains:
56
+ * - React/ReactDOM from CDN
57
+ * - FrontMCP Bridge runtime
58
+ * - Theme CSS and fonts
59
+ * - Component injection point
60
+ *
61
+ * @returns Vendor shell HTML
62
+ */
63
+ buildVendorShell(): Promise<string>;
64
+ /**
65
+ * Build a component chunk for a specific template.
66
+ *
67
+ * The component chunk is transpiled with externalized dependencies
68
+ * (React, etc.) that are provided by the vendor shell.
69
+ *
70
+ * @param template - Component template
71
+ * @returns Transpiled component code
72
+ */
73
+ buildComponentChunk<In = unknown, Out = unknown>(template: UITemplateConfig<In, Out>['template']): Promise<string>;
74
+ /**
75
+ * Combine shell and component for Claude/inline delivery.
76
+ *
77
+ * @param shell - Vendor shell HTML
78
+ * @param component - Component chunk code
79
+ * @param input - Tool input data
80
+ * @param output - Tool output data
81
+ * @returns Complete HTML with embedded component and data
82
+ */
83
+ combineForInline(shell: string, component: string, input: unknown, output: unknown): string;
84
+ /**
85
+ * Wrap HTML template as a React component.
86
+ */
87
+ private wrapHtmlAsComponent;
88
+ /**
89
+ * Transpile a React component function.
90
+ */
91
+ private transpileReactComponent;
92
+ }
93
+ //# sourceMappingURL=hybrid-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hybrid-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/hybrid-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,aAAa,CAAC;AAWvE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAc,SAAQ,WAAY,YAAW,cAAc;IACtE,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAElC;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAAuB;gBAEnC,OAAO,GAAE,cAAmB;IAIxC;;;;;OAKG;IACG,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACrC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,GACjC,OAAO,CAAC,iBAAiB,CAAC;IAkC7B;;;;;;;;;;OAUG;IACG,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAqHzC;;;;;;;;OAQG;IACG,mBAAmB,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACnD,QAAQ,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAC9C,OAAO,CAAC,MAAM,CAAC;IA2BlB;;;;;;;;OAQG;IACH,gBAAgB,CACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,GACd,MAAM;IA+CT;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA8B3B;;OAEG;YACW,uBAAuB;CA8BtC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * UI Builders
3
+ *
4
+ * Three build modes for creating universal HTML documents:
5
+ * - Static: Full HTML with placeholders, inject data at preview time
6
+ * - Hybrid: Vendor shell + component chunks, optimal for OpenAI
7
+ * - Inline: Minimal loader + full HTML per request, best for development
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export type { BuildMode, CdnMode, BuilderOptions, BuildToolOptions, StaticBuildResult, HybridBuildResult, InlineBuildResult, BuilderResult, Builder, IStaticBuilder, IHybridBuilder, IInlineBuilder, TemplateType, TemplateDetection, TranspileOptions, TranspileResult, } from './types';
12
+ export { BaseBuilder } from './base-builder';
13
+ export { StaticBuilder } from './static-builder';
14
+ export { HybridBuilder } from './hybrid-builder';
15
+ export { InlineBuilder } from './inline-builder';
16
+ export { DEFAULT_EXTERNALS, EXTERNAL_GLOBALS, CDN_URLS, CLOUDFLARE_CDN_URLS, createTransformConfig, createExternalizedConfig, createInlineConfig, createExternalsBanner, generateCdnScriptTags, generateGlobalsSetupScript, } from './esbuild-config';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build/builders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EACV,SAAS,EACT,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Inline Builder
3
+ *
4
+ * Builds minimal loader shell (for discovery) + full HTML per request.
5
+ * Best for development/review where each request gets complete widget.
6
+ *
7
+ * Build Phase:
8
+ * - Minimal loader with bridge and loading indicator
9
+ * - Injector script that waits for full HTML in tool response
10
+ *
11
+ * Preview Phase:
12
+ * - OpenAI: Loader at discovery, full HTML replaces document on tool call
13
+ * - Claude: Full HTML returned directly (no loader needed)
14
+ * - Generic: Same as OpenAI with frontmcp namespace
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ import { BaseBuilder } from './base-builder';
19
+ import type { BuilderOptions, BuildToolOptions, InlineBuildResult, IInlineBuilder } from './types';
20
+ import type { UITemplateConfig } from '../../types';
21
+ /**
22
+ * Inline builder for development and review scenarios.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const builder = new InlineBuilder({ cdnMode: 'cdn' });
27
+ *
28
+ * // Get loader for tools/list
29
+ * const loader = builder.buildLoader('get_weather');
30
+ *
31
+ * // Build full widget for each tool call
32
+ * const fullHtml = await builder.buildFullWidget(
33
+ * WeatherWidget,
34
+ * { location: 'NYC' },
35
+ * { temperature: 72 }
36
+ * );
37
+ * ```
38
+ */
39
+ export declare class InlineBuilder extends BaseBuilder implements IInlineBuilder {
40
+ readonly mode: "inline";
41
+ constructor(options?: BuilderOptions);
42
+ /**
43
+ * Build an inline result with loader and full widget generator.
44
+ *
45
+ * @param options - Build options
46
+ * @returns Inline build result
47
+ */
48
+ build<In = unknown, Out = unknown>(options: BuildToolOptions<In, Out>): Promise<InlineBuildResult>;
49
+ /**
50
+ * Build the minimal loader shell.
51
+ *
52
+ * The loader contains:
53
+ * - FrontMCP Bridge runtime
54
+ * - Loading indicator
55
+ * - Injector script that replaces document on tool response
56
+ *
57
+ * @param toolName - Name of the tool
58
+ * @returns Loader HTML
59
+ */
60
+ buildLoader(toolName: string): string;
61
+ /**
62
+ * Build full widget HTML with embedded data.
63
+ *
64
+ * @param template - Component template
65
+ * @param input - Tool input data
66
+ * @param output - Tool output data
67
+ * @returns Complete HTML with all dependencies and data
68
+ */
69
+ buildFullWidget<In = unknown, Out = unknown>(template: UITemplateConfig<In, Out>['template'], input: In, output: Out): Promise<string>;
70
+ /**
71
+ * Build React scripts for client-side rendering.
72
+ */
73
+ private buildReactScripts;
74
+ /**
75
+ * Build React content with client-side rendering.
76
+ */
77
+ private buildReactContent;
78
+ /**
79
+ * Simple HTML minification.
80
+ */
81
+ private minifyHtml;
82
+ }
83
+ //# sourceMappingURL=inline-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/inline-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,aAAa,CAAC;AAOvE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,WAAY,YAAW,cAAc;IACtE,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;gBAEtB,OAAO,GAAE,cAAmB;IAIxC;;;;;OAKG;IACG,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACrC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,GACjC,OAAO,CAAC,iBAAiB,CAAC;IAgC7B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAuHrC;;;;;;;OAOG;IACG,eAAe,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EAC/C,QAAQ,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,EAC/C,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,MAAM,CAAC;IA8DlB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAsDzB;;OAEG;IACH,OAAO,CAAC,UAAU;CAMnB"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Static Builder
3
+ *
4
+ * Builds complete HTML documents with placeholders for data injection.
5
+ * The shell is cached and reused; only data changes per request.
6
+ *
7
+ * Build Phase:
8
+ * - Full HTML with theme, CDN scripts, bridge runtime
9
+ * - Component code (transpiled if React/MDX)
10
+ * - Placeholders for input/output data
11
+ *
12
+ * Preview Phase:
13
+ * - Replace placeholders with actual data
14
+ * - Platform-specific handling (OpenAI, Claude, Generic)
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ import { BaseBuilder } from './base-builder';
19
+ import type { BuilderOptions, BuildToolOptions, StaticBuildResult, IStaticBuilder } from './types';
20
+ /**
21
+ * Static builder for creating cached HTML shells with placeholders.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const builder = new StaticBuilder({ cdnMode: 'cdn' });
26
+ *
27
+ * // Build once (cached)
28
+ * const result = await builder.build({
29
+ * template: WeatherWidget,
30
+ * toolName: 'get_weather',
31
+ * });
32
+ *
33
+ * // Inject data per request (fast)
34
+ * const html = builder.injectData(result.html, input, output);
35
+ * ```
36
+ */
37
+ export declare class StaticBuilder extends BaseBuilder implements IStaticBuilder {
38
+ readonly mode: "static";
39
+ constructor(options?: BuilderOptions);
40
+ /**
41
+ * Build a static HTML shell with placeholders.
42
+ *
43
+ * @param options - Build options
44
+ * @returns Static build result
45
+ */
46
+ build<In = unknown, Out = unknown>(options: BuildToolOptions<In, Out>): Promise<StaticBuildResult>;
47
+ /**
48
+ * Inject data into a pre-built shell.
49
+ *
50
+ * @param shell - HTML shell with placeholders
51
+ * @param input - Tool input data
52
+ * @param output - Tool output data
53
+ * @returns HTML with data injected
54
+ */
55
+ injectData(shell: string, input: unknown, output: unknown): string;
56
+ /**
57
+ * Build React rendering shell.
58
+ *
59
+ * Creates a client-side React rendering setup that:
60
+ * 1. Waits for runtime to be ready
61
+ * 2. Loads component code
62
+ * 3. Renders into #root with data from window.__mcpToolOutput
63
+ */
64
+ private buildReactShell;
65
+ /**
66
+ * Build inline React runtime (for offline mode).
67
+ */
68
+ private buildInlineReactRuntime;
69
+ /**
70
+ * Get component name from template.
71
+ */
72
+ private getComponentName;
73
+ /**
74
+ * Simple HTML minification.
75
+ */
76
+ private minifyHtml;
77
+ }
78
+ //# sourceMappingURL=static-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/static-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,SAAS,CAAC;AASjB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAc,SAAQ,WAAY,YAAW,cAAc;IACtE,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;gBAEtB,OAAO,GAAE,cAAmB;IAIxC;;;;;OAKG;IACG,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACrC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,GACjC,OAAO,CAAC,iBAAiB,CAAC;IA6F7B;;;;;;;OAOG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM;IAQlE;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IA8EvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,UAAU;CAMnB"}