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,389 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const EXPORTABLE = models_1.ReflectionKind.Class |
|
|
10
|
-
models_1.ReflectionKind.Interface |
|
|
11
|
-
models_1.ReflectionKind.Enum |
|
|
12
|
-
models_1.ReflectionKind.TypeAlias |
|
|
13
|
-
models_1.ReflectionKind.Function |
|
|
14
|
-
models_1.ReflectionKind.Variable;
|
|
15
|
-
const nameCollisionCache = new WeakMap();
|
|
16
|
-
function getNameCollisionCount(project, name) {
|
|
17
|
-
let collisions = nameCollisionCache.get(project);
|
|
18
|
-
if (collisions === undefined) {
|
|
19
|
-
collisions = {};
|
|
20
|
-
for (const reflection of project.getReflectionsByKind(EXPORTABLE)) {
|
|
21
|
-
collisions[reflection.name] = (collisions[reflection.name] ?? 0) + 1;
|
|
22
|
-
}
|
|
23
|
-
nameCollisionCache.set(project, collisions);
|
|
24
|
-
}
|
|
25
|
-
return collisions[name] ?? 0;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Returns a (hopefully) globally unique path for the given reflection.
|
|
29
|
-
*
|
|
30
|
-
* This only works for exportable symbols, so e.g. methods are not affected by this.
|
|
31
|
-
*
|
|
32
|
-
* If the given reflection has a globally unique name already, then it will be returned as is. If the name is
|
|
33
|
-
* ambiguous (i.e. there are two classes with the same name in different namespaces), then the namespaces path of the
|
|
34
|
-
* reflection will be returned.
|
|
35
|
-
*/
|
|
36
|
-
function getUniquePath(reflection) {
|
|
37
|
-
if (reflection.kindOf(EXPORTABLE)) {
|
|
38
|
-
if (getNameCollisionCount(reflection.project, reflection.name) >= 2) {
|
|
39
|
-
return getNamespacedPath(reflection);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return [reflection];
|
|
43
|
-
}
|
|
44
|
-
function getNamespacedPath(reflection) {
|
|
45
|
-
const path = [reflection];
|
|
46
|
-
let parent = reflection.parent;
|
|
47
|
-
while (parent?.kindOf(models_1.ReflectionKind.Namespace)) {
|
|
48
|
-
path.unshift(parent);
|
|
49
|
-
parent = parent.parent;
|
|
50
|
-
}
|
|
51
|
-
return path;
|
|
52
|
-
}
|
|
53
|
-
function renderUniquePath(context, reflection) {
|
|
54
|
-
return (0, lib_1.join)(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "."), getUniquePath(reflection), (item) => (utils_1.JSX.createElement("a", { href: context.urlTo(item), class: "tsd-signature-type " + (0, lib_1.getKindClass)(item) }, item.name)));
|
|
55
|
-
}
|
|
56
|
-
const indentSize = 4;
|
|
57
|
-
let indentationDepth = 0;
|
|
58
|
-
function includeIndentation() {
|
|
59
|
-
return indentationDepth > 0 ? utils_1.JSX.createElement("span", null, "\u00A0".repeat(indentationDepth * indentSize)) : utils_1.JSX.createElement(utils_1.JSX.Fragment, null);
|
|
60
|
-
}
|
|
61
|
-
function validateStateIsClean(page) {
|
|
62
|
-
(0, assert_1.ok)(indentationDepth === 0, `Rendering ${page}: Indentation depth increment/decrement not matched: ${indentationDepth}`);
|
|
63
|
-
}
|
|
64
|
-
// The type helper accepts an optional needsParens parameter that is checked
|
|
65
|
-
// if an inner type may result in invalid output without them. For example:
|
|
66
|
-
// 1 | 2[] !== (1 | 2)[]
|
|
67
|
-
// () => 1 | 2 !== (() => 1) | 2
|
|
68
|
-
const typeRenderers = {
|
|
69
|
-
array(context, type) {
|
|
70
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
71
|
-
renderType(context, type.elementType, models_1.TypeContext.arrayElement),
|
|
72
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "[]")));
|
|
73
|
-
},
|
|
74
|
-
conditional(context, type) {
|
|
75
|
-
indentationDepth++;
|
|
76
|
-
const parts = [
|
|
77
|
-
renderType(context, type.checkType, models_1.TypeContext.conditionalCheck),
|
|
78
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " extends "),
|
|
79
|
-
renderType(context, type.extendsType, models_1.TypeContext.conditionalExtends),
|
|
80
|
-
utils_1.JSX.createElement("br", null),
|
|
81
|
-
includeIndentation(),
|
|
82
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "? "),
|
|
83
|
-
renderType(context, type.trueType, models_1.TypeContext.conditionalTrue),
|
|
84
|
-
utils_1.JSX.createElement("br", null),
|
|
85
|
-
includeIndentation(),
|
|
86
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": "),
|
|
87
|
-
renderType(context, type.falseType, models_1.TypeContext.conditionalFalse),
|
|
88
|
-
];
|
|
89
|
-
indentationDepth--;
|
|
90
|
-
return utils_1.JSX.createElement(utils_1.JSX.Fragment, null, parts);
|
|
91
|
-
},
|
|
92
|
-
indexedAccess(context, type) {
|
|
93
|
-
let indexType = renderType(context, type.indexType, models_1.TypeContext.indexedIndex);
|
|
94
|
-
if (type.objectType instanceof models_1.ReferenceType &&
|
|
95
|
-
type.objectType.reflection &&
|
|
96
|
-
type.indexType instanceof models_1.LiteralType &&
|
|
97
|
-
typeof type.indexType.value === "string") {
|
|
98
|
-
const childReflection = type.objectType.reflection.getChildByName([type.indexType.value]);
|
|
99
|
-
if (childReflection) {
|
|
100
|
-
indexType = utils_1.JSX.createElement("a", { href: context.urlTo(childReflection) }, indexType);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
104
|
-
renderType(context, type.objectType, models_1.TypeContext.indexedObject),
|
|
105
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "["),
|
|
106
|
-
indexType,
|
|
107
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "]")));
|
|
108
|
-
},
|
|
109
|
-
inferred(context, type) {
|
|
110
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
111
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "infer "),
|
|
112
|
-
" ",
|
|
113
|
-
utils_1.JSX.createElement("span", { class: "tsd-kind-type-parameter" }, type.name),
|
|
114
|
-
type.constraint && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
115
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " extends "),
|
|
116
|
-
renderType(context, type.constraint, models_1.TypeContext.inferredConstraint)))));
|
|
117
|
-
},
|
|
118
|
-
intersection(context, type) {
|
|
119
|
-
return (0, lib_1.join)(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " & "), type.types, (item) => renderType(context, item, models_1.TypeContext.intersectionElement));
|
|
120
|
-
},
|
|
121
|
-
intrinsic(_context, type) {
|
|
122
|
-
return utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, type.name);
|
|
123
|
-
},
|
|
124
|
-
literal(_context, type) {
|
|
125
|
-
return utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, (0, lib_1.stringify)(type.value));
|
|
126
|
-
},
|
|
127
|
-
mapped(context, type) {
|
|
128
|
-
indentationDepth++;
|
|
129
|
-
const parts = [utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "{"), utils_1.JSX.createElement("br", null), includeIndentation()];
|
|
130
|
-
switch (type.readonlyModifier) {
|
|
131
|
-
case "+":
|
|
132
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly "));
|
|
133
|
-
break;
|
|
134
|
-
case "-":
|
|
135
|
-
parts.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
136
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "-"),
|
|
137
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "readonly ")));
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "["), utils_1.JSX.createElement("span", { class: "tsd-kind-type-parameter" }, type.parameter), utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " in "), renderType(context, type.parameterType, models_1.TypeContext.mappedParameter));
|
|
141
|
-
if (type.nameType) {
|
|
142
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " as "), renderType(context, type.nameType, models_1.TypeContext.mappedName));
|
|
143
|
-
}
|
|
144
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "]"));
|
|
145
|
-
switch (type.optionalModifier) {
|
|
146
|
-
case "+":
|
|
147
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "?: "));
|
|
148
|
-
break;
|
|
149
|
-
case "-":
|
|
150
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "-?: "));
|
|
151
|
-
break;
|
|
152
|
-
default:
|
|
153
|
-
parts.push(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": "));
|
|
154
|
-
}
|
|
155
|
-
parts.push(renderType(context, type.templateType, models_1.TypeContext.mappedTemplate));
|
|
156
|
-
indentationDepth--;
|
|
157
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
158
|
-
parts,
|
|
159
|
-
utils_1.JSX.createElement("br", null),
|
|
160
|
-
includeIndentation(),
|
|
161
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "}")));
|
|
162
|
-
},
|
|
163
|
-
namedTupleMember(context, type) {
|
|
164
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
165
|
-
type.name,
|
|
166
|
-
type.isOptional ? (utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "?: ")) : (utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": ")),
|
|
167
|
-
renderType(context, type.element, models_1.TypeContext.tupleElement)));
|
|
168
|
-
},
|
|
169
|
-
optional(context, type) {
|
|
170
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
171
|
-
renderType(context, type.elementType, models_1.TypeContext.optionalElement),
|
|
172
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "?")));
|
|
173
|
-
},
|
|
174
|
-
predicate(context, type) {
|
|
175
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
176
|
-
!!type.asserts && utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "asserts "),
|
|
177
|
-
utils_1.JSX.createElement("span", { class: "tsd-kind-parameter" }, type.name),
|
|
178
|
-
!!type.targetType && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
179
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, " is "),
|
|
180
|
-
renderType(context, type.targetType, models_1.TypeContext.predicateTarget)))));
|
|
181
|
-
},
|
|
182
|
-
query(context, type) {
|
|
183
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
184
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "typeof "),
|
|
185
|
-
renderType(context, type.queryType, models_1.TypeContext.queryTypeTarget)));
|
|
186
|
-
},
|
|
187
|
-
reference(context, type) {
|
|
188
|
-
const reflection = type.reflection;
|
|
189
|
-
let name;
|
|
190
|
-
if (reflection) {
|
|
191
|
-
if (reflection.kindOf(models_1.ReflectionKind.TypeParameter)) {
|
|
192
|
-
name = (utils_1.JSX.createElement("a", { class: "tsd-signature-type tsd-kind-type-parameter", href: context.urlTo(reflection) }, reflection.name));
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
name = renderUniquePath(context, reflection);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else if (type.externalUrl) {
|
|
199
|
-
name = (utils_1.JSX.createElement("a", { href: type.externalUrl, class: "tsd-signature-type external", target: "_blank" }, type.name));
|
|
200
|
-
}
|
|
201
|
-
else if (type.refersToTypeParameter) {
|
|
202
|
-
name = utils_1.JSX.createElement("span", { class: "tsd-signature-type tsd-kind-type-parameter" }, type.name);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
name = utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, type.name);
|
|
206
|
-
}
|
|
207
|
-
if (type.typeArguments?.length) {
|
|
208
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
209
|
-
name,
|
|
210
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "<"),
|
|
211
|
-
(0, lib_1.join)(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), type.typeArguments, (item) => renderType(context, item, models_1.TypeContext.referenceTypeArgument)),
|
|
212
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ">")));
|
|
213
|
-
}
|
|
214
|
-
return name;
|
|
215
|
-
},
|
|
216
|
-
reflection(context, type, { topLevelLinks }) {
|
|
217
|
-
const members = [];
|
|
218
|
-
const children = type.declaration.children || [];
|
|
219
|
-
indentationDepth++;
|
|
220
|
-
const renderName = (named) => topLevelLinks ? (utils_1.JSX.createElement("a", { class: (0, lib_1.getKindClass)(named), href: context.urlTo(named) }, named.name)) : (utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(named) }, named.name));
|
|
221
|
-
for (const item of children) {
|
|
222
|
-
if (item.getSignature && item.setSignature) {
|
|
223
|
-
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
224
|
-
renderName(item),
|
|
225
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": "),
|
|
226
|
-
renderType(context, item.getSignature.type, models_1.TypeContext.none)));
|
|
227
|
-
continue;
|
|
228
|
-
}
|
|
229
|
-
if (item.getSignature) {
|
|
230
|
-
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
231
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "get "),
|
|
232
|
-
renderName(item.getSignature),
|
|
233
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "(): "),
|
|
234
|
-
renderType(context, item.getSignature.type, models_1.TypeContext.none)));
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
if (item.setSignature) {
|
|
238
|
-
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
239
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "set "),
|
|
240
|
-
renderName(item.setSignature),
|
|
241
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
|
|
242
|
-
item.setSignature.parameters?.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
243
|
-
item.name,
|
|
244
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": "),
|
|
245
|
-
renderType(context, item.type, models_1.TypeContext.none)))),
|
|
246
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ")")));
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
if (item.signatures) {
|
|
250
|
-
for (const sig of item.signatures) {
|
|
251
|
-
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
252
|
-
renderName(sig),
|
|
253
|
-
item.flags.isOptional && utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "?"),
|
|
254
|
-
context.memberSignatureTitle(sig, {
|
|
255
|
-
hideName: true,
|
|
256
|
-
arrowStyle: false,
|
|
257
|
-
hideParamTypes: false,
|
|
258
|
-
})));
|
|
259
|
-
}
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
263
|
-
renderName(item),
|
|
264
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, item.flags.isOptional ? "?: " : ": "),
|
|
265
|
-
renderType(context, item.type, models_1.TypeContext.none)));
|
|
266
|
-
}
|
|
267
|
-
if (type.declaration.indexSignatures) {
|
|
268
|
-
for (const index of type.declaration.indexSignatures) {
|
|
269
|
-
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
270
|
-
"[",
|
|
271
|
-
utils_1.JSX.createElement("span", { class: (0, lib_1.getKindClass)(index) }, index.parameters[0].name),
|
|
272
|
-
":",
|
|
273
|
-
" ",
|
|
274
|
-
renderType(context, index.parameters[0].type, models_1.TypeContext.none),
|
|
275
|
-
"]",
|
|
276
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ": "),
|
|
277
|
-
renderType(context, index.type, models_1.TypeContext.none)));
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
if (!members.length && type.declaration.signatures?.length === 1) {
|
|
281
|
-
indentationDepth--;
|
|
282
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
283
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
|
|
284
|
-
context.memberSignatureTitle(type.declaration.signatures[0], {
|
|
285
|
-
hideName: true,
|
|
286
|
-
arrowStyle: true,
|
|
287
|
-
hideParamTypes: false,
|
|
288
|
-
}),
|
|
289
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ")")));
|
|
290
|
-
}
|
|
291
|
-
for (const item of type.declaration.signatures || []) {
|
|
292
|
-
members.push(context.memberSignatureTitle(item, { hideName: true, hideParamTypes: false }));
|
|
293
|
-
}
|
|
294
|
-
if (members.length) {
|
|
295
|
-
const membersWithSeparators = members.flatMap((m) => [
|
|
296
|
-
includeIndentation(),
|
|
297
|
-
m,
|
|
298
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "; "),
|
|
299
|
-
utils_1.JSX.createElement("br", null),
|
|
300
|
-
]);
|
|
301
|
-
membersWithSeparators.pop();
|
|
302
|
-
indentationDepth--;
|
|
303
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
304
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" },
|
|
305
|
-
"{",
|
|
306
|
-
" "),
|
|
307
|
-
utils_1.JSX.createElement("br", null),
|
|
308
|
-
membersWithSeparators,
|
|
309
|
-
utils_1.JSX.createElement("br", null),
|
|
310
|
-
includeIndentation(),
|
|
311
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "}")));
|
|
312
|
-
}
|
|
313
|
-
indentationDepth--;
|
|
314
|
-
return utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "{}");
|
|
315
|
-
},
|
|
316
|
-
rest(context, type) {
|
|
317
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
318
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
|
|
319
|
-
renderType(context, type.elementType, models_1.TypeContext.restElement)));
|
|
320
|
-
},
|
|
321
|
-
templateLiteral(context, type) {
|
|
322
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
323
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "`"),
|
|
324
|
-
type.head && utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, type.head),
|
|
325
|
-
type.tail.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
326
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "${"),
|
|
327
|
-
renderType(context, item[0], models_1.TypeContext.templateLiteralElement),
|
|
328
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "}"),
|
|
329
|
-
item[1] && utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, item[1])))),
|
|
330
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "`")));
|
|
331
|
-
},
|
|
332
|
-
tuple(context, type) {
|
|
333
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
334
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "["),
|
|
335
|
-
(0, lib_1.join)(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ", "), type.elements, (item) => renderType(context, item, models_1.TypeContext.tupleElement)),
|
|
336
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "]")));
|
|
337
|
-
},
|
|
338
|
-
typeOperator(context, type) {
|
|
339
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
340
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" },
|
|
341
|
-
type.operator,
|
|
342
|
-
" "),
|
|
343
|
-
renderType(context, type.target, models_1.TypeContext.typeOperatorTarget)));
|
|
344
|
-
},
|
|
345
|
-
union(context, type) {
|
|
346
|
-
// This could likely be improved with some print width based heuristic like
|
|
347
|
-
// how prettier works, but my initial investigation with it didn't consistently
|
|
348
|
-
// produce better results than this much simpler method as the print width
|
|
349
|
-
// method doesn't track how far into the current line we are, and I don't want
|
|
350
|
-
// to spend the time right now to properly track that here. PR welcome if someone
|
|
351
|
-
// wants to take the time to make that a real capability.
|
|
352
|
-
// https://gist.github.com/Gerrit0/5cebc127fd4b181e49e354b786d181d7
|
|
353
|
-
if (type.types.length > 3) {
|
|
354
|
-
++indentationDepth;
|
|
355
|
-
const membersWithSeparators = type.types.flatMap((item) => [
|
|
356
|
-
includeIndentation(),
|
|
357
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "| "),
|
|
358
|
-
renderType(context, item, models_1.TypeContext.unionElement),
|
|
359
|
-
utils_1.JSX.createElement("br", null),
|
|
360
|
-
]);
|
|
361
|
-
membersWithSeparators.pop();
|
|
362
|
-
--indentationDepth;
|
|
363
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
364
|
-
utils_1.JSX.createElement("br", null),
|
|
365
|
-
membersWithSeparators));
|
|
366
|
-
}
|
|
367
|
-
return (0, lib_1.join)(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, " | "), type.types, (item) => renderType(context, item, models_1.TypeContext.unionElement));
|
|
368
|
-
},
|
|
369
|
-
unknown(_context, type) {
|
|
370
|
-
return utils_1.JSX.createElement(utils_1.JSX.Fragment, null, type.name);
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
function renderType(context, type, where, options = { topLevelLinks: false }) {
|
|
374
|
-
if (!type) {
|
|
375
|
-
return utils_1.JSX.createElement("span", { class: "tsd-signature-type" }, "any");
|
|
376
|
-
}
|
|
377
|
-
const renderFn = typeRenderers[type.type];
|
|
378
|
-
const rendered = renderFn(context, type, options);
|
|
379
|
-
if (type.needsParenthesis(where)) {
|
|
380
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
381
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
|
|
382
|
-
rendered,
|
|
383
|
-
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, ")")));
|
|
384
|
-
}
|
|
385
|
-
return rendered;
|
|
386
|
-
}
|
|
387
|
-
function type(context, type, options = { topLevelLinks: false }) {
|
|
388
|
-
return renderType(context, type, models_1.TypeContext.none, options);
|
|
1
|
+
import { FormattedCodeBuilder, FormattedCodeGenerator, Wrap } from "../../../formatter.js";
|
|
2
|
+
import { TypeContext } from "../../../../models/types.js";
|
|
3
|
+
export function type(context, type, options = { topLevelLinks: false }) {
|
|
4
|
+
const builder = new FormattedCodeBuilder(context.urlTo);
|
|
5
|
+
const tree = builder.type(type, TypeContext.none, options);
|
|
6
|
+
const generator = new FormattedCodeGenerator(context.options.getValue("typePrintWidth"));
|
|
7
|
+
generator.node(tree, Wrap.Detect);
|
|
8
|
+
return generator.toElement();
|
|
389
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
2
|
-
import { type Type } from "../../../../models";
|
|
3
|
-
import { JSX } from "../../../../utils";
|
|
1
|
+
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext.js";
|
|
2
|
+
import { type Type } from "../../../../models/index.js";
|
|
3
|
+
import { JSX } from "../../../../utils/index.js";
|
|
4
4
|
export declare const typeAndParent: (context: DefaultThemeRenderContext, props: Type) => JSX.Element;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const typeAndParent = (context, props) => {
|
|
7
|
-
if (props instanceof models_1.ArrayType) {
|
|
8
|
-
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
1
|
+
import { ArrayType, ReferenceType, SignatureReflection } from "../../../../models/index.js";
|
|
2
|
+
import { JSX } from "../../../../utils/index.js";
|
|
3
|
+
export const typeAndParent = (context, props) => {
|
|
4
|
+
if (props instanceof ArrayType) {
|
|
5
|
+
return (JSX.createElement(JSX.Fragment, null,
|
|
9
6
|
context.typeAndParent(props.elementType),
|
|
10
7
|
"[]"));
|
|
11
8
|
}
|
|
12
|
-
if (props instanceof
|
|
13
|
-
const refl = props.reflection instanceof
|
|
9
|
+
if (props instanceof ReferenceType && props.reflection) {
|
|
10
|
+
const refl = props.reflection instanceof SignatureReflection ? props.reflection.parent : props.reflection;
|
|
14
11
|
const parent = refl.parent;
|
|
15
|
-
return (
|
|
16
|
-
parent?.url ?
|
|
12
|
+
return (JSX.createElement(JSX.Fragment, null,
|
|
13
|
+
parent?.url ? JSX.createElement("a", { href: context.urlTo(parent) }, parent.name) : parent?.name,
|
|
17
14
|
".",
|
|
18
|
-
refl.url ?
|
|
15
|
+
refl.url ? JSX.createElement("a", { href: context.urlTo(refl) }, refl.name) : refl.name));
|
|
19
16
|
}
|
|
20
|
-
return
|
|
17
|
+
return JSX.createElement(JSX.Fragment, null, props.toString());
|
|
21
18
|
};
|
|
22
|
-
exports.typeAndParent = typeAndParent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CommentDisplayPart } from "../../../../models/index.js";
|
|
2
|
+
import type { SomeType } from "../../../../models/types.js";
|
|
3
|
+
import { JSX } from "../../../../utils/index.js";
|
|
4
|
+
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext.js";
|
|
5
|
+
export declare function typeDeclaration(context: DefaultThemeRenderContext, type: SomeType): JSX.Children;
|
|
6
|
+
export declare function typeDetails(context: DefaultThemeRenderContext, type: SomeType, renderAnchors: boolean): JSX.Children;
|
|
7
|
+
export declare function typeDetailsImpl(context: DefaultThemeRenderContext, type: SomeType, renderAnchors: boolean, highlighted?: Map<string, CommentDisplayPart[]>): JSX.Children;
|
|
8
|
+
export declare function typeDetailsIfUseful(context: DefaultThemeRenderContext, type: SomeType | undefined): JSX.Children;
|