@skbkontur/colors 2.0.0-alpha.3 → 2.0.0-alpha.5

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.
Files changed (130) hide show
  1. package/README.md +3 -3
  2. package/colors.d.ts +319 -0
  3. package/colors.js +319 -0
  4. package/colors.less +319 -0
  5. package/colors.scss +319 -0
  6. package/lib/consts/default-swatch.d.ts +108 -0
  7. package/lib/consts/default-swatch.js +108 -0
  8. package/{dist/esm/consts/default-swatch.js → lib/consts/default-swatch.ts} +11 -7
  9. package/lib/consts/params/abney-correction.js +1102 -0
  10. package/{dist/esm/consts/params/abney-correction.js → lib/consts/params/abney-correction.ts} +3 -1
  11. package/lib/consts/params/chroma-params.js +102 -0
  12. package/{dist/esm/consts/params/chroma-params.js → lib/consts/params/chroma-params.ts} +3 -1
  13. package/lib/consts/params/interactions.ts +9 -0
  14. package/lib/consts/params/logo-lightness.ts +1 -0
  15. package/{dist/esm → lib}/consts/params/promo-hue-shift.d.ts +1 -1
  16. package/lib/consts/params/promo-hue-shift.js +11 -0
  17. package/{dist/esm/consts/params/promo-hue-shift.js → lib/consts/params/promo-hue-shift.ts} +1 -1
  18. package/{dist/esm → lib}/consts/params/warning-hue-patch.d.ts +1 -1
  19. package/lib/consts/params/warning-hue-patch.js +22 -0
  20. package/{dist/esm/consts/params/warning-hue-patch.js → lib/consts/params/warning-hue-patch.ts} +1 -1
  21. package/lib/get-colors-base.d.ts +11 -0
  22. package/lib/get-colors-base.js +78 -0
  23. package/{dist/esm/get-colors-base.js → lib/get-colors-base.ts} +44 -26
  24. package/lib/get-colors-default-tokens.d.ts +645 -0
  25. package/lib/get-colors-default-tokens.js +647 -0
  26. package/lib/get-colors-default-tokens.ts +646 -0
  27. package/lib/get-colors.d.ts +39 -0
  28. package/lib/get-colors.js +24 -0
  29. package/lib/get-colors.ts +59 -0
  30. package/{dist/esm → lib}/helpers/get-interactions.d.ts +2 -2
  31. package/lib/helpers/get-interactions.js +35 -0
  32. package/lib/helpers/get-interactions.ts +64 -0
  33. package/{dist/esm → lib}/helpers/get-logo.d.ts +2 -2
  34. package/lib/helpers/get-logo.js +25 -0
  35. package/lib/helpers/get-logo.ts +40 -0
  36. package/lib/helpers/get-palette.d.ts +51 -0
  37. package/lib/helpers/get-palette.js +204 -0
  38. package/lib/helpers/get-palette.ts +261 -0
  39. package/lib/helpers/get-promo.d.ts +6 -0
  40. package/lib/helpers/get-promo.js +47 -0
  41. package/lib/helpers/get-promo.ts +55 -0
  42. package/lib/types/tokens-base-generator.d.ts +43 -0
  43. package/{dist/esm/types/tokens-base-generator.d.ts → lib/types/tokens-base-generator.ts} +10 -15
  44. package/lib/types/tokens-base.d.ts +55 -0
  45. package/{dist/esm/types/tokens-base.d.ts → lib/types/tokens-base.ts} +7 -2
  46. package/lib/types/tokens.d.ts +12 -0
  47. package/{dist/esm/types/tokens.d.ts → lib/types/tokens.ts} +6 -0
  48. package/lib/utils/convert-color.js +144 -0
  49. package/lib/utils/convert-color.ts +163 -0
  50. package/lib/utils/format-variable.js +6 -0
  51. package/lib/utils/format-variable.ts +7 -0
  52. package/package.json +66 -7
  53. package/{dist/tokens → tokens}/brand-blue-deep_accent-brand.css +2 -2
  54. package/{dist/tokens → tokens}/brand-blue-deep_accent-gray.css +2 -2
  55. package/{dist/tokens → tokens}/brand-blue_accent-brand.css +2 -2
  56. package/{dist/tokens → tokens}/brand-blue_accent-gray.css +2 -2
  57. package/{dist/tokens → tokens}/brand-green_accent-brand.css +2 -2
  58. package/{dist/tokens → tokens}/brand-green_accent-gray.css +2 -2
  59. package/{dist/tokens → tokens}/brand-mint_accent-brand.css +2 -2
  60. package/{dist/tokens → tokens}/brand-mint_accent-gray.css +2 -2
  61. package/{dist/tokens → tokens}/brand-orange_accent-gray.css +2 -2
  62. package/{dist/tokens → tokens}/brand-purple_accent-brand.css +2 -2
  63. package/{dist/tokens → tokens}/brand-purple_accent-gray.css +2 -2
  64. package/{dist/tokens → tokens}/brand-red_accent-gray.css +2 -2
  65. package/{dist/tokens → tokens}/brand-violet_accent-brand.css +2 -2
  66. package/{dist/tokens → tokens}/brand-violet_accent-gray.css +2 -2
  67. package/{dist/tokens-mobile → tokens-mobile}/brand-blue-deep_accent-brand.json +117 -117
  68. package/{dist/tokens-mobile → tokens-mobile}/brand-blue-deep_accent-gray.json +135 -135
  69. package/{dist/tokens-mobile → tokens-mobile}/brand-blue_accent-brand.json +117 -117
  70. package/{dist/tokens-mobile → tokens-mobile}/brand-blue_accent-gray.json +135 -135
  71. package/{dist/tokens-mobile → tokens-mobile}/brand-green_accent-brand.json +117 -117
  72. package/{dist/tokens-mobile → tokens-mobile}/brand-green_accent-gray.json +135 -135
  73. package/{dist/tokens-mobile → tokens-mobile}/brand-mint_accent-brand.json +117 -117
  74. package/{dist/tokens-mobile → tokens-mobile}/brand-mint_accent-gray.json +135 -135
  75. package/{dist/tokens-mobile → tokens-mobile}/brand-orange_accent-gray.json +135 -135
  76. package/{dist/tokens-mobile → tokens-mobile}/brand-purple_accent-brand.json +117 -117
  77. package/{dist/tokens-mobile → tokens-mobile}/brand-purple_accent-gray.json +135 -135
  78. package/{dist/tokens-mobile → tokens-mobile}/brand-red_accent-gray.json +135 -135
  79. package/{dist/tokens-mobile → tokens-mobile}/brand-violet_accent-brand.json +117 -117
  80. package/{dist/tokens-mobile → tokens-mobile}/brand-violet_accent-gray.json +135 -135
  81. package/CHANGELOG.md +0 -84
  82. package/dist/colors.default-dark.js +0 -332
  83. package/dist/colors.default-light.js +0 -336
  84. package/dist/colors.less +0 -319
  85. package/dist/colors.scss +0 -319
  86. package/dist/esm/consts/default-swatch.d.ts +0 -109
  87. package/dist/esm/get-colors-base.d.ts +0 -12
  88. package/dist/esm/get-colors-default-tokens.d.ts +0 -645
  89. package/dist/esm/get-colors-default-tokens.js +0 -992
  90. package/dist/esm/get-colors.d.ts +0 -13
  91. package/dist/esm/get-colors.js +0 -14
  92. package/dist/esm/get-default-tokens.d.ts +0 -645
  93. package/dist/esm/get-default-tokens.js +0 -992
  94. package/dist/esm/helpers/get-interactions.js +0 -49
  95. package/dist/esm/helpers/get-logo.js +0 -28
  96. package/dist/esm/helpers/get-palette.d.ts +0 -76
  97. package/dist/esm/helpers/get-palette.js +0 -232
  98. package/dist/esm/helpers/get-promo.d.ts +0 -12
  99. package/dist/esm/helpers/get-promo.js +0 -51
  100. package/dist/esm/utils/convert-color.js +0 -133
  101. package/dist/esm/utils/format-variable.js +0 -10
  102. package/dist/tokens-js/brand-blue-deep_accent-brand.js +0 -644
  103. package/dist/tokens-js/brand-blue-deep_accent-gray.js +0 -644
  104. package/dist/tokens-js/brand-blue_accent-brand.js +0 -644
  105. package/dist/tokens-js/brand-blue_accent-gray.js +0 -644
  106. package/dist/tokens-js/brand-green_accent-brand.js +0 -644
  107. package/dist/tokens-js/brand-green_accent-gray.js +0 -644
  108. package/dist/tokens-js/brand-mint_accent-brand.js +0 -644
  109. package/dist/tokens-js/brand-mint_accent-gray.js +0 -644
  110. package/dist/tokens-js/brand-orange_accent-gray.js +0 -644
  111. package/dist/tokens-js/brand-purple_accent-brand.js +0 -644
  112. package/dist/tokens-js/brand-purple_accent-gray.js +0 -644
  113. package/dist/tokens-js/brand-red_accent-gray.js +0 -644
  114. package/dist/tokens-js/brand-violet_accent-brand.js +0 -644
  115. package/dist/tokens-js/brand-violet_accent-gray.js +0 -644
  116. package/scripts/babel-register.js +0 -4
  117. package/scripts/tokens-base.json +0 -3499
  118. package/scripts/tokens.json +0 -710
  119. /package/{dist/colors.js → colors.ts} +0 -0
  120. /package/{dist/esm → lib}/consts/params/abney-correction.d.ts +0 -0
  121. /package/{dist/esm → lib}/consts/params/chroma-params.d.ts +0 -0
  122. /package/{dist/esm → lib}/consts/params/interactions.d.ts +0 -0
  123. /package/{dist/esm → lib}/consts/params/interactions.js +0 -0
  124. /package/{dist/esm → lib}/consts/params/logo-lightness.d.ts +0 -0
  125. /package/{dist/esm → lib}/consts/params/logo-lightness.js +0 -0
  126. /package/{dist/esm → lib}/types/tokens-base-generator.js +0 -0
  127. /package/{dist/esm → lib}/types/tokens-base.js +0 -0
  128. /package/{dist/esm → lib}/types/tokens.js +0 -0
  129. /package/{dist/esm → lib}/utils/convert-color.d.ts +0 -0
  130. /package/{dist/esm → lib}/utils/format-variable.d.ts +0 -0
