@lism-css/mcp 0.3.0 → 0.10.1

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.
@@ -1,134 +1,134 @@
1
1
  [
2
- {
3
- "category": "color",
4
- "description": "セマンティックカラートークン。サイト全体のカラー設計に使用。",
5
- "tokens": [
6
- { "name": "--base", "value": "hsl(224 4% 99%)", "description": "ベース背景色" },
7
- { "name": "--base-2", "value": "hsl(224 8% 95%)", "description": "代替背景色" },
8
- { "name": "--text", "value": "hsl(224 4% 8%)", "description": "基本テキスト色" },
9
- { "name": "--text-2", "value": "hsl(224 6% 32%)", "description": "補助テキスト色" },
10
- { "name": "--divider", "value": "hsl(224 8% 88%)", "description": "区切り線色" },
11
- { "name": "--link", "value": "oklch(50% 0.3 240)", "description": "リンク色" },
12
- { "name": "--brand", "value": "#1e5f8c", "description": "ブランド色" },
13
- { "name": "--accent", "value": "#d94a6a", "description": "アクセント色" }
14
- ]
15
- },
16
- {
17
- "category": "color",
18
- "description": "パレットカラートークン。OKLCHで定義。--L(明度)と--C(彩度)の基準値を調整するとパレット全体の色味を変更可能。",
19
- "tokens": [
20
- { "name": "--red", "value": "oklch(var(--L) var(--C) 20)" },
21
- { "name": "--orange", "value": "oklch(calc(var(--L) + 4%) calc(var(--C) - 0.01) 52)" },
22
- { "name": "--yellow", "value": "oklch(calc(var(--L) + 12%) calc(var(--C) - 0.025) 84)" },
23
- { "name": "--green", "value": "oklch(calc(var(--L) + 4%) calc(var(--C) - 0.02) 152)" },
24
- { "name": "--blue", "value": "oklch(calc(var(--L) - 2%) calc(var(--C) + 0.01) 260)" },
25
- { "name": "--purple", "value": "oklch(calc(var(--L) - 4%) calc(var(--C) + 0.02) 292)" },
26
- { "name": "--pink", "value": "oklch(calc(var(--L) + 2%) calc(var(--C) + 0.02) 348)" },
27
- { "name": "--gray", "value": "oklch(calc(var(--L) - 4%) 0.04 256)" },
28
- { "name": "--black", "value": "#000" },
29
- { "name": "--white", "value": "#fff" },
30
- { "name": "--keycolor", "value": "コンポーネントごとのキーカラー" }
31
- ]
32
- },
33
- {
34
- "category": "spacing",
35
- "description": "スペーシングトークン。padding, margin, gap 等で使用。CSS変数名は --s{値}。フィボナッチ数列ベースのスケーリング。--s-unit(≒8px)を基準とする。",
36
- "tokens": [
37
- { "name": "--s5", "value": "calc(0.5 * var(--s-unit))", "description": "≒ 4px" },
38
- { "name": "--s10", "value": "var(--s-unit)", "description": "≒ 8px" },
39
- { "name": "--s15", "value": "calc(1.5 * var(--s-unit))", "description": "≒ 12px" },
40
- { "name": "--s20", "value": "calc(2 * var(--s-unit))", "description": "≒ 16px" },
41
- { "name": "--s30", "value": "calc(3 * var(--s-unit))", "description": "≒ 24px" },
42
- { "name": "--s40", "value": "calc(5 * var(--s-unit))", "description": "≒ 40px" },
43
- { "name": "--s50", "value": "calc(8 * var(--s-unit))", "description": "≒ 64px" },
44
- { "name": "--s60", "value": "calc(13 * var(--s-unit))", "description": "≒ 104px" },
45
- { "name": "--s70", "value": "calc(21 * var(--s-unit))", "description": "≒ 168px" },
46
- { "name": "--s80", "value": "calc(34 * var(--s-unit))", "description": "≒ 272px" }
47
- ]
48
- },
49
- {
50
- "category": "fontSize",
51
- "description": "フォントサイズトークン。CSS変数名は --fz--{値}。分子8の調和数列(倍音列)ベースのスケーリング。",
52
- "tokens": [
53
- { "name": "--fz--base", "value": "var(--REM)", "description": "本文の基本フォントサイズ(≒ 1rem)" },
54
- { "name": "--fz--5xl", "value": "calc(var(--REM) * 8 / 2)", "description": "最大サイズ(8/2)" },
55
- { "name": "--fz--4xl", "value": "calc(var(--REM) * 8 / 3)", "description": "特大サイズ(8/3)" },
56
- { "name": "--fz--3xl", "value": "calc(var(--REM) * 8 / 4)", "description": "3XLサイズ(8/4)" },
57
- { "name": "--fz--2xl", "value": "calc(var(--REM) * 8 / 5)", "description": "2XLサイズ(8/5)" },
58
- { "name": "--fz--xl", "value": "calc(var(--REM) * 8 / 6)", "description": "XLサイズ(8/6)" },
59
- { "name": "--fz--l", "value": "calc(var(--REM) * 8 / 7)", "description": "Lサイズ(8/7)" },
60
- { "name": "--fz--m", "value": "calc(var(--REM) * 8 / 8)", "description": "Mサイズ(基準)" },
61
- { "name": "--fz--s", "value": "calc(var(--REM) * 8 / 9)", "description": "Sサイズ(8/9)" },
62
- { "name": "--fz--xs", "value": "calc(var(--REM) * 8 / 10)", "description": "XSサイズ(8/10)" },
63
- { "name": "--fz--2xs", "value": "calc(var(--REM) * 8 / 11)", "description": "最小サイズ(8/11)" }
64
- ]
65
- },
66
- {
67
- "category": "lineHeight",
68
- "description": "行間(ハーフレディング)トークン。CSS変数名は --hl--{値}。line-heightは calc(1em + var(--hl) * 2) で算出される。--hl-unit(≒2px)を基準とする。",
69
- "tokens": [
70
- { "name": "--hl--xs", "value": "var(--hl-unit)", "description": "極小の行間(≒ 2px)" },
71
- { "name": "--hl--s", "value": "calc(var(--hl-unit) * 2)", "description": "小さめの行間(≒ 4px)" },
72
- { "name": "--hl--base", "value": "calc(var(--hl-unit) * 3)", "description": "基本の行間(≒ 6px)" },
73
- { "name": "--hl--l", "value": "calc(var(--hl-unit) * 4)", "description": "大きめの行間(≒ 8px)" }
74
- ]
75
- },
76
- {
77
- "category": "letterSpacing",
78
- "description": "文字間隔トークン。CSS変数名は --lts--{値}。",
79
- "tokens": [
80
- { "name": "--lts--base", "value": "normal", "description": "基本の文字間隔" },
81
- { "name": "--lts--s", "value": "-0.05em", "description": "狭めの文字間隔" },
82
- { "name": "--lts--l", "value": "0.05em", "description": "広めの文字間隔" }
83
- ]
84
- },
85
- {
86
- "category": "fontFamily",
87
- "description": "フォントファミリートークン。CSS変数名は --ff--{値}。",
88
- "tokens": [
89
- {
90
- "name": "--ff--base",
91
- "value": "-apple-system, 'BlinkMacSystemFont', 'Hiragino Sans', sans-serif, 'Segoe UI Emoji'",
92
- "description": "基本フォント"
93
- },
94
- { "name": "--ff--accent", "value": "'Garamond', 'Baskerville', 'Times New Roman', serif", "description": "アクセントフォント" },
95
- { "name": "--ff--mono", "value": "ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace", "description": "モノスペースフォント" }
96
- ]
97
- },
98
- {
99
- "category": "radius",
100
- "description": "角丸トークン。CSS変数名は --bdrs--{値}。段階的に値が大きくなる。",
101
- "tokens": [
102
- { "name": "--bdrs--5", "value": "2px", "description": "角丸 step 5" },
103
- { "name": "--bdrs--10", "value": "0.25rem", "description": "角丸 step 10(≒ 4px)" },
104
- { "name": "--bdrs--20", "value": "0.5rem", "description": "角丸 step 20(≒ 8px)" },
105
- { "name": "--bdrs--30", "value": "1rem", "description": "角丸 step 30(≒ 16px)" },
106
- { "name": "--bdrs--40", "value": "1.5rem", "description": "角丸 step 40(≒ 24px)" },
107
- { "name": "--bdrs--50", "value": "2rem", "description": "角丸 step 50(≒ 32px)" },
108
- { "name": "--bdrs--99", "value": "99rem", "description": "完全な丸 (pill)" },
109
- { "name": "--bdrs--inner", "value": "calc(var(--bdrs, 0px) - var(--p, 0px))", "description": "内側の角丸(親要素に合わせる)" }
110
- ]
111
- },
112
- {
113
- "category": "shadow",
114
- "description": "ボックスシャドウトークン。CSS変数名は --bxsh--{値}。--shc(シャドウカラー: hsl(220 4% 8% / 5%))と --shsz--{n}(シャドウサイズ)を組み合わせた --sh--{n} 変数を複合して構成。",
115
- "tokens": [
116
- { "name": "--bxsh--5", "value": "var(--sh--5)", "description": "シャドウ step 5(最も薄い・単一シャドウ)" },
117
- { "name": "--bxsh--10", "value": "var(--sh--5), var(--sh--10)", "description": "シャドウ step 10" },
118
- { "name": "--bxsh--20", "value": "var(--sh--10), var(--sh--20)", "description": "シャドウ step 20" },
119
- { "name": "--bxsh--30", "value": "var(--sh--20), var(--sh--30)", "description": "シャドウ step 30" },
120
- { "name": "--bxsh--40", "value": "var(--sh--30), var(--sh--40)", "description": "シャドウ step 40" },
121
- { "name": "--bxsh--50", "value": "var(--sh--40), var(--sh--50)", "description": "シャドウ step 50(最も濃い)" }
122
- ]
123
- },
124
- {
125
- "category": "zIndex",
126
- "description": "z-index プリセット値。",
127
- "tokens": [
128
- { "name": "-1", "value": "-1" },
129
- { "name": "0", "value": "0" },
130
- { "name": "1", "value": "1" },
131
- { "name": "99", "value": "99" }
132
- ]
133
- }
2
+ {
3
+ "category": "color",
4
+ "description": "セマンティックカラートークン。サイト全体のカラー設計に使用。",
5
+ "tokens": [
6
+ { "name": "--base", "value": "hsl(224 4% 99%)", "description": "ベース背景色" },
7
+ { "name": "--base-2", "value": "hsl(224 8% 95%)", "description": "代替背景色" },
8
+ { "name": "--text", "value": "hsl(224 4% 8%)", "description": "基本テキスト色" },
9
+ { "name": "--text-2", "value": "hsl(224 6% 32%)", "description": "補助テキスト色" },
10
+ { "name": "--divider", "value": "hsl(224 8% 88%)", "description": "区切り線色" },
11
+ { "name": "--link", "value": "oklch(50% 0.3 240)", "description": "リンク色" },
12
+ { "name": "--brand", "value": "#1e5f8c", "description": "ブランド色" },
13
+ { "name": "--accent", "value": "#d94a6a", "description": "アクセント色" }
14
+ ]
15
+ },
16
+ {
17
+ "category": "color",
18
+ "description": "パレットカラートークン。OKLCHで定義。--L(明度)と--C(彩度)の基準値を調整するとパレット全体の色味を変更可能。",
19
+ "tokens": [
20
+ { "name": "--red", "value": "oklch(var(--L) var(--C) 20)" },
21
+ { "name": "--orange", "value": "oklch(calc(var(--L) + 4%) calc(var(--C) - 0.01) 52)" },
22
+ { "name": "--yellow", "value": "oklch(calc(var(--L) + 12%) calc(var(--C) - 0.025) 84)" },
23
+ { "name": "--green", "value": "oklch(calc(var(--L) + 4%) calc(var(--C) - 0.02) 152)" },
24
+ { "name": "--blue", "value": "oklch(calc(var(--L) - 2%) calc(var(--C) + 0.01) 260)" },
25
+ { "name": "--purple", "value": "oklch(calc(var(--L) - 4%) calc(var(--C) + 0.02) 292)" },
26
+ { "name": "--pink", "value": "oklch(calc(var(--L) + 2%) calc(var(--C) + 0.02) 348)" },
27
+ { "name": "--gray", "value": "oklch(calc(var(--L) - 4%) 0.04 256)" },
28
+ { "name": "--black", "value": "#000" },
29
+ { "name": "--white", "value": "#fff" },
30
+ { "name": "--keycolor", "value": "コンポーネントごとのキーカラー" }
31
+ ]
32
+ },
33
+ {
34
+ "category": "spacing",
35
+ "description": "スペーシングトークン。padding, margin, gap 等で使用。CSS変数名は --s{値}。フィボナッチ数列ベースのスケーリング。--s-unit(≒8px)を基準とする。",
36
+ "tokens": [
37
+ { "name": "--s5", "value": "calc(0.5 * var(--s-unit))", "description": "≒ 4px" },
38
+ { "name": "--s10", "value": "var(--s-unit)", "description": "≒ 8px" },
39
+ { "name": "--s15", "value": "calc(1.5 * var(--s-unit))", "description": "≒ 12px" },
40
+ { "name": "--s20", "value": "calc(2 * var(--s-unit))", "description": "≒ 16px" },
41
+ { "name": "--s30", "value": "calc(3 * var(--s-unit))", "description": "≒ 24px" },
42
+ { "name": "--s40", "value": "calc(5 * var(--s-unit))", "description": "≒ 40px" },
43
+ { "name": "--s50", "value": "calc(8 * var(--s-unit))", "description": "≒ 64px" },
44
+ { "name": "--s60", "value": "calc(13 * var(--s-unit))", "description": "≒ 104px" },
45
+ { "name": "--s70", "value": "calc(21 * var(--s-unit))", "description": "≒ 168px" },
46
+ { "name": "--s80", "value": "calc(34 * var(--s-unit))", "description": "≒ 272px" }
47
+ ]
48
+ },
49
+ {
50
+ "category": "fontSize",
51
+ "description": "フォントサイズトークン。CSS変数名は --fz--{値}。分子8の調和数列(倍音列)ベースのスケーリング。",
52
+ "tokens": [
53
+ { "name": "--fz--base", "value": "var(--REM)", "description": "本文の基本フォントサイズ(≒ 1rem)" },
54
+ { "name": "--fz--5xl", "value": "calc(var(--REM) * 8 / 2)", "description": "最大サイズ(8/2)" },
55
+ { "name": "--fz--4xl", "value": "calc(var(--REM) * 8 / 3)", "description": "特大サイズ(8/3)" },
56
+ { "name": "--fz--3xl", "value": "calc(var(--REM) * 8 / 4)", "description": "3XLサイズ(8/4)" },
57
+ { "name": "--fz--2xl", "value": "calc(var(--REM) * 8 / 5)", "description": "2XLサイズ(8/5)" },
58
+ { "name": "--fz--xl", "value": "calc(var(--REM) * 8 / 6)", "description": "XLサイズ(8/6)" },
59
+ { "name": "--fz--l", "value": "calc(var(--REM) * 8 / 7)", "description": "Lサイズ(8/7)" },
60
+ { "name": "--fz--m", "value": "calc(var(--REM) * 8 / 8)", "description": "Mサイズ(基準)" },
61
+ { "name": "--fz--s", "value": "calc(var(--REM) * 8 / 9)", "description": "Sサイズ(8/9)" },
62
+ { "name": "--fz--xs", "value": "calc(var(--REM) * 8 / 10)", "description": "XSサイズ(8/10)" },
63
+ { "name": "--fz--2xs", "value": "calc(var(--REM) * 8 / 11)", "description": "最小サイズ(8/11)" }
64
+ ]
65
+ },
66
+ {
67
+ "category": "lineHeight",
68
+ "description": "行間(ハーフレディング)トークン。CSS変数名は --hl--{値}。line-heightは calc(1em + var(--hl) * 2) で算出される。--hl-unit(≒2px)を基準とする。",
69
+ "tokens": [
70
+ { "name": "--hl--xs", "value": "var(--hl-unit)", "description": "極小の行間(≒ 2px)" },
71
+ { "name": "--hl--s", "value": "calc(var(--hl-unit) * 2)", "description": "小さめの行間(≒ 4px)" },
72
+ { "name": "--hl--base", "value": "calc(var(--hl-unit) * 3)", "description": "基本の行間(≒ 6px)" },
73
+ { "name": "--hl--l", "value": "calc(var(--hl-unit) * 4)", "description": "大きめの行間(≒ 8px)" }
74
+ ]
75
+ },
76
+ {
77
+ "category": "letterSpacing",
78
+ "description": "文字間隔トークン。CSS変数名は --lts--{値}。",
79
+ "tokens": [
80
+ { "name": "--lts--base", "value": "normal", "description": "基本の文字間隔" },
81
+ { "name": "--lts--s", "value": "-0.05em", "description": "狭めの文字間隔" },
82
+ { "name": "--lts--l", "value": "0.05em", "description": "広めの文字間隔" }
83
+ ]
84
+ },
85
+ {
86
+ "category": "fontFamily",
87
+ "description": "フォントファミリートークン。CSS変数名は --ff--{値}。",
88
+ "tokens": [
89
+ {
90
+ "name": "--ff--base",
91
+ "value": "-apple-system, 'BlinkMacSystemFont', 'Hiragino Sans', sans-serif, 'Segoe UI Emoji'",
92
+ "description": "基本フォント"
93
+ },
94
+ { "name": "--ff--accent", "value": "'Garamond', 'Baskerville', 'Times New Roman', serif", "description": "アクセントフォント" },
95
+ { "name": "--ff--mono", "value": "ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace", "description": "モノスペースフォント" }
96
+ ]
97
+ },
98
+ {
99
+ "category": "radius",
100
+ "description": "角丸トークン。CSS変数名は --bdrs--{値}。段階的に値が大きくなる。",
101
+ "tokens": [
102
+ { "name": "--bdrs--5", "value": "2px", "description": "角丸 step 5" },
103
+ { "name": "--bdrs--10", "value": "0.25rem", "description": "角丸 step 10(≒ 4px)" },
104
+ { "name": "--bdrs--20", "value": "0.5rem", "description": "角丸 step 20(≒ 8px)" },
105
+ { "name": "--bdrs--30", "value": "1rem", "description": "角丸 step 30(≒ 16px)" },
106
+ { "name": "--bdrs--40", "value": "1.5rem", "description": "角丸 step 40(≒ 24px)" },
107
+ { "name": "--bdrs--50", "value": "2rem", "description": "角丸 step 50(≒ 32px)" },
108
+ { "name": "--bdrs--99", "value": "99rem", "description": "完全な丸 (pill)" },
109
+ { "name": "--bdrs--inner", "value": "calc(var(--bdrs, 0px) - var(--p, 0px))", "description": "内側の角丸(親要素に合わせる)" }
110
+ ]
111
+ },
112
+ {
113
+ "category": "shadow",
114
+ "description": "ボックスシャドウトークン。CSS変数名は --bxsh--{値}。--shc(シャドウカラー: hsl(220 4% 8% / 5%))と --shsz--{n}(シャドウサイズ)を組み合わせた --sh--{n} 変数を複合して構成。",
115
+ "tokens": [
116
+ { "name": "--bxsh--5", "value": "var(--sh--5)", "description": "シャドウ step 5(最も薄い・単一シャドウ)" },
117
+ { "name": "--bxsh--10", "value": "var(--sh--5), var(--sh--10)", "description": "シャドウ step 10" },
118
+ { "name": "--bxsh--20", "value": "var(--sh--10), var(--sh--20)", "description": "シャドウ step 20" },
119
+ { "name": "--bxsh--30", "value": "var(--sh--20), var(--sh--30)", "description": "シャドウ step 30" },
120
+ { "name": "--bxsh--40", "value": "var(--sh--30), var(--sh--40)", "description": "シャドウ step 40" },
121
+ { "name": "--bxsh--50", "value": "var(--sh--40), var(--sh--50)", "description": "シャドウ step 50(最も濃い)" }
122
+ ]
123
+ },
124
+ {
125
+ "category": "zIndex",
126
+ "description": "z-index プリセット値。",
127
+ "tokens": [
128
+ { "name": "-1", "value": "-1" },
129
+ { "name": "0", "value": "0" },
130
+ { "name": "1", "value": "1" },
131
+ { "name": "99", "value": "99" }
132
+ ]
133
+ }
134
134
  ]
