varvara-typedoc-theme 0.3.9 → 0.3.10

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.
@@ -4,11 +4,11 @@
4
4
  --va-space-ratio: 0.78;
5
5
  }
6
6
 
7
- [data-theme='light'] {
7
+ [data-theme="light"] {
8
8
  color-scheme: light;
9
9
  }
10
10
 
11
- [data-theme='dark'] {
11
+ [data-theme="dark"] {
12
12
  color-scheme: dark;
13
13
  }
14
14
 
@@ -132,7 +132,7 @@ footer {
132
132
 
133
133
  @media (min-width: 770px) {
134
134
  .container-main {
135
- grid-template-areas: 'header content' 'sidebar content';
135
+ grid-template-areas: "header content" "sidebar content";
136
136
  grid-auto-rows: auto 1fr;
137
137
  margin: var(--va-space-6) auto;
138
138
  }
@@ -150,8 +150,8 @@ footer {
150
150
  .container-main {
151
151
  grid-template-columns: minmax(0, 20rem) minmax(0, 2.5fr) minmax(0, 20rem);
152
152
  grid-template-areas:
153
- 'header content toc'
154
- 'sidebar content toc';
153
+ "header content toc"
154
+ "sidebar content toc";
155
155
  }
156
156
  .page-menu,
157
157
  .site-menu {
package/dist/index.js CHANGED
@@ -2,65 +2,229 @@ import { createRequire } from "node:module";
2
2
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
3
 
4
4
  // src/themes/VarvaraTheme.tsx
5
- import { DefaultTheme as DefaultTheme2, JSX as JSX5, RendererEvent } from "typedoc";
6
- import * as path from "path";
7
- import * as fs from "fs";
8
- import { fileURLToPath } from "url";
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 JSX5,
11
+ RendererEvent
12
+ } from "typedoc";
9
13
 
10
14
  // src/themes/VarvaraThemeContext.ts
11
- import { DefaultThemeRenderContext as DefaultThemeRenderContext3 } from "typedoc";
15
+ import {
16
+ DefaultThemeRenderContext
17
+ } from "typedoc";
12
18
 
13
19
  // src/partials/footer.tsx
14
- import { i18n, JSX } from "typedoc";
20
+ import { i18n, JSX as JSX2 } from "typedoc";
15
21
  function footer(context) {
16
22
  const hideGenerator = context.options.getValue("hideGenerator");
17
- let generatorDisplay = /* @__PURE__ */ JSX.createElement(JSX.Fragment, null);
23
+ let generatorDisplay = /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null);
18
24
  if (!hideGenerator) {
19
25
  const message = i18n.theme_generated_using_typedoc();
20
26
  const index = message.indexOf("TypeDoc");
21
- if (index == -1) {
22
- generatorDisplay = /* @__PURE__ */ JSX.createElement("p", {
27
+ if (index === -1) {
28
+ generatorDisplay = /* @__PURE__ */ JSX2.createElement("p", {
23
29
  class: "tsd-generator"
24
30
  }, message);
25
31
  } else {
26
32
  const pre = message.substring(0, index);
27
33
  const post = message.substring(index + "TypeDoc".length);
28
- generatorDisplay = /* @__PURE__ */ JSX.createElement("p", {
34
+ generatorDisplay = /* @__PURE__ */ JSX2.createElement("p", {
29
35
  class: "tsd-generator"
30
- }, pre, /* @__PURE__ */ JSX.createElement("a", {
36
+ }, pre, /* @__PURE__ */ JSX2.createElement("a", {
31
37
  href: "https://typedoc.org/",
32
38
  class: "va-link",
33
- target: "_blank"
34
- }, "TypeDoc"), " & ", /* @__PURE__ */ JSX.createElement("a", {
39
+ target: "_blank",
40
+ rel: "noopener"
41
+ }, "TypeDoc"), " & ", /* @__PURE__ */ JSX2.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
  }
41
49
  const customFooterHtml = context.options.getValue("customFooterHtml");
42
- let customFooterDisplay = /* @__PURE__ */ JSX.createElement(JSX.Fragment, null);
50
+ let customFooterDisplay = /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null);
43
51
  if (customFooterHtml) {
44
52
  if (context.options.getValue("customFooterHtmlDisableWrapper")) {
45
- customFooterDisplay = /* @__PURE__ */ JSX.createElement(JSX.Raw, {
53
+ customFooterDisplay = /* @__PURE__ */ JSX2.createElement(JSX2.Raw, {
46
54
  html: customFooterHtml
47
55
  });
48
56
  } else {
49
- customFooterDisplay = /* @__PURE__ */ JSX.createElement("p", null, /* @__PURE__ */ JSX.createElement(JSX.Raw, {
57
+ customFooterDisplay = /* @__PURE__ */ JSX2.createElement("p", null, /* @__PURE__ */ JSX2.createElement(JSX2.Raw, {
50
58
  html: customFooterHtml
51
59
  }));
52
60
  }
53
61
  }
54
- return /* @__PURE__ */ JSX.createElement("footer", null, /* @__PURE__ */ JSX.createElement("div", {
62
+ return /* @__PURE__ */ JSX2.createElement("footer", null, /* @__PURE__ */ JSX2.createElement("div", {
55
63
  class: "container"
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 JSX3
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__ */ JSX3.createElement("html", {
110
+ class: "default",
111
+ lang: context.options.getValue("lang"),
112
+ "data-base": context.relativeURL("./")
113
+ }, /* @__PURE__ */ JSX3.createElement("head", null, /* @__PURE__ */ JSX3.createElement("meta", {
114
+ charset: "utf-8"
115
+ }), context.hook("head.begin", context), /* @__PURE__ */ JSX3.createElement("meta", {
116
+ "http-equiv": "x-ua-compatible",
117
+ content: "IE=edge"
118
+ }), /* @__PURE__ */ JSX3.createElement("title", null, props.model.isProject() ? getDisplayName(props.model) : `${getDisplayName(props.model)} | ${getDisplayName(props.project)}`), favicon(context), props.url === "index.html" && buildSiteMetadata(context), /* @__PURE__ */ JSX3.createElement("meta", {
119
+ name: "description",
120
+ content: `Documentation for ${props.project.name}`
121
+ }), /* @__PURE__ */ JSX3.createElement("meta", {
122
+ name: "viewport",
123
+ content: "width=device-width, initial-scale=1"
124
+ }), /* @__PURE__ */ JSX3.createElement("link", {
125
+ rel: "stylesheet",
126
+ href: context.relativeURL("assets/style.css", true)
127
+ }), /* @__PURE__ */ JSX3.createElement("link", {
128
+ rel: "stylesheet",
129
+ href: context.relativeURL("assets/highlight.css", true)
130
+ }), /* @__PURE__ */ JSX3.createElement("script", {
131
+ defer: true,
132
+ src: context.relativeURL("assets/main.js", true)
133
+ }), /* @__PURE__ */ JSX3.createElement("script", {
134
+ async: true,
135
+ src: context.relativeURL("assets/icons.js", true),
136
+ id: "tsd-icons-script"
137
+ }), /* @__PURE__ */ JSX3.createElement("script", {
138
+ async: true,
139
+ src: context.relativeURL("assets/search.js", true),
140
+ id: "tsd-search-script"
141
+ }), /* @__PURE__ */ JSX3.createElement("script", {
142
+ async: true,
143
+ src: context.relativeURL("assets/navigation.js", true),
144
+ id: "tsd-nav-script"
145
+ }), !!getHierarchyRoots(props.project).length && /* @__PURE__ */ JSX3.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__ */ JSX3.createElement("link", {
150
+ rel: "stylesheet",
151
+ href: context.relativeURL("assets/custom.css", true)
152
+ }), context.options.getValue("customJs") && /* @__PURE__ */ JSX3.createElement("script", {
153
+ defer: true,
154
+ src: context.relativeURL("assets/custom.js", true)
155
+ })), /* @__PURE__ */ JSX3.createElement("body", null, context.hook("body.begin", context), /* @__PURE__ */ JSX3.createElement("script", null, /* @__PURE__ */ JSX3.createElement(JSX3.Raw, {
156
+ html: 'document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";'
157
+ })), /* @__PURE__ */ JSX3.createElement("div", {
158
+ class: "container container-main"
159
+ }, context.toolbar(props), /* @__PURE__ */ JSX3.createElement("div", {
160
+ class: "col-content"
161
+ }, context.hook("content.begin", context), context.header(props), template(props), context.hook("content.end", context)), /* @__PURE__ */ JSX3.createElement("div", {
162
+ class: "col-sidebar"
163
+ }, /* @__PURE__ */ JSX3.createElement("div", {
164
+ class: "page-menu"
165
+ }, context.hook("pageSidebar.begin", context), context.pageSidebar(props), context.hook("pageSidebar.end", context)), /* @__PURE__ */ JSX3.createElement("div", {
166
+ class: "site-menu"
167
+ }, context.hook("sidebar.begin", context), context.sidebar(props), context.hook("sidebar.end", context)))), context.footer(), /* @__PURE__ */ JSX3.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__ */ JSX3.createElement("link", {
178
+ rel: "icon",
179
+ href: context.relativeURL("assets/favicon.ico", true)
180
+ });
181
+ case ".png":
182
+ return /* @__PURE__ */ JSX3.createElement("link", {
183
+ rel: "icon",
184
+ href: context.relativeURL("assets/favicon.png", true),
185
+ type: "image/png"
186
+ });
187
+ case ".svg":
188
+ return /* @__PURE__ */ JSX3.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__ */ JSX3.createElement("script", {
204
+ type: "application/ld+json"
205
+ }, /* @__PURE__ */ JSX3.createElement(JSX3.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 { JSX as JSX2, ReflectionFlag, i18n as i18n2, translateTagName, ReflectionFlags } from "typedoc";
219
+ import {
220
+ i18n as i18n2,
221
+ ReflectionFlag,
222
+ ReflectionFlags,
223
+ translateTagName
224
+ } from "typedoc";
61
225
  function pageSidebar(context) {
62
226
  return (props) => {
63
- return /* @__PURE__ */ JSX2.createElement("div", {
227
+ return /* @__PURE__ */ JSX.createElement("div", {
64
228
  class: "va-button-group"
65
229
  }, context.settings(), context.pageNavigation(props));
66
230
  };
@@ -83,19 +247,19 @@ function settings(context) {
83
247
  visibilityOptions.push(buildFilterItem(context, key, ReflectionFlags.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
84
248
  }
85
249
  }
86
- return /* @__PURE__ */ JSX2.createElement("details", {
250
+ return /* @__PURE__ */ JSX.createElement("details", {
87
251
  class: "va-collapse settings tsd-accordion",
88
252
  open: false
89
- }, /* @__PURE__ */ JSX2.createElement("summary", null, i18n2.theme_settings()), visibilityOptions.length && /* @__PURE__ */ JSX2.createElement("details", {
253
+ }, /* @__PURE__ */ JSX.createElement("summary", null, i18n2.theme_settings()), visibilityOptions.length && /* @__PURE__ */ JSX.createElement("details", {
90
254
  class: "va-collapse"
91
- }, /* @__PURE__ */ JSX2.createElement("summary", null, i18n2.theme_member_visibility()), ...visibilityOptions), /* @__PURE__ */ JSX2.createElement("label", null, /* @__PURE__ */ JSX2.createElement("span", null, i18n2.theme_theme()), /* @__PURE__ */ JSX2.createElement("select", {
255
+ }, /* @__PURE__ */ JSX.createElement("summary", null, i18n2.theme_member_visibility()), ...visibilityOptions), /* @__PURE__ */ JSX.createElement("label", null, /* @__PURE__ */ JSX.createElement("span", null, i18n2.theme_theme()), /* @__PURE__ */ JSX.createElement("select", {
92
256
  id: "tsd-theme",
93
257
  class: "va-select"
94
- }, /* @__PURE__ */ JSX2.createElement("option", {
258
+ }, /* @__PURE__ */ JSX.createElement("option", {
95
259
  value: "os"
96
- }, i18n2.theme_os()), /* @__PURE__ */ JSX2.createElement("option", {
260
+ }, i18n2.theme_os()), /* @__PURE__ */ JSX.createElement("option", {
97
261
  value: "light"
98
- }, i18n2.theme_light()), /* @__PURE__ */ JSX2.createElement("option", {
262
+ }, i18n2.theme_light()), /* @__PURE__ */ JSX.createElement("option", {
99
263
  value: "dark"
100
264
  }, i18n2.theme_dark()))));
101
265
  };
@@ -109,7 +273,7 @@ function buildSectionNavigation(context, headings) {
109
273
  levels[levels.length - 1] = level;
110
274
  return;
111
275
  }
112
- const built = /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null, level.map((l) => /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null, l)));
276
+ const built = /* @__PURE__ */ JSX.createElement(JSX.Fragment, null, level.map((l) => /* @__PURE__ */ JSX.createElement(JSX.Fragment, null, l)));
113
277
  levels[levels.length - 1].push(built);
114
278
  }
115
279
  for (const heading of headings) {
@@ -121,11 +285,11 @@ function buildSectionNavigation(context, headings) {
121
285
  levels.push([]);
122
286
  }
123
287
  const icon = heading.kind && context.icons[heading.kind]();
124
- levels[levels.length - 1].push(/* @__PURE__ */ JSX2.createElement("a", {
288
+ levels[levels.length - 1].push(/* @__PURE__ */ JSX.createElement("a", {
125
289
  href: heading.link,
126
290
  class: [heading.classes, "va-button"].join(" "),
127
291
  style: !icon ? `padding-left: ${PADDING_PER_LEVEL * (inferredLevel - 1)}px` : ""
128
- }, icon, /* @__PURE__ */ JSX2.createElement("span", null, heading.text)));
292
+ }, icon, /* @__PURE__ */ JSX.createElement("span", null, heading.text)));
129
293
  }
130
294
  while (levels.length > 1) {
131
295
  finalizeLevel(true);
@@ -135,9 +299,9 @@ function buildSectionNavigation(context, headings) {
135
299
  return levels[0];
136
300
  }
137
301
  function buildFilterItem(_context, name, displayName, defaultValue) {
138
- return /* @__PURE__ */ JSX2.createElement("label", {
302
+ return /* @__PURE__ */ JSX.createElement("label", {
139
303
  class: "tsd-filter-item"
140
- }, /* @__PURE__ */ JSX2.createElement("span", null, displayName), /* @__PURE__ */ JSX2.createElement("input", {
304
+ }, /* @__PURE__ */ JSX.createElement("span", null, displayName), /* @__PURE__ */ JSX.createElement("input", {
141
305
  class: "tsd-filter-input va-checkbox",
142
306
  type: "checkbox",
143
307
  id: `tsd-filter-${name}`,
@@ -148,83 +312,94 @@ function buildFilterItem(_context, name, displayName, defaultValue) {
148
312
  function pageNavigation(context) {
149
313
  return (props) => {
150
314
  if (!props.pageSections.some((sect) => sect.headings.length)) {
151
- return /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null);
315
+ return /* @__PURE__ */ JSX.createElement(JSX.Fragment, null);
152
316
  }
153
317
  const sections = [];
154
318
  for (const section of props.pageSections) {
155
319
  if (section.title) {
156
- sections.push(/* @__PURE__ */ JSX2.createElement("details", {
320
+ sections.push(/* @__PURE__ */ JSX.createElement("details", {
157
321
  open: true,
158
322
  class: "va-collapse tsd-accordion"
159
- }, /* @__PURE__ */ JSX2.createElement("summary", {
323
+ }, /* @__PURE__ */ JSX.createElement("summary", {
160
324
  "data-key": `section-${section.title}`
161
325
  }, section.title), buildSectionNavigation(context, section.headings)));
162
326
  } else {
163
327
  sections.push(buildSectionNavigation(context, section.headings));
164
328
  }
165
329
  }
166
- return /* @__PURE__ */ JSX2.createElement("details", {
330
+ return /* @__PURE__ */ JSX.createElement("details", {
167
331
  open: false,
168
332
  class: "va-collapse page-navigation tsd-accordion"
169
- }, /* @__PURE__ */ JSX2.createElement("summary", null, i18n2.theme_on_this_page()), sections);
333
+ }, /* @__PURE__ */ JSX.createElement("summary", null, i18n2.theme_on_this_page()), sections);
170
334
  };
171
335
  }
172
- var navigation = (context) => (props) => {
336
+ var navigation = (context) => (_props) => {
173
337
  const navigationData = context.getNavigation();
174
- return /* @__PURE__ */ JSX2.createElement("nav", {
338
+ return /* @__PURE__ */ JSX.createElement("nav", {
175
339
  class: "va-button-group"
176
- }, /* @__PURE__ */ JSX2.createElement(Navigation, {
340
+ }, /* @__PURE__ */ JSX.createElement(Navigation, {
177
341
  data: navigationData,
178
342
  context
179
343
  }));
180
344
  };
181
- var Navigation = ({ data, context }) => /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null, data.map((item) => item.children && item.children.length > 0 ? /* @__PURE__ */ JSX2.createElement("details", {
345
+ var Navigation = ({
346
+ data,
347
+ context
348
+ }) => /* @__PURE__ */ JSX.createElement(JSX.Fragment, null, data.map((item) => item.children && item.children.length > 0 ? /* @__PURE__ */ JSX.createElement("details", {
182
349
  class: "va-collapse tsd-accordion"
183
- }, /* @__PURE__ */ JSX2.createElement("summary", {
350
+ }, /* @__PURE__ */ JSX.createElement("summary", {
184
351
  class: "tsd-accordion-summary",
185
352
  "data-key": `section-${item.text}`
186
- }, item.kind && context.icons[item.kind](), item.text), /* @__PURE__ */ JSX2.createElement(Navigation, {
353
+ }, item.kind && context.icons[item.kind](), item.text), /* @__PURE__ */ JSX.createElement(Navigation, {
187
354
  data: item.children,
188
355
  context
189
- })) : /* @__PURE__ */ JSX2.createElement(Item, {
356
+ })) : /* @__PURE__ */ JSX.createElement(Item, {
190
357
  item,
191
358
  context
192
359
  })));
193
- var Item = ({ item, context }) => {
360
+ var Item = ({
361
+ item,
362
+ context
363
+ }) => {
194
364
  const icon = item.kind && context.icons[item.kind]();
195
- return item.path ? /* @__PURE__ */ JSX2.createElement("a", {
365
+ return item.path ? /* @__PURE__ */ JSX.createElement("a", {
196
366
  href: context.relativeURL(item.path),
197
367
  class: "va-button"
198
- }, icon, /* @__PURE__ */ JSX2.createElement("span", null, item.text)) : /* @__PURE__ */ JSX2.createElement("span", {
368
+ }, icon, /* @__PURE__ */ JSX.createElement("span", null, item.text)) : /* @__PURE__ */ JSX.createElement("span", {
199
369
  class: "va-button"
200
- }, icon, /* @__PURE__ */ JSX2.createElement("span", null, item.text));
370
+ }, icon, /* @__PURE__ */ JSX.createElement("span", null, item.text));
201
371
  };
202
372
 
203
373
  // src/partials/toolbar.tsx
204
- import { i18n as i18n3, DeclarationReflection, JSX as JSX3, ProjectReflection } from "typedoc";
374
+ import {
375
+ DeclarationReflection as DeclarationReflection2,
376
+ i18n as i18n3,
377
+ JSX as JSX4,
378
+ ProjectReflection as ProjectReflection2
379
+ } from "typedoc";
205
380
  function toolbar(context) {
206
- return (props) => /* @__PURE__ */ JSX3.createElement("header", {
381
+ return (props) => /* @__PURE__ */ JSX4.createElement("header", {
207
382
  class: "page-toolbar"
208
- }, /* @__PURE__ */ JSX3.createElement("div", {
383
+ }, /* @__PURE__ */ JSX4.createElement("div", {
209
384
  class: "va-button-group"
210
- }, /* @__PURE__ */ JSX3.createElement("div", {
385
+ }, /* @__PURE__ */ JSX4.createElement("div", {
211
386
  class: "va-button-group va-button-group--horizontal"
212
- }, /* @__PURE__ */ JSX3.createElement("a", {
387
+ }, /* @__PURE__ */ JSX4.createElement("a", {
213
388
  href: context.options.getValue("titleLink") || context.relativeURL("index.html"),
214
389
  class: "title va-button"
215
- }, /* @__PURE__ */ JSX3.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection || props.project instanceof ProjectReflection) && props.project.packageVersion && /* @__PURE__ */ JSX3.createElement("span", {
390
+ }, /* @__PURE__ */ JSX4.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection2 || props.project instanceof ProjectReflection2) && props.project.packageVersion && /* @__PURE__ */ JSX4.createElement("span", {
216
391
  class: "version-badge"
217
- }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX3.createElement("button", {
392
+ }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX4.createElement("button", {
218
393
  id: "tsd-search-trigger",
219
394
  class: "va-button",
220
395
  "aria-label": i18n3.theme_search()
221
- }, i18n3.theme_search()), /* @__PURE__ */ JSX3.createElement("a", {
396
+ }, i18n3.theme_search()), /* @__PURE__ */ JSX4.createElement("a", {
222
397
  href: "#",
223
398
  class: "va-button",
224
399
  id: "tsd-toolbar-menu-trigger",
225
400
  "data-toggle": "menu",
226
401
  "aria-label": i18n3.theme_menu()
227
- }, /* @__PURE__ */ JSX3.createElement("svg", {
402
+ }, /* @__PURE__ */ JSX4.createElement("svg", {
228
403
  xmlns: "http://www.w3.org/2000/svg",
229
404
  fill: "none",
230
405
  viewBox: "0 0 24 24",
@@ -232,19 +407,19 @@ function toolbar(context) {
232
407
  width: "16",
233
408
  height: "16",
234
409
  stroke: "currentColor"
235
- }, /* @__PURE__ */ JSX3.createElement("path", {
410
+ }, /* @__PURE__ */ JSX4.createElement("path", {
236
411
  d: "M3.75 9h16.5m-16.5 6.75h16.5"
237
- })))), /* @__PURE__ */ JSX3.createElement("div", {
412
+ })))), /* @__PURE__ */ JSX4.createElement("div", {
238
413
  class: "navigation-links va-button-group"
239
- }, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */ JSX3.createElement("a", {
414
+ }, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */ JSX4.createElement("a", {
240
415
  href: url,
241
416
  class: "va-button"
242
- }, /* @__PURE__ */ JSX3.createElement("span", null, label), /* @__PURE__ */ JSX3.createElement("i", {
417
+ }, /* @__PURE__ */ JSX4.createElement("span", null, label), /* @__PURE__ */ JSX4.createElement("i", {
243
418
  class: "va-icon va-icon--external"
244
- }))))), /* @__PURE__ */ JSX3.createElement("dialog", {
419
+ }))))), /* @__PURE__ */ JSX4.createElement("dialog", {
245
420
  id: "tsd-search",
246
421
  "aria-label": i18n3.theme_search()
247
- }, /* @__PURE__ */ JSX3.createElement("input", {
422
+ }, /* @__PURE__ */ JSX4.createElement("input", {
248
423
  role: "combobox",
249
424
  class: "va-input",
250
425
  id: "tsd-search-input",
@@ -256,174 +431,18 @@ function toolbar(context) {
256
431
  autocomplete: "off",
257
432
  placeholder: i18n3.theme_search_placeholder(),
258
433
  maxLength: 100
259
- }), /* @__PURE__ */ JSX3.createElement("ul", {
434
+ }), /* @__PURE__ */ JSX4.createElement("ul", {
260
435
  role: "listbox",
261
436
  id: "tsd-search-results"
262
- }), /* @__PURE__ */ JSX3.createElement("div", {
437
+ }), /* @__PURE__ */ JSX4.createElement("div", {
263
438
  id: "tsd-search-status",
264
439
  "aria-live": "polite",
265
440
  "aria-atomic": "true"
266
- }, /* @__PURE__ */ JSX3.createElement("div", null, i18n3.theme_preparing_search_index()))));
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
- }
441
+ }, /* @__PURE__ */ JSX4.createElement("div", null, i18n3.theme_preparing_search_index()))));
423
442
  }
424
443
 
425
444
  // src/themes/VarvaraThemeContext.ts
426
- class VarvaraThemeContext extends DefaultThemeRenderContext3 {
445
+ class VarvaraThemeContext extends DefaultThemeRenderContext {
427
446
  constructor(router, theme, page, options) {
428
447
  super(router, theme, page, options);
429
448
  this.pageSidebar = pageSidebar(this);
@@ -437,7 +456,7 @@ class VarvaraThemeContext extends DefaultThemeRenderContext3 {
437
456
  }
438
457
 
439
458
  // src/themes/VarvaraTheme.tsx
440
- class VarvaraTheme extends DefaultTheme2 {
459
+ class VarvaraTheme extends DefaultTheme {
441
460
  constructor(renderer) {
442
461
  super(renderer);
443
462
  renderer.on(RendererEvent.END, () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varvara-typedoc-theme",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
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.0.0"
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"