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", () => {
5454 el . parent . addClass ( "expanded" )
5555 } ) )
5656
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+
5774 const observer = new IntersectionObserver ( entries => {
5875 entries . forEach ( entry => {
5976 const id = entry . target . getAttribute ( 'id' ) ;
Original file line number Diff line number Diff line change 33 padding : calc (3 * var (--base-spacing ));
44 padding-bottom : calc (1.5 * var (--base-spacing ));
55 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;
629}
Original file line number Diff line number Diff line change 33 padding : calc (3 * var (--base-spacing ));
44 padding-bottom : calc (1.5 * var (--base-spacing ));
55 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;
629}
Original file line number Diff line number Diff line change @@ -365,9 +365,11 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
365365 ))
366366 case _ => Nil
367367
368- def signatureList (list : Seq [LinkToType ], className : String = " " ): Seq [AppliedTag ] =
368+ def signatureList (list : Seq [LinkToType ], className : String = " " , expandable : Boolean ): Seq [AppliedTag ] =
369369 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 =>
371373 div(link.kind.name," " , link.signature.map(renderElement(_)))
372374 )))
373375
@@ -377,8 +379,8 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
377379 div(link.signature.map(renderElement(_)))
378380 }})
379381
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 )
382384 val selfType = selfTypeList(m.selfType.toList)
383385
384386 Seq (
You can’t perform that action at this time.
0 commit comments