@wordpress/theme 0.4.0 → 0.4.1-next.8fd3f8831.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 +9 -0
- package/README.md +43 -33
- package/build/color-ramps/{index.js → index.cjs} +8 -8
- package/build/color-ramps/lib/{color-utils.js → color-utils.cjs} +2 -2
- package/build/color-ramps/lib/{constants.js → constants.cjs} +2 -2
- package/build/color-ramps/lib/{default-ramps.js → default-ramps.cjs} +1 -1
- package/build/color-ramps/lib/{find-color-with-constraints.js → find-color-with-constraints.cjs} +6 -6
- package/build/color-ramps/lib/{index.js → index.cjs} +6 -6
- package/build/color-ramps/lib/{ramp-configs.js → ramp-configs.cjs} +1 -1
- package/build/color-ramps/lib/{register-color-spaces.js → register-color-spaces.cjs} +1 -1
- package/build/color-ramps/lib/{taper-chroma.js → taper-chroma.cjs} +2 -2
- package/build/color-ramps/lib/{types.js → types.cjs} +1 -1
- package/build/color-ramps/lib/{utils.js → utils.cjs} +4 -4
- package/build/{context.js → context.cjs} +1 -1
- package/build/{index.js → index.cjs} +2 -2
- package/build/index.cjs.map +7 -0
- package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
- package/build/prebuilt/js/{design-tokens.js → design-tokens.cjs} +1 -1
- package/build/prebuilt/ts/{color-tokens.js → color-tokens.cjs} +1 -1
- package/build/prebuilt/ts/token-types.cjs +18 -0
- package/build/prebuilt/ts/token-types.cjs.map +7 -0
- package/build/{private-apis.js → private-apis.cjs} +4 -4
- package/build/{theme-provider.js → theme-provider.cjs} +3 -3
- package/build/{types.js → types.cjs} +1 -1
- package/build/{use-theme-provider-styles.js → use-theme-provider-styles.cjs} +6 -6
- package/build-module/color-ramps/index.js +7 -7
- package/build-module/color-ramps/lib/color-utils.js +1 -1
- package/build-module/color-ramps/lib/constants.js +1 -1
- package/build-module/color-ramps/lib/find-color-with-constraints.js +5 -5
- package/build-module/color-ramps/lib/index.js +5 -5
- package/build-module/color-ramps/lib/taper-chroma.js +1 -1
- package/build-module/color-ramps/lib/utils.js +3 -3
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +2 -2
- package/build-module/prebuilt/ts/token-types.js +1 -0
- package/build-module/prebuilt/ts/token-types.js.map +7 -0
- package/build-module/private-apis.js +3 -3
- package/build-module/theme-provider.js +2 -2
- package/build-module/use-theme-provider-styles.js +4 -4
- package/build-types/index.d.ts +2 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/prebuilt/ts/token-types.d.ts +49 -0
- package/build-types/prebuilt/ts/token-types.d.ts.map +1 -0
- package/package.json +14 -6
- package/src/index.ts +2 -1
- package/src/prebuilt/ts/token-types.ts +125 -0
- package/bin/generate-default-ramps/index.ts +0 -49
- package/bin/generate-primitive-tokens/index.ts +0 -113
- package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +0 -84
- package/bin/terrazzo-plugin-inline-alias-values/index.ts +0 -113
- package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +0 -52
- package/bin/terrazzo-plugin-mode-overrides/index.ts +0 -208
- package/build/index.js.map +0 -7
- package/docs/ds-tokens.md +0 -176
- package/terrazzo.config.ts +0 -123
- package/tokens/border.json +0 -56
- package/tokens/color.json +0 -1559
- package/tokens/dimension.json +0 -169
- package/tokens/elevation.json +0 -201
- package/tokens/modes/border.high-dpi.json +0 -15
- package/tokens/modes/dimension.comfortable.json +0 -54
- package/tokens/modes/dimension.compact.json +0 -54
- package/tokens/typography.json +0 -93
- package/tsconfig.bin.json +0 -13
- package/tsconfig.bin.tsbuildinfo +0 -1
- package/tsconfig.json +0 -11
- package/tsconfig.src.json +0 -9
- package/tsconfig.src.tsbuildinfo +0 -1
- /package/build/color-ramps/{index.js.map → index.cjs.map} +0 -0
- /package/build/color-ramps/lib/{color-utils.js.map → color-utils.cjs.map} +0 -0
- /package/build/color-ramps/lib/{constants.js.map → constants.cjs.map} +0 -0
- /package/build/color-ramps/lib/{default-ramps.js.map → default-ramps.cjs.map} +0 -0
- /package/build/color-ramps/lib/{find-color-with-constraints.js.map → find-color-with-constraints.cjs.map} +0 -0
- /package/build/color-ramps/lib/{index.js.map → index.cjs.map} +0 -0
- /package/build/color-ramps/lib/{ramp-configs.js.map → ramp-configs.cjs.map} +0 -0
- /package/build/color-ramps/lib/{register-color-spaces.js.map → register-color-spaces.cjs.map} +0 -0
- /package/build/color-ramps/lib/{taper-chroma.js.map → taper-chroma.cjs.map} +0 -0
- /package/build/color-ramps/lib/{types.js.map → types.cjs.map} +0 -0
- /package/build/color-ramps/lib/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/{context.js.map → context.cjs.map} +0 -0
- /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
- /package/build/prebuilt/js/{design-tokens.js.map → design-tokens.cjs.map} +0 -0
- /package/build/prebuilt/ts/{color-tokens.js.map → color-tokens.cjs.map} +0 -0
- /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
- /package/build/{theme-provider.js.map → theme-provider.cjs.map} +0 -0
- /package/build/{types.js.map → types.cjs.map} +0 -0
- /package/build/{use-theme-provider-styles.js.map → use-theme-provider-styles.cjs.map} +0 -0
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { basename } from 'node:path';
|
|
5
|
-
import type { Plugin } from '@terrazzo/parser';
|
|
6
|
-
|
|
7
|
-
type DTCGPrimitiveValue =
|
|
8
|
-
| string
|
|
9
|
-
| number
|
|
10
|
-
| boolean
|
|
11
|
-
| { value: number; unit: string }
|
|
12
|
-
| { r: number; g: number; b: number; a?: number };
|
|
13
|
-
|
|
14
|
-
type DTCGValue = DTCGPrimitiveValue | Record< string, DTCGPrimitiveValue >;
|
|
15
|
-
|
|
16
|
-
interface DTCGExtensions {
|
|
17
|
-
[ key: string ]: unknown;
|
|
18
|
-
mode?: Record< string, DTCGValue >;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @see https://tr.designtokens.org/format/
|
|
23
|
-
*/
|
|
24
|
-
interface DTCGToken {
|
|
25
|
-
$value: DTCGValue;
|
|
26
|
-
$type?: string;
|
|
27
|
-
$description?: string;
|
|
28
|
-
$extensions?: DTCGExtensions;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface DTCGGroup {
|
|
32
|
-
$type?: string;
|
|
33
|
-
$description?: string;
|
|
34
|
-
$extensions?: DTCGExtensions;
|
|
35
|
-
[ key: string ]:
|
|
36
|
-
| DTCGToken
|
|
37
|
-
| DTCGGroup
|
|
38
|
-
| string
|
|
39
|
-
| DTCGExtensions
|
|
40
|
-
| undefined;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type DTCGDocument = Record< string, DTCGGroup >;
|
|
44
|
-
|
|
45
|
-
interface ModeOverride {
|
|
46
|
-
path: string[];
|
|
47
|
-
$value: DTCGValue;
|
|
48
|
-
$type?: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Type guard to check if a value is a DTCG token (has $value).
|
|
53
|
-
*
|
|
54
|
-
* @param value - The value to check.
|
|
55
|
-
* @return True if the value is a DTCG token.
|
|
56
|
-
*/
|
|
57
|
-
function isDTCGToken( value: DTCGToken | DTCGGroup ): value is DTCGToken {
|
|
58
|
-
return '$value' in value;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Set a nested value in an object from a path array.
|
|
63
|
-
*
|
|
64
|
-
* @param object - The object to modify.
|
|
65
|
-
* @param pathParts - The path at which to set the value.
|
|
66
|
-
* @param value - The value to set.
|
|
67
|
-
*/
|
|
68
|
-
function setNestedValue(
|
|
69
|
-
object: Record< string, unknown >,
|
|
70
|
-
pathParts: string[],
|
|
71
|
-
value: any
|
|
72
|
-
): void {
|
|
73
|
-
let current = object;
|
|
74
|
-
|
|
75
|
-
for ( let i = 0; i < pathParts.length - 1; i++ ) {
|
|
76
|
-
const key = pathParts[ i ];
|
|
77
|
-
|
|
78
|
-
if ( ! ( key in current ) ) {
|
|
79
|
-
current[ key ] = {};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
current = current[ key ] as Record< string, unknown >;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
current[ pathParts[ pathParts.length - 1 ] ] = value;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Recursively extracts mode overrides from a DTCG token tree.
|
|
90
|
-
*
|
|
91
|
-
* @param object - The DTCG group to extract from.
|
|
92
|
-
* @param currentPath - The current path in the token tree.
|
|
93
|
-
* @param currentType - The $type inherited from parent groups.
|
|
94
|
-
* @return A map of mode names to their token overrides.
|
|
95
|
-
*/
|
|
96
|
-
function getModeOverrides(
|
|
97
|
-
object: DTCGGroup,
|
|
98
|
-
currentPath: string[] = [],
|
|
99
|
-
currentType?: string
|
|
100
|
-
): Map< string, ModeOverride[] > {
|
|
101
|
-
const modeOverrides = new Map< string, ModeOverride[] >();
|
|
102
|
-
|
|
103
|
-
// Check if this group defines a $type that should be inherited by children
|
|
104
|
-
const groupType = object.$type ?? currentType;
|
|
105
|
-
|
|
106
|
-
for ( const [ key, value ] of Object.entries( object ) ) {
|
|
107
|
-
// Skip DTCG metadata keys
|
|
108
|
-
if ( key.startsWith( '$' ) ) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const node = value as DTCGToken | DTCGGroup;
|
|
113
|
-
|
|
114
|
-
if ( isDTCGToken( node ) ) {
|
|
115
|
-
// Extract mode-specific values from extensions
|
|
116
|
-
const modes = node.$extensions?.mode;
|
|
117
|
-
if ( modes ) {
|
|
118
|
-
for ( const [ mode, modeValue ] of Object.entries( modes ) ) {
|
|
119
|
-
modeOverrides.set( mode, [
|
|
120
|
-
...( modeOverrides.get( mode ) ?? [] ),
|
|
121
|
-
{
|
|
122
|
-
path: [ ...currentPath, key ],
|
|
123
|
-
$value: modeValue,
|
|
124
|
-
$type: node.$type ?? groupType,
|
|
125
|
-
},
|
|
126
|
-
] );
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
// Recurse into nested groups, passing down the type
|
|
131
|
-
const nextPath = [ ...currentPath, key ];
|
|
132
|
-
const childOverrides = getModeOverrides(
|
|
133
|
-
node,
|
|
134
|
-
nextPath,
|
|
135
|
-
groupType
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
// Merge child results
|
|
139
|
-
for ( const [ mode, overrides ] of childOverrides ) {
|
|
140
|
-
modeOverrides.set( mode, [
|
|
141
|
-
...( modeOverrides.get( mode ) ?? [] ),
|
|
142
|
-
...overrides,
|
|
143
|
-
] );
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return modeOverrides;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Terrazzo plugin that generates mode-specific DTCG override files.
|
|
153
|
-
*
|
|
154
|
-
* For each mode found in tokens (via $extensions.mode), generates a separate
|
|
155
|
-
* JSON file per source file containing tokens that have values for that mode.
|
|
156
|
-
*
|
|
157
|
-
* @return A Terrazzo plugin that generates mode-specific DTCG override files.
|
|
158
|
-
*/
|
|
159
|
-
export default function pluginModeOverrides(): Plugin {
|
|
160
|
-
return {
|
|
161
|
-
name: '@wordpress/terrazzo-plugin-mode-overrides',
|
|
162
|
-
async build( { outputFile, sources } ) {
|
|
163
|
-
for ( const { filename, src } of sources ) {
|
|
164
|
-
if ( ! filename ) {
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Parse the source JSON file
|
|
169
|
-
let document: DTCGDocument;
|
|
170
|
-
try {
|
|
171
|
-
document = JSON.parse( src ) as DTCGDocument;
|
|
172
|
-
} catch ( error ) {
|
|
173
|
-
throw new Error(
|
|
174
|
-
`Could not parse ${ filename }\n\n${ error }`
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Extract mode overrides from this file
|
|
179
|
-
const fileOverrides = getModeOverrides( document );
|
|
180
|
-
|
|
181
|
-
// Generate a DTCG file for each mode found in this source file
|
|
182
|
-
for ( const [ mode, overrides ] of fileOverrides ) {
|
|
183
|
-
const output: Record< string, unknown > = {};
|
|
184
|
-
|
|
185
|
-
for ( const override of overrides ) {
|
|
186
|
-
const { path, $value, $type } = override;
|
|
187
|
-
setNestedValue( output, path, { $type, $value } );
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Output as {basename}.{mode}.json (e.g., dimension.compact.json)
|
|
191
|
-
const sourceDir = new URL( './', filename );
|
|
192
|
-
const outFileName = `${ basename(
|
|
193
|
-
filename.pathname,
|
|
194
|
-
'.json'
|
|
195
|
-
) }.${ mode }.json`;
|
|
196
|
-
const outFileUrl = new URL(
|
|
197
|
-
`modes/${ outFileName }`,
|
|
198
|
-
sourceDir
|
|
199
|
-
);
|
|
200
|
-
outputFile(
|
|
201
|
-
outFileUrl.href,
|
|
202
|
-
JSON.stringify( output, null, '\t' )
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
}
|
package/build/index.js.map
DELETED
package/docs/ds-tokens.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
This file is generated by @terrazzo/terrazzo-plugin-ds-tokens-docs.
|
|
3
|
-
Do not edit directly.
|
|
4
|
-
-->
|
|
5
|
-
|
|
6
|
-
# DS Tokens reference
|
|
7
|
-
|
|
8
|
-
## Semantic tokens
|
|
9
|
-
|
|
10
|
-
### Border
|
|
11
|
-
|
|
12
|
-
| Variable name | Description |
|
|
13
|
-
| --------------------------------------- | ------------------------------- |
|
|
14
|
-
| `--wpds-border-radius-surface-xs` | Extra small radius for surfaces |
|
|
15
|
-
| `--wpds-border-radius-surface-sm` | Small radius for surfaces |
|
|
16
|
-
| `--wpds-border-radius-surface-md` | Medium radius for surfaces |
|
|
17
|
-
| `--wpds-border-radius-surface-lg` | Large radius for surfaces |
|
|
18
|
-
| `--wpds-border-width-surface-xs` | Extra small width for surfaces |
|
|
19
|
-
| `--wpds-border-width-surface-sm` | Small width for surfaces |
|
|
20
|
-
| `--wpds-border-width-surface-md` | Medium width for surfaces |
|
|
21
|
-
| `--wpds-border-width-surface-lg` | Large width for surfaces |
|
|
22
|
-
| `--wpds-border-width-interactive-focus` | Border width for focus ring |
|
|
23
|
-
|
|
24
|
-
### Color
|
|
25
|
-
|
|
26
|
-
| Variable name | Description |
|
|
27
|
-
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
-
| `--wpds-color-bg-surface-neutral` | Background color for surfaces with normal emphasis. |
|
|
29
|
-
| `--wpds-color-bg-surface-neutral-strong` | Background color for surfaces with strong emphasis. |
|
|
30
|
-
| `--wpds-color-bg-surface-neutral-weak` | Background color for surfaces with weak emphasis. |
|
|
31
|
-
| `--wpds-color-bg-surface-brand` | Background color for surfaces with brand tone and normal emphasis. |
|
|
32
|
-
| `--wpds-color-bg-surface-success` | Background color for surfaces with success tone and normal emphasis. |
|
|
33
|
-
| `--wpds-color-bg-surface-success-weak` | Background color for surfaces with success tone and weak emphasis. |
|
|
34
|
-
| `--wpds-color-bg-surface-info` | Background color for surfaces with info tone and normal emphasis. |
|
|
35
|
-
| `--wpds-color-bg-surface-info-weak` | Background color for surfaces with info tone and weak emphasis. |
|
|
36
|
-
| `--wpds-color-bg-surface-warning` | Background color for surfaces with warning tone and normal emphasis. |
|
|
37
|
-
| `--wpds-color-bg-surface-warning-weak` | Background color for surfaces with warning tone and weak emphasis. |
|
|
38
|
-
| `--wpds-color-bg-surface-caution` | Background color for surfaces with caution tone and normal emphasis. |
|
|
39
|
-
| `--wpds-color-bg-surface-caution-weak` | Background color for surfaces with caution tone and weak emphasis. |
|
|
40
|
-
| `--wpds-color-bg-surface-error` | Background color for surfaces with error tone and normal emphasis. |
|
|
41
|
-
| `--wpds-color-bg-surface-error-weak` | Background color for surfaces with error tone and weak emphasis. |
|
|
42
|
-
| `--wpds-color-bg-interactive-neutral` | Background color for interactive elements with neutral tone and normal emphasis. |
|
|
43
|
-
| `--wpds-color-bg-interactive-neutral-active` | Background color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. |
|
|
44
|
-
| `--wpds-color-bg-interactive-neutral-disabled` | Background color for interactive elements with neutral tone and normal emphasis, in their disabled state. |
|
|
45
|
-
| `--wpds-color-bg-interactive-neutral-strong` | Background color for interactive elements with neutral tone and strong emphasis. |
|
|
46
|
-
| `--wpds-color-bg-interactive-neutral-strong-active` | Background color for interactive elements with neutral tone and strong emphasis that are hovered, focused, or active. |
|
|
47
|
-
| `--wpds-color-bg-interactive-neutral-strong-disabled` | Background color for interactive elements with neutral tone and strong emphasis, in their disabled state. |
|
|
48
|
-
| `--wpds-color-bg-interactive-neutral-weak` | Background color for interactive elements with neutral tone and weak emphasis. |
|
|
49
|
-
| `--wpds-color-bg-interactive-neutral-weak-active` | Background color for interactive elements with neutral tone and weak emphasis that are hovered, focused, or active. |
|
|
50
|
-
| `--wpds-color-bg-interactive-neutral-weak-disabled` | Background color for interactive elements with neutral tone and weak emphasis, in their disabled state. |
|
|
51
|
-
| `--wpds-color-bg-interactive-brand` | Background color for interactive elements with brand tone and normal emphasis. |
|
|
52
|
-
| `--wpds-color-bg-interactive-brand-active` | Background color for interactive elements with brand tone and normal emphasis that are hovered, focused, or active. |
|
|
53
|
-
| `--wpds-color-bg-interactive-brand-disabled` | Background color for interactive elements with brand tone and normal emphasis, in their disabled state. |
|
|
54
|
-
| `--wpds-color-bg-interactive-brand-strong` | Background color for interactive elements with brand tone and strong emphasis. |
|
|
55
|
-
| `--wpds-color-bg-interactive-brand-strong-active` | Background color for interactive elements with brand tone and strong emphasis that are hovered, focused, or active. |
|
|
56
|
-
| `--wpds-color-bg-interactive-brand-strong-disabled` | Background color for interactive elements with brand tone and strong emphasis, in their disabled state. |
|
|
57
|
-
| `--wpds-color-bg-interactive-brand-weak` | Background color for interactive elements with brand tone and weak emphasis. |
|
|
58
|
-
| `--wpds-color-bg-interactive-brand-weak-active` | Background color for interactive elements with brand tone and weak emphasis that are hovered, focused, or active. |
|
|
59
|
-
| `--wpds-color-bg-interactive-brand-weak-disabled` | Background color for interactive elements with brand tone and weak emphasis, in their disabled state. |
|
|
60
|
-
| `--wpds-color-bg-interactive-error` | Background color for interactive elements with error tone and normal emphasis. |
|
|
61
|
-
| `--wpds-color-bg-interactive-error-active` | Background color for interactive elements with error tone and normal emphasis that are hovered, focused, or active. |
|
|
62
|
-
| `--wpds-color-bg-interactive-error-disabled` | Background color for interactive elements with error tone and normal emphasis, in their disabled state. |
|
|
63
|
-
| `--wpds-color-bg-interactive-error-strong` | Background color for interactive elements with error tone and strong emphasis. |
|
|
64
|
-
| `--wpds-color-bg-interactive-error-strong-active` | Background color for interactive elements with error tone and strong emphasis that are hovered, focused, or active. |
|
|
65
|
-
| `--wpds-color-bg-interactive-error-strong-disabled` | Background color for interactive elements with error tone and strong emphasis, in their disabled state. |
|
|
66
|
-
| `--wpds-color-bg-interactive-error-weak` | Background color for interactive elements with error tone and weak emphasis. |
|
|
67
|
-
| `--wpds-color-bg-interactive-error-weak-active` | Background color for interactive elements with error tone and weak emphasis that are hovered, focused, or active. |
|
|
68
|
-
| `--wpds-color-bg-interactive-error-weak-disabled` | Background color for interactive elements with error tone and weak emphasis, in their disabled state. |
|
|
69
|
-
| `--wpds-color-bg-track-neutral-weak` | Background color for tracks with a neutral tone and weak emphasis (eg. scrollbar track). |
|
|
70
|
-
| `--wpds-color-bg-track-neutral` | Background color for tracks with a neutral tone and normal emphasis (eg. slider or progressbar track). |
|
|
71
|
-
| `--wpds-color-bg-thumb-neutral-weak` | Background color for thumbs with a neutral tone and weak emphasis (eg. scrollbar thumb). |
|
|
72
|
-
| `--wpds-color-bg-thumb-neutral-weak-active` | Background color for thumbs with a neutral tone and weak emphasis (eg. scrollbar thumb) that are hovered, focused, or active. |
|
|
73
|
-
| `--wpds-color-bg-thumb-brand` | Background color for thumbs with a brand tone and normal emphasis (eg. slider thumb and filled track). |
|
|
74
|
-
| `--wpds-color-bg-thumb-brand-active` | Background color for thumbs with a brand tone and normal emphasis (eg. slider thumb and filled track) that are hovered, focused, or active. |
|
|
75
|
-
| `--wpds-color-bg-thumb-brand-disabled` | Background color for thumbs with a brand tone and normal emphasis (eg. slider thumb and filled track), in their disabled state. |
|
|
76
|
-
| `--wpds-color-fg-content-neutral` | Foreground color for content like text with normal emphasis. |
|
|
77
|
-
| `--wpds-color-fg-content-neutral-weak` | Foreground color for content like text with weak emphasis. |
|
|
78
|
-
| `--wpds-color-fg-content-success` | Foreground color for content like text with success tone and normal emphasis. |
|
|
79
|
-
| `--wpds-color-fg-content-success-weak` | Foreground color for content like text with success tone and weak emphasis. |
|
|
80
|
-
| `--wpds-color-fg-content-info` | Foreground color for content like text with info tone and normal emphasis. |
|
|
81
|
-
| `--wpds-color-fg-content-info-weak` | Foreground color for content like text with info tone and weak emphasis. |
|
|
82
|
-
| `--wpds-color-fg-content-warning` | Foreground color for content like text with warning tone and normal emphasis. |
|
|
83
|
-
| `--wpds-color-fg-content-warning-weak` | Foreground color for content like text with warning tone and weak emphasis. |
|
|
84
|
-
| `--wpds-color-fg-content-caution` | Foreground color for content like text with caution tone and normal emphasis. |
|
|
85
|
-
| `--wpds-color-fg-content-caution-weak` | Foreground color for content like text with caution tone and weak emphasis. |
|
|
86
|
-
| `--wpds-color-fg-content-error` | Foreground color for content like text with error tone and normal emphasis. |
|
|
87
|
-
| `--wpds-color-fg-content-error-weak` | Foreground color for content like text with error tone and weak emphasis. |
|
|
88
|
-
| `--wpds-color-fg-interactive-neutral` | Foreground color for interactive elements with neutral tone and normal emphasis. |
|
|
89
|
-
| `--wpds-color-fg-interactive-neutral-active` | Foreground color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. |
|
|
90
|
-
| `--wpds-color-fg-interactive-neutral-disabled` | Foreground color for interactive elements with neutral tone and normal emphasis, in their disabled state. |
|
|
91
|
-
| `--wpds-color-fg-interactive-neutral-strong` | Foreground color for interactive elements with neutral tone and strong emphasis. |
|
|
92
|
-
| `--wpds-color-fg-interactive-neutral-strong-active` | Foreground color for interactive elements with neutral tone and strong emphasis that are hovered, focused, or active. |
|
|
93
|
-
| `--wpds-color-fg-interactive-neutral-strong-disabled` | Foreground color for interactive elements with neutral tone and strong emphasis, in their disabled state. |
|
|
94
|
-
| `--wpds-color-fg-interactive-neutral-weak` | Foreground color for interactive elements with neutral tone and weak emphasis. |
|
|
95
|
-
| `--wpds-color-fg-interactive-neutral-weak-disabled` | Foreground color for interactive elements with neutral tone and weak emphasis, in their disabled state. |
|
|
96
|
-
| `--wpds-color-fg-interactive-brand` | Foreground color for interactive elements with brand tone and normal emphasis. |
|
|
97
|
-
| `--wpds-color-fg-interactive-brand-active` | Foreground color for interactive elements with brand tone and normal emphasis that are hovered, focused, or active. |
|
|
98
|
-
| `--wpds-color-fg-interactive-brand-disabled` | Foreground color for interactive elements with brand tone and normal emphasis, in their disabled state. |
|
|
99
|
-
| `--wpds-color-fg-interactive-brand-strong` | Foreground color for interactive elements with brand tone and strong emphasis. |
|
|
100
|
-
| `--wpds-color-fg-interactive-brand-strong-active` | Foreground color for interactive elements with brand tone and strong emphasis that are hovered, focused, or active. |
|
|
101
|
-
| `--wpds-color-fg-interactive-brand-strong-disabled` | Foreground color for interactive elements with brand tone and strong emphasis, in their disabled state. |
|
|
102
|
-
| `--wpds-color-fg-interactive-error` | Foreground color for interactive elements with error tone and normal emphasis. |
|
|
103
|
-
| `--wpds-color-fg-interactive-error-active` | Foreground color for interactive elements with error tone and normal emphasis that are hovered, focused, or active. |
|
|
104
|
-
| `--wpds-color-fg-interactive-error-disabled` | Foreground color for interactive elements with error tone and normal emphasis, in their disabled state. |
|
|
105
|
-
| `--wpds-color-fg-interactive-error-strong` | Foreground color for interactive elements with error tone and strong emphasis. |
|
|
106
|
-
| `--wpds-color-fg-interactive-error-strong-active` | Foreground color for interactive elements with error tone and strong emphasis that are hovered, focused, or active. |
|
|
107
|
-
| `--wpds-color-fg-interactive-error-strong-disabled` | Foreground color for interactive elements with error tone and strong emphasis, in their disabled state. |
|
|
108
|
-
| `--wpds-color-stroke-surface-neutral` | Decorative stroke color used to define neutrally-toned surface boundaries with normal emphasis. |
|
|
109
|
-
| `--wpds-color-stroke-surface-neutral-weak` | Decorative stroke color used to define neutrally-toned surface boundaries with weak emphasis. |
|
|
110
|
-
| `--wpds-color-stroke-surface-neutral-strong` | Decorative stroke color used to define neutrally-toned surface boundaries with strong emphasis. |
|
|
111
|
-
| `--wpds-color-stroke-surface-brand` | Decorative stroke color used to define brand-toned surface boundaries with normal emphasis. |
|
|
112
|
-
| `--wpds-color-stroke-surface-brand-strong` | Decorative stroke color used to define brand-toned surface boundaries with strong emphasis. |
|
|
113
|
-
| `--wpds-color-stroke-surface-success` | Decorative stroke color used to define success-toned surface boundaries with normal emphasis. |
|
|
114
|
-
| `--wpds-color-stroke-surface-success-strong` | Decorative stroke color used to define success-toned surface boundaries with strong emphasis. |
|
|
115
|
-
| `--wpds-color-stroke-surface-info` | Decorative stroke color used to define info-toned surface boundaries with normal emphasis. |
|
|
116
|
-
| `--wpds-color-stroke-surface-info-strong` | Decorative stroke color used to define info-toned surface boundaries with strong emphasis. |
|
|
117
|
-
| `--wpds-color-stroke-surface-warning` | Decorative stroke color used to define warning-toned surface boundaries with normal emphasis. |
|
|
118
|
-
| `--wpds-color-stroke-surface-warning-strong` | Decorative stroke color used to define warning-toned surface boundaries with strong emphasis. |
|
|
119
|
-
| `--wpds-color-stroke-surface-error` | Decorative stroke color used to define error-toned surface boundaries with normal emphasis. |
|
|
120
|
-
| `--wpds-color-stroke-surface-error-strong` | Decorative stroke color used to define error-toned surface boundaries with strong emphasis. |
|
|
121
|
-
| `--wpds-color-stroke-interactive-neutral` | Accessible stroke color used for interactive neutrally-toned elements with normal emphasis. |
|
|
122
|
-
| `--wpds-color-stroke-interactive-neutral-active` | Accessible stroke color used for interactive neutrally-toned elements with normal emphasis that are hovered, focused, or active. |
|
|
123
|
-
| `--wpds-color-stroke-interactive-neutral-disabled` | Accessible stroke color used for interactive neutrally-toned elements with normal emphasis, in their disabled state. |
|
|
124
|
-
| `--wpds-color-stroke-interactive-neutral-strong` | Accessible stroke color used for interactive neutrally-toned elements with strong emphasis. |
|
|
125
|
-
| `--wpds-color-stroke-interactive-brand` | Accessible stroke color used for interactive brand-toned elements with normal emphasis. |
|
|
126
|
-
| `--wpds-color-stroke-interactive-brand-active` | Accessible stroke color used for interactive brand-toned elements with normal emphasis that are hovered, focused, or active. |
|
|
127
|
-
| `--wpds-color-stroke-interactive-error` | Accessible stroke color used for interactive error-toned elements with normal emphasis. |
|
|
128
|
-
| `--wpds-color-stroke-interactive-error-active` | Accessible stroke color used for interactive error-toned elements with normal emphasis that are hovered, focused, or active. |
|
|
129
|
-
| `--wpds-color-stroke-interactive-error-strong` | Accessible stroke color used for interactive error-toned elements with strong emphasis. |
|
|
130
|
-
| `--wpds-color-stroke-focus-brand` | Accessible stroke color applied to focus rings. |
|
|
131
|
-
|
|
132
|
-
### Dimension
|
|
133
|
-
|
|
134
|
-
| Variable name | Description |
|
|
135
|
-
| -------------------------------------- | ----------------------------------- |
|
|
136
|
-
| `--wpds-dimension-base` | Base dimension unit |
|
|
137
|
-
| `--wpds-dimension-padding-surface-2xs` | 2x extra small spacing for surfaces |
|
|
138
|
-
| `--wpds-dimension-padding-surface-xs` | Extra small spacing for surfaces |
|
|
139
|
-
| `--wpds-dimension-padding-surface-sm` | Small spacing for surfaces |
|
|
140
|
-
| `--wpds-dimension-padding-surface-md` | Medium spacing for surfaces |
|
|
141
|
-
| `--wpds-dimension-padding-surface-lg` | Large spacing for surfaces |
|
|
142
|
-
| `--wpds-dimension-gap-2xs` | 2x extra small gap |
|
|
143
|
-
| `--wpds-dimension-gap-xs` | Extra small gap |
|
|
144
|
-
| `--wpds-dimension-gap-sm` | Small gap |
|
|
145
|
-
| `--wpds-dimension-gap-md` | Medium gap |
|
|
146
|
-
| `--wpds-dimension-gap-lg` | Large gap |
|
|
147
|
-
| `--wpds-dimension-gap-xl` | Extra large gap |
|
|
148
|
-
|
|
149
|
-
### Elevation
|
|
150
|
-
|
|
151
|
-
| Variable name | Description |
|
|
152
|
-
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
153
|
-
| `--wpds-elevation-x-small` | For sections and containers that group related content and controls, which may overlap other content. Example: Preview Frame. |
|
|
154
|
-
| `--wpds-elevation-small` | For components that provide contextual feedback without being intrusive. Generally non-interruptive. Example: Tooltips, Snackbar. |
|
|
155
|
-
| `--wpds-elevation-medium` | For components that offer additional actions. Example: Menus, Command Palette |
|
|
156
|
-
| `--wpds-elevation-large` | For components that confirm decisions or handle necessary interruptions. Example: Modals. |
|
|
157
|
-
|
|
158
|
-
### Typography
|
|
159
|
-
|
|
160
|
-
| Variable name | Description |
|
|
161
|
-
| ---------------------------------- | ----------------------- |
|
|
162
|
-
| `--wpds-font-family-heading` | Headings font family |
|
|
163
|
-
| `--wpds-font-family-body` | Body font family |
|
|
164
|
-
| `--wpds-font-family-mono` | Monospace font family |
|
|
165
|
-
| `--wpds-font-size-x-small` | Extra small font size |
|
|
166
|
-
| `--wpds-font-size-small` | Small font size |
|
|
167
|
-
| `--wpds-font-size-medium` | Medium font size |
|
|
168
|
-
| `--wpds-font-size-large` | Large font size |
|
|
169
|
-
| `--wpds-font-size-x-large` | Extra large font size |
|
|
170
|
-
| `--wpds-font-size-2x-large` | 2X large font size |
|
|
171
|
-
| `--wpds-font-line-height-x-small` | Extra small line height |
|
|
172
|
-
| `--wpds-font-line-height-small` | Small line height |
|
|
173
|
-
| `--wpds-font-line-height-medium` | Medium line height |
|
|
174
|
-
| `--wpds-font-line-height-large` | Large line height |
|
|
175
|
-
| `--wpds-font-line-height-x-large` | Extra large line height |
|
|
176
|
-
| `--wpds-font-line-height-2x-large` | 2X large line height |
|
package/terrazzo.config.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { defineConfig } from '@terrazzo/cli';
|
|
5
|
-
import pluginCSS from '@terrazzo/plugin-css';
|
|
6
|
-
import { makeCSSVar } from '@terrazzo/token-tools/css';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import pluginModeOverrides from './bin/terrazzo-plugin-mode-overrides/index';
|
|
12
|
-
import pluginKnownWpdsCssVariables from './bin/terrazzo-plugin-known-wpds-css-variables/index';
|
|
13
|
-
import pluginDsTokenDocs from './bin/terrazzo-plugin-ds-tokens-docs/index';
|
|
14
|
-
import inlineAliasValues from './bin/terrazzo-plugin-inline-alias-values/index';
|
|
15
|
-
|
|
16
|
-
export default defineConfig( {
|
|
17
|
-
tokens: [
|
|
18
|
-
'./tokens/border.json',
|
|
19
|
-
'./tokens/color.json',
|
|
20
|
-
'./tokens/dimension.json',
|
|
21
|
-
'./tokens/elevation.json',
|
|
22
|
-
'./tokens/typography.json',
|
|
23
|
-
],
|
|
24
|
-
outDir: './src/prebuilt',
|
|
25
|
-
|
|
26
|
-
plugins: [
|
|
27
|
-
inlineAliasValues( {
|
|
28
|
-
pattern: /^wpds-color\.primitive\./,
|
|
29
|
-
filename: 'ts/color-tokens.ts',
|
|
30
|
-
tokenId: ( tokenId ) =>
|
|
31
|
-
tokenId
|
|
32
|
-
.replace( /\.primitive/, '' )
|
|
33
|
-
.replace( /^wpds-color\./, '' )
|
|
34
|
-
.replace( /\./g, '-' ),
|
|
35
|
-
} ),
|
|
36
|
-
inlineAliasValues( { pattern: /^wpds-dimension\.primitive\./ } ),
|
|
37
|
-
pluginCSS( {
|
|
38
|
-
filename: 'css/design-tokens.css',
|
|
39
|
-
variableName: ( token ) => makeCSSVar( token.id ),
|
|
40
|
-
baseSelector: ':root',
|
|
41
|
-
modeSelectors: [
|
|
42
|
-
{
|
|
43
|
-
tokens: [ 'wpds-dimension.*' ],
|
|
44
|
-
mode: '.',
|
|
45
|
-
selectors: [
|
|
46
|
-
"[data-wpds-theme-provider-id][data-wpds-density='default']",
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
tokens: [ 'wpds-dimension.*' ],
|
|
51
|
-
mode: 'compact',
|
|
52
|
-
selectors: [
|
|
53
|
-
"[data-wpds-theme-provider-id][data-wpds-density='compact']",
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
tokens: [ 'wpds-dimension.*' ],
|
|
58
|
-
mode: 'comfortable',
|
|
59
|
-
selectors: [
|
|
60
|
-
"[data-wpds-theme-provider-id][data-wpds-density='comfortable']",
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
mode: 'high-dpi',
|
|
65
|
-
selectors: [
|
|
66
|
-
'@media ( -webkit-min-device-pixel-ratio: 2 ), ( min-resolution: 192dpi )',
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
legacyHex: true,
|
|
71
|
-
} ),
|
|
72
|
-
pluginKnownWpdsCssVariables( {
|
|
73
|
-
filename: 'js/design-tokens.js',
|
|
74
|
-
} ),
|
|
75
|
-
pluginDsTokenDocs( {
|
|
76
|
-
filename: '../../docs/ds-tokens.md',
|
|
77
|
-
} ),
|
|
78
|
-
pluginModeOverrides(),
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
// Linter rules current error when multiple entry files are used
|
|
82
|
-
// See https://github.com/terrazzoapp/terrazzo/issues/505
|
|
83
|
-
// lint: {
|
|
84
|
-
// rules: {
|
|
85
|
-
// 'a11y/min-contrast': [
|
|
86
|
-
// 'error',
|
|
87
|
-
// {
|
|
88
|
-
// level: 'AA',
|
|
89
|
-
// pairs: [
|
|
90
|
-
// // Standard BG / FG pairs
|
|
91
|
-
// ...[
|
|
92
|
-
// 'color.primitive.neutral.1',
|
|
93
|
-
// 'color.primitive.neutral.2',
|
|
94
|
-
// 'color.primitive.neutral.3',
|
|
95
|
-
// 'color.primitive.primary.1',
|
|
96
|
-
// 'color.primitive.primary.2',
|
|
97
|
-
// 'color.primitive.primary.3',
|
|
98
|
-
// ].flatMap( ( bgToken ) =>
|
|
99
|
-
// [
|
|
100
|
-
// 'color.primitive.neutral.11',
|
|
101
|
-
// 'color.primitive.neutral.12',
|
|
102
|
-
// 'color.primitive.primary.11',
|
|
103
|
-
// 'color.primitive.primary.12',
|
|
104
|
-
// ].map( ( fgToken ) => ( {
|
|
105
|
-
// foreground: fgToken,
|
|
106
|
-
// background: bgToken,
|
|
107
|
-
// } ) )
|
|
108
|
-
// ),
|
|
109
|
-
// // Action pairs (ie. using step 9 as background)
|
|
110
|
-
// {
|
|
111
|
-
// foreground: 'color.primitive.primary.contrast',
|
|
112
|
-
// background: 'color.primitive.primary.9',
|
|
113
|
-
// },
|
|
114
|
-
// {
|
|
115
|
-
// foreground: 'color.primitive.primary.1',
|
|
116
|
-
// background: 'color.primitive.primary.9',
|
|
117
|
-
// },
|
|
118
|
-
// ],
|
|
119
|
-
// },
|
|
120
|
-
// ],
|
|
121
|
-
// },
|
|
122
|
-
// },
|
|
123
|
-
} );
|
package/tokens/border.json
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"wpds-border": {
|
|
3
|
-
"$type": "dimension",
|
|
4
|
-
"radius": {
|
|
5
|
-
"surface": {
|
|
6
|
-
"xs": {
|
|
7
|
-
"$value": { "value": 1, "unit": "px" },
|
|
8
|
-
"$description": "Extra small radius for surfaces"
|
|
9
|
-
},
|
|
10
|
-
"sm": {
|
|
11
|
-
"$value": { "value": 2, "unit": "px" },
|
|
12
|
-
"$description": "Small radius for surfaces"
|
|
13
|
-
},
|
|
14
|
-
"md": {
|
|
15
|
-
"$value": { "value": 4, "unit": "px" },
|
|
16
|
-
"$description": "Medium radius for surfaces"
|
|
17
|
-
},
|
|
18
|
-
"lg": {
|
|
19
|
-
"$value": { "value": 8, "unit": "px" },
|
|
20
|
-
"$description": "Large radius for surfaces"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"width": {
|
|
25
|
-
"surface": {
|
|
26
|
-
"xs": {
|
|
27
|
-
"$value": { "value": 1, "unit": "px" },
|
|
28
|
-
"$description": "Extra small width for surfaces"
|
|
29
|
-
},
|
|
30
|
-
"sm": {
|
|
31
|
-
"$value": { "value": 2, "unit": "px" },
|
|
32
|
-
"$description": "Small width for surfaces"
|
|
33
|
-
},
|
|
34
|
-
"md": {
|
|
35
|
-
"$value": { "value": 4, "unit": "px" },
|
|
36
|
-
"$description": "Medium width for surfaces"
|
|
37
|
-
},
|
|
38
|
-
"lg": {
|
|
39
|
-
"$value": { "value": 8, "unit": "px" },
|
|
40
|
-
"$description": "Large width for surfaces"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"interactive": {
|
|
44
|
-
"focus": {
|
|
45
|
-
"$value": { "value": 2, "unit": "px" },
|
|
46
|
-
"$description": "Border width for focus ring",
|
|
47
|
-
"$extensions": {
|
|
48
|
-
"mode": {
|
|
49
|
-
"high-dpi": { "value": 1.5, "unit": "px" }
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|