@progress/kendo-typescript-tasks 11.2.7-dev.1 → 11.2.7-dev.15

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 (59) hide show
  1. package/api.js +2 -57
  2. package/package.json +4 -3
  3. package/api.config.js +0 -13
  4. package/src/api/class-page.hbs +0 -27
  5. package/src/api/class-page.js +0 -35
  6. package/src/api/code-block.hbs +0 -7
  7. package/src/api/comment-tags.hbs +0 -7
  8. package/src/api/comment.js +0 -56
  9. package/src/api/component-page.hbs +0 -101
  10. package/src/api/component-page.js +0 -67
  11. package/src/api/constant-page.hbs +0 -4
  12. package/src/api/constant-page.js +0 -15
  13. package/src/api/constructor.hbs +0 -21
  14. package/src/api/enum-page.hbs +0 -11
  15. package/src/api/enum-page.js +0 -25
  16. package/src/api/fn-page.hbs +0 -18
  17. package/src/api/fn-page.js +0 -24
  18. package/src/api/generator.js +0 -270
  19. package/src/api/index-page.hbs +0 -54
  20. package/src/api/index-page.js +0 -15
  21. package/src/api/is-constructor.js +0 -9
  22. package/src/api/is-event.js +0 -7
  23. package/src/api/is-field.js +0 -7
  24. package/src/api/is-input.js +0 -7
  25. package/src/api/is-method.js +0 -10
  26. package/src/api/is-public.js +0 -8
  27. package/src/api/map-constructors.js +0 -30
  28. package/src/api/map-methods.js +0 -23
  29. package/src/api/map-props.js +0 -63
  30. package/src/api/member-meta.hbs +0 -7
  31. package/src/api/member-page.js +0 -41
  32. package/src/api/methods.hbs +0 -109
  33. package/src/api/property.hbs +0 -38
  34. package/src/api/react/component-page.hbs +0 -26
  35. package/src/api/react/component-page.js +0 -30
  36. package/src/api/return-type.js +0 -30
  37. package/src/api/slug.js +0 -9
  38. package/src/api/template-utils.js +0 -40
  39. package/src/api/type-links.json +0 -3
  40. package/src/api/type-utils.js +0 -179
  41. package/src/api/union-page.hbs +0 -14
  42. package/src/api/union-page.js +0 -17
  43. package/src/api/utils.js +0 -40
  44. package/src/api/warn.js +0 -22
  45. package/src/api/warning-rules.js +0 -14
  46. package/test/api.js +0 -339
  47. package/test/class.json +0 -73
  48. package/test/components-def.json +0 -98
  49. package/test/events-def.json +0 -163
  50. package/test/fields-def.json +0 -203
  51. package/test/fn-def.json +0 -80
  52. package/test/fn.json +0 -89
  53. package/test/inputs-def.json +0 -98
  54. package/test/interface-comments.json +0 -412
  55. package/test/intersection.json +0 -67
  56. package/test/package.json +0 -175
  57. package/test/type-union-operators.json +0 -42
  58. package/test/type-union.json +0 -70
  59. package/test/warning.js +0 -91
