diff options
Diffstat (limited to 'src/less')
-rw-r--r-- | src/less/base.less | 48 | ||||
-rw-r--r-- | src/less/bundle.less | 29 | ||||
-rw-r--r-- | src/less/components/badges.less | 11 | ||||
-rw-r--r-- | src/less/components/buttons.less | 89 | ||||
-rw-r--r-- | src/less/components/captions.less | 57 | ||||
-rw-r--r-- | src/less/components/controls.less | 127 | ||||
-rw-r--r-- | src/less/components/embed.less | 23 | ||||
-rw-r--r-- | src/less/components/menus.less | 155 | ||||
-rw-r--r-- | src/less/components/progress.less | 110 | ||||
-rw-r--r-- | src/less/components/sliders.less | 140 | ||||
-rw-r--r-- | src/less/components/times.less | 28 | ||||
-rw-r--r-- | src/less/components/tooltips.less | 87 | ||||
-rw-r--r-- | src/less/components/video.less | 12 | ||||
-rw-r--r-- | src/less/components/volume.less | 30 | ||||
-rw-r--r-- | src/less/lib/animation.less | 21 | ||||
-rw-r--r-- | src/less/lib/mixins.less (renamed from src/less/mixins.less) | 4 | ||||
-rw-r--r-- | src/less/plyr.less | 957 | ||||
-rw-r--r-- | src/less/settings.less (renamed from src/less/variables.less) | 0 | ||||
-rw-r--r-- | src/less/states/fullscreen.less | 31 | ||||
-rw-r--r-- | src/less/utils/hidden.less | 33 |
20 files changed, 1035 insertions, 957 deletions
diff --git a/src/less/base.less b/src/less/base.less new file mode 100644 index 00000000..e41874a0 --- /dev/null +++ b/src/less/base.less @@ -0,0 +1,48 @@ +// -------------------------------------------------------------- +// Base styling +// -------------------------------------------------------------- + +// Base +.plyr { + position: relative; + max-width: 100%; + min-width: 200px; + overflow: hidden; + font-family: @plyr-font-family; + font-weight: @plyr-font-weight-normal; + direction: ltr; + text-shadow: none; + + // Media elements + video, + audio { + width: 100%; + height: auto; + vertical-align: middle; + border-radius: inherit; + } +} + +// Full UI only +.plyr--full-ui { + & when(@plyr-border-box = true) { + // border-box everything + // http://paulirish.com/2012/box-sizing-border-box-ftw/ + &, + *, + *::after, + *::before { + box-sizing: border-box; + } + } + + & when(@plyr-touch-action = true) { + // Fix 300ms delay + a, + button, + input, + label { + touch-action: manipulation; + } + } +} diff --git a/src/less/bundle.less b/src/less/bundle.less new file mode 100644 index 00000000..bff7fdec --- /dev/null +++ b/src/less/bundle.less @@ -0,0 +1,29 @@ +// ========================================================================== +// Plyr styles +// https://github.com/sampotts/plyr +// TODO: Review use of BEM classnames +// ========================================================================== + +@import 'settings'; + +@import 'lib/animation'; +@import 'lib/mixins'; + +@import 'base'; + +@import 'components/badges'; +@import 'components/buttons'; +@import 'components/captions'; +@import 'components/controls'; +@import 'components/embed'; +@import 'components/menus'; +@import 'components/progress'; +@import 'components/sliders'; +@import 'components/times'; +@import 'components/tooltips'; +@import 'components/video'; +@import 'components/volume'; + +@import 'states/fullscreen'; + +@import 'utils/hidden'; diff --git a/src/less/components/badges.less b/src/less/components/badges.less new file mode 100644 index 00000000..37ed2af4 --- /dev/null +++ b/src/less/components/badges.less @@ -0,0 +1,11 @@ +// -------------------------------------------------------------- +// Badges +// -------------------------------------------------------------- + +.plyr__badge { + padding: 1px 4px; + border-radius: 2px; + background: @plyr-menu-color; + color: @plyr-menu-bg; + font-size: @plyr-font-size-tiny; +} diff --git a/src/less/components/buttons.less b/src/less/components/buttons.less new file mode 100644 index 00000000..3aa6da1a --- /dev/null +++ b/src/less/components/buttons.less @@ -0,0 +1,89 @@ +.plyr__control { + position: relative; + display: inline-block; + flex-shrink: 0; + overflow: visible; // IE11 + vertical-align: middle; + padding: @plyr-control-padding; + border: 0; + background: transparent; + border-radius: 3px; + cursor: pointer; + transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease; + color: inherit; + + svg { + width: @plyr-control-icon-size; + height: @plyr-control-icon-size; + display: block; + fill: currentColor; + pointer-events: none; + } + + // Hide toggle icons by default + .icon--exit-fullscreen, + .icon--muted, + .icon--captions-on { + display: none; + } + + // Default focus + &:focus { + outline: 0; + } +} + +// Audio styles +.plyr--audio .plyr__control { + &.tab-focus, + &:hover, + &[aria-expanded='true'] { + background: @plyr-audio-control-bg-hover; + color: @plyr-audio-control-color-hover; + } +} + +// Large play button (video only) +.plyr__play-large { + display: none; + position: absolute; + z-index: 1; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding: ceil(@plyr-control-spacing * 1.25); + background: fade(@plyr-video-control-bg-hover, 80%); + border: 3px solid currentColor; + border-radius: 100%; + box-shadow: 0 1px 1px fade(#000, 15%); + color: @plyr-video-control-color; + transition: all 0.3s ease; + + svg { + position: relative; + left: 2px; + width: 20px; + height: 20px; + display: block; + fill: currentColor; + pointer-events: none; + } + + &:hover, + &:focus { + background: @plyr-video-control-bg-hover; + } + + &:focus { + outline: 1px dotted fade(@plyr-video-control-color, 50%); + } +} + +.plyr--full-ui.plyr--video .plyr__play-large { + display: inline-block; +} + +.plyr--playing .plyr__play-large { + opacity: 0; + visibility: hidden; +} diff --git a/src/less/components/captions.less b/src/less/components/captions.less new file mode 100644 index 00000000..d2058a13 --- /dev/null +++ b/src/less/components/captions.less @@ -0,0 +1,57 @@ +// -------------------------------------------------------------- +// Captions +// -------------------------------------------------------------- + +// Hide default captions +.plyr--full-ui video::-webkit-media-text-track-container { + display: none; +} + +.plyr__captions { + display: none; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + padding: @plyr-control-spacing; + transform: translateY(-(@plyr-control-spacing * 4)); + transition: transform 0.3s ease; + color: @plyr-captions-color; + font-size: @plyr-font-size-captions-small; + text-align: center; + + span { + border-radius: 2px; + padding: 0.2em 0.5em; + background: @plyr-captions-bg; + box-decoration-break: clone; + line-height: 170%; + white-space: pre-wrap; + + // Firefox adds a <div> when using getCueAsHTML() + div { + display: inline; + } + } + + span:empty { + display: none; + } + + @media (min-width: @plyr-bp-screen-sm) { + padding: (@plyr-control-spacing * 2); + font-size: @plyr-font-size-captions-base; + } + + @media (min-width: @plyr-bp-screen-md) { + font-size: @plyr-font-size-captions-medium; + } +} + +.plyr--captions-active .plyr__captions { + display: block; +} + +.plyr--hide-controls .plyr__captions { + transform: translateY(-(@plyr-control-spacing * 1.5)); +} diff --git a/src/less/components/controls.less b/src/less/components/controls.less new file mode 100644 index 00000000..2750de32 --- /dev/null +++ b/src/less/components/controls.less @@ -0,0 +1,127 @@ +// -------------------------------------------------------------- +// Controls +// -------------------------------------------------------------- + +// Hide native controls +.plyr ::-webkit-media-controls { + display: none; +} + +// Playback controls +.plyr__controls { + display: flex; + align-items: center; + text-align: center; + + // Spacing + > .plyr__control, + .plyr__progress, + .plyr__time, + .plyr__menu { + margin-left: (@plyr-control-spacing / 2); + + &:first-child, + &:first-child + [data-plyr='pause'] { + margin-left: 0; + } + } + + .plyr__volume { + margin-left: (@plyr-control-spacing / 2); + } + + @media (min-width: @plyr-bp-screen-sm) { + > .plyr__control, + .plyr__progress, + .plyr__time, + .plyr__menu { + margin-left: @plyr-control-spacing; + } + + > .plyr__control + .plyr__control, + .plyr__menu + .plyr__control, + > .plyr__control + .plyr__menu { + margin-left: (@plyr-control-spacing / 2); + } + } +} + +// Video controls +.plyr--video .plyr__controls { + position: absolute; + left: 0; + right: 0; + bottom: 0; + z-index: 2; + padding: (@plyr-control-spacing * 3.5) (@plyr-control-spacing + 2) @plyr-control-spacing; + background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 70%)); + border-bottom-left-radius: inherit; + border-bottom-right-radius: inherit; + color: @plyr-video-control-color; + transition: all 0.4s ease-in-out; + + .plyr__control { + svg { + filter: drop-shadow(0 1px 1px fade(#000, 15%)); + } + + // Hover and tab focus + &.tab-focus, + &:hover, + &[aria-expanded='true'] { + background: @plyr-video-control-bg-hover; + color: @plyr-video-control-color-hover; + } + } +} + +// Hide controls +.plyr--video.plyr--hide-controls .plyr__controls { + opacity: 0; + transform: translateY(100%); + pointer-events: none; +} + +// Audio controls +.plyr--audio .plyr__controls { + padding: @plyr-control-spacing; + border-radius: inherit; + background: @plyr-audio-controls-bg; + border: @plyr-audio-controls-border; + color: @plyr-audio-control-color; +} + +// States +.plyr__controls [data-plyr='pause'] { + display: none; +} +.plyr--playing .plyr__controls [data-plyr='play'] { + display: none; +} +.plyr--playing .plyr__controls [data-plyr='pause'] { + display: inline-block; +} + +// Change icons on state change +.plyr--muted .plyr__control .icon--muted, +.plyr--captions-active .plyr__control .icon--captions-on { + display: block; + + & + svg { + display: none; + } +} + +// Some options are hidden by default +.plyr [data-plyr='captions'], + .plyr [data-plyr='pip'], + .plyr [data-plyr='airplay'], + .plyr [data-plyr='fullscreen'] { + display: none; +} +.plyr--captions-enabled [data-plyr='captions'], + .plyr--pip-supported [data-plyr='pip'], + .plyr--airplay-supported [data-plyr='airplay'], + .plyr--fullscreen-enabled [data-plyr='fullscreen'] { + display: inline-block; +} diff --git a/src/less/components/embed.less b/src/less/components/embed.less new file mode 100644 index 00000000..02b33425 --- /dev/null +++ b/src/less/components/embed.less @@ -0,0 +1,23 @@ +// -------------------------------------------------------------- +// Embedded players +// YouTube, Vimeo, etc +// -------------------------------------------------------------- + +.plyr__video-embed { + padding-bottom: 56.25%; /* 16:9 */ + height: 0; + + iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; + user-select: none; + } +} +// To allow mouse events to be captured if full support +.plyr--full-ui .plyr__video-embed iframe { + pointer-events: none; +} diff --git a/src/less/components/menus.less b/src/less/components/menus.less new file mode 100644 index 00000000..52b735de --- /dev/null +++ b/src/less/components/menus.less @@ -0,0 +1,155 @@ +// -------------------------------------------------------------- +// Menus +// -------------------------------------------------------------- + +.plyr__menu { + position: relative; + + // Animate the icon + .plyr__control svg { + transition: transform 0.3s ease; + } + .plyr__control[aria-expanded='true'] { + svg { + transform: rotate(45deg); + } + + // Hide tooltip + .plyr__tooltip { + display: none; + } + } + + // The actual menu container + &__container { + position: absolute; + z-index: 1; + bottom: 100%; + right: -3px; + margin-bottom: 10px; + animation: plyr-popup 0.2s ease; + background: @plyr-menu-bg; + border-radius: 4px; + box-shadow: 0 1px 2px fade(#000, 20%); + white-space: nowrap; + text-align: left; + color: @plyr-menu-color; + font-size: @plyr-font-size-small; + + > div { + overflow: hidden; + transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1); + } + + // Arrow + &::after { + content: ''; + position: absolute; + top: 100%; + right: 15px; + height: 0; + width: 0; + border: 4px solid transparent; + border-top-color: @plyr-menu-bg; + } + + ul { + margin: 0; + padding: @plyr-control-padding; + list-style: none; + overflow: hidden; + } + + // Options + .plyr__control { + display: flex; + align-items: center; + width: 100%; + padding: ceil(@plyr-control-padding / 2) (@plyr-control-padding * 2); + color: @plyr-menu-color; + font-weight: @plyr-font-weight-bold; + user-select: none; + + &::after { + content: ''; + position: absolute; + top: 50%; + transform: translateY(-50%); + border: 4px solid transparent; + transition: border-color 0.2s ease; + } + + &--forward { + padding-right: ceil(@plyr-control-padding * 4); + + &::after { + right: 5px; + border-left-color: fade(@plyr-menu-color, 80%); + } + + &.tab-focus::after, + &:hover::after { + border-left-color: currentColor; + } + } + + &--back { + position: relative; + @horizontal-padding: (@plyr-control-padding * 2); + + width: ~'calc(100% - @{horizontal-padding})'; + margin: @plyr-control-padding; + margin-bottom: floor(@plyr-control-padding / 2); + padding-left: ceil(@plyr-control-padding * 4); + font-weight: @plyr-font-weight-normal; + + &::after { + left: @plyr-control-padding; + border-right-color: fade(@plyr-menu-color, 80%); + } + + &::before { + content: ''; + position: absolute; + top: 100%; + left: 0; + right: 0; + height: 1px; + overflow: hidden; + margin-top: ceil(@plyr-control-padding / 2); + background: fade(#000, 15%); + box-shadow: 0 1px 0 fade(#fff, 10%); + } + + &.tab-focus::after, + &:hover::after { + border-right-color: currentColor; + } + } + } + + label.plyr__control { + padding-left: ceil(@plyr-control-padding * 2.5); + + input[type='radio'] { + position: relative; + left: -@plyr-control-padding; + } + } + + // Option value + .plyr__menu__value { + display: flex; + align-items: center; + margin-left: auto; + padding-left: ceil(@plyr-control-padding * 3.5); + pointer-events: none; + overflow: hidden; + font-weight: @plyr-font-weight-normal; + + .plyr__badge { + font-weight: @plyr-font-weight-bold; + } + } + } +} diff --git a/src/less/components/progress.less b/src/less/components/progress.less new file mode 100644 index 00000000..0022dfe0 --- /dev/null +++ b/src/less/components/progress.less @@ -0,0 +1,110 @@ +// -------------------------------------------------------------- +// Playback progress +// -------------------------------------------------------------- + +.plyr__progress { + position: relative; + display: none; + flex: 1; + + input[type='range'] { + position: relative; + z-index: 2; + } + + // Seek tooltip to show time + .plyr__tooltip { + left: 0; + } +} + +.plyr .plyr__progress { + display: inline-block; +} + +.plyr__progress--buffer { + position: absolute; + left: 0; + top: 50%; + width: 100%; + height: @plyr-range-track-height; + margin: -(@plyr-range-track-height / 2) 0 0; + padding: 0; + background: transparent; + border: none; + border-radius: 100px; + + // WebKit + -webkit-appearance: none; + + &::-webkit-progress-bar { + background: transparent; + } + + &::-webkit-progress-value { + background: currentColor; + border-radius: 100px; + min-width: @plyr-range-track-height; + } + + // Mozilla + &::-moz-progress-bar { + background: currentColor; + border-radius: 100px; + min-width: @plyr-range-track-height; + } + + // Microsoft + &::-ms-fill { + border-radius: 100px; + } +} + +.plyr__progress--buffer { + &::-webkit-progress-value { + transition: width 0.2s ease; + } + + &::-moz-progress-bar { + transition: width 0.2s ease; + } + + &::-ms-fill { + transition: width 0.2s ease; + } +} + +.plyr--video .plyr__progress--buffer { + box-shadow: 0 1px 1px fade(#000, 15%); + color: @plyr-video-progress-buffered-bg; +} + +.plyr--audio .plyr__progress--buffer { + color: @plyr-audio-progress-buffered-bg; +} + +// Loading state +.plyr--loading .plyr__progress--buffer { + animation: plyr-progress 1s linear infinite; + background-size: @plyr-progress-loading-size @plyr-progress-loading-size; + background-repeat: repeat-x; + background-image: linear-gradient( + -45deg, + @plyr-progress-loading-bg 25%, + transparent 25%, + transparent 50%, + @plyr-progress-loading-bg 50%, + @plyr-progress-loading-bg 75%, + transparent 75%, + transparent + ); + color: transparent; +} + +.plyr--video.plyr--loading .plyr__progress--buffer { + background-color: @plyr-video-progress-buffered-bg; +} + +.plyr--audio.plyr--loading .plyr__progress--buffer { + background-color: @plyr-audio-progress-buffered-bg; +} diff --git a/src/less/components/sliders.less b/src/less/components/sliders.less new file mode 100644 index 00000000..e2a5ffcf --- /dev/null +++ b/src/less/components/sliders.less @@ -0,0 +1,140 @@ +// -------------------------------------------------------------- +// Slider inputs - <input type="range"> +// -------------------------------------------------------------- + +// Specificity is for bootstrap compatibility +.plyr--full-ui input[type='range'] { + display: block; + height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale); + width: 100%; + margin: 0; + padding: 0; + cursor: pointer; + border: none; + background: transparent; + + // Used in JS to populate lower fill for WebKit + color: @plyr-range-selected-bg; + + // WebKit + -webkit-appearance: none; + + &::-webkit-slider-runnable-track { + .plyr-range-track(); + } + + &::-webkit-slider-thumb { + -webkit-appearance: none; + margin-top: -((@plyr-range-thumb-height - @plyr-range-track-height) / 2); + .plyr-range-thumb(); + } + + // Mozilla + &::-moz-range-track { + .plyr-range-track(); + } + + &::-moz-range-thumb { + .plyr-range-thumb(); + } + + &::-moz-range-progress { + height: @plyr-range-track-height; + background: currentColor; + border-radius: (@plyr-range-track-height / 2); + } + + // Microsoft + &::-ms-track { + height: @plyr-range-track-height; + background: transparent; + border: 0; + color: transparent; + } + + &::-ms-fill-upper { + .plyr-range-track(); + } + + &::-ms-fill-lower { + .plyr-range-track(); + + background: currentColor; + } + + &::-ms-thumb { + .plyr-range-thumb(); + // For some reason, Edge uses the -webkit margin above + margin-top: 0; + } + + &::-ms-tooltip { + display: none; + } + + // Focus styles + &:focus { + outline: 0; + } + + &::-moz-focus-outer { + border: 0; + } + + &.tab-focus { + outline-offset: 3px; + } + + // Pressed styles + &:active { + &::-webkit-slider-thumb { + .plyr-range-thumb-active(); + } + + &::-moz-range-thumb { + .plyr-range-thumb-active(); + } + + &::-ms-thumb { + .plyr-range-thumb-active(); + } + } +} + +// Video range inputs +.plyr--full-ui.plyr--video input[type='range'] { + &::-webkit-slider-runnable-track { + background: @plyr-video-range-track-bg; + } + + &::-moz-range-track { + background: @plyr-video-range-track-bg; + } + + &::-ms-track { + background: @plyr-video-range-track-bg; + } + + &.tab-focus { + outline: 1px dotted fade(@plyr-video-control-color, 50%); + } +} + +// Audio range inputs +.plyr--full-ui.plyr--audio input[type='range'] { + &::-webkit-slider-runnable-track { + background: @plyr-audio-range-track-bg; + } + + &::-moz-range-track { + background: @plyr-audio-range-track-bg; + } + + &::-ms-track { + background: @plyr-audio-range-track-bg; + } + + &.tab-focus { + outline: 1px dotted fade(@plyr-audio-control-color, 50%); + } +} diff --git a/src/less/components/times.less b/src/less/components/times.less new file mode 100644 index 00000000..ea4466d1 --- /dev/null +++ b/src/less/components/times.less @@ -0,0 +1,28 @@ +// -------------------------------------------------------------- +// Time +// -------------------------------------------------------------- + +.plyr__time { + display: inline-block; + vertical-align: middle; + font-size: @plyr-font-size-small; +} + +// Media duration hidden on small screens +.plyr__time + .plyr__time { + display: none; + + @media (min-width: @plyr-bp-screen-md) { + display: inline-block; + } + + // Add a slash in before + &::before { + content: '\2044'; + margin-right: @plyr-control-spacing; + } +} + +.plyr--video .plyr__time { + text-shadow: 0 1px 1px fade(#000, 15%); +} diff --git a/src/less/components/tooltips.less b/src/less/components/tooltips.less new file mode 100644 index 00000000..0f7c0071 --- /dev/null +++ b/src/less/components/tooltips.less @@ -0,0 +1,87 @@ +// -------------------------------------------------------------- +// Tooltips +// -------------------------------------------------------------- + +.plyr__tooltip { + position: absolute; + z-index: 2; + bottom: 100%; + margin-bottom: (@plyr-tooltip-padding * 2); + padding: @plyr-tooltip-padding (@plyr-tooltip-padding * 1.5); + pointer-events: none; + opacity: 0; + background: @plyr-tooltip-bg; + border-radius: @plyr-tooltip-radius; + box-shadow: 0 1px 2px fade(#000, 10%); + color: @plyr-tooltip-color; + font-size: @plyr-font-size-small; + font-weight: @plyr-font-weight-normal; + line-height: 1.3; + transform: translate(-50%, 10px) scale(0.8); + transform-origin: 50% 100%; + transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease; + + &::before { + // Arrows + content: ''; + position: absolute; + width: 0; + height: 0; + left: 50%; + transform: translateX(-50%); + + // The background triangle + bottom: -@plyr-tooltip-arrow-size; + border-right: @plyr-tooltip-arrow-size solid transparent; + border-top: @plyr-tooltip-arrow-size solid @plyr-tooltip-bg; + border-left: @plyr-tooltip-arrow-size solid transparent; + z-index: 2; + } +} + +// Displaying +.plyr .plyr__control:hover .plyr__tooltip, +.plyr .plyr__control.tab-focus .plyr__tooltip, +.plyr__tooltip--visible { + opacity: 1; + transform: translate(-50%, 0) scale(1); +} + +.plyr .plyr__control:hover .plyr__tooltip { + z-index: 3; +} + +// First tooltip +.plyr__controls > .plyr__control:first-child .plyr__tooltip, +.plyr__controls > .plyr__control:first-child + .plyr__control .plyr__tooltip { + left: 0; + transform: translate(0, 10px) scale(0.8); + transform-origin: 0 100%; + + &::before { + left: (@plyr-control-icon-size / 2) + @plyr-control-padding; + } +} + +// Last tooltip +.plyr__controls > .plyr__control:last-child .plyr__tooltip { + right: 0; + transform: translate(0, 10px) scale(0.8); + transform-origin: 100% 100%; + + &::before { + left: auto; + right: (@plyr-control-icon-size / 2) + @plyr-control-padding; + transform: translateX(50%); + } +} + +.plyr__controls > .plyr__control:first-child, +.plyr__controls > .plyr__control:first-child + .plyr__control, +.plyr__controls > .plyr__control:last-child { + &:hover .plyr__tooltip, + &.tab-focus .plyr__tooltip, + .plyr__tooltip--visible { + transform: translate(0, 0) scale(1); + } +} diff --git a/src/less/components/video.less b/src/less/components/video.less new file mode 100644 index 00000000..b68bac96 --- /dev/null +++ b/src/less/components/video.less @@ -0,0 +1,12 @@ +// -------------------------------------------------------------- +// Video styles +// -------------------------------------------------------------- + +.plyr__video-wrapper { + position: relative; + background: #000; + border-radius: inherit; + // Require z-index to force border-radius + z-index: 0; + overflow: hidden; +} diff --git a/src/less/components/volume.less b/src/less/components/volume.less new file mode 100644 index 00000000..f62a572f --- /dev/null +++ b/src/less/components/volume.less @@ -0,0 +1,30 @@ +// -------------------------------------------------------------- +// Volume +// -------------------------------------------------------------- + +.plyr__volume { + flex: 1; + position: relative; + + input[type='range'] { + position: relative; + z-index: 2; + } + + @media (min-width: @plyr-bp-screen-sm) { + display: block; + max-width: 60px; + } + + @media (min-width: @plyr-bp-screen-md) { + max-width: 100px; + } +} + +// Hide sound controls on iOS +// It's not supported to change volume using JavaScript: +// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html +.plyr--is-ios .plyr__volume, + .plyr--is-ios [data-plyr='mute'] { + display: none !important; +} diff --git a/src/less/lib/animation.less b/src/less/lib/animation.less new file mode 100644 index 00000000..4165a7f7 --- /dev/null +++ b/src/less/lib/animation.less @@ -0,0 +1,21 @@ +// -------------------------------------------------------------- +// Animations +// -------------------------------------------------------------- + +@keyframes plyr-progress { + to { + background-position: @plyr-progress-loading-size 0; + } +} + +@keyframes plyr-popup { + from { + transform: translateY(10px); + opacity: 0.5; + } + + to { + transform: translateY(0); + opacity: 1; + } +} diff --git a/src/less/mixins.less b/src/less/lib/mixins.less index 14e7d742..333f6afe 100644 --- a/src/less/mixins.less +++ b/src/less/lib/mixins.less @@ -11,6 +11,7 @@ border-radius: (@plyr-range-track-height / 2); user-select: none; } + .plyr-range-thumb() { position: relative; height: @plyr-range-thumb-height; @@ -22,6 +23,7 @@ box-shadow: @plyr-range-thumb-shadow; box-sizing: border-box; } + .plyr-range-thumb-active() { background: @plyr-range-thumb-active-bg; border-color: @plyr-range-thumb-active-border-color; @@ -38,10 +40,12 @@ video { height: 100%; } + .plyr__video-wrapper { height: 100%; width: 100%; } + .plyr__video-embed { // Revert overflow change overflow: visible; diff --git a/src/less/plyr.less b/src/less/plyr.less deleted file mode 100644 index a31e7280..00000000 --- a/src/less/plyr.less +++ /dev/null @@ -1,957 +0,0 @@ -// ========================================================================== -// Plyr styles -// https://github.com/sampotts/plyr -// TODO: break into smaller files and look at use of BEM classnames -// ========================================================================== - -@import 'variables'; -@import 'mixins'; - -// Animation -// --------------------------------------- -@keyframes plyr-progress { - to { - background-position: @plyr-progress-loading-size 0; - } -} -@keyframes plyr-popup { - from { - transform: translateY(10px); - opacity: 0.5; - } - to { - transform: translateY(0); - opacity: 1; - } -} - -// Styles -// ------------------------------- -// Base -.plyr { - position: relative; - max-width: 100%; - min-width: 200px; - overflow: hidden; - font-family: @plyr-font-family; - font-weight: @plyr-font-weight-normal; - direction: ltr; - text-shadow: none; - - & when(@plyr-border-box = true) { - // border-box everything - // http://paulirish.com/2012/box-sizing-border-box-ftw/ - &, - *, - *::after, - *::before { - box-sizing: border-box; - } - } - - & when(@plyr-touch-action = true) { - // Fix 300ms delay - a, - button, - input, - label { - touch-action: manipulation; - } - } - - // ARIA - [aria-hidden='true'] { - display: none; - } - - // Focus - &:focus { - outline: 0; - } - - // Media elements - video, - audio { - width: 100%; - height: auto; - vertical-align: middle; - border-radius: inherit; - } - - // Range inputs - // Specificity is for bootstrap compatibility - input[type='range'] { - display: block; - height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale); - width: 100%; - margin: 0; - padding: 0; - cursor: pointer; - border: none; - background: transparent; - - // Used in JS to populate lower fill for WebKit - color: @plyr-range-selected-bg; - - // WebKit - -webkit-appearance: none; - - &::-webkit-slider-runnable-track { - .plyr-range-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - margin-top: -((@plyr-range-thumb-height - @plyr-range-track-height) / 2); - .plyr-range-thumb(); - } - - // Mozilla - &::-moz-range-track { - .plyr-range-track(); - } - &::-moz-range-thumb { - .plyr-range-thumb(); - } - &::-moz-range-progress { - height: @plyr-range-track-height; - background: currentColor; - border-radius: (@plyr-range-track-height / 2); - } - - // Microsoft - &::-ms-track { - height: @plyr-range-track-height; - background: transparent; - border: 0; - color: transparent; - } - &::-ms-fill-upper { - .plyr-range-track(); - } - &::-ms-fill-lower { - .plyr-range-track(); - background: currentColor; - } - &::-ms-thumb { - .plyr-range-thumb(); - // For some reason, Edge uses the -webkit margin above - margin-top: 0; - } - &::-ms-tooltip { - display: none; - } - - // Focus styles - &:focus { - outline: 0; - } - &::-moz-focus-outer { - border: 0; - } - &.tab-focus { - outline-offset: 3px; - } - - // Pressed styles - &:active { - &::-webkit-slider-thumb { - .plyr-range-thumb-active(); - } - &::-moz-range-thumb { - .plyr-range-thumb-active(); - } - &::-ms-thumb { - .plyr-range-thumb-active(); - } - } - } -} - -// Video range inputs -.plyr--video input[type='range'] { - &::-webkit-slider-runnable-track { - background: @plyr-video-range-track-bg; - } - &::-moz-range-track { - background: @plyr-video-range-track-bg; - } - &::-ms-track { - background: @plyr-video-range-track-bg; - } - - &.tab-focus { - outline: 1px dotted fade(@plyr-video-control-color, 50%); - } -} - -// Audio range inputs -.plyr--audio input[type='range'] { - &::-webkit-slider-runnable-track { - background: @plyr-audio-range-track-bg; - } - &::-moz-range-track { - background: @plyr-audio-range-track-bg; - } - &::-ms-track { - background: @plyr-audio-range-track-bg; - } - - &.tab-focus { - outline: 1px dotted fade(@plyr-audio-control-color, 50%); - } -} - -// Screen reader only elements -.plyr__sr-only { - clip: rect(1px, 1px, 1px, 1px); - overflow: hidden; - - // !important is not always needed - & when(@plyr-sr-only-important = true) { - position: absolute !important; - padding: 0 !important; - border: 0 !important; - height: 1px !important; - width: 1px !important; - } - & when(@plyr-sr-only-important = false) { - position: absolute; - padding: 0; - border: 0; - height: 1px; - width: 1px; - } -} - -// Video -.plyr__video-wrapper { - position: relative; - background: #000; - border-radius: inherit; - // Require z-index to force border-radius - z-index: 0; - overflow: hidden; -} - -// Container for embeds -.plyr__video-embed { - padding-bottom: 56.25%; /* 16:9 */ - height: 0; - - iframe { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; - user-select: none; - } - - // Vimeo hack - > div { - position: relative; - padding-bottom: 200%; - transform: translateY(-35.95%); - } -} -// To allow mouse events to be captured if full support -.plyr .plyr__video-embed iframe { - pointer-events: none; -} - -// Captions -// -------------------------------------------------------------- -// Hide default captions -.plyr video::-webkit-media-text-track-container { - display: none; -} -.plyr__captions { - display: none; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - padding: @plyr-control-spacing; - transform: translateY(-(@plyr-control-spacing * 4)); - transition: transform 0.3s ease; - color: @plyr-captions-color; - font-size: @plyr-font-size-captions-small; - text-align: center; - - span { - border-radius: 2px; - padding: 0.2em 0.5em; - background: @plyr-captions-bg; - box-decoration-break: clone; - line-height: 170%; - white-space: pre-wrap; - - // Firefox adds a <div> when using getCueAsHTML() - div { - display: inline; - } - } - span:empty { - display: none; - } - - @media (min-width: @plyr-bp-screen-sm) { - padding: (@plyr-control-spacing * 2); - font-size: @plyr-font-size-captions-base; - } - @media (min-width: @plyr-bp-screen-md) { - font-size: @plyr-font-size-captions-medium; - } -} -.plyr--captions-active .plyr__captions { - display: block; -} -.plyr--hide-controls .plyr__captions { - transform: translateY(-(@plyr-control-spacing * 1.5)); -} - -// Controls -// -------------------------------------------------------------- -// Hide native controls -.plyr ::-webkit-media-controls { - display: none; -} - -// Playback controls -.plyr__controls { - display: flex; - align-items: center; - text-align: center; - - // Spacing - > .plyr__control, - .plyr__progress, - .plyr__time, - .plyr__menu { - margin-left: (@plyr-control-spacing / 2); - - &:first-child, - &:first-child + [data-plyr='pause'] { - margin-left: 0; - } - } - .plyr__volume { - margin-left: (@plyr-control-spacing / 2); - } - - @media (min-width: @plyr-bp-screen-sm) { - > .plyr__control, - .plyr__progress, - .plyr__time, - .plyr__menu { - margin-left: @plyr-control-spacing; - } - - > .plyr__control + .plyr__control, - .plyr__menu + .plyr__control, - > .plyr__control + .plyr__menu { - margin-left: (@plyr-control-spacing / 2); - } - } -} - -// Buttons -.plyr__control { - position: relative; - display: inline-block; - flex-shrink: 0; - overflow: visible; // IE11 - vertical-align: middle; - padding: @plyr-control-padding; - border: 0; - background: transparent; - border-radius: 3px; - cursor: pointer; - transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease; - color: inherit; - - svg { - width: @plyr-control-icon-size; - height: @plyr-control-icon-size; - display: block; - fill: currentColor; - pointer-events: none; - } - - // Hide toggle icons by default - .icon--exit-fullscreen, - .icon--muted, - .icon--captions-on { - display: none; - } - - // Default focus - &:focus { - outline: 0; - } -} - -// Video controls -.plyr--video .plyr__controls { - position: absolute; - left: 0; - right: 0; - bottom: 0; - z-index: 2; - padding: (@plyr-control-spacing * 3.5) (@plyr-control-spacing + 2) @plyr-control-spacing; - background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 70%)); - border-bottom-left-radius: inherit; - border-bottom-right-radius: inherit; - color: @plyr-video-control-color; - transition: all 0.4s ease-in-out; - - .plyr__control { - svg { - filter: drop-shadow(0 1px 1px fade(#000, 15%)); - } - - // Hover and tab focus - &.tab-focus, - &:hover, - &[aria-expanded='true'] { - background: @plyr-video-control-bg-hover; - color: @plyr-video-control-color-hover; - } - } -} -// Hide controls -.plyr--video.plyr--hide-controls .plyr__controls { - opacity: 0; - transform: translateY(100%); - pointer-events: none; -} - -// Audio controls -.plyr--audio .plyr__controls { - padding: @plyr-control-spacing; - border-radius: inherit; - background: @plyr-audio-controls-bg; - border: @plyr-audio-controls-border; - color: @plyr-audio-control-color; - - .plyr__control { - // Hover and tab focus - &.tab-focus, - &:hover, - &[aria-expanded='true'] { - background: @plyr-audio-control-bg-hover; - color: @plyr-audio-control-color-hover; - } - } -} - -// Large play button (video only) -.plyr__play-large { - display: none; - position: absolute; - z-index: 1; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - padding: ceil(@plyr-control-spacing * 1.25); - background: fade(@plyr-video-control-bg-hover, 80%); - border: 3px solid currentColor; - border-radius: 100%; - box-shadow: 0 1px 1px fade(#000, 15%); - color: @plyr-video-control-color; - transition: all 0.3s ease; - - svg { - position: relative; - left: 2px; - width: 20px; - height: 20px; - display: block; - fill: currentColor; - pointer-events: none; - } - - &:hover, - &:focus { - background: @plyr-video-control-bg-hover; - } - - &:focus { - outline: 1px dotted fade(@plyr-video-control-color, 50%); - } -} -.plyr .plyr__play-large { - display: inline-block; -} -.plyr--audio .plyr__play-large { - display: none; -} -.plyr--playing .plyr__play-large { - opacity: 0; - visibility: hidden; -} - -// States -.plyr__controls [data-plyr='pause'], -.plyr--playing .plyr__controls [data-plyr='play'] { - display: none; -} -.plyr--playing .plyr__controls [data-plyr='pause'] { - display: inline-block; -} - -// Change icons on state change -.plyr--muted .plyr__control .icon--muted, -.plyr--captions-active .plyr__control .icon--captions-on { - display: block; - - & + svg { - display: none; - } -} - -// Some options are hidden by default -.plyr [data-plyr='captions'], -.plyr [data-plyr='pip'], -.plyr [data-plyr='airplay'], -.plyr [data-plyr='fullscreen'] { - display: none; -} -.plyr--captions-enabled [data-plyr='captions'], -.plyr--pip-supported [data-plyr='pip'], -.plyr--airplay-supported [data-plyr='airplay'], -.plyr--fullscreen-enabled [data-plyr='fullscreen'] { - display: inline-block; -} - -// Menus -// -------------------------------------------------------------- -.plyr__menu { - position: relative; - - // Hide tooltip - .plyr__control svg { - transition: transform 0.3s ease; - } - .plyr__control[aria-expanded='true'] { - svg { - transform: rotate(45deg); - } - .plyr__tooltip { - display: none; - } - } - - // The actual menu container - &__container { - position: absolute; - z-index: 1; - bottom: 100%; - right: -3px; - margin-bottom: 10px; - animation: plyr-popup 0.2s ease; - - background: @plyr-menu-bg; - border-radius: 4px; - box-shadow: 0 1px 2px fade(#000, 20%); - - white-space: nowrap; - text-align: left; - color: @plyr-menu-color; - font-size: @plyr-font-size-small; - - > div { - overflow: hidden; - transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1); - } - - // Arrow - &::after { - content: ''; - position: absolute; - top: 100%; - right: 15px; - height: 0; - width: 0; - border: 4px solid transparent; - border-top-color: @plyr-menu-bg; - } - - ul { - margin: 0; - padding: @plyr-control-padding; - list-style: none; - overflow: hidden; - } - - // Options - .plyr__control { - display: flex; - align-items: center; - width: 100%; - padding: ceil(@plyr-control-padding / 2) (@plyr-control-padding * 2); - color: @plyr-menu-color; - font-weight: @plyr-font-weight-bold; - user-select: none; - - &::after { - content: ''; - position: absolute; - top: 50%; - transform: translateY(-50%); - border: 4px solid transparent; - transition: border-color 0.2s ease; - } - - &--forward { - padding-right: ceil(@plyr-control-padding * 4); - - &::after { - right: 5px; - border-left-color: fade(@plyr-menu-color, 80%); - } - - &.tab-focus::after, - &:hover::after { - border-left-color: currentColor; - } - } - - &--back { - position: relative; - @horizontal-padding: (@plyr-control-padding * 2); - width: ~'calc(100% - @{horizontal-padding})'; - margin: @plyr-control-padding; - margin-bottom: floor(@plyr-control-padding / 2); - padding-left: ceil(@plyr-control-padding * 4); - font-weight: @plyr-font-weight-normal; - - &::after { - left: @plyr-control-padding; - border-right-color: fade(@plyr-menu-color, 80%); - } - &::before { - content: ''; - position: absolute; - top: 100%; - left: 0; - right: 0; - height: 1px; - overflow: hidden; - margin-top: ceil(@plyr-control-padding / 2); - background: fade(#000, 15%); - box-shadow: 0 1px 0 fade(#fff, 10%); - } - - &.tab-focus::after, - &:hover::after { - border-right-color: currentColor; - } - } - } - - label.plyr__control { - padding-left: ceil(@plyr-control-padding * 2.5); - - input[type='radio'] { - position: relative; - left: -@plyr-control-padding; - } - } - - // Option value - .plyr__menu__value { - display: flex; - align-items: center; - margin-left: auto; - padding-left: ceil(@plyr-control-padding * 3.5); - pointer-events: none; - overflow: hidden; - font-weight: @plyr-font-weight-normal; - - .plyr__badge { - font-weight: @plyr-font-weight-bold; - } - } - } -} - -// Badge -// -------------------------------------------------------------- -.plyr__badge { - padding: 1px 4px; - border-radius: 2px; - background: @plyr-menu-color; - color: @plyr-menu-bg; - font-size: 10px; -} - -// Tooltips -// -------------------------------------------------------------- -.plyr__tooltip { - position: absolute; - z-index: 2; - bottom: 100%; - margin-bottom: (@plyr-tooltip-padding * 2); - padding: @plyr-tooltip-padding (@plyr-tooltip-padding * 1.5); - pointer-events: none; - - opacity: 0; - background: @plyr-tooltip-bg; - border-radius: @plyr-tooltip-radius; - box-shadow: 0 1px 2px fade(#000, 10%); - - color: @plyr-tooltip-color; - font-size: @plyr-font-size-small; - font-weight: @plyr-font-weight-normal; - line-height: 1.3; - - transform: translate(-50%, 10px) scale(0.8); - transform-origin: 50% 100%; - transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease; - - &::before { - // Arrows - content: ''; - position: absolute; - width: 0; - height: 0; - left: 50%; - transform: translateX(-50%); - - // The background triangle - bottom: -@plyr-tooltip-arrow-size; - border-right: @plyr-tooltip-arrow-size solid transparent; - border-top: @plyr-tooltip-arrow-size solid @plyr-tooltip-bg; - border-left: @plyr-tooltip-arrow-size solid transparent; - z-index: 2; - } -} -.plyr .plyr__control:hover .plyr__tooltip, -.plyr .plyr__control.tab-focus .plyr__tooltip, -.plyr__tooltip--visible { - opacity: 1; - transform: translate(-50%, 0) scale(1); -} -.plyr .plyr__control:hover .plyr__tooltip { - z-index: 3; -} - -// First tooltip -.plyr__controls > .plyr__control:first-child .plyr__tooltip, -.plyr__controls > .plyr__control:first-child + .plyr__control .plyr__tooltip { - left: 0; - transform: translate(0, 10px) scale(0.8); - transform-origin: 0 100%; - - &::before { - left: (@plyr-control-icon-size / 2) + @plyr-control-padding; - } -} - -// Last tooltip -.plyr__controls > .plyr__control:last-child .plyr__tooltip { - right: 0; - transform: translate(0, 10px) scale(0.8); - transform-origin: 100% 100%; - - &::before { - left: auto; - right: (@plyr-control-icon-size / 2) + @plyr-control-padding; - transform: translateX(50%); - } -} - -.plyr__controls > .plyr__control:first-child, -.plyr__controls > .plyr__control:first-child + .plyr__control, -.plyr__controls > .plyr__control:last-child { - &:hover .plyr__tooltip, - &.tab-focus .plyr__tooltip, - .plyr__tooltip--visible { - transform: translate(0, 0) scale(1); - } -} - -// Playback progress -// -------------------------------------------------------------- -// <progress> element -.plyr__progress { - position: relative; - display: none; - flex: 1; - - input[type='range'] { - position: relative; - z-index: 2; - } - - // Seek tooltip to show time - .plyr__tooltip { - left: 0; - } -} -.plyr .plyr__progress { - display: inline-block; -} - -.plyr__progress--buffer { - position: absolute; - left: 0; - top: 50%; - width: 100%; - height: @plyr-range-track-height; - margin: -(@plyr-range-track-height / 2) 0 0; - padding: 0; - background: transparent; - border: none; - border-radius: 100px; - - // WebKit - -webkit-appearance: none; - - &::-webkit-progress-bar { - background: transparent; - } - &::-webkit-progress-value { - background: currentColor; - border-radius: 100px; - min-width: @plyr-range-track-height; - } - - // Mozilla - &::-moz-progress-bar { - background: currentColor; - border-radius: 100px; - min-width: @plyr-range-track-height; - } - - // Microsoft - &::-ms-fill { - border-radius: 100px; - } -} -.plyr__progress--buffer { - &::-webkit-progress-value { - transition: width 0.2s ease; - } - &::-moz-progress-bar { - transition: width 0.2s ease; - } - &::-ms-fill { - transition: width 0.2s ease; - } -} -.plyr--video .plyr__progress--buffer { - box-shadow: 0 1px 1px fade(#000, 15%); - color: @plyr-video-progress-buffered-bg; -} -.plyr--audio .plyr__progress--buffer { - color: @plyr-audio-progress-buffered-bg; -} - -// Loading state -.plyr--loading .plyr__progress--buffer { - animation: plyr-progress 1s linear infinite; - background-size: @plyr-progress-loading-size @plyr-progress-loading-size; - background-repeat: repeat-x; - background-image: linear-gradient( - -45deg, - @plyr-progress-loading-bg 25%, - transparent 25%, - transparent 50%, - @plyr-progress-loading-bg 50%, - @plyr-progress-loading-bg 75%, - transparent 75%, - transparent - ); - color: transparent; -} -.plyr--video.plyr--loading .plyr__progress--buffer { - background-color: @plyr-video-progress-buffered-bg; -} -.plyr--audio.plyr--loading .plyr__progress--buffer { - background-color: @plyr-audio-progress-buffered-bg; -} - -// Time -// -------------------------------------------------------------- -.plyr__time { - display: inline-block; - vertical-align: middle; - font-size: @plyr-font-size-small; -} -// Media duration hidden on small screens -.plyr__time + .plyr__time { - display: none; - - @media (min-width: @plyr-bp-screen-md) { - display: inline-block; - } - - // Add a slash in before - &::before { - content: '\2044'; - margin-right: @plyr-control-spacing; - } -} -.plyr--video .plyr__time { - text-shadow: 0 1px 1px fade(#000, 15%); -} - -// Volume -// -------------------------------------------------------------- -.plyr__volume { - display: none; -} -.plyr .plyr__volume { - flex: 1; - position: relative; - - input[type='range'] { - position: relative; - z-index: 2; - } - @media (min-width: @plyr-bp-screen-sm) { - display: block; - max-width: 60px; - } - @media (min-width: @plyr-bp-screen-md) { - max-width: 100px; - } -} - -// Hide sound controls on iOS -// It's not supported to change volume using JavaScript: -// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html -.plyr--is-ios .plyr__volume, -.plyr--is-ios [data-plyr='mute'] { - display: none !important; -} - -// Fullscreen -// -------------------------------------------------------------- -.plyr:fullscreen { - .plyr-fullscreen-active(); -} -.plyr:-webkit-full-screen { - .plyr-fullscreen-active(); -} -.plyr:-moz-full-screen { - .plyr-fullscreen-active(); -} -.plyr:-ms-fullscreen { - .plyr-fullscreen-active(); -} - -// Fallback for unsupported browsers -.plyr--fullscreen-fallback { - .plyr-fullscreen-active(); - - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 10000000; -} diff --git a/src/less/variables.less b/src/less/settings.less index e1b3f64b..e1b3f64b 100644 --- a/src/less/variables.less +++ b/src/less/settings.less diff --git a/src/less/states/fullscreen.less b/src/less/states/fullscreen.less new file mode 100644 index 00000000..9f7478d8 --- /dev/null +++ b/src/less/states/fullscreen.less @@ -0,0 +1,31 @@ +// -------------------------------------------------------------- +// Fullscreen +// -------------------------------------------------------------- + +.plyr:fullscreen { + .plyr-fullscreen-active(); +} + +.plyr:-webkit-full-screen { + .plyr-fullscreen-active(); +} + +.plyr:-moz-full-screen { + .plyr-fullscreen-active(); +} + +.plyr:-ms-fullscreen { + .plyr-fullscreen-active(); +} + +// Fallback for unsupported browsers +.plyr--fullscreen-fallback { + .plyr-fullscreen-active(); + + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 10000000; +} diff --git a/src/less/utils/hidden.less b/src/less/utils/hidden.less new file mode 100644 index 00000000..20947c59 --- /dev/null +++ b/src/less/utils/hidden.less @@ -0,0 +1,33 @@ +// -------------------------------------------------------------- +// Hiding content nicely +// -------------------------------------------------------------- + +// Attributes +.plyr--full-ui [hidden] { + display: none; +} +.plyr--full-ui [aria-hidden='true'] { + display: none; +} + +// Screen reader only elements +.plyr__sr-only { + clip: rect(1px, 1px, 1px, 1px); + overflow: hidden; + + // !important is not always needed + & when(@plyr-sr-only-important = true) { + position: absolute !important; + padding: 0 !important; + border: 0 !important; + height: 1px !important; + width: 1px !important; + } + & when(@plyr-sr-only-important = false) { + position: absolute; + padding: 0; + border: 0; + height: 1px; + width: 1px; + } +} |