typedoc 0.24.0-beta.7 → 0.24.0-beta.8
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/index.d.ts +4 -0
- package/dist/index.js +17 -1
- package/dist/lib/converter/comments/discovery.js +1 -1
- package/dist/lib/converter/context.js +2 -2
- package/dist/lib/converter/converter.d.ts +6 -4
- package/dist/lib/converter/converter.js +7 -5
- package/dist/lib/converter/plugins/PackagePlugin.js +3 -1
- package/dist/lib/converter/symbols.js +9 -4
- package/dist/lib/models/comments/comment.d.ts +2 -2
- package/dist/lib/models/comments/comment.js +26 -6
- package/dist/lib/models/reflections/declaration.d.ts +1 -1
- package/dist/lib/models/reflections/project.d.ts +0 -6
- package/dist/lib/models/reflections/project.js +0 -16
- package/dist/lib/models/types.js +2 -31
- package/dist/lib/output/components.d.ts +3 -3
- package/dist/lib/output/components.js +1 -5
- package/dist/lib/output/events.d.ts +22 -10
- package/dist/lib/output/events.js +14 -6
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +1 -3
- package/dist/lib/output/renderer.d.ts +12 -4
- package/dist/lib/output/renderer.js +3 -3
- package/dist/lib/output/theme.d.ts +2 -2
- package/dist/lib/output/themes/MarkedPlugin.d.ts +2 -2
- package/dist/lib/output/themes/MarkedPlugin.js +15 -12
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +5 -5
- package/dist/lib/output/themes/default/DefaultTheme.js +58 -11
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +15 -13
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +9 -59
- package/dist/lib/output/themes/default/layouts/default.d.ts +2 -1
- package/dist/lib/output/themes/default/layouts/default.js +18 -12
- package/dist/lib/output/themes/default/partials/footer.js +1 -1
- package/dist/lib/output/themes/default/partials/member.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.js +22 -14
- package/dist/lib/output/themes/default/partials/members.group.js +3 -3
- package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -3
- package/dist/lib/output/themes/default/partials/navigation.js +71 -74
- package/dist/lib/output/themes/default/partials/toolbar.js +2 -1
- package/dist/lib/serialization/schema.d.ts +1 -0
- package/dist/lib/serialization/schema.js +1 -0
- package/dist/lib/serialization/serializer.d.ts +1 -1
- package/dist/lib/utils/entry-point.d.ts +3 -3
- package/dist/lib/utils/entry-point.js +4 -4
- package/dist/lib/utils/fs.d.ts +5 -0
- package/dist/lib/utils/fs.js +35 -2
- package/dist/lib/utils/options/declaration.d.ts +1 -0
- package/dist/lib/utils/options/options.d.ts +5 -0
- package/dist/lib/utils/options/sources/typedoc.js +5 -0
- package/package.json +1 -1
- package/static/main.js +3 -3
- package/static/style.css +186 -257
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Renderer } from "./renderer";
|
|
2
2
|
import type { ProjectReflection } from "../models/reflections/project";
|
|
3
|
-
import type { UrlMapping } from "./models/UrlMapping";
|
|
3
|
+
import type { RenderTemplate, UrlMapping } from "./models/UrlMapping";
|
|
4
4
|
import { RendererComponent } from "./components";
|
|
5
5
|
import type { PageEvent } from "./events";
|
|
6
6
|
import type { Reflection } from "../models";
|
|
@@ -39,5 +39,5 @@ export declare abstract class Theme extends RendererComponent {
|
|
|
39
39
|
/**
|
|
40
40
|
* Renders the provided page to a string, which will be written to disk by the {@link Renderer}
|
|
41
41
|
*/
|
|
42
|
-
abstract render(page: PageEvent<Reflection
|
|
42
|
+
abstract render(page: PageEvent<Reflection>, template: RenderTemplate<PageEvent<Reflection>>): string;
|
|
43
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextAwareRendererComponent } from "../components";
|
|
2
|
-
import { RendererEvent, MarkdownEvent } from "../events";
|
|
2
|
+
import { RendererEvent, MarkdownEvent, PageEvent } from "../events";
|
|
3
3
|
import type { Theme } from "shiki";
|
|
4
4
|
/**
|
|
5
5
|
* Implements markdown and relativeURL helpers for templates.
|
|
@@ -46,7 +46,7 @@ export declare class MarkedPlugin extends ContextAwareRendererComponent {
|
|
|
46
46
|
* @param text The markdown string that should be parsed.
|
|
47
47
|
* @returns The resulting html string.
|
|
48
48
|
*/
|
|
49
|
-
parseMarkdown(text: string): string;
|
|
49
|
+
parseMarkdown(text: string, page: PageEvent<any>): string;
|
|
50
50
|
/**
|
|
51
51
|
* Triggered before the renderer starts rendering a project.
|
|
52
52
|
*
|
|
@@ -37,15 +37,6 @@ const components_1 = require("../components");
|
|
|
37
37
|
const events_1 = require("../events");
|
|
38
38
|
const utils_1 = require("../../utils");
|
|
39
39
|
const highlighter_1 = require("../../utils/highlighter");
|
|
40
|
-
const customMarkedRenderer = new Marked.Renderer();
|
|
41
|
-
customMarkedRenderer.heading = (text, level, _, slugger) => {
|
|
42
|
-
const slug = slugger.slug(text);
|
|
43
|
-
return `
|
|
44
|
-
<a href="#${slug}" id="${slug}" style="color: inherit; text-decoration: none;">
|
|
45
|
-
<h${level}>${text}</h${level}>
|
|
46
|
-
</a>
|
|
47
|
-
`;
|
|
48
|
-
};
|
|
49
40
|
/**
|
|
50
41
|
* Implements markdown and relativeURL helpers for templates.
|
|
51
42
|
* @internal
|
|
@@ -98,7 +89,7 @@ output file :
|
|
|
98
89
|
* @param text The markdown string that should be parsed.
|
|
99
90
|
* @returns The resulting html string.
|
|
100
91
|
*/
|
|
101
|
-
parseMarkdown(text) {
|
|
92
|
+
parseMarkdown(text, page) {
|
|
102
93
|
if (this.includes) {
|
|
103
94
|
text = text.replace(this.includePattern, (_match, path) => {
|
|
104
95
|
path = Path.join(this.includes, path.trim());
|
|
@@ -124,7 +115,7 @@ output file :
|
|
|
124
115
|
}
|
|
125
116
|
});
|
|
126
117
|
}
|
|
127
|
-
const event = new events_1.MarkdownEvent(events_1.MarkdownEvent.PARSE, text, text);
|
|
118
|
+
const event = new events_1.MarkdownEvent(events_1.MarkdownEvent.PARSE, page, text, text);
|
|
128
119
|
this.owner.trigger(event);
|
|
129
120
|
return event.parsedText;
|
|
130
121
|
}
|
|
@@ -169,7 +160,19 @@ output file :
|
|
|
169
160
|
const markedOptions = (this.application.options.getValue("markedOptions") ?? {});
|
|
170
161
|
// Set some default values if they are not specified via the TypeDoc option
|
|
171
162
|
markedOptions.highlight ?? (markedOptions.highlight = (text, lang) => this.getHighlighted(text, lang));
|
|
172
|
-
|
|
163
|
+
if (!markedOptions.renderer) {
|
|
164
|
+
markedOptions.renderer = new Marked.Renderer();
|
|
165
|
+
markedOptions.renderer.heading = (text, level, _, slugger) => {
|
|
166
|
+
const slug = slugger.slug(text);
|
|
167
|
+
// Prefix the slug with an extra `$` to prevent conflicts with TypeDoc's anchors.
|
|
168
|
+
this.page.pageHeadings.push({
|
|
169
|
+
link: `#$${slug}`,
|
|
170
|
+
text,
|
|
171
|
+
level,
|
|
172
|
+
});
|
|
173
|
+
return `<a id="$${slug}" class="tsd-anchor"></a><h${level}><a href="#$${slug}" style="color:inherit;text-decoration:none">${text}</a></h${level}>`;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
173
176
|
markedOptions.mangle ?? (markedOptions.mangle = false); // See https://github.com/TypeStrong/typedoc/issues/1395
|
|
174
177
|
return markedOptions;
|
|
175
178
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Theme } from "../../theme";
|
|
2
2
|
import type { Renderer } from "../../renderer";
|
|
3
3
|
import { Reflection, ProjectReflection, ContainerReflection, DeclarationReflection } from "../../../models";
|
|
4
|
-
import { UrlMapping } from "../../models/UrlMapping";
|
|
4
|
+
import { RenderTemplate, UrlMapping } from "../../models/UrlMapping";
|
|
5
5
|
import type { PageEvent } from "../../events";
|
|
6
6
|
import type { MarkedPlugin } from "../../plugins";
|
|
7
7
|
import { DefaultThemeRenderContext } from "./DefaultThemeRenderContext";
|
|
@@ -13,11 +13,11 @@ import { JSX } from "../../../utils";
|
|
|
13
13
|
export declare class DefaultTheme extends Theme {
|
|
14
14
|
/** @internal */
|
|
15
15
|
markedPlugin: MarkedPlugin;
|
|
16
|
-
|
|
17
|
-
getRenderContext(): DefaultThemeRenderContext;
|
|
16
|
+
getRenderContext(pageEvent: PageEvent<Reflection>): DefaultThemeRenderContext;
|
|
18
17
|
reflectionTemplate: (pageEvent: PageEvent<ContainerReflection>) => JSX.Element;
|
|
19
18
|
indexTemplate: (pageEvent: PageEvent<ProjectReflection>) => JSX.Element;
|
|
20
|
-
defaultLayoutTemplate: (pageEvent: PageEvent<Reflection
|
|
19
|
+
defaultLayoutTemplate: (pageEvent: PageEvent<Reflection>, template: RenderTemplate<PageEvent<Reflection>>) => JSX.Element;
|
|
20
|
+
getReflectionClasses(reflection: DeclarationReflection): string;
|
|
21
21
|
/**
|
|
22
22
|
* Mappings of reflections kinds to templates used by this theme.
|
|
23
23
|
*/
|
|
@@ -62,7 +62,7 @@ export declare class DefaultTheme extends Theme {
|
|
|
62
62
|
* @returns The altered urls array.
|
|
63
63
|
*/
|
|
64
64
|
buildUrls(reflection: DeclarationReflection, urls: UrlMapping[]): UrlMapping[];
|
|
65
|
-
render(page: PageEvent<Reflection
|
|
65
|
+
render(page: PageEvent<Reflection>, template: RenderTemplate<PageEvent<Reflection>>): string;
|
|
66
66
|
/**
|
|
67
67
|
* Generate an anchor url for the given reflection and all of its children.
|
|
68
68
|
*
|
|
@@ -11,11 +11,12 @@ const utils_1 = require("../../../utils");
|
|
|
11
11
|
* {@link Theme} implementation, this theme class will be used.
|
|
12
12
|
*/
|
|
13
13
|
class DefaultTheme extends theme_1.Theme {
|
|
14
|
-
getRenderContext() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
getRenderContext(pageEvent) {
|
|
15
|
+
return new DefaultThemeRenderContext_1.DefaultThemeRenderContext(this, pageEvent, this.application.options);
|
|
16
|
+
}
|
|
17
|
+
getReflectionClasses(reflection) {
|
|
18
|
+
const filters = this.application.options.getValue("visibilityFilters");
|
|
19
|
+
return getReflectionClasses(reflection, filters);
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Create a new DefaultTheme instance.
|
|
@@ -26,13 +27,13 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
26
27
|
constructor(renderer) {
|
|
27
28
|
super(renderer);
|
|
28
29
|
this.reflectionTemplate = (pageEvent) => {
|
|
29
|
-
return this.getRenderContext().reflectionTemplate(pageEvent);
|
|
30
|
+
return this.getRenderContext(pageEvent).reflectionTemplate(pageEvent);
|
|
30
31
|
};
|
|
31
32
|
this.indexTemplate = (pageEvent) => {
|
|
32
|
-
return this.getRenderContext().indexTemplate(pageEvent);
|
|
33
|
+
return this.getRenderContext(pageEvent).indexTemplate(pageEvent);
|
|
33
34
|
};
|
|
34
|
-
this.defaultLayoutTemplate = (pageEvent) => {
|
|
35
|
-
return this.getRenderContext().defaultLayout(pageEvent);
|
|
35
|
+
this.defaultLayoutTemplate = (pageEvent, template) => {
|
|
36
|
+
return this.getRenderContext(pageEvent).defaultLayout(template, pageEvent);
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
38
39
|
* Mappings of reflections kinds to templates used by this theme.
|
|
@@ -162,8 +163,8 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
162
163
|
}
|
|
163
164
|
return urls;
|
|
164
165
|
}
|
|
165
|
-
render(page) {
|
|
166
|
-
const templateOutput = this.defaultLayoutTemplate(page);
|
|
166
|
+
render(page, template) {
|
|
167
|
+
const templateOutput = this.defaultLayoutTemplate(page, template);
|
|
167
168
|
return "<!DOCTYPE html>" + utils_1.JSX.renderElement(templateOutput);
|
|
168
169
|
}
|
|
169
170
|
/**
|
|
@@ -193,3 +194,49 @@ exports.DefaultTheme = DefaultTheme;
|
|
|
193
194
|
function hasReadme(readme) {
|
|
194
195
|
return !readme.endsWith("none");
|
|
195
196
|
}
|
|
197
|
+
function toStyleClass(str) {
|
|
198
|
+
return str.replace(/(\w)([A-Z])/g, (_m, m1, m2) => m1 + "-" + m2).toLowerCase();
|
|
199
|
+
}
|
|
200
|
+
function getReflectionClasses(reflection, filters) {
|
|
201
|
+
const classes = [];
|
|
202
|
+
classes.push(toStyleClass("tsd-kind-" + models_1.ReflectionKind[reflection.kind]));
|
|
203
|
+
if (reflection.parent && reflection.parent instanceof models_1.DeclarationReflection) {
|
|
204
|
+
classes.push(toStyleClass(`tsd-parent-kind-${models_1.ReflectionKind[reflection.parent.kind]}`));
|
|
205
|
+
}
|
|
206
|
+
// Filter classes should match up with the settings function in
|
|
207
|
+
// partials/navigation.tsx.
|
|
208
|
+
for (const key of Object.keys(filters)) {
|
|
209
|
+
if (key === "inherited") {
|
|
210
|
+
if (reflection.inheritedFrom) {
|
|
211
|
+
classes.push("tsd-is-inherited");
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (key === "protected") {
|
|
215
|
+
if (reflection.flags.isProtected) {
|
|
216
|
+
classes.push("tsd-is-protected");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (key === "private") {
|
|
220
|
+
if (reflection.flags.isPrivate) {
|
|
221
|
+
classes.push("tsd-is-private");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else if (key === "external") {
|
|
225
|
+
if (reflection.flags.isExternal) {
|
|
226
|
+
classes.push("tsd-is-external");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else if (key.startsWith("@")) {
|
|
230
|
+
if (key === "@deprecated") {
|
|
231
|
+
if (reflection.isDeprecated()) {
|
|
232
|
+
classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else if (reflection.comment?.hasModifier(key) ||
|
|
236
|
+
reflection.comment?.getTag(key)) {
|
|
237
|
+
classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return classes.join(" ");
|
|
242
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { RendererHooks } from "../..";
|
|
2
|
-
import { CommentDisplayPart, DeclarationReflection, ReferenceType, Reflection
|
|
1
|
+
import type { PageEvent, RendererHooks } from "../..";
|
|
2
|
+
import { CommentDisplayPart, DeclarationReflection, ReferenceType, Reflection } from "../../../models";
|
|
3
3
|
import type { NeverIfInternal, Options } from "../../../utils";
|
|
4
4
|
import type { DefaultTheme } from "./DefaultTheme";
|
|
5
5
|
export declare class DefaultThemeRenderContext {
|
|
6
6
|
private theme;
|
|
7
|
+
page: PageEvent<Reflection>;
|
|
7
8
|
options: Options;
|
|
8
|
-
constructor(theme: DefaultTheme, options: Options);
|
|
9
|
-
icons: Record<"search" | "anchor" | ReflectionKind | "checkbox" | "chevronDown" | "menu" | "chevronSmall", () => import("../../../utils/jsx.elements").JsxElement>;
|
|
9
|
+
constructor(theme: DefaultTheme, page: PageEvent<Reflection>, options: Options);
|
|
10
|
+
icons: Record<"search" | "anchor" | import("../../../models").ReflectionKind | "checkbox" | "chevronDown" | "menu" | "chevronSmall", () => import("../../../utils/jsx.elements").JsxElement>;
|
|
10
11
|
hook: (name: keyof RendererHooks) => import("../../../utils/jsx.elements").JsxElement[];
|
|
11
12
|
/** Avoid this in favor of urlTo if possible */
|
|
12
13
|
relativeURL: (url: string, cacheBust?: boolean) => string;
|
|
@@ -18,15 +19,15 @@ export declare class DefaultThemeRenderContext {
|
|
|
18
19
|
* Will be removed in 0.24.
|
|
19
20
|
*/
|
|
20
21
|
attemptExternalResolution: (type: NeverIfInternal<ReferenceType>) => string | undefined;
|
|
21
|
-
getReflectionClasses: (
|
|
22
|
-
reflectionTemplate: (props:
|
|
23
|
-
indexTemplate: (props:
|
|
24
|
-
defaultLayout: (
|
|
22
|
+
getReflectionClasses: (refl: DeclarationReflection) => string;
|
|
23
|
+
reflectionTemplate: (props: PageEvent<import("../../../models").ContainerReflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
24
|
+
indexTemplate: (props: PageEvent<import("../../../models").ProjectReflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
25
|
+
defaultLayout: (template: import("../..").RenderTemplate<PageEvent<Reflection>>, props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
25
26
|
analytics: () => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
26
27
|
breadcrumb: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
27
28
|
comment: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
28
29
|
footer: () => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
29
|
-
header: (props:
|
|
30
|
+
header: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
30
31
|
hierarchy: (props: import("../../../models").DeclarationHierarchy | undefined) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
31
32
|
index: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
32
33
|
member: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
@@ -44,13 +45,14 @@ export declare class DefaultThemeRenderContext {
|
|
|
44
45
|
memberSources: (props: import("../../../models").SignatureReflection | DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
45
46
|
members: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
46
47
|
membersGroup: (group: import("../../../models").ReflectionGroup) => import("../../../utils/jsx.elements").JsxElement;
|
|
47
|
-
|
|
48
|
+
sidebar: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
49
|
+
pageSidebar: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
48
50
|
sidebarLinks: () => import("../../../utils/jsx.elements").JsxElement | null;
|
|
49
51
|
settings: () => import("../../../utils/jsx.elements").JsxElement;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
navigation: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
53
|
+
pageNavigation: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
52
54
|
parameter: (props: DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
53
|
-
toolbar: (props:
|
|
55
|
+
toolbar: (props: PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
54
56
|
type: (type: import("../../../models").Type | undefined) => import("../../../utils/jsx.elements").JsxElement;
|
|
55
57
|
typeAndParent: (props: import("../../../models").Type) => import("../../../utils/jsx.elements").JsxElement;
|
|
56
58
|
typeParameters: (typeParameters: import("../../../models").TypeParameterReflection[]) => import("../../../utils/jsx.elements").JsxElement;
|
|
@@ -33,8 +33,9 @@ function bind(fn, first) {
|
|
|
33
33
|
return (...r) => fn(first, ...r);
|
|
34
34
|
}
|
|
35
35
|
class DefaultThemeRenderContext {
|
|
36
|
-
constructor(theme, options) {
|
|
36
|
+
constructor(theme, page, options) {
|
|
37
37
|
this.theme = theme;
|
|
38
|
+
this.page = page;
|
|
38
39
|
this.icons = icon_1.icons;
|
|
39
40
|
this.hook = (name) => this.theme.owner.hooks.emit(name, this);
|
|
40
41
|
/** Avoid this in favor of urlTo if possible */
|
|
@@ -50,9 +51,9 @@ class DefaultThemeRenderContext {
|
|
|
50
51
|
};
|
|
51
52
|
this.markdown = (md) => {
|
|
52
53
|
if (md instanceof Array) {
|
|
53
|
-
return this.theme.markedPlugin.parseMarkdown(models_1.Comment.displayPartsToMarkdown(md, this.urlTo));
|
|
54
|
+
return this.theme.markedPlugin.parseMarkdown(models_1.Comment.displayPartsToMarkdown(md, this.urlTo), this.page);
|
|
54
55
|
}
|
|
55
|
-
return md ? this.theme.markedPlugin.parseMarkdown(md) : "";
|
|
56
|
+
return md ? this.theme.markedPlugin.parseMarkdown(md, this.page) : "";
|
|
56
57
|
};
|
|
57
58
|
/**
|
|
58
59
|
* Using this method will repeat work already done, instead of calling it, use `type.externalUrl`.
|
|
@@ -62,10 +63,7 @@ class DefaultThemeRenderContext {
|
|
|
62
63
|
this.attemptExternalResolution = (type) => {
|
|
63
64
|
return type.externalUrl;
|
|
64
65
|
};
|
|
65
|
-
this.getReflectionClasses = (
|
|
66
|
-
const filters = this.options.getValue("visibilityFilters");
|
|
67
|
-
return getReflectionClasses(reflection, filters);
|
|
68
|
-
};
|
|
66
|
+
this.getReflectionClasses = (refl) => this.theme.getReflectionClasses(refl);
|
|
69
67
|
this.reflectionTemplate = bind(reflection_1.reflectionTemplate, this);
|
|
70
68
|
this.indexTemplate = bind(templates_1.indexTemplate, this);
|
|
71
69
|
this.defaultLayout = bind(default_1.defaultLayout, this);
|
|
@@ -86,11 +84,12 @@ class DefaultThemeRenderContext {
|
|
|
86
84
|
this.memberSources = bind(member_sources_1.memberSources, this);
|
|
87
85
|
this.members = bind(members_1.members, this);
|
|
88
86
|
this.membersGroup = bind(members_group_1.membersGroup, this);
|
|
89
|
-
this.
|
|
87
|
+
this.sidebar = bind(navigation_1.sidebar, this);
|
|
88
|
+
this.pageSidebar = bind(navigation_1.pageSidebar, this);
|
|
90
89
|
this.sidebarLinks = bind(navigation_1.sidebarLinks, this);
|
|
91
90
|
this.settings = bind(navigation_1.settings, this);
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
91
|
+
this.navigation = bind(navigation_1.navigation, this);
|
|
92
|
+
this.pageNavigation = bind(navigation_1.pageNavigation, this);
|
|
94
93
|
this.parameter = bind(parameter_1.parameter, this);
|
|
95
94
|
this.toolbar = bind(toolbar_1.toolbar, this);
|
|
96
95
|
this.type = bind(type_1.type, this);
|
|
@@ -100,52 +99,3 @@ class DefaultThemeRenderContext {
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
exports.DefaultThemeRenderContext = DefaultThemeRenderContext;
|
|
103
|
-
function getReflectionClasses(reflection, filters) {
|
|
104
|
-
const classes = [];
|
|
105
|
-
classes.push(toStyleClass("tsd-kind-" + models_1.ReflectionKind[reflection.kind]));
|
|
106
|
-
if (reflection.parent &&
|
|
107
|
-
reflection.parent instanceof models_1.DeclarationReflection) {
|
|
108
|
-
classes.push(toStyleClass(`tsd-parent-kind-${models_1.ReflectionKind[reflection.parent.kind]}`));
|
|
109
|
-
}
|
|
110
|
-
// Filter classes should match up with the settings function in
|
|
111
|
-
// partials/navigation.tsx.
|
|
112
|
-
for (const key of Object.keys(filters)) {
|
|
113
|
-
if (key === "inherited") {
|
|
114
|
-
if (reflection.inheritedFrom) {
|
|
115
|
-
classes.push("tsd-is-inherited");
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
else if (key === "protected") {
|
|
119
|
-
if (reflection.flags.isProtected) {
|
|
120
|
-
classes.push("tsd-is-protected");
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else if (key === "private") {
|
|
124
|
-
if (reflection.flags.isPrivate) {
|
|
125
|
-
classes.push("tsd-is-private");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else if (key === "external") {
|
|
129
|
-
if (reflection.flags.isExternal) {
|
|
130
|
-
classes.push("tsd-is-external");
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else if (key.startsWith("@")) {
|
|
134
|
-
if (key === "@deprecated") {
|
|
135
|
-
if (reflection.isDeprecated()) {
|
|
136
|
-
classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else if (reflection.comment?.hasModifier(key) ||
|
|
140
|
-
reflection.comment?.getTag(key)) {
|
|
141
|
-
classes.push(toStyleClass(`tsd-is-${key.substring(1)}`));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return classes.join(" ");
|
|
146
|
-
}
|
|
147
|
-
function toStyleClass(str) {
|
|
148
|
-
return str
|
|
149
|
-
.replace(/(\w)([A-Z])/g, (_m, m1, m2) => m1 + "-" + m2)
|
|
150
|
-
.toLowerCase();
|
|
151
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { RenderTemplate } from "../../..";
|
|
1
2
|
import type { Reflection } from "../../../../models";
|
|
2
3
|
import { JSX } from "../../../../utils";
|
|
3
4
|
import type { PageEvent } from "../../../events";
|
|
4
5
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
5
|
-
export declare const defaultLayout: (context: DefaultThemeRenderContext, props: PageEvent<Reflection>) => JSX.Element;
|
|
6
|
+
export declare const defaultLayout: (context: DefaultThemeRenderContext, template: RenderTemplate<PageEvent<Reflection>>, props: PageEvent<Reflection>) => JSX.Element;
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultLayout = void 0;
|
|
4
4
|
const utils_1 = require("../../../../utils");
|
|
5
|
-
const
|
|
5
|
+
const lib_1 = require("../../lib");
|
|
6
|
+
const defaultLayout = (context, template, props) => (utils_1.JSX.createElement("html", { class: "default", lang: context.options.getValue("htmlLang") },
|
|
6
7
|
utils_1.JSX.createElement("head", null,
|
|
7
8
|
utils_1.JSX.createElement("meta", { charSet: "utf-8" }),
|
|
8
9
|
context.hook("head.begin"),
|
|
9
10
|
utils_1.JSX.createElement("meta", { "http-equiv": "x-ua-compatible", content: "IE=edge" }),
|
|
10
|
-
utils_1.JSX.createElement("title", null, props.model.
|
|
11
|
-
? props.
|
|
12
|
-
: `${props.model
|
|
11
|
+
utils_1.JSX.createElement("title", null, props.model.isProject()
|
|
12
|
+
? (0, lib_1.getDisplayName)(props.model)
|
|
13
|
+
: `${(0, lib_1.getDisplayName)(props.model)} | ${(0, lib_1.getDisplayName)(props.project)}`),
|
|
13
14
|
utils_1.JSX.createElement("meta", { name: "description", content: "Documentation for " + props.project.name }),
|
|
14
15
|
utils_1.JSX.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
|
|
15
16
|
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/style.css", true) }),
|
|
16
17
|
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/highlight.css", true) }),
|
|
17
18
|
context.options.getValue("customCss") && (utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/custom.css", true) })),
|
|
19
|
+
utils_1.JSX.createElement("script", { defer: true, src: context.relativeURL("assets/main.js", true) }),
|
|
18
20
|
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js", true), id: "search-script" }),
|
|
19
21
|
context.hook("head.end")),
|
|
20
22
|
utils_1.JSX.createElement("body", null,
|
|
@@ -23,18 +25,22 @@ const defaultLayout = (context, props) => (utils_1.JSX.createElement("html", { c
|
|
|
23
25
|
utils_1.JSX.createElement(utils_1.Raw, { html: 'document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"' })),
|
|
24
26
|
context.toolbar(props),
|
|
25
27
|
utils_1.JSX.createElement("div", { class: "container container-main" },
|
|
26
|
-
utils_1.JSX.createElement("div", { class: "col-
|
|
27
|
-
context.hook("navigation.begin"),
|
|
28
|
-
context.navigation(props),
|
|
29
|
-
context.hook("navigation.end")),
|
|
30
|
-
utils_1.JSX.createElement("div", { class: "col-8 col-content" },
|
|
28
|
+
utils_1.JSX.createElement("div", { class: "col-content" },
|
|
31
29
|
context.hook("content.begin"),
|
|
32
30
|
context.header(props),
|
|
33
|
-
|
|
34
|
-
context.hook("content.end"))
|
|
31
|
+
template(props),
|
|
32
|
+
context.hook("content.end")),
|
|
33
|
+
utils_1.JSX.createElement("div", { class: "col-sidebar" },
|
|
34
|
+
utils_1.JSX.createElement("div", { class: "page-menu" },
|
|
35
|
+
context.hook("pageSidebar.begin"),
|
|
36
|
+
context.pageSidebar(props),
|
|
37
|
+
context.hook("pageSidebar.end")),
|
|
38
|
+
utils_1.JSX.createElement("div", { class: "site-menu" },
|
|
39
|
+
context.hook("sidebar.begin"),
|
|
40
|
+
context.sidebar(props),
|
|
41
|
+
context.hook("sidebar.end")))),
|
|
35
42
|
context.footer(),
|
|
36
43
|
utils_1.JSX.createElement("div", { class: "overlay" }),
|
|
37
|
-
utils_1.JSX.createElement("script", { src: context.relativeURL("assets/main.js", true) }),
|
|
38
44
|
context.analytics(),
|
|
39
45
|
context.hook("body.end"))));
|
|
40
46
|
exports.defaultLayout = defaultLayout;
|
|
@@ -5,7 +5,7 @@ const utils_1 = require("../../../../utils");
|
|
|
5
5
|
function footer(context) {
|
|
6
6
|
const hideGenerator = context.options.getValue("hideGenerator");
|
|
7
7
|
if (!hideGenerator)
|
|
8
|
-
return (utils_1.JSX.createElement("div", { class: "
|
|
8
|
+
return (utils_1.JSX.createElement("div", { class: "tsd-generator" },
|
|
9
9
|
utils_1.JSX.createElement("p", null,
|
|
10
10
|
"Generated using ",
|
|
11
11
|
utils_1.JSX.createElement("a", { href: "https://typedoc.org/", target: "_blank" }, "TypeDoc"))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
2
2
|
import { JSX } from "../../../../utils";
|
|
3
3
|
import { DeclarationReflection } from "../../../../models";
|
|
4
|
-
export declare
|
|
4
|
+
export declare function member(context: DefaultThemeRenderContext, props: DeclarationReflection): JSX.Element;
|
|
@@ -5,18 +5,26 @@ const lib_1 = require("../../lib");
|
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
6
|
const models_1 = require("../../../../models");
|
|
7
7
|
const anchor_icon_1 = require("./anchor-icon");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(0, lib_1.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
: props.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
function member(context, props) {
|
|
9
|
+
context.page.pageHeadings.push({
|
|
10
|
+
link: `#${props.anchor}`,
|
|
11
|
+
text: (0, lib_1.getDisplayName)(props),
|
|
12
|
+
kind: props.kind,
|
|
13
|
+
classes: context.getReflectionClasses(props),
|
|
14
|
+
});
|
|
15
|
+
return (utils_1.JSX.createElement("section", { class: (0, lib_1.classNames)({ "tsd-panel": true, "tsd-member": true }, context.getReflectionClasses(props)) },
|
|
16
|
+
utils_1.JSX.createElement("a", { id: props.anchor, class: "tsd-anchor" }),
|
|
17
|
+
!!props.name && (utils_1.JSX.createElement("h3", { class: "tsd-anchor-link" },
|
|
18
|
+
(0, lib_1.renderFlags)(props.flags, props.comment),
|
|
19
|
+
utils_1.JSX.createElement("span", { class: (0, lib_1.classNames)({ deprecated: props.isDeprecated() }) }, (0, lib_1.wbr)(props.name)),
|
|
20
|
+
(0, anchor_icon_1.anchorIcon)(context, props.anchor))),
|
|
21
|
+
props.signatures
|
|
22
|
+
? context.memberSignatures(props)
|
|
23
|
+
: props.hasGetterOrSetter()
|
|
24
|
+
? context.memberGetterSetter(props)
|
|
25
|
+
: props instanceof models_1.ReferenceReflection
|
|
26
|
+
? context.memberReference(props)
|
|
27
|
+
: context.memberDeclaration(props),
|
|
28
|
+
props.groups?.map((item) => item.children.map((item) => !item.hasOwnDocument && context.member(item)))));
|
|
29
|
+
}
|
|
22
30
|
exports.member = member;
|
|
@@ -6,10 +6,10 @@ function membersGroup(context, group) {
|
|
|
6
6
|
if (group.categories) {
|
|
7
7
|
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null, group.categories.map((item) => (utils_1.JSX.createElement("section", { class: "tsd-panel-group tsd-member-group" },
|
|
8
8
|
utils_1.JSX.createElement("h2", null,
|
|
9
|
+
group.title,
|
|
9
10
|
!!item.title && utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
group.title),
|
|
11
|
+
" - ",
|
|
12
|
+
item.title)),
|
|
13
13
|
item.children.map((item) => !item.hasOwnDocument && context.member(item)))))));
|
|
14
14
|
}
|
|
15
15
|
return (utils_1.JSX.createElement("section", { class: "tsd-panel-group tsd-member-group" },
|
|
@@ -2,8 +2,9 @@ import { Reflection } from "../../../../models";
|
|
|
2
2
|
import { JSX } from "../../../../utils";
|
|
3
3
|
import type { PageEvent } from "../../../events";
|
|
4
4
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function sidebar(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
|
|
6
6
|
export declare function sidebarLinks(context: DefaultThemeRenderContext): JSX.Element | null;
|
|
7
7
|
export declare function settings(context: DefaultThemeRenderContext): JSX.Element;
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
8
|
+
export declare function navigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
|
|
9
|
+
export declare function pageSidebar(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
|
|
10
|
+
export declare function pageNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
|