varvara-typedoc-theme 0.3.9 → 0.3.11
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/assets/overrides.css +15 -6
- package/dist/index.js +260 -215
- package/package.json +4 -3
package/assets/overrides.css
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
--va-space-ratio: 0.78;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
[data-theme=
|
|
7
|
+
[data-theme="light"] {
|
|
8
8
|
color-scheme: light;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
[data-theme=
|
|
11
|
+
[data-theme="dark"] {
|
|
12
12
|
color-scheme: dark;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -81,10 +81,19 @@ dialog {
|
|
|
81
81
|
background-color: var(--va-background-color-default);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.navigation-links a span
|
|
84
|
+
.navigation-links a span,
|
|
85
|
+
.tsd-navigation a span {
|
|
85
86
|
flex: 1;
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
.tsd-navigation {
|
|
90
|
+
margin-bottom: var(--va-space-4);
|
|
91
|
+
|
|
92
|
+
a {
|
|
93
|
+
width: 100%;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
88
97
|
.site-menu {
|
|
89
98
|
margin-top: 0;
|
|
90
99
|
}
|
|
@@ -132,7 +141,7 @@ footer {
|
|
|
132
141
|
|
|
133
142
|
@media (min-width: 770px) {
|
|
134
143
|
.container-main {
|
|
135
|
-
grid-template-areas:
|
|
144
|
+
grid-template-areas: "header content" "sidebar content";
|
|
136
145
|
grid-auto-rows: auto 1fr;
|
|
137
146
|
margin: var(--va-space-6) auto;
|
|
138
147
|
}
|
|
@@ -150,8 +159,8 @@ footer {
|
|
|
150
159
|
.container-main {
|
|
151
160
|
grid-template-columns: minmax(0, 20rem) minmax(0, 2.5fr) minmax(0, 20rem);
|
|
152
161
|
grid-template-areas:
|
|
153
|
-
|
|
154
|
-
|
|
162
|
+
"header content toc"
|
|
163
|
+
"sidebar content toc";
|
|
155
164
|
}
|
|
156
165
|
.page-menu,
|
|
157
166
|
.site-menu {
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,19 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
3
3
|
|
|
4
4
|
// src/themes/VarvaraTheme.tsx
|
|
5
|
-
import
|
|
6
|
-
import * as path from "path";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import {
|
|
9
|
+
DefaultTheme,
|
|
10
|
+
JSX as JSX6,
|
|
11
|
+
RendererEvent
|
|
12
|
+
} from "typedoc";
|
|
9
13
|
|
|
10
14
|
// src/themes/VarvaraThemeContext.ts
|
|
11
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
DefaultThemeRenderContext
|
|
17
|
+
} from "typedoc";
|
|
12
18
|
|
|
13
19
|
// src/partials/footer.tsx
|
|
14
20
|
import { i18n, JSX } from "typedoc";
|
|
@@ -18,7 +24,7 @@ function footer(context) {
|
|
|
18
24
|
if (!hideGenerator) {
|
|
19
25
|
const message = i18n.theme_generated_using_typedoc();
|
|
20
26
|
const index = message.indexOf("TypeDoc");
|
|
21
|
-
if (index
|
|
27
|
+
if (index === -1) {
|
|
22
28
|
generatorDisplay = /* @__PURE__ */ JSX.createElement("p", {
|
|
23
29
|
class: "tsd-generator"
|
|
24
30
|
}, message);
|
|
@@ -30,11 +36,13 @@ function footer(context) {
|
|
|
30
36
|
}, pre, /* @__PURE__ */ JSX.createElement("a", {
|
|
31
37
|
href: "https://typedoc.org/",
|
|
32
38
|
class: "va-link",
|
|
33
|
-
target: "_blank"
|
|
39
|
+
target: "_blank",
|
|
40
|
+
rel: "noopener"
|
|
34
41
|
}, "TypeDoc"), " & ", /* @__PURE__ */ JSX.createElement("a", {
|
|
35
42
|
href: "https://varvara.js.org/",
|
|
36
43
|
class: "va-link",
|
|
37
|
-
target: "_blank"
|
|
44
|
+
target: "_blank",
|
|
45
|
+
rel: "noopener"
|
|
38
46
|
}, "Varvara CSS"), post);
|
|
39
47
|
}
|
|
40
48
|
}
|
|
@@ -56,11 +64,168 @@ function footer(context) {
|
|
|
56
64
|
}, context.hook("footer.begin", context), generatorDisplay, customFooterDisplay, context.hook("footer.end", context)));
|
|
57
65
|
}
|
|
58
66
|
|
|
67
|
+
// src/partials/layout.tsx
|
|
68
|
+
import { extname } from "node:path";
|
|
69
|
+
import {
|
|
70
|
+
JSX as JSX2
|
|
71
|
+
} from "typedoc";
|
|
72
|
+
|
|
73
|
+
// src/utils.ts
|
|
74
|
+
import { DeclarationReflection, ProjectReflection, ReflectionKind } from "typedoc";
|
|
75
|
+
function getDisplayName(refl) {
|
|
76
|
+
let version = "";
|
|
77
|
+
if ((refl instanceof DeclarationReflection || refl instanceof ProjectReflection) && refl.packageVersion) {
|
|
78
|
+
version = ` - v${refl.packageVersion}`;
|
|
79
|
+
}
|
|
80
|
+
return `${refl.name}${version}`;
|
|
81
|
+
}
|
|
82
|
+
var rootsCache = new WeakMap;
|
|
83
|
+
function getHierarchyRoots(project) {
|
|
84
|
+
const cached = rootsCache.get(project);
|
|
85
|
+
if (cached)
|
|
86
|
+
return cached;
|
|
87
|
+
const allClasses = project.getReflectionsByKind(ReflectionKind.ClassOrInterface);
|
|
88
|
+
const roots = allClasses.filter((refl) => {
|
|
89
|
+
if (!refl.implementedBy && !refl.extendedBy) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (!refl.implementedTypes && !refl.extendedTypes) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
const types = [...refl.implementedTypes || [], ...refl.extendedTypes || []];
|
|
96
|
+
return types.every((type) => !type.visit({
|
|
97
|
+
reference(ref) {
|
|
98
|
+
return ref.reflection !== undefined;
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
const result = roots.sort((a, b) => a.name.localeCompare(b.name));
|
|
103
|
+
rootsCache.set(project, result);
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/partials/layout.tsx
|
|
108
|
+
function layout(context) {
|
|
109
|
+
return (template, props) => /* @__PURE__ */ JSX2.createElement("html", {
|
|
110
|
+
class: "default",
|
|
111
|
+
lang: context.options.getValue("lang"),
|
|
112
|
+
"data-base": context.relativeURL("./")
|
|
113
|
+
}, /* @__PURE__ */ JSX2.createElement("head", null, /* @__PURE__ */ JSX2.createElement("meta", {
|
|
114
|
+
charset: "utf-8"
|
|
115
|
+
}), context.hook("head.begin", context), /* @__PURE__ */ JSX2.createElement("meta", {
|
|
116
|
+
"http-equiv": "x-ua-compatible",
|
|
117
|
+
content: "IE=edge"
|
|
118
|
+
}), /* @__PURE__ */ JSX2.createElement("title", null, props.model.isProject() ? getDisplayName(props.model) : `${getDisplayName(props.model)} | ${getDisplayName(props.project)}`), favicon(context), props.url === "index.html" && buildSiteMetadata(context), /* @__PURE__ */ JSX2.createElement("meta", {
|
|
119
|
+
name: "description",
|
|
120
|
+
content: `Documentation for ${props.project.name}`
|
|
121
|
+
}), /* @__PURE__ */ JSX2.createElement("meta", {
|
|
122
|
+
name: "viewport",
|
|
123
|
+
content: "width=device-width, initial-scale=1"
|
|
124
|
+
}), /* @__PURE__ */ JSX2.createElement("link", {
|
|
125
|
+
rel: "stylesheet",
|
|
126
|
+
href: context.relativeURL("assets/style.css", true)
|
|
127
|
+
}), /* @__PURE__ */ JSX2.createElement("link", {
|
|
128
|
+
rel: "stylesheet",
|
|
129
|
+
href: context.relativeURL("assets/highlight.css", true)
|
|
130
|
+
}), /* @__PURE__ */ JSX2.createElement("script", {
|
|
131
|
+
defer: true,
|
|
132
|
+
src: context.relativeURL("assets/main.js", true)
|
|
133
|
+
}), /* @__PURE__ */ JSX2.createElement("script", {
|
|
134
|
+
async: true,
|
|
135
|
+
src: context.relativeURL("assets/icons.js", true),
|
|
136
|
+
id: "tsd-icons-script"
|
|
137
|
+
}), /* @__PURE__ */ JSX2.createElement("script", {
|
|
138
|
+
async: true,
|
|
139
|
+
src: context.relativeURL("assets/search.js", true),
|
|
140
|
+
id: "tsd-search-script"
|
|
141
|
+
}), /* @__PURE__ */ JSX2.createElement("script", {
|
|
142
|
+
async: true,
|
|
143
|
+
src: context.relativeURL("assets/navigation.js", true),
|
|
144
|
+
id: "tsd-nav-script"
|
|
145
|
+
}), !!getHierarchyRoots(props.project).length && /* @__PURE__ */ JSX2.createElement("script", {
|
|
146
|
+
async: true,
|
|
147
|
+
src: context.relativeURL("assets/hierarchy.js", true),
|
|
148
|
+
id: "tsd-hierarchy-script"
|
|
149
|
+
}), context.hook("head.end", context), context.options.getValue("customCss") && /* @__PURE__ */ JSX2.createElement("link", {
|
|
150
|
+
rel: "stylesheet",
|
|
151
|
+
href: context.relativeURL("assets/custom.css", true)
|
|
152
|
+
}), context.options.getValue("customJs") && /* @__PURE__ */ JSX2.createElement("script", {
|
|
153
|
+
defer: true,
|
|
154
|
+
src: context.relativeURL("assets/custom.js", true)
|
|
155
|
+
})), /* @__PURE__ */ JSX2.createElement("body", null, context.hook("body.begin", context), /* @__PURE__ */ JSX2.createElement("script", null, /* @__PURE__ */ JSX2.createElement(JSX2.Raw, {
|
|
156
|
+
html: 'document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";'
|
|
157
|
+
})), /* @__PURE__ */ JSX2.createElement("div", {
|
|
158
|
+
class: "container container-main"
|
|
159
|
+
}, context.toolbar(props), /* @__PURE__ */ JSX2.createElement("div", {
|
|
160
|
+
class: "col-content"
|
|
161
|
+
}, context.hook("content.begin", context), context.header(props), template(props), context.hook("content.end", context)), /* @__PURE__ */ JSX2.createElement("div", {
|
|
162
|
+
class: "col-sidebar"
|
|
163
|
+
}, /* @__PURE__ */ JSX2.createElement("div", {
|
|
164
|
+
class: "page-menu"
|
|
165
|
+
}, context.hook("pageSidebar.begin", context), context.pageSidebar(props), context.hook("pageSidebar.end", context)), /* @__PURE__ */ JSX2.createElement("div", {
|
|
166
|
+
class: "site-menu"
|
|
167
|
+
}, context.hook("sidebar.begin", context), context.sidebar(props), context.hook("sidebar.end", context)))), context.footer(), /* @__PURE__ */ JSX2.createElement("div", {
|
|
168
|
+
class: "overlay"
|
|
169
|
+
}), context.hook("body.end", context)));
|
|
170
|
+
}
|
|
171
|
+
function favicon(context) {
|
|
172
|
+
const fav = context.options.getValue("favicon");
|
|
173
|
+
if (!fav)
|
|
174
|
+
return null;
|
|
175
|
+
switch (extname(fav)) {
|
|
176
|
+
case ".ico":
|
|
177
|
+
return /* @__PURE__ */ JSX2.createElement("link", {
|
|
178
|
+
rel: "icon",
|
|
179
|
+
href: context.relativeURL("assets/favicon.ico", true)
|
|
180
|
+
});
|
|
181
|
+
case ".png":
|
|
182
|
+
return /* @__PURE__ */ JSX2.createElement("link", {
|
|
183
|
+
rel: "icon",
|
|
184
|
+
href: context.relativeURL("assets/favicon.png", true),
|
|
185
|
+
type: "image/png"
|
|
186
|
+
});
|
|
187
|
+
case ".svg":
|
|
188
|
+
return /* @__PURE__ */ JSX2.createElement("link", {
|
|
189
|
+
rel: "icon",
|
|
190
|
+
href: context.relativeURL("assets/favicon.svg", true),
|
|
191
|
+
type: "image/svg+xml"
|
|
192
|
+
});
|
|
193
|
+
default:
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function buildSiteMetadata(context) {
|
|
198
|
+
try {
|
|
199
|
+
const url = new URL(context.options.getValue("hostedBaseUrl"));
|
|
200
|
+
if (url.pathname !== "/") {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ JSX2.createElement("script", {
|
|
204
|
+
type: "application/ld+json"
|
|
205
|
+
}, /* @__PURE__ */ JSX2.createElement(JSX2.Raw, {
|
|
206
|
+
html: JSON.stringify({
|
|
207
|
+
"@context": "https://schema.org",
|
|
208
|
+
"@type": "WebSite",
|
|
209
|
+
name: context.page.project.name,
|
|
210
|
+
url: url.toString()
|
|
211
|
+
})
|
|
212
|
+
}));
|
|
213
|
+
} catch {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
59
218
|
// src/partials/navigation.tsx
|
|
60
|
-
import {
|
|
219
|
+
import {
|
|
220
|
+
i18n as i18n2,
|
|
221
|
+
JSX as JSX3,
|
|
222
|
+
ReflectionFlag,
|
|
223
|
+
ReflectionFlags,
|
|
224
|
+
translateTagName
|
|
225
|
+
} from "typedoc";
|
|
61
226
|
function pageSidebar(context) {
|
|
62
227
|
return (props) => {
|
|
63
|
-
return /* @__PURE__ */
|
|
228
|
+
return /* @__PURE__ */ JSX3.createElement("div", {
|
|
64
229
|
class: "va-button-group"
|
|
65
230
|
}, context.settings(), context.pageNavigation(props));
|
|
66
231
|
};
|
|
@@ -83,19 +248,19 @@ function settings(context) {
|
|
|
83
248
|
visibilityOptions.push(buildFilterItem(context, key, ReflectionFlags.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
|
|
84
249
|
}
|
|
85
250
|
}
|
|
86
|
-
return /* @__PURE__ */
|
|
251
|
+
return /* @__PURE__ */ JSX3.createElement("details", {
|
|
87
252
|
class: "va-collapse settings tsd-accordion",
|
|
88
253
|
open: false
|
|
89
|
-
}, /* @__PURE__ */
|
|
254
|
+
}, /* @__PURE__ */ JSX3.createElement("summary", null, i18n2.theme_settings()), visibilityOptions.length && /* @__PURE__ */ JSX3.createElement("details", {
|
|
90
255
|
class: "va-collapse"
|
|
91
|
-
}, /* @__PURE__ */
|
|
256
|
+
}, /* @__PURE__ */ JSX3.createElement("summary", null, i18n2.theme_member_visibility()), ...visibilityOptions), /* @__PURE__ */ JSX3.createElement("label", null, /* @__PURE__ */ JSX3.createElement("span", null, i18n2.theme_theme()), /* @__PURE__ */ JSX3.createElement("select", {
|
|
92
257
|
id: "tsd-theme",
|
|
93
258
|
class: "va-select"
|
|
94
|
-
}, /* @__PURE__ */
|
|
259
|
+
}, /* @__PURE__ */ JSX3.createElement("option", {
|
|
95
260
|
value: "os"
|
|
96
|
-
}, i18n2.theme_os()), /* @__PURE__ */
|
|
261
|
+
}, i18n2.theme_os()), /* @__PURE__ */ JSX3.createElement("option", {
|
|
97
262
|
value: "light"
|
|
98
|
-
}, i18n2.theme_light()), /* @__PURE__ */
|
|
263
|
+
}, i18n2.theme_light()), /* @__PURE__ */ JSX3.createElement("option", {
|
|
99
264
|
value: "dark"
|
|
100
265
|
}, i18n2.theme_dark()))));
|
|
101
266
|
};
|
|
@@ -109,7 +274,7 @@ function buildSectionNavigation(context, headings) {
|
|
|
109
274
|
levels[levels.length - 1] = level;
|
|
110
275
|
return;
|
|
111
276
|
}
|
|
112
|
-
const built = /* @__PURE__ */
|
|
277
|
+
const built = /* @__PURE__ */ JSX3.createElement(JSX3.Fragment, null, level.map((l) => /* @__PURE__ */ JSX3.createElement(JSX3.Fragment, null, l)));
|
|
113
278
|
levels[levels.length - 1].push(built);
|
|
114
279
|
}
|
|
115
280
|
for (const heading of headings) {
|
|
@@ -121,11 +286,11 @@ function buildSectionNavigation(context, headings) {
|
|
|
121
286
|
levels.push([]);
|
|
122
287
|
}
|
|
123
288
|
const icon = heading.kind && context.icons[heading.kind]();
|
|
124
|
-
levels[levels.length - 1].push(/* @__PURE__ */
|
|
289
|
+
levels[levels.length - 1].push(/* @__PURE__ */ JSX3.createElement("a", {
|
|
125
290
|
href: heading.link,
|
|
126
291
|
class: [heading.classes, "va-button"].join(" "),
|
|
127
292
|
style: !icon ? `padding-left: ${PADDING_PER_LEVEL * (inferredLevel - 1)}px` : ""
|
|
128
|
-
}, icon, /* @__PURE__ */
|
|
293
|
+
}, icon, /* @__PURE__ */ JSX3.createElement("span", null, heading.text)));
|
|
129
294
|
}
|
|
130
295
|
while (levels.length > 1) {
|
|
131
296
|
finalizeLevel(true);
|
|
@@ -135,9 +300,9 @@ function buildSectionNavigation(context, headings) {
|
|
|
135
300
|
return levels[0];
|
|
136
301
|
}
|
|
137
302
|
function buildFilterItem(_context, name, displayName, defaultValue) {
|
|
138
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ JSX3.createElement("label", {
|
|
139
304
|
class: "tsd-filter-item"
|
|
140
|
-
}, /* @__PURE__ */
|
|
305
|
+
}, /* @__PURE__ */ JSX3.createElement("span", null, displayName), /* @__PURE__ */ JSX3.createElement("input", {
|
|
141
306
|
class: "tsd-filter-input va-checkbox",
|
|
142
307
|
type: "checkbox",
|
|
143
308
|
id: `tsd-filter-${name}`,
|
|
@@ -148,83 +313,118 @@ function buildFilterItem(_context, name, displayName, defaultValue) {
|
|
|
148
313
|
function pageNavigation(context) {
|
|
149
314
|
return (props) => {
|
|
150
315
|
if (!props.pageSections.some((sect) => sect.headings.length)) {
|
|
151
|
-
return /* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ JSX3.createElement(JSX3.Fragment, null);
|
|
152
317
|
}
|
|
153
318
|
const sections = [];
|
|
154
319
|
for (const section of props.pageSections) {
|
|
155
320
|
if (section.title) {
|
|
156
|
-
sections.push(/* @__PURE__ */
|
|
321
|
+
sections.push(/* @__PURE__ */ JSX3.createElement("details", {
|
|
157
322
|
open: true,
|
|
158
323
|
class: "va-collapse tsd-accordion"
|
|
159
|
-
}, /* @__PURE__ */
|
|
324
|
+
}, /* @__PURE__ */ JSX3.createElement("summary", {
|
|
160
325
|
"data-key": `section-${section.title}`
|
|
161
326
|
}, section.title), buildSectionNavigation(context, section.headings)));
|
|
162
327
|
} else {
|
|
163
328
|
sections.push(buildSectionNavigation(context, section.headings));
|
|
164
329
|
}
|
|
165
330
|
}
|
|
166
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ JSX3.createElement("details", {
|
|
167
332
|
open: false,
|
|
168
333
|
class: "va-collapse page-navigation tsd-accordion"
|
|
169
|
-
}, /* @__PURE__ */
|
|
334
|
+
}, /* @__PURE__ */ JSX3.createElement("summary", null, i18n2.theme_on_this_page()), sections);
|
|
170
335
|
};
|
|
171
336
|
}
|
|
172
|
-
var navigation = (context) => (
|
|
337
|
+
var navigation = (context) => (_props) => {
|
|
173
338
|
const navigationData = context.getNavigation();
|
|
174
|
-
return /* @__PURE__ */
|
|
339
|
+
return /* @__PURE__ */ JSX3.createElement("nav", {
|
|
175
340
|
class: "va-button-group"
|
|
176
|
-
}, /* @__PURE__ */
|
|
341
|
+
}, /* @__PURE__ */ JSX3.createElement(Navigation, {
|
|
177
342
|
data: navigationData,
|
|
178
343
|
context
|
|
179
344
|
}));
|
|
180
345
|
};
|
|
181
|
-
var Navigation = ({
|
|
346
|
+
var Navigation = ({
|
|
347
|
+
data,
|
|
348
|
+
context
|
|
349
|
+
}) => /* @__PURE__ */ JSX3.createElement(JSX3.Fragment, null, data.map((item) => item.children && item.children.length > 0 ? /* @__PURE__ */ JSX3.createElement("details", {
|
|
182
350
|
class: "va-collapse tsd-accordion"
|
|
183
|
-
}, /* @__PURE__ */
|
|
351
|
+
}, /* @__PURE__ */ JSX3.createElement("summary", {
|
|
184
352
|
class: "tsd-accordion-summary",
|
|
185
353
|
"data-key": `section-${item.text}`
|
|
186
|
-
}, item.kind && context.icons[item.kind](), item.text), /* @__PURE__ */
|
|
354
|
+
}, item.kind && context.icons[item.kind](), item.text), /* @__PURE__ */ JSX3.createElement(Navigation, {
|
|
187
355
|
data: item.children,
|
|
188
356
|
context
|
|
189
|
-
})) : /* @__PURE__ */
|
|
357
|
+
})) : /* @__PURE__ */ JSX3.createElement(Item, {
|
|
190
358
|
item,
|
|
191
359
|
context
|
|
192
360
|
})));
|
|
193
|
-
var Item = ({
|
|
361
|
+
var Item = ({
|
|
362
|
+
item,
|
|
363
|
+
context
|
|
364
|
+
}) => {
|
|
194
365
|
const icon = item.kind && context.icons[item.kind]();
|
|
195
|
-
return item.path ? /* @__PURE__ */
|
|
366
|
+
return item.path ? /* @__PURE__ */ JSX3.createElement("a", {
|
|
196
367
|
href: context.relativeURL(item.path),
|
|
197
368
|
class: "va-button"
|
|
198
|
-
}, icon, /* @__PURE__ */
|
|
369
|
+
}, icon, /* @__PURE__ */ JSX3.createElement("span", null, item.text)) : /* @__PURE__ */ JSX3.createElement("span", {
|
|
199
370
|
class: "va-button"
|
|
200
|
-
}, icon, /* @__PURE__ */
|
|
371
|
+
}, icon, /* @__PURE__ */ JSX3.createElement("span", null, item.text));
|
|
201
372
|
};
|
|
202
373
|
|
|
374
|
+
// src/partials/sidebar-links.tsx
|
|
375
|
+
import { JSX as JSX4 } from "typedoc";
|
|
376
|
+
function sidebarLinks(context) {
|
|
377
|
+
const links = Object.entries(context.options.getValue("sidebarLinks"));
|
|
378
|
+
const navLinks = Object.entries(context.options.getValue("navigationLinks"));
|
|
379
|
+
if (!links.length && !navLinks.length) {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
return /* @__PURE__ */ JSX4.createElement("nav", {
|
|
383
|
+
id: "tsd-sidebar-links",
|
|
384
|
+
class: "tsd-navigation va-button-group"
|
|
385
|
+
}, links.map(([label, url]) => /* @__PURE__ */ JSX4.createElement("a", {
|
|
386
|
+
href: url,
|
|
387
|
+
class: "va-button"
|
|
388
|
+
}, /* @__PURE__ */ JSX4.createElement("span", null, label), /* @__PURE__ */ JSX4.createElement("i", {
|
|
389
|
+
class: "va-icon va-icon--external"
|
|
390
|
+
}))), navLinks.map(([label, url]) => /* @__PURE__ */ JSX4.createElement("a", {
|
|
391
|
+
href: url,
|
|
392
|
+
class: "va-button"
|
|
393
|
+
}, /* @__PURE__ */ JSX4.createElement("span", null, label), /* @__PURE__ */ JSX4.createElement("i", {
|
|
394
|
+
class: "va-icon va-icon--external"
|
|
395
|
+
}))));
|
|
396
|
+
}
|
|
397
|
+
|
|
203
398
|
// src/partials/toolbar.tsx
|
|
204
|
-
import {
|
|
399
|
+
import {
|
|
400
|
+
DeclarationReflection as DeclarationReflection2,
|
|
401
|
+
i18n as i18n3,
|
|
402
|
+
JSX as JSX5,
|
|
403
|
+
ProjectReflection as ProjectReflection2
|
|
404
|
+
} from "typedoc";
|
|
205
405
|
function toolbar(context) {
|
|
206
|
-
return (props) => /* @__PURE__ */
|
|
406
|
+
return (props) => /* @__PURE__ */ JSX5.createElement("header", {
|
|
207
407
|
class: "page-toolbar"
|
|
208
|
-
}, /* @__PURE__ */
|
|
408
|
+
}, /* @__PURE__ */ JSX5.createElement("div", {
|
|
209
409
|
class: "va-button-group"
|
|
210
|
-
}, /* @__PURE__ */
|
|
410
|
+
}, /* @__PURE__ */ JSX5.createElement("div", {
|
|
211
411
|
class: "va-button-group va-button-group--horizontal"
|
|
212
|
-
}, /* @__PURE__ */
|
|
412
|
+
}, /* @__PURE__ */ JSX5.createElement("a", {
|
|
213
413
|
href: context.options.getValue("titleLink") || context.relativeURL("index.html"),
|
|
214
414
|
class: "title va-button"
|
|
215
|
-
}, /* @__PURE__ */
|
|
415
|
+
}, /* @__PURE__ */ JSX5.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection2 || props.project instanceof ProjectReflection2) && props.project.packageVersion && /* @__PURE__ */ JSX5.createElement("span", {
|
|
216
416
|
class: "version-badge"
|
|
217
|
-
}, "v", props.project.packageVersion)), /* @__PURE__ */
|
|
417
|
+
}, "v", props.project.packageVersion)), /* @__PURE__ */ JSX5.createElement("button", {
|
|
218
418
|
id: "tsd-search-trigger",
|
|
219
419
|
class: "va-button",
|
|
220
420
|
"aria-label": i18n3.theme_search()
|
|
221
|
-
}, i18n3.theme_search()), /* @__PURE__ */
|
|
421
|
+
}, i18n3.theme_search()), /* @__PURE__ */ JSX5.createElement("a", {
|
|
222
422
|
href: "#",
|
|
223
423
|
class: "va-button",
|
|
224
424
|
id: "tsd-toolbar-menu-trigger",
|
|
225
425
|
"data-toggle": "menu",
|
|
226
426
|
"aria-label": i18n3.theme_menu()
|
|
227
|
-
}, /* @__PURE__ */
|
|
427
|
+
}, /* @__PURE__ */ JSX5.createElement("svg", {
|
|
228
428
|
xmlns: "http://www.w3.org/2000/svg",
|
|
229
429
|
fill: "none",
|
|
230
430
|
viewBox: "0 0 24 24",
|
|
@@ -232,19 +432,19 @@ function toolbar(context) {
|
|
|
232
432
|
width: "16",
|
|
233
433
|
height: "16",
|
|
234
434
|
stroke: "currentColor"
|
|
235
|
-
}, /* @__PURE__ */
|
|
435
|
+
}, /* @__PURE__ */ JSX5.createElement("path", {
|
|
236
436
|
d: "M3.75 9h16.5m-16.5 6.75h16.5"
|
|
237
|
-
})))), /* @__PURE__ */
|
|
437
|
+
})))), /* @__PURE__ */ JSX5.createElement("div", {
|
|
238
438
|
class: "navigation-links va-button-group"
|
|
239
|
-
}, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */
|
|
439
|
+
}, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */ JSX5.createElement("a", {
|
|
240
440
|
href: url,
|
|
241
441
|
class: "va-button"
|
|
242
|
-
}, /* @__PURE__ */
|
|
442
|
+
}, /* @__PURE__ */ JSX5.createElement("span", null, label), /* @__PURE__ */ JSX5.createElement("i", {
|
|
243
443
|
class: "va-icon va-icon--external"
|
|
244
|
-
}))))), /* @__PURE__ */
|
|
444
|
+
}))))), /* @__PURE__ */ JSX5.createElement("dialog", {
|
|
245
445
|
id: "tsd-search",
|
|
246
446
|
"aria-label": i18n3.theme_search()
|
|
247
|
-
}, /* @__PURE__ */
|
|
447
|
+
}, /* @__PURE__ */ JSX5.createElement("input", {
|
|
248
448
|
role: "combobox",
|
|
249
449
|
class: "va-input",
|
|
250
450
|
id: "tsd-search-input",
|
|
@@ -256,174 +456,18 @@ function toolbar(context) {
|
|
|
256
456
|
autocomplete: "off",
|
|
257
457
|
placeholder: i18n3.theme_search_placeholder(),
|
|
258
458
|
maxLength: 100
|
|
259
|
-
}), /* @__PURE__ */
|
|
459
|
+
}), /* @__PURE__ */ JSX5.createElement("ul", {
|
|
260
460
|
role: "listbox",
|
|
261
461
|
id: "tsd-search-results"
|
|
262
|
-
}), /* @__PURE__ */
|
|
462
|
+
}), /* @__PURE__ */ JSX5.createElement("div", {
|
|
263
463
|
id: "tsd-search-status",
|
|
264
464
|
"aria-live": "polite",
|
|
265
465
|
"aria-atomic": "true"
|
|
266
|
-
}, /* @__PURE__ */
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// src/partials/layout.tsx
|
|
270
|
-
import { extname } from "path";
|
|
271
|
-
import { JSX as JSX4 } from "typedoc";
|
|
272
|
-
|
|
273
|
-
// src/utils.ts
|
|
274
|
-
import {
|
|
275
|
-
DeclarationReflection as DeclarationReflection2,
|
|
276
|
-
ProjectReflection as ProjectReflection2,
|
|
277
|
-
ReflectionKind
|
|
278
|
-
} from "typedoc";
|
|
279
|
-
function getDisplayName(refl) {
|
|
280
|
-
let version = "";
|
|
281
|
-
if ((refl instanceof DeclarationReflection2 || refl instanceof ProjectReflection2) && refl.packageVersion) {
|
|
282
|
-
version = ` - v${refl.packageVersion}`;
|
|
283
|
-
}
|
|
284
|
-
return `${refl.name}${version}`;
|
|
285
|
-
}
|
|
286
|
-
var rootsCache = new WeakMap;
|
|
287
|
-
function getHierarchyRoots(project) {
|
|
288
|
-
const cached = rootsCache.get(project);
|
|
289
|
-
if (cached)
|
|
290
|
-
return cached;
|
|
291
|
-
const allClasses = project.getReflectionsByKind(ReflectionKind.ClassOrInterface);
|
|
292
|
-
const roots = allClasses.filter((refl) => {
|
|
293
|
-
if (!refl.implementedBy && !refl.extendedBy) {
|
|
294
|
-
return false;
|
|
295
|
-
}
|
|
296
|
-
if (!refl.implementedTypes && !refl.extendedTypes) {
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
const types = [
|
|
300
|
-
...refl.implementedTypes || [],
|
|
301
|
-
...refl.extendedTypes || []
|
|
302
|
-
];
|
|
303
|
-
return types.every((type) => !type.visit({
|
|
304
|
-
reference(ref) {
|
|
305
|
-
return ref.reflection !== undefined;
|
|
306
|
-
}
|
|
307
|
-
}));
|
|
308
|
-
});
|
|
309
|
-
const result = roots.sort((a, b) => a.name.localeCompare(b.name));
|
|
310
|
-
rootsCache.set(project, result);
|
|
311
|
-
return result;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// src/partials/layout.tsx
|
|
315
|
-
function layout(context) {
|
|
316
|
-
return (template, props) => /* @__PURE__ */ JSX4.createElement("html", {
|
|
317
|
-
class: "default",
|
|
318
|
-
lang: context.options.getValue("lang"),
|
|
319
|
-
"data-base": context.relativeURL("./")
|
|
320
|
-
}, /* @__PURE__ */ JSX4.createElement("head", null, /* @__PURE__ */ JSX4.createElement("meta", {
|
|
321
|
-
charset: "utf-8"
|
|
322
|
-
}), context.hook("head.begin", context), /* @__PURE__ */ JSX4.createElement("meta", {
|
|
323
|
-
"http-equiv": "x-ua-compatible",
|
|
324
|
-
content: "IE=edge"
|
|
325
|
-
}), /* @__PURE__ */ JSX4.createElement("title", null, props.model.isProject() ? getDisplayName(props.model) : `${getDisplayName(props.model)} | ${getDisplayName(props.project)}`), favicon(context), props.url === "index.html" && buildSiteMetadata(context), /* @__PURE__ */ JSX4.createElement("meta", {
|
|
326
|
-
name: "description",
|
|
327
|
-
content: "Documentation for " + props.project.name
|
|
328
|
-
}), /* @__PURE__ */ JSX4.createElement("meta", {
|
|
329
|
-
name: "viewport",
|
|
330
|
-
content: "width=device-width, initial-scale=1"
|
|
331
|
-
}), /* @__PURE__ */ JSX4.createElement("link", {
|
|
332
|
-
rel: "stylesheet",
|
|
333
|
-
href: context.relativeURL("assets/style.css", true)
|
|
334
|
-
}), /* @__PURE__ */ JSX4.createElement("link", {
|
|
335
|
-
rel: "stylesheet",
|
|
336
|
-
href: context.relativeURL("assets/highlight.css", true)
|
|
337
|
-
}), /* @__PURE__ */ JSX4.createElement("script", {
|
|
338
|
-
defer: true,
|
|
339
|
-
src: context.relativeURL("assets/main.js", true)
|
|
340
|
-
}), /* @__PURE__ */ JSX4.createElement("script", {
|
|
341
|
-
async: true,
|
|
342
|
-
src: context.relativeURL("assets/icons.js", true),
|
|
343
|
-
id: "tsd-icons-script"
|
|
344
|
-
}), /* @__PURE__ */ JSX4.createElement("script", {
|
|
345
|
-
async: true,
|
|
346
|
-
src: context.relativeURL("assets/search.js", true),
|
|
347
|
-
id: "tsd-search-script"
|
|
348
|
-
}), /* @__PURE__ */ JSX4.createElement("script", {
|
|
349
|
-
async: true,
|
|
350
|
-
src: context.relativeURL("assets/navigation.js", true),
|
|
351
|
-
id: "tsd-nav-script"
|
|
352
|
-
}), !!getHierarchyRoots(props.project).length && /* @__PURE__ */ JSX4.createElement("script", {
|
|
353
|
-
async: true,
|
|
354
|
-
src: context.relativeURL("assets/hierarchy.js", true),
|
|
355
|
-
id: "tsd-hierarchy-script"
|
|
356
|
-
}), context.hook("head.end", context), context.options.getValue("customCss") && /* @__PURE__ */ JSX4.createElement("link", {
|
|
357
|
-
rel: "stylesheet",
|
|
358
|
-
href: context.relativeURL("assets/custom.css", true)
|
|
359
|
-
}), context.options.getValue("customJs") && /* @__PURE__ */ JSX4.createElement("script", {
|
|
360
|
-
defer: true,
|
|
361
|
-
src: context.relativeURL("assets/custom.js", true)
|
|
362
|
-
})), /* @__PURE__ */ JSX4.createElement("body", null, context.hook("body.begin", context), /* @__PURE__ */ JSX4.createElement("script", null, /* @__PURE__ */ JSX4.createElement(JSX4.Raw, {
|
|
363
|
-
html: 'document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";'
|
|
364
|
-
})), /* @__PURE__ */ JSX4.createElement("div", {
|
|
365
|
-
class: "container container-main"
|
|
366
|
-
}, context.toolbar(props), /* @__PURE__ */ JSX4.createElement("div", {
|
|
367
|
-
class: "col-content"
|
|
368
|
-
}, context.hook("content.begin", context), context.header(props), template(props), context.hook("content.end", context)), /* @__PURE__ */ JSX4.createElement("div", {
|
|
369
|
-
class: "col-sidebar"
|
|
370
|
-
}, /* @__PURE__ */ JSX4.createElement("div", {
|
|
371
|
-
class: "page-menu"
|
|
372
|
-
}, context.hook("pageSidebar.begin", context), context.pageSidebar(props), context.hook("pageSidebar.end", context)), /* @__PURE__ */ JSX4.createElement("div", {
|
|
373
|
-
class: "site-menu"
|
|
374
|
-
}, context.hook("sidebar.begin", context), context.sidebar(props), context.hook("sidebar.end", context)))), context.footer(), /* @__PURE__ */ JSX4.createElement("div", {
|
|
375
|
-
class: "overlay"
|
|
376
|
-
}), context.hook("body.end", context)));
|
|
377
|
-
}
|
|
378
|
-
function favicon(context) {
|
|
379
|
-
const fav = context.options.getValue("favicon");
|
|
380
|
-
if (!fav)
|
|
381
|
-
return null;
|
|
382
|
-
switch (extname(fav)) {
|
|
383
|
-
case ".ico":
|
|
384
|
-
return /* @__PURE__ */ JSX4.createElement("link", {
|
|
385
|
-
rel: "icon",
|
|
386
|
-
href: context.relativeURL("assets/favicon.ico", true)
|
|
387
|
-
});
|
|
388
|
-
case ".png":
|
|
389
|
-
return /* @__PURE__ */ JSX4.createElement("link", {
|
|
390
|
-
rel: "icon",
|
|
391
|
-
href: context.relativeURL("assets/favicon.png", true),
|
|
392
|
-
type: "image/png"
|
|
393
|
-
});
|
|
394
|
-
case ".svg":
|
|
395
|
-
return /* @__PURE__ */ JSX4.createElement("link", {
|
|
396
|
-
rel: "icon",
|
|
397
|
-
href: context.relativeURL("assets/favicon.svg", true),
|
|
398
|
-
type: "image/svg+xml"
|
|
399
|
-
});
|
|
400
|
-
default:
|
|
401
|
-
return null;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
function buildSiteMetadata(context) {
|
|
405
|
-
try {
|
|
406
|
-
const url = new URL(context.options.getValue("hostedBaseUrl"));
|
|
407
|
-
if (url.pathname !== "/") {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
return /* @__PURE__ */ JSX4.createElement("script", {
|
|
411
|
-
type: "application/ld+json"
|
|
412
|
-
}, /* @__PURE__ */ JSX4.createElement(JSX4.Raw, {
|
|
413
|
-
html: JSON.stringify({
|
|
414
|
-
"@context": "https://schema.org",
|
|
415
|
-
"@type": "WebSite",
|
|
416
|
-
name: context.page.project.name,
|
|
417
|
-
url: url.toString()
|
|
418
|
-
})
|
|
419
|
-
}));
|
|
420
|
-
} catch {
|
|
421
|
-
return null;
|
|
422
|
-
}
|
|
466
|
+
}, /* @__PURE__ */ JSX5.createElement("div", null, i18n3.theme_preparing_search_index()))));
|
|
423
467
|
}
|
|
424
468
|
|
|
425
469
|
// src/themes/VarvaraThemeContext.ts
|
|
426
|
-
class VarvaraThemeContext extends
|
|
470
|
+
class VarvaraThemeContext extends DefaultThemeRenderContext {
|
|
427
471
|
constructor(router, theme, page, options) {
|
|
428
472
|
super(router, theme, page, options);
|
|
429
473
|
this.pageSidebar = pageSidebar(this);
|
|
@@ -431,13 +475,14 @@ class VarvaraThemeContext extends DefaultThemeRenderContext3 {
|
|
|
431
475
|
this.defaultLayout = layout(this);
|
|
432
476
|
this.settings = settings(this);
|
|
433
477
|
this.pageNavigation = pageNavigation(this);
|
|
478
|
+
this.sidebarLinks = () => sidebarLinks(this);
|
|
434
479
|
}
|
|
435
480
|
footer = () => footer(this);
|
|
436
481
|
navigation = (context) => navigation(this)(context);
|
|
437
482
|
}
|
|
438
483
|
|
|
439
484
|
// src/themes/VarvaraTheme.tsx
|
|
440
|
-
class VarvaraTheme extends
|
|
485
|
+
class VarvaraTheme extends DefaultTheme {
|
|
441
486
|
constructor(renderer) {
|
|
442
487
|
super(renderer);
|
|
443
488
|
renderer.on(RendererEvent.END, () => {
|
|
@@ -447,10 +492,10 @@ class VarvaraTheme extends DefaultTheme2 {
|
|
|
447
492
|
fs.copyFileSync(varvaraCssPath, destPath);
|
|
448
493
|
fs.cpSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../assets/"), path.resolve(this.application.options.getValue("out"), "assets/"), { recursive: true });
|
|
449
494
|
});
|
|
450
|
-
renderer.hooks.on("head.end", (event) => /* @__PURE__ */
|
|
495
|
+
renderer.hooks.on("head.end", (event) => /* @__PURE__ */ JSX6.createElement(JSX6.Fragment, null, /* @__PURE__ */ JSX6.createElement("link", {
|
|
451
496
|
rel: "stylesheet",
|
|
452
497
|
href: event.relativeURL("assets/varvara.css")
|
|
453
|
-
}), /* @__PURE__ */
|
|
498
|
+
}), /* @__PURE__ */ JSX6.createElement("link", {
|
|
454
499
|
rel: "stylesheet",
|
|
455
500
|
href: event.relativeURL("assets/overrides.css")
|
|
456
501
|
})));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "varvara-typedoc-theme",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"author": "Marc Mariné <shenobi@gmail.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"typedoc": "^0.28.0",
|
|
25
|
-
"typescript": "^5
|
|
25
|
+
"typescript": "^5 || ^6"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "bun build.ts",
|
|
29
|
-
"build:docs": "bun run build && bunx typedoc"
|
|
29
|
+
"build:docs": "bun run build && bunx typedoc",
|
|
30
|
+
"lint": "biome lint ."
|
|
30
31
|
},
|
|
31
32
|
"exports": {
|
|
32
33
|
".": "./dist/index.js"
|