@frontmcp/ui 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/bridge/core/bridge-factory.d.ts +1 -0
  2. package/bridge/core/bridge-factory.d.ts.map +1 -1
  3. package/bridge/index.d.ts +1 -1
  4. package/bridge/index.d.ts.map +1 -1
  5. package/bridge/index.js +39 -881
  6. package/bundler/browser-components.d.ts +42 -0
  7. package/bundler/browser-components.d.ts.map +1 -0
  8. package/bundler/bundler.d.ts +78 -4
  9. package/bundler/bundler.d.ts.map +1 -1
  10. package/bundler/index.d.ts +8 -8
  11. package/bundler/index.d.ts.map +1 -1
  12. package/bundler/index.js +1315 -1854
  13. package/bundler/types.d.ts +188 -7
  14. package/bundler/types.d.ts.map +1 -1
  15. package/esm/bridge/{index.js → index.mjs} +40 -877
  16. package/esm/bundler/{index.js → index.mjs} +1391 -1895
  17. package/esm/{index.js → index.mjs} +215 -3091
  18. package/esm/layouts/{index.js → index.mjs} +3 -3
  19. package/esm/package.json +9 -8
  20. package/esm/react/index.mjs +1183 -0
  21. package/esm/renderers/index.mjs +611 -0
  22. package/esm/universal/{index.js → index.mjs} +266 -70
  23. package/index.d.ts +1 -4
  24. package/index.d.ts.map +1 -1
  25. package/index.js +208 -3113
  26. package/layouts/base.d.ts.map +1 -1
  27. package/layouts/index.js +3 -3
  28. package/layouts/presets.d.ts.map +1 -1
  29. package/package.json +9 -8
  30. package/react/Badge.d.ts.map +1 -1
  31. package/react/hooks/context.d.ts.map +1 -1
  32. package/react/index.d.ts +0 -1
  33. package/react/index.d.ts.map +1 -1
  34. package/react/index.js +57 -2001
  35. package/react/types.d.ts.map +1 -1
  36. package/renderers/index.d.ts +9 -4
  37. package/renderers/index.d.ts.map +1 -1
  38. package/renderers/index.js +328 -88
  39. package/renderers/mdx.renderer.d.ts +99 -0
  40. package/renderers/mdx.renderer.d.ts.map +1 -0
  41. package/renderers/react.renderer.d.ts +22 -13
  42. package/renderers/react.renderer.d.ts.map +1 -1
  43. package/renderers/transpiler.d.ts +49 -0
  44. package/renderers/transpiler.d.ts.map +1 -0
  45. package/universal/cached-runtime.d.ts +25 -1
  46. package/universal/cached-runtime.d.ts.map +1 -1
  47. package/universal/index.js +266 -70
  48. package/universal/runtime-builder.d.ts.map +1 -1
  49. package/universal/types.d.ts.map +1 -1
  50. package/web-components/elements/fmcp-input.d.ts.map +1 -1
  51. package/web-components/elements/fmcp-select.d.ts.map +1 -1
  52. package/web-components/index.d.ts +0 -1
  53. package/web-components/index.d.ts.map +1 -1
  54. package/bundler/cache.d.ts +0 -173
  55. package/bundler/cache.d.ts.map +0 -1
  56. package/bundler/file-cache/component-builder.d.ts +0 -167
  57. package/bundler/file-cache/component-builder.d.ts.map +0 -1
  58. package/bundler/file-cache/hash-calculator.d.ts +0 -155
  59. package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  60. package/bundler/file-cache/index.d.ts +0 -12
  61. package/bundler/file-cache/index.d.ts.map +0 -1
  62. package/bundler/file-cache/storage/filesystem.d.ts +0 -149
  63. package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  64. package/bundler/file-cache/storage/index.d.ts +0 -11
  65. package/bundler/file-cache/storage/index.d.ts.map +0 -1
  66. package/bundler/file-cache/storage/interface.d.ts +0 -152
  67. package/bundler/file-cache/storage/interface.d.ts.map +0 -1
  68. package/bundler/file-cache/storage/redis.d.ts +0 -139
  69. package/bundler/file-cache/storage/redis.d.ts.map +0 -1
  70. package/bundler/sandbox/enclave-adapter.d.ts +0 -121
  71. package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  72. package/bundler/sandbox/executor.d.ts +0 -14
  73. package/bundler/sandbox/executor.d.ts.map +0 -1
  74. package/bundler/sandbox/policy.d.ts +0 -62
  75. package/bundler/sandbox/policy.d.ts.map +0 -1
  76. package/esm/bridge/adapters/base-adapter.d.ts +0 -104
  77. package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
  78. package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
  79. package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
  80. package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
  81. package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
  82. package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
  83. package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
  84. package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
  85. package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
  86. package/esm/bridge/adapters/index.d.ts +0 -26
  87. package/esm/bridge/adapters/index.d.ts.map +0 -1
  88. package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
  89. package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
  90. package/esm/bridge/core/adapter-registry.d.ts +0 -122
  91. package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
  92. package/esm/bridge/core/bridge-factory.d.ts +0 -199
  93. package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
  94. package/esm/bridge/core/index.d.ts +0 -10
  95. package/esm/bridge/core/index.d.ts.map +0 -1
  96. package/esm/bridge/index.d.ts +0 -62
  97. package/esm/bridge/index.d.ts.map +0 -1
  98. package/esm/bridge/runtime/iife-generator.d.ts +0 -62
  99. package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
  100. package/esm/bridge/runtime/index.d.ts +0 -10
  101. package/esm/bridge/runtime/index.d.ts.map +0 -1
  102. package/esm/bridge/types.d.ts +0 -386
  103. package/esm/bridge/types.d.ts.map +0 -1
  104. package/esm/bundler/bundler.d.ts +0 -208
  105. package/esm/bundler/bundler.d.ts.map +0 -1
  106. package/esm/bundler/cache.d.ts +0 -173
  107. package/esm/bundler/cache.d.ts.map +0 -1
  108. package/esm/bundler/file-cache/component-builder.d.ts +0 -167
  109. package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
  110. package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
  111. package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  112. package/esm/bundler/file-cache/index.d.ts +0 -12
  113. package/esm/bundler/file-cache/index.d.ts.map +0 -1
  114. package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
  115. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  116. package/esm/bundler/file-cache/storage/index.d.ts +0 -11
  117. package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
  118. package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
  119. package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
  120. package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
  121. package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
  122. package/esm/bundler/index.d.ts +0 -43
  123. package/esm/bundler/index.d.ts.map +0 -1
  124. package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
  125. package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  126. package/esm/bundler/sandbox/executor.d.ts +0 -14
  127. package/esm/bundler/sandbox/executor.d.ts.map +0 -1
  128. package/esm/bundler/sandbox/policy.d.ts +0 -62
  129. package/esm/bundler/sandbox/policy.d.ts.map +0 -1
  130. package/esm/bundler/types.d.ts +0 -702
  131. package/esm/bundler/types.d.ts.map +0 -1
  132. package/esm/components/alert.d.ts +0 -66
  133. package/esm/components/alert.d.ts.map +0 -1
  134. package/esm/components/alert.schema.d.ts +0 -98
  135. package/esm/components/alert.schema.d.ts.map +0 -1
  136. package/esm/components/avatar.d.ts +0 -77
  137. package/esm/components/avatar.d.ts.map +0 -1
  138. package/esm/components/avatar.schema.d.ts +0 -170
  139. package/esm/components/avatar.schema.d.ts.map +0 -1
  140. package/esm/components/badge.d.ts +0 -64
  141. package/esm/components/badge.d.ts.map +0 -1
  142. package/esm/components/badge.schema.d.ts +0 -91
  143. package/esm/components/badge.schema.d.ts.map +0 -1
  144. package/esm/components/button.d.ts +0 -100
  145. package/esm/components/button.d.ts.map +0 -1
  146. package/esm/components/button.schema.d.ts +0 -120
  147. package/esm/components/button.schema.d.ts.map +0 -1
  148. package/esm/components/card.d.ts +0 -53
  149. package/esm/components/card.d.ts.map +0 -1
  150. package/esm/components/card.schema.d.ts +0 -93
  151. package/esm/components/card.schema.d.ts.map +0 -1
  152. package/esm/components/form.d.ts +0 -212
  153. package/esm/components/form.d.ts.map +0 -1
  154. package/esm/components/form.schema.d.ts +0 -365
  155. package/esm/components/form.schema.d.ts.map +0 -1
  156. package/esm/components/index.d.ts +0 -29
  157. package/esm/components/index.d.ts.map +0 -1
  158. package/esm/components/list.d.ts +0 -121
  159. package/esm/components/list.d.ts.map +0 -1
  160. package/esm/components/list.schema.d.ts +0 -129
  161. package/esm/components/list.schema.d.ts.map +0 -1
  162. package/esm/components/modal.d.ts +0 -100
  163. package/esm/components/modal.d.ts.map +0 -1
  164. package/esm/components/modal.schema.d.ts +0 -151
  165. package/esm/components/modal.schema.d.ts.map +0 -1
  166. package/esm/components/table.d.ts +0 -91
  167. package/esm/components/table.d.ts.map +0 -1
  168. package/esm/components/table.schema.d.ts +0 -123
  169. package/esm/components/table.schema.d.ts.map +0 -1
  170. package/esm/index.d.ts +0 -40
  171. package/esm/index.d.ts.map +0 -1
  172. package/esm/layouts/base.d.ts +0 -86
  173. package/esm/layouts/base.d.ts.map +0 -1
  174. package/esm/layouts/index.d.ts +0 -8
  175. package/esm/layouts/index.d.ts.map +0 -1
  176. package/esm/layouts/presets.d.ts +0 -134
  177. package/esm/layouts/presets.d.ts.map +0 -1
  178. package/esm/pages/consent.d.ts +0 -117
  179. package/esm/pages/consent.d.ts.map +0 -1
  180. package/esm/pages/error.d.ts +0 -101
  181. package/esm/pages/error.d.ts.map +0 -1
  182. package/esm/pages/index.d.ts +0 -9
  183. package/esm/pages/index.d.ts.map +0 -1
  184. package/esm/pages/index.js +0 -1036
  185. package/esm/react/Alert.d.ts +0 -101
  186. package/esm/react/Alert.d.ts.map +0 -1
  187. package/esm/react/Badge.d.ts +0 -100
  188. package/esm/react/Badge.d.ts.map +0 -1
  189. package/esm/react/Button.d.ts +0 -108
  190. package/esm/react/Button.d.ts.map +0 -1
  191. package/esm/react/Card.d.ts +0 -103
  192. package/esm/react/Card.d.ts.map +0 -1
  193. package/esm/react/hooks/context.d.ts +0 -179
  194. package/esm/react/hooks/context.d.ts.map +0 -1
  195. package/esm/react/hooks/index.d.ts +0 -42
  196. package/esm/react/hooks/index.d.ts.map +0 -1
  197. package/esm/react/hooks/tools.d.ts +0 -284
  198. package/esm/react/hooks/tools.d.ts.map +0 -1
  199. package/esm/react/index.d.ts +0 -80
  200. package/esm/react/index.d.ts.map +0 -1
  201. package/esm/react/index.js +0 -3124
  202. package/esm/react/types.d.ts +0 -105
  203. package/esm/react/types.d.ts.map +0 -1
  204. package/esm/react/utils.d.ts +0 -43
  205. package/esm/react/utils.d.ts.map +0 -1
  206. package/esm/render/index.d.ts +0 -8
  207. package/esm/render/index.d.ts.map +0 -1
  208. package/esm/render/prerender.d.ts +0 -57
  209. package/esm/render/prerender.d.ts.map +0 -1
  210. package/esm/renderers/index.d.ts +0 -21
  211. package/esm/renderers/index.d.ts.map +0 -1
  212. package/esm/renderers/index.js +0 -381
  213. package/esm/renderers/react.adapter.d.ts +0 -70
  214. package/esm/renderers/react.adapter.d.ts.map +0 -1
  215. package/esm/renderers/react.renderer.d.ts +0 -96
  216. package/esm/renderers/react.renderer.d.ts.map +0 -1
  217. package/esm/universal/UniversalApp.d.ts +0 -108
  218. package/esm/universal/UniversalApp.d.ts.map +0 -1
  219. package/esm/universal/cached-runtime.d.ts +0 -115
  220. package/esm/universal/cached-runtime.d.ts.map +0 -1
  221. package/esm/universal/context.d.ts +0 -122
  222. package/esm/universal/context.d.ts.map +0 -1
  223. package/esm/universal/index.d.ts +0 -57
  224. package/esm/universal/index.d.ts.map +0 -1
  225. package/esm/universal/renderers/html.renderer.d.ts +0 -37
  226. package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
  227. package/esm/universal/renderers/index.d.ts +0 -112
  228. package/esm/universal/renderers/index.d.ts.map +0 -1
  229. package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
  230. package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
  231. package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
  232. package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
  233. package/esm/universal/renderers/react.renderer.d.ts +0 -46
  234. package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
  235. package/esm/universal/runtime-builder.d.ts +0 -33
  236. package/esm/universal/runtime-builder.d.ts.map +0 -1
  237. package/esm/universal/store.d.ts +0 -135
  238. package/esm/universal/store.d.ts.map +0 -1
  239. package/esm/universal/types.d.ts +0 -199
  240. package/esm/universal/types.d.ts.map +0 -1
  241. package/esm/web-components/core/attribute-parser.d.ts +0 -82
  242. package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
  243. package/esm/web-components/core/base-element.d.ts +0 -197
  244. package/esm/web-components/core/base-element.d.ts.map +0 -1
  245. package/esm/web-components/core/index.d.ts +0 -9
  246. package/esm/web-components/core/index.d.ts.map +0 -1
  247. package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
  248. package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
  249. package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
  250. package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
  251. package/esm/web-components/elements/fmcp-button.d.ts +0 -117
  252. package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
  253. package/esm/web-components/elements/fmcp-card.d.ts +0 -53
  254. package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
  255. package/esm/web-components/elements/fmcp-input.d.ts +0 -96
  256. package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
  257. package/esm/web-components/elements/fmcp-select.d.ts +0 -100
  258. package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
  259. package/esm/web-components/elements/index.d.ts +0 -13
  260. package/esm/web-components/elements/index.d.ts.map +0 -1
  261. package/esm/web-components/index.d.ts +0 -50
  262. package/esm/web-components/index.d.ts.map +0 -1
  263. package/esm/web-components/register.d.ts +0 -57
  264. package/esm/web-components/register.d.ts.map +0 -1
  265. package/esm/web-components/types.d.ts +0 -122
  266. package/esm/web-components/types.d.ts.map +0 -1
  267. package/esm/widgets/index.d.ts +0 -8
  268. package/esm/widgets/index.d.ts.map +0 -1
  269. package/esm/widgets/index.js +0 -883
  270. package/esm/widgets/progress.d.ts +0 -133
  271. package/esm/widgets/progress.d.ts.map +0 -1
  272. package/esm/widgets/resource.d.ts +0 -163
  273. package/esm/widgets/resource.d.ts.map +0 -1
  274. package/pages/consent.d.ts +0 -117
  275. package/pages/consent.d.ts.map +0 -1
  276. package/pages/error.d.ts +0 -101
  277. package/pages/error.d.ts.map +0 -1
  278. package/pages/index.d.ts +0 -9
  279. package/pages/index.d.ts.map +0 -1
  280. package/pages/index.js +0 -1065
  281. package/react/utils.d.ts +0 -43
  282. package/react/utils.d.ts.map +0 -1
  283. package/widgets/index.d.ts +0 -8
  284. package/widgets/index.d.ts.map +0 -1
  285. package/widgets/index.js +0 -910
  286. package/widgets/progress.d.ts +0 -133
  287. package/widgets/progress.d.ts.map +0 -1
  288. package/widgets/resource.d.ts +0 -163
  289. package/widgets/resource.d.ts.map +0 -1
  290. /package/esm/components/{index.js → index.mjs} +0 -0
  291. /package/esm/render/{index.js → index.mjs} +0 -0
  292. /package/esm/web-components/{index.js → index.mjs} +0 -0
