@frontmcp/ui 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/README.md +140 -362
  2. package/bridge/runtime/index.d.ts +2 -1
  3. package/bridge/runtime/index.d.ts.map +1 -1
  4. package/bundler/file-cache/component-builder.d.ts +1 -1
  5. package/bundler/file-cache/component-builder.d.ts.map +1 -1
  6. package/bundler/file-cache/hash-calculator.d.ts +1 -1
  7. package/bundler/file-cache/hash-calculator.d.ts.map +1 -1
  8. package/bundler/file-cache/storage/filesystem.d.ts +1 -1
  9. package/bundler/file-cache/storage/filesystem.d.ts.map +1 -1
  10. package/bundler/file-cache/storage/interface.d.ts +1 -1
  11. package/bundler/file-cache/storage/interface.d.ts.map +1 -1
  12. package/bundler/file-cache/storage/redis.d.ts +1 -1
  13. package/bundler/file-cache/storage/redis.d.ts.map +1 -1
  14. package/bundler/index.js +10 -1057
  15. package/components/alert.schema.d.ts +6 -6
  16. package/components/avatar.schema.d.ts +9 -9
  17. package/components/badge.schema.d.ts +9 -9
  18. package/components/button.schema.d.ts +9 -9
  19. package/components/card.schema.d.ts +7 -7
  20. package/components/form.schema.d.ts +24 -24
  21. package/components/index.js +128 -198
  22. package/components/modal.schema.d.ts +8 -8
  23. package/components/table.schema.d.ts +6 -6
  24. package/esm/bridge/runtime/index.d.ts +2 -1
  25. package/esm/bridge/runtime/index.d.ts.map +1 -1
  26. package/esm/bundler/file-cache/component-builder.d.ts +1 -1
  27. package/esm/bundler/file-cache/component-builder.d.ts.map +1 -1
  28. package/esm/bundler/file-cache/hash-calculator.d.ts +1 -1
  29. package/esm/bundler/file-cache/hash-calculator.d.ts.map +1 -1
  30. package/esm/bundler/file-cache/storage/filesystem.d.ts +1 -1
  31. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +1 -1
  32. package/esm/bundler/file-cache/storage/interface.d.ts +1 -1
  33. package/esm/bundler/file-cache/storage/interface.d.ts.map +1 -1
  34. package/esm/bundler/file-cache/storage/redis.d.ts +1 -1
  35. package/esm/bundler/file-cache/storage/redis.d.ts.map +1 -1
  36. package/esm/bundler/index.js +3 -1050
  37. package/esm/components/alert.schema.d.ts +6 -6
  38. package/esm/components/avatar.schema.d.ts +9 -9
  39. package/esm/components/badge.schema.d.ts +9 -9
  40. package/esm/components/button.schema.d.ts +9 -9
  41. package/esm/components/card.schema.d.ts +7 -7
  42. package/esm/components/form.schema.d.ts +24 -24
  43. package/esm/components/index.js +136 -196
  44. package/esm/components/modal.schema.d.ts +8 -8
  45. package/esm/components/table.schema.d.ts +6 -6
  46. package/esm/index.d.ts +23 -39
  47. package/esm/index.d.ts.map +1 -1
  48. package/esm/index.js +4256 -16441
  49. package/esm/layouts/base.d.ts +2 -2
  50. package/esm/layouts/base.d.ts.map +1 -1
  51. package/esm/layouts/index.js +33 -516
  52. package/esm/package.json +8 -26
  53. package/esm/pages/index.js +100 -627
  54. package/esm/react/Alert.d.ts +1 -2
  55. package/esm/react/Alert.d.ts.map +1 -1
  56. package/esm/react/Badge.d.ts +1 -2
  57. package/esm/react/Badge.d.ts.map +1 -1
  58. package/esm/react/Button.d.ts +1 -2
  59. package/esm/react/Button.d.ts.map +1 -1
  60. package/esm/react/Card.d.ts +1 -2
  61. package/esm/react/Card.d.ts.map +1 -1
  62. package/esm/react/hooks/context.d.ts +1 -1
  63. package/esm/react/hooks/context.d.ts.map +1 -1
  64. package/esm/react/index.d.ts +5 -6
  65. package/esm/react/index.d.ts.map +1 -1
  66. package/esm/react/index.js +2074 -322
  67. package/esm/react/types.d.ts +1 -2
  68. package/esm/react/types.d.ts.map +1 -1
  69. package/esm/renderers/index.d.ts +10 -25
  70. package/esm/renderers/index.d.ts.map +1 -1
  71. package/esm/renderers/index.js +171 -1617
  72. package/esm/{runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  73. package/esm/renderers/react.adapter.d.ts.map +1 -0
  74. package/esm/renderers/react.renderer.d.ts +3 -3
  75. package/esm/renderers/react.renderer.d.ts.map +1 -1
  76. package/esm/universal/index.js +1755 -0
  77. package/esm/web-components/index.js +232 -287
  78. package/esm/widgets/index.js +89 -147
  79. package/index.d.ts +23 -39
  80. package/index.d.ts.map +1 -1
  81. package/index.js +6123 -18539
  82. package/layouts/base.d.ts +2 -2
  83. package/layouts/base.d.ts.map +1 -1
  84. package/layouts/index.js +43 -536
  85. package/package.json +8 -26
  86. package/pages/index.js +111 -648
  87. package/react/Alert.d.ts +1 -2
  88. package/react/Alert.d.ts.map +1 -1
  89. package/react/Badge.d.ts +1 -2
  90. package/react/Badge.d.ts.map +1 -1
  91. package/react/Button.d.ts +1 -2
  92. package/react/Button.d.ts.map +1 -1
  93. package/react/Card.d.ts +1 -2
  94. package/react/Card.d.ts.map +1 -1
  95. package/react/hooks/context.d.ts +1 -1
  96. package/react/hooks/context.d.ts.map +1 -1
  97. package/react/index.d.ts +5 -6
  98. package/react/index.d.ts.map +1 -1
  99. package/react/index.js +2065 -335
  100. package/react/types.d.ts +1 -2
  101. package/react/types.d.ts.map +1 -1
  102. package/renderers/index.d.ts +10 -25
  103. package/renderers/index.d.ts.map +1 -1
  104. package/renderers/index.js +175 -1641
  105. package/{runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  106. package/renderers/react.adapter.d.ts.map +1 -0
  107. package/renderers/react.renderer.d.ts +3 -3
  108. package/renderers/react.renderer.d.ts.map +1 -1
  109. package/universal/index.js +1841 -0
  110. package/web-components/index.js +224 -289
  111. package/widgets/index.js +80 -148
  112. package/adapters/index.d.ts +0 -13
  113. package/adapters/index.d.ts.map +0 -1
  114. package/adapters/index.js +0 -462
  115. package/adapters/platform-meta.d.ts +0 -166
  116. package/adapters/platform-meta.d.ts.map +0 -1
  117. package/adapters/response-builder.d.ts +0 -108
  118. package/adapters/response-builder.d.ts.map +0 -1
  119. package/adapters/serving-mode.d.ts +0 -107
  120. package/adapters/serving-mode.d.ts.map +0 -1
  121. package/base-template/bridge.d.ts +0 -90
  122. package/base-template/bridge.d.ts.map +0 -1
  123. package/base-template/default-base-template.d.ts +0 -92
  124. package/base-template/default-base-template.d.ts.map +0 -1
  125. package/base-template/index.d.ts +0 -15
  126. package/base-template/index.d.ts.map +0 -1
  127. package/base-template/index.js +0 -1398
  128. package/base-template/polyfills.d.ts +0 -31
  129. package/base-template/polyfills.d.ts.map +0 -1
  130. package/base-template/theme-styles.d.ts +0 -74
  131. package/base-template/theme-styles.d.ts.map +0 -1
  132. package/build/cdn-resources.d.ts +0 -243
  133. package/build/cdn-resources.d.ts.map +0 -1
  134. package/build/index.d.ts +0 -295
  135. package/build/index.d.ts.map +0 -1
  136. package/build/index.js +0 -7096
  137. package/build/widget-manifest.d.ts +0 -362
  138. package/build/widget-manifest.d.ts.map +0 -1
  139. package/dependency/cdn-registry.d.ts +0 -98
  140. package/dependency/cdn-registry.d.ts.map +0 -1
  141. package/dependency/import-map.d.ts +0 -186
  142. package/dependency/import-map.d.ts.map +0 -1
  143. package/dependency/import-parser.d.ts +0 -82
  144. package/dependency/import-parser.d.ts.map +0 -1
  145. package/dependency/index.d.ts +0 -17
  146. package/dependency/index.d.ts.map +0 -1
  147. package/dependency/resolver.d.ts +0 -164
  148. package/dependency/resolver.d.ts.map +0 -1
  149. package/dependency/schemas.d.ts +0 -486
  150. package/dependency/schemas.d.ts.map +0 -1
  151. package/dependency/template-loader.d.ts +0 -204
  152. package/dependency/template-loader.d.ts.map +0 -1
  153. package/dependency/template-processor.d.ts +0 -118
  154. package/dependency/template-processor.d.ts.map +0 -1
  155. package/dependency/types.d.ts +0 -739
  156. package/dependency/types.d.ts.map +0 -1
  157. package/esm/adapters/index.d.ts +0 -13
  158. package/esm/adapters/index.d.ts.map +0 -1
  159. package/esm/adapters/index.js +0 -427
  160. package/esm/adapters/platform-meta.d.ts +0 -166
  161. package/esm/adapters/platform-meta.d.ts.map +0 -1
  162. package/esm/adapters/response-builder.d.ts +0 -108
  163. package/esm/adapters/response-builder.d.ts.map +0 -1
  164. package/esm/adapters/serving-mode.d.ts +0 -107
  165. package/esm/adapters/serving-mode.d.ts.map +0 -1
  166. package/esm/base-template/bridge.d.ts +0 -90
  167. package/esm/base-template/bridge.d.ts.map +0 -1
  168. package/esm/base-template/default-base-template.d.ts +0 -92
  169. package/esm/base-template/default-base-template.d.ts.map +0 -1
  170. package/esm/base-template/index.d.ts +0 -15
  171. package/esm/base-template/index.d.ts.map +0 -1
  172. package/esm/base-template/index.js +0 -1364
  173. package/esm/base-template/polyfills.d.ts +0 -31
  174. package/esm/base-template/polyfills.d.ts.map +0 -1
  175. package/esm/base-template/theme-styles.d.ts +0 -74
  176. package/esm/base-template/theme-styles.d.ts.map +0 -1
  177. package/esm/build/cdn-resources.d.ts +0 -243
  178. package/esm/build/cdn-resources.d.ts.map +0 -1
  179. package/esm/build/index.d.ts +0 -295
  180. package/esm/build/index.d.ts.map +0 -1
  181. package/esm/build/index.js +0 -7021
  182. package/esm/build/widget-manifest.d.ts +0 -362
  183. package/esm/build/widget-manifest.d.ts.map +0 -1
  184. package/esm/dependency/cdn-registry.d.ts +0 -98
  185. package/esm/dependency/cdn-registry.d.ts.map +0 -1
  186. package/esm/dependency/import-map.d.ts +0 -186
  187. package/esm/dependency/import-map.d.ts.map +0 -1
  188. package/esm/dependency/import-parser.d.ts +0 -82
  189. package/esm/dependency/import-parser.d.ts.map +0 -1
  190. package/esm/dependency/index.d.ts +0 -17
  191. package/esm/dependency/index.d.ts.map +0 -1
  192. package/esm/dependency/resolver.d.ts +0 -164
  193. package/esm/dependency/resolver.d.ts.map +0 -1
  194. package/esm/dependency/schemas.d.ts +0 -486
  195. package/esm/dependency/schemas.d.ts.map +0 -1
  196. package/esm/dependency/template-loader.d.ts +0 -204
  197. package/esm/dependency/template-loader.d.ts.map +0 -1
  198. package/esm/dependency/template-processor.d.ts +0 -118
  199. package/esm/dependency/template-processor.d.ts.map +0 -1
  200. package/esm/dependency/types.d.ts +0 -739
  201. package/esm/dependency/types.d.ts.map +0 -1
  202. package/esm/handlebars/expression-extractor.d.ts +0 -147
  203. package/esm/handlebars/expression-extractor.d.ts.map +0 -1
  204. package/esm/handlebars/helpers.d.ts +0 -339
  205. package/esm/handlebars/helpers.d.ts.map +0 -1
  206. package/esm/handlebars/index.d.ts +0 -195
  207. package/esm/handlebars/index.d.ts.map +0 -1
  208. package/esm/handlebars/index.js +0 -587
  209. package/esm/registry/index.d.ts +0 -46
  210. package/esm/registry/index.d.ts.map +0 -1
  211. package/esm/registry/index.js +0 -6422
  212. package/esm/registry/render-template.d.ts +0 -91
  213. package/esm/registry/render-template.d.ts.map +0 -1
  214. package/esm/registry/tool-ui.registry.d.ts +0 -294
  215. package/esm/registry/tool-ui.registry.d.ts.map +0 -1
  216. package/esm/registry/uri-utils.d.ts +0 -56
  217. package/esm/registry/uri-utils.d.ts.map +0 -1
  218. package/esm/renderers/cache.d.ts +0 -145
  219. package/esm/renderers/cache.d.ts.map +0 -1
  220. package/esm/renderers/html.renderer.d.ts +0 -123
  221. package/esm/renderers/html.renderer.d.ts.map +0 -1
  222. package/esm/renderers/mdx.renderer.d.ts +0 -120
  223. package/esm/renderers/mdx.renderer.d.ts.map +0 -1
  224. package/esm/renderers/registry.d.ts +0 -134
  225. package/esm/renderers/registry.d.ts.map +0 -1
  226. package/esm/renderers/types.d.ts +0 -342
  227. package/esm/renderers/types.d.ts.map +0 -1
  228. package/esm/renderers/utils/detect.d.ts +0 -107
  229. package/esm/renderers/utils/detect.d.ts.map +0 -1
  230. package/esm/renderers/utils/hash.d.ts +0 -40
  231. package/esm/renderers/utils/hash.d.ts.map +0 -1
  232. package/esm/renderers/utils/index.d.ts +0 -9
  233. package/esm/renderers/utils/index.d.ts.map +0 -1
  234. package/esm/renderers/utils/transpiler.d.ts +0 -89
  235. package/esm/renderers/utils/transpiler.d.ts.map +0 -1
  236. package/esm/runtime/adapters/html.adapter.d.ts +0 -59
  237. package/esm/runtime/adapters/html.adapter.d.ts.map +0 -1
  238. package/esm/runtime/adapters/index.d.ts +0 -26
  239. package/esm/runtime/adapters/index.d.ts.map +0 -1
  240. package/esm/runtime/adapters/mdx.adapter.d.ts +0 -73
  241. package/esm/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  242. package/esm/runtime/adapters/react.adapter.d.ts.map +0 -1
  243. package/esm/runtime/adapters/types.d.ts +0 -95
  244. package/esm/runtime/adapters/types.d.ts.map +0 -1
  245. package/esm/runtime/csp.d.ts +0 -48
  246. package/esm/runtime/csp.d.ts.map +0 -1
  247. package/esm/runtime/index.d.ts +0 -17
  248. package/esm/runtime/index.d.ts.map +0 -1
  249. package/esm/runtime/index.js +0 -5186
  250. package/esm/runtime/mcp-bridge.d.ts +0 -101
  251. package/esm/runtime/mcp-bridge.d.ts.map +0 -1
  252. package/esm/runtime/renderer-runtime.d.ts +0 -133
  253. package/esm/runtime/renderer-runtime.d.ts.map +0 -1
  254. package/esm/runtime/sanitizer.d.ts +0 -172
  255. package/esm/runtime/sanitizer.d.ts.map +0 -1
  256. package/esm/runtime/types.d.ts +0 -415
  257. package/esm/runtime/types.d.ts.map +0 -1
  258. package/esm/runtime/wrapper.d.ts +0 -421
  259. package/esm/runtime/wrapper.d.ts.map +0 -1
  260. package/esm/styles/index.d.ts +0 -8
  261. package/esm/styles/index.d.ts.map +0 -1
  262. package/esm/styles/index.js +0 -171
  263. package/esm/styles/variants.d.ts +0 -51
  264. package/esm/styles/variants.d.ts.map +0 -1
  265. package/esm/theme/cdn.d.ts +0 -195
  266. package/esm/theme/cdn.d.ts.map +0 -1
  267. package/esm/theme/index.d.ts +0 -18
  268. package/esm/theme/index.d.ts.map +0 -1
  269. package/esm/theme/index.js +0 -700
  270. package/esm/theme/platforms.d.ts +0 -107
  271. package/esm/theme/platforms.d.ts.map +0 -1
  272. package/esm/theme/presets/github-openai.d.ts +0 -50
  273. package/esm/theme/presets/github-openai.d.ts.map +0 -1
  274. package/esm/theme/presets/index.d.ts +0 -11
  275. package/esm/theme/presets/index.d.ts.map +0 -1
  276. package/esm/theme/theme.d.ts +0 -396
  277. package/esm/theme/theme.d.ts.map +0 -1
  278. package/esm/tool-template/builder.d.ts +0 -213
  279. package/esm/tool-template/builder.d.ts.map +0 -1
  280. package/esm/tool-template/index.d.ts +0 -16
  281. package/esm/tool-template/index.d.ts.map +0 -1
  282. package/esm/tool-template/index.js +0 -3515
  283. package/esm/types/index.d.ts +0 -14
  284. package/esm/types/index.d.ts.map +0 -1
  285. package/esm/types/index.js +0 -75
  286. package/esm/types/ui-config.d.ts +0 -639
  287. package/esm/types/ui-config.d.ts.map +0 -1
  288. package/esm/types/ui-runtime.d.ts +0 -1007
  289. package/esm/types/ui-runtime.d.ts.map +0 -1
  290. package/esm/typings/cache/cache-adapter.d.ts +0 -125
  291. package/esm/typings/cache/cache-adapter.d.ts.map +0 -1
  292. package/esm/typings/cache/index.d.ts +0 -10
  293. package/esm/typings/cache/index.d.ts.map +0 -1
  294. package/esm/typings/cache/memory-cache.d.ts +0 -92
  295. package/esm/typings/cache/memory-cache.d.ts.map +0 -1
  296. package/esm/typings/dts-parser.d.ts +0 -90
  297. package/esm/typings/dts-parser.d.ts.map +0 -1
  298. package/esm/typings/index.d.ts +0 -48
  299. package/esm/typings/index.d.ts.map +0 -1
  300. package/esm/typings/schemas.d.ts +0 -232
  301. package/esm/typings/schemas.d.ts.map +0 -1
  302. package/esm/typings/type-fetcher.d.ts +0 -89
  303. package/esm/typings/type-fetcher.d.ts.map +0 -1
  304. package/esm/typings/types.d.ts +0 -320
  305. package/esm/typings/types.d.ts.map +0 -1
  306. package/esm/utils/escape-html.d.ts +0 -58
  307. package/esm/utils/escape-html.d.ts.map +0 -1
  308. package/esm/utils/index.d.ts +0 -10
  309. package/esm/utils/index.d.ts.map +0 -1
  310. package/esm/utils/index.js +0 -40
  311. package/esm/utils/safe-stringify.d.ts +0 -30
  312. package/esm/utils/safe-stringify.d.ts.map +0 -1
  313. package/esm/validation/error-box.d.ts +0 -56
  314. package/esm/validation/error-box.d.ts.map +0 -1
  315. package/esm/validation/index.d.ts +0 -13
  316. package/esm/validation/index.d.ts.map +0 -1
  317. package/esm/validation/index.js +0 -562
  318. package/esm/validation/schema-paths.d.ts +0 -118
  319. package/esm/validation/schema-paths.d.ts.map +0 -1
  320. package/esm/validation/template-validator.d.ts +0 -143
  321. package/esm/validation/template-validator.d.ts.map +0 -1
  322. package/esm/validation/wrapper.d.ts +0 -97
  323. package/esm/validation/wrapper.d.ts.map +0 -1
  324. package/handlebars/expression-extractor.d.ts +0 -147
  325. package/handlebars/expression-extractor.d.ts.map +0 -1
  326. package/handlebars/helpers.d.ts +0 -339
  327. package/handlebars/helpers.d.ts.map +0 -1
  328. package/handlebars/index.d.ts +0 -195
  329. package/handlebars/index.d.ts.map +0 -1
  330. package/handlebars/index.js +0 -666
  331. package/registry/index.d.ts +0 -46
  332. package/registry/index.d.ts.map +0 -1
  333. package/registry/index.js +0 -6465
  334. package/registry/render-template.d.ts +0 -91
  335. package/registry/render-template.d.ts.map +0 -1
  336. package/registry/tool-ui.registry.d.ts +0 -294
  337. package/registry/tool-ui.registry.d.ts.map +0 -1
  338. package/registry/uri-utils.d.ts +0 -56
  339. package/registry/uri-utils.d.ts.map +0 -1
  340. package/renderers/cache.d.ts +0 -145
  341. package/renderers/cache.d.ts.map +0 -1
  342. package/renderers/html.renderer.d.ts +0 -123
  343. package/renderers/html.renderer.d.ts.map +0 -1
  344. package/renderers/mdx.renderer.d.ts +0 -120
  345. package/renderers/mdx.renderer.d.ts.map +0 -1
  346. package/renderers/registry.d.ts +0 -134
  347. package/renderers/registry.d.ts.map +0 -1
  348. package/renderers/types.d.ts +0 -342
  349. package/renderers/types.d.ts.map +0 -1
  350. package/renderers/utils/detect.d.ts +0 -107
  351. package/renderers/utils/detect.d.ts.map +0 -1
  352. package/renderers/utils/hash.d.ts +0 -40
  353. package/renderers/utils/hash.d.ts.map +0 -1
  354. package/renderers/utils/index.d.ts +0 -9
  355. package/renderers/utils/index.d.ts.map +0 -1
  356. package/renderers/utils/transpiler.d.ts +0 -89
  357. package/renderers/utils/transpiler.d.ts.map +0 -1
  358. package/runtime/adapters/html.adapter.d.ts +0 -59
  359. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  360. package/runtime/adapters/index.d.ts +0 -26
  361. package/runtime/adapters/index.d.ts.map +0 -1
  362. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  363. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  364. package/runtime/adapters/react.adapter.d.ts.map +0 -1
  365. package/runtime/adapters/types.d.ts +0 -95
  366. package/runtime/adapters/types.d.ts.map +0 -1
  367. package/runtime/csp.d.ts +0 -48
  368. package/runtime/csp.d.ts.map +0 -1
  369. package/runtime/index.d.ts +0 -17
  370. package/runtime/index.d.ts.map +0 -1
  371. package/runtime/index.js +0 -5264
  372. package/runtime/mcp-bridge.d.ts +0 -101
  373. package/runtime/mcp-bridge.d.ts.map +0 -1
  374. package/runtime/renderer-runtime.d.ts +0 -133
  375. package/runtime/renderer-runtime.d.ts.map +0 -1
  376. package/runtime/sanitizer.d.ts +0 -172
  377. package/runtime/sanitizer.d.ts.map +0 -1
  378. package/runtime/types.d.ts +0 -415
  379. package/runtime/types.d.ts.map +0 -1
  380. package/runtime/wrapper.d.ts +0 -421
  381. package/runtime/wrapper.d.ts.map +0 -1
  382. package/styles/index.d.ts +0 -8
  383. package/styles/index.d.ts.map +0 -1
  384. package/styles/index.js +0 -222
  385. package/styles/variants.d.ts +0 -51
  386. package/styles/variants.d.ts.map +0 -1
  387. package/theme/cdn.d.ts +0 -195
  388. package/theme/cdn.d.ts.map +0 -1
  389. package/theme/index.d.ts +0 -18
  390. package/theme/index.d.ts.map +0 -1
  391. package/theme/index.js +0 -757
  392. package/theme/platforms.d.ts +0 -107
  393. package/theme/platforms.d.ts.map +0 -1
  394. package/theme/presets/github-openai.d.ts +0 -50
  395. package/theme/presets/github-openai.d.ts.map +0 -1
  396. package/theme/presets/index.d.ts +0 -11
  397. package/theme/presets/index.d.ts.map +0 -1
  398. package/theme/theme.d.ts +0 -396
  399. package/theme/theme.d.ts.map +0 -1
  400. package/tool-template/builder.d.ts +0 -213
  401. package/tool-template/builder.d.ts.map +0 -1
  402. package/tool-template/index.d.ts +0 -16
  403. package/tool-template/index.d.ts.map +0 -1
  404. package/tool-template/index.js +0 -3559
  405. package/types/index.d.ts +0 -14
  406. package/types/index.d.ts.map +0 -1
  407. package/types/index.js +0 -108
  408. package/types/ui-config.d.ts +0 -639
  409. package/types/ui-config.d.ts.map +0 -1
  410. package/types/ui-runtime.d.ts +0 -1007
  411. package/types/ui-runtime.d.ts.map +0 -1
  412. package/typings/cache/cache-adapter.d.ts +0 -125
  413. package/typings/cache/cache-adapter.d.ts.map +0 -1
  414. package/typings/cache/index.d.ts +0 -10
  415. package/typings/cache/index.d.ts.map +0 -1
  416. package/typings/cache/memory-cache.d.ts +0 -92
  417. package/typings/cache/memory-cache.d.ts.map +0 -1
  418. package/typings/dts-parser.d.ts +0 -90
  419. package/typings/dts-parser.d.ts.map +0 -1
  420. package/typings/index.d.ts +0 -48
  421. package/typings/index.d.ts.map +0 -1
  422. package/typings/schemas.d.ts +0 -232
  423. package/typings/schemas.d.ts.map +0 -1
  424. package/typings/type-fetcher.d.ts +0 -89
  425. package/typings/type-fetcher.d.ts.map +0 -1
  426. package/typings/types.d.ts +0 -320
  427. package/typings/types.d.ts.map +0 -1
  428. package/utils/escape-html.d.ts +0 -58
  429. package/utils/escape-html.d.ts.map +0 -1
  430. package/utils/index.d.ts +0 -10
  431. package/utils/index.d.ts.map +0 -1
  432. package/utils/index.js +0 -70
  433. package/utils/safe-stringify.d.ts +0 -30
  434. package/utils/safe-stringify.d.ts.map +0 -1
  435. package/validation/error-box.d.ts +0 -56
  436. package/validation/error-box.d.ts.map +0 -1
  437. package/validation/index.d.ts +0 -13
  438. package/validation/index.d.ts.map +0 -1
  439. package/validation/index.js +0 -603
  440. package/validation/schema-paths.d.ts +0 -118
  441. package/validation/schema-paths.d.ts.map +0 -1
  442. package/validation/template-validator.d.ts +0 -143
  443. package/validation/template-validator.d.ts.map +0 -1
  444. package/validation/wrapper.d.ts +0 -97
  445. package/validation/wrapper.d.ts.map +0 -1
@@ -1,500 +1,17 @@
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
1
  // libs/ui/src/layouts/base.ts
2
+ import {
3
+ OPENAI_PLATFORM,
4
+ canUseCdn,
5
+ needsInlineScripts,
6
+ DEFAULT_THEME,
7
+ buildThemeCss,
8
+ mergeThemes,
9
+ buildFontPreconnect,
10
+ buildFontStylesheets,
11
+ buildCdnScripts
12
+ } from "@frontmcp/uipack/theme";
13
+ import { escapeHtml } from "@frontmcp/uipack/utils";
14
+ import { escapeHtml as escapeHtml2 } from "@frontmcp/uipack/utils";
498
15
  function getSizeClass(size) {
499
16
  const sizeMap = {
500
17
  xs: "max-w-sm",
@@ -659,20 +176,20 @@ function createLayoutBuilder(defaults) {
659
176
  function consentLayout(content, options) {
660
177
  const { clientName, clientIcon, userInfo, ...baseOptions } = options;
661
178
  const headerHtml = clientName ? `<div class="text-center mb-6">
662
- ${clientIcon ? `<img src="${escapeHtml(clientIcon)}" alt="${escapeHtml(
179
+ ${clientIcon ? `<img src="${escapeHtml2(clientIcon)}" alt="${escapeHtml2(
663
180
  clientName
664
181
  )}" 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())}
182
+ ${escapeHtml2(clientName.charAt(0).toUpperCase())}
666
183
  </div>`}
667
- <h1 class="text-2xl font-bold text-text-primary">${escapeHtml(clientName)}</h1>
184
+ <h1 class="text-2xl font-bold text-text-primary">${escapeHtml2(clientName)}</h1>
668
185
  </div>` : "";
669
186
  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())}
187
+ ${userInfo.avatar ? `<img src="${escapeHtml2(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">
188
+ ${escapeHtml2((userInfo.name || userInfo.email || "U").charAt(0).toUpperCase())}
672
189
  </div>`}
673
190
  <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>` : ""}
191
+ ${userInfo.name ? `<div class="font-medium text-text-primary">${escapeHtml2(userInfo.name)}</div>` : ""}
192
+ ${userInfo.email ? `<div class="text-sm text-text-secondary">${escapeHtml2(userInfo.email)}</div>` : ""}
676
193
  </div>
677
194
  </div>` : "";
678
195
  const wrappedContent = `
@@ -708,15 +225,15 @@ function errorLayout(content, options) {
708
225
  </svg>
709
226
  </div>
710
227
 
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>` : ""}
228
+ ${errorCode ? `<p class="text-6xl font-bold text-danger mb-2">${escapeHtml2(errorCode)}</p>` : ""}
229
+ <h1 class="text-2xl font-bold text-text-primary mb-4">${escapeHtml2(errorTitle)}</h1>
230
+ ${errorMessage ? `<p class="text-text-secondary mb-8">${escapeHtml2(errorMessage)}</p>` : ""}
714
231
 
715
232
  ${content}
716
233
 
717
234
  <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(
235
+ ${showRetry ? `<button onclick="${retryUrl ? `window.location.href='${escapeHtml2(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>` : ""}
236
+ ${showHome ? `<a href="${escapeHtml2(
720
237
  homeUrl
721
238
  )}" 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
239
  </div>
@@ -750,102 +267,58 @@ var errorLayoutBuilder = createLayoutBuilder({
750
267
  background: "solid"
751
268
  });
752
269
 
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";
270
+ // libs/ui/src/components/button.ts
271
+ import { validateOptions } from "@frontmcp/uipack/validation";
799
272
 
800
273
  // 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({
274
+ import { z } from "zod";
275
+ var ButtonVariantSchema = z.enum(["primary", "secondary", "outline", "ghost", "danger", "success", "link"]);
276
+ var ButtonSizeSchema = z.enum(["xs", "sm", "md", "lg", "xl"]);
277
+ var ButtonOptionsSchema = z.object({
805
278
  /** Button variant */
806
279
  variant: ButtonVariantSchema.optional(),
807
280
  /** Button size */
808
281
  size: ButtonSizeSchema.optional(),
809
282
  /** Button type attribute */
810
- type: z2.enum(["button", "submit", "reset"]).optional(),
283
+ type: z.enum(["button", "submit", "reset"]).optional(),
811
284
  /** Disabled state */
812
- disabled: z2.boolean().optional(),
285
+ disabled: z.boolean().optional(),
813
286
  /** Loading state */
814
- loading: z2.boolean().optional(),
287
+ loading: z.boolean().optional(),
815
288
  /** Full width */
816
- fullWidth: z2.boolean().optional(),
289
+ fullWidth: z.boolean().optional(),
817
290
  /** Icon before text (HTML string) */
818
- iconBefore: z2.string().optional(),
291
+ iconBefore: z.string().optional(),
819
292
  /** Icon after text (HTML string) */
820
- iconAfter: z2.string().optional(),
293
+ iconAfter: z.string().optional(),
821
294
  /** Icon only (no text) */
822
- iconOnly: z2.boolean().optional(),
295
+ iconOnly: z.boolean().optional(),
823
296
  /** Additional CSS classes */
824
- className: z2.string().optional(),
297
+ className: z.string().optional(),
825
298
  /** Button ID */
826
- id: z2.string().optional(),
299
+ id: z.string().optional(),
827
300
  /** Name attribute */
828
- name: z2.string().optional(),
301
+ name: z.string().optional(),
829
302
  /** Value attribute */
830
- value: z2.string().optional(),
303
+ value: z.string().optional(),
831
304
  /** Click handler (URL for links) */
832
- href: z2.string().optional(),
305
+ href: z.string().optional(),
833
306
  /** Open in new tab */
834
- target: z2.enum(["_blank", "_self"]).optional(),
307
+ target: z.enum(["_blank", "_self"]).optional(),
835
308
  /** Data attributes */
836
- data: z2.record(z2.string(), z2.string()).optional(),
309
+ data: z.record(z.string(), z.string()).optional(),
837
310
  /** ARIA label */
838
- ariaLabel: z2.string().optional()
311
+ ariaLabel: z.string().optional()
839
312
  }).strict();
840
- var ButtonGroupOptionsSchema = z2.object({
313
+ var ButtonGroupOptionsSchema = z.object({
841
314
  /** Attach buttons visually */
842
- attached: z2.boolean().optional(),
315
+ attached: z.boolean().optional(),
843
316
  /** Direction */
844
- direction: z2.enum(["horizontal", "vertical"]).optional(),
317
+ direction: z.enum(["horizontal", "vertical"]).optional(),
845
318
  /** Gap between buttons */
846
- gap: z2.enum(["sm", "md", "lg"]).optional(),
319
+ gap: z.enum(["sm", "md", "lg"]).optional(),
847
320
  /** Additional CSS classes */
848
- className: z2.string().optional()
321
+ className: z.string().optional()
849
322
  }).strict();
850
323
 
851
324
  // libs/ui/src/components/button.ts
@@ -938,7 +411,7 @@ function button(text, options = {}) {
938
411
  }
939
412
  const variantClasses = getVariantClasses(variant);
940
413
  const sizeClasses = getSizeClasses(size, iconOnly);
941
- const safeClassName = className ? escapeHtml(className) : "";
414
+ const safeClassName = className ? escapeHtml2(className) : "";
942
415
  const baseClasses = [
943
416
  "inline-flex items-center justify-center",
944
417
  "font-medium",
@@ -953,24 +426,24 @@ function button(text, options = {}) {
953
426
  ].filter(Boolean).join(" ");
954
427
  const dataAttrs = data ? Object.entries(data).map(([key, val]) => {
955
428
  const safeKey = sanitizeDataKey(key);
956
- return safeKey ? `data-${safeKey}="${escapeHtml(val)}"` : "";
429
+ return safeKey ? `data-${safeKey}="${escapeHtml2(val)}"` : "";
957
430
  }).filter(Boolean).join(" ") : "";
958
- const idAttr = id ? `id="${escapeHtml(id)}"` : "";
959
- const nameAttr = name ? `name="${escapeHtml(name)}"` : "";
960
- const valueAttr = value ? `value="${escapeHtml(value)}"` : "";
431
+ const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
432
+ const nameAttr = name ? `name="${escapeHtml2(name)}"` : "";
433
+ const valueAttr = value ? `value="${escapeHtml2(value)}"` : "";
961
434
  const disabledAttr = disabled || loading ? "disabled" : "";
962
- const targetAttr = target ? `target="${escapeHtml(target)}"` : "";
435
+ const targetAttr = target ? `target="${escapeHtml2(target)}"` : "";
963
436
  const relAttr = target === "_blank" ? 'rel="noopener noreferrer"' : "";
964
437
  const trimmedText = text.trim();
965
438
  const effectiveAriaLabel = ariaLabel ?? (iconOnly && trimmedText ? trimmedText : void 0);
966
- const ariaLabelAttr = effectiveAriaLabel ? `aria-label="${escapeHtml(effectiveAriaLabel)}"` : "";
439
+ const ariaLabelAttr = effectiveAriaLabel ? `aria-label="${escapeHtml2(effectiveAriaLabel)}"` : "";
967
440
  const iconBeforeHtml = iconBefore && !loading ? `<span class="${iconOnly ? "" : "mr-2"}">${iconBefore}</span>` : "";
968
441
  const iconAfterHtml = iconAfter && !loading ? `<span class="${iconOnly ? "" : "ml-2"}">${iconAfter}</span>` : "";
969
442
  const loadingHtml = loading ? loadingSpinner : "";
970
- const textHtml = iconOnly ? "" : escapeHtml(text);
443
+ const textHtml = iconOnly ? "" : escapeHtml2(text);
971
444
  const contentHtml = `${loadingHtml}${iconBeforeHtml}${textHtml}${iconAfterHtml}`;
972
445
  if (href && !disabled && !loading && isValidHrefProtocol(href)) {
973
- return `<a href="${escapeHtml(
446
+ return `<a href="${escapeHtml2(
974
447
  href
975
448
  )}" class="${baseClasses}" ${idAttr} ${dataAttrs} ${ariaLabelAttr} ${targetAttr} ${relAttr}>
976
449
  ${contentHtml}
@@ -1023,19 +496,19 @@ function getPermissionIcon(scope, customIcon) {
1023
496
  }
1024
497
  function permissionList(permissions, options = {}) {
1025
498
  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>` : "";
499
+ const titleHtml = title ? `<h4 class="font-medium text-text-primary mb-3">${escapeHtml2(title)}</h4>` : "";
1027
500
  const itemsHtml = permissions.map((perm, index) => {
1028
501
  const icon = getPermissionIcon(perm.scope, perm.icon);
1029
502
  const sensitiveClasses = perm.sensitive ? "border-warning/30 bg-warning/5" : "border-border";
1030
503
  const sensitiveLabel = perm.sensitive ? '<span class="text-xs text-warning font-medium ml-2">Sensitive</span>' : "";
1031
504
  const checkboxHtml = checkable ? `<input
1032
505
  type="checkbox"
1033
- name="${escapeHtml(inputName)}[]"
1034
- value="${escapeHtml(perm.scope)}"
506
+ name="${escapeHtml2(inputName)}[]"
507
+ value="${escapeHtml2(perm.scope)}"
1035
508
  class="w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
1036
509
  ${perm.checked || perm.required ? "checked" : ""}
1037
510
  ${perm.required ? "disabled" : ""}
1038
- id="${id ? escapeHtml(id) : "perm"}-${index}"
511
+ id="${id ? escapeHtml2(id) : "perm"}-${index}"
1039
512
  >` : `<div class="w-5 h-5 rounded-full bg-success/10 text-success flex items-center justify-center">
1040
513
  <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1041
514
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"/>
@@ -1047,18 +520,18 @@ function permissionList(permissions, options = {}) {
1047
520
  </div>
1048
521
  <div class="flex-1 min-w-0">
1049
522
  <div class="flex items-center">
1050
- <span class="font-medium text-text-primary">${escapeHtml(perm.name)}</span>
523
+ <span class="font-medium text-text-primary">${escapeHtml2(perm.name)}</span>
1051
524
  ${perm.required ? '<span class="text-xs text-text-secondary ml-2">(Required)</span>' : ""}
1052
525
  ${sensitiveLabel}
1053
526
  </div>
1054
- ${perm.description ? `<p class="text-sm text-text-secondary mt-0.5">${escapeHtml(perm.description)}</p>` : ""}
527
+ ${perm.description ? `<p class="text-sm text-text-secondary mt-0.5">${escapeHtml2(perm.description)}</p>` : ""}
1055
528
  </div>
1056
529
  <div class="flex-shrink-0">
1057
530
  ${checkboxHtml}
1058
531
  </div>
1059
532
  </div>`;
1060
533
  }).join("\n");
1061
- const idAttr = id ? `id="${escapeHtml(id)}"` : "";
534
+ const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
1062
535
  return `<div class="permission-list ${className}" ${idAttr}>
1063
536
  ${titleHtml}
1064
537
  <div class="space-y-2">
@@ -1069,7 +542,7 @@ function permissionList(permissions, options = {}) {
1069
542
 
1070
543
  // libs/ui/src/components/form.ts
1071
544
  function hiddenInput(name, value) {
1072
- return `<input type="hidden" name="${escapeHtml(name)}" value="${escapeHtml(value)}">`;
545
+ return `<input type="hidden" name="${escapeHtml2(name)}" value="${escapeHtml2(value)}">`;
1073
546
  }
1074
547
  function csrfInput(token) {
1075
548
  return hiddenInput("_csrf", token);
@@ -1125,7 +598,7 @@ function alert(message, options = {}) {
1125
598
  const iconHtml = showIcon ? `<div class="flex-shrink-0 ${variantClasses.icon}">
1126
599
  ${icon || alertIcons[variant]}
1127
600
  </div>` : "";
1128
- const titleHtml = title ? `<h3 class="font-semibold">${escapeHtml(title)}</h3>` : "";
601
+ const titleHtml = title ? `<h3 class="font-semibold">${escapeHtml2(title)}</h3>` : "";
1129
602
  const dismissHtml = dismissible ? `<button
1130
603
  type="button"
1131
604
  class="flex-shrink-0 ml-auto -mr-1 -mt-1 p-1 rounded hover:bg-black/5 transition-colors"
@@ -1137,13 +610,13 @@ function alert(message, options = {}) {
1137
610
  </svg>
1138
611
  </button>` : "";
1139
612
  const actionsHtml = actions ? `<div class="mt-3">${actions}</div>` : "";
1140
- const idAttr = id ? `id="${escapeHtml(id)}"` : "";
613
+ const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
1141
614
  return `<div class="alert ${baseClasses}" role="alert" ${idAttr}>
1142
615
  <div class="flex gap-3">
1143
616
  ${iconHtml}
1144
617
  <div class="flex-1">
1145
618
  ${titleHtml}
1146
- <div class="${title ? "mt-1" : ""}">${escapeHtml(message)}</div>
619
+ <div class="${title ? "mt-1" : ""}">${escapeHtml2(message)}</div>
1147
620
  ${actionsHtml}
1148
621
  </div>
1149
622
  ${dismissHtml}
@@ -1180,30 +653,30 @@ function consentPage(options) {
1180
653
  }) : "";
1181
654
  const clientHeader = `
1182
655
  <div class="text-center mb-6">
1183
- ${client.icon ? `<img src="${escapeHtml(client.icon)}" alt="${escapeHtml(
656
+ ${client.icon ? `<img src="${escapeHtml2(client.icon)}" alt="${escapeHtml2(
1184
657
  client.name
1185
658
  )}" 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())}
659
+ ${escapeHtml2(client.name.charAt(0).toUpperCase())}
1187
660
  </div>`}
1188
661
  <h1 class="text-xl font-bold text-text-primary">
1189
662
  ${client.verified ? `<span class="inline-flex items-center gap-1">
1190
- ${escapeHtml(client.name)}
663
+ ${escapeHtml2(client.name)}
1191
664
  <svg class="w-5 h-5 text-primary" fill="currentColor" viewBox="0 0 20 20">
1192
665
  <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
666
  </svg>
1194
- </span>` : escapeHtml(client.name)}
667
+ </span>` : escapeHtml2(client.name)}
1195
668
  </h1>
1196
669
  <p class="text-text-secondary mt-1">wants to access your account</p>
1197
670
  </div>
1198
671
  `;
1199
672
  const userSection = user ? `
1200
673
  <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())}
674
+ ${user.avatar ? `<img src="${escapeHtml2(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">
675
+ ${escapeHtml2((user.name || user.email || "U").charAt(0).toUpperCase())}
1203
676
  </div>`}
1204
677
  <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>` : ""}
678
+ ${user.name ? `<div class="font-medium text-text-primary truncate">${escapeHtml2(user.name)}</div>` : ""}
679
+ ${user.email ? `<div class="text-sm text-text-secondary truncate">${escapeHtml2(user.email)}</div>` : ""}
1207
680
  </div>
1208
681
  <a href="/login?prompt=select_account" class="text-sm text-primary hover:text-primary/80">
1209
682
  Switch account
@@ -1212,7 +685,7 @@ function consentPage(options) {
1212
685
  ` : "";
1213
686
  const permissionsSection = `
1214
687
  <div class="mb-6">
1215
- <h3 class="font-medium text-text-primary mb-3">This will allow ${escapeHtml(client.name)} to:</h3>
688
+ <h3 class="font-medium text-text-primary mb-3">This will allow ${escapeHtml2(client.name)} to:</h3>
1216
689
  ${permissionList(permissions, {
1217
690
  checkable: allowScopeSelection,
1218
691
  inputName: "scope"
@@ -1233,12 +706,12 @@ function consentPage(options) {
1233
706
  ].filter(Boolean).join("\n");
1234
707
  const actionsHtml = `
1235
708
  <div class="flex gap-3 pt-4">
1236
- <form action="${escapeHtml(denyUrl || approveUrl)}" method="post" class="flex-1">
709
+ <form action="${escapeHtml2(denyUrl || approveUrl)}" method="post" class="flex-1">
1237
710
  ${hiddenFields}
1238
711
  <input type="hidden" name="action" value="deny">
1239
712
  ${outlineButton(denyText, { type: "submit", fullWidth: true })}
1240
713
  </form>
1241
- <form action="${escapeHtml(approveUrl)}" method="post" class="flex-1">
714
+ <form action="${escapeHtml2(approveUrl)}" method="post" class="flex-1">
1242
715
  ${hiddenFields}
1243
716
  <input type="hidden" name="action" value="approve">
1244
717
  ${primaryButton(approveText, { type: "submit", fullWidth: true })}
@@ -1247,13 +720,13 @@ function consentPage(options) {
1247
720
  `;
1248
721
  const linksHtml = client.privacyUrl || client.termsUrl || client.websiteUrl ? `
1249
722
  <div class="text-center text-xs text-text-secondary mt-6 space-x-3">
1250
- ${client.websiteUrl ? `<a href="${escapeHtml(
723
+ ${client.websiteUrl ? `<a href="${escapeHtml2(
1251
724
  client.websiteUrl
1252
725
  )}" target="_blank" rel="noopener" class="hover:text-primary">Website</a>` : ""}
1253
- ${client.privacyUrl ? `<a href="${escapeHtml(
726
+ ${client.privacyUrl ? `<a href="${escapeHtml2(
1254
727
  client.privacyUrl
1255
728
  )}" target="_blank" rel="noopener" class="hover:text-primary">Privacy Policy</a>` : ""}
1256
- ${client.termsUrl ? `<a href="${escapeHtml(
729
+ ${client.termsUrl ? `<a href="${escapeHtml2(
1257
730
  client.termsUrl
1258
731
  )}" target="_blank" rel="noopener" class="hover:text-primary">Terms of Service</a>` : ""}
1259
732
  </div>
@@ -1280,7 +753,7 @@ function consentSuccessPage(options) {
1280
753
  const redirectScript = redirectUrl && autoRedirectDelay > 0 ? `
1281
754
  <script>
1282
755
  setTimeout(() => {
1283
- window.location.href = '${escapeHtml(redirectUrl)}';
756
+ window.location.href = '${escapeHtml2(redirectUrl)}';
1284
757
  }, ${autoRedirectDelay});
1285
758
  </script>
1286
759
  ` : "";
@@ -1293,9 +766,9 @@ function consentSuccessPage(options) {
1293
766
  </div>
1294
767
  <h1 class="text-2xl font-bold text-text-primary mb-2">Authorization Successful</h1>
1295
768
  <p class="text-text-secondary mb-4">
1296
- You have authorized <strong>${escapeHtml(client.name)}</strong> to access your account.
769
+ You have authorized <strong>${escapeHtml2(client.name)}</strong> to access your account.
1297
770
  </p>
1298
- ${redirectUrl ? `<p class="text-sm text-text-secondary">Redirecting you back to ${escapeHtml(client.name)}...</p>` : ""}
771
+ ${redirectUrl ? `<p class="text-sm text-text-secondary">Redirecting you back to ${escapeHtml2(client.name)}...</p>` : ""}
1299
772
  </div>
1300
773
  ${redirectScript}
1301
774
  `;
@@ -1317,13 +790,13 @@ function consentDeniedPage(options) {
1317
790
  </div>
1318
791
  <h1 class="text-2xl font-bold text-text-primary mb-2">Authorization Denied</h1>
1319
792
  <p class="text-text-secondary mb-6">
1320
- You denied <strong>${escapeHtml(client.name)}</strong> access to your account.
793
+ You denied <strong>${escapeHtml2(client.name)}</strong> access to your account.
1321
794
  </p>
1322
795
  ${redirectUrl ? `
1323
- <a href="${escapeHtml(
796
+ <a href="${escapeHtml2(
1324
797
  redirectUrl
1325
798
  )}" 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)}
799
+ Return to ${escapeHtml2(client.name)}
1327
800
  </a>
1328
801
  ` : ""}
1329
802
  </div>
@@ -1359,20 +832,20 @@ function errorPage(options) {
1359
832
  ${details ? `
1360
833
  <div class="p-4 bg-gray-50 rounded-lg text-sm text-text-secondary mb-4">
1361
834
  <strong class="text-text-primary">Details:</strong>
1362
- <p class="mt-1">${escapeHtml(details)}</p>
835
+ <p class="mt-1">${escapeHtml2(details)}</p>
1363
836
  </div>
1364
837
  ` : ""}
1365
838
  ${showStack && stack ? `
1366
839
  <details class="p-4 bg-gray-900 rounded-lg text-sm">
1367
840
  <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>
841
+ <pre class="mt-2 text-xs text-gray-400 overflow-x-auto whitespace-pre-wrap">${escapeHtml2(stack)}</pre>
1369
842
  </details>
1370
843
  ` : ""}
1371
844
  </div>
1372
845
  ` : "";
1373
846
  const requestIdHtml = requestId ? `
1374
847
  <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>
848
+ Request ID: <code class="px-1.5 py-0.5 bg-gray-100 rounded text-xs">${escapeHtml2(requestId)}</code>
1376
849
  </p>
1377
850
  ` : "";
1378
851
  const content = `
@@ -1420,7 +893,7 @@ function unauthorizedPage(options = {}) {
1420
893
  showHome: false,
1421
894
  actions: `
1422
895
  <div class="flex justify-center mt-8">
1423
- <a href="${escapeHtml(
896
+ <a href="${escapeHtml2(
1424
897
  loginUrl
1425
898
  )}" class="px-6 py-3 bg-primary hover:bg-primary/90 text-white font-medium rounded-lg transition-colors">
1426
899
  Sign In
@@ -1441,7 +914,7 @@ function serverErrorPage(options = {}) {
1441
914
  }
1442
915
  function maintenancePage(options = {}) {
1443
916
  const { estimatedTime, ...rest } = options;
1444
- const timeMessage = estimatedTime ? `We expect to be back by ${escapeHtml(estimatedTime)}.` : "We'll be back shortly.";
917
+ const timeMessage = estimatedTime ? `We expect to be back by ${escapeHtml2(estimatedTime)}.` : "We'll be back shortly.";
1445
918
  return errorPage({
1446
919
  code: 503,
1447
920
  title: "Under Maintenance",
@@ -1484,7 +957,7 @@ function sessionExpiredPage(options = {}) {
1484
957
  showHome: false,
1485
958
  actions: `
1486
959
  <div class="flex justify-center mt-8">
1487
- <a href="${escapeHtml(
960
+ <a href="${escapeHtml2(
1488
961
  loginUrl
1489
962
  )}" class="px-6 py-3 bg-primary hover:bg-primary/90 text-white font-medium rounded-lg transition-colors">
1490
963
  Sign In Again
@@ -1527,12 +1000,12 @@ function oauthErrorPage(options) {
1527
1000
  }
1528
1001
  };
1529
1002
  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)}` : "";
1003
+ const clientMessage = clientName ? ` while connecting to ${escapeHtml2(clientName)}` : "";
1531
1004
  const redirectAction = redirectUri ? `
1532
- <a href="${escapeHtml(
1005
+ <a href="${escapeHtml2(
1533
1006
  redirectUri
1534
1007
  )}" 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"}
1008
+ Return to ${clientName ? escapeHtml2(clientName) : "Application"}
1536
1009
  </a>
1537
1010
  ` : "";
1538
1011
  return errorPage({