@cognitap/radiant 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +19 -15
  3. package/dist/library/color/colorFamilies.d.ts +3 -0
  4. package/dist/library/color/colorFamilies.d.ts.map +1 -0
  5. package/dist/library/color/colorFamilies.js +20 -0
  6. package/dist/library/color/colorFamilies.js.map +1 -0
  7. package/dist/library/color/generateColorWall.d.ts +54 -0
  8. package/dist/library/color/generateColorWall.d.ts.map +1 -0
  9. package/dist/library/color/generateColorWall.js +231 -0
  10. package/dist/library/color/generateColorWall.js.map +1 -0
  11. package/dist/library/color/index.d.ts +5 -0
  12. package/dist/library/color/index.d.ts.map +1 -0
  13. package/dist/library/color/index.js +3 -0
  14. package/dist/library/color/index.js.map +1 -0
  15. package/dist/library/color/oklch.d.ts +17 -0
  16. package/dist/library/color/oklch.d.ts.map +1 -0
  17. package/dist/library/color/oklch.js +79 -0
  18. package/dist/library/color/oklch.js.map +1 -0
  19. package/dist/library/color/recommendColorPalette.d.ts +65 -0
  20. package/dist/library/color/recommendColorPalette.d.ts.map +1 -0
  21. package/dist/library/color/recommendColorPalette.js +263 -0
  22. package/dist/library/color/recommendColorPalette.js.map +1 -0
  23. package/dist/library/index.d.ts +8 -2
  24. package/dist/library/index.d.ts.map +1 -1
  25. package/dist/library/index.js +4 -1
  26. package/dist/library/index.js.map +1 -1
  27. package/dist/library/styles.css +1 -1
  28. package/dist/library/themes/index.d.ts +4 -0
  29. package/dist/library/themes/index.d.ts.map +1 -1
  30. package/dist/library/themes/index.js +2 -0
  31. package/dist/library/themes/index.js.map +1 -1
  32. package/dist/library/themes/themeDocument.d.ts +16 -0
  33. package/dist/library/themes/themeDocument.d.ts.map +1 -0
  34. package/dist/library/themes/themeDocument.js +307 -0
  35. package/dist/library/themes/themeDocument.js.map +1 -0
  36. package/dist/library/themes/themeDocumentTypes.d.ts +69 -0
  37. package/dist/library/themes/themeDocumentTypes.d.ts.map +1 -0
  38. package/dist/library/themes/themeDocumentTypes.js +2 -0
  39. package/dist/library/themes/themeDocumentTypes.js.map +1 -0
  40. package/dist/library/themes/updateThemeAppearance.d.ts +29 -0
  41. package/dist/library/themes/updateThemeAppearance.d.ts.map +1 -0
  42. package/dist/library/themes/updateThemeAppearance.js +138 -0
  43. package/dist/library/themes/updateThemeAppearance.js.map +1 -0
  44. package/docs/system.md +13 -0
  45. package/docs/theming.md +412 -0
  46. package/package.json +11 -4
  47. package/src/color/colorFamilies.ts +19 -0
  48. package/src/color/generateColorWall.ts +358 -0
  49. package/src/color/index.ts +11 -0
  50. package/src/color/oklch.ts +95 -0
  51. package/src/color/recommendColorPalette.ts +375 -0
  52. package/src/index.ts +37 -0
  53. package/src/themes/index.ts +24 -0
  54. package/src/themes/themeDocument.ts +340 -0
  55. package/src/themes/themeDocumentTypes.ts +76 -0
  56. package/src/themes/updateThemeAppearance.ts +172 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,48 @@ See the [release policy](RELEASE_POLICY.md) for versioning and migration rules.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.0.4
8
+
9
+ - Expose independent Classic, Balanced and Expressive wall/brand-ramp presets,
10
+ with Balanced defaults, separate vividness controls and materialised replay.
11
+ Semantic action fills now choose the nearby readable brand shade at 4.5:1
12
+ text and 3:1 surface boundaries; explicit semantic overrides stay authored.
13
+
14
+ Experimental, additive workshop APIs for portable theme documents, deterministic
15
+ color walls, semantic palettes and bounded appearance controls. Existing 0.0.3
16
+ components and themes require no migration. See `docs/theming.md` for the
17
+ document format, merge/replace rules, supported controls and installed CSS routes.
18
+ Output is opaque sRGB; Display P3 generation and font loading are not included.
19
+ Automated Chromium and installed-consumer checks do not establish manual
20
+ screen-reader, Safari/Firefox or stable-library readiness. The public workshop
21
+ is delivered independently by radiant-docs after it pins this registry release.
22
+
23
+ - Add `updateThemeAppearance` for generated palette/canvas integration and bounded
24
+ spacing, density, radius, border, elevation and backdrop controls (DEV-155).
25
+ Preserve independent modes, unrelated settings and component exceptions;
26
+ compile ordinary theme documents through the existing runtime and CSS routes.
27
+ Add canonical workspace and installed-package appearance verification.
28
+
29
+ - Add working-palette recommendations and semantic light/dark mapping (DEV-154).
30
+ `recommendColorPalette` preserves the exact source and full wall, supports
31
+ deliberate family/role overrides and reports unrounded contrast for named
32
+ pairs, including explicit inactive-control exceptions. Return existing color
33
+ and canvas token layers; inspect real component states using the canonical form.
34
+
35
+ - Add the deterministic OKLCH color-wall generator (DEV-153), available through
36
+ the package root and a React-free `@cognitap/radiant/color` entry. It emits 16
37
+ hue families plus Brand and Neutral ramps, defaults to exact source anchoring
38
+ with reshaped neighbors, exposes bounded calibration controls and returns
39
+ immutable replayable inputs and theme-document-compatible color data. Add
40
+ reference/extreme-case coverage and a Storybook wall inspection story.
41
+
42
+ - Add versioned theme workshop documents (DEV-152): typed token sections,
43
+ source/palette and portable font metadata, full/selective JSON exports,
44
+ explicit merge/replace/reset updates and compilation through the existing
45
+ `defineTheme`/`ThemeScope` contract. Exact brand anchoring is the default policy;
46
+ palette generation and semantic role selection follow separately. Existing
47
+ themes, component exceptions and scope behavior are preserved.
48
+
7
49
  ## 0.0.3
8
50
 
9
51
  Experimental release of the harmonised ten-family system. **Breaking changes**
package/README.md CHANGED
@@ -971,24 +971,28 @@ across component stories and Docs. Defaults are Radiant and System.
971
971
  See the [Storybook guide](docs/storybook.md) for the shared story
972
972
  structure and verification workflow.
973
973
 
