@neatui/css 4.2.3 → 4.2.5
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/GUIDE.md +42 -1
- package/core/cover.scss +4 -4
- package/core/fit.scss +48 -0
- package/core/ux.scss +6 -4
- package/dist/neatui.css +60 -4
- package/dist/neatui.min.css +1 -1
- package/dist/neatui.preview.css +60 -4
- package/dist/neatui.preview.min.css +1 -1
- package/neatui.scss +2 -0
- package/package.json +1 -1
- package/tokens/neatui.tokens.json +84 -0
package/GUIDE.md
CHANGED
|
@@ -737,6 +737,47 @@ gap: 间距等级 (ss, sm, mm, ml, ll...)
|
|
|
737
737
|
比例和偏移是同一个“高度模式”,一次只能选择一个;`cover / contain` 可以再与它
|
|
738
738
|
组合。该语法不接受任意比例、任意百分比或响应式前缀。
|
|
739
739
|
|
|
740
|
+
图上也可以用 `ui-fit` 写更完整的装入策略(含 `fill` / `none` / `down` 与锚点);
|
|
741
|
+
若图已声明 `ui-fit`,则以图上的为准。
|
|
742
|
+
|
|
743
|
+
### `ui-fit`:媒资装入
|
|
744
|
+
|
|
745
|
+
`ui-fit` 描述置换元素(`img` / `video` 等)相对已定尺寸容器的装入策略,对应
|
|
746
|
+
`object-fit`,可选锚点对应 `object-position`。与 `ui-cover`(造框)正交。
|
|
747
|
+
|
|
748
|
+
```text
|
|
749
|
+
ui-fit="{mode} {anchor?}"
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
`mode` 五选一:
|
|
753
|
+
|
|
754
|
+
| Token | 意图 | CSS |
|
|
755
|
+
|-------|------|-----|
|
|
756
|
+
| `cover` | 铺满,多出裁 | `object-fit: cover` |
|
|
757
|
+
| `contain` | 完整装入,可留白 | `object-fit: contain` |
|
|
758
|
+
| `fill` | 扯满,可变比 | `object-fit: fill` |
|
|
759
|
+
| `none` | 固有尺寸 | `object-fit: none` |
|
|
760
|
+
| `down` | 只缩不放 | `object-fit: scale-down` |
|
|
761
|
+
|
|
762
|
+
`anchor` 可选,复用 `ui-flex` 九宫格坐标:
|
|
763
|
+
|
|
764
|
+
```text
|
|
765
|
+
lt ct rt
|
|
766
|
+
lm cm rm
|
|
767
|
+
lb cb rb
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
```html
|
|
771
|
+
<img ui-fit="cover" />
|
|
772
|
+
<img ui-fit="contain" />
|
|
773
|
+
<img ui-fit="cover lt" />
|
|
774
|
+
<img ui-fit="contain cm" />
|
|
775
|
+
<img ui-fit="down" />
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
不写 `ui-fit` 时保持浏览器默认;写在 `ui-cover` 框内且未声明时,由封面框默认
|
|
779
|
+
按 `cover` 处理。该语法没有响应式前缀。
|
|
780
|
+
|
|
740
781
|
### `ui-omit`:1–9 行省略
|
|
741
782
|
|
|
742
783
|
```html
|
|
@@ -1350,7 +1391,7 @@ cursor-move
|
|
|
1350
1391
|
- `ux-click[-sub] / hover-underline / ui-hover=":underline"`:始终显示
|
|
1351
1392
|
pointer 与下划线,不会绑定 click 或 hover 事件;
|
|
1352
1393
|
- `ux-scale`:`:active` 时缩放到 `.95`;
|
|
1353
|
-
- `parent-hover:show / parent-hover:hide`:父级 hover 时只改变
|
|
1394
|
+
- `parent-hover:show / parent-hover:hide`:父级 `:hover` 或 `.active` 时只改变
|
|
1354
1395
|
opacity 与 pointer-events,DOM 节点始终保留;
|
|
1355
1396
|
- `ev-none|auto[-sub|-sun]`:以 `!important` 控制 self、直接子级或孙级的
|
|
1356
1397
|
pointer-events。
|
package/core/cover.scss
CHANGED
|
@@ -17,17 +17,17 @@ $sz: no, xs, ss, sm, ms, mm, ml, ls, lm, ll, xl;
|
|
|
17
17
|
background-position: center;
|
|
18
18
|
background-repeat: no-repeat;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
// 封面框默认裁切铺满;图上显式 ui-fit 时由装入策略接管
|
|
21
|
+
img:not([ui-fit]) {
|
|
21
22
|
object-fit: cover;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
24
|
&[ui-cover~='cover'] {
|
|
25
|
-
img {
|
|
25
|
+
img:not([ui-fit]) {
|
|
26
26
|
object-fit: cover;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
&[ui-cover~='contain'] {
|
|
30
|
-
img {
|
|
30
|
+
img:not([ui-fit]) {
|
|
31
31
|
object-fit: contain;
|
|
32
32
|
}
|
|
33
33
|
}
|
package/core/fit.scss
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// ui-fit:置换元素装入策略(object-fit)+ 可选九宫格锚点(object-position)
|
|
2
|
+
// 语法: ui-fit="{mode} {anchor?}"
|
|
3
|
+
// mode: cover | contain | fill | none | down
|
|
4
|
+
// anchor: lt lm lb ct cm cb rt rm rb(与 ui-flex 九宫格同词)
|
|
5
|
+
|
|
6
|
+
[ui-fit~='cover'] {
|
|
7
|
+
object-fit: cover;
|
|
8
|
+
}
|
|
9
|
+
[ui-fit~='contain'] {
|
|
10
|
+
object-fit: contain;
|
|
11
|
+
}
|
|
12
|
+
[ui-fit~='fill'] {
|
|
13
|
+
object-fit: fill;
|
|
14
|
+
}
|
|
15
|
+
[ui-fit~='none'] {
|
|
16
|
+
object-fit: none;
|
|
17
|
+
}
|
|
18
|
+
[ui-fit~='down'] {
|
|
19
|
+
object-fit: scale-down;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[ui-fit~='lt'] {
|
|
23
|
+
object-position: left top;
|
|
24
|
+
}
|
|
25
|
+
[ui-fit~='lm'] {
|
|
26
|
+
object-position: left center;
|
|
27
|
+
}
|
|
28
|
+
[ui-fit~='lb'] {
|
|
29
|
+
object-position: left bottom;
|
|
30
|
+
}
|
|
31
|
+
[ui-fit~='ct'] {
|
|
32
|
+
object-position: center top;
|
|
33
|
+
}
|
|
34
|
+
[ui-fit~='cm'] {
|
|
35
|
+
object-position: center center;
|
|
36
|
+
}
|
|
37
|
+
[ui-fit~='cb'] {
|
|
38
|
+
object-position: center bottom;
|
|
39
|
+
}
|
|
40
|
+
[ui-fit~='rt'] {
|
|
41
|
+
object-position: right top;
|
|
42
|
+
}
|
|
43
|
+
[ui-fit~='rm'] {
|
|
44
|
+
object-position: right center;
|
|
45
|
+
}
|
|
46
|
+
[ui-fit~='rb'] {
|
|
47
|
+
object-position: right bottom;
|
|
48
|
+
}
|
package/core/ux.scss
CHANGED
|
@@ -64,22 +64,24 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
//
|
|
67
|
+
// 移入显示(父级 :hover 或 .active 同效)
|
|
68
68
|
.parent-hover\:show {
|
|
69
69
|
opacity: 0;
|
|
70
70
|
pointer-events: none;
|
|
71
71
|
transition: opacity 0.1s;
|
|
72
72
|
}
|
|
73
|
-
*:hover > .parent-hover\:show
|
|
73
|
+
*:hover > .parent-hover\:show,
|
|
74
|
+
*.active > .parent-hover\:show {
|
|
74
75
|
opacity: 1;
|
|
75
76
|
pointer-events: auto;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
//
|
|
79
|
+
// 移入隐藏(父级 :hover 或 .active 同效)
|
|
79
80
|
.parent-hover\:hide {
|
|
80
81
|
transition: opacity 0.1s;
|
|
81
82
|
}
|
|
82
|
-
*:hover > .parent-hover\:hide
|
|
83
|
+
*:hover > .parent-hover\:hide,
|
|
84
|
+
*.active > .parent-hover\:hide {
|
|
83
85
|
opacity: 0;
|
|
84
86
|
pointer-events: none;
|
|
85
87
|
}
|
package/dist/neatui.css
CHANGED
|
@@ -16440,10 +16440,10 @@ td[ui-col],th[ui-col]{
|
|
|
16440
16440
|
top:0;
|
|
16441
16441
|
width:100%;
|
|
16442
16442
|
}
|
|
16443
|
-
[ui-cover] img,[ui-cover][ui-cover~=cover] img{
|
|
16443
|
+
[ui-cover] img:not([ui-fit]),[ui-cover][ui-cover~=cover] img:not([ui-fit]){
|
|
16444
16444
|
object-fit:cover;
|
|
16445
16445
|
}
|
|
16446
|
-
[ui-cover][ui-cover~=contain] img{
|
|
16446
|
+
[ui-cover][ui-cover~=contain] img:not([ui-fit]){
|
|
16447
16447
|
object-fit:contain;
|
|
16448
16448
|
}
|
|
16449
16449
|
[ui-cover][ui-cover~="1:1"]{
|
|
@@ -16570,6 +16570,62 @@ td[ui-col],th[ui-col]{
|
|
|
16570
16570
|
padding-top:50%;
|
|
16571
16571
|
}
|
|
16572
16572
|
|
|
16573
|
+
[ui-fit~=cover]{
|
|
16574
|
+
object-fit:cover;
|
|
16575
|
+
}
|
|
16576
|
+
|
|
16577
|
+
[ui-fit~=contain]{
|
|
16578
|
+
object-fit:contain;
|
|
16579
|
+
}
|
|
16580
|
+
|
|
16581
|
+
[ui-fit~=fill]{
|
|
16582
|
+
object-fit:fill;
|
|
16583
|
+
}
|
|
16584
|
+
|
|
16585
|
+
[ui-fit~=none]{
|
|
16586
|
+
object-fit:none;
|
|
16587
|
+
}
|
|
16588
|
+
|
|
16589
|
+
[ui-fit~=down]{
|
|
16590
|
+
object-fit:scale-down;
|
|
16591
|
+
}
|
|
16592
|
+
|
|
16593
|
+
[ui-fit~=lt]{
|
|
16594
|
+
object-position:left top;
|
|
16595
|
+
}
|
|
16596
|
+
|
|
16597
|
+
[ui-fit~=lm]{
|
|
16598
|
+
object-position:left center;
|
|
16599
|
+
}
|
|
16600
|
+
|
|
16601
|
+
[ui-fit~=lb]{
|
|
16602
|
+
object-position:left bottom;
|
|
16603
|
+
}
|
|
16604
|
+
|
|
16605
|
+
[ui-fit~=ct]{
|
|
16606
|
+
object-position:center top;
|
|
16607
|
+
}
|
|
16608
|
+
|
|
16609
|
+
[ui-fit~=cm]{
|
|
16610
|
+
object-position:center center;
|
|
16611
|
+
}
|
|
16612
|
+
|
|
16613
|
+
[ui-fit~=cb]{
|
|
16614
|
+
object-position:center bottom;
|
|
16615
|
+
}
|
|
16616
|
+
|
|
16617
|
+
[ui-fit~=rt]{
|
|
16618
|
+
object-position:right top;
|
|
16619
|
+
}
|
|
16620
|
+
|
|
16621
|
+
[ui-fit~=rm]{
|
|
16622
|
+
object-position:right center;
|
|
16623
|
+
}
|
|
16624
|
+
|
|
16625
|
+
[ui-fit~=rb]{
|
|
16626
|
+
object-position:right bottom;
|
|
16627
|
+
}
|
|
16628
|
+
|
|
16573
16629
|
.ux-none,.ux-none *,.ux-none-sub>*,.ux-none-sub>* *{
|
|
16574
16630
|
cursor:pointer;
|
|
16575
16631
|
user-select:none;
|
|
@@ -16617,7 +16673,7 @@ td[ui-col],th[ui-col]{
|
|
|
16617
16673
|
transition:opacity .1s;
|
|
16618
16674
|
}
|
|
16619
16675
|
|
|
16620
|
-
|
|
16676
|
+
.active>.parent-hover\:show,:hover>.parent-hover\:show{
|
|
16621
16677
|
opacity:1;
|
|
16622
16678
|
pointer-events:auto;
|
|
16623
16679
|
}
|
|
@@ -16626,7 +16682,7 @@ td[ui-col],th[ui-col]{
|
|
|
16626
16682
|
transition:opacity .1s;
|
|
16627
16683
|
}
|
|
16628
16684
|
|
|
16629
|
-
|
|
16685
|
+
.active>.parent-hover\:hide,:hover>.parent-hover\:hide{
|
|
16630
16686
|
opacity:0;
|
|
16631
16687
|
pointer-events:none;
|
|
16632
16688
|
}
|