@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.
Files changed (82) hide show
  1. package/build/compilers/docs/__test__/testLinks.d.ts +7 -0
  2. package/build/compilers/docs/__test__/testLinks.js +2 -0
  3. package/build/compilers/docs/compileDocsJSON.d.ts +9 -1
  4. package/build/compilers/docs/compileDocsJSON.js +51 -11
  5. package/build/compilers/docs/compileDocsJSON.test.js +39 -6
  6. package/build/compilers/styles/helpers/tokenProcessors.d.ts +1 -1
  7. package/package.json +2 -2
  8. package/themes/calendar/docs.json +2746 -1256
  9. package/themes/calendarDark/docs.json +2746 -1256
  10. package/themes/calls/docs.json +2600 -1110
  11. package/themes/cloud/docs.json +2600 -1110
  12. package/themes/cloudDark/docs.json +2600 -1110
  13. package/themes/home/docs.json +2632 -1142
  14. package/themes/homeDark/docs.json +2632 -1142
  15. package/themes/media/docs.json +2813 -1323
  16. package/themes/mediaDark/docs.json +2813 -1323
  17. package/themes/mycom/docs.json +2760 -1270
  18. package/themes/octavius/docs.json +3463 -1973
  19. package/themes/octaviusCompact/docs.json +3463 -1973
  20. package/themes/octaviusCompactDark/docs.json +3463 -1973
  21. package/themes/octaviusDark/docs.json +3463 -1973
  22. package/themes/octaviusVK/docs.json +3463 -1973
  23. package/themes/octaviusVKDark/docs.json +3463 -1973
  24. package/themes/octaviusWhite/docs.json +3463 -1973
  25. package/themes/otvet/docs.json +2584 -1094
  26. package/themes/otvetDark/docs.json +2584 -1094
  27. package/themes/paradigmBase/docs.json +2600 -1110
  28. package/themes/paradigmBaseDark/docs.json +2600 -1110
  29. package/themes/pharma/docs.json +2812 -1322
  30. package/themes/promo/docs.json +2702 -1212
  31. package/themes/pulse/docs.json +1245 -590
  32. package/themes/pulseDark/docs.json +1245 -590
  33. package/themes/search/docs.json +2700 -1210
  34. package/themes/todo/docs.json +2600 -1110
  35. package/themes/vkBase/docs.json +1788 -778
  36. package/themes/vkBaseDark/docs.json +1788 -778
  37. package/themes/vkCom/cssVars/declarations/index.css +7 -7
  38. package/themes/vkCom/cssVars/declarations/noColors.css +7 -7
  39. package/themes/vkCom/cssVars/declarations/onlyVariables.css +3 -3
  40. package/themes/vkCom/cssVars/declarations/onlyVariables.js +2 -2
  41. package/themes/vkCom/cssVars/declarations/onlyVariablesLocal.css +3 -3
  42. package/themes/vkCom/cssVars/declarations/onlyVariablesLocalIncremental.css +7 -0
  43. package/themes/vkCom/cssVars/theme/fallbacks/index.css +7 -7
  44. package/themes/vkCom/cssVars/theme/fallbacks/index.less +3 -3
  45. package/themes/vkCom/cssVars/theme/fallbacks/index.pcss +3 -3
  46. package/themes/vkCom/cssVars/theme/fallbacks/index.scss +5 -5
  47. package/themes/vkCom/cssVars/theme/fallbacks/index.styl +3 -3
  48. package/themes/vkCom/cssVars/theme/index.js +3 -3
  49. package/themes/vkCom/cssVars/theme/index.json +3 -3
  50. package/themes/vkCom/docs.json +1788 -778
  51. package/themes/vkCom/index.css +7 -7
  52. package/themes/vkCom/index.js +3 -3
  53. package/themes/vkCom/index.json +3 -3
  54. package/themes/vkCom/index.less +3 -3
  55. package/themes/vkCom/index.pcss +3 -3
  56. package/themes/vkCom/index.scss +5 -5
  57. package/themes/vkCom/index.styl +3 -3
  58. package/themes/vkCom/struct.json +3 -3
  59. package/themes/vkComDark/cssVars/declarations/index.css +7 -7
  60. package/themes/vkComDark/cssVars/declarations/noColors.css +7 -7
  61. package/themes/vkComDark/cssVars/declarations/onlyVariables.css +3 -3
  62. package/themes/vkComDark/cssVars/declarations/onlyVariables.js +2 -2
  63. package/themes/vkComDark/cssVars/declarations/onlyVariablesLocal.css +3 -3
  64. package/themes/vkComDark/cssVars/declarations/onlyVariablesLocalIncremental.css +7 -0
  65. package/themes/vkComDark/cssVars/theme/fallbacks/index.css +7 -7
  66. package/themes/vkComDark/cssVars/theme/fallbacks/index.less +3 -3
  67. package/themes/vkComDark/cssVars/theme/fallbacks/index.pcss +3 -3
  68. package/themes/vkComDark/cssVars/theme/fallbacks/index.scss +5 -5
  69. package/themes/vkComDark/cssVars/theme/fallbacks/index.styl +3 -3
  70. package/themes/vkComDark/cssVars/theme/index.js +3 -3
  71. package/themes/vkComDark/cssVars/theme/index.json +3 -3
  72. package/themes/vkComDark/docs.json +1788 -778
  73. package/themes/vkComDark/index.css +7 -7
  74. package/themes/vkComDark/index.js +3 -3
  75. package/themes/vkComDark/index.json +3 -3
  76. package/themes/vkComDark/index.less +3 -3
  77. package/themes/vkComDark/index.pcss +3 -3
  78. package/themes/vkComDark/index.scss +5 -5
  79. package/themes/vkComDark/index.styl +3 -3
  80. package/themes/vkComDark/struct.json +3 -3
  81. package/themes/vkIOS/docs.json +1788 -778
  82. package/themes/vkIOSDark/docs.json +1788 -778
@@ -0,0 +1,7 @@
1
+ export interface BaseTheme {
2
+ /**
3
+ * @desc Link with text {@link https://google.com Google}.
4
+ * Link without text {@link https://google.com}
5
+ */
6
+ importedBaseProp: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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: string;
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 = tagText;
83
+ doc.desc = getTagDescription(tag);
57
84
  }
58
85
  else if (tagName === 'tags') {
59
- doc.tags = tagText.split(',').map(function (tag) { return tag.trim(); });
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
- doc.tags.push(tagText);
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 (all, declaration) {
75
- var properties = declaration.getType().getApparentProperties();
76
- var docs = properties.reduce(function (all, prop) {
77
- all[prop.getName()] = mapJsDocTagsToThemePropertyDoc(prop.getJsDocTags());
78
- return all;
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({}, all), docs);
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: 'Short desc tag',
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",
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.0",
76
+ "prettier": "2.8.4",
77
77
  "react": "18.2.0",
78
78
  "react-dom": "18.2.0",
79
79
  "rimraf": "4.4.0",