@frontmcp/uipack 0.12.2 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +56 -154
- package/README.md +367 -62
- package/adapters/base-template.d.ts +30 -0
- package/adapters/base-template.d.ts.map +1 -0
- package/adapters/cdn-info.d.ts +34 -0
- package/adapters/cdn-info.d.ts.map +1 -0
- package/adapters/constants.d.ts +18 -0
- package/adapters/constants.d.ts.map +1 -0
- package/adapters/content-detector.d.ts +19 -0
- package/adapters/content-detector.d.ts.map +1 -0
- package/adapters/content-renderers.d.ts +27 -0
- package/adapters/content-renderers.d.ts.map +1 -0
- package/adapters/index.d.ts +14 -7
- package/adapters/index.d.ts.map +1 -1
- package/adapters/index.js +2343 -426
- package/adapters/render-failure.d.ts +18 -0
- package/adapters/render-failure.d.ts.map +1 -0
- package/adapters/response-builder.d.ts +34 -104
- package/adapters/response-builder.d.ts.map +1 -1
- package/adapters/serving-mode.d.ts +28 -91
- package/adapters/serving-mode.d.ts.map +1 -1
- package/adapters/template-renderer.d.ts +50 -0
- package/adapters/template-renderer.d.ts.map +1 -0
- package/adapters/type-detector.d.ts +18 -0
- package/adapters/type-detector.d.ts.map +1 -0
- package/bridge-runtime/index.js +1 -1
- package/component/index.d.ts +14 -0
- package/component/index.d.ts.map +1 -0
- package/component/index.js +2043 -0
- package/component/loader.d.ts +36 -0
- package/component/loader.d.ts.map +1 -0
- package/component/renderer.d.ts +30 -0
- package/component/renderer.d.ts.map +1 -0
- package/component/transpiler.d.ts +49 -0
- package/component/transpiler.d.ts.map +1 -0
- package/component/types.d.ts +82 -0
- package/component/types.d.ts.map +1 -0
- package/esm/adapters/index.mjs +2337 -422
- package/esm/bridge-runtime/index.mjs +1 -1
- package/esm/component/index.mjs +2013 -0
- package/esm/index.mjs +3446 -13935
- package/esm/package.json +3 -12
- package/esm/resolver/index.mjs +661 -0
- package/esm/shell/index.mjs +1406 -0
- package/esm/types/index.mjs +11 -11
- package/esm/utils/index.mjs +53 -8
- package/index.d.ts +12 -40
- package/index.d.ts.map +1 -1
- package/index.js +3579 -14218
- package/package.json +3 -12
- package/resolver/cdn-registry.d.ts +39 -0
- package/resolver/cdn-registry.d.ts.map +1 -0
- package/resolver/esm-sh.resolver.d.ts +54 -0
- package/resolver/esm-sh.resolver.d.ts.map +1 -0
- package/resolver/import-map.d.ts +47 -0
- package/resolver/import-map.d.ts.map +1 -0
- package/resolver/import-parser.d.ts +28 -0
- package/resolver/import-parser.d.ts.map +1 -0
- package/resolver/import-rewriter.d.ts +29 -0
- package/resolver/import-rewriter.d.ts.map +1 -0
- package/resolver/index.d.ts +15 -0
- package/resolver/index.d.ts.map +1 -0
- package/resolver/index.js +708 -0
- package/resolver/types.d.ts +191 -0
- package/resolver/types.d.ts.map +1 -0
- package/shell/builder.d.ts +31 -0
- package/shell/builder.d.ts.map +1 -0
- package/shell/csp.d.ts +37 -0
- package/shell/csp.d.ts.map +1 -0
- package/shell/custom-shell-applier.d.ts +33 -0
- package/shell/custom-shell-applier.d.ts.map +1 -0
- package/shell/custom-shell-resolver.d.ts +47 -0
- package/shell/custom-shell-resolver.d.ts.map +1 -0
- package/shell/custom-shell-types.d.ts +75 -0
- package/shell/custom-shell-types.d.ts.map +1 -0
- package/shell/custom-shell-validator.d.ts +26 -0
- package/shell/custom-shell-validator.d.ts.map +1 -0
- package/shell/data-injector.d.ts +40 -0
- package/shell/data-injector.d.ts.map +1 -0
- package/shell/index.d.ts +19 -0
- package/shell/index.d.ts.map +1 -0
- package/shell/index.js +1453 -0
- package/shell/types.d.ts +54 -0
- package/shell/types.d.ts.map +1 -0
- package/types/index.d.ts +1 -3
- package/types/index.d.ts.map +1 -1
- package/types/index.js +11 -11
- package/types/ui-config.d.ts +50 -11
- package/types/ui-config.d.ts.map +1 -1
- package/types/ui-runtime.d.ts +8 -82
- package/types/ui-runtime.d.ts.map +1 -1
- package/utils/index.d.ts +9 -3
- package/utils/index.d.ts.map +1 -1
- package/utils/index.js +59 -7
- package/adapters/platform-meta.constants.d.ts +0 -26
- package/adapters/platform-meta.constants.d.ts.map +0 -1
- package/adapters/platform-meta.d.ts +0 -234
- package/adapters/platform-meta.d.ts.map +0 -1
- package/base-template/bridge.d.ts +0 -90
- package/base-template/bridge.d.ts.map +0 -1
- package/base-template/default-base-template.d.ts +0 -91
- package/base-template/default-base-template.d.ts.map +0 -1
- package/base-template/index.d.ts +0 -15
- package/base-template/index.d.ts.map +0 -1
- package/base-template/index.js +0 -1393
- package/base-template/polyfills.d.ts +0 -31
- package/base-template/polyfills.d.ts.map +0 -1
- package/base-template/theme-styles.d.ts +0 -74
- package/base-template/theme-styles.d.ts.map +0 -1
- package/build/builders/base-builder.d.ts +0 -124
- package/build/builders/base-builder.d.ts.map +0 -1
- package/build/builders/esbuild-config.d.ts +0 -94
- package/build/builders/esbuild-config.d.ts.map +0 -1
- package/build/builders/hybrid-builder.d.ts +0 -93
- package/build/builders/hybrid-builder.d.ts.map +0 -1
- package/build/builders/index.d.ts +0 -17
- package/build/builders/index.d.ts.map +0 -1
- package/build/builders/inline-builder.d.ts +0 -83
- package/build/builders/inline-builder.d.ts.map +0 -1
- package/build/builders/static-builder.d.ts +0 -78
- package/build/builders/static-builder.d.ts.map +0 -1
- package/build/builders/types.d.ts +0 -341
- package/build/builders/types.d.ts.map +0 -1
- package/build/cdn-resources.d.ts +0 -244
- package/build/cdn-resources.d.ts.map +0 -1
- package/build/hybrid-data.d.ts +0 -127
- package/build/hybrid-data.d.ts.map +0 -1
- package/build/index.d.ts +0 -299
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -8699
- package/build/ui-components-browser.d.ts +0 -64
- package/build/ui-components-browser.d.ts.map +0 -1
- package/build/widget-manifest.d.ts +0 -362
- package/build/widget-manifest.d.ts.map +0 -1
- package/bundler/cache.d.ts +0 -173
- package/bundler/cache.d.ts.map +0 -1
- package/bundler/file-cache/component-builder.d.ts +0 -167
- package/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/bundler/file-cache/index.d.ts +0 -12
- package/bundler/file-cache/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/bundler/file-cache/storage/index.d.ts +0 -11
- package/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/interface.d.ts +0 -152
- package/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/bundler/file-cache/storage/redis.d.ts +0 -139
- package/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/bundler/index.d.ts +0 -35
- package/bundler/index.d.ts.map +0 -1
- package/bundler/index.js +0 -2953
- package/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/bundler/sandbox/executor.d.ts +0 -14
- package/bundler/sandbox/executor.d.ts.map +0 -1
- package/bundler/sandbox/policy.d.ts +0 -62
- package/bundler/sandbox/policy.d.ts.map +0 -1
- package/bundler/types.d.ts +0 -702
- package/bundler/types.d.ts.map +0 -1
- package/dependency/cdn-registry.d.ts +0 -98
- package/dependency/cdn-registry.d.ts.map +0 -1
- package/dependency/import-map.d.ts +0 -186
- package/dependency/import-map.d.ts.map +0 -1
- package/dependency/import-parser.d.ts +0 -82
- package/dependency/import-parser.d.ts.map +0 -1
- package/dependency/index.d.ts +0 -17
- package/dependency/index.d.ts.map +0 -1
- package/dependency/index.js +0 -3180
- package/dependency/resolver.d.ts +0 -164
- package/dependency/resolver.d.ts.map +0 -1
- package/dependency/schemas.d.ts +0 -486
- package/dependency/schemas.d.ts.map +0 -1
- package/dependency/template-loader.d.ts +0 -204
- package/dependency/template-loader.d.ts.map +0 -1
- package/dependency/template-processor.d.ts +0 -118
- package/dependency/template-processor.d.ts.map +0 -1
- package/dependency/types.d.ts +0 -739
- package/dependency/types.d.ts.map +0 -1
- package/esm/base-template/index.mjs +0 -1359
- package/esm/build/index.mjs +0 -8601
- package/esm/bundler/index.mjs +0 -2895
- package/esm/dependency/index.mjs +0 -3068
- package/esm/handlebars/index.mjs +0 -587
- package/esm/registry/index.mjs +0 -6305
- package/esm/renderers/index.mjs +0 -1557
- package/esm/runtime/index.mjs +0 -5361
- package/esm/styles/index.mjs +0 -171
- package/esm/theme/index.mjs +0 -756
- package/esm/tool-template/index.mjs +0 -3652
- package/esm/validation/index.mjs +0 -542
- package/handlebars/expression-extractor.d.ts +0 -147
- package/handlebars/expression-extractor.d.ts.map +0 -1
- package/handlebars/helpers.d.ts +0 -339
- package/handlebars/helpers.d.ts.map +0 -1
- package/handlebars/index.d.ts +0 -195
- package/handlebars/index.d.ts.map +0 -1
- package/handlebars/index.js +0 -659
- package/preview/claude-preview.d.ts +0 -67
- package/preview/claude-preview.d.ts.map +0 -1
- package/preview/generic-preview.d.ts +0 -66
- package/preview/generic-preview.d.ts.map +0 -1
- package/preview/index.d.ts +0 -36
- package/preview/index.d.ts.map +0 -1
- package/preview/openai-preview.d.ts +0 -70
- package/preview/openai-preview.d.ts.map +0 -1
- package/preview/types.d.ts +0 -199
- package/preview/types.d.ts.map +0 -1
- package/registry/index.d.ts +0 -46
- package/registry/index.d.ts.map +0 -1
- package/registry/index.js +0 -6342
- package/registry/render-template.d.ts +0 -91
- package/registry/render-template.d.ts.map +0 -1
- package/registry/tool-ui.registry.d.ts +0 -294
- package/registry/tool-ui.registry.d.ts.map +0 -1
- package/registry/uri-utils.d.ts +0 -56
- package/registry/uri-utils.d.ts.map +0 -1
- package/renderers/cache.d.ts +0 -145
- package/renderers/cache.d.ts.map +0 -1
- package/renderers/html.renderer.d.ts +0 -123
- package/renderers/html.renderer.d.ts.map +0 -1
- package/renderers/index.d.ts +0 -36
- package/renderers/index.d.ts.map +0 -1
- package/renderers/index.js +0 -1603
- package/renderers/mdx-client.renderer.d.ts +0 -124
- package/renderers/mdx-client.renderer.d.ts.map +0 -1
- package/renderers/registry.d.ts +0 -133
- package/renderers/registry.d.ts.map +0 -1
- package/renderers/types.d.ts +0 -343
- package/renderers/types.d.ts.map +0 -1
- package/renderers/utils/detect.d.ts +0 -107
- package/renderers/utils/detect.d.ts.map +0 -1
- package/renderers/utils/hash.d.ts +0 -40
- package/renderers/utils/hash.d.ts.map +0 -1
- package/renderers/utils/index.d.ts +0 -9
- package/renderers/utils/index.d.ts.map +0 -1
- package/renderers/utils/transpiler.d.ts +0 -70
- package/renderers/utils/transpiler.d.ts.map +0 -1
- package/runtime/adapters/html.adapter.d.ts +0 -59
- package/runtime/adapters/html.adapter.d.ts.map +0 -1
- package/runtime/adapters/index.d.ts +0 -26
- package/runtime/adapters/index.d.ts.map +0 -1
- package/runtime/adapters/mdx.adapter.d.ts +0 -73
- package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
- package/runtime/adapters/types.d.ts +0 -95
- package/runtime/adapters/types.d.ts.map +0 -1
- package/runtime/csp.d.ts +0 -48
- package/runtime/csp.d.ts.map +0 -1
- package/runtime/index.d.ts +0 -17
- package/runtime/index.d.ts.map +0 -1
- package/runtime/index.js +0 -5432
- package/runtime/mcp-bridge.d.ts +0 -101
- package/runtime/mcp-bridge.d.ts.map +0 -1
- package/runtime/renderer-runtime.d.ts +0 -133
- package/runtime/renderer-runtime.d.ts.map +0 -1
- package/runtime/sanitizer.d.ts +0 -180
- package/runtime/sanitizer.d.ts.map +0 -1
- package/runtime/types.d.ts +0 -415
- package/runtime/types.d.ts.map +0 -1
- package/runtime/wrapper.d.ts +0 -421
- package/runtime/wrapper.d.ts.map +0 -1
- package/styles/index.d.ts +0 -8
- package/styles/index.d.ts.map +0 -1
- package/styles/index.js +0 -222
- package/styles/variants.d.ts +0 -51
- package/styles/variants.d.ts.map +0 -1
- package/theme/cdn.d.ts +0 -195
- package/theme/cdn.d.ts.map +0 -1
- package/theme/css-to-theme.d.ts +0 -64
- package/theme/css-to-theme.d.ts.map +0 -1
- package/theme/index.d.ts +0 -19
- package/theme/index.d.ts.map +0 -1
- package/theme/index.js +0 -814
- package/theme/platforms.d.ts +0 -102
- package/theme/platforms.d.ts.map +0 -1
- package/theme/presets/github-openai.d.ts +0 -50
- package/theme/presets/github-openai.d.ts.map +0 -1
- package/theme/presets/index.d.ts +0 -11
- package/theme/presets/index.d.ts.map +0 -1
- package/theme/theme.d.ts +0 -396
- package/theme/theme.d.ts.map +0 -1
- package/tool-template/builder.d.ts +0 -213
- package/tool-template/builder.d.ts.map +0 -1
- package/tool-template/index.d.ts +0 -16
- package/tool-template/index.d.ts.map +0 -1
- package/tool-template/index.js +0 -3690
- package/validation/error-box.d.ts +0 -56
- package/validation/error-box.d.ts.map +0 -1
- package/validation/index.d.ts +0 -13
- package/validation/index.d.ts.map +0 -1
- package/validation/index.js +0 -576
- package/validation/schema-paths.d.ts +0 -118
- package/validation/schema-paths.d.ts.map +0 -1
- package/validation/template-validator.d.ts +0 -143
- package/validation/template-validator.d.ts.map +0 -1
- package/validation/wrapper.d.ts +0 -97
- 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
|
-
});
|