@frontmcp/ui 0.6.0 → 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 (650) hide show
  1. package/README.md +140 -362
  2. package/bridge/core/bridge-factory.d.ts +1 -0
  3. package/bridge/core/bridge-factory.d.ts.map +1 -1
  4. package/bridge/index.d.ts +1 -1
  5. package/bridge/index.d.ts.map +1 -1
  6. package/bridge/index.js +39 -881
  7. package/bridge/runtime/index.d.ts +2 -1
  8. package/bridge/runtime/index.d.ts.map +1 -1
  9. package/bundler/browser-components.d.ts +42 -0
  10. package/bundler/browser-components.d.ts.map +1 -0
  11. package/bundler/bundler.d.ts +78 -4
  12. package/bundler/bundler.d.ts.map +1 -1
  13. package/bundler/index.d.ts +8 -8
  14. package/bundler/index.d.ts.map +1 -1
  15. package/bundler/index.js +1411 -2997
  16. package/bundler/types.d.ts +188 -7
  17. package/bundler/types.d.ts.map +1 -1
  18. package/components/alert.schema.d.ts +6 -6
  19. package/components/avatar.schema.d.ts +9 -9
  20. package/components/badge.schema.d.ts +9 -9
  21. package/components/button.schema.d.ts +9 -9
  22. package/components/card.schema.d.ts +7 -7
  23. package/components/form.schema.d.ts +24 -24
  24. package/components/index.js +128 -198
  25. package/components/modal.schema.d.ts +8 -8
  26. package/components/table.schema.d.ts +6 -6
  27. package/esm/bridge/{index.js → index.mjs} +40 -877
  28. package/esm/bundler/index.mjs +3136 -0
  29. package/esm/components/{index.js → index.mjs} +136 -196
  30. package/esm/index.mjs +5450 -0
  31. package/esm/layouts/index.mjs +409 -0
  32. package/esm/package.json +15 -32
  33. package/esm/react/{index.js → index.mjs} +71 -260
  34. package/esm/renderers/index.mjs +611 -0
  35. package/esm/universal/index.mjs +1951 -0
  36. package/esm/web-components/{index.js → index.mjs} +232 -287
  37. package/index.d.ts +22 -41
  38. package/index.d.ts.map +1 -1
  39. package/index.js +4286 -19607
  40. package/layouts/base.d.ts +2 -2
  41. package/layouts/base.d.ts.map +1 -1
  42. package/layouts/index.js +46 -539
  43. package/layouts/presets.d.ts.map +1 -1
  44. package/package.json +15 -32
  45. package/react/Alert.d.ts +1 -2
  46. package/react/Alert.d.ts.map +1 -1
  47. package/react/Badge.d.ts +1 -2
  48. package/react/Badge.d.ts.map +1 -1
  49. package/react/Button.d.ts +1 -2
  50. package/react/Button.d.ts.map +1 -1
  51. package/react/Card.d.ts +1 -2
  52. package/react/Card.d.ts.map +1 -1
  53. package/react/hooks/context.d.ts +1 -1
  54. package/react/hooks/context.d.ts.map +1 -1
  55. package/react/index.d.ts +5 -7
  56. package/react/index.d.ts.map +1 -1
  57. package/react/index.js +55 -269
  58. package/react/types.d.ts +1 -2
  59. package/react/types.d.ts.map +1 -1
  60. package/renderers/index.d.ts +15 -25
  61. package/renderers/index.d.ts.map +1 -1
  62. package/renderers/index.js +393 -1619
  63. package/renderers/mdx.renderer.d.ts +13 -34
  64. package/renderers/mdx.renderer.d.ts.map +1 -1
  65. package/{esm/runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  66. package/renderers/react.adapter.d.ts.map +1 -0
  67. package/renderers/react.renderer.d.ts +25 -16
  68. package/renderers/react.renderer.d.ts.map +1 -1
  69. package/renderers/transpiler.d.ts +49 -0
  70. package/renderers/transpiler.d.ts.map +1 -0
  71. package/universal/cached-runtime.d.ts +25 -1
  72. package/universal/cached-runtime.d.ts.map +1 -1
  73. package/universal/index.js +2037 -0
  74. package/universal/runtime-builder.d.ts.map +1 -1
  75. package/universal/types.d.ts.map +1 -1
  76. package/web-components/elements/fmcp-input.d.ts.map +1 -1
  77. package/web-components/elements/fmcp-select.d.ts.map +1 -1
  78. package/web-components/index.d.ts +0 -1
  79. package/web-components/index.d.ts.map +1 -1
  80. package/web-components/index.js +224 -289
  81. package/adapters/index.d.ts +0 -13
  82. package/adapters/index.d.ts.map +0 -1
  83. package/adapters/index.js +0 -462
  84. package/adapters/platform-meta.d.ts +0 -166
  85. package/adapters/platform-meta.d.ts.map +0 -1
  86. package/adapters/response-builder.d.ts +0 -108
  87. package/adapters/response-builder.d.ts.map +0 -1
  88. package/adapters/serving-mode.d.ts +0 -107
  89. package/adapters/serving-mode.d.ts.map +0 -1
  90. package/base-template/bridge.d.ts +0 -90
  91. package/base-template/bridge.d.ts.map +0 -1
  92. package/base-template/default-base-template.d.ts +0 -92
  93. package/base-template/default-base-template.d.ts.map +0 -1
  94. package/base-template/index.d.ts +0 -15
  95. package/base-template/index.d.ts.map +0 -1
  96. package/base-template/index.js +0 -1398
  97. package/base-template/polyfills.d.ts +0 -31
  98. package/base-template/polyfills.d.ts.map +0 -1
  99. package/base-template/theme-styles.d.ts +0 -74
  100. package/base-template/theme-styles.d.ts.map +0 -1
  101. package/build/cdn-resources.d.ts +0 -243
  102. package/build/cdn-resources.d.ts.map +0 -1
  103. package/build/index.d.ts +0 -295
  104. package/build/index.d.ts.map +0 -1
  105. package/build/index.js +0 -7096
  106. package/build/widget-manifest.d.ts +0 -362
  107. package/build/widget-manifest.d.ts.map +0 -1
  108. package/bundler/cache.d.ts +0 -173
  109. package/bundler/cache.d.ts.map +0 -1
  110. package/bundler/file-cache/component-builder.d.ts +0 -167
  111. package/bundler/file-cache/component-builder.d.ts.map +0 -1
  112. package/bundler/file-cache/hash-calculator.d.ts +0 -155
  113. package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  114. package/bundler/file-cache/index.d.ts +0 -12
  115. package/bundler/file-cache/index.d.ts.map +0 -1
  116. package/bundler/file-cache/storage/filesystem.d.ts +0 -149
  117. package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  118. package/bundler/file-cache/storage/index.d.ts +0 -11
  119. package/bundler/file-cache/storage/index.d.ts.map +0 -1
  120. package/bundler/file-cache/storage/interface.d.ts +0 -152
  121. package/bundler/file-cache/storage/interface.d.ts.map +0 -1
  122. package/bundler/file-cache/storage/redis.d.ts +0 -139
  123. package/bundler/file-cache/storage/redis.d.ts.map +0 -1
  124. package/bundler/sandbox/enclave-adapter.d.ts +0 -121
  125. package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  126. package/bundler/sandbox/executor.d.ts +0 -14
  127. package/bundler/sandbox/executor.d.ts.map +0 -1
  128. package/bundler/sandbox/policy.d.ts +0 -62
  129. package/bundler/sandbox/policy.d.ts.map +0 -1
  130. package/dependency/cdn-registry.d.ts +0 -98
  131. package/dependency/cdn-registry.d.ts.map +0 -1
  132. package/dependency/import-map.d.ts +0 -186
  133. package/dependency/import-map.d.ts.map +0 -1
  134. package/dependency/import-parser.d.ts +0 -82
  135. package/dependency/import-parser.d.ts.map +0 -1
  136. package/dependency/index.d.ts +0 -17
  137. package/dependency/index.d.ts.map +0 -1
  138. package/dependency/resolver.d.ts +0 -164
  139. package/dependency/resolver.d.ts.map +0 -1
  140. package/dependency/schemas.d.ts +0 -486
  141. package/dependency/schemas.d.ts.map +0 -1
  142. package/dependency/template-loader.d.ts +0 -204
  143. package/dependency/template-loader.d.ts.map +0 -1
  144. package/dependency/template-processor.d.ts +0 -118
  145. package/dependency/template-processor.d.ts.map +0 -1
  146. package/dependency/types.d.ts +0 -739
  147. package/dependency/types.d.ts.map +0 -1
  148. package/esm/adapters/index.d.ts +0 -13
  149. package/esm/adapters/index.d.ts.map +0 -1
  150. package/esm/adapters/index.js +0 -427
  151. package/esm/adapters/platform-meta.d.ts +0 -166
  152. package/esm/adapters/platform-meta.d.ts.map +0 -1
  153. package/esm/adapters/response-builder.d.ts +0 -108
  154. package/esm/adapters/response-builder.d.ts.map +0 -1
  155. package/esm/adapters/serving-mode.d.ts +0 -107
  156. package/esm/adapters/serving-mode.d.ts.map +0 -1
  157. package/esm/base-template/bridge.d.ts +0 -90
  158. package/esm/base-template/bridge.d.ts.map +0 -1
  159. package/esm/base-template/default-base-template.d.ts +0 -92
  160. package/esm/base-template/default-base-template.d.ts.map +0 -1
  161. package/esm/base-template/index.d.ts +0 -15
  162. package/esm/base-template/index.d.ts.map +0 -1
  163. package/esm/base-template/index.js +0 -1364
  164. package/esm/base-template/polyfills.d.ts +0 -31
  165. package/esm/base-template/polyfills.d.ts.map +0 -1
  166. package/esm/base-template/theme-styles.d.ts +0 -74
  167. package/esm/base-template/theme-styles.d.ts.map +0 -1
  168. package/esm/bridge/adapters/base-adapter.d.ts +0 -104
  169. package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
  170. package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
  171. package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
  172. package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
  173. package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
  174. package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
  175. package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
  176. package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
  177. package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
  178. package/esm/bridge/adapters/index.d.ts +0 -26
  179. package/esm/bridge/adapters/index.d.ts.map +0 -1
  180. package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
  181. package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
  182. package/esm/bridge/core/adapter-registry.d.ts +0 -122
  183. package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
  184. package/esm/bridge/core/bridge-factory.d.ts +0 -199
  185. package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
  186. package/esm/bridge/core/index.d.ts +0 -10
  187. package/esm/bridge/core/index.d.ts.map +0 -1
  188. package/esm/bridge/index.d.ts +0 -62
  189. package/esm/bridge/index.d.ts.map +0 -1
  190. package/esm/bridge/runtime/iife-generator.d.ts +0 -62
  191. package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
  192. package/esm/bridge/runtime/index.d.ts +0 -9
  193. package/esm/bridge/runtime/index.d.ts.map +0 -1
  194. package/esm/bridge/types.d.ts +0 -386
  195. package/esm/bridge/types.d.ts.map +0 -1
  196. package/esm/build/cdn-resources.d.ts +0 -243
  197. package/esm/build/cdn-resources.d.ts.map +0 -1
  198. package/esm/build/index.d.ts +0 -295
  199. package/esm/build/index.d.ts.map +0 -1
  200. package/esm/build/index.js +0 -7021
  201. package/esm/build/widget-manifest.d.ts +0 -362
  202. package/esm/build/widget-manifest.d.ts.map +0 -1
  203. package/esm/bundler/bundler.d.ts +0 -208
  204. package/esm/bundler/bundler.d.ts.map +0 -1
  205. package/esm/bundler/cache.d.ts +0 -173
  206. package/esm/bundler/cache.d.ts.map +0 -1
  207. package/esm/bundler/file-cache/component-builder.d.ts +0 -167
  208. package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
  209. package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
  210. package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  211. package/esm/bundler/file-cache/index.d.ts +0 -12
  212. package/esm/bundler/file-cache/index.d.ts.map +0 -1
  213. package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
  214. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  215. package/esm/bundler/file-cache/storage/index.d.ts +0 -11
  216. package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
  217. package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
  218. package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
  219. package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
  220. package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
  221. package/esm/bundler/index.d.ts +0 -43
  222. package/esm/bundler/index.d.ts.map +0 -1
  223. package/esm/bundler/index.js +0 -4687
  224. package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
  225. package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  226. package/esm/bundler/sandbox/executor.d.ts +0 -14
  227. package/esm/bundler/sandbox/executor.d.ts.map +0 -1
  228. package/esm/bundler/sandbox/policy.d.ts +0 -62
  229. package/esm/bundler/sandbox/policy.d.ts.map +0 -1
  230. package/esm/bundler/types.d.ts +0 -702
  231. package/esm/bundler/types.d.ts.map +0 -1
  232. package/esm/components/alert.d.ts +0 -66
  233. package/esm/components/alert.d.ts.map +0 -1
  234. package/esm/components/alert.schema.d.ts +0 -98
  235. package/esm/components/alert.schema.d.ts.map +0 -1
  236. package/esm/components/avatar.d.ts +0 -77
  237. package/esm/components/avatar.d.ts.map +0 -1
  238. package/esm/components/avatar.schema.d.ts +0 -170
  239. package/esm/components/avatar.schema.d.ts.map +0 -1
  240. package/esm/components/badge.d.ts +0 -64
  241. package/esm/components/badge.d.ts.map +0 -1
  242. package/esm/components/badge.schema.d.ts +0 -91
  243. package/esm/components/badge.schema.d.ts.map +0 -1
  244. package/esm/components/button.d.ts +0 -100
  245. package/esm/components/button.d.ts.map +0 -1
  246. package/esm/components/button.schema.d.ts +0 -120
  247. package/esm/components/button.schema.d.ts.map +0 -1
  248. package/esm/components/card.d.ts +0 -53
  249. package/esm/components/card.d.ts.map +0 -1
  250. package/esm/components/card.schema.d.ts +0 -93
  251. package/esm/components/card.schema.d.ts.map +0 -1
  252. package/esm/components/form.d.ts +0 -212
  253. package/esm/components/form.d.ts.map +0 -1
  254. package/esm/components/form.schema.d.ts +0 -365
  255. package/esm/components/form.schema.d.ts.map +0 -1
  256. package/esm/components/index.d.ts +0 -29
  257. package/esm/components/index.d.ts.map +0 -1
  258. package/esm/components/list.d.ts +0 -121
  259. package/esm/components/list.d.ts.map +0 -1
  260. package/esm/components/list.schema.d.ts +0 -129
  261. package/esm/components/list.schema.d.ts.map +0 -1
  262. package/esm/components/modal.d.ts +0 -100
  263. package/esm/components/modal.d.ts.map +0 -1
  264. package/esm/components/modal.schema.d.ts +0 -151
  265. package/esm/components/modal.schema.d.ts.map +0 -1
  266. package/esm/components/table.d.ts +0 -91
  267. package/esm/components/table.d.ts.map +0 -1
  268. package/esm/components/table.schema.d.ts +0 -123
  269. package/esm/components/table.schema.d.ts.map +0 -1
  270. package/esm/dependency/cdn-registry.d.ts +0 -98
  271. package/esm/dependency/cdn-registry.d.ts.map +0 -1
  272. package/esm/dependency/import-map.d.ts +0 -186
  273. package/esm/dependency/import-map.d.ts.map +0 -1
  274. package/esm/dependency/import-parser.d.ts +0 -82
  275. package/esm/dependency/import-parser.d.ts.map +0 -1
  276. package/esm/dependency/index.d.ts +0 -17
  277. package/esm/dependency/index.d.ts.map +0 -1
  278. package/esm/dependency/resolver.d.ts +0 -164
  279. package/esm/dependency/resolver.d.ts.map +0 -1
  280. package/esm/dependency/schemas.d.ts +0 -486
  281. package/esm/dependency/schemas.d.ts.map +0 -1
  282. package/esm/dependency/template-loader.d.ts +0 -204
  283. package/esm/dependency/template-loader.d.ts.map +0 -1
  284. package/esm/dependency/template-processor.d.ts +0 -118
  285. package/esm/dependency/template-processor.d.ts.map +0 -1
  286. package/esm/dependency/types.d.ts +0 -739
  287. package/esm/dependency/types.d.ts.map +0 -1
  288. package/esm/handlebars/expression-extractor.d.ts +0 -147
  289. package/esm/handlebars/expression-extractor.d.ts.map +0 -1
  290. package/esm/handlebars/helpers.d.ts +0 -339
  291. package/esm/handlebars/helpers.d.ts.map +0 -1
  292. package/esm/handlebars/index.d.ts +0 -195
  293. package/esm/handlebars/index.d.ts.map +0 -1
  294. package/esm/handlebars/index.js +0 -587
  295. package/esm/index.d.ts +0 -56
  296. package/esm/index.d.ts.map +0 -1
  297. package/esm/index.js +0 -20511
  298. package/esm/layouts/base.d.ts +0 -86
  299. package/esm/layouts/base.d.ts.map +0 -1
  300. package/esm/layouts/index.d.ts +0 -8
  301. package/esm/layouts/index.d.ts.map +0 -1
  302. package/esm/layouts/index.js +0 -892
  303. package/esm/layouts/presets.d.ts +0 -134
  304. package/esm/layouts/presets.d.ts.map +0 -1
  305. package/esm/pages/consent.d.ts +0 -117
  306. package/esm/pages/consent.d.ts.map +0 -1
  307. package/esm/pages/error.d.ts +0 -101
  308. package/esm/pages/error.d.ts.map +0 -1
  309. package/esm/pages/index.d.ts +0 -9
  310. package/esm/pages/index.d.ts.map +0 -1
  311. package/esm/pages/index.js +0 -1563
  312. package/esm/react/Alert.d.ts +0 -102
  313. package/esm/react/Alert.d.ts.map +0 -1
  314. package/esm/react/Badge.d.ts +0 -101
  315. package/esm/react/Badge.d.ts.map +0 -1
  316. package/esm/react/Button.d.ts +0 -109
  317. package/esm/react/Button.d.ts.map +0 -1
  318. package/esm/react/Card.d.ts +0 -104
  319. package/esm/react/Card.d.ts.map +0 -1
  320. package/esm/react/hooks/context.d.ts +0 -179
  321. package/esm/react/hooks/context.d.ts.map +0 -1
  322. package/esm/react/hooks/index.d.ts +0 -42
  323. package/esm/react/hooks/index.d.ts.map +0 -1
  324. package/esm/react/hooks/tools.d.ts +0 -284
  325. package/esm/react/hooks/tools.d.ts.map +0 -1
  326. package/esm/react/index.d.ts +0 -81
  327. package/esm/react/index.d.ts.map +0 -1
  328. package/esm/react/types.d.ts +0 -106
  329. package/esm/react/types.d.ts.map +0 -1
  330. package/esm/react/utils.d.ts +0 -43
  331. package/esm/react/utils.d.ts.map +0 -1
  332. package/esm/registry/index.d.ts +0 -46
  333. package/esm/registry/index.d.ts.map +0 -1
  334. package/esm/registry/index.js +0 -6422
  335. package/esm/registry/render-template.d.ts +0 -91
  336. package/esm/registry/render-template.d.ts.map +0 -1
  337. package/esm/registry/tool-ui.registry.d.ts +0 -294
  338. package/esm/registry/tool-ui.registry.d.ts.map +0 -1
  339. package/esm/registry/uri-utils.d.ts +0 -56
  340. package/esm/registry/uri-utils.d.ts.map +0 -1
  341. package/esm/render/index.d.ts +0 -8
  342. package/esm/render/index.d.ts.map +0 -1
  343. package/esm/render/prerender.d.ts +0 -57
  344. package/esm/render/prerender.d.ts.map +0 -1
  345. package/esm/renderers/cache.d.ts +0 -145
  346. package/esm/renderers/cache.d.ts.map +0 -1
  347. package/esm/renderers/html.renderer.d.ts +0 -123
  348. package/esm/renderers/html.renderer.d.ts.map +0 -1
  349. package/esm/renderers/index.d.ts +0 -36
  350. package/esm/renderers/index.d.ts.map +0 -1
  351. package/esm/renderers/index.js +0 -1827
  352. package/esm/renderers/mdx.renderer.d.ts +0 -120
  353. package/esm/renderers/mdx.renderer.d.ts.map +0 -1
  354. package/esm/renderers/react.renderer.d.ts +0 -96
  355. package/esm/renderers/react.renderer.d.ts.map +0 -1
  356. package/esm/renderers/registry.d.ts +0 -134
  357. package/esm/renderers/registry.d.ts.map +0 -1
  358. package/esm/renderers/types.d.ts +0 -342
  359. package/esm/renderers/types.d.ts.map +0 -1
  360. package/esm/renderers/utils/detect.d.ts +0 -107
  361. package/esm/renderers/utils/detect.d.ts.map +0 -1
  362. package/esm/renderers/utils/hash.d.ts +0 -40
  363. package/esm/renderers/utils/hash.d.ts.map +0 -1
  364. package/esm/renderers/utils/index.d.ts +0 -9
  365. package/esm/renderers/utils/index.d.ts.map +0 -1
  366. package/esm/renderers/utils/transpiler.d.ts +0 -89
  367. package/esm/renderers/utils/transpiler.d.ts.map +0 -1
  368. package/esm/runtime/adapters/html.adapter.d.ts +0 -59
  369. package/esm/runtime/adapters/html.adapter.d.ts.map +0 -1
  370. package/esm/runtime/adapters/index.d.ts +0 -26
  371. package/esm/runtime/adapters/index.d.ts.map +0 -1
  372. package/esm/runtime/adapters/mdx.adapter.d.ts +0 -73
  373. package/esm/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  374. package/esm/runtime/adapters/react.adapter.d.ts.map +0 -1
  375. package/esm/runtime/adapters/types.d.ts +0 -95
  376. package/esm/runtime/adapters/types.d.ts.map +0 -1
  377. package/esm/runtime/csp.d.ts +0 -48
  378. package/esm/runtime/csp.d.ts.map +0 -1
  379. package/esm/runtime/index.d.ts +0 -17
  380. package/esm/runtime/index.d.ts.map +0 -1
  381. package/esm/runtime/index.js +0 -5186
  382. package/esm/runtime/mcp-bridge.d.ts +0 -101
  383. package/esm/runtime/mcp-bridge.d.ts.map +0 -1
  384. package/esm/runtime/renderer-runtime.d.ts +0 -133
  385. package/esm/runtime/renderer-runtime.d.ts.map +0 -1
  386. package/esm/runtime/sanitizer.d.ts +0 -172
  387. package/esm/runtime/sanitizer.d.ts.map +0 -1
  388. package/esm/runtime/types.d.ts +0 -415
  389. package/esm/runtime/types.d.ts.map +0 -1
  390. package/esm/runtime/wrapper.d.ts +0 -421
  391. package/esm/runtime/wrapper.d.ts.map +0 -1
  392. package/esm/styles/index.d.ts +0 -8
  393. package/esm/styles/index.d.ts.map +0 -1
  394. package/esm/styles/index.js +0 -171
  395. package/esm/styles/variants.d.ts +0 -51
  396. package/esm/styles/variants.d.ts.map +0 -1
  397. package/esm/theme/cdn.d.ts +0 -195
  398. package/esm/theme/cdn.d.ts.map +0 -1
  399. package/esm/theme/index.d.ts +0 -18
  400. package/esm/theme/index.d.ts.map +0 -1
  401. package/esm/theme/index.js +0 -700
  402. package/esm/theme/platforms.d.ts +0 -107
  403. package/esm/theme/platforms.d.ts.map +0 -1
  404. package/esm/theme/presets/github-openai.d.ts +0 -50
  405. package/esm/theme/presets/github-openai.d.ts.map +0 -1
  406. package/esm/theme/presets/index.d.ts +0 -11
  407. package/esm/theme/presets/index.d.ts.map +0 -1
  408. package/esm/theme/theme.d.ts +0 -396
  409. package/esm/theme/theme.d.ts.map +0 -1
  410. package/esm/tool-template/builder.d.ts +0 -213
  411. package/esm/tool-template/builder.d.ts.map +0 -1
  412. package/esm/tool-template/index.d.ts +0 -16
  413. package/esm/tool-template/index.d.ts.map +0 -1
  414. package/esm/tool-template/index.js +0 -3515
  415. package/esm/types/index.d.ts +0 -14
  416. package/esm/types/index.d.ts.map +0 -1
  417. package/esm/types/index.js +0 -75
  418. package/esm/types/ui-config.d.ts +0 -639
  419. package/esm/types/ui-config.d.ts.map +0 -1
  420. package/esm/types/ui-runtime.d.ts +0 -1007
  421. package/esm/types/ui-runtime.d.ts.map +0 -1
  422. package/esm/typings/cache/cache-adapter.d.ts +0 -125
  423. package/esm/typings/cache/cache-adapter.d.ts.map +0 -1
  424. package/esm/typings/cache/index.d.ts +0 -10
  425. package/esm/typings/cache/index.d.ts.map +0 -1
  426. package/esm/typings/cache/memory-cache.d.ts +0 -92
  427. package/esm/typings/cache/memory-cache.d.ts.map +0 -1
  428. package/esm/typings/dts-parser.d.ts +0 -90
  429. package/esm/typings/dts-parser.d.ts.map +0 -1
  430. package/esm/typings/index.d.ts +0 -48
  431. package/esm/typings/index.d.ts.map +0 -1
  432. package/esm/typings/schemas.d.ts +0 -232
  433. package/esm/typings/schemas.d.ts.map +0 -1
  434. package/esm/typings/type-fetcher.d.ts +0 -89
  435. package/esm/typings/type-fetcher.d.ts.map +0 -1
  436. package/esm/typings/types.d.ts +0 -320
  437. package/esm/typings/types.d.ts.map +0 -1
  438. package/esm/universal/UniversalApp.d.ts +0 -108
  439. package/esm/universal/UniversalApp.d.ts.map +0 -1
  440. package/esm/universal/cached-runtime.d.ts +0 -115
  441. package/esm/universal/cached-runtime.d.ts.map +0 -1
  442. package/esm/universal/context.d.ts +0 -122
  443. package/esm/universal/context.d.ts.map +0 -1
  444. package/esm/universal/index.d.ts +0 -57
  445. package/esm/universal/index.d.ts.map +0 -1
  446. package/esm/universal/renderers/html.renderer.d.ts +0 -37
  447. package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
  448. package/esm/universal/renderers/index.d.ts +0 -112
  449. package/esm/universal/renderers/index.d.ts.map +0 -1
  450. package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
  451. package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
  452. package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
  453. package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
  454. package/esm/universal/renderers/react.renderer.d.ts +0 -46
  455. package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
  456. package/esm/universal/runtime-builder.d.ts +0 -33
  457. package/esm/universal/runtime-builder.d.ts.map +0 -1
  458. package/esm/universal/store.d.ts +0 -135
  459. package/esm/universal/store.d.ts.map +0 -1
  460. package/esm/universal/types.d.ts +0 -199
  461. package/esm/universal/types.d.ts.map +0 -1
  462. package/esm/utils/escape-html.d.ts +0 -58
  463. package/esm/utils/escape-html.d.ts.map +0 -1
  464. package/esm/utils/index.d.ts +0 -10
  465. package/esm/utils/index.d.ts.map +0 -1
  466. package/esm/utils/index.js +0 -40
  467. package/esm/utils/safe-stringify.d.ts +0 -30
  468. package/esm/utils/safe-stringify.d.ts.map +0 -1
  469. package/esm/validation/error-box.d.ts +0 -56
  470. package/esm/validation/error-box.d.ts.map +0 -1
  471. package/esm/validation/index.d.ts +0 -13
  472. package/esm/validation/index.d.ts.map +0 -1
  473. package/esm/validation/index.js +0 -562
  474. package/esm/validation/schema-paths.d.ts +0 -118
  475. package/esm/validation/schema-paths.d.ts.map +0 -1
  476. package/esm/validation/template-validator.d.ts +0 -143
  477. package/esm/validation/template-validator.d.ts.map +0 -1
  478. package/esm/validation/wrapper.d.ts +0 -97
  479. package/esm/validation/wrapper.d.ts.map +0 -1
  480. package/esm/web-components/core/attribute-parser.d.ts +0 -82
  481. package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
  482. package/esm/web-components/core/base-element.d.ts +0 -197
  483. package/esm/web-components/core/base-element.d.ts.map +0 -1
  484. package/esm/web-components/core/index.d.ts +0 -9
  485. package/esm/web-components/core/index.d.ts.map +0 -1
  486. package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
  487. package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
  488. package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
  489. package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
  490. package/esm/web-components/elements/fmcp-button.d.ts +0 -117
  491. package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
  492. package/esm/web-components/elements/fmcp-card.d.ts +0 -53
  493. package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
  494. package/esm/web-components/elements/fmcp-input.d.ts +0 -96
  495. package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
  496. package/esm/web-components/elements/fmcp-select.d.ts +0 -100
  497. package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
  498. package/esm/web-components/elements/index.d.ts +0 -13
  499. package/esm/web-components/elements/index.d.ts.map +0 -1
  500. package/esm/web-components/index.d.ts +0 -50
  501. package/esm/web-components/index.d.ts.map +0 -1
  502. package/esm/web-components/register.d.ts +0 -57
  503. package/esm/web-components/register.d.ts.map +0 -1
  504. package/esm/web-components/types.d.ts +0 -122
  505. package/esm/web-components/types.d.ts.map +0 -1
  506. package/esm/widgets/index.d.ts +0 -8
  507. package/esm/widgets/index.d.ts.map +0 -1
  508. package/esm/widgets/index.js +0 -941
  509. package/esm/widgets/progress.d.ts +0 -133
  510. package/esm/widgets/progress.d.ts.map +0 -1
  511. package/esm/widgets/resource.d.ts +0 -163
  512. package/esm/widgets/resource.d.ts.map +0 -1
  513. package/handlebars/expression-extractor.d.ts +0 -147
  514. package/handlebars/expression-extractor.d.ts.map +0 -1
  515. package/handlebars/helpers.d.ts +0 -339
  516. package/handlebars/helpers.d.ts.map +0 -1
  517. package/handlebars/index.d.ts +0 -195
  518. package/handlebars/index.d.ts.map +0 -1
  519. package/handlebars/index.js +0 -666
  520. package/pages/consent.d.ts +0 -117
  521. package/pages/consent.d.ts.map +0 -1
  522. package/pages/error.d.ts +0 -101
  523. package/pages/error.d.ts.map +0 -1
  524. package/pages/index.d.ts +0 -9
  525. package/pages/index.d.ts.map +0 -1
  526. package/pages/index.js +0 -1602
  527. package/react/utils.d.ts +0 -43
  528. package/react/utils.d.ts.map +0 -1
  529. package/registry/index.d.ts +0 -46
  530. package/registry/index.d.ts.map +0 -1
  531. package/registry/index.js +0 -6465
  532. package/registry/render-template.d.ts +0 -91
  533. package/registry/render-template.d.ts.map +0 -1
  534. package/registry/tool-ui.registry.d.ts +0 -294
  535. package/registry/tool-ui.registry.d.ts.map +0 -1
  536. package/registry/uri-utils.d.ts +0 -56
  537. package/registry/uri-utils.d.ts.map +0 -1
  538. package/renderers/cache.d.ts +0 -145
  539. package/renderers/cache.d.ts.map +0 -1
  540. package/renderers/html.renderer.d.ts +0 -123
  541. package/renderers/html.renderer.d.ts.map +0 -1
  542. package/renderers/registry.d.ts +0 -134
  543. package/renderers/registry.d.ts.map +0 -1
  544. package/renderers/types.d.ts +0 -342
  545. package/renderers/types.d.ts.map +0 -1
  546. package/renderers/utils/detect.d.ts +0 -107
  547. package/renderers/utils/detect.d.ts.map +0 -1
  548. package/renderers/utils/hash.d.ts +0 -40
  549. package/renderers/utils/hash.d.ts.map +0 -1
  550. package/renderers/utils/index.d.ts +0 -9
  551. package/renderers/utils/index.d.ts.map +0 -1
  552. package/renderers/utils/transpiler.d.ts +0 -89
  553. package/renderers/utils/transpiler.d.ts.map +0 -1
  554. package/runtime/adapters/html.adapter.d.ts +0 -59
  555. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  556. package/runtime/adapters/index.d.ts +0 -26
  557. package/runtime/adapters/index.d.ts.map +0 -1
  558. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  559. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  560. package/runtime/adapters/react.adapter.d.ts +0 -70
  561. package/runtime/adapters/react.adapter.d.ts.map +0 -1
  562. package/runtime/adapters/types.d.ts +0 -95
  563. package/runtime/adapters/types.d.ts.map +0 -1
  564. package/runtime/csp.d.ts +0 -48
  565. package/runtime/csp.d.ts.map +0 -1
  566. package/runtime/index.d.ts +0 -17
  567. package/runtime/index.d.ts.map +0 -1
  568. package/runtime/index.js +0 -5264
  569. package/runtime/mcp-bridge.d.ts +0 -101
  570. package/runtime/mcp-bridge.d.ts.map +0 -1
  571. package/runtime/renderer-runtime.d.ts +0 -133
  572. package/runtime/renderer-runtime.d.ts.map +0 -1
  573. package/runtime/sanitizer.d.ts +0 -172
  574. package/runtime/sanitizer.d.ts.map +0 -1
  575. package/runtime/types.d.ts +0 -415
  576. package/runtime/types.d.ts.map +0 -1
  577. package/runtime/wrapper.d.ts +0 -421
  578. package/runtime/wrapper.d.ts.map +0 -1
  579. package/styles/index.d.ts +0 -8
  580. package/styles/index.d.ts.map +0 -1
  581. package/styles/index.js +0 -222
  582. package/styles/variants.d.ts +0 -51
  583. package/styles/variants.d.ts.map +0 -1
  584. package/theme/cdn.d.ts +0 -195
  585. package/theme/cdn.d.ts.map +0 -1
  586. package/theme/index.d.ts +0 -18
  587. package/theme/index.d.ts.map +0 -1
  588. package/theme/index.js +0 -757
  589. package/theme/platforms.d.ts +0 -107
  590. package/theme/platforms.d.ts.map +0 -1
  591. package/theme/presets/github-openai.d.ts +0 -50
  592. package/theme/presets/github-openai.d.ts.map +0 -1
  593. package/theme/presets/index.d.ts +0 -11
  594. package/theme/presets/index.d.ts.map +0 -1
  595. package/theme/theme.d.ts +0 -396
  596. package/theme/theme.d.ts.map +0 -1
  597. package/tool-template/builder.d.ts +0 -213
  598. package/tool-template/builder.d.ts.map +0 -1
  599. package/tool-template/index.d.ts +0 -16
  600. package/tool-template/index.d.ts.map +0 -1
  601. package/tool-template/index.js +0 -3559
  602. package/types/index.d.ts +0 -14
  603. package/types/index.d.ts.map +0 -1
  604. package/types/index.js +0 -108
  605. package/types/ui-config.d.ts +0 -639
  606. package/types/ui-config.d.ts.map +0 -1
  607. package/types/ui-runtime.d.ts +0 -1007
  608. package/types/ui-runtime.d.ts.map +0 -1
  609. package/typings/cache/cache-adapter.d.ts +0 -125
  610. package/typings/cache/cache-adapter.d.ts.map +0 -1
  611. package/typings/cache/index.d.ts +0 -10
  612. package/typings/cache/index.d.ts.map +0 -1
  613. package/typings/cache/memory-cache.d.ts +0 -92
  614. package/typings/cache/memory-cache.d.ts.map +0 -1
  615. package/typings/dts-parser.d.ts +0 -90
  616. package/typings/dts-parser.d.ts.map +0 -1
  617. package/typings/index.d.ts +0 -48
  618. package/typings/index.d.ts.map +0 -1
  619. package/typings/schemas.d.ts +0 -232
  620. package/typings/schemas.d.ts.map +0 -1
  621. package/typings/type-fetcher.d.ts +0 -89
  622. package/typings/type-fetcher.d.ts.map +0 -1
  623. package/typings/types.d.ts +0 -320
  624. package/typings/types.d.ts.map +0 -1
  625. package/utils/escape-html.d.ts +0 -58
  626. package/utils/escape-html.d.ts.map +0 -1
  627. package/utils/index.d.ts +0 -10
  628. package/utils/index.d.ts.map +0 -1
  629. package/utils/index.js +0 -70
  630. package/utils/safe-stringify.d.ts +0 -30
  631. package/utils/safe-stringify.d.ts.map +0 -1
  632. package/validation/error-box.d.ts +0 -56
  633. package/validation/error-box.d.ts.map +0 -1
  634. package/validation/index.d.ts +0 -13
  635. package/validation/index.d.ts.map +0 -1
  636. package/validation/index.js +0 -603
  637. package/validation/schema-paths.d.ts +0 -118
  638. package/validation/schema-paths.d.ts.map +0 -1
  639. package/validation/template-validator.d.ts +0 -143
  640. package/validation/template-validator.d.ts.map +0 -1
  641. package/validation/wrapper.d.ts +0 -97
  642. package/validation/wrapper.d.ts.map +0 -1
  643. package/widgets/index.d.ts +0 -8
  644. package/widgets/index.d.ts.map +0 -1
  645. package/widgets/index.js +0 -978
  646. package/widgets/progress.d.ts +0 -133
  647. package/widgets/progress.d.ts.map +0 -1
  648. package/widgets/resource.d.ts +0 -163
  649. package/widgets/resource.d.ts.map +0 -1
  650. /package/esm/render/{index.js → index.mjs} +0 -0
package/pages/index.js DELETED
@@ -1,1602 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // libs/ui/src/pages/index.ts
21
- var pages_exports = {};
22
- __export(pages_exports, {
23
- consentDeniedPage: () => consentDeniedPage,
24
- consentPage: () => consentPage,
25
- consentSuccessPage: () => consentSuccessPage,
26
- errorPage: () => errorPage,
27
- forbiddenPage: () => forbiddenPage,
28
- maintenancePage: () => maintenancePage,
29
- notFoundPage: () => notFoundPage,
30
- oauthErrorPage: () => oauthErrorPage,
31
- offlinePage: () => offlinePage,
32
- rateLimitPage: () => rateLimitPage,
33
- serverErrorPage: () => serverErrorPage,
34
- sessionExpiredPage: () => sessionExpiredPage,
35
- unauthorizedPage: () => unauthorizedPage
36
- });
37
- module.exports = __toCommonJS(pages_exports);
38
-
39
- // libs/ui/src/theme/cdn.ts
40
- var CDN = {
41
- /**
42
- * Tailwind CSS v4 Browser CDN
43
- * Generates styles on-the-fly with @theme support
44
- * @see https://tailwindcss.com/docs/installation/play-cdn
45
- */
46
- tailwind: "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",
47
- /**
48
- * HTMX 2.x - High power tools for HTML
49
- * Enables AJAX, WebSockets, Server Sent Events directly in HTML
50
- * @see https://htmx.org
51
- */
52
- htmx: {
53
- url: "https://cdnjs.cloudflare.com/ajax/libs/htmx/2.0.7/htmx.min.js",
54
- integrity: "sha512-T6VLg/MJYMbLTmQ8VLvonbWg8VOvmDhXcOvHzCwo6ShdGuUU5SEcp1IAPXL4k9lVoMi8gRXl5K/S/zh43Y9rJA=="
55
- },
56
- /**
57
- * Alpine.js - Lightweight reactive framework
58
- * Used for more complex client-side interactions
59
- * @see https://alpinejs.dev
60
- */
61
- alpine: {
62
- url: "https://cdn.jsdelivr.net/npm/alpinejs@3.14.3/dist/cdn.min.js",
63
- integrity: "sha384-6zY8MFQJ/EqS1r4RJl+7j8rvZPuBWpT0RzWf+IFcKhxqUzQNmJzA1X1VEVZhYaEz"
64
- },
65
- /**
66
- * Google Fonts - Inter for modern UI typography
67
- */
68
- fonts: {
69
- preconnect: ["https://fonts.googleapis.com", "https://fonts.gstatic.com"],
70
- inter: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",
71
- mono: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap"
72
- },
73
- /**
74
- * Lucide Icons - Beautiful & consistent icons
75
- * @see https://lucide.dev
76
- */
77
- icons: {
78
- url: "https://cdn.jsdelivr.net/npm/lucide@0.294.0/dist/umd/lucide.min.js",
79
- integrity: "sha384-wpLmHb7v7V1LsEuTmPQ9tXqWZvTtRWWVqJuE+Yz6X0I6O2T6bHJVeXH1lVWqF4qE"
80
- }
81
- };
82
- var scriptCache = /* @__PURE__ */ new Map();
83
- function getCachedScript(url) {
84
- return scriptCache.get(url);
85
- }
86
- function isScriptCached(url) {
87
- return scriptCache.has(url);
88
- }
89
- function buildFontPreconnect() {
90
- return CDN.fonts.preconnect.map((url, i) => `<link rel="preconnect" href="${url}"${i > 0 ? " crossorigin" : ""}>`).join("\n ");
91
- }
92
- function buildFontStylesheets(options = {}) {
93
- const { inter = true, mono = false } = options;
94
- const links = [];
95
- if (inter) {
96
- links.push(`<link href="${CDN.fonts.inter}" rel="stylesheet">`);
97
- }
98
- if (mono) {
99
- links.push(`<link href="${CDN.fonts.mono}" rel="stylesheet">`);
100
- }
101
- return links.join("\n ");
102
- }
103
- function buildScriptTag(url, integrity, options = {}) {
104
- const attrs = [`src="${url}"`];
105
- if (integrity) {
106
- attrs.push(`integrity="${integrity}"`);
107
- attrs.push('crossorigin="anonymous"');
108
- }
109
- if (options.defer) attrs.push("defer");
110
- if (options.async) attrs.push("async");
111
- return `<script ${attrs.join(" ")}></script>`;
112
- }
113
- function buildInlineScriptTag(content) {
114
- return `<script>${content}</script>`;
115
- }
116
- function buildCdnScripts(options = {}) {
117
- const { tailwind = true, htmx = true, alpine = false, icons = false, inline = false } = options;
118
- const scripts = [];
119
- if (inline) {
120
- if (tailwind) {
121
- if (isScriptCached(CDN.tailwind)) {
122
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.tailwind)));
123
- } else {
124
- console.warn(
125
- "[frontmcp/ui] Inline mode requested but Tailwind script not cached. Call fetchAndCacheScripts() first."
126
- );
127
- }
128
- }
129
- if (htmx) {
130
- if (isScriptCached(CDN.htmx.url)) {
131
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.htmx.url)));
132
- } else {
133
- console.warn(
134
- "[frontmcp/ui] Inline mode requested but HTMX script not cached. Call fetchAndCacheScripts() first."
135
- );
136
- }
137
- }
138
- if (alpine) {
139
- if (isScriptCached(CDN.alpine.url)) {
140
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.alpine.url)));
141
- } else {
142
- console.warn(
143
- "[frontmcp/ui] Inline mode requested but Alpine.js script not cached. Call fetchAndCacheScripts() first."
144
- );
145
- }
146
- }
147
- if (icons) {
148
- if (isScriptCached(CDN.icons.url)) {
149
- scripts.push(buildInlineScriptTag(getCachedScript(CDN.icons.url)));
150
- } else {
151
- console.warn(
152
- "[frontmcp/ui] Inline mode requested but Lucide icons script not cached. Call fetchAndCacheScripts() first."
153
- );
154
- }
155
- }
156
- } else {
157
- if (tailwind) {
158
- scripts.push(buildScriptTag(CDN.tailwind));
159
- }
160
- if (htmx) {
161
- scripts.push(buildScriptTag(CDN.htmx.url, CDN.htmx.integrity));
162
- }
163
- if (alpine) {
164
- scripts.push(buildScriptTag(CDN.alpine.url, CDN.alpine.integrity, { defer: true }));
165
- }
166
- if (icons) {
167
- scripts.push(buildScriptTag(CDN.icons.url, CDN.icons.integrity));
168
- }
169
- }
170
- return scripts.join("\n ");
171
- }
172
-
173
- // libs/ui/src/theme/platforms.ts
174
- var OPENAI_PLATFORM = {
175
- id: "openai",
176
- name: "OpenAI",
177
- supportsWidgets: true,
178
- supportsTailwind: true,
179
- supportsHtmx: true,
180
- networkMode: "full",
181
- scriptStrategy: "cdn",
182
- options: {
183
- sdk: "apps-sdk",
184
- version: "1.0"
185
- }
186
- };
187
- var CLAUDE_PLATFORM = {
188
- id: "claude",
189
- name: "Claude (Artifacts)",
190
- supportsWidgets: true,
191
- supportsTailwind: true,
192
- supportsHtmx: false,
193
- // Network blocked, HTMX won't work for API calls
194
- networkMode: "blocked",
195
- scriptStrategy: "inline",
196
- maxInlineSize: 100 * 1024,
197
- // 100KB limit for artifacts
198
- cspRestrictions: ["script-src 'unsafe-inline'", "connect-src 'none'"],
199
- options: {
200
- mode: "artifacts",
201
- framework: "react"
202
- // Claude artifacts prefer React
203
- }
204
- };
205
- function canUseCdn(platform) {
206
- return platform.networkMode === "full" && platform.scriptStrategy === "cdn";
207
- }
208
- function needsInlineScripts(platform) {
209
- return platform.scriptStrategy === "inline" || platform.networkMode === "blocked";
210
- }
211
-
212
- // libs/ui/src/theme/presets/github-openai.ts
213
- var GITHUB_OPENAI_THEME = {
214
- name: "github-openai",
215
- colors: {
216
- semantic: {
217
- // Primary: Near-black for main actions and branding
218
- primary: "#24292f",
219
- // Secondary: Medium gray for secondary elements
220
- secondary: "#57606a",
221
- // Accent: Blue for links, focus states, and highlights
222
- accent: "#0969da",
223
- // Status colors
224
- success: "#1a7f37",
225
- // GitHub green
226
- warning: "#9a6700",
227
- // Amber warning
228
- danger: "#cf222e",
229
- // GitHub red
230
- info: "#0969da"
231
- // Blue info
232
- },
233
- surface: {
234
- // Pure white background
235
- background: "#ffffff",
236
- // Light gray surface (GitHub code background style)
237
- surface: "#f6f8fa",
238
- // White elevated surfaces (modals, cards)
239
- elevated: "#ffffff",
240
- // Dark semi-transparent overlay
241
- overlay: "rgba(27, 31, 36, 0.5)"
242
- },
243
- text: {
244
- // Near-black for primary text
245
- primary: "#24292f",
246
- // Gray for secondary/muted text
247
- secondary: "#57606a",
248
- // Light gray for disabled text
249
- disabled: "#8c959f",
250
- // White for text on dark backgrounds
251
- inverse: "#ffffff",
252
- // Blue for links
253
- link: "#0969da"
254
- },
255
- border: {
256
- // Light gray border (GitHub style)
257
- default: "#d0d7de",
258
- // Medium gray on hover
259
- hover: "#8c959f",
260
- // Blue focus ring
261
- focus: "#0969da",
262
- // Subtle divider
263
- divider: "#d8dee4"
264
- }
265
- },
266
- typography: {
267
- families: {
268
- // System UI font stack (GitHub/Apple style)
269
- sans: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
270
- // Monospace stack
271
- mono: 'ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace'
272
- },
273
- sizes: {
274
- xs: "0.75rem",
275
- // 12px
276
- sm: "0.875rem",
277
- // 14px
278
- base: "1rem",
279
- // 16px
280
- lg: "1.125rem",
281
- // 18px
282
- xl: "1.25rem",
283
- // 20px
284
- "2xl": "1.5rem",
285
- // 24px
286
- "3xl": "1.875rem",
287
- // 30px
288
- "4xl": "2.25rem"
289
- // 36px
290
- },
291
- weights: {
292
- normal: "400",
293
- medium: "500",
294
- semibold: "600",
295
- bold: "700"
296
- }
297
- },
298
- radius: {
299
- none: "0",
300
- sm: "3px",
301
- // GitHub uses smaller radii
302
- md: "6px",
303
- lg: "8px",
304
- xl: "12px",
305
- "2xl": "16px",
306
- full: "9999px"
307
- },
308
- shadows: {
309
- // Subtle shadows with gray tones
310
- sm: "0 1px 0 rgba(27, 31, 36, 0.04)",
311
- md: "0 3px 6px rgba(140, 149, 159, 0.15)",
312
- lg: "0 8px 24px rgba(140, 149, 159, 0.2)",
313
- xl: "0 12px 28px rgba(140, 149, 159, 0.3)"
314
- },
315
- components: {
316
- button: {
317
- radius: "6px",
318
- paddingX: "16px",
319
- paddingY: "5px",
320
- fontSize: "14px",
321
- fontWeight: "500"
322
- },
323
- card: {
324
- radius: "6px",
325
- padding: "16px",
326
- shadow: "0 1px 0 rgba(27, 31, 36, 0.04)",
327
- borderWidth: "1px"
328
- },
329
- input: {
330
- radius: "6px",
331
- paddingX: "12px",
332
- paddingY: "5px",
333
- borderWidth: "1px",
334
- focusRingWidth: "3px"
335
- }
336
- },
337
- cdn: {
338
- fonts: {
339
- preconnect: ["https://fonts.googleapis.com", "https://fonts.gstatic.com"],
340
- stylesheets: [
341
- // System UI fonts don't need external stylesheets, but we include
342
- // Inter as an optional enhancement for consistent cross-platform rendering
343
- "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
344
- ]
345
- },
346
- icons: {
347
- script: {
348
- url: "https://cdn.jsdelivr.net/npm/lucide@0.294.0/dist/umd/lucide.min.js"
349
- }
350
- },
351
- scripts: {
352
- tailwind: "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",
353
- htmx: {
354
- url: "https://cdnjs.cloudflare.com/ajax/libs/htmx/2.0.7/htmx.min.js",
355
- integrity: "sha512-T6VLg/MJYMbLTmQ8VLvonbWg8VOvmDhXcOvHzCwo6ShdGuUU5SEcp1IAPXL4k9lVoMi8gRXl5K/S/zh43Y9rJA=="
356
- },
357
- alpine: {
358
- url: "https://cdn.jsdelivr.net/npm/alpinejs@3.14.3/dist/cdn.min.js",
359
- integrity: "sha384-6zY8MFQJ/EqS1r4RJl+7j8rvZPuBWpT0RzWf+IFcKhxqUzQNmJzA1X1VEVZhYaEz"
360
- }
361
- }
362
- }
363
- };
364
- var DEFAULT_THEME = GITHUB_OPENAI_THEME;
365
-
366
- // libs/ui/src/theme/theme.ts
367
- function mergeThemesCore(base, override) {
368
- const baseColors = base.colors ?? { semantic: { primary: "#24292f" } };
369
- const filterStrings = (arr) => arr.filter((s) => s !== void 0);
370
- return {
371
- ...base,
372
- ...override,
373
- colors: {
374
- ...baseColors,
375
- ...override.colors,
376
- semantic: { ...baseColors.semantic, ...override.colors?.semantic },
377
- surface: { ...baseColors.surface, ...override.colors?.surface },
378
- text: { ...baseColors.text, ...override.colors?.text },
379
- border: { ...baseColors.border, ...override.colors?.border },
380
- custom: { ...baseColors.custom, ...override.colors?.custom }
381
- },
382
- typography: {
383
- ...base.typography,
384
- ...override.typography,
385
- families: { ...base.typography?.families, ...override.typography?.families },
386
- sizes: { ...base.typography?.sizes, ...override.typography?.sizes },
387
- weights: { ...base.typography?.weights, ...override.typography?.weights },
388
- lineHeight: { ...base.typography?.lineHeight, ...override.typography?.lineHeight }
389
- },
390
- spacing: { ...base.spacing, ...override.spacing },
391
- radius: { ...base.radius, ...override.radius },
392
- shadows: { ...base.shadows, ...override.shadows },
393
- components: {
394
- ...base.components,
395
- ...override.components,
396
- button: { ...base.components?.button, ...override.components?.button },
397
- card: { ...base.components?.card, ...override.components?.card },
398
- input: { ...base.components?.input, ...override.components?.input }
399
- },
400
- cdn: {
401
- ...base.cdn,
402
- ...override.cdn,
403
- fonts: {
404
- // Concatenate then dedupe so base entries are preserved without duplicates
405
- preconnect: filterStrings(
406
- Array.from(/* @__PURE__ */ new Set([...base.cdn?.fonts?.preconnect ?? [], ...override.cdn?.fonts?.preconnect ?? []]))
407
- ),
408
- stylesheets: filterStrings(
409
- Array.from(/* @__PURE__ */ new Set([...base.cdn?.fonts?.stylesheets ?? [], ...override.cdn?.fonts?.stylesheets ?? []]))
410
- )
411
- },
412
- icons: {
413
- ...base.cdn?.icons,
414
- ...override.cdn?.icons,
415
- // Deep merge script to preserve integrity when only url is overridden
416
- script: override.cdn?.icons?.script ? { ...base.cdn?.icons?.script, ...override.cdn?.icons?.script } : base.cdn?.icons?.script
417
- },
418
- scripts: {
419
- // tailwind is a simple string, just use override or base
420
- tailwind: override.cdn?.scripts?.tailwind ?? base.cdn?.scripts?.tailwind,
421
- // Deep merge htmx/alpine to preserve integrity when only url is overridden
422
- htmx: override.cdn?.scripts?.htmx ? { ...base.cdn?.scripts?.htmx, ...override.cdn?.scripts?.htmx } : base.cdn?.scripts?.htmx,
423
- alpine: override.cdn?.scripts?.alpine ? { ...base.cdn?.scripts?.alpine, ...override.cdn?.scripts?.alpine } : base.cdn?.scripts?.alpine
424
- }
425
- },
426
- customVars: { ...base.customVars, ...override.customVars },
427
- customCss: [base.customCss, override.customCss].filter(Boolean).join("\n")
428
- };
429
- }
430
- function mergeThemes(base, override) {
431
- const merged = mergeThemesCore(base, override);
432
- let darkVariant;
433
- if (override.dark !== void 0) {
434
- const darkBase = base.dark ?? base;
435
- const { dark: _nestedDark, ...overrideDarkWithoutNested } = override.dark;
436
- darkVariant = mergeThemesCore(darkBase, overrideDarkWithoutNested);
437
- } else if (base.dark !== void 0) {
438
- const { dark: _nestedDark, ...baseDarkWithoutNested } = base.dark;
439
- darkVariant = baseDarkWithoutNested;
440
- }
441
- return {
442
- ...merged,
443
- dark: darkVariant
444
- };
445
- }
446
- function emitColorScale(lines, name, scale) {
447
- for (const [shade, value] of Object.entries(scale)) {
448
- if (value) lines.push(`--color-${name}-${shade}: ${value};`);
449
- }
450
- }
451
- function buildThemeCss(theme) {
452
- const lines = [];
453
- const semantic = theme.colors.semantic;
454
- if (typeof semantic.primary === "string") {
455
- lines.push(`--color-primary: ${semantic.primary};`);
456
- } else if (semantic.primary) {
457
- emitColorScale(lines, "primary", semantic.primary);
458
- }
459
- if (semantic.secondary) {
460
- if (typeof semantic.secondary === "string") {
461
- lines.push(`--color-secondary: ${semantic.secondary};`);
462
- } else {
463
- emitColorScale(lines, "secondary", semantic.secondary);
464
- }
465
- }
466
- if (semantic.accent) {
467
- if (typeof semantic.accent === "string") {
468
- lines.push(`--color-accent: ${semantic.accent};`);
469
- } else {
470
- emitColorScale(lines, "accent", semantic.accent);
471
- }
472
- }
473
- if (semantic.neutral) {
474
- if (typeof semantic.neutral === "string") {
475
- lines.push(`--color-neutral: ${semantic.neutral};`);
476
- } else {
477
- emitColorScale(lines, "neutral", semantic.neutral);
478
- }
479
- }
480
- if (semantic.success) lines.push(`--color-success: ${semantic.success};`);
481
- if (semantic.warning) lines.push(`--color-warning: ${semantic.warning};`);
482
- if (semantic.danger) lines.push(`--color-danger: ${semantic.danger};`);
483
- if (semantic.info) lines.push(`--color-info: ${semantic.info};`);
484
- const surface = theme.colors.surface;
485
- if (surface?.background) lines.push(`--color-background: ${surface.background};`);
486
- if (surface?.surface) lines.push(`--color-surface: ${surface.surface};`);
487
- if (surface?.elevated) lines.push(`--color-elevated: ${surface.elevated};`);
488
- if (surface?.overlay) lines.push(`--color-overlay: ${surface.overlay};`);
489
- const text = theme.colors.text;
490
- if (text?.primary) lines.push(`--color-text-primary: ${text.primary};`);
491
- if (text?.secondary) lines.push(`--color-text-secondary: ${text.secondary};`);
492
- if (text?.disabled) lines.push(`--color-text-disabled: ${text.disabled};`);
493
- if (text?.inverse) lines.push(`--color-text-inverse: ${text.inverse};`);
494
- if (text?.link) lines.push(`--color-text-link: ${text.link};`);
495
- const border = theme.colors.border;
496
- if (border?.default) lines.push(`--color-border: ${border.default};`);
497
- if (border?.hover) lines.push(`--color-border-hover: ${border.hover};`);
498
- if (border?.focus) lines.push(`--color-border-focus: ${border.focus};`);
499
- if (border?.divider) lines.push(`--color-divider: ${border.divider};`);
500
- if (theme.colors.custom) {
501
- for (const [key, value] of Object.entries(theme.colors.custom)) {
502
- lines.push(`--color-${key}: ${value};`);
503
- }
504
- }
505
- const typography = theme.typography;
506
- if (typography?.families?.sans) lines.push(`--font-sans: ${typography.families.sans};`);
507
- if (typography?.families?.serif) lines.push(`--font-serif: ${typography.families.serif};`);
508
- if (typography?.families?.mono) lines.push(`--font-mono: ${typography.families.mono};`);
509
- if (typography?.families?.display) lines.push(`--font-display: ${typography.families.display};`);
510
- const radius = theme.radius;
511
- if (radius?.none) lines.push(`--radius-none: ${radius.none};`);
512
- if (radius?.sm) lines.push(`--radius-sm: ${radius.sm};`);
513
- if (radius?.md) lines.push(`--radius-md: ${radius.md};`);
514
- if (radius?.lg) lines.push(`--radius-lg: ${radius.lg};`);
515
- if (radius?.xl) lines.push(`--radius-xl: ${radius.xl};`);
516
- if (radius?.["2xl"]) lines.push(`--radius-2xl: ${radius["2xl"]};`);
517
- if (radius?.full) lines.push(`--radius-full: ${radius.full};`);
518
- if (theme.customVars) {
519
- for (const [key, value] of Object.entries(theme.customVars)) {
520
- lines.push(`${key}: ${value};`);
521
- }
522
- }
523
- return lines.join("\n ");
524
- }
525
-
526
- // libs/ui/src/utils/escape-html.ts
527
- function escapeHtml(str) {
528
- if (str === null || str === void 0) {
529
- return "";
530
- }
531
- const s = String(str);
532
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
533
- }
534
-
535
- // libs/ui/src/layouts/base.ts
536
- function getSizeClass(size) {
537
- const sizeMap = {
538
- xs: "max-w-sm",
539
- sm: "max-w-md",
540
- md: "max-w-lg",
541
- lg: "max-w-xl",
542
- xl: "max-w-2xl",
543
- "2xl": "max-w-3xl",
544
- "3xl": "max-w-4xl",
545
- full: "max-w-full"
546
- };
547
- return sizeMap[size];
548
- }
549
- function getAlignmentClasses(alignment) {
550
- const alignMap = {
551
- center: "min-h-screen flex items-center justify-center",
552
- top: "min-h-screen flex flex-col items-center pt-12",
553
- start: "min-h-screen"
554
- };
555
- return alignMap[alignment];
556
- }
557
- function getBackgroundClasses(background, theme) {
558
- switch (background) {
559
- case "gradient":
560
- return "bg-gradient-to-br from-primary to-secondary";
561
- case "pattern":
562
- return 'bg-surface bg-[url("data:image/svg+xml,...")]';
563
- // Pattern would be defined
564
- case "solid":
565
- return "bg-background";
566
- case "none":
567
- default:
568
- return "";
569
- }
570
- }
571
- function buildMetaTags(options) {
572
- const tags = [];
573
- if (options.description) {
574
- tags.push(`<meta name="description" content="${escapeHtml(options.description)}">`);
575
- }
576
- if (options.og) {
577
- if (options.og.title) {
578
- tags.push(`<meta property="og:title" content="${escapeHtml(options.og.title)}">`);
579
- }
580
- if (options.og.description) {
581
- tags.push(`<meta property="og:description" content="${escapeHtml(options.og.description)}">`);
582
- }
583
- if (options.og.image) {
584
- tags.push(`<meta property="og:image" content="${escapeHtml(options.og.image)}">`);
585
- }
586
- if (options.og.type) {
587
- tags.push(`<meta property="og:type" content="${escapeHtml(options.og.type)}">`);
588
- }
589
- }
590
- if (options.favicon) {
591
- tags.push(`<link rel="icon" href="${escapeHtml(options.favicon)}">`);
592
- }
593
- return tags.join("\n ");
594
- }
595
- function buildBodyAttrs(attrs) {
596
- if (!attrs) return "";
597
- return Object.entries(attrs).map(([key, value]) => `${key}="${escapeHtml(value)}"`).join(" ");
598
- }
599
- function baseLayout(content, options) {
600
- const {
601
- title,
602
- pageType = "custom",
603
- size = "md",
604
- alignment = "center",
605
- background = "solid",
606
- platform = OPENAI_PLATFORM,
607
- theme: themeOverrides,
608
- includeHtmx,
609
- includeAlpine = false,
610
- includeIcons = false,
611
- headExtra = "",
612
- bodyAttrs,
613
- bodyClass = "",
614
- titleSuffix = "FrontMCP"
615
- } = options;
616
- const theme = themeOverrides ? mergeThemes(DEFAULT_THEME, themeOverrides) : DEFAULT_THEME;
617
- const shouldIncludeHtmx = includeHtmx ?? platform.supportsHtmx;
618
- const useCdn = canUseCdn(platform);
619
- const useInline = needsInlineScripts(platform);
620
- const fontPreconnect = useCdn ? buildFontPreconnect() : "";
621
- const fontStylesheets = useCdn ? buildFontStylesheets({ inter: true }) : "";
622
- const scripts = buildCdnScripts({
623
- tailwind: platform.supportsTailwind,
624
- htmx: shouldIncludeHtmx,
625
- alpine: includeAlpine,
626
- icons: includeIcons,
627
- inline: useInline
628
- });
629
- const themeCss = buildThemeCss(theme);
630
- const customCss = theme.customCss || "";
631
- const styleBlock = platform.supportsTailwind ? `<style type="text/tailwindcss">
632
- @theme {
633
- ${themeCss}
634
- }
635
- ${customCss}
636
- </style>` : "";
637
- const sizeClass = getSizeClass(size);
638
- const alignmentClasses = getAlignmentClasses(alignment);
639
- const backgroundClasses = getBackgroundClasses(background, theme);
640
- const allBodyClasses = [backgroundClasses, "font-sans antialiased", bodyClass].filter(Boolean).join(" ");
641
- const metaTags = buildMetaTags(options);
642
- const bodyAttrStr = buildBodyAttrs(bodyAttrs);
643
- const wrappedContent = alignment === "center" ? `<div class="${alignmentClasses} p-4">
644
- <div class="w-full ${sizeClass}">
645
- ${content}
646
- </div>
647
- </div>` : `<div class="${alignmentClasses}">
648
- <div class="w-full ${sizeClass} mx-auto px-4 py-8">
649
- ${content}
650
- </div>
651
- </div>`;
652
- return `<!DOCTYPE html>
653
- <html lang="en">
654
- <head>
655
- <meta charset="UTF-8">
656
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
657
- <title>${escapeHtml(title)}${titleSuffix ? ` - ${escapeHtml(titleSuffix)}` : ""}</title>
658
- ${metaTags}
659
-
660
- <!-- Fonts -->
661
- ${fontPreconnect}
662
- ${fontStylesheets}
663
-
664
- <!-- Tailwind CSS -->
665
- ${scripts}
666
- ${styleBlock}
667
-
668
- ${headExtra}
669
- </head>
670
- <body class="${escapeHtml(allBodyClasses)}"${bodyAttrStr ? ` ${bodyAttrStr}` : ""}>
671
- ${wrappedContent}
672
- </body>
673
- </html>`;
674
- }
675
- function createLayoutBuilder(defaults) {
676
- return (content, options = {}) => {
677
- let mergedTheme = DEFAULT_THEME;
678
- if (defaults.theme) {
679
- mergedTheme = mergeThemes(mergedTheme, defaults.theme);
680
- }
681
- if (options.theme) {
682
- mergedTheme = mergeThemes(mergedTheme, options.theme);
683
- }
684
- const merged = {
685
- ...defaults,
686
- ...options,
687
- theme: mergedTheme
688
- };
689
- if (!merged.title) {
690
- throw new Error("createLayoutBuilder: title is required either in defaults or options");
691
- }
692
- return baseLayout(content, merged);
693
- };
694
- }
695
-
696
- // libs/ui/src/layouts/presets.ts
697
- function consentLayout(content, options) {
698
- const { clientName, clientIcon, userInfo, ...baseOptions } = options;
699
- const headerHtml = clientName ? `<div class="text-center mb-6">
700
- ${clientIcon ? `<img src="${escapeHtml(clientIcon)}" alt="${escapeHtml(
701
- clientName
702
- )}" class="w-16 h-16 rounded-xl mx-auto mb-4">` : `<div class="inline-flex items-center justify-center w-16 h-16 rounded-xl bg-gradient-to-br from-primary to-secondary text-white font-bold text-2xl mx-auto mb-4">
703
- ${escapeHtml(clientName.charAt(0).toUpperCase())}
704
- </div>`}
705
- <h1 class="text-2xl font-bold text-text-primary">${escapeHtml(clientName)}</h1>
706
- </div>` : "";
707
- const userInfoHtml = userInfo ? `<div class="flex items-center gap-3 p-3 bg-gray-50 rounded-lg mb-6">
708
- ${userInfo.avatar ? `<img src="${escapeHtml(userInfo.avatar)}" class="w-10 h-10 rounded-full">` : `<div class="w-10 h-10 rounded-full bg-primary text-white flex items-center justify-center font-medium">
709
- ${escapeHtml((userInfo.name || userInfo.email || "U").charAt(0).toUpperCase())}
710
- </div>`}
711
- <div>
712
- ${userInfo.name ? `<div class="font-medium text-text-primary">${escapeHtml(userInfo.name)}</div>` : ""}
713
- ${userInfo.email ? `<div class="text-sm text-text-secondary">${escapeHtml(userInfo.email)}</div>` : ""}
714
- </div>
715
- </div>` : "";
716
- const wrappedContent = `
717
- ${headerHtml}
718
- ${userInfoHtml}
719
- ${content}
720
- `;
721
- return baseLayout(wrappedContent, {
722
- ...baseOptions,
723
- pageType: "consent",
724
- size: baseOptions.size ?? "lg",
725
- alignment: "top",
726
- background: "solid"
727
- });
728
- }
729
- function errorLayout(content, options) {
730
- const {
731
- errorCode,
732
- errorTitle = "Something went wrong",
733
- errorMessage,
734
- showRetry = true,
735
- retryUrl,
736
- showHome = true,
737
- homeUrl = "/",
738
- ...baseOptions
739
- } = options;
740
- const errorHtml = `
741
- <div class="text-center">
742
- <!-- Error icon -->
743
- <div class="inline-flex items-center justify-center w-20 h-20 rounded-full bg-danger/10 mb-6">
744
- <svg class="w-10 h-10 text-danger" fill="none" stroke="currentColor" viewBox="0 0 24 24">
745
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
746
- </svg>
747
- </div>
748
-
749
- ${errorCode ? `<p class="text-6xl font-bold text-danger mb-2">${escapeHtml(errorCode)}</p>` : ""}
750
- <h1 class="text-2xl font-bold text-text-primary mb-4">${escapeHtml(errorTitle)}</h1>
751
- ${errorMessage ? `<p class="text-text-secondary mb-8">${escapeHtml(errorMessage)}</p>` : ""}
752
-
753
- ${content}
754
-
755
- <div class="flex gap-4 justify-center mt-8">
756
- ${showRetry ? `<button onclick="${retryUrl ? `window.location.href='${escapeHtml(retryUrl)}'` : "window.location.reload()"}" class="px-6 py-3 bg-primary hover:bg-primary/90 text-white font-medium rounded-lg transition-colors">Try Again</button>` : ""}
757
- ${showHome ? `<a href="${escapeHtml(
758
- homeUrl
759
- )}" class="px-6 py-3 bg-gray-100 hover:bg-gray-200 text-text-primary font-medium rounded-lg transition-colors">Go Home</a>` : ""}
760
- </div>
761
- </div>
762
- `;
763
- return baseLayout(errorHtml, {
764
- ...baseOptions,
765
- pageType: "error",
766
- size: "sm",
767
- alignment: "center",
768
- background: "solid",
769
- title: baseOptions.title ?? errorTitle
770
- });
771
- }
772
- var authLayoutBuilder = createLayoutBuilder({
773
- pageType: "auth",
774
- size: "sm",
775
- alignment: "center",
776
- background: "gradient"
777
- });
778
- var consentLayoutBuilder = createLayoutBuilder({
779
- pageType: "consent",
780
- size: "lg",
781
- alignment: "top",
782
- background: "solid"
783
- });
784
- var errorLayoutBuilder = createLayoutBuilder({
785
- pageType: "error",
786
- size: "sm",
787
- alignment: "center",
788
- background: "solid"
789
- });
790
-
791
- // libs/ui/src/validation/error-box.ts
792
- var errorIcon = `<svg class="w-5 h-5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
793
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
794
- </svg>`;
795
- function validationErrorBox(options) {
796
- const { componentName, invalidParam } = options;
797
- return `<div
798
- class="validation-error flex items-start gap-3 p-4 bg-red-50 border border-red-200 text-red-800 rounded-lg"
799
- role="alert"
800
- data-testid="validation-error"
801
- data-component="${escapeHtml(componentName)}"
802
- data-param="${escapeHtml(invalidParam)}"
803
- >
804
- ${errorIcon}
805
- <div class="min-w-0">
806
- <p class="font-semibold text-sm">${escapeHtml(componentName)}: Invalid Configuration</p>
807
- <p class="text-sm opacity-90 mt-0.5">The "${escapeHtml(invalidParam)}" parameter is invalid.</p>
808
- </div>
809
- </div>`;
810
- }
811
-
812
- // libs/ui/src/validation/wrapper.ts
813
- function getFirstInvalidPath(error) {
814
- const firstError = error.issues[0];
815
- if (!firstError || firstError.path.length === 0) {
816
- return "options";
817
- }
818
- return firstError.path.map(String).join(".");
819
- }
820
- function validateOptions(options, config) {
821
- const result = config.schema.safeParse(options);
822
- if (result.success) {
823
- return { success: true, data: result.data };
824
- }
825
- const invalidParam = getFirstInvalidPath(result.error);
826
- return {
827
- success: false,
828
- error: validationErrorBox({
829
- componentName: config.componentName,
830
- invalidParam
831
- })
832
- };
833
- }
834
-
835
- // libs/ui/src/validation/schema-paths.ts
836
- var import_zod = require("zod");
837
-
838
- // libs/ui/src/components/button.schema.ts
839
- var import_zod2 = require("zod");
840
- var ButtonVariantSchema = import_zod2.z.enum(["primary", "secondary", "outline", "ghost", "danger", "success", "link"]);
841
- var ButtonSizeSchema = import_zod2.z.enum(["xs", "sm", "md", "lg", "xl"]);
842
- var ButtonOptionsSchema = import_zod2.z.object({
843
- /** Button variant */
844
- variant: ButtonVariantSchema.optional(),
845
- /** Button size */
846
- size: ButtonSizeSchema.optional(),
847
- /** Button type attribute */
848
- type: import_zod2.z.enum(["button", "submit", "reset"]).optional(),
849
- /** Disabled state */
850
- disabled: import_zod2.z.boolean().optional(),
851
- /** Loading state */
852
- loading: import_zod2.z.boolean().optional(),
853
- /** Full width */
854
- fullWidth: import_zod2.z.boolean().optional(),
855
- /** Icon before text (HTML string) */
856
- iconBefore: import_zod2.z.string().optional(),
857
- /** Icon after text (HTML string) */
858
- iconAfter: import_zod2.z.string().optional(),
859
- /** Icon only (no text) */
860
- iconOnly: import_zod2.z.boolean().optional(),
861
- /** Additional CSS classes */
862
- className: import_zod2.z.string().optional(),
863
- /** Button ID */
864
- id: import_zod2.z.string().optional(),
865
- /** Name attribute */
866
- name: import_zod2.z.string().optional(),
867
- /** Value attribute */
868
- value: import_zod2.z.string().optional(),
869
- /** Click handler (URL for links) */
870
- href: import_zod2.z.string().optional(),
871
- /** Open in new tab */
872
- target: import_zod2.z.enum(["_blank", "_self"]).optional(),
873
- /** Data attributes */
874
- data: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
875
- /** ARIA label */
876
- ariaLabel: import_zod2.z.string().optional()
877
- }).strict();
878
- var ButtonGroupOptionsSchema = import_zod2.z.object({
879
- /** Attach buttons visually */
880
- attached: import_zod2.z.boolean().optional(),
881
- /** Direction */
882
- direction: import_zod2.z.enum(["horizontal", "vertical"]).optional(),
883
- /** Gap between buttons */
884
- gap: import_zod2.z.enum(["sm", "md", "lg"]).optional(),
885
- /** Additional CSS classes */
886
- className: import_zod2.z.string().optional()
887
- }).strict();
888
-
889
- // libs/ui/src/components/button.ts
890
- function getVariantClasses(variant) {
891
- const variants = {
892
- primary: "bg-primary hover:bg-primary/90 text-white shadow-sm",
893
- secondary: "bg-secondary hover:bg-secondary/90 text-white shadow-sm",
894
- outline: "border-2 border-primary text-primary hover:bg-primary/10",
895
- ghost: "text-text-primary hover:bg-gray-100",
896
- danger: "bg-danger hover:bg-danger/90 text-white shadow-sm",
897
- success: "bg-success hover:bg-success/90 text-white shadow-sm",
898
- link: "text-primary hover:text-primary/80 hover:underline"
899
- };
900
- return variants[variant];
901
- }
902
- function getSizeClasses(size, iconOnly) {
903
- if (iconOnly) {
904
- const iconSizes = {
905
- xs: "p-1.5",
906
- sm: "p-2",
907
- md: "p-2.5",
908
- lg: "p-3",
909
- xl: "p-4"
910
- };
911
- return iconSizes[size];
912
- }
913
- const sizes = {
914
- xs: "px-2.5 py-1.5 text-xs",
915
- sm: "px-3 py-2 text-sm",
916
- md: "px-4 py-2.5 text-sm",
917
- lg: "px-5 py-3 text-base",
918
- xl: "px-6 py-3.5 text-lg"
919
- };
920
- return sizes[size];
921
- }
922
- function sanitizeDataKey(key) {
923
- const sanitized = key.toLowerCase().replace(/[^a-z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
924
- if (!sanitized) {
925
- console.warn(`[frontmcp/ui] Dropping invalid data-* key: "${key}"`);
926
- return null;
927
- }
928
- return sanitized;
929
- }
930
- var loadingSpinner = `<svg class="animate-spin -ml-1 mr-2 h-4 w-4" fill="none" viewBox="0 0 24 24">
931
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
932
- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
933
- </svg>`;
934
- function isValidHrefProtocol(href) {
935
- const trimmed = href.trim().toLowerCase();
936
- return trimmed.startsWith("http://") || trimmed.startsWith("https://") || trimmed.startsWith("/") || trimmed.startsWith("#") || trimmed.startsWith("mailto:") || trimmed.startsWith("tel:");
937
- }
938
- function button(text, options = {}) {
939
- const validation = validateOptions(options, {
940
- schema: ButtonOptionsSchema,
941
- componentName: "button"
942
- });
943
- if (!validation.success) {
944
- return validation.error;
945
- }
946
- const validatedOptions = validation.data;
947
- const {
948
- variant = "primary",
949
- size = "md",
950
- type = "button",
951
- disabled = false,
952
- loading = false,
953
- fullWidth = false,
954
- iconBefore,
955
- iconAfter,
956
- iconOnly = false,
957
- className = "",
958
- id,
959
- name,
960
- value,
961
- href,
962
- target,
963
- data,
964
- ariaLabel
965
- } = validatedOptions;
966
- if (!iconOnly && !text.trim()) {
967
- console.warn("[frontmcp/ui] Button has empty text. Consider providing text or using iconOnly with ariaLabel.");
968
- }
969
- if (iconOnly && !ariaLabel && !text.trim()) {
970
- console.warn(
971
- "[frontmcp/ui] iconOnly button requires non-empty text or ariaLabel for accessibility; control will have no label."
972
- );
973
- }
974
- if (href && !isValidHrefProtocol(href)) {
975
- console.warn(`[frontmcp/ui] Button href contains potentially dangerous protocol: "${href.slice(0, 20)}..."`);
976
- }
977
- const variantClasses = getVariantClasses(variant);
978
- const sizeClasses = getSizeClasses(size, iconOnly);
979
- const safeClassName = className ? escapeHtml(className) : "";
980
- const baseClasses = [
981
- "inline-flex items-center justify-center",
982
- "font-medium",
983
- "rounded-lg",
984
- "transition-colors duration-200",
985
- "focus:outline-none focus:ring-2 focus:ring-primary/50 focus:ring-offset-2",
986
- disabled || loading ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
987
- fullWidth ? "w-full" : "",
988
- variantClasses,
989
- sizeClasses,
990
- safeClassName
991
- ].filter(Boolean).join(" ");
992
- const dataAttrs = data ? Object.entries(data).map(([key, val]) => {
993
- const safeKey = sanitizeDataKey(key);
994
- return safeKey ? `data-${safeKey}="${escapeHtml(val)}"` : "";
995
- }).filter(Boolean).join(" ") : "";
996
- const idAttr = id ? `id="${escapeHtml(id)}"` : "";
997
- const nameAttr = name ? `name="${escapeHtml(name)}"` : "";
998
- const valueAttr = value ? `value="${escapeHtml(value)}"` : "";
999
- const disabledAttr = disabled || loading ? "disabled" : "";
1000
- const targetAttr = target ? `target="${escapeHtml(target)}"` : "";
1001
- const relAttr = target === "_blank" ? 'rel="noopener noreferrer"' : "";
1002
- const trimmedText = text.trim();
1003
- const effectiveAriaLabel = ariaLabel ?? (iconOnly && trimmedText ? trimmedText : void 0);
1004
- const ariaLabelAttr = effectiveAriaLabel ? `aria-label="${escapeHtml(effectiveAriaLabel)}"` : "";
1005
- const iconBeforeHtml = iconBefore && !loading ? `<span class="${iconOnly ? "" : "mr-2"}">${iconBefore}</span>` : "";
1006
- const iconAfterHtml = iconAfter && !loading ? `<span class="${iconOnly ? "" : "ml-2"}">${iconAfter}</span>` : "";
1007
- const loadingHtml = loading ? loadingSpinner : "";
1008
- const textHtml = iconOnly ? "" : escapeHtml(text);
1009
- const contentHtml = `${loadingHtml}${iconBeforeHtml}${textHtml}${iconAfterHtml}`;
1010
- if (href && !disabled && !loading && isValidHrefProtocol(href)) {
1011
- return `<a href="${escapeHtml(
1012
- href
1013
- )}" class="${baseClasses}" ${idAttr} ${dataAttrs} ${ariaLabelAttr} ${targetAttr} ${relAttr}>
1014
- ${contentHtml}
1015
- </a>`;
1016
- }
1017
- return `<button type="${type}" class="${baseClasses}" ${idAttr} ${nameAttr} ${valueAttr} ${disabledAttr} ${dataAttrs} ${ariaLabelAttr}>
1018
- ${contentHtml}
1019
- </button>`;
1020
- }
1021
- var primaryButton = (text, opts) => button(text, { ...opts, variant: "primary" });
1022
- var outlineButton = (text, opts) => button(text, { ...opts, variant: "outline" });
1023
-
1024
- // libs/ui/src/components/list.ts
1025
- var permissionIcons = {
1026
- read: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1027
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
1028
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
1029
- </svg>`,
1030
- write: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1031
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
1032
- </svg>`,
1033
- delete: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1034
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
1035
- </svg>`,
1036
- profile: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1037
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
1038
- </svg>`,
1039
- email: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1040
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
1041
- </svg>`,
1042
- settings: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1043
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
1044
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
1045
- </svg>`,
1046
- default: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1047
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/>
1048
- </svg>`
1049
- };
1050
- function getPermissionIcon(scope, customIcon) {
1051
- if (customIcon) return customIcon;
1052
- const scopeLower = scope.toLowerCase();
1053
- if (scopeLower.includes("read")) return permissionIcons["read"];
1054
- if (scopeLower.includes("write") || scopeLower.includes("create") || scopeLower.includes("update"))
1055
- return permissionIcons["write"];
1056
- if (scopeLower.includes("delete")) return permissionIcons["delete"];
1057
- if (scopeLower.includes("profile")) return permissionIcons["profile"];
1058
- if (scopeLower.includes("email")) return permissionIcons["email"];
1059
- if (scopeLower.includes("settings") || scopeLower.includes("config")) return permissionIcons["settings"];
1060
- return permissionIcons["default"];
1061
- }
1062
- function permissionList(permissions, options = {}) {
1063
- const { id, checkable = false, inputName = "scopes", title, className = "" } = options;
1064
- const titleHtml = title ? `<h4 class="font-medium text-text-primary mb-3">${escapeHtml(title)}</h4>` : "";
1065
- const itemsHtml = permissions.map((perm, index) => {
1066
- const icon = getPermissionIcon(perm.scope, perm.icon);
1067
- const sensitiveClasses = perm.sensitive ? "border-warning/30 bg-warning/5" : "border-border";
1068
- const sensitiveLabel = perm.sensitive ? '<span class="text-xs text-warning font-medium ml-2">Sensitive</span>' : "";
1069
- const checkboxHtml = checkable ? `<input
1070
- type="checkbox"
1071
- name="${escapeHtml(inputName)}[]"
1072
- value="${escapeHtml(perm.scope)}"
1073
- class="w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
1074
- ${perm.checked || perm.required ? "checked" : ""}
1075
- ${perm.required ? "disabled" : ""}
1076
- id="${id ? escapeHtml(id) : "perm"}-${index}"
1077
- >` : `<div class="w-5 h-5 rounded-full bg-success/10 text-success flex items-center justify-center">
1078
- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1079
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"/>
1080
- </svg>
1081
- </div>`;
1082
- return `<div class="flex items-start gap-3 p-3 border ${sensitiveClasses} rounded-lg">
1083
- <div class="flex-shrink-0 mt-0.5 text-text-secondary">
1084
- ${icon}
1085
- </div>
1086
- <div class="flex-1 min-w-0">
1087
- <div class="flex items-center">
1088
- <span class="font-medium text-text-primary">${escapeHtml(perm.name)}</span>
1089
- ${perm.required ? '<span class="text-xs text-text-secondary ml-2">(Required)</span>' : ""}
1090
- ${sensitiveLabel}
1091
- </div>
1092
- ${perm.description ? `<p class="text-sm text-text-secondary mt-0.5">${escapeHtml(perm.description)}</p>` : ""}
1093
- </div>
1094
- <div class="flex-shrink-0">
1095
- ${checkboxHtml}
1096
- </div>
1097
- </div>`;
1098
- }).join("\n");
1099
- const idAttr = id ? `id="${escapeHtml(id)}"` : "";
1100
- return `<div class="permission-list ${className}" ${idAttr}>
1101
- ${titleHtml}
1102
- <div class="space-y-2">
1103
- ${itemsHtml}
1104
- </div>
1105
- </div>`;
1106
- }
1107
-
1108
- // libs/ui/src/components/form.ts
1109
- function hiddenInput(name, value) {
1110
- return `<input type="hidden" name="${escapeHtml(name)}" value="${escapeHtml(value)}">`;
1111
- }
1112
- function csrfInput(token) {
1113
- return hiddenInput("_csrf", token);
1114
- }
1115
-
1116
- // libs/ui/src/components/alert.ts
1117
- var alertIcons = {
1118
- info: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1119
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
1120
- </svg>`,
1121
- success: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1122
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
1123
- </svg>`,
1124
- warning: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1125
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
1126
- </svg>`,
1127
- danger: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1128
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
1129
- </svg>`,
1130
- neutral: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1131
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
1132
- </svg>`
1133
- };
1134
- function getVariantClasses2(variant) {
1135
- const variants = {
1136
- info: {
1137
- container: "bg-blue-50 border-blue-200 text-blue-800",
1138
- icon: "text-blue-500"
1139
- },
1140
- success: {
1141
- container: "bg-success/10 border-success/30 text-success",
1142
- icon: "text-success"
1143
- },
1144
- warning: {
1145
- container: "bg-warning/10 border-warning/30 text-warning",
1146
- icon: "text-warning"
1147
- },
1148
- danger: {
1149
- container: "bg-danger/10 border-danger/30 text-danger",
1150
- icon: "text-danger"
1151
- },
1152
- neutral: {
1153
- container: "bg-gray-50 border-gray-200 text-gray-800",
1154
- icon: "text-gray-500"
1155
- }
1156
- };
1157
- return variants[variant];
1158
- }
1159
- function alert(message, options = {}) {
1160
- const { variant = "info", title, showIcon = true, icon, dismissible = false, className = "", id, actions } = options;
1161
- const variantClasses = getVariantClasses2(variant);
1162
- const baseClasses = ["rounded-lg border p-4", variantClasses.container, className].filter(Boolean).join(" ");
1163
- const iconHtml = showIcon ? `<div class="flex-shrink-0 ${variantClasses.icon}">
1164
- ${icon || alertIcons[variant]}
1165
- </div>` : "";
1166
- const titleHtml = title ? `<h3 class="font-semibold">${escapeHtml(title)}</h3>` : "";
1167
- const dismissHtml = dismissible ? `<button
1168
- type="button"
1169
- class="flex-shrink-0 ml-auto -mr-1 -mt-1 p-1 rounded hover:bg-black/5 transition-colors"
1170
- onclick="this.closest('.alert').remove()"
1171
- aria-label="Dismiss"
1172
- >
1173
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1174
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1175
- </svg>
1176
- </button>` : "";
1177
- const actionsHtml = actions ? `<div class="mt-3">${actions}</div>` : "";
1178
- const idAttr = id ? `id="${escapeHtml(id)}"` : "";
1179
- return `<div class="alert ${baseClasses}" role="alert" ${idAttr}>
1180
- <div class="flex gap-3">
1181
- ${iconHtml}
1182
- <div class="flex-1">
1183
- ${titleHtml}
1184
- <div class="${title ? "mt-1" : ""}">${escapeHtml(message)}</div>
1185
- ${actionsHtml}
1186
- </div>
1187
- ${dismissHtml}
1188
- </div>
1189
- </div>`;
1190
- }
1191
-
1192
- // libs/ui/src/pages/consent.ts
1193
- function consentPage(options) {
1194
- const {
1195
- client,
1196
- user,
1197
- permissions,
1198
- approveUrl,
1199
- denyUrl,
1200
- csrfToken,
1201
- state,
1202
- redirectUri,
1203
- responseType,
1204
- nonce,
1205
- codeChallenge,
1206
- codeChallengeMethod,
1207
- error,
1208
- layout = {},
1209
- warningMessage,
1210
- allowScopeSelection = false,
1211
- approveText = "Allow",
1212
- denyText = "Deny"
1213
- } = options;
1214
- const errorAlert = error ? alert(error, { variant: "danger", dismissible: true }) : "";
1215
- const unverifiedWarning = !client.verified ? alert(warningMessage || "This application has not been verified. Only authorize applications you trust.", {
1216
- variant: "warning",
1217
- title: "Unverified Application"
1218
- }) : "";
1219
- const clientHeader = `
1220
- <div class="text-center mb-6">
1221
- ${client.icon ? `<img src="${escapeHtml(client.icon)}" alt="${escapeHtml(
1222
- client.name
1223
- )}" class="w-16 h-16 rounded-xl mx-auto mb-4 shadow-md">` : `<div class="inline-flex items-center justify-center w-16 h-16 rounded-xl bg-gradient-to-br from-primary to-secondary text-white font-bold text-2xl mx-auto mb-4 shadow-md">
1224
- ${escapeHtml(client.name.charAt(0).toUpperCase())}
1225
- </div>`}
1226
- <h1 class="text-xl font-bold text-text-primary">
1227
- ${client.verified ? `<span class="inline-flex items-center gap-1">
1228
- ${escapeHtml(client.name)}
1229
- <svg class="w-5 h-5 text-primary" fill="currentColor" viewBox="0 0 20 20">
1230
- <path fill-rule="evenodd" d="M6.267 3.455a3.066 3.066 0 001.745-.723 3.066 3.066 0 013.976 0 3.066 3.066 0 001.745.723 3.066 3.066 0 012.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 010 3.976 3.066 3.066 0 00-.723 1.745 3.066 3.066 0 01-2.812 2.812 3.066 3.066 0 00-1.745.723 3.066 3.066 0 01-3.976 0 3.066 3.066 0 00-1.745-.723 3.066 3.066 0 01-2.812-2.812 3.066 3.066 0 00-.723-1.745 3.066 3.066 0 010-3.976 3.066 3.066 0 00.723-1.745 3.066 3.066 0 012.812-2.812zm7.44 5.252a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
1231
- </svg>
1232
- </span>` : escapeHtml(client.name)}
1233
- </h1>
1234
- <p class="text-text-secondary mt-1">wants to access your account</p>
1235
- </div>
1236
- `;
1237
- const userSection = user ? `
1238
- <div class="flex items-center gap-3 p-4 bg-gray-50 rounded-lg mb-6">
1239
- ${user.avatar ? `<img src="${escapeHtml(user.avatar)}" class="w-12 h-12 rounded-full">` : `<div class="w-12 h-12 rounded-full bg-primary text-white flex items-center justify-center font-semibold text-lg">
1240
- ${escapeHtml((user.name || user.email || "U").charAt(0).toUpperCase())}
1241
- </div>`}
1242
- <div class="flex-1 min-w-0">
1243
- ${user.name ? `<div class="font-medium text-text-primary truncate">${escapeHtml(user.name)}</div>` : ""}
1244
- ${user.email ? `<div class="text-sm text-text-secondary truncate">${escapeHtml(user.email)}</div>` : ""}
1245
- </div>
1246
- <a href="/login?prompt=select_account" class="text-sm text-primary hover:text-primary/80">
1247
- Switch account
1248
- </a>
1249
- </div>
1250
- ` : "";
1251
- const permissionsSection = `
1252
- <div class="mb-6">
1253
- <h3 class="font-medium text-text-primary mb-3">This will allow ${escapeHtml(client.name)} to:</h3>
1254
- ${permissionList(permissions, {
1255
- checkable: allowScopeSelection,
1256
- inputName: "scope"
1257
- })}
1258
- </div>
1259
- `;
1260
- const hiddenFields = [
1261
- csrfToken ? csrfInput(csrfToken) : "",
1262
- state ? hiddenInput("state", state) : "",
1263
- redirectUri ? hiddenInput("redirect_uri", redirectUri) : "",
1264
- responseType ? hiddenInput("response_type", responseType) : "",
1265
- nonce ? hiddenInput("nonce", nonce) : "",
1266
- codeChallenge ? hiddenInput("code_challenge", codeChallenge) : "",
1267
- codeChallengeMethod ? hiddenInput("code_challenge_method", codeChallengeMethod) : "",
1268
- hiddenInput("client_id", client.clientId),
1269
- // Include all scopes if not selectable
1270
- !allowScopeSelection ? permissions.map((p) => hiddenInput("scope[]", p.scope)).join("\n") : ""
1271
- ].filter(Boolean).join("\n");
1272
- const actionsHtml = `
1273
- <div class="flex gap-3 pt-4">
1274
- <form action="${escapeHtml(denyUrl || approveUrl)}" method="post" class="flex-1">
1275
- ${hiddenFields}
1276
- <input type="hidden" name="action" value="deny">
1277
- ${outlineButton(denyText, { type: "submit", fullWidth: true })}
1278
- </form>
1279
- <form action="${escapeHtml(approveUrl)}" method="post" class="flex-1">
1280
- ${hiddenFields}
1281
- <input type="hidden" name="action" value="approve">
1282
- ${primaryButton(approveText, { type: "submit", fullWidth: true })}
1283
- </form>
1284
- </div>
1285
- `;
1286
- const linksHtml = client.privacyUrl || client.termsUrl || client.websiteUrl ? `
1287
- <div class="text-center text-xs text-text-secondary mt-6 space-x-3">
1288
- ${client.websiteUrl ? `<a href="${escapeHtml(
1289
- client.websiteUrl
1290
- )}" target="_blank" rel="noopener" class="hover:text-primary">Website</a>` : ""}
1291
- ${client.privacyUrl ? `<a href="${escapeHtml(
1292
- client.privacyUrl
1293
- )}" target="_blank" rel="noopener" class="hover:text-primary">Privacy Policy</a>` : ""}
1294
- ${client.termsUrl ? `<a href="${escapeHtml(
1295
- client.termsUrl
1296
- )}" target="_blank" rel="noopener" class="hover:text-primary">Terms of Service</a>` : ""}
1297
- </div>
1298
- ` : "";
1299
- const content = `
1300
- ${errorAlert}
1301
- ${unverifiedWarning}
1302
- ${clientHeader}
1303
- ${userSection}
1304
- ${permissionsSection}
1305
- ${actionsHtml}
1306
- ${linksHtml}
1307
- `;
1308
- return consentLayout(content, {
1309
- title: `Authorize ${client.name}`,
1310
- clientName: client.name,
1311
- clientIcon: client.icon,
1312
- userInfo: user,
1313
- ...layout
1314
- });
1315
- }
1316
- function consentSuccessPage(options) {
1317
- const { client, redirectUrl, autoRedirectDelay = 3e3, layout = {} } = options;
1318
- const redirectScript = redirectUrl && autoRedirectDelay > 0 ? `
1319
- <script>
1320
- setTimeout(() => {
1321
- window.location.href = '${escapeHtml(redirectUrl)}';
1322
- }, ${autoRedirectDelay});
1323
- </script>
1324
- ` : "";
1325
- const content = `
1326
- <div class="text-center">
1327
- <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-success/10 mb-6">
1328
- <svg class="w-8 h-8 text-success" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1329
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
1330
- </svg>
1331
- </div>
1332
- <h1 class="text-2xl font-bold text-text-primary mb-2">Authorization Successful</h1>
1333
- <p class="text-text-secondary mb-4">
1334
- You have authorized <strong>${escapeHtml(client.name)}</strong> to access your account.
1335
- </p>
1336
- ${redirectUrl ? `<p class="text-sm text-text-secondary">Redirecting you back to ${escapeHtml(client.name)}...</p>` : ""}
1337
- </div>
1338
- ${redirectScript}
1339
- `;
1340
- return consentLayout(content, {
1341
- title: "Authorization Successful",
1342
- clientName: client.name,
1343
- clientIcon: client.icon,
1344
- ...layout
1345
- });
1346
- }
1347
- function consentDeniedPage(options) {
1348
- const { client, redirectUrl, layout = {} } = options;
1349
- const content = `
1350
- <div class="text-center">
1351
- <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mb-6">
1352
- <svg class="w-8 h-8 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1353
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1354
- </svg>
1355
- </div>
1356
- <h1 class="text-2xl font-bold text-text-primary mb-2">Authorization Denied</h1>
1357
- <p class="text-text-secondary mb-6">
1358
- You denied <strong>${escapeHtml(client.name)}</strong> access to your account.
1359
- </p>
1360
- ${redirectUrl ? `
1361
- <a href="${escapeHtml(
1362
- redirectUrl
1363
- )}" class="inline-block px-6 py-3 bg-primary hover:bg-primary/90 text-white font-medium rounded-lg transition-colors">
1364
- Return to ${escapeHtml(client.name)}
1365
- </a>
1366
- ` : ""}
1367
- </div>
1368
- `;
1369
- return consentLayout(content, {
1370
- title: "Authorization Denied",
1371
- clientName: client.name,
1372
- clientIcon: client.icon,
1373
- ...layout
1374
- });
1375
- }
1376
-
1377
- // libs/ui/src/pages/error.ts
1378
- function errorPage(options) {
1379
- const {
1380
- code,
1381
- title = "Something went wrong",
1382
- message,
1383
- details,
1384
- showStack = false,
1385
- stack,
1386
- showRetry = true,
1387
- retryUrl,
1388
- showHome = true,
1389
- homeUrl = "/",
1390
- showBack = false,
1391
- actions,
1392
- layout = {},
1393
- requestId
1394
- } = options;
1395
- const detailsHtml = details || showStack && stack ? `
1396
- <div class="mt-8 text-left">
1397
- ${details ? `
1398
- <div class="p-4 bg-gray-50 rounded-lg text-sm text-text-secondary mb-4">
1399
- <strong class="text-text-primary">Details:</strong>
1400
- <p class="mt-1">${escapeHtml(details)}</p>
1401
- </div>
1402
- ` : ""}
1403
- ${showStack && stack ? `
1404
- <details class="p-4 bg-gray-900 rounded-lg text-sm">
1405
- <summary class="text-gray-300 cursor-pointer hover:text-white">Stack Trace</summary>
1406
- <pre class="mt-2 text-xs text-gray-400 overflow-x-auto whitespace-pre-wrap">${escapeHtml(stack)}</pre>
1407
- </details>
1408
- ` : ""}
1409
- </div>
1410
- ` : "";
1411
- const requestIdHtml = requestId ? `
1412
- <p class="text-xs text-text-secondary mt-6">
1413
- Request ID: <code class="px-1.5 py-0.5 bg-gray-100 rounded text-xs">${escapeHtml(requestId)}</code>
1414
- </p>
1415
- ` : "";
1416
- const content = `
1417
- ${detailsHtml}
1418
- ${actions || ""}
1419
- ${requestIdHtml}
1420
- `;
1421
- return errorLayout(content, {
1422
- title: `${code ? `Error ${code} - ` : ""}${title}`,
1423
- errorCode: code?.toString(),
1424
- errorTitle: title,
1425
- errorMessage: message,
1426
- showRetry,
1427
- retryUrl,
1428
- showHome,
1429
- homeUrl,
1430
- ...layout
1431
- });
1432
- }
1433
- function notFoundPage(options = {}) {
1434
- return errorPage({
1435
- code: 404,
1436
- title: "Page Not Found",
1437
- message: "The page you're looking for doesn't exist or has been moved.",
1438
- showRetry: false,
1439
- ...options
1440
- });
1441
- }
1442
- function forbiddenPage(options = {}) {
1443
- return errorPage({
1444
- code: 403,
1445
- title: "Access Denied",
1446
- message: "You don't have permission to access this resource.",
1447
- showRetry: false,
1448
- ...options
1449
- });
1450
- }
1451
- function unauthorizedPage(options = {}) {
1452
- const { loginUrl = "/login", ...rest } = options;
1453
- return errorPage({
1454
- code: 401,
1455
- title: "Authentication Required",
1456
- message: "Please sign in to access this resource.",
1457
- showRetry: false,
1458
- showHome: false,
1459
- actions: `
1460
- <div class="flex justify-center mt-8">
1461
- <a href="${escapeHtml(
1462
- loginUrl
1463
- )}" class="px-6 py-3 bg-primary hover:bg-primary/90 text-white font-medium rounded-lg transition-colors">
1464
- Sign In
1465
- </a>
1466
- </div>
1467
- `,
1468
- ...rest
1469
- });
1470
- }
1471
- function serverErrorPage(options = {}) {
1472
- return errorPage({
1473
- code: 500,
1474
- title: "Server Error",
1475
- message: "We're having trouble processing your request. Please try again later.",
1476
- showRetry: true,
1477
- ...options
1478
- });
1479
- }
1480
- function maintenancePage(options = {}) {
1481
- const { estimatedTime, ...rest } = options;
1482
- const timeMessage = estimatedTime ? `We expect to be back by ${escapeHtml(estimatedTime)}.` : "We'll be back shortly.";
1483
- return errorPage({
1484
- code: 503,
1485
- title: "Under Maintenance",
1486
- message: `We're currently performing scheduled maintenance. ${timeMessage}`,
1487
- showRetry: true,
1488
- showHome: false,
1489
- ...rest
1490
- });
1491
- }
1492
- function rateLimitPage(options = {}) {
1493
- const { retryAfter, ...rest } = options;
1494
- const retryMessage = retryAfter ? `Please wait ${retryAfter} seconds before trying again.` : "Please wait a moment before trying again.";
1495
- return errorPage({
1496
- code: 429,
1497
- title: "Too Many Requests",
1498
- message: `You've made too many requests. ${retryMessage}`,
1499
- showRetry: true,
1500
- showHome: true,
1501
- ...rest
1502
- });
1503
- }
1504
- function offlinePage(options = {}) {
1505
- return errorPage({
1506
- title: "You're Offline",
1507
- message: "Please check your internet connection and try again.",
1508
- showRetry: true,
1509
- showHome: false,
1510
- ...options,
1511
- layout: {
1512
- ...options.layout
1513
- }
1514
- });
1515
- }
1516
- function sessionExpiredPage(options = {}) {
1517
- const { loginUrl = "/login", ...rest } = options;
1518
- return errorPage({
1519
- title: "Session Expired",
1520
- message: "Your session has expired. Please sign in again to continue.",
1521
- showRetry: false,
1522
- showHome: false,
1523
- actions: `
1524
- <div class="flex justify-center mt-8">
1525
- <a href="${escapeHtml(
1526
- loginUrl
1527
- )}" class="px-6 py-3 bg-primary hover:bg-primary/90 text-white font-medium rounded-lg transition-colors">
1528
- Sign In Again
1529
- </a>
1530
- </div>
1531
- `,
1532
- ...rest
1533
- });
1534
- }
1535
- function oauthErrorPage(options) {
1536
- const { errorCode, errorDescription, redirectUri, clientName, ...rest } = options;
1537
- const errorMessages = {
1538
- invalid_request: {
1539
- title: "Invalid Request",
1540
- message: "The authorization request is missing required parameters or is malformed."
1541
- },
1542
- unauthorized_client: {
1543
- title: "Unauthorized Client",
1544
- message: "The client is not authorized to request an authorization code."
1545
- },
1546
- access_denied: {
1547
- title: "Access Denied",
1548
- message: "The resource owner denied the authorization request."
1549
- },
1550
- unsupported_response_type: {
1551
- title: "Unsupported Response Type",
1552
- message: "The authorization server does not support the requested response type."
1553
- },
1554
- invalid_scope: {
1555
- title: "Invalid Scope",
1556
- message: "The requested scope is invalid, unknown, or malformed."
1557
- },
1558
- server_error: {
1559
- title: "Server Error",
1560
- message: "The authorization server encountered an unexpected error."
1561
- },
1562
- temporarily_unavailable: {
1563
- title: "Temporarily Unavailable",
1564
- message: "The authorization server is temporarily unavailable. Please try again later."
1565
- }
1566
- };
1567
- const errorInfo = errorCode && errorMessages[errorCode] ? errorMessages[errorCode] : { title: "Authorization Error", message: errorDescription || "An error occurred during authorization." };
1568
- const clientMessage = clientName ? ` while connecting to ${escapeHtml(clientName)}` : "";
1569
- const redirectAction = redirectUri ? `
1570
- <a href="${escapeHtml(
1571
- redirectUri
1572
- )}" class="px-6 py-3 bg-gray-100 hover:bg-gray-200 text-text-primary font-medium rounded-lg transition-colors">
1573
- Return to ${clientName ? escapeHtml(clientName) : "Application"}
1574
- </a>
1575
- ` : "";
1576
- return errorPage({
1577
- title: errorInfo.title,
1578
- message: `${errorInfo.message}${clientMessage}`,
1579
- details: errorCode && errorDescription ? `Error: ${errorCode}
1580
- ${errorDescription}` : void 0,
1581
- showRetry: errorCode === "server_error" || errorCode === "temporarily_unavailable",
1582
- showHome: true,
1583
- actions: redirectAction ? `<div class="flex justify-center gap-4 mt-8">${redirectAction}</div>` : void 0,
1584
- ...rest
1585
- });
1586
- }
1587
- // Annotate the CommonJS export names for ESM import in node:
1588
- 0 && (module.exports = {
1589
- consentDeniedPage,
1590
- consentPage,
1591
- consentSuccessPage,
1592
- errorPage,
1593
- forbiddenPage,
1594
- maintenancePage,
1595
- notFoundPage,
1596
- oauthErrorPage,
1597
- offlinePage,
1598
- rateLimitPage,
1599
- serverErrorPage,
1600
- sessionExpiredPage,
1601
- unauthorizedPage
1602
- });