@neatui/css 4.2.4 → 4.2.6

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 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
package/core/basic.scss CHANGED
@@ -158,6 +158,14 @@
158
158
  .#{$d}inline-sub > * {
159
159
  display: inline;
160
160
  }
161
+ .#{$d}none,
162
+ .#{$d}none-sub > * {
163
+ display: none;
164
+ }
165
+ .#{$d}hide,
166
+ .#{$d}hide-sub > * {
167
+ opacity: 0;
168
+ }
161
169
 
162
170
  .#{$d}scroll {
163
171
  overflow: auto;
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
- img {
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/dist/neatui.css CHANGED
@@ -581,6 +581,14 @@ sup{
581
581
  display:inline;
582
582
  }
583
583
 
584
+ .none,.none-sub>*{
585
+ display:none;
586
+ }
587
+
588
+ .hide,.hide-sub>*{
589
+ opacity:0;
590
+ }
591
+
584
592
  .scroll{
585
593
  overflow:auto;
586
594
  }
@@ -742,6 +750,12 @@ sup{
742
750
  .pad\:inline,.pad\:inline-sub>*{
743
751
  display:inline;
744
752
  }
753
+ .pad\:none,.pad\:none-sub>*{
754
+ display:none;
755
+ }
756
+ .pad\:hide,.pad\:hide-sub>*{
757
+ opacity:0;
758
+ }
745
759
  .pad\:scroll{
746
760
  overflow:auto;
747
761
  }
@@ -897,6 +911,12 @@ sup{
897
911
  .mob\:inline,.mob\:inline-sub>*{
898
912
  display:inline;
899
913
  }
914
+ .mob\:none,.mob\:none-sub>*{
915
+ display:none;
916
+ }
917
+ .mob\:hide,.mob\:hide-sub>*{
918
+ opacity:0;
919
+ }
900
920
  .mob\:scroll{
901
921
  overflow:auto;
902
922
  }
@@ -16440,10 +16460,10 @@ td[ui-col],th[ui-col]{
16440
16460
  top:0;
16441
16461
  width:100%;
16442
16462
  }
16443
- [ui-cover] img,[ui-cover][ui-cover~=cover] img{
16463
+ [ui-cover] img:not([ui-fit]),[ui-cover][ui-cover~=cover] img:not([ui-fit]){
16444
16464
  object-fit:cover;
16445
16465
  }
16446
- [ui-cover][ui-cover~=contain] img{
16466
+ [ui-cover][ui-cover~=contain] img:not([ui-fit]){
16447
16467
  object-fit:contain;
16448
16468
  }
16449
16469
  [ui-cover][ui-cover~="1:1"]{
@@ -16570,6 +16590,62 @@ td[ui-col],th[ui-col]{
16570
16590
  padding-top:50%;
16571
16591
  }
16572
16592
 
16593
+ [ui-fit~=cover]{
16594
+ object-fit:cover;
16595
+ }
16596
+
16597
+ [ui-fit~=contain]{
16598
+ object-fit:contain;
16599
+ }
16600
+
16601
+ [ui-fit~=fill]{
16602
+ object-fit:fill;
16603
+ }
16604
+
16605
+ [ui-fit~=none]{
16606
+ object-fit:none;
16607
+ }
16608
+
16609
+ [ui-fit~=down]{
16610
+ object-fit:scale-down;
16611
+ }
16612
+
16613
+ [ui-fit~=lt]{
16614
+ object-position:left top;
16615
+ }
16616
+
16617
+ [ui-fit~=lm]{
16618
+ object-position:left center;
16619
+ }
16620
+
16621
+ [ui-fit~=lb]{
16622
+ object-position:left bottom;
16623
+ }
16624
+
16625
+ [ui-fit~=ct]{
16626
+ object-position:center top;
16627
+ }
16628
+
16629
+ [ui-fit~=cm]{
16630
+ object-position:center center;
16631
+ }
16632
+
16633
+ [ui-fit~=cb]{
16634
+ object-position:center bottom;
16635
+ }
16636
+
16637
+ [ui-fit~=rt]{
16638
+ object-position:right top;
16639
+ }
16640
+
16641
+ [ui-fit~=rm]{
16642
+ object-position:right center;
16643
+ }
16644
+
16645
+ [ui-fit~=rb]{
16646
+ object-position:right bottom;
16647
+ }
16648
+
16573
16649
  .ux-none,.ux-none *,.ux-none-sub>*,.ux-none-sub>* *{
16574
16650
  cursor:pointer;
16575
16651
  user-select:none;