mvframe 1.0.80 → 1.0.81

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.
@@ -204,7 +204,41 @@ alwaysApply: true
204
204
 
205
205
  - `hover`:hover 时 opacity 0.6 + 过渡
206
206
 
207
- ## 6. 动画(ani.scss)
207
+ ## 6. 组件通用样式(cpt.scss)
208
+
209
+ ### 组件变量
210
+
211
+ - `--btn-radius`:按钮圆角,与 `BtnGroup` 等组件保持一致
212
+ - `--loading-radius`:Loading 圆角
213
+ - `--card-radius` / `--card-header-border` / `--card-footer-border`:Card 相关变量
214
+
215
+ ### Tag
216
+
217
+ 全局 `.tag` 是通用标签样式,不是单独的 Vue 组件。遇到数量徽标、状态短标签、固定字段小块时,优先复用它,而不是重新写一套 pill/tag CSS。
218
+
219
+ | 类名 | 用途 |
220
+ |------|------|
221
+ | `tag` | 基础标签:灰底、提示色文字、胶囊圆角 |
222
+ | `tag rect` | 直角矩形标签 |
223
+ | `tag small` | 更小字号标签 |
224
+ | `tag backdrop` | 半透明毛玻璃标签 |
225
+ | `tag primary/red/orange/green/blue/purple/pink/yellow/white/black/body/dark` | 标签颜色变体,色值与 `var.scss` 的全局颜色体系一致 |
226
+
227
+ 使用建议:
228
+
229
+ - 默认直接在模板中组合类名:`class="tag blue"`、`class="tag rect small"`、`class="tag small backdrop"`
230
+ - 如果只是标签颜色或形态变化,不要重写 scoped tag 样式,直接叠加现有变体
231
+ - 只有在 `tag` 无法覆盖的专属视觉下,才在局部补 scoped 样式
232
+
233
+ ### Tip 按钮与图标
234
+
235
+ | 类名 | 用途 |
236
+ |------|------|
237
+ | `tipbtn` | hover 时通过 `::after` 显示简易文本提示,文案取 `txt` 属性 |
238
+ | `tipbtn bottom/left/right` | 控制提示方向 |
239
+ | `MvcIcon` | 组件图标类,默认 `flex-shrink: 0` |
240
+
241
+ ## 7. 动画(ani.scss)
208
242
 
209
243
  | 类名 | 用途 |
210
244
  |------|------|
package/dist/vendor.js CHANGED
@@ -7621,7 +7621,7 @@ const Ss = (e, o = {}) => {
7621
7621
  }, Ts = {
7622
7622
  name: "Matt Avias Frame",
7623
7623
  copyright: "©2026",
7624
- version: "1.0.80",
7624
+ version: "1.0.81",
7625
7625
  author: "Matt Avias",
7626
7626
  date: "2026-02-26",
7627
7627
  /** 默认语言 key,与 `$getLang`、localStorage `lang` 一致;业务在 app.use(mvframe, { config }) 里覆盖 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mvframe",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.0.80",
4
+ "version": "1.0.81",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -18,67 +18,73 @@ const path = require("path");
18
18
 
19
19
  const BEGIN = "<!-- MVFRAME-CODEX-RULES:BEGIN -->";
20
20
  const END = "<!-- MVFRAME-CODEX-RULES:END -->";
21
+ const STYLE_RULES_FILE = path.join(__dirname, "..", ".cursor", "rules", "style-system.mdc");
21
22
 
22
- function renderCodexAgentsSection() {
23
- return `${BEGIN}
24
- # MVFrame Codex Rules
25
-
26
- This project uses MVFrame. When editing Vue, JS, TS, SCSS, or CSS in this host app, prefer the framework globals before adding local implementations.
23
+ function stripFrontmatter(markdown) {
24
+ if (!markdown.startsWith("---")) {
25
+ return markdown;
26
+ }
27
+ const end = markdown.indexOf("\n---", 3);
28
+ if (end < 0) {
29
+ return markdown;
30
+ }
31
+ return markdown.slice(end + 4).replace(/^\s*\n/, "");
32
+ }
27
33
 
28
- ## Global Components
34
+ function shiftMarkdownHeadings(markdown, level = 1) {
35
+ return markdown.replace(/^(#{1,6})\s+/gm, (_all, hashes) => {
36
+ const nextLevel = Math.min(6, hashes.length + level);
37
+ return `${"#".repeat(nextLevel)} `;
38
+ });
39
+ }
29
40
 
30
- - Prefer MVFrame global components in templates without local imports: \`Frame\`, \`Page\`, \`Table\`, \`Form\`, \`Input\`, \`Textarea\`, \`Select\`, \`SelectV2\`, \`Tabs\`, \`BtnGroup\`, \`Icon\`, \`Loading\`, \`Drawer\`, \`DrawerArea\`, \`Login\`, \`Lang\`.
31
- - Do not rebuild an equivalent control with raw DOM, \`el-*\` combinations, or third-party components unless the MVFrame component cannot express the behavior.
32
- - For segmented controls, single-choice button groups, login forms, page shells, tables, drawers, loading masks, and framework navigation, check the MVFrame component first.
41
+ function getSharedStyleRulesForCodex() {
42
+ const raw = fs.readFileSync(STYLE_RULES_FILE, "utf8");
43
+ const withoutFrontmatter = stripFrontmatter(raw).trim();
44
+ const withoutRootTitle = withoutFrontmatter.replace(/^#\s+mvframe\s+样式系统\s*\n*/i, "");
45
+ return shiftMarkdownHeadings(withoutRootTitle, 1).trim();
46
+ }
33
47
 
