2022-06-08 15:03:38 +00:00
|
|
|
@import '../../common/variables.less';
|
2022-09-29 22:54:55 +00:00
|
|
|
@import '../../common/mixins.less';
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-07-01 20:19:57 +00:00
|
|
|
@height-collapsed-toc-button: 36px;
|
|
|
|
@padding-top-content-px: unit( @padding-top-content * @font-size-browser, px );
|
|
|
|
@selector-collapsed-toc-open: ~'#vector-toc-collapsed-checkbox:checked';
|
2022-09-09 16:22:07 +00:00
|
|
|
// Use calc so that the same max width can apply even when the TOC is in different containers
|
|
|
|
@max-width-collapsed-toc: 0.85 * @max-width-content-container; // 51em
|
2022-06-10 17:58:21 +00:00
|
|
|
|
2022-06-08 15:03:38 +00:00
|
|
|
#vector-toc-collapsed-button {
|
|
|
|
display: none;
|
2022-07-08 16:13:32 +00:00
|
|
|
float: left;
|
|
|
|
margin-right: 4px;
|
2022-09-02 15:57:43 +00:00
|
|
|
// Reduce vertical padding to fit with page title
|
2022-09-29 22:54:55 +00:00
|
|
|
padding: 7px @icon-padding-md-next;
|
2022-07-08 16:13:32 +00:00
|
|
|
// Override background color for when the TOC is overlaps content
|
|
|
|
// as a sticky element when the page is scrolled down.
|
|
|
|
background-color: @background-color-base;
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-07-08 16:13:32 +00:00
|
|
|
&:hover,
|
|
|
|
&:active {
|
|
|
|
background-color: @colorGray15;
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
2022-09-29 22:54:55 +00:00
|
|
|
|
|
|
|
.vector-feature-visual-enhancement-next-disabled & {
|
2022-10-26 17:01:12 +00:00
|
|
|
.mixin-vector-flush-left-margin-left();
|
2022-09-29 22:54:55 +00:00
|
|
|
// Reduce vertical padding to fit with page title
|
|
|
|
padding-left: @icon-padding-md;
|
|
|
|
padding-right: @icon-padding-md;
|
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-07-08 16:13:32 +00:00
|
|
|
#vector-toc-collapsed-button,
|
|
|
|
.sidebar-toc {
|
|
|
|
z-index: @z-index-menu;
|
|
|
|
}
|
|
|
|
|
2022-08-15 16:34:28 +00:00
|
|
|
.ve-active {
|
|
|
|
#vector-toc-collapsed-button {
|
|
|
|
display: none !important; /* stylelint-disable-line declaration-no-important */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
// Styles for the "move to sidebar/hide" buttons, hidden by default.
|
2022-07-01 20:19:57 +00:00
|
|
|
.vector-toc-collapse-button,
|
|
|
|
.vector-toc-uncollapse-button {
|
|
|
|
display: none;
|
|
|
|
border: 0;
|
|
|
|
padding: 0;
|
|
|
|
background-color: transparent;
|
|
|
|
color: @color-primary;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: @color-primary--hover;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: '@{msg-brackets-start}';
|
|
|
|
color: @color-base--subtle;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: '@{msg-brackets-end}';
|
|
|
|
color: @color-base--subtle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
// Shared collapsed TOC styles, applies across all collapsed cases (header, floating, sticky header)
|
2022-09-09 16:22:07 +00:00
|
|
|
.mixin-toc-collapsed() {
|
2022-09-15 18:07:52 +00:00
|
|
|
// T316056 Remove TOC menu fixed width and apply min/max-width
|
2022-09-09 16:22:07 +00:00
|
|
|
// using min() so that the TOC menu doesn't fully cover the text even on small viewports
|
|
|
|
width: auto;
|
2022-09-15 18:07:52 +00:00
|
|
|
min-width: 200px;
|
2022-09-09 16:22:07 +00:00
|
|
|
max-width: ~'min( @{max-width-collapsed-toc}, 75vw )'; // 51em
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
// TOC styles when collapsed to header
|
|
|
|
.mixin-toc-collapsed-header() {
|
2022-06-08 15:03:38 +00:00
|
|
|
#vector-toc-collapsed-button {
|
2022-06-10 21:14:39 +00:00
|
|
|
display: block;
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
|
|
|
|
2022-08-24 18:53:37 +00:00
|
|
|
.vector-sticky-toc-container {
|
2022-09-09 16:56:44 +00:00
|
|
|
// Override TOC container's sticky positioning
|
2022-06-10 17:58:21 +00:00
|
|
|
position: relative;
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
.sidebar-toc {
|
2022-09-09 16:22:07 +00:00
|
|
|
.mixin-toc-collapsed();
|
2022-07-01 20:19:57 +00:00
|
|
|
display: none;
|
2022-06-08 15:03:38 +00:00
|
|
|
position: absolute;
|
2022-09-01 16:23:55 +00:00
|
|
|
top: @height-collapsed-toc-button; // TOC button height
|
2022-10-26 17:01:12 +00:00
|
|
|
left: -@icon-padding-md;
|
2022-09-09 16:22:07 +00:00
|
|
|
margin-top: @padding-top-content-px; // Account for padding-top from .mw-body
|
2022-07-01 20:19:57 +00:00
|
|
|
// FIXME: Collapsed TOC styles are not consistent with other vector dropdowns
|
2022-06-08 15:03:38 +00:00
|
|
|
border: @border-width-base @border-style-base @border-color-base;
|
|
|
|
}
|
|
|
|
|
2022-10-26 17:01:12 +00:00
|
|
|
.vector-feature-visual-enhancement-next-disabled {
|
|
|
|
.sidebar-toc {
|
|
|
|
margin-left: 0;
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
@{selector-collapsed-toc-open} ~ .mw-table-of-contents-container .sidebar-toc {
|
2022-07-08 17:51:28 +00:00
|
|
|
// Hide the TOC when the button is not checked
|
2022-07-01 20:19:57 +00:00
|
|
|
display: block;
|
2022-06-10 17:58:21 +00:00
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
// TOC styles when collapsed to floating button
|
2022-07-01 20:19:57 +00:00
|
|
|
.mixin-toc-collapsed-floating() {
|
|
|
|
#vector-toc-collapsed-button {
|
2022-09-09 16:22:07 +00:00
|
|
|
position: fixed;
|
2022-07-01 20:19:57 +00:00
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
margin: 0;
|
2022-07-26 20:57:51 +00:00
|
|
|
}
|
|
|
|
|
2022-07-01 20:19:57 +00:00
|
|
|
.sidebar-toc {
|
2022-09-09 16:22:07 +00:00
|
|
|
.mixin-toc-collapsed();
|
|
|
|
position: fixed;
|
2022-07-01 20:19:57 +00:00
|
|
|
left: 6px;
|
2022-07-26 20:57:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-08 16:13:32 +00:00
|
|
|
@media ( max-width: @max-width-tablet ) {
|
2022-09-09 16:56:44 +00:00
|
|
|
//
|
|
|
|
// Collapsed to header on narrow screens
|
|
|
|
//
|
|
|
|
.mixin-toc-collapsed-header();
|
2022-06-08 15:03:38 +00:00
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
//
|
|
|
|
// Collapsed to floating button on narrow screens when below page title
|
|
|
|
//
|
2022-07-01 20:19:57 +00:00
|
|
|
.vector-below-page-title {
|
|
|
|
.mixin-toc-collapsed-floating();
|
2022-06-08 15:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
|
|
|
|
@media ( min-width: @min-width-desktop ) {
|
|
|
|
@supports ( display: grid ) {
|
2022-07-26 20:57:51 +00:00
|
|
|
.client-js {
|
2022-09-09 16:56:44 +00:00
|
|
|
.vector-toc-collapsed:not( .vector-sticky-header-visible ) {
|
|
|
|
//
|
|
|
|
// Collapsed to header
|
|
|
|
//
|
|
|
|
.mixin-toc-collapsed-header();
|
2022-07-26 20:57:51 +00:00
|
|
|
|
|
|
|
.mw-table-of-contents-container {
|
|
|
|
grid-area: content;
|
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
//
|
|
|
|
// Collapsed to floating icon when below page title
|
|
|
|
//
|
|
|
|
.vector-below-page-title& {
|
2022-07-01 20:19:57 +00:00
|
|
|
.mixin-toc-collapsed-floating();
|
|
|
|
}
|
2022-10-26 17:01:12 +00:00
|
|
|
|
|
|
|
// Disable left and right margin
|
|
|
|
&.vector-feature-visual-enhancement-next-disabled {
|
|
|
|
.sidebar-toc {
|
|
|
|
margin-left: 0;
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
|
2022-09-09 16:56:44 +00:00
|
|
|
// Show the "move to sidebar/hide" buttons
|
|
|
|
.vector-toc-collapsed .vector-toc-uncollapse-button,
|
|
|
|
.vector-toc-not-collapsed .vector-toc-collapse-button {
|
|
|
|
display: inline-block;
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-26 17:01:12 +00:00
|
|
|
|
|
|
|
.vector-toc-collapsed.vector-feature-visual-enhancement-next-disabled:not( .vector-sticky-header-visible ) {
|
|
|
|
.sidebar-toc {
|
|
|
|
margin-left: 0;
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
2022-07-08 16:13:32 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-09 16:22:07 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Collapsed to sticky header
|
|
|
|
//
|
|
|
|
.vector-toc-collapsed .vector-sticky-header-toc-container .sidebar-toc {
|
2022-10-26 17:01:12 +00:00
|
|
|
margin-left: 0;
|
|
|
|
margin-right: 0;
|
2022-09-09 16:22:07 +00:00
|
|
|
.mixin-toc-collapsed();
|
|
|
|
// T316056 Use max-content because collapsed TOC is absolutely positioned, width is relative to the collapsed TOC button
|
|
|
|
// max-content doesn't account for padding even when we use box-sizing, so use content-box instead
|
|
|
|
// and manually account for horizontal padding in the max width
|
|
|
|
box-sizing: content-box;
|
|
|
|
width: max-content;
|
|
|
|
@sidebar-toc-left-padding-em: unit( @sidebar-toc-left-padding / @font-size-browser, em );
|
|
|
|
@sidebar-toc-right-padding-em: unit( @sidebar-toc-right-padding / @font-size-browser, em );
|
2022-09-29 22:54:55 +00:00
|
|
|
|
2022-09-09 16:22:07 +00:00
|
|
|
@max-width-sticky-header-collapsed-toc: @max-width-collapsed-toc - @sidebar-toc-left-padding-em - @sidebar-toc-right-padding-em;
|
2022-10-26 17:01:12 +00:00
|
|
|
@max-width-sticky-header-collapsed-toc-next: @max-width-collapsed-toc - @sidebar-toc-right-padding-em;
|
2022-09-09 16:22:07 +00:00
|
|
|
max-width: ~'min( @{max-width-sticky-header-collapsed-toc}, 75vw )'; // min( 48.5625em, 75vw )
|
2022-09-29 22:54:55 +00:00
|
|
|
|
|
|
|
.vector-feature-visual-enhancement-next-enabled & {
|
|
|
|
max-width: ~'min( @{max-width-sticky-header-collapsed-toc-next}, 75vw )';
|
|
|
|
}
|
2022-09-09 16:22:07 +00:00
|
|
|
}
|