@orbit-work/ui 0.1.2 → 0.1.3
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/dist/appearance.cjs +4 -2
- package/dist/appearance.cjs.map +1 -1
- package/dist/appearance.d.cts +7 -1
- package/dist/appearance.d.ts +7 -1
- package/dist/appearance.js +5 -3
- package/dist/brand-preview.cjs +14 -0
- package/dist/brand-preview.cjs.map +1 -0
- package/dist/brand-preview.d.cts +13 -0
- package/dist/brand-preview.d.ts +13 -0
- package/dist/brand-preview.js +14 -0
- package/dist/brand-preview.js.map +1 -0
- package/dist/{chunk-KRP43SUA.cjs → chunk-JC7BHKS4.cjs} +2 -398
- package/dist/chunk-JC7BHKS4.cjs.map +1 -0
- package/dist/chunk-K7ONUTLA.cjs +240 -0
- package/dist/chunk-K7ONUTLA.cjs.map +1 -0
- package/dist/chunk-KTNWR3H5.js +399 -0
- package/dist/chunk-KTNWR3H5.js.map +1 -0
- package/dist/{chunk-S3R5QFO4.js → chunk-LSGO6AQR.js} +2 -398
- package/dist/chunk-LSGO6AQR.js.map +1 -0
- package/dist/chunk-Q7B4M5GC.cjs +399 -0
- package/dist/chunk-Q7B4M5GC.cjs.map +1 -0
- package/dist/chunk-ZXMHCL6D.js +240 -0
- package/dist/chunk-ZXMHCL6D.js.map +1 -0
- package/dist/core.css +12 -3
- package/dist/core.scoped.css +7888 -0
- package/dist/index.cjs +212 -377
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -4
- package/dist/index.d.ts +37 -4
- package/dist/index.js +191 -356
- package/dist/index.js.map +1 -1
- package/dist/{appearance-D7uh_ZTy.d.cts → unifiedTheme-DQ-sETKO.d.cts} +13 -4
- package/dist/{appearance-D7uh_ZTy.d.ts → unifiedTheme-DQ-sETKO.d.ts} +13 -4
- package/dist/workbench.css +12 -3
- package/package.json +16 -2
- package/dist/chunk-KRP43SUA.cjs.map +0 -1
- package/dist/chunk-S3R5QFO4.js.map +0 -1
|
@@ -128,6 +128,8 @@ type TenantTheme = {
|
|
|
128
128
|
name: string;
|
|
129
129
|
/** Brand image. Empty string means fall through to the host/brand layer. */
|
|
130
130
|
logo: string;
|
|
131
|
+
/** Optional login key-visual photo; empty/absent falls back to the stock KV. */
|
|
132
|
+
loginKV?: string;
|
|
131
133
|
favicon?: string;
|
|
132
134
|
modes: Partial<Record<ResolvedTheme, TenantThemeColors>>;
|
|
133
135
|
typography: {
|
|
@@ -149,17 +151,22 @@ type UnifiedThemeToken = BrandThemeToken | UnifiedTypographyToken;
|
|
|
149
151
|
type BrandTheme = {
|
|
150
152
|
id: string;
|
|
151
153
|
logo?: string;
|
|
154
|
+
/** Optional login key-visual photo (KV board background on the desktop login page). */
|
|
155
|
+
loginKV?: string;
|
|
152
156
|
favicon?: string;
|
|
153
157
|
modes: Partial<Record<ResolvedTheme, Partial<Record<BrandThemeToken, string>>>>;
|
|
154
158
|
typography?: {
|
|
155
159
|
fontSans: string;
|
|
156
160
|
fontMono: string;
|
|
157
161
|
};
|
|
162
|
+
/** OEM text-size preset; the personal preference and user skins still win. */
|
|
163
|
+
fontScale?: OrbitworkFontScale;
|
|
158
164
|
branding?: LocalizedBranding;
|
|
159
165
|
};
|
|
160
166
|
|
|
161
167
|
type UnifiedBranding = TenantBranding & {
|
|
162
168
|
logo?: string;
|
|
169
|
+
loginKV?: string;
|
|
163
170
|
favicon?: string;
|
|
164
171
|
};
|
|
165
172
|
type UnifiedTheme = {
|
|
@@ -185,8 +192,10 @@ type SkinThemeToken = (typeof ORBITWORK_SKIN_CSS_VARIABLES)[keyof typeof ORBITWO
|
|
|
185
192
|
type AppliedThemeToken = UnifiedThemeToken | SkinThemeToken;
|
|
186
193
|
/** Pick the best localized copy for a locale: canonical, then language, then en-US. */
|
|
187
194
|
declare function localizedCopy(source: LocalizedBranding | undefined, locale: string): TenantBranding | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Merge already-validated layers for one resolved color mode.
|
|
197
|
+
* Priority: personal skin > tenant > OEM brand > DS2 CSS defaults.
|
|
198
|
+
*/
|
|
199
|
+
declare function mergeUnifiedTheme(brand: BrandTheme | null, tenant: TenantTheme | null, userSkin: OrbitworkSkin | null, mode: ResolvedTheme, locale?: string, appearanceOverlaySkin?: OrbitworkSkin | null, fontScalePreference?: OrbitworkFontScale | null): UnifiedTheme;
|
|
188
200
|
|
|
189
|
-
|
|
190
|
-
declare const BUILTIN_ORBITWORK_SKINS: readonly [OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin];
|
|
191
|
-
|
|
192
|
-
export { ds2ContrastRatio as A, type BrandTheme as B, orbitworkSkinImageCssValue as C, DEFAULT_ORBITWORK_SKIN_ID as D, type LocalizedBranding as L, MAX_ORBITWORK_SKIN_IMAGE_BYTES as M, type OrbitworkSkin as O, type ResolvedTheme as R, type SkinValidationResult as S, type Theme as T, type UnifiedTheme as U, type OrbitworkFontScale as a, type TenantTheme as b, BUILTIN_ORBITWORK_SKINS as c, ORBITWORK_FONT_SCALES as d, type OrbitworkSkinChatBackgroundMask as e, type OrbitworkSkinTokens as f, type TenantBranding as g, type TenantThemeColors as h, hasOrbitworkSkinChatBackground as i, isOrbitworkFontScale as j, resolveOrbitworkSkinChatBackgroundMask as k, localizedCopy as l, BRAND_ACTION_TOKENS as m, type BrandActionToken as n, orbitworkSkinChatBackgroundMaskColor as o, parseOrbitworkSkin as p, type BrandThemeToken as q, resolveOrbitworkFontScale as r, ORBITWORK_SKIN_CSS_VARIABLES as s, ORBITWORK_SKIN_PUBLIC_PARTS as t, UNIFIED_NEUTRAL_TOKENS as u, UNIFIED_TYPOGRAPHY_TOKENS as v, type UnifiedBranding as w, type UnifiedNeutralToken as x, type UnifiedThemeToken as y, type UnifiedTypographyToken as z };
|
|
201
|
+
export { type AppliedThemeToken as A, type BrandTheme as B, ds2ContrastRatio as C, orbitworkSkinImageCssValue as D, type LocalizedBranding as L, MAX_ORBITWORK_SKIN_IMAGE_BYTES as M, type OrbitworkFontScale as O, type ResolvedTheme as R, type SkinValidationResult as S, type TenantBranding as T, type UnifiedTheme as U, type TenantTheme as a, type UnifiedBranding as b, type UnifiedThemeToken as c, type Theme as d, type OrbitworkSkin as e, ORBITWORK_FONT_SCALES as f, type OrbitworkSkinChatBackgroundMask as g, type OrbitworkSkinTokens as h, type TenantThemeColors as i, hasOrbitworkSkinChatBackground as j, isOrbitworkFontScale as k, localizedCopy as l, mergeUnifiedTheme as m, resolveOrbitworkSkinChatBackgroundMask as n, orbitworkSkinChatBackgroundMaskColor as o, parseOrbitworkSkin as p, BRAND_ACTION_TOKENS as q, resolveOrbitworkFontScale as r, type BrandActionToken as s, type BrandThemeToken as t, ORBITWORK_SKIN_CSS_VARIABLES as u, ORBITWORK_SKIN_PUBLIC_PARTS as v, UNIFIED_NEUTRAL_TOKENS as w, UNIFIED_TYPOGRAPHY_TOKENS as x, type UnifiedNeutralToken as y, type UnifiedTypographyToken as z };
|
|
@@ -128,6 +128,8 @@ type TenantTheme = {
|
|
|
128
128
|
name: string;
|
|
129
129
|
/** Brand image. Empty string means fall through to the host/brand layer. */
|
|
130
130
|
logo: string;
|
|
131
|
+
/** Optional login key-visual photo; empty/absent falls back to the stock KV. */
|
|
132
|
+
loginKV?: string;
|
|
131
133
|
favicon?: string;
|
|
132
134
|
modes: Partial<Record<ResolvedTheme, TenantThemeColors>>;
|
|
133
135
|
typography: {
|
|
@@ -149,17 +151,22 @@ type UnifiedThemeToken = BrandThemeToken | UnifiedTypographyToken;
|
|
|
149
151
|
type BrandTheme = {
|
|
150
152
|
id: string;
|
|
151
153
|
logo?: string;
|
|
154
|
+
/** Optional login key-visual photo (KV board background on the desktop login page). */
|
|
155
|
+
loginKV?: string;
|
|
152
156
|
favicon?: string;
|
|
153
157
|
modes: Partial<Record<ResolvedTheme, Partial<Record<BrandThemeToken, string>>>>;
|
|
154
158
|
typography?: {
|
|
155
159
|
fontSans: string;
|
|
156
160
|
fontMono: string;
|
|
157
161
|
};
|
|
162
|
+
/** OEM text-size preset; the personal preference and user skins still win. */
|
|
163
|
+
fontScale?: OrbitworkFontScale;
|
|
158
164
|
branding?: LocalizedBranding;
|
|
159
165
|
};
|
|
160
166
|
|
|
161
167
|
type UnifiedBranding = TenantBranding & {
|
|
162
168
|
logo?: string;
|
|
169
|
+
loginKV?: string;
|
|
163
170
|
favicon?: string;
|
|
164
171
|
};
|
|
165
172
|
type UnifiedTheme = {
|
|
@@ -185,8 +192,10 @@ type SkinThemeToken = (typeof ORBITWORK_SKIN_CSS_VARIABLES)[keyof typeof ORBITWO
|
|
|
185
192
|
type AppliedThemeToken = UnifiedThemeToken | SkinThemeToken;
|
|
186
193
|
/** Pick the best localized copy for a locale: canonical, then language, then en-US. */
|
|
187
194
|
declare function localizedCopy(source: LocalizedBranding | undefined, locale: string): TenantBranding | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Merge already-validated layers for one resolved color mode.
|
|
197
|
+
* Priority: personal skin > tenant > OEM brand > DS2 CSS defaults.
|
|
198
|
+
*/
|
|
199
|
+
declare function mergeUnifiedTheme(brand: BrandTheme | null, tenant: TenantTheme | null, userSkin: OrbitworkSkin | null, mode: ResolvedTheme, locale?: string, appearanceOverlaySkin?: OrbitworkSkin | null, fontScalePreference?: OrbitworkFontScale | null): UnifiedTheme;
|
|
188
200
|
|
|
189
|
-
|
|
190
|
-
declare const BUILTIN_ORBITWORK_SKINS: readonly [OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin, OrbitworkSkin];
|
|
191
|
-
|
|
192
|
-
export { ds2ContrastRatio as A, type BrandTheme as B, orbitworkSkinImageCssValue as C, DEFAULT_ORBITWORK_SKIN_ID as D, type LocalizedBranding as L, MAX_ORBITWORK_SKIN_IMAGE_BYTES as M, type OrbitworkSkin as O, type ResolvedTheme as R, type SkinValidationResult as S, type Theme as T, type UnifiedTheme as U, type OrbitworkFontScale as a, type TenantTheme as b, BUILTIN_ORBITWORK_SKINS as c, ORBITWORK_FONT_SCALES as d, type OrbitworkSkinChatBackgroundMask as e, type OrbitworkSkinTokens as f, type TenantBranding as g, type TenantThemeColors as h, hasOrbitworkSkinChatBackground as i, isOrbitworkFontScale as j, resolveOrbitworkSkinChatBackgroundMask as k, localizedCopy as l, BRAND_ACTION_TOKENS as m, type BrandActionToken as n, orbitworkSkinChatBackgroundMaskColor as o, parseOrbitworkSkin as p, type BrandThemeToken as q, resolveOrbitworkFontScale as r, ORBITWORK_SKIN_CSS_VARIABLES as s, ORBITWORK_SKIN_PUBLIC_PARTS as t, UNIFIED_NEUTRAL_TOKENS as u, UNIFIED_TYPOGRAPHY_TOKENS as v, type UnifiedBranding as w, type UnifiedNeutralToken as x, type UnifiedThemeToken as y, type UnifiedTypographyToken as z };
|
|
201
|
+
export { type AppliedThemeToken as A, type BrandTheme as B, ds2ContrastRatio as C, orbitworkSkinImageCssValue as D, type LocalizedBranding as L, MAX_ORBITWORK_SKIN_IMAGE_BYTES as M, type OrbitworkFontScale as O, type ResolvedTheme as R, type SkinValidationResult as S, type TenantBranding as T, type UnifiedTheme as U, type TenantTheme as a, type UnifiedBranding as b, type UnifiedThemeToken as c, type Theme as d, type OrbitworkSkin as e, ORBITWORK_FONT_SCALES as f, type OrbitworkSkinChatBackgroundMask as g, type OrbitworkSkinTokens as h, type TenantThemeColors as i, hasOrbitworkSkinChatBackground as j, isOrbitworkFontScale as k, localizedCopy as l, mergeUnifiedTheme as m, resolveOrbitworkSkinChatBackgroundMask as n, orbitworkSkinChatBackgroundMaskColor as o, parseOrbitworkSkin as p, BRAND_ACTION_TOKENS as q, resolveOrbitworkFontScale as r, type BrandActionToken as s, type BrandThemeToken as t, ORBITWORK_SKIN_CSS_VARIABLES as u, ORBITWORK_SKIN_PUBLIC_PARTS as v, UNIFIED_NEUTRAL_TOKENS as w, UNIFIED_TYPOGRAPHY_TOKENS as x, type UnifiedNeutralToken as y, type UnifiedTypographyToken as z };
|
package/dist/workbench.css
CHANGED
|
@@ -2387,9 +2387,6 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
|
2387
2387
|
.table {
|
|
2388
2388
|
display: table;
|
|
2389
2389
|
}
|
|
2390
|
-
.\[aspect-ratio\:73\.4\/45\.3\] {
|
|
2391
|
-
aspect-ratio: 73.4/45.3;
|
|
2392
|
-
}
|
|
2393
2390
|
.aspect-\[16\/10\] {
|
|
2394
2391
|
aspect-ratio: 16/10;
|
|
2395
2392
|
}
|
|
@@ -2582,6 +2579,9 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
|
2582
2579
|
.h-\[38px\] {
|
|
2583
2580
|
height: 38px;
|
|
2584
2581
|
}
|
|
2582
|
+
.h-\[46px\] {
|
|
2583
|
+
height: 46px;
|
|
2584
|
+
}
|
|
2585
2585
|
.h-\[52px\] {
|
|
2586
2586
|
height: 52px;
|
|
2587
2587
|
}
|
|
@@ -2882,6 +2882,9 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
|
2882
2882
|
.w-\[26px\] {
|
|
2883
2883
|
width: 26px;
|
|
2884
2884
|
}
|
|
2885
|
+
.w-\[34px\] {
|
|
2886
|
+
width: 34px;
|
|
2887
|
+
}
|
|
2885
2888
|
.w-\[38px\] {
|
|
2886
2889
|
width: 38px;
|
|
2887
2890
|
}
|
|
@@ -4637,6 +4640,9 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
|
4637
4640
|
.font-\[family-name\:var\(--ow-font-display\)\] {
|
|
4638
4641
|
font-family: var(--ow-font-display);
|
|
4639
4642
|
}
|
|
4643
|
+
.font-\[family-name\:var\(--ow-font-display\,\'Space_Grotesk\'\,sans-serif\)\] {
|
|
4644
|
+
font-family: var(--ow-font-display,'Space Grotesk',sans-serif);
|
|
4645
|
+
}
|
|
4640
4646
|
.font-\[family-name\:var\(--ow-font-mono\)\] {
|
|
4641
4647
|
font-family: var(--ow-font-mono);
|
|
4642
4648
|
}
|
|
@@ -4660,6 +4666,9 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
|
4660
4666
|
font-size: var(--text-xs);
|
|
4661
4667
|
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
4662
4668
|
}
|
|
4669
|
+
.text-\[20px\] {
|
|
4670
|
+
font-size: 20px;
|
|
4671
|
+
}
|
|
4663
4672
|
.text-\[length\:calc\(var\(--ow-fs-ui\)_\*_11\.5_\/_13\)\] {
|
|
4664
4673
|
font-size: calc(var(--ow-fs-ui) * 11.5 / 13);
|
|
4665
4674
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbit-work/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Orbitwork Design System — React components with light/dark theme support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -41,6 +41,16 @@
|
|
|
41
41
|
"default": "./dist/appearance.cjs"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
+
"./brand-preview": {
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./dist/brand-preview.d.ts",
|
|
47
|
+
"default": "./dist/brand-preview.js"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./dist/brand-preview.d.cts",
|
|
51
|
+
"default": "./dist/brand-preview.cjs"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
44
54
|
"./about-window": {
|
|
45
55
|
"import": {
|
|
46
56
|
"types": "./dist/about-window.d.ts",
|
|
@@ -72,6 +82,7 @@
|
|
|
72
82
|
}
|
|
73
83
|
},
|
|
74
84
|
"./styles/core.css": "./dist/core.css",
|
|
85
|
+
"./styles/core.scoped.css": "./dist/core.scoped.css",
|
|
75
86
|
"./styles/workbench.css": "./dist/workbench.css",
|
|
76
87
|
"./styles/file-tree.css": "./dist/file-tree.css",
|
|
77
88
|
"./styles/office.css": "./dist/office.css",
|
|
@@ -92,6 +103,7 @@
|
|
|
92
103
|
],
|
|
93
104
|
"sideEffects": [
|
|
94
105
|
"./dist/core.css",
|
|
106
|
+
"./dist/core.scoped.css",
|
|
95
107
|
"./dist/workbench.css",
|
|
96
108
|
"./dist/file-tree.css",
|
|
97
109
|
"./dist/office.css",
|
|
@@ -133,6 +145,7 @@
|
|
|
133
145
|
"playwright": "1.62.1",
|
|
134
146
|
"postcss": "^8.5.26",
|
|
135
147
|
"postcss-import": "^17.0.0",
|
|
148
|
+
"postcss-selector-parser": "^7.1.6",
|
|
136
149
|
"pretty-format": "^30.5.0",
|
|
137
150
|
"react": "^19.0.0",
|
|
138
151
|
"react-dom": "^19.0.0",
|
|
@@ -175,10 +188,11 @@
|
|
|
175
188
|
"check:a11y": "vitest run --project storybook",
|
|
176
189
|
"check:utilities": "node scripts/check-missing-utilities.mjs",
|
|
177
190
|
"check:css": "node scripts/check-css-contract.mjs",
|
|
191
|
+
"check:scopes": "node scripts/check-scoped-css.mjs",
|
|
178
192
|
"generate:tokens": "node scripts/generate-tokens-css.mjs",
|
|
179
193
|
"test:ds2": "node --test \"scripts/*.test.mjs\"",
|
|
180
194
|
"verify:package": "node scripts/verify-package.mjs",
|
|
181
|
-
"verify:static": "pnpm check && pnpm test && pnpm typecheck && pnpm build && pnpm verify:package && pnpm check:stories && pnpm check:i18n && pnpm check:css && pnpm check:ds2 && pnpm check:utilities",
|
|
195
|
+
"verify:static": "pnpm check && pnpm test && pnpm typecheck && pnpm build && pnpm verify:package && pnpm check:scopes && pnpm check:stories && pnpm check:i18n && pnpm check:css && pnpm check:ds2 && pnpm check:utilities",
|
|
182
196
|
"verify": "pnpm verify:static && pnpm check:a11y"
|
|
183
197
|
}
|
|
184
198
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/wowzin/projects/orbit/packages/ui/dist/chunk-KRP43SUA.cjs","../src/tokens/base.ts","../src/theme/core/fontScale.ts","../src/theme/utils/cssSafety.ts","../src/theme/core/skin.ts","../src/theme/skins/index.ts","../src/theme/core/types.ts"],"names":[],"mappings":"AAAA;ACQO,IAAM,UAAA,EAAY;AAAA;AAAA,EAEvB,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ,SAAA;AAAA,EACR,UAAA,EAAY,SAAA;AAAA,EACZ,KAAA,EAAO,SAAA;AAAA,EACP,QAAA,EAAU,SAAA;AAAA,EACV,cAAA,EAAgB,SAAA;AAAA,EAChB,cAAA,EAAgB,SAAA;AAAA;AAAA,EAGhB,KAAA,EAAO;AAAA,IACL,YAAA,EAAc,SAAA;AAAA,IACd,WAAA,EAAa,mBAAA;AAAA,IACb,OAAA,EAAS,SAAA;AAAA,IACT,MAAA,EAAQ;AAAA,EACV,CAAA;AAAA;AAAA,EAGA,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM;AAAA,EACR,CAAA;AAAA;AAAA,EAGA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,KAAA;AAAA,IACN,GAAA,EAAK,KAAA;AAAA,IACL,IAAA,EAAM,KAAA;AAAA,IACN,GAAA,EAAK,KAAA;AAAA,IACL,GAAA,EAAK,MAAA;AAAA,IACL,GAAA,EAAK,MAAA;AAAA,IACL,GAAA,EAAK,MAAA;AAAA,IACL,GAAA,EAAK,MAAA;AAAA,IACL,GAAA,EAAK,MAAA;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,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AAA;AACP,MAAA;AACA,MAAA;AACW,MAAA;AACA,MAAA;AAC1B,IAAA;AACH,EAAA;AACF;AAEwC;AAC7B,EAAA;AACL,EAAA;AACE,EAAA;AACO,EAAA;AACN,EAAA;AACe,IAAA;AACC,MAAA;AACE,MAAA;AACD,MAAA;AACD,MAAA;AACE,MAAA;AACP,MAAA;AACA,MAAA;AACW,MAAA;AACA,MAAA;AAC1B,IAAA;AACkB,IAAA;AACE,MAAA;AACE,MAAA;AACD,MAAA;AACD,MAAA;AACE,MAAA;AACP,MAAA;AACA,MAAA;AACW,MAAA;AACA,MAAA;AAC1B,IAAA;AACH,EAAA;AACF;AAEuC;AACrC,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;ALqqByE;AACA;AM5iClC;AACrC,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;AAoCsC;AACpC,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;AAEmC;AACjC,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;AAE4E;ANygCH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/wowzin/projects/orbit/packages/ui/dist/chunk-KRP43SUA.cjs","sourcesContent":[null,"/**\n * Orbitwork Design System — Primitive tokens.\n *\n * Theme-invariant foundation scales consumed by the CSS generator. Component\n * and layout measurements live in metrics.ts; theme semantics live in the\n * light/dark modules.\n */\n\nexport const primitive = {\n // Core brand colors\n navy: \"#0F1B3D\",\n yellow: \"#FFD23E\",\n yellowDeep: \"#D8A300\",\n white: \"#F7F6F1\",\n graphite: \"#16171B\",\n graphiteRaised: \"#1E2025\",\n graphiteBorder: \"#2A2C33\",\n\n // Theme-invariant brand lockup palette.\n brand: {\n dividerLight: \"#D8D5CC\",\n dividerDark: \"var(--ow-gray-70)\",\n cnLight: \"#3A3E46\",\n cnDark: \"#C9CBD1\",\n },\n\n // Grayscale 00-90: warm white to navy\n gray: {\n \"00\": \"#F7F6F1\",\n \"05\": \"#ECEBE5\",\n \"10\": \"#DCDCD7\",\n \"20\": \"#C2C3C1\",\n \"30\": \"#A2A5A9\",\n \"40\": \"#82878F\",\n \"50\": \"#646B7A\",\n \"60\": \"#4A5164\",\n \"70\": \"#333B50\",\n \"80\": \"#202942\",\n \"90\": \"#0F1B3D\",\n },\n\n // Spacing — Orbitwork DS standard scale\n space: {\n \"05\": \"2px\",\n \"1\": \"4px\",\n \"15\": \"6px\",\n \"2\": \"8px\",\n \"3\": \"12px\",\n \"4\": \"16px\",\n \"5\": \"20px\",\n \"6\": \"24px\",\n \"8\": \"32px\",\n \"10\": \"40px\",\n \"12\": \"48px\",\n \"16\": \"64px\",\n \"24\": \"96px\",\n },\n\n // Radius\n radius: {\n \"2xs\": \"4px\",\n xs: \"6px\",\n sm: \"8px\",\n md: \"10px\",\n lg: \"12px\",\n xl: \"16px\",\n pill: \"999px\",\n },\n\n // Typography — fonts\n fontDisplay: \"'Space Grotesk', 'HarmonyOS Sans SC', 'Noto Sans SC', sans-serif\",\n fontSans:\n \"'HarmonyOS Sans SC', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'\",\n fontMono:\n \"'IBM Plex Mono', ui-monospace, 'SF Mono', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'\",\n\n // Type scale\n fsDisplay: \"46px\",\n fsHeadline: \"32px\",\n fsTitle: \"22px\",\n fsSubtitle: \"16px\",\n fsBody: \"14px\",\n fsCaption: \"12px\",\n fsEyebrow: \"11px\",\n fsUi: \"13px\",\n fsCode: \"13px\",\n fsEyebrowCjk: \"12px\",\n // Extended type scale\n fsHeadlineLg: \"34px\",\n fsHeadlineMd: \"27px\",\n fsHeadlineSm: \"22px\",\n fsTitleLg: \"19px\",\n fsTitleMd: \"16px\",\n fsTitleSm: \"14px\",\n fsBodyLg: \"16px\",\n fsBodyMd: \"14px\",\n fsBodySm: \"12px\",\n fsMarkMd: \"11px\",\n fsMarkSm: \"10px\",\n\n // Line heights\n lhHeadline: \"1.15\",\n lhTitle: \"1.3\",\n lhBody: \"1.75\",\n lhUi: \"1.5\",\n lhCode: \"1.7\",\n\n // Letter spacing\n lsTitle: \"0.01em\",\n lsEyebrow: \"0.14em\",\n lsEyebrowCjk: \"0.08em\",\n\n // Motion\n easeBeacon: \"cubic-bezier(0.22, 1, 0.36, 1)\",\n dur1: \"120ms\",\n dur2: \"200ms\",\n dur3: \"320ms\",\n durSpin: \"1.6s\",\n durSpinFast: \"0.9s\",\n durSplash: \"1250ms\",\n staggerBeacon: \"125ms\",\n\n // Font weight\n fontWeightNormal: \"400\",\n fontWeightMedium: \"500\",\n fontWeightSemibold: \"600\",\n fontWeightBold: \"700\",\n\n // Border width\n borderWidthThin: \"0.5px\",\n borderWidthDefault: \"1px\",\n borderWidthThick: \"2px\",\n\n // Opacity levels\n opacityMuted: \"0.6\",\n opacityHover: \"0.8\",\n} as const\n","import { primitive } from \"../../tokens/base.ts\"\n\n/** Supported text sizes, independent of the light/dark palette. */\nexport const ORBITWORK_FONT_SCALES = [0.9, 1, 1.1, 1.2] as const\nexport type OrbitworkFontScale = (typeof ORBITWORK_FONT_SCALES)[number]\n\nexport function isOrbitworkFontScale(value: unknown): value is OrbitworkFontScale {\n return typeof value === \"number\" && ORBITWORK_FONT_SCALES.some((scale) => scale === value)\n}\n\n/** Personal device preference wins over a skin preset; old settings resolve to 100%. */\nexport function resolveOrbitworkFontScale(preference: unknown, skinScale?: unknown): OrbitworkFontScale {\n return isOrbitworkFontScale(preference) ? preference : isOrbitworkFontScale(skinScale) ? skinScale : 1\n}\n\n/** Reuse the maintained DS2 scale. Never compound a previously applied size. */\nexport function fontScaleTokens(scale: OrbitworkFontScale): Record<string, string> {\n if (!isOrbitworkFontScale(scale) || scale === 1) return {}\n return Object.fromEntries(\n Object.entries(primitive)\n .filter(([key]) => /^fs[A-Z]/.test(key))\n .map(([key, value]) => [\n `--ow-${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`,\n `${Math.round(Number.parseFloat(String(value)) * scale * 100) / 100}px`,\n ]),\n )\n}\n","/** Security verdict for precision CSS before it reaches the runtime stylesheet. */\nexport interface CSSSafetyReport {\n ok: boolean\n blockedImports: number\n blockedUrls: number\n blockedScripts: number\n warnings: string[]\n}\n\n/**\n * Precision CSS is declarative styling only. Assets use dedicated validated\n * skin fields, so every import, URL and executable CSS form is rejected here.\n */\nexport function analyzeSkinCSS(css: string): CSSSafetyReport {\n const blockedImports = css.match(/@import\\b/gi)?.length ?? 0\n const blockedUrls = css.match(/url\\s*\\(/gi)?.length ?? 0\n const blockedScripts = (css.match(/javascript\\s*:/gi)?.length ?? 0) + (css.match(/expression\\s*\\(/gi)?.length ?? 0)\n const warnings: string[] = []\n\n if (blockedImports > 0) warnings.push(`检测到 ${blockedImports} 个 @import 规则`)\n if (blockedUrls > 0) warnings.push(`检测到 ${blockedUrls} 个 url() 引用`)\n if (blockedScripts > 0) warnings.push(`检测到 ${blockedScripts} 个可执行 CSS 表达式`)\n\n return {\n ok: warnings.length === 0,\n blockedImports,\n blockedUrls,\n blockedScripts,\n warnings,\n }\n}\n","/**\n * Orbitwork skin protocol — aligned with Design project architecture.\n * A skin is a validated JSON document that overrides --ow-* CSS variables\n * at runtime. This module is framework-agnostic.\n */\n\nimport { analyzeSkinCSS } from \"../utils/cssSafety.ts\"\nimport { type OrbitworkFontScale, isOrbitworkFontScale } from \"./fontScale.ts\"\n\nexport type Theme = \"light\" | \"dark\" | \"system\"\nexport type ResolvedTheme = \"light\" | \"dark\"\n\n/**\n * DS2 皮肤白名单(COMPONENT-RULES §15 · 2026-08-31 裁决):\n * - 可覆盖:中性表面/边框/文字梯度、chat/composer/sidebar 背景类、\n * btn-primary 族(唯一开放的租户品牌色位)。\n * - 已移除(禁覆盖):primary 族(--ow-primary 暗档=荧黄行动极)、link、\n * switchActive(--ow-control-on 无彩选中)、功能色四族、cardRadius/buttonRadius\n * (圆角是品牌定稿)。\n */\nexport type OrbitworkSkinTokens = {\n backgroundPrimary?: string\n backgroundSecondary?: string\n backgroundTertiary?: string\n foregroundPrimary?: string\n foregroundSecondary?: string\n foregroundMuted?: string\n borderSubtle?: string\n borderStrong?: string\n buttonPrimaryBackground?: string\n buttonPrimaryForeground?: string\n chatBackground?: string\n chatBackgroundImage?: string\n /** 0–1 decimal string; kept under the legacy chatBackground namespace for skin.json compatibility. */\n chatBackgroundImageOpacity?: string\n chatBackgroundOverlay?: string\n chatBackgroundMaskColor?: string\n chatBackgroundPosition?:\n | \"center\"\n | \"top\"\n | \"bottom\"\n | \"left\"\n | \"right\"\n | \"top left\"\n | \"top right\"\n | \"bottom left\"\n | \"bottom right\"\n chatBackgroundSize?: \"cover\" | \"contain\" | \"auto\"\n userBubbleBackground?: string\n userBubbleForeground?: string\n userBubbleBorder?: string\n composerBackground?: string\n composerBorder?: string\n sidebarBackground?: string\n sidebarSelectedBackground?: string\n}\n\n/** Maintenance record for each public-part precision selector. */\nexport type OrbitworkSkinRegistryEntry = {\n target: string\n reason: string\n}\n\nexport type OrbitworkSkin = {\n version: 1\n id: string\n name: string\n description?: string\n /** Uniform text size preset, shared by both color modes. */\n fontScale?: OrbitworkFontScale\n modes: {\n light?: OrbitworkSkinTokens\n dark?: OrbitworkSkinTokens\n }\n contributes?: {\n /** Registered CSS targeting component roots and their public parts. */\n publicPartStyles?: string\n /** Every public-part selector must have a matching maintenance record. */\n registry?: OrbitworkSkinRegistryEntry[]\n }\n}\n\nexport type SkinValidationResult = { ok: true; skin: OrbitworkSkin } | { ok: false; error: string }\n\nconst COLOR_KEYS = [\n \"backgroundPrimary\",\n \"backgroundSecondary\",\n \"backgroundTertiary\",\n \"foregroundPrimary\",\n \"foregroundSecondary\",\n \"foregroundMuted\",\n \"borderSubtle\",\n \"borderStrong\",\n \"buttonPrimaryBackground\",\n \"buttonPrimaryForeground\",\n \"chatBackground\",\n \"chatBackgroundOverlay\",\n \"userBubbleBackground\",\n \"userBubbleForeground\",\n \"userBubbleBorder\",\n \"composerBackground\",\n \"composerBorder\",\n \"sidebarBackground\",\n \"sidebarSelectedBackground\",\n] as const\nconst IMAGE_KEYS = [\"chatBackgroundImage\"] as const\nconst OPACITY_KEYS = [\"chatBackgroundImageOpacity\"] as const\nconst MASK_COLOR_KEYS = [\"chatBackgroundMaskColor\"] as const\nconst POSITION_KEYS = [\"chatBackgroundPosition\"] as const\nconst SIZE_KEYS = [\"chatBackgroundSize\"] as const\nconst TOKEN_KEYS = [\n ...COLOR_KEYS,\n ...MASK_COLOR_KEYS,\n ...IMAGE_KEYS,\n ...OPACITY_KEYS,\n ...POSITION_KEYS,\n ...SIZE_KEYS,\n] as const\nconst ROOT_KEYS = new Set([\"version\", \"id\", \"name\", \"description\", \"fontScale\", \"modes\", \"contributes\"])\nconst MODE_KEYS = new Set([\"light\", \"dark\"])\nconst TOKEN_KEY_SET = new Set<string>(TOKEN_KEYS)\nconst CONTRIBUTES_KEYS = new Set([\"publicPartStyles\", \"registry\"])\nconst REGISTRY_ENTRY_KEYS = new Set([\"target\", \"reason\"])\nexport const HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i\nconst MASK_HEX_COLOR = /^#[0-9a-f]{6}(?:[0-9a-f]{2})?$/i\nconst DATA_IMAGE = /^data:image\\/(png|jpeg|webp);base64,([A-Za-z0-9+/]+={0,2})$/\nconst BACKGROUND_POSITIONS = new Set([\n \"center\",\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n \"top left\",\n \"top right\",\n \"bottom left\",\n \"bottom right\",\n])\nconst BACKGROUND_SIZES = new Set([\"cover\", \"contain\", \"auto\"])\nexport const MAX_ORBITWORK_SKIN_IMAGE_BYTES = 5 * 1024 * 1024\nconst CHAT_BACKGROUND_MASK_DERIVED_PROPERTIES = [\n \"--ow-chat-bg-mask-start-opacity\",\n \"--ow-chat-bg-mask-end-opacity\",\n] as const\n\nexport type OrbitworkSkinChatBackgroundMask = {\n color: string\n strength: number\n startOpacity: number\n endOpacity: number\n}\n\n/** Six-digit colors retain the original 80% → 50% mask; explicit alpha controls final strength. */\nexport function resolveOrbitworkSkinChatBackgroundMask(value: string): OrbitworkSkinChatBackgroundMask {\n const normalized = MASK_HEX_COLOR.test(value) ? value.toLowerCase() : \"#000000\"\n const strength = normalized.length === 9 ? Math.round((Number.parseInt(normalized.slice(7), 16) / 255) * 100) : 80\n const startOpacity = strength\n const endOpacity = strength <= 80 ? strength * 0.625 : 50 + (strength - 80) * 2.5\n return { color: normalized.slice(0, 7), strength, startOpacity, endOpacity }\n}\n\nexport function orbitworkSkinChatBackgroundMaskColor(color: string, strength: number): string {\n const normalizedColor = /^#[0-9a-f]{6}$/i.test(color) ? color.toLowerCase() : \"#000000\"\n const alpha = Math.round((Math.min(100, Math.max(0, strength)) / 100) * 255)\n return `${normalizedColor}${alpha.toString(16).padStart(2, \"0\")}`\n}\n\nexport const ORBITWORK_SKIN_CSS_VARIABLES: Readonly<Record<keyof OrbitworkSkinTokens, string>> = {\n backgroundPrimary: \"--ow-bg\",\n backgroundSecondary: \"--ow-surface\",\n backgroundTertiary: \"--ow-surface-2\",\n foregroundPrimary: \"--ow-text\",\n foregroundSecondary: \"--ow-text-2\",\n foregroundMuted: \"--ow-text-3\",\n borderSubtle: \"--ow-border\",\n borderStrong: \"--ow-border-strong\",\n buttonPrimaryBackground: \"--ow-btn-primary-bg\",\n buttonPrimaryForeground: \"--ow-btn-primary-fg\",\n chatBackground: \"--ow-chat-bg\",\n chatBackgroundImage: \"--ow-chat-bg-image\",\n chatBackgroundImageOpacity: \"--ow-chat-bg-image-opacity\",\n chatBackgroundOverlay: \"--ow-chat-bg-overlay\",\n chatBackgroundMaskColor: \"--ow-chat-bg-mask-color\",\n chatBackgroundPosition: \"--ow-chat-bg-position\",\n chatBackgroundSize: \"--ow-chat-bg-size\",\n // 三件用户气泡钩子由 domain/chat/UserTurn 消费;未覆盖时兜底 DS2 井色配方\n // (bg=--ow-bubble-user / fg=--ow-text / border=--ow-border),不再兜底透明。\n userBubbleBackground: \"--ow-chat-user-bubble-bg\",\n userBubbleForeground: \"--ow-chat-user-bubble-fg\",\n userBubbleBorder: \"--ow-chat-user-bubble-border\",\n composerBackground: \"--ow-composer-bg\",\n composerBorder: \"--ow-composer-border\",\n sidebarBackground: \"--ow-sidebar-bg\",\n sidebarSelectedBackground: \"--ow-sidebar-selected-bg\",\n}\n\n/**\n * DS2 皮肤禁覆盖清单(COMPONENT-RULES §15 · 2026-08-31 裁决)。\n * 条目以 `*` 结尾表示前缀匹配;其余为精确名(含其 `-` 后缀派生,如\n * `--ow-control-on` 同时覆盖 `--ow-control-on-glyph`)。\n *\n * 官方 skin skill 直接调用本模块导出的 parseOrbitworkSkin,不复制这份清单。\n */\nexport const DS2_SKIN_DENYLIST = [\n // 三极 token\n \"--ow-beacon\",\n \"--ow-beacon-idle\",\n \"--ow-accent-dot\",\n \"--ow-data-today\",\n // 行动极族(租户品牌色只经 btn-primary 族开放,--ow-primary 落点不可写)\n \"--ow-primary*\",\n // 无彩选中原则\n \"--ow-control-on\",\n // focus-ring\n \"--ow-focus-ring\",\n // 功能色四族全档\n \"--ow-info*\",\n \"--ow-success*\",\n \"--ow-warning*\",\n \"--ow-error*\",\n // 功能色别名:--ow-mention-bg/-text 直挂 --ow-info-tint/-on-tint,\n // Aliases are denied too, so precision CSS cannot bypass functional colors.\n \"--ow-mention*\",\n // 恒定域\n \"--ow-paper\",\n \"--ow-stage-*\",\n \"--ow-term-*\",\n \"--ow-ansi-*\",\n // 圆角(形状表是品牌定稿)\n \"--ow-radius-*\",\n] as const\n\n/**\n * DS2 皮肤禁覆盖 **CSS 属性** 清单(COMPONENT-RULES §5/§7/§9 · W5 终扫补闸)。\n *\n * `DS2_SKIN_DENYLIST` only sees token names. Precision CSS can also write\n * `box-shadow: 0 0 20px …`, `border-radius: 18px`,\n * `transform: translateY(-2px)`、`animation: neon-pulse 2s infinite` 完全绕开它——\n * 而这四类恰恰是 2.0 明令收口的三层:贴地零影(§5)、形状表定稿(§7)、\n * 唯一动效语汇=信标(§9)。故对属性维度另立一闸:命中即整块剥除。\n *\n * 条目为属性名前缀(连字符边界):`border-radius` 同时覆盖\n * `border-top-left-radius` 等长写;`transition` 覆盖 `transition-property` 等。\n *\n * 官方 skin skill 直接调用本模块导出的 parseOrbitworkSkin,不复制这份清单。\n */\nexport const DS2_SKIN_DENIED_PROPERTIES = [\n \"border-radius\",\n \"border-top-left-radius\",\n \"border-top-right-radius\",\n \"border-bottom-left-radius\",\n \"border-bottom-right-radius\",\n \"box-shadow\",\n \"transform\",\n \"animation\",\n \"transition\",\n \"backdrop-filter\",\n \"-webkit-backdrop-filter\",\n] as const\n\n/**\n * 判断某个 CSS 属性名是否命中属性维度禁覆盖清单。\n * 只按连字符边界做前缀匹配,避免 `animation` 误伤自定义属性 `--animation-x`\n * (自定义属性由 token 维度那一闸单独管)。\n */\nexport function isDs2SkinDeniedProperty(propertyName: string): boolean {\n const name = propertyName.trim().toLowerCase()\n if (name.startsWith(\"--\")) return false\n return DS2_SKIN_DENIED_PROPERTIES.some((entry) => name === entry || name.startsWith(`${entry}-`))\n}\n\n/**\n * 在一段 CSS 文本里找出第一处命中属性维度禁覆盖清单的声明。\n * 只在「声明位置」匹配(块首/`;`/`{` 之后的标识符 + `:`),选择器与值里的同名词不算。\n */\nexport function findDs2DeniedCssProperty(css: string): string | null {\n const declaration = /(?:^|[{;])\\s*(-{0,2}[a-z][a-z0-9-]*)\\s*:/gi\n let match: RegExpExecArray | null = declaration.exec(css)\n while (match) {\n const property = match[1] ?? \"\"\n if (isDs2SkinDeniedProperty(property)) return property.toLowerCase()\n match = declaration.exec(css)\n }\n return null\n}\n\n/**\n * 值维度禁覆盖(DS2 判据 7「品牌外渐变一律清除」)。\n *\n * 校验脚本不得复制该规则,统一委托 parseOrbitworkSkin。\n *\n * 为什么不是往 DS2_SKIN_DENIED_PROPERTIES 里加 `background`:皮肤本来就该能改底色,\n * 按属性名封会把整类合法覆盖一起封掉。要拦的是**值的形态**——任何 *-gradient()。\n * R2 之前这一层完全没有:glass.ts 的 `body { background: linear-gradient(135deg,\n * rgba(59,130,246,.1), rgba(139,92,246,.1)) }`(V1 蓝紫)是整份皮肤里唯二穿过闸口的\n * 块之一;cyberpunk.ts 的 `userBubbleBackground: \"linear-gradient(135deg,#E91E63,#9C27B0)\"`\n * 更是走 mode token 直接落到用户气泡上——两条路都得拦。\n */\nexport const DS2_SKIN_DENIED_VALUE_PATTERNS = [\"-gradient(\"] as const\n\n/** 判断某个 CSS 值是否命中值维度禁覆盖(渐变)。 */\nexport function isDs2SkinDeniedValue(value: string): boolean {\n const v = value.toLowerCase()\n return DS2_SKIN_DENIED_VALUE_PATTERNS.some((entry) => v.includes(entry))\n}\n\n/**\n * 在一段 CSS 文本里找出第一处命中值维度禁覆盖的声明值。\n * 只看声明的**值**侧,选择器与注释里的同名词不算(调用方已剥注释)。\n */\nexport function findDs2DeniedCssValue(css: string): string | null {\n const declaration = /(?:^|[{;])\\s*-{0,2}[a-z][a-z0-9-]*\\s*:([^;{}]*)/gi\n let match: RegExpExecArray | null = declaration.exec(css)\n while (match) {\n const value = match[1] ?? \"\"\n if (isDs2SkinDeniedValue(value)) {\n const hit = /[a-z-]*-gradient\\(/i.exec(value)\n return hit ? hit[0].slice(0, -1) : \"gradient\"\n }\n match = declaration.exec(css)\n }\n return null\n}\n\n/** Brand-locked component roots that precision styles cannot target. */\nexport const DS2_LOCKED_SLOT_SELECTORS = [\"beacon-spinner\", \"orbitwork-mark\", \"orbitwork-lockup\"] as const\n\nexport const MAX_ORBITWORK_SKIN_CSS_BYTES = 256 * 1024\n\n/**\n * Exact precision-style surface maintained by Orbitwork UI.\n * A data-slot/data-ow-part attribute is not skin-public unless it appears here.\n * Each target also owns its allowed visual properties so skins cannot turn a\n * stable selector into an undocumented layout or behavior override.\n */\nexport const ORBITWORK_SKIN_PUBLIC_PARTS = Object.freeze({\n '[data-slot=\"artifact-preview-card\"] [data-ow-part=\"meta\"]': Object.freeze([\"color\", \"font-weight\"]),\n} as const)\n\n/** One shared DS2 verdict for both import-time rejection and apply-time defence. */\nexport function findDs2SkinCssViolation(css: string): string | null {\n for (const slot of DS2_LOCKED_SLOT_SELECTORS) {\n if (css.includes(slot)) return `锁定件选择器 \"${slot}\"`\n }\n const tokenNames = css.match(/--ow-[a-z0-9-]+/gi) ?? []\n for (const tokenName of tokenNames) {\n if (isDs2SkinDeniedToken(tokenName)) return `禁覆盖 token ${tokenName}`\n }\n const property = findDs2DeniedCssProperty(css)\n if (property) return `禁覆盖 CSS 属性 ${property}`\n const gradient = findDs2DeniedCssValue(css)\n if (gradient) return `禁覆盖值形态 ${gradient}()`\n return null\n}\n\n/** 判断某个 CSS 自定义属性名是否命中 DS2 禁覆盖清单。 */\nexport function isDs2SkinDeniedToken(tokenName: string): boolean {\n const name = tokenName.trim()\n return DS2_SKIN_DENYLIST.some((entry) =>\n entry.endsWith(\"*\") ? name.startsWith(entry.slice(0, -1)) : name === entry || name.startsWith(`${entry}-`),\n )\n}\n\n/** WCAG 2.x 相对亮度 → 对比度实算(输入为 3/4/6/8 位 hex;alpha 忽略,按不透明计算)。 */\nexport function ds2ContrastRatio(hexA: string, hexB: string): number {\n const la = relativeLuminance(hexA)\n const lb = relativeLuminance(hexB)\n const lighter = Math.max(la, lb)\n const darker = Math.min(la, lb)\n return (lighter + 0.05) / (darker + 0.05)\n}\n\nfunction relativeLuminance(hex: string): number {\n const [r, g, b] = hexToRgb(hex)\n const toLinear = (channel: number) => {\n const c = channel / 255\n return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n }\n return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b)\n}\n\nfunction hexToRgb(hex: string): [number, number, number] {\n let value = hex.replace(/^#/, \"\")\n if (value.length === 3 || value.length === 4) {\n value = value\n .slice(0, 3)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n }\n return [\n Number.parseInt(value.slice(0, 2), 16),\n Number.parseInt(value.slice(2, 4), 16),\n Number.parseInt(value.slice(4, 6), 16),\n ]\n}\n\n/** 中性梯度整组闸:命中任一触发键即要求整组提交并过对比度实算。 */\nconst NEUTRAL_TRIGGER_KEYS = [\n \"backgroundPrimary\",\n \"backgroundSecondary\",\n \"backgroundTertiary\",\n \"foregroundPrimary\",\n \"foregroundSecondary\",\n \"foregroundMuted\",\n] as const\nconst NEUTRAL_REQUIRED_KEYS = [\n \"backgroundPrimary\",\n \"backgroundSecondary\",\n \"backgroundTertiary\",\n \"foregroundPrimary\",\n \"foregroundSecondary\",\n \"foregroundMuted\",\n \"borderSubtle\",\n \"borderStrong\",\n] as const\nconst NEUTRAL_CONTRAST_PAIRS: ReadonlyArray<readonly [keyof OrbitworkSkinTokens, keyof OrbitworkSkinTokens]> = [\n [\"foregroundPrimary\", \"backgroundPrimary\"],\n [\"foregroundPrimary\", \"backgroundSecondary\"],\n [\"foregroundPrimary\", \"backgroundTertiary\"],\n [\"foregroundSecondary\", \"backgroundPrimary\"],\n [\"foregroundSecondary\", \"backgroundSecondary\"],\n [\"foregroundSecondary\", \"backgroundTertiary\"],\n [\"foregroundMuted\", \"backgroundPrimary\"],\n [\"foregroundMuted\", \"backgroundSecondary\"],\n [\"foregroundMuted\", \"backgroundTertiary\"],\n]\nconst MIN_NEUTRAL_CONTRAST = 4.5\n\n/** 闸 (a):覆盖项落点命中禁覆盖清单即拒绝(白名单收敛后属兜底防线)。 */\nfunction assertTokensNotDenied(tokens: OrbitworkSkinTokens, path: string): void {\n for (const [key, value] of Object.entries(tokens)) {\n const cssVar = ORBITWORK_SKIN_CSS_VARIABLES[key as keyof OrbitworkSkinTokens]\n if (cssVar && isDs2SkinDeniedToken(cssVar)) {\n throw new Error(`${path}.${key} 的落点 ${cssVar} 命中 DS2 禁覆盖清单,拒绝该皮肤`)\n }\n // 值维度:token 值本身是渐变时,属性闸与 token 闸都拦不住(落点名合法、属性名合法),\n // 直接落到气泡/侧栏底上——判据 7「品牌外渐变一律清除」在这里收口。\n // chatBackgroundImage 例外:它本来就是一张图/图案的落点,由 orbitwork-skin-image 单独校验。\n if (key !== \"chatBackgroundImage\" && typeof value === \"string\" && isDs2SkinDeniedValue(value)) {\n throw new Error(`${path}.${key} 的值是渐变(${value}),DS2 判据 7 品牌外渐变一律清除,拒绝该皮肤`)\n }\n }\n}\n\n/** 闸 (b):中性梯度整组提交 + WCAG 对比度实算(text-on-bg / text-on-surface ≥ 4.5:1)。 */\nfunction assertNeutralGroupContrast(tokens: OrbitworkSkinTokens, path: string): void {\n const touched = NEUTRAL_TRIGGER_KEYS.some((key) => tokens[key] !== undefined)\n if (!touched) return\n const missing = NEUTRAL_REQUIRED_KEYS.filter((key) => tokens[key] === undefined)\n if (missing.length > 0) {\n throw new Error(`${path} 中性梯度须整组提交(text 系与 bg/surface 系同批),缺少:${missing.join(\"、\")}`)\n }\n for (const [textKey, bgKey] of NEUTRAL_CONTRAST_PAIRS) {\n const text = tokens[textKey]\n const bg = tokens[bgKey]\n if (!text || !bg) continue\n const ratio = ds2ContrastRatio(text, bg)\n if (ratio < MIN_NEUTRAL_CONTRAST) {\n throw new Error(\n `${path} 对比度不达标:${textKey}(${text}) 在 ${bgKey}(${bg}) 上为 ${ratio.toFixed(2)}:1,要求 ≥ ${MIN_NEUTRAL_CONTRAST}:1`,\n )\n }\n }\n}\n\n/** Runtime btn-primary is open, but yellow-adjacent values would impersonate the locked beacon pole. */\nexport function isNeonYellowAdjacent(value: string): boolean {\n if (!HEX_COLOR.test(value)) return false\n const [r, g, b] = hexToRgb(value)\n const max = Math.max(r, g, b) / 255\n const min = Math.min(r, g, b) / 255\n const delta = max - min\n if (delta === 0) return false\n const red = r / 255\n const green = g / 255\n const blue = b / 255\n let hue =\n max === red ? ((green - blue) / delta) % 6 : max === green ? (blue - red) / delta + 2 : (red - green) / delta + 4\n hue = (hue * 60 + 360) % 360\n const lightness = (max + min) / 2\n const saturation = delta / (1 - Math.abs(2 * lightness - 1))\n return hue >= 40 && hue <= 75 && saturation >= 0.5 && lightness >= 0.35\n}\n\nfunction assertButtonPrimary(tokens: OrbitworkSkinTokens, path: string): void {\n const background = tokens.buttonPrimaryBackground\n const foreground = tokens.buttonPrimaryForeground\n if (!background && !foreground) return\n if (!background || !foreground) throw new Error(`${path} btn-primary 须同时提交 background 与 foreground`)\n if (isNeonYellowAdjacent(background)) throw new Error(`${path}.buttonPrimaryBackground 不得使用荧黄邻近色`)\n const ratio = ds2ContrastRatio(background, foreground)\n if (ratio < 4.5) throw new Error(`${path} btn-primary 对比度为 ${ratio.toFixed(2)}:1,要求 ≥ 4.5:1`)\n}\n\nexport function hasOrbitworkSkinChatBackground(skin: OrbitworkSkin | null | undefined, mode: ResolvedTheme): boolean {\n return Boolean(skin?.modes?.[mode]?.chatBackgroundImage)\n}\n\nexport function parseOrbitworkSkin(input: unknown): SkinValidationResult {\n try {\n if (!isRecord(input)) throw new Error(\"主题必须是 JSON 对象\")\n assertKnownKeys(input, ROOT_KEYS, \"主题\")\n if (input.version !== 1) throw new Error(\"仅支持 version: 1\")\n if (typeof input.id !== \"string\" || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(input.id) || input.id.length > 64)\n throw new Error(\"id 必须是最多 64 字符的小写短横线标识\")\n if (typeof input.name !== \"string\" || !input.name.trim() || input.name.length > 48)\n throw new Error(\"name 必须是 1–48 个字符\")\n if (input.description !== undefined && (typeof input.description !== \"string\" || input.description.length > 160))\n throw new Error(\"description 最多 160 个字符\")\n if (input.fontScale !== undefined && !isOrbitworkFontScale(input.fontScale))\n throw new Error(\"fontScale 必须是 0.9、1、1.1 或 1.2\")\n if (!isRecord(input.modes)) throw new Error(\"modes 必须是对象\")\n assertKnownKeys(input.modes, MODE_KEYS, \"modes\")\n const light =\n input.modes.light === undefined ? undefined : parseTokens(input.modes.light, TOKEN_KEY_SET, \"modes.light\")\n const dark = input.modes.dark === undefined ? undefined : parseTokens(input.modes.dark, TOKEN_KEY_SET, \"modes.dark\")\n if (!light && !dark) throw new Error(\"modes 至少需要 light 或 dark\")\n\n // DS2 两道闸:禁覆盖清单拦截 + 中性梯度整组对比度实算\n if (light) {\n assertTokensNotDenied(light, \"modes.light\")\n assertNeutralGroupContrast(light, \"modes.light\")\n assertButtonPrimary(light, \"modes.light\")\n }\n if (dark) {\n assertTokensNotDenied(dark, \"modes.dark\")\n assertNeutralGroupContrast(dark, \"modes.dark\")\n assertButtonPrimary(dark, \"modes.dark\")\n }\n\n // Parse registered public-part styles.\n let contributes: OrbitworkSkin[\"contributes\"] | undefined\n if (input.contributes !== undefined) {\n if (!isRecord(input.contributes)) throw new Error(\"contributes 必须是对象\")\n assertKnownKeys(input.contributes, CONTRIBUTES_KEYS, \"contributes\")\n const publicPartStyles = input.contributes.publicPartStyles\n if (publicPartStyles !== undefined && typeof publicPartStyles !== \"string\")\n throw new Error(\"contributes.publicPartStyles 必须是字符串\")\n const registry = parseRegistry(input.contributes.registry)\n const normalizedPublicPartStyles = assertSkinContributions(publicPartStyles, registry)\n if (normalizedPublicPartStyles || registry) {\n contributes = {\n ...(normalizedPublicPartStyles ? { publicPartStyles: normalizedPublicPartStyles } : {}),\n ...(registry ? { registry } : {}),\n }\n }\n }\n\n return {\n ok: true,\n skin: {\n version: 1,\n id: input.id,\n name: input.name.trim(),\n ...(input.description ? { description: input.description.trim() } : {}),\n ...(input.fontScale !== undefined ? { fontScale: input.fontScale } : {}),\n modes: { ...(light ? { light } : {}), ...(dark ? { dark } : {}) },\n ...(contributes ? { contributes } : {}),\n },\n }\n } catch (error) {\n return { ok: false, error: error instanceof Error ? error.message : \"主题格式无效\" }\n }\n}\n\nconst PUBLIC_PART_TARGET =\n /^\\[data-slot=[\"'][a-z0-9]+(?:-[a-z0-9]+)*[\"']\\](?:\\s+(?:>\\s+)?\\[data-ow-(?:part|state|role|kind|context)=[\"'][a-z0-9]+(?:-[a-z0-9]+)*[\"']\\])*$/\n\ntype SkinCssDeclaration = { property: string; value: string }\ntype SkinCssRule = { selectors: string[]; declarations: SkinCssDeclaration[] }\n\nfunction assertSkinCssValue(property: string, value: string): void {\n if (property === \"color\" && /^var\\(--ow-text(?:-2)?\\)$/.test(value)) {\n return\n }\n if (\n property === \"font-weight\" &&\n (/^(?:[1-9]00|normal|bold)$/i.test(value) || /^var\\(--ow-font-weight-[a-z0-9-]+\\)$/i.test(value))\n )\n return\n throw new Error(`contributes.publicPartStyles 不允许 ${property} 使用值 ${value}`)\n}\n\n/**\n * Parse the deliberately tiny public-part CSS language and serialize it back\n * to one canonical representation. Comments and escapes are rejected instead\n * of being stripped: validation and browser injection must consume identical\n * semantics.\n */\nfunction cssRules(css: string): SkinCssRule[] {\n if (css.includes(\"/*\") || css.includes(\"*/\")) {\n throw new Error(\"contributes.publicPartStyles 不支持 CSS 注释\")\n }\n if (css.includes(\"\\\\\")) throw new Error(\"contributes.publicPartStyles 不支持 CSS 转义\")\n const rules: SkinCssRule[] = []\n let cursor = 0\n while (cursor < css.length) {\n while (/\\s/.test(css[cursor] ?? \"\")) cursor += 1\n if (cursor >= css.length) break\n const open = css.indexOf(\"{\", cursor)\n if (open < 0) throw new Error(\"contributes.publicPartStyles 包含不完整的 CSS 规则\")\n const close = css.indexOf(\"}\", open + 1)\n if (close < 0 || css.slice(open + 1, close).includes(\"{\")) {\n throw new Error(\"contributes.publicPartStyles 只能包含扁平 CSS 规则\")\n }\n const prelude = css.slice(cursor, open).trim()\n if (!prelude || prelude.startsWith(\"@\")) {\n throw new Error(\"contributes.publicPartStyles 不支持 @ 规则或空选择器\")\n }\n const selectors = prelude\n .split(\",\")\n .map((selector) => selector.trim())\n .filter(Boolean)\n const declarations = css\n .slice(open + 1, close)\n .split(\";\")\n .map((declaration) => declaration.trim())\n .filter(Boolean)\n .map((declaration) => {\n const separator = declaration.indexOf(\":\")\n if (separator <= 0 || !declaration.slice(separator + 1).trim()) {\n throw new Error(`contributes.publicPartStyles 包含无效声明:${declaration}`)\n }\n const property = declaration.slice(0, separator).trim().toLowerCase()\n const value = declaration.slice(separator + 1).trim()\n if (!/^[a-z][a-z-]*$/.test(property) || /[{};\"'@]/.test(value) || /!\\s*important/i.test(value)) {\n throw new Error(`contributes.publicPartStyles 包含无效声明:${declaration}`)\n }\n assertSkinCssValue(property, value)\n return { property, value }\n })\n if (declarations.length === 0) throw new Error(\"contributes.publicPartStyles 不接受空规则\")\n rules.push({ selectors, declarations })\n cursor = close + 1\n }\n if (css.trim() && rules.length === 0) throw new Error(\"contributes.publicPartStyles 没有有效规则\")\n return rules\n}\n\nexport function normalizeOrbitworkSkinPublicPartStyles(publicPartStyles: string): string {\n const path = \"contributes.publicPartStyles\"\n const publicPartCss = publicPartStyles.trim()\n if (new TextEncoder().encode(publicPartCss).byteLength > MAX_ORBITWORK_SKIN_CSS_BYTES)\n throw new Error(`${path} 不能超过 256 KiB`)\n const rules = cssRules(publicPartCss)\n for (const rule of rules) {\n for (const selector of rule.selectors) {\n if (!PUBLIC_PART_TARGET.test(selector))\n throw new Error(`${path} 只能定位 data-slot 根及其 data-ow-* public part:${selector}`)\n const allowedProperties = ORBITWORK_SKIN_PUBLIC_PARTS[selector as keyof typeof ORBITWORK_SKIN_PUBLIC_PARTS]\n if (!allowedProperties) throw new Error(`${path} 选择器不是 Orbitwork 开放的皮肤 public part:${selector}`)\n for (const { property } of rule.declarations) {\n if (!(allowedProperties as readonly string[]).includes(property)) {\n throw new Error(`${path} 不允许在 ${selector} 覆盖属性 ${property}`)\n }\n }\n }\n }\n const canonical = rules\n .map(\n ({ selectors, declarations }) =>\n `${selectors.join(\", \")} { ${declarations.map(({ property, value }) => `${property}: ${value};`).join(\" \")} }`,\n )\n .join(\"\\n\")\n const safety = analyzeSkinCSS(canonical)\n if (!safety.ok) throw new Error(`${path} 包含不安全内容:${safety.warnings.join(\";\")}`)\n const violation = findDs2SkinCssViolation(canonical)\n if (violation) throw new Error(`${path} 命中 DS2 禁覆盖:${violation}`)\n return canonical\n}\n\nfunction assertSkinContributions(\n publicPartStyles: unknown,\n registry: OrbitworkSkinRegistryEntry[] | undefined,\n): string | undefined {\n const publicPartCss = typeof publicPartStyles === \"string\" ? publicPartStyles.trim() : \"\"\n const hasCss = publicPartCss.length > 0\n\n if (hasCss && !registry?.length) throw new Error(\"contributes.publicPartStyles 必须提供 registry 登记\")\n if (!hasCss && registry?.length) throw new Error(\"contributes.registry 不能脱离 publicPartStyles 单独存在\")\n if (!hasCss || !registry) return undefined\n\n const normalized = normalizeOrbitworkSkinPublicPartStyles(publicPartCss)\n const rules = cssRules(normalized)\n const selectors = rules.flatMap((rule) => rule.selectors)\n const registeredTargets = new Set(registry.map((entry) => entry.target))\n for (const rule of rules) {\n for (const selector of rule.selectors) {\n if (!registeredTargets.has(selector)) throw new Error(`contributes.publicPartStyles 选择器未登记:${selector}`)\n }\n }\n const selectorSet = new Set(selectors)\n for (const entry of registry) {\n if (!selectorSet.has(entry.target)) throw new Error(`contributes.registry target 未出现在 CSS:${entry.target}`)\n }\n return normalized\n}\n\nfunction parseTokens(input: unknown, allowed: Set<string>, path: string): OrbitworkSkinTokens {\n if (!isRecord(input)) throw new Error(`${path} 必须是对象`)\n assertKnownKeys(input, allowed, path)\n const result: OrbitworkSkinTokens = {}\n for (const [key, value] of Object.entries(input)) {\n if (typeof value !== \"string\") throw new Error(`${path}.${key} 必须是字符串`)\n if (COLOR_KEYS.includes(key as (typeof COLOR_KEYS)[number])) {\n if (!HEX_COLOR.test(value)) throw new Error(`${path}.${key} 必须是十六进制颜色`)\n ;(result as Record<string, string>)[key] = value.toLowerCase()\n } else if (MASK_COLOR_KEYS.includes(key as (typeof MASK_COLOR_KEYS)[number])) {\n if (!MASK_HEX_COLOR.test(value)) throw new Error(`${path}.${key} 必须是六位或八位十六进制颜色`)\n ;(result as Record<string, string>)[key] = value.toLowerCase()\n } else if (IMAGE_KEYS.includes(key as (typeof IMAGE_KEYS)[number])) {\n assertSafeDataImage(value, `${path}.${key}`)\n ;(result as Record<string, string>)[key] = value\n } else if (OPACITY_KEYS.includes(key as (typeof OPACITY_KEYS)[number])) {\n const opacity = Number(value)\n if (!/^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$/.test(value) || !Number.isFinite(opacity) || opacity < 0 || opacity > 1) {\n throw new Error(`${path}.${key} 必须是 0–1 之间的十进制字符串`)\n }\n ;(result as Record<string, string>)[key] = String(opacity)\n } else if (POSITION_KEYS.includes(key as (typeof POSITION_KEYS)[number])) {\n const normalized = value.toLowerCase()\n if (!BACKGROUND_POSITIONS.has(normalized)) throw new Error(`${path}.${key} 不是支持的背景位置`)\n ;(result as Record<string, string>)[key] = normalized\n } else if (SIZE_KEYS.includes(key as (typeof SIZE_KEYS)[number])) {\n const normalized = value.toLowerCase()\n if (!BACKGROUND_SIZES.has(normalized)) throw new Error(`${path}.${key} 不是支持的背景尺寸`)\n ;(result as Record<string, string>)[key] = normalized\n } else {\n throw new Error(`${path} 包含不支持的字段:${key}`)\n }\n }\n return result\n}\n\nfunction parseRegistry(input: unknown): OrbitworkSkinRegistryEntry[] | undefined {\n if (input === undefined) return undefined\n if (!Array.isArray(input)) throw new Error(\"contributes.registry 必须是数组\")\n if (input.length === 0) return undefined\n const result = input.map((entry, index) => {\n if (!isRecord(entry)) throw new Error(`contributes.registry[${index}] 必须是 { target, reason } 对象`)\n assertKnownKeys(entry, REGISTRY_ENTRY_KEYS, `contributes.registry[${index}]`)\n const { target, reason } = entry\n if (typeof target !== \"string\" || !target.trim() || target.length > 200)\n throw new Error(`contributes.registry[${index}].target 必须是 1–200 字符的字符串`)\n if (typeof reason !== \"string\" || !reason.trim() || reason.length > 200)\n throw new Error(`contributes.registry[${index}].reason 必须是 1–200 字符的字符串`)\n return { target: target.trim(), reason: reason.trim() }\n })\n const duplicate = result.find(\n (entry, index) => result.findIndex((candidate) => candidate.target === entry.target) !== index,\n )\n if (duplicate) throw new Error(`contributes.registry target 重复:${duplicate.target}`)\n return result\n}\n\nfunction assertSafeDataImage(value: string, path: string): void {\n const match = DATA_IMAGE.exec(value)\n if (!match) throw new Error(`${path} 必须是 PNG、JPEG 或 WebP 的 base64 data URL`)\n const format = match[1]\n const payload = match[2]\n if (!format || !payload) throw new Error(`${path} 包含无效的图片数据`)\n if (payload.length % 4 !== 0) throw new Error(`${path} 包含无效的 base64 数据`)\n const padding = payload.endsWith(\"==\") ? 2 : payload.endsWith(\"=\") ? 1 : 0\n const decodedBytes = (payload.length / 4) * 3 - padding\n if (decodedBytes > MAX_ORBITWORK_SKIN_IMAGE_BYTES) throw new Error(`${path} 解码后不能超过 5 MiB`)\n let bytes: number[]\n try {\n const decoded = globalThis.atob(payload)\n bytes = Array.from(decoded.slice(0, 12), (char) => char.charCodeAt(0))\n } catch {\n throw new Error(`${path} 包含无效的 base64 数据`)\n }\n const validMagic =\n format === \"png\"\n ? [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a].every((byte, index) => bytes[index] === byte)\n : format === \"jpeg\"\n ? bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff\n : bytes[0] === 0x52 &&\n bytes[1] === 0x49 &&\n bytes[2] === 0x46 &&\n bytes[3] === 0x46 &&\n bytes[8] === 0x57 &&\n bytes[9] === 0x45 &&\n bytes[10] === 0x42 &&\n bytes[11] === 0x50\n if (!validMagic) throw new Error(`${path} 的内容与图片格式不匹配`)\n}\n\n/** Convert a validated embedded image into a CSS value without accepting arbitrary CSS or URLs. */\nexport function orbitworkSkinImageCssValue(value: string | undefined): string | undefined {\n if (!value) return undefined\n try {\n assertSafeDataImage(value, \"chatBackgroundImage\")\n return `url(\"${value}\")`\n } catch {\n return undefined\n }\n}\n\nexport function assertKnownKeys(value: Record<string, unknown>, allowed: Set<string>, path: string) {\n const unknown = Object.keys(value).find((key) => !allowed.has(key))\n if (unknown) throw new Error(`${path} 包含不支持的字段:${unknown}`)\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n}\n","import type { OrbitworkSkin, OrbitworkSkinTokens } from \"../core/skin.ts\"\n\ntype CompleteModeInput = {\n backgroundPrimary: string\n backgroundSecondary: string\n backgroundTertiary: string\n foregroundPrimary: string\n foregroundSecondary: string\n borderSubtle: string\n borderStrong: string\n buttonPrimaryBackground?: string\n buttonPrimaryForeground?: string\n}\n\n/** Give every built-in palette real component coverage instead of changing only the page canvas. */\nfunction completeMode(input: CompleteModeInput): OrbitworkSkinTokens {\n return {\n ...input,\n foregroundMuted: input.foregroundSecondary,\n chatBackground: input.backgroundPrimary,\n userBubbleBackground: input.backgroundTertiary,\n userBubbleForeground: input.foregroundPrimary,\n userBubbleBorder: input.borderStrong,\n composerBackground: input.backgroundSecondary,\n composerBorder: input.borderStrong,\n sidebarBackground: input.backgroundSecondary,\n sidebarSelectedBackground: input.backgroundTertiary,\n }\n}\n\n/**\n * Codex-inspired defaults mapped from the user-exported `codex-theme-v1` light/dark\n * configurations. `surface`, `ink`, and `contrast` own this neutral palette;\n * primary buttons inherit the same defaults as Warm Beige.\n * Codex-only font/window/functional-color fields stay outside the personal-skin contract.\n */\nexport const codex: OrbitworkSkin = {\n version: 1,\n id: \"codex\",\n name: \"Normal\",\n description: \"高对比中性工作空间\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#ffffff\",\n backgroundSecondary: \"#f5f5f5\",\n backgroundTertiary: \"#ebebeb\",\n foregroundPrimary: \"#000000\",\n foregroundSecondary: \"#525252\",\n borderSubtle: \"#dedede\",\n borderStrong: \"#b8b8b8\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#1f1f24\",\n backgroundSecondary: \"#29292e\",\n backgroundTertiary: \"#333339\",\n foregroundPrimary: \"#ffffff\",\n foregroundSecondary: \"#b7b7c0\",\n borderSubtle: \"#3f3f46\",\n borderStrong: \"#676771\",\n }),\n },\n}\n\nexport const DEFAULT_ORBITWORK_SKIN_ID = \"codex\" as const\n\n/** The former unskinned DS2 palette, retained as the second built-in choice. */\nexport const warmBeige: OrbitworkSkin = {\n version: 1,\n id: \"warm-beige\",\n name: \"Warm Beige\",\n description: \"Orbitwork 原始的海军蓝与暖灰语义配色\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#f7f6f1\",\n backgroundSecondary: \"#fdfdfc\",\n backgroundTertiary: \"#f1f0ea\",\n foregroundPrimary: \"#333b50\",\n foregroundSecondary: \"#646b7a\",\n borderSubtle: \"#dcdcd7\",\n borderStrong: \"#c2c3c1\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#16171b\",\n backgroundSecondary: \"#1e2025\",\n backgroundTertiary: \"#23252b\",\n foregroundPrimary: \"#ecebe5\",\n foregroundSecondary: \"#92969d\",\n borderSubtle: \"#2a2c33\",\n borderStrong: \"#3f434d\",\n }),\n },\n}\n\nexport const aurora: OrbitworkSkin = {\n version: 1,\n id: \"aurora\",\n name: \"Aurora\",\n description: \"柔和紫色强调与微暖背景\",\n modes: {\n light: {\n backgroundPrimary: \"#fdfcff\",\n backgroundSecondary: \"#f8f5ff\",\n backgroundTertiary: \"#f1ecfb\",\n foregroundPrimary: \"#1d1a26\",\n foregroundSecondary: \"#4c4560\",\n foregroundMuted: \"#4c4560\",\n borderSubtle: \"#ded8ea\",\n borderStrong: \"#c4b5fd\",\n buttonPrimaryBackground: \"#7c3aed\",\n buttonPrimaryForeground: \"#ffffff\",\n chatBackground: \"#fdfcff\",\n userBubbleBackground: \"#f1ecfb\",\n userBubbleForeground: \"#1d1a26\",\n userBubbleBorder: \"#c4b5fd\",\n composerBackground: \"#f8f5ff\",\n composerBorder: \"#c4b5fd\",\n sidebarBackground: \"#f8f5ff\",\n sidebarSelectedBackground: \"#f1ecfb\",\n },\n dark: {\n backgroundPrimary: \"#17141d\",\n backgroundSecondary: \"#201b29\",\n backgroundTertiary: \"#2a2335\",\n foregroundPrimary: \"#eae6f2\",\n foregroundSecondary: \"#b3abc6\",\n foregroundMuted: \"#b3abc6\",\n borderSubtle: \"#393146\",\n borderStrong: \"#6d4aa5\",\n buttonPrimaryBackground: \"#a78bfa\",\n buttonPrimaryForeground: \"#17141d\",\n chatBackground: \"#17141d\",\n userBubbleBackground: \"#2a2335\",\n userBubbleForeground: \"#eae6f2\",\n userBubbleBorder: \"#6d4aa5\",\n composerBackground: \"#201b29\",\n composerBorder: \"#6d4aa5\",\n sidebarBackground: \"#201b29\",\n sidebarSelectedBackground: \"#2a2335\",\n },\n },\n}\n\nexport const forest: OrbitworkSkin = {\n version: 1,\n id: \"forest\",\n name: \"Forest\",\n description: \"克制自然的绿色工作空间\",\n modes: {\n light: {\n backgroundPrimary: \"#fbfdfb\",\n backgroundSecondary: \"#f3f8f5\",\n backgroundTertiary: \"#e9f1ec\",\n foregroundPrimary: \"#16211b\",\n foregroundSecondary: \"#3f5248\",\n foregroundMuted: \"#3f5248\",\n borderSubtle: \"#d6e1da\",\n borderStrong: \"#98d8be\",\n buttonPrimaryBackground: \"#16805b\",\n buttonPrimaryForeground: \"#ffffff\",\n chatBackground: \"#fbfdfb\",\n userBubbleBackground: \"#e9f1ec\",\n userBubbleForeground: \"#16211b\",\n userBubbleBorder: \"#98d8be\",\n composerBackground: \"#f3f8f5\",\n composerBorder: \"#98d8be\",\n sidebarBackground: \"#f3f8f5\",\n sidebarSelectedBackground: \"#e9f1ec\",\n },\n dark: {\n backgroundPrimary: \"#111916\",\n backgroundSecondary: \"#17231e\",\n backgroundTertiary: \"#1e2e27\",\n foregroundPrimary: \"#e4efe8\",\n foregroundSecondary: \"#a7bcb0\",\n foregroundMuted: \"#a7bcb0\",\n borderSubtle: \"#314139\",\n borderStrong: \"#28664f\",\n buttonPrimaryBackground: \"#55d6a0\",\n buttonPrimaryForeground: \"#111916\",\n chatBackground: \"#111916\",\n userBubbleBackground: \"#1e2e27\",\n userBubbleForeground: \"#e4efe8\",\n userBubbleBorder: \"#28664f\",\n composerBackground: \"#17231e\",\n composerBorder: \"#28664f\",\n sidebarBackground: \"#17231e\",\n sidebarSelectedBackground: \"#1e2e27\",\n },\n },\n}\n\n/*\n * Adapted from Craft Agents OSS's MIT-licensed built-in themes. Source attribution stays beside\n * the palettes so future updates preserve provenance:\n * https://github.com/craft-ai-agents/craft-agents-oss/tree/main/apps/electron/resources/themes\n */\nexport const catppuccin: OrbitworkSkin = {\n version: 1,\n id: \"catppuccin\",\n name: \"Catppuccin\",\n description: \"柔和的粉彩色调,适合长时间阅读\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#eff1f5\",\n backgroundSecondary: \"#e6e9ef\",\n backgroundTertiary: \"#dce0e8\",\n foregroundPrimary: \"#4c4f69\",\n foregroundSecondary: \"#565a75\",\n borderSubtle: \"#ccd0da\",\n borderStrong: \"#9ca0b0\",\n buttonPrimaryBackground: \"#8839ef\",\n buttonPrimaryForeground: \"#ffffff\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#1e1e2e\",\n backgroundSecondary: \"#181825\",\n backgroundTertiary: \"#313244\",\n foregroundPrimary: \"#cdd6f4\",\n foregroundSecondary: \"#bac2de\",\n borderSubtle: \"#45475a\",\n borderStrong: \"#6c7086\",\n buttonPrimaryBackground: \"#cba6f7\",\n buttonPrimaryForeground: \"#1e1e2e\",\n }),\n },\n}\n\nexport const gruvbox: OrbitworkSkin = {\n version: 1,\n id: \"gruvbox\",\n name: \"Gruvbox\",\n description: \"复古而温暖的泥土色工作空间\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#fbf1c7\",\n backgroundSecondary: \"#ebdbb2\",\n backgroundTertiary: \"#d5c4a1\",\n foregroundPrimary: \"#3c3836\",\n foregroundSecondary: \"#504945\",\n borderSubtle: \"#bdae93\",\n borderStrong: \"#928374\",\n buttonPrimaryBackground: \"#458588\",\n buttonPrimaryForeground: \"#000000\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#282828\",\n backgroundSecondary: \"#32302f\",\n backgroundTertiary: \"#3c3836\",\n foregroundPrimary: \"#ebdbb2\",\n foregroundSecondary: \"#d5c4a1\",\n borderSubtle: \"#504945\",\n borderStrong: \"#665c54\",\n buttonPrimaryBackground: \"#83a598\",\n buttonPrimaryForeground: \"#282828\",\n }),\n },\n}\n\nexport const nord: OrbitworkSkin = {\n version: 1,\n id: \"nord\",\n name: \"Nord\",\n description: \"冷静克制的北境蓝灰色调\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#eceff4\",\n backgroundSecondary: \"#e5e9f0\",\n backgroundTertiary: \"#d8dee9\",\n foregroundPrimary: \"#2e3440\",\n foregroundSecondary: \"#3b4252\",\n borderSubtle: \"#c2c9d4\",\n borderStrong: \"#8f99a9\",\n buttonPrimaryBackground: \"#5e81ac\",\n buttonPrimaryForeground: \"#000000\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#2e3440\",\n backgroundSecondary: \"#3b4252\",\n backgroundTertiary: \"#434c5e\",\n foregroundPrimary: \"#eceff4\",\n foregroundSecondary: \"#d8dee9\",\n borderSubtle: \"#4c566a\",\n borderStrong: \"#60708a\",\n buttonPrimaryBackground: \"#88c0d0\",\n buttonPrimaryForeground: \"#2e3440\",\n }),\n },\n}\n\nexport const oneDarkPro: OrbitworkSkin = {\n version: 1,\n id: \"one-dark-pro\",\n name: \"One Dark Pro\",\n description: \"均衡清晰的 Atom 风格配色\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#fafafa\",\n backgroundSecondary: \"#f0f0f0\",\n backgroundTertiary: \"#e5e5e6\",\n foregroundPrimary: \"#383a42\",\n foregroundSecondary: \"#4f525d\",\n borderSubtle: \"#d0d0d1\",\n borderStrong: \"#a0a1a7\",\n buttonPrimaryBackground: \"#4078f2\",\n buttonPrimaryForeground: \"#000000\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#282c34\",\n backgroundSecondary: \"#21252b\",\n backgroundTertiary: \"#2f343f\",\n foregroundPrimary: \"#abb2bf\",\n foregroundSecondary: \"#c8ccd4\",\n borderSubtle: \"#3e4451\",\n borderStrong: \"#5c6370\",\n buttonPrimaryBackground: \"#61afef\",\n buttonPrimaryForeground: \"#20232a\",\n }),\n },\n}\n\nexport const rosePine: OrbitworkSkin = {\n version: 1,\n id: \"rose-pine\",\n name: \"Rosé Pine\",\n description: \"温暖优雅的玫瑰灰紫色调\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#faf4ed\",\n backgroundSecondary: \"#fffaf3\",\n backgroundTertiary: \"#f2e9e1\",\n foregroundPrimary: \"#575279\",\n foregroundSecondary: \"#625d82\",\n borderSubtle: \"#dfdad9\",\n borderStrong: \"#9893a5\",\n buttonPrimaryBackground: \"#907aa9\",\n buttonPrimaryForeground: \"#191724\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#191724\",\n backgroundSecondary: \"#1f1d2e\",\n backgroundTertiary: \"#26233a\",\n foregroundPrimary: \"#e0def4\",\n foregroundSecondary: \"#c4a7e7\",\n borderSubtle: \"#403d52\",\n borderStrong: \"#6e6a86\",\n buttonPrimaryBackground: \"#c4a7e7\",\n buttonPrimaryForeground: \"#191724\",\n }),\n },\n}\n\nexport const solarized: OrbitworkSkin = {\n version: 1,\n id: \"solarized\",\n name: \"Solarized\",\n description: \"低疲劳、精确平衡的经典配色\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#fdf6e3\",\n backgroundSecondary: \"#eee8d5\",\n backgroundTertiary: \"#e4ddc7\",\n foregroundPrimary: \"#4b626a\",\n foregroundSecondary: \"#455b62\",\n borderSubtle: \"#d3cbb7\",\n borderStrong: \"#93a1a1\",\n buttonPrimaryBackground: \"#268bd2\",\n buttonPrimaryForeground: \"#001f27\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#002b36\",\n backgroundSecondary: \"#073642\",\n backgroundTertiary: \"#0b4654\",\n foregroundPrimary: \"#eee8d5\",\n foregroundSecondary: \"#d5d1c4\",\n borderSubtle: \"#23515d\",\n borderStrong: \"#586e75\",\n buttonPrimaryBackground: \"#268bd2\",\n buttonPrimaryForeground: \"#001f27\",\n }),\n },\n}\n\nexport const BUILTIN_ORBITWORK_SKINS = [\n codex,\n warmBeige,\n aurora,\n forest,\n catppuccin,\n gruvbox,\n nord,\n oneDarkPro,\n rosePine,\n solarized,\n] as const\n","import type { ResolvedTheme } from \"./skin.ts\"\n\n/** Runtime layers may override only this complete neutral group. */\nexport const TENANT_THEME_COLOR_KEYS = [\n \"bg\",\n \"surface\",\n \"surface2\",\n \"text\",\n \"text2\",\n \"text3\",\n \"border\",\n \"borderStrong\",\n] as const\n\nexport type TenantThemeColors = Record<(typeof TENANT_THEME_COLOR_KEYS)[number], string>\n\n/** Localized brand copy. Assets stay outside locale buckets. */\nexport type TenantBranding = {\n productName: string\n companyName: string\n claim?: string\n claimNote?: string\n slogan?: string\n}\n\nexport type LocalizedBranding = Record<string, TenantBranding>\n\n/**\n * GET /api/v1/tenant/theme response.\n *\n * Every supplied mode is a complete neutral group. Keeping light and dark\n * separate prevents a runtime :root override from leaking one palette into\n * both DS2 modes.\n */\nexport type TenantTheme = {\n name: string\n /** Brand image. Empty string means fall through to the host/brand layer. */\n logo: string\n favicon?: string\n modes: Partial<Record<ResolvedTheme, TenantThemeColors>>\n typography: {\n fontSans: string\n fontMono: string\n }\n /** en-US is the required baseline; other locale buckets are optional. */\n branding: LocalizedBranding\n}\n\nexport const UNIFIED_NEUTRAL_TOKENS = [\n \"--ow-bg\",\n \"--ow-surface\",\n \"--ow-surface-2\",\n \"--ow-text\",\n \"--ow-text-2\",\n \"--ow-text-3\",\n \"--ow-border\",\n \"--ow-border-strong\",\n] as const\n\nexport const BRAND_ACTION_TOKENS = [\n \"--ow-btn-primary-bg\",\n \"--ow-btn-primary-hover\",\n \"--ow-btn-primary-press\",\n \"--ow-btn-primary-fg\",\n \"--ow-beacon\",\n \"--ow-beacon-idle\",\n \"--ow-accent-dot\",\n \"--ow-data-today\",\n] as const\n\nexport const UNIFIED_TYPOGRAPHY_TOKENS = [\"--ow-font-sans\", \"--ow-font-mono\"] as const\n\nexport type UnifiedNeutralToken = (typeof UNIFIED_NEUTRAL_TOKENS)[number]\nexport type BrandActionToken = (typeof BRAND_ACTION_TOKENS)[number]\nexport type BrandThemeToken = UnifiedNeutralToken | BrandActionToken\nexport type UnifiedTypographyToken = (typeof UNIFIED_TYPOGRAPHY_TOKENS)[number]\nexport type UnifiedThemeToken = BrandThemeToken | UnifiedTypographyToken\n\n/** Build-time validated OEM brand input consumed by the UI merge layer. */\nexport type BrandTheme = {\n id: string\n logo?: string\n favicon?: string\n modes: Partial<Record<ResolvedTheme, Partial<Record<BrandThemeToken, string>>>>\n typography?: {\n fontSans: string\n fontMono: string\n }\n branding?: LocalizedBranding\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tokens/base.ts","../src/theme/core/fontScale.ts","../src/theme/utils/cssSafety.ts","../src/theme/core/skin.ts","../src/theme/skins/index.ts","../src/theme/core/types.ts"],"sourcesContent":["/**\n * Orbitwork Design System — Primitive tokens.\n *\n * Theme-invariant foundation scales consumed by the CSS generator. Component\n * and layout measurements live in metrics.ts; theme semantics live in the\n * light/dark modules.\n */\n\nexport const primitive = {\n // Core brand colors\n navy: \"#0F1B3D\",\n yellow: \"#FFD23E\",\n yellowDeep: \"#D8A300\",\n white: \"#F7F6F1\",\n graphite: \"#16171B\",\n graphiteRaised: \"#1E2025\",\n graphiteBorder: \"#2A2C33\",\n\n // Theme-invariant brand lockup palette.\n brand: {\n dividerLight: \"#D8D5CC\",\n dividerDark: \"var(--ow-gray-70)\",\n cnLight: \"#3A3E46\",\n cnDark: \"#C9CBD1\",\n },\n\n // Grayscale 00-90: warm white to navy\n gray: {\n \"00\": \"#F7F6F1\",\n \"05\": \"#ECEBE5\",\n \"10\": \"#DCDCD7\",\n \"20\": \"#C2C3C1\",\n \"30\": \"#A2A5A9\",\n \"40\": \"#82878F\",\n \"50\": \"#646B7A\",\n \"60\": \"#4A5164\",\n \"70\": \"#333B50\",\n \"80\": \"#202942\",\n \"90\": \"#0F1B3D\",\n },\n\n // Spacing — Orbitwork DS standard scale\n space: {\n \"05\": \"2px\",\n \"1\": \"4px\",\n \"15\": \"6px\",\n \"2\": \"8px\",\n \"3\": \"12px\",\n \"4\": \"16px\",\n \"5\": \"20px\",\n \"6\": \"24px\",\n \"8\": \"32px\",\n \"10\": \"40px\",\n \"12\": \"48px\",\n \"16\": \"64px\",\n \"24\": \"96px\",\n },\n\n // Radius\n radius: {\n \"2xs\": \"4px\",\n xs: \"6px\",\n sm: \"8px\",\n md: \"10px\",\n lg: \"12px\",\n xl: \"16px\",\n pill: \"999px\",\n },\n\n // Typography — fonts\n fontDisplay: \"'Space Grotesk', 'HarmonyOS Sans SC', 'Noto Sans SC', sans-serif\",\n fontSans:\n \"'HarmonyOS Sans SC', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'\",\n fontMono:\n \"'IBM Plex Mono', ui-monospace, 'SF Mono', monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'\",\n\n // Type scale\n fsDisplay: \"46px\",\n fsHeadline: \"32px\",\n fsTitle: \"22px\",\n fsSubtitle: \"16px\",\n fsBody: \"14px\",\n fsCaption: \"12px\",\n fsEyebrow: \"11px\",\n fsUi: \"13px\",\n fsCode: \"13px\",\n fsEyebrowCjk: \"12px\",\n // Extended type scale\n fsHeadlineLg: \"34px\",\n fsHeadlineMd: \"27px\",\n fsHeadlineSm: \"22px\",\n fsTitleLg: \"19px\",\n fsTitleMd: \"16px\",\n fsTitleSm: \"14px\",\n fsBodyLg: \"16px\",\n fsBodyMd: \"14px\",\n fsBodySm: \"12px\",\n fsMarkMd: \"11px\",\n fsMarkSm: \"10px\",\n\n // Line heights\n lhHeadline: \"1.15\",\n lhTitle: \"1.3\",\n lhBody: \"1.75\",\n lhUi: \"1.5\",\n lhCode: \"1.7\",\n\n // Letter spacing\n lsTitle: \"0.01em\",\n lsEyebrow: \"0.14em\",\n lsEyebrowCjk: \"0.08em\",\n\n // Motion\n easeBeacon: \"cubic-bezier(0.22, 1, 0.36, 1)\",\n dur1: \"120ms\",\n dur2: \"200ms\",\n dur3: \"320ms\",\n durSpin: \"1.6s\",\n durSpinFast: \"0.9s\",\n durSplash: \"1250ms\",\n staggerBeacon: \"125ms\",\n\n // Font weight\n fontWeightNormal: \"400\",\n fontWeightMedium: \"500\",\n fontWeightSemibold: \"600\",\n fontWeightBold: \"700\",\n\n // Border width\n borderWidthThin: \"0.5px\",\n borderWidthDefault: \"1px\",\n borderWidthThick: \"2px\",\n\n // Opacity levels\n opacityMuted: \"0.6\",\n opacityHover: \"0.8\",\n} as const\n","import { primitive } from \"../../tokens/base.ts\"\n\n/** Supported text sizes, independent of the light/dark palette. */\nexport const ORBITWORK_FONT_SCALES = [0.9, 1, 1.1, 1.2] as const\nexport type OrbitworkFontScale = (typeof ORBITWORK_FONT_SCALES)[number]\n\nexport function isOrbitworkFontScale(value: unknown): value is OrbitworkFontScale {\n return typeof value === \"number\" && ORBITWORK_FONT_SCALES.some((scale) => scale === value)\n}\n\n/** Personal device preference wins over a skin preset; old settings resolve to 100%. */\nexport function resolveOrbitworkFontScale(preference: unknown, skinScale?: unknown): OrbitworkFontScale {\n return isOrbitworkFontScale(preference) ? preference : isOrbitworkFontScale(skinScale) ? skinScale : 1\n}\n\n/** Reuse the maintained DS2 scale. Never compound a previously applied size. */\nexport function fontScaleTokens(scale: OrbitworkFontScale): Record<string, string> {\n if (!isOrbitworkFontScale(scale) || scale === 1) return {}\n return Object.fromEntries(\n Object.entries(primitive)\n .filter(([key]) => /^fs[A-Z]/.test(key))\n .map(([key, value]) => [\n `--ow-${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`,\n `${Math.round(Number.parseFloat(String(value)) * scale * 100) / 100}px`,\n ]),\n )\n}\n","/** Security verdict for precision CSS before it reaches the runtime stylesheet. */\nexport interface CSSSafetyReport {\n ok: boolean\n blockedImports: number\n blockedUrls: number\n blockedScripts: number\n warnings: string[]\n}\n\n/**\n * Precision CSS is declarative styling only. Assets use dedicated validated\n * skin fields, so every import, URL and executable CSS form is rejected here.\n */\nexport function analyzeSkinCSS(css: string): CSSSafetyReport {\n const blockedImports = css.match(/@import\\b/gi)?.length ?? 0\n const blockedUrls = css.match(/url\\s*\\(/gi)?.length ?? 0\n const blockedScripts = (css.match(/javascript\\s*:/gi)?.length ?? 0) + (css.match(/expression\\s*\\(/gi)?.length ?? 0)\n const warnings: string[] = []\n\n if (blockedImports > 0) warnings.push(`检测到 ${blockedImports} 个 @import 规则`)\n if (blockedUrls > 0) warnings.push(`检测到 ${blockedUrls} 个 url() 引用`)\n if (blockedScripts > 0) warnings.push(`检测到 ${blockedScripts} 个可执行 CSS 表达式`)\n\n return {\n ok: warnings.length === 0,\n blockedImports,\n blockedUrls,\n blockedScripts,\n warnings,\n }\n}\n","/**\n * Orbitwork skin protocol — aligned with Design project architecture.\n * A skin is a validated JSON document that overrides --ow-* CSS variables\n * at runtime. This module is framework-agnostic.\n */\n\nimport { analyzeSkinCSS } from \"../utils/cssSafety.ts\"\nimport { type OrbitworkFontScale, isOrbitworkFontScale } from \"./fontScale.ts\"\n\nexport type Theme = \"light\" | \"dark\" | \"system\"\nexport type ResolvedTheme = \"light\" | \"dark\"\n\n/**\n * DS2 皮肤白名单(COMPONENT-RULES §15 · 2026-08-31 裁决):\n * - 可覆盖:中性表面/边框/文字梯度、chat/composer/sidebar 背景类、\n * btn-primary 族(唯一开放的租户品牌色位)。\n * - 已移除(禁覆盖):primary 族(--ow-primary 暗档=荧黄行动极)、link、\n * switchActive(--ow-control-on 无彩选中)、功能色四族、cardRadius/buttonRadius\n * (圆角是品牌定稿)。\n */\nexport type OrbitworkSkinTokens = {\n backgroundPrimary?: string\n backgroundSecondary?: string\n backgroundTertiary?: string\n foregroundPrimary?: string\n foregroundSecondary?: string\n foregroundMuted?: string\n borderSubtle?: string\n borderStrong?: string\n buttonPrimaryBackground?: string\n buttonPrimaryForeground?: string\n chatBackground?: string\n chatBackgroundImage?: string\n /** 0–1 decimal string; kept under the legacy chatBackground namespace for skin.json compatibility. */\n chatBackgroundImageOpacity?: string\n chatBackgroundOverlay?: string\n chatBackgroundMaskColor?: string\n chatBackgroundPosition?:\n | \"center\"\n | \"top\"\n | \"bottom\"\n | \"left\"\n | \"right\"\n | \"top left\"\n | \"top right\"\n | \"bottom left\"\n | \"bottom right\"\n chatBackgroundSize?: \"cover\" | \"contain\" | \"auto\"\n userBubbleBackground?: string\n userBubbleForeground?: string\n userBubbleBorder?: string\n composerBackground?: string\n composerBorder?: string\n sidebarBackground?: string\n sidebarSelectedBackground?: string\n}\n\n/** Maintenance record for each public-part precision selector. */\nexport type OrbitworkSkinRegistryEntry = {\n target: string\n reason: string\n}\n\nexport type OrbitworkSkin = {\n version: 1\n id: string\n name: string\n description?: string\n /** Uniform text size preset, shared by both color modes. */\n fontScale?: OrbitworkFontScale\n modes: {\n light?: OrbitworkSkinTokens\n dark?: OrbitworkSkinTokens\n }\n contributes?: {\n /** Registered CSS targeting component roots and their public parts. */\n publicPartStyles?: string\n /** Every public-part selector must have a matching maintenance record. */\n registry?: OrbitworkSkinRegistryEntry[]\n }\n}\n\nexport type SkinValidationResult = { ok: true; skin: OrbitworkSkin } | { ok: false; error: string }\n\nconst COLOR_KEYS = [\n \"backgroundPrimary\",\n \"backgroundSecondary\",\n \"backgroundTertiary\",\n \"foregroundPrimary\",\n \"foregroundSecondary\",\n \"foregroundMuted\",\n \"borderSubtle\",\n \"borderStrong\",\n \"buttonPrimaryBackground\",\n \"buttonPrimaryForeground\",\n \"chatBackground\",\n \"chatBackgroundOverlay\",\n \"userBubbleBackground\",\n \"userBubbleForeground\",\n \"userBubbleBorder\",\n \"composerBackground\",\n \"composerBorder\",\n \"sidebarBackground\",\n \"sidebarSelectedBackground\",\n] as const\nconst IMAGE_KEYS = [\"chatBackgroundImage\"] as const\nconst OPACITY_KEYS = [\"chatBackgroundImageOpacity\"] as const\nconst MASK_COLOR_KEYS = [\"chatBackgroundMaskColor\"] as const\nconst POSITION_KEYS = [\"chatBackgroundPosition\"] as const\nconst SIZE_KEYS = [\"chatBackgroundSize\"] as const\nconst TOKEN_KEYS = [\n ...COLOR_KEYS,\n ...MASK_COLOR_KEYS,\n ...IMAGE_KEYS,\n ...OPACITY_KEYS,\n ...POSITION_KEYS,\n ...SIZE_KEYS,\n] as const\nconst ROOT_KEYS = new Set([\"version\", \"id\", \"name\", \"description\", \"fontScale\", \"modes\", \"contributes\"])\nconst MODE_KEYS = new Set([\"light\", \"dark\"])\nconst TOKEN_KEY_SET = new Set<string>(TOKEN_KEYS)\nconst CONTRIBUTES_KEYS = new Set([\"publicPartStyles\", \"registry\"])\nconst REGISTRY_ENTRY_KEYS = new Set([\"target\", \"reason\"])\nexport const HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i\nconst MASK_HEX_COLOR = /^#[0-9a-f]{6}(?:[0-9a-f]{2})?$/i\nconst DATA_IMAGE = /^data:image\\/(png|jpeg|webp);base64,([A-Za-z0-9+/]+={0,2})$/\nconst BACKGROUND_POSITIONS = new Set([\n \"center\",\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n \"top left\",\n \"top right\",\n \"bottom left\",\n \"bottom right\",\n])\nconst BACKGROUND_SIZES = new Set([\"cover\", \"contain\", \"auto\"])\nexport const MAX_ORBITWORK_SKIN_IMAGE_BYTES = 5 * 1024 * 1024\nconst CHAT_BACKGROUND_MASK_DERIVED_PROPERTIES = [\n \"--ow-chat-bg-mask-start-opacity\",\n \"--ow-chat-bg-mask-end-opacity\",\n] as const\n\nexport type OrbitworkSkinChatBackgroundMask = {\n color: string\n strength: number\n startOpacity: number\n endOpacity: number\n}\n\n/** Six-digit colors retain the original 80% → 50% mask; explicit alpha controls final strength. */\nexport function resolveOrbitworkSkinChatBackgroundMask(value: string): OrbitworkSkinChatBackgroundMask {\n const normalized = MASK_HEX_COLOR.test(value) ? value.toLowerCase() : \"#000000\"\n const strength = normalized.length === 9 ? Math.round((Number.parseInt(normalized.slice(7), 16) / 255) * 100) : 80\n const startOpacity = strength\n const endOpacity = strength <= 80 ? strength * 0.625 : 50 + (strength - 80) * 2.5\n return { color: normalized.slice(0, 7), strength, startOpacity, endOpacity }\n}\n\nexport function orbitworkSkinChatBackgroundMaskColor(color: string, strength: number): string {\n const normalizedColor = /^#[0-9a-f]{6}$/i.test(color) ? color.toLowerCase() : \"#000000\"\n const alpha = Math.round((Math.min(100, Math.max(0, strength)) / 100) * 255)\n return `${normalizedColor}${alpha.toString(16).padStart(2, \"0\")}`\n}\n\nexport const ORBITWORK_SKIN_CSS_VARIABLES: Readonly<Record<keyof OrbitworkSkinTokens, string>> = {\n backgroundPrimary: \"--ow-bg\",\n backgroundSecondary: \"--ow-surface\",\n backgroundTertiary: \"--ow-surface-2\",\n foregroundPrimary: \"--ow-text\",\n foregroundSecondary: \"--ow-text-2\",\n foregroundMuted: \"--ow-text-3\",\n borderSubtle: \"--ow-border\",\n borderStrong: \"--ow-border-strong\",\n buttonPrimaryBackground: \"--ow-btn-primary-bg\",\n buttonPrimaryForeground: \"--ow-btn-primary-fg\",\n chatBackground: \"--ow-chat-bg\",\n chatBackgroundImage: \"--ow-chat-bg-image\",\n chatBackgroundImageOpacity: \"--ow-chat-bg-image-opacity\",\n chatBackgroundOverlay: \"--ow-chat-bg-overlay\",\n chatBackgroundMaskColor: \"--ow-chat-bg-mask-color\",\n chatBackgroundPosition: \"--ow-chat-bg-position\",\n chatBackgroundSize: \"--ow-chat-bg-size\",\n // 三件用户气泡钩子由 domain/chat/UserTurn 消费;未覆盖时兜底 DS2 井色配方\n // (bg=--ow-bubble-user / fg=--ow-text / border=--ow-border),不再兜底透明。\n userBubbleBackground: \"--ow-chat-user-bubble-bg\",\n userBubbleForeground: \"--ow-chat-user-bubble-fg\",\n userBubbleBorder: \"--ow-chat-user-bubble-border\",\n composerBackground: \"--ow-composer-bg\",\n composerBorder: \"--ow-composer-border\",\n sidebarBackground: \"--ow-sidebar-bg\",\n sidebarSelectedBackground: \"--ow-sidebar-selected-bg\",\n}\n\n/**\n * DS2 皮肤禁覆盖清单(COMPONENT-RULES §15 · 2026-08-31 裁决)。\n * 条目以 `*` 结尾表示前缀匹配;其余为精确名(含其 `-` 后缀派生,如\n * `--ow-control-on` 同时覆盖 `--ow-control-on-glyph`)。\n *\n * 官方 skin skill 直接调用本模块导出的 parseOrbitworkSkin,不复制这份清单。\n */\nexport const DS2_SKIN_DENYLIST = [\n // 三极 token\n \"--ow-beacon\",\n \"--ow-beacon-idle\",\n \"--ow-accent-dot\",\n \"--ow-data-today\",\n // 行动极族(租户品牌色只经 btn-primary 族开放,--ow-primary 落点不可写)\n \"--ow-primary*\",\n // 无彩选中原则\n \"--ow-control-on\",\n // focus-ring\n \"--ow-focus-ring\",\n // 功能色四族全档\n \"--ow-info*\",\n \"--ow-success*\",\n \"--ow-warning*\",\n \"--ow-error*\",\n // 功能色别名:--ow-mention-bg/-text 直挂 --ow-info-tint/-on-tint,\n // Aliases are denied too, so precision CSS cannot bypass functional colors.\n \"--ow-mention*\",\n // 恒定域\n \"--ow-paper\",\n \"--ow-stage-*\",\n \"--ow-term-*\",\n \"--ow-ansi-*\",\n // 圆角(形状表是品牌定稿)\n \"--ow-radius-*\",\n] as const\n\n/**\n * DS2 皮肤禁覆盖 **CSS 属性** 清单(COMPONENT-RULES §5/§7/§9 · W5 终扫补闸)。\n *\n * `DS2_SKIN_DENYLIST` only sees token names. Precision CSS can also write\n * `box-shadow: 0 0 20px …`, `border-radius: 18px`,\n * `transform: translateY(-2px)`、`animation: neon-pulse 2s infinite` 完全绕开它——\n * 而这四类恰恰是 2.0 明令收口的三层:贴地零影(§5)、形状表定稿(§7)、\n * 唯一动效语汇=信标(§9)。故对属性维度另立一闸:命中即整块剥除。\n *\n * 条目为属性名前缀(连字符边界):`border-radius` 同时覆盖\n * `border-top-left-radius` 等长写;`transition` 覆盖 `transition-property` 等。\n *\n * 官方 skin skill 直接调用本模块导出的 parseOrbitworkSkin,不复制这份清单。\n */\nexport const DS2_SKIN_DENIED_PROPERTIES = [\n \"border-radius\",\n \"border-top-left-radius\",\n \"border-top-right-radius\",\n \"border-bottom-left-radius\",\n \"border-bottom-right-radius\",\n \"box-shadow\",\n \"transform\",\n \"animation\",\n \"transition\",\n \"backdrop-filter\",\n \"-webkit-backdrop-filter\",\n] as const\n\n/**\n * 判断某个 CSS 属性名是否命中属性维度禁覆盖清单。\n * 只按连字符边界做前缀匹配,避免 `animation` 误伤自定义属性 `--animation-x`\n * (自定义属性由 token 维度那一闸单独管)。\n */\nexport function isDs2SkinDeniedProperty(propertyName: string): boolean {\n const name = propertyName.trim().toLowerCase()\n if (name.startsWith(\"--\")) return false\n return DS2_SKIN_DENIED_PROPERTIES.some((entry) => name === entry || name.startsWith(`${entry}-`))\n}\n\n/**\n * 在一段 CSS 文本里找出第一处命中属性维度禁覆盖清单的声明。\n * 只在「声明位置」匹配(块首/`;`/`{` 之后的标识符 + `:`),选择器与值里的同名词不算。\n */\nexport function findDs2DeniedCssProperty(css: string): string | null {\n const declaration = /(?:^|[{;])\\s*(-{0,2}[a-z][a-z0-9-]*)\\s*:/gi\n let match: RegExpExecArray | null = declaration.exec(css)\n while (match) {\n const property = match[1] ?? \"\"\n if (isDs2SkinDeniedProperty(property)) return property.toLowerCase()\n match = declaration.exec(css)\n }\n return null\n}\n\n/**\n * 值维度禁覆盖(DS2 判据 7「品牌外渐变一律清除」)。\n *\n * 校验脚本不得复制该规则,统一委托 parseOrbitworkSkin。\n *\n * 为什么不是往 DS2_SKIN_DENIED_PROPERTIES 里加 `background`:皮肤本来就该能改底色,\n * 按属性名封会把整类合法覆盖一起封掉。要拦的是**值的形态**——任何 *-gradient()。\n * R2 之前这一层完全没有:glass.ts 的 `body { background: linear-gradient(135deg,\n * rgba(59,130,246,.1), rgba(139,92,246,.1)) }`(V1 蓝紫)是整份皮肤里唯二穿过闸口的\n * 块之一;cyberpunk.ts 的 `userBubbleBackground: \"linear-gradient(135deg,#E91E63,#9C27B0)\"`\n * 更是走 mode token 直接落到用户气泡上——两条路都得拦。\n */\nexport const DS2_SKIN_DENIED_VALUE_PATTERNS = [\"-gradient(\"] as const\n\n/** 判断某个 CSS 值是否命中值维度禁覆盖(渐变)。 */\nexport function isDs2SkinDeniedValue(value: string): boolean {\n const v = value.toLowerCase()\n return DS2_SKIN_DENIED_VALUE_PATTERNS.some((entry) => v.includes(entry))\n}\n\n/**\n * 在一段 CSS 文本里找出第一处命中值维度禁覆盖的声明值。\n * 只看声明的**值**侧,选择器与注释里的同名词不算(调用方已剥注释)。\n */\nexport function findDs2DeniedCssValue(css: string): string | null {\n const declaration = /(?:^|[{;])\\s*-{0,2}[a-z][a-z0-9-]*\\s*:([^;{}]*)/gi\n let match: RegExpExecArray | null = declaration.exec(css)\n while (match) {\n const value = match[1] ?? \"\"\n if (isDs2SkinDeniedValue(value)) {\n const hit = /[a-z-]*-gradient\\(/i.exec(value)\n return hit ? hit[0].slice(0, -1) : \"gradient\"\n }\n match = declaration.exec(css)\n }\n return null\n}\n\n/** Brand-locked component roots that precision styles cannot target. */\nexport const DS2_LOCKED_SLOT_SELECTORS = [\"beacon-spinner\", \"orbitwork-mark\", \"orbitwork-lockup\"] as const\n\nexport const MAX_ORBITWORK_SKIN_CSS_BYTES = 256 * 1024\n\n/**\n * Exact precision-style surface maintained by Orbitwork UI.\n * A data-slot/data-ow-part attribute is not skin-public unless it appears here.\n * Each target also owns its allowed visual properties so skins cannot turn a\n * stable selector into an undocumented layout or behavior override.\n */\nexport const ORBITWORK_SKIN_PUBLIC_PARTS = Object.freeze({\n '[data-slot=\"artifact-preview-card\"] [data-ow-part=\"meta\"]': Object.freeze([\"color\", \"font-weight\"]),\n} as const)\n\n/** One shared DS2 verdict for both import-time rejection and apply-time defence. */\nexport function findDs2SkinCssViolation(css: string): string | null {\n for (const slot of DS2_LOCKED_SLOT_SELECTORS) {\n if (css.includes(slot)) return `锁定件选择器 \"${slot}\"`\n }\n const tokenNames = css.match(/--ow-[a-z0-9-]+/gi) ?? []\n for (const tokenName of tokenNames) {\n if (isDs2SkinDeniedToken(tokenName)) return `禁覆盖 token ${tokenName}`\n }\n const property = findDs2DeniedCssProperty(css)\n if (property) return `禁覆盖 CSS 属性 ${property}`\n const gradient = findDs2DeniedCssValue(css)\n if (gradient) return `禁覆盖值形态 ${gradient}()`\n return null\n}\n\n/** 判断某个 CSS 自定义属性名是否命中 DS2 禁覆盖清单。 */\nexport function isDs2SkinDeniedToken(tokenName: string): boolean {\n const name = tokenName.trim()\n return DS2_SKIN_DENYLIST.some((entry) =>\n entry.endsWith(\"*\") ? name.startsWith(entry.slice(0, -1)) : name === entry || name.startsWith(`${entry}-`),\n )\n}\n\n/** WCAG 2.x 相对亮度 → 对比度实算(输入为 3/4/6/8 位 hex;alpha 忽略,按不透明计算)。 */\nexport function ds2ContrastRatio(hexA: string, hexB: string): number {\n const la = relativeLuminance(hexA)\n const lb = relativeLuminance(hexB)\n const lighter = Math.max(la, lb)\n const darker = Math.min(la, lb)\n return (lighter + 0.05) / (darker + 0.05)\n}\n\nfunction relativeLuminance(hex: string): number {\n const [r, g, b] = hexToRgb(hex)\n const toLinear = (channel: number) => {\n const c = channel / 255\n return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4\n }\n return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b)\n}\n\nfunction hexToRgb(hex: string): [number, number, number] {\n let value = hex.replace(/^#/, \"\")\n if (value.length === 3 || value.length === 4) {\n value = value\n .slice(0, 3)\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n }\n return [\n Number.parseInt(value.slice(0, 2), 16),\n Number.parseInt(value.slice(2, 4), 16),\n Number.parseInt(value.slice(4, 6), 16),\n ]\n}\n\n/** 中性梯度整组闸:命中任一触发键即要求整组提交并过对比度实算。 */\nconst NEUTRAL_TRIGGER_KEYS = [\n \"backgroundPrimary\",\n \"backgroundSecondary\",\n \"backgroundTertiary\",\n \"foregroundPrimary\",\n \"foregroundSecondary\",\n \"foregroundMuted\",\n] as const\nconst NEUTRAL_REQUIRED_KEYS = [\n \"backgroundPrimary\",\n \"backgroundSecondary\",\n \"backgroundTertiary\",\n \"foregroundPrimary\",\n \"foregroundSecondary\",\n \"foregroundMuted\",\n \"borderSubtle\",\n \"borderStrong\",\n] as const\nconst NEUTRAL_CONTRAST_PAIRS: ReadonlyArray<readonly [keyof OrbitworkSkinTokens, keyof OrbitworkSkinTokens]> = [\n [\"foregroundPrimary\", \"backgroundPrimary\"],\n [\"foregroundPrimary\", \"backgroundSecondary\"],\n [\"foregroundPrimary\", \"backgroundTertiary\"],\n [\"foregroundSecondary\", \"backgroundPrimary\"],\n [\"foregroundSecondary\", \"backgroundSecondary\"],\n [\"foregroundSecondary\", \"backgroundTertiary\"],\n [\"foregroundMuted\", \"backgroundPrimary\"],\n [\"foregroundMuted\", \"backgroundSecondary\"],\n [\"foregroundMuted\", \"backgroundTertiary\"],\n]\nconst MIN_NEUTRAL_CONTRAST = 4.5\n\n/** 闸 (a):覆盖项落点命中禁覆盖清单即拒绝(白名单收敛后属兜底防线)。 */\nfunction assertTokensNotDenied(tokens: OrbitworkSkinTokens, path: string): void {\n for (const [key, value] of Object.entries(tokens)) {\n const cssVar = ORBITWORK_SKIN_CSS_VARIABLES[key as keyof OrbitworkSkinTokens]\n if (cssVar && isDs2SkinDeniedToken(cssVar)) {\n throw new Error(`${path}.${key} 的落点 ${cssVar} 命中 DS2 禁覆盖清单,拒绝该皮肤`)\n }\n // 值维度:token 值本身是渐变时,属性闸与 token 闸都拦不住(落点名合法、属性名合法),\n // 直接落到气泡/侧栏底上——判据 7「品牌外渐变一律清除」在这里收口。\n // chatBackgroundImage 例外:它本来就是一张图/图案的落点,由 orbitwork-skin-image 单独校验。\n if (key !== \"chatBackgroundImage\" && typeof value === \"string\" && isDs2SkinDeniedValue(value)) {\n throw new Error(`${path}.${key} 的值是渐变(${value}),DS2 判据 7 品牌外渐变一律清除,拒绝该皮肤`)\n }\n }\n}\n\n/** 闸 (b):中性梯度整组提交 + WCAG 对比度实算(text-on-bg / text-on-surface ≥ 4.5:1)。 */\nfunction assertNeutralGroupContrast(tokens: OrbitworkSkinTokens, path: string): void {\n const touched = NEUTRAL_TRIGGER_KEYS.some((key) => tokens[key] !== undefined)\n if (!touched) return\n const missing = NEUTRAL_REQUIRED_KEYS.filter((key) => tokens[key] === undefined)\n if (missing.length > 0) {\n throw new Error(`${path} 中性梯度须整组提交(text 系与 bg/surface 系同批),缺少:${missing.join(\"、\")}`)\n }\n for (const [textKey, bgKey] of NEUTRAL_CONTRAST_PAIRS) {\n const text = tokens[textKey]\n const bg = tokens[bgKey]\n if (!text || !bg) continue\n const ratio = ds2ContrastRatio(text, bg)\n if (ratio < MIN_NEUTRAL_CONTRAST) {\n throw new Error(\n `${path} 对比度不达标:${textKey}(${text}) 在 ${bgKey}(${bg}) 上为 ${ratio.toFixed(2)}:1,要求 ≥ ${MIN_NEUTRAL_CONTRAST}:1`,\n )\n }\n }\n}\n\n/** Runtime btn-primary is open, but yellow-adjacent values would impersonate the locked beacon pole. */\nexport function isNeonYellowAdjacent(value: string): boolean {\n if (!HEX_COLOR.test(value)) return false\n const [r, g, b] = hexToRgb(value)\n const max = Math.max(r, g, b) / 255\n const min = Math.min(r, g, b) / 255\n const delta = max - min\n if (delta === 0) return false\n const red = r / 255\n const green = g / 255\n const blue = b / 255\n let hue =\n max === red ? ((green - blue) / delta) % 6 : max === green ? (blue - red) / delta + 2 : (red - green) / delta + 4\n hue = (hue * 60 + 360) % 360\n const lightness = (max + min) / 2\n const saturation = delta / (1 - Math.abs(2 * lightness - 1))\n return hue >= 40 && hue <= 75 && saturation >= 0.5 && lightness >= 0.35\n}\n\nfunction assertButtonPrimary(tokens: OrbitworkSkinTokens, path: string): void {\n const background = tokens.buttonPrimaryBackground\n const foreground = tokens.buttonPrimaryForeground\n if (!background && !foreground) return\n if (!background || !foreground) throw new Error(`${path} btn-primary 须同时提交 background 与 foreground`)\n if (isNeonYellowAdjacent(background)) throw new Error(`${path}.buttonPrimaryBackground 不得使用荧黄邻近色`)\n const ratio = ds2ContrastRatio(background, foreground)\n if (ratio < 4.5) throw new Error(`${path} btn-primary 对比度为 ${ratio.toFixed(2)}:1,要求 ≥ 4.5:1`)\n}\n\nexport function hasOrbitworkSkinChatBackground(skin: OrbitworkSkin | null | undefined, mode: ResolvedTheme): boolean {\n return Boolean(skin?.modes?.[mode]?.chatBackgroundImage)\n}\n\nexport function parseOrbitworkSkin(input: unknown): SkinValidationResult {\n try {\n if (!isRecord(input)) throw new Error(\"主题必须是 JSON 对象\")\n assertKnownKeys(input, ROOT_KEYS, \"主题\")\n if (input.version !== 1) throw new Error(\"仅支持 version: 1\")\n if (typeof input.id !== \"string\" || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(input.id) || input.id.length > 64)\n throw new Error(\"id 必须是最多 64 字符的小写短横线标识\")\n if (typeof input.name !== \"string\" || !input.name.trim() || input.name.length > 48)\n throw new Error(\"name 必须是 1–48 个字符\")\n if (input.description !== undefined && (typeof input.description !== \"string\" || input.description.length > 160))\n throw new Error(\"description 最多 160 个字符\")\n if (input.fontScale !== undefined && !isOrbitworkFontScale(input.fontScale))\n throw new Error(\"fontScale 必须是 0.9、1、1.1 或 1.2\")\n if (!isRecord(input.modes)) throw new Error(\"modes 必须是对象\")\n assertKnownKeys(input.modes, MODE_KEYS, \"modes\")\n const light =\n input.modes.light === undefined ? undefined : parseTokens(input.modes.light, TOKEN_KEY_SET, \"modes.light\")\n const dark = input.modes.dark === undefined ? undefined : parseTokens(input.modes.dark, TOKEN_KEY_SET, \"modes.dark\")\n if (!light && !dark) throw new Error(\"modes 至少需要 light 或 dark\")\n\n // DS2 两道闸:禁覆盖清单拦截 + 中性梯度整组对比度实算\n if (light) {\n assertTokensNotDenied(light, \"modes.light\")\n assertNeutralGroupContrast(light, \"modes.light\")\n assertButtonPrimary(light, \"modes.light\")\n }\n if (dark) {\n assertTokensNotDenied(dark, \"modes.dark\")\n assertNeutralGroupContrast(dark, \"modes.dark\")\n assertButtonPrimary(dark, \"modes.dark\")\n }\n\n // Parse registered public-part styles.\n let contributes: OrbitworkSkin[\"contributes\"] | undefined\n if (input.contributes !== undefined) {\n if (!isRecord(input.contributes)) throw new Error(\"contributes 必须是对象\")\n assertKnownKeys(input.contributes, CONTRIBUTES_KEYS, \"contributes\")\n const publicPartStyles = input.contributes.publicPartStyles\n if (publicPartStyles !== undefined && typeof publicPartStyles !== \"string\")\n throw new Error(\"contributes.publicPartStyles 必须是字符串\")\n const registry = parseRegistry(input.contributes.registry)\n const normalizedPublicPartStyles = assertSkinContributions(publicPartStyles, registry)\n if (normalizedPublicPartStyles || registry) {\n contributes = {\n ...(normalizedPublicPartStyles ? { publicPartStyles: normalizedPublicPartStyles } : {}),\n ...(registry ? { registry } : {}),\n }\n }\n }\n\n return {\n ok: true,\n skin: {\n version: 1,\n id: input.id,\n name: input.name.trim(),\n ...(input.description ? { description: input.description.trim() } : {}),\n ...(input.fontScale !== undefined ? { fontScale: input.fontScale } : {}),\n modes: { ...(light ? { light } : {}), ...(dark ? { dark } : {}) },\n ...(contributes ? { contributes } : {}),\n },\n }\n } catch (error) {\n return { ok: false, error: error instanceof Error ? error.message : \"主题格式无效\" }\n }\n}\n\nconst PUBLIC_PART_TARGET =\n /^\\[data-slot=[\"'][a-z0-9]+(?:-[a-z0-9]+)*[\"']\\](?:\\s+(?:>\\s+)?\\[data-ow-(?:part|state|role|kind|context)=[\"'][a-z0-9]+(?:-[a-z0-9]+)*[\"']\\])*$/\n\ntype SkinCssDeclaration = { property: string; value: string }\ntype SkinCssRule = { selectors: string[]; declarations: SkinCssDeclaration[] }\n\nfunction assertSkinCssValue(property: string, value: string): void {\n if (property === \"color\" && /^var\\(--ow-text(?:-2)?\\)$/.test(value)) {\n return\n }\n if (\n property === \"font-weight\" &&\n (/^(?:[1-9]00|normal|bold)$/i.test(value) || /^var\\(--ow-font-weight-[a-z0-9-]+\\)$/i.test(value))\n )\n return\n throw new Error(`contributes.publicPartStyles 不允许 ${property} 使用值 ${value}`)\n}\n\n/**\n * Parse the deliberately tiny public-part CSS language and serialize it back\n * to one canonical representation. Comments and escapes are rejected instead\n * of being stripped: validation and browser injection must consume identical\n * semantics.\n */\nfunction cssRules(css: string): SkinCssRule[] {\n if (css.includes(\"/*\") || css.includes(\"*/\")) {\n throw new Error(\"contributes.publicPartStyles 不支持 CSS 注释\")\n }\n if (css.includes(\"\\\\\")) throw new Error(\"contributes.publicPartStyles 不支持 CSS 转义\")\n const rules: SkinCssRule[] = []\n let cursor = 0\n while (cursor < css.length) {\n while (/\\s/.test(css[cursor] ?? \"\")) cursor += 1\n if (cursor >= css.length) break\n const open = css.indexOf(\"{\", cursor)\n if (open < 0) throw new Error(\"contributes.publicPartStyles 包含不完整的 CSS 规则\")\n const close = css.indexOf(\"}\", open + 1)\n if (close < 0 || css.slice(open + 1, close).includes(\"{\")) {\n throw new Error(\"contributes.publicPartStyles 只能包含扁平 CSS 规则\")\n }\n const prelude = css.slice(cursor, open).trim()\n if (!prelude || prelude.startsWith(\"@\")) {\n throw new Error(\"contributes.publicPartStyles 不支持 @ 规则或空选择器\")\n }\n const selectors = prelude\n .split(\",\")\n .map((selector) => selector.trim())\n .filter(Boolean)\n const declarations = css\n .slice(open + 1, close)\n .split(\";\")\n .map((declaration) => declaration.trim())\n .filter(Boolean)\n .map((declaration) => {\n const separator = declaration.indexOf(\":\")\n if (separator <= 0 || !declaration.slice(separator + 1).trim()) {\n throw new Error(`contributes.publicPartStyles 包含无效声明:${declaration}`)\n }\n const property = declaration.slice(0, separator).trim().toLowerCase()\n const value = declaration.slice(separator + 1).trim()\n if (!/^[a-z][a-z-]*$/.test(property) || /[{};\"'@]/.test(value) || /!\\s*important/i.test(value)) {\n throw new Error(`contributes.publicPartStyles 包含无效声明:${declaration}`)\n }\n assertSkinCssValue(property, value)\n return { property, value }\n })\n if (declarations.length === 0) throw new Error(\"contributes.publicPartStyles 不接受空规则\")\n rules.push({ selectors, declarations })\n cursor = close + 1\n }\n if (css.trim() && rules.length === 0) throw new Error(\"contributes.publicPartStyles 没有有效规则\")\n return rules\n}\n\nexport function normalizeOrbitworkSkinPublicPartStyles(publicPartStyles: string): string {\n const path = \"contributes.publicPartStyles\"\n const publicPartCss = publicPartStyles.trim()\n if (new TextEncoder().encode(publicPartCss).byteLength > MAX_ORBITWORK_SKIN_CSS_BYTES)\n throw new Error(`${path} 不能超过 256 KiB`)\n const rules = cssRules(publicPartCss)\n for (const rule of rules) {\n for (const selector of rule.selectors) {\n if (!PUBLIC_PART_TARGET.test(selector))\n throw new Error(`${path} 只能定位 data-slot 根及其 data-ow-* public part:${selector}`)\n const allowedProperties = ORBITWORK_SKIN_PUBLIC_PARTS[selector as keyof typeof ORBITWORK_SKIN_PUBLIC_PARTS]\n if (!allowedProperties) throw new Error(`${path} 选择器不是 Orbitwork 开放的皮肤 public part:${selector}`)\n for (const { property } of rule.declarations) {\n if (!(allowedProperties as readonly string[]).includes(property)) {\n throw new Error(`${path} 不允许在 ${selector} 覆盖属性 ${property}`)\n }\n }\n }\n }\n const canonical = rules\n .map(\n ({ selectors, declarations }) =>\n `${selectors.join(\", \")} { ${declarations.map(({ property, value }) => `${property}: ${value};`).join(\" \")} }`,\n )\n .join(\"\\n\")\n const safety = analyzeSkinCSS(canonical)\n if (!safety.ok) throw new Error(`${path} 包含不安全内容:${safety.warnings.join(\";\")}`)\n const violation = findDs2SkinCssViolation(canonical)\n if (violation) throw new Error(`${path} 命中 DS2 禁覆盖:${violation}`)\n return canonical\n}\n\nfunction assertSkinContributions(\n publicPartStyles: unknown,\n registry: OrbitworkSkinRegistryEntry[] | undefined,\n): string | undefined {\n const publicPartCss = typeof publicPartStyles === \"string\" ? publicPartStyles.trim() : \"\"\n const hasCss = publicPartCss.length > 0\n\n if (hasCss && !registry?.length) throw new Error(\"contributes.publicPartStyles 必须提供 registry 登记\")\n if (!hasCss && registry?.length) throw new Error(\"contributes.registry 不能脱离 publicPartStyles 单独存在\")\n if (!hasCss || !registry) return undefined\n\n const normalized = normalizeOrbitworkSkinPublicPartStyles(publicPartCss)\n const rules = cssRules(normalized)\n const selectors = rules.flatMap((rule) => rule.selectors)\n const registeredTargets = new Set(registry.map((entry) => entry.target))\n for (const rule of rules) {\n for (const selector of rule.selectors) {\n if (!registeredTargets.has(selector)) throw new Error(`contributes.publicPartStyles 选择器未登记:${selector}`)\n }\n }\n const selectorSet = new Set(selectors)\n for (const entry of registry) {\n if (!selectorSet.has(entry.target)) throw new Error(`contributes.registry target 未出现在 CSS:${entry.target}`)\n }\n return normalized\n}\n\nfunction parseTokens(input: unknown, allowed: Set<string>, path: string): OrbitworkSkinTokens {\n if (!isRecord(input)) throw new Error(`${path} 必须是对象`)\n assertKnownKeys(input, allowed, path)\n const result: OrbitworkSkinTokens = {}\n for (const [key, value] of Object.entries(input)) {\n if (typeof value !== \"string\") throw new Error(`${path}.${key} 必须是字符串`)\n if (COLOR_KEYS.includes(key as (typeof COLOR_KEYS)[number])) {\n if (!HEX_COLOR.test(value)) throw new Error(`${path}.${key} 必须是十六进制颜色`)\n ;(result as Record<string, string>)[key] = value.toLowerCase()\n } else if (MASK_COLOR_KEYS.includes(key as (typeof MASK_COLOR_KEYS)[number])) {\n if (!MASK_HEX_COLOR.test(value)) throw new Error(`${path}.${key} 必须是六位或八位十六进制颜色`)\n ;(result as Record<string, string>)[key] = value.toLowerCase()\n } else if (IMAGE_KEYS.includes(key as (typeof IMAGE_KEYS)[number])) {\n assertSafeDataImage(value, `${path}.${key}`)\n ;(result as Record<string, string>)[key] = value\n } else if (OPACITY_KEYS.includes(key as (typeof OPACITY_KEYS)[number])) {\n const opacity = Number(value)\n if (!/^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$/.test(value) || !Number.isFinite(opacity) || opacity < 0 || opacity > 1) {\n throw new Error(`${path}.${key} 必须是 0–1 之间的十进制字符串`)\n }\n ;(result as Record<string, string>)[key] = String(opacity)\n } else if (POSITION_KEYS.includes(key as (typeof POSITION_KEYS)[number])) {\n const normalized = value.toLowerCase()\n if (!BACKGROUND_POSITIONS.has(normalized)) throw new Error(`${path}.${key} 不是支持的背景位置`)\n ;(result as Record<string, string>)[key] = normalized\n } else if (SIZE_KEYS.includes(key as (typeof SIZE_KEYS)[number])) {\n const normalized = value.toLowerCase()\n if (!BACKGROUND_SIZES.has(normalized)) throw new Error(`${path}.${key} 不是支持的背景尺寸`)\n ;(result as Record<string, string>)[key] = normalized\n } else {\n throw new Error(`${path} 包含不支持的字段:${key}`)\n }\n }\n return result\n}\n\nfunction parseRegistry(input: unknown): OrbitworkSkinRegistryEntry[] | undefined {\n if (input === undefined) return undefined\n if (!Array.isArray(input)) throw new Error(\"contributes.registry 必须是数组\")\n if (input.length === 0) return undefined\n const result = input.map((entry, index) => {\n if (!isRecord(entry)) throw new Error(`contributes.registry[${index}] 必须是 { target, reason } 对象`)\n assertKnownKeys(entry, REGISTRY_ENTRY_KEYS, `contributes.registry[${index}]`)\n const { target, reason } = entry\n if (typeof target !== \"string\" || !target.trim() || target.length > 200)\n throw new Error(`contributes.registry[${index}].target 必须是 1–200 字符的字符串`)\n if (typeof reason !== \"string\" || !reason.trim() || reason.length > 200)\n throw new Error(`contributes.registry[${index}].reason 必须是 1–200 字符的字符串`)\n return { target: target.trim(), reason: reason.trim() }\n })\n const duplicate = result.find(\n (entry, index) => result.findIndex((candidate) => candidate.target === entry.target) !== index,\n )\n if (duplicate) throw new Error(`contributes.registry target 重复:${duplicate.target}`)\n return result\n}\n\nfunction assertSafeDataImage(value: string, path: string): void {\n const match = DATA_IMAGE.exec(value)\n if (!match) throw new Error(`${path} 必须是 PNG、JPEG 或 WebP 的 base64 data URL`)\n const format = match[1]\n const payload = match[2]\n if (!format || !payload) throw new Error(`${path} 包含无效的图片数据`)\n if (payload.length % 4 !== 0) throw new Error(`${path} 包含无效的 base64 数据`)\n const padding = payload.endsWith(\"==\") ? 2 : payload.endsWith(\"=\") ? 1 : 0\n const decodedBytes = (payload.length / 4) * 3 - padding\n if (decodedBytes > MAX_ORBITWORK_SKIN_IMAGE_BYTES) throw new Error(`${path} 解码后不能超过 5 MiB`)\n let bytes: number[]\n try {\n const decoded = globalThis.atob(payload)\n bytes = Array.from(decoded.slice(0, 12), (char) => char.charCodeAt(0))\n } catch {\n throw new Error(`${path} 包含无效的 base64 数据`)\n }\n const validMagic =\n format === \"png\"\n ? [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a].every((byte, index) => bytes[index] === byte)\n : format === \"jpeg\"\n ? bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff\n : bytes[0] === 0x52 &&\n bytes[1] === 0x49 &&\n bytes[2] === 0x46 &&\n bytes[3] === 0x46 &&\n bytes[8] === 0x57 &&\n bytes[9] === 0x45 &&\n bytes[10] === 0x42 &&\n bytes[11] === 0x50\n if (!validMagic) throw new Error(`${path} 的内容与图片格式不匹配`)\n}\n\n/** Convert a validated embedded image into a CSS value without accepting arbitrary CSS or URLs. */\nexport function orbitworkSkinImageCssValue(value: string | undefined): string | undefined {\n if (!value) return undefined\n try {\n assertSafeDataImage(value, \"chatBackgroundImage\")\n return `url(\"${value}\")`\n } catch {\n return undefined\n }\n}\n\nexport function assertKnownKeys(value: Record<string, unknown>, allowed: Set<string>, path: string) {\n const unknown = Object.keys(value).find((key) => !allowed.has(key))\n if (unknown) throw new Error(`${path} 包含不支持的字段:${unknown}`)\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n}\n","import type { OrbitworkSkin, OrbitworkSkinTokens } from \"../core/skin.ts\"\n\ntype CompleteModeInput = {\n backgroundPrimary: string\n backgroundSecondary: string\n backgroundTertiary: string\n foregroundPrimary: string\n foregroundSecondary: string\n borderSubtle: string\n borderStrong: string\n buttonPrimaryBackground?: string\n buttonPrimaryForeground?: string\n}\n\n/** Give every built-in palette real component coverage instead of changing only the page canvas. */\nfunction completeMode(input: CompleteModeInput): OrbitworkSkinTokens {\n return {\n ...input,\n foregroundMuted: input.foregroundSecondary,\n chatBackground: input.backgroundPrimary,\n userBubbleBackground: input.backgroundTertiary,\n userBubbleForeground: input.foregroundPrimary,\n userBubbleBorder: input.borderStrong,\n composerBackground: input.backgroundSecondary,\n composerBorder: input.borderStrong,\n sidebarBackground: input.backgroundSecondary,\n sidebarSelectedBackground: input.backgroundTertiary,\n }\n}\n\n/**\n * Codex-inspired defaults mapped from the user-exported `codex-theme-v1` light/dark\n * configurations. `surface`, `ink`, and `contrast` own this neutral palette;\n * primary buttons inherit the same defaults as Warm Beige.\n * Codex-only font/window/functional-color fields stay outside the personal-skin contract.\n */\nexport const codex: OrbitworkSkin = {\n version: 1,\n id: \"codex\",\n name: \"Normal\",\n description: \"高对比中性工作空间\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#ffffff\",\n backgroundSecondary: \"#f5f5f5\",\n backgroundTertiary: \"#ebebeb\",\n foregroundPrimary: \"#000000\",\n foregroundSecondary: \"#525252\",\n borderSubtle: \"#dedede\",\n borderStrong: \"#b8b8b8\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#1f1f24\",\n backgroundSecondary: \"#29292e\",\n backgroundTertiary: \"#333339\",\n foregroundPrimary: \"#ffffff\",\n foregroundSecondary: \"#b7b7c0\",\n borderSubtle: \"#3f3f46\",\n borderStrong: \"#676771\",\n }),\n },\n}\n\nexport const DEFAULT_ORBITWORK_SKIN_ID = \"codex\" as const\n\n/** The former unskinned DS2 palette, retained as the second built-in choice. */\nexport const warmBeige: OrbitworkSkin = {\n version: 1,\n id: \"warm-beige\",\n name: \"Warm Beige\",\n description: \"Orbitwork 原始的海军蓝与暖灰语义配色\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#f7f6f1\",\n backgroundSecondary: \"#fdfdfc\",\n backgroundTertiary: \"#f1f0ea\",\n foregroundPrimary: \"#333b50\",\n foregroundSecondary: \"#646b7a\",\n borderSubtle: \"#dcdcd7\",\n borderStrong: \"#c2c3c1\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#16171b\",\n backgroundSecondary: \"#1e2025\",\n backgroundTertiary: \"#23252b\",\n foregroundPrimary: \"#ecebe5\",\n foregroundSecondary: \"#92969d\",\n borderSubtle: \"#2a2c33\",\n borderStrong: \"#3f434d\",\n }),\n },\n}\n\nexport const aurora: OrbitworkSkin = {\n version: 1,\n id: \"aurora\",\n name: \"Aurora\",\n description: \"柔和紫色强调与微暖背景\",\n modes: {\n light: {\n backgroundPrimary: \"#fdfcff\",\n backgroundSecondary: \"#f8f5ff\",\n backgroundTertiary: \"#f1ecfb\",\n foregroundPrimary: \"#1d1a26\",\n foregroundSecondary: \"#4c4560\",\n foregroundMuted: \"#4c4560\",\n borderSubtle: \"#ded8ea\",\n borderStrong: \"#c4b5fd\",\n buttonPrimaryBackground: \"#7c3aed\",\n buttonPrimaryForeground: \"#ffffff\",\n chatBackground: \"#fdfcff\",\n userBubbleBackground: \"#f1ecfb\",\n userBubbleForeground: \"#1d1a26\",\n userBubbleBorder: \"#c4b5fd\",\n composerBackground: \"#f8f5ff\",\n composerBorder: \"#c4b5fd\",\n sidebarBackground: \"#f8f5ff\",\n sidebarSelectedBackground: \"#f1ecfb\",\n },\n dark: {\n backgroundPrimary: \"#17141d\",\n backgroundSecondary: \"#201b29\",\n backgroundTertiary: \"#2a2335\",\n foregroundPrimary: \"#eae6f2\",\n foregroundSecondary: \"#b3abc6\",\n foregroundMuted: \"#b3abc6\",\n borderSubtle: \"#393146\",\n borderStrong: \"#6d4aa5\",\n buttonPrimaryBackground: \"#a78bfa\",\n buttonPrimaryForeground: \"#17141d\",\n chatBackground: \"#17141d\",\n userBubbleBackground: \"#2a2335\",\n userBubbleForeground: \"#eae6f2\",\n userBubbleBorder: \"#6d4aa5\",\n composerBackground: \"#201b29\",\n composerBorder: \"#6d4aa5\",\n sidebarBackground: \"#201b29\",\n sidebarSelectedBackground: \"#2a2335\",\n },\n },\n}\n\nexport const forest: OrbitworkSkin = {\n version: 1,\n id: \"forest\",\n name: \"Forest\",\n description: \"克制自然的绿色工作空间\",\n modes: {\n light: {\n backgroundPrimary: \"#fbfdfb\",\n backgroundSecondary: \"#f3f8f5\",\n backgroundTertiary: \"#e9f1ec\",\n foregroundPrimary: \"#16211b\",\n foregroundSecondary: \"#3f5248\",\n foregroundMuted: \"#3f5248\",\n borderSubtle: \"#d6e1da\",\n borderStrong: \"#98d8be\",\n buttonPrimaryBackground: \"#16805b\",\n buttonPrimaryForeground: \"#ffffff\",\n chatBackground: \"#fbfdfb\",\n userBubbleBackground: \"#e9f1ec\",\n userBubbleForeground: \"#16211b\",\n userBubbleBorder: \"#98d8be\",\n composerBackground: \"#f3f8f5\",\n composerBorder: \"#98d8be\",\n sidebarBackground: \"#f3f8f5\",\n sidebarSelectedBackground: \"#e9f1ec\",\n },\n dark: {\n backgroundPrimary: \"#111916\",\n backgroundSecondary: \"#17231e\",\n backgroundTertiary: \"#1e2e27\",\n foregroundPrimary: \"#e4efe8\",\n foregroundSecondary: \"#a7bcb0\",\n foregroundMuted: \"#a7bcb0\",\n borderSubtle: \"#314139\",\n borderStrong: \"#28664f\",\n buttonPrimaryBackground: \"#55d6a0\",\n buttonPrimaryForeground: \"#111916\",\n chatBackground: \"#111916\",\n userBubbleBackground: \"#1e2e27\",\n userBubbleForeground: \"#e4efe8\",\n userBubbleBorder: \"#28664f\",\n composerBackground: \"#17231e\",\n composerBorder: \"#28664f\",\n sidebarBackground: \"#17231e\",\n sidebarSelectedBackground: \"#1e2e27\",\n },\n },\n}\n\n/*\n * Adapted from Craft Agents OSS's MIT-licensed built-in themes. Source attribution stays beside\n * the palettes so future updates preserve provenance:\n * https://github.com/craft-ai-agents/craft-agents-oss/tree/main/apps/electron/resources/themes\n */\nexport const catppuccin: OrbitworkSkin = {\n version: 1,\n id: \"catppuccin\",\n name: \"Catppuccin\",\n description: \"柔和的粉彩色调,适合长时间阅读\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#eff1f5\",\n backgroundSecondary: \"#e6e9ef\",\n backgroundTertiary: \"#dce0e8\",\n foregroundPrimary: \"#4c4f69\",\n foregroundSecondary: \"#565a75\",\n borderSubtle: \"#ccd0da\",\n borderStrong: \"#9ca0b0\",\n buttonPrimaryBackground: \"#8839ef\",\n buttonPrimaryForeground: \"#ffffff\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#1e1e2e\",\n backgroundSecondary: \"#181825\",\n backgroundTertiary: \"#313244\",\n foregroundPrimary: \"#cdd6f4\",\n foregroundSecondary: \"#bac2de\",\n borderSubtle: \"#45475a\",\n borderStrong: \"#6c7086\",\n buttonPrimaryBackground: \"#cba6f7\",\n buttonPrimaryForeground: \"#1e1e2e\",\n }),\n },\n}\n\nexport const gruvbox: OrbitworkSkin = {\n version: 1,\n id: \"gruvbox\",\n name: \"Gruvbox\",\n description: \"复古而温暖的泥土色工作空间\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#fbf1c7\",\n backgroundSecondary: \"#ebdbb2\",\n backgroundTertiary: \"#d5c4a1\",\n foregroundPrimary: \"#3c3836\",\n foregroundSecondary: \"#504945\",\n borderSubtle: \"#bdae93\",\n borderStrong: \"#928374\",\n buttonPrimaryBackground: \"#458588\",\n buttonPrimaryForeground: \"#000000\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#282828\",\n backgroundSecondary: \"#32302f\",\n backgroundTertiary: \"#3c3836\",\n foregroundPrimary: \"#ebdbb2\",\n foregroundSecondary: \"#d5c4a1\",\n borderSubtle: \"#504945\",\n borderStrong: \"#665c54\",\n buttonPrimaryBackground: \"#83a598\",\n buttonPrimaryForeground: \"#282828\",\n }),\n },\n}\n\nexport const nord: OrbitworkSkin = {\n version: 1,\n id: \"nord\",\n name: \"Nord\",\n description: \"冷静克制的北境蓝灰色调\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#eceff4\",\n backgroundSecondary: \"#e5e9f0\",\n backgroundTertiary: \"#d8dee9\",\n foregroundPrimary: \"#2e3440\",\n foregroundSecondary: \"#3b4252\",\n borderSubtle: \"#c2c9d4\",\n borderStrong: \"#8f99a9\",\n buttonPrimaryBackground: \"#5e81ac\",\n buttonPrimaryForeground: \"#000000\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#2e3440\",\n backgroundSecondary: \"#3b4252\",\n backgroundTertiary: \"#434c5e\",\n foregroundPrimary: \"#eceff4\",\n foregroundSecondary: \"#d8dee9\",\n borderSubtle: \"#4c566a\",\n borderStrong: \"#60708a\",\n buttonPrimaryBackground: \"#88c0d0\",\n buttonPrimaryForeground: \"#2e3440\",\n }),\n },\n}\n\nexport const oneDarkPro: OrbitworkSkin = {\n version: 1,\n id: \"one-dark-pro\",\n name: \"One Dark Pro\",\n description: \"均衡清晰的 Atom 风格配色\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#fafafa\",\n backgroundSecondary: \"#f0f0f0\",\n backgroundTertiary: \"#e5e5e6\",\n foregroundPrimary: \"#383a42\",\n foregroundSecondary: \"#4f525d\",\n borderSubtle: \"#d0d0d1\",\n borderStrong: \"#a0a1a7\",\n buttonPrimaryBackground: \"#4078f2\",\n buttonPrimaryForeground: \"#000000\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#282c34\",\n backgroundSecondary: \"#21252b\",\n backgroundTertiary: \"#2f343f\",\n foregroundPrimary: \"#abb2bf\",\n foregroundSecondary: \"#c8ccd4\",\n borderSubtle: \"#3e4451\",\n borderStrong: \"#5c6370\",\n buttonPrimaryBackground: \"#61afef\",\n buttonPrimaryForeground: \"#20232a\",\n }),\n },\n}\n\nexport const rosePine: OrbitworkSkin = {\n version: 1,\n id: \"rose-pine\",\n name: \"Rosé Pine\",\n description: \"温暖优雅的玫瑰灰紫色调\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#faf4ed\",\n backgroundSecondary: \"#fffaf3\",\n backgroundTertiary: \"#f2e9e1\",\n foregroundPrimary: \"#575279\",\n foregroundSecondary: \"#625d82\",\n borderSubtle: \"#dfdad9\",\n borderStrong: \"#9893a5\",\n buttonPrimaryBackground: \"#907aa9\",\n buttonPrimaryForeground: \"#191724\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#191724\",\n backgroundSecondary: \"#1f1d2e\",\n backgroundTertiary: \"#26233a\",\n foregroundPrimary: \"#e0def4\",\n foregroundSecondary: \"#c4a7e7\",\n borderSubtle: \"#403d52\",\n borderStrong: \"#6e6a86\",\n buttonPrimaryBackground: \"#c4a7e7\",\n buttonPrimaryForeground: \"#191724\",\n }),\n },\n}\n\nexport const solarized: OrbitworkSkin = {\n version: 1,\n id: \"solarized\",\n name: \"Solarized\",\n description: \"低疲劳、精确平衡的经典配色\",\n modes: {\n light: completeMode({\n backgroundPrimary: \"#fdf6e3\",\n backgroundSecondary: \"#eee8d5\",\n backgroundTertiary: \"#e4ddc7\",\n foregroundPrimary: \"#4b626a\",\n foregroundSecondary: \"#455b62\",\n borderSubtle: \"#d3cbb7\",\n borderStrong: \"#93a1a1\",\n buttonPrimaryBackground: \"#268bd2\",\n buttonPrimaryForeground: \"#001f27\",\n }),\n dark: completeMode({\n backgroundPrimary: \"#002b36\",\n backgroundSecondary: \"#073642\",\n backgroundTertiary: \"#0b4654\",\n foregroundPrimary: \"#eee8d5\",\n foregroundSecondary: \"#d5d1c4\",\n borderSubtle: \"#23515d\",\n borderStrong: \"#586e75\",\n buttonPrimaryBackground: \"#268bd2\",\n buttonPrimaryForeground: \"#001f27\",\n }),\n },\n}\n\nexport const BUILTIN_ORBITWORK_SKINS = [\n codex,\n warmBeige,\n aurora,\n forest,\n catppuccin,\n gruvbox,\n nord,\n oneDarkPro,\n rosePine,\n solarized,\n] as const\n","import type { ResolvedTheme } from \"./skin.ts\"\n\n/** Runtime layers may override only this complete neutral group. */\nexport const TENANT_THEME_COLOR_KEYS = [\n \"bg\",\n \"surface\",\n \"surface2\",\n \"text\",\n \"text2\",\n \"text3\",\n \"border\",\n \"borderStrong\",\n] as const\n\nexport type TenantThemeColors = Record<(typeof TENANT_THEME_COLOR_KEYS)[number], string>\n\n/** Localized brand copy. Assets stay outside locale buckets. */\nexport type TenantBranding = {\n productName: string\n companyName: string\n claim?: string\n claimNote?: string\n slogan?: string\n}\n\nexport type LocalizedBranding = Record<string, TenantBranding>\n\n/**\n * GET /api/v1/tenant/theme response.\n *\n * Every supplied mode is a complete neutral group. Keeping light and dark\n * separate prevents a runtime :root override from leaking one palette into\n * both DS2 modes.\n */\nexport type TenantTheme = {\n name: string\n /** Brand image. Empty string means fall through to the host/brand layer. */\n logo: string\n favicon?: string\n modes: Partial<Record<ResolvedTheme, TenantThemeColors>>\n typography: {\n fontSans: string\n fontMono: string\n }\n /** en-US is the required baseline; other locale buckets are optional. */\n branding: LocalizedBranding\n}\n\nexport const UNIFIED_NEUTRAL_TOKENS = [\n \"--ow-bg\",\n \"--ow-surface\",\n \"--ow-surface-2\",\n \"--ow-text\",\n \"--ow-text-2\",\n \"--ow-text-3\",\n \"--ow-border\",\n \"--ow-border-strong\",\n] as const\n\nexport const BRAND_ACTION_TOKENS = [\n \"--ow-btn-primary-bg\",\n \"--ow-btn-primary-hover\",\n \"--ow-btn-primary-press\",\n \"--ow-btn-primary-fg\",\n \"--ow-beacon\",\n \"--ow-beacon-idle\",\n \"--ow-accent-dot\",\n \"--ow-data-today\",\n] as const\n\nexport const UNIFIED_TYPOGRAPHY_TOKENS = [\"--ow-font-sans\", \"--ow-font-mono\"] as const\n\nexport type UnifiedNeutralToken = (typeof UNIFIED_NEUTRAL_TOKENS)[number]\nexport type BrandActionToken = (typeof BRAND_ACTION_TOKENS)[number]\nexport type BrandThemeToken = UnifiedNeutralToken | BrandActionToken\nexport type UnifiedTypographyToken = (typeof UNIFIED_TYPOGRAPHY_TOKENS)[number]\nexport type UnifiedThemeToken = BrandThemeToken | UnifiedTypographyToken\n\n/** Build-time validated OEM brand input consumed by the UI merge layer. */\nexport type BrandTheme = {\n id: string\n logo?: string\n favicon?: string\n modes: Partial<Record<ResolvedTheme, Partial<Record<BrandThemeToken, string>>>>\n typography?: {\n fontSans: string\n fontMono: string\n }\n branding?: LocalizedBranding\n}\n"],"mappings":";AAQO,IAAM,YAAY;AAAA;AAAA,EAEvB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAGhB,OAAO;AAAA,IACL,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AAAA;AAAA,EAGA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA;AAAA,EAGA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA;AAAA,EAGA,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,EACR;AAAA;AAAA,EAGA,aAAa;AAA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