@frontmcp/ui 0.6.0 → 0.6.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 (445) hide show
  1. package/README.md +140 -362
  2. package/bridge/runtime/index.d.ts +2 -1
  3. package/bridge/runtime/index.d.ts.map +1 -1
  4. package/bundler/file-cache/component-builder.d.ts +1 -1
  5. package/bundler/file-cache/component-builder.d.ts.map +1 -1
  6. package/bundler/file-cache/hash-calculator.d.ts +1 -1
  7. package/bundler/file-cache/hash-calculator.d.ts.map +1 -1
  8. package/bundler/file-cache/storage/filesystem.d.ts +1 -1
  9. package/bundler/file-cache/storage/filesystem.d.ts.map +1 -1
  10. package/bundler/file-cache/storage/interface.d.ts +1 -1
  11. package/bundler/file-cache/storage/interface.d.ts.map +1 -1
  12. package/bundler/file-cache/storage/redis.d.ts +1 -1
  13. package/bundler/file-cache/storage/redis.d.ts.map +1 -1
  14. package/bundler/index.js +10 -1057
  15. package/components/alert.schema.d.ts +6 -6
  16. package/components/avatar.schema.d.ts +9 -9
  17. package/components/badge.schema.d.ts +9 -9
  18. package/components/button.schema.d.ts +9 -9
  19. package/components/card.schema.d.ts +7 -7
  20. package/components/form.schema.d.ts +24 -24
  21. package/components/index.js +128 -198
  22. package/components/modal.schema.d.ts +8 -8
  23. package/components/table.schema.d.ts +6 -6
  24. package/esm/bridge/runtime/index.d.ts +2 -1
  25. package/esm/bridge/runtime/index.d.ts.map +1 -1
  26. package/esm/bundler/file-cache/component-builder.d.ts +1 -1
  27. package/esm/bundler/file-cache/component-builder.d.ts.map +1 -1
  28. package/esm/bundler/file-cache/hash-calculator.d.ts +1 -1
  29. package/esm/bundler/file-cache/hash-calculator.d.ts.map +1 -1
  30. package/esm/bundler/file-cache/storage/filesystem.d.ts +1 -1
  31. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +1 -1
  32. package/esm/bundler/file-cache/storage/interface.d.ts +1 -1
  33. package/esm/bundler/file-cache/storage/interface.d.ts.map +1 -1
  34. package/esm/bundler/file-cache/storage/redis.d.ts +1 -1
  35. package/esm/bundler/file-cache/storage/redis.d.ts.map +1 -1
  36. package/esm/bundler/index.js +3 -1050
  37. package/esm/components/alert.schema.d.ts +6 -6
  38. package/esm/components/avatar.schema.d.ts +9 -9
  39. package/esm/components/badge.schema.d.ts +9 -9
  40. package/esm/components/button.schema.d.ts +9 -9
  41. package/esm/components/card.schema.d.ts +7 -7
  42. package/esm/components/form.schema.d.ts +24 -24
  43. package/esm/components/index.js +136 -196
  44. package/esm/components/modal.schema.d.ts +8 -8
  45. package/esm/components/table.schema.d.ts +6 -6
  46. package/esm/index.d.ts +23 -39
  47. package/esm/index.d.ts.map +1 -1
  48. package/esm/index.js +4256 -16441
  49. package/esm/layouts/base.d.ts +2 -2
  50. package/esm/layouts/base.d.ts.map +1 -1
  51. package/esm/layouts/index.js +33 -516
  52. package/esm/package.json +8 -26
  53. package/esm/pages/index.js +100 -627
  54. package/esm/react/Alert.d.ts +1 -2
  55. package/esm/react/Alert.d.ts.map +1 -1
  56. package/esm/react/Badge.d.ts +1 -2
  57. package/esm/react/Badge.d.ts.map +1 -1
  58. package/esm/react/Button.d.ts +1 -2
  59. package/esm/react/Button.d.ts.map +1 -1
  60. package/esm/react/Card.d.ts +1 -2
  61. package/esm/react/Card.d.ts.map +1 -1
  62. package/esm/react/hooks/context.d.ts +1 -1
  63. package/esm/react/hooks/context.d.ts.map +1 -1
  64. package/esm/react/index.d.ts +5 -6
  65. package/esm/react/index.d.ts.map +1 -1
  66. package/esm/react/index.js +2074 -322
  67. package/esm/react/types.d.ts +1 -2
  68. package/esm/react/types.d.ts.map +1 -1
  69. package/esm/renderers/index.d.ts +10 -25
  70. package/esm/renderers/index.d.ts.map +1 -1
  71. package/esm/renderers/index.js +171 -1617
  72. package/esm/{runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  73. package/esm/renderers/react.adapter.d.ts.map +1 -0
  74. package/esm/renderers/react.renderer.d.ts +3 -3
  75. package/esm/renderers/react.renderer.d.ts.map +1 -1
  76. package/esm/universal/index.js +1755 -0
  77. package/esm/web-components/index.js +232 -287
  78. package/esm/widgets/index.js +89 -147
  79. package/index.d.ts +23 -39
  80. package/index.d.ts.map +1 -1
  81. package/index.js +6123 -18539
  82. package/layouts/base.d.ts +2 -2
  83. package/layouts/base.d.ts.map +1 -1
  84. package/layouts/index.js +43 -536
  85. package/package.json +8 -26
  86. package/pages/index.js +111 -648
  87. package/react/Alert.d.ts +1 -2
  88. package/react/Alert.d.ts.map +1 -1
  89. package/react/Badge.d.ts +1 -2
  90. package/react/Badge.d.ts.map +1 -1
  91. package/react/Button.d.ts +1 -2
  92. package/react/Button.d.ts.map +1 -1
  93. package/react/Card.d.ts +1 -2
  94. package/react/Card.d.ts.map +1 -1
  95. package/react/hooks/context.d.ts +1 -1
  96. package/react/hooks/context.d.ts.map +1 -1
  97. package/react/index.d.ts +5 -6
  98. package/react/index.d.ts.map +1 -1
  99. package/react/index.js +2065 -335
  100. package/react/types.d.ts +1 -2
  101. package/react/types.d.ts.map +1 -1
  102. package/renderers/index.d.ts +10 -25
  103. package/renderers/index.d.ts.map +1 -1
  104. package/renderers/index.js +175 -1641
  105. package/{runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  106. package/renderers/react.adapter.d.ts.map +1 -0
  107. package/renderers/react.renderer.d.ts +3 -3
  108. package/renderers/react.renderer.d.ts.map +1 -1
  109. package/universal/index.js +1841 -0
  110. package/web-components/index.js +224 -289
  111. package/widgets/index.js +80 -148
  112. package/adapters/index.d.ts +0 -13
  113. package/adapters/index.d.ts.map +0 -1
  114. package/adapters/index.js +0 -462
  115. package/adapters/platform-meta.d.ts +0 -166
  116. package/adapters/platform-meta.d.ts.map +0 -1
  117. package/adapters/response-builder.d.ts +0 -108
  118. package/adapters/response-builder.d.ts.map +0 -1
  119. package/adapters/serving-mode.d.ts +0 -107
  120. package/adapters/serving-mode.d.ts.map +0 -1
  121. package/base-template/bridge.d.ts +0 -90
  122. package/base-template/bridge.d.ts.map +0 -1
  123. package/base-template/default-base-template.d.ts +0 -92
  124. package/base-template/default-base-template.d.ts.map +0 -1
  125. package/base-template/index.d.ts +0 -15
  126. package/base-template/index.d.ts.map +0 -1
  127. package/base-template/index.js +0 -1398
  128. package/base-template/polyfills.d.ts +0 -31
  129. package/base-template/polyfills.d.ts.map +0 -1
  130. package/base-template/theme-styles.d.ts +0 -74
  131. package/base-template/theme-styles.d.ts.map +0 -1
  132. package/build/cdn-resources.d.ts +0 -243
  133. package/build/cdn-resources.d.ts.map +0 -1
  134. package/build/index.d.ts +0 -295
  135. package/build/index.d.ts.map +0 -1
  136. package/build/index.js +0 -7096
  137. package/build/widget-manifest.d.ts +0 -362
  138. package/build/widget-manifest.d.ts.map +0 -1
  139. package/dependency/cdn-registry.d.ts +0 -98
  140. package/dependency/cdn-registry.d.ts.map +0 -1
  141. package/dependency/import-map.d.ts +0 -186
  142. package/dependency/import-map.d.ts.map +0 -1
  143. package/dependency/import-parser.d.ts +0 -82
  144. package/dependency/import-parser.d.ts.map +0 -1
  145. package/dependency/index.d.ts +0 -17
  146. package/dependency/index.d.ts.map +0 -1
  147. package/dependency/resolver.d.ts +0 -164
  148. package/dependency/resolver.d.ts.map +0 -1
  149. package/dependency/schemas.d.ts +0 -486
  150. package/dependency/schemas.d.ts.map +0 -1
  151. package/dependency/template-loader.d.ts +0 -204
  152. package/dependency/template-loader.d.ts.map +0 -1
  153. package/dependency/template-processor.d.ts +0 -118
  154. package/dependency/template-processor.d.ts.map +0 -1
  155. package/dependency/types.d.ts +0 -739
  156. package/dependency/types.d.ts.map +0 -1
  157. package/esm/adapters/index.d.ts +0 -13
  158. package/esm/adapters/index.d.ts.map +0 -1
  159. package/esm/adapters/index.js +0 -427
  160. package/esm/adapters/platform-meta.d.ts +0 -166
  161. package/esm/adapters/platform-meta.d.ts.map +0 -1
  162. package/esm/adapters/response-builder.d.ts +0 -108
  163. package/esm/adapters/response-builder.d.ts.map +0 -1
  164. package/esm/adapters/serving-mode.d.ts +0 -107
  165. package/esm/adapters/serving-mode.d.ts.map +0 -1
  166. package/esm/base-template/bridge.d.ts +0 -90
  167. package/esm/base-template/bridge.d.ts.map +0 -1
  168. package/esm/base-template/default-base-template.d.ts +0 -92
  169. package/esm/base-template/default-base-template.d.ts.map +0 -1
  170. package/esm/base-template/index.d.ts +0 -15
  171. package/esm/base-template/index.d.ts.map +0 -1
  172. package/esm/base-template/index.js +0 -1364
  173. package/esm/base-template/polyfills.d.ts +0 -31
  174. package/esm/base-template/polyfills.d.ts.map +0 -1
  175. package/esm/base-template/theme-styles.d.ts +0 -74
  176. package/esm/base-template/theme-styles.d.ts.map +0 -1
  177. package/esm/build/cdn-resources.d.ts +0 -243
  178. package/esm/build/cdn-resources.d.ts.map +0 -1
  179. package/esm/build/index.d.ts +0 -295
  180. package/esm/build/index.d.ts.map +0 -1
  181. package/esm/build/index.js +0 -7021
  182. package/esm/build/widget-manifest.d.ts +0 -362
  183. package/esm/build/widget-manifest.d.ts.map +0 -1
  184. package/esm/dependency/cdn-registry.d.ts +0 -98
  185. package/esm/dependency/cdn-registry.d.ts.map +0 -1
  186. package/esm/dependency/import-map.d.ts +0 -186
  187. package/esm/dependency/import-map.d.ts.map +0 -1
  188. package/esm/dependency/import-parser.d.ts +0 -82
  189. package/esm/dependency/import-parser.d.ts.map +0 -1
  190. package/esm/dependency/index.d.ts +0 -17
  191. package/esm/dependency/index.d.ts.map +0 -1
  192. package/esm/dependency/resolver.d.ts +0 -164
  193. package/esm/dependency/resolver.d.ts.map +0 -1
  194. package/esm/dependency/schemas.d.ts +0 -486
  195. package/esm/dependency/schemas.d.ts.map +0 -1
  196. package/esm/dependency/template-loader.d.ts +0 -204
  197. package/esm/dependency/template-loader.d.ts.map +0 -1
  198. package/esm/dependency/template-processor.d.ts +0 -118
  199. package/esm/dependency/template-processor.d.ts.map +0 -1
  200. package/esm/dependency/types.d.ts +0 -739
  201. package/esm/dependency/types.d.ts.map +0 -1
  202. package/esm/handlebars/expression-extractor.d.ts +0 -147
  203. package/esm/handlebars/expression-extractor.d.ts.map +0 -1
  204. package/esm/handlebars/helpers.d.ts +0 -339
  205. package/esm/handlebars/helpers.d.ts.map +0 -1
  206. package/esm/handlebars/index.d.ts +0 -195
  207. package/esm/handlebars/index.d.ts.map +0 -1
  208. package/esm/handlebars/index.js +0 -587
  209. package/esm/registry/index.d.ts +0 -46
  210. package/esm/registry/index.d.ts.map +0 -1
  211. package/esm/registry/index.js +0 -6422
  212. package/esm/registry/render-template.d.ts +0 -91
  213. package/esm/registry/render-template.d.ts.map +0 -1
  214. package/esm/registry/tool-ui.registry.d.ts +0 -294
  215. package/esm/registry/tool-ui.registry.d.ts.map +0 -1
  216. package/esm/registry/uri-utils.d.ts +0 -56
  217. package/esm/registry/uri-utils.d.ts.map +0 -1
  218. package/esm/renderers/cache.d.ts +0 -145
  219. package/esm/renderers/cache.d.ts.map +0 -1
  220. package/esm/renderers/html.renderer.d.ts +0 -123
  221. package/esm/renderers/html.renderer.d.ts.map +0 -1
  222. package/esm/renderers/mdx.renderer.d.ts +0 -120
  223. package/esm/renderers/mdx.renderer.d.ts.map +0 -1
  224. package/esm/renderers/registry.d.ts +0 -134
  225. package/esm/renderers/registry.d.ts.map +0 -1
  226. package/esm/renderers/types.d.ts +0 -342
  227. package/esm/renderers/types.d.ts.map +0 -1
  228. package/esm/renderers/utils/detect.d.ts +0 -107
  229. package/esm/renderers/utils/detect.d.ts.map +0 -1
  230. package/esm/renderers/utils/hash.d.ts +0 -40
  231. package/esm/renderers/utils/hash.d.ts.map +0 -1
  232. package/esm/renderers/utils/index.d.ts +0 -9
  233. package/esm/renderers/utils/index.d.ts.map +0 -1
  234. package/esm/renderers/utils/transpiler.d.ts +0 -89
  235. package/esm/renderers/utils/transpiler.d.ts.map +0 -1
  236. package/esm/runtime/adapters/html.adapter.d.ts +0 -59
  237. package/esm/runtime/adapters/html.adapter.d.ts.map +0 -1
  238. package/esm/runtime/adapters/index.d.ts +0 -26
  239. package/esm/runtime/adapters/index.d.ts.map +0 -1
  240. package/esm/runtime/adapters/mdx.adapter.d.ts +0 -73
  241. package/esm/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  242. package/esm/runtime/adapters/react.adapter.d.ts.map +0 -1
  243. package/esm/runtime/adapters/types.d.ts +0 -95
  244. package/esm/runtime/adapters/types.d.ts.map +0 -1
  245. package/esm/runtime/csp.d.ts +0 -48
  246. package/esm/runtime/csp.d.ts.map +0 -1
  247. package/esm/runtime/index.d.ts +0 -17
  248. package/esm/runtime/index.d.ts.map +0 -1
  249. package/esm/runtime/index.js +0 -5186
  250. package/esm/runtime/mcp-bridge.d.ts +0 -101
  251. package/esm/runtime/mcp-bridge.d.ts.map +0 -1
  252. package/esm/runtime/renderer-runtime.d.ts +0 -133
  253. package/esm/runtime/renderer-runtime.d.ts.map +0 -1
  254. package/esm/runtime/sanitizer.d.ts +0 -172
  255. package/esm/runtime/sanitizer.d.ts.map +0 -1
  256. package/esm/runtime/types.d.ts +0 -415
  257. package/esm/runtime/types.d.ts.map +0 -1
  258. package/esm/runtime/wrapper.d.ts +0 -421
  259. package/esm/runtime/wrapper.d.ts.map +0 -1
  260. package/esm/styles/index.d.ts +0 -8
  261. package/esm/styles/index.d.ts.map +0 -1
  262. package/esm/styles/index.js +0 -171
  263. package/esm/styles/variants.d.ts +0 -51
  264. package/esm/styles/variants.d.ts.map +0 -1
  265. package/esm/theme/cdn.d.ts +0 -195
  266. package/esm/theme/cdn.d.ts.map +0 -1
  267. package/esm/theme/index.d.ts +0 -18
  268. package/esm/theme/index.d.ts.map +0 -1
  269. package/esm/theme/index.js +0 -700
  270. package/esm/theme/platforms.d.ts +0 -107
  271. package/esm/theme/platforms.d.ts.map +0 -1
  272. package/esm/theme/presets/github-openai.d.ts +0 -50
  273. package/esm/theme/presets/github-openai.d.ts.map +0 -1
  274. package/esm/theme/presets/index.d.ts +0 -11
  275. package/esm/theme/presets/index.d.ts.map +0 -1
  276. package/esm/theme/theme.d.ts +0 -396
  277. package/esm/theme/theme.d.ts.map +0 -1
  278. package/esm/tool-template/builder.d.ts +0 -213
  279. package/esm/tool-template/builder.d.ts.map +0 -1
  280. package/esm/tool-template/index.d.ts +0 -16
  281. package/esm/tool-template/index.d.ts.map +0 -1
  282. package/esm/tool-template/index.js +0 -3515
  283. package/esm/types/index.d.ts +0 -14
  284. package/esm/types/index.d.ts.map +0 -1
  285. package/esm/types/index.js +0 -75
  286. package/esm/types/ui-config.d.ts +0 -639
  287. package/esm/types/ui-config.d.ts.map +0 -1
  288. package/esm/types/ui-runtime.d.ts +0 -1007
  289. package/esm/types/ui-runtime.d.ts.map +0 -1
  290. package/esm/typings/cache/cache-adapter.d.ts +0 -125
  291. package/esm/typings/cache/cache-adapter.d.ts.map +0 -1
  292. package/esm/typings/cache/index.d.ts +0 -10
  293. package/esm/typings/cache/index.d.ts.map +0 -1
  294. package/esm/typings/cache/memory-cache.d.ts +0 -92
  295. package/esm/typings/cache/memory-cache.d.ts.map +0 -1
  296. package/esm/typings/dts-parser.d.ts +0 -90
  297. package/esm/typings/dts-parser.d.ts.map +0 -1
  298. package/esm/typings/index.d.ts +0 -48
  299. package/esm/typings/index.d.ts.map +0 -1
  300. package/esm/typings/schemas.d.ts +0 -232
  301. package/esm/typings/schemas.d.ts.map +0 -1
  302. package/esm/typings/type-fetcher.d.ts +0 -89
  303. package/esm/typings/type-fetcher.d.ts.map +0 -1
  304. package/esm/typings/types.d.ts +0 -320
  305. package/esm/typings/types.d.ts.map +0 -1
  306. package/esm/utils/escape-html.d.ts +0 -58
  307. package/esm/utils/escape-html.d.ts.map +0 -1
  308. package/esm/utils/index.d.ts +0 -10
  309. package/esm/utils/index.d.ts.map +0 -1
  310. package/esm/utils/index.js +0 -40
  311. package/esm/utils/safe-stringify.d.ts +0 -30
  312. package/esm/utils/safe-stringify.d.ts.map +0 -1
  313. package/esm/validation/error-box.d.ts +0 -56
  314. package/esm/validation/error-box.d.ts.map +0 -1
  315. package/esm/validation/index.d.ts +0 -13
  316. package/esm/validation/index.d.ts.map +0 -1
  317. package/esm/validation/index.js +0 -562
  318. package/esm/validation/schema-paths.d.ts +0 -118
  319. package/esm/validation/schema-paths.d.ts.map +0 -1
  320. package/esm/validation/template-validator.d.ts +0 -143
  321. package/esm/validation/template-validator.d.ts.map +0 -1
  322. package/esm/validation/wrapper.d.ts +0 -97
  323. package/esm/validation/wrapper.d.ts.map +0 -1
  324. package/handlebars/expression-extractor.d.ts +0 -147
  325. package/handlebars/expression-extractor.d.ts.map +0 -1
  326. package/handlebars/helpers.d.ts +0 -339
  327. package/handlebars/helpers.d.ts.map +0 -1
  328. package/handlebars/index.d.ts +0 -195
  329. package/handlebars/index.d.ts.map +0 -1
  330. package/handlebars/index.js +0 -666
  331. package/registry/index.d.ts +0 -46
  332. package/registry/index.d.ts.map +0 -1
  333. package/registry/index.js +0 -6465
  334. package/registry/render-template.d.ts +0 -91
  335. package/registry/render-template.d.ts.map +0 -1
  336. package/registry/tool-ui.registry.d.ts +0 -294
  337. package/registry/tool-ui.registry.d.ts.map +0 -1
  338. package/registry/uri-utils.d.ts +0 -56
  339. package/registry/uri-utils.d.ts.map +0 -1
  340. package/renderers/cache.d.ts +0 -145
  341. package/renderers/cache.d.ts.map +0 -1
  342. package/renderers/html.renderer.d.ts +0 -123
  343. package/renderers/html.renderer.d.ts.map +0 -1
  344. package/renderers/mdx.renderer.d.ts +0 -120
  345. package/renderers/mdx.renderer.d.ts.map +0 -1
  346. package/renderers/registry.d.ts +0 -134
  347. package/renderers/registry.d.ts.map +0 -1
  348. package/renderers/types.d.ts +0 -342
  349. package/renderers/types.d.ts.map +0 -1
  350. package/renderers/utils/detect.d.ts +0 -107
  351. package/renderers/utils/detect.d.ts.map +0 -1
  352. package/renderers/utils/hash.d.ts +0 -40
  353. package/renderers/utils/hash.d.ts.map +0 -1
  354. package/renderers/utils/index.d.ts +0 -9
  355. package/renderers/utils/index.d.ts.map +0 -1
  356. package/renderers/utils/transpiler.d.ts +0 -89
  357. package/renderers/utils/transpiler.d.ts.map +0 -1
  358. package/runtime/adapters/html.adapter.d.ts +0 -59
  359. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  360. package/runtime/adapters/index.d.ts +0 -26
  361. package/runtime/adapters/index.d.ts.map +0 -1
  362. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  363. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  364. package/runtime/adapters/react.adapter.d.ts.map +0 -1
  365. package/runtime/adapters/types.d.ts +0 -95
  366. package/runtime/adapters/types.d.ts.map +0 -1
  367. package/runtime/csp.d.ts +0 -48
  368. package/runtime/csp.d.ts.map +0 -1
  369. package/runtime/index.d.ts +0 -17
  370. package/runtime/index.d.ts.map +0 -1
  371. package/runtime/index.js +0 -5264
  372. package/runtime/mcp-bridge.d.ts +0 -101
  373. package/runtime/mcp-bridge.d.ts.map +0 -1
  374. package/runtime/renderer-runtime.d.ts +0 -133
  375. package/runtime/renderer-runtime.d.ts.map +0 -1
  376. package/runtime/sanitizer.d.ts +0 -172
  377. package/runtime/sanitizer.d.ts.map +0 -1
  378. package/runtime/types.d.ts +0 -415
  379. package/runtime/types.d.ts.map +0 -1
  380. package/runtime/wrapper.d.ts +0 -421
  381. package/runtime/wrapper.d.ts.map +0 -1
  382. package/styles/index.d.ts +0 -8
  383. package/styles/index.d.ts.map +0 -1
  384. package/styles/index.js +0 -222
  385. package/styles/variants.d.ts +0 -51
  386. package/styles/variants.d.ts.map +0 -1
  387. package/theme/cdn.d.ts +0 -195
  388. package/theme/cdn.d.ts.map +0 -1
  389. package/theme/index.d.ts +0 -18
  390. package/theme/index.d.ts.map +0 -1
  391. package/theme/index.js +0 -757
  392. package/theme/platforms.d.ts +0 -107
  393. package/theme/platforms.d.ts.map +0 -1
  394. package/theme/presets/github-openai.d.ts +0 -50
  395. package/theme/presets/github-openai.d.ts.map +0 -1
  396. package/theme/presets/index.d.ts +0 -11
  397. package/theme/presets/index.d.ts.map +0 -1
  398. package/theme/theme.d.ts +0 -396
  399. package/theme/theme.d.ts.map +0 -1
  400. package/tool-template/builder.d.ts +0 -213
  401. package/tool-template/builder.d.ts.map +0 -1
  402. package/tool-template/index.d.ts +0 -16
  403. package/tool-template/index.d.ts.map +0 -1
  404. package/tool-template/index.js +0 -3559
  405. package/types/index.d.ts +0 -14
  406. package/types/index.d.ts.map +0 -1
  407. package/types/index.js +0 -108
  408. package/types/ui-config.d.ts +0 -639
  409. package/types/ui-config.d.ts.map +0 -1
  410. package/types/ui-runtime.d.ts +0 -1007
  411. package/types/ui-runtime.d.ts.map +0 -1
  412. package/typings/cache/cache-adapter.d.ts +0 -125
  413. package/typings/cache/cache-adapter.d.ts.map +0 -1
  414. package/typings/cache/index.d.ts +0 -10
  415. package/typings/cache/index.d.ts.map +0 -1
  416. package/typings/cache/memory-cache.d.ts +0 -92
  417. package/typings/cache/memory-cache.d.ts.map +0 -1
  418. package/typings/dts-parser.d.ts +0 -90
  419. package/typings/dts-parser.d.ts.map +0 -1
  420. package/typings/index.d.ts +0 -48
  421. package/typings/index.d.ts.map +0 -1
  422. package/typings/schemas.d.ts +0 -232
  423. package/typings/schemas.d.ts.map +0 -1
  424. package/typings/type-fetcher.d.ts +0 -89
  425. package/typings/type-fetcher.d.ts.map +0 -1
  426. package/typings/types.d.ts +0 -320
  427. package/typings/types.d.ts.map +0 -1
  428. package/utils/escape-html.d.ts +0 -58
  429. package/utils/escape-html.d.ts.map +0 -1
  430. package/utils/index.d.ts +0 -10
  431. package/utils/index.d.ts.map +0 -1
  432. package/utils/index.js +0 -70
  433. package/utils/safe-stringify.d.ts +0 -30
  434. package/utils/safe-stringify.d.ts.map +0 -1
  435. package/validation/error-box.d.ts +0 -56
  436. package/validation/error-box.d.ts.map +0 -1
  437. package/validation/index.d.ts +0 -13
  438. package/validation/index.d.ts.map +0 -1
  439. package/validation/index.js +0 -603
  440. package/validation/schema-paths.d.ts +0 -118
  441. package/validation/schema-paths.d.ts.map +0 -1
  442. package/validation/template-validator.d.ts +0 -143
  443. package/validation/template-validator.d.ts.map +0 -1
  444. package/validation/wrapper.d.ts +0 -97
  445. package/validation/wrapper.d.ts.map +0 -1
@@ -1,342 +0,0 @@
1
- /**
2
- * Renderer System Types
3
- *
4
- * Core interfaces for the multi-framework rendering system.
5
- * Supports HTML, React, and MDX templates with auto-detection.
6
- */
7
- import type { TemplateContext, TemplateHelpers, TemplateBuilderFn } from '../runtime/types';
8
- import type { PlatformCapabilities } from '../theme';
9
- /**
10
- * Supported renderer types for template processing.
11
- * - 'html': Plain HTML string or template function
12
- * - 'react': React functional component
13
- * - 'mdx': MDX content string
14
- */
15
- export type RendererType = 'html' | 'react' | 'mdx';
16
- /**
17
- * Props passed to React components used as templates.
18
- *
19
- * For SSR (server-side rendering), `output` is always available.
20
- * For client-side hydration with the bridge, use `HydratedToolUIProps`.
21
- */
22
- export interface ToolUIProps<In = unknown, Out = unknown> {
23
- /** Tool input arguments */
24
- input: In;
25
- /** Tool output result */
26
- output: Out;
27
- /** Structured content parsed from output */
28
- structuredContent?: unknown;
29
- /** Helper functions for rendering */
30
- helpers: TemplateHelpers;
31
- }
32
- /**
33
- * Props for client-side hydrated components using the Platform Bridge.
34
- *
35
- * These props include loading/error state for reactive rendering.
36
- * Use with `useSyncExternalStore` from React 18+:
37
- *
38
- * @example
39
- * ```tsx
40
- * import { useSyncExternalStore } from 'react';
41
- *
42
- * function useToolBridge<T>(): HydratedToolUIProps<T> {
43
- * const state = useSyncExternalStore(
44
- * window.__frontmcp.bridge.subscribe,
45
- * window.__frontmcp.bridge.getSnapshot,
46
- * window.__frontmcp.bridge.getServerSnapshot
47
- * );
48
- * return {
49
- * data: state.data as T,
50
- * loading: state.loading,
51
- * error: state.error,
52
- * };
53
- * }
54
- *
55
- * function MyWidget() {
56
- * const { data, loading, error } = useToolBridge<WeatherData>();
57
- *
58
- * if (loading) return <Spinner />;
59
- * if (error) return <Error message={error} />;
60
- * if (!data) return <Empty />;
61
- *
62
- * return <WeatherCard {...data} />;
63
- * }
64
- * ```
65
- */
66
- export interface HydratedToolUIProps<Out = unknown> {
67
- /** Tool output data (null when loading or no data) */
68
- data: Out | null;
69
- /** Whether the bridge is waiting for data */
70
- loading: boolean;
71
- /** Error message if data loading failed */
72
- error: string | null;
73
- }
74
- /**
75
- * Result of transpiling a template.
76
- */
77
- export interface TranspileResult {
78
- /** Transpiled JavaScript code */
79
- code: string;
80
- /** Content hash for caching */
81
- hash: string;
82
- /** Whether result was retrieved from cache */
83
- cached: boolean;
84
- /** Source map for debugging (optional) */
85
- sourceMap?: string;
86
- }
87
- /**
88
- * Options for transpilation.
89
- */
90
- export interface TranspileOptions {
91
- /** Enable source maps */
92
- sourceMaps?: boolean;
93
- /** Development mode (more detailed errors) */
94
- development?: boolean;
95
- }
96
- /**
97
- * Options for rendering a template.
98
- */
99
- export interface RenderOptions {
100
- /** Target platform capabilities */
101
- platform?: PlatformCapabilities;
102
- /** Enable client-side hydration */
103
- hydrate?: boolean;
104
- /** Custom MDX components */
105
- mdxComponents?: Record<string, unknown>;
106
- }
107
- /**
108
- * Runtime scripts to inject for client-side functionality.
109
- */
110
- export interface RuntimeScripts {
111
- /** Scripts to include in <head> */
112
- headScripts: string;
113
- /** Inline script content (for blocked-network platforms) */
114
- inlineScripts?: string;
115
- /** Whether scripts are inline or external */
116
- isInline: boolean;
117
- }
118
- /**
119
- * Result of rendering a template.
120
- */
121
- export interface RenderResult {
122
- /** Rendered HTML content (body only) */
123
- html: string;
124
- /** Renderer type that was used */
125
- rendererType: RendererType;
126
- /** Whether transpilation was cached */
127
- transpileCached: boolean;
128
- /** Runtime scripts needed for this template */
129
- runtimeScripts: RuntimeScripts;
130
- }
131
- /**
132
- * Abstract renderer interface for processing templates.
133
- *
134
- * Each renderer handles a specific template type (HTML, React, MDX)
135
- * and provides:
136
- * - Template type detection
137
- * - Transpilation (if needed)
138
- * - HTML rendering
139
- * - Client runtime script generation
140
- */
141
- export interface UIRenderer<T = unknown> {
142
- /**
143
- * Unique renderer type identifier.
144
- */
145
- readonly type: RendererType;
146
- /**
147
- * Priority for auto-detection.
148
- * Higher values are checked first.
149
- * - React: 20
150
- * - MDX: 10
151
- * - HTML: 0 (fallback)
152
- */
153
- readonly priority: number;
154
- /**
155
- * Check if this renderer can handle the given template.
156
- *
157
- * @param template - The template to check
158
- * @returns True if this renderer can process the template
159
- */
160
- canHandle(template: unknown): template is T;
161
- /**
162
- * Transpile the template to executable JavaScript (if needed).
163
- *
164
- * For React components from imports, no transpilation is needed.
165
- * For JSX strings, SWC transpilation is performed.
166
- * Results are cached by content hash.
167
- *
168
- * @param template - Template to transpile
169
- * @param options - Transpilation options
170
- * @returns Transpiled result with caching metadata
171
- */
172
- transpile(template: T, options?: TranspileOptions): Promise<TranspileResult>;
173
- /**
174
- * Render the template to HTML string.
175
- *
176
- * @param template - Template to render
177
- * @param context - Template context with input/output/helpers
178
- * @param options - Render options (platform, hydration, etc.)
179
- * @returns Rendered HTML string
180
- */
181
- render<In, Out>(template: T, context: TemplateContext<In, Out>, options?: RenderOptions): Promise<string>;
182
- /**
183
- * Get runtime scripts needed for client-side functionality.
184
- *
185
- * @param platform - Target platform capabilities
186
- * @returns Scripts to inject (CDN or inline based on platform)
187
- */
188
- getRuntimeScripts(platform: PlatformCapabilities): RuntimeScripts;
189
- }
190
- /**
191
- * Options for the renderer registry.
192
- */
193
- export interface RendererRegistryOptions {
194
- /** Maximum cache size for transpiled results */
195
- maxCacheSize?: number;
196
- /** Enable debug logging */
197
- debug?: boolean;
198
- }
199
- /**
200
- * Result of detecting a template's renderer type.
201
- */
202
- export interface DetectionResult {
203
- /** The detected renderer */
204
- renderer: UIRenderer;
205
- /** Confidence level (0-1) */
206
- confidence: number;
207
- /** Detection reason for debugging */
208
- reason: string;
209
- }
210
- /**
211
- * React component type for Tool UI templates.
212
- *
213
- * This is a generic function type that accepts props and returns JSX.
214
- * We use a loose type here to avoid requiring React types at compile time.
215
- */
216
- export type ReactComponentType<In = unknown, Out = unknown> = (props: ToolUIProps<In, Out>) => any;
217
- /**
218
- * All possible template types.
219
- * Auto-detected at runtime.
220
- */
221
- export type ToolUITemplate<In = unknown, Out = unknown> = TemplateBuilderFn<In, Out> | string | ReactComponentType<In, Out>;
222
- /**
223
- * Context passed to custom wrapper functions.
224
- */
225
- export interface WrapperContext {
226
- /** Tool name */
227
- toolName: string;
228
- /** Rendered content HTML */
229
- content: string;
230
- /** Detected renderer type */
231
- rendererType: RendererType;
232
- /** Target platform */
233
- platform: PlatformCapabilities;
234
- /** Runtime scripts to inject */
235
- runtimeScripts: RuntimeScripts;
236
- }
237
- /**
238
- * Extended Tool UI configuration with multi-framework support.
239
- *
240
- * The template type is auto-detected - no need to specify a renderer!
241
- *
242
- * @example React component
243
- * ```typescript
244
- * import { UserCard } from './components/user-card.tsx';
245
- *
246
- * @Tool({
247
- * ui: {
248
- * template: UserCard, // Auto-detected as React
249
- * hydrate: true, // Enable client-side interactivity
250
- * }
251
- * })
252
- * ```
253
- *
254
- * @example MDX template
255
- * ```typescript
256
- * @Tool({
257
- * ui: {
258
- * template: `
259
- * # Welcome
260
- * <UserCard name={output.name} />
261
- * `,
262
- * mdxComponents: { UserCard },
263
- * }
264
- * })
265
- * ```
266
- *
267
- * @example HTML template (unchanged)
268
- * ```typescript
269
- * @Tool({
270
- * ui: {
271
- * template: (ctx) => `<div>${ctx.output.name}</div>`,
272
- * }
273
- * })
274
- * ```
275
- */
276
- export interface ExtendedToolUIConfig<In = unknown, Out = unknown> {
277
- /**
278
- * Template for rendering the UI.
279
- *
280
- * Can be:
281
- * - React component: `({ input, output }) => <div>...</div>`
282
- * - MDX string: `# Title\n<Component />`
283
- * - HTML function: `(ctx) => \`<div>...</div>\``
284
- * - Static HTML string
285
- *
286
- * Type is auto-detected at runtime.
287
- */
288
- template: ToolUITemplate<In, Out>;
289
- /**
290
- * Enable client-side hydration for React components.
291
- * When true, the React runtime is included and components
292
- * become interactive in the browser.
293
- *
294
- * @default false
295
- */
296
- hydrate?: boolean;
297
- /**
298
- * Custom wrapper function to override the default HTML document wrapper.
299
- * Useful for completely custom document structures.
300
- *
301
- * @param content - Rendered template HTML
302
- * @param ctx - Wrapper context with metadata
303
- * @returns Complete HTML document string
304
- */
305
- wrapper?: (content: string, ctx: WrapperContext) => string;
306
- /**
307
- * Custom MDX components available in MDX templates.
308
- * These components can be used directly in MDX content.
309
- *
310
- * @example
311
- * ```typescript
312
- * mdxComponents: {
313
- * UserCard: ({ name }) => <div>{name}</div>,
314
- * Badge: ({ type }) => <span className={type}>...</span>,
315
- * }
316
- * ```
317
- */
318
- mdxComponents?: Record<string, (props: any) => any>;
319
- /** Content Security Policy for the sandboxed widget. */
320
- csp?: {
321
- connectDomains?: string[];
322
- resourceDomains?: string[];
323
- };
324
- /** Whether the widget can invoke tools via the MCP bridge. */
325
- widgetAccessible?: boolean;
326
- /** Preferred display mode for the widget. */
327
- displayMode?: 'inline' | 'fullscreen' | 'pip';
328
- /** Human-readable description shown to users about what the widget does. */
329
- widgetDescription?: string;
330
- /** Status messages shown during tool invocation. */
331
- invocationStatus?: {
332
- invoking?: string;
333
- invoked?: string;
334
- };
335
- /** How the widget HTML should be served to the client. */
336
- servingMode?: 'inline' | 'static' | 'hybrid' | 'direct-url' | 'custom-url';
337
- /** Custom URL for widget serving when `servingMode: 'custom-url'`. */
338
- customWidgetUrl?: string;
339
- /** Path for direct URL serving when `servingMode: 'direct-url'`. */
340
- directPath?: string;
341
- }
342
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/renderers/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAMrD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG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KAAK,GAAG,CAAC,CAAC;IAMpD,wDAAwD;IACxD,GAAG,CAAC,EAAE;QACJ,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;IAEF,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;IAE9C,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,oDAAoD;IACpD,gBAAgB,CAAC,EAAE;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,0DAA0D;IAC1D,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;IAE3E,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,107 +0,0 @@
1
- /**
2
- * Template Type Detection Utilities
3
- *
4
- * Provides functions to detect whether a template is:
5
- * - A React component (imported or inline)
6
- * - A JSX string (needs runtime transpilation)
7
- * - MDX content
8
- * - Plain HTML
9
- */
10
- /**
11
- * Check if a value is a React component (FC or class).
12
- *
13
- * Detection heuristics:
14
- * 1. Has $$typeof symbol (React.memo, React.forwardRef, etc.)
15
- * 2. Has prototype.isReactComponent (class components)
16
- * 3. Is a function with 0-1 parameters (function components)
17
- *
18
- * @param value - Value to check
19
- * @returns True if it's a React component
20
- *
21
- * @example
22
- * ```typescript
23
- * const MyComponent = ({ output }) => <div>{output.name}</div>;
24
- * isReactComponent(MyComponent); // true
25
- *
26
- * const htmlFn = (ctx) => `<div>${ctx.output.name}</div>`;
27
- * isReactComponent(htmlFn); // false (returns string)
28
- * ```
29
- */
30
- export declare function isReactComponent(value: unknown): boolean;
31
- /**
32
- * Check if a function is likely a template builder (returns string).
33
- *
34
- * This is a heuristic based on function characteristics.
35
- *
36
- * @param fn - Function to check
37
- * @returns True if likely a template builder function
38
- */
39
- export declare function isTemplateBuilderFunction(fn: Function): boolean;
40
- /**
41
- * Check if a string contains JSX syntax.
42
- *
43
- * Looks for patterns like:
44
- * - `<Component` - JSX component tags
45
- * - `</Component>` - JSX closing tags
46
- * - `<div className=` - JSX attributes
47
- * - `return (` followed by JSX
48
- *
49
- * @param source - String to check
50
- * @returns True if string contains JSX
51
- *
52
- * @example
53
- * ```typescript
54
- * containsJsx('<div>Hello</div>'); // false (just HTML)
55
- * containsJsx('<MyComponent />'); // true (JSX component)
56
- * containsJsx('function() { return <div /> }'); // true
57
- * ```
58
- */
59
- export declare function containsJsx(source: string): boolean;
60
- /**
61
- * Check if a string contains MDX syntax.
62
- *
63
- * MDX is Markdown with JSX components. Patterns:
64
- * - Frontmatter: `---\ntitle: ...\n---`
65
- * - JSX components: `<Component />`
66
- * - JSX attributes: `className`, `onClick`, `htmlFor`
67
- * - JS expressions: `{variable}` or `{items.map(...)}`
68
- * - Import/export statements
69
- *
70
- * @param source - String to check
71
- * @returns True if string contains MDX syntax
72
- *
73
- * @example
74
- * ```typescript
75
- * containsMdxSyntax('# Title\n<Card />'); // true
76
- * containsMdxSyntax('# Title\n{data.name}'); // true
77
- * containsMdxSyntax('<div className="test">...'); // true (JSX attribute)
78
- * containsMdxSyntax('# Title\nSome text'); // false (just Markdown)
79
- * ```
80
- */
81
- export declare function containsMdxSyntax(source: string): boolean;
82
- /**
83
- * Check if a string is plain HTML (no JSX or MDX).
84
- *
85
- * @param source - String to check
86
- * @returns True if string is plain HTML
87
- */
88
- export declare function isPlainHtml(source: string): boolean;
89
- /**
90
- * Detect the type of a template.
91
- *
92
- * Priority order:
93
- * 1. React component (imported, already transpiled)
94
- * 2. MDX string
95
- * 3. JSX string (needs transpilation)
96
- * 4. HTML template function
97
- * 5. Static HTML string
98
- *
99
- * @param template - Template to analyze
100
- * @returns Detected type and confidence
101
- */
102
- export declare function detectTemplateType(template: unknown): {
103
- type: 'react' | 'mdx' | 'jsx-string' | 'html-function' | 'html-string';
104
- confidence: number;
105
- reason: string;
106
- };
107
- //# sourceMappingURL=detect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../src/renderers/utils/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAuCxD;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAa/D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAqCnD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAkCzD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG;IACrD,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,YAAY,GAAG,eAAe,GAAG,aAAa,CAAC;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CA8DA"}
@@ -1,40 +0,0 @@
1
- /**
2
- * Hash Utilities for Renderer Caching
3
- *
4
- * Fast, non-cryptographic hashing for content-addressable cache keys.
5
- */
6
- /**
7
- * Generate a fast hash string from source content.
8
- * Uses FNV-1a algorithm for good distribution and speed.
9
- *
10
- * @param source - String to hash
11
- * @returns Base36 encoded hash string
12
- *
13
- * @example
14
- * ```typescript
15
- * const hash = hashString('function Component() { return <div>Hello</div> }');
16
- * // Returns something like "1a2b3c4d"
17
- * ```
18
- */
19
- export declare function hashString(source: string): string;
20
- /**
21
- * Generate a hash combining multiple values.
22
- * Useful for creating cache keys from multiple inputs.
23
- *
24
- * @param values - Values to combine into a hash
25
- * @returns Combined hash string
26
- *
27
- * @example
28
- * ```typescript
29
- * const key = hashCombined('template-source', { location: 'NYC' }, { temp: 72 });
30
- * ```
31
- */
32
- export declare function hashCombined(...values: unknown[]): string;
33
- /**
34
- * Check if a string likely represents a hash (short alphanumeric).
35
- *
36
- * @param value - Value to check
37
- * @returns True if it looks like a hash
38
- */
39
- export declare function isHash(value: string): boolean;
40
- //# sourceMappingURL=hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/renderers/utils/hash.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAWjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAezD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG7C"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Renderer Utilities
3
- *
4
- * Utility functions for template detection, hashing, and transpilation.
5
- */
6
- export { isReactComponent, isTemplateBuilderFunction, containsJsx, containsMdxSyntax, isPlainHtml, detectTemplateType, } from './detect';
7
- export { hashString, hashCombined, isHash } from './hash';
8
- export { transpileJsx, isSwcAvailable, executeTranspiledCode, transpileAndExecute } from './transpiler';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
@@ -1,89 +0,0 @@
1
- /**
2
- * Runtime JSX/TSX Transpiler
3
- *
4
- * Uses SWC to transpile JSX/TSX strings to executable JavaScript at runtime.
5
- * This enables dynamic React templates without requiring a build step.
6
- */
7
- import type { TranspileResult } from '../types';
8
- /**
9
- * SWC transformation options for JSX.
10
- */
11
- interface SwcTransformOptions {
12
- /** Enable TypeScript syntax */
13
- typescript?: boolean;
14
- /** Enable JSX syntax */
15
- jsx?: boolean;
16
- /** JSX runtime mode ('automatic' for React 17+, 'classic' for older) */
17
- jsxRuntime?: 'automatic' | 'classic';
18
- /** Enable development mode (better error messages) */
19
- development?: boolean;
20
- }
21
- /**
22
- * Transpile a JSX/TSX string to executable JavaScript.
23
- *
24
- * Uses SWC with React 17+ automatic JSX runtime.
25
- * Results are cached by content hash.
26
- *
27
- * @param source - JSX/TSX source code string
28
- * @param options - Transpilation options
29
- * @returns Transpiled result with code and caching metadata
30
- *
31
- * @example
32
- * ```typescript
33
- * const source = `
34
- * function Widget({ output }) {
35
- * return <div>{output.name}</div>;
36
- * }
37
- * `;
38
- *
39
- * const result = await transpileJsx(source);
40
- * console.log(result.code); // JavaScript code
41
- * console.log(result.cached); // Whether from cache
42
- * ```
43
- */
44
- export declare function transpileJsx(source: string, options?: SwcTransformOptions): Promise<TranspileResult>;
45
- /**
46
- * Check if SWC is available for runtime transpilation.
47
- *
48
- * @returns Promise resolving to true if SWC is available
49
- */
50
- export declare function isSwcAvailable(): Promise<boolean>;
51
- /**
52
- * Execute transpiled JavaScript code and extract the component.
53
- *
54
- * Creates a sandboxed environment with React available,
55
- * executes the code, and returns the exported component.
56
- *
57
- * @param code - Transpiled JavaScript code
58
- * @param context - Additional context to inject
59
- * @returns The exported component or default export
60
- *
61
- * @example
62
- * ```typescript
63
- * const code = `
64
- * "use strict";
65
- * Object.defineProperty(exports, "__esModule", { value: true });
66
- * const jsx_runtime = require("react/jsx-runtime");
67
- * function Widget(props) {
68
- * return jsx_runtime.jsx("div", { children: props.output.name });
69
- * }
70
- * exports.default = Widget;
71
- * `;
72
- *
73
- * const Component = await executeTranspiledCode(code);
74
- * // Component is now a usable React component function
75
- * ```
76
- */
77
- export declare function executeTranspiledCode(code: string, context?: Record<string, any>): Promise<any>;
78
- /**
79
- * Transpile and execute a JSX string, returning the component.
80
- *
81
- * Convenience function that combines transpileJsx and executeTranspiledCode.
82
- *
83
- * @param source - JSX/TSX source code
84
- * @param context - Additional context for execution
85
- * @returns The component function
86
- */
87
- export declare function transpileAndExecute(source: string, context?: Record<string, any>): Promise<any>;
88
- export {};
89
- //# sourceMappingURL=transpiler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/renderers/utils/transpiler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,UAAU,mBAAmB;IAC3B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wBAAwB;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,wEAAwE;IACxE,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAyCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC,CAwD9G;AAED;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAGvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EAEZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAEhC,OAAO,CAAC,GAAG,CAAC,CA+Cd;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EAEd,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAEhC,OAAO,CAAC,GAAG,CAAC,CAGd"}
@@ -1,59 +0,0 @@
1
- /**
2
- * HTML Renderer Adapter
3
- *
4
- * Client-side adapter for rendering HTML templates.
5
- * Handles plain HTML and Handlebars-enhanced templates.
6
- *
7
- * @packageDocumentation
8
- */
9
- import type { RendererAdapter, RenderContext, RenderOptions, RenderResult } from './types';
10
- import type { UIType } from '../../types/ui-runtime';
11
- /**
12
- * HTML Renderer Adapter.
13
- *
14
- * Renders HTML templates to the DOM with support for:
15
- * - Plain HTML strings
16
- * - Handlebars-enhanced templates ({{...}} syntax)
17
- * - Template builder functions
18
- */
19
- export declare class HtmlRendererAdapter implements RendererAdapter {
20
- readonly type: UIType;
21
- private handlebarsRenderer;
22
- /**
23
- * Check if this adapter can handle the given content.
24
- */
25
- canHandle(content: string | unknown): boolean;
26
- /**
27
- * Render HTML content to a string.
28
- */
29
- render(content: string, context: RenderContext, _options?: RenderOptions): Promise<string>;
30
- /**
31
- * Render HTML content directly to the DOM.
32
- */
33
- renderToDOM(content: string, target: HTMLElement, context: RenderContext, _options?: RenderOptions): Promise<RenderResult>;
34
- /**
35
- * Update rendered content with new data.
36
- */
37
- update(target: HTMLElement, context: RenderContext): Promise<RenderResult>;
38
- /**
39
- * Clean up (no-op for HTML adapter).
40
- */
41
- destroy(_target: HTMLElement): void;
42
- /**
43
- * Check if content contains Handlebars syntax.
44
- */
45
- private containsHandlebars;
46
- /**
47
- * Render Handlebars template.
48
- */
49
- private renderHandlebars;
50
- }
51
- /**
52
- * Create a new HTML renderer adapter.
53
- */
54
- export declare function createHtmlAdapter(): HtmlRendererAdapter;
55
- /**
56
- * Adapter loader for lazy loading.
57
- */
58
- export declare function loadHtmlAdapter(): Promise<RendererAdapter>;
59
- //# sourceMappingURL=html.adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html.adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/adapters/html.adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;GAOG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAU;IAG/B,OAAO,CAAC,kBAAkB,CAGV;IAEhB;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO;IAK7C;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhG;;OAEG;IACG,WAAW,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,aAAa,EACtB,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,YAAY,CAAC;IAqBxB;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAYhF;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAInC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;YACW,gBAAgB;CA4B/B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAEvD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,CAEhE"}