@@ -0,0 +1,144 @@
1
+ import { converter, formatHex } from 'culori';
2
+ export function convertColorFormat(obj, format) {
3
+ if (format === void 0) { format = 'hex/rgba'; }
4
+ if (format === 'oklch') {
5
+ return convertToOklchRecursive(obj);
6
+ }
7
+ var result = convertOklchToHex(obj);
8
+ result = convertAlphaOklchToRgba(result);
9
+ if (format === 'hex-aarrggbb') {
10
+ return convertToAarrggbbRecursive(result);
11
+ }
12
+ return result;
13
+ }
14
+ function convertToOklchRecursive(obj) {
15
+ if (typeof obj !== 'object' || obj === null) {
16
+ return obj;
17
+ }
18
+ if (Array.isArray(obj)) {
19
+ return obj.map(function (item) { return convertToOklchRecursive(item); });
20
+ }
21
+ var newObj = {};
22
+ var toOklch = converter('oklch');
23
+ for (var key in obj) {
24
+ var value = obj[key];
25
+ if (typeof value === 'string') {
26
+ if (value.startsWith('oklch(')) {
27
+ newObj[key] = value;
28
+ }
29
+ else {
30
+ var color = toOklch(value);
31
+ if (color) {
32
+ var l = (color.l * 100).toFixed(3);
33
+ var c = color.c.toFixed(3);
34
+ var h = (color.h || 0).toFixed(0);
35
+ var a = color.alpha !== undefined && color.alpha < 1 ? " / ".concat(color.alpha) : '';
36
+ newObj[key] = "oklch(".concat(l, "% ").concat(c, " ").concat(h).concat(a, ")");
37
+ }
38
+ else {
39
+ newObj[key] = value;
40
+ }
41
+ }
42
+ }
43
+ else if (typeof value === 'object' && value !== null) {
44
+ newObj[key] = convertToOklchRecursive(value);
45
+ }
46
+ else {
47
+ newObj[key] = value;
48
+ }
49
+ }
50
+ return newObj;
51
+ }
52
+ function convertOklchToHex(obj) {
53
+ if (typeof obj !== 'object' || obj === null) {
54
+ return obj;
55
+ }
56
+ if (Array.isArray(obj)) {
57
+ return obj.map(function (item) { return convertOklchToHex(item); });
58
+ }
59
+ var newObj = {};
60
+ for (var key in obj) {
61
+ var value = obj[key];
62
+ if (typeof value === 'string' && value.startsWith('oklch(') && !value.includes('/')) {
63
+ var oklchColor = converter('oklch')(value);
64
+ newObj[key] = oklchColor ? formatHex(oklchColor) : value;
65
+ }
66
+ else if (typeof value === 'object' && value !== null) {
67
+ newObj[key] = convertOklchToHex(value);
68
+ }
69
+ else {
70
+ newObj[key] = value;
71
+ }
72
+ }
73
+ return newObj;
74
+ }
75
+ function convertAlphaOklchToRgba(obj) {
76
+ var _a;
77
+ if (typeof obj !== 'object' || obj === null) {
78
+ return obj;
79
+ }
80
+ if (Array.isArray(obj)) {
81
+ return obj.map(function (item) { return convertAlphaOklchToRgba(item); });
82
+ }
83
+ var newObj = {};
84
+ for (var key in obj) {
85
+ var value = obj[key];
86
+ if (typeof value === 'string' && value.startsWith('oklch(') && value.includes('/')) {
87
+ var rgbaColor = converter('rgb')(value);
88
+ if (rgbaColor) {
89
+ var r = Math.round(rgbaColor.r * 255);
90
+ var g = Math.round(rgbaColor.g * 255);
91
+ var b = Math.round(rgbaColor.b * 255);
92
+ var a = (_a = rgbaColor.alpha) !== null && _a !== void 0 ? _a : 1;
93
+ newObj[key] = "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(a, ")");
94
+ continue;
95
+ }
96
+ }
97
+ if (typeof value === 'object' && value !== null) {
98
+ newObj[key] = convertAlphaOklchToRgba(value);
99
+ }
100
+ else {
101
+ newObj[key] = value;
102
+ }
103
+ }
104
+ return newObj;
105
+ }
106
+ var convertToAarrggbb = function (colorString) {
107
+ var _a;
108
+ var color = converter('rgb')(colorString);
109
+ if (!color) {
110
+ return colorString;
111
+ }
112
+ var r = Math.round(color.r * 255);
113
+ var g = Math.round(color.g * 255);
114
+ var b = Math.round(color.b * 255);
115
+ var alpha = Math.round(((_a = color.alpha) !== null && _a !== void 0 ? _a : 1) * 255);
116
+ var toHex = function (c) { return c.toString(16).padStart(2, '0'); };
117
+ var rgbHex = "".concat(toHex(r)).concat(toHex(g)).concat(toHex(b)).toUpperCase();
118
+ if (alpha === 255) {
119
+ return "#".concat(rgbHex);
120
+ }
121
+ return "#".concat(toHex(alpha)).concat(rgbHex).toUpperCase();
122
+ };
123
+ function convertToAarrggbbRecursive(obj) {
124
+ if (typeof obj !== 'object' || obj === null) {
125
+ return obj;
126
+ }
127
+ if (Array.isArray(obj)) {
128
+ return obj.map(function (item) { return convertToAarrggbbRecursive(item); });
129
+ }
130
+ var newObj = {};
131
+ for (var key in obj) {
132
+ var value = obj[key];
133
+ if (typeof value === 'string') {
134
+ newObj[key] = convertToAarrggbb(value);
135
+ }
136
+ else if (typeof value === 'object' && value !== null) {
137
+ newObj[key] = convertToAarrggbbRecursive(value);
138
+ }
139
+ else {
140
+ newObj[key] = value;
141
+ }
142
+ }
143
+ return newObj;
144
+ }
@@ -0,0 +1,163 @@
1
+ import { converter, formatHex, type Rgb } from 'culori';
2
+
3
+ import type { ColorObject, ColorStructure } from '../types/tokens.js';
4
+
5
+ export type ColorFormat = 'hex/rgba' | 'oklch' | 'hex-aarrggbb';
6
+
7
+ export function convertColorFormat(obj: ColorStructure, format: ColorFormat = 'hex/rgba'): ColorStructure {
8
+ if (format === 'oklch') {
9
+ return convertToOklchRecursive(obj);
10
+ }
11
+
12
+ let result = convertOklchToHex(obj);
13
+ result = convertAlphaOklchToRgba(result);
14
+
15
+ if (format === 'hex-aarrggbb') {
16
+ return convertToAarrggbbRecursive(result);
17
+ }
18
+
19
+ return result;
20
+ }
21
+
22
+ function convertToOklchRecursive(obj: ColorStructure): ColorStructure {
23
+ if (typeof obj !== 'object' || obj === null) {
24
+ return obj;
25
+ }
26
+
27
+ if (Array.isArray(obj)) {
28
+ return obj.map((item) => convertToOklchRecursive(item as ColorStructure));
29
+ }
30
+
31
+ const newObj: ColorObject = {};
32
+ const toOklch = converter('oklch');
33
+
34
+ for (const key in obj) {
35
+ const value = obj[key];
36
+
37
+ if (typeof value === 'string') {
38
+ if (value.startsWith('oklch(')) {
39
+ newObj[key] = value;
40
+ } else {
41
+ const color = toOklch(value);
42
+ if (color) {
43
+ const l = (color.l * 100).toFixed(3);
44
+ const c = color.c.toFixed(3);
45
+ const h = (color.h || 0).toFixed(0);
46
+ const a = color.alpha !== undefined && color.alpha < 1 ? ` / ${color.alpha}` : '';
47
+ newObj[key] = `oklch(${l}% ${c} ${h}${a})`;
48
+ } else {
49
+ newObj[key] = value;
50
+ }
51
+ }
52
+ } else if (typeof value === 'object' && value !== null) {
53
+ newObj[key] = convertToOklchRecursive(value as ColorStructure) as any;
54
+ } else {
55
+ newObj[key] = value;
56
+ }
57
+ }
58
+ return newObj as ColorStructure;
59
+ }
60
+
61
+ function convertOklchToHex(obj: ColorStructure): ColorStructure {
62
+ if (typeof obj !== 'object' || obj === null) {
63
+ return obj;
64
+ }
65
+
66
+ if (Array.isArray(obj)) {
67
+ return obj.map((item) => convertOklchToHex(item as ColorStructure));
68
+ }
69
+
70
+ const newObj: ColorObject = {};
71
+ for (const key in obj) {
72
+ const value = obj[key];
73
+
74
+ if (typeof value === 'string' && value.startsWith('oklch(') && !value.includes('/')) {
75
+ const oklchColor = converter('oklch')(value);
76
+ newObj[key] = oklchColor ? formatHex(oklchColor) : value;
77
+ } else if (typeof value === 'object' && value !== null) {
78
+ newObj[key] = convertOklchToHex(value as ColorStructure) as any;
79
+ } else {
80
+ newObj[key] = value;
81
+ }
82
+ }
83
+ return newObj as ColorStructure;
84
+ }
85
+
86
+ function convertAlphaOklchToRgba(obj: ColorStructure): ColorStructure {
87
+ if (typeof obj !== 'object' || obj === null) {
88
+ return obj;
89
+ }
90
+
91
+ if (Array.isArray(obj)) {
92
+ return obj.map((item) => convertAlphaOklchToRgba(item as ColorStructure));
93
+ }
94
+
95
+ const newObj: ColorObject = {};
96
+ for (const key in obj) {
97
+ const value = obj[key];
98
+
99
+ if (typeof value === 'string' && value.startsWith('oklch(') && value.includes('/')) {
100
+ const rgbaColor = converter('rgb')(value);
101
+ if (rgbaColor) {
102
+ const r = Math.round(rgbaColor.r * 255);
103
+ const g = Math.round(rgbaColor.g * 255);
104
+ const b = Math.round(rgbaColor.b * 255);
105
+ const a = rgbaColor.alpha ?? 1;
106
+ newObj[key] = `rgba(${r}, ${g}, ${b}, ${a})`;
107
+ continue;
108
+ }
109
+ }
110
+
111
+ if (typeof value === 'object' && value !== null) {
112
+ newObj[key] = convertAlphaOklchToRgba(value as ColorStructure) as any;
113
+ } else {
114
+ newObj[key] = value;
115
+ }
116
+ }
117
+ return newObj as ColorStructure;
118
+ }
119
+
120
+ const convertToAarrggbb = (colorString: string): string => {
121
+ const color = converter('rgb')(colorString) as Rgb;
122
+ if (!color) {
123
+ return colorString;
124
+ }
125
+
126
+ const r = Math.round(color.r * 255);
127
+ const g = Math.round(color.g * 255);
128
+ const b = Math.round(color.b * 255);
129
+ const alpha = Math.round((color.alpha ?? 1) * 255);
130
+
131
+ const toHex = (c: number) => c.toString(16).padStart(2, '0');
132
+ const rgbHex = `${toHex(r)}${toHex(g)}${toHex(b)}`.toUpperCase();
133
+
134
+ if (alpha === 255) {
135
+ return `#${rgbHex}`;
136
+ }
137
+
138
+ return `#${toHex(alpha)}${rgbHex}`.toUpperCase();
139
+ };
140
+
141
+ function convertToAarrggbbRecursive(obj: ColorStructure): ColorStructure {
142
+ if (typeof obj !== 'object' || obj === null) {
143
+ return obj;
144
+ }
145
+
146
+ if (Array.isArray(obj)) {
147
+ return obj.map((item) => convertToAarrggbbRecursive(item as ColorStructure));
148
+ }
149
+
150
+ const newObj: ColorObject = {};
151
+ for (const key in obj) {
152
+ const value = obj[key];
153
+
154
+ if (typeof value === 'string') {
155
+ newObj[key] = convertToAarrggbb(value);
156
+ } else if (typeof value === 'object' && value !== null) {
157
+ newObj[key] = convertToAarrggbbRecursive(value as ColorStructure) as any;
158
+ } else {
159
+ newObj[key] = value;
160
+ }
161
+ }
162
+ return newObj as ColorStructure;
163
+ }
@@ -0,0 +1,6 @@
1
+ export var camelCaseToKebabCase = function (str) {
2
+ return str.replace(/[A-Z]/g, function (match) { return "-".concat(match.toLowerCase()); });
3
+ };
4
+ export var kebabCaseToCamelCase = function (str) {
5
+ return str.replace(/-(\w)/g, function (_, c) { return c.toUpperCase(); });
6
+ };
@@ -0,0 +1,7 @@
1
+ export const camelCaseToKebabCase = (str: string) => {
2
+ return str.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
3
+ };
4
+
5
+ export const kebabCaseToCamelCase = (str: string) => {
6
+ return str.replace(/-(\w)/g, (_, c) => c.toUpperCase());
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/colors",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.5",
4
4
  "author": "Kontur",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -9,11 +9,66 @@
9
9
  "type": "module",
10
10
  "license": "UNLICENSED",
11
11
  "sideEffects": false,
12
+ "files": [
13
+ "/lib",
14
+ "/tokens",
15
+ "/tokens-mobile",
16
+ "colors.*"
17
+ ],
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "default": "./colors.js",
22
+ "types": "./colors.d.ts"
23
+ },
24
+ "./get-colors": {
25
+ "default": "./lib/get-colors.js",
26
+ "types": "./lib/get-colors.d.ts"
27
+ },
28
+ "./light-default": {
29
+ "default": "./colors-light-default.js",
30
+ "types": "./colors-light-default.d.ts"
31
+ },
32
+ "./dark-default": {
33
+ "default": "./colors-dark-default.js",
34
+ "types": "./colors-dark-default.d.ts"
35
+ },
36
+ "./colors.scss": "./colors.scss",
37
+ "./colors.less": "./colors.less",
38
+ "./tokens/brand-orange_accent-gray.css": "./tokens/brand-orange_accent-gray.css",
39
+ "./tokens/brand-blue_accent-gray.css": "./tokens/brand-blue_accent-gray.css",
40
+ "./tokens/brand-blue_accent-brand.css": "./tokens/brand-blue_accent-brand.css",
41
+ "./tokens/brand-blue-deep_accent-brand.css": "./tokens/brand-blue-deep_accent-brand.css",
42
+ "./tokens/brand-blue-deep_accent-gray.css": "./tokens/brand-blue-deep_accent-gray.css",
43
+ "./tokens/brand-green_accent-brand.css": "./tokens/brand-green_accent-brand.css",
44
+ "./tokens/brand-green_accent-gray.css": "./tokens/brand-green_accent-gray.css",
45
+ "./tokens/brand-mint_accent-brand.css": "./tokens/brand-mint_accent-brand.css",
46
+ "./tokens/brand-mint_accent-gray.css": "./tokens/brand-mint_accent-gray.css",
47
+ "./tokens/brand-purple_accent-brand.css": "./tokens/brand-purple_accent-brand.css",
48
+ "./tokens/brand-purple_accent-gray.css": "./tokens/brand-purple_accent-gray.css",
49
+ "./tokens/brand-violet_accent-brand.css": "./tokens/brand-violet_accent-brand.css",
50
+ "./tokens/brand-violet_accent-gray.css": "./tokens/brand-violet_accent-gray.css",
51
+ "./tokens-mobile/brand-orange_accent-gray.json": "./tokens/brand-orange_accent-gray.json",
52
+ "./tokens-mobile/brand-blue_accent-gray.json": "./tokens/brand-blue_accent-gray.json",
53
+ "./tokens-mobile/brand-blue_accent-brand.json": "./tokens/brand-blue_accent-brand.json",
54
+ "./tokens-mobile/brand-blue-deep_accent-brand.json": "./tokens/brand-blue-deep_accent-brand.json",
55
+ "./tokens-mobile/brand-blue-deep_accent-gray.json": "./tokens/brand-blue-deep_accent-gray.json",
56
+ "./tokens-mobile/brand-green_accent-brand.json": "./tokens/brand-green_accent-brand.json",
57
+ "./tokens-mobile/brand-green_accent-gray.json": "./tokens/brand-green_accent-gray.json",
58
+ "./tokens-mobile/brand-mint_accent-brand.json": "./tokens/brand-mint_accent-brand.json",
59
+ "./tokens-mobile/brand-mint_accent-gray.json": "./tokens/brand-mint_accent-gray.json",
60
+ "./tokens-mobile/brand-purple_accent-brand.json": "./tokens/brand-purple_accent-brand.json",
61
+ "./tokens-mobile/brand-purple_accent-gray.json": "./tokens/brand-purple_accent-gray.json",
62
+ "./tokens-mobile/brand-violet_accent-brand.json": "./tokens/brand-violet_accent-brand.json",
63
+ "./tokens-mobile/brand-violet_accent-gray.json": "./tokens/brand-violet_accent-gray.json"
64
+ },
12
65
  "scripts": {
13
- "build": "npm run build:esm && npm run build:static",
14
- "build:esm": "tsc --outDir dist/esm",
15
- "build:static": "node --import=tsx scripts/generate.ts && prettier ./dist --write && npx stylelint \"**/*.{css,scss,less}\" --fix",
16
- "extract-tokens": "node --import=tsx scripts/extract-tokens-from-figma.ts",
66
+ "prebuild": "node --import=tsx scripts/create-tokens-from-figma.ts",
67
+ "build": "npm run build:static && npm run build:esm",
68
+ "build:esm": "tsc",
69
+ "build:static": "node --import=tsx scripts/create-tokens-files.ts && prettier . --write && npx stylelint \"**/*.{css,scss,less}\" --fix",
70
+ "test": "vitest run",
71
+ "test:watch": "vitest",
17
72
  "clean": "git clean -fdxqe node_modules"
18
73
  },
