@wordpress/theme 0.7.1-next.v.202602191100.0 → 0.8.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 +7 -0
- package/build/esbuild-plugins/esbuild-ds-token-fallbacks.cjs +57 -0
- package/build/esbuild-plugins/esbuild-ds-token-fallbacks.cjs.map +7 -0
- package/build/postcss-plugins/add-fallback-to-var.cjs +38 -0
- package/build/postcss-plugins/add-fallback-to-var.cjs.map +7 -0
- package/build/postcss-plugins/ds-token-fallbacks.cjs +50 -0
- package/build/postcss-plugins/ds-token-fallbacks.cjs.map +7 -0
- package/build/postcss-plugins/postcss-ds-token-fallbacks.cjs +38 -0
- package/build/postcss-plugins/postcss-ds-token-fallbacks.cjs.map +7 -0
- package/build/prebuilt/js/design-token-fallbacks.cjs +161 -0
- package/build/prebuilt/js/design-token-fallbacks.cjs.map +7 -0
- package/build/prebuilt/js/design-tokens.cjs +1 -0
- package/build/prebuilt/js/design-tokens.cjs.map +2 -2
- package/build/theme-provider.cjs +1 -1
- package/build/theme-provider.cjs.map +2 -2
- package/build/use-theme-provider-styles.cjs +11 -11
- package/build/use-theme-provider-styles.cjs.map +1 -1
- package/build/vite-plugins/vite-ds-token-fallbacks.cjs +42 -0
- package/build/vite-plugins/vite-ds-token-fallbacks.cjs.map +7 -0
- package/build-module/esbuild-plugins/esbuild-ds-token-fallbacks.mjs +37 -0
- package/build-module/esbuild-plugins/esbuild-ds-token-fallbacks.mjs.map +7 -0
- package/build-module/postcss-plugins/add-fallback-to-var.mjs +14 -0
- package/build-module/postcss-plugins/add-fallback-to-var.mjs.map +7 -0
- package/build-module/postcss-plugins/ds-token-fallbacks.mjs +16 -0
- package/build-module/postcss-plugins/ds-token-fallbacks.mjs.map +7 -0
- package/build-module/postcss-plugins/postcss-ds-token-fallbacks.mjs +18 -0
- package/build-module/postcss-plugins/postcss-ds-token-fallbacks.mjs.map +7 -0
- package/build-module/prebuilt/js/design-token-fallbacks.mjs +141 -0
- package/build-module/prebuilt/js/design-token-fallbacks.mjs.map +7 -0
- package/build-module/prebuilt/js/design-tokens.mjs +1 -0
- package/build-module/prebuilt/js/design-tokens.mjs.map +2 -2
- package/build-module/theme-provider.mjs +1 -1
- package/build-module/theme-provider.mjs.map +2 -2
- package/build-module/use-theme-provider-styles.mjs +11 -11
- package/build-module/use-theme-provider-styles.mjs.map +1 -1
- package/build-module/vite-plugins/vite-ds-token-fallbacks.mjs +22 -0
- package/build-module/vite-plugins/vite-ds-token-fallbacks.mjs.map +7 -0
- package/build-types/color-ramps/stories/brand-fallbacks.story.d.ts +15 -0
- package/build-types/color-ramps/stories/brand-fallbacks.story.d.ts.map +1 -0
- package/build-types/postcss-plugins/add-fallback-to-var.d.ts +17 -0
- package/build-types/postcss-plugins/add-fallback-to-var.d.ts.map +1 -0
- package/build-types/postcss-plugins/ds-token-fallbacks.d.mts +15 -0
- package/build-types/postcss-plugins/ds-token-fallbacks.d.mts.map +1 -0
- package/build-types/prebuilt/js/design-token-fallbacks.d.mts +138 -0
- package/build-types/prebuilt/js/design-token-fallbacks.d.mts.map +1 -0
- package/package.json +19 -4
- package/src/color-ramps/stories/brand-fallbacks.story.tsx +165 -0
- package/src/esbuild-plugins/esbuild-ds-token-fallbacks.d.mts +2 -0
- package/src/esbuild-plugins/esbuild-ds-token-fallbacks.mjs +47 -0
- package/src/postcss-plugins/add-fallback-to-var.ts +29 -0
- package/src/postcss-plugins/ds-token-fallbacks.mjs +29 -0
- package/src/postcss-plugins/postcss-ds-token-fallbacks.d.mts +2 -0
- package/src/postcss-plugins/postcss-ds-token-fallbacks.mjs +16 -0
- package/src/postcss-plugins/test/add-fallback-to-var.test.ts +91 -0
- package/src/prebuilt/css/design-tokens.css +1 -0
- package/src/prebuilt/js/design-token-fallbacks.mjs +157 -0
- package/src/prebuilt/js/design-tokens.mjs +1 -0
- package/src/vite-plugins/vite-ds-token-fallbacks.d.mts +2 -0
- package/src/vite-plugins/vite-ds-token-fallbacks.mjs +28 -0
- package/src/style.scss +0 -6
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { addFallbackToVar } from '../add-fallback-to-var';
|
|
2
|
+
|
|
3
|
+
const mockFallbacks: Record< string, string > = {
|
|
4
|
+
'--wpds-border-radius-sm': '2px',
|
|
5
|
+
'--wpds-dimension-gap-sm': '8px',
|
|
6
|
+
'--wpds-dimension-gap-lg': '16px',
|
|
7
|
+
'--wpds-color-bg-interactive-brand-strong':
|
|
8
|
+
'var(--wp-admin-theme-color, #3858e9)',
|
|
9
|
+
'--wpds-color-bg-interactive-brand-strong-active':
|
|
10
|
+
'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 92%, black)',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe( 'addFallbackToVar', () => {
|
|
14
|
+
it( 'injects a fallback for a known token', () => {
|
|
15
|
+
expect(
|
|
16
|
+
addFallbackToVar( 'var(--wpds-border-radius-sm)', mockFallbacks )
|
|
17
|
+
).toBe( 'var(--wpds-border-radius-sm, 2px)' );
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
it( 'leaves unknown tokens untouched', () => {
|
|
21
|
+
expect(
|
|
22
|
+
addFallbackToVar( 'var(--wpds-nonexistent-token)', mockFallbacks )
|
|
23
|
+
).toBe( 'var(--wpds-nonexistent-token)' );
|
|
24
|
+
} );
|
|
25
|
+
|
|
26
|
+
it( 'leaves non-wpds custom properties untouched', () => {
|
|
27
|
+
expect(
|
|
28
|
+
addFallbackToVar( 'var(--my-custom-prop)', mockFallbacks )
|
|
29
|
+
).toBe( 'var(--my-custom-prop)' );
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
it( 'does not double-wrap a var() that already has a fallback', () => {
|
|
33
|
+
expect(
|
|
34
|
+
addFallbackToVar(
|
|
35
|
+
'var(--wpds-border-radius-sm, 999px)',
|
|
36
|
+
mockFallbacks
|
|
37
|
+
)
|
|
38
|
+
).toBe( 'var(--wpds-border-radius-sm, 999px)' );
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
it( 'handles multiple var() calls in one value', () => {
|
|
42
|
+
const input =
|
|
43
|
+
'var(--wpds-dimension-gap-sm) var(--wpds-dimension-gap-lg)';
|
|
44
|
+
const result = addFallbackToVar( input, mockFallbacks );
|
|
45
|
+
expect( result ).toBe(
|
|
46
|
+
'var(--wpds-dimension-gap-sm, 8px) var(--wpds-dimension-gap-lg, 16px)'
|
|
47
|
+
);
|
|
48
|
+
} );
|
|
49
|
+
|
|
50
|
+
it( 'injects a brand token fallback with var(--wp-admin-theme-color)', () => {
|
|
51
|
+
const result = addFallbackToVar(
|
|
52
|
+
'var(--wpds-color-bg-interactive-brand-strong)',
|
|
53
|
+
mockFallbacks
|
|
54
|
+
);
|
|
55
|
+
expect( result ).toBe(
|
|
56
|
+
'var(--wpds-color-bg-interactive-brand-strong, var(--wp-admin-theme-color, #3858e9))'
|
|
57
|
+
);
|
|
58
|
+
} );
|
|
59
|
+
|
|
60
|
+
it( 'injects a color-mix fallback for a derived brand token', () => {
|
|
61
|
+
const result = addFallbackToVar(
|
|
62
|
+
'var(--wpds-color-bg-interactive-brand-strong-active)',
|
|
63
|
+
mockFallbacks
|
|
64
|
+
);
|
|
65
|
+
expect( result ).toBe(
|
|
66
|
+
'var(--wpds-color-bg-interactive-brand-strong-active, color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 92%, black))'
|
|
67
|
+
);
|
|
68
|
+
} );
|
|
69
|
+
|
|
70
|
+
it( 'returns the original string when there are no var() calls', () => {
|
|
71
|
+
expect( addFallbackToVar( '10px solid red', mockFallbacks ) ).toBe(
|
|
72
|
+
'10px solid red'
|
|
73
|
+
);
|
|
74
|
+
} );
|
|
75
|
+
|
|
76
|
+
it( 'injects a fallback inside calc()', () => {
|
|
77
|
+
expect(
|
|
78
|
+
addFallbackToVar(
|
|
79
|
+
'calc(var(--wpds-dimension-gap-sm) * 2)',
|
|
80
|
+
mockFallbacks
|
|
81
|
+
)
|
|
82
|
+
).toBe( 'calc(var(--wpds-dimension-gap-sm, 8px) * 2)' );
|
|
83
|
+
} );
|
|
84
|
+
|
|
85
|
+
it( 'is idempotent — running twice gives the same result', () => {
|
|
86
|
+
const input = 'var(--wpds-border-radius-sm)';
|
|
87
|
+
const first = addFallbackToVar( input, mockFallbacks );
|
|
88
|
+
const second = addFallbackToVar( first, mockFallbacks );
|
|
89
|
+
expect( second ).toBe( first );
|
|
90
|
+
} );
|
|
91
|
+
} );
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
--wpds-color-stroke-surface-success-strong: #007f30; /* Decorative stroke color used to define success-toned surface boundaries with strong emphasis. */
|
|
101
101
|
--wpds-color-stroke-surface-warning: #d0b381; /* Decorative stroke color used to define warning-toned surface boundaries with normal emphasis. */
|
|
102
102
|
--wpds-color-stroke-surface-warning-strong: #926300; /* Decorative stroke color used to define warning-toned surface boundaries with strong emphasis. */
|
|
103
|
+
--wpds-cursor-control: default; /* Cursor style for interactive controls that are not links (e.g. buttons, checkboxes, and toggles). */
|
|
103
104
|
--wpds-dimension-base: 4px; /* Base dimension unit */
|
|
104
105
|
--wpds-dimension-gap-2xl: 32px; /* 2x extra large gap */
|
|
105
106
|
--wpds-dimension-gap-3xl: 40px; /* 3x extra large gap */
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is generated by the @wordpress/terrazzo-plugin-ds-token-fallbacks plugin.
|
|
3
|
+
* Do not edit this file directly.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
'--wpds-border-radius-lg': '8px',
|
|
8
|
+
'--wpds-border-radius-md': '4px',
|
|
9
|
+
'--wpds-border-radius-sm': '2px',
|
|
10
|
+
'--wpds-border-radius-xs': '1px',
|
|
11
|
+
'--wpds-border-width-focus': 'var(--wp-admin-border-width-focus, 2px)',
|
|
12
|
+
'--wpds-border-width-lg': '8px',
|
|
13
|
+
'--wpds-border-width-md': '4px',
|
|
14
|
+
'--wpds-border-width-sm': '2px',
|
|
15
|
+
'--wpds-border-width-xs': '1px',
|
|
16
|
+
'--wpds-color-bg-interactive-brand-strong':
|
|
17
|
+
'var(--wp-admin-theme-color, #3858e9)',
|
|
18
|
+
'--wpds-color-bg-interactive-brand-strong-active':
|
|
19
|
+
'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 93%, black)',
|
|
20
|
+
'--wpds-color-bg-interactive-brand-weak': '#00000000',
|
|
21
|
+
'--wpds-color-bg-interactive-brand-weak-active':
|
|
22
|
+
'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 12%, white)',
|
|
23
|
+
'--wpds-color-bg-interactive-error': '#00000000',
|
|
24
|
+
'--wpds-color-bg-interactive-error-active': '#fff6f4',
|
|
25
|
+
'--wpds-color-bg-interactive-error-strong': '#cc1818',
|
|
26
|
+
'--wpds-color-bg-interactive-error-strong-active': '#b90000',
|
|
27
|
+
'--wpds-color-bg-interactive-error-weak': '#00000000',
|
|
28
|
+
'--wpds-color-bg-interactive-error-weak-active': '#f6e6e3',
|
|
29
|
+
'--wpds-color-bg-interactive-neutral-strong': '#2d2d2d',
|
|
30
|
+
'--wpds-color-bg-interactive-neutral-strong-active': '#1e1e1e',
|
|
31
|
+
'--wpds-color-bg-interactive-neutral-strong-disabled': '#e2e2e2',
|
|
32
|
+
'--wpds-color-bg-interactive-neutral-weak': '#00000000',
|
|
33
|
+
'--wpds-color-bg-interactive-neutral-weak-active': '#eaeaea',
|
|
34
|
+
'--wpds-color-bg-interactive-neutral-weak-disabled': '#00000000',
|
|
35
|
+
'--wpds-color-bg-surface-brand':
|
|
36
|
+
'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 9%, white)',
|
|
37
|
+
'--wpds-color-bg-surface-caution': '#fee994',
|
|
38
|
+
'--wpds-color-bg-surface-caution-weak': '#fff9c9',
|
|
39
|
+
'--wpds-color-bg-surface-error': '#f6e6e3',
|
|
40
|
+
'--wpds-color-bg-surface-error-weak': '#fff6f4',
|
|
41
|
+
'--wpds-color-bg-surface-info': '#deebfa',
|
|
42
|
+
'--wpds-color-bg-surface-info-weak': '#f2f9ff',
|
|
43
|
+
'--wpds-color-bg-surface-neutral': '#f8f8f8',
|
|
44
|
+
'--wpds-color-bg-surface-neutral-strong': '#ffffff',
|
|
45
|
+
'--wpds-color-bg-surface-neutral-weak': '#f0f0f0',
|
|
46
|
+
'--wpds-color-bg-surface-success': '#c5f7cc',
|
|
47
|
+
'--wpds-color-bg-surface-success-weak': '#eaffed',
|
|
48
|
+
'--wpds-color-bg-surface-warning': '#fde6bd',
|
|
49
|
+
'--wpds-color-bg-surface-warning-weak': '#fff7e0',
|
|
50
|
+
'--wpds-color-bg-thumb-brand': 'var(--wp-admin-theme-color, #3858e9)',
|
|
51
|
+
'--wpds-color-bg-thumb-brand-active':
|
|
52
|
+
'var(--wp-admin-theme-color, #3858e9)',
|
|
53
|
+
'--wpds-color-bg-thumb-neutral-disabled': '#d8d8d8',
|
|
54
|
+
'--wpds-color-bg-thumb-neutral-weak': '#8a8a8a',
|
|
55
|
+
'--wpds-color-bg-thumb-neutral-weak-active': '#6c6c6c',
|
|
56
|
+
'--wpds-color-bg-track-neutral': '#d8d8d8',
|
|
57
|
+
'--wpds-color-bg-track-neutral-weak': '#e0e0e0',
|
|
58
|
+
'--wpds-color-fg-content-caution': '#281d00',
|
|
59
|
+
'--wpds-color-fg-content-caution-weak': '#826a00',
|
|
60
|
+
'--wpds-color-fg-content-error': '#470000',
|
|
61
|
+
'--wpds-color-fg-content-error-weak': '#cc1818',
|
|
62
|
+
'--wpds-color-fg-content-info': '#001b4f',
|
|
63
|
+
'--wpds-color-fg-content-info-weak': '#006bd7',
|
|
64
|
+
'--wpds-color-fg-content-neutral': '#1e1e1e',
|
|
65
|
+
'--wpds-color-fg-content-neutral-weak': '#6d6d6d',
|
|
66
|
+
'--wpds-color-fg-content-success': '#002900',
|
|
67
|
+
'--wpds-color-fg-content-success-weak': '#007f30',
|
|
68
|
+
'--wpds-color-fg-content-warning': '#2e1900',
|
|
69
|
+
'--wpds-color-fg-content-warning-weak': '#926300',
|
|
70
|
+
'--wpds-color-fg-interactive-brand': 'var(--wp-admin-theme-color, #3858e9)',
|
|
71
|
+
'--wpds-color-fg-interactive-brand-active':
|
|
72
|
+
'var(--wp-admin-theme-color, #3858e9)',
|
|
73
|
+
'--wpds-color-fg-interactive-brand-strong': '#fff',
|
|
74
|
+
'--wpds-color-fg-interactive-brand-strong-active': '#fff',
|
|
75
|
+
'--wpds-color-fg-interactive-error': '#cc1818',
|
|
76
|
+
'--wpds-color-fg-interactive-error-active': '#cc1818',
|
|
77
|
+
'--wpds-color-fg-interactive-error-strong': '#f2efef',
|
|
78
|
+
'--wpds-color-fg-interactive-error-strong-active': '#f2efef',
|
|
79
|
+
'--wpds-color-fg-interactive-neutral': '#1e1e1e',
|
|
80
|
+
'--wpds-color-fg-interactive-neutral-active': '#1e1e1e',
|
|
81
|
+
'--wpds-color-fg-interactive-neutral-disabled': '#8a8a8a',
|
|
82
|
+
'--wpds-color-fg-interactive-neutral-strong': '#f0f0f0',
|
|
83
|
+
'--wpds-color-fg-interactive-neutral-strong-active': '#f0f0f0',
|
|
84
|
+
'--wpds-color-fg-interactive-neutral-strong-disabled': '#8a8a8a',
|
|
85
|
+
'--wpds-color-fg-interactive-neutral-weak': '#6d6d6d',
|
|
86
|
+
'--wpds-color-fg-interactive-neutral-weak-disabled': '#8a8a8a',
|
|
87
|
+
'--wpds-color-stroke-focus-brand': 'var(--wp-admin-theme-color, #3858e9)',
|
|
88
|
+
'--wpds-color-stroke-interactive-brand':
|
|
89
|
+
'var(--wp-admin-theme-color, #3858e9)',
|
|
90
|
+
'--wpds-color-stroke-interactive-brand-active':
|
|
91
|
+
'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 85%, black)',
|
|
92
|
+
'--wpds-color-stroke-interactive-error': '#cc1818',
|
|
93
|
+
'--wpds-color-stroke-interactive-error-active': '#9d0000',
|
|
94
|
+
'--wpds-color-stroke-interactive-error-strong': '#cc1818',
|
|
95
|
+
'--wpds-color-stroke-interactive-neutral': '#8a8a8a',
|
|
96
|
+
'--wpds-color-stroke-interactive-neutral-active': '#6c6c6c',
|
|
97
|
+
'--wpds-color-stroke-interactive-neutral-disabled': '#d8d8d8',
|
|
98
|
+
'--wpds-color-stroke-interactive-neutral-strong': '#6c6c6c',
|
|
99
|
+
'--wpds-color-stroke-surface-brand':
|
|
100
|
+
'color-mix(in oklch, var(--wp-admin-theme-color, #3858e9) 46%, white)',
|
|
101
|
+
'--wpds-color-stroke-surface-brand-strong':
|
|
102
|
+
'var(--wp-admin-theme-color, #3858e9)',
|
|
103
|
+
'--wpds-color-stroke-surface-error': '#daa39b',
|
|
104
|
+
'--wpds-color-stroke-surface-error-strong': '#cc1818',
|
|
105
|
+
'--wpds-color-stroke-surface-info': '#9fbcdc',
|
|
106
|
+
'--wpds-color-stroke-surface-info-strong': '#006bd7',
|
|
107
|
+
'--wpds-color-stroke-surface-neutral': '#d8d8d8',
|
|
108
|
+
'--wpds-color-stroke-surface-neutral-strong': '#8a8a8a',
|
|
109
|
+
'--wpds-color-stroke-surface-neutral-weak': '#e0e0e0',
|
|
110
|
+
'--wpds-color-stroke-surface-success': '#8ac894',
|
|
111
|
+
'--wpds-color-stroke-surface-success-strong': '#007f30',
|
|
112
|
+
'--wpds-color-stroke-surface-warning': '#d0b381',
|
|
113
|
+
'--wpds-color-stroke-surface-warning-strong': '#926300',
|
|
114
|
+
'--wpds-cursor-control': 'default',
|
|
115
|
+
'--wpds-dimension-base': '4px',
|
|
116
|
+
'--wpds-dimension-gap-2xl': '32px',
|
|
117
|
+
'--wpds-dimension-gap-3xl': '40px',
|
|
118
|
+
'--wpds-dimension-gap-lg': '16px',
|
|
119
|
+
'--wpds-dimension-gap-md': '12px',
|
|
120
|
+
'--wpds-dimension-gap-sm': '8px',
|
|
121
|
+
'--wpds-dimension-gap-xl': '24px',
|
|
122
|
+
'--wpds-dimension-gap-xs': '4px',
|
|
123
|
+
'--wpds-dimension-padding-2xl': '24px',
|
|
124
|
+
'--wpds-dimension-padding-3xl': '32px',
|
|
125
|
+
'--wpds-dimension-padding-lg': '16px',
|
|
126
|
+
'--wpds-dimension-padding-md': '12px',
|
|
127
|
+
'--wpds-dimension-padding-sm': '8px',
|
|
128
|
+
'--wpds-dimension-padding-xl': '20px',
|
|
129
|
+
'--wpds-dimension-padding-xs': '4px',
|
|
130
|
+
'--wpds-elevation-lg':
|
|
131
|
+
'0 5px 15px 0 #00000014, 0 15px 27px 0 #00000012, 0 30px 36px 0 #0000000a, 0 50px 43px 0 #00000005',
|
|
132
|
+
'--wpds-elevation-md':
|
|
133
|
+
'0 2px 3px 0 #0000000d, 0 4px 5px 0 #0000000a, 0 12px 12px 0 #00000008, 0 16px 16px 0 #00000005',
|
|
134
|
+
'--wpds-elevation-sm':
|
|
135
|
+
'0 1px 2px 0 #0000000d, 0 2px 3px 0 #0000000a, 0 6px 6px 0 #00000008, 0 8px 8px 0 #00000005',
|
|
136
|
+
'--wpds-elevation-xs':
|
|
137
|
+
'0 1px 1px 0 #00000008, 0 1px 2px 0 #00000005, 0 3px 3px 0 #00000005, 0 4px 4px 0 #00000003',
|
|
138
|
+
'--wpds-font-family-body':
|
|
139
|
+
'-apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif',
|
|
140
|
+
'--wpds-font-family-heading':
|
|
141
|
+
'-apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif',
|
|
142
|
+
'--wpds-font-family-mono': '"Menlo", "Consolas", monaco, monospace',
|
|
143
|
+
'--wpds-font-line-height-2xl': '40px',
|
|
144
|
+
'--wpds-font-line-height-lg': '28px',
|
|
145
|
+
'--wpds-font-line-height-md': '24px',
|
|
146
|
+
'--wpds-font-line-height-sm': '20px',
|
|
147
|
+
'--wpds-font-line-height-xl': '32px',
|
|
148
|
+
'--wpds-font-line-height-xs': '16px',
|
|
149
|
+
'--wpds-font-size-2xl': '32px',
|
|
150
|
+
'--wpds-font-size-lg': '15px',
|
|
151
|
+
'--wpds-font-size-md': '13px',
|
|
152
|
+
'--wpds-font-size-sm': '12px',
|
|
153
|
+
'--wpds-font-size-xl': '20px',
|
|
154
|
+
'--wpds-font-size-xs': '11px',
|
|
155
|
+
'--wpds-font-weight-medium': '499',
|
|
156
|
+
'--wpds-font-weight-regular': '400',
|
|
157
|
+
};
|
|
@@ -101,6 +101,7 @@ export default [
|
|
|
101
101
|
'--wpds-color-stroke-interactive-error-active',
|
|
102
102
|
'--wpds-color-stroke-interactive-error-strong',
|
|
103
103
|
'--wpds-color-stroke-focus-brand',
|
|
104
|
+
'--wpds-cursor-control',
|
|
104
105
|
'--wpds-dimension-base',
|
|
105
106
|
'--wpds-dimension-padding-xs',
|
|
106
107
|
'--wpds-dimension-padding-sm',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin that injects design-system token fallbacks into JS/TS files.
|
|
5
|
+
*
|
|
6
|
+
* Replaces bare `var(--wpds-*)` references in string literals with
|
|
7
|
+
* `var(--wpds-*, <fallback>)` so components render correctly without
|
|
8
|
+
* a ThemeProvider.
|
|
9
|
+
*/
|
|
10
|
+
const plugin = () => ( {
|
|
11
|
+
name: 'ds-token-fallbacks-js',
|
|
12
|
+
transform( code, id ) {
|
|
13
|
+
if ( ! /\.[mc]?[jt]sx?$/.test( id ) ) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if ( id.includes( 'node_modules' ) ) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if ( ! code.includes( '--wpds-' ) ) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
// Sourcemap omitted: replacements are small, inline substitutions
|
|
23
|
+
// that preserve line structure, so the debugging impact is negligible.
|
|
24
|
+
return { code: addFallbackToVar( code ), map: null };
|
|
25
|
+
},
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
export default plugin;
|