@@ -109,6 +109,25 @@ export declare const TokenCategorySchema: z.ZodObject<{
109
109
  }>;
110
110
  export declare const PropsSystemDataSchema: z.ZodObject<{
111
111
  description: z.ZodString;
112
+ classNaming: z.ZodOptional<z.ZodObject<{
113
+ propClass: z.ZodString;
114
+ propClassWithVariable: z.ZodString;
115
+ responsive: z.ZodString;
116
+ note: z.ZodString;
117
+ examples: z.ZodArray<z.ZodString, "many">;
118
+ }, "strip", z.ZodTypeAny, {
119
+ responsive: string;
120
+ propClass: string;
121
+ propClassWithVariable: string;
122
+ note: string;
123
+ examples: string[];
124
+ }, {
125
+ responsive: string;
126
+ propClass: string;
127
+ propClassWithVariable: string;
128
+ note: string;
129
+ examples: string[];
130
+ }>>;
112
131
  categories: z.ZodArray<z.ZodObject<{
113
132
  category: z.ZodString;
114
133
  description: z.ZodString;
@@ -171,6 +190,13 @@ export declare const PropsSystemDataSchema: z.ZodObject<{
171
190
  values?: string[] | undefined;
172
191
  }[];
173
192
  }[];
193
+ classNaming?: {
194
+ responsive: string;
195
+ propClass: string;
196
+ propClassWithVariable: string;
197
+ note: string;
198
+ examples: string[];
199
+ } | undefined;
174
200
  }, {
175
201
  description: string;
176
202
  categories: {
@@ -185,6 +211,13 @@ export declare const PropsSystemDataSchema: z.ZodObject<{
185
211
  values?: string[] | undefined;
186
212
  }[];
187
213
  }[];
214
+ classNaming?: {
215
+ responsive: string;
216
+ propClass: string;
217
+ propClassWithVariable: string;
218
+ note: string;
219
+ examples: string[];
220
+ } | undefined;
188
221
  }>;
