@frontmcp/uipack 0.12.2 → 1.0.0-beta.10

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 (298) hide show
  1. package/CLAUDE.md +56 -154
  2. package/README.md +367 -62
  3. package/adapters/base-template.d.ts +30 -0
  4. package/adapters/base-template.d.ts.map +1 -0
  5. package/adapters/cdn-info.d.ts +34 -0
  6. package/adapters/cdn-info.d.ts.map +1 -0
  7. package/adapters/constants.d.ts +18 -0
  8. package/adapters/constants.d.ts.map +1 -0
  9. package/adapters/content-detector.d.ts +19 -0
  10. package/adapters/content-detector.d.ts.map +1 -0
  11. package/adapters/content-renderers.d.ts +27 -0
  12. package/adapters/content-renderers.d.ts.map +1 -0
  13. package/adapters/index.d.ts +14 -7
  14. package/adapters/index.d.ts.map +1 -1
  15. package/adapters/index.js +2343 -426
  16. package/adapters/render-failure.d.ts +18 -0
  17. package/adapters/render-failure.d.ts.map +1 -0
  18. package/adapters/response-builder.d.ts +34 -104
  19. package/adapters/response-builder.d.ts.map +1 -1
  20. package/adapters/serving-mode.d.ts +28 -91
  21. package/adapters/serving-mode.d.ts.map +1 -1
  22. package/adapters/template-renderer.d.ts +50 -0
  23. package/adapters/template-renderer.d.ts.map +1 -0
  24. package/adapters/type-detector.d.ts +18 -0
  25. package/adapters/type-detector.d.ts.map +1 -0
  26. package/bridge-runtime/index.js +1 -1
  27. package/component/index.d.ts +14 -0
  28. package/component/index.d.ts.map +1 -0
  29. package/component/index.js +2043 -0
  30. package/component/loader.d.ts +36 -0
  31. package/component/loader.d.ts.map +1 -0
  32. package/component/renderer.d.ts +30 -0
  33. package/component/renderer.d.ts.map +1 -0
  34. package/component/transpiler.d.ts +49 -0
  35. package/component/transpiler.d.ts.map +1 -0
  36. package/component/types.d.ts +82 -0
  37. package/component/types.d.ts.map +1 -0
  38. package/esm/adapters/index.mjs +2337 -422
  39. package/esm/bridge-runtime/index.mjs +1 -1
  40. package/esm/component/index.mjs +2013 -0
  41. package/esm/index.mjs +3446 -13935
  42. package/esm/package.json +4 -13
  43. package/esm/resolver/index.mjs +661 -0
  44. package/esm/shell/index.mjs +1406 -0
  45. package/esm/types/index.mjs +11 -11
  46. package/esm/utils/index.mjs +53 -8
  47. package/index.d.ts +12 -40
  48. package/index.d.ts.map +1 -1
  49. package/index.js +3579 -14218
  50. package/package.json +4 -13
  51. package/resolver/cdn-registry.d.ts +39 -0
  52. package/resolver/cdn-registry.d.ts.map +1 -0
  53. package/resolver/esm-sh.resolver.d.ts +54 -0
  54. package/resolver/esm-sh.resolver.d.ts.map +1 -0
  55. package/resolver/import-map.d.ts +47 -0
  56. package/resolver/import-map.d.ts.map +1 -0
  57. package/resolver/import-parser.d.ts +28 -0
  58. package/resolver/import-parser.d.ts.map +1 -0
  59. package/resolver/import-rewriter.d.ts +29 -0
  60. package/resolver/import-rewriter.d.ts.map +1 -0
  61. package/resolver/index.d.ts +15 -0
  62. package/resolver/index.d.ts.map +1 -0
  63. package/resolver/index.js +708 -0
  64. package/resolver/types.d.ts +191 -0
  65. package/resolver/types.d.ts.map +1 -0
  66. package/shell/builder.d.ts +31 -0
  67. package/shell/builder.d.ts.map +1 -0
  68. package/shell/csp.d.ts +37 -0
  69. package/shell/csp.d.ts.map +1 -0
  70. package/shell/custom-shell-applier.d.ts +33 -0
  71. package/shell/custom-shell-applier.d.ts.map +1 -0
  72. package/shell/custom-shell-resolver.d.ts +47 -0
  73. package/shell/custom-shell-resolver.d.ts.map +1 -0
  74. package/shell/custom-shell-types.d.ts +75 -0
  75. package/shell/custom-shell-types.d.ts.map +1 -0
  76. package/shell/custom-shell-validator.d.ts +26 -0
  77. package/shell/custom-shell-validator.d.ts.map +1 -0
  78. package/shell/data-injector.d.ts +40 -0
  79. package/shell/data-injector.d.ts.map +1 -0
  80. package/shell/index.d.ts +19 -0
  81. package/shell/index.d.ts.map +1 -0
  82. package/shell/index.js +1453 -0
  83. package/shell/types.d.ts +54 -0
  84. package/shell/types.d.ts.map +1 -0
  85. package/types/index.d.ts +1 -3
  86. package/types/index.d.ts.map +1 -1
  87. package/types/index.js +11 -11
  88. package/types/ui-config.d.ts +50 -11
  89. package/types/ui-config.d.ts.map +1 -1
  90. package/types/ui-runtime.d.ts +8 -82
  91. package/types/ui-runtime.d.ts.map +1 -1
  92. package/utils/index.d.ts +9 -3
  93. package/utils/index.d.ts.map +1 -1
  94. package/utils/index.js +59 -7
  95. package/adapters/platform-meta.constants.d.ts +0 -26
  96. package/adapters/platform-meta.constants.d.ts.map +0 -1
  97. package/adapters/platform-meta.d.ts +0 -234
  98. package/adapters/platform-meta.d.ts.map +0 -1
  99. package/base-template/bridge.d.ts +0 -90
  100. package/base-template/bridge.d.ts.map +0 -1
  101. package/base-template/default-base-template.d.ts +0 -91
  102. package/base-template/default-base-template.d.ts.map +0 -1
  103. package/base-template/index.d.ts +0 -15
  104. package/base-template/index.d.ts.map +0 -1
  105. package/base-template/index.js +0 -1393
  106. package/base-template/polyfills.d.ts +0 -31
  107. package/base-template/polyfills.d.ts.map +0 -1
  108. package/base-template/theme-styles.d.ts +0 -74
  109. package/base-template/theme-styles.d.ts.map +0 -1
  110. package/build/builders/base-builder.d.ts +0 -124
  111. package/build/builders/base-builder.d.ts.map +0 -1
  112. package/build/builders/esbuild-config.d.ts +0 -94
  113. package/build/builders/esbuild-config.d.ts.map +0 -1
  114. package/build/builders/hybrid-builder.d.ts +0 -93
  115. package/build/builders/hybrid-builder.d.ts.map +0 -1
  116. package/build/builders/index.d.ts +0 -17
  117. package/build/builders/index.d.ts.map +0 -1
  118. package/build/builders/inline-builder.d.ts +0 -83
  119. package/build/builders/inline-builder.d.ts.map +0 -1
  120. package/build/builders/static-builder.d.ts +0 -78
  121. package/build/builders/static-builder.d.ts.map +0 -1
  122. package/build/builders/types.d.ts +0 -341
  123. package/build/builders/types.d.ts.map +0 -1
  124. package/build/cdn-resources.d.ts +0 -244
  125. package/build/cdn-resources.d.ts.map +0 -1
  126. package/build/hybrid-data.d.ts +0 -127
  127. package/build/hybrid-data.d.ts.map +0 -1
  128. package/build/index.d.ts +0 -299
  129. package/build/index.d.ts.map +0 -1
  130. package/build/index.js +0 -8699
  131. package/build/ui-components-browser.d.ts +0 -64
  132. package/build/ui-components-browser.d.ts.map +0 -1
  133. package/build/widget-manifest.d.ts +0 -362
  134. package/build/widget-manifest.d.ts.map +0 -1
  135. package/bundler/cache.d.ts +0 -173
  136. package/bundler/cache.d.ts.map +0 -1
  137. package/bundler/file-cache/component-builder.d.ts +0 -167
  138. package/bundler/file-cache/component-builder.d.ts.map +0 -1
  139. package/bundler/file-cache/hash-calculator.d.ts +0 -155
  140. package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
  141. package/bundler/file-cache/index.d.ts +0 -12
  142. package/bundler/file-cache/index.d.ts.map +0 -1
  143. package/bundler/file-cache/storage/filesystem.d.ts +0 -149
  144. package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
  145. package/bundler/file-cache/storage/index.d.ts +0 -11
  146. package/bundler/file-cache/storage/index.d.ts.map +0 -1
  147. package/bundler/file-cache/storage/interface.d.ts +0 -152
  148. package/bundler/file-cache/storage/interface.d.ts.map +0 -1
  149. package/bundler/file-cache/storage/redis.d.ts +0 -139
  150. package/bundler/file-cache/storage/redis.d.ts.map +0 -1
  151. package/bundler/index.d.ts +0 -35
  152. package/bundler/index.d.ts.map +0 -1
  153. package/bundler/index.js +0 -2953
  154. package/bundler/sandbox/enclave-adapter.d.ts +0 -121
  155. package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
  156. package/bundler/sandbox/executor.d.ts +0 -14
  157. package/bundler/sandbox/executor.d.ts.map +0 -1
  158. package/bundler/sandbox/policy.d.ts +0 -62
  159. package/bundler/sandbox/policy.d.ts.map +0 -1
  160. package/bundler/types.d.ts +0 -702
  161. package/bundler/types.d.ts.map +0 -1
  162. package/dependency/cdn-registry.d.ts +0 -98
  163. package/dependency/cdn-registry.d.ts.map +0 -1
  164. package/dependency/import-map.d.ts +0 -186
  165. package/dependency/import-map.d.ts.map +0 -1
  166. package/dependency/import-parser.d.ts +0 -82
  167. package/dependency/import-parser.d.ts.map +0 -1
  168. package/dependency/index.d.ts +0 -17
  169. package/dependency/index.d.ts.map +0 -1
  170. package/dependency/index.js +0 -3180
  171. package/dependency/resolver.d.ts +0 -164
  172. package/dependency/resolver.d.ts.map +0 -1
  173. package/dependency/schemas.d.ts +0 -486
  174. package/dependency/schemas.d.ts.map +0 -1
  175. package/dependency/template-loader.d.ts +0 -204
  176. package/dependency/template-loader.d.ts.map +0 -1
  177. package/dependency/template-processor.d.ts +0 -118
  178. package/dependency/template-processor.d.ts.map +0 -1
  179. package/dependency/types.d.ts +0 -739
  180. package/dependency/types.d.ts.map +0 -1
  181. package/esm/base-template/index.mjs +0 -1359
  182. package/esm/build/index.mjs +0 -8601
  183. package/esm/bundler/index.mjs +0 -2895
  184. package/esm/dependency/index.mjs +0 -3068
  185. package/esm/handlebars/index.mjs +0 -587
  186. package/esm/registry/index.mjs +0 -6305
  187. package/esm/renderers/index.mjs +0 -1557
  188. package/esm/runtime/index.mjs +0 -5361
  189. package/esm/styles/index.mjs +0 -171
  190. package/esm/theme/index.mjs +0 -756
  191. package/esm/tool-template/index.mjs +0 -3652
  192. package/esm/validation/index.mjs +0 -542
  193. package/handlebars/expression-extractor.d.ts +0 -147
  194. package/handlebars/expression-extractor.d.ts.map +0 -1
  195. package/handlebars/helpers.d.ts +0 -339
  196. package/handlebars/helpers.d.ts.map +0 -1
  197. package/handlebars/index.d.ts +0 -195
  198. package/handlebars/index.d.ts.map +0 -1
  199. package/handlebars/index.js +0 -659
  200. package/preview/claude-preview.d.ts +0 -67
  201. package/preview/claude-preview.d.ts.map +0 -1
  202. package/preview/generic-preview.d.ts +0 -66
  203. package/preview/generic-preview.d.ts.map +0 -1
  204. package/preview/index.d.ts +0 -36
  205. package/preview/index.d.ts.map +0 -1
  206. package/preview/openai-preview.d.ts +0 -70
  207. package/preview/openai-preview.d.ts.map +0 -1
  208. package/preview/types.d.ts +0 -199
  209. package/preview/types.d.ts.map +0 -1
  210. package/registry/index.d.ts +0 -46
  211. package/registry/index.d.ts.map +0 -1
  212. package/registry/index.js +0 -6342
  213. package/registry/render-template.d.ts +0 -91
  214. package/registry/render-template.d.ts.map +0 -1
  215. package/registry/tool-ui.registry.d.ts +0 -294
  216. package/registry/tool-ui.registry.d.ts.map +0 -1
  217. package/registry/uri-utils.d.ts +0 -56
  218. package/registry/uri-utils.d.ts.map +0 -1
  219. package/renderers/cache.d.ts +0 -145
  220. package/renderers/cache.d.ts.map +0 -1
  221. package/renderers/html.renderer.d.ts +0 -123
  222. package/renderers/html.renderer.d.ts.map +0 -1
  223. package/renderers/index.d.ts +0 -36
  224. package/renderers/index.d.ts.map +0 -1
  225. package/renderers/index.js +0 -1603
  226. package/renderers/mdx-client.renderer.d.ts +0 -124
  227. package/renderers/mdx-client.renderer.d.ts.map +0 -1
  228. package/renderers/registry.d.ts +0 -133
  229. package/renderers/registry.d.ts.map +0 -1
  230. package/renderers/types.d.ts +0 -343
  231. package/renderers/types.d.ts.map +0 -1
  232. package/renderers/utils/detect.d.ts +0 -107
  233. package/renderers/utils/detect.d.ts.map +0 -1
  234. package/renderers/utils/hash.d.ts +0 -40
  235. package/renderers/utils/hash.d.ts.map +0 -1
  236. package/renderers/utils/index.d.ts +0 -9
  237. package/renderers/utils/index.d.ts.map +0 -1
  238. package/renderers/utils/transpiler.d.ts +0 -70
  239. package/renderers/utils/transpiler.d.ts.map +0 -1
  240. package/runtime/adapters/html.adapter.d.ts +0 -59
  241. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  242. package/runtime/adapters/index.d.ts +0 -26
  243. package/runtime/adapters/index.d.ts.map +0 -1
  244. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  245. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  246. package/runtime/adapters/types.d.ts +0 -95
  247. package/runtime/adapters/types.d.ts.map +0 -1
  248. package/runtime/csp.d.ts +0 -48
  249. package/runtime/csp.d.ts.map +0 -1
  250. package/runtime/index.d.ts +0 -17
  251. package/runtime/index.d.ts.map +0 -1
  252. package/runtime/index.js +0 -5432
  253. package/runtime/mcp-bridge.d.ts +0 -101
  254. package/runtime/mcp-bridge.d.ts.map +0 -1
  255. package/runtime/renderer-runtime.d.ts +0 -133
  256. package/runtime/renderer-runtime.d.ts.map +0 -1
  257. package/runtime/sanitizer.d.ts +0 -180
  258. package/runtime/sanitizer.d.ts.map +0 -1
  259. package/runtime/types.d.ts +0 -415
  260. package/runtime/types.d.ts.map +0 -1
  261. package/runtime/wrapper.d.ts +0 -421
  262. package/runtime/wrapper.d.ts.map +0 -1
  263. package/styles/index.d.ts +0 -8
  264. package/styles/index.d.ts.map +0 -1
  265. package/styles/index.js +0 -222
  266. package/styles/variants.d.ts +0 -51
  267. package/styles/variants.d.ts.map +0 -1
  268. package/theme/cdn.d.ts +0 -195
  269. package/theme/cdn.d.ts.map +0 -1
  270. package/theme/css-to-theme.d.ts +0 -64
  271. package/theme/css-to-theme.d.ts.map +0 -1
  272. package/theme/index.d.ts +0 -19
  273. package/theme/index.d.ts.map +0 -1
  274. package/theme/index.js +0 -814
  275. package/theme/platforms.d.ts +0 -102
  276. package/theme/platforms.d.ts.map +0 -1
  277. package/theme/presets/github-openai.d.ts +0 -50
  278. package/theme/presets/github-openai.d.ts.map +0 -1
  279. package/theme/presets/index.d.ts +0 -11
  280. package/theme/presets/index.d.ts.map +0 -1
  281. package/theme/theme.d.ts +0 -396
  282. package/theme/theme.d.ts.map +0 -1
  283. package/tool-template/builder.d.ts +0 -213
  284. package/tool-template/builder.d.ts.map +0 -1
  285. package/tool-template/index.d.ts +0 -16
  286. package/tool-template/index.d.ts.map +0 -1
  287. package/tool-template/index.js +0 -3690
  288. package/validation/error-box.d.ts +0 -56
  289. package/validation/error-box.d.ts.map +0 -1
  290. package/validation/index.d.ts +0 -13
  291. package/validation/index.d.ts.map +0 -1
  292. package/validation/index.js +0 -576
  293. package/validation/schema-paths.d.ts +0 -118
  294. package/validation/schema-paths.d.ts.map +0 -1
  295. package/validation/template-validator.d.ts +0 -143
  296. package/validation/template-validator.d.ts.map +0 -1
  297. package/validation/wrapper.d.ts +0 -97
  298. package/validation/wrapper.d.ts.map +0 -1
