ep-craft 0.1.2 → 0.1.3

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.
Files changed (154) hide show
  1. package/dist/components/button/EpButton.vue.d.ts +4 -4
  2. package/dist/components/button/EpButton.vue.js +19 -19
  3. package/dist/components/button/button.d.ts +2 -2
  4. package/dist/components/button/button.js +1 -1
  5. package/dist/components/button/index.d.ts +2 -1
  6. package/dist/components/button/index.js +4 -3
  7. package/dist/index.css +2 -2
  8. package/dist/resolver.js +9 -12
  9. package/package.json +4 -2
  10. package/theme-chalk/src/affix.scss +7 -0
  11. package/theme-chalk/src/alert.scss +115 -0
  12. package/theme-chalk/src/anchor-link.scss +45 -0
  13. package/theme-chalk/src/anchor.scss +93 -0
  14. package/theme-chalk/src/aside.scss +8 -0
  15. package/theme-chalk/src/autocomplete.scss +95 -0
  16. package/theme-chalk/src/avatar-group.scss +25 -0
  17. package/theme-chalk/src/avatar.scss +55 -0
  18. package/theme-chalk/src/backtop.scss +29 -0
  19. package/theme-chalk/src/badge.scss +58 -0
  20. package/theme-chalk/src/base.scss +3 -0
  21. package/theme-chalk/src/breadcrumb-item.scss +58 -0
  22. package/theme-chalk/src/breadcrumb.scss +9 -0
  23. package/theme-chalk/src/button-group.scss +133 -0
  24. package/theme-chalk/src/button.scss +325 -0
  25. package/theme-chalk/src/calendar.scss +94 -0
  26. package/theme-chalk/src/card.scss +49 -0
  27. package/theme-chalk/src/carousel-item.scss +58 -0
  28. package/theme-chalk/src/carousel.scss +195 -0
  29. package/theme-chalk/src/cascader-panel.scss +150 -0
  30. package/theme-chalk/src/cascader.scss +289 -0
  31. package/theme-chalk/src/check-tag.scss +60 -0
  32. package/theme-chalk/src/checkbox-button.scss +142 -0
  33. package/theme-chalk/src/checkbox-group.scss +7 -0
  34. package/theme-chalk/src/checkbox.scss +300 -0
  35. package/theme-chalk/src/col.scss +56 -0
  36. package/theme-chalk/src/collapse-item.scss +72 -0
  37. package/theme-chalk/src/collapse-transition.scss +1 -0
  38. package/theme-chalk/src/collapse.scss +29 -0
  39. package/theme-chalk/src/color/index.scss +20 -0
  40. package/theme-chalk/src/color-picker-panel.scss +294 -0
  41. package/theme-chalk/src/color-picker.scss +165 -0
  42. package/theme-chalk/src/common/popup.scss +47 -0
  43. package/theme-chalk/src/common/transition.scss +125 -0
  44. package/theme-chalk/src/common/var.scss +1730 -0
  45. package/theme-chalk/src/config-provider.scss +0 -0
  46. package/theme-chalk/src/container.scss +14 -0
  47. package/theme-chalk/src/dark/css-vars.scss +45 -0
  48. package/theme-chalk/src/dark/var.scss +224 -0
  49. package/theme-chalk/src/date-picker/date-picker.scss +121 -0
  50. package/theme-chalk/src/date-picker/date-range-picker.scss +165 -0
  51. package/theme-chalk/src/date-picker/date-table.scss +164 -0
  52. package/theme-chalk/src/date-picker/month-table.scss +112 -0
  53. package/theme-chalk/src/date-picker/picker-panel.scss +152 -0
  54. package/theme-chalk/src/date-picker/picker.scss +217 -0
  55. package/theme-chalk/src/date-picker/time-picker.scss +90 -0
  56. package/theme-chalk/src/date-picker/time-range-picker.scss +33 -0
  57. package/theme-chalk/src/date-picker/time-spinner.scss +115 -0
  58. package/theme-chalk/src/date-picker/utils.scss +14 -0
  59. package/theme-chalk/src/date-picker/year-table.scss +108 -0
  60. package/theme-chalk/src/date-picker-panel.scss +34 -0
  61. package/theme-chalk/src/date-picker.scss +0 -0
  62. package/theme-chalk/src/descriptions-item.scss +77 -0
  63. package/theme-chalk/src/descriptions.scss +151 -0
  64. package/theme-chalk/src/dialog.scss +207 -0
  65. package/theme-chalk/src/display.scss +12 -0
  66. package/theme-chalk/src/divider.scss +48 -0
  67. package/theme-chalk/src/drawer.scss +251 -0
  68. package/theme-chalk/src/dropdown-item.scss +0 -0
  69. package/theme-chalk/src/dropdown-menu.scss +0 -0
  70. package/theme-chalk/src/dropdown.scss +208 -0
  71. package/theme-chalk/src/empty.scss +49 -0
  72. package/theme-chalk/src/footer.scss +12 -0
  73. package/theme-chalk/src/form-item.scss +246 -0
  74. package/theme-chalk/src/form.scss +28 -0
  75. package/theme-chalk/src/header.scss +12 -0
  76. package/theme-chalk/src/icon.scss +41 -0
  77. package/theme-chalk/src/image-viewer.scss +161 -0
  78. package/theme-chalk/src/image.scss +49 -0
  79. package/theme-chalk/src/index.scss +116 -0
  80. package/theme-chalk/src/infinite-scroll.scss +0 -0
  81. package/theme-chalk/src/input-number.scss +192 -0
  82. package/theme-chalk/src/input-otp.scss +191 -0
  83. package/theme-chalk/src/input-tag.scss +249 -0
  84. package/theme-chalk/src/input.scss +541 -0
  85. package/theme-chalk/src/link.scss +90 -0
  86. package/theme-chalk/src/loading.scss +104 -0
  87. package/theme-chalk/src/main.scss +14 -0
  88. package/theme-chalk/src/mention.scss +88 -0
  89. package/theme-chalk/src/menu-item-group.scss +0 -0
  90. package/theme-chalk/src/menu-item.scss +0 -0
  91. package/theme-chalk/src/menu.scss +376 -0
  92. package/theme-chalk/src/message-box.scss +220 -0
  93. package/theme-chalk/src/message.scss +123 -0
  94. package/theme-chalk/src/mixins/_button.scss +240 -0
  95. package/theme-chalk/src/mixins/_col.scss +41 -0
  96. package/theme-chalk/src/mixins/_var.scss +67 -0
  97. package/theme-chalk/src/mixins/config.scss +5 -0
  98. package/theme-chalk/src/mixins/function.scss +99 -0
  99. package/theme-chalk/src/mixins/mixins.scss +257 -0
  100. package/theme-chalk/src/mixins/utils.scss +39 -0
  101. package/theme-chalk/src/notification.scss +109 -0
  102. package/theme-chalk/src/option-group.scss +33 -0
  103. package/theme-chalk/src/option.scss +71 -0
  104. package/theme-chalk/src/overlay.scss +17 -0
  105. package/theme-chalk/src/page-header.scss +60 -0
  106. package/theme-chalk/src/pagination.scss +235 -0
  107. package/theme-chalk/src/popconfirm.scss +17 -0
  108. package/theme-chalk/src/popover.scss +61 -0
  109. package/theme-chalk/src/popper.scss +117 -0
  110. package/theme-chalk/src/progress.scss +179 -0
  111. package/theme-chalk/src/radio-button.scss +165 -0
  112. package/theme-chalk/src/radio-group.scss +9 -0
  113. package/theme-chalk/src/radio.scss +220 -0
  114. package/theme-chalk/src/rate.scss +121 -0
  115. package/theme-chalk/src/reset.scss +99 -0
  116. package/theme-chalk/src/result.scss +57 -0
  117. package/theme-chalk/src/row.scss +34 -0
  118. package/theme-chalk/src/scrollbar.scss +97 -0
  119. package/theme-chalk/src/segmented.scss +186 -0
  120. package/theme-chalk/src/select-dropdown-v2.scss +1 -0
  121. package/theme-chalk/src/select-dropdown.scss +57 -0
  122. package/theme-chalk/src/select-v2.scss +4 -0
  123. package/theme-chalk/src/select.scss +269 -0
  124. package/theme-chalk/src/skeleton-item.scss +83 -0
  125. package/theme-chalk/src/skeleton.scss +44 -0
  126. package/theme-chalk/src/slider.scss +212 -0
  127. package/theme-chalk/src/space.scss +20 -0
  128. package/theme-chalk/src/spinner.scss +43 -0
  129. package/theme-chalk/src/splitter-panel.scss +8 -0
  130. package/theme-chalk/src/splitter.scss +148 -0
  131. package/theme-chalk/src/statistic.scss +35 -0
  132. package/theme-chalk/src/step.scss +320 -0
  133. package/theme-chalk/src/steps.scss +22 -0
  134. package/theme-chalk/src/sub-menu.scss +0 -0
  135. package/theme-chalk/src/switch.scss +294 -0
  136. package/theme-chalk/src/tab-pane.scss +0 -0
  137. package/theme-chalk/src/table-column.scss +100 -0
  138. package/theme-chalk/src/table-v2.scss +239 -0
  139. package/theme-chalk/src/table.scss +698 -0
  140. package/theme-chalk/src/tabs.scss +699 -0
  141. package/theme-chalk/src/tag.scss +195 -0
  142. package/theme-chalk/src/text.scss +51 -0
  143. package/theme-chalk/src/time-picker.scss +5 -0
  144. package/theme-chalk/src/time-select.scss +37 -0
  145. package/theme-chalk/src/timeline-item.scss +135 -0
  146. package/theme-chalk/src/timeline.scss +101 -0
  147. package/theme-chalk/src/tooltip.scss +0 -0
  148. package/theme-chalk/src/tour.scss +187 -0
  149. package/theme-chalk/src/transfer.scss +201 -0
  150. package/theme-chalk/src/tree-select.scss +41 -0
  151. package/theme-chalk/src/tree.scss +134 -0
  152. package/theme-chalk/src/upload.scss +660 -0
  153. package/theme-chalk/src/var.scss +87 -0
  154. package/theme-chalk/src/virtual-list.scss +40 -0
