@fox-js/foxui 4.0.1-94 → 4.0.1-95
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/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +5840 -6186
- package/dist/index.umd.js +2 -2
- package/dist/locale/index.d.ts +0 -90
- package/dist/locale/index.esm.js +0 -78
- package/dist/locale/index.umd.js +1 -1
- package/dist/style.css +481 -772
- package/dist/style.js +1 -1
- package/dist/theme/common/base.scss +39 -0
- package/dist/theme/common/border.scss +16 -0
- package/dist/theme/common/color.scss +126 -0
- package/dist/theme/common/fill.scss +25 -0
- package/dist/theme/common/shadow.scss +28 -0
- package/dist/theme/common/typography.scss +38 -0
- package/dist/theme/common/var.scss +6 -0
- package/dist/theme/components/actionsheet.scss +49 -0
- package/dist/theme/components/avatar.scss +15 -0
- package/dist/theme/components/backtop.scss +10 -0
- package/dist/theme/components/badge.scss +23 -0
- package/dist/theme/components/button.scss +97 -0
- package/dist/theme/components/buttons-item.scss +12 -0
- package/dist/theme/components/calendar.scss +31 -0
- package/dist/theme/components/card.scss +16 -0
- package/dist/theme/components/cascader.scss +23 -0
- package/dist/theme/components/cell.scss +44 -0
- package/dist/theme/components/checkbox.scss +35 -0
- package/dist/theme/components/circleprogress.scss +16 -0
- package/dist/theme/components/collapse.scss +24 -0
- package/dist/theme/components/content.scss +10 -0
- package/dist/theme/components/countdown.scss +11 -0
- package/dist/theme/components/dialog.scss +48 -0
- package/dist/theme/components/divider.scss +22 -0
- package/dist/theme/components/elevator.scss +49 -0
- package/dist/theme/components/ellipsis.scss +10 -0
- package/dist/theme/components/empty.scss +18 -0
- package/dist/theme/components/fixednav.scss +14 -0
- package/dist/theme/components/floating-button.scss +23 -0
- package/dist/theme/components/footer-bar.scss +16 -0
- package/dist/theme/components/footer.scss +11 -0
- package/dist/theme/components/form.scss +24 -0
- package/dist/theme/components/grid.scss +18 -0
- package/dist/theme/components/group.scss +28 -0
- package/dist/theme/components/header-bar.scss +36 -0
- package/dist/theme/components/hint-text.scss +22 -0
- package/dist/theme/components/icon.scss +11 -0
- package/dist/theme/components/index.scss +75 -0
- package/dist/theme/components/indicator.scss +18 -0
- package/dist/theme/components/infiniteloading.scss +12 -0
- package/dist/theme/components/input-number.scss +38 -0
- package/dist/theme/components/input.scss +61 -0
- package/dist/theme/components/link-item.scss +15 -0
- package/dist/theme/components/list.scss +9 -0
- package/dist/theme/components/menu.scss +31 -0
- package/dist/theme/components/messagebox.scss +55 -0
- package/dist/theme/components/navbar.scss +24 -0
- package/dist/theme/components/noticebar.scss +20 -0
- package/dist/theme/components/notify.scss +21 -0
- package/dist/theme/components/numberkeyboard.scss +30 -0
- package/dist/theme/components/pagination.scss +22 -0
- package/dist/theme/components/picker.scss +24 -0
- package/dist/theme/components/popover-dialog.scss +23 -0
- package/dist/theme/components/popover.scss +20 -0
- package/dist/theme/components/popup-wrapper.scss +40 -0
- package/dist/theme/components/popup.scss +13 -0
- package/dist/theme/components/price.scss +19 -0
- package/dist/theme/components/progress.scss +32 -0
- package/dist/theme/components/radio.scss +33 -0
- package/dist/theme/components/range.scss +18 -0
- package/dist/theme/components/rate.scss +13 -0
- package/dist/theme/components/row-item.scss +14 -0
- package/dist/theme/components/searchbar.scss +28 -0
- package/dist/theme/components/shortpassword.scss +17 -0
- package/dist/theme/components/sidenavbar.scss +27 -0
- package/dist/theme/components/skeleton.scss +10 -0
- package/dist/theme/components/slot-item.scss +10 -0
- package/dist/theme/components/steps-bar.scss +55 -0
- package/dist/theme/components/steps.scss +36 -0
- package/dist/theme/components/swiper.scss +12 -0
- package/dist/theme/components/switch-item.scss +9 -0
- package/dist/theme/components/switch.scss +20 -0
- package/dist/theme/components/tabbar.scss +21 -0
- package/dist/theme/components/table.scss +15 -0
- package/dist/theme/components/tabs-bar.scss +110 -0
- package/dist/theme/components/tabs-frame.scss +9 -0
- package/dist/theme/components/tag.scss +41 -0
- package/dist/theme/components/text.scss +36 -0
- package/dist/theme/components/textarea.scss +18 -0
- package/dist/theme/components/toast.scss +18 -0
- package/dist/theme/components/trendarrow.scss +12 -0
- package/dist/theme/components/uploader.scss +12 -0
- package/dist/theme/components/watermark.scss +9 -0
- package/dist/theme/dark/css-vars.scss +27 -0
- package/dist/theme/dark/var.scss +77 -0
- package/dist/theme/index.scss +248 -0
- package/dist/theme/mixins/_css-var.scss +39 -0
- package/dist/theme/mixins/index.scss +1 -0
- package/dist/theme/readme.md +359 -0
- package/dist/types/index.d.ts +146 -114
- package/package.json +3 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use './common/color' as *;
|
|
3
|
+
@use './common/typography' as *;
|
|
4
|
+
@use './common/border' as *;
|
|
5
|
+
@use './common/fill' as *;
|
|
6
|
+
@use './common/shadow' as *;
|
|
7
|
+
@use './common/base' as *;
|
|
8
|
+
@use './mixins/css-var' as *;
|
|
9
|
+
@use './components/actionsheet' as *;
|
|
10
|
+
@use './components/avatar' as *;
|
|
11
|
+
@use './components/backtop' as *;
|
|
12
|
+
@use './components/badge' as *;
|
|
13
|
+
@use './components/button' as *;
|
|
14
|
+
@use './components/buttons-item' as *;
|
|
15
|
+
@use './components/calendar' as *;
|
|
16
|
+
@use './components/card' as *;
|
|
17
|
+
@use './components/cascader' as *;
|
|
18
|
+
@use './components/cell' as *;
|
|
19
|
+
@use './components/checkbox' as *;
|
|
20
|
+
@use './components/circleprogress' as *;
|
|
21
|
+
@use './components/collapse' as *;
|
|
22
|
+
@use './components/content' as *;
|
|
23
|
+
@use './components/countdown' as *;
|
|
24
|
+
@use './components/dialog' as *;
|
|
25
|
+
@use './components/divider' as *;
|
|
26
|
+
@use './components/elevator' as *;
|
|
27
|
+
@use './components/ellipsis' as *;
|
|
28
|
+
@use './components/empty' as *;
|
|
29
|
+
@use './components/fixednav' as *;
|
|
30
|
+
@use './components/floating-button' as *;
|
|
31
|
+
@use './components/footer' as *;
|
|
32
|
+
@use './components/footer-bar' as *;
|
|
33
|
+
@use './components/form' as *;
|
|
34
|
+
@use './components/grid' as *;
|
|
35
|
+
@use './components/group' as *;
|
|
36
|
+
@use './components/header-bar' as *;
|
|
37
|
+
@use './components/hint-text' as *;
|
|
38
|
+
@use './components/icon' as *;
|
|
39
|
+
@use './components/indicator' as *;
|
|
40
|
+
@use './components/infiniteloading' as *;
|
|
41
|
+
@use './components/input' as *;
|
|
42
|
+
@use './components/input-number' as *;
|
|
43
|
+
@use './components/link-item' as *;
|
|
44
|
+
@use './components/list' as *;
|
|
45
|
+
@use './components/menu' as *;
|
|
46
|
+
@use './components/messagebox' as *;
|
|
47
|
+
@use './components/navbar' as *;
|
|
48
|
+
@use './components/noticebar' as *;
|
|
49
|
+
@use './components/notify' as *;
|
|
50
|
+
@use './components/numberkeyboard' as *;
|
|
51
|
+
@use './components/pagination' as *;
|
|
52
|
+
@use './components/picker' as *;
|
|
53
|
+
@use './components/popover' as *;
|
|
54
|
+
@use './components/popover-dialog' as *;
|
|
55
|
+
@use './components/popup' as *;
|
|
56
|
+
@use './components/popup-wrapper' as *;
|
|
57
|
+
@use './components/price' as *;
|
|
58
|
+
@use './components/progress' as *;
|
|
59
|
+
@use './components/radio' as *;
|
|
60
|
+
@use './components/range' as *;
|
|
61
|
+
@use './components/rate' as *;
|
|
62
|
+
@use './components/row-item' as *;
|
|
63
|
+
@use './components/searchbar' as *;
|
|
64
|
+
@use './components/shortpassword' as *;
|
|
65
|
+
@use './components/sidenavbar' as *;
|
|
66
|
+
@use './components/skeleton' as *;
|
|
67
|
+
@use './components/slot-item' as *;
|
|
68
|
+
@use './components/steps' as *;
|
|
69
|
+
@use './components/steps-bar' as *;
|
|
70
|
+
@use './components/swiper' as *;
|
|
71
|
+
@use './components/switch' as *;
|
|
72
|
+
@use './components/switch-item' as *;
|
|
73
|
+
@use './components/tabbar' as *;
|
|
74
|
+
@use './components/table' as *;
|
|
75
|
+
@use './components/tabs-bar' as *;
|
|
76
|
+
@use './components/tabs-frame' as *;
|
|
77
|
+
@use './components/tag' as *;
|
|
78
|
+
@use './components/text' as *;
|
|
79
|
+
@use './components/textarea' as *;
|
|
80
|
+
@use './components/toast' as *;
|
|
81
|
+
@use './components/trendarrow' as *;
|
|
82
|
+
@use './components/uploader' as *;
|
|
83
|
+
@use './components/watermark' as *;
|
|
84
|
+
|
|
85
|
+
:root {
|
|
86
|
+
// colors
|
|
87
|
+
@include gen-color-css-vars($colors);
|
|
88
|
+
// 补充不生成的变量
|
|
89
|
+
--fox-color-primary: #{$color-primary};
|
|
90
|
+
--fox-color-success: #{$color-success};
|
|
91
|
+
--fox-color-warning: #{$color-warning};
|
|
92
|
+
--fox-color-danger: #{$color-danger};
|
|
93
|
+
--fox-color-info: #{$color-info};
|
|
94
|
+
|
|
95
|
+
// text-color
|
|
96
|
+
@each $type, $value in $text-color {
|
|
97
|
+
--fox-text-color-#{$type}: #{$value};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// border color
|
|
101
|
+
@each $type, $value in $border-color {
|
|
102
|
+
--fox-border-color-#{$type}: #{$value};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// fill color
|
|
106
|
+
@each $type, $value in $fill-color {
|
|
107
|
+
--fox-fill-color-#{$type}: #{$value};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// white color
|
|
111
|
+
--fox-white: #{$white};
|
|
112
|
+
// back color
|
|
113
|
+
--fox-black: #{$black};
|
|
114
|
+
// 填充色
|
|
115
|
+
--fox-fill-color-base: #{$fill-color-base};
|
|
116
|
+
// 背景色
|
|
117
|
+
--fox-background-color: #{$background-color};
|
|
118
|
+
// 标题常规文字色
|
|
119
|
+
--fox-title-color: #{$title-color};
|
|
120
|
+
// 副标题色
|
|
121
|
+
--fox-title-color-secondary: #{$title-color-secondary};
|
|
122
|
+
// 常规文字色
|
|
123
|
+
--fox-text-color-regular: #{$text-color-regular};
|
|
124
|
+
// 次要文字色
|
|
125
|
+
--fox-text-color-secondary: #{$text-color-secondary};
|
|
126
|
+
// 特殊禁用色
|
|
127
|
+
--fox-disabled-color: #{$disabled-color};
|
|
128
|
+
// 只读颜色
|
|
129
|
+
--fox-readonly-color: #{$readonly-color};
|
|
130
|
+
// 必输颜色
|
|
131
|
+
--fox-required-colo: #{$required-color};
|
|
132
|
+
|
|
133
|
+
// font size
|
|
134
|
+
--fox-font-size-extra-small: #{$font-size-extra-small};
|
|
135
|
+
--fox-font-size-small: #{$font-size-small};
|
|
136
|
+
--fox-font-size-base: #{$font-size-base};
|
|
137
|
+
--fox-font-size-medium: #{$font-size-medium};
|
|
138
|
+
--fox-font-size-large: #{$font-size-large};
|
|
139
|
+
--fox-font-size-extra-large: #{$font-size-extra-large};
|
|
140
|
+
--fox-font-weight-bold: #{$font-weight-bold};
|
|
141
|
+
--fox-line-height-base: #{$line-height-base};
|
|
142
|
+
|
|
143
|
+
// 动画
|
|
144
|
+
--fox-animation-duration: #{$animation-duration};
|
|
145
|
+
--fox-animation-timing-fun: #{$animation-timing-fun};
|
|
146
|
+
|
|
147
|
+
// font family
|
|
148
|
+
--fox-font-family: #{$font-family};
|
|
149
|
+
|
|
150
|
+
// box shadow
|
|
151
|
+
--fox-box-shadow-light: #{$box-shadow-light};
|
|
152
|
+
--fox-box-shadow-lighter: #{$box-shadow-lighter};
|
|
153
|
+
--fox-box-shadow: #{$box-shadow};
|
|
154
|
+
--fox-fooer-bar-box-shadow: none;
|
|
155
|
+
|
|
156
|
+
// 暗黑风格
|
|
157
|
+
--fox-dark-background: #{$dark-background};
|
|
158
|
+
--fox-dark-background-2: #{$dark-background-2};
|
|
159
|
+
--fox-dark-background-3: #{$dark-background-3};
|
|
160
|
+
--fox-dark-background-4: #{$dark-background-4};
|
|
161
|
+
--fox-dark-background-5: #{$dark-background-5};
|
|
162
|
+
--fox-dark-color: #{$dark-color};
|
|
163
|
+
--fox-dark-color-2: #{$dark-color-2};
|
|
164
|
+
--fox-dark-color-gray: #{$dark-color-gray};
|
|
165
|
+
--fox-dark-calendar-choose-color: #{$dark-calendar-choose-color};
|
|
166
|
+
|
|
167
|
+
// overlay
|
|
168
|
+
--fox-overlay-bg-color: #{$overlay-bg-color};
|
|
169
|
+
--fox-overlay-text-bg-color: #{$overlay-text-bg-color};
|
|
170
|
+
|
|
171
|
+
@include gen-component-css-vars('actionsheet', $actionsheet);
|
|
172
|
+
@include gen-component-css-vars('avatar', $avatar);
|
|
173
|
+
@include gen-component-css-vars('backtop', $backtop);
|
|
174
|
+
@include gen-component-css-vars('badge', $badge);
|
|
175
|
+
@include gen-component-css-vars('button', $button);
|
|
176
|
+
@include gen-component-css-vars('buttons-item', $buttons-item);
|
|
177
|
+
@include gen-component-css-vars('calendar', $calendar);
|
|
178
|
+
@include gen-component-css-vars('card', $card);
|
|
179
|
+
@include gen-component-css-vars('cascader', $cascader);
|
|
180
|
+
@include gen-component-css-vars('cell', $cell);
|
|
181
|
+
@include gen-component-css-vars('cell-group', $cell-group);
|
|
182
|
+
@include gen-component-css-vars('checkbox', $checkbox);
|
|
183
|
+
@include gen-component-css-vars('circleprogress', $circleprogress);
|
|
184
|
+
@include gen-component-css-vars('collapse', $collapse);
|
|
185
|
+
@include gen-component-css-vars('content', $content);
|
|
186
|
+
@include gen-component-css-vars('countdown', $countdown);
|
|
187
|
+
@include gen-component-css-vars('dialog', $dialog);
|
|
188
|
+
@include gen-component-css-vars('divider', $divider);
|
|
189
|
+
@include gen-component-css-vars('elevator', $elevator);
|
|
190
|
+
@include gen-component-css-vars('ellipsis', $ellipsis);
|
|
191
|
+
@include gen-component-css-vars('empty', $empty);
|
|
192
|
+
@include gen-component-css-vars('fixednav', $fixednav);
|
|
193
|
+
@include gen-component-css-vars('floating-button', $floating-button);
|
|
194
|
+
@include gen-component-css-vars('footer', $footer);
|
|
195
|
+
@include gen-component-css-vars('footer-bar', $footer-bar);
|
|
196
|
+
@include gen-component-css-vars('form', $form);
|
|
197
|
+
@include gen-component-css-vars('grid', $grid);
|
|
198
|
+
@include gen-component-css-vars('group', $group);
|
|
199
|
+
@include gen-component-css-vars('header-bar', $header-bar);
|
|
200
|
+
@include gen-component-css-vars('hint-text', $hint-text);
|
|
201
|
+
@include gen-component-css-vars('icon', $icon);
|
|
202
|
+
@include gen-component-css-vars('indicator', $indicator);
|
|
203
|
+
@include gen-component-css-vars('infiniteloading', $infiniteloading);
|
|
204
|
+
@include gen-component-css-vars('input', $input);
|
|
205
|
+
@include gen-component-css-vars('input-item', $input-item);
|
|
206
|
+
@include gen-component-css-vars('input-number', $input-number);
|
|
207
|
+
@include gen-component-css-vars('link-item', $link-item);
|
|
208
|
+
@include gen-component-css-vars('list', $list);
|
|
209
|
+
@include gen-component-css-vars('menu', $menu);
|
|
210
|
+
@include gen-component-css-vars('messagebox', $messagebox);
|
|
211
|
+
@include gen-component-css-vars('navbar', $navbar);
|
|
212
|
+
@include gen-component-css-vars('noticebar', $noticebar);
|
|
213
|
+
@include gen-component-css-vars('notify', $notify);
|
|
214
|
+
@include gen-component-css-vars('numberkeyboard', $numberkeyboard);
|
|
215
|
+
@include gen-component-css-vars('pagination', $pagination);
|
|
216
|
+
@include gen-component-css-vars('picker', $picker);
|
|
217
|
+
@include gen-component-css-vars('popover', $popover);
|
|
218
|
+
@include gen-component-css-vars('popover-dialog', $popover-dialog);
|
|
219
|
+
@include gen-component-css-vars('popup', $popup);
|
|
220
|
+
@include gen-component-css-vars('popup-wrapper', $popup-wrapper);
|
|
221
|
+
@include gen-component-css-vars('price', $price);
|
|
222
|
+
@include gen-component-css-vars('progress', $progress);
|
|
223
|
+
@include gen-component-css-vars('radio', $radio);
|
|
224
|
+
@include gen-component-css-vars('range', $range);
|
|
225
|
+
@include gen-component-css-vars('rate', $rate);
|
|
226
|
+
@include gen-component-css-vars('row-item', $row-item);
|
|
227
|
+
@include gen-component-css-vars('searchbar', $searchbar);
|
|
228
|
+
@include gen-component-css-vars('shortpassword', $shortpassword);
|
|
229
|
+
@include gen-component-css-vars('sidenavbar', $sidenavbar);
|
|
230
|
+
@include gen-component-css-vars('skeleton', $skeleton);
|
|
231
|
+
@include gen-component-css-vars('slot-item', $slot-item);
|
|
232
|
+
@include gen-component-css-vars('steps', $steps);
|
|
233
|
+
@include gen-component-css-vars('steps-bar', $steps-bar);
|
|
234
|
+
@include gen-component-css-vars('swiper', $swiper);
|
|
235
|
+
@include gen-component-css-vars('switch', $switch);
|
|
236
|
+
@include gen-component-css-vars('switch-item', $switch-item);
|
|
237
|
+
@include gen-component-css-vars('tabbar', $tabbar);
|
|
238
|
+
@include gen-component-css-vars('table', $table);
|
|
239
|
+
@include gen-component-css-vars('tabs-bar', $tabs-bar);
|
|
240
|
+
@include gen-component-css-vars('tabs-frame', $tabs-frame);
|
|
241
|
+
@include gen-component-css-vars('tag', $tag);
|
|
242
|
+
@include gen-component-css-vars('text', $text);
|
|
243
|
+
@include gen-component-css-vars('textarea', $textarea);
|
|
244
|
+
@include gen-component-css-vars('toast', $toast);
|
|
245
|
+
@include gen-component-css-vars('trendarrow', $trendarrow);
|
|
246
|
+
@include gen-component-css-vars('uploader', $uploader);
|
|
247
|
+
@include gen-component-css-vars('watermark', $watermark);
|
|
248
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
|
|
5
|
+
@mixin gen-color-css-vars($colors-map, $prefix: 'fox') {
|
|
6
|
+
@each $type, $variants in $colors-map {
|
|
7
|
+
@if meta.type-of($variants) == 'map' {
|
|
8
|
+
@each $level, $value in $variants {
|
|
9
|
+
--#{$prefix}-color-#{$type}-#{$level}: #{$value};
|
|
10
|
+
}
|
|
11
|
+
} @else {
|
|
12
|
+
--#{$prefix}-color-#{$type}: #{$variants};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@mixin gen-css-vars($map, $prefix: 'fox') {
|
|
18
|
+
@each $key, $value in $map {
|
|
19
|
+
@if meta.type-of($value) == 'map' {
|
|
20
|
+
@each $sub-key, $sub-value in $value {
|
|
21
|
+
--#{$prefix}-#{$key}-#{$sub-key}: #{$sub-value};
|
|
22
|
+
}
|
|
23
|
+
} @else {
|
|
24
|
+
--#{$prefix}-#{$key}: #{$value};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@mixin gen-component-css-vars($component-name, $map, $prefix: 'fox') {
|
|
30
|
+
@each $key, $value in $map {
|
|
31
|
+
@if meta.type-of($value) == 'map' {
|
|
32
|
+
@each $sub-key, $sub-value in $value {
|
|
33
|
+
--#{$prefix}-#{$component-name}-#{$key}-#{$sub-key}: #{$sub-value};
|
|
34
|
+
}
|
|
35
|
+
} @else {
|
|
36
|
+
--#{$prefix}-#{$component-name}-#{$key}: #{$value};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward 'css-var';
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 江成
|
|
3
|
+
* @Date: 2026-06-22 13:47:37
|
|
4
|
+
* @LastEditors: 江成
|
|
5
|
+
* @LastEditTime: 2026-06-22 23:32:46
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Fox Theme Design 系统
|
|
9
|
+
|
|
10
|
+
Fox 主题 Design 系统用于替代 `ui/foxui/src/styles/variables.scss`,采用 Design Token 架构,将变量从扁平的 Sass 变量重构为结构化的 Map 体系,并自动生成 CSS 自定义属性(CSS Custom Properties),实现运行时主题切换能力。
|
|
11
|
+
|
|
12
|
+
## 目录结构
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
theme/
|
|
16
|
+
├── index.scss # 主入口,生成 :root 下的 CSS 自定义属性
|
|
17
|
+
├── readme.md
|
|
18
|
+
├── common/ # 基础 Design Token
|
|
19
|
+
│ ├── var.scss # 基础变量统一导出
|
|
20
|
+
│ ├── color.scss # 颜色系统(主色、语义色、色阶)
|
|
21
|
+
│ ├── typography.scss # 排版系统(文字颜色、字号、字重)
|
|
22
|
+
│ ├── border.scss # 边框系统
|
|
23
|
+
│ ├── fill.scss # 填充色系统
|
|
24
|
+
│ ├── shadow.scss # 阴影系统
|
|
25
|
+
│ └── base.scss # 其他基础快捷变量(动画、遮罩、暗黑、字体等)
|
|
26
|
+
├── components/ # 组件 Design Token
|
|
27
|
+
│ ├── index.scss # 组件变量统一导出
|
|
28
|
+
│ ├── button.scss # 按钮组件变量
|
|
29
|
+
│ ├── cell.scss # 单元格组件变量(含 cell-group)
|
|
30
|
+
│ ├── input.scss # 输入框组件变量(含 input-item)
|
|
31
|
+
│ ├── steps.scss # 步骤条组件变量
|
|
32
|
+
│ ├── steps-bar.scss # 步骤条栏组件变量
|
|
33
|
+
│ ├── tabs-bar.scss # 标签栏组件变量
|
|
34
|
+
│ ├── tabs-frame.scss # 标签框架组件变量
|
|
35
|
+
│ ├── ... # 其他 70+ 组件变量文件
|
|
36
|
+
│ └── watermark.scss # 水印组件变量
|
|
37
|
+
├── dark/ # 暗黑模式
|
|
38
|
+
│ ├── var.scss # 暗黑模式变量定义
|
|
39
|
+
│ └── css-vars.scss # 暗黑模式 CSS 自定义属性生成
|
|
40
|
+
└── mixins/ # 混入工具
|
|
41
|
+
├── index.scss # 混入统一导出
|
|
42
|
+
└── _css-var.scss # CSS 变量生成混入
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 核心设计
|
|
46
|
+
|
|
47
|
+
### 1. Map 结构替代扁平变量
|
|
48
|
+
|
|
49
|
+
**旧方式(variables.scss):**
|
|
50
|
+
```scss
|
|
51
|
+
$button-default-height: 38px !default;
|
|
52
|
+
$button-default-color: rgba(102, 102, 102, 1) !default;
|
|
53
|
+
$button-default-bg-color: $white !default;
|
|
54
|
+
$button-primary-color: $white !default;
|
|
55
|
+
$button-primary-bg-color: $color-primary !default;
|
|
56
|
+
// ... 每个属性一个变量,数百个扁平变量
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**新方式(theme 系统):**
|
|
60
|
+
```scss
|
|
61
|
+
$button: () !default;
|
|
62
|
+
$button: map.deep-merge(
|
|
63
|
+
(
|
|
64
|
+
'border-radius': 25px,
|
|
65
|
+
'default': (
|
|
66
|
+
'height': 38px,
|
|
67
|
+
'color': rgba(102, 102, 102, 1),
|
|
68
|
+
'bg-color': $white
|
|
69
|
+
),
|
|
70
|
+
'primary': (
|
|
71
|
+
'color': $white,
|
|
72
|
+
'bg-color': $color-primary
|
|
73
|
+
)
|
|
74
|
+
),
|
|
75
|
+
$button
|
|
76
|
+
);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2. 自动生成 CSS 自定义属性
|
|
80
|
+
|
|
81
|
+
通过 `gen-component-css-vars` 混入,将 Map 结构自动展开为 CSS 自定义属性:
|
|
82
|
+
|
|
83
|
+
```scss
|
|
84
|
+
@include gen-component-css-vars('button', $button);
|
|
85
|
+
// 生成:
|
|
86
|
+
// --fox-button-border-radius: 25px;
|
|
87
|
+
// --fox-button-default-height: 38px;
|
|
88
|
+
// --fox-button-default-color: rgba(102, 102, 102, 1);
|
|
89
|
+
// --fox-button-default-bg-color: #fff;
|
|
90
|
+
// --fox-button-primary-color: #fff;
|
|
91
|
+
// --fox-button-primary-bg-color: #fa2c19;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. CSS 变量生成规则
|
|
95
|
+
|
|
96
|
+
| Map 结构 | 生成的 CSS 变量 |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `'key': value` | `--fox-{component}-key: value` |
|
|
99
|
+
| `'key': ('sub': value)` | `--fox-{component}-key-sub: value` |
|
|
100
|
+
|
|
101
|
+
**注意**:Map key 不应包含组件名前缀。例如 `tabs-bar` 组件的 key 应为 `'icon-size'` 而非 `'bar-icon-size'`,否则会生成重复的 `--fox-tabs-bar-bar-icon-size`。
|
|
102
|
+
|
|
103
|
+
### 4. 颜色系统
|
|
104
|
+
|
|
105
|
+
颜色系统基于 Map 自动计算色阶(light-1 ~ light-9, dark-2),通过 `gen-color-css-vars` 混入生成 CSS 变量:
|
|
106
|
+
|
|
107
|
+
```scss
|
|
108
|
+
// 生成 --fox-color-primary-base, --fox-color-primary-light-1 ~ light-9, --fox-color-primary-dark-2
|
|
109
|
+
@include gen-color-css-vars($colors);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
同时补充了简写形式的颜色基础变量,供 `variables.scss` 中的 `var(--fox-color-primary)` 等引用:
|
|
113
|
+
|
|
114
|
+
```scss
|
|
115
|
+
--fox-color-primary: #{$color-primary};
|
|
116
|
+
--fox-color-success: #{$color-success};
|
|
117
|
+
--fox-color-warning: #{$color-warning};
|
|
118
|
+
--fox-color-danger: #{$color-danger};
|
|
119
|
+
--fox-color-info: #{$color-info};
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 使用方式
|
|
123
|
+
|
|
124
|
+
### 基本使用
|
|
125
|
+
|
|
126
|
+
```scss
|
|
127
|
+
// 在项目入口引入
|
|
128
|
+
@use '@fox-js/foxui/theme/index.scss' as *;
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 自定义主题
|
|
132
|
+
|
|
133
|
+
通过 `@forward ... with` 覆盖 Design Token:
|
|
134
|
+
|
|
135
|
+
#### 自定义主色
|
|
136
|
+
|
|
137
|
+
```scss
|
|
138
|
+
@forward '@fox-js/foxui/common/var.scss' with (
|
|
139
|
+
$colors: (
|
|
140
|
+
'primary': (
|
|
141
|
+
'base': #1890ff
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// 然后引入主题
|
|
147
|
+
@use '@fox-js/foxui/theme/index.scss' as *;
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### 自定义语义色
|
|
151
|
+
|
|
152
|
+
```scss
|
|
153
|
+
@forward '@fox-js/foxui/common/var.scss' with (
|
|
154
|
+
$colors: (
|
|
155
|
+
'success': (
|
|
156
|
+
'base': #52c41a
|
|
157
|
+
),
|
|
158
|
+
'warning': (
|
|
159
|
+
'base': #faad14
|
|
160
|
+
),
|
|
161
|
+
'danger': (
|
|
162
|
+
'base': #f5222d
|
|
163
|
+
),
|
|
164
|
+
'info': (
|
|
165
|
+
'base': #909399
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// 然后引入主题
|
|
171
|
+
@use '@fox-js/foxui/theme/index.scss' as *;
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### 自定义字号
|
|
175
|
+
|
|
176
|
+
```scss
|
|
177
|
+
@forward '@fox-js/foxui/common/base.scss' with (
|
|
178
|
+
$font-size-extra-small: 11px,
|
|
179
|
+
$font-size-small: 13px,
|
|
180
|
+
$font-size-base: 15px,
|
|
181
|
+
$font-size-medium: 17px,
|
|
182
|
+
$font-size-large: 19px,
|
|
183
|
+
$font-size-extra-large: 22px
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// 然后引入主题
|
|
187
|
+
@use '@fox-js/foxui/theme/index.scss' as *;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### 同时自定义颜色和字号
|
|
191
|
+
|
|
192
|
+
```scss
|
|
193
|
+
@forward '@fox-js/foxui/common/var.scss' with (
|
|
194
|
+
$colors: (
|
|
195
|
+
'primary': (
|
|
196
|
+
'base': #1890ff
|
|
197
|
+
),
|
|
198
|
+
'success': (
|
|
199
|
+
'base': #52c41a
|
|
200
|
+
),
|
|
201
|
+
'warning': (
|
|
202
|
+
'base': #faad14
|
|
203
|
+
),
|
|
204
|
+
'danger': (
|
|
205
|
+
'base': #f5222d
|
|
206
|
+
),
|
|
207
|
+
'info': (
|
|
208
|
+
'base': #909399
|
|
209
|
+
)
|
|
210
|
+
),
|
|
211
|
+
$font-size-extra-small: 10px,
|
|
212
|
+
$font-size-small: 12px,
|
|
213
|
+
$font-size-base: 14px,
|
|
214
|
+
$font-size-medium: 16px,
|
|
215
|
+
$font-size-large: 18px,
|
|
216
|
+
$font-size-extra-large: 20px
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
// 然后引入主题
|
|
221
|
+
@use '@fox-js/foxui/theme/index.scss' as *;
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 自定义组件变量
|
|
225
|
+
|
|
226
|
+
```scss
|
|
227
|
+
@forward '@fox-js/foxui/components/button.scss' with (
|
|
228
|
+
$button: (
|
|
229
|
+
'border-radius': 8px,
|
|
230
|
+
'default': (
|
|
231
|
+
'height': 40px
|
|
232
|
+
)
|
|
233
|
+
)
|
|
234
|
+
);
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 暗黑模式
|
|
238
|
+
|
|
239
|
+
```scss
|
|
240
|
+
// 引入暗黑模式变量
|
|
241
|
+
@use '@fox-js/foxui/theme/dark/css-vars.scss' as *;
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
暗黑模式会在 `html.dark` 选择器下覆盖 CSS 自定义属性,实现运行时切换。
|
|
245
|
+
|
|
246
|
+
### 在组件中使用变量
|
|
247
|
+
|
|
248
|
+
```scss
|
|
249
|
+
// 通过 CSS 变量引用(推荐,支持运行时切换)
|
|
250
|
+
.button {
|
|
251
|
+
height: var(--fox-button-default-height);
|
|
252
|
+
color: var(--fox-button-default-color);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 通过 Sass 变量引用(编译时确定)
|
|
256
|
+
@use '@fox-js/foxui/common/var' as *;
|
|
257
|
+
|
|
258
|
+
.button {
|
|
259
|
+
height: map.get($button, 'default', 'height');
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 与 variables.scss 的对比
|
|
264
|
+
|
|
265
|
+
| 特性 | variables.scss | theme 系统 |
|
|
266
|
+
|---|---|---|
|
|
267
|
+
| 变量结构 | 扁平变量(1000+) | 结构化 Map |
|
|
268
|
+
| CSS 变量生成 | 手动 var() 声明 | 自动生成 |
|
|
269
|
+
| 运行时切换 | 不支持 | 支持 |
|
|
270
|
+
| 主题定制 | 逐个覆盖变量 | Map 合并覆盖 |
|
|
271
|
+
| 暗黑模式 | 需手动定义 | 内置支持 |
|
|
272
|
+
| CSS 变量覆盖率 | - | 100% |
|
|
273
|
+
| 组件变量数 | 75 个组件 | 75 个组件 |
|
|
274
|
+
|
|
275
|
+
## 基础变量速查
|
|
276
|
+
|
|
277
|
+
### 颜色
|
|
278
|
+
|
|
279
|
+
| 变量 | 说明 | 默认值 |
|
|
280
|
+
|---|---|---|
|
|
281
|
+
| `$color-primary` | 主色 | #fa2c19 |
|
|
282
|
+
| `$color-success` | 成功色 | #67c23a |
|
|
283
|
+
| `$color-warning` | 警告色 | #ffaa08 |
|
|
284
|
+
| `$color-danger` | 危险色 | #dd412c |
|
|
285
|
+
| `$color-info` | 信息色 | #666666 |
|
|
286
|
+
| `$white` | 白色 | #ffffff |
|
|
287
|
+
| `$black` | 黑色 | #000000 |
|
|
288
|
+
|
|
289
|
+
### 文字颜色
|
|
290
|
+
|
|
291
|
+
| 变量 | 说明 | 默认值 |
|
|
292
|
+
|---|---|---|
|
|
293
|
+
| `$title-color` | 标题色 | #1a1a1a |
|
|
294
|
+
| `$title-color-secondary` | 二级标题色 | #666666 |
|
|
295
|
+
| `$text-color-regular` | 正文色 | #808080 |
|
|
296
|
+
| `$text-color-secondary` | 次级文字色 | #909399 |
|
|
297
|
+
| `$disabled-color` | 禁用色 | #cccccc |
|
|
298
|
+
| `$readonly-color` | 只读色 | #808080 |
|
|
299
|
+
| `$required-color` | 必填标识色 | #fa2c19 |
|
|
300
|
+
|
|
301
|
+
### 字体
|
|
302
|
+
|
|
303
|
+
| 变量 | 说明 | 默认值 |
|
|
304
|
+
|---|---|---|
|
|
305
|
+
| `$font-size-extra-small` | 极小字号 | 10px |
|
|
306
|
+
| `$font-size-small` | 小字号 | 12px |
|
|
307
|
+
| `$font-size-base` | 基础字号 | 14px |
|
|
308
|
+
| `$font-size-medium` | 中等字号 | 16px |
|
|
309
|
+
| `$font-size-large` | 大字号 | 18px |
|
|
310
|
+
| `$font-size-extra-large` | 极大字号 | 20px |
|
|
311
|
+
| `$font-weight-bold` | 粗体字重 | 400 |
|
|
312
|
+
| `$line-height-base` | 基础行高 | 1.5 |
|
|
313
|
+
| `$font-family` | 字体族 | PingFang SC, ... |
|
|
314
|
+
|
|
315
|
+
### 边框
|
|
316
|
+
|
|
317
|
+
| 变量 | 说明 | 默认值 |
|
|
318
|
+
|---|---|---|
|
|
319
|
+
| `$border-color-base` | 基础边框色 | #dcdfe6 |
|
|
320
|
+
| `$border-color-light` | 浅边框色 | #e4e7ed |
|
|
321
|
+
| `$border-color-lighter` | 更浅边框色 | #ebeef5 |
|
|
322
|
+
|
|
323
|
+
### 填充
|
|
324
|
+
|
|
325
|
+
| 变量 | 说明 | 默认值 |
|
|
326
|
+
|---|---|---|
|
|
327
|
+
| `$fill-color-base` | 基础填充色 | #f5f5f5 |
|
|
328
|
+
| `$background-color` | 背景色 | #fafafa |
|
|
329
|
+
|
|
330
|
+
### 阴影
|
|
331
|
+
|
|
332
|
+
| 变量 | 说明 | 默认值 |
|
|
333
|
+
|---|---|---|
|
|
334
|
+
| `$box-shadow` | 基础阴影 | 0px 12px 32px 4px ... |
|
|
335
|
+
| `$box-shadow-light` | 轻阴影 | 0px 0px 12px ... |
|
|
336
|
+
| `$box-shadow-lighter` | 更轻阴影 | 0px 0px 8px ... |
|
|
337
|
+
|
|
338
|
+
### 动画
|
|
339
|
+
|
|
340
|
+
| 变量 | 说明 | 默认值 |
|
|
341
|
+
|---|---|---|
|
|
342
|
+
| `$animation-duration` | 动画时长 | 0.25s |
|
|
343
|
+
| `$animation-timing-fun` | 动画缓动 | cubic-bezier(0.55, 0.085, 0.68, 0.53) |
|
|
344
|
+
|
|
345
|
+
### 遮罩
|
|
346
|
+
|
|
347
|
+
| 变量 | 说明 | 默认值 |
|
|
348
|
+
|---|---|---|
|
|
349
|
+
| `$overlay-bg-color` | 遮罩背景色 | rgba(0, 0, 0, 0.7) |
|
|
350
|
+
| `$overlay-text-bg-color` | 文字遮罩背景色 | rgba(0, 0, 0, 0.8) |
|
|
351
|
+
|
|
352
|
+
## 迁移指南
|
|
353
|
+
|
|
354
|
+
从 `variables.scss` 迁移到 theme 系统:
|
|
355
|
+
|
|
356
|
+
1. **替换入口引用**:将 `@use '@/styles/variables.scss'` 替换为 `@use '@/theme/common/var'`
|
|
357
|
+
2. **组件变量访问**:将 `$button-default-height` 替换为 `map.get($button, 'default', 'height')`
|
|
358
|
+
3. **CSS 变量使用**:推荐直接使用 `var(--fox-button-default-height)`,无需修改
|
|
359
|
+
4. **主题定制**:使用 `@forward ... with` 覆盖 Map 变量
|