trix-ui 0.2.2 → 0.2.4
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 +306 -306
- package/dist/commands/build.js +104 -104
- package/dist/index.js +0 -0
- package/package.json +10 -10
- package/registry/index.json +203 -180
- package/templates/components/ui/badge.tsx +182 -182
- package/templates/composites/music-player-card.tsx +583 -208
- package/templates/sections/signature-hero.tsx +92 -0
- package/templates/wrappers/Interative-wrapper.tsx +1 -1
- package/templates/wrappers/progress-wrapper.tsx +248 -0
- package/templates/wrappers/reveal-wrap.tsx +136 -0
- package/templates/sections/modern-hero.tsx +0 -1226
package/README.md
CHANGED
|
@@ -1,306 +1,306 @@
|
|
|
1
|
-
<!-- # trix-ui
|
|
2
|
-
|
|
3
|
-
A small, registry-driven CLI that installs minimal, accessible UI components into your app.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
Use it with npx or install as a dev dependency.
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx trix-ui init
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install -D trix-ui
|
|
15
|
-
ui init
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Quickstart
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npx trix-ui init
|
|
22
|
-
npx trix-ui add button card dialog
|
|
23
|
-
npx trix-ui add-section hero
|
|
24
|
-
npx trix-ui add-wrapper glow-wrapper
|
|
25
|
-
npx trix-ui remove button
|
|
26
|
-
npx trix-ui remove --section hero
|
|
27
|
-
npx trix-ui remove --wrapper glow-wrapper
|
|
28
|
-
npx trix-ui list
|
|
29
|
-
npx trix-ui list --type sections
|
|
30
|
-
npx trix-ui list --type wrappers
|
|
31
|
-
npx trix-ui doctor
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## How it works (detailed)
|
|
35
|
-
|
|
36
|
-
### High-level model
|
|
37
|
-
`trix-ui` is a registry-driven CLI. It installs UI assets into your app by copying
|
|
38
|
-
templates and recording those installs in a lockfile. The registry is a JSON catalog
|
|
39
|
-
of components, sections, wrappers, and composites. Each entry describes:
|
|
40
|
-
- which template files to copy
|
|
41
|
-
- where those files should land in your project
|
|
42
|
-
- any local or npm dependencies
|
|
43
|
-
|
|
44
|
-
### Core files and directories
|
|
45
|
-
When you run `ui init`, the CLI prepares a project for installs:
|
|
46
|
-
- `trix-ui.json` (config)
|
|
47
|
-
- `components/ui`, `components/sections`, `components/wrappers`, `components/composites`
|
|
48
|
-
- `lib/utils.ts`
|
|
49
|
-
- `styles/globals.css`
|
|
50
|
-
- `.ui/lock.json` (install tracking)
|
|
51
|
-
|
|
52
|
-
The lockfile is the source of truth for what the CLI has installed and is used
|
|
53
|
-
to safely remove files later.
|
|
54
|
-
|
|
55
|
-
### Data flow (install)
|
|
56
|
-
1. Resolve working directory (`--cwd` or `process.cwd()`).
|
|
57
|
-
2. Load config from `trix-ui.json` (merged with defaults).
|
|
58
|
-
3. Load registry (bundled by default or local if configured).
|
|
59
|
-
4. Load lockfile (creates empty lockfile if none exists).
|
|
60
|
-
5. Validate inputs (normalize names and verify registry entries).
|
|
61
|
-
6. Analyze dependencies:
|
|
62
|
-
- `dependencies.local` installs other registry components first.
|
|
63
|
-
- `dependencies.npm` are collected for optional install.
|
|
64
|
-
7. Handle conflicts (existing files/lockfile entries) with prompts, or `--force`.
|
|
65
|
-
8. Copy templates into target paths.
|
|
66
|
-
9. Update lockfile with installed entries and files.
|
|
67
|
-
10. Optionally install npm dependencies (`--skip-deps` to skip).
|
|
68
|
-
|
|
69
|
-
### Dependency resolution
|
|
70
|
-
- **Local dependencies** (`dependencies.local`) are other registry components and
|
|
71
|
-
are installed before sections/wrappers/composites.
|
|
72
|
-
- **NPM dependencies** (`dependencies.npm`) are optional and can be installed
|
|
73
|
-
by the CLI via your package manager.
|
|
74
|
-
|
|
75
|
-
### Conflict handling
|
|
76
|
-
If a target file already exists or an entry is in the lockfile:
|
|
77
|
-
- Default: skip and warn.
|
|
78
|
-
- `--force`: overwrite files and update lockfile entries.
|
|
79
|
-
- `--yes`: auto-confirm prompts.
|
|
80
|
-
|
|
81
|
-
### Safe removal
|
|
82
|
-
- `ui remove` and related commands remove only files tracked in `.ui/lock.json`.
|
|
83
|
-
- `--force` removes files based on registry targets even if not tracked.
|
|
84
|
-
|
|
85
|
-
### Registry resolution
|
|
86
|
-
- **Bundled registry** (default): packaged with the CLI (`registry/index.json`).
|
|
87
|
-
- **Local registry**: configure `registry` in `trix-ui.json` to point to a custom
|
|
88
|
-
registry file (and optional templates path).
|
|
89
|
-
|
|
90
|
-
### Tokens and path resolution
|
|
91
|
-
Registry `target` fields support tokens:
|
|
92
|
-
`{{components}}`, `{{sections}}`, `{{wrappers}}`, `{{composites}}`, `{{lib}}`, `{{styles}}`.
|
|
93
|
-
Tokens are resolved using `trix-ui.json` paths, then converted to absolute paths.
|
|
94
|
-
Note: `{{lib}}` resolves to the `paths.utils` file path.
|
|
95
|
-
|
|
96
|
-
### Doctor command
|
|
97
|
-
`ui doctor` checks:
|
|
98
|
-
- config presence and validity
|
|
99
|
-
- required directories/files
|
|
100
|
-
- registry load errors
|
|
101
|
-
- lockfile existence
|
|
102
|
-
|
|
103
|
-
## Commands
|
|
104
|
-
|
|
105
|
-
- `ui init` - Creates `trix-ui.json`, `components/ui`, `lib/utils.ts`, `styles/globals.css`, and `.ui/lock.json`.
|
|
106
|
-
- `ui add <component...>` - Copies templates into `components/ui` and updates `.ui/lock.json`.
|
|
107
|
-
- `ui add-section <section...>` - Copies section templates into `components/sections` and updates `.ui/lock.json`.
|
|
108
|
-
- `ui add-wrapper <wrapper...>` - Copies wrapper templates into `components/wrappers` and updates `.ui/lock.json`.
|
|
109
|
-
- `ui add-composite <composite...>` - Copies composite templates into `components/composites` and updates `.ui/lock.json`.
|
|
110
|
-
- `ui remove <component...>` - Removes only files tracked in `.ui/lock.json` (safe by default).
|
|
111
|
-
- `ui remove --section <section...>` - Removes only section files tracked in `.ui/lock.json` (safe by default).
|
|
112
|
-
- `ui remove --wrapper <wrapper...>` - Removes only wrapper files tracked in `.ui/lock.json` (safe by default).
|
|
113
|
-
- `ui remove --composite <composite...>` - Removes only composite files tracked in `.ui/lock.json` (safe by default).
|
|
114
|
-
- `ui list` - Lists registry components, sections, wrappers, and composites.
|
|
115
|
-
- `ui list --type sections` - Lists registry sections only.
|
|
116
|
-
- `ui list --type wrappers` - Lists registry wrappers only.
|
|
117
|
-
- `ui list --type composites` - Lists registry composites only.
|
|
118
|
-
- `ui doctor` - Checks config, registry, and required files.
|
|
119
|
-
|
|
120
|
-
## Config (trix-ui.json)
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"registry": {
|
|
125
|
-
"type": "bundled"
|
|
126
|
-
},
|
|
127
|
-
"paths": {
|
|
128
|
-
"components": "components/ui",
|
|
129
|
-
"sections": "components/sections",
|
|
130
|
-
"wrappers": "components/wrappers",
|
|
131
|
-
"composites": "components/composites",
|
|
132
|
-
"utils": "lib/utils.ts",
|
|
133
|
-
"styles": "styles/globals.css"
|
|
134
|
-
},
|
|
135
|
-
"barrel": false
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Notes:
|
|
140
|
-
- `registry.type`:
|
|
141
|
-
- `bundled` uses the registry packaged with the CLI (default).
|
|
142
|
-
- Set `barrel: true` and run `ui init --barrel` to create `components/ui/index.ts`.
|
|
143
|
-
|
|
144
|
-
## Registry format
|
|
145
|
-
|
|
146
|
-
`registry/index.json`:
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"version": 1,
|
|
151
|
-
"components": [
|
|
152
|
-
{
|
|
153
|
-
"name": "button",
|
|
154
|
-
"description": "Button with variants and focus ring.",
|
|
155
|
-
"files": [
|
|
156
|
-
{
|
|
157
|
-
"source": "components/ui/button.tsx",
|
|
158
|
-
"target": "{{components}}/button.tsx"
|
|
159
|
-
}
|
|
160
|
-
],
|
|
161
|
-
"dependencies": {
|
|
162
|
-
"npm": ["clsx", "tailwind-merge"]
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
],
|
|
166
|
-
"sections": [
|
|
167
|
-
{
|
|
168
|
-
"name": "hero",
|
|
169
|
-
"description": "Hero section with headline, bullets, and CTAs.",
|
|
170
|
-
"files": [
|
|
171
|
-
{
|
|
172
|
-
"source": "sections/hero.tsx",
|
|
173
|
-
"target": "{{sections}}/hero.tsx"
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"dependencies": {
|
|
177
|
-
"local": ["badge", "button"]
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
"wrappers": [
|
|
182
|
-
{
|
|
183
|
-
"name": "glow-wrapper",
|
|
184
|
-
"description": "Glow effect wrapper for highlighting key components.",
|
|
185
|
-
"files": [
|
|
186
|
-
{
|
|
187
|
-
"source": "wrappers/glow-wrapper.tsx",
|
|
188
|
-
"target": "{{wrappers}}/glow-wrapper.tsx"
|
|
189
|
-
}
|
|
190
|
-
]
|
|
191
|
-
}
|
|
192
|
-
],
|
|
193
|
-
"composites": [
|
|
194
|
-
{
|
|
195
|
-
"name": "marketing-stack",
|
|
196
|
-
"description": "Composite layout for stacked marketing sections.",
|
|
197
|
-
"files": [
|
|
198
|
-
{
|
|
199
|
-
"source": "composites/marketing-stack.tsx",
|
|
200
|
-
"target": "{{composites}}/marketing-stack.tsx"
|
|
201
|
-
}
|
|
202
|
-
],
|
|
203
|
-
"dependencies": {
|
|
204
|
-
"local": ["button", "card"]
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
- `source` is relative to `templates/`.
|
|
212
|
-
- `target` supports tokens: `{{components}}`, `{{sections}}`, `{{wrappers}}`, `{{composites}}`, `{{lib}}`, `{{styles}}`.
|
|
213
|
-
- `dependencies.local` installs registry components before the section, wrapper, or composite.
|
|
214
|
-
- `dependencies.npm` are printed after install; you install them manually.
|
|
215
|
-
|
|
216
|
-
## Add a new component
|
|
217
|
-
|
|
218
|
-
1. Create a template in `templates/components/ui/<name>.tsx`.
|
|
219
|
-
2. Add a registry entry in `registry/index.json`.
|
|
220
|
-
3. Run `ui add <name>` in your app.
|
|
221
|
-
|
|
222
|
-
## Add a new section
|
|
223
|
-
|
|
224
|
-
1. Create a template in `templates/sections/<name>.tsx`.
|
|
225
|
-
2. Add a registry entry in `registry/index.json` under `sections`.
|
|
226
|
-
3. Run `ui add-section <name>` in your app.
|
|
227
|
-
|
|
228
|
-
## Add a new wrapper
|
|
229
|
-
|
|
230
|
-
1. Create a template in `templates/wrappers/<name>.tsx`.
|
|
231
|
-
2. Add a registry entry in `registry/index.json` under `wrappers`.
|
|
232
|
-
3. Run `ui add-wrapper <name>` in your app.
|
|
233
|
-
|
|
234
|
-
## Add a new composite
|
|
235
|
-
|
|
236
|
-
1. Create a template in `templates/composites/<name>.tsx`.
|
|
237
|
-
2. Add a registry entry in `registry/index.json` under `composites`.
|
|
238
|
-
3. Run `ui add-composite <name>` in your app.
|
|
239
|
-
|
|
240
|
-
## Tailwind setup
|
|
241
|
-
|
|
242
|
-
Add CSS variables in `styles/globals.css` (installed by `ui init`).
|
|
243
|
-
In your Tailwind config, map colors to CSS variables, for example:
|
|
244
|
-
|
|
245
|
-
```ts
|
|
246
|
-
export default {
|
|
247
|
-
theme: {
|
|
248
|
-
extend: {
|
|
249
|
-
colors: {
|
|
250
|
-
border: "hsl(var(--border))",
|
|
251
|
-
input: "hsl(var(--input))",
|
|
252
|
-
ring: "hsl(var(--ring))",
|
|
253
|
-
background: "hsl(var(--background))",
|
|
254
|
-
foreground: "hsl(var(--foreground))",
|
|
255
|
-
primary: {
|
|
256
|
-
DEFAULT: "hsl(var(--primary))",
|
|
257
|
-
foreground: "hsl(var(--primary-foreground))"
|
|
258
|
-
},
|
|
259
|
-
secondary: {
|
|
260
|
-
DEFAULT: "hsl(var(--secondary))",
|
|
261
|
-
foreground: "hsl(var(--secondary-foreground))"
|
|
262
|
-
},
|
|
263
|
-
muted: {
|
|
264
|
-
DEFAULT: "hsl(var(--muted))",
|
|
265
|
-
foreground: "hsl(var(--muted-foreground))"
|
|
266
|
-
},
|
|
267
|
-
accent: {
|
|
268
|
-
DEFAULT: "hsl(var(--accent))",
|
|
269
|
-
foreground: "hsl(var(--accent-foreground))"
|
|
270
|
-
},
|
|
271
|
-
destructive: {
|
|
272
|
-
DEFAULT: "hsl(var(--destructive))",
|
|
273
|
-
foreground: "hsl(var(--destructive-foreground))"
|
|
274
|
-
},
|
|
275
|
-
card: {
|
|
276
|
-
DEFAULT: "hsl(var(--card))",
|
|
277
|
-
foreground: "hsl(var(--card-foreground))"
|
|
278
|
-
},
|
|
279
|
-
popover: {
|
|
280
|
-
DEFAULT: "hsl(var(--popover))",
|
|
281
|
-
foreground: "hsl(var(--popover-foreground))"
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
borderRadius: {
|
|
285
|
-
lg: "var(--radius)",
|
|
286
|
-
md: "calc(var(--radius) - 2px)",
|
|
287
|
-
sm: "calc(var(--radius) - 4px)"
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
## Troubleshooting
|
|
295
|
-
|
|
296
|
-
`ui doctor` reports common issues:
|
|
297
|
-
- missing `trix-ui.json`
|
|
298
|
-
- missing `components/ui` directory
|
|
299
|
-
- missing `lib/utils.ts` or `styles/globals.css`
|
|
300
|
-
- registry load failures
|
|
301
|
-
- missing `.ui/lock.json`
|
|
302
|
-
|
|
303
|
-
## Notes
|
|
304
|
-
|
|
305
|
-
- Requires Node 18+ for built-in `fetch`.
|
|
306
|
-
- Paths are stored in `.ui/lock.json` relative to the project root for Windows/Mac safety. -->
|
|
1
|
+
<!-- # trix-ui
|
|
2
|
+
|
|
3
|
+
A small, registry-driven CLI that installs minimal, accessible UI components into your app.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Use it with npx or install as a dev dependency.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx trix-ui init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -D trix-ui
|
|
15
|
+
ui init
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quickstart
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx trix-ui init
|
|
22
|
+
npx trix-ui add button card dialog
|
|
23
|
+
npx trix-ui add-section hero
|
|
24
|
+
npx trix-ui add-wrapper glow-wrapper
|
|
25
|
+
npx trix-ui remove button
|
|
26
|
+
npx trix-ui remove --section hero
|
|
27
|
+
npx trix-ui remove --wrapper glow-wrapper
|
|
28
|
+
npx trix-ui list
|
|
29
|
+
npx trix-ui list --type sections
|
|
30
|
+
npx trix-ui list --type wrappers
|
|
31
|
+
npx trix-ui doctor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## How it works (detailed)
|
|
35
|
+
|
|
36
|
+
### High-level model
|
|
37
|
+
`trix-ui` is a registry-driven CLI. It installs UI assets into your app by copying
|
|
38
|
+
templates and recording those installs in a lockfile. The registry is a JSON catalog
|
|
39
|
+
of components, sections, wrappers, and composites. Each entry describes:
|
|
40
|
+
- which template files to copy
|
|
41
|
+
- where those files should land in your project
|
|
42
|
+
- any local or npm dependencies
|
|
43
|
+
|
|
44
|
+
### Core files and directories
|
|
45
|
+
When you run `ui init`, the CLI prepares a project for installs:
|
|
46
|
+
- `trix-ui.json` (config)
|
|
47
|
+
- `components/ui`, `components/sections`, `components/wrappers`, `components/composites`
|
|
48
|
+
- `lib/utils.ts`
|
|
49
|
+
- `styles/globals.css`
|
|
50
|
+
- `.ui/lock.json` (install tracking)
|
|
51
|
+
|
|
52
|
+
The lockfile is the source of truth for what the CLI has installed and is used
|
|
53
|
+
to safely remove files later.
|
|
54
|
+
|
|
55
|
+
### Data flow (install)
|
|
56
|
+
1. Resolve working directory (`--cwd` or `process.cwd()`).
|
|
57
|
+
2. Load config from `trix-ui.json` (merged with defaults).
|
|
58
|
+
3. Load registry (bundled by default or local if configured).
|
|
59
|
+
4. Load lockfile (creates empty lockfile if none exists).
|
|
60
|
+
5. Validate inputs (normalize names and verify registry entries).
|
|
61
|
+
6. Analyze dependencies:
|
|
62
|
+
- `dependencies.local` installs other registry components first.
|
|
63
|
+
- `dependencies.npm` are collected for optional install.
|
|
64
|
+
7. Handle conflicts (existing files/lockfile entries) with prompts, or `--force`.
|
|
65
|
+
8. Copy templates into target paths.
|
|
66
|
+
9. Update lockfile with installed entries and files.
|
|
67
|
+
10. Optionally install npm dependencies (`--skip-deps` to skip).
|
|
68
|
+
|
|
69
|
+
### Dependency resolution
|
|
70
|
+
- **Local dependencies** (`dependencies.local`) are other registry components and
|
|
71
|
+
are installed before sections/wrappers/composites.
|
|
72
|
+
- **NPM dependencies** (`dependencies.npm`) are optional and can be installed
|
|
73
|
+
by the CLI via your package manager.
|
|
74
|
+
|
|
75
|
+
### Conflict handling
|
|
76
|
+
If a target file already exists or an entry is in the lockfile:
|
|
77
|
+
- Default: skip and warn.
|
|
78
|
+
- `--force`: overwrite files and update lockfile entries.
|
|
79
|
+
- `--yes`: auto-confirm prompts.
|
|
80
|
+
|
|
81
|
+
### Safe removal
|
|
82
|
+
- `ui remove` and related commands remove only files tracked in `.ui/lock.json`.
|
|
83
|
+
- `--force` removes files based on registry targets even if not tracked.
|
|
84
|
+
|
|
85
|
+
### Registry resolution
|
|
86
|
+
- **Bundled registry** (default): packaged with the CLI (`registry/index.json`).
|
|
87
|
+
- **Local registry**: configure `registry` in `trix-ui.json` to point to a custom
|
|
88
|
+
registry file (and optional templates path).
|
|
89
|
+
|
|
90
|
+
### Tokens and path resolution
|
|
91
|
+
Registry `target` fields support tokens:
|
|
92
|
+
`{{components}}`, `{{sections}}`, `{{wrappers}}`, `{{composites}}`, `{{lib}}`, `{{styles}}`.
|
|
93
|
+
Tokens are resolved using `trix-ui.json` paths, then converted to absolute paths.
|
|
94
|
+
Note: `{{lib}}` resolves to the `paths.utils` file path.
|
|
95
|
+
|
|
96
|
+
### Doctor command
|
|
97
|
+
`ui doctor` checks:
|
|
98
|
+
- config presence and validity
|
|
99
|
+
- required directories/files
|
|
100
|
+
- registry load errors
|
|
101
|
+
- lockfile existence
|
|
102
|
+
|
|
103
|
+
## Commands
|
|
104
|
+
|
|
105
|
+
- `ui init` - Creates `trix-ui.json`, `components/ui`, `lib/utils.ts`, `styles/globals.css`, and `.ui/lock.json`.
|
|
106
|
+
- `ui add <component...>` - Copies templates into `components/ui` and updates `.ui/lock.json`.
|
|
107
|
+
- `ui add-section <section...>` - Copies section templates into `components/sections` and updates `.ui/lock.json`.
|
|
108
|
+
- `ui add-wrapper <wrapper...>` - Copies wrapper templates into `components/wrappers` and updates `.ui/lock.json`.
|
|
109
|
+
- `ui add-composite <composite...>` - Copies composite templates into `components/composites` and updates `.ui/lock.json`.
|
|
110
|
+
- `ui remove <component...>` - Removes only files tracked in `.ui/lock.json` (safe by default).
|
|
111
|
+
- `ui remove --section <section...>` - Removes only section files tracked in `.ui/lock.json` (safe by default).
|
|
112
|
+
- `ui remove --wrapper <wrapper...>` - Removes only wrapper files tracked in `.ui/lock.json` (safe by default).
|
|
113
|
+
- `ui remove --composite <composite...>` - Removes only composite files tracked in `.ui/lock.json` (safe by default).
|
|
114
|
+
- `ui list` - Lists registry components, sections, wrappers, and composites.
|
|
115
|
+
- `ui list --type sections` - Lists registry sections only.
|
|
116
|
+
- `ui list --type wrappers` - Lists registry wrappers only.
|
|
117
|
+
- `ui list --type composites` - Lists registry composites only.
|
|
118
|
+
- `ui doctor` - Checks config, registry, and required files.
|
|
119
|
+
|
|
120
|
+
## Config (trix-ui.json)
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"registry": {
|
|
125
|
+
"type": "bundled"
|
|
126
|
+
},
|
|
127
|
+
"paths": {
|
|
128
|
+
"components": "components/ui",
|
|
129
|
+
"sections": "components/sections",
|
|
130
|
+
"wrappers": "components/wrappers",
|
|
131
|
+
"composites": "components/composites",
|
|
132
|
+
"utils": "lib/utils.ts",
|
|
133
|
+
"styles": "styles/globals.css"
|
|
134
|
+
},
|
|
135
|
+
"barrel": false
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Notes:
|
|
140
|
+
- `registry.type`:
|
|
141
|
+
- `bundled` uses the registry packaged with the CLI (default).
|
|
142
|
+
- Set `barrel: true` and run `ui init --barrel` to create `components/ui/index.ts`.
|
|
143
|
+
|
|
144
|
+
## Registry format
|
|
145
|
+
|
|
146
|
+
`registry/index.json`:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"version": 1,
|
|
151
|
+
"components": [
|
|
152
|
+
{
|
|
153
|
+
"name": "button",
|
|
154
|
+
"description": "Button with variants and focus ring.",
|
|
155
|
+
"files": [
|
|
156
|
+
{
|
|
157
|
+
"source": "components/ui/button.tsx",
|
|
158
|
+
"target": "{{components}}/button.tsx"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"dependencies": {
|
|
162
|
+
"npm": ["clsx", "tailwind-merge"]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"sections": [
|
|
167
|
+
{
|
|
168
|
+
"name": "hero",
|
|
169
|
+
"description": "Hero section with headline, bullets, and CTAs.",
|
|
170
|
+
"files": [
|
|
171
|
+
{
|
|
172
|
+
"source": "sections/hero.tsx",
|
|
173
|
+
"target": "{{sections}}/hero.tsx"
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"dependencies": {
|
|
177
|
+
"local": ["badge", "button"]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"wrappers": [
|
|
182
|
+
{
|
|
183
|
+
"name": "glow-wrapper",
|
|
184
|
+
"description": "Glow effect wrapper for highlighting key components.",
|
|
185
|
+
"files": [
|
|
186
|
+
{
|
|
187
|
+
"source": "wrappers/glow-wrapper.tsx",
|
|
188
|
+
"target": "{{wrappers}}/glow-wrapper.tsx"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"composites": [
|
|
194
|
+
{
|
|
195
|
+
"name": "marketing-stack",
|
|
196
|
+
"description": "Composite layout for stacked marketing sections.",
|
|
197
|
+
"files": [
|
|
198
|
+
{
|
|
199
|
+
"source": "composites/marketing-stack.tsx",
|
|
200
|
+
"target": "{{composites}}/marketing-stack.tsx"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"dependencies": {
|
|
204
|
+
"local": ["button", "card"]
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- `source` is relative to `templates/`.
|
|
212
|
+
- `target` supports tokens: `{{components}}`, `{{sections}}`, `{{wrappers}}`, `{{composites}}`, `{{lib}}`, `{{styles}}`.
|
|
213
|
+
- `dependencies.local` installs registry components before the section, wrapper, or composite.
|
|
214
|
+
- `dependencies.npm` are printed after install; you install them manually.
|
|
215
|
+
|
|
216
|
+
## Add a new component
|
|
217
|
+
|
|
218
|
+
1. Create a template in `templates/components/ui/<name>.tsx`.
|
|
219
|
+
2. Add a registry entry in `registry/index.json`.
|
|
220
|
+
3. Run `ui add <name>` in your app.
|
|
221
|
+
|
|
222
|
+
## Add a new section
|
|
223
|
+
|
|
224
|
+
1. Create a template in `templates/sections/<name>.tsx`.
|
|
225
|
+
2. Add a registry entry in `registry/index.json` under `sections`.
|
|
226
|
+
3. Run `ui add-section <name>` in your app.
|
|
227
|
+
|
|
228
|
+
## Add a new wrapper
|
|
229
|
+
|
|
230
|
+
1. Create a template in `templates/wrappers/<name>.tsx`.
|
|
231
|
+
2. Add a registry entry in `registry/index.json` under `wrappers`.
|
|
232
|
+
3. Run `ui add-wrapper <name>` in your app.
|
|
233
|
+
|
|
234
|
+
## Add a new composite
|
|
235
|
+
|
|
236
|
+
1. Create a template in `templates/composites/<name>.tsx`.
|
|
237
|
+
2. Add a registry entry in `registry/index.json` under `composites`.
|
|
238
|
+
3. Run `ui add-composite <name>` in your app.
|
|
239
|
+
|
|
240
|
+
## Tailwind setup
|
|
241
|
+
|
|
242
|
+
Add CSS variables in `styles/globals.css` (installed by `ui init`).
|
|
243
|
+
In your Tailwind config, map colors to CSS variables, for example:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
export default {
|
|
247
|
+
theme: {
|
|
248
|
+
extend: {
|
|
249
|
+
colors: {
|
|
250
|
+
border: "hsl(var(--border))",
|
|
251
|
+
input: "hsl(var(--input))",
|
|
252
|
+
ring: "hsl(var(--ring))",
|
|
253
|
+
background: "hsl(var(--background))",
|
|
254
|
+
foreground: "hsl(var(--foreground))",
|
|
255
|
+
primary: {
|
|
256
|
+
DEFAULT: "hsl(var(--primary))",
|
|
257
|
+
foreground: "hsl(var(--primary-foreground))"
|
|
258
|
+
},
|
|
259
|
+
secondary: {
|
|
260
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
261
|
+
foreground: "hsl(var(--secondary-foreground))"
|
|
262
|
+
},
|
|
263
|
+
muted: {
|
|
264
|
+
DEFAULT: "hsl(var(--muted))",
|
|
265
|
+
foreground: "hsl(var(--muted-foreground))"
|
|
266
|
+
},
|
|
267
|
+
accent: {
|
|
268
|
+
DEFAULT: "hsl(var(--accent))",
|
|
269
|
+
foreground: "hsl(var(--accent-foreground))"
|
|
270
|
+
},
|
|
271
|
+
destructive: {
|
|
272
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
273
|
+
foreground: "hsl(var(--destructive-foreground))"
|
|
274
|
+
},
|
|
275
|
+
card: {
|
|
276
|
+
DEFAULT: "hsl(var(--card))",
|
|
277
|
+
foreground: "hsl(var(--card-foreground))"
|
|
278
|
+
},
|
|
279
|
+
popover: {
|
|
280
|
+
DEFAULT: "hsl(var(--popover))",
|
|
281
|
+
foreground: "hsl(var(--popover-foreground))"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
borderRadius: {
|
|
285
|
+
lg: "var(--radius)",
|
|
286
|
+
md: "calc(var(--radius) - 2px)",
|
|
287
|
+
sm: "calc(var(--radius) - 4px)"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Troubleshooting
|
|
295
|
+
|
|
296
|
+
`ui doctor` reports common issues:
|
|
297
|
+
- missing `trix-ui.json`
|
|
298
|
+
- missing `components/ui` directory
|
|
299
|
+
- missing `lib/utils.ts` or `styles/globals.css`
|
|
300
|
+
- registry load failures
|
|
301
|
+
- missing `.ui/lock.json`
|
|
302
|
+
|
|
303
|
+
## Notes
|
|
304
|
+
|
|
305
|
+
- Requires Node 18+ for built-in `fetch`.
|
|
306
|
+
- Paths are stored in `.ui/lock.json` relative to the project root for Windows/Mac safety. -->
|