typedoc 0.25.0 → 0.25.1

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 (81) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +2 -1
  3. package/dist/lib/application.d.ts +3 -3
  4. package/dist/lib/application.js +440 -359
  5. package/dist/lib/cli.js +6 -3
  6. package/dist/lib/converter/comments/parser.js +5 -11
  7. package/dist/lib/converter/comments/tagName.d.ts +8 -0
  8. package/dist/lib/converter/comments/tagName.js +62 -0
  9. package/dist/lib/converter/context.js +1 -2
  10. package/dist/lib/converter/converter.d.ts +11 -11
  11. package/dist/lib/converter/converter.js +436 -311
  12. package/dist/lib/converter/factories/signature.js +3 -4
  13. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
  14. package/dist/lib/converter/plugins/CategoryPlugin.js +293 -200
  15. package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
  16. package/dist/lib/converter/plugins/CommentPlugin.js +433 -305
  17. package/dist/lib/converter/plugins/GroupPlugin.d.ts +3 -3
  18. package/dist/lib/converter/plugins/GroupPlugin.js +215 -145
  19. package/dist/lib/converter/plugins/ImplementsPlugin.js +239 -194
  20. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
  21. package/dist/lib/converter/plugins/InheritDocPlugin.js +201 -138
  22. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
  23. package/dist/lib/converter/plugins/LinkResolverPlugin.js +110 -44
  24. package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
  25. package/dist/lib/converter/plugins/PackagePlugin.js +191 -96
  26. package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -6
  27. package/dist/lib/converter/plugins/SourcePlugin.js +234 -146
  28. package/dist/lib/converter/plugins/TypePlugin.js +147 -102
  29. package/dist/lib/converter/symbols.js +1 -1
  30. package/dist/lib/converter/types.js +10 -0
  31. package/dist/lib/converter/utils/repository.js +2 -2
  32. package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
  33. package/dist/lib/models/reflections/abstract.d.ts +4 -0
  34. package/dist/lib/models/reflections/abstract.js +14 -2
  35. package/dist/lib/models/reflections/index.d.ts +1 -1
  36. package/dist/lib/output/components.d.ts +1 -0
  37. package/dist/lib/output/components.js +9 -1
  38. package/dist/lib/output/index.d.ts +1 -1
  39. package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
  40. package/dist/lib/output/plugins/AssetsPlugin.js +111 -44
  41. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
  42. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +173 -99
  43. package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
  44. package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
  45. package/dist/lib/output/plugins/index.d.ts +2 -1
  46. package/dist/lib/output/plugins/index.js +5 -3
  47. package/dist/lib/output/renderer.d.ts +10 -8
  48. package/dist/lib/output/renderer.js +315 -202
  49. package/dist/lib/output/theme.js +63 -18
  50. package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
  51. package/dist/lib/output/themes/MarkedPlugin.js +223 -145
  52. package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
  53. package/dist/lib/output/themes/default/DefaultTheme.js +68 -0
  54. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +42 -36
  55. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +15 -1
  56. package/dist/lib/output/themes/default/layouts/default.js +2 -0
  57. package/dist/lib/output/themes/default/partials/header.js +1 -1
  58. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
  59. package/dist/lib/output/themes/default/partials/icon.js +40 -35
  60. package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
  61. package/dist/lib/output/themes/default/partials/navigation.js +34 -67
  62. package/dist/lib/utils/component.d.ts +1 -1
  63. package/dist/lib/utils/component.js +3 -1
  64. package/dist/lib/utils/entry-point.js +27 -14
  65. package/dist/lib/utils/events.js +1 -1
  66. package/dist/lib/utils/general.js +1 -1
  67. package/dist/lib/utils/index.d.ts +1 -1
  68. package/dist/lib/utils/index.js +2 -1
  69. package/dist/lib/utils/jsx.js +1 -1
  70. package/dist/lib/utils/options/declaration.d.ts +2 -0
  71. package/dist/lib/utils/options/index.d.ts +1 -1
  72. package/dist/lib/utils/options/index.js +2 -1
  73. package/dist/lib/utils/options/options.d.ts +19 -0
  74. package/dist/lib/utils/options/options.js +22 -2
  75. package/dist/lib/utils/options/readers/tsconfig.js +2 -7
  76. package/dist/lib/utils/options/sources/typedoc.js +11 -0
  77. package/dist/lib/utils/perf.d.ts +1 -1
  78. package/dist/lib/utils/perf.js +10 -20
  79. package/package.json +1 -1
  80. package/static/main.js +4 -3
  81. package/static/style.css +7 -3
