mediawiki-skins-Vector/resources/skins.vector.styles/components/TableOfContents.less

183 lines
4.7 KiB
Plaintext
Raw Normal View History

@import '../../common/variables.less';
.vector-toc {
max-height: 75vh;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
background-color: @background-color-page-container;
.vector-feature-page-tools-disabled & {
padding: @padding-top-tabs 12px 20px 27px;
.vector-toc-pinnable-header {
// Override default pinnable header styles
padding: 0 0 12px 0;
border: 0;
line-height: initial;
}
}
.vector-pinnable-header-label {
// Override heading element styles in elements.less
overflow: unset;
}
.vector-toc-numb {
display: none;
}
.vector-toc-toggle {
// For no-js users, toggling is disabled and icon is hidden
display: none;
position: absolute;
top: 1px; // visually center icon
left: ~'calc( -1 * @{size-toc-subsection-toggle-icon} - 1px )'; // leaves 6px between icon + text
width: @size-toc-subsection-toggle-icon; // ~22px @ 12
height: @size-toc-subsection-toggle-icon;
font-size: 0.75em; // reduces size of toggle icon to 12px @ 16
transition: @transition-duration-base;
color: transparent;
cursor: pointer;
.vector-feature-page-tools-enabled & {
// Vertically center the icon with the text
margin-top: 2px;
}
}
.vector-toc-link {
word-break: break-word;
color: @color-link;
display: block;
}
// Highlight and bold active sections, active top sections that are unexpanded
// and active top sections that are the only active element.
.vector-toc-list-item-active,
.vector-toc-level-1-active:not( .vector-toc-list-item-expanded ),
.vector-toc-list-item-active.vector-toc-level-1-active {
> .vector-toc-link {
// Highlight active section
color: @color-base;
font-weight: bold;
.vector-toc-text {
// Increase width to prevent line wrapping due to bold text
// Avoid applying on link element to avoid focus indicator changing size
width: ~'calc( 100% + @{padding-horizontal-dropdown-menu-item} )';
}
}
}
// Highlight active top sections that contain an active section
.vector-toc-level-1-active:not( .vector-toc-list-item-active ) > .vector-toc-link {
color: @color-base;
}
.vector-toc-text {
.vector-feature-page-tools-disabled & {
padding: 4px 0;
}
.vector-feature-page-tools-enabled & {
// Match .mixin-vector-dropdown-menu-item() vertical padding
padding: @padding-vertical-dropdown-menu-item 0;
}
}
.vector-toc-contents,
.vector-toc-list {
margin: 0;
list-style: none;
.vector-feature-page-tools-disabled & {
line-height: 18px;
}
}
.vector-toc-list-item {
display: block;
position: relative;
list-style-type: none;
padding-left: 8px;
.vector-feature-page-tools-enabled & {
margin: 0;
}
&.vector-toc-level-1 {
padding-left: 0;
}
a {
font-size: @font-size-base;
}
}
}
// Collapse ToC sections by default, excluding no-js
.client-js .vector-toc {
.vector-toc-level-1 .vector-toc-list-item {
display: none;
}
.vector-toc-level-1.vector-toc-list-item-expanded .vector-toc-list-item {
display: block;
}
.vector-toc-toggle {
display: block;
}
.vector-toc-level-1.vector-toc-list-item-expanded .vector-toc-toggle {
transform: rotate( 0deg );
}
}
.client-js body.ltr .vector-toc .vector-toc-toggle {
transform: rotate( -90deg );
}
.client-js body.rtl .vector-toc .vector-toc-toggle {
transform: rotate( 90deg );
}
// Ensure there is only 1 table of contents landmark at anytime
.vector-toc-landmark {
display: none;
}
.client-js {
@media ( min-width: @min-width-desktop ) {
/**
* FIXME: Remove the following line containing '.vector-toc-unpinned' after line 157 has been in prod for a week.
*/
.vector-toc-unpinned.vector-sticky-header-visible .vector-sticky-header .vector-toc-landmark,
&.vector-feature-toc-pinned-disabled .vector-sticky-header-visible .vector-sticky-header .vector-toc-landmark,
/**
* FIXME: Remove the following line containing '.vector-toc-unpinned' after line 162 has been in prod for a week.
*/
.vector-toc-unpinned:not( .vector-sticky-header-visible ) .vector-page-titlebar .vector-toc-landmark,
&.vector-feature-toc-pinned-disabled body:not( .vector-sticky-header-visible ) .vector-page-titlebar .vector-toc-landmark,
/**
* FIXME: Remove the following line containing '.vector-toc-pinned' after line 167 has been in prod for a week.
*/
.vector-toc-pinned .mw-table-of-contents-container.vector-toc-landmark,
&.vector-feature-toc-pinned-enabled .mw-table-of-contents-container.vector-toc-landmark {
display: block;
}
}
@media ( max-width: @max-width-tablet ) {
// On lower resolutions the TOC will always be in the page titlebar regardless of the TOC pinned classes
.vector-page-titlebar .vector-toc-landmark {
display: block;
}
.mw-table-of-contents-container.vector-toc-landmark {
display: none;
}
}
}