Skip to content

Commit 97d2763

Browse files
committed
feat(app): dark mode toggle button
fix #1127
1 parent 3814299 commit 97d2763

File tree

21 files changed

+444
-348
lines changed

21 files changed

+444
-348
lines changed

src-refactored/core/entities/public-configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class PublicConfiguration {
2626
public gaID: string;
2727
public gaSite: string;
2828
public hideGenerator: boolean;
29+
public hideDarkModeToggle: boolean;
2930
public host: string;
3031
public includes;
3132
public includesName: string;

src-refactored/core/entities/public-flags.ts

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,192 +17,198 @@ export const PUBLIC_FLAGS: Flag[] = [
1717
{
1818
label: 'assetsFolder',
1919
flag: '-a, --assetsFolder [folder]',
20-
description: 'External assets folder to copy in generated documentation folder',
20+
description: 'External assets folder to copy in generated documentation folder'
2121
},
2222
{
2323
label: 'config',
2424
flag: '-c, --config [config]',
2525
description:
26-
'A configuration file : .compodocrc, .compodocrc.json, .compodocrc.yaml or compodoc property in package.json',
26+
'A configuration file : .compodocrc, .compodocrc.json, .compodocrc.yaml or compodoc property in package.json'
2727
},
2828
{
2929
label: 'coverageMinimumPerFile',
3030
flag: '--coverageMinimumPerFile [minimum]',
31-
description: 'Test command of documentation coverage per file with a minimum (default 0)',
31+
description: 'Test command of documentation coverage per file with a minimum (default 0)'
3232
},
3333
{
3434
label: 'coverageTest',
3535
flag: '--coverageTest [threshold]',
36-
description: 'Test command of documentation coverage with a threshold (default 70)',
36+
description: 'Test command of documentation coverage with a threshold (default 70)'
3737
},
3838
{
3939
label: 'coverageTestShowOnlyFailed',
4040
flag: '--coverageTestShowOnlyFailed',
41-
description: 'Display only failed files for a coverage test',
41+
description: 'Display only failed files for a coverage test'
4242
},
4343
{
4444
label: 'coverageTestThresholdFail',
4545
flag: '--coverageTestThresholdFail [true|false]',
4646
description:
4747
'Test command of documentation coverage (global or per file) will fail with error or just warn user (true: error, false: warn)',
48-
defaultValue: COMPODOC_DEFAULTS.coverageTestThresholdFail,
48+
defaultValue: COMPODOC_DEFAULTS.coverageTestThresholdFail
4949
},
5050
{
5151
label: 'customFavicon',
5252
flag: '--customFavicon [path]',
53-
description: 'Use a custom favicon',
53+
description: 'Use a custom favicon'
5454
},
5555
{
5656
label: 'customLogo',
5757
flag: '--customLogo [path]',
58-
description: 'Use a custom logo',
58+
description: 'Use a custom logo'
5959
},
6060
{
6161
label: 'disableCoverage',
6262
flag: '--disableCoverage',
6363
description: 'Do not add the documentation coverage report',
64-
defaultValue: false,
64+
defaultValue: false
6565
},
6666
{
6767
label: 'disableDependencies',
6868
flag: '--disableDependencies',
6969
description: 'Do not add the dependencies list',
70-
defaultValue: COMPODOC_DEFAULTS.disableDependencies,
70+
defaultValue: COMPODOC_DEFAULTS.disableDependencies
7171
},
7272
{
7373
label: 'disableDomTree',
7474
flag: '--disableDomTree',
7575
description: 'Do not add dom tree tab',
76-
defaultValue: false,
76+
defaultValue: false
7777
},
7878
{
7979
label: 'disableGraph',
8080
flag: '--disableGraph',
8181
description: 'Do not add the dependency graph',
82-
defaultValue: false,
82+
defaultValue: false
8383
},
8484
{
8585
label: 'disableInternal',
8686
flag: '--disableInternal',
8787
description: 'Do not show @internal in generated documentation',
88-
defaultValue: false,
88+
defaultValue: false
8989
},
9090
{
9191
label: 'disableLifeCycleHooks',
9292
flag: '--disableLifeCycleHooks',
9393
description: 'Do not show Angular lifecycle hooks in generated documentation',
94-
defaultValue: false,
94+
defaultValue: false
9595
},
9696
{
9797
label: 'disablePrivate',
9898
flag: '--disablePrivate',
9999
description: 'Do not show private in generated documentation',
100-
defaultValue: false,
100+
defaultValue: false
101101
},
102102
{
103103
label: 'disableProtected',
104104
flag: '--disableProtected',
105105
description: 'Do not show protected in generated documentation',
106-
defaultValue: false,
106+
defaultValue: false
107107
},
108108
{
109109
label: 'disableRoutesGraph',
110110
flag: '--disableRoutesGraph',
111111
description: 'Do not add the routes graph',
112-
defaultValue: COMPODOC_DEFAULTS.disableRoutesGraph,
112+
defaultValue: COMPODOC_DEFAULTS.disableRoutesGraph
113113
},
114114
{
115115
label: 'disableSearch',
116116
flag: '--disableSearch',
117117
description: 'Do not add the search input',
118-
defaultValue: false,
118+
defaultValue: false
119119
},
120120
{
121121
label: 'disableSourceCode',
122122
flag: '--disableSourceCode',
123123
description: 'Do not add source code tab and links to source code',
124-
defaultValue: false,
124+
defaultValue: false
125125
},
126126
{
127127
label: 'disableStyleTab',
128128
flag: '--disableStyleTab',
129129
description: 'Do not add style tab',
130-
defaultValue: false,
130+
defaultValue: false
131131
},
132132
{
133133
label: 'disableTemplateTab',
134134
flag: '--disableTemplateTab',
135135
description: 'Do not add template tab',
136-
defaultValue: false,
136+
defaultValue: false
137137
},
138138
{
139139
label: 'exportFormat',
140140
flag: '-e, --exportFormat [format]',
141141
description: 'Export in specified format (json, html)',
142-
defaultValue: COMPODOC_DEFAULTS.exportFormat,
142+
defaultValue: COMPODOC_DEFAULTS.exportFormat
143143
},
144144
{
145145
label: 'extTheme',
146146
flag: '-y, --extTheme [file]',
147-
description: 'External styling theme file',
147+
description: 'External styling theme file'
148148
},
149149
{
150150
label: 'files',
151151
flag: '--files [files]',
152-
description: 'Files provided by external tool, used for coverage test',
152+
description: 'Files provided by external tool, used for coverage test'
153153
},
154154
{
155155
label: 'gaID',
156156
flag: '--gaID [id]',
157-
description: 'Google Analytics tracking ID',
157+
description: 'Google Analytics tracking ID'
158158
},
159159
{
160160
label: 'gaSite',
161161
flag: '--gaSite [site]',
162162
description: 'Google Analytics site name',
163-
defaultValue: COMPODOC_DEFAULTS.gaSite,
163+
defaultValue: COMPODOC_DEFAULTS.gaSite
164164
},
165165
{
166166
label: 'hideGenerator',
167167
flag: '--hideGenerator',
168168
description: 'Do not print the Compodoc link at the bottom of the page',
169-
defaultValue: false,
169+
defaultValue: false
170+
},
171+
{
172+
label: 'hideDarkModeToggle',
173+
flag: '--hideDarkModeToggle',
174+
description: 'Do not show dark mode toggle button at the top right position of the page',
175+
defaultValue: false
170176
},
171177
{
172178
label: 'host',
173179
flag: '--host [host]',
174180
description: 'Change default host address',
175-
defaultValue: COMPODOC_DEFAULTS.hostname,
181+
defaultValue: COMPODOC_DEFAULTS.hostname
176182
},
177183
{
178184
label: 'includes',
179185
flag: '--includes [path]',
180-
description: 'Path of external markdown files to include',
186+
description: 'Path of external markdown files to include'
181187
},
182188
{
183189
label: 'includesName',
184190
flag: '--includesName [name]',
185191
description: 'Name of item menu of externals markdown files',
186-
defaultValue: COMPODOC_DEFAULTS.additionalEntryName,
192+
defaultValue: COMPODOC_DEFAULTS.additionalEntryName
187193
},
188194
{
189195
label: 'language',
190196
flag: '--language [language]',
191197
description:
192198
'Language used for the generated documentation (en-US, de-DE, es-ES, fr-FR, hu-HU, it-IT, ja-JP, nl-NL, pt-BR, zh-CN)',
193-
defaultValue: COMPODOC_DEFAULTS.language,
199+
defaultValue: COMPODOC_DEFAULTS.language
194200
},
195201
{
196202
label: 'minimal',
197203
flag: '--minimal',
198204
description: 'Minimal mode with only documentation. No search, no graph, no coverage.',
199-
defaultValue: false,
205+
defaultValue: false
200206
},
201207
{
202208
label: 'name',
203209
flag: '-n, --name [name]',
204210
description: 'Title documentation',
205-
defaultValue: COMPODOC_DEFAULTS.title,
211+
defaultValue: COMPODOC_DEFAULTS.title
206212
},
207213
{
208214
label: 'navTabConfig',
@@ -213,76 +219,76 @@ export const PUBLIC_FLAGS: Flag[] = [
213219
Note: Certain tabs will only be shown if applicable to a given dependency`,
214220
defaultValue: false,
215221
parsingFunction: list,
216-
stringifyDefaultValue: true,
222+
stringifyDefaultValue: true
217223
},
218224
{
219225
label: 'open',
220226
flag: '-o, --open [value]',
221227
description: 'Open the generated documentation',
222-
defaultValue: false,
228+
defaultValue: false
223229
},
224230
{
225231
label: 'output',
226232
flag: '-d, --output [folder]',
227233
description: 'Where to store the generated documentation',
228-
defaultValue: COMPODOC_DEFAULTS.folder,
234+
defaultValue: COMPODOC_DEFAULTS.folder
229235
},
230236
{
231237
label: 'port',
232238
flag: '-r, --port [port]',
233239
description: 'Change default serving port',
234-
defaultValue: COMPODOC_DEFAULTS.port,
240+
defaultValue: COMPODOC_DEFAULTS.port
235241
},
236242
{
237243
label: 'serve',
238244
flag: '-s, --serve',
239245
description: 'Serve generated documentation (default http://localhost:8080/)',
240-
defaultValue: false,
246+
defaultValue: false
241247
},
242248
{
243249
label: 'silent',
244250
flag: '-t, --silent',
245251
description: `In silent mode, log messages aren't logged in the console`,
246-
defaultValue: false,
252+
defaultValue: false
247253
},
248254
{
249255
label: 'templates',
250256
flag: '--templates [folder]',
251-
description: 'Path to directory of Handlebars templates to override built-in templates',
257+
description: 'Path to directory of Handlebars templates to override built-in templates'
252258
},
253259
{
254260
label: 'theme',
255261
flag: '--theme [theme]',
256262
description: `Choose one of available themes, default is 'gitbook' (laravel, original, material, postmark, readthedocs, stripe, vagrant)`,
257-
defaultValue: COMPODOC_DEFAULTS.theme,
263+
defaultValue: COMPODOC_DEFAULTS.theme
258264
},
259265
{
260266
label: 'toggleMenuItems',
261267
flag: '--toggleMenuItems <items>',
262268
description: `Close by default items in the menu values : ['all'] or one of these ['modules','components','directives','controllers','classes','injectables','guards','interfaces','interceptors','pipes','miscellaneous','additionalPages']`,
263269
defaultValue: COMPODOC_DEFAULTS.toggleMenuItems,
264-
parsingFunction: list,
270+
parsingFunction: list
265271
},
266272
{
267273
label: 'tsconfig',
268274
flag: '-p, --tsconfig [config]',
269-
description: 'A tsconfig.json file',
275+
description: 'A tsconfig.json file'
270276
},
271277
{
272278
label: 'unitTestCoverage',
273279
flag: '--unitTestCoverage [json-summary]',
274-
description: 'To include unit test coverage, specify istanbul JSON coverage summary file',
280+
description: 'To include unit test coverage, specify istanbul JSON coverage summary file'
275281
},
276282
{
277283
label: 'watch',
278284
flag: '-w, --watch',
279285
description: 'Watch source files after serve and force documentation rebuild',
280-
defaultValue: false,
286+
defaultValue: false
281287
},
282288
{
283289
label: 'maxSearchResults',
284290
flag: '--maxSearchResults [number]',
285291
description: 'Max search results on the results page. To show all results, set to 0',
286-
defaultValue: 15,
287-
},
292+
defaultValue: 15
293+
}
288294
];

src/app/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class Configuration implements ConfigurationInterface {
2323
documentationMainDescription: '',
2424
base: COMPODOC_DEFAULTS.base,
2525
hideGenerator: false,
26+
hideDarkModeToggle: false,
2627
hasFilesToCoverage: false,
2728
modules: [],
2829
readme: false,

src/app/engines/pdf-engine/export-pdf.engine.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export class ExportPdfEngine {
5656
margin: [10, 350, 10, 270]
5757
});
5858

59+
Configuration.mainData.hideDarkModeToggle = true;
60+
5961
if (!Configuration.mainData.hideGenerator) {
6062
docDefinition.content.push({
6163
text: I18nEngine.translate('generated-using'),

src/app/interfaces/configuration-file.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface ConfigurationFileInterface {
1818
watch: boolean;
1919
exportFormat: string;
2020
hideGenerator: boolean;
21+
hideDarkModeToggle: boolean;
2122
coverageTest: number;
2223
coverageMinimumPerFile: number;
2324
coverageTestThresholdFail: string;

src/app/interfaces/main-data.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface MainDataInterface {
1414
documentationMainDescription: string;
1515
base: string;
1616
hideGenerator: boolean;
17+
hideDarkModeToggle: boolean;
1718
hasFilesToCoverage: boolean;
1819
modules: any;
1920
readme: boolean;

0 commit comments

Comments
 (0)