@morya-ui/mcp 0.3.4 → 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 -0
- package/README.md +154 -151
- package/bin/morya-ui-mcp.js +2 -2
- package/data/catalog.json +40 -40
- 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 -166
- package/data/golden-pages/list-page-rail.vue +272 -270
- package/data/golden-pages/list-page.vue +222 -220
- 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 +42 -5
- package/dist/__tests__/tools.test.js +49 -29
- package/dist/decisions.d.ts +2 -0
- package/dist/decisions.js +34 -6
- package/dist/golden-pages.d.ts +6 -1
- package/dist/golden-pages.js +34 -33
- package/dist/index.js +52 -9
- package/dist/page-snippets.js +1041 -280
- package/dist/patterns.d.ts +4 -2
- package/dist/patterns.js +35 -6
- package/dist/reference-brief.d.ts +55 -0
- package/dist/reference-brief.js +468 -0
- package/dist/style-presets.d.ts +13 -32
- package/dist/style-presets.js +100 -291
- package/dist/style-shells.d.ts +20 -0
- package/dist/style-shells.js +249 -0
- package/dist/tools.d.ts +21 -3
- package/dist/tools.js +496 -424
- package/package.json +11 -13
package/dist/patterns.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface PagePattern {
|
|
|
12
12
|
descriptionEn: string;
|
|
13
13
|
keywords: string[];
|
|
14
14
|
goldenPage?: string;
|
|
15
|
+
/** Composition-first: prefer these page-snippet ids over cloning the golden page. */
|
|
16
|
+
suggestedSnippets?: string[];
|
|
15
17
|
components: PatternComponent[];
|
|
16
18
|
structure: string[];
|
|
17
19
|
layout: Record<string, string>;
|
|
@@ -51,8 +53,8 @@ export declare const designRules: {
|
|
|
51
53
|
readonly motion: "--m-motion-fast/normal/enter/exit/distance/ease; intensity via useMotion (data-m-motion); enter/exit via motion.transitions / transition prop (fade, scale-fade, zoom, slide-*, dialog, drawer, …)";
|
|
52
54
|
};
|
|
53
55
|
readonly composition: {
|
|
54
|
-
readonly workflow: readonly ["Resolve style first: reference →
|
|
55
|
-
readonly snippets: readonly ["list-filters", "list-toolbar", "list-table", "list-row-actions", "form-header", "form-body", "form-actions", "dashboard-kpi-grid", "dashboard-chart-card", "layout-app-shell", "scrollable-panel"];
|
|
56
|
+
readonly workflow: readonly ["Resolve style first: user reference/description → prompt cues → ask when uncertain (get_style_direction; no preset catalog).", "For full pages: recommend_page({ style? }) → suggestedSnippets / get_page_snippet → optional get_golden_page → apply styleDirection.", "Craft: visual-craft Ops polish or Express design plan; optional frontend-design / impeccable only after contract (companions never replace M*).", "For local edits: get_page_snippet(section) — list filters prefer list-filters-stack; also toolbar/form-actions/KPI/scrollable-panel.", "Use MLayout fillViewport as the app shell; put MPageContent inside MLayoutContent.", "Prefer MPage* components over scoped CSS for filters, toolbars, headers, form surfaces, and KPI cards.", "Use MSpace or MFlex for control groups inside MPageFilters; default filter composition is list-filters-stack.", "Golden pages lock structure/API, not the only aesthetic — do not emit identical quiet chrome every time."];
|
|
57
|
+
readonly snippets: readonly ["list-filters-stack", "list-filters", "list-filters-dense", "list-filter-chips", "list-toolbar", "list-table", "list-row-actions", "form-header", "form-body", "form-actions", "dashboard-kpi-grid", "dashboard-chart-card", "layout-app-shell", "scrollable-panel"];
|
|
56
58
|
readonly pageStack: {
|
|
57
59
|
readonly list: readonly ["MLayout", "MLayoutHeader", "MLayoutContent", "MPageContent", "MPageFilters", "MPageToolbar", "MTable"];
|
|
58
60
|
readonly form: readonly ["MLayout", "MLayoutHeader", "MLayoutContent", "MPageContent", "MPageHeader", "MPageSection", "MForm"];
|
package/dist/patterns.js
CHANGED
|
@@ -6,6 +6,16 @@ export const pagePatterns = [
|
|
|
6
6
|
description: '用于资源管理、设备管理、用户管理等带筛选和行操作的数据列表。',
|
|
7
7
|
descriptionEn: 'A resource-management list with filters, actions, row operations, and pagination.',
|
|
8
8
|
goldenPage: 'list-page',
|
|
9
|
+
suggestedSnippets: [
|
|
10
|
+
'layout-app-shell',
|
|
11
|
+
'page-header-actions',
|
|
12
|
+
'list-filters-stack',
|
|
13
|
+
'list-table',
|
|
14
|
+
'list-status-dot',
|
|
15
|
+
'empty-block',
|
|
16
|
+
'form-in-dialog',
|
|
17
|
+
'confirm-delete',
|
|
18
|
+
],
|
|
9
19
|
keywords: [
|
|
10
20
|
'列表',
|
|
11
21
|
'表格',
|
|
@@ -94,6 +104,7 @@ export const pagePatterns = [
|
|
|
94
104
|
description: '用于创建或编辑业务对象,包含分组字段、校验和提交状态。',
|
|
95
105
|
descriptionEn: 'A create or edit page with grouped fields, validation, and submit states.',
|
|
96
106
|
goldenPage: 'form-page',
|
|
107
|
+
suggestedSnippets: ['page-content-form', 'form-header', 'form-body', 'form-actions'],
|
|
97
108
|
keywords: ['表单', '新增', '编辑', '创建', '配置', '设置', 'form', 'create', 'edit', 'settings'],
|
|
98
109
|
components: [
|
|
99
110
|
{ component: 'ConfigProvider', role: '应用根包裹' },
|
|
@@ -155,6 +166,7 @@ export const pagePatterns = [
|
|
|
155
166
|
description: '从列表触发的短表单 CRUD:留在列表页,用 MDialog 承载 MForm。',
|
|
156
167
|
descriptionEn: 'Short CRUD forms launched from a list: keep the list page and host MForm in MDialog.',
|
|
157
168
|
keywords: ['弹窗表单', '新建弹窗', '编辑弹窗', '列表新建', 'dialog form', 'modal form', 'inline create', 'inline edit'],
|
|
169
|
+
suggestedSnippets: ['form-in-dialog', 'page-header-actions', 'list-table'],
|
|
158
170
|
components: [
|
|
159
171
|
{ component: 'Dialog', role: '承载短表单' },
|
|
160
172
|
{ component: 'Form', role: '声明式校验' },
|
|
@@ -195,6 +207,13 @@ export const pagePatterns = [
|
|
|
195
207
|
description: '用于展示关键指标、趋势、告警和需要优先处理的业务信息。',
|
|
196
208
|
descriptionEn: 'A workspace for KPIs, trends, alerts, and prioritized operational information.',
|
|
197
209
|
keywords: ['仪表盘', '工作台', '监控', '指标', '趋势', '告警', 'dashboard', 'monitoring', 'kpi', 'analytics'],
|
|
210
|
+
suggestedSnippets: [
|
|
211
|
+
'layout-app-shell',
|
|
212
|
+
'page-header-actions',
|
|
213
|
+
'dashboard-kpi-grid',
|
|
214
|
+
'dashboard-chart-card',
|
|
215
|
+
'dashboard-recent-table',
|
|
216
|
+
],
|
|
198
217
|
components: [
|
|
199
218
|
{ component: 'ConfigProvider', role: '应用根包裹' },
|
|
200
219
|
{ component: 'Layout', role: '页面骨架' },
|
|
@@ -262,6 +281,7 @@ export const pagePatterns = [
|
|
|
262
281
|
interactionRules: ['显示未保存修改状态', '保存成功使用 message.success 单行反馈;仅有 summary+detail 时用 toast', '保存失败保留输入并显示字段或页面级错误', '切换 Tab 不应意外丢失未保存输入'],
|
|
263
282
|
avoid: ['不要把所有设置塞进一个超长表单', '不要用 placeholder 代替配置项 label', '不要隐藏影响范围较大的配置说明'],
|
|
264
283
|
goldenPage: 'settings-page',
|
|
284
|
+
suggestedSnippets: ['page-content-form', 'form-header', 'form-body', 'form-actions'],
|
|
265
285
|
},
|
|
266
286
|
{
|
|
267
287
|
id: 'empty-state',
|
|
@@ -270,6 +290,7 @@ export const pagePatterns = [
|
|
|
270
290
|
description: '用于首次使用、搜索无结果、资源已清空或暂时没有内容的场景。',
|
|
271
291
|
descriptionEn: 'For first use, no search results, empty resources, or temporarily unavailable content.',
|
|
272
292
|
goldenPage: 'empty-state',
|
|
293
|
+
suggestedSnippets: ['empty-block'],
|
|
273
294
|
keywords: ['空状态', '无数据', '无结果', '首次使用', 'empty', 'no results', 'no data', 'zero state'],
|
|
274
295
|
components: [
|
|
275
296
|
{ component: 'PageContent', role: '承载空态的内容区', required: false },
|
|
@@ -300,6 +321,7 @@ export const pagePatterns = [
|
|
|
300
321
|
description: '用于登录、注册、找回密码和二次认证流程。',
|
|
301
322
|
descriptionEn: 'For login, registration, password recovery, and second-factor authentication flows.',
|
|
302
323
|
goldenPage: 'login-page',
|
|
324
|
+
suggestedSnippets: ['auth-split-shell'],
|
|
303
325
|
keywords: ['登录', '注册', '认证', '密码', '验证码', 'login', 'register', 'authentication', 'password', 'otp'],
|
|
304
326
|
components: [
|
|
305
327
|
{ component: 'ConfigProvider', role: '应用根包裹' },
|
|
@@ -332,6 +354,7 @@ export const pagePatterns = [
|
|
|
332
354
|
description: '用于产品官网、发布页、定价前导等公开营销表面;首屏单一任务,控件仍用 morya-ui。',
|
|
333
355
|
descriptionEn: 'Public marketing surfaces (product home, launch, pre-pricing). One job in the first viewport; controls still use morya-ui.',
|
|
334
356
|
goldenPage: 'landing-page',
|
|
357
|
+
suggestedSnippets: [],
|
|
335
358
|
keywords: [
|
|
336
359
|
'落地页',
|
|
337
360
|
'营销',
|
|
@@ -365,8 +388,8 @@ export const pagePatterns = [
|
|
|
365
388
|
},
|
|
366
389
|
styleRules: [
|
|
367
390
|
'交互控件使用 MButton / MTag / MAccordion 等',
|
|
368
|
-
'颜色与间距使用 --m
|
|
369
|
-
'
|
|
391
|
+
'颜色与间距使用 --m-*;氛围跟已选 style preset(默认扁平/简洁,勿擅自渐变)',
|
|
392
|
+
'未点名 expressive 预设时:禁止紫蓝 aurora、奶油衬线陶土、报纸风、霓虹、毛玻璃默认脸',
|
|
370
393
|
'首屏不要堆统计条、促销胶囊、日程碎片',
|
|
371
394
|
],
|
|
372
395
|
interactionRules: ['CTA 指向明确下一步', 'FAQ 用 Accordion 降低长页噪声', '尊重 prefers-reduced-motion 若加动画'],
|
|
@@ -394,6 +417,7 @@ export const pagePatterns = [
|
|
|
394
417
|
interactionRules: ['进入下一步前只校验当前步骤', '返回上一步保留输入', '完成前展示摘要或确认', '刷新和离开时处理未完成状态'],
|
|
395
418
|
avoid: ['不要把所有字段一次性隐藏在一个超长页面', '不要允许跳过有前置依赖的步骤', '不要让完成按钮在每一步都使用相同文案'],
|
|
396
419
|
goldenPage: 'wizard-form',
|
|
420
|
+
suggestedSnippets: ['wizard-steps', 'form-body', 'result-block'],
|
|
397
421
|
},
|
|
398
422
|
{
|
|
399
423
|
id: 'detail-page',
|
|
@@ -445,6 +469,7 @@ export const pagePatterns = [
|
|
|
445
469
|
'不要让详情页的操作按钮分散在多个无关区域',
|
|
446
470
|
],
|
|
447
471
|
goldenPage: 'detail-page',
|
|
472
|
+
suggestedSnippets: ['detail-toolbar', 'form-in-dialog', 'confirm-delete', 'list-status-dot'],
|
|
448
473
|
},
|
|
449
474
|
{
|
|
450
475
|
id: 'result-page',
|
|
@@ -502,6 +527,7 @@ export const pagePatterns = [
|
|
|
502
527
|
'不要使用已移除的 #extra 插槽;操作用 #footer',
|
|
503
528
|
],
|
|
504
529
|
goldenPage: 'result-page',
|
|
530
|
+
suggestedSnippets: ['result-block'],
|
|
505
531
|
},
|
|
506
532
|
];
|
|
507
533
|
/** Advisory page-writing standards for MCP and human authors — not enforced blockers. */
|
|
@@ -655,17 +681,20 @@ export const designRules = {
|
|
|
655
681
|
},
|
|
656
682
|
composition: {
|
|
657
683
|
workflow: [
|
|
658
|
-
'Resolve style first: reference →
|
|
659
|
-
'For full pages: recommend_page({ style? }) → get_golden_page → apply styleDirection
|
|
684
|
+
'Resolve style first: user reference/description → prompt cues → ask when uncertain (get_style_direction; no preset catalog).',
|
|
685
|
+
'For full pages: recommend_page({ style? }) → suggestedSnippets / get_page_snippet → optional get_golden_page → apply styleDirection.',
|
|
660
686
|
'Craft: visual-craft Ops polish or Express design plan; optional frontend-design / impeccable only after contract (companions never replace M*).',
|
|
661
|
-
'For local edits: get_page_snippet(section)
|
|
687
|
+
'For local edits: get_page_snippet(section) — list filters prefer list-filters-stack; also toolbar/form-actions/KPI/scrollable-panel.',
|
|
662
688
|
'Use MLayout fillViewport as the app shell; put MPageContent inside MLayoutContent.',
|
|
663
689
|
'Prefer MPage* components over scoped CSS for filters, toolbars, headers, form surfaces, and KPI cards.',
|
|
664
|
-
'Use MSpace or MFlex for control groups inside MPageFilters;
|
|
690
|
+
'Use MSpace or MFlex for control groups inside MPageFilters; default filter composition is list-filters-stack.',
|
|
665
691
|
'Golden pages lock structure/API, not the only aesthetic — do not emit identical quiet chrome every time.',
|
|
666
692
|
],
|
|
667
693
|
snippets: [
|
|
694
|
+
'list-filters-stack',
|
|
668
695
|
'list-filters',
|
|
696
|
+
'list-filters-dense',
|
|
697
|
+
'list-filter-chips',
|
|
669
698
|
'list-toolbar',
|
|
670
699
|
'list-table',
|
|
671
700
|
'list-row-actions',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured reference brief → snippet / shell / token mapping for page fidelity.
|
|
3
|
+
* Agents describe what the reference shows; this module returns how to rebuild it with M*.
|
|
4
|
+
*/
|
|
5
|
+
export type BriefSurface = 'ops-list' | 'ops-form' | 'ops-dashboard' | 'ops-detail' | 'ops-settings' | 'account' | 'flow-empty' | 'flow-result' | 'flow-wizard' | 'express' | 'overlay-dialog' | 'overlay-drawer';
|
|
6
|
+
export type BriefDensity = 'default' | 'compact' | 'spacious';
|
|
7
|
+
export interface ReferenceBriefInput {
|
|
8
|
+
/** Free-text description of the reference (screenshot / mock / “like X”). */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Product / page intent. */
|
|
11
|
+
intent?: string;
|
|
12
|
+
surface?: BriefSurface | string;
|
|
13
|
+
density?: BriefDensity | string;
|
|
14
|
+
/** Named blocks visible in the reference (filters, table, kpi, brand-panel, …). */
|
|
15
|
+
requiredBlocks?: string[];
|
|
16
|
+
/** Component ids or export names that must appear (Table, MStatus, …). */
|
|
17
|
+
requiredComponents?: string[];
|
|
18
|
+
/** One primary CTA label if visible in the reference. */
|
|
19
|
+
primaryAction?: string;
|
|
20
|
+
/** Optional free-text style direction (same as recommend_page.style). */
|
|
21
|
+
style?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BriefMappingItem {
|
|
24
|
+
block: string;
|
|
25
|
+
snippetId: string;
|
|
26
|
+
notesZh: string;
|
|
27
|
+
notesEn: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ReferenceBriefResult {
|
|
30
|
+
surface: BriefSurface;
|
|
31
|
+
density: BriefDensity;
|
|
32
|
+
styleSummary: string | null;
|
|
33
|
+
suggestedSnippets: string[];
|
|
34
|
+
suggestedShellId: string | null;
|
|
35
|
+
mapping: BriefMappingItem[];
|
|
36
|
+
tokenRoles: Array<{
|
|
37
|
+
role: string;
|
|
38
|
+
token: string;
|
|
39
|
+
notesZh: string;
|
|
40
|
+
notesEn: string;
|
|
41
|
+
}>;
|
|
42
|
+
craftCuesZh: string[];
|
|
43
|
+
craftCuesEn: string[];
|
|
44
|
+
validationHints: {
|
|
45
|
+
requiredBlocks: string[];
|
|
46
|
+
requiredComponents: string[];
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Map a reference brief to snippets, shell, and validation hints.
|
|
51
|
+
*/
|
|
52
|
+
export declare function mapReferenceBrief(input: ReferenceBriefInput): ReferenceBriefResult;
|
|
53
|
+
/** Detect whether generated code covers a required block (heuristic). */
|
|
54
|
+
export declare function codeCoversBlock(code: string, block: string): boolean;
|
|
55
|
+
export declare function codeCoversComponent(code: string, component: string): boolean;
|