@atlaskit/tokens 1.43.1 → 1.44.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 +12 -0
- package/codemods/hypermod.config.tsx +2 -0
- package/codemods/remove-fallbacks-color/transform.tsx +26 -0
- package/dist/cjs/artifacts/replacement-mapping.js +1 -7
- package/dist/cjs/artifacts/themes/atlassian-typography-adg3.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-typography-minor3.js +2 -2
- package/dist/cjs/artifacts/token-default-values.js +1 -3
- package/dist/cjs/artifacts/token-names.js +1 -3
- package/dist/cjs/artifacts/tokens-raw/atlassian-typography-adg3.js +1 -63
- package/dist/cjs/artifacts/tokens-raw/atlassian-typography-minor3.js +1 -63
- package/dist/cjs/get-token-value.js +1 -1
- package/dist/cjs/get-token.js +1 -1
- package/dist/es2019/artifacts/replacement-mapping.js +1 -7
- package/dist/es2019/artifacts/themes/atlassian-typography-adg3.js +1 -3
- package/dist/es2019/artifacts/themes/atlassian-typography-minor3.js +1 -3
- package/dist/es2019/artifacts/token-default-values.js +1 -3
- package/dist/es2019/artifacts/token-names.js +1 -3
- package/dist/es2019/artifacts/tokens-raw/atlassian-typography-adg3.js +1 -63
- package/dist/es2019/artifacts/tokens-raw/atlassian-typography-minor3.js +1 -63
- package/dist/es2019/get-token-value.js +1 -1
- package/dist/es2019/get-token.js +1 -1
- package/dist/esm/artifacts/replacement-mapping.js +1 -7
- package/dist/esm/artifacts/themes/atlassian-typography-adg3.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-typography-minor3.js +2 -2
- package/dist/esm/artifacts/token-default-values.js +1 -3
- package/dist/esm/artifacts/token-names.js +1 -3
- package/dist/esm/artifacts/tokens-raw/atlassian-typography-adg3.js +1 -63
- package/dist/esm/artifacts/tokens-raw/atlassian-typography-minor3.js +1 -63
- package/dist/esm/get-token-value.js +1 -1
- package/dist/esm/get-token.js +1 -1
- package/dist/types/artifacts/replacement-mapping.d.ts +1 -1
- package/dist/types/artifacts/themes/atlassian-typography-adg3.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-typography-minor3.d.ts +2 -2
- package/dist/types/artifacts/token-default-values.d.ts +1 -3
- package/dist/types/artifacts/token-names.d.ts +1 -5
- package/dist/types/artifacts/tokens-raw/atlassian-typography-adg3.d.ts +1 -34
- package/dist/types/artifacts/tokens-raw/atlassian-typography-minor3.d.ts +1 -34
- package/dist/types/types.d.ts +0 -4
- package/dist/types-ts4.5/artifacts/replacement-mapping.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/themes/atlassian-typography-adg3.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-typography-minor3.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/token-default-values.d.ts +1 -3
- package/dist/types-ts4.5/artifacts/token-names.d.ts +1 -5
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-typography-adg3.d.ts +1 -34
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-typography-minor3.d.ts +1 -34
- package/dist/types-ts4.5/types.d.ts +0 -4
- package/package.json +6 -5
- package/codemods/css-to-design-tokens/__tests__/css-to-design-tokens.test.tsx +0 -489
- package/codemods/css-to-design-tokens/__tests__/utils.test.tsx +0 -145
- package/codemods/theme-to-design-tokens/__tests__/theme-to-design-tokens.test.tsx +0 -1104
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::4f8c980cdc8766c5383270928294aeac>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
declare const tokens: {
|
|
@@ -439,8 +439,6 @@ declare const tokens: {
|
|
|
439
439
|
readonly 'font.body': "--ds-font-body";
|
|
440
440
|
readonly 'font.body.small': "--ds-font-body-small";
|
|
441
441
|
readonly 'font.body.UNSAFE_small': "--ds-font-body-UNSAFE_small";
|
|
442
|
-
readonly 'font.ui': "--ds-font-ui";
|
|
443
|
-
readonly 'font.ui.small': "--ds-font-ui-small";
|
|
444
442
|
readonly 'font.code': "--ds-font-code";
|
|
445
443
|
readonly 'font.letterSpacing.0': "--ds-font-letterSpacing-0";
|
|
446
444
|
readonly 'font.letterSpacing.100': "--ds-font-letterSpacing-100";
|
|
@@ -910,8 +908,6 @@ export type CSSTokenMap = {
|
|
|
910
908
|
'font.body': 'var(--ds-font-body)';
|
|
911
909
|
'font.body.small': 'var(--ds-font-body-small)';
|
|
912
910
|
'font.body.UNSAFE_small': 'var(--ds-font-body-UNSAFE_small)';
|
|
913
|
-
'font.ui': 'var(--ds-font-ui)';
|
|
914
|
-
'font.ui.small': 'var(--ds-font-ui-small)';
|
|
915
911
|
'font.code': 'var(--ds-font-code)';
|
|
916
912
|
'font.letterSpacing.0': 'var(--ds-font-letterSpacing-0)';
|
|
917
913
|
'font.letterSpacing.100': 'var(--ds-font-letterSpacing-100)';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::9979a8f061dbdaddf43d0173981655c2>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
declare const tokens: ({
|
|
@@ -95,39 +95,6 @@ declare const tokens: ({
|
|
|
95
95
|
name: string;
|
|
96
96
|
path: string[];
|
|
97
97
|
cleanName: string;
|
|
98
|
-
} | {
|
|
99
|
-
attributes: {
|
|
100
|
-
group: string;
|
|
101
|
-
state: string;
|
|
102
|
-
introduced: string;
|
|
103
|
-
deprecated: string;
|
|
104
|
-
description: string;
|
|
105
|
-
responsiveSmallerVariant?: undefined;
|
|
106
|
-
};
|
|
107
|
-
value: string;
|
|
108
|
-
filePath: string;
|
|
109
|
-
isSource: boolean;
|
|
110
|
-
original: {
|
|
111
|
-
attributes: {
|
|
112
|
-
group: string;
|
|
113
|
-
state: string;
|
|
114
|
-
introduced: string;
|
|
115
|
-
deprecated: string;
|
|
116
|
-
description: string;
|
|
117
|
-
responsiveSmallerVariant?: undefined;
|
|
118
|
-
};
|
|
119
|
-
value: {
|
|
120
|
-
fontWeight: string;
|
|
121
|
-
fontSize: string;
|
|
122
|
-
lineHeight: string;
|
|
123
|
-
fontFamily: string;
|
|
124
|
-
fontStyle: string;
|
|
125
|
-
letterSpacing: string;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
name: string;
|
|
129
|
-
path: string[];
|
|
130
|
-
cleanName: string;
|
|
131
98
|
} | {
|
|
132
99
|
attributes: {
|
|
133
100
|
group: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::9e4504db147308499c5db002a01275ff>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
declare const tokens: ({
|
|
@@ -95,39 +95,6 @@ declare const tokens: ({
|
|
|
95
95
|
name: string;
|
|
96
96
|
path: string[];
|
|
97
97
|
cleanName: string;
|
|
98
|
-
} | {
|
|
99
|
-
attributes: {
|
|
100
|
-
group: string;
|
|
101
|
-
state: string;
|
|
102
|
-
introduced: string;
|
|
103
|
-
deprecated: string;
|
|
104
|
-
description: string;
|
|
105
|
-
responsiveSmallerVariant?: undefined;
|
|
106
|
-
};
|
|
107
|
-
value: string;
|
|
108
|
-
filePath: string;
|
|
109
|
-
isSource: boolean;
|
|
110
|
-
original: {
|
|
111
|
-
attributes: {
|
|
112
|
-
group: string;
|
|
113
|
-
state: string;
|
|
114
|
-
introduced: string;
|
|
115
|
-
deprecated: string;
|
|
116
|
-
description: string;
|
|
117
|
-
responsiveSmallerVariant?: undefined;
|
|
118
|
-
};
|
|
119
|
-
value: {
|
|
120
|
-
fontWeight: string;
|
|
121
|
-
fontSize: string;
|
|
122
|
-
lineHeight: string;
|
|
123
|
-
fontFamily: string;
|
|
124
|
-
fontStyle: string;
|
|
125
|
-
letterSpacing: string;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
name: string;
|
|
129
|
-
path: string[];
|
|
130
|
-
cleanName: string;
|
|
131
98
|
} | {
|
|
132
99
|
attributes: {
|
|
133
100
|
group: string;
|
|
@@ -1038,10 +1038,6 @@ export interface TypographyTokenSchema<TPalette extends {
|
|
|
1038
1038
|
xsmall: TypographyToken<TPalette>;
|
|
1039
1039
|
xxsmall: TypographyToken<TPalette>;
|
|
1040
1040
|
};
|
|
1041
|
-
ui: {
|
|
1042
|
-
'[default]': TypographyToken<TPalette>;
|
|
1043
|
-
small: TypographyToken<TPalette>;
|
|
1044
|
-
};
|
|
1045
1041
|
body: {
|
|
1046
1042
|
'[default]': TypographyToken<TPalette>;
|
|
1047
1043
|
small: TypographyToken<TPalette>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tokens",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"description": "Design tokens are the single source of truth to name and store design decisions.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,16 +38,17 @@
|
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"@babel/traverse": "^7.23.2",
|
|
40
40
|
"@babel/types": "^7.20.0",
|
|
41
|
-
"bind-event-listener": "^
|
|
41
|
+
"bind-event-listener": "^3.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^16.8.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@af/accessibility-testing": "*",
|
|
48
|
-
"@atlaskit/
|
|
49
|
-
"@atlaskit/
|
|
50
|
-
"@atlaskit/
|
|
48
|
+
"@atlaskit/calendar": "^14.2.0",
|
|
49
|
+
"@atlaskit/checkbox": "^13.1.0",
|
|
50
|
+
"@atlaskit/radio": "^6.1.3",
|
|
51
|
+
"@atlaskit/tooltip": "^18.2.1",
|
|
51
52
|
"@atlaskit/visual-regression": "*",
|
|
52
53
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
53
54
|
"@atlassian/codegen": "^0.1.0",
|
|
@@ -1,489 +0,0 @@
|
|
|
1
|
-
import { Parser } from 'jscodeshift';
|
|
2
|
-
|
|
3
|
-
import __noop from '@atlaskit/ds-lib/noop';
|
|
4
|
-
|
|
5
|
-
import transformer from '../transform';
|
|
6
|
-
|
|
7
|
-
/* eslint-disable no-console */
|
|
8
|
-
export async function withMockedConsoleWarn(fn: any) {
|
|
9
|
-
const originalWarn = console.warn;
|
|
10
|
-
const warn = jest.fn();
|
|
11
|
-
console.warn = warn;
|
|
12
|
-
|
|
13
|
-
await fn(warn);
|
|
14
|
-
|
|
15
|
-
console.warn = originalWarn;
|
|
16
|
-
}
|
|
17
|
-
/* eslint-enable no-console */
|
|
18
|
-
|
|
19
|
-
async function applyTransform(
|
|
20
|
-
transform: any,
|
|
21
|
-
input: string,
|
|
22
|
-
options: {
|
|
23
|
-
parser: string | Parser;
|
|
24
|
-
} = {
|
|
25
|
-
parser: 'babel',
|
|
26
|
-
},
|
|
27
|
-
) {
|
|
28
|
-
// Handle ES6 modules using default export for the transform
|
|
29
|
-
const transformer = transform.default ? transform.default : transform;
|
|
30
|
-
const output = await transformer(
|
|
31
|
-
{ source: input },
|
|
32
|
-
{
|
|
33
|
-
jscodeshift: __noop,
|
|
34
|
-
stats: __noop,
|
|
35
|
-
},
|
|
36
|
-
options || {},
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
return (output || '').trim();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
describe('PostCSS Transform', () => {
|
|
43
|
-
it(`standard CSS`, async () => {
|
|
44
|
-
const input = `
|
|
45
|
-
.normal {
|
|
46
|
-
color: #eeeeee;
|
|
47
|
-
}
|
|
48
|
-
.normal-selected {
|
|
49
|
-
color: #eeeeee;
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
const result = await applyTransform(transformer, input);
|
|
53
|
-
expect(result).toMatchInlineSnapshot(`
|
|
54
|
-
".normal {
|
|
55
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
56
|
-
}
|
|
57
|
-
.normal-selected {
|
|
58
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
59
|
-
}"
|
|
60
|
-
`);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it(`standard LESS`, async () => {
|
|
64
|
-
const input = `
|
|
65
|
-
.container {
|
|
66
|
-
.mixin-1();
|
|
67
|
-
.mixin-2;
|
|
68
|
-
.mixin-3 (@width: 100px) {
|
|
69
|
-
color: #eeeeee;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
const result = await applyTransform(transformer, input);
|
|
74
|
-
expect(result).toMatchInlineSnapshot(`
|
|
75
|
-
".container {
|
|
76
|
-
.mixin-1();
|
|
77
|
-
.mixin-2;
|
|
78
|
-
.mixin-3 (@width: 100px) {
|
|
79
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
80
|
-
}
|
|
81
|
-
}"
|
|
82
|
-
`);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it(`box-shadows`, async () => {
|
|
86
|
-
const input = `.container { box-shadow: 0px 1px 5px 0px var(--adg3-color-N40); }`;
|
|
87
|
-
const result = await applyTransform(transformer, input);
|
|
88
|
-
expect(result).toMatchInlineSnapshot(
|
|
89
|
-
`".container { box-shadow: var(MISSING_TOKEN, 0px 1px 5px 0px var(--adg3-color-N40)); }"`,
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it(`should not transform value with 'url()'`, async () => {
|
|
94
|
-
const input = `.user-time-icon { background: url(@spriteUrl) no-repeat; }`;
|
|
95
|
-
const result = await applyTransform(transformer, input);
|
|
96
|
-
expect(result).toMatchInlineSnapshot(
|
|
97
|
-
`".user-time-icon { background: url(@spriteUrl) no-repeat; }"`,
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it(`should not transform value with less functions`, async () => {
|
|
102
|
-
await withMockedConsoleWarn(async (warn: any) => {
|
|
103
|
-
const input = `.user-time-icon { background: lighten(@spriteUrl) no-repeat; }`;
|
|
104
|
-
const result = await applyTransform(transformer, input);
|
|
105
|
-
expect(result).toMatchInlineSnapshot(
|
|
106
|
-
`".user-time-icon { background: lighten(@spriteUrl) no-repeat; }"`,
|
|
107
|
-
);
|
|
108
|
-
expect(warn).toHaveBeenCalledTimes(1);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it(`should not transform box-shadow: none`, async () => {
|
|
113
|
-
const input = `.container { box-shadow: none; }`;
|
|
114
|
-
const result = await applyTransform(transformer, input);
|
|
115
|
-
expect(result).toMatchInlineSnapshot(`".container { box-shadow: none; }"`);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it(`should not transform border radius`, async () => {
|
|
119
|
-
const input = `.container { border-radius: 3px; }`;
|
|
120
|
-
const result = await applyTransform(transformer, input);
|
|
121
|
-
expect(result).toMatchInlineSnapshot(
|
|
122
|
-
`".container { border-radius: 3px; }"`,
|
|
123
|
-
);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it(`chained selectors`, async () => {
|
|
127
|
-
const input = `
|
|
128
|
-
h1,h2,h3 {
|
|
129
|
-
color: #eeeeee;
|
|
130
|
-
}
|
|
131
|
-
`;
|
|
132
|
-
const result = await applyTransform(transformer, input);
|
|
133
|
-
expect(result).toMatchInlineSnapshot(`
|
|
134
|
-
"h1,h2,h3 {
|
|
135
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
136
|
-
}"
|
|
137
|
-
`);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it(`does not transform CSS var declarations`, async () => {
|
|
141
|
-
const input = `--adg3-color-R50: #ffebe6;`;
|
|
142
|
-
const result = await applyTransform(transformer, input);
|
|
143
|
-
expect(result).toMatchInlineSnapshot(`"--adg3-color-R50: #ffebe6;"`);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it(`standard CSS with ADG3 variables`, async () => {
|
|
147
|
-
const input = `
|
|
148
|
-
.normal {
|
|
149
|
-
color: var(--adg3-color-N800);
|
|
150
|
-
color: var(--adg3-color-T400);
|
|
151
|
-
color: var(--adg3-color-B400);
|
|
152
|
-
}
|
|
153
|
-
`;
|
|
154
|
-
const result = await applyTransform(transformer, input);
|
|
155
|
-
expect(result).toMatchInlineSnapshot(`
|
|
156
|
-
".normal {
|
|
157
|
-
color: var(--ds-text, var(--adg3-color-N800));
|
|
158
|
-
color: var(--ds-text-accent-teal, var(--adg3-color-T400));
|
|
159
|
-
color: var(--ds-text-brand, var(--adg3-color-B400));
|
|
160
|
-
}"
|
|
161
|
-
`);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it(`deeply nested CSS`, async () => {
|
|
165
|
-
const input = `
|
|
166
|
-
.normal {
|
|
167
|
-
color: #eeeeee;
|
|
168
|
-
.deep {
|
|
169
|
-
color: #eeeeee;
|
|
170
|
-
.deeper {
|
|
171
|
-
color: #eeeeee;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
`;
|
|
176
|
-
const result = await applyTransform(transformer, input);
|
|
177
|
-
expect(result).toMatchInlineSnapshot(`
|
|
178
|
-
".normal {
|
|
179
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
180
|
-
.deep {
|
|
181
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
182
|
-
.deeper {
|
|
183
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}"
|
|
187
|
-
`);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it(`interaction states CSS`, async () => {
|
|
191
|
-
const input = `
|
|
192
|
-
.normal {
|
|
193
|
-
color: #eeeeee;
|
|
194
|
-
}
|
|
195
|
-
.normal:hover {
|
|
196
|
-
color: #eeeeee;
|
|
197
|
-
}
|
|
198
|
-
.normal:active {
|
|
199
|
-
color: #eeeeee;
|
|
200
|
-
}
|
|
201
|
-
`;
|
|
202
|
-
const result = await applyTransform(transformer, input);
|
|
203
|
-
expect(result).toMatchInlineSnapshot(`
|
|
204
|
-
".normal {
|
|
205
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
206
|
-
}
|
|
207
|
-
.normal:hover {
|
|
208
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
209
|
-
}
|
|
210
|
-
.normal:active {
|
|
211
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
212
|
-
}"
|
|
213
|
-
`);
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
it(`nested interaction states CSS`, async () => {
|
|
217
|
-
const input = `
|
|
218
|
-
.normal {
|
|
219
|
-
color: #eeeeee;
|
|
220
|
-
&:hover {
|
|
221
|
-
color: #eeeeee;
|
|
222
|
-
}
|
|
223
|
-
&:active {
|
|
224
|
-
color: #eeeeee;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
`;
|
|
228
|
-
const result = await applyTransform(transformer, input);
|
|
229
|
-
expect(result).toMatchInlineSnapshot(`
|
|
230
|
-
".normal {
|
|
231
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
232
|
-
&:hover {
|
|
233
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
234
|
-
}
|
|
235
|
-
&:active {
|
|
236
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
237
|
-
}
|
|
238
|
-
}"
|
|
239
|
-
`);
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it(`nested CSS`, async () => {
|
|
243
|
-
const input = `
|
|
244
|
-
.normal {
|
|
245
|
-
color: #000000;
|
|
246
|
-
width: var(--gutter-size);
|
|
247
|
-
.nested {
|
|
248
|
-
color: #000000;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
`;
|
|
252
|
-
const result = await applyTransform(transformer, input);
|
|
253
|
-
expect(result).toMatchInlineSnapshot(`
|
|
254
|
-
".normal {
|
|
255
|
-
color: var(--ds-text, #000000);
|
|
256
|
-
width: var(--gutter-size);
|
|
257
|
-
.nested {
|
|
258
|
-
color: var(--ds-text, #000000);
|
|
259
|
-
}
|
|
260
|
-
}"
|
|
261
|
-
`);
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it(`avoids already converted colors`, async () => {
|
|
265
|
-
const input = `
|
|
266
|
-
.normal {
|
|
267
|
-
color: var(--ds-text, #000000);
|
|
268
|
-
}
|
|
269
|
-
`;
|
|
270
|
-
const result = await applyTransform(transformer, input);
|
|
271
|
-
expect(result).toMatchInlineSnapshot(`
|
|
272
|
-
".normal {
|
|
273
|
-
color: var(--ds-text, #000000);
|
|
274
|
-
}"
|
|
275
|
-
`);
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it(`aliased adg-3 colors`, async () => {
|
|
279
|
-
const input = `
|
|
280
|
-
.container {
|
|
281
|
-
box-shadow: 0px 1px 5px 0px var(--adg3-color-N40);
|
|
282
|
-
border: 1px solid var(--adg3-color-N40);
|
|
283
|
-
}
|
|
284
|
-
`;
|
|
285
|
-
const result = await applyTransform(transformer, input);
|
|
286
|
-
expect(result).toMatchInlineSnapshot(`
|
|
287
|
-
".container {
|
|
288
|
-
box-shadow: var(MISSING_TOKEN, 0px 1px 5px 0px var(--adg3-color-N40));
|
|
289
|
-
border: 1px solid var(--ds-border, var(--adg3-color-N40));
|
|
290
|
-
}"
|
|
291
|
-
`);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it(`should transform border properties`, async () => {
|
|
295
|
-
const input = `
|
|
296
|
-
.normal {
|
|
297
|
-
border-top: 1px solid #eee;
|
|
298
|
-
border-bottom: 1px solid #eee;
|
|
299
|
-
}
|
|
300
|
-
`;
|
|
301
|
-
const result = await applyTransform(transformer, input);
|
|
302
|
-
expect(result).toMatchInlineSnapshot(`
|
|
303
|
-
".normal {
|
|
304
|
-
border-top: 1px solid var(--ds-surface-sunken, #eee);
|
|
305
|
-
border-bottom: 1px solid var(--ds-surface-sunken, #eee);
|
|
306
|
-
}"
|
|
307
|
-
`);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
it(`named colors`, async () => {
|
|
311
|
-
const input = `
|
|
312
|
-
.normal {
|
|
313
|
-
color: red;
|
|
314
|
-
color: crimson;
|
|
315
|
-
color: cyan;
|
|
316
|
-
color: darkblue;
|
|
317
|
-
color: darkcyan;
|
|
318
|
-
color: fuchsia;
|
|
319
|
-
color: lightgreen;
|
|
320
|
-
color: lightskyblue;
|
|
321
|
-
background-color: red;
|
|
322
|
-
background-color: crimson;
|
|
323
|
-
background-color: cyan;
|
|
324
|
-
background-color: darkblue;
|
|
325
|
-
background-color: darkcyan;
|
|
326
|
-
background-color: fuchsia;
|
|
327
|
-
background-color: lightgreen;
|
|
328
|
-
background-color: lightskyblue;
|
|
329
|
-
border-color: red;
|
|
330
|
-
border-color: crimson;
|
|
331
|
-
border-color: cyan;
|
|
332
|
-
border-color: darkblue;
|
|
333
|
-
border-color: darkcyan;
|
|
334
|
-
border-color: fuchsia;
|
|
335
|
-
border-color: lightgreen;
|
|
336
|
-
border-color: lightskyblue;
|
|
337
|
-
}
|
|
338
|
-
`;
|
|
339
|
-
const result = await applyTransform(transformer, input);
|
|
340
|
-
expect(result).toMatchInlineSnapshot(`
|
|
341
|
-
".normal {
|
|
342
|
-
color: var(--ds-text-accent-orange, red);
|
|
343
|
-
color: var(--ds-text-danger, crimson);
|
|
344
|
-
color: var(--ds-text-accent-teal, cyan);
|
|
345
|
-
color: var(--ds-text-accent-blue-bolder, darkblue);
|
|
346
|
-
color: var(--ds-text-accent-teal-bolder, darkcyan);
|
|
347
|
-
color: var(--ds-text-subtle, fuchsia);
|
|
348
|
-
color: var(--ds-text-accent-green, lightgreen);
|
|
349
|
-
color: var(--ds-text-accent-blue, lightskyblue);
|
|
350
|
-
background-color: var(--ds-background-danger, red);
|
|
351
|
-
background-color: var(--ds-background-danger, crimson);
|
|
352
|
-
background-color: var(--ds-background-accent-teal-subtle, cyan);
|
|
353
|
-
background-color: var(--ds-background-accent-blue-bolder, darkblue);
|
|
354
|
-
background-color: var(--ds-background-accent-teal-bolder, darkcyan);
|
|
355
|
-
background-color: var(--ds-background-accent-magenta-subtle, fuchsia);
|
|
356
|
-
background-color: var(--ds-background-accent-green-subtle, lightgreen);
|
|
357
|
-
background-color: var(--ds-background-accent-blue-subtle, lightskyblue);
|
|
358
|
-
border-color: var(--ds-border-accent-orange, red);
|
|
359
|
-
border-color: var(--ds-border-danger, crimson);
|
|
360
|
-
border-color: var(--ds-border-accent-teal, cyan);
|
|
361
|
-
border-color: var(--ds-border-accent-blue, darkblue);
|
|
362
|
-
border-color: var(--ds-border-accent-teal, darkcyan);
|
|
363
|
-
border-color: var(--ds-border-accent-magenta, fuchsia);
|
|
364
|
-
border-color: var(--ds-border-accent-green, lightgreen);
|
|
365
|
-
border-color: var(--ds-border-accent-blue, lightskyblue);
|
|
366
|
-
}"
|
|
367
|
-
`);
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
it(`raw colors`, async () => {
|
|
371
|
-
const input = `
|
|
372
|
-
.normal {
|
|
373
|
-
color: #ffffff;
|
|
374
|
-
color: #fff;
|
|
375
|
-
color: #000000;
|
|
376
|
-
color: #f0f0f0;
|
|
377
|
-
color: #eeeeee;
|
|
378
|
-
color: #cccccc;
|
|
379
|
-
color: #292929;
|
|
380
|
-
color: #003366;
|
|
381
|
-
background-color: #ffffff;
|
|
382
|
-
background-color: #fff;
|
|
383
|
-
background-color: #000000;
|
|
384
|
-
background-color: #f0f0f0;
|
|
385
|
-
background-color: #eeeeee;
|
|
386
|
-
background-color: #cccccc;
|
|
387
|
-
background-color: #292929;
|
|
388
|
-
background-color: #003366;
|
|
389
|
-
border-color: #ffffff;
|
|
390
|
-
border-color: #fff;
|
|
391
|
-
border-color: #000000;
|
|
392
|
-
border-color: #f0f0f0;
|
|
393
|
-
border-color: #eeeeee;
|
|
394
|
-
border-color: #cccccc;
|
|
395
|
-
border-color: #292929;
|
|
396
|
-
border-color: #003366;
|
|
397
|
-
}
|
|
398
|
-
`;
|
|
399
|
-
const result = await applyTransform(transformer, input);
|
|
400
|
-
expect(result).toMatchInlineSnapshot(`
|
|
401
|
-
".normal {
|
|
402
|
-
color: var(--ds-surface, #ffffff);
|
|
403
|
-
color: var(--ds-surface, #fff);
|
|
404
|
-
color: var(--ds-text, #000000);
|
|
405
|
-
color: var(--ds-surface, #f0f0f0);
|
|
406
|
-
color: var(--ds-surface-sunken, #eeeeee);
|
|
407
|
-
color: var(--ds-text-accent-gray, #cccccc);
|
|
408
|
-
color: var(--ds-text, #292929);
|
|
409
|
-
color: var(--ds-text, #003366);
|
|
410
|
-
background-color: var(--ds-surface, #ffffff);
|
|
411
|
-
background-color: var(--ds-surface, #fff);
|
|
412
|
-
background-color: var(--ds-background-input, #000000);
|
|
413
|
-
background-color: var(--ds-surface, #f0f0f0);
|
|
414
|
-
background-color: var(--ds-surface-sunken, #eeeeee);
|
|
415
|
-
background-color: var(--ds-background-accent-gray-subtle, #cccccc);
|
|
416
|
-
background-color: var(--ds-background-input, #292929);
|
|
417
|
-
background-color: var(--ds-background-input, #003366);
|
|
418
|
-
border-color: var(--ds-surface, #ffffff);
|
|
419
|
-
border-color: var(--ds-surface, #fff);
|
|
420
|
-
border-color: var(--ds-border, #000000);
|
|
421
|
-
border-color: var(--ds-surface, #f0f0f0);
|
|
422
|
-
border-color: var(--ds-surface-sunken, #eeeeee);
|
|
423
|
-
border-color: var(--ds-border-accent-gray, #cccccc);
|
|
424
|
-
border-color: var(--ds-border, #292929);
|
|
425
|
-
border-color: var(--ds-border, #003366);
|
|
426
|
-
}"
|
|
427
|
-
`);
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
it(`omits less variable use`, async () => {
|
|
431
|
-
const input = `.normal { border-bottom: @grid/2 solid @gh-background-color-column; }`;
|
|
432
|
-
const result = await applyTransform(transformer, input);
|
|
433
|
-
expect(result).toMatchInlineSnapshot(
|
|
434
|
-
`".normal { border-bottom: @grid/2 solid @gh-background-color-column; }"`,
|
|
435
|
-
);
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
it(`gradients`, async () => {
|
|
439
|
-
const input = `
|
|
440
|
-
.container {
|
|
441
|
-
background: linear-gradient(red, blue);
|
|
442
|
-
background: radial-gradient(red, blue);
|
|
443
|
-
background: conic-gradient(red, orange, yellow, green, blue);
|
|
444
|
-
}
|
|
445
|
-
`;
|
|
446
|
-
const result = await applyTransform(transformer, input);
|
|
447
|
-
expect(result).toMatchInlineSnapshot(`
|
|
448
|
-
".container {
|
|
449
|
-
background: linear-gradient(var(--ds-background-danger, red), var(--ds-background-accent-blue-subtle, blue));
|
|
450
|
-
background: radial-gradient(var(--ds-background-danger, red), var(--ds-background-accent-blue-subtle, blue));
|
|
451
|
-
background: conic-gradient(var(--ds-background-danger, red), var(--ds-background-input, orange), var(--ds-background-accent-yellow-subtle, yellow), var(--ds-background-accent-green-subtle, green), var(--ds-background-accent-blue-subtle, blue));
|
|
452
|
-
}"
|
|
453
|
-
`);
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
it(`border color`, async () => {
|
|
457
|
-
const input = `
|
|
458
|
-
.some-div {
|
|
459
|
-
border-color: red yellow green hsla(60, 90%, 50%, .8);
|
|
460
|
-
}
|
|
461
|
-
`;
|
|
462
|
-
const result = await applyTransform(transformer, input);
|
|
463
|
-
expect(result).toMatchInlineSnapshot(`
|
|
464
|
-
".some-div {
|
|
465
|
-
border-color: var(--ds-border-accent-orange, red) var(--ds-border-accent-yellow, yellow) var(--ds-border-accent-green, green) var(--ds-border, hsla(60, 90%, 50%, .8));
|
|
466
|
-
}"
|
|
467
|
-
`);
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
it(`other color properties`, async () => {
|
|
471
|
-
const input = `
|
|
472
|
-
.properties {
|
|
473
|
-
accent-color: darkred;
|
|
474
|
-
caret-color: red;
|
|
475
|
-
text-stroke: 4px navy;
|
|
476
|
-
scrollbar-color: rebeccapurple green;
|
|
477
|
-
}
|
|
478
|
-
`;
|
|
479
|
-
const result = await applyTransform(transformer, input);
|
|
480
|
-
expect(result).toMatchInlineSnapshot(`
|
|
481
|
-
".properties {
|
|
482
|
-
accent-color: var(--ds-background-accent-orange-bolder-hovered, darkred);
|
|
483
|
-
caret-color: var(--ds-background-accent-orange-subtler-hovered, red);
|
|
484
|
-
text-stroke: 4px var(--ds-text-accent-blue-bolder, navy);
|
|
485
|
-
scrollbar-color: var(--ds-text-accent-purple, rebeccapurple) var(--ds-text-accent-green, green);
|
|
486
|
-
}"
|
|
487
|
-
`);
|
|
488
|
-
});
|
|
489
|
-
});
|