docula 1.0.0 → 1.1.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.
package/dist/docula.d.ts CHANGED
@@ -75,6 +75,11 @@ type DoculaCookieAuth = {
75
75
  cookieName?: string;
76
76
  logoutUrl?: string;
77
77
  };
78
+ type DoculaHeaderLink = {
79
+ label: string;
80
+ url: string;
81
+ icon?: string;
82
+ };
78
83
  type DoculaCacheOptions = {
79
84
  github: {
80
85
  ttl: number;
@@ -161,6 +166,11 @@ declare class DoculaOptions {
161
166
  * in the header based on whether a JWT cookie is present.
162
167
  */
163
168
  cookieAuth?: DoculaCookieAuth;
169
+ /**
170
+ * Additional links to display in the site header navigation.
171
+ * Each link requires a label and url.
172
+ */
173
+ headerLinks?: DoculaHeaderLink[];
164
174
  /**
165
175
  * File extensions to copy as assets from docs/ and changelog/ directories.
166
176
  * Override in docula.config to customize.
@@ -217,6 +227,11 @@ type DoculaData = {
217
227
  cookieName?: string;
218
228
  logoutUrl?: string;
219
229
  };
230
+ headerLinks?: Array<{
231
+ label: string;
232
+ url: string;
233
+ icon?: string;
234
+ }>;
220
235
  };
221
236
  type DoculaTemplates = {
222
237
  home: string;
@@ -392,4 +407,4 @@ declare class Docula {
392
407
  serve(options: DoculaOptions): Promise<http.Server>;
393
408
  }
394
409
 
395
- export { type DoculaCacheOptions, type DoculaCookieAuth, DoculaOptions, Docula as default };
410
+ export { type DoculaCacheOptions, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };
package/dist/docula.js CHANGED
@@ -920,6 +920,11 @@ var DoculaOptions = class {
920
920
  * in the header based on whether a JWT cookie is present.
921
921
  */
922
922
  cookieAuth;
923
+ /**
924
+ * Additional links to display in the site header navigation.
925
+ * Each link requires a label and url.
926
+ */
927
+ headerLinks;
923
928
  /**
924
929
  * File extensions to copy as assets from docs/ and changelog/ directories.
925
930
  * Override in docula.config to customize.
@@ -1027,6 +1032,14 @@ var DoculaOptions = class {
1027
1032
  if (options.cookieAuth && typeof options.cookieAuth === "object" && typeof options.cookieAuth.loginUrl === "string") {
1028
1033
  this.cookieAuth = options.cookieAuth;
1029
1034
  }
1035
+ if (options.headerLinks && Array.isArray(options.headerLinks)) {
1036
+ const validLinks = options.headerLinks.filter(
1037
+ (link) => typeof link === "object" && link !== null && typeof link.label === "string" && typeof link.url === "string"
1038
+ );
1039
+ if (validLinks.length > 0) {
1040
+ this.headerLinks = validLinks;
1041
+ }
1042
+ }
1030
1043
  }
1031
1044
  };
1032
1045
 
@@ -1094,7 +1107,8 @@ var DoculaBuilder = class {
1094
1107
  openApiUrl: this.options.openApiUrl,
1095
1108
  homePage: this.options.homePage,
1096
1109
  themeMode: this.options.themeMode,
1097
- cookieAuth: this.options.cookieAuth
1110
+ cookieAuth: this.options.cookieAuth,
1111
+ headerLinks: this.options.headerLinks
1098
1112
  };
1099
1113
  if (!doculaData.openApiUrl && fs3.existsSync(`${doculaData.sitePath}/api/swagger.json`)) {
1100
1114
  doculaData.openApiUrl = "/api/swagger.json";
@@ -2649,6 +2663,7 @@ export {
2649
2663
  };
2650
2664
  /* v8 ignore next -- @preserve */
2651
2665
  /* v8 ignore next 3 -- @preserve */
2666
+ /* v8 ignore next 5 -- @preserve */
2652
2667
  /* v8 ignore next 2 -- @preserve */
2653
2668
  /* v8 ignore next 9 -- @preserve */
2654
2669
  /* v8 ignore next 4 -- @preserve */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docula",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Beautiful Website for Your Projects",
5
5
  "type": "module",
6
6
  "main": "./dist/docula.js",
@@ -127,6 +127,32 @@
127
127
  align-items: center;
128
128
  }
129
129
 
130
+ .sidebar-links {
131
+ display: none;
132
+ }
133
+
134
+ @media screen and (min-width: 992px) {
135
+ .sidebar-links {
136
+ display: flex;
137
+ flex-direction: column;
138
+ gap: 0.5rem;
139
+ padding: 1rem 0;
140
+ border-top: 1px solid var(--border);
141
+ margin-top: 1rem;
142
+ }
143
+
144
+ .sidebar-header-link {
145
+ color: var(--sidebar-text);
146
+ text-decoration: none;
147
+ font-size: 0.875rem;
148
+ padding: 0.25rem 0;
149
+ }
150
+
151
+ .sidebar-header-link:hover {
152
+ text-decoration: underline;
153
+ }
154
+ }
155
+
130
156
  .header-logo {
131
157
  flex-shrink: 0;
132
158
  margin-right: 1.5rem;
@@ -5,6 +5,11 @@
5
5
  <a class="header-logo" href="/">
6
6
  <img src="/logo.svg" alt="logo" />
7
7
  </a>
8
+ {{#if headerLinks}}
9
+ {{#each headerLinks}}
10
+ <a class="header-link" href="{{this.url}}" target="_blank" rel="noopener noreferrer">{{#if this.icon}}{{{this.icon}}} {{/if}}{{this.label}}</a>
11
+ {{/each}}
12
+ {{/if}}
8
13
  <button id="open-sidebar" class="icon menu-btn">
9
14
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>
10
15
  <span>Menu</span>
@@ -36,6 +36,13 @@
36
36
  {{/forEach}}
37
37
  </ul>
38
38
 
39
+ {{#if headerLinks}}
40
+ <div class="sidebar-links">
41
+ {{#each headerLinks}}
42
+ <a class="sidebar-header-link" href="{{this.url}}" target="_blank" rel="noopener noreferrer">{{#if this.icon}}{{{this.icon}}} {{/if}}{{this.label}}</a>
43
+ {{/each}}
44
+ </div>
45
+ {{/if}}
39
46
  </div>
40
47
  </section>
41
48
 
@@ -26,6 +26,18 @@
26
26
  <span>Changelog</span>
27
27
  </a>
28
28
  {{/if}}
29
+ {{#if headerLinks}}
30
+ {{#each headerLinks}}
31
+ <a class="header-bottom__item" href="{{this.url}}" target="_blank" rel="noopener noreferrer">
32
+ {{#if this.icon}}
33
+ {{{this.icon}}}
34
+ {{else}}
35
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>
36
+ {{/if}}
37
+ <span>{{this.label}}</span>
38
+ </a>
39
+ {{/each}}
40
+ {{/if}}
29
41
  </nav>
30
42
  {{#if cookieAuth}}
31
43
  <a href="{{cookieAuth.loginUrl}}" class="cookie-auth-btn" id="cookie-auth-login">
@@ -61,6 +73,18 @@
61
73
  <span>Changelog</span>
62
74
  </a>
63
75
  {{/if}}
76
+ {{#if headerLinks}}
77
+ {{#each headerLinks}}
78
+ <a class="mobile-nav__item" href="{{this.url}}" target="_blank" rel="noopener noreferrer">
79
+ {{#if this.icon}}
80
+ {{{this.icon}}}
81
+ {{else}}
82
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>
83
+ {{/if}}
84
+ <span>{{this.label}}</span>
85
+ </a>
86
+ {{/each}}
87
+ {{/if}}
64
88
  {{#if cookieAuth}}
65
89
  <a class="mobile-nav__item" href="{{cookieAuth.loginUrl}}" id="cookie-auth-login-mobile">
66
90
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" x2="3" y1="12" y2="12"/></svg>