ksk-design-system 1.35.0 → 1.37.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/README.md CHANGED
@@ -14,7 +14,8 @@
14
14
  - **アクセシブル** — shadcn/ui(Radix UI ベース)+ `@storybook/addon-a11y` で a11y を担保
15
15
  - **Tailwind CSS v4 ネイティブ** — `@theme` ベースのトークン設計
16
16
  - **型安全** — React 19 + TypeScript、CVA によるバリアント管理
17
- - **110 コンポーネント** — 汎用 UI 55 / EC 11 / 管理画面系 8 / レイアウトシェル 3 / 汎用パターン 33
17
+ - **110 + 91 コンポーネント** — Web 110(UI 55 / EC 11 / 管理 8 / シェル 3 / パターン 33)+ React Native 91
18
+ - **iOS 26 Liquid Glass 対応** — RN 側 `GlassView` + `Button variant="glass"`、Web 側 `.glass` CSS マテリアル
18
19
 
19
20
  ## 🎨 テーマ
20
21
 
@@ -35,6 +36,12 @@ React 19 + TypeScript / Vite / **Tailwind CSS v4** / shadcn/ui(Radix UI)/ CV
35
36
 
36
37
  ## 🚀 使い方
37
38
 
39
+ ### Web (Next.js / Vite / 任意の React 環境)
40
+
41
+ ```bash
42
+ npm install ksk-design-system
43
+ ```
44
+
38
45
  ```css
39
46
  /* プロジェクトの CSS */
40
47
  @import "ksk-design-system/preset";
@@ -47,11 +54,55 @@ import { Button, Card, Input, FormField } from "ksk-design-system"
47
54
 
48
55
  新規クライアント案件では、テーマファイルで `--Primitive-Brand-500` などブランドカラーの 10 行を定義するだけで、全コンポーネントがそのブランドカラーで動作します。
49
56
 
50
- > **インストールについて**: 現在は npm 未公開です。まずは上のライブ Storybook でコンポーネントと挙動をご確認ください。npm パッケージとしての配布を準備中です。
57
+ ### React Native / Expo
58
+
59
+ `ksk-design-system/native/ui` から直接 RN 用コンポーネント(91 個)を import できます。iOS 26 の **Liquid Glass** にも対応:
60
+
61
+ ```tsx
62
+ import { ThemeProvider, Button, Card, GlassView } from "ksk-design-system/native/ui"
63
+ ```
64
+
65
+ ```bash
66
+ # Liquid Glass を本物の UIVisualEffectView で出したい場合
67
+ npx expo install expo-blur
68
+ ```
69
+
70
+ Web は backdrop-filter で擬似、Android は半透明 surface でフォールバックします。
71
+
72
+ ## 🧪 試してみる(1コマンドお試し)
73
+
74
+ ```bash
75
+ npx ksk-design-system demo
76
+ cd ksk-ds-demo
77
+ npm run dev # → http://localhost:5173 で全プロトタイプ
78
+ # or
79
+ npm run storybook # → http://localhost:6010 で全コンポーネントカタログ
80
+ ```
81
+
82
+ `npx ksk-design-system demo my-trial` のように引数で名前指定もできます。
83
+ 中身は git clone + npm install を自動でやるだけなので、もちろん手動でもOK:
84
+
85
+ ```bash
86
+ git clone https://github.com/ekusiek716/ksk-design-system.git
87
+ cd ksk-design-system && npm install
88
+ ```
89
+
90
+ ### Notion 仕様からモック自動生成(オプション)
91
+
92
+ Claude Code をこのリポで開いて:
93
+
94
+ ```
95
+ /mock https://notion.so/your-spec
96
+ # or
97
+ /mock 「ECサイトの商品詳細画面、カート追加と画像ギャラリー付き」
98
+ ```
99
+
100
+ DS コンポーネントを最大限活用したモックが `src/prototypes/` に生成され、`http://localhost:5173` のプレビューに即反映されます。スクラッチで UI を組まず、既存コンポーネントを組み合わせて作るのでブレません。
51
101
 
52
102
  ## 📖 ドキュメント
53
103
 
54
104
  - **ライブ Storybook**: https://ksk-design-system.vercel.app — 全コンポーネントのバリアント・テーマ切り替えを操作可能
105
+ - **npm**: https://www.npmjs.com/package/ksk-design-system
55
106
  - 設計思想・トークン体系の詳細は `CLAUDE.md` / `DESIGN.md` を参照
56
107
 
57
108
  ## 📄 ライセンス
package/bin/init.js CHANGED
@@ -1,19 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // ksk-design-system init
3
+ // ksk-design-system CLI
4
4
  // Consumer プロジェクトに AI (Claude / Codex) 向けルールファイルを設置する。
5
5
  // AI エージェントは node_modules 配下のファイルを自動で読まないため、
6
6
  // プロジェクトルートに AGENTS.md / CLAUDE.md(node_modules 内の DS ルールを
