@mtn-ui/theme 0.0.1
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/index.css +244 -0
- package/package.json +25 -0
- package/vars.scss +29 -0
package/index.css
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
MTN UI Theme System
|
|
3
|
+
Tailwind CSS v4 CSS-first Configuration
|
|
4
|
+
注意:这里不导入 Tailwind,只定义变量
|
|
5
|
+
Tailwind 应在应用层(play)导入
|
|
6
|
+
============================================ */
|
|
7
|
+
|
|
8
|
+
/* ============================================
|
|
9
|
+
Theme Variables (@theme)
|
|
10
|
+
定义全局主题变量,供 Tailwind 和组件使用
|
|
11
|
+
============================================ */
|
|
12
|
+
@theme {
|
|
13
|
+
/* ---------- 颜色系统 ---------- */
|
|
14
|
+
--color-primary: #409eff;
|
|
15
|
+
--color-primary-hover: #66b1ff;
|
|
16
|
+
--color-primary-active: #3a8ee6;
|
|
17
|
+
--color-success: #67c23a;
|
|
18
|
+
--color-success-hover: #85ce61;
|
|
19
|
+
--color-warning: #e6a23c;
|
|
20
|
+
--color-warning-hover: #ebb563;
|
|
21
|
+
--color-danger: #f56c6c;
|
|
22
|
+
--color-danger-hover: #f78989;
|
|
23
|
+
--color-danger-active: #dd6161;
|
|
24
|
+
--color-info: #909399;
|
|
25
|
+
--color-info-hover: #a6a9ad;
|
|
26
|
+
|
|
27
|
+
/* ---------- 中性色系统 ---------- */
|
|
28
|
+
--color-text-primary: #303133;
|
|
29
|
+
--color-text-regular: #606266;
|
|
30
|
+
--color-text-secondary: #909399;
|
|
31
|
+
--color-text-placeholder: #c0c4cc;
|
|
32
|
+
--color-border-base: #dcdfe6;
|
|
33
|
+
--color-border-light: #e4e7ed;
|
|
34
|
+
--color-border-lighter: #ebeef5;
|
|
35
|
+
--color-border-extra-light: #f2f6fc;
|
|
36
|
+
--color-bg-base: #f5f7fa;
|
|
37
|
+
--color-bg-page: #ffffff;
|
|
38
|
+
|
|
39
|
+
/* ---------- 圆角系统 ---------- */
|
|
40
|
+
--radius-none: 0;
|
|
41
|
+
--radius-sm: 2px;
|
|
42
|
+
--radius-base: 4px;
|
|
43
|
+
--radius-md: 8px;
|
|
44
|
+
--radius-lg: 12px;
|
|
45
|
+
--radius-xl: 16px;
|
|
46
|
+
--radius-full: 9999px;
|
|
47
|
+
|
|
48
|
+
/* ---------- 间距系统 ---------- */
|
|
49
|
+
--spacing-xs: 4px;
|
|
50
|
+
--spacing-sm: 8px;
|
|
51
|
+
--spacing-md: 16px;
|
|
52
|
+
--spacing-lg: 24px;
|
|
53
|
+
--spacing-xl: 32px;
|
|
54
|
+
--spacing-2xl: 48px;
|
|
55
|
+
|
|
56
|
+
/* ---------- 阴影系统 ---------- */
|
|
57
|
+
--shadow-sm: 0 2px 4px rgb(0 0 0 / 12%), 0 0 6px rgb(0 0 0 / 4%);
|
|
58
|
+
--shadow-base: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
|
59
|
+
--shadow-md: 0 4px 16px 0 rgb(0 0 0 / 12%);
|
|
60
|
+
--shadow-lg: 0 8px 24px 0 rgb(0 0 0 / 16%);
|
|
61
|
+
|
|
62
|
+
/* ---------- 过渡动画 ---------- */
|
|
63
|
+
--transition-base: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
64
|
+
--transition-fast: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
65
|
+
--transition-slow: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
66
|
+
|
|
67
|
+
/* ---------- 自定义动画 ---------- */
|
|
68
|
+
--animate-spin-slow: spin 3s linear infinite;
|
|
69
|
+
--animate-fade-in: fade-in 0.3s ease-in-out;
|
|
70
|
+
--animate-slide-up: slide-up 0.3s ease-out;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* ============================================
|
|
74
|
+
Base Layer
|
|
75
|
+
定义基础样式和 CSS 变量
|
|
76
|
+
============================================ */
|
|
77
|
+
@layer base {
|
|
78
|
+
:root {
|
|
79
|
+
/* MTN UI 专用变量(带 mtn- 前缀) */
|
|
80
|
+
--mtn-main-bg: var(--color-bg-page);
|
|
81
|
+
--mtn-text-primary: var(--color-text-primary);
|
|
82
|
+
--mtn-text-regular: var(--color-text-regular);
|
|
83
|
+
--mtn-text-secondary: var(--color-text-secondary);
|
|
84
|
+
--mtn-border-color: var(--color-border-base);
|
|
85
|
+
--mtn-border-radius: var(--radius-base);
|
|
86
|
+
--mtn-transition: var(--transition-base);
|
|
87
|
+
|
|
88
|
+
/* ============================================
|
|
89
|
+
Ant Design Vue 主题变量映射
|
|
90
|
+
将 Antdv 的 CSS 变量映射到 Tailwind 变量
|
|
91
|
+
============================================ */
|
|
92
|
+
--ant-primary-color: var(--color-primary);
|
|
93
|
+
--ant-primary-color-hover: var(--color-primary-hover);
|
|
94
|
+
--ant-primary-color-active: var(--color-primary-active);
|
|
95
|
+
--ant-error-color: var(--color-danger);
|
|
96
|
+
--ant-error-color-hover: var(--color-danger-hover);
|
|
97
|
+
--ant-error-color-active: var(--color-danger-active);
|
|
98
|
+
--ant-success-color: var(--color-success);
|
|
99
|
+
--ant-success-color-hover: var(--color-success-hover);
|
|
100
|
+
--ant-warning-color: var(--color-warning);
|
|
101
|
+
--ant-warning-color-hover: var(--color-warning-hover);
|
|
102
|
+
--ant-info-color: var(--color-info);
|
|
103
|
+
--ant-info-color-hover: var(--color-info-hover);
|
|
104
|
+
--ant-border-radius-base: var(--radius-base);
|
|
105
|
+
--ant-border-radius-sm: var(--radius-sm);
|
|
106
|
+
--ant-border-radius-lg: var(--radius-md);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* 全局重置和基础样式 */
|
|
110
|
+
* {
|
|
111
|
+
box-sizing: border-box;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ============================================
|
|
115
|
+
保护 Ant Design Vue 组件不被 Tailwind reset 影响
|
|
116
|
+
解决 Tailwind Preflight 导致的样式冲突
|
|
117
|
+
============================================ */
|
|
118
|
+
/* 保护 Antdv 按钮的对齐和显示方式 */
|
|
119
|
+
.ant-btn {
|
|
120
|
+
display: inline-flex !important;
|
|
121
|
+
align-items: center !important;
|
|
122
|
+
justify-content: center !important;
|
|
123
|
+
vertical-align: middle !important;
|
|
124
|
+
line-height: 1.5715 !important;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* 保护 Antdv 按钮组 */
|
|
129
|
+
.ant-btn-group {
|
|
130
|
+
display: inline-block !important;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* 保护 Antdv 图标对齐 */
|
|
134
|
+
.ant-btn .anticon {
|
|
135
|
+
line-height: 0 !important;
|
|
136
|
+
display: inline-flex !important;
|
|
137
|
+
align-items: center !important;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* ============================================
|
|
141
|
+
修复 Ant Design Vue Popconfirm 图标对齐问题
|
|
142
|
+
============================================ */
|
|
143
|
+
/* Popconfirm 消息容器 - 使用 flex 确保内容对齐 */
|
|
144
|
+
.ant-popconfirm-message {
|
|
145
|
+
display: flex !important;
|
|
146
|
+
align-items: center !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Popconfirm 图标容器 - 确保图标垂直居中 */
|
|
150
|
+
.ant-popconfirm-message-icon {
|
|
151
|
+
display: inline-flex !important;
|
|
152
|
+
align-items: center !important;
|
|
153
|
+
justify-content: center !important;
|
|
154
|
+
flex-shrink: 0 !important;
|
|
155
|
+
line-height: 1 !important;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Popconfirm 图标内的 anticon - 确保垂直居中 */
|
|
159
|
+
/* 覆盖 Ant Design Vue 的 padding-top: 4px 以修复图标偏下问题 */
|
|
160
|
+
.ant-popconfirm-message-icon > .anticon {
|
|
161
|
+
display: inline-flex !important;
|
|
162
|
+
align-items: center !important;
|
|
163
|
+
padding-top: 0 !important;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* 保护 Antdv loading spinner 的间距 */
|
|
167
|
+
.ant-btn-loading-icon {
|
|
168
|
+
margin-right: 8px !important;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* 如果图标在文字后面 */
|
|
172
|
+
.ant-btn .anticon:last-child {
|
|
173
|
+
margin-left: 4px !important;
|
|
174
|
+
margin-right: 0 !important;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* 保护 Antdv 按钮内的 SVG */
|
|
178
|
+
.ant-btn svg {
|
|
179
|
+
display: inline !important;
|
|
180
|
+
vertical-align: middle !important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* ============================================
|
|
184
|
+
MTN 专属按钮风格样式
|
|
185
|
+
使用 mtn-variant 属性选择器直接匹配
|
|
186
|
+
这是最可靠的方式,确保样式能够正确应用
|
|
187
|
+
============================================ */
|
|
188
|
+
/* 渐变风格 */
|
|
189
|
+
.ant-btn[mtn-variant="gradient"] {
|
|
190
|
+
background: linear-gradient(to right, rgb(59 130 246), rgb(99 102 241)) !important;
|
|
191
|
+
border: none !important;
|
|
192
|
+
color: white !important;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* 毛玻璃风格 */
|
|
196
|
+
.ant-btn[mtn-variant="glass"] {
|
|
197
|
+
backdrop-filter: blur(12px) !important;
|
|
198
|
+
background: rgb(255 255 255 / 30%) !important;
|
|
199
|
+
border: 1px solid rgb(255 255 255 / 20%) !important;
|
|
200
|
+
color: rgb(31 41 55) !important;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* 柔和风格 */
|
|
204
|
+
.ant-btn[mtn-variant="soft"] {
|
|
205
|
+
background-color: rgb(239 246 255) !important;
|
|
206
|
+
color: rgb(37 99 235) !important;
|
|
207
|
+
border: none !important;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.ant-btn[mtn-variant="soft"]:hover:not(:disabled) {
|
|
211
|
+
background-color: rgb(219 234 254) !important;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* 动画定义 */
|
|
215
|
+
@keyframes fade-in {
|
|
216
|
+
from {
|
|
217
|
+
opacity: 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
to {
|
|
221
|
+
opacity: 1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@keyframes slide-up {
|
|
226
|
+
from {
|
|
227
|
+
transform: translateY(10px);
|
|
228
|
+
opacity: 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
to {
|
|
232
|
+
transform: translateY(0);
|
|
233
|
+
opacity: 1;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* ============================================
|
|
239
|
+
Components Layer - 样式隔离
|
|
240
|
+
使用 mtn- 前缀防止样式冲突
|
|
241
|
+
============================================ */
|
|
242
|
+
@layer components {
|
|
243
|
+
/* 此层暂时为空,未来可用于自定义组件样式 */
|
|
244
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mtn-ui/theme",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "MTN UI Theme System",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.css",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.css",
|
|
9
|
+
"./vars": "./vars.scss",
|
|
10
|
+
"./tailwind": "./index.css"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.css",
|
|
14
|
+
"vars.scss"
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"tailwindcss": "^4.0.0"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"tailwindcss": "^4.0.0"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/vars.scss
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SCSS 共享变量
|
|
2
|
+
|
|
3
|
+
// 颜色系统
|
|
4
|
+
$color-primary: #409eff;
|
|
5
|
+
$color-success: #67c23a;
|
|
6
|
+
$color-warning: #e6a23c;
|
|
7
|
+
$color-danger: #f56c6c;
|
|
8
|
+
$color-info: #909399;
|
|
9
|
+
|
|
10
|
+
// 尺寸
|
|
11
|
+
$size-small: 24px;
|
|
12
|
+
$size-medium: 32px;
|
|
13
|
+
$size-large: 40px;
|
|
14
|
+
|
|
15
|
+
// 间距
|
|
16
|
+
$spacing-xs: 4px;
|
|
17
|
+
$spacing-sm: 8px;
|
|
18
|
+
$spacing-md: 16px;
|
|
19
|
+
$spacing-lg: 24px;
|
|
20
|
+
$spacing-xl: 32px;
|
|
21
|
+
|
|
22
|
+
// 圆角
|
|
23
|
+
$border-radius-sm: 2px;
|
|
24
|
+
$border-radius-md: 4px;
|
|
25
|
+
$border-radius-lg: 8px;
|
|
26
|
+
|
|
27
|
+
// 阴影
|
|
28
|
+
$shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
|
|
29
|
+
$shadow-md: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|