typedoc 0.27.0-beta.0 → 0.27.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/lib/application.d.ts +1 -1
- package/dist/lib/application.js +2 -5
- package/dist/lib/converter/converter.js +2 -1
- package/dist/lib/converter/factories/index-signature.d.ts +2 -2
- package/dist/lib/converter/factories/index-signature.js +39 -16
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +1 -1
- package/dist/lib/converter/symbols.js +11 -3
- package/dist/lib/converter/types.js +3 -4
- package/dist/lib/internationalization/locales/en.cjs +9 -3
- package/dist/lib/internationalization/locales/en.d.cts +7 -3
- package/dist/lib/internationalization/locales/jp.cjs +5 -3
- package/dist/lib/internationalization/locales/jp.d.cts +0 -3
- package/dist/lib/internationalization/locales/ko.cjs +5 -2
- package/dist/lib/internationalization/locales/ko.d.cts +0 -2
- package/dist/lib/internationalization/locales/zh.cjs +40 -13
- package/dist/lib/internationalization/locales/zh.d.cts +35 -7
- package/dist/lib/models/types.d.ts +3 -3
- package/dist/lib/output/formatter.js +6 -1
- package/dist/lib/output/output.d.ts +2 -1
- package/dist/lib/output/output.js +30 -11
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +2 -0
- package/dist/lib/output/plugins/AssetsPlugin.js +2 -0
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +67 -0
- package/dist/lib/output/plugins/index.d.ts +1 -0
- package/dist/lib/output/plugins/index.js +1 -0
- package/dist/lib/output/renderer.js +2 -1
- package/dist/lib/output/themes/MarkedPlugin.d.ts +1 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +1 -1
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +1 -1
- package/dist/lib/output/themes/default/layouts/default.js +3 -2
- package/dist/lib/output/themes/default/partials/comment.js +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.js +9 -9
- package/dist/lib/output/themes/default/partials/navigation.js +1 -1
- package/dist/lib/output/themes/default/partials/toolbar.js +1 -1
- package/dist/lib/output/themes/default/partials/typeDetails.js +1 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +18 -13
- package/dist/lib/output/themes/default/templates/reflection.js +1 -0
- package/dist/lib/output/themes/lib.js +8 -1
- package/dist/lib/utils/entry-point.d.ts +1 -1
- package/dist/lib/utils/entry-point.js +4 -25
- package/dist/lib/utils/fs.d.ts +10 -0
- package/dist/lib/utils/fs.js +134 -20
- package/dist/lib/utils/general.d.ts +1 -0
- package/dist/lib/utils/general.js +4 -0
- package/dist/lib/utils/highlighter.d.ts +2 -3
- package/dist/lib/utils/highlighter.js +28 -30
- package/dist/lib/utils/jsx.d.ts +1 -2
- package/dist/lib/utils/jsx.elements.d.ts +1 -1
- package/dist/lib/utils/jsx.elements.js +3 -1
- package/dist/lib/utils/jsx.js +37 -40
- package/dist/lib/utils/options/declaration.d.ts +3 -1
- package/dist/lib/utils/options/defaults.d.ts +1 -1
- package/dist/lib/utils/options/sources/typedoc.js +13 -1
- package/package.json +9 -10
- package/static/main.js +4 -4
- package/static/style.css +18 -15
|
@@ -6,6 +6,8 @@ declare const _default: {
|
|
|
6
6
|
solution_not_supported_in_watch_mode: string;
|
|
7
7
|
strategy_not_supported_in_watch_mode: string;
|
|
8
8
|
found_0_errors_and_1_warnings: "发现 {0} 个错误和 {1} 个警告";
|
|
9
|
+
output_0_could_not_be_generated: "由于以上错误无法生成 {0} 输出";
|
|
10
|
+
output_0_generated_at_1: "已生成 {0} 输出,位于 {1}";
|
|
9
11
|
no_entry_points_for_packages: string;
|
|
10
12
|
failed_to_find_packages: string;
|
|
11
13
|
nested_packages_unsupported_0: "位于 {0} 的项目已将 entryPointStrategy 设置为包,但不支持嵌套包";
|
|
@@ -53,6 +55,7 @@ declare const _default: {
|
|
|
53
55
|
type_0_defined_in_1_is_referenced_by_2_but_not_included_in_docs: "{0} 在 {1} 中定义,被 {2} 引用,但未包含在文档中";
|
|
54
56
|
reflection_0_kind_1_defined_in_2_does_not_have_any_documentation: "{0} ({1}),在 {2} 中定义,没有任何文档";
|
|
55
57
|
invalid_intentionally_not_exported_symbols_0: "以下符号被标记为有意不导出,但未在文档中引用,或已被导出:\n{0}";
|
|
58
|
+
reflection_0_has_unused_mergeModuleWith_tag: "{0} 中存在无法解析的 @mergeModuleWith 标签";
|
|
56
59
|
not_all_search_category_boosts_used_0: "文档中并未使用 searchCategoryBoosts 中指定的所有类别。未使用的类别包括:\n{0}";
|
|
57
60
|
not_all_search_group_boosts_used_0: "文档中并未使用 searchGroupBoosts 中指定的所有组。未使用的组为:\n{0}";
|
|
58
61
|
comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "{0} 的评论包含“{1}”的 @categoryDescription,但该类别中没有子项";
|
|
@@ -69,6 +72,9 @@ declare const _default: {
|
|
|
69
72
|
disable_git_set_but_not_source_link_template: string;
|
|
70
73
|
disable_git_set_and_git_revision_used: string;
|
|
71
74
|
git_remote_0_not_valid: "提供的 git 远程“{0}”无效。源链接将失效";
|
|
75
|
+
reflection_0_tried_to_merge_into_child_1: "反射 {0} 尝试使用 @mergeModuleWith 合并到其子项之一:{1}";
|
|
76
|
+
include_0_in_1_specified_2_resolved_to_3_does_not_exist: "{1} 的注释中 {0} 标签指定了包含 “{2}”,解析为 “{3}”,该文件并不存在或并非文件。";
|
|
77
|
+
include_0_in_1_specified_2_circular_include_3: "{1} 的注释中 {0} 标签指定了包含 “{2}”,导致了循环包含:\n\t{3}";
|
|
72
78
|
custom_css_file_0_does_not_exist: "{0} 处的自定义 CSS 文件不存在";
|
|
73
79
|
custom_js_file_0_does_not_exist: "{0} 处的自定义 JavaScript 文件不存在";
|
|
74
80
|
unsupported_highlight_language_0_not_highlighted_in_comment_for_1: "不支持的高亮语言 {0} 将不会在 {1} 的注释中高亮";
|
|
@@ -78,11 +84,13 @@ declare const _default: {
|
|
|
78
84
|
could_not_empty_output_directory_0: "无法清空输出目录 {0}";
|
|
79
85
|
could_not_create_output_directory_0: "无法创建输出目录 {0}";
|
|
80
86
|
theme_0_is_not_defined_available_are_1: "主题“{0}”未定义。可用主题为:{1}";
|
|
87
|
+
reflection_0_links_to_1_but_anchor_does_not_exist_try_2: "{0} 链接至 {1},但对应锚点不存在。你是否是指:\n\t{2}";
|
|
81
88
|
no_entry_points_provided: string;
|
|
82
89
|
unable_to_find_any_entry_points: string;
|
|
83
90
|
watch_does_not_support_packages_mode: string;
|
|
84
91
|
watch_does_not_support_merge_mode: string;
|
|
85
92
|
entry_point_0_not_in_program: "入口点 {0} 未被 tsconfig 中的“files”或“include”选项引用";
|
|
93
|
+
failed_to_resolve_0_to_ts_path: "无法将 package.json 中的入口点 {0} 解析至 TypeScript 源文件";
|
|
86
94
|
use_expand_or_glob_for_files_in_dir: string;
|
|
87
95
|
glob_0_did_not_match_any_files: "glob {0} 与任何文件均不匹配";
|
|
88
96
|
entry_point_0_did_not_match_any_files_after_exclude: "应用排除模式后,glob {0} 没有匹配任何文件";
|
|
@@ -130,6 +138,7 @@ declare const _default: {
|
|
|
130
138
|
help_excludeReferences: string;
|
|
131
139
|
help_externalSymbolLinkMappings: string;
|
|
132
140
|
help_out: string;
|
|
141
|
+
help_html: string;
|
|
133
142
|
help_json: string;
|
|
134
143
|
help_pretty: string;
|
|
135
144
|
help_emit: string;
|
|
@@ -137,6 +146,7 @@ declare const _default: {
|
|
|
137
146
|
help_lightHighlightTheme: string;
|
|
138
147
|
help_darkHighlightTheme: string;
|
|
139
148
|
help_highlightLanguages: string;
|
|
149
|
+
help_typePrintWidth: string;
|
|
140
150
|
help_customCss: string;
|
|
141
151
|
help_customJs: string;
|
|
142
152
|
help_markdownItOptions: string;
|
|
@@ -151,8 +161,10 @@ declare const _default: {
|
|
|
151
161
|
help_disableGit: string;
|
|
152
162
|
help_basePath: string;
|
|
153
163
|
help_excludeTags: string;
|
|
164
|
+
help_notRenderedTags: string;
|
|
154
165
|
help_readme: string;
|
|
155
166
|
help_cname: string;
|
|
167
|
+
help_favicon: string;
|
|
156
168
|
help_sourceLinkExternal: string;
|
|
157
169
|
help_markdownLinkExternal: string;
|
|
158
170
|
help_githubPages: string;
|
|
@@ -169,11 +181,13 @@ declare const _default: {
|
|
|
169
181
|
help_navigationLinks: string;
|
|
170
182
|
help_sidebarLinks: string;
|
|
171
183
|
help_navigationLeaves: string;
|
|
172
|
-
help_navigation: string;
|
|
173
184
|
help_headings: string;
|
|
185
|
+
help_sluggerConfiguration: string;
|
|
186
|
+
help_navigation: string;
|
|
174
187
|
help_visibilityFilters: string;
|
|
175
188
|
help_searchCategoryBoosts: string;
|
|
176
189
|
help_searchGroupBoosts: string;
|
|
190
|
+
help_useFirstParagraphOfCommentAsSummary: string;
|
|
177
191
|
help_jsDocCompatibility: string;
|
|
178
192
|
help_commentStyle: string;
|
|
179
193
|
help_useTsLinkResolution: string;
|
|
@@ -182,6 +196,7 @@ declare const _default: {
|
|
|
182
196
|
help_inlineTags: string;
|
|
183
197
|
help_modifierTags: string;
|
|
184
198
|
help_categorizeByGroup: string;
|
|
199
|
+
help_groupReferencesByType: string;
|
|
185
200
|
help_defaultCategory: string;
|
|
186
201
|
help_categoryOrder: string;
|
|
187
202
|
help_groupOrder: string;
|
|
@@ -216,6 +231,7 @@ declare const _default: {
|
|
|
216
231
|
highlightLanguages_contains_invalid_languages_0: "highlightLanguages 包含无效语言:{0},运行 typedoc --help 获取受支持语言的列表";
|
|
217
232
|
hostedBaseUrl_must_start_with_http: string;
|
|
218
233
|
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: string;
|
|
234
|
+
favicon_must_be_ico_or_svg: string;
|
|
219
235
|
option_0_must_be_an_object: "“{0}”选项必须是非数组对象";
|
|
220
236
|
option_0_must_be_a_function: "‘{0}’ 选项必须是一个函数";
|
|
221
237
|
option_0_must_be_object_with_urls: "{0} 必须是具有字符串标签作为键和 URL 值的对象";
|
|
@@ -224,6 +240,13 @@ declare const _default: {
|
|
|
224
240
|
option_0_values_must_be_numbers: "{0} 的所有值都必须是数字";
|
|
225
241
|
option_0_values_must_be_array_of_tags: "{0} 必须是有效标签名称的数组";
|
|
226
242
|
option_0_specified_1_but_only_2_is_valid: "{0} 只能指定已知值,并且提供了无效值 ({1})。有效的排序策略为:\n{2}";
|
|
243
|
+
option_outputs_must_be_array: string;
|
|
244
|
+
specified_output_0_has_not_been_defined: "指定的输出类型 {0} 未被定义。";
|
|
245
|
+
alert_note: string;
|
|
246
|
+
alert_tip: string;
|
|
247
|
+
alert_important: string;
|
|
248
|
+
alert_warning: string;
|
|
249
|
+
alert_caution: string;
|
|
227
250
|
kind_project: string;
|
|
228
251
|
kind_module: string;
|
|
229
252
|
kind_namespace: string;
|
|
@@ -272,23 +295,22 @@ declare const _default: {
|
|
|
272
295
|
kind_plural_type_alias: string;
|
|
273
296
|
kind_plural_reference: string;
|
|
274
297
|
kind_plural_document: string;
|
|
275
|
-
flag_protected: string;
|
|
276
298
|
flag_private: string;
|
|
277
|
-
|
|
278
|
-
flag_inherited: string;
|
|
299
|
+
flag_protected: string;
|
|
279
300
|
flag_public: string;
|
|
280
301
|
flag_static: string;
|
|
302
|
+
flag_external: string;
|
|
281
303
|
flag_optional: string;
|
|
282
304
|
flag_rest: string;
|
|
283
305
|
flag_abstract: string;
|
|
284
306
|
flag_const: string;
|
|
285
307
|
flag_readonly: string;
|
|
308
|
+
flag_inherited: string;
|
|
286
309
|
theme_implements: string;
|
|
287
310
|
theme_indexable: string;
|
|
288
311
|
theme_type_declaration: string;
|
|
289
312
|
theme_index: string;
|
|
290
313
|
theme_hierarchy: string;
|
|
291
|
-
theme_hierarchy_view_full: string;
|
|
292
314
|
theme_implemented_by: string;
|
|
293
315
|
theme_defined_in: string;
|
|
294
316
|
theme_implementation_of: string;
|
|
@@ -298,6 +320,7 @@ declare const _default: {
|
|
|
298
320
|
theme_generated_using_typedoc: string;
|
|
299
321
|
theme_preparing_search_index: string;
|
|
300
322
|
theme_search_index_not_available: string;
|
|
323
|
+
theme_loading: string;
|
|
301
324
|
theme_settings: string;
|
|
302
325
|
theme_member_visibility: string;
|
|
303
326
|
theme_theme: string;
|
|
@@ -311,8 +334,6 @@ declare const _default: {
|
|
|
311
334
|
theme_copy: string;
|
|
312
335
|
theme_copied: string;
|
|
313
336
|
theme_normally_hidden: string;
|
|
314
|
-
theme_class_hierarchy_title: string;
|
|
315
|
-
theme_loading: string;
|
|
316
337
|
tag_defaultValue: string;
|
|
317
338
|
tag_deprecated: string;
|
|
318
339
|
tag_example: string;
|
|
@@ -339,6 +360,7 @@ declare const _default: {
|
|
|
339
360
|
tag_jsx: string;
|
|
340
361
|
tag_license: string;
|
|
341
362
|
tag_module: string;
|
|
363
|
+
tag_mergeModuleWith: string;
|
|
342
364
|
tag_prop: string;
|
|
343
365
|
tag_property: string;
|
|
344
366
|
tag_return: string;
|
|
@@ -347,10 +369,13 @@ declare const _default: {
|
|
|
347
369
|
tag_template: string;
|
|
348
370
|
tag_type: string;
|
|
349
371
|
tag_typedef: string;
|
|
372
|
+
tag_summary: string;
|
|
350
373
|
tag_link: string;
|
|
351
374
|
tag_label: string;
|
|
352
375
|
tag_linkcode: string;
|
|
353
376
|
tag_linkplain: string;
|
|
377
|
+
tag_include: string;
|
|
378
|
+
tag_includeCode: string;
|
|
354
379
|
tag_alpha: string;
|
|
355
380
|
tag_beta: string;
|
|
356
381
|
tag_eventProperty: string;
|
|
@@ -366,11 +391,13 @@ declare const _default: {
|
|
|
366
391
|
tag_class: string;
|
|
367
392
|
tag_enum: string;
|
|
368
393
|
tag_event: string;
|
|
394
|
+
tag_expand: string;
|
|
369
395
|
tag_hidden: string;
|
|
370
396
|
tag_hideCategories: string;
|
|
371
397
|
tag_hideconstructor: string;
|
|
372
398
|
tag_hideGroups: string;
|
|
373
399
|
tag_ignore: string;
|
|
400
|
+
tag_inline: string;
|
|
374
401
|
tag_interface: string;
|
|
375
402
|
tag_namespace: string;
|
|
376
403
|
tag_overload: string;
|
|
@@ -378,5 +405,6 @@ declare const _default: {
|
|
|
378
405
|
tag_protected: string;
|
|
379
406
|
tag_showCategories: string;
|
|
380
407
|
tag_showGroups: string;
|
|
408
|
+
tag_useDeclaredType: string;
|
|
381
409
|
};
|
|
382
410
|
export = _default;
|
|
@@ -233,11 +233,11 @@ export declare class MappedType extends Type {
|
|
|
233
233
|
parameter: string;
|
|
234
234
|
parameterType: SomeType;
|
|
235
235
|
templateType: SomeType;
|
|
236
|
-
readonlyModifier?:
|
|
237
|
-
optionalModifier?:
|
|
236
|
+
readonlyModifier?: "+" | "-" | undefined;
|
|
237
|
+
optionalModifier?: "+" | "-" | undefined;
|
|
238
238
|
nameType?: SomeType | undefined;
|
|
239
239
|
readonly type = "mapped";
|
|
240
|
-
constructor(parameter: string, parameterType: SomeType, templateType: SomeType, readonlyModifier?:
|
|
240
|
+
constructor(parameter: string, parameterType: SomeType, templateType: SomeType, readonlyModifier?: "+" | "-" | undefined, optionalModifier?: "+" | "-" | undefined, nameType?: SomeType | undefined);
|
|
241
241
|
protected getTypeString(): string;
|
|
242
242
|
needsParenthesis(): boolean;
|
|
243
243
|
toObject(serializer: Serializer): JSONOutput.MappedType;
|
|
@@ -451,7 +451,12 @@ export class FormattedCodeBuilder {
|
|
|
451
451
|
}
|
|
452
452
|
if (reflection.indexSignatures) {
|
|
453
453
|
for (const index of reflection.indexSignatures) {
|
|
454
|
-
members.push(nodes(
|
|
454
|
+
members.push(nodes(...(index.flags.isReadonly
|
|
455
|
+
? [
|
|
456
|
+
simpleElement(JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly")),
|
|
457
|
+
space(),
|
|
458
|
+
]
|
|
459
|
+
: []), simpleElement(JSX.createElement("span", { class: "tsd-signature-symbol" }, "[")), simpleElement(JSX.createElement("span", { class: getKindClass(index) }, index.parameters[0].name)), simpleElement(JSX.createElement("span", { class: "tsd-signature-symbol" }, ":")), space(), this.type(index.parameters[0].type, TypeContext.none), simpleElement(JSX.createElement("span", { class: "tsd-signature-symbol" }, "]:")), space(), this.type(index.type, TypeContext.none)));
|
|
455
460
|
}
|
|
456
461
|
}
|
|
457
462
|
if (!members.length && reflection.signatures?.length === 1) {
|
|
@@ -7,7 +7,8 @@ export declare class Outputs {
|
|
|
7
7
|
private defaultOutput;
|
|
8
8
|
constructor(application: Application);
|
|
9
9
|
addOutput(name: string, output: (path: string, project: ProjectReflection) => Promise<void>): void;
|
|
10
|
-
|
|
10
|
+
setDefaultOutputName(name: string): void;
|
|
11
|
+
getOutputSpecs(): OutputSpecification[];
|
|
11
12
|
writeOutputs(project: ProjectReflection): Promise<void>;
|
|
12
13
|
writeOutput(output: OutputSpecification, project: ProjectReflection): Promise<void>;
|
|
13
14
|
}
|
|
@@ -3,12 +3,7 @@ import { nicePath } from "../utils/paths.js";
|
|
|
3
3
|
export class Outputs {
|
|
4
4
|
application;
|
|
5
5
|
outputs = new Map();
|
|
6
|
-
defaultOutput =
|
|
7
|
-
return {
|
|
8
|
-
name: "html",
|
|
9
|
-
path: this.application.options.getValue("out"),
|
|
10
|
-
};
|
|
11
|
-
};
|
|
6
|
+
defaultOutput = "html";
|
|
12
7
|
constructor(application) {
|
|
13
8
|
this.application = application;
|
|
14
9
|
}
|
|
@@ -18,15 +13,24 @@ export class Outputs {
|
|
|
18
13
|
}
|
|
19
14
|
this.outputs.set(name, output);
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
this.defaultOutput =
|
|
16
|
+
setDefaultOutputName(name) {
|
|
17
|
+
this.defaultOutput = name;
|
|
23
18
|
}
|
|
24
|
-
|
|
19
|
+
getOutputSpecs() {
|
|
25
20
|
const options = this.application.options;
|
|
26
21
|
let outputs = [];
|
|
27
22
|
const outputShortcuts = options
|
|
28
23
|
.getDeclarations()
|
|
29
24
|
.filter((decl) => decl.type === ParameterType.Path && decl.outputShortcut);
|
|
25
|
+
// --out is a special case. It isn't marked as a shortcut as what it is
|
|
26
|
+
// a shortcut for may be modified by plugins. However, it is effectively
|
|
27
|
+
// treated as an output shortcut, so check it here.
|
|
28
|
+
if (options.isSet("out")) {
|
|
29
|
+
outputs.push({
|
|
30
|
+
name: this.defaultOutput,
|
|
31
|
+
path: options.getValue("out"),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
30
34
|
for (const shortcut of outputShortcuts) {
|
|
31
35
|
if (options.isSet(shortcut.name)) {
|
|
32
36
|
outputs.push({
|
|
@@ -35,12 +39,21 @@ export class Outputs {
|
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
}
|
|
42
|
+
// If no shortcuts have been defined, use the dedicated outputs option
|
|
38
43
|
if (outputs.length === 0) {
|
|
39
44
|
outputs = options.getValue("outputs") || [];
|
|
40
45
|
}
|
|
46
|
+
// If no outputs have been defined, just write the default output.
|
|
41
47
|
if (!outputs.length) {
|
|
42
|
-
outputs.push(
|
|
48
|
+
outputs.push({
|
|
49
|
+
name: this.defaultOutput,
|
|
50
|
+
path: options.getValue("out"),
|
|
51
|
+
});
|
|
43
52
|
}
|
|
53
|
+
return outputs;
|
|
54
|
+
}
|
|
55
|
+
async writeOutputs(project) {
|
|
56
|
+
const outputs = this.getOutputSpecs();
|
|
44
57
|
for (const output of outputs) {
|
|
45
58
|
await this.writeOutput(output, project);
|
|
46
59
|
}
|
|
@@ -59,7 +72,13 @@ export class Outputs {
|
|
|
59
72
|
}
|
|
60
73
|
const preErrors = this.application.logger.errorCount;
|
|
61
74
|
const start = Date.now();
|
|
62
|
-
|
|
75
|
+
try {
|
|
76
|
+
await writer(output.path, project);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
80
|
+
this.application.logger.error(message);
|
|
81
|
+
}
|
|
63
82
|
if (this.application.logger.errorCount === preErrors) {
|
|
64
83
|
this.application.logger.info(this.application.i18n.output_0_generated_at_1(output.name, nicePath(output.path)));
|
|
65
84
|
}
|
|
@@ -13,6 +13,8 @@ export declare class AssetsPlugin extends RendererComponent {
|
|
|
13
13
|
copy: import("../../internationalization/internationalization.js").TranslatedString;
|
|
14
14
|
copied: import("../../internationalization/internationalization.js").TranslatedString;
|
|
15
15
|
normally_hidden: import("../../internationalization/internationalization.js").TranslatedString;
|
|
16
|
+
hierarchy_expand: import("../../internationalization/internationalization.js").TranslatedString;
|
|
17
|
+
hierarchy_collapse: import("../../internationalization/internationalization.js").TranslatedString;
|
|
16
18
|
};
|
|
17
19
|
private onRenderBegin;
|
|
18
20
|
/**
|
|
@@ -87,6 +87,8 @@ let AssetsPlugin = (() => {
|
|
|
87
87
|
copy: this.application.i18n.theme_copy(),
|
|
88
88
|
copied: this.application.i18n.theme_copied(),
|
|
89
89
|
normally_hidden: this.application.i18n.theme_normally_hidden(),
|
|
90
|
+
hierarchy_expand: this.application.i18n.theme_hierarchy_expand(),
|
|
91
|
+
hierarchy_collapse: this.application.i18n.theme_hierarchy_collapse(),
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
94
|
onRenderBegin(event) {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as Path from "path";
|
|
2
|
+
import { RendererComponent } from "../components.js";
|
|
3
|
+
import { RendererEvent } from "../events.js";
|
|
4
|
+
import { writeFile } from "../../utils/index.js";
|
|
5
|
+
import { DefaultTheme } from "../themes/default/DefaultTheme.js";
|
|
6
|
+
import { gzip } from "zlib";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
import { getHierarchyRoots, getKindClass, getUniquePath, } from "../themes/lib.js";
|
|
9
|
+
const gzipP = promisify(gzip);
|
|
10
|
+
export class HierarchyPlugin extends RendererComponent {
|
|
11
|
+
constructor(renderer) {
|
|
12
|
+
super(renderer);
|
|
13
|
+
this.owner.on(RendererEvent.BEGIN, this.onRendererBegin.bind(this));
|
|
14
|
+
}
|
|
15
|
+
onRendererBegin(_event) {
|
|
16
|
+
if (!(this.owner.theme instanceof DefaultTheme)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.owner.preRenderAsyncJobs.push((event) => this.buildHierarchy(event));
|
|
20
|
+
}
|
|
21
|
+
async buildHierarchy(event) {
|
|
22
|
+
const project = event.project;
|
|
23
|
+
const hierarchy = {
|
|
24
|
+
roots: getHierarchyRoots(project).map((refl) => refl.id),
|
|
25
|
+
reflections: {},
|
|
26
|
+
};
|
|
27
|
+
const queue = [...hierarchy.roots];
|
|
28
|
+
while (queue.length) {
|
|
29
|
+
const id = queue.pop();
|
|
30
|
+
const refl = project.getReflectionById(id);
|
|
31
|
+
if (id in hierarchy.reflections)
|
|
32
|
+
continue;
|
|
33
|
+
if (!refl.url)
|
|
34
|
+
continue;
|
|
35
|
+
const jsonRecord = {
|
|
36
|
+
name: refl.name,
|
|
37
|
+
kind: refl.kind,
|
|
38
|
+
url: refl.url,
|
|
39
|
+
class: getKindClass(refl),
|
|
40
|
+
};
|
|
41
|
+
const path = getUniquePath(refl);
|
|
42
|
+
if (path.length > 1) {
|
|
43
|
+
jsonRecord.uniqueNameParents = path
|
|
44
|
+
.slice(0, -1)
|
|
45
|
+
.map((r) => r.id);
|
|
46
|
+
queue.push(...jsonRecord.uniqueNameParents);
|
|
47
|
+
}
|
|
48
|
+
const children = [
|
|
49
|
+
...(refl.implementedBy || []),
|
|
50
|
+
...(refl.extendedBy || []),
|
|
51
|
+
];
|
|
52
|
+
for (const child of children) {
|
|
53
|
+
if (child.reflection) {
|
|
54
|
+
jsonRecord.children ||= [];
|
|
55
|
+
jsonRecord.children.push(child.reflection.id);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (jsonRecord.children) {
|
|
59
|
+
queue.push(...jsonRecord.children);
|
|
60
|
+
}
|
|
61
|
+
hierarchy.reflections[id] = jsonRecord;
|
|
62
|
+
}
|
|
63
|
+
const hierarchyJs = Path.join(event.outputDirectory, "assets", "hierarchy.js");
|
|
64
|
+
const gz = await gzipP(Buffer.from(JSON.stringify(hierarchy)));
|
|
65
|
+
await writeFile(hierarchyJs, `window.hierarchyData = "data:application/octet-stream;base64,${gz.toString("base64")}"`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { MarkedPlugin } from "../themes/MarkedPlugin.js";
|
|
2
2
|
export { AssetsPlugin } from "./AssetsPlugin.js";
|
|
3
|
+
export { HierarchyPlugin } from "./HierarchyPlugin.js";
|
|
3
4
|
export { IconsPlugin } from "./IconsPlugin.js";
|
|
4
5
|
export { JavascriptIndexPlugin } from "./JavascriptIndexPlugin.js";
|
|
5
6
|
export { NavigationPlugin } from "./NavigationPlugin.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { MarkedPlugin } from "../themes/MarkedPlugin.js";
|
|
2
2
|
export { AssetsPlugin } from "./AssetsPlugin.js";
|
|
3
|
+
export { HierarchyPlugin } from "./HierarchyPlugin.js";
|
|
3
4
|
export { IconsPlugin } from "./IconsPlugin.js";
|
|
4
5
|
export { JavascriptIndexPlugin } from "./JavascriptIndexPlugin.js";
|
|
5
6
|
export { NavigationPlugin } from "./NavigationPlugin.js";
|
|
@@ -49,7 +49,7 @@ import { Option, EventHooks, AbstractComponent } from "../utils/index.js";
|
|
|
49
49
|
import { loadHighlighter } from "../utils/highlighter.js";
|
|
50
50
|
import { Reflection } from "../models/index.js";
|
|
51
51
|
import { setRenderSettings } from "../utils/jsx.js";
|
|
52
|
-
import { AssetsPlugin, IconsPlugin, JavascriptIndexPlugin, MarkedPlugin, NavigationPlugin, SitemapPlugin, } from "./plugins/index.js";
|
|
52
|
+
import { AssetsPlugin, HierarchyPlugin, IconsPlugin, JavascriptIndexPlugin, MarkedPlugin, NavigationPlugin, SitemapPlugin, } from "./plugins/index.js";
|
|
53
53
|
/**
|
|
54
54
|
* The renderer processes a {@link ProjectReflection} using a {@link Theme} instance and writes
|
|
55
55
|
* the emitted html documents to a output directory. You can specify which theme should be used
|
|
@@ -216,6 +216,7 @@ let Renderer = (() => {
|
|
|
216
216
|
this.markedPlugin = new MarkedPlugin(this);
|
|
217
217
|
new AssetsPlugin(this);
|
|
218
218
|
new IconsPlugin(this);
|
|
219
|
+
new HierarchyPlugin(this);
|
|
219
220
|
new JavascriptIndexPlugin(this);
|
|
220
221
|
new NavigationPlugin(this);
|
|
221
222
|
new SitemapPlugin(this);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextAwareRendererComponent } from "../components.js";
|
|
2
2
|
import { MarkdownEvent, RendererEvent, type PageEvent } from "../events.js";
|
|
3
|
-
import type { BundledTheme } from "shiki"
|
|
3
|
+
import type { BundledTheme } from "@gerrit0/mini-shiki";
|
|
4
4
|
import type { DefaultThemeRenderContext, Renderer } from "../index.js";
|
|
5
5
|
import { type CommentDisplayPart } from "../../models/index.js";
|
|
6
6
|
/**
|
|
@@ -172,7 +172,7 @@ let DefaultTheme = (() => {
|
|
|
172
172
|
urls.push(new UrlMapping("modules.html", project, this.reflectionTemplate));
|
|
173
173
|
urls.push(new UrlMapping("index.html", project, this.indexTemplate));
|
|
174
174
|
}
|
|
175
|
-
if (getHierarchyRoots(project).length) {
|
|
175
|
+
if (this.application.options.getValue("includeHierarchySummary") && getHierarchyRoots(project).length) {
|
|
176
176
|
urls.push(new UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
|
|
177
177
|
}
|
|
178
178
|
project.childrenIncludingDocuments?.forEach((child) => this.buildUrls(child, urls));
|
|
@@ -65,7 +65,7 @@ export declare class DefaultThemeRenderContext {
|
|
|
65
65
|
reflectionFlags: (props: Reflection) => import("../../../utils/jsx.elements.js").JsxElement;
|
|
66
66
|
footer: () => import("../../../utils/jsx.elements.js").JsxElement;
|
|
67
67
|
header: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements.js").JsxElement;
|
|
68
|
-
hierarchy: (
|
|
68
|
+
hierarchy: (typeHierarchy: import("../../../models/index.js").DeclarationHierarchy | undefined) => import("../../../utils/jsx.elements.js").JsxElement | undefined;
|
|
69
69
|
index: (props: import("../../../models/index.js").ContainerReflection) => import("../../../utils/jsx.elements.js").JsxElement;
|
|
70
70
|
member: (props: DeclarationReflection | DocumentReflection) => import("../../../utils/jsx.elements.js").JsxElement;
|
|
71
71
|
moduleReflection: (mod: DeclarationReflection | import("../../../models/index.js").ProjectReflection) => import("../../../utils/jsx.elements.js").JsxElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX, Raw } from "../../../../utils/index.js";
|
|
2
|
-
import { getDisplayName } from "../../lib.js";
|
|
2
|
+
import { getDisplayName, getHierarchyRoots } from "../../lib.js";
|
|
3
3
|
import { extname } from "path";
|
|
4
4
|
function favicon(context) {
|
|
5
5
|
const fav = context.options.getValue("favicon");
|
|
@@ -35,7 +35,7 @@ function buildSiteMetadata(context) {
|
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
export const defaultLayout = (context, template, props) => (JSX.createElement("html", { class: "default", lang: context.options.getValue("lang") },
|
|
38
|
+
export const defaultLayout = (context, template, props) => (JSX.createElement("html", { class: "default", lang: context.options.getValue("lang"), "data-base": context.relativeURL("./") },
|
|
39
39
|
JSX.createElement("head", null,
|
|
40
40
|
JSX.createElement("meta", { charset: "utf-8" }),
|
|
41
41
|
context.hook("head.begin", context),
|
|
@@ -55,6 +55,7 @@ export const defaultLayout = (context, template, props) => (JSX.createElement("h
|
|
|
55
55
|
JSX.createElement("script", { async: true, src: context.relativeURL("assets/icons.js", true), id: "tsd-icons-script" }),
|
|
56
56
|
JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js", true), id: "tsd-search-script" }),
|
|
57
57
|
JSX.createElement("script", { async: true, src: context.relativeURL("assets/navigation.js", true), id: "tsd-nav-script" }),
|
|
58
|
+
!!getHierarchyRoots(props.project).length && (JSX.createElement("script", { async: true, src: context.relativeURL("assets/hierarchy.js", true), id: "tsd-hierarchy-script" })),
|
|
58
59
|
context.hook("head.end", context)),
|
|
59
60
|
JSX.createElement("body", null,
|
|
60
61
|
context.hook("body.begin", context),
|
|
@@ -53,7 +53,7 @@ export function commentTags(context, props) {
|
|
|
53
53
|
: context.internationalization.translateTagName(item.tag);
|
|
54
54
|
const anchor = context.slugger.slug(name);
|
|
55
55
|
return (JSX.createElement(JSX.Fragment, null,
|
|
56
|
-
JSX.createElement("div", { class: `tsd-tag-${
|
|
56
|
+
JSX.createElement("div", { class: `tsd-tag-${item.tag.substring(1)}` },
|
|
57
57
|
JSX.createElement("h4", { class: "tsd-anchor-link" },
|
|
58
58
|
JSX.createElement("a", { id: anchor, class: "tsd-anchor" }),
|
|
59
59
|
name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext.js";
|
|
2
2
|
import { JSX } from "../../../../utils/index.js";
|
|
3
3
|
import type { DeclarationHierarchy } from "../../../../models/index.js";
|
|
4
|
-
export declare function hierarchy(context: DefaultThemeRenderContext,
|
|
4
|
+
export declare function hierarchy(context: DefaultThemeRenderContext, typeHierarchy: DeclarationHierarchy | undefined): JSX.Element | undefined;
|
|
@@ -9,22 +9,22 @@ function hasAnyLinkedReferenceType(h) {
|
|
|
9
9
|
return true;
|
|
10
10
|
return hasAnyLinkedReferenceType(h.next);
|
|
11
11
|
}
|
|
12
|
-
export function hierarchy(context,
|
|
13
|
-
if (!
|
|
12
|
+
export function hierarchy(context, typeHierarchy) {
|
|
13
|
+
if (!typeHierarchy)
|
|
14
14
|
return;
|
|
15
|
-
const
|
|
15
|
+
const summaryLink = context.options.getValue("includeHierarchySummary") && hasAnyLinkedReferenceType(typeHierarchy) ? (JSX.createElement(JSX.Fragment, null,
|
|
16
16
|
" ",
|
|
17
17
|
"(",
|
|
18
|
-
JSX.createElement("a", { href: context.relativeURL("hierarchy.html") + "#" + context.page.model.getFullName() }, context.i18n.
|
|
18
|
+
JSX.createElement("a", { href: context.relativeURL("hierarchy.html") + "#" + context.page.model.getFullName() }, context.i18n.theme_hierarchy_view_summary()),
|
|
19
19
|
")")) : (JSX.createElement(JSX.Fragment, null));
|
|
20
|
-
return (JSX.createElement("section", { class: "tsd-panel tsd-hierarchy" },
|
|
20
|
+
return (JSX.createElement("section", { class: "tsd-panel tsd-hierarchy", "data-refl": context.page.model.id },
|
|
21
21
|
JSX.createElement("h4", null,
|
|
22
22
|
context.i18n.theme_hierarchy(),
|
|
23
|
-
|
|
24
|
-
hierarchyList(context,
|
|
23
|
+
summaryLink),
|
|
24
|
+
hierarchyList(context, typeHierarchy)));
|
|
25
25
|
}
|
|
26
26
|
function hierarchyList(context, props) {
|
|
27
|
-
return (JSX.createElement("ul", { class: "tsd-hierarchy" }, props.types.map((item, i, l) => (JSX.createElement("li",
|
|
28
|
-
props.isTarget ? JSX.createElement("span", { class: "target" }, item.toString()) : context.type(item),
|
|
27
|
+
return (JSX.createElement("ul", { class: "tsd-hierarchy" }, props.types.map((item, i, l) => (JSX.createElement("li", { class: "tsd-hierarchy-item" },
|
|
28
|
+
props.isTarget ? JSX.createElement("span", { class: "tsd-hierarchy-target" }, item.toString()) : context.type(item),
|
|
29
29
|
i === l.length - 1 && !!props.next && hierarchyList(context, props.next))))));
|
|
30
30
|
}
|
|
@@ -67,7 +67,7 @@ export function settings(context) {
|
|
|
67
67
|
export const navigation = function navigation(context, props) {
|
|
68
68
|
return (JSX.createElement("nav", { class: "tsd-navigation" },
|
|
69
69
|
JSX.createElement("a", { href: context.urlTo(props.project), class: classNames({ current: props.project === props.model }) }, getDisplayName(props.project)),
|
|
70
|
-
JSX.createElement("ul", { class: "tsd-small-nested-navigation", id: "tsd-nav-container"
|
|
70
|
+
JSX.createElement("ul", { class: "tsd-small-nested-navigation", id: "tsd-nav-container" },
|
|
71
71
|
JSX.createElement("li", null, context.i18n.theme_loading()))));
|
|
72
72
|
};
|
|
73
73
|
export function pageSidebar(context, props) {
|
|
@@ -2,7 +2,7 @@ import { JSX } from "../../../../utils/index.js";
|
|
|
2
2
|
import { getDisplayName } from "../../lib.js";
|
|
3
3
|
export const toolbar = (context, props) => (JSX.createElement("header", { class: "tsd-page-toolbar" },
|
|
4
4
|
JSX.createElement("div", { class: "tsd-toolbar-contents container" },
|
|
5
|
-
JSX.createElement("div", { class: "table-cell", id: "tsd-search"
|
|
5
|
+
JSX.createElement("div", { class: "table-cell", id: "tsd-search" },
|
|
6
6
|
JSX.createElement("div", { class: "field" },
|
|
7
7
|
JSX.createElement("label", { for: "tsd-search-field", class: "tsd-widget tsd-toolbar-icon search no-caption" }, context.icons.search()),
|
|
8
8
|
JSX.createElement("input", { type: "text", id: "tsd-search-field", "aria-label": context.i18n.theme_search() })),
|
|
@@ -192,6 +192,7 @@ function renderChild(context, child, renderAnchors, highlight) {
|
|
|
192
192
|
function renderIndexSignature(context, index) {
|
|
193
193
|
return (JSX.createElement("li", { class: "tsd-parameter-index-signature" },
|
|
194
194
|
JSX.createElement("h5", null,
|
|
195
|
+
index.flags.isReadonly && JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly "),
|
|
195
196
|
JSX.createElement("span", { class: "tsd-signature-symbol" }, "["),
|
|
196
197
|
index.parameters.map((item) => (JSX.createElement(JSX.Fragment, null,
|
|
197
198
|
JSX.createElement("span", { class: getKindClass(item) }, item.name),
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import { JSX } from "../../../../utils/index.js";
|
|
2
2
|
import { getHierarchyRoots } from "../../lib.js";
|
|
3
|
-
function fullHierarchy(context, root, seen
|
|
4
|
-
if (seen.has(root))
|
|
5
|
-
return
|
|
3
|
+
function fullHierarchy(context, root, seen) {
|
|
4
|
+
if (seen.has(root)) {
|
|
5
|
+
return (JSX.createElement("li", { "data-refl": root.id },
|
|
6
|
+
JSX.createElement("a", { href: context.urlTo(root) },
|
|
7
|
+
context.icons[root.kind](),
|
|
8
|
+
root.name)));
|
|
9
|
+
}
|
|
6
10
|
seen.add(root);
|
|
11
|
+
const children = [];
|
|
12
|
+
for (const child of [...(root.implementedBy || []), ...(root.extendedBy || [])]) {
|
|
13
|
+
if (child.reflection) {
|
|
14
|
+
children.push(fullHierarchy(context, child.reflection, seen));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
7
17
|
// Note: We don't use root.anchor for the anchor, because those are built on a per page basis.
|
|
8
18
|
// And classes/interfaces get their own page, so all the anchors will be empty anyways.
|
|
9
19
|
// Full name should be safe here, since this list only includes classes/interfaces.
|
|
10
|
-
return (JSX.createElement("li",
|
|
20
|
+
return (JSX.createElement("li", { "data-refl": root.id },
|
|
11
21
|
JSX.createElement("a", { id: root.getFullName(), class: "tsd-anchor" }),
|
|
12
22
|
JSX.createElement("a", { href: context.urlTo(root) },
|
|
13
23
|
context.icons[root.kind](),
|
|
14
24
|
root.name),
|
|
15
|
-
JSX.createElement("ul", null,
|
|
16
|
-
root.implementedBy?.map((child) => {
|
|
17
|
-
return child.reflection && fullHierarchy(context, child.reflection, seen);
|
|
18
|
-
}),
|
|
19
|
-
root.extendedBy?.map((child) => {
|
|
20
|
-
return child.reflection && fullHierarchy(context, child.reflection, seen);
|
|
21
|
-
}))));
|
|
25
|
+
children.length && JSX.createElement("ul", null, children)));
|
|
22
26
|
}
|
|
23
27
|
export function hierarchyTemplate(context, props) {
|
|
28
|
+
const seen = new Set();
|
|
24
29
|
return (JSX.createElement(JSX.Fragment, null,
|
|
25
|
-
JSX.createElement("h2", null, context.i18n.
|
|
26
|
-
getHierarchyRoots(props.project).map((root) => (JSX.createElement("ul", { class: "tsd-full-hierarchy" }, fullHierarchy(context, root))))));
|
|
30
|
+
JSX.createElement("h2", null, context.i18n.theme_hierarchy_summary()),
|
|
31
|
+
getHierarchyRoots(props.project).map((root) => (JSX.createElement("ul", { class: "tsd-full-hierarchy" }, fullHierarchy(context, root, seen))))));
|
|
27
32
|
}
|
|
@@ -38,6 +38,7 @@ export function reflectionTemplate(context, props) {
|
|
|
38
38
|
function renderIndexSignature(context, index) {
|
|
39
39
|
return (JSX.createElement("li", { class: "tsd-index-signature" },
|
|
40
40
|
JSX.createElement("div", { class: "tsd-signature" },
|
|
41
|
+
index.flags.isReadonly && JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly "),
|
|
41
42
|
JSX.createElement("span", { class: "tsd-signature-symbol" }, "["),
|
|
42
43
|
index.parameters.map((item) => (JSX.createElement(JSX.Fragment, null,
|
|
43
44
|
JSX.createElement("span", { class: getKindClass(item) }, item.name),
|