@neatui/css 5.4.0 → 5.5.1
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/CHANGELOG.md +13 -0
- package/GUIDE.md +192 -135
- package/README.md +10 -0
- package/core/basic.scss +5 -11
- package/dist/neatui.css +1 -21
- package/dist/neatui.min.css +1 -1
- package/dist/neatui.preview.css +1 -21
- package/dist/neatui.preview.min.css +1 -1
- package/package.json +1 -1
- package/tokens/neatui.tokens.json +176 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @neatui/css 更新记录
|
|
2
2
|
|
|
3
|
+
## 5.5.1
|
|
4
|
+
|
|
5
|
+
- `GUIDE.md` 开头新增「规则速查」:全部可用写法与禁止清单,按编译结果核对;修正手册中不存在的写法(`text-*`、`shadow-*`、`overflow-*`、`cursor-*`、`w-screen` 等)与错误数值(`z-*`、`w-*l`),按钮必须带 `@a` / `@b` 主题标记。
|
|
6
|
+
- `README.md` 新增 AI 使用指引。
|
|
7
|
+
- token schema 新增 `ui-wrap`,`yarn validate` 与 VS Code 插件(0.2.1)可校验、补全;移除换行类补全。
|
|
8
|
+
|
|
9
|
+
## 5.5.0
|
|
10
|
+
|
|
11
|
+
### 不兼容变更:换行只用 `ui-wrap`
|
|
12
|
+
|
|
13
|
+
- 移除 `.wrap`、`.nowrap` 及 `pad:`、`mob:` 换行类。
|
|
14
|
+
- `ui-wrap` 新增 `no`(不换行)。迁移:`nowrap` → `ui-wrap="no"`,`wrap` → `ui-wrap="all"`,`mob:wrap` → `ui-wrap="=mob"`,`pad:wrap` → `ui-wrap="<dpc"`。
|
|
15
|
+
|
|
3
16
|
## 5.2.1
|
|
4
17
|
|
|
5
18
|
- `ui-icon="close"`:图案放大到 80%,线条更细;`steps` 内部使用的 `%icon-close` 不变。
|
package/GUIDE.md
CHANGED
|
@@ -1,15 +1,89 @@
|
|
|
1
1
|
# NeatUI 完整使用手册
|
|
2
2
|
|
|
3
|
-
> **版本**: @neatui/css
|
|
3
|
+
> **版本**: @neatui/css v5.x
|
|
4
4
|
>
|
|
5
|
-
> **更新日期**: 2026-
|
|
5
|
+
> **更新日期**: 2026-11-02
|
|
6
6
|
>
|
|
7
7
|
> **定位**: 这不是又一个 CSS 工具库,而是一套完整的设计系统 + 原子化实现
|
|
8
|
+
>
|
|
9
|
+
> **AI / 新读者**:先读下方「规则速查」,按它写代码;需要细节时再查后面对应章节。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 规则速查
|
|
14
|
+
|
|
15
|
+
本节是确定性规则,人和 AI 都应以此为准。只使用下面列出的写法;**不在这里、也不在后续章节中的 class 或属性值,视为不存在**,不要按其他框架的习惯臆造(如 `text-center`、`shadow-md`、`overflow-hidden`、`cursor-pointer`)。
|
|
16
|
+
|
|
17
|
+
### 1. 档位
|
|
18
|
+
|
|
19
|
+
| 名称 | 取值 |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| 尺寸档 `{size}` | `no xs ss sm sl ms mm ml ls lm ll xl`(12 档,由小到大) |
|
|
22
|
+
| 宽高 / 圆角 / 字号分段 | 在档位后加 `*s` / `*m` / `*l`,如 `w-xl*s`、`fs-mm*s`、`r-sm*m`(`no`、`full` 无分段) |
|
|
23
|
+
| 层级 / 透明度档 | `no xs ss sm sl ms mm ml ls lm ll xl xx`(13 档) |
|
|
24
|
+
| 断点 | `mob` <800px,`pad` 800–1279px,`dpc` ≥1280px;细分 `mob-s/m/l`、`pad-s/m/l`、`dpc-s/m/l`,分界 480 / 640 / 800 / 960 / 1120 / 1280 / 1440 / 1600px |
|
|
25
|
+
|
|
26
|
+
### 2. 原子 class
|
|
27
|
+
|
|
28
|
+
| 用途 | 写法 |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| 内边距 | `n-` `nx-` `ny-` `nt-` `nr-` `nb-` `nl-` + `{size}`;加 `-sub` 作用于直接子元素,`-sun` 作用于孙级 |
|
|
31
|
+
| 外边距 | `m-` `mx-` `my-` `mt-` `mr-` `mb-` `ml-` + `{size}`,同样支持 `-sub` / `-sun`;负值 `-m-sm`、`-mt-sm`(无 `-sub`) |
|
|
32
|
+
| 间隙 | `gap-{size}`(Flex 与 Grid 共用) |
|
|
33
|
+
| 宽高 | `w-` `h-` `min-w-` `max-w-` `min-h-` `max-h-` + `{size}` / 分段;`w-full` `h-full` `full` `w-auto` `h-auto` |
|
|
34
|
+
| 圆角 | `r-{size}`、`r-full`;方向 `r-t-` `r-b-` `r-lt-` `r-rt-` `r-lb-` `r-rb-` |
|
|
35
|
+
| 字号 | `fs-{size}` / 分段;语义 `fs-case` `fs-note` `fs-desc` `fs-body` `fs-lead`;`fs-root` `fs++` `fs--` |
|
|
36
|
+
| 字重 | `bold`、`fw1`…`fw9`(=100…900)、`fw0`(normal) |
|
|
37
|
+
| 行高 | `lh-{size}`(无 `lh-sl`) |
|
|
38
|
+
| 文字对齐 | `al` `ac` `ar` `aj`(左 / 中 / 右 / 两端);`-sub` 作用于子元素 |
|
|
39
|
+
| 垂直对齐 | `vt` `vm` `vb` |
|
|
40
|
+
| 大小写 | `upper` `lower` |
|
|
41
|
+
| 显示 | `block` `inline` `inline-block`(`dib`) `flex` `inline-flex` `none`(隐藏);`hide` 只设 `opacity:0` 保留占位;均有 `-sub` |
|
|
42
|
+
| 定位 | `pr` `pa` `pf` `ps`;偏移 `ot-` `or-` `ob-` `ol-` + `{size}` |
|
|
43
|
+
| 层级 | `z-{层级档}`(`z-no`=0 … `z-xx`=12) |
|
|
44
|
+
| 透明度 | `o-{层级档}`(`o-no`=0 … `o-mm`=.5 … `o-xx`=1) |
|
|
45
|
+
| 滚动 | `scroll` `scroll-x` `scroll-y`,或属性 `ui-scroll` |
|
|
46
|
+
| Flex 子项 | `flex-block`(flex:1 且裁切) `flex-fill`(flex:1 不裁切) `flex-grow` `flex-shrink` `flex-fixed` |
|
|
47
|
+
| 边框 | 宽度 `b-` `bt-` `br-` `bb-` `bl-` `bx-` `by-` + `{size}`;样式 `b-solid` `b-dashed` `b-double` `b-dotted` `b-no` |
|
|
48
|
+
| 颜色 | `co-` 文字、`bg-` 背景、`b-` 边框 + 颜色名;派生 `-o-` / `-w-` / `-b-` + `xxs…xxl`,如 `bg-main-o-sm` |
|
|
49
|
+
| 颜色名 | 种子 `main text fore back link code well warn risk`;自动 `read desc note case line weak deep none`;绝对色 `w`(白) `b`(黑);项目可扩展 |
|
|
50
|
+
| 状态 | 只有 `:hover` 与 `:active` 后缀,如 `co-main:hover`、`bg-main-b-sm:active`(颜色、`z-`、`o-`);**没有** `:focus` / `:disabled` |
|
|
51
|
+
| 交互 | `ux-hover` `ux-shadow` `ux-click` `ux-scale` `ux-disable` `ux-none`;`ev-none` / `ev-auto`(pointer-events) |
|
|
52
|
+
| 容器 | `doc`(正文宽度,最大 800px);`box` `box-base` `box-norm` `box-slim` `box-wide` `box-full` |
|
|
53
|
+
|
|
54
|
+
响应式:上表除颜色、状态、交互、边框样式、`z-`、`o-` 外,class 都可加 `pad:`(≤1279px)或 `mob:`(≤799px)前缀,层叠顺序 `基础 → pad: → mob:`。**没有 `dpc:` class 前缀。**
|
|
55
|
+
|
|
56
|
+
### 3. 属性语法
|
|
57
|
+
|
|
58
|
+
| 属性 | 语法 | 示例 |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `ui-flex` | `{row\|col} {x}{y}` + 可选 `wrap` `reverse` `inline` `block` `fixed`;x:`l c r x a`,y:`t m b y d`;可加 `pad:` `mob:` | `ui-flex="row xm"`、`ui-flex="col cm mob:row"` |
|
|
61
|
+
| `ui-grid` | 列数 `1..12` + 九宫格对齐 + `block`;`mob:` `pad:` `dpc:` 前缀;间距用 `gap-*` class | `ui-grid="mob:1 pad:2 dpc:4" class="gap-mm"` |
|
|
62
|
+
| `ui-row` / `ui-col` | `{断点}-{0..24}`,断点为 `mob pad dpc` 及细分;`ui-row` 另有 `space` `:full` `reverse` | `ui-row="space" ui-col="mob-24 dpc-8"` |
|
|
63
|
+
| `ui-hide` | `>` `<` `=` + 断点或细分档,可空格组合,命中即隐藏 | `ui-hide="<pad"`、`ui-hide="=mob =dpc-l"` |
|
|
64
|
+
| `ui-wrap` | `no`(不换行)、`all`(全部换行)、或同 `ui-hide` 的断点值(列出的范围换行,其余不换行) | `ui-wrap="no"`、`ui-wrap="=mob"` |
|
|
65
|
+
| `ui-omit` | `1..9` 行省略 | `ui-omit="2"` |
|
|
66
|
+
| `ui-cover` | 13 种比例或 `+{size}` / `-{size}`,可加 `cover` / `contain` | `ui-cover="16:9"` |
|
|
67
|
+
| `ui-fit` | `cover contain fill none down` + 可选九宫格锚点 | `ui-fit="cover lt"` |
|
|
68
|
+
| `ui-scroll` | `:x` `:y` `:hidden` `x:hidden` `y:hidden` `x:unset` `y:unset` `stable`,尺寸 `xs s m l xl` | `ui-scroll=":x :y"` |
|
|
69
|
+
| `ui-btn` | 主题 `@a` / `@b`(必填) + 颜色名 + 尺寸 `xs s m l xl` + 修饰 `:round` `:border` `:square` `:underline`(文字按钮) `:block`(100% 宽) `:disabled` | `ui-btn="@a main s :border"` |
|
|
70
|
+
|
|
71
|
+
### 4. 禁止清单
|
|
72
|
+
|
|
73
|
+
- 不写任意像素或色值(`style="padding:13px"`、`color:#f00`);用档位和语义色。确需特殊值时手写样式并注释原因。
|
|
74
|
+
- 不用其他框架的类名:`text-center`→`ac`,`font-bold`→`bold`,`hidden`→`none`,没有 `overflow-*`(滚动用 `scroll` / `scroll-x` / `scroll-y` 或 `ui-scroll`),`shadow-*` / `cursor-*` / `w-screen` / `h-screen` 不存在。
|
|
75
|
+
- 换行只用 `ui-wrap`;`wrap` / `nowrap` 类已移除;不要写 `ui-wrap=""`,用 `ui-wrap="no"`。`flex-wrap` / `flex-nowrap` 是 flex 换行,与文字换行无关。
|
|
76
|
+
- 不写 `dpc:` class 前缀;桌面值写在无前缀的基础 class 上。
|
|
77
|
+
- 组件属性必须带主题标记,否则没有样式:`ui-btn` `ui-btns` `ui-card` `ui-tag` `ui-tabs` `ui-form` `ui-img` `ui-avatar` `ui-note` `ui-list` `ui-line` `ui-steps` `ui-title` `ui-navs` 等写 `@a`(部分组件另有 `@b` `@c`…),如 `ui-tag="@a main"`。布局属性(`ui-flex` `ui-grid` `ui-row` `ui-hide` `ui-wrap` `ui-scroll` `ui-cover` `ui-fit` `ui-omit`)不需要。
|
|
78
|
+
- 不手写 `@media`;用 class 前缀、`ui-hide`、`ui-wrap` 或 SCSS mixin(`neatui.mob` / `neatui.pad` / `neatui.dpc`)。
|
|
79
|
+
- 有色深背景上的白字用 `co-w`,不用 `co-fore` / `co-text`。
|
|
80
|
+
- `ui-hide` 只改可见性,不卸载组件;需要销毁时用 `v-if`。
|
|
8
81
|
|
|
9
82
|
---
|
|
10
83
|
|
|
11
84
|
## 目录
|
|
12
85
|
|
|
86
|
+
- [规则速查](#规则速查)
|
|
13
87
|
- [核心理念](#核心理念)
|
|
14
88
|
- [架构概览](#架构概览)
|
|
15
89
|
- [快速开始](#快速开始)
|
|
@@ -126,7 +200,7 @@ npm install @neatui/css @neatui/vue
|
|
|
126
200
|
</div>
|
|
127
201
|
|
|
128
202
|
<!-- NeatUI 方式 -->
|
|
129
|
-
<div ui-flex="row cm" class="n-sm bg-fore r-sm
|
|
203
|
+
<div ui-flex="row cm" class="n-sm bg-fore r-sm">
|
|
130
204
|
<h1 class="fs-lm bold co-text">Hello World</h1>
|
|
131
205
|
</div>
|
|
132
206
|
```
|
|
@@ -596,7 +670,7 @@ y: 纵向对齐
|
|
|
596
670
|
</nav>
|
|
597
671
|
|
|
598
672
|
<!-- 垂直两端分布 + 水平居中 -->
|
|
599
|
-
<div ui-flex="col
|
|
673
|
+
<div ui-flex="col cy">
|
|
600
674
|
<header>顶部</header>
|
|
601
675
|
<footer>底部</footer>
|
|
602
676
|
</div>
|
|
@@ -627,7 +701,7 @@ y: 纵向对齐
|
|
|
627
701
|
</div>
|
|
628
702
|
|
|
629
703
|
<!-- NeatUI -->
|
|
630
|
-
<div ui-flex="row cm" class="h-
|
|
704
|
+
<div ui-flex="row cm" class="h-full"> <!-- 父级需有确定高度 -->
|
|
631
705
|
<div class="bg-fore n-ml">内容</div>
|
|
632
706
|
</div>
|
|
633
707
|
```
|
|
@@ -643,11 +717,11 @@ y: 纵向对齐
|
|
|
643
717
|
|
|
644
718
|
<!-- NeatUI -->
|
|
645
719
|
<div ui-flex="col cm" class="n-sm">
|
|
646
|
-
<div ui-img="sz:sl :round">
|
|
720
|
+
<div ui-img="@a sz:sl :round">
|
|
647
721
|
<img />
|
|
648
722
|
</div>
|
|
649
723
|
<h3 class="mt-ss">标题</h3>
|
|
650
|
-
<button class="mt-ms" ui-btn="main">按钮</button>
|
|
724
|
+
<button class="mt-ms" ui-btn="@a main">按钮</button>
|
|
651
725
|
</div>
|
|
652
726
|
```
|
|
653
727
|
|
|
@@ -713,7 +787,7 @@ grade: gap class 的间距等级 (no, xs, ss, sm, sl, ms, mm, ml, ls, lm, ll, xl
|
|
|
713
787
|
<img :src="product.image" />
|
|
714
788
|
<h3 class="co-main fs-ml">{{ product.name }}</h3>
|
|
715
789
|
<p class="co-desc">{{ product.desc }}</p>
|
|
716
|
-
<button ui-btn="main s">购买</button>
|
|
790
|
+
<button ui-btn="@a main s">购买</button>
|
|
717
791
|
</li>
|
|
718
792
|
</ul>
|
|
719
793
|
```
|
|
@@ -935,11 +1009,15 @@ dpc, dpc-s, dpc-m, dpc-l
|
|
|
935
1009
|
|
|
936
1010
|
### 按断点换行 `ui-wrap`
|
|
937
1011
|
|
|
938
|
-
|
|
1012
|
+
换行只用 `ui-wrap`(`wrap`、`nowrap` 及 `pad:`、`mob:` 换行类已移除)。三类取值:
|
|
1013
|
+
|
|
1014
|
+
- `no`:不换行(`no` + `wrap`,对应 CSS `nowrap`)。
|
|
1015
|
+
- `all`:全部换行。
|
|
1016
|
+
- 断点值:与 `ui-hide` 相同(`>`、`<`、`=` + 九档细分值或设备段别名),可用空格组合,列出的范围换行、其余不换行。
|
|
939
1017
|
|
|
940
1018
|
| 换行的端 | 写法 |
|
|
941
1019
|
| --- | --- |
|
|
942
|
-
| 都不换行 | `ui-wrap=""` |
|
|
1020
|
+
| 都不换行 | `ui-wrap="no"` |
|
|
943
1021
|
| 仅移动 | `ui-wrap="=mob"` |
|
|
944
1022
|
| 仅平板 | `ui-wrap="=pad"` |
|
|
945
1023
|
| 仅桌面 | `ui-wrap="=dpc"` |
|
|
@@ -953,7 +1031,7 @@ dpc, dpc-s, dpc-m, dpc-l
|
|
|
953
1031
|
<div ui-wrap="=pad-m">...</div>
|
|
954
1032
|
```
|
|
955
1033
|
|
|
956
|
-
|
|
1034
|
+
迁移:`nowrap` → `ui-wrap="no"`,`wrap` → `ui-wrap="all"`,`mob:wrap` → `ui-wrap="=mob"`,`pad:wrap` → `ui-wrap="<dpc"`。
|
|
957
1035
|
`all` 不带媒体查询,比 `=mob =pad =dpc` 更可靠(后者在断点间的小数宽度,如 799.5px,不会命中)。
|
|
958
1036
|
|
|
959
1037
|
### 响应式 class 前缀
|
|
@@ -1041,7 +1119,7 @@ function toggleElderlyMode() {
|
|
|
1041
1119
|
</ul>
|
|
1042
1120
|
|
|
1043
1121
|
<!-- 移动端汉堡按钮 -->
|
|
1044
|
-
<button ui-hide=">mob" ui-btn="none s">
|
|
1122
|
+
<button ui-hide=">mob" ui-btn="@a none s">
|
|
1045
1123
|
<i class="icon-menu"></i>
|
|
1046
1124
|
</button>
|
|
1047
1125
|
</nav>
|
|
@@ -1054,95 +1132,97 @@ function toggleElderlyMode() {
|
|
|
1054
1132
|
### ui-btn 语法
|
|
1055
1133
|
|
|
1056
1134
|
```html
|
|
1057
|
-
ui-btn="
|
|
1135
|
+
ui-btn="@{theme} [{color}] [{size}] [:{modifier}...]"
|
|
1058
1136
|
|
|
1059
|
-
@{
|
|
1060
|
-
@a
|
|
1061
|
-
@i = 内联按钮 (inline-flex)
|
|
1137
|
+
@{theme}(必填):
|
|
1138
|
+
@a, @b // 按钮主题风格;不写则没有按钮样式
|
|
1062
1139
|
|
|
1063
1140
|
{color}:
|
|
1064
|
-
main
|
|
1141
|
+
main vice well warn risk info none text read desc note case line weak back w b link
|
|
1065
1142
|
|
|
1066
1143
|
{size}:
|
|
1067
|
-
s
|
|
1144
|
+
xs s m(默认) l xl
|
|
1068
1145
|
|
|
1069
1146
|
:{modifier}:
|
|
1070
|
-
:round
|
|
1071
|
-
:
|
|
1072
|
-
:
|
|
1147
|
+
:round // 胶囊圆角
|
|
1148
|
+
:square // 正方形(图标按钮)
|
|
1149
|
+
:border // 线框
|
|
1150
|
+
:underline // 文字按钮(透明底,悬停下划线)
|
|
1151
|
+
:block // 宽度 100%
|
|
1152
|
+
:disabled // 视觉禁用
|
|
1073
1153
|
```
|
|
1074
1154
|
|
|
1075
1155
|
### 基础按钮
|
|
1076
1156
|
|
|
1077
1157
|
```html
|
|
1078
1158
|
<!-- 主色按钮 -->
|
|
1079
|
-
<button ui-btn="main">主操作</button>
|
|
1159
|
+
<button ui-btn="@a main">主操作</button>
|
|
1080
1160
|
|
|
1081
1161
|
<!-- 辅助色按钮 -->
|
|
1082
|
-
<button ui-btn="vice">次要操作</button>
|
|
1162
|
+
<button ui-btn="@a vice">次要操作</button>
|
|
1083
1163
|
|
|
1084
1164
|
<!-- 成功按钮 -->
|
|
1085
|
-
<button ui-btn="well">提交</button>
|
|
1165
|
+
<button ui-btn="@a well">提交</button>
|
|
1086
1166
|
|
|
1087
1167
|
<!-- 警告按钮 -->
|
|
1088
|
-
<button ui-btn="warn">警告</button>
|
|
1168
|
+
<button ui-btn="@a warn">警告</button>
|
|
1089
1169
|
|
|
1090
1170
|
<!-- 危险按钮 -->
|
|
1091
|
-
<button ui-btn="risk">删除</button>
|
|
1171
|
+
<button ui-btn="@a risk">删除</button>
|
|
1092
1172
|
|
|
1093
1173
|
<!-- 信息按钮 -->
|
|
1094
|
-
<button ui-btn="info">详情</button>
|
|
1174
|
+
<button ui-btn="@a info">详情</button>
|
|
1095
1175
|
|
|
1096
1176
|
<!-- 无样式按钮 -->
|
|
1097
|
-
<button ui-btn="none">纯文本</button>
|
|
1177
|
+
<button ui-btn="@a none">纯文本</button>
|
|
1098
1178
|
```
|
|
1099
1179
|
|
|
1100
1180
|
### 尺寸变体
|
|
1101
1181
|
|
|
1102
1182
|
```html
|
|
1103
|
-
<button ui-btn="main s">小按钮</button>
|
|
1104
|
-
<button ui-btn="main m">中按钮</button>
|
|
1105
|
-
<button ui-btn="main l">大按钮</button>
|
|
1183
|
+
<button ui-btn="@a main s">小按钮</button>
|
|
1184
|
+
<button ui-btn="@a main m">中按钮</button>
|
|
1185
|
+
<button ui-btn="@a main l">大按钮</button>
|
|
1106
1186
|
```
|
|
1107
1187
|
|
|
1108
1188
|
### 块级按钮
|
|
1109
1189
|
|
|
1110
1190
|
```html
|
|
1111
1191
|
<!-- 100% 宽度 -->
|
|
1112
|
-
<button ui-btn="@a main">登录</button>
|
|
1192
|
+
<button ui-btn="@a main :block">登录</button>
|
|
1113
1193
|
```
|
|
1114
1194
|
|
|
1115
1195
|
### 样式修饰符
|
|
1116
1196
|
|
|
1117
1197
|
```html
|
|
1118
|
-
<!--
|
|
1119
|
-
<button ui-btn="main :round">
|
|
1198
|
+
<!-- 胶囊按钮 -->
|
|
1199
|
+
<button ui-btn="@a main :round">
|
|
1120
1200
|
<i class="icon-check"></i>
|
|
1121
1201
|
</button>
|
|
1122
1202
|
|
|
1123
1203
|
<!-- 边框按钮 -->
|
|
1124
|
-
<button ui-btn="main :border">边框样式</button>
|
|
1204
|
+
<button ui-btn="@a main :border">边框样式</button>
|
|
1125
1205
|
|
|
1126
1206
|
<!-- 文本按钮 -->
|
|
1127
|
-
<button ui-btn="main :
|
|
1207
|
+
<button ui-btn="@a main :underline">文本链接</button>
|
|
1128
1208
|
```
|
|
1129
1209
|
|
|
1130
1210
|
### 组合使用
|
|
1131
1211
|
|
|
1132
1212
|
```html
|
|
1133
|
-
<!-- 块级 + 大尺寸 +
|
|
1134
|
-
<button ui-btn="@a main l :round">提交订单</button>
|
|
1213
|
+
<!-- 块级 + 大尺寸 + 胶囊 -->
|
|
1214
|
+
<button ui-btn="@a main l :round :block">提交订单</button>
|
|
1135
1215
|
|
|
1136
1216
|
<!-- 小尺寸 + 边框 -->
|
|
1137
|
-
<button ui-btn="vice s :border">取消</button>
|
|
1217
|
+
<button ui-btn="@a vice s :border">取消</button>
|
|
1138
1218
|
```
|
|
1139
1219
|
|
|
1140
1220
|
### 按钮组
|
|
1141
1221
|
|
|
1142
1222
|
```html
|
|
1143
1223
|
<div ui-flex="row lm">
|
|
1144
|
-
<button ui-btn="main">确定</button>
|
|
1145
|
-
<button ui-btn="none :border" class="ml-sm">取消</button>
|
|
1224
|
+
<button ui-btn="@a main">确定</button>
|
|
1225
|
+
<button ui-btn="@a none :border" class="ml-sm">取消</button>
|
|
1146
1226
|
</div>
|
|
1147
1227
|
```
|
|
1148
1228
|
|
|
@@ -1247,13 +1327,12 @@ w-ss ~ w-xl // 1em ~ 5.5em
|
|
|
1247
1327
|
|
|
1248
1328
|
// 分段扩展
|
|
1249
1329
|
w-ll*s // 15em
|
|
1250
|
-
w-ll*m //
|
|
1251
|
-
w-ll*l //
|
|
1330
|
+
w-ll*m // 27em
|
|
1331
|
+
w-ll*l // 66em
|
|
1252
1332
|
|
|
1253
1333
|
// 特殊值
|
|
1254
1334
|
w-full // 100%
|
|
1255
1335
|
w-auto // auto
|
|
1256
|
-
w-screen // 100vw
|
|
1257
1336
|
```
|
|
1258
1337
|
|
|
1259
1338
|
#### Height
|
|
@@ -1262,7 +1341,6 @@ w-screen // 100vw
|
|
|
1262
1341
|
h-{size} // 同 width
|
|
1263
1342
|
h-full // 100%
|
|
1264
1343
|
h-auto // auto
|
|
1265
|
-
h-screen // 100vh
|
|
1266
1344
|
```
|
|
1267
1345
|
|
|
1268
1346
|
### 圆角类 (Border Radius)
|
|
@@ -1302,23 +1380,24 @@ fs-xs*m ~ fs-xl*m // 5rem ~ 10rem
|
|
|
1302
1380
|
fs-xs*l ~ fs-xl*l // 11rem ~ 21rem
|
|
1303
1381
|
|
|
1304
1382
|
// 字重
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
//
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1383
|
+
bold // font-weight: bold
|
|
1384
|
+
fw1 ~ fw9 // font-weight: 100 ~ 900
|
|
1385
|
+
fw0 // font-weight: normal
|
|
1386
|
+
|
|
1387
|
+
// 文字对齐(-sub 作用于直接子元素)
|
|
1388
|
+
al // 左
|
|
1389
|
+
ac // 中
|
|
1390
|
+
ar // 右
|
|
1391
|
+
aj // 两端
|
|
1392
|
+
|
|
1393
|
+
// 垂直对齐
|
|
1394
|
+
vt vm vb
|
|
1316
1395
|
|
|
1317
1396
|
// 行高
|
|
1318
|
-
lh-
|
|
1397
|
+
lh-no ~ lh-xl // line-height(lh-xs = 1 … lh-xl = 3.5;无 lh-sl)
|
|
1319
1398
|
|
|
1320
|
-
//
|
|
1321
|
-
|
|
1399
|
+
// 大小写
|
|
1400
|
+
upper lower
|
|
1322
1401
|
```
|
|
1323
1402
|
|
|
1324
1403
|
### 边框类 (Border)
|
|
@@ -1365,68 +1444,50 @@ ol-xs ~ ol-xl // left
|
|
|
1365
1444
|
### Z轴类 (Z-Index)
|
|
1366
1445
|
|
|
1367
1446
|
```scss
|
|
1368
|
-
z-
|
|
1369
|
-
z-
|
|
1370
|
-
z-
|
|
1371
|
-
z-
|
|
1372
|
-
z-
|
|
1373
|
-
z-ll // 90
|
|
1374
|
-
z-xl // 100
|
|
1447
|
+
z-no // z-index: 0
|
|
1448
|
+
z-xs // 1
|
|
1449
|
+
z-ss ~ z-xl // 2 ~ 11
|
|
1450
|
+
z-xx // 12
|
|
1451
|
+
z-mm:hover // hover 时生效
|
|
1375
1452
|
```
|
|
1376
1453
|
|
|
1377
|
-
###
|
|
1454
|
+
### 阴影
|
|
1378
1455
|
|
|
1379
|
-
|
|
1380
|
-
shadow-xs // 浅阴影
|
|
1381
|
-
shadow-sm
|
|
1382
|
-
shadow-mm // 默认阴影
|
|
1383
|
-
shadow-ml
|
|
1384
|
-
shadow-ll // 深阴影
|
|
1385
|
-
shadow-none // 无阴影
|
|
1386
|
-
```
|
|
1456
|
+
NeatUI 不提供通用阴影 class(没有 `shadow-*`)。需要阴影时由组件自身样式或项目样式提供。
|
|
1387
1457
|
|
|
1388
1458
|
### 显示类 (Display)
|
|
1389
1459
|
|
|
1390
1460
|
```scss
|
|
1391
|
-
block
|
|
1392
|
-
inline
|
|
1393
|
-
inline-block
|
|
1394
|
-
flex
|
|
1395
|
-
|
|
1396
|
-
|
|
1461
|
+
block // display: block
|
|
1462
|
+
inline // display: inline
|
|
1463
|
+
inline-block // 同 dib
|
|
1464
|
+
flex // display: flex(布局推荐用 ui-flex)
|
|
1465
|
+
inline-flex
|
|
1466
|
+
none // display: none
|
|
1467
|
+
hide // opacity: 0(保留占位)
|
|
1468
|
+
// 以上均有 -sub,作用于直接子元素
|
|
1397
1469
|
|
|
1398
1470
|
// Flex 子项
|
|
1399
|
-
flex-block
|
|
1400
|
-
flex-fill
|
|
1401
|
-
flex-
|
|
1402
|
-
flex-
|
|
1471
|
+
flex-block // flex: 1,overflow: hidden
|
|
1472
|
+
flex-fill // flex: 1,min-width: 0,不裁切
|
|
1473
|
+
flex-grow // 只放大不缩小
|
|
1474
|
+
flex-shrink // 只缩小不放大
|
|
1475
|
+
flex-fixed // 不放大不缩小
|
|
1403
1476
|
```
|
|
1404
1477
|
|
|
1405
1478
|
### 溢出类 (Overflow)
|
|
1406
1479
|
|
|
1407
1480
|
```scss
|
|
1408
|
-
overflow
|
|
1409
|
-
overflow-
|
|
1410
|
-
overflow-
|
|
1411
|
-
overflow-x-auto
|
|
1412
|
-
overflow-y-auto
|
|
1413
|
-
overflow-x-hidden
|
|
1414
|
-
overflow-y-hidden
|
|
1481
|
+
scroll // overflow: auto
|
|
1482
|
+
scroll-x // overflow-x: auto
|
|
1483
|
+
scroll-y // overflow-y: auto
|
|
1415
1484
|
```
|
|
1416
1485
|
|
|
1417
|
-
|
|
1418
|
-
`stable`、五档 scrollbar 尺寸以及 x/y auto、hidden、unset。800px 以上的尺寸覆盖
|
|
1419
|
-
只作用于 attribute 形式。
|
|
1486
|
+
没有 `overflow-*` class。更多滚动控制用 `ui-scroll` 属性:`:x` `:y` `:hidden` `x:hidden` `y:hidden` `x:unset` `y:unset` `stable`,滚动条尺寸 `xs s m l xl`。800px 以上的尺寸覆盖只作用于属性形式。
|
|
1420
1487
|
|
|
1421
|
-
###
|
|
1488
|
+
### 光标
|
|
1422
1489
|
|
|
1423
|
-
|
|
1424
|
-
cursor-pointer
|
|
1425
|
-
cursor-default
|
|
1426
|
-
cursor-not-allowed
|
|
1427
|
-
cursor-text
|
|
1428
|
-
cursor-move
|
|
1429
|
-
```
|
|
1490
|
+
没有 `cursor-*` class。需要 pointer 光标时用交互类:`ux-click` / `ux-none`(见下方交互类)。
|
|
1430
1491
|
|
|
1431
1492
|
### 交互类 (Interaction)
|
|
1432
1493
|
|
|
@@ -1516,7 +1577,7 @@ cursor-move
|
|
|
1516
1577
|
```vue
|
|
1517
1578
|
<!-- 封装常用卡片 -->
|
|
1518
1579
|
<template>
|
|
1519
|
-
<div class="card bg-fore n-mm r-sm
|
|
1580
|
+
<div class="card bg-fore n-mm r-sm">
|
|
1520
1581
|
<slot />
|
|
1521
1582
|
</div>
|
|
1522
1583
|
</template>
|
|
@@ -1547,9 +1608,9 @@ cursor-move
|
|
|
1547
1608
|
### 场景 1: 登录页面
|
|
1548
1609
|
|
|
1549
1610
|
```html
|
|
1550
|
-
<div ui-flex="row cm" class="h-
|
|
1551
|
-
<div class="w-ll*s bg-fore n-ll r-ml
|
|
1552
|
-
<h1 class="fs-xl bold co-main
|
|
1611
|
+
<div ui-flex="row cm" class="h-full bg-weak"> <!-- 父级需有确定高度 -->
|
|
1612
|
+
<div class="w-ll*s bg-fore n-ll r-ml">
|
|
1613
|
+
<h1 class="fs-xl bold co-main ac">登录</h1>
|
|
1553
1614
|
|
|
1554
1615
|
<form class="mt-lm">
|
|
1555
1616
|
<div class="mb-mm">
|
|
@@ -1568,7 +1629,7 @@ cursor-move
|
|
|
1568
1629
|
/>
|
|
1569
1630
|
</div>
|
|
1570
1631
|
|
|
1571
|
-
<button ui-btn="@a main l" class="mt-ml">
|
|
1632
|
+
<button ui-btn="@a main l :block" class="mt-ml">
|
|
1572
1633
|
登录
|
|
1573
1634
|
</button>
|
|
1574
1635
|
</form>
|
|
@@ -1586,7 +1647,7 @@ cursor-move
|
|
|
1586
1647
|
<li
|
|
1587
1648
|
v-for="product in products"
|
|
1588
1649
|
:key="product.id"
|
|
1589
|
-
class="bg-fore r-sm
|
|
1650
|
+
class="bg-fore r-sm"
|
|
1590
1651
|
>
|
|
1591
1652
|
<img :src="product.image" class="w-full h-auto" />
|
|
1592
1653
|
|
|
@@ -1596,7 +1657,7 @@ cursor-move
|
|
|
1596
1657
|
|
|
1597
1658
|
<div ui-flex="row xm" class="mt-mm">
|
|
1598
1659
|
<span class="co-risk bold fs-ml">¥{{ product.price }}</span>
|
|
1599
|
-
<button ui-btn="main s">购买</button>
|
|
1660
|
+
<button ui-btn="@a main s">购买</button>
|
|
1600
1661
|
</div>
|
|
1601
1662
|
</div>
|
|
1602
1663
|
</li>
|
|
@@ -1607,7 +1668,7 @@ cursor-move
|
|
|
1607
1668
|
### 场景 3: 导航栏
|
|
1608
1669
|
|
|
1609
1670
|
```html
|
|
1610
|
-
<nav class="pf ot-no w-full bg-fore
|
|
1671
|
+
<nav class="pf ot-no w-full bg-fore z-xl">
|
|
1611
1672
|
<div class="doc" ui-flex="row xm" class="ny-sm">
|
|
1612
1673
|
<!-- Logo -->
|
|
1613
1674
|
<div ui-flex="row lm">
|
|
@@ -1630,12 +1691,12 @@ cursor-move
|
|
|
1630
1691
|
|
|
1631
1692
|
<!-- 操作按钮 -->
|
|
1632
1693
|
<div ui-flex="row lm">
|
|
1633
|
-
<button ui-btn="vice s :border" class="mr-sm">登录</button>
|
|
1634
|
-
<button ui-btn="main s">注册</button>
|
|
1694
|
+
<button ui-btn="@a vice s :border" class="mr-sm">登录</button>
|
|
1695
|
+
<button ui-btn="@a main s">注册</button>
|
|
1635
1696
|
</div>
|
|
1636
1697
|
|
|
1637
1698
|
<!-- 移动端汉堡菜单 -->
|
|
1638
|
-
<button ui-hide=">mob" ui-btn="none" @click="toggleMenu">
|
|
1699
|
+
<button ui-hide=">mob" ui-btn="@a none" @click="toggleMenu">
|
|
1639
1700
|
<i class="icon-menu fs-ml"></i>
|
|
1640
1701
|
</button>
|
|
1641
1702
|
</div>
|
|
@@ -1651,11 +1712,11 @@ cursor-move
|
|
|
1651
1712
|
ui-flex="row cm"
|
|
1652
1713
|
@click.self="closeDialog"
|
|
1653
1714
|
>
|
|
1654
|
-
<div class="w-ll*s bg-fore r-ml
|
|
1715
|
+
<div class="w-ll*s bg-fore r-ml">
|
|
1655
1716
|
<!-- 头部 -->
|
|
1656
1717
|
<div class="n-mm bb-xs b-line" ui-flex="row xm">
|
|
1657
1718
|
<h3 class="fs-lm bold co-main">标题</h3>
|
|
1658
|
-
<button ui-btn="none s" @click="closeDialog">
|
|
1719
|
+
<button ui-btn="@a none s" @click="closeDialog">
|
|
1659
1720
|
<i class="icon-close"></i>
|
|
1660
1721
|
</button>
|
|
1661
1722
|
</div>
|
|
@@ -1667,10 +1728,10 @@ cursor-move
|
|
|
1667
1728
|
|
|
1668
1729
|
<!-- 底部 -->
|
|
1669
1730
|
<div class="n-mm bt-xs b-line" ui-flex="row rm">
|
|
1670
|
-
<button ui-btn="none :border" class="mr-sm" @click="closeDialog">
|
|
1731
|
+
<button ui-btn="@a none :border" class="mr-sm" @click="closeDialog">
|
|
1671
1732
|
取消
|
|
1672
1733
|
</button>
|
|
1673
|
-
<button ui-btn="main" @click="confirm">
|
|
1734
|
+
<button ui-btn="@a main" @click="confirm">
|
|
1674
1735
|
确定
|
|
1675
1736
|
</button>
|
|
1676
1737
|
</div>
|
|
@@ -1681,14 +1742,14 @@ cursor-move
|
|
|
1681
1742
|
### 场景 5: 数据表格
|
|
1682
1743
|
|
|
1683
1744
|
```html
|
|
1684
|
-
<div class="bg-fore r-sm
|
|
1745
|
+
<div class="bg-fore r-sm">
|
|
1685
1746
|
<table class="w-full">
|
|
1686
1747
|
<thead class="bb-xs b-line">
|
|
1687
1748
|
<tr>
|
|
1688
|
-
<th class="n-mm
|
|
1689
|
-
<th class="n-mm
|
|
1690
|
-
<th class="n-mm
|
|
1691
|
-
<th class="n-mm
|
|
1749
|
+
<th class="n-mm al co-desc bold">姓名</th>
|
|
1750
|
+
<th class="n-mm al co-desc bold">邮箱</th>
|
|
1751
|
+
<th class="n-mm al co-desc bold">状态</th>
|
|
1752
|
+
<th class="n-mm ar co-desc bold">操作</th>
|
|
1692
1753
|
</tr>
|
|
1693
1754
|
</thead>
|
|
1694
1755
|
<tbody>
|
|
@@ -1704,9 +1765,9 @@ cursor-move
|
|
|
1704
1765
|
活跃
|
|
1705
1766
|
</span>
|
|
1706
1767
|
</td>
|
|
1707
|
-
<td class="n-mm
|
|
1708
|
-
<button ui-btn="info s :
|
|
1709
|
-
<button ui-btn="risk s :
|
|
1768
|
+
<td class="n-mm ar">
|
|
1769
|
+
<button ui-btn="@a info s :underline">编辑</button>
|
|
1770
|
+
<button ui-btn="@a risk s :underline">删除</button>
|
|
1710
1771
|
</td>
|
|
1711
1772
|
</tr>
|
|
1712
1773
|
</tbody>
|
|
@@ -1772,11 +1833,7 @@ $theme: (
|
|
|
1772
1833
|
<!-- Active -->
|
|
1773
1834
|
<button class="bg-main bg-main-b-sm:active">按钮</button>
|
|
1774
1835
|
|
|
1775
|
-
<!--
|
|
1776
|
-
<input class="b-line b-main:focus" />
|
|
1777
|
-
|
|
1778
|
-
<!-- Disabled -->
|
|
1779
|
-
<button class="bg-weak:disabled" disabled>禁用</button>
|
|
1836
|
+
<!-- 只有 :hover 与 :active 两种状态后缀;没有 :focus / :disabled -->
|
|
1780
1837
|
```
|
|
1781
1838
|
|
|
1782
1839
|
### 4. 组合类名简化
|
|
@@ -1784,7 +1841,7 @@ $theme: (
|
|
|
1784
1841
|
```vue
|
|
1785
1842
|
<script setup>
|
|
1786
1843
|
// 创建常用组合
|
|
1787
|
-
const cardClass = 'bg-fore n-mm r-sm
|
|
1844
|
+
const cardClass = 'bg-fore n-mm r-sm'
|
|
1788
1845
|
const titleClass = 'fs-lm bold co-main'
|
|
1789
1846
|
const descClass = 'co-desc fs-sm my-ss'
|
|
1790
1847
|
</script>
|
|
@@ -1841,7 +1898,7 @@ fs-lm pad:fs-mm mob:fs-sm
|
|
|
1841
1898
|
ui-hide="<pad"
|
|
1842
1899
|
|
|
1843
1900
|
<!-- 按钮系统 -->
|
|
1844
|
-
ui-btn="@a main l :round"
|
|
1901
|
+
ui-btn="@a main l :round :block"
|
|
1845
1902
|
```
|
|
1846
1903
|
|
|
1847
1904
|
---
|
|
@@ -1850,7 +1907,7 @@ ui-btn="@a main l :round"
|
|
|
1850
1907
|
|
|
1851
1908
|
- **官网**: http://neatui.fekit.cn
|
|
1852
1909
|
- **NPM**: https://www.npmjs.com/package/@neatui/css
|
|
1853
|
-
- **当前版本**:
|
|
1910
|
+
- **当前版本**: v5.x
|
|
1854
1911
|
- **作者**: xiaojunbo
|
|
1855
1912
|
- **许可**: MIT
|
|
1856
1913
|
|
|
@@ -1859,4 +1916,4 @@ ui-btn="@a main l :round"
|
|
|
1859
1916
|
*本文档是人工维护的使用说明;实际能力以 `@neatui/css` SCSS 源码和构建输出为准,
|
|
1860
1917
|
大版本语义变化以 `MIGRATION-4.0.md` 为准。*
|
|
1861
1918
|
|
|
1862
|
-
*最后更新: 2026-
|
|
1919
|
+
*最后更新: 2026-11-02*
|
package/README.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
NeatUI 约束型原子设计系统(SCSS)。正式项目用 SCSS 自定义 `$theme`;试用可用预编译 preview(默认 light / dark)。
|
|
6
6
|
|
|
7
|
+
## 使用手册(AI 必读)
|
|
8
|
+
|
|
9
|
+
编写 NeatUI 代码前,请先阅读包内 [`GUIDE.md`](./GUIDE.md) 开头的「规则速查」:它列出全部可用写法和禁止清单,未列出的 class / 属性值视为不存在。
|
|
10
|
+
|
|
11
|
+
让项目里的 AI 自动遵守这些规则:在你项目的 `AGENTS.md`(或 `CLAUDE.md`)中加一行:
|
|
12
|
+
|
|
13
|
+
```md
|
|
14
|
+
- 使用 NeatUI 样式前先读 `node_modules/@neatui/css/GUIDE.md` 的「规则速查」,只使用其中列出的写法。
|
|
15
|
+
```
|
|
16
|
+
|
|
7
17
|
## 更新与升级
|
|
8
18
|
|
|
9
19
|
升级前请查看 [更新记录与迁移说明](./CHANGELOG.md)。
|