@cyberpunk-vue/theme-chalk 1.13.20 → 1.14.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.
@@ -32,7 +32,9 @@ $slider-sizes: (
32
32
  display: flex;
33
33
  align-items: center;
34
34
  cursor: pointer;
35
- user-select: none;
35
+ user-select: none;
36
+ --cp-slider-color: var(--cp-color-primary);
37
+ --cp-slider-color-light: var(--cp-color-primary-light);
36
38
 
37
39
  // ========== 轨道 ==========
38
40
  @include e(runway) {
@@ -61,8 +63,8 @@ $slider-sizes: (
61
63
  top: 0;
62
64
  left: 0;
63
65
  height: 100%;
64
- background: var(--cp-color-primary);
65
- box-shadow: 0 0 10px var(--cp-color-primary);
66
+ background: var(--cp-slider-color);
67
+ box-shadow: 0 0 10px var(--cp-slider-color-light);
66
68
  z-index: 1;
67
69
 
68
70
  // 内部纹理,增加科幻感
@@ -89,8 +91,8 @@ $slider-sizes: (
89
91
  width: 18px;
90
92
  height: 18px;
91
93
  background: var(--cp-bg-elevated);
92
- border: var(--cp-slider-thumb-border-width, 2px) solid var(--cp-color-primary);
93
- box-shadow: 0 0 8px var(--cp-color-primary);
94
+ border: var(--cp-slider-thumb-border-width, 2px) solid var(--cp-slider-color);
95
+ box-shadow: 0 0 8px var(--cp-slider-color-light);
94
96
  transform: translate(-50%, 0);
95
97
  cursor: grab;
96
98
  z-index: 2;
@@ -114,7 +116,7 @@ $slider-sizes: (
114
116
  left: 50%;
115
117
  width: var(--cp-slider-inner-dot-size, 6px);
116
118
  height: var(--cp-slider-inner-dot-size, 6px);
117
- background: var(--cp-color-primary);
119
+ background: var(--cp-slider-color);
118
120
  transform: translate(-50%, -50%);
119
121
  clip-path: polygon(
120
122
  var(--cp-slider-inner-clip-size, 2px) 0,
@@ -127,21 +129,21 @@ $slider-sizes: (
127
129
  }
128
130
 
129
131
  &:hover {
130
- border-color: var(--cp-color-primary-light);
131
- box-shadow: 0 0 12px var(--cp-color-primary);
132
+ border-color: var(--cp-slider-color);
133
+ box-shadow: 0 0 12px var(--cp-slider-color-light);
132
134
  transform: translate(-50%, 0) scale(1.1);
133
135
  }
134
136
 
135
137
  &:active,
136
138
  &:focus {
137
139
  cursor: grabbing;
138
- border-color: var(--cp-color-primary-light);
139
- box-shadow: 0 0 16px var(--cp-color-primary);
140
+ border-color: var(--cp-slider-color);
141
+ box-shadow: 0 0 16px var(--cp-slider-color-light);
140
142
  }
141
143
 
142
144
  @include when(active) {
143
- border-color: var(--cp-color-primary-light);
144
- box-shadow: 0 0 16px var(--cp-color-primary);
145
+ border-color: var(--cp-slider-color);
146
+ box-shadow: 0 0 16px var(--cp-slider-color-light);
145
147
  transform: translate(-50%, 0) scale(1.15);
146
148
  }
147
149
  }
@@ -154,13 +156,13 @@ $slider-sizes: (
154
156
  transform: translateX(-50%);
155
157
  padding: 4px 8px;
156
158
  background: var(--cp-bg-elevated);
157
- border: 1px solid var(--cp-color-primary); // 修正变量名
158
- color: var(--cp-color-primary); // 修正变量名
159
+ border: 1px solid var(--cp-slider-color);
160
+ color: var(--cp-slider-color);
159
161
  font-family: var(--cp-font-family-mono);
160
162
  font-size: 12px;
161
163
  font-weight: 600;
162
164
  white-space: nowrap;
163
- box-shadow: 0 0 8px var(--cp-color-primary); // 修正变量名
165
+ box-shadow: 0 0 8px var(--cp-slider-color-light);
164
166
  z-index: 10;
165
167
 
166
168
  // 箭头
@@ -171,7 +173,7 @@ $slider-sizes: (
171
173
  left: 50%;
172
174
  transform: translateX(-50%);
173
175
  border: 4px solid transparent;
174
- border-top-color: var(--cp-color-primary); // 修正变量名
176
+ border-top-color: var(--cp-slider-color);
175
177
  }
176
178
  }
177
179
 
@@ -259,7 +261,7 @@ $slider-sizes: (
259
261
  right: 100%;
260
262
  transform: translateY(-50%);
261
263
  border: 4px solid transparent;
262
- border-right-color: var(--cp-color-primary);
264
+ border-right-color: var(--cp-slider-color);
263
265
  border-top-color: transparent;
264
266
  }
265
267
  }
@@ -429,49 +431,49 @@ $slider-sizes: (
429
431
  }
430
432
 
431
433
  // ========== 自定义颜色 ==========
432
- @include when(custom-color) {
433
- .#{$namespace}-slider__bar {
434
- background: var(--cp-slider-custom-color);
435
- box-shadow: 0 0 10px var(--cp-slider-custom-color-light);
436
- }
437
-
438
- .#{$namespace}-slider__thumb {
439
- border-color: var(--cp-slider-custom-color);
440
- box-shadow: 0 0 8px var(--cp-slider-custom-color-light);
441
-
442
- &::before {
443
- background: var(--cp-slider-custom-color);
444
- }
445
-
446
- &:hover,
447
- &:active,
448
- &:focus {
449
- border-color: var(--cp-slider-custom-color);
450
- box-shadow: 0 0 12px var(--cp-slider-custom-color-light);
451
- }
452
-
453
- &.is-active {
454
- border-color: var(--cp-slider-custom-color);
455
- box-shadow: 0 0 16px var(--cp-slider-custom-color-light);
456
- }
457
- }
458
-
459
- .#{$namespace}-slider__tooltip {
460
- border-color: var(--cp-slider-custom-color);
461
- color: var(--cp-slider-custom-color);
462
- box-shadow: 0 0 8px var(--cp-slider-custom-color-light);
463
-
464
- &::after {
465
- border-top-color: var(--cp-slider-custom-color);
466
- }
467
- }
434
+ @include when(custom-color) {
435
+ .#{$namespace}-slider__bar {
436
+ background: var(--cp-slider-color);
437
+ box-shadow: 0 0 10px var(--cp-slider-color-light);
438
+ }
439
+
440
+ .#{$namespace}-slider__thumb {
441
+ border-color: var(--cp-slider-color);
442
+ box-shadow: 0 0 8px var(--cp-slider-color-light);
443
+
444
+ &::before {
445
+ background: var(--cp-slider-color);
446
+ }
447
+
448
+ &:hover,
449
+ &:active,
450
+ &:focus {
451
+ border-color: var(--cp-slider-color);
452
+ box-shadow: 0 0 12px var(--cp-slider-color-light);
453
+ }
454
+
455
+ &.is-active {
456
+ border-color: var(--cp-slider-color);
457
+ box-shadow: 0 0 16px var(--cp-slider-color-light);
458
+ }
459
+ }
460
+
461
+ .#{$namespace}-slider__tooltip {
462
+ border-color: var(--cp-slider-color);
463
+ color: var(--cp-slider-color);
464
+ box-shadow: 0 0 8px var(--cp-slider-color-light);
465
+
466
+ &::after {
467
+ border-top-color: var(--cp-slider-color);
468
+ }
469
+ }
468
470
 
