@vkontakte/vkui-tokens 4.29.3 → 4.29.4
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/build/compilers/docs/__test__/testLinks.d.ts +7 -0
- package/build/compilers/docs/__test__/testLinks.js +2 -0
- package/build/compilers/docs/compileDocsJSON.d.ts +9 -1
- package/build/compilers/docs/compileDocsJSON.js +51 -11
- package/build/compilers/docs/compileDocsJSON.test.js +39 -6
- package/build/compilers/styles/helpers/tokenProcessors.d.ts +1 -1
- package/package.json +2 -2
- package/themes/calendar/docs.json +2746 -1256
- package/themes/calendarDark/docs.json +2746 -1256
- package/themes/calls/docs.json +2600 -1110
- package/themes/cloud/docs.json +2600 -1110
- package/themes/cloudDark/docs.json +2600 -1110
- package/themes/home/docs.json +2632 -1142
- package/themes/homeDark/docs.json +2632 -1142
- package/themes/media/docs.json +2813 -1323
- package/themes/mediaDark/docs.json +2813 -1323
- package/themes/mycom/docs.json +2760 -1270
- package/themes/octavius/docs.json +3463 -1973
- package/themes/octaviusCompact/docs.json +3463 -1973
- package/themes/octaviusCompactDark/docs.json +3463 -1973
- package/themes/octaviusDark/docs.json +3463 -1973
- package/themes/octaviusVK/docs.json +3463 -1973
- package/themes/octaviusVKDark/docs.json +3463 -1973
- package/themes/octaviusWhite/docs.json +3463 -1973
- package/themes/otvet/docs.json +2584 -1094
- package/themes/otvetDark/docs.json +2584 -1094
- package/themes/paradigmBase/docs.json +2600 -1110
- package/themes/paradigmBaseDark/docs.json +2600 -1110
- package/themes/pharma/docs.json +2812 -1322
- package/themes/promo/docs.json +2702 -1212
- package/themes/pulse/docs.json +1245 -590
- package/themes/pulseDark/docs.json +1245 -590
- package/themes/search/docs.json +2700 -1210
- package/themes/todo/docs.json +2600 -1110
- package/themes/vkBase/docs.json +1788 -778
- package/themes/vkBaseDark/docs.json +1788 -778
- package/themes/vkCom/cssVars/declarations/index.css +7 -7
- package/themes/vkCom/cssVars/declarations/noColors.css +7 -7
- package/themes/vkCom/cssVars/declarations/onlyVariables.css +3 -3
- package/themes/vkCom/cssVars/declarations/onlyVariables.js +2 -2
- package/themes/vkCom/cssVars/declarations/onlyVariablesLocal.css +3 -3
- package/themes/vkCom/cssVars/declarations/onlyVariablesLocalIncremental.css +7 -0
- package/themes/vkCom/cssVars/theme/fallbacks/index.css +7 -7
- package/themes/vkCom/cssVars/theme/fallbacks/index.less +3 -3
- package/themes/vkCom/cssVars/theme/fallbacks/index.pcss +3 -3
- package/themes/vkCom/cssVars/theme/fallbacks/index.scss +5 -5
- package/themes/vkCom/cssVars/theme/fallbacks/index.styl +3 -3
- package/themes/vkCom/cssVars/theme/index.js +3 -3
- package/themes/vkCom/cssVars/theme/index.json +3 -3
- package/themes/vkCom/docs.json +1788 -778
- package/themes/vkCom/index.css +7 -7
- package/themes/vkCom/index.js +3 -3
- package/themes/vkCom/index.json +3 -3
- package/themes/vkCom/index.less +3 -3
- package/themes/vkCom/index.pcss +3 -3
- package/themes/vkCom/index.scss +5 -5
- package/themes/vkCom/index.styl +3 -3
- package/themes/vkCom/struct.json +3 -3
- package/themes/vkComDark/cssVars/declarations/index.css +7 -7
- package/themes/vkComDark/cssVars/declarations/noColors.css +7 -7
- package/themes/vkComDark/cssVars/declarations/onlyVariables.css +3 -3
- package/themes/vkComDark/cssVars/declarations/onlyVariables.js +2 -2
- package/themes/vkComDark/cssVars/declarations/onlyVariablesLocal.css +3 -3
- package/themes/vkComDark/cssVars/declarations/onlyVariablesLocalIncremental.css +7 -0
- package/themes/vkComDark/cssVars/theme/fallbacks/index.css +7 -7
- package/themes/vkComDark/cssVars/theme/fallbacks/index.less +3 -3
- package/themes/vkComDark/cssVars/theme/fallbacks/index.pcss +3 -3
- package/themes/vkComDark/cssVars/theme/fallbacks/index.scss +5 -5
- package/themes/vkComDark/cssVars/theme/fallbacks/index.styl +3 -3
- package/themes/vkComDark/cssVars/theme/index.js +3 -3
- package/themes/vkComDark/cssVars/theme/index.json +3 -3
- package/themes/vkComDark/docs.json +1788 -778
- package/themes/vkComDark/index.css +7 -7
- package/themes/vkComDark/index.js +3 -3
- package/themes/vkComDark/index.json +3 -3
- package/themes/vkComDark/index.less +3 -3
- package/themes/vkComDark/index.pcss +3 -3
- package/themes/vkComDark/index.scss +5 -5
- package/themes/vkComDark/index.styl +3 -3
- package/themes/vkComDark/struct.json +3 -3
- package/themes/vkIOS/docs.json +1788 -778
- package/themes/vkIOSDark/docs.json +1788 -778
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { SpecialTokens, Theme } from '../../../interfaces/general';
|
|
2
|
+
export type Description = {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'link';
|
|
7
|
+
url: string;
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
2
10
|
export interface ThemePropertyDoc {
|
|
3
11
|
tags: string[];
|
|
4
|
-
desc:
|
|
12
|
+
desc: Description[];
|
|
5
13
|
}
|
|
6
14
|
export type ThemeDocs = {
|
|
7
15
|
[name: string]: ThemePropertyDoc;
|
|
@@ -18,6 +18,34 @@ exports.compileDocsJSON = exports.getTypeDocs = void 0;
|
|
|
18
18
|
var path_1 = __importDefault(require("path"));
|
|
19
19
|
var ts_morph_1 = require("ts-morph");
|
|
20
20
|
var capitalize_1 = require("../../helpers/capitalize");
|
|
21
|
+
function getTagDescription(tag) {
|
|
22
|
+
return tag
|
|
23
|
+
.getText()
|
|
24
|
+
.map(function (part) {
|
|
25
|
+
switch (part.kind) {
|
|
26
|
+
case 'text':
|
|
27
|
+
return {
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: part.text,
|
|
30
|
+
};
|
|
31
|
+
case 'linkText': {
|
|
32
|
+
var _a = part.text.split(' '), url = _a[0], urlText = _a[1];
|
|
33
|
+
if (!url) {
|
|
34
|
+
throw new Error('[desc] Ожидаемый формат ссылки в JSDoc `{@link url urlText}` или `{@link url}`');
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
url: url,
|
|
38
|
+
type: 'link',
|
|
39
|
+
text: urlText || url,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
case 'link':
|
|
43
|
+
default:
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.filter(function (i) { return i !== null; });
|
|
48
|
+
}
|
|
21
49
|
function getTagText(tag) {
|
|
22
50
|
return tag
|
|
23
51
|
.getText()
|
|
@@ -47,19 +75,20 @@ function getExportedTypeDeclarations(file, typeName) {
|
|
|
47
75
|
function mapJsDocTagsToThemePropertyDoc(tags) {
|
|
48
76
|
var doc = {
|
|
49
77
|
tags: [],
|
|
50
|
-
desc:
|
|
78
|
+
desc: [],
|
|
51
79
|
};
|
|
52
80
|
tags.forEach(function (tag) {
|
|
53
81
|
var tagName = tag.getName();
|
|
54
|
-
var tagText = getTagText(tag);
|
|
55
82
|
if (tagName === 'desc' || tagName === 'description') {
|
|
56
|
-
doc.desc =
|
|
83
|
+
doc.desc = getTagDescription(tag);
|
|
57
84
|
}
|
|
58
85
|
else if (tagName === 'tags') {
|
|
59
|
-
|
|
86
|
+
var docTags = getTagText(tag);
|
|
87
|
+
doc.tags = docTags.split(',').map(function (tag) { return tag.trim(); });
|
|
60
88
|
}
|
|
61
89
|
else if (tagName === 'tag') {
|
|
62
|
-
|
|
90
|
+
var docTag = getTagText(tag);
|
|
91
|
+
doc.tags.push(docTag);
|
|
63
92
|
}
|
|
64
93
|
});
|
|
65
94
|
return doc;
|
|
@@ -71,13 +100,24 @@ function getTypeDocs(filePath, name) {
|
|
|
71
100
|
});
|
|
72
101
|
var file = project.addSourceFileAtPath(filePath);
|
|
73
102
|
var declarations = getExportedTypeDeclarations(file, name);
|
|
74
|
-
return declarations.reduce(function (
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
103
|
+
return declarations.reduce(function (prevDocs, declaration) {
|
|
104
|
+
var rawProperties = declaration.getType().getApparentProperties();
|
|
105
|
+
var parsedProperties = rawProperties
|
|
106
|
+
.reduce(function (acc, prop) {
|
|
107
|
+
acc.push([prop.getName(), mapJsDocTagsToThemePropertyDoc(prop.getJsDocTags())]);
|
|
108
|
+
return acc;
|
|
109
|
+
}, [])
|
|
110
|
+
.sort(function (_a, _b) {
|
|
111
|
+
var a = _a[0];
|
|
112
|
+
var b = _b[0];
|
|
113
|
+
return a.localeCompare(b);
|
|
114
|
+
});
|
|
115
|
+
var docs = parsedProperties.reduce(function (acc, _a) {
|
|
116
|
+
var key = _a[0], value = _a[1];
|
|
117
|
+
acc[key] = value;
|
|
118
|
+
return acc;
|
|
79
119
|
}, {});
|
|
80
|
-
return __assign(__assign({},
|
|
120
|
+
return __assign(__assign({}, prevDocs), docs);
|
|
81
121
|
}, {});
|
|
82
122
|
}
|
|
83
123
|
exports.getTypeDocs = getTypeDocs;
|
|
@@ -6,32 +6,65 @@ describe('compileDocsJSON', function () {
|
|
|
6
6
|
var docs = (0, compileDocsJSON_1.getTypeDocs)('src/build/compilers/docs/__test__/testRecursiveReexport.ts', 'BaseTheme');
|
|
7
7
|
expect(docs).toEqual({
|
|
8
8
|
importedBaseProp: {
|
|
9
|
-
desc:
|
|
9
|
+
desc: [
|
|
10
|
+
{
|
|
11
|
+
type: 'text',
|
|
12
|
+
text: 'Short desc tag',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
10
15
|
tags: ['tag1', 'tag2'],
|
|
11
16
|
},
|
|
12
17
|
});
|
|
13
18
|
});
|
|
19
|
+
it('should correct compile documentation with jsdoc link', function () {
|
|
20
|
+
var docs = (0, compileDocsJSON_1.getTypeDocs)('src/build/compilers/docs/__test__/testLinks.ts', 'BaseTheme');
|
|
21
|
+
expect(docs).toEqual({
|
|
22
|
+
importedBaseProp: {
|
|
23
|
+
desc: [
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: 'Link with text ',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'link',
|
|
30
|
+
url: 'https://google.com',
|
|
31
|
+
text: 'Google',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: '.\nLink without text ',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'link',
|
|
39
|
+
url: 'https://google.com',
|
|
40
|
+
text: 'https://google.com',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
tags: [],
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
});
|
|
14
47
|
it('should correct compile documentation with imports', function () {
|
|
15
48
|
var docs = (0, compileDocsJSON_1.getTypeDocs)('src/build/compilers/docs/__test__/testTheme.ts', 'ThemeTest');
|
|
16
49
|
expect(docs).toEqual({
|
|
17
50
|
prop: {
|
|
18
|
-
desc:
|
|
51
|
+
desc: [],
|
|
19
52
|
tags: ['empty description'],
|
|
20
53
|
},
|
|
21
54
|
propWithoutDoc: {
|
|
22
|
-
desc:
|
|
55
|
+
desc: [],
|
|
23
56
|
tags: [],
|
|
24
57
|
},
|
|
25
58
|
localBaseProp: {
|
|
26
|
-
desc: 'Empty tags',
|
|
59
|
+
desc: [{ type: 'text', text: 'Empty tags' }],
|
|
27
60
|
tags: [],
|
|
28
61
|
},
|
|
29
62
|
importedBaseProp: {
|
|
30
|
-
desc: 'Short desc tag',
|
|
63
|
+
desc: [{ type: 'text', text: 'Short desc tag' }],
|
|
31
64
|
tags: ['tag1', 'tag2'],
|
|
32
65
|
},
|
|
33
66
|
derivedProp: {
|
|
34
|
-
desc: 'Long description tag',
|
|
67
|
+
desc: [{ type: 'text', text: 'Long description tag' }],
|
|
35
68
|
tags: ['tagListItem1', 'tagListItem2', 'tagListItem3'],
|
|
36
69
|
},
|
|
37
70
|
});
|
|
@@ -6,7 +6,7 @@ export declare const EStyleTypes: {
|
|
|
6
6
|
readonly LESS: "less";
|
|
7
7
|
readonly STYL: "styl";
|
|
8
8
|
};
|
|
9
|
-
export type Formats = typeof EStyleTypes[keyof typeof EStyleTypes];
|
|
9
|
+
export type Formats = (typeof EStyleTypes)[keyof typeof EStyleTypes];
|
|
10
10
|
export declare const varDeclarations: {
|
|
11
11
|
readonly css: (prop: any, prefix?: string) => string;
|
|
12
12
|
readonly pcss: (prop: any, prefix?: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/vkui-tokens",
|
|
3
|
-
"version": "4.29.
|
|
3
|
+
"version": "4.29.4",
|
|
4
4
|
"description": "Репозиторий, который содержит в себе дизайн-токены и другие инструменты объединенной дизайн-системы VKUI и Paradigm",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "utils/descriptions.js",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"jest": "29.4.1",
|
|
74
74
|
"jest-junit": "15.0.0",
|
|
75
75
|
"lodash": "4.17.21",
|
|
76
|
-
"prettier": "2.8.
|
|
76
|
+
"prettier": "2.8.4",
|
|
77
77
|
"react": "18.2.0",
|
|
78
78
|
"react-dom": "18.2.0",
|
|
79
79
|
"rimraf": "4.4.0",
|