varvara-typedoc-theme 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +6 -5
  2. package/dist/index.js +42 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Varvara TypeDoc Theme
2
2
 
3
- Varvara TypeDoc Theme is a [custom theme](https://typedoc.org/documents/Development.Custom_Themes.html) for TypeDoc, designed to provide an seamless documentation experience for TypeScript projects.
3
+ _View a_ [_live example here_](https://marcmarine.github.io/western-signs).
4
4
 
5
- [![license](https://img.shields.io/github/license/marcmarine/varvara-js)](https://github.com/marcmarine/varvara-js/blob/main/LICENSE)
5
+ Varvara TypeDoc Theme is a custom theme for TypeDoc, designed to provide a seamless documentation experience for TypeScript projects.
6
6
 
7
- ## Prerequisites
8
-
9
- Ensure TypeDoc is [installed](https://typedoc.org/index.html#quick-start) in your project.
7
+ ![NPM Version](https://img.shields.io/npm/v/varvara-typedoc-theme)
8
+ [![GitHub License](https://img.shields.io/github/license/marcmarine/varvara-js)](https://github.com/marcmarine/varvara-js/blob/main/LICENSE)
10
9
 
11
10
  ## Installation
12
11
 
12
+ Ensure TypeDoc is [installed](https://typedoc.org/index.html#quick-start) in your project.
13
+
13
14
  Install the Varvara TypeDoc theme as a development dependency:
14
15
 
15
16
  ```bash
package/dist/index.js CHANGED
@@ -89,21 +89,28 @@ function sidebar(context) {
89
89
  };
90
90
  }
91
91
 
92
- // src/partials/pageSidebar.tsx
92
+ // src/partials/navigation.tsx
93
93
  import {
94
94
  JSX as JSX3,
95
95
  ReflectionFlag
96
96
  } from "typedoc";
97
97
  function pageSidebar(context) {
98
98
  return (props) => {
99
+ return /* @__PURE__ */ JSX3.createElement("div", {
100
+ class: "va-button-group"
101
+ }, context.settings(), context.pageNavigation(props));
102
+ };
103
+ }
104
+ var flagOptionNameToReflectionFlag = {
105
+ protected: ReflectionFlag.Protected,
106
+ private: ReflectionFlag.Private,
107
+ external: ReflectionFlag.External,
108
+ inherited: ReflectionFlag.Inherited
109
+ };
110
+ function settings(context) {
111
+ return () => {
99
112
  const defaultFilters = context.options.getValue("visibilityFilters");
100
113
  const visibilityOptions = [];
101
- const flagOptionNameToReflectionFlag = {
102
- protected: ReflectionFlag.Protected,
103
- private: ReflectionFlag.Private,
104
- external: ReflectionFlag.External,
105
- inherited: ReflectionFlag.Inherited
106
- };
107
114
  for (const key of Object.keys(defaultFilters)) {
108
115
  if (key.startsWith("@")) {
109
116
  const filterName = key.substring(1).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
@@ -112,25 +119,7 @@ function pageSidebar(context) {
112
119
  visibilityOptions.push(buildFilterItem(context, key, context.internationalization.flagString(flagOptionNameToReflectionFlag[key]), defaultFilters[key]));
113
120
  }
114
121
  }
115
- if (!props.pageSections.some((sect) => sect.headings.length)) {
116
- return /* @__PURE__ */ JSX3.createElement(JSX3.Fragment, null);
117
- }
118
- const sections = [];
119
- for (const section of props.pageSections) {
120
- if (section.title) {
121
- sections.push(/* @__PURE__ */ JSX3.createElement("details", {
122
- open: true,
123
- class: "va-collapse tsd-accordion"
124
- }, /* @__PURE__ */ JSX3.createElement("summary", {
125
- "data-key": `section-${section.title}`
126
- }, section.title), buildSectionNavigation(context, section.headings)));
127
- } else {
128
- sections.push(buildSectionNavigation(context, section.headings));
129
- }
130
- }
131
- return /* @__PURE__ */ JSX3.createElement("div", {
132
- class: "va-button-group"
133
- }, /* @__PURE__ */ JSX3.createElement("details", {
122
+ return /* @__PURE__ */ JSX3.createElement("details", {
134
123
  class: "va-collapse settings tsd-accordion",
135
124
  open: false
136
125
  }, /* @__PURE__ */ JSX3.createElement("summary", null, context.i18n.theme_settings()), visibilityOptions.length && /* @__PURE__ */ JSX3.createElement("div", {
@@ -150,10 +139,7 @@ function pageSidebar(context) {
150
139
  value: "light"
151
140
  }, context.i18n.theme_light()), /* @__PURE__ */ JSX3.createElement("option", {
152
141
  value: "dark"
153
- }, context.i18n.theme_dark())))), /* @__PURE__ */ JSX3.createElement("details", {
154
- open: false,
155
- class: "va-collapse page-navigation tsd-accordion"
156
- }, /* @__PURE__ */ JSX3.createElement("summary", null, context.i18n.theme_on_this_page()), sections));
142
+ }, context.i18n.theme_dark()))));
157
143
  };
158
144
  }
159
145
  function buildSectionNavigation(context, headings) {
@@ -201,6 +187,30 @@ function buildFilterItem(context, name, displayName, defaultValue) {
201
187
  checked: defaultValue
202
188
  }), context.icons.checkbox(), /* @__PURE__ */ JSX3.createElement("span", null, displayName)));
203
189
  }
190
+ function pageNavigation(context) {
191
+ return (props) => {
192
+ if (!props.pageSections.some((sect) => sect.headings.length)) {
193
+ return /* @__PURE__ */ JSX3.createElement(JSX3.Fragment, null);
194
+ }
195
+ const sections = [];
196
+ for (const section of props.pageSections) {
197
+ if (section.title) {
198
+ sections.push(/* @__PURE__ */ JSX3.createElement("details", {
199
+ open: true,
200
+ class: "va-collapse tsd-accordion"
201
+ }, /* @__PURE__ */ JSX3.createElement("summary", {
202
+ "data-key": `section-${section.title}`
203
+ }, section.title), buildSectionNavigation(context, section.headings)));
204
+ } else {
205
+ sections.push(buildSectionNavigation(context, section.headings));
206
+ }
207
+ }
208
+ return /* @__PURE__ */ JSX3.createElement("details", {
209
+ open: false,
210
+ class: "va-collapse page-navigation tsd-accordion"
211
+ }, /* @__PURE__ */ JSX3.createElement("summary", null, context.i18n.theme_on_this_page()), sections);
212
+ };
213
+ }
204
214
 
205
215
  // src/partials/toolbar.tsx
206
216
  import {
@@ -428,6 +438,8 @@ class VarvaraThemeContext extends DefaultThemeRenderContext3 {
428
438
  this.toolbar = toolbar(this);
429
439
  this.defaultLayout = layout(this);
430
440
  this.sidebar = sidebar(this);
441
+ this.settings = settings(this);
442
+ this.pageNavigation = pageNavigation(this);
431
443
  }
432
444
  footer = () => footer(this);
433
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varvara-typedoc-theme",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "author": "Marc Mariné <shenobi@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",