974
- | Command | Purpose |
975
- | ---------------------- | ----------------------------------------------------------------------------------- |
976
- | `pnpm storybook` | Develop components in Storybook. |
977
- | `pnpm build` | Build JavaScript, declarations, and CSS into `dist/library`. |
978
- | `pnpm watch` | Rebuild on change, except `reset.css` (run `pnpm build` first). |
979
- | `pnpm build:storybook` | Build static Storybook into `dist/storybook`. |
980
- | `pnpm lint` | Run Oxlint, including accessibility rules. |
981
- | `pnpm format` | Format with Oxfmt (`format:check` to check only). |
982
- | `pnpm typecheck` | Check TypeScript. |
983
- | `pnpm test` | Run style tests and verify the packed, installed package. |
984
- | `pnpm test:package` | Verify the packed, installed package only. |
985
- | `pnpm test:browser` | Run Storybook plays and axe in every theme/mode, plus native browser scenarios. |
986
- | `pnpm check` | Run formatting, lint, types, runtime/package/browser tests, and builds, as CI does. |
987
- | `pnpm release:prepare` | Pack and verify a release candidate, then dry-run publishing. |
974
+ | Command | Purpose |
975
+ | ------------------------- | ----------------------------------------------------------------------------------- |
976
+ | `pnpm storybook` | Develop components in Storybook. |
977
+ | `pnpm build` | Build JavaScript, declarations, and CSS into `dist/library`. |
978
+ | `pnpm watch` | Rebuild on change, except `reset.css` (run `pnpm build` first). |
979
+ | `pnpm build:storybook` | Build static Storybook into `dist/storybook`. |
980
+ | `pnpm lint` | Run Oxlint, including accessibility rules. |
981
+ | `pnpm format` | Format with Oxfmt (`format:check` to check only). |
982
+ | `pnpm typecheck` | Check TypeScript. |
983
+ | `pnpm test` | Run style tests and verify the packed, installed package. |
984
+ | `pnpm test:package` | Verify the packed, installed package only. |
985
+ | `pnpm test:browser` | Run Storybook plays and axe in every theme/mode, plus native browser scenarios. |
986
+ | `pnpm test:browser:smoke` | Run every story in Radiant Light/Dark plus native browser scenarios. |
987
+ | `pnpm check:ci` | Run source checks, runtime/package tests, builds, and representative browser tests. |
988
+ | `pnpm check` | Run the full theme, installed styling/composition, and browser audit. |
989
+ | `pnpm release:prepare` | Pack and verify a release candidate, then dry-run publishing. |
988
990
 
989
991
  Package verification installs the archive with npm, so it needs network access.
990
992
  A Husky pre-commit hook formats staged files with Oxfmt.
991
- [CI](.github/workflows/ci.yml) runs `pnpm check`.
993
+ [CI](.github/workflows/ci.yml) runs `pnpm check:ci` for pull requests and pushes
994
+ to `main`. Run `pnpm check` for the exhaustive audit, locally or with the manual
995
+ workflow's **full** input.
992
996
  See [verification conventions](docs/testing.md) for focused browser runs,
993
997
  failure artifacts, and the evidence required by migration issues.
994
998
 
