@cyberpunk-vue/theme-chalk 1.14.0 → 1.14.2

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 (47) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.css.map +1 -1
  3. package/package.json +1 -1
  4. package/src/common/var.scss +247 -247
  5. package/src/components/avatar-group.scss +113 -113
  6. package/src/components/avatar.scss +123 -123
  7. package/src/components/badge.scss +210 -210
  8. package/src/components/breadcrumb.scss +203 -203
  9. package/src/components/button.scss +975 -975
  10. package/src/components/card.scss +699 -696
  11. package/src/components/checkbox-group.scss +22 -22
  12. package/src/components/checkbox.scss +320 -320
  13. package/src/components/col.scss +43 -43
  14. package/src/components/dialog.scss +360 -360
  15. package/src/components/divider.scss +250 -250
  16. package/src/components/empty.scss +99 -99
  17. package/src/components/form-item.scss +189 -189
  18. package/src/components/form.scss +59 -59
  19. package/src/components/icon.scss +83 -83
  20. package/src/components/image-preview.scss +147 -147
  21. package/src/components/image.scss +351 -351
  22. package/src/components/input-number.scss +129 -129
  23. package/src/components/input.scss +362 -362
  24. package/src/components/loading.scss +64 -64
  25. package/src/components/notification.scss +348 -348
  26. package/src/components/pagination.scss +287 -280
  27. package/src/components/pattern-background.scss +18 -18
  28. package/src/components/popover.scss +438 -438
  29. package/src/components/progress.scss +438 -438
  30. package/src/components/radio-group.scss +22 -22
  31. package/src/components/radio.scss +286 -286
  32. package/src/components/row.scss +12 -12
  33. package/src/components/scrollbar.scss +40 -40
  34. package/src/components/segmented.scss +566 -566
  35. package/src/components/select.scss +15 -1
  36. package/src/components/slider.scss +421 -421
  37. package/src/components/status-indicator.scss +206 -206
  38. package/src/components/switch.scss +405 -405
  39. package/src/components/table.scss +474 -474
  40. package/src/components/tag.scss +416 -416
  41. package/src/components/text.scss +310 -271
  42. package/src/components/textarea.scss +106 -104
  43. package/src/components/timeline.scss +379 -379
  44. package/src/components/tree.scss +397 -397
  45. package/src/components/upload.scss +509 -509
  46. package/src/index.scss +60 -60
  47. package/src/mixins/mixins.scss +156 -156