package/theme/index.js DELETED
@@ -1,814 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // libs/uipack/src/theme/index.ts
21
- var theme_exports = {};
22
- __export(theme_exports, {
23
- CDN: () => CDN,
24
- CLAUDE_PLATFORM: () => CLAUDE_PLATFORM,
25
- CUSTOM_PLATFORM: () => CUSTOM_PLATFORM,
26
- DEFAULT_THEME: () => DEFAULT_THEME,
27
- GEMINI_PLATFORM: () => GEMINI_PLATFORM,
28
- GITHUB_OPENAI_THEME: () => GITHUB_OPENAI_THEME,
29
- OPENAI_PLATFORM: () => OPENAI_PLATFORM,
30
- PLATFORM_PRESETS: () => PLATFORM_PRESETS,
31
- buildCdnScripts: () => buildCdnScripts,
32
- buildCdnScriptsFromTheme: () => buildCdnScriptsFromTheme,
33
- buildFontPreconnect: () => buildFontPreconnect,
34
- buildFontPreconnectFromTheme: () => buildFontPreconnectFromTheme,
35
- buildFontStylesheets: () => buildFontStylesheets,
36
- buildFontStylesheetsFromTheme: () => buildFontStylesheetsFromTheme,
37
- buildStyleBlock: () => buildStyleBlock,
38
- buildTailwindStyleBlock: () => buildTailwindStyleBlock,
39
- buildThemeCss: () => buildThemeCss,
40
- canUseCdn: () => canUseCdn,
41
- clearScriptCache: () => clearScriptCache,
42
- createPlatform: () => createPlatform,
43
- createTheme: () => createTheme,
44
- cssToTailwindTheme: () => cssToTailwindTheme,
45
- fetchAndCacheScripts: () => fetchAndCacheScripts,
46
- fetchAndCacheScriptsFromTheme: () => fetchAndCacheScriptsFromTheme,
47
- fetchScript: () => fetchScript,
48
- getCachedScript: () => getCachedScript,
49
- getFallbackMode: () => getFallbackMode,
50
- getPlatform: () => getPlatform,
51
- isScriptCached: () => isScriptCached,
52
- mergeThemes: () => mergeThemes,
53
- needsInlineScripts: () => needsInlineScripts,
54
- supportsFullInteractivity: () => supportsFullInteractivity
55
- });
56
- module.exports = __toCommonJS(theme_exports);
57
-
58
- // libs/uipack/src/theme/cdn.ts
59
- var CDN = {
60
- /**
61
- * Tailwind CSS v4 Browser CDN
62
- * Generates styles on-the-fly with @theme support
63
- * @see https://tailwindcss.com/docs/installation/play-cdn
64
- */
65
- tailwind: "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",
66
- /**
67
- * HTMX 2.x - High power tools for HTML
68
- * Enables AJAX, WebSockets, Server Sent Events directly in HTML
69
- * @see https://htmx.org
70
- */
71
- htmx: {
72
- url: "https://cdnjs.cloudflare.com/ajax/libs/htmx/2.0.7/htmx.min.js",
73
- integrity: "sha512-T6VLg/MJYMbLTmQ8VLvonbWg8VOvmDhXcOvHzCwo6ShdGuUU5SEcp1IAPXL4k9lVoMi8gRXl5K/S/zh43Y9rJA=="
74
- },
75
- /**
76
- * Alpine.js - Lightweight reactive framework
77
- * Used for more complex client-side interactions
78
- * @see https://alpinejs.dev
79
- */
80
- alpine: {
81
- url: "https://cdn.jsdelivr.net/npm/alpinejs@3.14.3/dist/cdn.min.js",
82
- integrity: "sha384-6zY8MFQJ/EqS1r4RJl+7j8rvZPuBWpT0RzWf+IFcKhxqUzQNmJzA1X1VEVZhYaEz"
83
- },
84
- /**
85
- * Google Fonts - Inter for modern UI typography
86
- */
87
- fonts: {
88
- preconnect: ["https://fonts.googleapis.com", "https://fonts.gstatic.com"],
89
- inter: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap",
90
- mono: "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap"
91
- },
92
- /**
93
- * Lucide Icons - Beautiful & consistent icons
94
- * @see https://lucide.dev
95
- */
96
- icons: {
97
- url: "https://cdn.jsdelivr.net/npm/lucide@0.294.0/dist/umd/lucide.min.js",
98
- integrity: "sha384-wpLmHb7v7V1LsEuTmPQ9tXqWZvTtRWWVqJuE+Yz6X0I6O2T6bHJVeXH1lVWqF4qE"
99
- }
100
- };
101
- var scriptCache = /* @__PURE__ */ new Map();
102
- async function fetchScript(url) {
103
- const cached = scriptCache.get(url);
104
- if (cached) {
105
- return cached;
106
- }
107
- const response = await fetch(url);
108
- if (!response.ok) {
109
- throw new Error(`Failed to fetch script: ${url} (${response.status})`);
110
- }
111
- const content = await response.text();
112
- scriptCache.set(url, content);
113
- return content;
114
- }
115
- async function fetchAndCacheScripts(options = {}) {
116
- const { tailwind = true, htmx = true, alpine = false, icons = false } = options;
117
- const urls = [];
118
- if (tailwind) urls.push(CDN.tailwind);
119
- if (htmx) urls.push(CDN.htmx.url);
120
- if (alpine) urls.push(CDN.alpine.url);
121
- if (icons) urls.push(CDN.icons.url);
122
- await Promise.all(urls.map(fetchScript));
123
- return scriptCache;
124
- }
125
- function getCachedScript(url) {
126
- return scriptCache.get(url);
127
- }
128
- function isScriptCached(url) {
129
- return scriptCache.has(url);
130
- }
131
- function clearScriptCache() {
132
- scriptCache.clear();
133
- }
134
- function buildFontPreconnect() {
135
- return CDN.fonts.preconnect.map((url, i) => `<link rel="preconnect" href="${url}"${i > 0 ? " crossorigin" : ""}>`).join("\n ");
136
- }
137
- function buildFontStylesheets(options = {}) {
138
- const { inter = true, mono = false } = options;
139
- const links = [];
140
- if (inter) {
141
- links.push(`<link href="${CDN.fonts.inter}" rel="stylesheet">`);
142
- }
143
- if (mono) {
144
- links.push(`<link href="${CDN.fonts.mono}" rel="stylesheet">`);
145
- }
146
- return links.join("\n ");
147
- }
148
- function buildScriptTag(url, integrity, options = {}) {
149
- const attrs = [`src="${url}"`];
150
- if (integrity) {
151
- attrs.push(`integrity="${integrity}"`);
152
- attrs.push('crossorigin="anonymous"');
153
- }
154
- if (options.defer) attrs.push("defer");
155
- if (options.async) attrs.push("async");
156
- return `<script ${attrs.join(" ")}></script>`;
157
- }
158
- function buildInlineScriptTag(content) {
159
- return `<script>${content}</script>`;
160
- }
161
- function buildCdnScripts(options = {}) {
162
- const { tailwind = true, htmx = true, alpine = false, icons = false, inline = false } = options;
163
- const scripts = [];
164
- if (inline) {
165
- if (tailwind) {
166
- const cached = getCachedScript(CDN.tailwind);
167
- if (cached) {
168
- scripts.push(buildInlineScriptTag(cached));
169
- } else {
170
- console.warn(
171
- "[frontmcp/ui] Inline mode requested but Tailwind script not cached. Call fetchAndCacheScripts() first."
172
- );
173
- }
174
- }
175
- if (htmx) {
176
- const cached = getCachedScript(CDN.htmx.url);
177
- if (cached) {
178
- scripts.push(buildInlineScriptTag(cached));
179
- } else {
180
- console.warn(
181
- "[frontmcp/ui] Inline mode requested but HTMX script not cached. Call fetchAndCacheScripts() first."
182
- );
183
- }
184
- }
185
- if (alpine) {
186
- const cached = getCachedScript(CDN.alpine.url);
187
- if (cached) {
188
- scripts.push(buildInlineScriptTag(cached));
189
- } else {
190
- console.warn(
191
- "[frontmcp/ui] Inline mode requested but Alpine.js script not cached. Call fetchAndCacheScripts() first."
192
- );
193
- }
194
- }
195
- if (icons) {
196
- const cached = getCachedScript(CDN.icons.url);
197
- if (cached) {
198
- scripts.push(buildInlineScriptTag(cached));
199
- } else {
200
- console.warn(
201
- "[frontmcp/ui] Inline mode requested but Lucide icons script not cached. Call fetchAndCacheScripts() first."
202
- );
203
- }
204
- }
205
- } else {
206
- if (tailwind) {
207
- scripts.push(buildScriptTag(CDN.tailwind));
208
- }
209
- if (htmx) {
210
- scripts.push(buildScriptTag(CDN.htmx.url, CDN.htmx.integrity));
211
- }
212
- if (alpine) {
213
- scripts.push(buildScriptTag(CDN.alpine.url, CDN.alpine.integrity, { defer: true }));
214
- }
215
- if (icons) {
216
- scripts.push(buildScriptTag(CDN.icons.url, CDN.icons.integrity));
217
- }
218
- }
219
- return scripts.join("\n ");
220
- }
221
- function buildFontPreconnectFromTheme(theme) {
222
- const preconnect = theme.cdn?.fonts?.preconnect ?? CDN.fonts.preconnect;
223
- return preconnect.map((url, i) => `<link rel="preconnect" href="${url}"${i > 0 ? " crossorigin" : ""}>`).join("\n ");
224
- }
225
- function buildFontStylesheetsFromTheme(theme) {
226
- const stylesheets = theme.cdn?.fonts?.stylesheets ?? [CDN.fonts.inter];
227
- return stylesheets.map((url) => `<link href="${url}" rel="stylesheet">`).join("\n ");
228
- }
229
- function buildCdnScriptsFromTheme(theme, options = {}) {
230
- const { tailwind = true, htmx = true, alpine = false, icons = false, inline = false } = options;
231
- const scripts = [];
232
- const tailwindUrl = theme.cdn?.scripts?.tailwind ?? CDN.tailwind;
233
- const htmxConfig = theme.cdn?.scripts?.htmx ?? CDN.htmx;
234
- const alpineConfig = theme.cdn?.scripts?.alpine ?? CDN.alpine;
235
- const iconsConfig = theme.cdn?.icons?.script ?? CDN.icons;
236
- if (inline) {
237
- if (tailwind) {
238
- const cached = getCachedScript(tailwindUrl);
239
- if (cached) {
240
- scripts.push(buildInlineScriptTag(cached));
241
- } else {
242
- console.warn(
243
- "[frontmcp/ui] Inline mode requested but Tailwind script not cached. Call fetchAndCacheScriptsFromTheme() first."
244
- );
245
- }
246
- }
247
- if (htmx) {
248
- const cached = getCachedScript(htmxConfig.url);
249
- if (cached) {
250
- scripts.push(buildInlineScriptTag(cached));
251
- } else {
252
- console.warn(
253
- "[frontmcp/ui] Inline mode requested but HTMX script not cached. Call fetchAndCacheScriptsFromTheme() first."
254
- );
255
- }
256
- }
257
- if (alpine) {
258
- const cached = getCachedScript(alpineConfig.url);
259
- if (cached) {
260
- scripts.push(buildInlineScriptTag(cached));
261
- } else {
262
- console.warn(
263
- "[frontmcp/ui] Inline mode requested but Alpine.js script not cached. Call fetchAndCacheScriptsFromTheme() first."
264
- );
265
- }
266
- }
267
- if (icons) {
268
- const cached = getCachedScript(iconsConfig.url);
269
- if (cached) {
270
- scripts.push(buildInlineScriptTag(cached));
271
- } else {
272
- console.warn(
273
- "[frontmcp/ui] Inline mode requested but icons script not cached. Call fetchAndCacheScriptsFromTheme() first."
274
- );
275
- }
276
- }
277
- } else {
278
- if (tailwind) {
279
- scripts.push(buildScriptTag(tailwindUrl));
280
- }
281
- if (htmx) {
282
- scripts.push(buildScriptTag(htmxConfig.url, htmxConfig.integrity));
283
- }
284
- if (alpine) {
285
- scripts.push(buildScriptTag(alpineConfig.url, alpineConfig.integrity, { defer: true }));
286
- }
287
- if (icons) {
288
- scripts.push(buildScriptTag(iconsConfig.url, iconsConfig.integrity));
289
- }
290
- }
291
- return scripts.join("\n ");
292
- }
293
- async function fetchAndCacheScriptsFromTheme(theme, options = {}) {
294
- const { tailwind = true, htmx = true, alpine = false, icons = false } = options;
295
- const urls = [];
296
- const tailwindUrl = theme.cdn?.scripts?.tailwind ?? CDN.tailwind;
297
- const htmxConfig = theme.cdn?.scripts?.htmx ?? CDN.htmx;
298
- const alpineConfig = theme.cdn?.scripts?.alpine ?? CDN.alpine;
299
- const iconsConfig = theme.cdn?.icons?.script ?? CDN.icons;
300
- if (tailwind) urls.push(tailwindUrl);
301
- if (htmx) urls.push(htmxConfig.url);
302
- if (alpine) urls.push(alpineConfig.url);
303
- if (icons) urls.push(iconsConfig.url);
304
- await Promise.all(urls.map(fetchScript));
305
- return scriptCache;
306
- }
307
-
308
- // libs/uipack/src/theme/platforms.ts
309
- var OPENAI_PLATFORM = {
310
- id: "openai",
311
- name: "OpenAI",
312
- supportsWidgets: true,
313
- supportsTailwind: true,
314
- supportsHtmx: true,
315
- networkMode: "full",
316
- scriptStrategy: "cdn",
317
- options: {
318
- sdk: "apps-sdk",
319
- version: "1.0"
320
- }
321
- };
322
- var CLAUDE_PLATFORM = {
323
- id: "claude",
324
- name: "Claude (Artifacts)",
325
- supportsWidgets: true,
326
- // Claude Artifacts support interactive widgets
327
- supportsTailwind: true,
328
- supportsHtmx: false,
329
- // Network blocked, HTMX won't work for API calls
330
- networkMode: "limited",
331
- scriptStrategy: "cdn",
332
- maxInlineSize: 100 * 1024,
333
- // 100KB limit for artifacts
334
- cspRestrictions: ["script-src 'unsafe-inline'", "connect-src 'none'"],
335
- options: {
336
- mode: "artifacts",
337
- framework: "react"
338
- // Claude artifacts prefer React
339
- }
340
- };
341
- var GEMINI_PLATFORM = {
342
- id: "gemini",
343
- name: "Gemini",
344
- supportsWidgets: false,
345
- supportsTailwind: true,
346
- supportsHtmx: false,
347
- networkMode: "limited",
348
- scriptStrategy: "inline",
349
- options: {
350
- fallback: "markdown"
351
- // Fall back to markdown rendering
352
- }
353
- };
354
- var CUSTOM_PLATFORM = {
355
- id: "custom",
356
- name: "Custom MCP Client",
357
- supportsWidgets: true,
358
- supportsTailwind: true,
359
- supportsHtmx: true,
360
- networkMode: "full",
361
- scriptStrategy: "cdn"
362
- };
363
- var PLATFORM_PRESETS = {
364
- openai: OPENAI_PLATFORM,
365
- claude: CLAUDE_PLATFORM,
366
- gemini: GEMINI_PLATFORM,
367
- custom: CUSTOM_PLATFORM
368
- };
369
- function getPlatform(id) {
370
- return PLATFORM_PRESETS[id] ?? CUSTOM_PLATFORM;
371
- }
372
- function createPlatform(base) {
373
- const preset = PLATFORM_PRESETS[base.id] ?? CUSTOM_PLATFORM;
374
- return { ...preset, ...base };
375
- }
376
- function canUseCdn(platform) {
377
- return platform.networkMode === "full" && platform.scriptStrategy === "cdn";
378
- }
379
- function needsInlineScripts(platform) {
380
- return platform.scriptStrategy === "inline" || platform.networkMode === "blocked";
381
- }
382
- function supportsFullInteractivity(platform) {
383
- return platform.supportsWidgets && platform.supportsHtmx && platform.networkMode === "full";
384
- }
385
- function getFallbackMode(platform) {
386
- if (platform.supportsWidgets && platform.supportsTailwind) {
387
- return "html";
388
- }
389
- if (platform.options?.["fallback"] === "markdown") {
390
- return "markdown";
391
- }
392
- return "text";
393
- }
394
-
395
- // libs/uipack/src/theme/presets/github-openai.ts
396
- var GITHUB_OPENAI_THEME = {
397
- name: "github-openai",
398
- colors: {
399
- semantic: {
400
- // Primary: Near-black for main actions and branding
401
- primary: "#24292f",
402
- // Secondary: Medium gray for secondary elements
403
- secondary: "#57606a",
404
- // Accent: Blue for links, focus states, and highlights
405
- accent: "#0969da",
406
- // Status colors
407
- success: "#1a7f37",
408
- // GitHub green
409
- warning: "#9a6700",
410
- // Amber warning
411
- danger: "#cf222e",
412
- // GitHub red
413
- info: "#0969da"
414
- // Blue info
415
- },
416
- surface: {
417
- // Pure white background
418
- background: "#ffffff",
419
- // Light gray surface (GitHub code background style)
420
- surface: "#f6f8fa",
421
- // White elevated surfaces (modals, cards)
422
- elevated: "#ffffff",
423
- // Dark semi-transparent overlay
424
- overlay: "rgba(27, 31, 36, 0.5)"
425
- },
426
- text: {
427
- // Near-black for primary text
428
- primary: "#24292f",
429
- // Gray for secondary/muted text
430
- secondary: "#57606a",
431
- // Light gray for disabled text
432
- disabled: "#8c959f",
433
- // White for text on dark backgrounds
434
- inverse: "#ffffff",
435
- // Blue for links
436
- link: "#0969da"
437
- },
438
- border: {
439
- // Light gray border (GitHub style)
440
- default: "#d0d7de",
441
- // Medium gray on hover
442
- hover: "#8c959f",
443
- // Blue focus ring
444
- focus: "#0969da",
445
- // Subtle divider
446
- divider: "#d8dee4"
447
- }
448
- },
449
- typography: {
450
- families: {
451
- // System UI font stack (GitHub/Apple style)
452
- sans: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
453
- // Monospace stack
454
- mono: 'ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace'
455
- },
456
- sizes: {
457
- xs: "0.75rem",
458
- // 12px
459
- sm: "0.875rem",
460
- // 14px
461
- base: "1rem",
462
- // 16px
463
- lg: "1.125rem",
464
- // 18px
465
- xl: "1.25rem",
466
- // 20px
467
- "2xl": "1.5rem",
468
- // 24px
469
- "3xl": "1.875rem",
470
- // 30px
471
- "4xl": "2.25rem"
472
- // 36px
473
- },
474
- weights: {
475
- normal: "400",
476
- medium: "500",
477
- semibold: "600",
478
- bold: "700"
479
- }
480
- },
481
- radius: {
482
- none: "0",
483
- sm: "3px",
484
- // GitHub uses smaller radii
485
- md: "6px",
486
- lg: "8px",
487
- xl: "12px",
488
- "2xl": "16px",
489
- full: "9999px"
490
- },
491
- shadows: {
492
- // Subtle shadows with gray tones
493
- sm: "0 1px 0 rgba(27, 31, 36, 0.04)",
494
- md: "0 3px 6px rgba(140, 149, 159, 0.15)",
495
- lg: "0 8px 24px rgba(140, 149, 159, 0.2)",
496
- xl: "0 12px 28px rgba(140, 149, 159, 0.3)"
497
- },
498
- components: {
499
- button: {
500
- radius: "6px",
501
- paddingX: "16px",
502
- paddingY: "5px",
503
- fontSize: "14px",
504
- fontWeight: "500"
505
- },
506
- card: {
507
- radius: "6px",
508
- padding: "16px",
509
- shadow: "0 1px 0 rgba(27, 31, 36, 0.04)",
510
- borderWidth: "1px"
511
- },
512
- input: {
513
- radius: "6px",
514
- paddingX: "12px",
515
- paddingY: "5px",
516
- borderWidth: "1px",
517
- focusRingWidth: "3px"
518
- }
519
- },
520
- cdn: {
521
- fonts: {
522
- preconnect: ["https://fonts.googleapis.com", "https://fonts.gstatic.com"],
523
- stylesheets: [
524
- // System UI fonts don't need external stylesheets, but we include
525
- // Inter as an optional enhancement for consistent cross-platform rendering
526
- "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
527
- ]
528
- },
529
- icons: {
530
- script: {
531
- url: "https://cdn.jsdelivr.net/npm/lucide@0.294.0/dist/umd/lucide.min.js"
532
- }
533
- },
534
- scripts: {
535
- tailwind: "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",
536
- htmx: {
537
- url: "https://cdnjs.cloudflare.com/ajax/libs/htmx/2.0.7/htmx.min.js",
538
- integrity: "sha512-T6VLg/MJYMbLTmQ8VLvonbWg8VOvmDhXcOvHzCwo6ShdGuUU5SEcp1IAPXL4k9lVoMi8gRXl5K/S/zh43Y9rJA=="
539
- },
540
- alpine: {
541
- url: "https://cdn.jsdelivr.net/npm/alpinejs@3.14.3/dist/cdn.min.js",
542
- integrity: "sha384-6zY8MFQJ/EqS1r4RJl+7j8rvZPuBWpT0RzWf+IFcKhxqUzQNmJzA1X1VEVZhYaEz"
543
- }
544
- }
545
- }
546
- };
547
- var DEFAULT_THEME = GITHUB_OPENAI_THEME;
548
-
549
- // libs/uipack/src/theme/theme.ts
550
- var DEFAULT_THEME2 = DEFAULT_THEME;
551
- function mergeThemesCore(base, override) {
552
- const baseColors = base.colors ?? { semantic: { primary: "#24292f" } };
553
- const filterStrings = (arr) => arr.filter((s) => s !== void 0);
554
- return {
555
- ...base,
556
- ...override,
557
- colors: {
558
- ...baseColors,
559
- ...override.colors,
560
- semantic: { ...baseColors.semantic, ...override.colors?.semantic },
561
- surface: { ...baseColors.surface, ...override.colors?.surface },
562
- text: { ...baseColors.text, ...override.colors?.text },
563
- border: { ...baseColors.border, ...override.colors?.border },
564
- custom: { ...baseColors.custom, ...override.colors?.custom }
565
- },
566
- typography: {
567
- ...base.typography,
568
- ...override.typography,
569
- families: { ...base.typography?.families, ...override.typography?.families },
570
- sizes: { ...base.typography?.sizes, ...override.typography?.sizes },
571
- weights: { ...base.typography?.weights, ...override.typography?.weights },
572
- lineHeight: { ...base.typography?.lineHeight, ...override.typography?.lineHeight }
573
- },
574
- spacing: { ...base.spacing, ...override.spacing },
575
- radius: { ...base.radius, ...override.radius },
576
- shadows: { ...base.shadows, ...override.shadows },
577
- components: {
578
- ...base.components,
579
- ...override.components,
580
- button: { ...base.components?.button, ...override.components?.button },
581
- card: { ...base.components?.card, ...override.components?.card },
582
- input: { ...base.components?.input, ...override.components?.input }
583
- },
584
- cdn: {
585
- ...base.cdn,
586
- ...override.cdn,
587
- fonts: {
588
- // Concatenate then dedupe so base entries are preserved without duplicates
589
- preconnect: filterStrings(
590
- Array.from(/* @__PURE__ */ new Set([...base.cdn?.fonts?.preconnect ?? [], ...override.cdn?.fonts?.preconnect ?? []]))
591
- ),
592
- stylesheets: filterStrings(
593
- Array.from(/* @__PURE__ */ new Set([...base.cdn?.fonts?.stylesheets ?? [], ...override.cdn?.fonts?.stylesheets ?? []]))
594
- )
595
- },
596
- icons: {
597
- ...base.cdn?.icons,
598
- ...override.cdn?.icons,
599
- // Deep merge script to preserve integrity when only url is overridden
600
- script: override.cdn?.icons?.script ? { ...base.cdn?.icons?.script, ...override.cdn?.icons?.script } : base.cdn?.icons?.script
601
- },
602
- scripts: {
603
- // tailwind is a simple string, just use override or base
604
- tailwind: override.cdn?.scripts?.tailwind ?? base.cdn?.scripts?.tailwind,
605
- // Deep merge htmx/alpine to preserve integrity when only url is overridden
606
- htmx: override.cdn?.scripts?.htmx ? { ...base.cdn?.scripts?.htmx, ...override.cdn?.scripts?.htmx } : base.cdn?.scripts?.htmx,
607
- alpine: override.cdn?.scripts?.alpine ? { ...base.cdn?.scripts?.alpine, ...override.cdn?.scripts?.alpine } : base.cdn?.scripts?.alpine
608
- }
609
- },
610
- customVars: { ...base.customVars, ...override.customVars },
611
- customCss: [base.customCss, override.customCss].filter(Boolean).join("\n")
612
- };
613
- }
614
- function mergeThemes(base, override) {
615
- const merged = mergeThemesCore(base, override);
616
- let darkVariant;
617
- if (override.dark !== void 0) {
618
- const darkBase = base.dark ?? base;
619
- const { dark: _nestedDark, ...overrideDarkWithoutNested } = override.dark;
620
- darkVariant = mergeThemesCore(darkBase, overrideDarkWithoutNested);
621
- } else if (base.dark !== void 0) {
622
- const { dark: _nestedDark, ...baseDarkWithoutNested } = base.dark;
623
- darkVariant = baseDarkWithoutNested;
624
- }
625
- return {
626
- ...merged,
627
- dark: darkVariant
628
- };
629
- }
630
- function createTheme(overrides) {
631
- return mergeThemes(DEFAULT_THEME2, overrides);
632
- }
633
- function emitColorScale(lines, name, scale) {
634
- for (const [shade, value] of Object.entries(scale)) {
635
- if (value) lines.push(`--color-${name}-${shade}: ${value};`);
636
- }
637
- }
638
- var OPACITY_VARIANTS = [10, 20, 30, 50, 70, 90];
639
- function emitColorWithOpacityVariants(lines, name, value) {
640
- lines.push(`--color-${name}: ${value};`);
641
- for (const opacity of OPACITY_VARIANTS) {
642
- lines.push(`--color-${name}-${opacity}: color-mix(in oklch, ${value} ${opacity}%, transparent);`);
643
- }
644
- }
645
- function emitBrandColorWithVariants(lines, name, value) {
646
- lines.push(`--color-${name}: ${value};`);
647
- lines.push(`--color-${name}-hover: color-mix(in oklch, ${value} 85%, black);`);
648
- for (const opacity of OPACITY_VARIANTS) {
649
- lines.push(`--color-${name}-${opacity}: color-mix(in oklch, ${value} ${opacity}%, transparent);`);
650
- }
651
- }
652
- function buildThemeCss(theme) {
653
- const lines = [];
654
- const semantic = theme.colors.semantic;
655
- if (typeof semantic.primary === "string") {
656
- emitBrandColorWithVariants(lines, "primary", semantic.primary);
657
- } else if (semantic.primary) {
658
- emitColorScale(lines, "primary", semantic.primary);
659
- }
660
- if (semantic.secondary) {
661
- if (typeof semantic.secondary === "string") {
662
- emitBrandColorWithVariants(lines, "secondary", semantic.secondary);
663
- } else {
664
- emitColorScale(lines, "secondary", semantic.secondary);
665
- }
666
- }
667
- if (semantic.accent) {
668
- if (typeof semantic.accent === "string") {
669
- lines.push(`--color-accent: ${semantic.accent};`);
670
- } else {
671
- emitColorScale(lines, "accent", semantic.accent);
672
- }
673
- }
674
- if (semantic.neutral) {
675
- if (typeof semantic.neutral === "string") {
676
- lines.push(`--color-neutral: ${semantic.neutral};`);
677
- } else {
678
- emitColorScale(lines, "neutral", semantic.neutral);
679
- }
680
- }
681
- if (semantic.success) emitColorWithOpacityVariants(lines, "success", semantic.success);
682
- if (semantic.warning) emitColorWithOpacityVariants(lines, "warning", semantic.warning);
683
- if (semantic.danger) emitColorWithOpacityVariants(lines, "danger", semantic.danger);
684
- if (semantic.info) emitColorWithOpacityVariants(lines, "info", semantic.info);
685
- const surface = theme.colors.surface;
686
- if (surface?.background) lines.push(`--color-background: ${surface.background};`);
687
- if (surface?.surface) lines.push(`--color-surface: ${surface.surface};`);
688
- if (surface?.elevated) lines.push(`--color-elevated: ${surface.elevated};`);
689
- if (surface?.overlay) lines.push(`--color-overlay: ${surface.overlay};`);
690
- const text = theme.colors.text;
691
- if (text?.primary) lines.push(`--color-text-primary: ${text.primary};`);
692
- if (text?.secondary) lines.push(`--color-text-secondary: ${text.secondary};`);
693
- if (text?.disabled) lines.push(`--color-text-disabled: ${text.disabled};`);
694
- if (text?.inverse) lines.push(`--color-text-inverse: ${text.inverse};`);
695
- if (text?.link) lines.push(`--color-text-link: ${text.link};`);
696
- const border = theme.colors.border;
697
- if (border?.default) lines.push(`--color-border: ${border.default};`);
698
- if (border?.hover) lines.push(`--color-border-hover: ${border.hover};`);
699
- if (border?.focus) lines.push(`--color-border-focus: ${border.focus};`);
700
- if (border?.divider) lines.push(`--color-divider: ${border.divider};`);
701
- if (theme.colors.custom) {
702
- for (const [key, value] of Object.entries(theme.colors.custom)) {
703
- lines.push(`--color-${key}: ${value};`);
704
- }
705
- }
706
- const typography = theme.typography;
707
- if (typography?.families?.sans) lines.push(`--font-sans: ${typography.families.sans};`);
708
- if (typography?.families?.serif) lines.push(`--font-serif: ${typography.families.serif};`);
709
- if (typography?.families?.mono) lines.push(`--font-mono: ${typography.families.mono};`);
710
- if (typography?.families?.display) lines.push(`--font-display: ${typography.families.display};`);
711
- const radius = theme.radius;
712
- if (radius?.none) lines.push(`--radius-none: ${radius.none};`);
713
- if (radius?.sm) lines.push(`--radius-sm: ${radius.sm};`);
714
- if (radius?.md) lines.push(`--radius-md: ${radius.md};`);
715
- if (radius?.lg) lines.push(`--radius-lg: ${radius.lg};`);
716
- if (radius?.xl) lines.push(`--radius-xl: ${radius.xl};`);
717
- if (radius?.["2xl"]) lines.push(`--radius-2xl: ${radius["2xl"]};`);
718
- if (radius?.full) lines.push(`--radius-full: ${radius.full};`);
719
- if (theme.customVars) {
720
- for (const [key, value] of Object.entries(theme.customVars)) {
721
- lines.push(`${key}: ${value};`);
722
- }
723
- }
724
- return lines.join("\n ");
725
- }
726
- function buildStyleBlock(theme) {
727
- const themeCss = buildThemeCss(theme);
728
- const customCss = theme.customCss || "";
729
- return `<style type="text/tailwindcss">
730
- @theme {
731
- ${themeCss}
732
- }
733
- ${customCss}
734
- </style>`;
735
- }
736
-
737
- // libs/uipack/src/theme/css-to-theme.ts
738
- var COLOR_VAR_REGEX = /--(color-[\w-]+):\s*([^;]+);/g;
739
- var MAX_CSS_INPUT_LENGTH = 1e5;
740
- function cssToTailwindTheme(userCss) {
741
- if (userCss.length > MAX_CSS_INPUT_LENGTH) {
742
- return {
743
- themeBlock: "",
744
- remainingCss: userCss,
745
- colorVars: /* @__PURE__ */ new Map()
746
- };
747
- }
748
- const colorVars = /* @__PURE__ */ new Map();
749
- const regex = new RegExp(COLOR_VAR_REGEX.source, "g");
750
- let match;
751
- while ((match = regex.exec(userCss)) !== null) {
752
- const varName = match[1];
753
- const value = match[2].trim();
754
- colorVars.set(varName, value);
755
- }
756
- const remainingCss = userCss.replace(COLOR_VAR_REGEX, "");
757
- let themeBlock = "";
758
- if (colorVars.size > 0) {
759
- const lines = Array.from(colorVars.entries()).map(([name, value]) => `--${name}: ${value};`);
760
- themeBlock = `@theme {
761
- ${lines.join("\n ")}
762
- }`;
763
- }
764
- return {
765
- themeBlock,
766
- remainingCss,
767
- colorVars
768
- };
769
- }
770
- function buildTailwindStyleBlock(userCss) {
771
- const { themeBlock, remainingCss } = cssToTailwindTheme(userCss);
772
- const parts = [themeBlock, remainingCss.trim()].filter(Boolean);
773
- if (parts.length === 0) {
774
- return "";
775
- }
776
- return `<style type="text/tailwindcss">
777
- ${parts.join("\n\n")}
778
- </style>`;
779
- }
780
- // Annotate the CommonJS export names for ESM import in node:
781
- 0 && (module.exports = {
782
- CDN,
783
- CLAUDE_PLATFORM,
784
- CUSTOM_PLATFORM,
785
- DEFAULT_THEME,
786
- GEMINI_PLATFORM,
787
- GITHUB_OPENAI_THEME,
788
- OPENAI_PLATFORM,
789
- PLATFORM_PRESETS,
790
- buildCdnScripts,
791
- buildCdnScriptsFromTheme,
792
- buildFontPreconnect,
793
- buildFontPreconnectFromTheme,
794
- buildFontStylesheets,
795
- buildFontStylesheetsFromTheme,
796
- buildStyleBlock,
797
- buildTailwindStyleBlock,
798
- buildThemeCss,
799
- canUseCdn,
800
- clearScriptCache,
801
- createPlatform,
802
- createTheme,
803
- cssToTailwindTheme,
804
- fetchAndCacheScripts,
805
- fetchAndCacheScriptsFromTheme,
806
- fetchScript,
807
- getCachedScript,
808
- getFallbackMode,
809
- getPlatform,
810
- isScriptCached,
811
- mergeThemes,
812
- needsInlineScripts,
813
- supportsFullInteractivity
814
- });