@vkontakte/vkui-tokens 4.19.1 → 4.20.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.
Files changed (139) hide show
  1. package/build/compilers/docs/__test__/emptyTheme.d.ts +9 -0
  2. package/build/compilers/docs/__test__/emptyTheme.js +2 -0
  3. package/build/compilers/docs/__test__/testBaseForBase.d.ts +8 -0
  4. package/build/compilers/docs/__test__/testBaseForBase.js +2 -0
  5. package/build/compilers/docs/__test__/testBaseTheme.d.ts +1 -0
  6. package/build/compilers/docs/__test__/testBaseTheme.js +2 -0
  7. package/build/compilers/docs/__test__/testRecursiveReexport.d.ts +1 -0
  8. package/build/compilers/docs/__test__/testRecursiveReexport.js +2 -0
  9. package/build/compilers/docs/__test__/testTheme.d.ts +15 -0
  10. package/build/compilers/docs/__test__/testTheme.js +2 -0
  11. package/build/compilers/docs/compileDocsJSON.d.ts +37 -0
  12. package/build/compilers/docs/compileDocsJSON.js +120 -0
  13. package/build/compilers/docs/compileDocsJSON.test.d.ts +1 -0
  14. package/build/compilers/docs/compileDocsJSON.test.js +39 -0
  15. package/build/compilers/index.d.ts +3 -1
  16. package/build/compilers/index.js +21 -1
  17. package/build/compilers/structJSON/compileStructJSON.d.ts +6 -0
  18. package/build/compilers/structJSON/compileStructJSON.js +32 -0
  19. package/build/compilers/structJSON/compileStructJSON.test.d.ts +1 -0
  20. package/build/compilers/structJSON/compileStructJSON.test.js +13 -0
  21. package/build/helpers/cssHelpers.d.ts +1 -1
  22. package/build/helpers/cssHelpers.js +1 -1
  23. package/interfaces/general/animations/index.d.ts +4 -0
  24. package/interfaces/general/colors/index.d.ts +4 -0
  25. package/interfaces/general/elevation/index.d.ts +4 -0
  26. package/interfaces/general/geometry/index.d.ts +4 -0
  27. package/interfaces/general/gradients/index.d.ts +4 -0
  28. package/interfaces/general/index.d.ts +14 -0
  29. package/interfaces/general/toneValues/index.d.ts +4 -0
  30. package/interfaces/general/typography/index.d.ts +6 -0
  31. package/interfaces/namespaces/paradigm/index.d.ts +33 -0
  32. package/interfaces/themes/search/index.d.ts +3 -0
  33. package/package.json +6 -6
  34. package/themes/calendar/docs.json +1304 -0
  35. package/themes/calendar/struct.json +1349 -0
  36. package/themes/calendarDark/docs.json +1304 -0
  37. package/themes/calendarDark/struct.json +1349 -0
  38. package/themes/calls/docs.json +1252 -0
  39. package/themes/calls/struct.json +1179 -0
  40. package/themes/cloud/docs.json +1252 -0
  41. package/themes/cloud/struct.json +1214 -0
  42. package/themes/cloudDark/docs.json +1252 -0
  43. package/themes/cloudDark/struct.json +1193 -0
  44. package/themes/home/docs.json +1284 -0
  45. package/themes/home/struct.json +1221 -0
  46. package/themes/homeDark/docs.json +1284 -0
  47. package/themes/homeDark/struct.json +1220 -0
  48. package/themes/media/docs.json +1460 -0
  49. package/themes/media/struct.json +1548 -0
  50. package/themes/mediaDark/docs.json +1460 -0
  51. package/themes/mediaDark/struct.json +1548 -0
  52. package/themes/mycom/docs.json +1468 -0
  53. package/themes/mycom/struct.json +1551 -0
  54. package/themes/octavius/docs.json +1904 -0
  55. package/themes/octavius/struct.json +1928 -0
  56. package/themes/octaviusCompact/docs.json +1904 -0
  57. package/themes/octaviusCompact/struct.json +1929 -0
  58. package/themes/octaviusCompactDark/docs.json +1904 -0
  59. package/themes/octaviusCompactDark/struct.json +1929 -0
  60. package/themes/octaviusDark/docs.json +1904 -0
  61. package/themes/octaviusDark/struct.json +1928 -0
  62. package/themes/octaviusVK/docs.json +1904 -0
  63. package/themes/octaviusVK/struct.json +1926 -0
  64. package/themes/octaviusVKDark/docs.json +1904 -0
  65. package/themes/octaviusVKDark/struct.json +1926 -0
  66. package/themes/octaviusWhite/docs.json +1904 -0
  67. package/themes/octaviusWhite/struct.json +1928 -0
  68. package/themes/otvet/docs.json +1236 -0
  69. package/themes/otvet/struct.json +1139 -0
  70. package/themes/otvetDark/docs.json +1236 -0
  71. package/themes/otvetDark/struct.json +1139 -0
  72. package/themes/paradigmBase/docs.json +1252 -0
  73. package/themes/paradigmBase/struct.json +1192 -0
  74. package/themes/paradigmBaseDark/docs.json +1252 -0
  75. package/themes/paradigmBaseDark/struct.json +1193 -0
  76. package/themes/pharma/docs.json +1464 -0
  77. package/themes/pharma/struct.json +1553 -0
  78. package/themes/promo/docs.json +1372 -0
  79. package/themes/promo/struct.json +1432 -0
  80. package/themes/search/cssVars/declarations/index.css +369 -27
  81. package/themes/search/cssVars/declarations/noColors.css +171 -3
  82. package/themes/search/cssVars/declarations/onlyAdaptiveGroups.css +18 -0
  83. package/themes/search/cssVars/declarations/onlyMedia.css +180 -24
  84. package/themes/search/cssVars/declarations/onlyVariables.css +49 -1
  85. package/themes/search/cssVars/declarations/onlyVariables.js +2 -2
  86. package/themes/search/cssVars/declarations/onlyVariablesLocal.css +49 -1
  87. package/themes/search/cssVars/declarations/onlyVariablesLocalIncremental.css +49 -1
  88. package/themes/search/cssVars/theme/fallbacks/index.css +171 -3
  89. package/themes/search/cssVars/theme/fallbacks/index.less +73 -1
  90. package/themes/search/cssVars/theme/fallbacks/index.pcss +73 -1
  91. package/themes/search/cssVars/theme/fallbacks/index.scss +200 -2
  92. package/themes/search/cssVars/theme/fallbacks/index.styl +73 -1
  93. package/themes/search/cssVars/theme/index.js +277 -1
  94. package/themes/search/cssVars/theme/index.json +277 -1
  95. package/themes/search/docs.json +1364 -0
  96. package/themes/search/index.css +171 -3
  97. package/themes/search/index.js +79 -1
  98. package/themes/search/index.json +79 -1
  99. package/themes/search/index.less +73 -1
  100. package/themes/search/index.pcss +73 -1
  101. package/themes/search/index.scss +200 -2
  102. package/themes/search/index.styl +73 -1
  103. package/themes/search/struct.json +1448 -0
  104. package/themes/todo/docs.json +1252 -0
  105. package/themes/todo/struct.json +1193 -0
  106. package/themes/vkBase/docs.json +827 -0
  107. package/themes/vkBase/struct.json +886 -0
  108. package/themes/vkBaseDark/docs.json +827 -0
  109. package/themes/vkBaseDark/struct.json +887 -0
  110. package/themes/vkCom/docs.json +827 -0
  111. package/themes/vkCom/struct.json +887 -0
  112. package/themes/vkComDark/cssVars/declarations/index.css +9 -9
  113. package/themes/vkComDark/cssVars/declarations/noSizes.css +9 -9
  114. package/themes/vkComDark/cssVars/declarations/onlyColors.css +9 -9
  115. package/themes/vkComDark/cssVars/declarations/onlyColors.js +2 -2
  116. package/themes/vkComDark/cssVars/declarations/onlyVariables.css +9 -9
  117. package/themes/vkComDark/cssVars/declarations/onlyVariables.js +2 -2
  118. package/themes/vkComDark/cssVars/declarations/onlyVariablesLocal.css +9 -9
  119. package/themes/vkComDark/cssVars/declarations/onlyVariablesLocalIncremental.css +9 -9
  120. package/themes/vkComDark/cssVars/theme/fallbacks/index.css +9 -9
  121. package/themes/vkComDark/cssVars/theme/fallbacks/index.less +9 -9
  122. package/themes/vkComDark/cssVars/theme/fallbacks/index.pcss +9 -9
  123. package/themes/vkComDark/cssVars/theme/fallbacks/index.scss +9 -9
  124. package/themes/vkComDark/cssVars/theme/fallbacks/index.styl +9 -9
  125. package/themes/vkComDark/cssVars/theme/index.js +9 -9
  126. package/themes/vkComDark/cssVars/theme/index.json +9 -9
  127. package/themes/vkComDark/docs.json +827 -0
  128. package/themes/vkComDark/index.css +9 -9
  129. package/themes/vkComDark/index.js +9 -9
  130. package/themes/vkComDark/index.json +9 -9
  131. package/themes/vkComDark/index.less +9 -9
  132. package/themes/vkComDark/index.pcss +9 -9
  133. package/themes/vkComDark/index.scss +9 -9
  134. package/themes/vkComDark/index.styl +9 -9
  135. package/themes/vkComDark/struct.json +887 -0
  136. package/themes/vkIOS/docs.json +827 -0
  137. package/themes/vkIOS/struct.json +887 -0
  138. package/themes/vkIOSDark/docs.json +827 -0
  139. package/themes/vkIOSDark/struct.json +887 -0
