@morya-ui/mcp 0.4.1 → 0.4.3
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/data/catalog.json +498 -486
- package/data/example-coverage.json +15 -16
- package/data/golden-pages/dashboard-page.vue +10 -10
- package/data/golden-pages/detail-page.vue +6 -6
- package/data/golden-pages/empty-state.vue +3 -3
- package/data/golden-pages/form-in-dialog.vue +5 -5
- package/data/golden-pages/form-page.vue +2 -2
- package/data/golden-pages/landing-page.vue +4 -4
- package/data/golden-pages/list-page-dense.vue +7 -7
- package/data/golden-pages/list-page-rail.vue +7 -7
- package/data/golden-pages/list-page.vue +7 -7
- package/data/golden-pages/login-page.vue +2 -2
- package/data/golden-pages/result-page.vue +2 -2
- package/data/golden-pages/settings-page.vue +6 -6
- package/data/golden-pages/wizard-form.vue +3 -18
- package/dist/__tests__/tools.test.js +3 -3
- package/dist/decisions.js +17 -14
- package/dist/page-snippets.js +58 -58
- package/dist/patterns.d.ts +5 -5
- package/dist/patterns.js +8 -8
- package/dist/reference-brief.js +3 -3
- package/dist/tools.js +27 -28
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -129,19 +129,19 @@ async function submit() {
|
|
|
129
129
|
</script>`;
|
|
130
130
|
const listContent = ` <MPageHeader :title="title">
|
|
131
131
|
<template #actions>
|
|
132
|
-
<MButton
|
|
132
|
+
<MButton type="primary">${zh ? '新建' : 'Create'}</MButton>
|
|
133
133
|
</template>
|
|
134
134
|
</MPageHeader>
|
|
135
135
|
<MPageFilters variant="filled" :aria-label="${zh ? '筛选' : 'Filters'}">
|
|
136
136
|
<MSpace wrap>
|
|
137
137
|
<MInput v-model="keyword" placeholder="${zh ? '搜索关键词' : 'Search keyword'}" clearable style="width: 14rem" />
|
|
138
|
-
<MButton
|
|
139
|
-
<MButton
|
|
138
|
+
<MButton>${zh ? '查询' : 'Search'}</MButton>
|
|
139
|
+
<MButton>${zh ? '重置' : 'Reset'}</MButton>
|
|
140
140
|
</MSpace>
|
|
141
141
|
</MPageFilters>
|
|
142
142
|
<MTable :columns="columns" :rows="rows" :loading="loading" fill paginator :rows-per-page="10" striped bordered row-key="id">
|
|
143
143
|
<template #cell-status="{ value }">
|
|
144
|
-
<MStatus :label="String(value ?? '')" :
|
|
144
|
+
<MStatus :label="String(value ?? '')" :type="value === 'active' ? 'success' : 'secondary'" />
|
|
145
145
|
</template>
|
|
146
146
|
<template #empty>
|
|
147
147
|
<MEmpty
|
|
@@ -149,7 +149,7 @@ async function submit() {
|
|
|
149
149
|
:description="${zh ? '创建第一条记录开始使用。' : 'Create your first record to get started.'}"
|
|
150
150
|
>
|
|
151
151
|
<template #extra>
|
|
152
|
-
<MButton
|
|
152
|
+
<MButton type="primary">${zh ? '新建' : 'Create'}</MButton>
|
|
153
153
|
</template>
|
|
154
154
|
</MEmpty>
|
|
155
155
|
</template>
|
|
@@ -161,8 +161,8 @@ async function submit() {
|
|
|
161
161
|
<MInput v-model="model.name" fluid />
|
|
162
162
|
</MFormItem>
|
|
163
163
|
<MPageSection variant="actions">
|
|
164
|
-
<MButton
|
|
165
|
-
<MButton
|
|
164
|
+
<MButton html-type="submit" type="primary" :loading="loading">${zh ? '保存' : 'Save'}</MButton>
|
|
165
|
+
<MButton>${zh ? '取消' : 'Cancel'}</MButton>
|
|
166
166
|
</MPageSection>
|
|
167
167
|
</MForm>
|
|
168
168
|
</MPageSection>`;
|
|
@@ -184,9 +184,9 @@ async function submit() {
|
|
|
184
184
|
const detailContent = ` <MPageHeader :title="title" :description="${zh ? '查看资源摘要与属性。' : 'Review summary and properties.'}">
|
|
185
185
|
<template #actions>
|
|
186
186
|
<MSpace>
|
|
187
|
-
<MStatus :label="${zh ? '启用' : 'Active'}"
|
|
188
|
-
<MButton
|
|
189
|
-
<MButton
|
|
187
|
+
<MStatus :label="${zh ? '启用' : 'Active'}" type="success" />
|
|
188
|
+
<MButton type="primary">${zh ? '编辑' : 'Edit'}</MButton>
|
|
189
|
+
<MButton>${zh ? '返回' : 'Back'}</MButton>
|
|
190
190
|
</MSpace>
|
|
191
191
|
</template>
|
|
192
192
|
</MPageHeader>
|
|
@@ -202,7 +202,7 @@ async function submit() {
|
|
|
202
202
|
<MInput v-model="model.name" fluid />
|
|
203
203
|
</MFormItem>
|
|
204
204
|
<MPageSection variant="actions">
|
|
205
|
-
<MButton
|
|
205
|
+
<MButton html-type="submit" type="primary" :loading="loading">${zh ? '保存' : 'Save'}</MButton>
|
|
206
206
|
</MPageSection>
|
|
207
207
|
</MForm>
|
|
208
208
|
</MPageSection>
|
|
@@ -217,8 +217,8 @@ async function submit() {
|
|
|
217
217
|
</MFormItem>
|
|
218
218
|
<MPageSection variant="actions">
|
|
219
219
|
<MSpace>
|
|
220
|
-
<MButton
|
|
221
|
-
<MButton
|
|
220
|
+
<MButton type="text" :disabled="activeStep === 0" @click="activeStep = Math.max(activeStep - 1, 0)">${zh ? '上一步' : 'Back'}</MButton>
|
|
221
|
+
<MButton html-type="submit" type="primary" :loading="loading">${zh ? '下一步' : 'Next'}</MButton>
|
|
222
222
|
</MSpace>
|
|
223
223
|
</MPageSection>
|
|
224
224
|
</MForm>
|
|
@@ -276,7 +276,7 @@ ${content}
|
|
|
276
276
|
<MFormItem label="${zh ? '密码' : 'Password'}" name="password">
|
|
277
277
|
<MInput type="password" fluid />
|
|
278
278
|
</MFormItem>
|
|
279
|
-
<MButton
|
|
279
|
+
<MButton html-type="submit" type="primary" :loading="loading" block>${zh ? '登录' : 'Sign in'}</MButton>
|
|
280
280
|
</MForm>
|
|
281
281
|
</MCard>
|
|
282
282
|
</main>
|
|
@@ -288,7 +288,7 @@ ${content}
|
|
|
288
288
|
<MPageContent>
|
|
289
289
|
<MPageHeader :title="title">
|
|
290
290
|
<template #actions>
|
|
291
|
-
<MButton
|
|
291
|
+
<MButton type="primary" @click="submit">${zh ? '新建' : 'Create'}</MButton>
|
|
292
292
|
</template>
|
|
293
293
|
</MPageHeader>
|
|
294
294
|
<MEmpty
|
|
@@ -297,7 +297,7 @@ ${content}
|
|
|
297
297
|
icon="database"
|
|
298
298
|
>
|
|
299
299
|
<template #extra>
|
|
300
|
-
<MButton
|
|
300
|
+
<MButton type="primary" @click="submit">${zh ? '创建' : 'Create'}</MButton>
|
|
301
301
|
</template>
|
|
302
302
|
</MEmpty>
|
|
303
303
|
</MPageContent>
|
|
@@ -309,7 +309,7 @@ ${content}
|
|
|
309
309
|
<main class="m-generated-page">
|
|
310
310
|
<MCard>
|
|
311
311
|
<p class="m-generated-muted">${zh ? '将此区域替换为页面内容。' : 'Replace this area with page content.'}</p>
|
|
312
|
-
<MTag value="${zh ? '示例' : 'Example'}"
|
|
312
|
+
<MTag value="${zh ? '示例' : 'Example'}" type="info" />
|
|
313
313
|
</MCard>
|
|
314
314
|
</main>
|
|
315
315
|
</MConfigProvider>`;
|
|
@@ -1082,7 +1082,7 @@ export function createToolHandlers(catalog = loadCatalog()) {
|
|
|
1082
1082
|
!(/<MPageContent\b[^>]*\bfill\b/i.test(code) && /<MTable\b[^>]*\bfill\b/i.test(code))) {
|
|
1083
1083
|
push('craft', 'page-sections', 'list-fill-height', '参考建议:若这是全视口后台主列表且表格是页面主任务,可考虑 MPageContent fill + MTable fill(表体滚动、分页贴底)。嵌入表/短页/整页文档滚动则跳过 fill(见 page-scroll-choice / 黄金样例 list-page)。', 'Advisory: for a full-viewport admin list whose main job is one table, consider MPageContent fill + MTable fill so the body scrolls and pagination stays at the page bottom. Skip fill for embedded/short/document-scroll tables (see page-scroll-choice / golden list-page).');
|
|
1084
1084
|
}
|
|
1085
|
-
if (/<MMessage\b[^>]*\
|
|
1085
|
+
if (/<MMessage\b[^>]*\b(?:severity|type)\s*=/i.test(code)) {
|
|
1086
1086
|
push('contract', 'feedback', 'mmessage-as-alert', '契约:<MMessage> 是 message 服务宿主,不是内嵌 Alert。表单常驻错误用字段 errorMessage 或 token 样式的 role="alert"。', 'Contract: <MMessage> is the message service host, not an inline alert. Use field errorMessage or a token-styled role="alert".');
|
|
1087
1087
|
}
|
|
1088
1088
|
if (/toast\.(?:success|info|warn|warning|error)\s*\(\s*['"`][^'"`]+['"`]\s*\)/i.test(code)) {
|
|
@@ -1103,15 +1103,14 @@ export function createToolHandlers(catalog = loadCatalog()) {
|
|
|
1103
1103
|
/>\s*(?:示例|样例|No data|暂无数据|Lorem ipsum)\s*</i.test(code)) {
|
|
1104
1104
|
push('craft', 'craft', 'placeholder-copy', '工艺建议:用领域真实文案,避免「示例 / Name / No data / 暂无数据」。', 'Craft: use domain-real copy — avoid “示例 / Name / No data / 暂无数据”.');
|
|
1105
1105
|
}
|
|
1106
|
-
// Craft: more than one
|
|
1106
|
+
// Craft: more than one solid primary in viewport (heuristic)
|
|
1107
1107
|
{
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
const explicitPrimary = (code.match(
|
|
1108
|
+
const nonPrimaryType = String.raw `type\s*=\s*["'](?:default|dashed|link|text)["']`;
|
|
1109
|
+
const nonSolidVariant = String.raw `variant\s*=\s*["'](?:outlined|dashed|filled|text|link)["']`;
|
|
1110
|
+
const explicitPrimary = (code.match(new RegExp(String.raw `<MButton\b(?![^>]*(?:${nonPrimaryType}|${nonSolidVariant}))[^>]*type\s*=\s*["']primary["']`, 'gi')) || []).length;
|
|
1111
1111
|
if (explicitPrimary > 1) {
|
|
1112
|
-
push('craft', 'craft', 'multiple-primary', '工艺建议:主视口内通常只需一个
|
|
1112
|
+
push('craft', 'craft', 'multiple-primary', '工艺建议:主视口内通常只需一个 type="primary" 实心按钮。', 'Craft: usually only one type="primary" solid button in the main viewport.');
|
|
1113
1113
|
}
|
|
1114
|
-
void primaryFilled;
|
|
1115
1114
|
}
|
|
1116
1115
|
// Craft: icon-only without accessible name
|
|
1117
1116
|
{
|
|
@@ -1220,10 +1219,10 @@ export function createToolHandlers(catalog = loadCatalog()) {
|
|
|
1220
1219
|
},
|
|
1221
1220
|
composition: designRules.composition,
|
|
1222
1221
|
actions: {
|
|
1223
|
-
primary: { component: 'MButton', props: ['
|
|
1224
|
-
secondary: { component: 'MButton', props: ['
|
|
1225
|
-
destructive: { component: 'MButton', props: ['
|
|
1226
|
-
cancel: { component: 'MButton', props: ['
|
|
1222
|
+
primary: { component: 'MButton', props: ['type="primary"'] },
|
|
1223
|
+
secondary: { component: 'MButton', props: ['default', 'type="text" or variant="outlined"'] },
|
|
1224
|
+
destructive: { component: 'MButton', props: ['danger'], requiresConfirmation: true },
|
|
1225
|
+
cancel: { component: 'MButton', props: ['type="text"'] },
|
|
1227
1226
|
},
|
|
1228
1227
|
status: {
|
|
1229
1228
|
preferred: 'MStatus',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morya-ui/mcp",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"description": "MCP server for morya-ui — component docs, examples, and usage guidance for AI coding agents.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/morya-space/morya-ui/tree/main/packages/ui-mcp#readme",
|