varvara-typedoc-theme 0.3.5 → 0.3.7

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Varvara 🤦‍♀️ TypeDoc Theme
2
2
 
3
- _View a_ [_live example here_](https://marcmarine.github.io/western-signs).
3
+ _View a_ [_live example here_](https://docs.label.energy).
4
4
 
5
5
  Varvara TypeDoc Theme is a custom theme for TypeDoc, designed to provide a seamless documentation experience for TypeScript projects.
6
6
 
@@ -42,7 +42,7 @@ npx typedoc --plugin varvara-typedoc-theme --theme varvara-css src/index.ts
42
42
 
43
43
  ### Method 2: Configuration File
44
44
 
45
- Create a `typedoc.js` configuration file in your project's root directory:
45
+ Create a `typedoc.mjs` configuration file in your project's root directory:
46
46
 
47
47
  > [!NOTE]
48
48
  > You can use various TypeDoc [configuration files](https://typedoc.org/documents/Options.Configuration.html) to customize your documentation generation.
@@ -57,7 +57,12 @@ const config = {
57
57
  theme: 'varvara-css',
58
58
 
59
59
  // Optional: Include version information
60
- includeVersion: true
60
+ includeVersion: true,
61
+
62
+ // Optional: Include groups
63
+ navigation: {
64
+ includeGroups: true
65
+ }
61
66
 
62
67
  // Additional TypeDoc configuration options
63
68
  // ... other options as needed
@@ -16,11 +16,26 @@
16
16
  box-sizing: border-box;
17
17
  }
18
18
 
19
+ .va-collapse {
20
+ overflow: hidden;
21
+ }
22
+
19
23
  .va-button {
20
24
  display: flex;
21
25
  align-items: center;
22
26
  }
23
27
 
28
+ .va-button span {
29
+ color: inherit;
30
+ }
31
+
32
+ .va-button span,
33
+ .va-collapse summary {
34
+ white-space: nowrap;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ }
38
+
24
39
  .title {
25
40
  flex: 1;
26
41
  }
package/dist/index.js CHANGED
@@ -58,49 +58,6 @@ function footer(context) {
58
58
 
59
59
  // src/partials/navigation.tsx
60
60
  import { JSX as JSX2, ReflectionFlag, i18n as i18n2, translateTagName, ReflectionFlags } from "typedoc";
61
-
62
- // src/utils.ts
63
- import {
64
- DeclarationReflection,
65
- ProjectReflection,
66
- ReflectionKind
67
- } from "typedoc";
68
- function getDisplayName(refl) {
69
- let version = "";
70
- if ((refl instanceof DeclarationReflection || refl instanceof ProjectReflection) && refl.packageVersion) {
71
- version = ` - v${refl.packageVersion}`;
72
- }
73
- return `${refl.name}${version}`;
74
- }
75
- var rootsCache = new WeakMap;
76
- function getHierarchyRoots(project) {
77
- const cached = rootsCache.get(project);
78
- if (cached)
79
- return cached;
80
- const allClasses = project.getReflectionsByKind(ReflectionKind.ClassOrInterface);
81
- const roots = allClasses.filter((refl) => {
82
- if (!refl.implementedBy && !refl.extendedBy) {
83
- return false;
84
- }
85
- if (!refl.implementedTypes && !refl.extendedTypes) {
86
- return true;
87
- }
88
- const types = [
89
- ...refl.implementedTypes || [],
90
- ...refl.extendedTypes || []
91
- ];
92
- return types.every((type) => !type.visit({
93
- reference(ref) {
94
- return ref.reflection !== undefined;
95
- }
96
- }));
97
- });
98
- const result = roots.sort((a, b) => a.name.localeCompare(b.name));
99
- rootsCache.set(project, result);
100
- return result;
101
- }
102
-
103
- // src/partials/navigation.tsx
104
61
  function pageSidebar(context) {
105
62
  return (props) => {
106
63
  return /* @__PURE__ */ JSX2.createElement("div", {
@@ -145,7 +102,7 @@ function settings(context) {
145
102
  }
146
103
  function buildSectionNavigation(context, headings) {
147
104
  const levels = [[]];
148
- const PADDING_PER_LEVEL = 18;
105
+ const PADDING_PER_LEVEL = 12;
149
106
  function finalizeLevel(finishedHandlingHeadings) {
150
107
  const level = levels.pop();
151
108
  if (levels[levels.length - 1].length === 0 && finishedHandlingHeadings) {
@@ -163,10 +120,12 @@ function buildSectionNavigation(context, headings) {
163
120
  while (inferredLevel > levels.length) {
164
121
  levels.push([]);
165
122
  }
123
+ const icon = heading.kind && context.icons[heading.kind]();
166
124
  levels[levels.length - 1].push(/* @__PURE__ */ JSX2.createElement("a", {
167
125
  href: heading.link,
168
- class: [heading.classes, "va-button"].join(" ")
169
- }, heading.kind && context.icons[heading.kind](), heading.text));
126
+ class: [heading.classes, "va-button"].join(" "),
127
+ style: !icon ? `padding-left: ${PADDING_PER_LEVEL * (inferredLevel - 1)}px` : ""
128
+ }, icon, /* @__PURE__ */ JSX2.createElement("span", null, heading.text)));
170
129
  }
171
130
  while (levels.length > 1) {
172
131
  finalizeLevel(true);
@@ -214,20 +173,17 @@ var navigation = (context) => (props) => {
214
173
  const navigationData = context.getNavigation();
215
174
  return /* @__PURE__ */ JSX2.createElement("nav", {
216
175
  class: "va-button-group"
217
- }, /* @__PURE__ */ JSX2.createElement("details", {
218
- class: "va-collapse tsd-accordion"
219
- }, /* @__PURE__ */ JSX2.createElement("summary", null, /* @__PURE__ */ JSX2.createElement("a", {
220
- href: context.urlTo(props.project)
221
- }, getDisplayName(props.project))), /* @__PURE__ */ JSX2.createElement(Navigation, {
176
+ }, /* @__PURE__ */ JSX2.createElement(Navigation, {
222
177
  data: navigationData,
223
178
  context
224
- })));
179
+ }));
225
180
  };
226
181
  var Navigation = ({ data, context }) => /* @__PURE__ */ JSX2.createElement(JSX2.Fragment, null, data.map((item) => item.children && item.children.length > 0 ? /* @__PURE__ */ JSX2.createElement("details", {
227
182
  class: "va-collapse tsd-accordion"
228
183
  }, /* @__PURE__ */ JSX2.createElement("summary", {
229
- class: "tsd-accordion-summary"
230
- }, item.text), /* @__PURE__ */ JSX2.createElement(Navigation, {
184
+ class: "tsd-accordion-summary",
185
+ "data-key": `section-${item.text}`
186
+ }, item.kind && context.icons[item.kind](), item.text), /* @__PURE__ */ JSX2.createElement(Navigation, {
231
187
  data: item.children,
232
188
  context
233
189
  })) : /* @__PURE__ */ JSX2.createElement(Item, {
@@ -239,13 +195,13 @@ var Item = ({ item, context }) => {
239
195
  return item.path ? /* @__PURE__ */ JSX2.createElement("a", {
240
196
  href: context.relativeURL(item.path),
241
197
  class: "va-button"
242
- }, icon, item.text) : /* @__PURE__ */ JSX2.createElement("span", {
198
+ }, icon, /* @__PURE__ */ JSX2.createElement("span", null, item.text)) : /* @__PURE__ */ JSX2.createElement("span", {
243
199
  class: "va-button"
244
- }, icon, item.text);
200
+ }, icon, /* @__PURE__ */ JSX2.createElement("span", null, item.text));
245
201
  };
246
202
 
247
203
  // src/partials/toolbar.tsx
248
- import { i18n as i18n3, DeclarationReflection as DeclarationReflection2, JSX as JSX3, ProjectReflection as ProjectReflection2 } from "typedoc";
204
+ import { i18n as i18n3, DeclarationReflection, JSX as JSX3, ProjectReflection } from "typedoc";
249
205
  function toolbar(context) {
250
206
  return (props) => /* @__PURE__ */ JSX3.createElement("header", {
251
207
  class: "page-toolbar"
@@ -256,7 +212,7 @@ function toolbar(context) {
256
212
  }, /* @__PURE__ */ JSX3.createElement("a", {
257
213
  href: context.options.getValue("titleLink") || context.relativeURL("index.html"),
258
214
  class: "title va-button"
259
- }, /* @__PURE__ */ JSX3.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection2 || props.project instanceof ProjectReflection2) && props.project.packageVersion && /* @__PURE__ */ JSX3.createElement("span", {
215
+ }, /* @__PURE__ */ JSX3.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection || props.project instanceof ProjectReflection) && props.project.packageVersion && /* @__PURE__ */ JSX3.createElement("span", {
260
216
  class: "version-badge"
261
217
  }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX3.createElement("button", {
262
218
  id: "tsd-search-trigger",
@@ -293,18 +249,9 @@ function toolbar(context) {
293
249
  }, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */ JSX3.createElement("a", {
294
250
  href: url,
295
251
  class: "va-button"
296
- }, /* @__PURE__ */ JSX3.createElement("span", null, label), /* @__PURE__ */ JSX3.createElement("svg", {
297
- viewBox: "0 0 16 16",
298
- xmlns: "http://www.w3.org/2000/svg",
299
- width: "16",
300
- height: "16",
301
- fill: "none"
302
- }, /* @__PURE__ */ JSX3.createElement("path", {
303
- "fill-rule": "evenodd",
304
- "clip-rule": "evenodd",
305
- d: "M1.52346 0.380859H15.6187V14.4761H13.333V4.28282L2.33158 15.2842L0.715332 13.668L11.7167 2.66657H1.52346V0.380859Z",
306
- fill: "currentColor"
307
- })))))), /* @__PURE__ */ JSX3.createElement("dialog", {
252
+ }, /* @__PURE__ */ JSX3.createElement("span", null, label), /* @__PURE__ */ JSX3.createElement("i", {
253
+ class: "va-icon va-icon--external"
254
+ }))))), /* @__PURE__ */ JSX3.createElement("dialog", {
308
255
  id: "tsd-search",
309
256
  "aria-label": i18n3.theme_search()
310
257
  }, /* @__PURE__ */ JSX3.createElement("input", {
@@ -332,6 +279,49 @@ function toolbar(context) {
332
279
  // src/partials/layout.tsx
333
280
  import { extname } from "path";
334
281
  import { JSX as JSX4 } from "typedoc";
282
+
283
+ // src/utils.ts
284
+ import {
285
+ DeclarationReflection as DeclarationReflection2,
286
+ ProjectReflection as ProjectReflection2,
287
+ ReflectionKind
288
+ } from "typedoc";
289
+ function getDisplayName(refl) {
290
+ let version = "";
291
+ if ((refl instanceof DeclarationReflection2 || refl instanceof ProjectReflection2) && refl.packageVersion) {
292
+ version = ` - v${refl.packageVersion}`;
293
+ }
294
+ return `${refl.name}${version}`;
295
+ }
296
+ var rootsCache = new WeakMap;
297
+ function getHierarchyRoots(project) {
298
+ const cached = rootsCache.get(project);
299
+ if (cached)
300
+ return cached;
301
+ const allClasses = project.getReflectionsByKind(ReflectionKind.ClassOrInterface);
302
+ const roots = allClasses.filter((refl) => {
303
+ if (!refl.implementedBy && !refl.extendedBy) {
304
+ return false;
305
+ }
306
+ if (!refl.implementedTypes && !refl.extendedTypes) {
307
+ return true;
308
+ }
309
+ const types = [
310
+ ...refl.implementedTypes || [],
311
+ ...refl.extendedTypes || []
312
+ ];
313
+ return types.every((type) => !type.visit({
314
+ reference(ref) {
315
+ return ref.reflection !== undefined;
316
+ }
317
+ }));
318
+ });
319
+ const result = roots.sort((a, b) => a.name.localeCompare(b.name));
320
+ rootsCache.set(project, result);
321
+ return result;
322
+ }
323
+
324
+ // src/partials/layout.tsx
335
325
  function layout(context) {
336
326
  return (template, props) => /* @__PURE__ */ JSX4.createElement("html", {
337
327
  class: "default",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varvara-typedoc-theme",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "author": "Marc Mariné <shenobi@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "varvara-css": "^0.7.4"
18
+ "varvara-css": "^0.8.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/bun": "latest"