@nopon-web/styles 0.0.1 → 0.0.2
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/_mixin.scss +175 -2
- package/components/box-card.scss +41 -0
- package/components/icon.scss +7 -6
- package/components/picture.scss +25 -6
- package/components/popup.scss +3 -3
- package/components/scroll-bar.scss +29 -27
- package/components/table.scss +47 -0
- package/components/text.scss +11 -4
- package/components.scss +0 -1
- package/package.json +1 -1
package/_mixin.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use './_variables' as var;
|
|
2
2
|
@use './_function' as func;
|
|
3
|
+
@use 'sass:map';
|
|
3
4
|
|
|
4
5
|
@mixin absolute-center($x: true, $y: true) {
|
|
5
6
|
position: absolute;
|
|
@@ -29,10 +30,17 @@
|
|
|
29
30
|
background-image: func.get-image($image);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
@mixin bg-border($width, $height, $image) {
|
|
33
|
-
|
|
33
|
+
@mixin bg-border($width, $height, $image, $border: ('width': 0, 'image-slice': 0), $fill: true) {
|
|
34
|
+
$border-width: map.get($border, 'width');
|
|
35
|
+
$border-image-slice: map.get($border, 'image-slice');
|
|
36
|
+
|
|
37
|
+
width: $width;
|
|
34
38
|
height: $height;
|
|
35
39
|
border-image-source: func.get-image($image);
|
|
40
|
+
border-style: solid;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
border-width: $border-width;
|
|
43
|
+
border-image-slice: #{$border-image-slice}#{if($fill, ' fill', '')};
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
@mixin bg-text($image) {
|
|
@@ -42,3 +50,168 @@
|
|
|
42
50
|
-webkit-text-fill-color: transparent;
|
|
43
51
|
background-image: func.get-image($image);
|
|
44
52
|
}
|
|
53
|
+
|
|
54
|
+
@mixin text-stroke($size: 1px, $color: #000, $blur: 0) {
|
|
55
|
+
text-shadow: #{$size} #{$size} #{$blur} #{$color}, -#{$size} #{$size} #{$blur} #{$color},
|
|
56
|
+
#{$size} -#{$size} #{$blur} #{$color}, -#{$size} -#{$size} #{$blur} #{$color};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// 通用列表布局封装
|
|
60
|
+
/// 支持 grid / flex 两种布局
|
|
61
|
+
/// @param $options - 可选配置
|
|
62
|
+
/// ------------------------------------------------------------------------
|
|
63
|
+
/// HTML 模板示例:
|
|
64
|
+
// <ul class="b-e--list">
|
|
65
|
+
// <li class="b-e--item">
|
|
66
|
+
// <div class="b-e--media">
|
|
67
|
+
// <div class="b-e--picture">
|
|
68
|
+
// <div class="b-e--picture_bg picture">
|
|
69
|
+
// <img src="">
|
|
70
|
+
// </div>
|
|
71
|
+
// <div class="b-e--picture_wrapper picture">
|
|
72
|
+
// <img class="b-e--picture_content"
|
|
73
|
+
// src="">
|
|
74
|
+
// </div>
|
|
75
|
+
// <div class="b-e--picture_decoration picture">
|
|
76
|
+
// <img src="">
|
|
77
|
+
// </div>
|
|
78
|
+
// <div class="b-e--picture_cover picture">
|
|
79
|
+
// <img src="">
|
|
80
|
+
// </div>
|
|
81
|
+
// </div>
|
|
82
|
+
// </div>
|
|
83
|
+
// <div class="b-e--content">
|
|
84
|
+
// <div class="b-e--content_text">
|
|
85
|
+
// <span class="text"></span>
|
|
86
|
+
// </div>
|
|
87
|
+
// </div>
|
|
88
|
+
// </li>
|
|
89
|
+
// </ul>
|
|
90
|
+
/// ------------------------------------------------------------------------
|
|
91
|
+
@mixin extend-list($options: ()) {
|
|
92
|
+
// --- 默认参数 ---
|
|
93
|
+
$defaults: (
|
|
94
|
+
'namespace-block': 'b',
|
|
95
|
+
'namespace-element': 'e',
|
|
96
|
+
// 布局模式
|
|
97
|
+
'display': grid,
|
|
98
|
+
// 是否换行
|
|
99
|
+
'wrap': false,
|
|
100
|
+
// 列数
|
|
101
|
+
'col': 4,
|
|
102
|
+
// 间距
|
|
103
|
+
'gap': 10px,
|
|
104
|
+
// 图片宽高比
|
|
105
|
+
'picture-ratio': 100%,
|
|
106
|
+
// 图片宽度
|
|
107
|
+
'picture-width': 100%,
|
|
108
|
+
// 图片高度
|
|
109
|
+
'picture-height': 100%,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// 合并配置
|
|
113
|
+
$config: map.merge($defaults, $options);
|
|
114
|
+
|
|
115
|
+
// 变量定义
|
|
116
|
+
$block: map.get($config, 'namespace-block');
|
|
117
|
+
$element: map.get($config, 'namespace-element');
|
|
118
|
+
$display: map.get($config, 'display');
|
|
119
|
+
$wrap: map.get($config, 'wrap');
|
|
120
|
+
$col: map.get($config, 'col');
|
|
121
|
+
$gap: map.get($config, 'gap');
|
|
122
|
+
$picture-ratio: map.get($config, 'picture-ratio');
|
|
123
|
+
$picture-width: map.get($config, 'picture-width');
|
|
124
|
+
$picture-height: map.get($config, 'picture-height');
|
|
125
|
+
|
|
126
|
+
// --- 列表容器 ---
|
|
127
|
+
.#{$block}-#{$element}--list {
|
|
128
|
+
--col: #{$col};
|
|
129
|
+
--gap: #{$gap};
|
|
130
|
+
--picture-ratio: #{$picture-ratio};
|
|
131
|
+
--picture-width: #{$picture-width};
|
|
132
|
+
--picture-height: #{$picture-height};
|
|
133
|
+
display: $display;
|
|
134
|
+
|
|
135
|
+
// flex 布局
|
|
136
|
+
@if $display == flex {
|
|
137
|
+
margin: 0 calc(var(--gap) / -2);
|
|
138
|
+
|
|
139
|
+
// 换行
|
|
140
|
+
@if $wrap {
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// grid 布局(默认)
|
|
146
|
+
@if $display == grid {
|
|
147
|
+
gap: var(--gap);
|
|
148
|
+
|
|
149
|
+
// 换行
|
|
150
|
+
@if $wrap {
|
|
151
|
+
grid-template-columns: repeat(var(--col), minmax(0, 1fr));
|
|
152
|
+
} @else {
|
|
153
|
+
grid-auto-flow: column;
|
|
154
|
+
grid-auto-columns: calc((100% - (var(--col) - 1) * var(--gap)) / var(--col));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@if $wrap == false {
|
|
159
|
+
overflow-x: scroll;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// --- 列表项 ---
|
|
164
|
+
.#{$block}-#{$element}--item {
|
|
165
|
+
position: relative;
|
|
166
|
+
font-size: 0;
|
|
167
|
+
|
|
168
|
+
@if $display == flex {
|
|
169
|
+
flex-shrink: 0;
|
|
170
|
+
width: calc(100% / var(--col));
|
|
171
|
+
padding: calc(var(--gap) / 2);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// --- 图片 ---
|
|
176
|
+
.#{$block}-#{$element}--picture {
|
|
177
|
+
position: relative;
|
|
178
|
+
|
|
179
|
+
&_bg {
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 100%;
|
|
182
|
+
@include absolute-center(true, true);
|
|
183
|
+
z-index: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&_wrapper {
|
|
187
|
+
position: relative;
|
|
188
|
+
height: 0;
|
|
189
|
+
padding-bottom: var(--picture-ratio);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&_content {
|
|
193
|
+
max-width: var(--picture-width);
|
|
194
|
+
max-height: var(--picture-height);
|
|
195
|
+
@include absolute-center(true, true);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&_decoration {
|
|
199
|
+
position: absolute;
|
|
200
|
+
top: 0;
|
|
201
|
+
right: 0;
|
|
202
|
+
z-index: 1;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&_cover {
|
|
206
|
+
@include absolute-center(true, true);
|
|
207
|
+
z-index: 2;
|
|
208
|
+
width: 100%;
|
|
209
|
+
height: 100%;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// --- 内容区 ---
|
|
214
|
+
.#{$block}-#{$element}--content {
|
|
215
|
+
text-align: center;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Example HTML:
|
|
3
|
+
|
|
4
|
+
<div class="box-card">
|
|
5
|
+
<div class="box-wrapper">
|
|
6
|
+
<div class="box-header">
|
|
7
|
+
<span class="box-title">Title</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="box-body">Content</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
@use '../mixin' as mixin;
|
|
15
|
+
|
|
16
|
+
.box-card {
|
|
17
|
+
position: relative;
|
|
18
|
+
font-size: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.box-wrapper {
|
|
22
|
+
margin: 0 auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.box-header {
|
|
26
|
+
@include mixin.absolute-center(true, false);
|
|
27
|
+
top: 0;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.box-title {
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.box-body--bg {
|
|
37
|
+
width: 100%;
|
|
38
|
+
@include mixin.absolute-center(true, false);
|
|
39
|
+
top: 0;
|
|
40
|
+
z-index: -1;
|
|
41
|
+
}
|
package/components/icon.scss
CHANGED
package/components/picture.scss
CHANGED
|
@@ -1,26 +1,45 @@
|
|
|
1
1
|
@use '../mixin' as mixin;
|
|
2
2
|
|
|
3
|
-
// 图片
|
|
4
3
|
.picture {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
img {
|
|
4
|
+
> img {
|
|
8
5
|
width: 100%;
|
|
9
6
|
height: 100%;
|
|
10
7
|
object-fit: contain;
|
|
11
8
|
}
|
|
12
9
|
|
|
10
|
+
&:has(.picture-content, .picture-frame) {
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 图片内容
|
|
13
15
|
.picture-content {
|
|
14
16
|
&--center {
|
|
15
17
|
@include mixin.absolute-center(true, true);
|
|
16
18
|
}
|
|
19
|
+
|
|
17
20
|
&--bottom {
|
|
18
21
|
@include mixin.absolute-center(true, false);
|
|
19
22
|
bottom: 0;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
// 图片边框
|
|
27
|
+
.picture-frame {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
@include mixin.absolute-center(true, true);
|
|
31
|
+
z-index: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:has(.picture-frame) {
|
|
35
|
+
--frame-width: 0.02rem;
|
|
36
|
+
|
|
37
|
+
> img {
|
|
38
|
+
position: relative;
|
|
39
|
+
width: calc(100% - var(--frame-width) * 2);
|
|
40
|
+
height: calc(100% - var(--frame-width) * 2);
|
|
41
|
+
margin: var(--frame-width);
|
|
42
|
+
z-index: 0;
|
|
43
|
+
}
|
|
25
44
|
}
|
|
26
45
|
}
|
package/components/popup.scss
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@use '../_variables' as var;
|
|
2
|
-
|
|
3
1
|
.popup {
|
|
4
2
|
overflow: hidden;
|
|
5
3
|
|
|
@@ -8,6 +6,7 @@
|
|
|
8
6
|
display: flex;
|
|
9
7
|
flex-direction: column;
|
|
10
8
|
}
|
|
9
|
+
|
|
11
10
|
.popup-body {
|
|
12
11
|
flex: 1;
|
|
13
12
|
}
|
|
@@ -36,7 +35,8 @@
|
|
|
36
35
|
|
|
37
36
|
.popup-footer--button_list {
|
|
38
37
|
display: flex;
|
|
39
|
-
|
|
38
|
+
justify-content: space-around;
|
|
39
|
+
margin: 0 auto;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// 自定义
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
.s-scroll {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
&::-webkit-scrollbar {
|
|
3
|
+
display: none;
|
|
4
|
+
}
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.s-scroll-bar_thumb {
|
|
10
|
-
position: absolute;
|
|
11
|
-
bottom: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
height: 6px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
6
|
+
&-bar {
|
|
7
|
+
&_x {
|
|
8
|
+
position: relative;
|
|
16
9
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
10
|
+
.s-scroll-bar_thumb {
|
|
11
|
+
position: absolute;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
height: 6px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
26
17
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
&_y {
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
.s-scroll-bar_thumb {
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&_thumb {
|
|
30
|
+
background-color: var(--theme-color);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.table {
|
|
2
|
+
--grid-padding: 0.2rem 0;
|
|
3
|
+
--grid-width: auto;
|
|
4
|
+
--bg-thead: rgba(0, 0, 0, 0.2);
|
|
5
|
+
--color-border: rgba(255, 255, 255, 0.2);
|
|
6
|
+
width: 100%;
|
|
7
|
+
font-size: 0;
|
|
8
|
+
border-spacing: 0;
|
|
9
|
+
border-collapse: separate;
|
|
10
|
+
border: 0.02rem solid var(--color-border);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
|
|
13
|
+
thead {
|
|
14
|
+
background-color: var(--bg-thead);
|
|
15
|
+
|
|
16
|
+
.text {
|
|
17
|
+
font-size: 0.3rem;
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
tbody {
|
|
23
|
+
.text {
|
|
24
|
+
font-size: 0.28rem;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
tr {
|
|
29
|
+
width: 100%;
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
th,
|
|
34
|
+
td {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
flex: 1 0 var(--grid-width);
|
|
39
|
+
padding: var(--grid-padding);
|
|
40
|
+
border: solid var(--color-border);
|
|
41
|
+
border-width: 0 0.02rem 0.02rem 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.text {
|
|
45
|
+
vertical-align: middle;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/components/text.scss
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
@use '../_variables' as var;
|
|
2
|
-
|
|
3
|
-
// 文本
|
|
4
1
|
.text {
|
|
5
2
|
display: inline-block;
|
|
6
|
-
font-size: var(--text-sm);
|
|
7
3
|
line-height: 1;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
|
|
6
|
+
&.paragraph {
|
|
7
|
+
line-height: 1.5;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.ellipsis {
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
text-overflow: ellipsis;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
8
15
|
}
|
package/components.scss
CHANGED