@wordpress/theme 0.5.1-next.ba3aee3a2.0 → 0.6.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 +41 -1
- package/README.md +18 -18
- package/build/color-ramps/lib/color-utils.cjs +2 -1
- package/build/color-ramps/lib/color-utils.cjs.map +2 -2
- package/build/color-ramps/lib/default-ramps.cjs +2 -2
- package/build/color-ramps/lib/default-ramps.cjs.map +1 -1
- package/build/prebuilt/js/design-tokens.cjs +10 -25
- package/build/prebuilt/js/design-tokens.cjs.map +2 -2
- package/build/prebuilt/ts/color-tokens.cjs +4 -24
- package/build/prebuilt/ts/color-tokens.cjs.map +2 -2
- package/build/prebuilt/ts/token-types.cjs.map +1 -1
- package/build/theme-provider.cjs +6 -7
- package/build/theme-provider.cjs.map +2 -2
- package/build/use-theme-provider-styles.cjs +4 -12
- package/build/use-theme-provider-styles.cjs.map +2 -2
- package/build-module/color-ramps/lib/color-utils.mjs +2 -1
- package/build-module/color-ramps/lib/color-utils.mjs.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.mjs +2 -2
- package/build-module/color-ramps/lib/default-ramps.mjs.map +1 -1
- package/build-module/prebuilt/js/design-tokens.mjs +10 -25
- package/build-module/prebuilt/js/design-tokens.mjs.map +2 -2
- package/build-module/prebuilt/ts/color-tokens.mjs +4 -24
- package/build-module/prebuilt/ts/color-tokens.mjs.map +2 -2
- package/build-module/theme-provider.mjs +6 -7
- package/build-module/theme-provider.mjs.map +2 -2
- package/build-module/use-theme-provider-styles.mjs +4 -13
- package/build-module/use-theme-provider-styles.mjs.map +2 -2
- package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -1
- package/build-types/prebuilt/ts/token-types.d.ts +3 -3
- package/build-types/prebuilt/ts/token-types.d.ts.map +1 -1
- package/build-types/stories/index.story.d.ts +1 -1
- package/build-types/stories/index.story.d.ts.map +1 -1
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/color-ramps/lib/color-utils.ts +2 -1
- package/src/color-ramps/lib/default-ramps.ts +2 -2
- package/src/color-ramps/stories/index.story.tsx +2 -2
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +86 -86
- package/src/color-ramps/test/index.test.ts +8 -24
- package/src/prebuilt/css/design-tokens.css +18 -33
- package/src/prebuilt/js/design-tokens.mjs +10 -25
- package/src/prebuilt/ts/color-tokens.ts +4 -24
- package/src/prebuilt/ts/token-types.ts +2 -8
- package/src/stories/index.story.tsx +4 -4
- package/src/stories/introduction.mdx +6 -0
- package/src/style.scss +6 -0
- package/src/stylelint-plugins/test/fixtures/no-unknown-ds-tokens-valid.css +1 -1
- package/src/use-theme-provider-styles.ts +4 -13
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { serialize } from 'colorjs.io/fn';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
4
|
import '../lib/register-color-spaces';
|
|
10
5
|
import { buildRamp } from '../lib';
|
|
6
|
+
import { getColorString } from '../lib/color-utils';
|
|
11
7
|
import { BG_RAMP_CONFIG, ACCENT_RAMP_CONFIG } from '../lib/ramp-configs';
|
|
12
8
|
import { DEFAULT_SEED_COLORS } from '../lib/constants';
|
|
13
9
|
|
|
14
10
|
const lStops = [ 100, 90, 80, 70, 60, 50, 40, 30, 20, 10 ];
|
|
15
11
|
const sStops = [ 100, 80, 60, 40, 20, 0 ];
|
|
16
|
-
const
|
|
12
|
+
const hStops = [ 0, 60, 120, 180, 240, 300 ];
|
|
17
13
|
|
|
18
|
-
describe
|
|
14
|
+
describe( 'buildRamps', () => {
|
|
19
15
|
it( 'background ramp snapshots', () => {
|
|
20
16
|
const allBgColors = lStops.flatMap( ( l ) =>
|
|
21
17
|
sStops.flatMap( ( s ) =>
|
|
22
|
-
|
|
18
|
+
hStops.map( ( h ) => `hsl(${ h }deg ${ s }% ${ l }%)` )
|
|
23
19
|
)
|
|
24
20
|
);
|
|
25
21
|
|
|
26
22
|
expect(
|
|
27
23
|
allBgColors.map( ( bg ) => {
|
|
28
24
|
const ramp = buildRamp( bg, BG_RAMP_CONFIG );
|
|
29
|
-
const seedOriginal =
|
|
30
|
-
|
|
31
|
-
inGamut: true,
|
|
32
|
-
} );
|
|
33
|
-
const seedComputed = serialize( ramp.ramp.surface2, {
|
|
34
|
-
format: 'hex',
|
|
35
|
-
inGamut: true,
|
|
36
|
-
} );
|
|
25
|
+
const seedOriginal = getColorString( bg );
|
|
26
|
+
const seedComputed = getColorString( ramp.ramp.surface2 );
|
|
37
27
|
|
|
38
28
|
return {
|
|
39
29
|
input: {
|
|
@@ -99,14 +89,8 @@ describe.skip( 'buildRamps', () => {
|
|
|
99
89
|
allPrimaryColors.map( ( primary ) =>
|
|
100
90
|
options.map( ( o ) => {
|
|
101
91
|
const ramp = buildRamp( primary, ACCENT_RAMP_CONFIG, o );
|
|
102
|
-
const seedOriginal =
|
|
103
|
-
|
|
104
|
-
inGamut: true,
|
|
105
|
-
} );
|
|
106
|
-
const seedComputed = serialize( ramp.ramp.bgFill1, {
|
|
107
|
-
format: 'hex',
|
|
108
|
-
inGamut: true,
|
|
109
|
-
} );
|
|
92
|
+
const seedOriginal = getColorString( primary );
|
|
93
|
+
const seedComputed = getColorString( ramp.ramp.bgFill1 );
|
|
110
94
|
|
|
111
95
|
return {
|
|
112
96
|
input: {
|
|
@@ -3,49 +3,38 @@
|
|
|
3
3
|
* ------------------------------------------- */
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
|
-
--wpds-border-radius-
|
|
7
|
-
--wpds-border-radius-
|
|
8
|
-
--wpds-border-radius-
|
|
9
|
-
--wpds-border-radius-
|
|
10
|
-
--wpds-border-width-
|
|
11
|
-
--wpds-border-width-
|
|
12
|
-
--wpds-border-width-
|
|
13
|
-
--wpds-border-width-
|
|
14
|
-
--wpds-border-width-
|
|
15
|
-
--wpds-color-bg-interactive-brand: #00000000; /* Background color for interactive elements with brand tone and normal emphasis. */
|
|
16
|
-
--wpds-color-bg-interactive-brand-active: #f6f8fd; /* Background color for interactive elements with brand tone and normal emphasis that are hovered, focused, or active. */
|
|
17
|
-
--wpds-color-bg-interactive-brand-disabled: #e2e2e2; /* Background color for interactive elements with brand tone and normal emphasis, in their disabled state. */
|
|
6
|
+
--wpds-border-radius-lg: 8px; /* Large radius */
|
|
7
|
+
--wpds-border-radius-md: 4px; /* Medium radius */
|
|
8
|
+
--wpds-border-radius-sm: 2px; /* Small radius */
|
|
9
|
+
--wpds-border-radius-xs: 1px; /* Extra small radius */
|
|
10
|
+
--wpds-border-width-focus: 2px; /* Border width for focus ring */
|
|
11
|
+
--wpds-border-width-lg: 8px; /* Large width */
|
|
12
|
+
--wpds-border-width-md: 4px; /* Medium width */
|
|
13
|
+
--wpds-border-width-sm: 2px; /* Small width */
|
|
14
|
+
--wpds-border-width-xs: 1px; /* Extra small width */
|
|
18
15
|
--wpds-color-bg-interactive-brand-strong: #3858e9; /* Background color for interactive elements with brand tone and strong emphasis. */
|
|
19
16
|
--wpds-color-bg-interactive-brand-strong-active: #2e49d9; /* Background color for interactive elements with brand tone and strong emphasis that are hovered, focused, or active. */
|
|
20
|
-
--wpds-color-bg-interactive-brand-strong-disabled: #d2d2d2; /* Background color for interactive elements with brand tone and strong emphasis, in their disabled state. */
|
|
21
17
|
--wpds-color-bg-interactive-brand-weak: #00000000; /* Background color for interactive elements with brand tone and weak emphasis. */
|
|
22
18
|
--wpds-color-bg-interactive-brand-weak-active: #e6eaf4; /* Background color for interactive elements with brand tone and weak emphasis that are hovered, focused, or active. */
|
|
23
|
-
--wpds-color-bg-interactive-brand-weak-disabled: #e2e2e2; /* Background color for interactive elements with brand tone and weak emphasis, in their disabled state. */
|
|
24
19
|
--wpds-color-bg-interactive-error: #00000000; /* Background color for interactive elements with error tone and normal emphasis. */
|
|
25
20
|
--wpds-color-bg-interactive-error-active: #fff6f4; /* Background color for interactive elements with error tone and normal emphasis that are hovered, focused, or active. */
|
|
26
|
-
--wpds-color-bg-interactive-error-disabled: #e2e2e2; /* Background color for interactive elements with error tone and normal emphasis, in their disabled state. */
|
|
27
21
|
--wpds-color-bg-interactive-error-strong: #cc1818; /* Background color for interactive elements with error tone and strong emphasis. */
|
|
28
22
|
--wpds-color-bg-interactive-error-strong-active: #b90000; /* Background color for interactive elements with error tone and strong emphasis that are hovered, focused, or active. */
|
|
29
|
-
--wpds-color-bg-interactive-error-strong-disabled: #d2d2d2; /* Background color for interactive elements with error tone and strong emphasis, in their disabled state. */
|
|
30
23
|
--wpds-color-bg-interactive-error-weak: #00000000; /* Background color for interactive elements with error tone and weak emphasis. */
|
|
31
24
|
--wpds-color-bg-interactive-error-weak-active: #f6e6e3; /* Background color for interactive elements with error tone and weak emphasis that are hovered, focused, or active. */
|
|
32
|
-
--wpds-color-bg-interactive-error-weak-disabled: #e2e2e2; /* Background color for interactive elements with error tone and weak emphasis, in their disabled state. */
|
|
33
|
-
--wpds-color-bg-interactive-neutral: #00000000; /* Background color for interactive elements with neutral tone and normal emphasis. */
|
|
34
|
-
--wpds-color-bg-interactive-neutral-active: #eaeaea; /* Background color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. */
|
|
35
|
-
--wpds-color-bg-interactive-neutral-disabled: #e2e2e2; /* Background color for interactive elements with neutral tone and normal emphasis, in their disabled state. */
|
|
36
25
|
--wpds-color-bg-interactive-neutral-strong: #2d2d2d; /* Background color for interactive elements with neutral tone and strong emphasis. */
|
|
37
26
|
--wpds-color-bg-interactive-neutral-strong-active: #1e1e1e; /* Background color for interactive elements with neutral tone and strong emphasis that are hovered, focused, or active. */
|
|
38
|
-
--wpds-color-bg-interactive-neutral-strong-disabled: #
|
|
27
|
+
--wpds-color-bg-interactive-neutral-strong-disabled: #e2e2e2; /* Background color for interactive elements with neutral tone and strong emphasis, in their disabled state. */
|
|
39
28
|
--wpds-color-bg-interactive-neutral-weak: #00000000; /* Background color for interactive elements with neutral tone and weak emphasis. */
|
|
40
29
|
--wpds-color-bg-interactive-neutral-weak-active: #eaeaea; /* Background color for interactive elements with neutral tone and weak emphasis that are hovered, focused, or active. */
|
|
41
|
-
--wpds-color-bg-interactive-neutral-weak-disabled: #
|
|
30
|
+
--wpds-color-bg-interactive-neutral-weak-disabled: #00000000; /* Background color for interactive elements with weak emphasis, in their disabled state, regardless of the tone. */
|
|
42
31
|
--wpds-color-bg-surface-brand: #ecf0f9; /* Background color for surfaces with brand tone and normal emphasis. */
|
|
43
32
|
--wpds-color-bg-surface-caution: #fee994; /* Background color for surfaces with caution tone and normal emphasis. */
|
|
44
33
|
--wpds-color-bg-surface-caution-weak: #fff9c9; /* Background color for surfaces with caution tone and weak emphasis. */
|
|
45
34
|
--wpds-color-bg-surface-error: #f6e6e3; /* Background color for surfaces with error tone and normal emphasis. */
|
|
46
35
|
--wpds-color-bg-surface-error-weak: #fff6f4; /* Background color for surfaces with error tone and weak emphasis. */
|
|
47
36
|
--wpds-color-bg-surface-info: #deebfa; /* Background color for surfaces with info tone and normal emphasis. */
|
|
48
|
-
--wpds-color-bg-surface-info-weak: #
|
|
37
|
+
--wpds-color-bg-surface-info-weak: #f2f9ff; /* Background color for surfaces with info tone and weak emphasis. */
|
|
49
38
|
--wpds-color-bg-surface-neutral: #f8f8f8; /* Background color for surfaces with normal emphasis. */
|
|
50
39
|
--wpds-color-bg-surface-neutral-strong: #ffffff; /* Background color for surfaces with strong emphasis. */
|
|
51
40
|
--wpds-color-bg-surface-neutral-weak: #f0f0f0; /* Background color for surfaces with weak emphasis. */
|
|
@@ -55,7 +44,7 @@
|
|
|
55
44
|
--wpds-color-bg-surface-warning-weak: #fff7e0; /* Background color for surfaces with warning tone and weak emphasis. */
|
|
56
45
|
--wpds-color-bg-thumb-brand: #3858e9; /* Background color for thumbs with a brand tone and normal emphasis (eg. slider thumb and filled track). */
|
|
57
46
|
--wpds-color-bg-thumb-brand-active: #3858e9; /* Background color for thumbs with a brand tone and normal emphasis (eg. slider thumb and filled track) that are hovered, focused, or active. */
|
|
58
|
-
--wpds-color-bg-thumb-
|
|
47
|
+
--wpds-color-bg-thumb-neutral-disabled: #d8d8d8; /* Background color for thumbs with normal emphasis (eg. slider thumb and filled track), in their disabled state, regardless of the tone. */
|
|
59
48
|
--wpds-color-bg-thumb-neutral-weak: #8a8a8a; /* Background color for thumbs with a neutral tone and weak emphasis (eg. scrollbar thumb). */
|
|
60
49
|
--wpds-color-bg-thumb-neutral-weak-active: #6c6c6c; /* Background color for thumbs with a neutral tone and weak emphasis (eg. scrollbar thumb) that are hovered, focused, or active. */
|
|
61
50
|
--wpds-color-bg-track-neutral: #d8d8d8; /* Background color for tracks with a neutral tone and normal emphasis (eg. slider or progressbar track). */
|
|
@@ -74,24 +63,20 @@
|
|
|
74
63
|
--wpds-color-fg-content-warning-weak: #926300; /* Foreground color for content like text with warning tone and weak emphasis. */
|
|
75
64
|
--wpds-color-fg-interactive-brand: #3858e9; /* Foreground color for interactive elements with brand tone and normal emphasis. */
|
|
76
65
|
--wpds-color-fg-interactive-brand-active: #3858e9; /* Foreground color for interactive elements with brand tone and normal emphasis that are hovered, focused, or active. */
|
|
77
|
-
--wpds-color-fg-interactive-brand-disabled: #8a8a8a; /* Foreground color for interactive elements with brand tone and normal emphasis, in their disabled state. */
|
|
78
66
|
--wpds-color-fg-interactive-brand-strong: #eff0f2; /* Foreground color for interactive elements with brand tone and strong emphasis. */
|
|
79
67
|
--wpds-color-fg-interactive-brand-strong-active: #eff0f2; /* Foreground color for interactive elements with brand tone and strong emphasis that are hovered, focused, or active. */
|
|
80
|
-
--wpds-color-fg-interactive-brand-strong-disabled: #6d6d6d; /* Foreground color for interactive elements with brand tone and strong emphasis, in their disabled state. */
|
|
81
68
|
--wpds-color-fg-interactive-error: #cc1818; /* Foreground color for interactive elements with error tone and normal emphasis. */
|
|
82
69
|
--wpds-color-fg-interactive-error-active: #cc1818; /* Foreground color for interactive elements with error tone and normal emphasis that are hovered, focused, or active. */
|
|
83
|
-
--wpds-color-fg-interactive-error-disabled: #8a8a8a; /* Foreground color for interactive elements with error tone and normal emphasis, in their disabled state. */
|
|
84
70
|
--wpds-color-fg-interactive-error-strong: #f2efef; /* Foreground color for interactive elements with error tone and strong emphasis. */
|
|
85
71
|
--wpds-color-fg-interactive-error-strong-active: #f2efef; /* Foreground color for interactive elements with error tone and strong emphasis that are hovered, focused, or active. */
|
|
86
|
-
--wpds-color-fg-interactive-error-strong-disabled: #6d6d6d; /* Foreground color for interactive elements with error tone and strong emphasis, in their disabled state. */
|
|
87
72
|
--wpds-color-fg-interactive-neutral: #1e1e1e; /* Foreground color for interactive elements with neutral tone and normal emphasis. */
|
|
88
73
|
--wpds-color-fg-interactive-neutral-active: #1e1e1e; /* Foreground color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. */
|
|
89
|
-
--wpds-color-fg-interactive-neutral-disabled: #8a8a8a; /* Foreground color for interactive elements with
|
|
74
|
+
--wpds-color-fg-interactive-neutral-disabled: #8a8a8a; /* Foreground color for interactive elements with normal emphasis, in their disabled state, regardless of the tone. */
|
|
90
75
|
--wpds-color-fg-interactive-neutral-strong: #f0f0f0; /* Foreground color for interactive elements with neutral tone and strong emphasis. */
|
|
91
76
|
--wpds-color-fg-interactive-neutral-strong-active: #f0f0f0; /* Foreground color for interactive elements with neutral tone and strong emphasis that are hovered, focused, or active. */
|
|
92
|
-
--wpds-color-fg-interactive-neutral-strong-disabled: #
|
|
77
|
+
--wpds-color-fg-interactive-neutral-strong-disabled: #8a8a8a; /* Foreground color for interactive elements with strong emphasis, in their disabled state, regardless of the tone. */
|
|
93
78
|
--wpds-color-fg-interactive-neutral-weak: #6d6d6d; /* Foreground color for interactive elements with neutral tone and weak emphasis. */
|
|
94
|
-
--wpds-color-fg-interactive-neutral-weak-disabled: #8a8a8a; /* Foreground color for interactive elements with
|
|
79
|
+
--wpds-color-fg-interactive-neutral-weak-disabled: #8a8a8a; /* Foreground color for interactive elements with weak emphasis, in their disabled state, regardless of the tone. */
|
|
95
80
|
--wpds-color-stroke-focus-brand: #3858e9; /* Accessible stroke color applied to focus rings. */
|
|
96
81
|
--wpds-color-stroke-interactive-brand: #3858e9; /* Accessible stroke color used for interactive brand-toned elements with normal emphasis. */
|
|
97
82
|
--wpds-color-stroke-interactive-brand-active: #2337c8; /* Accessible stroke color used for interactive brand-toned elements with normal emphasis that are hovered, focused, or active. */
|
|
@@ -100,7 +85,7 @@
|
|
|
100
85
|
--wpds-color-stroke-interactive-error-strong: #cc1818; /* Accessible stroke color used for interactive error-toned elements with strong emphasis. */
|
|
101
86
|
--wpds-color-stroke-interactive-neutral: #8a8a8a; /* Accessible stroke color used for interactive neutrally-toned elements with normal emphasis. */
|
|
102
87
|
--wpds-color-stroke-interactive-neutral-active: #6c6c6c; /* Accessible stroke color used for interactive neutrally-toned elements with normal emphasis that are hovered, focused, or active. */
|
|
103
|
-
--wpds-color-stroke-interactive-neutral-disabled: #d8d8d8; /* Accessible stroke color used for interactive
|
|
88
|
+
--wpds-color-stroke-interactive-neutral-disabled: #d8d8d8; /* Accessible stroke color used for interactive elements with normal emphasis, in their disabled state, regardless of the tone. */
|
|
104
89
|
--wpds-color-stroke-interactive-neutral-strong: #6c6c6c; /* Accessible stroke color used for interactive neutrally-toned elements with strong emphasis. */
|
|
105
90
|
--wpds-color-stroke-surface-brand: #a3b1d4; /* Decorative stroke color used to define brand-toned surface boundaries with normal emphasis. */
|
|
106
91
|
--wpds-color-stroke-surface-brand-strong: #3858e9; /* Decorative stroke color used to define brand-toned surface boundaries with strong emphasis. */
|
|
@@ -201,6 +186,6 @@
|
|
|
201
186
|
|
|
202
187
|
@media ( -webkit-min-device-pixel-ratio: 2 ), ( min-resolution: 192dpi ) {
|
|
203
188
|
:root {
|
|
204
|
-
--wpds-border-width-
|
|
189
|
+
--wpds-border-width-focus: 1.5px; /* Border width for focus ring */
|
|
205
190
|
}
|
|
206
191
|
}
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export default [
|
|
7
|
-
'--wpds-border-radius-
|
|
8
|
-
'--wpds-border-radius-
|
|
9
|
-
'--wpds-border-radius-
|
|
10
|
-
'--wpds-border-radius-
|
|
11
|
-
'--wpds-border-width-
|
|
12
|
-
'--wpds-border-width-
|
|
13
|
-
'--wpds-border-width-
|
|
14
|
-
'--wpds-border-width-
|
|
15
|
-
'--wpds-border-width-
|
|
7
|
+
'--wpds-border-radius-xs',
|
|
8
|
+
'--wpds-border-radius-sm',
|
|
9
|
+
'--wpds-border-radius-md',
|
|
10
|
+
'--wpds-border-radius-lg',
|
|
11
|
+
'--wpds-border-width-xs',
|
|
12
|
+
'--wpds-border-width-sm',
|
|
13
|
+
'--wpds-border-width-md',
|
|
14
|
+
'--wpds-border-width-lg',
|
|
15
|
+
'--wpds-border-width-focus',
|
|
16
16
|
'--wpds-color-bg-surface-neutral',
|
|
17
17
|
'--wpds-color-bg-surface-neutral-strong',
|
|
18
18
|
'--wpds-color-bg-surface-neutral-weak',
|
|
@@ -27,40 +27,29 @@ export default [
|
|
|
27
27
|
'--wpds-color-bg-surface-caution-weak',
|
|
28
28
|
'--wpds-color-bg-surface-error',
|
|
29
29
|
'--wpds-color-bg-surface-error-weak',
|
|
30
|
-
'--wpds-color-bg-interactive-neutral',
|
|
31
|
-
'--wpds-color-bg-interactive-neutral-active',
|
|
32
|
-
'--wpds-color-bg-interactive-neutral-disabled',
|
|
33
30
|
'--wpds-color-bg-interactive-neutral-strong',
|
|
34
31
|
'--wpds-color-bg-interactive-neutral-strong-active',
|
|
35
32
|
'--wpds-color-bg-interactive-neutral-strong-disabled',
|
|
36
33
|
'--wpds-color-bg-interactive-neutral-weak',
|
|
37
34
|
'--wpds-color-bg-interactive-neutral-weak-active',
|
|
38
35
|
'--wpds-color-bg-interactive-neutral-weak-disabled',
|
|
39
|
-
'--wpds-color-bg-interactive-brand',
|
|
40
|
-
'--wpds-color-bg-interactive-brand-active',
|
|
41
|
-
'--wpds-color-bg-interactive-brand-disabled',
|
|
42
36
|
'--wpds-color-bg-interactive-brand-strong',
|
|
43
37
|
'--wpds-color-bg-interactive-brand-strong-active',
|
|
44
|
-
'--wpds-color-bg-interactive-brand-strong-disabled',
|
|
45
38
|
'--wpds-color-bg-interactive-brand-weak',
|
|
46
39
|
'--wpds-color-bg-interactive-brand-weak-active',
|
|
47
|
-
'--wpds-color-bg-interactive-brand-weak-disabled',
|
|
48
40
|
'--wpds-color-bg-interactive-error',
|
|
49
41
|
'--wpds-color-bg-interactive-error-active',
|
|
50
|
-
'--wpds-color-bg-interactive-error-disabled',
|
|
51
42
|
'--wpds-color-bg-interactive-error-strong',
|
|
52
43
|
'--wpds-color-bg-interactive-error-strong-active',
|
|
53
|
-
'--wpds-color-bg-interactive-error-strong-disabled',
|
|
54
44
|
'--wpds-color-bg-interactive-error-weak',
|
|
55
45
|
'--wpds-color-bg-interactive-error-weak-active',
|
|
56
|
-
'--wpds-color-bg-interactive-error-weak-disabled',
|
|
57
46
|
'--wpds-color-bg-track-neutral-weak',
|
|
58
47
|
'--wpds-color-bg-track-neutral',
|
|
59
48
|
'--wpds-color-bg-thumb-neutral-weak',
|
|
60
49
|
'--wpds-color-bg-thumb-neutral-weak-active',
|
|
61
50
|
'--wpds-color-bg-thumb-brand',
|
|
62
51
|
'--wpds-color-bg-thumb-brand-active',
|
|
63
|
-
'--wpds-color-bg-thumb-
|
|
52
|
+
'--wpds-color-bg-thumb-neutral-disabled',
|
|
64
53
|
'--wpds-color-fg-content-neutral',
|
|
65
54
|
'--wpds-color-fg-content-neutral-weak',
|
|
66
55
|
'--wpds-color-fg-content-success',
|
|
@@ -83,16 +72,12 @@ export default [
|
|
|
83
72
|
'--wpds-color-fg-interactive-neutral-weak-disabled',
|
|
84
73
|
'--wpds-color-fg-interactive-brand',
|
|
85
74
|
'--wpds-color-fg-interactive-brand-active',
|
|
86
|
-
'--wpds-color-fg-interactive-brand-disabled',
|
|
87
75
|
'--wpds-color-fg-interactive-brand-strong',
|
|
88
76
|
'--wpds-color-fg-interactive-brand-strong-active',
|
|
89
|
-
'--wpds-color-fg-interactive-brand-strong-disabled',
|
|
90
77
|
'--wpds-color-fg-interactive-error',
|
|
91
78
|
'--wpds-color-fg-interactive-error-active',
|
|
92
|
-
'--wpds-color-fg-interactive-error-disabled',
|
|
93
79
|
'--wpds-color-fg-interactive-error-strong',
|
|
94
80
|
'--wpds-color-fg-interactive-error-strong-active',
|
|
95
|
-
'--wpds-color-fg-interactive-error-strong-disabled',
|
|
96
81
|
'--wpds-color-stroke-surface-neutral',
|
|
97
82
|
'--wpds-color-stroke-surface-neutral-weak',
|
|
98
83
|
'--wpds-color-stroke-surface-neutral-strong',
|
|
@@ -10,7 +10,6 @@ export default {
|
|
|
10
10
|
'fg-interactive-brand-strong-active',
|
|
11
11
|
],
|
|
12
12
|
'primary-bgFill2': [ 'bg-interactive-brand-strong-active' ],
|
|
13
|
-
'primary-surface2': [ 'bg-interactive-brand-active' ],
|
|
14
13
|
'primary-surface4': [ 'bg-interactive-brand-weak-active' ],
|
|
15
14
|
'primary-fgSurface3': [
|
|
16
15
|
'fg-interactive-brand',
|
|
@@ -72,23 +71,8 @@ export default {
|
|
|
72
71
|
'error-stroke4': [ 'stroke-interactive-error-active' ],
|
|
73
72
|
'error-stroke1': [ 'stroke-surface-error' ],
|
|
74
73
|
'bg-surface2': [ 'bg-surface-neutral' ],
|
|
75
|
-
'bg-
|
|
76
|
-
|
|
77
|
-
'bg-interactive-error-strong-disabled',
|
|
78
|
-
'bg-interactive-neutral-strong-disabled',
|
|
79
|
-
],
|
|
80
|
-
'bg-surface5': [
|
|
81
|
-
'bg-interactive-brand-disabled',
|
|
82
|
-
'bg-interactive-brand-weak-disabled',
|
|
83
|
-
'bg-interactive-error-disabled',
|
|
84
|
-
'bg-interactive-error-weak-disabled',
|
|
85
|
-
'bg-interactive-neutral-disabled',
|
|
86
|
-
'bg-interactive-neutral-weak-disabled',
|
|
87
|
-
],
|
|
88
|
-
'bg-surface4': [
|
|
89
|
-
'bg-interactive-neutral-active',
|
|
90
|
-
'bg-interactive-neutral-weak-active',
|
|
91
|
-
],
|
|
74
|
+
'bg-surface5': [ 'bg-interactive-neutral-strong-disabled' ],
|
|
75
|
+
'bg-surface4': [ 'bg-interactive-neutral-weak-active' ],
|
|
92
76
|
'bg-surface3': [ 'bg-surface-neutral-strong' ],
|
|
93
77
|
'bg-fgSurface4': [
|
|
94
78
|
'fg-content-neutral',
|
|
@@ -97,15 +81,11 @@ export default {
|
|
|
97
81
|
],
|
|
98
82
|
'bg-fgSurface3': [
|
|
99
83
|
'fg-content-neutral-weak',
|
|
100
|
-
'fg-interactive-brand-strong-disabled',
|
|
101
|
-
'fg-interactive-error-strong-disabled',
|
|
102
|
-
'fg-interactive-neutral-strong-disabled',
|
|
103
84
|
'fg-interactive-neutral-weak',
|
|
104
85
|
],
|
|
105
86
|
'bg-fgSurface2': [
|
|
106
|
-
'fg-interactive-brand-disabled',
|
|
107
|
-
'fg-interactive-error-disabled',
|
|
108
87
|
'fg-interactive-neutral-disabled',
|
|
88
|
+
'fg-interactive-neutral-strong-disabled',
|
|
109
89
|
'fg-interactive-neutral-weak-disabled',
|
|
110
90
|
],
|
|
111
91
|
'bg-stroke3': [
|
|
@@ -119,7 +99,7 @@ export default {
|
|
|
119
99
|
'stroke-interactive-neutral-strong',
|
|
120
100
|
],
|
|
121
101
|
'bg-stroke2': [
|
|
122
|
-
'bg-thumb-
|
|
102
|
+
'bg-thumb-neutral-disabled',
|
|
123
103
|
'bg-track-neutral',
|
|
124
104
|
'stroke-interactive-neutral-disabled',
|
|
125
105
|
'stroke-surface-neutral',
|
|
@@ -21,7 +21,7 @@ export type BorderRadiusSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
|
21
21
|
/**
|
|
22
22
|
* Size scale for border width tokens.
|
|
23
23
|
*/
|
|
24
|
-
export type BorderWidthSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
24
|
+
export type BorderWidthSize = 'xs' | 'sm' | 'md' | 'lg' | 'focus';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Target elements that tokens can be applied to.
|
|
@@ -57,10 +57,8 @@ export type SurfaceBackgroundColor =
|
|
|
57
57
|
* Background color variants for interactive elements.
|
|
58
58
|
*/
|
|
59
59
|
export type InteractiveBackgroundColor =
|
|
60
|
-
| 'neutral'
|
|
61
60
|
| 'neutral-strong'
|
|
62
61
|
| 'neutral-weak'
|
|
63
|
-
| 'brand'
|
|
64
62
|
| 'brand-strong'
|
|
65
63
|
| 'brand-weak'
|
|
66
64
|
| 'error'
|
|
@@ -148,15 +146,11 @@ export type ForegroundColor =
|
|
|
148
146
|
| 'neutral-weak-disabled'
|
|
149
147
|
| 'brand'
|
|
150
148
|
| 'brand-active'
|
|
151
|
-
| 'brand-disabled'
|
|
152
149
|
| 'brand-strong'
|
|
153
150
|
| 'brand-strong-active'
|
|
154
|
-
| 'brand-strong-disabled'
|
|
155
151
|
| 'error-active'
|
|
156
|
-
| 'error-disabled'
|
|
157
152
|
| 'error-strong'
|
|
158
|
-
| 'error-strong-active'
|
|
159
|
-
| 'error-strong-disabled';
|
|
153
|
+
| 'error-strong-active';
|
|
160
154
|
|
|
161
155
|
/**
|
|
162
156
|
* Font family variants.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { Meta, StoryObj } from '@storybook/react-
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -21,7 +21,7 @@ import { ThemeProvider } from '../theme-provider';
|
|
|
21
21
|
import '../prebuilt/css/design-tokens.css';
|
|
22
22
|
|
|
23
23
|
const meta: Meta< typeof ThemeProvider > = {
|
|
24
|
-
title: 'Design System/Theme Provider',
|
|
24
|
+
title: 'Design System/Theme/Theme Provider',
|
|
25
25
|
component: ThemeProvider,
|
|
26
26
|
args: {
|
|
27
27
|
isRoot: true,
|
|
@@ -132,7 +132,7 @@ const DSTokensList = () => {
|
|
|
132
132
|
|
|
133
133
|
return (
|
|
134
134
|
<div style={ { color: 'var( --wpds-color-fg-content-neutral )' } }>
|
|
135
|
-
<h1>
|
|
135
|
+
<h1>Design System Color tokens</h1>
|
|
136
136
|
<h2>Semantic tokens (can be consumed directly)</h2>
|
|
137
137
|
<ColorTokenTable tokens={ props.semanticProps } />
|
|
138
138
|
<h2>Legacy tokens (should not be consumed directly)</h2>
|
|
@@ -233,7 +233,7 @@ const NestingDebug = ( { bg = '', primary = '', density = '' } ) => (
|
|
|
233
233
|
padding: 'var(--wpds-dimension-padding-surface-xs)',
|
|
234
234
|
borderRadius: '0.25rem',
|
|
235
235
|
backgroundColor:
|
|
236
|
-
'var(--wpds-color-bg-interactive-
|
|
236
|
+
'var(--wpds-color-bg-interactive-neutral-weak-disabled)',
|
|
237
237
|
color: 'var(--wpds-color-fg-content-neutral)',
|
|
238
238
|
} }
|
|
239
239
|
>
|
package/src/style.scss
ADDED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
.example {
|
|
3
3
|
background-color: var(--wpds-color-bg-surface-neutral);
|
|
4
4
|
color: var(--wpds-color-fg-content-neutral);
|
|
5
|
-
border-radius: var(--wpds-border-radius-
|
|
5
|
+
border-radius: var(--wpds-border-radius-sm);
|
|
6
6
|
padding: var(--wpds-dimension-padding-surface-md);
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
clone,
|
|
7
7
|
set,
|
|
8
8
|
to,
|
|
9
|
-
serialize,
|
|
10
9
|
sRGB,
|
|
11
10
|
HSL,
|
|
12
11
|
type PlainColorObject,
|
|
@@ -30,6 +29,7 @@ import {
|
|
|
30
29
|
DEFAULT_SEED_COLORS,
|
|
31
30
|
type RampResult,
|
|
32
31
|
} from './color-ramps';
|
|
32
|
+
import { getColorString } from './color-ramps/lib/color-utils';
|
|
33
33
|
import type { ThemeProviderProps } from './types';
|
|
34
34
|
|
|
35
35
|
type Entry = [ string, string ];
|
|
@@ -117,23 +117,14 @@ function legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {
|
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
return [
|
|
120
|
-
[
|
|
121
|
-
'--wp-admin-theme-color',
|
|
122
|
-
serialize( parsedAccent, { format: 'hex' } ),
|
|
123
|
-
],
|
|
120
|
+
[ '--wp-admin-theme-color', getColorString( parsedAccent ) ],
|
|
124
121
|
[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],
|
|
125
|
-
[
|
|
126
|
-
'--wp-admin-theme-color-darker-10',
|
|
127
|
-
serialize( darker10, { format: 'hex' } ),
|
|
128
|
-
],
|
|
122
|
+
[ '--wp-admin-theme-color-darker-10', getColorString( darker10 ) ],
|
|
129
123
|
[
|
|
130
124
|
'--wp-admin-theme-color-darker-10--rgb',
|
|
131
125
|
customRgbFormat( darker10 ),
|
|
132
126
|
],
|
|
133
|
-
[
|
|
134
|
-
'--wp-admin-theme-color-darker-20',
|
|
135
|
-
serialize( darker20, { format: 'hex' } ),
|
|
136
|
-
],
|
|
127
|
+
[ '--wp-admin-theme-color-darker-20', getColorString( darker20 ) ],
|
|
137
128
|
[
|
|
138
129
|
'--wp-admin-theme-color-darker-20--rgb',
|
|
139
130
|
customRgbFormat( darker20 ),
|