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.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/lib/application.d.ts +3 -3
- package/dist/lib/application.js +440 -359
- package/dist/lib/cli.js +6 -3
- package/dist/lib/converter/comments/parser.js +5 -11
- package/dist/lib/converter/comments/tagName.d.ts +8 -0
- package/dist/lib/converter/comments/tagName.js +62 -0
- package/dist/lib/converter/context.js +1 -2
- package/dist/lib/converter/converter.d.ts +11 -11
- package/dist/lib/converter/converter.js +436 -311
- package/dist/lib/converter/factories/signature.js +3 -4
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
- package/dist/lib/converter/plugins/CategoryPlugin.js +293 -200
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +433 -305
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +3 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +215 -145
- package/dist/lib/converter/plugins/ImplementsPlugin.js +239 -194
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/InheritDocPlugin.js +201 -138
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +110 -44
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
- package/dist/lib/converter/plugins/PackagePlugin.js +191 -96
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -6
- package/dist/lib/converter/plugins/SourcePlugin.js +234 -146
- package/dist/lib/converter/plugins/TypePlugin.js +147 -102
- package/dist/lib/converter/symbols.js +1 -1
- package/dist/lib/converter/types.js +10 -0
- package/dist/lib/converter/utils/repository.js +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
- package/dist/lib/models/reflections/abstract.d.ts +4 -0
- package/dist/lib/models/reflections/abstract.js +14 -2
- package/dist/lib/models/reflections/index.d.ts +1 -1
- package/dist/lib/output/components.d.ts +1 -0
- package/dist/lib/output/components.js +9 -1
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.js +111 -44
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +173 -99
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
- package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
- package/dist/lib/output/plugins/index.d.ts +2 -1
- package/dist/lib/output/plugins/index.js +5 -3
- package/dist/lib/output/renderer.d.ts +10 -8
- package/dist/lib/output/renderer.js +315 -202
- package/dist/lib/output/theme.js +63 -18
- package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
- package/dist/lib/output/themes/MarkedPlugin.js +223 -145
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +68 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +42 -36
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +15 -1
- package/dist/lib/output/themes/default/layouts/default.js +2 -0
- package/dist/lib/output/themes/default/partials/header.js +1 -1
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
- package/dist/lib/output/themes/default/partials/icon.js +40 -35
- package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +34 -67
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +3 -1
- package/dist/lib/utils/entry-point.js +27 -14
- package/dist/lib/utils/events.js +1 -1
- package/dist/lib/utils/general.js +1 -1
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/jsx.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +2 -0
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/index.js +2 -1
- package/dist/lib/utils/options/options.d.ts +19 -0
- package/dist/lib/utils/options/options.js +22 -2
- package/dist/lib/utils/options/readers/tsconfig.js +2 -7
- package/dist/lib/utils/options/sources/typedoc.js +11 -0
- package/dist/lib/utils/perf.d.ts +1 -1
- package/dist/lib/utils/perf.js +10 -20
- package/package.json +1 -1
- package/static/main.js +4 -3
- 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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
67
|
+
private static sortCatCallback;
|
|
68
|
+
static getCategories(reflection: DeclarationReflection): Set<string>;
|
|
69
69
|
}
|
|
@@ -1,11 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
83
|
-
this.
|
|
149
|
+
categorize(obj) {
|
|
150
|
+
if (this.categorizeByGroup) {
|
|
151
|
+
this.groupCategorize(obj);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
this.lumpCategorize(obj);
|
|
155
|
+
}
|
|
84
156
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
|
91
|
-
if (
|
|
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
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
215
|
-
|
|
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
|
-
|
|
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
|
}
|