@@ -1,107 +1,107 @@
1
- // CpSwitch 组件样式
2
- // 赛博朋克/机甲风格 - 升级版
3
-
4
- @use 'sass:map';
5
- @use '../common/var' as *;
6
- @use '../mixins/mixins' as *;
7
-
8
- // Switch 变量
9
- $switch-sizes: (
10
- sm: (
11
- height: 20px, // 稍微增高以容纳细节
12
- width: 36px,
13
- thumb: 16px,
14
- clip: 4px,
15
- font-size: 10px,
16
- padding: 2px,
17
- ),
18
- md: (
19
- height: 24px,
20
- width: 44px,
21
- thumb: 20px,
22
- clip: 5px,
23
- font-size: 12px,
24
- padding: 2px,
25
- ),
26
- lg: (
27
- height: 28px,
28
- width: 56px,
29
- thumb: 24px,
30
- clip: 6px,
31
- font-size: 13px,
32
- padding: 2px,
33
- ),
34
- );
35
-
1
+ // CpSwitch 组件样式
2
+ // 赛博朋克/机甲风格 - 升级版
3
+
4
+ @use 'sass:map';
5
+ @use '../common/var' as *;
6
+ @use '../mixins/mixins' as *;
7
+
8
+ // Switch 变量
9
+ $switch-sizes: (
10
+ sm: (
11
+ height: 20px, // 稍微增高以容纳细节
12
+ width: 36px,
13
+ thumb: 16px,
14
+ clip: 4px,
15
+ font-size: 10px,
16
+ padding: 2px,
17
+ ),
18
+ md: (
19
+ height: 24px,
20
+ width: 44px,
21
+ thumb: 20px,
22
+ clip: 5px,
23
+ font-size: 12px,
24
+ padding: 2px,
25
+ ),
26
+ lg: (
27
+ height: 28px,
28
+ width: 56px,
29
+ thumb: 24px,
30
+ clip: 6px,
31
+ font-size: 13px,
32
+ padding: 2px,
33
+ ),
34
+ );
35
+
36
36
  @include b(switch) {
37
- // 基础样式
38
- position: relative;
37
+ // 基础样式
38
+ position: relative;
39
39
  display: inline-flex;
40
40
  align-items: center;
41
41
  gap: var(--cp-spacing-sm);
42
42
  cursor: pointer;
43
43
  user-select: none;
44
44
  vertical-align: middle;
45
-
46
- // CSS 变量
47
- --cp-switch-active-color: var(--cp-color-primary);
48
- --cp-switch-active-color-light: var(--cp-color-primary-light);
49
- --cp-switch-inactive-color: var(--cp-border);
50
- --cp-switch-bg-color: color-mix(in srgb, var(--cp-bg-deep) 80%, transparent);
51
- --cp-switch-text-color: var(--cp-text-inverse);
52
-
53
- // ===== 隐藏原生 input =====
54
- @include e(input) {
55
- position: absolute;
56
- width: 0;
57
- height: 0;
58
- opacity: 0;
59
- margin: 0;
60
- }
61
-
62
- // ===== 轨道 =====
63
- @include e(track) {
64
- position: relative;
65
- display: flex;
66
- align-items: center;
67
- background: var(--cp-switch-bg-color);
68
- border: 1px solid var(--cp-switch-inactive-color);
69
- border-radius: 2px; // 轻微圆角配合切角
70
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
71
- overflow: hidden;
72
-
73
- // 纹理叠加
74
- &::before {
75
- content: '';
76
- position: absolute;
77
- top: 0;
78
- left: 0;
79
- width: 100%;
80
- height: 100%;
81
- background-image: repeating-linear-gradient(
82
- 45deg,
83
- transparent,
84
- transparent 2px,
85
- rgba(255, 255, 255, 0.03) 2px,
86
- rgba(255, 255, 255, 0.03) 4px
87
- );
88
- z-index: 0;
89
- }
90
-
91
- // 装饰性细节 (角落光标)
92
- &::after {
93
- content: '';
94
- position: absolute;
95
- top: -1px;
96
- right: -1px;
97
- width: 6px;
98
- height: 6px;
99
- background: transparent;
100
- border-top: 1px solid var(--cp-switch-inactive-color);
101
- border-right: 1px solid var(--cp-switch-inactive-color);
102
- clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0); // 三角形
103
- z-index: 2;
104
- transition: all 0.3s ease;
45
+
46
+ // CSS 变量
47
+ --cp-switch-active-color: var(--cp-color-primary);
48
+ --cp-switch-active-color-light: var(--cp-color-primary-light);
49
+ --cp-switch-inactive-color: var(--cp-border);
50
+ --cp-switch-bg-color: color-mix(in srgb, var(--cp-bg-deep) 80%, transparent);
51
+ --cp-switch-text-color: var(--cp-text-inverse);
52
+
53
+ // ===== 隐藏原生 input =====
54
+ @include e(input) {
55
+ position: absolute;
56
+ width: 0;
57
+ height: 0;
58
+ opacity: 0;
59
+ margin: 0;
60
+ }
61
+
62
+ // ===== 轨道 =====
63
+ @include e(track) {
64
+ position: relative;
65
+ display: flex;
66
+ align-items: center;
67
+ background: var(--cp-switch-bg-color);
68
+ border: 1px solid var(--cp-switch-inactive-color);
69
+ border-radius: 2px; // 轻微圆角配合切角
70
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
71
+ overflow: hidden;
72
+
73
+ // 纹理叠加
74
+ &::before {
75
+ content: '';
76
+ position: absolute;
77
+ top: 0;
78
+ left: 0;
79
+ width: 100%;
80
+ height: 100%;
81
+ background-image: repeating-linear-gradient(
82
+ 45deg,
83
+ transparent,
84
+ transparent 2px,
85
+ rgba(255, 255, 255, 0.03) 2px,
86
+ rgba(255, 255, 255, 0.03) 4px
87
+ );
88
+ z-index: 0;
89
+ }
90
+
91
+ // 装饰性细节 (角落光标)
92
+ &::after {
93
+ content: '';
94
+ position: absolute;
95
+ top: -1px;
96
+ right: -1px;
97
+ width: 6px;
98
+ height: 6px;
99
+ background: transparent;
100
+ border-top: 1px solid var(--cp-switch-inactive-color);
101
+ border-right: 1px solid var(--cp-switch-inactive-color);
102
+ clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0); // 三角形
103
+ z-index: 2;
104
+ transition: all 0.3s ease;
105
105
  }
106
106
  }
107
107
 
@@ -153,317 +153,317 @@ $switch-sizes: (
153
153
 
154
154
  // ===== Wrapper (Fit Text 占位) =====
155
155
  // 仅在 fit-text 模式下有内容撑开
156
- @include e(wrapper) {
157
- display: flex;
158
- align-items: center;
159
- justify-content: center;
160
- opacity: 0;
161
- visibility: hidden;
162
- height: 100%;
163
- pointer-events: none;
164
-
165
- .wrapper-text {
166
- padding: 0 8px; // 边距
167
- font-family: var(--cp-font-family-ui);
168
- font-weight: 600;
169
- white-space: nowrap;
170
-
171
- // 同时渲染两个文本,取最宽的一个撑开容器
172
- &.inactive {
173
- display: none; // 如果不想都显示,至少要让最宽的那个生效。
174
- // 简单起见,如果 fit-text 开启,我们让 .active 和 .inactive 叠加?
175
- // 为了简单,这里简单处理:并排会导致过宽。
176
- // 应该 absolute 叠加取最大宽,或者 JS 计算。
177
- // CSS 方案:grid 布局叠加。
178
- }
179
- }
180
- }
181
-
182
- @include when(fit-text) {
183
- width: auto;
184
- min-width: unset;
185
-
186
- .cp-switch__track {
187
- min-width: 44px; // 最小宽度
188
- width: auto;
189
- }
190
-
191
- .cp-switch__wrapper {
192
- display: grid;
193
- grid-template-areas: "content";
194
-
195
- .wrapper-text {
196
- grid-area: content;
197
- display: block !important;
198
- visibility: hidden; // 占位
199
- }
200
- }
201
-
202
- // Fit Text 模式下滑块和文字的定位
203
- // 需重新计算 thumb 位置。
204
- // 由于布局变了,Thumb 不再是 absolute left/right,而是...
205
- // 实际上 Fit Text 最好的方式是 Thumb 也在流中,或者依然 absolute。
206
- // 依然 absolute,但 left/right 变为 flex 的两端对齐?
207
- // 保持 fixed thumb width 是最简单的。
208
- }
209
-
210
- // ===== 滑块 =====
211
- @include e(thumb) {
212
- position: absolute;
213
- top: 1px; // border 1px
214
- left: 1px;
215
- display: flex;
216
- align-items: center;
217
- justify-content: center;
218
- background: linear-gradient(135deg, #3c3c41 0%, #2a2a2e 100%);
219
- border: 1px solid rgba(255, 255, 255, 0.2);
220
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
221
- transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); // 弹性动画
222
- z-index: 10;
223
- color: var(--cp-text-muted);
224
-
225
- // 机甲纹理
226
- &::before {
227
- content: '';
228
- position: absolute;
229
- width: 40%;
230
- height: 2px;
231
- background: rgba(0, 0, 0, 0.5);
232
- border-radius: 1px;
233
- box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
234
- }
235
-
236
- // 专属 Loading Core
237
- .cp-switch__loading-core {
238
- display: flex;
239
- align-items: center;
240
- justify-content: center;
241
- width: 100%;
242
- height: 100%;
243
- color: inherit;
244
-
245
- .loading-svg {
246
- width: 80%;
247
- height: 80%;
248
- }
249
-
250
- .outer-ring {
251
- transform-origin: center;
252
- animation: cp-switch-spin 1.5s linear infinite;
253
- }
254
-
255
- .inner-core {
256
- transform-origin: center;
257
- animation: cp-switch-pulse 1s ease-in-out infinite alternate;
258
- }
259
- }
260
- }
261
-
262
- // ===== 内嵌文字 =====
263
- @include e(active-text) {
264
- position: absolute;
265
- top: 0;
266
- height: 100%;
267
- display: flex;
268
- align-items: center;
269
- font-family: var(--cp-font-family-ui);
270
- font-weight: 600;
271
- transition: opacity 0.2s ease;
272
- pointer-events: none;
273
- z-index: 1;
274
- white-space: nowrap;
275
-
276
- .text-inner {
277
- display: block;
278
- }
279
- }
280
-
281
- @include e(inactive-text) {
282
- position: absolute;
283
- top: 0;
284
- height: 100%;
285
- display: flex;
286
- align-items: center;
287
- font-family: var(--cp-font-family-ui);
288
- font-weight: 600;
289
- transition: opacity 0.2s ease;
290
- pointer-events: none;
291
- z-index: 1;
292
- white-space: nowrap;
293
-
294
- .text-inner {
295
- display: block;
296
- }
297
- }
298
-
299
- @include e(active-text) {
300
- left: 0;
301
- padding-left: 6px; // 初始 padding
302
- color: var(--cp-switch-text-color);
303
- opacity: 0;
304
- justify-content: flex-start;
305
- width: calc(100% - 20px); // 减去 thumb 宽度的近似值
306
- }
307
-
308
- @include e(inactive-text) {
309
- right: 0;
310
- padding-right: 6px;
311
- color: var(--cp-text-muted);
312
- opacity: 1;
313
- justify-content: flex-end;
314
- width: calc(100% - 20px);
315
- }
316
-
317
- // ===== 尺寸 =====
318
- @each $size-name, $size-config in $switch-sizes {
319
- @include m(#{$size-name}) {
320
- $height: map.get($size-config, height);
321
- $width: map.get($size-config, width);
322
- $thumb-size: map.get($size-config, thumb);
323
- $padding: map.get($size-config, padding);
324
-
325
- // 基础固定宽度模式
326
- &:not(.is-fit-text) {
327
- .cp-switch__track {
328
- height: $height;
329
- width: $width;
330
- }
331
- }
332
-
333
- // Fit Text 模式
334
- &.is-fit-text {
335
- .cp-switch__track {
336
- height: $height;
337
- // width 由内容撑开
338
- }
339
-
340
- // 文字边距调整
341
- .cp-switch__active-text,
342
- .cp-switch__inactive-text,
343
- .wrapper-text {
344
- width: 100%;
345
- // 左右预留足够空间防止被 Thumb 遮挡 (Thumb宽度 + 间距)
346
- padding: 0 calc(#{$thumb-size} + 8px);
347
- box-sizing: border-box;
348
- }
349
-
350
- // wrapper-text 不需要 width 100%,它需要自然撑开
351
- .wrapper-text {
352
- width: auto;
353
- }
354
-
355
- .cp-switch__active-text { left: 0; }
356
- .cp-switch__inactive-text { right: 0; }
357
-
358
- // 选中时的位置修正
359
- &.is-checked {
360
- .cp-switch__thumb {
361
- // 使用 left: auto, right: 1px 不支持 transition left -> right
362
- // 所以必须通过 calc(100% - size)
363
- left: calc(100% - #{$thumb-size} - 2px);
364
- }
365
- }
366
- }
367
-
368
- .cp-switch__track {
369
- clip-path: polygon(
370
- map.get($size-config, clip) 0,
371
- 100% 0,
372
- 100% calc(100% - #{map.get($size-config, clip)}),
373
- calc(100% - #{map.get($size-config, clip)}) 100%,
374
- 0 100%,
375
- 0 map.get($size-config, clip)
376
- );
377
- }
378
-
379
- .cp-switch__thumb {
380
- width: $thumb-size;
381
- height: $thumb-size;
382
- clip-path: polygon(
383
- 3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px
384
- );
385
-
386
- // 机甲纹理调整
387
- @if $size-name == 'sm' { &::before { height: 1px; } }
388
- }
389
-
156
+ @include e(wrapper) {
157
+ display: flex;
158
+ align-items: center;
159
+ justify-content: center;
160
+ opacity: 0;
161
+ visibility: hidden;
162
+ height: 100%;
163
+ pointer-events: none;
164
+
165
+ .wrapper-text {
166
+ padding: 0 8px; // 边距
167
+ font-family: var(--cp-font-family-ui);
168
+ font-weight: 600;
169
+ white-space: nowrap;
170
+
171
+ // 同时渲染两个文本,取最宽的一个撑开容器
172
+ &.inactive {
173
+ display: none; // 如果不想都显示,至少要让最宽的那个生效。
174
+ // 简单起见,如果 fit-text 开启,我们让 .active 和 .inactive 叠加?
175
+ // 为了简单,这里简单处理:并排会导致过宽。
176
+ // 应该 absolute 叠加取最大宽,或者 JS 计算。
177
+ // CSS 方案:grid 布局叠加。
178
+ }
179
+ }
180
+ }
181
+
182
+ @include when(fit-text) {
183
+ width: auto;
184
+ min-width: unset;
185
+
186
+ .cp-switch__track {
187
+ min-width: 44px; // 最小宽度
188
+ width: auto;
189
+ }
190
+
191
+ .cp-switch__wrapper {
192
+ display: grid;
193
+ grid-template-areas: "content";
194
+
195
+ .wrapper-text {
196
+ grid-area: content;
197
+ display: block !important;
198
+ visibility: hidden; // 占位
199
+ }
200
+ }
201
+
202
+ // Fit Text 模式下滑块和文字的定位
203
+ // 需重新计算 thumb 位置。
204
+ // 由于布局变了,Thumb 不再是 absolute left/right,而是...
205
+ // 实际上 Fit Text 最好的方式是 Thumb 也在流中,或者依然 absolute。
206
+ // 依然 absolute,但 left/right 变为 flex 的两端对齐?
207
+ // 保持 fixed thumb width 是最简单的。
208
+ }
209
+
210
+ // ===== 滑块 =====
211
+ @include e(thumb) {
212
+ position: absolute;
213
+ top: 1px; // border 1px
214
+ left: 1px;
215
+ display: flex;
216
+ align-items: center;
217
+ justify-content: center;
218
+ background: linear-gradient(135deg, #3c3c41 0%, #2a2a2e 100%);
219
+ border: 1px solid rgba(255, 255, 255, 0.2);
220
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
221
+ transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); // 弹性动画
222
+ z-index: 10;
223
+ color: var(--cp-text-muted);
224
+
225
+ // 机甲纹理
226
+ &::before {
227
+ content: '';
228
+ position: absolute;
229
+ width: 40%;
230
+ height: 2px;
231
+ background: rgba(0, 0, 0, 0.5);
232
+ border-radius: 1px;
233
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
234
+ }
235
+
236
+ // 专属 Loading Core
237
+ .cp-switch__loading-core {
238
+ display: flex;
239
+ align-items: center;
240
+ justify-content: center;
241
+ width: 100%;
242
+ height: 100%;
243
+ color: inherit;
244
+
245
+ .loading-svg {
246
+ width: 80%;
247
+ height: 80%;
248
+ }
249
+
250
+ .outer-ring {
251
+ transform-origin: center;
252
+ animation: cp-switch-spin 1.5s linear infinite;
253
+ }
254
+
255
+ .inner-core {
256
+ transform-origin: center;
257
+ animation: cp-switch-pulse 1s ease-in-out infinite alternate;
258
+ }
259
+ }
260
+ }
261
+
262
+ // ===== 内嵌文字 =====
263
+ @include e(active-text) {
264
+ position: absolute;
265
+ top: 0;
266
+ height: 100%;
267
+ display: flex;
268
+ align-items: center;
269
+ font-family: var(--cp-font-family-ui);
270
+ font-weight: 600;
271
+ transition: opacity 0.2s ease;
272
+ pointer-events: none;
273
+ z-index: 1;
274
+ white-space: nowrap;
275
+
276
+ .text-inner {
277
+ display: block;
278
+ }
279
+ }
280
+
281
+ @include e(inactive-text) {
282
+ position: absolute;
283
+ top: 0;
284
+ height: 100%;
285
+ display: flex;
286
+ align-items: center;
287
+ font-family: var(--cp-font-family-ui);
288
+ font-weight: 600;
289
+ transition: opacity 0.2s ease;
290
+ pointer-events: none;
291
+ z-index: 1;
292
+ white-space: nowrap;
293
+
294
+ .text-inner {
295
+ display: block;
296
+ }
297
+ }
298
+
299
+ @include e(active-text) {
300
+ left: 0;
301
+ padding-left: 6px; // 初始 padding
302
+ color: var(--cp-switch-text-color);
303
+ opacity: 0;
304
+ justify-content: flex-start;
305
+ width: calc(100% - 20px); // 减去 thumb 宽度的近似值
306
+ }
307
+
308
+ @include e(inactive-text) {
309
+ right: 0;
310
+ padding-right: 6px;
311
+ color: var(--cp-text-muted);
312
+ opacity: 1;
313
+ justify-content: flex-end;
314
+ width: calc(100% - 20px);
315
+ }
316
+
317
+ // ===== 尺寸 =====
318
+ @each $size-name, $size-config in $switch-sizes {
319
+ @include m(#{$size-name}) {
320
+ $height: map.get($size-config, height);
321
+ $width: map.get($size-config, width);
322
+ $thumb-size: map.get($size-config, thumb);
323
+ $padding: map.get($size-config, padding);
324
+
325
+ // 基础固定宽度模式
326
+ &:not(.is-fit-text) {
327
+ .cp-switch__track {
328
+ height: $height;
329
+ width: $width;
330
+ }
331
+ }
332
+
333
+ // Fit Text 模式
334
+ &.is-fit-text {
335
+ .cp-switch__track {
336
+ height: $height;
337
+ // width 由内容撑开
338
+ }
339
+
340
+ // 文字边距调整
341
+ .cp-switch__active-text,
342
+ .cp-switch__inactive-text,
343
+ .wrapper-text {
344
+ width: 100%;
345
+ // 左右预留足够空间防止被 Thumb 遮挡 (Thumb宽度 + 间距)
346
+ padding: 0 calc(#{$thumb-size} + 8px);
347
+ box-sizing: border-box;
348
+ }
349
+
350
+ // wrapper-text 不需要 width 100%,它需要自然撑开
351
+ .wrapper-text {
352
+ width: auto;
353
+ }
354
+
355
+ .cp-switch__active-text { left: 0; }
356
+ .cp-switch__inactive-text { right: 0; }
357
+
358
+ // 选中时的位置修正
359
+ &.is-checked {
360
+ .cp-switch__thumb {
361
+ // 使用 left: auto, right: 1px 不支持 transition left -> right
362
+ // 所以必须通过 calc(100% - size)
363
+ left: calc(100% - #{$thumb-size} - 2px);
364
+ }
365
+ }
366
+ }
367
+
368
+ .cp-switch__track {
369
+ clip-path: polygon(
370
+ map.get($size-config, clip) 0,
371
+ 100% 0,
372
+ 100% calc(100% - #{map.get($size-config, clip)}),
373
+ calc(100% - #{map.get($size-config, clip)}) 100%,
374
+ 0 100%,
375
+ 0 map.get($size-config, clip)
376
+ );
377
+ }
378
+
379
+ .cp-switch__thumb {
380
+ width: $thumb-size;
381
+ height: $thumb-size;
382
+ clip-path: polygon(
383
+ 3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px
384
+ );
385
+
386
+ // 机甲纹理调整
387
+ @if $size-name == 'sm' { &::before { height: 1px; } }
388
+ }
389
+
390
390
  .cp-switch__active-text,
391
391
  .cp-switch__inactive-text,
392
392
  .cp-switch__text,
393
393
  .wrapper-text {
394
394
  font-size: map.get($size-config, font-size);
395
395
  }
396
-
397
- // 基础模式的 Thumb 位置
398
- &:not(.is-fit-text) {
399
- &.is-checked {
400
- .cp-switch__thumb {
401
- left: calc(#{$width} - #{$thumb-size} - 2px);
402
- }
403
- }
404
- }
405
- }
406
- }
407
-
408
- // ===== 选中状态 =====
409
- @include when(checked) {
410
- .cp-switch__track {
411
- background: rgba(0, 0, 0, 0.4); // 半透明深色底
412
- border-color: var(--cp-switch-active-color);
413
- box-shadow:
414
- 0 0 10px var(--cp-switch-active-color-light);
415
-
416
- &::after { // 角落装饰
417
- border-color: var(--cp-switch-active-color);
418
- box-shadow: 0 0 5px var(--cp-switch-active-color);
419
- background: var(--cp-switch-active-color); // 实心
420
- }
421
-
422
- // 纹理变色 - 使用 CSS 滤镜实现染色
423
- &::before {
424
- background-image: repeating-linear-gradient(
425
- 45deg,
426
- transparent,
427
- transparent 2px,
428
- var(--cp-switch-active-color-light) 2px,
429
- var(--cp-switch-active-color-light) 4px
430
- );
431
- }
432
- }
433
-
434
- .cp-switch__thumb {
435
- background: var(--cp-switch-active-color);
436
- border-color: rgba(255, 255, 255, 0.8);
437
- box-shadow: 0 0 12px var(--cp-switch-active-color); // 强发光
438
- // Loading core 颜色 - 使用深色以在亮色背景上保持可见
439
- color: rgba(0, 0, 0, 0.7);
440
-
441
- // Loading 动画添加发光效果增强可见度
442
- .cp-switch__loading-core {
443
- filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.9));
444
- }
445
-
446
- &::before { // 纹理
447
- background: rgba(255, 255, 255, 0.6);
448
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
449
- }
450
- }
451
-
452
- .cp-switch__active-text { opacity: 1; }
453
- .cp-switch__inactive-text { opacity: 0; }
454
- }
455
-
456
- // ===== Loading 状态 =====
396
+
397
+ // 基础模式的 Thumb 位置
398
+ &:not(.is-fit-text) {
399
+ &.is-checked {
400
+ .cp-switch__thumb {
401
+ left: calc(#{$width} - #{$thumb-size} - 2px);
402
+ }
403
+ }
404
+ }
405
+ }
406
+ }
407
+
408
+ // ===== 选中状态 =====
409
+ @include when(checked) {
410
+ .cp-switch__track {
411
+ background: rgba(0, 0, 0, 0.4); // 半透明深色底
412
+ border-color: var(--cp-switch-active-color);
413
+ box-shadow:
414
+ 0 0 10px var(--cp-switch-active-color-light);
415
+
416
+ &::after { // 角落装饰
417
+ border-color: var(--cp-switch-active-color);
418
+ box-shadow: 0 0 5px var(--cp-switch-active-color);
419
+ background: var(--cp-switch-active-color); // 实心
420
+ }
421
+
422
+ // 纹理变色 - 使用 CSS 滤镜实现染色
423
+ &::before {
424
+ background-image: repeating-linear-gradient(
425
+ 45deg,
426
+ transparent,
427
+ transparent 2px,
428
+ var(--cp-switch-active-color-light) 2px,
429
+ var(--cp-switch-active-color-light) 4px
430
+ );
431
+ }
432
+ }
433
+
434
+ .cp-switch__thumb {
435
+ background: var(--cp-switch-active-color);
436
+ border-color: rgba(255, 255, 255, 0.8);
437
+ box-shadow: 0 0 12px var(--cp-switch-active-color); // 强发光
438
+ // Loading core 颜色 - 使用深色以在亮色背景上保持可见
439
+ color: rgba(0, 0, 0, 0.7);
440
+
441
+ // Loading 动画添加发光效果增强可见度
442
+ .cp-switch__loading-core {
443
+ filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.9));
444
+ }
445
+
446
+ &::before { // 纹理
447
+ background: rgba(255, 255, 255, 0.6);
448
+ box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
449
+ }
450
+ }
451
+
452
+ .cp-switch__active-text { opacity: 1; }
453
+ .cp-switch__inactive-text { opacity: 0; }
454
+ }
455
+
456
+ // ===== Loading 状态 =====
457
457
  @include when(loading) {
458
458
  cursor: wait;
459
459
  .cp-switch__thumb {
460
460
  &::before { display: none; } // 隐藏横杠显示 Loading
461
461
  }
462
- }
463
-
464
- // ===== 禁用状态 =====
465
- @include when(disabled) {
466
- opacity: 0.6;
462
+ }
463
+
464
+ // ===== 禁用状态 =====
465
+ @include when(disabled) {
466
+ opacity: 0.6;
467
467
  cursor: not-allowed;
468
468
  filter: grayscale(0.8);
469
469
  }
@@ -598,11 +598,11 @@ $switch-sizes: (
598
598
 
599
599
  // 动画定义
600
600
  @keyframes cp-switch-spin {
601
- from { transform: rotate(0deg); }
602
- to { transform: rotate(360deg); }
603
- }
604
-
605
- @keyframes cp-switch-pulse {
606
- from { opacity: 0.5; transform: scale(0.8); }
607
- to { opacity: 1; transform: scale(1.1); }
608
- }
601
+ from { transform: rotate(0deg); }
602
+ to { transform: rotate(360deg); }
603
+ }
604
+
605
+ @keyframes cp-switch-pulse {
606
+ from { opacity: 0.5; transform: scale(0.8); }
607
+ to { opacity: 1; transform: scale(1.1); }
608
+ }