@yahoo/uds 0.2.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cli/README.md +78 -131
- package/cli/commands/purge.ts +7 -3
- package/cli/env.d.ts +1 -0
- package/cli/preload.ts +10 -0
- package/cli/utils/purgeCSS.test.ts +88 -8
- package/cli/utils/purgeCSS.ts +165 -15
- package/dist/Image.native-B3I4JoH3.d.cts +38 -0
- package/dist/Image.native-DUAFJodS.d.ts +38 -0
- package/dist/VStack-BHlRUsOR.d.cts +103 -0
- package/dist/VStack-DMb_RGRS.d.ts +103 -0
- package/dist/experimental/index.cjs +1 -1
- package/dist/experimental/index.d.cts +8 -8
- package/dist/experimental/index.d.ts +8 -8
- package/dist/experimental/index.js +1 -1
- package/dist/experimental/index.native.cjs +1 -1
- package/dist/experimental/index.native.d.cts +3 -3
- package/dist/experimental/index.native.d.ts +3 -3
- package/dist/experimental/index.native.js +1 -1
- package/dist/fixtures.cjs +1946 -0
- package/dist/fixtures.d.ts +81 -0
- package/dist/fixtures.js +1910 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +41 -236
- package/dist/index.d.ts +41 -236
- package/dist/index.js +1 -1
- package/dist/{index.native-CisPq4BI.d.ts → index.native-BTfOSmUx.d.ts} +1 -1
- package/dist/{index.native-DJlx-bfM.d.cts → index.native-Bm-r2Dpa.d.cts} +1 -1
- package/dist/index.native.cjs +1 -1
- package/dist/index.native.d.cts +20 -83
- package/dist/index.native.d.ts +20 -83
- package/dist/index.native.js +1 -1
- package/dist/styles/globals.css +0 -1
- package/dist/styles/toast.css +1 -0
- package/dist/styles/toast.d.cts +2 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/tailwindPlugin.cjs +1 -1
- package/dist/tailwindPlugin.d.cts +8 -2
- package/dist/tailwindPlugin.d.ts +8 -2
- package/dist/tailwindPlugin.js +1 -1
- package/dist/tailwindPurge/utils.cjs +1 -0
- package/dist/tailwindPurge/utils.d.cts +25 -0
- package/dist/tailwindPurge/utils.d.ts +25 -0
- package/dist/tailwindPurge/utils.js +1 -0
- package/dist/tailwindPurge.cjs +1 -1
- package/dist/tailwindPurge.d.cts +5 -1
- package/dist/tailwindPurge.d.ts +5 -1
- package/dist/tailwindPurge.js +1 -1
- package/dist/tokens/index.cjs +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/index.native.cjs +1 -1
- package/dist/tokens/index.native.d.cts +2 -2
- package/dist/tokens/index.native.d.ts +2 -2
- package/dist/tokens/index.native.js +1 -1
- package/dist/tokens/parseTokens.cjs +1 -1
- package/dist/tokens/parseTokens.d.cts +8 -18
- package/dist/tokens/parseTokens.d.ts +8 -18
- package/dist/tokens/parseTokens.js +1 -1
- package/dist/tokens/parseTokens.native.cjs +1 -1
- package/dist/tokens/parseTokens.native.d.cts +4 -21
- package/dist/tokens/parseTokens.native.d.ts +4 -21
- package/dist/tokens/parseTokens.native.js +1 -1
- package/dist/{types-CzJpH_Oi.d.cts → types-COiuE8XK.d.cts} +49 -138
- package/dist/{types-CzJpH_Oi.d.ts → types-COiuE8XK.d.ts} +49 -138
- package/package.json +26 -11
- package/dist/Image.native-C6kOWgnf.d.ts +0 -38
- package/dist/Image.native-VeXt5aeI.d.cts +0 -38
- package/dist/VStack-BSD9TbBd.d.cts +0 -114
- package/dist/VStack-Dk3-8IyU.d.ts +0 -114
- package/dist/fixtures/index.cjs +0 -1
- package/dist/fixtures/index.d.cts +0 -154
- package/dist/fixtures/index.d.ts +0 -154
- package/dist/fixtures/index.js +0 -1
package/cli/README.md
CHANGED
@@ -1,181 +1,128 @@
|
|
1
|
+
import { Box } from '@yahoo/uds';
|
2
|
+
import { RequiredChip } from '~/components/RequiredChip';
|
3
|
+
import { DocImage } from '~/components/DocImage';
|
4
|
+
|
1
5
|
# Universal CLI
|
2
6
|
|
3
|
-
|
7
|
+
> **Early preview notice**: The CLI tool currently requires Bun. This requirement may change in the future but you will need to install and use Bun locally to use the `uds` command.
|
4
8
|
|
5
|
-
Bluebun relies on Bun APIs and is designed to be extremely fast, with no-dependencies.
|
9
|
+
The Universal CLI is available as command, `uds`. The tool was created with [Bluebun](https://github.com/jamonholmgren/bluebun/) (inspired by [Gluegun](https://github.com/infinitered/gluegun)), but is specifically designed to be used with [Bun](https://bun.sh). Bluebun relies on Bun APIs and is designed to be extremely fast, with no-dependencies.
|
6
10
|
|
7
|
-
|
11
|
+
<Box justifyContent="center">
|
12
|
+
<DocImage light={{ src: '/images/cli-screenshot.png', width: 500, height: 356 }} />
|
13
|
+
</Box>
|
8
14
|
|
9
|
-
|
15
|
+
## Requirements
|
10
16
|
|
11
|
-
|
17
|
+
1. To use the CLI, first [install](/docs/getting-started/quick-start#installation) the `@yahoo/uds` package as a dependency in your package.json. This makes the tool available in your repo.
|
12
18
|
|
13
|
-
|
19
|
+
- Install Bun if you don't already have it:
|
14
20
|
|
15
|
-
|
21
|
+
```bash
|
22
|
+
curl -fsSL https://bun.sh/install | bash
|
23
|
+
```
|
16
24
|
|
17
|
-
|
25
|
+
## Commands
|
18
26
|
|
19
|
-
|
20
|
-
| ------- | -------- | --------------- |
|
21
|
-
| id | true | |
|
22
|
-
| outFile | false | ./uds.config.ts |
|
27
|
+
> **Note**: If you are _not_ running the CLI from a package.json script you will need to add `bun` before the binary in order to run it directly. i.e. `bun uds purge`
|
23
28
|
|
24
|
-
|
25
|
-
uds sync --id [id] --outFile [path]
|
29
|
+
The following command are available after installing `@yahoo/uds`:
|
26
30
|
|
27
|
-
|
28
|
-
```
|
31
|
+
### Sync
|
29
32
|
|
30
|
-
|
33
|
+
The `uds sync` command fetches the latest design config from the [Configurator](/docs/getting-started/using-configurator) and writes it to a file in your project.
|
31
34
|
|
32
|
-
|
33
|
-
| ------------ | -------- | --------------- |
|
34
|
-
| UDS_ID | true | |
|
35
|
-
| UDS_OUT_FILE | false | ./uds.config.ts |
|
35
|
+
#### Flags
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
| Flag | Description | Default | Required |
|
38
|
+
| --------- | --------------------------- | --------------- | ---------------- |
|
39
|
+
| `id` | ID from the Configurator | | <RequiredChip /> |
|
40
|
+
| `outFile` | File to write the output to | ./uds.config.ts | |
|
40
41
|
|
41
|
-
|
42
|
+
**Example:**
|
42
43
|
|
43
44
|
```shell
|
44
|
-
uds
|
45
|
-
uds
|
46
|
-
uds expo launch --profile [profile] --platform [ios|android]
|
47
|
-
uds expo update --profile [profile] --platform [ios|android]
|
48
|
-
uds expo --help
|
49
|
-
```
|
50
|
-
|
51
|
-
## Purge CSS
|
52
|
-
|
53
|
-
```shell
|
54
|
-
uds purge
|
45
|
+
uds sync --id [id] --outFile [path]
|
46
|
+
uds sync --id [id]
|
55
47
|
```
|
56
48
|
|
57
|
-
|
49
|
+
#### Enviornment variables
|
58
50
|
|
59
|
-
|
51
|
+
Alternatively, you can use environment variables instead of flags.
|
60
52
|
|
61
|
-
|
53
|
+
| Variable | Description | Default | Required |
|
54
|
+
| -------------- | --------------------------- | --------------- | ---------------- |
|
55
|
+
| `UDS_ID` | ID from the Configurator | | <RequiredChip /> |
|
56
|
+
| `UDS_OUT_FILE` | File to write the output to | ./uds.config.ts | |
|
62
57
|
|
63
|
-
|
58
|
+
**Example:**
|
64
59
|
|
60
|
+
```shell
|
61
|
+
UDS_ID=[id] UDS_OUT_FILE=[path] uds sync
|
65
62
|
```
|
66
|
-
cli/
|
67
|
-
commands/
|
68
|
-
pizza.ts # pizza
|
69
|
-
help.ts # pizza help
|
70
|
-
bake/
|
71
|
-
bake.ts # pizza bake
|
72
|
-
cheese.ts # pizza bake cheese
|
73
|
-
pepperoni.ts # pizza bake pepperoni
|
74
|
-
```
|
75
63
|
|
76
|
-
|
64
|
+
### Purge
|
65
|
+
|
66
|
+
The `uds purge` command is used to optimize and reduce the amount of CSS produced by your app.
|
77
67
|
|
78
|
-
|
68
|
+
Running this command produces a `./dist/safelist.ts` file in the root of your project. This file imported in your `tailwind.config.js` and passed to the `safelist` configuration option.
|
79
69
|
|
80
70
|
```typescript
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
// bake it!
|
89
|
-
},
|
71
|
+
/** @type {import('tailwindcss').Config} */
|
72
|
+
const { safelist } = require(`${__dirname}/dist/safelist.ts`);
|
73
|
+
|
74
|
+
module.exports = {
|
75
|
+
content: ['./pages/**/*.{html,jsx,tsx}', './components/**/*.{html,jsx,tsx}'],
|
76
|
+
safelist,
|
77
|
+
// ...
|
90
78
|
};
|
91
79
|
```
|
92
80
|
|
93
|
-
|
94
|
-
|
95
|
-
Commands have the following properties:
|
81
|
+
For more information about safelisting classes in Tailwind, visit the [official documentation](https://tailwindcss.com/docs/content-configuration#safelisting-classes)
|
96
82
|
|
97
|
-
|
98
|
-
- `description` - a description of the command for the automatic help system
|
99
|
-
- `alias` - an array of aliases for the command (can also be a single string)
|
100
|
-
- `run` - the function that is run when the command is run, usually `async`
|
83
|
+
**Example:**
|
101
84
|
|
102
|
-
|
103
|
-
|
104
|
-
|
85
|
+
```shell
|
86
|
+
uds purge
|
87
|
+
```
|
105
88
|
|
106
|
-
|
89
|
+
#### Enviornment variables
|
107
90
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
- `commandPath` - the path to the command that was run (e.g. `["bake", "cheese"]`)
|
112
|
-
- `arguments` - the positional arguments passed to the command (e.g. `["convection"]`)
|
113
|
-
- `options` - the options passed to the command (e.g. `{ sliced: true, temp: 400, time: 30 }`)
|
114
|
-
- `first` - the first argument passed to the command (e.g. `"convection"`)
|
115
|
-
- `second` - the second argument passed to the command (e.g. `undefined`)
|
116
|
-
- `third` - the third argument passed to the command (e.g. `undefined`)
|
91
|
+
| Variable | Description | Default | Required |
|
92
|
+
| ------------------------------- | ------------------------------------------- | ------- | -------- |
|
93
|
+
| `ENABLED_SCALE_AND_COLOR_MODES` | Selects which color and scale modes to keep | all | |
|
117
94
|
|
118
|
-
|
95
|
+
**Example:**
|
119
96
|
|
120
|
-
```
|
121
|
-
|
122
|
-
import { createPizza, slice } from './_pizza';
|
123
|
-
import { convectionBake, toasterBake, regularBake } from './_bakePizza';
|
124
|
-
|
125
|
-
export default {
|
126
|
-
name: 'bake',
|
127
|
-
description: 'Bake a pizza',
|
128
|
-
alias: ['b'],
|
129
|
-
run: async (props: Props) => {
|
130
|
-
const { first, second, third, options } = props;
|
131
|
-
|
132
|
-
const pizza = createPizza();
|
133
|
-
|
134
|
-
spinStart('Baking pizza...');
|
135
|
-
if (first === 'convection') {
|
136
|
-
await convectionBake(pizza, options.temp, options.time);
|
137
|
-
} else if (first === 'toaster') {
|
138
|
-
await toasterBake(pizza, options.temp, options.time);
|
139
|
-
} else {
|
140
|
-
await regularBake(pizza, options.temp, options.time);
|
141
|
-
}
|
142
|
-
spinStop('✅ Pizza baked!');
|
143
|
-
|
144
|
-
spinStart('Slicing pizza...');
|
145
|
-
if (options.sliced) {
|
146
|
-
await slice(pizza);
|
147
|
-
}
|
148
|
-
spinStop('✅ Pizza sliced!');
|
149
|
-
},
|
150
|
-
};
|
97
|
+
```shell
|
98
|
+
ENABLED_SCALE_AND_COLOR_MODES="dark,large" uds purge
|
151
99
|
```
|
152
100
|
|
153
|
-
|
101
|
+
### Expo (WIP)
|
154
102
|
|
155
|
-
|
103
|
+
The `uds expo` command is for building and launching React Native apps using Expo.
|
104
|
+
This command is still a WIP and is only used internally at the moment.
|
156
105
|
|
157
|
-
```
|
158
|
-
|
106
|
+
```shell
|
107
|
+
uds expo build --profile [profile] --platform [ios|android]
|
108
|
+
uds expo dev --profile [profile] --platform [ios|android]
|
109
|
+
uds expo launch --profile [profile] --platform [ios|android]
|
110
|
+
uds expo update --profile [profile] --platform [ios|android]
|
111
|
+
uds expo --help
|
159
112
|
```
|
160
113
|
|
161
|
-
|
114
|
+
## Development
|
115
|
+
|
116
|
+
The CLI is created with [Bluebun](https://github.com/jamonholmgren/bluebun/) (inspired by [Gluegun](https://github.com/infinitered/gluegun)), but specifically designed to be used with [Bun](https://bun.sh). Bluebun relies on Bun APIs and is designed to be extremely fast, with no-dependencies.
|
162
117
|
|
163
|
-
|
118
|
+
### Adding a command
|
164
119
|
|
165
|
-
|
166
|
-
- [cli](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/cli.md) - start the CLI without running the command
|
167
|
-
- [commandHelp](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/commandHelp.md) - get a list of all commands and their descriptions
|
120
|
+
Commands are organized in a tree structure in `uds/cli/commands`. The root command is the name of the CLI (`uds`) and in `uds.ts`, which subcommand being in its own file. See the Bluebun [Command docs](https://github.com/jamonholmgren/bluebun/blob/main/docs/commands.md) for more information on usage docs and creating command files.
|
168
121
|
|
169
|
-
|
122
|
+
**Important note:**
|
170
123
|
|
171
|
-
-
|
172
|
-
- [cursor](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/cursor.md) - manipulate the cursor
|
173
|
-
- [inputKey](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/inputKey.md) - wait for a single keypress
|
174
|
-
- [inputKeys](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/inputKeys.md) - wait for and handle multiple keypresses
|
124
|
+
Adding nested commands, i.e. `uds expo dev` does work correctly when UDS is consumed from npm. As a workaround, please see code for expo/expo.ts for re-routing sub-commands from the root command file. To verify your CLI command works correctly you should run `npm pack` within the packages/uds directory. Once you have your generated tarball you should copy that tarball to a test application such as https://github.com/yahoo-design/uds-nextjs-demo, then add `"@yahoo/uds": "file:./tarball-generated-from-npm-pack.tgz` to it's dependencies and run an install. Now you should be able to run `bun uds [your command name]` to test your functionality.
|
175
125
|
|
176
|
-
|
126
|
+
### API Reference
|
177
127
|
|
178
|
-
- [
|
179
|
-
- [spinner](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/spinner.md) - start and stop a spinner
|
180
|
-
- [progress](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/progress.md) - start, update, and stop a progress bar
|
181
|
-
- [styles and colors](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference/styles.md) - style and colorize text
|
128
|
+
Bluebun comes with a number of built-in utilities that are exported from the main `bluebun` package. See [reference guide](https://github.com/jamonholmgren/bluebun/blob/main/docs/reference.md) for more.
|
package/cli/commands/purge.ts
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
import { Props, spinStart, spinStop } from 'bluebun';
|
2
2
|
|
3
|
-
import { purge } from '../utils/purgeCSS';
|
3
|
+
import { purge, PurgeOptions } from '../utils/purgeCSS';
|
4
|
+
|
5
|
+
interface PurgeProps extends Props {
|
6
|
+
options: PurgeOptions;
|
7
|
+
}
|
4
8
|
|
5
9
|
export default {
|
6
10
|
name: 'purge',
|
7
11
|
description: `Purge unused CSS`,
|
8
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
9
|
-
run: async (props:
|
13
|
+
run: async (props: PurgeProps) => {
|
10
14
|
spinStart('Purging css...');
|
11
15
|
|
12
|
-
await purge();
|
16
|
+
await purge(props.options);
|
13
17
|
|
14
18
|
spinStop('✅', 'Purging css done!');
|
15
19
|
},
|
package/cli/env.d.ts
CHANGED
package/cli/preload.ts
CHANGED
@@ -29,4 +29,14 @@ mock.module('@yahoo/uds/tailwindPurge', () => ({
|
|
29
29
|
fontFamily:
|
30
30
|
'font-icons font-sans font-sans-beta font-sans-condensed font-serif-text font-serif-display font-display1 font-title1 font-title2 font-title3 font-title4 font-headline1 font-body1 font-label1 font-label2 font-caption1 font-caption2 font-legal1',
|
31
31
|
},
|
32
|
+
componentToTwClasses: {
|
33
|
+
Box: 'flex',
|
34
|
+
HStack: 'container fill',
|
35
|
+
Icon: 'flex fill outline',
|
36
|
+
Image: 'flex',
|
37
|
+
Pressable: 'flex',
|
38
|
+
Text: 'flex text',
|
39
|
+
VStack: 'container fill',
|
40
|
+
Button: '',
|
41
|
+
},
|
32
42
|
}));
|
@@ -1,20 +1,40 @@
|
|
1
|
+
import { defaultTokensConfig } from '@yahoo/uds/tokens';
|
1
2
|
import { describe, expect, it } from 'bun:test';
|
2
3
|
import { Project } from 'ts-morph';
|
3
4
|
|
4
5
|
import {
|
6
|
+
getClassesForEnabledThemesAndScales,
|
5
7
|
getComponentsToConvertToTW,
|
6
8
|
getFiles,
|
7
9
|
getTailwindSafelist,
|
10
|
+
getUsedProps,
|
8
11
|
isUDSComponent,
|
9
12
|
parseFiles,
|
10
13
|
} from './purgeCSS';
|
11
14
|
|
12
15
|
const PAGE_A_CODE = `
|
13
|
-
import { Button } from '@yahoo/uds';
|
16
|
+
import { HStack, Button } from '@yahoo/uds';
|
17
|
+
|
18
|
+
const functionWithProp = () => {
|
19
|
+
const vars = {
|
20
|
+
isActive: false
|
21
|
+
};
|
22
|
+
|
23
|
+
return {
|
24
|
+
...vars,
|
25
|
+
color: 'blue'
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
const AnotherComponent = () => {
|
30
|
+
const propsList = functionWithProp();
|
31
|
+
return <HStack test="test" {...propsList}>meow</HStack>
|
32
|
+
}
|
14
33
|
|
15
34
|
const PageA = () => {
|
16
35
|
return (
|
17
36
|
<div>
|
37
|
+
<HStack />
|
18
38
|
<Button> Click me </Button>
|
19
39
|
</div>
|
20
40
|
)
|
@@ -37,7 +57,7 @@ const PageB = () => {
|
|
37
57
|
`;
|
38
58
|
|
39
59
|
const FILES = ['/pages/PageA.tsx', '/pages/PageB.tsx'];
|
40
|
-
const IMPORTED_UDS_COMPONENTS = ['
|
60
|
+
const IMPORTED_UDS_COMPONENTS = ['HStack', 'Button', 'Spinner'];
|
41
61
|
|
42
62
|
describe('purgeCSS', () => {
|
43
63
|
const project = new Project();
|
@@ -67,11 +87,31 @@ describe('purgeCSS', () => {
|
|
67
87
|
|
68
88
|
describe('getTailwindSafelist', () => {
|
69
89
|
it('returns the tailwind classes corresponding to the props on a component', () => {
|
70
|
-
const res = getTailwindSafelist(IMPORTED_UDS_COMPONENTS);
|
71
|
-
|
72
|
-
expect(res).toEqual(
|
73
|
-
'
|
74
|
-
|
90
|
+
const res = getTailwindSafelist(project, IMPORTED_UDS_COMPONENTS);
|
91
|
+
|
92
|
+
expect(res).toEqual([
|
93
|
+
'container',
|
94
|
+
'fill',
|
95
|
+
'',
|
96
|
+
'items-start',
|
97
|
+
'items-end',
|
98
|
+
'items-center',
|
99
|
+
'items-stretch',
|
100
|
+
'items-baseline',
|
101
|
+
'justify-start',
|
102
|
+
'justify-end',
|
103
|
+
'justify-center',
|
104
|
+
'justify-between',
|
105
|
+
'justify-around',
|
106
|
+
'justify-evenly',
|
107
|
+
'text-accent',
|
108
|
+
'text-alert',
|
109
|
+
'text-black',
|
110
|
+
'text-brand',
|
111
|
+
'text-positive',
|
112
|
+
'text-warning',
|
113
|
+
'text-white',
|
114
|
+
]);
|
75
115
|
});
|
76
116
|
});
|
77
117
|
|
@@ -85,7 +125,7 @@ describe('purgeCSS', () => {
|
|
85
125
|
|
86
126
|
describe('isUDSComponent', () => {
|
87
127
|
it('returns true if the component is exported from UDS', () => {
|
88
|
-
const res = isUDSComponent('
|
128
|
+
const res = isUDSComponent('HStack');
|
89
129
|
|
90
130
|
expect(res).toBeTrue();
|
91
131
|
});
|
@@ -96,4 +136,44 @@ describe('purgeCSS', () => {
|
|
96
136
|
expect(res).toBeFalse();
|
97
137
|
});
|
98
138
|
});
|
139
|
+
|
140
|
+
describe('getUsedProps', () => {
|
141
|
+
it('return the list of all used props in the project for a given component', () => {
|
142
|
+
project.createSourceFile(FILES[0], PAGE_A_CODE, {
|
143
|
+
overwrite: true,
|
144
|
+
});
|
145
|
+
project.createSourceFile(FILES[1], PAGE_B_CODE, {
|
146
|
+
overwrite: true,
|
147
|
+
});
|
148
|
+
|
149
|
+
const usedProps = getUsedProps(project, 'HStack');
|
150
|
+
|
151
|
+
expect(usedProps).toEqual([
|
152
|
+
'test',
|
153
|
+
'color',
|
154
|
+
'isActive',
|
155
|
+
'flexGrow',
|
156
|
+
'alignItems',
|
157
|
+
'justifyContent',
|
158
|
+
]);
|
159
|
+
});
|
160
|
+
});
|
161
|
+
|
162
|
+
describe('getClassesForEnabledThemesAndScales', () => {
|
163
|
+
it('returns the list of classes related to the mode/themes we have in the config', () => {
|
164
|
+
const classes = getClassesForEnabledThemesAndScales(defaultTokensConfig);
|
165
|
+
|
166
|
+
expect(classes).toEqual([
|
167
|
+
'uds-color-mode-light',
|
168
|
+
'uds-color-mode-dark',
|
169
|
+
'uds-scale-mode-xsmall',
|
170
|
+
'uds-scale-mode-small',
|
171
|
+
'uds-scale-mode-medium',
|
172
|
+
'uds-scale-mode-large',
|
173
|
+
'uds-scale-mode-xlarge',
|
174
|
+
'uds-scale-mode-xxlarge',
|
175
|
+
'uds-scale-mode-xxxlarge',
|
176
|
+
]);
|
177
|
+
});
|
178
|
+
});
|
99
179
|
});
|