@frontmcp/ui 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +438 -0
  3. package/package.json +147 -0
  4. package/src/adapters/index.d.ts +10 -0
  5. package/src/adapters/index.js +18 -0
  6. package/src/adapters/index.js.map +1 -0
  7. package/src/adapters/platform-meta.d.ts +165 -0
  8. package/src/adapters/platform-meta.js +310 -0
  9. package/src/adapters/platform-meta.js.map +1 -0
  10. package/src/base-template/bridge.d.ts +89 -0
  11. package/src/base-template/bridge.js +452 -0
  12. package/src/base-template/bridge.js.map +1 -0
  13. package/src/base-template/default-base-template.d.ts +91 -0
  14. package/src/base-template/default-base-template.js +435 -0
  15. package/src/base-template/default-base-template.js.map +1 -0
  16. package/src/base-template/index.d.ts +14 -0
  17. package/src/base-template/index.js +30 -0
  18. package/src/base-template/index.js.map +1 -0
  19. package/src/base-template/polyfills.d.ts +30 -0
  20. package/src/base-template/polyfills.js +190 -0
  21. package/src/base-template/polyfills.js.map +1 -0
  22. package/src/base-template/theme-styles.d.ts +73 -0
  23. package/src/base-template/theme-styles.js +95 -0
  24. package/src/base-template/theme-styles.js.map +1 -0
  25. package/src/bridge/adapters/base-adapter.d.ts +103 -0
  26. package/src/bridge/adapters/base-adapter.js +314 -0
  27. package/src/bridge/adapters/base-adapter.js.map +1 -0
  28. package/src/bridge/adapters/claude.adapter.d.ts +66 -0
  29. package/src/bridge/adapters/claude.adapter.js +145 -0
  30. package/src/bridge/adapters/claude.adapter.js.map +1 -0
  31. package/src/bridge/adapters/ext-apps.adapter.d.ts +142 -0
  32. package/src/bridge/adapters/ext-apps.adapter.js +416 -0
  33. package/src/bridge/adapters/ext-apps.adapter.js.map +1 -0
  34. package/src/bridge/adapters/gemini.adapter.d.ts +63 -0
  35. package/src/bridge/adapters/gemini.adapter.js +160 -0
  36. package/src/bridge/adapters/gemini.adapter.js.map +1 -0
  37. package/src/bridge/adapters/generic.adapter.d.ts +55 -0
  38. package/src/bridge/adapters/generic.adapter.js +108 -0
  39. package/src/bridge/adapters/generic.adapter.js.map +1 -0
  40. package/src/bridge/adapters/index.d.ts +25 -0
  41. package/src/bridge/adapters/index.js +65 -0
  42. package/src/bridge/adapters/index.js.map +1 -0
  43. package/src/bridge/adapters/openai.adapter.d.ts +64 -0
  44. package/src/bridge/adapters/openai.adapter.js +194 -0
  45. package/src/bridge/adapters/openai.adapter.js.map +1 -0
  46. package/src/bridge/core/adapter-registry.d.ts +121 -0
  47. package/src/bridge/core/adapter-registry.js +271 -0
  48. package/src/bridge/core/adapter-registry.js.map +1 -0
  49. package/src/bridge/core/bridge-factory.d.ts +198 -0
  50. package/src/bridge/core/bridge-factory.js +428 -0
  51. package/src/bridge/core/bridge-factory.js.map +1 -0
  52. package/src/bridge/core/index.d.ts +9 -0
  53. package/src/bridge/core/index.js +22 -0
  54. package/src/bridge/core/index.js.map +1 -0
  55. package/src/bridge/index.d.ts +61 -0
  56. package/src/bridge/index.js +94 -0
  57. package/src/bridge/index.js.map +1 -0
  58. package/src/bridge/runtime/iife-generator.d.ts +61 -0
  59. package/src/bridge/runtime/iife-generator.js +940 -0
  60. package/src/bridge/runtime/iife-generator.js.map +1 -0
  61. package/src/bridge/runtime/index.d.ts +8 -0
  62. package/src/bridge/runtime/index.js +16 -0
  63. package/src/bridge/runtime/index.js.map +1 -0
  64. package/src/bridge/types.d.ts +385 -0
  65. package/src/bridge/types.js +11 -0
  66. package/src/bridge/types.js.map +1 -0
  67. package/src/build/cdn-resources.d.ts +140 -0
  68. package/src/build/cdn-resources.js +314 -0
  69. package/src/build/cdn-resources.js.map +1 -0
  70. package/src/build/index.d.ts +294 -0
  71. package/src/build/index.js +325 -0
  72. package/src/build/index.js.map +1 -0
  73. package/src/build/widget-manifest.d.ts +212 -0
  74. package/src/build/widget-manifest.js +652 -0
  75. package/src/build/widget-manifest.js.map +1 -0
  76. package/src/bundler/bundler.d.ts +110 -0
  77. package/src/bundler/bundler.js +432 -0
  78. package/src/bundler/bundler.js.map +1 -0
  79. package/src/bundler/cache.d.ts +172 -0
  80. package/src/bundler/cache.js +250 -0
  81. package/src/bundler/cache.js.map +1 -0
  82. package/src/bundler/index.d.ts +41 -0
  83. package/src/bundler/index.js +73 -0
  84. package/src/bundler/index.js.map +1 -0
  85. package/src/bundler/sandbox/enclave-adapter.d.ts +120 -0
  86. package/src/bundler/sandbox/enclave-adapter.js +339 -0
  87. package/src/bundler/sandbox/enclave-adapter.js.map +1 -0
  88. package/src/bundler/sandbox/executor.d.ts +13 -0
  89. package/src/bundler/sandbox/executor.js +22 -0
  90. package/src/bundler/sandbox/executor.js.map +1 -0
  91. package/src/bundler/sandbox/policy.d.ts +61 -0
  92. package/src/bundler/sandbox/policy.js +238 -0
  93. package/src/bundler/sandbox/policy.js.map +1 -0
  94. package/src/bundler/types.d.ts +347 -0
  95. package/src/bundler/types.js +132 -0
  96. package/src/bundler/types.js.map +1 -0
  97. package/src/components/alert.d.ts +71 -0
  98. package/src/components/alert.js +189 -0
  99. package/src/components/alert.js.map +1 -0
  100. package/src/components/alert.schema.d.ts +114 -0
  101. package/src/components/alert.schema.js +105 -0
  102. package/src/components/alert.schema.js.map +1 -0
  103. package/src/components/avatar.d.ts +76 -0
  104. package/src/components/avatar.js +176 -0
  105. package/src/components/avatar.js.map +1 -0
  106. package/src/components/avatar.schema.d.ts +169 -0
  107. package/src/components/avatar.schema.js +103 -0
  108. package/src/components/avatar.schema.js.map +1 -0
  109. package/src/components/badge.d.ts +70 -0
  110. package/src/components/badge.js +149 -0
  111. package/src/components/badge.js.map +1 -0
  112. package/src/components/badge.schema.d.ts +109 -0
  113. package/src/components/badge.schema.js +96 -0
  114. package/src/components/badge.schema.js.map +1 -0
  115. package/src/components/button.d.ts +111 -0
  116. package/src/components/button.js +336 -0
  117. package/src/components/button.js.map +1 -0
  118. package/src/components/button.schema.d.ts +148 -0
  119. package/src/components/button.schema.js +121 -0
  120. package/src/components/button.schema.js.map +1 -0
  121. package/src/components/card.d.ts +60 -0
  122. package/src/components/card.js +117 -0
  123. package/src/components/card.js.map +1 -0
  124. package/src/components/card.schema.d.ts +113 -0
  125. package/src/components/card.schema.js +98 -0
  126. package/src/components/card.schema.js.map +1 -0
  127. package/src/components/form.d.ts +239 -0
  128. package/src/components/form.js +420 -0
  129. package/src/components/form.js.map +1 -0
  130. package/src/components/form.schema.d.ts +441 -0
  131. package/src/components/form.schema.js +406 -0
  132. package/src/components/form.schema.js.map +1 -0
  133. package/src/components/index.d.ts +29 -0
  134. package/src/components/index.js +98 -0
  135. package/src/components/index.js.map +1 -0
  136. package/src/components/list.d.ts +127 -0
  137. package/src/components/list.js +279 -0
  138. package/src/components/list.js.map +1 -0
  139. package/src/components/list.schema.d.ts +134 -0
  140. package/src/components/list.schema.js +168 -0
  141. package/src/components/list.schema.js.map +1 -0
  142. package/src/components/modal.d.ts +111 -0
  143. package/src/components/modal.js +260 -0
  144. package/src/components/modal.js.map +1 -0
  145. package/src/components/modal.schema.d.ts +186 -0
  146. package/src/components/modal.schema.js +167 -0
  147. package/src/components/modal.schema.js.map +1 -0
  148. package/src/components/table.d.ts +105 -0
  149. package/src/components/table.js +283 -0
  150. package/src/components/table.js.map +1 -0
  151. package/src/components/table.schema.d.ts +159 -0
  152. package/src/components/table.schema.js +173 -0
  153. package/src/components/table.schema.js.map +1 -0
  154. package/src/handlebars/helpers.d.ts +348 -0
  155. package/src/handlebars/helpers.js +605 -0
  156. package/src/handlebars/helpers.js.map +1 -0
  157. package/src/handlebars/index.d.ts +193 -0
  158. package/src/handlebars/index.js +350 -0
  159. package/src/handlebars/index.js.map +1 -0
  160. package/src/index.d.ts +50 -0
  161. package/src/index.js +192 -0
  162. package/src/index.js.map +1 -0
  163. package/src/layouts/base.d.ts +88 -0
  164. package/src/layouts/base.js +227 -0
  165. package/src/layouts/base.js.map +1 -0
  166. package/src/layouts/index.d.ts +7 -0
  167. package/src/layouts/index.js +25 -0
  168. package/src/layouts/index.js.map +1 -0
  169. package/src/layouts/presets.d.ts +133 -0
  170. package/src/layouts/presets.js +277 -0
  171. package/src/layouts/presets.js.map +1 -0
  172. package/src/pages/consent.d.ts +116 -0
  173. package/src/pages/consent.js +218 -0
  174. package/src/pages/consent.js.map +1 -0
  175. package/src/pages/error.d.ts +100 -0
  176. package/src/pages/error.js +263 -0
  177. package/src/pages/error.js.map +1 -0
  178. package/src/pages/index.d.ts +8 -0
  179. package/src/pages/index.js +27 -0
  180. package/src/pages/index.js.map +1 -0
  181. package/src/react/Alert.d.ts +101 -0
  182. package/src/react/Alert.js +51 -0
  183. package/src/react/Alert.js.map +1 -0
  184. package/src/react/Badge.d.ts +100 -0
  185. package/src/react/Badge.js +55 -0
  186. package/src/react/Badge.js.map +1 -0
  187. package/src/react/Button.d.ts +108 -0
  188. package/src/react/Button.js +52 -0
  189. package/src/react/Button.js.map +1 -0
  190. package/src/react/Card.d.ts +103 -0
  191. package/src/react/Card.js +55 -0
  192. package/src/react/Card.js.map +1 -0
  193. package/src/react/hooks/context.d.ts +178 -0
  194. package/src/react/hooks/context.js +287 -0
  195. package/src/react/hooks/context.js.map +1 -0
  196. package/src/react/hooks/index.d.ts +41 -0
  197. package/src/react/hooks/index.js +61 -0
  198. package/src/react/hooks/index.js.map +1 -0
  199. package/src/react/hooks/tools.d.ts +283 -0
  200. package/src/react/hooks/tools.js +465 -0
  201. package/src/react/hooks/tools.js.map +1 -0
  202. package/src/react/index.d.ts +80 -0
  203. package/src/react/index.js +113 -0
  204. package/src/react/index.js.map +1 -0
  205. package/src/react/types.d.ts +105 -0
  206. package/src/react/types.js +12 -0
  207. package/src/react/types.js.map +1 -0
  208. package/src/react/utils.d.ts +42 -0
  209. package/src/react/utils.js +99 -0
  210. package/src/react/utils.js.map +1 -0
  211. package/src/registry/index.d.ts +45 -0
  212. package/src/registry/index.js +67 -0
  213. package/src/registry/index.js.map +1 -0
  214. package/src/registry/render-template.d.ts +86 -0
  215. package/src/registry/render-template.js +239 -0
  216. package/src/registry/render-template.js.map +1 -0
  217. package/src/registry/tool-ui.registry.d.ts +260 -0
  218. package/src/registry/tool-ui.registry.js +438 -0
  219. package/src/registry/tool-ui.registry.js.map +1 -0
  220. package/src/registry/uri-utils.d.ts +55 -0
  221. package/src/registry/uri-utils.js +97 -0
  222. package/src/registry/uri-utils.js.map +1 -0
  223. package/src/render/index.d.ts +7 -0
  224. package/src/render/index.js +14 -0
  225. package/src/render/index.js.map +1 -0
  226. package/src/render/prerender.d.ts +56 -0
  227. package/src/render/prerender.js +98 -0
  228. package/src/render/prerender.js.map +1 -0
  229. package/src/renderers/cache.d.ts +144 -0
  230. package/src/renderers/cache.js +240 -0
  231. package/src/renderers/cache.js.map +1 -0
  232. package/src/renderers/html.renderer.d.ts +122 -0
  233. package/src/renderers/html.renderer.js +204 -0
  234. package/src/renderers/html.renderer.js.map +1 -0
  235. package/src/renderers/index.d.ts +35 -0
  236. package/src/renderers/index.js +70 -0
  237. package/src/renderers/index.js.map +1 -0
  238. package/src/renderers/mdx.renderer.d.ts +119 -0
  239. package/src/renderers/mdx.renderer.js +305 -0
  240. package/src/renderers/mdx.renderer.js.map +1 -0
  241. package/src/renderers/react.renderer.d.ts +95 -0
  242. package/src/renderers/react.renderer.js +260 -0
  243. package/src/renderers/react.renderer.js.map +1 -0
  244. package/src/renderers/registry.d.ts +133 -0
  245. package/src/renderers/registry.js +232 -0
  246. package/src/renderers/registry.js.map +1 -0
  247. package/src/renderers/types.d.ts +341 -0
  248. package/src/renderers/types.js +9 -0
  249. package/src/renderers/types.js.map +1 -0
  250. package/src/renderers/utils/detect.d.ts +106 -0
  251. package/src/renderers/utils/detect.js +267 -0
  252. package/src/renderers/utils/detect.js.map +1 -0
  253. package/src/renderers/utils/hash.d.ts +39 -0
  254. package/src/renderers/utils/hash.js +75 -0
  255. package/src/renderers/utils/hash.js.map +1 -0
  256. package/src/renderers/utils/index.d.ts +8 -0
  257. package/src/renderers/utils/index.js +28 -0
  258. package/src/renderers/utils/index.js.map +1 -0
  259. package/src/renderers/utils/transpiler.d.ts +88 -0
  260. package/src/renderers/utils/transpiler.js +215 -0
  261. package/src/renderers/utils/transpiler.js.map +1 -0
  262. package/src/runtime/adapters/html.adapter.d.ts +58 -0
  263. package/src/runtime/adapters/html.adapter.js +131 -0
  264. package/src/runtime/adapters/html.adapter.js.map +1 -0
  265. package/src/runtime/adapters/index.d.ts +25 -0
  266. package/src/runtime/adapters/index.js +54 -0
  267. package/src/runtime/adapters/index.js.map +1 -0
  268. package/src/runtime/adapters/mdx.adapter.d.ts +72 -0
  269. package/src/runtime/adapters/mdx.adapter.js +241 -0
  270. package/src/runtime/adapters/mdx.adapter.js.map +1 -0
  271. package/src/runtime/adapters/react.adapter.d.ts +69 -0
  272. package/src/runtime/adapters/react.adapter.js +245 -0
  273. package/src/runtime/adapters/react.adapter.js.map +1 -0
  274. package/src/runtime/adapters/types.d.ts +94 -0
  275. package/src/runtime/adapters/types.js +11 -0
  276. package/src/runtime/adapters/types.js.map +1 -0
  277. package/src/runtime/csp.d.ts +37 -0
  278. package/src/runtime/csp.js +140 -0
  279. package/src/runtime/csp.js.map +1 -0
  280. package/src/runtime/index.d.ts +16 -0
  281. package/src/runtime/index.js +72 -0
  282. package/src/runtime/index.js.map +1 -0
  283. package/src/runtime/mcp-bridge.d.ts +100 -0
  284. package/src/runtime/mcp-bridge.js +581 -0
  285. package/src/runtime/mcp-bridge.js.map +1 -0
  286. package/src/runtime/renderer-runtime.d.ts +132 -0
  287. package/src/runtime/renderer-runtime.js +389 -0
  288. package/src/runtime/renderer-runtime.js.map +1 -0
  289. package/src/runtime/sanitizer.d.ts +171 -0
  290. package/src/runtime/sanitizer.js +318 -0
  291. package/src/runtime/sanitizer.js.map +1 -0
  292. package/src/runtime/types.d.ts +414 -0
  293. package/src/runtime/types.js +12 -0
  294. package/src/runtime/types.js.map +1 -0
  295. package/src/runtime/wrapper.d.ts +375 -0
  296. package/src/runtime/wrapper.js +1793 -0
  297. package/src/runtime/wrapper.js.map +1 -0
  298. package/src/styles/index.d.ts +7 -0
  299. package/src/styles/index.js +11 -0
  300. package/src/styles/index.js.map +1 -0
  301. package/src/styles/variants.d.ts +50 -0
  302. package/src/styles/variants.js +175 -0
  303. package/src/styles/variants.js.map +1 -0
  304. package/src/theme/cdn.d.ts +194 -0
  305. package/src/theme/cdn.js +375 -0
  306. package/src/theme/cdn.js.map +1 -0
  307. package/src/theme/index.d.ts +17 -0
  308. package/src/theme/index.js +57 -0
  309. package/src/theme/index.js.map +1 -0
  310. package/src/theme/platforms.d.ts +106 -0
  311. package/src/theme/platforms.js +161 -0
  312. package/src/theme/platforms.js.map +1 -0
  313. package/src/theme/presets/github-openai.d.ts +49 -0
  314. package/src/theme/presets/github-openai.js +189 -0
  315. package/src/theme/presets/github-openai.js.map +1 -0
  316. package/src/theme/presets/index.d.ts +10 -0
  317. package/src/theme/presets/index.js +17 -0
  318. package/src/theme/presets/index.js.map +1 -0
  319. package/src/theme/theme.d.ts +395 -0
  320. package/src/theme/theme.js +332 -0
  321. package/src/theme/theme.js.map +1 -0
  322. package/src/tool-template/builder.d.ts +212 -0
  323. package/src/tool-template/builder.js +397 -0
  324. package/src/tool-template/builder.js.map +1 -0
  325. package/src/tool-template/index.d.ts +15 -0
  326. package/src/tool-template/index.js +38 -0
  327. package/src/tool-template/index.js.map +1 -0
  328. package/src/types/index.d.ts +13 -0
  329. package/src/types/index.js +26 -0
  330. package/src/types/index.js.map +1 -0
  331. package/src/types/ui-config.d.ts +357 -0
  332. package/src/types/ui-config.js +12 -0
  333. package/src/types/ui-config.js.map +1 -0
  334. package/src/types/ui-runtime.d.ts +965 -0
  335. package/src/types/ui-runtime.js +117 -0
  336. package/src/types/ui-runtime.js.map +1 -0
  337. package/src/validation/error-box.d.ts +55 -0
  338. package/src/validation/error-box.js +75 -0
  339. package/src/validation/error-box.js.map +1 -0
  340. package/src/validation/index.d.ts +12 -0
  341. package/src/validation/index.js +21 -0
  342. package/src/validation/index.js.map +1 -0
  343. package/src/validation/wrapper.d.ts +96 -0
  344. package/src/validation/wrapper.js +117 -0
  345. package/src/validation/wrapper.js.map +1 -0
  346. package/src/web-components/core/attribute-parser.d.ts +85 -0
  347. package/src/web-components/core/attribute-parser.js +189 -0
  348. package/src/web-components/core/attribute-parser.js.map +1 -0
  349. package/src/web-components/core/base-element.d.ts +197 -0
  350. package/src/web-components/core/base-element.js +289 -0
  351. package/src/web-components/core/base-element.js.map +1 -0
  352. package/src/web-components/core/index.d.ts +8 -0
  353. package/src/web-components/core/index.js +18 -0
  354. package/src/web-components/core/index.js.map +1 -0
  355. package/src/web-components/elements/fmcp-alert.d.ts +45 -0
  356. package/src/web-components/elements/fmcp-alert.js +93 -0
  357. package/src/web-components/elements/fmcp-alert.js.map +1 -0
  358. package/src/web-components/elements/fmcp-badge.d.ts +46 -0
  359. package/src/web-components/elements/fmcp-badge.js +99 -0
  360. package/src/web-components/elements/fmcp-badge.js.map +1 -0
  361. package/src/web-components/elements/fmcp-button.d.ts +124 -0
  362. package/src/web-components/elements/fmcp-button.js +233 -0
  363. package/src/web-components/elements/fmcp-button.js.map +1 -0
  364. package/src/web-components/elements/fmcp-card.d.ts +52 -0
  365. package/src/web-components/elements/fmcp-card.js +115 -0
  366. package/src/web-components/elements/fmcp-card.js.map +1 -0
  367. package/src/web-components/elements/fmcp-input.d.ts +95 -0
  368. package/src/web-components/elements/fmcp-input.js +248 -0
  369. package/src/web-components/elements/fmcp-input.js.map +1 -0
  370. package/src/web-components/elements/fmcp-select.d.ts +99 -0
  371. package/src/web-components/elements/fmcp-select.js +243 -0
  372. package/src/web-components/elements/fmcp-select.js.map +1 -0
  373. package/src/web-components/elements/index.d.ts +12 -0
  374. package/src/web-components/elements/index.js +34 -0
  375. package/src/web-components/elements/index.js.map +1 -0
  376. package/src/web-components/index.d.ts +49 -0
  377. package/src/web-components/index.js +75 -0
  378. package/src/web-components/index.js.map +1 -0
  379. package/src/web-components/register.d.ts +56 -0
  380. package/src/web-components/register.js +80 -0
  381. package/src/web-components/register.js.map +1 -0
  382. package/src/web-components/types.d.ts +121 -0
  383. package/src/web-components/types.js +25 -0
  384. package/src/web-components/types.js.map +1 -0
  385. package/src/widgets/index.d.ts +7 -0
  386. package/src/widgets/index.js +24 -0
  387. package/src/widgets/index.js.map +1 -0
  388. package/src/widgets/progress.d.ts +132 -0
  389. package/src/widgets/progress.js +303 -0
  390. package/src/widgets/progress.js.map +1 -0
  391. package/src/widgets/resource.d.ts +162 -0
  392. package/src/widgets/resource.js +340 -0
  393. package/src/widgets/resource.js.map +1 -0
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Handlebars Renderer Module
3
+ *
4
+ * Provides Handlebars template rendering for HTML templates.
5
+ * Enhances plain HTML with {{variable}} syntax support.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { HandlebarsRenderer, createHandlebarsRenderer } from '@frontmcp/ui/handlebars';
10
+ *
11
+ * const renderer = createHandlebarsRenderer();
12
+ *
13
+ * const template = `
14
+ * <div class="card">
15
+ * <h2>{{escapeHtml output.title}}</h2>
16
+ * <p>Created: {{formatDate output.createdAt}}</p>
17
+ * {{#if output.items.length}}
18
+ * <ul>
19
+ * {{#each output.items}}
20
+ * <li>{{this.name}} - {{formatCurrency this.price}}</li>
21
+ * {{/each}}
22
+ * </ul>
23
+ * {{/if}}
24
+ * </div>
25
+ * `;
26
+ *
27
+ * const html = renderer.render(template, {
28
+ * input: { query: 'test' },
29
+ * output: {
30
+ * title: 'Results',
31
+ * createdAt: new Date(),
32
+ * items: [{ name: 'Item 1', price: 9.99 }]
33
+ * }
34
+ * });
35
+ * ```
36
+ *
37
+ * @packageDocumentation
38
+ */
39
+ import type { TemplateHelpers } from '../types';
40
+ import { type HelperFunction } from './helpers';
41
+ /**
42
+ * Check if Handlebars is available.
43
+ */
44
+ export declare function isHandlebarsAvailable(): Promise<boolean>;
45
+ /**
46
+ * Options for the Handlebars renderer.
47
+ */
48
+ export interface HandlebarsRendererOptions {
49
+ /**
50
+ * Additional custom helpers to register.
51
+ */
52
+ helpers?: Record<string, HelperFunction>;
53
+ /**
54
+ * Partial templates to register.
55
+ */
56
+ partials?: Record<string, string>;
57
+ /**
58
+ * Strict mode - error on missing variables.
59
+ * @default false
60
+ */
61
+ strict?: boolean;
62
+ /**
63
+ * Whether to auto-escape output.
64
+ * @default true
65
+ */
66
+ autoEscape?: boolean;
67
+ }
68
+ /**
69
+ * Render context for templates.
70
+ */
71
+ export interface RenderContext {
72
+ /**
73
+ * Tool input arguments.
74
+ */
75
+ input: Record<string, unknown>;
76
+ /**
77
+ * Tool output/result.
78
+ */
79
+ output: unknown;
80
+ /**
81
+ * Structured content (if schema provided).
82
+ */
83
+ structuredContent?: unknown;
84
+ /**
85
+ * Template helper functions.
86
+ */
87
+ helpers?: TemplateHelpers;
88
+ }
89
+ /**
90
+ * Handlebars template renderer.
91
+ *
92
+ * Provides safe, cacheable Handlebars rendering with built-in helpers
93
+ * for formatting, escaping, and logic.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const renderer = new HandlebarsRenderer();
98
+ *
99
+ * // Simple render
100
+ * const html = await renderer.render('<div>{{output.name}}</div>', { output: { name: 'Test' } });
101
+ *
102
+ * // With custom helpers
103
+ * renderer.registerHelper('shout', (str) => String(str).toUpperCase() + '!');
104
+ * const html2 = await renderer.render('<div>{{shout output.name}}</div>', { output: { name: 'hello' } });
105
+ * ```
106
+ */
107
+ export declare class HandlebarsRenderer {
108
+ private readonly options;
109
+ private compiledTemplates;
110
+ private initialized;
111
+ private hbs;
112
+ constructor(options?: HandlebarsRendererOptions);
113
+ /**
114
+ * Initialize the renderer with Handlebars.
115
+ */
116
+ private init;
117
+ /**
118
+ * Render a Handlebars template.
119
+ *
120
+ * @param template - Template string
121
+ * @param context - Render context with input/output
122
+ * @returns Rendered HTML string
123
+ */
124
+ render(template: string, context: RenderContext): Promise<string>;
125
+ /**
126
+ * Render a template synchronously.
127
+ *
128
+ * Note: Requires Handlebars to be pre-loaded. Use `render()` for async loading.
129
+ *
130
+ * @param template - Template string
131
+ * @param context - Render context
132
+ * @returns Rendered HTML string
133
+ */
134
+ renderSync(template: string, context: RenderContext): string;
135
+ /**
136
+ * Initialize synchronously (for environments where Handlebars is already loaded).
137
+ */
138
+ initSync(handlebars: typeof import('handlebars')): void;
139
+ /**
140
+ * Register a custom helper.
141
+ *
142
+ * @param name - Helper name
143
+ * @param fn - Helper function
144
+ */
145
+ registerHelper(name: string, fn: HelperFunction): void;
146
+ /**
147
+ * Register a partial template.
148
+ *
149
+ * @param name - Partial name
150
+ * @param template - Partial template string
151
+ */
152
+ registerPartial(name: string, template: string): void;
153
+ /**
154
+ * Clear compiled template cache.
155
+ */
156
+ clearCache(): void;
157
+ /**
158
+ * Check if a template string contains Handlebars syntax.
159
+ *
160
+ * @param template - Template string to check
161
+ * @returns true if contains {{...}} syntax
162
+ */
163
+ static containsHandlebars(template: string): boolean;
164
+ /**
165
+ * Check if the renderer is initialized.
166
+ */
167
+ get isInitialized(): boolean;
168
+ }
169
+ /**
170
+ * Create a new Handlebars renderer.
171
+ *
172
+ * @param options - Renderer options
173
+ * @returns New HandlebarsRenderer instance
174
+ */
175
+ export declare function createHandlebarsRenderer(options?: HandlebarsRendererOptions): HandlebarsRenderer;
176
+ /**
177
+ * Render a template with default settings.
178
+ *
179
+ * Convenience function for one-off rendering.
180
+ *
181
+ * @param template - Template string
182
+ * @param context - Render context
183
+ * @returns Rendered HTML
184
+ */
185
+ export declare function renderTemplate(template: string, context: RenderContext): Promise<string>;
186
+ /**
187
+ * Check if a template contains Handlebars syntax.
188
+ *
189
+ * @param template - Template string
190
+ * @returns true if contains {{...}}
191
+ */
192
+ export declare function containsHandlebars(template: string): boolean;
193
+ export { builtinHelpers, escapeHtml, formatDate, formatCurrency, formatNumber, json, jsonEmbed, eq, ne, gt, gte, lt, lte, and, or, not, first, last, length, includes, join, uppercase, lowercase, capitalize, truncate, defaultValue, uniqueId, classNames, resetUniqueIdCounter, type HelperFunction, } from './helpers';
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ /**
3
+ * Handlebars Renderer Module
4
+ *
5
+ * Provides Handlebars template rendering for HTML templates.
6
+ * Enhances plain HTML with {{variable}} syntax support.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { HandlebarsRenderer, createHandlebarsRenderer } from '@frontmcp/ui/handlebars';
11
+ *
12
+ * const renderer = createHandlebarsRenderer();
13
+ *
14
+ * const template = `
15
+ * <div class="card">
16
+ * <h2>{{escapeHtml output.title}}</h2>
17
+ * <p>Created: {{formatDate output.createdAt}}</p>
18
+ * {{#if output.items.length}}
19
+ * <ul>
20
+ * {{#each output.items}}
21
+ * <li>{{this.name}} - {{formatCurrency this.price}}</li>
22
+ * {{/each}}
23
+ * </ul>
24
+ * {{/if}}
25
+ * </div>
26
+ * `;
27
+ *
28
+ * const html = renderer.render(template, {
29
+ * input: { query: 'test' },
30
+ * output: {
31
+ * title: 'Results',
32
+ * createdAt: new Date(),
33
+ * items: [{ name: 'Item 1', price: 9.99 }]
34
+ * }
35
+ * });
36
+ * ```
37
+ *
38
+ * @packageDocumentation
39
+ */
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.resetUniqueIdCounter = exports.classNames = exports.uniqueId = exports.defaultValue = exports.truncate = exports.capitalize = exports.lowercase = exports.uppercase = exports.join = exports.includes = exports.length = exports.last = exports.first = exports.not = exports.or = exports.and = exports.lte = exports.lt = exports.gte = exports.gt = exports.ne = exports.eq = exports.jsonEmbed = exports.json = exports.formatNumber = exports.formatCurrency = exports.formatDate = exports.escapeHtml = exports.builtinHelpers = exports.HandlebarsRenderer = void 0;
42
+ exports.isHandlebarsAvailable = isHandlebarsAvailable;
43
+ exports.createHandlebarsRenderer = createHandlebarsRenderer;
44
+ exports.renderTemplate = renderTemplate;
45
+ exports.containsHandlebars = containsHandlebars;
46
+ const helpers_1 = require("./helpers");
47
+ /**
48
+ * Lazy-loaded Handlebars module.
49
+ */
50
+ let Handlebars = null;
51
+ /**
52
+ * Load Handlebars module.
53
+ */
54
+ async function loadHandlebars() {
55
+ if (Handlebars !== null) {
56
+ return Handlebars;
57
+ }
58
+ try {
59
+ Handlebars = await import('handlebars');
60
+ return Handlebars;
61
+ }
62
+ catch {
63
+ throw new Error('Handlebars is required for template rendering. Install it: npm install handlebars');
64
+ }
65
+ }
66
+ /**
67
+ * Check if Handlebars is available.
68
+ */
69
+ async function isHandlebarsAvailable() {
70
+ try {
71
+ await loadHandlebars();
72
+ return true;
73
+ }
74
+ catch {
75
+ return false;
76
+ }
77
+ }
78
+ /**
79
+ * Handlebars template renderer.
80
+ *
81
+ * Provides safe, cacheable Handlebars rendering with built-in helpers
82
+ * for formatting, escaping, and logic.
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const renderer = new HandlebarsRenderer();
87
+ *
88
+ * // Simple render
89
+ * const html = await renderer.render('<div>{{output.name}}</div>', { output: { name: 'Test' } });
90
+ *
91
+ * // With custom helpers
92
+ * renderer.registerHelper('shout', (str) => String(str).toUpperCase() + '!');
93
+ * const html2 = await renderer.render('<div>{{shout output.name}}</div>', { output: { name: 'hello' } });
94
+ * ```
95
+ */
96
+ class HandlebarsRenderer {
97
+ options;
98
+ compiledTemplates = new Map();
99
+ initialized = false;
100
+ hbs = null;
101
+ constructor(options = {}) {
102
+ this.options = {
103
+ strict: false,
104
+ autoEscape: true,
105
+ ...options,
106
+ };
107
+ }
108
+ /**
109
+ * Initialize the renderer with Handlebars.
110
+ */
111
+ async init() {
112
+ if (this.initialized)
113
+ return;
114
+ this.hbs = await loadHandlebars();
115
+ // Register built-in helpers
116
+ for (const [name, helper] of Object.entries(helpers_1.builtinHelpers)) {
117
+ this.hbs.registerHelper(name, helper);
118
+ }
119
+ // Register custom helpers
120
+ if (this.options.helpers) {
121
+ for (const [name, helper] of Object.entries(this.options.helpers)) {
122
+ this.hbs.registerHelper(name, helper);
123
+ }
124
+ }
125
+ // Register partials
126
+ if (this.options.partials) {
127
+ for (const [name, template] of Object.entries(this.options.partials)) {
128
+ this.hbs.registerPartial(name, template);
129
+ }
130
+ }
131
+ this.initialized = true;
132
+ }
133
+ /**
134
+ * Render a Handlebars template.
135
+ *
136
+ * @param template - Template string
137
+ * @param context - Render context with input/output
138
+ * @returns Rendered HTML string
139
+ */
140
+ async render(template, context) {
141
+ await this.init();
142
+ if (!this.hbs) {
143
+ throw new Error('Handlebars not initialized');
144
+ }
145
+ // Get or compile template
146
+ let compiled = this.compiledTemplates.get(template);
147
+ if (!compiled) {
148
+ compiled = this.hbs.compile(template, {
149
+ strict: this.options.strict,
150
+ noEscape: !this.options.autoEscape,
151
+ });
152
+ this.compiledTemplates.set(template, compiled);
153
+ }
154
+ // Build template data
155
+ const data = {
156
+ input: context.input ?? {},
157
+ output: context.output ?? {},
158
+ structuredContent: context.structuredContent,
159
+ // Also expose at root level for convenience
160
+ ...context.input,
161
+ ...(typeof context.output === 'object' && context.output !== null
162
+ ? context.output
163
+ : {}),
164
+ };
165
+ // Render template
166
+ try {
167
+ return compiled(data);
168
+ }
169
+ catch (error) {
170
+ throw new Error(`Template rendering failed: ${error instanceof Error ? error.message : String(error)}`);
171
+ }
172
+ }
173
+ /**
174
+ * Render a template synchronously.
175
+ *
176
+ * Note: Requires Handlebars to be pre-loaded. Use `render()` for async loading.
177
+ *
178
+ * @param template - Template string
179
+ * @param context - Render context
180
+ * @returns Rendered HTML string
181
+ */
182
+ renderSync(template, context) {
183
+ if (!this.initialized || !this.hbs) {
184
+ throw new Error('HandlebarsRenderer not initialized. Call render() first or use initSync().');
185
+ }
186
+ // Get or compile template
187
+ let compiled = this.compiledTemplates.get(template);
188
+ if (!compiled) {
189
+ compiled = this.hbs.compile(template, {
190
+ strict: this.options.strict,
191
+ noEscape: !this.options.autoEscape,
192
+ });
193
+ this.compiledTemplates.set(template, compiled);
194
+ }
195
+ // Build template data
196
+ const data = {
197
+ input: context.input ?? {},
198
+ output: context.output ?? {},
199
+ structuredContent: context.structuredContent,
200
+ ...context.input,
201
+ ...(typeof context.output === 'object' && context.output !== null
202
+ ? context.output
203
+ : {}),
204
+ };
205
+ return compiled(data);
206
+ }
207
+ /**
208
+ * Initialize synchronously (for environments where Handlebars is already loaded).
209
+ */
210
+ initSync(handlebars) {
211
+ this.hbs = handlebars;
212
+ // Register built-in helpers
213
+ for (const [name, helper] of Object.entries(helpers_1.builtinHelpers)) {
214
+ this.hbs.registerHelper(name, helper);
215
+ }
216
+ // Register custom helpers
217
+ if (this.options.helpers) {
218
+ for (const [name, helper] of Object.entries(this.options.helpers)) {
219
+ this.hbs.registerHelper(name, helper);
220
+ }
221
+ }
222
+ // Register partials
223
+ if (this.options.partials) {
224
+ for (const [name, template] of Object.entries(this.options.partials)) {
225
+ this.hbs.registerPartial(name, template);
226
+ }
227
+ }
228
+ this.initialized = true;
229
+ }
230
+ /**
231
+ * Register a custom helper.
232
+ *
233
+ * @param name - Helper name
234
+ * @param fn - Helper function
235
+ */
236
+ registerHelper(name, fn) {
237
+ if (this.hbs) {
238
+ this.hbs.registerHelper(name, fn);
239
+ }
240
+ // Also store for future use
241
+ if (!this.options.helpers) {
242
+ this.options.helpers = {};
243
+ }
244
+ this.options.helpers[name] = fn;
245
+ }
246
+ /**
247
+ * Register a partial template.
248
+ *
249
+ * @param name - Partial name
250
+ * @param template - Partial template string
251
+ */
252
+ registerPartial(name, template) {
253
+ if (this.hbs) {
254
+ this.hbs.registerPartial(name, template);
255
+ }
256
+ // Also store for future use
257
+ if (!this.options.partials) {
258
+ this.options.partials = {};
259
+ }
260
+ this.options.partials[name] = template;
261
+ }
262
+ /**
263
+ * Clear compiled template cache.
264
+ */
265
+ clearCache() {
266
+ this.compiledTemplates.clear();
267
+ }
268
+ /**
269
+ * Check if a template string contains Handlebars syntax.
270
+ *
271
+ * @param template - Template string to check
272
+ * @returns true if contains {{...}} syntax
273
+ */
274
+ static containsHandlebars(template) {
275
+ // Match {{...}} but not {{! comments }}
276
+ return /\{\{(?!!)[\s\S]*?\}\}/.test(template);
277
+ }
278
+ /**
279
+ * Check if the renderer is initialized.
280
+ */
281
+ get isInitialized() {
282
+ return this.initialized;
283
+ }
284
+ }
285
+ exports.HandlebarsRenderer = HandlebarsRenderer;
286
+ /**
287
+ * Create a new Handlebars renderer.
288
+ *
289
+ * @param options - Renderer options
290
+ * @returns New HandlebarsRenderer instance
291
+ */
292
+ function createHandlebarsRenderer(options) {
293
+ return new HandlebarsRenderer(options);
294
+ }
295
+ /**
296
+ * Render a template with default settings.
297
+ *
298
+ * Convenience function for one-off rendering.
299
+ *
300
+ * @param template - Template string
301
+ * @param context - Render context
302
+ * @returns Rendered HTML
303
+ */
304
+ async function renderTemplate(template, context) {
305
+ const renderer = createHandlebarsRenderer();
306
+ return renderer.render(template, context);
307
+ }
308
+ /**
309
+ * Check if a template contains Handlebars syntax.
310
+ *
311
+ * @param template - Template string
312
+ * @returns true if contains {{...}}
313
+ */
314
+ function containsHandlebars(template) {
315
+ return HandlebarsRenderer.containsHandlebars(template);
316
+ }
317
+ // ============================================
318
+ // Re-exports
319
+ // ============================================
320
+ var helpers_2 = require("./helpers");
321
+ Object.defineProperty(exports, "builtinHelpers", { enumerable: true, get: function () { return helpers_2.builtinHelpers; } });
322
+ Object.defineProperty(exports, "escapeHtml", { enumerable: true, get: function () { return helpers_2.escapeHtml; } });
323
+ Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return helpers_2.formatDate; } });
324
+ Object.defineProperty(exports, "formatCurrency", { enumerable: true, get: function () { return helpers_2.formatCurrency; } });
325
+ Object.defineProperty(exports, "formatNumber", { enumerable: true, get: function () { return helpers_2.formatNumber; } });
326
+ Object.defineProperty(exports, "json", { enumerable: true, get: function () { return helpers_2.json; } });
327
+ Object.defineProperty(exports, "jsonEmbed", { enumerable: true, get: function () { return helpers_2.jsonEmbed; } });
328
+ Object.defineProperty(exports, "eq", { enumerable: true, get: function () { return helpers_2.eq; } });
329
+ Object.defineProperty(exports, "ne", { enumerable: true, get: function () { return helpers_2.ne; } });
330
+ Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return helpers_2.gt; } });
331
+ Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return helpers_2.gte; } });
332
+ Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return helpers_2.lt; } });
333
+ Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return helpers_2.lte; } });
334
+ Object.defineProperty(exports, "and", { enumerable: true, get: function () { return helpers_2.and; } });
335
+ Object.defineProperty(exports, "or", { enumerable: true, get: function () { return helpers_2.or; } });
336
+ Object.defineProperty(exports, "not", { enumerable: true, get: function () { return helpers_2.not; } });
337
+ Object.defineProperty(exports, "first", { enumerable: true, get: function () { return helpers_2.first; } });
338
+ Object.defineProperty(exports, "last", { enumerable: true, get: function () { return helpers_2.last; } });
339
+ Object.defineProperty(exports, "length", { enumerable: true, get: function () { return helpers_2.length; } });
340
+ Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return helpers_2.includes; } });
341
+ Object.defineProperty(exports, "join", { enumerable: true, get: function () { return helpers_2.join; } });
342
+ Object.defineProperty(exports, "uppercase", { enumerable: true, get: function () { return helpers_2.uppercase; } });
343
+ Object.defineProperty(exports, "lowercase", { enumerable: true, get: function () { return helpers_2.lowercase; } });
344
+ Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return helpers_2.capitalize; } });
345
+ Object.defineProperty(exports, "truncate", { enumerable: true, get: function () { return helpers_2.truncate; } });
346
+ Object.defineProperty(exports, "defaultValue", { enumerable: true, get: function () { return helpers_2.defaultValue; } });
347
+ Object.defineProperty(exports, "uniqueId", { enumerable: true, get: function () { return helpers_2.uniqueId; } });
348
+ Object.defineProperty(exports, "classNames", { enumerable: true, get: function () { return helpers_2.classNames; } });
349
+ Object.defineProperty(exports, "resetUniqueIdCounter", { enumerable: true, get: function () { return helpers_2.resetUniqueIdCounter; } });
350
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handl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AA;AACN,mGAAA,QAAQ,OAAA;AACR,+FAAA,IAAI,OAAA;AACJ,oGAAA,SAAS,OAAA;AACT,oGAAA,SAAS,OAAA;AACT,qGAAA,UAAU,OAAA;AACV,mGAAA,QAAQ,OAAA;AACR,uGAAA,YAAY,OAAA;AACZ,mGAAA,QAAQ,OAAA;AACR,qGAAA,UAAU,OAAA;AACV,+GAAA,oBAAoB,OAAA","sourcesContent":["/**\n * Handlebars Renderer Module\n *\n * Provides Handlebars template rendering for HTML templates.\n * Enhances plain HTML with {{variable}} syntax support.\n *\n * @example\n * ```typescript\n * import { HandlebarsRenderer, createHandlebarsRenderer } from '@frontmcp/ui/handlebars';\n *\n * const renderer = createHandlebarsRenderer();\n *\n * const template = `\n * <div class=\"card\">\n * <h2>{{escapeHtml output.title}}</h2>\n * <p>Created: {{formatDate output.createdAt}}</p>\n * {{#if output.items.length}}\n * <ul>\n * {{#each output.items}}\n * <li>{{this.name}} - {{formatCurrency this.price}}</li>\n * {{/each}}\n * </ul>\n * {{/if}}\n * </div>\n * `;\n *\n * const html = renderer.render(template, {\n * input: { query: 'test' },\n * output: {\n * title: 'Results',\n * createdAt: new Date(),\n * items: [{ name: 'Item 1', price: 9.99 }]\n * }\n * });\n * ```\n *\n * @packageDocumentation\n */\n\nimport type { TemplateContext, TemplateHelpers } from '../types';\nimport { builtinHelpers, type HelperFunction } from './helpers';\n\n/**\n * Lazy-loaded Handlebars module.\n */\nlet Handlebars: typeof import('handlebars') | null = null;\n\n/**\n * Load Handlebars module.\n */\nasync function loadHandlebars(): Promise<typeof import('handlebars')> {\n if (Handlebars !== null) {\n return Handlebars;\n }\n\n try {\n Handlebars = await import('handlebars');\n return Handlebars;\n } catch {\n throw new Error('Handlebars is required for template rendering. Install it: npm install handlebars');\n }\n}\n\n/**\n * Check if Handlebars is available.\n */\nexport async function isHandlebarsAvailable(): Promise<boolean> {\n try {\n await loadHandlebars();\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Options for the Handlebars renderer.\n */\nexport interface HandlebarsRendererOptions {\n /**\n * Additional custom helpers to register.\n */\n helpers?: Record<string, HelperFunction>;\n\n /**\n * Partial templates to register.\n */\n partials?: Record<string, string>;\n\n /**\n * Strict mode - error on missing variables.\n * @default false\n */\n strict?: boolean;\n\n /**\n * Whether to auto-escape output.\n * @default true\n */\n autoEscape?: boolean;\n}\n\n/**\n * Render context for templates.\n */\nexport interface RenderContext {\n /**\n * Tool input arguments.\n */\n input: Record<string, unknown>;\n\n /**\n * Tool output/result.\n */\n output: unknown;\n\n /**\n * Structured content (if schema provided).\n */\n structuredContent?: unknown;\n\n /**\n * Template helper functions.\n */\n helpers?: TemplateHelpers;\n}\n\n/**\n * Handlebars template renderer.\n *\n * Provides safe, cacheable Handlebars rendering with built-in helpers\n * for formatting, escaping, and logic.\n *\n * @example\n * ```typescript\n * const renderer = new HandlebarsRenderer();\n *\n * // Simple render\n * const html = await renderer.render('<div>{{output.name}}</div>', { output: { name: 'Test' } });\n *\n * // With custom helpers\n * renderer.registerHelper('shout', (str) => String(str).toUpperCase() + '!');\n * const html2 = await renderer.render('<div>{{shout output.name}}</div>', { output: { name: 'hello' } });\n * ```\n */\nexport class HandlebarsRenderer {\n private readonly options: HandlebarsRendererOptions;\n private compiledTemplates = new Map<string, HandlebarsTemplateDelegate>();\n private initialized = false;\n private hbs: typeof import('handlebars') | null = null;\n\n constructor(options: HandlebarsRendererOptions = {}) {\n this.options = {\n strict: false,\n autoEscape: true,\n ...options,\n };\n }\n\n /**\n * Initialize the renderer with Handlebars.\n */\n private async init(): Promise<void> {\n if (this.initialized) return;\n\n this.hbs = await loadHandlebars();\n\n // Register built-in helpers\n for (const [name, helper] of Object.entries(builtinHelpers)) {\n this.hbs.registerHelper(name, helper as Handlebars.HelperDelegate);\n }\n\n // Register custom helpers\n if (this.options.helpers) {\n for (const [name, helper] of Object.entries(this.options.helpers)) {\n this.hbs.registerHelper(name, helper as Handlebars.HelperDelegate);\n }\n }\n\n // Register partials\n if (this.options.partials) {\n for (const [name, template] of Object.entries(this.options.partials)) {\n this.hbs.registerPartial(name, template);\n }\n }\n\n this.initialized = true;\n }\n\n /**\n * Render a Handlebars template.\n *\n * @param template - Template string\n * @param context - Render context with input/output\n * @returns Rendered HTML string\n */\n async render(template: string, context: RenderContext): Promise<string> {\n await this.init();\n\n if (!this.hbs) {\n throw new Error('Handlebars not initialized');\n }\n\n // Get or compile template\n let compiled = this.compiledTemplates.get(template);\n if (!compiled) {\n compiled = this.hbs.compile(template, {\n strict: this.options.strict,\n noEscape: !this.options.autoEscape,\n });\n this.compiledTemplates.set(template, compiled);\n }\n\n // Build template data\n const data = {\n input: context.input ?? {},\n output: context.output ?? {},\n structuredContent: context.structuredContent,\n // Also expose at root level for convenience\n ...context.input,\n ...(typeof context.output === 'object' && context.output !== null\n ? (context.output as Record<string, unknown>)\n : {}),\n };\n\n // Render template\n try {\n return compiled(data);\n } catch (error) {\n throw new Error(`Template rendering failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n /**\n * Render a template synchronously.\n *\n * Note: Requires Handlebars to be pre-loaded. Use `render()` for async loading.\n *\n * @param template - Template string\n * @param context - Render context\n * @returns Rendered HTML string\n */\n renderSync(template: string, context: RenderContext): string {\n if (!this.initialized || !this.hbs) {\n throw new Error('HandlebarsRenderer not initialized. Call render() first or use initSync().');\n }\n\n // Get or compile template\n let compiled = this.compiledTemplates.get(template);\n if (!compiled) {\n compiled = this.hbs.compile(template, {\n strict: this.options.strict,\n noEscape: !this.options.autoEscape,\n });\n this.compiledTemplates.set(template, compiled);\n }\n\n // Build template data\n const data = {\n input: context.input ?? {},\n output: context.output ?? {},\n structuredContent: context.structuredContent,\n ...context.input,\n ...(typeof context.output === 'object' && context.output !== null\n ? (context.output as Record<string, unknown>)\n : {}),\n };\n\n return compiled(data);\n }\n\n /**\n * Initialize synchronously (for environments where Handlebars is already loaded).\n */\n initSync(handlebars: typeof import('handlebars')): void {\n this.hbs = handlebars;\n\n // Register built-in helpers\n for (const [name, helper] of Object.entries(builtinHelpers)) {\n this.hbs.registerHelper(name, helper as Handlebars.HelperDelegate);\n }\n\n // Register custom helpers\n if (this.options.helpers) {\n for (const [name, helper] of Object.entries(this.options.helpers)) {\n this.hbs.registerHelper(name, helper as Handlebars.HelperDelegate);\n }\n }\n\n // Register partials\n if (this.options.partials) {\n for (const [name, template] of Object.entries(this.options.partials)) {\n this.hbs.registerPartial(name, template);\n }\n }\n\n this.initialized = true;\n }\n\n /**\n * Register a custom helper.\n *\n * @param name - Helper name\n * @param fn - Helper function\n */\n registerHelper(name: string, fn: HelperFunction): void {\n if (this.hbs) {\n this.hbs.registerHelper(name, fn as Handlebars.HelperDelegate);\n }\n // Also store for future use\n if (!this.options.helpers) {\n this.options.helpers = {};\n }\n this.options.helpers[name] = fn;\n }\n\n /**\n * Register a partial template.\n *\n * @param name - Partial name\n * @param template - Partial template string\n */\n registerPartial(name: string, template: string): void {\n if (this.hbs) {\n this.hbs.registerPartial(name, template);\n }\n // Also store for future use\n if (!this.options.partials) {\n this.options.partials = {};\n }\n this.options.partials[name] = template;\n }\n\n /**\n * Clear compiled template cache.\n */\n clearCache(): void {\n this.compiledTemplates.clear();\n }\n\n /**\n * Check if a template string contains Handlebars syntax.\n *\n * @param template - Template string to check\n * @returns true if contains {{...}} syntax\n */\n static containsHandlebars(template: string): boolean {\n // Match {{...}} but not {{! comments }}\n return /\\{\\{(?!!)[\\s\\S]*?\\}\\}/.test(template);\n }\n\n /**\n * Check if the renderer is initialized.\n */\n get isInitialized(): boolean {\n return this.initialized;\n }\n}\n\n/**\n * Create a new Handlebars renderer.\n *\n * @param options - Renderer options\n * @returns New HandlebarsRenderer instance\n */\nexport function createHandlebarsRenderer(options?: HandlebarsRendererOptions): HandlebarsRenderer {\n return new HandlebarsRenderer(options);\n}\n\n/**\n * Render a template with default settings.\n *\n * Convenience function for one-off rendering.\n *\n * @param template - Template string\n * @param context - Render context\n * @returns Rendered HTML\n */\nexport async function renderTemplate(template: string, context: RenderContext): Promise<string> {\n const renderer = createHandlebarsRenderer();\n return renderer.render(template, context);\n}\n\n/**\n * Check if a template contains Handlebars syntax.\n *\n * @param template - Template string\n * @returns true if contains {{...}}\n */\nexport function containsHandlebars(template: string): boolean {\n return HandlebarsRenderer.containsHandlebars(template);\n}\n\n// ============================================\n// Re-exports\n// ============================================\n\nexport {\n builtinHelpers,\n escapeHtml,\n formatDate,\n formatCurrency,\n formatNumber,\n json,\n jsonEmbed,\n eq,\n ne,\n gt,\n gte,\n lt,\n lte,\n and,\n or,\n not,\n first,\n last,\n length,\n includes,\n join,\n uppercase,\n lowercase,\n capitalize,\n truncate,\n defaultValue,\n uniqueId,\n classNames,\n resetUniqueIdCounter,\n type HelperFunction,\n} from './helpers';\n\n// Handlebars types\ntype HandlebarsTemplateDelegate = ReturnType<typeof import('handlebars')['compile']>;\n"]}
package/src/index.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @frontmcp/ui
3
+ *
4
+ * Comprehensive UI library for FrontMCP applications.
5
+ * Provides theme system, layouts, components, page templates, and widgets
6
+ * for building authentication and authorization UIs across multiple LLM platforms.
7
+ *
8
+ * Key features:
9
+ * - Multi-framework renderer support (HTML, React, MDX)
10
+ * - Platform-aware theming (OpenAI, Claude, etc.)
11
+ * - Runtime JSX/TSX transpilation with SWC
12
+ * - MCP Bridge integration for cross-platform widgets
13
+ * - Standalone types and adapters for external consumers (AgentLink)
14
+ * - Build-time API for pre-compiling UI templates
15
+ *
16
+ * ## Standalone Usage (without @frontmcp/sdk)
17
+ *
18
+ * For external systems like AgentLink that want to use the UI components
19
+ * without the full SDK:
20
+ *
21
+ * ```typescript
22
+ * // Import standalone types
23
+ * import type { UITemplateConfig, TemplateContext } from '@frontmcp/ui/types';
24
+ *
25
+ * // Import platform adapters
26
+ * import { buildUIMeta } from '@frontmcp/ui/adapters';
27
+ *
28
+ * // Import build-time API
29
+ * import { buildToolUI } from '@frontmcp/ui/build';
30
+ *
31
+ * // Import components directly
32
+ * import { card, button, table } from '@frontmcp/ui/components';
33
+ * ```
34
+ */
35
+ export * from './types';
36
+ export { type AIPlatformType, type UIMetadata, type BuildUIMetaOptions, type BuildToolDiscoveryMetaOptions, buildUIMeta, buildToolDiscoveryMeta, buildOpenAICSP, } from './adapters';
37
+ export { type BuildTargetPlatform, type BuildOptions, type BuildResult, type MultiBuildOptions, type MultiBuildResult, type StaticWidgetOptions, buildToolUI, buildToolUIMulti, buildStaticWidget, } from './build';
38
+ export * from './validation';
39
+ export * from './theme';
40
+ export * from './layouts';
41
+ export * from './components';
42
+ export * from './pages';
43
+ export * from './widgets';
44
+ export { type ProviderType, type DisplayMode, type ThemeMode, type HostContext, type MCPBridge, type MCPBridgeExtended, type WrapToolUIOptions, type OpenAIRuntime, type OpenAIUserAgent, type SafeAreaInsets, MCP_BRIDGE_RUNTIME, getMCPBridgeScript, isMCPBridgeSupported, DEFAULT_CSP_DIRECTIVES, buildCSPDirectives, buildCSPMetaTag, validateCSPDomain, sanitizeCSPDomains, type WrapToolUIFullOptions, wrapToolUI, wrapToolUIMinimal, createTemplateHelpers, getToolUIMimeType, type SanitizerFn, type SanitizeOptions, REDACTION_TOKENS, PII_PATTERNS, sanitizeInput, createSanitizer, detectPII, isEmail, isPhone, isCreditCard, isSSN, isIPv4, detectPIIType, redactPIIFromText, } from './runtime';
45
+ export * from './tool-template';
46
+ export * from './base-template';
47
+ export * from './renderers';
48
+ export { type PlatformAdapter, type AdapterCapabilities, type BridgeConfig, FrontMcpBridge, createBridge, AdapterRegistry, defaultRegistry, registerAdapter, generateBridgeIIFE, generatePlatformBundle, UNIVERSAL_BRIDGE_SCRIPT, BRIDGE_SCRIPT_TAGS, } from './bridge';
49
+ export { registerAllComponents, registerFmcpButton, registerFmcpCard, registerFmcpAlert, registerFmcpBadge, registerFmcpInput, registerFmcpSelect, FmcpButton, FmcpCard, FmcpAlert, FmcpBadge, FmcpInput, FmcpSelect, FmcpElement, } from './web-components';
50
+ export { ToolUIRegistry, type RenderOptions, type UIRenderResult, type CompileStaticWidgetOptions, type HybridComponentPayload, type BuildHybridComponentPayloadOptions, renderToolTemplate, renderToolTemplateAsync, isReactComponent, hasUIConfig, containsMdxSyntax, type RenderTemplateOptions, UI_RESOURCE_SCHEME, isUIResourceUri, isStaticWidgetUri, parseWidgetUri, buildStaticWidgetUri, getUIResourceMimeType, type ParsedWidgetUri, } from './registry';