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
|
@@ -0,0 +1,478 @@
|
|
|
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
|
+
import { CategoryPlugin } from "../converter/plugins/CategoryPlugin.js";
|
|
36
|
+
import { GroupPlugin } from "../converter/plugins/GroupPlugin.js";
|
|
37
|
+
import { ReflectionKind, } from "../models/index.js";
|
|
38
|
+
import { createNormalizedUrl } from "#node-utils";
|
|
39
|
+
import { Option } from "../utils/index.js";
|
|
40
|
+
import { Slugger } from "./themes/default/Slugger.js";
|
|
41
|
+
import { getHierarchyRoots } from "./themes/lib.js";
|
|
42
|
+
/**
|
|
43
|
+
* The type of page which should be rendered. This may be extended in the future.
|
|
44
|
+
* @enum
|
|
45
|
+
*/
|
|
46
|
+
export const PageKind = {
|
|
47
|
+
Index: "index",
|
|
48
|
+
Reflection: "reflection",
|
|
49
|
+
Document: "document",
|
|
50
|
+
Hierarchy: "hierarchy",
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Base router class intended to make it easier to implement a router.
|
|
54
|
+
*
|
|
55
|
+
* Child classes need only {@link getIdealBaseName}, this class will take care
|
|
56
|
+
* of the recursing through child reflections.
|
|
57
|
+
* @group Routers
|
|
58
|
+
*/
|
|
59
|
+
let BaseRouter = (() => {
|
|
60
|
+
let _sluggerConfiguration_decorators;
|
|
61
|
+
let _sluggerConfiguration_initializers = [];
|
|
62
|
+
let _sluggerConfiguration_extraInitializers = [];
|
|
63
|
+
let _includeHierarchySummary_decorators;
|
|
64
|
+
let _includeHierarchySummary_initializers = [];
|
|
65
|
+
let _includeHierarchySummary_extraInitializers = [];
|
|
66
|
+
return class BaseRouter {
|
|
67
|
+
static {
|
|
68
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
69
|
+
_sluggerConfiguration_decorators = [Option("sluggerConfiguration")];
|
|
70
|
+
_includeHierarchySummary_decorators = [Option("includeHierarchySummary")];
|
|
71
|
+
__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);
|
|
72
|
+
__esDecorate(this, null, _includeHierarchySummary_decorators, { kind: "accessor", name: "includeHierarchySummary", static: false, private: false, access: { has: obj => "includeHierarchySummary" in obj, get: obj => obj.includeHierarchySummary, set: (obj, value) => { obj.includeHierarchySummary = value; } }, metadata: _metadata }, _includeHierarchySummary_initializers, _includeHierarchySummary_extraInitializers);
|
|
73
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
74
|
+
}
|
|
75
|
+
application;
|
|
76
|
+
extension = ".html";
|
|
77
|
+
// Note: This will always contain lowercased names to avoid issues with
|
|
78
|
+
// case-insensitive file systems.
|
|
79
|
+
usedFileNames = new Set();
|
|
80
|
+
sluggers = new Map();
|
|
81
|
+
fullUrls = new Map();
|
|
82
|
+
anchors = new Map();
|
|
83
|
+
#sluggerConfiguration_accessor_storage = __runInitializers(this, _sluggerConfiguration_initializers, void 0);
|
|
84
|
+
get sluggerConfiguration() { return this.#sluggerConfiguration_accessor_storage; }
|
|
85
|
+
set sluggerConfiguration(value) { this.#sluggerConfiguration_accessor_storage = value; }
|
|
86
|
+
#includeHierarchySummary_accessor_storage = (__runInitializers(this, _sluggerConfiguration_extraInitializers), __runInitializers(this, _includeHierarchySummary_initializers, void 0));
|
|
87
|
+
get includeHierarchySummary() { return this.#includeHierarchySummary_accessor_storage; }
|
|
88
|
+
set includeHierarchySummary(value) { this.#includeHierarchySummary_accessor_storage = value; }
|
|
89
|
+
constructor(application) {
|
|
90
|
+
__runInitializers(this, _includeHierarchySummary_extraInitializers);
|
|
91
|
+
this.application = application;
|
|
92
|
+
}
|
|
93
|
+
buildPages(project) {
|
|
94
|
+
this.usedFileNames = new Set();
|
|
95
|
+
this.sluggers = new Map([
|
|
96
|
+
[project, new Slugger(this.sluggerConfiguration)],
|
|
97
|
+
]);
|
|
98
|
+
const pages = [];
|
|
99
|
+
if (project.readme?.length) {
|
|
100
|
+
pages.push({
|
|
101
|
+
url: this.getFileName("index"),
|
|
102
|
+
kind: PageKind.Index,
|
|
103
|
+
model: project,
|
|
104
|
+
});
|
|
105
|
+
pages.push({
|
|
106
|
+
url: this.getFileName("modules"),
|
|
107
|
+
kind: PageKind.Reflection,
|
|
108
|
+
model: project,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
pages.push({
|
|
113
|
+
url: this.getFileName("index"),
|
|
114
|
+
kind: PageKind.Reflection,
|
|
115
|
+
model: project,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
this.fullUrls.set(project, pages[pages.length - 1].url);
|
|
119
|
+
if (this.includeHierarchySummary && getHierarchyRoots(project)) {
|
|
120
|
+
pages.push({
|
|
121
|
+
url: this.getFileName("hierarchy"),
|
|
122
|
+
kind: PageKind.Hierarchy,
|
|
123
|
+
model: project,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
for (const child of project.childrenIncludingDocuments || []) {
|
|
127
|
+
this.buildChildPages(child, pages);
|
|
128
|
+
}
|
|
129
|
+
return pages;
|
|
130
|
+
}
|
|
131
|
+
hasUrl(reflection) {
|
|
132
|
+
return this.fullUrls.has(reflection);
|
|
133
|
+
}
|
|
134
|
+
getLinkableReflections() {
|
|
135
|
+
return Array.from(this.fullUrls.keys());
|
|
136
|
+
}
|
|
137
|
+
getAnchor(refl) {
|
|
138
|
+
if (!this.anchors.has(refl)) {
|
|
139
|
+
this.application.logger.verbose(`${refl.getFullName()} does not have an anchor but one was requested, this is a bug in the theme`);
|
|
140
|
+
}
|
|
141
|
+
return this.anchors.get(refl);
|
|
142
|
+
}
|
|
143
|
+
hasOwnDocument(refl) {
|
|
144
|
+
return this.anchors.get(refl) === undefined && this.hasUrl(refl);
|
|
145
|
+
}
|
|
146
|
+
relativeUrl(from, to) {
|
|
147
|
+
let slashes = 0;
|
|
148
|
+
while (!this.hasOwnDocument(from)) {
|
|
149
|
+
from = from.parent;
|
|
150
|
+
}
|
|
151
|
+
const fromUrl = this.getFullUrl(from);
|
|
152
|
+
const toUrl = this.getFullUrl(to);
|
|
153
|
+
let equal = true;
|
|
154
|
+
let start = 0;
|
|
155
|
+
for (let i = 0; i < fromUrl.length; ++i) {
|
|
156
|
+
equal = equal && fromUrl[i] === toUrl[i];
|
|
157
|
+
if (fromUrl[i] === "/") {
|
|
158
|
+
if (equal) {
|
|
159
|
+
start = i + 1;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
++slashes;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (equal && !to.isProject()) {
|
|
167
|
+
if (fromUrl === toUrl) {
|
|
168
|
+
return "";
|
|
169
|
+
}
|
|
170
|
+
return `#${this.getAnchor(to)}`;
|
|
171
|
+
}
|
|
172
|
+
return "../".repeat(slashes) + toUrl.substring(start);
|
|
173
|
+
}
|
|
174
|
+
baseRelativeUrl(from, target) {
|
|
175
|
+
let slashes = 0;
|
|
176
|
+
const full = this.getFullUrl(from);
|
|
177
|
+
for (let i = 0; i < full.length; ++i) {
|
|
178
|
+
if (full[i] === "/")
|
|
179
|
+
++slashes;
|
|
180
|
+
}
|
|
181
|
+
return "../".repeat(slashes) + target;
|
|
182
|
+
}
|
|
183
|
+
getFullUrl(refl) {
|
|
184
|
+
const url = this.fullUrls.get(refl);
|
|
185
|
+
if (!url) {
|
|
186
|
+
throw new Error(`Tried to get a URL of a reflection ${refl.getFullName()} which did not receive a URL`);
|
|
187
|
+
}
|
|
188
|
+
return url;
|
|
189
|
+
}
|
|
190
|
+
getSlugger(reflection) {
|
|
191
|
+
if (this.sluggers.has(reflection)) {
|
|
192
|
+
return this.sluggers.get(reflection);
|
|
193
|
+
}
|
|
194
|
+
// A slugger should always be defined at least for the project
|
|
195
|
+
return this.getSlugger(reflection.parent);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Should the page kind to use if a reflection should have its own rendered
|
|
199
|
+
* page in the output. Note that once `undefined` is returned, children of
|
|
200
|
+
* that reflection will not have their own document.
|
|
201
|
+
*/
|
|
202
|
+
getPageKind(reflection) {
|
|
203
|
+
const pageReflectionKinds = ReflectionKind.Class |
|
|
204
|
+
ReflectionKind.Interface |
|
|
205
|
+
ReflectionKind.Enum |
|
|
206
|
+
ReflectionKind.Module |
|
|
207
|
+
ReflectionKind.Namespace |
|
|
208
|
+
ReflectionKind.TypeAlias |
|
|
209
|
+
ReflectionKind.Function |
|
|
210
|
+
ReflectionKind.Variable;
|
|
211
|
+
const documentReflectionKinds = ReflectionKind.Document;
|
|
212
|
+
if (reflection.kindOf(pageReflectionKinds)) {
|
|
213
|
+
return PageKind.Reflection;
|
|
214
|
+
}
|
|
215
|
+
if (reflection.kindOf(documentReflectionKinds)) {
|
|
216
|
+
return PageKind.Document;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
buildChildPages(reflection, outPages) {
|
|
220
|
+
const kind = this.getPageKind(reflection);
|
|
221
|
+
if (kind) {
|
|
222
|
+
const idealName = this.getIdealBaseName(reflection);
|
|
223
|
+
const actualName = this.getFileName(idealName);
|
|
224
|
+
this.fullUrls.set(reflection, actualName);
|
|
225
|
+
this.sluggers.set(reflection, new Slugger(this.sluggerConfiguration));
|
|
226
|
+
outPages.push({
|
|
227
|
+
kind,
|
|
228
|
+
model: reflection,
|
|
229
|
+
url: actualName,
|
|
230
|
+
});
|
|
231
|
+
reflection.traverse((child) => {
|
|
232
|
+
this.buildChildPages(child, outPages);
|
|
233
|
+
return true;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.buildAnchors(reflection, reflection.parent);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
buildAnchors(reflection, pageReflection) {
|
|
241
|
+
if (!reflection.isDeclaration() &&
|
|
242
|
+
!reflection.isSignature() &&
|
|
243
|
+
!reflection.isTypeParameter()) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
// We support linking to reflections for types directly contained within an export
|
|
247
|
+
// but not any deeper. This is because TypeDoc may or may not render the type details
|
|
248
|
+
// for a property depending on whether or not it is deemed useful, and defining a link
|
|
249
|
+
// which might not be used may result in a link being generated which isn't valid. #2808.
|
|
250
|
+
// This should be kept in sync with the renderingChildIsUseful function.
|
|
251
|
+
if (reflection.kindOf(ReflectionKind.TypeLiteral) &&
|
|
252
|
+
(!reflection.parent?.kindOf(ReflectionKind.SomeExport) ||
|
|
253
|
+
reflection.parent.type?.type !==
|
|
254
|
+
"reflection")) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (!reflection.kindOf(ReflectionKind.TypeLiteral)) {
|
|
258
|
+
let refl = reflection;
|
|
259
|
+
const parts = [refl.name];
|
|
260
|
+
while (refl.parent && refl.parent !== pageReflection) {
|
|
261
|
+
refl = refl.parent;
|
|
262
|
+
// Avoid duplicate names for signatures and useless __type in anchors
|
|
263
|
+
if (!refl.kindOf(ReflectionKind.TypeLiteral |
|
|
264
|
+
ReflectionKind.FunctionOrMethod)) {
|
|
265
|
+
parts.unshift(refl.name);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const anchor = this.getSlugger(pageReflection).slug(parts.join("."));
|
|
269
|
+
this.fullUrls.set(reflection, this.fullUrls.get(pageReflection) + "#" + anchor);
|
|
270
|
+
this.anchors.set(reflection, anchor);
|
|
271
|
+
}
|
|
272
|
+
reflection.traverse((child) => {
|
|
273
|
+
this.buildAnchors(child, pageReflection);
|
|
274
|
+
return true;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/** Strip non-url safe characters from the specified string. */
|
|
278
|
+
getUrlSafeName(name) {
|
|
279
|
+
return createNormalizedUrl(name);
|
|
280
|
+
}
|
|
281
|
+
getFileName(baseName) {
|
|
282
|
+
const lowerBaseName = baseName.toLocaleLowerCase();
|
|
283
|
+
if (this.usedFileNames.has(lowerBaseName)) {
|
|
284
|
+
let index = 1;
|
|
285
|
+
while (this.usedFileNames.has(`${lowerBaseName}-${index}`)) {
|
|
286
|
+
++index;
|
|
287
|
+
}
|
|
288
|
+
this.usedFileNames.add(`${lowerBaseName}-${index}`);
|
|
289
|
+
return `${baseName}-${index}${this.extension}`;
|
|
290
|
+
}
|
|
291
|
+
this.usedFileNames.add(lowerBaseName);
|
|
292
|
+
return `${baseName}${this.extension}`;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
})();
|
|
296
|
+
export { BaseRouter };
|
|
297
|
+
/**
|
|
298
|
+
* Router which places reflections in folders according to their kind.
|
|
299
|
+
* @group Routers
|
|
300
|
+
*/
|
|
301
|
+
export class KindRouter extends BaseRouter {
|
|
302
|
+
directories = new Map([
|
|
303
|
+
[ReflectionKind.Class, "classes"],
|
|
304
|
+
[ReflectionKind.Interface, "interfaces"],
|
|
305
|
+
[ReflectionKind.Enum, "enums"],
|
|
306
|
+
[ReflectionKind.Namespace, "modules"],
|
|
307
|
+
[ReflectionKind.Module, "modules"],
|
|
308
|
+
[ReflectionKind.TypeAlias, "types"],
|
|
309
|
+
[ReflectionKind.Function, "functions"],
|
|
310
|
+
[ReflectionKind.Variable, "variables"],
|
|
311
|
+
[ReflectionKind.Document, "documents"],
|
|
312
|
+
]);
|
|
313
|
+
getIdealBaseName(reflection) {
|
|
314
|
+
const dir = this.directories.get(reflection.kind);
|
|
315
|
+
const parts = [createNormalizedUrl(reflection.name)];
|
|
316
|
+
while (reflection.parent && !reflection.parent.isProject()) {
|
|
317
|
+
reflection = reflection.parent;
|
|
318
|
+
parts.unshift(createNormalizedUrl(reflection.name));
|
|
319
|
+
}
|
|
320
|
+
const baseName = parts.join(".");
|
|
321
|
+
return `${dir}/${baseName}`;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Router which places reflections in folders according to their kind,
|
|
326
|
+
* but creates each page as `/index.html` to allow for clean URLs.
|
|
327
|
+
* @group Routers
|
|
328
|
+
*/
|
|
329
|
+
export class KindDirRouter extends KindRouter {
|
|
330
|
+
fixLink(link) {
|
|
331
|
+
return link.replace(/\/index\.html(#|$)/, "/$1");
|
|
332
|
+
}
|
|
333
|
+
buildChildPages(reflection, outPages) {
|
|
334
|
+
this.extension = `/index.html`;
|
|
335
|
+
return super.buildChildPages(reflection, outPages);
|
|
336
|
+
}
|
|
337
|
+
getFullUrl(refl) {
|
|
338
|
+
return this.fixLink(super.getFullUrl(refl));
|
|
339
|
+
}
|
|
340
|
+
relativeUrl(from, to) {
|
|
341
|
+
return this.fixLink(super.relativeUrl(from, to));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Router which places reflections in folders according to the module structure.
|
|
346
|
+
* @group Routers
|
|
347
|
+
*/
|
|
348
|
+
export class StructureRouter extends BaseRouter {
|
|
349
|
+
getIdealBaseName(reflection) {
|
|
350
|
+
// Special case: Modules allow slashes in their name. We actually want
|
|
351
|
+
// to allow that here to mirror file structures.
|
|
352
|
+
const parts = [...reflection.name.split("/").map(createNormalizedUrl)];
|
|
353
|
+
while (reflection.parent && !reflection.parent.isProject()) {
|
|
354
|
+
reflection = reflection.parent;
|
|
355
|
+
parts.unshift(...reflection.name.split("/").map(createNormalizedUrl));
|
|
356
|
+
}
|
|
357
|
+
// This should only happen if someone tries to break things with @module
|
|
358
|
+
// I don't think it will ever occur in normal usage.
|
|
359
|
+
if (parts.includes("..")) {
|
|
360
|
+
throw new Error("structure router cannot be used with a project that has a name containing '..'");
|
|
361
|
+
}
|
|
362
|
+
return parts.join("/");
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Router which places reflections in folders according to the module structure,
|
|
367
|
+
* but creates each page as `/index.html` to allow for clean URLs.
|
|
368
|
+
* @group Routers
|
|
369
|
+
*/
|
|
370
|
+
export class StructureDirRouter extends StructureRouter {
|
|
371
|
+
fixLink(link) {
|
|
372
|
+
return link.replace(/\/index\.html(#|$)/, "/$1");
|
|
373
|
+
}
|
|
374
|
+
buildChildPages(reflection, outPages) {
|
|
375
|
+
this.extension = `/index.html`;
|
|
376
|
+
return super.buildChildPages(reflection, outPages);
|
|
377
|
+
}
|
|
378
|
+
getFullUrl(refl) {
|
|
379
|
+
return this.fixLink(super.getFullUrl(refl));
|
|
380
|
+
}
|
|
381
|
+
relativeUrl(from, to) {
|
|
382
|
+
return this.fixLink(super.relativeUrl(from, to));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Router which places reflections in folders according to `@group` tags.
|
|
387
|
+
* @group Routers
|
|
388
|
+
*/
|
|
389
|
+
let GroupRouter = (() => {
|
|
390
|
+
let _classSuper = BaseRouter;
|
|
391
|
+
let _groupReferencesByType_decorators;
|
|
392
|
+
let _groupReferencesByType_initializers = [];
|
|
393
|
+
let _groupReferencesByType_extraInitializers = [];
|
|
394
|
+
return class GroupRouter extends _classSuper {
|
|
395
|
+
static {
|
|
396
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
397
|
+
_groupReferencesByType_decorators = [Option("groupReferencesByType")];
|
|
398
|
+
__esDecorate(this, null, _groupReferencesByType_decorators, { kind: "accessor", name: "groupReferencesByType", static: false, private: false, access: { has: obj => "groupReferencesByType" in obj, get: obj => obj.groupReferencesByType, set: (obj, value) => { obj.groupReferencesByType = value; } }, metadata: _metadata }, _groupReferencesByType_initializers, _groupReferencesByType_extraInitializers);
|
|
399
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
400
|
+
}
|
|
401
|
+
#groupReferencesByType_accessor_storage = __runInitializers(this, _groupReferencesByType_initializers, void 0);
|
|
402
|
+
get groupReferencesByType() { return this.#groupReferencesByType_accessor_storage; }
|
|
403
|
+
set groupReferencesByType(value) { this.#groupReferencesByType_accessor_storage = value; }
|
|
404
|
+
getGroup(reflection) {
|
|
405
|
+
if (reflection.isDeclaration() || reflection.isDocument()) {
|
|
406
|
+
const group = GroupPlugin.getGroups(reflection, this.groupReferencesByType);
|
|
407
|
+
return group.values().next().value;
|
|
408
|
+
}
|
|
409
|
+
throw new Error("Tried to render a non declaration/document to a page, not supported by GroupRouter");
|
|
410
|
+
}
|
|
411
|
+
getIdealBaseName(reflection) {
|
|
412
|
+
const group = this.getGroup(reflection)
|
|
413
|
+
.split("/")
|
|
414
|
+
.map(createNormalizedUrl)
|
|
415
|
+
.join("/");
|
|
416
|
+
const parts = [createNormalizedUrl(reflection.name)];
|
|
417
|
+
while (reflection.parent && !reflection.parent.isProject()) {
|
|
418
|
+
reflection = reflection.parent;
|
|
419
|
+
parts.unshift(createNormalizedUrl(reflection.name));
|
|
420
|
+
}
|
|
421
|
+
const baseName = parts.join(".");
|
|
422
|
+
return `${group}/${baseName}`;
|
|
423
|
+
}
|
|
424
|
+
constructor() {
|
|
425
|
+
super(...arguments);
|
|
426
|
+
__runInitializers(this, _groupReferencesByType_extraInitializers);
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
})();
|
|
430
|
+
export { GroupRouter };
|
|
431
|
+
/**
|
|
432
|
+
* Router which places reflections in folders according to `@category` tags.
|
|
433
|
+
* @group Routers
|
|
434
|
+
*/
|
|
435
|
+
let CategoryRouter = (() => {
|
|
436
|
+
let _classSuper = BaseRouter;
|
|
437
|
+
let _defaultCategory_decorators;
|
|
438
|
+
let _defaultCategory_initializers = [];
|
|
439
|
+
let _defaultCategory_extraInitializers = [];
|
|
440
|
+
return class CategoryRouter extends _classSuper {
|
|
441
|
+
static {
|
|
442
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
443
|
+
_defaultCategory_decorators = [Option("defaultCategory")];
|
|
444
|
+
__esDecorate(this, null, _defaultCategory_decorators, { kind: "accessor", name: "defaultCategory", static: false, private: false, access: { has: obj => "defaultCategory" in obj, get: obj => obj.defaultCategory, set: (obj, value) => { obj.defaultCategory = value; } }, metadata: _metadata }, _defaultCategory_initializers, _defaultCategory_extraInitializers);
|
|
445
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
446
|
+
}
|
|
447
|
+
#defaultCategory_accessor_storage = __runInitializers(this, _defaultCategory_initializers, void 0);
|
|
448
|
+
get defaultCategory() { return this.#defaultCategory_accessor_storage; }
|
|
449
|
+
set defaultCategory(value) { this.#defaultCategory_accessor_storage = value; }
|
|
450
|
+
getCategory(reflection) {
|
|
451
|
+
if (reflection.isDeclaration() || reflection.isDocument()) {
|
|
452
|
+
const cats = CategoryPlugin.getCategories(reflection);
|
|
453
|
+
return cats.size
|
|
454
|
+
? cats.values().next().value
|
|
455
|
+
: this.defaultCategory;
|
|
456
|
+
}
|
|
457
|
+
throw new Error("Tried to render a non declaration/document to a page, not supported by GroupRouter");
|
|
458
|
+
}
|
|
459
|
+
getIdealBaseName(reflection) {
|
|
460
|
+
const cat = this.getCategory(reflection)
|
|
461
|
+
.split("/")
|
|
462
|
+
.map(createNormalizedUrl)
|
|
463
|
+
.join("/");
|
|
464
|
+
const parts = [createNormalizedUrl(reflection.name)];
|
|
465
|
+
while (reflection.parent && !reflection.parent.isProject()) {
|
|
466
|
+
reflection = reflection.parent;
|
|
467
|
+
parts.unshift(createNormalizedUrl(reflection.name));
|
|
468
|
+
}
|
|
469
|
+
const baseName = parts.join(".");
|
|
470
|
+
return `${cat}/${baseName}`;
|
|
471
|
+
}
|
|
472
|
+
constructor() {
|
|
473
|
+
super(...arguments);
|
|
474
|
+
__runInitializers(this, _defaultCategory_extraInitializers);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
})();
|
|
478
|
+
export { CategoryRouter };
|
|
@@ -1,40 +1,15 @@
|
|
|
1
|
-
import type { ProjectReflection } from "../models/reflections/project.js";
|
|
2
|
-
import type { RenderTemplate, UrlMapping } from "./models/UrlMapping.js";
|
|
3
1
|
import { RendererComponent } from "./components.js";
|
|
4
2
|
import type { PageEvent } from "./events.js";
|
|
5
3
|
import type { Reflection } from "../models/index.js";
|
|
6
|
-
import type { Slugger } from "./themes/default/Slugger.js";
|
|
7
4
|
/**
|
|
8
5
|
* Base class of all themes.
|
|
9
6
|
*
|
|
10
|
-
* The theme class
|
|
11
|
-
*
|
|
12
|
-
* and templates to use. Additionally themes can subscribe to the events emitted by
|
|
13
|
-
* {@link Renderer} to control and manipulate the output process.
|
|
7
|
+
* The theme class determines how a page is rendered. It is loosely coupled with a router
|
|
8
|
+
* class instance which is also created by the {@link Renderer} class.
|
|
14
9
|
*/
|
|
15
10
|
export declare abstract class Theme extends RendererComponent {
|
|
16
|
-
private sluggers;
|
|
17
|
-
/**
|
|
18
|
-
* Map the models of the given project to the desired output files.
|
|
19
|
-
* It is assumed that with the project structure:
|
|
20
|
-
* ```text
|
|
21
|
-
* A
|
|
22
|
-
* |- B
|
|
23
|
-
* |- C
|
|
24
|
-
* ```
|
|
25
|
-
* If `B` has a UrlMapping, then `A` also has a UrlMapping, and `C` may or
|
|
26
|
-
* may not have a UrlMapping. If `B` does not have a UrlMapping, then `A`
|
|
27
|
-
* may or may not have a UrlMapping, but `C` must not have a UrlMapping.
|
|
28
|
-
*
|
|
29
|
-
* @param project The project whose urls should be generated.
|
|
30
|
-
* @returns A list of {@link UrlMapping} instances defining which models
|
|
31
|
-
* should be rendered to which files.
|
|
32
|
-
*/
|
|
33
|
-
abstract getUrls(project: ProjectReflection): UrlMapping<Reflection>[];
|
|
34
11
|
/**
|
|
35
12
|
* Renders the provided page to a string, which will be written to disk by the {@link Renderer}
|
|
36
13
|
*/
|
|
37
|
-
abstract render(
|
|
38
|
-
setSlugger(reflection: Reflection, slugger: Slugger): void;
|
|
39
|
-
getSlugger(reflection: Reflection): Slugger;
|
|
14
|
+
abstract render(event: PageEvent<Reflection>): string;
|
|
40
15
|
}
|
package/dist/lib/output/theme.js
CHANGED
|
@@ -2,21 +2,8 @@ import { RendererComponent } from "./components.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Base class of all themes.
|
|
4
4
|
*
|
|
5
|
-
* The theme class
|
|
6
|
-
*
|
|
7
|
-
* and templates to use. Additionally themes can subscribe to the events emitted by
|
|
8
|
-
* {@link Renderer} to control and manipulate the output process.
|
|
5
|
+
* The theme class determines how a page is rendered. It is loosely coupled with a router
|
|
6
|
+
* class instance which is also created by the {@link Renderer} class.
|
|
9
7
|
*/
|
|
10
8
|
export class Theme extends RendererComponent {
|
|
11
|
-
sluggers = new Map();
|
|
12
|
-
setSlugger(reflection, slugger) {
|
|
13
|
-
this.sluggers.set(reflection, slugger);
|
|
14
|
-
}
|
|
15
|
-
getSlugger(reflection) {
|
|
16
|
-
if (this.sluggers.has(reflection)) {
|
|
17
|
-
return this.sluggers.get(reflection);
|
|
18
|
-
}
|
|
19
|
-
// A slugger should always be defined at least for the project
|
|
20
|
-
return this.getSlugger(reflection.parent);
|
|
21
|
-
}
|
|
22
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextAwareRendererComponent } from "../components.js";
|
|
2
|
-
import { MarkdownEvent,
|
|
2
|
+
import { MarkdownEvent, type PageEvent, RendererEvent } from "../events.js";
|
|
3
3
|
import { type ValidationOptions } from "../../utils/index.js";
|
|
4
4
|
import type { BundledTheme } from "@gerrit0/mini-shiki";
|
|
5
5
|
import type { DefaultThemeRenderContext, Renderer } from "../index.js";
|
|
@@ -18,7 +18,7 @@ export declare class MarkedPlugin extends ContextAwareRendererComponent {
|
|
|
18
18
|
private renderedRelativeLinks;
|
|
19
19
|
/**
|
|
20
20
|
* This needing to be here really feels hacky... probably some nicer way to do this.
|
|
21
|
-
* Revisit
|
|
21
|
+
* Revisit in 0.28.
|
|
22
22
|
*/
|
|
23
23
|
private renderContext;
|
|
24
24
|
private lastHeaderSlug;
|