varvara-typedoc-theme 0.2.0 → 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;
@@ -132,12 +81,12 @@ a {
132
81
 
133
82
  .settings .va-select {
134
83
  width: 100%;
135
- border-left: 0;
84
+ border-left-color: transparent;
136
85
  border-right: 0;
137
86
  border-bottom: 0;
138
87
  }
139
88
 
140
- .settings .va-select-group {
89
+ .settings label:has(.va-select) {
141
90
  padding-left: 0 !important;
142
91
  }
143
92
 
@@ -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
  }
@@ -194,7 +131,7 @@ footer {
194
131
  .container-main {
195
132
  grid-template-areas: 'header content' 'sidebar content';
196
133
  grid-auto-rows: auto 1fr;
197
- margin: var(--va-space-8) 0;
134
+ margin: var(--va-space-8) auto;
198
135
  }
199
136
  .container {
200
137
  padding: 0 var(--va-space-8);
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,10 +81,7 @@ function sidebar(context) {
90
81
  }
91
82
 
92
83
  // src/partials/navigation.tsx
93
- import {
94
- JSX as JSX3,
95
- ReflectionFlag
96
- } from "typedoc";
84
+ import { JSX as JSX3, ReflectionFlag, i18n as i18n3, translateTagName, ReflectionFlags } from "typedoc";
97
85
  function pageSidebar(context) {
98
86
  return (props) => {
99
87
  return /* @__PURE__ */ JSX3.createElement("div", {
@@ -114,32 +102,30 @@ function settings(context) {
114
102
  for (const key of Object.keys(defaultFilters)) {
115
103
  if (key.startsWith("@")) {
116
104
  const filterName = key.substring(1).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
117
- visibilityOptions.push(buildFilterItem(context, filterName, context.internationalization.translateTagName(key), defaultFilters[key]));
105
+ visibilityOptions.push(buildFilterItem(context, filterName, translateTagName(key), defaultFilters[key]));
118
106
  } else if (key === "protected" && !context.options.getValue("excludeProtected") || key === "private" && !context.options.getValue("excludePrivate") || key === "external" && !context.options.getValue("excludeExternals") || key === "inherited") {
119
- visibilityOptions.push(buildFilterItem(context, key, context.internationalization.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
107
+ visibilityOptions.push(buildFilterItem(context, key, ReflectionFlags.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
120
108
  }
121
109
  }
122
110
  return /* @__PURE__ */ JSX3.createElement("details", {
123
111
  class: "va-collapse settings tsd-accordion",
124
112
  open: false
125
- }, /* @__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", {
126
114
  class: "tsd-filter-visibility"
127
115
  }, /* @__PURE__ */ JSX3.createElement("span", {
128
116
  class: "settings-label"
129
- }, context.i18n.theme_member_visibility()), /* @__PURE__ */ JSX3.createElement("ul", {
117
+ }, i18n3.theme_member_visibility()), /* @__PURE__ */ JSX3.createElement("ul", {
130
118
  id: "tsd-filter-options"
131
- }, ...visibilityOptions)), /* @__PURE__ */ JSX3.createElement("div", {
132
- class: "va-select-group"
133
- }, /* @__PURE__ */ JSX3.createElement("label", 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", {
134
120
  id: "tsd-theme",
135
121
  class: "va-select"
136
122
  }, /* @__PURE__ */ JSX3.createElement("option", {
137
123
  value: "os"
138
- }, context.i18n.theme_os()), /* @__PURE__ */ JSX3.createElement("option", {
124
+ }, i18n3.theme_os()), /* @__PURE__ */ JSX3.createElement("option", {
139
125
  value: "light"
140
- }, context.i18n.theme_light()), /* @__PURE__ */ JSX3.createElement("option", {
126
+ }, i18n3.theme_light()), /* @__PURE__ */ JSX3.createElement("option", {
141
127
  value: "dark"
142
- }, context.i18n.theme_dark()))));
128
+ }, i18n3.theme_dark()))));
143
129
  };
144
130
  }
145
131
  function buildSectionNavigation(context, headings) {
@@ -208,52 +194,39 @@ function pageNavigation(context) {
208
194
  return /* @__PURE__ */ JSX3.createElement("details", {
209
195
  open: false,
210
196
  class: "va-collapse page-navigation tsd-accordion"
211
- }, /* @__PURE__ */ JSX3.createElement("summary", null, context.i18n.theme_on_this_page()), sections);
197
+ }, /* @__PURE__ */ JSX3.createElement("summary", null, i18n3.theme_on_this_page()), sections);
212
198
  };
213
199
  }
214
200
 
215
201
  // src/partials/toolbar.tsx
216
- import {
217
- DeclarationReflection,
218
- JSX as JSX4,
219
- ProjectReflection
220
- } from "typedoc";
202
+ import { i18n as i18n4, DeclarationReflection, JSX as JSX4, ProjectReflection } from "typedoc";
221
203
  function toolbar(context) {
222
204
  return (props) => /* @__PURE__ */ JSX4.createElement("header", {
223
205
  class: "page-toolbar"
224
206
  }, /* @__PURE__ */ JSX4.createElement("div", {
225
- class: "search",
226
- id: "tsd-search"
227
- }, /* @__PURE__ */ JSX4.createElement("div", {
228
- class: "field va-button-group"
207
+ class: "va-button-group"
229
208
  }, /* @__PURE__ */ JSX4.createElement("div", {
230
209
  class: "va-button-group va-button-group--horizontal"
231
210
  }, /* @__PURE__ */ JSX4.createElement("a", {
232
211
  href: context.options.getValue("titleLink") || context.relativeURL("index.html"),
233
- class: "va-button"
212
+ class: "title va-button"
234
213
  }, /* @__PURE__ */ JSX4.createElement("b", null, props.project.name), (props.project instanceof DeclarationReflection || props.project instanceof ProjectReflection) && props.project.packageVersion && /* @__PURE__ */ JSX4.createElement("span", {
235
214
  class: "version-badge"
236
- }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX4.createElement("label", {
237
- for: "tsd-search-field",
238
- class: "va-button"
239
- }, context.icons.search()), /* @__PURE__ */ JSX4.createElement("a", {
240
- href: "#",
215
+ }, "v", props.project.packageVersion)), /* @__PURE__ */ JSX4.createElement("button", {
216
+ id: "tsd-search-trigger",
241
217
  class: "va-button",
242
- "data-toggle": "menu",
243
- "aria-label": context.i18n.theme_menu()
244
- }, context.icons.menu())), /* @__PURE__ */ JSX4.createElement("input", {
245
- type: "text",
246
- id: "tsd-search-field",
247
- class: "va-input",
248
- placeholder: context.i18n.theme_search(),
249
- "aria-label": context.i18n.theme_search()
250
- })), /* @__PURE__ */ JSX4.createElement("ul", {
251
- class: "results"
252
- }, /* @__PURE__ */ JSX4.createElement("li", {
253
- class: "state loading"
254
- }, context.i18n.theme_preparing_search_index()), /* @__PURE__ */ JSX4.createElement("li", {
255
- class: "state failure"
256
- }, 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", {
257
230
  class: "navigation-links va-button-group"
258
231
  }, Object.entries(context.options.getValue("navigationLinks")).map(([label, url]) => /* @__PURE__ */ JSX4.createElement("a", {
259
232
  href: url,
@@ -269,14 +242,34 @@ function toolbar(context) {
269
242
  "clip-rule": "evenodd",
270
243
  d: "M1.52346 0.380859H15.6187V14.4761H13.333V4.28282L2.33158 15.2842L0.715332 13.668L11.7167 2.66657H1.52346V0.380859Z",
271
244
  fill: "currentColor"
272
- }))))));
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()))));
273
268
  }
