@voltui/agent 0.5.0 → 0.6.0
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 +61 -21
- package/content.js +16 -538
- package/installer.js +210 -18
- package/package.json +7 -4
- package/skills/volt-ui/SKILL.md +48 -0
- package/skills/volt-ui-adoption/SKILL.md +71 -0
- package/skills/volt-ui-component-selection/SKILL.md +225 -0
- package/skills/volt-ui-distribution/SKILL.md +83 -0
- package/skills/volt-ui-forms/SKILL.md +77 -0
- package/skills/volt-ui-overlays/SKILL.md +72 -0
- package/skills/volt-ui-styling/SKILL.md +68 -0
- package/skills.js +74 -0
package/content.js
CHANGED
|
@@ -1,549 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Content the @voltui/agent installer writes into a consumer project:
|
|
5
|
-
*
|
|
4
|
+
* Content the @voltui/agent installer writes into a consumer project: the rules/instructions block
|
|
5
|
+
* for agents that do not load skills, and the VS Code snippets. The skills themselves are the files
|
|
6
|
+
* under ./skills (see ./skills.js); the rules block is built from them, never written separately.
|
|
6
7
|
*
|
|
7
8
|
* Single source for both the installer (setup-agent.js) and the hosted /api/mcp/setup endpoint, which
|
|
8
9
|
* reads a generated copy (`pnpm generate:mcp-content`). Edit here, never in the generated file.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const { routingBlock, loadSkills } = require('./skills');
|
|
13
|
+
|
|
14
|
+
const DEFAULT_MCP_URL = 'https://voltui.dev/api/mcp';
|
|
12
15
|
|
|
13
16
|
/** @param {string} MCP_URL endpoint written into the rules/instructions */
|
|
14
17
|
function buildContent(MCP_URL) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- class-variance-authority (CVA) for variants
|
|
23
|
-
- ng-primitives for accessibility / interaction primitives
|
|
24
|
-
- Signals: input(), output(), model(), computed()
|
|
25
|
-
|
|
26
|
-
## Naming
|
|
27
|
-
| Context | Selector | Class |
|
|
28
|
-
|---------|----------|-------|
|
|
29
|
-
| Source (library) | \`volt-*\` (component) / \`[voltXxx]\` (directive) | \`Volt*\` |
|
|
30
|
-
| CLI output (user project) | \`ui-*\` (component) / \`[uiXxx]\` (directive) | \`Ui*\` |
|
|
31
|
-
|
|
32
|
-
## Components
|
|
33
|
-
button · badge · card · input · autofill · search · textarea · checkbox · radio · switch · toggle ·
|
|
34
|
-
select · tabs · accordion · avatar · separator · tooltip · navigation-menu · form-field ·
|
|
35
|
-
dialog · popover · dropdown-menu · slider · range-slider · progress · breadcrumbs · sidebar ·
|
|
36
|
-
toggle-group · meter · pagination · toast · input-otp · file-upload · combobox ·
|
|
37
|
-
date-picker · listbox · toolbar · skeleton · table · resizable · theme · alert · spinner · empty-state
|
|
38
|
-
|
|
39
|
-
## Component import (CLI)
|
|
40
|
-
\`\`\`ts
|
|
41
|
-
import { UiButton } from './ui/button';
|
|
42
|
-
import { UiCard, UiCardHeader, UiCardContent, UiCardFooter } from './ui/card';
|
|
43
|
-
import { UiFormField, UiLabel, UiHint, UiError } from './ui/form-field';
|
|
44
|
-
import { UiToastService } from './ui/toast';
|
|
45
|
-
\`\`\`
|
|
46
|
-
|
|
47
|
-
## Template selectors
|
|
48
|
-
\`\`\`html
|
|
49
|
-
<!-- Components -->
|
|
50
|
-
<button uiButton variant="solid|outline|ghost|link|destructive" size="sm|md|lg|icon">
|
|
51
|
-
<a uiButton routerLink="/docs"> <!-- links styled as buttons: never <a><ui-button> -->
|
|
52
|
-
<ui-button variant="…" aria-label="…"> <!-- still supported; aria-* forwarded to its <button> -->
|
|
53
|
-
<ui-card> <ui-card-header> <ui-card-title> <ui-card-content class="p-3"> <ui-card-footer>
|
|
54
|
-
<ui-form-field> <ui-label> <ui-input size="sm|md|lg" state="default|error|success"> <ui-hint> <ui-error>
|
|
55
|
-
<ui-badge variant="solid|secondary|outline|destructive|success|warning|info">
|
|
56
|
-
<ui-alert variant="default|info|success|warning|destructive" role="status|alert"> <ui-alert-title> <ui-alert-description>
|
|
57
|
-
<ui-spinner size="sm|md|lg" label="Loading…">
|
|
58
|
-
<ui-empty-state> <ui-empty-state-title> <ui-empty-state-description> <div slot="actions">
|
|
59
|
-
<ui-tabs [(value)]="activeTab"> <ui-tabs-list> <ui-tabs-trigger value="x"> <ui-tabs-content value="x">
|
|
60
|
-
<ui-accordion type="single|multiple" [collapsible]="true">
|
|
61
|
-
<ui-select placeholder="…"> <ui-select-content> <ui-select-item value="x">
|
|
62
|
-
<ui-table> <ui-table-header> <ui-table-body> <ui-table-row> <ui-table-head> <ui-table-cell>
|
|
63
|
-
<ui-skeleton variant="circle|text|rectangle" width="…" height="…">
|
|
64
|
-
|
|
65
|
-
<!-- Attribute directives (overlays) -->
|
|
66
|
-
<button [uiDialog]="tpl"> + <ng-template> with <div uiDialogContent>
|
|
67
|
-
<ng-template uiDialogRoot [(open)]="isOpen" let-close="close"> <!-- state-controlled dialog -->
|
|
68
|
-
<button [uiDrawer]="tpl"> + <ng-template> with <div uiDrawerContent side="left|right|top|bottom">
|
|
69
|
-
<button uiPopover [uiPopover]="tpl"> + <ng-template> with <ui-popover-content>
|
|
70
|
-
<button uiTooltip [uiTooltip]="tpl"> + <ng-template> with <ui-tooltip-content>
|
|
71
|
-
<button [uiDropdownMenu]="tpl"> + <ng-template> with <ui-dropdown-menu>
|
|
72
|
-
<img uiAvatarImage>
|
|
73
|
-
<a uiNavigationMenuLink>
|
|
74
|
-
\`\`\`
|
|
75
|
-
|
|
76
|
-
## Theme
|
|
77
|
-
\`\`\`ts
|
|
78
|
-
import { provideVoltTheme } from '@voltui/components';
|
|
79
|
-
// colors: volt | ember | sage | dusk | glacier
|
|
80
|
-
// styles: sharp | soft | brutal | ghost | retro
|
|
81
|
-
provideVoltTheme({ color: 'ember', style: 'soft', dark: false })
|
|
82
|
-
\`\`\`
|
|
83
|
-
|
|
84
|
-
## CLI
|
|
85
|
-
\`\`\`bash
|
|
86
|
-
npx @voltui/cli init # scaffold ui/ folder
|
|
87
|
-
npx @voltui/cli add button # add a component
|
|
88
|
-
npx @voltui/cli list # list all components
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
## Code guidelines
|
|
92
|
-
1. Use standalone components with \`imports\` array.
|
|
93
|
-
2. Use OnPush change detection.
|
|
94
|
-
3. Use signal inputs: \`readonly x = input<T>(default)\`.
|
|
95
|
-
4. Boolean inputs must use \`booleanAttribute\`.
|
|
96
|
-
5. Import copied components from \`'./ui/<component>'\`.
|
|
97
|
-
6. Overlays are attribute-directive triggers + \`<ng-template>\` — never use \`<ui-dialog>\`, \`<ui-tooltip>\`, \`<ui-popover-trigger>\`, or \`<ui-dropdown-menu-trigger>\`. For state-driven dialogs use \`<ng-template uiDialogRoot [(open)]>\` or \`UiDialogService.open()\`.
|
|
98
|
-
7. Links that look like buttons are \`<a uiButton routerLink>\` / \`<a uiButton href>\`. Never put a button inside a link.
|
|
99
|
-
8. \`class\` on any Volt component is merged with \`cn()\` onto the element that owns the styles (\`<ui-input class="w-24">\` styles the native input).
|
|
100
|
-
9. Toasts: \`inject(UiToastService).success('Saved')\` — no template or ng-primitives import needed.
|
|
101
|
-
10. Server-side search: \`<ui-combobox filterMode="manual" [items]="results()" [loading]="loading()" (queryChange)="search($event)" />\` — the app fetches (latest response wins); never feed server results to the default local filter. Router breadcrumbs: \`<a uiBreadcrumbLink routerLink="…">\`. Native selects: \`<select uiNativeSelect>\`.
|
|
102
|
-
|
|
103
|
-
## AI tools
|
|
104
|
-
MCP server at ${MCP_URL} — query it for component details, usage examples, and theme info.
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
const COPILOT_INSTRUCTIONS = `# Volt UI — GitHub Copilot Instructions
|
|
108
|
-
|
|
109
|
-
You are working with **Volt UI**, an Angular v21 component library (shadcn/ui-inspired).
|
|
110
|
-
|
|
111
|
-
## Architecture
|
|
112
|
-
- **Standalone components** — no NgModules
|
|
113
|
-
- **Zoneless signals** — input(), output(), model(), computed()
|
|
114
|
-
- **OnPush** change detection everywhere
|
|
115
|
-
- **CVA** (class-variance-authority) for variants
|
|
116
|
-
- **ng-primitives** for accessibility and interaction behavior
|
|
117
|
-
|
|
118
|
-
## Naming
|
|
119
|
-
- Library source: \`volt-*\` element selectors and \`[voltXxx]\` attribute directives, \`Volt*\` classes
|
|
120
|
-
- After CLI copy: \`ui-*\` element selectors and \`[uiXxx]\` attribute directives, \`Ui*\` classes
|
|
121
|
-
- Import from: \`'./ui/<component>'\`
|
|
122
|
-
|
|
123
|
-
## Available components
|
|
124
|
-
|
|
125
|
-
| Component | Import | Selectors | Notes |
|
|
126
|
-
|-----------|--------|-----------|-------|
|
|
127
|
-
| Button | \`./ui/button\` | \`button[uiButton]\`, \`a[uiButton]\`, \`ui-button\` | Variants: solid, outline, ghost, link, destructive. Use \`a[uiButton]\` for links |
|
|
128
|
-
| Badge | \`./ui/badge\` | \`ui-badge\` | Variants: solid, secondary, outline, destructive, success, warning, info |
|
|
129
|
-
| Alert | \`./ui/alert\` | \`ui-alert\` + title/description | Variants: default, info, success, warning, destructive. Opt-in \`role\` |
|
|
130
|
-
| Spinner | \`./ui/spinner\` | \`ui-spinner\` | \`size\`; \`label\` makes it \`role="status"\` |
|
|
131
|
-
| Empty State | \`./ui/empty-state\` | \`ui-empty-state\` + title/description | Optional \`[slot=icon]\`, \`[slot=actions]\`; plain content |
|
|
132
|
-
| Autofill | \`./ui/autofill\` | \`[uiAutofill]\` directive | Emits \`autofillChange\` |
|
|
133
|
-
| Card | \`./ui/card\` | \`ui-card\` + header/title/description/content/footer | Presentational |
|
|
134
|
-
| Input | \`./ui/input\` | \`ui-input\` | CVA; \`size\`, \`state\`, \`class\` style the native input |
|
|
135
|
-
| Textarea | \`./ui/textarea\` | \`ui-textarea\` | CVA |
|
|
136
|
-
| Checkbox | \`./ui/checkbox\` | \`ui-checkbox\` | CVA |
|
|
137
|
-
| Radio | \`./ui/radio\` | \`ui-radio-group\`, \`ui-radio-item\` | CVA |
|
|
138
|
-
| Switch | \`./ui/switch\` | \`ui-switch\` | CVA |
|
|
139
|
-
| Toggle | \`./ui/toggle\` | \`ui-toggle\` | CVA |
|
|
140
|
-
| Toggle Group | \`./ui/toggle-group\` | \`ui-toggle-group\`, \`ui-toggle-group-item\` | CVA |
|
|
141
|
-
| Select | \`./ui/select\` | \`ui-select\` + content/item/label/separator + \`<select uiNativeSelect>\` (attribute, not an element) | CVA |
|
|
142
|
-
| Tabs | \`./ui/tabs\` | \`ui-tabs\` + list/trigger/content | Use \`value\` model, not \`defaultValue\` |
|
|
143
|
-
| Accordion | \`./ui/accordion\` | \`ui-accordion\` + item/trigger/content | \`type\`, \`collapsible\` |
|
|
144
|
-
| Avatar | \`./ui/avatar\` | \`ui-avatar\`, \`<img uiAvatarImage>\`, \`ui-avatar-fallback\` | Image is directive |
|
|
145
|
-
| Breadcrumbs | \`./ui/breadcrumbs\` | \`ui-breadcrumbs\` + singular \`breadcrumb-*\` sub-components | |
|
|
146
|
-
| Separator | \`./ui/separator\` | \`ui-separator\` | \`orientation\` |
|
|
147
|
-
| Skeleton | \`./ui/skeleton\` | \`ui-skeleton\` | \`variant\`, \`width\`, \`height\` |
|
|
148
|
-
| Meter | \`./ui/meter\` | \`ui-meter\` + label/value/track/indicator | |
|
|
149
|
-
| Progress | \`./ui/progress\` | \`ui-progress\` + label/value | |
|
|
150
|
-
| Slider | \`./ui/slider\` | \`ui-slider\` | CVA |
|
|
151
|
-
| Range Slider | \`./ui/range-slider\` | \`ui-range-slider\` | CVA, dual-thumb |
|
|
152
|
-
| Form Field | \`./ui/form-field\` | \`ui-form-field\`, \`ui-label\`, \`ui-hint\`, \`ui-error\` | Wires label/description ids |
|
|
153
|
-
| Pagination | \`./ui/pagination\` | \`ui-pagination\` + first/previous/next/last/button | |
|
|
154
|
-
| Table | \`./ui/table\` | \`ui-table\` + header/body/footer/row/head/cell/caption | |
|
|
155
|
-
| Toolbar | \`./ui/toolbar\` | \`ui-toolbar\`, \`button[uiToolbarButton]\` | |
|
|
156
|
-
| Search | \`./ui/search\` | \`ui-search\`, \`ui-search-clear\` | |
|
|
157
|
-
| Input OTP | \`./ui/input-otp\` | \`ui-input-otp\`, \`ui-input-otp-slot\` | |
|
|
158
|
-
| Combobox | \`./ui/combobox\` | \`ui-combobox\` + input/button/dropdown/option | |
|
|
159
|
-
| Date Picker | \`./ui/date-picker\` | \`ui-date-picker\`, \`ui-date-range-picker\` + sub-components | CVA |
|
|
160
|
-
| File Upload | \`./ui/file-upload\` | \`ui-file-upload\`, \`ui-file-dropzone\` | |
|
|
161
|
-
| Listbox | \`./ui/listbox\` | \`ui-listbox\` + option/section/header | |
|
|
162
|
-
| Navigation Menu | \`./ui/navigation-menu\` | \`ui-navigation-menu\` + list/item/trigger/content/link | Link is \`a[uiNavigationMenuLink]\` |
|
|
163
|
-
| Resizable | \`./ui/resizable\` | \`ui-resizable\` + panel/handle | |
|
|
164
|
-
| Sidebar | \`./ui/sidebar\` | \`ui-sidebar\` layout group | |
|
|
165
|
-
| Theme | \`./ui/theme\` | \`provideVoltTheme\`, \`applyVoltTheme\` | |
|
|
166
|
-
| Dialog | \`./ui/dialog\` | \`[uiDialog]\`, \`ng-template[uiDialogRoot]\`, \`[uiDialogOverlay]\`, \`[uiDialogContent]\`, \`[uiDialogTitle]\`, \`[uiDialogDescription]\` | Trigger, \`[(open)]\`-controlled, or \`UiDialogService.open()\` |
|
|
167
|
-
| Drawer | \`./ui/drawer\` | \`[uiDrawer]\`, \`[uiDrawerOverlay]\`, \`[uiDrawerContent]\`, \`[uiDrawerTitle]\`, \`[uiDrawerDescription]\`, \`ui-drawer-close\` | Template-based overlay |
|
|
168
|
-
| Popover | \`./ui/popover\` | \`[uiPopover]\`, \`ui-popover-content\` | Template-based overlay |
|
|
169
|
-
| Tooltip | \`./ui/tooltip\` | \`[uiTooltip]\`, \`ui-tooltip-content\` | Template-based overlay |
|
|
170
|
-
| Dropdown Menu | \`./ui/dropdown-menu\` | \`[uiDropdownMenu]\`, \`ui-dropdown-menu\` + item/label/separator | Template-based overlay |
|
|
171
|
-
| Toast | \`./ui/toast\` | \`ui-toast\` + title/description/close | Use \`UiToastService\` (show/success/error/warning/info) |
|
|
172
|
-
|
|
173
|
-
Known upstream caveats in \`ng-primitives\`: meter currently exposes \`aria-valuenow\` as a percentage for non-0..100 ranges, and progress currently reports \`aria-valuemin="0"\` even when \`min\` is customized.
|
|
174
|
-
|
|
175
|
-
## Overlay pattern
|
|
176
|
-
Overlays are never used as element selectors. Use an attribute-directive trigger that references an \`<ng-template>\`:
|
|
177
|
-
|
|
178
|
-
\`\`\`html
|
|
179
|
-
<button [uiDialog]="dialogTpl">Open</button>
|
|
180
|
-
<ng-template #dialogTpl let-close="close">
|
|
181
|
-
<div uiDialogOverlay></div>
|
|
182
|
-
<div uiDialogContent>
|
|
183
|
-
<h2 uiDialogTitle>Title</h2>
|
|
184
|
-
<p uiDialogDescription>Description</p>
|
|
185
|
-
<button uiButton (click)="close()">Close</button>
|
|
186
|
-
</div>
|
|
187
|
-
</ng-template>
|
|
188
|
-
|
|
189
|
-
<!-- State-controlled: no trigger element -->
|
|
190
|
-
<ng-template uiDialogRoot [(open)]="editing" let-close="close">…</ng-template>
|
|
191
|
-
\`\`\`
|
|
192
|
-
|
|
193
|
-
## Button variants
|
|
194
|
-
\`\`\`html
|
|
195
|
-
<button uiButton variant="solid|outline|ghost|link|destructive" size="sm|md|lg|icon">Save</button>
|
|
196
|
-
<a uiButton variant="outline" routerLink="/docs">Docs</a>
|
|
197
|
-
<button uiButton size="icon" aria-label="Close"><svg aria-hidden="true">…</svg></button>
|
|
198
|
-
\`\`\`
|
|
199
|
-
|
|
200
|
-
## Card pattern
|
|
201
|
-
\`\`\`html
|
|
202
|
-
<ui-card>
|
|
203
|
-
<ui-card-header>
|
|
204
|
-
<ui-card-title>Title</ui-card-title>
|
|
205
|
-
<ui-card-description>Description</ui-card-description>
|
|
206
|
-
</ui-card-header>
|
|
207
|
-
<ui-card-content>Content</ui-card-content>
|
|
208
|
-
<ui-card-footer>
|
|
209
|
-
<ui-button variant="outline">Cancel</ui-button>
|
|
210
|
-
<ui-button>Save</ui-button>
|
|
211
|
-
</ui-card-footer>
|
|
212
|
-
</ui-card>
|
|
213
|
-
\`\`\`
|
|
214
|
-
|
|
215
|
-
## Form field pattern
|
|
216
|
-
\`\`\`html
|
|
217
|
-
<ui-form-field>
|
|
218
|
-
<ui-label>Email</ui-label>
|
|
219
|
-
<ui-input type="email" placeholder="you@example.com" />
|
|
220
|
-
<ui-hint>We'll never share your email</ui-hint>
|
|
221
|
-
<ui-error>Email is required</ui-error>
|
|
222
|
-
</ui-form-field>
|
|
223
|
-
\`\`\`
|
|
224
|
-
|
|
225
|
-
## Tabs pattern
|
|
226
|
-
\`\`\`html
|
|
227
|
-
<ui-tabs [(value)]="activeTab">
|
|
228
|
-
<ui-tabs-list>
|
|
229
|
-
<ui-tabs-trigger value="account">Account</ui-tabs-trigger>
|
|
230
|
-
<ui-tabs-trigger value="password">Password</ui-tabs-trigger>
|
|
231
|
-
</ui-tabs-list>
|
|
232
|
-
<ui-tabs-content value="account">Account settings.</ui-tabs-content>
|
|
233
|
-
<ui-tabs-content value="password">Password settings.</ui-tabs-content>
|
|
234
|
-
</ui-tabs>
|
|
235
|
-
\`\`\`
|
|
236
|
-
|
|
237
|
-
## Theme system
|
|
238
|
-
\`\`\`ts
|
|
239
|
-
import { provideVoltTheme } from '@voltui/components';
|
|
240
|
-
// colors: volt | ember | sage | dusk | glacier
|
|
241
|
-
// styles: sharp | soft | brutal | ghost | retro
|
|
242
|
-
providers: [provideVoltTheme({ color: 'ember', style: 'soft', dark: false })]
|
|
243
|
-
\`\`\`
|
|
244
|
-
|
|
245
|
-
## CLI
|
|
246
|
-
\`\`\`bash
|
|
247
|
-
npx @voltui/cli init
|
|
248
|
-
npx @voltui/cli add button card form-field input
|
|
249
|
-
npx @voltui/cli list
|
|
250
|
-
\`\`\`
|
|
251
|
-
|
|
252
|
-
## Code guidelines
|
|
253
|
-
1. Use standalone components with \`imports\` array.
|
|
254
|
-
2. Use OnPush change detection.
|
|
255
|
-
3. Use signal inputs (\`readonly x = input<T>(default)\`).
|
|
256
|
-
4. Use \`computed()\` for derived values.
|
|
257
|
-
5. Boolean inputs must use \`booleanAttribute\`.
|
|
258
|
-
6. Import from \`'./ui/<component>'\`.
|
|
259
|
-
7. Never use \`<ui-dialog>\`, \`<ui-tooltip>\`, \`<ui-popover-trigger>\`, or \`<ui-dropdown-menu-trigger>\`.
|
|
260
|
-
8. Never nest a button inside a link: use \`<a uiButton>\`.
|
|
261
|
-
9. \`class\` is merged with \`cn()\` onto the element that owns the styles.
|
|
262
|
-
10. Server-side search: \`<ui-combobox filterMode="manual" (queryChange)="search($event)">\` (the app fetches; never combine with the local filter). Router breadcrumbs: \`<a uiBreadcrumbLink routerLink>\`. Native selects: \`<select uiNativeSelect>\`.
|
|
263
|
-
`;
|
|
264
|
-
|
|
265
|
-
const VOLT_UI_SKILL = `---
|
|
266
|
-
name: volt-ui
|
|
267
|
-
description: >
|
|
268
|
-
Understand and integrate Volt UI components into Angular projects.
|
|
269
|
-
Volt UI is an Angular component library inspired by shadcn/ui, built on
|
|
270
|
-
ng-primitives, Tailwind CSS v4, standalone signals components and CVA.
|
|
271
|
-
Use when the project consumes @voltui/components, @voltui/cli, or copied
|
|
272
|
-
Volt UI source under src/app/ui.
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
# Volt UI — AI Integration Skill
|
|
276
|
-
|
|
277
|
-
## When to use this skill
|
|
278
|
-
|
|
279
|
-
- The user is adding, editing or debugging Volt UI components in an Angular app.
|
|
280
|
-
- You see imports from \`'@voltui/components'\`, \`'./ui/button'\`, etc.
|
|
281
|
-
- You need to generate markup, fix selectors, wire Reactive Forms, or theme the app.
|
|
282
|
-
- The user asks about available components, CLI commands, or MCP tools.
|
|
283
|
-
|
|
284
|
-
## What Volt UI is
|
|
285
|
-
|
|
286
|
-
- **Angular 21**, zoneless, standalone components, OnPush, signals (\`input()\`, \`output()\`, \`model()\`).
|
|
287
|
-
- **Tailwind CSS v4** with semantic tokens (\`bg-primary\`, \`text-foreground\`, \`rounded-md\`).
|
|
288
|
-
- **ng-primitives** provides accessible behavior (keyboard, focus, overlays, CVA).
|
|
289
|
-
- **class-variance-authority (CVA)** drives component variants.
|
|
290
|
-
- **Two first-class consumption modes**:
|
|
291
|
-
1. **Package mode**: \`npm install @voltui/components\`, import \`VoltXxx\` from \`'@voltui/components'\`. Centralized updates, shared behavior, one version.
|
|
292
|
-
2. **Copy-and-own mode**: \`npx @voltui/cli add button\` copies source into the project (default \`src/app/ui\`) as editable \`UiXxx\` code.
|
|
293
|
-
|
|
294
|
-
## Naming conventions
|
|
295
|
-
|
|
296
|
-
| Context | Selector | Class name | Import path |
|
|
297
|
-
| -------------- | ----------------------------------------------- | ---------- | ----------------------------------- |
|
|
298
|
-
| Library source | \`volt-*\` (component) / \`[voltXxx]\` (directive) | \`VoltXxx\` | \`'@voltui/components'\` |
|
|
299
|
-
| After CLI copy | \`ui-*\` (component) / \`[uiXxx]\` (directive) | \`UiXxx\` | \`'./ui/<component>'\` |
|
|
300
|
-
|
|
301
|
-
Always prefer the CLI prefix (\`ui-*\` / \`UiXxx\`) when generating code for this project unless it explicitly imports from the npm package.
|
|
302
|
-
|
|
303
|
-
## Adding components to this project
|
|
304
|
-
|
|
305
|
-
\`\`\`bash
|
|
306
|
-
npx @voltui/cli init # scaffolds src/app/ui
|
|
307
|
-
npx @voltui/cli add button card form-field input
|
|
308
|
-
npx @voltui/cli add dialog ./src/app/shared/ui --dry-run
|
|
309
|
-
\`\`\`
|
|
310
|
-
|
|
311
|
-
Runtime dependencies (installed once):
|
|
312
|
-
|
|
313
|
-
\`\`\`bash
|
|
314
|
-
npm install ng-primitives class-variance-authority clsx tailwind-merge
|
|
315
|
-
\`\`\`
|
|
316
|
-
|
|
317
|
-
## Theme setup
|
|
318
|
-
|
|
319
|
-
In the app's global CSS:
|
|
320
|
-
|
|
321
|
-
\`\`\`css
|
|
322
|
-
@import 'tailwindcss';
|
|
323
|
-
@import '@voltui/components/themes.css';
|
|
324
|
-
\`\`\`
|
|
325
|
-
|
|
326
|
-
In \`app.config.ts\`:
|
|
327
|
-
|
|
328
|
-
\`\`\`ts
|
|
329
|
-
import { provideVoltTheme } from '@voltui/components';
|
|
330
|
-
|
|
331
|
-
bootstrapApplication(AppComponent, {
|
|
332
|
-
providers: [provideVoltTheme({ color: 'volt', style: 'sharp', dark: false })],
|
|
333
|
-
});
|
|
334
|
-
\`\`\`
|
|
335
|
-
|
|
336
|
-
Color presets: \`volt\`, \`ember\`, \`sage\`, \`dusk\`, \`glacier\`.
|
|
337
|
-
Style presets: \`sharp\`, \`soft\`, \`brutal\`, \`ghost\`, \`retro\`.
|
|
338
|
-
|
|
339
|
-
## Component / directive selector rules
|
|
340
|
-
|
|
341
|
-
- Element selectors are used for presentational containers: \`<ui-card>\`, \`<ui-button>\`, \`<ui-input>\`.
|
|
342
|
-
- Attribute directives are used when the primitive is applied to an existing host element:
|
|
343
|
-
- Dialog trigger: \`<button [uiDialog]="tpl">\`
|
|
344
|
-
- Drawer trigger: \`<button [uiDrawer]="tpl">\`
|
|
345
|
-
- Popover trigger: \`<button uiPopover [uiPopover]="tpl">\`
|
|
346
|
-
- Tooltip trigger: \`<button uiTooltip [uiTooltip]="tpl">\`
|
|
347
|
-
- Dropdown trigger: \`<button [uiDropdownMenu]="tpl">\`
|
|
348
|
-
- Avatar image: \`<img uiAvatarImage>\`
|
|
349
|
-
- Navigation link: \`<a uiNavigationMenuLink>\`
|
|
350
|
-
- Overlays (dialog, drawer, popover, tooltip, dropdown-menu) are declared inside an \`<ng-template>\` and referenced by the trigger.
|
|
351
|
-
|
|
352
|
-
## Reactive Forms
|
|
353
|
-
|
|
354
|
-
Most CVA components expose \`formControl\` directly:
|
|
355
|
-
|
|
356
|
-
\`\`\`ts
|
|
357
|
-
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
358
|
-
import { UiInput, UiCheckbox, UiSwitch, UiRadioGroup, UiRadioItem } from './ui';
|
|
359
|
-
|
|
360
|
-
email = new FormControl('', { nonNullable: true });
|
|
361
|
-
accepted = new FormControl(false, { nonNullable: true });
|
|
362
|
-
\`\`\`
|
|
363
|
-
|
|
364
|
-
\`\`\`html
|
|
365
|
-
<ui-form-field>
|
|
366
|
-
<ui-label>Email</ui-label>
|
|
367
|
-
<ui-input [formControl]="email" type="email" />
|
|
368
|
-
<ui-hint>We'll only use this for account updates.</ui-hint>
|
|
369
|
-
</ui-form-field>
|
|
370
|
-
|
|
371
|
-
<ui-checkbox [formControl]="accepted">Accept terms</ui-checkbox>
|
|
372
|
-
\`\`\`
|
|
373
|
-
|
|
374
|
-
## Common patterns
|
|
375
|
-
|
|
376
|
-
### Buttons and links
|
|
377
|
-
|
|
378
|
-
\`\`\`html
|
|
379
|
-
<button uiButton type="submit">Save</button>
|
|
380
|
-
<a uiButton variant="outline" routerLink="/docs">Docs</a>
|
|
381
|
-
<button uiButton size="icon" aria-label="Switch theme"><svg aria-hidden="true">…</svg></button>
|
|
382
|
-
\`\`\`
|
|
383
|
-
|
|
384
|
-
Never wrap \`<ui-button>\` in \`<a>\`. \`<ui-button>\` remains supported and forwards \`aria-label\`,
|
|
385
|
-
\`aria-expanded\`, \`aria-controls\`, \`aria-pressed\`, \`aria-haspopup\`, \`aria-labelledby\`,
|
|
386
|
-
\`aria-describedby\` to its inner \`<button>\`.
|
|
387
|
-
|
|
388
|
-
### Styling
|
|
389
|
-
|
|
390
|
-
\`class\` on every Volt component is merged with \`cn()\` (tailwind-merge) onto the element that owns
|
|
391
|
-
the styles: \`<ui-card-content class="p-3">\` replaces \`p-6\`, \`<ui-input class="w-24">\` styles the
|
|
392
|
-
native \`<input>\`.
|
|
393
|
-
|
|
394
|
-
### Search and navigation
|
|
395
|
-
|
|
396
|
-
Local list → the default. Server/API search → \`filterMode="manual"\` plus \`(queryChange)\`. Never pass
|
|
397
|
-
server results to the default local filter: it hides rows whose label does not contain the typed text.
|
|
398
|
-
|
|
399
|
-
\`\`\`html
|
|
400
|
-
<!-- A list you already have: Ui narrows it by label as the user types. -->
|
|
401
|
-
<ui-combobox [(value)]="framework" [items]="frameworks" />
|
|
402
|
-
|
|
403
|
-
<!-- A server decides what matches: items are rendered exactly as supplied. -->
|
|
404
|
-
<ui-combobox
|
|
405
|
-
label="Owner"
|
|
406
|
-
filterMode="manual"
|
|
407
|
-
[items]="results()"
|
|
408
|
-
[loading]="loading()"
|
|
409
|
-
loadingText="Searching…"
|
|
410
|
-
[emptyText]="'No matches for ' + query()"
|
|
411
|
-
[itemLabel]="label"
|
|
412
|
-
[compareWith]="sameId"
|
|
413
|
-
[(value)]="owner"
|
|
414
|
-
(queryChange)="search($event)"
|
|
415
|
-
/>
|
|
416
|
-
\`\`\`
|
|
417
|
-
|
|
418
|
-
\`(queryChange)\` is the text the user typed — not the value, and not the label written back after a
|
|
419
|
-
selection, so it is safe to start a request from. The application owns the request: debounce it, make
|
|
420
|
-
the latest response win, show errors. The combobox never fetches. \`loading\` shows a row and is
|
|
421
|
-
announced once through the combobox's own live region; do not add a second \`role="status"\`.
|
|
422
|
-
|
|
423
|
-
Angular Router breadcrumbs: put the directive on your own anchor so \`routerLink\` owns navigation.
|
|
424
|
-
|
|
425
|
-
\`\`\`html
|
|
426
|
-
<a uiBreadcrumbLink routerLink="/admin" [queryParams]="{ tab: 'users' }">Admin</a>
|
|
427
|
-
<ui-breadcrumb-link href="/docs">Docs</ui-breadcrumb-link> <!-- plain URL only -->
|
|
428
|
-
\`\`\`
|
|
429
|
-
|
|
430
|
-
Prefer native HTML where the browser already has the right primitive: \`<select uiNativeSelect>\` (an
|
|
431
|
-
attribute on a real \`<select>\`; there is no \`<ui-native-select>\` element), \`<details>\`/\`<summary>\`,
|
|
432
|
-
\`<input type="file">\`. Use Ui when it adds reusable styling or behaviour you would otherwise copy.
|
|
433
|
-
|
|
434
|
-
### Feedback
|
|
435
|
-
|
|
436
|
-
\`\`\`ts
|
|
437
|
-
private readonly toast = inject(UiToastService);
|
|
438
|
-
this.toast.success('Changes saved');
|
|
439
|
-
this.toast.error('Could not save', { description: 'Try again.' });
|
|
440
|
-
\`\`\`
|
|
441
|
-
|
|
442
|
-
\`\`\`html
|
|
443
|
-
<ui-badge variant="success">Connected</ui-badge>
|
|
444
|
-
<ui-alert variant="warning" role="status">
|
|
445
|
-
<ui-alert-title>Connection needs attention</ui-alert-title>
|
|
446
|
-
<ui-alert-description>Reconnect your account.</ui-alert-description>
|
|
447
|
-
</ui-alert>
|
|
448
|
-
<ui-spinner size="sm" /> <!-- decorative -->
|
|
449
|
-
<ui-spinner label="Loading projects" /> <!-- announced status -->
|
|
450
|
-
\`\`\`
|
|
451
|
-
|
|
452
|
-
### Card
|
|
453
|
-
|
|
454
|
-
\`\`\`html
|
|
455
|
-
<ui-card>
|
|
456
|
-
<ui-card-header>
|
|
457
|
-
<ui-card-title>Title</ui-card-title>
|
|
458
|
-
<ui-card-description>Description</ui-card-description>
|
|
459
|
-
</ui-card-header>
|
|
460
|
-
<ui-card-content>Content</ui-card-content>
|
|
461
|
-
<ui-card-footer>
|
|
462
|
-
<ui-button variant="outline">Cancel</ui-button>
|
|
463
|
-
<ui-button>Save</ui-button>
|
|
464
|
-
</ui-card-footer>
|
|
465
|
-
</ui-card>
|
|
466
|
-
\`\`\`
|
|
467
|
-
|
|
468
|
-
### Dialog
|
|
469
|
-
|
|
470
|
-
\`\`\`html
|
|
471
|
-
<button [uiDialog]="dialogTpl">Open</button>
|
|
472
|
-
<ng-template #dialogTpl let-close="close">
|
|
473
|
-
<div uiDialogOverlay></div>
|
|
474
|
-
<div uiDialogContent>
|
|
475
|
-
<h2 uiDialogTitle>Confirm</h2>
|
|
476
|
-
<p uiDialogDescription>Are you sure?</p>
|
|
477
|
-
<button uiButton (click)="close()">Confirm</button>
|
|
478
|
-
</div>
|
|
479
|
-
</ng-template>
|
|
480
|
-
|
|
481
|
-
<!-- Controlled by state, no trigger -->
|
|
482
|
-
<ng-template uiDialogRoot [(open)]="editing" (closed)="onClosed($event)" let-close="close">
|
|
483
|
-
<div uiDialogOverlay></div>
|
|
484
|
-
<div uiDialogContent>…</div>
|
|
485
|
-
</ng-template>
|
|
486
|
-
\`\`\`
|
|
487
|
-
|
|
488
|
-
While a request is pending, pin the dialog and put focus on the safe action:
|
|
489
|
-
|
|
490
|
-
\`\`\`html
|
|
491
|
-
<ng-template uiDialogRoot role="alertdialog" [(open)]="deleting" [dismissible]="!pending()"
|
|
492
|
-
initialFocus="[data-cancel]" let-close="close">…</ng-template>
|
|
493
|
-
\`\`\`
|
|
494
|
-
|
|
495
|
-
\`[dismissible]\` is live (Escape and overlay click do nothing while \`false\`); \`close()\` always works.
|
|
496
|
-
\`closeOnEscape\`/\`closeOnClick\` are only read when the dialog opens.
|
|
497
|
-
|
|
498
|
-
\`\`\`ts
|
|
499
|
-
const ok = await inject(UiDialogService).open<boolean>(confirmTpl, { role: 'alertdialog' }).closed;
|
|
500
|
-
\`\`\`
|
|
501
|
-
|
|
502
|
-
### Tabs
|
|
503
|
-
|
|
504
|
-
\`\`\`html
|
|
505
|
-
<ui-tabs [(value)]="activeTab">
|
|
506
|
-
<ui-tabs-list>
|
|
507
|
-
<ui-tabs-trigger value="account">Account</ui-tabs-trigger>
|
|
508
|
-
<ui-tabs-trigger value="password">Password</ui-tabs-trigger>
|
|
509
|
-
</ui-tabs-list>
|
|
510
|
-
<ui-tabs-content value="account">Account settings.</ui-tabs-content>
|
|
511
|
-
<ui-tabs-content value="password">Password settings.</ui-tabs-content>
|
|
512
|
-
</ui-tabs>
|
|
513
|
-
\`\`\`
|
|
514
|
-
|
|
515
|
-
## AI tools integration
|
|
516
|
-
|
|
517
|
-
- **MCP server**: \`${MCP_URL}\` is a spec-compliant Streamable HTTP MCP server, already configured in this project's \`.mcp.json\` by \`npx @voltui/agent\`. It exposes tools, resources, and prompts:
|
|
518
|
-
- Tools: \`list_components\`, \`get_component\`, \`get_usage_example\`, \`get_theme_info\`, \`get_project_info\`, \`generate_cli_command\`.
|
|
519
|
-
- Resources: \`component://<name>\`, \`theme://info\`, \`project://info\`.
|
|
520
|
-
- Prompts: \`generate-volt-ui-component\`, \`volt-ui-troubleshooting\`.
|
|
521
|
-
- **CLI**: \`npx @voltui/cli list\` shows available components; \`npx @voltui/cli add <name>\` copies source.
|
|
522
|
-
- Prefer calling the MCP \`get_component\` tool over guessing inputs — this file lists the common patterns, but the MCP server always reflects the current component metadata.
|
|
523
|
-
|
|
524
|
-
## Rules for generating Volt UI code
|
|
525
|
-
|
|
526
|
-
1. Prefer standalone components with signal inputs; avoid NgModules.
|
|
527
|
-
2. Use OnPush change detection in new components that extend Volt UI.
|
|
528
|
-
3. Import copied components from \`'./ui/<component>'\` (or the local barrel), not from \`'@voltui/components'\`, unless this project explicitly uses the npm package workflow.
|
|
529
|
-
4. Use semantic Tailwind utilities (\`bg-primary\`, \`text-foreground\`, \`rounded-md\`) instead of hard-coded \`var()\` utilities.
|
|
530
|
-
5. Boolean inputs must use \`booleanAttribute\`; number inputs should use \`numberAttribute\` when appropriate.
|
|
531
|
-
6. For overlays, always use the attribute-directive trigger + \`<ng-template>\` pattern.
|
|
532
|
-
7. Do not invent inputs. If unsure, call the MCP \`get_component\` tool.
|
|
533
|
-
8. Links styled as buttons are \`<a uiButton>\`; never nest interactive elements.
|
|
534
|
-
|
|
535
|
-
## Blocks, Layouts and Recipes are copied, not imported
|
|
536
|
-
|
|
537
|
-
They live on the docs site (\`/docs/blocks\`, \`/docs/layouts\`, \`/docs/recipes/*\`), not in
|
|
538
|
-
\`@voltui/components\`. Copy the source into the app and import Volt from \`@voltui/components\`. Never
|
|
539
|
-
import an \`AppDashboard\`, \`SettingsLayout\` or \`SettingsFormRecipe\` from the package. Recipes
|
|
540
|
-
(settings form, async search, data table) show behaviour — validation, pending, failure, retry — using
|
|
541
|
-
ordinary Angular signals around the atoms.
|
|
542
|
-
|
|
543
|
-
Blocked-but-focusable actions use \`aria-disabled="true"\` (+ \`aria-describedby\` for the reason) on
|
|
544
|
-
\`uiButton\`; Volt only dims it, so guard the handler yourself. Use \`disabled\` to leave the tab order.
|
|
545
|
-
|
|
546
|
-
`;
|
|
18
|
+
// One block for every rules-file agent (Cursor, Copilot, Gemini, Windsurf): short, because the
|
|
19
|
+
// facts are in the MCP server and the playbooks are digests of the skills.
|
|
20
|
+
const RULES = routingBlock(MCP_URL);
|
|
21
|
+
const CURSOR_RULES = RULES;
|
|
22
|
+
const COPILOT_INSTRUCTIONS = RULES;
|
|
23
|
+
const WINDSURF_RULES = RULES;
|
|
24
|
+
const VOLT_UI_SKILLS = loadSkills();
|
|
547
25
|
|
|
548
26
|
const VSCODE_SNIPPETS = {
|
|
549
27
|
'Volt UI Button': {
|
|
@@ -577,9 +55,9 @@ Blocked-but-focusable actions use \`aria-disabled="true"\` (+ \`aria-describedby
|
|
|
577
55
|
description: 'Volt UI Form Field with input',
|
|
578
56
|
body: [
|
|
579
57
|
'<ui-form-field>',
|
|
580
|
-
' <ui-
|
|
58
|
+
' <ui-label>${1:Label}</ui-label>',
|
|
581
59
|
' <ui-input type="${2:text}" placeholder="${3:Enter value}" />',
|
|
582
|
-
' <ui-
|
|
60
|
+
' <ui-hint>${4:Helper text}</ui-hint>',
|
|
583
61
|
'</ui-form-field>',
|
|
584
62
|
],
|
|
585
63
|
},
|
|
@@ -781,7 +259,7 @@ Blocked-but-focusable actions use \`aria-disabled="true"\` (+ \`aria-describedby
|
|
|
781
259
|
},
|
|
782
260
|
};
|
|
783
261
|
|
|
784
|
-
return { CURSOR_RULES, COPILOT_INSTRUCTIONS,
|
|
262
|
+
return { CURSOR_RULES, COPILOT_INSTRUCTIONS, WINDSURF_RULES, VOLT_UI_SKILLS, VSCODE_SNIPPETS };
|
|
785
263
|
}
|
|
786
264
|
|
|
787
265
|
module.exports = { DEFAULT_MCP_URL, buildContent };
|