File tree Expand file tree Collapse file tree 4 files changed +69
-4
lines changed
src/dotty/tools/scaladoc/renderers Expand file tree Collapse file tree 4 files changed +69
-4
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,23 @@ window.addEventListener("DOMContentLoaded", () => {
54
54
el . parent . addClass ( "expanded" )
55
55
} ) )
56
56
57
+ document . querySelectorAll ( ".supertypes" ) . forEach ( el => el . firstChild . addEventListener ( 'click' , ( ) => {
58
+ el . classList . toggle ( "collapsed" ) ;
59
+ el . firstChild . classList . toggle ( "expand" ) ;
60
+ } ) )
61
+
62
+
63
+ document . querySelectorAll ( ".subtypes" ) . forEach ( el => el . firstChild . addEventListener ( 'click' , ( ) => {
64
+ el . classList . toggle ( "collapsed" ) ;
65
+ el . firstChild . classList . toggle ( "expand" ) ;
66
+ } ) )
67
+
68
+ document . querySelectorAll ( ".nh" ) . forEach ( el => el . addEventListener ( 'click' , ( ) => {
69
+ el . lastChild . click ( )
70
+ el . first . addClass ( "expanded" )
71
+ el . parent . addClass ( "expanded" )
72
+ } ) )
73
+
57
74
const observer = new IntersectionObserver ( entries => {
58
75
entries . forEach ( entry => {
59
76
const id = entry . target . getAttribute ( 'id' ) ;
Original file line number Diff line number Diff line change 3
3
padding : calc (3 * var (--base-spacing ));
4
4
padding-bottom : calc (1.5 * var (--base-spacing ));
5
5
overflow-x : scroll;
6
+ position : relative;
7
+ }
8
+
9
+ .subtypes > span {
10
+ position : absolute;
11
+ top : calc (1 * var (--base-spacing ));
12
+ right : calc (1 * var (--base-spacing ));
13
+ }
14
+
15
+ .subtypes > div {
16
+ display : none;
17
+ }
18
+
19
+ .subtypes > div : nth-child (2 ),
20
+ .subtypes > div : nth-child (3 ),
21
+ .subtypes > div : nth-child (4 ),
22
+ .subtypes > div : nth-child (5 ),
23
+ .subtypes > div : nth-child (6 ) {
24
+ display : block;
25
+ }
26
+
27
+ .subtypes .collapsed > div {
28
+ display : block;
6
29
}
Original file line number Diff line number Diff line change 3
3
padding : calc (3 * var (--base-spacing ));
4
4
padding-bottom : calc (1.5 * var (--base-spacing ));
5
5
overflow-x : scroll;
6
+ position : relative;
7
+ }
8
+
9
+ .supertypes > span {
10
+ position : absolute;
11
+ top : calc (1 * var (--base-spacing ));
12
+ right : calc (1 * var (--base-spacing ));
13
+ }
14
+
15
+ .supertypes > div {
16
+ display : none;
17
+ }
18
+
19
+ .supertypes > div : nth-child (2 ),
20
+ .supertypes > div : nth-child (3 ),
21
+ .supertypes > div : nth-child (4 ),
22
+ .supertypes > div : nth-child (5 ),
23
+ .supertypes > div : nth-child (6 ) {
24
+ display : block;
25
+ }
26
+
27
+ .supertypes .collapsed > div {
28
+ display : block;
6
29
}
Original file line number Diff line number Diff line change @@ -365,9 +365,11 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
365
365
))
366
366
case _ => Nil
367
367
368
- def signatureList (list : Seq [LinkToType ], className : String = " " ): Seq [AppliedTag ] =
368
+ def signatureList (list : Seq [LinkToType ], className : String = " " , expandable : Boolean ): Seq [AppliedTag ] =
369
369
if list.isEmpty then Nil
370
- else Seq (div(cls := s " mono-small-inline $className" )(list.map(link =>
370
+ else Seq (div(cls := s " mono-small-inline $className" )(
371
+ if (expandable) then span(cls := " icon-button show-content" ) else span(),
372
+ list.map(link =>
371
373
div(link.kind.name," " , link.signature.map(renderElement(_)))
372
374
)))
373
375
@@ -377,8 +379,8 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
377
379
div(link.signature.map(renderElement(_)))
378
380
}})
379
381
380
- val supertypes = signatureList(m.parents, " supertypes" )
381
- val subtypes = signatureList(m.knownChildren, " subtypes" )
382
+ val supertypes = signatureList(m.parents, " supertypes" , m.parents.length > 5 )
383
+ val subtypes = signatureList(m.knownChildren, " subtypes" , m.knownChildren.length > 5 )
382
384
val selfType = selfTypeList(m.selfType.toList)
383
385
384
386
Seq (
You can’t perform that action at this time.
0 commit comments