@veltra/styles 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/dist/_functions.scss +49 -0
- package/dist/_mixins.scss +177 -0
- package/dist/_vars.scss +44 -0
- package/dist/anime/fade.css +9 -0
- package/dist/anime/fade.scss +8 -0
- package/dist/anime/slide.css +18 -0
- package/dist/anime/slide.scss +28 -0
- package/dist/anime/spring.css +30 -0
- package/dist/anime/spring.scss +42 -0
- package/dist/anime/zoom-in.css +57 -0
- package/dist/anime/zoom-in.scss +73 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/load-theme.d.ts +18 -0
- package/dist/load-theme.js +38 -0
- package/dist/load-theme.js.map +1 -0
- package/dist/normalize.css +76 -0
- package/dist/normalize.scss +63 -0
- package/dist/theme/dark.d.ts +7 -0
- package/dist/theme/dark.js +47 -0
- package/dist/theme/dark.js.map +1 -0
- package/dist/theme/helper.d.ts +22 -0
- package/dist/theme/helper.js +57 -0
- package/dist/theme/helper.js.map +1 -0
- package/dist/theme/index.d.ts +7 -0
- package/dist/theme/index.js +6 -0
- package/dist/theme/light.d.ts +7 -0
- package/dist/theme/light.js +89 -0
- package/dist/theme/light.js.map +1 -0
- package/dist/theme/type.d.ts +91 -0
- package/dist/theme/ui-theme.d.ts +35 -0
- package/dist/theme/ui-theme.js +179 -0
- package/dist/theme/ui-theme.js.map +1 -0
- package/package.json +82 -0
- package/src/_functions.scss +49 -0
- package/src/_mixins.scss +177 -0
- package/src/_vars.scss +44 -0
- package/src/anime/fade.scss +8 -0
- package/src/anime/slide.scss +28 -0
- package/src/anime/spring.scss +42 -0
- package/src/anime/zoom-in.scss +73 -0
- package/src/env.d.ts +1 -0
- package/src/index.ts +5 -0
- package/src/load-theme.ts +46 -0
- package/src/normalize.scss +63 -0
- package/src/theme/__test__/ui-theme.test.ts +27 -0
- package/src/theme/dark.ts +38 -0
- package/src/theme/helper.ts +58 -0
- package/src/theme/index.ts +6 -0
- package/src/theme/light.ts +60 -0
- package/src/theme/type.ts +156 -0
- package/src/theme/ui-theme.ts +265 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@use 'vars';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
|
|
4
|
+
// 使用单个变量(全局主题 token,`--u-*`)
|
|
5
|
+
@function use-var($basename, $nodes...) {
|
|
6
|
+
$suffix: '';
|
|
7
|
+
|
|
8
|
+
@each $node in $nodes {
|
|
9
|
+
$suffix: $suffix + '-' + $node;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@return var(--u-#{$basename}#{$suffix});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// 组件级 token:`var(--u-{component}-{property}[, fallback])`
|
|
16
|
+
@function component-var($component, $property, $fallback: null) {
|
|
17
|
+
@if $fallback == null {
|
|
18
|
+
@return var(--u-#{$component}-#{$property});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@return var(--u-#{$component}-#{$property}, #{$fallback});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 使用多个变量
|
|
25
|
+
@function use-vars($vars, $separator: ' ') {
|
|
26
|
+
$result: '';
|
|
27
|
+
$len: list.length($vars);
|
|
28
|
+
@for $i from 1 to $len {
|
|
29
|
+
$result: $result + use-var(list.nth($vars, $i)) + $separator;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$result: $result + use-var(list.nth($vars, $len));
|
|
33
|
+
|
|
34
|
+
@return $result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// bem的函数
|
|
38
|
+
@function bem($b, $e: null, $m: null) {
|
|
39
|
+
$b: '.' + vars.$namespace + $b;
|
|
40
|
+
@if ($e != null) {
|
|
41
|
+
$b: $b + '__' + $e;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@if ($m != null) {
|
|
45
|
+
$b: $b + '--' + $m;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@return $b;
|
|
49
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
@use 'vars';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use 'functions' as fn;
|
|
5
|
+
|
|
6
|
+
/** flex布局 */
|
|
7
|
+
@mixin flex($display: flex, $justify: flex-start, $align: center, $wrap: nowrap) {
|
|
8
|
+
display: $display;
|
|
9
|
+
justify-content: $justify;
|
|
10
|
+
align-items: $align;
|
|
11
|
+
flex-wrap: $wrap;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin size {
|
|
15
|
+
@each $size in vars.$sizes {
|
|
16
|
+
&--#{$size} {
|
|
17
|
+
@content ($size);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@mixin b($blocks...) {
|
|
23
|
+
@each $block in $blocks {
|
|
24
|
+
.#{vars.$namespace}#{$block} {
|
|
25
|
+
@content;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin e($elements...) {
|
|
31
|
+
$selector-list: null;
|
|
32
|
+
|
|
33
|
+
@each $element in $elements {
|
|
34
|
+
@if ($selector-list != null) {
|
|
35
|
+
$selector-list: #{$selector-list} + ', &__' + #{$element};
|
|
36
|
+
} @else {
|
|
37
|
+
$selector-list: '&__' + #{$element};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#{$selector-list} {
|
|
42
|
+
@content;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@mixin m($modifiers...) {
|
|
47
|
+
$selector-list: null;
|
|
48
|
+
|
|
49
|
+
@each $modifier in $modifiers {
|
|
50
|
+
@if ($selector-list != null) {
|
|
51
|
+
$selector-list: #{$selector-list} + ', &--' + #{$modifier};
|
|
52
|
+
} @else {
|
|
53
|
+
$selector-list: '&--' + #{$modifier};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#{$selector-list} {
|
|
58
|
+
@content;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@mixin em($element, $modifier) {
|
|
63
|
+
$selector: '&__' + #{$element} + '--' + $modifier;
|
|
64
|
+
#{$selector} {
|
|
65
|
+
@content;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@mixin is($types...) {
|
|
70
|
+
@each $type in $types {
|
|
71
|
+
&.is-#{$type} {
|
|
72
|
+
@content;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@mixin bem($b, $e: null, $m: null) {
|
|
78
|
+
$b: '.' + vars.$namespace + $b;
|
|
79
|
+
|
|
80
|
+
@if ($e != null) {
|
|
81
|
+
@each $ei in $e {
|
|
82
|
+
@if ($m != null) {
|
|
83
|
+
@each $mi in $m {
|
|
84
|
+
#{$b + '__' + $ei + '--' + $mi} {
|
|
85
|
+
@content;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} @else {
|
|
89
|
+
#{$b + '__' + $ei} {
|
|
90
|
+
@content;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} @else {
|
|
95
|
+
#{$b} {
|
|
96
|
+
@content;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@mixin ellipsis {
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 设置css变量
|
|
109
|
+
* 参数1:变量前缀
|
|
110
|
+
* 参数2: 一个由值组成的列表或者由key, value组成的map
|
|
111
|
+
* css-var(height, (
|
|
112
|
+
* large: 40px
|
|
113
|
+
* default: 32px
|
|
114
|
+
* small: 24px
|
|
115
|
+
* ))
|
|
116
|
+
* 生成的css变量:
|
|
117
|
+
* --u-height-large: 40px;
|
|
118
|
+
* --u-height-default: 32px;
|
|
119
|
+
* --u-height-small: 24px;
|
|
120
|
+
*/
|
|
121
|
+
@mixin css-var($prefix, $list) {
|
|
122
|
+
@each $type, $value in $list {
|
|
123
|
+
@if $value == null {
|
|
124
|
+
--#{$prefix}: #{$type};
|
|
125
|
+
} @else {
|
|
126
|
+
// "" + $type用于消除警告
|
|
127
|
+
--#{$prefix}-#{"" + $type}: #{$value};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@function breakpoint($point) {
|
|
133
|
+
@return var(--u-breakpoint-#{$point});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 暗色:data-theme 与系统偏好,与 UITheme.injectBuiltInThemes 选择器策略一致 */
|
|
137
|
+
@mixin dark {
|
|
138
|
+
html[data-theme='dark'] & {
|
|
139
|
+
@content;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@media (prefers-color-scheme: dark) {
|
|
143
|
+
html:not([data-theme='light']) & {
|
|
144
|
+
@content;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@mixin xs {
|
|
150
|
+
@media screen and (min-width: 0) and (max-width: breakpoint(xs)) {
|
|
151
|
+
@content;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@mixin sm {
|
|
156
|
+
@media screen and (min-width: breakpoint(xs)) and (max-width: breakpoint(sm)) {
|
|
157
|
+
@content;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@mixin md {
|
|
162
|
+
@media screen and (min-width: breakpoint(sm)) and (max-width: breakpoint(md)) {
|
|
163
|
+
@content;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@mixin lg {
|
|
168
|
+
@media screen and (min-width: breakpoint( md)) and (max-width: breakpoint(lg)) {
|
|
169
|
+
@content;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@mixin xl {
|
|
174
|
+
@media screen and (min-width: breakpoint(lg)) {
|
|
175
|
+
@content;
|
|
176
|
+
}
|
|
177
|
+
}
|
package/dist/_vars.scss
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
$namespace: 'u-';
|
|
4
|
+
|
|
5
|
+
// 与全局 CSS 变量对齐的语义化别名(便于 SCSS 中直接引用)
|
|
6
|
+
$color-primary: var(--u-color-primary);
|
|
7
|
+
$text-color-main: var(--u-text-color-main);
|
|
8
|
+
$border-color: var(--u-border-color);
|
|
9
|
+
$bg-color-top: var(--u-bg-color-top);
|
|
10
|
+
|
|
11
|
+
// 定义size映射的函数, 保证尺寸的统一性, size-vars(small, default, large)
|
|
12
|
+
// 例子:
|
|
13
|
+
// size-vars((height: 24px), (height: 32px), (height: 40px))
|
|
14
|
+
// 生成:
|
|
15
|
+
// (small: (height: 24px), default: (height: 32px), large: (height: 40px))
|
|
16
|
+
@function size-vars($sizes...) {
|
|
17
|
+
$size-types: (small, default, large);
|
|
18
|
+
$size-result: ();
|
|
19
|
+
|
|
20
|
+
@for $i from 1 through length($size-types) {
|
|
21
|
+
$size-result: map.merge($size-result, (#{nth($size-types, $i)}: nth($sizes, $i)));
|
|
22
|
+
}
|
|
23
|
+
@return $size-result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
$sizes: (small, default, large);
|
|
27
|
+
|
|
28
|
+
// 颜色类别
|
|
29
|
+
$color-types: (
|
|
30
|
+
// 品牌色
|
|
31
|
+
primary,
|
|
32
|
+
// 成功色
|
|
33
|
+
success,
|
|
34
|
+
// 警告色
|
|
35
|
+
warning,
|
|
36
|
+
// 危险色
|
|
37
|
+
danger,
|
|
38
|
+
// 信息
|
|
39
|
+
info,
|
|
40
|
+
// 禁用色
|
|
41
|
+
disabled,
|
|
42
|
+
// 默认色
|
|
43
|
+
default
|
|
44
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.slide-down-enter-from, .slide-down-leave-to,
|
|
2
|
+
.slide-up-enter-from,
|
|
3
|
+
.slide-up-leave-to {
|
|
4
|
+
opacity: 0;
|
|
5
|
+
}
|
|
6
|
+
.slide-down-enter-active, .slide-down-leave-active,
|
|
7
|
+
.slide-up-enter-active,
|
|
8
|
+
.slide-up-leave-active {
|
|
9
|
+
transition: transform 0.2s cubic-bezier(0, 0, 0.2, 1), opacity 0.2s cubic-bezier(0, 0, 0.2, 1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.slide-down-enter-from, .slide-down-leave-to {
|
|
13
|
+
transform: translateY(-10px);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.slide-up-enter-from, .slide-up-leave-to {
|
|
17
|
+
transform: translateY(10px);
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.slide-down,
|
|
2
|
+
.slide-up {
|
|
3
|
+
&-enter-from,
|
|
4
|
+
&-leave-to {
|
|
5
|
+
opacity: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&-enter-active,
|
|
9
|
+
&-leave-active {
|
|
10
|
+
transition:
|
|
11
|
+
transform 0.2s cubic-bezier(0, 0, 0.2, 1),
|
|
12
|
+
opacity 0.2s cubic-bezier(0, 0, 0.2, 1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.slide-down {
|
|
17
|
+
&-enter-from,
|
|
18
|
+
&-leave-to {
|
|
19
|
+
transform: translateY(-10px);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.slide-up {
|
|
24
|
+
&-enter-from,
|
|
25
|
+
&-leave-to {
|
|
26
|
+
transform: translateY(10px);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@keyframes spring-in {
|
|
2
|
+
0% {
|
|
3
|
+
transform: scale(0);
|
|
4
|
+
}
|
|
5
|
+
40% {
|
|
6
|
+
transform: scale(1.1);
|
|
7
|
+
}
|
|
8
|
+
60% {
|
|
9
|
+
transform: scale(1);
|
|
10
|
+
}
|
|
11
|
+
80% {
|
|
12
|
+
transform: scale(1.02);
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
transform: scale(1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
.spring-enter-active {
|
|
19
|
+
transform-origin: center;
|
|
20
|
+
animation: spring-in 0.5s ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.spring-leave-active {
|
|
24
|
+
transition: transform 0.4s cubic-bezier(0.64, -0.32, 0.66, 1.06), opacity 0.4s cubic-bezier(0.64, -0.32, 0.66, 1.06);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.spring-leave-to {
|
|
28
|
+
transform: scale3d(0, 0, 0) translate3d(0, 0, 0) !important;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@keyframes spring-in {
|
|
2
|
+
0% {
|
|
3
|
+
transform: scale(0);
|
|
4
|
+
}
|
|
5
|
+
40% {
|
|
6
|
+
transform: scale(1.1);
|
|
7
|
+
}
|
|
8
|
+
60% {
|
|
9
|
+
transform: scale(1);
|
|
10
|
+
}
|
|
11
|
+
80% {
|
|
12
|
+
transform: scale(1.02);
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
transform: scale(1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// @keyframes spring-out {
|
|
20
|
+
// 100% {
|
|
21
|
+
// transform: scale3d(0, 0, 0) translate3d(0, 0, 0);
|
|
22
|
+
// opacity: 0;
|
|
23
|
+
// }
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
.spring-enter-active {
|
|
27
|
+
transform-origin: center;
|
|
28
|
+
animation: spring-in 0.5s ease-in-out;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.spring-leave-active {
|
|
32
|
+
// animation: spring-out 0.4s cubic-bezier(0.64, -0.32, 0.66, 1.06);
|
|
33
|
+
|
|
34
|
+
transition:
|
|
35
|
+
transform 0.4s cubic-bezier(0.64, -0.32, 0.66, 1.06),
|
|
36
|
+
opacity 0.4s cubic-bezier(0.64, -0.32, 0.66, 1.06);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.spring-leave-to {
|
|
40
|
+
transform: scale3d(0, 0, 0) translate3d(0, 0, 0) !important;
|
|
41
|
+
opacity: 0;
|
|
42
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.zoom-in-enter-from, .zoom-in-leave-to,
|
|
2
|
+
.zoom-in-left-enter-from,
|
|
3
|
+
.zoom-in-left-leave-to,
|
|
4
|
+
.zoom-in-right-enter-from,
|
|
5
|
+
.zoom-in-right-leave-to,
|
|
6
|
+
.zoom-in-top-enter-from,
|
|
7
|
+
.zoom-in-top-leave-to,
|
|
8
|
+
.zoom-in-bottom-enter-from,
|
|
9
|
+
.zoom-in-bottom-leave-to {
|
|
10
|
+
opacity: 0;
|
|
11
|
+
}
|
|
12
|
+
.zoom-in-enter-active,
|
|
13
|
+
.zoom-in-left-enter-active,
|
|
14
|
+
.zoom-in-right-enter-active,
|
|
15
|
+
.zoom-in-top-enter-active,
|
|
16
|
+
.zoom-in-bottom-enter-active {
|
|
17
|
+
transition: opacity 0.15s ease-in, transform 0.15s ease-in;
|
|
18
|
+
}
|
|
19
|
+
.zoom-in-leave-active,
|
|
20
|
+
.zoom-in-left-leave-active,
|
|
21
|
+
.zoom-in-right-leave-active,
|
|
22
|
+
.zoom-in-top-leave-active,
|
|
23
|
+
.zoom-in-bottom-leave-active {
|
|
24
|
+
transition: opacity 0.15s ease-out, transform 0.15s ease-out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.zoom-in-left-enter-from, .zoom-in-left-leave-to,
|
|
28
|
+
.zoom-in-right-enter-from,
|
|
29
|
+
.zoom-in-right-leave-to {
|
|
30
|
+
transform: scaleX(0.8);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.zoom-in-top-enter-from, .zoom-in-top-leave-to,
|
|
34
|
+
.zoom-in-bottom-enter-from,
|
|
35
|
+
.zoom-in-bottom-leave-to {
|
|
36
|
+
transform: scaleY(0.8);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.zoom-in-enter-from, .zoom-in-leave-to {
|
|
40
|
+
transform: scale(0.8);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.zoom-in-left-enter-active, .zoom-in-left-leave-active {
|
|
44
|
+
transform-origin: left center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.zoom-in-right-enter-active, .zoom-in-right-leave-active {
|
|
48
|
+
transform-origin: right center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.zoom-in-top-enter-active, .zoom-in-top-leave-active {
|
|
52
|
+
transform-origin: center top;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.zoom-in-bottom-enter-active, .zoom-in-bottom-leave-active {
|
|
56
|
+
transform-origin: center bottom;
|
|
57
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
.zoom-in,
|
|
2
|
+
.zoom-in-left,
|
|
3
|
+
.zoom-in-right,
|
|
4
|
+
.zoom-in-top,
|
|
5
|
+
.zoom-in-bottom {
|
|
6
|
+
&-enter-from,
|
|
7
|
+
&-leave-to {
|
|
8
|
+
opacity: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-enter-active {
|
|
12
|
+
transition:
|
|
13
|
+
opacity 0.15s ease-in,
|
|
14
|
+
transform 0.15s ease-in;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-leave-active {
|
|
18
|
+
transition:
|
|
19
|
+
opacity 0.15s ease-out,
|
|
20
|
+
transform 0.15s ease-out;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.zoom-in-left,
|
|
25
|
+
.zoom-in-right {
|
|
26
|
+
&-enter-from,
|
|
27
|
+
&-leave-to {
|
|
28
|
+
transform: scaleX(0.8);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.zoom-in-top,
|
|
33
|
+
.zoom-in-bottom {
|
|
34
|
+
&-enter-from,
|
|
35
|
+
&-leave-to {
|
|
36
|
+
transform: scaleY(0.8);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.zoom-in {
|
|
41
|
+
&-enter-from,
|
|
42
|
+
&-leave-to {
|
|
43
|
+
transform: scale(0.8);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.zoom-in-left {
|
|
48
|
+
&-enter-active,
|
|
49
|
+
&-leave-active {
|
|
50
|
+
transform-origin: left center;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.zoom-in-right {
|
|
55
|
+
&-enter-active,
|
|
56
|
+
&-leave-active {
|
|
57
|
+
transform-origin: right center;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.zoom-in-top {
|
|
62
|
+
&-enter-active,
|
|
63
|
+
&-leave-active {
|
|
64
|
+
transform-origin: center top;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.zoom-in-bottom {
|
|
69
|
+
&-enter-active,
|
|
70
|
+
&-leave-active {
|
|
71
|
+
transform-origin: center bottom;
|
|
72
|
+
}
|
|
73
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UITheme } from "./theme/ui-theme.js";
|
|
2
|
+
import { ShallowRef } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/load-theme.d.ts
|
|
5
|
+
declare const currentTheme: ShallowRef<UITheme | undefined>;
|
|
6
|
+
declare function setTheme(mode: 'light' | 'dark' | 'auto'): void;
|
|
7
|
+
/**
|
|
8
|
+
* @description 加载主题, 如果你是 SSR 环境,
|
|
9
|
+
* 请在 `onMounted` 中调用,否则你可以在
|
|
10
|
+
* 项目的入口环境(通常是 main.ts)或其他全局环境中调用。
|
|
11
|
+
*
|
|
12
|
+
* 不传 `theme` 时注入内置 light/dark 变量(支持 `setTheme` 与系统暗色偏好)。
|
|
13
|
+
* 传入自定义 `UITheme` 时使用单次 `html { }` 注入。
|
|
14
|
+
*/
|
|
15
|
+
declare function loadTheme(theme?: UITheme): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { currentTheme, loadTheme, setTheme };
|
|
18
|
+
//# sourceMappingURL=load-theme.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UITheme } from "./theme/ui-theme.js";
|
|
2
|
+
import { lightTheme } from "./theme/light.js";
|
|
3
|
+
import { darkTheme } from "./theme/dark.js";
|
|
4
|
+
import { shallowRef } from "vue";
|
|
5
|
+
import { useConfig } from "@veltra/compositions";
|
|
6
|
+
//#region src/load-theme.ts
|
|
7
|
+
const currentTheme = shallowRef();
|
|
8
|
+
function setTheme(mode) {
|
|
9
|
+
UITheme.setTheme(mode);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @description 加载主题, 如果你是 SSR 环境,
|
|
13
|
+
* 请在 `onMounted` 中调用,否则你可以在
|
|
14
|
+
* 项目的入口环境(通常是 main.ts)或其他全局环境中调用。
|
|
15
|
+
*
|
|
16
|
+
* 不传 `theme` 时注入内置 light/dark 变量(支持 `setTheme` 与系统暗色偏好)。
|
|
17
|
+
* 传入自定义 `UITheme` 时使用单次 `html { }` 注入。
|
|
18
|
+
*/
|
|
19
|
+
function loadTheme(theme) {
|
|
20
|
+
currentTheme.value = theme ?? lightTheme;
|
|
21
|
+
const { config } = useConfig();
|
|
22
|
+
if (typeof document !== "undefined") document.documentElement.classList.add(config.size);
|
|
23
|
+
if (typeof document === "undefined") return;
|
|
24
|
+
if (!theme) {
|
|
25
|
+
currentTheme.value = lightTheme;
|
|
26
|
+
UITheme.injectBuiltInThemes(lightTheme, darkTheme);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
currentTheme.value = theme;
|
|
30
|
+
if (theme === lightTheme || theme === darkTheme) {
|
|
31
|
+
UITheme.injectBuiltInThemes(lightTheme, darkTheme);
|
|
32
|
+
UITheme.setTheme(theme === darkTheme ? "dark" : "light");
|
|
33
|
+
} else theme.render();
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { currentTheme, loadTheme, setTheme };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=load-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-theme.js","names":[],"sources":["../src/load-theme.ts"],"sourcesContent":["import { useConfig } from '@veltra/compositions'\nimport { shallowRef, type ShallowRef } from 'vue'\n\nimport { darkTheme } from './theme/dark'\nimport { lightTheme } from './theme/light'\nimport { UITheme } from './theme/ui-theme'\n\nexport const currentTheme: ShallowRef<UITheme | undefined> = shallowRef<UITheme>()\n\nexport function setTheme(mode: 'light' | 'dark' | 'auto'): void {\n UITheme.setTheme(mode)\n}\n\n/**\n * @description 加载主题, 如果你是 SSR 环境,\n * 请在 `onMounted` 中调用,否则你可以在\n * 项目的入口环境(通常是 main.ts)或其他全局环境中调用。\n *\n * 不传 `theme` 时注入内置 light/dark 变量(支持 `setTheme` 与系统暗色偏好)。\n * 传入自定义 `UITheme` 时使用单次 `html { }` 注入。\n */\nexport function loadTheme(theme?: UITheme): void {\n currentTheme.value = theme ?? lightTheme\n\n const { config } = useConfig()\n if (typeof document !== 'undefined') {\n document.documentElement.classList.add(config.size)\n }\n\n if (typeof document === 'undefined') return\n\n if (!theme) {\n currentTheme.value = lightTheme\n UITheme.injectBuiltInThemes(lightTheme, darkTheme)\n return\n }\n\n currentTheme.value = theme\n\n if (theme === lightTheme || theme === darkTheme) {\n UITheme.injectBuiltInThemes(lightTheme, darkTheme)\n UITheme.setTheme(theme === darkTheme ? 'dark' : 'light')\n } else {\n theme.render()\n }\n}\n"],"mappings":";;;;;;AAOA,MAAa,eAAgD,YAAqB;AAElF,SAAgB,SAAS,MAAuC;AAC9D,SAAQ,SAAS,KAAK;;;;;;;;;;AAWxB,SAAgB,UAAU,OAAuB;AAC/C,cAAa,QAAQ,SAAS;CAE9B,MAAM,EAAE,WAAW,WAAW;AAC9B,KAAI,OAAO,aAAa,YACtB,UAAS,gBAAgB,UAAU,IAAI,OAAO,KAAK;AAGrD,KAAI,OAAO,aAAa,YAAa;AAErC,KAAI,CAAC,OAAO;AACV,eAAa,QAAQ;AACrB,UAAQ,oBAAoB,YAAY,UAAU;AAClD;;AAGF,cAAa,QAAQ;AAErB,KAAI,UAAU,cAAc,UAAU,WAAW;AAC/C,UAAQ,oBAAoB,YAAY,UAAU;AAClD,UAAQ,SAAS,UAAU,YAAY,SAAS,QAAQ;OAExD,OAAM,QAAQ"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/** flex布局 */
|
|
3
|
+
/**
|
|
4
|
+
* 设置css变量
|
|
5
|
+
* 参数1:变量前缀
|
|
6
|
+
* 参数2: 一个由值组成的列表或者由key, value组成的map
|
|
7
|
+
* css-var(height, (
|
|
8
|
+
* large: 40px
|
|
9
|
+
* default: 32px
|
|
10
|
+
* small: 24px
|
|
11
|
+
* ))
|
|
12
|
+
* 生成的css变量:
|
|
13
|
+
* --u-height-large: 40px;
|
|
14
|
+
* --u-height-default: 32px;
|
|
15
|
+
* --u-height-small: 24px;
|
|
16
|
+
*/
|
|
17
|
+
/** 暗色:data-theme 与系统偏好,与 UITheme.injectBuiltInThemes 选择器策略一致 */
|
|
18
|
+
html {
|
|
19
|
+
font-family: var(--u-font-family);
|
|
20
|
+
font-weight: normal;
|
|
21
|
+
color: var(--u-text-color-main);
|
|
22
|
+
line-height: 1.4;
|
|
23
|
+
}
|
|
24
|
+
html.small {
|
|
25
|
+
font-size: var(--u-font-size-main-small);
|
|
26
|
+
}
|
|
27
|
+
html.default {
|
|
28
|
+
font-size: var(--u-font-size-main-default);
|
|
29
|
+
}
|
|
30
|
+
html.large {
|
|
31
|
+
font-size: var(--u-font-size-main-large);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body,
|
|
35
|
+
ul,
|
|
36
|
+
h1,
|
|
37
|
+
h2,
|
|
38
|
+
h3,
|
|
39
|
+
h4,
|
|
40
|
+
h5,
|
|
41
|
+
h6 {
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
div,
|
|
46
|
+
section,
|
|
47
|
+
head,
|
|
48
|
+
aside,
|
|
49
|
+
body,
|
|
50
|
+
main,
|
|
51
|
+
h1,
|
|
52
|
+
h2,
|
|
53
|
+
h3,
|
|
54
|
+
h4,
|
|
55
|
+
h5,
|
|
56
|
+
h6,
|
|
57
|
+
p,
|
|
58
|
+
article,
|
|
59
|
+
button,
|
|
60
|
+
input,
|
|
61
|
+
textarea {
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
a {
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
color: inherit;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ul {
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
li {
|
|
75
|
+
list-style: none;
|
|
76
|
+
}
|