这一版本优化了很多
This commit is contained in:
7
node_modules/wot-design-uni/components/common/abstracts/_config.scss
generated
vendored
Normal file
7
node_modules/wot-design-uni/components/common/abstracts/_config.scss
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* SCSS 配置项:命名空间以及BEM
|
||||
*/
|
||||
$namespace: 'wd';
|
||||
$elementSeparator: '__';
|
||||
$modifierSeparator: '--';
|
||||
$state-prefix: 'is-';
|
||||
89
node_modules/wot-design-uni/components/common/abstracts/_function.scss
generated
vendored
Normal file
89
node_modules/wot-design-uni/components/common/abstracts/_function.scss
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
@import 'config';
|
||||
$default-theme: #4d80f0 !default; // 正常色
|
||||
|
||||
/* 转换成字符串 */
|
||||
@function selectorToString($selector) {
|
||||
$selector: inspect($selector);
|
||||
$selector: str-slice($selector, 2, -2);
|
||||
|
||||
@return $selector;
|
||||
}
|
||||
|
||||
/* 判断是否存在 Modifier */
|
||||
@function containsModifier($selector) {
|
||||
$selector: selectorToString($selector);
|
||||
|
||||
@if str-index($selector, $modifierSeparator) {
|
||||
@return true;
|
||||
}
|
||||
|
||||
@else {
|
||||
@return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* 判断是否存在伪类 */
|
||||
@function containsPseudo($selector) {
|
||||
$selector: selectorToString($selector);
|
||||
|
||||
@if str-index($selector, ':') {
|
||||
@return true;
|
||||
}
|
||||
|
||||
@else {
|
||||
@return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主题色切换
|
||||
* @params $theme-color 主题色
|
||||
* @params $type 变暗’dark‘ 变亮 'light'
|
||||
* @params $mix-color 自己设置的混色
|
||||
*/
|
||||
@function themeColor($theme-color, $type: "", $mix-color: "") {
|
||||
@if $default-theme !=#4d80f0 {
|
||||
@if $type=="dark" {
|
||||
@return darken($theme-color, 10%);
|
||||
}
|
||||
|
||||
@else if $type=="light" {
|
||||
@return lighten($theme-color, 10%);
|
||||
}
|
||||
|
||||
@else {
|
||||
@return $theme-color;
|
||||
}
|
||||
}
|
||||
|
||||
@else {
|
||||
@return $mix-color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
|
||||
* @params $open-linear 是否开启线性渐变色
|
||||
* @params $deg 渐变色角度
|
||||
* @params $theme-color 当前配色
|
||||
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
|
||||
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
|
||||
* @params [Array] $per-list 渐变色比例
|
||||
*/
|
||||
@function resultColor($deg, $theme-color, $set, $color-list, $per-list) {
|
||||
// 开启渐变
|
||||
|
||||
$len: length($color-list);
|
||||
$arg: $deg;
|
||||
|
||||
@for $i from 1 through $len {
|
||||
$arg: $arg + ","+ themeColor($theme-color, nth($set, $i), nth($color-list, $i)) + " "+ nth($per-list, $i);
|
||||
}
|
||||
|
||||
@return linear-gradient(unquote($arg));
|
||||
|
||||
}
|
||||
385
node_modules/wot-design-uni/components/common/abstracts/_mixin.scss
generated
vendored
Normal file
385
node_modules/wot-design-uni/components/common/abstracts/_mixin.scss
generated
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
/**
|
||||
* 混合宏
|
||||
*/
|
||||
@import "config";
|
||||
@import "function";
|
||||
|
||||
/**
|
||||
* BEM,定义块(b)
|
||||
*/
|
||||
@mixin b($block) {
|
||||
$B: $namespace + "-"+ $block !global;
|
||||
|
||||
.#{$B} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
@mixin e($element...) {
|
||||
$selector: &;
|
||||
$selectors: "";
|
||||
|
||||
@if containsPseudo($selector) {
|
||||
@each $item in $element {
|
||||
$selectors: #{$selectors + "." + $B + $elementSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
#{$selector} {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@else {
|
||||
@each $item in $element {
|
||||
$selectors: #{$selectors + $selector + $elementSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 此方法用于生成穿透样式 */
|
||||
|
||||
/* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
|
||||
@mixin edeep($element...) {
|
||||
$selector: &;
|
||||
$selectors: "";
|
||||
|
||||
@if containsPseudo($selector) {
|
||||
@each $item in $element {
|
||||
$selectors: #{$selectors + "." + $B + $elementSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
#{$selector} {
|
||||
:deep() {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@else {
|
||||
@each $item in $element {
|
||||
$selectors: #{$selectors + $selector + $elementSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
:deep() {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 定义状态(m) */
|
||||
@mixin m($modifier...) {
|
||||
$selectors: "";
|
||||
|
||||
@each $item in $modifier {
|
||||
$selectors: #{$selectors + & + $modifierSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 定义状态(m) */
|
||||
@mixin mdeep($modifier...) {
|
||||
$selectors: "";
|
||||
|
||||
@each $item in $modifier {
|
||||
$selectors: #{$selectors + & + $modifierSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
:deep() {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 对于需要需要嵌套在 m 底下的 e,调用这个混合宏,一般在切换整个组件的状态,如切换颜色的时候 */
|
||||
@mixin me($element...) {
|
||||
$selector: &;
|
||||
$selectors: "";
|
||||
|
||||
@if containsModifier($selector) {
|
||||
@each $item in $element {
|
||||
$selectors: #{$selectors + "." + $B + $elementSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
#{$selector} {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@else {
|
||||
@each $item in $element {
|
||||
$selectors: #{$selectors + $selector + $elementSeparator + $item + ","};
|
||||
}
|
||||
|
||||
@at-root {
|
||||
#{$selectors} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 状态,生成 is-$state 类名 */
|
||||
@mixin when($states...) {
|
||||
@at-root {
|
||||
@each $state in $states {
|
||||
&.#{$state-prefix + $state} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 常用混合宏
|
||||
*/
|
||||
|
||||
/* 单行超出隐藏 */
|
||||
@mixin lineEllipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 多行超出隐藏 */
|
||||
@mixin multiEllipsis($lineNumber: 3) {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: $lineNumber;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 清除浮动 */
|
||||
@mixin clearFloat {
|
||||
&::after {
|
||||
display: block;
|
||||
content: "";
|
||||
height: 0;
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/* 0.5px 边框 指定方向*/
|
||||
@mixin halfPixelBorder($direction: "bottom", $left: 0, $color: $-color-border-light) {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
|
||||
@if ($left==0) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@else {
|
||||
width: calc(100% - #{$left});
|
||||
}
|
||||
|
||||
height: 1px;
|
||||
left: $left;
|
||||
|
||||
@if ($direction=="bottom") {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
@else {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
transform: scaleY(0.5);
|
||||
background: $color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 0.5px 边框 环绕 */
|
||||
@mixin halfPixelBorderSurround($color: $-color-border-light) {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
border: 1px solid $color;
|
||||
transform: scale(0.5);
|
||||
box-sizing: border-box;
|
||||
transform-origin: left top;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin buttonClear {
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 三角形实现尖角样式,适用于背景透明情况
|
||||
* @param $size 三角形高,底边为 $size * 2
|
||||
* @param $bg 三角形背景颜色
|
||||
*/
|
||||
@mixin triangleArrow($size, $bg) {
|
||||
@include e(arrow) {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
@include e(arrow-down) {
|
||||
border-left: $size solid transparent;
|
||||
border-right: $size solid transparent;
|
||||
border-top: $size solid $bg;
|
||||
transform: translateX(-50%);
|
||||
bottom: calc(-1 * $size)
|
||||
}
|
||||
|
||||
@include e(arrow-up) {
|
||||
border-left: $size solid transparent;
|
||||
border-right: $size solid transparent;
|
||||
border-bottom: $size solid $bg;
|
||||
transform: translateX(-50%);
|
||||
top: calc(-1 * $size)
|
||||
}
|
||||
|
||||
@include e(arrow-left) {
|
||||
border-top: $size solid transparent;
|
||||
border-bottom: $size solid transparent;
|
||||
border-right: $size solid $bg;
|
||||
transform: translateY(-50%);
|
||||
left: calc(-1 * $size)
|
||||
}
|
||||
|
||||
@include e(arrow-right) {
|
||||
border-top: $size solid transparent;
|
||||
border-bottom: $size solid transparent;
|
||||
border-left: $size solid $bg;
|
||||
transform: translateY(-50%);
|
||||
right: calc(-1 * $size)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 正方形实现尖角样式,适用于背景不透明情况
|
||||
* @param $size 正方形边长
|
||||
* @param $bg 正方形背景颜色
|
||||
* @param $z-index z-index属性值,不得大于外部包裹器
|
||||
* @param $box-shadow 阴影
|
||||
*/
|
||||
@mixin squareArrow($size, $bg, $z-index, $box-shadow) {
|
||||
@include e(arrow) {
|
||||
position: absolute;
|
||||
width: $size;
|
||||
height: $size;
|
||||
z-index: $z-index;
|
||||
}
|
||||
|
||||
@include e(arrow-down) {
|
||||
transform: translateX(-50%);
|
||||
bottom: 0;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
width: $size;
|
||||
height: $size;
|
||||
background-color: $bg;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: calc(-1 * $size / 2);
|
||||
transform: rotateZ(45deg);
|
||||
box-shadow: $box-shadow;
|
||||
}
|
||||
}
|
||||
|
||||
@include e(arrow-up) {
|
||||
transform: translateX(-50%);
|
||||
top: 0;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
width: $size;
|
||||
height: $size;
|
||||
background-color: $bg;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: calc(-1 * $size / 2);
|
||||
transform: rotateZ(45deg);
|
||||
box-shadow: $box-shadow;
|
||||
}
|
||||
}
|
||||
|
||||
@include e(arrow-left) {
|
||||
transform: translateY(-50%);
|
||||
left: 0;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
width: $size;
|
||||
height: $size;
|
||||
background-color: $bg;
|
||||
position: absolute;
|
||||
left: calc(-1 * $size / 2);
|
||||
top: 0;
|
||||
transform: rotateZ(45deg);
|
||||
box-shadow: $box-shadow;
|
||||
}
|
||||
}
|
||||
|
||||
@include e(arrow-right) {
|
||||
transform: translateY(-50%);
|
||||
right: 0;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
width: $size;
|
||||
height: $size;
|
||||
background-color: $bg;
|
||||
position: absolute;
|
||||
right: calc(-1 * $size / 2);
|
||||
top: 0;
|
||||
transform: rotateZ(45deg);
|
||||
box-shadow: $box-shadow;
|
||||
}
|
||||
}
|
||||
}
|
||||
1030
node_modules/wot-design-uni/components/common/abstracts/variable.scss
generated
vendored
Normal file
1030
node_modules/wot-design-uni/components/common/abstracts/variable.scss
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user