Skip to content

Commit cf4dd05

Browse files
authored
Merge pull request #15697 from pikinier20/scaladoc/new-ui
Scaladoc: New UI design
2 parents 36f0e09 + 4e9f2de commit cf4dd05

File tree

373 files changed

+8193
-3217
lines changed

Some content is hidden

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

373 files changed

+8193
-3217
lines changed

docs/_assets/css/bootstrap.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/_assets/css/color-brewer.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Ported by Fabrício Tavares de Oliveira
66
77
*/
88

9-
.hljs {
9+
/* .hljs {
1010
background: transparent;
1111
}
1212
1313
.hljs,
1414
.hljs-subst {
1515
color: #000;
16-
}
16+
} */
1717

1818
/*.hljs-string,
1919
.hljs-meta,
@@ -24,7 +24,7 @@ Ported by Fabrício Tavares de Oliveira
2424
color: #756bb1;
2525
}*/
2626

27-
.hljs-comment,
27+
/* .hljs-comment,
2828
.hljs-quote {
2929
color: #636363;
3030
}
@@ -40,7 +40,7 @@ Ported by Fabrício Tavares de Oliveira
4040
.hljs-deletion,
4141
.hljs-variable {
4242
color: #88f;
43-
}
43+
} */
4444

4545
/*.hljs-keyword,
4646
.hljs-selector-tag,
@@ -57,10 +57,10 @@ Ported by Fabrício Tavares de Oliveira
5757
color: #3182bd;
5858
}*/
5959

60-
.hljs-emphasis {
60+
/* .hljs-emphasis {
6161
font-style: italic;
6262
}
6363
6464
.hljs-attribute {
6565
color: #e6550d;
66-
}
66+
} */

docs/_assets/images/logo.svg

Lines changed: 5 additions & 15 deletions
Loading

docs/_assets/images/logo_dark.svg

Lines changed: 6 additions & 0 deletions
Loading

docs/_assets/js/bootstrap.min.js

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

docs/_assets/js/highlight.pack.js

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

docs/_assets/js/jquery.min.js

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

docs/_layouts/base.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
---
22
extraCSS:
3-
- css/bootstrap.min.css
4-
- css/dottydoc.css
53
- css/color-brewer.css
6-
extraJS:
7-
- js/jquery.min.js
8-
- js/bootstrap.min.js
94
---
105
<link rel="dns-prefetch" href="//fonts.googleapis.com">
116
<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>
127
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
138

14-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css">
15-
16-
179
{{ content }}

docs/_layouts/doc-page.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
---
22
layout: static-site-main
33
---
4+
45
<main>
56
<header>
6-
<h1>{{ page.title }}</h1>
77
{% if urls.editSource %}
8-
<div class="byline">
9-
<a href="{{ urls.editSource }}">
10-
<i class="far fa-edit"></i>
11-
Edit this page on GitHub
12-
</a>
13-
</div>
8+
<a class="text-button with-link body-small" href="{{ urls.editSource }}">
9+
Edit this page on GitHub
10+
</a>
1411
{% endif %}
12+
<h1 class="h600">{{ page.title }}</h1>
1513
</header>
1614
{{ content }}
1715
</main>
18-

docs/_layouts/main.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
extraCSS:
66
- css/content-contributors.css
77
---
8-
<div id="content-wrapper">
9-
{{ content }}
10-
</div>
8+
9+
<div id="content-wrapper">{{ content }}</div>

docs/_layouts/static-site-main.html

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
11
---
22
layout: main
33
---
4-
<div class="container">
5-
<div id="site-header">
6-
<div class="wrap">
7-
<nav class="navigation" role="menu">
8-
<ul class="navigation-menu">
9-
<li class="navigation-menu-item">
10-
<a href="https://docs.scala-lang.org/" class="active">Learn</a>
11-
</li>
12-
<li class="navigation-menu-item">
13-
<a href="https://www.scala-lang.org/download/">Install</a>
14-
</li>
15-
<li class="navigation-menu-item">
16-
<a href="https://scastie.scala-lang.org">Playground</a>
17-
</li>
18-
<li class="navigation-menu-item">
19-
<a href="https://index.scala-lang.org">Find A Library</a>
20-
</li>
21-
<li class="navigation-menu-item">
22-
<a href="https://www.scala-lang.org/community/">Community</a>
23-
</li>
24-
<li class="navigation-menu-item">
25-
<a href="https://www.scala-lang.org/blog/">Blog</a>
26-
</li>
27-
</ul>
28-
</nav>
29-
</div>
30-
</div>
31-
{% if page.nightlyOf %}
4+
5+
<div class="site-container">
6+
<div id="site-header"></div>
7+
{% if page.movedTo %}
328
<aside class="warning">
33-
This is a nightly documentation. The content of this page may not be consistent with the current stable version of language.
34-
Click <a href="{{ page.nightlyOf }}">here</a> to find the stable version of this page.
9+
This is a nightly documentation. The content of this page may not be
10+
consistent with the current stable version of language. Click
11+
<a href="{{ page.nightlyOf }}">here</a> to find the stable version of this
12+
page.
3513
</aside>
36-
{% endif %}
37-
{{ content }}
38-
<nav class="arrows-wrapper" aria-label="Page navigation">
14+
{% endif %} {{ content }}
15+
<div class="divider" />
16+
<nav class="arrow-navigation" aria-label="Page navigation">
3917
{% if page.previous %}
40-
<a rel="prev" href="{{ page.previous.url }}" class="arrows previous" aria-keyshortcuts="Left">
41-
<span>{{ page.previous.title }}</span>
42-
<i class="fa fa-angle-left"></i>
43-
</a>
44-
{% endif %}
45-
{% if page.next %}
46-
<a rel="next" href="{{ page.next.url }}" class="arrows next" aria-keyshortcuts="Right">
47-
<span>{{ page.next.title }}</span>
48-
<i class="fa fa-angle-right"></i>
49-
</a>
18+
<div>
19+
<span class="body-small">Previous</span>
20+
<a
21+
rel="prev"
22+
href="{{ page.previous.url }}"
23+
aria-keyshortcuts="Left"
24+
class="body-medium"
25+
>
26+
<span class="body-medium">{{ page.previous.title }}</span>
27+
</a>
28+
</div>
29+
{% endif %} {% if page.next %}
30+
<div>
31+
<span class="body-small">Next</span>
32+
<a
33+
rel="next"
34+
href="{{ page.next.url }}"
35+
aria-keyshortcuts="Right"
36+
class="body-medium"
37+
>
38+
<span class="body-medium">{{ page.next.title }}</span>
39+
</a>
40+
</div>
5041
{% endif %}
5142
</nav>
5243
<div class="content-contributors hidden">
53-
<span><b>Contributors to this page</b></span>
44+
<h1 class="h200">Contributors to this page</h1>
5445
<div id="documentation-contributors" class="contributors-container"></div>
46+
{% if urls.editSource %}
47+
<div class="github-edit-button">
48+
<a class="text-button with-link body-small" href="{{ urls.editSource }}">
49+
Edit this page on GitHub
50+
</a>
51+
</div>
52+
{% endif %}
5553
</div>
5654
</div>

project/Build.scala

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,22 @@ object Build {
13791379
)
13801380
}
13811381

1382+
def bundleCSS = Def.task {
1383+
val unmanagedResources = (Compile / resourceDirectory).value
1384+
def createBundle(dir: File): Seq[File] = {
1385+
val (dirs, files) = IO.listFiles(dir).toList.partition(_.isDirectory)
1386+
val targetDir = (Compile / resourceManaged).value.toPath.resolve(unmanagedResources.toPath.relativize(dir.toPath)).toFile
1387+
val bundleFile = targetDir / "bundle.css"
1388+
if (bundleFile.exists) bundleFile.delete()
1389+
files.foreach(file => IO.append(bundleFile, IO.readBytes(file)))
1390+
bundleFile :: dirs.flatMap(createBundle)
1391+
}
1392+
1393+
val cssThemePath = unmanagedResources / "dotty_res" / "styles" / "theme"
1394+
1395+
createBundle(cssThemePath)
1396+
}
1397+
13821398
val SourceLinksIntegrationTest = config("sourceLinksIntegrationTest") extend Test
13831399

13841400
lazy val scaladoc = project.in(file("scaladoc")).
@@ -1392,7 +1408,10 @@ object Build {
13921408
SourceLinksIntegrationTest / test:= ((SourceLinksIntegrationTest / test) dependsOn generateScalaDocumentation.toTask("")).value,
13931409
).
13941410
settings(
1395-
Compile / resourceGenerators += generateStaticAssetsTask.taskValue,
1411+
Compile / resourceGenerators ++= Seq(
1412+
generateStaticAssetsTask.taskValue,
1413+
bundleCSS.taskValue
1414+
),
13961415
libraryDependencies ++= Dependencies.flexmarkDeps ++ Seq(
13971416
"nl.big-o" % "liqp" % "0.8.2",
13981417
"org.jsoup" % "jsoup" % "1.14.3", // Needed to process .html files for static site
@@ -1879,7 +1898,17 @@ object ScaladocConfigs {
18791898
projectFooter,
18801899
defaultTemplate,
18811900
Author(true),
1882-
Groups(true)
1901+
Groups(true),
1902+
QuickLinks(
1903+
List(
1904+
"Download::https://www.scala-lang.org/download/",
1905+
"Documentation::https://docs.scala-lang.org/",
1906+
"Libraries::https://index.scala-lang.org",
1907+
"Contribute::https://www.scala-lang.org/contribute/",
1908+
"Blog::https://www.scala-lang.org/blog/",
1909+
"Community::https://www.scala-lang.org/community/"
1910+
)
1911+
)
18831912
)
18841913
}
18851914

project/ScaladocGeneration.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ object ScaladocGeneration {
129129
def key: String = "-usejavacp"
130130
}
131131

132+
case class QuickLinks(value: List[String]) extends Arg[List[String]] {
133+
def key: String = "-quick-links"
134+
}
135+
132136
import _root_.scala.reflect._
133137

134138
trait GenerationConfig {

project/resources/referenceReplacements/_layouts/static-site-main.html

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
layout: main
33
---
4+
45
<div class="container">
56
<div id="site-header">
67
<div class="wrap">
@@ -31,20 +32,29 @@
3132
{{ content }}
3233
<nav class="arrows-wrapper" aria-label="Page navigation">
3334
{% if page.previous %}
34-
<a rel="prev" href="{{ page.previous.url }}" class="arrows previous" aria-keyshortcuts="Left">
35-
<span>{{ page.previous.title }}</span>
36-
<i class="fa fa-angle-left"></i>
35+
<a
36+
rel="prev"
37+
href="{{ page.previous.url }}"
38+
class="arrows previous"
39+
aria-keyshortcuts="Left"
40+
>
41+
<span>{{ page.previous.title }}</span>
42+
<i class="fa fa-angle-left"></i>
3743
</a>
38-
{% endif %}
39-
{% if page.next %}
40-
<a rel="next" href="{{ page.next.url }}" class="arrows next" aria-keyshortcuts="Right">
41-
<span>{{ page.next.title }}</span>
42-
<i class="fa fa-angle-right"></i>
44+
{% endif %} {% if page.next %}
45+
<a
46+
rel="next"
47+
href="{{ page.next.url }}"
48+
class="arrows next"
49+
aria-keyshortcuts="Right"
50+
>
51+
<span>{{ page.next.title }}</span>
52+
<i class="fa fa-angle-right"></i>
4353
</a>
4454
{% endif %}
4555
</nav>
4656
<div class="content-contributors hidden">
47-
<span><b>Contributors to this page</b></span>
57+
<h1 class="h200">Contributors to this page</h1>
4858
<div id="documentation-contributors" class="contributors-container"></div>
4959
</div>
5060
</div>

project/scripts/cmdScaladocTests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ dist/target/pack/bin/scaladoc \
4040
-project-footer "Copyright (c) 2002-2022, LAMP/EPFL" \
4141
-default-template static-site-main \
4242
-author -groups -revision main -project-version "${DOTTY_BOOTSTRAPPED_VERSION}" \
43+
"-quick-links:Download::https://www.scala-lang.org/download/,Documentation::https://docs.scala-lang.org/,Libraries::https://index.scala-lang.org,Contribute::https://www.scala-lang.org/contribute/,Blog::https://www.scala-lang.org/blog/,Community::https://www.scala-lang.org/community/" \
4344
out/bootstrap/scaladoc-testcases/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/classes > "$tmp" 2>&1 || echo "generated testcases project with scripts"
4445
diff -rq "$OUT1" "scaladoc/output/testcases"

scaladoc-js/common/css/code-snippets.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* Snippets */
22

3-
.snippet {
3+
/* .snippet {
44
position: relative;
55
background: var(--code-bg);
66
margin: 1em 0px;
77
border-radius: 2px;
88
box-shadow: 0 0 2px #888;
99
cursor: default;
10-
}
11-
.snippet-error {
10+
} */
11+
/* .snippet-error {
1212
border-bottom: 2px dotted red;
1313
}
1414
.snippet-warn {
@@ -19,17 +19,17 @@
1919
}
2020
.snippet-debug {
2121
border-bottom: 2px dotted pink;
22-
}
22+
} */
2323

24-
.snippet .snippet-meta {
24+
/* .snippet .snippet-meta {
2525
border-top: 2px solid var(--inactive-bg);
2626
color: var(--inactive-fg);
2727
margin-top: 10px;
2828
padding-top: 10px;
2929
font-size: 0.75em;
30-
}
30+
} */
3131

32-
.snippet-meta .snippet-label {
32+
/* .snippet-meta .snippet-label {
3333
font-weight: bold;
3434
}
3535
@@ -319,4 +319,4 @@ input:checked + .slider:before {
319319
--slider-width: 24px;
320320
--slider-height: 10px;
321321
}
322-
}
322+
} */

0 commit comments

Comments
 (0)