@morya-ui/mcp 0.3.2 → 0.3.4

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.
@@ -4,10 +4,23 @@ export interface GoldenPageRecord {
4
4
  title: string;
5
5
  titleEn: string;
6
6
  patternId: string;
7
+ /** Visual style preset this sample demonstrates (structure may be shared). */
8
+ style?: string;
9
+ /** Canonical structure id when this is a craft variant. */
10
+ variantOf?: string;
7
11
  }
8
12
  export declare const goldenPageCatalog: GoldenPageRecord[];
9
13
  export declare function listGoldenPages(): GoldenPageRecord[];
10
14
  export declare function findGoldenPage(id: string): GoldenPageRecord | undefined;
15
+ /**
16
+ * Pick the best golden for a pattern + optional style preset.
17
+ * Falls back to the pattern's canonical sample when no style variant exists.
18
+ */
19
+ export declare function resolveGoldenPageId(args: {
20
+ patternId?: string | null;
21
+ canonicalGoldenId?: string | null;
22
+ styleId?: string | null;
23
+ }): string | null;
11
24
  export declare function readGoldenPageSource(id: string): {
12
25
  record: GoldenPageRecord;
13
26
  source: string;
@@ -5,9 +5,28 @@ export const goldenPageCatalog = [
5
5
  {
6
6
  id: 'list-page',
7
7
  file: 'list-page.vue',
8
- title: '列表页黄金样例',
9
- titleEn: 'List page golden sample',
8
+ title: '列表页黄金样例(soft)',
9
+ titleEn: 'List page golden sample (soft)',
10
10
  patternId: 'admin-list',
11
+ style: 'soft',
12
+ },
13
+ {
14
+ id: 'list-page-dense',
15
+ file: 'list-page-dense.vue',
16
+ title: '列表页黄金样例(dense)',
17
+ titleEn: 'List page golden sample (dense)',
18
+ patternId: 'admin-list',
19
+ style: 'dense',
20
+ variantOf: 'list-page',
21
+ },
22
+ {
23
+ id: 'list-page-rail',
24
+ file: 'list-page-rail.vue',
25
+ title: '列表页黄金样例(rail)',
26
+ titleEn: 'List page golden sample (rail)',
27
+ patternId: 'admin-list',
28
+ style: 'rail',
29
+ variantOf: 'list-page',
11
30
  },
12
31
  {
13
32
  id: 'form-page',
@@ -80,6 +99,15 @@ export const goldenPageCatalog = [
80
99
  patternId: 'wizard-form',
81
100
  },
82
101
  ];
102
+ /** Map style preset → list golden craft variant (same structure). */
103
+ const listStyleGolden = {
104
+ soft: 'list-page',
105
+ quiet: 'list-page',
106
+ studio: 'list-page',
107
+ ink: 'list-page',
108
+ dense: 'list-page-dense',
109
+ rail: 'list-page-rail',
110
+ };
83
111
  const pkgRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
84
112
  const bundledDir = join(pkgRoot, 'data/golden-pages');
85
113
  const repoDir = join(pkgRoot, '../../design-kit/docs/golden-pages');
@@ -97,6 +125,31 @@ export function findGoldenPage(id) {
97
125
  const key = id.trim().toLowerCase().replace(/\.vue$/i, '').replace(/[-_\s]/g, '');
98
126
  return goldenPageCatalog.find((item) => item.id.replace(/[-_\s]/g, '') === key);
99
127
  }
128
+ /**
129
+ * Pick the best golden for a pattern + optional style preset.
130
+ * Falls back to the pattern's canonical sample when no style variant exists.
131
+ */
132
+ export function resolveGoldenPageId(args) {
133
+ const style = args.styleId?.trim().toLowerCase() || '';
134
+ const canonical = args.canonicalGoldenId?.split('/').pop()?.replace(/\.vue$/i, '') ||
135
+ (args.patternId
136
+ ? goldenPageCatalog.find((item) => item.patternId === args.patternId && !item.variantOf)?.id
137
+ : null) ||
138
+ null;
139
+ if (args.patternId === 'admin-list' || canonical === 'list-page' || canonical?.startsWith('list-page')) {
140
+ const styled = style ? listStyleGolden[style] : null;
141
+ if (styled && findGoldenPage(styled))
142
+ return styled;
143
+ return 'list-page';
144
+ }
145
+ if (canonical && findGoldenPage(canonical))
146
+ return canonical;
147
+ if (args.patternId) {
148
+ const match = goldenPageCatalog.find((item) => item.patternId === args.patternId && !item.variantOf);
149
+ return match?.id ?? null;
150
+ }
151
+ return null;
152
+ }
100
153
  export function readGoldenPageSource(id) {
101
154
  const record = findGoldenPage(id);
102
155
  if (!record)
package/dist/index.js CHANGED
@@ -86,14 +86,20 @@ register('get_pattern', 'Read the structure, component composition, layout, and
86
86
  pattern: z.string().min(1),
87
87
  mode: z.string().optional(),
88
88
  }, async (args) => handlers.getPattern(args));
89
- register('recommend_page', 'Recommend a page pattern and component composition from product intent. Pass includeScaffold: true for starter Vue code.', {
89
+ register('recommend_page', 'Recommend a page pattern and component composition from product intent. Pass style for a visual preset (quiet/soft/dense/rail/studio/ink). Pass includeScaffold: true for starter Vue code.', {
90
90
  intent: z.string().min(1),
91
91
  pageType: z.string().optional(),
92
92
  features: z.array(z.string()).max(20).optional(),
93
+ style: z.string().optional().describe('Optional visual style preset id or alias, e.g. soft / dense / 柔和留白.'),
93
94
  mode: z.string().optional(),
94
95
  includeScaffold: z.boolean().optional(),
95
96
  }, async (args) => handlers.recommendPage(args));
96
- register('get_design_rules', 'Return design-token, semantic-action, accessibility, and composition rules for generated pages.', { mode: z.string().optional() }, async (args) => handlers.getDesignRules(args));
97
+ register('get_design_rules', 'Return design-token, style presets, semantic-action, accessibility, and composition rules for generated pages.', { mode: z.string().optional() }, async (args) => handlers.getDesignRules(args));
98
+ register('list_style_presets', 'List selectable page visual styles (quiet/soft/dense/rail/studio/ink) and resolution priority (reference → preset → prompt → ask).', { mode: z.string().optional() }, async (args) => handlers.listStylePresets(args));
99
+ register('get_style_preset', 'Read apply/avoid cues for one visual style preset (quiet, soft, dense, rail, studio, ink, or Chinese aliases).', {
100
+ style: z.string().min(1).describe('Style preset id or alias.'),
101
+ mode: z.string().optional(),
102
+ }, async (args) => handlers.getStylePreset(args));
97
103
  register('recommend_component', 'List, read, or recommend component selection guides. Omit query/decision to list; pass decision only to read; pass query to recommend.', {
98
104
  query: z.string().optional(),
99
105
  decision: z.string().optional(),
@@ -102,7 +108,7 @@ register('recommend_component', 'List, read, or recommend component selection gu
102
108
  offset: z.number().int().min(0).optional(),
103
109
  }, async (args) => handlers.recommendComponent(args));
104
110
  register('list_golden_pages', 'List golden page samples for list, form, and dashboard layouts.', { mode: z.string().optional() }, async (args) => handlers.listGoldenPageCatalog(args));
105
- register('get_golden_page', 'Read a golden page Vue source sample (list-page, form-page, dashboard-page, login-page, landing-page, empty-state, detail-page, form-in-dialog, result-page, settings-page, wizard-form).', {
111
+ register('get_golden_page', 'Read a golden page Vue source sample (list-page, list-page-dense, list-page-rail, form-page, dashboard-page, login-page, landing-page, empty-state, detail-page, form-in-dialog, result-page, settings-page, wizard-form). List craft variants: dense/rail when style is dense/rail; soft structure is list-page.', {
106
112
  page: z.string().min(1),
107
113
  mode: z.string().optional(),
108
114
  }, async (args) => handlers.getGoldenPage(args));