typedoc 0.28.0-beta.1 → 0.28.0-beta.2
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 +1 -1
- package/dist/lib/converter/context.d.ts +16 -6
- package/dist/lib/converter/context.js +39 -3
- package/dist/lib/converter/factories/signature.js +1 -1
- package/dist/lib/converter/factories/symbol-id.js +1 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +1 -1
- package/dist/lib/converter/plugins/SourcePlugin.js +1 -1
- package/dist/lib/converter/symbols.js +14 -4
- package/dist/lib/converter/types.js +16 -21
- package/dist/lib/models/ContainerReflection.d.ts +2 -2
- package/dist/lib/models/ContainerReflection.js +28 -4
- package/dist/lib/models/ProjectReflection.d.ts +1 -1
- package/dist/lib/models/ProjectReflection.js +1 -1
- package/dist/lib/models/ReflectionSymbolId.d.ts +10 -0
- package/dist/lib/models/ReflectionSymbolId.js +10 -0
- package/dist/lib/output/formatter.d.ts +1 -0
- package/dist/lib/output/formatter.js +3 -0
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +4 -0
- package/dist/lib/output/renderer.d.ts +0 -5
- package/dist/lib/output/renderer.js +3 -40
- package/dist/lib/output/theme.d.ts +9 -1
- package/dist/lib/output/theme.js +8 -0
- package/dist/lib/output/themes/MarkedPlugin.js +2 -2
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +11 -5
- package/dist/lib/output/themes/default/DefaultTheme.js +275 -208
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +47 -40
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +9 -0
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +1 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +2 -9
- package/dist/lib/output/themes/default/partials/breadcrumb.js +2 -2
- package/dist/lib/output/themes/default/partials/comment.js +2 -3
- package/dist/lib/output/themes/default/partials/index.js +4 -6
- package/dist/lib/output/themes/default/partials/member.declaration.js +1 -1
- package/dist/lib/output/themes/default/partials/member.js +3 -5
- package/dist/lib/output/themes/default/partials/member.signature.body.js +2 -2
- package/dist/lib/output/themes/default/partials/member.signatures.js +2 -3
- package/dist/lib/output/themes/default/partials/members.js +2 -4
- package/dist/lib/output/themes/default/partials/moduleReflection.js +6 -10
- package/dist/lib/output/themes/default/partials/navigation.js +5 -7
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +5 -5
- package/dist/lib/output/themes/default/partials/typeDetails.js +99 -53
- package/dist/lib/output/themes/default/partials/typeParameters.js +2 -3
- package/dist/lib/output/themes/default/templates/hierarchy.js +3 -5
- package/dist/lib/output/themes/default/templates/reflection.js +7 -3
- package/dist/lib/output/themes/lib.js +8 -4
- package/dist/lib/utils/highlighter.d.ts +1 -0
- package/dist/lib/utils/highlighter.js +16 -2
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +1 -0
- package/dist/lib/utils/options/defaults.js +2 -0
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
- package/dist/lib/utils-common/jsx.elements.d.ts +16 -0
- package/dist/lib/utils-common/path.js +4 -1
- package/package.json +1 -1
- package/static/main.js +4 -4
- package/static/style.css +24 -17
- package/tsdoc.json +16 -0
- package/dist/lib/converter/factories/types.d.ts +0 -4
- package/dist/lib/converter/factories/types.js +0 -13
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type { Icons, NavigationElement, PageDefinition, PageHeading, RendererEve
|
|
|
41
41
|
export { Outputs } from "./lib/output/output.js";
|
|
42
42
|
export { ArgumentsReader, CommentStyle, EntryPointStrategy, normalizePath, Option, OptionDefaults, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, ValidatingFileRegistry, } from "./lib/utils/index.js";
|
|
43
43
|
export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, DocumentationEntryPoint, FancyConsoleLogger, FlagsDeclarationOption, JsDocCompatibility, KeyToDeclaration, ManuallyValidatedOption, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, ObjectDeclarationOption, OptionsReader, OutputSpecification, ParameterTypeToOptionTypeMap, SortStrategy, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, TypeDocOptionValues, ValidationOptions, } from "./lib/utils/index.js";
|
|
44
|
-
export { type ComponentPath, ConsoleLogger, type DeclarationReference, type EnumKeys, EventDispatcher, EventHooks, type GlobString, i18n, JSX, Logger, LogLevel, type Meaning, type MeaningKeyword, type MinimalNode, MinimalSourceFile, type NormalizedPath, type NormalizedPathOrModule, type SymbolReference, translateTagName, } from "#utils";
|
|
44
|
+
export { type ComponentPath, ConsoleLogger, type DeclarationReference, type EnumKeys, EventDispatcher, EventHooks, type GlobString, i18n, JSX, Logger, LogLevel, type Meaning, type MeaningKeyword, type MinimalNode, MinimalSourceFile, type NormalizedPath, type NormalizedPathOrModule, type SymbolReference, type TranslatedString, translateTagName, } from "#utils";
|
|
45
45
|
export { type Deserializable, Deserializer, type DeserializerComponent, JSONOutput, SerializeEvent, Serializer, type SerializerComponent, type SerializerEvents, } from "./lib/serialization/index.js";
|
|
46
46
|
export * as Internationalization from "./lib/internationalization/index.js";
|
|
47
47
|
export type { TranslatableStrings } from "./lib/internationalization/internationalization.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { DeclarationReflection, type DocumentReflection, type ProjectReflection, type Reflection, ReflectionKind } from "../models/index.js";
|
|
2
|
+
import { Comment, DeclarationReflection, type DocumentReflection, type ProjectReflection, ReferenceType, type Reflection, ReflectionKind } from "../models/index.js";
|
|
3
3
|
import type { Converter } from "./converter.js";
|
|
4
4
|
import { type NormalizedPath } from "#utils";
|
|
5
5
|
/**
|
|
@@ -35,6 +35,8 @@ export declare class Context {
|
|
|
35
35
|
convertingTypeNode: boolean;
|
|
36
36
|
convertingClassOrInterface: boolean;
|
|
37
37
|
shouldBeStatic: boolean;
|
|
38
|
+
inlineType: Set<string>;
|
|
39
|
+
preventInline: Set<string>;
|
|
38
40
|
private reflectionIdToSymbolMap;
|
|
39
41
|
/**
|
|
40
42
|
* Create a new Context instance.
|
|
@@ -58,6 +60,13 @@ export declare class Context {
|
|
|
58
60
|
createDeclarationReflection(kind: ReflectionKind, symbol: ts.Symbol | undefined, exportSymbol: ts.Symbol | undefined, nameOverride?: string): DeclarationReflection;
|
|
59
61
|
postReflectionCreation(reflection: Reflection, symbol: ts.Symbol | undefined, exportSymbol: ts.Symbol | undefined): void;
|
|
60
62
|
finalizeDeclarationReflection(reflection: DeclarationReflection): void;
|
|
63
|
+
/**
|
|
64
|
+
* Create a {@link ReferenceType} which points to the provided symbol.
|
|
65
|
+
*
|
|
66
|
+
* @privateRemarks
|
|
67
|
+
* This is available on Context so that it can be monkey-patched by typedoc-plugin-missing-exports
|
|
68
|
+
*/
|
|
69
|
+
createSymbolReference(symbol: ts.Symbol, context: Context, name?: string): ReferenceType;
|
|
61
70
|
addChild(reflection: DeclarationReflection | DocumentReflection): void;
|
|
62
71
|
shouldIgnore(symbol: ts.Symbol): boolean;
|
|
63
72
|
/**
|
|
@@ -72,10 +81,11 @@ export declare class Context {
|
|
|
72
81
|
getSymbolFromReflection(reflection: Reflection): ts.Symbol | undefined;
|
|
73
82
|
/** @internal */
|
|
74
83
|
setActiveProgram(program: ts.Program | undefined): void;
|
|
75
|
-
getComment(symbol: ts.Symbol, kind: ReflectionKind):
|
|
76
|
-
getNodeComment(node: ts.Node, moduleComment: boolean):
|
|
77
|
-
getFileComment(node: ts.SourceFile):
|
|
78
|
-
getJsDocComment(declaration: ts.JSDocPropertyLikeTag | ts.JSDocCallbackTag | ts.JSDocTypedefTag | ts.JSDocTemplateTag | ts.JSDocEnumTag):
|
|
79
|
-
getSignatureComment(declaration: ts.SignatureDeclaration | ts.JSDocSignature):
|
|
84
|
+
getComment(symbol: ts.Symbol, kind: ReflectionKind): Comment | undefined;
|
|
85
|
+
getNodeComment(node: ts.Node, moduleComment: boolean): Comment | undefined;
|
|
86
|
+
getFileComment(node: ts.SourceFile): Comment | undefined;
|
|
87
|
+
getJsDocComment(declaration: ts.JSDocPropertyLikeTag | ts.JSDocCallbackTag | ts.JSDocTypedefTag | ts.JSDocTemplateTag | ts.JSDocEnumTag): Comment | undefined;
|
|
88
|
+
getSignatureComment(declaration: ts.SignatureDeclaration | ts.JSDocSignature): Comment | undefined;
|
|
89
|
+
shouldInline(symbol: ts.Symbol, name: string): boolean;
|
|
80
90
|
withScope(scope: Reflection): Context;
|
|
81
91
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ok as assert } from "assert";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
-
import { ContainerReflection, DeclarationReflection, ReflectionFlag, ReflectionKind, } from "../models/index.js";
|
|
3
|
+
import { Comment, ContainerReflection, DeclarationReflection, ReferenceType, ReflectionFlag, ReflectionKind, } from "../models/index.js";
|
|
4
4
|
import { isNamedNode } from "./utils/nodes.js";
|
|
5
5
|
import { ConverterEvents } from "./converter-events.js";
|
|
6
6
|
import { resolveAliasedSymbol } from "./utils/symbols.js";
|
|
7
7
|
import { getComment, getFileComment, getJsDocComment, getNodeComment, getSignatureComment } from "./comments/index.js";
|
|
8
|
-
import { getHumanName } from "../utils/tsutils.js";
|
|
9
|
-
import { normalizePath } from "#node-utils";
|
|
8
|
+
import { getHumanName, getQualifiedName } from "../utils/tsutils.js";
|
|
9
|
+
import { findPackageForPath, normalizePath } from "#node-utils";
|
|
10
10
|
import { createSymbolId } from "./factories/symbol-id.js";
|
|
11
11
|
import { removeIf } from "#utils";
|
|
12
12
|
/**
|
|
@@ -47,6 +47,8 @@ export class Context {
|
|
|
47
47
|
convertingTypeNode = false; // Inherited by withScope
|
|
48
48
|
convertingClassOrInterface = false; // Not inherited
|
|
49
49
|
shouldBeStatic = false; // Not inherited
|
|
50
|
+
inlineType = new Set(); // Inherited by withScope
|
|
51
|
+
preventInline = new Set(); // Inherited by withScope
|
|
50
52
|
reflectionIdToSymbolMap = new Map();
|
|
51
53
|
/**
|
|
52
54
|
* Create a new Context instance.
|
|
@@ -165,6 +167,21 @@ export class Context {
|
|
|
165
167
|
this.converter.processDocumentTags(reflection, reflection);
|
|
166
168
|
}
|
|
167
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Create a {@link ReferenceType} which points to the provided symbol.
|
|
172
|
+
*
|
|
173
|
+
* @privateRemarks
|
|
174
|
+
* This is available on Context so that it can be monkey-patched by typedoc-plugin-missing-exports
|
|
175
|
+
*/
|
|
176
|
+
createSymbolReference(symbol, context, name) {
|
|
177
|
+
const ref = ReferenceType.createUnresolvedReference(name ?? symbol.name, createSymbolId(symbol), context.project, getQualifiedName(symbol, name ?? symbol.name));
|
|
178
|
+
ref.refersToTypeParameter = !!(symbol.flags & ts.SymbolFlags.TypeParameter);
|
|
179
|
+
const symbolPath = symbol.declarations?.[0]?.getSourceFile().fileName;
|
|
180
|
+
if (!symbolPath)
|
|
181
|
+
return ref;
|
|
182
|
+
ref.package = findPackageForPath(symbolPath)?.[0];
|
|
183
|
+
return ref;
|
|
184
|
+
}
|
|
168
185
|
addChild(reflection) {
|
|
169
186
|
if (this.scope instanceof ContainerReflection) {
|
|
170
187
|
this.scope.addChild(reflection);
|
|
@@ -233,12 +250,31 @@ export class Context {
|
|
|
233
250
|
getSignatureComment(declaration) {
|
|
234
251
|
return getSignatureComment(declaration, this.converter.config, this.logger, this.checker, this.project.files);
|
|
235
252
|
}
|
|
253
|
+
shouldInline(symbol, name) {
|
|
254
|
+
if (this.preventInline.has(name))
|
|
255
|
+
return false;
|
|
256
|
+
if (this.inlineType.has(name))
|
|
257
|
+
return true;
|
|
258
|
+
return this
|
|
259
|
+
.getComment(symbol, ReflectionKind.Interface)
|
|
260
|
+
?.hasModifier("@inline") ?? false;
|
|
261
|
+
}
|
|
236
262
|
withScope(scope) {
|
|
237
263
|
assert(scope.parent === this.scope || scope === this.scope, "Incorrect context used for withScope");
|
|
238
264
|
const context = new Context(this.converter, this.programs, this.project, scope);
|
|
239
265
|
context.convertingTypeNode = this.convertingTypeNode;
|
|
240
266
|
context.setActiveProgram(this._program);
|
|
241
267
|
context.reflectionIdToSymbolMap = this.reflectionIdToSymbolMap;
|
|
268
|
+
context.preventInline = new Set(this.preventInline);
|
|
269
|
+
context.inlineType = new Set(this.inlineType);
|
|
270
|
+
for (const tag of scope.comment?.blockTags || []) {
|
|
271
|
+
if (tag.tag === "@preventInline") {
|
|
272
|
+
context.preventInline.add(Comment.combineDisplayParts(tag.content));
|
|
273
|
+
}
|
|
274
|
+
else if (tag.tag === "@inlineType") {
|
|
275
|
+
context.inlineType.add(Comment.combineDisplayParts(tag.content));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
242
278
|
return context;
|
|
243
279
|
}
|
|
244
280
|
}
|
|
@@ -16,7 +16,6 @@ export function createSignature(context, kind, signature, symbol, declaration) {
|
|
|
16
16
|
if (context.shouldBeStatic) {
|
|
17
17
|
sigRef.setFlag(ReflectionFlag.Static);
|
|
18
18
|
}
|
|
19
|
-
const sigRefCtx = context.withScope(sigRef);
|
|
20
19
|
if (symbol && declaration) {
|
|
21
20
|
context.project.registerSymbolId(sigRef, createSymbolId(symbol, declaration));
|
|
22
21
|
}
|
|
@@ -34,6 +33,7 @@ export function createSignature(context, kind, signature, symbol, declaration) {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
}
|
|
36
|
+
const sigRefCtx = context.withScope(sigRef);
|
|
37
37
|
sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
|
|
38
38
|
const parameterSymbols = signature.thisParameter
|
|
39
39
|
? [signature.thisParameter, ...signature.parameters]
|
|
@@ -45,6 +45,6 @@ export class MergeModuleWithPlugin extends ConverterComponent {
|
|
|
45
45
|
tempRefl = tempRefl.parent;
|
|
46
46
|
}
|
|
47
47
|
this.application.logger.verbose(`Merging ${refl.getFullName()} into ${target.getFullName()}`);
|
|
48
|
-
project.
|
|
48
|
+
project.mergeReflections(refl, target);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -113,8 +113,8 @@ let SourcePlugin = (() => {
|
|
|
113
113
|
this.owner.on(ConverterEvents.RESOLVE_BEGIN, this.onBeginResolve.bind(this));
|
|
114
114
|
}
|
|
115
115
|
onEnd() {
|
|
116
|
-
// Should probably clear repositories/ignoredPaths here, but these aren't likely to change between runs...
|
|
117
116
|
this.fileNames.clear();
|
|
117
|
+
delete this.repositories;
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Triggered when the converter has created a declaration reflection.
|
|
@@ -116,7 +116,8 @@ function _convertSymbolNow(context, symbol, exportSymbol) {
|
|
|
116
116
|
export function convertSymbol(context, symbol, exportSymbol) {
|
|
117
117
|
// #1795, defer conversion of symbols named `default` so that if a function
|
|
118
118
|
// is default exported and also exported with a name, the name takes precedence
|
|
119
|
-
if ((exportSymbol?.name ?? symbol.name) === "default"
|
|
119
|
+
if ((exportSymbol?.name ?? symbol.name) === "default" &&
|
|
120
|
+
context.scope.kindOf(ReflectionKind.ExportContainer)) {
|
|
120
121
|
context.converter.deferConversion(() => {
|
|
121
122
|
_convertSymbolNow(context, symbol, exportSymbol);
|
|
122
123
|
});
|
|
@@ -204,6 +205,7 @@ function convertTypeAlias(context, symbol, exportSymbol) {
|
|
|
204
205
|
return convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration);
|
|
205
206
|
}
|
|
206
207
|
const reflection = context.createDeclarationReflection(ReflectionKind.TypeAlias, symbol, exportSymbol);
|
|
208
|
+
context.finalizeDeclarationReflection(reflection);
|
|
207
209
|
if (reflection.comment?.hasModifier("@useDeclaredType")) {
|
|
208
210
|
reflection.comment.removeModifier("@useDeclaredType");
|
|
209
211
|
reflection.type = context.converter.convertType(context.withScope(reflection), context.checker.getDeclaredTypeOfSymbol(symbol));
|
|
@@ -214,9 +216,17 @@ function convertTypeAlias(context, symbol, exportSymbol) {
|
|
|
214
216
|
if (reflection.type.type === "union") {
|
|
215
217
|
attachUnionComments(context, declaration, reflection.type);
|
|
216
218
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
else if (reflection.type.type === "reflection" && reflection.type.declaration.children) {
|
|
220
|
+
// #2817 lift properties of object literal types up to the reflection level.
|
|
221
|
+
const typeDecl = reflection.type.declaration;
|
|
222
|
+
reflection.project.mergeReflections(typeDecl, reflection);
|
|
223
|
+
delete reflection.type;
|
|
224
|
+
// When created any signatures will be created with __type as their
|
|
225
|
+
// name, rename them so that they have the alias's name as their name
|
|
226
|
+
for (const sig of reflection.signatures || []) {
|
|
227
|
+
sig.name = reflection.name;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
220
230
|
reflection.typeParameters = declaration.typeParameters?.map((param) => createTypeParamReflection(param, context.withScope(reflection)));
|
|
221
231
|
}
|
|
222
232
|
else if (ts.isJSDocTypedefTag(declaration) ||
|
|
@@ -8,7 +8,6 @@ import { convertParameterNodes, convertTypeParameterNodes, createSignature } fro
|
|
|
8
8
|
import { convertSymbol } from "./symbols.js";
|
|
9
9
|
import { isObjectType, isTypeReference } from "./utils/nodes.js";
|
|
10
10
|
import { removeUndefined } from "./utils/reflections.js";
|
|
11
|
-
import { createSymbolReference } from "./factories/types.js";
|
|
12
11
|
import { createSymbolId } from "./factories/symbol-id.js";
|
|
13
12
|
const converters = new Map();
|
|
14
13
|
export function loadConverters() {
|
|
@@ -189,7 +188,7 @@ const exprWithTypeArgsConverter = {
|
|
|
189
188
|
return convertType(context, context.checker.getTypeAtLocation(node));
|
|
190
189
|
}
|
|
191
190
|
const parameters = node.typeArguments?.map((type) => convertType(context, type)) ?? [];
|
|
192
|
-
const ref = createSymbolReference(context.resolveAliasedSymbol(targetSymbol), context);
|
|
191
|
+
const ref = context.createSymbolReference(context.resolveAliasedSymbol(targetSymbol), context);
|
|
193
192
|
ref.typeArguments = parameters;
|
|
194
193
|
return ref;
|
|
195
194
|
},
|
|
@@ -239,12 +238,12 @@ const importType = {
|
|
|
239
238
|
if (!symbol) {
|
|
240
239
|
return new IntrinsicType("any");
|
|
241
240
|
}
|
|
242
|
-
return createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
|
|
241
|
+
return context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
|
|
243
242
|
},
|
|
244
243
|
convertType(context, type) {
|
|
245
244
|
const symbol = type.getSymbol();
|
|
246
245
|
assert(symbol, "Missing symbol when converting import type"); // Should be a compiler error
|
|
247
|
-
return createSymbolReference(context.resolveAliasedSymbol(symbol), context, "__module");
|
|
246
|
+
return context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, "__module");
|
|
248
247
|
},
|
|
249
248
|
};
|
|
250
249
|
const indexedAccessConverter = {
|
|
@@ -413,7 +412,7 @@ const queryConverter = {
|
|
|
413
412
|
// on a variable typed as `any` with a name that doesn't exist.
|
|
414
413
|
return new QueryType(ReferenceType.createBrokenReference(node.exprName.getText(), context.project));
|
|
415
414
|
}
|
|
416
|
-
const ref = createSymbolReference(context.resolveAliasedSymbol(querySymbol), context, node.exprName.getText());
|
|
415
|
+
const ref = context.createSymbolReference(context.resolveAliasedSymbol(querySymbol), context, node.exprName.getText());
|
|
417
416
|
ref.preferValues = true;
|
|
418
417
|
return new QueryType(ref);
|
|
419
418
|
},
|
|
@@ -422,7 +421,7 @@ const queryConverter = {
|
|
|
422
421
|
// an instantiation expression we get the user's exprName.
|
|
423
422
|
const symbol = context.getSymbolAtLocation(node.exprName) || type.getSymbol();
|
|
424
423
|
assert(symbol, `Query type failed to get a symbol for: ${context.checker.typeToString(type)}. This is a bug.`);
|
|
425
|
-
const ref = createSymbolReference(context.resolveAliasedSymbol(symbol), context);
|
|
424
|
+
const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context);
|
|
426
425
|
ref.preferValues = true;
|
|
427
426
|
return new QueryType(ref);
|
|
428
427
|
},
|
|
@@ -436,20 +435,18 @@ const referenceConverter = {
|
|
|
436
435
|
return new ArrayType(convertType(context, node.typeArguments?.[0]));
|
|
437
436
|
}
|
|
438
437
|
const symbol = context.expectSymbolAtLocation(node.typeName);
|
|
438
|
+
const name = node.typeName.getText();
|
|
439
439
|
// Ignore @inline if there are type arguments, as they won't be resolved
|
|
440
440
|
// in the type we just retrieved from node.typeName.
|
|
441
441
|
if (!node.typeArguments &&
|
|
442
|
-
context
|
|
443
|
-
.getComment(symbol, ReflectionKind.Interface)
|
|
444
|
-
?.hasModifier("@inline")) {
|
|
442
|
+
context.shouldInline(symbol, name)) {
|
|
445
443
|
// typeLiteralConverter doesn't use the node, so we can get away with lying here.
|
|
446
444
|
// This might not actually be safe, it appears that it is in the relatively small
|
|
447
445
|
// amount of testing I've done with it, but I wouldn't be surprised if someone manages
|
|
448
446
|
// to find a crash.
|
|
449
447
|
return typeLiteralConverter.convertType(context, type, null, undefined);
|
|
450
448
|
}
|
|
451
|
-
const
|
|
452
|
-
const ref = createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
|
|
449
|
+
const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
|
|
453
450
|
ref.typeArguments = node.typeArguments?.map((type) => convertType(context, type));
|
|
454
451
|
return ref;
|
|
455
452
|
},
|
|
@@ -465,15 +462,6 @@ const referenceConverter = {
|
|
|
465
462
|
ref.refersToTypeParameter = true;
|
|
466
463
|
return ref;
|
|
467
464
|
}
|
|
468
|
-
if (context
|
|
469
|
-
.getComment(symbol, ReflectionKind.Interface)
|
|
470
|
-
?.hasModifier("@inline")) {
|
|
471
|
-
// typeLiteralConverter doesn't use the node, so we can get away with lying here.
|
|
472
|
-
// This might not actually be safe, it appears that it is in the relatively small
|
|
473
|
-
// amount of testing I've done with it, but I wouldn't be surprised if someone manages
|
|
474
|
-
// to find a crash.
|
|
475
|
-
return typeLiteralConverter.convertType(context, type, null, undefined);
|
|
476
|
-
}
|
|
477
465
|
let name;
|
|
478
466
|
if (ts.isIdentifier(node.typeName)) {
|
|
479
467
|
name = node.typeName.text;
|
|
@@ -481,7 +469,14 @@ const referenceConverter = {
|
|
|
481
469
|
else {
|
|
482
470
|
name = node.typeName.right.text;
|
|
483
471
|
}
|
|
484
|
-
|
|
472
|
+
if (context.shouldInline(symbol, name)) {
|
|
473
|
+
// typeLiteralConverter doesn't use the node, so we can get away with lying here.
|
|
474
|
+
// This might not actually be safe, it appears that it is in the relatively small
|
|
475
|
+
// amount of testing I've done with it, but I wouldn't be surprised if someone manages
|
|
476
|
+
// to find a crash.
|
|
477
|
+
return typeLiteralConverter.convertType(context, type, null, undefined);
|
|
478
|
+
}
|
|
479
|
+
const ref = context.createSymbolReference(context.resolveAliasedSymbol(symbol), context, name);
|
|
485
480
|
if (type.flags & ts.TypeFlags.Substitution) {
|
|
486
481
|
// NoInfer<T>
|
|
487
482
|
ref.typeArguments = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Reflection, type TraverseCallback } from "./Reflection.js";
|
|
2
2
|
import { ReflectionCategory } from "./ReflectionCategory.js";
|
|
3
3
|
import { ReflectionGroup } from "./ReflectionGroup.js";
|
|
4
|
-
import
|
|
4
|
+
import { ReflectionKind } from "./kind.js";
|
|
5
5
|
import type { Deserializer, JSONOutput, Serializer } from "#serialization";
|
|
6
6
|
import type { DocumentReflection } from "./DocumentReflection.js";
|
|
7
7
|
import type { DeclarationReflection } from "./DeclarationReflection.js";
|
|
@@ -47,7 +47,7 @@ export declare abstract class ContainerReflection extends Reflection {
|
|
|
47
47
|
* @returns An array containing all children with the desired kind.
|
|
48
48
|
*/
|
|
49
49
|
getChildrenByKind(kind: ReflectionKind): DeclarationReflection[];
|
|
50
|
-
addChild(child:
|
|
50
|
+
addChild(child: Reflection): void;
|
|
51
51
|
removeChild(child: DeclarationReflection | DocumentReflection): void;
|
|
52
52
|
traverse(callback: TraverseCallback): void;
|
|
53
53
|
toObject(serializer: Serializer): JSONOutput.ContainerReflection;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Reflection, TraverseProperty } from "./Reflection.js";
|
|
2
2
|
import { ReflectionCategory } from "./ReflectionCategory.js";
|
|
3
3
|
import { ReflectionGroup } from "./ReflectionGroup.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ReflectionKind } from "./kind.js";
|
|
5
|
+
import { assertNever, removeIfPresent } from "#utils";
|
|
5
6
|
/**
|
|
6
7
|
* @category Reflections
|
|
7
8
|
*/
|
|
@@ -50,13 +51,36 @@ export class ContainerReflection extends Reflection {
|
|
|
50
51
|
if (child.isDeclaration()) {
|
|
51
52
|
this.children ||= [];
|
|
52
53
|
this.children.push(child);
|
|
54
|
+
this.childrenIncludingDocuments ||= [];
|
|
55
|
+
this.childrenIncludingDocuments.push(child);
|
|
53
56
|
}
|
|
54
|
-
else {
|
|
57
|
+
else if (child.isDocument()) {
|
|
55
58
|
this.documents ||= [];
|
|
56
59
|
this.documents.push(child);
|
|
60
|
+
this.childrenIncludingDocuments ||= [];
|
|
61
|
+
this.childrenIncludingDocuments.push(child);
|
|
62
|
+
}
|
|
63
|
+
else if (this.isDeclaration() && child.isSignature()) {
|
|
64
|
+
switch (child.kind) {
|
|
65
|
+
case ReflectionKind.CallSignature:
|
|
66
|
+
case ReflectionKind.ConstructorSignature:
|
|
67
|
+
this.signatures ||= [];
|
|
68
|
+
this.signatures.push(child);
|
|
69
|
+
break;
|
|
70
|
+
case ReflectionKind.IndexSignature:
|
|
71
|
+
this.indexSignatures ||= [];
|
|
72
|
+
this.indexSignatures.push(child);
|
|
73
|
+
break;
|
|
74
|
+
case ReflectionKind.GetSignature:
|
|
75
|
+
case ReflectionKind.SetSignature:
|
|
76
|
+
throw new Error("Unsupported child type: " + ReflectionKind[child.kind]);
|
|
77
|
+
default:
|
|
78
|
+
assertNever(child.kind);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new Error("Unsupported child type: " + ReflectionKind[child.kind]);
|
|
57
83
|
}
|
|
58
|
-
this.childrenIncludingDocuments ||= [];
|
|
59
|
-
this.childrenIncludingDocuments.push(child);
|
|
60
84
|
}
|
|
61
85
|
removeChild(child) {
|
|
62
86
|
if (child.isDeclaration()) {
|
|
@@ -82,7 +82,7 @@ export declare class ProjectReflection extends ContainerReflection {
|
|
|
82
82
|
*/
|
|
83
83
|
removeReflection(reflection: Reflection): void;
|
|
84
84
|
/** @internal */
|
|
85
|
-
|
|
85
|
+
mergeReflections(source: DeclarationReflection, target: DeclarationReflection | ProjectReflection): void;
|
|
86
86
|
/**
|
|
87
87
|
* Remove a reflection without updating the parent reflection to remove references to the removed reflection.
|
|
88
88
|
*/
|
|
@@ -168,7 +168,7 @@ export class ProjectReflection extends ContainerReflection {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
/** @internal */
|
|
171
|
-
|
|
171
|
+
mergeReflections(source, target) {
|
|
172
172
|
// First, tell the children about their new parent
|
|
173
173
|
delete this.referenceGraph;
|
|
174
174
|
const oldChildrenIds = this.reflectionChildren.getNoInsert(source.id) || [];
|
|
@@ -46,6 +46,16 @@ export declare class ReflectionSymbolId {
|
|
|
46
46
|
* Note: This can only be non-NaN if {@link pos} is finite.
|
|
47
47
|
*/
|
|
48
48
|
transientId: number;
|
|
49
|
+
/**
|
|
50
|
+
* Note: This is **not** serialized, only {@link packageName} and {@link packagePath} path
|
|
51
|
+
* information is preserved when serializing. This is set so that it is available to plugins
|
|
52
|
+
* when initially converting a project.
|
|
53
|
+
*
|
|
54
|
+
* @privateRemarks
|
|
55
|
+
* This is used by typedoc-plugin-dt-links to determine the path to read to get the source
|
|
56
|
+
* code of a definitely typed package.
|
|
57
|
+
*/
|
|
58
|
+
fileName?: NormalizedPath;
|
|
49
59
|
constructor(json: JSONOutput.ReflectionSymbolId);
|
|
50
60
|
getStableKey(): ReflectionSymbolIdString;
|
|
51
61
|
toDeclarationReference(): DeclarationReference;
|
|
@@ -40,6 +40,16 @@ export class ReflectionSymbolId {
|
|
|
40
40
|
* Note: This can only be non-NaN if {@link pos} is finite.
|
|
41
41
|
*/
|
|
42
42
|
transientId = NaN;
|
|
43
|
+
/**
|
|
44
|
+
* Note: This is **not** serialized, only {@link packageName} and {@link packagePath} path
|
|
45
|
+
* information is preserved when serializing. This is set so that it is available to plugins
|
|
46
|
+
* when initially converting a project.
|
|
47
|
+
*
|
|
48
|
+
* @privateRemarks
|
|
49
|
+
* This is used by typedoc-plugin-dt-links to determine the path to read to get the source
|
|
50
|
+
* code of a definitely typed package.
|
|
51
|
+
*/
|
|
52
|
+
fileName;
|
|
43
53
|
constructor(json) {
|
|
44
54
|
this.packageName = json.packageName;
|
|
45
55
|
this.packagePath = json.packagePath;
|
|
@@ -70,6 +70,7 @@ export declare class FormattedCodeBuilder {
|
|
|
70
70
|
reflection(reflection: DeclarationReflection, options: {
|
|
71
71
|
topLevelLinks: boolean;
|
|
72
72
|
}): FormatterNode;
|
|
73
|
+
typeAlias(item: DeclarationReflection): FormatterNode;
|
|
73
74
|
interface(item: DeclarationReflection): FormatterNode;
|
|
74
75
|
member(members: FormatterNode[], item: DeclarationReflection, options: {
|
|
75
76
|
topLevelLinks: boolean;
|
|
@@ -515,6 +515,9 @@ export class FormattedCodeBuilder {
|
|
|
515
515
|
}
|
|
516
516
|
return simpleElement(JSX.createElement("span", { class: "tsd-signature-symbol" }, "{}"));
|
|
517
517
|
}
|
|
518
|
+
typeAlias(item) {
|
|
519
|
+
return nodes(simpleElement(JSX.createElement("span", { class: "tsd-signature-keyword" }, "type")), space(), simpleElement(JSX.createElement("span", { class: getKindClass(item) }, item.name)), this.typeParameters(item), space(), simpleElement(JSX.createElement("span", { class: "tsd-signature-symbol" }, "=")), space(), this.reflection(item, { topLevelLinks: true }));
|
|
520
|
+
}
|
|
518
521
|
interface(item) {
|
|
519
522
|
return nodes(simpleElement(JSX.createElement("span", { class: "tsd-signature-keyword" }, "interface")), space(), simpleElement(JSX.createElement("span", { class: getKindClass(item) }, item.name)), this.typeParameters(item), space(), this.reflection(item, { topLevelLinks: true }));
|
|
520
523
|
}
|
|
@@ -139,6 +139,10 @@ let JavascriptIndexPlugin = (() => {
|
|
|
139
139
|
url: theme.router.getFullUrl(reflection),
|
|
140
140
|
classes: theme.getReflectionClasses(reflection),
|
|
141
141
|
};
|
|
142
|
+
const icon = theme.getReflectionIcon(reflection);
|
|
143
|
+
if (icon !== reflection.kind) {
|
|
144
|
+
row.icon = icon;
|
|
145
|
+
}
|
|
142
146
|
if (parent) {
|
|
143
147
|
row.parent = parent.getFullName();
|
|
144
148
|
}
|
|
@@ -177,10 +177,6 @@ export declare class Renderer extends AbstractComponent<Application, RendererEve
|
|
|
177
177
|
private accessor githubPages;
|
|
178
178
|
/** @internal */
|
|
179
179
|
accessor cacheBust: boolean;
|
|
180
|
-
private accessor lightTheme;
|
|
181
|
-
private accessor darkTheme;
|
|
182
|
-
private accessor highlightLanguages;
|
|
183
|
-
private accessor ignoredHighlightLanguages;
|
|
184
180
|
private accessor pretty;
|
|
185
181
|
renderStartTime: number;
|
|
186
182
|
markedPlugin: MarkedPlugin;
|
|
@@ -207,7 +203,6 @@ export declare class Renderer extends AbstractComponent<Application, RendererEve
|
|
|
207
203
|
*/
|
|
208
204
|
render(project: ProjectReflection, outputDirectory: string): Promise<void>;
|
|
209
205
|
private runPreRenderJobs;
|
|
210
|
-
private loadHighlighter;
|
|
211
206
|
/**
|
|
212
207
|
* Render a single page.
|
|
213
208
|
*
|
|
@@ -46,7 +46,6 @@ import { IndexEvent, PageEvent, RendererEvent } from "./events.js";
|
|
|
46
46
|
import { writeFileSync } from "../utils/fs.js";
|
|
47
47
|
import { DefaultTheme } from "./themes/default/DefaultTheme.js";
|
|
48
48
|
import { AbstractComponent, Option } from "../utils/index.js";
|
|
49
|
-
import { loadHighlighter } from "../utils/highlighter.js";
|
|
50
49
|
import { EventHooks, i18n, JSX } from "#utils";
|
|
51
50
|
import { AssetsPlugin, HierarchyPlugin, IconsPlugin, JavascriptIndexPlugin, MarkedPlugin, NavigationPlugin, SitemapPlugin, } from "./plugins/index.js";
|
|
52
51
|
import { CategoryRouter, GroupRouter, KindDirRouter, KindRouter, StructureDirRouter, StructureRouter, } from "./router.js";
|
|
@@ -102,18 +101,6 @@ let Renderer = (() => {
|
|
|
102
101
|
let _cacheBust_decorators;
|
|
103
102
|
let _cacheBust_initializers = [];
|
|
104
103
|
let _cacheBust_extraInitializers = [];
|
|
105
|
-
let _lightTheme_decorators;
|
|
106
|
-
let _lightTheme_initializers = [];
|
|
107
|
-
let _lightTheme_extraInitializers = [];
|
|
108
|
-
let _darkTheme_decorators;
|
|
109
|
-
let _darkTheme_initializers = [];
|
|
110
|
-
let _darkTheme_extraInitializers = [];
|
|
111
|
-
let _highlightLanguages_decorators;
|
|
112
|
-
let _highlightLanguages_initializers = [];
|
|
113
|
-
let _highlightLanguages_extraInitializers = [];
|
|
114
|
-
let _ignoredHighlightLanguages_decorators;
|
|
115
|
-
let _ignoredHighlightLanguages_initializers = [];
|
|
116
|
-
let _ignoredHighlightLanguages_extraInitializers = [];
|
|
117
104
|
let _pretty_decorators;
|
|
118
105
|
let _pretty_initializers = [];
|
|
119
106
|
let _pretty_extraInitializers = [];
|
|
@@ -126,10 +113,6 @@ let Renderer = (() => {
|
|
|
126
113
|
_cname_decorators = [Option("cname")];
|
|
127
114
|
_githubPages_decorators = [Option("githubPages")];
|
|
128
115
|
_cacheBust_decorators = [Option("cacheBust")];
|
|
129
|
-
_lightTheme_decorators = [Option("lightHighlightTheme")];
|
|
130
|
-
_darkTheme_decorators = [Option("darkHighlightTheme")];
|
|
131
|
-
_highlightLanguages_decorators = [Option("highlightLanguages")];
|
|
132
|
-
_ignoredHighlightLanguages_decorators = [Option("ignoredHighlightLanguages")];
|
|
133
116
|
_pretty_decorators = [Option("pretty")];
|
|
134
117
|
__esDecorate(this, null, _themeName_decorators, { kind: "accessor", name: "themeName", static: false, private: false, access: { has: obj => "themeName" in obj, get: obj => obj.themeName, set: (obj, value) => { obj.themeName = value; } }, metadata: _metadata }, _themeName_initializers, _themeName_extraInitializers);
|
|
135
118
|
__esDecorate(this, null, _routerName_decorators, { kind: "accessor", name: "routerName", static: false, private: false, access: { has: obj => "routerName" in obj, get: obj => obj.routerName, set: (obj, value) => { obj.routerName = value; } }, metadata: _metadata }, _routerName_initializers, _routerName_extraInitializers);
|
|
@@ -137,10 +120,6 @@ let Renderer = (() => {
|
|
|
137
120
|
__esDecorate(this, null, _cname_decorators, { kind: "accessor", name: "cname", static: false, private: false, access: { has: obj => "cname" in obj, get: obj => obj.cname, set: (obj, value) => { obj.cname = value; } }, metadata: _metadata }, _cname_initializers, _cname_extraInitializers);
|
|
138
121
|
__esDecorate(this, null, _githubPages_decorators, { kind: "accessor", name: "githubPages", static: false, private: false, access: { has: obj => "githubPages" in obj, get: obj => obj.githubPages, set: (obj, value) => { obj.githubPages = value; } }, metadata: _metadata }, _githubPages_initializers, _githubPages_extraInitializers);
|
|
139
122
|
__esDecorate(this, null, _cacheBust_decorators, { kind: "accessor", name: "cacheBust", static: false, private: false, access: { has: obj => "cacheBust" in obj, get: obj => obj.cacheBust, set: (obj, value) => { obj.cacheBust = value; } }, metadata: _metadata }, _cacheBust_initializers, _cacheBust_extraInitializers);
|
|
140
|
-
__esDecorate(this, null, _lightTheme_decorators, { kind: "accessor", name: "lightTheme", static: false, private: false, access: { has: obj => "lightTheme" in obj, get: obj => obj.lightTheme, set: (obj, value) => { obj.lightTheme = value; } }, metadata: _metadata }, _lightTheme_initializers, _lightTheme_extraInitializers);
|
|
141
|
-
__esDecorate(this, null, _darkTheme_decorators, { kind: "accessor", name: "darkTheme", static: false, private: false, access: { has: obj => "darkTheme" in obj, get: obj => obj.darkTheme, set: (obj, value) => { obj.darkTheme = value; } }, metadata: _metadata }, _darkTheme_initializers, _darkTheme_extraInitializers);
|
|
142
|
-
__esDecorate(this, null, _highlightLanguages_decorators, { kind: "accessor", name: "highlightLanguages", static: false, private: false, access: { has: obj => "highlightLanguages" in obj, get: obj => obj.highlightLanguages, set: (obj, value) => { obj.highlightLanguages = value; } }, metadata: _metadata }, _highlightLanguages_initializers, _highlightLanguages_extraInitializers);
|
|
143
|
-
__esDecorate(this, null, _ignoredHighlightLanguages_decorators, { kind: "accessor", name: "ignoredHighlightLanguages", static: false, private: false, access: { has: obj => "ignoredHighlightLanguages" in obj, get: obj => obj.ignoredHighlightLanguages, set: (obj, value) => { obj.ignoredHighlightLanguages = value; } }, metadata: _metadata }, _ignoredHighlightLanguages_initializers, _ignoredHighlightLanguages_extraInitializers);
|
|
144
123
|
__esDecorate(this, null, _pretty_decorators, { kind: "accessor", name: "pretty", static: false, private: false, access: { has: obj => "pretty" in obj, get: obj => obj.pretty, set: (obj, value) => { obj.pretty = value; } }, metadata: _metadata }, _pretty_initializers, _pretty_extraInitializers);
|
|
145
124
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
146
125
|
}
|
|
@@ -224,19 +203,7 @@ let Renderer = (() => {
|
|
|
224
203
|
/** @internal */
|
|
225
204
|
get cacheBust() { return this.#cacheBust_accessor_storage; }
|
|
226
205
|
set cacheBust(value) { this.#cacheBust_accessor_storage = value; }
|
|
227
|
-
#
|
|
228
|
-
get lightTheme() { return this.#lightTheme_accessor_storage; }
|
|
229
|
-
set lightTheme(value) { this.#lightTheme_accessor_storage = value; }
|
|
230
|
-
#darkTheme_accessor_storage = (__runInitializers(this, _lightTheme_extraInitializers), __runInitializers(this, _darkTheme_initializers, void 0));
|
|
231
|
-
get darkTheme() { return this.#darkTheme_accessor_storage; }
|
|
232
|
-
set darkTheme(value) { this.#darkTheme_accessor_storage = value; }
|
|
233
|
-
#highlightLanguages_accessor_storage = (__runInitializers(this, _darkTheme_extraInitializers), __runInitializers(this, _highlightLanguages_initializers, void 0));
|
|
234
|
-
get highlightLanguages() { return this.#highlightLanguages_accessor_storage; }
|
|
235
|
-
set highlightLanguages(value) { this.#highlightLanguages_accessor_storage = value; }
|
|
236
|
-
#ignoredHighlightLanguages_accessor_storage = (__runInitializers(this, _highlightLanguages_extraInitializers), __runInitializers(this, _ignoredHighlightLanguages_initializers, void 0));
|
|
237
|
-
get ignoredHighlightLanguages() { return this.#ignoredHighlightLanguages_accessor_storage; }
|
|
238
|
-
set ignoredHighlightLanguages(value) { this.#ignoredHighlightLanguages_accessor_storage = value; }
|
|
239
|
-
#pretty_accessor_storage = (__runInitializers(this, _ignoredHighlightLanguages_extraInitializers), __runInitializers(this, _pretty_initializers, void 0));
|
|
206
|
+
#pretty_accessor_storage = (__runInitializers(this, _cacheBust_extraInitializers), __runInitializers(this, _pretty_initializers, void 0));
|
|
240
207
|
get pretty() { return this.#pretty_accessor_storage; }
|
|
241
208
|
set pretty(value) { this.#pretty_accessor_storage = value; }
|
|
242
209
|
renderStartTime = (__runInitializers(this, _pretty_extraInitializers), -1);
|
|
@@ -298,6 +265,7 @@ let Renderer = (() => {
|
|
|
298
265
|
for (const page of pages) {
|
|
299
266
|
this.renderDocument(outputDirectory, page);
|
|
300
267
|
}
|
|
268
|
+
this.postRenderAsyncJobs.push(async (o) => await this.theme.postRender(o));
|
|
301
269
|
await Promise.all(this.postRenderAsyncJobs.map((job) => job(output)));
|
|
302
270
|
this.postRenderAsyncJobs = [];
|
|
303
271
|
this.trigger(RendererEvent.END, output);
|
|
@@ -307,16 +275,11 @@ let Renderer = (() => {
|
|
|
307
275
|
}
|
|
308
276
|
async runPreRenderJobs(output) {
|
|
309
277
|
const start = Date.now();
|
|
310
|
-
this.preRenderAsyncJobs.push(this.
|
|
278
|
+
this.preRenderAsyncJobs.push(async (o) => await this.theme.preRender(o));
|
|
311
279
|
await Promise.all(this.preRenderAsyncJobs.map((job) => job(output)));
|
|
312
280
|
this.preRenderAsyncJobs = [];
|
|
313
281
|
this.application.logger.verbose(`Pre render async jobs took ${Date.now() - start}ms`);
|
|
314
282
|
}
|
|
315
|
-
async loadHighlighter() {
|
|
316
|
-
await loadHighlighter(this.lightTheme, this.darkTheme,
|
|
317
|
-
// Checked in option validation
|
|
318
|
-
this.highlightLanguages, this.ignoredHighlightLanguages);
|
|
319
|
-
}
|
|
320
283
|
/**
|
|
321
284
|
* Render a single page.
|
|
322
285
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RendererComponent } from "./components.js";
|
|
2
|
-
import type { PageEvent } from "./events.js";
|
|
2
|
+
import type { PageEvent, RendererEvent } from "./events.js";
|
|
3
3
|
import type { Reflection } from "../models/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Base class of all themes.
|
|
@@ -12,4 +12,12 @@ export declare abstract class Theme extends RendererComponent {
|
|
|
12
12
|
* Renders the provided page to a string, which will be written to disk by the {@link Renderer}
|
|
13
13
|
*/
|
|
14
14
|
abstract render(event: PageEvent<Reflection>): string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional hook to call pre-render jobs
|
|
17
|
+
*/
|
|
18
|
+
preRender(_event: RendererEvent): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Optional hook to call post-render jobs
|
|
21
|
+
*/
|
|
22
|
+
postRender(_event: RendererEvent): Promise<void>;
|
|
15
23
|
}
|
package/dist/lib/output/theme.js
CHANGED
|
@@ -6,4 +6,12 @@ import { RendererComponent } from "./components.js";
|
|
|
6
6
|
* class instance which is also created by the {@link Renderer} class.
|
|
7
7
|
*/
|
|
8
8
|
export class Theme extends RendererComponent {
|
|
9
|
+
/**
|
|
10
|
+
* Optional hook to call pre-render jobs
|
|
11
|
+
*/
|
|
12
|
+
async preRender(_event) { }
|
|
13
|
+
/**
|
|
14
|
+
* Optional hook to call post-render jobs
|
|
15
|
+
*/
|
|
16
|
+
async postRender(_event) { }
|
|
9
17
|
}
|