@@ -0,0 +1,9 @@
1
+ export interface BaseTheme {
2
+ /**
3
+ * @tag empty description
4
+ */
5
+ prop: string;
6
+ propWithoutDoc: string;
7
+ }
8
+ export interface EmptyTheme extends BaseTheme {
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface BaseTheme {
2
+ /**
3
+ * @desc Short desc tag
4
+ * @tag tag1
5
+ * @tag tag2
6
+ */
7
+ importedBaseProp: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export { BaseTheme as BaseTheme1 } from './testBaseForBase';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export { BaseTheme1 as BaseTheme } from './testBaseTheme';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { EmptyTheme } from './emptyTheme';
2
+ import { BaseTheme1 } from './testBaseTheme';
3
+ export interface BaseTheme2 {
4
+ /**
5
+ * @desc Empty tags
6
+ */
7
+ localBaseProp: string;
8
+ }
9
+ export interface ThemeTest extends BaseTheme1, BaseTheme2, EmptyTheme {
10
+ /**
11
+ * @description Long description tag
12
+ * @tags tagListItem1, tagListItem2,tagListItem3
13
+ */
14
+ derivedProp: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ import { SpecialTokens, Theme } from '../../../interfaces/general';
2
+ export interface ThemePropertyDoc {
3
+ tags: string[];
4
+ desc: string;
5
+ }
6
+ export declare type ThemeDocs = {
7
+ [name: string]: ThemePropertyDoc;
8
+ };
9
+ export declare function getTypeDocs(filePath: string, name: string): ThemeDocs;
10
+ /**
11
+ * Компилирует документацию для полей интерфейса темы и возвращает сериализованный JSON
12
+ *
13
+ * Собирает из jsDoc комментариев над полями интерфейса темы следующего следующие теги:
14
+ * - @desc/@description <desc> – описание поля
15
+ * - @tag <tag> – добавить тег (можно использовать несколько раз)
16
+ * - @tags <tag>, <tag>, ... – задать список тегов, разделённых запятой
17
+ *
18
+ * По итогу компиляции формирует JSON вида:
19
+ * {
20
+ * "<property>": {
21
+ * "desc": "<desc>",
22
+ * "tags": ["<tag>", "<tag>", ...]
23
+ * },
24
+ * ...
25
+ * }
26
+ *
27
+ * Умеет работать с выражениями вида:
28
+ * - export interface MyTheme { ... }
29
+ * - interface BaseTheme1 { ... }
30
+ * interface BaseTheme2 { ... }
31
+ * export interface MyTheme extends BaseTheme1, BaseTheme2 { ... }
32
+ * - import { AnotherBaseTheme } from 'path/to/baseTheme.ts'
33
+ * import { MyTheme, BaseTheme } from 'path/to/myTheme.ts'
34
+ * export interface MyDarkTheme extends MyTheme, BaseTheme, AnotherBaseTheme
35
+ * - export { BaseTheme as MyTheme } from 'path/to/baseTheme.ts'
36
+ */
37
+ export declare function compileDocsJSON<T extends SpecialTokens = Theme>(theme: T): string;
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.compileDocsJSON = exports.getTypeDocs = void 0;
18
+ var path_1 = __importDefault(require("path"));
19
+ var ts_morph_1 = require("ts-morph");
20
+ var capitalize_1 = require("../../helpers/capitalize");
21
+ function getTagText(tag) {
22
+ return tag
23
+ .getText()
24
+ .map(function (part) { return part.text; })
25
+ .join(' ');
26
+ }
27
+ function resolveDeclaration(declaration) {
28
+ if (ts_morph_1.Node.isExportSpecifier(declaration)) {
29
+ // export { A as B } from 'path/to/module.ts'
30
+ var declarations = declaration
31
+ .getNameNode()
32
+ .getSymbol()
33
+ .getDeclarations();
34
+ return resolveDeclarations(declarations);
35
+ }
36
+ return [declaration];
37
+ }
38
+ function resolveDeclarations(declarations) {
39
+ return declarations.reduce(function (all, declaration) {
40
+ return all.concat(resolveDeclaration(declaration));
41
+ }, []);
42
+ }
43
+ function getExportedTypeDeclarations(file, typeName) {
44
+ var exportSymbol = file.getExportSymbols().find(function (symbol) {
45
+ return symbol.getName() === typeName;
46
+ });
47
+ var declarations = exportSymbol.getDeclarations();
48
+ return resolveDeclarations(declarations);
49
+ }
50
+ function mapJsDocTagsToThemePropertyDoc(tags) {
51
+ var doc = {
52
+ tags: [],
53
+ desc: '',
54
+ };
55
+ tags.forEach(function (tag) {
56
+ var tagName = tag.getName();
57
+ var tagText = getTagText(tag);
58
+ if (tagName === 'desc' || tagName === 'description') {
59
+ doc.desc = tagText;
60
+ }
61
+ else if (tagName === 'tags') {
62
+ doc.tags = tagText.split(',').map(function (tag) { return tag.trim(); });
63
+ }
64
+ else if (tagName === 'tag') {
65
+ doc.tags.push(tagText);
66
+ }
67
+ });
68
+ return doc;
69
+ }
70
+ function getTypeDocs(filePath, name) {
71
+ var project = new ts_morph_1.Project({
72
+ tsConfigFilePath: 'tsconfig.json',
73
+ skipAddingFilesFromTsConfig: true,
74
+ });
75
+ var file = project.addSourceFileAtPath(filePath);
76
+ var declarations = getExportedTypeDeclarations(file, name);
77
+ return declarations.reduce(function (all, declaration) {
78
+ var properties = declaration.getType().getApparentProperties();
79
+ var docs = properties.reduce(function (all, prop) {
80
+ all[prop.getName()] = mapJsDocTagsToThemePropertyDoc(prop.getJsDocTags());
81
+ return all;
82
+ }, {});
83
+ return __assign(__assign({}, all), docs);
84
+ }, {});
85
+ }
86
+ exports.getTypeDocs = getTypeDocs;
87
+ /**
88
+ * Компилирует документацию для полей интерфейса темы и возвращает сериализованный JSON
89
+ *
90
+ * Собирает из jsDoc комментариев над полями интерфейса темы следующего следующие теги:
91
+ * - @desc/@description <desc> – описание поля
92
+ * - @tag <tag> – добавить тег (можно использовать несколько раз)
93
+ * - @tags <tag>, <tag>, ... – задать список тегов, разделённых запятой
94
+ *
95
+ * По итогу компиляции формирует JSON вида:
96
+ * {
97
+ * "<property>": {
98
+ * "desc": "<desc>",
99
+ * "tags": ["<tag>", "<tag>", ...]
100
+ * },
101
+ * ...
102
+ * }
103
+ *
104
+ * Умеет работать с выражениями вида:
105
+ * - export interface MyTheme { ... }
106
+ * - interface BaseTheme1 { ... }
107
+ * interface BaseTheme2 { ... }
108
+ * export interface MyTheme extends BaseTheme1, BaseTheme2 { ... }
109
+ * - import { AnotherBaseTheme } from 'path/to/baseTheme.ts'
110
+ * import { MyTheme, BaseTheme } from 'path/to/myTheme.ts'
111
+ * export interface MyDarkTheme extends MyTheme, BaseTheme, AnotherBaseTheme
112
+ * - export { BaseTheme as MyTheme } from 'path/to/baseTheme.ts'
113
+ */
114
+ function compileDocsJSON(theme) {
115
+ var themeFilePath = path_1.default.resolve("src/interfaces/themes/" + theme.themeName + "/index.ts");
116
+ var themeInterfaceName = "Theme" + capitalize_1.capitalize(theme.themeName);
117
+ var docs = getTypeDocs(themeFilePath, themeInterfaceName);
118
+ return JSON.stringify(docs, null, ' ');
119
+ }
120
+ exports.compileDocsJSON = compileDocsJSON;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var compileDocsJSON_1 = require("./compileDocsJSON");
4
+ describe('compileDocsJSON', function () {
5
+ it('should correct compile documentation with reexported interface', function () {
6
+ var docs = compileDocsJSON_1.getTypeDocs('src/build/compilers/docs/__test__/testRecursiveReexport.ts', 'BaseTheme');
7
+ expect(docs).toEqual({
8
+ importedBaseProp: {
9
+ desc: 'Short desc tag',
10
+ tags: ['tag1', 'tag2'],
11
+ },
12
+ });
13
+ });
14
+ it('should correct compile documentation with imports', function () {
15
+ var docs = compileDocsJSON_1.getTypeDocs('src/build/compilers/docs/__test__/testTheme.ts', 'ThemeTest');
16
+ expect(docs).toEqual({
17
+ prop: {
18
+ desc: '',
19
+ tags: ['empty description'],
20
+ },
21
+ propWithoutDoc: {
22
+ desc: '',
23
+ tags: [],
24
+ },
25
+ localBaseProp: {
26
+ desc: 'Empty tags',
27
+ tags: [],
28
+ },
29
+ importedBaseProp: {
30
+ desc: 'Short desc tag',
31
+ tags: ['tag1', 'tag2'],
32
+ },
33
+ derivedProp: {
34
+ desc: 'Long description tag',
35
+ tags: ['tagListItem1', 'tagListItem2', 'tagListItem3'],
36
+ },
37
+ });
38
+ });
39
+ });
@@ -1,9 +1,11 @@
1
1
  import { PixelifyTheme, SpecialTokens, Theme, ThemeCssVarsWide } from '../../interfaces/general';
2
2
  declare type ThemeBuildType = 'root' | 'subtheme' | 'flat' | 'cssVars' | 'cssVarsPseudoRoot';
3
+ declare function writeStructJsonFile<T = Theme>(themePath: string, theme: T, _?: ThemeBuildType): void;
3
4
  declare function writeJsonFile<T = Theme>(themePath: string, theme: T, _?: ThemeBuildType): void;
4
5
  declare function writeTsFile<T extends SpecialTokens = Theme>(themePath: string, theme: T, type: ThemeBuildType, themeName?: string): void;
5
6
  declare function writeStyleFiles<PT extends PixelifyTheme = PixelifyTheme>(themePath: string, theme: PT): void;
6
7
  declare function writeCssVarsSourceFile<PT extends PixelifyTheme = PixelifyTheme>(themePath: string, theme: PT, cssVarsTheme: any, themeBase?: PT): void;
7
8
  declare function writeCssVarsSourceMediaFile<T = ThemeCssVarsWide>(themePath: string, theme: T): void;
8
9
  declare function writeCssVarsJsUtils<T = Theme>(themePath: string, theme: ThemeCssVarsWide<T>): void;
9
- export { writeCssVarsJsUtils, writeCssVarsSourceFile, writeCssVarsSourceMediaFile, writeJsonFile, writeStyleFiles, writeTsFile, };
10
+ declare function writeDocsFiles<T extends SpecialTokens = Theme>(themePath: string, theme: T): void;
11
+ export { writeCssVarsJsUtils, writeCssVarsSourceFile, writeCssVarsSourceMediaFile, writeDocsFiles, writeJsonFile, writeStructJsonFile, writeStyleFiles, writeTsFile, };
@@ -3,15 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeTsFile = exports.writeStyleFiles = exports.writeJsonFile = exports.writeCssVarsSourceMediaFile = exports.writeCssVarsSourceFile = exports.writeCssVarsJsUtils = void 0;
6
+ exports.writeTsFile = exports.writeStyleFiles = exports.writeStructJsonFile = exports.writeJsonFile = exports.writeDocsFiles = exports.writeCssVarsSourceMediaFile = exports.writeCssVarsSourceFile = exports.writeCssVarsJsUtils = void 0;
7
7
  var fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  var path_1 = __importDefault(require("path"));
9
9
  var compileGetDeclarationString_1 = require("./cssVars/jsUtils/compileGetDeclarationString");
10
+ var compileDocsJSON_1 = require("./docs/compileDocsJSON");
10
11
  var compileJSON_1 = require("./json/compileJSON");
11
12
  var compileStyles_1 = require("./styles/compileStyles");
12
13
  var compileTypeScript_1 = require("./ts/compileTypeScript");
13
14
  var capitalize_1 = require("../helpers/capitalize");
14
15
  var compileBreakpointsCssVarsDeclaration_1 = require("./cssVars/declarations/compileBreakpointsCssVarsDeclaration");
16
+ var compileStructJSON_1 = require("./structJSON/compileStructJSON");
15
17
  var cssModes = [
16
18
  { mode: 'default', fileName: 'index.css' },
17
19
  { mode: 'onlyVariables', fileName: 'onlyVariables.css' },
@@ -25,6 +27,15 @@ var cssModes = [
25
27
  { mode: 'noSizes', fileName: 'noSizes.css' },
26
28
  { mode: 'noColors', fileName: 'noColors.css' },
27
29
  ];
30
+ function writeStructJsonFile(themePath, theme, _) {
31
+ console.log("\u043A\u043E\u043C\u043F\u0438\u043B\u0438\u0440\u0443\u0435\u043C \u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u043D\u044B\u0439 json...");
32
+ var fileName = "struct.json";
33
+ var filePath = path_1.default.resolve(themePath, fileName);
34
+ var content = compileStructJSON_1.compileStructJSON(theme);
35
+ fs_extra_1.default.writeFileSync(filePath, content);
36
+ console.log("\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0437\u0430\u043F\u0438\u0441\u0430\u043B\u0438 \u0444\u0430\u0439\u043B " + fileName);
37
+ }
38
+ exports.writeStructJsonFile = writeStructJsonFile;
28
39
  function writeJsonFile(themePath, theme, _) {
29
40
  console.log("\u043A\u043E\u043C\u043F\u0438\u043B\u0438\u0440\u0443\u0435\u043C json...");
30
41
  var fileName = "index.json";
@@ -125,3 +136,12 @@ function writeCssVarsJsUtils(themePath, theme) {
125
136
  });
126
137
  }
127
138
  exports.writeCssVarsJsUtils = writeCssVarsJsUtils;
139
+ function writeDocsFiles(themePath, theme) {
140
+ console.log("\u043A\u043E\u043C\u043F\u0438\u043B\u0438\u0440\u0443\u0435\u043C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044E...");
141
+ var fileName = "docs.json";
142
+ var filePath = path_1.default.resolve(themePath, fileName);
143
+ var content = compileDocsJSON_1.compileDocsJSON(theme);
144
+ fs_extra_1.default.writeFileSync(filePath, content);
145
+ console.log("\u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0437\u0430\u043F\u0438\u0441\u0430\u043B\u0438 \u0444\u0430\u0439\u043B " + fileName);
146
+ }
147
+ exports.writeDocsFiles = writeDocsFiles;
@@ -0,0 +1,6 @@
1
+ import type { Theme } from '../../../interfaces/general';
2
+ export declare type ValuesOf<T extends any[]> = T[number];
3
+ /**
4
+ * Компилирует структурируемый json с темой
5
+ */
6
+ export declare const compileStructJSON: <T = Theme>(theme: T) => string;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compileStructJSON = void 0;
4
+ var groups = [
5
+ 'fontFamily',
6
+ 'fontWeight',
7
+ 'colorsScheme',
8
+ 'size',
9
+ 'opacity',
10
+ 'elevation',
11
+ 'gradient',
12
+ 'animation',
13
+ 'color',
14
+ 'font',
15
+ 'theme',
16
+ 'other',
17
+ ];
18
+ /**
19
+ * Компилирует структурируемый json с темой
20
+ */
21
+ var compileStructJSON = function (theme) {
22
+ var structTheme = {};
23
+ Object.keys(theme).forEach(function (key) {
24
+ var group = groups.find(function (predicate) { return key.startsWith(predicate); }) || 'other';
25
+ if (!structTheme[group]) {
26
+ structTheme[group] = {};
27
+ }
28
+ structTheme[group][key] = theme[key];
29
+ });
30
+ return JSON.stringify(structTheme, null, '\t');
31
+ };
32
+ exports.compileStructJSON = compileStructJSON;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var compileStructJSON_1 = require("./compileStructJSON");
4
+ describe('compileJSON', function () {
5
+ it('should correct stringify', function () {
6
+ var testData = {
7
+ colorA: '#fff',
8
+ colorsScheme: 'scheme',
9
+ randomToken: 123,
10
+ };
11
+ expect(compileStructJSON_1.compileStructJSON(testData)).toBe("{\n\t\"color\": {\n\t\t\"colorA\": \"#fff\"\n\t},\n\t\"colorsScheme\": {\n\t\t\"colorsScheme\": \"scheme\"\n\t},\n\t\"other\": {\n\t\t\"randomToken\": 123\n\t}\n}");
12
+ });
13
+ });
@@ -4,7 +4,7 @@ export declare function isColorDescriptionCallable(value: unknown): value is Col
4
4
  export declare function isColorDescriptionStatic(value: unknown): value is ColorDescriptionStatic;
5
5
  /**
6
6
  * @deprecated
7
- * use toneOpacity
7
+ * @use toneOpacity
8
8
  * TODO: remove
9
9
  */
10
10
  export declare function getRGBA(color: ColorDescription, opacity: number): ColorDescription;
@@ -25,7 +25,7 @@ function isColorDescriptionStatic(value) {
25
25
  exports.isColorDescriptionStatic = isColorDescriptionStatic;
26
26
  /**
27
27
  * @deprecated
28
- * use toneOpacity
28
+ * @use toneOpacity
29
29
  * TODO: remove
30
30
  */
31
31
  function getRGBA(color, opacity) {
@@ -3,6 +3,10 @@ import { Property } from 'csstype';
3
3
  * Переменные отвечающие за параметры анимаций
4
4
  */
5
5
  export interface Animations {
6
+ /**
7
+ * @desc Параметры кривой анимации по умолчанию
8
+ * @tags animation
9
+ */
6
10
  animationEasingDefault: Property.TransitionTimingFunction;
7
11
  animationEasingPlatform: Property.TransitionTimingFunction;
8
12
  animationDurationS: string;
@@ -74,6 +74,10 @@ export interface ColorsDescriptionStruct {
74
74
  colorIconContrastSecondary: ColorDescription;
75
75
  colorIconPositive: ColorDescription;
76
76
  colorIconNegative: ColorDescription;
77
+ /**
78
+ * @desc Цвет акцентной обводки
79
+ * @tags color,stroke
80
+ */
77
81
  colorStrokeAccent: ColorDescription;
78
82
  colorStrokeAccentThemed: ColorDescription;
79
83
  colorStrokePositive: ColorDescription;
@@ -1,5 +1,9 @@
1
1
  import { Property } from 'csstype';
2
2
  export interface Elevation {
3
+ /**
4
+ * @desc Параметры тени уровень 4
5
+ * @tags elevation
6
+ */
3
7
  elevation4: Property.BoxShadow;
4
8
  elevation3: Property.BoxShadow;
5
9
  elevation2: Property.BoxShadow;
@@ -60,6 +60,10 @@ export interface Sizes {
60
60
  sizeButtonTertiaryLargePaddingHorizontalIcon: number;
61
61
  sizeButtonMinimumWidth: number;
62
62
  sizeFormItemPaddingVertical: number;
63
+ /**
64
+ * @desc Отступ для компонента SplitCol
65
+ * @tags size,component
66
+ */
63
67
  sizeSplitColPaddingHorizontal: number;
64
68
  sizeSubnavigationBarGap: number;
65
69
  sizeSubnavigationBarPaddingVertical: number;
@@ -1,5 +1,9 @@
1
1
  export declare type GradientPoints = string;
2
2
  export interface Gradients {
3
+ /**
4
+ * @desc Параметры градиента черного цвета
5
+ * @tags gradient
6
+ */
3
7
  gradientBlack: GradientPoints;
4
8
  gradientWhite: GradientPoints;
5
9
  gradientTint: GradientPoints;
@@ -17,6 +17,11 @@ declare type AdaptiveTokens = {
17
17
  [key in keyof AdaptiveInterfaceValues]: Adaptive<AdaptiveInterfaceValues[key]>;
18
18
  };
19
19
  export interface ColorsScheme {
20
+ /**
21
+ * @desc Legacy
22
+ * @tags color,legacy
23
+ * @deprecated
24
+ */
20
25
  colorsScheme: 'light' | 'dark';
21
26
  }
22
27
  export interface ColorsDescription<T extends {
@@ -27,6 +32,10 @@ export interface ColorsDescription<T extends {
27
32
  export interface ColorsFinal extends Colors, ColorsScheme {
28
33
  }
29
34
  export interface SpecialTokens {
35
+ /**
36
+ * @desc Legacy
37
+ * @tags legacy
38
+ */
30
39
  themeName: string;
31
40
  themeNameBase?: string;
32
41
  themeInheritsFrom?: string;
@@ -49,6 +58,11 @@ export interface ThemeDescription extends Tokens<ThemeGeneral>, ColorsDescriptio
49
58
  * Основной интерфейс темы
50
59
  */
51
60
  export interface Theme extends ThemeGeneral, ColorsFinal {
61
+ /**
62
+ * @desc Legacy
63
+ * @tags legacy
64
+ * @deprecated
65
+ */
52
66
  themeType: 'root';
53
67
  }
54
68
  /**
@@ -1,4 +1,8 @@
1
1
  export interface ToneValues {
2
+ /**
3
+ * @desc Основное значение прозрачности
4
+ * @tags opacity
5
+ */
2
6
  opacityDisable: number;
3
7
  opacityDisableAccessibility: number;
4
8
  }
@@ -19,6 +19,8 @@ export interface Fonts {
19
19
  fontTitle2: Font;
20
20
  fontTitle3: Font;
21
21
  /**
22
+ * @desc Legacy. Сейчас не используется в компонентах
23
+ * @tags font
22
24
  * @deprecated
23
25
  * @see fontHeadline1
24
26
  */
@@ -41,6 +43,10 @@ export interface Fonts {
41
43
  * Глобальные переменные типографии, которые можно использовать вне групп
42
44
  */
43
45
  export interface TypographyBaseProps {
46
+ /**
47
+ * @desc Семейство шрифтов для заголовков
48
+ * @tags font
49
+ */
44
50
  fontFamilyAccent: Property.FontFamily;
45
51
  fontFamilyBase: Property.FontFamily;
46
52
  fontWeightAccent1: Property.FontWeight;
@@ -10,7 +10,15 @@ export interface LocalParadigmColorsDescriptionStruct {
10
10
  colorButtonContrastAlpha: ColorDescription;
11
11
  colorRating: ColorDescription;
12
12
  colorThumbErrorBackgroundAlpha: ColorDescription;
13
+ /**
14
+ * @desc Тонированный акцентный фон с прозрачностью меняется на белый в темной теме
15
+ * @tags color,background,alpha,themed
16
+ */
13
17
  colorBackgroundAccentTintThemedAlpha: ColorDescription;
18
+ /**
19
+ * @desc Тонированный акцентный фон с прозрачностью
20
+ * @tags color,background,alpha
21
+ */
14
22
  colorBackgroundAccentTintAlpha: ColorDescription;
15
23
  colorBackgroundAccentTintThemed: ColorDescription;
16
24
  colorBackgroundWarningTintThemedAlpha: ColorDescription;
@@ -31,6 +39,11 @@ export interface ParadigmLocalSizes {
31
39
  sizeArrowHeight: number;
32
40
  sizeArrowWidth: number;
33
41
  sizeBasePadding: number;
42
+ /**
43
+ * @desc Legacy
44
+ * @tags size,legacy
45
+ * @deprecated
46
+ */
34
47
  sizeBorderWidthTab: number;
35
48
  sizeBorderWidthBar: number;
36
49
  sizeBorderWidthAccent: number;
@@ -82,6 +95,11 @@ export interface ParadigmLocalSizes {
82
95
  sizeIllustrationXXL: number;
83
96
  }
84
97
  export interface ParadigmToneValues {
98
+ /**
99
+ * @desc Legacy. Значение прозрачности
100
+ * @tags legacy
101
+ * @deprecated
102
+ */
85
103
  toneValueOverlay: number;
86
104
  toneValueViewer: number;
87
105
  toneValueToolbar: number;
@@ -90,15 +108,30 @@ export interface ParadigmToneValues {
90
108
  toneValueFocus: number;
91
109
  }
92
110
  export interface ParadigmBorders {
111
+ /**
112
+ * @desc Legacy
113
+ * @tags legacy
114
+ * @deprecated
115
+ */
93
116
  typeBorderButton: Property.BorderStyle;
94
117
  typeBorderPosition: Property.BorderStyle;
95
118
  }
96
119
  export interface ParadigmLocalFonts {
120
+ /**
121
+ * @desc Legacy. Крупный заголовок из темы Paradigm
122
+ * @tags font
123
+ * @deprecated
124
+ */
97
125
  fontH0: Font;
98
126
  fontH1: Font;
99
127
  fontH2: Font;
100
128
  }
101
129
  export interface ParadigmHelpers {
130
+ /**
131
+ * @desc Legacy
132
+ * @tags legacy,size
133
+ * @deprecated
134
+ */
102
135
  sizeBase: number;
103
136
  sizeGrid: number;
104
137
  x0: number;
@@ -28,6 +28,9 @@ export declare type SearchLocalFonts = {
28
28
  searchFontSearchBigTextBold: Adaptive<Font>;
29
29
  searchFontSearchTextBold: Adaptive<Font>;
30
30
  searchFontSearchTextMailSans: Adaptive<Font>;
31
+ searchFontForAdvertisingBold: Adaptive<Font>;
32
+ searchFontGreenURL: Adaptive<Font>;
33
+ searchFontParagraphBold: Adaptive<Font>;
31
34
  };
32
35
  export interface LocalSearchColorsDescriptionStruct {
33
36
  searchColorTextLinkPositive: ColorDescription;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/vkui-tokens",
3
- "version": "4.19.1",
3
+ "version": "4.20.0",
4
4
  "description": "Репозиторий, который содержит в себе дизайн-токены и другие инструменты объединенной дизайн-системы VKUI и Paradigm",
5
5
  "license": "MIT",
6
6
  "main": "utils/descriptions.js",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "repository": "https://github.com/VKCOM/vkui-tokens.git",
28
28
  "dependencies": {
29
- "csstype": "3.1.0"
29
+ "csstype": "3.1.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/color": "3.0.1",
@@ -36,15 +36,15 @@
36
36
  "@types/node": "15.0.1",
37
37
  "@typescript-eslint/eslint-plugin": "4.33.0",
38
38
  "@typescript-eslint/parser": "4.22.0",
39
- "@vkontakte/appearance": "https://github.com/VKCOM/Appearance#v9.51.0",
39
+ "@vkontakte/appearance": "https://github.com/VKCOM/Appearance#v9.51.4",
40
40
  "color": "3.1.3",
41
41
  "common-tags": "1.8.2",
42
42
  "css.escape": "1.5.1",
43
43
  "eslint": "7.25.0",
44
- "eslint-config-prettier": "8.3.0",
44
+ "eslint-config-prettier": "8.5.0",
45
45
  "eslint-config-silence": "1.0.0",
46
46
  "eslint-import-resolver-alias": "1.1.2",
47
- "eslint-plugin-compat": "3.9.0",
47
+ "eslint-plugin-compat": "4.0.2",
48
48
  "eslint-plugin-import": "2.26.0",
49
49
  "eslint-plugin-jasmine": "4.1.2",
50
50
  "eslint-plugin-prettier": "3.4.0",
@@ -55,9 +55,9 @@
55
55
  "jest-junit": "12.0.0",
56
56
  "lodash": "4.17.21",
57
57
  "prettier": "2.7.1",
58
- "release-it": "14.10.0",
59
58
  "rimraf": "3.0.2",
60
59
  "ts-jest": "26.5.5",
60
+ "ts-morph": "16.0.0",
61
61
  "ts-node": "10.9.1",
62
62
  "tsconfig-paths": "4.1.0",
63
63
  "tscpaths": "0.0.9",