469
471
  &.is-vertical {
470
472
  .#{$namespace}-slider__tooltip {
471
- &::after {
472
- border-right-color: var(--cp-slider-custom-color);
473
- border-top-color: transparent;
474
- }
473
+ &::after {
474
+ border-right-color: var(--cp-slider-color);
475
+ border-top-color: transparent;
476
+ }
475
477
  }
476
478
  }
477
479
  }
@@ -33,14 +33,15 @@ $switch-sizes: (
33
33
  ),
34
34
  );
35
35
 
36
- @include b(switch) {
36
+ @include b(switch) {
37
37
  // 基础样式
38
38
  position: relative;
39
- display: inline-flex;
40
- align-items: center;
41
- cursor: pointer;
42
- user-select: none;
43
- vertical-align: middle;
39
+ display: inline-flex;
40
+ align-items: center;
41
+ gap: var(--cp-spacing-sm);
42
+ cursor: pointer;
43
+ user-select: none;
44
+ vertical-align: middle;
44
45
 
45
46
  // CSS 变量
46
47
  --cp-switch-active-color: var(--cp-color-primary);
@@ -101,11 +102,57 @@ $switch-sizes: (
101
102
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0); // 三角形
102
103
  z-index: 2;
103
104
  transition: all 0.3s ease;
104
- }
105
- }
106
-
107
- // ===== Wrapper (Fit Text 占位) =====
108
- // 仅在 fit-text 模式下有内容撑开
105
+ }
106
+ }
107
+
108
+ // ===== 外部状态文字 =====
109
+ @include e(text) {
110
+ display: inline-grid;
111
+ align-items: center;
112
+ min-width: 0;
113
+ color: var(--cp-text-muted);
114
+ font-family: var(--cp-font-family-ui);
115
+ font-size: var(--cp-font-size-sm);
116
+ font-weight: 600;
117
+ line-height: 1;
118
+ white-space: nowrap;
119
+ transition: color 0.2s ease, text-shadow 0.2s ease;
120
+
121
+ .cp-switch__text-value {
122
+ display: block;
123
+ grid-area: 1 / 1;
124
+ opacity: 0;
125
+ visibility: hidden;
126
+ transition: opacity 0.2s ease, visibility 0.2s ease;
127
+
128
+ @include m(active) {
129
+ color: var(--cp-switch-active-color);
130
+ text-shadow: 0 0 8px var(--cp-switch-active-color-light);
131
+ }
132
+
133
+ @include m(inactive) {
134
+ color: var(--cp-text-muted);
135
+ text-shadow: none;
136
+ }
137
+ }
138
+ }
139
+
140
+ @include when(checked) {
141
+ .cp-switch__text-value--active {
142
+ opacity: 1;
143
+ visibility: visible;
144
+ }
145
+ }
146
+
147
+ &:not(.is-checked) {
148
+ .cp-switch__text-value--inactive {
149
+ opacity: 1;
150
+ visibility: visible;
151
+ }
152
+ }
153
+
154
+ // ===== Wrapper (Fit Text 占位) =====
155
+ // 仅在 fit-text 模式下有内容撑开
109
156
  @include e(wrapper) {
110
157
  display: flex;
111
158
  align-items: center;
@@ -340,11 +387,12 @@ $switch-sizes: (
340
387
  @if $size-name == 'sm' { &::before { height: 1px; } }
341
388
  }
342
389
 
343
- .cp-switch__active-text,
344
- .cp-switch__inactive-text,
345
- .wrapper-text {
346
- font-size: map.get($size-config, font-size);
347
- }
390
+ .cp-switch__active-text,
391
+ .cp-switch__inactive-text,
392
+ .cp-switch__text,
393
+ .wrapper-text {
394
+ font-size: map.get($size-config, font-size);
395
+ }
348
396
 
349
397
  // 基础模式的 Thumb 位置
350
398
  &:not(.is-fit-text) {
@@ -406,23 +454,150 @@ $switch-sizes: (
406
454
  }
407
455
 
408
456
  // ===== Loading 状态 =====
409
- @include when(loading) {
410
- cursor: wait;
411
- .cp-switch__thumb {
412
- &::before { display: none; } // 隐藏横杠显示 Loading
413
- }
457
+ @include when(loading) {
458
+ cursor: wait;
459
+ .cp-switch__thumb {
460
+ &::before { display: none; } // 隐藏横杠显示 Loading
461
+ }
414
462
  }
415
463
 
416
464
  // ===== 禁用状态 =====
417
465
  @include when(disabled) {
418
466
  opacity: 0.6;
419
- cursor: not-allowed;
420
- filter: grayscale(0.8);
421
- }
422
- }
423
-
424
- // 动画定义
425
- @keyframes cp-switch-spin {
467
+ cursor: not-allowed;
468
+ filter: grayscale(0.8);
469
+ }
470
+
471
+ // ===== 形状模式 =====
472
+ @include m(shape-no-clip) {
473
+ .cp-switch__track,
474
+ .cp-switch__thumb {
475
+ clip-path: none;
476
+ border-radius: 0;
477
+ }
478
+
479
+ .cp-switch__track::after {
480
+ display: none;
481
+ }
482
+ }
483
+
484
+ @include m(shape-round) {
485
+ .cp-switch__track,
486
+ .cp-switch__thumb {
487
+ clip-path: none;
488
+ border-radius: 999px;
489
+ }
490
+
491
+ .cp-switch__track::after {
492
+ display: none;
493
+ }
494
+ }
495
+ }
496
+
497
+ [data-theme="light"] {
498
+ @include b(switch) {
499
+ --cp-switch-bg-color: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
500
+ --cp-switch-inactive-color: #c4d0e3;
501
+ --cp-switch-active-color-light: color-mix(in srgb, var(--cp-switch-active-color) 18%, transparent);
502
+
503
+ @include e(track) {
504
+ background: var(--cp-switch-bg-color);
505
+ box-shadow:
506
+ inset 0 0 0 1px rgba(255, 255, 255, 0.62),
507
+ 0 1px 2px rgba(15, 23, 42, 0.06);
508
+
509
+ &::before {
510
+ background-image: repeating-linear-gradient(
511
+ 45deg,
512
+ transparent,
513
+ transparent 2px,
514
+ rgba(15, 23, 42, 0.035) 2px,
515
+ rgba(15, 23, 42, 0.035) 4px
516
+ );
517
+ }
518
+
519
+ &::after {
520
+ opacity: 0.65;
521
+ }
522
+ }
523
+
524
+ @include e(thumb) {
525
+ background: linear-gradient(135deg, #ffffff 0%, #e9f1ff 100%);
526
+ border-color: #b8c7dd;
527
+ box-shadow:
528
+ 0 1px 2px rgba(15, 23, 42, 0.16),
529
+ inset 0 1px 0 rgba(255, 255, 255, 0.9);
530
+ color: #64748b;
531
+
532
+ &::before {
533
+ background: #94a3b8;
534
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
535
+ }
536
+ }
537
+
538
+ @include e(text) {
539
+ .cp-switch__text-value--active {
540
+ text-shadow: none;
541
+ }
542
+ }
543
+
544
+ @include when(checked) {
545
+ .cp-switch__track {
546
+ background:
547
+ linear-gradient(
548
+ 135deg,
549
+ color-mix(in srgb, var(--cp-switch-active-color) 10%, #ffffff) 0%,
550
+ color-mix(in srgb, var(--cp-switch-active-color) 18%, #ffffff) 100%
551
+ );
552
+ border-color: var(--cp-switch-active-color);
553
+ box-shadow:
554
+ inset 0 0 0 1px rgba(255, 255, 255, 0.56),
555
+ 0 0 0 2px color-mix(in srgb, var(--cp-switch-active-color) 14%, transparent);
556
+
557
+ &::after {
558
+ background: var(--cp-switch-active-color);
559
+ box-shadow: none;
560
+ }
561
+
562
+ &::before {
563
+ background-image: repeating-linear-gradient(
564
+ 45deg,
565
+ transparent,
566
+ transparent 2px,
567
+ color-mix(in srgb, var(--cp-switch-active-color) 16%, transparent) 2px,
568
+ color-mix(in srgb, var(--cp-switch-active-color) 16%, transparent) 4px
569
+ );
570
+ }
571
+ }
572
+
573
+ .cp-switch__thumb {
574
+ background: linear-gradient(
575
+ 135deg,
576
+ color-mix(in srgb, var(--cp-switch-active-color) 88%, #ffffff) 0%,
577
+ var(--cp-switch-active-color) 100%
578
+ );
579
+ border-color: #ffffff;
580
+ box-shadow:
581
+ 0 2px 5px color-mix(in srgb, var(--cp-switch-active-color) 34%, transparent),
582
+ inset 0 1px 0 rgba(255, 255, 255, 0.48);
583
+ color: #ffffff;
584
+
585
+ &::before {
586
+ background: rgba(255, 255, 255, 0.78);
587
+ box-shadow: none;
588
+ }
589
+ }
590
+ }
591
+
592
+ @include when(disabled) {
593
+ opacity: 0.55;
594
+ filter: grayscale(0.45);
595
+ }
596
+ }
597
+ }
598
+
599
+ // 动画定义
600
+ @keyframes cp-switch-spin {
426
601
  from { transform: rotate(0deg); }
427
602
  to { transform: rotate(360deg); }
428
603
  }
@@ -82,50 +82,76 @@
82
82
  }
83
83
  }
84
84
 
85
- @include when(readonly) {
86
- .cp-textarea__inner {
87
- cursor: default;
88
- }
89
- }
85
+ @include when(readonly) {
86
+ .cp-textarea__inner {
87
+ cursor: default;
88
+ }
89
+ }
90
+
91
+ @include when(show-word-limit) {
92
+ padding-bottom: calc(var(--cp-spacing-xs) + var(--cp-font-size-sm));
93
+ }
90
94
 
91
95
  // ===== 自定义颜色 =====
92
- @include when(custom-color) {
93
- .cp-textarea__inner:hover:not(:disabled):not([readonly]) {
94
- border-color: var(--cp-textarea-custom-color);
96
+ @include when(custom-color) {
97
+ .cp-textarea__inner:hover:not(:disabled):not([readonly]) {
98
+ border-color: var(--cp-textarea-custom-color);
95
99
  }
96
100
 
97
101
  &.is-focused .cp-textarea__inner {
98
102
  border-color: var(--cp-textarea-custom-color);
99
- box-shadow: 0 0 10px var(--cp-textarea-custom-color-light), inset 0 0 5px var(--cp-textarea-custom-color-light);
100
- }
101
- }
102
-
103
- // ===== 内部元素 =====
103
+ box-shadow: 0 0 10px var(--cp-textarea-custom-color-light), inset 0 0 5px var(--cp-textarea-custom-color-light);
104
+ }
105
+ }
106
+
107
+ // ===== 形状模式 =====
108
+ @include m(shape-no-clip) {
109
+ .cp-textarea__inner {
110
+ clip-path: none;
111
+ border-radius: 0;
112
+ }
113
+ }
114
+
115
+ @include m(shape-round) {
116
+ .cp-textarea__inner {
117
+ clip-path: none;
118
+ border-radius: var(--cp-radius-lg);
119
+ }
120
+ }
121
+
122
+ // ===== 内部元素 =====
104
123
  @include e(inner) {
105
124
  width: 100%;
106
125
  min-height: 80px;
107
126
  resize: vertical;
108
127
  outline: none;
109
- color: var(--cp-textarea-text-color, var(--cp-text-primary));
110
- font-family: inherit;
111
- font-size: inherit;
112
- transition: all 0.2s ease;
113
-
114
- // 机甲风切角
115
- clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
128
+ color: var(--cp-textarea-text-color, var(--cp-text-primary));
129
+ font-family: inherit;
130
+ font-size: inherit;
131
+ transition:
132
+ background 0.2s ease,
133
+ border-color 0.2s ease,
134
+ box-shadow 0.2s ease,
135
+ color 0.2s ease,
136
+ border-radius 0.2s ease,
137
+ clip-path 0.2s ease;
138
+
139
+ // 机甲风切角
140
+ clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
116
141
 
117
142
  &::placeholder {
118
143
  color: var(--cp-text-muted);
119
144
  }
120
145
  }
121
146
 
122
- @include e(count) {
123
- position: absolute;
124
- right: var(--cp-spacing-sm);
125
- bottom: var(--cp-spacing-sm);
126
- color: var(--cp-text-muted);
127
- font-size: var(--cp-font-size-sm);
128
- font-family: var(--cp-font-family-mono);
129
- pointer-events: none;
130
- }
131
- }
147
+ @include e(count) {
148
+ position: absolute;
149
+ right: var(--cp-spacing-sm);
150
+ bottom: 0;
151
+ color: var(--cp-text-muted);
152
+ font-size: var(--cp-font-size-sm);
153
+ font-family: var(--cp-font-family-mono);
154
+ line-height: 1;
155
+ pointer-events: none;
156
+ }
157
+ }