@oxyhq/bloom 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/normalize-colors.d.js +2 -0
- package/lib/commonjs/normalize-colors.d.js.map +1 -0
- package/lib/commonjs/theme/apply-dark-class.js +8 -24
- package/lib/commonjs/theme/apply-dark-class.js.map +1 -1
- package/lib/commonjs/theme/build-theme.js +61 -57
- package/lib/commonjs/theme/build-theme.js.map +1 -1
- package/lib/commonjs/theme/color-presets.js +9 -9
- package/lib/commonjs/theme/color-scope/index.web.js +7 -14
- package/lib/commonjs/theme/color-scope/index.web.js.map +1 -1
- package/lib/commonjs/theme/color-scope/style-builder.js +7 -6
- package/lib/commonjs/theme/color-scope/style-builder.js.map +1 -1
- package/lib/commonjs/theme/color-space.js +76 -0
- package/lib/commonjs/theme/color-space.js.map +1 -0
- package/lib/commonjs/theme/index.js +0 -6
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/native-root-vars.native.js +28 -18
- package/lib/commonjs/theme/native-root-vars.native.js.map +1 -1
- package/lib/commonjs/theme/preset-vars.js +20 -152
- package/lib/commonjs/theme/preset-vars.js.map +1 -1
- package/lib/commonjs/theme/token-registry.js +123 -0
- package/lib/commonjs/theme/token-registry.js.map +1 -0
- package/lib/module/normalize-colors.d.js +2 -0
- package/lib/module/normalize-colors.d.js.map +1 -0
- package/lib/module/theme/apply-dark-class.js +8 -19
- package/lib/module/theme/apply-dark-class.js.map +1 -1
- package/lib/module/theme/build-theme.js +61 -57
- package/lib/module/theme/build-theme.js.map +1 -1
- package/lib/module/theme/color-presets.js +9 -9
- package/lib/module/theme/color-scope/index.web.js +7 -14
- package/lib/module/theme/color-scope/index.web.js.map +1 -1
- package/lib/module/theme/color-scope/style-builder.js +7 -6
- package/lib/module/theme/color-scope/style-builder.js.map +1 -1
- package/lib/module/theme/color-space.js +69 -0
- package/lib/module/theme/color-space.js.map +1 -0
- package/lib/module/theme/index.js +1 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/native-root-vars.native.js +29 -18
- package/lib/module/theme/native-root-vars.native.js.map +1 -1
- package/lib/module/theme/preset-vars.js +19 -150
- package/lib/module/theme/preset-vars.js.map +1 -1
- package/lib/module/theme/token-registry.js +113 -0
- package/lib/module/theme/token-registry.js.map +1 -0
- package/lib/typescript/commonjs/theme/apply-dark-class.d.ts +5 -10
- package/lib/typescript/commonjs/theme/apply-dark-class.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/build-theme.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-presets.d.ts +9 -9
- package/lib/typescript/commonjs/theme/color-scope/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts +5 -2
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-space.d.ts +28 -0
- package/lib/typescript/commonjs/theme/color-space.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +1 -2
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/native-root-vars.native.d.ts +25 -15
- package/lib/typescript/commonjs/theme/native-root-vars.native.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/preset-vars.d.ts +11 -74
- package/lib/typescript/commonjs/theme/preset-vars.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/token-registry.d.ts +53 -0
- package/lib/typescript/commonjs/theme/token-registry.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/types.d.ts +3 -0
- package/lib/typescript/commonjs/theme/types.d.ts.map +1 -1
- package/lib/typescript/module/theme/apply-dark-class.d.ts +5 -10
- package/lib/typescript/module/theme/apply-dark-class.d.ts.map +1 -1
- package/lib/typescript/module/theme/build-theme.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-presets.d.ts +9 -9
- package/lib/typescript/module/theme/color-scope/index.web.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts +5 -2
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-space.d.ts +28 -0
- package/lib/typescript/module/theme/color-space.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +1 -2
- package/lib/typescript/module/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/native-root-vars.native.d.ts +25 -15
- package/lib/typescript/module/theme/native-root-vars.native.d.ts.map +1 -1
- package/lib/typescript/module/theme/preset-vars.d.ts +11 -74
- package/lib/typescript/module/theme/preset-vars.d.ts.map +1 -1
- package/lib/typescript/module/theme/token-registry.d.ts +53 -0
- package/lib/typescript/module/theme/token-registry.d.ts.map +1 -0
- package/lib/typescript/module/theme/types.d.ts +3 -0
- package/lib/typescript/module/theme/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/BloomColorScope.test.tsx +5 -5
- package/src/__tests__/BloomThemeProvider.test.tsx +4 -3
- package/src/__tests__/apply-dark-class.test.ts +26 -21
- package/src/__tests__/native-root-vars.test.ts +8 -7
- package/src/__tests__/preset-vars.test.ts +31 -77
- package/src/__tests__/theme.test.ts +6 -6
- package/src/normalize-colors.d.ts +22 -0
- package/src/react-native-css.d.ts +3 -3
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +574 -0
- package/src/theme/__tests__/__snapshots__/visual-gallery.test.tsx.snap +838 -0
- package/src/theme/__tests__/color-space.test.ts +28 -0
- package/src/theme/__tests__/golden-tokens.test.ts +33 -0
- package/src/theme/__tests__/runtime-contract.test.ts +63 -0
- package/src/theme/__tests__/theme-colors-parity.test.ts +115 -0
- package/src/theme/__tests__/token-registry.test.ts +30 -0
- package/src/theme/__tests__/visual-gallery.test.tsx +10 -0
- package/src/theme/apply-dark-class.ts +8 -17
- package/src/theme/build-theme.ts +59 -62
- package/src/theme/color-presets.ts +9 -9
- package/src/theme/color-scope/index.web.tsx +7 -14
- package/src/theme/color-scope/style-builder.ts +7 -4
- package/src/theme/color-space.ts +56 -0
- package/src/theme/index.ts +1 -6
- package/src/theme/native-root-vars.native.ts +28 -18
- package/src/theme/preset-vars.ts +17 -178
- package/src/theme/token-registry.ts +159 -0
- package/src/theme/types.ts +3 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { APP_COLOR_NAMES } from "./color-presets.js";
|
|
4
|
+
import { getPresetVars } from "./preset-vars.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The canonical set of Bloom theme token names — WITHOUT the leading `--`.
|
|
8
|
+
*
|
|
9
|
+
* This is the single source of truth for which tokens a preset produces. It
|
|
10
|
+
* covers exactly the keys returned by `getPresetVars(name, mode)` (the base
|
|
11
|
+
* shadcn palette plus the synthesized extended tokens: card/chart/content-area/
|
|
12
|
+
* sidebar-*). The list is intentionally hand-maintained and verified by
|
|
13
|
+
* `token-registry.test.ts` against the live `getPresetVars('oxy', 'light')`
|
|
14
|
+
* output, so any drift in the preset shape fails CI.
|
|
15
|
+
*
|
|
16
|
+
* Order mirrors `getPresetVars`'s insertion order: base tokens first (in the
|
|
17
|
+
* order they appear in the preset data), then the synthesized extended tokens.
|
|
18
|
+
*/
|
|
19
|
+
export const CANONICAL_TOKENS = ['background', 'foreground', 'surface', 'surface-foreground', 'popover', 'popover-foreground', 'primary', 'primary-foreground', 'secondary', 'secondary-foreground', 'muted', 'muted-foreground', 'accent', 'accent-foreground', 'destructive', 'border', 'input', 'ring', 'sidebar', 'card', 'card-foreground', 'chart-1', 'chart-2', 'chart-3', 'chart-4', 'chart-5', 'content-area', 'sidebar-foreground', 'sidebar-primary', 'sidebar-primary-foreground', 'sidebar-accent', 'sidebar-accent-foreground', 'sidebar-border', 'sidebar-ring'];
|
|
20
|
+
|
|
21
|
+
/** A canonical token name (no leading `--`). */
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Matches a shadcn-style raw HSL triple — `H S% L%`, optionally with an alpha
|
|
25
|
+
* tail `H S% L% / A`. The value starts with a digit (or a leading `-`) and
|
|
26
|
+
* carries at least one `%` (the saturation/lightness units), which distinguishes
|
|
27
|
+
* a bare triple from an already-resolved color (`rgb(...)`, `#fff`) or a
|
|
28
|
+
* unitless/length token (`--radius: 0.5rem`).
|
|
29
|
+
*/
|
|
30
|
+
const RAW_HSL_TRIPLE = /^-?\d[\d.]*\s+[\d.]+%/;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Convert a shadcn-style HSL triple (`'H S% L%'`, optionally with an alpha tail
|
|
34
|
+
* `'H S% L% / A'`) into an sRGB `rgb(...)` string.
|
|
35
|
+
*
|
|
36
|
+
* Standard HSL→sRGB math with integer-rounded channels and modern
|
|
37
|
+
* space-separated output (`rgb(r g b)` / `rgb(r g b / a)`). This is the SINGLE
|
|
38
|
+
* conversion the whole library uses — web document writes, web scope vars, and
|
|
39
|
+
* native `rootVariables` all flow through `getResolvedTokens`, which calls this.
|
|
40
|
+
* The byte-for-byte output is frozen by the golden parity fixture
|
|
41
|
+
* (`__fixtures__/golden-resolved-tokens.json`), so the visible palette cannot
|
|
42
|
+
* drift.
|
|
43
|
+
*
|
|
44
|
+
* Task 2's `oklchToSrgb` (in `color-space.ts`) stays available for a FUTURE
|
|
45
|
+
* OKLCH re-authoring of the seed palette; it is intentionally NOT used here —
|
|
46
|
+
* routing through OKLCH would shift the rounded channels off the frozen palette.
|
|
47
|
+
*
|
|
48
|
+
* Pure function — no side effects.
|
|
49
|
+
*/
|
|
50
|
+
export function hslToSrgb(triple) {
|
|
51
|
+
const [colorPart, alphaPart] = triple.split('/').map(part => part.trim());
|
|
52
|
+
const channels = (colorPart ?? '').split(/\s+/).filter(Boolean);
|
|
53
|
+
const hue = parseFloat((channels[0] ?? '0').replace(/deg$/i, ''));
|
|
54
|
+
const sat = parseFloat((channels[1] ?? '0').replace('%', '')) / 100;
|
|
55
|
+
const light = parseFloat((channels[2] ?? '0').replace('%', '')) / 100;
|
|
56
|
+
const h = Number.isFinite(hue) ? hue : 0;
|
|
57
|
+
const s = Number.isFinite(sat) ? sat : 0;
|
|
58
|
+
const l = Number.isFinite(light) ? light : 0;
|
|
59
|
+
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
60
|
+
const huePrime = (h % 360 + 360) % 360 / 60;
|
|
61
|
+
const second = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
62
|
+
let r = 0;
|
|
63
|
+
let g = 0;
|
|
64
|
+
let b = 0;
|
|
65
|
+
if (huePrime < 1) {
|
|
66
|
+
[r, g, b] = [chroma, second, 0];
|
|
67
|
+
} else if (huePrime < 2) {
|
|
68
|
+
[r, g, b] = [second, chroma, 0];
|
|
69
|
+
} else if (huePrime < 3) {
|
|
70
|
+
[r, g, b] = [0, chroma, second];
|
|
71
|
+
} else if (huePrime < 4) {
|
|
72
|
+
[r, g, b] = [0, second, chroma];
|
|
73
|
+
} else if (huePrime < 5) {
|
|
74
|
+
[r, g, b] = [second, 0, chroma];
|
|
75
|
+
} else {
|
|
76
|
+
[r, g, b] = [chroma, 0, second];
|
|
77
|
+
}
|
|
78
|
+
const match = l - chroma / 2;
|
|
79
|
+
const red = Math.round((r + match) * 255);
|
|
80
|
+
const green = Math.round((g + match) * 255);
|
|
81
|
+
const blue = Math.round((b + match) * 255);
|
|
82
|
+
if (alphaPart !== undefined && alphaPart !== '') {
|
|
83
|
+
const alpha = alphaPart.endsWith('%') ? parseFloat(alphaPart) / 100 : parseFloat(alphaPart);
|
|
84
|
+
const safeAlpha = Number.isFinite(alpha) ? alpha : 1;
|
|
85
|
+
return `rgb(${red} ${green} ${blue} / ${safeAlpha})`;
|
|
86
|
+
}
|
|
87
|
+
return `rgb(${red} ${green} ${blue})`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Resolve a preset's canonical runtime color tokens to sRGB `rgb(...)` strings.
|
|
92
|
+
*
|
|
93
|
+
* THE single source of runtime color tokens for the whole library, on BOTH web
|
|
94
|
+
* and native. Takes the raw triple map from `getPresetVars(preset, mode)` (base
|
|
95
|
+
* + extended) and converts every value that looks like an HSL triple via
|
|
96
|
+
* `hslToSrgb`. Non-triple values (already-resolved colors, length/radius tokens)
|
|
97
|
+
* pass through unchanged. Keys retain the `--` prefix, so each `--x` token IS a
|
|
98
|
+
* full CSS color — no resolved-color companion universe, no per-platform wrapping.
|
|
99
|
+
*
|
|
100
|
+
* The result is frozen by the golden parity fixture
|
|
101
|
+
* (`__fixtures__/golden-resolved-tokens.json`), guaranteeing the visible palette
|
|
102
|
+
* matches the previous resolved-color pipeline byte-for-byte.
|
|
103
|
+
*/
|
|
104
|
+
export function getResolvedTokens(preset, mode) {
|
|
105
|
+
const raw = getPresetVars(preset, mode);
|
|
106
|
+
const resolved = {};
|
|
107
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
108
|
+
resolved[key] = RAW_HSL_TRIPLE.test(value) ? hslToSrgb(value) : value;
|
|
109
|
+
}
|
|
110
|
+
return resolved;
|
|
111
|
+
}
|
|
112
|
+
export { APP_COLOR_NAMES };
|
|
113
|
+
//# sourceMappingURL=token-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["APP_COLOR_NAMES","getPresetVars","CANONICAL_TOKENS","RAW_HSL_TRIPLE","hslToSrgb","triple","colorPart","alphaPart","split","map","part","trim","channels","filter","Boolean","hue","parseFloat","replace","sat","light","h","Number","isFinite","s","l","chroma","Math","abs","huePrime","second","r","g","b","match","red","round","green","blue","undefined","alpha","endsWith","safeAlpha","getResolvedTokens","preset","mode","raw","resolved","key","value","Object","entries","test"],"sourceRoot":"../../../src","sources":["theme/token-registry.ts"],"mappings":";;AAAA,SAASA,eAAe,QAA2B,oBAAiB;AACpE,SAASC,aAAa,QAAQ,kBAAe;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,CAC9B,YAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,iBAAiBA,CAC/BC,MAAoB,EACpBC,IAAsB,EACE;EACxB,MAAMC,GAAG,GAAG5C,aAAa,CAAC0C,MAAM,EAAEC,IAAI,CAAC;EACvC,MAAME,QAAgC,GAAG,CAAC,CAAC;EAC3C,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,GAAG,CAAC,EAAE;IAC9CC,QAAQ,CAACC,GAAG,CAAC,GAAG5C,cAAc,CAACgD,IAAI,CAACH,KAAK,CAAC,GAAG5C,SAAS,CAAC4C,KAAK,CAAC,GAAGA,KAAK;EACvE;EACA,OAAOF,QAAQ;AACjB;AAEA,SAAS9C,eAAe","ignoreList":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type AppColorName } from './color-presets';
|
|
2
|
-
export { toWebColorValue } from './preset-vars';
|
|
3
2
|
export declare function applyDarkClass(resolved: 'light' | 'dark'): void;
|
|
4
3
|
/**
|
|
5
4
|
* Apply a color preset's CSS custom properties to the document root.
|
|
@@ -9,16 +8,12 @@ export declare function applyDarkClass(resolved: 'light' | 'dark'): void;
|
|
|
9
8
|
* -------------------------------------------------------------------
|
|
10
9
|
* The shadcn/Tailwind-v4 web apps compile their color utilities to reference the
|
|
11
10
|
* BASE token directly (`.bg-background { background-color: var(--background) }`),
|
|
12
|
-
* so on web the base `--x` tokens MUST be FULL CSS colors.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* unchanged. See `toWebColorValue`.
|
|
11
|
+
* so on web the base `--x` tokens MUST be FULL CSS colors. `getResolvedTokens`
|
|
12
|
+
* returns every canonical token already resolved to an sRGB `rgb(...)` string,
|
|
13
|
+
* so `var(--x)` resolves to a valid color directly — no per-value wrapping. The
|
|
14
|
+
* same rgb values feed native (`color-mix` alpha utilities resolve on sRGB), so
|
|
15
|
+
* web and native share one canonical token pipeline.
|
|
18
16
|
*
|
|
19
|
-
* NATIVE writes the SAME tokens as RAW HSL triples (no `hsl()` wrapper) via
|
|
20
|
-
* `rootVariables` (`native-root-vars.native.ts`), consumed through bloom's
|
|
21
|
-
* native `global.css` `hsl(var(--x))` indirection — that path is untouched here.
|
|
22
17
|
* Includes extended tokens (card, chart-*, content-area, sidebar-*) so consumer
|
|
23
18
|
* apps don't need to synthesize them.
|
|
24
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,QAIxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,QAUpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/build-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"build-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/build-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAyFX;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,OAAO,GAAG,MAAM,EAC1B,UAAU,GAAE,OAAe,GAC1B,KAAK,CAUP"}
|
|
@@ -5,17 +5,17 @@ export type AppColorName = 'teal' | 'blue' | 'green' | 'amber' | 'yellow' | 'red
|
|
|
5
5
|
* Keys carry a leading `--` for historical reasons (shadcn-style CSS variable
|
|
6
6
|
* names) — keep in mind the values are platform-agnostic **raw HSL triples**
|
|
7
7
|
* (e.g. `'185 100% 20%'` or `'185 100% 20% / 0.5'`), not CSS-resolved colors.
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* The single canonical resolver `getResolvedTokens` (in `token-registry.ts`)
|
|
9
|
+
* converts this raw map to sRGB `rgb(...)` for every runtime write — the same
|
|
10
|
+
* values drive BOTH layers:
|
|
11
|
+
* - the web layer: `getResolvedTokens`'s `rgb(...)` strings are written to
|
|
12
|
+
* `document.documentElement` / a `BloomColorScope` element, so `var(--x)` —
|
|
13
|
+
* the form Tailwind v4 `@theme inline` compiles its color utilities to —
|
|
14
|
+
* resolves to a valid color directly, and
|
|
15
15
|
* - the native layer (`buildTheme` resolves the raw triples into `hsl(...)`
|
|
16
16
|
* strings consumable by React Native styles; `native-root-vars.native.ts`
|
|
17
|
-
* writes the
|
|
18
|
-
*
|
|
17
|
+
* writes the same canonical `rgb(...)` values into react-native-css's
|
|
18
|
+
* `rootVariables` family).
|
|
19
19
|
*
|
|
20
20
|
* The `--` prefix is an implementation detail we will drop in a future major.
|
|
21
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAiBrD,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuBD,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,OAAe,EACf,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,2CA4CtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAAC,aAAa,CAUjF"}
|
|
@@ -13,8 +13,11 @@ export type VariableContextProviderComponent = React.ComponentType<{
|
|
|
13
13
|
}>;
|
|
14
14
|
/**
|
|
15
15
|
* Build the CSS custom-property map for a preset, ready to be applied to a
|
|
16
|
-
* subtree.
|
|
17
|
-
*
|
|
16
|
+
* subtree. Every token is resolved to an sRGB `rgb(...)` string via
|
|
17
|
+
* `getResolvedTokens` — the single canonical token pipeline shared by web and
|
|
18
|
+
* native — so Tailwind v4 `@theme` utilities (e.g. `bg-background`) and
|
|
19
|
+
* `color-mix`-based alpha utilities (`bg-primary/10`) both resolve against the
|
|
20
|
+
* same color values. Keys retain the leading `--`.
|
|
18
21
|
*/
|
|
19
22
|
export declare function buildScopeVars(colorPreset: AppColorName, mode: 'light' | 'dark'): Record<string, string>;
|
|
20
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-builder.d.ts","sourceRoot":"","sources":["../../../../../src/theme/color-scope/style-builder.ts"],"names":[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0 +1,28 @@
|
|
|
1
|
+
export interface Oklch {
|
|
2
|
+
l: number;
|
|
3
|
+
c: number;
|
|
4
|
+
h: number;
|
|
5
|
+
}
|
|
6
|
+
export interface Rgb {
|
|
7
|
+
r: number;
|
|
8
|
+
g: number;
|
|
9
|
+
b: number;
|
|
10
|
+
}
|
|
11
|
+
/** OKLCH → linear OKLab → linear sRGB → gamma sRGB → 0..255. Pure. */
|
|
12
|
+
export declare function oklchToSrgb({ l, c, h }: Oklch): Rgb;
|
|
13
|
+
export declare function srgbToRgbString({ r, g, b }: Rgb, alpha?: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Parse an `rgb(...)` / `rgba(...)` string into an {@link Rgb}.
|
|
16
|
+
*
|
|
17
|
+
* Contract: input MUST be an `rgb(...)` / `rgba(...)` string (e.g. a resolved
|
|
18
|
+
* token from `getResolvedTokens`). Both modern (`rgb(r g b)`) and legacy
|
|
19
|
+
* (`rgb(r, g, b)`) syntaxes are accepted. Anything else throws — this is a
|
|
20
|
+
* canonical-pipeline primitive and a non-rgb input signals a real bug at the
|
|
21
|
+
* call site, never a value to silently coerce to black.
|
|
22
|
+
*
|
|
23
|
+
* @throws {Error} if `s` is not an `rgb()` / `rgba()` string.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseRgbString(s: string): Rgb;
|
|
26
|
+
/** Cheap perceptual-ish distance in sRGB (sufficient for a ≤1 rounding gate). */
|
|
27
|
+
export declare function deltaE(a: Rgb, b: Rgb): number;
|
|
28
|
+
//# sourceMappingURL=color-space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-space.d.ts","sourceRoot":"","sources":["../../../../src/theme/color-space.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AAC1D,MAAM,WAAW,GAAG;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;AAMxD,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,GAAG,GAAG,CAgBnD;AAED,wBAAgB,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAO7C;AAED,iFAAiF;AACjF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAE7C"}
|
|
@@ -7,8 +7,7 @@ export { useTheme, useThemeColor, useBloomTheme } from './use-theme';
|
|
|
7
7
|
export type { Theme, ThemeColors, ThemeMode } from './types';
|
|
8
8
|
export type { AppColorName, AppColorPreset, PresetTokens } from './color-presets';
|
|
9
9
|
export { APP_COLOR_NAMES, PREMIUM_COLOR_NAMES, APP_COLOR_PRESETS, HEX_TO_APP_COLOR, hexToAppColorName, } from './color-presets';
|
|
10
|
-
export { getPresetVars, applyPresetVarsToDocument
|
|
11
|
-
export type { PresetVarsOptions } from './preset-vars';
|
|
10
|
+
export { getPresetVars, applyPresetVarsToDocument } from './preset-vars';
|
|
12
11
|
export { applyDarkClass } from './apply-dark-class';
|
|
13
12
|
export { setColorSchemeSafe } from './set-color-scheme-safe';
|
|
14
13
|
export { initCssInteropDarkMode } from './init-css-interop';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,sBAAs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zB,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -21,18 +21,28 @@ import { type AppColorName } from './color-presets';
|
|
|
21
21
|
* `BloomThemeProvider`'s `VariableContextProvider` only feeds path #1, so the navigator
|
|
22
22
|
* host and every portal/modal — which render outside that subtree — never see the
|
|
23
23
|
* preset vars and fall through to `rootVariables`/`universalVariables`. By default those
|
|
24
|
-
* families hold only react-native-css's own `__rn-css-rem`/`__rn-css-color` entries
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* content resolves the palette identically regardless of React-tree position.
|
|
24
|
+
* families hold only react-native-css's own `__rn-css-rem`/`__rn-css-color` entries, so
|
|
25
|
+
* the whole tree below the navigator renders monochrome until the palette is injected at
|
|
26
|
+
* runtime. Writing the vars into `rootVariables` here is the exact same mechanism
|
|
27
|
+
* react-native-css uses for compiled `:root {}` / `@theme` vars (`StyleCollection.inject`
|
|
28
|
+
* does `rootVariables(name).set(valueArray)`), so portaled content resolves the palette
|
|
29
|
+
* identically regardless of React-tree position.
|
|
31
30
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
31
|
+
* Consumer contract (CRITICAL — single canonical color pipeline)
|
|
32
|
+
* -------------------------------------------------------------
|
|
33
|
+
* Each base `--x` token is now written as a FULL `rgb(...)` color (not a raw HSL
|
|
34
|
+
* triple). A consuming app's Tailwind `@theme` must therefore reference these
|
|
35
|
+
* base tokens DIRECTLY (its Tailwind color var equals `var(--x)`) and must NOT
|
|
36
|
+
* wrap them in `hsl(...)`. The legacy `hsl(var(--x))` indirection (which assumed
|
|
37
|
+
* a raw triple) would produce the invalid `hsl(rgb(...))` and must be removed in
|
|
38
|
+
* every consumer. Web and native now share this one contract.
|
|
39
|
+
*
|
|
40
|
+
* Every token is written as an sRGB `rgb(...)` string from the single canonical
|
|
41
|
+
* token pipeline (`getResolvedTokens`) — `primary: 'rgb(31 153 239)'` — the SAME
|
|
42
|
+
* values web writes to `document.documentElement`. sRGB is the space
|
|
43
|
+
* react-native-css's `color-mix` resolver registers, so `color-mix`-based alpha
|
|
44
|
+
* utilities (`bg-primary/10`) resolve on native; full (non-alpha) utilities
|
|
45
|
+
* resolve directly through bloom's `global.css` `var(--x)` indirection.
|
|
36
46
|
*
|
|
37
47
|
* Why a STATIC `import`, not a runtime `require` (critical)
|
|
38
48
|
* ---------------------------------------------------------
|
|
@@ -62,15 +72,15 @@ import { type AppColorName } from './color-presets';
|
|
|
62
72
|
* `shared.rootVariables[name]`, and `@property --x` goes through
|
|
63
73
|
* `name.startsWith("--") ? name.slice(2) : name`. The lookup side matches: a `var(--x)`
|
|
64
74
|
* reference compiles to `[{}, "var", ident.slice(2)]`, so `varResolver` looks up the
|
|
65
|
-
* bare name. `
|
|
66
|
-
* writing each entry.
|
|
75
|
+
* bare name. `getResolvedTokens` returns keys WITH the `--` prefix, so we strip it
|
|
76
|
+
* before writing each entry.
|
|
67
77
|
*
|
|
68
78
|
* Value shape
|
|
69
79
|
* -----------
|
|
70
80
|
* Each entry is a `VariableValue[]` — an array of `[value, mediaCondition?]` tuples.
|
|
71
81
|
* Bloom's preset vars are unconditional, so each is a single-element `[[value]]`, e.g.
|
|
72
|
-
* `rootVariables('primary').set([['
|
|
73
|
-
* emits for unconditional `:root` vars.
|
|
82
|
+
* `rootVariables('primary').set([['rgb(31 153 239)']])`. This is the same shape the
|
|
83
|
+
* compiler emits for unconditional `:root` vars.
|
|
74
84
|
*
|
|
75
85
|
* This is native-only and additive: the `VariableContextProvider` wrapper stays (it is
|
|
76
86
|
* the correct, scoped mechanism for `BloomColorScope` subtree overrides and harmlessly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-root-vars.native.d.ts","sourceRoot":"","sources":["../../../../src/theme/native-root-vars.native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-root-vars.native.d.ts","sourceRoot":"","sources":["../../../../src/theme/native-root-vars.native.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAS3F"}
|
|
@@ -1,72 +1,4 @@
|
|
|
1
1
|
import { type AppColorName, type PresetTokens } from './color-presets';
|
|
2
|
-
/**
|
|
3
|
-
* Convert a shadcn-style HSL triple (`'H S% L%'`, optionally with an alpha tail
|
|
4
|
-
* `'H S% L% / A'`) into an sRGB `rgb(...)` string.
|
|
5
|
-
*
|
|
6
|
-
* Why rgb and not hsl (the native alpha-utility bug this fixes)
|
|
7
|
-
* -------------------------------------------------------------
|
|
8
|
-
* Tailwind v4 compiles an alpha-on-theme-color utility (`bg-primary/10`) into a
|
|
9
|
-
* `color-mix(... var(--color-primary) 10%, transparent)` declaration. On native,
|
|
10
|
-
* react-native-css resolves that `color-mix` at runtime via `colorjs.io/fn`, but
|
|
11
|
-
* its `color-mix` implementation registers ONLY the `sRGB`, `P3`, and `OKLab`
|
|
12
|
-
* color spaces — never `HSL`. So if `--color-primary` resolves to an `hsl(...)`
|
|
13
|
-
* string, `parse('hsl(...)')` throws, the mix is swallowed, and the utility
|
|
14
|
-
* silently produces no color. Emitting the resolved var as `rgb(...)` (a space
|
|
15
|
-
* colorjs.io always has registered) makes the alpha utilities resolve on native,
|
|
16
|
-
* matching web. Full (non-alpha) utilities already worked because React Native's
|
|
17
|
-
* native color parser handles `hsl()` directly; only `color-mix` was affected.
|
|
18
|
-
*
|
|
19
|
-
* Output is space-separated channels (`rgb(31 153 239)`), the modern CSS syntax
|
|
20
|
-
* parsed by both `colorjs.io/fn` (with only sRGB/P3/OKLab registered) and
|
|
21
|
-
* react-native-web / browsers. An alpha tail emits `rgb(r g b / a)`, likewise
|
|
22
|
-
* parsed by both.
|
|
23
|
-
*
|
|
24
|
-
* Pure function — standard HSL→sRGB conversion, channels rounded to integers.
|
|
25
|
-
* Tolerates a `deg` suffix on the hue and `%` suffixes on saturation/lightness.
|
|
26
|
-
*/
|
|
27
|
-
export declare function hslTripletToRgb(triplet: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Transform a single preset var into the value to write to a WEB element
|
|
30
|
-
* (`document.documentElement` or a `BloomColorScope` subtree element).
|
|
31
|
-
*
|
|
32
|
-
* The web apps (Vite + Tailwind v4 + shadcn) compile their `@theme inline`
|
|
33
|
-
* block so the color utilities reference the BASE token directly — e.g.
|
|
34
|
-
* `.bg-background { background-color: var(--background) }`. So on web the base
|
|
35
|
-
* `--x` tokens MUST resolve to a COMPLETE CSS color; a bare HSL triple
|
|
36
|
-
* (`185 50% 5%`) is invalid as a `background-color` value and renders
|
|
37
|
-
* transparent (the production incident this fixes). We therefore wrap raw
|
|
38
|
-
* triples in `hsl(...)`, preserving the exact preset color math (and any `/ A`
|
|
39
|
-
* alpha tail, valid in modern `hsl(H S% L% / A)` syntax) with zero rounding
|
|
40
|
-
* drift.
|
|
41
|
-
*
|
|
42
|
-
* Values that are already full colors pass through unchanged:
|
|
43
|
-
* - `--color-*` resolved vars (already `rgb(...)` from `getPresetVars`),
|
|
44
|
-
* - any value not shaped like a raw HSL triple (`--radius: 0.5rem`,
|
|
45
|
-
* pre-resolved `rgb(...)`/`hsl(...)`, etc.).
|
|
46
|
-
*
|
|
47
|
-
* NATIVE never calls this — `getPresetVars` returns raw triples verbatim and
|
|
48
|
-
* `native-root-vars.native.ts` writes them through bloom's `hsl(var(--x))`
|
|
49
|
-
* native `global.css` indirection. Pure function — no side effects — so it is
|
|
50
|
-
* unit-testable in isolation.
|
|
51
|
-
*/
|
|
52
|
-
export declare function toWebColorValue(key: string, value: string): string;
|
|
53
|
-
export interface PresetVarsOptions {
|
|
54
|
-
/**
|
|
55
|
-
* Also emit Tailwind v4 resolved `--color-*` vars (as sRGB `rgb(...)` strings)
|
|
56
|
-
* alongside the raw HSL triples. Needed when scoping a subtree where
|
|
57
|
-
* Tailwind's `@theme` block has already precomputed `--color-*` at `:root`,
|
|
58
|
-
* so overriding `--background` alone wouldn't cascade to `bg-background`.
|
|
59
|
-
*
|
|
60
|
-
* The resolved vars are emitted as `rgb(...)` rather than `hsl(...)` so the
|
|
61
|
-
* alpha-on-theme-color utilities (`bg-primary/10`, `text-foreground/50`)
|
|
62
|
-
* resolve on native: Tailwind compiles those to a runtime `color-mix(...)` that
|
|
63
|
-
* react-native-css evaluates via `colorjs.io/fn`, which only registers the
|
|
64
|
-
* sRGB/P3/OKLab spaces (not HSL) — so an `hsl(...)` var would throw and the
|
|
65
|
-
* utility would silently render no color. See `hslTripletToRgb`. Default
|
|
66
|
-
* `false`.
|
|
67
|
-
*/
|
|
68
|
-
includeResolvedColorVars?: boolean;
|
|
69
|
-
}
|
|
70
2
|
/**
|
|
71
3
|
* Bloom's base preset tokens extended with the surface/card/chart/sidebar
|
|
72
4
|
* tokens that apps layer on top of the core shadcn palette. Synthesized from
|
|
@@ -74,18 +6,23 @@ export interface PresetVarsOptions {
|
|
|
74
6
|
*
|
|
75
7
|
* This is the single source of truth for extended theming vars — consumer apps
|
|
76
8
|
* must not redefine these per-app.
|
|
9
|
+
*
|
|
10
|
+
* Values are platform-agnostic **raw HSL triples** (`'185 100% 20%'`, optionally
|
|
11
|
+
* with a `/ A` alpha tail). The single canonical resolver `getResolvedTokens`
|
|
12
|
+
* (in `token-registry.ts`) converts these to sRGB `rgb(...)` for BOTH web and
|
|
13
|
+
* native runtime writes — this function only produces the raw triple map.
|
|
77
14
|
*/
|
|
78
|
-
export declare function getPresetVars(colorName: AppColorName, mode: 'light' | 'dark'
|
|
15
|
+
export declare function getPresetVars(colorName: AppColorName, mode: 'light' | 'dark'): PresetTokens;
|
|
79
16
|
/**
|
|
80
17
|
* Apply a preset's extended vars to `document.documentElement`. Web-only no-op
|
|
81
18
|
* on native. `BloomThemeProvider` already writes the base preset vars on web;
|
|
82
19
|
* call this only when an app needs the extended (card/chart/sidebar) tokens on
|
|
83
20
|
* the document root.
|
|
84
21
|
*
|
|
85
|
-
*
|
|
86
|
-
* `
|
|
87
|
-
*
|
|
88
|
-
*
|
|
22
|
+
* Tokens are resolved to sRGB `rgb(...)` via the single canonical
|
|
23
|
+
* `getResolvedTokens` pipeline, so `var(--x)` — the form Tailwind v4
|
|
24
|
+
* `@theme inline` compiles its color utilities to — resolves directly to a
|
|
25
|
+
* valid color on web.
|
|
89
26
|
*/
|
|
90
|
-
export declare function applyPresetVarsToDocument(colorName: AppColorName, mode: 'light' | 'dark'
|
|
27
|
+
export declare function applyPresetVarsToDocument(colorName: AppColorName, mode: 'light' | 'dark'): void;
|
|
91
28
|
//# sourceMappingURL=preset-vars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-vars.d.ts","sourceRoot":"","sources":["../../../../src/theme/preset-vars.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"preset-vars.d.ts","sourceRoot":"","sources":["../../../../src/theme/preset-vars.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAe1F;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,YAAY,CAiCd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,IAAI,CAQN"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { APP_COLOR_NAMES, type AppColorName } from './color-presets';
|
|
2
|
+
/**
|
|
3
|
+
* The canonical set of Bloom theme token names — WITHOUT the leading `--`.
|
|
4
|
+
*
|
|
5
|
+
* This is the single source of truth for which tokens a preset produces. It
|
|
6
|
+
* covers exactly the keys returned by `getPresetVars(name, mode)` (the base
|
|
7
|
+
* shadcn palette plus the synthesized extended tokens: card/chart/content-area/
|
|
8
|
+
* sidebar-*). The list is intentionally hand-maintained and verified by
|
|
9
|
+
* `token-registry.test.ts` against the live `getPresetVars('oxy', 'light')`
|
|
10
|
+
* output, so any drift in the preset shape fails CI.
|
|
11
|
+
*
|
|
12
|
+
* Order mirrors `getPresetVars`'s insertion order: base tokens first (in the
|
|
13
|
+
* order they appear in the preset data), then the synthesized extended tokens.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CANONICAL_TOKENS: readonly ["background", "foreground", "surface", "surface-foreground", "popover", "popover-foreground", "primary", "primary-foreground", "secondary", "secondary-foreground", "muted", "muted-foreground", "accent", "accent-foreground", "destructive", "border", "input", "ring", "sidebar", "card", "card-foreground", "chart-1", "chart-2", "chart-3", "chart-4", "chart-5", "content-area", "sidebar-foreground", "sidebar-primary", "sidebar-primary-foreground", "sidebar-accent", "sidebar-accent-foreground", "sidebar-border", "sidebar-ring"];
|
|
16
|
+
/** A canonical token name (no leading `--`). */
|
|
17
|
+
export type CanonicalToken = (typeof CANONICAL_TOKENS)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Convert a shadcn-style HSL triple (`'H S% L%'`, optionally with an alpha tail
|
|
20
|
+
* `'H S% L% / A'`) into an sRGB `rgb(...)` string.
|
|
21
|
+
*
|
|
22
|
+
* Standard HSL→sRGB math with integer-rounded channels and modern
|
|
23
|
+
* space-separated output (`rgb(r g b)` / `rgb(r g b / a)`). This is the SINGLE
|
|
24
|
+
* conversion the whole library uses — web document writes, web scope vars, and
|
|
25
|
+
* native `rootVariables` all flow through `getResolvedTokens`, which calls this.
|
|
26
|
+
* The byte-for-byte output is frozen by the golden parity fixture
|
|
27
|
+
* (`__fixtures__/golden-resolved-tokens.json`), so the visible palette cannot
|
|
28
|
+
* drift.
|
|
29
|
+
*
|
|
30
|
+
* Task 2's `oklchToSrgb` (in `color-space.ts`) stays available for a FUTURE
|
|
31
|
+
* OKLCH re-authoring of the seed palette; it is intentionally NOT used here —
|
|
32
|
+
* routing through OKLCH would shift the rounded channels off the frozen palette.
|
|
33
|
+
*
|
|
34
|
+
* Pure function — no side effects.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hslToSrgb(triple: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a preset's canonical runtime color tokens to sRGB `rgb(...)` strings.
|
|
39
|
+
*
|
|
40
|
+
* THE single source of runtime color tokens for the whole library, on BOTH web
|
|
41
|
+
* and native. Takes the raw triple map from `getPresetVars(preset, mode)` (base
|
|
42
|
+
* + extended) and converts every value that looks like an HSL triple via
|
|
43
|
+
* `hslToSrgb`. Non-triple values (already-resolved colors, length/radius tokens)
|
|
44
|
+
* pass through unchanged. Keys retain the `--` prefix, so each `--x` token IS a
|
|
45
|
+
* full CSS color — no resolved-color companion universe, no per-platform wrapping.
|
|
46
|
+
*
|
|
47
|
+
* The result is frozen by the golden parity fixture
|
|
48
|
+
* (`__fixtures__/golden-resolved-tokens.json`), guaranteeing the visible palette
|
|
49
|
+
* matches the previous resolved-color pipeline byte-for-byte.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getResolvedTokens(preset: AppColorName, mode: 'light' | 'dark'): Record<string, string>;
|
|
52
|
+
export { APP_COLOR_NAMES };
|
|
53
|
+
//# sourceMappingURL=token-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-registry.d.ts","sourceRoot":"","sources":["../../../../src/theme/token-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGrE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,0hBAmCnB,CAAC;AAEX,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAW/D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA+ChD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,OAAO,GAAG,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -10,8 +10,11 @@ export interface ThemeColors {
|
|
|
10
10
|
borderLight: string;
|
|
11
11
|
primary: string;
|
|
12
12
|
primaryForeground: string;
|
|
13
|
+
/** Legacy alias: the page surface tint (`--surface`), NOT a brand accent. */
|
|
13
14
|
primaryLight: string;
|
|
15
|
+
/** Legacy alias: the page background (`--background`), NOT the focus ring. */
|
|
14
16
|
primaryDark: string;
|
|
17
|
+
/** Legacy alias: mirrors `primary` (`--primary`) for backwards compatibility. */
|
|
15
18
|
secondary: string;
|
|
16
19
|
tint: string;
|
|
17
20
|
icon: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/theme/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type AppColorName } from './color-presets';
|
|
2
|
-
export { toWebColorValue } from './preset-vars';
|
|
3
2
|
export declare function applyDarkClass(resolved: 'light' | 'dark'): void;
|
|
4
3
|
/**
|
|
5
4
|
* Apply a color preset's CSS custom properties to the document root.
|
|
@@ -9,16 +8,12 @@ export declare function applyDarkClass(resolved: 'light' | 'dark'): void;
|
|
|
9
8
|
* -------------------------------------------------------------------
|
|
10
9
|
* The shadcn/Tailwind-v4 web apps compile their color utilities to reference the
|
|
11
10
|
* BASE token directly (`.bg-background { background-color: var(--background) }`),
|
|
12
|
-
* so on web the base `--x` tokens MUST be FULL CSS colors.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* unchanged. See `toWebColorValue`.
|
|
11
|
+
* so on web the base `--x` tokens MUST be FULL CSS colors. `getResolvedTokens`
|
|
12
|
+
* returns every canonical token already resolved to an sRGB `rgb(...)` string,
|
|
13
|
+
* so `var(--x)` resolves to a valid color directly — no per-value wrapping. The
|
|
14
|
+
* same rgb values feed native (`color-mix` alpha utilities resolve on sRGB), so
|
|
15
|
+
* web and native share one canonical token pipeline.
|
|
18
16
|
*
|
|
19
|
-
* NATIVE writes the SAME tokens as RAW HSL triples (no `hsl()` wrapper) via
|
|
20
|
-
* `rootVariables` (`native-root-vars.native.ts`), consumed through bloom's
|
|
21
|
-
* native `global.css` `hsl(var(--x))` indirection — that path is untouched here.
|
|
22
17
|
* Includes extended tokens (card, chart-*, content-area, sidebar-*) so consumer
|
|
23
18
|
* apps don't need to synthesize them.
|
|
24
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-dark-class.d.ts","sourceRoot":"","sources":["../../../../src/theme/apply-dark-class.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,QAIxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,QAUpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/build-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"build-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/build-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAyFX;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,OAAO,GAAG,MAAM,EAC1B,UAAU,GAAE,OAAe,GAC1B,KAAK,CAUP"}
|
|
@@ -5,17 +5,17 @@ export type AppColorName = 'teal' | 'blue' | 'green' | 'amber' | 'yellow' | 'red
|
|
|
5
5
|
* Keys carry a leading `--` for historical reasons (shadcn-style CSS variable
|
|
6
6
|
* names) — keep in mind the values are platform-agnostic **raw HSL triples**
|
|
7
7
|
* (e.g. `'185 100% 20%'` or `'185 100% 20% / 0.5'`), not CSS-resolved colors.
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* The single canonical resolver `getResolvedTokens` (in `token-registry.ts`)
|
|
9
|
+
* converts this raw map to sRGB `rgb(...)` for every runtime write — the same
|
|
10
|
+
* values drive BOTH layers:
|
|
11
|
+
* - the web layer: `getResolvedTokens`'s `rgb(...)` strings are written to
|
|
12
|
+
* `document.documentElement` / a `BloomColorScope` element, so `var(--x)` —
|
|
13
|
+
* the form Tailwind v4 `@theme inline` compiles its color utilities to —
|
|
14
|
+
* resolves to a valid color directly, and
|
|
15
15
|
* - the native layer (`buildTheme` resolves the raw triples into `hsl(...)`
|
|
16
16
|
* strings consumable by React Native styles; `native-root-vars.native.ts`
|
|
17
|
-
* writes the
|
|
18
|
-
*
|
|
17
|
+
* writes the same canonical `rgb(...)` values into react-native-css's
|
|
18
|
+
* `rootVariables` family).
|
|
19
19
|
*
|
|
20
20
|
* The `--` prefix is an implementation detail we will drop in a future major.
|
|
21
21
|
*/
|