typedoc 0.27.9 → 0.28.0-beta.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/README.md +26 -26
- package/bin/package.json +1 -1
- package/dist/browser-locales/en.d.ts +2 -0
- package/dist/browser-locales/en.js +62 -0
- package/dist/browser-locales/ja.d.ts +2 -0
- package/dist/browser-locales/ja.js +62 -0
- package/dist/browser-locales/ko.d.ts +2 -0
- package/dist/browser-locales/ko.js +62 -0
- package/dist/browser-locales/zh.d.ts +2 -0
- package/dist/browser-locales/zh.js +62 -0
- package/dist/browser-utils.d.ts +3 -0
- package/dist/browser-utils.js +3 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.js +13 -7
- package/dist/lib/application.d.ts +9 -10
- package/dist/lib/application.js +75 -56
- package/dist/lib/cli.js +4 -3
- package/dist/lib/converter/comments/blockLexer.js +2 -2
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +8 -10
- package/dist/lib/converter/comments/discovery.d.ts +1 -1
- package/dist/lib/converter/comments/discovery.js +3 -4
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +5 -7
- package/dist/lib/converter/comments/linkResolver.d.ts +1 -1
- package/dist/lib/converter/comments/linkResolver.js +10 -16
- package/dist/lib/converter/comments/parser.d.ts +2 -2
- package/dist/lib/converter/comments/parser.js +8 -8
- package/dist/lib/converter/comments/textParser.d.ts +3 -2
- package/dist/lib/converter/comments/textParser.js +1 -2
- package/dist/lib/converter/context.d.ts +13 -14
- package/dist/lib/converter/context.js +49 -13
- package/dist/lib/converter/converter.d.ts +10 -5
- package/dist/lib/converter/converter.js +59 -42
- package/dist/lib/converter/factories/index-signature.js +3 -2
- package/dist/lib/converter/factories/signature.js +5 -6
- package/dist/lib/converter/factories/symbol-id.d.ts +4 -0
- package/dist/lib/converter/factories/symbol-id.js +92 -0
- package/dist/lib/converter/factories/types.d.ts +4 -0
- package/dist/lib/converter/factories/types.js +13 -0
- package/dist/lib/converter/index.d.ts +3 -4
- package/dist/lib/converter/index.js +2 -2
- package/dist/lib/converter/jsdoc.js +5 -4
- package/dist/lib/converter/plugins/CategoryPlugin.js +4 -2
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +0 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +8 -6
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +8 -7
- package/dist/lib/converter/plugins/ImplementsPlugin.js +6 -8
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/IncludePlugin.js +19 -16
- package/dist/lib/converter/plugins/InheritDocPlugin.js +7 -9
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +3 -2
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +3 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +23 -19
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +2 -1
- package/dist/lib/converter/plugins/SourcePlugin.js +10 -9
- package/dist/lib/converter/plugins/TypePlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/TypePlugin.js +1 -1
- package/dist/lib/converter/plugins/index.d.ts +1 -1
- package/dist/lib/converter/plugins/index.js +1 -1
- package/dist/lib/converter/symbols.js +103 -32
- package/dist/lib/converter/types.js +14 -13
- package/dist/lib/converter/utils/repository.d.ts +1 -1
- package/dist/lib/converter/utils/repository.js +2 -2
- package/dist/lib/debug/index.d.ts +2 -2
- package/dist/lib/debug/index.js +2 -2
- package/dist/lib/debug/{debugReflectionLifetimes.d.ts → reflectionLifetimes.d.ts} +2 -1
- package/dist/lib/debug/{debugReflectionLifetimes.js → reflectionLifetimes.js} +12 -4
- package/dist/lib/debug/{debugRendererUrls.d.ts → rendererUrls.d.ts} +1 -0
- package/dist/lib/debug/rendererUrls.js +68 -0
- package/dist/lib/internationalization/index.d.ts +2 -1
- package/dist/lib/internationalization/index.js +2 -1
- package/dist/lib/internationalization/internationalization.d.ts +16 -46
- package/dist/lib/internationalization/internationalization.js +44 -213
- package/dist/lib/internationalization/locales/en.cjs +9 -1
- package/dist/lib/internationalization/locales/en.d.cts +9 -1
- package/dist/lib/internationalization/locales/ja.cjs +1 -0
- package/dist/lib/internationalization/locales/zh.cjs +61 -5
- package/dist/lib/internationalization/locales/zh.d.cts +26 -2
- package/dist/lib/internationalization/translatable.d.ts +2 -1
- package/dist/lib/models/{comments/comment.d.ts → Comment.d.ts} +9 -8
- package/dist/lib/models/{comments/comment.js → Comment.js} +15 -18
- package/dist/lib/models/{reflections/container.d.ts → ContainerReflection.d.ts} +6 -6
- package/dist/lib/models/{reflections/container.js → ContainerReflection.js} +4 -5
- package/dist/lib/models/{reflections/declaration.d.ts → DeclarationReflection.d.ts} +11 -19
- package/dist/lib/models/{reflections/declaration.js → DeclarationReflection.js} +11 -29
- package/dist/lib/models/{reflections/document.d.ts → DocumentReflection.d.ts} +3 -3
- package/dist/lib/models/{reflections/document.js → DocumentReflection.js} +3 -3
- package/dist/lib/models/FileRegistry.d.ts +12 -20
- package/dist/lib/models/FileRegistry.js +8 -44
- package/dist/lib/models/{reflections/parameter.d.ts → ParameterReflection.d.ts} +4 -4
- package/dist/lib/models/{reflections/parameter.js → ParameterReflection.js} +2 -2
- package/dist/lib/models/{reflections/project.d.ts → ProjectReflection.d.ts} +12 -21
- package/dist/lib/models/{reflections/project.js → ProjectReflection.js} +16 -48
- package/dist/lib/models/{reflections/reference.d.ts → ReferenceReflection.d.ts} +3 -3
- package/dist/lib/models/{reflections/reference.js → ReferenceReflection.js} +3 -4
- package/dist/lib/models/{reflections/abstract.d.ts → Reflection.d.ts} +15 -28
- package/dist/lib/models/{reflections/abstract.js → Reflection.js} +38 -21
- package/dist/lib/models/ReflectionCategory.d.ts +2 -6
- package/dist/lib/models/ReflectionCategory.js +3 -9
- package/dist/lib/models/ReflectionGroup.d.ts +1 -5
- package/dist/lib/models/ReflectionGroup.js +2 -8
- package/dist/lib/models/{reflections/ReflectionSymbolId.d.ts → ReflectionSymbolId.d.ts} +23 -10
- package/dist/lib/models/ReflectionSymbolId.js +75 -0
- package/dist/lib/models/{reflections/signature.d.ts → SignatureReflection.d.ts} +8 -7
- package/dist/lib/models/{reflections/signature.js → SignatureReflection.js} +7 -11
- package/dist/lib/models/{sources/file.d.ts → SourceReference.d.ts} +3 -4
- package/dist/lib/models/{reflections/type-parameter.d.ts → TypeParameterReflection.d.ts} +6 -5
- package/dist/lib/models/{reflections/type-parameter.js → TypeParameterReflection.js} +4 -1
- package/dist/lib/models/index.d.ts +18 -6
- package/dist/lib/models/index.js +18 -6
- package/dist/lib/models/{reflections/kind.d.ts → kind.d.ts} +2 -8
- package/dist/lib/models/{reflections/kind.js → kind.js} +99 -30
- package/dist/lib/models/types.d.ts +8 -10
- package/dist/lib/models/types.js +11 -22
- package/dist/lib/models/{reflections/variant.d.ts → variant.d.ts} +7 -7
- package/dist/lib/output/components.d.ts +2 -2
- package/dist/lib/output/components.js +1 -1
- package/dist/lib/output/events.d.ts +10 -18
- package/dist/lib/output/events.js +10 -27
- package/dist/lib/output/formatter.d.ts +8 -5
- package/dist/lib/output/formatter.js +45 -18
- package/dist/lib/output/index.d.ts +4 -5
- package/dist/lib/output/index.js +4 -4
- package/dist/lib/output/output.js +5 -4
- package/dist/lib/output/plugins/AssetsPlugin.js +7 -6
- package/dist/lib/output/plugins/HierarchyPlugin.js +4 -3
- package/dist/lib/output/plugins/IconsPlugin.js +3 -3
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +12 -17
- package/dist/lib/output/plugins/SitemapPlugin.js +6 -7
- package/dist/lib/output/renderer.d.ts +22 -14
- package/dist/lib/output/renderer.js +76 -36
- package/dist/lib/output/router.d.ts +175 -0
- package/dist/lib/output/router.js +478 -0
- package/dist/lib/output/theme.d.ts +3 -28
- package/dist/lib/output/theme.js +2 -15
- package/dist/lib/output/themes/MarkedPlugin.d.ts +2 -2
- package/dist/lib/output/themes/MarkedPlugin.js +32 -30
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +11 -40
- package/dist/lib/output/themes/default/DefaultTheme.js +207 -406
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +49 -47
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +17 -14
- package/dist/lib/output/themes/default/Slugger.js +1 -1
- package/dist/lib/output/themes/default/layouts/default.d.ts +1 -1
- package/dist/lib/output/themes/default/layouts/default.js +6 -6
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +4 -1
- package/dist/lib/output/themes/default/partials/anchor-icon.js +12 -2
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/breadcrumb.js +11 -5
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +9 -9
- package/dist/lib/output/themes/default/partials/footer.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/footer.js +2 -2
- package/dist/lib/output/themes/default/partials/header.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/header.js +4 -3
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.js +10 -8
- package/dist/lib/output/themes/default/partials/icon.d.ts +2 -3
- package/dist/lib/output/themes/default/partials/icon.js +3 -3
- package/dist/lib/output/themes/default/partials/index.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/index.js +10 -18
- package/dist/lib/output/themes/default/partials/member.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.declaration.js +2 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +5 -5
- package/dist/lib/output/themes/default/partials/member.js +10 -9
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signatures.js +4 -4
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.sources.js +7 -7
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.js +2 -2
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/moduleReflection.js +5 -5
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +17 -15
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +2 -2
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/toolbar.js +10 -13
- package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/type.js +1 -1
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeAndParent.js +3 -3
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeDetails.js +23 -19
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeParameters.js +12 -7
- package/dist/lib/output/themes/default/templates/document.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/document.js +2 -2
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/hierarchy.js +4 -3
- package/dist/lib/output/themes/default/templates/index.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/index.js +2 -2
- package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/reflection.js +9 -12
- package/dist/lib/output/themes/lib.d.ts +1 -1
- package/dist/lib/output/themes/lib.js +3 -3
- package/dist/lib/serialization/components.d.ts +1 -1
- package/dist/lib/serialization/deserializer.d.ts +9 -13
- package/dist/lib/serialization/deserializer.js +22 -24
- package/dist/lib/serialization/events.d.ts +1 -1
- package/dist/lib/serialization/index.d.ts +1 -1
- package/dist/lib/serialization/index.js +1 -1
- package/dist/lib/serialization/schema.d.ts +15 -10
- package/dist/lib/serialization/schema.js +1 -1
- package/dist/lib/serialization/serializer.d.ts +4 -4
- package/dist/lib/serialization/serializer.js +1 -2
- package/dist/lib/utils/ValidatingFileRegistry.d.ts +10 -0
- package/dist/lib/utils/ValidatingFileRegistry.js +34 -0
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +1 -1
- package/dist/lib/utils/entry-point.d.ts +3 -3
- package/dist/lib/utils/entry-point.js +29 -26
- package/dist/lib/utils/fs.d.ts +5 -13
- package/dist/lib/utils/fs.js +11 -67
- package/dist/lib/utils/general.d.ts +1 -47
- package/dist/lib/utils/general.js +4 -74
- package/dist/lib/utils/highlighter.js +1 -2
- package/dist/lib/utils/html.d.ts +0 -1
- package/dist/lib/utils/html.js +4 -13
- package/dist/lib/utils/index.d.ts +9 -17
- package/dist/lib/utils/index.js +8 -15
- package/dist/lib/utils/loggers.d.ts +5 -108
- package/dist/lib/utils/loggers.js +24 -168
- package/dist/lib/utils/options/declaration.d.ts +63 -38
- package/dist/lib/utils/options/declaration.js +124 -66
- package/dist/lib/utils/options/defaults.d.ts +1 -1
- package/dist/lib/utils/options/help.d.ts +1 -2
- package/dist/lib/utils/options/help.js +5 -5
- package/dist/lib/utils/options/index.d.ts +4 -4
- package/dist/lib/utils/options/index.js +3 -3
- package/dist/lib/utils/options/options.d.ts +3 -6
- package/dist/lib/utils/options/options.js +10 -12
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
- package/dist/lib/utils/options/readers/arguments.js +4 -3
- package/dist/lib/utils/options/readers/package-json.d.ts +1 -1
- package/dist/lib/utils/options/readers/package-json.js +3 -2
- package/dist/lib/utils/options/readers/tsconfig.d.ts +1 -1
- package/dist/lib/utils/options/readers/tsconfig.js +27 -27
- package/dist/lib/utils/options/readers/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/readers/typedoc.js +8 -9
- package/dist/lib/utils/options/sources/typedoc.js +143 -135
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +3 -1
- package/dist/lib/utils/package-manifest.d.ts +3 -3
- package/dist/lib/utils/package-manifest.js +9 -8
- package/dist/lib/utils/paths.d.ts +17 -6
- package/dist/lib/utils/paths.js +94 -11
- package/dist/lib/utils/perf.d.ts +4 -1
- package/dist/lib/utils/perf.js +32 -13
- package/dist/lib/utils/plugins.js +4 -3
- package/dist/lib/utils/sort.d.ts +1 -1
- package/dist/lib/utils/sort.js +8 -3
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +4 -3
- package/dist/lib/utils-common/general.d.ts +40 -0
- package/dist/lib/utils-common/general.js +20 -0
- package/dist/lib/utils-common/i18n.d.ts +17 -0
- package/dist/lib/utils-common/i18n.js +39 -0
- package/dist/lib/utils-common/index.d.ts +16 -0
- package/dist/lib/utils-common/index.js +18 -0
- package/dist/lib/{utils → utils-common}/jsx.d.ts +3 -3
- package/dist/lib/{utils → utils-common}/jsx.js +1 -1
- package/dist/lib/utils-common/logger.d.ts +86 -0
- package/dist/lib/utils-common/logger.js +120 -0
- package/dist/lib/{utils → utils-common}/minimalSourceFile.d.ts +7 -2
- package/dist/lib/{utils → utils-common}/minimalSourceFile.js +3 -2
- package/dist/lib/utils-common/path.d.ts +35 -0
- package/dist/lib/utils-common/path.js +123 -0
- package/dist/lib/utils-common/string.d.ts +11 -0
- package/dist/lib/utils-common/string.js +84 -0
- package/dist/lib/validation/documentation.d.ts +2 -2
- package/dist/lib/validation/documentation.js +5 -6
- package/dist/lib/validation/exports.d.ts +1 -1
- package/dist/lib/validation/exports.js +4 -4
- package/dist/lib/validation/links.d.ts +1 -1
- package/dist/lib/validation/links.js +9 -8
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +1 -1
- package/dist/lib/validation/unusedMergeModuleWith.js +3 -2
- package/package.json +57 -36
- package/static/main.js +4 -4
- package/static/style.css +232 -209
- package/tsdoc.json +8 -0
- package/dist/lib/debug/debugRendererUrls.js +0 -59
- package/dist/lib/internationalization/locales/jp.cjs +0 -3
- package/dist/lib/internationalization/locales/jp.d.cts +0 -2
- package/dist/lib/models/comments/index.d.ts +0 -2
- package/dist/lib/models/comments/index.js +0 -1
- package/dist/lib/models/reflections/ReflectionSymbolId.js +0 -133
- package/dist/lib/models/reflections/index.d.ts +0 -15
- package/dist/lib/models/reflections/index.js +0 -12
- package/dist/lib/models/sources/index.d.ts +0 -1
- package/dist/lib/models/sources/index.js +0 -1
- package/dist/lib/output/models/UrlMapping.d.ts +0 -13
- package/dist/lib/output/models/UrlMapping.js +0 -10
- /package/dist/lib/models/{sources/file.js → SourceReference.js} +0 -0
- /package/dist/lib/models/{reflections/utils.d.ts → utils.d.ts} +0 -0
- /package/dist/lib/models/{reflections/utils.js → utils.js} +0 -0
- /package/dist/lib/models/{reflections/variant.js → variant.js} +0 -0
- /package/dist/lib/{utils → utils-common}/array.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/array.js +0 -0
- /package/dist/lib/{converter/comments → utils-common}/declarationReference.d.ts +0 -0
- /package/dist/lib/{converter/comments → utils-common}/declarationReference.js +0 -0
- /package/dist/lib/{utils → utils-common}/enum.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/enum.js +0 -0
- /package/dist/lib/{utils → utils-common}/events.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/events.js +0 -0
- /package/dist/lib/{utils → utils-common}/hooks.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/hooks.js +0 -0
- /package/dist/lib/{utils → utils-common}/jsx.elements.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/jsx.elements.js +0 -0
- /package/dist/lib/{utils → utils-common}/map.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/map.js +0 -0
- /package/dist/lib/{utils → utils-common}/set.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/set.js +0 -0
- /package/dist/lib/{utils → utils-common}/validation.d.ts +0 -0
- /package/dist/lib/{utils → utils-common}/validation.js +0 -0
|
@@ -1,436 +1,237 @@
|
|
|
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] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
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);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
1
|
import { Theme } from "../../theme.js";
|
|
36
|
-
import {
|
|
37
|
-
import { UrlMapping } from "../../models/UrlMapping.js";
|
|
2
|
+
import { ReferenceReflection, ReflectionCategory, ReflectionGroup, ReflectionKind, } from "../../../models/index.js";
|
|
38
3
|
import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext.js";
|
|
39
|
-
import { filterMap, JSX, Option } from "../../../utils/index.js";
|
|
40
|
-
import { classNames, getDisplayName, getHierarchyRoots, toStyleClass } from "../lib.js";
|
|
41
4
|
import { getIcons } from "./partials/icon.js";
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
getRenderContext(pageEvent)
|
|
79
|
-
|
|
5
|
+
import { filterMap, JSX } from "#utils";
|
|
6
|
+
import { classNames, getDisplayName, toStyleClass } from "../lib.js";
|
|
7
|
+
import { PageKind } from "../../router.js";
|
|
8
|
+
import { createNormalizedUrl } from "#node-utils";
|
|
9
|
+
export class DefaultTheme extends Theme {
|
|
10
|
+
// Note: This will always contain lowercased names to avoid issues with
|
|
11
|
+
// case-insensitive file systems.
|
|
12
|
+
usedFileNames = new Set();
|
|
13
|
+
/** @internal */
|
|
14
|
+
markedPlugin;
|
|
15
|
+
router;
|
|
16
|
+
/**
|
|
17
|
+
* The icons which will actually be rendered. The source of truth lives on the theme, and
|
|
18
|
+
* the {@link DefaultThemeRenderContext.icons} member will produce references to these.
|
|
19
|
+
*
|
|
20
|
+
* These icons will be written twice. Once to an `icons.svg` file in the assets directory
|
|
21
|
+
* which will be referenced by icons on the context, and once to an `icons.js` file so that
|
|
22
|
+
* references to the icons can be dynamically embedded within the page for use by the search
|
|
23
|
+
* dropdown and when loading the page on `file://` urls.
|
|
24
|
+
*
|
|
25
|
+
* Custom themes may overwrite this entire object or individual properties on it to customize
|
|
26
|
+
* the icons used within the page, however TypeDoc currently assumes that all icons are svg
|
|
27
|
+
* elements, so custom themes must also use svg elements.
|
|
28
|
+
*/
|
|
29
|
+
icons;
|
|
30
|
+
ContextClass = DefaultThemeRenderContext;
|
|
31
|
+
getRenderContext(pageEvent) {
|
|
32
|
+
return new this.ContextClass(this.router, this, pageEvent, this.application.options);
|
|
33
|
+
}
|
|
34
|
+
documentTemplate = (pageEvent) => {
|
|
35
|
+
return this.getRenderContext(pageEvent).documentTemplate(pageEvent);
|
|
36
|
+
};
|
|
37
|
+
reflectionTemplate = (pageEvent) => {
|
|
38
|
+
return this.getRenderContext(pageEvent).reflectionTemplate(pageEvent);
|
|
39
|
+
};
|
|
40
|
+
indexTemplate = (pageEvent) => {
|
|
41
|
+
return this.getRenderContext(pageEvent).indexTemplate(pageEvent);
|
|
42
|
+
};
|
|
43
|
+
hierarchyTemplate = (pageEvent) => {
|
|
44
|
+
return this.getRenderContext(pageEvent).hierarchyTemplate(pageEvent);
|
|
45
|
+
};
|
|
46
|
+
defaultLayoutTemplate = (pageEvent, template) => {
|
|
47
|
+
return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
|
|
48
|
+
};
|
|
49
|
+
getReflectionClasses(reflection) {
|
|
50
|
+
const filters = this.application.options.getValue("visibilityFilters");
|
|
51
|
+
return getReflectionClasses(reflection, filters);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create a new DefaultTheme instance.
|
|
55
|
+
*
|
|
56
|
+
* @param renderer The renderer this theme is attached to.
|
|
57
|
+
*/
|
|
58
|
+
constructor(renderer) {
|
|
59
|
+
super(renderer);
|
|
60
|
+
this.icons = getIcons();
|
|
61
|
+
this.markedPlugin = renderer.markedPlugin;
|
|
62
|
+
this.router = renderer.router;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @param reflection The reflection the url should be generated for.
|
|
66
|
+
*/
|
|
67
|
+
getFileName(reflection) {
|
|
68
|
+
const parts = [createNormalizedUrl(reflection.name)];
|
|
69
|
+
while (reflection.parent && !reflection.parent.isProject()) {
|
|
70
|
+
reflection = reflection.parent;
|
|
71
|
+
parts.unshift(createNormalizedUrl(reflection.name));
|
|
80
72
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
hierarchyTemplate = (pageEvent) => {
|
|
91
|
-
return this.getRenderContext(pageEvent).hierarchyTemplate(pageEvent);
|
|
92
|
-
};
|
|
93
|
-
defaultLayoutTemplate = (pageEvent, template) => {
|
|
94
|
-
return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
|
|
95
|
-
};
|
|
96
|
-
getReflectionClasses(reflection) {
|
|
97
|
-
const filters = this.application.options.getValue("visibilityFilters");
|
|
98
|
-
return getReflectionClasses(reflection, filters);
|
|
73
|
+
const baseName = parts.join(".");
|
|
74
|
+
const lowerBaseName = baseName.toLocaleLowerCase();
|
|
75
|
+
if (this.usedFileNames.has(lowerBaseName)) {
|
|
76
|
+
let index = 1;
|
|
77
|
+
while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
|
|
78
|
+
++index;
|
|
79
|
+
}
|
|
80
|
+
this.usedFileNames.add(`${lowerBaseName}-${index}`);
|
|
81
|
+
return `${baseName}-${index}.html`;
|
|
99
82
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
template: this.reflectionTemplate,
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
kind: [ReflectionKind.TypeAlias],
|
|
126
|
-
directory: "types",
|
|
127
|
-
template: this.reflectionTemplate,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
kind: [ReflectionKind.Function],
|
|
131
|
-
directory: "functions",
|
|
132
|
-
template: this.reflectionTemplate,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
kind: [ReflectionKind.Variable],
|
|
136
|
-
directory: "variables",
|
|
137
|
-
template: this.reflectionTemplate,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
kind: [ReflectionKind.Document],
|
|
141
|
-
directory: "documents",
|
|
142
|
-
template: this.documentTemplate,
|
|
143
|
-
},
|
|
144
|
-
];
|
|
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.icons = getIcons(renderer.application.i18n);
|
|
154
|
-
this.markedPlugin = renderer.markedPlugin;
|
|
83
|
+
this.usedFileNames.add(lowerBaseName);
|
|
84
|
+
return `${baseName}.html`;
|
|
85
|
+
}
|
|
86
|
+
render(page) {
|
|
87
|
+
const template = {
|
|
88
|
+
[PageKind.Index]: this.indexTemplate,
|
|
89
|
+
[PageKind.Document]: this.documentTemplate,
|
|
90
|
+
[PageKind.Hierarchy]: this.hierarchyTemplate,
|
|
91
|
+
[PageKind.Reflection]: this.reflectionTemplate,
|
|
92
|
+
}[page.pageKind];
|
|
93
|
+
const templateOutput = this.defaultLayoutTemplate(page, template);
|
|
94
|
+
return "<!DOCTYPE html>" + JSX.renderElement(templateOutput) + "\n";
|
|
95
|
+
}
|
|
96
|
+
_navigationCache;
|
|
97
|
+
/**
|
|
98
|
+
* If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
|
|
99
|
+
*/
|
|
100
|
+
getNavigation(project) {
|
|
101
|
+
// This is ok because currently TypeDoc wipes out the theme after each render.
|
|
102
|
+
// Might need to change in the future, but it's fine for now.
|
|
103
|
+
if (this._navigationCache) {
|
|
104
|
+
return this._navigationCache;
|
|
155
105
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
project.url = "index.html";
|
|
169
|
-
urls.push(new UrlMapping("index.html", project, this.reflectionTemplate));
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
project.url = "modules.html";
|
|
173
|
-
urls.push(new UrlMapping("modules.html", project, this.reflectionTemplate));
|
|
174
|
-
urls.push(new UrlMapping("index.html", project, this.indexTemplate));
|
|
106
|
+
return (this._navigationCache = this.buildNavigation(project));
|
|
107
|
+
}
|
|
108
|
+
buildNavigation(project) {
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
110
|
+
const theme = this;
|
|
111
|
+
const router = this.router;
|
|
112
|
+
const opts = this.application.options.getValue("navigation");
|
|
113
|
+
const leaves = this.application.options.getValue("navigationLeaves");
|
|
114
|
+
return getNavigationElements(project) || [];
|
|
115
|
+
function toNavigation(element) {
|
|
116
|
+
if (opts.excludeReferences && element instanceof ReferenceReflection) {
|
|
117
|
+
return;
|
|
175
118
|
}
|
|
176
|
-
|
|
177
|
-
|
|
119
|
+
const children = getNavigationElements(element);
|
|
120
|
+
if (element instanceof ReflectionCategory || element instanceof ReflectionGroup) {
|
|
121
|
+
if (!children?.length) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
text: element.title,
|
|
126
|
+
children,
|
|
127
|
+
};
|
|
178
128
|
}
|
|
179
|
-
|
|
180
|
-
|
|
129
|
+
return {
|
|
130
|
+
text: getDisplayName(element),
|
|
131
|
+
path: router.getFullUrl(element),
|
|
132
|
+
kind: element.kind & ReflectionKind.Project ? undefined : element.kind,
|
|
133
|
+
class: classNames({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
|
|
134
|
+
children: children?.length ? children : undefined,
|
|
135
|
+
};
|
|
181
136
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
getFileName(reflection) {
|
|
186
|
-
const parts = [createNormalizedUrl(reflection.name)];
|
|
187
|
-
while (reflection.parent && !reflection.parent.isProject()) {
|
|
188
|
-
reflection = reflection.parent;
|
|
189
|
-
parts.unshift(createNormalizedUrl(reflection.name));
|
|
137
|
+
function getNavigationElements(parent) {
|
|
138
|
+
if (parent instanceof ReflectionCategory) {
|
|
139
|
+
return filterMap(parent.children, toNavigation);
|
|
190
140
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
let index = 1;
|
|
195
|
-
while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
|
|
196
|
-
++index;
|
|
141
|
+
if (parent instanceof ReflectionGroup) {
|
|
142
|
+
if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
|
|
143
|
+
return filterMap(parent.categories, toNavigation);
|
|
197
144
|
}
|
|
198
|
-
|
|
199
|
-
return `${baseName}-${index}.html`;
|
|
145
|
+
return filterMap(parent.children, toNavigation);
|
|
200
146
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Return the template mapping for the given reflection.
|
|
206
|
-
*
|
|
207
|
-
* @param reflection The reflection whose mapping should be resolved.
|
|
208
|
-
* @returns The found mapping or undefined if no mapping could be found.
|
|
209
|
-
*/
|
|
210
|
-
getMapping(reflection) {
|
|
211
|
-
return this.mappings.find((mapping) => reflection.kindOf(mapping.kind));
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Build the url for the the given reflection and all of its children.
|
|
215
|
-
*
|
|
216
|
-
* @param reflection The reflection the url should be created for.
|
|
217
|
-
* @param urls The array the url should be appended to.
|
|
218
|
-
* @returns The altered urls array.
|
|
219
|
-
*/
|
|
220
|
-
buildUrls(reflection, urls) {
|
|
221
|
-
const mapping = this.getMapping(reflection);
|
|
222
|
-
if (mapping) {
|
|
223
|
-
if (!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) {
|
|
224
|
-
const url = [mapping.directory, this.getFileName(reflection)].join("/");
|
|
225
|
-
urls.push(new UrlMapping(url, reflection, mapping.template));
|
|
226
|
-
this.setSlugger(reflection, new Slugger(this.sluggerConfiguration));
|
|
227
|
-
reflection.url = url;
|
|
228
|
-
reflection.hasOwnDocument = true;
|
|
229
|
-
}
|
|
230
|
-
reflection.traverse((child) => {
|
|
231
|
-
if (child.isDeclaration() || child.isDocument()) {
|
|
232
|
-
this.buildUrls(child, urls);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
this.applyAnchorUrl(child, reflection);
|
|
236
|
-
}
|
|
237
|
-
return true;
|
|
238
|
-
});
|
|
147
|
+
if (leaves.includes(parent.getFullName())) {
|
|
148
|
+
return;
|
|
239
149
|
}
|
|
240
|
-
|
|
241
|
-
|
|
150
|
+
if (!parent.kindOf(ReflectionKind.MayContainDocuments)) {
|
|
151
|
+
return;
|
|
242
152
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
render(page, template) {
|
|
246
|
-
const templateOutput = this.defaultLayoutTemplate(page, template);
|
|
247
|
-
return "<!DOCTYPE html>" + JSX.renderElement(templateOutput) + "\n";
|
|
248
|
-
}
|
|
249
|
-
_navigationCache;
|
|
250
|
-
/**
|
|
251
|
-
* If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
|
|
252
|
-
*/
|
|
253
|
-
getNavigation(project) {
|
|
254
|
-
// This is ok because currently TypeDoc wipes out the theme after each render.
|
|
255
|
-
// Might need to change in the future, but it's fine for now.
|
|
256
|
-
if (this._navigationCache) {
|
|
257
|
-
return this._navigationCache;
|
|
153
|
+
if (parent.isDocument()) {
|
|
154
|
+
return filterMap(parent.children, toNavigation);
|
|
258
155
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const theme = this;
|
|
264
|
-
const opts = this.application.options.getValue("navigation");
|
|
265
|
-
const leaves = this.application.options.getValue("navigationLeaves");
|
|
266
|
-
return getNavigationElements(project) || [];
|
|
267
|
-
function toNavigation(element) {
|
|
268
|
-
if (opts.excludeReferences && element instanceof ReferenceReflection) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
const children = getNavigationElements(element);
|
|
272
|
-
if (element instanceof ReflectionCategory || element instanceof ReflectionGroup) {
|
|
273
|
-
if (!children?.length) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
return {
|
|
277
|
-
text: element.title,
|
|
278
|
-
children,
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return {
|
|
282
|
-
text: getDisplayName(element),
|
|
283
|
-
path: element.url,
|
|
284
|
-
kind: element.kind & ReflectionKind.Project ? undefined : element.kind,
|
|
285
|
-
class: classNames({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
|
|
286
|
-
children: children?.length ? children : undefined,
|
|
287
|
-
};
|
|
156
|
+
if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
|
|
157
|
+
// Tricky: Non-module children don't show up in the navigation pane,
|
|
158
|
+
// but any documents added by them should.
|
|
159
|
+
return filterMap(parent.documents, toNavigation);
|
|
288
160
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return filterMap(parent.children, toNavigation);
|
|
292
|
-
}
|
|
293
|
-
if (parent instanceof ReflectionGroup) {
|
|
294
|
-
if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
|
|
295
|
-
return filterMap(parent.categories, toNavigation);
|
|
296
|
-
}
|
|
297
|
-
return filterMap(parent.children, toNavigation);
|
|
298
|
-
}
|
|
299
|
-
if (leaves.includes(parent.getFullName())) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
if (!parent.kindOf(ReflectionKind.MayContainDocuments)) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
if (parent.isDocument()) {
|
|
306
|
-
return filterMap(parent.children, toNavigation);
|
|
307
|
-
}
|
|
308
|
-
if (!parent.kindOf(ReflectionKind.SomeModule | ReflectionKind.Project)) {
|
|
309
|
-
// Tricky: Non-module children don't show up in the navigation pane,
|
|
310
|
-
// but any documents added by them should.
|
|
311
|
-
return filterMap(parent.documents, toNavigation);
|
|
312
|
-
}
|
|
313
|
-
if (parent.categories && shouldShowCategories(parent, opts)) {
|
|
314
|
-
return filterMapWithNoneCollection(parent.categories);
|
|
315
|
-
}
|
|
316
|
-
if (parent.groups && shouldShowGroups(parent, opts)) {
|
|
317
|
-
return filterMapWithNoneCollection(parent.groups);
|
|
318
|
-
}
|
|
319
|
-
if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
|
|
320
|
-
return deriveModuleFolders(parent.childrenIncludingDocuments);
|
|
321
|
-
}
|
|
322
|
-
return filterMap(parent.childrenIncludingDocuments, toNavigation);
|
|
161
|
+
if (parent.categories && shouldShowCategories(parent, opts)) {
|
|
162
|
+
return filterMapWithNoneCollection(parent.categories);
|
|
323
163
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
164
|
+
if (parent.groups && shouldShowGroups(parent, opts)) {
|
|
165
|
+
return filterMapWithNoneCollection(parent.groups);
|
|
166
|
+
}
|
|
167
|
+
if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
|
|
168
|
+
return deriveModuleFolders(parent.childrenIncludingDocuments);
|
|
169
|
+
}
|
|
170
|
+
return filterMap(parent.childrenIncludingDocuments, toNavigation);
|
|
171
|
+
}
|
|
172
|
+
function filterMapWithNoneCollection(reflection) {
|
|
173
|
+
const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
|
|
174
|
+
const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
|
|
175
|
+
const mappedOthers = filterMap(others, toNavigation);
|
|
176
|
+
if (none) {
|
|
177
|
+
const noneMappedChildren = filterMap(none.children, toNavigation);
|
|
178
|
+
return [...noneMappedChildren, ...mappedOthers];
|
|
333
179
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
root.push({
|
|
345
|
-
text: path[0],
|
|
346
|
-
children: [],
|
|
347
|
-
});
|
|
348
|
-
return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
|
|
349
|
-
}
|
|
180
|
+
return mappedOthers;
|
|
181
|
+
}
|
|
182
|
+
function deriveModuleFolders(children) {
|
|
183
|
+
const result = [];
|
|
184
|
+
const resolveOrCreateParents = (path, root = result) => {
|
|
185
|
+
if (path.length > 1) {
|
|
186
|
+
const inner = root.find((el) => el.text === path[0]);
|
|
187
|
+
if (inner) {
|
|
188
|
+
inner.children ||= [];
|
|
189
|
+
return resolveOrCreateParents(path.slice(1), inner.children);
|
|
350
190
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (nav) {
|
|
358
|
-
const parts = child.name.split("/");
|
|
359
|
-
const collection = resolveOrCreateParents(parts);
|
|
360
|
-
nav.text = parts[parts.length - 1];
|
|
361
|
-
collection.push(nav);
|
|
191
|
+
else {
|
|
192
|
+
root.push({
|
|
193
|
+
text: path[0],
|
|
194
|
+
children: [],
|
|
195
|
+
});
|
|
196
|
+
return resolveOrCreateParents(path.slice(1), root[root.length - 1].children);
|
|
362
197
|
}
|
|
363
198
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
const fullName = `${review.text}/${copyFrom.text}`;
|
|
376
|
-
delete review.children;
|
|
377
|
-
Object.assign(review, copyFrom);
|
|
378
|
-
review.text = fullName;
|
|
379
|
-
queue.push(review);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
199
|
+
return root;
|
|
200
|
+
};
|
|
201
|
+
// Note: This might end up putting a module within another module if we document
|
|
202
|
+
// both foo/index.ts and foo/bar.ts.
|
|
203
|
+
for (const child of children.filter((c) => router.hasOwnDocument(c))) {
|
|
204
|
+
const nav = toNavigation(child);
|
|
205
|
+
if (nav) {
|
|
206
|
+
const parts = child.name.split("/");
|
|
207
|
+
const collection = resolveOrCreateParents(parts);
|
|
208
|
+
nav.text = parts[parts.length - 1];
|
|
209
|
+
collection.push(nav);
|
|
382
210
|
}
|
|
383
|
-
return result;
|
|
384
211
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// which might not be used may result in a link being generated which isn't valid. #2808.
|
|
402
|
-
// This should be kept in sync with the renderingChildIsUseful function.
|
|
403
|
-
if (reflection.kindOf(ReflectionKind.TypeLiteral) &&
|
|
404
|
-
(!reflection.parent?.kindOf(ReflectionKind.SomeExport) ||
|
|
405
|
-
reflection.parent.type?.type !== "reflection")) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
if ((!reflection.url || !DefaultTheme.URL_PREFIX.test(reflection.url)) &&
|
|
409
|
-
!reflection.kindOf(ReflectionKind.TypeLiteral)) {
|
|
410
|
-
let refl = reflection;
|
|
411
|
-
const parts = [refl.name];
|
|
412
|
-
while (refl.parent && refl.parent !== container && !(reflection.parent instanceof ProjectReflection)) {
|
|
413
|
-
refl = refl.parent;
|
|
414
|
-
// Avoid duplicate names for signatures
|
|
415
|
-
// BREAKING: In 0.28, also add !refl.kindOf(ReflectionKind.TypeLiteral) to this check to improve anchor
|
|
416
|
-
// generation by omitting useless __type prefixes.
|
|
417
|
-
if (parts[0] !== refl.name) {
|
|
418
|
-
parts.unshift(refl.name);
|
|
212
|
+
// Now merge single-possible-paths together so we don't have folders in our navigation
|
|
213
|
+
// which contain only another single folder.
|
|
214
|
+
if (opts.compactFolders) {
|
|
215
|
+
const queue = [...result];
|
|
216
|
+
while (queue.length) {
|
|
217
|
+
const review = queue.shift();
|
|
218
|
+
queue.push(...(review.children || []));
|
|
219
|
+
if (review.kind || review.path)
|
|
220
|
+
continue;
|
|
221
|
+
if (review.children?.length === 1) {
|
|
222
|
+
const copyFrom = review.children[0];
|
|
223
|
+
const fullName = `${review.text}/${copyFrom.text}`;
|
|
224
|
+
delete review.children;
|
|
225
|
+
Object.assign(review, copyFrom);
|
|
226
|
+
review.text = fullName;
|
|
227
|
+
queue.push(review);
|
|
419
228
|
}
|
|
420
229
|
}
|
|
421
|
-
const anchor = this.getSlugger(reflection).slug(parts.join("."));
|
|
422
|
-
reflection.url = container.url + "#" + anchor;
|
|
423
|
-
reflection.anchor = anchor;
|
|
424
|
-
reflection.hasOwnDocument = false;
|
|
425
230
|
}
|
|
426
|
-
|
|
427
|
-
this.applyAnchorUrl(child, container);
|
|
428
|
-
return true;
|
|
429
|
-
});
|
|
231
|
+
return result;
|
|
430
232
|
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
export { DefaultTheme };
|
|
233
|
+
}
|
|
234
|
+
}
|
|
434
235
|
function getReflectionClasses(reflection, filters) {
|
|
435
236
|
const classes = new Set();
|
|
436
237
|
// Filter classes should match up with the settings function in
|