umberto 6.1.1 → 7.0.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 (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/package.json +1 -1
  3. package/scripts/filter/before-post-render/has-own-favicons.js +12 -0
  4. package/scripts/utils/has-own-favicons.js +48 -0
  5. package/src/api-builder/utils/findtargetdoclet.js +2 -2
  6. package/src/data-converter/converters/typedoc/abstractparser.js +54 -50
  7. package/src/data-converter/converters/typedoc/accessorparser.js +7 -5
  8. package/src/data-converter/converters/typedoc/classparser.js +5 -3
  9. package/src/data-converter/converters/typedoc/computedpropertyparser.js +4 -3
  10. package/src/data-converter/converters/typedoc/constantparser.js +5 -3
  11. package/src/data-converter/converters/typedoc/constructorparser.js +4 -3
  12. package/src/data-converter/converters/typedoc/errorparser.js +4 -10
  13. package/src/data-converter/converters/typedoc/eventparser.js +4 -10
  14. package/src/data-converter/converters/typedoc/functionparser.js +5 -3
  15. package/src/data-converter/converters/typedoc/interfaceparser.js +5 -3
  16. package/src/data-converter/converters/typedoc/methodparser.js +6 -4
  17. package/src/data-converter/converters/typedoc/moduleparser.js +9 -3
  18. package/src/data-converter/converters/typedoc/propertyparser.js +7 -28
  19. package/src/data-converter/converters/typedoc/referenceparser.js +41 -0
  20. package/src/data-converter/converters/typedoc/reflectionkind.js +34 -0
  21. package/src/data-converter/converters/typedoc/typedoc.ts +215 -214
  22. package/src/data-converter/converters/typedoc/typedocconverter.js +130 -99
  23. package/src/data-converter/converters/typedoc/typeparser.js +10 -6
  24. package/src/data-converter/converters/typedoc2umberto.js +9 -3
  25. package/themes/umberto/layout/gloria/_api-docs/_mixin/_type.pug +9 -0
  26. package/themes/umberto/layout/gloria/_partial/head.pug +7 -4
  27. package/themes/umberto/layout/umberto/_api-docs/_mixin/_type.pug +9 -0
  28. package/themes/umberto/layout/umberto/_partial/head.pug +7 -4
  29. package/themes/umberto/src/gloria/js/_codeswitcherbuttons.js +2 -2
  30. package/themes/umberto/src/umberto/js/_codeswitcherbuttons.js +2 -2
@@ -6,18 +6,19 @@
6
6
  'use strict';
7
7
 
8
8
  const AbstractParser = require( './abstractparser' );
9
+ const ReflectionKind = require( './reflectionkind' );
9
10
 
10
11
  module.exports = class MethodParser extends AbstractParser {
11
12
  /**
12
- * @param {TypedocReflectionMeta} item
13
+ * @param {BaseReflection} item
13
14
  * @returns {Boolean}
14
15
  */
15
16
  canParse( item ) {
16
- return item.kindString === 'Method';
17
+ return item.kind === ReflectionKind.Method;
17
18
  }
18
19
 
19
20
  /**
20
- * @param {TypedocReflection<ConstructorOrMethod>} item
21
+ * @param {MethodReflection|ConstructorReflection} item
21
22
  * @param {String} parentName
22
23
  * @returns {Array.<Object>}
23
24
  */
@@ -27,6 +28,7 @@ module.exports = class MethodParser extends AbstractParser {
27
28
  // Needed for post-processing once all project reflections are converted.
28
29
  _signature: signature,
29
30
 
31
+ id: item.id,
30
32
  name: item.name,
31
33
  memberof: parentName,
32
34
  longname: this.getLongName( item, parentName ),
@@ -64,7 +66,7 @@ module.exports = class MethodParser extends AbstractParser {
64
66
  /**
65
67
  * Returns the access type for the item based on its signatures.
66
68
  *
67
- * @param {TypedocReflection<ConstructorOrMethod>} item
69
+ * @param {MethodReflection|ConstructorReflection} item
68
70
  * @param {Number} sourceIndex
69
71
  * @returns {'public'|'internal'|'protected'|'private'}
70
72
  */
@@ -6,22 +6,28 @@
6
6
  'use strict';
7
7
 
8
8
  const AbstractParser = require( './abstractparser' );
9
+ const ReflectionKind = require( './reflectionkind' );
9
10
 
10
11
  module.exports = class ModuleParser extends AbstractParser {
11
12
  /**
12
- * @param {TypedocReflectionMeta} item
13
+ * @param {BaseReflection} item
13
14
  * @returns {Boolean}
14
15
  */
15
16
  canParse( item ) {
16
- return item.kindString === 'Module';
17
+ return item.kind === ReflectionKind.Module;
17
18
  }
18
19
 
19
20
  /**
20
- * @param {TypedocReflection<'Module'>} item
21
+ * @param {ModuleReflection} item
21
22
  * @returns {Object}
22
23
  */
23
24
  parse( item ) {
25
+ if ( !item.name.includes( '/' ) ) {
26
+ item.name += '/index';
27
+ }
28
+
24
29
  return {
30
+ id: item.id,
25
31
  name: item.name,
26
32
  longname: this.getLongName( item ),
27
33
  kind: this.getKind( item ),
@@ -6,33 +6,28 @@
6
6
  'use strict';
7
7
 
8
8
  const AbstractParser = require( './abstractparser' );
9
+ const ReflectionKind = require( './reflectionkind' );
9
10
 
10
11
  module.exports = class PropertyParser extends AbstractParser {
11
12
  /**
12
- * @param {TypedocReflectionMeta} item
13
+ * @param {BaseReflection} item
13
14
  * @returns {Boolean}
14
15
  */
15
16
  canParse( item ) {
16
- return item.kindString === 'Property' && item.name !== 'constructor';
17
+ return item.kind === ReflectionKind.Property;
17
18
  }
18
19
 
19
20
  /**
20
- * @param {TypedocReflection<'Property'>} item
21
+ * @param {PropertyReflection} item
21
22
  * @param {String} parentName
22
23
  * @returns {Object}
23
24
  */
24
25
  parse( item, parentName ) {
25
- // By default, a comment that is associated in the source code with the property, is bound to the item itself, as anyone would
26
- // expect. TypeDoc works differently for a callable property, for which the comment is moved down to the property signature.
27
- // Hence, we must extract it back from the property signature to be able to display it correctly in the API docs.
28
- const description = isCallableProperty( item ) ?
29
- this.getComment( item.type.declaration.signatures[ 0 ] ) :
30
- this.getComment( item );
31
-
32
26
  return {
33
27
  // Needed for post-processing once all project reflections are converted.
34
28
  _signature: [ item, {} ],
35
29
 
30
+ id: item.id,
36
31
  name: item.name,
37
32
  memberof: parentName,
38
33
  longname: this.getLongName( item, parentName ),
@@ -44,7 +39,7 @@ module.exports = class PropertyParser extends AbstractParser {
44
39
  optional: this.isOptional( item ),
45
40
  kind: this.getKind( item ),
46
41
  extraId: this.getExtraId( item ),
47
- description,
42
+ description: this.getComment( item ),
48
43
  file: this.getFile( item ),
49
44
  skipSource: this.shouldSkipSource( item ),
50
45
  deprecated: this.isDeprecated( item ),
@@ -60,7 +55,7 @@ module.exports = class PropertyParser extends AbstractParser {
60
55
  /**
61
56
  * Returns the default value of an item defined by the `@defaultValue` or `@default` tags.
62
57
  *
63
- * @param {TypedocReflection} item
58
+ * @param {PropertyReflection} item
64
59
  * @returns {String}
65
60
  */
66
61
  getDefault( item ) {
@@ -77,19 +72,3 @@ module.exports = class PropertyParser extends AbstractParser {
77
72
  return defaultTag.content[ 0 ].text;
78
73
  }
79
74
  };
80
-
81
- /**
82
- * @param {TypedocReflectionType} item
83
- * @returns {Boolean}
84
- */
85
- function isCallableProperty( item ) {
86
- if ( item.type.type !== 'reflection' ) {
87
- return false;
88
- }
89
-
90
- if ( !Array.isArray( item.type.declaration.signatures ) ) {
91
- return false;
92
- }
93
-
94
- return true;
95
- }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const AbstractParser = require( './abstractparser' );
9
+ const ReflectionKind = require( './reflectionkind' );
10
+
11
+ module.exports = class ReferenceParser extends AbstractParser {
12
+ /**
13
+ * @param {BaseReflection} item
14
+ * @returns {Boolean}
15
+ */
16
+ canParse( item ) {
17
+ return item.kind === ReflectionKind.Reference;
18
+ }
19
+
20
+ /**
21
+ * @param {ReferenceReflection} item
22
+ * @param {String} parentName
23
+ * @returns {Object}
24
+ */
25
+ parse( item, parentName ) {
26
+ return {
27
+ // Needed for post-processing once all project reflections are converted.
28
+ _signature: item,
29
+
30
+ id: item.id,
31
+ name: item.name,
32
+ memberof: parentName,
33
+ longname: this.getLongName( item, parentName ),
34
+ file: this.getFile( item ),
35
+
36
+ _isReference: true,
37
+
38
+ targetDoclet: null
39
+ };
40
+ }
41
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ // To avoid linking Umberto and Typedoc, let's keep this file in sync with the `ReflectionKind` enum.
9
+ // See: https://typedoc.org/api/enums/Models.ReflectionKind.html
10
+
11
+ module.exports.Accessor = 262144;
12
+ module.exports.CallSignature = 4096;
13
+ module.exports.Class = 128;
14
+ module.exports.Constructor = 512;
15
+ module.exports.ConstructorSignature = 16384;
16
+ module.exports.Document = 8388608;
17
+ module.exports.Enum = 8;
18
+ module.exports.EnumMember = 16;
19
+ module.exports.Function = 64;
20
+ module.exports.GetSignature = 524288;
21
+ module.exports.IndexSignature = 8192;
22
+ module.exports.Interface = 256;
23
+ module.exports.Method = 2048;
24
+ module.exports.Module = 2;
25
+ module.exports.Namespace = 4;
26
+ module.exports.Parameter = 32768;
27
+ module.exports.Project = 1;
28
+ module.exports.Property = 1024;
29
+ module.exports.Reference = 4194304;
30
+ module.exports.SetSignature = 1048576;
31
+ module.exports.TypeAlias = 2097152;
32
+ module.exports.TypeLiteral = 65536;
33
+ module.exports.TypeParameter = 131072;
34
+ module.exports.Variable = 32;