diff options
| author | Sebastian Widua <seppel3210@gmail.com> | 2021-06-12 23:47:17 +0200 |
|---|---|---|
| committer | Sebastian Widua <seppel3210@gmail.com> | 2021-06-12 23:47:17 +0200 |
| commit | c8f5d6d80d397334eb613cf3e414028af68f3f02 (patch) | |
| tree | c859f2b8272a054cda20323f113e6ae78f73f37f /src/librustdoc/html/static | |
| parent | b5e92756b305c6ec4bdd42feddd013333eb69d63 (diff) | |
| parent | da7ada584a3e5c3467b8b9f344b4a0f2a81ce32a (diff) | |
| download | rust-c8f5d6d80d397334eb613cf3e414028af68f3f02.tar.gz rust-c8f5d6d80d397334eb613cf3e414028af68f3f02.zip | |
Merge branch 'master' of https://github.com/rust-lang/rust
Diffstat (limited to 'src/librustdoc/html/static')
| -rw-r--r-- | src/librustdoc/html/static/main.js | 103 | ||||
| -rw-r--r-- | src/librustdoc/html/static/rustdoc.css | 86 | ||||
| -rw-r--r-- | src/librustdoc/html/static/search.js | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/static/sidebar-items.js | 1 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/ayu.css | 11 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/dark.css | 10 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/light.css | 10 |
7 files changed, 110 insertions, 113 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index a96b0c87108..1a15a444a70 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -561,41 +561,40 @@ function hideThemeButtonState() { } }()); - function addSidebarCrates(crates) { - // Draw a convenient sidebar of known crates if we have a listing - if (window.rootPath === "../" || window.rootPath === "./") { - var sidebar = document.getElementsByClassName("sidebar-elems")[0]; - if (sidebar) { - var div = document.createElement("div"); - div.className = "block crate"; - div.innerHTML = "<h3>Crates</h3>"; - var ul = document.createElement("ul"); - div.appendChild(ul); - - for (var i = 0; i < crates.length; ++i) { - var klass = "crate"; - if (window.rootPath !== "./" && crates[i] === window.currentCrate) { - klass += " current"; - } - var link = document.createElement("a"); - link.href = window.rootPath + crates[i] + "/index.html"; - link.className = klass; - link.textContent = crates[i]; - - var li = document.createElement("li"); - li.appendChild(link); - ul.appendChild(li); - } - sidebar.appendChild(div); - } - } - } - // delayed sidebar rendering. window.initSidebarItems = function(items) { var sidebar = document.getElementsByClassName("sidebar-elems")[0]; var current = window.sidebarCurrent; + function addSidebarCrates(crates) { + if (!hasClass(document.body, "crate")) { + // We only want to list crates on the crate page. + return; + } + // Draw a convenient sidebar of known crates if we have a listing + var div = document.createElement("div"); + div.className = "block crate"; + div.innerHTML = "<h3>Crates</h3>"; + var ul = document.createElement("ul"); + div.appendChild(ul); + + for (var i = 0; i < crates.length; ++i) { + var klass = "crate"; + if (window.rootPath !== "./" && crates[i] === window.currentCrate) { + klass += " current"; + } + var link = document.createElement("a"); + link.href = window.rootPath + crates[i] + "/index.html"; + link.className = klass; + link.textContent = crates[i]; + + var li = document.createElement("li"); + li.appendChild(link); + ul.appendChild(li); + } + sidebar.appendChild(div); + } + function block(shortty, longty) { var filtered = items[shortty]; if (!filtered) { @@ -634,28 +633,32 @@ function hideThemeButtonState() { ul.appendChild(li); } div.appendChild(ul); - if (sidebar) { - sidebar.appendChild(div); - } + sidebar.appendChild(div); } - block("primitive", "Primitive Types"); - block("mod", "Modules"); - block("macro", "Macros"); - block("struct", "Structs"); - block("enum", "Enums"); - block("union", "Unions"); - block("constant", "Constants"); - block("static", "Statics"); - block("trait", "Traits"); - block("fn", "Functions"); - block("type", "Type Definitions"); - block("foreigntype", "Foreign Types"); - block("keyword", "Keywords"); - block("traitalias", "Trait Aliases"); - - // `crates{version}.js` should always be loaded before this script, so we can use it safely. - addSidebarCrates(window.ALL_CRATES); + if (sidebar) { + var isModule = hasClass(document.body, "mod"); + if (!isModule) { + block("primitive", "Primitive Types"); + block("mod", "Modules"); + block("macro", "Macros"); + block("struct", "Structs"); + block("enum", "Enums"); + block("union", "Unions"); + block("constant", "Constants"); + block("static", "Statics"); + block("trait", "Traits"); + block("fn", "Functions"); + block("type", "Type Definitions"); + block("foreigntype", "Foreign Types"); + block("keyword", "Keywords"); + block("traitalias", "Trait Aliases"); + } + + // `crates{version}.js` should always be loaded before this script, so we can use + // it safely. + addSidebarCrates(window.ALL_CRATES); + } }; window.register_implementors = function(imp) { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index f3866e211d9..d8684641a30 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -117,8 +117,7 @@ h2 { h3 { font-size: 1.3em; } -h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.notable), -h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant):not(.associatedtype) { +h1, h2, h3, h4 { font-weight: 500; margin: 20px 0 15px 0; padding-bottom: 6px; @@ -135,30 +134,38 @@ h1.fqn { h1.fqn > .in-band > a:hover { text-decoration: underline; } -h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), -h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant):not(.associatedtype) { +h2, h3, h4 { border-bottom: 1px solid; } -h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant, h4.associatedtype { +.impl, .method, +.type:not(.container-rustdoc), .associatedconstant, +.associatedtype { flex-basis: 100%; font-weight: 600; margin-top: 16px; margin-bottom: 10px; position: relative; } -h3.impl, h3.method, h4.method.trait-impl, h3.type, -h4.type.trait-impl, h4.associatedconstant.trait-impl, h4.associatedtype.trait-impl { +.impl, .method.trait-impl, +.type.trait-impl, +.associatedconstant.trait-impl, +.associatedtype.trait-impl { padding-left: 15px; } +div.impl-items > div { + padding-left: 0; +} + h1, h2, h3, h4, .sidebar, a.source, .search-input, .search-results .result-name, .content table td:first-child > a, -div.item-list .out-of-band, +div.item-list .out-of-band, span.since, #source-sidebar, #sidebar-toggle, details.rustdoc-toggle > summary::before, details.undocumented > summary::before, -.content ul.crate a.crate, +div.impl-items > div:not(.docblock):not(.item-info), +.content ul.crate a.crate, a.srclink, /* This selector is for the items listed in the "all items" page. */ #main > ul.docblock > li > a { font-family: "Fira Sans", Arial, sans-serif; @@ -304,17 +311,18 @@ nav.sub { border: none; } -.location a:first-child { +.location a:first-of-type { font-weight: 500; } +.location a:hover { + text-decoration: underline; +} .block { padding: 0; margin-bottom: 14px; } .block h2, .block h3 { - margin-top: 0; - margin-bottom: 8px; text-align: center; } .block ul, .block li { @@ -462,15 +470,7 @@ nav.sub { font-weight: normal; } -h3.impl > .out-of-band { - font-size: 21px; -} - -h4.method > .out-of-band { - font-size: 19px; -} - -h4 > code, h3 > code, .invisible > code { +.method > code, .trait-impl > code, .invisible > code { max-width: calc(100% - 41px); display: block; } @@ -543,7 +543,7 @@ h4 > code, h3 > code, .invisible > code { } .content .multi-column li { width: 100%; display: inline-block; } -.content .method { +.content > .methods > .method { font-size: 1em; position: relative; } @@ -555,7 +555,7 @@ h4 > code, h3 > code, .invisible > code { font-size: 0.8em; } -.content .methods > div:not(.notable-traits):not(.methods) { +.content .methods > div:not(.notable-traits):not(.method) { margin-left: 40px; margin-bottom: 15px; } @@ -564,9 +564,6 @@ h4 > code, h3 > code, .invisible > code { margin-left: 20px; margin-top: -34px; } -.content .docblock > .impl-items > h4 { - border-bottom: 0; -} .content .docblock >.impl-items .table-display { margin: 0; } @@ -688,7 +685,8 @@ a { text-decoration: underline; } -.invisible > .srclink, h4 > code + .srclink, h3 > code + .srclink { +.invisible > .srclink, +.method > code + .srclink { position: absolute; top: 0; right: 0; @@ -802,6 +800,8 @@ a { .search-results .result-name > span { display: inline-block; + margin: 0; + font-weight: normal; } body.blur > :not(#help) { @@ -923,7 +923,7 @@ body.blur > :not(#help) { flex-grow: 1; } -.impl-items h4, h4.impl, h3.impl, .methods h3 { +.has-srclink { display: flex; flex-basis: 100%; font-size: 16px; @@ -1134,6 +1134,13 @@ a.test-arrow:hover{ margin: 0; } +.notable-traits .notable { + margin: 0; + margin-bottom: 13px; + font-size: 19px; + font-weight: 600; +} + .notable-traits .docblock code.content{ margin: 0; padding: 0; @@ -1197,12 +1204,6 @@ pre.rust { margin-left: 5px; } -h4 > .notable-traits { - position: absolute; - left: -44px; - top: 2px; -} - #all-types { text-align: center; border: 1px solid; @@ -1316,14 +1317,6 @@ h4 > .notable-traits { border-top: 1px solid; } - - -h3.notable { - margin: 0; - margin-bottom: 13px; - font-size: 19px; -} - kbd { display: inline-block; padding: 3px 5px; @@ -1468,13 +1461,12 @@ details.rustdoc-toggle > summary.hideme::before { details.rustdoc-toggle > summary:not(.hideme)::before { position: absolute; left: -23px; - top: initial; + top: 3px; } .impl-items > details.rustdoc-toggle > summary:not(.hideme)::before, .undocumented > details.rustdoc-toggle > summary:not(.hideme)::before { position: absolute; - top: 3px; left: -2px; } @@ -1616,10 +1608,6 @@ details.undocumented[open] > summary::before { padding: 0; } - .content h4 > .out-of-band { - position: inherit; - } - #search { margin-left: 0; } @@ -1639,7 +1627,7 @@ details.undocumented[open] > summary::before { z-index: 1; } - h4 > .notable-traits { + .notable-traits { position: absolute; left: -22px; top: 24px; diff --git a/src/librustdoc/html/static/search.js b/src/librustdoc/html/static/search.js index b3242bf4df9..35be246b5bf 100644 --- a/src/librustdoc/html/static/search.js +++ b/src/librustdoc/html/static/search.js @@ -1024,7 +1024,7 @@ window.initSearch = function(rawSearchIndex) { var description = document.createElement("div"); description.className = "desc"; var spanDesc = document.createElement("span"); - spanDesc.innerText = item.desc + "\u00A0"; + spanDesc.insertAdjacentHTML("beforeend", item.desc); description.appendChild(spanDesc); wrapper.appendChild(description); diff --git a/src/librustdoc/html/static/sidebar-items.js b/src/librustdoc/html/static/sidebar-items.js deleted file mode 100644 index 81172ba0d92..00000000000 --- a/src/librustdoc/html/static/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -initSidebarItems({}); diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index fd47c085b84..d220d8708a1 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -10,8 +10,7 @@ body { color: #c5c5c5; } -h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), -h4:not(.method):not(.type):not(.tymethod) { +h1, h2, h3, h4 { color: white; } h1.fqn { @@ -20,10 +19,10 @@ h1.fqn { h1.fqn a { color: #fff; } -h2, h3:not(.impl):not(.method):not(.type):not(.tymethod) { +h2, h3, h4 { border-bottom-color: #5c6773; } -h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) { +h4 { border: none; } @@ -407,6 +406,10 @@ pre.ignore:hover, .information:hover + pre.ignore { border-color: #5c6773; } +.notable-traits-tooltiptext .notable { + border-bottom-color: #5c6773; +} + #titles > button.selected { background-color: #141920 !important; border-bottom: 1px solid #ffb44c !important; diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index d6e1a880a4e..6385a763f2e 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -3,15 +3,13 @@ body { color: #ddd; } -h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), -h4:not(.method):not(.type):not(.tymethod) { +h1, h2, h3, h4 { color: #ddd; } h1.fqn { border-bottom-color: #d2d2d2; } -h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), -h4:not(.method):not(.type):not(.tymethod) { +h2, h3, h4 { border-bottom-color: #d2d2d2; } @@ -356,6 +354,10 @@ pre.ignore:hover, .information:hover + pre.ignore { border-color: #777; } +.notable-traits-tooltiptext .notable { + border-bottom-color: #d2d2d2; +} + #titles > button:not(.selected) { background-color: #252525; border-top-color: #252525; diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index c8151f1cf97..c19d5bfc317 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -5,15 +5,13 @@ body { color: black; } -h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), -h4:not(.method):not(.type):not(.tymethod) { +h1, h2, h3, h4 { color: black; } h1.fqn { border-bottom-color: #D5D5D5; } -h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), -h4:not(.method):not(.type):not(.tymethod) { +h2, h3, h4 { border-bottom-color: #DDDDDD; } @@ -348,6 +346,10 @@ pre.ignore:hover, .information:hover + pre.ignore { border-color: #999; } +.notable-traits-tooltiptext .notable { + border-bottom-color: #DDDDDD; +} + #titles > button:not(.selected) { background-color: #e6e6e6; border-top-color: #e6e6e6; |
