@wordpress/theme 0.3.0 → 0.3.1-next.6deb34194.0

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 (42) hide show
  1. package/build/color-ramps/lib/default-ramps.js +65 -65
  2. package/build/color-ramps/lib/default-ramps.js.map +1 -1
  3. package/build/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  4. package/build/color-ramps/lib/index.js.map +2 -2
  5. package/build/color-ramps/lib/taper-chroma.js +18 -44
  6. package/build/color-ramps/lib/taper-chroma.js.map +2 -2
  7. package/build/prebuilt/js/design-tokens.js +15 -5
  8. package/build/prebuilt/js/design-tokens.js.map +2 -2
  9. package/build/prebuilt/json/figma.json +101 -29
  10. package/build-module/color-ramps/lib/default-ramps.js +65 -65
  11. package/build-module/color-ramps/lib/default-ramps.js.map +1 -1
  12. package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  13. package/build-module/color-ramps/lib/index.js.map +2 -2
  14. package/build-module/color-ramps/lib/taper-chroma.js +19 -46
  15. package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
  16. package/build-module/prebuilt/js/design-tokens.js +15 -5
  17. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  18. package/build-module/prebuilt/json/figma.json +101 -29
  19. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +3 -4
  20. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
  21. package/build-types/color-ramps/lib/taper-chroma.d.ts +4 -4
  22. package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
  23. package/docs/ds-tokens.md +17 -7
  24. package/package.json +4 -4
  25. package/src/color-ramps/lib/default-ramps.ts +65 -65
  26. package/src/color-ramps/lib/find-color-with-constraints.ts +11 -7
  27. package/src/color-ramps/lib/index.ts +4 -4
  28. package/src/color-ramps/lib/taper-chroma.ts +32 -63
  29. package/src/prebuilt/css/design-tokens.css +54 -26
  30. package/src/prebuilt/js/design-tokens.js +15 -5
  31. package/src/prebuilt/json/figma.json +101 -29
  32. package/tokens/border.json +43 -21
  33. package/tokens/color.json +65 -65
  34. package/tokens/dimension.json +62 -0
  35. package/tsconfig.bin.tsbuildinfo +1 -1
  36. package/tsconfig.src.json +1 -1
  37. package/tsconfig.src.tsbuildinfo +1 -1
  38. package/build/types/css-modules.d.js +0 -1
  39. package/build/types/css-modules.d.js.map +0 -7
  40. package/build-module/types/css-modules.d.js +0 -1
  41. package/build-module/types/css-modules.d.js.map +0 -7
  42. package/src/types/css-modules.d.ts +0 -4
@@ -1,29 +1,53 @@
1
1
  {
2
- "Border/radius-x-small": {
2
+ "Border/radius-surface-xs": {
3
3
  "value": {
4
4
  ".": "1px"
5
5
  },
6
- "description": "Extra small radius"
6
+ "description": "Extra small radius for surfaces"
7
7
  },
8
- "Border/radius-small": {
8
+ "Border/radius-surface-sm": {
9
9
  "value": {
10
10
  ".": "2px"
11
11
  },
12
- "description": "Small radius"
12
+ "description": "Small radius for surfaces"
13
13
  },
14
- "Border/radius-medium": {
14
+ "Border/radius-surface-md": {
15
15
  "value": {
16
16
  ".": "4px"
17
17
  },
18
- "description": "Medium radius"
18
+ "description": "Medium radius for surfaces"
19
19
  },
20
- "Border/radius-large": {
20
+ "Border/radius-surface-lg": {
21
21
  "value": {
22
22
  ".": "8px"
23
23
  },
24
- "description": "Large radius"
24
+ "description": "Large radius for surfaces"
25
25
  },
26
- "Border/width-focus": {
26
+ "Border/width-surface-xs": {
27
+ "value": {
28
+ ".": "1px"
29
+ },
30
+ "description": "Extra small width for surfaces"
31
+ },
32
+ "Border/width-surface-sm": {
33
+ "value": {
34
+ ".": "2px"
35
+ },
36
+ "description": "Small width for surfaces"
37
+ },
38
+ "Border/width-surface-md": {
39
+ "value": {
40
+ ".": "4px"
41
+ },
42
+ "description": "Medium width for surfaces"
43
+ },
44
+ "Border/width-surface-lg": {
45
+ "value": {
46
+ ".": "8px"
47
+ },
48
+ "description": "Large width for surfaces"
49
+ },
50
+ "Border/width-interactive-focus": {
27
51
  "value": {
28
52
  ".": "2px",
29
53
  "high-dpi": "1.5px"
@@ -56,61 +80,61 @@
56
80
  },
57
81
  "Color/Semantic/Background/Success/bgSur-success": {
58
82
  "value": {
59
- ".": "#cbf5d1"
83
+ ".": "#c5f7cc"
60
84
  },
61
85
  "description": "Background color for surfaces with success tone and normal emphasis."
62
86
  },
63
87
  "Color/Semantic/Background/Success/bgSur-success-weak": {
64
88
  "value": {
65
- ".": "#f0fcf2"
89
+ ".": "#eaffed"
66
90
  },
67
91
  "description": "Background color for surfaces with success tone and weak emphasis."
68
92
  },
69
93
  "Color/Semantic/Background/Info/bgSur-info": {
70
94
  "value": {
71
- ".": "#dfebf8"
95
+ ".": "#deebfa"
72
96
  },
73
97
  "description": "Background color for surfaces with info tone and normal emphasis."
74
98
  },
75
99
  "Color/Semantic/Background/Info/bgSur-info-weak": {
76
100
  "value": {
77
- ".": "#f5f9fd"
101
+ ".": "#f3f9ff"
78
102
  },
79
103
  "description": "Background color for surfaces with info tone and weak emphasis."
80
104
  },
81
105
  "Color/Semantic/Background/Warning/bgSur-warning": {
82
106
  "value": {
83
- ".": "#f8e8cc"
107
+ ".": "#fde6bd"
84
108
  },
85
109
  "description": "Background color for surfaces with warning tone and normal emphasis."
86
110
  },
87
111
  "Color/Semantic/Background/Warning/bgSur-warning-weak": {
88
112
  "value": {
89
- ".": "#fdf7ee"
113
+ ".": "#fff7e0"
90
114
  },
91
115
  "description": "Background color for surfaces with warning tone and weak emphasis."
92
116
  },
93
117
  "Color/Semantic/Background/Caution/bgSur-caution": {
94
118
  "value": {
95
- ".": "#f7eab3"
119
+ ".": "#fee994"
96
120
  },
97
121
  "description": "Background color for surfaces with caution tone and normal emphasis."
98
122
  },
99
123
  "Color/Semantic/Background/Caution/bgSur-caution-weak": {
100
124
  "value": {
101
- ".": "#fdf9e7"
125
+ ".": "#fff9c9"
102
126
  },
103
127
  "description": "Background color for surfaces with caution tone and weak emphasis."
104
128
  },
105
129
  "Color/Semantic/Background/Error/bgSur-error": {
106
130
  "value": {
107
- ".": "#fae4e1"
131
+ ".": "#f6e6e3"
108
132
  },
109
133
  "description": "Background color for surfaces with error tone and normal emphasis."
110
134
  },
111
135
  "Color/Semantic/Background/Error/bgSur-error-weak": {
112
136
  "value": {
113
- ".": "#fdf6f5"
137
+ ".": "#fff6f4"
114
138
  },
115
139
  "description": "Background color for surfaces with error tone and weak emphasis."
116
140
  },
@@ -176,7 +200,7 @@
176
200
  },
177
201
  "Color/Semantic/Background/Brand/bgInt-brand-active": {
178
202
  "value": {
179
- ".": "#f6f8fc"
203
+ ".": "#f6f8fd"
180
204
  },
181
205
  "description": "Background color for interactive elements with brand tone and normal emphasis that are hovered, focused, or active."
182
206
  },
@@ -212,7 +236,7 @@
212
236
  },
213
237
  "Color/Semantic/Background/Brand/bgInt-brand-weak-active": {
214
238
  "value": {
215
- ".": "#e4eaf7"
239
+ ".": "#e6eaf4"
216
240
  },
217
241
  "description": "Background color for interactive elements with brand tone and weak emphasis that are hovered, focused, or active."
218
242
  },
@@ -308,7 +332,7 @@
308
332
  },
309
333
  "Color/Semantic/Foreground/Warning/fgCon-warning-weak": {
310
334
  "value": {
311
- ".": "#936400"
335
+ ".": "#926300"
312
336
  },
313
337
  "description": "Foreground color for content like text with warning tone and weak emphasis."
314
338
  },
@@ -320,7 +344,7 @@
320
344
  },
321
345
  "Color/Semantic/Foreground/Caution/fgCon-caution-weak": {
322
346
  "value": {
323
- ".": "#836b00"
347
+ ".": "#826a00"
324
348
  },
325
349
  "description": "Foreground color for content like text with caution tone and weak emphasis."
326
350
  },
@@ -440,7 +464,7 @@
440
464
  },
441
465
  "Color/Semantic/Stroke/Brand/strokeSur-brand": {
442
466
  "value": {
443
- ".": "#a2b1d6"
467
+ ".": "#a3b1d4"
444
468
  },
445
469
  "description": "Decorative stroke color used to define brand-toned surface boundaries with normal emphasis."
446
470
  },
@@ -452,7 +476,7 @@
452
476
  },
453
477
  "Color/Semantic/Stroke/Success/strokeSur-success": {
454
478
  "value": {
455
- ".": "#82c98f"
479
+ ".": "#8ac894"
456
480
  },
457
481
  "description": "Decorative stroke color used to define success-toned surface boundaries with normal emphasis."
458
482
  },
@@ -464,7 +488,7 @@
464
488
  },
