Skip to content

Commit 059da48

Browse files
committed
feat: add CLAUDE.md and update pnpm-lock.yaml
1 parent 9da6704 commit 059da48

File tree

2 files changed

+2328
-2698
lines changed

2 files changed

+2328
-2698
lines changed

CLAUDE.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# @formkit/theme-starter
2+
3+
Minimal, heavily-commented FormKit theme template. Use this as a starting point for creating custom themes.
4+
5+
## Purpose
6+
7+
Unlike `theme-regenesis` (fully styled), this package is:
8+
- **Educational** - extensive comments explaining every decision
9+
- **Minimal** - bare-bones styles, many empty sections
10+
- **Template** - meant to be copied and customized
11+
12+
Users scaffold via: `npx formkit create-theme MyThemeName`
13+
14+
## Architecture
15+
16+
```
17+
src/
18+
├── theme.ts # Main theme definition with detailed comments
19+
├── globals.ts # Global styles (commented explanations)
20+
├── main.ts # Dev server entry
21+
├── App.vue # Kitchen sink demo
22+
├── style.css # Dev UI (red text = missing styles)
23+
├── families/ # Family groupings with comments
24+
│ ├── button.ts
25+
│ ├── box.ts
26+
│ ├── text.ts
27+
│ └── dropdown.ts
28+
└── inputs/ # Input definitions
29+
├── [21 core]
30+
├── pro/
31+
└── addon/
32+
```
33+
34+
## Key Differences from theme-regenesis
35+
36+
| Aspect | theme-starter | theme-regenesis |
37+
|--------|---------------|-----------------|
38+
| Comments | 25-50+ per file | Minimal |
39+
| Styling | Bare-bones | Fully styled |
40+
| Purpose | Learning/template | Production use |
41+
| Complexity | Simple | Complete |
42+
43+
## Theme Variables
44+
45+
```typescript
46+
variables: {
47+
accentColor: 'blue', // String value
48+
colorTemperature: 'neutral', // String value
49+
inputMaxWidth: 'max-w-[20em]', // String value
50+
radius: { // Editor control
51+
editor: 'radius',
52+
value: 'rounded-md',
53+
},
54+
spacing: {
55+
editor: 'spacing',
56+
value: '2',
57+
min: '1',
58+
max: '4',
59+
},
60+
scale: {
61+
editor: 'fontSize',
62+
value: 'base',
63+
},
64+
}
65+
```
66+
67+
## Development
68+
69+
```bash
70+
pnpm dev # Vite + theme editor
71+
pnpm build # tsup → dist/
72+
pnpm test # vitest
73+
```
74+
75+
### Debug Feature
76+
77+
`style.css` sets `--text-color: red` - any red text indicates missing theme styles.
78+
79+
## Educational Comments
80+
81+
Files include detailed explanations:
82+
- Why certain styles are needed
83+
- Browser quirks (Safari flex, webkit color)
84+
- Tailwind Forms plugin conflicts
85+
- Mobile/touch device considerations
86+
87+
Look for `⚠️ CAUTION:` blocks throughout.
88+
89+
## Creating a Custom Theme
90+
91+
### Step 1: Scaffold
92+
```bash
93+
npx formkit create-theme MyTheme
94+
```
95+
96+
### Step 2: Understand Structure
97+
- Read comments in `theme.ts` and `globals.ts`
98+
- Review family definitions
99+
- Check individual inputs for section names
100+
101+
### Step 3: Customize
102+
1. **Variables** - Modify in `theme.ts`
103+
2. **Globals** - Base styles in `globals.ts`
104+
3. **Families** - Shared styles in `families/`
105+
4. **Inputs** - Override in `inputs/`
106+
107+
### Step 4: Test
108+
```bash
109+
pnpm dev
110+
# Red text = missing styles
111+
# Toggle dark mode
112+
# Test all inputs in kitchen sink
113+
```
114+
115+
### Step 5: Publish
116+
```bash
117+
pnpm build
118+
pnpm release # bumpp + publish
119+
```
120+
121+
## Input Coverage
122+
123+
Same as theme-regenesis: 21 core + 12 pro + 2 addon = 35 inputs
124+
125+
## Interconnections
126+
127+
```
128+
@formkit/theme-creator
129+
↓ provides createTheme(), rootClasses()
130+
theme-starter (this package)
131+
↓ template for custom themes
132+
├── User custom themes (copy & modify)
133+
├── themes.formkit.com (available for preview)
134+
└── CLI scaffolding target
135+
```
136+
137+
## Common Tasks
138+
139+
### Understanding a section
140+
141+
Each section key in theme files corresponds to a FormKit section:
142+
- `outer` - outermost wrapper
143+
- `wrapper` - inner wrapper
144+
- `label` - input label
145+
- `inner` - input container
146+
- `input` - actual input element
147+
- `help` - help text
148+
- `messages` - error messages
149+
150+
See FormKit docs for full section list per input type.
151+
152+
### Adding custom variables
153+
154+
1. Add to `variables` in `theme.ts`
155+
2. Use `$variableName` in class strings
156+
3. For editor UI, use object form with `editor` type
157+
158+
### Removing Pro inputs
159+
160+
If not using @formkit/pro:
161+
1. Remove `pro/` directory
162+
2. Remove pro imports from `theme.ts`
163+
3. Remove from `meta.supportedInputs`

0 commit comments

Comments
 (0)