@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.
- package/README.md +5 -1
- package/bin/generate-primitive-tokens/index.ts +1 -1
- package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +5 -24
- package/bin/terrazzo-plugin-inline-alias-values/index.ts +84 -0
- package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +19 -39
- package/build/color-ramps/index.js +5 -5
- package/build/color-ramps/index.js.map +2 -2
- package/build/color-ramps/lib/constants.js +4 -4
- package/build/color-ramps/lib/constants.js.map +2 -2
- package/build/color-ramps/lib/default-ramps.js +154 -154
- package/build/color-ramps/lib/default-ramps.js.map +2 -2
- package/build/color-ramps/lib/find-color-with-constraints.js +36 -53
- package/build/color-ramps/lib/find-color-with-constraints.js.map +2 -2
- package/build/color-ramps/lib/index.js +72 -64
- package/build/color-ramps/lib/index.js.map +2 -2
- package/build/color-ramps/lib/ramp-configs.js +3 -3
- package/build/color-ramps/lib/ramp-configs.js.map +1 -1
- package/build/color-ramps/lib/types.js.map +1 -1
- package/build/color-ramps/lib/utils.js +63 -2
- package/build/color-ramps/lib/utils.js.map +2 -2
- package/build/prebuilt/js/design-tokens.js +5 -10
- package/build/prebuilt/js/design-tokens.js.map +2 -2
- package/build/prebuilt/json/figma.json +105 -905
- package/build/prebuilt/ts/color-tokens.js +137 -0
- package/build/prebuilt/ts/color-tokens.js.map +7 -0
- package/build/token-id.js +30 -0
- package/build/token-id.js.map +7 -0
- package/build/use-theme-provider-styles.js +15 -27
- package/build/use-theme-provider-styles.js.map +3 -3
- package/build-module/color-ramps/index.js +5 -5
- package/build-module/color-ramps/index.js.map +2 -2
- package/build-module/color-ramps/lib/constants.js +3 -3
- package/build-module/color-ramps/lib/constants.js.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.js +154 -154
- package/build-module/color-ramps/lib/default-ramps.js.map +2 -2
- package/build-module/color-ramps/lib/find-color-with-constraints.js +38 -60
- package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
- package/build-module/color-ramps/lib/index.js +76 -66
- package/build-module/color-ramps/lib/index.js.map +2 -2
- package/build-module/color-ramps/lib/ramp-configs.js +3 -3
- package/build-module/color-ramps/lib/ramp-configs.js.map +1 -1
- package/build-module/color-ramps/lib/utils.js +63 -2
- package/build-module/color-ramps/lib/utils.js.map +2 -2
- package/build-module/prebuilt/js/design-tokens.js +5 -10
- package/build-module/prebuilt/js/design-tokens.js.map +2 -2
- package/build-module/prebuilt/json/figma.json +105 -905
- package/build-module/prebuilt/ts/color-tokens.js +117 -0
- package/build-module/prebuilt/ts/color-tokens.js.map +7 -0
- package/build-module/token-id.js +6 -0
- package/build-module/token-id.js.map +7 -0
- package/build-module/use-theme-provider-styles.js +15 -27
- package/build-module/use-theme-provider-styles.js.map +2 -2
- package/build-types/color-ramps/lib/constants.d.ts +2 -2
- package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +2 -3
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/types.d.ts +2 -4
- package/build-types/color-ramps/lib/types.d.ts.map +1 -1
- package/build-types/color-ramps/lib/utils.d.ts +21 -2
- package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/color-ramps/stories/ramp-table.d.ts +2 -4
- package/build-types/color-ramps/stories/ramp-table.d.ts.map +1 -1
- package/build-types/prebuilt/ts/color-tokens.d.ts +7 -0
- package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts.map +1 -1
- package/build-types/theme-provider.d.ts.map +1 -1
- package/build-types/token-id.d.ts +9 -0
- package/build-types/token-id.d.ts.map +1 -0
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/docs/ds-tokens.md +10 -178
- package/package.json +4 -4
- package/src/color-ramps/index.ts +5 -5
- package/src/color-ramps/lib/constants.ts +7 -5
- package/src/color-ramps/lib/default-ramps.ts +154 -154
- package/src/color-ramps/lib/find-color-with-constraints.ts +53 -77
- package/src/color-ramps/lib/index.ts +100 -100
- package/src/color-ramps/lib/ramp-configs.ts +3 -3
- package/src/color-ramps/lib/types.ts +2 -7
- package/src/color-ramps/lib/utils.ts +109 -5
- package/src/color-ramps/stories/index.story.tsx +4 -1
- package/src/color-ramps/stories/ramp-table.tsx +15 -26
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +16891 -1059
- package/src/color-ramps/test/index.test.ts +43 -16
- package/src/prebuilt/css/design-tokens.css +88 -413
- package/src/prebuilt/js/design-tokens.js +5 -10
- package/src/prebuilt/json/figma.json +105 -905
- package/src/prebuilt/ts/color-tokens.ts +117 -0
- package/src/stories/index.story.tsx +4 -18
- package/src/test/token-id.test.ts +12 -0
- package/src/token-id.ts +9 -0
- package/src/use-theme-provider-styles.ts +17 -35
- package/terrazzo.config.ts +15 -12
- package/tokens/color.json +82 -82
- package/tokens/dimension.json +75 -0
- package/tsconfig.bin.tsbuildinfo +1 -1
- package/tsconfig.src.tsbuildinfo +1 -1
- package/build/prebuilt/ts/design-tokens.js +0 -391
- package/build/prebuilt/ts/design-tokens.js.map +0 -7
- package/build-module/prebuilt/ts/design-tokens.js +0 -371
- package/build-module/prebuilt/ts/design-tokens.js.map +0 -7
- package/build-types/prebuilt/ts/design-tokens.d.ts +0 -7
- package/build-types/prebuilt/ts/design-tokens.d.ts.map +0 -1
- package/src/prebuilt/ts/design-tokens.ts +0 -371
- package/tokens/spacing.json +0 -45
package/docs/ds-tokens.md
CHANGED
|
@@ -109,6 +109,16 @@ Do not edit directly.
|
|
|
109
109
|
| `--wpds-color-stroke-interactive-error-strong` | Accessible stroke color used for interactive error-toned elements with strong emphasis. |
|
|
110
110
|
| `--wpds-color-stroke-focus-brand` | Accessible stroke color applied to focus rings. |
|
|
111
111
|
|
|
112
|
+
### Dimension
|
|
113
|
+
|
|
114
|
+
| Variable name | Description |
|
|
115
|
+
| ------------------------------------------ | -------------------------------- |
|
|
116
|
+
| `--wpds-dimension-base` | Base dimension unit |
|
|
117
|
+
| `--wpds-dimension-padding-surface-x-small` | Extra small spacing for surfaces |
|
|
118
|
+
| `--wpds-dimension-padding-surface-small` | Small spacing for surfaces |
|
|
119
|
+
| `--wpds-dimension-padding-surface-medium` | Medium spacing for surfaces |
|
|
120
|
+
| `--wpds-dimension-padding-surface-large` | Large spacing for surfaces |
|
|
121
|
+
|
|
112
122
|
### Elevation
|
|
113
123
|
|
|
114
124
|
| Variable name | Description |
|
|
@@ -118,21 +128,6 @@ Do not edit directly.
|
|
|
118
128
|
| `--wpds-elevation-medium` | For components that offer additional actions. Example: Menus, Command Palette |
|
|
119
129
|
| `--wpds-elevation-large` | For components that confirm decisions or handle necessary interruptions. Example: Modals. |
|
|
120
130
|
|
|
121
|
-
### Spacing
|
|
122
|
-
|
|
123
|
-
| Variable name | Description |
|
|
124
|
-
| ------------------- | ------------------- |
|
|
125
|
-
| `--wpds-spacing-05` | Extra small spacing |
|
|
126
|
-
| `--wpds-spacing-10` | Small spacing |
|
|
127
|
-
| `--wpds-spacing-15` | Medium spacing |
|
|
128
|
-
| `--wpds-spacing-20` | Large spacing |
|
|
129
|
-
| `--wpds-spacing-30` | Extra large spacing |
|
|
130
|
-
| `--wpds-spacing-40` | 2X large spacing |
|
|
131
|
-
| `--wpds-spacing-50` | 3X large spacing |
|
|
132
|
-
| `--wpds-spacing-60` | 4X large spacing |
|
|
133
|
-
| `--wpds-spacing-70` | 5X large spacing |
|
|
134
|
-
| `--wpds-spacing-80` | 6X large spacing |
|
|
135
|
-
|
|
136
131
|
### Typography
|
|
137
132
|
|
|
138
133
|
| Variable name | Description |
|
|
@@ -152,166 +147,3 @@ Do not edit directly.
|
|
|
152
147
|
| `--wpds-font-line-height-large` | Large line height |
|
|
153
148
|
| `--wpds-font-line-height-x-large` | Extra large line height |
|
|
154
149
|
| `--wpds-font-line-height-2x-large` | 2X large line height |
|
|
155
|
-
|
|
156
|
-
## Primitive tokens
|
|
157
|
-
|
|
158
|
-
**🚨 Note: These tokens are only private implementation details of the Theme, and should never be referenced / consumed directly in the code.**
|
|
159
|
-
|
|
160
|
-
### Color (private)
|
|
161
|
-
|
|
162
|
-
| Variable name | Description |
|
|
163
|
-
| ------------------------------------------------ | ----------- |
|
|
164
|
-
| `--wpds-color-private-primary-bg-fill1` | N/A |
|
|
165
|
-
| `--wpds-color-private-primary-fg-fill` | N/A |
|
|
166
|
-
| `--wpds-color-private-primary-bg-fill2` | N/A |
|
|
167
|
-
| `--wpds-color-private-primary-surface2` | N/A |
|
|
168
|
-
| `--wpds-color-private-primary-surface6` | N/A |
|
|
169
|
-
| `--wpds-color-private-primary-surface5` | N/A |
|
|
170
|
-
| `--wpds-color-private-primary-surface4` | N/A |
|
|
171
|
-
| `--wpds-color-private-primary-surface3` | N/A |
|
|
172
|
-
| `--wpds-color-private-primary-fg-surface4` | N/A |
|
|
173
|
-
| `--wpds-color-private-primary-fg-surface3` | N/A |
|
|
174
|
-
| `--wpds-color-private-primary-fg-surface2` | N/A |
|
|
175
|
-
| `--wpds-color-private-primary-fg-surface1` | N/A |
|
|
176
|
-
| `--wpds-color-private-primary-stroke3` | N/A |
|
|
177
|
-
| `--wpds-color-private-primary-stroke4` | N/A |
|
|
178
|
-
| `--wpds-color-private-primary-stroke2` | N/A |
|
|
179
|
-
| `--wpds-color-private-primary-stroke1` | N/A |
|
|
180
|
-
| `--wpds-color-private-primary-bg-fill-dark` | N/A |
|
|
181
|
-
| `--wpds-color-private-primary-fg-fill-dark` | N/A |
|
|
182
|
-
| `--wpds-color-private-primary-bg-fill-inverted2` | N/A |
|
|
183
|
-
| `--wpds-color-private-primary-bg-fill-inverted1` | N/A |
|
|
184
|
-
| `--wpds-color-private-primary-fg-fill-inverted` | N/A |
|
|
185
|
-
| `--wpds-color-private-primary-surface1` | N/A |
|
|
186
|
-
| `--wpds-color-private-info-bg-fill1` | N/A |
|
|
187
|
-
| `--wpds-color-private-info-fg-fill` | N/A |
|
|
188
|
-
| `--wpds-color-private-info-bg-fill2` | N/A |
|
|
189
|
-
| `--wpds-color-private-info-surface2` | N/A |
|
|
190
|
-
| `--wpds-color-private-info-surface6` | N/A |
|
|
191
|
-
| `--wpds-color-private-info-surface5` | N/A |
|
|
192
|
-
| `--wpds-color-private-info-surface4` | N/A |
|
|
193
|
-
| `--wpds-color-private-info-surface3` | N/A |
|
|
194
|
-
| `--wpds-color-private-info-fg-surface4` | N/A |
|
|
195
|
-
| `--wpds-color-private-info-fg-surface3` | N/A |
|
|
196
|
-
| `--wpds-color-private-info-fg-surface2` | N/A |
|
|
197
|
-
| `--wpds-color-private-info-fg-surface1` | N/A |
|
|
198
|
-
| `--wpds-color-private-info-stroke3` | N/A |
|
|
199
|
-
| `--wpds-color-private-info-stroke4` | N/A |
|
|
200
|
-
| `--wpds-color-private-info-stroke2` | N/A |
|
|
201
|
-
| `--wpds-color-private-info-stroke1` | N/A |
|
|
202
|
-
| `--wpds-color-private-info-bg-fill-dark` | N/A |
|
|
203
|
-
| `--wpds-color-private-info-fg-fill-dark` | N/A |
|
|
204
|
-
| `--wpds-color-private-info-bg-fill-inverted2` | N/A |
|
|
205
|
-
| `--wpds-color-private-info-bg-fill-inverted1` | N/A |
|
|
206
|
-
| `--wpds-color-private-info-fg-fill-inverted` | N/A |
|
|
207
|
-
| `--wpds-color-private-info-surface1` | N/A |
|
|
208
|
-
| `--wpds-color-private-success-bg-fill1` | N/A |
|
|
209
|
-
| `--wpds-color-private-success-fg-fill` | N/A |
|
|
210
|
-
| `--wpds-color-private-success-bg-fill2` | N/A |
|
|
211
|
-
| `--wpds-color-private-success-surface2` | N/A |
|
|
212
|
-
| `--wpds-color-private-success-surface6` | N/A |
|
|
213
|
-
| `--wpds-color-private-success-surface5` | N/A |
|
|
214
|
-
| `--wpds-color-private-success-surface4` | N/A |
|
|
215
|
-
| `--wpds-color-private-success-surface3` | N/A |
|
|
216
|
-
| `--wpds-color-private-success-fg-surface4` | N/A |
|
|
217
|
-
| `--wpds-color-private-success-fg-surface3` | N/A |
|
|
218
|
-
| `--wpds-color-private-success-fg-surface2` | N/A |
|
|
219
|
-
| `--wpds-color-private-success-fg-surface1` | N/A |
|
|
220
|
-
| `--wpds-color-private-success-stroke3` | N/A |
|
|
221
|
-
| `--wpds-color-private-success-stroke4` | N/A |
|
|
222
|
-
| `--wpds-color-private-success-stroke2` | N/A |
|
|
223
|
-
| `--wpds-color-private-success-stroke1` | N/A |
|
|
224
|
-
| `--wpds-color-private-success-bg-fill-dark` | N/A |
|
|
225
|
-
| `--wpds-color-private-success-fg-fill-dark` | N/A |
|
|
226
|
-
| `--wpds-color-private-success-bg-fill-inverted2` | N/A |
|
|
227
|
-
| `--wpds-color-private-success-bg-fill-inverted1` | N/A |
|
|
228
|
-
| `--wpds-color-private-success-fg-fill-inverted` | N/A |
|
|
229
|
-
| `--wpds-color-private-success-surface1` | N/A |
|
|
230
|
-
| `--wpds-color-private-warning-bg-fill1` | N/A |
|
|
231
|
-
| `--wpds-color-private-warning-fg-fill` | N/A |
|
|
232
|
-
| `--wpds-color-private-warning-bg-fill2` | N/A |
|
|
233
|
-
| `--wpds-color-private-warning-surface2` | N/A |
|
|
234
|
-
| `--wpds-color-private-warning-surface6` | N/A |
|
|
235
|
-
| `--wpds-color-private-warning-surface5` | N/A |
|
|
236
|
-
| `--wpds-color-private-warning-surface4` | N/A |
|
|
237
|
-
| `--wpds-color-private-warning-surface3` | N/A |
|
|
238
|
-
| `--wpds-color-private-warning-fg-surface4` | N/A |
|
|
239
|
-
| `--wpds-color-private-warning-fg-surface3` | N/A |
|
|
240
|
-
| `--wpds-color-private-warning-fg-surface2` | N/A |
|
|
241
|
-
| `--wpds-color-private-warning-fg-surface1` | N/A |
|
|
242
|
-
| `--wpds-color-private-warning-stroke3` | N/A |
|
|
243
|
-
| `--wpds-color-private-warning-stroke4` | N/A |
|
|
244
|
-
| `--wpds-color-private-warning-stroke2` | N/A |
|
|
245
|
-
| `--wpds-color-private-warning-stroke1` | N/A |
|
|
246
|
-
| `--wpds-color-private-warning-bg-fill-dark` | N/A |
|
|
247
|
-
| `--wpds-color-private-warning-fg-fill-dark` | N/A |
|
|
248
|
-
| `--wpds-color-private-warning-bg-fill-inverted2` | N/A |
|
|
249
|
-
| `--wpds-color-private-warning-bg-fill-inverted1` | N/A |
|
|
250
|
-
| `--wpds-color-private-warning-fg-fill-inverted` | N/A |
|
|
251
|
-
| `--wpds-color-private-warning-surface1` | N/A |
|
|
252
|
-
| `--wpds-color-private-error-bg-fill1` | N/A |
|
|
253
|
-
| `--wpds-color-private-error-fg-fill` | N/A |
|
|
254
|
-
| `--wpds-color-private-error-bg-fill2` | N/A |
|
|
255
|
-
| `--wpds-color-private-error-surface2` | N/A |
|
|
256
|
-
| `--wpds-color-private-error-surface6` | N/A |
|
|
257
|
-
| `--wpds-color-private-error-surface5` | N/A |
|
|
258
|
-
| `--wpds-color-private-error-surface4` | N/A |
|
|
259
|
-
| `--wpds-color-private-error-surface3` | N/A |
|
|
260
|
-
| `--wpds-color-private-error-fg-surface4` | N/A |
|
|
261
|
-
| `--wpds-color-private-error-fg-surface3` | N/A |
|
|
262
|
-
| `--wpds-color-private-error-fg-surface2` | N/A |
|
|
263
|
-
| `--wpds-color-private-error-fg-surface1` | N/A |
|
|
264
|
-
| `--wpds-color-private-error-stroke3` | N/A |
|
|
265
|
-
| `--wpds-color-private-error-stroke4` | N/A |
|
|
266
|
-
| `--wpds-color-private-error-stroke2` | N/A |
|
|
267
|
-
| `--wpds-color-private-error-stroke1` | N/A |
|
|
268
|
-
| `--wpds-color-private-error-bg-fill-dark` | N/A |
|
|
269
|
-
| `--wpds-color-private-error-fg-fill-dark` | N/A |
|
|
270
|
-
| `--wpds-color-private-error-bg-fill-inverted2` | N/A |
|
|
271
|
-
| `--wpds-color-private-error-bg-fill-inverted1` | N/A |
|
|
272
|
-
| `--wpds-color-private-error-fg-fill-inverted` | N/A |
|
|
273
|
-
| `--wpds-color-private-error-surface1` | N/A |
|
|
274
|
-
| `--wpds-color-private-bg-surface2` | N/A |
|
|
275
|
-
| `--wpds-color-private-bg-bg-fill1` | N/A |
|
|
276
|
-
| `--wpds-color-private-bg-fg-fill` | N/A |
|
|
277
|
-
| `--wpds-color-private-bg-bg-fill2` | N/A |
|
|
278
|
-
| `--wpds-color-private-bg-surface6` | N/A |
|
|
279
|
-
| `--wpds-color-private-bg-surface5` | N/A |
|
|
280
|
-
| `--wpds-color-private-bg-surface4` | N/A |
|
|
281
|
-
| `--wpds-color-private-bg-surface3` | N/A |
|
|
282
|
-
| `--wpds-color-private-bg-fg-surface4` | N/A |
|
|
283
|
-
| `--wpds-color-private-bg-fg-surface3` | N/A |
|
|
284
|
-
| `--wpds-color-private-bg-fg-surface2` | N/A |
|
|
285
|
-
| `--wpds-color-private-bg-fg-surface1` | N/A |
|
|
286
|
-
| `--wpds-color-private-bg-stroke3` | N/A |
|
|
287
|
-
| `--wpds-color-private-bg-stroke4` | N/A |
|
|
288
|
-
| `--wpds-color-private-bg-stroke2` | N/A |
|
|
289
|
-
| `--wpds-color-private-bg-stroke1` | N/A |
|
|
290
|
-
| `--wpds-color-private-bg-bg-fill-dark` | N/A |
|
|
291
|
-
| `--wpds-color-private-bg-fg-fill-dark` | N/A |
|
|
292
|
-
| `--wpds-color-private-bg-bg-fill-inverted2` | N/A |
|
|
293
|
-
| `--wpds-color-private-bg-bg-fill-inverted1` | N/A |
|
|
294
|
-
| `--wpds-color-private-bg-fg-fill-inverted` | N/A |
|
|
295
|
-
| `--wpds-color-private-bg-surface1` | N/A |
|
|
296
|
-
| `--wpds-color-private-caution-bg-fill1` | N/A |
|
|
297
|
-
| `--wpds-color-private-caution-fg-fill` | N/A |
|
|
298
|
-
| `--wpds-color-private-caution-bg-fill2` | N/A |
|
|
299
|
-
| `--wpds-color-private-caution-surface2` | N/A |
|
|
300
|
-
| `--wpds-color-private-caution-surface6` | N/A |
|
|
301
|
-
| `--wpds-color-private-caution-surface5` | N/A |
|
|
302
|
-
| `--wpds-color-private-caution-surface4` | N/A |
|
|
303
|
-
| `--wpds-color-private-caution-surface3` | N/A |
|
|
304
|
-
| `--wpds-color-private-caution-fg-surface4` | N/A |
|
|
305
|
-
| `--wpds-color-private-caution-fg-surface3` | N/A |
|
|
306
|
-
| `--wpds-color-private-caution-fg-surface2` | N/A |
|
|
307
|
-
| `--wpds-color-private-caution-fg-surface1` | N/A |
|
|
308
|
-
| `--wpds-color-private-caution-stroke3` | N/A |
|
|
309
|
-
| `--wpds-color-private-caution-stroke4` | N/A |
|
|
310
|
-
| `--wpds-color-private-caution-stroke2` | N/A |
|
|
311
|
-
| `--wpds-color-private-caution-stroke1` | N/A |
|
|
312
|
-
| `--wpds-color-private-caution-bg-fill-dark` | N/A |
|
|
313
|
-
| `--wpds-color-private-caution-fg-fill-dark` | N/A |
|
|
314
|
-
| `--wpds-color-private-caution-bg-fill-inverted2` | N/A |
|
|
315
|
-
| `--wpds-color-private-caution-bg-fill-inverted1` | N/A |
|
|
316
|
-
| `--wpds-color-private-caution-fg-fill-inverted` | N/A |
|
|
317
|
-
| `--wpds-color-private-caution-surface1` | N/A |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1-next.16d95556a.0",
|
|
4
4
|
"description": "Theme and context provider for the WordPress Design System.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"build-module/color-ramps/lib/register-color-spaces.js"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@wordpress/element": "^6.
|
|
47
|
-
"@wordpress/private-apis": "^1.
|
|
46
|
+
"@wordpress/element": "^6.35.1-next.16d95556a.0",
|
|
47
|
+
"@wordpress/private-apis": "^1.35.1-next.16d95556a.0",
|
|
48
48
|
"colorjs.io": "^0.5.2",
|
|
49
49
|
"memize": "^2.1.0"
|
|
50
50
|
},
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"build": "npm run build:tokens && npm run build:default-ramps",
|
|
65
65
|
"postbuild": "prettier --write tokens/color.json src/prebuilt src/color-ramps/lib/default-ramps.ts docs"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "59a9383612bbe16e21af84d13b035bfbca7fe833"
|
|
68
68
|
}
|
package/src/color-ramps/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ function getBgRampInfo( ramp: InternalRampResult ): {
|
|
|
44
44
|
pinLightness: {
|
|
45
45
|
stepName: STEP_TO_PIN,
|
|
46
46
|
value: clampAccentScaleReferenceLightness(
|
|
47
|
-
get( parse( ramp.ramp[ STEP_TO_PIN ]
|
|
47
|
+
get( parse( ramp.ramp[ STEP_TO_PIN ] ), [ OKLCH, 'l' ] ),
|
|
48
48
|
ramp.direction
|
|
49
49
|
),
|
|
50
50
|
},
|
|
@@ -96,8 +96,8 @@ export function checkAccessibleCombinations( {
|
|
|
96
96
|
CONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {
|
|
97
97
|
for ( const bg of bgs ) {
|
|
98
98
|
for ( const fg of fgs ) {
|
|
99
|
-
const bgColor = parse( ramp.ramp[ bg ]
|
|
100
|
-
const fgColor = parse( ramp.ramp[ fg ]
|
|
99
|
+
const bgColor = parse( ramp.ramp[ bg ] );
|
|
100
|
+
const fgColor = parse( ramp.ramp[ fg ] );
|
|
101
101
|
if ( getContrast( bgColor, fgColor ) < target ) {
|
|
102
102
|
unmetTargets.push( {
|
|
103
103
|
bgName: bg,
|
|
@@ -116,8 +116,8 @@ export function checkAccessibleCombinations( {
|
|
|
116
116
|
CONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {
|
|
117
117
|
for ( const bg of bgs ) {
|
|
118
118
|
for ( const fg of fgs ) {
|
|
119
|
-
const bgColor = parse( bgRamp.ramp[ bg ]
|
|
120
|
-
const fgColor = parse( ramp.ramp[ fg ]
|
|
119
|
+
const bgColor = parse( bgRamp.ramp[ bg ] );
|
|
120
|
+
const fgColor = parse( ramp.ramp[ fg ] );
|
|
121
121
|
if ( getContrast( bgColor, fgColor ) < target ) {
|
|
122
122
|
unmetTargets.push( {
|
|
123
123
|
bgName: bg,
|
|
@@ -12,9 +12,11 @@ import type { Ramp } from './types';
|
|
|
12
12
|
export const WHITE = to( 'white', OKLCH );
|
|
13
13
|
export const BLACK = to( 'black', OKLCH );
|
|
14
14
|
|
|
15
|
-
// Margin added to target contrasts to counter for algorithm approximations
|
|
16
|
-
//
|
|
17
|
-
|
|
15
|
+
// Margin added to target contrasts to counter for algorithm approximations and rounding errors.
|
|
16
|
+
// - the `CONTRAST_EPSILON` value is 0.004, so the real contrast can be lower by this amount.
|
|
17
|
+
// - the max contrast between adjacent RGB values is 1.016, so half of the difference (0.008) can be rounding error.
|
|
18
|
+
// - the sum is 0.012: the margin we add to ensure that the target contrast is met after all the rounding.
|
|
19
|
+
export const UNIVERSAL_CONTRAST_TOPUP = 0.012;
|
|
18
20
|
|
|
19
21
|
// When enabling "lighter direction" bias, this is the amount by which
|
|
20
22
|
// black text contrast needs to be greater than white text contrast.
|
|
@@ -33,8 +35,8 @@ export const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS = {
|
|
|
33
35
|
darker: { min: 0.75, max: 0.98 },
|
|
34
36
|
} as const;
|
|
35
37
|
|
|
36
|
-
//
|
|
37
|
-
export const
|
|
38
|
+
// Contrast precision we aim for. Approximately 1/256, resolution of an 8-bit number.
|
|
39
|
+
export const CONTRAST_EPSILON = 4e-3;
|
|
38
40
|
|
|
39
41
|
export const MAX_BISECTION_ITERATIONS = 10;
|
|
40
42
|
|
|
@@ -10,190 +10,190 @@ export const DEFAULT_RAMPS: Record<
|
|
|
10
10
|
> = {
|
|
11
11
|
bg: {
|
|
12
12
|
ramp: {
|
|
13
|
-
surface2:
|
|
14
|
-
bgFill1:
|
|
15
|
-
fgFill:
|
|
16
|
-
bgFill2:
|
|
17
|
-
surface6:
|
|
18
|
-
surface5:
|
|
19
|
-
surface4:
|
|
20
|
-
surface3:
|
|
21
|
-
fgSurface4:
|
|
22
|
-
fgSurface3:
|
|
23
|
-
fgSurface2:
|
|
24
|
-
fgSurface1:
|
|
25
|
-
stroke3:
|
|
26
|
-
stroke4:
|
|
27
|
-
stroke2:
|
|
28
|
-
stroke1:
|
|
29
|
-
bgFillDark:
|
|
30
|
-
fgFillDark:
|
|
31
|
-
bgFillInverted2:
|
|
32
|
-
bgFillInverted1:
|
|
33
|
-
fgFillInverted:
|
|
34
|
-
surface1:
|
|
13
|
+
surface2: '#f8f8f8',
|
|
14
|
+
bgFill1: '#555',
|
|
15
|
+
fgFill: '#f0f0f0',
|
|
16
|
+
bgFill2: '#494949',
|
|
17
|
+
surface6: '#d3d3d3',
|
|
18
|
+
surface5: '#e3e3e3',
|
|
19
|
+
surface4: '#eaeaea',
|
|
20
|
+
surface3: '#fff',
|
|
21
|
+
fgSurface4: '#1e1e1e',
|
|
22
|
+
fgSurface3: '#6e6e6e',
|
|
23
|
+
fgSurface2: '#8b8b8b',
|
|
24
|
+
fgSurface1: '#ababab',
|
|
25
|
+
stroke3: '#8b8b8b',
|
|
26
|
+
stroke4: '#6d6d6d',
|
|
27
|
+
stroke2: '#adadad',
|
|
28
|
+
stroke1: '#cfcfcf',
|
|
29
|
+
bgFillDark: '#1e1e1e',
|
|
30
|
+
fgFillDark: '#f0f0f0',
|
|
31
|
+
bgFillInverted2: '#1e1e1e',
|
|
32
|
+
bgFillInverted1: '#2d2d2d',
|
|
33
|
+
fgFillInverted: '#f0f0f0',
|
|
34
|
+
surface1: '#f0f0f0',
|
|
35
35
|
},
|
|
36
36
|
direction: 'darker',
|
|
37
37
|
},
|
|
38
38
|
primary: {
|
|
39
39
|
ramp: {
|
|
40
|
-
bgFill1:
|
|
41
|
-
fgFill:
|
|
42
|
-
bgFill2:
|
|
43
|
-
surface2:
|
|
44
|
-
surface6:
|
|
45
|
-
surface5:
|
|
46
|
-
surface4:
|
|
47
|
-
surface3:
|
|
48
|
-
fgSurface4:
|
|
49
|
-
fgSurface3:
|
|
50
|
-
fgSurface2:
|
|
51
|
-
fgSurface1:
|
|
52
|
-
stroke3:
|
|
53
|
-
stroke4:
|
|
54
|
-
stroke2:
|
|
55
|
-
stroke1:
|
|
56
|
-
bgFillDark:
|
|
57
|
-
fgFillDark:
|
|
58
|
-
bgFillInverted2:
|
|
59
|
-
bgFillInverted1:
|
|
60
|
-
fgFillInverted:
|
|
61
|
-
surface1:
|
|
40
|
+
bgFill1: '#3858e9',
|
|
41
|
+
fgFill: '#eff0f2',
|
|
42
|
+
bgFill2: '#2e49da',
|
|
43
|
+
surface2: '#f6f8fc',
|
|
44
|
+
surface6: '#c7d3ef',
|
|
45
|
+
surface5: '#dce3f5',
|
|
46
|
+
surface4: '#e5ebf7',
|
|
47
|
+
surface3: '#fff',
|
|
48
|
+
fgSurface4: '#080071',
|
|
49
|
+
fgSurface3: '#3858e9',
|
|
50
|
+
fgSurface2: '#5881ff',
|
|
51
|
+
fgSurface1: '#84a9ff',
|
|
52
|
+
stroke3: '#3858e9',
|
|
53
|
+
stroke4: '#2337c8',
|
|
54
|
+
stroke2: '#6d83bf',
|
|
55
|
+
stroke1: '#91a2cf',
|
|
56
|
+
bgFillDark: '#1b1e26',
|
|
57
|
+
fgFillDark: '#eff0f2',
|
|
58
|
+
bgFillInverted2: '#1b1e26',
|
|
59
|
+
bgFillInverted1: '#12009f',
|
|
60
|
+
fgFillInverted: '#eff0f2',
|
|
61
|
+
surface1: '#edf0fa',
|
|
62
62
|
},
|
|
63
63
|
direction: 'darker',
|
|
64
64
|
},
|
|
65
65
|
info: {
|
|
66
66
|
ramp: {
|
|
67
|
-
bgFill1:
|
|
68
|
-
fgFill:
|
|
69
|
-
bgFill2:
|
|
70
|
-
surface2:
|
|
71
|
-
surface6:
|
|
72
|
-
surface5:
|
|
73
|
-
surface4:
|
|
74
|
-
surface3:
|
|
75
|
-
fgSurface4:
|
|
76
|
-
fgSurface3:
|
|
77
|
-
fgSurface2:
|
|
78
|
-
fgSurface1:
|
|
79
|
-
stroke3:
|
|
80
|
-
stroke4:
|
|
81
|
-
stroke2:
|
|
82
|
-
stroke1:
|
|
83
|
-
bgFillDark:
|
|
84
|
-
fgFillDark:
|
|
85
|
-
bgFillInverted2:
|
|
86
|
-
bgFillInverted1:
|
|
87
|
-
fgFillInverted:
|
|
88
|
-
surface1:
|
|
67
|
+
bgFill1: '#0090ff',
|
|
68
|
+
fgFill: '#1b1e23',
|
|
69
|
+
bgFill2: '#0081ef',
|
|
70
|
+
surface2: '#f5f9fd',
|
|
71
|
+
surface6: '#bed6f1',
|
|
72
|
+
surface5: '#d5e5f6',
|
|
73
|
+
surface4: '#e0ebf8',
|
|
74
|
+
surface3: '#fff',
|
|
75
|
+
fgSurface4: '#001758',
|
|
76
|
+
fgSurface3: '#006dd9',
|
|
77
|
+
fgSurface2: '#008cfb',
|
|
78
|
+
fgSurface1: '#53b1ff',
|
|
79
|
+
stroke3: '#006dd9',
|
|
80
|
+
stroke4: '#004eb8',
|
|
81
|
+
stroke2: '#5d8fc6',
|
|
82
|
+
stroke1: '#8aaed6',
|
|
83
|
+
bgFillDark: '#1b1e23',
|
|
84
|
+
fgFillDark: '#eff0f2',
|
|
85
|
+
bgFillInverted2: '#1b1e23',
|
|
86
|
+
bgFillInverted1: '#002675',
|
|
87
|
+
fgFillInverted: '#eff0f2',
|
|
88
|
+
surface1: '#eaf1fa',
|
|
89
89
|
},
|
|
90
90
|
direction: 'darker',
|
|
91
91
|
},
|
|
92
92
|
success: {
|
|
93
93
|
ramp: {
|
|
94
|
-
bgFill1:
|
|
95
|
-
fgFill:
|
|
96
|
-
bgFill2:
|
|
97
|
-
surface2:
|
|
98
|
-
surface6:
|
|
99
|
-
surface5:
|
|
100
|
-
surface4:
|
|
101
|
-
surface3:
|
|
102
|
-
fgSurface4:
|
|
103
|
-
fgSurface3:
|
|
104
|
-
fgSurface2:
|
|
105
|
-
fgSurface1:
|
|
106
|
-
stroke3:
|
|
107
|
-
stroke4:
|
|
108
|
-
stroke2:
|
|
109
|
-
stroke1:
|
|
110
|
-
bgFillDark:
|
|
111
|
-
fgFillDark:
|
|
112
|
-
bgFillInverted2:
|
|
113
|
-
bgFillInverted1:
|
|
114
|
-
fgFillInverted:
|
|
115
|
-
surface1:
|
|
94
|
+
bgFill1: '#4ab866',
|
|
95
|
+
fgFill: '#1b1f1c',
|
|
96
|
+
bgFill2: '#37a857',
|
|
97
|
+
surface2: '#f0fcf2',
|
|
98
|
+
surface6: '#7eea95',
|
|
99
|
+
surface5: '#b7f2c1',
|
|
100
|
+
surface4: '#cdf5d3',
|
|
101
|
+
surface3: '#fff',
|
|
102
|
+
fgSurface4: '#002b00',
|
|
103
|
+
fgSurface3: '#008031',
|
|
104
|
+
fgSurface2: '#2c9f4e',
|
|
105
|
+
fgSurface1: '#54c16f',
|
|
106
|
+
stroke3: '#008031',
|
|
107
|
+
stroke4: '#006314',
|
|
108
|
+
stroke2: '#61986b',
|
|
109
|
+
stroke1: '#77ba84',
|
|
110
|
+
bgFillDark: '#1b1f1c',
|
|
111
|
+
fgFillDark: '#edf2ed',
|
|
112
|
+
bgFillInverted2: '#1b1f1c',
|
|
113
|
+
bgFillInverted1: '#003800',
|
|
114
|
+
fgFillInverted: '#edf2ed',
|
|
115
|
+
surface1: '#ddf8e1',
|
|
116
116
|
},
|
|
117
117
|
direction: 'darker',
|
|
118
118
|
},
|
|
119
119
|
caution: {
|
|
120
120
|
ramp: {
|
|
121
|
-
bgFill1:
|
|
122
|
-
fgFill:
|
|
123
|
-
bgFill2:
|
|
124
|
-
surface2:
|
|
125
|
-
surface6:
|
|
126
|
-
surface5:
|
|
127
|
-
surface4:
|
|
128
|
-
surface3:
|
|
129
|
-
fgSurface4:
|
|
130
|
-
fgSurface3:
|
|
131
|
-
fgSurface2:
|
|
132
|
-
fgSurface1:
|
|
133
|
-
stroke3:
|
|
134
|
-
stroke4:
|
|
135
|
-
stroke2:
|
|
136
|
-
stroke1:
|
|
137
|
-
bgFillDark:
|
|
138
|
-
fgFillDark:
|
|
139
|
-
bgFillInverted2:
|
|
140
|
-
bgFillInverted1:
|
|
141
|
-
fgFillInverted:
|
|
142
|
-
surface1:
|
|
121
|
+
bgFill1: '#f0d149',
|
|
122
|
+
fgFill: '#1f1e1b',
|
|
123
|
+
bgFill2: '#ddbe30',
|
|
124
|
+
surface2: '#fdf9e7',
|
|
125
|
+
surface6: '#ecd367',
|
|
126
|
+
surface5: '#f5e399',
|
|
127
|
+
surface4: '#f8ebb5',
|
|
128
|
+
surface3: '#fff',
|
|
129
|
+
fgSurface4: '#291d00',
|
|
130
|
+
fgSurface3: '#876b00',
|
|
131
|
+
fgSurface2: '#a78900',
|
|
132
|
+
fgSurface1: '#c9aa00',
|
|
133
|
+
stroke3: '#876b00',
|
|
134
|
+
stroke4: '#675000',
|
|
135
|
+
stroke2: '#978c60',
|
|
136
|
+
stroke1: '#b8ab75',
|
|
137
|
+
bgFillDark: '#1f1e1b',
|
|
138
|
+
fgFillDark: '#f6f1da',
|
|
139
|
+
bgFillInverted2: '#1f1e1b',
|
|
140
|
+
bgFillInverted1: '#3a2b00',
|
|
141
|
+
fgFillInverted: '#f6f1da',
|
|
142
|
+
surface1: '#faf1cd',
|
|
143
143
|
},
|
|
144
144
|
direction: 'darker',
|
|
145
145
|
},
|
|
146
146
|
warning: {
|
|
147
147
|
ramp: {
|
|
148
|
-
bgFill1:
|
|
149
|
-
fgFill:
|
|
150
|
-
bgFill2:
|
|
151
|
-
surface2:
|
|
152
|
-
surface6:
|
|
153
|
-
surface5:
|
|
154
|
-
surface4:
|
|
155
|
-
surface3:
|
|
156
|
-
fgSurface4:
|
|
157
|
-
fgSurface3:
|
|
158
|
-
fgSurface2:
|
|
159
|
-
fgSurface1:
|
|
160
|
-
stroke3:
|
|
161
|
-
stroke4:
|
|
162
|
-
stroke2:
|
|
163
|
-
stroke1:
|
|
164
|
-
bgFillDark:
|
|
165
|
-
fgFillDark:
|
|
166
|
-
bgFillInverted2:
|
|
167
|
-
bgFillInverted1:
|
|
168
|
-
fgFillInverted:
|
|
169
|
-
surface1:
|
|
148
|
+
bgFill1: '#f0b849',
|
|
149
|
+
fgFill: '#1f1e1b',
|
|
150
|
+
bgFill2: '#dea633',
|
|
151
|
+
surface2: '#fdf7ee',
|
|
152
|
+
surface6: '#f1ce90',
|
|
153
|
+
surface5: '#f6e0bb',
|
|
154
|
+
surface4: '#f8e9cd',
|
|
155
|
+
surface3: '#fff',
|
|
156
|
+
fgSurface4: '#2f1800',
|
|
157
|
+
fgSurface3: '#976300',
|
|
158
|
+
fgSurface2: '#b78100',
|
|
159
|
+
fgSurface1: '#d9a22e',
|
|
160
|
+
stroke3: '#976300',
|
|
161
|
+
stroke4: '#754900',
|
|
162
|
+
stroke2: '#9f8860',
|
|
163
|
+
stroke1: '#c2a776',
|
|
164
|
+
bgFillDark: '#1f1e1b',
|
|
165
|
+
fgFillDark: '#f3f0e9',
|
|
166
|
+
bgFillInverted2: '#1f1e1b',
|
|
167
|
+
bgFillInverted1: '#432600',
|
|
168
|
+
fgFillInverted: '#f3f0e9',
|
|
169
|
+
surface1: '#faefdc',
|
|
170
170
|
},
|
|
171
171
|
direction: 'darker',
|
|
172
172
|
},
|
|
173
173
|
error: {
|
|
174
174
|
ramp: {
|
|
175
|
-
bgFill1:
|
|
176
|
-
fgFill:
|
|
177
|
-
bgFill2:
|
|
178
|
-
surface2:
|
|
179
|
-
surface6:
|
|
180
|
-
surface5:
|
|
181
|
-
surface4:
|
|
182
|
-
surface3:
|
|
183
|
-
fgSurface4:
|
|
184
|
-
fgSurface3:
|
|
185
|
-
fgSurface2:
|
|
186
|
-
fgSurface1:
|
|
187
|
-
stroke3:
|
|
188
|
-
stroke4:
|
|
189
|
-
stroke2:
|
|
190
|
-
stroke1:
|
|
191
|
-
bgFillDark:
|
|
192
|
-
fgFillDark:
|
|
193
|
-
bgFillInverted2:
|
|
194
|
-
bgFillInverted1:
|
|
195
|
-
fgFillInverted:
|
|
196
|
-
surface1:
|
|
175
|
+
bgFill1: '#cc1818',
|
|
176
|
+
fgFill: '#f2efef',
|
|
177
|
+
bgFill2: '#bc0001',
|
|
178
|
+
surface2: '#fdf6f5',
|
|
179
|
+
surface6: '#f5c9c2',
|
|
180
|
+
surface5: '#f9dcd8',
|
|
181
|
+
surface4: '#fae5e2',
|
|
182
|
+
surface3: '#fff',
|
|
183
|
+
fgSurface4: '#4a0000',
|
|
184
|
+
fgSurface3: '#cc1818',
|
|
185
|
+
fgSurface2: '#f84d41',
|
|
186
|
+
fgSurface1: '#ff8373',
|
|
187
|
+
stroke3: '#cc1818',
|
|
188
|
+
stroke4: '#a70000',
|
|
189
|
+
stroke2: '#ca675c',
|
|
190
|
+
stroke1: '#dc8e83',
|
|
191
|
+
bgFillDark: '#231c1b',
|
|
192
|
+
fgFillDark: '#f2efef',
|
|
193
|
+
bgFillInverted2: '#231c1b',
|
|
194
|
+
bgFillInverted1: '#680000',
|
|
195
|
+
fgFillInverted: '#f2efef',
|
|
196
|
+
surface1: '#fcedea',
|
|
197
197
|
},
|
|
198
198
|
direction: 'darker',
|
|
199
199
|
},
|