@mar7th/march7th-ui 1.0.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.
- package/.idea/march7th-ui.iml +9 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/demo/march7th-components.js +204 -0
- package/demo/march7th-theme-preview.html +166 -0
- package/demo/march7th-theme.css +9 -0
- package/demo/march7th-theme.js +296 -0
- package/demo/march7th-tokens.css +327 -0
- package/demo/march7th-ui.css +431 -0
- package/package.json +13 -0
- package/src/index.html +166 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* March7th UI Styles
|
|
3
|
+
* Base styles and utility/component classes powered by march7th-tokens.css.
|
|
4
|
+
* Load after march7th-tokens.css.
|
|
5
|
+
* Usage:
|
|
6
|
+
* <link rel="stylesheet" href="/theme/march7th-tokens.css">
|
|
7
|
+
* <link rel="stylesheet" href="/theme/march7th-ui.css">
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
:root.m7-theme-transitioning *,
|
|
11
|
+
:root.m7-theme-transitioning *::before,
|
|
12
|
+
:root.m7-theme-transitioning *::after {
|
|
13
|
+
transition: none !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.m7-theme {
|
|
17
|
+
background: var(--m7-page-bg); /* 应用页面背景色 */
|
|
18
|
+
color: var(--m7-text); /* 应用默认正文文字色 */
|
|
19
|
+
transition:
|
|
20
|
+
background-color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
21
|
+
color var(--m7-duration-fast) var(--m7-ease-standard);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.m7-card {
|
|
25
|
+
background: var(--m7-card-bg); /* 应用卡片背景色 */
|
|
26
|
+
border-radius: var(--m7-radius-large);
|
|
27
|
+
box-shadow: var(--m7-shadow-sm);
|
|
28
|
+
color: var(--m7-text-regular); /* 应用常规文本色 */
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
transition:
|
|
31
|
+
background-color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
32
|
+
color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
33
|
+
box-shadow var(--m7-duration-fast) var(--m7-ease-standard);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.m7-card-transparent {
|
|
37
|
+
background: var(--m7-card-bg-transparent); /* 应用半透明卡片背景色 */
|
|
38
|
+
backdrop-filter: blur(8px);
|
|
39
|
+
border-radius: var(--m7-radius-large);
|
|
40
|
+
box-shadow: var(--m7-shadow-sm);
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.m7-float-panel {
|
|
45
|
+
background: var(--m7-float-panel-bg); /* 应用浮动面板背景色 */
|
|
46
|
+
border: 1px solid var(--m7-line-divider); /* 应用轻量分割线/边框颜色 */
|
|
47
|
+
border-radius: var(--m7-radius-large);
|
|
48
|
+
box-shadow: var(--m7-shadow-xl);
|
|
49
|
+
color: var(--m7-text-regular); /* 应用常规文本色 */
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.m7-btn,
|
|
54
|
+
.m7-btn-regular {
|
|
55
|
+
align-items: center;
|
|
56
|
+
background: var(--m7-btn-regular-bg); /* 应用常规按钮背景色 */
|
|
57
|
+
border: 0; /* 无边框颜色 */
|
|
58
|
+
border-radius: 0.75rem;
|
|
59
|
+
color: var(--m7-btn-content); /* 应用常规按钮内容颜色 */
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
font: inherit;
|
|
63
|
+
gap: 0.4em;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
min-height: 2.5rem;
|
|
66
|
+
padding: 0.55rem 0.9rem;
|
|
67
|
+
text-decoration: none;
|
|
68
|
+
transition:
|
|
69
|
+
background-color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
70
|
+
color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
71
|
+
transform var(--m7-duration-fast) var(--m7-ease-standard);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.m7-btn:hover,
|
|
75
|
+
.m7-btn-regular:hover {
|
|
76
|
+
background: var(--m7-btn-regular-bg-hover); /* 应用常规按钮悬停背景色 */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.m7-btn:active,
|
|
80
|
+
.m7-btn-regular:active {
|
|
81
|
+
background: var(--m7-btn-regular-bg-active); /* 应用常规按钮按下背景色 */
|
|
82
|
+
transform: scale(0.97);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.m7-btn-plain {
|
|
86
|
+
align-items: center;
|
|
87
|
+
background: transparent; /* 透明背景,不额外铺色 */
|
|
88
|
+
border: 0; /* 无边框颜色 */
|
|
89
|
+
border-radius: 0.75rem;
|
|
90
|
+
color: var(--m7-text-regular); /* 应用常规文本色 */
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
font: inherit;
|
|
94
|
+
gap: 0.4em;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
min-height: 2.5rem;
|
|
97
|
+
padding: 0.55rem 0.75rem;
|
|
98
|
+
text-decoration: none;
|
|
99
|
+
transition:
|
|
100
|
+
background-color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
101
|
+
color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
102
|
+
transform var(--m7-duration-fast) var(--m7-ease-standard);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.m7-btn-plain:hover {
|
|
106
|
+
background: var(--m7-btn-plain-bg-hover); /* 应用朴素按钮悬停/当前背景色 */
|
|
107
|
+
color: var(--m7-primary); /* 应用主品牌色 */
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.m7-btn-plain:active {
|
|
111
|
+
background: var(--m7-btn-plain-bg-active); /* 应用朴素按钮按下背景色 */
|
|
112
|
+
transform: scale(0.97);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.m7-current,
|
|
116
|
+
.m7-current-theme-btn {
|
|
117
|
+
background: var(--m7-btn-plain-bg-hover); /* 应用朴素按钮悬停/当前背景色 */
|
|
118
|
+
color: var(--m7-primary); /* 应用主品牌色 */
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.m7-link {
|
|
122
|
+
border-radius: 0.375rem;
|
|
123
|
+
color: inherit; /* 继承父级文字颜色 */
|
|
124
|
+
margin: -0.15em;
|
|
125
|
+
padding: 0.15em;
|
|
126
|
+
text-decoration-line: underline;
|
|
127
|
+
text-decoration-style: dashed;
|
|
128
|
+
text-decoration-thickness: 2px;
|
|
129
|
+
text-decoration-color: var(--m7-link-underline); /* 应用链接下划线颜色 */
|
|
130
|
+
text-underline-offset: 0.25rem;
|
|
131
|
+
transition:
|
|
132
|
+
background-color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
133
|
+
color var(--m7-duration-fast) var(--m7-ease-standard),
|
|
134
|
+
text-decoration-color var(--m7-duration-fast) var(--m7-ease-standard);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.m7-link:hover {
|
|
138
|
+
background: var(--m7-link-hover); /* 应用链接悬停背景色 */
|
|
139
|
+
color: var(--m7-primary); /* 应用主品牌色 */
|
|
140
|
+
text-decoration-color: var(--m7-link-hover); /* 应用链接悬停装饰色 */
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.m7-link:active {
|
|
144
|
+
background: var(--m7-link-active); /* 应用链接按下背景色 */
|
|
145
|
+
text-decoration-color: var(--m7-link-active); /* 应用链接按下装饰色 */
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.m7-inline-code {
|
|
149
|
+
background: var(--m7-inline-code-bg); /* 应用行内代码背景色 */
|
|
150
|
+
border-radius: 0.35rem;
|
|
151
|
+
color: var(--m7-inline-code-color); /* 应用行内代码文字色 */
|
|
152
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
153
|
+
font-size: 0.9em;
|
|
154
|
+
padding: 0.12em 0.35em;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.m7-codeblock {
|
|
158
|
+
background: var(--m7-codeblock-bg); /* 应用代码块背景色 */
|
|
159
|
+
border-radius: 0.75rem;
|
|
160
|
+
color: rgba(255, 255, 255, 0.88); /* 代码块默认文字颜色 */
|
|
161
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
162
|
+
line-height: 1.6;
|
|
163
|
+
overflow: auto;
|
|
164
|
+
padding: 1rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.m7-text-strong {
|
|
168
|
+
color: var(--m7-text-strong); /* 应用强文本颜色 */
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.m7-text-regular {
|
|
172
|
+
color: var(--m7-text-regular); /* 应用常规文本色 */
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.m7-text-muted {
|
|
176
|
+
color: var(--m7-text-muted); /* 应用弱化文本颜色 */
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.m7-text-subtle {
|
|
180
|
+
color: var(--m7-text-subtle); /* 应用极弱文本颜色 */
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.m7-divider {
|
|
184
|
+
border-color: var(--m7-line-divider); /* 应用分割线颜色 */
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.m7-theme ::selection,
|
|
188
|
+
.m7-card ::selection,
|
|
189
|
+
.m7-float-panel ::selection {
|
|
190
|
+
background: var(--m7-selection-bg); /* 应用文本选中背景色 */
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.m7-scrollbar {
|
|
194
|
+
scrollbar-color: var(--m7-scrollbar-bg) transparent; /* 应用 Firefox 滚动条颜色与透明轨道 */
|
|
195
|
+
scrollbar-width: thin;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.m7-scrollbar::-webkit-scrollbar {
|
|
199
|
+
height: 8px;
|
|
200
|
+
width: 8px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.m7-scrollbar::-webkit-scrollbar-thumb {
|
|
204
|
+
background: var(--m7-scrollbar-bg); /* 应用滚动条默认颜色 */
|
|
205
|
+
border-radius: 999px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.m7-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
209
|
+
background: var(--m7-scrollbar-bg-hover); /* 应用滚动条悬停颜色 */
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.m7-scrollbar::-webkit-scrollbar-thumb:active {
|
|
213
|
+
background: var(--m7-scrollbar-bg-active); /* 应用滚动条按下颜色 */
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.m7-hue-slider {
|
|
217
|
+
appearance: none;
|
|
218
|
+
background: var(--m7-color-selection-bar); /* 应用主题色选择条渐变 */
|
|
219
|
+
border-radius: 0.375rem;
|
|
220
|
+
height: 1.5rem;
|
|
221
|
+
width: 100%;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.m7-hue-slider::-webkit-slider-thumb {
|
|
225
|
+
appearance: none;
|
|
226
|
+
background: rgba(255, 255, 255, 0.75); /* 滑块手柄半透明白色 */
|
|
227
|
+
border: 0; /* 无边框颜色 */
|
|
228
|
+
border-radius: 0.125rem;
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
height: 1rem;
|
|
231
|
+
width: 0.5rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.m7-hue-slider::-moz-range-thumb {
|
|
235
|
+
background: rgba(255, 255, 255, 0.75); /* 滑块手柄半透明白色 */
|
|
236
|
+
border: 0; /* 无边框颜色 */
|
|
237
|
+
border-radius: 0.125rem;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
height: 1rem;
|
|
240
|
+
width: 0.5rem;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.m7-container {
|
|
244
|
+
width: min(var(--m7-container-width), calc(100% - var(--m7-spacing-3xl)));
|
|
245
|
+
margin-inline: auto;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.m7-section { padding-block: var(--m7-spacing-5xl); }
|
|
249
|
+
.m7-stack { display: flex; flex-direction: column; gap: var(--m7-widget-gap); }
|
|
250
|
+
.m7-cluster { display: flex; flex-wrap: wrap; gap: var(--m7-spacing-sm); align-items: center; }
|
|
251
|
+
.m7-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--m7-widget-gap); }
|
|
252
|
+
.m7-sidebar-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--m7-widget-gap); }
|
|
253
|
+
|
|
254
|
+
@media (min-width: 768px) {
|
|
255
|
+
.m7-sidebar-layout { grid-template-columns: minmax(0, 1fr) var(--m7-sidebar-width); }
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.m7-surface {
|
|
259
|
+
background: var(--m7-card-bg-transparent); /* 通用半透明表面 */
|
|
260
|
+
border: 1px solid var(--m7-line-divider); /* 通用表面边框 */
|
|
261
|
+
border-radius: var(--m7-radius-2xl);
|
|
262
|
+
box-shadow: var(--m7-shadow-md);
|
|
263
|
+
color: var(--m7-text-regular); /* 表面默认文字颜色 */
|
|
264
|
+
backdrop-filter: blur(var(--m7-blur-md));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.m7-navbar {
|
|
268
|
+
position: sticky;
|
|
269
|
+
top: 0;
|
|
270
|
+
z-index: var(--m7-z-sticky);
|
|
271
|
+
background: color-mix(in oklch, var(--m7-card-bg) 78%, transparent); /* 导航栏半透明背景 */
|
|
272
|
+
border-bottom: 1px solid var(--m7-line-divider); /* 导航栏底部分割线 */
|
|
273
|
+
backdrop-filter: blur(var(--m7-blur-2xl));
|
|
274
|
+
box-shadow: var(--m7-shadow-sm);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.m7-hero {
|
|
278
|
+
position: relative;
|
|
279
|
+
overflow: hidden;
|
|
280
|
+
padding: clamp(var(--m7-spacing-4xl), 8vw, 7rem) var(--m7-spacing-lg);
|
|
281
|
+
border-radius: var(--m7-radius-3xl);
|
|
282
|
+
background:
|
|
283
|
+
radial-gradient(circle at 20% 15%, color-mix(in oklch, var(--m7-accent-pink) 22%, transparent), transparent 34%),
|
|
284
|
+
radial-gradient(circle at 80% 20%, color-mix(in oklch, var(--m7-primary) 24%, transparent), transparent 36%),
|
|
285
|
+
var(--m7-card-bg-transparent); /* 英雄区渐变表面 */
|
|
286
|
+
border: 1px solid var(--m7-line-divider); /* 英雄区边框 */
|
|
287
|
+
backdrop-filter: blur(var(--m7-blur-md));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.m7-input,
|
|
291
|
+
.m7-select,
|
|
292
|
+
.m7-textarea {
|
|
293
|
+
width: 100%;
|
|
294
|
+
min-height: 2.75rem;
|
|
295
|
+
padding: 0 var(--m7-spacing-lg);
|
|
296
|
+
border: 1px solid var(--m7-line-divider); /* 表单控件边框 */
|
|
297
|
+
border-radius: var(--m7-radius-xl);
|
|
298
|
+
outline: none;
|
|
299
|
+
background: var(--m7-btn-regular-bg); /* 表单控件背景 */
|
|
300
|
+
color: var(--m7-text-strong); /* 表单控件文字 */
|
|
301
|
+
font: inherit;
|
|
302
|
+
transition: border-color var(--m7-duration-fast) var(--m7-ease-standard), box-shadow var(--m7-duration-fast) var(--m7-ease-standard), background-color var(--m7-duration-fast) var(--m7-ease-standard);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.m7-textarea { min-height: 7rem; padding-block: var(--m7-spacing-md); resize: vertical; }
|
|
306
|
+
.m7-input:focus,
|
|
307
|
+
.m7-select:focus,
|
|
308
|
+
.m7-textarea:focus {
|
|
309
|
+
border-color: var(--m7-primary); /* 表单聚焦边框 */
|
|
310
|
+
box-shadow: 0 0 0 4px color-mix(in oklch, var(--m7-primary) 18%, transparent); /* 表单聚焦光晕 */
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.m7-badge {
|
|
314
|
+
display: inline-flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: var(--m7-spacing-xs);
|
|
317
|
+
padding: 0.25rem 0.6rem;
|
|
318
|
+
border: 1px solid var(--m7-line-divider); /* 徽章边框 */
|
|
319
|
+
border-radius: var(--m7-radius-full);
|
|
320
|
+
background: var(--m7-btn-regular-bg); /* 徽章背景 */
|
|
321
|
+
color: var(--m7-content-meta); /* 徽章文字 */
|
|
322
|
+
font-size: 0.8125rem;
|
|
323
|
+
font-weight: 600;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.m7-scale-hover { transition: transform var(--m7-duration-fast) var(--m7-ease-standard); }
|
|
327
|
+
.m7-scale-hover:hover { transform: scale(var(--m7-scale-105)); }
|
|
328
|
+
.m7-pressable { transition: transform var(--m7-duration-fast) var(--m7-ease-standard); }
|
|
329
|
+
.m7-pressable:active { transform: scale(var(--m7-scale-95)); }
|
|
330
|
+
.m7-gpu { transform: var(--m7-gpu-transform); backface-visibility: hidden; }
|
|
331
|
+
|
|
332
|
+
/* ===== March7th Base Styles ===== */
|
|
333
|
+
.m7-theme,
|
|
334
|
+
.m7-theme * ,
|
|
335
|
+
.m7-theme *::before,
|
|
336
|
+
.m7-theme *::after {
|
|
337
|
+
box-sizing: border-box;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.m7-theme {
|
|
341
|
+
min-height: 100vh;
|
|
342
|
+
margin: 0;
|
|
343
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
|
344
|
+
font-size: 16px;
|
|
345
|
+
line-height: 1.65;
|
|
346
|
+
text-rendering: optimizeLegibility;
|
|
347
|
+
-webkit-font-smoothing: antialiased;
|
|
348
|
+
-moz-osx-font-smoothing: grayscale;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.m7-theme :where(h1, h2, h3, h4, h5, h6) {
|
|
352
|
+
margin: 0 0 var(--m7-spacing-md);
|
|
353
|
+
color: var(--m7-text-strong); /* 标题文字颜色 */
|
|
354
|
+
font-weight: 750;
|
|
355
|
+
line-height: 1.2;
|
|
356
|
+
letter-spacing: -0.025em;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.m7-theme :where(h1) { font-size: clamp(2rem, 5vw, 4rem); }
|
|
360
|
+
.m7-theme :where(h2) { font-size: clamp(1.5rem, 3vw, 2.25rem); }
|
|
361
|
+
.m7-theme :where(h3) { font-size: clamp(1.25rem, 2vw, 1.5rem); }
|
|
362
|
+
.m7-theme :where(p) { margin: 0 0 var(--m7-spacing-lg); color: var(--m7-text-regular); /* 段落文字颜色 */ }
|
|
363
|
+
.m7-theme :where(small) { color: var(--m7-text-muted); /* 小号辅助文字颜色 */ }
|
|
364
|
+
.m7-theme :where(strong, b) { color: var(--m7-text-strong); /* 加粗强调文字颜色 */ }
|
|
365
|
+
.m7-theme :where(hr) { height: 1px; margin: var(--m7-spacing-2xl) 0; border: 0; background: var(--m7-line-divider); /* 水平分割线颜色 */ }
|
|
366
|
+
|
|
367
|
+
.m7-theme :where(a:not(.m7-btn):not(.m7-btn-regular):not(.m7-btn-plain):not(.m7-link)) {
|
|
368
|
+
color: var(--m7-primary); /* 默认链接文字颜色 */
|
|
369
|
+
text-decoration-color: var(--m7-link-underline); /* 默认链接下划线颜色 */
|
|
370
|
+
text-underline-offset: 0.2em;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.m7-theme :where(a:not(.m7-btn):not(.m7-btn-regular):not(.m7-btn-plain):not(.m7-link):hover) {
|
|
374
|
+
color: var(--m7-primary); /* 默认链接悬停文字颜色 */
|
|
375
|
+
text-decoration-color: var(--m7-primary); /* 默认链接悬停下划线颜色 */
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.m7-theme :where(ul, ol) { margin: 0 0 var(--m7-spacing-lg); padding-left: 1.35em; color: var(--m7-text-regular); /* 列表文字颜色 */ }
|
|
379
|
+
.m7-theme :where(li + li) { margin-top: var(--m7-spacing-xs); }
|
|
380
|
+
.m7-theme :where(blockquote) {
|
|
381
|
+
margin: var(--m7-spacing-xl) 0;
|
|
382
|
+
padding: var(--m7-spacing-md) var(--m7-spacing-lg);
|
|
383
|
+
border-left: 4px solid var(--m7-primary); /* 引用块强调边框颜色 */
|
|
384
|
+
border-radius: var(--m7-radius-lg);
|
|
385
|
+
background: var(--m7-btn-regular-bg); /* 引用块背景色 */
|
|
386
|
+
color: var(--m7-text-regular); /* 引用块文字颜色 */
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.m7-theme :where(img, svg, video, canvas) { max-width: 100%; height: auto; }
|
|
390
|
+
.m7-theme :where(img, video) { border-radius: var(--m7-radius-xl); }
|
|
391
|
+
.m7-theme :where(figure) { margin: 0 0 var(--m7-spacing-xl); }
|
|
392
|
+
.m7-theme :where(figcaption) { margin-top: var(--m7-spacing-sm); color: var(--m7-text-muted); /* 媒体说明文字颜色 */ font-size: 0.875rem; text-align: center; }
|
|
393
|
+
|
|
394
|
+
.m7-theme :where(table) {
|
|
395
|
+
width: 100%;
|
|
396
|
+
border-collapse: collapse;
|
|
397
|
+
border: 1px solid var(--m7-line-divider); /* 表格外边框颜色 */
|
|
398
|
+
border-radius: var(--m7-radius-xl);
|
|
399
|
+
overflow: hidden;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.m7-theme :where(th, td) {
|
|
403
|
+
padding: var(--m7-spacing-sm) var(--m7-spacing-md);
|
|
404
|
+
border-bottom: 1px solid var(--m7-line-divider); /* 表格行分割线颜色 */
|
|
405
|
+
text-align: left;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.m7-theme :where(th) {
|
|
409
|
+
background: var(--m7-btn-regular-bg); /* 表头背景色 */
|
|
410
|
+
color: var(--m7-text-strong); /* 表头文字颜色 */
|
|
411
|
+
font-weight: 700;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.m7-theme :where(td) { color: var(--m7-text-regular); /* 表格内容文字颜色 */ }
|
|
415
|
+
.m7-theme :where(tr:last-child td) { border-bottom: 0; }
|
|
416
|
+
.m7-theme :where(code:not(.m7-inline-code)) { background: var(--m7-inline-code-bg); color: var(--m7-inline-code-color); border-radius: var(--m7-radius-md); padding: 0.12em 0.35em; font-size: 0.9em; }
|
|
417
|
+
.m7-theme :where(pre:not(.m7-codeblock)) { background: var(--m7-codeblock-bg); color: rgba(255, 255, 255, 0.88); border-radius: var(--m7-radius-xl); overflow: auto; padding: var(--m7-spacing-lg); }
|
|
418
|
+
|
|
419
|
+
.m7-theme :where(button, input, select, textarea) { font: inherit; }
|
|
420
|
+
.m7-theme :where(button) { cursor: pointer; }
|
|
421
|
+
.m7-theme :where(:focus-visible) { outline: 3px solid color-mix(in oklch, var(--m7-primary) 50%, transparent); outline-offset: 3px; }
|
|
422
|
+
|
|
423
|
+
.m7-prose { color: var(--m7-text-regular); }
|
|
424
|
+
.m7-prose > * + * { margin-top: var(--m7-spacing-lg); }
|
|
425
|
+
.m7-prose :where(p, ul, ol, blockquote, table, figure, pre) { margin-bottom: 0; }
|
|
426
|
+
|
|
427
|
+
@media (max-width: 767px) {
|
|
428
|
+
.m7-theme { font-size: 15px; }
|
|
429
|
+
.m7-section { padding-block: var(--m7-spacing-3xl); }
|
|
430
|
+
.m7-container { width: min(var(--m7-container-width), calc(100% - var(--m7-spacing-xl))); }
|
|
431
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mar7th/march7th-ui",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"packageManager": "pnpm@10.12.4"
|
|
13
|
+
}
|
package/src/index.html
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>March7th Theme Preview</title>
|
|
7
|
+
<script>
|
|
8
|
+
(function(){var p="m7-theme",m=localStorage.getItem(p+":mode")||"system",h=localStorage.getItem(p+":hue")||"215",r=m==="system"?(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"):m;document.documentElement.style.setProperty("--m7-hue",h);document.documentElement.classList.toggle("m7-dark",r==="dark");document.documentElement.setAttribute("data-m7-mode",m);document.documentElement.setAttribute("data-m7-resolved-mode",r);})();
|
|
9
|
+
</script>
|
|
10
|
+
<link rel="stylesheet" href="../demo/march7th-tokens.css" />
|
|
11
|
+
<link rel="stylesheet" href="../demo/march7th-ui.css" />
|
|
12
|
+
<script src="../demo/march7th-theme.js" defer></script>
|
|
13
|
+
<script src="../demo/march7th-components.js" defer></script>
|
|
14
|
+
<style>
|
|
15
|
+
body{margin:0}.preview-bg{position:relative;isolation:isolate;min-height:100vh;overflow:hidden}.preview-bg:before,.preview-bg:after{position:fixed;z-index:-1;content:"";border-radius:999px;filter:blur(16px);pointer-events:none}.preview-bg:before{top:-12rem;right:-10rem;width:34rem;height:34rem;background:color-mix(in oklch,var(--m7-primary) 32%,transparent)}.preview-bg:after{bottom:-14rem;left:-9rem;width:34rem;height:34rem;background:color-mix(in oklch,var(--m7-accent-pink) 24%,transparent)}.preview-pad{padding:var(--m7-spacing-2xl) 0 var(--m7-spacing-5xl)}.preview-card{padding:var(--m7-spacing-xl)}.preview-hero-title{max-width:11em;font-size:clamp(2.4rem,7vw,5.2rem);line-height:.96;letter-spacing:-.07em}.preview-eyebrow{display:inline-flex;gap:.5rem;align-items:center;margin:0 0 1rem;padding:.35rem .7rem;border:1px solid var(--m7-line-divider);border-radius:var(--m7-radius-full);color:var(--m7-primary);font-size:.875rem;font-weight:700}.preview-dot{width:.55rem;height:.55rem;border-radius:var(--m7-radius-full);background:var(--m7-primary);box-shadow:0 0 1rem var(--m7-primary)}.preview-side{display:grid;gap:var(--m7-widget-gap)}.preview-row{display:flex;justify-content:space-between;gap:1rem;color:var(--m7-text-muted)}.preview-row strong{color:var(--m7-primary);font-size:1.3rem}.swatches{display:grid;grid-template-columns:repeat(6,1fr);gap:var(--m7-spacing-sm)}.swatch{min-height:4.5rem;padding:.6rem;border:1px solid var(--m7-line-divider);border-radius:var(--m7-radius-xl);font-size:.75rem;font-weight:800}.primary{background:var(--m7-primary);color:#fff}.pink{background:var(--m7-accent-pink);color:#fff}.purple{background:var(--m7-accent-purple);color:#fff}.ice{background:var(--m7-accent-ice);color:rgba(0,0,0,.7)}.cardbg{background:var(--m7-card-bg);color:var(--m7-text-regular)}.pagebg{background:var(--m7-page-bg);color:var(--m7-text-regular)}.admonitions{display:grid;grid-template-columns:repeat(5,1fr);gap:var(--m7-spacing-sm)}.ad{padding:var(--m7-spacing-md);border:1px solid var(--m7-line-divider);border-radius:var(--m7-radius-xl);background:var(--m7-card-bg-transparent)}.ad strong{display:block}.ad span{color:var(--m7-text-muted);font-size:.85rem}.tip strong{color:var(--m7-admonitions-color-tip)}.note strong{color:var(--m7-admonitions-color-note)}.important strong{color:var(--m7-admonitions-color-important)}.warning strong{color:var(--m7-admonitions-color-warning)}.caution strong{color:var(--m7-admonitions-color-caution)}.preview-table-wrap{overflow:auto}.preview-img{width:100%;aspect-ratio:16/9;background:linear-gradient(135deg,color-mix(in oklch,var(--m7-primary) 28%,transparent),color-mix(in oklch,var(--m7-accent-pink) 22%,transparent)),var(--m7-btn-regular-bg)}@media(max-width:900px){.swatches{grid-template-columns:repeat(3,1fr)}.admonitions{grid-template-columns:1fr}}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
<body class="m7-theme m7-scrollbar">
|
|
19
|
+
<div class="preview-bg">
|
|
20
|
+
<nav class="m7-navbar">
|
|
21
|
+
<div class="m7-container m7-cluster" style="min-height:4.5rem;justify-content:space-between">
|
|
22
|
+
<strong class="m7-text-strong">March7th UI</strong>
|
|
23
|
+
<div class="m7-cluster">
|
|
24
|
+
<a class="m7-link" href="#colors">色彩</a>
|
|
25
|
+
<a class="m7-link" href="#base">基础样式</a>
|
|
26
|
+
<a class="m7-link" href="#components">组件</a>
|
|
27
|
+
<a class="m7-link" href="#custom-elements">自定义标签</a>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</nav>
|
|
31
|
+
|
|
32
|
+
<main class="m7-container preview-pad m7-stack">
|
|
33
|
+
<section class="m7-sidebar-layout">
|
|
34
|
+
<div class="m7-hero">
|
|
35
|
+
<p class="preview-eyebrow"><span class="preview-dot"></span>March7th Theme Preview</p>
|
|
36
|
+
<h1 class="preview-hero-title">三月七 UI 风格设计预览</h1>
|
|
37
|
+
<p class="m7-text-regular">这份预览展示了主题色、基础排版、常规 HTML 元素、表单、布局、组件与响应式效果。其它站点引入 CSS/JS 后即可复用这套轻量底层 UI 风格。</p>
|
|
38
|
+
<div class="m7-cluster">
|
|
39
|
+
<button class="m7-btn m7-pressable" data-mode="light">浅色模式</button>
|
|
40
|
+
<button class="m7-btn m7-pressable" data-mode="dark">暗色模式</button>
|
|
41
|
+
<button class="m7-btn m7-pressable" data-mode="system">跟随系统</button>
|
|
42
|
+
<button class="m7-btn-plain m7-pressable" id="resetTheme">重置</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<aside class="preview-side">
|
|
47
|
+
<section class="m7-card preview-card">
|
|
48
|
+
<h2>主题色相</h2>
|
|
49
|
+
<p class="preview-row"><span>当前 hue</span><strong id="hueValue">215</strong></p>
|
|
50
|
+
<input id="hueSlider" class="m7-hue-slider" type="range" min="0" max="360" step="5" />
|
|
51
|
+
</section>
|
|
52
|
+
<section class="m7-card preview-card">
|
|
53
|
+
<h2>模式状态</h2>
|
|
54
|
+
<p class="preview-row"><span>存储模式</span><code id="storedMode">system</code></p>
|
|
55
|
+
<p class="preview-row"><span>实际模式</span><code id="resolvedMode">light</code></p>
|
|
56
|
+
</section>
|
|
57
|
+
</aside>
|
|
58
|
+
</section>
|
|
59
|
+
|
|
60
|
+
<section id="colors" class="m7-card preview-card m7-stack">
|
|
61
|
+
<h2>核心色板</h2>
|
|
62
|
+
<div class="swatches">
|
|
63
|
+
<div class="swatch primary">primary</div><div class="swatch pink">accent pink</div><div class="swatch purple">accent purple</div><div class="swatch ice">accent ice</div><div class="swatch cardbg">card bg</div><div class="swatch pagebg">page bg</div>
|
|
64
|
+
</div>
|
|
65
|
+
</section>
|
|
66
|
+
|
|
67
|
+
<section id="base" class="m7-grid">
|
|
68
|
+
<article class="m7-card preview-card m7-prose">
|
|
69
|
+
<h2>基础排版</h2>
|
|
70
|
+
<p><strong>强文本</strong>、常规正文、<small>辅助文字</small> 和 <a href="#">默认链接</a> 都已提供底层样式。</p>
|
|
71
|
+
<blockquote>这是 blockquote 引用块,使用主题主色作为左侧强调边。</blockquote>
|
|
72
|
+
<ul><li>无序列表项目</li><li>自动使用正文颜色</li></ul>
|
|
73
|
+
<ol><li>有序列表项目</li><li>保持统一间距</li></ol>
|
|
74
|
+
</article>
|
|
75
|
+
|
|
76
|
+
<article class="m7-card preview-card m7-prose">
|
|
77
|
+
<h2>媒体与说明</h2>
|
|
78
|
+
<figure>
|
|
79
|
+
<div class="preview-img"></div>
|
|
80
|
+
<figcaption>图片、视频和说明文字的常规样式预览</figcaption>
|
|
81
|
+
</figure>
|
|
82
|
+
<hr />
|
|
83
|
+
<p>水平分割线、图片圆角、说明文字颜色都已纳入底层样式。</p>
|
|
84
|
+
</article>
|
|
85
|
+
|
|
86
|
+
<article class="m7-card preview-card m7-prose">
|
|
87
|
+
<h2>表单控件</h2>
|
|
88
|
+
<input class="m7-input" value="Lovely March7th!" />
|
|
89
|
+
<select class="m7-select"><option>March7th Blue</option><option>Memory Pink</option></select>
|
|
90
|
+
<textarea class="m7-textarea">Memory of Everything</textarea>
|
|
91
|
+
<button class="m7-btn">提交</button>
|
|
92
|
+
</article>
|
|
93
|
+
</section>
|
|
94
|
+
|
|
95
|
+
<section id="components" class="m7-grid">
|
|
96
|
+
<article class="m7-card preview-card">
|
|
97
|
+
<h2>按钮、徽章与链接</h2>
|
|
98
|
+
<p>这是一段包含 <a class="m7-link" href="#">主题链接</a> 的示例文本。</p>
|
|
99
|
+
<div class="m7-cluster"><button class="m7-btn">主要按钮</button><button class="m7-btn-plain">朴素按钮</button><span class="m7-badge">Badge</span><span class="m7-badge">OKLCH</span></div>
|
|
100
|
+
</article>
|
|
101
|
+
|
|
102
|
+
<article class="m7-card preview-card">
|
|
103
|
+
<h2>表格</h2>
|
|
104
|
+
<div class="preview-table-wrap"><table><thead><tr><th>变量</th><th>用途</th></tr></thead><tbody><tr><td><code>--m7-primary</code></td><td>主品牌色</td></tr><tr><td><code>--m7-card-bg</code></td><td>卡片背景</td></tr><tr><td><code>--m7-widget-gap</code></td><td>响应式组件间距</td></tr></tbody></table></div>
|
|
105
|
+
</article>
|
|
106
|
+
|
|
107
|
+
<article class="m7-surface preview-card">
|
|
108
|
+
<h2>Surface 表面</h2>
|
|
109
|
+
<p>半透明表面适合放在壁纸或渐变背景上,包含边框、阴影和毛玻璃。</p>
|
|
110
|
+
<div class="m7-cluster"><span class="m7-badge">Glass</span><span class="m7-badge">Responsive</span></div>
|
|
111
|
+
</article>
|
|
112
|
+
</section>
|
|
113
|
+
|
|
114
|
+
<section id="custom-elements" class="m7-card preview-card m7-stack">
|
|
115
|
+
<h2>自定义 HTML 标签组件</h2>
|
|
116
|
+
<p class="m7-text-regular">通过 <code>march7th-components.js</code> 注册 Web Components,不依赖框架,直接使用主题变量和 UI 类。</p>
|
|
117
|
+
<m7-marquee text="March7th Theme · Memory of Everything · Lovely March7th · To travel far away ·" speed="22s"></m7-marquee>
|
|
118
|
+
<div class="m7-grid">
|
|
119
|
+
<m7-carousel height="260px" items="Memory of Everything|Lovely March7th|Sleep Tight, the Night Dreams Long|Wake Up, the Tomorrow is Yours"></m7-carousel>
|
|
120
|
+
<div class="m7-stack">
|
|
121
|
+
<m7-notice type="tip" title="自定义标签示例">这是 <code><m7-notice></code>,适合用于提示、公告和说明。</m7-notice>
|
|
122
|
+
<m7-notice type="warning" title="无需框架">这些组件只依赖浏览器原生 Custom Elements,可以在任意站点中使用。</m7-notice>
|
|
123
|
+
<m7-tags items="Web Components|Carousel|Marquee|Notice|Theme Tokens"></m7-tags>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<pre><code><script src="/theme/march7th-components.js" defer></script>
|
|
127
|
+
|
|
128
|
+
<m7-marquee text="March7th Theme · Lovely March7th"></m7-marquee>
|
|
129
|
+
<m7-carousel items="Memory|Lovely|Tomorrow"></m7-carousel>
|
|
130
|
+
<m7-notice type="tip" title="提示">内容</m7-notice>
|
|
131
|
+
<m7-tags items="OKLCH|Design Tokens|Web Components"></m7-tags></code></pre>
|
|
132
|
+
</section>
|
|
133
|
+
|
|
134
|
+
<section class="m7-card preview-card m7-stack">
|
|
135
|
+
<h2>语义提示色</h2>
|
|
136
|
+
<div class="admonitions"><div class="ad tip"><strong>Tip</strong><span>青色提示</span></div><div class="ad note"><strong>Note</strong><span>蓝色备注</span></div><div class="ad important"><strong>Important</strong><span>紫色重点</span></div><div class="ad warning"><strong>Warning</strong><span>黄色警告</span></div><div class="ad caution"><strong>Caution</strong><span>红色谨慎</span></div></div>
|
|
137
|
+
</section>
|
|
138
|
+
|
|
139
|
+
<section class="m7-grid">
|
|
140
|
+
<article class="m7-card preview-card" style="grid-column:span 2">
|
|
141
|
+
<h2>代码块</h2>
|
|
142
|
+
<pre><code>const theme = {
|
|
143
|
+
hue: March7thTheme.getHue(),
|
|
144
|
+
mode: March7thTheme.getMode(),
|
|
145
|
+
resolvedMode: March7thTheme.getResolvedMode(),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
March7thTheme.setMode("system");
|
|
149
|
+
March7thTheme.setHue(215);</code></pre>
|
|
150
|
+
</article>
|
|
151
|
+
<article class="m7-card-transparent preview-card">
|
|
152
|
+
<h2>透明卡片</h2>
|
|
153
|
+
<p><code>.m7-card-transparent</code> 适合放在壁纸、渐变和 Banner 上。</p>
|
|
154
|
+
</article>
|
|
155
|
+
</section>
|
|
156
|
+
|
|
157
|
+
<p class="m7-text-muted" style="text-align:center">预览文件:<code>/theme/march7th-theme-preview.html</code></p>
|
|
158
|
+
</main>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<script>
|
|
162
|
+
function sync(){if(!window.March7thTheme)return;var h=March7thTheme.getHue(),m=March7thTheme.getMode(),r=March7thTheme.getResolvedMode();hueValue.textContent=h;hueSlider.value=h;storedMode.textContent=m;resolvedMode.textContent=r;document.querySelectorAll("[data-mode]").forEach(function(b){b.classList.toggle("m7-current",b.dataset.mode===m)})}
|
|
163
|
+
addEventListener("march7th-theme-ready",sync);addEventListener("march7th-theme-change",sync);addEventListener("march7th-hue-change",sync);addEventListener("DOMContentLoaded",function(){document.querySelectorAll("[data-mode]").forEach(function(b){b.addEventListener("click",function(){March7thTheme.setMode(b.dataset.mode);sync()})});hueSlider.addEventListener("input",function(e){March7thTheme.setHue(e.target.value);sync()});resetTheme.addEventListener("click",function(){March7thTheme.reset();sync()});sync()});
|
|
164
|
+
</script>
|
|
165
|
+
</body>
|
|
166
|
+
</html>
|