varvara-typedoc-theme 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,26 @@
1
- @media (prefers-color-scheme: light) {
2
- :root {
3
- --va-color-foreground: #29353d;
4
- --va-color-background: #f3f5f7;
5
- --va-border-color: LightGray;
6
- --va-color-primary: RoyalBlue;
7
- }
1
+ [data-theme='light'] {
2
+ color-scheme: light;
8
3
  }
9
4
 
10
- @media (prefers-color-scheme: dark) {
11
- :root {
12
- --va-color-foreground: #b3ccd6;
13
- --va-color-background: #2a303c;
14
- --va-border-color: LightSlateGray;
15
- --va-color-primary: LightSkyBlue;
16
- }
5
+ [data-theme='dark'] {
6
+ color-scheme: dark;
17
7
  }
18
8
 
19
- [data-theme='light'] {
20
- --va-color-foreground: #29353d;
21
- --va-color-background: #f3f5f7;
22
- --va-border-color: LightGray;
23
- --va-color-primary: RoyalBlue;
9
+ * {
10
+ box-sizing: border-box;
24
11
  }
25
12
 
26
- [data-theme='dark'] {
27
- --va-color-foreground: #b3ccd6;
28
- --va-color-background: #2a303c;
29
- --va-border-color: LightSlateGray;
30
- --va-color-primary: LightSkyBlue;
13
+ .va-collapse {
14
+ overflow: hidden;
15
+ }
16
+
17
+ .va-button {
18
+ display: flex;
19
+ align-items: center;
20
+ }
21
+
22
+ .title {
23
+ flex: 1;
31
24
  }
32
25
 
33
26
  body {
@@ -61,64 +54,20 @@ a {
61
54
  gap: 1rem;
62
55
  }
63
56
 
64
- .search {
65
- position: relative;
66
- display: flex;
67
- margin-bottom: 1rem;
68
- }
69
-
70
- #tsd-search.has-focus {
71
- background-color: transparent;
72
- }
73
-
74
- .search input,
75
- .search a:not([href='#']) {
76
- flex: 1;
77
- }
78
-
79
- .search a[href='#'] {
80
- display: none;
81
- }
82
-
83
- #tsd-search .field {
84
- position: static;
85
- width: 100%;
86
- }
87
-
88
- #tsd-search .field label {
89
- position: static;
90
- }
91
-
92
- #tsd-search .field input {
93
- top: auto;
94
- font-size: 1rem;
95
- opacity: 1; // Temporally
96
- }
97
-
98
- #tsd-search.has-focus .field input {
99
- display: flex;
57
+ #tsd-search-input {
58
+ border-radius: 0;
59
+ border-width: var(--va-input-border-width);
60
+ border-color: var(--va-input-border-color);
100
61
  }
101
62
 
102
- #tsd-search .results {
103
- top: 100%;
104
- z-index: 1;
63
+ dialog {
64
+ background-color: var(--va-color-background);
105
65
  }
106
66
 
107
- .navigation-links a {
108
- display: flex;
109
- }
110
67
  .navigation-links a span {
111
68
  flex: 1;
112
69
  }
113
70
 
