@wordpress/theme 0.10.1-next.v.202604091042.0 → 0.11.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/CHANGELOG.md +15 -1
- package/README.md +51 -22
- package/build/color-ramps/lib/constants.cjs +1 -1
- package/build/color-ramps/lib/constants.cjs.map +1 -1
- package/build/color-ramps/lib/default-ramps.cjs +50 -50
- package/build/color-ramps/lib/default-ramps.cjs.map +1 -1
- package/build/postcss-plugins/add-fallback-to-var.cjs +3 -1
- package/build/postcss-plugins/add-fallback-to-var.cjs.map +2 -2
- package/build/postcss-plugins/ds-token-fallbacks.cjs +3 -1
- package/build/postcss-plugins/ds-token-fallbacks.cjs.map +2 -2
- package/build/prebuilt/js/design-token-fallbacks.cjs +50 -50
- package/build/prebuilt/js/design-token-fallbacks.cjs.map +2 -2
- package/build/prebuilt/js/design-tokens.cjs +17 -17
- package/build/prebuilt/js/design-tokens.cjs.map +1 -1
- package/build/stylelint-plugins/no-unknown-ds-tokens.cjs.map +1 -1
- package/build/use-theme-provider-styles.cjs +7 -7
- package/build/use-theme-provider-styles.cjs.map +1 -1
- package/build-module/color-ramps/lib/constants.mjs +1 -1
- package/build-module/color-ramps/lib/constants.mjs.map +1 -1
- package/build-module/color-ramps/lib/default-ramps.mjs +50 -50
- package/build-module/color-ramps/lib/default-ramps.mjs.map +1 -1
- package/build-module/postcss-plugins/add-fallback-to-var.mjs +3 -1
- package/build-module/postcss-plugins/add-fallback-to-var.mjs.map +2 -2
- package/build-module/postcss-plugins/ds-token-fallbacks.mjs +3 -1
- package/build-module/postcss-plugins/ds-token-fallbacks.mjs.map +2 -2
- package/build-module/prebuilt/js/design-token-fallbacks.mjs +50 -50
- package/build-module/prebuilt/js/design-token-fallbacks.mjs.map +2 -2
- package/build-module/prebuilt/js/design-tokens.mjs +17 -17
- package/build-module/prebuilt/js/design-tokens.mjs.map +1 -1
- package/build-module/stylelint-plugins/no-unknown-ds-tokens.mjs.map +1 -1
- package/build-module/use-theme-provider-styles.mjs +7 -7
- package/build-module/use-theme-provider-styles.mjs.map +1 -1
- package/build-types/color-ramps/test/index.test.d.ts +5 -0
- package/build-types/color-ramps/test/index.test.d.ts.map +1 -0
- package/build-types/postcss-plugins/add-fallback-to-var.d.ts.map +1 -1
- package/build-types/postcss-plugins/ds-token-fallbacks.d.mts.map +1 -1
- package/build-types/postcss-plugins/test/add-fallback-to-var.test.d.ts +2 -0
- package/build-types/postcss-plugins/test/add-fallback-to-var.test.d.ts.map +1 -0
- package/build-types/postcss-plugins/test/ds-token-fallbacks.test.d.ts +2 -0
- package/build-types/postcss-plugins/test/ds-token-fallbacks.test.d.ts.map +1 -0
- package/build-types/prebuilt/js/design-token-fallbacks.d.mts +17 -17
- package/build-types/stylelint-plugins/test/no-setting-wpds-custom-properties.test.d.ts +2 -0
- package/build-types/stylelint-plugins/test/no-setting-wpds-custom-properties.test.d.ts.map +1 -0
- package/build-types/stylelint-plugins/test/no-token-fallback-values.test.d.ts +2 -0
- package/build-types/stylelint-plugins/test/no-token-fallback-values.test.d.ts.map +1 -0
- package/build-types/stylelint-plugins/test/no-unknown-ds-tokens.test.d.ts +2 -0
- package/build-types/stylelint-plugins/test/no-unknown-ds-tokens.test.d.ts.map +1 -0
- package/build-types/stylelint-plugins/test/utils/index.d.ts +8 -0
- package/build-types/stylelint-plugins/test/utils/index.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/color-ramps/lib/constants.ts +1 -1
- package/src/color-ramps/lib/default-ramps.ts +50 -50
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +21 -21
- package/src/postcss-plugins/add-fallback-to-var.ts +5 -1
- package/src/postcss-plugins/ds-token-fallbacks.mjs +5 -1
- package/src/postcss-plugins/test/add-fallback-to-var.test.ts +10 -9
- package/src/postcss-plugins/test/ds-token-fallbacks.test.ts +39 -0
- package/src/prebuilt/css/design-tokens.css +55 -53
- package/src/prebuilt/js/design-token-fallbacks.mjs +51 -50
- package/src/prebuilt/js/design-tokens.mjs +17 -17
- package/src/stylelint-plugins/no-unknown-ds-tokens.mjs +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.11.0 (2026-04-15)
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
- Renamed typography tokens from `--wpds-font-*` to `--wpds-typography-*`. Sub-groups that correspond to CSS `font-*` properties retain the `font-` prefix; `line-height` does not. To migrate:
|
|
10
|
+
- `--wpds-font-family-*`: use `--wpds-typography-font-family-*` instead.
|
|
11
|
+
- `--wpds-font-size-*`: use `--wpds-typography-font-size-*` instead.
|
|
12
|
+
- `--wpds-font-weight-*`: use `--wpds-typography-font-weight-*` instead.
|
|
13
|
+
- `--wpds-font-line-height-*`: use `--wpds-typography-line-height-*` instead.
|
|
14
|
+
|
|
15
|
+
### Enhancements
|
|
16
|
+
|
|
17
|
+
- The design token fallback build plugins (PostCSS, esbuild, Vite) now throw an error when encountering an unknown `--wpds-*` token, instead of silently skipping it.
|
|
18
|
+
|
|
5
19
|
## 0.10.0 (2026-04-01)
|
|
6
20
|
|
|
7
|
-
###
|
|
21
|
+
### Enhancements
|
|
8
22
|
|
|
9
23
|
- Change the default value of `--wpds-cursor-control` from `default` to `pointer` ([#76762](https://github.com/WordPress/gutenberg/pull/76762)).
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -13,6 +13,36 @@ A theming package that's part of the WordPress Design System. It has two parts:
|
|
|
13
13
|
|
|
14
14
|
In the **[Design Tokens Reference](https://github.com/WordPress/gutenberg/blob/trunk/packages/theme/docs/tokens.md)** document there is a complete reference of all available design tokens including colors, spacing, typography, and more.
|
|
15
15
|
|
|
16
|
+
### Using Design Tokens
|
|
17
|
+
|
|
18
|
+
Design tokens are delivered as CSS custom properties (e.g. `var(--wpds-color-fg-content-neutral)`). To use them, a stylesheet defining the token values must be loaded on the page.
|
|
19
|
+
|
|
20
|
+
The [`ThemeProvider`](#theme-provider) component can be used to customize token values like colors and density for a specific part of your application.
|
|
21
|
+
|
|
22
|
+
#### Within WordPress
|
|
23
|
+
|
|
24
|
+
Stylesheets are managed on your behalf in a WordPress context, so you don't need to worry about loading them yourself.
|
|
25
|
+
|
|
26
|
+
#### Outside WordPress
|
|
27
|
+
|
|
28
|
+
Outside of WordPress, you will need to install and load the design tokens stylesheet to support the full range of theming capabilities:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
npm install @wordpress/theme
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import '@wordpress/theme/design-tokens.css';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This stylesheet is universal and does not have a separate RTL version.
|
|
39
|
+
|
|
40
|
+
### Developer Tools
|
|
41
|
+
|
|
42
|
+
For the best development experience, we recommend configuring the [build plugins](#build-plugins) and [Stylelint rules](#stylelint-plugins) provided by this package. The build plugins automatically inject fallback values into `var(--wpds-*)` references so components render correctly even when the tokens stylesheet is not yet loaded, and will raise an error if a reference does not match a known token. The Stylelint rules catch typos, unknown tokens, and other discouraged patterns during development.
|
|
43
|
+
|
|
44
|
+
If you use `@wordpress/build` to build your scripts, the build plugins are already enabled by default.
|
|
45
|
+
|
|
16
46
|
### Architecture
|
|
17
47
|
|
|
18
48
|
Internally, the design system uses a tiered token architecture:
|
|
@@ -52,27 +82,29 @@ Semantic tokens follow a consistent naming pattern:
|
|
|
52
82
|
|
|
53
83
|
**Type** indicates what kind of value it represents, usually mapping to a DTCG token type.
|
|
54
84
|
|
|
55
|
-
| Value
|
|
56
|
-
|
|
|
57
|
-
| `color`
|
|
58
|
-
| `dimension`
|
|
59
|
-
| `border`
|
|
60
|
-
| `elevation`
|
|
61
|
-
| `
|
|
85
|
+
| Value | Description |
|
|
86
|
+
| ------------ | ------------------------------------------------------------------------------ |
|
|
87
|
+
| `color` | Color values for backgrounds, foregrounds, and strokes |
|
|
88
|
+
| `dimension` | Spacing, sizing, and other measurable lengths (e.g., padding, margins, widths) |
|
|
89
|
+
| `border` | Border properties like radius and width |
|
|
90
|
+
| `elevation` | Shadow definitions for layering and depth |
|
|
91
|
+
| `typography` | Typography properties like font family, font size, and line-height |
|
|
62
92
|
|
|
63
93
|
**Property** is the specific design property being defined.
|
|
64
94
|
|
|
65
|
-
| Value
|
|
66
|
-
|
|
|
67
|
-
| `bg`
|
|
68
|
-
| `fg`
|
|
69
|
-
| `stroke`
|
|
70
|
-
| `padding`
|
|
71
|
-
| `gap`
|
|
72
|
-
| `radius`
|
|
73
|
-
| `width`
|
|
74
|
-
| `size`
|
|
75
|
-
| `family`
|
|
95
|
+
| Value | Description |
|
|
96
|
+
| ------------- | ---------------------------------- |
|
|
97
|
+
| `bg` | Background color |
|
|
98
|
+
| `fg` | Foreground color (text and icons) |
|
|
99
|
+
| `stroke` | Border and outline color |
|
|
100
|
+
| `padding` | Internal spacing within an element |
|
|
101
|
+
| `gap` | Spacing between elements |
|
|
102
|
+
| `radius` | Border radius for rounded corners |
|
|
103
|
+
| `width` | Border width |
|
|
104
|
+
| `font-size` | Font size |
|
|
105
|
+
| `font-family` | Font family |
|
|
106
|
+
| `font-weight` | Font weight |
|
|
107
|
+
| `line-height` | Line height |
|
|
76
108
|
|
|
77
109
|
**Target** is the component or element type the token applies to.
|
|
78
110
|
|
|
@@ -136,10 +168,7 @@ import { ThemeProvider } from '@wordpress/theme';
|
|
|
136
168
|
|
|
137
169
|
function App() {
|
|
138
170
|
return (
|
|
139
|
-
<ThemeProvider
|
|
140
|
-
color={ { primary: 'blue' } }
|
|
141
|
-
density="compact"
|
|
142
|
-
>
|
|
171
|
+
<ThemeProvider color={ { primary: 'blue' } } density="compact">
|
|
143
172
|
{ /* Your app content */ }
|
|
144
173
|
</ThemeProvider>
|
|
145
174
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/constants.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { to, OKLCH } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport type { Ramp } from './types';\n\nexport const WHITE = to( 'white', OKLCH );\nexport const BLACK = to( 'black', OKLCH );\n\n// Margin added to target contrasts to counter for algorithm approximations and rounding errors.\n// - the `CONTRAST_EPSILON` value is 0.004, so the real contrast can be lower by this amount.\n// - the max contrast between adjacent RGB values is 1.016, so 0.016 is the maximum total rounding error between two values.\n// - the sum is 0.02: the margin we add to ensure that the target contrast is met after all the rounding.\nexport const UNIVERSAL_CONTRAST_TOPUP = 0.02;\n\n// When enabling \"lighter direction\" bias, this is the amount by which\n// black text contrast needs to be greater than white text contrast.\n// The higher the value, the stronger the preference for white text.\n// The current value has been determined empirically as the highest value\n// that won't cause the algo not to be able to correctly solve all contrasts.\nexport const WHITE_TEXT_CONTRAST_MARGIN = 3.1;\n\n// These values are used as thresholds when trying to match the background\n// ramp's lightness while calculating an accent ramp. They prevent the accent\n// scale from being pinned to lightness values in the middle of the range,\n// which would cause the algorithm to struggle to satisfy the accent scale\n// constraints and therefore produce unexpected results.\nexport const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS = {\n\tlighter: { min: 0.2, max: 0.4 },\n\tdarker: { min: 0.75, max: 0.98 },\n} as const;\n\n// Contrast precision we aim for. Approximately 1/256, resolution of an 8-bit number.\nexport const CONTRAST_EPSILON = 4e-3;\n\nexport const MAX_BISECTION_ITERATIONS = 10;\n\nexport const CONTRAST_COMBINATIONS: {\n\tbgs: ( keyof Ramp )[];\n\tfgs: ( keyof Ramp )[];\n\ttarget: number;\n}[] = [\n\t{\n\t\tbgs: [ 'surface1', 'surface2', 'surface3' ],\n\t\tfgs: [ 'fgSurface3', 'fgSurface4' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'surface4', 'surface5' ],\n\t\tfgs: [ 'fgSurface4' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'bgFill1' ],\n\t\tfgs: [ 'fgFill' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'bgFillInverted1' ],\n\t\tfgs: [ 'fgFillInverted' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'bgFillInverted1' ],\n\t\tfgs: [ 'fgFillInverted' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'surface1', 'surface2', 'surface3' ],\n\t\tfgs: [ 'stroke3' ],\n\t\ttarget: 3,\n\t},\n];\n\n// Used when generating the DTCG tokens and the static color ramps.\nexport const DEFAULT_SEED_COLORS = {\n\tbg: '#
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { to, OKLCH } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport type { Ramp } from './types';\n\nexport const WHITE = to( 'white', OKLCH );\nexport const BLACK = to( 'black', OKLCH );\n\n// Margin added to target contrasts to counter for algorithm approximations and rounding errors.\n// - the `CONTRAST_EPSILON` value is 0.004, so the real contrast can be lower by this amount.\n// - the max contrast between adjacent RGB values is 1.016, so 0.016 is the maximum total rounding error between two values.\n// - the sum is 0.02: the margin we add to ensure that the target contrast is met after all the rounding.\nexport const UNIVERSAL_CONTRAST_TOPUP = 0.02;\n\n// When enabling \"lighter direction\" bias, this is the amount by which\n// black text contrast needs to be greater than white text contrast.\n// The higher the value, the stronger the preference for white text.\n// The current value has been determined empirically as the highest value\n// that won't cause the algo not to be able to correctly solve all contrasts.\nexport const WHITE_TEXT_CONTRAST_MARGIN = 3.1;\n\n// These values are used as thresholds when trying to match the background\n// ramp's lightness while calculating an accent ramp. They prevent the accent\n// scale from being pinned to lightness values in the middle of the range,\n// which would cause the algorithm to struggle to satisfy the accent scale\n// constraints and therefore produce unexpected results.\nexport const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS = {\n\tlighter: { min: 0.2, max: 0.4 },\n\tdarker: { min: 0.75, max: 0.98 },\n} as const;\n\n// Contrast precision we aim for. Approximately 1/256, resolution of an 8-bit number.\nexport const CONTRAST_EPSILON = 4e-3;\n\nexport const MAX_BISECTION_ITERATIONS = 10;\n\nexport const CONTRAST_COMBINATIONS: {\n\tbgs: ( keyof Ramp )[];\n\tfgs: ( keyof Ramp )[];\n\ttarget: number;\n}[] = [\n\t{\n\t\tbgs: [ 'surface1', 'surface2', 'surface3' ],\n\t\tfgs: [ 'fgSurface3', 'fgSurface4' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'surface4', 'surface5' ],\n\t\tfgs: [ 'fgSurface4' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'bgFill1' ],\n\t\tfgs: [ 'fgFill' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'bgFillInverted1' ],\n\t\tfgs: [ 'fgFillInverted' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'bgFillInverted1' ],\n\t\tfgs: [ 'fgFillInverted' ],\n\t\ttarget: 4.5,\n\t},\n\t{\n\t\tbgs: [ 'surface1', 'surface2', 'surface3' ],\n\t\tfgs: [ 'stroke3' ],\n\t\ttarget: 3,\n\t},\n];\n\n// Used when generating the DTCG tokens and the static color ramps.\nexport const DEFAULT_SEED_COLORS = {\n\tbg: '#fcfcfc',\n\tprimary: '#3858e9',\n\tinfo: '#0090ff',\n\tsuccess: '#4ab866',\n\tcaution: '#f0d149',\n\twarning: '#f0b849',\n\terror: '#cc1818',\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA0B;AAK1B,mCAAO;AAGA,IAAM,YAAQ,cAAI,SAAS,eAAM;AACjC,IAAM,YAAQ,cAAI,SAAS,eAAM;AAMjC,IAAM,2BAA2B;AAOjC,IAAM,6BAA6B;AAOnC,IAAM,yCAAyC;AAAA,EACrD,SAAS,EAAE,KAAK,KAAK,KAAK,IAAI;AAAA,EAC9B,QAAQ,EAAE,KAAK,MAAM,KAAK,KAAK;AAChC;AAGO,IAAM,mBAAmB;AAEzB,IAAM,2BAA2B;AAEjC,IAAM,wBAIP;AAAA,EACL;AAAA,IACC,KAAK,CAAE,YAAY,YAAY,UAAW;AAAA,IAC1C,KAAK,CAAE,cAAc,YAAa;AAAA,IAClC,QAAQ;AAAA,EACT;AAAA,EACA;AAAA,IACC,KAAK,CAAE,YAAY,UAAW;AAAA,IAC9B,KAAK,CAAE,YAAa;AAAA,IACpB,QAAQ;AAAA,EACT;AAAA,EACA;AAAA,IACC,KAAK,CAAE,SAAU;AAAA,IACjB,KAAK,CAAE,QAAS;AAAA,IAChB,QAAQ;AAAA,EACT;AAAA,EACA;AAAA,IACC,KAAK,CAAE,iBAAkB;AAAA,IACzB,KAAK,CAAE,gBAAiB;AAAA,IACxB,QAAQ;AAAA,EACT;AAAA,EACA;AAAA,IACC,KAAK,CAAE,iBAAkB;AAAA,IACzB,KAAK,CAAE,gBAAiB;AAAA,IACxB,QAAQ;AAAA,EACT;AAAA,EACA;AAAA,IACC,KAAK,CAAE,YAAY,YAAY,UAAW;AAAA,IAC1C,KAAK,CAAE,SAAU;AAAA,IACjB,QAAQ;AAAA,EACT;AACD;AAGO,IAAM,sBAAsB;AAAA,EAClC,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,28 +25,28 @@ module.exports = __toCommonJS(default_ramps_exports);
|
|
|
25
25
|
var DEFAULT_RAMPS = {
|
|
26
26
|
bg: {
|
|
27
27
|
ramp: {
|
|
28
|
-
surface2: "#
|
|
28
|
+
surface2: "#fcfcfc",
|
|
29
29
|
bgFill1: "#555",
|
|
30
30
|
fgFill: "#f0f0f0",
|
|
31
31
|
bgFill2: "#484848",
|
|
32
|
-
surface6: "#
|
|
33
|
-
surface5: "#
|
|
34
|
-
surface4: "#
|
|
32
|
+
surface6: "#d6d6d6",
|
|
33
|
+
surface5: "#e6e6e6",
|
|
34
|
+
surface4: "#ededed",
|
|
35
35
|
surface3: "#fff",
|
|
36
36
|
fgSurface4: "#1e1e1e",
|
|
37
|
-
fgSurface3: "#
|
|
38
|
-
fgSurface2: "#
|
|
39
|
-
fgSurface1: "#
|
|
40
|
-
stroke3: "#
|
|
41
|
-
stroke4: "#
|
|
42
|
-
stroke2: "#
|
|
43
|
-
stroke1: "#
|
|
37
|
+
fgSurface3: "#707070",
|
|
38
|
+
fgSurface2: "#8d8d8d",
|
|
39
|
+
fgSurface1: "#aeaeae",
|
|
40
|
+
stroke3: "#8d8d8d",
|
|
41
|
+
stroke4: "#6e6e6e",
|
|
42
|
+
stroke2: "#dbdbdb",
|
|
43
|
+
stroke1: "#e4e4e4",
|
|
44
44
|
bgFillDark: "#1e1e1e",
|
|
45
45
|
fgFillDark: "#f0f0f0",
|
|
46
46
|
bgFillInverted2: "#1e1e1e",
|
|
47
47
|
bgFillInverted1: "#2d2d2d",
|
|
48
48
|
fgFillInverted: "#f0f0f0",
|
|
49
|
-
surface1: "#
|
|
49
|
+
surface1: "#f4f4f4"
|
|
50
50
|
},
|
|
51
51
|
direction: "darker"
|
|
52
52
|
},
|
|
@@ -55,15 +55,15 @@ var DEFAULT_RAMPS = {
|
|
|
55
55
|
bgFill1: "#3858e9",
|
|
56
56
|
fgFill: "#eff0f2",
|
|
57
57
|
bgFill2: "#2e49d9",
|
|
58
|
-
surface2: "#
|
|
59
|
-
surface6: "#
|
|
60
|
-
surface5: "#
|
|
58
|
+
surface2: "#f6f8fe",
|
|
59
|
+
surface6: "#c7d2ee",
|
|
60
|
+
surface5: "#dce3f4",
|
|
61
61
|
surface4: "#e6eaf4",
|
|
62
62
|
surface3: "#fff",
|
|
63
63
|
fgSurface4: "#0b0070",
|
|
64
64
|
fgSurface3: "#3858e9",
|
|
65
|
-
fgSurface2: "#
|
|
66
|
-
fgSurface1: "#
|
|
65
|
+
fgSurface2: "#5a82ff",
|
|
66
|
+
fgSurface1: "#86a9ff",
|
|
67
67
|
stroke3: "#3858e9",
|
|
68
68
|
stroke4: "#2337c8",
|
|
69
69
|
stroke2: "#9caacc",
|
|
@@ -73,7 +73,7 @@ var DEFAULT_RAMPS = {
|
|
|
73
73
|
bgFillInverted2: "#1a1e27",
|
|
74
74
|
bgFillInverted1: "#13009f",
|
|
75
75
|
fgFillInverted: "#eff0f2",
|
|
76
|
-
surface1: "#
|
|
76
|
+
surface1: "#ecf0fa"
|
|
77
77
|
},
|
|
78
78
|
direction: "darker"
|
|
79
79
|
},
|
|
@@ -82,15 +82,15 @@ var DEFAULT_RAMPS = {
|
|
|
82
82
|
bgFill1: "#0090ff",
|
|
83
83
|
fgFill: "#1a1f24",
|
|
84
84
|
bgFill2: "#007fed",
|
|
85
|
-
surface2: "#
|
|
85
|
+
surface2: "#f3f9ff",
|
|
86
86
|
surface6: "#bcd5f2",
|
|
87
|
-
surface5: "#
|
|
87
|
+
surface5: "#d4e4f7",
|
|
88
88
|
surface4: "#deebfa",
|
|
89
89
|
surface3: "#fff",
|
|
90
90
|
fgSurface4: "#001b4f",
|
|
91
91
|
fgSurface3: "#006bd7",
|
|
92
92
|
fgSurface2: "#008bfa",
|
|
93
|
-
fgSurface1: "#
|
|
93
|
+
fgSurface1: "#59b0ff",
|
|
94
94
|
stroke3: "#006bd7",
|
|
95
95
|
stroke4: "#004fa9",
|
|
96
96
|
stroke2: "#95b5d9",
|
|
@@ -100,7 +100,7 @@ var DEFAULT_RAMPS = {
|
|
|
100
100
|
bgFillInverted2: "#1a1f24",
|
|
101
101
|
bgFillInverted1: "#002a69",
|
|
102
102
|
fgFillInverted: "#eef0f3",
|
|
103
|
-
surface1: "#
|
|
103
|
+
surface1: "#e5f1ff"
|
|
104
104
|
},
|
|
105
105
|
direction: "darker"
|
|
106
106
|
},
|
|
@@ -109,25 +109,25 @@ var DEFAULT_RAMPS = {
|
|
|
109
109
|
bgFill1: "#4ab866",
|
|
110
110
|
fgFill: "#1b1f1c",
|
|
111
111
|
bgFill2: "#37a756",
|
|
112
|
-
surface2: "#
|
|
112
|
+
surface2: "#ebffed",
|
|
113
113
|
surface6: "#88e89b",
|
|
114
|
-
surface5: "#
|
|
115
|
-
surface4: "#
|
|
114
|
+
surface5: "#b0f3bb",
|
|
115
|
+
surface4: "#c6f7cd",
|
|
116
116
|
surface3: "#fff",
|
|
117
117
|
fgSurface4: "#002900",
|
|
118
|
-
fgSurface3: "#
|
|
119
|
-
fgSurface2: "#
|
|
120
|
-
fgSurface1: "#
|
|
121
|
-
stroke3: "#
|
|
122
|
-
stroke4: "#
|
|
123
|
-
stroke2: "#
|
|
118
|
+
fgSurface3: "#008030",
|
|
119
|
+
fgSurface2: "#2b9f4e",
|
|
120
|
+
fgSurface1: "#54c16e",
|
|
121
|
+
stroke3: "#008030",
|
|
122
|
+
stroke4: "#006113",
|
|
123
|
+
stroke2: "#84c08f",
|
|
124
124
|
stroke1: "#8ac894",
|
|
125
125
|
bgFillDark: "#1b1f1c",
|
|
126
126
|
fgFillDark: "#eaf3eb",
|
|
127
127
|
bgFillInverted2: "#1b1f1c",
|
|
128
128
|
bgFillInverted1: "#003701",
|
|
129
129
|
fgFillInverted: "#eaf3eb",
|
|
130
|
-
surface1: "#
|
|
130
|
+
surface1: "#ccfdd3"
|
|
131
131
|
},
|
|
132
132
|
direction: "darker"
|
|
133
133
|
},
|
|
@@ -136,17 +136,17 @@ var DEFAULT_RAMPS = {
|
|
|
136
136
|
bgFill1: "#f0d149",
|
|
137
137
|
fgFill: "#1f1e1b",
|
|
138
138
|
bgFill2: "#dcbe2f",
|
|
139
|
-
surface2: "#
|
|
140
|
-
surface6: "#
|
|
141
|
-
surface5: "#
|
|
142
|
-
surface4: "#
|
|
139
|
+
surface2: "#fff9ca",
|
|
140
|
+
surface6: "#e9d170",
|
|
141
|
+
surface5: "#f7e28a",
|
|
142
|
+
surface4: "#fee995",
|
|
143
143
|
surface3: "#fff",
|
|
144
144
|
fgSurface4: "#281d00",
|
|
145
145
|
fgSurface3: "#826a00",
|
|
146
|
-
fgSurface2: "#
|
|
146
|
+
fgSurface2: "#a48700",
|
|
147
147
|
fgSurface1: "#c6a800",
|
|
148
148
|
stroke3: "#826a00",
|
|
149
|
-
stroke4: "#
|
|
149
|
+
stroke4: "#634f00",
|
|
150
150
|
stroke2: "#bdb17e",
|
|
151
151
|
stroke1: "#c5b883",
|
|
152
152
|
bgFillDark: "#1f1e1b",
|
|
@@ -154,7 +154,7 @@ var DEFAULT_RAMPS = {
|
|
|
154
154
|
bgFillInverted2: "#1f1e1b",
|
|
155
155
|
bgFillInverted1: "#392c00",
|
|
156
156
|
fgFillInverted: "#fdf1bf",
|
|
157
|
-
surface1: "#
|
|
157
|
+
surface1: "#fff09c"
|
|
158
158
|
},
|
|
159
159
|
direction: "darker"
|
|
160
160
|
},
|
|
@@ -163,25 +163,25 @@ var DEFAULT_RAMPS = {
|
|
|
163
163
|
bgFill1: "#f0b849",
|
|
164
164
|
fgFill: "#1f1e1b",
|
|
165
165
|
bgFill2: "#dda633",
|
|
166
|
-
surface2: "#
|
|
167
|
-
surface6: "#
|
|
168
|
-
surface5: "#
|
|
169
|
-
surface4: "#
|
|
166
|
+
surface2: "#fff7e1",
|
|
167
|
+
surface6: "#f4cc85",
|
|
168
|
+
surface5: "#fadead",
|
|
169
|
+
surface4: "#fde6be",
|
|
170
170
|
surface3: "#fff",
|
|
171
171
|
fgSurface4: "#2e1900",
|
|
172
172
|
fgSurface3: "#926300",
|
|
173
|
-
fgSurface2: "#
|
|
174
|
-
fgSurface1: "#
|
|
173
|
+
fgSurface2: "#b57f00",
|
|
174
|
+
fgSurface1: "#d7a02b",
|
|
175
175
|
stroke3: "#926300",
|
|
176
176
|
stroke4: "#6f4900",
|
|
177
177
|
stroke2: "#c7ad7e",
|
|
178
|
-
stroke1: "#
|
|
178
|
+
stroke1: "#d0b481",
|
|
179
179
|
bgFillDark: "#1f1e1b",
|
|
180
180
|
fgFillDark: "#f7efe2",
|
|
181
181
|
bgFillInverted2: "#1f1e1b",
|
|
182
182
|
bgFillInverted1: "#422800",
|
|
183
183
|
fgFillInverted: "#f7efe2",
|
|
184
|
-
surface1: "#
|
|
184
|
+
surface1: "#ffedc5"
|
|
185
185
|
},
|
|
186
186
|
direction: "darker"
|
|
187
187
|
},
|
|
@@ -190,9 +190,9 @@ var DEFAULT_RAMPS = {
|
|
|
190
190
|
bgFill1: "#cc1818",
|
|
191
191
|
fgFill: "#f2efef",
|
|
192
192
|
bgFill2: "#b90000",
|
|
193
|
-
surface2: "#
|
|
194
|
-
surface6: "#
|
|
195
|
-
surface5: "#
|
|
193
|
+
surface2: "#fff6f5",
|
|
194
|
+
surface6: "#f3c9c2",
|
|
195
|
+
surface5: "#f7dbd7",
|
|
196
196
|
surface4: "#f6e6e3",
|
|
197
197
|
surface3: "#fff",
|
|
198
198
|
fgSurface4: "#470000",
|
|
@@ -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: '#
|
|
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: '#fcfcfc',\n\t\t\tbgFill1: '#555',\n\t\t\tfgFill: '#f0f0f0',\n\t\t\tbgFill2: '#484848',\n\t\t\tsurface6: '#d6d6d6',\n\t\t\tsurface5: '#e6e6e6',\n\t\t\tsurface4: '#ededed',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#1e1e1e',\n\t\t\tfgSurface3: '#707070',\n\t\t\tfgSurface2: '#8d8d8d',\n\t\t\tfgSurface1: '#aeaeae',\n\t\t\tstroke3: '#8d8d8d',\n\t\t\tstroke4: '#6e6e6e',\n\t\t\tstroke2: '#dbdbdb',\n\t\t\tstroke1: '#e4e4e4',\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: '#f4f4f4',\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: '#f6f8fe',\n\t\t\tsurface6: '#c7d2ee',\n\t\t\tsurface5: '#dce3f4',\n\t\t\tsurface4: '#e6eaf4',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#0b0070',\n\t\t\tfgSurface3: '#3858e9',\n\t\t\tfgSurface2: '#5a82ff',\n\t\t\tfgSurface1: '#86a9ff',\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: '#ecf0fa',\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: '#bcd5f2',\n\t\t\tsurface5: '#d4e4f7',\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: '#59b0ff',\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: '#e5f1ff',\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: '#ebffed',\n\t\t\tsurface6: '#88e89b',\n\t\t\tsurface5: '#b0f3bb',\n\t\t\tsurface4: '#c6f7cd',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#002900',\n\t\t\tfgSurface3: '#008030',\n\t\t\tfgSurface2: '#2b9f4e',\n\t\t\tfgSurface1: '#54c16e',\n\t\t\tstroke3: '#008030',\n\t\t\tstroke4: '#006113',\n\t\t\tstroke2: '#84c08f',\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: '#ccfdd3',\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: '#fff9ca',\n\t\t\tsurface6: '#e9d170',\n\t\t\tsurface5: '#f7e28a',\n\t\t\tsurface4: '#fee995',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#281d00',\n\t\t\tfgSurface3: '#826a00',\n\t\t\tfgSurface2: '#a48700',\n\t\t\tfgSurface1: '#c6a800',\n\t\t\tstroke3: '#826a00',\n\t\t\tstroke4: '#634f00',\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: '#fff09c',\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: '#fff7e1',\n\t\t\tsurface6: '#f4cc85',\n\t\t\tsurface5: '#fadead',\n\t\t\tsurface4: '#fde6be',\n\t\t\tsurface3: '#fff',\n\t\t\tfgSurface4: '#2e1900',\n\t\t\tfgSurface3: '#926300',\n\t\t\tfgSurface2: '#b57f00',\n\t\t\tfgSurface1: '#d7a02b',\n\t\t\tstroke3: '#926300',\n\t\t\tstroke4: '#6f4900',\n\t\t\tstroke2: '#c7ad7e',\n\t\t\tstroke1: '#d0b481',\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: '#ffedc5',\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: '#fff6f5',\n\t\t\tsurface6: '#f3c9c2',\n\t\t\tsurface5: '#f7dbd7',\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": ";;;;;;;;;;;;;;;;;;;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,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,MAAM;AAAA,IACL,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;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,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,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,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,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
|
}
|
|
@@ -28,7 +28,9 @@ function addFallbackToVar(cssValue, tokenFallbacks, { escapeQuotes = false } = {
|
|
|
28
28
|
(match, tokenName) => {
|
|
29
29
|
let fallback = tokenFallbacks[tokenName];
|
|
30
30
|
if (fallback === void 0) {
|
|
31
|
-
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Unknown design token: ${tokenName}. This token is not in the design system. If this token was recently renamed, update all references to use the new name.`
|
|
33
|
+
);
|
|
32
34
|
}
|
|
33
35
|
if (escapeQuotes) {
|
|
34
36
|
fallback = fallback.replaceAll('"', '\\"').replaceAll("'", "\\'");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/postcss-plugins/add-fallback-to-var.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the provided token fallback map.\n *\n * Existing fallbacks (i.e. `var()` calls that already contain a comma)\n * are left untouched, making the function safe to run multiple times\n * (idempotent).\n *\n * NOTE: The regex and replacement logic here is mirrored in\n * `ds-token-fallbacks.mjs`. If you update one, update the other to match.\n *\n * @param cssValue A CSS declaration value.\n * @param tokenFallbacks Map of CSS variable names to their fallback expressions.\n * @param options Options.\n * @param options.escapeQuotes When true, escape `\"` and `'` in fallback values.\n * Use this when the input is JS/TS source so that\n * injected quotes don't break string literals.\n * @return The value with fallbacks injected.\n */\nexport function addFallbackToVar(\n\tcssValue: string,\n\ttokenFallbacks: Record< string, string >,\n\t{ escapeQuotes = false }: { escapeQuotes?: boolean } = {}\n): string {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName: string ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,iBACf,UACA,gBACA,EAAE,eAAe,MAAM,IAAgC,CAAC,GAC/C;AACT,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAuB;AAC/B,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,
|
|
4
|
+
"sourcesContent": ["/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the provided token fallback map.\n *\n * Existing fallbacks (i.e. `var()` calls that already contain a comma)\n * are left untouched, making the function safe to run multiple times\n * (idempotent).\n *\n * NOTE: The regex and replacement logic here is mirrored in\n * `ds-token-fallbacks.mjs`. If you update one, update the other to match.\n *\n * @param cssValue A CSS declaration value.\n * @param tokenFallbacks Map of CSS variable names to their fallback expressions.\n * @param options Options.\n * @param options.escapeQuotes When true, escape `\"` and `'` in fallback values.\n * Use this when the input is JS/TS source so that\n * injected quotes don't break string literals.\n * @return The value with fallbacks injected.\n */\nexport function addFallbackToVar(\n\tcssValue: string,\n\ttokenFallbacks: Record< string, string >,\n\t{ escapeQuotes = false }: { escapeQuotes?: boolean } = {}\n): string {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName: string ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unknown design token: ${ tokenName }. ` +\n\t\t\t\t\t\t'This token is not in the design system. ' +\n\t\t\t\t\t\t'If this token was recently renamed, update all references to use the new name.'\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( escapeQuotes ) {\n\t\t\t\tfallback = fallback\n\t\t\t\t\t.replaceAll( '\"', '\\\\\"' )\n\t\t\t\t\t.replaceAll( \"'\", \"\\\\'\" );\n\t\t\t}\n\t\t\treturn `var(${ tokenName }, ${ fallback })`;\n\t\t}\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,iBACf,UACA,gBACA,EAAE,eAAe,MAAM,IAAgC,CAAC,GAC/C;AACT,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAuB;AAC/B,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,cAAM,IAAI;AAAA,UACT,yBAA0B,SAAU;AAAA,QAGrC;AAAA,MACD;AACA,UAAK,cAAe;AACnB,mBAAW,SACT,WAAY,KAAK,KAAM,EACvB,WAAY,KAAK,KAAM;AAAA,MAC1B;AACA,aAAO,OAAQ,SAAU,KAAM,QAAS;AAAA,IACzC;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -40,7 +40,9 @@ function addFallbackToVar(cssValue, { escapeQuotes = false } = {}) {
|
|
|
40
40
|
(match, tokenName) => {
|
|
41
41
|
let fallback = tokenFallbacks[tokenName];
|
|
42
42
|
if (fallback === void 0) {
|
|
43
|
-
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Unknown design token: ${tokenName}. This token is not in the design system. If this token was recently renamed, update all references to use the new name.`
|
|
45
|
+
);
|
|
44
46
|
}
|
|
45
47
|
if (escapeQuotes) {
|
|
46
48
|
fallback = fallback.replaceAll('"', '\\"').replaceAll("'", "\\'");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/postcss-plugins/ds-token-fallbacks.mjs"],
|
|
4
|
-
"sourcesContent": ["import _tokenFallbacks from '../prebuilt/js/design-token-fallbacks.mjs';\n\n/** @type {Record<string, string>} */\nconst tokenFallbacks = _tokenFallbacks;\n\n/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the generated token fallback map.\n *\n * Existing fallbacks (i.e. var() calls that already contain a comma) are\n * left untouched, making the function safe to run multiple times.\n *\n * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.\n * If you update one, update the other to match.\n *\n * @param {string} cssValue A CSS declaration value.\n * @param {Object} [options] Options.\n * @param {boolean} [options.escapeQuotes] When true, escape `\"` and `'` in\n * fallback values. Use this when the\n * input is JS/TS source so that\n * injected quotes don't break string\n * literals. JS will unescape them at\n * parse time, so the browser's CSS\n * engine still sees the correct value.\n * @return {string} The value with fallbacks injected.\n */\nexport function addFallbackToVar( cssValue, { escapeQuotes = false } = {} ) {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA4B;AAG5B,IAAM,iBAAiB,8BAAAA;AAuBhB,SAAS,iBAAkB,UAAU,EAAE,eAAe,MAAM,IAAI,CAAC,GAAI;AAC3E,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAe;AACvB,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,
|
|
4
|
+
"sourcesContent": ["import _tokenFallbacks from '../prebuilt/js/design-token-fallbacks.mjs';\n\n/** @type {Record<string, string>} */\nconst tokenFallbacks = _tokenFallbacks;\n\n/**\n * Replace bare `var(--wpds-*)` references in a CSS value string with\n * `var(--wpds-*, <fallback>)` using the generated token fallback map.\n *\n * Existing fallbacks (i.e. var() calls that already contain a comma) are\n * left untouched, making the function safe to run multiple times.\n *\n * NOTE: The regex and replacement logic here mirrors `add-fallback-to-var.ts`.\n * If you update one, update the other to match.\n *\n * @param {string} cssValue A CSS declaration value.\n * @param {Object} [options] Options.\n * @param {boolean} [options.escapeQuotes] When true, escape `\"` and `'` in\n * fallback values. Use this when the\n * input is JS/TS source so that\n * injected quotes don't break string\n * literals. JS will unescape them at\n * parse time, so the browser's CSS\n * engine still sees the correct value.\n * @return {string} The value with fallbacks injected.\n */\nexport function addFallbackToVar( cssValue, { escapeQuotes = false } = {} ) {\n\treturn cssValue.replace(\n\t\t/var\\(\\s*(--wpds-[\\w-]+)\\s*\\)/g,\n\t\t( match, tokenName ) => {\n\t\t\tlet fallback = tokenFallbacks[ tokenName ];\n\t\t\tif ( fallback === undefined ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unknown design token: ${ tokenName }. ` +\n\t\t\t\t\t\t'This token is not in the design system. ' +\n\t\t\t\t\t\t'If this token was recently renamed, update all references to use the new name.'\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( escapeQuotes ) {\n\t\t\t\tfallback = fallback\n\t\t\t\t\t.replaceAll( '\"', '\\\\\"' )\n\t\t\t\t\t.replaceAll( \"'\", \"\\\\'\" );\n\t\t\t}\n\t\t\treturn `var(${ tokenName }, ${ fallback })`;\n\t\t}\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA4B;AAG5B,IAAM,iBAAiB,8BAAAA;AAuBhB,SAAS,iBAAkB,UAAU,EAAE,eAAe,MAAM,IAAI,CAAC,GAAI;AAC3E,SAAO,SAAS;AAAA,IACf;AAAA,IACA,CAAE,OAAO,cAAe;AACvB,UAAI,WAAW,eAAgB,SAAU;AACzC,UAAK,aAAa,QAAY;AAC7B,cAAM,IAAI;AAAA,UACT,yBAA0B,SAAU;AAAA,QAGrC;AAAA,MACD;AACA,UAAK,cAAe;AACnB,mBAAW,SACT,WAAY,KAAK,KAAM,EACvB,WAAY,KAAK,KAAM;AAAA,MAC1B;AACA,aAAO,OAAQ,SAAU,KAAM,QAAS;AAAA,IACzC;AAAA,EACD;AACD;",
|
|
6
6
|
"names": ["_tokenFallbacks"]
|
|
7
7
|
}
|