@lism-css/mcp 0.12.0 → 0.13.0

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.
Files changed (43) hide show
  1. package/README.ja.md +1 -1
  2. package/dist/data/docs-index.json +202 -151
  3. package/dist/data/guides/SKILL.md +95 -54
  4. package/dist/data/guides/base-styles.md +2 -2
  5. package/dist/data/guides/components-core.md +84 -130
  6. package/dist/data/guides/components-ui.md +3 -3
  7. package/dist/data/guides/css-rules.md +41 -21
  8. package/dist/data/guides/primitive-class.md +148 -0
  9. package/dist/data/guides/primitives/a--decorator.md +45 -0
  10. package/dist/data/guides/primitives/a--divider.md +69 -0
  11. package/dist/data/guides/primitives/a--icon.md +105 -0
  12. package/dist/data/guides/primitives/a--spacer.md +63 -0
  13. package/dist/data/guides/primitives/is--boxLink.md +97 -0
  14. package/dist/data/guides/primitives/is--container.md +46 -0
  15. package/dist/data/guides/primitives/is--layer.md +71 -0
  16. package/dist/data/guides/primitives/is--vertical.md +52 -0
  17. package/dist/data/guides/primitives/is--wrapper.md +87 -0
  18. package/dist/data/guides/primitives/l--box.md +31 -0
  19. package/dist/data/guides/primitives/l--center.md +55 -0
  20. package/dist/data/guides/primitives/l--cluster.md +38 -0
  21. package/dist/data/guides/primitives/l--columns.md +72 -0
  22. package/dist/data/guides/primitives/l--flex.md +74 -0
  23. package/dist/data/guides/primitives/l--flow.md +134 -0
  24. package/dist/data/guides/primitives/l--fluidCols.md +68 -0
  25. package/dist/data/guides/primitives/l--frame.md +94 -0
  26. package/dist/data/guides/primitives/l--grid.md +68 -0
  27. package/dist/data/guides/primitives/l--sideMain.md +102 -0
  28. package/dist/data/guides/primitives/l--stack.md +56 -0
  29. package/dist/data/guides/primitives/l--switchCols.md +69 -0
  30. package/dist/data/guides/primitives/l--tileGrid.md +61 -0
  31. package/dist/data/guides/property-class.md +6 -5
  32. package/dist/data/guides/set-class.md +11 -9
  33. package/dist/data/guides/tokens.md +18 -0
  34. package/dist/data/guides/utility-class.md +9 -8
  35. package/dist/data/meta.js +2 -2
  36. package/dist/lib/load-markdown.d.ts +3 -2
  37. package/dist/lib/load-markdown.js +23 -5
  38. package/dist/lib/search.js +20 -1
  39. package/dist/tools/get-component.js +119 -30
  40. package/dist/tools/get-guide.js +1 -1
  41. package/dist/tools/search-docs.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/data/guides/module-class.md +0 -162
@@ -7,6 +7,8 @@
7
7
  > Property Class(`-{prop}:{value}`)は個別の CSS プロパティを 1 対 1 で制御するクラスです。
8
8
  > ユーティリティクラス(`u--{name}`)は複数のプロパティや子要素への効果をまとめて提供するもので、まったく別の仕組みです。
9
9
 
