@apify/docusaurus-plugin-typedoc-api 3.0.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/LICENSE +21 -0
- package/README.md +290 -0
- package/assets/styles-8ad572ec.css +303 -0
- package/lib/components/AnchorLink.js +22 -0
- package/lib/components/AnchorLink.js.map +1 -0
- package/lib/components/ApiChangelog.js +28 -0
- package/lib/components/ApiChangelog.js.map +1 -0
- package/lib/components/ApiDataContext.js +16 -0
- package/lib/components/ApiDataContext.js.map +1 -0
- package/lib/components/ApiIndex.js +80 -0
- package/lib/components/ApiIndex.js.map +1 -0
- package/lib/components/ApiItem.js +86 -0
- package/lib/components/ApiItem.js.map +1 -0
- package/lib/components/ApiItemLayout.js +69 -0
- package/lib/components/ApiItemLayout.js.map +1 -0
- package/lib/components/ApiPage.js +69 -0
- package/lib/components/ApiPage.js.map +1 -0
- package/lib/components/Breadcrumb.js +38 -0
- package/lib/components/Breadcrumb.js.map +1 -0
- package/lib/components/Comment.js +56 -0
- package/lib/components/Comment.js.map +1 -0
- package/lib/components/CommentBadges.js +35 -0
- package/lib/components/CommentBadges.js.map +1 -0
- package/lib/components/DefaultValue.js +49 -0
- package/lib/components/DefaultValue.js.map +1 -0
- package/lib/components/Flags.js +27 -0
- package/lib/components/Flags.js.map +1 -0
- package/lib/components/Footer.js +18 -0
- package/lib/components/Footer.js.map +1 -0
- package/lib/components/Hierarchy.js +27 -0
- package/lib/components/Hierarchy.js.map +1 -0
- package/lib/components/Icon.js +27 -0
- package/lib/components/Icon.js.map +1 -0
- package/lib/components/Index.js +87 -0
- package/lib/components/Index.js.map +1 -0
- package/lib/components/Markdown.js +204 -0
- package/lib/components/Markdown.js.map +1 -0
- package/lib/components/Member.js +68 -0
- package/lib/components/Member.js.map +1 -0
- package/lib/components/MemberDeclaration.js +64 -0
- package/lib/components/MemberDeclaration.js.map +1 -0
- package/lib/components/MemberGetterSetter.js +61 -0
- package/lib/components/MemberGetterSetter.js.map +1 -0
- package/lib/components/MemberReference.js +38 -0
- package/lib/components/MemberReference.js.map +1 -0
- package/lib/components/MemberSignatureBody.js +91 -0
- package/lib/components/MemberSignatureBody.js.map +1 -0
- package/lib/components/MemberSignatureTitle.js +52 -0
- package/lib/components/MemberSignatureTitle.js.map +1 -0
- package/lib/components/MemberSignatures.js +61 -0
- package/lib/components/MemberSignatures.js.map +1 -0
- package/lib/components/MemberSources.js +33 -0
- package/lib/components/MemberSources.js.map +1 -0
- package/lib/components/Members.js +51 -0
- package/lib/components/Members.js.map +1 -0
- package/lib/components/MembersGroup.js +39 -0
- package/lib/components/MembersGroup.js.map +1 -0
- package/lib/components/Parameter.js +145 -0
- package/lib/components/Parameter.js.map +1 -0
- package/lib/components/Reflection.js +112 -0
- package/lib/components/Reflection.js.map +1 -0
- package/lib/components/SourceLink.js +37 -0
- package/lib/components/SourceLink.js.map +1 -0
- package/lib/components/Type.js +341 -0
- package/lib/components/Type.js.map +1 -0
- package/lib/components/TypeAndParent.js +27 -0
- package/lib/components/TypeAndParent.js.map +1 -0
- package/lib/components/TypeParameters.js +36 -0
- package/lib/components/TypeParameters.js.map +1 -0
- package/lib/components/TypeParametersGeneric.js +27 -0
- package/lib/components/TypeParametersGeneric.js.map +1 -0
- package/lib/components/VersionBanner.js +39 -0
- package/lib/components/VersionBanner.js.map +1 -0
- package/lib/hooks/useBreadcrumbs.js +9 -0
- package/lib/hooks/useBreadcrumbs.js.map +1 -0
- package/lib/hooks/useGitRefName.js +9 -0
- package/lib/hooks/useGitRefName.js.map +1 -0
- package/lib/hooks/useMinimalLayout.js +9 -0
- package/lib/hooks/useMinimalLayout.js.map +1 -0
- package/lib/hooks/useReflection.js +19 -0
- package/lib/hooks/useReflection.js.map +1 -0
- package/lib/hooks/useReflectionMap.js +9 -0
- package/lib/hooks/useReflectionMap.js.map +1 -0
- package/lib/index.js +320 -0
- package/lib/index.js.map +1 -0
- package/lib/markdownLoader.js +11 -0
- package/lib/markdownLoader.js.map +1 -0
- package/lib/plugin/data.js +332 -0
- package/lib/plugin/data.js.map +1 -0
- package/lib/plugin/sidebar.js +105 -0
- package/lib/plugin/sidebar.js.map +1 -0
- package/lib/plugin/structure/0.23.js +48 -0
- package/lib/plugin/structure/0.23.js.map +1 -0
- package/lib/plugin/url.js +49 -0
- package/lib/plugin/url.js.map +1 -0
- package/lib/plugin/version.js +83 -0
- package/lib/plugin/version.js.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/hierarchy.js +35 -0
- package/lib/utils/hierarchy.js.map +1 -0
- package/lib/utils/icons.js +124 -0
- package/lib/utils/icons.js.map +1 -0
- package/lib/utils/links.js +10 -0
- package/lib/utils/links.js.map +1 -0
- package/lib/utils/markdown.js +69 -0
- package/lib/utils/markdown.js.map +1 -0
- package/lib/utils/visibility.js +25 -0
- package/lib/utils/visibility.js.map +1 -0
- package/package.json +57 -0
- package/src/components/AnchorLink.tsx +14 -0
- package/src/components/ApiChangelog.tsx +26 -0
- package/src/components/ApiDataContext.ts +17 -0
- package/src/components/ApiIndex.tsx +109 -0
- package/src/components/ApiItem.tsx +110 -0
- package/src/components/ApiItemLayout.tsx +96 -0
- package/src/components/ApiPage.tsx +78 -0
- package/src/components/Breadcrumb.tsx +41 -0
- package/src/components/Comment.tsx +74 -0
- package/src/components/CommentBadges.tsx +40 -0
- package/src/components/DefaultValue.tsx +48 -0
- package/src/components/Flags.tsx +29 -0
- package/src/components/Footer.tsx +13 -0
- package/src/components/Hierarchy.tsx +27 -0
- package/src/components/Icon.tsx +20 -0
- package/src/components/Index.tsx +109 -0
- package/src/components/Markdown.tsx +241 -0
- package/src/components/Member.tsx +64 -0
- package/src/components/MemberDeclaration.tsx +67 -0
- package/src/components/MemberGetterSetter.tsx +69 -0
- package/src/components/MemberReference.tsx +43 -0
- package/src/components/MemberSignatureBody.tsx +121 -0
- package/src/components/MemberSignatureTitle.tsx +65 -0
- package/src/components/MemberSignatures.tsx +64 -0
- package/src/components/MemberSources.tsx +42 -0
- package/src/components/Members.tsx +62 -0
- package/src/components/MembersGroup.tsx +47 -0
- package/src/components/Parameter.tsx +165 -0
- package/src/components/README.md +9 -0
- package/src/components/Reflection.tsx +136 -0
- package/src/components/SourceLink.tsx +46 -0
- package/src/components/Type.tsx +377 -0
- package/src/components/TypeAndParent.tsx +26 -0
- package/src/components/TypeParameters.tsx +37 -0
- package/src/components/TypeParametersGeneric.tsx +25 -0
- package/src/components/VersionBanner.tsx +44 -0
- package/src/components/styles.css +303 -0
- package/src/hooks/useBreadcrumbs.ts +6 -0
- package/src/hooks/useGitRefName.ts +6 -0
- package/src/hooks/useMinimalLayout.ts +6 -0
- package/src/hooks/useReflection.ts +18 -0
- package/src/hooks/useReflectionMap.ts +7 -0
- package/src/index.ts +420 -0
- package/src/markdownLoader.ts +10 -0
- package/src/plugin/data.ts +389 -0
- package/src/plugin/sidebar.ts +139 -0
- package/src/plugin/structure/0.23.ts +58 -0
- package/src/plugin/url.ts +49 -0
- package/src/plugin/version.ts +118 -0
- package/src/types.ts +165 -0
- package/src/utils/hierarchy.ts +46 -0
- package/src/utils/icons.ts +103 -0
- package/src/utils/links.ts +10 -0
- package/src/utils/markdown.ts +82 -0
- package/src/utils/visibility.ts +31 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
|
3
|
+
// https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/type.hbs
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { JSONOutput } from 'typedoc';
|
|
7
|
+
import Link from '@docusaurus/Link';
|
|
8
|
+
import { useReflectionMap } from '../hooks/useReflectionMap';
|
|
9
|
+
import { MemberSignatureTitle } from './MemberSignatureTitle';
|
|
10
|
+
|
|
11
|
+
function parens(element: JSX.Element, needsParens: boolean): JSX.Element {
|
|
12
|
+
if (!needsParens) {
|
|
13
|
+
return element;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{needsParens && <span className="tsd-signature-symbol">(</span>}
|
|
19
|
+
{element}
|
|
20
|
+
{needsParens && <span className="tsd-signature-symbol">)</span>}
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TypeProps {
|
|
26
|
+
needsParens?: boolean;
|
|
27
|
+
type?: { type: string; value?: unknown };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line complexity
|
|
31
|
+
export function Type({ needsParens = false, type: base }: TypeProps) {
|
|
32
|
+
const reflections = useReflectionMap();
|
|
33
|
+
|
|
34
|
+
if (!base) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Cast to string since `type` doesnt include all string values in the union.
|
|
39
|
+
// https://github.com/TypeStrong/typedoc/blob/master/src/lib/output/themes/default/partials/type.tsx
|
|
40
|
+
switch (String(base.type)) {
|
|
41
|
+
case 'array': {
|
|
42
|
+
const type = base as JSONOutput.ArrayType;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<Type needsParens type={type.elementType} />
|
|
47
|
+
<span className="tsd-signature-symbol">[]</span>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case 'conditional': {
|
|
53
|
+
const type = base as JSONOutput.ConditionalType;
|
|
54
|
+
|
|
55
|
+
return parens(
|
|
56
|
+
<>
|
|
57
|
+
<Type needsParens type={type.checkType} />
|
|
58
|
+
<span className="tsd-signature-symbol"> extends </span>
|
|
59
|
+
<Type type={type.extendsType} />
|
|
60
|
+
<span className="tsd-signature-symbol"> ? </span>
|
|
61
|
+
<Type type={type.trueType} />
|
|
62
|
+
<span className="tsd-signature-symbol"> : </span>
|
|
63
|
+
<Type type={type.falseType} />
|
|
64
|
+
</>,
|
|
65
|
+
needsParens,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
case 'indexedAccess': {
|
|
70
|
+
const type = base as JSONOutput.IndexedAccessType;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
<Type type={type.objectType} />
|
|
75
|
+
<span className="tsd-signature-symbol">[</span>
|
|
76
|
+
<Type type={type.indexType} />
|
|
77
|
+
<span className="tsd-signature-symbol">]</span>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
case 'inferred': {
|
|
83
|
+
const type = base as JSONOutput.InferredType;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<span className="tsd-signature-symbol">infer </span> {type.name}
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
case 'intersection': {
|
|
93
|
+
const type = base as JSONOutput.IntersectionType;
|
|
94
|
+
|
|
95
|
+
return parens(
|
|
96
|
+
<>
|
|
97
|
+
{type.types.map((t, i) => (
|
|
98
|
+
<React.Fragment key={t.type + i}>
|
|
99
|
+
{i > 0 && <span className="tsd-signature-symbol"> & </span>}
|
|
100
|
+
<Type needsParens type={t} />
|
|
101
|
+
</React.Fragment>
|
|
102
|
+
))}
|
|
103
|
+
</>,
|
|
104
|
+
needsParens,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
case 'intrinsic': {
|
|
109
|
+
const type = base as JSONOutput.IntrinsicType;
|
|
110
|
+
|
|
111
|
+
return <span className="tsd-signature-type">{type.name}</span>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
case 'literal': {
|
|
115
|
+
const type = base as JSONOutput.LiteralType;
|
|
116
|
+
|
|
117
|
+
return <span className="tsd-signature-type">{String(type.value)}</span>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
case 'mapped': {
|
|
121
|
+
const type = base as unknown as JSONOutput.MappedType;
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<span className="tsd-signature-symbol">{'{ '}</span>
|
|
126
|
+
|
|
127
|
+
{type.readonlyModifier === '+' && <span className="tsd-signature-symbol">readonly </span>}
|
|
128
|
+
{type.readonlyModifier === '-' && (
|
|
129
|
+
<span className="tsd-signature-symbol">-readonly </span>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
<span className="tsd-signature-symbol">[ </span>
|
|
133
|
+
<span className="tsd-signature-type">{type.parameter}</span>
|
|
134
|
+
<span className="tsd-signature-symbol"> in </span>
|
|
135
|
+
<Type type={type.parameterType} />
|
|
136
|
+
{type.nameType && (
|
|
137
|
+
<>
|
|
138
|
+
<span className="tsd-signature-symbol"> as </span>
|
|
139
|
+
<Type type={type.nameType} />
|
|
140
|
+
</>
|
|
141
|
+
)}
|
|
142
|
+
<span className="tsd-signature-symbol"> ]</span>
|
|
143
|
+
|
|
144
|
+
{type.optionalModifier === '+' && <span className="tsd-signature-symbol">?: </span>}
|
|
145
|
+
{type.optionalModifier === '-' && <span className="tsd-signature-symbol">-?: </span>}
|
|
146
|
+
{!type.optionalModifier && <span className="tsd-signature-symbol">: </span>}
|
|
147
|
+
|
|
148
|
+
<Type type={type.templateType} />
|
|
149
|
+
|
|
150
|
+
<span className="tsd-signature-symbol">{' }'}</span>
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
case 'optional': {
|
|
156
|
+
const type = base as JSONOutput.OptionalType;
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<>
|
|
160
|
+
<Type type={type.elementType} />
|
|
161
|
+
<span className="tsd-signature-symbol">?</span>
|
|
162
|
+
</>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
case 'predicate': {
|
|
167
|
+
const type = base as JSONOutput.PredicateType;
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<>
|
|
171
|
+
{type.asserts && <span className="tsd-signature-symbol">asserts </span>}
|
|
172
|
+
<span className="tsd-signature-type">{type.name}</span>
|
|
173
|
+
{type.targetType && (
|
|
174
|
+
<>
|
|
175
|
+
<span className="tsd-signature-symbol"> is </span>
|
|
176
|
+
<Type type={type.targetType} />
|
|
177
|
+
</>
|
|
178
|
+
)}
|
|
179
|
+
</>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
case 'query': {
|
|
184
|
+
const type = base as JSONOutput.QueryType;
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<>
|
|
188
|
+
<span className="tsd-signature-symbol">typeof </span>
|
|
189
|
+
<Type type={type.queryType} />
|
|
190
|
+
</>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
case 'reference': {
|
|
195
|
+
const type = base as JSONOutput.ReferenceType;
|
|
196
|
+
const ref = type.id ? reflections[type.id] : null;
|
|
197
|
+
const genericClass = ref?.id && !ref.sources ? 'tsd-signature-type-generic' : '';
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
{ref?.permalink ? (
|
|
202
|
+
<Link
|
|
203
|
+
className={`tsd-signature-type ${genericClass}`}
|
|
204
|
+
data-tsd-kind={ref.kindString}
|
|
205
|
+
to={ref.permalink}
|
|
206
|
+
>
|
|
207
|
+
{type.name}
|
|
208
|
+
</Link>
|
|
209
|
+
) : (
|
|
210
|
+
<span className={`tsd-signature-type ${genericClass}`}>{type.name}</span>
|
|
211
|
+
)}
|
|
212
|
+
{type.typeArguments && type.typeArguments.length > 0 && (
|
|
213
|
+
<>
|
|
214
|
+
<span className="tsd-signature-symbol"><</span>
|
|
215
|
+
{type.typeArguments.map((t, i) => (
|
|
216
|
+
<React.Fragment key={t.type + i}>
|
|
217
|
+
{i > 0 && <span className="tsd-signature-symbol">, </span>}
|
|
218
|
+
<Type type={t} />
|
|
219
|
+
</React.Fragment>
|
|
220
|
+
))}
|
|
221
|
+
<span className="tsd-signature-symbol">></span>
|
|
222
|
+
</>
|
|
223
|
+
)}
|
|
224
|
+
</>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
case 'reflection': {
|
|
229
|
+
const type = base as JSONOutput.ReflectionType;
|
|
230
|
+
const decl = type.declaration;
|
|
231
|
+
|
|
232
|
+
// object literal
|
|
233
|
+
if (decl?.children && decl.children.length > 0) {
|
|
234
|
+
return (
|
|
235
|
+
<>
|
|
236
|
+
<span className="tsd-signature-symbol">{'{ '}</span>
|
|
237
|
+
{decl.children.map((child, i) => (
|
|
238
|
+
<React.Fragment key={child.id ?? i}>
|
|
239
|
+
{i > 0 && <span className="tsd-signature-symbol">; </span>}
|
|
240
|
+
<span>
|
|
241
|
+
{child.name}
|
|
242
|
+
<span className="tsd-signature-symbol">{child.flags?.isOptional && '?'}: </span>
|
|
243
|
+
{child.type ? <Type type={child.type} /> : 'any'}
|
|
244
|
+
</span>
|
|
245
|
+
</React.Fragment>
|
|
246
|
+
))}
|
|
247
|
+
<span className="tsd-signature-symbol">{' }'}</span>
|
|
248
|
+
</>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (decl?.signatures && decl.signatures.length === 1) {
|
|
253
|
+
return <MemberSignatureTitle hideName useArrow sig={decl.signatures[0]} />;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (decl?.signatures && decl.signatures.length > 0) {
|
|
257
|
+
return parens(
|
|
258
|
+
<>
|
|
259
|
+
<span className="tsd-signature-symbol">{'{ '}</span>
|
|
260
|
+
{decl.signatures.map((sig, i) => (
|
|
261
|
+
<React.Fragment key={sig.id ?? i}>
|
|
262
|
+
{i > 0 && <span className="tsd-signature-symbol">; </span>}
|
|
263
|
+
<MemberSignatureTitle sig={sig} />
|
|
264
|
+
</React.Fragment>
|
|
265
|
+
))}
|
|
266
|
+
<span className="tsd-signature-symbol">{' }'}</span>
|
|
267
|
+
</>,
|
|
268
|
+
needsParens,
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return <>{'{}'}</>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
case 'rest': {
|
|
276
|
+
const type = base as JSONOutput.RestType;
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<>
|
|
280
|
+
<span className="tsd-signature-symbol">...</span>
|
|
281
|
+
<Type type={type.elementType} />
|
|
282
|
+
</>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
case 'tuple': {
|
|
287
|
+
const type = base as JSONOutput.TupleType;
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
<>
|
|
291
|
+
<span className="tsd-signature-symbol">[</span>
|
|
292
|
+
{type.elements?.map((t, i) => (
|
|
293
|
+
<React.Fragment key={t.type + i}>
|
|
294
|
+
{i > 0 && <span className="tsd-signature-symbol">, </span>}
|
|
295
|
+
<Type type={t} />
|
|
296
|
+
</React.Fragment>
|
|
297
|
+
))}
|
|
298
|
+
<span className="tsd-signature-symbol">]</span>
|
|
299
|
+
</>
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
case 'typeOperator': {
|
|
304
|
+
const type = base as JSONOutput.TypeOperatorType;
|
|
305
|
+
|
|
306
|
+
return (
|
|
307
|
+
<>
|
|
308
|
+
<span className="tsd-signature-symbol">{type.operator} </span>
|
|
309
|
+
<Type type={type.target} />
|
|
310
|
+
</>
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// case 'typeParameter': {
|
|
315
|
+
// const type = base as JSONOutput.TypeParameterType;
|
|
316
|
+
|
|
317
|
+
// return <span className="tsd-signature-type">{type.name}</span>;
|
|
318
|
+
// }
|
|
319
|
+
|
|
320
|
+
case 'union': {
|
|
321
|
+
const type = base as JSONOutput.UnionType;
|
|
322
|
+
|
|
323
|
+
return parens(
|
|
324
|
+
<>
|
|
325
|
+
{type.types.map((t, i) => (
|
|
326
|
+
<React.Fragment key={t.type + i}>
|
|
327
|
+
{i > 0 && <span className="tsd-signature-symbol"> | </span>}
|
|
328
|
+
<Type needsParens type={t} />
|
|
329
|
+
</React.Fragment>
|
|
330
|
+
))}
|
|
331
|
+
</>,
|
|
332
|
+
needsParens,
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
case 'unknown': {
|
|
337
|
+
const type = base as JSONOutput.UnknownType;
|
|
338
|
+
|
|
339
|
+
return <span className="tsd-signature-type">{type.name}</span>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
case 'named-tuple-member': {
|
|
343
|
+
const type = base as unknown as JSONOutput.NamedTupleMemberType;
|
|
344
|
+
|
|
345
|
+
return (
|
|
346
|
+
<>
|
|
347
|
+
{type.name}
|
|
348
|
+
<span className="tsd-signature-symbol">{type.isOptional ? '?: ' : ': '}</span>
|
|
349
|
+
<Type type={type.element} />
|
|
350
|
+
</>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
case 'template-literal': {
|
|
355
|
+
const type = base as unknown as JSONOutput.TemplateLiteralType;
|
|
356
|
+
|
|
357
|
+
return (
|
|
358
|
+
<>
|
|
359
|
+
<span className="tsd-signature-symbol">`</span>
|
|
360
|
+
{type.head && <span className="tsd-signature-type">{type.head}</span>}
|
|
361
|
+
{type.tail.map((t, i) => (
|
|
362
|
+
<React.Fragment key={i}>
|
|
363
|
+
<span className="tsd-signature-symbol">{'${'}</span>
|
|
364
|
+
{typeof t[0] !== 'string' && <Type type={t[0]!} />}
|
|
365
|
+
<span className="tsd-signature-symbol">{'}'}</span>
|
|
366
|
+
{typeof t[1] === 'string' && <span className="tsd-signature-type">{t[1]}</span>}
|
|
367
|
+
</React.Fragment>
|
|
368
|
+
))}
|
|
369
|
+
<span className="tsd-signature-symbol">`</span>
|
|
370
|
+
</>
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
default:
|
|
375
|
+
return <span className="tsd-signature-type">void</span>;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/typeAndParent.hbs
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { JSONOutput } from 'typedoc';
|
|
5
|
+
import { Type } from './Type';
|
|
6
|
+
|
|
7
|
+
export interface TypeAndParentProps {
|
|
8
|
+
type?: JSONOutput.SomeType;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function TypeAndParent({ type }: TypeAndParentProps) {
|
|
12
|
+
if (!type) {
|
|
13
|
+
return <>void</>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if ('elementType' in type && type.elementType) {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<TypeAndParent type={type.elementType} />
|
|
20
|
+
[]
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <Type type={type} />;
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/typeParameters.hbs
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { JSONOutput } from 'typedoc';
|
|
5
|
+
import { Comment } from './Comment';
|
|
6
|
+
import { DefaultValue } from './DefaultValue';
|
|
7
|
+
import { Type } from './Type';
|
|
8
|
+
|
|
9
|
+
export interface TypeParametersProps {
|
|
10
|
+
params?: JSONOutput.TypeParameterReflection[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function TypeParameters({ params }: TypeParametersProps) {
|
|
14
|
+
if (!params || params.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<ul className="tsd-type-parameters">
|
|
20
|
+
{params.map((param) => (
|
|
21
|
+
<li key={param.id}>
|
|
22
|
+
<strong>{param.name}</strong>
|
|
23
|
+
|
|
24
|
+
{param.type && (
|
|
25
|
+
<>
|
|
26
|
+
<span className="tsd-signature-symbol">:</span> <Type type={param.type} />
|
|
27
|
+
</>
|
|
28
|
+
)}
|
|
29
|
+
|
|
30
|
+
<DefaultValue comment={param.comment} type={param.type} value={param.default} />
|
|
31
|
+
|
|
32
|
+
<Comment comment={param.comment} />
|
|
33
|
+
</li>
|
|
34
|
+
))}
|
|
35
|
+
</ul>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { JSONOutput } from 'typedoc';
|
|
3
|
+
|
|
4
|
+
export interface TypeParametersGenericProps {
|
|
5
|
+
params?: JSONOutput.TypeParameterReflection[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function TypeParametersGeneric({ params }: TypeParametersGenericProps) {
|
|
9
|
+
if (!params || params.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<span className="tsd-generics">
|
|
15
|
+
<span className="tsd-signature-symbol"><</span>
|
|
16
|
+
{params.map((param, i) => (
|
|
17
|
+
<React.Fragment key={param.id}>
|
|
18
|
+
{i > 0 && <span className="tsd-signature-symbol">, </span>}
|
|
19
|
+
{param.name}
|
|
20
|
+
</React.Fragment>
|
|
21
|
+
))}
|
|
22
|
+
<span className="tsd-signature-symbol">></span>
|
|
23
|
+
</span>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import Link from '@docusaurus/Link';
|
|
3
|
+
import { useDocVersionSuggestions } from '@docusaurus/plugin-content-docs/client';
|
|
4
|
+
import { ThemeClassNames, useDocsPreferredVersion } from '@docusaurus/theme-common';
|
|
5
|
+
import { useDocsVersion } from '@docusaurus/theme-common/internal';
|
|
6
|
+
|
|
7
|
+
export function VersionBanner(): JSX.Element | null {
|
|
8
|
+
const { banner, docs, pluginId, version } = useDocsVersion();
|
|
9
|
+
const { latestVersionSuggestion: latestVersion } = useDocVersionSuggestions(pluginId);
|
|
10
|
+
const { savePreferredVersionName } = useDocsPreferredVersion(pluginId);
|
|
11
|
+
|
|
12
|
+
const handleClick = useCallback(() => {
|
|
13
|
+
savePreferredVersionName(latestVersion.name);
|
|
14
|
+
}, [latestVersion.name, savePreferredVersionName]);
|
|
15
|
+
|
|
16
|
+
if (!banner || !latestVersion) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const latestVersionInfo = docs[latestVersion.label];
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={`${ThemeClassNames.docs.docVersionBanner} alert alert--warning margin-bottom--md`}
|
|
25
|
+
role="alert"
|
|
26
|
+
>
|
|
27
|
+
<div>
|
|
28
|
+
{banner === 'unreleased' && <>This is documentation for an unreleased version.</>}
|
|
29
|
+
{banner === 'unmaintained' && (
|
|
30
|
+
<>
|
|
31
|
+
This is documentation for version <b>{version}</b>.
|
|
32
|
+
</>
|
|
33
|
+
)}{' '}
|
|
34
|
+
For the latest API, see version{' '}
|
|
35
|
+
<b>
|
|
36
|
+
<Link to={latestVersionInfo.id} onClick={handleClick}>
|
|
37
|
+
{latestVersionInfo.title}
|
|
38
|
+
</Link>
|
|
39
|
+
</b>
|
|
40
|
+
.
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|