mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Issue number: None --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> This PR follows the architectural changes defined on the _SCSS Architecture Design Doc_. Due to some of the developments done in the meantime, not everything that was defined on that document was followed and some sections were simplified. Overall, there were two guidelines that supported the work on this PR: - Have no impact on the current scss partials & CSS architecture for the `md/iOS` themes. - Make everything related to the new `Ionic` Theme separated. Based on these, here're the changes made: **On Themes folder (private):** - Renamed current internal scss partials on src/themes, related to md/iOS, to `native.*.scss` and move them to a new folder, called `native`. Updated imports on all framework. - Removed the ionic prefix from the name of the mixins and function partials on src/themes. Updated imports on all framework. - Created new folder, named ionic, inside src/themes. This holds the `ionic.globals.scss`, with all the mixins and functions forwarded, to be used on other scopes. - Replaced on already created Ionic theme files, the usage of tokens and mixins with @use, to instead _@use "../../themes/ionic/ionic.globals.scss" as globals;_. This ensures an equal approach is followed everywhere and also makes it easier to change the files imported or paths, in the future, as its all in the same global file. - Updated the foundations `readMe` file, with the new process for using globals.  **On css folder (public):** - Created new folder, named `ionic`, inside src/css. This holds all the files related exclusively to Ionic Theme, following the same structure as exists now for md/iOS, with a core, a bundle, utils, etc. Some files were a bit duplicated, to eliminate imports from ios or md theme partials. The only file common to both Themes is the `normalize.scss`. - No folder structure or renamings were done on the existing output, to prevent breaking-changes for developers already making imports from this folder. - Updated typography and link partials to use globals instead of tokens. - Changed `font-size` styles on typography to be on `body`, instead of `html`, to enable correct support of accessibility features on browsers and devices, related to `font-size`.  **Other changes related to global styles new architecture:** - Updated margin & padding utility-classed generated by token, to include css variables and padding/margin mixins. - Updated link test to use new global Ionic bundle, correct utility-class on ion-content and updated snapshots. The font-size changed to 16, as its now the default on the body. - Updated typography snapshots. - Updated prettier format on all scss files. Later on we should make sure this is equal for all team members. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> --------- Co-authored-by: Sean Perkins <sean@ionic.io>
276 lines
6.0 KiB
SCSS
276 lines
6.0 KiB
SCSS
@import "../../themes/native/native.globals";
|
|
|
|
// Progress bar
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Host has no background by default - this will be added to the progress-buffer-bar
|
|
: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: #{ion-color(primary, base, 0.3)};
|
|
--progress-background: #{ion-color(primary, base)};
|
|
|
|
display: block;
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
contain: strict;
|
|
|
|
direction: ltr;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress,
|
|
.progress-indeterminate,
|
|
.indeterminate-bar-primary,
|
|
.indeterminate-bar-secondary,
|
|
.progress-buffer-bar {
|
|
@include position(0, 0, 0, 0);
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.buffer-circles-container,
|
|
.buffer-circles {
|
|
@include position(0, 0, 0, 0);
|
|
position: absolute;
|
|
}
|
|
|
|
// Extend a bit to overflow. The size of animated distance.
|
|
.buffer-circles {
|
|
/* stylelint-disable property-disallowed-list */
|
|
right: -10px;
|
|
left: -10px;
|
|
/* stylelint-enable property-disallowed-list */
|
|
}
|
|
|
|
// Determinate progress bar
|
|
// --------------------------------------------------
|
|
|
|
.progress,
|
|
.progress-buffer-bar,
|
|
.buffer-circles-container {
|
|
/* stylelint-disable-next-line property-disallowed-list */
|
|
transform-origin: left top;
|
|
|
|
transition: transform 150ms linear;
|
|
}
|
|
|
|
// Progress and background bar
|
|
// --------------------------------------------------
|
|
|
|
.progress,
|
|
.progress-indeterminate {
|
|
background: var(--progress-background);
|
|
|
|
z-index: 2;
|
|
}
|
|
|
|
.progress-buffer-bar {
|
|
background: var(--background);
|
|
|
|
z-index: 1;
|
|
}
|
|
|
|
.buffer-circles-container {
|
|
overflow: hidden;
|
|
}
|
|
|
|
// MD based animation on indeterminate type
|
|
// --------------------------------------------------
|
|
|
|
.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;
|
|
|
|
.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;
|
|
|
|
.progress-indeterminate {
|
|
animation: secondary-indeterminate-scale 2s infinite linear;
|
|
animation-play-state: inherit;
|
|
}
|
|
}
|
|
|
|
// Progress Bar: Buffer Circles
|
|
// ------------------------------------------------------------------------
|
|
|
|
.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;
|
|
}
|
|
|
|
// Progress Bar: Reversed
|
|
// ------------------------------------------------------------------------
|
|
// If reversed is set to true, the animation will be reversed
|
|
// and the bar will start at the top right
|
|
|
|
:host(.progress-bar-reversed) {
|
|
transform: scaleX(-1);
|
|
}
|
|
|
|
// Progress Bar: Paused
|
|
// ------------------------------------------------------------------------
|
|
|
|
:host(.progress-paused) {
|
|
.indeterminate-bar-secondary,
|
|
.indeterminate-bar-primary,
|
|
.buffer-circles {
|
|
animation-play-state: paused;
|
|
}
|
|
}
|
|
|
|
// Progress Bar: Color
|
|
// ------------------------------------------------------------------------
|
|
|
|
:host(.ion-color) .buffer-circles {
|
|
background-image: radial-gradient(
|
|
ellipse at center,
|
|
#{current-color(base, 0.3)} 0%,
|
|
#{current-color(base, 0.3)} 30%,
|
|
transparent 30%
|
|
);
|
|
}
|
|
|
|
:host(.ion-color) {
|
|
.progress,
|
|
.progress-indeterminate {
|
|
background: #{current-color(base)};
|
|
}
|
|
}
|
|
|
|
// Progress Bar: Animation Keyframes
|
|
// ------------------------------------------------------------------------
|
|
// Source: https://github.com/material-components/material-components-web/blob/master/packages/mdc-linear-progress/_keyframes.scss
|
|
|
|
@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);
|
|
}
|
|
}
|