Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 44 additions & 24 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,13 @@ so that we can apply CSS-filters to change the arrow color in themes */
padding: 4px;
transform: rotate(-45deg);
top: -5px;
/* So the arrow doesn't go above the content in the popover. */
z-index: -1;
}
#settings.popover::before {
/* Because of the tabs, it renders weird if we pick a different color than the tab's
background. */
background-color: var(--search-tab-button-not-selected-background);
}

.setting-line {
Expand Down Expand Up @@ -1548,9 +1555,22 @@ so that we can apply CSS-filters to change the arrow color in themes */
border-color: var(--settings-input-color) !important;
}

.settings-menu #settings {
/* This is to prevent the popover width to change when we switch tabs. I picked the biggest
width based on the setting with the longest text. The `- 2px` is to includes the borders
width when the window's width is very thin. */
width: min(456px, calc(100vw - 2px));
}
#settings.popover {
--popover-arrow-offset: 196px;
top: calc(100% - 16px);
right: 1px;
}

#settings .settings {
height: 100%;
display: flex;
flex-direction: column;
}

/* use larger max-width for help popover, but not for help.html */
Expand Down Expand Up @@ -2032,13 +2052,15 @@ a.tooltip:hover::after {

#search-tabs {
margin-top: 0.25rem;
margin-bottom: 4px;
}

#search-tabs, #settings .tabs {
display: flex;
flex-direction: row;
gap: 1px;
margin-bottom: 4px;
}

#search-tabs button {
#search-tabs button, #settings .tabs button.tab {
text-align: center;
font-size: 1.125rem;
border: 0;
Expand All @@ -2047,15 +2069,23 @@ a.tooltip:hover::after {
line-height: 1.5;
color: inherit;
}
#search-tabs button:not(.selected) {
#search-tabs button:not(.selected), #settings .tabs button.tab: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 {
#search-tabs button:hover, #search-tabs button.selected,
#settings .tabs button.tab:hover, #settings .tabs button.tab.selected {
background-color: var(--search-tab-button-selected-background);
border-top-color: var(--search-tab-button-selected-border-top-color);
}

#settings .settings .setting {
display: none;
}
#settings .settings .setting.selected {
display: block;
}

#search-tabs .count {
font-size: 1rem;
font-variant-numeric: tabular-nums;
Expand All @@ -2067,8 +2097,7 @@ a.tooltip:hover::after {
color: transparent;
}

.search-form.loading::after
{
.search-form.loading::after {
width: 18px;
height: 18px;
border-radius: 18px;
Expand Down Expand Up @@ -2777,8 +2806,11 @@ in src-script.js and main.js
}
/* The `overflow-y` property is used on an internal content instead of the top one otherwise the
little arrow at the top can't be displayed. */
#settings.popover .settings, #help.popover .content {
#settings.popover .settings .setting, #help.popover .content {
overflow-y: scroll;
}

#help.popover .content {
height: 100%;
}

Expand Down Expand Up @@ -3491,10 +3523,10 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--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;
--search-tab-button-not-selected-border-top-color: #1d1f20;
--search-tab-button-not-selected-background: #1d1f20;
--search-tab-button-selected-border-top-color: #ffb44c;
--search-tab-button-selected-background: #141920;
--settings-menu-filter: invert(70%);
--settings-menu-hover-filter: invert(100%);
--stab-background-color: #314559;
Expand Down Expand Up @@ -3621,18 +3653,6 @@ Original by Dempfi (https://github.com/dempfi/ayu)
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);
}

:root[data-theme="ayu"] .settings-menu > a img,
:root[data-theme="ayu"] #sidebar-button > a::before {
filter: invert(100);
Expand Down
10 changes: 9 additions & 1 deletion src/librustdoc/html/static/js/rustdoc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ declare namespace rustdoc {
type Dir = [string, rustdoc.Dir[], string[]]

/**
* Indivitual setting object, used in `settings.js`
* Individual setting object, used in `settings.js`.
*/
interface Setting {
js_name: string,
Expand All @@ -571,6 +571,14 @@ declare namespace rustdoc {
default: string | boolean,
}

/**
* Individual settings tab, used in `settings.js`.
*/
interface SettingsTab {
name: string,
settings: Array<rustdoc.Setting>,
}

/**
* Single element in the data-locs field of a scraped example.
* First field is the start and end char index,
Expand Down
Loading
Loading