@morya-ui/mcp 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +154 -151
- package/bin/morya-ui-mcp.js +2 -2
- package/data/catalog.json +26 -26
- package/data/example-coverage.json +2 -2
- package/data/golden-pages/dashboard-page.vue +138 -138
- package/data/golden-pages/detail-page.vue +178 -178
- package/data/golden-pages/empty-state.vue +56 -56
- package/data/golden-pages/form-in-dialog.vue +166 -166
- package/data/golden-pages/form-page.vue +107 -107
- package/data/golden-pages/landing-page.vue +358 -358
- package/data/golden-pages/list-page-dense.vue +168 -168
- package/data/golden-pages/list-page-rail.vue +272 -272
- package/data/golden-pages/list-page.vue +222 -222
- package/data/golden-pages/login-page.vue +231 -231
- package/data/golden-pages/result-page.vue +84 -84
- package/data/golden-pages/settings-page.vue +163 -163
- package/data/golden-pages/wizard-form.vue +182 -182
- package/dist/__tests__/fidelity.test.d.ts +1 -0
- package/dist/__tests__/fidelity.test.js +88 -0
- package/dist/__tests__/page-snippets.test.js +13 -5
- package/dist/__tests__/tools.test.js +10 -8
- package/dist/index.js +46 -3
- package/dist/page-snippets.js +722 -635
- package/dist/reference-brief.d.ts +55 -0
- package/dist/reference-brief.js +468 -0
- package/dist/style-shells.d.ts +20 -0
- package/dist/style-shells.js +249 -0
- package/dist/tools.d.ts +26 -0
- package/dist/tools.js +464 -374
- package/package.json +1 -1
|
@@ -1,222 +1,222 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* 黄金样例:列表页(结构母版 · style: soft)
|
|
4
|
-
* structure: list · style: soft
|
|
5
|
-
* 全视口主列表使用 fill;气质变体见 list-page-dense / list-page-rail。
|
|
6
|
-
* 镜像区块顺序;视觉跟 styleDirection / 参考走,不要把 soft 当唯一正确答案。
|
|
7
|
-
* @see DESIGN.md · page-layouts.md · style-presets.md · visual-craft § Ops polish
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
MBreadcrumb,
|
|
11
|
-
MButton,
|
|
12
|
-
MConfigProvider,
|
|
13
|
-
MEmpty,
|
|
14
|
-
MInput,
|
|
15
|
-
MLayout,
|
|
16
|
-
MLayoutContent,
|
|
17
|
-
MLayoutHeader,
|
|
18
|
-
MLayoutSider,
|
|
19
|
-
MMenu,
|
|
20
|
-
MPageContent,
|
|
21
|
-
MPageFilterChips,
|
|
22
|
-
MPageFilters,
|
|
23
|
-
MPageHeader,
|
|
24
|
-
MSelect,
|
|
25
|
-
MSpace,
|
|
26
|
-
MStatus,
|
|
27
|
-
MTable,
|
|
28
|
-
MTag,
|
|
29
|
-
zhCN,
|
|
30
|
-
} from 'morya-ui'
|
|
31
|
-
import { computed, ref } from 'vue'
|
|
32
|
-
|
|
33
|
-
const keyword = ref('')
|
|
34
|
-
const status = ref<string | undefined>()
|
|
35
|
-
const department = ref<string | null>(null)
|
|
36
|
-
const filtersExpanded = ref(false)
|
|
37
|
-
const siderCollapsed = ref(false)
|
|
38
|
-
|
|
39
|
-
const menuModel = [
|
|
40
|
-
{ key: 'users', label: '用户管理', icon: 'user', to: '/users' },
|
|
41
|
-
{ key: 'roles', label: '角色管理', icon: 'shield', to: '/roles' },
|
|
42
|
-
{ key: 'settings', label: '系统设置', icon: 'settings', to: '/settings' },
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
const statusOptions = [
|
|
46
|
-
{ label: '全部', value: '' },
|
|
47
|
-
{ label: '启用', value: 'active' },
|
|
48
|
-
{ label: '停用', value: 'inactive' },
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
const departmentOptions = [
|
|
52
|
-
{ label: '研发', value: '研发' },
|
|
53
|
-
{ label: '运营', value: '运营' },
|
|
54
|
-
{ label: '市场', value: '市场' },
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
-
const activeFilters = computed(() => {
|
|
58
|
-
const items: Array<{ key: string; label: string }> = []
|
|
59
|
-
if (keyword.value.trim()) {
|
|
60
|
-
items.push({ key: 'keyword', label: `关键词:${keyword.value.trim()}` })
|
|
61
|
-
}
|
|
62
|
-
if (status.value) {
|
|
63
|
-
const label = statusOptions.find((o) => o.value === status.value)?.label ?? status.value
|
|
64
|
-
items.push({ key: 'status', label: `状态:${label}` })
|
|
65
|
-
}
|
|
66
|
-
if (department.value) {
|
|
67
|
-
items.push({ key: 'department', label: `部门:${department.value}` })
|
|
68
|
-
}
|
|
69
|
-
return items
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
function clearFilter(key: string) {
|
|
73
|
-
if (key === 'keyword') keyword.value = ''
|
|
74
|
-
if (key === 'status') status.value = undefined
|
|
75
|
-
if (key === 'department') department.value = null
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function resetFilters() {
|
|
79
|
-
keyword.value = ''
|
|
80
|
-
status.value = undefined
|
|
81
|
-
department.value = null
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const columns = [
|
|
85
|
-
{ key: 'name', label: '名称' },
|
|
86
|
-
{ key: 'status', label: '状态', width: 120 },
|
|
87
|
-
{ key: 'updatedAt', label: '更新时间', width: 140 },
|
|
88
|
-
{ key: 'actions', label: '操作', width: 148 },
|
|
89
|
-
]
|
|
90
|
-
|
|
91
|
-
const rows = [
|
|
92
|
-
{ id: '1', name: '示例项目 A', status: 'active', updatedAt: '2026-09-01' },
|
|
93
|
-
{ id: '2', name: '示例项目 B', status: 'inactive', updatedAt: '2026-08-28' },
|
|
94
|
-
{ id: '3', name: '示例项目 C', status: 'active', updatedAt: '2026-08-25' },
|
|
95
|
-
{ id: '4', name: '示例项目 D', status: 'active', updatedAt: '2026-08-20' },
|
|
96
|
-
{ id: '5', name: '示例项目 E', status: 'inactive', updatedAt: '2026-08-15' },
|
|
97
|
-
]
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<template>
|
|
101
|
-
<MConfigProvider :locale="zhCN">
|
|
102
|
-
<MLayout has-sider fill-viewport>
|
|
103
|
-
<MLayoutSider v-model:collapsed="siderCollapsed" bordered :collapsed-width="72">
|
|
104
|
-
<MMenu
|
|
105
|
-
:model="menuModel"
|
|
106
|
-
:collapsed="siderCollapsed"
|
|
107
|
-
:collapsed-width="72"
|
|
108
|
-
selected-key="users"
|
|
109
|
-
/>
|
|
110
|
-
</MLayoutSider>
|
|
111
|
-
|
|
112
|
-
<MLayout>
|
|
113
|
-
<MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
|
|
114
|
-
<MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '用户管理' }]" />
|
|
115
|
-
</MLayoutHeader>
|
|
116
|
-
|
|
117
|
-
<MLayoutContent>
|
|
118
|
-
<MPageContent fill>
|
|
119
|
-
<MPageHeader title="用户管理" description="维护账号、角色与权限。">
|
|
120
|
-
<template #actions>
|
|
121
|
-
<MButton severity="primary">
|
|
122
|
-
新建用户
|
|
123
|
-
</MButton>
|
|
124
|
-
</template>
|
|
125
|
-
</MPageHeader>
|
|
126
|
-
|
|
127
|
-
<MPageFilters
|
|
128
|
-
v-model:expanded="filtersExpanded"
|
|
129
|
-
aria-label="筛选"
|
|
130
|
-
variant="filled"
|
|
131
|
-
collapsible
|
|
132
|
-
>
|
|
133
|
-
<MSpace wrap>
|
|
134
|
-
<MInput v-model="keyword" placeholder="搜索名称" clearable style="width: 14rem" />
|
|
135
|
-
<MSelect
|
|
136
|
-
v-model="status"
|
|
137
|
-
:options="statusOptions"
|
|
138
|
-
placeholder="状态"
|
|
139
|
-
clearable
|
|
140
|
-
style="width: 10rem"
|
|
141
|
-
/>
|
|
142
|
-
</MSpace>
|
|
143
|
-
<template #actions>
|
|
144
|
-
<MButton severity="secondary">
|
|
145
|
-
查询
|
|
146
|
-
</MButton>
|
|
147
|
-
<MButton severity="secondary" text @click="resetFilters">
|
|
148
|
-
重置
|
|
149
|
-
</MButton>
|
|
150
|
-
</template>
|
|
151
|
-
<template #advanced>
|
|
152
|
-
<MSpace wrap>
|
|
153
|
-
<MSelect
|
|
154
|
-
v-model="department"
|
|
155
|
-
:options="departmentOptions"
|
|
156
|
-
placeholder="部门"
|
|
157
|
-
clearable
|
|
158
|
-
style="width: 10rem"
|
|
159
|
-
/>
|
|
160
|
-
</MSpace>
|
|
161
|
-
</template>
|
|
162
|
-
</MPageFilters>
|
|
163
|
-
|
|
164
|
-
<MPageFilterChips v-if="activeFilters.length" label="已选" aria-label="已选筛选">
|
|
165
|
-
<MTag
|
|
166
|
-
v-for="item in activeFilters"
|
|
167
|
-
:key="item.key"
|
|
168
|
-
:value="item.label"
|
|
169
|
-
size="small"
|
|
170
|
-
bordered
|
|
171
|
-
closable
|
|
172
|
-
@close="clearFilter(item.key)"
|
|
173
|
-
/>
|
|
174
|
-
</MPageFilterChips>
|
|
175
|
-
|
|
176
|
-
<MTable
|
|
177
|
-
:columns="columns"
|
|
178
|
-
:rows="rows"
|
|
179
|
-
:rows-per-page="5"
|
|
180
|
-
fill
|
|
181
|
-
paginator
|
|
182
|
-
striped
|
|
183
|
-
bordered
|
|
184
|
-
row-key="id"
|
|
185
|
-
aria-label="用户列表"
|
|
186
|
-
>
|
|
187
|
-
<template #cell-status="{ value }">
|
|
188
|
-
<MStatus
|
|
189
|
-
:label="value === 'active' ? '启用' : '停用'"
|
|
190
|
-
:severity="value === 'active' ? 'success' : 'secondary'"
|
|
191
|
-
/>
|
|
192
|
-
</template>
|
|
193
|
-
<template #cell-actions>
|
|
194
|
-
<MSpace>
|
|
195
|
-
<MButton severity="secondary" size="small" text>
|
|
196
|
-
编辑
|
|
197
|
-
</MButton>
|
|
198
|
-
<MButton severity="danger" size="small" text>
|
|
199
|
-
删除
|
|
200
|
-
</MButton>
|
|
201
|
-
</MSpace>
|
|
202
|
-
</template>
|
|
203
|
-
<template #empty>
|
|
204
|
-
<MEmpty
|
|
205
|
-
title="还没有用户"
|
|
206
|
-
description="创建第一个用户后,即可分配角色与权限。"
|
|
207
|
-
icon="user"
|
|
208
|
-
>
|
|
209
|
-
<template #extra>
|
|
210
|
-
<MButton severity="primary">
|
|
211
|
-
新建用户
|
|
212
|
-
</MButton>
|
|
213
|
-
</template>
|
|
214
|
-
</MEmpty>
|
|
215
|
-
</template>
|
|
216
|
-
</MTable>
|
|
217
|
-
</MPageContent>
|
|
218
|
-
</MLayoutContent>
|
|
219
|
-
</MLayout>
|
|
220
|
-
</MLayout>
|
|
221
|
-
</MConfigProvider>
|
|
222
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 黄金样例:列表页(结构母版 · style: soft)
|
|
4
|
+
* structure: list · style: soft
|
|
5
|
+
* 全视口主列表使用 fill;气质变体见 list-page-dense / list-page-rail。
|
|
6
|
+
* 镜像区块顺序;视觉跟 styleDirection / 参考走,不要把 soft 当唯一正确答案。
|
|
7
|
+
* @see DESIGN.md · page-layouts.md · style-presets.md · visual-craft § Ops polish
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
MBreadcrumb,
|
|
11
|
+
MButton,
|
|
12
|
+
MConfigProvider,
|
|
13
|
+
MEmpty,
|
|
14
|
+
MInput,
|
|
15
|
+
MLayout,
|
|
16
|
+
MLayoutContent,
|
|
17
|
+
MLayoutHeader,
|
|
18
|
+
MLayoutSider,
|
|
19
|
+
MMenu,
|
|
20
|
+
MPageContent,
|
|
21
|
+
MPageFilterChips,
|
|
22
|
+
MPageFilters,
|
|
23
|
+
MPageHeader,
|
|
24
|
+
MSelect,
|
|
25
|
+
MSpace,
|
|
26
|
+
MStatus,
|
|
27
|
+
MTable,
|
|
28
|
+
MTag,
|
|
29
|
+
zhCN,
|
|
30
|
+
} from 'morya-ui'
|
|
31
|
+
import { computed, ref } from 'vue'
|
|
32
|
+
|
|
33
|
+
const keyword = ref('')
|
|
34
|
+
const status = ref<string | undefined>()
|
|
35
|
+
const department = ref<string | null>(null)
|
|
36
|
+
const filtersExpanded = ref(false)
|
|
37
|
+
const siderCollapsed = ref(false)
|
|
38
|
+
|
|
39
|
+
const menuModel = [
|
|
40
|
+
{ key: 'users', label: '用户管理', icon: 'user', to: '/users' },
|
|
41
|
+
{ key: 'roles', label: '角色管理', icon: 'shield', to: '/roles' },
|
|
42
|
+
{ key: 'settings', label: '系统设置', icon: 'settings', to: '/settings' },
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const statusOptions = [
|
|
46
|
+
{ label: '全部', value: '' },
|
|
47
|
+
{ label: '启用', value: 'active' },
|
|
48
|
+
{ label: '停用', value: 'inactive' },
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
const departmentOptions = [
|
|
52
|
+
{ label: '研发', value: '研发' },
|
|
53
|
+
{ label: '运营', value: '运营' },
|
|
54
|
+
{ label: '市场', value: '市场' },
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
const activeFilters = computed(() => {
|
|
58
|
+
const items: Array<{ key: string; label: string }> = []
|
|
59
|
+
if (keyword.value.trim()) {
|
|
60
|
+
items.push({ key: 'keyword', label: `关键词:${keyword.value.trim()}` })
|
|
61
|
+
}
|
|
62
|
+
if (status.value) {
|
|
63
|
+
const label = statusOptions.find((o) => o.value === status.value)?.label ?? status.value
|
|
64
|
+
items.push({ key: 'status', label: `状态:${label}` })
|
|
65
|
+
}
|
|
66
|
+
if (department.value) {
|
|
67
|
+
items.push({ key: 'department', label: `部门:${department.value}` })
|
|
68
|
+
}
|
|
69
|
+
return items
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
function clearFilter(key: string) {
|
|
73
|
+
if (key === 'keyword') keyword.value = ''
|
|
74
|
+
if (key === 'status') status.value = undefined
|
|
75
|
+
if (key === 'department') department.value = null
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function resetFilters() {
|
|
79
|
+
keyword.value = ''
|
|
80
|
+
status.value = undefined
|
|
81
|
+
department.value = null
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const columns = [
|
|
85
|
+
{ key: 'name', label: '名称' },
|
|
86
|
+
{ key: 'status', label: '状态', width: 120 },
|
|
87
|
+
{ key: 'updatedAt', label: '更新时间', width: 140 },
|
|
88
|
+
{ key: 'actions', label: '操作', width: 148 },
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
const rows = [
|
|
92
|
+
{ id: '1', name: '示例项目 A', status: 'active', updatedAt: '2026-09-01' },
|
|
93
|
+
{ id: '2', name: '示例项目 B', status: 'inactive', updatedAt: '2026-08-28' },
|
|
94
|
+
{ id: '3', name: '示例项目 C', status: 'active', updatedAt: '2026-08-25' },
|
|
95
|
+
{ id: '4', name: '示例项目 D', status: 'active', updatedAt: '2026-08-20' },
|
|
96
|
+
{ id: '5', name: '示例项目 E', status: 'inactive', updatedAt: '2026-08-15' },
|
|
97
|
+
]
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<template>
|
|
101
|
+
<MConfigProvider :locale="zhCN">
|
|
102
|
+
<MLayout has-sider fill-viewport>
|
|
103
|
+
<MLayoutSider v-model:collapsed="siderCollapsed" bordered :collapsed-width="72">
|
|
104
|
+
<MMenu
|
|
105
|
+
:model="menuModel"
|
|
106
|
+
:collapsed="siderCollapsed"
|
|
107
|
+
:collapsed-width="72"
|
|
108
|
+
selected-key="users"
|
|
109
|
+
/>
|
|
110
|
+
</MLayoutSider>
|
|
111
|
+
|
|
112
|
+
<MLayout>
|
|
113
|
+
<MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
|
|
114
|
+
<MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '用户管理' }]" />
|
|
115
|
+
</MLayoutHeader>
|
|
116
|
+
|
|
117
|
+
<MLayoutContent>
|
|
118
|
+
<MPageContent fill>
|
|
119
|
+
<MPageHeader title="用户管理" description="维护账号、角色与权限。">
|
|
120
|
+
<template #actions>
|
|
121
|
+
<MButton severity="primary">
|
|
122
|
+
新建用户
|
|
123
|
+
</MButton>
|
|
124
|
+
</template>
|
|
125
|
+
</MPageHeader>
|
|
126
|
+
|
|
127
|
+
<MPageFilters
|
|
128
|
+
v-model:expanded="filtersExpanded"
|
|
129
|
+
aria-label="筛选"
|
|
130
|
+
variant="filled"
|
|
131
|
+
collapsible
|
|
132
|
+
>
|
|
133
|
+
<MSpace wrap>
|
|
134
|
+
<MInput v-model="keyword" placeholder="搜索名称" clearable style="width: 14rem" />
|
|
135
|
+
<MSelect
|
|
136
|
+
v-model="status"
|
|
137
|
+
:options="statusOptions"
|
|
138
|
+
placeholder="状态"
|
|
139
|
+
clearable
|
|
140
|
+
style="width: 10rem"
|
|
141
|
+
/>
|
|
142
|
+
</MSpace>
|
|
143
|
+
<template #actions>
|
|
144
|
+
<MButton severity="secondary">
|
|
145
|
+
查询
|
|
146
|
+
</MButton>
|
|
147
|
+
<MButton severity="secondary" text @click="resetFilters">
|
|
148
|
+
重置
|
|
149
|
+
</MButton>
|
|
150
|
+
</template>
|
|
151
|
+
<template #advanced>
|
|
152
|
+
<MSpace wrap>
|
|
153
|
+
<MSelect
|
|
154
|
+
v-model="department"
|
|
155
|
+
:options="departmentOptions"
|
|
156
|
+
placeholder="部门"
|
|
157
|
+
clearable
|
|
158
|
+
style="width: 10rem"
|
|
159
|
+
/>
|
|
160
|
+
</MSpace>
|
|
161
|
+
</template>
|
|
162
|
+
</MPageFilters>
|
|
163
|
+
|
|
164
|
+
<MPageFilterChips v-if="activeFilters.length" label="已选" aria-label="已选筛选">
|
|
165
|
+
<MTag
|
|
166
|
+
v-for="item in activeFilters"
|
|
167
|
+
:key="item.key"
|
|
168
|
+
:value="item.label"
|
|
169
|
+
size="small"
|
|
170
|
+
bordered
|
|
171
|
+
closable
|
|
172
|
+
@close="clearFilter(item.key)"
|
|
173
|
+
/>
|
|
174
|
+
</MPageFilterChips>
|
|
175
|
+
|
|
176
|
+
<MTable
|
|
177
|
+
:columns="columns"
|
|
178
|
+
:rows="rows"
|
|
179
|
+
:rows-per-page="5"
|
|
180
|
+
fill
|
|
181
|
+
paginator
|
|
182
|
+
striped
|
|
183
|
+
bordered
|
|
184
|
+
row-key="id"
|
|
185
|
+
aria-label="用户列表"
|
|
186
|
+
>
|
|
187
|
+
<template #cell-status="{ value }">
|
|
188
|
+
<MStatus
|
|
189
|
+
:label="value === 'active' ? '启用' : '停用'"
|
|
190
|
+
:severity="value === 'active' ? 'success' : 'secondary'"
|
|
191
|
+
/>
|
|
192
|
+
</template>
|
|
193
|
+
<template #cell-actions>
|
|
194
|
+
<MSpace>
|
|
195
|
+
<MButton severity="secondary" size="small" text>
|
|
196
|
+
编辑
|
|
197
|
+
</MButton>
|
|
198
|
+
<MButton severity="danger" size="small" text>
|
|
199
|
+
删除
|
|
200
|
+
</MButton>
|
|
201
|
+
</MSpace>
|
|
202
|
+
</template>
|
|
203
|
+
<template #empty>
|
|
204
|
+
<MEmpty
|
|
205
|
+
title="还没有用户"
|
|
206
|
+
description="创建第一个用户后,即可分配角色与权限。"
|
|
207
|
+
icon="user"
|
|
208
|
+
>
|
|
209
|
+
<template #extra>
|
|
210
|
+
<MButton severity="primary">
|
|
211
|
+
新建用户
|
|
212
|
+
</MButton>
|
|
213
|
+
</template>
|
|
214
|
+
</MEmpty>
|
|
215
|
+
</template>
|
|
216
|
+
</MTable>
|
|
217
|
+
</MPageContent>
|
|
218
|
+
</MLayoutContent>
|
|
219
|
+
</MLayout>
|
|
220
|
+
</MLayout>
|
|
221
|
+
</MConfigProvider>
|
|
222
|
+
</template>
|