274
269
 
275
270
  // src/partials/layout.tsx
276
271
  import { extname } from "path";
277
- import {
278
- JSX as JSX5
279
- } from "typedoc";
272
+ import { JSX as JSX5 } from "typedoc";
280
273
 
281
274
  // src/utils.ts
282
275
  import {
@@ -432,8 +425,8 @@ function buildSiteMetadata(context) {
432
425
 
433
426
  // src/themes/VarvaraThemeContext.ts
434
427
  class VarvaraThemeContext extends DefaultThemeRenderContext3 {
435
- constructor(theme, page, options) {
436
- super(theme, page, options);
428
+ constructor(router, theme, page, options) {
429
+ super(router, theme, page, options);
437
430
  this.pageSidebar = pageSidebar(this);
438
431
  this.toolbar = toolbar(this);
439
432
  this.defaultLayout = layout(this);
@@ -464,7 +457,7 @@ class VarvaraTheme extends DefaultTheme2 {
464
457
  })));
465
458
  }
466
459
  getRenderContext(pageEvent) {
467
- return new VarvaraThemeContext(this, pageEvent, this.application.options);
460
+ return new VarvaraThemeContext(this.router, this, pageEvent, this.application.options);
468
461
  }
469
462
  }
470
463
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varvara-typedoc-theme",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "author": "Marc Mariné <shenobi@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,20 +8,20 @@
8
8
  "directory": "packages/typedoc-theme"
9
9
  },
10
10
  "type": "module",
11
- "description": "Seamless documentation experience for TypeScript projects.",
11
+ "description": "Varvara theme for TypeDoc.",
12
12
  "keywords": [
13
13
  "typedoc-theme",
14
14
  "varvara-css"
15
15
  ],
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "varvara-css": "^0.4.1"
18
+ "varvara-css": "latest"
19
19
  },
20
20
  "devDependencies": {
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": {