mvframe 1.0.94 → 1.0.96
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/.cursor/rules/style-system.mdc +76 -1
- package/README.cn.md +43 -0
- package/README.md +43 -0
- package/dist/css/style.css +1 -1
- package/dist/vendor.js +1 -1
- package/package.json +9 -1
- package/scripts/init-rules.js +41 -0
- package/scripts/install-cursor-rules.js +67 -0
- package/scripts/scaffold-app.js +41 -24
- package/src/style/chip/mixin.scss +141 -0
|
@@ -11,7 +11,7 @@ alwaysApply: true
|
|
|
11
11
|
- **`alwaysApply: true` 只作用于 Cursor**:把本文件当作对话上下文里的规范读给 AI,**不会**在构建时自动给任何 `.vue` 挂上样式,也**不等于**工具类已生效。
|
|
12
12
|
- **运行时要用工具类**,必须在应用入口(如 demo `main.js`、宿主项目)**已 `import` `mvframe` 的 `src/style/index.scss`(或包导出的 `style`)**;然后在组件 **template 里写上工具类名**(如 `flexMode`、`g16`、`fs14`),尽量少写与工具类等价的 scoped 声明。
|
|
13
13
|
|
|
14
|
-
样式入口为 `src/style/index.scss`,按模块拆分为 `chip/*.scss
|
|
14
|
+
样式入口为 `src/style/index.scss`,按模块拆分为 `chip/*.scss`。宿主项目如果只消费发布包,直接 `import "mvframe/style"` 即可拿到全局工具类;如果要在业务 SCSS 里复用框架断点 mixin,用 `@use "mvframe/style/mixin" as *;`。
|
|
15
15
|
|
|
16
16
|
## 1. 变量与颜色(var.scss)
|
|
17
17
|
|
|
@@ -166,6 +166,81 @@ alwaysApply: true
|
|
|
166
166
|
- `g{N}`:gap,N=2~40(步长 2)
|
|
167
167
|
- `mauto`:margin-inline auto
|
|
168
168
|
|
|
169
|
+
## 4.1 响应式(media.scss + mixin.scss)
|
|
170
|
+
|
|
171
|
+
### 断点
|
|
172
|
+
|
|
173
|
+
| 名称 | 范围 |
|
|
174
|
+
|------|------|
|
|
175
|
+
| `xs` | `< 40rem`(< 640px) |
|
|
176
|
+
| `sm` | `40rem ~ 47.99875rem`(640px ~ 767.98px) |
|
|
177
|
+
| `md` | `48rem ~ 63.99875rem`(768px ~ 1023.98px) |
|
|
178
|
+
| `lg` | `64rem ~ 79.99875rem`(1024px ~ 1279.98px) |
|
|
179
|
+
| `xl` | `80rem ~ 95.99875rem`(1280px ~ 1535.98px) |
|
|
180
|
+
| `xxl` | `>= 96rem`(>= 1536px) |
|
|
181
|
+
|
|
182
|
+
### SCSS mixin
|
|
183
|
+
|
|
184
|
+
- `@include media-up(md) { ... }`:`md` 及以上
|
|
185
|
+
- `@include media-down(md) { ... }`:`md` 及以下
|
|
186
|
+
- `@include media-only(md) { ... }`:仅 `md`
|
|
187
|
+
- `@include media-between(sm, lg) { ... }`:`sm` 到 `lg`
|
|
188
|
+
|
|
189
|
+
宿主项目若使用发布包,可直接在业务 SCSS 中:
|
|
190
|
+
|
|
191
|
+
```scss
|
|
192
|
+
@use "mvframe/style/mixin" as *;
|
|
193
|
+
|
|
194
|
+
.panel {
|
|
195
|
+
padding: 1.5rem;
|
|
196
|
+
|
|
197
|
+
@include media-down(sm) {
|
|
198
|
+
padding: 1rem;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 响应式工具类
|
|
204
|
+
|
|
205
|
+
`media.scss` 额外提供一批按断点包裹的全局工具类,命名为 `断点-范围-工具类`:
|
|
206
|
+
|
|
207
|
+
- 范围:`up` / `down` / `only`
|
|
208
|
+
- 工具类:`hide`、`block`、`inline`、`inlineBlock`、`flexMode`、`inlineFlex`、`grid`、`flexV`、`flexV-1`、`flexWrap`、`flexWrap-1`、`hl`、`hb`、`ha`、`hc`、`hr`、`vl`、`vr`、`vc`、`vs`、`txt-c`、`txt-r`
|
|
209
|
+
|
|
210
|
+
示例:
|
|
211
|
+
|
|
212
|
+
- `class="md-down-hide"`:`md` 及以下隐藏
|
|
213
|
+
- `class="lg-up-flexMode lg-up-hb lg-up-vc"`:`lg` 及以上切到横向 flex 并两端对齐
|
|
214
|
+
- `class="xs-only-block sm-only-hide"`:只在手机端显示
|
|
215
|
+
|
|
216
|
+
### Grid 断点列数类
|
|
217
|
+
|
|
218
|
+
如果容器同时带有 `grid`,可直接写 `断点+列数` 来按屏宽切列数:
|
|
219
|
+
|
|
220
|
+
- `grid col2 md2 lg3 sm1`
|
|
221
|
+
- `grid col1 md2 xl4`
|
|
222
|
+
|
|
223
|
+
规则:
|
|
224
|
+
|
|
225
|
+
- `col{N}`:默认列数(所有屏宽的基础值)
|
|
226
|
+
- `xs{N}` / `sm{N}` / `md{N}` / `lg{N}` / `xl{N}` / `xxl{N}`:仅在该断点区间覆盖 `grid-template-columns`
|
|
227
|
+
- 列数当前支持 `1~12`
|
|
228
|
+
|
|
229
|
+
示例:
|
|
230
|
+
|
|
231
|
+
```html
|
|
232
|
+
<div class="grid col2 md2 lg3 sm1 g16">
|
|
233
|
+
...
|
|
234
|
+
</div>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
含义:
|
|
238
|
+
|
|
239
|
+
- 默认 2 列
|
|
240
|
+
- `sm` 屏 1 列
|
|
241
|
+
- `md` 屏 2 列
|
|
242
|
+
- `lg` 屏 3 列
|
|
243
|
+
|
|
169
244
|
## 5. 其它样式(other.scss / static.scss)
|
|
170
245
|
|
|
171
246
|
### 全局重置与基础
|
package/README.cn.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- `"./composition"` → `dist/composition.js`(`import { useMap, … } from 'mvframe/composition'`)
|
|
21
21
|
- `"./store"`、`"./directive"`、`"./util"` → 对应 `dist` 下分包
|
|
22
22
|
- `"./notify"` → `dist/notify.js`(浏览器端请求本地 `mvframe-notify` 服务的通知 helper)
|
|
23
|
+
- `"./style/mixin"` → `src/style/chip/mixin.scss`(宿主项目 SCSS 可复用的断点 / 通用 mixin)
|
|
23
24
|
- `"./style"` → `dist/css/style.css`(由 `src/style/index.scss` 单独入口打包的全量工具类/变量)
|
|
24
25
|
- `"./style/cpt"` → `dist/css/cpt.css`(随组件抽取的样式;一般用 `mvframe/style` 即可)
|
|
25
26
|
|
|
@@ -147,8 +148,25 @@ app.use(mvframe, {
|
|
|
147
148
|
|
|
148
149
|
- 工具类与变量说明见 `.cursor/rules/style-system.mdc`(`--color-*`、间距、字体、布局类等)。
|
|
149
150
|
- SCSS 会通过 `vite.config.js` 的 **`additionalData`** 注入 **`src/style/chip/mixin.scss`**,与库同构构建的业务项目可保持一致配置。
|
|
151
|
+
- 响应式断点统一在 `mixin.scss`:`xs / sm / md / lg / xl / xxl`;业务 SCSS 可直接 `@use "mvframe/style/mixin" as *;`,然后使用 `@include media-up(md)`、`media-down(md)`、`media-only(md)`、`media-between(sm, lg)`。
|
|
152
|
+
- 发布包的 `mvframe/style` 里已内置一组响应式工具类:`{断点}-{up|down|only}-{工具类}`,例如 `md-down-hide`、`lg-up-flexMode`、`xs-only-block`。
|
|
153
|
+
- Grid 容器还支持断点列数类:`class="grid col2 md2 lg3 sm1"`,表示默认 2 列,`sm` 1 列,`md` 2 列,`lg` 3 列。
|
|
150
154
|
- 发布包可 **`import 'mvframe/style'`**(即 `dist/css/style.css`);需与 Element Plus 等并存时仍可在业务工程中链入源码 **`src/style/index.scss`** 以便覆写变量。
|
|
151
155
|
|
|
156
|
+
业务侧示例:
|
|
157
|
+
|
|
158
|
+
```scss
|
|
159
|
+
@use "mvframe/style/mixin" as *;
|
|
160
|
+
|
|
161
|
+
.BillingPanel {
|
|
162
|
+
padding: 1.5rem;
|
|
163
|
+
|
|
164
|
+
@include media-down(sm) {
|
|
165
|
+
padding: 1rem;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
152
170
|
---
|
|
153
171
|
|
|
154
172
|
## 构建库
|
|
@@ -275,16 +293,41 @@ Codex 不会自动读取 Cursor 的 `.cursor/rules/*.mdc`。宿主项目需要
|
|
|
275
293
|
|
|
276
294
|
```bash
|
|
277
295
|
cd /path/to/your-app
|
|
296
|
+
yarn exec mvframe-init-rules
|
|
297
|
+
# 或:npx mvframe-init-rules
|
|
298
|
+
|
|
299
|
+
# 仅初始化 Codex 规则
|
|
278
300
|
yarn exec mvframe-install-codex-rules
|
|
279
301
|
# 或:npx mvframe-install-codex-rules
|
|
280
302
|
|
|
281
303
|
# 克隆 / monorepo 中指向 mvframe 源码时
|
|
304
|
+
node /path/to/mvframe/scripts/init-rules.js
|
|
305
|
+
node /path/to/mvframe/scripts/init-rules.js /path/to/your-app
|
|
306
|
+
|
|
307
|
+
# 仅初始化 Codex 规则
|
|
282
308
|
node /path/to/mvframe/scripts/install-codex-agents.js
|
|
283
309
|
node /path/to/mvframe/scripts/install-codex-agents.js /path/to/your-app
|
|
284
310
|
```
|
|
285
311
|
|
|
286
312
|
脚手架命令已自动执行这一步。生成区块带有 `MVFRAME-CODEX-RULES` 标记,重复执行只更新这段内容,不覆盖你在 `AGENTS.md` 中的其它规则。
|
|
287
313
|
|
|
314
|
+
## Cursor 规则(`.cursor/rules`)
|
|
315
|
+
|
|
316
|
+
统一命令 `mvframe-init-rules` 会同时把 **mvframe 包内**与仓库一致的 **`*.mdc`** 补充到目标项目 **`/.cursor/rules/`**(`component-hierarchy`、`script-setup`、`style-system`、`views`、`router`、`global-components`、`data`、`util`)。
|
|
317
|
+
若宿主项目已存在同名规则文件,则保留宿主文件,仅补缺失项。
|
|
318
|
+
|
|
319
|
+
仅安装 Cursor 规则时:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
cd /path/to/your-app
|
|
323
|
+
yarn exec mvframe-install-cursor-rules
|
|
324
|
+
# 或:npx mvframe-install-cursor-rules
|
|
325
|
+
|
|
326
|
+
# 克隆 / monorepo 中指向 mvframe 源码时
|
|
327
|
+
node /path/to/mvframe/scripts/install-cursor-rules.js
|
|
328
|
+
node /path/to/mvframe/scripts/install-cursor-rules.js /path/to/your-app
|
|
329
|
+
```
|
|
330
|
+
|
|
288
331
|
## Cursor Skill(应用初始化)
|
|
289
332
|
|
|
290
333
|
本仓库自带 **`.cursor/skills/mvframe-app-init`**,消费方项目可复制到自身 `.cursor/skills` 以便 Cursor 识别 MVFrame 接入规范。
|
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ A Vue 3 + Vite oriented admin-shell toolkit: **Frame layout**, **common business
|
|
|
20
20
|
- `"./composition"` → `dist/composition.js` (e.g. `import { useMap } from 'mvframe/composition'`)
|
|
21
21
|
- `"./store"`, `"./directive"`, `"./util"` → matching chunks under `dist`
|
|
22
22
|
- `"./notify"` → `dist/notify.js` (browser helper for the local `mvframe-notify` service)
|
|
23
|
+
- `"./style/mixin"` → `src/style/chip/mixin.scss` (shared breakpoint and helper mixins for host SCSS)
|
|
23
24
|
- `"./style"` → `dist/css/style.css` (full toolkit CSS from `src/style/index.scss` entry)
|
|
24
25
|
- `"./style/cpt"` → `dist/css/cpt.css` (component-extracted CSS; usually `import 'mvframe/style'` is enough)
|
|
25
26
|
|
|
@@ -147,8 +148,25 @@ Full helper list: `.cursor/rules/util.mdc` and `src/util/index.js`.
|
|
|
147
148
|
|
|
148
149
|
- Utility classes & tokens: `.cursor/rules/style-system.mdc` (`--color-*`, spacing, typography, layout).
|
|
149
150
|
- `vite.config.js` **`additionalData`** injects **`src/style/chip/mixin.scss`**; mirror this in apps that compile the same SCSS tree.
|
|
151
|
+
- Breakpoints are centralized in `mixin.scss`: `xs / sm / md / lg / xl / xxl`. Host SCSS can `@use "mvframe/style/mixin" as *;` and use `@include media-up(md)`, `media-down(md)`, `media-only(md)`, or `media-between(sm, lg)`.
|
|
152
|
+
- `mvframe/style` now ships responsive utility classes in the shape `{breakpoint}-{up|down|only}-{utility}`, for example `md-down-hide`, `lg-up-flexMode`, and `xs-only-block`.
|
|
153
|
+
- Grid containers also support breakpoint column-count classes such as `class="grid col2 md2 lg3 sm1"`: default 2 columns, `sm` 1 column, `md` 2 columns, `lg` 3 columns.
|
|
150
154
|
- Published packages can use **`import 'mvframe/style'`** (`dist/css/style.css`). For SCSS overrides, still link **`src/style/index.scss`** from Git/monorepo when needed.
|
|
151
155
|
|
|
156
|
+
Host SCSS example:
|
|
157
|
+
|
|
158
|
+
```scss
|
|
159
|
+
@use "mvframe/style/mixin" as *;
|
|
160
|
+
|
|
161
|
+
.BillingPanel {
|
|
162
|
+
padding: 1.5rem;
|
|
163
|
+
|
|
164
|
+
@include media-down(sm) {
|
|
165
|
+
padding: 1rem;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
152
170
|
---
|
|
153
171
|
|
|
154
172
|
## Building the library
|
|
@@ -260,16 +278,41 @@ Codex does **not** automatically read Cursor `.cursor/rules/*.mdc`. For host pro
|
|
|
260
278
|
|
|
261
279
|
```bash
|
|
262
280
|
cd /path/to/your-app
|
|
281
|
+
yarn exec mvframe-init-rules
|
|
282
|
+
# or: npx mvframe-init-rules
|
|
283
|
+
|
|
284
|
+
# Codex rules only
|
|
263
285
|
yarn exec mvframe-install-codex-rules
|
|
264
286
|
# or: npx mvframe-install-codex-rules
|
|
265
287
|
|
|
266
288
|
# Full checkout / monorepo path to mvframe
|
|
289
|
+
node /path/to/mvframe/scripts/init-rules.js
|
|
290
|
+
node /path/to/mvframe/scripts/init-rules.js /path/to/your-app
|
|
291
|
+
|
|
292
|
+
# Codex rules only
|
|
267
293
|
node /path/to/mvframe/scripts/install-codex-agents.js
|
|
268
294
|
node /path/to/mvframe/scripts/install-codex-agents.js /path/to/your-app
|
|
269
295
|
```
|
|
270
296
|
|
|
271
297
|
The scaffold command already runs this step. The generated block is bounded by `MVFRAME-CODEX-RULES` markers, so rerunning the command updates only that block and preserves other `AGENTS.md` content.
|
|
272
298
|
|
|
299
|
+
## Cursor Rules (`.cursor/rules`)
|
|
300
|
+
|
|
301
|
+
The unified `mvframe-init-rules` command also adds the package’s **`*.mdc`** files into the target project’s **`/.cursor/rules/`** (`component-hierarchy`, `script-setup`, `style-system`, `views`, `router`, `global-components`, `data`, `util`).
|
|
302
|
+
If the host project already has a same-named rule file, the host file is kept and only missing rules are added.
|
|
303
|
+
|
|
304
|
+
Install Cursor rules only:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
cd /path/to/your-app
|
|
308
|
+
yarn exec mvframe-install-cursor-rules
|
|
309
|
+
# or: npx mvframe-install-cursor-rules
|
|
310
|
+
|
|
311
|
+
# Full checkout / monorepo path to mvframe
|
|
312
|
+
node /path/to/mvframe/scripts/install-cursor-rules.js
|
|
313
|
+
node /path/to/mvframe/scripts/install-cursor-rules.js /path/to/your-app
|
|
314
|
+
```
|
|
315
|
+
|
|
273
316
|
## Cursor Skill (app scaffold)
|
|
274
317
|
|
|
275
318
|
This repo ships **`.cursor/skills/mvframe-app-init`**. Copy it into your app’s **`.cursor/skills`** so Cursor can pick up MVFrame integration conventions.
|