@apify/ui-library 0.76.2-featcolortokens-178953.24 → 0.76.3
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/.stylelintrc +12 -0
- package/CHANGELOG.md +3454 -0
- package/CODEOWNERS +7 -0
- package/README.md +5 -18
- package/dist/src/components/button.js +1 -1
- package/dist/src/components/button.js.map +1 -1
- package/dist/src/design_system/colors_theme.d.ts +213 -0
- package/dist/src/design_system/colors_theme.d.ts.map +1 -0
- package/dist/src/design_system/colors_theme.js +213 -0
- package/dist/src/design_system/colors_theme.js.map +1 -0
- package/dist/src/design_system/{colors/generated/properties_theme.d.ts → properties_theme.d.ts} +14 -18
- package/dist/src/design_system/properties_theme.d.ts.map +1 -0
- package/dist/src/design_system/{colors/generated/properties_theme.js → properties_theme.js} +154 -18
- package/dist/src/design_system/properties_theme.js.map +1 -0
- package/dist/src/design_system/theme.d.ts +87 -88
- package/dist/src/design_system/theme.d.ts.map +1 -1
- package/dist/src/design_system/theme.js +2 -1
- package/dist/src/design_system/theme.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/eslint.config.mjs +45 -0
- package/package.json +5 -11
- package/src/codemods/generate_color_property_tokens.mjs +98 -0
- package/src/codemods/generate_color_theme_files.mjs +47 -0
- package/src/components/button.tsx +1 -1
- package/src/design_system/{colors/generated/colors_theme.light.ts → colors_theme.ts} +143 -40
- package/src/design_system/generate_color_definitions.js +44 -0
- package/src/design_system/{colors/generated/properties_theme.ts → properties_theme.ts} +293 -19
- package/src/design_system/supernova_color_tokens.json +1766 -0
- package/src/design_system/theme.ts +2 -1
- package/src/index.ts +0 -1
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +10 -0
- package/dist/src/design_system/colors/generated/colors_theme.dark.d.ts +0 -110
- package/dist/src/design_system/colors/generated/colors_theme.dark.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/colors_theme.dark.js +0 -110
- package/dist/src/design_system/colors/generated/colors_theme.dark.js.map +0 -1
- package/dist/src/design_system/colors/generated/colors_theme.light.d.ts +0 -110
- package/dist/src/design_system/colors/generated/colors_theme.light.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/colors_theme.light.js +0 -110
- package/dist/src/design_system/colors/generated/colors_theme.light.js.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables.dark.d.ts +0 -5
- package/dist/src/design_system/colors/generated/css_variables.dark.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables.dark.js +0 -147
- package/dist/src/design_system/colors/generated/css_variables.dark.js.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables.light.d.ts +0 -5
- package/dist/src/design_system/colors/generated/css_variables.light.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables.light.js +0 -147
- package/dist/src/design_system/colors/generated/css_variables.light.js.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.dark.d.ts +0 -5
- package/dist/src/design_system/colors/generated/css_variables_palette.dark.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.dark.js +0 -74
- package/dist/src/design_system/colors/generated/css_variables_palette.dark.js.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.light.d.ts +0 -5
- package/dist/src/design_system/colors/generated/css_variables_palette.light.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.light.js +0 -74
- package/dist/src/design_system/colors/generated/css_variables_palette.light.js.map +0 -1
- package/dist/src/design_system/colors/generated/properties_theme.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/properties_theme.js.map +0 -1
- package/dist/src/design_system/colors/index.d.ts +0 -8
- package/dist/src/design_system/colors/index.d.ts.map +0 -1
- package/dist/src/design_system/colors/index.js +0 -8
- package/dist/src/design_system/colors/index.js.map +0 -1
- package/src/design_system/colors/build_color_tokens.js +0 -183
- package/src/design_system/colors/figma_color_tokens.dark.json +0 -886
- package/src/design_system/colors/figma_color_tokens.light.json +0 -886
- package/src/design_system/colors/generated/colors_theme.dark.ts +0 -110
- package/src/design_system/colors/generated/css_variables.dark.ts +0 -147
- package/src/design_system/colors/generated/css_variables.light.ts +0 -147
- package/src/design_system/colors/generated/css_variables_palette.dark.ts +0 -74
- package/src/design_system/colors/generated/css_variables_palette.light.ts +0 -74
- package/src/design_system/colors/index.ts +0 -7
- package/style/colors/dark.scss +0 -148
- package/style/colors/light.scss +0 -148
- package/style/colors/palette.dark.scss +0 -75
- package/style/colors/palette.light.scss +0 -75
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import react from 'eslint-plugin-react';
|
|
2
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
3
|
+
import sonarjs from 'eslint-plugin-sonarjs';
|
|
4
|
+
|
|
5
|
+
import apifyJestConfig from '@apify/eslint-config/jest.js';
|
|
6
|
+
import apifyTypescriptConfig from '@apify/eslint-config/ts.js';
|
|
7
|
+
|
|
8
|
+
/** @type {import('eslint').Linter.Config[]} */
|
|
9
|
+
// eslint-disable-next-line import/no-default-export
|
|
10
|
+
export default [
|
|
11
|
+
{ ignores: ['**/dist'] }, // Ignores need to happen first
|
|
12
|
+
...apifyTypescriptConfig,
|
|
13
|
+
...apifyJestConfig,
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
17
|
+
settings: {
|
|
18
|
+
react: {
|
|
19
|
+
version: 'detect',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
...react.configs.flat.recommended,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
plugins: {
|
|
26
|
+
sonarjs,
|
|
27
|
+
'react-hooks': reactHooks,
|
|
28
|
+
},
|
|
29
|
+
languageOptions: {
|
|
30
|
+
sourceType: 'module',
|
|
31
|
+
|
|
32
|
+
parserOptions: {
|
|
33
|
+
projectService: true,
|
|
34
|
+
tsconfigRootDir: import.meta.dirname,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
rules: {
|
|
38
|
+
'react/react-in-jsx-scope': 'off',
|
|
39
|
+
'no-void': 'off',
|
|
40
|
+
'react/display-name': 'off',
|
|
41
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
42
|
+
...reactHooks.configs.recommended.rules,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "0.76.
|
|
3
|
+
"version": "0.76.3",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"build": "npm run clean && npm run compile",
|
|
18
18
|
"clean": "rimraf ./dist",
|
|
19
19
|
"compile": "tsc -p tsconfig.build.json",
|
|
20
|
-
"generate-theme": "node src/codemods/generate_typograpy_tokens_files.mjs && npm run lint:fix",
|
|
21
|
-
"
|
|
20
|
+
"generate-theme": "node ./src/codemods/generate_color_theme_files.mjs && node src/codemods/generate_color_property_tokens.mjs && node src/codemods/generate_typograpy_tokens_files.mjs && npm run lint:fix",
|
|
21
|
+
"generate-color-definition": "node ./src/design_system/generate_color_definitions.js",
|
|
22
22
|
"postpublish": "npm run clean"
|
|
23
23
|
},
|
|
24
24
|
"//": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"It's not nice, but helps us to get around the problem of multiple react instances."
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@apify/ui-icons": "^0.12.
|
|
29
|
+
"@apify/ui-icons": "^0.12.2",
|
|
30
30
|
"@floating-ui/react": "^0.26.2",
|
|
31
31
|
"@react-hook/resize-observer": "^2.0.2",
|
|
32
32
|
"clsx": "^2.0.0",
|
|
@@ -63,14 +63,8 @@
|
|
|
63
63
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
64
64
|
"eslint-plugin-sonarjs": "^1.0.3",
|
|
65
65
|
"recast": "^0.23.9",
|
|
66
|
-
"style-dictionary": "^4.4.0",
|
|
67
66
|
"typescript": "^5.1.6",
|
|
68
67
|
"typescript-eslint": "^8.24.0"
|
|
69
68
|
},
|
|
70
|
-
"
|
|
71
|
-
"dist",
|
|
72
|
-
"src",
|
|
73
|
-
"style"
|
|
74
|
-
],
|
|
75
|
-
"gitHead": "f06f0f5036c000f5f09fb098df165f7cef098298"
|
|
69
|
+
"gitHead": "0392e2df24f0e881cfe9598e37c00ed6313e0408"
|
|
76
70
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
+
import { print, types } from 'recast';
|
|
5
|
+
|
|
6
|
+
const { builders } = types;
|
|
7
|
+
|
|
8
|
+
const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
|
|
9
|
+
|
|
10
|
+
const lightColorTokens = JSON.parse(code).light;
|
|
11
|
+
|
|
12
|
+
const getObjectValueByPath = (obj, path) => {
|
|
13
|
+
return path.split('.').reduce((acc, part) => acc && acc[part], obj);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getColorPropertyName = (semanticCategory, property) => {
|
|
17
|
+
const semanticColorName = `${property.split(/[_ ]/).map((semanticPartName) => semanticPartName.toLowerCase()).join('-')}`;
|
|
18
|
+
|
|
19
|
+
// lower case and replace spaces with dashes
|
|
20
|
+
const semanticCategoryName = semanticCategory.toLowerCase().split(' ').join('-');
|
|
21
|
+
|
|
22
|
+
return `--color-${semanticCategoryName}-${semanticColorName}`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const generateColorPropertyTokens = (supernovaColorsDefinitions) => {
|
|
26
|
+
const mergedPalettes = { ...supernovaColorsDefinitions.Semantic, ...supernovaColorsDefinitions.Decorative };
|
|
27
|
+
|
|
28
|
+
const colorTheme = {};
|
|
29
|
+
for (const [category, palette] of Object.entries(mergedPalettes)) {
|
|
30
|
+
// convert to camelCase if there are multiple words in the category name
|
|
31
|
+
const categoryName = category
|
|
32
|
+
.split(' ')
|
|
33
|
+
.map((word, i) => (i === 0
|
|
34
|
+
? word.toLocaleLowerCase()
|
|
35
|
+
: `${word.charAt(0).toUpperCase()}${word.slice(1)}`),
|
|
36
|
+
)
|
|
37
|
+
.join('');
|
|
38
|
+
colorTheme[categoryName] = {};
|
|
39
|
+
|
|
40
|
+
for (const [key, { value }] of Object.entries(palette)) {
|
|
41
|
+
const [firstPart, ...rest] = key.split(' ');
|
|
42
|
+
const propertyName = `${firstPart.toLowerCase()}${rest.join('')}`;
|
|
43
|
+
|
|
44
|
+
const hexLocator = value.slice(1, -1);
|
|
45
|
+
const hex = value.startsWith('#') ? value : getObjectValueByPath(supernovaColorsDefinitions, hexLocator)?.value;
|
|
46
|
+
|
|
47
|
+
colorTheme[categoryName][propertyName] = {
|
|
48
|
+
variable: `var(${getColorPropertyName(category, key)})`,
|
|
49
|
+
hex,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return colorTheme;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const createPropertyDeclaration = (tokens) => {
|
|
58
|
+
const paletteArray = [];
|
|
59
|
+
|
|
60
|
+
for (const [paletteName, paletteProps] of [...Object.entries(tokens)]) {
|
|
61
|
+
const paletteItemsArray = [];
|
|
62
|
+
|
|
63
|
+
for (const [paletteItemName, { variable, hex }] of Object.entries(paletteProps)) {
|
|
64
|
+
const objectPropertyItem = builders.property(
|
|
65
|
+
'init',
|
|
66
|
+
builders.identifier(paletteItemName),
|
|
67
|
+
builders.literal(variable),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
objectPropertyItem.comments = [builders.commentBlock(` ${hex} `)];
|
|
71
|
+
|
|
72
|
+
paletteItemsArray.push(objectPropertyItem);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
paletteArray.push(builders.property(
|
|
76
|
+
'init',
|
|
77
|
+
builders.identifier(paletteName),
|
|
78
|
+
builders.objectExpression(paletteItemsArray),
|
|
79
|
+
));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return builders.exportNamedDeclaration(
|
|
83
|
+
builders.variableDeclaration('const', [
|
|
84
|
+
builders.variableDeclarator(
|
|
85
|
+
builders.identifier('colorProperties'),
|
|
86
|
+
builders.tsAsExpression(builders.objectExpression(paletteArray), builders.tsTypeReference(builders.identifier('const'))),
|
|
87
|
+
)]),
|
|
88
|
+
[],
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const generatedTokens = generateColorPropertyTokens(lightColorTokens);
|
|
93
|
+
|
|
94
|
+
const lightThemeDeclaration = createPropertyDeclaration(generatedTokens);
|
|
95
|
+
|
|
96
|
+
const printedCode = print(builders.program([lightThemeDeclaration])).code;
|
|
97
|
+
|
|
98
|
+
writeFileSync('./src/design_system/properties_theme.ts', printedCode);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
+
import { print, types } from 'recast';
|
|
5
|
+
|
|
6
|
+
const { builders } = types;
|
|
7
|
+
|
|
8
|
+
const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
|
|
9
|
+
|
|
10
|
+
const colorTokens = JSON.parse(code);
|
|
11
|
+
|
|
12
|
+
const lightThemeProperty = colorTokens.light;
|
|
13
|
+
const darkThemeProperty = colorTokens.dark;
|
|
14
|
+
|
|
15
|
+
function createThemeDeclaration(themeProperty, variableName) {
|
|
16
|
+
const paletteArray = [];
|
|
17
|
+
|
|
18
|
+
const { Decorative, Palette } = themeProperty;
|
|
19
|
+
|
|
20
|
+
for (const [paletteName, paletteProps] of [...Object.entries(Palette), ...Object.entries(Decorative)]) {
|
|
21
|
+
for (const [paletteItemName, paletteItem] of Object.entries(paletteProps)) {
|
|
22
|
+
paletteArray.push(
|
|
23
|
+
builders.property(
|
|
24
|
+
'init',
|
|
25
|
+
builders.identifier(`${paletteName.toLowerCase()}${paletteItemName}`),
|
|
26
|
+
builders.literal(paletteItem.value),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return builders.exportNamedDeclaration(
|
|
33
|
+
builders.variableDeclaration('const', [
|
|
34
|
+
builders.variableDeclarator(
|
|
35
|
+
builders.identifier(variableName),
|
|
36
|
+
builders.tsAsExpression(builders.objectExpression(paletteArray), builders.tsTypeReference(builders.identifier('const'))),
|
|
37
|
+
)]),
|
|
38
|
+
[],
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const lightThemeDeclaration = createThemeDeclaration(lightThemeProperty, 'lightTheme');
|
|
43
|
+
const darkThemeDeclaration = createThemeDeclaration(darkThemeProperty, 'darkTheme');
|
|
44
|
+
|
|
45
|
+
const printedCode = print(builders.program([lightThemeDeclaration, darkThemeDeclaration])).code;
|
|
46
|
+
|
|
47
|
+
writeFileSync('./src/design_system/colors_theme.ts', printedCode);
|
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
export const lightTheme = {
|
|
6
|
-
roseLight: '#f483b5',
|
|
7
|
-
roseBase: '#c6387d',
|
|
8
|
-
roseDark: '#781552',
|
|
9
|
-
roseText: '#b6006b',
|
|
10
|
-
buttercupLight: '#ffdd96',
|
|
11
|
-
buttercupBase: '#f0b21b',
|
|
12
|
-
buttercupDark: '#c37319',
|
|
13
|
-
buttercupText: '#a65d00',
|
|
14
|
-
paprikaLight: '#e44467',
|
|
15
|
-
paprikaBase: '#9b0238',
|
|
16
|
-
paprikaDark: '#4a0018',
|
|
17
|
-
paprikaText: '#ba0044',
|
|
18
|
-
tealLight: '#a7f2ed',
|
|
19
|
-
tealBase: '#30c0bb',
|
|
20
|
-
tealDark: '#297774',
|
|
21
|
-
tealText: '#018181',
|
|
22
|
-
indigoLight: '#a1b7ff',
|
|
23
|
-
indigoBase: '#5d85e1',
|
|
24
|
-
indigoDark: '#365494',
|
|
25
|
-
indigoText: '#2563c1',
|
|
26
|
-
slateLight: '#c1c5e1',
|
|
27
|
-
slateBase: '#8490c4',
|
|
28
|
-
slateDark: '#525c85',
|
|
29
|
-
slateText: '#566087',
|
|
30
|
-
coralLight: '#ffc89f',
|
|
31
|
-
coralBase: '#fa8136',
|
|
32
|
-
coralDark: '#bb4511',
|
|
33
|
-
coralText: '#c74000',
|
|
34
|
-
lavenderLight: '#bf97ed',
|
|
35
|
-
lavenderBase: '#6a14de',
|
|
36
|
-
lavenderDark: '#330276',
|
|
37
|
-
lavenderText: '#6e00f4',
|
|
38
|
-
bambooLight: '#64cda5',
|
|
39
|
-
bambooBase: '#12966f',
|
|
40
|
-
bambooDark: '#195d46',
|
|
41
|
-
bambooText: '#007455',
|
|
42
2
|
neutral0: '#ffffff',
|
|
43
3
|
neutral25: '#f8f9fc',
|
|
44
4
|
neutral50: '#f3f4fa',
|
|
@@ -107,4 +67,147 @@ export const lightTheme = {
|
|
|
107
67
|
blue500: '#1672eb',
|
|
108
68
|
blue600: '#1a57da',
|
|
109
69
|
blue700: '#224ed5',
|
|
70
|
+
roseLight: '#f483b5',
|
|
71
|
+
roseBase: '#c6387d',
|
|
72
|
+
roseDark: '#781552',
|
|
73
|
+
roseText: '#b6006b',
|
|
74
|
+
buttercupLight: '#ffdd96',
|
|
75
|
+
buttercupBase: '#f0b21b',
|
|
76
|
+
buttercupDark: '#c37319',
|
|
77
|
+
buttercupText: '#a65d00',
|
|
78
|
+
paprikaLight: '#e44467',
|
|
79
|
+
paprikaBase: '#9b0238',
|
|
80
|
+
paprikaDark: '#4a0018',
|
|
81
|
+
paprikaText: '#ba0044',
|
|
82
|
+
tealLight: '#a7f2ed',
|
|
83
|
+
tealBase: '#30c0bb',
|
|
84
|
+
tealDark: '#297774',
|
|
85
|
+
tealText: '#018181',
|
|
86
|
+
indigoLight: '#a1b7ff',
|
|
87
|
+
indigoBase: '#5d85e1',
|
|
88
|
+
indigoDark: '#365494',
|
|
89
|
+
indigoText: '#2563c1',
|
|
90
|
+
slateLight: '#c1c5e1',
|
|
91
|
+
slateBase: '#8490c4',
|
|
92
|
+
slateDark: '#525c85',
|
|
93
|
+
slateText: '#566087',
|
|
94
|
+
coralLight: '#ffc89f',
|
|
95
|
+
coralBase: '#fa8136',
|
|
96
|
+
coralDark: '#bb4511',
|
|
97
|
+
coralText: '#c74000',
|
|
98
|
+
lavenderLight: '#bf97ed',
|
|
99
|
+
lavenderBase: '#6a14de',
|
|
100
|
+
lavenderDark: '#330276',
|
|
101
|
+
lavenderText: '#6e00f4',
|
|
102
|
+
bambooLight: '#64cda5',
|
|
103
|
+
bambooBase: '#12966f',
|
|
104
|
+
bambooDark: '#195d46',
|
|
105
|
+
bambooText: '#007455',
|
|
106
|
+
} as const;
|
|
107
|
+
|
|
108
|
+
export const darkTheme = {
|
|
109
|
+
neutral0: '#ffffff',
|
|
110
|
+
neutral25: '#f8f9fc',
|
|
111
|
+
neutral50: '#f3f4fa',
|
|
112
|
+
neutral75: '#eef0f8',
|
|
113
|
+
neutral100: '#e1e3ed',
|
|
114
|
+
neutral150: '#d1d5e4',
|
|
115
|
+
neutral200: '#c1c6d9',
|
|
116
|
+
neutral250: '#b2b8cc',
|
|
117
|
+
neutral300: '#a5abc0',
|
|
118
|
+
neutral350: '#989eb3',
|
|
119
|
+
neutral400: '#8c93a8',
|
|
120
|
+
neutral450: '#7d8499',
|
|
121
|
+
neutral500: '#6e758a',
|
|
122
|
+
neutral550: '#646a7f',
|
|
123
|
+
neutral600: '#575d71',
|
|
124
|
+
neutral650: '#4d5265',
|
|
125
|
+
neutral700: '#414758',
|
|
126
|
+
neutral750: '#343847',
|
|
127
|
+
neutral775: '#2d313e',
|
|
128
|
+
neutral800: '#2a2d39',
|
|
129
|
+
neutral850: '#252832',
|
|
130
|
+
neutral875: '#1e2027',
|
|
131
|
+
neutral900: '#1a1b21',
|
|
132
|
+
neutral950: '#101114',
|
|
133
|
+
yellow25: '#fcdc73',
|
|
134
|
+
yellow50: '#ffd761',
|
|
135
|
+
yellow75: '#f9ce4b',
|
|
136
|
+
yellow100: '#f5bc38',
|
|
137
|
+
yellow200: '#cf9117',
|
|
138
|
+
yellow300: '#a56909',
|
|
139
|
+
yellow350: '#8a4f05',
|
|
140
|
+
yellow400: '#6d3806',
|
|
141
|
+
yellow500: '#5d2e0e',
|
|
142
|
+
yellow600: '#3f1b07',
|
|
143
|
+
yellow700: '#301806',
|
|
144
|
+
red25: '#f5a790',
|
|
145
|
+
red50: '#fe9e8a',
|
|
146
|
+
red75: '#ff8770',
|
|
147
|
+
red100: '#ff7157',
|
|
148
|
+
red200: '#ef6045',
|
|
149
|
+
red300: '#cf4436',
|
|
150
|
+
red350: '#aa3229',
|
|
151
|
+
red400: '#812420',
|
|
152
|
+
red500: '#672523',
|
|
153
|
+
red600: '#40191b',
|
|
154
|
+
red700: '#381719',
|
|
155
|
+
green25: '#74d584',
|
|
156
|
+
green50: '#6ccd7c',
|
|
157
|
+
green75: '#55c06a',
|
|
158
|
+
green100: '#3bb358',
|
|
159
|
+
green200: '#23a64a',
|
|
160
|
+
green300: '#068a35',
|
|
161
|
+
green350: '#006e29',
|
|
162
|
+
green400: '#00531e',
|
|
163
|
+
green500: '#14441f',
|
|
164
|
+
green600: '#0f2b14',
|
|
165
|
+
green700: '#09260f',
|
|
166
|
+
blue25: '#92C0ff',
|
|
167
|
+
blue50: '#8ebcff',
|
|
168
|
+
blue75: '#80a9ff',
|
|
169
|
+
blue100: '#6f9dff',
|
|
170
|
+
blue200: '#5990ff',
|
|
171
|
+
blue300: '#3970d7',
|
|
172
|
+
blue350: '#295cbb',
|
|
173
|
+
blue400: '#194594',
|
|
174
|
+
blue500: '#1a3a78',
|
|
175
|
+
blue600: '#0d2550',
|
|
176
|
+
blue700: '#151d34',
|
|
177
|
+
roseLight: '#e88bb3',
|
|
178
|
+
roseBase: '#b8487b',
|
|
179
|
+
roseDark: '#6f234f',
|
|
180
|
+
roseText: '#ed8bb5',
|
|
181
|
+
buttercupLight: '#f9deaa',
|
|
182
|
+
buttercupBase: '#e5b557',
|
|
183
|
+
buttercupDark: '#b87939',
|
|
184
|
+
buttercupText: '#ebbf6c',
|
|
185
|
+
paprikaLight: '#e26c7d',
|
|
186
|
+
paprikaBase: '#9e384b',
|
|
187
|
+
paprikaDark: '#511d27',
|
|
188
|
+
paprikaText: '#f67c8d',
|
|
189
|
+
tealLight: '#aef0f5',
|
|
190
|
+
tealBase: '#58bcc4',
|
|
191
|
+
tealDark: '#408288',
|
|
192
|
+
tealText: '#62c1c8',
|
|
193
|
+
indigoLight: '#a8b7ed',
|
|
194
|
+
indigoBase: '#6d85ca',
|
|
195
|
+
indigoDark: '#425484',
|
|
196
|
+
indigoText: '#a2b2eb',
|
|
197
|
+
slateLight: '#c2c5dc',
|
|
198
|
+
slateBase: '#8690bf',
|
|
199
|
+
slateDark: '#535c81',
|
|
200
|
+
slateText: '#afb2c9',
|
|
201
|
+
coralLight: '#f3ccb0',
|
|
202
|
+
coralBase: '#f08848',
|
|
203
|
+
coralDark: '#9a4e2d',
|
|
204
|
+
coralText: '#f9b27b',
|
|
205
|
+
lavenderLight: '#b482ed',
|
|
206
|
+
lavenderBase: '#8148c9',
|
|
207
|
+
lavenderDark: '#48296f',
|
|
208
|
+
lavenderText: '#be8af9',
|
|
209
|
+
bambooLight: '#7acaa9',
|
|
210
|
+
bambooBase: '#439274',
|
|
211
|
+
bambooDark: '#305b4a',
|
|
212
|
+
bambooText: '#65bc99',
|
|
110
213
|
} as const;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
|
|
4
|
+
|
|
5
|
+
const colorsDefinitions = JSON.parse(code);
|
|
6
|
+
|
|
7
|
+
const getObjectValueByPath = (obj, path) => {
|
|
8
|
+
return path.split('.').reduce((acc, part) => {
|
|
9
|
+
return acc && acc[part];
|
|
10
|
+
}, obj);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getColorPropertyName = (semanticCategory, property) => {
|
|
14
|
+
const semanticColorName = `${property.split(/[_ ]/).map((semanticPartName) => semanticPartName.toLowerCase()).join('-')}`;
|
|
15
|
+
|
|
16
|
+
// lower case and replace spaces with dashes
|
|
17
|
+
const semanticCategoryName = semanticCategory.toLowerCase().split(' ').join('-');
|
|
18
|
+
|
|
19
|
+
return `--color-${semanticCategoryName}-${semanticColorName}`;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const generateColorDefinitions = (themeVariant) => {
|
|
23
|
+
const mergedPalette = {
|
|
24
|
+
...colorsDefinitions[themeVariant].Semantic,
|
|
25
|
+
...colorsDefinitions[themeVariant].Decorative,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const colorDefinitions = [];
|
|
29
|
+
for (const [semanticCategory, palette] of Object.entries(mergedPalette)) {
|
|
30
|
+
for (const [key, { value }] of Object.entries(palette)) {
|
|
31
|
+
colorDefinitions.push(
|
|
32
|
+
|
|
33
|
+
`${getColorPropertyName(semanticCategory, key)}: ${value.startsWith('#') ? value : getObjectValueByPath(colorsDefinitions[themeVariant], value.slice(1, -1)).value};`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return colorDefinitions.join('\n');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
['light', 'dark'].forEach((themeVariant) => {
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
43
|
+
console.log(`\n*** CSS variables from ${themeVariant} mode ***\n`, generateColorDefinitions(themeVariant));
|
|
44
|
+
});
|