@@ -1,105 +0,0 @@
1
- /**
2
- * @file types.ts
3
- * @description TypeScript types for React wrapper components.
4
- *
5
- * Re-exports element types from web-components for use with React refs,
6
- * and defines React-specific prop interfaces.
7
- *
8
- * @module @frontmcp/ui/react/types
9
- */
10
- import type { ReactNode } from 'react';
11
- import type { CardVariant, CardSize, BadgeVariant, BadgeSize } from '../components';
12
- export type { FmcpButton, FmcpCard, FmcpAlert, FmcpBadge, FmcpInput, FmcpSelect } from '../web-components';
13
- /**
14
- * React props for Card component
15
- */
16
- export interface CardProps {
17
- /** Card title */
18
- title?: string;
19
- /** Card subtitle/description */
20
- subtitle?: string;
21
- /** Header actions content */
22
- headerActions?: ReactNode;
23
- /** Footer content */
24
- footer?: ReactNode;
25
- /** Card variant */
26
- variant?: CardVariant;
27
- /** Card size (padding) */
28
- size?: CardSize;
29
- /** Additional CSS classes */
30
- className?: string;
31
- /** Card ID */
32
- id?: string;
33
- /** Clickable card (adds hover effects) */
34
- clickable?: boolean;
35
- /** Click handler URL */
36
- href?: string;
37
- /** Card content */
38
- children: ReactNode;
39
- }
40
- /**
41
- * React props for Badge component
42
- */
43
- export interface BadgeProps {
44
- /** Badge variant */
45
- variant?: BadgeVariant;
46
- /** Badge size */
47
- size?: BadgeSize;
48
- /** Rounded pill style */
49
- pill?: boolean;
50
- /** Icon before text (ReactNode) */
51
- icon?: ReactNode;
52
- /** Dot indicator (no text) */
53
- dot?: boolean;
54
- /** Additional CSS classes */
55
- className?: string;
56
- /** Removable badge */
57
- removable?: boolean;
58
- /** Badge content */
59
- children?: ReactNode;
60
- }
61
- /**
62
- * React props for Button component
63
- */
64
- export interface ButtonProps {
65
- /** Button variant */
66
- variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success';
67
- /** Button size */
68
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
69
- /** Disabled state */
70
- disabled?: boolean;
71
- /** Loading state */
72
- loading?: boolean;
73
- /** Full width */
74
- fullWidth?: boolean;
75
- /** Icon position */
76
- iconPosition?: 'left' | 'right';
77
- /** Icon content */
78
- icon?: ReactNode;
79
- /** Button type */
80
- type?: 'button' | 'submit' | 'reset';
81
- /** Additional CSS classes */
82
- className?: string;
83
- /** Click handler */
84
- onClick?: () => void;
85
- /** Button content */
86
- children: ReactNode;
87
- }
88
- /**
89
- * React props for Alert component
90
- */
91
- export interface AlertProps {
92
- /** Alert variant */
93
- variant?: 'info' | 'success' | 'warning' | 'danger';
94
- /** Alert title */
95
- title?: string;
96
- /** Icon content */
97
- icon?: ReactNode;
98
- /** Dismissible */
99
- dismissible?: boolean;
100
- /** Additional CSS classes */
101
- className?: string;
102
- /** Alert content */
103
- children: ReactNode;
104
- }
105
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":"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"}
@@ -1,43 +0,0 @@
1
- /**
2
- * @file utils.ts
3
- * @description Utility functions for React wrapper components.
4
- *
5
- * Provides helpers for converting React children to HTML strings
6
- * for SSR compatibility with FrontMCP web components.
7
- *
8
- * @module @frontmcp/ui/react/utils
9
- */
10
- import type { ReactNode } from 'react';
11
- /**
12
- * Convert React children to an HTML string for SSR.
13
- *
14
- * - Strings are escaped via escapeHtml()
15
- * - Numbers are converted to strings
16
- * - ReactNode is rendered via ReactDOMServer.renderToStaticMarkup()
17
- * - null/undefined return empty string
18
- *
19
- * @param children - React children to convert
20
- * @returns HTML string representation
21
- *
22
- * @example
23
- * ```tsx
24
- * // String children
25
- * renderChildrenToString('Hello') // 'Hello' (escaped)
26
- *
27
- * // React element children
28
- * renderChildrenToString(<div>Test</div>) // '<div>Test</div>'
29
- *
30
- * // Mixed children
31
- * renderChildrenToString(['Hello', <span>World</span>])
32
- * ```
33
- */
34
- export declare function renderChildrenToString(children: ReactNode): string;
35
- /**
36
- * Check if we're running in a browser environment
37
- */
38
- export declare function isBrowser(): boolean;
39
- /**
40
- * Check if we're running in a Node.js environment
41
- */
42
- export declare function isServer(): boolean;
43
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/react/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAoBvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,GAAG,MAAM,CAiClE;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAElC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * @file render/index.ts
3
- * @description React 19 static rendering utilities.
4
- *
5
- * @module @frontmcp/ui/render
6
- */
7
- export { renderToString, renderToStringSync, isReactAvailable } from './prerender';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,57 +0,0 @@
1
- /**
2
- * @file prerender.ts
3
- * @description React 19 static rendering utilities.
4
- *
5
- * Provides both async (prerender) and sync (renderToStaticMarkup) methods
6
- * for converting React elements to HTML strings.
7
- *
8
- * @example Async rendering (recommended)
9
- * ```typescript
10
- * import { renderToString } from '@frontmcp/ui/render';
11
- * import { Card } from '@frontmcp/ui/components';
12
- *
13
- * const html = await renderToString(<Card title="Hello">Content</Card>);
14
- * ```
15
- *
16
- * @example Sync rendering (backwards compatible)
17
- * ```typescript
18
- * import { renderToStringSync } from '@frontmcp/ui/render';
19
- *
20
- * const html = renderToStringSync(<Card title="Hello">Content</Card>);
21
- * ```
22
- *
23
- * @module @frontmcp/ui/render
24
- */
25
- import type { ReactElement } from 'react';
26
- /**
27
- * Render a React element to static HTML string using React 19's prerender API.
28
- *
29
- * This is the recommended async method that:
30
- * - Waits for all Suspense boundaries to resolve
31
- * - Uses React 19's streaming prerender API
32
- * - Returns clean static HTML without hydration markers
33
- *
34
- * @param element - The React element to render
35
- * @returns Promise resolving to HTML string
36
- */
37
- export declare function renderToString(element: ReactElement): Promise<string>;
38
- /**
39
- * Render a React element to static HTML string synchronously.
40
- *
41
- * This is the sync method for backwards compatibility that:
42
- * - Does NOT wait for Suspense boundaries
43
- * - Uses React's renderToStaticMarkup
44
- * - Returns clean static HTML without hydration markers
45
- *
46
- * @param element - The React element to render
47
- * @returns HTML string
48
- */
49
- export declare function renderToStringSync(element: ReactElement): string;
50
- /**
51
- * Check if React and react-dom are available.
52
- * Useful for conditional rendering in environments where React may not be installed.
53
- *
54
- * @returns true if React and react-dom are available
55
- */
56
- export declare function isReactAvailable(): boolean;
57
- //# sourceMappingURL=prerender.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../../src/render/prerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B3E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAKhE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAQ1C"}
@@ -1,21 +0,0 @@
1
- /**
2
- * React Renderer Module
3
- *
4
- * Provides the React renderer for template processing.
5
- * Other renderers (HTML, MDX) and utilities are available in @frontmcp/uipack.
6
- *
7
- * @module @frontmcp/ui/renderers
8
- *
9
- * @example
10
- * ```typescript
11
- * import { reactRenderer, ReactRenderer } from '@frontmcp/ui/renderers';
12
- * import { rendererRegistry } from '@frontmcp/uipack/renderers';
13
- *
14
- * // Register React renderer
15
- * rendererRegistry.register(reactRenderer);
16
- * ```
17
- */
18
- export type { RendererType, UIRenderer, ToolUIProps, HydratedToolUIProps, TranspileResult, TranspileOptions, RenderOptions, RuntimeScripts, RenderResult, RendererRegistryOptions, DetectionResult, ReactComponentType, WrapperContext, ExtendedToolUIConfig, } from '@frontmcp/uipack/renderers';
19
- export { ReactRenderer, reactRenderer, buildHydrationScript } from './react.renderer';
20
- export { ReactRendererAdapter, createReactAdapter, loadReactAdapter } from './react.adapter';
21
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,YAAY,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,381 +0,0 @@
1
- // libs/ui/src/renderers/react.renderer.ts
2
- import {
3
- isReactComponent,
4
- containsJsx,
5
- hashString,
6
- transpileJsx,
7
- executeTranspiledCode,
8
- transpileCache
9
- } from "@frontmcp/uipack/renderers";
10
- var REACT_CDN = {
11
- react: "https://esm.sh/react@19",
12
- reactDom: "https://esm.sh/react-dom@19/client"
13
- };
14
- var INLINE_REACT_PLACEHOLDER = `
15
- // React runtime not available inline yet.
16
- // For blocked-network platforms, use pre-rendered HTML templates.
17
- console.warn('[FrontMCP] React hydration not available on this platform.');
18
- `;
19
- var ReactRenderer = class {
20
- type = "react";
21
- priority = 20;
22
- // Higher priority than HTML
23
- /**
24
- * Lazy-loaded React modules.
25
- */
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- React = null;
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- ReactDOMServer = null;
30
- /**
31
- * Check if this renderer can handle the given template.
32
- *
33
- * Accepts:
34
- * - React component functions (imported, already transpiled)
35
- * - Strings containing JSX syntax
36
- */
37
- canHandle(template) {
38
- if (typeof template === "function" && isReactComponent(template)) {
39
- return true;
40
- }
41
- if (typeof template === "string" && containsJsx(template)) {
42
- return true;
43
- }
44
- return false;
45
- }
46
- /**
47
- * Transpile the template if needed.
48
- *
49
- * For imported React components, no transpilation is needed.
50
- * For JSX strings, SWC transpilation is performed.
51
- */
52
- async transpile(template, options) {
53
- if (typeof template === "function") {
54
- const hash = hashString(template.toString());
55
- return {
56
- code: "",
57
- // No transpiled code for already-compiled components
58
- hash,
59
- cached: true
60
- };
61
- }
62
- if (typeof template === "string") {
63
- return transpileJsx(template, {
64
- development: options?.sourceMaps ?? false
65
- });
66
- }
67
- throw new Error("Invalid template type for ReactRenderer");
68
- }
69
- /**
70
- * Render the template to HTML string using react-dom/server.
71
- */
72
- async render(template, context, options) {
73
- await this.loadReact();
74
- let Component;
75
- if (typeof template === "function") {
76
- Component = template;
77
- } else if (typeof template === "string") {
78
- const transpiled = await this.transpile(template);
79
- const cached = transpileCache.getByKey(`exec:${transpiled.hash}`);
80
- if (cached) {
81
- Component = cached.code;
82
- } else {
83
- Component = await executeTranspiledCode(transpiled.code, {
84
- // Provide any additional MDX components if specified
85
- ...options?.mdxComponents
86
- });
87
- transpileCache.setByKey(`exec:${transpiled.hash}`, {
88
- code: Component,
89
- hash: transpiled.hash,
90
- cached: false
91
- });
92
- }
93
- } else {
94
- throw new Error("Invalid template type for ReactRenderer");
95
- }
96
- const props = {
97
- input: context.input,
98
- output: context.output,
99
- structuredContent: context.structuredContent,
100
- helpers: context.helpers
101
- };
102
- const element = this.React.createElement(Component, props);
103
- const html = this.ReactDOMServer.renderToString(element);
104
- if (options?.hydrate) {
105
- const componentName = Component.name || "Component";
106
- const escapedProps = JSON.stringify(props).replace(/&/g, "&amp;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
107
- return `<div data-hydrate="${componentName}" data-props='${escapedProps}'>${html}</div>`;
108
- }
109
- return html;
110
- }
111
- /**
112
- * Get runtime scripts for client-side functionality.
113
- */
114
- getRuntimeScripts(platform) {
115
- if (platform.networkMode === "blocked") {
116
- return {
117
- headScripts: "",
118
- inlineScripts: INLINE_REACT_PLACEHOLDER,
119
- isInline: true
120
- };
121
- }
122
- return {
123
- headScripts: `
124
- <script crossorigin src="${REACT_CDN.react}"></script>
125
- <script crossorigin src="${REACT_CDN.reactDom}"></script>
126
- `,
127
- isInline: false
128
- };
129
- }
130
- /**
131
- * Load React and ReactDOMServer modules.
132
- */
133
- async loadReact() {
134
- if (this.React && this.ReactDOMServer) {
135
- return;
136
- }
137
- try {
138
- this.React = await import("react");
139
- this.ReactDOMServer = await import("react-dom/server");
140
- } catch {
141
- throw new Error("React is required for ReactRenderer. Install react and react-dom: npm install react react-dom");
142
- }
143
- }
144
- };
145
- var reactRenderer = new ReactRenderer();
146
- function buildHydrationScript() {
147
- return `
148
- <script>
149
- (function() {
150
- // Wait for React to be available
151
- if (typeof React === 'undefined' || typeof ReactDOM === 'undefined') {
152
- console.warn('[FrontMCP] React not available for hydration');
153
- return;
154
- }
155
-
156
- // Find all elements marked for hydration
157
- document.querySelectorAll('[data-hydrate]').forEach(function(root) {
158
- var componentName = root.getAttribute('data-hydrate');
159
- var propsJson = root.getAttribute('data-props');
160
- var props = propsJson ? JSON.parse(propsJson) : {};
161
-
162
- // Look for the component in the global scope
163
- if (window.__frontmcp_components && window.__frontmcp_components[componentName]) {
164
- try {
165
- ReactDOM.hydrateRoot(root, React.createElement(
166
- window.__frontmcp_components[componentName],
167
- props
168
- ));
169
- } catch (e) {
170
- console.error('[FrontMCP] Hydration failed for', componentName, e);
171
- }
172
- }
173
- });
174
- })();
175
- </script>
176
- `;
177
- }
178
-
179
- // libs/ui/src/renderers/react.adapter.ts
180
- var mountedRoots = /* @__PURE__ */ new WeakMap();
181
- var ReactRendererAdapter = class {
182
- type = "react";
183
- // Lazy-loaded React runtime
184
- react = null;
185
- reactDOM = null;
186
- loadPromise = null;
187
- /**
188
- * Check if this adapter can handle the given content.
189
- */
190
- canHandle(content) {
191
- if (typeof content === "function") {
192
- return true;
193
- }
194
- if (typeof content === "string") {
195
- return content.includes("React.createElement") || content.includes("jsx(") || content.includes("jsxs(") || /function\s+\w+\s*\([^)]*\)\s*\{[\s\S]*return\s*[\s\S]*</.test(content);
196
- }
197
- return false;
198
- }
199
- /**
200
- * Render React component to a string.
201
- * This is a client-side fallback - SSR should be done at build time.
202
- */
203
- async render(content, context, _options) {
204
- return `<div data-frontmcp-react data-tool="${context.toolName}">${content}</div>`;
205
- }
206
- /**
207
- * Render React component directly to the DOM.
208
- */
209
- async renderToDOM(content, target, context, options) {
210
- try {
211
- await this.ensureReactLoaded();
212
- if (!this.react || !this.reactDOM) {
213
- throw new Error("React runtime not available");
214
- }
215
- const componentName = target.getAttribute("data-component");
216
- const component = this.getComponent(componentName, content);
217
- if (!component) {
218
- target.innerHTML = content;
219
- return { success: true };
220
- }
221
- const element = this.react.createElement(component, {
222
- input: context.input,
223
- output: context.output,
224
- structuredContent: context.structuredContent,
225
- toolName: context.toolName
226
- });
227
- if (options?.hydrate && this.reactDOM.hydrateRoot) {
228
- const root = this.reactDOM.hydrateRoot(target, element);
229
- mountedRoots.set(target, root);
230
- } else if (this.reactDOM.createRoot) {
231
- const root = this.reactDOM.createRoot(target);
232
- root.render(element);
233
- mountedRoots.set(target, root);
234
- } else if (this.reactDOM.render) {
235
- this.reactDOM.render(element, target);
236
- mountedRoots.set(target, {
237
- unmount: () => this.reactDOM?.unmountComponentAtNode?.(target)
238
- });
239
- } else {
240
- throw new Error("No suitable React render method available");
241
- }
242
- target.dispatchEvent(
243
- new CustomEvent("frontmcp:rendered", {
244
- bubbles: true,
245
- detail: { type: "react", toolName: context.toolName }
246
- })
247
- );
248
- return { success: true };
249
- } catch (error) {
250
- const message = error instanceof Error ? error.message : String(error);
251
- console.error("[FrontMCP] React render failed:", message);
252
- return { success: false, error: message };
253
- }
254
- }
255
- /**
256
- * Hydrate existing SSR content with React.
257
- */
258
- async hydrate(target, context, options) {
259
- return this.renderToDOM("", target, context, { ...options, hydrate: true });
260
- }
261
- /**
262
- * Update rendered React component with new data.
263
- */
264
- async update(target, context) {
265
- try {
266
- await this.ensureReactLoaded();
267
- if (!this.react) {
268
- throw new Error("React runtime not available");
269
- }
270
- const existingRoot = mountedRoots.get(target);
271
- const componentName = target.getAttribute("data-component");
272
- const component = this.getComponent(componentName, "");
273
- if (!component) {
274
- return { success: false, error: "No component found for update" };
275
- }
276
- const element = this.react.createElement(component, {
277
- input: context.input,
278
- output: context.output,
279
- structuredContent: context.structuredContent,
280
- toolName: context.toolName
281
- });
282
- if (existingRoot && "render" in existingRoot) {
283
- existingRoot.render(element);
284
- return { success: true };
285
- }
286
- return this.renderToDOM("", target, context);
287
- } catch (error) {
288
- const message = error instanceof Error ? error.message : String(error);
289
- console.error("[FrontMCP] React update failed:", message);
290
- return { success: false, error: message };
291
- }
292
- }
293
- /**
294
- * Clean up React root.
295
- */
296
- destroy(target) {
297
- const root = mountedRoots.get(target);
298
- if (root) {
299
- root.unmount();
300
- mountedRoots.delete(target);
301
- }
302
- }
303
- /**
304
- * Ensure React is loaded.
305
- */
306
- async ensureReactLoaded() {
307
- if (this.react && this.reactDOM) {
308
- return;
309
- }
310
- if (this.loadPromise) {
311
- return this.loadPromise;
312
- }
313
- this.loadPromise = this.loadReact();
314
- return this.loadPromise;
315
- }
316
- /**
317
- * Load React runtime.
318
- */
319
- async loadReact() {
320
- const win = typeof window !== "undefined" ? window : globalThis;
321
- if (win.React) {
322
- this.react = win.React;
323
- }
324
- if (win.ReactDOM) {
325
- this.reactDOM = win.ReactDOM;
326
- }
327
- if (this.react && this.reactDOM) {
328
- return;
329
- }
330
- try {
331
- if (!this.react) {
332
- const reactModule = await import(
333
- /* webpackIgnore: true */
334
- "react"
335
- );
336
- this.react = reactModule.default || reactModule;
337
- }
338
- if (!this.reactDOM) {
339
- const reactDOMModule = await import(
340
- /* webpackIgnore: true */
341
- "react-dom/client"
342
- );
343
- this.reactDOM = reactDOMModule.default || reactDOMModule;
344
- }
345
- } catch {
346
- if (!this.react || !this.reactDOM) {
347
- console.warn("[FrontMCP] React runtime not available. Ensure React is loaded via CDN or bundled.");
348
- }
349
- }
350
- }
351
- /**
352
- * Get a React component by name or from content.
353
- */
354
- getComponent(componentName, content) {
355
- const win = typeof window !== "undefined" ? window : globalThis;
356
- if (componentName && win.__frontmcp_components) {
357
- const registered = win.__frontmcp_components?.[componentName];
358
- if (registered) {
359
- return registered;
360
- }
361
- }
362
- if (content && typeof content === "function") {
363
- return content;
364
- }
365
- return null;
366
- }
367
- };
368
- function createReactAdapter() {
369
- return new ReactRendererAdapter();
370
- }
371
- async function loadReactAdapter() {
372
- return createReactAdapter();
373
- }
374
- export {
375
- ReactRenderer,
376
- ReactRendererAdapter,
377
- buildHydrationScript,
378
- createReactAdapter,
379
- loadReactAdapter,
380
- reactRenderer
381
- };