Auto merge of #119066 - notriddle:notriddle/sidebar-source-redesign, … · rust-lang/rust@67b6975 (original) (raw)
`@@ -366,22 +366,12 @@ img {
`
366
366
`max-width: 100%;
`
367
367
`}
`
368
368
``
369
``
`-
.sub-logo-container, .logo-container {
`
``
369
`+
.logo-container {
`
370
370
`/* zero text boxes so that computed line height = image height exactly */
`
371
371
`line-height: 0;
`
372
372
`display: block;
`
373
373
`}
`
374
374
``
375
``
`-
.sub-logo-container {
`
376
``
`-
margin-right: 32px;
`
377
``
`-
}
`
378
``
-
379
``
`-
.sub-logo-container > img {
`
380
``
`-
height: 60px;
`
381
``
`-
width: 60px;
`
382
``
`-
object-fit: contain;
`
383
``
`-
}
`
384
``
-
385
375
`.rust-logo {
`
386
376
`filter: var(--rust-logo-filter);
`
387
377
`}
`
`@@ -401,6 +391,7 @@ img {
`
401
391
``
402
392
`.rustdoc.src .sidebar {
`
403
393
`flex-basis: 50px;
`
``
394
`+
width: 50px;
`
404
395
`border-right: 1px solid;
`
405
396
`overflow-x: hidden;
`
406
397
`/* The sidebar is by default hidden */
`
`@@ -424,12 +415,12 @@ img {
`
424
415
`}
`
425
416
``
426
417
`.rustdoc.src .sidebar-resizer {
`
427
``
`-
/* when closed, place resizer glow on top of the normal src sidebar border (no need to worry
`
428
``
`-
about sidebar) */
`
``
418
`+
/* when closed, place resizer glow on top of the normal src sidebar border (no need to
`
``
419
`+
worry about sidebar) */
`
429
420
`left: 49px;
`
430
421
`}
`
431
422
``
432
``
`-
.src-sidebar-expanded .rustdoc.src .sidebar-resizer {
`
``
423
`+
.src-sidebar-expanded .src .sidebar-resizer {
`
433
424
`/* for src sidebar, gap is already provided by 1px border on sidebar itself, so place resizer
`
434
425
` to right of it */
`
435
426
`left: var(--src-sidebar-width);
`
`@@ -497,15 +488,11 @@ img {
`
497
488
`}
`
498
489
``
499
490
`.sidebar, .mobile-topbar, .sidebar-menu-toggle,
`
500
``
`-
#src-sidebar-toggle, #src-sidebar {
`
``
491
`+
#src-sidebar {
`
501
492
`background-color: var(--sidebar-background-color);
`
502
493
`}
`
503
494
``
504
``
`-
#src-sidebar-toggle > button:hover, #src-sidebar-toggle > button:focus {
`
505
``
`-
background-color: var(--sidebar-background-color-hover);
`
506
``
`-
}
`
507
``
-
508
``
`-
.src .sidebar > *:not(#src-sidebar-toggle) {
`
``
495
`+
.src .sidebar > * {
`
509
496
`visibility: hidden;
`
510
497
`}
`
511
498
``
`@@ -515,7 +502,7 @@ img {
`
515
502
`width: var(--src-sidebar-width);
`
516
503
`}
`
517
504
``
518
``
`-
.src-sidebar-expanded .src .sidebar > *:not(#src-sidebar-toggle) {
`
``
505
`+
.src-sidebar-expanded .src .sidebar > * {
`
519
506
`visibility: visible;
`
520
507
`}
`
521
508
``
`@@ -1531,47 +1518,26 @@ a.tooltip:hover::after {
`
1531
1518
`font-weight: normal;
`
1532
1519
`}
`
1533
1520
``
1534
``
`-
#src-sidebar-toggle {
`
1535
``
`-
position: sticky;
`
1536
``
`-
top: 0;
`
1537
``
`-
left: 0;
`
1538
``
`-
font-size: 1.25rem;
`
1539
``
`-
border-bottom: 1px solid;
`
1540
``
`-
display: flex;
`
1541
``
`-
height: 40px;
`
1542
``
`-
justify-content: stretch;
`
1543
``
`-
align-items: stretch;
`
1544
``
`-
z-index: 10;
`
1545
``
`-
}
`
1546
1521
`#src-sidebar {
`
1547
1522
`width: 100%;
`
1548
1523
`overflow: auto;
`
1549
1524
`}
`
1550
``
`-
#src-sidebar > .title {
`
1551
``
`-
font-size: 1.5rem;
`
1552
``
`-
text-align: center;
`
1553
``
`-
border-bottom: 1px solid var(--border-color);
`
1554
``
`-
margin-bottom: 6px;
`
1555
``
`-
}
`
1556
1525
`#src-sidebar div.files > a:hover, details.dir-entry summary:hover,
`
1557
1526
`#src-sidebar div.files > a:focus, details.dir-entry summary:focus {
`
1558
1527
`background-color: var(--src-sidebar-background-hover);
`
1559
1528
`}
`
1560
1529
`#src-sidebar div.files > a.selected {
`
1561
1530
`background-color: var(--src-sidebar-background-selected);
`
1562
1531
`}
`
1563
``
`-
#src-sidebar-toggle > button {
`
1564
``
`-
font-size: inherit;
`
1565
``
`-
font-weight: bold;
`
1566
``
`-
background: none;
`
1567
``
`-
color: inherit;
`
1568
``
`-
text-align: center;
`
1569
``
`-
border: none;
`
1570
``
`-
outline: none;
`
1571
``
`-
flex: 1 1;
`
1572
``
`-
/* iOS button gradient: https://stackoverflow.com/q/5438567 */
`
1573
``
`-
-webkit-appearance: none;
`
1574
``
`-
opacity: 1;
`
``
1532
+
``
1533
`+
.src-sidebar-title {
`
``
1534
`+
position: sticky;
`
``
1535
`+
top: 0;
`
``
1536
`+
display: flex;
`
``
1537
`+
padding: 8px 8px 0 48px;
`
``
1538
`+
margin-bottom: 7px;
`
``
1539
`+
background: var(--sidebar-background-color);
`
``
1540
`+
border-bottom: 1px solid var(--border-color);
`
1575
1541
`}
`
1576
1542
``
1577
1543
`#settings-menu, #help-button {
`
`@@ -1580,8 +1546,10 @@ a.tooltip:hover::after {
`
1580
1546
`}
`
1581
1547
`#sidebar-button {
`
1582
1548
`display: none;
`
``
1549
`+
line-height: 0;
`
1583
1550
`}
`
1584
``
`-
.hide-sidebar #sidebar-button {
`
``
1551
`+
.hide-sidebar #sidebar-button,
`
``
1552
`+
.src #sidebar-button {
`
1585
1553
`display: flex;
`
1586
1554
`margin-right: 4px;
`
1587
1555
`position: fixed;
`
`@@ -1591,6 +1559,13 @@ a.tooltip:hover::after {
`
1591
1559
`background-color: var(--main-background-color);
`
1592
1560
`z-index: 1;
`
1593
1561
`}
`
``
1562
`+
.src #sidebar-button {
`
``
1563
`+
left: 8px;
`
``
1564
`+
z-index: 101;
`
``
1565
`+
}
`
``
1566
`+
.hide-sidebar .src #sidebar-button {
`
``
1567
`+
position: static;
`
``
1568
`+
}
`
1594
1569
`#settings-menu > a, #help-button > a, #sidebar-button > a {
`
1595
1570
`display: flex;
`
1596
1571
`align-items: center;
`
`@@ -1823,6 +1798,30 @@ However, it's not needed with smaller screen width because the doc/code block is
`
1823
1798
`margin-top: 16px;
`
1824
1799
`}
`
1825
1800
``
``
1801
`+
/* sidebar button opens modal
`
``
1802
`+
use hamburger button */
`
``
1803
`+
.src #sidebar-button > a:before, .sidebar-menu-toggle:before {
`
``
1804
`+
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
`
``
1805
`+
viewBox="0 0 22 22" fill="none" stroke="black">\
`
``
1806
`+
`
``
1807
`+
opacity: 0.75;
`
``
1808
`+
}
`
``
1809
`+
.sidebar-menu-toggle:hover:before,
`
``
1810
`+
.sidebar-menu-toggle:active:before,
`
``
1811
`+
.sidebar-menu-toggle:focus:before {
`
``
1812
`+
opacity: 1;
`
``
1813
`+
}
`
``
1814
+
``
1815
`+
/* src sidebar button opens a folder view */
`
``
1816
`+
.src #sidebar-button > a:before {
`
``
1817
`+
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
`
``
1818
`+
viewBox="0 0 22 22" fill="none" stroke="black">\
`
``
1819
`+
`
``
1820
`+
`
``
1821
`+
`
``
1822
`+
opacity: 0.75;
`
``
1823
`+
}
`
``
1824
+
1826
1825
`/* Media Queries */
`
1827
1826
``
1828
1827
`/* Make sure all the buttons line wrap at the same time */
`
`@@ -1846,10 +1845,6 @@ in src-script.js and main.js
`
1846
1845
`scroll-margin-top: 45px;
`
1847
1846
` }
`
1848
1847
``
1849
``
`-
.hide-sidebar #sidebar-button {
`
1850
``
`-
position: static;
`
1851
``
`-
}
`
1852
``
-
1853
1848
` .rustdoc {
`
1854
1849
`/* Sidebar should overlay main content, rather than pushing main content to the right.
`
1855
1850
`` Turn off display: flex
on the body element. */
``
`@@ -1904,6 +1899,15 @@ in src-script.js and main.js
`
1904
1899
`height: 100vh;
`
1905
1900
`border: 0;
`
1906
1901
` }
`
``
1902
`+
.src .search-form {
`
``
1903
`+
margin-left: 40px;
`
``
1904
`+
}
`
``
1905
`+
.hide-sidebar .search-form {
`
``
1906
`+
margin-left: 32px;
`
``
1907
`+
}
`
``
1908
`+
.hide-sidebar .src .search-form {
`
``
1909
`+
margin-left: 0;
`
``
1910
`+
}
`
1907
1911
``
1908
1912
` .sidebar.shown,
`
1909
1913
` .src-sidebar-expanded .src .sidebar,
`
`@@ -1953,11 +1957,8 @@ in src-script.js and main.js
`
1953
1957
``
1954
1958
` .sidebar-menu-toggle {
`
1955
1959
`width: 45px;
`
1956
``
`-
/* Rare exception to specifying font sizes in rem. Since this is acting
`
1957
``
`-
as an icon, it's okay to specify its sizes in pixels. */
`
1958
``
`-
font-size: 32px;
`
1959
1960
`border: none;
`
1960
``
`-
color: var(--main-color);
`
``
1961
`+
line-height: 0;
`
1961
1962
` }
`
1962
1963
``
1963
1964
` .hide-sidebar .sidebar-menu-toggle {
`
`@@ -1977,31 +1978,6 @@ in src-script.js and main.js
`
1977
1978
`left: -11px;
`
1978
1979
` }
`
1979
1980
``
1980
``
`-
#src-sidebar-toggle {
`
1981
``
`-
position: fixed;
`
1982
``
`-
left: 1px;
`
1983
``
`-
top: 100px;
`
1984
``
`-
width: 30px;
`
1985
``
`-
font-size: 1.5rem;
`
1986
``
`-
padding: 0;
`
1987
``
`-
z-index: 10;
`
1988
``
`-
border-top-right-radius: 3px;
`
1989
``
`-
border-bottom-right-radius: 3px;
`
1990
``
`-
border: 1px solid;
`
1991
``
`-
border-left: 0;
`
1992
``
`-
}
`
1993
``
-
1994
``
`-
.src-sidebar-expanded #src-sidebar-toggle {
`
1995
``
`-
left: unset;
`
1996
``
`-
top: unset;
`
1997
``
`-
width: unset;
`
1998
``
`-
border-top-right-radius: unset;
`
1999
``
`-
border-bottom-right-radius: unset;
`
2000
``
`-
position: sticky;
`
2001
``
`-
border: 0;
`
2002
``
`-
border-bottom: 1px solid;
`
2003
``
`-
}
`
2004
``
-
2005
1981
`/* We don't display these buttons on mobile devices. */
`
2006
1982
`#copy-path, #help-button {
`
2007
1983
`display: none;
`
`@@ -2017,6 +1993,12 @@ in src-script.js and main.js
`
2017
1993
`width: 22px;
`
2018
1994
`height: 22px;
`
2019
1995
` }
`
``
1996
`+
.sidebar-menu-toggle:before {
`
``
1997
`+
filter: var(--mobile-sidebar-menu-filter);
`
``
1998
`+
}
`
``
1999
`+
.sidebar-menu-toggle:hover {
`
``
2000
`+
background: var(--main-background-color);
`
``
2001
`+
}
`
2020
2002
``
2021
2003
`/* Display an alternating layout on tablets and phones */
`
2022
2004
` .item-table, .item-row, .item-table > li, .item-table > li > div,
`
`@@ -2043,9 +2025,13 @@ in src-script.js and main.js
`
2043
2025
` }
`
2044
2026
``
2045
2027
` .src-sidebar-expanded .src .sidebar {
`
``
2028
`+
position: fixed;
`
2046
2029
`max-width: 100vw;
`
2047
2030
`width: 100vw;
`
2048
2031
` }
`
``
2032
`+
.src .src-sidebar-title {
`
``
2033
`+
padding-top: 0;
`
``
2034
`+
}
`
2049
2035
``
2050
2036
`/* Position of the "[-]" element. */
`
2051
2037
`details.toggle:not(.top-doc) > summary {
`
`@@ -2117,12 +2103,6 @@ in src-script.js and main.js
`
2117
2103
` .search-form {
`
2118
2104
`align-self: stretch;
`
2119
2105
` }
`
2120
``
-
2121
``
`-
.sub-logo-container > img {
`
2122
``
`-
height: 35px;
`
2123
``
`-
width: 35px;
`
2124
``
`-
margin-bottom: var(--nav-sub-mobile-padding);
`
2125
``
`-
}
`
2126
2106
`}
`
2127
2107
``
2128
2108
`.variant,
`
`@@ -2344,6 +2324,7 @@ in src-script.js and main.js
`
2344
2324
`--code-attribute-color: #999;
`
2345
2325
`--toggles-color: #999;
`
2346
2326
`--toggle-filter: none;
`
``
2327
`+
--mobile-sidebar-menu-filter: none;
`
2347
2328
`--search-input-focused-border-color: #66afe9;
`
2348
2329
`--copy-path-button-color: #999;
`
2349
2330
`--copy-path-img-filter: invert(50%);
`
`@@ -2448,6 +2429,7 @@ in src-script.js and main.js
`
2448
2429
`--code-attribute-color: #999;
`
2449
2430
`--toggles-color: #999;
`
2450
2431
`--toggle-filter: invert(100%);
`
``
2432
`+
--mobile-sidebar-menu-filter: invert(100%);
`
2451
2433
`--search-input-focused-border-color: #008dfd;
`
2452
2434
`--copy-path-button-color: #999;
`
2453
2435
`--copy-path-img-filter: invert(50%);
`
`@@ -2559,6 +2541,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
`
2559
2541
`--code-attribute-color: #999;
`
2560
2542
`--toggles-color: #999;
`
2561
2543
`--toggle-filter: invert(100%);
`
``
2544
`+
--mobile-sidebar-menu-filter: invert(100%);
`
2562
2545
`` --search-input-focused-border-color: #5c6773; /* Same as --border-color
. */
``
2563
2546
`--copy-path-button-color: #fff;
`
2564
2547
`--copy-path-img-filter: invert(70%);
`
`@@ -2650,8 +2633,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
`
2650
2633
`:root[data-theme="ayu"] h4,
`
2651
2634
`:where(:root[data-theme="ayu"]) h1 a,
`
2652
2635
`:root[data-theme="ayu"] .sidebar h2 a,
`
2653
``
`-
:root[data-theme="ayu"] .sidebar h3 a,
`
2654
``
`-
:root[data-theme="ayu"] #source-sidebar > .title {
`
``
2636
`+
:root[data-theme="ayu"] .sidebar h3 a {
`
2655
2637
`color: #fff;
`
2656
2638
`}
`
2657
2639
``