typedoc 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/application.d.ts +2 -2
- package/dist/lib/application.js +6 -4
- package/dist/lib/cli.js +1 -1
- package/dist/lib/converter/comments/index.js +6 -1
- package/dist/lib/converter/context.js +2 -2
- package/dist/lib/converter/converter.d.ts +3 -3
- package/dist/lib/converter/converter.js +13 -6
- package/dist/lib/converter/factories/signature.d.ts +1 -0
- package/dist/lib/converter/factories/signature.js +28 -5
- package/dist/lib/converter/plugins/CategoryPlugin.js +1 -1
- package/dist/lib/converter/plugins/GroupPlugin.js +3 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +2 -0
- package/dist/lib/converter/symbols.js +6 -2
- package/dist/lib/converter/types.js +28 -10
- package/dist/lib/internationalization/locales/en.cjs +1 -1
- package/dist/lib/internationalization/locales/en.d.cts +1 -1
- package/dist/lib/internationalization/locales/ja.cjs +0 -1
- package/dist/lib/internationalization/locales/zh.cjs +6 -1
- package/dist/lib/internationalization/locales/zh.d.cts +6 -1
- package/dist/lib/models/types.js +264 -216
- package/dist/lib/output/renderer.d.ts +5 -1
- package/dist/lib/output/renderer.js +9 -1
- package/dist/lib/output/router.js +17 -5
- package/dist/lib/output/themes/MarkedPlugin.js +6 -1
- package/dist/lib/output/themes/default/partials/index.js +5 -13
- package/dist/lib/output/themes/default/partials/members.js +9 -6
- package/dist/lib/output/themes/default/partials/moduleReflection.js +15 -8
- package/dist/lib/output/themes/default/partials/navigation.js +13 -5
- package/dist/lib/output/themes/lib.d.ts +3 -2
- package/dist/lib/output/themes/lib.js +22 -15
- package/dist/lib/serialization/deserializer.d.ts +1 -1
- package/dist/lib/serialization/deserializer.js +1 -1
- package/dist/lib/serialization/serializer.d.ts +1 -1
- package/dist/lib/serialization/serializer.js +1 -1
- package/dist/lib/utils/entry-point.js +5 -6
- package/dist/lib/utils/highlighter.js +3 -2
- package/dist/lib/utils/options/declaration.js +11 -1
- package/dist/lib/utils/options/defaults.js +2 -0
- package/dist/lib/utils/options/options.d.ts +1 -1
- package/dist/lib/utils/options/options.js +1 -1
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -0
- package/dist/lib/utils/options/readers/arguments.js +17 -4
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
- package/dist/lib/utils-common/array.d.ts +1 -0
- package/dist/lib/utils-common/array.js +1 -0
- package/dist/lib/utils-common/events.d.ts +1 -0
- package/dist/lib/utils-common/events.js +1 -0
- package/package.json +10 -10
- package/static/style.css +4 -4
- package/tsdoc.json +5 -0
package/dist/lib/models/types.js
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
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
|
+
};
|
|
1
35
|
import { ReflectionSymbolId } from "./ReflectionSymbolId.js";
|
|
2
36
|
import { ReflectionKind } from "./kind.js";
|
|
3
37
|
import { Comment } from "./Comment.js";
|
|
4
|
-
import { i18n, joinArray } from "#utils";
|
|
38
|
+
import { i18n, joinArray, NonEnumerable } from "#utils";
|
|
5
39
|
/**
|
|
6
40
|
* Base class of all type definitions.
|
|
7
41
|
* @category Types
|
|
@@ -658,227 +692,241 @@ export class QueryType extends Type {
|
|
|
658
692
|
* ```
|
|
659
693
|
* @category Types
|
|
660
694
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
*/
|
|
673
|
-
typeArguments;
|
|
674
|
-
/**
|
|
675
|
-
* The resolved reflection.
|
|
676
|
-
*/
|
|
677
|
-
get reflection() {
|
|
678
|
-
if (typeof this._target === "number") {
|
|
679
|
-
return this._project?.getReflectionById(this._target);
|
|
680
|
-
}
|
|
681
|
-
const resolvePotential = this._project?.getReflectionsFromSymbolId(this._target);
|
|
682
|
-
if (!resolvePotential?.length) {
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
const kind = this.preferValues
|
|
686
|
-
? ReflectionKind.ValueReferenceTarget
|
|
687
|
-
: ReflectionKind.TypeReferenceTarget;
|
|
688
|
-
const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) ||
|
|
689
|
-
resolvePotential.find((refl) => refl.kindOf(~kind));
|
|
690
|
-
// Do not mark the type as resolved at this point so that if it
|
|
691
|
-
// points to a member which is removed (e.g. by typedoc-plugin-zod)
|
|
692
|
-
// and then replaced it still ends up pointing at the right reflection.
|
|
693
|
-
// We will lock type reference resolution when serializing to JSON.
|
|
694
|
-
// this._target = resolved.id;
|
|
695
|
-
return resolved;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Sometimes a few properties are more important than the rest
|
|
699
|
-
* of the properties within a type. This occurs most often with
|
|
700
|
-
* object parameters, where users want to specify `@param foo.bar`
|
|
701
|
-
* to highlight something about the `bar` property.
|
|
702
|
-
*
|
|
703
|
-
* Does NOT support nested properties.
|
|
704
|
-
*/
|
|
705
|
-
highlightedProperties;
|
|
706
|
-
/**
|
|
707
|
-
* If not resolved, the symbol id of the reflection, otherwise undefined.
|
|
708
|
-
*/
|
|
709
|
-
get symbolId() {
|
|
710
|
-
if (!this.reflection && typeof this._target === "object") {
|
|
711
|
-
return this._target;
|
|
695
|
+
let ReferenceType = (() => {
|
|
696
|
+
let _classSuper = Type;
|
|
697
|
+
let __project_decorators;
|
|
698
|
+
let __project_initializers = [];
|
|
699
|
+
let __project_extraInitializers = [];
|
|
700
|
+
return class ReferenceType extends _classSuper {
|
|
701
|
+
static {
|
|
702
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
703
|
+
__project_decorators = [NonEnumerable];
|
|
704
|
+
__esDecorate(null, null, __project_decorators, { kind: "field", name: "_project", static: false, private: false, access: { has: obj => "_project" in obj, get: obj => obj._project, set: (obj, value) => { obj._project = value; } }, metadata: _metadata }, __project_initializers, __project_extraInitializers);
|
|
705
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
712
706
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
package;
|
|
748
|
-
/**
|
|
749
|
-
* If this reference type refers to a reflection defined by a project not being rendered,
|
|
750
|
-
* points to the url that this type should be linked to.
|
|
751
|
-
*/
|
|
752
|
-
externalUrl;
|
|
753
|
-
/**
|
|
754
|
-
* If set, no warnings about something not being exported should be created
|
|
755
|
-
* since this may be referring to a type created with `infer X` which will not
|
|
756
|
-
* be registered on the project.
|
|
757
|
-
*/
|
|
758
|
-
refersToTypeParameter = false;
|
|
759
|
-
/**
|
|
760
|
-
* If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
|
|
761
|
-
* values rather than those which represent types.
|
|
762
|
-
*/
|
|
763
|
-
preferValues = false;
|
|
764
|
-
_target;
|
|
765
|
-
_project;
|
|
766
|
-
constructor(name, target, project, qualifiedName) {
|
|
767
|
-
super();
|
|
768
|
-
this.name = name;
|
|
769
|
-
if (typeof target === "number") {
|
|
770
|
-
this._target = target;
|
|
707
|
+
type = "reference";
|
|
708
|
+
/**
|
|
709
|
+
* The name of the referenced type.
|
|
710
|
+
*
|
|
711
|
+
* If the symbol cannot be found because it's not part of the documentation this
|
|
712
|
+
* can be used to represent the type.
|
|
713
|
+
*/
|
|
714
|
+
name;
|
|
715
|
+
/**
|
|
716
|
+
* The type arguments of this reference.
|
|
717
|
+
*/
|
|
718
|
+
typeArguments;
|
|
719
|
+
/**
|
|
720
|
+
* The resolved reflection.
|
|
721
|
+
*/
|
|
722
|
+
get reflection() {
|
|
723
|
+
if (typeof this._target === "number") {
|
|
724
|
+
return this._project?.getReflectionById(this._target);
|
|
725
|
+
}
|
|
726
|
+
const resolvePotential = this._project?.getReflectionsFromSymbolId(this._target);
|
|
727
|
+
if (!resolvePotential?.length) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
const kind = this.preferValues
|
|
731
|
+
? ReflectionKind.ValueReferenceTarget
|
|
732
|
+
: ReflectionKind.TypeReferenceTarget;
|
|
733
|
+
const resolved = resolvePotential.find((refl) => refl.kindOf(kind)) ||
|
|
734
|
+
resolvePotential.find((refl) => refl.kindOf(~kind));
|
|
735
|
+
// Do not mark the type as resolved at this point so that if it
|
|
736
|
+
// points to a member which is removed (e.g. by typedoc-plugin-zod)
|
|
737
|
+
// and then replaced it still ends up pointing at the right reflection.
|
|
738
|
+
// We will lock type reference resolution when serializing to JSON.
|
|
739
|
+
// this._target = resolved.id;
|
|
740
|
+
return resolved;
|
|
771
741
|
}
|
|
772
|
-
|
|
773
|
-
|
|
742
|
+
/**
|
|
743
|
+
* Sometimes a few properties are more important than the rest
|
|
744
|
+
* of the properties within a type. This occurs most often with
|
|
745
|
+
* object parameters, where users want to specify `@param foo.bar`
|
|
746
|
+
* to highlight something about the `bar` property.
|
|
747
|
+
*
|
|
748
|
+
* Does NOT support nested properties.
|
|
749
|
+
*/
|
|
750
|
+
highlightedProperties;
|
|
751
|
+
/**
|
|
752
|
+
* If not resolved, the symbol id of the reflection, otherwise undefined.
|
|
753
|
+
*/
|
|
754
|
+
get symbolId() {
|
|
755
|
+
if (!this.reflection && typeof this._target === "object") {
|
|
756
|
+
return this._target;
|
|
757
|
+
}
|
|
774
758
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
* This is used for type parameters, which don't actually point to something,
|
|
786
|
-
* and also for temporary references which will be cleaned up with real references
|
|
787
|
-
* later during conversion.
|
|
788
|
-
* @internal
|
|
789
|
-
*/
|
|
790
|
-
static createBrokenReference(name, project) {
|
|
791
|
-
return new ReferenceType(name, -1, project, name);
|
|
792
|
-
}
|
|
793
|
-
getTypeString() {
|
|
794
|
-
const name = this.reflection ? this.reflection.name : this.name;
|
|
795
|
-
let typeArgs = "";
|
|
796
|
-
if (this.typeArguments && this.typeArguments.length > 0) {
|
|
797
|
-
typeArgs += "<";
|
|
798
|
-
typeArgs += this.typeArguments
|
|
799
|
-
.map((arg) => arg.stringify(TypeContext.referenceTypeArgument))
|
|
800
|
-
.join(", ");
|
|
801
|
-
typeArgs += ">";
|
|
759
|
+
/**
|
|
760
|
+
* Checks if this type is a reference type because it uses a name, but is intentionally not pointing
|
|
761
|
+
* to a reflection. This happens for type parameters and when representing a mapped type.
|
|
762
|
+
*/
|
|
763
|
+
isIntentionallyBroken() {
|
|
764
|
+
if (typeof this._target === "object" &&
|
|
765
|
+
this._project?.symbolIdHasBeenRemoved(this._target)) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
return this._target === -1 || this.refersToTypeParameter;
|
|
802
769
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
770
|
+
/**
|
|
771
|
+
* Convert this reference type to a declaration reference used for resolution of external types.
|
|
772
|
+
*/
|
|
773
|
+
toDeclarationReference() {
|
|
774
|
+
return {
|
|
775
|
+
resolutionStart: "global",
|
|
776
|
+
moduleSource: this.package,
|
|
777
|
+
symbolReference: {
|
|
778
|
+
path: this.qualifiedName
|
|
779
|
+
.split(".")
|
|
780
|
+
.map((p) => ({ path: p, navigation: "." })),
|
|
781
|
+
},
|
|
782
|
+
};
|
|
812
783
|
}
|
|
813
|
-
|
|
814
|
-
|
|
784
|
+
/**
|
|
785
|
+
* The fully qualified name of the referenced type, relative to the file it is defined in.
|
|
786
|
+
* This will usually be the same as `name`, unless namespaces are used.
|
|
787
|
+
*/
|
|
788
|
+
qualifiedName;
|
|
789
|
+
/**
|
|
790
|
+
* The package that this type is referencing.
|
|
791
|
+
*/
|
|
792
|
+
package;
|
|
793
|
+
/**
|
|
794
|
+
* If this reference type refers to a reflection defined by a project not being rendered,
|
|
795
|
+
* points to the url that this type should be linked to.
|
|
796
|
+
*/
|
|
797
|
+
externalUrl;
|
|
798
|
+
/**
|
|
799
|
+
* If set, no warnings about something not being exported should be created
|
|
800
|
+
* since this may be referring to a type created with `infer X` which will not
|
|
801
|
+
* be registered on the project.
|
|
802
|
+
*/
|
|
803
|
+
refersToTypeParameter = false;
|
|
804
|
+
/**
|
|
805
|
+
* If set, will prefer reflections with {@link ReflectionKind | ReflectionKinds} which represent
|
|
806
|
+
* values rather than those which represent types.
|
|
807
|
+
*/
|
|
808
|
+
preferValues = false;
|
|
809
|
+
_target;
|
|
810
|
+
_project = __runInitializers(this, __project_initializers, void 0);
|
|
811
|
+
constructor(name, target, project, qualifiedName) {
|
|
812
|
+
super();
|
|
813
|
+
__runInitializers(this, __project_extraInitializers);
|
|
814
|
+
this.name = name;
|
|
815
|
+
if (typeof target === "number") {
|
|
816
|
+
this._target = target;
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
this._target = "variant" in target ? target.id : target;
|
|
820
|
+
}
|
|
821
|
+
this._project = project;
|
|
822
|
+
this.qualifiedName = qualifiedName;
|
|
815
823
|
}
|
|
816
|
-
|
|
817
|
-
target
|
|
824
|
+
static createUnresolvedReference(name, target, project, qualifiedName) {
|
|
825
|
+
return new ReferenceType(name, target, project, qualifiedName);
|
|
818
826
|
}
|
|
819
|
-
|
|
820
|
-
target
|
|
827
|
+
static createResolvedReference(name, target, project) {
|
|
828
|
+
return new ReferenceType(name, target, project, name);
|
|
821
829
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
if (this.name !== this.qualifiedName) {
|
|
831
|
-
result.qualifiedName = this.qualifiedName;
|
|
830
|
+
/**
|
|
831
|
+
* This is used for type parameters, which don't actually point to something,
|
|
832
|
+
* and also for temporary references which will be cleaned up with real references
|
|
833
|
+
* later during conversion.
|
|
834
|
+
* @internal
|
|
835
|
+
*/
|
|
836
|
+
static createBrokenReference(name, project) {
|
|
837
|
+
return new ReferenceType(name, -1, project, name);
|
|
832
838
|
}
|
|
833
|
-
|
|
834
|
-
|
|
839
|
+
getTypeString() {
|
|
840
|
+
const name = this.reflection ? this.reflection.name : this.name;
|
|
841
|
+
let typeArgs = "";
|
|
842
|
+
if (this.typeArguments && this.typeArguments.length > 0) {
|
|
843
|
+
typeArgs += "<";
|
|
844
|
+
typeArgs += this.typeArguments
|
|
845
|
+
.map((arg) => arg.stringify(TypeContext.referenceTypeArgument))
|
|
846
|
+
.join(", ");
|
|
847
|
+
typeArgs += ">";
|
|
848
|
+
}
|
|
849
|
+
return name + typeArgs;
|
|
835
850
|
}
|
|
836
|
-
|
|
837
|
-
|
|
851
|
+
needsParenthesis() {
|
|
852
|
+
return false;
|
|
838
853
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
854
|
+
toObject(serializer) {
|
|
855
|
+
let target;
|
|
856
|
+
if (typeof this._target === "number") {
|
|
857
|
+
target = this._target;
|
|
858
|
+
}
|
|
859
|
+
else if (this._project?.symbolIdHasBeenRemoved(this._target)) {
|
|
860
|
+
target = -1;
|
|
861
|
+
}
|
|
862
|
+
else if (this.reflection) {
|
|
863
|
+
target = this.reflection.id;
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
target = this._target.toObject();
|
|
867
|
+
}
|
|
868
|
+
const result = {
|
|
869
|
+
type: this.type,
|
|
870
|
+
target,
|
|
871
|
+
typeArguments: serializer.toObjectsOptional(this.typeArguments),
|
|
872
|
+
name: this.name,
|
|
873
|
+
package: this.package,
|
|
874
|
+
externalUrl: this.externalUrl,
|
|
875
|
+
};
|
|
876
|
+
if (this.name !== this.qualifiedName) {
|
|
877
|
+
result.qualifiedName = this.qualifiedName;
|
|
878
|
+
}
|
|
879
|
+
if (this.refersToTypeParameter) {
|
|
880
|
+
result.refersToTypeParameter = true;
|
|
881
|
+
}
|
|
882
|
+
if (typeof target !== "number" && this.preferValues) {
|
|
883
|
+
result.preferValues = true;
|
|
884
|
+
}
|
|
885
|
+
if (this.highlightedProperties) {
|
|
886
|
+
result.highlightedProperties = Object.fromEntries(Array.from(this.highlightedProperties.entries(), ([key, parts]) => {
|
|
887
|
+
return [
|
|
888
|
+
key,
|
|
889
|
+
Comment.serializeDisplayParts(parts),
|
|
890
|
+
];
|
|
891
|
+
}));
|
|
892
|
+
}
|
|
893
|
+
return result;
|
|
846
894
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
895
|
+
fromObject(de, obj) {
|
|
896
|
+
this.typeArguments = de.reviveMany(obj.typeArguments, (t) => de.constructType(t));
|
|
897
|
+
if (typeof obj.target === "number" && obj.target !== -1) {
|
|
898
|
+
de.defer((project) => {
|
|
899
|
+
const target = project.getReflectionById(de.oldIdToNewId[obj.target] ?? -1);
|
|
900
|
+
if (target) {
|
|
901
|
+
this._project = project;
|
|
902
|
+
this._target = target.id;
|
|
903
|
+
}
|
|
904
|
+
else {
|
|
905
|
+
de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(JSON.stringify(obj.target)));
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
else if (obj.target === -1) {
|
|
910
|
+
this._target = -1;
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
this._project = de.project;
|
|
914
|
+
this._target = new ReflectionSymbolId(obj.target);
|
|
915
|
+
}
|
|
916
|
+
this.qualifiedName = obj.qualifiedName ?? obj.name;
|
|
917
|
+
this.package = obj.package;
|
|
918
|
+
this.refersToTypeParameter = !!obj.refersToTypeParameter;
|
|
919
|
+
this.preferValues = !!obj.preferValues;
|
|
920
|
+
if (obj.highlightedProperties) {
|
|
921
|
+
this.highlightedProperties = new Map();
|
|
922
|
+
for (const [key, parts] of Object.entries(obj.highlightedProperties)) {
|
|
923
|
+
this.highlightedProperties.set(key, Comment.deserializeDisplayParts(de, parts));
|
|
860
924
|
}
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
else if (obj.target === -1) {
|
|
864
|
-
this._target = -1;
|
|
865
|
-
}
|
|
866
|
-
else {
|
|
867
|
-
this._project = de.project;
|
|
868
|
-
this._target = new ReflectionSymbolId(obj.target);
|
|
869
|
-
}
|
|
870
|
-
this.qualifiedName = obj.qualifiedName ?? obj.name;
|
|
871
|
-
this.package = obj.package;
|
|
872
|
-
this.refersToTypeParameter = !!obj.refersToTypeParameter;
|
|
873
|
-
this.preferValues = !!obj.preferValues;
|
|
874
|
-
if (obj.highlightedProperties) {
|
|
875
|
-
this.highlightedProperties = new Map();
|
|
876
|
-
for (const [key, parts] of Object.entries(obj.highlightedProperties)) {
|
|
877
|
-
this.highlightedProperties.set(key, Comment.deserializeDisplayParts(de, parts));
|
|
878
925
|
}
|
|
879
926
|
}
|
|
880
|
-
}
|
|
881
|
-
}
|
|
927
|
+
};
|
|
928
|
+
})();
|
|
929
|
+
export { ReferenceType };
|
|
882
930
|
/**
|
|
883
931
|
* Represents a type which has it's own reflection like literal types.
|
|
884
932
|
* This type will likely go away at some point and be replaced by a dedicated
|
|
@@ -899,17 +947,17 @@ export class ReflectionType extends Type {
|
|
|
899
947
|
}
|
|
900
948
|
getTypeString() {
|
|
901
949
|
const parts = [];
|
|
902
|
-
const sigs = this.declaration.
|
|
950
|
+
const sigs = this.declaration.getNonIndexSignatures();
|
|
903
951
|
for (const sig of sigs) {
|
|
904
952
|
parts.push(sigStr(sig, ": "));
|
|
905
953
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
954
|
+
for (const p of this.declaration.children || []) {
|
|
955
|
+
parts.push(`${p.name}${propertySep(p)} ${typeStr(p.type)}`);
|
|
956
|
+
}
|
|
957
|
+
for (const s of this.declaration.indexSignatures || []) {
|
|
958
|
+
parts.push(sigStr(s, ": ", "[]"));
|
|
911
959
|
}
|
|
912
|
-
if (sigs.length === 1) {
|
|
960
|
+
if (sigs.length === 1 && parts.length === 1) {
|
|
913
961
|
return sigStr(sigs[0], " => ");
|
|
914
962
|
}
|
|
915
963
|
if (parts.length === 0) {
|
|
@@ -1238,7 +1286,7 @@ function propertySep(refl) {
|
|
|
1238
1286
|
function typeStr(type) {
|
|
1239
1287
|
return type?.toString() ?? "any";
|
|
1240
1288
|
}
|
|
1241
|
-
function sigStr(sig, sep) {
|
|
1289
|
+
function sigStr(sig, sep, brackets = "()") {
|
|
1242
1290
|
const params = joinArray(sig.parameters, ", ", (p) => `${p.name}${propertySep(p)} ${typeStr(p.type)}`);
|
|
1243
|
-
return
|
|
1291
|
+
return `${brackets[0]}${params}${brackets[1]}${sep}${typeStr(sig.type)}`;
|
|
1244
1292
|
}
|
|
@@ -115,7 +115,7 @@ export interface RendererEvents {
|
|
|
115
115
|
* an instance of {@link IndexEvent}.
|
|
116
116
|
*
|
|
117
117
|
* @summary Writes HTML output from TypeDoc's models
|
|
118
|
-
* @group
|
|
118
|
+
* @group None
|
|
119
119
|
*/
|
|
120
120
|
export declare class Renderer extends AbstractComponent<Application, RendererEvents> {
|
|
121
121
|
private routers;
|
|
@@ -189,12 +189,16 @@ export declare class Renderer extends AbstractComponent<Application, RendererEve
|
|
|
189
189
|
* @param theme
|
|
190
190
|
*/
|
|
191
191
|
defineTheme(name: string, theme: new (renderer: Renderer) => Theme): void;
|
|
192
|
+
/** @internal intended for test usage only */
|
|
193
|
+
removeTheme(name: string): void;
|
|
192
194
|
/**
|
|
193
195
|
* Define a new router that can be used to determine the output structure.
|
|
194
196
|
* @param name
|
|
195
197
|
* @param router
|
|
196
198
|
*/
|
|
197
199
|
defineRouter(name: string, router: new (app: Application) => Router): void;
|
|
200
|
+
/** @internal intended for test usage only */
|
|
201
|
+
removeRouter(name: string): void;
|
|
198
202
|
/**
|
|
199
203
|
* Render the given project reflection to the specified output directory.
|
|
200
204
|
*
|
|
@@ -79,7 +79,7 @@ import { CategoryRouter, GroupRouter, KindDirRouter, KindRouter, StructureDirRou
|
|
|
79
79
|
* an instance of {@link IndexEvent}.
|
|
80
80
|
*
|
|
81
81
|
* @summary Writes HTML output from TypeDoc's models
|
|
82
|
-
* @group
|
|
82
|
+
* @group None
|
|
83
83
|
*/
|
|
84
84
|
let Renderer = (() => {
|
|
85
85
|
let _classSuper = AbstractComponent;
|
|
@@ -231,6 +231,10 @@ let Renderer = (() => {
|
|
|
231
231
|
}
|
|
232
232
|
this.themes.set(name, theme);
|
|
233
233
|
}
|
|
234
|
+
/** @internal intended for test usage only */
|
|
235
|
+
removeTheme(name) {
|
|
236
|
+
this.themes.delete(name);
|
|
237
|
+
}
|
|
234
238
|
/**
|
|
235
239
|
* Define a new router that can be used to determine the output structure.
|
|
236
240
|
* @param name
|
|
@@ -242,6 +246,10 @@ let Renderer = (() => {
|
|
|
242
246
|
}
|
|
243
247
|
this.routers.set(name, router);
|
|
244
248
|
}
|
|
249
|
+
/** @internal intended for test usage only */
|
|
250
|
+
removeRouter(name) {
|
|
251
|
+
this.routers.delete(name);
|
|
252
|
+
}
|
|
245
253
|
/**
|
|
246
254
|
* Render the given project reflection to the specified output directory.
|
|
247
255
|
*
|
|
@@ -166,6 +166,16 @@ let BaseRouter = (() => {
|
|
|
166
166
|
// an own document.
|
|
167
167
|
from = from.parent;
|
|
168
168
|
}
|
|
169
|
+
let toPage = to;
|
|
170
|
+
while (!this.hasOwnDocument(toPage)) {
|
|
171
|
+
toPage = toPage.parent;
|
|
172
|
+
}
|
|
173
|
+
// We unfortunately have to special case ProjectReflection as it is
|
|
174
|
+
// the model used twice for rendering. This should be changed in a
|
|
175
|
+
// future version to remove this hackery.
|
|
176
|
+
if (from === toPage && !(to instanceof ProjectReflection)) {
|
|
177
|
+
return to === toPage ? "" : `#${this.getAnchor(to)}`;
|
|
178
|
+
}
|
|
169
179
|
const fromUrl = this.getFullUrl(from);
|
|
170
180
|
const toUrl = this.getFullUrl(to);
|
|
171
181
|
let equal = true;
|
|
@@ -181,12 +191,14 @@ let BaseRouter = (() => {
|
|
|
181
191
|
}
|
|
182
192
|
}
|
|
183
193
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
194
|
+
// If equal is still set, we're going to a page either in
|
|
195
|
+
// the same directory as this page, or a lower directory,
|
|
196
|
+
// don't bother going up directories just to come back down.
|
|
197
|
+
if (equal) {
|
|
198
|
+
return toUrl.substring(start);
|
|
189
199
|
}
|
|
200
|
+
// Otherwise, go up until we get to the common directory
|
|
201
|
+
// and then back down to the target path.
|
|
190
202
|
return "../".repeat(slashes) + toUrl.substring(start);
|
|
191
203
|
}
|
|
192
204
|
baseRelativeUrl(from, target) {
|
|
@@ -177,7 +177,7 @@ let MarkedPlugin = (() => {
|
|
|
177
177
|
let url;
|
|
178
178
|
let kindClass;
|
|
179
179
|
if (typeof part.target === "string") {
|
|
180
|
-
url = part.target;
|
|
180
|
+
url = part.target === "#" ? undefined : part.target;
|
|
181
181
|
}
|
|
182
182
|
else if ("id" in part.target) {
|
|
183
183
|
// No point in trying to resolve a ReflectionSymbolId at this point, we've already
|
|
@@ -204,6 +204,11 @@ let MarkedPlugin = (() => {
|
|
|
204
204
|
.reflection_0_links_to_1_with_text_2_but_resolved_to_3(page.model.getFriendlyFullName(), part.target.getFriendlyFullName(), part.text, target.getFriendlyFullName()));
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
+
// If the url goes to this page, render as `#`
|
|
208
|
+
// to go to the top of the page.
|
|
209
|
+
if (url == "") {
|
|
210
|
+
url = "#";
|
|
211
|
+
}
|
|
207
212
|
}
|
|
208
213
|
if (useHtml) {
|
|
209
214
|
const text = part.tag === "@linkcode" ? `<code>${part.text}</code>` : part.text;
|