Skip to content

Commit 7c1a615

Browse files
authored
Merge pull request #115 from webdoc-labs/feature/es5-class
Feature: Proper ES5 class support with inference
2 parents 3450c47 + 6e3f144 commit 7c1a615

File tree

16 files changed

+338
-72
lines changed

16 files changed

+338
-72
lines changed

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/example.api.json

Lines changed: 101 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@
2828
"type": "ClassDoc",
2929
"scope": "static",
3030
"brief": "",
31-
"description": ""
31+
"description": "",
32+
"members": [
33+
{
34+
"name": "constructor",
35+
"type": "MethodDoc",
36+
"access": "public",
37+
"scope": "instance",
38+
"brief": "",
39+
"description": ""
40+
}
41+
]
3242
},
3343
{
3444
"name": "AbstractRenderer",
@@ -42,6 +52,14 @@
4252
"scope": "instance",
4353
"brief": "<p>The background color to fill if not transparent</p>",
4454
"description": ""
55+
},
56+
{
57+
"name": "constructor",
58+
"type": "MethodDoc",
59+
"access": "public",
60+
"scope": "instance",
61+
"brief": "",
62+
"description": ""
4563
}
4664
]
4765
},
@@ -475,13 +493,17 @@
475493
"name": "Road",
476494
"type": "ClassDoc",
477495
"brief": "<p>This is another road class.</p>",
478-
"description": ""
479-
},
480-
{
481-
"name": "Road",
482-
"type": "ClassDoc",
483-
"brief": "<p>Road represents a drivable 2D path for vehicles.</p>",
484-
"description": ""
496+
"description": "",
497+
"members": [
498+
{
499+
"name": "constructor",
500+
"type": "MethodDoc",
501+
"access": "public",
502+
"scope": "instance",
503+
"brief": "<p>This is another road class.</p>",
504+
"description": ""
505+
}
506+
]
485507
},
486508
{
487509
"name": "DEFAULT_LANES",
@@ -509,7 +531,17 @@
509531
"name": "Transaction",
510532
"type": "ClassDoc",
511533
"brief": "",
512-
"description": ""
534+
"description": "",
535+
"members": [
536+
{
537+
"name": "constructor",
538+
"type": "MethodDoc",
539+
"access": "public",
540+
"scope": "instance",
541+
"brief": "",
542+
"description": ""
543+
}
544+
]
513545
}
514546
]
515547
},
@@ -519,6 +551,14 @@
519551
"brief": "<p>Bean class</p>",
520552
"description": "",
521553
"members": [
554+
{
555+
"name": "constructor",
556+
"type": "MethodDoc",
557+
"access": "public",
558+
"scope": "instance",
559+
"brief": "<p>Bean class</p>",
560+
"description": ""
561+
},
522562
{
523563
"name": "roast",
524564
"type": "MethodDoc",
@@ -590,6 +630,14 @@
590630
"brief": "<p>Register a retail dealer for buying a car from</p>",
591631
"description": ""
592632
},
633+
{
634+
"name": "constructor",
635+
"type": "MethodDoc",
636+
"access": "public",
637+
"scope": "instance",
638+
"brief": "<p><em>Simulation</em> for a automobile that can drive on a manifold surface.</p>",
639+
"description": ""
640+
},
593641
{
594642
"name": "onCrash",
595643
"type": "MethodDoc",
@@ -635,12 +683,56 @@
635683
}
636684
]
637685
},
686+
{
687+
"name": "ExampleFactory",
688+
"type": "ClassDoc",
689+
"description": "<p>{@link ExampleFactory} can be used to build examples.</p>\n<pre><code class=\"hljs language-js\"><span class=\"hljs-comment\">// <span class=\"hljs-doctag\">TODO:</span> Make the API interesting</span>\nExampleFactory.getInstance()\n .build()\n</code></pre>",
690+
"members": [
691+
{
692+
"name": "getInstance",
693+
"type": "MethodDoc",
694+
"scope": "static",
695+
"brief": "<p>Gets a lazily-initialized, shared singleton instance of {@link ExampleFactory}.</p>",
696+
"description": ""
697+
},
698+
{
699+
"name": "build",
700+
"type": "MethodDoc",
701+
"scope": "instance",
702+
"brief": "<p>Build the road.</p>",
703+
"description": ""
704+
},
705+
{
706+
"name": "constructor",
707+
"type": "MethodDoc",
708+
"access": "public",
709+
"scope": "instance",
710+
"brief": "<p>This constructor should only be used for custom contexts.</p>",
711+
"description": ""
712+
},
713+
{
714+
"name": "getContext",
715+
"type": "MethodDoc",
716+
"scope": "instance",
717+
"brief": "<p>Get the context of this factory.</p>",
718+
"description": ""
719+
}
720+
]
721+
},
638722
{
639723
"name": "Gravity",
640724
"type": "ClassDoc",
641725
"brief": "<p>This class shouldn't be documented!</p>",
642726
"description": "",
643727
"members": [
728+
{
729+
"name": "constructor",
730+
"type": "MethodDoc",
731+
"access": "public",
732+
"scope": "instance",
733+
"brief": "<p>This class shouldn't be documented!</p>",
734+
"description": ""
735+
},
644736
{
645737
"name": "force",
646738
"type": "MethodDoc",

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"scripts": {
2525
"unit-test": "",
26-
"build": "webdoc --tutorials ./tutorials --site-root example-documentation --site-domain https://webdoc-labs.github.io",
26+
"build": "webdoc --tutorials ./tutorials --site-domain https://webdoc-labs.github.io",
2727
"build-next": "cd .. && webdoc && cd example",
2828
"build-pixi-api": "cd ../../pixi-api && webdoc && cd ../webdoc/example",
2929
"build-pixi-api-prod": "cd ../../pixi-api && webdoc --site-root pixi-api && cd ../webdoc/example",

example/src/ExampleFactory.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* A namespace dedicated to road manipulation utilites.
3+
*
4+
* @namespace
5+
*/
6+
const R = {
7+
/**
8+
* Builds a road
9+
*
10+
* @param {string} address
11+
* @return {ExampleFactory}
12+
*/
13+
buildRoad(address) {
14+
return null;
15+
},
16+
17+
/**
18+
* The default no. of lanes per one side of road
19+
*/
20+
DEFAULT_LANES: 4,
21+
};
22+
23+
/**
24+
* This constructor should only be used for custom contexts.
25+
*
26+
* @classdesc
27+
* {@link ExampleFactory} can be used to build examples.
28+
*
29+
* ```js
30+
* // TODO: Make the API interesting
31+
* ExampleFactory.getInstance()
32+
* .build()
33+
* ```
34+
*
35+
* @param {ExampleContext}[context=null] - A custom context for the factory.
36+
* @class
37+
*/
38+
export function ExampleFactory(context= null) {
39+
40+
}
41+
42+
/**
43+
* Get the context of this factory.
44+
*
45+
* @return {ExampleContext}
46+
*/
47+
ExampleFactory.prototype.getContext = function() {
48+
return null;
49+
}
50+
51+
/**
52+
* Build the road.
53+
*/
54+
ExampleFactory.prototype.build = function() {
55+
56+
}
57+
58+
/**
59+
* Gets a lazily-initialized, shared singleton instance of {@link ExampleFactory}.
60+
*
61+
* @returns {ExampleFactory}
62+
*/
63+
ExampleFactory.getInstance = function () {
64+
if (!ExampleFactory.__instance) {
65+
ExampleFactory.__instance = new ExampleFactory();
66+
}
67+
68+
return ExampleFactory.__instance;
69+
}

example/src/Road.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/webdoc-default-template/static/scripts/default-template.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9466,7 +9466,6 @@ function makeIds(data, collector) {
94669466
};
94679467
})(function Explorer(_ref2) {
94689468
var isOpen = _ref2.isOpen,
9469-
setOpen = _ref2.setOpen,
94709469
expandedItems = _ref2.expandedItems,
94719470
setExpandedItems = _ref2.setExpandedItems,
94729471
toggleItem = _ref2.toggleItem,
@@ -9485,9 +9484,6 @@ function makeIds(data, collector) {
94859484
var _useExplorerStyles = useExplorerStyles(),
94869485
root = _useExplorerStyles.root;
94879486

9488-
var toggleOpen = external_React_default.a.useCallback(function () {
9489-
return setOpen(!isOpen);
9490-
}, [isOpen]);
94919487
var children = [];
94929488
var explorerTree = window.appData.explorerTree;
94939489

0 commit comments

Comments
 (0)