clean-jsdoc-theme 4.2.10 → 4.2.12

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # clean-jsdoc-theme
2
2
 
3
- [![Stars](https://img.shields.io/github/stars/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-4.2.10-005bff) [![Issues Open](https://img.shields.io/github/issues/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [![Build Status](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme.svg?branch=production)](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
3
+ [![Stars](https://img.shields.io/github/stars/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-4.2.12-005bff) [![Issues Open](https://img.shields.io/github/issues/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [![Build Status](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme.svg?branch=production)](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [![license](https://img.shields.io/github/license/ankitskvmdam/clean-jsdoc-theme)](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
4
4
  <br>
5
5
 
6
6
  `clean-jsdoc-theme` is a beautifully crafted theme for JSDoc 3/JSDoc 4. It is a clean and fully responsive theme with loads of
@@ -316,6 +316,41 @@ only loaded if user wants to search anything.
316
316
  `options` can be any valid CodePen option. For more
317
317
  visit: [Codepen Prefill options](https://blog.codepen.io/documentation/prefill/#all-the-json-options-0)
318
318
 
319
+ If you want to add some js in the beginning of your example then you can use `js` option.
320
+
321
+ ```json
322
+ "theme_opts": {
323
+ "codepen": {
324
+ "enable_for": ["examples"],
325
+ "options": {
326
+ "js_external": "https://code.jquery.com/jquery-3.6.0.min.js",
327
+ "js_pre_processor": "babel"
328
+ "js": "import Something from 'some-package'"
329
+ }
330
+ }
331
+ }
332
+ ```
333
+
334
+ Let say you have an example as follows:
335
+
336
+ ```js
337
+ /**
338
+ * @example
339
+ * let a = Something.fn()
340
+ * console.log(a) // Return value of something
341
+ */
342
+ const a;
343
+ ```
344
+
345
+ In codepen the above `@example` will look like:
346
+
347
+ ```js
348
+ import Something from 'some-package';
349
+
350
+ let a = Something.fn();
351
+ console.log(a); // Return value of something
352
+ ```
353
+
319
354
  ### Add static dir
320
355
 
321
356
  To include static files:
@@ -341,7 +376,7 @@ To create custom style rules. Example:
341
376
  Use this option to add third party css library. If you want to add your own custom css file then consider
342
377
  using [Add custom css files](#add-custom-css-files)
343
378
 
344
- > Note: you have to pass an array of objects. Each object key will be an attribute inside the generated script tag.
379
+ > Note: you have to pass an array of objects. Each object key will be an attribute inside the generated style tag.
345
380
 
346
381
  Example:
347
382
 
@@ -372,14 +407,16 @@ file.
372
407
 
373
408
  ### Add scripts
374
409
 
375
- To create custom scripts. Example:
410
+ If you wish to incorporate JavaScript functions that execute when a user accesses a webpage, you can utilize the add_scripts option for this purpose. For instance, suppose you want to display a notification dialog when a user visits the webpage located at https://place-where-my-docs-are/SomeClass.html. You want to notify users that they should refrain from utilizing this class. To accomplish this, you can proceed as follows:
376
411
 
377
412
  ```json
378
413
  "theme_opts": {
379
- "add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')}"
414
+ "add_scripts": "function showAlert(){ if (window.location.pathname === '/SomeClass.html') { alert('Do not use this class') } } showAlert();",
380
415
  }
381
416
  ```
382
417
 
418
+ Writing js code like above can get tricky and complex. You can consider `include_js`.
419
+
383
420
  ### Add script paths
384
421
 
385
422
  Use this option to add third party js library. If you want to add your own custom script file then consider
@@ -408,11 +445,33 @@ This will not flatten the directory. Directory structure will be kept as it is.
408
445
 
409
446
  ### Add custom script files
410
447
 
411
- To include js files. Example:
448
+ If you wish to run some local/custom javascript then you can include them via `include_js`.
449
+
450
+ Lets say you want to show some custom message depending on url. You can create a js file as follows:
451
+
452
+ ```js
453
+ // static/showAlert.js
454
+ function showCustomAlertMessage() {
455
+ const pathname = window.location.pathname;
456
+
457
+ switch (pathname) {
458
+ case '/SomeClass.html':
459
+ return alert("Please don't use this class");
460
+ case '/OtherPage.html':
461
+ return alert('Wonderful!');
462
+ default:
463
+ return;
464
+ }
465
+ }
466
+
467
+ showCustomAlert();
468
+ ```
469
+
470
+ Assuming the above js file is stored in `./static/showAlert.js`. To include you can do:
412
471
 
413
472
  ```json
414
473
  "theme_opts": {
415
- "include_js": ["./static/index.js", "./src/docs/index.js"]
474
+ "include_js": ["./static/showAlert.js"]
416
475
  }
417
476
  ```
418
477
 
package/jsdoc-config.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "allowUnknownTags": true
4
4
  },
5
5
  "source": {
6
- "include": ["./demo/src", "./README.md"]
6
+ "include": ["./demo/src", "./README.md", "package.json"]
7
7
  },
8
8
  "plugins": ["plugins/markdown"],
9
9
  "opts": {
@@ -17,6 +17,7 @@
17
17
  "search": true,
18
18
  "homepageTitle": "Clean JSDoc Theme",
19
19
  "default_theme": "dark",
20
+ "exclude_inherited": false,
20
21
  "include_css": ["./demo/src/assets/style.css"],
21
22
  "include_js": ["./demo/src/assets/script.js"],
22
23
  "static_dir": ["./demo/src/assets/png", "./example"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clean-jsdoc-theme",
3
- "version": "4.2.10",
3
+ "version": "4.2.12",
4
4
  "description": "A beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template. This is a fully mobile responsive theme and also fully customizable theme.",
5
5
  "main": "publish.js",
6
6
  "scripts": {
package/publish.js CHANGED
@@ -894,8 +894,8 @@ exports.publish = async function (taffyData, opts, tutorials) {
894
894
  view.navbar = buildNavbar(themeOpts);
895
895
  view.resizeable = resizeable(themeOpts);
896
896
  view.codepen = codepen(themeOpts);
897
- view.baseURL = getBaseURL(themeOpts);
898
897
  view.excludeInherited = Boolean(themeOpts.exclude_inherited);
898
+ view.baseURL = getBaseURL(themeOpts);
899
899
  attachModuleSymbols(
900
900
  find({ longname: { left: 'module:' } }),
901
901
  members.modules
@@ -91,7 +91,7 @@
91
91
  <?js } ?>
92
92
 
93
93
  <?js
94
- var classes = self.find({kind: 'class', memberof: doc.longname});
94
+ var classes = self.find({kind: 'class', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
95
95
  if (!isGlobalPage && classes && classes.length) {
96
96
  ?>
97
97
  <h2 id="classes" class="subsection-title has-anchor">Classes</h2>
@@ -103,7 +103,7 @@
103
103
  <?js } ?>
104
104
 
105
105
  <?js
106
- var interfaces = self.find({kind: 'interface', memberof: doc.longname});
106
+ var interfaces = self.find({kind: 'interface', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
107
107
  if (!isGlobalPage && interfaces && interfaces.length) {
108
108
  ?>
109
109
  <h2 id="interfaces" class="subsection-title has-anchor">Interfaces</h2>
@@ -115,7 +115,7 @@
115
115
  <?js } ?>
116
116
 
117
117
  <?js
118
- var mixins = self.find({kind: 'mixin', memberof: doc.longname});
118
+ var mixins = self.find({kind: 'mixin', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
119
119
  if (!isGlobalPage && mixins && mixins.length) {
120
120
  ?>
121
121
  <h2 id="mixins" class="subsection-title has-anchor">Mixins</h2>
@@ -127,7 +127,7 @@
127
127
  <?js } ?>
128
128
 
129
129
  <?js
130
- var namespaces = self.find({kind: 'namespace', memberof: doc.longname});
130
+ var namespaces = self.find({kind: 'namespace', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
131
131
  if (!isGlobalPage && namespaces && namespaces.length) {
132
132
  ?>
133
133
  <h2 id="namespaces" class="subsection-title has-anchor">Namespaces</h2>
@@ -139,7 +139,7 @@
139
139
  <?js } ?>
140
140
 
141
141
  <?js
142
- var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
142
+ var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
143
143
 
144
144
  // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
145
145
  if (isGlobalPage && members && members.length && members.forEach) {
@@ -157,7 +157,7 @@
157
157
  <?js } ?>
158
158
 
159
159
  <?js
160
- var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
160
+ var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
161
161
  if (methods && methods.length && methods.forEach) {
162
162
  ?>
163
163
  <h2 id="methods" class="subsection-title has-anchor">Methods</h2>
@@ -168,7 +168,7 @@
168
168
  <?js } ?>
169
169
 
170
170
  <?js
171
- var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
171
+ var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
172
172
  if (typedefs && typedefs.length && typedefs.forEach) {
173
173
  ?>
174
174
  <h2 id="type-definitions" class="subsection-title has-anchor">Type Definitions</h2>
@@ -188,7 +188,7 @@
188
188
  <?js } ?>
189
189
 
190
190
  <?js
191
- var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
191
+ var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
192
192
  if (events && events.length && events.forEach) {
193
193
  ?>
194
194
  <h2 id="events" class="subsection-title has-anchor">Events</h2>
@@ -6,9 +6,6 @@
6
6
 
7
7
  data.forEach(function(example) {
8
8
 
9
- var jsonString = JSON.stringify(example.code)
10
- .replace(/"/g, "&quot;")
11
- .replace(/'/g, "&apos;");
12
9
  if (example.caption) {
13
10
  ?>
14
11
  <p class="code-caption"><?js= example.caption ?></p>
@@ -20,13 +17,23 @@
20
17
  if(enable_for.findIndex(function (val) { return val === "examples"}) !== -1) {
21
18
  var options = codepen.options || {};
22
19
  var optionsString = '';
23
- var optionsKey = Object.keys(options)
20
+
21
+ var code = `${options.js}
22
+ ${example.code}
23
+ `
24
+
25
+ var jsonString = JSON.stringify(code)
26
+ .replace(/"/g, "&quot;")
27
+ .replace(/'/g, "&apos;");
28
+
29
+ var optionsKey = Object.keys(options).filter((key) => key !== 'js' )
24
30
  optionsKey.map((key, idx) => {
25
31
  optionsString += '"' + key +'": "' + options[key].replace(/"/g, "&quot;").replace(/'/g, "&apos;") + '"';
26
32
  if(idx !== optionsKey.length - 1) {
27
33
  optionsString += ','
28
34
  }
29
35
  })
36
+
30
37
  ?>
31
38
  <form action="https://codepen.io/pen/define" method="POST" target="_blank" class="codepen-form">
32
39
  <input type="hidden" name="data" value='{"title": "<?js= example.caption || 'Example' ?>", "js": <?js= jsonString ?>, <?js= optionsString ?> }' />
package/tmpl/method.tmpl CHANGED
@@ -49,7 +49,7 @@ var self = this;
49
49
  </div>
50
50
  <?js } ?>
51
51
 
52
- <?js if (data.params && params.length) { ?>
52
+ <?js if (data.params && params.length && !data.hideconstructor) { ?>
53
53
  <div class="method-member-container flex flex-col w-100 overflow-auto mt-20">
54
54
  <strong>Parameters:</strong>
55
55
  <?js= this.partial('params.tmpl', params) ?>