sparkle-design 0.9.0 → 1.0.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.en.md +77 -157
- package/README.md +77 -157
- package/package.json +32 -2
- package/dist/components/ui/badge/index.figma.d.ts +0 -1
- package/dist/components/ui/badge/index.figma.js +0 -28
- package/dist/components/ui/breadcrumb/index.figma.d.ts +0 -1
- package/dist/components/ui/breadcrumb/index.figma.js +0 -28
- package/dist/components/ui/button/index.figma.d.ts +0 -1
- package/dist/components/ui/button/index.figma.js +0 -59
- package/dist/components/ui/card/index.figma.d.ts +0 -1
- package/dist/components/ui/card/index.figma.js +0 -28
- package/dist/components/ui/checkbox/index.figma.d.ts +0 -1
- package/dist/components/ui/checkbox/index.figma.js +0 -34
- package/dist/components/ui/dialog/index.figma.d.ts +0 -1
- package/dist/components/ui/dialog/index.figma.js +0 -21
- package/dist/components/ui/divider/index.figma.d.ts +0 -1
- package/dist/components/ui/divider/index.figma.js +0 -39
- package/dist/components/ui/form/index.figma.d.ts +0 -1
- package/dist/components/ui/form/index.figma.js +0 -129
- package/dist/components/ui/icon/index.figma.d.ts +0 -1
- package/dist/components/ui/icon/index.figma.js +0 -1858
- package/dist/components/ui/icon-button/index.figma.d.ts +0 -1
- package/dist/components/ui/icon-button/index.figma.js +0 -43
- package/dist/components/ui/inline-message/index.figma.d.ts +0 -1
- package/dist/components/ui/inline-message/index.figma.js +0 -26
- package/dist/components/ui/input/index.figma.d.ts +0 -1
- package/dist/components/ui/input/index.figma.js +0 -36
- package/dist/components/ui/input-password/index.figma.d.ts +0 -1
- package/dist/components/ui/input-password/index.figma.js +0 -36
- package/dist/components/ui/link/index.figma.d.ts +0 -1
- package/dist/components/ui/link/index.figma.js +0 -22
- package/dist/components/ui/modal/index.figma.d.ts +0 -1
- package/dist/components/ui/modal/index.figma.js +0 -61
- package/dist/components/ui/overlay/index.figma.d.ts +0 -1
- package/dist/components/ui/overlay/index.figma.js +0 -14
- package/dist/components/ui/radio/index.figma.d.ts +0 -1
- package/dist/components/ui/radio/index.figma.js +0 -63
- package/dist/components/ui/select/index.figma.d.ts +0 -1
- package/dist/components/ui/select/index.figma.js +0 -30
- package/dist/components/ui/skeleton/index.figma.d.ts +0 -1
- package/dist/components/ui/skeleton/index.figma.js +0 -14
- package/dist/components/ui/slider/index.figma.d.ts +0 -1
- package/dist/components/ui/slider/index.figma.js +0 -28
- package/dist/components/ui/spinner/index.figma.d.ts +0 -1
- package/dist/components/ui/spinner/index.figma.js +0 -16
- package/dist/components/ui/switch/index.figma.d.ts +0 -1
- package/dist/components/ui/switch/index.figma.js +0 -27
- package/dist/components/ui/tabs/index.figma.d.ts +0 -1
- package/dist/components/ui/tabs/index.figma.js +0 -55
- package/dist/components/ui/tag/index.figma.d.ts +0 -1
- package/dist/components/ui/tag/index.figma.js +0 -32
- package/dist/components/ui/textarea/index.figma.d.ts +0 -1
- package/dist/components/ui/textarea/index.figma.js +0 -27
- package/dist/components/ui/toast/index.figma.d.ts +0 -1
- package/dist/components/ui/toast/index.figma.js +0 -26
- package/dist/components/ui/tooltip/index.figma.d.ts +0 -1
- package/dist/components/ui/tooltip/index.figma.js +0 -23
package/README.en.md
CHANGED
|
@@ -24,52 +24,72 @@ It implements [Goodpatch](https://goodpatch.com/)'s "Sparkle Design" system on t
|
|
|
24
24
|
- 🎨 **Customizability** ... A dedicated CLI tool lets you apply the same customizations found in the Figma files. This makes it easy to spin up code for design systems built on Sparkle Design.
|
|
25
25
|
- 🤖 **AI Friendly** ... Ships with skills and guard configurations for Claude Code, Cursor, and Codex. Maintain design system quality even during AI-assisted coding.
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Quick Start
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### 1. Set up
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
In an existing Next.js / Vite project, a single command completes the integration:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
|
|
35
|
-
# or
|
|
36
|
-
pnpm add sparkle-design
|
|
37
|
-
# or
|
|
38
|
-
yarn add sparkle-design
|
|
34
|
+
npx --yes sparkle-design-cli setup --assistant claude
|
|
39
35
|
```
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
This automatically:
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
1. Detects your package manager (pnpm / npm / yarn / bun)
|
|
40
|
+
2. Adds `sparkle-design` to dependencies and `tailwindcss` + `@tailwindcss/postcss` to devDependencies
|
|
41
|
+
3. Generates `sparkle.config.json` / `postcss.config.mjs` / Tailwind entry CSS (Next.js: `globals.css`, Vite: `index.css`) if missing
|
|
42
|
+
4. Adds a Sparkle Design guard block and `lint:sparkle` script to `CLAUDE.md`
|
|
43
|
+
5. Generates `sparkle-design.css` and `SparkleHead.tsx`
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
`--assistant` accepts `claude` / `cursor` / `codex` / `generic`. Existing files are never overwritten.
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
Refer to the [official documentation](https://ui.shadcn.com/docs/registry/getting-started) for details on the shadcn/ui registry.
|
|
47
|
+
Once the setup is complete, place the generated `SparkleHead` in the `<head>` of your root layout.
|
|
53
48
|
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
You can also specify [namespaces](https://ui.shadcn.com/docs/registry/namespace) in `components.json` to install components by name.
|
|
49
|
+
```tsx
|
|
50
|
+
import { SparkleHead } from "./SparkleHead";
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
export default function RootLayout({ children }) {
|
|
53
|
+
return (
|
|
54
|
+
<html>
|
|
55
|
+
<head>
|
|
56
|
+
<SparkleHead />
|
|
57
|
+
</head>
|
|
58
|
+
<body>{children}</body>
|
|
59
|
+
</html>
|
|
60
|
+
);
|
|
65
61
|
}
|
|
66
62
|
```
|
|
67
63
|
|
|
64
|
+
> **`@next/next/no-head-element` in Next.js App Router**: If your project extends `next/core-web-vitals`, placing a `<head>` element directly in `layout.tsx` may trigger a lint error. Add `// eslint-disable-next-line @next/next/no-head-element` to suppress it, or consider using `next/font` as an alternative.
|
|
65
|
+
|
|
66
|
+
Customize primary color, fonts, border radius, and more via `sparkle.config.json`. To tweak settings inside Figma, the [Sparkle Design Theme Settings](https://www.figma.com/community/plugin/1443500367756891364/sparkle-design-theme-settings) plugin is available. See `sparkle-design-cli generate --help` for details.
|
|
67
|
+
|
|
68
|
+
> **⚠️ Note for TailwindCSS v4 when using sparkle-design as an npm package:** TailwindCSS v4 does not automatically scan utility classes inside `node_modules`. When consuming `sparkle-design` as an npm package, your entry CSS needs an `@source` directive like the one below:
|
|
69
|
+
>
|
|
70
|
+
> ```css
|
|
71
|
+
> @import "tailwindcss";
|
|
72
|
+
> @source "../../node_modules/sparkle-design/dist";
|
|
73
|
+
> @import "./sparkle-design.css";
|
|
74
|
+
> ```
|
|
75
|
+
>
|
|
76
|
+
> From `sparkle-design-cli` v2.0.6 onward, `generate` / `setup` **auto-scans your `package.json`** (dependencies / devDependencies) and automatically inserts the matching `@source` directives when it detects `sparkle-design` or `@goodpatch/sparkle-design-internal`. No manual config is required. If you want to include additional design system packages, add them to `extend.source-packages` in `sparkle.config.json`; the detected packages and your explicit list will be merged.
|
|
77
|
+
|
|
78
|
+
#### Installing as an AI Agent Skill (optional)
|
|
79
|
+
|
|
80
|
+
If you use an AI agent such as Claude Code, Codex, or Cursor, you can also install the Sparkle Design skills with [Vercel's skills CLI](https://github.com/vercel-labs/skills) to have the agent walk you through setup.
|
|
81
|
+
|
|
68
82
|
```bash
|
|
69
|
-
|
|
83
|
+
# Install only the setup-sparkle-design skill
|
|
84
|
+
npx skills add goodpatch/sparkle-design -s setup-sparkle-design
|
|
85
|
+
|
|
86
|
+
# Install all skills (setup / add-component / accessibility-checker)
|
|
87
|
+
npx skills add goodpatch/sparkle-design --all
|
|
70
88
|
```
|
|
71
89
|
|
|
72
|
-
|
|
90
|
+
After installation, asking the agent to "install Sparkle Design" triggers the `setup-sparkle-design` skill, which inspects the project and guides you through only the missing steps. Use `-a claude-code` / `-a codex` etc. to target a specific agent.
|
|
91
|
+
|
|
92
|
+
### 2. Use components
|
|
73
93
|
|
|
74
94
|
```tsx
|
|
75
95
|
import React from "react";
|
|
@@ -92,96 +112,56 @@ function App() {
|
|
|
92
112
|
export default App;
|
|
93
113
|
```
|
|
94
114
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Import these files to take advantage of everything Sparkle Design offers.
|
|
102
|
-
|
|
103
|
-
#### Using as an npm package
|
|
104
|
-
|
|
105
|
-
When using `sparkle-design` as an npm package, TailwindCSS v4 needs `@source` directives to detect utility classes inside the package.
|
|
106
|
-
|
|
107
|
-
`sparkle-design-cli generate` auto-detects CSS files containing `@import "tailwindcss"` and inserts `@source` directives. This works with any filename (`globals.css`, `index.css`, etc.). If auto-detection fails, specify the path via `extend.globals-path` in `sparkle.config.json` or the `--globals-path` CLI option.
|
|
108
|
-
|
|
109
|
-
To configure manually, add the following to your Tailwind entrypoint CSS:
|
|
110
|
-
|
|
111
|
-
```css
|
|
112
|
-
@import "tailwindcss";
|
|
113
|
-
/* Scan sparkle-design classes */
|
|
114
|
-
/* Adjust the path relative to the CSS file (example for src/app/globals.css) */
|
|
115
|
-
@source "../../node_modules/sparkle-design/dist";
|
|
116
|
-
/* Sparkle Design custom definitions (import after Tailwind) */
|
|
117
|
-
@import "./sparkle-design.css";
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
> **Note**: The relative path for `@source` depends on where your CSS file is located. The example above assumes `src/app/globals.css`.
|
|
115
|
+
> **Using with Server Components**: For components that contain `"use client"`, use subpath imports. Each component's [README](src/components/ui/) includes Server Component / Client Component information.
|
|
116
|
+
>
|
|
117
|
+
> ```tsx
|
|
118
|
+
> import { Button } from "sparkle-design/button";
|
|
119
|
+
> ```
|
|
121
120
|
|
|
122
|
-
|
|
121
|
+
### 3. Update settings and check for anti-patterns
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
After editing `sparkle.config.json`, regenerate the CSS:
|
|
125
124
|
|
|
126
125
|
```bash
|
|
127
126
|
npx sparkle-design-cli generate
|
|
128
127
|
```
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
- `sparkle-design.css` — Design token CSS
|
|
132
|
-
- `SparkleHead.tsx` — Font loading React component
|
|
133
|
-
|
|
134
|
-
Place `SparkleHead` in the `<head>` of your root layout:
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
import { SparkleHead } from "./SparkleHead";
|
|
129
|
+
After making Sparkle Design-related code changes, check for anti-patterns:
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<html>
|
|
142
|
-
<head>
|
|
143
|
-
<SparkleHead />
|
|
144
|
-
</head>
|
|
145
|
-
<body>{children}</body>
|
|
146
|
-
</html>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
131
|
+
```bash
|
|
132
|
+
npx sparkle-design-cli check src
|
|
149
133
|
```
|
|
150
134
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
> **`@next/next/no-head-element` in Next.js App Router**: If your project extends `next/core-web-vitals`, a `<head>` element in `layout.tsx` may trigger a lint error. In that case, use `eslint-disable` on the relevant line or consider alternative approaches with `next/font`.
|
|
135
|
+
### Manual installation (advanced)
|
|
154
136
|
|
|
155
|
-
|
|
137
|
+
If you prefer a step-by-step installation without CLI setup, see the [CLI documentation](https://github.com/goodpatch/sparkle-design-cli#readme).
|
|
156
138
|
|
|
157
|
-
|
|
158
|
-
- `font-pro`: Proportional font ([Google Fonts](https://fonts.google.com/) name)
|
|
159
|
-
- `font-mono`: Monospace font ([Google Fonts](https://fonts.google.com/) name)
|
|
160
|
-
- `radius`: Border radius preset (none, sm, md, lg, xl, full)
|
|
139
|
+
## Install individual components
|
|
161
140
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
Extended options (per-font weight customization, fallback chains, custom token CSS) can be configured in the `extend` section of `sparkle.config.json`. See `sparkle-design-cli generate --help` for details.
|
|
141
|
+
Sparkle Design works with the shadcn/ui registry. You can copy the registry URL from Storybook.<br />
|
|
142
|
+
Refer to the [official documentation](https://ui.shadcn.com/docs/registry/getting-started) for details on the shadcn/ui registry.
|
|
165
143
|
|
|
166
144
|
```bash
|
|
167
|
-
|
|
168
|
-
|
|
145
|
+
pnpm dlx shadcn@latest add [registry URL]
|
|
146
|
+
```
|
|
169
147
|
|
|
170
|
-
|
|
171
|
-
npx sparkle-design-cli check src --strict
|
|
148
|
+
You can also specify [namespaces](https://ui.shadcn.com/docs/registry/namespace) in `components.json` to install components by name.
|
|
172
149
|
|
|
173
|
-
|
|
174
|
-
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"registries": {
|
|
153
|
+
"@sparkle-design": "https://sparkle-design.goodpatch.com/r/{name}.json"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
175
156
|
```
|
|
176
157
|
|
|
177
|
-
|
|
158
|
+
```bash
|
|
159
|
+
pnpm dlx shadcn@latest add @sparkle-design/button
|
|
160
|
+
```
|
|
178
161
|
|
|
179
162
|
## Development Guide
|
|
180
163
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
- Node.js 22.14.0 or later
|
|
184
|
-
- pnpm 10 or later
|
|
164
|
+
For environment setup, component creation, testing, and contribution guidelines, see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
185
165
|
|
|
186
166
|
### Directory structure
|
|
187
167
|
|
|
@@ -196,58 +176,6 @@ npx sparkle-design-cli setup --assistant claude
|
|
|
196
176
|
└─ .github/ # GitHub configuration
|
|
197
177
|
```
|
|
198
178
|
|
|
199
|
-
### Build the package
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
pnpm build:package
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Start Storybook
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
pnpm storybook
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Run tests
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
pnpm test
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Refer to `docs/ai-instructions/testing.md` for testing guidelines.
|
|
218
|
-
|
|
219
|
-
### Code formatting
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# Check formatting
|
|
223
|
-
pnpm format:check
|
|
224
|
-
|
|
225
|
-
# Format automatically
|
|
226
|
-
pnpm format
|
|
227
|
-
|
|
228
|
-
# ESLint check (via Next.js)
|
|
229
|
-
pnpm lint:check
|
|
230
|
-
# or
|
|
231
|
-
pnpm lint
|
|
232
|
-
|
|
233
|
-
# ESLint auto-fix (via Next.js)
|
|
234
|
-
pnpm lint:fix
|
|
235
|
-
|
|
236
|
-
# Type check
|
|
237
|
-
pnpm type-check
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**Note**: ESLint uses the `next lint` command, applying rules optimized for Next.js projects.
|
|
241
|
-
|
|
242
|
-
### About the Makefile
|
|
243
|
-
|
|
244
|
-
The Makefile defines the following targets:
|
|
245
|
-
|
|
246
|
-
- `registry` ... Generate the registry and copy files to the public directory
|
|
247
|
-
- `new-component` ... Interactive flow for creating a new component
|
|
248
|
-
|
|
249
|
-
Run `make help` for details.
|
|
250
|
-
|
|
251
179
|
### Sparkle Design badge
|
|
252
180
|
|
|
253
181
|
The Sparkle Design badge indicates that a component uses Sparkle Design. Add the following snippet to your README:
|
|
@@ -256,14 +184,6 @@ The Sparkle Design badge indicates that a component uses Sparkle Design. Add the
|
|
|
256
184
|
[](https://sparkle-design.goodpatch.com/)
|
|
257
185
|
```
|
|
258
186
|
|
|
259
|
-
### Miscellaneous
|
|
260
|
-
|
|
261
|
-
- Follow `docs/ai-instructions/comment-style.md` for comment conventions.
|
|
262
|
-
- Follow `.github/copilot-commit-message-instructions.md` for commit message format.
|
|
263
|
-
- Refer to `CHANGELOG.md` for release notes.
|
|
264
|
-
- If the public registry domain changes, run `pnpm update:public-domain -- --to https://new-domain.example.com --dry-run` to preview the impact, then rerun without `--dry-run` to apply the replacement.
|
|
265
|
-
- See the `docs/ai-instructions/` directory for additional development, testing, and AI guidelines.
|
|
266
|
-
|
|
267
187
|
## Component status
|
|
268
188
|
|
|
269
189
|
Please refer to the table on [README.md](./README.md#コンポーネント公開状況) for the current implementation status of components.
|
package/README.md
CHANGED
|
@@ -24,52 +24,72 @@ shadcn/ui をベースに、[グッドパッチ](https://goodpatch.com/)のデ
|
|
|
24
24
|
- 🎨 **カスタマイズ性** ... 専用CLIツールを利用し、Figmaファイルと同等のカスタマイズを適用することが出来ます。これによりSparkle Designをベースとしたデザインシステムのコードを素早く用意することが出来ます。
|
|
25
25
|
- 🤖 **AI フレンドリー** ... Claude Code / Cursor / Codex 向けのスキルとガード設定を同梱。AI コーディングでもデザインシステムの品質を維持できます。
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## クイックスタート
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### 1. セットアップ
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
既存の Next.js / Vite プロジェクトで次の 1 コマンドを実行するだけで導入が完了します。
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
|
|
35
|
-
# または
|
|
36
|
-
pnpm add sparkle-design
|
|
37
|
-
# または
|
|
38
|
-
yarn add sparkle-design
|
|
34
|
+
npx --yes sparkle-design-cli setup --assistant claude
|
|
39
35
|
```
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
これで以下が自動で行われます:
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
1. パッケージマネージャー(pnpm / npm / yarn / bun)を自動検出
|
|
40
|
+
2. `sparkle-design` を dependencies、`tailwindcss` + `@tailwindcss/postcss` を devDependencies に追加
|
|
41
|
+
3. `sparkle.config.json` / `postcss.config.mjs` / Tailwind エントリ CSS(Next.js: `globals.css`、Vite: `index.css`)を必要に応じて生成
|
|
42
|
+
4. `CLAUDE.md` に Sparkle Design ガードブロックと `lint:sparkle` スクリプトを追加
|
|
43
|
+
5. `sparkle-design.css` と `SparkleHead.tsx` を生成
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
`--assistant` は `claude` / `cursor` / `codex` / `generic` から選択できます。既存ファイルは上書きされません。
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
shadcn/ui registry の詳細な情報は [公式ドキュメント](https://ui.shadcn.com/docs/registry/getting-started) を参照してください。
|
|
47
|
+
セットアップが完了したら、生成された `SparkleHead` をルートレイアウトの `<head>` に配置してください。
|
|
53
48
|
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
また[Namespaces](https://ui.shadcn.com/docs/registry/namespace)を`components.json`に指定することで、コンポーネント名でのインストールも可能になります。
|
|
49
|
+
```tsx
|
|
50
|
+
import { SparkleHead } from "./SparkleHead";
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
export default function RootLayout({ children }) {
|
|
53
|
+
return (
|
|
54
|
+
<html>
|
|
55
|
+
<head>
|
|
56
|
+
<SparkleHead />
|
|
57
|
+
</head>
|
|
58
|
+
<body>{children}</body>
|
|
59
|
+
</html>
|
|
60
|
+
);
|
|
65
61
|
}
|
|
66
62
|
```
|
|
67
63
|
|
|
64
|
+
> **Next.js App Router で `@next/next/no-head-element` が出る場合**: `next/core-web-vitals` を使用しているプロジェクトでは、`layout.tsx` に `<head>` を直接書くと lint エラーになることがあります。該当行に `// eslint-disable-next-line @next/next/no-head-element` を追加するか、`next/font` による代替方法を検討してください。
|
|
65
|
+
|
|
66
|
+
`sparkle.config.json` でプライマリカラー・フォント・角丸などをカスタマイズできます。Figma 上で設定を調整したい場合は [Sparkle Design Theme Settings](https://www.figma.com/community/plugin/1443500367756891364/sparkle-design-theme-settings) プラグインを利用できます。詳細は `sparkle-design-cli generate --help` を参照してください。
|
|
67
|
+
|
|
68
|
+
> **⚠️ TailwindCSS v4 で npm package として使う場合の注意:** TailwindCSS v4 は `node_modules` 内のユーティリティクラスを自動スキャンしないため、`sparkle-design` を npm package として使うときはエントリ CSS に以下のような `@source` ディレクティブが必要です。
|
|
69
|
+
>
|
|
70
|
+
> ```css
|
|
71
|
+
> @import "tailwindcss";
|
|
72
|
+
> @source "../../node_modules/sparkle-design/dist";
|
|
73
|
+
> @import "./sparkle-design.css";
|
|
74
|
+
> ```
|
|
75
|
+
>
|
|
76
|
+
> `sparkle-design-cli` v2.0.6 以降は、`generate` / `setup` 実行時に **`package.json` の dependencies / devDependencies を自動スキャン** し、`sparkle-design` や `@goodpatch/sparkle-design-internal` が含まれていれば該当する `@source` を自動挿入します。`sparkle.config.json` 側で何も設定しなくても動きます。独自のデザインシステムパッケージを併用したい場合のみ `extend.source-packages` に追記すると、自動検出分と合算されます。
|
|
77
|
+
|
|
78
|
+
#### AI エージェントに Skill として導入する場合(任意)
|
|
79
|
+
|
|
80
|
+
Claude Code / Codex / Cursor などの AI エージェントを使っている場合は、[Vercel の skills CLI](https://github.com/vercel-labs/skills) 経由で Sparkle Design のスキルセットを導入しておくと、会話から誘導してもらうこともできます。
|
|
81
|
+
|
|
68
82
|
```bash
|
|
69
|
-
|
|
83
|
+
# setup-sparkle-design スキルだけを導入
|
|
84
|
+
npx skills add goodpatch/sparkle-design -s setup-sparkle-design
|
|
85
|
+
|
|
86
|
+
# 全スキル(setup / add-component / accessibility-checker)を導入
|
|
87
|
+
npx skills add goodpatch/sparkle-design --all
|
|
70
88
|
```
|
|
71
89
|
|
|
72
|
-
|
|
90
|
+
導入後に「Sparkle Design を導入して」と依頼すると `setup-sparkle-design` スキルが発動し、プロジェクト状態に合わせて不足ステップだけ案内してくれます。`-a claude-code` / `-a codex` などで対象エージェントを指定することもできます。
|
|
91
|
+
|
|
92
|
+
### 2. コンポーネントの使用
|
|
73
93
|
|
|
74
94
|
```tsx
|
|
75
95
|
import React from "react";
|
|
@@ -92,96 +112,56 @@ function App() {
|
|
|
92
112
|
export default App;
|
|
93
113
|
```
|
|
94
114
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
これらのファイルをインポートすることで、Sparkle Design の全機能を利用できます。
|
|
102
|
-
|
|
103
|
-
#### npm パッケージとして利用する場合
|
|
104
|
-
|
|
105
|
-
`sparkle-design` を npm パッケージとしてインストールして利用する場合、TailwindCSS v4 がパッケージ内のユーティリティクラスを検出できるよう `@source` ディレクティブが必要です。
|
|
106
|
-
|
|
107
|
-
`sparkle-design-cli generate` を実行すると、`@import "tailwindcss"` を含む CSS ファイルを自動検出し、`@source` ディレクティブを挿入します。`globals.css` 以外のファイル名(Vite の `index.css` 等)にも対応しています。自動検出がうまく動かない場合は `sparkle.config.json` の `extend.globals-path` か CLI の `--globals-path` オプションで明示的に指定できます。
|
|
108
|
-
|
|
109
|
-
手動で設定する場合は、Tailwind エントリポイント CSS に以下を追加してください:
|
|
110
|
-
|
|
111
|
-
```css
|
|
112
|
-
@import "tailwindcss";
|
|
113
|
-
/* sparkle-design のクラスをスキャン対象にする */
|
|
114
|
-
/* パスは CSS ファイルの配置に応じて調整(src/app/globals.css なら ../../node_modules/...) */
|
|
115
|
-
@source "../../node_modules/sparkle-design/dist";
|
|
116
|
-
/* Sparkle Design のカスタム定義(Tailwindの後にインポート) */
|
|
117
|
-
@import "./sparkle-design.css";
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
> **注意**: `@source` の相対パスは CSS ファイルの配置場所に依存します。上記は `src/app/globals.css` の場合の例です。
|
|
115
|
+
> **Server Component で使う場合**: `"use client"` を含むコンポーネントは個別 import を推奨します。各コンポーネントの [README](src/components/ui/) に Server Component / Client Component の情報が記載されています。
|
|
116
|
+
>
|
|
117
|
+
> ```tsx
|
|
118
|
+
> import { Button } from "sparkle-design/button";
|
|
119
|
+
> ```
|
|
121
120
|
|
|
122
|
-
|
|
121
|
+
### 3. 設定の更新とアンチパターンの検査
|
|
123
122
|
|
|
124
|
-
`sparkle.config.json`
|
|
123
|
+
`sparkle.config.json` を編集した後は以下で CSS を再生成できます。
|
|
125
124
|
|
|
126
125
|
```bash
|
|
127
126
|
npx sparkle-design-cli generate
|
|
128
127
|
```
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
- `sparkle-design.css` — デザイントークン CSS
|
|
132
|
-
- `SparkleHead.tsx` — フォント読み込み用 React コンポーネント
|
|
133
|
-
|
|
134
|
-
`SparkleHead` はルートレイアウトの `<head>` 内に配置してください:
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
import { SparkleHead } from "./SparkleHead";
|
|
129
|
+
Sparkle Design に関するコード変更後は、アンチパターンを検出できます。
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<html>
|
|
142
|
-
<head>
|
|
143
|
-
<SparkleHead />
|
|
144
|
-
</head>
|
|
145
|
-
<body>{children}</body>
|
|
146
|
-
</html>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
131
|
+
```bash
|
|
132
|
+
npx sparkle-design-cli check src
|
|
149
133
|
```
|
|
150
134
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
> `SparkleHead` は `<link rel="preconnect">` と `<link rel="stylesheet">` でフォントを読み込みます。CSS の `@import` に比べてフォントの発見が早く、特にモバイル環境でのアイコン表示が改善されます。
|
|
135
|
+
### 手動インストール(高度な利用)
|
|
154
136
|
|
|
155
|
-
|
|
137
|
+
CLI setup を使わずに段階的に導入したい場合は、[CLI ドキュメント](https://github.com/goodpatch/sparkle-design-cli#readme) を参照してください。
|
|
156
138
|
|
|
157
|
-
|
|
158
|
-
- `font-pro`: プロポーショナルフォント([Google Fonts](https://fonts.google.com/) の名前)
|
|
159
|
-
- `font-mono`: モノスペースフォント([Google Fonts](https://fonts.google.com/) の名前)
|
|
160
|
-
- `radius`: 角丸設定(none, sm, md, lg, xl, full)
|
|
139
|
+
## 個別コンポーネントの導入
|
|
161
140
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
フォントウェイトのカスタマイズ、フォールバックチェーン、カスタムトークン CSS などの拡張設定は `sparkle.config.json` の `extend` セクションで指定できます。詳細は `sparkle-design-cli generate --help` を参照してください。
|
|
141
|
+
Sparkle Design は shadcn/ui registry に対応しています。レジストリの URL は Storybook からコピーすることができます。<br />
|
|
142
|
+
shadcn/ui registry の詳細な情報は [公式ドキュメント](https://ui.shadcn.com/docs/registry/getting-started) を参照してください。
|
|
165
143
|
|
|
166
144
|
```bash
|
|
167
|
-
|
|
168
|
-
|
|
145
|
+
pnpm dlx shadcn@latest add [registry URL]
|
|
146
|
+
```
|
|
169
147
|
|
|
170
|
-
|
|
171
|
-
npx sparkle-design-cli check src --strict
|
|
148
|
+
また[Namespaces](https://ui.shadcn.com/docs/registry/namespace)を`components.json`に指定することで、コンポーネント名でのインストールも可能になります。
|
|
172
149
|
|
|
173
|
-
|
|
174
|
-
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"registries": {
|
|
153
|
+
"@sparkle-design": "https://sparkle-design.goodpatch.com/r/{name}.json"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
175
156
|
```
|
|
176
157
|
|
|
177
|
-
|
|
158
|
+
```bash
|
|
159
|
+
pnpm dlx shadcn@latest add @sparkle-design/button
|
|
160
|
+
```
|
|
178
161
|
|
|
179
162
|
## 開発ガイド
|
|
180
163
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
- Node.js 22.14.0 以上
|
|
184
|
-
- pnpm 10 以上
|
|
164
|
+
開発環境のセットアップ・コンポーネントの作成・テスト・コントリビューション方法は [CONTRIBUTING.md](./CONTRIBUTING.md) を参照してください。
|
|
185
165
|
|
|
186
166
|
### ディレクトリ構成
|
|
187
167
|
|
|
@@ -196,58 +176,6 @@ npx sparkle-design-cli setup --assistant claude
|
|
|
196
176
|
└─ .github/ # GitHub関連の設定ファイル
|
|
197
177
|
```
|
|
198
178
|
|
|
199
|
-
### Package のビルド
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
pnpm build:package
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Storybook の起動
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
pnpm storybook
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### テストの実行
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
pnpm test
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
テストガイドラインについては `docs/ai-instructions/testing.md` を参照してください。
|
|
218
|
-
|
|
219
|
-
### コードフォーマット
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# フォーマットチェック
|
|
223
|
-
pnpm format:check
|
|
224
|
-
|
|
225
|
-
# 自動フォーマット
|
|
226
|
-
pnpm format
|
|
227
|
-
|
|
228
|
-
# ESLint チェック (Next.js 経由)
|
|
229
|
-
pnpm lint:check
|
|
230
|
-
# または
|
|
231
|
-
pnpm lint
|
|
232
|
-
|
|
233
|
-
# ESLint 自動修正 (Next.js 経由)
|
|
234
|
-
pnpm lint:fix
|
|
235
|
-
|
|
236
|
-
# 型チェック
|
|
237
|
-
pnpm type-check
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**注意**: ESLintは`next lint`コマンドを使用しており、Next.jsプロジェクトに最適化された設定とルールが適用されます。
|
|
241
|
-
|
|
242
|
-
### Makefile について
|
|
243
|
-
|
|
244
|
-
Makefile では次のターゲットが定義されています。
|
|
245
|
-
|
|
246
|
-
- `registry` ... レジストリの生成と公開ファイルへのコピー
|
|
247
|
-
- `new-component` ... 対話形式で新規コンポーネントを作成
|
|
248
|
-
|
|
249
|
-
`make help` で詳細は確認してください。
|
|
250
|
-
|
|
251
179
|
### Sparkle Design バッジ
|
|
252
180
|
|
|
253
181
|
Sparkle Design のバッジは、コンポーネントが Sparkle Design を使用していることを示します。README に次のように追加してください。
|
|
@@ -256,14 +184,6 @@ Sparkle Design のバッジは、コンポーネントが Sparkle Design を使
|
|
|
256
184
|
[](https://sparkle-design.goodpatch.com/)
|
|
257
185
|
```
|
|
258
186
|
|
|
259
|
-
### その他
|
|
260
|
-
|
|
261
|
-
- コメントの書き方は `docs/ai-instructions/comment-style.md` を参照してください。
|
|
262
|
-
- コミットメッセージの形式は `.github/copilot-commit-message-instructions.md` のルールに従います。
|
|
263
|
-
- 変更履歴は `CHANGELOG.md` を参照してください。
|
|
264
|
-
- 公開用ドメインを切り替える場合は `pnpm update:public-domain -- --to https://new-domain.example.com --dry-run` で影響範囲を確認し、その後 `--dry-run` を外して一括更新できます。
|
|
265
|
-
- その他開発・テスト・AI関連のガイドラインは `docs/ai-instructions/` ディレクトリを参照してください。
|
|
266
|
-
|
|
267
187
|
## コンポーネント公開状況
|
|
268
188
|
|
|
269
189
|
現在公開されているコンポーネントの一覧です。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sparkle-design",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org",
|
|
6
6
|
"access": "public"
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"update:public-domain": "node scripts/update-public-domain.mjs"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@figma/code-connect": "^1.3.4",
|
|
57
56
|
"@hookform/resolvers": "^5.2.2",
|
|
58
57
|
"class-variance-authority": "^0.7.1",
|
|
59
58
|
"clsx": "^2.1.1",
|
|
@@ -71,6 +70,7 @@
|
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
72
|
"@chromatic-com/storybook": "^5.1.1",
|
|
73
|
+
"@figma/code-connect": "^1.3.4",
|
|
74
74
|
"@storybook/addon-a11y": "^10.3.5",
|
|
75
75
|
"@storybook/addon-docs": "^10.3.5",
|
|
76
76
|
"@storybook/addon-onboarding": "^10.3.5",
|
|
@@ -101,6 +101,36 @@
|
|
|
101
101
|
"vite": "6.4.2",
|
|
102
102
|
"vitest": "^3.0.9"
|
|
103
103
|
},
|
|
104
|
+
"pnpm": {
|
|
105
|
+
"overrides": {
|
|
106
|
+
"lodash": "^4.17.23",
|
|
107
|
+
"path-to-regexp": "^8.4.0",
|
|
108
|
+
"brace-expansion@>=2.0.0 <2.0.3": "^2.0.3",
|
|
109
|
+
"picomatch": "^4.0.4",
|
|
110
|
+
"flatted": "^3.4.2",
|
|
111
|
+
"undici": "^6.24.0",
|
|
112
|
+
"tar": "^7.5.11",
|
|
113
|
+
"minimatch@>=7.0.0 <7.4.8": "^7.4.8",
|
|
114
|
+
"minimatch@>=9.0.0 <9.0.7": "^9.0.7",
|
|
115
|
+
"minimatch@>=10.0.0 <10.2.3": "^10.2.3",
|
|
116
|
+
"minimatch@<3.1.3": "^3.1.3",
|
|
117
|
+
"ajv@<6.14.0": "^6.14.0",
|
|
118
|
+
"qs@<6.14.2": "^6.14.2",
|
|
119
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
120
|
+
"@isaacs/brace-expansion": "^5.0.1",
|
|
121
|
+
"diff@>=5.0.0 <5.2.2": "^5.2.2",
|
|
122
|
+
"body-parser@>=2.2.0 <2.2.1": "^2.2.1",
|
|
123
|
+
"glob@>=10.2.0 <10.5.0": "^10.5.0",
|
|
124
|
+
"glob@>=11.0.0 <11.1.0": "^11.1.0",
|
|
125
|
+
"js-yaml@>=4.0.0 <4.1.1": "^4.1.1",
|
|
126
|
+
"playwright": "^1.59.1",
|
|
127
|
+
"form-data": "^4.0.4",
|
|
128
|
+
"hono": "^4.12.14",
|
|
129
|
+
"yaml@>=2.0.0 <2.8.3": "^2.8.3",
|
|
130
|
+
"@eslint/plugin-kit": "^0.3.4",
|
|
131
|
+
"brace-expansion@<1.1.13": "^1.1.13"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
104
134
|
"main": "./dist/index.js",
|
|
105
135
|
"types": "./dist/index.d.ts",
|
|
106
136
|
"exports": {
|