typedoc 0.26.0-beta.5 → 0.26.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 +5 -6
- package/dist/index.js +1 -2
- package/dist/lib/application-events.d.ts +3 -3
- package/dist/lib/application.d.ts +9 -4
- package/dist/lib/application.js +14 -4
- package/dist/lib/converter/comments/parser.js +7 -3
- package/dist/lib/converter/comments/textParser.d.ts +12 -1
- package/dist/lib/converter/comments/textParser.js +72 -25
- package/dist/lib/converter/components.d.ts +1 -1
- package/dist/lib/converter/context.d.ts +0 -10
- package/dist/lib/converter/context.js +0 -12
- package/dist/lib/converter/converter.d.ts +22 -2
- package/dist/lib/converter/converter.js +0 -1
- package/dist/lib/converter/factories/index-signature.js +1 -1
- package/dist/lib/converter/factories/signature.js +5 -5
- package/dist/lib/converter/index.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +1 -1
- package/dist/lib/converter/plugins/CategoryPlugin.js +2 -4
- package/dist/lib/converter/plugins/CommentPlugin.js +12 -11
- package/dist/lib/converter/plugins/GroupPlugin.js +8 -10
- package/dist/lib/converter/plugins/ImplementsPlugin.js +4 -4
- package/dist/lib/converter/plugins/InheritDocPlugin.js +1 -1
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +2 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +7 -11
- package/dist/lib/converter/plugins/SourcePlugin.js +4 -6
- package/dist/lib/converter/plugins/TypePlugin.js +4 -8
- package/dist/lib/converter/types.js +6 -6
- package/dist/lib/internationalization/locales/jp.cjs +15 -1
- package/dist/lib/internationalization/locales/jp.d.cts +15 -1
- package/dist/lib/internationalization/locales/ko.cjs +154 -0
- package/dist/lib/internationalization/locales/ko.d.cts +153 -0
- package/dist/lib/internationalization/locales/zh.cjs +15 -1
- package/dist/lib/internationalization/locales/zh.d.cts +15 -1
- package/dist/lib/internationalization/translatable.d.ts +2 -1
- package/dist/lib/internationalization/translatable.js +3 -1
- package/dist/lib/models/FileRegistry.d.ts +9 -4
- package/dist/lib/models/FileRegistry.js +6 -1
- package/dist/lib/models/comments/comment.d.ts +2 -2
- package/dist/lib/models/reflections/declaration.js +1 -0
- package/dist/lib/models/reflections/project.js +1 -1
- package/dist/lib/output/components.d.ts +1 -1
- package/dist/lib/output/components.js +3 -5
- package/dist/lib/output/events.d.ts +6 -13
- package/dist/lib/output/events.js +7 -17
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -0
- package/dist/lib/output/plugins/AssetsPlugin.js +13 -15
- package/dist/lib/output/plugins/IconsPlugin.js +1 -3
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +0 -8
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +4 -18
- package/dist/lib/output/plugins/NavigationPlugin.js +2 -5
- package/dist/lib/output/plugins/SitemapPlugin.js +3 -3
- package/dist/lib/output/renderer.d.ts +11 -4
- package/dist/lib/output/renderer.js +11 -21
- package/dist/lib/output/themes/MarkedPlugin.js +4 -4
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +4 -5
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +0 -2
- package/dist/lib/output/themes/default/layouts/default.js +0 -1
- package/dist/lib/output/themes/default/partials/comment.js +2 -3
- package/dist/lib/output/themes/default/partials/navigation.js +1 -1
- package/dist/lib/output/themes/default/templates/hierarchy.js +1 -1
- package/dist/lib/serialization/events.d.ts +2 -3
- package/dist/lib/serialization/events.js +2 -4
- package/dist/lib/serialization/index.d.ts +1 -1
- package/dist/lib/serialization/serializer.d.ts +10 -5
- package/dist/lib/serialization/serializer.js +6 -6
- package/dist/lib/utils/component.d.ts +4 -18
- package/dist/lib/utils/component.js +1 -39
- package/dist/lib/utils/events.d.ts +18 -113
- package/dist/lib/utils/events.js +33 -374
- package/dist/lib/utils/highlighter.js +1 -1
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +1 -2
- package/dist/lib/utils/minimalSourceFile.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +0 -1
- package/dist/lib/utils/options/options.js +3 -3
- package/dist/lib/utils/options/readers/typedoc.js +1 -1
- package/dist/lib/utils/options/sources/typedoc.js +1 -4
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
- package/dist/lib/utils/options/tsdoc-defaults.js +11 -12
- package/package.json +7 -6
- package/tsdoc.json +9 -1
- package/dist/lib/output/themes/default/partials/analytics.d.ts +0 -3
- package/dist/lib/output/themes/default/partials/analytics.js +0 -19
|
@@ -60,6 +60,9 @@ declare const _default: {
|
|
|
60
60
|
signature_0_has_unused_param_with_name_1: "签名 {0} 有一个名为“{1}”的 @param,但未被使用";
|
|
61
61
|
declaration_reference_in_inheritdoc_for_0_not_fully_parsed: "@inheritDoc 中对 {0} 的声明引用未完全解析,可能会解析不正确";
|
|
62
62
|
failed_to_find_0_to_inherit_comment_from_in_1: "在 {1} 的评论中找不到要继承的评论“{0}”";
|
|
63
|
+
failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "无法解析 {1} 的注释中指向\"{0}\"的链接。您可能想要\"{2}\"";
|
|
64
|
+
failed_to_resolve_link_to_0_in_readme_for_1: "无法解析 {1} 的自述文件中指向\"{0}\"的链接";
|
|
65
|
+
failed_to_resolve_link_to_0_in_readme_for_1_may_have_meant_2: "无法解析 {1} 的自述文件中指向\"{0}\"的链接。您可能想要\"{2}\"";
|
|
63
66
|
reflection_0_tried_to_copy_comment_from_1_but_source_had_no_comment: "{0} 尝试使用 @inheritDoc 从 {1} 复制注释,但源没有相关注释";
|
|
64
67
|
inheritdoc_circular_inheritance_chain_0: "@inheritDoc 指定循环继承链:{0}";
|
|
65
68
|
provided_readme_at_0_could_not_be_read: "提供的 README 路径无法读取 {0}";
|
|
@@ -154,7 +157,6 @@ declare const _default: {
|
|
|
154
157
|
help_githubPages: string;
|
|
155
158
|
help_hostedBaseUrl: string;
|
|
156
159
|
help_useHostedBaseUrlForAbsoluteLinks: string;
|
|
157
|
-
help_gaID: string;
|
|
158
160
|
help_hideGenerator: string;
|
|
159
161
|
help_customFooterHtml: string;
|
|
160
162
|
help_customFooterHtmlDisableWrapper: string;
|
|
@@ -273,6 +275,13 @@ declare const _default: {
|
|
|
273
275
|
flag_private: string;
|
|
274
276
|
flag_external: string;
|
|
275
277
|
flag_inherited: string;
|
|
278
|
+
flag_public: string;
|
|
279
|
+
flag_static: string;
|
|
280
|
+
flag_optional: string;
|
|
281
|
+
flag_rest: string;
|
|
282
|
+
flag_abstract: string;
|
|
283
|
+
flag_const: string;
|
|
284
|
+
flag_readonly: string;
|
|
276
285
|
theme_implements: string;
|
|
277
286
|
theme_indexable: string;
|
|
278
287
|
theme_type_declaration: string;
|
|
@@ -303,5 +312,10 @@ declare const _default: {
|
|
|
303
312
|
tag_see: string;
|
|
304
313
|
tag_group: string;
|
|
305
314
|
tag_example: string;
|
|
315
|
+
theme_copy: string;
|
|
316
|
+
theme_copied: string;
|
|
317
|
+
theme_normally_hidden: string;
|
|
318
|
+
theme_class_hierarchy_title: string;
|
|
319
|
+
theme_loading: string;
|
|
306
320
|
};
|
|
307
321
|
export = _default;
|
|
@@ -160,7 +160,6 @@ export declare const translatable: {
|
|
|
160
160
|
readonly help_githubPages: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`";
|
|
161
161
|
readonly help_hostedBaseUrl: "Specify a base URL to be used in generating a sitemap.xml in our output folder and canonical links. If not specified, no sitemap will be generated";
|
|
162
162
|
readonly help_useHostedBaseUrlForAbsoluteLinks: "If set, TypeDoc will produce absolute links to pages on your site using the hostedBaseUrl option";
|
|
163
|
-
readonly help_gaID: "Set the Google Analytics tracking ID and activate tracking code";
|
|
164
163
|
readonly help_hideGenerator: "Do not print the TypeDoc link at the end of the page";
|
|
165
164
|
readonly help_customFooterHtml: "Custom footer after the TypeDoc link";
|
|
166
165
|
readonly help_customFooterHtmlDisableWrapper: "If set, disables the wrapper element for customFooterHtml";
|
|
@@ -301,8 +300,10 @@ export declare const translatable: {
|
|
|
301
300
|
readonly theme_re_exports: "Re-exports";
|
|
302
301
|
readonly theme_renames_and_re_exports: "Renames and re-exports";
|
|
303
302
|
readonly theme_generated_using_typedoc: "Generated using TypeDoc";
|
|
303
|
+
readonly theme_class_hierarchy_title: "Class Hierarchy";
|
|
304
304
|
readonly theme_preparing_search_index: "Preparing search index...";
|
|
305
305
|
readonly theme_search_index_not_available: "The search index is not available";
|
|
306
|
+
readonly theme_loading: "Loading...";
|
|
306
307
|
readonly theme_settings: "Settings";
|
|
307
308
|
readonly theme_member_visibility: "Member Visibility";
|
|
308
309
|
readonly theme_theme: "Theme";
|
|
@@ -178,7 +178,6 @@ exports.translatable = {
|
|
|
178
178
|
help_githubPages: "Generate a .nojekyll file to prevent 404 errors in GitHub Pages. Defaults to `true`",
|
|
179
179
|
help_hostedBaseUrl: "Specify a base URL to be used in generating a sitemap.xml in our output folder and canonical links. If not specified, no sitemap will be generated",
|
|
180
180
|
help_useHostedBaseUrlForAbsoluteLinks: "If set, TypeDoc will produce absolute links to pages on your site using the hostedBaseUrl option",
|
|
181
|
-
help_gaID: "Set the Google Analytics tracking ID and activate tracking code",
|
|
182
181
|
help_hideGenerator: "Do not print the TypeDoc link at the end of the page",
|
|
183
182
|
help_customFooterHtml: "Custom footer after the TypeDoc link",
|
|
184
183
|
help_customFooterHtmlDisableWrapper: "If set, disables the wrapper element for customFooterHtml",
|
|
@@ -329,9 +328,12 @@ exports.translatable = {
|
|
|
329
328
|
theme_re_exports: "Re-exports",
|
|
330
329
|
theme_renames_and_re_exports: "Renames and re-exports",
|
|
331
330
|
theme_generated_using_typedoc: "Generated using TypeDoc", // If this includes "TypeDoc", theme will insert a link at that location.
|
|
331
|
+
theme_class_hierarchy_title: "Class Hierarchy",
|
|
332
332
|
// Search
|
|
333
333
|
theme_preparing_search_index: "Preparing search index...",
|
|
334
334
|
theme_search_index_not_available: "The search index is not available",
|
|
335
|
+
// Left nav bar
|
|
336
|
+
theme_loading: "Loading...",
|
|
335
337
|
// Right nav bar
|
|
336
338
|
theme_settings: "Settings",
|
|
337
339
|
theme_member_visibility: "Member Visibility",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Deserializer, Serializer } from "../serialization";
|
|
2
|
-
import type { FileRegistry as
|
|
2
|
+
import type { FileRegistry as JSONFileRegistry } from "../serialization/schema";
|
|
3
3
|
import type { Reflection } from "./reflections";
|
|
4
4
|
export declare class FileRegistry {
|
|
5
5
|
protected nextId: number;
|
|
@@ -17,10 +17,15 @@ export declare class FileRegistry {
|
|
|
17
17
|
resolve(id: number): string | Reflection | undefined;
|
|
18
18
|
getName(id: number): string | undefined;
|
|
19
19
|
getNameToAbsoluteMap(): ReadonlyMap<string, string>;
|
|
20
|
-
toObject(ser: Serializer):
|
|
21
|
-
|
|
20
|
+
toObject(ser: Serializer): JSONFileRegistry;
|
|
21
|
+
/**
|
|
22
|
+
* Revive a file registry from disc.
|
|
23
|
+
* Note that in the packages context this may be called multiple times on
|
|
24
|
+
* a single object, and should merge in files from the other registries.
|
|
25
|
+
*/
|
|
26
|
+
fromObject(de: Deserializer, obj: JSONFileRegistry): void;
|
|
22
27
|
}
|
|
23
28
|
export declare class ValidatingFileRegistry extends FileRegistry {
|
|
24
29
|
register(sourcePath: string, relativePath: string): number | undefined;
|
|
25
|
-
fromObject(de: Deserializer, obj:
|
|
30
|
+
fromObject(de: Deserializer, obj: JSONFileRegistry): void;
|
|
26
31
|
}
|
|
@@ -7,7 +7,7 @@ const fs_1 = require("fs");
|
|
|
7
7
|
class FileRegistry {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.nextId = 1;
|
|
10
|
-
// The combination of
|
|
10
|
+
// The combination of these two make up the registry
|
|
11
11
|
this.mediaToReflection = new Map();
|
|
12
12
|
this.mediaToPath = new Map();
|
|
13
13
|
this.reflectionToPath = new Map();
|
|
@@ -87,6 +87,11 @@ class FileRegistry {
|
|
|
87
87
|
}
|
|
88
88
|
return result;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Revive a file registry from disc.
|
|
92
|
+
* Note that in the packages context this may be called multiple times on
|
|
93
|
+
* a single object, and should merge in files from the other registries.
|
|
94
|
+
*/
|
|
90
95
|
fromObject(de, obj) {
|
|
91
96
|
for (const [key, val] of Object.entries(obj.entries)) {
|
|
92
97
|
const absolute = (0, utils_1.normalizePath)((0, path_1.resolve)(de.projectRoot, val));
|
|
@@ -123,8 +123,8 @@ export declare class Comment {
|
|
|
123
123
|
kind: "inline-tag";
|
|
124
124
|
tag: `@${string}`;
|
|
125
125
|
text: string;
|
|
126
|
-
target?:
|
|
127
|
-
tsLinkText?: string
|
|
126
|
+
target?: Reflection | string | ReflectionSymbolId;
|
|
127
|
+
tsLinkText?: string;
|
|
128
128
|
} | {
|
|
129
129
|
kind: "relative-link";
|
|
130
130
|
/**
|
|
@@ -129,6 +129,7 @@ class DeclarationReflection extends container_1.ContainerReflection {
|
|
|
129
129
|
if (obj.variant === "project") {
|
|
130
130
|
this.kind = kind_1.ReflectionKind.Module;
|
|
131
131
|
this.packageVersion = obj.packageVersion;
|
|
132
|
+
this.project.files.fromObject(de, obj.files || {});
|
|
132
133
|
de.defer(() => {
|
|
133
134
|
for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {
|
|
134
135
|
const refl = this.project.getReflectionById(de.oldIdToNewId[+id] ?? -1);
|
|
@@ -296,7 +296,7 @@ class ProjectReflection extends container_1.ContainerReflection {
|
|
|
296
296
|
if (obj.readme) {
|
|
297
297
|
this.readme = comments_1.Comment.deserializeDisplayParts(de, obj.readme);
|
|
298
298
|
}
|
|
299
|
-
this.files.fromObject(de, obj.files);
|
|
299
|
+
this.files.fromObject(de, obj.files || {});
|
|
300
300
|
de.defer(() => {
|
|
301
301
|
// Unnecessary conditional in release
|
|
302
302
|
for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {
|
|
@@ -3,7 +3,7 @@ import type { ProjectReflection, Reflection } from "../models/reflections/index"
|
|
|
3
3
|
import type { Renderer } from "./renderer";
|
|
4
4
|
import { RendererEvent, PageEvent } from "./events";
|
|
5
5
|
export { Component };
|
|
6
|
-
export declare abstract class RendererComponent extends AbstractComponent<Renderer> {
|
|
6
|
+
export declare abstract class RendererComponent extends AbstractComponent<Renderer, {}> {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* A plugin for the renderer that reads the current render context.
|
|
@@ -115,11 +115,9 @@ let ContextAwareRendererComponent = (() => {
|
|
|
115
115
|
* @param renderer The renderer this plugin should be attached to.
|
|
116
116
|
*/
|
|
117
117
|
initialize() {
|
|
118
|
-
this.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
[events_1.RendererEvent.END]: () => this.absoluteToRelativePathMap.clear(),
|
|
122
|
-
});
|
|
118
|
+
this.owner.on(events_1.RendererEvent.BEGIN, this.onBeginRenderer.bind(this));
|
|
119
|
+
this.owner.on(events_1.PageEvent.BEGIN, this.onBeginPage.bind(this));
|
|
120
|
+
this.owner.on(events_1.RendererEvent.END, () => this.absoluteToRelativePathMap.clear());
|
|
123
121
|
}
|
|
124
122
|
/**
|
|
125
123
|
* Transform the given absolute path into a relative path.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Event } from "../utils/events";
|
|
2
1
|
import type { ProjectReflection } from "../models/reflections/project";
|
|
3
2
|
import type { RenderTemplate, UrlMapping } from "./models/UrlMapping";
|
|
4
3
|
import type { DeclarationReflection, DocumentReflection, Reflection, ReflectionKind } from "../models";
|
|
@@ -9,7 +8,7 @@ import type { DeclarationReflection, DocumentReflection, Reflection, ReflectionK
|
|
|
9
8
|
* @see {@link Renderer.EVENT_BEGIN}
|
|
10
9
|
* @see {@link Renderer.EVENT_END}
|
|
11
10
|
*/
|
|
12
|
-
export declare class RendererEvent
|
|
11
|
+
export declare class RendererEvent {
|
|
13
12
|
/**
|
|
14
13
|
* The project the renderer is currently processing.
|
|
15
14
|
*/
|
|
@@ -34,7 +33,7 @@ export declare class RendererEvent extends Event {
|
|
|
34
33
|
* @event
|
|
35
34
|
*/
|
|
36
35
|
static readonly END = "endRender";
|
|
37
|
-
constructor(
|
|
36
|
+
constructor(outputDirectory: string, project: ProjectReflection);
|
|
38
37
|
/**
|
|
39
38
|
* Create an {@link PageEvent} event based on this event and the given url mapping.
|
|
40
39
|
*
|
|
@@ -101,9 +100,8 @@ export declare class PageEvent<out Model = unknown> extends Event {
|
|
|
101
100
|
* An event emitted when markdown is being parsed. Allows other plugins to manipulate the result.
|
|
102
101
|
*
|
|
103
102
|
* @see {@link MarkdownEvent.PARSE}
|
|
104
|
-
* @see {@link MarkdownEvent.INCLUDE}
|
|
105
103
|
*/
|
|
106
|
-
export declare class MarkdownEvent
|
|
104
|
+
export declare class MarkdownEvent {
|
|
107
105
|
/**
|
|
108
106
|
* The unparsed original text.
|
|
109
107
|
*/
|
|
@@ -121,17 +119,12 @@ export declare class MarkdownEvent extends Event {
|
|
|
121
119
|
* @event
|
|
122
120
|
*/
|
|
123
121
|
static readonly PARSE = "parseMarkdown";
|
|
124
|
-
|
|
125
|
-
* Triggered on the renderer when this plugin includes a markdown file through a markdown include tag.
|
|
126
|
-
* @event
|
|
127
|
-
*/
|
|
128
|
-
static readonly INCLUDE = "includeMarkdown";
|
|
129
|
-
constructor(name: string, page: PageEvent, originalText: string, parsedText: string);
|
|
122
|
+
constructor(page: PageEvent, originalText: string, parsedText: string);
|
|
130
123
|
}
|
|
131
124
|
/**
|
|
132
125
|
* An event emitted when the search index is being prepared.
|
|
133
126
|
*/
|
|
134
|
-
export declare class IndexEvent
|
|
127
|
+
export declare class IndexEvent {
|
|
135
128
|
/**
|
|
136
129
|
* Triggered on the renderer when the search index is being prepared.
|
|
137
130
|
* @event
|
|
@@ -168,5 +161,5 @@ export declare class IndexEvent extends Event {
|
|
|
168
161
|
* Remove a search result by index.
|
|
169
162
|
*/
|
|
170
163
|
removeResult(index: number): void;
|
|
171
|
-
constructor(
|
|
164
|
+
constructor(searchResults: Array<DeclarationReflection | DocumentReflection>);
|
|
172
165
|
}
|
|
@@ -25,7 +25,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.IndexEvent = exports.MarkdownEvent = exports.PageEvent = exports.RendererEvent = void 0;
|
|
27
27
|
const Path = __importStar(require("path"));
|
|
28
|
-
const events_1 = require("../utils/events");
|
|
29
28
|
/**
|
|
30
29
|
* An event emitted by the {@link Renderer} class at the very beginning and
|
|
31
30
|
* ending of the entire rendering process.
|
|
@@ -33,9 +32,8 @@ const events_1 = require("../utils/events");
|
|
|
33
32
|
* @see {@link Renderer.EVENT_BEGIN}
|
|
34
33
|
* @see {@link Renderer.EVENT_END}
|
|
35
34
|
*/
|
|
36
|
-
class RendererEvent
|
|
37
|
-
constructor(
|
|
38
|
-
super(name);
|
|
35
|
+
class RendererEvent {
|
|
36
|
+
constructor(outputDirectory, project) {
|
|
39
37
|
this.outputDirectory = outputDirectory;
|
|
40
38
|
this.project = project;
|
|
41
39
|
}
|
|
@@ -72,7 +70,7 @@ RendererEvent.END = "endRender";
|
|
|
72
70
|
* @see {@link Renderer.EVENT_BEGIN_PAGE}
|
|
73
71
|
* @see {@link Renderer.EVENT_END_PAGE}
|
|
74
72
|
*/
|
|
75
|
-
class PageEvent extends
|
|
73
|
+
class PageEvent extends Event {
|
|
76
74
|
constructor(name, model) {
|
|
77
75
|
super(name);
|
|
78
76
|
/**
|
|
@@ -98,11 +96,9 @@ PageEvent.END = "endPage";
|
|
|
98
96
|
* An event emitted when markdown is being parsed. Allows other plugins to manipulate the result.
|
|
99
97
|
*
|
|
100
98
|
* @see {@link MarkdownEvent.PARSE}
|
|
101
|
-
* @see {@link MarkdownEvent.INCLUDE}
|
|
102
99
|
*/
|
|
103
|
-
class MarkdownEvent
|
|
104
|
-
constructor(
|
|
105
|
-
super(name);
|
|
100
|
+
class MarkdownEvent {
|
|
101
|
+
constructor(page, originalText, parsedText) {
|
|
106
102
|
this.page = page;
|
|
107
103
|
this.originalText = originalText;
|
|
108
104
|
this.parsedText = parsedText;
|
|
@@ -114,15 +110,10 @@ exports.MarkdownEvent = MarkdownEvent;
|
|
|
114
110
|
* @event
|
|
115
111
|
*/
|
|
116
112
|
MarkdownEvent.PARSE = "parseMarkdown";
|
|
117
|
-
/**
|
|
118
|
-
* Triggered on the renderer when this plugin includes a markdown file through a markdown include tag.
|
|
119
|
-
* @event
|
|
120
|
-
*/
|
|
121
|
-
MarkdownEvent.INCLUDE = "includeMarkdown";
|
|
122
113
|
/**
|
|
123
114
|
* An event emitted when the search index is being prepared.
|
|
124
115
|
*/
|
|
125
|
-
class IndexEvent
|
|
116
|
+
class IndexEvent {
|
|
126
117
|
/**
|
|
127
118
|
* Remove a search result by index.
|
|
128
119
|
*/
|
|
@@ -130,8 +121,7 @@ class IndexEvent extends events_1.Event {
|
|
|
130
121
|
this.searchResults.splice(index, 1);
|
|
131
122
|
this.searchFields.splice(index, 1);
|
|
132
123
|
}
|
|
133
|
-
constructor(
|
|
134
|
-
super(name);
|
|
124
|
+
constructor(searchResults) {
|
|
135
125
|
/**
|
|
136
126
|
* Weights for the fields defined in `searchFields`. The default will weight
|
|
137
127
|
* `name` as 10x more important than comment and document content.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PageEvent, RendererEvent, MarkdownEvent, IndexEvent } from "./events";
|
|
2
2
|
export { UrlMapping } from "./models/UrlMapping";
|
|
3
3
|
export type { RenderTemplate } from "./models/UrlMapping";
|
|
4
|
-
export { Renderer } from "./renderer";
|
|
4
|
+
export { Renderer, type RendererEvents } from "./renderer";
|
|
5
5
|
export type { RendererHooks } from "./renderer";
|
|
6
6
|
export { Theme } from "./theme";
|
|
7
7
|
export { DefaultTheme, Slugger, type NavigationElement, } from "./themes/default/DefaultTheme";
|
|
@@ -87,21 +87,19 @@ let AssetsPlugin = (() => {
|
|
|
87
87
|
* Create a new AssetsPlugin instance.
|
|
88
88
|
*/
|
|
89
89
|
initialize() {
|
|
90
|
-
this.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
});
|
|
90
|
+
this.owner.on(events_1.RendererEvent.BEGIN, this.onRenderBegin.bind(this));
|
|
91
|
+
this.owner.on(events_1.RendererEvent.END, this.onRenderEnd.bind(this));
|
|
92
|
+
}
|
|
93
|
+
onRenderBegin(event) {
|
|
94
|
+
const dest = (0, path_1.join)(event.outputDirectory, "assets");
|
|
95
|
+
if (this.customCss) {
|
|
96
|
+
if ((0, fs_2.existsSync)(this.customCss)) {
|
|
97
|
+
(0, fs_1.copySync)(this.customCss, (0, path_1.join)(dest, "custom.css"));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.application.logger.error(this.application.i18n.custom_css_file_0_does_not_exist(this.customCss));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
105
103
|
}
|
|
106
104
|
/**
|
|
107
105
|
* Triggered before the renderer starts rendering a project.
|
|
@@ -77,9 +77,7 @@ let IconsPlugin = (() => {
|
|
|
77
77
|
let _classSuper = components_1.RendererComponent;
|
|
78
78
|
var IconsPlugin = _classThis = class extends _classSuper {
|
|
79
79
|
initialize() {
|
|
80
|
-
this.
|
|
81
|
-
[events_1.RendererEvent.BEGIN]: this.onBeginRender,
|
|
82
|
-
});
|
|
80
|
+
this.owner.on(events_1.RendererEvent.BEGIN, this.onBeginRender.bind(this));
|
|
83
81
|
}
|
|
84
82
|
onBeginRender(_event) {
|
|
85
83
|
if (this.owner.theme instanceof DefaultTheme_1.DefaultTheme) {
|
|
@@ -7,15 +7,7 @@ import { RendererComponent } from "../components";
|
|
|
7
7
|
export declare class JavascriptIndexPlugin extends RendererComponent {
|
|
8
8
|
private accessor searchComments;
|
|
9
9
|
private accessor searchDocuments;
|
|
10
|
-
/**
|
|
11
|
-
* Create a new JavascriptIndexPlugin instance.
|
|
12
|
-
*/
|
|
13
10
|
initialize(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Triggered after a document has been rendered, just before it is written to disc.
|
|
16
|
-
*
|
|
17
|
-
* @param event An event object describing the current render operation.
|
|
18
|
-
*/
|
|
19
11
|
private onRendererBegin;
|
|
20
12
|
private buildSearchIndex;
|
|
21
13
|
private getCommentSearchText;
|
|
@@ -106,24 +106,13 @@ let JavascriptIndexPlugin = (() => {
|
|
|
106
106
|
set searchComments(value) { __classPrivateFieldSet(this, _JavascriptIndexPlugin_searchComments_accessor_storage, value, "f"); }
|
|
107
107
|
get searchDocuments() { return __classPrivateFieldGet(this, _JavascriptIndexPlugin_searchDocuments_accessor_storage, "f"); }
|
|
108
108
|
set searchDocuments(value) { __classPrivateFieldSet(this, _JavascriptIndexPlugin_searchDocuments_accessor_storage, value, "f"); }
|
|
109
|
-
/**
|
|
110
|
-
* Create a new JavascriptIndexPlugin instance.
|
|
111
|
-
*/
|
|
112
109
|
initialize() {
|
|
113
|
-
this.
|
|
110
|
+
this.owner.on(events_1.RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
114
111
|
}
|
|
115
|
-
|
|
116
|
-
* Triggered after a document has been rendered, just before it is written to disc.
|
|
117
|
-
*
|
|
118
|
-
* @param event An event object describing the current render operation.
|
|
119
|
-
*/
|
|
120
|
-
onRendererBegin(event) {
|
|
112
|
+
onRendererBegin(_event) {
|
|
121
113
|
if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
|
|
122
114
|
return;
|
|
123
115
|
}
|
|
124
|
-
if (event.isDefaultPrevented()) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
116
|
this.owner.preRenderAsyncJobs.push((event) => this.buildSearchIndex(event));
|
|
128
117
|
}
|
|
129
118
|
async buildSearchIndex(event) {
|
|
@@ -136,11 +125,8 @@ let JavascriptIndexPlugin = (() => {
|
|
|
136
125
|
refl.name &&
|
|
137
126
|
!refl.flags.isExternal);
|
|
138
127
|
});
|
|
139
|
-
const indexEvent = new events_1.IndexEvent(
|
|
140
|
-
this.owner.trigger(indexEvent);
|
|
141
|
-
if (indexEvent.isDefaultPrevented()) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
128
|
+
const indexEvent = new events_1.IndexEvent(initialSearchResults);
|
|
129
|
+
this.owner.trigger(events_1.IndexEvent.PREPARE_INDEX, indexEvent);
|
|
144
130
|
const builder = new lunr_1.Builder();
|
|
145
131
|
builder.pipeline.add(lunr_1.trimmer);
|
|
146
132
|
builder.ref("id");
|
|
@@ -78,15 +78,12 @@ let NavigationPlugin = (() => {
|
|
|
78
78
|
let _classSuper = components_1.RendererComponent;
|
|
79
79
|
var NavigationPlugin = _classThis = class extends _classSuper {
|
|
80
80
|
initialize() {
|
|
81
|
-
this.
|
|
81
|
+
this.owner.on(events_1.RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
82
82
|
}
|
|
83
|
-
onRendererBegin(
|
|
83
|
+
onRendererBegin(_event) {
|
|
84
84
|
if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
if (event.isDefaultPrevented()) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
87
|
this.owner.preRenderAsyncJobs.push((event) => this.buildNavigationIndex(event));
|
|
91
88
|
}
|
|
92
89
|
async buildNavigationIndex(event) {
|
|
@@ -61,13 +61,13 @@ let SitemapPlugin = (() => {
|
|
|
61
61
|
return !url || url.endsWith("/") ? url : url + "/";
|
|
62
62
|
}
|
|
63
63
|
initialize() {
|
|
64
|
-
this.
|
|
64
|
+
this.owner.on(events_1.RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
65
65
|
}
|
|
66
|
-
onRendererBegin(
|
|
66
|
+
onRendererBegin(_event) {
|
|
67
67
|
if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
70
|
+
if (!this.hostedBaseUrl) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
this.owner.hooks.on("head.begin", (context) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Application } from "../application";
|
|
2
2
|
import type { Theme } from "./theme";
|
|
3
|
-
import { RendererEvent } from "./events";
|
|
3
|
+
import { RendererEvent, PageEvent, IndexEvent, type MarkdownEvent } from "./events";
|
|
4
4
|
import type { ProjectReflection } from "../models/reflections/project";
|
|
5
5
|
import { RendererComponent } from "./components";
|
|
6
6
|
import { ChildableComponent } from "../utils/component";
|
|
@@ -77,6 +77,14 @@ export interface RendererHooks {
|
|
|
77
77
|
*/
|
|
78
78
|
"comment.afterTags": [DefaultThemeRenderContext, Comment, Reflection];
|
|
79
79
|
}
|
|
80
|
+
export interface RendererEvents {
|
|
81
|
+
beginRender: [RendererEvent];
|
|
82
|
+
beginPage: [PageEvent<Reflection>];
|
|
83
|
+
endPage: [PageEvent<Reflection>];
|
|
84
|
+
endRender: [RendererEvent];
|
|
85
|
+
parseMarkdown: [MarkdownEvent];
|
|
86
|
+
prepareIndex: [IndexEvent];
|
|
87
|
+
}
|
|
80
88
|
/**
|
|
81
89
|
* The renderer processes a {@link ProjectReflection} using a {@link Theme} instance and writes
|
|
82
90
|
* the emitted html documents to a output directory. You can specify which theme should be used
|
|
@@ -88,8 +96,7 @@ export interface RendererHooks {
|
|
|
88
96
|
*
|
|
89
97
|
* * {@link Renderer.EVENT_BEGIN}<br>
|
|
90
98
|
* Triggered before the renderer starts rendering a project. The listener receives
|
|
91
|
-
* an instance of {@link RendererEvent}.
|
|
92
|
-
* render process can be canceled.
|
|
99
|
+
* an instance of {@link RendererEvent}.
|
|
93
100
|
*
|
|
94
101
|
* * {@link Renderer.EVENT_BEGIN_PAGE}<br>
|
|
95
102
|
* Triggered before a document will be rendered. The listener receives an instance of
|
|
@@ -111,7 +118,7 @@ export interface RendererHooks {
|
|
|
111
118
|
*
|
|
112
119
|
* @document ../../../internal-docs/custom-themes.md
|
|
113
120
|
*/
|
|
114
|
-
export declare class Renderer extends ChildableComponent<Application, RendererComponent> {
|
|
121
|
+
export declare class Renderer extends ChildableComponent<Application, RendererComponent, RendererEvents> {
|
|
115
122
|
private themes;
|
|
116
123
|
/** @event */
|
|
117
124
|
static readonly EVENT_BEGIN_PAGE = "beginPage";
|
|
@@ -104,8 +104,7 @@ const jsx_1 = require("../utils/jsx");
|
|
|
104
104
|
*
|
|
105
105
|
* * {@link Renderer.EVENT_BEGIN}<br>
|
|
106
106
|
* Triggered before the renderer starts rendering a project. The listener receives
|
|
107
|
-
* an instance of {@link RendererEvent}.
|
|
108
|
-
* render process can be canceled.
|
|
107
|
+
* an instance of {@link RendererEvent}.
|
|
109
108
|
*
|
|
110
109
|
* * {@link Renderer.EVENT_BEGIN_PAGE}<br>
|
|
111
110
|
* Triggered before a document will be rendered. The listener receives an instance of
|
|
@@ -254,20 +253,18 @@ let Renderer = (() => {
|
|
|
254
253
|
!(await this.prepareOutputDirectory(outputDirectory))) {
|
|
255
254
|
return;
|
|
256
255
|
}
|
|
257
|
-
const output = new events_1.RendererEvent(
|
|
256
|
+
const output = new events_1.RendererEvent(outputDirectory, project);
|
|
258
257
|
output.urls = this.theme.getUrls(project);
|
|
259
|
-
this.trigger(output);
|
|
258
|
+
this.trigger(events_1.RendererEvent.BEGIN, output);
|
|
260
259
|
await this.runPreRenderJobs(output);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
output.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.trigger(events_1.RendererEvent.END, output);
|
|
270
|
-
}
|
|
260
|
+
this.application.logger.verbose(`There are ${output.urls.length} pages to write.`);
|
|
261
|
+
output.urls.forEach((mapping) => {
|
|
262
|
+
this.renderDocument(...output.createPageEvent(mapping));
|
|
263
|
+
(0, type_1.validateStateIsClean)(mapping.url);
|
|
264
|
+
});
|
|
265
|
+
await Promise.all(this.postRenderAsyncJobs.map((job) => job(output)));
|
|
266
|
+
this.postRenderAsyncJobs = [];
|
|
267
|
+
this.trigger(events_1.RendererEvent.END, output);
|
|
271
268
|
this.theme = void 0;
|
|
272
269
|
this.hooks.restoreMomento(momento);
|
|
273
270
|
}
|
|
@@ -292,10 +289,6 @@ let Renderer = (() => {
|
|
|
292
289
|
renderDocument(template, page) {
|
|
293
290
|
const momento = this.hooks.saveMomento();
|
|
294
291
|
this.trigger(events_1.PageEvent.BEGIN, page);
|
|
295
|
-
if (page.isDefaultPrevented()) {
|
|
296
|
-
this.hooks.restoreMomento(momento);
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
292
|
if (page.model instanceof models_1.Reflection) {
|
|
300
293
|
page.contents = this.theme.render(page, template);
|
|
301
294
|
}
|
|
@@ -304,9 +297,6 @@ let Renderer = (() => {
|
|
|
304
297
|
}
|
|
305
298
|
this.trigger(events_1.PageEvent.END, page);
|
|
306
299
|
this.hooks.restoreMomento(momento);
|
|
307
|
-
if (page.isDefaultPrevented()) {
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
300
|
try {
|
|
311
301
|
(0, fs_1.writeFileSync)(page.filename, page.contents);
|
|
312
302
|
}
|
|
@@ -115,7 +115,7 @@ let MarkedPlugin = (() => {
|
|
|
115
115
|
*/
|
|
116
116
|
initialize() {
|
|
117
117
|
super.initialize();
|
|
118
|
-
this.
|
|
118
|
+
this.owner.on(events_1.MarkdownEvent.PARSE, this.onParseMarkdown.bind(this));
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* Highlight the syntax of the given text using HighlightJS.
|
|
@@ -149,8 +149,8 @@ let MarkedPlugin = (() => {
|
|
|
149
149
|
markdown = this.displayPartsToMarkdown(page, context, markdown);
|
|
150
150
|
}
|
|
151
151
|
this.renderContext = context;
|
|
152
|
-
const event = new events_1.MarkdownEvent(
|
|
153
|
-
this.owner.trigger(event);
|
|
152
|
+
const event = new events_1.MarkdownEvent(page, markdown, markdown);
|
|
153
|
+
this.owner.trigger(events_1.MarkdownEvent.PARSE, event);
|
|
154
154
|
this.renderContext = null;
|
|
155
155
|
return event.parsedText;
|
|
156
156
|
}
|
|
@@ -256,7 +256,7 @@ let MarkedPlugin = (() => {
|
|
|
256
256
|
this.parser = (0, markdown_it_1.default)({
|
|
257
257
|
...this.markdownItOptions,
|
|
258
258
|
highlight: (code, lang) => {
|
|
259
|
-
code =
|
|
259
|
+
code = this.getHighlighted(code, lang || "ts");
|
|
260
260
|
code = code.replace(/\n$/, "") + "\n";
|
|
261
261
|
if (!lang) {
|
|
262
262
|
return `<pre><code>${code}</code><button>${this.application.i18n.theme_copy()}</button></pre>\n`;
|
|
@@ -40,7 +40,6 @@ export declare class DefaultThemeRenderContext {
|
|
|
40
40
|
* by their type declaration, which is already rendered by {@link DefaultThemeRenderContext.memberDeclaration}
|
|
41
41
|
*/
|
|
42
42
|
reflectionPreview: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
43
|
-
analytics: () => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
44
43
|
breadcrumb: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
45
44
|
commentSummary: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
46
45
|
commentTags: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
@@ -54,12 +53,12 @@ export declare class DefaultThemeRenderContext {
|
|
|
54
53
|
memberGetterSetter: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
55
54
|
memberReference: (props: import("../../../models").ReferenceReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
56
55
|
memberSignatureBody: (props: import("../../../models").SignatureReflection, r_1?: {
|
|
57
|
-
hideSources?: boolean
|
|
56
|
+
hideSources?: boolean;
|
|
58
57
|
} | undefined) => import("../../../utils/jsx.elements").JsxElement;
|
|
59
58
|
memberSignatureTitle: (props: import("../../../models").SignatureReflection, r_1?: {
|
|
60
|
-
hideName?: boolean
|
|
61
|
-
arrowStyle?: boolean
|
|
62
|
-
hideParamTypes?: boolean
|
|
59
|
+
hideName?: boolean;
|
|
60
|
+
arrowStyle?: boolean;
|
|
61
|
+
hideParamTypes?: boolean;
|
|
63
62
|
} | undefined) => import("../../../utils/jsx.elements").JsxElement;
|
|
64
63
|
memberSignatures: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
65
64
|
memberSources: (props: DeclarationReflection | import("../../../models").SignatureReflection) => import("../../../utils/jsx.elements").JsxElement;
|