@wordpress/theme 0.1.1-next.2f1c7c01b.0 → 0.2.1-next.16d95556a.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 (106) hide show
  1. package/README.md +5 -1
  2. package/bin/generate-primitive-tokens/index.ts +1 -1
  3. package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +5 -24
  4. package/bin/terrazzo-plugin-inline-alias-values/index.ts +84 -0
  5. package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +19 -39
  6. package/build/color-ramps/index.js +5 -5
  7. package/build/color-ramps/index.js.map +2 -2
  8. package/build/color-ramps/lib/constants.js +4 -4
  9. package/build/color-ramps/lib/constants.js.map +2 -2
  10. package/build/color-ramps/lib/default-ramps.js +154 -154
  11. package/build/color-ramps/lib/default-ramps.js.map +2 -2
  12. package/build/color-ramps/lib/find-color-with-constraints.js +36 -53
  13. package/build/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  14. package/build/color-ramps/lib/index.js +72 -64
  15. package/build/color-ramps/lib/index.js.map +2 -2
  16. package/build/color-ramps/lib/ramp-configs.js +3 -3
  17. package/build/color-ramps/lib/ramp-configs.js.map +1 -1
  18. package/build/color-ramps/lib/types.js.map +1 -1
  19. package/build/color-ramps/lib/utils.js +63 -2
  20. package/build/color-ramps/lib/utils.js.map +2 -2
  21. package/build/prebuilt/js/design-tokens.js +5 -10
  22. package/build/prebuilt/js/design-tokens.js.map +2 -2
  23. package/build/prebuilt/json/figma.json +105 -905
  24. package/build/prebuilt/ts/color-tokens.js +137 -0
  25. package/build/prebuilt/ts/color-tokens.js.map +7 -0
  26. package/build/token-id.js +30 -0
  27. package/build/token-id.js.map +7 -0
  28. package/build/use-theme-provider-styles.js +15 -27
  29. package/build/use-theme-provider-styles.js.map +3 -3
  30. package/build-module/color-ramps/index.js +5 -5
  31. package/build-module/color-ramps/index.js.map +2 -2
  32. package/build-module/color-ramps/lib/constants.js +3 -3
  33. package/build-module/color-ramps/lib/constants.js.map +2 -2
  34. package/build-module/color-ramps/lib/default-ramps.js +154 -154
  35. package/build-module/color-ramps/lib/default-ramps.js.map +2 -2
  36. package/build-module/color-ramps/lib/find-color-with-constraints.js +38 -60
  37. package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  38. package/build-module/color-ramps/lib/index.js +76 -66
  39. package/build-module/color-ramps/lib/index.js.map +2 -2
  40. package/build-module/color-ramps/lib/ramp-configs.js +3 -3
  41. package/build-module/color-ramps/lib/ramp-configs.js.map +1 -1
  42. package/build-module/color-ramps/lib/utils.js +63 -2
  43. package/build-module/color-ramps/lib/utils.js.map +2 -2
  44. package/build-module/prebuilt/js/design-tokens.js +5 -10
  45. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  46. package/build-module/prebuilt/json/figma.json +105 -905
  47. package/build-module/prebuilt/ts/color-tokens.js +117 -0
  48. package/build-module/prebuilt/ts/color-tokens.js.map +7 -0
  49. package/build-module/token-id.js +6 -0
  50. package/build-module/token-id.js.map +7 -0
  51. package/build-module/use-theme-provider-styles.js +15 -27
  52. package/build-module/use-theme-provider-styles.js.map +2 -2
  53. package/build-types/color-ramps/lib/constants.d.ts +2 -2
  54. package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
  55. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +2 -3
  56. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
  57. package/build-types/color-ramps/lib/index.d.ts.map +1 -1
  58. package/build-types/color-ramps/lib/types.d.ts +2 -4
  59. package/build-types/color-ramps/lib/types.d.ts.map +1 -1
  60. package/build-types/color-ramps/lib/utils.d.ts +21 -2
  61. package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
  62. package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
  63. package/build-types/color-ramps/stories/ramp-table.d.ts +2 -4
  64. package/build-types/color-ramps/stories/ramp-table.d.ts.map +1 -1
  65. package/build-types/prebuilt/ts/color-tokens.d.ts +7 -0
  66. package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -0
  67. package/build-types/stories/index.story.d.ts.map +1 -1
  68. package/build-types/theme-provider.d.ts.map +1 -1
  69. package/build-types/token-id.d.ts +9 -0
  70. package/build-types/token-id.d.ts.map +1 -0
  71. package/build-types/use-theme-provider-styles.d.ts.map +1 -1
  72. package/docs/ds-tokens.md +10 -178
  73. package/package.json +4 -4
  74. package/src/color-ramps/index.ts +5 -5
  75. package/src/color-ramps/lib/constants.ts +7 -5
  76. package/src/color-ramps/lib/default-ramps.ts +154 -154
  77. package/src/color-ramps/lib/find-color-with-constraints.ts +53 -77
  78. package/src/color-ramps/lib/index.ts +100 -100
  79. package/src/color-ramps/lib/ramp-configs.ts +3 -3
  80. package/src/color-ramps/lib/types.ts +2 -7
  81. package/src/color-ramps/lib/utils.ts +109 -5
  82. package/src/color-ramps/stories/index.story.tsx +4 -1
  83. package/src/color-ramps/stories/ramp-table.tsx +15 -26
  84. package/src/color-ramps/test/__snapshots__/index.test.ts.snap +16891 -1059
  85. package/src/color-ramps/test/index.test.ts +43 -16
  86. package/src/prebuilt/css/design-tokens.css +88 -413
  87. package/src/prebuilt/js/design-tokens.js +5 -10
  88. package/src/prebuilt/json/figma.json +105 -905
  89. package/src/prebuilt/ts/color-tokens.ts +117 -0
  90. package/src/stories/index.story.tsx +4 -18
  91. package/src/test/token-id.test.ts +12 -0
  92. package/src/token-id.ts +9 -0
  93. package/src/use-theme-provider-styles.ts +17 -35
  94. package/terrazzo.config.ts +15 -12
  95. package/tokens/color.json +82 -82
  96. package/tokens/dimension.json +75 -0
  97. package/tsconfig.bin.tsbuildinfo +1 -1
  98. package/tsconfig.src.tsbuildinfo +1 -1
  99. package/build/prebuilt/ts/design-tokens.js +0 -391
  100. package/build/prebuilt/ts/design-tokens.js.map +0 -7
  101. package/build-module/prebuilt/ts/design-tokens.js +0 -371
  102. package/build-module/prebuilt/ts/design-tokens.js.map +0 -7
  103. package/build-types/prebuilt/ts/design-tokens.d.ts +0 -7
  104. package/build-types/prebuilt/ts/design-tokens.d.ts.map +0 -1
  105. package/src/prebuilt/ts/design-tokens.ts +0 -371
  106. package/tokens/spacing.json +0 -45