465
489
  "Color/Semantic/Stroke/Info/strokeSur-info": {
466
490
  "value": {
467
- ".": "#9fbcdd"
491
+ ".": "#9fbcdc"
468
492
  },
469
493
  "description": "Decorative stroke color used to define info-toned surface boundaries with normal emphasis."
470
494
  },
@@ -476,19 +500,19 @@
476
500
  },
477
501
  "Color/Semantic/Stroke/Warning/strokeSur-warning": {
478
502
  "value": {
479
- ".": "#d2b581"
503
+ ".": "#d0b381"
480
504
  },
481
505
  "description": "Decorative stroke color used to define warning-toned surface boundaries with normal emphasis."
482
506
  },
483
507
  "Color/Semantic/Stroke/Warning/strokeSur-warning-strong": {
484
508
  "value": {
485
- ".": "#936400"
509
+ ".": "#926300"
486
510
  },
487
511
  "description": "Decorative stroke color used to define warning-toned surface boundaries with strong emphasis."
488
512
  },
489
513
  "Color/Semantic/Stroke/Error/strokeSur-error": {
490
514
  "value": {
491
- ".": "#e1a198"
515
+ ".": "#daa39b"
492
516
  },
493
517
  "description": "Decorative stroke color used to define error-toned surface boundaries with normal emphasis."
494
518
  },
@@ -598,6 +622,54 @@
598
622
  },
599
623
  "description": "Large spacing for surfaces"
600
624
  },
