@cyberpunk-vue/theme-chalk 0.1.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.
@@ -0,0 +1,124 @@
1
+ @use '../mixins/mixins' as *;
2
+ @use '../common/var' as *;
3
+
4
+ // ============================================
5
+ // CpAvatar - 赛博朋克风格头像组件
6
+ // ============================================
7
+
8
+ // 切角尺寸比例
9
+ $avatar-clip-ratio: 0.15;
10
+
11
+ // 图标占比
12
+ $avatar-icon-ratio: 0.55;
13
+
14
+ // 文字占比
15
+ $avatar-font-ratio: 0.4;
16
+
17
+ // 过渡时间
18
+ $avatar-transition-duration: 0.2s;
19
+
20
+ @include b(avatar) {
21
+ display: inline-flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ position: relative;
25
+ overflow: hidden;
26
+ background-color: var(--cp-bg-elevated);
27
+ color: var(--cp-text-muted);
28
+ vertical-align: middle;
29
+ flex-shrink: 0;
30
+
31
+ // 使用 CSS 变量控制尺寸
32
+ width: var(--cp-avatar-size, 40px);
33
+ height: var(--cp-avatar-size, 40px);
34
+ font-size: calc(var(--cp-avatar-size, 40px) * #{$avatar-font-ratio});
35
+ line-height: 1;
36
+
37
+ // 默认禁止选中和拖拽
38
+ user-select: none;
39
+ -webkit-user-drag: none;
40
+
41
+ transition: background-color $avatar-transition-duration ease,
42
+ box-shadow $avatar-transition-duration ease;
43
+
44
+ // ========================================
45
+ // 形状变体
46
+ // ========================================
47
+
48
+ // 圆形 (默认)
49
+ &.#{$namespace}-avatar--shape-circle {
50
+ border-radius: 50%;
51
+ }
52
+
53
+ // 圆角方形
54
+ &.#{$namespace}-avatar--shape-square {
55
+ border-radius: var(--cp-radius-sm);
56
+ }
57
+
58
+ // 机甲切角
59
+ &.#{$namespace}-avatar--shape-clip {
60
+ $clip-size: calc(var(--cp-avatar-size, 40px) * #{$avatar-clip-ratio});
61
+ clip-path: polygon(
62
+ #{$clip-size} 0,
63
+ 100% 0,
64
+ 100% calc(100% - #{$clip-size}),
65
+ calc(100% - #{$clip-size}) 100%,
66
+ 0 100%,
67
+ 0 #{$clip-size}
68
+ );
69
+ }
70
+
71
+ // ========================================
72
+ // 内部元素
73
+ // ========================================
74
+
75
+ // 图片
76
+ @include e(image) {
77
+ display: block;
78
+ width: 100%;
79
+ height: 100%;
80
+ object-fit: cover;
81
+ }
82
+
83
+ // 图标
84
+ @include e(icon) {
85
+ font-size: calc(var(--cp-avatar-size, 40px) * #{$avatar-icon-ratio}) !important;
86
+ color: inherit;
87
+ }
88
+
89
+ // 文字
90
+ @include e(text) {
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ font-weight: 500;
95
+ text-transform: uppercase;
96
+ white-space: nowrap;
97
+ }
98
+
99
+ // 占位符(用户轮廓)
100
+ @include e(placeholder) {
101
+ width: 55%;
102
+ height: 55%;
103
+ color: var(--cp-text-muted);
104
+ opacity: 0.7;
105
+ }
106
+
107
+ // ========================================
108
+ // 状态
109
+ // ========================================
110
+
111
+ // 加载中
112
+ &.is-loading {
113
+ .#{$namespace}-avatar__image {
114
+ opacity: 0;
115
+ }
116
+ }
117
+
118
+ // 错误
119
+ &.is-error {
120
+ .#{$namespace}-avatar__image {
121
+ display: none;
122
+ }
123
+ }
124
+ }