@@ -25,190 +25,190 @@ module.exports = __toCommonJS(default_ramps_exports);
25
25
  var DEFAULT_RAMPS = {
26
26
  bg: {
27
27
  ramp: {
28
- surface2: { color: "#f8f8f8", warning: false },
29
- bgFill1: { color: "#555", warning: false },
30
- fgFill: { color: "#f0f0f0", warning: false },
31
- bgFill2: { color: "#474747", warning: false },
32
- surface6: { color: "#d0d0d0", warning: false },
33
- surface5: { color: "#dfdfdf", warning: false },
34
- surface4: { color: "#eaeaea", warning: false },
35
- surface3: { color: "#fff", warning: false },
36
- fgSurface4: { color: "#1e1e1e", warning: false },
37
- fgSurface3: { color: "#6d6d6d", warning: false },
38
- fgSurface2: { color: "#898989", warning: false },
39
- fgSurface1: { color: "#a9a9a9", warning: false },
40
- stroke3: { color: "#898989", warning: false },
41
- stroke4: { color: "#6a6a6a", warning: false },
42
- stroke2: { color: "#adadad", warning: false },
43
- stroke1: { color: "#d0d0d0", warning: false },
44
- bgFillDark: { color: "#1e1e1e", warning: false },
45
- fgFillDark: { color: "#f0f0f0", warning: false },
46
- bgFillInverted2: { color: "#1e1e1e", warning: false },
47
- bgFillInverted1: { color: "#2f2f2f", warning: false },
48
- fgFillInverted: { color: "#f0f0f0", warning: false },
49
- surface1: { color: "#f0f0f0", warning: false }
28
+ surface2: "#f8f8f8",
29
+ bgFill1: "#555",
30
+ fgFill: "#f0f0f0",
31
+ bgFill2: "#494949",
32
+ surface6: "#d3d3d3",
33
+ surface5: "#e3e3e3",
34
+ surface4: "#eaeaea",
35
+ surface3: "#fff",
36
+ fgSurface4: "#1e1e1e",
37
+ fgSurface3: "#6e6e6e",
38
+ fgSurface2: "#8b8b8b",
39
+ fgSurface1: "#ababab",
40
+ stroke3: "#8b8b8b",
41
+ stroke4: "#6d6d6d",
42
+ stroke2: "#adadad",
43
+ stroke1: "#cfcfcf",
44
+ bgFillDark: "#1e1e1e",
45
+ fgFillDark: "#f0f0f0",
46
+ bgFillInverted2: "#1e1e1e",
47
+ bgFillInverted1: "#2d2d2d",
48
+ fgFillInverted: "#f0f0f0",
49
+ surface1: "#f0f0f0"
50
50
  },
51
51
  direction: "darker"
52
52
  },
53
53
  primary: {
54
54
  ramp: {
55
- bgFill1: { color: "#3858e9", warning: false },
56
- fgFill: { color: "#eff0f2", warning: false },
57
- bgFill2: { color: "#2c47d7", warning: false },
58
- surface2: { color: "#f6f8fc", warning: false },
59
- surface6: { color: "#c4d0ee", warning: false },
60
- surface5: { color: "#d8e0f3", warning: false },
61
- surface4: { color: "#e5eaf7", warning: false },
62
- surface3: { color: "#fff", warning: false },
63
- fgSurface4: { color: "#080071", warning: false },
64
- fgSurface3: { color: "#3858e9", warning: false },
65
- fgSurface2: { color: "#5780ff", warning: false },
66
- fgSurface1: { color: "#81a7ff", warning: false },
67
- stroke3: { color: "#3858e9", warning: false },
68
- stroke4: { color: "#2236c7", warning: false },
69
- stroke2: { color: "#6f85c0", warning: false },
70
- stroke1: { color: "#92a4cf", warning: false },
71
- bgFillDark: { color: "#1b1e26", warning: false },
72
- fgFillDark: { color: "#eff0f2", warning: false },
73
- bgFillInverted2: { color: "#1b1e26", warning: false },
74
- bgFillInverted1: { color: "#1401a4", warning: false },
75
- fgFillInverted: { color: "#eff0f2", warning: false },
76
- surface1: { color: "#ecf0f9", warning: false }
55
+ bgFill1: "#3858e9",
56
+ fgFill: "#eff0f2",
57
+ bgFill2: "#2e49da",
58
+ surface2: "#f6f8fc",
59
+ surface6: "#c7d3ef",
60
+ surface5: "#dce3f5",
61
+ surface4: "#e5ebf7",
62
+ surface3: "#fff",
63
+ fgSurface4: "#080071",
64
+ fgSurface3: "#3858e9",
65
+ fgSurface2: "#5881ff",
66
+ fgSurface1: "#84a9ff",
67
+ stroke3: "#3858e9",
68
+ stroke4: "#2337c8",
69
+ stroke2: "#6d83bf",
70
+ stroke1: "#91a2cf",
71
+ bgFillDark: "#1b1e26",
72
+ fgFillDark: "#eff0f2",
73
+ bgFillInverted2: "#1b1e26",
74
+ bgFillInverted1: "#12009f",
75
+ fgFillInverted: "#eff0f2",
76
+ surface1: "#edf0fa"
77
77
  },
78
78
  direction: "darker"
79
79
  },
80
80
  info: {
81
81
  ramp: {
82
- bgFill1: { color: "#0090ff", warning: false },
83
- fgFill: { color: "#1b1e23", warning: false },
84
- bgFill2: { color: "#007eec", warning: false },
85
- surface2: { color: "#f5f9fd", warning: false },
86
- surface6: { color: "#bad3f0", warning: false },
87
- surface5: { color: "#d1e1f5", warning: false },
88
- surface4: { color: "#e1ecf8", warning: false },
89
- surface3: { color: "#fff", warning: false },
90
- fgSurface4: { color: "#001758", warning: false },
91
- fgSurface3: { color: "#006cd8", warning: false },
92
- fgSurface2: { color: "#008bfa", warning: false },
93
- fgSurface1: { color: "#4dafff", warning: false },
94
- stroke3: { color: "#006cd8", warning: false },
95
- stroke4: { color: "#004bb5", warning: false },
96
- stroke2: { color: "#5e90c7", warning: false },
97
- stroke1: { color: "#8baed6", warning: false },
98
- bgFillDark: { color: "#1b1e23", warning: false },
99
- fgFillDark: { color: "#eff0f2", warning: false },
100
- bgFillInverted2: { color: "#1b1e23", warning: false },
101
- bgFillInverted1: { color: "#00297a", warning: false },
102
- fgFillInverted: { color: "#eff0f2", warning: false },
103
- surface1: { color: "#e9f1fa", warning: false }
82
+ bgFill1: "#0090ff",
83
+ fgFill: "#1b1e23",
84
+ bgFill2: "#0081ef",
85
+ surface2: "#f5f9fd",
86
+ surface6: "#bed6f1",
87
+ surface5: "#d5e5f6",
88
+ surface4: "#e0ebf8",
89
+ surface3: "#fff",
90
+ fgSurface4: "#001758",
91
+ fgSurface3: "#006dd9",
92
+ fgSurface2: "#008cfb",
93
+ fgSurface1: "#53b1ff",
94
+ stroke3: "#006dd9",
95
+ stroke4: "#004eb8",
96
+ stroke2: "#5d8fc6",
97
+ stroke1: "#8aaed6",
98
+ bgFillDark: "#1b1e23",
99
+ fgFillDark: "#eff0f2",
100
+ bgFillInverted2: "#1b1e23",
101
+ bgFillInverted1: "#002675",
102
+ fgFillInverted: "#eff0f2",
103
+ surface1: "#eaf1fa"
104
104
  },
105
105
  direction: "darker"
106
106
  },
107
107
  success: {
108
108
  ramp: {
109
- bgFill1: { color: "#4ab866", warning: false },
110
- fgFill: { color: "#1b1f1c", warning: false },
111
- bgFill2: { color: "#34a554", warning: false },
112
- surface2: { color: "#f0fcf2", warning: false },
113
- surface6: { color: "#7be792", warning: false },
114
- surface5: { color: "#acf0b7", warning: false },
115
- surface4: { color: "#cdf5d3", warning: false },
116
- surface3: { color: "#fff", warning: false },
117
- fgSurface4: { color: "#002b00", warning: false },
118
- fgSurface3: { color: "#008030", warning: false },
119
- fgSurface2: { color: "#2a9e4d", warning: false },
120
- fgSurface1: { color: "#52bf6d", warning: false },
121
- stroke3: { color: "#008030", warning: false },
122
- stroke4: { color: "#006113", warning: false },
123
- stroke2: { color: "#62996c", warning: false },
124
- stroke1: { color: "#78ba84", warning: false },
125
- bgFillDark: { color: "#1b1f1c", warning: false },
126
- fgFillDark: { color: "#edf2ed", warning: false },
127
- bgFillInverted2: { color: "#1b1f1c", warning: false },
128
- bgFillInverted1: { color: "#003a00", warning: false },
129
- fgFillInverted: { color: "#edf2ed", warning: false },
130
- surface1: { color: "#ddf8e0", warning: false }
109
+ bgFill1: "#4ab866",
110
+ fgFill: "#1b1f1c",
111
+ bgFill2: "#37a857",
112
+ surface2: "#f0fcf2",
113
+ surface6: "#7eea95",
114
+ surface5: "#b7f2c1",
115
+ surface4: "#cdf5d3",
116
+ surface3: "#fff",
117
+ fgSurface4: "#002b00",
118
+ fgSurface3: "#008031",
119
+ fgSurface2: "#2c9f4e",
120
+ fgSurface1: "#54c16f",
121
+ stroke3: "#008031",
122
+ stroke4: "#006314",
123
+ stroke2: "#61986b",
124
+ stroke1: "#77ba84",
125
+ bgFillDark: "#1b1f1c",
126
+ fgFillDark: "#edf2ed",
127
+ bgFillInverted2: "#1b1f1c",
128
+ bgFillInverted1: "#003800",
129
+ fgFillInverted: "#edf2ed",
130
+ surface1: "#ddf8e1"
131
131
  },
132
132
  direction: "darker"
133
133
  },
134
134
  caution: {
135
135
  ramp: {
136
- bgFill1: { color: "#f0d149", warning: false },
137
- fgFill: { color: "#1f1e1b", warning: false },
138
- bgFill2: { color: "#dabb2b", warning: false },
139
- surface2: { color: "#fdf9e7", warning: false },
140
- surface6: { color: "#e7d070", warning: false },
141
- surface5: { color: "#f4e08c", warning: false },
142
- surface4: { color: "#f8ebb6", warning: false },
143
- surface3: { color: "#fff", warning: false },
144
- fgSurface4: { color: "#291d00", warning: false },
145
- fgSurface3: { color: "#866a00", warning: false },
146
- fgSurface2: { color: "#a58700", warning: false },
147
- fgSurface1: { color: "#c6a800", warning: false },
148
- stroke3: { color: "#866a00", warning: false },
149
- stroke4: { color: "#644e00", warning: false },
150
- stroke2: { color: "#988d60", warning: false },
151
- stroke1: { color: "#b8ab76", warning: false },
152
- bgFillDark: { color: "#1f1e1b", warning: false },
153
- fgFillDark: { color: "#f6f1da", warning: false },
154
- bgFillInverted2: { color: "#1f1e1b", warning: false },
155
- bgFillInverted1: { color: "#3d2d00", warning: false },
156
- fgFillInverted: { color: "#f6f1da", warning: false },
157
- surface1: { color: "#faf1cb", warning: false }
136
+ bgFill1: "#f0d149",
137
+ fgFill: "#1f1e1b",
138
+ bgFill2: "#ddbe30",
139
+ surface2: "#fdf9e7",
140
+ surface6: "#ecd367",
141
+ surface5: "#f5e399",
142
+ surface4: "#f8ebb5",
143
+ surface3: "#fff",
144
+ fgSurface4: "#291d00",
145
+ fgSurface3: "#876b00",
146
+ fgSurface2: "#a78900",
147
+ fgSurface1: "#c9aa00",
148
+ stroke3: "#876b00",
149
+ stroke4: "#675000",
150
+ stroke2: "#978c60",
151
+ stroke1: "#b8ab75",
152
+ bgFillDark: "#1f1e1b",
153
+ fgFillDark: "#f6f1da",
154
+ bgFillInverted2: "#1f1e1b",
155
+ bgFillInverted1: "#3a2b00",
156
+ fgFillInverted: "#f6f1da",
157
+ surface1: "#faf1cd"
158
158
  },
159
159
  direction: "darker"
160
160
  },
161
161
  warning: {
162
162
  ramp: {
163
- bgFill1: { color: "#f0b849", warning: false },
164
- fgFill: { color: "#1f1e1b", warning: false },
165
- bgFill2: { color: "#dba430", warning: false },
166
- surface2: { color: "#fdf7ee", warning: false },
167
- surface6: { color: "#f0cb89", warning: false },
168
- surface5: { color: "#f5ddb2", warning: false },
169
- surface4: { color: "#f8e9cd", warning: false },
170
- surface3: { color: "#fff", warning: false },
171
- fgSurface4: { color: "#2f1800", warning: false },
172
- fgSurface3: { color: "#966200", warning: false },
173
- fgSurface2: { color: "#b58000", warning: false },
174
- fgSurface1: { color: "#d7a02b", warning: false },
175
- stroke3: { color: "#966200", warning: false },
176
- stroke4: { color: "#724700", warning: false },
177
- stroke2: { color: "#a08961", warning: false },
178
- stroke1: { color: "#c2a777", warning: false },
179
- bgFillDark: { color: "#1f1e1b", warning: false },
180
- fgFillDark: { color: "#f3f0e9", warning: false },
181
- bgFillInverted2: { color: "#1f1e1b", warning: false },
182
- bgFillInverted1: { color: "#472900", warning: false },
183
- fgFillInverted: { color: "#f3f0e9", warning: false },
184
- surface1: { color: "#faefdb", warning: false }
163
+ bgFill1: "#f0b849",
164
+ fgFill: "#1f1e1b",
165
+ bgFill2: "#dea633",
166
+ surface2: "#fdf7ee",
167
+ surface6: "#f1ce90",
168
+ surface5: "#f6e0bb",
169
+ surface4: "#f8e9cd",
170
+ surface3: "#fff",
171
+ fgSurface4: "#2f1800",
172
+ fgSurface3: "#976300",
173
+ fgSurface2: "#b78100",
174
+ fgSurface1: "#d9a22e",
175
+ stroke3: "#976300",
176
+ stroke4: "#754900",
177
+ stroke2: "#9f8860",
178
+ stroke1: "#c2a776",
179
+ bgFillDark: "#1f1e1b",
180
+ fgFillDark: "#f3f0e9",
181
+ bgFillInverted2: "#1f1e1b",
182
+ bgFillInverted1: "#432600",
183
+ fgFillInverted: "#f3f0e9",
184
+ surface1: "#faefdc"
185
185
  },
186
186
  direction: "darker"
187
187
  },
188
188
  error: {
189
189
  ramp: {
190
- bgFill1: { color: "#cc1818", warning: false },
191
- fgFill: { color: "#f2efef", warning: false },
192
- bgFill2: { color: "#b90000", warning: false },
193
- surface2: { color: "#fdf6f5", warning: false },
194
- surface6: { color: "#f5c5be", warning: false },
195
- surface5: { color: "#f8d8d3", warning: false },
196
- surface4: { color: "#fae6e2", warning: false },
197
- surface3: { color: "#fff", warning: false },
198
- fgSurface4: { color: "#4a0000", warning: false },
199
- fgSurface3: { color: "#cc1818", warning: false },
200
- fgSurface2: { color: "#f64b40", warning: false },
201
- fgSurface1: { color: "#ff8070", warning: false },
202
- stroke3: { color: "#cc1818", warning: false },
203
- stroke4: { color: "#a40000", warning: false },
204
- stroke2: { color: "#cd695d", warning: false },
205
- stroke1: { color: "#dc9085", warning: false },
206
- bgFillDark: { color: "#231c1b", warning: false },
207
- fgFillDark: { color: "#f2efef", warning: false },
208
- bgFillInverted2: { color: "#231c1b", warning: false },
209
- bgFillInverted1: { color: "#6d0000", warning: false },
210
- fgFillInverted: { color: "#f2efef", warning: false },
211
- surface1: { color: "#fcecea", warning: false }
190
+ bgFill1: "#cc1818",
191
+ fgFill: "#f2efef",
192
+ bgFill2: "#bc0001",
193
+ surface2: "#fdf6f5",
194
+ surface6: "#f5c9c2",
195
+ surface5: "#f9dcd8",
196
+ surface4: "#fae5e2",
197
+ surface3: "#fff",
198
+ fgSurface4: "#4a0000",
199
+ fgSurface3: "#cc1818",
200
+ fgSurface2: "#f84d41",
201
+ fgSurface1: "#ff8373",
202
+ stroke3: "#cc1818",
203
+ stroke4: "#a70000",
204
+ stroke2: "#ca675c",
205
+ stroke1: "#dc8e83",
206
+ bgFillDark: "#231c1b",
207
+ fgFillDark: "#f2efef",
208
+ bgFillInverted2: "#231c1b",
209
+ bgFillInverted1: "#680000",
210
+ fgFillInverted: "#f2efef",
211
+ surface1: "#fcedea"
212
212
  },
213
213
  direction: "darker"
214
214
  }
@@ -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: { color: '#f8f8f8', warning: false },\n\t\t\tbgFill1: { color: '#555', warning: false },\n\t\t\tfgFill: { color: '#f0f0f0', warning: false },\n\t\t\tbgFill2: { color: '#474747', warning: false },\n\t\t\tsurface6: { color: '#d0d0d0', warning: false },\n\t\t\tsurface5: { color: '#dfdfdf', warning: false },\n\t\t\tsurface4: { color: '#eaeaea', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#1e1e1e', warning: false },\n\t\t\tfgSurface3: { color: '#6d6d6d', warning: false },\n\t\t\tfgSurface2: { color: '#898989', warning: false },\n\t\t\tfgSurface1: { color: '#a9a9a9', warning: false },\n\t\t\tstroke3: { color: '#898989', warning: false },\n\t\t\tstroke4: { color: '#6a6a6a', warning: false },\n\t\t\tstroke2: { color: '#adadad', warning: false },\n\t\t\tstroke1: { color: '#d0d0d0', warning: false },\n\t\t\tbgFillDark: { color: '#1e1e1e', warning: false },\n\t\t\tfgFillDark: { color: '#f0f0f0', warning: false },\n\t\t\tbgFillInverted2: { color: '#1e1e1e', warning: false },\n\t\t\tbgFillInverted1: { color: '#2f2f2f', warning: false },\n\t\t\tfgFillInverted: { color: '#f0f0f0', warning: false },\n\t\t\tsurface1: { color: '#f0f0f0', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tprimary: {\n\t\tramp: {\n\t\t\tbgFill1: { color: '#3858e9', warning: false },\n\t\t\tfgFill: { color: '#eff0f2', warning: false },\n\t\t\tbgFill2: { color: '#2c47d7', warning: false },\n\t\t\tsurface2: { color: '#f6f8fc', warning: false },\n\t\t\tsurface6: { color: '#c4d0ee', warning: false },\n\t\t\tsurface5: { color: '#d8e0f3', warning: false },\n\t\t\tsurface4: { color: '#e5eaf7', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#080071', warning: false },\n\t\t\tfgSurface3: { color: '#3858e9', warning: false },\n\t\t\tfgSurface2: { color: '#5780ff', warning: false },\n\t\t\tfgSurface1: { color: '#81a7ff', warning: false },\n\t\t\tstroke3: { color: '#3858e9', warning: false },\n\t\t\tstroke4: { color: '#2236c7', warning: false },\n\t\t\tstroke2: { color: '#6f85c0', warning: false },\n\t\t\tstroke1: { color: '#92a4cf', warning: false },\n\t\t\tbgFillDark: { color: '#1b1e26', warning: false },\n\t\t\tfgFillDark: { color: '#eff0f2', warning: false },\n\t\t\tbgFillInverted2: { color: '#1b1e26', warning: false },\n\t\t\tbgFillInverted1: { color: '#1401a4', warning: false },\n\t\t\tfgFillInverted: { color: '#eff0f2', warning: false },\n\t\t\tsurface1: { color: '#ecf0f9', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tinfo: {\n\t\tramp: {\n\t\t\tbgFill1: { color: '#0090ff', warning: false },\n\t\t\tfgFill: { color: '#1b1e23', warning: false },\n\t\t\tbgFill2: { color: '#007eec', warning: false },\n\t\t\tsurface2: { color: '#f5f9fd', warning: false },\n\t\t\tsurface6: { color: '#bad3f0', warning: false },\n\t\t\tsurface5: { color: '#d1e1f5', warning: false },\n\t\t\tsurface4: { color: '#e1ecf8', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#001758', warning: false },\n\t\t\tfgSurface3: { color: '#006cd8', warning: false },\n\t\t\tfgSurface2: { color: '#008bfa', warning: false },\n\t\t\tfgSurface1: { color: '#4dafff', warning: false },\n\t\t\tstroke3: { color: '#006cd8', warning: false },\n\t\t\tstroke4: { color: '#004bb5', warning: false },\n\t\t\tstroke2: { color: '#5e90c7', warning: false },\n\t\t\tstroke1: { color: '#8baed6', warning: false },\n\t\t\tbgFillDark: { color: '#1b1e23', warning: false },\n\t\t\tfgFillDark: { color: '#eff0f2', warning: false },\n\t\t\tbgFillInverted2: { color: '#1b1e23', warning: false },\n\t\t\tbgFillInverted1: { color: '#00297a', warning: false },\n\t\t\tfgFillInverted: { color: '#eff0f2', warning: false },\n\t\t\tsurface1: { color: '#e9f1fa', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tsuccess: {\n\t\tramp: {\n\t\t\tbgFill1: { color: '#4ab866', warning: false },\n\t\t\tfgFill: { color: '#1b1f1c', warning: false },\n\t\t\tbgFill2: { color: '#34a554', warning: false },\n\t\t\tsurface2: { color: '#f0fcf2', warning: false },\n\t\t\tsurface6: { color: '#7be792', warning: false },\n\t\t\tsurface5: { color: '#acf0b7', warning: false },\n\t\t\tsurface4: { color: '#cdf5d3', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#002b00', warning: false },\n\t\t\tfgSurface3: { color: '#008030', warning: false },\n\t\t\tfgSurface2: { color: '#2a9e4d', warning: false },\n\t\t\tfgSurface1: { color: '#52bf6d', warning: false },\n\t\t\tstroke3: { color: '#008030', warning: false },\n\t\t\tstroke4: { color: '#006113', warning: false },\n\t\t\tstroke2: { color: '#62996c', warning: false },\n\t\t\tstroke1: { color: '#78ba84', warning: false },\n\t\t\tbgFillDark: { color: '#1b1f1c', warning: false },\n\t\t\tfgFillDark: { color: '#edf2ed', warning: false },\n\t\t\tbgFillInverted2: { color: '#1b1f1c', warning: false },\n\t\t\tbgFillInverted1: { color: '#003a00', warning: false },\n\t\t\tfgFillInverted: { color: '#edf2ed', warning: false },\n\t\t\tsurface1: { color: '#ddf8e0', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\tcaution: {\n\t\tramp: {\n\t\t\tbgFill1: { color: '#f0d149', warning: false },\n\t\t\tfgFill: { color: '#1f1e1b', warning: false },\n\t\t\tbgFill2: { color: '#dabb2b', warning: false },\n\t\t\tsurface2: { color: '#fdf9e7', warning: false },\n\t\t\tsurface6: { color: '#e7d070', warning: false },\n\t\t\tsurface5: { color: '#f4e08c', warning: false },\n\t\t\tsurface4: { color: '#f8ebb6', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#291d00', warning: false },\n\t\t\tfgSurface3: { color: '#866a00', warning: false },\n\t\t\tfgSurface2: { color: '#a58700', warning: false },\n\t\t\tfgSurface1: { color: '#c6a800', warning: false },\n\t\t\tstroke3: { color: '#866a00', warning: false },\n\t\t\tstroke4: { color: '#644e00', warning: false },\n\t\t\tstroke2: { color: '#988d60', warning: false },\n\t\t\tstroke1: { color: '#b8ab76', warning: false },\n\t\t\tbgFillDark: { color: '#1f1e1b', warning: false },\n\t\t\tfgFillDark: { color: '#f6f1da', warning: false },\n\t\t\tbgFillInverted2: { color: '#1f1e1b', warning: false },\n\t\t\tbgFillInverted1: { color: '#3d2d00', warning: false },\n\t\t\tfgFillInverted: { color: '#f6f1da', warning: false },\n\t\t\tsurface1: { color: '#faf1cb', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\twarning: {\n\t\tramp: {\n\t\t\tbgFill1: { color: '#f0b849', warning: false },\n\t\t\tfgFill: { color: '#1f1e1b', warning: false },\n\t\t\tbgFill2: { color: '#dba430', warning: false },\n\t\t\tsurface2: { color: '#fdf7ee', warning: false },\n\t\t\tsurface6: { color: '#f0cb89', warning: false },\n\t\t\tsurface5: { color: '#f5ddb2', warning: false },\n\t\t\tsurface4: { color: '#f8e9cd', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#2f1800', warning: false },\n\t\t\tfgSurface3: { color: '#966200', warning: false },\n\t\t\tfgSurface2: { color: '#b58000', warning: false },\n\t\t\tfgSurface1: { color: '#d7a02b', warning: false },\n\t\t\tstroke3: { color: '#966200', warning: false },\n\t\t\tstroke4: { color: '#724700', warning: false },\n\t\t\tstroke2: { color: '#a08961', warning: false },\n\t\t\tstroke1: { color: '#c2a777', warning: false },\n\t\t\tbgFillDark: { color: '#1f1e1b', warning: false },\n\t\t\tfgFillDark: { color: '#f3f0e9', warning: false },\n\t\t\tbgFillInverted2: { color: '#1f1e1b', warning: false },\n\t\t\tbgFillInverted1: { color: '#472900', warning: false },\n\t\t\tfgFillInverted: { color: '#f3f0e9', warning: false },\n\t\t\tsurface1: { color: '#faefdb', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n\terror: {\n\t\tramp: {\n\t\t\tbgFill1: { color: '#cc1818', warning: false },\n\t\t\tfgFill: { color: '#f2efef', warning: false },\n\t\t\tbgFill2: { color: '#b90000', warning: false },\n\t\t\tsurface2: { color: '#fdf6f5', warning: false },\n\t\t\tsurface6: { color: '#f5c5be', warning: false },\n\t\t\tsurface5: { color: '#f8d8d3', warning: false },\n\t\t\tsurface4: { color: '#fae6e2', warning: false },\n\t\t\tsurface3: { color: '#fff', warning: false },\n\t\t\tfgSurface4: { color: '#4a0000', warning: false },\n\t\t\tfgSurface3: { color: '#cc1818', warning: false },\n\t\t\tfgSurface2: { color: '#f64b40', warning: false },\n\t\t\tfgSurface1: { color: '#ff8070', warning: false },\n\t\t\tstroke3: { color: '#cc1818', warning: false },\n\t\t\tstroke4: { color: '#a40000', warning: false },\n\t\t\tstroke2: { color: '#cd695d', warning: false },\n\t\t\tstroke1: { color: '#dc9085', warning: false },\n\t\t\tbgFillDark: { color: '#231c1b', warning: false },\n\t\t\tfgFillDark: { color: '#f2efef', warning: false },\n\t\t\tbgFillInverted2: { color: '#231c1b', warning: false },\n\t\t\tbgFillInverted1: { color: '#6d0000', warning: false },\n\t\t\tfgFillInverted: { color: '#f2efef', warning: false },\n\t\t\tsurface1: { color: '#fcecea', warning: false },\n\t\t},\n\t\tdirection: 'darker',\n\t},\n};\n"],
5
- "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M;AAAA,MAC7C,UAAU,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC7C,UAAU,EAAE,OAAO,QAAQ,SAAS,MAAM;AAAA,MAC1C,YAAY,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC/C,YAAY,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC/C,YAAY,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC/C,YAAY,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC/C,SAAS,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC5C,SAAS,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC5C,SAAS,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC5C,SAAS,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC5C,YAAY,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC/C,YAAY,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MAC/C,iBAAiB,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MACpD,iBAAiB,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MACpD,gBAAgB,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,MACnD,UAAU,EAAE,OAAO,WAAW,SAAS,MAAM;AAAA,IAC9C;AAAA,IACA,WAAW;AAAA,EACZ;AACD;",
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: '#494949',\n\t\t\tsurface6: '#d3d3d3',\n\t\t\tsurface5: '#e3e3e3',\n\t\t\tsurface4: '#eaeaea',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#1e1e1e',\n\t\t\tfgSurface3: '#6e6e6e',\n\t\t\tfgSurface2: '#8b8b8b',\n\t\t\tfgSurface1: '#ababab',\n\t\t\tstroke3: '#8b8b8b',\n\t\t\tstroke4: '#6d6d6d',\n\t\t\tstroke2: '#adadad',\n\t\t\tstroke1: '#cfcfcf',\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: '#2e49da',\n\t\t\tsurface2: '#f6f8fc',\n\t\t\tsurface6: '#c7d3ef',\n\t\t\tsurface5: '#dce3f5',\n\t\t\tsurface4: '#e5ebf7',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#080071',\n\t\t\tfgSurface3: '#3858e9',\n\t\t\tfgSurface2: '#5881ff',\n\t\t\tfgSurface1: '#84a9ff',\n\t\t\tstroke3: '#3858e9',\n\t\t\tstroke4: '#2337c8',\n\t\t\tstroke2: '#6d83bf',\n\t\t\tstroke1: '#91a2cf',\n\t\t\tbgFillDark: '#1b1e26',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1b1e26',\n\t\t\tbgFillInverted1: '#12009f',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#edf0fa',\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: '#0081ef',\n\t\t\tsurface2: '#f5f9fd',\n\t\t\tsurface6: '#bed6f1',\n\t\t\tsurface5: '#d5e5f6',\n\t\t\tsurface4: '#e0ebf8',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#001758',\n\t\t\tfgSurface3: '#006dd9',\n\t\t\tfgSurface2: '#008cfb',\n\t\t\tfgSurface1: '#53b1ff',\n\t\t\tstroke3: '#006dd9',\n\t\t\tstroke4: '#004eb8',\n\t\t\tstroke2: '#5d8fc6',\n\t\t\tstroke1: '#8aaed6',\n\t\t\tbgFillDark: '#1b1e23',\n\t\t\tfgFillDark: '#eff0f2',\n\t\t\tbgFillInverted2: '#1b1e23',\n\t\t\tbgFillInverted1: '#002675',\n\t\t\tfgFillInverted: '#eff0f2',\n\t\t\tsurface1: '#eaf1fa',\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: '#37a857',\n\t\t\tsurface2: '#f0fcf2',\n\t\t\tsurface6: '#7eea95',\n\t\t\tsurface5: '#b7f2c1',\n\t\t\tsurface4: '#cdf5d3',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#002b00',\n\t\t\tfgSurface3: '#008031',\n\t\t\tfgSurface2: '#2c9f4e',\n\t\t\tfgSurface1: '#54c16f',\n\t\t\tstroke3: '#008031',\n\t\t\tstroke4: '#006314',\n\t\t\tstroke2: '#61986b',\n\t\t\tstroke1: '#77ba84',\n\t\t\tbgFillDark: '#1b1f1c',\n\t\t\tfgFillDark: '#edf2ed',\n\t\t\tbgFillInverted2: '#1b1f1c',\n\t\t\tbgFillInverted1: '#003800',\n\t\t\tfgFillInverted: '#edf2ed',\n\t\t\tsurface1: '#ddf8e1',\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: '#ddbe30',\n\t\t\tsurface2: '#fdf9e7',\n\t\t\tsurface6: '#ecd367',\n\t\t\tsurface5: '#f5e399',\n\t\t\tsurface4: '#f8ebb5',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#291d00',\n\t\t\tfgSurface3: '#876b00',\n\t\t\tfgSurface2: '#a78900',\n\t\t\tfgSurface1: '#c9aa00',\n\t\t\tstroke3: '#876b00',\n\t\t\tstroke4: '#675000',\n\t\t\tstroke2: '#978c60',\n\t\t\tstroke1: '#b8ab75',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f6f1da',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#3a2b00',\n\t\t\tfgFillInverted: '#f6f1da',\n\t\t\tsurface1: '#faf1cd',\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: '#dea633',\n\t\t\tsurface2: '#fdf7ee',\n\t\t\tsurface6: '#f1ce90',\n\t\t\tsurface5: '#f6e0bb',\n\t\t\tsurface4: '#f8e9cd',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#2f1800',\n\t\t\tfgSurface3: '#976300',\n\t\t\tfgSurface2: '#b78100',\n\t\t\tfgSurface1: '#d9a22e',\n\t\t\tstroke3: '#976300',\n\t\t\tstroke4: '#754900',\n\t\t\tstroke2: '#9f8860',\n\t\t\tstroke1: '#c2a776',\n\t\t\tbgFillDark: '#1f1e1b',\n\t\t\tfgFillDark: '#f3f0e9',\n\t\t\tbgFillInverted2: '#1f1e1b',\n\t\t\tbgFillInverted1: '#432600',\n\t\t\tfgFillInverted: '#f3f0e9',\n\t\t\tsurface1: '#faefdc',\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: '#bc0001',\n\t\t\tsurface2: '#fdf6f5',\n\t\t\tsurface6: '#f5c9c2',\n\t\t\tsurface5: '#f9dcd8',\n\t\t\tsurface4: '#fae5e2',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#4a0000',\n\t\t\tfgSurface3: '#cc1818',\n\t\t\tfgSurface2: '#f84d41',\n\t\t\tfgSurface1: '#ff8373',\n\t\t\tstroke3: '#cc1818',\n\t\t\tstroke4: '#a70000',\n\t\t\tstroke2: '#ca675c',\n\t\t\tstroke1: '#dc8e83',\n\t\t\tbgFillDark: '#231c1b',\n\t\t\tfgFillDark: '#f2efef',\n\t\t\tbgFillInverted2: '#231c1b',\n\t\t\tbgFillInverted1: '#680000',\n\t\t\tfgFillInverted: '#f2efef',\n\t\t\tsurface1: '#fcedea',\n\t\t},\n\t\tdirection: 'darker',\n\t},\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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,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;AAAA,EACA,SAAS;AAAA,IACR,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,MAC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iB;AAAA,MACjB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,EACZ;AACD;",
6
6
  "names": []
7
7
  }
@@ -28,13 +28,19 @@ var import_utils = require("./utils");
28
28
  var import_constants = require("./constants");
29
29
  var import_color_utils = require("./color-utils");
30
30
  var import_taper_chroma = require("./taper-chroma");
31
+ function cdiff(c1, c2) {
32
+ return Math.log(c1 / c2);
33
+ }
31
34
  function findColorMeetingRequirements(reference, seed, target, direction, {
32
35
  lightnessConstraint,
33
- taperChromaOptions,
34
- strict = true
36
+ taperChromaOptions
35
37
  } = {}) {
36
38
  if (target <= 1) {
37
- return { color: seed, reached: true, achieved: 1 };
39
+ return {
40
+ color: reference,
41
+ reached: true,
42
+ achieved: 1
43
+ };
38
44
  }
39
45
  function getColorForL(l) {
40
46
  let newL = l;
@@ -53,71 +59,48 @@ function findColorMeetingRequirements(reference, seed, target, direction, {
53
59
  coords: [newL, newC, (0, import_fn.get)(seed, [import_fn.OKLCH, "h"])]
54
60
  });
55
61
  }
62
+ const mostContrastingL = direction === "lighter" ? 1 : 0;
63
+ const mostContrastingColor = direction === "lighter" ? import_constants.WHITE : import_constants.BLACK;
64
+ const highestContrast = (0, import_color_utils.getContrast)(reference, mostContrastingColor);
56
65
  if (lightnessConstraint) {
57
66
  const colorWithExactL = getColorForL(lightnessConstraint.value);
58
67
  const exactLContrast = (0, import_color_utils.getContrast)(reference, colorWithExactL);
59
- if (lightnessConstraint.type === "force" || exactLContrast >= target) {
68
+ const exactLContrastMeetsTarget = cdiff(exactLContrast, target) >= -import_constants.CONTRAST_EPSILON;
69
+ if (exactLContrastMeetsTarget || lightnessConstraint.type === "force") {
60
70
  return {
61
71
  color: colorWithExactL,
62
- reached: exactLContrast >= target,
63
- achieved: exactLContrast
72
+ reached: exactLContrastMeetsTarget,
73
+ achieved: exactLContrast,
74
+ deficit: exactLContrastMeetsTarget ? cdiff(exactLContrast, highestContrast) : cdiff(target, exactLContrast)
64
75
  };
65
76
  }
66
77
  }
67
- const mostContrastingL = direction === "lighter" ? 1 : 0;
68
- const mostContrastingColor = direction === "lighter" ? import_constants.WHITE : import_constants.BLACK;
69
- const highestContrast = (0, import_color_utils.getContrast)(reference, mostContrastingColor);
70
- if (highestContrast < target) {
71
- if (strict) {
72
- throw new Error(
73
- `Contrast target ${target.toFixed(
74
- 2
75
- )}:1 unreachable in ${direction} direction(boundary achieves ${highestContrast.toFixed(3)}:1).`
76
- );
77
- }
78
+ if (cdiff(highestContrast, target) <= import_constants.CONTRAST_EPSILON) {
78
79
  return {
79
80
  color: mostContrastingColor,
80
- reached: false,
81
- achieved: highestContrast
81
+ reached: cdiff(highestContrast, target) >= -import_constants.CONTRAST_EPSILON,
82
+ achieved: highestContrast,
83
+ deficit: cdiff(target, highestContrast)
82
84
  };
83
85
  }
84
- let worseL = (0, import_fn.get)(reference, [import_fn.OKLCH, "l"]);
85
- let worseContrast = 1;
86
- let replacedWorse = false;
87
- let betterL = mostContrastingL;
88
- let betterContrast = highestContrast;
89
- let replacedBetter = false;
90
- let bestColor = mostContrastingColor;
91
- let bestContrast = highestContrast;
92
- for (let i = 0; i < import_constants.MAX_BISECTION_ITERATIONS; i++) {
93
- const newL = (worseL * (betterContrast - target) - betterL * (worseContrast - target)) / (betterContrast - worseContrast);
94
- bestColor = getColorForL(newL);
95
- bestContrast = (0, import_color_utils.getContrast)(reference, bestColor);
96
- if (Math.abs(bestContrast - target) <= import_constants.LIGHTNESS_EPSILON) {
97
- break;
98
- }
99
- if (bestContrast >= target) {
100
- betterL = newL;
101
- betterContrast = bestContrast;
102
- if (replacedBetter) {
103
- worseContrast = (worseContrast + target) / 2;
104
- }
105
- replacedBetter = true;
106
- replacedWorse = false;
107
- } else {
108
- worseL = newL;
109
- worseContrast = bestContrast;
110
- if (replacedWorse) {
111
- betterContrast = (betterContrast + target) / 2;
112
- }
113
- replacedWorse = true;
114
- replacedBetter = false;
115
- }
116
- }
86
+ const lowerL = (0, import_fn.get)(reference, [import_fn.OKLCH, "l"]);
87
+ const lowerContrast = cdiff(1, target);
88
+ const upperL = mostContrastingL;
89
+ const upperContrast = cdiff(highestContrast, target);
90
+ const bestColor = (0, import_utils.solveWithBisect)(
91
+ getColorForL,
92
+ (c) => cdiff((0, import_color_utils.getContrast)(reference, c), target),
93
+ lowerL,
94
+ lowerContrast,
95
+ upperL,
96
+ upperContrast
97
+ );
117
98
  return {
118
99
  color: bestColor,
119
100
  reached: true,
120
- achieved: bestContrast
101
+ achieved: target,
102
+ // Negative number that specifies how much room we have.
103
+ deficit: cdiff(target, highestContrast)
121
104
  };
122
105
  }
123
106
  // Annotate the CommonJS export names for ESM import in node:
@@ -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 { clampToGamut } from './utils';\nimport {\n\tWHITE,\n\tBLACK,\n\tLIGHTNESS_EPSILON,\n\tMAX_BISECTION_ITERATIONS,\n} from './constants';\nimport { getContrast } from './color-utils';\nimport { type TaperChromaOptions, taperChroma } from './taper-chroma';\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.strict\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\tstrict = true,\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\tstrict?: boolean;\n\t} = {}\n): { color: ColorTypes; reached: boolean; achieved: 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 { color: seed, reached: true, achieved: 1 };\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\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\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\tlightnessConstraint.type === 'force' ||\n\t\t\texactLContrast >= target\n\t\t) {\n\t\t\treturn {\n\t\t\t\tcolor: colorWithExactL,\n\t\t\t\treached: exactLContrast >= target,\n\t\t\t\tachieved: exactLContrast,\n\t\t\t};\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\t// If even the most contrasting color can't reach the target,\n\t// the target is unreachable.\n\tif ( highestContrast < target ) {\n\t\tif ( strict ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Contrast target ${ target.toFixed(\n\t\t\t\t\t2\n\t\t\t\t) }:1 unreachable in ${ direction } direction` +\n\t\t\t\t\t`(boundary achieves ${ highestContrast.toFixed( 3 ) }:1).`\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tcolor: mostContrastingColor,\n\t\t\treached: false,\n\t\t\tachieved: 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\tlet worseL = get( reference, [ OKLCH, 'l' ] );\n\tlet worseContrast = 1;\n\tlet replacedWorse = false;\n\tlet betterL = mostContrastingL;\n\tlet betterContrast = highestContrast;\n\tlet replacedBetter = false;\n\n\tlet bestColor: ColorTypes = mostContrastingColor;\n\tlet bestContrast = highestContrast;\n\n\tfor ( let i = 0; i < MAX_BISECTION_ITERATIONS; i++ ) {\n\t\t// Linear interpolation between worse and better L values, weighted by the contrast difference.\n\t\tconst newL =\n\t\t\t( worseL * ( betterContrast - target ) -\n\t\t\t\tbetterL * ( worseContrast - target ) ) /\n\t\t\t( betterContrast - worseContrast );\n\n\t\tbestColor = getColorForL( newL );\n\t\tbestContrast = getContrast( reference, bestColor );\n\n\t\tif ( Math.abs( bestContrast - target ) <= LIGHTNESS_EPSILON ) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Update one of the boundary L values, using the Illinois method.\n\t\tif ( bestContrast >= target ) {\n\t\t\tbetterL = newL;\n\t\t\tbetterContrast = bestContrast;\n\t\t\tif ( replacedBetter ) {\n\t\t\t\tworseContrast = ( worseContrast + target ) / 2;\n\t\t\t}\n\t\t\treplacedBetter = true;\n\t\t\treplacedWorse = false;\n\t\t} else {\n\t\t\tworseL = newL;\n\t\t\tworseContrast = bestContrast;\n\t\t\tif ( replacedWorse ) {\n\t\t\t\tbetterContrast = ( betterContrast + target ) / 2;\n\t\t\t}\n\t\t\treplacedWorse = true;\n\t\t\treplacedBetter = false;\n\t\t}\n\t}\n\n\treturn {\n\t\tcolor: bestColor,\n\t\treached: true,\n\t\tachieved: bestContrast,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA4C;AAK5C,mCAAO;AACP,mBAA6B;AAC7B,uBAKO;AACP,yBAA4B;AAC5B,0BAAqD;AAmB9C,SAAS,6BACf,WACA,MACA,QACA,WACA;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AACV,IAOI,CAAC,GACuD;AAG5D,MAAK,UAAU,GAAI;AAClB,WAAO,EAAE,OAAO,MAAM,SAAS,MAAM,UAAU,EAAE;AAAA,EAClD;AAEA,WAAS,aAAc,GAAwB;AAC9C,QAAI,OAAO;AACX,QAAI,WAAO,eAAK,MAAM,CAAE,iBAAO,GAAI,CAAE;AAErC,QAAK,oBAAqB;AACzB,YAAM,cAAU,iCAAa,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,eAAO,2BAAc;AAAA,MACpB,SAAS;AAAA,MACT,QAAQ,CAAE,MAAM,UAAM,eAAK,MAAM,CAAE,iBAAO,GAAI,CAAE,CAAE;AAAA,IACnD,CAAE;AAAA,EACH;AAEA,MAAK,qBAAsB;AAI1B,UAAM,kBAAkB,aAAc,oBAAoB,KAAM;AAChE,UAAM,qBAAiB,gCAAa,WAAW,eAAgB;AAI/D,QACC,oBAAoB,SAAS,WAC7B,kBAAkB,QACjB;AACD,aAAO;AAAA,QACN,OAAO;AAAA,QACP,SAAS,kBAAkB;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AA,IACT,UAAU;AAAA,EACX;AACD;",
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 { clampToGamut, solveWithBisect } from './utils';\nimport { WHITE, BLACK, CONTRAST_EPSILON } from './constants';\nimport { 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
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA4C;AAK5C,mCAAO;AACP,mBAA8C;AAC9C,uBAA+C;AAC/C,yBAA4B;AAC5B,0BAAqD;AASrD,SAAS,MAAO,IAAY,IAAa;AACxC,SAAO,KAAK,IAAK,KAAK,EAAG;AAC1B;AAkBO,SAAS,6BACf,WACA,MACA,QACA,WACA;AAAA,EACC;AAAA,EACA;AACD,IAMI,CAAC,GACyE;AAG9E,MAAK,UAAU,GAAI;AAClB,WAAO;AAAA,MACN,OAAO;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,EACD;AAEA,WAAS,aAAc,GAAwB;AAC9C,QAAI,OAAO;AACX,QAAI,WAAO,eAAK,MAAM,CAAE,iBAAO,GAAI,CAAE;AAErC,QAAK,oBAAqB;AACzB,YAAM,cAAU,iCAAa,MAAM,MAAM,kBAAmB;AAE5D,UAAK,O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