@wordpress/theme 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -9
- package/bin/generate-default-ramps/index.ts +49 -0
- package/bin/generate-primitive-tokens/index.ts +14 -9
- package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +5 -24
- package/bin/terrazzo-plugin-figma-ds-token-manager/index.ts +11 -4
- package/bin/terrazzo-plugin-inline-alias-values/index.ts +84 -0
- package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +19 -39
- package/build/color-ramps/index.js +21 -39
- package/build/color-ramps/index.js.map +3 -3
- package/build/color-ramps/lib/color-utils.js +39 -0
- package/build/color-ramps/lib/color-utils.js.map +7 -0
- package/build/color-ramps/lib/constants.js +20 -27
- package/build/color-ramps/lib/constants.js.map +3 -3
- package/build/color-ramps/lib/default-ramps.js +220 -0
- package/build/color-ramps/lib/default-ramps.js.map +7 -0
- package/build/color-ramps/lib/find-color-with-constraints.js +60 -91
- package/build/color-ramps/lib/find-color-with-constraints.js.map +3 -3
- package/build/color-ramps/lib/index.js +77 -119
- package/build/color-ramps/lib/index.js.map +3 -3
- package/build/color-ramps/lib/ramp-configs.js +15 -14
- package/build/color-ramps/lib/ramp-configs.js.map +2 -2
- package/build/color-ramps/lib/register-color-spaces.js +7 -0
- package/build/color-ramps/lib/register-color-spaces.js.map +7 -0
- package/build/color-ramps/lib/taper-chroma.js +35 -27
- package/build/color-ramps/lib/taper-chroma.js.map +3 -3
- package/build/color-ramps/lib/types.js +2 -1
- package/build/color-ramps/lib/types.js.map +1 -1
- package/build/color-ramps/lib/utils.js +75 -11
- package/build/color-ramps/lib/utils.js.map +2 -2
- package/build/context.js +3 -2
- package/build/context.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/prebuilt/js/design-tokens.js +19 -11
- package/build/prebuilt/js/design-tokens.js.map +2 -2
- package/build/prebuilt/json/figma.json +165 -783
- package/build/prebuilt/ts/color-tokens.js +137 -0
- package/build/prebuilt/ts/color-tokens.js.map +7 -0
- package/build/private-apis.js +3 -2
- package/build/private-apis.js.map +1 -1
- package/build/theme-provider.js +19 -17
- package/build/theme-provider.js.map +4 -4
- package/build/token-id.js +30 -0
- package/build/token-id.js.map +7 -0
- package/build/types/css-modules.d.js +0 -1
- package/build/types.js +2 -1
- package/build/types.js.map +1 -1
- package/build/use-theme-provider-styles.js +67 -62
- package/build/use-theme-provider-styles.js.map +3 -3
- package/build-module/color-ramps/index.js +20 -28
- package/build-module/color-ramps/index.js.map +2 -2
- package/build-module/color-ramps/lib/color-utils.js +19 -0
- package/build-module/color-ramps/lib/color-utils.js.map +7 -0
- package/build-module/color-ramps/lib/constants.js +14 -11
- package/build-module/color-ramps/lib/constants.js.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.js +196 -0
- package/build-module/color-ramps/lib/default-ramps.js.map +7 -0
- package/build-module/color-ramps/lib/find-color-with-constraints.js +61 -87
- package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
- package/build-module/color-ramps/lib/index.js +85 -109
- package/build-module/color-ramps/lib/index.js.map +3 -3
- package/build-module/color-ramps/lib/ramp-configs.js +14 -13
- package/build-module/color-ramps/lib/ramp-configs.js.map +2 -2
- package/build-module/color-ramps/lib/register-color-spaces.js +7 -0
- package/build-module/color-ramps/lib/register-color-spaces.js.map +7 -0
- package/build-module/color-ramps/lib/taper-chroma.js +40 -16
- package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
- package/build-module/color-ramps/lib/utils.js +70 -6
- package/build-module/color-ramps/lib/utils.js.map +2 -2
- package/build-module/context.js +2 -1
- package/build-module/context.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/prebuilt/js/design-tokens.js +18 -10
- package/build-module/prebuilt/js/design-tokens.js.map +2 -2
- package/build-module/prebuilt/json/figma.json +165 -783
- package/build-module/prebuilt/ts/color-tokens.js +117 -0
- package/build-module/prebuilt/ts/color-tokens.js.map +7 -0
- package/build-module/private-apis.js +2 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/theme-provider.js +18 -6
- package/build-module/theme-provider.js.map +3 -3
- package/build-module/token-id.js +6 -0
- package/build-module/token-id.js.map +7 -0
- package/build-module/use-theme-provider-styles.js +69 -57
- package/build-module/use-theme-provider-styles.js.map +2 -2
- package/build-types/color-ramps/index.d.ts +9 -16
- package/build-types/color-ramps/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/color-utils.d.ts +22 -0
- package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -0
- package/build-types/color-ramps/lib/constants.d.ts +7 -9
- package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
- package/build-types/color-ramps/lib/default-ramps.d.ts +7 -0
- package/build-types/color-ramps/lib/default-ramps.d.ts.map +1 -0
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +8 -7
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
- package/build-types/color-ramps/lib/index.d.ts +5 -2
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/register-color-spaces.d.ts +2 -0
- package/build-types/color-ramps/lib/register-color-spaces.d.ts.map +1 -0
- package/build-types/color-ramps/lib/taper-chroma.d.ts +7 -3
- package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
- package/build-types/color-ramps/lib/utils.d.ts +28 -5
- package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/prebuilt/ts/color-tokens.d.ts +7 -0
- package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts.map +1 -1
- package/build-types/theme-provider.d.ts.map +1 -1
- package/build-types/token-id.d.ts +9 -0
- package/build-types/token-id.d.ts.map +1 -0
- package/build-types/use-theme-provider-styles.d.ts +4 -0
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/docs/ds-tokens.md +22 -156
- package/package.json +19 -9
- package/src/color-ramps/index.ts +24 -41
- package/src/color-ramps/lib/color-utils.ts +34 -0
- package/src/color-ramps/lib/constants.ts +13 -9
- package/src/color-ramps/lib/default-ramps.ts +200 -0
- package/src/color-ramps/lib/find-color-with-constraints.ts +83 -116
- package/src/color-ramps/lib/index.ts +107 -145
- package/src/color-ramps/lib/ramp-configs.ts +3 -3
- package/src/color-ramps/lib/register-color-spaces.ts +13 -0
- package/src/color-ramps/lib/taper-chroma.ts +47 -19
- package/src/color-ramps/lib/utils.ts +117 -14
- package/src/color-ramps/stories/index.story.tsx +16 -22
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +45722 -376
- package/src/color-ramps/test/index.test.ts +68 -29
- package/src/prebuilt/css/design-tokens.css +88 -355
- package/src/prebuilt/js/design-tokens.js +17 -10
- package/src/prebuilt/json/figma.json +165 -783
- package/src/prebuilt/ts/color-tokens.ts +117 -0
- package/src/stories/index.story.tsx +4 -18
- package/src/test/token-id.test.ts +12 -0
- package/src/token-id.ts +9 -0
- package/src/use-theme-provider-styles.ts +67 -60
- package/terrazzo.config.ts +15 -12
- package/tokens/color.json +221 -69
- package/tokens/dimension.json +75 -0
- package/tsconfig.bin.json +13 -0
- package/tsconfig.bin.tsbuildinfo +1 -0
- package/tsconfig.json +6 -4
- package/tsconfig.src.json +9 -0
- package/tsconfig.src.tsbuildinfo +1 -0
- package/bin/build-tokens.js +0 -83
- package/build/color-ramps/lib/cache-utils.js +0 -57
- package/build/color-ramps/lib/cache-utils.js.map +0 -7
- package/build/prebuilt/ts/design-tokens.js +0 -354
- package/build/prebuilt/ts/design-tokens.js.map +0 -7
- package/build/style.module.css.js +0 -2
- package/build-module/color-ramps/lib/cache-utils.js +0 -31
- package/build-module/color-ramps/lib/cache-utils.js.map +0 -7
- package/build-module/prebuilt/ts/design-tokens.js +0 -334
- package/build-module/prebuilt/ts/design-tokens.js.map +0 -7
- package/build-module/style.module.css.js +0 -1
- package/build-style/style.css +0 -3
- package/build-types/color-ramps/lib/cache-utils.d.ts +0 -22
- package/build-types/color-ramps/lib/cache-utils.d.ts.map +0 -1
- package/build-types/prebuilt/ts/design-tokens.d.ts +0 -7
- package/build-types/prebuilt/ts/design-tokens.d.ts.map +0 -1
- package/src/color-ramps/lib/cache-utils.ts +0 -56
- package/src/prebuilt/ts/design-tokens.ts +0 -335
- package/tokens/spacing.json +0 -45
- package/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -9,35 +9,95 @@ A theming package that's part of the WordPress Design System. It has two parts:
|
|
|
9
9
|
|
|
10
10
|
In the **[Design Tokens Reference](docs/ds-tokens.md)** document there is a complete reference of all available design tokens including colors, spacing, typography, and more.
|
|
11
11
|
|
|
12
|
+
### Color Tokens
|
|
13
|
+
|
|
14
|
+
The design system defines color tokens using the following naming scheme:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
--wpds-<element>-<tone>[-<emphasis>][-<state>]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Element** specifies what the color is applied to.
|
|
21
|
+
|
|
22
|
+
| Value | Description |
|
|
23
|
+
| -------------------- | ------------------------------------------------------------------------------------------- |
|
|
24
|
+
| `bg-surface` | Backgrounds of layout or container surfaces. |
|
|
25
|
+
| `bg-interactive` | Backgrounds of interactive elements such as buttons, inputs, and toggles. |
|
|
26
|
+
| `bg-track` | Backgrounds of track components like scrollbars and slider tracks. |
|
|
27
|
+
| `bg-thumb` | Backgrounds of thumb components like scrollbar thumbs and slider thumbs. |
|
|
28
|
+
| `fg-content` | Foreground color for text and icons in static content. |
|
|
29
|
+
| `fg-interactive` | Foreground color for text and icons in interactive elements such as links and buttons. |
|
|
30
|
+
| `stroke-surface` | Decorative borders and dividers for non-interactive surfaces. |
|
|
31
|
+
| `stroke-interactive` | Accessible borders for interactive controls. |
|
|
32
|
+
| `stroke-focus` | Stroke color specifically for focus rings. |
|
|
33
|
+
|
|
34
|
+
**Tone** defines the semantic intent of the color.
|
|
35
|
+
|
|
36
|
+
| Value | Description |
|
|
37
|
+
| --------- | ---------------------------------------------------------------------------------------- |
|
|
38
|
+
| `neutral` | Neutrally toned UI elements. |
|
|
39
|
+
| `brand` | Brand-accented or primary action colors. |
|
|
40
|
+
| `success` | Positive or completed states. |
|
|
41
|
+
| `info` | Informational or system-generated context. |
|
|
42
|
+
| `caution` | Heads-up or low-severity issues; “proceed carefully.” |
|
|
43
|
+
| `warning` | Higher-severity or time-sensitive issues that require user attention but are not errors. |
|
|
44
|
+
| `error` | Blocking issues, validation failures, or destructive actions. |
|
|
45
|
+
|
|
46
|
+
> [!NOTE]
|
|
47
|
+
> `caution` and `warning` represent two escalation levels of non-error severity.
|
|
48
|
+
> Use **`caution`** for guidance or minor risks, and **`warning`** when the user must act to prevent an error.
|
|
49
|
+
|
|
50
|
+
**Emphasis** adjusts color strength relative to the base tone, if specified. The default is a normal emphasis.
|
|
51
|
+
|
|
52
|
+
| Value | Description |
|
|
53
|
+
| -------------------- | ------------------------------------------- |
|
|
54
|
+
| `strong` | Higher contrast and/or elevated emphasis. |
|
|
55
|
+
| `weak` | Subtle variant for secondary or muted elements. |
|
|
56
|
+
|
|
57
|
+
**State** represents the interactive state of the element, if specified. The default is an idle state.
|
|
58
|
+
|
|
59
|
+
| Value | Description |
|
|
60
|
+
| ---------- | ---------------------------------------- |
|
|
61
|
+
| `active` | Hovered, pressed, or selected state. |
|
|
62
|
+
| `disabled` | Unavailable or inoperable state. |
|
|
63
|
+
|
|
12
64
|
## Theme Provider
|
|
13
65
|
|
|
14
|
-
The `ThemeProvider` is a React component that should wrap your application to provide design tokens and theme context to the child UI components.
|
|
66
|
+
The `ThemeProvider` is a React component that should wrap your application to provide design tokens and theme context to the child UI components. It accepts a set of customizable seed values and automatically generates a set of design tokens, which are exposed as CSS custom properties for use throughout the application.
|
|
15
67
|
|
|
16
68
|
```tsx
|
|
17
69
|
import { ThemeProvider } from '@wordpress/theme';
|
|
18
70
|
|
|
19
71
|
function App() {
|
|
20
72
|
return (
|
|
21
|
-
<ThemeProvider color={ {
|
|
73
|
+
<ThemeProvider color={ { primary: 'blue' } }>
|
|
22
74
|
{ /* Your app content */ }
|
|
23
75
|
</ThemeProvider>
|
|
24
76
|
);
|
|
25
77
|
}
|
|
26
78
|
```
|
|
27
79
|
|
|
80
|
+
The `color` prop accepts an object with the following optional properties:
|
|
81
|
+
|
|
82
|
+
- `primary`: The primary/accent seed color (default: `'#3858e9'`)
|
|
83
|
+
- `bg`: The background seed color (default: `'#f8f8f8'`)
|
|
84
|
+
|
|
85
|
+
Both properties accept any valid CSS color value. The theme system automatically generates appropriate color ramps and determines light/dark mode based on these seed colors.
|
|
86
|
+
|
|
87
|
+
### Nesting Providers
|
|
88
|
+
|
|
28
89
|
The provider can be used recursively to override or modify the theme for a specific subtree.
|
|
29
90
|
|
|
30
91
|
```tsx
|
|
31
|
-
<ThemeProvider>
|
|
32
|
-
{ /*
|
|
33
|
-
<ThemeProvider color={ {
|
|
92
|
+
<ThemeProvider color={ { bg: 'white' } }>
|
|
93
|
+
{ /* light-themed UI components */ }
|
|
94
|
+
<ThemeProvider color={ { bg: '#1e1e1e' } }>
|
|
34
95
|
{ /* dark-themed UI components */ }
|
|
35
|
-
<ThemeProvider color={ {
|
|
36
|
-
{ /*
|
|
96
|
+
<ThemeProvider color={ { primary: 'red' } }>
|
|
97
|
+
{ /* dark-themed with red accent */ }
|
|
37
98
|
</ThemeProvider>
|
|
38
|
-
{ /* dark-themed UI components */ }
|
|
39
99
|
</ThemeProvider>
|
|
40
|
-
{ /*
|
|
100
|
+
{ /* light-themed UI components */ }
|
|
41
101
|
</ThemeProvider>
|
|
42
102
|
```
|
|
43
103
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { writeFile } from 'node:fs/promises';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_SEED_COLORS,
|
|
13
|
+
buildBgRamp,
|
|
14
|
+
buildAccentRamp,
|
|
15
|
+
} from '../../src/color-ramps/index.ts';
|
|
16
|
+
|
|
17
|
+
const __dirname = dirname( fileURLToPath( import.meta.url ) );
|
|
18
|
+
|
|
19
|
+
const bgRamp = buildBgRamp( DEFAULT_SEED_COLORS.bg );
|
|
20
|
+
const accentRamps = Object.fromEntries(
|
|
21
|
+
[ ...Object.entries( DEFAULT_SEED_COLORS ) ]
|
|
22
|
+
.filter( ( [ scaleName ] ) => scaleName !== 'bg' )
|
|
23
|
+
.map( ( [ scaleName, seed ] ) => [
|
|
24
|
+
scaleName,
|
|
25
|
+
buildAccentRamp( seed, bgRamp ),
|
|
26
|
+
] )
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const ramps = { bg: bgRamp, ...accentRamps };
|
|
30
|
+
|
|
31
|
+
const outputPath = join(
|
|
32
|
+
__dirname,
|
|
33
|
+
'../../src/color-ramps/lib/default-ramps.ts'
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const content = `
|
|
37
|
+
/**
|
|
38
|
+
* Internal dependencies
|
|
39
|
+
*/
|
|
40
|
+
import type { RampResult } from './types';
|
|
41
|
+
import type { DEFAULT_SEED_COLORS } from './constants';
|
|
42
|
+
|
|
43
|
+
export const DEFAULT_RAMPS: Record<
|
|
44
|
+
keyof typeof DEFAULT_SEED_COLORS,
|
|
45
|
+
RampResult
|
|
46
|
+
> = ${ JSON.stringify( ramps ) };
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
await writeFile( outputPath, content );
|
|
@@ -4,11 +4,19 @@
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
parse,
|
|
9
|
+
to,
|
|
10
|
+
serialize,
|
|
11
|
+
OKLCH,
|
|
12
|
+
sRGB,
|
|
13
|
+
type PlainColorObject,
|
|
14
|
+
} from 'colorjs.io/fn';
|
|
8
15
|
|
|
9
16
|
/**
|
|
10
17
|
* Internal dependencies
|
|
11
18
|
*/
|
|
19
|
+
import '../../src/color-ramps/lib/register-color-spaces';
|
|
12
20
|
import {
|
|
13
21
|
DEFAULT_SEED_COLORS,
|
|
14
22
|
buildBgRamp,
|
|
@@ -23,9 +31,9 @@ const colorJsonPath = path.join( __dirname, '../../tokens/color.json' );
|
|
|
23
31
|
|
|
24
32
|
const transformColorStringToDTCGValue = ( color: string ) => {
|
|
25
33
|
if ( /oklch|p3/.test( color ) ) {
|
|
26
|
-
let parsed:
|
|
34
|
+
let parsed: PlainColorObject;
|
|
27
35
|
try {
|
|
28
|
-
parsed =
|
|
36
|
+
parsed = to( parse( color ), OKLCH );
|
|
29
37
|
} catch {
|
|
30
38
|
return color;
|
|
31
39
|
}
|
|
@@ -39,7 +47,7 @@ const transformColorStringToDTCGValue = ( color: string ) => {
|
|
|
39
47
|
isNaN( coords[ 2 ] ) ? 0 : coords[ 2 ], // h
|
|
40
48
|
],
|
|
41
49
|
...( parsed.alpha < 1 ? { alpha: parsed.alpha } : undefined ),
|
|
42
|
-
hex:
|
|
50
|
+
hex: serialize( to( parsed, sRGB ), { format: 'hex' } ),
|
|
43
51
|
};
|
|
44
52
|
}
|
|
45
53
|
|
|
@@ -58,15 +66,12 @@ function generatePrimitiveColorTokens() {
|
|
|
58
66
|
);
|
|
59
67
|
|
|
60
68
|
// Build the ramps
|
|
61
|
-
const bgRamp = buildBgRamp(
|
|
69
|
+
const bgRamp = buildBgRamp( DEFAULT_SEED_COLORS.bg );
|
|
62
70
|
const accentRamps = [ ...Object.entries( DEFAULT_SEED_COLORS ) ]
|
|
63
71
|
.filter( ( [ scaleName ] ) => scaleName !== 'bg' )
|
|
64
72
|
.map( ( [ scaleName, seed ] ) => ( {
|
|
65
73
|
scaleName,
|
|
66
|
-
ramp: buildAccentRamp(
|
|
67
|
-
seed,
|
|
68
|
-
bgRamp,
|
|
69
|
-
} ),
|
|
74
|
+
ramp: buildAccentRamp( seed, bgRamp ),
|
|
70
75
|
} ) );
|
|
71
76
|
|
|
72
77
|
// Convert the ramp values in a DTCG compatible format
|
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
import { FORMAT_ID } from '@terrazzo/plugin-css';
|
|
5
5
|
import type { Plugin } from '@terrazzo/parser';
|
|
6
6
|
|
|
7
|
-
function isPrivateToken( token: string ) {
|
|
8
|
-
return /-private-/i.test( token );
|
|
9
|
-
}
|
|
10
|
-
|
|
11
7
|
function titleCase( str: string ) {
|
|
12
8
|
return str[ 0 ].toUpperCase() + str.slice( 1 );
|
|
13
9
|
}
|
|
@@ -24,7 +20,6 @@ export default function pluginDsTokenDocs( {
|
|
|
24
20
|
return;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
const primitiveTokens: TokensMap = {};
|
|
28
23
|
const semanticTokens: TokensMap = {};
|
|
29
24
|
// Re-use transformed tokens from the CSS plugin
|
|
30
25
|
for ( const token of getTransforms( {
|
|
@@ -46,24 +41,16 @@ export default function pluginDsTokenDocs( {
|
|
|
46
41
|
.at( -1 )
|
|
47
42
|
?.split( '.json' )[ 0 ] ?? 'Miscellaneous';
|
|
48
43
|
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
: semanticTokens;
|
|
53
|
-
tokensObject[ group ] ??= {};
|
|
54
|
-
tokensObject[ group ][ token.localID ] =
|
|
44
|
+
// Group by category
|
|
45
|
+
semanticTokens[ group ] ??= {};
|
|
46
|
+
semanticTokens[ group ][ token.localID ] =
|
|
55
47
|
token.token.$description ?? 'N/A';
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
function tokensToMdTable(
|
|
59
|
-
tokens: TokensMap,
|
|
60
|
-
isPrivate: boolean = false
|
|
61
|
-
) {
|
|
50
|
+
function tokensToMdTable( tokens: TokensMap ) {
|
|
62
51
|
return Object.entries( tokens )
|
|
63
52
|
.map( ( [ group, tokensInGroup ] ) => [
|
|
64
|
-
`### ${ titleCase( group ) }
|
|
65
|
-
isPrivate ? ' (private)' : ''
|
|
66
|
-
}`,
|
|
53
|
+
`### ${ titleCase( group ) }`,
|
|
67
54
|
'',
|
|
68
55
|
'| Variable name | Description |',
|
|
69
56
|
'|---|---|',
|
|
@@ -89,12 +76,6 @@ export default function pluginDsTokenDocs( {
|
|
|
89
76
|
'## Semantic tokens',
|
|
90
77
|
'',
|
|
91
78
|
...tokensToMdTable( semanticTokens ),
|
|
92
|
-
'',
|
|
93
|
-
'## Primitive tokens',
|
|
94
|
-
'',
|
|
95
|
-
'**🚨 Note: These tokens are only private implementation details of the Theme, and should never be referenced / consumed directly in the code.**',
|
|
96
|
-
'',
|
|
97
|
-
...tokensToMdTable( primitiveTokens, true ),
|
|
98
79
|
'', // final empty line
|
|
99
80
|
].join( '\n' )
|
|
100
81
|
);
|
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { Plugin, TokenNormalized } from '@terrazzo/parser';
|
|
5
5
|
import { transformCSSValue } from '@terrazzo/token-tools/css';
|
|
6
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
parse,
|
|
8
|
+
to,
|
|
9
|
+
serialize,
|
|
10
|
+
sRGB,
|
|
11
|
+
type ColorConstructor,
|
|
12
|
+
} from 'colorjs.io/fn';
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
15
|
* Internal dependencies
|
|
10
16
|
*/
|
|
17
|
+
import '../../src/color-ramps/lib/register-color-spaces';
|
|
11
18
|
import { FORMAT_JSON_ID } from './lib';
|
|
12
19
|
|
|
13
20
|
function titleCase( str: string ) {
|
|
@@ -113,15 +120,15 @@ function transformColorToken(
|
|
|
113
120
|
|
|
114
121
|
// Always convert to hex
|
|
115
122
|
// (easier to convert to Figma RGB, and includes clamping)
|
|
116
|
-
let convertedColor:
|
|
123
|
+
let convertedColor: ColorConstructor;
|
|
117
124
|
try {
|
|
118
|
-
convertedColor =
|
|
125
|
+
convertedColor = parse( cssColorValue );
|
|
119
126
|
} catch {
|
|
120
127
|
console.warn( 'Unexpected: could not convert token value to Color' );
|
|
121
128
|
return;
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
return
|
|
131
|
+
return serialize( to( convertedColor, sRGB ), { format: 'hex' } );
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
export default function pluginFigmaDsTokenManager( {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { type Plugin } from '@terrazzo/parser';
|
|
5
|
+
|
|
6
|
+
interface InlineAliasValuesOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Output filename for the generated aliased tokens mapping.
|
|
9
|
+
*/
|
|
10
|
+
filename?: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Pattern matching IDs of tokens whose values should be inlined into their alias references.
|
|
14
|
+
*/
|
|
15
|
+
pattern: RegExp;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Optional function to transform token IDs in the output.
|
|
19
|
+
*/
|
|
20
|
+
tokenId?: ( tokenId: string ) => string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Inlines the values of tokens matching the given pattern into their alias
|
|
25
|
+
* references. Matching tokens are removed from the output, and a TypeScript
|
|
26
|
+
* file is emitted with the mapping of aliased tokens.
|
|
27
|
+
*
|
|
28
|
+
* @param options The options for the plugin.
|
|
29
|
+
* @param options.filename
|
|
30
|
+
* @param options.pattern
|
|
31
|
+
* @param options.tokenId
|
|
32
|
+
*/
|
|
33
|
+
export default function inlineAliasValues( {
|
|
34
|
+
filename,
|
|
35
|
+
pattern,
|
|
36
|
+
tokenId = ( id ) => id,
|
|
37
|
+
}: InlineAliasValuesOptions ): Plugin {
|
|
38
|
+
const aliasedBy: Record< string, string[] > = {};
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
name: '@wordpress/terrazzo-plugin-inline-alias-values',
|
|
42
|
+
async transform( { tokens } ) {
|
|
43
|
+
Object.keys( tokens )
|
|
44
|
+
.filter( ( id ) => pattern.test( id ) )
|
|
45
|
+
.forEach( ( id ) => {
|
|
46
|
+
const token = tokens[ id ];
|
|
47
|
+
if ( token.aliasedBy ) {
|
|
48
|
+
aliasedBy[ tokenId( id ) ] =
|
|
49
|
+
token.aliasedBy.map( tokenId );
|
|
50
|
+
|
|
51
|
+
for ( const aliasedId of token.aliasedBy ) {
|
|
52
|
+
Object.assign( tokens[ aliasedId ], {
|
|
53
|
+
$value: token.$value,
|
|
54
|
+
mode: token.mode,
|
|
55
|
+
originalValue: token.originalValue,
|
|
56
|
+
} );
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
delete tokens[ id ];
|
|
61
|
+
} );
|
|
62
|
+
},
|
|
63
|
+
async build( { outputFile } ) {
|
|
64
|
+
if ( ! filename ) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const json = JSON.stringify( aliasedBy, null, 2 );
|
|
69
|
+
|
|
70
|
+
outputFile(
|
|
71
|
+
filename,
|
|
72
|
+
[
|
|
73
|
+
'/**',
|
|
74
|
+
' * This file is generated by the @wordpress/terrazzo-plugin-inline-alias-values plugin.',
|
|
75
|
+
' * Do not edit this file directly.',
|
|
76
|
+
' */',
|
|
77
|
+
'',
|
|
78
|
+
`export default ${ json } as Record< string, string[] >;`,
|
|
79
|
+
'',
|
|
80
|
+
].join( '\n' )
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -4,12 +4,8 @@
|
|
|
4
4
|
import { FORMAT_ID } from '@terrazzo/plugin-css';
|
|
5
5
|
import type { Plugin } from '@terrazzo/parser';
|
|
6
6
|
|
|
7
|
-
function isPrivateToken( token: string ) {
|
|
8
|
-
return /-private-/i.test( token );
|
|
9
|
-
}
|
|
10
|
-
|
|
11
7
|
export default function pluginKnownWpdsCssVariables( {
|
|
12
|
-
|
|
8
|
+
filename = 'design-tokens.js',
|
|
13
9
|
} = {} ): Plugin {
|
|
14
10
|
return {
|
|
15
11
|
name: '@terrazzo/plugin-known-wpds-css-variables',
|
|
@@ -31,42 +27,26 @@ export default function pluginKnownWpdsCssVariables( {
|
|
|
31
27
|
continue;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
tokensToExport[ token.localID ][ token.mode ] = token.value;
|
|
38
|
-
}
|
|
30
|
+
tokensToExport[ token.localID ] ??= {};
|
|
31
|
+
tokensToExport[ token.localID ][ token.mode ] = token.value;
|
|
39
32
|
}
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
: tokensToExport,
|
|
59
|
-
null,
|
|
60
|
-
2
|
|
61
|
-
) }${
|
|
62
|
-
filename.endsWith( '.ts' ) && modes
|
|
63
|
-
? ' as Record< string, Record< string, string > >'
|
|
64
|
-
: ''
|
|
65
|
-
}`,
|
|
66
|
-
'', // final empty line
|
|
67
|
-
].join( '\n' )
|
|
68
|
-
);
|
|
69
|
-
}
|
|
34
|
+
outputFile(
|
|
35
|
+
filename,
|
|
36
|
+
[
|
|
37
|
+
'/**',
|
|
38
|
+
' * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin.',
|
|
39
|
+
' * Do not edit this file directly.',
|
|
40
|
+
' */',
|
|
41
|
+
'',
|
|
42
|
+
`export default ${ JSON.stringify(
|
|
43
|
+
Array.from( new Set( Object.keys( tokensToExport ) ) ),
|
|
44
|
+
null,
|
|
45
|
+
2
|
|
46
|
+
) }`,
|
|
47
|
+
'', // final empty line
|
|
48
|
+
].join( '\n' )
|
|
49
|
+
);
|
|
70
50
|
},
|
|
71
51
|
};
|
|
72
52
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
5
|
var __export = (target, all) => {
|
|
9
6
|
for (var name in all)
|
|
@@ -17,15 +14,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
14
|
}
|
|
18
15
|
return to;
|
|
19
16
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/color-ramps/index.ts
|
|
29
20
|
var color_ramps_exports = {};
|
|
30
21
|
__export(color_ramps_exports, {
|
|
31
22
|
DEFAULT_SEED_COLORS: () => import_constants2.DEFAULT_SEED_COLORS,
|
|
@@ -34,48 +25,39 @@ __export(color_ramps_exports, {
|
|
|
34
25
|
checkAccessibleCombinations: () => checkAccessibleCombinations
|
|
35
26
|
});
|
|
36
27
|
module.exports = __toCommonJS(color_ramps_exports);
|
|
37
|
-
var
|
|
28
|
+
var import_fn = require("colorjs.io/fn");
|
|
29
|
+
var import_register_color_spaces = require("./lib/register-color-spaces");
|
|
38
30
|
var import_lib = require("./lib/index");
|
|
39
31
|
var import_utils = require("./lib/utils");
|
|
40
32
|
var import_ramp_configs = require("./lib/ramp-configs");
|
|
41
|
-
var
|
|
33
|
+
var import_color_utils = require("./lib/color-utils");
|
|
42
34
|
var import_constants = require("./lib/constants");
|
|
43
35
|
var import_constants2 = require("./lib/constants");
|
|
44
|
-
function buildBgRamp({
|
|
45
|
-
seed,
|
|
46
|
-
debug
|
|
47
|
-
}) {
|
|
36
|
+
function buildBgRamp(seed) {
|
|
48
37
|
if (typeof seed !== "string" || seed.trim() === "") {
|
|
49
38
|
throw new Error("Seed color must be a non-empty string");
|
|
50
39
|
}
|
|
51
|
-
return (0, import_lib.buildRamp)(seed, import_ramp_configs.BG_RAMP_CONFIG
|
|
40
|
+
return (0, import_lib.buildRamp)(seed, import_ramp_configs.BG_RAMP_CONFIG);
|
|
52
41
|
}
|
|
53
|
-
|
|
42
|
+
var STEP_TO_PIN = "surface2";
|
|
54
43
|
function getBgRampInfo(ramp) {
|
|
55
44
|
return {
|
|
56
45
|
mainDirection: ramp.direction,
|
|
57
46
|
pinLightness: {
|
|
58
47
|
stepName: STEP_TO_PIN,
|
|
59
48
|
value: (0, import_utils.clampAccentScaleReferenceLightness)(
|
|
60
|
-
|
|
49
|
+
(0, import_fn.get)((0, import_fn.parse)(ramp.ramp[STEP_TO_PIN].color), [import_fn.OKLCH, "l"]),
|
|
61
50
|
ramp.direction
|
|
62
51
|
)
|
|
63
52
|
}
|
|
64
53
|
};
|
|
65
54
|
}
|
|
66
|
-
function buildAccentRamp({
|
|
67
|
-
seed,
|
|
68
|
-
bgRamp,
|
|
69
|
-
debug
|
|
70
|
-
}) {
|
|
55
|
+
function buildAccentRamp(seed, bgRamp) {
|
|
71
56
|
if (typeof seed !== "string" || seed.trim() === "") {
|
|
72
57
|
throw new Error("Seed color must be a non-empty string");
|
|
73
58
|
}
|
|
74
59
|
const bgRampInfo = bgRamp ? getBgRampInfo(bgRamp) : void 0;
|
|
75
|
-
return (0, import_lib.buildRamp)(seed, import_ramp_configs.ACCENT_RAMP_CONFIG,
|
|
76
|
-
...bgRampInfo,
|
|
77
|
-
debug
|
|
78
|
-
});
|
|
60
|
+
return (0, import_lib.buildRamp)(seed, import_ramp_configs.ACCENT_RAMP_CONFIG, bgRampInfo);
|
|
79
61
|
}
|
|
80
62
|
function checkAccessibleCombinations({
|
|
81
63
|
bgRamp,
|
|
@@ -86,14 +68,14 @@ function checkAccessibleCombinations({
|
|
|
86
68
|
import_constants.CONTRAST_COMBINATIONS.forEach(({ bgs, fgs, target }) => {
|
|
87
69
|
for (const bg of bgs) {
|
|
88
70
|
for (const fg of fgs) {
|
|
89
|
-
const bgColor =
|
|
90
|
-
const fgColor =
|
|
91
|
-
if ((0,
|
|
71
|
+
const bgColor = (0, import_fn.parse)(ramp.ramp[bg].color);
|
|
72
|
+
const fgColor = (0, import_fn.parse)(ramp.ramp[fg].color);
|
|
73
|
+
if ((0, import_color_utils.getContrast)(bgColor, fgColor) < target) {
|
|
92
74
|
unmetTargets.push({
|
|
93
75
|
bgName: bg,
|
|
94
|
-
bgColor:
|
|
76
|
+
bgColor: (0, import_fn.serialize)(bgColor),
|
|
95
77
|
fgName: fg,
|
|
96
|
-
fgColor:
|
|
78
|
+
fgColor: (0, import_fn.serialize)(fgColor),
|
|
97
79
|
unmetContrast: target
|
|
98
80
|
});
|
|
99
81
|
}
|
|
@@ -105,14 +87,14 @@ function checkAccessibleCombinations({
|
|
|
105
87
|
import_constants.CONTRAST_COMBINATIONS.forEach(({ bgs, fgs, target }) => {
|
|
106
88
|
for (const bg of bgs) {
|
|
107
89
|
for (const fg of fgs) {
|
|
108
|
-
const bgColor =
|
|
109
|
-
const fgColor =
|
|
110
|
-
if ((0,
|
|
90
|
+
const bgColor = (0, import_fn.parse)(bgRamp.ramp[bg].color);
|
|
91
|
+
const fgColor = (0, import_fn.parse)(ramp.ramp[fg].color);
|
|
92
|
+
if ((0, import_color_utils.getContrast)(bgColor, fgColor) < target) {
|
|
111
93
|
unmetTargets.push({
|
|
112
94
|
bgName: bg,
|
|
113
|
-
bgColor:
|
|
95
|
+
bgColor: (0, import_fn.serialize)(bgColor),
|
|
114
96
|
fgName: fg,
|
|
115
|
-
fgColor:
|
|
97
|
+
fgColor: (0, import_fn.serialize)(fgColor),
|
|
116
98
|
unmetContrast: target
|
|
117
99
|
});
|
|
118
100
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/color-ramps/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_constants"
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH, parse, serialize } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './lib/register-color-spaces';\nimport { buildRamp } from './lib/index';\nimport { clampAccentScaleReferenceLightness } from './lib/utils';\nimport { BG_RAMP_CONFIG, ACCENT_RAMP_CONFIG } from './lib/ramp-configs';\nimport type {\n\tRampResult as InternalRampResult,\n\tRampDirection,\n\tRamp,\n} from './lib/types';\nimport { getContrast } from './lib/color-utils';\nimport { CONTRAST_COMBINATIONS } from './lib/constants';\nexport { DEFAULT_SEED_COLORS } from './lib/constants';\n\n/**\n * Creates a background ramp.\n * @param seed The seed color for the background ramp.\n */\nexport function buildBgRamp( seed: string ) {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\treturn buildRamp( seed, BG_RAMP_CONFIG );\n}\n\nconst STEP_TO_PIN = 'surface2';\nfunction getBgRampInfo( ramp: InternalRampResult ): {\n\tmainDirection: RampDirection;\n\tpinLightness: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} {\n\treturn {\n\t\tmainDirection: ramp.direction,\n\t\tpinLightness: {\n\t\t\tstepName: STEP_TO_PIN,\n\t\t\tvalue: clampAccentScaleReferenceLightness(\n\t\t\t\tget( parse( ramp.ramp[ STEP_TO_PIN ].color ), [ OKLCH, 'l' ] ),\n\t\t\t\tramp.direction\n\t\t\t),\n\t\t},\n\t};\n}\n\n/**\n * Creates an accent ramp (ie used by primary, success, info, warning and error\n * ramps).\n * @param seed The seed color for the accent ramp.\n * @param bgRamp The ramp of the background on which the accent is shown.\n */\nexport function buildAccentRamp(\n\tseed: string,\n\tbgRamp?: InternalRampResult\n): InternalRampResult {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\tconst bgRampInfo = bgRamp ? getBgRampInfo( bgRamp ) : undefined;\n\treturn buildRamp( seed, ACCENT_RAMP_CONFIG, bgRampInfo );\n}\n\n/**\n * Checks that all bg/fg combinations generated by the ramps meet contrast\n * targets.\n * @param params\n * @param params.bgRamp\n * @param params.accentRamps\n */\nexport function checkAccessibleCombinations( {\n\tbgRamp,\n\taccentRamps = [],\n}: {\n\tbgRamp: InternalRampResult;\n\taccentRamps?: InternalRampResult[];\n} ) {\n\tconst unmetTargets: {\n\t\tbgName: keyof Ramp;\n\t\tbgColor: string;\n\t\tfgName: keyof Ramp;\n\t\tfgColor: string;\n\t\tunmetContrast: number;\n\t}[] = [];\n\n\t// Assess combinations within each ramp\n\t[ bgRamp, ...accentRamps ].forEach( ( ramp ) => {\n\t\tCONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {\n\t\t\tfor ( const bg of bgs ) {\n\t\t\t\tfor ( const fg of fgs ) {\n\t\t\t\t\tconst bgColor = parse( ramp.ramp[ bg ].color );\n\t\t\t\t\tconst fgColor = parse( ramp.ramp[ fg ].color );\n\t\t\t\t\tif ( getContrast( bgColor, fgColor ) < target ) {\n\t\t\t\t\t\tunmetTargets.push( {\n\t\t\t\t\t\t\tbgName: bg,\n\t\t\t\t\t\t\tbgColor: serialize( bgColor ),\n\t\t\t\t\t\t\tfgName: fg,\n\t\t\t\t\t\t\tfgColor: serialize( fgColor ),\n\t\t\t\t\t\t\tunmetContrast: target,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n\t// Assess each accent ramp's fg color against bg ramp\n\taccentRamps.forEach( ( ramp ) => {\n\t\tCONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {\n\t\t\tfor ( const bg of bgs ) {\n\t\t\t\tfor ( const fg of fgs ) {\n\t\t\t\t\tconst bgColor = parse( bgRamp.ramp[ bg ].color );\n\t\t\t\t\tconst fgColor = parse( ramp.ramp[ fg ].color );\n\t\t\t\t\tif ( getContrast( bgColor, fgColor ) < target ) {\n\t\t\t\t\t\tunmetTargets.push( {\n\t\t\t\t\t\t\tbgName: bg,\n\t\t\t\t\t\t\tbgColor: serialize( bgColor ),\n\t\t\t\t\t\t\tfgName: fg,\n\t\t\t\t\t\t\tfgColor: serialize( fgColor ),\n\t\t\t\t\t\t\tunmetContrast: target,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn unmetTargets;\n}\n\nexport type RampResult = InternalRampResult;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA6C;AAK7C,mCAAO;AACP,iBAA0B;AAC1B,mBAAmD;AACnD,0BAAmD;AAMnD,yBAA4B;AAC5B,uBAAsC;AACtC,IAAAA,oBAAoC;AAM7B,SAAS,YAAa,MAAe;AAC3C,MAAK,OAAO,SAAS,YAAY,KAAK,KAAK,MAAM,IAAK;AACrD,UAAM,IAAI,MAAO,uCAAwC;AAAA,EAC1D;AAEA,aAAO,sBAAW,MAAM,kCAAe;AACxC;AAEA,IAAM,cAAc;AACpB,SAAS,cAAe,MAMtB;AACD,SAAO;AAAA,IACN,eAAe,KAAK;AAAA,IACpB,cAAc;AAAA,MACb,UAAU;AAAA,MACV,WAAO;AAAA,YACN,mBAAK,iBAAO,KAAK,KAAM,WAAY,EAAE,KAAM,GAAG,CAAE,iBAAO,GAAI,CAAE;AAAA,QAC7D,KAAK;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;AAQO,SAAS,gBACf,MACA,QACqB;AACrB,MAAK,OAAO,SAAS,YAAY,KAAK,KAAK,MAAM,IAAK;AACrD,UAAM,IAAI,MAAO,uCAAwC;AAAA,EAC1D;AAEA,QAAM,aAAa,SAAS,cAAe,MAAO,IAAI;AACtD,aAAO,sBAAW,MAAM,wCAAoB,UAAW;AACxD;AASO,SAAS,4BAA6B;AAAA,EAC5C;AAAA,EACA,cAAc,CAAC;AAChB,GAGI;AACH,QAAM,eAMA,CAAC;AAGP,GAAE,QAAQ,GAAG,WAAY,EAAE,QAAS,CAAE,SAAU;AAC/C,2CAAsB,QAAS,CAAE,EAAE,KAAK,KAAK,OAAO,MAAO;AAC1D,iBAAY,MAAM,KAAM;AACvB,mBAAY,MAAM,KAAM;AACvB,gBAAM,cAAU,iBAAO,KAAK,KAAM,EAAG,EAAE,KAAM;AAC7C,gBAAM,cAAU,iBAAO,KAAK,KAAM,EAAG,EAAE,KAAM;AAC7C,kBAAK,gCAAa,SAAS,OAAQ,IAAI,QAAS;AAC/C,yBAAa,KAAM;AAAA,cAClB,QAAQ;AAAA,cACR,aAAS,qBAAW,OAAQ;AAAA,cAC5B,QAAQ;AAAA,cACR,aAAS,qBAAW,OAAQ;AAAA,cAC5B,eAAe;AAAA,YAChB,CAAE;AAAA,UACH;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,cAAY,QAAS,CAAE,SAAU;AAChC,2CAAsB,QAAS,CAAE,EAAE,KAAK,KAAK,OAAO,MAAO;AAC1D,iBAAY,MAAM,KAAM;AACvB,mBAAY,MAAM,KAAM;AACvB,gBAAM,cAAU,iBAAO,OAAO,KAAM,EAAG,EAAE,KAAM;AAC/C,gBAAM,cAAU,iBAAO,KAAK,KAAM,EAAG,EAAE,KAAM;AAC7C,kBAAK,gCAAa,SAAS,OAAQ,IAAI,QAAS;AAC/C,yBAAa,KAAM;AAAA,cAClB,QAAQ;AAAA,cACR,aAAS,qBAAW,OAAQ;AAAA,cAC5B,QAAQ;AAAA,cACR,aAAS,qBAAW,OAAQ;AAAA,cAC5B,eAAe;AAAA,YAChB,CAAE;AAAA,UACH;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,SAAO;AACR;",
|
|
6
|
+
"names": ["import_constants"]
|
|
7
7
|
}
|