@frontmcp/uipack 0.12.2 → 1.0.0-beta.1

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 (298) hide show
  1. package/CLAUDE.md +56 -154
  2. package/README.md +367 -62
  3. package/adapters/base-template.d.ts +30 -0
  4. package/adapters/base-template.d.ts.map +1 -0
  5. package/adapters/cdn-info.d.ts +34 -0
  6. package/adapters/cdn-info.d.ts.map +1 -0
  7. package/adapters/constants.d.ts +18 -0
  8. package/adapters/constants.d.ts.map +1 -0
  9. package/adapters/content-detector.d.ts +19 -0
  10. package/adapters/content-detector.d.ts.map +1 -0
  11. package/adapters/content-renderers.d.ts +27 -0
  12. package/adapters/content-renderers.d.ts.map +1 -0
  13. package/adapters/index.d.ts +14 -7
  14. package/adapters/index.d.ts.map +1 -1
  15. package/adapters/index.js +2343 -426
  16. package/adapters/render-failure.d.ts +18 -0
  17. package/adapters/render-failure.d.ts.map +1 -0
  18. package/adapters/response-builder.d.ts +34 -104
  19. package/adapters/response-builder.d.ts.map +1 -1
  20. package/adapters/serving-mode.d.ts +28 -91
  21. package/adapters/serving-mode.d.ts.map +1 -1
  22. package/adapters/template-renderer.d.ts +50 -0
  23. package/adapters/template-renderer.d.ts.map +1 -0
  24. package/adapters/type-detector.d.ts +18 -0
  25. package/adapters/type-detector.d.ts.map +1 -0
  26. package/bridge-runtime/index.js +1 -1
  27. package/component/index.d.ts +14 -0
  28. package/component/index.d.ts.map +1 -0
  29. package/component/index.js +2043 -0
  30. package/component/loader.d.ts +36 -0
  31. package/component/loader.d.ts.map +1 -0
  32. package/component/renderer.d.ts +30 -0
  33. package/component/renderer.d.ts.map +1 -0
  34. package/component/transpiler.d.ts +49 -0
  35. package/component/transpiler.d.ts.map +1 -0
  36. package/component/types.d.ts +82 -0
  37. package/component/types.d.ts.map +1 -0
  38. package/esm/adapters/index.mjs +2337 -422
  39. package/esm/bridge-runtime/index.mjs +1 -1
  40. package/esm/component/index.mjs +2013 -0
  41. package/esm/index.mjs +3446 -13935
  42. package/esm/package.json +3 -12
  43. package/esm/resolver/index.mjs +661 -0
  44. package/esm/shell/index.mjs +1406 -0
  45. package/esm/types/index.mjs +11 -11
  46. package/esm/utils/index.mjs +53 -8
  47. package/index.d.ts +12 -40
  48. package/index.d.ts.map +1 -1
  49. package/index.js +3579 -14218
  50. package/package.json +3 -12
  51. package/resolver/cdn-registry.d.ts +39 -0
  52. package/resolver/cdn-registry.d.ts.map +1 -0
  53. package/resolver/esm-sh.resolver.d.ts +54 -0
  54. package/resolver/esm-sh.resolver.d.ts.map +1 -0
  55. package/resolver/import-map.d.ts +47 -0
  56. package/resolver/import-map.d.ts.map +1 -0
  57. package/resolver/import-parser.d.ts +28 -0
  58. package/resolver/import-parser.d.ts.map +1 -0
  59. package/resolver/import-rewriter.d.ts +29 -0
  60. package/resolver/import-rewriter.d.ts.map +1 -0
  61. package/resolver/index.d.ts +15 -0
  62. package/resolver/index.d.ts.map +1 -0
  63. package/resolver/index.js +708 -0
  64. package/resolver/types.d.ts +191 -0
  65. package/resolver/types.d.ts.map +1 -0
  66. package/shell/builder.d.ts +31 -0
  67. package/shell/builder.d.ts.map +1 -0
  68. package/shell/csp.d.ts +37 -0
  69. package/shell/csp.d.ts.map +1 -0
  70. package/shell/custom-shell-applier.d.ts +33 -0
  71. package/shell/custom-shell-applier.d.ts.map +1 -0
  72. package/shell/custom-shell-resolver.d.ts +47 -0
  73. package/shell/custom-shell-resolver.d.ts.map +1 -0
  74. package/shell/custom-shell-types.d.ts +75 -0
  75. package/shell/custom-shell-types.d.ts.map +1 -0
  76. package/shell/custom-shell-validator.d.ts +26 -0
  77. package/shell/custom-shell-validator.d.ts.map +1 -0
  78. package/shell/data-injector.d.ts +40 -0
  79. package/shell/data-injector.d.ts.map +1 -0
  80. package/shell/index.d.ts +19 -0
  81. package/shell/index.d.ts.map +1 -0
  82. package/shell/index.js +1453 -0
  83. package/shell/types.d.ts +54 -0
  84. package/shell/types.d.ts.map +1 -0
  85. package/types/index.d.ts +1 -3
  86. package/types/index.d.ts.map +1 -1
  87. package/types/index.js +11 -11
  88. package/types/ui-config.d.ts +50 -11
  89. package/types/ui-config.d.ts.map +1 -1
  90. package/types/ui-runtime.d.ts +8 -82
  91. package/types/ui-runtime.d.ts.map +1 -1
  92. package/utils/index.d.ts +9 -3
  93. package/utils/index.d.ts.map +1 -1
  94. package/utils/index.js +59 -7
  95. package/adapters/platform-meta.constants.d.ts +0 -26
  96. package/adapters/platform-meta.constants.d.ts.map +0 -1
  97. package/adapters/platform-meta.d.ts +0 -234
  98. package/adapters/platform-meta.d.ts.map +0 -1
  99. package/base-template/bridge.d.ts +0 -90
  100. package/base-template/bridge.d.ts.map +0 -1
  101. package/base-template/default-base-template.d.ts +0 -91
  102. package/base-template/default-base-template.d.ts.map +0 -1
  103. package/base-template/index.d.ts +0 -15
  104. package/base-template/index.d.ts.map +0 -1
  105. package/base-template/index.js +0 -1393
  106. package/base-template/polyfills.d.ts +0 -31
  107. package/base-template/polyfills.d.ts.map +0 -1
  108. package/base-template/theme-styles.d.ts +0 -74
  109. package/base-template/theme-styles.d.ts.map +0 -1
  110. package/build/builders/base-builder.d.ts +0 -124
  111. package/build/builders/base-builder.d.ts.map +0 -1
  112. package/build/builders/esbuild-config.d.ts +0 -94
  113. package/build/builders/esbuild-config.d.ts.map +0 -1
  114. package/build/builders/hybrid-builder.d.ts +0 -93
  115. package/build/builders/hybrid-builder.d.ts.map +0 -1
  116. package/build/builders/index.d.ts +0 -17
  117. package/build/builders/index.d.ts.map +0 -1
  118. package/build/builders/inline-builder.d.ts +0 -83
  119. package/build/builders/inline-builder.d.ts.map +0 -1
  120. package/build/builders/static-builder.d.ts +0 -78
  121. package/build/builders/static-builder.d.ts.map +0 -1
  122. package/build/builders/types.d.ts +0 -341
  123. package/build/builders/types.d.ts.map +0 -1
  124. package/build/cdn-resources.d.ts +0 -244
  125. package/build/cdn-resources.d.ts.map +0 -1
  126. package/build/hybrid-data.d.ts +0 -127
  127. package/build/hybrid-data.d.ts.map +0 -1
  128. package/build/index.d.ts +0 -299
  129. package/build/index.d.ts.map +0 -1
  130. package/build/index.js +0 -8699
  131. package/build/ui-components-browser.d.ts +0 -64
  132. package/build/ui-components-browser.d.ts.map +0 -1
  133. package/build/widget-manifest.d.ts +0 -362
  134. package/build/widget-manifest.d.ts.map +0 -1
  135. package/bundler/cache.d.ts +0 -173
  136. package/bundler/cache.d.ts.map +0 -1
  137. package/bundler/file-cache/component-builder.d.ts +0 -167
  138. package/bundler/file-cache/component-builder.d.ts.map +0 -1
  139. package/bundler/file-cache/hash-calculator.d.ts +0 -155
  140. package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  141. package/bundler/file-cache/index.d.ts +0 -12
  142. package/bundler/file-cache/index.d.ts.map +0 -1
  143. package/bundler/file-cache/storage/filesystem.d.ts +0 -149
  144. package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  145. package/bundler/file-cache/storage/index.d.ts +0 -11
  146. package/bundler/file-cache/storage/index.d.ts.map +0 -1
  147. package/bundler/file-cache/storage/interface.d.ts +0 -152
  148. package/bundler/file-cache/storage/interface.d.ts.map +0 -1
  149. package/bundler/file-cache/storage/redis.d.ts +0 -139
  150. package/bundler/file-cache/storage/redis.d.ts.map +0 -1
  151. package/bundler/index.d.ts +0 -35
  152. package/bundler/index.d.ts.map +0 -1
  153. package/bundler/index.js +0 -2953
  154. package/bundler/sandbox/enclave-adapter.d.ts +0 -121
  155. package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  156. package/bundler/sandbox/executor.d.ts +0 -14
  157. package/bundler/sandbox/executor.d.ts.map +0 -1
  158. package/bundler/sandbox/policy.d.ts +0 -62
  159. package/bundler/sandbox/policy.d.ts.map +0 -1
  160. package/bundler/types.d.ts +0 -702
  161. package/bundler/types.d.ts.map +0 -1
  162. package/dependency/cdn-registry.d.ts +0 -98
  163. package/dependency/cdn-registry.d.ts.map +0 -1
  164. package/dependency/import-map.d.ts +0 -186
  165. package/dependency/import-map.d.ts.map +0 -1
  166. package/dependency/import-parser.d.ts +0 -82
  167. package/dependency/import-parser.d.ts.map +0 -1
  168. package/dependency/index.d.ts +0 -17
  169. package/dependency/index.d.ts.map +0 -1
  170. package/dependency/index.js +0 -3180
  171. package/dependency/resolver.d.ts +0 -164
  172. package/dependency/resolver.d.ts.map +0 -1
  173. package/dependency/schemas.d.ts +0 -486
  174. package/dependency/schemas.d.ts.map +0 -1
  175. package/dependency/template-loader.d.ts +0 -204
  176. package/dependency/template-loader.d.ts.map +0 -1
  177. package/dependency/template-processor.d.ts +0 -118
  178. package/dependency/template-processor.d.ts.map +0 -1
  179. package/dependency/types.d.ts +0 -739
  180. package/dependency/types.d.ts.map +0 -1
  181. package/esm/base-template/index.mjs +0 -1359
  182. package/esm/build/index.mjs +0 -8601
  183. package/esm/bundler/index.mjs +0 -2895
  184. package/esm/dependency/index.mjs +0 -3068
  185. package/esm/handlebars/index.mjs +0 -587
  186. package/esm/registry/index.mjs +0 -6305
  187. package/esm/renderers/index.mjs +0 -1557
  188. package/esm/runtime/index.mjs +0 -5361
  189. package/esm/styles/index.mjs +0 -171
  190. package/esm/theme/index.mjs +0 -756
  191. package/esm/tool-template/index.mjs +0 -3652
  192. package/esm/validation/index.mjs +0 -542
  193. package/handlebars/expression-extractor.d.ts +0 -147
  194. package/handlebars/expression-extractor.d.ts.map +0 -1
  195. package/handlebars/helpers.d.ts +0 -339
  196. package/handlebars/helpers.d.ts.map +0 -1
  197. package/handlebars/index.d.ts +0 -195
  198. package/handlebars/index.d.ts.map +0 -1
  199. package/handlebars/index.js +0 -659
  200. package/preview/claude-preview.d.ts +0 -67
  201. package/preview/claude-preview.d.ts.map +0 -1
  202. package/preview/generic-preview.d.ts +0 -66
  203. package/preview/generic-preview.d.ts.map +0 -1
  204. package/preview/index.d.ts +0 -36
  205. package/preview/index.d.ts.map +0 -1
  206. package/preview/openai-preview.d.ts +0 -70
  207. package/preview/openai-preview.d.ts.map +0 -1
  208. package/preview/types.d.ts +0 -199
  209. package/preview/types.d.ts.map +0 -1
  210. package/registry/index.d.ts +0 -46
  211. package/registry/index.d.ts.map +0 -1
  212. package/registry/index.js +0 -6342
  213. package/registry/render-template.d.ts +0 -91
  214. package/registry/render-template.d.ts.map +0 -1
  215. package/registry/tool-ui.registry.d.ts +0 -294
  216. package/registry/tool-ui.registry.d.ts.map +0 -1
  217. package/registry/uri-utils.d.ts +0 -56
  218. package/registry/uri-utils.d.ts.map +0 -1
  219. package/renderers/cache.d.ts +0 -145
  220. package/renderers/cache.d.ts.map +0 -1
  221. package/renderers/html.renderer.d.ts +0 -123
  222. package/renderers/html.renderer.d.ts.map +0 -1
  223. package/renderers/index.d.ts +0 -36
  224. package/renderers/index.d.ts.map +0 -1
  225. package/renderers/index.js +0 -1603
  226. package/renderers/mdx-client.renderer.d.ts +0 -124
  227. package/renderers/mdx-client.renderer.d.ts.map +0 -1
  228. package/renderers/registry.d.ts +0 -133
  229. package/renderers/registry.d.ts.map +0 -1
  230. package/renderers/types.d.ts +0 -343
  231. package/renderers/types.d.ts.map +0 -1
  232. package/renderers/utils/detect.d.ts +0 -107
  233. package/renderers/utils/detect.d.ts.map +0 -1
  234. package/renderers/utils/hash.d.ts +0 -40
  235. package/renderers/utils/hash.d.ts.map +0 -1
  236. package/renderers/utils/index.d.ts +0 -9
  237. package/renderers/utils/index.d.ts.map +0 -1
  238. package/renderers/utils/transpiler.d.ts +0 -70
  239. package/renderers/utils/transpiler.d.ts.map +0 -1
  240. package/runtime/adapters/html.adapter.d.ts +0 -59
  241. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  242. package/runtime/adapters/index.d.ts +0 -26
  243. package/runtime/adapters/index.d.ts.map +0 -1
  244. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  245. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  246. package/runtime/adapters/types.d.ts +0 -95
  247. package/runtime/adapters/types.d.ts.map +0 -1
  248. package/runtime/csp.d.ts +0 -48
  249. package/runtime/csp.d.ts.map +0 -1
  250. package/runtime/index.d.ts +0 -17
  251. package/runtime/index.d.ts.map +0 -1
  252. package/runtime/index.js +0 -5432
  253. package/runtime/mcp-bridge.d.ts +0 -101
  254. package/runtime/mcp-bridge.d.ts.map +0 -1
  255. package/runtime/renderer-runtime.d.ts +0 -133
  256. package/runtime/renderer-runtime.d.ts.map +0 -1
  257. package/runtime/sanitizer.d.ts +0 -180
  258. package/runtime/sanitizer.d.ts.map +0 -1
  259. package/runtime/types.d.ts +0 -415
  260. package/runtime/types.d.ts.map +0 -1
  261. package/runtime/wrapper.d.ts +0 -421
  262. package/runtime/wrapper.d.ts.map +0 -1
  263. package/styles/index.d.ts +0 -8
  264. package/styles/index.d.ts.map +0 -1
  265. package/styles/index.js +0 -222
  266. package/styles/variants.d.ts +0 -51
  267. package/styles/variants.d.ts.map +0 -1
  268. package/theme/cdn.d.ts +0 -195
  269. package/theme/cdn.d.ts.map +0 -1
  270. package/theme/css-to-theme.d.ts +0 -64
  271. package/theme/css-to-theme.d.ts.map +0 -1
  272. package/theme/index.d.ts +0 -19
  273. package/theme/index.d.ts.map +0 -1
  274. package/theme/index.js +0 -814
  275. package/theme/platforms.d.ts +0 -102
  276. package/theme/platforms.d.ts.map +0 -1
  277. package/theme/presets/github-openai.d.ts +0 -50
  278. package/theme/presets/github-openai.d.ts.map +0 -1
  279. package/theme/presets/index.d.ts +0 -11
  280. package/theme/presets/index.d.ts.map +0 -1
  281. package/theme/theme.d.ts +0 -396
  282. package/theme/theme.d.ts.map +0 -1
  283. package/tool-template/builder.d.ts +0 -213
  284. package/tool-template/builder.d.ts.map +0 -1
  285. package/tool-template/index.d.ts +0 -16
  286. package/tool-template/index.d.ts.map +0 -1
  287. package/tool-template/index.js +0 -3690
  288. package/validation/error-box.d.ts +0 -56
  289. package/validation/error-box.d.ts.map +0 -1
  290. package/validation/index.d.ts +0 -13
  291. package/validation/index.d.ts.map +0 -1
  292. package/validation/index.js +0 -576
  293. package/validation/schema-paths.d.ts +0 -118
  294. package/validation/schema-paths.d.ts.map +0 -1
  295. package/validation/template-validator.d.ts +0 -143
  296. package/validation/template-validator.d.ts.map +0 -1
  297. package/validation/wrapper.d.ts +0 -97
  298. package/validation/wrapper.d.ts.map +0 -1