19
74
  "dependencies": {
@@ -21,8 +76,12 @@
21
76
  "culori": "4.0.2"
22
77
  },
23
78
  "devDependencies": {
24
- "@skbkontur/react-ui": "5.4.6",
79
+ "@skbkontur/react-ui": "5.5.1",
25
80
  "@types/apca-w3": "0.1.3",
26
- "@types/culori": "4.0.1"
81
+ "@types/culori": "4.0.1",
82
+ "vitest": "^2.1.6"
83
+ },
84
+ "colors": {
85
+ "_": "./"
27
86
  }
28
87
  }
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='blue-deep'][data-k-color-accent='brand'] {
1
+ [data-k-brand='blue-deep'][data-k-accent='brand'] {
2
2
  --k-color-text-accent-heavy: #2b5adf;
3
3
  --k-color-text-accent-heavy-hover: #3e72ff;
4
4
  --k-color-text-accent-heavy-pressed: #3959a5;
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='blue-deep'][data-k-color-accent='brand'][data-k-color-theme='dark'] {
323
+ [data-k-brand='blue-deep'][data-k-accent='brand'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: #76a2ff;
325
325
  --k-color-text-accent-heavy-hover: #99bfff;
326
326
  --k-color-text-accent-heavy-pressed: #6589dc;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='blue-deep'][data-k-color-accent='gray'] {
1
+ [data-k-brand='blue-deep'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='blue-deep'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='blue-deep'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='blue'][data-k-color-accent='brand'] {
1
+ [data-k-brand='blue'][data-k-accent='brand'] {
2
2
  --k-color-text-accent-heavy: #0069c2;
3
3
  --k-color-text-accent-heavy-hover: #0080ea;
4
4
  --k-color-text-accent-heavy-pressed: #37608e;
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='blue'][data-k-color-accent='brand'][data-k-color-theme='dark'] {
323
+ [data-k-brand='blue'][data-k-accent='brand'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: #55a9ff;
325
325
  --k-color-text-accent-heavy-hover: #80c5ff;
326
326
  --k-color-text-accent-heavy-pressed: #4b8fdb;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='blue'][data-k-color-accent='gray'] {
1
+ [data-k-brand='blue'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='blue'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='blue'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='green'][data-k-color-accent='brand'] {
1
+ [data-k-brand='green'][data-k-accent='brand'] {
2
2
  --k-color-text-accent-heavy: #007f34;
3
3
  --k-color-text-accent-heavy-hover: #009b41;
4
4
  --k-color-text-accent-heavy-pressed: #3a6a43;
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='green'][data-k-color-accent='brand'][data-k-color-theme='dark'] {
323
+ [data-k-brand='green'][data-k-accent='brand'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: #00c655;
325
325
  --k-color-text-accent-heavy-hover: #4ede76;
326
326
  --k-color-text-accent-heavy-pressed: #4fa161;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='green'][data-k-color-accent='gray'] {
1
+ [data-k-brand='green'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='green'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='green'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='mint'][data-k-color-accent='brand'] {
1
+ [data-k-brand='mint'][data-k-accent='brand'] {
2
2
  --k-color-text-accent-heavy: #027b68;
3
3
  --k-color-text-accent-heavy-hover: #02957f;
4
4
  --k-color-text-accent-heavy-pressed: #216c5d;
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='mint'][data-k-color-accent='brand'][data-k-color-theme='dark'] {
323
+ [data-k-brand='mint'][data-k-accent='brand'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: #05bfa3;
325
325
  --k-color-text-accent-heavy-hover: #02dcbe;
326
326
  --k-color-text-accent-heavy-pressed: #35a08b;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='mint'][data-k-color-accent='gray'] {
1
+ [data-k-brand='mint'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='mint'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='mint'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='orange'][data-k-color-accent='gray'] {
1
+ [data-k-brand='orange'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='orange'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='orange'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='purple'][data-k-color-accent='brand'] {
1
+ [data-k-brand='purple'][data-k-accent='brand'] {
2
2
  --k-color-text-accent-heavy: #992db3;
3
3
  --k-color-text-accent-heavy-hover: #b545d1;
4
4
  --k-color-text-accent-heavy-pressed: #7c428b;
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='purple'][data-k-color-accent='brand'][data-k-color-theme='dark'] {
323
+ [data-k-brand='purple'][data-k-accent='brand'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: #db70f7;
325
325
  --k-color-text-accent-heavy-hover: #ea9aff;
326
326
  --k-color-text-accent-heavy-pressed: #b568ca;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='purple'][data-k-color-accent='gray'] {
1
+ [data-k-brand='purple'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='purple'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='purple'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='red'][data-k-color-accent='gray'] {
1
+ [data-k-brand='red'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='red'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='red'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='violet'][data-k-color-accent='brand'] {
1
+ [data-k-brand='violet'][data-k-accent='brand'] {
2
2
  --k-color-text-accent-heavy: #7441d3;
3
3
  --k-color-text-accent-heavy-hover: #8c59f3;
4
4
  --k-color-text-accent-heavy-pressed: #634c9e;
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='violet'][data-k-color-accent='brand'][data-k-color-theme='dark'] {
323
+ [data-k-brand='violet'][data-k-accent='brand'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: #ab8eff;
325
325
  --k-color-text-accent-heavy-hover: #c1b0ff;
326
326
  --k-color-text-accent-heavy-pressed: #9278dc;
@@ -1,4 +1,4 @@
1
- [data-k-color-brand='violet'][data-k-color-accent='gray'] {
1
+ [data-k-brand='violet'][data-k-accent='gray'] {
2
2
  --k-color-text-accent-heavy: rgba(0, 0, 0, 0.88);
3
3
  --k-color-text-accent-heavy-hover: rgba(0, 0, 0, 0.96);
4
4
  --k-color-text-accent-heavy-pressed: rgba(0, 0, 0, 0.96);
@@ -320,7 +320,7 @@
320
320
  --k-color-customizable-soft-yellow: #f6d65e;
321
321
  }
322
322
 
323
- [data-k-color-brand='violet'][data-k-color-accent='gray'][data-k-color-theme='dark'] {
323
+ [data-k-brand='violet'][data-k-accent='gray'][data-k-color-theme='dark'] {
324
324
  --k-color-text-accent-heavy: rgba(255, 255, 255, 0.96);
325
325
  --k-color-text-accent-heavy-hover: #fff;
326
326
  --k-color-text-accent-heavy-pressed: #fff;