189
222
  export declare const OverviewDataSchema: z.ZodObject<{
190
223
  description: z.ZodString;
@@ -46,8 +46,16 @@ const PropCategorySchema = z.object({
46
46
  description: z.string(),
47
47
  props: z.array(PropEntrySchema),
48
48
  });
49
+ const ClassNamingSchema = z.object({
50
+ propClass: z.string(),
51
+ propClassWithVariable: z.string(),
52
+ responsive: z.string(),
53
+ note: z.string(),
54
+ examples: z.array(z.string()),
55
+ });
49
56
  export const PropsSystemDataSchema = z.object({
50
57
  description: z.string(),
58
+ classNaming: ClassNamingSchema.optional(),
51
59
  categories: z.array(PropCategorySchema),
52
60
  });
53
61
  const PackageInfoSchema = z.object({
@@ -12,6 +12,11 @@ export declare function buildAliasMap(items: Array<{
12
12
  * 検索クエリにCSSプロパティ名が含まれていた場合に、対応するLism prop名で展開するために使用。
13
13
  */
14
14
  export declare function buildCssPropertyMap(categories: PropCategory[]): Map<string, string[]>;
15
+ /**
16
+ * Prop Class 記法(例: "-g:5", ".-p:20", "-fz")から prop 名を抽出する。
17
+ * get-props-system.ts からも利用される共通ユーティリティ。
18
+ */
19
+ export declare function parsePropClassName(input: string): string | null;
15
20
  export interface SearchDocsOptions {
16
21
  category?: string;
17
22
  limit?: number;
@@ -42,20 +42,40 @@ export function buildCssPropertyMap(categories) {
42
42
  }
43
43
  return map;
44
44
  }
45
+ // ".-g:5" or "-g:5" → prop="g", value="5" / "-p" → prop="p"
46
+ const PROP_CLASS_RE = /^\.?-([a-z][a-z0-9-]*)(:.+)?$/i;
45
47
  /**
46
- * 検索クエリをCSSプロパティ名で展開する。
47
- * 例: "font-size" → "font-size fz", "padding" → "padding p"
48
+ * Prop Class 記法(例: "-g:5", ".-p:20", "-fz")から prop 名を抽出する。
49
+ * get-props-system.ts からも利用される共通ユーティリティ。
48
50
  */
49
- function expandQueryWithCssProps(query, cssPropertyMap) {
50
- if (!cssPropertyMap)
51
- return query;
52
- const queryLower = query.toLowerCase();
51
+ export function parsePropClassName(input) {
52
+ const m = input.match(PROP_CLASS_RE);
53
+ return m ? m[1].toLowerCase() : null;
54
+ }
55
+ /**
56
+ * 検索クエリをCSSプロパティ名やProp Class記法で展開する。
57
+ * 例: "font-size" → "font-size fz"
58
+ * 例: "-g:5" → "-g:5 g gap prop class"
59
+ */
60
+ function expandQuery(query, cssPropertyMap) {
53
61
  const additions = [];
54
- for (const [cssProp, lismProps] of cssPropertyMap) {
55
- if (queryLower.includes(cssProp)) {
56
- additions.push(...lismProps);
62
+ const queryLower = query.toLowerCase();
63
+ const parsedProp = parsePropClassName(queryLower.trim());
64
+ if (cssPropertyMap) {
65
+ for (const [cssProp, lismProps] of cssPropertyMap) {
66
+ // Prop Class 記法の逆引き(例: "-g:5" の "g" → "gap")
67
+ if (parsedProp && lismProps.includes(parsedProp)) {
68
+ additions.push(cssProp);
69
+ }
70
+ // CSSプロパティ名の展開(例: "font-size" → "fz")
71
+ if (queryLower.includes(cssProp)) {
72
+ additions.push(...lismProps);
73
+ }
57
74
  }
58
75
  }
76
+ if (parsedProp) {
77
+ additions.push(parsedProp, 'prop class');
78
+ }
59
79
  return additions.length > 0 ? `${query} ${additions.join(' ')}` : query;
60
80
  }
61
81
  // docs entry のタイトルに含まれるコンポーネント名から aliases を取得
@@ -107,8 +127,8 @@ function scoreEntry(entry, queryTokens, aliasMap) {
107
127
  }
108
128
  export function searchDocs(entries, query, options) {
109
129
  const { category, limit = 10, aliasMap, cssPropertyMap } = options ?? {};
110
- // CSSプロパティ名をLism prop名に展開してからトークナイズ
111
- const expandedQuery = expandQueryWithCssProps(query, cssPropertyMap);
130
+ // CSSプロパティ名・Prop Class記法をLism prop名に展開してからトークナイズ
131
+ const expandedQuery = expandQuery(query, cssPropertyMap);
112
132
  const queryTokens = tokenize(expandedQuery);
113
133
  if (queryTokens.length === 0)
114
134
  return [];
@@ -52,8 +52,16 @@ export interface PropEntry {
52
52
  description: string;
53
53
  values?: string[];
54
54
  }
55
+ export interface ClassNaming {
56
+ propClass: string;
57
+ propClassWithVariable: string;
58
+ responsive: string;
59
+ note: string;
60
+ examples: string[];
61
+ }
55
62
  export interface PropsSystemData {
56
63
  description: string;
64
+ classNaming?: ClassNaming;
57
65
  categories: PropCategory[];
58
66
  }
59
67
  export interface PropCategory {
@@ -40,9 +40,7 @@ export function registerGetComponent(server) {
40
40
  return notFound(`Component "${name}" not found by name, but ${aliasMatches.length} components matched by alias. Did you mean one of these?`, { suggestions });
41
41
  }
42
42
  // Step 3: 名前の部分一致
43
- const suggestions = candidates
44
- .filter((c) => c.name.toLowerCase().includes(nameLower))
45
- .map((c) => ({ name: c.name, package: c.package }));
43
+ const suggestions = candidates.filter((c) => c.name.toLowerCase().includes(nameLower)).map((c) => ({ name: c.name, package: c.package }));
46
44
  if (suggestions.length > 0) {
47
45
  return notFound(`Component "${name}" not found. Did you mean one of these? Or try search_docs with a broader query.`, {
48
46
  suggestions,
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { loadJSON } from '../lib/load-data.js';
3
3
  import { PropsSystemDataSchema } from '../lib/schemas.js';
4
+ import { parsePropClassName } from '../lib/search.js';
4
5
  import { success, error, notFound, READ_ONLY_ANNOTATIONS } from '../lib/response.js';
5
6
  /** cssProperty フィールドからコア名を抽出(例: "--hl (CSS変数)" → "--hl") */
6
7
  function normalizeCssProperty(raw) {
@@ -30,7 +31,7 @@ export function registerGetPropsSystem(server) {
30
31
  if (!prop) {
31
32
  return success(data);
32
33
  }
33
- const queryLower = prop.toLowerCase();
34
+ const queryLower = parsePropClassName(prop) ?? prop.toLowerCase();
34
35
  const matched = [];
35
36
  for (const cat of data.categories) {
36
37
  const found = cat.props.filter((p) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lism-css/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.10.1",
4
4
  "description": "MCP server for lism-css documentation and API reference.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "scripts": {
25
+ "format": "prettier --write . --ignore-path ../../.prettierignore",
25
26
  "build": "tsc -p tsconfig.build.json && cp src/data/*.json dist/data/",
26
27
  "dev": "tsc --watch",
27
28
  "test": "vitest run"