@@ -1,31 +0,0 @@
1
- /**
2
- * Platform Polyfills for Base Template
3
- *
4
- * Provides additional polyfills for MCP session detection and
5
- * direct HTTP fallback when not in an OpenAI or ext-apps environment.
6
- *
7
- * These polyfills complement the existing MCP_BRIDGE_RUNTIME.
8
- */
9
- /**
10
- * MCP Session information for HTTP fallback
11
- */
12
- export interface McpSession {
13
- /** MCP server URL */
14
- mcpUrl: string;
15
- /** Session ID for authentication */
16
- sessionId: string;
17
- }
18
- /**
19
- * Render the MCP session detection polyfill script.
20
- *
21
- * This provides auto-detection of MCP session info from:
22
- * 1. Explicit window.__frontmcp.mcpSession
23
- * 2. Meta tags (mcp-url, mcp-session-id)
24
- * 3. URL query parameters (mcpUrl, sessionId)
25
- * 4. Fallback values provided at render time
26
- *
27
- * @param mcpSession - Optional explicit session to bake into the template
28
- * @returns Script tag with polyfill code
29
- */
30
- export declare function renderMcpSessionPolyfill(mcpSession?: McpSession): string;
31
- //# sourceMappingURL=polyfills.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../../src/base-template/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM,CAuJxE"}
@@ -1,74 +0,0 @@
1
- /**
2
- * Theme Styles for Base Template
3
- *
4
- * Composes theme configuration into complete HTML head content
5
- * including fonts, scripts, and CSS custom properties.
6
- *
7
- * Uses existing theme utilities from @frontmcp/ui/theme module.
8
- */
9
- import { type ThemeConfig } from '../theme';
10
- /**
11
- * Options for rendering theme styles.
12
- */
13
- export interface ThemeStylesOptions {
14
- /** Theme configuration (default: DEFAULT_THEME) */
15
- theme?: ThemeConfig;
16
- /** Include Tailwind CSS (default: true) */
17
- tailwind?: boolean;
18
- /** Include HTMX (default: false) */
19
- htmx?: boolean;
20
- /** Include Alpine.js (default: false) */
21
- alpine?: boolean;
22
- /** Include fonts (default: true) */
23
- fonts?: boolean;
24
- /** Use inline scripts from cache (for blocked network platforms) */
25
- inline?: boolean;
26
- }
27
- /**
28
- * Render complete theme styles for HTML head section.
29
- *
30
- * This function composes all theme-related HTML including:
31
- * 1. Font preconnect links (optional)
32
- * 2. Font stylesheets (optional)
33
- * 3. Tailwind CSS script (with @theme variables)
34
- * 4. Additional framework scripts (HTMX, Alpine.js)
35
- *
36
- * @param options - Theme styles configuration
37
- * @returns HTML string with all style/script tags
38
- *
39
- * @example
40
- * ```typescript
41
- * // Default theme with Tailwind only
42
- * const styles = renderThemeStyles();
43
- *
44
- * // Custom theme with HTMX
45
- * const styles = renderThemeStyles({
46
- * theme: customTheme,
47
- * htmx: true,
48
- * });
49
- *
50
- * // For blocked-network platforms (Claude Artifacts)
51
- * await fetchAndCacheScriptsFromTheme(theme);
52
- * const styles = renderThemeStyles({ inline: true });
53
- * ```
54
- */
55
- export declare function renderThemeStyles(options?: ThemeStylesOptions): string;
56
- /**
57
- * Render minimal theme styles (Tailwind + @theme only).
58
- *
59
- * Use this for lightweight widgets that don't need fonts or additional scripts.
60
- *
61
- * @param theme - Theme configuration (default: DEFAULT_THEME)
62
- * @returns HTML string with Tailwind script and @theme style block
63
- */
64
- export declare function renderMinimalThemeStyles(theme?: ThemeConfig): string;
65
- /**
66
- * Render theme CSS variables only (no scripts).
67
- *
68
- * Use this when Tailwind is already loaded elsewhere.
69
- *
70
- * @param theme - Theme configuration (default: DEFAULT_THEME)
71
- * @returns HTML style block with @theme CSS
72
- */
73
- export declare function renderThemeCssOnly(theme?: ThemeConfig): string;
74
- //# sourceMappingURL=theme-styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme-styles.d.ts","sourceRoot":"","sources":["../../src/base-template/theme-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAML,KAAK,WAAW,EAEjB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAmC1E;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,GAAE,WAA2B,GAAG,MAAM,CASnF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,GAAE,WAA2B,GAAG,MAAM,CAE7E"}
@@ -1,124 +0,0 @@
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
- * Uses dynamic import to avoid loading esbuild at module load time.
50
- *
51
- * @param source - Source code to transpile
52
- * @param options - Transpile options
53
- * @returns Transpile result
54
- * @throws Error if esbuild is not installed and transpilation is attempted
55
- */
56
- protected transpile(source: string, options?: TranspileOptions): Promise<TranspileResult>;
57
- /**
58
- * Render an HTML template.
59
- *
60
- * @param template - HTML template (string or function)
61
- * @param context - Template context with input/output
62
- * @returns Rendered HTML string
63
- */
64
- protected renderHtmlTemplate<In = unknown, Out = unknown>(template: string | TemplateBuilderFn<In, Out>, context: TemplateContext<In, Out>): string;
65
- /**
66
- * Build the <head> section of the HTML document.
67
- *
68
- * @param options - Head options
69
- * @returns HTML head content
70
- */
71
- protected buildHead(options: {
72
- title: string;
73
- includeBridge?: boolean;
74
- includeCdn?: boolean;
75
- includeTheme?: boolean;
76
- customStyles?: string;
77
- }): string;
78
- /**
79
- * Build data injection script.
80
- *
81
- * @param options - Injection options
82
- * @returns Script tag with data injection
83
- */
84
- protected buildDataInjectionScript(options: {
85
- toolName: string;
86
- input?: unknown;
87
- output?: unknown;
88
- usePlaceholders?: boolean;
89
- }): string;
90
- /**
91
- * Wrap content in a complete HTML document.
92
- *
93
- * @param options - Wrap options
94
- * @returns Complete HTML document
95
- */
96
- protected wrapInHtmlDocument(options: {
97
- head: string;
98
- body: string;
99
- bodyClass?: string;
100
- }): string;
101
- /**
102
- * Calculate content hash.
103
- *
104
- * @param content - Content to hash
105
- * @returns Hash string
106
- */
107
- protected calculateHash(content: string): Promise<string>;
108
- /**
109
- * Estimate gzipped size.
110
- *
111
- * @param content - Content to estimate
112
- * @returns Estimated gzipped size in bytes
113
- */
114
- protected estimateGzipSize(content: string): number;
115
- /**
116
- * Create template context.
117
- *
118
- * @param input - Tool input
119
- * @param output - Tool output
120
- * @returns Template context
121
- */
122
- protected createContext<In = unknown, Out = unknown>(input: In, output: Out): TemplateContext<In, Out>;
123
- }
124
- //# sourceMappingURL=base-builder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../../../src/build/builders/base-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,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;;;;;;;;OAQG;cACa,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC;IA8B3B;;;;;;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"}
@@ -1,94 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,93 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,83 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,78 +0,0 @@
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
@@ -1 +0,0 @@
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"}