Skip to content

Commit 081695a

Browse files
committed
Summary tables
1 parent 1a4f7f0 commit 081695a

File tree

17 files changed

+277
-8
lines changed

17 files changed

+277
-8
lines changed

packages/webdoc-default-template/helper/renderer-plugins/category-filter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ exports.categoryFilterPlugin = (doc /*: Doc */, constraints /*: CategoryConstrai
1515
return false;
1616
}
1717
}
18+
if (child.inherited && !child.overrides) {
19+
return;
20+
}
1821

1922
if (child.type === "MethodDoc" && child.name === "constructor") {
2023
return false;// Filter constructors always!

packages/webdoc-default-template/helper/renderer-plugins/signature.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {Doc} from "@webdoc/types";
55
const {linker} = require("../linker");
66

77
exports.signaturePlugin = {
8-
generateSignature(doc /*: Doc */) {
8+
generateSignature(doc /*: Doc */, options = {} /*: { noTail: boolean } */) {
99
const mapDocTypeToKeyboard = {
1010
ClassDoc: "class",
1111
NSDoc: "namespace",
@@ -48,7 +48,7 @@ exports.signaturePlugin = {
4848
.join(", ")
4949
})`;
5050
}
51-
if (doc.returns) {
51+
if (!options.noTail && doc.returns) {
5252
signature += ` → {${
5353
(doc.returns || [])
5454
.map((returns) => (returns.dataType ?
@@ -59,7 +59,7 @@ exports.signaturePlugin = {
5959
}
6060
break;
6161
case "PropertyDoc":
62-
if (doc.dataType) {
62+
if (!options.noTail && doc.dataType) {
6363
signature += ": " + linker.linkTo(doc.dataType, undefined, {htmlSafe: false});
6464
}
6565
break;

packages/webdoc-default-template/publish.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const path = require("path");
66
const {traverse} = require("@webdoc/model");
77
const {
88
FlushToFile,
9+
RelationsPlugin,
910
TemplateRenderer,
1011
TemplatePipeline,
1112
TemplateTagsResolver,
@@ -62,11 +63,14 @@ exports.publish = (options /*: PublishOptions */) => {
6263
.installPlugin("linker", linker)
6364
.installPlugin("generateIndex", indexSorterPlugin)
6465
.installPlugin("signature", signaturePlugin)
65-
.installPlugin("categoryFilter", categoryFilterPlugin);
66+
.installPlugin("categoryFilter", categoryFilterPlugin)
67+
.installPlugin("relations", RelationsPlugin);
6668
const pipeline = new TemplatePipeline(renderer)
6769
.pipe(new TemplateTagsResolver())
6870
.pipe(new FlushToFile({skipNullFile: false}));
6971

72+
renderer.getPlugin("relations").buildRelations();
73+
7074
idToDoc = new Map();
7175

7276
traverse(docTree, (doc) => {

packages/webdoc-default-template/src/app/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import ReactDOM from "react-dom";
66
import store from "./store";
77

88
window.onload = function() {
9+
wakeAccordions();
10+
911
const appBarRoot = document.getElementById("header-mount-point");
1012
const explorerRoot = document.getElementById("explorer-mount-point");
1113
const footerRoot = document.getElementById("footer-mount-point");
@@ -35,3 +37,16 @@ window.onload = function() {
3537
footerRoot,
3638
);
3739
};
40+
41+
function wakeAccordions() {
42+
document.querySelectorAll(".accordion").forEach(
43+
(accordion) => {
44+
const btn = accordion.querySelector(".accordion__toggle");
45+
46+
btn.onclick = () => {
47+
console.log("WTF");
48+
accordion.classList.toggle("accordion-active");
49+
};
50+
},
51+
);
52+
}

packages/webdoc-default-template/src/styles/members.scss

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@
1010
padding: 8px;
1111
}
1212

13+
&__subcategory {
14+
color: #333;
15+
font-size: 1.125em;
16+
font-weight: normal;
17+
line-height: 1.4em;
18+
margin: 14px 8px 14px 0;
19+
}
20+
1321
> hr {
14-
border: 2px solid $colorSheetSecondary
22+
border: 1px solid $colorSheetSecondary;
23+
margin-bottom: 10px;
1524
}
1625

1726
> * {
@@ -50,3 +59,57 @@
5059
margin-bottom: 8px;
5160
}
5261
}
62+
63+
.accordion {
64+
&__toggle {
65+
align-items: center;
66+
border-radius: 8px;
67+
display: flex;
68+
transition-duration: 200ms;
69+
70+
button {
71+
background: transparent;
72+
border: none;
73+
height: 40px;
74+
padding: 0;
75+
width: 40px;
76+
77+
.accordion__bg-active {
78+
display: none;
79+
}
80+
81+
&:focus {
82+
outline: none;
83+
}
84+
}
85+
86+
&:hover {
87+
background-color: rgba(0, 0, 0, 0.04);
88+
}
89+
}
90+
91+
&__content {
92+
max-height: 0;
93+
overflow: hidden;
94+
visibility: hidden;
95+
}
96+
}
97+
98+
.accordion-active {
99+
> .accordion__content {
100+
max-height: max-content;
101+
visibility: visible;
102+
}
103+
104+
.accordion__toggle {
105+
button {
106+
.accordion__bg-inactive {
107+
display: none;
108+
}
109+
110+
.accordion__bg-active {
111+
display: inline;
112+
}
113+
}
114+
}
115+
}

packages/webdoc-default-template/src/styles/tables.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,40 @@ table {
4343
display: block;
4444
overflow-x: scroll;
4545
}
46+
47+
table.summary {
48+
margin-left: 40px;
49+
padding: 18px auto;
50+
table-layout: fixed;
51+
width: calc(100% - 40px);
52+
53+
tbody {
54+
margin: 18px auto;
55+
}
56+
57+
td {
58+
vertical-align: top;
59+
60+
section:last-child {
61+
color: #333;
62+
margin-top: 18px;
63+
}
64+
}
65+
66+
td:first-child {
67+
width: 36%;
68+
}
69+
70+
td:last-child {
71+
width: 64%;
72+
}
73+
74+
.summary__signature {
75+
font-family: IBM Plex Mono, monospace;
76+
font-weight: bold;
77+
78+
a {
79+
text-decoration: underline;
80+
}
81+
}
82+
}
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9545,6 +9545,7 @@ function Footer() {
95459545

95469546

95479547
window.onload = function () {
9548+
wakeAccordions();
95489549
var appBarRoot = document.getElementById("header-mount-point");
95499550
var explorerRoot = document.getElementById("explorer-mount-point");
95509551
var footerRoot = document.getElementById("footer-mount-point");
@@ -9557,6 +9558,17 @@ window.onload = function () {
95579558
external_ReactDOM_default.a.render(React.createElement(components_Footer, null), footerRoot);
95589559
};
95599560

9561+
function wakeAccordions() {
9562+
document.querySelectorAll(".accordion").forEach(function (accordion) {
9563+
var btn = accordion.querySelector(".accordion__toggle");
9564+
9565+
btn.onclick = function () {
9566+
console.log("WTF");
9567+
accordion.classList.toggle("accordion-active");
9568+
};
9569+
});
9570+
}
9571+
95609572
/***/ }),
95619573
/* 68 */,
95629574
/* 69 */,

packages/webdoc-default-template/static/styles/index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)