rappel-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/_virtual/_plugin-vue_export-helper.js +1 -0
- package/cjs/components/button/index.d.ts +33 -0
- package/cjs/components/button/index.js +1 -0
- package/cjs/components/button/src/button.d.ts +3 -0
- package/cjs/components/button/src/button.vue.js +1 -0
- package/cjs/components/button/src/button.vue2.js +1 -0
- package/cjs/components/button/src/constants.d.ts +4 -0
- package/cjs/components/button/src/constants.js +1 -0
- package/cjs/components/button/src/types.d.ts +16 -0
- package/cjs/components/button/style/css.d.ts +0 -0
- package/cjs/components/button/style/index.d.ts +0 -0
- package/cjs/components/colors/index.d.ts +7 -0
- package/cjs/components/colors/index.js +1 -0
- package/cjs/components/colors/src/colors.vue.js +1 -0
- package/cjs/components/colors/src/colors.vue2.js +1 -0
- package/cjs/components/colors/src/neutral-color.css +1 -0
- package/cjs/components/colors/src/neutral-color.vue.js +1 -0
- package/cjs/components/colors/src/neutral-color.vue2.js +1 -0
- package/cjs/components/colors/src/primary-color.css +1 -0
- package/cjs/components/colors/src/primary-color.vue.js +1 -0
- package/cjs/components/colors/src/primary-color.vue2.js +1 -0
- package/cjs/components/colors/src/secondary-color.css +1 -0
- package/cjs/components/colors/src/secondary-color.vue.js +1 -0
- package/cjs/components/colors/src/secondary-color.vue2.js +1 -0
- package/cjs/components/index.d.ts +4 -0
- package/cjs/components/index.js +1 -0
- package/cjs/components/input/index.d.ts +25 -0
- package/cjs/components/input/index.js +1 -0
- package/cjs/components/input/src/input.vue.js +1 -0
- package/cjs/components/input/src/input.vue2.js +1 -0
- package/cjs/components/tabs/index.d.ts +20 -0
- package/cjs/components/tabs/index.js +1 -0
- package/cjs/components/tabs/src/tabs.vue.js +1 -0
- package/cjs/composables/index.d.ts +6 -0
- package/cjs/composables/use-namespace/index.d.ts +12 -0
- package/cjs/composables/use-namespace/index.js +1 -0
- package/cjs/composables/useDateFormat.d.ts +7 -0
- package/cjs/composables/useDateFormat.js +1 -0
- package/cjs/composables/useDraggable.d.ts +10 -0
- package/cjs/composables/useDraggable.js +1 -0
- package/cjs/composables/useOnceFn.d.ts +24 -0
- package/cjs/composables/useOnceFn.js +1 -0
- package/cjs/composables/useTimeNodes.d.ts +3 -0
- package/cjs/composables/useTimeNodes.js +1 -0
- package/cjs/composables/useWaterFallLayout.d.ts +10 -0
- package/cjs/composables/useWaterFallLayout.js +1 -0
- package/cjs/constants/index.d.ts +1 -0
- package/cjs/constants/svgLoading.d.ts +2 -0
- package/cjs/constants/svgLoading.js +36 -0
- package/cjs/directives/index.d.ts +3 -0
- package/cjs/directives/vDraggable.d.ts +2 -0
- package/cjs/directives/vDraggable.js +1 -0
- package/cjs/directives/vResizable.d.ts +14 -0
- package/cjs/directives/vResizable.js +21 -0
- package/cjs/directives/vSvgLoading.d.ts +4 -0
- package/cjs/directives/vSvgLoading.js +1 -0
- package/cjs/index.d.ts +86 -0
- package/cjs/index.js +1 -0
- package/cjs/package.json.js +1 -0
- package/cjs/purple-ui/index.d.ts +1 -0
- package/cjs/purple-ui/resolver.d.ts +2 -0
- package/cjs/purple-ui/resolver.js +1 -0
- package/cjs/theme-chalk/src/base.css +1 -0
- package/cjs/theme-chalk/src/button.css +1 -0
- package/cjs/utils/index.d.ts +2 -0
- package/cjs/utils/util.d.ts +143 -0
- package/cjs/utils/util.js +3 -0
- package/cjs/utils/vue/index.d.ts +17 -0
- package/cjs/utils/vue/index.js +1 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/components/button/index.d.ts +33 -0
- package/es/components/button/index.mjs +6 -0
- package/es/components/button/src/button.d.ts +3 -0
- package/es/components/button/src/button.vue.mjs +74 -0
- package/es/components/button/src/button.vue2.mjs +4 -0
- package/es/components/button/src/constants.d.ts +4 -0
- package/es/components/button/src/constants.mjs +5 -0
- package/es/components/button/src/types.d.ts +16 -0
- package/es/components/button/style/css.d.ts +0 -0
- package/es/components/button/style/index.d.ts +0 -0
- package/es/components/colors/index.d.ts +7 -0
- package/es/components/colors/index.mjs +16 -0
- package/es/components/colors/src/colors.vue.mjs +21 -0
- package/es/components/colors/src/colors.vue2.mjs +4 -0
- package/es/components/colors/src/neutral-color.css +1 -0
- package/es/components/colors/src/neutral-color.vue.mjs +7 -0
- package/es/components/colors/src/neutral-color.vue2.mjs +195 -0
- package/es/components/colors/src/primary-color.css +1 -0
- package/es/components/colors/src/primary-color.vue.mjs +7 -0
- package/es/components/colors/src/primary-color.vue2.mjs +33 -0
- package/es/components/colors/src/secondary-color.css +1 -0
- package/es/components/colors/src/secondary-color.vue.mjs +7 -0
- package/es/components/colors/src/secondary-color.vue2.mjs +54 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.mjs +20 -0
- package/es/components/input/index.d.ts +25 -0
- package/es/components/input/index.mjs +6 -0
- package/es/components/input/src/input.vue.mjs +15 -0
- package/es/components/input/src/input.vue2.mjs +4 -0
- package/es/components/tabs/index.d.ts +20 -0
- package/es/components/tabs/index.mjs +6 -0
- package/es/components/tabs/src/tabs.vue.mjs +17 -0
- package/es/composables/index.d.ts +6 -0
- package/es/composables/use-namespace/index.d.ts +12 -0
- package/es/composables/use-namespace/index.mjs +21 -0
- package/es/composables/useDateFormat.d.ts +7 -0
- package/es/composables/useDateFormat.mjs +20 -0
- package/es/composables/useDraggable.d.ts +10 -0
- package/es/composables/useDraggable.mjs +55 -0
- package/es/composables/useOnceFn.d.ts +24 -0
- package/es/composables/useOnceFn.mjs +32 -0
- package/es/composables/useTimeNodes.d.ts +3 -0
- package/es/composables/useTimeNodes.mjs +24 -0
- package/es/composables/useWaterFallLayout.d.ts +10 -0
- package/es/composables/useWaterFallLayout.mjs +51 -0
- package/es/constants/index.d.ts +1 -0
- package/es/constants/svgLoading.d.ts +2 -0
- package/es/constants/svgLoading.mjs +39 -0
- package/es/directives/index.d.ts +3 -0
- package/es/directives/vDraggable.d.ts +2 -0
- package/es/directives/vDraggable.mjs +13 -0
- package/es/directives/vResizable.d.ts +14 -0
- package/es/directives/vResizable.mjs +136 -0
- package/es/directives/vSvgLoading.d.ts +4 -0
- package/es/directives/vSvgLoading.mjs +48 -0
- package/es/index.d.ts +86 -0
- package/es/index.mjs +76 -0
- package/es/package.json.mjs +4 -0
- package/es/purple-ui/index.d.ts +1 -0
- package/es/purple-ui/resolver.d.ts +2 -0
- package/es/purple-ui/resolver.mjs +18 -0
- package/es/theme-chalk/src/base.css +1 -0
- package/es/theme-chalk/src/button.css +1 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/util.d.ts +143 -0
- package/es/utils/util.mjs +151 -0
- package/es/utils/vue/index.d.ts +17 -0
- package/es/utils/vue/index.mjs +36 -0
- package/global.d.ts +7 -0
- package/package.json +65 -0
- package/theme-chalk/base.css +148 -0
- package/theme-chalk/css-vars/_button.css +35 -0
- package/theme-chalk/css-vars/_colors.css +51 -0
- package/theme-chalk/function/_button.css +35 -0
- package/theme-chalk/function/index.css +35 -0
- package/theme-chalk/index.css +560 -0
- package/theme-chalk/mixins/_button.css +35 -0
- package/theme-chalk/mixins/index.css +35 -0
- package/theme-chalk/pu-button.css +446 -0
- package/theme-chalk/root-vars.css +132 -0
- package/theme-chalk/src/base.scss +30 -0
- package/theme-chalk/src/button.scss +104 -0
- package/theme-chalk/src/common/_function.scss +46 -0
- package/theme-chalk/src/css-vars/_button.scss +47 -0
- package/theme-chalk/src/css-vars/_colors.scss +82 -0
- package/theme-chalk/src/css-vars/_namespace.scss +12 -0
- package/theme-chalk/src/function/_button.scss +2 -0
- package/theme-chalk/src/function/index.scss +155 -0
- package/theme-chalk/src/index.scss +2 -0
- package/theme-chalk/src/mixins/_button.scss +140 -0
- package/theme-chalk/src/mixins/index.scss +25 -0
- package/theme-chalk/src/root-vars.scss +13 -0
- package/umd/index.js +59 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use '../css-vars/_namespace.scss' as *;
|
|
4
|
+
|
|
5
|
+
//('color','text','base') => $obj.color.text.base
|
|
6
|
+
@function deepGet($obj, $keys...) {
|
|
7
|
+
$current: $obj;
|
|
8
|
+
@each $key in $keys {
|
|
9
|
+
$current: map.get($current, $key);
|
|
10
|
+
}
|
|
11
|
+
@return $current;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//('color','text','base') => 'color-text-base'
|
|
15
|
+
@function joinStr($args...) {
|
|
16
|
+
$str: list.nth($args, 1);
|
|
17
|
+
@for $i from 1 through list.length($args) {
|
|
18
|
+
@if $i > 1 {
|
|
19
|
+
$str: $str + '-' + list.nth($args, $i);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
@return $str;
|
|
23
|
+
}
|
|
24
|
+
// 'button' => 'pu-button'
|
|
25
|
+
@function namespaceJoinStr($args...) {
|
|
26
|
+
@return deepGet($namespace, 'prefix') + '-' + joinStr($args...);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#{$obj.color.text.base}
|
|
30
|
+
@function getScssVar($obj, $keys...) {
|
|
31
|
+
@return #{deepGet($obj, $keys...)};
|
|
32
|
+
}
|
|
33
|
+
// $namespace.prefix's value
|
|
34
|
+
@function getNamespace($name) {
|
|
35
|
+
@return deepGet($namespace, $name);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//('color','text','base') => '--pu-color-text-base'
|
|
39
|
+
@function getCssVarStr($args...) {
|
|
40
|
+
@return '--' + namespaceJoinStr($args...);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ('color','text','base') => var(--pu-color-text-base)
|
|
44
|
+
@function getCssVar($args...) {
|
|
45
|
+
@return var(#{getCssVarStr($args...)});
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../function/index' as *;
|
|
3
|
+
|
|
4
|
+
$button: () !default;
|
|
5
|
+
$button: map.deep-merge(
|
|
6
|
+
(
|
|
7
|
+
'': (
|
|
8
|
+
'bgcolor': getCssVar('color', 'fill', 'blank'),
|
|
9
|
+
'color': getCssVar('color', 'text', 'secondary'),
|
|
10
|
+
'border-color': getCssVar('color', 'border', 'base'),
|
|
11
|
+
'hover-color': getCssVar('color', 'primary', 'base'),
|
|
12
|
+
'hover-bgcolor': getCssVar('color', 'primary', 'shade-1'),
|
|
13
|
+
'hover-border-color': getCssVar('color', 'primary', 'shade-4')
|
|
14
|
+
)
|
|
15
|
+
),
|
|
16
|
+
$button
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
$button-types: ('', 'primary', 'success', 'danger', 'warning', 'info');
|
|
20
|
+
@each $type in $button-types {
|
|
21
|
+
@if $type {
|
|
22
|
+
$button: map.deep-merge(
|
|
23
|
+
(
|
|
24
|
+
$type: (
|
|
25
|
+
'bgcolor': getCssVar('color', $type, 'base'),
|
|
26
|
+
'color': getCssVar('color', 'text', 'lightest'),
|
|
27
|
+
'border-color': getCssVar('color', $type, 'base'),
|
|
28
|
+
'hover-color': getCssVar('color', 'text', 'lightest'),
|
|
29
|
+
'hover-bgcolor': getCssVar('color', $type, 'hover'),
|
|
30
|
+
'hover-border-color': getCssVar('color', $type, 'hover')
|
|
31
|
+
)
|
|
32
|
+
),
|
|
33
|
+
$button
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
$button-padding: () !default;
|
|
39
|
+
$button-padding: map.deep-merge(
|
|
40
|
+
(
|
|
41
|
+
'large': 12px 20px,
|
|
42
|
+
'': 8px 16px,
|
|
43
|
+
'small': 6px 12px,
|
|
44
|
+
'mini': 4px 8px
|
|
45
|
+
),
|
|
46
|
+
$button-padding
|
|
47
|
+
);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../function/index.scss' as *;
|
|
3
|
+
|
|
4
|
+
$colors: () !default;
|
|
5
|
+
|
|
6
|
+
$colors: map.deep-merge(
|
|
7
|
+
(
|
|
8
|
+
text: (
|
|
9
|
+
darkest: #000000,
|
|
10
|
+
base: #303131,
|
|
11
|
+
secondary: #606062,
|
|
12
|
+
neutral: #909093,
|
|
13
|
+
placeholder: #b2b2b6,
|
|
14
|
+
disabled: #cdcdd1,
|
|
15
|
+
lightest: #ffffff
|
|
16
|
+
),
|
|
17
|
+
border: (
|
|
18
|
+
darker: #c3c3cb,
|
|
19
|
+
dark: #d0d0d8,
|
|
20
|
+
base: #dbdbe0,
|
|
21
|
+
light: #e4e4e8,
|
|
22
|
+
lighter: #ededef,
|
|
23
|
+
extra-light: #efeff3,
|
|
24
|
+
theme: #d4caff
|
|
25
|
+
),
|
|
26
|
+
fill: (
|
|
27
|
+
darker: #d7d7dc,
|
|
28
|
+
dark: #e8e8ec,
|
|
29
|
+
base: #ededf0,
|
|
30
|
+
light: #f1f1f4,
|
|
31
|
+
lighter: #f6f6f7,
|
|
32
|
+
extra-light: #f8f8f9,
|
|
33
|
+
theme: #f7f7fb,
|
|
34
|
+
blank: #ffffff,
|
|
35
|
+
transparent: transparent
|
|
36
|
+
)
|
|
37
|
+
),
|
|
38
|
+
$colors
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
$state-types: (
|
|
42
|
+
primary: (
|
|
43
|
+
#937bff
|
|
44
|
+
),
|
|
45
|
+
success: (
|
|
46
|
+
#06b56d
|
|
47
|
+
),
|
|
48
|
+
danger: (
|
|
49
|
+
#ee6979
|
|
50
|
+
),
|
|
51
|
+
warning: (
|
|
52
|
+
#cd9a0a
|
|
53
|
+
),
|
|
54
|
+
info: (
|
|
55
|
+
#8e8e91
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 生成不同(0.9-0.1)透明度对应的等值颜色:
|
|
61
|
+
primary: (
|
|
62
|
+
base: #937bff,
|
|
63
|
+
hover: #7e69dc,
|
|
64
|
+
shade-9: #9e88ff,
|
|
65
|
+
shade-8: #a995ff,
|
|
66
|
+
shade-7: #b3a3ff,
|
|
67
|
+
shade-6: #beb0ff,
|
|
68
|
+
shade-5: #c9bdff,
|
|
69
|
+
shade-4: #d4caff,
|
|
70
|
+
shade-3: #ded7ff,
|
|
71
|
+
shade-2: #e9e5ff,
|
|
72
|
+
shade-1: #f4f2ff
|
|
73
|
+
),
|
|
74
|
+
*/
|
|
75
|
+
@each $type, $color in $state-types {
|
|
76
|
+
$colors: map.merge(
|
|
77
|
+
$colors,
|
|
78
|
+
(
|
|
79
|
+
$type: create-colors($color)
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:color';
|
|
4
|
+
@use 'sass:math';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
@use '../css-vars/_namespace.scss' as *;
|
|
7
|
+
|
|
8
|
+
//('color','text','base') => $obj.color.text.base
|
|
9
|
+
@function deepGet($obj, $keys...) {
|
|
10
|
+
$current: $obj;
|
|
11
|
+
@each $key in $keys {
|
|
12
|
+
$current: map.get($current, $key);
|
|
13
|
+
}
|
|
14
|
+
@return $current;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//('color','text','base') => 'color-text-base'
|
|
18
|
+
@function joinStr($args...) {
|
|
19
|
+
$str: list.nth($args, 1);
|
|
20
|
+
@for $i from 1 through list.length($args) {
|
|
21
|
+
@if $i > 1 {
|
|
22
|
+
$str: $str + '-' + list.nth($args, $i);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
@return $str;
|
|
26
|
+
}
|
|
27
|
+
// 'button' => 'pu-button'
|
|
28
|
+
@function namespaceJoinStr($args...) {
|
|
29
|
+
@return deepGet($namespace, 'prefix') + '-' + joinStr($args...);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#{$obj.color.text.base}
|
|
33
|
+
@function getScssVar($obj, $keys...) {
|
|
34
|
+
@return #{deepGet($obj, $keys...)};
|
|
35
|
+
}
|
|
36
|
+
// $namespace.prefix's value
|
|
37
|
+
@function getNamespace($name) {
|
|
38
|
+
@return deepGet($namespace, $name);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//('color','text','base') => '--pu-color-text-base'
|
|
42
|
+
@function getCssVarStr($args...) {
|
|
43
|
+
@return '--' + namespaceJoinStr($args...);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ('color','text','base') => var(--pu-color-text-base)
|
|
47
|
+
@function getCssVar($args...) {
|
|
48
|
+
@return var(#{getCssVarStr($args...)});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 将十六进制颜色转换为RGB颜色
|
|
53
|
+
* @param $hex 十六进制颜色值
|
|
54
|
+
* @returns RGB颜色值
|
|
55
|
+
* color.channel($color, "red", $space: rgb)
|
|
56
|
+
*/
|
|
57
|
+
@function hex-to-rgb($hex) {
|
|
58
|
+
@return color.channel($hex, 'red', $space: rgb) color.channel($hex, 'green', $space: rgb)
|
|
59
|
+
color.channel($hex, 'blue', $space: rgb);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 将RGB颜色转换为十六进制颜色
|
|
63
|
+
* @param $value RGB颜色值
|
|
64
|
+
* @returns 十六进制颜色值
|
|
65
|
+
*/
|
|
66
|
+
@function color-to-hex($value) {
|
|
67
|
+
$hex-chars: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'f';
|
|
68
|
+
$first: list.nth($hex-chars, math.floor(math.div($value, 16)) + 1);
|
|
69
|
+
$second: list.nth($hex-chars, ($value % 16) + 1);
|
|
70
|
+
@return #{$first}#{$second};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 将RGB颜色转换为十六进制颜色
|
|
74
|
+
* @param $color RGB颜色值
|
|
75
|
+
* @returns 十六进制颜色值
|
|
76
|
+
*/
|
|
77
|
+
@function rgb-to-hex($color) {
|
|
78
|
+
$r-hex: color-to-hex(color.channel($color, 'red', $space: rgb));
|
|
79
|
+
$g-hex: color-to-hex(color.channel($color, 'green', $space: rgb));
|
|
80
|
+
$b-hex: color-to-hex(color.channel($color, 'blue', $space: rgb));
|
|
81
|
+
|
|
82
|
+
@return string.unquote('#' + $r-hex + $g-hex + $b-hex);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 创建一个等效的透明度颜色,并返回一个等效的透明度颜色
|
|
87
|
+
* @param $color 颜色
|
|
88
|
+
* @param $opacity 透明度,默认值为1
|
|
89
|
+
* @returns 一个等效的透明度颜色
|
|
90
|
+
*/
|
|
91
|
+
@function get-equal-opacity-color($color, $opacity: 1) {
|
|
92
|
+
// 获取颜色的 RGB 值
|
|
93
|
+
$r: color.channel($color, 'red', $space: rgb);
|
|
94
|
+
$g: color.channel($color, 'green', $space: rgb);
|
|
95
|
+
$b: color.channel($color, 'blue', $space: rgb);
|
|
96
|
+
|
|
97
|
+
// 白色背景值
|
|
98
|
+
$white-r: 255;
|
|
99
|
+
$white-g: 255;
|
|
100
|
+
$white-b: 255;
|
|
101
|
+
|
|
102
|
+
// 计算等效颜色值:前景 × alpha + 背景 × (1 - alpha)
|
|
103
|
+
$equiv-r: math.round($r * $opacity + $white-r * (1 - $opacity));
|
|
104
|
+
$equiv-g: math.round($g * $opacity + $white-g * (1 - $opacity));
|
|
105
|
+
$equiv-b: math.round($b * $opacity + $white-b * (1 - $opacity));
|
|
106
|
+
|
|
107
|
+
// 返回新的颜色
|
|
108
|
+
@return rgb-to-hex(rgb($equiv-r, $equiv-g, $equiv-b));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 创建一个变暗的颜色,并返回一个变暗的颜色
|
|
113
|
+
* @param $color 颜色
|
|
114
|
+
* @param $factor 颜色变暗的度量,默认为0.15
|
|
115
|
+
* @returns 一个变暗的颜色
|
|
116
|
+
*/
|
|
117
|
+
@function darken-color($color, $factor: 0.15) {
|
|
118
|
+
$r: color.channel($color, 'red', $space: rgb);
|
|
119
|
+
$g: color.channel($color, 'green', $space: rgb);
|
|
120
|
+
$b: color.channel($color, 'blue', $space: rgb);
|
|
121
|
+
|
|
122
|
+
// 向黑色混合:newColor = originalColor * (1 - factor) + blackColor * factor
|
|
123
|
+
$new-r: math.round($r * (1 - $factor));
|
|
124
|
+
$new-g: math.round($g * (1 - $factor));
|
|
125
|
+
$new-b: math.round($b * (1 - $factor));
|
|
126
|
+
|
|
127
|
+
@return rgb-to-hex(rgb($new-r, $new-g, $new-b));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 创建层级颜色
|
|
132
|
+
* @param $base-color 基础颜色
|
|
133
|
+
* @param $darkness 变暗的度量,默认为0.15
|
|
134
|
+
* @returns 主题色映射
|
|
135
|
+
*/
|
|
136
|
+
@function create-colors($base-color, $darkness: 0.15) {
|
|
137
|
+
$result: (
|
|
138
|
+
base: $base-color,
|
|
139
|
+
hover: darken-color($base-color, $darkness)
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// 添加不同透明度的等值颜色,映射为 shade-1 到 shade-9
|
|
143
|
+
@for $i from 9 through 1 {
|
|
144
|
+
$opacity: $i * 0.1; // 从 0.9 到 0.1
|
|
145
|
+
$color-with-opacity: get-equal-opacity-color($base-color, $opacity);
|
|
146
|
+
$result: map.merge(
|
|
147
|
+
$result,
|
|
148
|
+
(
|
|
149
|
+
'shade-#{$i}': $color-with-opacity
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@return $result;
|
|
155
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../css-vars/_button' as *;
|
|
3
|
+
@use './index' as *;
|
|
4
|
+
@use '../function/index' as *;
|
|
5
|
+
|
|
6
|
+
@mixin set-bgcolor-var($type, $value) {
|
|
7
|
+
#{getCssVarStr('button', 'bgcolor')}: #{map.get($button, $type, $value)};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@mixin set-bgcolor-custom($value) {
|
|
11
|
+
#{getCssVarStr('button', 'bgcolor')}: #{$value};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin set-color-var($type, $value) {
|
|
15
|
+
#{getCssVarStr('button', 'color')}: #{map.get($button, $type, $value)};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@mixin set-color-custom($value) {
|
|
19
|
+
#{getCssVarStr('button', 'color')}: #{$value};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@mixin set-bordercolor-var($type, $value) {
|
|
23
|
+
#{getCssVarStr('button', 'border-color')}: #{map.get($button, $type, $value)};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@mixin set-bordercolor-custom($value) {
|
|
27
|
+
#{getCssVarStr('button', 'border-color')}: #{$value};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin set-bbc-color-vars($type) {
|
|
31
|
+
@include set-bgcolor-var($type, 'bgcolor');
|
|
32
|
+
@include set-color-var($type, 'color');
|
|
33
|
+
@include set-bordercolor-var($type, 'border-color');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@mixin set-bbc-hover-color-vars($type) {
|
|
37
|
+
@include set-bgcolor-var($type, 'hover-bgcolor');
|
|
38
|
+
@include set-color-var($type, 'hover-color');
|
|
39
|
+
@include set-bordercolor-var($type, 'hover-border-color');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@mixin button-modifier($button, $type) {
|
|
43
|
+
@include set-bbc-color-vars($type);
|
|
44
|
+
@include hover() {
|
|
45
|
+
@include set-bbc-hover-color-vars($type);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include is('disabled') {
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
background-color: if(
|
|
51
|
+
$type != '',
|
|
52
|
+
getCssVar('color', $type, 'shade-4'),
|
|
53
|
+
getCssVar('color', 'fill', 'blank')
|
|
54
|
+
);
|
|
55
|
+
border-color: if(
|
|
56
|
+
$type != '',
|
|
57
|
+
getCssVar('color', $type, 'shade-4'),
|
|
58
|
+
getCssVar('color', 'border', 'base')
|
|
59
|
+
);
|
|
60
|
+
color: if(
|
|
61
|
+
$type != '',
|
|
62
|
+
getCssVar('color', 'fill', 'blank'),
|
|
63
|
+
getCssVar('color', 'text', 'disabled')
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@include is('link') {
|
|
68
|
+
@include set-color-var($type, if($type != '', 'bgcolor', 'color'));
|
|
69
|
+
@include hover {
|
|
70
|
+
@include set-color-var($type, if($type != '', 'hover-bgcolor', 'hover-color'));
|
|
71
|
+
@include set-bgcolor-custom('transparent');
|
|
72
|
+
@include set-bordercolor-custom('transparent');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include is('disabled') {
|
|
76
|
+
background-color: getCssVar('color', 'fill', 'blank');
|
|
77
|
+
border-color: getCssVar('color', 'fill', 'blank');
|
|
78
|
+
color: if(
|
|
79
|
+
$type != '',
|
|
80
|
+
getCssVar('color', $type, 'shade-4'),
|
|
81
|
+
getCssVar('color', 'text', 'disabled')
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@include is('plain') {
|
|
87
|
+
@if $type != '' {
|
|
88
|
+
background-color: getCssVar('color', $type, 'shade-1');
|
|
89
|
+
color: getCssVar('color', $type, 'base');
|
|
90
|
+
border-color: getCssVar('color', $type, 'shade-6');
|
|
91
|
+
@include hover {
|
|
92
|
+
color: getCssVar('color', 'fill', 'blank');
|
|
93
|
+
background-color: getCssVar('color', $type, 'base');
|
|
94
|
+
border-color: getCssVar('color', $type, 'base');
|
|
95
|
+
}
|
|
96
|
+
@include is('disabled') {
|
|
97
|
+
background-color: if(
|
|
98
|
+
$type != '',
|
|
99
|
+
getCssVar('color', $type, 'shade-1'),
|
|
100
|
+
getCssVar('color', 'fill', 'blank')
|
|
101
|
+
);
|
|
102
|
+
color: if(
|
|
103
|
+
$type != '',
|
|
104
|
+
getCssVar('color', $type, 'shade-4'),
|
|
105
|
+
getCssVar('color', 'text', 'disabled')
|
|
106
|
+
);
|
|
107
|
+
border-color: if(
|
|
108
|
+
$type != '',
|
|
109
|
+
getCssVar('color', $type, 'shade-4'),
|
|
110
|
+
getCssVar('color', 'border', 'shade-4')
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include is('loading') {
|
|
117
|
+
&:before {
|
|
118
|
+
z-index: 1;
|
|
119
|
+
content: '';
|
|
120
|
+
position: absolute;
|
|
121
|
+
top: -1px;
|
|
122
|
+
left: -1px;
|
|
123
|
+
right: -1px;
|
|
124
|
+
bottom: -1px;
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
border-radius: inherit;
|
|
127
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@mixin button-modifier-style($button, $type) {
|
|
133
|
+
@if $type != '' {
|
|
134
|
+
&--#{$type} {
|
|
135
|
+
@include button-modifier($button, $type);
|
|
136
|
+
}
|
|
137
|
+
} @else {
|
|
138
|
+
@include button-modifier($button, $type);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@use '../function/index' as *;
|
|
2
|
+
|
|
3
|
+
@mixin buildCls($name) {
|
|
4
|
+
@at-root {
|
|
5
|
+
.#{getNamespace('prefix') + '-' + $name} {
|
|
6
|
+
@content;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@mixin is($state) {
|
|
12
|
+
&.#{getNamespace('statePrefix') + '-' + $state} {
|
|
13
|
+
@content;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@mixin hover() {
|
|
18
|
+
&:hover:not(.is-disabled) {
|
|
19
|
+
@content;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@mixin set-css-var($name, $value) {
|
|
24
|
+
#{getCssVarStr($name)}: #{$value};
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'css-vars/_colors' as *;
|
|
3
|
+
@use 'function/index' as *;
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
#{getCssVarStr('color', 'primary')}: #{map.get($colors, 'primary', 'base')};
|
|
7
|
+
|
|
8
|
+
@each $color-name, $shades in $colors {
|
|
9
|
+
@each $shade-name, $shade-value in $shades {
|
|
10
|
+
#{getCssVarStr('color')}-#{$color-name}-#{''+$shade-name}: #{$shade-value};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|