34
- ## Global Style Utilities
48
+ function renderCodexAgentsSection() {
49
+ return `${BEGIN}
50
+ # MVFrame Codex 规则
35
51
 
36
- - Before writing scoped CSS, inline \`:style\`, or new SCSS utility code, check whether MVFrame global classes already cover it.
37
- - MVFrame styles must be imported once from the app entry: \`import "mvframe/style"\` and \`import "mvframe/style/cpt"\`. If utility classes appear missing, fix the import before duplicating CSS.
38
- - Prefer utility classes in templates for common layout, spacing, sizing, typography, color, border, scroll, hover, radius, and positioning work.
52
+ 本项目使用 MVFrame。在该宿主项目中编辑 Vue、JS、TS、SCSS CSS 时,新增本地实现前,优先检查并复用框架已有的全局能力。
39
53
 
40
- Common utility classes:
54
+ ## 全局组件
41
55
 
42
- | Need | Prefer |
43
- |------|--------|
44
- | flex layout | \`flexMode\`, \`flexV\`, \`flex1\`, \`flexGrow\`, \`noShrink\`, \`minw0\`, \`minh0\` |
45
- | flex alignment | \`hl\`, \`hc\`, \`hr\`, \`hb\`, \`ha\`, \`vl\`, \`vc\`, \`vr\`, \`vs\` |
46
- | wrapping / gaps | \`flexWrap\`, \`grid\`, \`g2\` ... \`g40\` |
47
- | spacing | \`p{N}\`, \`pt{N}\`, \`pr{N}\`, \`pb{N}\`, \`pl{N}\`, \`m{N}\`, \`mt{N}\`, \`mr{N}\`, \`mb{N}\`, \`ml{N}\` where N is one of \`0,2,4,6,8,10,12,16,20,24,30,32,36,40,48\` |
48
- | sizing | \`w{N}\`, \`h{N}\`, \`minw{N}\`, \`maxw{N}\`, \`minh{N}\`, \`maxh{N}\`, \`wp25\`, \`wp50\`, \`wp75\`, \`wp100\`, \`hp100\`, \`vh100\` |
49
- | text | \`fs{N}\`, \`lh{N}\`, \`fw300\`, \`fw500\`, \`fw700\`, \`txt-c\`, \`txt-r\`, \`txt-nowrap\`, \`txt-nowrap{N}\`, \`txt-wrap\`, \`txt-prewrap\` |
50
- | color / background | \`txt-h1\`, \`txt-h2\`, \`txt-p\`, \`txt-tip\`, \`txt-gray\`, \`txt-primary\`, \`bg-primary\`, \`bg-page-header\`, \`border\`, \`border-t\`, \`border-b\`, \`border-none\` |
51
- | positioning / effects | \`relative\`, \`abs\`, \`absFull\`, \`absCenter\`, \`sticky\`, \`z1\`, \`z2\`, \`z9\`, \`radius{N}\`, \`radiusP50\`, \`hover\`, \`trans-all\`, \`backdrop\` |
52
- | interaction / scroll | \`point\`, \`grab\`, \`yscroll\`, \`xscroll\`, \`nobar\`, \`noscroll\`, \`noselect\`, \`noevent\`, \`hide\` |
56
+ - 模板内优先直接使用 MVFrame 全局组件,不要重复本地 import:\`Frame\`、\`Page\`、\`Table\`、\`Form\`、\`Input\`、\`Textarea\`、\`Select\`、\`SelectV2\`、\`Tabs\`、\`BtnGroup\`、\`Icon\`、\`Loading\`、\`Drawer\`、\`DrawerArea\`、\`Login\`、\`Lang\`。
57
+ - 除非 MVFrame 组件确实无法表达该交互,否则不要用原生 DOM、\`el-*\` 组合或第三方组件去重造等价控件。
58
+ - 遇到分段切换、单选按钮组、登录表单、页面外壳、表格、抽屉、加载遮罩、框架导航等场景,先检查 MVFrame 组件是否已经覆盖。
53
59
 
54
- Spacing rule: do not add odd-pixel \`margin\` or \`padding\` such as \`3px\`, \`5px\`, \`7px\`, \`9px\`, or \`11px\`. Use the MVFrame spacing classes or rem values aligned with the spacing scale.
60
+ ## 全局样式工具类
55
61
 
56
- Scoped styles are still allowed for component-specific behavior, complex selectors, custom brand visuals, third-party overrides, or values not covered by the utility system. Keep those scoped rules narrow and combine them with MVFrame classes.
62
+ ${getSharedStyleRulesForCodex()}
57
63
 
58
- ## Global Methods
64
+ ## 全局方法
59
65
 
60
- - Prefer MVFrame globals instead of repeated imports or local helpers: \`globalThis.$d\`, \`$fa\`, \`$fu\`, \`$pm\`, \`$db\`, \`$copy\`, \`$deepClone\`, \`$getLang\`, \`$getImg\`, \`$sc\`, \`$c.info\`.
61
- - In templates, call global methods directly when they are provided through Vue globalProperties.
62
- - For ordinary JS modules, use \`globalThis.$xxx\` or the exported MVFrame subpath only when a direct import is explicitly needed.
66
+ - 优先使用 MVFrame 全局方法,不要重复 import 或本地封装等价 helper:\`globalThis.$d\`、\`$fa\`、\`$fu\`、\`$pm\`、\`$db\`、\`$copy\`、\`$deepClone\`、\`$getLang\`、\`$getImg\`、\`$sc\`、\`$c.info\`。
67
+ - 在模板里,如果这些方法已经通过 Vue globalProperties 注入,直接调用即可。
68
+ - 对普通 JS 模块,优先使用 \`globalThis.$xxx\`;只有确实需要显式 import 时,再使用 MVFrame 的子路径导出。
63
69
 
64
- ## Router, Store, And Maps
70
+ ## 路由、Store Maps
65
71
 
66
- - Prefer route \`name\` navigation over raw \`path\` navigation.
67
- - Use the MVFrame store factory pattern already wired by the app: \`inject("store")\` in components or \`import { store, pinia } from "mvframe/store"\` in setup code and guards.
68
- - For MVFrame maps/i18n maps, prefer \`useMap\`, \`getMaps\`, \`patchMaps\`, \`mapLang\`, and \`mapLangPath\` from \`mvframe/maps\`.
72
+ - 路由跳转优先使用 route \`name\`,不要优先写死 \`path\`。
73
+ - 使用项目已经接好的 MVFrame store factory 模式:组件内用 \`inject("store")\`,setup 代码或守卫里用 \`import { store, pinia } from "mvframe/store"\`。
74
+ - 涉及 MVFrame maps / i18n maps 时,优先使用 \`useMap\`、\`getMaps\`、\`patchMaps\`、\`mapLang\`、\`mapLangPath\`,来源为 \`mvframe/maps\`。
69
75
 
70
- ## Editing Checklist
76
+ ## 编辑检查清单
71
77
 
72
- - Before adding markup, check whether a MVFrame global component fits.
73
- - Before adding CSS, check whether MVFrame utility classes fit.
74
- - Before importing a helper library, check whether a MVFrame global helper already exists.
75
- - If local CSS or a new helper is still needed, keep it small and specific to the component.
78
+ - 新增结构前,先判断是否已有合适的 MVFrame 全局组件。
79
+ - 新增 CSS 前,先判断是否已有合适的 MVFrame 工具类。
80
+ - 引入新的 helper 库前,先判断 MVFrame 是否已经提供等价全局方法。
81
+ - 如果最终仍需新增本地 CSS helper,保持小而专,限定在当前组件范围内。
76
82
 
77
- ## Completion Notify
83
+ ## 完成后通知
78
84
 
79
- - After every completed development task, send one concise completion notification from the host project root with \`yarn exec mvframe-notify --once --message "<project or module>: <what changed and current result>"\`.
80
- - Keep the notify message short and delivery-focused. Include the affected module or page, the main completed work, and the current verification result when available.
81
- - If \`.env.mvframe-notify\` is missing, DingTalk notify is not configured, or the notify command fails, do not fake success. Report that notify could not be sent in the final response.
85
+ - 每次完成一个开发任务后,都要在宿主项目根目录发送一条简洁的完成通知:\`yarn exec mvframe-notify --once --message "<项目或模块>: <本次改动与当前结果>"\`。
86
+ - notify 文案保持简短、可投递、可扫读;包含受影响模块或页面、本次完成的主要工作,以及当前验证结果(如果已有)。
87
+ - 如果缺少 \`.env.mvframe-notify\`、钉钉 notify 未配置,或命令执行失败,不要伪造成功;需要在最终回复里明确说明通知未发送成功。
82
88
  ${END}
83
89
  `;
84
90
  }