625
+ "Dimension/Semantic/gap-2xs": {
626
+ "value": {
627
+ ".": "4px",
628
+ "compact": "4px",
629
+ "comfortable": "8px"
630
+ },
631
+ "description": "2x extra small gap"
632
+ },
633
+ "Dimension/Semantic/gap-xs": {
634
+ "value": {
635
+ ".": "8px",
636
+ "compact": "4px",
637
+ "comfortable": "12px"
638
+ },
639
+ "description": "Extra small gap"
640
+ },
641
+ "Dimension/Semantic/gap-sm": {
642
+ "value": {
643
+ ".": "12px",
644
+ "compact": "8px",
645
+ "comfortable": "16px"
646
+ },
647
+ "description": "Small gap"
648
+ },
649
+ "Dimension/Semantic/gap-md": {
650
+ "value": {
651
+ ".": "16px",
652
+ "compact": "12px",
653
+ "comfortable": "20px"
654
+ },
655
+ "description": "Medium gap"
656
+ },
657
+ "Dimension/Semantic/gap-lg": {
658
+ "value": {
659
+ ".": "24px",
660
+ "compact": "20px",
661
+ "comfortable": "32px"
662
+ },
663
+ "description": "Large gap"
664
+ },
665
+ "Dimension/Semantic/gap-xl": {
666
+ "value": {
667
+ ".": "40px",
668
+ "compact": "32px",
669
+ "comfortable": "48px"
670
+ },
671
+ "description": "Extra large gap"
672
+ },
601
673
  "Elevation/x-small": {
602
674
  "value": {
603
675
  ".": "0 1px 1px 0 color(srgb 0 0 0 / 0.03), 0 1px 2px 0 color(srgb 0 0 0 / 0.02), 0 3px 3px 0 color(srgb 0 0 0 / 0.02), 0 4px 4px 0 color(srgb 0 0 0 / 0.01)"
@@ -32,10 +32,10 @@ var DEFAULT_RAMPS = {
32
32
  bgFill1: "#3858e9",
33
33
  fgFill: "#eff0f2",
34
34
  bgFill2: "#2e49d9",
35
- surface2: "#f6f8fc",
36
- surface6: "#c7d2ee",
35
+ surface2: "#f6f8fd",
36
+ surface6: "#c7d2ed",
37
37
  surface5: "#dbe2f4",
38
- surface4: "#e4eaf7",
38
+ surface4: "#e6eaf4",
39
39
  surface3: "#fff",
40
40
  fgSurface4: "#0b0070",
41
41
  fgSurface3: "#3858e9",
@@ -43,11 +43,11 @@ var DEFAULT_RAMPS = {
43
43
  fgSurface1: "#85a9ff",
44
44
  stroke3: "#3858e9",
45
45
  stroke4: "#2337c8",
46
- stroke2: "#9aaad3",
47
- stroke1: "#a2b1d6",
48
- bgFillDark: "#1b1e26",
46
+ stroke2: "#9caacc",
47
+ stroke1: "#a3b1d4",
48
+ bgFillDark: "#1a1e27",
49
49
  fgFillDark: "#eff0f2",
50
- bgFillInverted2: "#1b1e26",
50
+ bgFillInverted2: "#1a1e27",
51
51
  bgFillInverted1: "#13009f",
52
52
  fgFillInverted: "#eff0f2",
53
53
  surface1: "#ecf0f9"
@@ -57,27 +57,27 @@ var DEFAULT_RAMPS = {
57
57
  info: {
58
58
  ramp: {
59
59
  bgFill1: "#0090ff",
60
- fgFill: "#1b1e23",
60
+ fgFill: "#1a1f24",
61
61
  bgFill2: "#007fed",
62
- surface2: "#f5f9fd",
63
- surface6: "#bdd5f1",
64
- surface5: "#d4e4f6",
65
- surface4: "#dfebf8",
62
+ surface2: "#f3f9ff",
63
+ surface6: "#bcd5f1",
64
+ surface5: "#d3e4f7",
65
+ surface4: "#deebfa",
66
66
  surface3: "#fff",
67
67
  fgSurface4: "#001b4f",
68
68
  fgSurface3: "#006bd7",
69
69
  fgSurface2: "#008bfa",
70
- fgSurface1: "#59b0ff",
70
+ fgSurface1: "#58b0ff",
71
71
  stroke3: "#006bd7",
72
72
  stroke4: "#004fa9",
73
- stroke2: "#94b5d9",
74
- stroke1: "#9fbcdd",
75
- bgFillDark: "#1b1e23",
76
- fgFillDark: "#eff0f2",
77
- bgFillInverted2: "#1b1e23",
73
+ stroke2: "#95b5d9",
74
+ stroke1: "#9fbcdc",
75
+ bgFillDark: "#1a1f24",
76
+ fgFillDark: "#eef0f3",
77
+ bgFillInverted2: "#1a1f24",
78
78
  bgFillInverted1: "#002a69",
79
- fgFillInverted: "#eff0f2",
80
- surface1: "#e9f1fa"
79
+ fgFillInverted: "#eef0f3",
80
+ surface1: "#e4f1ff"
81
81
  },
82
82
  direction: "darker"
83
83
  },
@@ -86,25 +86,25 @@ var DEFAULT_RAMPS = {
86
86
  bgFill1: "#4ab866",
87
87
  fgFill: "#1b1f1c",
88
88
  bgFill2: "#37a756",
89
- surface2: "#f0fcf2",
90
- surface6: "#7eea95",
91
- surface5: "#b5f1bf",
92
- surface4: "#cbf5d1",
89
+ surface2: "#eaffed",
90
+ surface6: "#88e89b",
91
+ surface5: "#aff3bb",
92
+ surface4: "#c5f7cc",
93
93
  surface3: "#fff",
94
94
  fgSurface4: "#002900",
95
95
  fgSurface3: "#007f30",
96
96
  fgSurface2: "#2b9e4e",
97
- fgSurface1: "#53c06e",
97
+ fgSurface1: "#53c16e",
98
98
  stroke3: "#007f30",
99
99
  stroke4: "#006013",
100
- stroke2: "#7dc189",
101
- stroke1: "#82c98f",
100
+ stroke2: "#84c08e",
101
+ stroke1: "#8ac894",
102
102
  bgFillDark: "#1b1f1c",
103
- fgFillDark: "#edf2ed",
103
+ fgFillDark: "#eaf3eb",
104
104
  bgFillInverted2: "#1b1f1c",
105
105
  bgFillInverted1: "#003701",
106
- fgFillInverted: "#edf2ed",
107
- surface1: "#dbf8df"
106
+ fgFillInverted: "#eaf3eb",
107
+ surface1: "#cbfdd2"
108
108
  },
109
109
  direction: "darker"
110
110
  },
@@ -113,25 +113,25 @@ var DEFAULT_RAMPS = {
113
113
  bgFill1: "#f0d149",
114
114
  fgFill: "#1f1e1b",
115
115
  bgFill2: "#dcbe2f",
116
- surface2: "#fdf9e7",
117
- surface6: "#ecd264",
118
- surface5: "#f5e297",
119
- surface4: "#f7eab3",
116
+ surface2: "#fff9c9",
117
+ surface6: "#e8d172",
118
+ surface5: "#f7e18a",
119
+ surface4: "#fee994",
120
120
  surface3: "#fff",
121
121
  fgSurface4: "#281d00",
122
- fgSurface3: "#836b00",
123
- fgSurface2: "#a58700",
124
- fgSurface1: "#c7a900",
125
- stroke3: "#836b00",
126
- stroke4: "#635000",
127
- stroke2: "#bfb17a",
128
- stroke1: "#c7b97f",
122
+ fgSurface3: "#826a00",
123
+ fgSurface2: "#a48600",
124
+ fgSurface1: "#c6a800",
125
+ stroke3: "#826a00",
126
+ stroke4: "#624f00",
127
+ stroke2: "#bdb17e",
128
+ stroke1: "#c5b883",
129
129
  bgFillDark: "#1f1e1b",
130
- fgFillDark: "#f6f1da",
130
+ fgFillDark: "#fdf1bf",
131
131
  bgFillInverted2: "#1f1e1b",
132
132
  bgFillInverted1: "#392c00",
133
- fgFillInverted: "#f6f1da",
134
- surface1: "#f9f0c8"
133
+ fgFillInverted: "#fdf1bf",
134
+ surface1: "#ffef9b"
135
135
  },
136
136
  direction: "darker"
137
137
  },
@@ -140,25 +140,25 @@ var DEFAULT_RAMPS = {
140
140
  bgFill1: "#f0b849",
141
141
  fgFill: "#1f1e1b",
142
142
  bgFill2: "#dda633",
143
- surface2: "#fdf7ee",
144
- surface6: "#f1ce8f",
145
- surface5: "#f6e0b9",
146
- surface4: "#f8e8cc",
143
+ surface2: "#fff7e0",
144
+ surface6: "#f4cc84",
145
+ surface5: "#faddac",
146
+ surface4: "#fde6bd",
147
147
  surface3: "#fff",
148
148
  fgSurface4: "#2e1900",
149
- fgSurface3: "#936400",
150
- fgSurface2: "#b68000",
151
- fgSurface1: "#d8a12c",
152
- stroke3: "#936400",
153
- stroke4: "#704a00",
154
- stroke2: "#caae7c",
155
- stroke1: "#d2b581",
149
+ fgSurface3: "#926300",
150
+ fgSurface2: "#b47f00",
151
+ fgSurface1: "#d7a02a",
152
+ stroke3: "#926300",
153
+ stroke4: "#6f4900",
154
+ stroke2: "#c7ad7e",
155
+ stroke1: "#d0b381",
156
156
  bgFillDark: "#1f1e1b",
157
- fgFillDark: "#f3f0e9",
157
+ fgFillDark: "#f7efe2",
158
158
  bgFillInverted2: "#1f1e1b",
159
159
  bgFillInverted1: "#422800",
160
- fgFillInverted: "#f3f0e9",
161
- surface1: "#faeeda"
160
+ fgFillInverted: "#f7efe2",
161
+ surface1: "#ffecc4"
162
162
  },
163
163
  direction: "darker"
164
164
  },
@@ -167,10 +167,10 @@ var DEFAULT_RAMPS = {
167
167
  bgFill1: "#cc1818",
168
168
  fgFill: "#f2efef",
169
169
  bgFill2: "#b90000",
170
- surface2: "#fdf6f5",
171
- surface6: "#f5c8c1",
172
- surface5: "#f9dbd7",
173
- surface4: "#fae4e1",
170
+ surface2: "#fff6f4",
171
+ surface6: "#f3c8c2",
172
+ surface5: "#f8dcd7",
173
+ surface4: "#f6e6e3",
174
174
  surface3: "#fff",
175
175
  fgSurface4: "#470000",
176
176
  fgSurface3: "#cc1818",
@@ -178,14 +178,14 @@ var DEFAULT_RAMPS = {
178
178
  fgSurface1: "#ff8879",
179
179
  stroke3: "#cc1818",
180
180
  stroke4: "#9d0000",
181
- stroke2: "#de988e",
182
- stroke1: "#e1a198",
181
+ stroke2: "#d39c95",
182
+ stroke1: "#daa39b",
183
183
  bgFillDark: "#231c1b",
184
184
  fgFillDark: "#f2efef",
185
185
  bgFillInverted2: "#231c1b",
186
186
  bgFillInverted1: "#640000",
187
187
  fgFillInverted: "#f2efef",
188
- surface1: "#fbece9"
188
+ surface1: "#fcece9"
189
189
  },
190
190
  direction: "darker"
191
191
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/color-ramps/lib/default-ramps.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RampResult } from './types';\nimport type { DEFAULT_SEED_COLORS } from './constants';\n\nexport const DEFAULT_RAMPS: Record<\n\tkeyof typeof DEFAULT_SEED_COLORS,\n\tRampResult\n> = {\n\tbg: {\n\t\tramp: {\n\t\t\tsurface2: '#f8f8f8',\n\t\t\tbgFill1: '#555',\n\t\t\tfgFill: '#f0f0f0',\n\t\t\tbgFill2: '#484848',\n\t\t\tsurface6: '#d2d2d2',\n\t\t\tsurface5: '#e2e2e2',\n\t\t\tsurface4: '#eaeaea',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#1e1e1e',\n\t\t\tfgSurface3: '#6d6d6d',\n\t\t\tfgSurface2: '#8a8a8a',\n\t\t\tfgSurface1: '#aaa',\n\t\t\tstroke3: '#8a8a8a',\n\t\t\tstroke4: '#6c6c6c',\n\t\t\tstroke2: '#d8d8d8',\n\t\t\tstroke1: '#e0e0e0',\n\t\t\tbgFillDark: '#1e1e1e',\n\t\t\tfgFillDark: '#f0f0f0',\n\t\t\tbgFillInverted2: '#1e1e1e',\n\t\t\tbgFillInverted1: '#2d2d2d',\n\t\t\tfgFillInverted: '#f0f0f0',\n\t\t\tsurface1: '#f0f0f0',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tprimary: {\n\t\tramp: {\n\t\t\tbgFill1: '#3858e9',\n\t\t\tfgFill: '#eff0f2',\n\t\t\tbgFill2: '#2e49d9',\n\t\t\tsurface2: '#f6f8fc',\n\t\t\tsurface6: '#c7d2ee',\n\t\t\tsurface5: '#dbe2f4',\n\t\t\tsurface4: '#e4eaf7',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#0b0070',\n\t\t\tfgSurface3: '#3858e9',\n\t\t\tfgSurface2: '#5b82ff',\n\t\t\tfgSurface1: '#85a9ff',\n\t\t\tstroke3: '#3858e9',\n\t\t\tstroke4: '#2337c8',\n\t\t\tstroke2: '#9aaad3',\n\t\t\tstroke1: '#a2b1d6',\n\t\t\tbgFillDark: '#1b1e26',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1b1e26',\n\t\t\tbgFillInverted1: '#13009f',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#ecf0f9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tinfo: {\n\t\tramp: {\n\t\t\tbgFill1: '#0090ff',\n\t\t\tfgFill: '#1b1e23',\n\t\t\tbgFill2: '#007fed',\n\t\t\tsurface2: '#f5f9fd',\n\t\t\tsurface6: '#bdd5f1',\n\t\t\tsurface5: '#d4e4f6',\n\t\t\tsurface4: '#dfebf8',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#001b4f',\n\t\t\tfgSurface3: '#006bd7',\n\t\t\tfgSurface2: '#008bfa',\n\t\t\tfgSurface1: '#59b0ff',\n\t\t\tstroke3: '#006bd7',\n\t\t\tstroke4: '#004fa9',\n\t\t\tstroke2: '#94b5d9',\n\t\t\tstroke1: '#9fbcdd',\n\t\t\tbgFillDark: '#1b1e23',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1b1e23',\n\t\t\tbgFillInverted1: '#002a69',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#e9f1fa',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tsuccess: {\n\t\tramp: {\n\t\t\tbgFill1: '#4ab866',\n\t\t\tfgFill: '#1b1f1c',\n\t\t\tbgFill2: '#37a756',\n\t\t\tsurface2: '#f0fcf2',\n\t\t\tsurface6: '#7eea95',\n\t\t\tsurface5: '#b5f1bf',\n\t\t\tsurface4: '#cbf5d1',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#002900',\n\t\t\tfgSurface3: '#007f30',\n\t\t\tfgSurface2: '#2b9e4e',\n\t\t\tfgSurface1: '#53c06e',\n\t\t\tstroke3: '#007f30',\n\t\t\tstroke4: '#006013',\n\t\t\tstroke2: '#7dc189',\n\t\t\tstroke1: '#82c98f',\n\t\t\tbgFillDark: '#1b1f1c',\n\t\t\tfgFillDark: '#edf2ed',\n\t\t\tbgFillInverted2: '#1b1f1c',\n\t\t\tbgFillInverted1: '#003701',\n\t\t\tfgFillInverted: '#edf2ed',\n\t\t\tsurface1: '#dbf8df',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tcaution: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0d149',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dcbe2f',\n\t\t\tsurface2: '#fdf9e7',\n\t\t\tsurface6: '#ecd264',\n\t\t\tsurface5: '#f5e297',\n\t\t\tsurface4: '#f7eab3',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#281d00',\n\t\t\tfgSurface3: '#836b00',\n\t\t\tfgSurface2: '#a58700',\n\t\t\tfgSurface1: '#c7a900',\n\t\t\tstroke3: '#836b00',\n\t\t\tstroke4: '#635000',\n\t\t\tstroke2: '#bfb17a',\n\t\t\tstroke1: '#c7b97f',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f6f1da',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#392c00',\n\t\t\tfgFillInverted: '#f6f1da',\n\t\t\tsurface1: '#f9f0c8',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\twarning: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0b849',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dda633',\n\t\t\tsurface2: '#fdf7ee',\n\t\t\tsurface6: '#f1ce8f',\n\t\t\tsurface5: '#f6e0b9',\n\t\t\tsurface4: '#f8e8cc',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#2e1900',\n\t\t\tfgSurface3: '#936400',\n\t\t\tfgSurface2: '#b68000',\n\t\t\tfgSurface1: '#d8a12c',\n\t\t\tstroke3: '#936400',\n\t\t\tstroke4: '#704a00',\n\t\t\tstroke2: '#caae7c',\n\t\t\tstroke1: '#d2b581',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f3f0e9',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#422800',\n\t\t\tfgFillInverted: '#f3f0e9',\n\t\t\tsurface1: '#faeeda',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\terror: {\n\t\tramp: {\n\t\t\tbgFill1: '#cc1818',\n\t\t\tfgFill: '#f2efef',\n\t\t\tbgFill2: '#b90000',\n\t\t\tsurface2: '#fdf6f5',\n\t\t\tsurface6: '#f5c8c1',\n\t\t\tsurface5: '#f9dbd7',\n\t\t\tsurface4: '#fae4e1',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#470000',\n\t\t\tfgSurface3: '#cc1818',\n\t\t\tfgSurface2: '#f74c40',\n\t\t\tfgSurface1: '#ff8879',\n\t\t\tstroke3: '#cc1818',\n\t\t\tstroke4: '#9d0000',\n\t\t\tstroke2: '#de988e',\n\t\t\tstroke1: '#e1a198',\n\t\t\tbgFillDark: '#231c1b',\n\t\t\tfgFillDark: '#f2efef',\n\t\t\tbgFillInverted2: '#231c1b',\n\t\t\tbgFillInverted1: '#640000',\n\t\t\tfgFillInverted: '#f2efef',\n\t\t\tsurface1: '#fbece9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n};\n"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RampResult } from './types';\nimport type { DEFAULT_SEED_COLORS } from './constants';\n\nexport const DEFAULT_RAMPS: Record<\n\tkeyof typeof DEFAULT_SEED_COLORS,\n\tRampResult\n> = {\n\tbg: {\n\t\tramp: {\n\t\t\tsurface2: '#f8f8f8',\n\t\t\tbgFill1: '#555',\n\t\t\tfgFill: '#f0f0f0',\n\t\t\tbgFill2: '#484848',\n\t\t\tsurface6: '#d2d2d2',\n\t\t\tsurface5: '#e2e2e2',\n\t\t\tsurface4: '#eaeaea',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#1e1e1e',\n\t\t\tfgSurface3: '#6d6d6d',\n\t\t\tfgSurface2: '#8a8a8a',\n\t\t\tfgSurface1: '#aaa',\n\t\t\tstroke3: '#8a8a8a',\n\t\t\tstroke4: '#6c6c6c',\n\t\t\tstroke2: '#d8d8d8',\n\t\t\tstroke1: '#e0e0e0',\n\t\t\tbgFillDark: '#1e1e1e',\n\t\t\tfgFillDark: '#f0f0f0',\n\t\t\tbgFillInverted2: '#1e1e1e',\n\t\t\tbgFillInverted1: '#2d2d2d',\n\t\t\tfgFillInverted: '#f0f0f0',\n\t\t\tsurface1: '#f0f0f0',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tprimary: {\n\t\tramp: {\n\t\t\tbgFill1: '#3858e9',\n\t\t\tfgFill: '#eff0f2',\n\t\t\tbgFill2: '#2e49d9',\n\t\t\tsurface2: '#f6f8fd',\n\t\t\tsurface6: '#c7d2ed',\n\t\t\tsurface5: '#dbe2f4',\n\t\t\tsurface4: '#e6eaf4',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#0b0070',\n\t\t\tfgSurface3: '#3858e9',\n\t\t\tfgSurface2: '#5b82ff',\n\t\t\tfgSurface1: '#85a9ff',\n\t\t\tstroke3: '#3858e9',\n\t\t\tstroke4: '#2337c8',\n\t\t\tstroke2: '#9caacc',\n\t\t\tstroke1: '#a3b1d4',\n\t\t\tbgFillDark: '#1a1e27',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1a1e27',\n\t\t\tbgFillInverted1: '#13009f',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#ecf0f9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tinfo: {\n\t\tramp: {\n\t\t\tbgFill1: '#0090ff',\n\t\t\tfgFill: '#1a1f24',\n\t\t\tbgFill2: '#007fed',\n\t\t\tsurface2: '#f3f9ff',\n\t\t\tsurface6: '#bcd5f1',\n\t\t\tsurface5: '#d3e4f7',\n\t\t\tsurface4: '#deebfa',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#001b4f',\n\t\t\tfgSurface3: '#006bd7',\n\t\t\tfgSurface2: '#008bfa',\n\t\t\tfgSurface1: '#58b0ff',\n\t\t\tstroke3: '#006bd7',\n\t\t\tstroke4: '#004fa9',\n\t\t\tstroke2: '#95b5d9',\n\t\t\tstroke1: '#9fbcdc',\n\t\t\tbgFillDark: '#1a1f24',\n\t\t\tfgFillDark: '#eef0f3',\n\t\t\tbgFillInverted2: '#1a1f24',\n\t\t\tbgFillInverted1: '#002a69',\n\t\t\tfgFillInverted: '#eef0f3',\n\t\t\tsurface1: '#e4f1ff',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tsuccess: {\n\t\tramp: {\n\t\t\tbgFill1: '#4ab866',\n\t\t\tfgFill: '#1b1f1c',\n\t\t\tbgFill2: '#37a756',\n\t\t\tsurface2: '#eaffed',\n\t\t\tsurface6: '#88e89b',\n\t\t\tsurface5: '#aff3bb',\n\t\t\tsurface4: '#c5f7cc',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#002900',\n\t\t\tfgSurface3: '#007f30',\n\t\t\tfgSurface2: '#2b9e4e',\n\t\t\tfgSurface1: '#53c16e',\n\t\t\tstroke3: '#007f30',\n\t\t\tstroke4: '#006013',\n\t\t\tstroke2: '#84c08e',\n\t\t\tstroke1: '#8ac894',\n\t\t\tbgFillDark: '#1b1f1c',\n\t\t\tfgFillDark: '#eaf3eb',\n\t\t\tbgFillInverted2: '#1b1f1c',\n\t\t\tbgFillInverted1: '#003701',\n\t\t\tfgFillInverted: '#eaf3eb',\n\t\t\tsurface1: '#cbfdd2',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tcaution: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0d149',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dcbe2f',\n\t\t\tsurface2: '#fff9c9',\n\t\t\tsurface6: '#e8d172',\n\t\t\tsurface5: '#f7e18a',\n\t\t\tsurface4: '#fee994',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#281d00',\n\t\t\tfgSurface3: '#826a00',\n\t\t\tfgSurface2: '#a48600',\n\t\t\tfgSurface1: '#c6a800',\n\t\t\tstroke3: '#826a00',\n\t\t\tstroke4: '#624f00',\n\t\t\tstroke2: '#bdb17e',\n\t\t\tstroke1: '#c5b883',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#fdf1bf',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#392c00',\n\t\t\tfgFillInverted: '#fdf1bf',\n\t\t\tsurface1: '#ffef9b',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\twarning: {\n\t\tramp: {\n\t\t\tbgFill1: '#f0b849',\n\t\t\tfgFill: '#1f1e1b',\n\t\t\tbgFill2: '#dda633',\n\t\t\tsurface2: '#fff7e0',\n\t\t\tsurface6: '#f4cc84',\n\t\t\tsurface5: '#faddac',\n\t\t\tsurface4: '#fde6bd',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#2e1900',\n\t\t\tfgSurface3: '#926300',\n\t\t\tfgSurface2: '#b47f00',\n\t\t\tfgSurface1: '#d7a02a',\n\t\t\tstroke3: '#926300',\n\t\t\tstroke4: '#6f4900',\n\t\t\tstroke2: '#c7ad7e',\n\t\t\tstroke1: '#d0b381',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f7efe2',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#422800',\n\t\t\tfgFillInverted: '#f7efe2',\n\t\t\tsurface1: '#ffecc4',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\terror: {\n\t\tramp: {\n\t\t\tbgFill1: '#cc1818',\n\t\t\tfgFill: '#f2efef',\n\t\t\tbgFill2: '#b90000',\n\t\t\tsurface2: '#fff6f4',\n\t\t\tsurface6: '#f3c8c2',\n\t\t\tsurface5: '#f8dcd7',\n\t\t\tsurface4: '#f6e6e3',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#470000',\n\t\t\tfgSurface3: '#cc1818',\n\t\t\tfgSurface2: '#f74c40',\n\t\t\tfgSurface1: '#ff8879',\n\t\t\tstroke3: '#cc1818',\n\t\t\tstroke4: '#9d0000',\n\t\t\tstroke2: '#d39c95',\n\t\t\tstroke1: '#daa39b',\n\t\t\tbgFillDark: '#231c1b',\n\t\t\tfgFillDark: '#f2efef',\n\t\t\tbgFillInverted2: '#231c1b',\n\t\t\tbgFillInverted1: '#640000',\n\t\t\tfgFillInverted: '#f2efef',\n\t\t\tsurface1: '#fcece9',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n};\n"],
5
5
  "mappings": ";AAMO,IAAM,gBAGT;AAAA,EACH,IAAI;AAAA,IACH,MAAM;AAAA,MACL,UAAU;AAAA,MACV,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,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AChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AAAA,EACA,OAAO;AAAA,IACN,MAAM;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/color-ramps/lib/find-color-with-constraints.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH, type ColorTypes } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { solveWithBisect } from './utils';\nimport { WHITE, BLACK, CONTRAST_EPSILON } from './constants';\nimport { clampToGamut, getContrast } from './color-utils';\nimport { type TaperChromaOptions, taperChroma } from './taper-chroma';\n\n/**\n * Difference of contrast values that grows linearly with the Y luminance.\n * We get more precise linear interpolations when we use this.\n * @param c1 First contrast.\n * @param c2 Second contrast.\n * @return Difference of logarithms.\n */\nfunction cdiff( c1: number, c2: number ) {\n\treturn Math.log( c1 / c2 );\n}\n\n/**\n * Solve for L such that:\n * - the L applied to the seed meets the contrast target against the reference\n * - the search is performed in one direction (ie lighter / darker)\n * - more constraints can be applied around lightness\n * - chroma could be tapered\n * @param reference\n * @param seed\n * @param target\n * @param direction\n * @param options\n * @param options.lightnessConstraint\n * @param options.lightnessConstraint.type\n * @param options.lightnessConstraint.value\n * @param options.taperChromaOptions\n */\nexport function findColorMeetingRequirements(\n\treference: ColorTypes,\n\tseed: ColorTypes,\n\ttarget: number,\n\tdirection: 'lighter' | 'darker',\n\t{\n\t\tlightnessConstraint,\n\t\ttaperChromaOptions,\n\t}: {\n\t\tlightnessConstraint?: {\n\t\t\ttype: 'force' | 'onlyIfSucceeds';\n\t\t\tvalue: number;\n\t\t};\n\t\ttaperChromaOptions?: TaperChromaOptions;\n\t} = {}\n): { color: ColorTypes; reached: boolean; achieved: number; deficit?: number } {\n\t// A target of 1 means same color.\n\t// A target lower than 1 doesn't make sense.\n\tif ( target <= 1 ) {\n\t\treturn {\n\t\t\tcolor: reference,\n\t\t\treached: true,\n\t\t\tachieved: 1,\n\t\t};\n\t}\n\n\tfunction getColorForL( l: number ): ColorTypes {\n\t\tlet newL = l;\n\t\tlet newC = get( seed, [ OKLCH, 'c' ] );\n\n\t\tif ( taperChromaOptions ) {\n\t\t\tconst tapered = taperChroma( seed, newL, taperChromaOptions );\n\t\t\t// taperChroma returns either { l, c } or a ColorObject\n\t\t\tif ( 'l' in tapered && 'c' in tapered ) {\n\t\t\t\tnewL = tapered.l;\n\t\t\t\tnewC = tapered.c;\n\t\t\t} else {\n\t\t\t\t// It's already a ColorObject, return it directly\n\t\t\t\treturn tapered;\n\t\t\t}\n\t\t}\n\n\t\treturn clampToGamut( {\n\t\t\tspaceId: 'oklch',\n\t\t\tcoords: [ newL, newC, get( seed, [ OKLCH, 'h' ] ) ],\n\t\t} );\n\t}\n\n\t// Set the boundary based on the direction.\n\tconst mostContrastingL = direction === 'lighter' ? 1 : 0;\n\tconst mostContrastingColor = direction === 'lighter' ? WHITE : BLACK;\n\tconst highestContrast = getContrast( reference, mostContrastingColor );\n\n\tif ( lightnessConstraint ) {\n\t\t// Apply a specific L value.\n\t\t// Useful when pinning a step to a specific lightness, of to specify\n\t\t// min/max L values.\n\t\tconst colorWithExactL = getColorForL( lightnessConstraint.value );\n\t\tconst exactLContrast = getContrast( reference, colorWithExactL );\n\t\tconst exactLContrastMeetsTarget =\n\t\t\tcdiff( exactLContrast, target ) >= -CONTRAST_EPSILON;\n\n\t\t// If the L constraint is of \"force\" type, apply it even when it doesn't\n\t\t// meet the contrast target.\n\t\tif (\n\t\t\texactLContrastMeetsTarget ||\n\t\t\tlightnessConstraint.type === 'force'\n\t\t) {\n\t\t\treturn {\n\t\t\t\tcolor: colorWithExactL,\n\t\t\t\treached: exactLContrastMeetsTarget,\n\t\t\t\tachieved: exactLContrast,\n\t\t\t\tdeficit: exactLContrastMeetsTarget\n\t\t\t\t\t? cdiff( exactLContrast, highestContrast )\n\t\t\t\t\t: cdiff( target, exactLContrast ),\n\t\t\t};\n\t\t}\n\t}\n\n\t// If even the most contrasting color can't reach the target, the target is unreachable.\n\t// On the other hand, if the contrast is very close to the target, we consider it reached.\n\tif ( cdiff( highestContrast, target ) <= CONTRAST_EPSILON ) {\n\t\treturn {\n\t\t\tcolor: mostContrastingColor,\n\t\t\treached: cdiff( highestContrast, target ) >= -CONTRAST_EPSILON,\n\t\t\tachieved: highestContrast,\n\t\t\tdeficit: cdiff( target, highestContrast ),\n\t\t};\n\t}\n\n\t// Bracket: low fails, high meets.\n\t// Originally this was seed.oklch.l \u2014 although it's an assumption that works\n\t// only when we know for sure the direction of the search.\n\t// TODO: can we bring this back to seed.oklch.l ?\n\tconst lowerL = get( reference, [ OKLCH, 'l' ] );\n\tconst lowerContrast = cdiff( 1, target );\n\tconst upperL = mostContrastingL;\n\tconst upperContrast = cdiff( highestContrast, target );\n\n\tconst bestColor = solveWithBisect(\n\t\tgetColorForL,\n\t\t( c: ColorTypes ) => cdiff( getContrast( reference, c ), target ),\n\t\tlowerL,\n\t\tlowerContrast,\n\t\tupperL,\n\t\tupperContrast\n\t);\n\n\treturn {\n\t\tcolor: bestColor,\n\t\treached: true,\n\t\tachieved: target,\n\t\t// Negative number that specifies how much room we have.\n\t\tdeficit: cdiff( target, highestContrast ),\n\t};\n}\n"],
5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ACV,SAAS,4BACN,MAAO,gBAAgB,eAAgB,IACvC,MAAO,QAAQ,cAAe;AAAA,MAClC;AAAA,IACD;AAAA,EACD;AAIA,MAAK,MAAO,iBAAiB,MAAO,KAAK,kBAAmB;AAC3D,WAAO;AAAA,MACN,OAAO;AAAA,MACP,SAAS,MAAO,iBAAiB,MAAO,KAAK,CAAC;AAAA,MAC9C,UAAU;AAAA,MACV,SAAS,MAAO,QAAQ,eAAgB;AAAA,IACzC;AAAA,EACD;AAMA,QAAM,SAAS,IAAK,WAAW,CAAE,OAAO,GAAI,CAAE;AAC9C,QAAM,gBAAgB,MAAO,GAAG,MAAO;AACvC,QAAM,SAAS;AACf,QAAM,gBAAgB,MAAO,iBAAiB,MAAO;AAErD,QAAM,YAAY;AAAA,IACjB;AAAA,IACA,CAAE,MAAmB,MAAO,YAAa,WAAW,CAAE,GAAG,MAAO;AAAA,IAChE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA;AAAA,IAEV,SAAS,MAAO,QAAQ,eAAgB;AAAA,EACzC;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH, type PlainColorObject } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { solveWithBisect } from './utils';\nimport { WHITE, BLACK, CONTRAST_EPSILON } from './constants';\nimport { clampToGamut, getContrast } from './color-utils';\nimport { type TaperChromaOptions, taperChroma } from './taper-chroma';\n\n/**\n * Difference of contrast values that grows linearly with the Y luminance.\n * We get more precise linear interpolations when we use this.\n * @param c1 First contrast.\n * @param c2 Second contrast.\n * @return Difference of logarithms.\n */\nfunction cdiff( c1: number, c2: number ) {\n\treturn Math.log( c1 / c2 );\n}\n\n/**\n * Solve for L such that:\n * - the L applied to the seed meets the contrast target against the reference\n * - the search is performed in one direction (ie lighter / darker)\n * - more constraints can be applied around lightness\n * @param reference\n * @param seed\n * @param target\n * @param direction\n * @param options\n * @param options.lightnessConstraint\n * @param options.lightnessConstraint.type\n * @param options.lightnessConstraint.value\n * @param options.taperChromaOptions\n */\nexport function findColorMeetingRequirements(\n\treference: PlainColorObject,\n\tseed: PlainColorObject,\n\ttarget: number,\n\tdirection: 'lighter' | 'darker',\n\t{\n\t\tlightnessConstraint,\n\t\ttaperChromaOptions,\n\t}: {\n\t\tlightnessConstraint?: {\n\t\t\ttype: 'force' | 'onlyIfSucceeds';\n\t\t\tvalue: number;\n\t\t};\n\t\ttaperChromaOptions?: TaperChromaOptions;\n\t} = {}\n): {\n\tcolor: PlainColorObject;\n\treached: boolean;\n\tachieved: number;\n\tdeficit?: number;\n} {\n\t// A target of 1 means same color.\n\t// A target lower than 1 doesn't make sense.\n\tif ( target <= 1 ) {\n\t\treturn {\n\t\t\tcolor: reference,\n\t\t\treached: true,\n\t\t\tachieved: 1,\n\t\t};\n\t}\n\n\tfunction getColorForL( l: number ): PlainColorObject {\n\t\tlet newL = l;\n\t\tlet newC = get( seed, [ OKLCH, 'c' ] );\n\n\t\tif ( taperChromaOptions ) {\n\t\t\tconst tapered = taperChroma( seed, newL, taperChromaOptions );\n\t\t\t// taperChroma returns either { l, c } or a ColorObject\n\t\t\tif ( 'l' in tapered && 'c' in tapered ) {\n\t\t\t\tnewL = tapered.l;\n\t\t\t\tnewC = tapered.c;\n\t\t\t} else {\n\t\t\t\t// It's already a ColorObject, return it directly\n\t\t\t\treturn tapered;\n\t\t\t}\n\t\t}\n\n\t\treturn clampToGamut( {\n\t\t\tspaceId: 'oklch',\n\t\t\tcoords: [ newL, newC, get( seed, [ OKLCH, 'h' ] ) ],\n\t\t} );\n\t}\n\n\t// Set the boundary based on the direction.\n\tconst mostContrastingL = direction === 'lighter' ? 1 : 0;\n\tconst mostContrastingColor = direction === 'lighter' ? WHITE : BLACK;\n\tconst highestContrast = getContrast( reference, mostContrastingColor );\n\n\tif ( lightnessConstraint ) {\n\t\t// Apply a specific L value.\n\t\t// Useful when pinning a step to a specific lightness, of to specify\n\t\t// min/max L values.\n\t\tconst colorWithExactL = getColorForL( lightnessConstraint.value );\n\t\tconst exactLContrast = getContrast( reference, colorWithExactL );\n\t\tconst exactLContrastMeetsTarget =\n\t\t\tcdiff( exactLContrast, target ) >= -CONTRAST_EPSILON;\n\n\t\t// If the L constraint is of \"force\" type, apply it even when it doesn't\n\t\t// meet the contrast target.\n\t\tif (\n\t\t\texactLContrastMeetsTarget ||\n\t\t\tlightnessConstraint.type === 'force'\n\t\t) {\n\t\t\treturn {\n\t\t\t\tcolor: colorWithExactL,\n\t\t\t\treached: exactLContrastMeetsTarget,\n\t\t\t\tachieved: exactLContrast,\n\t\t\t\tdeficit: exactLContrastMeetsTarget\n\t\t\t\t\t? cdiff( exactLContrast, highestContrast )\n\t\t\t\t\t: cdiff( target, exactLContrast ),\n\t\t\t};\n\t\t}\n\t}\n\n\t// If even the most contrasting color can't reach the target, the target is unreachable.\n\t// On the other hand, if the contrast is very close to the target, we consider it reached.\n\tif ( cdiff( highestContrast, target ) <= CONTRAST_EPSILON ) {\n\t\treturn {\n\t\t\tcolor: mostContrastingColor,\n\t\t\treached: cdiff( highestContrast, target ) >= -CONTRAST_EPSILON,\n\t\t\tachieved: highestContrast,\n\t\t\tdeficit: cdiff( target, highestContrast ),\n\t\t};\n\t}\n\n\t// Bracket: low fails, high meets.\n\t// Originally this was seed.oklch.l \u2014 although it's an assumption that works\n\t// only when we know for sure the direction of the search.\n\t// TODO: can we bring this back to seed.oklch.l ?\n\tconst lowerL = get( reference, [ OKLCH, 'l' ] );\n\tconst lowerContrast = cdiff( 1, target );\n\tconst upperL = mostContrastingL;\n\tconst upperContrast = cdiff( highestContrast, target );\n\n\tconst bestColor = solveWithBisect(\n\t\tgetColorForL,\n\t\t( c ) => cdiff( getContrast( reference, c ), target ),\n\t\tlowerL,\n\t\tlowerContrast,\n\t\tupperL,\n\t\tupperContrast\n\t);\n\n\treturn {\n\t\tcolor: bestColor,\n\t\treached: true,\n\t\tachieved: target,\n\t\t// Negative number that specifies how much room we have.\n\t\tdeficit: cdiff( target, highestContrast ),\n\t};\n}\n"],
5
+ "mappings": ";AAGA,SAAS,KAAK,aAAoC;AAKlD,OAAO;AACP,SAAS,uBAAuB;AAChC,SAAS,OAAO,OAAO,wBAAwB;AAC/C,SAAS,cAAc,mBAAmB;AAC1C,SAAkC,mBAAmB;AASrD,SAAS,MAAO,IAAY,IAAa;AACxC,SAAO,KAAK,IAAK,KAAK,EAAG;AAC1B;AAiBO,SAAS,6BACf,WACA,MACA,QACA,WACA;AAAA,EACC;AAAA,EACA;AACD,IAMI,CAAC,GAMJ;AAGD,MAAK,UAAU,GAAI;AAClB,WAAO;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,EACD;AAEA,WAAS,aAAc,GAA8B;AACpD,QAAI,OAAO;AACX,QAAI,OAAO,IAAK,MAAM,CAAE,OAAO,GAAI,CAAE;AAErC,QAAK,oBAAqB;AACzB,YAAM,UAAU,YAAa,MAAM,MAAM,kBAAmB;AAE5D,UAAK,OAAO,WAAW,OAAO,SAAU;AACvC,eAAO,QAAQ;AACf,eAAO,QAAQ;AAAA,MAChB,OAAO;AAEN,eAAO;AAAA,MACR;AAAA,IACD;AAEA,WAAO,aAAc;AAAA,MACpB,SAAS;AAAA,MACT,QAAQ,CAAE,MAAM,MAAM,IAAK,MAAM,CAAE,OAAO,GAAI,CAAE,CAAE;AAAA,IACnD,CAAE;AAAA,EACH;AAGA,QAAM,mBAAmB,cAAc,YAAY,IAAI;AACvD,QAAM,uBAAuB,cAAc,YAAY,QAAQ;AAC/D,QAAM,kBAAkB,YAAa,WAAW,oBAAqB;AAErE,MAAK,qBAAsB;AAI1B,UAAM,kBAAkB,aAAc,oBAAoB,KAAM;AAChE,UAAM,iBAAiB,YAAa,WAAW,eAAgB;AAC/D,UAAM,4BACL,MAAO,gBAAgB,MAAO,KAAK,CAAC;AAIrC,QACC,6BACA,oBAAoB,SAAS,SAC5B;AACD,aAAO;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,QACT,UAAU;AAAA,QACV,SAAS,4BACN,MAAO,gBAAgB,eAAgB,IACvC,MAAO,QAAQ,cAAe;AAAA,MAClC;AAAA,IACD;AAAA,EACD;AAIA,MAAK,MAAO,iBAAiB,MAAO,KAAK,kBAAmB;AAC3D,WAAO;AAAA,MACN,OAAO;AAAA,MACP,SAAS,MAAO,iBAAiB,MAAO,KAAK,CAAC;AAAA,MAC9C,UAAU;AAAA,MACV,SAAS,MAAO,QAAQ,eAAgB;AAAA,IACzC;AAAA,EACD;AAMA,QAAM,SAAS,IAAK,WAAW,CAAE,OAAO,GAAI,CAAE;AAC9C,QAAM,gBAAgB,MAAO,GAAG,MAAO;AACvC,QAAM,SAAS;AACf,QAAM,gBAAgB,MAAO,iBAAiB,MAAO;AAErD,QAAM,YAAY;AAAA,IACjB;AAAA,IACA,CAAE,MAAO,MAAO,YAAa,WAAW,CAAE,GAAG,MAAO;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA;AAAA,IAEV,SAAS,MAAO,QAAQ,eAAgB;AAAA,EACzC;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/color-ramps/lib/index.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tclone,\n\tget,\n\tOKLCH,\n\tparse,\n\tset,\n\ttype ColorTypes,\n\ttype PlainColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { clampToGamut, getContrast, getColorString } from './color-utils';\nimport { findColorMeetingRequirements } from './find-color-with-constraints';\nimport {\n\tsortByDependency,\n\tcomputeBetterFgColorDirection,\n\tadjustContrastTarget,\n\tstepsForStep,\n\tsolveWithBisect,\n} from './utils';\n\nimport type {\n\tFollowDirection,\n\tRamp,\n\tRampDirection,\n\tRampConfig,\n\tRampResult,\n} from './types';\nimport { CONTRAST_EPSILON } from './constants';\n\n/**\n * Calculate a complete color ramp based on the provided configuration.\n *\n * @param params - The calculation parameters\n * @param params.seed - The base color to build the ramp from\n * @param params.sortedSteps - Steps sorted in dependency order\n * @param params.config - Ramp configuration defining contrast requirements\n * @param params.mainDir - Primary direction for the ramp (lighter/darker)\n * @param params.oppDir - Opposite direction from mainDir\n * @param params.pinLightness - Optional lightness override for a given step\n * @param params.pinLightness.stepName\n * @param params.pinLightness.value\n * @return Object containing ramp results and satisfaction status\n */\nfunction calculateRamp( {\n\tseed,\n\tsortedSteps,\n\tconfig,\n\tmainDir,\n\toppDir,\n\tpinLightness,\n}: {\n\tseed: ColorTypes;\n\tsortedSteps: ( keyof Ramp )[];\n\tconfig: RampConfig;\n\tmainDir: RampDirection;\n\toppDir: RampDirection;\n\tpinLightness?: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} ) {\n\tconst rampResults = {} as Record< keyof Ramp, string >;\n\tlet warnings: string[] | undefined;\n\tlet maxDeficit = -Infinity;\n\tlet maxDeficitDirection: RampDirection = 'lighter';\n\tlet maxDeficitStep;\n\n\t// Keep track of the calculated colors, as they are going to be useful\n\t// when other colors reference them.\n\tconst calculatedColors = new Map< keyof Ramp | 'seed', ColorTypes >();\n\tcalculatedColors.set( 'seed', seed );\n\n\tfor ( const stepName of sortedSteps ) {\n\t\tconst {\n\t\t\tcontrast,\n\t\t\tlightness: stepLightnessConstraint,\n\t\t\ttaperChromaOptions,\n\t\t\tsameAsIfPossible,\n\t\t} = config[ stepName ];\n\n\t\tconst referenceColor = calculatedColors.get( contrast.reference );\n\t\tif ( ! referenceColor ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Reference color for step ${ stepName } not found: ${ contrast.reference }`\n\t\t\t);\n\t\t}\n\n\t\t// Check if we can reuse color from the `sameAsIfPossible` config option\n\t\tif ( sameAsIfPossible ) {\n\t\t\tconst candidateColor = calculatedColors.get( sameAsIfPossible );\n\t\t\tif ( ! candidateColor ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Same-as color for step ${ stepName } not found: ${ sameAsIfPossible }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst candidateContrast = getContrast(\n\t\t\t\treferenceColor,\n\t\t\t\tcandidateColor\n\t\t\t);\n\t\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\t\t\t// If the candidate meets the contrast requirement, use it\n\t\t\tif ( candidateContrast >= adjustedTarget ) {\n\t\t\t\t// Store the reused color\n\t\t\t\tcalculatedColors.set( stepName, candidateColor );\n\t\t\t\trampResults[ stepName ] = getColorString( candidateColor );\n\n\t\t\t\tcontinue; // Skip to next step\n\t\t\t}\n\t\t}\n\n\t\tfunction computeDirection(\n\t\t\tcolor: ColorTypes,\n\t\t\tfollowDirection: FollowDirection\n\t\t): RampDirection {\n\t\t\tif ( followDirection === 'main' ) {\n\t\t\t\treturn mainDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'opposite' ) {\n\t\t\t\treturn oppDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'best' ) {\n\t\t\t\treturn computeBetterFgColorDirection(\n\t\t\t\t\tcolor,\n\t\t\t\t\tcontrast.preferLighter\n\t\t\t\t).better;\n\t\t\t}\n\n\t\t\treturn followDirection;\n\t\t}\n\n\t\tconst computedDir = computeDirection(\n\t\t\treferenceColor,\n\t\t\tcontrast.followDirection\n\t\t);\n\n\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\n\t\t// Define the lightness constraint, if needed.\n\t\tlet lightnessConstraint;\n\t\tif ( pinLightness?.stepName === stepName ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: pinLightness.value,\n\t\t\t\ttype: 'force',\n\t\t\t} as const;\n\t\t} else if ( stepLightnessConstraint ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: stepLightnessConstraint( computedDir ),\n\t\t\t\ttype: 'onlyIfSucceeds',\n\t\t\t} as const;\n\t\t}\n\n\t\t// Calculate the color meeting the requirements\n\t\tconst searchResults = findColorMeetingRequirements(\n\t\t\treferenceColor,\n\t\t\tseed,\n\t\t\tadjustedTarget,\n\t\t\tcomputedDir,\n\t\t\t{\n\t\t\t\tlightnessConstraint,\n\t\t\t\ttaperChromaOptions,\n\t\t\t}\n\t\t);\n\n\t\t// When the target contrast is not met, take note of it and use\n\t\t// that information to guide the ramp calculation bisection.\n\t\tif (\n\t\t\t! contrast.ignoreWhenAdjustingSeed &&\n\t\t\tsearchResults.deficit &&\n\t\t\tsearchResults.deficit > maxDeficit\n\t\t) {\n\t\t\tmaxDeficit = searchResults.deficit;\n\t\t\tmaxDeficitDirection = computedDir;\n\t\t\tmaxDeficitStep = stepName;\n\t\t}\n\n\t\t// Store calculated color for future dependencies\n\t\tcalculatedColors.set( stepName, searchResults.color );\n\n\t\t// Add to results\n\t\trampResults[ stepName ] = getColorString( searchResults.color );\n\n\t\tif ( ! searchResults.reached && ! contrast.ignoreWhenAdjustingSeed ) {\n\t\t\twarnings ??= [];\n\t\t\twarnings.push( stepName );\n\t\t}\n\t}\n\n\treturn {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t};\n}\n\nexport function buildRamp(\n\tseedArg: string,\n\tconfig: RampConfig,\n\t{\n\t\tmainDirection,\n\t\tpinLightness,\n\t\trescaleToFitContrastTargets = true,\n\t}: {\n\t\tmainDirection?: RampDirection;\n\t\tpinLightness?: {\n\t\t\tstepName: keyof Ramp;\n\t\t\tvalue: number;\n\t\t};\n\t\trescaleToFitContrastTargets?: boolean;\n\t} = {}\n): RampResult {\n\tlet seed: PlainColorObject;\n\ttry {\n\t\tseed = clampToGamut( parse( seedArg ) );\n\t} catch ( error ) {\n\t\tthrow new Error(\n\t\t\t`Invalid seed color \"${ seedArg }\": ${\n\t\t\t\terror instanceof Error ? error.message : 'Unknown error'\n\t\t\t}`\n\t\t);\n\t}\n\n\tlet mainDir: RampDirection = 'lighter';\n\tlet oppDir: RampDirection = 'darker';\n\n\tif ( mainDirection ) {\n\t\tmainDir = mainDirection;\n\t\toppDir = mainDirection === 'darker' ? 'lighter' : 'darker';\n\t} else {\n\t\tconst { better, worse } = computeBetterFgColorDirection( seed );\n\t\tmainDir = better;\n\t\toppDir = worse;\n\t}\n\n\t// Get the correct calculation order based on dependencies\n\tconst sortedSteps = sortByDependency( config );\n\n\t// Calculate the ramp with the initial seed.\n\tconst {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t} = calculateRamp( {\n\t\tseed,\n\t\tsortedSteps,\n\t\tconfig,\n\t\tmainDir,\n\t\toppDir,\n\t\tpinLightness,\n\t} );\n\n\tlet bestRamp = rampResults;\n\n\tif ( maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets ) {\n\t\tconst iterSteps = stepsForStep( maxDeficitStep!, config );\n\n\t\tfunction getSeedForL( l: number ): ColorTypes {\n\t\t\treturn clampToGamut( set( clone( seed ), [ OKLCH, 'l' ], l ) );\n\t\t}\n\n\t\tfunction getDeficitForSeed( s: ColorTypes ): number {\n\t\t\tconst iterationResults = calculateRamp( {\n\t\t\t\tseed: s,\n\t\t\t\tsortedSteps: iterSteps,\n\t\t\t\tconfig,\n\t\t\t\tmainDir,\n\t\t\t\toppDir,\n\t\t\t\tpinLightness,\n\t\t\t} );\n\n\t\t\t// If the constraints start failing in the opposite direction to the original\n\t\t\t// iteration's direction, that means we've moved too far away from the target.\n\t\t\t// Don't use the `maxDeficit` value because it's not related to our search,\n\t\t\t// and might even be positive, which would confuse the bisection algorithm.\n\t\t\treturn iterationResults.maxDeficitDirection === maxDeficitDirection\n\t\t\t\t? iterationResults.maxDeficit\n\t\t\t\t: -maxDeficit;\n\t\t}\n\n\t\t// For a scale with the \"lighter\" direction, the contrast can be improved\n\t\t// by darkening the seed. For \"darker\" direction, by lightening the seed.\n\t\tconst lowerSeedL = maxDeficitDirection === 'lighter' ? 0 : 1;\n\t\tconst lowerDeficit = -maxDeficit;\n\t\tconst upperSeedL = get( seed, [ OKLCH, 'l' ] );\n\t\tconst upperDeficit = maxDeficit;\n\n\t\tconst bestSeed = solveWithBisect(\n\t\t\tgetSeedForL,\n\t\t\tgetDeficitForSeed,\n\t\t\tlowerSeedL,\n\t\t\tlowerDeficit,\n\t\t\tupperSeedL,\n\t\t\tupperDeficit\n\t\t);\n\n\t\t// Calculate the final ramp with adjusted seed.\n\t\tbestRamp = calculateRamp( {\n\t\t\tseed: bestSeed,\n\t\t\tsortedSteps,\n\t\t\tconfig,\n\t\t\tmainDir,\n\t\t\toppDir,\n\t\t\tpinLightness,\n\t\t} ).rampResults;\n\t}\n\n\t// Swap surface1 and surface3 for darker ramps to maintain visual elevation hierarchy.\n\t// This ensures surface1 appears \"behind\" surface2, and surface3 appears \"in front\",\n\t// regardless of the ramp's main direction.\n\tif ( mainDir === 'darker' ) {\n\t\tconst tmpSurface1 = bestRamp.surface1;\n\t\tbestRamp.surface1 = bestRamp.surface3;\n\t\tbestRamp.surface3 = tmpSurface1;\n\t}\n\n\treturn {\n\t\tramp: bestRamp,\n\t\twarnings,\n\t\tdirection: mainDir,\n\t};\n}\n"],
5
- "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAKP,OAAO;AACP,SAAS,cAAc,aAAa,sBAAsB;AAC1D,SAAS,oCAAoC;AAC7C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AASP,SAAS,wBAAwB;AAgBjC,SAAS,cAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAUI;AACH,QAAM,cAAc,C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ainColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { clampToGamut, getContrast, getColorString } from './color-utils';\nimport { findColorMeetingRequirements } from './find-color-with-constraints';\nimport {\n\tsortByDependency,\n\tcomputeBetterFgColorDirection,\n\tadjustContrastTarget,\n\tstepsForStep,\n\tsolveWithBisect,\n} from './utils';\n\nimport type {\n\tFollowDirection,\n\tRamp,\n\tRampDirection,\n\tRampConfig,\n\tRampResult,\n} from './types';\nimport { CONTRAST_EPSILON } from './constants';\n\n/**\n * Calculate a complete color ramp based on the provided configuration.\n *\n * @param params - The calculation parameters\n * @param params.seed - The base color to build the ramp from\n * @param params.sortedSteps - Steps sorted in dependency order\n * @param params.config - Ramp configuration defining contrast requirements\n * @param params.mainDir - Primary direction for the ramp (lighter/darker)\n * @param params.oppDir - Opposite direction from mainDir\n * @param params.pinLightness - Optional lightness override for a given step\n * @param params.pinLightness.stepName\n * @param params.pinLightness.value\n * @return Object containing ramp results and satisfaction status\n */\nfunction calculateRamp( {\n\tseed,\n\tsortedSteps,\n\tconfig,\n\tmainDir,\n\toppDir,\n\tpinLightness,\n}: {\n\tseed: PlainColorObject;\n\tsortedSteps: ( keyof Ramp )[];\n\tconfig: RampConfig;\n\tmainDir: RampDirection;\n\toppDir: RampDirection;\n\tpinLightness?: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} ) {\n\tconst rampResults = {} as Record< keyof Ramp, string >;\n\tlet warnings: string[] | undefined;\n\tlet maxDeficit = -Infinity;\n\tlet maxDeficitDirection: RampDirection = 'lighter';\n\tlet maxDeficitStep;\n\n\t// Keep track of the calculated colors, as they are going to be useful\n\t// when other colors reference them.\n\tconst calculatedColors = new Map< keyof Ramp | 'seed', PlainColorObject >();\n\tcalculatedColors.set( 'seed', seed );\n\n\tfor ( const stepName of sortedSteps ) {\n\t\tconst {\n\t\t\tcontrast,\n\t\t\tlightness: stepLightnessConstraint,\n\t\t\ttaperChromaOptions,\n\t\t\tsameAsIfPossible,\n\t\t} = config[ stepName ];\n\n\t\tconst referenceColor = calculatedColors.get( contrast.reference );\n\t\tif ( ! referenceColor ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Reference color for step ${ stepName } not found: ${ contrast.reference }`\n\t\t\t);\n\t\t}\n\n\t\t// Check if we can reuse color from the `sameAsIfPossible` config option\n\t\tif ( sameAsIfPossible ) {\n\t\t\tconst candidateColor = calculatedColors.get( sameAsIfPossible );\n\t\t\tif ( ! candidateColor ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Same-as color for step ${ stepName } not found: ${ sameAsIfPossible }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst candidateContrast = getContrast(\n\t\t\t\treferenceColor,\n\t\t\t\tcandidateColor\n\t\t\t);\n\t\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\t\t\t// If the candidate meets the contrast requirement, use it\n\t\t\tif ( candidateContrast >= adjustedTarget ) {\n\t\t\t\t// Store the reused color\n\t\t\t\tcalculatedColors.set( stepName, candidateColor );\n\t\t\t\trampResults[ stepName ] = getColorString( candidateColor );\n\n\t\t\t\tcontinue; // Skip to next step\n\t\t\t}\n\t\t}\n\n\t\tfunction computeDirection(\n\t\t\tcolor: ColorTypes,\n\t\t\tfollowDirection: FollowDirection\n\t\t): RampDirection {\n\t\t\tif ( followDirection === 'main' ) {\n\t\t\t\treturn mainDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'opposite' ) {\n\t\t\t\treturn oppDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'best' ) {\n\t\t\t\treturn computeBetterFgColorDirection(\n\t\t\t\t\tcolor,\n\t\t\t\t\tcontrast.preferLighter\n\t\t\t\t).better;\n\t\t\t}\n\n\t\t\treturn followDirection;\n\t\t}\n\n\t\tconst computedDir = computeDirection(\n\t\t\treferenceColor,\n\t\t\tcontrast.followDirection\n\t\t);\n\n\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\n\t\t// Define the lightness constraint, if needed.\n\t\tlet lightnessConstraint;\n\t\tif ( pinLightness?.stepName === stepName ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: pinLightness.value,\n\t\t\t\ttype: 'force',\n\t\t\t} as const;\n\t\t} else if ( stepLightnessConstraint ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: stepLightnessConstraint( computedDir ),\n\t\t\t\ttype: 'onlyIfSucceeds',\n\t\t\t} as const;\n\t\t}\n\n\t\t// Calculate the color meeting the requirements\n\t\tconst searchResults = findColorMeetingRequirements(\n\t\t\treferenceColor,\n\t\t\tseed,\n\t\t\tadjustedTarget,\n\t\t\tcomputedDir,\n\t\t\t{\n\t\t\t\tlightnessConstraint,\n\t\t\t\ttaperChromaOptions,\n\t\t\t}\n\t\t);\n\n\t\t// When the target contrast is not met, take note of it and use\n\t\t// that information to guide the ramp calculation bisection.\n\t\tif (\n\t\t\t! contrast.ignoreWhenAdjustingSeed &&\n\t\t\tsearchResults.deficit &&\n\t\t\tsearchResults.deficit > maxDeficit\n\t\t) {\n\t\t\tmaxDeficit = searchResults.deficit;\n\t\t\tmaxDeficitDirection = computedDir;\n\t\t\tmaxDeficitStep = stepName;\n\t\t}\n\n\t\t// Store calculated color for future dependencies\n\t\tcalculatedColors.set( stepName, searchResults.color );\n\n\t\t// Add to results\n\t\trampResults[ stepName ] = getColorString( searchResults.color );\n\n\t\tif ( ! searchResults.reached && ! contrast.ignoreWhenAdjustingSeed ) {\n\t\t\twarnings ??= [];\n\t\t\twarnings.push( stepName );\n\t\t}\n\t}\n\n\treturn {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t};\n}\n\nexport function buildRamp(\n\tseedArg: string,\n\tconfig: RampConfig,\n\t{\n\t\tmainDirection,\n\t\tpinLightness,\n\t\trescaleToFitContrastTargets = true,\n\t}: {\n\t\tmainDirection?: RampDirection;\n\t\tpinLightness?: {\n\t\t\tstepName: keyof Ramp;\n\t\t\tvalue: number;\n\t\t};\n\t\trescaleToFitContrastTargets?: boolean;\n\t} = {}\n): RampResult {\n\tlet seed: PlainColorObject;\n\ttry {\n\t\tseed = clampToGamut( parse( seedArg ) );\n\t} catch ( error ) {\n\t\tthrow new Error(\n\t\t\t`Invalid seed color \"${ seedArg }\": ${\n\t\t\t\terror instanceof Error ? error.message : 'Unknown error'\n\t\t\t}`\n\t\t);\n\t}\n\n\tlet mainDir: RampDirection = 'lighter';\n\tlet oppDir: RampDirection = 'darker';\n\n\tif ( mainDirection ) {\n\t\tmainDir = mainDirection;\n\t\toppDir = mainDirection === 'darker' ? 'lighter' : 'darker';\n\t} else {\n\t\tconst { better, worse } = computeBetterFgColorDirection( seed );\n\t\tmainDir = better;\n\t\toppDir = worse;\n\t}\n\n\t// Get the correct calculation order based on dependencies\n\tconst sortedSteps = sortByDependency( config );\n\n\t// Calculate the ramp with the initial seed.\n\tconst {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t} = calculateRamp( {\n\t\tseed,\n\t\tsortedSteps,\n\t\tconfig,\n\t\tmainDir,\n\t\toppDir,\n\t\tpinLightness,\n\t} );\n\n\tlet bestRamp = rampResults;\n\n\tif ( maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets ) {\n\t\tconst iterSteps = stepsForStep( maxDeficitStep!, config );\n\n\t\tfunction getSeedForL( l: number ): PlainColorObject {\n\t\t\treturn clampToGamut( set( clone( seed ), [ OKLCH, 'l' ], l ) );\n\t\t}\n\n\t\tfunction getDeficitForSeed( s: PlainColorObject ): number {\n\t\t\tconst iterationResults = calculateRamp( {\n\t\t\t\tseed: s,\n\t\t\t\tsortedSteps: iterSteps,\n\t\t\t\tconfig,\n\t\t\t\tmainDir,\n\t\t\t\toppDir,\n\t\t\t\tpinLightness,\n\t\t\t} );\n\n\t\t\t// If the constraints start failing in the opposite direction to the original\n\t\t\t// iteration's direction, that means we've moved too far away from the target.\n\t\t\t// Don't use the `maxDeficit` value because it's not related to our search,\n\t\t\t// and might even be positive, which would confuse the bisection algorithm.\n\t\t\treturn iterationResults.maxDeficitDirection === maxDeficitDirection\n\t\t\t\t? iterationResults.maxDeficit\n\t\t\t\t: -maxDeficit;\n\t\t}\n\n\t\t// For a scale with the \"lighter\" direction, the contrast can be improved\n\t\t// by darkening the seed. For \"darker\" direction, by lightening the seed.\n\t\tconst lowerSeedL = maxDeficitDirection === 'lighter' ? 0 : 1;\n\t\tconst lowerDeficit = -maxDeficit;\n\t\tconst upperSeedL = get( seed, [ OKLCH, 'l' ] );\n\t\tconst upperDeficit = maxDeficit;\n\n\t\tconst bestSeed = solveWithBisect(\n\t\t\tgetSeedForL,\n\t\t\tgetDeficitForSeed,\n\t\t\tlowerSeedL,\n\t\t\tlowerDeficit,\n\t\t\tupperSeedL,\n\t\t\tupperDeficit\n\t\t);\n\n\t\t// Calculate the final ramp with adjusted seed.\n\t\tbestRamp = calculateRamp( {\n\t\t\tseed: bestSeed,\n\t\t\tsortedSteps,\n\t\t\tconfig,\n\t\t\tmainDir,\n\t\t\toppDir,\n\t\t\tpinLightness,\n\t\t} ).rampResults;\n\t}\n\n\t// Swap surface1 and surface3 for darker ramps to maintain visual elevation hierarchy.\n\t// This ensures surface1 appears \"behind\" surface2, and surface3 appears \"in front\",\n\t// regardless of the ramp's main direction.\n\tif ( mainDir === 'darker' ) {\n\t\tconst tmpSurface1 = bestRamp.surface1;\n\t\tbestRamp.surface1 = bestRamp.surface3;\n\t\tbestRamp.surface3 = tmpSurface1;\n\t}\n\n\treturn {\n\t\tramp: bestRamp,\n\t\twarnings,\n\t\tdirection: mainDir,\n\t};\n}\n"],
5
+ "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAKP,OAAO;AACP,SAAS,cAAc,aAAa,sBAAsB;AAC1D,SAAS,oCAAoC;AAC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