mirror of https://github.com/ElemeFE/element
170 lines
2.7 KiB
SCSS
170 lines
2.7 KiB
SCSS
![]() |
@import "function";
|
||
|
@import "../common/var";
|
||
|
|
||
|
/* Transition
|
||
|
-------------------------- */
|
||
|
@mixin primary-transition {
|
||
|
transition: $t-primary;
|
||
|
}
|
||
|
|
||
|
@mixin specific-transition($attr) {
|
||
|
transition: $attr $t-primary;
|
||
|
}
|
||
|
|
||
|
@mixin specific-transition-with-time($attr, $time) {
|
||
|
transition: $attr $t-primary;
|
||
|
}
|
||
|
|
||
|
/* Flex
|
||
|
-------------------------- */
|
||
|
@mixin flex-center {
|
||
|
justify-content: center;
|
||
|
align-items: center;
|
||
|
}
|
||
|
|
||
|
@mixin flex-left-center {
|
||
|
justify-content: flex-start;
|
||
|
align-items: center;
|
||
|
}
|
||
|
|
||
|
|
||
|
/* placeholder
|
||
|
-------------------------- */
|
||
|
@mixin placeholder {
|
||
|
&::-webkit-input-placeholder {
|
||
|
@content
|
||
|
}
|
||
|
&::-moz-placeholder {
|
||
|
@content
|
||
|
}
|
||
|
&:-ms-input-placeholder {
|
||
|
@content
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* BEM
|
||
|
-------------------------- */
|
||
|
@mixin b($block) {
|
||
|
$B: $namespace+'-'+$block !global;
|
||
|
|
||
|
.#{$B} {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin e($element) {
|
||
|
$E: $element !global;
|
||
|
$selector: &;
|
||
|
$currentSelector: "";
|
||
|
@each $unit in $element {
|
||
|
$currentSelector: #{$currentSelector + "." + $B + $element-separator + $unit + ","};
|
||
|
}
|
||
|
|
||
|
@if hitAllSpecialNestRule($selector) {
|
||
|
@at-root {
|
||
|
#{$selector} {
|
||
|
#{$currentSelector} {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
} @else {
|
||
|
@at-root {
|
||
|
#{$currentSelector} {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin m($modifier) {
|
||
|
$selector: &;
|
||
|
$currentSelector: "";
|
||
|
@each $unit in $modifier {
|
||
|
$currentSelector: #{$currentSelector + & + $modifier-separator + $unit + ","};
|
||
|
}
|
||
|
|
||
|
@at-root {
|
||
|
#{$currentSelector} {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin configurable-m($modifier, $E-flag: false) {
|
||
|
$selector: &;
|
||
|
$interpolation: '';
|
||
|
|
||
|
@if $E-flag {
|
||
|
$interpolation: $element-separator + $E-flag;
|
||
|
}
|
||
|
|
||
|
@at-root {
|
||
|
#{$selector} {
|
||
|
.#{$B+$interpolation+$modifier-separator+$modifier} {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin spec-selector($specSelector: '', $element: $E, $modifier: false, $block: $B) {
|
||
|
$modifierCombo: '';
|
||
|
|
||
|
@if $modifier {
|
||
|
$modifierCombo: $modifier-separator + $modifier;
|
||
|
}
|
||
|
|
||
|
@at-root {
|
||
|
#{&}#{$specSelector}.#{$block+$element-separator+$element+$modifierCombo} {
|
||
|
@content
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin meb($modifier: false, $element: $E, $block: $B) {
|
||
|
$selector: &;
|
||
|
$modifierCombo: '';
|
||
|
|
||
|
@if $modifier {
|
||
|
$modifierCombo: $modifier-separator + $modifier;
|
||
|
}
|
||
|
|
||
|
@at-root {
|
||
|
#{$selector} {
|
||
|
.#{$block+$element-separator+$element+$modifierCombo} {
|
||
|
@content
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin when($state) {
|
||
|
$selector: &;
|
||
|
|
||
|
@at-root {
|
||
|
#{$selector}.#{$state-prefix + $state} {
|
||
|
@content;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin extend-rule($name) {
|
||
|
@extend #{'%shared-'+$name};
|
||
|
}
|
||
|
|
||
|
@mixin share-rule($name) {
|
||
|
$rule-name: '%shared-'+$name;
|
||
|
|
||
|
@at-root #{$rule-name} {
|
||
|
@content
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@mixin pseudo($pseudo) {
|
||
|
@at-root #{&}#{':#{$pseudo}'} {
|
||
|
@content
|
||
|
}
|
||
|
}
|
||
|
|