10
+ Lism コンポーネントでの `util` prop による指定方法は [components-core.md](./components-core.md#共通-props) を参照してください。
11
+
10
12
  ## TOC
11
13
 
12
14
  - [コアに含まれるユーティリティ一覧](#コアに含まれるユーティリティ一覧)
@@ -24,14 +26,13 @@
24
26
 
25
27
  | クラス | 用途 | ソースファイル |
26
28
  |--------|------|---------------|
27
- | `u--trim` | ハーフレディングのネガティブマージンでテキスト上下の余白を詰める | [`_trimHL.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_trimHL.scss) |
28
- | `u--trimChildren` | 子要素すべてにハーフレディングトリムを適用(`img`, `figure`, `button` は除外) | [`_trimHL.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_trimHL.scss) |
29
- | `u--cbox` | `--keycolor` を使い `color-mix()` で `--c` / `--bgc` / `--bdc` を自動生成する色付きボックス | [`_cbox.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_cbox.scss) |
30
- | `u--collapseGrid` | Grid / Flex の子要素間に `box-shadow` で境界線を表現する | [`_itemDivider.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_itemDivider.scss) |
31
- | `u--expandedLink` | `::before` 疑似要素で親コンテナ全体をクリック可能にするリンク。`is--linkBox` と併用 | [`_linkExpand.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_linkExpand.scss) |
32
- | `u--srOnly` | スクリーンリーダー専用(視覚的に非表示)。`clip-path: inset(50%)` で実装 | [`_hidden.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_hidden.scss) |
33
- | `u--snap` | スクロールスナップコンテナ。`--snapType`, `--snapAlign`, `--snapStop` で制御 | [`_snap.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_snap.scss) |
34
- | `u--clipText` | テキストで背景をクリッピング(`background-clip: text`) | [`_clipText.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/utility/_clipText.scss) |
29
+ | `u--trim` | ハーフレディングのネガティブマージンでテキスト上下の余白を詰める | [`_trimHL.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_trimHL.scss) |
30
+ | `u--trimChildren` | 子要素すべてにハーフレディングトリムを適用(`img`, `figure`, `button` は除外) | [`_trimHL.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_trimHL.scss) |
31
+ | `u--cbox` | `--keycolor` を使い `color-mix()` で `--c` / `--bgc` / `--bdc` を自動生成する色付きボックス | [`_cbox.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_cbox.scss) |
32
+ | `u--collapseGrid` | Grid / Flex の子要素間に `box-shadow` で境界線を表現する | [`_itemDivider.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_itemDivider.scss) |
33
+ | `u--srOnly` | スクリーンリーダー専用(視覚的に非表示)。`clip-path: inset(50%)` で実装 | [`_hidden.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_hidden.scss) |
34
+ | `u--snap` | スクロールスナップコンテナ。`--snapType`, `--snapAlign`, `--snapStop` で制御 | [`_snap.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_snap.scss) |
35
+ | `u--clipText` | テキストで背景をクリッピング(`background-clip: text`) | [`_clipText.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/utility/_clipText.scss) |
35
36
 
36
37
 
37
38
  ## 使用例
package/dist/data/meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const meta = {
2
- generatedAt: '2026-04-05',
3
- sourceCommit: 'edb98742',
2
+ generatedAt: '2026-04-14',
3
+ sourceCommit: '9a7c9ffa',
4
4
  docsVersion: '0.1.0',
5
5
  };
@@ -1,6 +1,7 @@
1
- /** guides/ ディレクトリから Markdown ファイルを読み込む(キャッシュ付き) */
1
+ /** guides/ ディレクトリから Markdown ファイルを読み込む(キャッシュ付き)。
2
+ * filename にはサブディレクトリを含む posix 区切りの相対パス(例: `primitives/l--flex.md`)を渡せる。 */
2
3
  export declare function loadMarkdown(filename: string): string;
3
- /** 利用可能なガイドファイル名の一覧を返す */
4
+ /** 利用可能なガイドファイル名の一覧(サブディレクトリ配下も含む)を返す */
4
5
  export declare function getGuideFilenames(): string[];
5
6
  /** 起動時に全ガイドを一括読み込みしてキャッシュに載せる */
6
7
  export declare function preloadGuides(): void;
@@ -1,5 +1,5 @@
1
- import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
- import { dirname, resolve } from 'node:path';
1
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
+ import { dirname, relative, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  const __dirname = dirname(fileURLToPath(import.meta.url));
5
5
  // スキル Markdown の正本を直接参照(開発・テスト時)
@@ -8,7 +8,8 @@ const skillsDir = resolve(__dirname, '..', '..', '..', '..', '.claude', 'skills'
8
8
  const distDir = resolve(__dirname, '..', 'data', 'guides');
9
9
  const guidesDir = existsSync(skillsDir) ? skillsDir : distDir;
10
10
  const cache = new Map();
11
- /** guides/ ディレクトリから Markdown ファイルを読み込む(キャッシュ付き) */
11
+ /** guides/ ディレクトリから Markdown ファイルを読み込む(キャッシュ付き)。
12
+ * filename にはサブディレクトリを含む posix 区切りの相対パス(例: `primitives/l--flex.md`)を渡せる。 */
12
13
  export function loadMarkdown(filename) {
13
14
  if (cache.has(filename))
14
15
  return cache.get(filename);
@@ -17,9 +18,26 @@ export function loadMarkdown(filename) {
17
18
  cache.set(filename, content);
18
19
  return content;
19
20
  }
20
- /** 利用可能なガイドファイル名の一覧を返す */
21
+ /** guidesDir 配下を再帰的に走査し、`.md` ファイルの相対パス(posix 区切り)を返す */
22
+ function walkMarkdownFiles(dir, baseDir = dir) {
23
+ const results = [];
24
+ for (const entry of readdirSync(dir)) {
25
+ if (entry.startsWith('.'))
26
+ continue;
27
+ const full = resolve(dir, entry);
28
+ const stat = statSync(full);
29
+ if (stat.isDirectory()) {
30
+ results.push(...walkMarkdownFiles(full, baseDir));
31
+ }
32
+ else if (stat.isFile() && entry.endsWith('.md')) {
33
+ results.push(relative(baseDir, full).split('\\').join('/'));
34
+ }
35
+ }
36
+ return results;
37
+ }
38
+ /** 利用可能なガイドファイル名の一覧(サブディレクトリ配下も含む)を返す */
21
39
  export function getGuideFilenames() {
22
- return readdirSync(guidesDir).filter((f) => f.endsWith('.md'));
40
+ return walkMarkdownFiles(guidesDir);
23
41
  }
24
42
  /** 起動時に全ガイドを一括読み込みしてキャッシュに載せる */
25
43
  export function preloadGuides() {
@@ -88,9 +88,28 @@ export function searchDocs(entries, query, options) {
88
88
  const DOCS_BASE_URL = 'https://lism-css.com/docs';
89
89
  return scored.map(({ entry, score }) => ({
90
90
  sourcePath: entry.sourcePath,
91
- url: `${DOCS_BASE_URL}/${entry.sourcePath.replace(/\.mdx$/, '')}/`,
91
+ url: `${DOCS_BASE_URL}/${sourcePathToUrlSlug(entry.sourcePath)}/`,
92
92
  heading: entry.title,
93
93
  snippet: entry.snippet,
94
94
  score,
95
95
  }));
96
96
  }
97
+ /**
98
+ * `sourcePath`(実 MDX ファイルの相対パス)を公開 URL のスラッグに変換する。
99
+ *
100
+ * - `primitives/` 配下のみファイル名の casing を保持(CSS クラス名と URL を一致させるための例外)
101
+ * - それ以外は全て小文字化(Astro content collections の `generateId` と揃える)
102
+ *
103
+ * IMPORTANT: `apps/docs/src/lib/contentSlug.ts` の `toContentSlug` と必ず同じロジックに保つこと。
104
+ * 別ワークスペース(apps/docs)なので直接 import できず、ローカル実装で複製している。
105
+ * apps/docs 側を変更した場合は必ずここも合わせて更新する。
106
+ *
107
+ * 例:
108
+ * `primitives/l--tileGrid.mdx` → `primitives/l--tileGrid`
109
+ * `core-components/Group.mdx` → `core-components/group`
110
+ * `ui/DummyImage.mdx` → `ui/dummyimage`
111
+ */
112
+ function sourcePathToUrlSlug(sourcePath) {
113
+ const withoutExt = sourcePath.replace(/\.mdx$/, '');
114
+ return withoutExt.startsWith('primitives/') ? withoutExt : withoutExt.toLowerCase();
115
+ }
@@ -1,16 +1,70 @@
1
1
  import { z } from 'zod';
2
- import { loadMarkdown } from '../lib/load-markdown.js';
2
+ import { getGuideFilenames, loadMarkdown } from '../lib/load-markdown.js';
3
3
  import { findComponentByHeading, findComponentInTables } from '../lib/markdown-utils.js';
4
4
  import { markdownResponse, error, notFound, READ_ONLY_ANNOTATIONS } from '../lib/response.js';
5
+ /** 入力を正規化してエイリアス検索のキーに変換する。
6
+ * `<Flex>` / `Flex` / `l--flex` / `flex` をすべて `flex` に揃える。 */
7
+ function normalizeComponentKey(input) {
8
+ return input
9
+ .trim()
10
+ .toLowerCase()
11
+ .replace(/^<|>$/g, '')
12
+ .replace(/^(l--|is--|a--|c--)/, '');
13
+ }
14
+ /** 入力が `<ComponentName>` 形式(React コンポーネントとしての問い合わせ)か判定する */
15
+ function isAngleBracketNotation(input) {
16
+ return /^<[^<>]+>$/.test(input.trim());
17
+ }
18
+ /** primitives/*.md の先頭行 `# l--flex / \`<Flex>\`` からクラス名とコンポーネント名を抽出する */
19
+ function parsePrimitiveHeading(md) {
20
+ const firstLine = md.split('\n', 1)[0] ?? '';
21
+ const match = firstLine.match(/^#\s+((?:l|is|a|c)--[A-Za-z0-9]+)(?:\s*\/\s*`<([A-Za-z0-9]+)>`)?/);
22
+ if (!match)
23
+ return null;
24
+ return { className: match[1], componentName: match[2] };
25
+ }
26
+ let classAliasMap = null;
27
+ let componentAliasMap = null;
28
+ /** primitives/*.md を走査して、クラス名由来 / React コンポーネント名由来の alias map を構築する(遅延初期化・キャッシュ)。
29
+ * angle-bracket 形式の問い合わせ(`<Vertical>` など)には componentAliasMap のみを照合し、
30
+ * クラス専用プリミティブ(例: is--vertical)を誤ってヒットさせないために分離している。 */
31
+ function buildAliasMaps() {
32
+ if (classAliasMap && componentAliasMap)
33
+ return;
34
+ const classMap = new Map();
35
+ const componentMap = new Map();
36
+ for (const filename of getGuideFilenames()) {
37
+ if (!filename.startsWith('primitives/'))
38
+ continue;
39
+ const parsed = parsePrimitiveHeading(loadMarkdown(filename));
40
+ if (!parsed)
41
+ continue;
42
+ classMap.set(normalizeComponentKey(parsed.className), filename);
43
+ if (parsed.componentName) {
44
+ componentMap.set(normalizeComponentKey(parsed.componentName), filename);
45
+ }
46
+ }
47
+ classAliasMap = classMap;
48
+ componentAliasMap = componentMap;
49
+ }
50
+ function getClassAliasMap() {
51
+ buildAliasMaps();
52
+ return classAliasMap;
53
+ }
54
+ function getComponentAliasMap() {
55
+ buildAliasMaps();
56
+ return componentAliasMap;
57
+ }
5
58
  export function registerGetComponent(server) {
6
59
  server.registerTool('get_component', {
7
60
  description: 'Get detailed information about a specific lism-css component: purpose, props, and usage examples.\n' +
8
61
  'Use this when you need documentation for a known component by name (e.g. "Box", "Flex", "Accordion", "Lism", "HTML").\n' +
62
+ 'Accepts multiple notations: "Flex", "<Flex>", "l--flex", "flex" all resolve to the same entry.\n' +
9
63
  'Do NOT use this for broad topic guides (use get_guide with "components-core" or "components-ui") or keyword search across all docs (use search_docs).\n' +
10
64
  'If the component is not found, suggestions will be provided — follow up with search_docs for a broader query.\n' +
11
65
  'The response is pre-formatted Markdown. Output it verbatim. Do NOT summarize or omit code examples.',
12
66
  inputSchema: {
13
- name: z.string().describe('Component name to look up (e.g. "Box", "Flex", "Accordion").'),
67
+ name: z.string().describe('Component name to look up (e.g. "Box", "Flex", "Accordion", "l--flex", "<Flex>").'),
14
68
  package: z
15
69
  .enum(['lism-css', '@lism-css/ui'])
16
70
  .optional()
@@ -19,30 +73,30 @@ export function registerGetComponent(server) {
19
73
  annotations: READ_ONLY_ANNOTATIONS,
20
74
  }, ({ name, package: pkg }) => {
21
75
  try {
22
- const nameLower = name.toLowerCase();
23
- // --- @lism-css/ui コンポーネントを検索 ---
24
- if (!pkg || pkg === '@lism-css/ui') {
25
- const uiMd = loadMarkdown('components-ui.md');
26
- // ## ComponentName 形式の見出しで検索(完全一致)
27
- const uiSection = findComponentByHeading(uiMd, name);
28
- if (uiSection) {
29
- return markdownResponse(uiSection);
76
+ const normalizedKey = normalizeComponentKey(name);
77
+ const rawLower = name.toLowerCase();
78
+ const isAngle = isAngleBracketNotation(name);
79
+ // --- 1) lism-css コア: primitives/ の個別ファイルを alias map で解決 ---
80
+ // angle-bracket 形式 (`<Vertical>`) は React コンポーネント alias のみと照合し、
81
+ // クラス専用プリミティブ (is--vertical 等) への false positive を避ける。
82
+ if (!pkg || pkg === 'lism-css') {
83
+ const componentHit = getComponentAliasMap().get(normalizedKey);
84
+ if (componentHit) {
85
+ return markdownResponse(loadMarkdown(componentHit));
30
86
  }
31
- // 大文字小文字を無視した見出し検索
32
- const uiLines = uiMd.split('\n');
33
- const headingLine = uiLines.find((l) => l.startsWith('## ') && l.slice(3).trim().toLowerCase() === nameLower);
34
- if (headingLine) {
35
- const section = findComponentByHeading(uiMd, headingLine.slice(3).trim());
36
- if (section)
37
- return markdownResponse(section);
87
+ if (!isAngle) {
88
+ const classHit = getClassAliasMap().get(normalizedKey);
89
+ if (classHit) {
90
+ return markdownResponse(loadMarkdown(classHit));
91
+ }
38
92
  }
39
93
  }
40
- // --- lism-css コアコンポーネントを検索 ---
94
+ // --- 2) lism-css コア: components-core.md のセマンティック/コアコンポーネント ---
41
95
  if (!pkg || pkg === 'lism-css') {
42
96
  const coreMd = loadMarkdown('components-core.md');
43
97
  // 見出しにコンポーネント名を含むセクションを検索(Lism, HTML 等)
44
98
  const coreLines = coreMd.split('\n');
45
- const headingLine = coreLines.find((l) => /^#{2,3}\s/.test(l) && l.toLowerCase().includes(`<${nameLower}>`));
99
+ const headingLine = coreLines.find((l) => /^#{2,3}\s/.test(l) && l.toLowerCase().includes(`<${rawLower}>`));
46
100
  if (headingLine) {
47
101
  const headingText = headingLine.replace(/^#+\s*/, '').trim();
48
102
  const section = findComponentByHeading(coreMd, headingText);
@@ -55,22 +109,57 @@ export function registerGetComponent(server) {
55
109
  return markdownResponse(coreSection);
56
110
  }
57
111
  }
58
- // --- 部分一致で候補を提示 ---
112
+ // --- 3) @lism-css/ui: components-ui.md を検索 ---
113
+ if (!pkg || pkg === '@lism-css/ui') {
114
+ const uiMd = loadMarkdown('components-ui.md');
115
+ // ## ComponentName 形式の見出しで検索(完全一致)
116
+ const uiSection = findComponentByHeading(uiMd, name);
117
+ if (uiSection) {
118
+ return markdownResponse(uiSection);
119
+ }
120
+ // 大文字小文字を無視した見出し検索
121
+ const uiLines = uiMd.split('\n');
122
+ const headingLine = uiLines.find((l) => l.startsWith('## ') && l.slice(3).trim().toLowerCase() === rawLower);
123
+ if (headingLine) {
124
+ const section = findComponentByHeading(uiMd, headingLine.slice(3).trim());
125
+ if (section)
126
+ return markdownResponse(section);
127
+ }
128
+ }
129
+ // --- 4) 部分一致で候補を提示 ---
59
130
  const uiMd = loadMarkdown('components-ui.md');
60
131
  const coreMd = loadMarkdown('components-core.md');
61
- const uiCandidates = uiMd
62
- .split('\n')
63
- .filter((l) => l.startsWith('## ') && l.toLowerCase().includes(nameLower))
64
- .map((l) => l.slice(3).trim());
132
+ const moduleCandidates = [];
133
+ if (!pkg || pkg === 'lism-css') {
134
+ const seenFiles = new Set();
135
+ for (const map of [getComponentAliasMap(), getClassAliasMap()]) {
136
+ for (const [key, file] of map) {
137
+ if (key.includes(normalizedKey) && !seenFiles.has(file)) {
138
+ seenFiles.add(file);
139
+ moduleCandidates.push(file.replace(/^primitives\//, '').replace(/\.md$/, ''));
140
+ }
141
+ }
142
+ }
143
+ }
65
144
  const coreCandidates = [];
66
- for (const line of coreMd.split('\n')) {
67
- if (line.startsWith('|') && line.toLowerCase().includes(nameLower)) {
68
- const match = line.match(/`<([^>]+)>`/);
69
- if (match)
70
- coreCandidates.push(match[1]);
145
+ if (!pkg || pkg === 'lism-css') {
146
+ for (const line of coreMd.split('\n')) {
147
+ if (line.startsWith('|') && line.toLowerCase().includes(rawLower)) {
148
+ const match = line.match(/`<([^>]+)>`/);
149
+ if (match)
150
+ coreCandidates.push(match[1]);
151
+ }
152
+ }
153
+ }
154
+ const uiCandidates = [];
155
+ if (!pkg || pkg === '@lism-css/ui') {
156
+ for (const l of uiMd.split('\n')) {
157
+ if (l.startsWith('## ') && l.toLowerCase().includes(rawLower)) {
158
+ uiCandidates.push(l.slice(3).trim());
159
+ }
71
160
  }
72
161
  }
73
- const suggestions = [...new Set([...uiCandidates, ...coreCandidates])];
162
+ const suggestions = [...new Set([...moduleCandidates, ...coreCandidates, ...uiCandidates])];
74
163
  if (suggestions.length > 0) {
75
164
  return notFound(`Component "${name}" not found. Did you mean one of these? Or try search_docs with a broader query.`, {
76
165
  suggestions,
@@ -15,7 +15,7 @@ const GUIDE_TOPICS = {
15
15
  },
16
16
  'base-styles': { file: 'base-styles.md', label: 'Base styling, reset CSS, HTML element styles' },
17
17
  'set-class': { file: 'set-class.md', label: 'Set classes (set--plain, set--shadow, set--hov, etc.)' },
18
- 'module-class': { file: 'module-class.md', label: 'Module class prefixes (is--, l--, a--, c--)' },
18
+ 'primitive-class': { file: 'primitive-class.md', label: 'Primitive class prefixes (is--, l--, a--) and Component class (c--)' },
19
19
  'utility-class': { file: 'utility-class.md', label: 'Utility classes (u--trim, u--cbox, etc.)' },
20
20
  'css-rules': { file: 'css-rules.md', label: 'CSS methodology, layer structure, naming conventions' },
21
21
  responsive: { file: 'prop-responsive.md', label: 'Responsive design, breakpoints, container queries' },
@@ -5,7 +5,7 @@ import { DocsEntrySchema } from '../lib/schemas.js';
5
5
  import { parsePropRows } from '../lib/markdown-utils.js';
6
6
  import { searchDocs } from '../lib/search.js';
7
7
  import { success, error, READ_ONLY_ANNOTATIONS } from '../lib/response.js';
8
- const DOC_CATEGORIES = ['all', 'core-components', 'modules', 'props', 'ui', 'guide'];
8
+ const DOC_CATEGORIES = ['all', 'core-components', 'primitives', 'property-class', 'ui', 'guide'];
9
9
  /**
10
10
  * property-class.md のテーブルから CSSプロパティ名 → Lism prop名 のマップを構築する。
11
11
  * search.ts の buildCssPropertyMap と同じインターフェースを返す。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lism-css/mcp",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "MCP server for lism-css documentation and API reference.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,162 +0,0 @@
1
- # モジュールクラス
2
-
3
- Lism CSS では、クラス名のプレフィックスによってモジュールの種類と CSS Layer の所属が決まります。
4
- すべてのモジュールクラスは `@layer lism-modules` に属します(`set--` を除く)。
5
-
6
- ## TOC
7
-
8
- - [プレフィックス一覧](#プレフィックス一覧)
9
- - [State Module(`is--`)](#state-moduleis--)
10
- - [Layout Module(`l--`)](#layout-modulel--)
11
- - [Atomic Module(`a--`)](#atomic-modulea--)
12
- - [Component(`c--`)](#componentc--)
13
-
14
- [詳細](https://lism-css.com/docs/module-class/)
15
-
16
- ---
17
-
18
- ## プレフィックス一覧
19
-
20
- | プレフィックス | 種類 | 役割 |
21
- |--------------|------|------|
22
- | `is--` | State Module | 複数のモジュールに付け外しできる汎用的な状態クラス |
23
- | `l--` | Layout Module | レイアウトの構成単位となるモジュール |
24
- | `a--` | Atomic Module | レイアウトの最小単位(アイコン・区切り線等) |
25
- | `c--` | Component | 具体的な役割を持つコンポーネント |
26
-
27
- **併用ルール:**
28
- - `is--` は他のすべてのモジュールと併用可能
29
- - `l--` と `c--` は併用可能(例: `class="l--flex c--nav"`)
30
- - 同カテゴリ内の併用は不可(例: `l--flex` と `l--grid` は同要素に付けない)
31
-
32
-
33
- ## State Module(`is--`)
34
-
35
- [詳細](https://lism-css.com/docs/state/)
36
-
37
- 要素に構造的な振る舞い(状態)を付与するクラスです。他のモジュールクラスと自由に組み合わせられます。
38
-
39
- | クラス | 用途 | 備考 |
40
- |--------|------|------|
41
- | `is--container` | コンテナクエリの基準要素にする(`container-type: inline-size`) | Lism のレスポンシブ機能の前提。判定基準にしたいラッパーに付与する |
42
- | `is--wrapper` | 直下の子要素のコンテンツ幅を制限する | `-contentSize:s` / `-contentSize:l` でプリセットサイズ指定可能。デフォルト: `--sz--m` |
43
- | `is--layer` | `position: absolute; inset: 0` の絶対配置レイヤー | `overflow: hidden` も適用される |
44
- | `is--linkBox` | ボックス全体をクリッカブルなリンク領域にする | `position: relative; isolation: isolate` を適用 |
45
- | `is--vertical` | 縦書きモード(`writing-mode: var(--vertical-mode)`) | `is--vertical@sm`, `is--vertical@md` でブレークポイント指定可能 |
46
- | `is--skipFlow` | `l--flow` 内で次の兄弟要素のフロー余白をリセット | `is--skipFlow + *` で `--flow: 0px` |
47
- | `is--side` | `l--sideMain` 内でサイド要素を示す | `l--sideMain` と組み合わせて使用 |
48
-
49
- ### コンポーネントでの対応
50
-
51
- | JSX Prop | HTML クラス |
52
- |----------|-----------|
53
- | `isContainer` | `is--container` |
54
- | `isWrapper` / `isWrapper='s'` | `is--wrapper` / `is--wrapper -contentSize:s` |
55
- | `isLayer` | `is--layer` |
56
- | `isLinkBox` | `is--linkBox` |
57
- | `isVertical` | `is--vertical` |
58
-
59
- ```jsx
60
- // Layout 優先の書き方(推奨)
61
- <Stack isLayer>背景レイヤー</Stack>
62
- // → <div class="l--stack is--layer">...</div>
63
-
64
- <Flex isWrapper="l">コンテンツ</Flex>
65
- // → <div class="l--flex is--wrapper -contentSize:l">...</div>
66
- ```
67
-
68
-
69
- ## Layout Module(`l--`)
70
-
71
- レイアウト構造を定義するメインのモジュール群です。Lism コンポーネントでは `layout` prop が内部で固定されており、対応するクラスが自動出力されます。
72
-
73
- | クラス | コンポーネント | CSS display | 用途 |
74
- |--------|-------------|-------------|------|
75
- | `l--box` | `<Box>` | — | 汎用ボックス |
76
- | `l--flex` | `<Flex>` | `flex` | Flexbox(横方向)。子要素に `min-width: 0` |
77
- | `l--stack` | `<Stack>` | `flex` | 縦積み(`flex-direction: column`) |
78
- | `l--cluster` | `<Cluster>` | `flex` | 折り返し Flex(`flex-wrap: wrap; align-items: center`) |
79
- | `l--grid` | `<Grid>` | `grid` | CSS Grid。`--gtc`, `--gtr`, `--gta` 変数で制御 |
80
- | `l--center` | `<Center>` | `grid` | 中央配置(`place-content: center; place-items: center`) |
81
- | `l--flow` | `<Flow>` | `flow-root` | フローコンテンツ。子要素間に `margin-block-start: var(--flow)` |
82
- | `l--frame` | `<Frame>` | — | アスペクト比フレーム。直下メディアに `object-fit: cover` |
83
- | `l--columns` | `<Columns>` | `grid` | 固定カラム数(`grid-template-columns: repeat(var(--cols), minmax(0, 1fr))`) |
84
- | `l--tileGrid` | `<TileGrid>` | `grid` | 均等タイルグリッド(`grid-template: repeat(var(--rows,1), minmax(0, 1fr)) / repeat(var(--cols,1), minmax(0, 1fr))`) |
85
- | `l--fluidCols` | `<FluidCols>` | `grid` | 流動カラム(`auto-fit` / `auto-fill`)。`--cols` で最小幅指定 |
86
- | `l--switchCols` | `<SwitchCols>` | `flex` | ブレークポイントでカラム切り替え。`--breakSize` で制御 |
87
- | `l--sideMain` | `<SideMain>` | `flex` | サイド+メインの2カラム。`--sideW`, `--mainW` で制御 |
88
-
89
- ### レイアウト固有の Props
90
-
91
- ```jsx
92
- <Grid gtc="1fr 1fr" gtr="auto">...</Grid>
93
- <Columns cols={3}>...</Columns> // --cols: 3
94
- <FluidCols autoFill>...</FluidCols> // --autoMode: auto-fill
95
- <SwitchCols breakSize="480px">...</SwitchCols> // --breakSize: 480px
96
- <SideMain sideW="200px" mainW="1fr">...</SideMain>
97
- <Flow flow="30">...</Flow> // --flow: var(--s30)
98
- ```
99
-
100
-
101
- ## Atomic Module(`a--`)
102
-
103
- レイアウトの最小単位となる単機能モジュールです。
104
-
105
- | クラス | コンポーネント | 用途 |
106
- |--------|-------------|------|
107
- | `a--icon` | `<Icon>` | SVG アイコン。`flex-shrink: 0`, デフォルトサイズ `1em` |
108
- | `a--divider` | `<Divider>` | 区切り線。`--bdc`, `--bds`, `--bdw` 変数でカスタマイズ |
109
- | `a--spacer` | `<Spacer>` | 空白要素(`min-height: 1px; min-width: 1px`) |
110
- | `a--decorator` | `<Decorator>` | 装飾用要素(SCSS定義なし、クラス名のみ出力) |
111
-
112
- ```jsx
113
- <Icon as={LucideArrowRight} fz="xl" />
114
- <Media as="img" src="/image.jpg" alt="説明" ar="16/9" />
115
- <Divider />
116
- <Spacer h="40" />
117
- ```
118
-
119
-
120
- ## Component(`c--`)
121
-
122
- [詳細](https://lism-css.com/docs/components/)
123
-
124
- より具体的な役割を持つコンポーネントのクラスです。他のクラスとの組み合わせを前提とした設計になっています。
125
-
126
- ### ユーザー定義コンポーネント
127
-
128
- 独自のコンポーネントを作成する場合は `c--{name}` の命名規則に従います。
129
-
130
- ```css
131
- @layer lism-modules {
132
- .c--my-card {
133
- border: 1px solid var(--brand);
134
- border-radius: var(--bdrs--20);
135
- padding: var(--s30);
136
- }
137
- .c--my-card_header { ... } /* 子要素 */
138
- .c--my-card_body { ... }
139
- }
140
- ```
141
-
142
- - バリエーション: `.c--button.c--button--outline`
143
- - 子要素: `.c--card_header`, `.c--card_body`
144
-
145
- ### `@lism-css/ui` で提供されるコンポーネント
146
-
147
- `@lism-css/ui` パッケージでは、以下の `c--` クラスを持つ UI コンポーネントが利用できます。
148
-
149
- | クラス | コンポーネント | 用途 |
150
- |--------|-------------|------|
151
- | `c--button` | `<Button>` | ボタン(`c--button--outline` バリエーションあり) |
152
- | `c--badge` | `<Badge>` | ラベル・バッジ(`c--badge--outline` バリエーションあり) |
153
- | `c--avatar` | `<Avatar>` | ユーザーアイコン |
154
- | `c--accordion` | `<Accordion>` | 折りたたみパネル(`_item`, `_panel`, `_button`, `_content`, `_icon` 子要素あり) |
155
- | `c--tabs` | `<Tabs>` | タブ切り替え UI(`_list`, `_tab`, `_panel` 子要素あり) |
156
- | `c--modal` | `<Modal>` | モーダルダイアログ(`_inner` 子要素あり) |
157
- | `c--details` | `<Details>` | details/summary(`_summary`, `_icon`, `_body` 子要素あり) |
158
- | `c--alert` | `<Alert>` | 警告・通知ボックス |
159
- | `c--callout` | `<Callout>` | 注釈・補足(`_head`, `_icon`, `_title`, `_body` 子要素あり) |
160
- | `c--chat` | `<Chat>` | チャット風 UI(`_avatar`, `_name`, `_body`, `_content`, `_deco` 子要素あり) |
161
- | `c--navMenu` | `<NavMenu>` | ナビゲーションメニュー(`_item`, `_link`, `_nest` 子要素あり) |
162
- | `c--shapeDivider` | `<ShapeDivider>` | 図形区切り線(`_inner`, `_svg` 子要素あり) |