mediawiki-skins-Citizen/skinStyles/extensions/MultimediaViewer/mmv.less
2024-02-26 17:14:19 -05:00

648 lines
14 KiB
Plaintext

/*
* Citizen
*
* SkinStyles for Extension:MultimediaViewer
* Module: mmv
* Version: REL1_39 (1b97775)
*
* Date: 2022-11-26
*/
@import '../../../resources/variables.less';
// FIXME: Use relative units
@mmv-width-toolbar: 52px;
@mmv-height-abovethefold: 86px;
@mmv-button-size: 40px;
/* mmv.ui.dialog.less */
.mw-mmv-dialog {
right: @mmv-width-toolbar;
margin: var( --space-xs );
background-color: var( --color-surface-1 );
border-radius: var( --border-radius--medium );
box-shadow: var( --box-shadow-dialog );
// The dialog will always show above the metadata in mobile view
@media ( max-width: @max-width-breakpoint-tablet ) {
top: unset !important;
right: 0 !important;
bottom: @mmv-height-abovethefold !important;
left: 0 !important;
width: auto;
}
// Make arrow slightly smaller
.mw-mmv-dialog-down-arrow {
right: @mmv-width-toolbar;
width: 16px;
height: 16px;
background-color: var( --color-surface-1 );
// Hide arrow since the dialog is no longer relative
@media ( max-width: @max-width-breakpoint-tablet ) {
display: none;
}
}
.mw-mmv-dialog-warning {
background-color: var( --color-warning );
}
}
/* mmv.ui.reuse.dialog.less */
.mw-mmv-reuse-dialog {
bottom: @mmv-height-abovethefold;
.mw-mmv-reuse-tabs {
border-bottom-color: var( --border-color-base );
border-radius: var( --border-radius--medium ) var( --border-radius--medium ) 0 0; // Sync with dialog
.oo-ui-optionWidget {
padding: var( --space-xs ) var( --space-sm );
font-size: 1rem;
font-weight: var( --font-weight-semibold );
&.oo-ui-optionWidget-highlighted {
border-bottom: 0; // border will cause reflow
box-shadow: inset 0 -2px 0 0 var( --color-primary--hover );
}
&.oo-ui-optionWidget-selected,
&.oo-ui-optionWidget-highlighted.oo-ui-optionWidget-selected {
border-bottom: 0; // border will cause reflow
box-shadow: inset 0 -2px 0 0 var( --color-primary );
}
&:first-child {
border-radius: var( --border-radius--medium ) 0 0 0;
}
}
}
.mw-mmv-reuse-pane {
padding: var( --space-md );
}
.mw-mmv-dialog-down-arrow {
bottom: @mmv-height-abovethefold + @mmv-button-size / 2;
}
.mw-mmv-dialog-warning {
padding: var( --space-md ) var( --space-xl );
}
}
/* mmv.ui.download.dialog.less */
.mw-mmv-download-dialog {
bottom: @mmv-height-abovethefold;
.mw-mmv-download-size .oo-ui-optionWidget {
padding: var( --space-sm ) var( --space-md );
font-size: 1rem;
}
.mw-mmv-dialog-down-arrow {
bottom: @mmv-height-abovethefold + @mmv-button-size + @mmv-button-size / 2;
background-color: var( --color-surface-1 );
}
.mw-mmv-dialog-warning {
padding: var( --space-md ) var( --space-xl );
}
}
/* mmv.ui.viewingOptions.less */
.mw-mmv-options-dialog {
top: 0;
padding: var( --space-md );
&.mw-mmv-enable-confirmation-shown {
background-color: var( --background-color-success );
box-shadow: var( --box-shadow-dialog );
// Hide arrow since those are notifications
.mw-mmv-dialog-down-arrow {
display: none;
}
}
&.mw-mmv-disable-confirmation-shown {
background-color: var( --color-surface-1 );
// Hide arrow since those are notifications
.mw-mmv-dialog-down-arrow {
display: none;
}
}
.mw-mmv-dialog-down-arrow {
top: @mmv-button-size + @mmv-button-size + @mmv-button-size / 2;
}
.mw-mmv-disable-confirmation {
.mw-mmv-options-dialog-header {
color: var( --color-base--emphasized );
}
.mw-mmv-options-text-header {
color: var( --color-base--subtle );
}
}
.mw-mmv-enable-confirmation {
.mw-mmv-options-dialog-header {
color: var( --color-base--emphasized );
}
.mw-mmv-options-text-header {
color: var( --color-base--subtle );
}
}
}
.mw-mmv-options-submit {
margin-top: var( --space-md );
}
// Just use flex layout
.mw-mmv-options-subcontainer {
display: flex;
gap: var( --space-sm );
margin-top: var( --space-md );
}
.mw-mmv-options-subcontainer .mw-mmv-options-text {
margin-left: 0;
}
.mw-mmv-options-dialog-header {
margin: 0 0 var( --space-xs ) 0;
font-size: 1rem;
font-weight: var( --font-weight-semibold );
color: var( --color-base--emphasized );
}
.mw-mmv-options-text-header {
font-size: 0.875rem;
color: var( --color-base );
}
.mw-mmv-options-text-body {
margin-top: var( --space-xs );
font-size: var( --font-size-x-small );
color: var( --color-base--subtle );
}
.mw-mmv-options-enable-alert {
position: unset;
padding: var( --space-sm ) var( --space-md );
margin: ~'calc( var(--space-md ) * -1)';
margin-bottom: var( --space-md );
font-weight: var( --font-weight-semibold );
background-color: var( --color-warning );
border-top-left-radius: var( --border-radius--medium );
border-top-right-radius: var( --border-radius--medium );
}
/* mmv.ui.canvas.less */
.mw-mmv-image img {
@media ( max-width: @max-width-breakpoint-tablet ) {
pointer-events: none;
// It is frustrating to misclick the image on mobile
// So that the image is not clickable on mobile
cursor: auto;
}
}
/* mmv.ui.canvasButtons.less */
// Align icon with the rest of the skin
.mw-mmv-download-button,
.mw-mmv-reuse-button,
.mw-mmv-options-button,
.mw-mmv-close,
.mw-mmv-fullscreen,
.mw-mmv-next-image,
.mw-mmv-prev-image {
padding: 0;
background-size: var( --size-icon );
border-radius: var( --border-radius--small );
opacity: var( --opacity-icon-base );
&.mw-mmv-dialog-open,
&:hover {
background-color: var( --background-color-quiet--hover );
opacity: var( --opacity-icon-base--hover );
}
&:active {
background-color: var( --background-color-quiet--active );
opacity: var( --opacity-icon-base--active );
}
}
.mw-mmv-download-button,
.mw-mmv-reuse-button,
.mw-mmv-options-button,
.mw-mmv-close,
.mw-mmv-fullscreen {
right: 8px !important;
width: @mmv-button-size !important;
height: @mmv-button-size !important;
margin-top: 0;
}
.mw-mmv-close {
top: 8px;
}
.mw-mmv-fullscreen {
top: 8px + @mmv-button-size;
}
.mw-mmv-options-button {
top: 8px + @mmv-button-size * 2;
}
.mw-mmv-reuse-button {
bottom: @mmv-height-abovethefold + 8px; // close to space-xs
}
.mw-mmv-download-button {
bottom: @mmv-button-size + @mmv-height-abovethefold + 8px;
}
.mw-mmv-prev-image {
left: 8px;
background-position: left 8px center;
&:hover {
// Changing margin is expensive and we don't want to move the hover background
margin-left: 0;
background-position: left 4px center;
}
}
.mw-mmv-next-image {
right: 8px;
background-position: right 8px center;
&:hover {
// Changing margin is expensive and we don't want to move the hover background
margin-right: 0;
background-position: right 4px center;
}
}
// Make it much bigger so it is easier to click
.mw-mmv-prev-image,
.mw-mmv-next-image {
top: 20vh !important;
z-index: 1002; // avoid covering other buttons
height: 50vh;
}
/* mmv.ui.permission.less */
.mw-mmv-permission-box {
width: auto; // We use grid to align metadata so no need to hardcode
margin: var( --space-md ) 0 0 0;
background-color: var( --color-surface-2 ) !important; // Somehow there is an inline style overriding it
&.empty {
display: none;
}
h3 {
margin: 0;
font-size: var( --font-size-x-small );
font-weight: var( --font-weight-normal );
color: var( --color-base--subtle );
letter-spacing: 0.05em;
}
// Make button bigger and aligned
.mw-mmv-permission-close {
top: var( --space-xs );
right: var( --space-xs );
width: 2rem;
height: 2rem;
padding: var( --space-xs );
background-color: transparent;
background-repeat: no-repeat;
background-position: center;
background-size: 14px;
border: 0;
border-radius: var( --border-radius--small );
// Add hover state
&:hover {
background-color: var( --background-color-quiet--hover );
}
&:active {
background-color: var( --background-color-quiet--active );
}
}
.mw-mmv-permission-text {
.mw-mmv-permission-text-fader {
top: 2.7em;
background-image: linear-gradient( to bottom, rgba( 255, 255, 255, 0 ) 0%, var( --color-surface-1 ) 100% );
a {
padding-top: 2px;
background-color: var( --color-surface-1 );
}
}
}
.mw-mmv-permission-text,
.mw-mmv-permission-html {
margin: var( --space-xxs ) 0 0 0;
font-size: var( --font-size-x-small );
line-height: var( --line-height-sm );
color: var( --color-base );
}
.mw-mmv-permission-html {
padding: 0;
}
&.full-size {
.mw-mmv-permission-html {
border-top: 0;
}
}
}
/* mmv.ui.progressBar.less */
// Sync with citizen progress bar
.mw-mmv-progress {
top: -2px;
height: 2px;
background-color: transparent;
}
.mw-mmv-progress-percent {
height: 2px;
background: linear-gradient( -45deg, transparent 33%, rgba( 0, 0, 0, 0.1 ) 33%, rgba( 0, 0, 0, 0.1 ) 66%, transparent 66% ), var( --color-primary );
filter: drop-shadow( 0 0 16px var( --color-primary ) );
border-top-right-radius: var( --border-radius--large );
border-bottom-right-radius: var( --border-radius--large );
}
/* mmv.ui.stripeButtons.less */
.mw-mmv-stripe-button {
font-size: 0.875rem;
// Icon only button for smaller screen size
@media ( max-width: @max-width-breakpoint-tablet ) {
text-indent: -9999px;
&::before {
margin-right: 0 !important;
}
}
&.mw-mmv-description-page-button,
&.mw-mmv-description-page-button:active,
&.mw-mmv-description-page-button:visited {
display: flex;
align-items: center;
justify-content: center;
float: none;
min-width: auto;
max-width: none;
padding: 0 var( --space-sm );
margin: var( --space-md );
font-size: 0.875rem;
white-space: nowrap;
}
}
/* mmv.ui.truncatableTextField.less */
// TODO: Revisit later
/* mmv.ui.metadataPanel.less */
.mw-mmv-info-box {
padding: var( --space-md );
background-color: var( --color-surface-2 );
border: 0;
border-radius: var( --border-radius--medium );
}
.mw-mmv-title-para {
flex-grow: 1;
order: -1; // Reorder because we use flex in container
// Changing height and line-height like the origina causes reflow
height: auto;
padding: 0;
margin: var( --space-xl ) var( --space-md ) var( --space-md ) var( --space-md );
overflow: hidden;
line-height: var( --line-height-sm );
// Enforce single line
white-space: nowrap;
// Reset when expanded
.mw-mmv-untruncated & {
white-space: normal;
}
&.mw-mmv-title-smaller {
padding: 0;
margin: var( --space-md );
}
// Enforce consistent sizing
&.mw-mmv-ttf-normal,
&.mw-mmv-title-small,
&.mw-mmv-title-smaller {
font-size: 1rem;
@media ( max-width: @max-width-breakpoint-tablet ) {
font-size: 0.875rem;
}
}
.mw-mmv-ttf-ellipsis {
// Never need to use it anyways
display: none !important;
}
}
.mw-mmv-credit {
height: auto !important;
padding: 0;
margin: 0;
font-size: 0.875rem;
color: var( --color-base--subtle );
@media ( max-width: @max-width-breakpoint-tablet ) {
font-size: var( --font-size-x-small );
}
.mw-mmv-ttf-ellipsis {
// Never need to use it anyways
display: none !important;
}
}
.mw-mmv-source-author {
line-height: var( --line-height-xs );
}
.mw-mmv-title {
.mw-mmv-untruncated & {
color: var( --color-base--emphasized );
}
}
.mw-mmv-image-metadata {
// Use grid instead
display: grid;
grid-template-areas:
'desc links'
'about about';
grid-template-columns: 2fr 1fr;
gap: var( --space-xs );
width: auto;
padding: 0 var( --space-md ) var( --space-md ) var( --space-md );
margin-top: -4px;
// Sync with title
background-color: #000;
border-top: 0;
.mw-mmv-untruncated & {
gap: var( --space-lg );
background-color: transparent;
@media ( max-width: @max-width-breakpoint-tablet ) {
grid-template-areas:
'desc desc'
'links links'
'about about';
}
}
// Reset hardcoded styles for grid
&-column {
float: none !important;
width: auto !important;
max-width: none !important;
}
&-desc-column {
grid-area: desc;
}
&-links-column {
grid-area: links;
}
}
.mw-mmv-image-desc {
padding: 0;
font-size: 0.875rem;
color: inherit;
}
.mw-mmv-image-links {
margin: 0;
li {
font-size: 0.875rem;
@media ( max-width: @max-width-breakpoint-tablet ) {
font-size: var( --font-size-x-small );
}
+ li {
margin-top: var( --space-xs );
}
// Reset hardcoded styles
.metadata-panel-is-closed &.mw-mmv-license-li {
height: auto;
line-height: var( --line-height-xs );
}
}
}
.mw-mmv-image-desc-div {
margin-bottom: 0;
}
.mw-mmv-about-links {
grid-area: about;
padding: 0;
font-size: 0.875rem;
}
.mw-mmv-label {
font-size: var( --font-size-x-small );
color: var( --color-base );
background-color: var( --color-surface-3 );
&:hover {
background-color: var( --color-surface-2--hover );
}
&:active {
background-color: var( --color-surface-2--active );
}
}
/* mmv.ui.metadataPanelScroller.less */
/* mmv.lightboxinterface.less */
.mw-mmv-image-wrapper {
bottom: @mmv-height-abovethefold;
}
// Only apply background color when scroll up
.mw-mmv-post-image {
min-height: @mmv-height-abovethefold;
color: #fff;
background-color: transparent;
border-top-left-radius: var( --border-radius--large );
border-top-right-radius: var( --border-radius--large );
&.mw-mmv-untruncated {
color: var( --color-base );
background-color: var( --color-surface-1 );
box-shadow: none; // We already have top border
}
// Add scroll up affordance
// On touch device, when user drag/swipe the indicator, it will cause the
// page to scroll up and show the card below.
@media ( hover: none ) {
&::before {
position: absolute;
top: var( --space-xs );
right: 0;
left: 0;
width: 40px;
height: 4px;
margin: 0 auto;
content: '';
background-color: ~'rgba( 255, 255, 255, var( --opacity-icon-base ) )';
border-radius: var( --border-radius--pill );
}
&.mw-mmv-untruncated {
// Since background color is dependent on theme now
&::before {
background-color: var( --border-color-base--darker );
}
}
}
}
.mw-mmv-above-fold {
display: flex; // let's use flex instead of float
gap: var( --space-xs );
height: auto; // avoid layout shift when scroll up
padding-bottom: 0; // let metadata handle the padding
}