@skbkontur/colors 1.1.2-75bba.0 → 1.1.2-b2742.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/dist/cjs/constants/default-swatch.d.ts +5 -3
- package/dist/cjs/constants/default-swatch.js +5 -3
- package/dist/cjs/constants/interaction-settings.d.ts +8 -0
- package/dist/cjs/constants/interaction-settings.js +11 -0
- package/dist/cjs/get-base-tokens.js +15 -37
- package/dist/cjs/get-colors.d.ts +17 -0
- package/dist/cjs/get-colors.js +16 -0
- package/dist/cjs/get-default-tokens.d.ts +600 -1271
- package/dist/cjs/get-default-tokens.js +601 -1272
- package/dist/cjs/helpers/get-interactions.d.ts +7 -0
- package/dist/cjs/helpers/get-interactions.js +40 -0
- package/dist/cjs/helpers/get-palette.d.ts +2 -0
- package/dist/cjs/types/base-tokens.d.ts +6 -5
- package/dist/esm/constants/default-swatch.d.ts +5 -3
- package/dist/esm/constants/default-swatch.js +5 -3
- package/dist/esm/constants/interaction-settings.d.ts +8 -0
- package/dist/esm/constants/interaction-settings.js +8 -0
- package/dist/esm/get-base-tokens.js +15 -37
- package/dist/esm/get-colors.d.ts +17 -0
- package/dist/esm/get-colors.js +12 -0
- package/dist/esm/get-default-tokens.d.ts +600 -1271
- package/dist/esm/get-default-tokens.js +601 -1272
- package/dist/esm/helpers/get-interactions.d.ts +7 -0
- package/dist/esm/helpers/get-interactions.js +35 -0
- package/dist/esm/helpers/get-palette.d.ts +2 -0
- package/dist/esm/types/base-tokens.d.ts +6 -5
- package/package.json +5 -4
- package/dist/cjs/get-tokens.d.ts +0 -15
- package/dist/cjs/get-tokens.js +0 -13
- package/dist/esm/get-tokens.d.ts +0 -15
- package/dist/esm/get-tokens.js +0 -9
|
@@ -23,12 +23,10 @@ export declare const customizable: {
|
|
|
23
23
|
blueDeep: string;
|
|
24
24
|
violet: string;
|
|
25
25
|
purple: string;
|
|
26
|
+
yellow: string;
|
|
26
27
|
};
|
|
27
28
|
export declare const gray: {
|
|
28
29
|
0: string;
|
|
29
|
-
4: string;
|
|
30
|
-
8: string;
|
|
31
|
-
12: string;
|
|
32
30
|
16: string;
|
|
33
31
|
20: string;
|
|
34
32
|
24: string;
|
|
@@ -55,6 +53,7 @@ export declare const gray: {
|
|
|
55
53
|
};
|
|
56
54
|
export declare const whiteAlpha: {
|
|
57
55
|
4: string;
|
|
56
|
+
6: string;
|
|
58
57
|
8: string;
|
|
59
58
|
12: string;
|
|
60
59
|
16: string;
|
|
@@ -78,9 +77,11 @@ export declare const whiteAlpha: {
|
|
|
78
77
|
88: string;
|
|
79
78
|
92: string;
|
|
80
79
|
96: string;
|
|
80
|
+
100: string;
|
|
81
81
|
};
|
|
82
82
|
export declare const blackAlpha: {
|
|
83
83
|
4: string;
|
|
84
|
+
6: string;
|
|
84
85
|
8: string;
|
|
85
86
|
12: string;
|
|
86
87
|
16: string;
|
|
@@ -104,4 +105,5 @@ export declare const blackAlpha: {
|
|
|
104
105
|
88: string;
|
|
105
106
|
92: string;
|
|
106
107
|
96: string;
|
|
108
|
+
100: string;
|
|
107
109
|
};
|
|
@@ -26,12 +26,10 @@ exports.customizable = {
|
|
|
26
26
|
blueDeep: '#366AF3',
|
|
27
27
|
violet: '#844BEC',
|
|
28
28
|
purple: '#B750D1',
|
|
29
|
+
yellow: '#FAB700',
|
|
29
30
|
};
|
|
30
31
|
exports.gray = {
|
|
31
32
|
0: 'oklch(0% 0 0)',
|
|
32
|
-
4: 'oklch(4% 0 0)',
|
|
33
|
-
8: 'oklch(8% 0 0)',
|
|
34
|
-
12: 'oklch(12% 0 0)',
|
|
35
33
|
16: 'oklch(16% 0 0)',
|
|
36
34
|
20: 'oklch(20% 0 0)',
|
|
37
35
|
24: 'oklch(24% 0 0)',
|
|
@@ -58,6 +56,7 @@ exports.gray = {
|
|
|
58
56
|
};
|
|
59
57
|
exports.whiteAlpha = {
|
|
60
58
|
4: 'oklch(100% 0 0 / 0.04)',
|
|
59
|
+
6: 'oklch(100% 0 0 / 0.06)',
|
|
61
60
|
8: 'oklch(100% 0 0 / 0.08)',
|
|
62
61
|
12: 'oklch(100% 0 0 / 0.12)',
|
|
63
62
|
16: 'oklch(100% 0 0 / 0.16)',
|
|
@@ -81,9 +80,11 @@ exports.whiteAlpha = {
|
|
|
81
80
|
88: 'oklch(100% 0 0 / 0.88)',
|
|
82
81
|
92: 'oklch(100% 0 0 / 0.92)',
|
|
83
82
|
96: 'oklch(100% 0 0 / 0.96)',
|
|
83
|
+
100: 'oklch(100% 0 0 / 1)',
|
|
84
84
|
};
|
|
85
85
|
exports.blackAlpha = {
|
|
86
86
|
4: 'oklch(0% 0 0 / 0.04)',
|
|
87
|
+
6: 'oklch(0% 0 0 / 0.06)',
|
|
87
88
|
8: 'oklch(0% 0 0 / 0.08)',
|
|
88
89
|
12: 'oklch(0% 0 0 / 0.12)',
|
|
89
90
|
16: 'oklch(0% 0 0 / 0.16)',
|
|
@@ -107,4 +108,5 @@ exports.blackAlpha = {
|
|
|
107
108
|
88: 'oklch(0% 0 0 / 0.88)',
|
|
108
109
|
92: 'oklch(0% 0 0 / 0.92)',
|
|
109
110
|
96: 'oklch(0% 0 0 / 0.96)',
|
|
111
|
+
100: 'oklch(0% 0 0 / 1)',
|
|
110
112
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const HOVER_LIGHT_L = -4;
|
|
2
|
+
export declare const HOVER_LIGHT_C = 0;
|
|
3
|
+
export declare const HOVER_DARK_L = 4;
|
|
4
|
+
export declare const HOVER_DARK_C = 0;
|
|
5
|
+
export declare const PRESSED_LIGHT_L = -8;
|
|
6
|
+
export declare const PRESSED_LIGHT_C = -0.03;
|
|
7
|
+
export declare const PRESSED_DARK_L = -4;
|
|
8
|
+
export declare const PRESSED_DARK_C = -0.03;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRESSED_DARK_C = exports.PRESSED_DARK_L = exports.PRESSED_LIGHT_C = exports.PRESSED_LIGHT_L = exports.HOVER_DARK_C = exports.HOVER_DARK_L = exports.HOVER_LIGHT_C = exports.HOVER_LIGHT_L = void 0;
|
|
4
|
+
exports.HOVER_LIGHT_L = -4;
|
|
5
|
+
exports.HOVER_LIGHT_C = 0;
|
|
6
|
+
exports.HOVER_DARK_L = +4;
|
|
7
|
+
exports.HOVER_DARK_C = 0;
|
|
8
|
+
exports.PRESSED_LIGHT_L = -8;
|
|
9
|
+
exports.PRESSED_LIGHT_C = -0.03;
|
|
10
|
+
exports.PRESSED_DARK_L = -4;
|
|
11
|
+
exports.PRESSED_DARK_C = -0.03;
|
|
@@ -40,8 +40,9 @@ var get_palette_1 = require("./helpers/get-palette");
|
|
|
40
40
|
var get_promo_1 = require("./helpers/get-promo");
|
|
41
41
|
var DEFAULT_SWATCH = __importStar(require("./constants/default-swatch"));
|
|
42
42
|
var get_logo_1 = require("./helpers/get-logo");
|
|
43
|
+
var get_interactions_1 = require("./helpers/get-interactions");
|
|
43
44
|
function getBaseTokens(_a) {
|
|
44
|
-
var brand = _a.brand,
|
|
45
|
+
var brand = _a.brand, _b = _a.accent, accent = _b === void 0 ? 'gray' : _b, _c = _a.system, system = _c === void 0 ? DEFAULT_SWATCH.system : _c;
|
|
45
46
|
var brandColor = (0, exports.colorToHex)(brand);
|
|
46
47
|
var brandPalette = (0, get_palette_1.getPalette)({ color: brandColor });
|
|
47
48
|
var accentPalette;
|
|
@@ -50,10 +51,8 @@ function getBaseTokens(_a) {
|
|
|
50
51
|
accentPalette = brandPalette;
|
|
51
52
|
break;
|
|
52
53
|
case 'gray':
|
|
53
|
-
accentPalette = undefined;
|
|
54
|
-
break;
|
|
55
54
|
default:
|
|
56
|
-
accentPalette =
|
|
55
|
+
accentPalette = undefined;
|
|
57
56
|
}
|
|
58
57
|
var warningPalette = (0, get_palette_1.getPalette)({
|
|
59
58
|
color: system.warning,
|
|
@@ -63,54 +62,33 @@ function getBaseTokens(_a) {
|
|
|
63
62
|
color: system.success,
|
|
64
63
|
});
|
|
65
64
|
var customizable = {};
|
|
66
|
-
for (var colorKey in DEFAULT_SWATCH.
|
|
65
|
+
for (var colorKey in DEFAULT_SWATCH.customizable) {
|
|
67
66
|
// @ts-expect-error
|
|
68
67
|
customizable[colorKey] = (0, get_palette_1.getPalette)({
|
|
69
68
|
// @ts-expect-error
|
|
70
|
-
color: DEFAULT_SWATCH.
|
|
69
|
+
color: DEFAULT_SWATCH.customizable[colorKey],
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
return {
|
|
74
|
-
brandLogo: (0, get_logo_1.getLogo)(brand),
|
|
75
|
-
brandPromo: {
|
|
76
|
-
light: (0, get_promo_1.getPromo)(brandColor),
|
|
77
|
-
dark: 'blue',
|
|
78
|
-
},
|
|
79
73
|
brand: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
dark: brand,
|
|
84
|
-
},
|
|
85
|
-
// todo interactions
|
|
74
|
+
logo: (0, get_logo_1.getLogo)(brandColor),
|
|
75
|
+
promo: (0, get_promo_1.getPromo)(brandColor),
|
|
76
|
+
original: brandColor,
|
|
86
77
|
interactions: {
|
|
87
|
-
hover:
|
|
88
|
-
|
|
89
|
-
dark: '',
|
|
90
|
-
},
|
|
91
|
-
pressed: {
|
|
92
|
-
light: '',
|
|
93
|
-
dark: '',
|
|
94
|
-
},
|
|
78
|
+
hover: (0, get_interactions_1.getHover)(brandColor),
|
|
79
|
+
pressed: (0, get_interactions_1.getPressed)(brandColor),
|
|
95
80
|
},
|
|
96
81
|
palette: brandPalette,
|
|
97
82
|
},
|
|
98
83
|
accent: {
|
|
99
84
|
original: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
dark: accent === 'gray' ? accent : '#3d3d3d',
|
|
85
|
+
light: accent === 'brand' ? brandColor : DEFAULT_SWATCH.gray[36],
|
|
86
|
+
dark: accent === 'brand' ? brandColor : DEFAULT_SWATCH.gray[96],
|
|
103
87
|
},
|
|
104
|
-
// todo interactions
|
|
105
88
|
interactions: {
|
|
106
|
-
hover
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
pressed: {
|
|
111
|
-
light: '',
|
|
112
|
-
dark: '',
|
|
113
|
-
},
|
|
89
|
+
// TODO обработать hover/pressed для gray
|
|
90
|
+
hover: (0, get_interactions_1.getHover)(accent === 'brand' ? brandColor : DEFAULT_SWATCH.gray[36]),
|
|
91
|
+
pressed: (0, get_interactions_1.getPressed)(accent === 'brand' ? brandColor : DEFAULT_SWATCH.gray[36]),
|
|
114
92
|
},
|
|
115
93
|
palette: accentPalette || undefined,
|
|
116
94
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ConfigOptions } from './get-base-tokens';
|
|
2
|
+
import { getDefaultTokens } from './get-default-tokens';
|
|
3
|
+
import type { BaseTokens } from './types/base-tokens';
|
|
4
|
+
export interface Themed<T> {
|
|
5
|
+
light: T;
|
|
6
|
+
dark: T;
|
|
7
|
+
}
|
|
8
|
+
export type DefaultTokensFull = ReturnType<typeof getDefaultTokens>;
|
|
9
|
+
export type DefaultTokens = DefaultTokensFull['light' | 'dark'];
|
|
10
|
+
export interface SemanticConfigOptions<T> extends ConfigOptions {
|
|
11
|
+
theme?: 'light' | 'dark';
|
|
12
|
+
overrides?: (base: BaseTokens, defaults?: DefaultTokensFull, params?: SemanticConfigOptions<T>) => Themed<T>;
|
|
13
|
+
}
|
|
14
|
+
export declare function getColors(params: SemanticConfigOptions<DefaultTokens>): DefaultTokens;
|
|
15
|
+
export declare function getColors<T>(params: SemanticConfigOptions<T> & {
|
|
16
|
+
overrides: (base: BaseTokens) => Themed<T>;
|
|
17
|
+
}): Themed<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getColors = void 0;
|
|
4
|
+
var get_base_tokens_1 = require("./get-base-tokens");
|
|
5
|
+
var get_default_tokens_1 = require("./get-default-tokens");
|
|
6
|
+
var DEFAULT_THEME = 'light';
|
|
7
|
+
function getColors(params) {
|
|
8
|
+
var theme = params.theme || DEFAULT_THEME;
|
|
9
|
+
var base = (0, get_base_tokens_1.getBaseTokens)(params);
|
|
10
|
+
var defaults = (0, get_default_tokens_1.getDefaultTokens)(base);
|
|
11
|
+
if (params.overrides) {
|
|
12
|
+
return params.overrides(base, defaults, params)[theme];
|
|
13
|
+
}
|
|
14
|
+
return defaults[theme];
|
|
15
|
+
}
|
|
16
|
+
exports.getColors = getColors;
|