@@ -0,0 +1,3 @@
1
+ /** Stable nominal hue geometry shared by generation and semantic recommendations. */
2
+ export declare const colorFamilies: readonly [readonly ["Red", 25], readonly ["Orange", 55], readonly ["Amber", 80], readonly ["Yellow", 100], readonly ["Lime", 125], readonly ["Green", 145], readonly ["Emerald", 165], readonly ["Teal", 185], readonly ["Cyan", 205], readonly ["Sky", 230], readonly ["Blue", 255], readonly ["Indigo", 275], readonly ["Violet", 295], readonly ["Purple", 315], readonly ["Pink", 340], readonly ["Rose", 10]];
3
+ //# sourceMappingURL=colorFamilies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorFamilies.d.ts","sourceRoot":"","sources":["../../../src/color/colorFamilies.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,eAAO,MAAM,aAAa,oZAiBhB,CAAA"}
@@ -0,0 +1,20 @@
1
+ /** Stable nominal hue geometry shared by generation and semantic recommendations. */
2
+ export const colorFamilies = [
3
+ ['Red', 25],
4
+ ['Orange', 55],
5
+ ['Amber', 80],
6
+ ['Yellow', 100],
7
+ ['Lime', 125],
8
+ ['Green', 145],
9
+ ['Emerald', 165],
10
+ ['Teal', 185],
11
+ ['Cyan', 205],
12
+ ['Sky', 230],
13
+ ['Blue', 255],
14
+ ['Indigo', 275],
15
+ ['Violet', 295],
16
+ ['Purple', 315],
17
+ ['Pink', 340],
18
+ ['Rose', 10]
19
+ ];
20
+ //# sourceMappingURL=colorFamilies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorFamilies.js","sourceRoot":"","sources":["../../../src/color/colorFamilies.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,CAAC,KAAK,EAAE,EAAE,CAAC;IACX,CAAC,QAAQ,EAAE,EAAE,CAAC;IACd,CAAC,OAAO,EAAE,EAAE,CAAC;IACb,CAAC,QAAQ,EAAE,GAAG,CAAC;IACf,CAAC,MAAM,EAAE,GAAG,CAAC;IACb,CAAC,OAAO,EAAE,GAAG,CAAC;IACd,CAAC,SAAS,EAAE,GAAG,CAAC;IAChB,CAAC,MAAM,EAAE,GAAG,CAAC;IACb,CAAC,MAAM,EAAE,GAAG,CAAC;IACb,CAAC,KAAK,EAAE,GAAG,CAAC;IACZ,CAAC,MAAM,EAAE,GAAG,CAAC;IACb,CAAC,QAAQ,EAAE,GAAG,CAAC;IACf,CAAC,QAAQ,EAAE,GAAG,CAAC;IACf,CAAC,QAAQ,EAAE,GAAG,CAAC;IACf,CAAC,MAAM,EAAE,GAAG,CAAC;IACb,CAAC,MAAM,EAAE,EAAE,CAAC;CACJ,CAAA","sourcesContent":["/** Stable nominal hue geometry shared by generation and semantic recommendations. */\nexport const colorFamilies = [\n ['Red', 25],\n ['Orange', 55],\n ['Amber', 80],\n ['Yellow', 100],\n ['Lime', 125],\n ['Green', 145],\n ['Emerald', 165],\n ['Teal', 185],\n ['Cyan', 205],\n ['Sky', 230],\n ['Blue', 255],\n ['Indigo', 275],\n ['Violet', 295],\n ['Purple', 315],\n ['Pink', 340],\n ['Rose', 10]\n] as const\n"]}
@@ -0,0 +1,54 @@
1
+ import type { ThemeBrandSource, ThemeColorSection, ThemePalette } from '../themes/themeDocumentTypes.js';
2
+ export type ColorCalibrationPreset = 'classic' | 'balanced' | 'expressive';
3
+ /** Stable IDs for independently choosing the full wall and exact-brand ramp. */
4
+ export declare const colorCalibrationPresets: readonly [{
5
+ readonly id: "classic";
6
+ readonly name: "Classic";
7
+ readonly description: "Original hue-aware curves and linear anchor reshaping.";
8
+ }, {
9
+ readonly id: "balanced";
10
+ readonly name: "Balanced";
11
+ readonly description: "Restrained brand shades, coordinated families and smooth anchor reshaping.";
12
+ }, {
13
+ readonly id: "expressive";
14
+ readonly name: "Expressive";
15
+ readonly description: "Fuller color families and a more vivid, smoothly reshaped brand ramp.";
16
+ }];
17
+ export interface ColorWallInput {
18
+ readonly version?: 1;
19
+ /** Original opaque six-digit sRGB hex; retained verbatim at the exact anchor. */
20
+ readonly brand: string;
21
+ readonly gamut?: 'srgb';
22
+ readonly fidelity?: 'anchored' | 'unanchored';
23
+ /** Independently select coordinated families and the brand ramp. Both default to balanced. */
24
+ readonly wallPreset?: ColorCalibrationPreset;
25
+ readonly rampPreset?: ColorCalibrationPreset;
26
+ /** 0–1 wall chroma. Omit to derive restraint from the source. */
27
+ readonly vividness?: number;
28
+ /** 0–1 brand-ramp chroma, independent of wall vividness; never changes the exact anchor. */
29
+ readonly brandVividness?: number;
30
+ readonly lightness?: 'hue-aware' | 'shared';
31
+ /** 0.75–1.35. */
32
+ readonly distribution?: number;
33
+ /** 0–0.035 peak OKLCH chroma. */
34
+ readonly neutralTint?: number;
35
+ /** 0–1 alignment of the nearest named hue family toward the brand. */
36
+ readonly hueAlignment?: number;
37
+ /** Finite degrees, wrapped to [0, 360); used when source C < 0.02. */
38
+ readonly neutralHue?: number;
39
+ }
40
+ export interface ColorWall {
41
+ /** Materialised, JSON-safe inputs; replay with generateColorWall(wall.input). */
42
+ readonly input: Required<ColorWallInput>;
43
+ readonly neutralInput: boolean;
44
+ /** Color authoring data; semantic values and modes remain independently owned. */
45
+ readonly color: {
46
+ readonly brand: ThemeBrandSource;
47
+ readonly fidelity: 'anchored' | 'unanchored';
48
+ readonly palettes: readonly ThemePalette[];
49
+ readonly anchor?: ThemeColorSection['anchor'];
50
+ };
51
+ }
52
+ /** Deterministic, sRGB-first calibration v1. No browser, React, AI or semantic-role selection. */
53
+ export declare function generateColorWall(input: ColorWallInput): ColorWall;
54
+ //# sourceMappingURL=generateColorWall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateColorWall.d.ts","sourceRoot":"","sources":["../../../src/color/generateColorWall.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACb,MAAM,iCAAiC,CAAA;AAIxC,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;AAC1E,gFAAgF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QAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAA;KAC9C,CAAA;CACF;AAyDD,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,CAsMlE"}
@@ -0,0 +1,231 @@
1
+ import { colorFamilies as families } from './colorFamilies.js';
2
+ import { freezeTree } from '../themes/tokens.js';
3
+ import { clamp, hueDifference, measureHex, srgbMapper, wrapHue } from './oklch.js';
4
+ /** Stable IDs for independently choosing the full wall and exact-brand ramp. */
5
+ export const colorCalibrationPresets = freezeTree([
6
+ {
7
+ id: 'classic',
8
+ name: 'Classic',
9
+ description: 'Original hue-aware curves and linear anchor reshaping.'
10
+ },
11
+ {
12
+ id: 'balanced',
13
+ name: 'Balanced',
14
+ description: 'Restrained brand shades, coordinated families and smooth anchor reshaping.'
15
+ },
16
+ {
17
+ id: 'expressive',
18
+ name: 'Expressive',
19
+ description: 'Fuller color families and a more vivid, smoothly reshaped brand ramp.'
20
+ }
21
+ ]);
22
+ const profiles = {
23
+ classic: {
24
+ center: 0.7,
25
+ slope: 0.7,
26
+ low: 0.6,
27
+ high: 0.86,
28
+ exponent: 1,
29
+ cap: 0.255,
30
+ envelope: 0.8,
31
+ tint: 0.012,
32
+ alignment: 0.6,
33
+ radius: 2.2
34
+ },
35
+ balanced: {
36
+ center: 0.7,
37
+ slope: 0.75,
38
+ low: 0.62,
39
+ high: 0.9,
40
+ exponent: 0.95,
41
+ cap: 0.26,
42
+ envelope: 0.4,
43
+ tint: 0.008,
44
+ alignment: 0.25,
45
+ radius: 2.2
46
+ },
47
+ expressive: {
48
+ center: 0.62,
49
+ slope: 0.9,
50
+ low: 0.6,
51
+ high: 0.92,
52
+ exponent: 1.05,
53
+ cap: 0.32,
54
+ envelope: 0.3,
55
+ tint: 0.016,
56
+ alignment: 0.5,
57
+ radius: 2.6
58
+ }
59
+ };
60
+ const stops = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
61
+ const lightness = [0.985, 0.965, 0.93, 0.87, 0.79, 0.7, 0.61, 0.52, 0.43, 0.34, 0.24];
62
+ function option(value, fallback, allowed, key) {
63
+ if (value === undefined)
64
+ return fallback;
65
+ if (!allowed.includes(value))
66
+ throw new TypeError(`colorWall.${key} must be one of: ${allowed.join(', ')}.`);
67
+ return value;
68
+ }
69
+ function number(value, fallback, low, high, key) {
70
+ if (value === undefined)
71
+ return fallback;
72
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < low || value > high) {
73
+ throw new TypeError(`colorWall.${key} must be a finite number from ${low} to ${high}.`);
74
+ }
75
+ return value === 0 ? 0 : value;
76
+ }
77
+ /** Three-point monotone Hermite mapping; endpoints also cover exact black/white. */
78
+ function reshapeLightness(x0, x1, x2, y0, y1, y2, x, endpoint) {
79
+ if (endpoint)
80
+ return y0 + ((x - x0) / (x2 - x0)) * (y2 - y0);
81
+ const h0 = x1 - x0, h1 = x2 - x1;
82
+ const d0 = (y1 - y0) / h0, d1 = (y2 - y1) / h1;
83
+ const m0 = clamp(((2 * h0 + h1) * d0 - h0 * d1) / (h0 + h1), 0, 3 * d0);
84
+ const m2 = clamp(((2 * h1 + h0) * d1 - h1 * d0) / (h0 + h1), 0, 3 * d1);
85
+ const w1 = 2 * h1 + h0, w2 = h1 + 2 * h0;
86
+ const m1 = d0 <= 0 || d1 <= 0 ? 0 : (w1 + w2) / (w1 / d0 + w2 / d1);
87
+ const upper = x > x1;
88
+ const lo = upper ? x1 : x0, hi = upper ? x2 : x1;
89
+ const a = upper ? y1 : y0, b = upper ? y2 : y1;
90
+ const ma = upper ? m1 : m0, mb = upper ? m2 : m1;
91
+ const t = clamp((x - lo) / (hi - lo)), span = hi - lo;
92
+ return ((2 * t ** 3 - 3 * t ** 2 + 1) * a +
93
+ (t ** 3 - 2 * t ** 2 + t) * span * ma +
94
+ (-2 * t ** 3 + 3 * t ** 2) * b +
95
+ (t ** 3 - t ** 2) * span * mb);
96
+ }
97
+ /** Deterministic, sRGB-first calibration v1. No browser, React, AI or semantic-role selection. */
98
+ export function generateColorWall(input) {
99
+ if (!input || typeof input !== 'object' || Array.isArray(input))
100
+ throw new TypeError('colorWall input must be an object.');
101
+ const allowed = [
102
+ 'version',
103
+ 'brand',
104
+ 'gamut',
105
+ 'fidelity',
106
+ 'wallPreset',
107
+ 'rampPreset',
108
+ 'vividness',
109
+ 'brandVividness',
110
+ 'lightness',
111
+ 'distribution',
112
+ 'neutralTint',
113
+ 'hueAlignment',
114
+ 'neutralHue'
115
+ ];
116
+ for (const key of Object.keys(input)) {
117
+ if (!allowed.includes(key))
118
+ throw new TypeError(`Unknown colorWall input: ${key}.`);
119
+ }
120
+ if (typeof input.brand !== 'string' || !/^#[0-9a-f]{6}$/i.test(input.brand)) {
121
+ throw new TypeError('colorWall.brand must be an opaque six-digit sRGB hex color, such as #7C3AED. Alpha and wide-gamut sources are not supported by version 1.');
122
+ }
123
+ const source = measureHex(input.brand), mapper = srgbMapper();
124
+ const neutralInput = source.C < 0.02;
125
+ const wallPreset = option(input.wallPreset, 'balanced', ['classic', 'balanced', 'expressive'], 'wallPreset');
126
+ const rampPreset = option(input.rampPreset, 'balanced', ['classic', 'balanced', 'expressive'], 'rampPreset');
127
+ const wallProfile = profiles[wallPreset], brandProfile = profiles[rampPreset];
128
+ const mood = Math.sqrt(clamp(source.C / 0.28));
129
+ const classicVividness = neutralInput
130
+ ? 0.35
131
+ : clamp(source.C / Math.max(0.001, mapper.maxChroma(source.L, source.h)), 0.1, 0.92);
132
+ const settings = {
133
+ version: option(input.version, 1, [1], 'version'),
134
+ brand: input.brand,
135
+ gamut: option(input.gamut, 'srgb', ['srgb'], 'gamut'),
136
+ fidelity: option(input.fidelity, 'anchored', ['anchored', 'unanchored'], 'fidelity'),
137
+ wallPreset,
138
+ rampPreset,
139
+ vividness: number(input.vividness, wallPreset === 'classic'
140
+ ? classicVividness
141
+ : wallPreset === 'balanced'
142
+ ? 0.45 + 0.4 * mood
143
+ : 0.6 + 0.3 * mood, 0, 1, 'vividness'),
144
+ brandVividness: number(input.brandVividness, rampPreset === 'classic'
145
+ ? classicVividness
146
+ : rampPreset === 'balanced'
147
+ ? 0.18 + 0.65 * mood
148
+ : 0.28 + 0.62 * mood, 0, 1, 'brandVividness'),
149
+ lightness: option(input.lightness, 'hue-aware', ['hue-aware', 'shared'], 'lightness'),
150
+ distribution: number(input.distribution, 1, 0.75, 1.35, 'distribution'),
151
+ neutralTint: number(input.neutralTint, wallProfile.tint, 0, 0.035, 'neutralTint'),
152
+ hueAlignment: number(input.hueAlignment, wallProfile.alignment, 0, 1, 'hueAlignment'),
153
+ neutralHue: wrapHue(number(input.neutralHue, 255, -Number.MAX_VALUE, Number.MAX_VALUE, 'neutralHue'))
154
+ };
155
+ const hue = neutralInput ? settings.neutralHue : source.h;
156
+ const nearestFamily = families.reduce((a, b) => Math.abs(hueDifference(hue, a[1])) < Math.abs(hueDifference(hue, b[1])) ? a : b);
157
+ const rotation = hueDifference(hue, nearestFamily[1]) * settings.hueAlignment;
158
+ function tone(base, h, profile) {
159
+ const middle = settings.lightness === 'shared'
160
+ ? 0.7
161
+ : clamp(profile.center + profile.slope * (mapper.cuspLightness(h) - profile.center), profile.low, profile.high);
162
+ return base >= 0.7
163
+ ? middle +
164
+ (0.985 - middle) *
165
+ ((base - 0.7) / (0.985 - 0.7)) ** (settings.distribution * profile.exponent)
166
+ : middle -
167
+ (middle - 0.24) *
168
+ ((0.7 - base) / (0.7 - 0.24)) ** (settings.distribution * profile.exponent);
169
+ }
170
+ function ramp(h, kind, profile = wallProfile, strength = settings.vividness) {
171
+ return lightness.map((base, i) => {
172
+ const L = kind === 'chromatic' ? tone(base, h, profile) : base;
173
+ const envelope = Math.sin(Math.PI * (1 - L));
174
+ const C = kind === 'neutral'
175
+ ? settings.neutralTint * envelope ** 0.8
176
+ : kind === 'achromatic'
177
+ ? 0
178
+ : Math.min(mapper.maxChroma(L, h) * strength, profile.cap * envelope ** profile.envelope);
179
+ return { ...mapper.map(L, C, h), stop: stops[i] };
180
+ });
181
+ }
182
+ const regular = ramp(hue, neutralInput ? 'achromatic' : 'chromatic', brandProfile, settings.brandVividness);
183
+ const closest = regular.reduce((a, b) => Math.abs(a.L - source.L) <= Math.abs(b.L - source.L) ? a : b);
184
+ const anchor = regular.indexOf(closest);
185
+ const brand = regular.map((color, i) => {
186
+ if (settings.fidelity === 'unanchored')
187
+ return color;
188
+ if (i === anchor)
189
+ return { ...source, stop: stops[i] };
190
+ const top = Math.max(regular[0].L, source.L), bottom = Math.min(regular.at(-1).L, source.L);
191
+ const L = settings.rampPreset === 'classic'
192
+ ? i < anchor
193
+ ? source.L + ((top - source.L) * (color.L - closest.L)) / (regular[0].L - closest.L)
194
+ : source.L -
195
+ ((source.L - bottom) * (closest.L - color.L)) / (closest.L - regular.at(-1).L)
196
+ : reshapeLightness(regular.at(-1).L, closest.L, regular[0].L, bottom, source.L, top, color.L, anchor === 0 || anchor === regular.length - 1);
197
+ const weight = Math.exp(-(((i - anchor) / brandProfile.radius) ** 2));
198
+ const C = settings.rampPreset === 'classic'
199
+ ? Math.max(0, color.C + (source.C - closest.C) * weight)
200
+ : neutralInput
201
+ ? 0
202
+ : mapper.maxChroma(L, hue) *
203
+ clamp((color.C / Math.max(0.001, mapper.maxChroma(color.L, hue))) * (1 - weight) +
204
+ (source.C / Math.max(0.001, mapper.maxChroma(source.L, hue))) * weight);
205
+ return { ...mapper.map(L, C, hue), stop: color.stop };
206
+ });
207
+ function palette(name, colors) {
208
+ return {
209
+ id: name.toLowerCase(),
210
+ name,
211
+ swatches: colors.map(({ stop, value }) => ({ stop, value }))
212
+ };
213
+ }
214
+ return freezeTree({
215
+ input: settings,
216
+ neutralInput,
217
+ color: {
218
+ brand: { value: input.brand, gamut: 'srgb' },
219
+ fidelity: settings.fidelity,
220
+ ...(settings.fidelity === 'anchored'
221
+ ? { anchor: { paletteId: 'brand', stop: stops[anchor] } }
222
+ : {}),
223
+ palettes: [
224
+ palette('Brand', brand),
225
+ ...families.map(([name, h]) => palette(name, ramp(wrapHue(h + rotation), 'chromatic'))),
226
+ palette('Neutral', ramp(hue, 'neutral'))
227
+ ]
228
+ }
229
+ });
230
+ }
231
+ //# sourceMappingURL=generateColorWall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateColorWall.js","sourceRoot":"","sources":["../../../src/color/generateColorWall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAM9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGlF,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IAChD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,wDAAwD;KACtE;IACD;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,4EAA4E;KAC1F;IACD;QACE,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,uEAAuE;KACrF;CACO,CAAC,CAAA;AACX,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE;QACP,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,CAAC;QACX,GAAG,EAAE,KAAK;QACV,QAAQ,EAAE,GAAG;QACb,IAAI,EAAE,KAAK;QACX,SAAS,EAAE,GAAG;QACd,MAAM,EAAE,GAAG;KACZ;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,IAAI;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AsB;QACnD,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE;YACtB,IAAI;YACJ,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;SAC7D,CAAA;IACH,CAAC;IACD,OAAO,UAAU,CAAC;QAChB,KAAK,EAAE,QAAQ;QACf,YAAY;QACZ,KAAK,EAAE;YACL,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,MAAe,EAAE;YACrD,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,GAAG,CAAC,QAAQ,CAAC,QAAQ,KAAK,UAAU;gBAClC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE;gBACzD,CAAC,CAAC,EAAE,CAAC;YACP,QAAQ,EAAE;gBACR,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC;gBACvB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;gBACvF,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;aACzC;SACF;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { colorFamilies as families } from './colorFamilies.js'\nimport type {\n ThemeBrandSource,\n ThemeColorSection,\n ThemePalette\n} from '../themes/themeDocumentTypes.js'\nimport { freezeTree } from '../themes/tokens.js'\nimport { clamp, hueDifference, measureHex, srgbMapper, wrapHue } from './oklch.js'\n\nexport type ColorCalibrationPreset = 'classic' | 'balanced' | 'expressive'\n/** Stable IDs for independently choosing the full wall and exact-brand ramp. */\nexport const colorCalibrationPresets = freezeTree([\n {\n id: 'classic',\n name: 'Classic',\n description: 'Original hue-aware curves and linear anchor reshaping.'\n },\n {\n id: 'balanced',\n name: 'Balanced',\n description: 'Restrained brand shades, coordinated families and smooth anchor reshaping.'\n },\n {\n id: 'expressive',\n name: 'Expressive',\n description: 'Fuller color families and a more vivid, smoothly reshaped brand ramp.'\n }\n] as const)\nconst profiles = {\n classic: {\n center: 0.7,\n slope: 0.7,\n low: 0.6,\n high: 0.86,\n exponent: 1,\n cap: 0.255,\n envelope: 0.8,\n tint: 0.012,\n alignment: 0.6,\n radius: 2.2\n },\n balanced: {\n center: 0.7,\n slope: 0.75,\n low: 0.62,\n high: 0.9,\n exponent: 0.95,\n cap: 0.26,\n envelope: 0.4,\n tint: 0.008,\n alignment: 0.25,\n radius: 2.2\n },\n expressive: {\n center: 0.62,\n slope: 0.9,\n low: 0.6,\n high: 0.92,\n exponent: 1.05,\n cap: 0.32,\n envelope: 0.3,\n tint: 0.016,\n alignment: 0.5,\n radius: 2.6\n }\n} as const\n\nexport interface ColorWallInput {\n readonly version?: 1\n /** Original opaque six-digit sRGB hex; retained verbatim at the exact anchor. */\n readonly brand: string\n readonly gamut?: 'srgb'\n readonly fidelity?: 'anchored' | 'unanchored'\n /** Independently select coordinated families and the brand ramp. Both default to balanced. */\n readonly wallPreset?: ColorCalibrationPreset\n readonly rampPreset?: ColorCalibrationPreset\n /** 0–1 wall chroma. Omit to derive restraint from the source. */\n readonly vividness?: number\n /** 0–1 brand-ramp chroma, independent of wall vividness; never changes the exact anchor. */\n readonly brandVividness?: number\n readonly lightness?: 'hue-aware' | 'shared'\n /** 0.75–1.35. */\n readonly distribution?: number\n /** 0–0.035 peak OKLCH chroma. */\n readonly neutralTint?: number\n /** 0–1 alignment of the nearest named hue family toward the brand. */\n readonly hueAlignment?: number\n /** Finite degrees, wrapped to [0, 360); used when source C < 0.02. */\n readonly neutralHue?: number\n}\nexport interface ColorWall {\n /** Materialised, JSON-safe inputs; replay with generateColorWall(wall.input). */\n readonly input: Required<ColorWallInput>\n readonly neutralInput: boolean\n /** Color authoring data; semantic values and modes remain independently owned. */\n readonly color: {\n readonly brand: ThemeBrandSource\n readonly fidelity: 'anchored' | 'unanchored'\n readonly palettes: readonly ThemePalette[]\n readonly anchor?: ThemeColorSection['anchor']\n }\n}\n\nconst stops = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const\nconst lightness = [0.985, 0.965, 0.93, 0.87, 0.79, 0.7, 0.61, 0.52, 0.43, 0.34, 0.24]\n\nfunction option<T>(value: unknown, fallback: T, allowed: readonly T[], key: string): T {\n if (value === undefined) return fallback\n if (!allowed.includes(value as T))\n throw new TypeError(`colorWall.${key} must be one of: ${allowed.join(', ')}.`)\n return value as T\n}\nfunction number(value: unknown, fallback: number, low: number, high: number, key: string): number {\n if (value === undefined) return fallback\n if (typeof value !== 'number' || !Number.isFinite(value) || value < low || value > high) {\n throw new TypeError(`colorWall.${key} must be a finite number from ${low} to ${high}.`)\n }\n return value === 0 ? 0 : value\n}\n\n/** Three-point monotone Hermite mapping; endpoints also cover exact black/white. */\nfunction reshapeLightness(\n x0: number,\n x1: number,\n x2: number,\n y0: number,\n y1: number,\n y2: number,\n x: number,\n endpoint: boolean\n) {\n if (endpoint) return y0 + ((x - x0) / (x2 - x0)) * (y2 - y0)\n const h0 = x1 - x0,\n h1 = x2 - x1\n const d0 = (y1 - y0) / h0,\n d1 = (y2 - y1) / h1\n const m0 = clamp(((2 * h0 + h1) * d0 - h0 * d1) / (h0 + h1), 0, 3 * d0)\n const m2 = clamp(((2 * h1 + h0) * d1 - h1 * d0) / (h0 + h1), 0, 3 * d1)\n const w1 = 2 * h1 + h0,\n w2 = h1 + 2 * h0\n const m1 = d0 <= 0 || d1 <= 0 ? 0 : (w1 + w2) / (w1 / d0 + w2 / d1)\n const upper = x > x1\n const lo = upper ? x1 : x0,\n hi = upper ? x2 : x1\n const a = upper ? y1 : y0,\n b = upper ? y2 : y1\n const ma = upper ? m1 : m0,\n mb = upper ? m2 : m1\n const t = clamp((x - lo) / (hi - lo)),\n span = hi - lo\n return (\n (2 * t ** 3 - 3 * t ** 2 + 1) * a +\n (t ** 3 - 2 * t ** 2 + t) * span * ma +\n (-2 * t ** 3 + 3 * t ** 2) * b +\n (t ** 3 - t ** 2) * span * mb\n )\n}\n\n/** Deterministic, sRGB-first calibration v1. No browser, React, AI or semantic-role selection. */\nexport function generateColorWall(input: ColorWallInput): ColorWall {\n if (!input || typeof input !== 'object' || Array.isArray(input))\n throw new TypeError('colorWall input must be an object.')\n const allowed = [\n 'version',\n 'brand',\n 'gamut',\n 'fidelity',\n 'wallPreset',\n 'rampPreset',\n 'vividness',\n 'brandVividness',\n 'lightness',\n 'distribution',\n 'neutralTint',\n 'hueAlignment',\n 'neutralHue'\n ]\n for (const key of Object.keys(input)) {\n if (!allowed.includes(key)) throw new TypeError(`Unknown colorWall input: ${key}.`)\n }\n if (typeof input.brand !== 'string' || !/^#[0-9a-f]{6}$/i.test(input.brand)) {\n throw new TypeError(\n 'colorWall.brand must be an opaque six-digit sRGB hex color, such as #7C3AED. Alpha and wide-gamut sources are not supported by version 1.'\n )\n }\n const source = measureHex(input.brand),\n mapper = srgbMapper()\n const neutralInput = source.C < 0.02\n const wallPreset = option(\n input.wallPreset,\n 'balanced',\n ['classic', 'balanced', 'expressive'] as const,\n 'wallPreset'\n )\n const rampPreset = option(\n input.rampPreset,\n 'balanced',\n ['classic', 'balanced', 'expressive'] as const,\n 'rampPreset'\n )\n const wallProfile = profiles[wallPreset],\n brandProfile = profiles[rampPreset]\n const mood = Math.sqrt(clamp(source.C / 0.28))\n const classicVividness = neutralInput\n ? 0.35\n : clamp(source.C / Math.max(0.001, mapper.maxChroma(source.L, source.h)), 0.1, 0.92)\n const settings: Required<ColorWallInput> = {\n version: option(input.version, 1, [1], 'version'),\n brand: input.brand,\n gamut: option(input.gamut, 'srgb', ['srgb'], 'gamut'),\n fidelity: option(input.fidelity, 'anchored', ['anchored', 'unanchored'], 'fidelity'),\n wallPreset,\n rampPreset,\n vividness: number(\n input.vividness,\n wallPreset === 'classic'\n ? classicVividness\n : wallPreset === 'balanced'\n ? 0.45 + 0.4 * mood\n : 0.6 + 0.3 * mood,\n 0,\n 1,\n 'vividness'\n ),\n brandVividness: number(\n input.brandVividness,\n rampPreset === 'classic'\n ? classicVividness\n : rampPreset === 'balanced'\n ? 0.18 + 0.65 * mood\n : 0.28 + 0.62 * mood,\n 0,\n 1,\n 'brandVividness'\n ),\n lightness: option(input.lightness, 'hue-aware', ['hue-aware', 'shared'], 'lightness'),\n distribution: number(input.distribution, 1, 0.75, 1.35, 'distribution'),\n neutralTint: number(input.neutralTint, wallProfile.tint, 0, 0.035, 'neutralTint'),\n hueAlignment: number(input.hueAlignment, wallProfile.alignment, 0, 1, 'hueAlignment'),\n neutralHue: wrapHue(\n number(input.neutralHue, 255, -Number.MAX_VALUE, Number.MAX_VALUE, 'neutralHue')\n )\n }\n const hue = neutralInput ? settings.neutralHue : source.h\n const nearestFamily = families.reduce((a, b) =>\n Math.abs(hueDifference(hue, a[1])) < Math.abs(hueDifference(hue, b[1])) ? a : b\n )\n const rotation = hueDifference(hue, nearestFamily[1]) * settings.hueAlignment\n function tone(\n base: number,\n h: number,\n profile: (typeof profiles)[ColorCalibrationPreset]\n ): number {\n const middle =\n settings.lightness === 'shared'\n ? 0.7\n : clamp(\n profile.center + profile.slope * (mapper.cuspLightness(h) - profile.center),\n profile.low,\n profile.high\n )\n return base >= 0.7\n ? middle +\n (0.985 - middle) *\n ((base - 0.7) / (0.985 - 0.7)) ** (settings.distribution * profile.exponent)\n : middle -\n (middle - 0.24) *\n ((0.7 - base) / (0.7 - 0.24)) ** (settings.distribution * profile.exponent)\n }\n function ramp(\n h: number,\n kind: 'chromatic' | 'neutral' | 'achromatic',\n profile = wallProfile,\n strength = settings.vividness\n ) {\n return lightness.map((base, i) => {\n const L = kind === 'chromatic' ? tone(base, h, profile) : base\n const envelope = Math.sin(Math.PI * (1 - L))\n const C =\n kind === 'neutral'\n ? settings.neutralTint * envelope ** 0.8\n : kind === 'achromatic'\n ? 0\n : Math.min(\n mapper.maxChroma(L, h) * strength,\n profile.cap * envelope ** profile.envelope\n )\n return { ...mapper.map(L, C, h), stop: stops[i] }\n })\n }\n const regular = ramp(\n hue,\n neutralInput ? 'achromatic' : 'chromatic',\n brandProfile,\n settings.brandVividness\n )\n const closest = regular.reduce((a, b) =>\n Math.abs(a.L - source.L) <= Math.abs(b.L - source.L) ? a : b\n )\n const anchor = regular.indexOf(closest)\n const brand = regular.map((color, i) => {\n if (settings.fidelity === 'unanchored') return color\n if (i === anchor) return { ...source, stop: stops[i] }\n const top = Math.max(regular[0].L, source.L),\n bottom = Math.min(regular.at(-1)!.L, source.L)\n const L =\n settings.rampPreset === 'classic'\n ? i < anchor\n ? source.L + ((top - source.L) * (color.L - closest.L)) / (regular[0].L - closest.L)\n : source.L -\n ((source.L - bottom) * (closest.L - color.L)) / (closest.L - regular.at(-1)!.L)\n : reshapeLightness(\n regular.at(-1)!.L,\n closest.L,\n regular[0].L,\n bottom,\n source.L,\n top,\n color.L,\n anchor === 0 || anchor === regular.length - 1\n )\n const weight = Math.exp(-(((i - anchor) / brandProfile.radius) ** 2))\n const C =\n settings.rampPreset === 'classic'\n ? Math.max(0, color.C + (source.C - closest.C) * weight)\n : neutralInput\n ? 0\n : mapper.maxChroma(L, hue) *\n clamp(\n (color.C / Math.max(0.001, mapper.maxChroma(color.L, hue))) * (1 - weight) +\n (source.C / Math.max(0.001, mapper.maxChroma(source.L, hue))) * weight\n )\n return { ...mapper.map(L, C, hue), stop: color.stop }\n })\n function palette(name: string, colors: typeof regular): ThemePalette {\n return {\n id: name.toLowerCase(),\n name,\n swatches: colors.map(({ stop, value }) => ({ stop, value }))\n }\n }\n return freezeTree({\n input: settings,\n neutralInput,\n color: {\n brand: { value: input.brand, gamut: 'srgb' as const },\n fidelity: settings.fidelity,\n ...(settings.fidelity === 'anchored'\n ? { anchor: { paletteId: 'brand', stop: stops[anchor] } }\n : {}),\n palettes: [\n palette('Brand', brand),\n ...families.map(([name, h]) => palette(name, ramp(wrapHue(h + rotation), 'chromatic'))),\n palette('Neutral', ramp(hue, 'neutral'))\n ]\n }\n })\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { generateColorWall, colorCalibrationPresets } from './generateColorWall.js';
2
+ export type { ColorWall, ColorWallInput, ColorCalibrationPreset } from './generateColorWall.js';
3
+ export { recommendColorPalette } from './recommendColorPalette.js';
4
+ export type { ColorPalette, ColorPaletteOptions, PaletteModeColors, PaletteColorPair, PaletteContrastCheck, WorkingPaletteRole } from './recommendColorPalette.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/color/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AACnF,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { generateColorWall, colorCalibrationPresets } from './generateColorWall.js';
2
+ export { recommendColorPalette } from './recommendColorPalette.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/color/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA","sourcesContent":["export { generateColorWall, colorCalibrationPresets } from './generateColorWall.js'\nexport type { ColorWall, ColorWallInput, ColorCalibrationPreset } from './generateColorWall.js'\nexport { recommendColorPalette } from './recommendColorPalette.js'\nexport type {\n ColorPalette,\n ColorPaletteOptions,\n PaletteModeColors,\n PaletteColorPair,\n PaletteContrastCheck,\n WorkingPaletteRole\n} from './recommendColorPalette.js'\n"]}
@@ -0,0 +1,17 @@
1
+ export interface OklchColor {
2
+ readonly value: string;
3
+ readonly L: number;
4
+ readonly C: number;
5
+ readonly h: number;
6
+ }
7
+ export declare const clamp: (n: number, low?: number, high?: number) => number;
8
+ export declare const wrapHue: (h: number) => number;
9
+ export declare const hueDifference: (a: number, b: number) => number;
10
+ export declare function measureHex(hex: string): OklchColor;
11
+ /** Per-generation caches: bounded by this wall, without history-dependent global state. */
12
+ export declare function srgbMapper(): {
13
+ maxChroma: (L: number, h: number) => number;
14
+ cuspLightness: (h: number) => number;
15
+ map: (L: number, C: number, h: number) => OklchColor;
16
+ };
17
+ //# sourceMappingURL=oklch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oklch.d.ts","sourceRoot":"","sources":["../../../src/color/oklch.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CACnB;AACD,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,EAAE,YAAO,EAAE,aAAQ,WAAqC,CAAA;AACvF,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,WAA4B,CAAA;AAC7D,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,WAA+B,CAAA;AAKjF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAUlD;AAgBD,2FAA2F;AAC3F,wBAAgB,UAAU;mBAGF,MAAM,KAAK,MAAM,KAAG,MAAM;uBAetB,MAAM,KAAG,MAAM;aAiBzB,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,UAAU;EAe1D"}
@@ -0,0 +1,79 @@
1
+ export const clamp = (n, low = 0, high = 1) => Math.max(low, Math.min(high, n));
2
+ export const wrapHue = (h) => ((h % 360) + 360) % 360;
3
+ export const hueDifference = (a, b) => wrapHue(a - b + 180) - 180;
4
+ const linear = (n) => (n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4);
5
+ const encoded = (n) => n <= 0.0031308 ? 12.92 * n : 1.055 * Math.max(0, n) ** (1 / 2.4) - 0.055;
6
+ export function measureHex(hex) {
7
+ const [r, g, b] = [1, 3, 5].map(i => linear(parseInt(hex.slice(i, i + 2), 16) / 255));
8
+ const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
9
+ const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
10
+ const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
11
+ const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
12
+ const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
13
+ const bAxis = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
14
+ const C = Math.hypot(a, bAxis);
15
+ return { value: hex, L, C, h: C < 1e-6 ? 0 : wrapHue((Math.atan2(bAxis, a) * 180) / Math.PI) };
16
+ }
17
+ function linearRgb(L, C, h) {
18
+ const angle = (h * Math.PI) / 180;
19
+ const a = C * Math.cos(angle), b = C * Math.sin(angle);
20
+ const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
21
+ const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
22
+ const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
23
+ return [
24
+ 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
25
+ -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
26
+ -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
27
+ ];
28
+ }
29
+ /** Per-generation caches: bounded by this wall, without history-dependent global state. */
30
+ export function srgbMapper() {
31
+ const chromas = new Map(), cusps = new Map();
32
+ function maxChroma(L, h) {
33
+ if (L <= 0 || L >= 1)
34
+ return 0;
35
+ const key = `${L},${h}`;
36
+ const cached = chromas.get(key);
37
+ if (cached !== undefined)
38
+ return cached;
39
+ let low = 0, high = 0.5;
40
+ for (let i = 0; i < 25; i++) {
41
+ const mid = (low + high) / 2;
42
+ if (linearRgb(L, mid, h).every(n => n >= -1e-8 && n <= 1 + 1e-8))
43
+ low = mid;
44
+ else
45
+ high = mid;
46
+ }
47
+ chromas.set(key, low);
48
+ return low;
49
+ }
50
+ function cuspLightness(h) {
51
+ const cached = cusps.get(h);
52
+ if (cached !== undefined)
53
+ return cached;
54
+ let bestL = 0.7, bestC = 0;
55
+ // Fixed sample locations and tie order are part of algorithm version 1.
56
+ for (let i = 20; i <= 98; i++) {
57
+ const L = i / 100, C = maxChroma(L, h);
58
+ if (C > bestC) {
59
+ bestC = C;
60
+ bestL = L;
61
+ }
62
+ }
63
+ cusps.set(h, bestL);
64
+ return bestL;
65
+ }
66
+ function map(L, C, h) {
67
+ const rgb = linearRgb(clamp(L), Math.min(C, maxChroma(L, h)), h);
68
+ const value = '#' +
69
+ rgb
70
+ .map(n => Math.round(clamp(encoded(n)) * 255)
71
+ .toString(16)
72
+ .padStart(2, '0'))
73
+ .join('')
74
+ .toUpperCase();
75
+ return measureHex(value);
76
+ }
77
+ return { maxChroma, cuspLightness, map };
78
+ }
79
+ //# sourceMappingURL=oklch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oklch.js","sourceRoot":"","sources":["../../../src/color/oklch.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,GAAG,GAAG,CA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,CAAC,CAAA;QAChE,MAAM,KAAK,GACT,GAAG;YACH,GAAG;iBACA,GAAG,CAAC,CAAC,CAAC,EAAE,CACP,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;iBAChC,QAAQ,CAAC,EAAE,CAAC;iBACZ,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACpB;iBACA,IAAI,CAAC,EAAE,CAAC;iBACR,WAAW,EAAE,CAAA;QAClB,OAAO,UAAU,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,CAAA;AAC1C,CAAC","sourcesContent":["// sRGB ↔ Oklab matrices: https://bottosson.github.io/posts/oklab/\n// Transfer functions: https://www.w3.org/TR/css-color-4/#color-conversion-code\n// This mapper deliberately reduces chroma at fixed L/h; it is not browser gamut mapping.\ntype Triple = readonly [number, number, number]\nexport interface OklchColor {\n readonly value: string\n readonly L: number\n readonly C: number\n readonly h: number\n}\nexport const clamp = (n: number, low = 0, high = 1) => Math.max(low, Math.min(high, n))\nexport const wrapHue = (h: number) => ((h % 360) + 360) % 360\nexport const hueDifference = (a: number, b: number) => wrapHue(a - b + 180) - 180\nconst linear = (n: number) => (n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4)\nconst encoded = (n: number) =>\n n <= 0.0031308 ? 12.92 * n : 1.055 * Math.max(0, n) ** (1 / 2.4) - 0.055\n\nexport function measureHex(hex: string): OklchColor {\n const [r, g, b] = [1, 3, 5].map(i => linear(parseInt(hex.slice(i, i + 2), 16) / 255))\n const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)\n const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)\n const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s\n const a = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s\n const bAxis = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s\n const C = Math.hypot(a, bAxis)\n return { value: hex, L, C, h: C < 1e-6 ? 0 : wrapHue((Math.atan2(bAxis, a) * 180) / Math.PI) }\n}\n\nfunction linearRgb(L: number, C: number, h: number): Triple {\n const angle = (h * Math.PI) / 180\n const a = C * Math.cos(angle),\n b = C * Math.sin(angle)\n const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3\n const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3\n const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s\n ]\n}\n\n/** Per-generation caches: bounded by this wall, without history-dependent global state. */\nexport function srgbMapper() {\n const chromas = new Map<string, number>(),\n cusps = new Map<number, number>()\n function maxChroma(L: number, h: number): number {\n if (L <= 0 || L >= 1) return 0\n const key = `${L},${h}`\n const cached = chromas.get(key)\n if (cached !== undefined) return cached\n let low = 0,\n high = 0.5\n for (let i = 0; i < 25; i++) {\n const mid = (low + high) / 2\n if (linearRgb(L, mid, h).every(n => n >= -1e-8 && n <= 1 + 1e-8)) low = mid\n else high = mid\n }\n chromas.set(key, low)\n return low\n }\n function cuspLightness(h: number): number {\n const cached = cusps.get(h)\n if (cached !== undefined) return cached\n let bestL = 0.7,\n bestC = 0\n // Fixed sample locations and tie order are part of algorithm version 1.\n for (let i = 20; i <= 98; i++) {\n const L = i / 100,\n C = maxChroma(L, h)\n if (C > bestC) {\n bestC = C\n bestL = L\n }\n }\n cusps.set(h, bestL)\n return bestL\n }\n function map(L: number, C: number, h: number): OklchColor {\n const rgb = linearRgb(clamp(L), Math.min(C, maxChroma(L, h)), h)\n const value =\n '#' +\n rgb\n .map(n =>\n Math.round(clamp(encoded(n)) * 255)\n .toString(16)\n .padStart(2, '0')\n )\n .join('')\n .toUpperCase()\n return measureHex(value)\n }\n return { maxChroma, cuspLightness, map }\n}\n"]}