7
7
  // 参照する薄いポインタ)を置く必要がある。
8
8
  //
9
9
  // Usage:
10
- // npx ksk-ds init # AGENTS.md + CLAUDE.md を設置
11
- // npx ksk-ds init --force # 既存ファイルを上書き
12
- // npx ksk-ds postinstall # npm postinstall から呼ばれる silent モード
10
+ // npx ksk-design-system init # AGENTS.md + CLAUDE.md を設置
11
+ // npx ksk-design-system init --force # 既存ファイルを上書き
12
+ // npx ksk-design-system demo [dir] # DS リポを clone + setup(お試し用)
13
+ // npx ksk-design-system postinstall # npm postinstall から呼ばれる silent モード
13
14
 
14
15
  import { copyFileSync, existsSync } from "node:fs"
15
16
  import { dirname, join, resolve } from "node:path"
16
17
  import { fileURLToPath } from "node:url"
18
+ import { spawnSync } from "node:child_process"
17
19
 
18
20
  const __dirname = dirname(fileURLToPath(import.meta.url))
19
21
  const pkgRoot = resolve(__dirname, "..")
@@ -26,18 +28,78 @@ if (cmd === "help" || cmd === "--help" || cmd === "-h") {
26
28
  console.log(`ksk-design-system CLI
27
29
 
28
30
  使い方:
29
- npx ksk-ds init AI ルールファイルを設置
30
- npx ksk-ds init --force 既存ファイルを上書き
31
+ npx ksk-design-system init AI ルールファイルを設置
32
+ npx ksk-design-system init --force 既存ファイルを上書き
33
+ npx ksk-design-system demo [dir] DS リポを clone + npm install(お試し)
34
+ dir 省略時は ./ksk-ds-demo
31
35
  `)
32
36
  process.exit(0)
33
37
  }
34
38
 
39
+ if (cmd === "demo") {
40
+ runDemo(args.slice(1))
41
+ process.exit(0)
42
+ }
43
+
35
44
  if (cmd !== "init" && cmd !== "postinstall") {
36
45
  console.error(`未知のコマンド: ${cmd}`)
37
- console.error(`npx ksk-ds help を参照してください`)
46
+ console.error(`npx ksk-design-system help を参照してください`)
38
47
  process.exit(1)
39
48
  }
40
49
 
50
+ function runDemo(rest) {
51
+ const consumerCwd = process.cwd()
52
+ const targetDir = rest.find((a) => !a.startsWith("--")) || "ksk-ds-demo"
53
+ const absDir = resolve(consumerCwd, targetDir)
54
+
55
+ if (existsSync(absDir)) {
56
+ console.error(`\n✗ ${absDir} は既に存在します`)
57
+ console.error(` 別名を指定するか、既存フォルダを削除してください`)
58
+ process.exit(1)
59
+ }
60
+
61
+ console.log(`\n📦 KSK Design System Demo を ${targetDir}/ に展開します\n`)
62
+
63
+ // git clone --depth=1
64
+ const cloneRes = spawnSync(
65
+ "git",
66
+ [
67
+ "clone",
68
+ "--depth=1",
69
+ "https://github.com/ekusiek716/ksk-design-system.git",
70
+ targetDir,
71
+ ],
72
+ { stdio: "inherit", cwd: consumerCwd },
73
+ )
74
+ if (cloneRes.status !== 0) {
75
+ console.error("\n✗ git clone に失敗しました")
76
+ process.exit(1)
77
+ }
78
+
79
+ // npm install
80
+ console.log(`\n→ npm install を実行中(数分かかります)...\n`)
81
+ const instRes = spawnSync("npm", ["install"], {
82
+ stdio: "inherit",
83
+ cwd: absDir,
84
+ })
85
+ if (instRes.status !== 0) {
86
+ console.error("\n✗ npm install に失敗しました")
87
+ process.exit(1)
88
+ }
89
+
90
+ console.log(`\n✓ セットアップ完了\n`)
91
+ console.log(`次のステップ:\n`)
92
+ console.log(` cd ${targetDir}`)
93
+ console.log(` npm run dev # → http://localhost:5173 で全プロトタイプが触れる`)
94
+ console.log(` npm run storybook # → http://localhost:6010 で全コンポーネントカタログ`)
95
+ console.log(``)
96
+ console.log(`💡 Claude Code をこのディレクトリで開くと /mock コマンドが使えます:`)
97
+ console.log(` /mock https://notion.so/your-spec`)
98
+ console.log(` /mock 「ECサイトの商品詳細画面」`)
99
+ console.log(` → DS 準拠のモックが src/prototypes/ に自動生成`)
100
+ console.log(``)
101
+ }
102
+
41
103
  // ─── postinstall モードのガード ─────────────────────────────
42
104
  // INIT_CWD は npm install が実行されたディレクトリ(consumer のルート)。
43
105
  // 未設定、または pkgRoot と同じ場合は DS 自身のインストールコンテキストなのでスキップ。