@@ -12,9 +12,8 @@ const convert_expression_1 = require("../convert-expression");
12
12
  const reflections_1 = require("../utils/reflections");
13
13
  const ReflectionSymbolId_1 = require("../../models/reflections/ReflectionSymbolId");
14
14
  function createSignature(context, kind, signature, symbol, declaration) {
15
- var _a;
16
15
  (0, assert_1.default)(context.scope instanceof models_1.DeclarationReflection);
17
- declaration || (declaration = signature.getDeclaration());
16
+ declaration ||= signature.getDeclaration();
18
17
  const sigRef = new models_1.SignatureReflection(kind == models_1.ReflectionKind.ConstructorSignature
19
18
  ? `new ${context.scope.parent.name}`
20
19
  : context.scope.name, kind, context.scope);
@@ -63,7 +62,7 @@ function createSignature(context, kind, signature, symbol, declaration) {
63
62
  break;
64
63
  case models_1.ReflectionKind.CallSignature:
65
64
  case models_1.ReflectionKind.ConstructorSignature:
66
- (_a = context.scope).signatures ?? (_a.signatures = []);
65
+ context.scope.signatures ??= [];
67
66
  context.scope.signatures.push(sigRef);
68
67
  break;
69
68
  }
@@ -80,7 +79,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
80
79
  if (declaration && typescript_1.default.isJSDocParameterTag(declaration)) {
81
80
  paramRefl.comment = context.getJsDocComment(declaration);
82
81
  }
83
- paramRefl.comment || (paramRefl.comment = context.getComment(param, paramRefl.kind));
82
+ paramRefl.comment ||= context.getComment(param, paramRefl.kind);
84
83
  context.registerReflection(paramRefl, param);
85
84
  context.trigger(converter_events_1.ConverterEvents.CREATE_PARAMETER, paramRefl);
86
85
  let type;
@@ -1,5 +1,4 @@
1
1
  import { DeclarationReflection } from "../../models";
2
- import { ReflectionCategory } from "../../models";
3
2
  import { ConverterComponent } from "../components";
4
3
  /**
5
4
  * A handler that sorts and categorizes the found reflections in the resolving phase.
@@ -8,10 +7,10 @@ import { ConverterComponent } from "../components";
8
7
  */
9
8
  export declare class CategoryPlugin extends ConverterComponent {
10
9
  sortFunction: (reflections: DeclarationReflection[]) => void;
11
- defaultCategory: string;
12
- categoryOrder: string[];
13
- categorizeByGroup: boolean;
14
- boosts: Record<string, number>;
10
+ accessor defaultCategory: string;
11
+ accessor categoryOrder: string[];
12
+ accessor categorizeByGroup: boolean;
13
+ accessor boosts: Record<string, number>;
15
14
  usedBoosts: Set<string>;
16
15
  static defaultCategory: string;
17
16
  static WEIGHTS: string[];
@@ -47,7 +46,7 @@ export declare class CategoryPlugin extends ConverterComponent {
47
46
  * relevance boost to be used when searching
48
47
  * @returns An array containing all children of the given reflection categorized
49
48
  */
50
- getReflectionCategories(reflections: DeclarationReflection[]): ReflectionCategory[];
49
+ private getReflectionCategories;
51
50
  /**
52
51
  * Return the category of a given reflection.
53
52
  *
@@ -57,7 +56,7 @@ export declare class CategoryPlugin extends ConverterComponent {
57
56
  * @privateRemarks
58
57
  * If you change this, also update getGroups in GroupPlugin accordingly.
59
58
  */
60
- getCategories(reflection: DeclarationReflection): Set<string>;
59
+ private extractCategories;
61
60
  /**
62
61
  * Callback used to sort categories by name.
63
62
  *
@@ -65,5 +64,6 @@ export declare class CategoryPlugin extends ConverterComponent {
65
64
  * @param b The right reflection to sort.
66
65
  * @returns The sorting weight.
67
66
  */
68
- static sortCatCallback(a: ReflectionCategory, b: ReflectionCategory): number;
67
+ private static sortCatCallback;
68
+ static getCategories(reflection: DeclarationReflection): Set<string>;
69
69
  }
@@ -1,11 +1,53 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.unshift(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.unshift(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
41
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
42
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
43
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
44
+ };
45
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
46
+ if (kind === "m") throw new TypeError("Private method is not writable");
47
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
48
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
49
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
50
  };
8
- var CategoryPlugin_1;
9
51
  Object.defineProperty(exports, "__esModule", { value: true });
10
52
  exports.CategoryPlugin = void 0;
11
53
  const models_1 = require("../../models");
@@ -18,221 +60,272 @@ const utils_1 = require("../../utils");
18
60
  *
19
61
  * The handler sets the ´category´ property of all reflections.
20
62
  */
21
- let CategoryPlugin = CategoryPlugin_1 = class CategoryPlugin extends components_1.ConverterComponent {
22
- constructor() {
23
- super(...arguments);
24
- this.usedBoosts = new Set();
25
- }
26
- /**
27
- * Create a new CategoryPlugin instance.
28
- */
29
- initialize() {
30
- this.listenTo(this.owner, {
31
- [converter_1.Converter.EVENT_BEGIN]: this.onBegin,
32
- [converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
33
- [converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
34
- }, undefined, -200);
35
- }
36
- /**
37
- * Triggered when the converter begins converting a project.
38
- */
39
- onBegin(_context) {
40
- this.sortFunction = (0, utils_1.getSortFunction)(this.application.options);
41
- // Set up static properties
42
- if (this.defaultCategory) {
43
- CategoryPlugin_1.defaultCategory = this.defaultCategory;
63
+ let CategoryPlugin = (() => {
64
+ var _CategoryPlugin_defaultCategory_accessor_storage, _CategoryPlugin_categoryOrder_accessor_storage, _CategoryPlugin_categorizeByGroup_accessor_storage, _CategoryPlugin_boosts_accessor_storage;
65
+ let _classDecorators = [(0, components_1.Component)({ name: "category" })];
66
+ let _classDescriptor;
67
+ let _classExtraInitializers = [];
68
+ let _classThis;
69
+ let _classSuper = components_1.ConverterComponent;
70
+ let _instanceExtraInitializers = [];
71
+ let _defaultCategory_decorators;
72
+ let _defaultCategory_initializers = [];
73
+ let _categoryOrder_decorators;
74
+ let _categoryOrder_initializers = [];
75
+ let _categorizeByGroup_decorators;
76
+ let _categorizeByGroup_initializers = [];
77
+ let _boosts_decorators;
78
+ let _boosts_initializers = [];
79
+ var CategoryPlugin = _classThis = class extends _classSuper {
80
+ constructor() {
81
+ super(...arguments);
82
+ this.sortFunction = (__runInitializers(this, _instanceExtraInitializers), void 0);
83
+ _CategoryPlugin_defaultCategory_accessor_storage.set(this, __runInitializers(this, _defaultCategory_initializers, void 0));
84
+ _CategoryPlugin_categoryOrder_accessor_storage.set(this, __runInitializers(this, _categoryOrder_initializers, void 0));
85
+ _CategoryPlugin_categorizeByGroup_accessor_storage.set(this, __runInitializers(this, _categorizeByGroup_initializers, void 0));
86
+ _CategoryPlugin_boosts_accessor_storage.set(this, __runInitializers(this, _boosts_initializers, void 0));
87
+ this.usedBoosts = new Set();
44
88
  }
45
- if (this.categoryOrder) {
46
- CategoryPlugin_1.WEIGHTS = this.categoryOrder;
89
+ get defaultCategory() { return __classPrivateFieldGet(this, _CategoryPlugin_defaultCategory_accessor_storage, "f"); }
90
+ set defaultCategory(value) { __classPrivateFieldSet(this, _CategoryPlugin_defaultCategory_accessor_storage, value, "f"); }
91
+ get categoryOrder() { return __classPrivateFieldGet(this, _CategoryPlugin_categoryOrder_accessor_storage, "f"); }
92
+ set categoryOrder(value) { __classPrivateFieldSet(this, _CategoryPlugin_categoryOrder_accessor_storage, value, "f"); }
93
+ get categorizeByGroup() { return __classPrivateFieldGet(this, _CategoryPlugin_categorizeByGroup_accessor_storage, "f"); }
94
+ set categorizeByGroup(value) { __classPrivateFieldSet(this, _CategoryPlugin_categorizeByGroup_accessor_storage, value, "f"); }
95
+ get boosts() { return __classPrivateFieldGet(this, _CategoryPlugin_boosts_accessor_storage, "f"); }
96
+ set boosts(value) { __classPrivateFieldSet(this, _CategoryPlugin_boosts_accessor_storage, value, "f"); }
97
+ /**
98
+ * Create a new CategoryPlugin instance.
99
+ */
100
+ initialize() {
101
+ this.listenTo(this.owner, {
102
+ [converter_1.Converter.EVENT_BEGIN]: this.onBegin,
103
+ [converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
104
+ [converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
105
+ }, undefined, -200);
47
106
  }
48
- }
49
- /**
50
- * Triggered when the converter resolves a reflection.
51
- *
52
- * @param context The context object describing the current state the converter is in.
53
- * @param reflection The reflection that is currently resolved.
54
- */
55
- onResolve(_context, reflection) {
56
- if (reflection instanceof models_1.ContainerReflection) {
57
- this.categorize(reflection);
58
- }
59
- }
60
- /**
61
- * Triggered when the converter has finished resolving a project.
62
- *
63
- * @param context The context object describing the current state the converter is in.
64
- */
65
- onEndResolve(context) {
66
- const project = context.project;
67
- this.categorize(project);
68
- const unusedBoosts = new Set(Object.keys(this.boosts));
69
- for (const boost of this.usedBoosts) {
70
- unusedBoosts.delete(boost);
107
+ /**
108
+ * Triggered when the converter begins converting a project.
109
+ */
110
+ onBegin(_context) {
111
+ this.sortFunction = (0, utils_1.getSortFunction)(this.application.options);
112
+ // Set up static properties
113
+ if (this.defaultCategory) {
114
+ CategoryPlugin.defaultCategory = this.defaultCategory;
115
+ }
116
+ if (this.categoryOrder) {
117
+ CategoryPlugin.WEIGHTS = this.categoryOrder;
118
+ }
71
119
  }
72
- this.usedBoosts.clear();
73
- if (unusedBoosts.size) {
74
- context.logger.warn(`Not all categories specified in searchCategoryBoosts were used in the documentation.` +
75
- ` The unused categories were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
120
+ /**
121
+ * Triggered when the converter resolves a reflection.
122
+ *
123
+ * @param context The context object describing the current state the converter is in.
124
+ * @param reflection The reflection that is currently resolved.
125
+ */
126
+ onResolve(_context, reflection) {
127
+ if (reflection instanceof models_1.ContainerReflection) {
128
+ this.categorize(reflection);
129
+ }
76
130
  }
77
- }
78
- categorize(obj) {
79
- if (this.categorizeByGroup) {
80
- this.groupCategorize(obj);
131
+ /**
132
+ * Triggered when the converter has finished resolving a project.
133
+ *
134
+ * @param context The context object describing the current state the converter is in.
135
+ */
136
+ onEndResolve(context) {
137
+ const project = context.project;
138
+ this.categorize(project);
139
+ const unusedBoosts = new Set(Object.keys(this.boosts));
140
+ for (const boost of this.usedBoosts) {
141
+ unusedBoosts.delete(boost);
142
+ }
143
+ this.usedBoosts.clear();
144
+ if (unusedBoosts.size) {
145
+ context.logger.warn(`Not all categories specified in searchCategoryBoosts were used in the documentation.` +
146
+ ` The unused categories were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
147
+ }
81
148
  }
82
- else {
83
- this.lumpCategorize(obj);
149
+ categorize(obj) {
150
+ if (this.categorizeByGroup) {
151
+ this.groupCategorize(obj);
152
+ }
153
+ else {
154
+ this.lumpCategorize(obj);
155
+ }
84
156
  }
85
- }
86
- groupCategorize(obj) {
87
- if (!obj.groups || obj.groups.length === 0) {
88
- return;
157
+ groupCategorize(obj) {
158
+ if (!obj.groups || obj.groups.length === 0) {
159
+ return;
160
+ }
161
+ obj.groups.forEach((group) => {
162
+ if (group.categories)
163
+ return;
164
+ group.categories = this.getReflectionCategories(group.children);
165
+ if (group.categories && group.categories.length > 1) {
166
+ group.categories.sort(CategoryPlugin.sortCatCallback);
167
+ }
168
+ else if (group.categories.length === 1 &&
169
+ group.categories[0].title === CategoryPlugin.defaultCategory) {
170
+ // no categories if everything is uncategorized
171
+ group.categories = undefined;
172
+ }
173
+ });
89
174
  }
90
- obj.groups.forEach((group) => {
91
- if (group.categories)
175
+ lumpCategorize(obj) {
176
+ if (!obj.children || obj.children.length === 0 || obj.categories) {
92
177
  return;
93
- group.categories = this.getReflectionCategories(group.children);
94
- if (group.categories && group.categories.length > 1) {
95
- group.categories.sort(CategoryPlugin_1.sortCatCallback);
96
178
  }
97
- else if (group.categories.length === 1 &&
98
- group.categories[0].title === CategoryPlugin_1.defaultCategory) {
179
+ obj.categories = this.getReflectionCategories(obj.children);
180
+ if (obj.categories && obj.categories.length > 1) {
181
+ obj.categories.sort(CategoryPlugin.sortCatCallback);
182
+ }
183
+ else if (obj.categories.length === 1 &&
184
+ obj.categories[0].title === CategoryPlugin.defaultCategory) {
99
185
  // no categories if everything is uncategorized
100
- group.categories = undefined;
186
+ obj.categories = undefined;
101
187
  }
102
- });
103
- }
104
- lumpCategorize(obj) {
105
- if (!obj.children || obj.children.length === 0 || obj.categories) {
106
- return;
107
- }
108
- obj.categories = this.getReflectionCategories(obj.children);
109
- if (obj.categories && obj.categories.length > 1) {
110
- obj.categories.sort(CategoryPlugin_1.sortCatCallback);
111
- }
112
- else if (obj.categories.length === 1 &&
113
- obj.categories[0].title === CategoryPlugin_1.defaultCategory) {
114
- // no categories if everything is uncategorized
115
- obj.categories = undefined;
116
188
  }
117
- }
118
- /**
119
- * Create a categorized representation of the given list of reflections.
120
- *
121
- * @param reflections The reflections that should be categorized.
122
- * @param categorySearchBoosts A user-supplied map of category titles, for computing a
123
- * relevance boost to be used when searching
124
- * @returns An array containing all children of the given reflection categorized
125
- */
126
- getReflectionCategories(reflections) {
127
- const categories = new Map();
128
- for (const child of reflections) {
129
- const childCategories = this.getCategories(child);
130
- if (childCategories.size === 0) {
131
- childCategories.add(CategoryPlugin_1.defaultCategory);
132
- }
133
- for (const childCat of childCategories) {
134
- const category = categories.get(childCat);
135
- if (category) {
136
- category.children.push(child);
189
+ /**
190
+ * Create a categorized representation of the given list of reflections.
191
+ *
192
+ * @param reflections The reflections that should be categorized.
193
+ * @param categorySearchBoosts A user-supplied map of category titles, for computing a
194
+ * relevance boost to be used when searching
195
+ * @returns An array containing all children of the given reflection categorized
196
+ */
197
+ getReflectionCategories(reflections) {
198
+ const categories = new Map();
199
+ for (const child of reflections) {
200
+ const childCategories = this.extractCategories(child);
201
+ if (childCategories.size === 0) {
202
+ childCategories.add(CategoryPlugin.defaultCategory);
137
203
  }
138
- else {
139
- const cat = new models_2.ReflectionCategory(childCat);
140
- cat.children.push(child);
141
- categories.set(childCat, cat);
204
+ for (const childCat of childCategories) {
205
+ const category = categories.get(childCat);
206
+ if (category) {
207
+ category.children.push(child);
208
+ }
209
+ else {
210
+ const cat = new models_2.ReflectionCategory(childCat);
211
+ cat.children.push(child);
212
+ categories.set(childCat, cat);
213
+ }
142
214
  }
143
215
  }
216
+ for (const cat of categories.values()) {
217
+ this.sortFunction(cat.children);
218
+ }
219
+ return Array.from(categories.values());
144
220
  }
145
- for (const cat of categories.values()) {
146
- this.sortFunction(cat.children);
147
- }
148
- return Array.from(categories.values());
149
- }
150
- /**
151
- * Return the category of a given reflection.
152
- *
153
- * @param reflection The reflection.
154
- * @returns The category the reflection belongs to
155
- *
156
- * @privateRemarks
157
- * If you change this, also update getGroups in GroupPlugin accordingly.
158
- */
159
- getCategories(reflection) {
160
- const categories = new Set();
161
- function extractCategoryTags(comment) {
162
- if (!comment)
163
- return;
164
- (0, utils_1.removeIf)(comment.blockTags, (tag) => {
165
- if (tag.tag === "@category") {
166
- categories.add(models_1.Comment.combineDisplayParts(tag.content).trim());
167
- return true;
221
+ /**
222
+ * Return the category of a given reflection.
223
+ *
224
+ * @param reflection The reflection.
225
+ * @returns The category the reflection belongs to
226
+ *
227
+ * @privateRemarks
228
+ * If you change this, also update getGroups in GroupPlugin accordingly.
229
+ */
230
+ extractCategories(reflection) {
231
+ const categories = CategoryPlugin.getCategories(reflection);
232
+ reflection.comment?.removeTags("@category");
233
+ for (const sig of reflection.getNonIndexSignatures()) {
234
+ sig.comment?.removeTags("@category");
235
+ }
236
+ if (reflection.type?.type === "reflection") {
237
+ reflection.type.declaration.comment?.removeTags("@category");
238
+ for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
239
+ sig.comment?.removeTags("@category");
168
240
  }
169
- return false;
170
- });
171
- }
172
- extractCategoryTags(reflection.comment);
173
- for (const sig of reflection.getNonIndexSignatures()) {
174
- extractCategoryTags(sig.comment);
175
- }
176
- if (reflection.type?.type === "reflection") {
177
- extractCategoryTags(reflection.type.declaration.comment);
178
- for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
179
- extractCategoryTags(sig.comment);
180
241
  }
181
- }
182
- categories.delete("");
183
- for (const cat of categories) {
184
- if (cat in this.boosts) {
185
- this.usedBoosts.add(cat);
186
- reflection.relevanceBoost =
187
- (reflection.relevanceBoost ?? 1) * this.boosts[cat];
242
+ categories.delete("");
243
+ for (const cat of categories) {
244
+ if (cat in this.boosts) {
245
+ this.usedBoosts.add(cat);
246
+ reflection.relevanceBoost =
247
+ (reflection.relevanceBoost ?? 1) * this.boosts[cat];
248
+ }
188
249
  }
250
+ return categories;
189
251
  }
190
- return categories;
191
- }
192
- /**
193
- * Callback used to sort categories by name.
194
- *
195
- * @param a The left reflection to sort.
196
- * @param b The right reflection to sort.
197
- * @returns The sorting weight.
198
- */
199
- static sortCatCallback(a, b) {
200
- let aWeight = CategoryPlugin_1.WEIGHTS.indexOf(a.title);
201
- let bWeight = CategoryPlugin_1.WEIGHTS.indexOf(b.title);
202
- if (aWeight === -1 || bWeight === -1) {
203
- let asteriskIndex = CategoryPlugin_1.WEIGHTS.indexOf("*");
204
- if (asteriskIndex === -1) {
205
- asteriskIndex = CategoryPlugin_1.WEIGHTS.length;
206
- }
207
- if (aWeight === -1) {
208
- aWeight = asteriskIndex;
209
- }
210
- if (bWeight === -1) {
211
- bWeight = asteriskIndex;
252
+ /**
253
+ * Callback used to sort categories by name.
254
+ *
255
+ * @param a The left reflection to sort.
256
+ * @param b The right reflection to sort.
257
+ * @returns The sorting weight.
258
+ */
259
+ static sortCatCallback(a, b) {
260
+ let aWeight = CategoryPlugin.WEIGHTS.indexOf(a.title);
261
+ let bWeight = CategoryPlugin.WEIGHTS.indexOf(b.title);
262
+ if (aWeight === -1 || bWeight === -1) {
263
+ let asteriskIndex = CategoryPlugin.WEIGHTS.indexOf("*");
264
+ if (asteriskIndex === -1) {
265
+ asteriskIndex = CategoryPlugin.WEIGHTS.length;
266
+ }
267
+ if (aWeight === -1) {
268
+ aWeight = asteriskIndex;
269
+ }
270
+ if (bWeight === -1) {
271
+ bWeight = asteriskIndex;
272
+ }
273
+ }
274
+ if (aWeight === bWeight) {
275
+ return a.title > b.title ? 1 : -1;
212
276
  }
277
+ return aWeight - bWeight;
213
278
  }
214
- if (aWeight === bWeight) {
215
- return a.title > b.title ? 1 : -1;
279
+ static getCategories(reflection) {
280
+ const categories = new Set();
281
+ function discoverCategories(comment) {
282
+ if (!comment)
283
+ return;
284
+ for (const tag of comment.blockTags) {
285
+ if (tag.tag === "@category") {
286
+ categories.add(models_1.Comment.combineDisplayParts(tag.content).trim());
287
+ }
288
+ }
289
+ }
290
+ discoverCategories(reflection.comment);
291
+ for (const sig of reflection.getNonIndexSignatures()) {
292
+ discoverCategories(sig.comment);
293
+ }
294
+ if (reflection.type?.type === "reflection") {
295
+ discoverCategories(reflection.type.declaration.comment);
296
+ for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
297
+ discoverCategories(sig.comment);
298
+ }
299
+ }
300
+ categories.delete("");
301
+ return categories;
216
302
  }
217
- return aWeight - bWeight;
218
- }
219
- };
303
+ };
304
+ _CategoryPlugin_defaultCategory_accessor_storage = new WeakMap();
305
+ _CategoryPlugin_categoryOrder_accessor_storage = new WeakMap();
306
+ _CategoryPlugin_categorizeByGroup_accessor_storage = new WeakMap();
307
+ _CategoryPlugin_boosts_accessor_storage = new WeakMap();
308
+ __setFunctionName(_classThis, "CategoryPlugin");
309
+ (() => {
310
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
311
+ _defaultCategory_decorators = [(0, utils_1.Option)("defaultCategory")];
312
+ _categoryOrder_decorators = [(0, utils_1.Option)("categoryOrder")];
313
+ _categorizeByGroup_decorators = [(0, utils_1.Option)("categorizeByGroup")];
314
+ _boosts_decorators = [(0, utils_1.Option)("searchCategoryBoosts")];
315
+ __esDecorate(_classThis, null, _defaultCategory_decorators, { kind: "accessor", name: "defaultCategory", static: false, private: false, access: { has: obj => "defaultCategory" in obj, get: obj => obj.defaultCategory, set: (obj, value) => { obj.defaultCategory = value; } }, metadata: _metadata }, _defaultCategory_initializers, _instanceExtraInitializers);
316
+ __esDecorate(_classThis, null, _categoryOrder_decorators, { kind: "accessor", name: "categoryOrder", static: false, private: false, access: { has: obj => "categoryOrder" in obj, get: obj => obj.categoryOrder, set: (obj, value) => { obj.categoryOrder = value; } }, metadata: _metadata }, _categoryOrder_initializers, _instanceExtraInitializers);
317
+ __esDecorate(_classThis, null, _categorizeByGroup_decorators, { kind: "accessor", name: "categorizeByGroup", static: false, private: false, access: { has: obj => "categorizeByGroup" in obj, get: obj => obj.categorizeByGroup, set: (obj, value) => { obj.categorizeByGroup = value; } }, metadata: _metadata }, _categorizeByGroup_initializers, _instanceExtraInitializers);
318
+ __esDecorate(_classThis, null, _boosts_decorators, { kind: "accessor", name: "boosts", static: false, private: false, access: { has: obj => "boosts" in obj, get: obj => obj.boosts, set: (obj, value) => { obj.boosts = value; } }, metadata: _metadata }, _boosts_initializers, _instanceExtraInitializers);
319
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
320
+ CategoryPlugin = _classThis = _classDescriptor.value;
321
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
322
+ })();
323
+ // For use in static methods
324
+ _classThis.defaultCategory = "Other";
325
+ _classThis.WEIGHTS = [];
326
+ (() => {
327
+ __runInitializers(_classThis, _classExtraInitializers);
328
+ })();
329
+ return CategoryPlugin = _classThis;
330
+ })();
220
331
  exports.CategoryPlugin = CategoryPlugin;
221
- // For use in static methods
222
- CategoryPlugin.defaultCategory = "Other";
223
- CategoryPlugin.WEIGHTS = [];
224
- __decorate([
225
- (0, utils_1.BindOption)("defaultCategory")
226
- ], CategoryPlugin.prototype, "defaultCategory", void 0);
227
- __decorate([
228
- (0, utils_1.BindOption)("categoryOrder")
229
- ], CategoryPlugin.prototype, "categoryOrder", void 0);
230
- __decorate([
231
- (0, utils_1.BindOption)("categorizeByGroup")
232
- ], CategoryPlugin.prototype, "categorizeByGroup", void 0);
233
- __decorate([
234
- (0, utils_1.BindOption)("searchCategoryBoosts")
235
- ], CategoryPlugin.prototype, "boosts", void 0);
236
- exports.CategoryPlugin = CategoryPlugin = CategoryPlugin_1 = __decorate([
237
- (0, components_1.Component)({ name: "category" })
238
- ], CategoryPlugin);
@@ -56,11 +56,13 @@ import { ConverterComponent } from "../components";
56
56
  *
57
57
  */
58
58
  export declare class CommentPlugin extends ConverterComponent {
59
- excludeTags: `@${string}`[];
60
- excludeInternal: boolean;
61
- excludePrivate: boolean;
62
- excludeProtected: boolean;
63
- excludeNotDocumented: boolean;
59
+ accessor excludeTags: `@${string}`[];
60
+ accessor excludeInternal: boolean;
61
+ accessor excludePrivate: boolean;
62
+ accessor excludeProtected: boolean;
63
+ accessor excludeNotDocumented: boolean;
64
+ accessor excludeCategories: string[];
65
+ accessor defaultCategory: string;
64
66
  private _excludeKinds;
65
67
  private get excludeNotDocumentedKinds();
66
68
  /**
@@ -118,4 +120,5 @@ export declare class CommentPlugin extends ConverterComponent {
118
120
  * @param reflection Reflection to check if hidden
119
121
  */
120
122
  private isHidden;
123
+ private excludedByCategory;
121
124
  }