ksk-design-system 1.40.0 → 1.40.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.
- package/AGENTS.md +2 -0
- package/CLAUDE.md +7 -2
- package/DESIGN.md +22 -7
- package/contracts/components.json +22 -3
- package/contracts/design-context.json +136 -0
- package/dist/index.js +2920 -2722
- package/dist/native/ui.js +470 -451
- package/dist/types/components/patterns/admin/data-table.d.ts +50 -16
- package/dist/types/components/ui/progress.d.ts +19 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/native/components/Progress.d.ts +13 -2
- package/dist/types/native/components/index.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/COMPONENT_LOOKUP.md +5 -5
package/AGENTS.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
```
|
|
18
18
|
contracts/rules.json # 禁止パターン32件・AIアンチパターン10件・a11y要件
|
|
19
19
|
contracts/components.json # 全112コンポーネントの定義・バリアント・ルール
|
|
20
|
+
contracts/design-context.json # DESIGN.md と正本ファイルの関係・AI向け検査方針
|
|
20
21
|
tokens.json # カラー・スペーシング・シャドウトークン
|
|
21
22
|
src/components/COMPONENT_LOOKUP.md # バリアント・インポートパス一覧(自動生成)
|
|
22
23
|
```
|
|
@@ -92,6 +93,7 @@ Brand色を差し替え(10行)→ Primitive Layer → Semantic Layer → Bri
|
|
|
92
93
|
| **AGENTS.md**(本ファイル) | 概要・技術スタック・コマンド・クイックスタート |
|
|
93
94
|
| **contracts/components.json** | 全112コンポーネントの構造化定義(バリアント・アクセシビリティ要件) |
|
|
94
95
|
| **contracts/rules.json** | 禁止パターン32件・AIアンチパターン10件・アクセシビリティ要件 |
|
|
96
|
+
| **contracts/design-context.json** | `DESIGN.md` の役割・正本ファイル・外部 DESIGN.md 参照方針 |
|
|
95
97
|
| **tokens.json** | カラー・スペーシング・シャドウトークンの機械可読定義 |
|
|
96
98
|
| **src/components/COMPONENT_LOOKUP.md** | 全112コンポーネントのバリアント・インポートパス(自動生成) |
|
|
97
99
|
| **DESIGN.md** | AI エージェント向け視覚言語サマリ(トークン+意図・voice・motion) |
|
package/CLAUDE.md
CHANGED
|
@@ -59,6 +59,7 @@ Brand色を差し替え(10行)→ Primitive Layer → Semantic Layer → Bri
|
|
|
59
59
|
| **AGENTS.md** | 同上(Codex用。セッション開始時の読み込み指示・編集後コマンドを明記) |
|
|
60
60
|
| **contracts/components.json** | 全112コンポーネントの構造化定義(バリアント・アクセシビリティ要件) |
|
|
61
61
|
| **contracts/rules.json** | 禁止パターン32件・AIアンチパターン10件・アクセシビリティ要件 |
|
|
62
|
+
| **contracts/design-context.json** | `DESIGN.md` の役割・正本ファイル・外部 DESIGN.md 参照方針 |
|
|
62
63
|
| **tokens.json** | カラー・スペーシング・シャドウトークンの機械可読定義 |
|
|
63
64
|
| **src/components/COMPONENT_LOOKUP.md** | 全112コンポーネントのバリアント・インポートパス一覧(自動生成) |
|
|
64
65
|
| **DESIGN.md** | AI エージェント向け視覚言語サマリ(トークン+意図・voice・motion) |
|
|
@@ -66,8 +67,9 @@ Brand色を差し替え(10行)→ Primitive Layer → Semantic Layer → Bri
|
|
|
66
67
|
**セッション開始時 / コードを書く前に必ず読む:**
|
|
67
68
|
1. `contracts/rules.json` の `prohibited` と `aiPatterns`(AIが典型的に犯すパターン集)を確認
|
|
68
69
|
2. `contracts/components.json` でコンポーネント定義・バリアントを確認
|
|
69
|
-
3. `
|
|
70
|
-
4. `
|
|
70
|
+
3. `contracts/design-context.json` で `DESIGN.md` と正本ファイルの関係を確認
|
|
71
|
+
4. `src/components/COMPONENT_LOOKUP.md` で既存コンポーネントを確認(手書き・再定義の防止)
|
|
72
|
+
5. `tokens.json` でカラー・余白・影・タイポのトークンを確認
|
|
71
73
|
|
|
72
74
|
**`.tsx` を編集したら `bash scripts/lint-scratch.sh`、コンポーネント増減時は `npm run check` を実行すること。**
|
|
73
75
|
|
|
@@ -114,6 +116,9 @@ bash scripts/check-drift.sh
|
|
|
114
116
|
# COMPONENT_LOOKUP.md 再生成(コンポーネント追加後に実行)
|
|
115
117
|
npm run generate:lookup
|
|
116
118
|
|
|
119
|
+
# DESIGN.md contract 検査
|
|
120
|
+
npm run lint:design
|
|
121
|
+
|
|
117
122
|
# 全チェック(tsc + lint + drift + lookup 一括)
|
|
118
123
|
npm run check
|
|
119
124
|
```
|
package/DESIGN.md
CHANGED
|
@@ -32,7 +32,7 @@ colors:
|
|
|
32
32
|
info: "#2563EB"
|
|
33
33
|
typography:
|
|
34
34
|
fontFamily: "system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', sans-serif"
|
|
35
|
-
display: { fontSize: "48px", lineHeight: "1.
|
|
35
|
+
display: { fontSize: "48px", lineHeight: "1.25", fontWeight: 700 } # typo-display-xl
|
|
36
36
|
heading: { fontSize: "18px", lineHeight: "1.5", fontWeight: 700 } # typo-heading-lg(基準)
|
|
37
37
|
body: { fontSize: "14px", lineHeight: "1.75", fontWeight: 400 } # typo-body-md(基準)
|
|
38
38
|
label: { fontSize: "12px", lineHeight: "1.5", fontWeight: 500 } # typo-label-sm
|
|
@@ -45,12 +45,12 @@ rounded:
|
|
|
45
45
|
full: "9999px" # Button / Chip
|
|
46
46
|
spacing:
|
|
47
47
|
unit: "4px" # 4px グリッド(scale: 0,4,8,12,16,20,24,28,32,36,40,44,48,...)
|
|
48
|
-
page: "16px" #
|
|
48
|
+
page: "16px" # 基準画面端マージン。実レイアウトは Screen / Shell の padding contract を優先
|
|
49
49
|
elevation: # 影色は neutral(Gray-900 ベース rgba(17,24,39,…))でテーマ非依存
|
|
50
|
-
sm: "0 1px 2px rgba(0,0,0,0.05)"
|
|
51
|
-
md: "0 0 8px rgba(20,20,20,0.08)"
|
|
52
|
-
lg: "
|
|
53
|
-
dialog: "
|
|
50
|
+
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
|
|
51
|
+
md: "0 0 8px rgba(20, 20, 20, 0.08)"
|
|
52
|
+
lg: "0px 12px 32px -4px rgba(17, 24, 39, 0.12), 0px 8px 16px -6px rgba(17, 24, 39, 0.12)"
|
|
53
|
+
dialog: "0px 12px 32px -4px rgba(17, 24, 39, 0.12), 0px 8px 16px -6px rgba(17, 24, 39, 0.12), 0px 1px 4px 1px rgba(0, 0, 0, 0.2)"
|
|
54
54
|
motion:
|
|
55
55
|
microIn: "150ms ease-out" # fade-in / scale-in
|
|
56
56
|
enter: "200ms ease-out" # fade-in-up / slide-in
|
|
@@ -93,6 +93,21 @@ EC/BtoC 系)を回すのが狙い。
|
|
|
93
93
|
- **基盤**: React 19 + Tailwind v4 + shadcn/Radix + iconsax。
|
|
94
94
|
- **判断基準**: 色・余白・タイポは必ずトークン経由。生の値を書かない(後述 Do/Don't)。
|
|
95
95
|
|
|
96
|
+
## Source Of Truth
|
|
97
|
+
|
|
98
|
+
`DESIGN.md` は Google DESIGN.md の「front matter + rationale」形式を参考にした **AI 向け配布サマリ**であり、
|
|
99
|
+
実装正本ではない。KSK の正本は次のファイルに置く。
|
|
100
|
+
|
|
101
|
+
- `tokens.json`: primitive / semantic / dark semantic / typography / spacing / shadow / touch target。
|
|
102
|
+
- `src/styles/*.css`: 実際に publish される CSS custom properties と typography / glass utilities。
|
|
103
|
+
- `contracts/rules.json`: 禁止パターン、AI anti-pattern、a11y、consumer lint の正本。
|
|
104
|
+
- `contracts/components.json`: component 名、variant、subcomponent、usage rule、件数の正本。
|
|
105
|
+
- `src/components/COMPONENT_LOOKUP.md`: import map、Storybook coverage、DS-first recipe の生成済み索引。
|
|
106
|
+
|
|
107
|
+
Google DESIGN.md は互換フォーマットと検査観点の参照に留める。Google 側の alpha schema / CLI を
|
|
108
|
+
KSK の必須正本・publish 依存にせず、KSK 固有の multi-theme / native / categorical / component contract は
|
|
109
|
+
`contracts/design-context.json` と repo 内 checker で管理する。
|
|
110
|
+
|
|
96
111
|
## Colors
|
|
97
112
|
|
|
98
113
|
3層トークン。コンポーネントは**必ず Semantic 層を `var()` で参照**する(Primitive 直参照・生 hex 禁止)。
|
|
@@ -125,7 +140,7 @@ EC/BtoC 系)を回すのが狙い。
|
|
|
125
140
|
## Layout & Spacing
|
|
126
141
|
|
|
127
142
|
- **4px グリッド**。余白・サイズは 4 の倍数(scale 0–60)。
|
|
128
|
-
- 画面端マージン: `
|
|
143
|
+
- 画面端マージン: 16px を基準にしつつ、実レイアウトでは `Screen` / shell component の padding contract を優先する。
|
|
129
144
|
- **タッチターゲット**(モバイル): WCAG 2.5.5 / Apple HIG に従い主要操作(ボタン/アイコンボタン/入力/ナビ)の
|
|
130
145
|
**min は 44px** 以上、推奨 48px。44 未満が避けられない **チップ(min 32px)は hitSlop**(不可視の拡張タップ領域)で
|
|
131
146
|
実効 44px を確保する。値の正本は `tokens.json` の `touchTargets`。
|
|
@@ -317,9 +317,16 @@
|
|
|
317
317
|
{
|
|
318
318
|
"name": "Progress",
|
|
319
319
|
"path": "src/components/ui/progress.tsx",
|
|
320
|
-
"description": "進捗バー。color variant (default/success/warning/caution) + transition duration (none/sm/md/lg)
|
|
320
|
+
"description": "進捗バー。color variant (default/success/warning/caution) + transition duration (none/sm/md/lg) + autoColor 閾値切替に対応。",
|
|
321
|
+
"features": [
|
|
322
|
+
"color-variants",
|
|
323
|
+
"transition-duration",
|
|
324
|
+
"auto-color-thresholds"
|
|
325
|
+
],
|
|
321
326
|
"rules": [
|
|
322
|
-
"
|
|
327
|
+
"値に応じた色切替は autoColor を使い、consumer 側で個別に if 文と className を重ねない",
|
|
328
|
+
"autoColor=true の既定閾値は 80% 以上 warning、100% 以上 caution",
|
|
329
|
+
"しきい値がアプリごとに違う場合は autoColor={{ successBelow, warningFrom, warningBelow, cautionFrom }} を使う",
|
|
323
330
|
"達成カード等は transitionDuration=\"lg\" で緩やかに"
|
|
324
331
|
]
|
|
325
332
|
},
|
|
@@ -1728,18 +1735,30 @@
|
|
|
1728
1735
|
"edit-trigger",
|
|
1729
1736
|
"rich-column-helpers",
|
|
1730
1737
|
"date-column",
|
|
1738
|
+
"date-cell",
|
|
1731
1739
|
"chip-column",
|
|
1732
1740
|
"select-column",
|
|
1741
|
+
"select-popper-position",
|
|
1733
1742
|
"sort",
|
|
1734
1743
|
"checkbox",
|
|
1735
1744
|
"actions",
|
|
1745
|
+
"row-click",
|
|
1746
|
+
"full-cell-hit-area",
|
|
1736
1747
|
"inline-edit",
|
|
1748
|
+
"flexible-column-width",
|
|
1737
1749
|
"drag",
|
|
1738
|
-
"section-row"
|
|
1750
|
+
"section-row",
|
|
1751
|
+
"section-sticky-left",
|
|
1752
|
+
"section-heading-emphasis"
|
|
1739
1753
|
],
|
|
1740
1754
|
"rules": [
|
|
1741
1755
|
"rows/columns API は最短実装向け",
|
|
1742
1756
|
"DateField / Chip cluster / typed Select などのリッチ列は cell と edit.trigger、または createDataTableDateColumn / createDataTableChipColumn / createDataTableSelectColumn を使う",
|
|
1757
|
+
"行全体をクリック可能にする場合は DataTable の onRowClick または DataTableRow の onRowClick を使い、独自の tr/td クリック実装を作らない",
|
|
1758
|
+
"Select セルは DataTableSelectCell または createDataTableSelectColumn を使い、ポップオーバー位置は contentPosition で調整する",
|
|
1759
|
+
"日付編集セルは DataTableDateCell または createDataTableDateColumn を使う",
|
|
1760
|
+
"残り幅を受け持つ列は width=\"flex\" を使い、手書き className の w-full/min-w 再実装を避ける",
|
|
1761
|
+
"セクション見出しを横スクロール中も左に残す場合は DataTableSectionRow stickyLeft / headingSize を使う",
|
|
1743
1762
|
"複雑なテーブル全体構成は DataTableHead, DataTableRow, DataTableCell などのサブコンポーネントを使う"
|
|
1744
1763
|
]
|
|
1745
1764
|
},
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"name": "KSK Design System — Agent Design Context",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "AI エージェント向け DESIGN.md の扱いと、KSK 固有の正本・検査方針を定義する。Google DESIGN.md は互換入口として参照し、KSK の正本は tokens / contracts / CSS に置く。"
|
|
6
|
+
},
|
|
7
|
+
"canonicalSources": [
|
|
8
|
+
{
|
|
9
|
+
"path": "tokens.json",
|
|
10
|
+
"owns": [
|
|
11
|
+
"primitive colors",
|
|
12
|
+
"semantic colors",
|
|
13
|
+
"dark semantic colors",
|
|
14
|
+
"typography",
|
|
15
|
+
"spacing scale",
|
|
16
|
+
"border radius scale",
|
|
17
|
+
"shadows",
|
|
18
|
+
"touch targets"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "src/styles/*.css",
|
|
23
|
+
"owns": [
|
|
24
|
+
"published CSS custom properties",
|
|
25
|
+
"typography utilities",
|
|
26
|
+
"glass utilities",
|
|
27
|
+
"categorical token CSS"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"path": "contracts/rules.json",
|
|
32
|
+
"owns": [
|
|
33
|
+
"prohibited patterns",
|
|
34
|
+
"AI anti-patterns",
|
|
35
|
+
"accessibility rules",
|
|
36
|
+
"consumer lint rules"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"path": "contracts/components.json",
|
|
41
|
+
"owns": [
|
|
42
|
+
"component names",
|
|
43
|
+
"variants",
|
|
44
|
+
"subcomponents",
|
|
45
|
+
"usage rules",
|
|
46
|
+
"component counts"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "src/components/COMPONENT_LOOKUP.md",
|
|
51
|
+
"owns": [
|
|
52
|
+
"generated import map",
|
|
53
|
+
"storybook coverage hints",
|
|
54
|
+
"DS-first recipes"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"designMd": {
|
|
59
|
+
"role": "AI 向けの視覚言語サマリ。実装正本ではなく、正本から検査される配布・参照レイヤー。",
|
|
60
|
+
"frontMatterRole": "Google DESIGN.md 互換の機械可読サマリ。KSK の主要 token を抽出して agent が読みやすい粒度にする。",
|
|
61
|
+
"bodyRole": "KSK の設計意図、使い分け、禁止事項を説明する rationale。",
|
|
62
|
+
"updatePolicy": "tokens.json / contracts/*.json / src/styles/*.css の変更で DESIGN.md の記述が古くなる場合は同じ PR で更新する。",
|
|
63
|
+
"googleDesignMdPolicy": "Google DESIGN.md の思想・検査観点・export 形式は参照する。ただし alpha 仕様や CLI を KSK の必須正本・runtime 依存にしない。"
|
|
64
|
+
},
|
|
65
|
+
"externalReferences": [
|
|
66
|
+
{
|
|
67
|
+
"name": "Google DESIGN.md",
|
|
68
|
+
"url": "https://github.com/google-labs-code/design.md",
|
|
69
|
+
"status": "optional-reference",
|
|
70
|
+
"adopt": [
|
|
71
|
+
"front matter + markdown rationale の二層構造",
|
|
72
|
+
"broken token reference check",
|
|
73
|
+
"section order check",
|
|
74
|
+
"agent-readable JSON findings",
|
|
75
|
+
"Tailwind v4 / DTCG export という互換出口の考え方"
|
|
76
|
+
],
|
|
77
|
+
"doNotAdoptAsCanonical": [
|
|
78
|
+
"Google schema を KSK の完全正本にすること",
|
|
79
|
+
"Google CLI を publish / CI の必須依存にすること",
|
|
80
|
+
"KSK 固有の multi-theme / native / component contracts を Google alpha schema に従属させること"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"guardrails": {
|
|
85
|
+
"requiredSections": [
|
|
86
|
+
"Overview",
|
|
87
|
+
"Source Of Truth",
|
|
88
|
+
"Colors",
|
|
89
|
+
"Typography",
|
|
90
|
+
"Layout & Spacing",
|
|
91
|
+
"Elevation & Depth",
|
|
92
|
+
"Shapes",
|
|
93
|
+
"Motion",
|
|
94
|
+
"Components",
|
|
95
|
+
"Voice & Tone",
|
|
96
|
+
"Do's and Don'ts"
|
|
97
|
+
],
|
|
98
|
+
"requiredSourceMentions": [
|
|
99
|
+
"tokens.json",
|
|
100
|
+
"src/styles/*.css",
|
|
101
|
+
"contracts/rules.json",
|
|
102
|
+
"contracts/components.json",
|
|
103
|
+
"src/components/COMPONENT_LOOKUP.md",
|
|
104
|
+
"Google DESIGN.md"
|
|
105
|
+
],
|
|
106
|
+
"requiredFrontMatterPaths": [
|
|
107
|
+
"version",
|
|
108
|
+
"name",
|
|
109
|
+
"colors.primary",
|
|
110
|
+
"colors.primaryAction",
|
|
111
|
+
"colors.surface",
|
|
112
|
+
"colors.textHigh",
|
|
113
|
+
"colors.border",
|
|
114
|
+
"colors.focus",
|
|
115
|
+
"typography.display.fontSize",
|
|
116
|
+
"typography.display.lineHeight",
|
|
117
|
+
"typography.body.fontSize",
|
|
118
|
+
"rounded.surface",
|
|
119
|
+
"rounded.modal",
|
|
120
|
+
"rounded.sheet",
|
|
121
|
+
"spacing.unit",
|
|
122
|
+
"elevation.md",
|
|
123
|
+
"components.button.background",
|
|
124
|
+
"components.card.background",
|
|
125
|
+
"components.dialog.rounded"
|
|
126
|
+
],
|
|
127
|
+
"checks": [
|
|
128
|
+
"DESIGN.md front matter が存在すること",
|
|
129
|
+
"front matter 内の {path.to.token} 参照が解決できること",
|
|
130
|
+
"主要 colors / typography / radius / elevation が tokens.json と src/preset.css から導出した値と一致すること",
|
|
131
|
+
"body の ## セクションが requiredSections の順序を保つこと",
|
|
132
|
+
"body が KSK の正本ファイルと Google DESIGN.md の参照方針を明示すること",
|
|
133
|
+
"front matter の components.* が contracts/components.json に存在する component を指すこと"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
}
|