@qubit-ltd/jsdoc-theme 1.3.6 → 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 +22 -1
- package/i18n/en.json +1 -0
- package/i18n/zh.json +1 -0
- package/package.json +1 -1
- package/publish.js +7 -7
- package/tmpl/container.tmpl +18 -0
- package/tmpl/method.tmpl +13 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# qubit-jsdoc-theme
|
|
2
2
|
|
|
3
|
-
[](https://github.com/Haixing-Hu/qubit-jsdoc-theme) [](https://github.com/Haixing-Hu/qubit-jsdoc-theme/fork) ](https://github.com/Haixing-Hu/qubit-jsdoc-theme) [](https://github.com/Haixing-Hu/qubit-jsdoc-theme/fork)  [](https://github.com/Haixing-Hu/qubit-jsdoc-theme/issues) [](https://github.com/Haixing-Hu/qubit-jsdoc-theme/graphs/contributors) [](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
package/i18n/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qubit-ltd/jsdoc-theme",
|
|
3
|
-
"version": "1.
|
|
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,
|
package/tmpl/container.tmpl
CHANGED
|
@@ -199,6 +199,24 @@
|
|
|
199
199
|
|
|
200
200
|
<?js
|
|
201
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
|
+
|
|
202
220
|
if (methods && methods.length && methods.forEach) {
|
|
203
221
|
?>
|
|
204
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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) { ?>
|