typedoc 0.26.11 → 0.27.0-beta.0
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/bin/package.json +3 -0
- package/bin/typedoc +1 -1
- package/dist/index.d.ts +23 -13
- package/dist/index.js +22 -81
- package/dist/lib/application-events.js +1 -4
- package/dist/lib/application.d.ts +26 -16
- package/dist/lib/application.js +222 -242
- package/dist/lib/cli.js +3 -40
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +24 -30
- package/dist/lib/converter/comments/declarationReference.js +10 -21
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
- package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
- package/dist/lib/converter/comments/discovery.d.ts +4 -4
- package/dist/lib/converter/comments/discovery.js +154 -172
- package/dist/lib/converter/comments/index.d.ts +4 -4
- package/dist/lib/converter/comments/index.js +39 -50
- package/dist/lib/converter/comments/lexer.d.ts +1 -1
- package/dist/lib/converter/comments/lexer.js +2 -5
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +12 -15
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +14 -21
- package/dist/lib/converter/comments/parser.d.ts +6 -6
- package/dist/lib/converter/comments/parser.js +69 -96
- package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
- package/dist/lib/converter/comments/rawLexer.js +13 -16
- package/dist/lib/converter/comments/tagName.js +1 -4
- package/dist/lib/converter/comments/textParser.d.ts +4 -4
- package/dist/lib/converter/comments/textParser.js +28 -30
- package/dist/lib/converter/components.d.ts +2 -3
- package/dist/lib/converter/components.js +2 -7
- package/dist/lib/converter/context.d.ts +9 -9
- package/dist/lib/converter/context.js +54 -44
- package/dist/lib/converter/convert-expression.js +16 -23
- package/dist/lib/converter/converter-events.d.ts +1 -0
- package/dist/lib/converter/converter-events.js +2 -4
- package/dist/lib/converter/converter.d.ts +16 -13
- package/dist/lib/converter/converter.js +210 -238
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +11 -17
- package/dist/lib/converter/factories/signature.d.ts +2 -2
- package/dist/lib/converter/factories/signature.js +95 -106
- package/dist/lib/converter/index.d.ts +6 -7
- package/dist/lib/converter/index.js +3 -11
- package/dist/lib/converter/jsdoc.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +34 -41
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
- package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
- package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
- package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
- package/dist/lib/converter/plugins/TypePlugin.js +95 -158
- package/dist/lib/converter/plugins/index.d.ts +10 -9
- package/dist/lib/converter/plugins/index.js +10 -21
- package/dist/lib/converter/symbols.d.ts +1 -1
- package/dist/lib/converter/symbols.js +234 -227
- package/dist/lib/converter/types.d.ts +2 -2
- package/dist/lib/converter/types.js +252 -237
- package/dist/lib/converter/utils/nodes.js +5 -13
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +4 -7
- package/dist/lib/converter/utils/repository.d.ts +1 -1
- package/dist/lib/converter/utils/repository.js +103 -97
- package/dist/lib/converter/utils/symbols.js +3 -9
- package/dist/lib/internationalization/index.d.ts +3 -4
- package/dist/lib/internationalization/index.js +3 -8
- package/dist/lib/internationalization/internationalization.d.ts +5 -4
- package/dist/lib/internationalization/internationalization.js +97 -103
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/en.cjs +366 -2
- package/dist/lib/internationalization/locales/en.d.cts +339 -2
- package/dist/lib/internationalization/locales/jp.cjs +8 -11
- package/dist/lib/internationalization/locales/jp.d.cts +310 -1
- package/dist/lib/internationalization/locales/ko.cjs +7 -9
- package/dist/lib/internationalization/locales/ko.d.cts +223 -1
- package/dist/lib/internationalization/locales/zh.cjs +7 -10
- package/dist/lib/internationalization/locales/zh.d.cts +381 -1
- package/dist/lib/internationalization/translatable.d.ts +4 -327
- package/dist/lib/internationalization/translatable.js +2 -360
- package/dist/lib/models/FileRegistry.d.ts +20 -9
- package/dist/lib/models/FileRegistry.js +54 -45
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionCategory.js +16 -12
- package/dist/lib/models/ReflectionGroup.d.ts +3 -3
- package/dist/lib/models/ReflectionGroup.js +23 -14
- package/dist/lib/models/comments/comment.d.ts +23 -37
- package/dist/lib/models/comments/comment.js +388 -325
- package/dist/lib/models/comments/index.d.ts +2 -2
- package/dist/lib/models/comments/index.js +1 -6
- package/dist/lib/models/index.d.ts +7 -7
- package/dist/lib/models/index.js +7 -23
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
- package/dist/lib/models/reflections/abstract.d.ts +17 -20
- package/dist/lib/models/reflections/abstract.js +249 -256
- package/dist/lib/models/reflections/container.d.ts +7 -7
- package/dist/lib/models/reflections/container.js +43 -16
- package/dist/lib/models/reflections/declaration.d.ts +15 -12
- package/dist/lib/models/reflections/declaration.js +150 -29
- package/dist/lib/models/reflections/document.d.ts +3 -3
- package/dist/lib/models/reflections/document.js +26 -13
- package/dist/lib/models/reflections/index.d.ts +15 -15
- package/dist/lib/models/reflections/index.js +12 -31
- package/dist/lib/models/reflections/kind.d.ts +1 -1
- package/dist/lib/models/reflections/kind.js +3 -6
- package/dist/lib/models/reflections/parameter.d.ts +5 -4
- package/dist/lib/models/reflections/parameter.js +11 -13
- package/dist/lib/models/reflections/project.d.ts +14 -9
- package/dist/lib/models/reflections/project.js +104 -56
- package/dist/lib/models/reflections/reference.d.ts +3 -3
- package/dist/lib/models/reflections/reference.js +6 -9
- package/dist/lib/models/reflections/signature.d.ts +8 -8
- package/dist/lib/models/reflections/signature.js +35 -14
- package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
- package/dist/lib/models/reflections/type-parameter.js +9 -10
- package/dist/lib/models/reflections/utils.js +1 -4
- package/dist/lib/models/reflections/variant.d.ts +8 -7
- package/dist/lib/models/reflections/variant.js +1 -2
- package/dist/lib/models/sources/file.d.ts +2 -2
- package/dist/lib/models/sources/file.js +22 -5
- package/dist/lib/models/sources/index.d.ts +1 -1
- package/dist/lib/models/sources/index.js +1 -5
- package/dist/lib/models/types.d.ts +26 -13
- package/dist/lib/models/types.js +236 -151
- package/dist/lib/output/components.d.ts +5 -11
- package/dist/lib/output/components.js +84 -125
- package/dist/lib/output/events.d.ts +3 -3
- package/dist/lib/output/events.js +128 -94
- package/dist/lib/output/formatter.d.ts +84 -0
- package/dist/lib/output/formatter.js +619 -0
- package/dist/lib/output/index.d.ts +9 -8
- package/dist/lib/output/index.js +7 -19
- package/dist/lib/output/models/UrlMapping.d.ts +2 -2
- package/dist/lib/output/models/UrlMapping.js +4 -5
- package/dist/lib/output/output.d.ts +13 -0
- package/dist/lib/output/output.js +72 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +7 -8
- package/dist/lib/output/plugins/AssetsPlugin.js +62 -80
- package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/IconsPlugin.js +28 -84
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
- package/dist/lib/output/plugins/index.d.ts +6 -6
- package/dist/lib/output/plugins/index.js +6 -15
- package/dist/lib/output/renderer.d.ts +14 -13
- package/dist/lib/output/renderer.js +129 -185
- package/dist/lib/output/theme.d.ts +9 -5
- package/dist/lib/output/theme.js +14 -62
- package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
- package/dist/lib/output/themes/MarkedPlugin.js +152 -117
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
- package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +46 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
- package/dist/lib/output/themes/default/layouts/default.js +47 -36
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
- package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
- package/dist/lib/output/themes/default/partials/comment.js +52 -29
- package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/footer.js +11 -14
- package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/header.js +9 -13
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/hierarchy.js +9 -12
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/icon.js +78 -73
- package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/index.js +19 -22
- package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
- package/dist/lib/output/themes/default/partials/member.js +19 -24
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
- package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
- package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/members.js +10 -42
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/navigation.js +51 -62
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
- package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
- package/dist/lib/output/themes/default/partials/type.js +8 -388
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +221 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
- package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/document.js +3 -7
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/hierarchy.js +10 -13
- package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/index.js +3 -7
- package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/reflection.js +31 -34
- package/dist/lib/output/themes/lib.d.ts +17 -3
- package/dist/lib/output/themes/lib.js +110 -49
- package/dist/lib/serialization/components.d.ts +2 -5
- package/dist/lib/serialization/components.js +1 -2
- package/dist/lib/serialization/deserializer.d.ts +21 -7
- package/dist/lib/serialization/deserializer.js +138 -123
- package/dist/lib/serialization/events.d.ts +2 -2
- package/dist/lib/serialization/events.js +6 -5
- package/dist/lib/serialization/index.d.ts +5 -5
- package/dist/lib/serialization/index.js +4 -33
- package/dist/lib/serialization/schema.d.ts +8 -2
- package/dist/lib/serialization/schema.js +2 -2
- package/dist/lib/serialization/serializer.d.ts +11 -5
- package/dist/lib/serialization/serializer.js +32 -25
- package/dist/lib/utils/array.d.ts +3 -0
- package/dist/lib/utils/array.js +26 -27
- package/dist/lib/utils/component.d.ts +2 -44
- package/dist/lib/utils/component.js +10 -102
- package/dist/lib/utils/entry-point.d.ts +3 -4
- package/dist/lib/utils/entry-point.js +114 -85
- package/dist/lib/utils/enum.js +6 -14
- package/dist/lib/utils/events.js +6 -12
- package/dist/lib/utils/fs.js +50 -91
- package/dist/lib/utils/general.d.ts +2 -1
- package/dist/lib/utils/general.js +50 -40
- package/dist/lib/utils/highlighter.js +30 -57
- package/dist/lib/utils/hooks.js +7 -13
- package/dist/lib/utils/html-entities.d.ts +8926 -0
- package/dist/lib/utils/html-entities.js +2329 -0
- package/dist/lib/utils/html.d.ts +8 -0
- package/dist/lib/utils/html.js +81 -34
- package/dist/lib/utils/index.d.ts +22 -22
- package/dist/lib/utils/index.js +20 -91
- package/dist/lib/utils/jsx.d.ts +12 -5
- package/dist/lib/utils/jsx.elements.js +1 -4
- package/dist/lib/utils/jsx.js +53 -20
- package/dist/lib/utils/loggers.d.ts +3 -3
- package/dist/lib/utils/loggers.js +36 -46
- package/dist/lib/utils/map.js +6 -13
- package/dist/lib/utils/minimalSourceFile.js +5 -7
- package/dist/lib/utils/options/declaration.d.ts +33 -7
- package/dist/lib/utils/options/declaration.js +20 -22
- package/dist/lib/utils/options/defaults.d.ts +3 -2
- package/dist/lib/utils/options/defaults.js +18 -38
- package/dist/lib/utils/options/help.d.ts +2 -2
- package/dist/lib/utils/options/help.js +7 -10
- package/dist/lib/utils/options/index.d.ts +6 -6
- package/dist/lib/utils/options/index.js +4 -18
- package/dist/lib/utils/options/options.d.ts +8 -5
- package/dist/lib/utils/options/options.js +47 -71
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
- package/dist/lib/utils/options/readers/arguments.js +15 -17
- package/dist/lib/utils/options/readers/index.d.ts +4 -4
- package/dist/lib/utils/options/readers/index.js +4 -11
- package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
- package/dist/lib/utils/options/readers/package-json.js +15 -21
- package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +54 -63
- package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
- package/dist/lib/utils/options/readers/typedoc.js +44 -76
- package/dist/lib/utils/options/sources/index.d.ts +1 -1
- package/dist/lib/utils/options/sources/index.js +1 -5
- package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/sources/typedoc.js +220 -196
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
- package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +15 -19
- package/dist/lib/utils/paths.js +9 -15
- package/dist/lib/utils/perf.js +6 -11
- package/dist/lib/utils/plugins.d.ts +1 -1
- package/dist/lib/utils/plugins.js +7 -10
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +9 -12
- package/dist/lib/utils/set.js +2 -6
- package/dist/lib/utils/sort.d.ts +3 -3
- package/dist/lib/utils/sort.js +20 -24
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +13 -21
- package/dist/lib/utils/tsutils.d.ts +1 -1
- package/dist/lib/utils/tsutils.js +3 -30
- package/dist/lib/utils/validation.js +6 -12
- package/dist/lib/validation/documentation.d.ts +2 -2
- package/dist/lib/validation/documentation.js +26 -29
- package/dist/lib/validation/exports.d.ts +2 -2
- package/dist/lib/validation/exports.js +9 -11
- package/dist/lib/validation/links.d.ts +2 -2
- package/dist/lib/validation/links.js +4 -7
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
- package/package.json +14 -11
- package/static/main.js +4 -4
- package/static/style.css +91 -2
- package/tsdoc.json +30 -0
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
- package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/parameter.js +0 -79
- package/dist/lib/utils/html-entities.json +0 -2326
|
@@ -1,67 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
// remove html tags
|
|
24
|
-
.replace(/<[!/a-z].*?>/gi, "")
|
|
25
|
-
// remove unwanted chars
|
|
26
|
-
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "")
|
|
27
|
-
.replace(/\s/g, "-"));
|
|
28
|
-
}
|
|
29
|
-
slug(value) {
|
|
30
|
-
const originalSlug = this.serialize(value);
|
|
31
|
-
let slug = originalSlug;
|
|
32
|
-
let count = 0;
|
|
33
|
-
if (this.seen.has(slug)) {
|
|
34
|
-
count = this.seen.get(originalSlug);
|
|
35
|
-
do {
|
|
36
|
-
count++;
|
|
37
|
-
slug = `${originalSlug}-${count}`;
|
|
38
|
-
} while (this.seen.has(slug));
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
39
23
|
}
|
|
40
|
-
this.seen.set(originalSlug, count);
|
|
41
|
-
this.seen.set(slug, 0);
|
|
42
|
-
return slug;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.Slugger = Slugger;
|
|
46
|
-
/**
|
|
47
|
-
* Default theme implementation of TypeDoc. If a theme does not provide a custom
|
|
48
|
-
* {@link Theme} implementation, this theme class will be used.
|
|
49
|
-
*/
|
|
50
|
-
class DefaultTheme extends theme_1.Theme {
|
|
51
|
-
getRenderContext(pageEvent) {
|
|
52
|
-
return new DefaultThemeRenderContext_1.DefaultThemeRenderContext(this, pageEvent, this.application.options);
|
|
53
24
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
57
32
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { Theme } from "../../theme.js";
|
|
36
|
+
import { ReflectionKind, ProjectReflection, DeclarationReflection, SignatureReflection, ReflectionCategory, ReflectionGroup, TypeParameterReflection, ReferenceReflection, } from "../../../models/index.js";
|
|
37
|
+
import { UrlMapping } from "../../models/UrlMapping.js";
|
|
38
|
+
import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext.js";
|
|
39
|
+
import { filterMap, JSX, Option } from "../../../utils/index.js";
|
|
40
|
+
import { classNames, getDisplayName, getHierarchyRoots, toStyleClass } from "../lib.js";
|
|
41
|
+
import { icons } from "./partials/icon.js";
|
|
42
|
+
import { Slugger } from "./Slugger.js";
|
|
43
|
+
import { createNormalizedUrl } from "../../../utils/html.js";
|
|
44
|
+
let DefaultTheme = (() => {
|
|
45
|
+
let _classSuper = Theme;
|
|
46
|
+
let _sluggerConfiguration_decorators;
|
|
47
|
+
let _sluggerConfiguration_initializers = [];
|
|
48
|
+
let _sluggerConfiguration_extraInitializers = [];
|
|
49
|
+
return class DefaultTheme extends _classSuper {
|
|
50
|
+
static {
|
|
51
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
52
|
+
_sluggerConfiguration_decorators = [Option("sluggerConfiguration")];
|
|
53
|
+
__esDecorate(this, null, _sluggerConfiguration_decorators, { kind: "accessor", name: "sluggerConfiguration", static: false, private: false, access: { has: obj => "sluggerConfiguration" in obj, get: obj => obj.sluggerConfiguration, set: (obj, value) => { obj.sluggerConfiguration = value; } }, metadata: _metadata }, _sluggerConfiguration_initializers, _sluggerConfiguration_extraInitializers);
|
|
54
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
55
|
+
}
|
|
56
|
+
// Note: This will always contain lowercased names to avoid issues with
|
|
57
|
+
// case-insensitive file systems.
|
|
58
|
+
usedFileNames = new Set();
|
|
59
|
+
#sluggerConfiguration_accessor_storage = __runInitializers(this, _sluggerConfiguration_initializers, void 0);
|
|
60
|
+
get sluggerConfiguration() { return this.#sluggerConfiguration_accessor_storage; }
|
|
61
|
+
set sluggerConfiguration(value) { this.#sluggerConfiguration_accessor_storage = value; }
|
|
62
|
+
/** @internal */
|
|
63
|
+
markedPlugin = __runInitializers(this, _sluggerConfiguration_extraInitializers);
|
|
65
64
|
/**
|
|
66
65
|
* The icons which will actually be rendered. The source of truth lives on the theme, and
|
|
67
66
|
* the {@link DefaultThemeRenderContext.icons} member will produce references to these.
|
|
@@ -75,324 +74,349 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
75
74
|
* the icons used within the page, however TypeDoc currently assumes that all icons are svg
|
|
76
75
|
* elements, so custom themes must also use svg elements.
|
|
77
76
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
icons = { ...icons };
|
|
78
|
+
getRenderContext(pageEvent) {
|
|
79
|
+
return new DefaultThemeRenderContext(this, pageEvent, this.application.options);
|
|
80
|
+
}
|
|
81
|
+
documentTemplate = (pageEvent) => {
|
|
80
82
|
return this.getRenderContext(pageEvent).documentTemplate(pageEvent);
|
|
81
83
|
};
|
|
82
|
-
|
|
84
|
+
reflectionTemplate = (pageEvent) => {
|
|
83
85
|
return this.getRenderContext(pageEvent).reflectionTemplate(pageEvent);
|
|
84
86
|
};
|
|
85
|
-
|
|
87
|
+
indexTemplate = (pageEvent) => {
|
|
86
88
|
return this.getRenderContext(pageEvent).indexTemplate(pageEvent);
|
|
87
89
|
};
|
|
88
|
-
|
|
90
|
+
hierarchyTemplate = (pageEvent) => {
|
|
89
91
|
return this.getRenderContext(pageEvent).hierarchyTemplate(pageEvent);
|
|
90
92
|
};
|
|
91
|
-
|
|
93
|
+
defaultLayoutTemplate = (pageEvent, template) => {
|
|
92
94
|
return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
|
|
93
95
|
};
|
|
96
|
+
getReflectionClasses(reflection) {
|
|
97
|
+
const filters = this.application.options.getValue("visibilityFilters");
|
|
98
|
+
return getReflectionClasses(reflection, filters);
|
|
99
|
+
}
|
|
94
100
|
/**
|
|
95
101
|
* Mappings of reflections kinds to templates used by this theme.
|
|
96
102
|
*/
|
|
97
|
-
|
|
103
|
+
mappings = [
|
|
98
104
|
{
|
|
99
|
-
kind: [
|
|
105
|
+
kind: [ReflectionKind.Class],
|
|
100
106
|
directory: "classes",
|
|
101
107
|
template: this.reflectionTemplate,
|
|
102
108
|
},
|
|
103
109
|
{
|
|
104
|
-
kind: [
|
|
110
|
+
kind: [ReflectionKind.Interface],
|
|
105
111
|
directory: "interfaces",
|
|
106
112
|
template: this.reflectionTemplate,
|
|
107
113
|
},
|
|
108
114
|
{
|
|
109
|
-
kind: [
|
|
115
|
+
kind: [ReflectionKind.Enum],
|
|
110
116
|
directory: "enums",
|
|
111
117
|
template: this.reflectionTemplate,
|
|
112
118
|
},
|
|
113
119
|
{
|
|
114
|
-
kind: [
|
|
120
|
+
kind: [ReflectionKind.Namespace, ReflectionKind.Module],
|
|
115
121
|
directory: "modules",
|
|
116
122
|
template: this.reflectionTemplate,
|
|
117
123
|
},
|
|
118
124
|
{
|
|
119
|
-
kind: [
|
|
125
|
+
kind: [ReflectionKind.TypeAlias],
|
|
120
126
|
directory: "types",
|
|
121
127
|
template: this.reflectionTemplate,
|
|
122
128
|
},
|
|
123
129
|
{
|
|
124
|
-
kind: [
|
|
130
|
+
kind: [ReflectionKind.Function],
|
|
125
131
|
directory: "functions",
|
|
126
132
|
template: this.reflectionTemplate,
|
|
127
133
|
},
|
|
128
134
|
{
|
|
129
|
-
kind: [
|
|
135
|
+
kind: [ReflectionKind.Variable],
|
|
130
136
|
directory: "variables",
|
|
131
137
|
template: this.reflectionTemplate,
|
|
132
138
|
},
|
|
133
139
|
{
|
|
134
|
-
kind: [
|
|
140
|
+
kind: [ReflectionKind.Document],
|
|
135
141
|
directory: "documents",
|
|
136
142
|
template: this.documentTemplate,
|
|
137
143
|
},
|
|
138
144
|
];
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*/
|
|
149
|
-
getUrls(project) {
|
|
150
|
-
const urls = [];
|
|
151
|
-
this.sluggers.set(project, new Slugger());
|
|
152
|
-
if (!project.readme?.length) {
|
|
153
|
-
project.url = "index.html";
|
|
154
|
-
urls.push(new UrlMapping_1.UrlMapping("index.html", project, this.reflectionTemplate));
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
project.url = "modules.html";
|
|
158
|
-
urls.push(new UrlMapping_1.UrlMapping("modules.html", project, this.reflectionTemplate));
|
|
159
|
-
urls.push(new UrlMapping_1.UrlMapping("index.html", project, this.indexTemplate));
|
|
160
|
-
}
|
|
161
|
-
if ((0, lib_1.getHierarchyRoots)(project).length) {
|
|
162
|
-
urls.push(new UrlMapping_1.UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
|
|
145
|
+
static URL_PREFIX = /^(http|ftp)s?:\/\//;
|
|
146
|
+
/**
|
|
147
|
+
* Create a new DefaultTheme instance.
|
|
148
|
+
*
|
|
149
|
+
* @param renderer The renderer this theme is attached to.
|
|
150
|
+
*/
|
|
151
|
+
constructor(renderer) {
|
|
152
|
+
super(renderer);
|
|
153
|
+
this.markedPlugin = renderer.markedPlugin;
|
|
163
154
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Map the models of the given project to the desired output files.
|
|
157
|
+
*
|
|
158
|
+
* @param project The project whose urls should be generated.
|
|
159
|
+
* @returns A list of {@link UrlMapping} instances defining which models
|
|
160
|
+
* should be rendered to which files.
|
|
161
|
+
*/
|
|
162
|
+
getUrls(project) {
|
|
163
|
+
this.usedFileNames = new Set();
|
|
164
|
+
const urls = [];
|
|
165
|
+
this.setSlugger(project, new Slugger(this.sluggerConfiguration));
|
|
166
|
+
if (!project.readme?.length) {
|
|
167
|
+
project.url = "index.html";
|
|
168
|
+
urls.push(new UrlMapping("index.html", project, this.reflectionTemplate));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
project.url = "modules.html";
|
|
172
|
+
urls.push(new UrlMapping("modules.html", project, this.reflectionTemplate));
|
|
173
|
+
urls.push(new UrlMapping("index.html", project, this.indexTemplate));
|
|
174
|
+
}
|
|
175
|
+
if (getHierarchyRoots(project).length) {
|
|
176
|
+
urls.push(new UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
|
|
177
|
+
}
|
|
178
|
+
project.childrenIncludingDocuments?.forEach((child) => this.buildUrls(child, urls));
|
|
179
|
+
return urls;
|
|
179
180
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
getMapping(reflection) {
|
|
189
|
-
return this.mappings.find((mapping) => reflection.kindOf(mapping.kind));
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Build the url for the the given reflection and all of its children.
|
|
193
|
-
*
|
|
194
|
-
* @param reflection The reflection the url should be created for.
|
|
195
|
-
* @param urls The array the url should be appended to.
|
|
196
|
-
* @returns The altered urls array.
|
|
197
|
-
*/
|
|
198
|
-
buildUrls(reflection, urls) {
|
|
199
|
-
const mapping = this.getMapping(reflection);
|
|
200
|
-
if (mapping) {
|
|
201
|
-
if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
|
|
202
|
-
const url = [mapping.directory, DefaultTheme.getUrl(reflection) + ".html"].join("/");
|
|
203
|
-
urls.push(new UrlMapping_1.UrlMapping(url, reflection, mapping.template));
|
|
204
|
-
this.sluggers.set(reflection, new Slugger());
|
|
205
|
-
reflection.url = url;
|
|
206
|
-
reflection.hasOwnDocument = true;
|
|
181
|
+
/**
|
|
182
|
+
* @param reflection The reflection the url should be generated for.
|
|
183
|
+
*/
|
|
184
|
+
getFileName(reflection) {
|
|
185
|
+
const parts = [createNormalizedUrl(reflection.name)];
|
|
186
|
+
while (reflection.parent && !reflection.parent.isProject()) {
|
|
187
|
+
reflection = reflection.parent;
|
|
188
|
+
parts.unshift(createNormalizedUrl(reflection.name));
|
|
207
189
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
190
|
+
const baseName = parts.join(".");
|
|
191
|
+
const lowerBaseName = baseName.toLocaleLowerCase();
|
|
192
|
+
if (this.usedFileNames.has(lowerBaseName)) {
|
|
193
|
+
let index = 1;
|
|
194
|
+
while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
|
|
195
|
+
++index;
|
|
211
196
|
}
|
|
212
|
-
|
|
213
|
-
|
|
197
|
+
this.usedFileNames.add(`${lowerBaseName}-${index}`);
|
|
198
|
+
return `${baseName}-${index}.html`;
|
|
199
|
+
}
|
|
200
|
+
this.usedFileNames.add(lowerBaseName);
|
|
201
|
+
return `${baseName}.html`;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Return the template mapping for the given reflection.
|
|
205
|
+
*
|
|
206
|
+
* @param reflection The reflection whose mapping should be resolved.
|
|
207
|
+
* @returns The found mapping or undefined if no mapping could be found.
|
|
208
|
+
*/
|
|
209
|
+
getMapping(reflection) {
|
|
210
|
+
return this.mappings.find((mapping) => reflection.kindOf(mapping.kind));
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Build the url for the the given reflection and all of its children.
|
|
214
|
+
*
|
|
215
|
+
* @param reflection The reflection the url should be created for.
|
|
216
|
+
* @param urls The array the url should be appended to.
|
|
217
|
+
* @returns The altered urls array.
|
|
218
|
+
*/
|
|
219
|
+
buildUrls(reflection, urls) {
|
|
220
|
+
const mapping = this.getMapping(reflection);
|
|
221
|
+
if (mapping) {
|
|
222
|
+
if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
|
|
223
|
+
const url = [mapping.directory, this.getFileName(reflection)].join("/");
|
|
224
|
+
urls.push(new UrlMapping(url, reflection, mapping.template));
|
|
225
|
+
this.setSlugger(reflection, new Slugger(this.sluggerConfiguration));
|
|
226
|
+
reflection.url = url;
|
|
227
|
+
reflection.hasOwnDocument = true;
|
|
214
228
|
}
|
|
215
|
-
|
|
216
|
-
|
|
229
|
+
reflection.traverse((child) => {
|
|
230
|
+
if (child.isDeclaration() || child.isDocument()) {
|
|
231
|
+
this.buildUrls(child, urls);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.applyAnchorUrl(child, reflection);
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
else if (reflection.parent) {
|
|
240
|
+
this.applyAnchorUrl(reflection, reflection.parent);
|
|
241
|
+
}
|
|
242
|
+
return urls;
|
|
217
243
|
}
|
|
218
|
-
|
|
219
|
-
|
|
244
|
+
render(page, template) {
|
|
245
|
+
const templateOutput = this.defaultLayoutTemplate(page, template);
|
|
246
|
+
return "<!DOCTYPE html>" + JSX.renderElement(templateOutput) + "\n";
|
|
220
247
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
// Might need to change in the future, but it's fine for now.
|
|
233
|
-
if (this._navigationCache) {
|
|
234
|
-
return this._navigationCache;
|
|
248
|
+
_navigationCache;
|
|
249
|
+
/**
|
|
250
|
+
* If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
|
|
251
|
+
*/
|
|
252
|
+
getNavigation(project) {
|
|
253
|
+
// This is ok because currently TypeDoc wipes out the theme after each render.
|
|
254
|
+
// Might need to change in the future, but it's fine for now.
|
|
255
|
+
if (this._navigationCache) {
|
|
256
|
+
return this._navigationCache;
|
|
257
|
+
}
|
|
258
|
+
return (this._navigationCache = this.buildNavigation(project));
|
|
235
259
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
function toNavigation(element) {
|
|
245
|
-
const children = getNavigationElements(element);
|
|
246
|
-
if (element instanceof models_1.ReflectionCategory || element instanceof models_1.ReflectionGroup) {
|
|
247
|
-
if (!children?.length) {
|
|
260
|
+
buildNavigation(project) {
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
262
|
+
const theme = this;
|
|
263
|
+
const opts = this.application.options.getValue("navigation");
|
|
264
|
+
const leaves = this.application.options.getValue("navigationLeaves");
|
|
265
|
+
return getNavigationElements(project) || [];
|
|
266
|
+
function toNavigation(element) {
|
|
267
|
+
if (opts.excludeReferences && element instanceof ReferenceReflection) {
|
|
248
268
|
return;
|
|
249
269
|
}
|
|
270
|
+
const children = getNavigationElements(element);
|
|
271
|
+
if (element instanceof ReflectionCategory || element instanceof ReflectionGroup) {
|
|
272
|
+
if (!children?.length) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
text: element.title,
|
|
277
|
+
children,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
250
280
|
return {
|
|
251
|
-
text: element
|
|
252
|
-
|
|
281
|
+
text: getDisplayName(element),
|
|
282
|
+
path: element.url,
|
|
283
|
+
kind: element.kind & ReflectionKind.Project ? undefined : element.kind,
|
|
284
|
+
class: classNames({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
|
|
285
|
+
children: children?.length ? children : undefined,
|
|
253
286
|
};
|
|
254
287
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
text: (0, lib_1.getDisplayName)(element),
|
|
260
|
-
path: element.url,
|
|
261
|
-
kind: element.kind,
|
|
262
|
-
class: (0, lib_1.classNames)({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
|
|
263
|
-
children: children?.length ? children : undefined,
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function getNavigationElements(parent) {
|
|
267
|
-
if (parent instanceof models_1.ReflectionCategory) {
|
|
268
|
-
return (0, utils_1.filterMap)(parent.children, toNavigation);
|
|
269
|
-
}
|
|
270
|
-
if (parent instanceof models_1.ReflectionGroup) {
|
|
271
|
-
if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
|
|
272
|
-
return (0, utils_1.filterMap)(parent.categories, toNavigation);
|
|
288
|
+
function getNavigationElements(parent) {
|
|
289
|
+
if (parent instanceof ReflectionCategory) {
|
|
290
|
+
return filterMap(parent.children, toNavigation);
|
|
273
291
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
if (parent instanceof ReflectionGroup) {
|
|
293
|
+
if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
|
|
294
|
+
return filterMap(parent.categories, toNavigation);
|
|
295
|
+
}
|
|
296
|
+
return filterMap(parent.children, toNavigation);
|
|
297
|
+
}
|
|
298
|
+
if (leaves.includes(parent.getFullName())) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (!parent.kindOf(ReflectionKind.MayContainDocuments)) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (parent.isDocument()) {
|
|
305
|
+
return filterMap(parent.children, toNavigation);
|
|
306
|
+
}
|
|
307
|
+
if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
|
|
308
|
+
// Tricky: Non-module children don't show up in the navigation pane,
|
|
309
|
+
// but any documents added by them should.
|
|
310
|
+
return filterMap(parent.documents, toNavigation);
|
|
311
|
+
}
|
|
312
|
+
if (parent.categories && shouldShowCategories(parent, opts)) {
|
|
313
|
+
return filterMapWithNoneCollection(parent.categories);
|
|
314
|
+
}
|
|
315
|
+
if (parent.groups && shouldShowGroups(parent, opts)) {
|
|
316
|
+
return filterMapWithNoneCollection(parent.groups);
|
|
317
|
+
}
|
|
318
|
+
if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
|
|
319
|
+
return deriveModuleFolders(parent.childrenIncludingDocuments);
|
|
320
|
+
}
|
|
321
|
+
return filterMap(parent.childrenIncludingDocuments, toNavigation);
|
|
298
322
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return
|
|
323
|
+
function filterMapWithNoneCollection(reflection) {
|
|
324
|
+
const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
|
|
325
|
+
const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
|
|
326
|
+
const mappedOthers = filterMap(others, toNavigation);
|
|
327
|
+
if (none) {
|
|
328
|
+
const noneMappedChildren = filterMap(none.children, toNavigation);
|
|
329
|
+
return [...noneMappedChildren, ...mappedOthers];
|
|
330
|
+
}
|
|
331
|
+
return mappedOthers;
|
|
308
332
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
333
|
+
function deriveModuleFolders(children) {
|
|
334
|
+
const result = [];
|
|
335
|
+
const resolveOrCreateParents = (path, root = result) => {
|
|
336
|
+
if (path.length > 1) {
|
|
337
|
+
const inner = root.find((el) => el.text === path[0]);
|
|
338
|
+
if (inner) {
|
|
339
|
+
inner.children ||= [];
|
|
340
|
+
return resolveOrCreateParents(path.slice(1), inner.children);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
root.push({
|
|
344
|
+
text: path[0],
|
|
345
|
+
children: [],
|
|
346
|
+
});
|
|
347
|
+
return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
|
|
348
|
+
}
|
|
319
349
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
350
|
+
return root;
|
|
351
|
+
};
|
|
352
|
+
// Note: This might end up putting a module within another module if we document
|
|
353
|
+
// both foo/index.ts and foo/bar.ts.
|
|
354
|
+
for (const child of children.filter((c) => c.hasOwnDocument)) {
|
|
355
|
+
const nav = toNavigation(child);
|
|
356
|
+
if (nav) {
|
|
357
|
+
const parts = child.name.split("/");
|
|
358
|
+
const collection = resolveOrCreateParents(parts);
|
|
359
|
+
nav.text = parts[parts.length - 1];
|
|
360
|
+
collection.push(nav);
|
|
326
361
|
}
|
|
327
362
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
363
|
+
// Now merge single-possible-paths together so we don't have folders in our navigation
|
|
364
|
+
// which contain only another single folder.
|
|
365
|
+
if (opts.compactFolders) {
|
|
366
|
+
const queue = [...result];
|
|
367
|
+
while (queue.length) {
|
|
368
|
+
const review = queue.shift();
|
|
369
|
+
queue.push(...(review.children || []));
|
|
370
|
+
if (review.kind || review.path)
|
|
371
|
+
continue;
|
|
372
|
+
if (review.children?.length === 1) {
|
|
373
|
+
const copyFrom = review.children[0];
|
|
374
|
+
const fullName = `${review.text}/${copyFrom.text}`;
|
|
375
|
+
delete review.children;
|
|
376
|
+
Object.assign(review, copyFrom);
|
|
377
|
+
review.text = fullName;
|
|
378
|
+
queue.push(review);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
339
381
|
}
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Generate an anchor url for the given reflection and all of its children.
|
|
387
|
+
*
|
|
388
|
+
* @param reflection The reflection an anchor url should be created for.
|
|
389
|
+
* @param container The nearest reflection having an own document.
|
|
390
|
+
*/
|
|
391
|
+
applyAnchorUrl(reflection, container) {
|
|
392
|
+
if (!(reflection instanceof DeclarationReflection) &&
|
|
393
|
+
!(reflection instanceof SignatureReflection) &&
|
|
394
|
+
!(reflection instanceof TypeParameterReflection)) {
|
|
395
|
+
return;
|
|
340
396
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
continue;
|
|
350
|
-
if (review.children?.length === 1) {
|
|
351
|
-
const copyFrom = review.children[0];
|
|
352
|
-
const fullName = `${review.text}/${copyFrom.text}`;
|
|
353
|
-
delete review.children;
|
|
354
|
-
Object.assign(review, copyFrom);
|
|
355
|
-
review.text = fullName;
|
|
356
|
-
queue.push(review);
|
|
397
|
+
if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
|
|
398
|
+
let refl = reflection;
|
|
399
|
+
const parts = [refl.name];
|
|
400
|
+
while (refl.parent && refl.parent !== container && !(reflection.parent instanceof ProjectReflection)) {
|
|
401
|
+
refl = refl.parent;
|
|
402
|
+
// Avoid duplicate names for signatures
|
|
403
|
+
if (parts[0] !== refl.name) {
|
|
404
|
+
parts.unshift(refl.name);
|
|
357
405
|
}
|
|
358
406
|
}
|
|
407
|
+
const anchor = this.getSlugger(reflection).slug(parts.join("."));
|
|
408
|
+
reflection.url = container.url + "#" + anchor;
|
|
409
|
+
reflection.anchor = anchor;
|
|
410
|
+
reflection.hasOwnDocument = false;
|
|
359
411
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (this.sluggers.has(reflection)) {
|
|
365
|
-
return this.sluggers.get(reflection);
|
|
366
|
-
}
|
|
367
|
-
// A slugger should always be defined at least for the project
|
|
368
|
-
return this.getSlugger(reflection.parent);
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Generate an anchor url for the given reflection and all of its children.
|
|
372
|
-
*
|
|
373
|
-
* @param reflection The reflection an anchor url should be created for.
|
|
374
|
-
* @param container The nearest reflection having an own document.
|
|
375
|
-
*/
|
|
376
|
-
static applyAnchorUrl(reflection, container) {
|
|
377
|
-
if (!(reflection instanceof models_1.DeclarationReflection) &&
|
|
378
|
-
!(reflection instanceof models_1.SignatureReflection) &&
|
|
379
|
-
!(reflection instanceof models_1.TypeParameterReflection)) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
|
|
383
|
-
const anchor = DefaultTheme.getUrl(reflection, container, ".");
|
|
384
|
-
reflection.url = container.url + "#" + anchor;
|
|
385
|
-
reflection.anchor = anchor;
|
|
386
|
-
reflection.hasOwnDocument = false;
|
|
412
|
+
reflection.traverse((child) => {
|
|
413
|
+
this.applyAnchorUrl(child, container);
|
|
414
|
+
return true;
|
|
415
|
+
});
|
|
387
416
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
exports.DefaultTheme = DefaultTheme;
|
|
395
|
-
DefaultTheme.URL_PREFIX = /^(http|ftp)s?:\/\//;
|
|
417
|
+
};
|
|
418
|
+
})();
|
|
419
|
+
export { DefaultTheme };
|
|
396
420
|
function getReflectionClasses(reflection, filters) {
|
|
397
421
|
const classes = [];
|
|
398
422
|
// Filter classes should match up with the settings function in
|
|
@@ -421,12 +445,12 @@ function getReflectionClasses(reflection, filters) {
|
|
|
421
445
|
else if (key.startsWith("@")) {
|
|
422
446
|
if (key === "@deprecated") {
|
|
423
447
|
if (reflection.isDeprecated()) {
|
|
424
|
-
classes.push(
|
|
448
|
+
classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
|
|
425
449
|
}
|
|
426
450
|
}
|
|
427
451
|
else if (reflection.comment?.hasModifier(key) ||
|
|
428
452
|
reflection.comment?.getTag(key)) {
|
|
429
|
-
classes.push(
|
|
453
|
+
classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
|
|
430
454
|
}
|
|
431
455
|
}
|
|
432
456
|
}
|