114
- .navigation-links a svg {
115
- color: var(--va-color-foreground);
116
- }
117
-
118
- .navigation-links a:active svg {
119
- color: currentColor;
120
- }
121
-
122
71
  .settings .settings-label {
123
72
  margin-top: 1em;
124
73
  text-transform: none;
@@ -145,15 +94,6 @@ a {
145
94
  margin-top: 0;
146
95
  }
147
96
 
148
- .va-collapse {
149
- overflow: hidden;
150
- }
151
-
152
- .va-button {
153
- display: flex;
154
- align-items: center;
155
- }
156
-
157
97
  .tsd-signature,
158
98
  pre {
159
99
  border: var(--va-border-width) solid var(--va-border-color);
@@ -176,9 +116,6 @@ footer {
176
116
  .page-toolbar {
177
117
  margin-top: 1rem;
178
118
  }
179
- .search a[href='#'] {
180
- display: inline-block;
181
- }
182
119
  .has-menu .col-sidebar {
183
120
  padding: 1rem;
184
121
  }
package/dist/index.js CHANGED
@@ -2,27 +2,21 @@ 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
- DefaultTheme as DefaultTheme2,
7
- JSX as JSX6,
8
- RendererEvent
9
- } from "typedoc";
5
+ import { DefaultTheme as DefaultTheme2, JSX as JSX6, RendererEvent } from "typedoc";
10
6
  import * as path from "path";
11
7
  import * as fs from "fs";
12
8
  import { fileURLToPath } from "url";
13
9
 
14
10
  // src/themes/VarvaraThemeContext.ts
15
- import {
16
- DefaultThemeRenderContext as DefaultThemeRenderContext3
17
- } from "typedoc";
11
+ import { DefaultThemeRenderContext as DefaultThemeRenderContext3 } from "typedoc";
18
12
 
19
13
  // src/partials/footer.tsx
20
- import { JSX } from "typedoc";
14
+ import { i18n, JSX } from "typedoc";
21
15
  function footer(context) {
22
16
  const hideGenerator = context.options.getValue("hideGenerator");
23
17
  let generatorDisplay = /* @__PURE__ */ JSX.createElement(JSX.Fragment, null);
24
18
  if (!hideGenerator) {
25
- const message = context.i18n.theme_generated_using_typedoc();
19
+ const message = i18n.theme_generated_using_typedoc();
26
20
  const index = message.indexOf("TypeDoc");
27
21
  if (index == -1) {
28
22
  generatorDisplay = /* @__PURE__ */ JSX.createElement("p", {
@@ -61,7 +55,7 @@ function footer(context) {
61
55
  }
62
56
 
63
57
  // src/partials/sidebar.tsx
64
- import { JSX as JSX2 } from "typedoc";
58
+ import { i18n as i18n2, JSX as JSX2 } from "typedoc";
65
59
  function sidebar(context) {
66
60
  const navigation = context.getNavigation();
67
61
  return (props) => {
@@ -71,12 +65,9 @@ function sidebar(context) {
71
65
  class: "va-collapse tsd-accordion"
72
66
  }, /* @__PURE__ */ JSX2.createElement("summary", null, /* @__PURE__ */ JSX2.createElement("a", {
73
67
  href: context.urlTo(props.project)
74
- }, context.i18n.kind_plural_module())), navigation.map((item) => /* @__PURE__ */ JSX2.createElement("a", {
68
+ }, i18n2.kind_plural_module())), navigation.map((item) => /* @__PURE__ */ JSX2.createElement("a", {
75
69
  href: `${context.relativeURL("./")}/${item.path}`,
76
- class: [
77
- "va-button",
78
- item.path?.includes(props.url) && "va-button--active"
79
- ].join(" ")
70
+ class: ["va-button", item.path?.includes(props.url) && "va-button--active"].join(" ")
80
71
  }, /* @__PURE__ */ JSX2.createElement("svg", {
81
72
  width: "20",
82
73
  height: "20",
@@ -90,7 +81,7 @@ function sidebar(context) {
90
81
  }
91
82
 
92
83
  // src/partials/navigation.tsx
93
- import { JSX as JSX3, ReflectionFlag } from "typedoc";
84
+ import { JSX as JSX3, ReflectionFlag, i18n as i18n3, translateTagName, ReflectionFlags } from "typedoc";
94
85
  function pageSidebar(context) {
95
86
  return (props) => {
96
87
  return /* @__PURE__ */ JSX3.createElement("div", {
@@ -111,30 +102,30 @@ function settings(context) {
111
102
  for (const key of Object.keys(defaultFilters)) {
112
103
  if (key.startsWith("@")) {
113
104
  const filterName = key.substring(1).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
114
- visibilityOptions.push(buildFilterItem(context, filterName, context.internationalization.translateTagName(key), defaultFilters[key]));
105
+ visibilityOptions.push(buildFilterItem(context, filterName, translateTagName(key), defaultFilters[key]));
115
106
  } else if (key === "protected" && !context.options.getValue("excludeProtected") || key === "private" && !context.options.getValue("excludePrivate") || key === "external" && !context.options.getValue("excludeExternals") || key === "inherited") {
116
- visibilityOptions.push(buildFilterItem(context, key, context.internationalization.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
107
+ visibilityOptions.push(buildFilterItem(context, key, ReflectionFlags.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
117
108
  }
118
109
  }
119
110
  return /* @__PURE__ */ JSX3.createElement("details", {
120
111
  class: "va-collapse settings tsd-accordion",
121
112
  open: false
122
- }, /* @__PURE__ */ JSX3.createElement("summary", null, context.i18n.theme_settings()), visibilityOptions.length && /* @__PURE__ */ JSX3.createElement("div", {
113
+ }, /* @__PURE__ */ JSX3.createElement("summary", null, i18n3.theme_settings()), visibilityOptions.length && /* @__PURE__ */ JSX3.createElement("div", {
123
114
  class: "tsd-filter-visibility"
124
115
  }, /* @__PURE__ */ JSX3.createElement("span", {
125
116
  class: "settings-label"
126
- }, context.i18n.theme_member_visibility()), /* @__PURE__ */ JSX3.createElement("ul", {
117
+ }, i18n3.theme_member_visibility()), /* @__PURE__ */ JSX3.createElement("ul", {
127
118
  id: "tsd-filter-options"
128
- }, ...visibilityOptions)), /* @__PURE__ */ JSX3.createElement("label", null, /* @__PURE__ */ JSX3.createElement("span", null, context.i18n.theme_theme()), /* @__PURE__ */ JSX3.createElement("select", {
119
+ }, ...visibilityOptions)), /* @__PURE__ */ JSX3.createElement("label", null, /* @__PURE__ */ JSX3.createElement("span", null, i18n3.theme_theme()), /* @__PURE__ */ JSX3.createElement("select", {
129
120
  id: "tsd-theme",
130
121
  class: "va-select"
131
122
  }, /* @__PURE__ */ JSX3.createElement("option", {
132
123
  value: "os"
133
- }, context.i18n.theme_os()), /* @__PURE__ */ JSX3.createElement("option", {
124
+ }, i18n3.theme_os()), /* @__PURE__ */ JSX3.createElement("option", {
134
125
  value: "light"
135
- }, context.i18n.theme_light()), /* @__PURE__ */ JSX3.createElement("option", {
126
+ }, i18n3.theme_light()), /* @__PURE__ */ JSX3.createElement("option", {
136
127
  value: "dark"
137
- }, context.i18n.theme_dark()))));
128
+ }, i18n3.theme_dark()))));
138
129
  };
139
130
  }
140
131
  function buildSectionNavigation(context, headings) {
@@ -203,52 +194,39 @@ function pageNavigation(context) {
203
194
  return /* @__PURE__ */ JSX3.createElement("details", {
204
195
  open: false,
205
196
  class: "va-collapse page-navigation tsd-accordion"
206
- }, /* @__PURE__ */ JSX3.createElement("summary", null, context.i18n.theme_on_this_page()), sections);
197
+ }, /* @__PURE__ */ JSX3.createElement("summary", null, i18n3.theme_on_this_page()), sections);
207
198
  };
208
199
  }
209
200
 
210
201
  // src/partials/toolbar.tsx
211
- import {
212
- DeclarationReflection,
213
- JSX as JSX4,
214
- ProjectReflection
215
- } from "typedoc";
202
+ import { i18n as i18n4, DeclarationReflection, JSX as JSX4, ProjectReflection } from "typedoc";
216
203
  function toolbar(context) {
217
204
  return (props) => /* @__PURE__ */ JSX4.createElement("header", {
218
205
  class: "page-toolbar"
219
206
  }, /* @__PURE__ */ JSX4.createElement("div", {
220
- class: "search",
221
- id: "tsd-search"
222
- }, /* @__PURE__ */ JSX4.createElement("div", {
223
- class: "field va-button-group"
207
+ class: "va-button-group"
224
208
  }, /* @__PURE__ */ JSX4.createElement("div", {
225
209
  class: "va-button-group va-button-group--horizontal"
226
210
  }, /* @__PURE__ */ JSX4.createElement("a", {
227
211
  href: context.options.getValue("titleLink") || context.relativeURL("index.html"),
228
- class: "va-button"
212
+ class: "title va-button"
229
213
  }, /* @__PURE__ */ JSX4.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection || props.project instanceof ProjectReflection) && props.project.packageVersion && /* @__PURE__ */ JSX4.createElement("span", {
230
214
  class: "version-badge"
231
- }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX4.createElement("label", {
232
- for: "tsd-search-field",
233
- class: "va-button"
234
- }, context.icons.search()), /* @__PURE__ */ JSX4.createElement("a", {
235
- href: "#",
215
+ }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX4.createElement("button", {
216
+ id: "tsd-search-trigger",
236
217
  class: "va-button",
237
- "data-toggle": "menu",
238
- "aria-label": context.i18n.theme_menu()
239
- }, context.icons.menu())), /* @__PURE__ */ JSX4.createElement("input", {
240
- type: "text",
241
- id: "tsd-search-field",
242
- class: "va-input",
243
- placeholder: context.i18n.theme_search(),
244
- "aria-label": context.i18n.theme_search()
245
- })), /* @__PURE__ */ JSX4.createElement("ul", {
246
- class: "results"
247
- }, /* @__PURE__ */ JSX4.createElement("li", {
248
- class: "state loading"
249
- }, context.i18n.theme_preparing_search_index()), /* @__PURE__ */ JSX4.createElement("li", {
250
- class: "state failure"
251
- }, context.i18n.theme_search_index_not_available()))), /* @__PURE__ */ JSX4.createElement("div", {
218
+ "aria-label": i18n4.theme_search()
219
+ }, /* @__PURE__ */ JSX4.createElement("svg", {
220
+ xmlns: "http://www.w3.org/2000/svg",
221
+ fill: "none",
222
+ viewBox: "0 0 24 24",
223
+ "stroke-width": "2.5",
224
+ width: "16",
225
+ height: "16",
226
+ stroke: "currentColor"
227
+ }, /* @__PURE__ */ JSX4.createElement("path", {
228
+ d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
229
+ })))), /* @__PURE__ */ JSX4.createElement("div", {
252
230
  class: "navigation-links va-button-group"
253
231
  }, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */ JSX4.createElement("a", {
254
232
  href: url,
@@ -264,14 +242,34 @@ function toolbar(context) {
264
242
  "clip-rule": "evenodd",
265
243
  d: "M1.52346 0.380859H15.6187V14.4761H13.333V4.28282L2.33158 15.2842L0.715332 13.668L11.7167 2.66657H1.52346V0.380859Z",
266
244
  fill: "currentColor"
267
- }))))));
245
+ })))))), /* @__PURE__ */ JSX4.createElement("dialog", {
246
+ id: "tsd-search",
247
+ "aria-label": i18n4.theme_search()
248
+ }, /* @__PURE__ */ JSX4.createElement("input", {
249
+ role: "combobox",
250
+ class: "va-input",
251
+ id: "tsd-search-input",
252
+ "aria-controls": "tsd-search-results",
253
+ "aria-autocomplete": "list",
254
+ "aria-expanded": "true",
255
+ spellcheck: false,
256
+ autocapitalize: "off",
257
+ autocomplete: "off",
258
+ placeholder: i18n4.theme_search_placeholder(),
259
+ maxLength: 100
260
+ }), /* @__PURE__ */ JSX4.createElement("ul", {
261
+ role: "listbox",
262
+ id: "tsd-search-results"
263
+ }), /* @__PURE__ */ JSX4.createElement("div", {
264
+ id: "tsd-search-status",
265
+ "aria-live": "polite",
266
+ "aria-atomic": "true"
267
+ }, /* @__PURE__ */ JSX4.createElement("div", null, i18n4.theme_preparing_search_index()))));
268
268
  }
269
269
 
270
270
  // src/partials/layout.tsx
271
271
  import { extname } from "path";
272
- import {
273
- JSX as JSX5
274
- } from "typedoc";
272
+ import { JSX as JSX5 } from "typedoc";
275
273
 
276
274
  // src/utils.ts
277
275
  import {
@@ -427,8 +425,8 @@ function buildSiteMetadata(context) {
427
425
 
428
426
  // src/themes/VarvaraThemeContext.ts
429
427
  class VarvaraThemeContext extends DefaultThemeRenderContext3 {
430
- constructor(theme, page, options) {
431
- super(theme, page, options);
428
+ constructor(router, theme, page, options) {
429
+ super(router, theme, page, options);
432
430
  this.pageSidebar = pageSidebar(this);
433
431
  this.toolbar = toolbar(this);
434
432
  this.defaultLayout = layout(this);
@@ -459,7 +457,7 @@ class VarvaraTheme extends DefaultTheme2 {
459
457
  })));
460
458
  }
461
459
  getRenderContext(pageEvent) {
462
- return new VarvaraThemeContext(this, pageEvent, this.application.options);
460
+ return new VarvaraThemeContext(this.router, this, pageEvent, this.application.options);
463
461
  }
464
462
  }
465
463
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varvara-typedoc-theme",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "author": "Marc Mariné <shenobi@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "@types/bun": "latest"
22
22
  },
23
23
  "peerDependencies": {
24
- "typedoc": "^0.27.5",
24
+ "typedoc": "^0.28.0",
25
25
  "typescript": "^5.0.0"
26
26
  },
27
27
  "scripts": {