@@ -1,270 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require('fs');
4
- const mkdirp = require('mkdirp');
5
- const path = require('path');
6
- const indexPage = require('./index-page.js');
7
- const memberPage = require('./member-page.js');
8
- const slug = require('./slug.js');
9
- const utils = require('./utils.js');
10
- const typeLinks = require('./type-links.json');
11
- if (fs.existsSync('api-type-links.json')) {
12
- Object.assign(typeLinks, require(path.resolve('api-type-links.json')));
13
- }
14
-
15
- const moduleFilter = (module) => module.children;
16
-
17
- const kind = (member, module) => {
18
- let kind = member.kindString.toLowerCase();
19
- const notBaseType = kind !== 'function' && kind !== 'enumeration' && kind !== 'interface' &&
20
- kind !== 'object literal' && kind !== 'module';
21
-
22
- if (member.name.toUpperCase() === member.name) {
23
- kind = 'constant';
24
- } else if (module.name.match(/.component/) !== null && notBaseType) {
25
- kind = 'component';
26
- } else if (module.name.match(/.directive/) !== null && notBaseType) {
27
- kind = 'directive';
28
- } else if (member.type && member.type.type === 'union') {
29
- kind = 'union';
30
- } else if (notBaseType) {
31
- kind = 'class';
32
- }
33
-
34
- return kind;
35
- };
36
-
37
- const addTypeSlug = (element, knownTypes) => {
38
- if (element.type === 'reference' ||
39
- (typeof element.type !== 'string' && knownTypes[element.id])) {
40
- const type = knownTypes[element.id];
41
- if (type) {
42
- element.typeSlug = type.slug;
43
- } else if (typeLinks[element.name]) {
44
- element.typeLink = typeLinks[element.name];
45
- }
46
- } else if (element.type === 'array' && element.elementType.type === 'reference') {
47
- addTypeSlug(element.elementType, knownTypes);
48
- }
49
- };
50
-
51
- const traverseElements = (elements, callback) => {
52
- if (!elements) {
53
- return;
54
- }
55
-
56
- elements.forEach(element => {
57
- callback(element);
58
-
59
- for (let field in element) {
60
- const value = element[field];
61
- if (Array.isArray(value)) {
62
- traverseElements(value, callback);
63
- } else if (typeof value === 'object' && value !== null) {
64
- traverseElements([ value ], callback);
65
- }
66
- }
67
- });
68
- };
69
-
70
- const associateTypes = (elements, knownTypes) => {
71
- traverseElements(elements, element => {
72
- addTypeSlug(element, knownTypes);
73
- });
74
- };
75
-
76
- const normalizeUnionReferences = (element, members) => {
77
- if (element.kind === 'union') {
78
- const types = element.type.types;
79
- for (let idx = types.length - 1; idx >= 0; idx--) {
80
- const type = types[idx];
81
- if (type.type === 'reference') {
82
- const unionReference = members.find((child) => child.name === type.name);
83
-
84
- if (unionReference && unionReference.kind === 'union') {
85
- normalizeUnionReferences(unionReference, members);
86
- const toReplace = unionReference.type.types;
87
- types.splice.apply(types, [ idx, 1 ].concat(toReplace));
88
- }
89
- }
90
- }
91
- }
92
- };
93
-
94
- const normalizeMembers = (members) => {
95
- traverseElements(members, (element) => {
96
- normalizeUnionReferences(element, members);
97
-
98
- if (!element.comment && element.implementationOf) {
99
- const interfaceName = element.implementationOf.name.split('.')[0];
100
- const interfaceOptions = members.find((child) => child.name === interfaceName);
101
-
102
- if (interfaceOptions) {
103
- const baseOption = interfaceOptions.children.find(child => child.name === element.name);
104
- if (baseOption) {
105
- mergeComments(element, baseOption);
106
- }
107
- }
108
- }
109
-
110
- if (!element.comment && element.kindString === 'Accessor') {
111
- const accessor = element.getSignature || element.setSignature || [];
112
- element.comment = accessor[0].comment;
113
- }
114
- });
115
- };
116
-
117
- const mergeComments = (root, src) => {
118
- if (!root.comment && src.comment) {
119
- root.comment = src.comment;
120
- }
121
-
122
- Object.keys(root).forEach(key => {
123
- if (typeof root[key] === 'object' && src[key]) {
124
- mergeComments(root[key], src[key]);
125
- }
126
- });
127
- };
128
-
129
- const moduleRoot = (moduleName, rootModules) => (rootModules.includes(moduleName) ? moduleName :
130
- rootModules.find(rootModule => moduleName.indexOf(rootModule) > -1));
131
-
132
- const moduleFullName = (moduleName, packageName, rootModules) => {
133
- const rootModule = moduleRoot(moduleName, rootModules);
134
- let fullName = packageName;
135
- if (rootModule) {
136
- fullName += '_' + rootModule;
137
- }
138
-
139
- return fullName;
140
- };
141
-
142
- const extractMembers = (packageName, modules, config) => {
143
- const knownTypes = {};
144
- const rootModules = config.modules || [];
145
- const nonEmptyModules = modules.filter(moduleFilter);
146
-
147
- const models = nonEmptyModules.map(module => module
148
- .children
149
- .filter(child => child.kindString !== "Reference")
150
- .filter(child => child.name !== 'core')
151
- .filter(child => child.sources && !child.sources[0].fileName.includes('prosemirror'))
152
- .map(child => {
153
- const fullName = moduleFullName(module.name, packageName, rootModules);
154
-
155
- const model = {
156
- id: child.id,
157
- module: moduleRoot(module.name, rootModules),
158
- name: child.name,
159
- comment: child.comment,
160
- children: child.children?.sort(utils.nameComparer),
161
- decorators: child.decorators,
162
- type: child.type,
163
- kind: kind(child, module),
164
- packageName: fullName,
165
- url: `${child.name}`,
166
- signatures: child.signatures,
167
- slug: slug(fullName, child.name),
168
- typeParameter: child.typeParameter
169
- };
170
-
171
- knownTypes[child.id] = model;
172
-
173
- if (config.isPlatformSpecific && config.isPlatformSpecific(child)) {
174
- config.toPlatformModel(model);
175
- }
176
-
177
- return model;
178
- })
179
- );
180
-
181
- const members = utils.flatten(models)
182
- .sort(utils.nameComparer)
183
- .map(model => {
184
- associateTypes([ model ], knownTypes);
185
- return model;
186
- });
187
-
188
- normalizeMembers(members);
189
-
190
- return members;
191
- };
192
-
193
- const namespacesAsModules = data => {
194
- const modules = [];
195
- data.filter(moduleFilter).forEach(module => module
196
- .children
197
- .filter(child => child.name !== 'core')
198
- .forEach(child => {
199
- if (child.kindString === 'Module' && child.children) {
200
- modules.push(child);
201
- }
202
- })
203
- );
204
-
205
- return modules;
206
- };
207
-
208
- const writeFile = (name, content) => {
209
- mkdirp.sync(path.dirname(name));
210
- fs.writeFileSync(name, content);
211
- };
212
-
213
- const writeMember = (path, member, info) => {
214
- let sub = member.module ? member.module + '/' : '';
215
- writeFile(`${path}/${sub}${member.url}.md`, memberPage(member, info));
216
- };
217
-
218
- const groupMembers = (members) => {
219
- const membersByModule = utils.groupBy(m => m.module || '', members);
220
-
221
- Object.keys(membersByModule).forEach(module => {
222
- membersByModule[module] = utils.groupBy(m => m.kind, membersByModule[module]);
223
- });
224
-
225
- return membersByModule;
226
- };
227
-
228
- const packagePlatform = (packageInfo) => {
229
- let platform = '';
230
-
231
- if (/-angular-/.test(packageInfo.name)) {
232
- platform = 'Angular';
233
- } else if (/-react-/.test(packageInfo.name)) {
234
- platform = 'React';
235
- } else if (/-vue-/.test(packageInfo.name)) {
236
- platform = 'Vue';
237
- }
238
-
239
- return platform;
240
- };
241
-
242
- const generate = (done, config, packageInfo) => {
243
- const meta = require(config.jsonPath);
244
- const namespaces = namespacesAsModules(meta.children);
245
- const members = extractMembers(packageInfo.name, [ ...meta.children, ...namespaces ], config);
246
- const membersByModule = config.reorderModules ?
247
- config.reorderModules(groupMembers(members)) : groupMembers(members);
248
- const outPath = config.outPath;
249
- const platform = packagePlatform(packageInfo);
250
- const info = Object.assign({ platform }, packageInfo['@progress']);
251
-
252
- writeFile(`${outPath}/index.md`, indexPage(packageInfo.name, membersByModule, info));
253
- writeFile(`${outPath}/_meta.yml`, `---\ntitle: API\n---\n`);
254
-
255
- members.forEach(member => writeMember(outPath, member, info));
256
-
257
- const warnings = utils.warnings();
258
- let error;
259
- if (config.warningsAsErrors && warnings.length > 0) {
260
- error = new Error(`API Generation failed with warnings`);
261
- }
262
-
263
- done(error);
264
- };
265
-
266
- module.exports = {
267
- generate: generate,
268
- extractMembers: extractMembers
269
- };
270
-
@@ -1,54 +0,0 @@
1
- ---
2
- title: {{friendlyName}} API
3
- page_title: {{platform}} {{friendlyName}} API | Kendo UI{{#if platform}} for {{platform}}{{/if}}
4
- description: "Learn how to build custom functionality of the {{platform}} {{friendlyName}} by Kendo UI with the help of the options available in the API."
5
- slug: {{slug}}
6
- api_reference: true
7
- type: index_api
8
- position: 1
9
- ---
10
-
11
- <span class="api-text">
12
-
13
-
14
- # {{friendlyName}} API
15
-
16
-
17
- </span>
18
-
19
- {{#each modules}}
20
- <h2 class="api-module-name">
21
- {{#if @key}}
22
- {{@key}}
23
- {{else}}
24
- {{../name}}
25
- {{/if}}
26
- </h2>
27
-
28
- <div class="api-index">
29
-
30
- {{#each this}}
31
- <div class="api-index-section">
32
-
33
-
34
- <span class="section-key">
35
-
36
-
37
- ## {{{ capitalize @key }}}
38
-
39
-
40
- </span>
41
-
42
-
43
- <ul class="api-item-list">
44
- {{#each this}}
45
- <li class="api-item">
46
- <a href="{% slug {{slug}} %}">{{name}}</a>
47
- </li>
48
- {{/each}}
49
- </ul>
50
- </div>
51
- {{/each}}
52
-
53
- </div>
54
- {{/each}}
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- const template = require('./template-utils.js');
4
- const slug = require('./slug.js');
5
-
6
- const indexTemplate = template.compileFrom('index-page.hbs');
7
-
8
- const index = (projectName, modules, meta) =>
9
- indexTemplate(Object.assign({}, meta, {
10
- name: projectName,
11
- slug: slug(projectName),
12
- modules: modules,
13
- }));
14
-
15
- module.exports = index;
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- const isPublic = require('./is-public');
4
-
5
- const isConstructor = (prop) =>
6
- prop.kindString && prop.kindString === 'Constructor' && isPublic(prop);
7
-
8
- module.exports = isConstructor;
9
-
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- const isEvent = (prop) =>
4
- prop.type && prop.type.name === 'EventEmitter';
5
-
6
- module.exports = isEvent;
7
-
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- const isEvent = require('./is-event.js');
4
- const isField = prop => !(prop.decorators && prop.decorators[0].name.match(/^(input|output)$/i)) &&
5
- !isEvent(prop);
6
-
7
- module.exports = isField;
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- const isInput = (prop) =>
4
- prop.decorators && prop.decorators[0].name === 'Input';
5
-
6
- module.exports = isInput;
7
-
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- const isPublic = require('./is-public');
4
- const isInput = require('./is-input');
5
-
6
- const isMethod = (prop) =>
7
- prop.kindString && prop.kindString === 'Method' && isPublic(prop) && !isInput(prop);
8
-
9
- module.exports = isMethod;
10
-
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- const isPublic = (prop) =>
4
- !/^ng[A-Z]/.test(prop.name) &&
5
- !prop.flags.isPrivate && !prop.flags.isProtected;
6
-
7
- module.exports = isPublic;
8
-
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- const comment = require('./comment');
4
- const isPublic = require('./is-public');
5
- const types = require('./type-utils');
6
- const utils = require('./utils');
7
-
8
- const isConstructor = (prop) =>
9
- prop.kindString && prop.kindString === 'Constructor' && isPublic(prop);
10
-
11
- const mapConstructors = (member) => {
12
- if (member.decorators && member.decorators.find(d => d.name === 'NgModule')) {
13
- // Ignore NgModule constructors
14
- return [];
15
- }
16
-
17
- return utils.flatten(member.children.filter(isConstructor).map(ctr => {
18
- const source = `${member.name}.constructor`;
19
-
20
- return ctr.signatures.map((signature) => ({
21
- signature: types.callSignature(signature),
22
- comment: comment(signature, source),
23
- name: types.fullName(member),
24
- params: types.params(signature, source)
25
- }));
26
- }));
27
- };
28
-
29
- module.exports = mapConstructors;
30
-
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- const comment = require('./comment.js');
4
- const types = require('./type-utils.js');
5
- const isMethod = require('./is-method.js');
6
- const returnType = require('./return-type');
7
- const utils = require('./utils');
8
-
9
- const mapMethods = (children, parentName) =>
10
- utils.flatten(children.filter(isMethod).map(method => {
11
- const name = method.name;
12
- const source = `${parentName}.${name}`;
13
-
14
- return method.signatures.map((signature) => ({
15
- comment: comment(signature, source),
16
- name: name,
17
- returns: returnType(signature, source),
18
- params: types.params(signature, source)
19
- }));
20
- }));
21
-
22
- module.exports = mapMethods;
23
-
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- const comment = require('./comment');
4
- const types = require('./type-utils');
5
- const isConstructor = require('./is-constructor');
6
- const isEvent = require('./is-event');
7
- const isInput = require('./is-input');
8
- const isMethod = require('./is-method');
9
- const isPublic = require('./is-public');
10
-
11
- const defaultValue = prop => {
12
- const { comment: { tags = [] } = {} } = prop;
13
- const { text = '' } = tags.find(t => t.tag === 'default') || {};
14
-
15
- return text && text.trim();
16
- };
17
-
18
- const accessor = signature => (Array.isArray(signature) ? signature[0] : signature);
19
-
20
- const isProp = (prop) => isPublic(prop) && !isConstructor(prop) && !isMethod(prop);
21
- const mapProps = (children, parentName) =>
22
- children.filter(isProp).map(prop => {
23
- let type;
24
- let commentProp = prop;
25
- if (prop.type) {
26
- type = types.typeString(prop);
27
- } else if (prop.kindString === 'Accessor') {
28
- const getter = prop.getSignature;
29
- const setter = prop.setSignature;
30
-
31
- // Fingers crossed
32
- type = types.typeString(setter ?
33
- accessor(setter).parameters[0] :
34
- accessor(getter)
35
- );
36
- } else if (prop.kindString === 'Method') {
37
- type = types.callType(prop.signatures[0]);
38
- commentProp = prop.signatures[0];
39
- }
40
-
41
- let name = prop.name;
42
- if (isInput(prop) || isEvent(prop)) {
43
- const inputArgs = prop.decorators ? prop.decorators[0].arguments : {};
44
- if (inputArgs.bindingPropertyName) {
45
- /* eslint-disable no-eval */
46
- name = eval(inputArgs.bindingPropertyName);
47
- }
48
- }
49
-
50
- if (prop.flags && prop.flags.isOptional) {
51
- name += '?';
52
- }
53
-
54
- return {
55
- name: name,
56
- type: type,
57
- defaultValue: defaultValue(prop),
58
- comment: comment(commentProp, parentName)
59
- };
60
- });
61
-
62
- module.exports = mapProps;
63
-
@@ -1,7 +0,0 @@
1
- ---
2
- title: {{name}}
3
- description: "Learn how to build custom functionality when working with the {{platform}} {{friendlyName}} by Kendo UI with the help of the {{name}}."
4
- api_reference: true
5
- type: inner_api
6
- slug: {{slug}}
7
- ---
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- const path = require('path');
4
- const componentPage = require('./component-page');
5
- const constantPage = require('./constant-page');
6
- const classPage = require('./class-page');
7
- const enumPage = require('./enum-page.js');
8
- const fnPage = require('./fn-page');
9
- const unionPage = require('./union-page');
10
-
11
- const memberPage = (member, meta) => {
12
- switch (member.kind) {
13
- case 'component': {
14
- if (member.platform) {
15
- return require(path.join(__dirname, member.platform, 'component-page'))(member, meta);
16
- }
17
- return componentPage(member, meta);
18
- }
19
- case 'directive':
20
- return componentPage(member, meta);
21
- case 'hook':
22
- case 'function':
23
- return fnPage(member, meta);
24
- case 'class':
25
- case 'interface':
26
- case 'module':
27
- return classPage(member, meta);
28
- case 'constant':
29
- case 'object literal':
30
- return constantPage(member, meta);
31
- case 'union':
32
- return unionPage(member, meta);
33
- case 'enumeration':
34
- return enumPage(member, meta);
35
- default:
36
- throw new Error(`Unknown member kind '${member.kind}' for ${member.name}`);
37
- }
38
- };
39
-
40
- module.exports = memberPage;
41
-
@@ -1,109 +0,0 @@
1
- {{#if methods}}
2
-
3
- ## Methods
4
-
5
- {{#each methods}}
6
- <table class="api-table api-table-methods">
7
- <thead class="api-table-methods-head">
8
- <tr>
9
- <th>
10
-
11
-
12
- #### {{name}}
13
-
14
-
15
- </th>
16
- </tr>
17
- </thead>
18
- <tbody class="api-table-body">
19
- <tr>
20
- <td>
21
-
22
-
23
- {{comment}}
24
-
25
-
26
- </td>
27
- </tr>
28
- {{#if params}}
29
- <tr class="nested-table">
30
- <td>
31
- <table class="api-table api-table-parameters">
32
- <thead class="api-table-parameters-head">
33
- <tr>
34
- <th class="th-name">Parameters</th>
35
- <th class="th-type"></th>
36
- <th class="th-desc"></th>
37
- </tr>
38
- </thead>
39
- <tbody class="api-table-body">
40
- {{#each params}}
41
- <tr>
42
- <td>
43
-
44
-
45
- {{name}}
46
-
47
-
48
- </td>
49
- <td type>
50
-
51
-
52
- {{> code_block type }}
53
-
54
-
55
- </td>
56
- <td>
57
-
58
-
59
- {{comment}}
60
-
61
-
62
- </td>
63
- </tr>
64
- {{/each}}
65
- </tbody>
66
- </table>
67
- </td>
68
- </tr>
69
- {{/if}}
70
-
71
- {{#if returns}}
72
- <tr class="nested-table">
73
- <td>
74
- <table class="api-table api-table-returns">
75
- <thead class="api-table-returns-head">
76
- <tr>
77
- <th class="th-type">Returns</th>
78
- <th class="th-desc"></th>
79
- </tr>
80
- </thead>
81
- <tbody class="api-table-body">
82
- <tr>
83
- <td type>
84
-
85
-
86
- {{> code_block returns.type }}
87
-
88
-
89
- </td>
90
- <td>
91
-
92
-
93
- {{returns.comment}}
94
-
95
-
96
- </td>
97
- </tr>
98
- </tbody>
99
- </table>
100
- </td>
101
- </tr>
102
- {{/if}}
103
- </tbody>
104
- </table>
105
-
106
- {{/each}}
107
-
108
- {{/if}}
109
-