@qubit-ltd/jsdoc-theme 1.3.5 → 1.4.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # qubit-jsdoc-theme
2
2
 
3
- [![Stars](https://img.shields.io/github/stars/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-1.2.0-005bff) [![Issues Open](https://img.shields.io/github/issues/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/graphs/contributors) [![license](https://img.shields.io/github/license/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/blob/master/LICENSE)
3
+ [![Stars](https://img.shields.io/github/stars/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme) [![Fork](https://img.shields.io/github/forks/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/fork) ![Version](https://img.shields.io/badge/version-1.4.0-005bff) [![Issues Open](https://img.shields.io/github/issues/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/issues) [![Contributors](https://img.shields.io/github/contributors/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/graphs/contributors) [![license](https://img.shields.io/github/license/Haixing-Hu/qubit-jsdoc-theme)](https://github.com/Haixing-Hu/qubit-jsdoc-theme/blob/master/LICENSE)
4
4
  <br>
5
5
 
6
6
  **Based on [clean-jsdoc-theme](https://github.com/ankitskvmdam/clean-jsdoc-theme) v4.3.0**
@@ -13,6 +13,7 @@
13
13
  - **🆕 Intelligent Constructor Detection:** Only displays the "Constructor" section when a class has explicit constructor documentation, avoiding empty constructor sections for classes without custom constructors.
14
14
  - **🆕 Field-Level JSDoc Support:** Properties table is populated directly from `@type` annotations on individual class fields, eliminating the need for redundant `@property` tags in class-level JSDoc.
15
15
  - **🆕 Clean Member Organization:** Properties are displayed in their own dedicated section, while the "Members" section can be configured to show only methods, avoiding duplication.
16
+ - **🆕 Enhanced Mixin Support:** Automatically displays methods inherited from mixin classes when using `@mixes` JSDoc tags, providing complete documentation of mixed-in functionality with proper inheritance attribution.
16
17
  - **🆕 Internationalization (i18n):** Full support for multiple languages with comprehensive translation of all UI elements, section headings, table headers, and navigation tooltips.
17
18
  - **🆕 Homepage Navigation:** Added a "Back to Homepage" button in the top navigation bar for easy navigation between class documentation and the main documentation index.
18
19
  - **🆕 Enhanced Tooltips:** All navigation buttons include internationalized tooltips that adapt to the selected language.
@@ -705,11 +706,31 @@ Don't forget to add the following in your jsdoc config file, otherwise toc will
705
706
 
706
707
  ## Changelog
707
708
 
709
+ ### v1.4.0 (2025-01-XX)
710
+
711
+ **Enhanced Mixin Documentation Support**
712
+
713
+ #### 🔧 New Features
714
+ - **Complete Mixin Method Documentation**: Automatically displays methods inherited from mixin classes when using `@mixes` JSDoc tags
715
+ - **Proper Inheritance Attribution**: Methods from mixin classes are displayed with clear "Inherited from [MixinClass]" labels
716
+ - **Full Method Documentation**: Includes complete parameter descriptions, return values, and method documentation from mixin classes
717
+ - **Seamless Integration**: Works transparently with existing `@mixes` tags without requiring code changes
718
+
719
+ #### 🛠️ Technical Improvements
720
+ - **Enhanced Template Logic**: Updated `container.tmpl` to collect and display methods from mixed-in classes
721
+ - **Dynamic Method Collection**: Automatically searches for methods in classes specified by `@mixes` tags
722
+ - **Inheritance Flag Support**: Properly marks mixin methods as inherited for correct documentation formatting
723
+
724
+ #### 📖 Documentation Updates
725
+ - **Updated Examples**: Enhanced usage examples to demonstrate mixin documentation features
726
+ - **Feature Documentation**: Added comprehensive documentation for the new mixin method display functionality
727
+
708
728
  ### v1.2.0 (2025-01-XX)
709
729
 
710
730
  **Major Update - Internationalization & Navigation Enhancements**
711
731
 
712
732
  #### 🌍 New Features
733
+ - **Enhanced Mixin Documentation**: Automatic detection and display of methods inherited from mixin classes when using `@mixes` JSDoc tags, with proper "Inherited from" attribution
713
734
  - **Full Internationalization (i18n)**: Complete support for multiple languages with comprehensive translation system
714
735
  - **Homepage Navigation Button**: Added "Back to Homepage" button in top navigation bar for easy navigation
715
736
  - **Internationalized Tooltips**: All navigation buttons now include language-aware tooltips
package/i18n/en.json CHANGED
@@ -36,6 +36,7 @@
36
36
  "requires": "Requires",
37
37
  "interfaces": "Interfaces",
38
38
  "mixins": "Mixins",
39
+ "externals": "Externals",
39
40
  "type_definitions": "Type Definitions",
40
41
  "optional": "optional",
41
42
  "nullable": "nullable",
package/i18n/zh.json CHANGED
@@ -36,6 +36,7 @@
36
36
  "requires": "依赖",
37
37
  "interfaces": "接口",
38
38
  "mixins": "混入",
39
+ "externals": "外部",
39
40
  "type_definitions": "类型定义",
40
41
  "optional": "可选",
41
42
  "nullable": "可为空",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qubit-ltd/jsdoc-theme",
3
- "version": "1.3.5",
3
+ "version": "1.4.0",
4
4
  "description": "A customized JSDoc theme based on clean-jsdoc-theme, enhanced with properties table and constructor detection features for Qubit projects.",
5
5
  "main": "publish.js",
6
6
  "author": "Haixing Hu (starfish.hu@gmail.com)",
package/publish.js CHANGED
@@ -555,7 +555,7 @@ function buildSidebar(members) {
555
555
 
556
556
  const sections = {
557
557
  [SECTION_TYPE.Modules]: buildSidebarMembers({
558
- itemHeading: "Modules",
558
+ itemHeading: i18n.t("module", "Modules"),
559
559
  items: members.modules,
560
560
  itemsSeen: seen,
561
561
  linktoFn: linkto,
@@ -571,7 +571,7 @@ function buildSidebar(members) {
571
571
  }),
572
572
 
573
573
  [SECTION_TYPE.Externals]: buildSidebarMembers({
574
- itemHeading: "Externals",
574
+ itemHeading: i18n.t("externals", "Externals"),
575
575
  items: members.externals,
576
576
  itemsSeen: seen,
577
577
  linktoFn: linktoExternal,
@@ -579,7 +579,7 @@ function buildSidebar(members) {
579
579
  }),
580
580
 
581
581
  [SECTION_TYPE.Events]: buildSidebarMembers({
582
- itemHeading: "Events",
582
+ itemHeading: i18n.t("events", "Events"),
583
583
  items: members.events,
584
584
  itemsSeen: seen,
585
585
  linktoFn: linkto,
@@ -587,7 +587,7 @@ function buildSidebar(members) {
587
587
  }),
588
588
 
589
589
  [SECTION_TYPE.Namespaces]: buildSidebarMembers({
590
- itemHeading: "Namespaces",
590
+ itemHeading: i18n.t("namespaces", "Namespaces"),
591
591
  items: members.namespaces,
592
592
  itemsSeen: seen,
593
593
  linktoFn: linkto,
@@ -595,7 +595,7 @@ function buildSidebar(members) {
595
595
  }),
596
596
 
597
597
  [SECTION_TYPE.Mixins]: buildSidebarMembers({
598
- itemHeading: "Mixins",
598
+ itemHeading: i18n.t("mixins", "Mixins"),
599
599
  items: members.mixins,
600
600
  itemsSeen: seen,
601
601
  linktoFn: linkto,
@@ -603,7 +603,7 @@ function buildSidebar(members) {
603
603
  }),
604
604
 
605
605
  [SECTION_TYPE.Tutorials]: buildSidebarMembers({
606
- itemHeading: "Tutorials",
606
+ itemHeading: i18n.t("tutorials", "Tutorials"),
607
607
  items: members.tutorials,
608
608
  itemsSeen: seenTutorials,
609
609
  linktoFn: linktoTutorial,
@@ -611,7 +611,7 @@ function buildSidebar(members) {
611
611
  }),
612
612
 
613
613
  [SECTION_TYPE.Interfaces]: buildSidebarMembers({
614
- itemHeading: "Interfaces",
614
+ itemHeading: i18n.t("interfaces", "Interfaces"),
615
615
  items: members.interfaces,
616
616
  itemsSeen: seen,
617
617
  linktoFn: linkto,
@@ -11,11 +11,6 @@
11
11
  }
12
12
  ?>
13
13
  <?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
14
- <?js if (packageInfo && packageInfo.version) { ?>
15
- <div class="package-version-info">
16
- <p class="package-version"><?js= t('version') ?>: v<?js= packageInfo.version ?></p>
17
- </div>
18
- <?js } ?>
19
14
  <?js= self.partial('mainpage.tmpl', doc) ?>
20
15
  <?js } else if (doc.kind === 'source') { ?>
21
16
  <?js= self.partial('source.tmpl', doc) ?>
@@ -46,9 +41,6 @@
46
41
  <h1 id="<?js= module.name ?>-title" class="has-anchor">
47
42
  <?js= module.name ?>
48
43
  </h1>
49
- <?js if (module.version) { ?>
50
- <p class="module-version"><?js= t('version') ?>: v<?js= module.version ?></p>
51
- <?js } ?>
52
44
  <?js } ?>
53
45
  <?js if (module.classdesc) { ?>
54
46
  <div class="class-description"><?js= module.classdesc ?></div>
@@ -207,6 +199,24 @@
207
199
 
208
200
  <?js
209
201
  var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...shouldExcludeInherited});
202
+
203
+ // Add mixin methods if this class has @mixes tags
204
+ if (doc.mixes && doc.mixes.length) {
205
+ doc.mixes.forEach(function(mixinName) {
206
+ var mixinMethods = self.find({kind: 'function', memberof: mixinName});
207
+ if (mixinMethods && mixinMethods.length) {
208
+ // Add inherited flag and source info to mixin methods
209
+ mixinMethods.forEach(function(mixinMethod) {
210
+ mixinMethod.inherited = true;
211
+ mixinMethod.inherits = mixinName;
212
+ mixinMethod.mixinSource = mixinName;
213
+ });
214
+ // Merge mixin methods with current class methods
215
+ methods = methods.concat(mixinMethods);
216
+ }
217
+ });
218
+ }
219
+
210
220
  if (methods && methods.length && methods.forEach) {
211
221
  ?>
212
222
  <h2 id="methods" class="subsection-title has-anchor"><?js= t('methods') ?></h2>
package/tmpl/method.tmpl CHANGED
@@ -7,13 +7,19 @@ var self = this;
7
7
  // Check if this is a class with an explicit constructor
8
8
  var hasExplicitConstructor = false;
9
9
  if (data.kind === 'class') {
10
- // Only consider constructor-specific documentation, not class-level documentation
11
- hasExplicitConstructor = data.params && data.params.length > 0 ||
12
- (data.description && data.description !== data.classdesc) ||
13
- data.examples && data.examples.length > 0 ||
14
- data.see && data.see.length > 0 ||
15
- data.since;
16
- // Note: We exclude @author as it's typically class-level, not constructor-specific
10
+ // Only show constructor if:
11
+ // 1. Has constructor parameters OR
12
+ // 2. Has constructor-specific description (different from class description) OR
13
+ // 3. Has constructor-specific examples/see/since AND also has params or different description
14
+
15
+ var hasConstructorParams = data.params && data.params.length > 0;
16
+ var hasConstructorSpecificDescription = data.description &&
17
+ data.description !== data.classdesc &&
18
+ data.description.trim() !== '';
19
+
20
+ // For MixIn classes and similar patterns, avoid showing constructor
21
+ // unless there are clear constructor-specific elements
22
+ hasExplicitConstructor = hasConstructorParams || hasConstructorSpecificDescription;
17
23
  }
18
24
  ?>
19
25
  <?js if (data.kind !== 'module' && !data.hideconstructor) { ?>