UNPKG

@ionic/core

Version:
267 lines (251 loc) • 7.31 kB
/** * Convert a font size to a dynamic font size. * Fonts that participate in Dynamic Type should use * dynamic font sizes. * @param size - The initial font size including the unit (i.e. px or pt) * @param unit (optional) - The unit to convert to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * Convert a font size to a dynamic font size but impose * a maximum font size. * @param size - The initial font size including the unit (i.e. px or pt) * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale). * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * Convert a font size to a dynamic font size but impose * a minimum font size. * @param size - The initial font size including the unit (i.e. px or pt) * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale). * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * Convert a font size to a dynamic font size but impose * maximum and minimum font sizes. * @param size - The initial font size including the unit (i.e. px or pt) * @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale). * @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale). * @param unit (optional) - The unit to convert the initial font size to. Use this if you want to * convert to a unit other than $baselineUnit. */ /** * A heuristic that applies CSS to tablet * viewports. * * Usage: * @include tablet-viewport() { * :host { * background-color: green; * } * } */ /** * A heuristic that applies CSS to mobile * viewports (i.e. phones, not tablets). * * Usage: * @include mobile-viewport() { * :host { * background-color: blue; * } * } */ :host { /** * @prop --background: Background of the progress track, or the buffer bar if `buffer` is set * @prop --progress-background: Background of the progress bar representing the current value */ --background: rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.3); --progress-background: var(--ion-color-primary, #0054e9); display: block; position: relative; width: 100%; contain: strict; direction: ltr; overflow: hidden; } .progress, .progress-indeterminate, .indeterminate-bar-primary, .indeterminate-bar-secondary, .progress-buffer-bar { left: 0; right: 0; top: 0; bottom: 0; position: absolute; width: 100%; height: 100%; } .buffer-circles-container, .buffer-circles { left: 0; right: 0; top: 0; bottom: 0; position: absolute; } .buffer-circles { /* stylelint-disable property-disallowed-list */ right: -10px; left: -10px; /* stylelint-enable property-disallowed-list */ } .progress, .progress-buffer-bar, .buffer-circles-container { /* stylelint-disable-next-line property-disallowed-list */ transform-origin: left top; transition: transform 150ms linear; } .progress, .progress-indeterminate { background: var(--progress-background); z-index: 2; } .progress-buffer-bar { background: var(--background); z-index: 1; } .buffer-circles-container { overflow: hidden; } .indeterminate-bar-primary { /* stylelint-disable property-disallowed-list */ top: 0; right: 0; bottom: 0; left: -145.166611%; /* stylelint-enable property-disallowed-list */ animation: primary-indeterminate-translate 2s infinite linear; } .indeterminate-bar-primary .progress-indeterminate { animation: primary-indeterminate-scale 2s infinite linear; animation-play-state: inherit; } .indeterminate-bar-secondary { /* stylelint-disable property-disallowed-list */ top: 0; right: 0; bottom: 0; left: -54.888891%; /* stylelint-enable property-disallowed-list */ animation: secondary-indeterminate-translate 2s infinite linear; } .indeterminate-bar-secondary .progress-indeterminate { animation: secondary-indeterminate-scale 2s infinite linear; animation-play-state: inherit; } .buffer-circles { background-image: radial-gradient(ellipse at center, var(--background) 0%, var(--background) 30%, transparent 30%); /* stylelint-disable property-disallowed-list */ background-repeat: repeat-x; background-position: 5px center; background-size: 10px 10px; /* stylelint-enable property-disallowed-list */ z-index: 0; animation: buffering 450ms infinite linear; } :host(.progress-bar-reversed) { transform: scaleX(-1); } :host(.progress-paused) .indeterminate-bar-secondary, :host(.progress-paused) .indeterminate-bar-primary, :host(.progress-paused) .buffer-circles { animation-play-state: paused; } :host(.ion-color) .buffer-circles { background-image: radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%); } :host(.ion-color) .progress, :host(.ion-color) .progress-indeterminate { background: var(--ion-color-base); } @keyframes primary-indeterminate-translate { 0% { transform: translateX(0); } 20% { animation-timing-function: cubic-bezier(0.5, 0, 0.701732, 0.495819); transform: translateX(0); } 59.15% { animation-timing-function: cubic-bezier(0.302435, 0.381352, 0.55, 0.956352); transform: translateX(83.67142%); } 100% { transform: translateX(200.611057%); } } @keyframes primary-indeterminate-scale { 0% { transform: scaleX(0.08); } 36.65% { animation-timing-function: cubic-bezier(0.334731, 0.12482, 0.785844, 1); transform: scaleX(0.08); } 69.15% { animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1); transform: scaleX(0.661479); } 100% { transform: scaleX(0.08); } } @keyframes secondary-indeterminate-translate { 0% { animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685); transform: translateX(0); } 25% { animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712); transform: translateX(37.651913%); } 48.35% { animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026); transform: translateX(84.386165%); } 100% { transform: translateX(160.277782%); } } @keyframes secondary-indeterminate-scale { 0% { animation-timing-function: cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971); transform: scaleX(0.08); } 19.15% { animation-timing-function: cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315); transform: scaleX(0.457104); } 44.15% { animation-timing-function: cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179); transform: scaleX(0.72796); } 100% { transform: scaleX(0.08); } } @keyframes buffering { to { transform: translateX(-10px); } } :host { border-radius: 9999px; height: 4px; } :host(.progress-bar-solid) { /** * On iOS the unfilled portion of the progress bar * is always a consistent background color. We * only apply this style when the progress bar is * solid (with a buffer value of 1). This maintains * the custom Ionic appearance for a buffered progress bar. */ --background: var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6)); }