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