You need to sign in or sign up before continuing.
Commit 9f665200 by liimin

docs(contracts): 更新AI组件契约定义与规范

- 定义了组件清单索引、清单项目、Figma框架及增量补丁计划的JSON模式
- 添加了项目上下文示例文件,描述Vue项目的结构和约束
- 更新AGENTS.md文档,新增AI组件语义入口规范
- 重构pnpm-workspace.yaml,将common-ui重命名为vui
- 修复tsconfig.json中的路径映射引用
- 更新组件契约中的包根路径配置
- 移除React相关依赖并添加新的VUI包结构定义
1 parent fc688d3d
Showing 119 changed files with 4548 additions and 51 deletions
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
- 不要静默修改根级工作区配置行为。 - 不要静默修改根级工作区配置行为。
- 优先做增量、可审查的修改,而不是大范围重构。 - 优先做增量、可审查的修改,而不是大范围重构。
## AI 组件语义入口
- 修改 `packages/vui/**` 组件时,优先读取对应组件目录下的 `*.manifest.json`。
- `packages/vui/*/meta/index.json` 是平台包级 AI 组件入口;除非任务明确要求,不要跳过它直接猜测组件能力。
- 新增或重命名 `packages/vui/**/src/components/*` 下组件时,必须同步更新组件目录内的 manifest 与 `meta/index.json`。
## 高风险路径 ## 高风险路径
- `packages/cli/**` - `packages/cli/**`
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"paths": { "paths": {
"@/*": ["src/*"], "@/*": ["src/*"],
"@venus/common-ui-vue": ["../../../../packages/common-ui/vue-ui/src/index.ts"] "@venus/common-ui-vue": ["../../../../packages/vui/vue-ui/src/index.ts"]
}, },
"resolveJsonModule": true, "resolveJsonModule": true,
"typeRoots": ["../../node_modules/@types", "./node_modules/@types"], "typeRoots": ["../../node_modules/@types", "./node_modules/@types"],
......
{ {
"$schema": "./component-manifest.schema.json", "$schema": "./component-manifest.schema.json",
"packageName": "@venus/common-ui-vue", "packageName": "@venus/common-ui-vue",
"packageRoot": "packages/common-ui/vue-ui", "packageRoot": "packages/vui/vue-ui",
"framework": "vue", "framework": "vue",
"notes": "第一阶段最小组件清单,仅覆盖当前已显式文档化的基础组件,用于后续 AI 组件映射试点。", "notes": "第一阶段最小组件清单,仅覆盖当前已显式文档化的基础组件,用于后续 AI 组件映射试点。",
"components": [ "components": [
......
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://venus.local/contracts/ai/component-manifest-index.schema.json",
"type": "object",
"required": ["packageName", "packageRoot", "framework", "components"],
"properties": {
"packageName": { "type": "string" },
"packageRoot": { "type": "string" },
"framework": { "type": "string", "enum": ["react", "shared", "uniapp", "vue"] },
"notes": { "type": "string" },
"components": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["exportName", "manifest"],
"properties": {
"exportName": { "type": "string" },
"manifest": { "type": "string" },
"source": { "type": "string" }
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://venus.local/contracts/ai/component-manifest-item.schema.json",
"type": "object",
"required": ["name", "exportName", "source", "category", "description", "figmaMapping", "usageGuidance"],
"properties": {
"name": { "type": "string" },
"exportName": { "type": "string" },
"source": { "type": "string" },
"category": { "type": "string" },
"description": { "type": "string" },
"props": {
"type": "array",
"items": { "$ref": "#/$defs/prop" }
},
"events": {
"type": "array",
"items": { "$ref": "#/$defs/event" }
},
"slots": {
"type": "array",
"items": { "$ref": "#/$defs/slot" }
},
"figmaMapping": { "$ref": "#/$defs/figmaMapping" },
"usageGuidance": { "$ref": "#/$defs/usageGuidance" }
},
"additionalProperties": false,
"$defs": {
"prop": {
"type": "object",
"required": ["name", "type", "description"],
"properties": {
"name": { "type": "string" },
"type": { "type": "string" },
"description": { "type": "string" },
"required": { "type": "boolean" },
"default": { "type": "string" }
},
"additionalProperties": false
},
"event": {
"type": "object",
"required": ["name", "description"],
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"payload": { "type": "string" }
},
"additionalProperties": false
},
"slot": {
"type": "object",
"required": ["name", "description"],
"properties": {
"name": { "type": "string" },
"description": { "type": "string" }
},
"additionalProperties": false
},
"figmaMapping": {
"type": "object",
"required": ["keywords", "nodeTypes"],
"properties": {
"keywords": {
"type": "array",
"items": { "type": "string" }
},
"nodeTypes": {
"type": "array",
"items": { "type": "string" }
},
"variantHints": {
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false
},
"usageGuidance": {
"type": "object",
"required": ["recommendedScenarios"],
"properties": {
"recommendedScenarios": {
"type": "array",
"items": { "type": "string" }
},
"avoidScenarios": {
"type": "array",
"items": { "type": "string" }
},
"dependencies": {
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false
}
}
}
{
"projectName": "@venus/example-admin",
"projectRoot": "D:/work/venus/example",
"framework": "vue",
"appType": "admin",
"workspace": {
"inWorkspace": true,
"workspaceRoot": "D:/work/venus",
"packageName": "@venus/example-admin",
"packageManager": "pnpm"
},
"directories": {
"srcDir": "src",
"componentDirs": [],
"pageDirs": ["src/views"],
"routeFiles": ["src/router/index.ts"],
"storeFiles": ["src/stores/app.ts", "src/stores/index.ts", "src/stores/menu.ts"],
"styleDirs": ["src/styles"]
},
"routing": {
"solution": "vue-router",
"menuCoupled": true,
"requiresRegistration": true
},
"stateManagement": {
"solution": "pinia",
"persistence": false
},
"uiStack": {
"componentPackages": ["element-plus"],
"primaryLibrary": "element-plus",
"tokenSource": "element-plus"
},
"qualityGates": {
"lint": "pnpm lint",
"typecheck": "pnpm run check:type",
"templateContract": "pnpm run check:template-contract",
"reviewTrigger": "pnpm run review:trigger",
"fitness": "pnpm run check:fitness -- --tier fast"
},
"constraints": [
"changes must respect workspace-level quality gates",
"new pages should include route registration planning",
"state additions should align with the current pinia store layout"
],
"notes": "Generated by the project-intelligence pilot reader. Refine fields as more project patterns are covered."
}
{
"planId": "user-management-list-incremental-patch",
"targetProject": {
"projectName": "@venus/example-admin",
"projectRoot": "D:/work/venus/example",
"framework": "vue",
"primaryUiLibrary": "@vui/vue",
"componentManifestEntry": "packages/vui/vue/meta/index.json"
},
"page": {
"pageId": "user-management-list",
"title": "User Management",
"intent": "list",
"routePath": "/users",
"routeName": "UserManagementList"
},
"routeRegistration": {
"strategy": "static-routes-array",
"routeFile": "src/router/index.ts",
"suggestedParentRoute": "Layout",
"anchorStrategy": "semantic-resource",
"anchorConfidence": "low",
"anchorReviewRequired": true,
"anchorRoutePath": "/system/user",
"insertionScope": "Layout.children",
"insertAfterRoutePath": "/system/user",
"insertionHint": "Insert the new route into Layout.children after \"/system/user\" using shared resource tokens \"user\".",
"detectedSignals": ["routes-array", "layout-parent-route", "layout-children-array", "catch-all-route"],
"menuConfigTarget": "src/config/menus.ts",
"menuAnchorPath": "/system/user",
"menuAnchorConfidence": "low",
"menuAnchorReviewRequired": true,
"menuParentPath": "/system",
"menuInsertAfterPath": "/system/user",
"menuInsertionHint": "Candidate menu insertion: update the menu config under \"/system\" after \"/system/user\" using shared resource tokens \"user\"."
},
"componentSelections": [
{
"hint": "VInput",
"exportName": "VInput",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VInput/VInput.manifest.json",
"usedIn": ["field:keyword"],
"recommendedScenarios": ["表单基础输入", "登录页账号密码输入", "需要前后缀的输入场景"]
},
{
"hint": "VSelect",
"exportName": "VSelect",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VSelect/VSelect.manifest.json",
"usedIn": ["field:status"],
"recommendedScenarios": ["筛选栏状态选择", "表单枚举字段选择", "多选标签关联"]
},
{
"hint": "VButton",
"exportName": "VButton",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VButton/VButton.manifest.json",
"usedIn": ["action:search", "action:reset", "action:create-user", "action:view-user", "action:edit-user"],
"recommendedScenarios": ["表单提交", "列表工具条主操作", "弹窗确认操作"]
},
{
"hint": "VDialog",
"exportName": "VDialog",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VDialog/VDialog.manifest.json",
"usedIn": ["action:create-user", "action:edit-user"],
"recommendedScenarios": ["新增编辑弹窗", "二次确认", "小型详情预览"]
},
{
"hint": "VTable",
"exportName": "VTable",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VTable/VTable.manifest.json",
"usedIn": ["block:user-table"],
"recommendedScenarios": ["后台列表页", "带行操作的数据展示", "查询结果表格"]
}
],
"operations": [
{
"id": "create-page-file",
"kind": "create-file",
"targetPath": "src/views/UserManagementList.vue",
"description": "Create the generated list page component.",
"patchStrategy": "none",
"reason": "The page does not exist yet and should be introduced as a new file."
},
{
"id": "create-route-snippet",
"kind": "create-file",
"targetPath": "src/views/UserManagementList.route-snippet.ts",
"description": "Create an isolated route export that can be reviewed before touching the live router file.",
"patchStrategy": "none",
"reason": "Separating the route definition reduces risk for old projects."
},
{
"id": "patch-router-registration",
"kind": "patch-file",
"targetPath": "src/router/index.ts",
"description": "Register the generated route using the detected static-routes-array strategy.",
"patchStrategy": "manual-review",
"snippet": "import { UserManagementListRoute } from \"../views/UserManagementList.route-snippet\";\n\n/*\nManual review required before registering this route:\nAnchor strategy: semantic-resource (low confidence)\nCandidate anchor route: /system/user\nInsert the new route into Layout.children after \"/system/user\" using shared resource tokens \"user\".\nRegister UserManagementListRoute manually after confirming the correct sibling position.\n*/",
"dependsOn": ["create-route-snippet"],
"reason": "The project context indicates that route registration is required for new pages and the router file matches static-routes-array."
},
{
"id": "review-menu-coupling",
"kind": "review-only",
"targetPath": "src/config/menus.ts",
"description": "Review whether the new page also requires a menu entry update. Candidate menu insertion: update the menu config under \"/system\" after \"/system/user\" using shared resource tokens \"user\".",
"patchStrategy": "manual-review",
"reason": "The project context indicates that menu configuration is coupled with routing."
},
{
"id": "review-state-impact",
"kind": "review-only",
"targetPath": "src/stores/app.ts",
"description": "Review whether this page needs a dedicated pinia store or can remain local-state only.",
"patchStrategy": "manual-review",
"reason": "The project uses pinia and new module pages may need shared state integration."
}
],
"validation": {
"commands": ["pnpm lint", "pnpm run check:type"],
"notes": [
"Review the generated route snippet before patching the live router file.",
"Prefer reusing the existing project UI library rather than introducing raw UI markup."
]
},
"notes": [
"changes must respect workspace-level quality gates",
"new pages should include route registration planning",
"state additions should align with the current pinia store layout",
"component library manifest loaded from packages/vui/vue/meta/index.json",
"component hints without manifest mapping: FilterToolbar"
]
}
{
"$schema": "../figma-frame.schema.json",
"frameId": "figma-user-management-list",
"title": "User Management",
"intent": "list",
"route": {
"path": "/users",
"name": "UserManagementList",
"menuTitle": "Users",
"requiresAuth": true
},
"layout": {
"shell": "list",
"responsive": true,
"columns": 1
},
"nodes": [
{
"id": "section-filters",
"kind": "SECTION",
"name": "Filters",
"description": "Collect filter values before querying the list.",
"children": [
{
"id": "filter-form",
"kind": "FORM",
"name": "Search Users",
"componentHint": "FilterToolbar",
"children": [
{
"id": "keyword",
"kind": "INPUT",
"name": "Keyword",
"componentHint": "VInput"
},
{
"id": "status",
"kind": "SELECT",
"name": "Status",
"componentHint": "StatusSelect"
},
{
"id": "search",
"kind": "BUTTON",
"name": "Search",
"actionKind": "submit",
"componentHint": "VButton"
},
{
"id": "reset",
"kind": "BUTTON",
"name": "Reset",
"actionKind": "toggle",
"componentHint": "VButton"
}
]
}
]
},
{
"id": "section-results",
"kind": "SECTION",
"name": "Results",
"description": "Display queried records and row actions.",
"children": [
{
"id": "page-actions",
"kind": "ACTIONS",
"name": "Page Actions",
"children": [
{
"id": "create-user",
"kind": "BUTTON",
"name": "Create User",
"actionKind": "dialog",
"componentHint": "VButton"
}
]
},
{
"id": "user-table",
"kind": "TABLE",
"name": "User Table",
"description": "Table with row actions for view and edit.",
"componentHint": "DataTable",
"children": [
{
"id": "view-user",
"kind": "BUTTON",
"name": "View",
"actionKind": "navigate",
"componentHint": "VButton"
},
{
"id": "edit-user",
"kind": "BUTTON",
"name": "Edit",
"actionKind": "dialog",
"componentHint": "VButton"
}
]
}
]
}
],
"notes": "Minimal Figma-style frame example for the list-page ingestion pilot."
}
{
"pageId": "figma-user-management-list",
"title": "User Management",
"intent": "list",
"source": {
"kind": "figma-frame",
"reference": "figma-user-management-list",
"frameName": "User Management"
},
"route": {
"path": "/users",
"name": "UserManagementList",
"requiresAuth": true,
"menuTitle": "Users"
},
"layout": {
"shell": "list",
"responsive": true,
"columns": 1
},
"sections": [
{
"id": "section-filters",
"name": "Filters",
"purpose": "Collect filter values before querying the list.",
"blocks": [
{
"id": "filter-form",
"kind": "form",
"title": "Search Users",
"componentHint": "FilterToolbar",
"figmaNodeId": "filter-form",
"fields": [
{
"id": "keyword",
"label": "Keyword",
"type": "text",
"componentHint": "VInput"
},
{
"id": "status",
"label": "Status",
"type": "select",
"componentHint": "StatusSelect"
}
],
"actions": [
{
"id": "search",
"label": "Search",
"kind": "submit",
"componentHint": "VButton"
},
{
"id": "reset",
"label": "Reset",
"kind": "toggle",
"componentHint": "VButton"
}
]
}
]
},
{
"id": "section-results",
"name": "Results",
"purpose": "Display queried records and row actions.",
"blocks": [
{
"id": "page-actions",
"kind": "actions",
"title": "Page Actions",
"figmaNodeId": "page-actions",
"actions": [
{
"id": "create-user",
"label": "Create User",
"kind": "dialog",
"componentHint": "VButton"
}
]
},
{
"id": "user-table",
"kind": "table",
"title": "User Table",
"description": "Table with row actions for view and edit.",
"componentHint": "DataTable",
"figmaNodeId": "user-table",
"actions": [
{
"id": "view-user",
"label": "View",
"kind": "navigate",
"componentHint": "VButton"
},
{
"id": "edit-user",
"label": "Edit",
"kind": "dialog",
"componentHint": "VButton"
}
]
}
]
}
],
"dataRequirements": [
{
"id": "figma-user-management-list-query",
"kind": "query",
"name": "fetchUserManagementList",
"description": "Fetch User Management records for the generated list page."
},
{
"id": "create-user-mutation",
"kind": "mutation",
"name": "createUser",
"description": "Handle \"Create User\" interaction inferred from the Figma frame."
},
{
"id": "edit-user-mutation",
"kind": "mutation",
"name": "updateUserManagement",
"description": "Handle \"Edit\" interaction inferred from the Figma frame."
}
],
"notes": "Minimal Figma-style frame example for the list-page ingestion pilot."
}
{
"planId": "user-management-list-incremental-patch",
"targetProject": {
"projectName": "@demo/vui-admin",
"projectRoot": "D:/work/venus/apps/frontend/vue/vui-admin",
"framework": "vue",
"primaryUiLibrary": "@vui/vue",
"componentManifestEntry": "packages/vui/vue/meta/index.json"
},
"page": {
"pageId": "user-management-list",
"title": "User Management",
"intent": "list",
"routePath": "/users",
"routeName": "UserManagementList"
},
"routeRegistration": {
"strategy": "generic-review",
"routeFile": "src/router/index.ts",
"insertionHint": "Review the existing router bootstrap flow and register the generated route manually.",
"detectedSignals": []
},
"componentSelections": [
{
"hint": "VInput",
"exportName": "VInput",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VInput/VInput.manifest.json",
"usedIn": ["field:keyword"],
"recommendedScenarios": ["表单基础输入", "登录页账号密码输入", "需要前后缀的输入场景"]
},
{
"hint": "VSelect",
"exportName": "VSelect",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VSelect/VSelect.manifest.json",
"usedIn": ["field:status"],
"recommendedScenarios": ["筛选栏状态选择", "表单枚举字段选择", "多选标签关联"]
},
{
"hint": "VButton",
"exportName": "VButton",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VButton/VButton.manifest.json",
"usedIn": ["action:search", "action:reset", "action:create-user", "action:view-user", "action:edit-user"],
"recommendedScenarios": ["表单提交", "列表工具条主操作", "弹窗确认操作"]
},
{
"hint": "VDialog",
"exportName": "VDialog",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VDialog/VDialog.manifest.json",
"usedIn": ["action:create-user", "action:edit-user"],
"recommendedScenarios": ["新增编辑弹窗", "二次确认", "小型详情预览"]
},
{
"hint": "VTable",
"exportName": "VTable",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VTable/VTable.manifest.json",
"usedIn": ["block:user-table"],
"recommendedScenarios": ["后台列表页", "带行操作的数据展示", "查询结果表格"]
}
],
"operations": [
{
"id": "create-page-file",
"kind": "create-file",
"targetPath": "src/views/UserManagementList.vue",
"description": "Create the generated list page component.",
"patchStrategy": "none",
"reason": "The page does not exist yet and should be introduced as a new file."
},
{
"id": "create-route-snippet",
"kind": "create-file",
"targetPath": "src/views/UserManagementList.route-snippet.ts",
"description": "Create an isolated route export that can be reviewed before touching the live router file.",
"patchStrategy": "none",
"reason": "Separating the route definition reduces risk for old projects."
},
{
"id": "patch-router-registration",
"kind": "patch-file",
"targetPath": "src/router/index.ts",
"description": "Register the generated route using the detected generic-review strategy.",
"patchStrategy": "manual-review",
"snippet": "import { UserManagementListRoute } from \"../views/UserManagementList.route-snippet\";\n\n// TODO(ai-patcher): review the router bootstrap flow and register UserManagementListRoute manually.",
"dependsOn": ["create-route-snippet"],
"reason": "The project context indicates that route registration is required for new pages and the router file matches generic-review."
},
{
"id": "review-state-impact",
"kind": "review-only",
"targetPath": "src/stores/index.ts",
"description": "Review whether this page needs a dedicated pinia store or can remain local-state only.",
"patchStrategy": "manual-review",
"reason": "The project uses pinia and new module pages may need shared state integration."
}
],
"validation": {
"commands": ["pnpm lint", "pnpm run check:type"],
"notes": [
"Review the generated route snippet before patching the live router file.",
"Prefer reusing the existing project UI library rather than introducing raw UI markup."
]
},
"notes": [
"changes must respect workspace-level quality gates",
"prefer existing @vui/vue components before introducing raw UI markup",
"new pages should include route registration planning",
"state additions should align with the current pinia store layout",
"component library manifest loaded from packages/vui/vue/meta/index.json",
"component hints without manifest mapping: FilterToolbar"
]
}
{
"$schema": "../figma-frame.schema.json",
"frameId": "figma-user-profile-detail",
"title": "User Profile",
"intent": "detail",
"route": {
"path": "/users/:id",
"name": "UserProfileDetail",
"menuTitle": "User Detail",
"requiresAuth": true
},
"layout": {
"shell": "detail",
"responsive": true,
"columns": 2
},
"nodes": [
{
"id": "section-hero",
"kind": "SECTION",
"name": "Header",
"description": "Present primary page title and quick actions.",
"children": [
{
"id": "hero-card",
"kind": "HERO",
"name": "User Profile",
"description": "Profile summary and top-level actions.",
"children": [
{
"id": "edit-user",
"kind": "BUTTON",
"name": "Edit",
"actionKind": "navigate",
"componentHint": "VButton"
}
]
}
]
},
{
"id": "section-details",
"kind": "SECTION",
"name": "Details",
"description": "Display user information and account status.",
"children": [
{
"id": "basic-info",
"kind": "DESCRIPTION",
"name": "Basic Information",
"description": "Read-only user information fields."
},
{
"id": "status-card",
"kind": "CARD",
"name": "Account Status",
"description": "Display account status, role and last login time."
}
]
}
],
"notes": "Minimal Figma-style frame example for the detail-page ingestion pilot."
}
{
"pageId": "figma-user-profile-detail",
"title": "User Profile",
"intent": "detail",
"source": {
"kind": "figma-frame",
"reference": "figma-user-profile-detail",
"frameName": "User Profile"
},
"route": {
"path": "/users/:id",
"name": "UserProfileDetail",
"requiresAuth": true,
"menuTitle": "User Detail"
},
"layout": {
"shell": "detail",
"responsive": true,
"columns": 2
},
"sections": [
{
"id": "section-hero",
"name": "Header",
"purpose": "Present primary page title and quick actions.",
"blocks": [
{
"id": "hero-card",
"kind": "hero",
"title": "User Profile",
"description": "Profile summary and top-level actions.",
"figmaNodeId": "hero-card",
"actions": [
{
"id": "edit-user",
"label": "Edit",
"kind": "navigate",
"componentHint": "VButton"
}
]
}
]
},
{
"id": "section-details",
"name": "Details",
"purpose": "Display user information and account status.",
"blocks": [
{
"id": "basic-info",
"kind": "description",
"title": "Basic Information",
"description": "Read-only user information fields.",
"figmaNodeId": "basic-info"
},
{
"id": "status-card",
"kind": "card",
"title": "Account Status",
"description": "Display account status, role and last login time.",
"figmaNodeId": "status-card"
}
]
}
],
"dataRequirements": [
{
"id": "figma-user-profile-detail-detail-query",
"kind": "query",
"name": "fetchUserProfileDetail",
"description": "Fetch User Profile detail data for the generated detail page."
},
{
"id": "edit-user-mutation",
"kind": "mutation",
"name": "updateUserProfile",
"description": "Handle \"Edit\" interaction inferred from the Figma frame."
}
],
"notes": "Minimal Figma-style frame example for the detail-page ingestion pilot."
}
{
"$schema": "../page-schema.schema.json",
"pageId": "user-profile-detail",
"title": "User Profile",
"intent": "detail",
"source": {
"kind": "manual",
"reference": "Standard detail page pilot"
},
"route": {
"path": "/users/:id",
"name": "UserProfileDetail",
"requiresAuth": true,
"menuTitle": "User Detail"
},
"layout": {
"shell": "detail",
"responsive": true,
"columns": 2
},
"sections": [
{
"id": "hero",
"name": "Header",
"purpose": "Present primary page title and quick actions.",
"blocks": [
{
"id": "hero-card",
"kind": "hero",
"title": "User Profile",
"description": "Profile summary and top-level actions.",
"actions": [
{
"id": "edit-user",
"label": "Edit",
"kind": "navigate",
"componentHint": "VButton"
}
]
}
]
},
{
"id": "details",
"name": "Details",
"purpose": "Display basic information and status.",
"blocks": [
{
"id": "basic-info",
"kind": "description",
"title": "Basic Information",
"description": "Read-only user information fields."
},
{
"id": "status-card",
"kind": "card",
"title": "Account Status",
"description": "Display account status, role and last login time."
}
]
}
],
"dataRequirements": [
{
"id": "user-detail-query",
"kind": "query",
"name": "fetchUserDetail",
"description": "Fetch single user detail by id."
}
],
"notes": "Pilot detail page schema for multi-template code generation."
}
{
"$schema": "../figma-frame.schema.json",
"frameId": "figma-user-profile-form",
"title": "User Profile Form",
"intent": "form",
"route": {
"path": "/users/create",
"name": "UserProfileForm",
"menuTitle": "Create User",
"requiresAuth": true
},
"layout": {
"shell": "form",
"responsive": true,
"columns": 1
},
"nodes": [
{
"id": "section-user-form",
"kind": "SECTION",
"name": "User Form",
"description": "Collect user profile data for creation or editing.",
"children": [
{
"id": "profile-form",
"kind": "FORM",
"name": "Profile Information",
"componentHint": "EntityForm",
"children": [
{
"id": "name",
"kind": "INPUT",
"name": "Name",
"required": true,
"componentHint": "VInput"
},
{
"id": "email",
"kind": "INPUT",
"name": "Email",
"required": true,
"componentHint": "VInput"
},
{
"id": "role",
"kind": "SELECT",
"name": "Role",
"required": true,
"componentHint": "RoleSelect"
},
{
"id": "enabled",
"kind": "SWITCH",
"name": "Enabled",
"componentHint": "StatusSwitch"
},
{
"id": "submit-form",
"kind": "BUTTON",
"name": "Submit",
"actionKind": "submit",
"componentHint": "VButton"
},
{
"id": "cancel-form",
"kind": "BUTTON",
"name": "Cancel",
"actionKind": "navigate",
"componentHint": "VButton"
}
]
}
]
}
],
"notes": "Minimal Figma-style frame example for the form-page ingestion pilot."
}
{
"pageId": "figma-user-profile-form",
"title": "User Profile Form",
"intent": "form",
"source": {
"kind": "figma-frame",
"reference": "figma-user-profile-form",
"frameName": "User Profile Form"
},
"route": {
"path": "/users/create",
"name": "UserProfileForm",
"requiresAuth": true,
"menuTitle": "Create User"
},
"layout": {
"shell": "form",
"responsive": true,
"columns": 1
},
"sections": [
{
"id": "section-user-form",
"name": "User Form",
"purpose": "Collect user profile data for creation or editing.",
"blocks": [
{
"id": "profile-form",
"kind": "form",
"title": "Profile Information",
"componentHint": "EntityForm",
"figmaNodeId": "profile-form",
"fields": [
{
"id": "name",
"label": "Name",
"type": "text",
"required": true,
"componentHint": "VInput"
},
{
"id": "email",
"label": "Email",
"type": "text",
"required": true,
"componentHint": "VInput"
},
{
"id": "role",
"label": "Role",
"type": "select",
"required": true,
"componentHint": "RoleSelect"
},
{
"id": "enabled",
"label": "Enabled",
"type": "switch",
"componentHint": "StatusSwitch"
}
],
"actions": [
{
"id": "submit-form",
"label": "Submit",
"kind": "submit",
"componentHint": "VButton"
},
{
"id": "cancel-form",
"label": "Cancel",
"kind": "navigate",
"componentHint": "VButton"
}
]
}
]
}
],
"dataRequirements": [
{
"id": "submit-form-mutation",
"kind": "mutation",
"name": "submitUserProfileForm",
"description": "Handle \"Submit\" interaction inferred from the Figma frame."
}
],
"notes": "Minimal Figma-style frame example for the form-page ingestion pilot."
}
{
"$schema": "../page-schema.schema.json",
"pageId": "user-profile-form",
"title": "User Profile Form",
"intent": "form",
"source": {
"kind": "manual",
"reference": "Standard create/edit form page pilot"
},
"route": {
"path": "/users/create",
"name": "UserProfileForm",
"requiresAuth": true,
"menuTitle": "Create User"
},
"layout": {
"shell": "form",
"responsive": true,
"columns": 1
},
"sections": [
{
"id": "user-form",
"name": "User Form",
"purpose": "Collect user profile data for creation or editing.",
"blocks": [
{
"id": "profile-form",
"kind": "form",
"title": "Profile Information",
"componentHint": "EntityForm",
"fields": [
{
"id": "name",
"label": "Name",
"type": "text",
"required": true,
"componentHint": "VInput"
},
{
"id": "email",
"label": "Email",
"type": "text",
"required": true,
"componentHint": "VInput"
},
{
"id": "role",
"label": "Role",
"type": "select",
"required": true,
"componentHint": "RoleSelect"
},
{
"id": "enabled",
"label": "Enabled",
"type": "switch",
"componentHint": "StatusSwitch"
}
],
"actions": [
{
"id": "submit-form",
"label": "Submit",
"kind": "submit",
"componentHint": "VButton"
},
{
"id": "cancel-form",
"label": "Cancel",
"kind": "navigate",
"componentHint": "VButton"
}
]
}
]
}
],
"dataRequirements": [
{
"id": "create-user-mutation",
"kind": "mutation",
"name": "createUser",
"description": "Submit user form to create a new user."
}
],
"notes": "Pilot form page schema for multi-template code generation."
}
{
"$schema": "../project-context.schema.json",
"projectName": "@demo/vui-admin",
"projectRoot": "D:/work/venus/apps/frontend/vue/vui-admin",
"framework": "vue",
"appType": "admin",
"workspace": {
"inWorkspace": true,
"workspaceRoot": "D:/work/venus",
"packageName": "@demo/vui-admin",
"packageManager": "pnpm"
},
"directories": {
"srcDir": "src",
"componentDirs": ["src/components"],
"pageDirs": ["src/views"],
"routeFiles": ["src/router/index.ts"],
"storeFiles": ["src/stores/index.ts"],
"styleDirs": ["src/styles"]
},
"routing": {
"solution": "vue-router",
"menuCoupled": false,
"requiresRegistration": true
},
"stateManagement": {
"solution": "pinia",
"persistence": false
},
"uiStack": {
"componentPackages": ["@vui/vue", "element-plus"],
"primaryLibrary": "@vui/vue",
"tokenSource": "@vui/vue"
},
"qualityGates": {
"lint": "pnpm lint",
"typecheck": "pnpm run check:type",
"templateContract": "pnpm run check:template-contract",
"reviewTrigger": "pnpm run review:trigger",
"fitness": "pnpm run check:fitness -- --tier fast"
},
"constraints": [
"changes must respect workspace-level quality gates",
"prefer existing @vui/vue components before introducing raw UI markup",
"new pages should include route registration planning",
"state additions should align with the current pinia store layout"
],
"notes": "Synthetic project-context example for validating @vui/vue manifest-aware generation."
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://venus.local/contracts/ai/figma-frame.schema.json",
"type": "object",
"required": ["frameId", "title", "nodes"],
"properties": {
"frameId": { "type": "string" },
"title": { "type": "string" },
"intent": {
"type": "string",
"enum": ["dashboard", "detail", "form", "list", "settings", "unknown"]
},
"route": {
"type": "object",
"properties": {
"path": { "type": "string" },
"name": { "type": "string" },
"menuTitle": { "type": "string" },
"requiresAuth": { "type": "boolean" }
},
"additionalProperties": false
},
"layout": {
"type": "object",
"properties": {
"shell": {
"type": "string",
"enum": ["blank", "dashboard", "detail", "form", "list", "workspace"]
},
"responsive": { "type": "boolean" },
"columns": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
},
"nodes": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/node" }
},
"notes": { "type": "string" }
},
"additionalProperties": false,
"$defs": {
"field": {
"type": "object",
"required": ["id", "label", "type"],
"properties": {
"id": { "type": "string" },
"label": { "type": "string" },
"type": {
"type": "string",
"enum": ["date", "number", "select", "switch", "text", "textarea"]
},
"required": { "type": "boolean" },
"componentHint": { "type": "string" }
},
"additionalProperties": false
},
"action": {
"type": "object",
"required": ["id", "label", "kind"],
"properties": {
"id": { "type": "string" },
"label": { "type": "string" },
"kind": {
"type": "string",
"enum": ["dialog", "navigate", "request", "submit", "toggle"]
},
"componentHint": { "type": "string" }
},
"additionalProperties": false
},
"node": {
"type": "object",
"required": ["id", "kind", "name"],
"properties": {
"id": { "type": "string" },
"kind": {
"type": "string",
"enum": [
"ACTIONS",
"BUTTON",
"CARD",
"CHART",
"CONTAINER",
"DESCRIPTION",
"FORM",
"HERO",
"INPUT",
"SECTION",
"SELECT",
"STATS",
"SWITCH",
"TABLE",
"TEXT"
]
},
"name": { "type": "string" },
"description": { "type": "string" },
"componentHint": { "type": "string" },
"required": { "type": "boolean" },
"actionKind": {
"type": "string",
"enum": ["dialog", "navigate", "request", "submit", "toggle"]
},
"tokenRefs": {
"type": "array",
"items": { "type": "string" }
},
"fields": {
"type": "array",
"items": { "$ref": "#/$defs/field" }
},
"actions": {
"type": "array",
"items": { "$ref": "#/$defs/action" }
},
"children": {
"type": "array",
"items": { "$ref": "#/$defs/node" }
}
},
"additionalProperties": false
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://venus.local/contracts/ai/incremental-patch-plan.schema.json",
"type": "object",
"required": ["planId", "targetProject", "page", "routeRegistration", "operations", "validation"],
"properties": {
"planId": { "type": "string" },
"targetProject": { "$ref": "#/$defs/targetProject" },
"page": { "$ref": "#/$defs/page" },
"routeRegistration": { "$ref": "#/$defs/routeRegistration" },
"componentSelections": {
"type": "array",
"items": { "$ref": "#/$defs/componentSelection" }
},
"operations": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/operation" }
},
"validation": { "$ref": "#/$defs/validation" },
"notes": {
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false,
"$defs": {
"targetProject": {
"type": "object",
"required": ["projectName", "projectRoot", "framework"],
"properties": {
"projectName": { "type": "string" },
"projectRoot": { "type": "string" },
"framework": { "type": "string" },
"primaryUiLibrary": { "type": "string" },
"componentManifestEntry": { "type": "string" }
},
"additionalProperties": false
},
"page": {
"type": "object",
"required": ["pageId", "title"],
"properties": {
"pageId": { "type": "string" },
"title": { "type": "string" },
"intent": { "type": "string" },
"routePath": { "type": "string" },
"routeName": { "type": "string" }
},
"additionalProperties": false
},
"componentSelection": {
"type": "object",
"required": ["hint", "exportName", "packageName", "sourceManifest"],
"properties": {
"hint": { "type": "string" },
"exportName": { "type": "string" },
"packageName": { "type": "string" },
"sourceManifest": { "type": "string" },
"usedIn": {
"type": "array",
"items": { "type": "string" }
},
"recommendedScenarios": {
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false
},
"routeRegistration": {
"type": "object",
"required": ["strategy", "routeFile"],
"properties": {
"strategy": {
"type": "string",
"enum": [
"static-routes-array",
"router-factory-routes-array",
"dynamic-add-routes-helper",
"generic-review"
]
},
"routeFile": { "type": "string" },
"suggestedParentRoute": { "type": "string" },
"anchorStrategy": { "type": "string" },
"anchorConfidence": { "type": "string" },
"anchorReviewRequired": { "type": "boolean" },
"matchedRoutePrefix": { "type": "string" },
"anchorRoutePath": { "type": "string" },
"insertionScope": { "type": "string" },
"insertBeforeRoutePath": { "type": "string" },
"insertAfterRoutePath": { "type": "string" },
"insertionHint": { "type": "string" },
"menuConfigTarget": { "type": "string" },
"menuAnchorPath": { "type": "string" },
"menuAnchorConfidence": { "type": "string" },
"menuAnchorReviewRequired": { "type": "boolean" },
"menuParentPath": { "type": "string" },
"menuInsertAfterPath": { "type": "string" },
"menuInsertionHint": { "type": "string" },
"detectedSignals": {
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false
},
"operation": {
"type": "object",
"required": ["id", "kind", "targetPath", "description"],
"properties": {
"id": { "type": "string" },
"kind": {
"type": "string",
"enum": ["create-file", "patch-file", "review-only"]
},
"targetPath": { "type": "string" },
"description": { "type": "string" },
"patchStrategy": {
"type": "string",
"enum": ["append-snippet", "manual-review", "none"]
},
"snippet": { "type": "string" },
"dependsOn": {
"type": "array",
"items": { "type": "string" }
},
"reason": { "type": "string" }
},
"additionalProperties": false
},
"validation": {
"type": "object",
"required": ["commands"],
"properties": {
"commands": {
"type": "array",
"minItems": 1,
"items": { "type": "string" }
},
"notes": {
"type": "array",
"items": { "type": "string" }
}
},
"additionalProperties": false
}
}
}
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
- 已有治理骨架:`AGENTS.md`、`contracts/`、`review-trigger`、`fitness`、`smart-check` - 已有治理骨架:`AGENTS.md`、`contracts/`、`review-trigger`、`fitness`、`smart-check`
- 已有模板能力:`packages/cli/templates/react`、`packages/cli/templates/vue` - 已有模板能力:`packages/cli/templates/react`、`packages/cli/templates/vue`
- 已有少量组件基础:`packages/common-ui/vue-ui` - 已有少量组件基础:`packages/vui/vue`
- 缺少统一 design tokens 包 - 缺少统一 design tokens 包
- 缺少组件机器描述(props、插槽、适用场景、Figma 映射) - 缺少组件机器描述(props、插槽、适用场景、Figma 映射)
- 缺少项目上下文抽取层 - 缺少项目上下文抽取层
...@@ -160,9 +160,10 @@ AI 生成完成后,必须走统一验证链,而不是直接把结果当成 ...@@ -160,9 +160,10 @@ AI 生成完成后,必须走统一验证链,而不是直接把结果当成
### 组件和描述层 ### 组件和描述层
- `packages/common-ui/` 的组件补强 - `packages/vui/` 的组件补强
- `packages/design-tokens/` - `packages/design-tokens/`
- `contracts/ai/*.manifest.json` - `packages/vui/*/meta/index.json`
- `packages/vui/*/src/components/*/*.manifest.json`
## 分阶段路线 ## 分阶段路线
......
# Vue UI 基座决策
## 目标
为 `@vui/vue` 选择第一阶段的 Vue UI 基座,优先服务当前主目标:
- 让 AI 更稳定地把 Figma/页面 schema 映射成 Vue 页面
- 让新项目生成和老项目增量 patch 共享同一套组件语义
- 在不自建完整底层组件库的前提下,尽快形成可运行、可描述、可生成的 UI 体系
## 结论
第一阶段建议 `@vui/vue` 基于 `Element Plus` 做包裹式二次封装,而不是直接从零实现完整组件库,也不建议先走纯 headless 方案。
推荐结构:
- 底层基座:`element-plus`
- 语义层出口:`@vui/vue`
- AI 消费层:`packages/vui/vue/meta/index.json`
- 组件级语义:`packages/vui/vue/src/components/*/*.manifest.json`
## 选择标准
当前阶段更关注以下标准,而不是“底层是否最纯粹”:
- 组件语义是否稳定,AI 是否容易学会映射
- 后台/中台常见页面是否覆盖充分
- 文档、社区和示例是否足够多
- 二次封装成本是否可控
- 是否适合当前 `venus` 的 Figma -> schema -> codegen 主链
## 为什么选 Element Plus
### 1. 组件语义最适合当前 AI 主线
`Button`、`Input`、`Form`、`Table`、`Dialog`、`Drawer`、`Descriptions` 这类组件名称和职责都比较稳定,AI 更容易把:
- Figma 节点
- 页面 schema block
- 业务页面模板
统一映射到 `@vui/vue` 的语义组件。
### 2. 覆盖后台场景最完整
你当前最先要打通的是:
- 列表页
- 表单页
- 详情页
- 弹窗/抽屉
- 查询区
- 工具条
这些恰好是 `Element Plus` 最成熟的能力带。
### 3. 更适合先做语义层,而不是先补底层轮子
当前 `venus` 最缺的不是又一个底层按钮实现,而是:
- AI 可读的组件语义
- 设计稿到组件的稳定映射
- 项目里统一消费的 `V*` 组件层
基于 `Element Plus`,可以先把精力放在 `VButton`、`VInput`、`VForm`、`VTable` 这些语义组件上。
### 4. 与当前仓库状态最一致
当前试点已经基于 `Element Plus` 落了:
- `VButton`
- `VInput`
继续沿这条路推进,成本最低,也最利于快速形成 AI 可验证样本。
## 为什么当前不优先选其他路线
### Naive UI
优点:
- TypeScript 体验好
- 风格现代
- 组件设计一致性不错
当前不优先的原因:
- 社区默认认知和资料沉淀不如 `Element Plus` 稳
- 对 AI 来说,主流程度和团队熟悉度同样重要
可以作为第二选择,但不是当前首推。
### Ant Design Vue
优点:
- 企业后台场景成熟
当前不优先的原因:
- 在当前 Vue 生态心智里,我仍更建议先以 `Element Plus` 作为默认基座
- 与当前试点方向也不如 `Element Plus` 顺滑
### 纯 headless / 自建底层
优点:
- 长期自由度更高
- 设计系统掌控力更强
当前不优先的原因:
- AI 很难一次生成出完整可交付页面
- 你需要先补大量样式、交互、可访问性和组合约束
- 会把当前主目标从“设计稿到代码”拖回“先造底层组件库”
## 实施原则
### 1. 不 fork Element Plus
不建议修改 `Element Plus` 源码,也不建议把 `Element Plus` 直接暴露给业务层。
建议方式:
- `@vui/vue` 负责导出 `VButton`、`VInput` 等语义组件
- `@vui/vue` 内部适配 `Element Plus`
### 2. AI 只面向 `V*` 组件
后续 AI 映射应优先输出:
- `VButton`
- `VInput`
- `VForm`
- `VTable`
而不是直接输出:
- `ElButton`
- `ElInput`
- `ElForm`
- `ElTable`
这样后续即使底层基座发生变化,AI 层和业务层也能保持稳定。
### 3. 组件 manifest 跟随语义层演进
组件的:
- props
- slots
- events
- 推荐/禁止场景
- Figma 关键词
应随组件目录一起维护在:
- `packages/vui/vue/src/components/*/*.manifest.json`
同时由:
- `packages/vui/vue/meta/index.json`
作为统一 AI 入口,而不是散落在说明文档里。
## `@vui/vue` 下一批组件优先级
第一优先:直接支撑当前 AI 主链
- `VForm`
- `VFormItem`
- `VTable`
- `VDialog`
第二优先:补齐标准 CRUD 页面能力
- `VSelect`
- `VTextarea`
- `VDrawer`
- `VTag`
第三优先:补齐页面结构和反馈能力
- `VCard`
- `VDescriptions`
- `VEmpty`
- `VMessage` 或统一反馈封装
## 对主目标的意义
这个决策的核心不是“Vue 里哪个库更好”,而是“哪个库更适合作为 AI 设计稿到代码的第一阶段基座”。
在当前阶段,`Element Plus + @vui/vue 语义封装` 能同时满足:
- 页面覆盖度
- AI 可映射性
- 封装成本
- 工程落地速度
因此它是当前最合适的第一阶段方案。
# VUI 多端包架构
## 目标
`vui` 作为 `venus` 的多端 UI 包族,是后续 AI 主线唯一面向的 UI 体系。
关于 Vue 侧第一阶段为何选择 `Element Plus` 作为 `@vui/vue` 的底层基座,见:
- `docs/architecture/vue-ui-base-decision.md`
它需要同时满足四个目标:
- Vue、React、uniapp/小程序按端隔离
- 每个端可以独立发布、独立演进、独立安装
- AI 能按平台读取组件语义、Figma 映射和页面模板
- 业务项目只安装所需平台包,避免跨端冗余
## 命名策略
推荐将 `vui` 设计为一组独立 npm 包,而不是单个总包的子路径导出。
推荐包名:
- `@vui/tokens`
- `@vui/shared`
- `@vui/vue`
- `@vui/react`
- `@vui/uniapp`
如果后续无法使用 `@vui` scope,则保持目录结构不变,只把发布名平移为:
- `@venus/vui-tokens`
- `@venus/vui-shared`
- `@venus/vui-vue`
- `@venus/vui-react`
- `@venus/vui-uniapp`
当前架构文档默认使用 `@vui/*` 作为目标发布名,因为它最符合最终使用体验。
## 为什么不用 `@venus/vui/vue`
`@venus/vui/vue` 看起来像按端拆分,但本质仍然是一个总包的子路径导出。
这会带来几个问题:
- 安装时容易把多端依赖一并带入
- `peerDependencies` 容易互相污染
- Vue/React/uniapp 发版节奏被绑在一起
- AI 语义层会被塞进一个越来越大的总包目录
因此 `vui` 应该采用“目录族 + 多独立包”的方式。
## 目录结构
```text
packages/
vui/
README.md
tokens/
package.json
src/
index.ts
shared/
package.json
src/
index.ts
vue/
package.json
src/
components/
VButton/
index.ts
VButton.vue
VButton.manifest.json
VInput/
index.ts
VInput.vue
VInput.manifest.json
index.ts
index.ts
shims-vue.d.ts
meta/
index.json
README.md
react/
package.json
src/
index.ts
meta/
index.json
README.md
uniapp/
package.json
src/
index.ts
meta/
index.json
README.md
```
## 各目录职责
### `packages/vui/tokens`
职责:
- 承载 design tokens
- 输出颜色、字号、间距、圆角、阴影、断点等基础设计值
- 不放任何框架运行时代码
### `packages/vui/shared`
职责:
- 承载跨框架共享的类型、工具和 schema
- 为 AI 代码生成、Figma 映射和组件清单提供公共类型
- 不直接承载 Vue/React/uniapp 组件实现
### `packages/vui/vue`
职责:
- Vue 运行时组件包
- 承载 Vue 侧组件实现、示例和 AI 组件清单
- 当前试点优先落 `VButton`、`VInput`
### `packages/vui/react`
职责:
- React 运行时组件包
- 目录先建骨架,不急于补完整组件
- 后续与 Vue 共享设计语义,但实现保持独立
### `packages/vui/uniapp`
职责:
- uniapp / 小程序运行时组件包
- 当前只建立发布和语义占位,不提前承诺完整能力
## AI 语义层位置
`contracts/ai/` 负责保存 schema,平台包自身保存组件级 manifest 与包级索引。
具体建议:
- `contracts/ai/component-manifest.schema.json`
- `contracts/ai/component-manifest-item.schema.json`
- `contracts/ai/component-manifest-index.schema.json`
- `contracts/ai/project-context.schema.json`
- `contracts/ai/page-schema.schema.json`
- `packages/vui/vue/meta/index.json`
- `packages/vui/vue/src/components/*/*.manifest.json`
- `packages/vui/react/meta/index.json`
- `packages/vui/uniapp/meta/index.json`
这样做的目的,是让组件语义和组件实现一起演进,同时保留一个稳定的 AI 读取入口,避免 manifest 脱离源码。
## 试点策略
当前阶段不追求组件数量,而追求“少量组件但描述完整”。
首批试点组件:
- Vue:`VButton`
- Vue:`VInput`
首批试点要求:
- 组件实现可运行
- 包入口可导出
- `src/components/*/*.manifest.json` 有完整组件语义
- `meta/index.json` 可作为统一入口索引
- AI 代码生成优先消费 `@vui/vue`
## 对主目标的意义
这套 `vui` 结构直接服务于当前主目标:
- Figma 到代码:AI 能按平台读取组件语义
- 新项目生成:按目标框架只引入对应包
- 老项目增量改造:根据项目上下文判断该用 `@vui/vue` 还是 `@vui/react`
- 后续多端扩展:uniapp/小程序不会和 Web 端组件实现混装
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
- 新增 `AI 设计稿到代码` 架构文档 - 新增 `AI 设计稿到代码` 架构文档
- 新增第一阶段执行计划 - 新增第一阶段执行计划
- 新增 `contracts/ai/` 下的最小组件 manifest schema - 新增 `contracts/ai/` 下的最小组件 manifest schema
- 为当前 `@venus/common-ui-vue` 补一份最小组件 manifest - 为 `@vui/vue` 补组件级 manifest 与包级索引入口
- 为老项目增量接入补最小 `incremental-patch-plan` contract 与 patcher 试点
本阶段不包含: 本阶段不包含:
- Figma API 接入 - Figma API 接入
- 页面 schema 生成器 - 页面 schema 生成器
- 代码生成器和 patcher 实现 - 完整代码生成器和完整 patcher 自动改写实现
- 自动校验脚本与 CI 接入 - 自动校验脚本与 CI 接入
- 现有组件库大规模重构 - 现有组件库大规模重构
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
- 治理骨架:`AGENTS.md`、`contracts/`、`review-trigger`、`fitness` - 治理骨架:`AGENTS.md`、`contracts/`、`review-trigger`、`fitness`
- 模板交付链:`packages/cli/templates/react`、`packages/cli/templates/vue` - 模板交付链:`packages/cli/templates/react`、`packages/cli/templates/vue`
- 少量组件基础:`packages/common-ui/vue-ui` - 少量组件基础:`packages/vui/vue`
当前 `venus` 仍缺: 当前 `venus` 仍缺:
...@@ -57,13 +58,17 @@ ...@@ -57,13 +58,17 @@
- 说明目标、能力分层、总体架构、仓库落点和阶段路线。 - 说明目标、能力分层、总体架构、仓库落点和阶段路线。
2. 新增 `contracts/ai/component-manifest.schema.json` 2. 新增 `contracts/ai/component-manifest.schema.json`
- 定义 AI 后续读取组件语义所需的最小字段。 - 定义 AI 后续读取组件语义所需的最小字段。
3. 新增 `contracts/ai/common-ui-vue.manifest.json` 3. 建立 `@vui/vue` 的组件级 manifest 与索引入口
- 使用当前 `@venus/common-ui-vue` 组件做首份样例清单。 - 使用 `meta/index.json + src/components/*/*.manifest.json` 作为首份样例清单。
4. 记录后续第二阶段入口 4. 记录后续第二阶段入口
- design tokens - design tokens
- project context schema - project context schema
- figma ingest - figma ingest
- page schema - page schema
5. 为老项目改造建立最小 patch plan
- 先产出 create-file / patch-file / review-only 计划
- 先生成路由 patch snippet,不直接修改复杂存量文件
- 优先识别静态 routes 数组、router 工厂和动态 addRoutes 这几类常见接入形态
## 验证策略 ## 验证策略
...@@ -81,6 +86,6 @@ ...@@ -81,6 +86,6 @@
当本阶段完成后,下一阶段优先事项应为: 当本阶段完成后,下一阶段优先事项应为:
1. 建立 `project-context.schema.json` 1. 建立 `project-context.schema.json`
2. 为 `common-ui-vue` 补更完整的组件属性、插槽、事件和适用场景 2. 为 `@vui/vue` 补更完整的组件属性、插槽、事件和适用场景
3. 设计 `page-schema.schema.json` 3. 设计 `page-schema.schema.json`
4. 评估 `packages/ai/project-intelligence/` 与 `packages/ai/design-mapper/` 的最小包结构 4. 评估 `packages/ai/project-intelligence/` 与 `packages/ai/design-mapper/` 的最小包结构
# 2026-05-27 VUI 多端组件体系执行计划
## 目标
建立 `packages/vui/` 多端组件体系骨架,为 `venus` 的 AI 设计稿到代码目标提供可发布、可扩展、可按端隔离的 UI 包结构。
本计划的重点不是一次性替换所有旧组件,而是:
- 先定稳定目录结构
- 先定发布命名
- 先定 AI 语义层位置
- 先让 Vue 侧 `VButton`、`VInput` 形成试点闭环
## 背景
旧 UI 体系存在三个问题:
- 目录语义偏旧,不适合承载多端包族
- Vue、React、uniapp 的未来落点不清晰
- AI 组件清单还没有和最终包结构对齐
因此当前策略是不再扩充旧体系,而是在 `packages/vui/` 下建立新结构,并让 AI 主线只围绕 `vui` 演进。
## 范围
本阶段包含:
- 新增 `vui` 多端包架构文档
- 新增 `packages/vui/` 目录说明
- 建立 `tokens` / `shared` / `vue` / `react` / `uniapp` 骨架
- 在 `packages/vui/vue` 中落 `VButton`、`VInput` 试点
- 在 `packages/vui/*/meta/` 中建立 AI 入口索引,并让组件目录自带 manifest
本阶段不包含:
- 旧目录清理与迁移收尾
- React 和 uniapp 的完整组件实现
- npm 正式发布流程
- Figma API 接入
## 目录决策
采用如下结构:
```text
packages/vui/
tokens/
shared/
vue/
react/
uniapp/
```
说明:
- 新能力统一往 `vue/`、`react/`、`uniapp/` 里长
- AI 语义清单和平台包同仓维护
## 试点步骤
1. 建立多包骨架
- `packages/vui/tokens`
- `packages/vui/shared`
- `packages/vui/vue`
- `packages/vui/react`
- `packages/vui/uniapp`
2. 在 `packages/vui/vue` 落首批组件
- `VButton`
- `VInput`
3. 在 `packages/vui/vue/src/components/*/*.manifest.json` 中补齐组件语义,并由 `packages/vui/vue/meta/index.json` 聚合入口
4. 保持 `contracts/ai/*.schema.json` 继续作为仓库级 schema
5. 后续再让 AI 代码生成优先消费 `@vui/vue`
## 风险
- 历史目录尚未完全清理,但不应继续影响 AI 主线结构判断
- 如果过早大规模迁移,会把注意力从主目标转移到包迁移本身
- 如果不先把 `vui` 目录形态定清楚,后续 React / uniapp 会再次出现结构漂移
## 验证策略
- 文档诊断通过
- 新增骨架包不引入新的 lint error
- `packages/vui/vue` 的试点组件可以被 AI manifest 正确描述
## 下一阶段出口
本阶段完成后,下一步回到主目标,继续推进:
1. `@vui/vue` 接入 AI 代码生成
2. `project-intelligence` 识别 `@vui/vue` / `@vui/react`
3. `figma-ingest` 开始把设计节点映射为 `page-schema`
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"@venus/common-ui-vue": "workspace:*", "@venus/common-ui-vue": "workspace:*",
"@venus/composables": "workspace:*", "@venus/composables": "workspace:*",
"@vueuse/core": "catalog:", "@vueuse/core": "catalog:",
"@vui/vue": "workspace:*",
"element-plus": "catalog:", "element-plus": "catalog:",
"pinia": "catalog:", "pinia": "catalog:",
"vue": "catalog:", "vue": "catalog:",
......
...@@ -18,6 +18,12 @@ export const systemMenus: MenuItem[] = [ ...@@ -18,6 +18,12 @@ export const systemMenus: MenuItem[] = [
level: 1, level: 1,
}, },
{ {
id: "system-user-management",
title: "用户管理",
path: "/system/user-management",
level: 1,
},
{
id: "page-hooks", id: "page-hooks",
title: "组合函数", title: "组合函数",
path: "/pageHooks/index", path: "/pageHooks/index",
...@@ -214,4 +220,3 @@ export function getMenuChain( ...@@ -214,4 +220,3 @@ export function getMenuChain(
return menuChain; return menuChain;
} }
...@@ -2,6 +2,10 @@ import type { RouteRecordRaw } from "vue-router"; ...@@ -2,6 +2,10 @@ import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import { UserManagementListRoute } from "../views/system/UserManagementList.route-snippet";
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
{ {
path: "/", path: "/",
...@@ -36,6 +40,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -36,6 +40,7 @@ const routes: RouteRecordRaw[] = [
title: "UI组件库", title: "UI组件库",
}, },
}, },
UserManagementListRoute,
{ {
path: "/pageHooks/index", path: "/pageHooks/index",
name: "PageHooks", name: "PageHooks",
...@@ -117,4 +122,3 @@ router.beforeEach((to: any, _from: any, next: any) => { ...@@ -117,4 +122,3 @@ router.beforeEach((to: any, _from: any, next: any) => {
}); });
export default router; export default router;
export const UserManagementListRoute = {
path: "/system/user-management",
name: "SystemUserManagement",
component: () => import("./UserManagementList.vue"),
meta: {
title: "用户管理",
},
};
<script setup lang="ts">
import { reactive, ref } from "vue";
import { VButton, VDialog, VInput, VSelect, VTable } from "@vui/vue";
const statusOptions = [
{ label: "启用", value: "active" },
{ label: "停用", value: "inactive" },
];
const filters = reactive({
keyword: "",
status: "",
});
const dialogState = reactive({
title: "",
visible: false,
});
const tableColumns = [
{ key: "name", label: "姓名" },
{ key: "status", label: "状态" },
{ key: "department", label: "部门" },
{ key: "actions", label: "操作", width: 220 },
];
const rows = ref([
{ id: 1, name: "张三", status: "启用", department: "平台研发" },
{ id: 2, name: "李四", status: "停用", department: "运营支持" },
]);
function handleFilterAction(actionId: "reset" | "search") {
if (actionId === "reset") {
filters.keyword = "";
filters.status = "";
return;
}
console.log("search-users", { ...filters });
}
function openDialog(title: string) {
dialogState.title = title;
dialogState.visible = true;
}
function handleRowAction(actionId: "edit" | "view", row: { name: string }) {
openDialog(actionId === "edit" ? `编辑 ${row.name}` : `查看 ${row.name}`);
}
</script>
<template>
<div class="user-management-page">
<header class="page-header">
<div>
<h1>用户管理</h1>
<p>用于演示 AI 主线生成页面接入真实项目后的最小闭环。</p>
</div>
<VButton @click="openDialog('新增用户')">
新增用户
</VButton>
</header>
<section class="page-card">
<h2>筛选条件</h2>
<div class="filter-row">
<VInput v-model="filters.keyword"
clearable
placeholder="请输入姓名或账号" />
<VSelect v-model="filters.status"
clearable
:options="statusOptions"
placeholder="请选择状态" />
<VButton @click="handleFilterAction('search')">
查询
</VButton>
<VButton plain @click="handleFilterAction('reset')">
重置
</VButton>
</div>
</section>
<section class="page-card">
<div class="section-header">
<h2>用户列表</h2>
<span class="section-tip">当前为演示数据,后续可接入真实接口与 store。</span>
</div>
<VTable :columns="tableColumns" :data="rows">
<template #actions="{ row }">
<div class="action-row">
<VButton plain @click="handleRowAction('view', row)">
查看
</VButton>
<VButton plain @click="handleRowAction('edit', row)">
编辑
</VButton>
</div>
</template>
</VTable>
</section>
<VDialog v-model="dialogState.visible"
:title="dialogState.title"
width="520px">
<p>这里保留为最小占位内容,后续可替换成 schema 驱动的表单或详情区域。</p>
<template #footer>
<div class="action-row">
<VButton plain @click="dialogState.visible = false">
取消
</VButton>
<VButton @click="dialogState.visible = false">
确认
</VButton>
</div>
</template>
</VDialog>
</div>
</template>
<style scoped>
.user-management-page {
display: grid;
gap: 16px;
padding: 16px;
}
.page-header {
display: flex;
gap: 16px;
align-items: center;
justify-content: space-between;
}
.page-card {
display: grid;
gap: 12px;
padding: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
}
.filter-row,
.section-header,
.action-row {
display: flex;
gap: 12px;
align-items: center;
}
.filter-row {
flex-wrap: wrap;
}
.section-header {
justify-content: space-between;
}
.section-tip {
font-size: 13px;
color: #6b7280;
}
</style>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"paths": { "paths": {
"@/*": ["src/*"], "@/*": ["src/*"],
"@venus/common-ui-vue": ["../../packages/common-ui/vue-ui/src/index.ts"], "@venus/common-ui-vue": ["../../packages/vui/vue-ui/src/index.ts"],
"@venus/composables": ["../../packages/composables/src/index.ts"] "@venus/composables": ["../../packages/composables/src/index.ts"]
}, },
"resolveJsonModule": true, "resolveJsonModule": true,
......
...@@ -7,3 +7,9 @@ ...@@ -7,3 +7,9 @@
- 生成新增页面、组件、样式和辅助文件 - 生成新增页面、组件、样式和辅助文件
- 尽量复用 `packages/cli/templates/**` 和统一组件库 - 尽量复用 `packages/cli/templates/**` 和统一组件库
- 在写文件前先输出生成计划,避免无边界覆盖 - 在写文件前先输出生成计划,避免无边界覆盖
当前试点约定:
- Vue 页面生成会优先读取 `project-context.uiStack.primaryLibrary`
- Vue 侧 AI 主线统一面向 `@vui/vue`
- 当项目上下文未显式声明 UI 包时,生成结果默认仍导入 `@vui/vue`
export const UserProfileDetailRoute = {
path: "/users/:id",
name: "UserProfileDetail",
component: () => import("./UserProfileDetail.vue"),
};
<script setup lang="ts">
import { ref } from "vue";
import { VButton } from "@vui/vue";
const detailRecord = ref({
name: "Demo User",
email: "demo@example.com",
role: "Admin",
status: "active",
});
function handleHeroAction(actionId: string) {
console.log("hero-action", actionId, detailRecord.value);
}
</script>
<template>
<div class="generated-page UserProfileDetail">
<header class="page-header">
<h1>User Profile</h1>
<p>Generated from page schema pilot.</p>
</header>
<section class="page-section">
<div class="section-header">
<div>
<h2>User Profile</h2>
<p>Profile summary and top-level actions.</p>
</div>
<VButton plain @click="handleHeroAction('edit-user')">
Edit
</VButton>
</div>
</section>
<section class="page-section">
<h2>Basic Information</h2>
<el-descriptions border :column="2">
<el-descriptions-item label="Name">
{{ detailRecord.name }}
</el-descriptions-item>
<el-descriptions-item label="Email">
{{ detailRecord.email }}
</el-descriptions-item>
<el-descriptions-item label="Role">
{{ detailRecord.role }}
</el-descriptions-item>
<el-descriptions-item label="Status">
{{ detailRecord.status }}
</el-descriptions-item>
</el-descriptions>
</section>
<section class="page-section">
<h2>Account Status</h2>
<p>Display account status, role and last login time.</p>
</section>
</div>
</template>
<style scoped>
.generated-page {
display: grid;
gap: 16px;
padding: 16px;
}
.page-header {
display: grid;
gap: 8px;
}
.page-section {
padding: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
}
.filter-row,
.section-header,
.action-row,
.field-switch {
display: flex;
gap: 12px;
align-items: center;
justify-content: space-between;
}
</style>
export const UserProfileFormRoute = {
path: "/users/create",
name: "UserProfileForm",
component: () => import("./UserProfileForm.vue"),
};
<script setup lang="ts">
import { reactive } from "vue";
import { VButton, VInput, VSelect } from "@vui/vue";
const selectOptions = {
"role": [
{
"label": "Option A",
"value": "option-a"
},
{
"label": "Option B",
"value": "option-b"
}
]
};
const formModel = reactive({
"name": "",
"email": "",
"role": "",
"enabled": false
});
function handleFormAction(actionId: string) {
console.log("form-action", actionId, formModel);
}
</script>
<template>
<div class="generated-page UserProfileForm">
<header class="page-header">
<h1>User Profile Form</h1>
<p>Generated from page schema pilot.</p>
</header>
<section class="page-section">
<h2>Profile Information</h2>
<el-form label-position="top">
<el-form-item label="Name">
<VInput v-model="formModel.name" placeholder="Name" />
</el-form-item>
<el-form-item label="Email">
<VInput v-model="formModel.email" placeholder="Email" />
</el-form-item>
<el-form-item label="Role">
<VSelect v-model="formModel.role"
:options="selectOptions.role"
placeholder="Role" />
</el-form-item>
<el-form-item label="Enabled">
<div class="field-switch">
<span>Enabled</span>
<el-switch v-model="formModel.enabled" />
</div>
</el-form-item>
<div class="action-row">
<VButton @click="handleFormAction('submit-form')">
Submit
</VButton>
<VButton plain @click="handleFormAction('cancel-form')">
Cancel
</VButton>
</div>
</el-form>
</section>
</div>
</template>
<style scoped>
.generated-page {
display: grid;
gap: 16px;
padding: 16px;
}
.page-header {
display: grid;
gap: 8px;
}
.page-section {
padding: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
}
.filter-row,
.section-header,
.action-row,
.field-switch {
display: flex;
gap: 12px;
align-items: center;
justify-content: space-between;
}
</style>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { VButton, VInput } from "@venus/common-ui-vue"; import { VButton, VDialog, VInput, VSelect, VTable } from "@vui/vue";
const selectOptions = {
"status": [
{
"label": "Option A",
"value": "option-a"
},
{
"label": "Option B",
"value": "option-b"
}
]
};
const dialogState = reactive({ visible: false, title: "" });
const dialogActionLabels = {
"create-user": "Create User",
"edit-user": "Edit"
};
const filters = reactive({ const filters = reactive({
"keyword": "", "keyword": "",
"status": "" "status": ""
}); });
const tableColumns = [
{
"key": "name",
"label": "Name"
},
{
"key": "status",
"label": "Status"
},
{
"key": "actions",
"label": "Actions",
"width": 220
}
];
const rows = ref([{ id: 1, name: "Demo User", status: "active" }]); const rows = ref([{ id: 1, name: "Demo User", status: "active" }]);
function handleSearch() { function handleFilterAction(actionId: string) {
console.log("search", filters); if (dialogActionLabels[actionId]) {
dialogState.title = dialogActionLabels[actionId];
dialogState.visible = true;
return;
}
console.log("filter-action", actionId, filters);
} }
function handleCreate() { function handleToolbarAction(actionId: string) {
console.log("create"); if (dialogActionLabels[actionId]) {
dialogState.title = dialogActionLabels[actionId];
dialogState.visible = true;
return;
}
console.log("toolbar-action", actionId);
} }
function handleView(row: { id: number; name: string; status: string }) { function handleRowAction(actionId: string, row: { id: number; name: string; status: string }) {
console.log("view", row); if (dialogActionLabels[actionId]) {
dialogState.title = dialogActionLabels[actionId];
dialogState.visible = true;
return;
}
console.log("row-action", actionId, row);
} }
</script> </script>
...@@ -29,36 +76,53 @@ function handleView(row: { id: number; name: string; status: string }) { ...@@ -29,36 +76,53 @@ function handleView(row: { id: number; name: string; status: string }) {
<p>Generated from page schema pilot.</p> <p>Generated from page schema pilot.</p>
</header> </header>
<section class="page-section"> <section class="page-section">
<h2>Filters</h2> <h2>Search Users</h2>
<div class="filter-row"> <div class="filter-row">
<VInput v-model="filters.keyword" placeholder="Keyword" /> <VInput v-model="filters.keyword" placeholder="Keyword" />
<el-input v-model="filters.status" placeholder="Status" /> <VSelect v-model="filters.status"
<VButton @click="handleSearch"> :options="selectOptions.status"
placeholder="Status" />
<VButton @click="handleFilterAction('search')">
Search Search
</VButton> </VButton>
<VButton plain @click="handleFilterAction('reset')">
Reset
</VButton>
</div> </div>
</section> </section>
<section class="page-section"> <section class="page-section">
<div class="section-header"> <div class="section-header">
<h2>User Table</h2> <h2>User Table</h2>
<VButton @click="handleCreate"> <VButton @click="handleToolbarAction('create-user')">
Create Create User
</VButton> </VButton>
</div> </div>
<el-table :data="rows" style="width: 100%"> <VTable :columns="tableColumns" :data="rows">
<el-table-column label="Name" prop="name" /> <template #actions="{ row }">
<el-table-column label="Status" prop="status" /> <VButton plain @click="handleRowAction('view-user', row)">
<el-table-column label="Actions"> View
<template #default="{ row }"> </VButton>
<VButton plain <VButton plain @click="handleRowAction('edit-user', row)">
size="small" Edit
@click="handleView(row)"> </VButton>
View </template>
</VButton> </VTable>
</template>
</el-table-column>
</el-table>
</section> </section>
<VDialog v-model="dialogState.visible"
:title="dialogState.title || 'Dialog'"
width="520px">
<p>Generated dialog placeholder for schema-driven actions.</p>
<template #footer>
<div class="action-row">
<VButton plain @click="dialogState.visible = false">
Cancel
</VButton>
<VButton @click="dialogState.visible = false">
Confirm
</VButton>
</div>
</template>
</VDialog>
</div> </div>
</template> </template>
...@@ -82,7 +146,9 @@ function handleView(row: { id: number; name: string; status: string }) { ...@@ -82,7 +146,9 @@ function handleView(row: { id: number; name: string; status: string }) {
} }
.filter-row, .filter-row,
.section-header { .section-header,
.action-row,
.field-switch {
display: flex; display: flex;
gap: 12px; gap: 12px;
align-items: center; align-items: center;
......
export const UserProfileDetailRoute = {
path: "/users/:id",
name: "UserProfileDetail",
component: () => import("./UserProfileDetail.vue"),
};
<script setup lang="ts">
import { ref } from "vue";
import { VButton } from "@vui/vue";
const detailRecord = ref({
name: "Demo User",
email: "demo@example.com",
role: "Admin",
status: "active",
});
function handleHeroAction(actionId: string) {
console.log("hero-action", actionId, detailRecord.value);
}
</script>
<template>
<div class="generated-page UserProfileDetail">
<header class="page-header">
<h1>User Profile</h1>
<p>Generated from page schema pilot.</p>
</header>
<section class="page-section">
<div class="section-header">
<div>
<h2>User Profile</h2>
<p>Profile summary and top-level actions.</p>
</div>
<VButton plain @click="handleHeroAction('edit-user')">
Edit
</VButton>
</div>
</section>
<section class="page-section">
<h2>Basic Information</h2>
<el-descriptions border :column="2">
<el-descriptions-item label="Name">
{{ detailRecord.name }}
</el-descriptions-item>
<el-descriptions-item label="Email">
{{ detailRecord.email }}
</el-descriptions-item>
<el-descriptions-item label="Role">
{{ detailRecord.role }}
</el-descriptions-item>
<el-descriptions-item label="Status">
{{ detailRecord.status }}
</el-descriptions-item>
</el-descriptions>
</section>
<section class="page-section">
<h2>Account Status</h2>
<p>Display account status, role and last login time.</p>
</section>
</div>
</template>
<style scoped>
.generated-page {
display: grid;
gap: 16px;
padding: 16px;
}
.page-header {
display: grid;
gap: 8px;
}
.page-section {
padding: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
}
.filter-row,
.section-header,
.action-row,
.field-switch {
display: flex;
gap: 12px;
align-items: center;
justify-content: space-between;
}
</style>
export const UserProfileFormRoute = {
path: "/users/create",
name: "UserProfileForm",
component: () => import("./UserProfileForm.vue"),
};
<script setup lang="ts">
import { reactive } from "vue";
import { VButton, VInput, VSelect } from "@vui/vue";
const selectOptions = {
"role": [
{
"label": "Option A",
"value": "option-a"
},
{
"label": "Option B",
"value": "option-b"
}
]
};
const formModel = reactive({
"name": "",
"email": "",
"role": "",
"enabled": false
});
function handleFormAction(actionId: string) {
console.log("form-action", actionId, formModel);
}
</script>
<template>
<div class="generated-page UserProfileForm">
<header class="page-header">
<h1>User Profile Form</h1>
<p>Generated from page schema pilot.</p>
</header>
<section class="page-section">
<h2>Profile Information</h2>
<el-form label-position="top">
<el-form-item label="Name">
<VInput v-model="formModel.name" placeholder="Name" />
</el-form-item>
<el-form-item label="Email">
<VInput v-model="formModel.email" placeholder="Email" />
</el-form-item>
<el-form-item label="Role">
<VSelect v-model="formModel.role"
:options="selectOptions.role"
placeholder="Role" />
</el-form-item>
<el-form-item label="Enabled">
<div class="field-switch">
<span>Enabled</span>
<el-switch v-model="formModel.enabled" />
</div>
</el-form-item>
<div class="action-row">
<VButton @click="handleFormAction('submit-form')">
Submit
</VButton>
<VButton plain @click="handleFormAction('cancel-form')">
Cancel
</VButton>
</div>
</el-form>
</section>
</div>
</template>
<style scoped>
.generated-page {
display: grid;
gap: 16px;
padding: 16px;
}
.page-header {
display: grid;
gap: 8px;
}
.page-section {
padding: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
}
.filter-row,
.section-header,
.action-row,
.field-switch {
display: flex;
gap: 12px;
align-items: center;
justify-content: space-between;
}
</style>
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
负责承接 Figma 设计稿输入。 负责承接 Figma 设计稿输入。
当前试点能力:
- 将 `SECTION / FORM / ACTIONS / TABLE / HERO` 映射为 `page-schema` 的 `section/block`
- 支持从子节点 `INPUT / SELECT / SWITCH / BUTTON` 自动提炼字段与动作
- 基于页面意图和动作语义推断最小 `dataRequirements`
后续目标: 后续目标:
- 读取页面、Frame、组件、样式和 token - 读取页面、Frame、组件、样式和 token
......
...@@ -2,6 +2,21 @@ ...@@ -2,6 +2,21 @@
负责老项目增量修改。 负责老项目增量修改。
当前试点能力:
- 根据 `page-schema` 与 `project-context` 生成最小增量 patch 计划
- 将新增页面文件与路由注册 patch 分离,优先输出可审查的计划
- 识别常见 `vue-router` 文件形态,为静态 routes 数组、router 工厂和 `addRoutes` 辅助函数生成不同 patch 建议
- 对菜单耦合、状态管理、微前端壳集成给出 review-only 提示
- 当项目使用 `@vui/vue` 时,读取 `meta/index.json` 与组件级 manifest,给出组件选择建议
锚点降级规则:
- `shared-prefix` 视为高置信度,可以保留结构化插入建议
- `catch-all-fallback` 视为中置信度,只作为保底结构位置参考
- `semantic-resource` 与 `generic-fallback` 视为低置信度,自动降级为 `manual-review`
- 当 patch plan 输出 `anchorReviewRequired: true` 或 `menuAnchorReviewRequired: true` 时,候选锚点仅用于缩小人工判断范围,不应直接自动落补丁
后续目标: 后续目标:
- 在已有项目中定位路由、菜单、页面和组件插入点 - 在已有项目中定位路由、菜单、页面和组件插入点
......
{
"planId": "user-management-list-incremental-patch",
"targetProject": {
"projectName": "@demo/vui-admin",
"projectRoot": "D:/work/venus/apps/frontend/vue/vui-admin",
"framework": "vue",
"primaryUiLibrary": "@vui/vue",
"componentManifestEntry": "packages/vui/vue/meta/index.json"
},
"page": {
"pageId": "user-management-list",
"title": "User Management",
"intent": "list",
"routePath": "/users",
"routeName": "UserManagementList"
},
"routeRegistration": {
"strategy": "generic-review",
"routeFile": "src/router/index.ts",
"insertionHint": "Review the existing router bootstrap flow and register the generated route manually.",
"detectedSignals": []
},
"componentSelections": [
{
"hint": "VInput",
"exportName": "VInput",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VInput/VInput.manifest.json",
"usedIn": ["field:keyword"],
"recommendedScenarios": ["表单基础输入", "登录页账号密码输入", "需要前后缀的输入场景"]
},
{
"hint": "VButton",
"exportName": "VButton",
"packageName": "@vui/vue",
"sourceManifest": "packages/vui/vue/src/components/VButton/VButton.manifest.json",
"usedIn": ["action:search", "action:reset", "action:create-user", "action:view-user", "action:edit-user"],
"recommendedScenarios": ["表单提交", "列表工具条主操作", "弹窗确认操作"]
}
],
"operations": [
{
"id": "create-page-file",
"kind": "create-file",
"targetPath": "src/views/UserManagementList.vue",
"description": "Create the generated list page component.",
"patchStrategy": "none",
"reason": "The page does not exist yet and should be introduced as a new file."
},
{
"id": "create-route-snippet",
"kind": "create-file",
"targetPath": "src/views/UserManagementList.route-snippet.ts",
"description": "Create an isolated route export that can be reviewed before touching the live router file.",
"patchStrategy": "none",
"reason": "Separating the route definition reduces risk for old projects."
},
{
"id": "patch-router-registration",
"kind": "patch-file",
"targetPath": "src/router/index.ts",
"description": "Register the generated route using the detected generic-review strategy.",
"patchStrategy": "manual-review",
"snippet": "import { UserManagementListRoute } from \"../views/UserManagementList.route-snippet\";\n\n// TODO(ai-patcher): review the router bootstrap flow and register UserManagementListRoute manually.",
"dependsOn": ["create-route-snippet"],
"reason": "The project context indicates that route registration is required for new pages and the router file matches generic-review."
},
{
"id": "review-state-impact",
"kind": "review-only",
"targetPath": "src/stores/index.ts",
"description": "Review whether this page needs a dedicated pinia store or can remain local-state only.",
"patchStrategy": "manual-review",
"reason": "The project uses pinia and new module pages may need shared state integration."
}
],
"validation": {
"commands": ["pnpm lint", "pnpm run check:type"],
"notes": [
"Review the generated route snippet before patching the live router file.",
"Prefer reusing the existing project UI library rather than introducing raw UI markup."
]
},
"notes": [
"changes must respect workspace-level quality gates",
"prefer existing @vui/vue components before introducing raw UI markup",
"new pages should include route registration planning",
"state additions should align with the current pinia store layout",
"component library manifest loaded from packages/vui/vue/meta/index.json",
"component hints without manifest mapping: FilterToolbar, StatusSelect, DataTable"
]
}
export const UserManagementListRoute = {
path: "/users",
name: "UserManagementList",
component: () => import("./UserManagementList.vue"),
};
<script setup lang="ts">
import { reactive, ref } from "vue";
import { VButton, VInput } from "@vui/vue";
const filters = reactive({
"keyword": "",
"status": ""
});
const rows = ref([{ id: 1, name: "Demo User", status: "active" }]);
function handleFilterAction(actionId: string) {
console.log("filter-action", actionId, filters);
}
function handleToolbarAction(actionId: string) {
console.log("toolbar-action", actionId);
}
function handleRowAction(actionId: string, row: { id: number; name: string; status: string }) {
console.log("row-action", actionId, row);
}
</script>
<template>
<div class="generated-page UserManagementList">
<header class="page-header">
<h1>User Management</h1>
<p>Generated from page schema pilot.</p>
</header>
<section class="page-section">
<h2>Search Users</h2>
<div class="filter-row">
<VInput v-model="filters.keyword" placeholder="Keyword" />
<el-select v-model="filters.status" placeholder="Status">
<el-option label="Option A" value="option-a" />
<el-option label="Option B" value="option-b" />
</el-select>
<VButton @click="handleFilterAction('search')">
Search
</VButton>
<VButton plain @click="handleFilterAction('reset')">
Reset
</VButton>
</div>
</section>
<section class="page-section">
<div class="section-header">
<h2>User Table</h2>
<VButton @click="handleToolbarAction('create-user')">
Create User
</VButton>
</div>
<el-table :data="rows" style="width: 100%">
<el-table-column label="Name" prop="name" />
<el-table-column label="Status" prop="status" />
<el-table-column label="Actions">
<template #default="{ row }">
<VButton plain @click="handleRowAction('view-user', row)">
View
</VButton>
<VButton plain @click="handleRowAction('edit-user', row)">
Edit
</VButton>
</template>
</el-table-column>
</el-table>
</section>
</div>
</template>
<style scoped>
.generated-page {
display: grid;
gap: 16px;
padding: 16px;
}
.page-header {
display: grid;
gap: 8px;
}
.page-section {
padding: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
}
.filter-row,
.section-header,
.action-row,
.field-switch {
display: flex;
gap: 12px;
align-items: center;
justify-content: space-between;
}
</style>
...@@ -2,8 +2,9 @@ import fs from "node:fs"; ...@@ -2,8 +2,9 @@ import fs from "node:fs";
import path from "node:path"; import path from "node:path";
const KNOWN_UI_PACKAGES = [ const KNOWN_UI_PACKAGES = [
"@venus/common-ui", "@vui/react",
"@venus/common-ui-vue", "@vui/uniapp",
"@vui/vue",
"antd", "antd",
"ant-design-vue", "ant-design-vue",
"element-plus", "element-plus",
...@@ -181,10 +182,12 @@ function detectUiStack(dependencies) { ...@@ -181,10 +182,12 @@ function detectUiStack(dependencies) {
const componentPackages = KNOWN_UI_PACKAGES.filter((pkg) => Boolean(dependencies[pkg])); const componentPackages = KNOWN_UI_PACKAGES.filter((pkg) => Boolean(dependencies[pkg]));
let primaryLibrary = "unknown"; let primaryLibrary = "unknown";
if (componentPackages.includes("@venus/common-ui-vue")) { if (componentPackages.includes("@vui/vue")) {
primaryLibrary = "@venus/common-ui-vue"; primaryLibrary = "@vui/vue";
} else if (componentPackages.includes("@venus/common-ui")) { } else if (componentPackages.includes("@vui/react")) {
primaryLibrary = "@venus/common-ui"; primaryLibrary = "@vui/react";
} else if (componentPackages.includes("@vui/uniapp")) {
primaryLibrary = "@vui/uniapp";
} else if (componentPackages.includes("element-plus")) { } else if (componentPackages.includes("element-plus")) {
primaryLibrary = "element-plus"; primaryLibrary = "element-plus";
} else if (componentPackages.includes("ant-design-vue")) { } else if (componentPackages.includes("ant-design-vue")) {
...@@ -196,7 +199,7 @@ function detectUiStack(dependencies) { ...@@ -196,7 +199,7 @@ function detectUiStack(dependencies) {
return { return {
componentPackages, componentPackages,
primaryLibrary, primaryLibrary,
tokenSource: primaryLibrary.startsWith("@venus/common-ui") ? "venus-component-library" : primaryLibrary, tokenSource: primaryLibrary,
}; };
} }
...@@ -232,8 +235,8 @@ function buildConstraints(framework, dependencies, workspaceRoot) { ...@@ -232,8 +235,8 @@ function buildConstraints(framework, dependencies, workspaceRoot) {
constraints.push("route and shell integration must remain qiankun-compatible"); constraints.push("route and shell integration must remain qiankun-compatible");
} }
if (dependencies["@venus/common-ui-vue"]) { if (dependencies["@vui/vue"]) {
constraints.push("prefer existing @venus/common-ui-vue components before introducing raw UI markup"); constraints.push("prefer existing @vui/vue components before introducing raw UI markup");
} }
if (dependencies["vue-router"]) { if (dependencies["vue-router"]) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/venusjs/vue-venus-admin.git", "url": "git+https://github.com/venusjs/vue-venus-admin.git",
"directory": "packages/common-ui" "directory": "packages/vui"
}, },
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/venusjs/vue-venus-admin.git", "url": "git+https://github.com/venusjs/vue-venus-admin.git",
"directory": "packages/common-ui" "directory": "packages/vui/vue-ui"
}, },
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ElButton } from "element-plus"; import { ElButton } from "element-plus";
defineOptions({
name: "VButton",
});
defineProps<{ defineProps<{
block?: boolean; block?: boolean;
circle?: boolean; circle?: boolean;
......
# VUI Workspace
本目录承接 `venus` 的多端组件包族。
当前阶段结构:
- `tokens/`:设计 token
- `shared/`:跨框架共享类型与工具
- `vue/`:Vue 组件运行时包
- `react/`:React 组件运行时包
- `uniapp/`:uniapp / 小程序组件运行时包
- `vue-ui/`:历史兼容目录,暂不作为最终形态
当前迁移原则:
- 新能力优先进入 `packages/vui/*`
- 旧目录只做兼容,不继续扩张
- AI 组件 manifest 跟随平台包维护在 `meta/` 目录
# @vui/react
React 运行时组件包骨架。
当前阶段只建立发布与目录位置,后续再补 React 版本的 Button/Input 试点。
# React Meta
当前阶段保留 `meta/` 入口,后续在此维护 `@vui/react` 的组件 manifest。
{
"name": "@vui/react",
"version": "0.1.0",
"description": "VUI React runtime components",
"type": "module",
"files": [
"meta",
"src"
],
"sideEffects": false,
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./src/index.ts"
}
},
"peerDependencies": {
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
}
}
// React package skeleton. Components will be added in the next iteration.
export {};
# @vui/shared
承载跨框架共享的类型、工具函数和 AI 组件语义辅助类型。
{
"name": "@vui/shared",
"version": "0.1.0",
"description": "VUI shared types and helpers",
"type": "module",
"files": [
"src"
],
"sideEffects": false,
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./src/index.ts"
}
}
}
export type VuiPlatform = "react" | "uniapp" | "vue";
export interface VuiComponentRef {
exportName: string;
packageName: string;
platform: VuiPlatform;
}
# @vui/tokens
承载 `vui` 的设计 token。
当前阶段只建立最小入口,后续继续拆分颜色、字号、间距、圆角、阴影和断点。
{
"name": "@vui/tokens",
"version": "0.1.0",
"description": "VUI design tokens",
"type": "module",
"files": [
"src"
],
"sideEffects": false,
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./src/index.ts"
}
}
}
export const vuiColorTokens = {
primary: "#3b82f6",
text: "#111827",
border: "#e5e7eb",
surface: "#ffffff",
} as const;
export const vuiSpacingTokens = {
xs: 4,
sm: 8,
md: 12,
lg: 16,
xl: 24,
} as const;
# @vui/uniapp
uniapp / 小程序运行时组件包骨架。
当前阶段先保留目录与发布位,后续再补多端组件适配。
# Uniapp Meta
当前阶段保留 `meta/` 入口,后续在此维护 `@vui/uniapp` 的组件 manifest。
{
"name": "@vui/uniapp",
"version": "0.1.0",
"description": "VUI uniapp runtime components",
"type": "module",
"files": [
"meta",
"src"
],
"sideEffects": false,
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./src/index.ts"
}
}
}
// uniapp package skeleton. Components will be added in the next iteration.
export {};
# 构建产物
dist
*.log
# 依赖
node_modules
# IDE
.vscode
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# 临时文件
*.tmp
*.bak
.DS_Store
# 源代码
src/
# 示例
examples/
# 配置文件
*.config.ts
*.config.js
tsconfig.json
# 文档
*.md
!README.md
# 开发文件
.gitignore
.npmignore
# 测试
__tests__/
*.test.ts
*.spec.ts
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - 2024-11-13
### Added
- 🎉 初始版本发布
- ✨ 新增 `VButton` 按钮组件
- 支持加载状态
- 支持确认提示
- 支持防抖功能
- 支持权限控制
- 继承 Element Plus Button 所有功能
- ✨ 新增 `VSearchBox` 搜索框组件
- 支持防抖搜索
- 支持清空事件
- 支持回车搜索
- 支持自定义搜索按钮
- 多种尺寸支持
- 📝 完整的 TypeScript 类型定义
- 📚 详细的使用文档和示例
- 🎨 优雅的样式设计
### Features
#### VButton 特性
- 基于 Element Plus ElButton 二次封装
- 提供更便捷的业务功能
- 完整的 TypeScript 支持
- 支持所有 Element Plus Button 属性
#### VSearchBox 特性
- 基于 Element Plus ElInput 二次封装
- 自动防抖搜索
- 支持多种事件监听
- 美观的搜索按钮样式
- 响应式设计
[1.0.0]: https://github.com/venusjs/vue-venus-admin/releases/tag/common-ui-v1.0.0
# @venus/common-ui
Venus Pro 通用 UI 组件库 - 基于 Element Plus 的二次封装
## 简介
这是一个基于 Element Plus 的二次封装组件库,提供更符合业务需求的组件 API 和默认配置。
## 安装
```bash
pnpm add @venus/common-ui
```
## 使用
```typescript
import { VButton, VSearchBox } from "@venus/common-ui";
```
## 组件列表
### VButton - 按钮组件
增强型按钮组件,提供加载状态、权限控制等功能。
```vue
<VButton type="primary" :loading="isLoading" @click="handleClick">
提交
</VButton>
```
### VSearchBox - 搜索框组件
增强型搜索框,支持防抖、清空、搜索事件等功能。
```vue
<VSearchBox v-model="searchText" placeholder="请输入搜索内容" @search="handleSearch" />
```
## 特性
- 🎨 基于 Element Plus,保持统一的设计风格
- 📦 开箱即用的业务组件
- 🔧 灵活的配置和扩展
- 💪 TypeScript 支持
- 🎯 专注于业务场景
## License
MIT
import { defineBuildConfig } from "unbuild";
export default defineBuildConfig({
clean: true,
declaration: true,
entries: [ "src/index" ],
externals: [
"vue",
"element-plus",
"@vueuse/core",
"@element-plus/icons-vue",
],
rollup: {
emitCJS: false,
esbuild: {
target: "es2015",
},
},
});
# @venus/common-ui 集成说明
## 在微前端基座中的使用示例
### 1. 引入组件
在 `Home.vue` 中引入公共组件库:
```typescript
import { VButton, VSearchBox } from "@venus/common-ui";
import { ElMessage } from "element-plus";
```
### 2. 组件使用示例
#### VSearchBox - 搜索框组件
```vue
<template>
<VSearchBox
v-model="searchKeyword"
placeholder="请输入搜索关键词"
:debounce="300"
@search="handleSearch"
@clear="handleClearSearch" />
</template>
<script setup lang="ts">
import { ref } from "vue";
import { VSearchBox } from "@venus/common-ui";
const searchKeyword = ref("");
const handleSearch = (value: string) => {
console.log("搜索关键词:", value);
// 执行搜索逻辑
};
const handleClearSearch = () => {
console.log("搜索框已清空");
};
</script>
```
**特性:**
- ✓ 支持 v-model 双向绑定
- ✓ 内置防抖功能(可配置延迟时间)
- ✓ 支持清空按钮和清空事件
- ✓ 支持回车键搜索
- ✓ 可选搜索按钮
- ✓ 支持多种尺寸(large / default / small)
#### VButton - 按钮组件
```vue
<template>
<!-- 基础使用 -->
<VButton type="primary" @click="handleClick">点击按钮</VButton>
<!-- 加载状态 -->
<VButton type="primary" :loading="isLoading" @click="handleAsync">异步操作</VButton>
<!-- 确认提示 -->
<VButton type="danger" confirm-text="确定要删除吗?" @click="handleDelete">删除</VButton>
<!-- 防抖 -->
<VButton type="primary" :debounce="500" @click="handleClick">防抖按钮</VButton>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { VButton } from "@venus/common-ui";
const isLoading = ref(false);
const handleClick = () => {
console.log("按钮被点击");
};
const handleAsync = async () => {
isLoading.value = true;
// 执行异步操作
await someAsyncOperation();
isLoading.value = false;
};
const handleDelete = () => {
console.log("删除操作已确认");
};
</script>
```
**特性:**
- ✓ 继承 Element Plus Button 所有属性和功能
- ✓ 内置加载状态管理
- ✓ 支持点击前确认提示
- ✓ 内置防抖功能(可配置延迟时间)
- ✓ 支持权限控制(预留接口)
- ✓ 完整的 TypeScript 类型支持
### 3. 在其他微应用中使用
#### 方式一:全局注册(推荐)
在微应用的入口文件(如 `main.ts`)中:
```typescript
import { createApp } from "vue";
import CommonUI from "@venus/common-ui";
import App from "./App.vue";
const app = createApp(App);
app.use(CommonUI);
app.mount("#app");
```
#### 方式二:按需引入
```typescript
import { VButton, VSearchBox } from '@venus/common-ui';
// 在组件中直接使用
<template>
<VButton type="primary">按钮</VButton>
<VSearchBox v-model="keyword" @search="handleSearch" />
</template>
```
### 4. TypeScript 支持
```typescript
import type { VButtonProps, VSearchBoxProps } from "@venus/common-ui";
// 享受完整的类型提示和检查
const buttonProps: VButtonProps = {
type: "primary",
loading: false,
debounce: 300,
};
const searchProps: VSearchBoxProps = {
modelValue: "",
placeholder: "请输入",
debounce: 300,
};
```
### 5. 在主应用中查看示例
启动主应用后,访问首页即可看到完整的组件展示和使用示例:
```bash
# 安装依赖
pnpm install
# 启动主应用
pnpm dev
```
访问 `http://localhost:5173`,向下滚动到 "**@venus/common-ui 公共组件库示例**" 部分。
### 6. 组件 API 参考
详细的 API 文档请参考:
- [VButton API](./src/components/button/index.vue)
- [VSearchBox API](./src/components/search-box/index.vue)
- [类型定义](./src/types.ts)
### 7. 扩展开发
如需添加新组件,请按以下步骤操作:
1. 在 `src/components/` 下创建新组件目录
2. 实现组件逻辑和样式
3. 在 `src/components/index.ts` 中导出组件
4. 在 `src/index.ts` 中注册组件
5. 更新类型定义(`src/types.ts`)
6. 运行 `pnpm build` 构建组件库
## 注意事项
- 所有组件基于 Element Plus 二次封装,确保项目已安装 Element Plus
- 组件库使用 TypeScript 开发,建议在 TypeScript 项目中使用以获得最佳体验
- 确保 Vue 版本 >= 3.3.0,Element Plus 版本 >= 2.0.0
## 常见问题
### Q: 组件样式不生效?
A: 确保已正确引入 Element Plus 的样式文件。
### Q: TypeScript 类型报错?
A: 检查 `tsconfig.json` 配置,确保正确配置了类型解析路径。
### Q: 组件热更新不生效?
A: 在开发模式下,组件库使用源码引入(development 模式),修改后会自动热更新。
---
更多问题请查看 [README.md](./README.md) 或提交 Issue。
# @venus/common-ui 使用指南
## 安装
在项目的 `package.json` 中添加依赖:
```json
{
"dependencies": {
"@venus/common-ui": "workspace:*"
}
}
```
然后运行:
```bash
pnpm install
```
## 全局注册
在你的 Vue 应用入口文件中:
```typescript
import { createApp } from "vue";
import App from "./App.vue";
import VenusUI from "@venus/common-ui";
const app = createApp(App);
// 全局注册所有组件
app.use(VenusUI);
app.mount("#app");
```
## 按需引入
```vue
<script setup lang="ts">
import { VButton, VSearchBox } from "@venus/common-ui";
</script>
```
## 组件使用示例
### VButton 按钮组件
#### 基础用法
```vue
<template>
<VButton>默认按钮</VButton>
<VButton type="primary">主要按钮</VButton>
<VButton type="success">成功按钮</VButton>
<VButton type="warning">警告按钮</VButton>
<VButton type="danger">危险按钮</VButton>
<VButton type="info">信息按钮</VButton>
</template>
```
#### 加载状态
```vue
<script setup lang="ts">
import { ref } from "vue";
import { VButton } from "@venus/common-ui";
const loading = ref(false);
const handleSubmit = async () => {
loading.value = true;
try {
// 执行异步操作
await someAsyncOperation();
} finally {
loading.value = false;
}
};
</script>
<template>
<VButton type="primary" :loading="loading" @click="handleSubmit">提交</VButton>
</template>
```
#### 确认提示
```vue
<template>
<VButton type="danger" confirm-text="确定要删除吗?" @click="handleDelete">删除</VButton>
</template>
```
#### 防抖功能
```vue
<template>
<!-- 300ms 防抖 -->
<VButton type="primary" :debounce="300" @click="handleSave">保存</VButton>
</template>
```
#### 权限控制
```vue
<template>
<!-- 只有拥有 'user:delete' 权限的用户才能看到此按钮 -->
<VButton type="danger" permission="user:delete" @click="handleDelete">删除用户</VButton>
</template>
```
### VSearchBox 搜索框组件
#### 基础用法
```vue
<script setup lang="ts">
import { ref } from "vue";
import { VSearchBox } from "@venus/common-ui";
const searchText = ref("");
const handleSearch = (value: string) => {
console.log("搜索:", value);
// 执行搜索逻辑
};
</script>
<template>
<VSearchBox v-model="searchText" placeholder="请输入搜索内容" @search="handleSearch" />
</template>
```
#### 不显示搜索按钮
```vue
<template>
<VSearchBox v-model="searchText" :show-search-button="false" @search="handleSearch" />
</template>
```
#### 自定义防抖时间
```vue
<template>
<!-- 500ms 防抖 -->
<VSearchBox v-model="searchText" :debounce="500" @search="handleSearch" />
</template>
```
#### 监听清空事件
```vue
<script setup lang="ts">
const handleClear = () => {
console.log("搜索框已清空");
// 执行清空后的逻辑,比如重置列表
};
</script>
<template>
<VSearchBox v-model="searchText" @search="handleSearch" @clear="handleClear" />
</template>
```
#### 不同尺寸
```vue
<template>
<VSearchBox v-model="searchText" size="large" />
<VSearchBox v-model="searchText" size="default" />
<VSearchBox v-model="searchText" size="small" />
</template>
```
#### 禁用状态
```vue
<template>
<VSearchBox v-model="searchText" disabled />
</template>
```
## 完整示例
```vue
<script setup lang="ts">
import { ref, reactive } from "vue";
import { VButton, VSearchBox } from "@venus/common-ui";
import { ElMessage } from "element-plus";
// 搜索相关
const searchText = ref("");
const handleSearch = (value: string) => {
console.log("搜索:", value);
ElMessage.success(`正在搜索: ${value}`);
};
const handleClear = () => {
ElMessage.info("搜索已清空");
};
// 表单相关
const loading = ref(false);
const formData = reactive({
name: "",
email: "",
});
const handleSubmit = async () => {
loading.value = true;
try {
// 模拟API调用
await new Promise((resolve) => setTimeout(resolve, 2000));
ElMessage.success("提交成功");
} catch (error) {
ElMessage.error("提交失败");
} finally {
loading.value = false;
}
};
const handleDelete = () => {
ElMessage.success("删除成功");
};
const handleSave = () => {
ElMessage.success("保存成功");
};
</script>
<template>
<div class="demo-container">
<h2>搜索功能</h2>
<VSearchBox
v-model="searchText"
placeholder="搜索用户..."
:debounce="300"
@search="handleSearch"
@clear="handleClear" />
<h2>按钮示例</h2>
<div class="button-group">
<VButton type="primary" :loading="loading" @click="handleSubmit">提交表单</VButton>
<VButton type="danger" confirm-text="确定要删除吗?此操作不可恢复!" @click="handleDelete">
删除数据
</VButton>
<VButton type="success" :debounce="500" @click="handleSave">保存草稿</VButton>
</div>
</div>
</template>
<style scoped>
.demo-container {
padding: 20px;
}
.button-group {
display: flex;
gap: 10px;
margin-top: 20px;
}
h2 {
margin: 20px 0 10px;
}
</style>
```
## TypeScript 类型支持
所有组件都提供完整的 TypeScript 类型定义:
```typescript
import type { VButtonProps, VSearchBoxProps } from "@venus/common-ui";
// 使用类型
const buttonProps: VButtonProps = {
type: "primary",
loading: true,
debounce: 300,
};
const searchProps: VSearchBoxProps = {
modelValue: "",
placeholder: "搜索",
debounce: 500,
};
```
## API 文档
### VButton Props
| 属性 | 说明 | 类型 | 默认值 |
| ----------- | ---------------- | ------------------------------------------------------------------------ | ----------- |
| type | 按钮类型 | `'default' \| 'primary' \| 'success' \| 'warning' \| 'danger' \| 'info'` | `'default'` |
| loading | 是否加载中 | `boolean` | `false` |
| disabled | 是否禁用 | `boolean` | `false` |
| permission | 权限码 | `string` | - |
| confirmText | 确认提示文本 | `string` | - |
| debounce | 防抖时间(毫秒) | `number` | `0` |
继承 Element Plus ElButton 的所有属性。
### VButton Events
| 事件名 | 说明 | 参数 |
| ------ | -------- | ----------------------------- |
| click | 点击事件 | `(event: MouseEvent) => void` |
### VSearchBox Props
| 属性 | 说明 | 类型 | 默认值 |
| ---------------- | ---------------- | --------------------------------- | ------------------ |
| modelValue | 绑定值 | `string` | `''` |
| placeholder | 占位符 | `string` | `'请输入搜索内容'` |
| clearable | 是否可清空 | `boolean` | `true` |
| debounce | 防抖延迟(毫秒) | `number` | `300` |
| showSearchButton | 是否显示搜索按钮 | `boolean` | `true` |
| searchButtonText | 搜索按钮文本 | `string` | `'搜索'` |
| size | 输入框尺寸 | `'large' \| 'default' \| 'small'` | `'default'` |
| maxlength | 最大长度 | `number` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| prefixIcon | 搜索图标 | `string \| Component` | `Search` |
### VSearchBox Events
| 事件名 | 说明 | 参数 |
| ----------------- | ---------- | ------------------------- |
| update:modelValue | 输入值变化 | `(value: string) => void` |
| search | 搜索事件 | `(value: string) => void` |
| clear | 清空事件 | `() => void` |
| input | 输入事件 | `(value: string) => void` |
## 注意事项
1. **Element Plus 依赖**:本组件库依赖 Element Plus,请确保项目中已安装并正确配置 Element Plus。
2. **样式引入**:如果使用按需引入,请确保引入了 Element Plus 的样式:
```typescript
import "element-plus/dist/index.css";
```
3. **图标**:搜索框组件使用了 Element Plus 的图标,确保图标已正确配置。
4. **防抖**:搜索框的防抖功能会在输入时自动触发搜索,如果不需要此功能,可以将 `debounce` 设置为 `0`。
5. **权限控制**:按钮的权限控制功能需要配合项目的权限系统使用,你需要在组件内部实现 `hasPermission` 函数。
<template>
<div class="example-container">
<h1>@venus/common-ui 组件示例</h1>
<!-- 搜索框示例 -->
<section class="section">
<h2>VSearchBox - 搜索框组件</h2>
<div class="demo-block">
<h3>基础用法</h3>
<VSearchBox v-model="searchText"
placeholder="请输入搜索内容..."
@clear="handleClear"
@search="handleSearch" />
<p class="hint">
当前搜索值: {{ searchText }}
</p>
</div>
<div class="demo-block">
<h3>不显示搜索按钮</h3>
<VSearchBox v-model="searchText"
placeholder="输入后回车搜索"
:show-search-button="false"
@search="handleSearch" />
</div>
<div class="demo-block">
<h3>不同尺寸</h3>
<div class="size-group">
<VSearchBox v-model="searchText"
placeholder="大尺寸"
size="large"
@search="handleSearch" />
<VSearchBox v-model="searchText"
placeholder="默认尺寸"
size="default"
@search="handleSearch" />
<VSearchBox v-model="searchText"
placeholder="小尺寸"
size="small"
@search="handleSearch" />
</div>
</div>
<div class="demo-block">
<h3>禁用状态</h3>
<VSearchBox v-model="searchText"
disabled
placeholder="禁用状态" />
</div>
<div class="demo-block">
<h3>自定义防抖时间</h3>
<VSearchBox v-model="searchText"
:debounce="1000"
placeholder="1秒防抖"
@search="handleSearch" />
<p class="hint">
输入后 1 秒才会触发搜索
</p>
</div>
</section>
<!-- 按钮示例 -->
<section class="section">
<h2>VButton - 按钮组件</h2>
<div class="demo-block">
<h3>按钮类型</h3>
<div class="button-group">
<VButton>默认按钮</VButton>
<VButton type="primary">
主要按钮
</VButton>
<VButton type="success">
成功按钮
</VButton>
<VButton type="warning">
警告按钮
</VButton>
<VButton type="danger">
危险按钮
</VButton>
<VButton type="info">
信息按钮
</VButton>
</div>
</div>
<div class="demo-block">
<h3>加载状态</h3>
<div class="button-group">
<VButton :loading="loading"
type="primary"
@click="handleSubmit">
{{ loading ? "提交中..." : "提交表单" }}
</VButton>
<VButton loading type="primary">
加载中
</VButton>
</div>
</div>
<div class="demo-block">
<h3>禁用状态</h3>
<div class="button-group">
<VButton disabled>
默认按钮
</VButton>
<VButton disabled type="primary">
主要按钮
</VButton>
<VButton disabled type="success">
成功按钮
</VButton>
</div>
</div>
<div class="demo-block">
<h3>确认提示</h3>
<div class="button-group">
<VButton confirm-text="确定要删除这条数据吗?此操作不可恢复!"
type="danger"
@click="handleDelete">
删除数据
</VButton>
<VButton confirm-text="确定要重置所有设置吗?"
type="warning"
@click="handleSave">
重置设置
</VButton>
</div>
<p class="hint">
点击按钮会弹出确认对话框
</p>
</div>
<div class="demo-block">
<h3>防抖功能</h3>
<div class="button-group">
<VButton :debounce="500"
type="primary"
@click="handleQuickClick">
500ms 防抖
</VButton>
<VButton :debounce="1000"
type="success"
@click="handleQuickClick">
1000ms 防抖
</VButton>
</div>
<p class="hint">
快速连续点击,只会触发一次
</p>
</div>
<div class="demo-block">
<h3>按钮尺寸</h3>
<div class="button-group">
<VButton size="large" type="primary">
大型按钮
</VButton>
<VButton size="default" type="primary">
默认按钮
</VButton>
<VButton size="small" type="primary">
小型按钮
</VButton>
</div>
</div>
<div class="demo-block">
<h3>图标按钮</h3>
<div class="button-group">
<VButton icon="Search" type="primary">
搜索
</VButton>
<VButton icon="Check" type="success">
确认
</VButton>
<VButton icon="Edit" type="warning">
编辑
</VButton>
<VButton icon="Delete" type="danger">
删除
</VButton>
</div>
</div>
</section>
<!-- 组合示例 -->
<section class="section">
<h2>组合示例</h2>
<div class="demo-block">
<h3>搜索和操作</h3>
<div class="combined-demo">
<VSearchBox v-model="searchText"
placeholder="搜索用户..."
style="flex: 1"
@search="handleSearch" />
<div class="button-group" style="margin-left: 12px">
<VButton icon="Plus" type="primary">
新增
</VButton>
<VButton icon="Upload" type="success">
导入
</VButton>
<VButton icon="Download" type="warning">
导出
</VButton>
</div>
</div>
</div>
</section>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { ElMessage } from "element-plus";
import { VButton, VSearchBox } from "../src";
// 搜索示例
const searchText = ref("");
const handleSearch = (value: string) => {
console.log("搜索内容:", value);
ElMessage.success(`正在搜索: ${value || "空"}`);
};
const handleClear = () => {
ElMessage.info("搜索框已清空");
};
// 按钮示例
const loading = ref(false);
const handleSubmit = async () => {
loading.value = true;
ElMessage.info("提交中...");
// 模拟 API 调用
await new Promise((resolve) => setTimeout(resolve, 2000));
loading.value = false;
ElMessage.success("提交成功!");
};
const handleDelete = () => {
ElMessage.success("删除成功!");
};
const handleSave = () => {
ElMessage.success("保存成功!");
};
const handleQuickClick = () => {
ElMessage.info("点击事件触发");
};
</script>
<style scoped>
/* 响应式 */
@media (max-width: 768px) {
.example-container {
padding: 16px;
}
.button-group {
gap: 8px;
}
.combined-demo {
flex-direction: column;
align-items: stretch;
}
.combined-demo .button-group {
margin-top: 12px;
margin-left: 0 !important;
}
}
.example-container {
max-width: 1200px;
padding: 24px;
margin: 0 auto;
}
h1 {
margin-bottom: 32px;
font-size: 32px;
font-weight: bold;
color: #303133;
}
.section {
margin-bottom: 48px;
}
.section h2 {
padding-bottom: 8px;
margin-bottom: 24px;
font-size: 24px;
font-weight: 600;
color: #409eff;
border-bottom: 2px solid #409eff;
}
.demo-block {
padding: 24px;
margin-bottom: 32px;
background: #f5f7fa;
border-radius: 8px;
}
.demo-block h3 {
margin-bottom: 16px;
font-size: 16px;
font-weight: 600;
color: #606266;
}
.button-group {
display: flex;
flex-wrap: wrap;
gap: 12px;
align-items: center;
}
.size-group {
display: flex;
flex-direction: column;
gap: 12px;
}
.hint {
margin-top: 12px;
font-size: 14px;
color: #909399;
}
.combined-demo {
display: flex;
gap: 12px;
align-items: center;
}
</style>
{
"name": "@venus/common-ui-vue",
"version": "1.0.0",
"description": "Venus Pro Common UI Components - Element Plus wrapper",
"homepage": "https://github.com/venusjs/vue-venus-admin",
"bugs": "https://github.com/venusjs/vue-venus-admin/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/venusjs/vue-venus-admin.git",
"directory": "packages/vui/vue-ui"
},
"license": "MIT",
"type": "module",
"scripts": {
"build": "pnpm unbuild",
"stub": "pnpm unbuild --stub"
},
"files": [
"dist",
"src"
],
"sideEffects": [
"**/*.css",
"**/*.scss",
"**/*.vue"
],
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
}
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
}
},
"peerDependencies": {
"@element-plus/icons-vue": ">=2.0.0",
"element-plus": ">=2.0.0",
"vue": ">=3.3.0"
},
"dependencies": {
"@element-plus/icons-vue": "catalog:",
"@vueuse/core": "catalog:",
"element-plus": "catalog:",
"vue": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"typescript": "catalog:",
"unbuild": "catalog:"
}
}
<template>
<!--
二次封装:
- 默认类型设为 primary
- 支持 block(全宽)
- 统一样式类 v-btn
-->
<ElButton class="v-btn"
:class="[{ 'v-btn--block': !!$props.block }]"
:type="$props.type ?? 'primary'"
v-bind="$attrs"
@click="handleClick">
<slot />
</ElButton>
</template>
<script setup lang="ts">
import { ElButton } from "element-plus";
defineOptions({
name: "VButton",
});
defineProps<{
block?: boolean;
circle?: boolean;
disabled?: boolean;
loading?: boolean;
plain?: boolean;
round?: boolean;
size?: "default" | "large" | "small";
type?: "danger" | "default" | "info" | "primary" | "success" | "warning";
}>();
const emit = defineEmits([ "click" ]);
function handleClick(e: MouseEvent) {
emit("click", e);
}
</script>
<style scoped>
.v-btn {
--v-primary: #3b82f6;
}
.v-btn--block {
display: block;
width: 100%;
}
</style>
<template>
<!--
二次封装:
- 统一样式类 v-input
- 支持 block(全宽)
-->
<ElInput class="v-input"
:class="[{ 'v-input--block': !!props.block }]"
:clearable="props.clearable"
:disabled="props.disabled"
:model-value="props.modelValue"
:placeholder="props.placeholder"
:type="props.type"
v-bind="$attrs"
@update:model-value="emit('update:modelValue', $event)">
<template #prepend>
<slot name="prepend" />
</template>
<template #append>
<slot name="append" />
</template>
<template #prefix>
<slot name="prefix" />
</template>
<template #suffix>
<slot name="suffix" />
</template>
</ElInput>
</template>
<script setup lang="ts">
import { ElInput } from "element-plus";
defineOptions({
name: "VInput",
});
const props = defineProps<{
block?: boolean;
clearable?: boolean;
disabled?: boolean;
modelValue?: number | string;
placeholder?: string;
type?: string;
}>();
const emit = defineEmits([ "update:modelValue" ]);
</script>
<style scoped>
.v-input {
/* 可以在此定制输入框的默认样式 */
}
.v-input--block {
display: block;
}
</style>
export { default, default as GLButton } from "./index.vue";
<script setup lang="ts">
defineOptions({
name: "GLButton",
});
</script>
<template>
<ElButton v-bind="$attrs">
<template v-for="(_, name) in $slots"
:key="name"
#[name]="slotData">
<slot :name="name" v-bind="{ ...slotData }"></slot>
</template>
</ElButton>
</template>
export { default, default as GLEllipsis } from "./index.vue";
<template>
<ElTooltip v-if="showTooltip"
:content="content"
:placement="placement">
<span class="gl-ellipsis">{{ truncatedContent }}</span>
</ElTooltip>
<span v-else class="gl-ellipsis">{{ truncatedContent }}</span>
</template>
<script lang="ts">
import { ElTooltip } from "element-plus";
export default {
name: "GLEllipsis",
components: { ElTooltip },
props: {
content: { type: String, default: "" },
length: { type: Number, default: 20 },
tooltip: { type: Boolean, default: true },
placement: { type: String, default: "top" },
},
computed: {
truncatedContent(): string {
const content = this.$props.content;
const length = this.$props.length;
if (!content) return "";
return content.length <= length ? content : `${content.slice(0, length)}...`;
},
showTooltip(): boolean {
return Boolean(this.tooltip) && typeof this.content === "string" && this.content.length > this.length;
},
},
};
</script>
<style scoped>
.gl-ellipsis {
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
export { default, default as GLIcon } from "./index.vue";
<template>
<ElIcon v-bind="$attrs">
<template v-for="(_, name) in $slots"
:key="name"
#[name]="slotData">
<slot :name="name" v-bind="{ ...slotData }" />
</template>
</ElIcon>
</template>
<script setup lang="ts">
import { ElIcon } from "element-plus";
defineOptions({
name: "GLIcon",
});
</script>
export { GLButton } from "./button";
export { GLInput } from "./input";
export { default as VButton } from "./VButton.vue";
export { default as VInput } from "./VInput.vue";
export { default, default as GLInput } from "./index.vue";
<script setup lang="ts">
defineOptions({
name: "GLInput",
});
</script>
<template>
<ElInput v-bind="$attrs" class="gl-input">
<template v-for="(_, name) in $slots"
:key="name"
#[name]="slotData">
<slot :name="name" v-bind="{ ...slotData }"></slot>
</template>
</ElInput>
</template>
<style scoped lang="scss">
:deep(.gl-input) {
.el-input__wrapper {
padding: 0;
background: transparent !important;
border: none !important;
box-shadow: none !important;
&:hover {
border: none !important;
box-shadow: none !important;
}
&.is-focus {
border: none !important;
box-shadow: none !important;
}
&.is-disabled {
border: none !important;
box-shadow: none !important;
}
}
.el-input__inner {
outline: none !important;
background: transparent !important;
border: none !important;
box-shadow: none !important;
&:focus {
outline: none !important;
border: none !important;
box-shadow: none !important;
}
}
}
</style>
export { default, default as GLLink } from "./index.vue";
<template>
<ElLink v-bind="$attrs">
<template v-for="(_, name) in $slots"
:key="name"
#[name]="slotData">
<slot :name="name" v-bind="{ ...slotData }" />
</template>
</ElLink>
</template>
<script setup lang="ts">
import { ElLink } from "element-plus";
defineOptions({
name: "GLLink",
});
</script>
export { default, default as GLScrollbar } from "./index.vue";
<template>
<ElScrollbar v-bind="$attrs">
<template v-for="(_, name) in $slots"
:key="name"
#[name]="slotData">
<slot :name="name" v-bind="{ ...slotData }" />
</template>
</ElScrollbar>
</template>
<script setup lang="ts">
import { ElScrollbar } from "element-plus";
defineOptions({
name: "GLScrollbar",
});
</script>
export { default, default as VSearchBox } from "./index.vue";
<template>
<div class="v-search-box">
<ElInput v-model="inputValue"
class="v-search-box__input"
:clearable="clearable"
:disabled="disabled"
:maxlength="maxlength"
:placeholder="placeholder"
:prefix-icon="prefixIcon || Search"
:size="size"
@clear="handleClear"
@keyup.enter="handleKeyEnter">
<template v-if="showSearchButton" #append>
<el-button :disabled="disabled"
:icon="Search"
:size="size"
@click="() => handleSearch()">
{{ searchButtonText }}
</el-button>
</template>
<!-- 透传所有插槽 -->
<template v-for="(_, name) in $slots" #[name]="slotProps">
<slot :name="name" v-bind="slotProps || {}"></slot>
</template>
</ElInput>
</div>
</template>
<script setup lang="ts">
import type { VSearchBoxEmits, VSearchBoxProps } from "../../types";
import { computed } from "vue";
import { Search } from "@element-plus/icons-vue";
import { useDebounceFn } from "@vueuse/core";
import { ElInput } from "element-plus";
/**
* VSearchBox - 搜索框组件
* 基于 Element Plus ElInput 的二次封装
* 提供防抖搜索、清空、回车搜索等功能
*/
defineOptions({
name: "VSearchBox",
});
const props = withDefaults(defineProps<VSearchBoxProps>(), {
modelValue: "",
placeholder: "请输入搜索内容",
clearable: true,
debounce: 300,
showSearchButton: true,
searchButtonText: "搜索",
size: "default",
disabled: false,
prefixIcon: undefined,
});
const emit = defineEmits<VSearchBoxEmits>();
// 计算输入框的值
const inputValue = computed({
get: () => props.modelValue,
set: (value: string) => {
emit("update:modelValue", value);
emit("input", value);
// 触发防抖搜索
if (props.debounce > 0) {
debouncedSearch(value);
}
},
});
// 处理搜索
const handleSearch = (value?: string) => {
const searchValue = value ?? inputValue.value;
emit("search", searchValue);
};
// 防抖搜索
const debouncedSearch = useDebounceFn((value: string) => {
emit("search", value);
}, props.debounce);
// 处理清空
const handleClear = () => {
emit("clear");
emit("search", "");
};
// 处理回车
const handleKeyEnter = () => {
handleSearch();
};
</script>
<style scoped>
.v-search-box {
display: inline-block;
width: 100%;
}
.v-search-box__input {
width: 100%;
}
/* 搜索按钮样式优化 */
:deep(.el-input-group__append) {
padding: 0;
color: #fff;
background-color: var(--el-color-primary);
border-color: var(--el-color-primary);
}
:deep(.el-input-group__append .el-button) {
margin: 0;
color: inherit;
background-color: transparent;
border: none;
}
:deep(.el-input-group__append .el-button:hover) {
background-color: rgb(255 255 255 / 10%);
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!