2023-01-27 15:49:08 +01:00
|
|
|
/* When static files are updated, their suffixes need to be updated.
|
|
|
|
1. In the top directory run:
|
|
|
|
./x.py doc --stage 1 library/core
|
|
|
|
2. Find the directory containing files named with updated suffixes:
|
|
|
|
find build -path '*'/stage1-std/'*'/static.files
|
|
|
|
3. Copy the filenames with updated suffixes from the directory.
|
|
|
|
*/
|
|
|
|
|
2023-04-05 17:13:00 +02:00
|
|
|
:root {
|
|
|
|
--nav-sub-mobile-padding: 8px;
|
2023-06-27 15:05:43 +02:00
|
|
|
--search-typename-width: 6.75rem;
|
2023-09-27 08:59:32 -07:00
|
|
|
/* DEFAULT_SIDEBAR_WIDTH
|
|
|
|
see main.js for information on these values
|
|
|
|
and on the RUSTDOC_MOBILE_BREAKPOINT */
|
|
|
|
--desktop-sidebar-width: 200px;
|
|
|
|
--src-sidebar-width: 300px;
|
2023-12-31 22:25:46 +01:00
|
|
|
--desktop-sidebar-z-index: 100;
|
2024-07-01 17:08:49 -07:00
|
|
|
--sidebar-elems-left-padding: 24px;
|
2024-05-29 23:40:58 +02:00
|
|
|
/* clipboard <https://github.com/rust-lang/crates.io/commits/main/public/assets/copy.svg> */
|
|
|
|
--clipboard-image: url('data:image/svg+xml,<svg width="19" height="18" viewBox="0 0 24 25" \
|
|
|
|
xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
|
|
|
|
<path d="M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 \
|
|
|
|
0110 0a3.323 3.323 0 013.333 3.333h5C19.245 3.333 20 4.09 20 5v8.333h-2V9H2v14h16v-3zM3 \
|
|
|
|
7h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0-1.75-.755-1.75-1.666C11.75 2.755 10.957 2 10 \
|
|
|
|
2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1.666H4.75C3.793 5.333 3 6.09 3 7z"/>\
|
|
|
|
<path d="M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z"/>\
|
|
|
|
</svg>');
|
2024-06-03 09:55:11 +02:00
|
|
|
--copy-path-height: 34px;
|
|
|
|
--copy-path-width: 33px;
|
2024-05-29 23:40:58 +02:00
|
|
|
/* Checkmark <https://www.svgrepo.com/svg/335033/checkmark> */
|
|
|
|
--checkmark-image: url('data:image/svg+xml,<svg viewBox="-1 -1 23 23" \
|
|
|
|
xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
|
|
|
|
<g><path d="M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414"></path>\
|
|
|
|
</g></svg>');
|
2024-06-03 21:27:29 +02:00
|
|
|
--button-left-margin: 4px;
|
|
|
|
--button-border-radius: 2px;
|
2023-04-05 17:13:00 +02:00
|
|
|
}
|
|
|
|
|
2015-09-19 10:42:03 +01:00
|
|
|
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
|
2014-04-12 21:39:12 +02:00
|
|
|
@font-face {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-family: 'Fira Sans';
|
|
|
|
font-style: normal;
|
|
|
|
font-weight: 400;
|
2021-02-26 00:02:11 -08:00
|
|
|
src: local('Fira Sans'),
|
2022-10-24 01:28:55 -07:00
|
|
|
url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
|
|
|
@font-face {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-family: 'Fira Sans';
|
|
|
|
font-style: normal;
|
|
|
|
font-weight: 500;
|
2021-02-26 00:02:11 -08:00
|
|
|
src: local('Fira Sans Medium'),
|
2022-10-24 01:28:55 -07:00
|
|
|
url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
2015-09-19 10:42:03 +01:00
|
|
|
|
2021-03-29 18:33:22 +02:00
|
|
|
/* See SourceSerif4-LICENSE.md for the Source Serif 4 license. */
|
2014-04-12 21:39:12 +02:00
|
|
|
@font-face {
|
2021-03-29 18:33:22 +02:00
|
|
|
font-family: 'Source Serif 4';
|
2016-11-06 21:03:08 +01:00
|
|
|
font-style: normal;
|
|
|
|
font-weight: 400;
|
2021-06-17 17:36:42 +02:00
|
|
|
src: local('Source Serif 4'),
|
2023-01-27 12:43:00 +01:00
|
|
|
url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
|
|
|
@font-face {
|
2021-03-29 18:33:22 +02:00
|
|
|
font-family: 'Source Serif 4';
|
2016-11-06 21:03:08 +01:00
|
|
|
font-style: italic;
|
|
|
|
font-weight: 400;
|
2021-06-17 17:36:42 +02:00
|
|
|
src: local('Source Serif 4 Italic'),
|
2023-01-27 12:43:00 +01:00
|
|
|
url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
|
|
|
@font-face {
|
2021-03-29 18:33:22 +02:00
|
|
|
font-family: 'Source Serif 4';
|
2016-11-06 21:03:08 +01:00
|
|
|
font-style: normal;
|
|
|
|
font-weight: 700;
|
2021-06-17 17:36:42 +02:00
|
|
|
src: local('Source Serif 4 Bold'),
|
2023-01-27 12:43:00 +01:00
|
|
|
url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
2015-09-19 10:42:03 +01:00
|
|
|
|
|
|
|
/* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */
|
2014-07-08 20:26:23 +02:00
|
|
|
@font-face {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-family: 'Source Code Pro';
|
|
|
|
font-style: normal;
|
|
|
|
font-weight: 400;
|
2016-12-04 13:44:19 -08:00
|
|
|
/* Avoid using locally installed font because bad versions are in circulation:
|
|
|
|
* see https://github.com/rust-lang/rust/issues/24355 */
|
2022-10-24 01:28:55 -07:00
|
|
|
src: url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");
|
2021-03-04 15:38:31 +01:00
|
|
|
font-display: swap;
|
|
|
|
}
|
|
|
|
@font-face {
|
|
|
|
font-family: 'Source Code Pro';
|
|
|
|
font-style: italic;
|
|
|
|
font-weight: 400;
|
2022-10-24 01:28:55 -07:00
|
|
|
src: url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-07-08 20:26:23 +02:00
|
|
|
}
|
|
|
|
@font-face {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-family: 'Source Code Pro';
|
|
|
|
font-style: normal;
|
|
|
|
font-weight: 600;
|
2022-10-24 01:28:55 -07:00
|
|
|
src: url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");
|
2021-02-19 17:54:41 -08:00
|
|
|
font-display: swap;
|
2014-07-08 20:26:23 +02:00
|
|
|
}
|
2014-04-12 21:39:12 +02:00
|
|
|
|
2021-10-12 04:47:34 +09:00
|
|
|
/* Avoid using legacy CJK serif fonts in Windows like Batang. */
|
2021-05-15 14:01:27 +09:00
|
|
|
@font-face {
|
2021-10-26 10:58:13 +09:00
|
|
|
font-family: 'NanumBarunGothic';
|
2022-10-24 01:28:55 -07:00
|
|
|
src: url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");
|
2021-05-15 14:01:27 +09:00
|
|
|
font-display: swap;
|
2021-10-26 10:58:13 +09:00
|
|
|
unicode-range: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
|
2021-05-15 14:01:27 +09:00
|
|
|
}
|
|
|
|
|
2013-09-18 22:18:38 -07:00
|
|
|
* {
|
2020-07-15 17:20:46 +02:00
|
|
|
box-sizing: border-box;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
|
|
|
|
2013-10-14 21:32:12 +02:00
|
|
|
/* General structure and fonts */
|
2013-09-18 22:18:38 -07:00
|
|
|
|
|
|
|
body {
|
2022-02-05 05:05:05 -08:00
|
|
|
/* Line spacing at least 1.5 per Web Content Accessibility Guidelines
|
|
|
|
https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
|
|
|
|
font: 1rem/1.5 "Source Serif 4", NanumBarunGothic, serif;
|
2016-11-06 21:03:08 +01:00
|
|
|
margin: 0;
|
|
|
|
position: relative;
|
2022-01-11 17:36:52 -08:00
|
|
|
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
|
|
|
|
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
|
|
|
|
more aggressively when we want them to. */
|
|
|
|
overflow-wrap: anywhere;
|
2016-11-06 21:03:08 +01:00
|
|
|
font-feature-settings: "kern", "liga";
|
2022-06-24 17:03:04 +02:00
|
|
|
background-color: var(--main-background-color);
|
|
|
|
color: var(--main-color);
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-27 09:07:12 +03:00
|
|
|
h1 {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.5rem; /* 24px */
|
2014-04-27 09:07:12 +03:00
|
|
|
}
|
|
|
|
h2 {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.375rem; /* 22px */
|
2014-04-27 09:07:12 +03:00
|
|
|
}
|
|
|
|
h3 {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.25rem; /* 20px */
|
2014-04-27 09:07:12 +03:00
|
|
|
}
|
2021-10-01 06:17:15 -04:00
|
|
|
h1, h2, h3, h4, h5, h6 {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-weight: 500;
|
2021-10-18 21:04:38 -07:00
|
|
|
}
|
|
|
|
h1, h2, h3, h4 {
|
2022-09-27 09:21:24 -07:00
|
|
|
margin: 25px 0 15px 0;
|
2016-11-06 21:03:08 +01:00
|
|
|
padding-bottom: 6px;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
2021-10-21 23:09:11 -07:00
|
|
|
.docblock h3, .docblock h4, h5, h6 {
|
2021-10-18 21:04:38 -07:00
|
|
|
margin: 15px 0 5px 0;
|
|
|
|
}
|
2022-09-28 14:33:56 -07:00
|
|
|
.docblock > h2:first-child,
|
|
|
|
.docblock > h3:first-child,
|
|
|
|
.docblock > h4:first-child,
|
|
|
|
.docblock > h5:first-child,
|
|
|
|
.docblock > h6:first-child {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
2023-01-13 10:09:25 -07:00
|
|
|
.main-heading h1 {
|
2021-12-03 17:09:04 -08:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2022-10-04 11:54:40 -07:00
|
|
|
flex-grow: 1;
|
|
|
|
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
|
|
|
|
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
|
|
|
|
more aggressively when we want them to. */
|
|
|
|
overflow-wrap: anywhere;
|
2021-12-03 17:09:04 -08:00
|
|
|
}
|
|
|
|
.main-heading {
|
2021-04-20 22:31:48 +02:00
|
|
|
display: flex;
|
2022-01-13 09:54:44 -08:00
|
|
|
flex-wrap: wrap;
|
|
|
|
padding-bottom: 6px;
|
2021-12-03 17:09:04 -08:00
|
|
|
margin-bottom: 15px;
|
2014-03-18 01:44:55 -06:00
|
|
|
}
|
2021-10-21 23:09:11 -07:00
|
|
|
/* The only headings that get underlines are:
|
|
|
|
Markdown-generated headings within the top-doc
|
|
|
|
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
|
|
|
|
Underlines elsewhere in the documentation break up visual flow and tend to invert
|
|
|
|
section hierarchies. */
|
2022-10-18 11:14:01 -07:00
|
|
|
.content h2,
|
2022-05-21 13:57:52 +02:00
|
|
|
.top-doc .docblock > h3,
|
|
|
|
.top-doc .docblock > h4 {
|
2022-07-27 15:36:27 +02:00
|
|
|
border-bottom: 1px solid var(--headings-border-bottom-color);
|
2014-03-18 01:44:55 -06:00
|
|
|
}
|
2023-02-12 12:27:40 -07:00
|
|
|
/* while line-height 1.5 is required for any "block of text",
|
|
|
|
which WCAG defines as more than one sentence, it looks weird for
|
|
|
|
very large main headers */
|
|
|
|
h1, h2 {
|
|
|
|
line-height: 1.25;
|
|
|
|
padding-top: 3px;
|
|
|
|
padding-bottom: 9px;
|
|
|
|
}
|
2021-10-21 18:46:47 -07:00
|
|
|
h3.code-header {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.125rem; /* 18px */
|
2021-10-21 18:46:47 -07:00
|
|
|
}
|
|
|
|
h4.code-header {
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1rem;
|
2021-10-21 18:46:47 -07:00
|
|
|
}
|
2022-01-07 12:39:56 -05:00
|
|
|
.code-header {
|
2021-07-25 21:41:57 +00:00
|
|
|
font-weight: 600;
|
|
|
|
margin: 0;
|
2022-01-07 12:39:56 -05:00
|
|
|
padding: 0;
|
2023-02-02 15:10:41 -07:00
|
|
|
white-space: pre-wrap;
|
2021-07-25 21:41:57 +00:00
|
|
|
}
|
2017-10-01 15:54:50 +03:00
|
|
|
|
2022-09-28 13:52:13 -07:00
|
|
|
#crate-search,
|
2021-10-01 06:17:15 -04:00
|
|
|
h1, h2, h3, h4, h5, h6,
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.sidebar,
|
|
|
|
.mobile-topbar,
|
|
|
|
.search-input,
|
|
|
|
.search-results .result-name,
|
2023-02-07 19:00:18 -07:00
|
|
|
.item-name > a,
|
2021-12-03 17:09:04 -08:00
|
|
|
.out-of-band,
|
|
|
|
span.since,
|
2023-07-14 16:38:01 -07:00
|
|
|
a.src,
|
2022-10-14 09:48:19 -07:00
|
|
|
#help-button > a,
|
2022-12-05 11:15:09 -07:00
|
|
|
summary.hideme,
|
2022-12-01 11:31:44 -07:00
|
|
|
.scraped-example-list,
|
2020-12-29 15:56:52 +01:00
|
|
|
/* This selector is for the items listed in the "all items" page. */
|
2022-09-16 13:40:21 -07:00
|
|
|
ul.all-items {
|
2021-10-26 10:58:13 +09:00
|
|
|
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
|
|
|
|
2022-09-17 09:38:57 -07:00
|
|
|
#toggle-all-docs,
|
2022-06-24 17:03:04 +02:00
|
|
|
a.anchor,
|
2023-11-29 13:38:56 -07:00
|
|
|
.section-header a,
|
2023-07-14 16:38:01 -07:00
|
|
|
#src-sidebar a,
|
2023-03-21 15:28:22 -07:00
|
|
|
.rust a,
|
2022-06-24 17:03:04 +02:00
|
|
|
.sidebar h2 a,
|
|
|
|
.sidebar h3 a,
|
|
|
|
.mobile-topbar h2 a,
|
2022-10-11 09:22:40 -07:00
|
|
|
h1 a,
|
2022-06-24 17:03:04 +02:00
|
|
|
.search-results a,
|
2022-12-09 10:40:49 -07:00
|
|
|
.stab,
|
2023-04-22 16:00:20 +02:00
|
|
|
.result-name i {
|
2022-06-24 17:03:04 +02:00
|
|
|
color: var(--main-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.enum, a.enum,
|
|
|
|
span.struct, a.struct,
|
|
|
|
span.union, a.union,
|
|
|
|
span.primitive, a.primitive,
|
|
|
|
span.type, a.type,
|
|
|
|
span.foreigntype, a.foreigntype {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--type-link-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.trait, a.trait,
|
|
|
|
span.traitalias, a.traitalias {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--trait-link-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.associatedtype, a.associatedtype,
|
|
|
|
span.constant, a.constant,
|
|
|
|
span.static, a.static {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--assoc-item-link-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.fn, a.fn,
|
|
|
|
span.method, a.method,
|
|
|
|
span.tymethod, a.tymethod {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--function-link-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.attr, a.attr,
|
|
|
|
span.derive, a.derive,
|
|
|
|
span.macro, a.macro {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--macro-link-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.mod, a.mod {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--mod-link-color);
|
|
|
|
}
|
|
|
|
|
2023-03-21 15:28:22 -07:00
|
|
|
span.keyword, a.keyword {
|
2022-09-16 17:57:07 +02:00
|
|
|
color: var(--keyword-link-color);
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
color: var(--link-color);
|
2023-01-09 11:09:19 -07:00
|
|
|
text-decoration: none;
|
2022-09-16 17:57:07 +02:00
|
|
|
}
|
|
|
|
|
2014-04-18 11:08:34 +09:00
|
|
|
ol, ul {
|
2022-02-05 05:05:05 -08:00
|
|
|
padding-left: 24px;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
2014-04-18 11:08:34 +09:00
|
|
|
ul ul, ol ul, ul ol, ol ol {
|
2022-02-05 05:05:05 -08:00
|
|
|
margin-bottom: .625em;
|
2014-04-18 11:08:34 +09:00
|
|
|
}
|
2014-04-12 21:39:12 +02:00
|
|
|
|
2023-01-07 14:48:55 +01:00
|
|
|
p, .docblock > .warning {
|
2022-02-05 05:05:05 -08:00
|
|
|
/* Paragraph spacing at least 1.5 times line spacing per Web Content Accessibility Guidelines.
|
|
|
|
Line-height is 1.5rem, so line spacing is .5rem; .75em is 1.5 times that.
|
|
|
|
https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html */
|
|
|
|
margin: 0 0 .75em 0;
|
2014-04-12 21:39:12 +02:00
|
|
|
}
|
2022-09-27 09:21:24 -07:00
|
|
|
/* For the last child of a div, the margin will be taken care of
|
|
|
|
by the margin-top of the next item. */
|
2023-01-07 14:48:55 +01:00
|
|
|
p:last-child, .docblock > .warning:last-child {
|
2022-09-27 09:21:24 -07:00
|
|
|
margin: 0;
|
|
|
|
}
|
2014-03-20 19:05:22 +01:00
|
|
|
|
2021-06-30 04:13:46 +09:00
|
|
|
/* Fix some style changes due to normalize.css 8 */
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
button {
|
|
|
|
/* Buttons on Safari have different default padding than other platforms. Make them the same. */
|
|
|
|
padding: 1px 6px;
|
2022-11-20 21:48:57 -07:00
|
|
|
/* Opinionated tweak: use pointer cursor as clickability signifier. */
|
|
|
|
cursor: pointer;
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
}
|
|
|
|
|
2022-11-20 21:48:57 -07:00
|
|
|
/* end tweaks for normalize.css 8 */
|
|
|
|
|
2022-09-17 09:38:57 -07:00
|
|
|
button#toggle-all-docs {
|
|
|
|
padding: 0;
|
|
|
|
background: none;
|
|
|
|
border: none;
|
2022-09-17 09:53:31 -07:00
|
|
|
/* iOS button gradient: https://stackoverflow.com/q/5438567 */
|
|
|
|
-webkit-appearance: none;
|
|
|
|
opacity: 1;
|
2022-09-17 09:38:57 -07:00
|
|
|
}
|
|
|
|
|
2021-09-30 04:23:02 +02:00
|
|
|
.rustdoc {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
main {
|
|
|
|
position: relative;
|
|
|
|
flex-grow: 1;
|
|
|
|
padding: 10px 15px 40px 45px;
|
2022-11-29 11:37:32 -07:00
|
|
|
min-width: 0; /* avoid growing beyond the size limit */
|
2021-09-30 04:23:02 +02:00
|
|
|
}
|
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.src main {
|
2021-10-10 00:52:14 +02:00
|
|
|
padding: 15px;
|
|
|
|
}
|
|
|
|
|
2021-12-02 14:21:32 +01:00
|
|
|
.width-limiter {
|
2021-09-30 04:23:02 +02:00
|
|
|
max-width: 960px;
|
|
|
|
margin-right: auto;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details:not(.toggle) summary {
|
2021-06-24 15:41:31 +09:00
|
|
|
margin-bottom: .6em;
|
|
|
|
}
|
|
|
|
|
2024-07-30 15:23:44 +02:00
|
|
|
code, pre, .code-header {
|
2018-11-07 11:02:08 -05:00
|
|
|
font-family: "Source Code Pro", monospace;
|
2013-11-11 15:16:23 +01:00
|
|
|
}
|
2016-09-09 11:54:12 +08:00
|
|
|
.docblock code, .docblock-short code {
|
2016-11-06 21:03:08 +01:00
|
|
|
border-radius: 3px;
|
2022-02-05 05:05:05 -08:00
|
|
|
padding: 0 0.125em;
|
2014-08-06 11:03:18 +01:00
|
|
|
}
|
2021-04-01 13:31:55 -07:00
|
|
|
.docblock pre code, .docblock-short pre code {
|
2016-11-06 21:03:08 +01:00
|
|
|
padding: 0;
|
2015-07-12 19:42:42 -04:00
|
|
|
}
|
2013-11-11 15:16:23 +01:00
|
|
|
pre {
|
2016-11-06 21:03:08 +01:00
|
|
|
padding: 14px;
|
2024-09-02 15:59:00 +02:00
|
|
|
line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
|
2014-04-25 17:34:32 +09:00
|
|
|
}
|
2023-01-30 11:05:12 -07:00
|
|
|
pre.item-decl {
|
2021-07-15 18:19:07 +02:00
|
|
|
overflow-x: auto;
|
|
|
|
}
|
2023-01-10 18:27:00 +01:00
|
|
|
/* This rule allows to have scrolling on the X axis. */
|
|
|
|
.item-decl .type-contents-toggle {
|
|
|
|
contain: initial;
|
|
|
|
}
|
2014-04-25 17:34:32 +09:00
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.src .content pre {
|
2016-11-06 21:03:08 +01:00
|
|
|
padding: 20px;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
2024-09-02 15:59:00 +02:00
|
|
|
.rustdoc.src .example-wrap .src-line-numbers {
|
2022-12-23 22:55:04 -07:00
|
|
|
padding: 20px 0 20px 4px;
|
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2016-01-02 21:38:36 -05:00
|
|
|
img {
|
2016-11-06 21:03:08 +01:00
|
|
|
max-width: 100%;
|
2016-01-02 21:38:36 -05:00
|
|
|
}
|
|
|
|
|
2023-12-17 23:06:31 -07:00
|
|
|
.logo-container {
|
rustdoc: clean up `.logo-container` layout CSS
This commit should result in no appearance changes.
To make the logo container exactly the desired height, you want to get rid
of the part of the box used for typographic descenders (you know, the part
of g, y, and j that descends below the baseline). After all, it contains no
text, but the space is still left open in the layout by default, because
`<img>` is `display:inline`. The CSS used to employ three different tricks
to accomplish this:
* By making `.sidebar .logo-container` a flex container, the image becomes
a flex item and is [blockified], without synthesizing any inline boxes.
No inline boxes means no descenders.
* By giving `.mobile-topbar .logo-container` a max-height exactly the same
as the height of the image plus the padding, the descender area gets
cut off.
* By setting `.sub-logo-container { line-height: 0 }`, we ensure that the
only box that contributes to the height of the line box is the image
itself, and not any zero-content text boxes that neighbor it. See the
[logical height algorithm].
This commit gets rid of the first two hacks, leaving only the third,
since it requires only one line of code to accomplish and doesn't require
setting the value based on math.
[blockified]: https://drafts.csswg.org/css-flexbox-1/#flex-items
[logical height algorithm]: https://www.w3.org/TR/css-inline-3/#inline-height
2022-11-04 15:13:13 -07:00
|
|
|
/* zero text boxes so that computed line height = image height exactly */
|
2022-10-20 13:22:36 -07:00
|
|
|
line-height: 0;
|
2023-01-04 13:04:30 -07:00
|
|
|
display: block;
|
2021-10-24 22:41:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-06 18:20:28 +01:00
|
|
|
.rust-logo {
|
|
|
|
filter: var(--rust-logo-filter);
|
|
|
|
}
|
|
|
|
|
2013-09-18 22:18:38 -07:00
|
|
|
.sidebar {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 0.875rem;
|
2023-09-27 08:59:32 -07:00
|
|
|
flex: 0 0 var(--desktop-sidebar-width);
|
2023-10-07 11:10:36 -07:00
|
|
|
width: var(--desktop-sidebar-width);
|
2021-11-17 14:45:17 +01:00
|
|
|
overflow-y: scroll;
|
2023-04-10 16:15:51 -07:00
|
|
|
overscroll-behavior: contain;
|
2021-10-24 20:03:13 +02:00
|
|
|
position: sticky;
|
|
|
|
height: 100vh;
|
2021-11-29 15:55:05 +01:00
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2023-12-31 22:25:46 +01:00
|
|
|
z-index: var(--desktop-sidebar-z-index);
|
2020-04-07 22:10:17 +02:00
|
|
|
}
|
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.rustdoc.src .sidebar {
|
2022-11-16 22:52:30 -07:00
|
|
|
flex-basis: 50px;
|
2023-12-18 12:11:14 -07:00
|
|
|
width: 50px;
|
2021-10-10 19:08:08 +02:00
|
|
|
border-right: 1px solid;
|
|
|
|
overflow-x: hidden;
|
2021-10-24 21:59:53 +02:00
|
|
|
/* The sidebar is by default hidden */
|
|
|
|
overflow-y: hidden;
|
|
|
|
}
|
|
|
|
|
2023-09-07 18:45:24 -07:00
|
|
|
.hide-sidebar .sidebar,
|
|
|
|
.hide-sidebar .sidebar-resizer {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-resizer {
|
|
|
|
touch-action: none;
|
|
|
|
width: 9px;
|
|
|
|
cursor: col-resize;
|
2023-12-31 22:25:46 +01:00
|
|
|
z-index: calc(var(--desktop-sidebar-z-index) + 1);
|
2023-10-07 11:10:36 -07:00
|
|
|
position: fixed;
|
2023-09-07 18:45:24 -07:00
|
|
|
height: 100%;
|
|
|
|
/* make sure there's a 1px gap between the scrollbar and resize handle */
|
2023-09-27 08:59:32 -07:00
|
|
|
left: calc(var(--desktop-sidebar-width) + 1px);
|
2023-09-07 18:45:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.rustdoc.src .sidebar-resizer {
|
2023-12-18 12:11:14 -07:00
|
|
|
/* when closed, place resizer glow on top of the normal src sidebar border (no need to
|
|
|
|
worry about sidebar) */
|
2023-09-07 18:45:24 -07:00
|
|
|
left: 49px;
|
|
|
|
}
|
|
|
|
|
2023-12-17 23:06:31 -07:00
|
|
|
.src-sidebar-expanded .src .sidebar-resizer {
|
2023-09-07 18:45:24 -07:00
|
|
|
/* for src sidebar, gap is already provided by 1px border on sidebar itself, so place resizer
|
|
|
|
to right of it */
|
2023-09-27 08:59:32 -07:00
|
|
|
left: var(--src-sidebar-width);
|
2023-09-07 18:45:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-resizing {
|
|
|
|
-moz-user-select: none;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-resizing * {
|
|
|
|
cursor: col-resize !important;
|
|
|
|
}
|
|
|
|
|
2023-10-07 11:10:36 -07:00
|
|
|
.sidebar-resizing .sidebar {
|
|
|
|
position: fixed;
|
|
|
|
}
|
|
|
|
.sidebar-resizing > body {
|
|
|
|
padding-left: var(--resizing-sidebar-width);
|
|
|
|
}
|
|
|
|
|
2023-09-07 18:45:24 -07:00
|
|
|
.sidebar-resizer:hover,
|
|
|
|
.sidebar-resizer:active,
|
|
|
|
.sidebar-resizer:focus,
|
|
|
|
.sidebar-resizer.active {
|
|
|
|
width: 10px;
|
|
|
|
margin: 0;
|
|
|
|
/* when active or hovered, place resizer glow on top of the sidebar (right next to, or even
|
|
|
|
on top of, the scrollbar) */
|
2023-09-27 08:59:32 -07:00
|
|
|
left: var(--desktop-sidebar-width);
|
2023-09-07 18:45:24 -07:00
|
|
|
border-left: solid 1px var(--sidebar-resizer-hover);
|
|
|
|
}
|
|
|
|
|
|
|
|
.src-sidebar-expanded .rustdoc.src .sidebar-resizer:hover,
|
|
|
|
.src-sidebar-expanded .rustdoc.src .sidebar-resizer:active,
|
|
|
|
.src-sidebar-expanded .rustdoc.src .sidebar-resizer:focus,
|
|
|
|
.src-sidebar-expanded .rustdoc.src .sidebar-resizer.active {
|
|
|
|
/* when active or hovered, place resizer glow on top of the normal src sidebar border */
|
2023-09-27 08:59:32 -07:00
|
|
|
left: calc(var(--src-sidebar-width) - 1px);
|
2023-09-07 18:45:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@media (pointer: coarse) {
|
|
|
|
.sidebar-resizer {
|
|
|
|
/* too easy to hit the resizer while trying to hit the [-] toggle */
|
|
|
|
display: none !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-resizer.active {
|
|
|
|
/* make the resize tool bigger when actually resizing, to avoid :hover styles on other stuff
|
2023-10-07 11:10:36 -07:00
|
|
|
while resizing */
|
2023-09-07 18:45:24 -07:00
|
|
|
padding: 0 140px;
|
|
|
|
width: 2px;
|
|
|
|
margin-left: -140px;
|
|
|
|
border-left: none;
|
|
|
|
}
|
|
|
|
.sidebar-resizer.active:before {
|
|
|
|
border-left: solid 2px var(--sidebar-resizer-active);
|
|
|
|
display: block;
|
|
|
|
height: 100%;
|
|
|
|
content: "";
|
2021-10-24 21:59:53 +02:00
|
|
|
}
|
|
|
|
|
2022-12-27 13:59:00 -07:00
|
|
|
.sidebar, .mobile-topbar, .sidebar-menu-toggle,
|
2023-12-17 23:06:31 -07:00
|
|
|
#src-sidebar {
|
2022-06-24 17:03:04 +02:00
|
|
|
background-color: var(--sidebar-background-color);
|
|
|
|
}
|
|
|
|
|
2023-12-18 12:11:14 -07:00
|
|
|
.src .sidebar > * {
|
2021-10-24 21:59:53 +02:00
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.src-sidebar-expanded .src .sidebar {
|
2021-10-24 21:59:53 +02:00
|
|
|
overflow-y: auto;
|
2023-09-27 08:59:32 -07:00
|
|
|
flex-basis: var(--src-sidebar-width);
|
2023-10-07 11:10:36 -07:00
|
|
|
width: var(--src-sidebar-width);
|
2021-10-24 21:59:53 +02:00
|
|
|
}
|
|
|
|
|
2023-12-18 12:11:14 -07:00
|
|
|
.src-sidebar-expanded .src .sidebar > * {
|
2021-10-24 21:59:53 +02:00
|
|
|
visibility: visible;
|
2021-10-10 00:52:14 +02:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
#all-types {
|
|
|
|
margin-top: 1em;
|
|
|
|
}
|
|
|
|
|
2020-04-07 22:10:17 +02:00
|
|
|
/* Improve the scrollbar display on firefox */
|
|
|
|
* {
|
|
|
|
scrollbar-width: initial;
|
2022-07-11 14:51:39 +02:00
|
|
|
scrollbar-color: var(--scrollbar-color);
|
2020-04-07 22:10:17 +02:00
|
|
|
}
|
|
|
|
.sidebar {
|
2020-04-01 16:12:40 +02:00
|
|
|
scrollbar-width: thin;
|
2022-07-11 14:51:39 +02:00
|
|
|
scrollbar-color: var(--scrollbar-color);
|
2020-04-01 16:12:40 +02:00
|
|
|
}
|
|
|
|
|
2020-04-07 22:10:17 +02:00
|
|
|
/* Improve the scrollbar display on webkit-based browsers */
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
width: 12px;
|
|
|
|
}
|
2020-04-01 16:12:40 +02:00
|
|
|
.sidebar::-webkit-scrollbar {
|
|
|
|
width: 8px;
|
|
|
|
}
|
2020-04-07 22:10:17 +02:00
|
|
|
::-webkit-scrollbar-track {
|
2020-04-01 16:12:40 +02:00
|
|
|
-webkit-box-shadow: inset 0;
|
2022-07-11 14:51:39 +02:00
|
|
|
background-color: var(--scrollbar-track-background-color);
|
|
|
|
}
|
|
|
|
.sidebar::-webkit-scrollbar-track {
|
|
|
|
background-color: var(--scrollbar-track-background-color);
|
|
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
|
|
|
|
background-color: var(--scrollbar-thumb-background-color);
|
2017-02-15 20:21:25 -05:00
|
|
|
}
|
|
|
|
|
2013-09-18 22:18:38 -07:00
|
|
|
/* Everything else */
|
|
|
|
|
2019-11-11 16:54:45 +01:00
|
|
|
.hidden {
|
2018-02-01 23:40:23 +01:00
|
|
|
display: none !important;
|
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2019-04-29 11:45:06 +02:00
|
|
|
.logo-container > img {
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
height: 48px;
|
|
|
|
width: 48px;
|
2019-04-29 11:45:06 +02:00
|
|
|
}
|
|
|
|
|
2022-10-10 11:37:19 -07:00
|
|
|
ul.block, .block li {
|
2016-11-06 21:03:08 +01:00
|
|
|
padding: 0;
|
2022-02-03 22:50:32 -08:00
|
|
|
margin: 0;
|
2016-11-06 21:03:08 +01:00
|
|
|
list-style: none;
|
2015-09-09 00:46:44 +09:00
|
|
|
}
|
2014-03-18 01:44:55 -06:00
|
|
|
|
2022-11-30 07:51:18 -07:00
|
|
|
.sidebar-elems a,
|
|
|
|
.sidebar > h2 a {
|
2016-11-06 21:03:08 +01:00
|
|
|
display: block;
|
2022-11-30 07:51:18 -07:00
|
|
|
padding: 0.25rem; /* 4px */
|
2023-09-07 18:45:24 -07:00
|
|
|
margin-right: 0.25rem;
|
2024-07-01 17:08:49 -07:00
|
|
|
/* extend click target to far edge of screen (mile wide bar) */
|
|
|
|
border-left: solid var(--sidebar-elems-left-padding) transparent;
|
|
|
|
margin-left: calc(-0.25rem - var(--sidebar-elems-left-padding));
|
2024-07-15 16:20:37 -07:00
|
|
|
background-clip: border-box;
|
2014-03-18 01:44:55 -06:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.sidebar h2 {
|
2024-07-19 09:00:50 -07:00
|
|
|
text-wrap: balance;
|
2022-10-18 11:14:01 -07:00
|
|
|
overflow-wrap: anywhere;
|
2021-07-16 21:58:23 -07:00
|
|
|
padding: 0;
|
2022-10-29 09:04:31 -07:00
|
|
|
margin: 0.7rem 0;
|
2017-10-10 23:39:10 +02:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.sidebar h3 {
|
2024-07-19 09:00:50 -07:00
|
|
|
text-wrap: balance;
|
|
|
|
overflow-wrap: anywhere;
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.125rem; /* 18px */
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
2017-10-10 23:39:10 +02:00
|
|
|
}
|
|
|
|
|
2022-10-18 11:14:01 -07:00
|
|
|
.sidebar-elems,
|
2023-09-18 17:48:18 -07:00
|
|
|
.sidebar > .version,
|
2022-10-18 11:14:01 -07:00
|
|
|
.sidebar > h2 {
|
2024-07-01 17:08:49 -07:00
|
|
|
padding-left: var(--sidebar-elems-left-padding);
|
2022-10-18 11:14:01 -07:00
|
|
|
}
|
|
|
|
|
2023-01-19 16:30:05 -07:00
|
|
|
.sidebar a {
|
2022-09-24 15:49:10 +02:00
|
|
|
color: var(--sidebar-link-color);
|
|
|
|
}
|
|
|
|
.sidebar .current,
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
.sidebar .current a,
|
|
|
|
.sidebar-crate a.logo-container:hover + h2 a,
|
2023-01-04 13:04:30 -07:00
|
|
|
.sidebar a:hover:not(.logo-container) {
|
2022-09-24 15:49:10 +02:00
|
|
|
background-color: var(--sidebar-current-link-background-color);
|
|
|
|
}
|
|
|
|
|
2022-02-08 17:04:53 +01:00
|
|
|
.sidebar-elems .block {
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
margin-bottom: 2em;
|
2017-10-10 23:39:10 +02:00
|
|
|
}
|
|
|
|
|
2022-02-08 17:04:53 +01:00
|
|
|
.sidebar-elems .block li a {
|
|
|
|
white-space: nowrap;
|
2022-11-30 07:51:18 -07:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
2022-02-08 17:04:53 +01:00
|
|
|
}
|
|
|
|
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
.sidebar-crate {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2023-09-21 11:45:13 -07:00
|
|
|
/* there's a 10px padding at the top of <main>, and a 4px margin at the
|
|
|
|
top of the search form. To line them up, add them. */
|
2023-09-23 12:59:58 -07:00
|
|
|
margin: 14px 32px 1rem;
|
2023-09-19 16:28:18 -07:00
|
|
|
row-gap: 10px;
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
column-gap: 32px;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-crate h2 {
|
|
|
|
flex-grow: 1;
|
|
|
|
/* This setup with the margins and row-gap is designed to make flex-wrap
|
|
|
|
work the way we want. If they're in the side-by-side lockup, there
|
|
|
|
should be a 16px margin to the left of the logo (visually the same as
|
|
|
|
the 24px one on everything else, which are not giant circles) and 8px
|
|
|
|
between it and the crate's name and version. When they're line wrapped,
|
|
|
|
the logo needs to have the same margin on both sides of itself (to
|
|
|
|
center properly) and the crate name and version need 24px on their
|
|
|
|
left margin. */
|
|
|
|
margin: 0 -8px;
|
2023-09-21 11:45:13 -07:00
|
|
|
/* To align this with the search bar, it should not be centered, even when
|
|
|
|
the logo is. */
|
|
|
|
align-self: start;
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-crate .logo-container {
|
2023-09-21 11:45:13 -07:00
|
|
|
/* The logo is expected to have 8px "slop" along its edges, so we can optically
|
|
|
|
center it. */
|
2024-07-01 17:08:49 -07:00
|
|
|
margin: 0 calc(-16px - var(--sidebar-elems-left-padding));
|
|
|
|
padding: 0 var(--sidebar-elems-left-padding);
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
2024-07-15 16:20:37 -07:00
|
|
|
.sidebar-crate .logo-container img {
|
|
|
|
/* When in a horizontal logo lockup, the highlight color of the crate name menu item
|
|
|
|
extends underneath the actual logo (in a vertical lockup, that background highlight
|
|
|
|
extends to the left edge of the screen).
|
|
|
|
|
|
|
|
To prevent a weird-looking colored band from appearing under the logo, cover it up
|
|
|
|
with the sidebar's background. Additionally, the crate name extends slightly above
|
|
|
|
the logo, so that its highlight has a bit of space to let the ascenders breath while
|
|
|
|
also having those ascenders meet exactly with the top of the logo.
|
|
|
|
|
|
|
|
In ANSI art, make it look like this:
|
|
|
|
| ┌─────┐
|
|
|
|
| (R) │ std │
|
|
|
|
| └─────┘
|
|
|
|
|
|
|
|
Not like this (which would happen without the z-index):
|
|
|
|
| ┌────────┐
|
|
|
|
| (│ std │
|
|
|
|
| └────────┘
|
|
|
|
|
|
|
|
Not like this (which would happen without the background):
|
|
|
|
| ┌────────┐
|
|
|
|
| (R) std │
|
|
|
|
| └────────┘
|
|
|
|
|
|
|
|
Nor like this (which would happen without the negative margin):
|
|
|
|
| ─────────┐
|
|
|
|
| (R) │ std │
|
|
|
|
| └─────┘
|
|
|
|
*/
|
|
|
|
margin-top: -16px;
|
|
|
|
border-top: solid 16px transparent;
|
|
|
|
box-sizing: content-box;
|
|
|
|
position: relative;
|
|
|
|
background-clip: border-box;
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
.sidebar-crate h2 a {
|
|
|
|
display: block;
|
2024-07-01 17:08:49 -07:00
|
|
|
/* extend click target to far edge of screen (mile wide bar) */
|
|
|
|
border-left: solid var(--sidebar-elems-left-padding) transparent;
|
2024-07-15 16:20:37 -07:00
|
|
|
background-clip: border-box;
|
2024-07-01 17:08:49 -07:00
|
|
|
margin: 0 calc(-24px + 0.25rem) 0 calc(-0.2rem - var(--sidebar-elems-left-padding));
|
2023-09-21 11:45:13 -07:00
|
|
|
/* Align the sidebar crate link with the search bar, which have different
|
|
|
|
font sizes.
|
|
|
|
|
|
|
|
| | font-size | line-height | total line-height | padding-y | total |
|
|
|
|
|:-------|----------:|------------:|------------------:|----------:|-------------:|
|
|
|
|
| crate | 1.375rem | 1.25 | 1.72rem | x | 2x+1.72rem |
|
|
|
|
| search | 1rem | 1.15 | 1.15rem | 8px | 1.15rem+16px |
|
|
|
|
|
|
|
|
2x + 1.72rem = 1.15rem + 16px
|
|
|
|
2x = 1.15rem + 16px - 1.72rem
|
|
|
|
2x = 16px - 0.57rem
|
|
|
|
x = ( 16px - 0.57rem ) / 2
|
|
|
|
*/
|
|
|
|
padding: calc( ( 16px - 0.57rem ) / 2 ) 0.25rem;
|
2024-01-29 20:40:22 +01:00
|
|
|
padding-left: 0.2rem;
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 11:59:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-crate h2 .version {
|
|
|
|
display: block;
|
|
|
|
font-weight: normal;
|
|
|
|
font-size: 1rem;
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
}
|
|
|
|
|
2023-09-23 15:31:32 -07:00
|
|
|
.sidebar-crate + .version {
|
|
|
|
margin-top: -1rem;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.mobile-topbar {
|
2017-12-06 00:42:33 +01:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2021-05-10 11:39:53 +02:00
|
|
|
.rustdoc .example-wrap {
|
2022-09-21 15:26:15 -07:00
|
|
|
display: flex;
|
2021-03-10 16:40:27 +01:00
|
|
|
position: relative;
|
2022-09-27 09:21:24 -07:00
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
2024-06-03 21:27:29 +02:00
|
|
|
|
2024-08-31 22:28:40 +02:00
|
|
|
.rustdoc .example-wrap > pre,
|
|
|
|
.rustdoc .scraped-example .src-line-numbers {
|
2024-06-03 21:27:29 +02:00
|
|
|
border-radius: 6px;
|
|
|
|
}
|
|
|
|
|
2024-08-31 22:28:40 +02:00
|
|
|
/*
|
|
|
|
If the code example line numbers are displayed, there will be a weird radius in the middle from
|
|
|
|
both the code example and the line numbers, so we need to remove the radius in this case.
|
|
|
|
*/
|
|
|
|
.rustdoc .example-wrap > .example-line-numbers,
|
|
|
|
.rustdoc .scraped-example .src-line-numbers {
|
|
|
|
border-top-right-radius: 0;
|
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
}
|
|
|
|
.rustdoc .example-wrap > .example-line-numbers + pre,
|
|
|
|
.rustdoc .scraped-example .rust {
|
|
|
|
border-top-left-radius: 0;
|
|
|
|
border-bottom-left-radius: 0;
|
|
|
|
}
|
|
|
|
|
2024-09-02 15:59:00 +02:00
|
|
|
.rustdoc .scraped-example {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
2022-09-27 09:21:24 -07:00
|
|
|
/* For the last child of a div, the margin will be taken care of
|
|
|
|
by the margin-top of the next item. */
|
|
|
|
.rustdoc .example-wrap:last-child {
|
|
|
|
margin-bottom: 0px;
|
|
|
|
}
|
2018-10-08 22:51:37 +02:00
|
|
|
|
2023-04-05 09:11:10 -07:00
|
|
|
.rustdoc .example-wrap pre {
|
2018-11-10 21:58:47 +01:00
|
|
|
margin: 0;
|
2022-10-25 10:43:08 -07:00
|
|
|
flex-grow: 1;
|
2023-04-04 16:35:36 +02:00
|
|
|
}
|
|
|
|
|
2024-09-02 15:59:00 +02:00
|
|
|
.scraped-example:not(.expanded) .example-wrap {
|
2024-08-30 18:27:11 +02:00
|
|
|
/* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
|
|
|
|
* of lines shown in the un-expanded example code viewer. This pre needs to have
|
|
|
|
* a max-height equal to line-height * N. The line-height is currently 1.5em,
|
|
|
|
* and we include additional 10px for padding. */
|
|
|
|
max-height: calc(1.5em * 5 + 10px);
|
|
|
|
}
|
|
|
|
|
2024-09-02 15:59:00 +02:00
|
|
|
.rustdoc:not(.src) .scraped-example:not(.expanded) .src-line-numbers,
|
2024-08-30 18:27:11 +02:00
|
|
|
.rustdoc:not(.src) .scraped-example:not(.expanded) pre.rust {
|
|
|
|
padding-bottom: 0;
|
|
|
|
/* See above comment, should be the same max-height. */
|
2023-01-24 16:46:45 +01:00
|
|
|
overflow: auto hidden;
|
2018-11-10 21:58:47 +01:00
|
|
|
}
|
|
|
|
|
2024-08-30 18:27:11 +02:00
|
|
|
.rustdoc:not(.src) .example-wrap pre {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
2023-04-05 09:11:10 -07:00
|
|
|
.rustdoc .example-wrap pre.example-line-numbers,
|
2024-09-02 15:59:00 +02:00
|
|
|
.rustdoc .example-wrap .src-line-numbers {
|
2022-12-20 10:32:35 -07:00
|
|
|
min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */
|
2024-08-30 18:27:11 +02:00
|
|
|
flex-grow: 0;
|
2022-10-25 10:43:08 -07:00
|
|
|
text-align: right;
|
2016-11-06 21:03:08 +01:00
|
|
|
-webkit-user-select: none;
|
|
|
|
user-select: none;
|
2022-12-23 22:55:04 -07:00
|
|
|
padding: 14px 8px;
|
|
|
|
color: var(--src-line-numbers-span-color);
|
2014-12-20 03:56:47 +09:00
|
|
|
}
|
2022-10-25 10:43:08 -07:00
|
|
|
|
2024-09-02 15:59:00 +02:00
|
|
|
.rustdoc .scraped-example .src-line-numbers {
|
2022-12-23 22:55:04 -07:00
|
|
|
padding: 14px 0;
|
2022-10-25 10:43:08 -07:00
|
|
|
}
|
2022-11-12 08:53:12 -07:00
|
|
|
.src-line-numbers a, .src-line-numbers span {
|
2022-10-27 13:07:07 +02:00
|
|
|
color: var(--src-line-numbers-span-color);
|
2022-12-23 22:55:04 -07:00
|
|
|
padding: 0 8px;
|
2022-10-27 13:07:07 +02:00
|
|
|
}
|
|
|
|
.src-line-numbers :target {
|
|
|
|
background-color: transparent;
|
2022-10-28 09:51:57 -07:00
|
|
|
border-right: none;
|
2022-12-23 22:55:04 -07:00
|
|
|
padding: 0 8px;
|
2022-10-28 09:51:57 -07:00
|
|
|
}
|
|
|
|
.src-line-numbers .line-highlighted {
|
|
|
|
background-color: var(--src-line-number-highlighted-background-color);
|
2018-02-01 23:40:23 +01:00
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2022-10-25 10:43:08 -07:00
|
|
|
.search-loading {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
2020-10-08 13:25:36 +02:00
|
|
|
.docblock-short {
|
2022-01-11 17:36:52 -08:00
|
|
|
overflow-wrap: break-word;
|
2020-10-08 13:25:36 +02:00
|
|
|
overflow-wrap: anywhere;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
2021-03-29 21:49:58 +08:00
|
|
|
/* Wrap non-pre code blocks (`text`) but not (```text```). */
|
2022-12-13 10:46:27 -07:00
|
|
|
.docblock :not(pre) > code,
|
|
|
|
.docblock-short code {
|
2021-01-31 01:27:21 +08:00
|
|
|
white-space: pre-wrap;
|
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2022-02-05 05:05:05 -08:00
|
|
|
.top-doc .docblock h2 { font-size: 1.375rem; }
|
2022-07-27 15:00:43 +02:00
|
|
|
.top-doc .docblock h3 { font-size: 1.25rem; }
|
2021-05-16 20:47:03 -07:00
|
|
|
.top-doc .docblock h4,
|
2021-10-18 21:04:38 -07:00
|
|
|
.top-doc .docblock h5 {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.125rem;
|
2021-10-18 21:04:38 -07:00
|
|
|
}
|
2021-10-01 06:17:15 -04:00
|
|
|
.top-doc .docblock h6 {
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1rem;
|
2021-05-16 20:47:03 -07:00
|
|
|
}
|
2017-08-01 17:08:33 -05:00
|
|
|
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
.docblock h5 { font-size: 1rem; }
|
2022-02-05 05:05:05 -08:00
|
|
|
.docblock h6 { font-size: 0.875rem; }
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2016-05-27 12:04:56 +02:00
|
|
|
.docblock {
|
2016-11-06 21:03:08 +01:00
|
|
|
margin-left: 24px;
|
2017-09-17 22:11:37 +02:00
|
|
|
position: relative;
|
2016-05-27 12:04:56 +02:00
|
|
|
}
|
|
|
|
|
2022-09-08 17:46:57 -07:00
|
|
|
.docblock > :not(.more-examples-toggle):not(.example-wrap) {
|
2021-09-08 15:08:11 +02:00
|
|
|
max-width: 100%;
|
|
|
|
overflow-x: auto;
|
|
|
|
}
|
|
|
|
|
2022-09-25 13:09:22 -07:00
|
|
|
.out-of-band {
|
2021-04-22 22:33:54 +02:00
|
|
|
flex-grow: 0;
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.125rem;
|
2016-05-05 04:46:45 +02:00
|
|
|
}
|
|
|
|
|
2022-07-11 14:51:39 +02:00
|
|
|
.docblock code, .docblock-short code,
|
2023-07-14 16:38:01 -07:00
|
|
|
pre, .rustdoc.src .example-wrap {
|
2022-07-11 14:51:39 +02:00
|
|
|
background-color: var(--code-block-background-color);
|
|
|
|
}
|
|
|
|
|
2021-11-29 17:14:05 +01:00
|
|
|
#main-content {
|
2018-02-01 23:40:23 +01:00
|
|
|
position: relative;
|
|
|
|
}
|
2016-05-06 18:47:12 +02:00
|
|
|
|
2015-02-15 15:58:45 +02:00
|
|
|
.docblock table {
|
2016-11-06 21:03:08 +01:00
|
|
|
margin: .5em 0;
|
2022-09-26 09:54:44 -07:00
|
|
|
border-collapse: collapse;
|
2015-02-15 15:58:45 +02:00
|
|
|
}
|
|
|
|
|
2022-12-07 21:59:54 -07:00
|
|
|
.docblock table td, .docblock table th {
|
2016-11-06 21:03:08 +01:00
|
|
|
padding: .5em;
|
2022-12-07 21:59:54 -07:00
|
|
|
border: 1px solid var(--border-color);
|
2015-02-15 15:58:45 +02:00
|
|
|
}
|
|
|
|
|
2022-12-08 09:38:27 -07:00
|
|
|
.docblock table tbody tr:nth-child(2n) {
|
2022-12-07 21:59:54 -07:00
|
|
|
background: var(--table-alt-row-background-color);
|
2015-02-15 15:58:45 +02:00
|
|
|
}
|
|
|
|
|
2024-07-20 22:28:13 +02:00
|
|
|
.docblock .stab, .docblock-short .stab {
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
2023-11-30 10:10:49 -07:00
|
|
|
/* "where ..." clauses with block display are also smaller */
|
|
|
|
div.where {
|
2023-02-02 15:10:41 -07:00
|
|
|
white-space: pre-wrap;
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 0.875rem;
|
2016-10-15 10:29:47 -05:00
|
|
|
}
|
2014-12-27 22:45:13 -05:00
|
|
|
|
2022-04-06 20:41:44 +02:00
|
|
|
.item-info {
|
|
|
|
display: block;
|
2022-10-12 11:24:23 -07:00
|
|
|
margin-left: 24px;
|
2022-04-06 20:41:44 +02:00
|
|
|
}
|
|
|
|
|
2022-10-12 11:24:23 -07:00
|
|
|
.item-info code {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 0.875rem;
|
2015-08-17 20:23:47 +02:00
|
|
|
}
|
|
|
|
|
2021-11-29 17:14:05 +01:00
|
|
|
#main-content > .item-info {
|
2022-01-07 12:39:56 -05:00
|
|
|
margin-left: 0;
|
2018-08-27 21:52:10 +02:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
nav.sub {
|
2021-10-24 22:41:48 +02:00
|
|
|
flex-grow: 1;
|
2022-10-20 13:22:36 -07:00
|
|
|
flex-flow: row nowrap;
|
|
|
|
margin: 4px 0 25px 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2022-10-27 13:36:27 -07:00
|
|
|
.search-form {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
height: 34px;
|
2022-10-20 13:22:36 -07:00
|
|
|
flex-grow: 1;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
2023-07-14 16:38:01 -07:00
|
|
|
.src nav.sub {
|
2022-10-20 13:22:36 -07:00
|
|
|
margin: 0 0 15px 0;
|
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2023-11-29 13:38:56 -07:00
|
|
|
.section-header {
|
2022-11-22 14:48:58 -07:00
|
|
|
/* fields use <span> tags, but should get their own lines */
|
|
|
|
display: block;
|
2021-06-17 09:57:48 +02:00
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
2023-11-29 13:38:56 -07:00
|
|
|
.section-header:hover > .anchor, .impl:hover > .anchor,
|
2022-12-20 12:44:22 -07:00
|
|
|
.trait-impl:hover > .anchor, .variant:hover > .anchor {
|
2017-08-08 22:16:08 +02:00
|
|
|
display: initial;
|
|
|
|
}
|
|
|
|
.anchor {
|
|
|
|
display: none;
|
2017-09-17 22:11:37 +02:00
|
|
|
position: absolute;
|
2021-10-21 18:46:47 -07:00
|
|
|
left: -0.5em;
|
2021-08-06 16:47:35 +02:00
|
|
|
background: none !important;
|
2017-08-08 22:16:08 +02:00
|
|
|
}
|
2017-09-17 22:11:37 +02:00
|
|
|
.anchor.field {
|
2018-02-17 20:46:06 +03:00
|
|
|
left: -5px;
|
2017-09-17 22:11:37 +02:00
|
|
|
}
|
2023-11-29 13:38:56 -07:00
|
|
|
.section-header > .anchor {
|
2021-08-06 16:47:35 +02:00
|
|
|
left: -15px;
|
|
|
|
padding-right: 8px;
|
|
|
|
}
|
2023-11-29 13:38:56 -07:00
|
|
|
h2.section-header > .anchor {
|
2021-08-06 16:47:35 +02:00
|
|
|
padding-right: 6px;
|
2018-03-06 22:05:41 +01:00
|
|
|
}
|
2023-11-14 15:40:31 +01:00
|
|
|
a.doc-anchor {
|
|
|
|
color: var(--main-color);
|
|
|
|
display: none;
|
|
|
|
position: absolute;
|
|
|
|
left: -17px;
|
|
|
|
/* We add this padding so that when the cursor moves from the heading's text to the anchor,
|
|
|
|
the anchor doesn't disappear. */
|
2024-08-03 12:30:38 -07:00
|
|
|
padding-right: 10px;
|
2023-11-14 15:40:31 +01:00
|
|
|
/* And this padding is used to make the anchor larger and easier to click on. */
|
|
|
|
padding-left: 3px;
|
|
|
|
}
|
|
|
|
*:hover > .doc-anchor {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
/* If the first element of the top doc block is a heading, we don't want to ever display its anchor
|
|
|
|
because of the `[-]` element which would overlap with it. */
|
|
|
|
.top-doc > .docblock > *:first-child > .doc-anchor {
|
|
|
|
display: none !important;
|
2022-02-25 15:09:37 +01:00
|
|
|
}
|
2017-08-08 22:16:08 +02:00
|
|
|
|
2022-10-07 17:05:30 -07:00
|
|
|
.main-heading a:hover,
|
2023-04-05 09:11:10 -07:00
|
|
|
.example-wrap .rust a:hover,
|
2022-09-16 13:40:21 -07:00
|
|
|
.all-items a:hover,
|
2024-07-30 15:23:44 +02:00
|
|
|
.docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor),
|
|
|
|
.docblock-short a:not(.scrape-help):not(.tooltip):hover,
|
2022-10-06 11:20:37 -07:00
|
|
|
.item-info a {
|
2016-11-06 21:03:08 +01:00
|
|
|
text-decoration: underline;
|
2015-02-20 13:54:11 +02:00
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2023-09-07 18:45:24 -07:00
|
|
|
.crate.block li.current a { font-weight: 500; }
|
2013-09-18 22:18:38 -07:00
|
|
|
|
2022-01-20 14:47:26 -08:00
|
|
|
/* In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap
|
|
|
|
as much as needed on mobile (see
|
2023-01-05 09:45:44 +01:00
|
|
|
tests/rustdoc-gui/type-declaration-overflow.goml for an example of why
|
2022-01-20 14:47:26 -08:00
|
|
|
this matters). The `anywhere` value means:
|
|
|
|
|
|
|
|
"Soft wrap opportunities introduced by the word break are considered when
|
|
|
|
calculating min-content intrinsic sizes."
|
|
|
|
|
|
|
|
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap#values
|
|
|
|
|
|
|
|
For table layouts, that becomes a problem: the browser tries to make each
|
|
|
|
column as narrow as possible, and `overflow-wrap: anywhere` means it can do
|
|
|
|
so by breaking words - even if some other column could be shrunk without
|
|
|
|
breaking words! This shows up, for instance, in the `Structs` / `Modules` /
|
|
|
|
`Functions` (etcetera) sections of a module page, and when a docblock
|
|
|
|
contains a table.
|
|
|
|
|
|
|
|
So, for table layouts, override the default with break-word, which does
|
|
|
|
_not_ affect min-content intrinsic sizes.
|
|
|
|
*/
|
|
|
|
table,
|
|
|
|
.item-table {
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
}
|
|
|
|
|
2021-06-18 00:33:42 +02:00
|
|
|
.item-table {
|
2021-10-11 00:38:56 +02:00
|
|
|
display: table;
|
2023-02-07 19:00:18 -07:00
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
2024-07-21 02:28:04 +02:00
|
|
|
width: 100%;
|
2021-05-25 00:36:36 +02:00
|
|
|
}
|
2023-02-07 19:00:18 -07:00
|
|
|
.item-table > li {
|
2021-09-12 01:18:39 +02:00
|
|
|
display: table-row;
|
|
|
|
}
|
2023-02-07 19:00:18 -07:00
|
|
|
.item-table > li > div {
|
2021-09-12 01:18:39 +02:00
|
|
|
display: table-cell;
|
2021-05-25 00:36:36 +02:00
|
|
|
}
|
2023-02-07 19:00:18 -07:00
|
|
|
.item-table > li > .item-name {
|
2022-02-05 05:05:05 -08:00
|
|
|
padding-right: 1.25rem;
|
2021-05-25 00:36:36 +02:00
|
|
|
}
|
|
|
|
|
2022-01-01 23:48:34 -05:00
|
|
|
.search-results-title {
|
2022-07-03 20:10:19 +02:00
|
|
|
margin-top: 0;
|
|
|
|
white-space: nowrap;
|
|
|
|
/* flex layout allows shrinking the <select> appropriately if it becomes too large */
|
2022-11-23 13:28:06 -07:00
|
|
|
display: flex;
|
2022-07-03 20:10:19 +02:00
|
|
|
/* make things look like in a line, despite the fact that we're using a layout
|
|
|
|
with boxes (i.e. from the flex layout) */
|
|
|
|
align-items: baseline;
|
2022-01-01 23:48:34 -05:00
|
|
|
}
|
2022-07-03 20:10:19 +02:00
|
|
|
#crate-search-div {
|
|
|
|
/* ensures that 100% in properties of #crate-search-div:after
|
|
|
|
are relative to the size of this div */
|
|
|
|
position: relative;
|
|
|
|
/* allows this div (and with it the <select>-element "#crate-search") to be shrunk */
|
|
|
|
min-width: 5em;
|
2022-01-01 23:48:34 -05:00
|
|
|
}
|
2018-10-01 00:47:54 +02:00
|
|
|
#crate-search {
|
2021-02-19 17:54:41 -08:00
|
|
|
min-width: 115px;
|
2022-10-29 09:04:31 -07:00
|
|
|
padding: 0 23px 0 4px;
|
2022-07-03 20:10:19 +02:00
|
|
|
/* prevents the <select> from overflowing the containing div in case it's shrunk */
|
|
|
|
max-width: 100%;
|
|
|
|
/* contents can overflow because of max-width limit, then show ellipsis */
|
|
|
|
text-overflow: ellipsis;
|
2022-08-13 14:00:23 +02:00
|
|
|
border: 1px solid var(--border-color);
|
2022-01-01 23:48:34 -05:00
|
|
|
border-radius: 4px;
|
2018-10-01 00:47:54 +02:00
|
|
|
outline: none;
|
|
|
|
cursor: pointer;
|
|
|
|
-moz-appearance: none;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
/* Removes default arrow from firefox */
|
2022-07-03 20:10:19 +02:00
|
|
|
text-indent: 0.01px;
|
|
|
|
background-color: var(--main-background-color);
|
2022-09-28 13:52:13 -07:00
|
|
|
color: inherit;
|
|
|
|
line-height: 1.5;
|
|
|
|
font-weight: 500;
|
2022-07-03 20:10:19 +02:00
|
|
|
}
|
2022-11-07 18:08:14 +01:00
|
|
|
#crate-search:hover, #crate-search:focus {
|
|
|
|
border-color: var(--crate-search-hover-border);
|
|
|
|
}
|
2022-07-03 20:10:19 +02:00
|
|
|
/* pseudo-element for holding the dropdown-arrow image; needs to be a separate thing
|
|
|
|
so that we can apply CSS-filters to change the arrow color in themes */
|
|
|
|
#crate-search-div::after {
|
|
|
|
/* lets clicks through! */
|
|
|
|
pointer-events: none;
|
|
|
|
/* completely covers the underlying div */
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
content: "";
|
2018-11-29 01:29:49 +01:00
|
|
|
background-repeat: no-repeat;
|
2018-12-08 16:35:51 +01:00
|
|
|
background-size: 20px;
|
2022-07-03 20:10:19 +02:00
|
|
|
background-position: calc(100% - 2px) 56%;
|
2023-01-31 21:23:23 +01:00
|
|
|
/* down arrow (image is black color) */
|
|
|
|
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
|
|
|
width="128" height="128" viewBox="-30 -20 176 176"><path d="M111,40.5L64,87.499L17,40.5" \
|
|
|
|
fill="none" stroke="black" strike-linecap="square" stroke-miterlimit="10" stroke-width="12"/> \
|
|
|
|
</svg>');
|
2022-11-07 18:08:14 +01:00
|
|
|
/* changes the arrow image color */
|
|
|
|
filter: var(--crate-search-div-filter);
|
|
|
|
}
|
|
|
|
#crate-search-div:hover::after, #crate-search-div:focus-within::after {
|
|
|
|
filter: var(--crate-search-div-hover-filter);
|
2022-07-03 20:10:19 +02:00
|
|
|
}
|
|
|
|
#crate-search > option {
|
|
|
|
font-size: 1rem;
|
2018-10-01 00:47:54 +02:00
|
|
|
}
|
2013-09-18 22:18:38 -07:00
|
|
|
.search-input {
|
2021-12-08 23:39:42 -08:00
|
|
|
/* Override Normalize.css: it has a rule that sets
|
|
|
|
-webkit-appearance: textfield for search inputs. That
|
|
|
|
causes rounded corners and no border on iOS Safari. */
|
|
|
|
-webkit-appearance: none;
|
2016-11-06 21:03:08 +01:00
|
|
|
outline: none;
|
2022-08-13 14:00:23 +02:00
|
|
|
border: 1px solid var(--border-color);
|
2022-01-20 14:18:59 +01:00
|
|
|
border-radius: 2px;
|
2022-01-27 17:55:39 +01:00
|
|
|
padding: 8px;
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1rem;
|
2022-10-27 13:36:27 -07:00
|
|
|
flex-grow: 1;
|
2022-08-13 14:00:23 +02:00
|
|
|
background-color: var(--button-background-color);
|
2022-10-06 13:01:07 +02:00
|
|
|
color: var(--search-color);
|
2014-03-18 01:44:55 -06:00
|
|
|
}
|
2022-09-02 15:08:23 +02:00
|
|
|
.search-input:focus {
|
|
|
|
border-color: var(--search-input-focused-border-color);
|
|
|
|
}
|
2014-03-18 01:44:55 -06:00
|
|
|
|
2021-05-09 12:56:21 -07:00
|
|
|
.search-results {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-results.active {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
2021-05-21 16:39:03 +02:00
|
|
|
.search-results > a {
|
2022-11-04 12:34:24 -07:00
|
|
|
display: flex;
|
2021-05-09 12:56:21 -07:00
|
|
|
/* A little margin ensures the browser's outlining of focused links has room to display. */
|
|
|
|
margin-left: 2px;
|
|
|
|
margin-right: 2px;
|
2022-11-04 22:36:04 +01:00
|
|
|
border-bottom: 1px solid var(--search-result-border-color);
|
2022-11-04 12:34:24 -07:00
|
|
|
gap: 1em;
|
2014-08-31 17:11:42 -04:00
|
|
|
}
|
|
|
|
|
2022-11-04 13:19:33 -07:00
|
|
|
.search-results > a > div.desc {
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2022-11-04 12:34:24 -07:00
|
|
|
overflow: hidden;
|
2023-06-27 15:05:43 +02:00
|
|
|
flex: 2;
|
2021-05-21 16:39:03 +02:00
|
|
|
}
|
|
|
|
|
2022-10-01 15:50:47 +02:00
|
|
|
.search-results a:hover,
|
|
|
|
.search-results a:focus {
|
|
|
|
background-color: var(--search-result-link-focus-background-color);
|
|
|
|
}
|
|
|
|
|
2023-06-27 15:05:43 +02:00
|
|
|
.search-results .result-name {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: start;
|
|
|
|
flex: 3;
|
|
|
|
}
|
2023-07-18 14:22:27 +02:00
|
|
|
.search-results .result-name .alias {
|
2022-11-21 11:15:41 +01:00
|
|
|
color: var(--search-results-alias-color);
|
|
|
|
}
|
2023-04-22 16:00:20 +02:00
|
|
|
.search-results .result-name .grey {
|
2022-11-21 11:15:41 +01:00
|
|
|
color: var(--search-results-grey-color);
|
|
|
|
}
|
2023-06-16 23:18:57 +02:00
|
|
|
.search-results .result-name .typename {
|
|
|
|
color: var(--search-results-grey-color);
|
|
|
|
font-size: 0.875rem;
|
2023-06-27 15:05:43 +02:00
|
|
|
width: var(--search-typename-width);
|
|
|
|
}
|
|
|
|
.search-results .result-name .path {
|
|
|
|
word-break: break-all;
|
|
|
|
max-width: calc(100% - var(--search-typename-width));
|
|
|
|
display: inline-block;
|
2023-06-16 23:18:57 +02:00
|
|
|
}
|
2023-07-18 14:22:27 +02:00
|
|
|
.search-results .result-name .path > * {
|
|
|
|
display: inline;
|
|
|
|
}
|
2022-11-21 11:15:41 +01:00
|
|
|
|
2022-06-20 16:28:52 +02:00
|
|
|
.popover {
|
|
|
|
position: absolute;
|
2022-12-01 14:24:33 -07:00
|
|
|
top: 100%;
|
2022-06-20 16:28:52 +02:00
|
|
|
right: 0;
|
2023-12-31 22:25:46 +01:00
|
|
|
z-index: calc(var(--desktop-sidebar-z-index) + 1);
|
2022-06-20 16:28:52 +02:00
|
|
|
margin-top: 7px;
|
|
|
|
border-radius: 3px;
|
2022-08-13 14:00:23 +02:00
|
|
|
border: 1px solid var(--border-color);
|
2022-12-13 11:00:34 -07:00
|
|
|
background-color: var(--main-background-color);
|
|
|
|
color: var(--main-color);
|
2022-11-08 18:00:22 -07:00
|
|
|
--popover-arrow-offset: 11px;
|
2015-07-08 14:52:58 +01:00
|
|
|
}
|
|
|
|
|
2022-06-20 16:28:52 +02:00
|
|
|
/* This rule is to draw the little arrow connecting the settings menu to the gear icon. */
|
|
|
|
.popover::before {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
2022-11-08 18:00:22 -07:00
|
|
|
right: var(--popover-arrow-offset);
|
2022-08-13 14:00:23 +02:00
|
|
|
border: solid var(--border-color);
|
2022-06-20 16:28:52 +02:00
|
|
|
border-width: 1px 1px 0 0;
|
2022-12-13 11:00:34 -07:00
|
|
|
background-color: var(--main-background-color);
|
2022-06-20 16:28:52 +02:00
|
|
|
padding: 4px;
|
|
|
|
transform: rotate(-45deg);
|
|
|
|
top: -5px;
|
2015-07-08 14:52:58 +01:00
|
|
|
}
|
2022-06-20 16:28:52 +02:00
|
|
|
|
2023-09-13 11:09:04 +02:00
|
|
|
.setting-line {
|
|
|
|
margin: 1.2em 0.6em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.setting-radio input, .setting-check input {
|
|
|
|
margin-right: 0.3em;
|
|
|
|
height: 1.2rem;
|
|
|
|
width: 1.2rem;
|
|
|
|
border: 2px solid var(--settings-input-border-color);
|
|
|
|
outline: none;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.setting-radio input {
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.setting-radio span, .setting-check span {
|
|
|
|
padding-bottom: 1px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.setting-radio {
|
|
|
|
margin-top: 0.1em;
|
|
|
|
margin-bottom: 0.1em;
|
|
|
|
min-width: 3.8em;
|
|
|
|
padding: 0.3em;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.setting-radio + .setting-radio {
|
|
|
|
margin-left: 0.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.setting-check {
|
|
|
|
margin-right: 20px;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.setting-radio input:checked {
|
|
|
|
box-shadow: inset 0 0 0 3px var(--main-background-color);
|
|
|
|
background-color: var(--settings-input-color);
|
|
|
|
}
|
|
|
|
.setting-check input:checked {
|
|
|
|
background-color: var(--settings-input-color);
|
|
|
|
border-width: 1px;
|
2024-04-10 20:36:02 +02:00
|
|
|
/* cross-mark image in the settings checkboxes */
|
2023-09-13 11:09:04 +02:00
|
|
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">\
|
|
|
|
<path d="M7,25L17,32L33,12" fill="none" stroke="black" stroke-width="5"/>\
|
|
|
|
<path d="M7,23L17,30L33,10" fill="none" stroke="white" stroke-width="5"/></svg>');
|
|
|
|
}
|
|
|
|
.setting-radio input:focus, .setting-check input:focus {
|
|
|
|
box-shadow: 0 0 1px 1px var(--settings-input-color);
|
|
|
|
}
|
|
|
|
/* In here we combine both `:focus` and `:checked` properties. */
|
|
|
|
.setting-radio input:checked:focus {
|
|
|
|
box-shadow: inset 0 0 0 3px var(--main-background-color),
|
|
|
|
0 0 2px 2px var(--settings-input-color);
|
|
|
|
}
|
|
|
|
.setting-radio input:hover, .setting-check input:hover {
|
|
|
|
border-color: var(--settings-input-color) !important;
|
|
|
|
}
|
|
|
|
|
2022-10-14 09:48:19 -07:00
|
|
|
/* use larger max-width for help popover, but not for help.html */
|
|
|
|
#help.popover {
|
2022-06-20 16:28:52 +02:00
|
|
|
max-width: 600px;
|
2022-11-08 18:00:22 -07:00
|
|
|
--popover-arrow-offset: 48px;
|
2022-06-20 16:28:52 +02:00
|
|
|
}
|
|
|
|
|
2022-10-14 09:48:19 -07:00
|
|
|
#help dt {
|
2016-11-06 21:03:08 +01:00
|
|
|
float: left;
|
|
|
|
clear: left;
|
2021-02-02 16:15:57 -05:00
|
|
|
margin-right: 0.5rem;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
2022-10-14 09:48:19 -07:00
|
|
|
#help span.top, #help span.bottom {
|
2020-10-19 13:44:27 +02:00
|
|
|
text-align: center;
|
|
|
|
display: block;
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1.125rem;
|
2021-09-15 13:37:29 +02:00
|
|
|
}
|
2022-10-14 09:48:19 -07:00
|
|
|
#help span.top {
|
2021-09-15 13:37:29 +02:00
|
|
|
margin: 10px 0;
|
2022-08-13 14:00:23 +02:00
|
|
|
border-bottom: 1px solid var(--border-color);
|
2020-10-19 13:44:27 +02:00
|
|
|
padding-bottom: 4px;
|
|
|
|
margin-bottom: 6px;
|
|
|
|
}
|
2022-10-14 09:48:19 -07:00
|
|
|
#help span.bottom {
|
2021-09-15 13:37:29 +02:00
|
|
|
clear: both;
|
2022-08-13 14:00:23 +02:00
|
|
|
border-top: 1px solid var(--border-color);
|
2021-09-15 13:37:29 +02:00
|
|
|
}
|
2022-06-20 16:28:52 +02:00
|
|
|
.side-by-side > div {
|
2016-11-06 21:03:08 +01:00
|
|
|
width: 50%;
|
|
|
|
float: left;
|
2022-06-20 16:28:52 +02:00
|
|
|
padding: 0 20px 20px 17px;
|
2013-09-18 22:18:38 -07:00
|
|
|
}
|
2013-09-26 12:53:06 -07:00
|
|
|
|
2021-07-18 12:25:49 +02:00
|
|
|
.item-info .stab {
|
2023-12-06 15:33:01 +01:00
|
|
|
display: block;
|
2016-11-06 21:03:08 +01:00
|
|
|
padding: 3px;
|
|
|
|
margin-bottom: 5px;
|
2022-12-09 10:40:49 -07:00
|
|
|
}
|
2023-02-07 19:00:18 -07:00
|
|
|
.item-name .stab {
|
2022-12-09 10:40:49 -07:00
|
|
|
margin-left: 0.3125em;
|
|
|
|
}
|
|
|
|
.stab {
|
|
|
|
padding: 0 2px;
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 0.875rem;
|
2021-06-08 11:04:53 -07:00
|
|
|
font-weight: normal;
|
2022-10-03 15:31:59 +02:00
|
|
|
color: var(--main-color);
|
|
|
|
background-color: var(--stab-background-color);
|
2022-12-09 10:40:49 -07:00
|
|
|
width: fit-content;
|
|
|
|
white-space: pre-wrap;
|
|
|
|
border-radius: 3px;
|
2023-07-03 13:26:08 +02:00
|
|
|
display: inline;
|
2022-12-13 11:09:38 -07:00
|
|
|
vertical-align: baseline;
|
2022-10-03 15:31:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.stab.portability > code {
|
|
|
|
background: none;
|
|
|
|
color: var(--stab-code-color);
|
2014-06-26 11:37:39 -07:00
|
|
|
}
|
|
|
|
|
2023-12-06 15:33:01 +01:00
|
|
|
.stab .emoji, .item-info .stab::before {
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 1.25rem;
|
2023-12-06 15:33:01 +01:00
|
|
|
}
|
|
|
|
.stab .emoji {
|
2022-08-18 15:47:39 +02:00
|
|
|
margin-right: 0.3rem;
|
2017-01-04 22:09:54 -08:00
|
|
|
}
|
2023-12-06 15:33:01 +01:00
|
|
|
.item-info .stab::before {
|
|
|
|
/* ensure badges with emoji and without it have same height */
|
|
|
|
content: "\0";
|
|
|
|
width: 0;
|
|
|
|
display: inline-block;
|
|
|
|
color: transparent;
|
|
|
|
}
|
2017-01-04 22:09:54 -08:00
|
|
|
|
2021-03-23 12:23:45 +01:00
|
|
|
/* Black one-pixel outline around emoji shapes */
|
|
|
|
.emoji {
|
|
|
|
text-shadow:
|
|
|
|
1px 0 0 black,
|
|
|
|
-1px 0 0 black,
|
2023-12-06 15:33:01 +01:00
|
|
|
0 1px 0 black,
|
2021-03-23 12:23:45 +01:00
|
|
|
0 -1px 0 black;
|
|
|
|
}
|
|
|
|
|
2016-05-06 18:47:12 +02:00
|
|
|
.since {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-weight: normal;
|
|
|
|
font-size: initial;
|
2016-02-09 21:15:29 -05:00
|
|
|
}
|
|
|
|
|
2021-12-03 17:09:04 -08:00
|
|
|
.rightside {
|
2018-12-26 21:23:05 -08:00
|
|
|
padding-left: 12px;
|
2022-08-27 00:37:04 +02:00
|
|
|
float: right;
|
2018-12-26 21:23:05 -08:00
|
|
|
}
|
|
|
|
|
2022-09-02 15:08:23 +02:00
|
|
|
.rightside:not(a),
|
|
|
|
.out-of-band {
|
|
|
|
color: var(--right-side-color);
|
|
|
|
}
|
|
|
|
|
2022-10-04 16:56:56 +02:00
|
|
|
pre.rust {
|
|
|
|
tab-size: 4;
|
|
|
|
-moz-tab-size: 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Code highlighting */
|
|
|
|
pre.rust .kw {
|
|
|
|
color: var(--code-highlight-kw-color);
|
|
|
|
}
|
|
|
|
pre.rust .kw-2 {
|
|
|
|
color: var(--code-highlight-kw-2-color);
|
|
|
|
}
|
|
|
|
pre.rust .lifetime {
|
|
|
|
color: var(--code-highlight-lifetime-color);
|
|
|
|
}
|
|
|
|
pre.rust .prelude-ty {
|
|
|
|
color: var(--code-highlight-prelude-color);
|
|
|
|
}
|
|
|
|
pre.rust .prelude-val {
|
|
|
|
color: var(--code-highlight-prelude-val-color);
|
|
|
|
}
|
|
|
|
pre.rust .string {
|
|
|
|
color: var(--code-highlight-string-color);
|
|
|
|
}
|
|
|
|
pre.rust .number {
|
|
|
|
color: var(--code-highlight-number-color);
|
|
|
|
}
|
|
|
|
pre.rust .bool-val {
|
|
|
|
color: var(--code-highlight-literal-color);
|
|
|
|
}
|
|
|
|
pre.rust .self {
|
|
|
|
color: var(--code-highlight-self-color);
|
|
|
|
}
|
2022-10-31 13:12:51 -07:00
|
|
|
pre.rust .attr {
|
2022-10-04 16:56:56 +02:00
|
|
|
color: var(--code-highlight-attribute-color);
|
|
|
|
}
|
|
|
|
pre.rust .macro,
|
|
|
|
pre.rust .macro-nonterminal {
|
|
|
|
color: var(--code-highlight-macro-color);
|
|
|
|
}
|
2016-10-12 05:23:37 +02:00
|
|
|
pre.rust .question-mark {
|
2016-11-06 21:03:08 +01:00
|
|
|
font-weight: bold;
|
2022-10-04 16:56:56 +02:00
|
|
|
color: var(--code-highlight-question-mark-color);
|
|
|
|
}
|
|
|
|
pre.rust .comment {
|
|
|
|
color: var(--code-highlight-comment-color);
|
|
|
|
}
|
|
|
|
pre.rust .doccomment {
|
|
|
|
color: var(--code-highlight-doc-comment-color);
|
2016-10-12 05:23:37 +02:00
|
|
|
}
|
2014-03-04 11:24:20 -08:00
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.rustdoc.src .example-wrap pre.rust a {
|
2022-12-15 08:55:23 +01:00
|
|
|
background: var(--codeblock-link-background);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.compile_fail,
|
|
|
|
.example-wrap.should_panic {
|
2022-09-08 23:40:13 +02:00
|
|
|
border-left: 2px solid var(--codeblock-error-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.ignore.example-wrap {
|
2022-09-08 23:40:13 +02:00
|
|
|
border-left: 2px solid var(--codeblock-ignore-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.compile_fail:hover,
|
|
|
|
.example-wrap.should_panic:hover {
|
2022-09-08 23:40:13 +02:00
|
|
|
border-left: 2px solid var(--codeblock-error-hover-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.ignore:hover {
|
2022-09-08 23:40:13 +02:00
|
|
|
border-left: 2px solid var(--codeblock-ignore-hover-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.compile_fail .tooltip,
|
|
|
|
.example-wrap.should_panic .tooltip {
|
2022-09-08 23:40:13 +02:00
|
|
|
color: var(--codeblock-error-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.ignore .tooltip {
|
2023-01-07 14:48:55 +01:00
|
|
|
color: var(--codeblock-ignore-color);
|
2022-09-08 23:40:13 +02:00
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.compile_fail:hover .tooltip,
|
|
|
|
.example-wrap.should_panic:hover .tooltip {
|
2022-09-08 23:40:13 +02:00
|
|
|
color: var(--codeblock-error-hover-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap.ignore:hover .tooltip {
|
2022-09-08 23:40:13 +02:00
|
|
|
color: var(--codeblock-ignore-hover-color);
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:18:14 +02:00
|
|
|
.example-wrap .tooltip {
|
|
|
|
position: absolute;
|
|
|
|
display: block;
|
|
|
|
left: -25px;
|
|
|
|
top: 5px;
|
2023-01-26 13:32:33 -07:00
|
|
|
margin: 0;
|
|
|
|
line-height: 1;
|
2022-09-09 16:18:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.example-wrap.compile_fail .tooltip,
|
|
|
|
.example-wrap.should_panic .tooltip,
|
|
|
|
.example-wrap.ignore .tooltip {
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.25rem;
|
2023-01-07 14:48:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This class only exists for users who want to draw attention to a particular element in their
|
|
|
|
documentation. */
|
|
|
|
.content .docblock .warning {
|
|
|
|
border-left: 2px solid var(--warning-border-color);
|
|
|
|
padding: 14px;
|
|
|
|
position: relative;
|
|
|
|
/* The "!important" part is required because the rule is otherwise overruled in this CSS
|
|
|
|
selector: ".docblock > :not(.more-examples-toggle):not(.example-wrap)" */
|
|
|
|
overflow-x: visible !important;
|
|
|
|
}
|
|
|
|
.content .docblock .warning::before {
|
|
|
|
color: var(--warning-border-color);
|
|
|
|
content: "ⓘ";
|
|
|
|
position: absolute;
|
|
|
|
left: -25px;
|
|
|
|
top: 5px;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.25rem;
|
2022-09-09 16:18:14 +02:00
|
|
|
}
|
2023-12-24 19:23:42 +01:00
|
|
|
.top-doc > .docblock >.warning:first-child::before {
|
|
|
|
top: 20px;
|
|
|
|
}
|
2022-09-09 16:18:14 +02:00
|
|
|
|
2024-05-29 23:40:58 +02:00
|
|
|
.example-wrap > a.test-arrow, .example-wrap .button-holder {
|
2021-12-17 22:38:18 -08:00
|
|
|
visibility: hidden;
|
2016-11-06 21:03:08 +01:00
|
|
|
position: absolute;
|
2024-06-03 21:27:29 +02:00
|
|
|
top: 4px;
|
|
|
|
right: 4px;
|
2020-01-26 17:24:40 +01:00
|
|
|
z-index: 1;
|
2024-05-29 23:40:58 +02:00
|
|
|
}
|
|
|
|
a.test-arrow {
|
2024-07-30 15:23:44 +02:00
|
|
|
height: var(--copy-path-height);
|
|
|
|
padding: 6px 4px 0 11px;
|
2022-11-05 17:22:25 +01:00
|
|
|
}
|
2024-07-30 15:23:44 +02:00
|
|
|
a.test-arrow::before {
|
|
|
|
content: url('data:image/svg+xml,<svg viewBox="0 0 20 20" width="18" height="20" \
|
|
|
|
xmlns="http://www.w3.org/2000/svg"><path d="M0 0l18 10-18 10z"/></svg>');
|
2014-06-06 09:12:18 -07:00
|
|
|
}
|
2024-05-29 23:40:58 +02:00
|
|
|
.example-wrap .button-holder {
|
|
|
|
display: flex;
|
|
|
|
}
|
2024-07-30 15:23:44 +02:00
|
|
|
|
2024-07-29 13:58:15 +02:00
|
|
|
/*
|
|
|
|
On iPad, the ":hover" state sticks around, making things work not greatly. Do work around
|
|
|
|
it, we move it into this media query. More information can be found at:
|
|
|
|
https://css-tricks.com/solving-sticky-hover-states-with-media-hover-hover/
|
|
|
|
|
|
|
|
However, using `@media (hover: hover)` makes this rule never to be applied in GUI tests, so
|
|
|
|
instead, we check that it's not a "finger" cursor.
|
|
|
|
*/
|
|
|
|
@media not (pointer: coarse) {
|
2024-07-30 15:23:44 +02:00
|
|
|
.example-wrap:hover > a.test-arrow, .example-wrap:hover > .button-holder {
|
2024-07-29 13:58:15 +02:00
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.example-wrap .button-holder.keep-visible {
|
2021-12-17 22:38:18 -08:00
|
|
|
visibility: visible;
|
|
|
|
}
|
2024-08-30 18:27:11 +02:00
|
|
|
.example-wrap .button-holder > * {
|
2024-05-29 23:40:58 +02:00
|
|
|
background: var(--main-background-color);
|
2024-07-30 15:23:44 +02:00
|
|
|
cursor: pointer;
|
|
|
|
border-radius: var(--button-border-radius);
|
2024-06-03 09:55:11 +02:00
|
|
|
height: var(--copy-path-height);
|
|
|
|
width: var(--copy-path-width);
|
2024-08-30 18:27:11 +02:00
|
|
|
border: 0;
|
|
|
|
color: var(--code-example-button-color);
|
2024-07-30 15:23:44 +02:00
|
|
|
}
|
2024-08-30 18:27:11 +02:00
|
|
|
.example-wrap .button-holder > *:hover {
|
|
|
|
color: var(--code-example-button-hover-color);
|
|
|
|
}
|
|
|
|
.example-wrap .button-holder > *:not(:first-child) {
|
2024-06-03 21:27:29 +02:00
|
|
|
margin-left: var(--button-left-margin);
|
2024-08-30 18:27:11 +02:00
|
|
|
}
|
|
|
|
.example-wrap .button-holder .copy-button {
|
2024-05-29 23:40:58 +02:00
|
|
|
padding: 2px 0 0 4px;
|
|
|
|
}
|
2024-07-30 15:23:44 +02:00
|
|
|
.example-wrap .button-holder .copy-button::before,
|
|
|
|
.example-wrap .test-arrow::before {
|
2024-05-29 23:40:58 +02:00
|
|
|
filter: var(--copy-path-img-filter);
|
2024-07-30 15:23:44 +02:00
|
|
|
}
|
|
|
|
.example-wrap .button-holder .copy-button::before {
|
2024-06-03 09:55:11 +02:00
|
|
|
content: var(--clipboard-image);
|
2024-05-29 23:40:58 +02:00
|
|
|
}
|
2024-07-30 15:23:44 +02:00
|
|
|
.example-wrap .button-holder .copy-button:hover::before,
|
|
|
|
.example-wrap .test-arrow:hover::before {
|
2024-05-29 23:40:58 +02:00
|
|
|
filter: var(--copy-path-img-hover-filter);
|
|
|
|
}
|
|
|
|
.example-wrap .button-holder .copy-button.clicked::before {
|
|
|
|
content: var(--checkmark-image);
|
2024-06-03 09:55:11 +02:00
|
|
|
padding-right: 5px;
|
2024-05-29 23:40:58 +02:00
|
|
|
}
|
2015-02-20 13:54:11 +02:00
|
|
|
|
2021-04-17 18:08:50 -07:00
|
|
|
.code-attribute {
|
|
|
|
font-weight: 300;
|
2022-09-02 15:08:23 +02:00
|
|
|
color: var(--code-attribute-color);
|
2021-04-17 18:08:50 -07:00
|
|
|
}
|
|
|
|
|
2017-07-09 00:40:29 +02:00
|
|
|
.item-spacer {
|
|
|
|
width: 100%;
|
|
|
|
height: 12px;
|
2022-11-26 01:51:50 +01:00
|
|
|
display: block;
|
2017-07-09 00:40:29 +02:00
|
|
|
}
|
|
|
|
|
2019-05-03 12:55:31 -04:00
|
|
|
.out-of-band > span.since {
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1.25rem;
|
2016-05-10 21:01:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-19 22:48:53 -07:00
|
|
|
.sub-variant h4 {
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1rem;
|
2021-10-19 22:48:53 -07:00
|
|
|
font-weight: 400;
|
|
|
|
margin-top: 0;
|
|
|
|
margin-bottom: 0;
|
2018-10-19 01:34:46 +02:00
|
|
|
}
|
|
|
|
|
2021-10-19 22:48:53 -07:00
|
|
|
.sub-variant {
|
|
|
|
margin-left: 24px;
|
|
|
|
margin-bottom: 40px;
|
2018-10-19 01:34:46 +02:00
|
|
|
}
|
|
|
|
|
2021-10-19 22:48:53 -07:00
|
|
|
.sub-variant > .sub-variant-field {
|
|
|
|
margin-left: 24px;
|
2016-11-11 16:41:00 -06:00
|
|
|
}
|
|
|
|
|
2024-08-19 16:16:34 -07:00
|
|
|
@keyframes targetfadein {
|
|
|
|
from {
|
|
|
|
background-color: var(--main-background-color);
|
|
|
|
}
|
|
|
|
10% {
|
|
|
|
background-color: var(--target-border-color);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
background-color: var(--target-background-color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-16 22:48:23 -07:00
|
|
|
:target {
|
|
|
|
padding-right: 3px;
|
2022-11-08 21:12:17 +01:00
|
|
|
background-color: var(--target-background-color);
|
|
|
|
border-right: 3px solid var(--target-border-color);
|
2024-08-19 16:16:34 -07:00
|
|
|
animation: 0.65s cubic-bezier(0, 0, 0.1, 1.0) 0.1s targetfadein;
|
2021-06-16 22:48:23 -07:00
|
|
|
}
|
|
|
|
|
2023-01-26 13:32:33 -07:00
|
|
|
.code-header a.tooltip {
|
2022-11-08 18:00:22 -07:00
|
|
|
color: inherit;
|
|
|
|
margin-right: 15px;
|
|
|
|
position: relative;
|
2020-07-06 17:18:04 -07:00
|
|
|
}
|
|
|
|
|
2023-05-23 17:19:35 -07:00
|
|
|
.code-header a.tooltip:hover {
|
|
|
|
color: var(--link-color);
|
|
|
|
}
|
|
|
|
|
2022-11-08 18:00:22 -07:00
|
|
|
/* placeholder thunk so that the mouse can easily travel from "(i)" to popover
|
|
|
|
the resulting "hover tunnel" is a stepped triangle, approximating
|
|
|
|
https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown */
|
2023-01-26 13:32:33 -07:00
|
|
|
a.tooltip:hover::after {
|
2020-07-06 17:18:04 -07:00
|
|
|
position: absolute;
|
2022-11-08 18:00:22 -07:00
|
|
|
top: calc(100% - 10px);
|
|
|
|
left: -15px;
|
|
|
|
right: -15px;
|
|
|
|
height: 20px;
|
|
|
|
content: "\00a0";
|
2020-07-06 17:18:04 -07:00
|
|
|
}
|
|
|
|
|
rustdoc: add interaction delays for tooltip popovers
Designing a good hover microinteraction is a matter of guessing
user intent from what are, literally, vague gestures. In this case,
guessing if hovering in our out of the tooltip base is intentional
or not.
To figure this out, a few different techniques are used:
* When the mouse pointer enters a tooltip anchor point, its hitbox
is grown on the bottom, where the popover is/will appear. This was
already there before this commit: search "hover tunnel" in
rustdoc.css for the implementation.
* This commit adds a delay when the mouse pointer enters the base
anchor, in case the mouse pointer was just passing through and the
user didn't want to open it.
* This commit also adds a delay when the mouse pointer exits the
tooltip's base anchor or its popover, before hiding it.
* A fade-out animation is layered onto the pointer exit delay to
immediately inform the user that they successfully dismissed the
popover, while still providing a way for them to cancel it if
it was a mistake and they still wanted to interact with it.
* No animation is used for revealing it, because we don't want
people to try to interact with an element while it's in the
middle of fading in: either they're allowed to interact with
it while it's fading in, meaning it can't serve as mistake-
proofing for opening the popover, or they can't, but they
might try and be frustrated.
See also:
* https://www.nngroup.com/articles/timing-exposing-content/
* https://www.nngroup.com/articles/tooltip-guidelines/
* https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown
2023-05-23 15:29:43 -07:00
|
|
|
/* This animation is layered onto the mistake-proofing delay for dismissing
|
|
|
|
a hovered tooltip, to ensure it feels responsive even with the delay.
|
|
|
|
*/
|
|
|
|
.fade-out {
|
|
|
|
opacity: 0;
|
|
|
|
transition: opacity 0.45s cubic-bezier(0, 0, 0.1, 1.0);
|
|
|
|
}
|
|
|
|
|
2023-01-26 13:32:33 -07:00
|
|
|
.popover.tooltip .content {
|
2022-11-08 18:00:22 -07:00
|
|
|
margin: 0.25em 0.5em;
|
2021-06-02 21:16:33 +02:00
|
|
|
}
|
|
|
|
|
2023-01-26 13:32:33 -07:00
|
|
|
.popover.tooltip .content pre, .popover.tooltip .content code {
|
2022-11-07 15:53:30 -07:00
|
|
|
background: transparent;
|
2020-07-15 17:20:46 +02:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1.25rem;
|
2022-11-07 15:53:30 -07:00
|
|
|
white-space: pre-wrap;
|
2017-11-29 19:23:41 +01:00
|
|
|
}
|
|
|
|
|
2023-01-26 13:32:33 -07:00
|
|
|
.popover.tooltip .content > h3:first-child {
|
2023-01-13 15:42:29 -07:00
|
|
|
margin: 0 0 5px 0;
|
|
|
|
}
|
|
|
|
|
2017-10-04 00:06:07 +02:00
|
|
|
.search-failed {
|
|
|
|
text-align: center;
|
|
|
|
margin-top: 20px;
|
2021-05-09 12:56:21 -07:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-failed.active {
|
|
|
|
display: block;
|
2017-10-04 00:06:07 +02:00
|
|
|
}
|
|
|
|
|
2018-11-01 02:20:49 +01:00
|
|
|
.search-failed > ul {
|
|
|
|
text-align: left;
|
|
|
|
max-width: 570px;
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
}
|
|
|
|
|
2022-12-22 15:52:34 -07:00
|
|
|
#search-tabs {
|
2022-09-14 09:45:05 -07:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
gap: 1px;
|
|
|
|
margin-bottom: 4px;
|
2017-10-04 00:06:07 +02:00
|
|
|
}
|
|
|
|
|
2022-12-22 15:52:34 -07:00
|
|
|
#search-tabs button {
|
2017-10-04 00:06:07 +02:00
|
|
|
text-align: center;
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1.125rem;
|
2020-12-10 11:38:12 +01:00
|
|
|
border: 0;
|
2018-10-16 19:07:41 +02:00
|
|
|
border-top: 2px solid;
|
2022-09-14 09:45:05 -07:00
|
|
|
flex: 1;
|
2022-09-28 13:52:13 -07:00
|
|
|
line-height: 1.5;
|
|
|
|
color: inherit;
|
2017-10-04 00:06:07 +02:00
|
|
|
}
|
2023-01-30 19:28:47 +01:00
|
|
|
#search-tabs button:not(.selected) {
|
|
|
|
background-color: var(--search-tab-button-not-selected-background);
|
|
|
|
border-top-color: var(--search-tab-button-not-selected-border-top-color);
|
|
|
|
}
|
|
|
|
#search-tabs button:hover, #search-tabs button.selected {
|
|
|
|
background-color: var(--search-tab-button-selected-background);
|
|
|
|
border-top-color: var(--search-tab-button-selected-border-top-color);
|
|
|
|
}
|
2017-11-02 01:01:51 +01:00
|
|
|
|
2022-12-22 15:52:34 -07:00
|
|
|
#search-tabs .count {
|
Set font size proportional to user's font size
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
2021-12-30 16:42:06 -05:00
|
|
|
font-size: 1rem;
|
2023-09-19 19:40:36 -07:00
|
|
|
font-variant-numeric: tabular-nums;
|
2022-12-22 11:38:39 +01:00
|
|
|
color: var(--search-tab-title-count-color);
|
2017-11-02 01:01:51 +01:00
|
|
|
}
|
2017-11-15 20:04:02 +01:00
|
|
|
|
2023-02-28 22:37:52 +01:00
|
|
|
#search .error code {
|
|
|
|
border-radius: 3px;
|
|
|
|
background-color: var(--search-error-code-background-color);
|
|
|
|
}
|
|
|
|
|
2023-04-15 11:53:50 -07:00
|
|
|
.search-corrections {
|
|
|
|
font-weight: normal;
|
|
|
|
}
|
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
#src-sidebar {
|
2021-12-14 11:48:30 +01:00
|
|
|
width: 100%;
|
2019-04-29 23:24:09 +02:00
|
|
|
overflow: auto;
|
|
|
|
}
|
2023-07-14 16:38:01 -07:00
|
|
|
#src-sidebar div.files > a:hover, details.dir-entry summary:hover,
|
|
|
|
#src-sidebar div.files > a:focus, details.dir-entry summary:focus {
|
|
|
|
background-color: var(--src-sidebar-background-hover);
|
2022-11-24 23:36:26 +01:00
|
|
|
}
|
2023-07-14 16:38:01 -07:00
|
|
|
#src-sidebar div.files > a.selected {
|
|
|
|
background-color: var(--src-sidebar-background-selected);
|
2022-11-24 23:36:26 +01:00
|
|
|
}
|
2023-12-17 23:06:31 -07:00
|
|
|
|
|
|
|
.src-sidebar-title {
|
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
|
|
|
display: flex;
|
2023-12-18 18:22:35 -07:00
|
|
|
padding: 8px 8px 0 48px;
|
|
|
|
margin-bottom: 7px;
|
2023-12-17 23:06:31 -07:00
|
|
|
background: var(--sidebar-background-color);
|
2023-12-18 16:00:57 -07:00
|
|
|
border-bottom: 1px solid var(--border-color);
|
2022-07-01 11:05:38 -07:00
|
|
|
}
|
2022-12-28 16:04:57 -07:00
|
|
|
|
2021-05-09 11:21:38 -07:00
|
|
|
#settings-menu, #help-button {
|
2024-06-03 21:27:29 +02:00
|
|
|
margin-left: var(--button-left-margin);
|
2022-12-01 14:24:33 -07:00
|
|
|
display: flex;
|
2019-04-29 23:43:39 +02:00
|
|
|
}
|
2023-09-07 18:45:24 -07:00
|
|
|
#sidebar-button {
|
|
|
|
display: none;
|
2023-12-18 13:30:47 -07:00
|
|
|
line-height: 0;
|
2023-09-07 18:45:24 -07:00
|
|
|
}
|
2023-12-17 23:06:31 -07:00
|
|
|
.hide-sidebar #sidebar-button,
|
|
|
|
.src #sidebar-button {
|
2023-09-07 18:45:24 -07:00
|
|
|
display: flex;
|
|
|
|
margin-right: 4px;
|
|
|
|
position: fixed;
|
|
|
|
left: 6px;
|
|
|
|
height: 34px;
|
|
|
|
width: 34px;
|
|
|
|
background-color: var(--main-background-color);
|
|
|
|
z-index: 1;
|
|
|
|
}
|
2023-12-17 23:06:31 -07:00
|
|
|
.src #sidebar-button {
|
2023-12-18 12:11:14 -07:00
|
|
|
left: 8px;
|
2023-12-31 22:25:46 +01:00
|
|
|
z-index: calc(var(--desktop-sidebar-z-index) + 1);
|
2023-12-17 23:06:31 -07:00
|
|
|
}
|
2023-12-19 18:22:38 -07:00
|
|
|
.hide-sidebar .src #sidebar-button {
|
|
|
|
position: static;
|
|
|
|
}
|
2023-09-07 18:45:24 -07:00
|
|
|
#settings-menu > a, #help-button > a, #sidebar-button > a {
|
2022-12-01 14:24:33 -07:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2022-08-13 14:00:23 +02:00
|
|
|
background-color: var(--button-background-color);
|
2022-10-17 11:53:42 -07:00
|
|
|
border: 1px solid var(--border-color);
|
2024-06-03 21:27:29 +02:00
|
|
|
border-radius: var(--button-border-radius);
|
2022-11-19 11:07:13 +01:00
|
|
|
color: var(--settings-button-color);
|
2022-12-01 14:24:33 -07:00
|
|
|
/* Rare exception to specifying font sizes in rem. Since this is acting
|
|
|
|
as an icon, it's okay to specify their sizes in pixels. */
|
|
|
|
font-size: 20px;
|
2022-12-28 16:04:57 -07:00
|
|
|
width: 33px;
|
2022-11-19 11:07:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#settings-menu > a:hover, #settings-menu > a:focus,
|
2023-09-07 18:45:24 -07:00
|
|
|
#help-button > a:hover, #help-button > a:focus,
|
|
|
|
#sidebar-button > a:hover, #sidebar-button > a:focus {
|
2022-11-19 11:07:13 +01:00
|
|
|
border-color: var(--settings-button-border-focus);
|
2022-05-10 16:09:41 +02:00
|
|
|
}
|
2021-03-31 22:13:47 +02:00
|
|
|
|
2024-04-09 17:15:33 -07:00
|
|
|
#settings-menu > a {
|
|
|
|
line-height: 0;
|
|
|
|
font-size: 0;
|
|
|
|
}
|
|
|
|
#settings-menu > a:before {
|
2024-04-10 20:29:15 +02:00
|
|
|
/* Wheel <https://www.svgrepo.com/svg/384069/settings-cog-gear> */
|
|
|
|
content: url('data:image/svg+xml,<svg width="22" height="22" viewBox="0 0 12 12" \
|
|
|
|
enable-background="new 0 0 12 12" xmlns="http://www.w3.org/2000/svg">\
|
|
|
|
<path d="M10.25,6c0-0.1243286-0.0261841-0.241333-0.0366211-0.362915l1.6077881-1.5545654l\
|
|
|
|
-1.25-2.1650391 c0,0-1.2674561,0.3625488-2.1323853,0.6099854c-0.2034912-0.1431885-0.421875\
|
|
|
|
-0.2639771-0.6494751-0.3701782L7.25,0h-2.5 c0,0-0.3214111,1.2857666-0.5393066,2.1572876\
|
|
|
|
C3.9830933,2.2634888,3.7647095,2.3842773,3.5612183,2.5274658L1.428833,1.9174805 \
|
|
|
|
l-1.25,2.1650391c0,0,0.9641113,0.9321899,1.6077881,1.5545654C1.7761841,5.758667,\
|
|
|
|
1.75,5.8756714,1.75,6 s0.0261841,0.241333,0.0366211,0.362915L0.178833,7.9174805l1.25,\
|
|
|
|
2.1650391l2.1323853-0.6099854 c0.2034912,0.1432495,0.421875,0.2639771,0.6494751,0.3701782\
|
|
|
|
L4.75,12h2.5l0.5393066-2.1572876 c0.2276001-0.1062012,0.4459839-0.2269287,0.6494751\
|
|
|
|
-0.3701782l2.1323853,0.6099854l1.25-2.1650391L10.2133789,6.362915 C10.2238159,6.241333,\
|
|
|
|
10.25,6.1243286,10.25,6z M6,7.5C5.1715698,7.5,4.5,6.8284302,4.5,6S5.1715698,4.5,6,4.5S7.5\
|
|
|
|
,5.1715698,7.5,6 S6.8284302,7.5,6,7.5z" fill="black"/></svg>');
|
2024-04-09 17:15:33 -07:00
|
|
|
width: 22px;
|
|
|
|
height: 22px;
|
2024-05-05 19:27:59 +02:00
|
|
|
filter: var(--settings-menu-filter);
|
2024-04-09 17:15:33 -07:00
|
|
|
}
|
|
|
|
|
2023-10-07 09:41:38 -07:00
|
|
|
#sidebar-button > a:before {
|
2024-04-10 20:36:02 +02:00
|
|
|
/* sidebar resizer image */
|
2023-10-07 09:41:38 -07:00
|
|
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" \
|
|
|
|
fill="none" stroke="black">\
|
|
|
|
<rect x="1" y="1" width="20" height="20" ry="1.5" stroke-width="1.5"/>\
|
|
|
|
<circle cx="4.375" cy="4.375" r="1" stroke-width=".75"/>\
|
|
|
|
<path d="m7.6121 3v16 M5.375 7.625h-2 m2 3h-2 m2 3h-2" stroke-width="1.25"/></svg>');
|
|
|
|
width: 22px;
|
|
|
|
height: 22px;
|
|
|
|
}
|
|
|
|
|
2022-09-02 15:08:23 +02:00
|
|
|
#copy-path {
|
|
|
|
color: var(--copy-path-button-color);
|
2022-10-17 11:53:42 -07:00
|
|
|
background: var(--main-background-color);
|
2024-06-03 09:55:11 +02:00
|
|
|
height: var(--copy-path-height);
|
|
|
|
width: var(--copy-path-width);
|
2022-10-17 11:53:42 -07:00
|
|
|
margin-left: 10px;
|
|
|
|
padding: 0;
|
|
|
|
padding-left: 2px;
|
|
|
|
border: 0;
|
2024-04-09 17:15:33 -07:00
|
|
|
font-size: 0;
|
2022-09-02 15:08:23 +02:00
|
|
|
}
|
2024-04-16 23:55:32 +02:00
|
|
|
#copy-path::before {
|
2022-09-02 15:08:23 +02:00
|
|
|
filter: var(--copy-path-img-filter);
|
2024-05-29 23:40:58 +02:00
|
|
|
content: var(--clipboard-image);
|
2022-09-02 15:08:23 +02:00
|
|
|
}
|
2024-04-16 23:55:32 +02:00
|
|
|
#copy-path:hover::before {
|
2022-09-02 15:08:23 +02:00
|
|
|
filter: var(--copy-path-img-hover-filter);
|
|
|
|
}
|
2024-04-16 23:55:32 +02:00
|
|
|
#copy-path.clicked::before {
|
2024-05-29 23:40:58 +02:00
|
|
|
content: var(--checkmark-image);
|
2024-04-16 23:55:32 +02:00
|
|
|
}
|
2022-09-02 15:08:23 +02:00
|
|
|
|
2022-05-04 15:39:18 +02:00
|
|
|
@keyframes rotating {
|
|
|
|
from {
|
|
|
|
transform: rotate(0deg);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
transform: rotate(360deg);
|
|
|
|
}
|
|
|
|
}
|
2022-05-11 23:11:18 +02:00
|
|
|
#settings-menu.rotate > a img {
|
2022-05-04 15:39:18 +02:00
|
|
|
animation: rotating 2s linear infinite;
|
|
|
|
}
|
|
|
|
|
2021-05-14 19:43:08 +02:00
|
|
|
kbd {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 3px 5px;
|
|
|
|
font: 15px monospace;
|
|
|
|
line-height: 10px;
|
|
|
|
vertical-align: middle;
|
2022-08-13 14:00:23 +02:00
|
|
|
border: solid 1px var(--border-color);
|
2021-05-14 19:43:08 +02:00
|
|
|
border-radius: 3px;
|
2023-01-05 11:03:35 +01:00
|
|
|
color: var(--kbd-color);
|
2022-11-20 14:32:27 +01:00
|
|
|
background-color: var(--kbd-background);
|
|
|
|
box-shadow: inset 0 -1px 0 var(--kbd-box-shadow-color);
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
|
|
|
|
2022-09-16 13:40:21 -07:00
|
|
|
ul.all-items > li {
|
2021-05-14 19:43:08 +02:00
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
2022-07-01 15:29:47 -07:00
|
|
|
details.dir-entry {
|
|
|
|
padding-left: 4px;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
2022-07-01 15:29:47 -07:00
|
|
|
|
2022-07-01 10:33:06 -07:00
|
|
|
details.dir-entry > summary {
|
2022-12-30 11:58:58 -07:00
|
|
|
margin: 0 0 0 -4px;
|
|
|
|
padding: 0 0 0 4px;
|
2021-05-14 19:43:08 +02:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
2022-07-01 10:33:06 -07:00
|
|
|
|
|
|
|
details.dir-entry div.folders, details.dir-entry div.files {
|
2022-07-01 15:29:47 -07:00
|
|
|
padding-left: 23px;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
2022-07-01 10:33:06 -07:00
|
|
|
|
|
|
|
details.dir-entry a {
|
2021-05-14 19:43:08 +02:00
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
2022-09-27 09:21:24 -07:00
|
|
|
/* We use CSS containment on the details elements because most sizeable elements
|
|
|
|
of the page are contained in one of these. This also makes re-rendering
|
|
|
|
faster on document changes (like closing and opening toggles).
|
|
|
|
Unfortunately we can't yet specify contain: content or contain: strict
|
|
|
|
because the [-]/[+] toggles extend past the boundaries of the <details>
|
|
|
|
https://developer.mozilla.org/en-US/docs/Web/CSS/contain */
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle {
|
2022-09-27 09:21:24 -07:00
|
|
|
contain: layout;
|
2022-10-21 10:31:33 -07:00
|
|
|
position: relative;
|
2022-09-27 09:21:24 -07:00
|
|
|
}
|
|
|
|
|
2021-05-14 19:43:08 +02:00
|
|
|
/* The hideme class is used on summary tags that contain a span with
|
|
|
|
placeholder text shown only when the toggle is closed. For instance,
|
|
|
|
"Expand description" or "Show methods". */
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary.hideme {
|
2021-05-14 19:43:08 +02:00
|
|
|
cursor: pointer;
|
2022-12-05 11:15:09 -07:00
|
|
|
font-size: 1rem;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary {
|
2021-05-14 19:43:08 +02:00
|
|
|
list-style: none;
|
2022-10-27 09:48:06 -07:00
|
|
|
/* focus outline is shown on `::before` instead of this */
|
|
|
|
outline: none;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary::-webkit-details-marker,
|
|
|
|
details.toggle > summary::marker {
|
2021-05-14 19:43:08 +02:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary.hideme > span {
|
2021-05-14 19:43:08 +02:00
|
|
|
margin-left: 9px;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary::before {
|
2023-01-31 21:23:23 +01:00
|
|
|
/* toggle plus */
|
|
|
|
background: url('data:image/svg+xml,<svg width="17" height="17" \
|
|
|
|
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
|
|
|
|
d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7M8.5 12V8.625v0V5"/></svg>') no-repeat top left;
|
2021-07-17 11:28:26 -07:00
|
|
|
content: "";
|
2021-05-14 19:43:08 +02:00
|
|
|
cursor: pointer;
|
2022-02-05 05:05:05 -08:00
|
|
|
width: 16px;
|
|
|
|
height: 16px;
|
2021-07-16 17:24:35 -07:00
|
|
|
display: inline-block;
|
|
|
|
vertical-align: middle;
|
|
|
|
opacity: .5;
|
2022-12-01 15:55:09 +01:00
|
|
|
filter: var(--toggle-filter);
|
2021-07-17 10:55:33 -07:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary.hideme > span,
|
2022-09-02 15:08:23 +02:00
|
|
|
.more-examples-toggle summary, .more-examples-toggle .hide-more {
|
|
|
|
color: var(--toggles-color);
|
|
|
|
}
|
|
|
|
|
2021-07-17 10:55:33 -07:00
|
|
|
/* Screen readers see the text version at the end the line.
|
|
|
|
Visual readers see the icon at the start of the line, but small and transparent. */
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary::after {
|
2021-07-17 10:55:33 -07:00
|
|
|
content: "Expand";
|
2021-07-16 17:24:35 -07:00
|
|
|
overflow: hidden;
|
2021-07-17 10:55:33 -07:00
|
|
|
width: 0;
|
|
|
|
height: 0;
|
|
|
|
position: absolute;
|
2021-07-16 17:24:35 -07:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary.hideme::after {
|
2021-07-16 17:24:35 -07:00
|
|
|
/* "hideme" toggles already have a description when they're contracted */
|
2021-07-17 10:55:33 -07:00
|
|
|
content: "";
|
2021-07-16 17:24:35 -07:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary:focus::before,
|
|
|
|
details.toggle > summary:hover::before {
|
2021-07-16 17:24:35 -07:00
|
|
|
opacity: 1;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary:focus-visible::before {
|
2022-10-26 02:41:34 -07:00
|
|
|
/* The SVG is black, and gets turned white using a filter in the dark themes.
|
2022-10-25 16:52:50 -07:00
|
|
|
Do the same with the outline.
|
2022-10-26 02:41:34 -07:00
|
|
|
The dotted 1px style is copied from Firefox's focus ring style.
|
2022-10-25 16:52:50 -07:00
|
|
|
*/
|
|
|
|
outline: 1px dotted #000;
|
|
|
|
outline-offset: 1px;
|
|
|
|
}
|
|
|
|
|
2021-05-14 19:43:08 +02:00
|
|
|
details.non-exhaustive {
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary.hideme::before {
|
2021-05-14 19:43:08 +02:00
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle > summary:not(.hideme)::before {
|
2021-05-14 19:43:08 +02:00
|
|
|
position: absolute;
|
2021-10-21 18:46:47 -07:00
|
|
|
left: -24px;
|
2022-02-05 05:05:05 -08:00
|
|
|
top: 4px;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
.impl-items > details.toggle > summary:not(.hideme)::before {
|
2021-05-14 19:43:08 +02:00
|
|
|
position: absolute;
|
2021-10-21 18:46:47 -07:00
|
|
|
left: -24px;
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* When a "hideme" summary is open and the "Expand description" or "Show
|
|
|
|
methods" text is hidden, we want the [-] toggle that remains to not
|
|
|
|
affect the layout of the items to its right. To do that, we use
|
|
|
|
absolute positioning. Note that we also set position: relative
|
|
|
|
on the parent <details> to make this work properly. */
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle[open] > summary.hideme {
|
2021-05-14 19:43:08 +02:00
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle[open] > summary.hideme > span {
|
2021-05-14 19:43:08 +02:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle[open] > summary::before {
|
2023-01-31 21:23:23 +01:00
|
|
|
/* toggle minus */
|
|
|
|
background: url('data:image/svg+xml,<svg width="17" height="17" \
|
|
|
|
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
|
|
|
|
d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7"/></svg>') no-repeat top left;
|
2021-07-17 10:55:33 -07:00
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle[open] > summary::after {
|
2021-07-16 17:24:35 -07:00
|
|
|
content: "Collapse";
|
2021-05-14 19:43:08 +02:00
|
|
|
}
|
|
|
|
|
2022-05-21 15:05:19 +02:00
|
|
|
/* This is needed in docblocks to have the "▶" element to be on the same line. */
|
|
|
|
.docblock summary > * {
|
|
|
|
display: inline-block;
|
2022-05-21 13:57:52 +02:00
|
|
|
}
|
|
|
|
|
2022-10-17 13:54:42 -07:00
|
|
|
/* In case there is no documentation before a code block, we need to add some margin at the top
|
|
|
|
to prevent an overlay between the "collapse toggle" and the information tooltip.
|
|
|
|
However, it's not needed with smaller screen width because the doc/code block is always put
|
|
|
|
"one line" below. */
|
|
|
|
.docblock > .example-wrap:first-child .tooltip {
|
|
|
|
margin-top: 16px;
|
2020-07-22 16:28:47 +02:00
|
|
|
}
|
|
|
|
|
2023-12-18 18:22:35 -07:00
|
|
|
/* sidebar button opens modal
|
|
|
|
use hamburger button */
|
|
|
|
.src #sidebar-button > a:before, .sidebar-menu-toggle:before {
|
2024-04-10 20:36:02 +02:00
|
|
|
/* hamburger button image */
|
2023-12-18 18:22:35 -07:00
|
|
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
|
|
|
viewBox="0 0 22 22" fill="none" stroke="black">\
|
|
|
|
<path d="M3,5h16M3,11h16M3,17h16" stroke-width="2.75"/></svg>');
|
|
|
|
opacity: 0.75;
|
|
|
|
}
|
|
|
|
.sidebar-menu-toggle:hover:before,
|
|
|
|
.sidebar-menu-toggle:active:before,
|
|
|
|
.sidebar-menu-toggle:focus:before {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* src sidebar button opens a folder view */
|
|
|
|
.src #sidebar-button > a:before {
|
2024-04-10 20:36:02 +02:00
|
|
|
/* folder image */
|
2023-12-18 18:22:35 -07:00
|
|
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
|
|
|
viewBox="0 0 22 22" fill="none" stroke="black">\
|
|
|
|
<path d="M16,9v-4h-6v-1l-2,-2h-4l-2,2v16h13L21,9h-15L2,19" stroke-width="1.25"/>\
|
|
|
|
<path d="M15,7h-11v3" stroke-width="0.75"/>\
|
|
|
|
<path d="M3.75,10v1.25" stroke-width="0.375"/></svg>');
|
|
|
|
opacity: 0.75;
|
|
|
|
}
|
|
|
|
|
2022-10-17 13:54:42 -07:00
|
|
|
/* Media Queries */
|
|
|
|
|
2023-09-19 19:40:36 -07:00
|
|
|
/* Make sure all the buttons line wrap at the same time */
|
|
|
|
@media (max-width: 850px) {
|
|
|
|
#search-tabs .count {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-01 12:13:46 -07:00
|
|
|
/*
|
|
|
|
WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
|
|
|
|
If you update this line, then you also need to update the line with the same warning
|
2023-09-27 08:59:32 -07:00
|
|
|
in src-script.js and main.js
|
2022-07-01 12:13:46 -07:00
|
|
|
*/
|
2014-08-02 20:58:41 -04:00
|
|
|
@media (max-width: 700px) {
|
2022-01-18 22:05:17 -08:00
|
|
|
/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
|
|
|
|
or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
|
|
|
|
by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
|
|
|
|
*/
|
|
|
|
*[id] {
|
|
|
|
scroll-margin-top: 45px;
|
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.rustdoc {
|
|
|
|
/* Sidebar should overlay main content, rather than pushing main content to the right.
|
|
|
|
Turn off `display: flex` on the body element. */
|
|
|
|
display: block;
|
2016-11-06 21:03:08 +01:00
|
|
|
}
|
|
|
|
|
2021-09-30 04:23:02 +02:00
|
|
|
main {
|
|
|
|
padding-left: 15px;
|
|
|
|
padding-top: 0px;
|
|
|
|
}
|
|
|
|
|
2022-01-13 09:54:44 -08:00
|
|
|
.main-heading {
|
2021-09-30 04:23:02 +02:00
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
2022-09-25 13:09:22 -07:00
|
|
|
.out-of-band {
|
2022-01-13 09:54:44 -08:00
|
|
|
text-align: left;
|
|
|
|
margin-left: initial;
|
|
|
|
padding: initial;
|
|
|
|
}
|
|
|
|
|
2022-09-25 13:09:22 -07:00
|
|
|
.out-of-band .since::before {
|
2022-01-13 09:54:44 -08:00
|
|
|
content: "Since ";
|
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
/* Hide the logo and item name from the sidebar. Those are displayed
|
|
|
|
in the mobile-topbar instead. */
|
2023-01-04 13:04:30 -07:00
|
|
|
.sidebar .logo-container,
|
2023-09-07 18:45:24 -07:00
|
|
|
.sidebar .location,
|
|
|
|
.sidebar-resizer {
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
display: none;
|
2016-11-06 21:03:08 +01:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.sidebar {
|
2021-10-10 19:08:08 +02:00
|
|
|
position: fixed;
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
top: 45px;
|
|
|
|
/* Hide the sidebar offscreen while not in use. Doing this instead of display: none means
|
|
|
|
the sidebar stays visible for screen readers, which is useful for navigation. */
|
|
|
|
left: -1000px;
|
2021-10-10 19:08:08 +02:00
|
|
|
z-index: 11;
|
2022-01-21 17:44:54 -08:00
|
|
|
/* Reduce height slightly to account for mobile topbar. */
|
|
|
|
height: calc(100vh - 45px);
|
2022-11-16 22:52:30 -07:00
|
|
|
width: 200px;
|
2021-10-10 19:08:08 +02:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
|
|
|
|
so don't bump down the main content or the sidebar. */
|
2023-07-14 16:38:01 -07:00
|
|
|
.src main,
|
|
|
|
.rustdoc.src .sidebar {
|
2021-10-24 20:03:13 +02:00
|
|
|
top: 0;
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
padding: 0;
|
2022-06-29 15:15:40 +02:00
|
|
|
height: 100vh;
|
|
|
|
border: 0;
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
}
|
2023-12-18 12:11:14 -07:00
|
|
|
.src .search-form {
|
|
|
|
margin-left: 40px;
|
|
|
|
}
|
2023-12-19 18:22:38 -07:00
|
|
|
.hide-sidebar .search-form {
|
|
|
|
margin-left: 32px;
|
|
|
|
}
|
|
|
|
.hide-sidebar .src .search-form {
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
|
|
|
|
.sidebar.shown,
|
2023-07-14 16:38:01 -07:00
|
|
|
.src-sidebar-expanded .src .sidebar,
|
|
|
|
.rustdoc:not(.src) .sidebar:focus-within {
|
2021-10-24 20:03:13 +02:00
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
|
2022-10-18 11:14:01 -07:00
|
|
|
.mobile-topbar h2 {
|
|
|
|
padding-bottom: 0;
|
2022-01-31 05:53:43 -08:00
|
|
|
margin: auto 0.5em auto auto;
|
2022-01-21 17:44:54 -08:00
|
|
|
overflow: hidden;
|
|
|
|
/* Rare exception to specifying font sizes in rem. Since the topbar
|
|
|
|
height is specified in pixels, this also has to be specified in
|
|
|
|
pixels to avoid overflowing the topbar when the user sets a bigger
|
|
|
|
font size. */
|
2022-02-05 05:05:05 -08:00
|
|
|
font-size: 24px;
|
2022-10-18 11:14:01 -07:00
|
|
|
white-space: nowrap;
|
2024-01-31 14:34:29 +01:00
|
|
|
text-overflow: ellipsis;
|
2022-10-18 11:14:01 -07:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.mobile-topbar .logo-container > img {
|
2019-04-29 11:45:06 +02:00
|
|
|
max-width: 35px;
|
|
|
|
max-height: 35px;
|
2022-10-29 09:04:31 -07:00
|
|
|
margin: 5px 0 5px 20px;
|
2019-04-29 11:45:06 +02:00
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.mobile-topbar {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
position: sticky;
|
2017-12-11 22:30:04 +01:00
|
|
|
z-index: 10;
|
2017-12-06 00:42:33 +01:00
|
|
|
font-size: 2rem;
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
height: 45px;
|
|
|
|
width: 100%;
|
2017-12-11 22:30:04 +01:00
|
|
|
left: 0;
|
2021-11-29 15:55:05 +01:00
|
|
|
top: 0;
|
2016-11-06 21:03:08 +01:00
|
|
|
}
|
|
|
|
|
2023-09-07 18:45:24 -07:00
|
|
|
.hide-sidebar .mobile-topbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 19:48:24 -05:00
|
|
|
.sidebar-menu-toggle {
|
|
|
|
width: 45px;
|
|
|
|
border: none;
|
2023-12-18 13:30:47 -07:00
|
|
|
line-height: 0;
|
2017-12-11 22:30:04 +01:00
|
|
|
}
|
|
|
|
|
2023-09-07 18:45:24 -07:00
|
|
|
.hide-sidebar .sidebar-menu-toggle {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2022-07-11 14:51:39 +02:00
|
|
|
.sidebar-elems {
|
2022-08-27 00:37:04 +02:00
|
|
|
margin-top: 1em;
|
2022-07-11 14:51:39 +02:00
|
|
|
}
|
|
|
|
|
2018-02-19 23:22:08 +03:00
|
|
|
.anchor {
|
2018-02-20 22:46:24 +03:00
|
|
|
display: none !important;
|
2018-02-19 23:22:08 +03:00
|
|
|
}
|
2018-10-06 18:51:56 +02:00
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
#main-content > details.toggle > summary::before,
|
|
|
|
#main-content > div > details.toggle > summary::before {
|
2021-05-14 19:58:21 +02:00
|
|
|
left: -11px;
|
2021-04-17 23:43:20 -07:00
|
|
|
}
|
|
|
|
|
2022-12-01 13:44:28 -07:00
|
|
|
/* We don't display these buttons on mobile devices. */
|
|
|
|
#copy-path, #help-button {
|
2020-10-15 17:28:42 +02:00
|
|
|
display: none;
|
|
|
|
}
|
2021-05-25 00:36:36 +02:00
|
|
|
|
2023-10-07 09:41:38 -07:00
|
|
|
/* sidebar button becomes topbar button */
|
|
|
|
#sidebar-button > a:before {
|
|
|
|
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
|
|
|
|
viewBox="0 0 22 22" fill="none" stroke="black">\
|
|
|
|
<rect x="1" y="1" width="20" height="20" ry="1.5" stroke-width="1.5"/>\
|
|
|
|
<circle cx="4.375" cy="4.375" r="1" stroke-width=".75"/>\
|
|
|
|
<path d="m3 7.375h16m0-3h-4" stroke-width="1.25"/></svg>');
|
|
|
|
width: 22px;
|
|
|
|
height: 22px;
|
|
|
|
}
|
2023-12-18 13:30:47 -07:00
|
|
|
.sidebar-menu-toggle:before {
|
|
|
|
filter: var(--mobile-sidebar-menu-filter);
|
|
|
|
}
|
|
|
|
.sidebar-menu-toggle:hover {
|
|
|
|
background: var(--main-background-color);
|
|
|
|
}
|
2023-10-07 09:41:38 -07:00
|
|
|
|
2021-05-25 00:36:36 +02:00
|
|
|
/* Display an alternating layout on tablets and phones */
|
2023-02-07 19:00:18 -07:00
|
|
|
.item-table, .item-row, .item-table > li, .item-table > li > div,
|
2022-11-04 12:34:24 -07:00
|
|
|
.search-results > a, .search-results > a > div {
|
2021-09-12 01:18:39 +02:00
|
|
|
display: block;
|
|
|
|
}
|
2021-05-25 00:36:36 +02:00
|
|
|
|
2021-05-21 23:11:06 +02:00
|
|
|
/* Display an alternating layout on tablets and phones */
|
|
|
|
.search-results > a {
|
2021-05-22 09:01:33 +00:00
|
|
|
padding: 5px 0px;
|
2021-05-21 23:11:06 +02:00
|
|
|
}
|
2023-02-07 19:00:18 -07:00
|
|
|
.search-results > a > div.desc, .item-table > li > div.desc {
|
2021-05-21 23:11:06 +02:00
|
|
|
padding-left: 2em;
|
|
|
|
}
|
2023-06-27 15:05:43 +02:00
|
|
|
.search-results .result-name {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.search-results .result-name .typename {
|
|
|
|
width: initial;
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
.search-results .result-name .typename, .search-results .result-name .path {
|
|
|
|
display: inline;
|
|
|
|
}
|
2021-12-14 11:48:30 +01:00
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.src-sidebar-expanded .src .sidebar {
|
2023-12-17 23:06:31 -07:00
|
|
|
position: fixed;
|
2021-12-14 11:48:30 +01:00
|
|
|
max-width: 100vw;
|
|
|
|
width: 100vw;
|
|
|
|
}
|
2023-12-17 23:06:31 -07:00
|
|
|
.src .src-sidebar-title {
|
|
|
|
padding-top: 0;
|
|
|
|
}
|
2021-12-29 18:54:33 +01:00
|
|
|
|
|
|
|
/* Position of the "[-]" element. */
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle:not(.top-doc) > summary {
|
2021-12-29 18:54:33 +01:00
|
|
|
margin-left: 10px;
|
|
|
|
}
|
2023-01-10 11:35:37 -07:00
|
|
|
.impl-items > details.toggle > summary:not(.hideme)::before,
|
|
|
|
#main-content > details.toggle:not(.top-doc) > summary::before,
|
|
|
|
#main-content > div > details.toggle > summary::before {
|
2021-12-29 18:54:33 +01:00
|
|
|
left: -11px;
|
|
|
|
}
|
2022-09-02 12:15:06 -07:00
|
|
|
|
|
|
|
/* Align summary-nested and unnested item-info gizmos. */
|
2022-10-12 11:24:23 -07:00
|
|
|
.impl-items > .item-info {
|
2022-09-02 12:15:06 -07:00
|
|
|
margin-left: 34px;
|
|
|
|
}
|
2022-10-20 13:22:36 -07:00
|
|
|
|
2023-07-14 16:38:01 -07:00
|
|
|
.src nav.sub {
|
2022-10-20 13:22:36 -07:00
|
|
|
margin: 0;
|
2023-04-05 17:13:00 +02:00
|
|
|
padding: var(--nav-sub-mobile-padding);
|
2022-10-20 13:22:36 -07:00
|
|
|
}
|
2017-12-18 21:27:19 +01:00
|
|
|
}
|
|
|
|
|
2024-09-01 23:59:46 +02:00
|
|
|
|
2022-12-05 23:48:07 -08:00
|
|
|
/* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
|
|
|
|
@media (min-width: 701px) {
|
2022-12-06 09:34:37 -08:00
|
|
|
/* Places file-link for a scraped example on top of the example to save space.
|
|
|
|
We only do this on large screens so the file-link doesn't overlap too much
|
|
|
|
with the example's content. */
|
2022-12-05 23:48:07 -08:00
|
|
|
.scraped-example-title {
|
|
|
|
position: absolute;
|
2022-12-06 09:34:37 -08:00
|
|
|
z-index: 10;
|
2022-12-05 23:48:07 -08:00
|
|
|
background: var(--main-background-color);
|
|
|
|
bottom: 8px;
|
|
|
|
right: 5px;
|
|
|
|
padding: 2px 4px;
|
|
|
|
box-shadow: 0 0 4px var(--main-background-color);
|
|
|
|
}
|
2024-07-17 14:33:10 +02:00
|
|
|
|
|
|
|
.item-table > li > .item-name {
|
|
|
|
width: 33%;
|
|
|
|
}
|
|
|
|
.item-table > li > div {
|
2024-07-19 09:00:50 -07:00
|
|
|
overflow-wrap: anywhere;
|
2024-07-17 14:33:10 +02:00
|
|
|
}
|
2022-12-05 23:48:07 -08:00
|
|
|
}
|
|
|
|
|
2019-04-29 23:43:39 +02:00
|
|
|
@media print {
|
2023-07-14 16:38:01 -07:00
|
|
|
nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path,
|
2023-01-10 11:35:37 -07:00
|
|
|
details.toggle[open] > summary::before, details.toggle > summary::before,
|
|
|
|
details.toggle.top-doc > summary {
|
2019-04-29 23:43:39 +02:00
|
|
|
display: none;
|
|
|
|
}
|
2022-07-08 01:54:55 -04:00
|
|
|
|
|
|
|
.docblock {
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
main {
|
2022-07-08 12:44:16 -04:00
|
|
|
padding: 10px;
|
2022-07-08 01:54:55 -04:00
|
|
|
}
|
2019-04-29 23:43:39 +02:00
|
|
|
}
|
2017-12-18 21:27:19 +01:00
|
|
|
|
2021-01-31 13:42:16 +01:00
|
|
|
@media (max-width: 464px) {
|
2021-01-31 01:19:29 +08:00
|
|
|
.docblock {
|
|
|
|
margin-left: 12px;
|
|
|
|
}
|
2021-10-07 17:25:58 +02:00
|
|
|
|
|
|
|
.docblock code {
|
2022-01-11 17:36:52 -08:00
|
|
|
overflow-wrap: break-word;
|
2021-10-07 17:25:58 +02:00
|
|
|
overflow-wrap: anywhere;
|
|
|
|
}
|
2021-10-24 22:41:48 +02:00
|
|
|
|
2022-10-20 13:22:36 -07:00
|
|
|
nav.sub {
|
2021-10-24 22:41:48 +02:00
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
2022-10-27 13:36:27 -07:00
|
|
|
.search-form {
|
2022-10-20 13:22:36 -07:00
|
|
|
align-self: stretch;
|
2021-10-24 22:41:48 +02:00
|
|
|
}
|
2017-12-08 16:36:08 +01:00
|
|
|
}
|
2021-05-09 16:22:22 -07:00
|
|
|
|
2022-11-17 15:24:39 -07:00
|
|
|
.variant,
|
2022-10-21 10:48:41 -07:00
|
|
|
.implementors-toggle > summary,
|
2022-09-28 17:38:25 -07:00
|
|
|
.impl,
|
2022-09-30 09:42:07 -07:00
|
|
|
#implementors-list > .docblock,
|
|
|
|
.impl-items > section,
|
2023-01-10 11:35:37 -07:00
|
|
|
.impl-items > .toggle > summary,
|
2022-10-30 23:10:59 -07:00
|
|
|
.methods > section,
|
2023-01-10 11:35:37 -07:00
|
|
|
.methods > .toggle > summary
|
2022-09-30 10:15:59 -07:00
|
|
|
{
|
2022-01-07 12:39:56 -05:00
|
|
|
margin-bottom: 0.75em;
|
|
|
|
}
|
|
|
|
|
2022-11-17 15:24:39 -07:00
|
|
|
.variants > .docblock,
|
2022-12-13 16:55:45 -07:00
|
|
|
.implementors-toggle > .docblock,
|
2023-01-10 11:35:37 -07:00
|
|
|
.impl-items > .toggle[open]:not(:last-child),
|
|
|
|
.methods > .toggle[open]:not(:last-child),
|
2022-09-27 09:21:24 -07:00
|
|
|
.implementors-toggle[open]:not(:last-child) {
|
2022-01-07 12:39:56 -05:00
|
|
|
margin-bottom: 2em;
|
|
|
|
}
|
|
|
|
|
2023-01-10 11:35:37 -07:00
|
|
|
#trait-implementations-list .impl-items > .toggle:not(:last-child),
|
|
|
|
#synthetic-implementations-list .impl-items > .toggle:not(:last-child),
|
|
|
|
#blanket-implementations-list .impl-items > .toggle:not(:last-child) {
|
2022-01-07 12:39:56 -05:00
|
|
|
margin-bottom: 1em;
|
|
|
|
}
|
2021-08-26 14:43:12 -07:00
|
|
|
|
|
|
|
/* Begin: styles for --scrape-examples feature */
|
2021-05-09 16:22:22 -07:00
|
|
|
|
2022-02-14 19:49:39 -08:00
|
|
|
.scraped-example-list .scrape-help {
|
2022-01-27 17:00:31 -08:00
|
|
|
margin-left: 10px;
|
|
|
|
padding: 0 4px;
|
|
|
|
font-weight: normal;
|
|
|
|
font-size: 12px;
|
|
|
|
position: relative;
|
|
|
|
bottom: 1px;
|
2022-12-30 10:43:06 -07:00
|
|
|
border: 1px solid var(--scrape-example-help-border-color);
|
2022-01-27 18:51:34 -08:00
|
|
|
border-radius: 50px;
|
2022-12-30 10:43:06 -07:00
|
|
|
color: var(--scrape-example-help-color);
|
|
|
|
}
|
|
|
|
.scraped-example-list .scrape-help:hover {
|
|
|
|
border-color: var(--scrape-example-help-hover-border-color);
|
|
|
|
color: var(--scrape-example-help-hover-color);
|
2022-01-27 17:00:31 -08:00
|
|
|
}
|
|
|
|
|
2024-09-02 15:59:00 +02:00
|
|
|
.scraped-example:not(.expanded) .example-wrap::before,
|
|
|
|
.scraped-example:not(.expanded) .example-wrap::after {
|
2021-05-09 16:22:22 -07:00
|
|
|
content: " ";
|
|
|
|
width: 100%;
|
2021-10-07 09:46:18 -07:00
|
|
|
height: 5px;
|
2021-05-09 16:22:22 -07:00
|
|
|
position: absolute;
|
2022-10-29 12:23:10 +02:00
|
|
|
z-index: 1;
|
|
|
|
}
|
2024-09-02 15:59:00 +02:00
|
|
|
.scraped-example:not(.expanded) .example-wrap::before {
|
|
|
|
top: 0;
|
2023-01-21 12:15:42 +01:00
|
|
|
background: linear-gradient(to bottom,
|
|
|
|
var(--scrape-example-code-wrapper-background-start),
|
|
|
|
var(--scrape-example-code-wrapper-background-end));
|
2021-05-09 16:22:22 -07:00
|
|
|
}
|
2024-09-02 15:59:00 +02:00
|
|
|
.scraped-example:not(.expanded) .example-wrap::after {
|
2021-05-09 16:22:22 -07:00
|
|
|
bottom: 0;
|
2023-01-21 12:15:42 +01:00
|
|
|
background: linear-gradient(to top,
|
|
|
|
var(--scrape-example-code-wrapper-background-start),
|
|
|
|
var(--scrape-example-code-wrapper-background-end));
|
2021-05-09 16:22:22 -07:00
|
|
|
}
|
|
|
|
|
2024-08-30 18:27:11 +02:00
|
|
|
.scraped-example:not(.expanded) {
|
2022-11-26 21:39:39 -06:00
|
|
|
width: 100%;
|
2021-05-09 16:22:22 -07:00
|
|
|
overflow-y: hidden;
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
2024-08-30 18:27:11 +02:00
|
|
|
.scraped-example:not(.expanded) {
|
2022-01-27 17:00:31 -08:00
|
|
|
overflow-x: hidden;
|
|
|
|
}
|
|
|
|
|
2024-08-30 18:27:11 +02:00
|
|
|
.scraped-example .rust span.highlight {
|
2022-12-28 17:14:17 +01:00
|
|
|
background: var(--scrape-example-code-line-highlight);
|
|
|
|
}
|
2024-08-30 18:27:11 +02:00
|
|
|
.scraped-example .rust span.highlight.focus {
|
2022-12-28 17:14:17 +01:00
|
|
|
background: var(--scrape-example-code-line-highlight-focus);
|
|
|
|
}
|
|
|
|
|
2021-10-06 21:43:40 -07:00
|
|
|
.more-examples-toggle {
|
2022-01-27 17:00:31 -08:00
|
|
|
max-width: calc(100% + 25px);
|
2021-10-06 21:43:40 -07:00
|
|
|
margin-top: 10px;
|
2022-01-27 17:00:31 -08:00
|
|
|
margin-left: -25px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.more-examples-toggle .hide-more {
|
|
|
|
margin-left: 25px;
|
|
|
|
cursor: pointer;
|
2021-10-06 21:43:40 -07:00
|
|
|
}
|
|
|
|
|
2021-05-09 16:22:22 -07:00
|
|
|
.more-scraped-examples {
|
2022-12-21 18:03:31 -07:00
|
|
|
margin-left: 25px;
|
|
|
|
position: relative;
|
2021-08-25 20:15:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-line {
|
2022-12-21 18:03:31 -07:00
|
|
|
position: absolute;
|
|
|
|
top: 5px;
|
|
|
|
bottom: 0;
|
|
|
|
right: calc(100% + 10px);
|
2021-08-25 20:15:46 -07:00
|
|
|
padding: 0 4px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-line-inner {
|
|
|
|
min-width: 2px;
|
|
|
|
height: 100%;
|
2022-12-24 08:28:59 +01:00
|
|
|
background: var(--scrape-example-toggle-line-background);
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-line:hover .toggle-line-inner {
|
|
|
|
background: var(--scrape-example-toggle-line-hover-background);
|
2021-08-25 20:15:46 -07:00
|
|
|
}
|
|
|
|
|
2022-12-16 10:11:37 -07:00
|
|
|
.more-scraped-examples .scraped-example, .example-links {
|
|
|
|
margin-top: 20px;
|
2021-09-14 09:50:47 -07:00
|
|
|
}
|
|
|
|
|
2022-12-16 10:11:37 -07:00
|
|
|
.more-scraped-examples .scraped-example:first-child {
|
|
|
|
margin-top: 5px;
|
2021-08-25 20:15:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.example-links ul {
|
|
|
|
margin-bottom: 0;
|
2021-05-09 16:22:22 -07:00
|
|
|
}
|
2021-08-26 14:43:12 -07:00
|
|
|
|
|
|
|
/* End: styles for --scrape-examples feature */
|
2023-09-13 15:08:45 -07:00
|
|
|
|
|
|
|
/* Begin: styles for themes
|
|
|
|
|
|
|
|
Keep the default light and dark themes synchronized with the ones
|
|
|
|
in noscript.css
|
|
|
|
|
|
|
|
The special "Begin theme" and "End theme" below are used by a lot of
|
|
|
|
tooling to ensure different themes all define all the variables. Do not
|
|
|
|
alter their formatting. */
|
|
|
|
|
2024-04-03 14:11:01 +02:00
|
|
|
/*
|
|
|
|
About `:root:not([data-theme])`: if for any reason the JS is enabled but cannot be loaded,
|
|
|
|
`noscript` won't be enabled and the doc will have no color applied. To do around this, we
|
|
|
|
add a selector check that if `data-theme` is not defined, then we apply the light theme
|
|
|
|
by default.
|
|
|
|
*/
|
2023-09-13 15:08:45 -07:00
|
|
|
/* Begin theme: light */
|
2024-04-03 14:11:01 +02:00
|
|
|
:root[data-theme="light"], :root:not([data-theme]) {
|
2023-09-13 15:08:45 -07:00
|
|
|
--main-background-color: white;
|
|
|
|
--main-color: black;
|
|
|
|
--settings-input-color: #2196f3;
|
|
|
|
--settings-input-border-color: #717171;
|
|
|
|
--settings-button-color: #000;
|
|
|
|
--settings-button-border-focus: #717171;
|
|
|
|
--sidebar-background-color: #f5f5f5;
|
|
|
|
--sidebar-background-color-hover: #e0e0e0;
|
|
|
|
--code-block-background-color: #f5f5f5;
|
|
|
|
--scrollbar-track-background-color: #dcdcdc;
|
|
|
|
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
|
|
|
|
--scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
|
|
|
|
--headings-border-bottom-color: #ddd;
|
|
|
|
--border-color: #e0e0e0;
|
|
|
|
--button-background-color: #fff;
|
|
|
|
--right-side-color: grey;
|
|
|
|
--code-attribute-color: #999;
|
|
|
|
--toggles-color: #999;
|
|
|
|
--toggle-filter: none;
|
2023-12-18 13:30:47 -07:00
|
|
|
--mobile-sidebar-menu-filter: none;
|
2023-09-13 15:08:45 -07:00
|
|
|
--search-input-focused-border-color: #66afe9;
|
|
|
|
--copy-path-button-color: #999;
|
|
|
|
--copy-path-img-filter: invert(50%);
|
|
|
|
--copy-path-img-hover-filter: invert(35%);
|
2024-08-30 18:27:11 +02:00
|
|
|
--code-example-button-color: #7f7f7f;
|
|
|
|
--code-example-button-hover-color: #595959;
|
2023-09-13 15:08:45 -07:00
|
|
|
--codeblock-error-hover-color: rgb(255, 0, 0);
|
|
|
|
--codeblock-error-color: rgba(255, 0, 0, .5);
|
|
|
|
--codeblock-ignore-hover-color: rgb(255, 142, 0);
|
|
|
|
--codeblock-ignore-color: rgba(255, 142, 0, .6);
|
|
|
|
--warning-border-color: #ff8e00;
|
|
|
|
--type-link-color: #ad378a;
|
|
|
|
--trait-link-color: #6e4fc9;
|
|
|
|
--assoc-item-link-color: #3873ad;
|
|
|
|
--function-link-color: #ad7c37;
|
|
|
|
--macro-link-color: #068000;
|
|
|
|
--keyword-link-color: #3873ad;
|
|
|
|
--mod-link-color: #3873ad;
|
|
|
|
--link-color: #3873ad;
|
|
|
|
--sidebar-link-color: #356da4;
|
|
|
|
--sidebar-current-link-background-color: #fff;
|
|
|
|
--search-result-link-focus-background-color: #ccc;
|
|
|
|
--search-result-border-color: #aaa3;
|
|
|
|
--search-color: #000;
|
|
|
|
--search-error-code-background-color: #d0cccc;
|
|
|
|
--search-results-alias-color: #000;
|
|
|
|
--search-results-grey-color: #999;
|
|
|
|
--search-tab-title-count-color: #888;
|
|
|
|
--search-tab-button-not-selected-border-top-color: #e6e6e6;
|
|
|
|
--search-tab-button-not-selected-background: #e6e6e6;
|
|
|
|
--search-tab-button-selected-border-top-color: #0089ff;
|
|
|
|
--search-tab-button-selected-background: #fff;
|
2024-05-05 19:27:59 +02:00
|
|
|
--settings-menu-filter: none;
|
2023-09-13 15:08:45 -07:00
|
|
|
--stab-background-color: #fff5d6;
|
|
|
|
--stab-code-color: #000;
|
|
|
|
--code-highlight-kw-color: #8959a8;
|
|
|
|
--code-highlight-kw-2-color: #4271ae;
|
|
|
|
--code-highlight-lifetime-color: #b76514;
|
|
|
|
--code-highlight-prelude-color: #4271ae;
|
|
|
|
--code-highlight-prelude-val-color: #c82829;
|
|
|
|
--code-highlight-number-color: #718c00;
|
|
|
|
--code-highlight-string-color: #718c00;
|
|
|
|
--code-highlight-literal-color: #c82829;
|
|
|
|
--code-highlight-attribute-color: #c82829;
|
|
|
|
--code-highlight-self-color: #c82829;
|
|
|
|
--code-highlight-macro-color: #3e999f;
|
|
|
|
--code-highlight-question-mark-color: #ff9011;
|
|
|
|
--code-highlight-comment-color: #8e908c;
|
|
|
|
--code-highlight-doc-comment-color: #4d4d4c;
|
|
|
|
--src-line-numbers-span-color: #c67e2d;
|
|
|
|
--src-line-number-highlighted-background-color: #fdffd3;
|
|
|
|
--target-background-color: #fdffd3;
|
|
|
|
--target-border-color: #ad7c37;
|
|
|
|
--kbd-color: #000;
|
|
|
|
--kbd-background: #fafbfc;
|
|
|
|
--kbd-box-shadow-color: #c6cbd1;
|
|
|
|
--rust-logo-filter: initial;
|
|
|
|
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
|
|
|
|
--crate-search-div-filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg)
|
|
|
|
brightness(114%) contrast(76%);
|
|
|
|
--crate-search-div-hover-filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg)
|
|
|
|
brightness(96%) contrast(93%);
|
|
|
|
--crate-search-hover-border: #717171;
|
|
|
|
--src-sidebar-background-selected: #fff;
|
|
|
|
--src-sidebar-background-hover: #e0e0e0;
|
|
|
|
--table-alt-row-background-color: #f5f5f5;
|
|
|
|
--codeblock-link-background: #eee;
|
|
|
|
--scrape-example-toggle-line-background: #ccc;
|
|
|
|
--scrape-example-toggle-line-hover-background: #999;
|
|
|
|
--scrape-example-code-line-highlight: #fcffd6;
|
|
|
|
--scrape-example-code-line-highlight-focus: #f6fdb0;
|
|
|
|
--scrape-example-help-border-color: #555;
|
|
|
|
--scrape-example-help-color: #333;
|
|
|
|
--scrape-example-help-hover-border-color: #000;
|
|
|
|
--scrape-example-help-hover-color: #000;
|
|
|
|
--scrape-example-code-wrapper-background-start: rgba(255, 255, 255, 1);
|
|
|
|
--scrape-example-code-wrapper-background-end: rgba(255, 255, 255, 0);
|
2023-09-07 18:45:24 -07:00
|
|
|
--sidebar-resizer-hover: hsl(207, 90%, 66%);
|
|
|
|
--sidebar-resizer-active: hsl(207, 90%, 54%);
|
2023-09-13 15:08:45 -07:00
|
|
|
}
|
|
|
|
/* End theme: light */
|
|
|
|
|
|
|
|
/* Begin theme: dark */
|
|
|
|
:root[data-theme="dark"] {
|
|
|
|
--main-background-color: #353535;
|
|
|
|
--main-color: #ddd;
|
|
|
|
--settings-input-color: #2196f3;
|
|
|
|
--settings-input-border-color: #999;
|
|
|
|
--settings-button-color: #000;
|
|
|
|
--settings-button-border-focus: #ffb900;
|
|
|
|
--sidebar-background-color: #505050;
|
|
|
|
--sidebar-background-color-hover: #676767;
|
|
|
|
--code-block-background-color: #2A2A2A;
|
|
|
|
--scrollbar-track-background-color: #717171;
|
|
|
|
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
|
|
|
|
--scrollbar-color: rgba(32,34,37,.6) #5a5a5a;
|
|
|
|
--headings-border-bottom-color: #d2d2d2;
|
|
|
|
--border-color: #e0e0e0;
|
|
|
|
--button-background-color: #f0f0f0;
|
|
|
|
--right-side-color: grey;
|
|
|
|
--code-attribute-color: #999;
|
|
|
|
--toggles-color: #999;
|
|
|
|
--toggle-filter: invert(100%);
|
2023-12-18 13:30:47 -07:00
|
|
|
--mobile-sidebar-menu-filter: invert(100%);
|
2023-09-13 15:08:45 -07:00
|
|
|
--search-input-focused-border-color: #008dfd;
|
|
|
|
--copy-path-button-color: #999;
|
|
|
|
--copy-path-img-filter: invert(50%);
|
|
|
|
--copy-path-img-hover-filter: invert(65%);
|
2024-08-30 18:27:11 +02:00
|
|
|
--code-example-button-color: #7f7f7f;
|
|
|
|
--code-example-button-hover-color: #a5a5a5;
|
2023-09-13 15:08:45 -07:00
|
|
|
--codeblock-error-hover-color: rgb(255, 0, 0);
|
|
|
|
--codeblock-error-color: rgba(255, 0, 0, .5);
|
|
|
|
--codeblock-ignore-hover-color: rgb(255, 142, 0);
|
|
|
|
--codeblock-ignore-color: rgba(255, 142, 0, .6);
|
|
|
|
--warning-border-color: #ff8e00;
|
|
|
|
--type-link-color: #2dbfb8;
|
|
|
|
--trait-link-color: #b78cf2;
|
|
|
|
--assoc-item-link-color: #d2991d;
|
|
|
|
--function-link-color: #2bab63;
|
|
|
|
--macro-link-color: #09bd00;
|
|
|
|
--keyword-link-color: #d2991d;
|
|
|
|
--mod-link-color: #d2991d;
|
|
|
|
--link-color: #d2991d;
|
|
|
|
--sidebar-link-color: #fdbf35;
|
|
|
|
--sidebar-current-link-background-color: #444;
|
|
|
|
--search-result-link-focus-background-color: #616161;
|
|
|
|
--search-result-border-color: #aaa3;
|
|
|
|
--search-color: #111;
|
|
|
|
--search-error-code-background-color: #484848;
|
|
|
|
--search-results-alias-color: #fff;
|
|
|
|
--search-results-grey-color: #ccc;
|
|
|
|
--search-tab-title-count-color: #888;
|
|
|
|
--search-tab-button-not-selected-border-top-color: #252525;
|
|
|
|
--search-tab-button-not-selected-background: #252525;
|
|
|
|
--search-tab-button-selected-border-top-color: #0089ff;
|
|
|
|
--search-tab-button-selected-background: #353535;
|
2024-05-05 19:27:59 +02:00
|
|
|
--settings-menu-filter: none;
|
2023-09-13 15:08:45 -07:00
|
|
|
--stab-background-color: #314559;
|
|
|
|
--stab-code-color: #e6e1cf;
|
|
|
|
--code-highlight-kw-color: #ab8ac1;
|
|
|
|
--code-highlight-kw-2-color: #769acb;
|
|
|
|
--code-highlight-lifetime-color: #d97f26;
|
|
|
|
--code-highlight-prelude-color: #769acb;
|
|
|
|
--code-highlight-prelude-val-color: #ee6868;
|
|
|
|
--code-highlight-number-color: #83a300;
|
|
|
|
--code-highlight-string-color: #83a300;
|
|
|
|
--code-highlight-literal-color: #ee6868;
|
|
|
|
--code-highlight-attribute-color: #ee6868;
|
|
|
|
--code-highlight-self-color: #ee6868;
|
|
|
|
--code-highlight-macro-color: #3e999f;
|
|
|
|
--code-highlight-question-mark-color: #ff9011;
|
|
|
|
--code-highlight-comment-color: #8d8d8b;
|
|
|
|
--code-highlight-doc-comment-color: #8ca375;
|
|
|
|
--src-line-numbers-span-color: #3b91e2;
|
|
|
|
--src-line-number-highlighted-background-color: #0a042f;
|
|
|
|
--target-background-color: #494a3d;
|
|
|
|
--target-border-color: #bb7410;
|
|
|
|
--kbd-color: #000;
|
|
|
|
--kbd-background: #fafbfc;
|
|
|
|
--kbd-box-shadow-color: #c6cbd1;
|
|
|
|
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
|
|
|
|
drop-shadow(0 1px 0 #fff)
|
|
|
|
drop-shadow(-1px 0 0 #fff)
|
|
|
|
drop-shadow(0 -1px 0 #fff);
|
|
|
|
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
|
|
|
|
--crate-search-div-filter: invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg)
|
|
|
|
brightness(90%) contrast(90%);
|
|
|
|
--crate-search-div-hover-filter: invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg)
|
|
|
|
brightness(100%) contrast(91%);
|
|
|
|
--crate-search-hover-border: #2196f3;
|
|
|
|
--src-sidebar-background-selected: #333;
|
|
|
|
--src-sidebar-background-hover: #444;
|
|
|
|
--table-alt-row-background-color: #2a2a2a;
|
|
|
|
--codeblock-link-background: #333;
|
|
|
|
--scrape-example-toggle-line-background: #999;
|
|
|
|
--scrape-example-toggle-line-hover-background: #c5c5c5;
|
|
|
|
--scrape-example-code-line-highlight: #5b3b01;
|
|
|
|
--scrape-example-code-line-highlight-focus: #7c4b0f;
|
|
|
|
--scrape-example-help-border-color: #aaa;
|
|
|
|
--scrape-example-help-color: #eee;
|
|
|
|
--scrape-example-help-hover-border-color: #fff;
|
|
|
|
--scrape-example-help-hover-color: #fff;
|
|
|
|
--scrape-example-code-wrapper-background-start: rgba(53, 53, 53, 1);
|
|
|
|
--scrape-example-code-wrapper-background-end: rgba(53, 53, 53, 0);
|
2023-09-07 18:45:24 -07:00
|
|
|
--sidebar-resizer-hover: hsl(207, 30%, 54%);
|
|
|
|
--sidebar-resizer-active: hsl(207, 90%, 54%);
|
2023-09-13 15:08:45 -07:00
|
|
|
}
|
|
|
|
/* End theme: dark */
|
|
|
|
|
|
|
|
/* Begin theme: ayu */
|
|
|
|
/*
|
|
|
|
Based off of the Ayu theme
|
|
|
|
Original by Dempfi (https://github.com/dempfi/ayu)
|
|
|
|
*/
|
|
|
|
:root[data-theme="ayu"] {
|
|
|
|
--main-background-color: #0f1419;
|
|
|
|
--main-color: #c5c5c5;
|
|
|
|
--settings-input-color: #ffb454;
|
|
|
|
--settings-input-border-color: #999;
|
|
|
|
--settings-button-color: #fff;
|
|
|
|
--settings-button-border-focus: #e0e0e0;
|
|
|
|
--sidebar-background-color: #14191f;
|
|
|
|
--sidebar-background-color-hover: rgba(70, 70, 70, 0.33);
|
|
|
|
--code-block-background-color: #191f26;
|
|
|
|
--scrollbar-track-background-color: transparent;
|
|
|
|
--scrollbar-thumb-background-color: #5c6773;
|
|
|
|
--scrollbar-color: #5c6773 #24292f;
|
|
|
|
--headings-border-bottom-color: #5c6773;
|
|
|
|
--border-color: #5c6773;
|
|
|
|
--button-background-color: #141920;
|
|
|
|
--right-side-color: grey;
|
|
|
|
--code-attribute-color: #999;
|
|
|
|
--toggles-color: #999;
|
|
|
|
--toggle-filter: invert(100%);
|
2023-12-18 13:30:47 -07:00
|
|
|
--mobile-sidebar-menu-filter: invert(100%);
|
2023-09-13 15:08:45 -07:00
|
|
|
--search-input-focused-border-color: #5c6773; /* Same as `--border-color`. */
|
|
|
|
--copy-path-button-color: #fff;
|
|
|
|
--copy-path-img-filter: invert(70%);
|
|
|
|
--copy-path-img-hover-filter: invert(100%);
|
2024-08-30 18:27:11 +02:00
|
|
|
--code-example-button-color: #b2b2b2;
|
|
|
|
--code-example-button-hover-color: #fff;
|
2023-09-13 15:08:45 -07:00
|
|
|
--codeblock-error-hover-color: rgb(255, 0, 0);
|
|
|
|
--codeblock-error-color: rgba(255, 0, 0, .5);
|
|
|
|
--codeblock-ignore-hover-color: rgb(255, 142, 0);
|
|
|
|
--codeblock-ignore-color: rgba(255, 142, 0, .6);
|
|
|
|
--warning-border-color: #ff8e00;
|
|
|
|
--type-link-color: #ffa0a5;
|
|
|
|
--trait-link-color: #39afd7;
|
|
|
|
--assoc-item-link-color: #39afd7;
|
|
|
|
--function-link-color: #fdd687;
|
|
|
|
--macro-link-color: #a37acc;
|
|
|
|
--keyword-link-color: #39afd7;
|
|
|
|
--mod-link-color: #39afd7;
|
|
|
|
--link-color: #39afd7;
|
|
|
|
--sidebar-link-color: #53b1db;
|
|
|
|
--sidebar-current-link-background-color: transparent;
|
|
|
|
--search-result-link-focus-background-color: #3c3c3c;
|
|
|
|
--search-result-border-color: #aaa3;
|
|
|
|
--search-color: #fff;
|
|
|
|
--search-error-code-background-color: #4f4c4c;
|
|
|
|
--search-results-alias-color: #c5c5c5;
|
|
|
|
--search-results-grey-color: #999;
|
|
|
|
--search-tab-title-count-color: #888;
|
|
|
|
--search-tab-button-not-selected-border-top-color: none;
|
|
|
|
--search-tab-button-not-selected-background: transparent !important;
|
|
|
|
--search-tab-button-selected-border-top-color: none;
|
|
|
|
--search-tab-button-selected-background: #141920 !important;
|
2024-05-05 19:27:59 +02:00
|
|
|
--settings-menu-filter: invert(100%);
|
2023-09-13 15:08:45 -07:00
|
|
|
--stab-background-color: #314559;
|
|
|
|
--stab-code-color: #e6e1cf;
|
|
|
|
--code-highlight-kw-color: #ff7733;
|
|
|
|
--code-highlight-kw-2-color: #ff7733;
|
|
|
|
--code-highlight-lifetime-color: #ff7733;
|
|
|
|
--code-highlight-prelude-color: #69f2df;
|
|
|
|
--code-highlight-prelude-val-color: #ff7733;
|
|
|
|
--code-highlight-number-color: #b8cc52;
|
|
|
|
--code-highlight-string-color: #b8cc52;
|
|
|
|
--code-highlight-literal-color: #ff7733;
|
|
|
|
--code-highlight-attribute-color: #e6e1cf;
|
|
|
|
--code-highlight-self-color: #36a3d9;
|
|
|
|
--code-highlight-macro-color: #a37acc;
|
|
|
|
--code-highlight-question-mark-color: #ff9011;
|
|
|
|
--code-highlight-comment-color: #788797;
|
|
|
|
--code-highlight-doc-comment-color: #a1ac88;
|
|
|
|
--src-line-numbers-span-color: #5c6773;
|
|
|
|
--src-line-number-highlighted-background-color: rgba(255, 236, 164, 0.06);
|
|
|
|
--target-background-color: rgba(255, 236, 164, 0.06);
|
|
|
|
--target-border-color: rgba(255, 180, 76, 0.85);
|
|
|
|
--kbd-color: #c5c5c5;
|
|
|
|
--kbd-background: #314559;
|
|
|
|
--kbd-box-shadow-color: #5c6773;
|
|
|
|
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
|
|
|
|
drop-shadow(0 1px 0 #fff)
|
|
|
|
drop-shadow(-1px 0 0 #fff)
|
|
|
|
drop-shadow(0 -1px 0 #fff);
|
|
|
|
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
|
|
|
|
--crate-search-div-filter: invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg)
|
|
|
|
brightness(94%) contrast(94%);
|
|
|
|
--crate-search-div-hover-filter: invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg)
|
|
|
|
brightness(113%) contrast(76%);
|
|
|
|
--crate-search-hover-border: #e0e0e0;
|
|
|
|
--src-sidebar-background-selected: #14191f;
|
|
|
|
--src-sidebar-background-hover: #14191f;
|
|
|
|
--table-alt-row-background-color: #191f26;
|
|
|
|
--codeblock-link-background: #333;
|
|
|
|
--scrape-example-toggle-line-background: #999;
|
|
|
|
--scrape-example-toggle-line-hover-background: #c5c5c5;
|
|
|
|
--scrape-example-code-line-highlight: #5b3b01;
|
|
|
|
--scrape-example-code-line-highlight-focus: #7c4b0f;
|
|
|
|
--scrape-example-help-border-color: #aaa;
|
|
|
|
--scrape-example-help-color: #eee;
|
|
|
|
--scrape-example-help-hover-border-color: #fff;
|
|
|
|
--scrape-example-help-hover-color: #fff;
|
|
|
|
--scrape-example-code-wrapper-background-start: rgba(15, 20, 25, 1);
|
|
|
|
--scrape-example-code-wrapper-background-end: rgba(15, 20, 25, 0);
|
2023-09-07 18:45:24 -07:00
|
|
|
--sidebar-resizer-hover: hsl(34, 50%, 33%);
|
|
|
|
--sidebar-resizer-active: hsl(34, 100%, 66%);
|
2023-09-13 15:08:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] h1,
|
|
|
|
:root[data-theme="ayu"] h2,
|
|
|
|
:root[data-theme="ayu"] h3,
|
|
|
|
:root[data-theme="ayu"] h4,
|
|
|
|
:where(:root[data-theme="ayu"]) h1 a,
|
|
|
|
:root[data-theme="ayu"] .sidebar h2 a,
|
2023-12-18 16:00:57 -07:00
|
|
|
:root[data-theme="ayu"] .sidebar h3 a {
|
2023-09-13 15:08:45 -07:00
|
|
|
color: #fff;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .docblock code {
|
|
|
|
color: #ffb454;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .docblock a > code {
|
|
|
|
color: #39AFD7 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .code-header,
|
|
|
|
:root[data-theme="ayu"] .docblock pre > code,
|
|
|
|
:root[data-theme="ayu"] pre,
|
|
|
|
:root[data-theme="ayu"] pre > code,
|
|
|
|
:root[data-theme="ayu"] .item-info code,
|
|
|
|
:root[data-theme="ayu"] .rustdoc.source .example-wrap {
|
|
|
|
color: #e6e1cf;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .sidebar .current,
|
2023-09-07 18:45:24 -07:00
|
|
|
:root[data-theme="ayu"] .sidebar .current a,
|
2023-09-13 15:08:45 -07:00
|
|
|
:root[data-theme="ayu"] .sidebar a:hover,
|
|
|
|
:root[data-theme="ayu"] #src-sidebar div.files > a:hover,
|
|
|
|
:root[data-theme="ayu"] details.dir-entry summary:hover,
|
|
|
|
:root[data-theme="ayu"] #src-sidebar div.files > a:focus,
|
|
|
|
:root[data-theme="ayu"] details.dir-entry summary:focus,
|
|
|
|
:root[data-theme="ayu"] #src-sidebar div.files > a.selected {
|
|
|
|
color: #ffb44c;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .sidebar-elems .location {
|
|
|
|
color: #ff7733;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .src-line-numbers .line-highlighted {
|
|
|
|
color: #708090;
|
|
|
|
padding-right: 7px;
|
|
|
|
border-right: 1px solid #ffb44c;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .search-results a:hover,
|
|
|
|
:root[data-theme="ayu"] .search-results a:focus {
|
|
|
|
color: #fff !important;
|
|
|
|
background-color: #3c3c3c;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .search-results a {
|
|
|
|
color: #0096cf;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .search-results a div.desc {
|
|
|
|
color: #c5c5c5;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] .result-name .primitive > i,
|
|
|
|
:root[data-theme="ayu"] .result-name .keyword > i {
|
|
|
|
color: #788797;
|
|
|
|
}
|
|
|
|
|
|
|
|
:root[data-theme="ayu"] #search-tabs > button.selected {
|
|
|
|
border-bottom: 1px solid #ffb44c !important;
|
|
|
|
border-top: none;
|
|
|
|
}
|
|
|
|
:root[data-theme="ayu"] #search-tabs > button:not(.selected) {
|
|
|
|
border: none;
|
|
|
|
background-color: transparent !important;
|
|
|
|
}
|
|
|
|
:root[data-theme="ayu"] #search-tabs > button:hover {
|
|
|
|
border-bottom: 1px solid rgba(242, 151, 24, 0.3);
|
|
|
|
}
|
|
|
|
|
2023-09-07 18:45:24 -07:00
|
|
|
:root[data-theme="ayu"] #settings-menu > a img,
|
2023-10-07 09:41:38 -07:00
|
|
|
:root[data-theme="ayu"] #sidebar-button > a:before {
|
2023-09-13 15:08:45 -07:00
|
|
|
filter: invert(100);
|
|
|
|
}
|
|
|
|
/* End theme: ayu */
|
|
|
|
|
|
|
|
/* End: styles for themes */
|