@@ -0,0 +1,123 @@
1
+ @use 'mixins/mixins' as *;
2
+ @use 'mixins/var' as *;
3
+ @use 'common/var' as *;
4
+
5
+ @include b(message) {
6
+ @include set-component-css-var('message', $message);
7
+ }
8
+
9
+ @include b(message) {
10
+ width: max-content;
11
+ max-width: calc(100% - 32px);
12
+ box-sizing: border-box;
13
+ border-radius: getCssVar('border-radius-base');
14
+ border-width: getCssVar('border-width');
15
+ border-style: getCssVar('border-style');
16
+ border-color: getCssVar('message', 'border-color');
17
+ position: fixed;
18
+ background-color: getCssVar('message', 'bg-color');
19
+ transition:
20
+ opacity getCssVar('transition-duration'),
21
+ transform 0.4s,
22
+ top 0.4s,
23
+ bottom 0.4s;
24
+ padding: getCssVar('message', 'padding');
25
+ display: flex;
26
+ align-items: center;
27
+ gap: 8px;
28
+
29
+ &.is-left {
30
+ left: 16px;
31
+ }
32
+
33
+ &.is-right {
34
+ right: 16px;
35
+ }
36
+
37
+ &.is-center {
38
+ left: 50%;
39
+ transform: translateX(-50%);
40
+ }
41
+
42
+ @include when(plain) {
43
+ background-color: getCssVar('bg-color', 'overlay');
44
+ border-color: getCssVar('bg-color', 'overlay');
45
+ box-shadow: getCssVar('box-shadow-light');
46
+ }
47
+
48
+ p {
49
+ margin: 0;
50
+ }
51
+
52
+ @each $type in (primary, success, info, warning, error) {
53
+ @include m($type) {
54
+ @include css-var-from-global(
55
+ ('message', 'bg-color'),
56
+ ('color', $type, 'light-9')
57
+ );
58
+ @include css-var-from-global(
59
+ ('message', 'border-color'),
60
+ ('color', $type, 'light-8')
61
+ );
62
+ @include css-var-from-global(('message', 'text-color'), ('color', $type));
63
+
64
+ .#{$namespace}-message__content {
65
+ color: getCssVar('message', 'text-color');
66
+ overflow-wrap: break-word;
67
+ }
68
+ }
69
+
70
+ & .#{$namespace}-message-icon--#{$type} {
71
+ color: getCssVar('message', 'text-color');
72
+ }
73
+ }
74
+
75
+ .#{$namespace}-message__badge {
76
+ position: absolute;
77
+ top: -8px;
78
+ right: -8px;
79
+ }
80
+
81
+ @include e(content) {
82
+ padding: 0;
83
+ font-size: 14px;
84
+ line-height: 1;
85
+ &:focus {
86
+ outline-width: 0;
87
+ }
88
+ }
89
+
90
+ & .#{$namespace}-message__closeBtn {
91
+ cursor: pointer;
92
+ color: getCssVar('message', 'close-icon-color');
93
+ font-size: getCssVar('message', 'close-size');
94
+
95
+ &:focus {
96
+ outline-width: 0;
97
+ }
98
+ &:hover {
99
+ color: getCssVar('message', 'close-hover-color');
100
+ }
101
+ }
102
+ }
103
+
104
+ .#{$namespace}-message-fade-enter-from,
105
+ .#{$namespace}-message-fade-leave-to {
106
+ opacity: 0;
107
+ &.is-left,
108
+ &.is-right {
109
+ transform: translateY(-100%);
110
+
111
+ &.is-bottom {
112
+ transform: translateY(100%);
113
+ }
114
+ }
115
+
116
+ &.is-center {
117
+ transform: translate(-50%, -100%);
118
+
119
+ &.is-bottom {
120
+ transform: translate(-50%, 100%);
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,240 @@
1
+ @use '../mixins/var' as *;
2
+ @use '../mixins/function' as *;
3
+ @use '../common/var' as *;
4
+
5
+ @mixin button-plain($type) {
6
+ $button-color-types: (
7
+ '': (
8
+ 'text-color': (
9
+ 'color',
10
+ $type,
11
+ ),
12
+ 'bg-color': (
13
+ 'color',
14
+ $type,
15
+ 'light-9',
16
+ ),
17
+ 'border-color': (
18
+ 'color',
19
+ $type,
20
+ 'light-5',
21
+ ),
22
+ ),
23
+ 'hover': (
24
+ 'text-color': (
25
+ 'color',
26
+ 'white',
27
+ ),
28
+ 'bg-color': (
29
+ 'color',
30
+ $type,
31
+ ),
32
+ 'border-color': (
33
+ 'color',
34
+ $type,
35
+ ),
36
+ ),
37
+ 'active': (
38
+ 'text-color': (
39
+ 'color',
40
+ 'white',
41
+ ),
42
+ ),
43
+ );
44
+
45
+ @each $type, $typeMap in $button-color-types {
46
+ @each $typeColor, $list in $typeMap {
47
+ @include css-var-from-global(('button', $type, $typeColor), $list);
48
+ }
49
+ }
50
+
51
+ &.is-disabled {
52
+ &,
53
+ &:hover,
54
+ &:focus,
55
+ &:active {
56
+ color: getCssVar('color', $type, 'light-5');
57
+ background-color: getCssVar('color', $type, 'light-9');
58
+ border-color: getCssVar('color', $type, 'light-8');
59
+ }
60
+ }
61
+ }
62
+
63
+ @mixin button-dashed($type) {
64
+ $button-color-types: (
65
+ '': (
66
+ 'text-color': (
67
+ 'color',
68
+ $type,
69
+ ),
70
+ 'bg-color': (
71
+ 'color',
72
+ $type,
73
+ 'light-9',
74
+ ),
75
+ 'border-color': (
76
+ 'color',
77
+ $type,
78
+ 'light-5',
79
+ ),
80
+ ),
81
+ 'hover': (
82
+ 'text-color': (
83
+ 'color',
84
+ $type,
85
+ ),
86
+ 'bg-color': (
87
+ 'color',
88
+ $type,
89
+ 'light-9',
90
+ ),
91
+ 'border-color': (
92
+ 'color',
93
+ $type,
94
+ 'light-3',
95
+ ),
96
+ ),
97
+ 'active': (
98
+ 'text-color': (
99
+ 'color',
100
+ $type,
101
+ 'dark-2',
102
+ ),
103
+ 'bg-color': (
104
+ 'color',
105
+ $type,
106
+ 'light-9',
107
+ ),
108
+ 'border-color': (
109
+ 'color',
110
+ $type,
111
+ 'dark-2',
112
+ ),
113
+ ),
114
+ );
115
+
116
+ @each $type, $typeMap in $button-color-types {
117
+ @each $typeColor, $list in $typeMap {
118
+ @include css-var-from-global(('button', $type, $typeColor), $list);
119
+ }
120
+ }
121
+
122
+ &.is-disabled {
123
+ &,
124
+ &:hover,
125
+ &:focus,
126
+ &:active {
127
+ color: getCssVar('color', $type, 'light-5');
128
+ background-color: getCssVar('color', $type, 'light-9');
129
+ border-color: getCssVar('color', $type, 'light-8');
130
+ }
131
+ }
132
+ }
133
+
134
+ @mixin button-variant($type) {
135
+ $button-color-types: (
136
+ '': (
137
+ 'text-color': (
138
+ 'color',
139
+ 'white',
140
+ ),
141
+ 'bg-color': (
142
+ 'color',
143
+ $type,
144
+ ),
145
+ 'border-color': (
146
+ 'color',
147
+ $type,
148
+ ),
149
+ 'outline-color': (
150
+ 'color',
151
+ $type,
152
+ 'light-5',
153
+ ),
154
+ 'active-color': (
155
+ 'color',
156
+ $type,
157
+ 'dark-2',
158
+ ),
159
+ ),
160
+ 'hover': (
161
+ 'text-color': (
162
+ 'color',
163
+ 'white',
164
+ ),
165
+ 'link-text-color': (
166
+ 'color',
167
+ $type,
168
+ 'light-5',
169
+ ),
170
+ 'bg-color': (
171
+ 'color',
172
+ $type,
173
+ 'light-3',
174
+ ),
175
+ 'border-color': (
176
+ 'color',
177
+ $type,
178
+ 'light-3',
179
+ ),
180
+ ),
181
+ 'active': (
182
+ 'bg-color': (
183
+ 'color',
184
+ $type,
185
+ 'dark-2',
186
+ ),
187
+ 'border-color': (
188
+ 'color',
189
+ $type,
190
+ 'dark-2',
191
+ ),
192
+ ),
193
+ 'disabled': (
194
+ 'text-color': (
195
+ 'color',
196
+ 'white',
197
+ ),
198
+ 'bg-color': (
199
+ 'color',
200
+ $type,
201
+ 'light-5',
202
+ ),
203
+ 'border-color': (
204
+ 'color',
205
+ $type,
206
+ 'light-5',
207
+ ),
208
+ ),
209
+ );
210
+
211
+ @each $type, $typeMap in $button-color-types {
212
+ @each $typeColor, $list in $typeMap {
213
+ @include css-var-from-global(('button', $type, $typeColor), $list);
214
+ }
215
+ }
216
+
217
+ &.is-plain,
218
+ &.is-text,
219
+ &.is-link {
220
+ @include button-plain($type);
221
+ }
222
+
223
+ &.is-dashed {
224
+ @include button-dashed($type);
225
+ }
226
+ }
227
+
228
+ @mixin button-size(
229
+ $padding-vertical,
230
+ $padding-horizontal,
231
+ $font-size,
232
+ $border-radius
233
+ ) {
234
+ padding: $padding-vertical $padding-horizontal;
235
+ font-size: $font-size;
236
+ border-radius: $border-radius;
237
+ &.is-round {
238
+ padding: $padding-vertical $padding-horizontal;
239
+ }
240
+ }
@@ -0,0 +1,41 @@
1
+ @use 'sass:math';
2
+
3
+ @use '../common/var' as *;
4
+ @use './mixins' as *;
5
+
6
+ @mixin col-size($size) {
7
+ @include res($size) {
8
+ @for $i from 0 through 24 {
9
+ .#{$namespace}-col-#{$size}-#{$i} {
10
+ @if $i == 0 {
11
+ display: none;
12
+ } @else {
13
+ display: block;
14
+ }
15
+ max-width: (math.div(1, 24) * $i * 100) * 1%;
16
+ flex: 0 0 (math.div(1, 24) * $i * 100) * 1%;
17
+ @include when(guttered) {
18
+ @if $i == 0 {
19
+ display: none;
20
+ } @else {
21
+ display: block;
22
+ }
23
+ }
24
+ }
25
+
26
+ .#{$namespace}-col-#{$size}-offset-#{$i} {
27
+ margin-left: (math.div(1, 24) * $i * 100) * 1%;
28
+ }
29
+
30
+ .#{$namespace}-col-#{$size}-pull-#{$i} {
31
+ position: relative;
32
+ right: (math.div(1, 24) * $i * 100) * 1%;
33
+ }
34
+
35
+ .#{$namespace}-col-#{$size}-push-#{$i} {
36
+ position: relative;
37
+ left: (math.div(1, 24) * $i * 100) * 1%;
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,67 @@
1
+ @use 'sass:map';
2
+ @use 'sass:color';
3
+
4
+ @use 'config';
5
+ @use 'function' as *;
6
+ @use '../common/var' as *;
7
+
8
+ // set css var value, because we need translate value to string
9
+ // for example:
10
+ // @include set-css-var-value(('color', 'primary'), red);
11
+ // --el-color-primary: red;
12
+ @mixin set-css-var-value($name, $value) {
13
+ #{joinVarName($name)}: #{$value};
14
+ }
15
+
16
+ // @include set-css-var-type('color', 'primary', $map);
17
+ // --el-color-primary: #{map.get($map, 'primary')};
18
+ @mixin set-css-var-type($name, $type, $variables) {
19
+ #{getCssVarName($name, $type)}: #{map.get($variables, $type)};
20
+ }
21
+
22
+ @mixin set-css-color-type($colors, $type) {
23
+ @include set-css-var-value(('color', $type), map.get($colors, $type, 'base'));
24
+
25
+ @each $i in (3, 5, 7, 8, 9) {
26
+ @include set-css-var-value(
27
+ ('color', $type, 'light', $i),
28
+ map.get($colors, $type, 'light-#{$i}')
29
+ );
30
+ }
31
+
32
+ @include set-css-var-value(
33
+ ('color', $type, 'dark-2'),
34
+ map.get($colors, $type, 'dark-2')
35
+ );
36
+ }
37
+
38
+ // set all css var for component by map
39
+ @mixin set-component-css-var($name, $variables) {
40
+ @each $attribute, $value in $variables {
41
+ @if $attribute == 'default' {
42
+ #{getCssVarName($name)}: #{$value};
43
+ } @else {
44
+ #{getCssVarName($name, $attribute)}: #{$value};
45
+ }
46
+ }
47
+ }
48
+
49
+ @mixin set-css-color-rgb($type) {
50
+ $color: map.get($colors, $type, 'base');
51
+ @include set-css-var-value(
52
+ ('color', $type, 'rgb'),
53
+ #{color.channel($color, 'red', $space: rgb),
54
+ color.channel($color, 'green', $space: rgb),
55
+ color.channel($color, 'blue', $space: rgb)}
56
+ );
57
+ }
58
+
59
+ // generate css var from existing css var
60
+ // for example:
61
+ // @include css-var-from-global(('button', 'text-color'), ('color', $type))
62
+ // --el-button-text-color: var(--el-color-#{$type});
63
+ @mixin css-var-from-global($var, $gVar) {
64
+ $varName: joinVarName($var);
65
+ $gVarName: joinVarName($gVar);
66
+ #{$varName}: var(#{$gVarName});
67
+ }
@@ -0,0 +1,5 @@
1
+ $namespace: 'el' !default;
2
+ $common-separator: '-' !default;
3
+ $element-separator: '__' !default;
4
+ $modifier-separator: '--' !default;
5
+ $state-prefix: 'is-' !default;
@@ -0,0 +1,99 @@
1
+ @use 'config';
2
+ @use 'sass:meta';
3
+ @use 'sass:string';
4
+ @use 'sass:math';
5
+ @use 'sass:color';
6
+
7
+ // BEM support Func
8
+ @function selectorToString($selector) {
9
+ $selector: meta.inspect($selector);
10
+ $selector: string.slice($selector, 2, -2);
11
+ @return $selector;
12
+ }
13
+
14
+ @function containsModifier($selector) {
15
+ $selector: selectorToString($selector);
16
+
17
+ @if string.index($selector, config.$modifier-separator) {
18
+ @return true;
19
+ } @else {
20
+ @return false;
21
+ }
22
+ }
23
+
24
+ @function containWhenFlag($selector) {
25
+ $selector: selectorToString($selector);
26
+
27
+ @if string.index($selector, '.' + config.$state-prefix) {
28
+ @return true;
29
+ } @else {
30
+ @return false;
31
+ }
32
+ }
33
+
34
+ @function containPseudoClass($selector) {
35
+ $selector: selectorToString($selector);
36
+
37
+ @if string.index($selector, ':') {
38
+ @return true;
39
+ } @else {
40
+ @return false;
41
+ }
42
+ }
43
+
44
+ @function hitAllSpecialNestRule($selector) {
45
+ @return containsModifier($selector) or containWhenFlag($selector) or
46
+ containPseudoClass($selector);
47
+ }
48
+
49
+ // join var name
50
+ // joinVarName(('button', 'text-color')) => '--el-button-text-color'
51
+ @function joinVarName($list) {
52
+ $name: '--' + config.$namespace;
53
+ @each $item in $list {
54
+ @if $item != '' {
55
+ $name: $name + '-' + $item;
56
+ }
57
+ }
58
+ @return $name;
59
+ }
60
+
61
+ // getCssVarName('button', 'text-color') => '--el-button-text-color'
62
+ @function getCssVarName($args...) {
63
+ @return joinVarName($args);
64
+ }
65
+
66
+ // getCssVar('button', 'text-color') => var(--el-button-text-color)
67
+ @function getCssVar($args...) {
68
+ @return var(#{joinVarName($args)});
69
+ }
70
+
71
+ // getCssVarWithDefault(('button', 'text-color'), red) => var(--el-button-text-color, red)
72
+ @function getCssVarWithDefault($args, $default) {
73
+ @return var(#{joinVarName($args)}, #{$default});
74
+ }
75
+
76
+ // bem('block', 'element', 'modifier') => 'el-block__element--modifier'
77
+ @function bem($block, $element: '', $modifier: '') {
78
+ $name: config.$namespace + config.$common-separator + $block;
79
+
80
+ @if $element != '' {
81
+ $name: $name + config.$element-separator + $element;
82
+ }
83
+
84
+ @if $modifier != '' {
85
+ $name: $name + config.$modifier-separator + $modifier;
86
+ }
87
+
88
+ // @debug $name;
89
+ @return $name;
90
+ }
91
+
92
+ @function roundColor($color) {
93
+ $r: math.round(color.channel($color, 'red'));
94
+ $g: math.round(color.channel($color, 'green'));
95
+ $b: math.round(color.channel($color, 'blue'));
96
+ $a: color.channel($color, 'alpha');
97
+
98
+ @return rgba($r, $g, $b, $a);
99
+ }