Skip to content

Commit 6141dfc

Browse files
committed
add style for documentableElement
1 parent b849736 commit 6141dfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+429
-26
lines changed

scaladoc-js/common/src/code-snippets/CodeSnippets.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import scala.util.chaining._
99

1010
import CodeSnippetsGlobals._
1111

12+
1213
class CodeSnippets:
1314
lazy val scastieConfig = getScastieConfiguration
1415

@@ -86,11 +87,14 @@ class CodeSnippets:
8687
}
8788

8889
private def copyRunButtons(snippet: html.Element) = {
90+
val copyButtonIcon = s"""<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
91+
<path d="M2.5 2.5V9.5H4V11H2C1.44772 11 1 10.5523 1 10V2C1 1.44772 1.44772 1 2 1H10C10.5523 1 11 1.44772 11 2V4H9.5V2.5H2.5Z" fill="#A09FA6"/>
92+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 6C5 5.44772 5.44772 5 6 5H14C14.5523 5 15 5.44772 15 6V14C15 14.5523 14.5523 15 14 15H6C5.44772 15 5 14.5523 5 14V6ZM6.5 13.5V6.5H13.5V13.5H6.5Z" fill="#A09FA6"/>
93+
</svg>
94+
"""
8995
def copyButton = {
9096
div(
91-
button(cls := "copy-button")(
92-
i(cls := "far fa-clone")
93-
).tap(_.addEventListener("click", _ => {
97+
button(cls := "copy-button icon-button").tap(_.addEventListener("click", _ => {
9498
val code = snippet.querySelectorAll("code>span:not(.hidden)")
9599
.map(_.textContent)
96100
.mkString
@@ -102,7 +106,6 @@ class CodeSnippets:
102106
val runButton = button(cls := "run-button")(
103107
i(cls := "fas fa-play")
104108
)
105-
106109
runButton.addEventListener("click", _ =>
107110
if !runButton.hasAttribute("opened") then {
108111
scastie.Embedded(snippet.querySelector("pre"), scastieConfig)
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

scaladoc/resources/dotty_res/scripts/ux.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ window.addEventListener("DOMContentLoaded", () => {
1313
elements[i].onclick = function (e) {
1414
if (!$(e.target).is("a") && e.fromSnippet !== true)
1515
this.classList.toggle("expand")
16+
this.querySelector(".show-content").classList.toggle("expand")
1617
}
1718
}
1819
}

scaladoc/resources/dotty_res/styles/scalastyle.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ footer .mode {
577577
transform: translateX(28px);
578578
}
579579

580-
.documentableElement .modifiers {
580+
/* .documentableElement .modifiers {
581581
display: table-cell;
582582
min-width: 10vw;
583583
max-width: 10vw;
@@ -628,7 +628,7 @@ footer .mode {
628628
.signature,
629629
.documentableElement {
630630
font-weight: 500;
631-
}
631+
} */
632632

633633
.signature.monospace {
634634
padding: 8px;
@@ -659,7 +659,7 @@ footer .mode {
659659
border-radius: 3px;
660660
}
661661

662-
.documentableElement {
662+
/* .documentableElement {
663663
color: var(--symbol-fg);
664664
white-space: normal;
665665
position: relative;
@@ -669,9 +669,9 @@ footer .mode {
669669
border-left: 0.25em solid transparent;
670670
margin: 0.5em 0;
671671
border-radius: 3px;
672-
}
672+
} */
673673

674-
.documentableElement > div {
674+
/* .documentableElement > div {
675675
display: table;
676676
}
677677
@@ -685,13 +685,13 @@ footer .mode {
685685
686686
.documentableElement.expand > div .cover {
687687
display: block;
688-
}
688+
} */
689689

690690
.doc code {
691691
padding: 0;
692692
}
693693

694-
.documentableElement:hover {
694+
/* .documentableElement:hover {
695695
cursor: pointer;
696696
border-left-color: var(--active-bg);
697697
}
@@ -729,7 +729,7 @@ footer .mode {
729729
730730
.documentableElement::before:hover .documentableAnchor:before {
731731
display: flex;
732-
}
732+
} */
733733

734734
.documentableAnchor:before {
735735
content: "\e901"; /* arrow down */
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.documentableElement {
2+
background-color: var(--action-primary-background-default-solid);
3+
padding: calc(3 * var(--base-spacing));
4+
border-radius: 4px;
5+
border: 1px solid var(--border-default);
6+
margin-bottom: calc(3 * var(--base-spacing));
7+
color: var(--code-method-highlighting-code-fg);
8+
position: relative;
9+
}
10+
11+
.documentableElement:last-child {
12+
margin-bottom: 0;
13+
}
14+
15+
.documentableElement .signature {
16+
margin-right: calc(3 * var(--base-spacing));
17+
}
18+
19+
.documentableElement:hover {
20+
cursor: pointer;
21+
}
22+
23+
.documentableElement .annotations {
24+
display: none;
25+
}
26+
27+
.documentableElement > div .cover {
28+
display: none;
29+
}
30+
31+
.documentableElement.expand > div .cover {
32+
display: block;
33+
}
34+
35+
.documentableElement.expand .annotations {
36+
display: inline-block;
37+
}
38+
39+
.documentableElement.expand .documentableBrief {
40+
display: none;
41+
}
42+
43+
.documentableElement .icon-button {
44+
position: absolute;
45+
top: calc(3 * var(--base-spacing));
46+
right: calc(3 * var(--base-spacing));
47+
display: none;
48+
}
49+
50+
.documentableElement:hover .icon-button {
51+
display: block;
52+
}
53+
54+
[t="k"] {
55+
color: var(--code-syntax-highlighting-keyword);
56+
}
57+
58+
[t="t"] {
59+
color: var(--code-method-highlighting-type);
60+
}
61+
62+
#content a[t="t"] {
63+
color: var(--code-method-highlighting-type-link);
64+
}

0 commit comments

Comments
 (0)