@lism-css/mcp 0.12.0 → 0.14.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.
- package/README.ja.md +1 -1
- package/dist/data/docs-index.json +267 -174
- package/dist/data/guides/SKILL.md +95 -54
- package/dist/data/guides/base-styles.md +2 -2
- package/dist/data/guides/components-core.md +87 -132
- package/dist/data/guides/components-ui.md +3 -15
- package/dist/data/guides/css-rules.md +110 -24
- package/dist/data/guides/naming.md +204 -0
- package/dist/data/guides/primitive-class.md +84 -0
- package/dist/data/guides/primitives/a--decorator.md +43 -0
- package/dist/data/guides/primitives/a--divider.md +62 -0
- package/dist/data/guides/primitives/a--icon.md +105 -0
- package/dist/data/guides/primitives/a--spacer.md +63 -0
- package/dist/data/guides/primitives/is--boxLink.md +97 -0
- package/dist/data/guides/primitives/is--container.md +46 -0
- package/dist/data/guides/primitives/is--layer.md +71 -0
- package/dist/data/guides/primitives/is--wrapper.md +87 -0
- package/dist/data/guides/primitives/l--box.md +31 -0
- package/dist/data/guides/primitives/l--center.md +55 -0
- package/dist/data/guides/primitives/l--cluster.md +38 -0
- package/dist/data/guides/primitives/l--columns.md +72 -0
- package/dist/data/guides/primitives/l--flex.md +74 -0
- package/dist/data/guides/primitives/l--flow.md +134 -0
- package/dist/data/guides/primitives/l--fluidCols.md +71 -0
- package/dist/data/guides/primitives/l--frame.md +94 -0
- package/dist/data/guides/primitives/l--grid.md +68 -0
- package/dist/data/guides/primitives/l--sideMain.md +102 -0
- package/dist/data/guides/primitives/l--stack.md +56 -0
- package/dist/data/guides/primitives/l--switchCols.md +69 -0
- package/dist/data/guides/primitives/l--tileGrid.md +61 -0
- package/dist/data/guides/property-class.md +12 -11
- package/dist/data/guides/set-class.md +11 -26
- package/dist/data/guides/tokens.md +26 -9
- package/dist/data/guides/utility-class.md +9 -8
- package/dist/data/meta.js +2 -2
- package/dist/lib/load-markdown.d.ts +3 -2
- package/dist/lib/load-markdown.js +23 -5
- package/dist/lib/search.js +20 -1
- package/dist/tools/get-component.js +119 -30
- package/dist/tools/get-guide.js +1 -1
- package/dist/tools/search-docs.js +1 -1
- package/package.json +1 -1
- package/dist/data/guides/module-class.md +0 -162
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# l--tileGrid / `<TileGrid>`
|
|
2
|
+
|
|
3
|
+
`cols`(列数)と `rows`(行数)を指定して、**均等なタイル型グリッドレイアウト**を構成するクラス。内部的には `grid-template: repeat(rows, minmax(0, 1fr)) / repeat(cols, minmax(0, 1fr))` を使用します。
|
|
4
|
+
|
|
5
|
+
## 基本情報
|
|
6
|
+
|
|
7
|
+
- クラス名: `l--tileGrid`
|
|
8
|
+
- コンポーネント: `<TileGrid>`
|
|
9
|
+
- SCSSソース: https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/primitives/layout/_tileGrid.scss
|
|
10
|
+
- ドキュメント(人間向け): https://lism-css.com/docs/primitives/l--tileGrid/
|
|
11
|
+
|
|
12
|
+
## 専用Props
|
|
13
|
+
|
|
14
|
+
| Prop | CSS変数 | 説明 | デフォルト |
|
|
15
|
+
|------|--------|------|------------|
|
|
16
|
+
| `cols` | `--cols` | 列数を指定。配列でブレイクポイント指定可 | `1` |
|
|
17
|
+
| `rows` | `--rows` | 行数を指定。配列でブレイクポイント指定可 | `1` |
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### 基本的な使い方
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<TileGrid cols="3" rows="3" g="5" min-h="50svh">
|
|
25
|
+
<Box p="20" bgc="base-2">item1</Box>
|
|
26
|
+
<Box p="20" bgc="base-2">item2</Box>
|
|
27
|
+
<Box p="20" bgc="base-2">item3</Box>
|
|
28
|
+
<Box p="20" bgc="base-2">item4</Box>
|
|
29
|
+
<Box p="20" bgc="base-2" gc="span 2">item5</Box>
|
|
30
|
+
<Center gc="3" gr="1 / -1" p="20" bgc="blue">item6</Center>
|
|
31
|
+
</TileGrid>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<div class="l--tileGrid -g:5 -min-h:50svh" style="--cols: 3; --rows: 3">
|
|
36
|
+
<div class="l--box -p:20 -bgc:base-2">item1</div>
|
|
37
|
+
<div class="l--box -p:20 -bgc:base-2">item2</div>
|
|
38
|
+
<div class="l--box -p:20 -bgc:base-2">item3</div>
|
|
39
|
+
<div class="l--box -p:20 -bgc:base-2">item4</div>
|
|
40
|
+
<div class="l--box -p:20 -bgc:base-2 -gc:span 2">item5</div>
|
|
41
|
+
<div class="l--center -p:20 -bgc:blue" style="grid-column: 3; grid-row: 1 / -1">item6</div>
|
|
42
|
+
</div>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### ブレイクポイント別指定
|
|
46
|
+
|
|
47
|
+
`cols` / `rows` をブレイクポイントで切り替え、`gaf`(`grid-auto-flow`)と組み合わせて動的レイアウトも構築できます。
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
<TileGrid cols={['2', '3']} rows="4" min-h="50svh" gaf="row dense">
|
|
51
|
+
<Box gc={['1 / -1', 'span 2']} gr={['span 2', '1 / -1']} p="20" bgc="base-2">A</Box>
|
|
52
|
+
<Box p="20" bgc="green:20%">B</Box>
|
|
53
|
+
<Box p="20" bgc="blue:20%">C</Box>
|
|
54
|
+
</TileGrid>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 関連プリミティブ
|
|
58
|
+
|
|
59
|
+
- [l--columns](./l--columns.md) — 等幅列のみ(1D)のカラム
|
|
60
|
+
- [l--fluidCols](./l--fluidCols.md) — 自動折り返し型段組
|
|
61
|
+
- [l--grid](./l--grid.md) — 汎用 CSS Grid
|
|
@@ -53,7 +53,7 @@ CSS Layer の外(最も高い詳細度)に配置され、`-{prop}(:{value})`
|
|
|
53
53
|
|
|
54
54
|
## 全 Prop 一覧
|
|
55
55
|
|
|
56
|
-
ソース: [props.ts](https://
|
|
56
|
+
ソース: [props.ts](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/config/defaults/props.ts)
|
|
57
57
|
|
|
58
58
|
### タイポグラフィ
|
|
59
59
|
|
|
@@ -98,9 +98,9 @@ CSS Layer の外(最も高い詳細度)に配置され、`-{prop}(:{value})`
|
|
|
98
98
|
| `sz` | `inline-size` | — | — |
|
|
99
99
|
| `min-sz` | `min-inline-size` | — | — |
|
|
100
100
|
| `max-sz` | `max-inline-size` | `-max-sz:xs`, `-max-sz:s`, `-max-sz:m`, `-max-sz:l`, `-max-sz:xl`, `-max-sz:full`, `-max-sz:container` | — |
|
|
101
|
-
| `
|
|
102
|
-
| `min-
|
|
103
|
-
| `max-
|
|
101
|
+
| `bsz` | `block-size` | — | — |
|
|
102
|
+
| `min-bsz` | `min-block-size` | — | — |
|
|
103
|
+
| `max-bsz` | `max-block-size` | — | — |
|
|
104
104
|
|
|
105
105
|
**`max-sz` の特殊クラス:**
|
|
106
106
|
- `-max-sz:full` — `max-inline-size: 100%`。`.set--gutter` 内では gutter 分を含めた全幅に拡張
|
|
@@ -125,7 +125,8 @@ CSS Layer の外(最も高い詳細度)に配置され、`-{prop}(:{value})`
|
|
|
125
125
|
| `keycolor` | `--keycolor` 変数のみ | — | — |
|
|
126
126
|
|
|
127
127
|
セマンティックカラー: `base`, `base-2`, `text`, `text-2`, `divider`, `link`, `brand`, `accent`
|
|
128
|
-
パレットカラー: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `gray`, `white`, `black
|
|
128
|
+
パレットカラー: `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `gray`, `white`, `black`
|
|
129
|
+
キーカラー変数: `keycolor`(ユーザー定義の `--keycolor` を参照する独立変数。詳細は `tokens.md` を参照)
|
|
129
130
|
|
|
130
131
|
### 角丸
|
|
131
132
|
|
|
@@ -270,7 +271,7 @@ SPACE トークン(全値): `5`, `10`, `15`, `20`, `30`, `40`, `50`, `60`, `
|
|
|
270
271
|
|
|
271
272
|
### ボーダー(`bd` 系)
|
|
272
273
|
|
|
273
|
-
[詳細](https://lism-css.com/docs/
|
|
274
|
+
[詳細](https://lism-css.com/docs/property-class/bd/)
|
|
274
275
|
|
|
275
276
|
Lism CSS のボーダーは CSS 変数(`--bds`, `--bdw`, `--bdc`)で管理される特殊な仕様です。
|
|
276
277
|
`-bd` または `-bd-{side}` クラスを付けると、初期値(`--bds: solid`, `--bdw: 1px`, `--bdc: var(--divider)`)がセットされ、`bds`, `bdc`, `bdw` Prop で個別に上書きできます。
|
|
@@ -311,7 +312,7 @@ Lism CSS のボーダーは CSS 変数(`--bds`, `--bdw`, `--bdc`)で管理
|
|
|
311
312
|
|
|
312
313
|
### ホバー(`hov` 系)
|
|
313
314
|
|
|
314
|
-
[詳細](https://lism-css.com/docs/
|
|
315
|
+
[詳細](https://lism-css.com/docs/property-class/hov/)
|
|
315
316
|
|
|
316
317
|
ホバーエフェクト用のクラスです。`-hov:{prop}` 系と `-hov:to:*` 系の2種類があります。
|
|
317
318
|
|
|
@@ -349,7 +350,7 @@ Lism CSS のボーダーは CSS 変数(`--bds`, `--bdw`, `--bdc`)で管理
|
|
|
349
350
|
|
|
350
351
|
```jsx
|
|
351
352
|
// set--hov + set--transition が必要
|
|
352
|
-
<Box set=
|
|
353
|
+
<Box set="hov transition">
|
|
353
354
|
<Box hov={{ to: 'show' }}>ホバーで表示</Box>
|
|
354
355
|
</Box>
|
|
355
356
|
```
|
|
@@ -358,11 +359,11 @@ Lism CSS のボーダーは CSS 変数(`--bds`, `--bdw`, `--bdc`)で管理
|
|
|
358
359
|
|
|
359
360
|
| Prop | CSS プロパティ | プリセット値クラス | BP クラス |
|
|
360
361
|
|------|--------------|-------------|-----|
|
|
361
|
-
| `
|
|
362
|
-
| `
|
|
362
|
+
| `ovw` | `overflow-wrap` | `-ovw:anywhere` | — |
|
|
363
|
+
| `whs` | `white-space` | `-whs:nowrap` | — |
|
|
363
364
|
| `float` | `float` | `-float:left`, `-float:right` | — |
|
|
364
365
|
| `clear` | `clear` | `-clear:both` | — |
|
|
365
|
-
| `
|
|
366
|
+
| `iso` | `isolation` | `-iso:isolate` | — |
|
|
366
367
|
|
|
367
368
|
|
|
368
369
|
## 値の省略形(例外一覧)
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
`@layer lism-base` に属し、特定の機能を有効にするために CSS変数やベーススタイルをセットアップするクラス群です。
|
|
4
4
|
HTML では直接クラスを付与し、Lism コンポーネントでは `set` prop(`set="plain"`, `set="shadow"` 等)で指定します。
|
|
5
5
|
|
|
6
|
+
`set` prop の記法(複数値指定・`-` prefix による除外)は [components-core.md](./components-core.md#共通-props) を参照してください。
|
|
7
|
+
|
|
6
8
|
## TOC
|
|
7
9
|
|
|
8
10
|
- [`set--plain`](#set--plain)
|
|
@@ -11,9 +13,7 @@ HTML では直接クラスを付与し、Lism コンポーネントでは `set`
|
|
|
11
13
|
- [`set--transition`](#set--transition)
|
|
12
14
|
- [`set--gutter`](#set--gutter)
|
|
13
15
|
- [`set--innerRs`](#set--innerrs)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[詳細](https://lism-css.com/docs/set/)
|
|
16
|
+
[詳細](https://lism-css.com/docs/set-class/)
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -23,14 +23,12 @@ HTML では直接クラスを付与し、Lism コンポーネントでは `set`
|
|
|
23
23
|
|
|
24
24
|
| クラス | ソースファイル |
|
|
25
25
|
|--------|---------------|
|
|
26
|
-
| `set--plain` | [`_plain.scss`](https://
|
|
27
|
-
| `set--shadow` | [`_shadow.scss`](https://
|
|
28
|
-
| `set--hov` | [`_hov.scss`](https://
|
|
29
|
-
| `set--transition` | [`_transition.scss`](https://
|
|
30
|
-
| `set--gutter` | [`_gutter.scss`](https://
|
|
31
|
-
| `set--innerRs` | [`_innerRs.scss`](https://
|
|
32
|
-
| `set--bp` | [`_bp.scss`](https://github.com/lism-css/lism-css/blob/main/packages/lism-css/src/scss/base/set/_bp.scss) |
|
|
33
|
-
|
|
26
|
+
| `set--plain` | [`_plain.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/base/set/_plain.scss) |
|
|
27
|
+
| `set--shadow` | [`_shadow.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/base/tokens/_shadow.scss) |
|
|
28
|
+
| `set--hov` | [`_hov.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/base/set/_hov.scss) |
|
|
29
|
+
| `set--transition` | [`_transition.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/base/set/_transition.scss) |
|
|
30
|
+
| `set--gutter` | [`_gutter.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/base/set/_gutter.scss) |
|
|
31
|
+
| `set--innerRs` | [`_innerRs.scss`](https://raw.githubusercontent.com/lism-css/lism-css/main/packages/lism-css/src/scss/base/set/_innerRs.scss) |
|
|
34
32
|
---
|
|
35
33
|
|
|
36
34
|
## `set--plain`
|
|
@@ -84,7 +82,7 @@ HTML では直接クラスを付与し、Lism コンポーネントでは `set`
|
|
|
84
82
|
.-hov\:test {
|
|
85
83
|
color: var(--_isHov, green) var(--_notHov, red); /* hover時はgreen, 非hover時はred*/
|
|
86
84
|
box-shadow: var(--_isHov, var(--bxsh--30)); /* hover時はshadowをつける(非hover時は無効な値) */
|
|
87
|
-
opacity: var(--_notHov, var(--o
|
|
85
|
+
opacity: var(--_notHov, var(--o---20)); /* 非hover時は不透明度を下げる(hover時は無効な値) */
|
|
88
86
|
}
|
|
89
87
|
```
|
|
90
88
|
|
|
@@ -93,7 +91,7 @@ HTML では直接クラスを付与し、Lism コンポーネントでは `set`
|
|
|
93
91
|
例えば、親のボックスがhoverされたら、その内部の画像をズームするようなケースで活用でき、`-hov:to:zoom`クラスが標準で用意されています。
|
|
94
92
|
|
|
95
93
|
```html
|
|
96
|
-
<a href="###" class="l--frame is--
|
|
94
|
+
<a href="###" class="l--frame is--boxLink set--hov -ar:21/9 -ov:hidden">
|
|
97
95
|
<img class="set--transition -hov:to:zoom" src="https://cdn.lism-css.com/img/a-2.jpg" width="960" height="640" loading="lazy" />
|
|
98
96
|
<div class="is--layer -bgc" style="--c: #fff; --bgc: rgb(0 0 0 / 50%)"></div>
|
|
99
97
|
<div class="l--center is--layer -c" style="--c: #fff;">
|
|
@@ -175,16 +173,3 @@ HTML では直接クラスを付与し、Lism コンポーネントでは `set`
|
|
|
175
173
|
```
|
|
176
174
|
|
|
177
175
|
|
|
178
|
-
## `set--bp`
|
|
179
|
-
|
|
180
|
-
ブレークポイント判定用の hack 変数をセットします。コンテナクエリで各ブレークポイントを超えた時に空変数がセットされ、CSS の空変数トリックで条件分岐に使えます。
|
|
181
|
-
`sm`, `md`にのみ対応しています。(`--_is_sm`, `--_is_md`が定義されます。)
|
|
182
|
-
|
|
183
|
-
smサイズ以上でテキストカラーを赤に変える例:
|
|
184
|
-
|
|
185
|
-
```html
|
|
186
|
-
<div class="set--bp -p:20" style="color: var(--_is_sm) red">...</div>
|
|
187
|
-
```
|
|
188
|
-
```jsx
|
|
189
|
-
<Lism set="bp" p="20" style={{ color: 'var(--_is_sm) red;' }}>...</Lism>
|
|
190
|
-
```
|
|
@@ -28,18 +28,17 @@ CSSコードを書く場合やコンポーネントのPropsに値を指定する
|
|
|
28
28
|
|
|
29
29
|
| カテゴリ | トークン値 | CSS変数パターン | 例 |
|
|
30
30
|
|---|---|---|---|
|
|
31
|
-
| 余白 (space) | `5`, `10`, `15`, `20`, `30`, `40`, `50`, `60`, `70`, `80` | `--s{
|
|
31
|
+
| 余白 (space) | `5`, `10`, `15`, `20`, `30`, `40`, `50`, `60`, `70`, `80` | `--s{N}` | `--s20` |
|
|
32
32
|
| フォントサイズ (fz) | `root`, `base`, `2xs`, `xs`, `s`, `m`, `l`, `xl`, `2xl`, `3xl`, `4xl`, `5xl` | `--fz--{key}` | `--fz--l` |
|
|
33
33
|
| ハーフレディング・行間 (lh/hl) | `base`, `xs`, `s`, `l` | `--hl--{key}` | `--hl--s` |
|
|
34
34
|
| 字間 (lts) | `base`, `s`, `l` | `--lts--{key}` | `--lts--s` |
|
|
35
35
|
| フォント (ff) | `base`, `accent`, `mono` | `--ff--{key}` | `--ff--mono` |
|
|
36
36
|
| ウェイト (fw) | `light`, `normal`, `bold` | `--fw--{key}` | `--fw--bold` |
|
|
37
|
-
| 透明度 (o) | `-10`, `-20`, `-30` | `--o--
|
|
37
|
+
| 透明度 (o) | `-10`, `-20`, `-30` | `--o--{-N}` | `--o---10` |
|
|
38
38
|
| 角丸 (bdrs) | `10`, `20`, `30`, `40`, `99`, `inner` | `--bdrs--{key}` | `--bdrs--20` |
|
|
39
|
-
| 影 (bxsh) | `10`, `20`, `30`, `40` | `--bxsh--{
|
|
40
|
-
| サイズ (sz) | `xs`, `s`, `m`, `l`, `xl`, `
|
|
39
|
+
| 影 (bxsh) | `10`, `20`, `30`, `40` | `--bxsh--{N}` | `--bxsh--20` |
|
|
40
|
+
| サイズ (sz) | `xs`, `s`, `m`, `l`, `xl`, `container` | `--sz--{key}` | `--sz--l` |
|
|
41
41
|
| アスペクト比 (ar) | `og` | `--ar--{key}` | `--ar--og` |
|
|
42
|
-
| 書字方向 (writing) | `vertical` | `--writing--{key}` | `--writing--vertical` |
|
|
43
42
|
| フロー余白 (flow) | `s`, `l` | `--flow--{key}` | `--flow--s` |
|
|
44
43
|
| セマンティックカラー (c) | `base`, `base-2`, `text`, `text-2`, `divider`, `link`, `brand`, `accent` | `--{name}` | `--brand` |
|
|
45
44
|
| パレットカラー (palette) | `red`, `blue`, `green`, `yellow`, `purple`, `orange`, `pink`, `gray`, `white`, `black` | `--{name}` | `--red` |
|
|
@@ -135,9 +134,9 @@ CSSコードを書く場合やコンポーネントのPropsに値を指定する
|
|
|
135
134
|
|
|
136
135
|
| CSS変数 | 値 | 説明 |
|
|
137
136
|
|---------|-----|------|
|
|
138
|
-
| `--o
|
|
139
|
-
| `--o
|
|
140
|
-
| `--o
|
|
137
|
+
| `--o---10` | `0.75` | 75%の不透明度 |
|
|
138
|
+
| `--o---20` | `0.5` | 50%の不透明度 |
|
|
139
|
+
| `--o---30` | `0.25` | 25%の不透明度 |
|
|
141
140
|
|
|
142
141
|
|
|
143
142
|
## 角丸 (bdrs)
|
|
@@ -154,7 +153,7 @@ CSSコードを書く場合やコンポーネントのPropsに値を指定する
|
|
|
154
153
|
|
|
155
154
|
## 影 (bxsh)
|
|
156
155
|
|
|
157
|
-
`--shc`(シャドウカラー: `hsl(220 4% 8% / 5%)`)と `--shsz--{
|
|
156
|
+
`--shc`(シャドウカラー: `hsl(220 4% 8% / 5%)`)と `--shsz--{N}`(シャドウサイズ)を組み合わせた複合シャドウ。使用時は `set--shadow` クラスの併用が必要(影色 `--shc` の再計算のため)。
|
|
158
157
|
|
|
159
158
|
| CSS変数 | 値 | 説明 |
|
|
160
159
|
|---------|-----|------|
|
|
@@ -198,6 +197,24 @@ OKLCH で定義されたカラーパレット。`--L`(明度)と `--C`(彩
|
|
|
198
197
|
| `--black` | `#000` |
|
|
199
198
|
| `--white` | `#fff` |
|
|
200
199
|
|
|
200
|
+
### キーカラー変数 (`--keycolor`)
|
|
201
|
+
|
|
202
|
+
`--keycolor` は、カラートークンとは性質が異なる。初めから値があるわけではない。ボックス全体のカラーリングなどを行う際の「軸となる色」を指定するための変数。
|
|
203
|
+
|
|
204
|
+
`--keycolor: var(--red)` のように指定しておくことで、そのボックス自身や子要素のカラー Props(`c`, `bgc`, `bdc` など)で 特定の色をハードコーディングせずに `--keycolor` 経由で参照できるようにすることができる。代表的な使用例は `u--cbox` ユーティリティクラス。
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<!-- ボックスにキーカラーを設定、テキストをキーカラーに連動させる例 -->
|
|
208
|
+
<div class="u--cbox" style="--keycolor: var(--red)">
|
|
209
|
+
<p class="-c" style="-c:var(--keycolor)">...</p>
|
|
210
|
+
</div>
|
|
211
|
+
```
|
|
212
|
+
```jsx
|
|
213
|
+
<Lism class="u--cbox" keycolor="var(--red)">
|
|
214
|
+
<Text c="keycolor">...</Text>
|
|
215
|
+
</Lism>
|
|
216
|
+
```
|
|
217
|
+
|
|
201
218
|
- `c`, `bgc` 等のカラー系 Props では、セマンティックカラー → パレットカラーの順で検索される
|
|
202
219
|
- どちらも最終的に `var(--{name})` に変換される
|
|
203
220
|
|
|
@@ -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://
|
|
28
|
-
| `u--trimChildren` | 子要素すべてにハーフレディングトリムを適用(`img`, `figure`, `button` は除外) | [`_trimHL.scss`](https://
|
|
29
|
-
| `u--cbox` | `--keycolor` を使い `color-mix()` で `--c` / `--bgc` / `--bdc` を自動生成する色付きボックス | [`_cbox.scss`](https://
|
|
30
|
-
| `u--collapseGrid` | Grid / Flex の子要素間に `box-shadow` で境界線を表現する | [`_itemDivider.scss`](https://
|
|
31
|
-
| `u--
|
|
32
|
-
| `u--
|
|
33
|
-
| `u--
|
|
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,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
|
|
40
|
+
return walkMarkdownFiles(guidesDir);
|
|
23
41
|
}
|
|
24
42
|
/** 起動時に全ガイドを一括読み込みしてキャッシュに載せる */
|
|
25
43
|
export function preloadGuides() {
|
package/dist/lib/search.js
CHANGED
|
@@ -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
|
|
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/DummyText.mdx` → `ui/dummytext`
|
|
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 形式の問い合わせには componentAliasMap のみを照合し、
|
|
30
|
+
* クラス専用プリミティブへの false positive を避けるために分離している。 */
|
|
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
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
// クラス専用プリミティブへの 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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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(`<${
|
|
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
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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([...
|
|
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,
|
package/dist/tools/get-guide.js
CHANGED
|
@@ -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
|
-
'
|
|
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', '
|
|
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 と同じインターフェースを返す。
|