@j3m-quantum/ui 1.11.2 → 2.1.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 +72 -7
- package/cursor-rules-for-consumers.md +24 -15
- package/dist/cli/index.js +670 -0
- package/dist/cli/postinstall.js +25 -0
- package/dist/index.cjs +2443 -624
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +213 -31
- package/dist/index.d.ts +213 -31
- package/dist/index.js +2440 -626
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs2 from 'fs';
|
|
3
|
+
import * as path2 from 'path';
|
|
4
|
+
|
|
5
|
+
var CURSOR_RULES_CONTENT = `# J3M Design System Rules
|
|
6
|
+
|
|
7
|
+
## Package Usage
|
|
8
|
+
- This project uses @j3m-quantum/ui - a complete React component library with J3M styling
|
|
9
|
+
- Import components directly: \`import { Button, Card, Input } from '@j3m-quantum/ui'\`
|
|
10
|
+
- Do NOT use shadcn CLI to add components - everything is already bundled
|
|
11
|
+
- Do NOT create local component copies - use the package exports
|
|
12
|
+
|
|
13
|
+
## CRITICAL: Do NOT Create Components
|
|
14
|
+
|
|
15
|
+
When implementing UI from Figma or any design:
|
|
16
|
+
1. FIRST check if @j3m-quantum/ui has the component (see list below)
|
|
17
|
+
2. Use the package component with appropriate props
|
|
18
|
+
3. NEVER create new component files for existing components
|
|
19
|
+
|
|
20
|
+
## CSS Import Order (Critical)
|
|
21
|
+
The order in src/index.css must be:
|
|
22
|
+
\`\`\`css
|
|
23
|
+
@import "tailwindcss";
|
|
24
|
+
@import "tw-animate-css"; /* Required for animations */
|
|
25
|
+
@import "@j3m-quantum/ui/styles"; /* J3M theme and tokens */
|
|
26
|
+
\`\`\`
|
|
27
|
+
|
|
28
|
+
## Theme Modes (4 Modes)
|
|
29
|
+
| Mode | Classes | Description |
|
|
30
|
+
|------|---------|-------------|
|
|
31
|
+
| Light Solid | (default) | Opaque surfaces, gray backgrounds |
|
|
32
|
+
| Dark Solid | \`dark\` | Dark opaque surfaces |
|
|
33
|
+
| Light Glass | \`theme-glass\` | Frosted glass on image/gradient |
|
|
34
|
+
| Dark Glass | \`dark theme-glass\` | Dark frosted glass on image |
|
|
35
|
+
|
|
36
|
+
### Setting Up Theme
|
|
37
|
+
\`\`\`tsx
|
|
38
|
+
<div className="j3m-app-bg"> {/* Light solid */}
|
|
39
|
+
<div className="dark j3m-app-bg"> {/* Dark solid */}
|
|
40
|
+
<div className="theme-glass j3m-app-bg"> {/* Light glass */}
|
|
41
|
+
<div className="dark theme-glass j3m-app-bg"> {/* Dark glass */}
|
|
42
|
+
\`\`\`
|
|
43
|
+
|
|
44
|
+
## Glass Context (Important!)
|
|
45
|
+
In glass mode, cards containing interactive components need the \`glass-context\` class:
|
|
46
|
+
\`\`\`tsx
|
|
47
|
+
<Card className="glass-context">
|
|
48
|
+
<CardContent>
|
|
49
|
+
<Input placeholder="Name" />
|
|
50
|
+
<Button>Submit</Button>
|
|
51
|
+
</CardContent>
|
|
52
|
+
</Card>
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
## Figma Layer \u2192 Component Mapping
|
|
56
|
+
|
|
57
|
+
When you see these Figma layer names, use these components:
|
|
58
|
+
|
|
59
|
+
| Figma Layer Name | Import |
|
|
60
|
+
|------------------|--------|
|
|
61
|
+
| "Button", "CTA", "Primary Button", "Action" | \`import { Button } from '@j3m-quantum/ui'\` |
|
|
62
|
+
| "Card", "Container", "Panel", "Box" | \`import { Card, CardHeader, CardContent } from '@j3m-quantum/ui'\` |
|
|
63
|
+
| "Input", "Text Field", "Text Input" | \`import { Input } from '@j3m-quantum/ui'\` |
|
|
64
|
+
| "Dialog", "Modal", "Popup" | \`import { Dialog, DialogContent, DialogHeader } from '@j3m-quantum/ui'\` |
|
|
65
|
+
| "Sheet", "Side Panel", "Drawer" | \`import { Sheet, SheetContent } from '@j3m-quantum/ui'\` |
|
|
66
|
+
| "Table", "Data Table", "Grid" | \`import { Table } from '@j3m-quantum/ui'\` |
|
|
67
|
+
| "Planning Grid", "Week Table", "Supplier Matrix" | \`import { PlanningTable } from '@j3m-quantum/ui'\` |
|
|
68
|
+
| "Calibration Table", "Production Grid" | \`import { CalibrationTable } from '@j3m-quantum/ui'\` |
|
|
69
|
+
| "Loading View", "Delivery Grid" | \`import { SupplierWeeklyLoading } from '@j3m-quantum/ui'\` |
|
|
70
|
+
| "Sidebar", "Navigation" | \`import { Sidebar, SidebarProvider } from '@j3m-quantum/ui'\` |
|
|
71
|
+
| "Dropdown", "Menu" | \`import { DropdownMenu } from '@j3m-quantum/ui'\` |
|
|
72
|
+
| "Select", "Picker" | \`import { Select } from '@j3m-quantum/ui'\` |
|
|
73
|
+
| "Checkbox", "Check" | \`import { Checkbox } from '@j3m-quantum/ui'\` |
|
|
74
|
+
| "Switch", "Toggle" | \`import { Switch } from '@j3m-quantum/ui'\` |
|
|
75
|
+
| "Badge", "Tag", "Label" | \`import { Badge } from '@j3m-quantum/ui'\` |
|
|
76
|
+
| "Avatar", "Profile Image" | \`import { Avatar } from '@j3m-quantum/ui'\` |
|
|
77
|
+
| "Progress", "Progress Bar" | \`import { Progress } from '@j3m-quantum/ui'\` |
|
|
78
|
+
| "Tabs", "Tab Bar" | \`import { Tabs, TabsList, TabsTrigger, TabsContent } from '@j3m-quantum/ui'\` |
|
|
79
|
+
| "Accordion", "Expandable" | \`import { Accordion } from '@j3m-quantum/ui'\` |
|
|
80
|
+
| "Tooltip", "Hint" | \`import { Tooltip } from '@j3m-quantum/ui'\` |
|
|
81
|
+
| "Calendar", "Date Picker" | \`import { Calendar } from '@j3m-quantum/ui'\` |
|
|
82
|
+
| "Chart", "Graph" | \`import { Chart } from '@j3m-quantum/ui'\` |
|
|
83
|
+
|
|
84
|
+
## Available Components (60+)
|
|
85
|
+
|
|
86
|
+
### Inputs
|
|
87
|
+
Button, ButtonGroup, Input, InputGroup, Textarea, Checkbox, RadioGroup, Switch, Slider, Select, NativeSelect, Toggle, ToggleGroup, ThemeSwitch, Form, Field, Label
|
|
88
|
+
|
|
89
|
+
### Display
|
|
90
|
+
Card, Table, Badge, Avatar, UserAvatarsDropdown, Separator, Skeleton, Accordion, Tabs, Calendar, EventCalendar (BigCalendar), Carousel, Chart, AspectRatio, Empty, Item, Kbd
|
|
91
|
+
|
|
92
|
+
### Feedback
|
|
93
|
+
Alert, AlertDialog, Progress, CircularProgress, Tooltip, Sonner (Toast), Spinner
|
|
94
|
+
|
|
95
|
+
### Navigation
|
|
96
|
+
Breadcrumb, Pagination, Command, SearchTrigger, DropdownMenu, Menubar, NavigationMenu, ContextMenu
|
|
97
|
+
|
|
98
|
+
### Overlay
|
|
99
|
+
Dialog, Drawer, Sheet, Popover, HoverCard
|
|
100
|
+
|
|
101
|
+
### Layout
|
|
102
|
+
ScrollArea, Collapsible, Resizable, Sidebar, SidebarProvider, SidebarInset, Section
|
|
103
|
+
|
|
104
|
+
### Blocks (Pre-built compositions)
|
|
105
|
+
SiteHeader, NavMain, NavProjects, NavSecondary, NavUser, SearchForm, PlanningTable, CalibrationTable, SupplierWeeklyLoading, Gantt, Kanban
|
|
106
|
+
|
|
107
|
+
### Map
|
|
108
|
+
Map, MapTileLayer, MapMarker, MapPopup, MapTooltip, MapZoomControl
|
|
109
|
+
|
|
110
|
+
## DO
|
|
111
|
+
- Import all components from @j3m-quantum/ui
|
|
112
|
+
- Use Tailwind semantic classes: bg-primary, text-muted-foreground, bg-accent
|
|
113
|
+
- Use CSS variables for custom styling: var(--primary), var(--background)
|
|
114
|
+
- Use \`glass-context\` class on Cards with interactive components in glass mode
|
|
115
|
+
- Check the component list above before building custom components
|
|
116
|
+
- Use the j3m-app-bg class on root element for proper backgrounds
|
|
117
|
+
|
|
118
|
+
## DON'T
|
|
119
|
+
- Don't create new component files for UI elements that exist in @j3m-quantum/ui
|
|
120
|
+
- Don't use shadcn CLI - components are already bundled
|
|
121
|
+
- Don't override component CSS unless approved by design system maintainer
|
|
122
|
+
- Don't use arbitrary color values like bg-[#F58446] - use bg-primary
|
|
123
|
+
- Don't modify component border-radius - pill shapes are intentional
|
|
124
|
+
- Don't style portal components manually - they auto-adapt to theme
|
|
125
|
+
|
|
126
|
+
## Common Patterns
|
|
127
|
+
|
|
128
|
+
### Form in Card
|
|
129
|
+
\`\`\`tsx
|
|
130
|
+
import { Card, CardHeader, CardTitle, CardContent, Input, Button } from '@j3m-quantum/ui'
|
|
131
|
+
|
|
132
|
+
<Card className="glass-context">
|
|
133
|
+
<CardHeader>
|
|
134
|
+
<CardTitle>Contact Form</CardTitle>
|
|
135
|
+
</CardHeader>
|
|
136
|
+
<CardContent className="space-y-4">
|
|
137
|
+
<Input placeholder="Name" />
|
|
138
|
+
<Input placeholder="Email" />
|
|
139
|
+
<Button>Send</Button>
|
|
140
|
+
</CardContent>
|
|
141
|
+
</Card>
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
### Dashboard Layout
|
|
145
|
+
\`\`\`tsx
|
|
146
|
+
import {
|
|
147
|
+
SidebarProvider, Sidebar, SidebarContent, SidebarFooter, SidebarInset,
|
|
148
|
+
SiteHeader, SidebarTrigger, NavMain, NavUser
|
|
149
|
+
} from '@j3m-quantum/ui'
|
|
150
|
+
|
|
151
|
+
<SidebarProvider>
|
|
152
|
+
<Sidebar>
|
|
153
|
+
<SidebarContent>
|
|
154
|
+
<NavMain items={navItems} />
|
|
155
|
+
</SidebarContent>
|
|
156
|
+
<SidebarFooter>
|
|
157
|
+
<NavUser user={userData} />
|
|
158
|
+
</SidebarFooter>
|
|
159
|
+
</Sidebar>
|
|
160
|
+
<SidebarInset>
|
|
161
|
+
<SiteHeader trigger={<SidebarTrigger />} breadcrumbs={[{ label: "Dashboard" }]} />
|
|
162
|
+
<main className="p-4">{/* Content */}</main>
|
|
163
|
+
</SidebarInset>
|
|
164
|
+
</SidebarProvider>
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
167
|
+
### Dialog with Form
|
|
168
|
+
\`\`\`tsx
|
|
169
|
+
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, Input, Button } from '@j3m-quantum/ui'
|
|
170
|
+
|
|
171
|
+
<Dialog>
|
|
172
|
+
<DialogTrigger asChild>
|
|
173
|
+
<Button>Open Form</Button>
|
|
174
|
+
</DialogTrigger>
|
|
175
|
+
<DialogContent>
|
|
176
|
+
<DialogHeader>
|
|
177
|
+
<DialogTitle>Edit Profile</DialogTitle>
|
|
178
|
+
</DialogHeader>
|
|
179
|
+
{/* No glass-context needed - Dialog is a portal */}
|
|
180
|
+
<Input placeholder="Name" />
|
|
181
|
+
<Button>Save</Button>
|
|
182
|
+
</DialogContent>
|
|
183
|
+
</Dialog>
|
|
184
|
+
\`\`\`
|
|
185
|
+
|
|
186
|
+
## CLI Commands
|
|
187
|
+
|
|
188
|
+
Run these in your project:
|
|
189
|
+
|
|
190
|
+
\`\`\`bash
|
|
191
|
+
npx @j3m-quantum/ui init # Set up these rules (already done!)
|
|
192
|
+
npx @j3m-quantum/ui list # List all available components
|
|
193
|
+
npx @j3m-quantum/ui doctor # Check if setup is correct
|
|
194
|
+
\`\`\`
|
|
195
|
+
`;
|
|
196
|
+
async function init() {
|
|
197
|
+
const cwd = process.cwd();
|
|
198
|
+
const cursorDir = path2.join(cwd, ".cursor");
|
|
199
|
+
const rulesDir = path2.join(cursorDir, "rules");
|
|
200
|
+
const rulesFile = path2.join(rulesDir, "j3m-quantum.md");
|
|
201
|
+
const cursorRulesFile = path2.join(cwd, ".cursorrules");
|
|
202
|
+
console.log("");
|
|
203
|
+
console.log("\u{1F3A8} Setting up @j3m-quantum/ui...");
|
|
204
|
+
console.log("");
|
|
205
|
+
try {
|
|
206
|
+
if (!fs2.existsSync(rulesDir)) {
|
|
207
|
+
fs2.mkdirSync(rulesDir, { recursive: true });
|
|
208
|
+
console.log(" \u2713 Created .cursor/rules/ directory");
|
|
209
|
+
}
|
|
210
|
+
fs2.writeFileSync(rulesFile, CURSOR_RULES_CONTENT, "utf-8");
|
|
211
|
+
console.log(" \u2713 Created .cursor/rules/j3m-quantum.md");
|
|
212
|
+
if (fs2.existsSync(cursorRulesFile)) {
|
|
213
|
+
const existingContent = fs2.readFileSync(cursorRulesFile, "utf-8");
|
|
214
|
+
if (!existingContent.includes("@j3m-quantum/ui")) {
|
|
215
|
+
console.log(" \u2139 Found existing .cursorrules file");
|
|
216
|
+
console.log(" Consider adding: 'See .cursor/rules/j3m-quantum.md for J3M Design System rules'");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
console.log("");
|
|
220
|
+
console.log("\u2705 Setup complete!");
|
|
221
|
+
console.log("");
|
|
222
|
+
console.log("AI assistants will now:");
|
|
223
|
+
console.log(" \u2022 Use components from @j3m-quantum/ui");
|
|
224
|
+
console.log(" \u2022 Know about all 60+ available components");
|
|
225
|
+
console.log(" \u2022 Map Figma layers to correct components");
|
|
226
|
+
console.log(" \u2022 Follow J3M styling guidelines");
|
|
227
|
+
console.log("");
|
|
228
|
+
console.log("Next steps:");
|
|
229
|
+
console.log(" 1. Ensure your CSS imports are correct:");
|
|
230
|
+
console.log(' @import "tailwindcss";');
|
|
231
|
+
console.log(' @import "tw-animate-css";');
|
|
232
|
+
console.log(' @import "@j3m-quantum/ui/styles";');
|
|
233
|
+
console.log("");
|
|
234
|
+
console.log(" 2. Run 'npx @j3m-quantum/ui doctor' to verify setup");
|
|
235
|
+
console.log("");
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.error("\u274C Failed to set up cursor rules:", error.message);
|
|
238
|
+
process.exit(1);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// src/cli/commands/list.ts
|
|
243
|
+
var REGISTRY = {
|
|
244
|
+
inputs: {
|
|
245
|
+
label: "Inputs",
|
|
246
|
+
components: [
|
|
247
|
+
{ name: "Button", description: "Primary action button with variants", import: "Button", figmaNames: ["Button", "CTA", "Primary Button"] },
|
|
248
|
+
{ name: "ButtonGroup", description: "Group of related buttons", import: "ButtonGroup" },
|
|
249
|
+
{ name: "Input", description: "Text input field", import: "Input", figmaNames: ["Input", "Text Field"] },
|
|
250
|
+
{ name: "InputGroup", description: "Input with addons", import: "InputGroup" },
|
|
251
|
+
{ name: "Textarea", description: "Multi-line text input", import: "Textarea" },
|
|
252
|
+
{ name: "Checkbox", description: "Checkbox input", import: "Checkbox", figmaNames: ["Checkbox", "Check"] },
|
|
253
|
+
{ name: "RadioGroup", description: "Radio button group", import: "RadioGroup, RadioGroupItem" },
|
|
254
|
+
{ name: "Switch", description: "Toggle switch", import: "Switch", figmaNames: ["Switch", "Toggle"] },
|
|
255
|
+
{ name: "Slider", description: "Range slider", import: "Slider" },
|
|
256
|
+
{ name: "Select", description: "Dropdown select", import: "Select, SelectTrigger, SelectContent, SelectItem, SelectValue", figmaNames: ["Select", "Dropdown", "Picker"] },
|
|
257
|
+
{ name: "NativeSelect", description: "Native HTML select", import: "NativeSelect" },
|
|
258
|
+
{ name: "Toggle", description: "Toggle button", import: "Toggle" },
|
|
259
|
+
{ name: "ToggleGroup", description: "Group of toggle buttons", import: "ToggleGroup, ToggleGroupItem" },
|
|
260
|
+
{ name: "ThemeSwitch", description: "Light/dark mode toggle", import: "ThemeSwitch" },
|
|
261
|
+
{ name: "Form", description: "Form with validation", import: "Form, FormField, FormItem, FormLabel, FormControl, FormMessage" },
|
|
262
|
+
{ name: "Field", description: "Form field wrapper", import: "Field" },
|
|
263
|
+
{ name: "Label", description: "Form label", import: "Label" }
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
display: {
|
|
267
|
+
label: "Display",
|
|
268
|
+
components: [
|
|
269
|
+
{ name: "Card", description: "Content container", import: "Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter", figmaNames: ["Card", "Container", "Panel"] },
|
|
270
|
+
{ name: "Table", description: "Data table", import: "Table, TableHeader, TableBody, TableRow, TableHead, TableCell", figmaNames: ["Table", "Data Grid"] },
|
|
271
|
+
{ name: "Badge", description: "Status badge/tag", import: "Badge", figmaNames: ["Badge", "Tag", "Label"] },
|
|
272
|
+
{ name: "Avatar", description: "User avatar", import: "Avatar, AvatarImage, AvatarFallback", figmaNames: ["Avatar", "Profile Image"] },
|
|
273
|
+
{ name: "UserAvatarsDropdown", description: "Avatar with dropdown", import: "UserAvatarsDropdown" },
|
|
274
|
+
{ name: "Separator", description: "Visual divider", import: "Separator" },
|
|
275
|
+
{ name: "Skeleton", description: "Loading placeholder", import: "Skeleton" },
|
|
276
|
+
{ name: "Accordion", description: "Collapsible sections", import: "Accordion, AccordionItem, AccordionTrigger, AccordionContent", figmaNames: ["Accordion", "Expandable"] },
|
|
277
|
+
{ name: "Tabs", description: "Tabbed content", import: "Tabs, TabsList, TabsTrigger, TabsContent", figmaNames: ["Tabs", "Tab Bar"] },
|
|
278
|
+
{ name: "Calendar", description: "Date picker calendar", import: "Calendar", figmaNames: ["Calendar", "Date Picker"] },
|
|
279
|
+
{ name: "EventCalendar", description: "Big calendar for events", import: "BigCalendar, type IEvent, type IUser" },
|
|
280
|
+
{ name: "Carousel", description: "Image/content carousel", import: "Carousel, CarouselContent, CarouselItem" },
|
|
281
|
+
{ name: "Chart", description: "Data visualization", import: "ChartContainer, ChartTooltip, ChartLegend", figmaNames: ["Chart", "Graph"] },
|
|
282
|
+
{ name: "AspectRatio", description: "Maintain aspect ratio", import: "AspectRatio" },
|
|
283
|
+
{ name: "Empty", description: "Empty state placeholder", import: "Empty" },
|
|
284
|
+
{ name: "Item", description: "List item", import: "Item" },
|
|
285
|
+
{ name: "Kbd", description: "Keyboard shortcut display", import: "Kbd" }
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
feedback: {
|
|
289
|
+
label: "Feedback",
|
|
290
|
+
components: [
|
|
291
|
+
{ name: "Alert", description: "Alert message", import: "Alert, AlertTitle, AlertDescription" },
|
|
292
|
+
{ name: "AlertDialog", description: "Confirmation dialog", import: "AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel" },
|
|
293
|
+
{ name: "Progress", description: "Progress bar", import: "Progress", figmaNames: ["Progress", "Progress Bar"] },
|
|
294
|
+
{ name: "CircularProgress", description: "Circular progress indicator", import: "CircularProgress" },
|
|
295
|
+
{ name: "Tooltip", description: "Hover tooltip", import: "Tooltip, TooltipTrigger, TooltipContent, TooltipProvider", figmaNames: ["Tooltip", "Hint"] },
|
|
296
|
+
{ name: "Sonner", description: "Toast notifications", import: "Toaster, toast" },
|
|
297
|
+
{ name: "Spinner", description: "Loading spinner", import: "Spinner" }
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
navigation: {
|
|
301
|
+
label: "Navigation",
|
|
302
|
+
components: [
|
|
303
|
+
{ name: "Breadcrumb", description: "Breadcrumb navigation", import: "Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator" },
|
|
304
|
+
{ name: "Pagination", description: "Page navigation", import: "Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious" },
|
|
305
|
+
{ name: "Command", description: "Command palette", import: "Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandDialog" },
|
|
306
|
+
{ name: "SearchTrigger", description: "Search button trigger", import: "SearchTrigger, useSearchShortcut" },
|
|
307
|
+
{ name: "DropdownMenu", description: "Dropdown menu", import: "DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator", figmaNames: ["Dropdown", "Menu"] },
|
|
308
|
+
{ name: "Menubar", description: "Horizontal menu bar", import: "Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem" },
|
|
309
|
+
{ name: "NavigationMenu", description: "Navigation menu", import: "NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink" },
|
|
310
|
+
{ name: "ContextMenu", description: "Right-click menu", import: "ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem" }
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
overlay: {
|
|
314
|
+
label: "Overlay",
|
|
315
|
+
components: [
|
|
316
|
+
{ name: "Dialog", description: "Modal dialog", import: "Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter", figmaNames: ["Dialog", "Modal", "Popup"] },
|
|
317
|
+
{ name: "Drawer", description: "Bottom drawer", import: "Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerFooter" },
|
|
318
|
+
{ name: "Sheet", description: "Side panel", import: "Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription", figmaNames: ["Sheet", "Side Panel", "Drawer"] },
|
|
319
|
+
{ name: "Popover", description: "Popover panel", import: "Popover, PopoverTrigger, PopoverContent" },
|
|
320
|
+
{ name: "HoverCard", description: "Hover preview card", import: "HoverCard, HoverCardTrigger, HoverCardContent" }
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
layout: {
|
|
324
|
+
label: "Layout",
|
|
325
|
+
components: [
|
|
326
|
+
{ name: "ScrollArea", description: "Custom scrollable area", import: "ScrollArea, ScrollBar" },
|
|
327
|
+
{ name: "Collapsible", description: "Collapsible section", import: "Collapsible, CollapsibleTrigger, CollapsibleContent" },
|
|
328
|
+
{ name: "Resizable", description: "Resizable panels", import: "ResizablePanelGroup, ResizablePanel, ResizableHandle" },
|
|
329
|
+
{ name: "Sidebar", description: "Application sidebar", import: "Sidebar, SidebarProvider, SidebarContent, SidebarHeader, SidebarFooter, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarTrigger, SidebarInset", figmaNames: ["Sidebar", "Navigation"] },
|
|
330
|
+
{ name: "Section", description: "Page section", import: "Section" }
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
blocks: {
|
|
334
|
+
label: "Blocks (Pre-built Compositions)",
|
|
335
|
+
components: [
|
|
336
|
+
{ name: "SiteHeader", description: "Sticky header with breadcrumbs", import: "SiteHeader" },
|
|
337
|
+
{ name: "NavMain", description: "Main navigation with collapsible items", import: "NavMain" },
|
|
338
|
+
{ name: "NavProjects", description: "Projects navigation section", import: "NavProjects" },
|
|
339
|
+
{ name: "NavSecondary", description: "Secondary navigation links", import: "NavSecondary" },
|
|
340
|
+
{ name: "NavUser", description: "User profile with dropdown", import: "NavUser" },
|
|
341
|
+
{ name: "SearchForm", description: "Search input form", import: "SearchForm" },
|
|
342
|
+
{ name: "PlanningTable", description: "Weekly supplier planning matrix", import: "PlanningTable, type Supplier, type PlanningTableConfig", figmaNames: ["Planning Grid", "Week Table", "Supplier Matrix"] },
|
|
343
|
+
{ name: "CalibrationTable", description: "Production calibration table", import: "CalibrationTable, type CalibrationPrefix", figmaNames: ["Calibration Table", "Production Grid"] },
|
|
344
|
+
{ name: "SupplierWeeklyLoading", description: "Weekly loading view", import: "SupplierWeeklyLoading, type LoadingDelivery", figmaNames: ["Loading View", "Delivery Grid"] },
|
|
345
|
+
{ name: "Gantt", description: "Gantt chart component", import: "Gantt" },
|
|
346
|
+
{ name: "Kanban", description: "Kanban board component", import: "Kanban" }
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
map: {
|
|
350
|
+
label: "Map (requires leaflet)",
|
|
351
|
+
components: [
|
|
352
|
+
{ name: "Map", description: "Map container", import: "Map" },
|
|
353
|
+
{ name: "MapTileLayer", description: "Map tile layer", import: "MapTileLayer" },
|
|
354
|
+
{ name: "MapMarker", description: "Map marker", import: "MapMarker" },
|
|
355
|
+
{ name: "MapPopup", description: "Marker popup", import: "MapPopup" },
|
|
356
|
+
{ name: "MapTooltip", description: "Marker tooltip", import: "MapTooltip" },
|
|
357
|
+
{ name: "MapZoomControl", description: "Zoom controls", import: "MapZoomControl" }
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
function list(category) {
|
|
362
|
+
console.log("");
|
|
363
|
+
console.log("\u{1F4E6} @j3m-quantum/ui Components");
|
|
364
|
+
console.log("\u2550".repeat(50));
|
|
365
|
+
const categories = category ? { [category]: REGISTRY[category] } : REGISTRY;
|
|
366
|
+
if (category && !REGISTRY[category]) {
|
|
367
|
+
console.log("");
|
|
368
|
+
console.log(`\u274C Unknown category: ${category}`);
|
|
369
|
+
console.log("");
|
|
370
|
+
console.log("Available categories:");
|
|
371
|
+
Object.keys(REGISTRY).forEach((cat) => {
|
|
372
|
+
console.log(` \u2022 ${cat}`);
|
|
373
|
+
});
|
|
374
|
+
console.log("");
|
|
375
|
+
console.log("Usage: npx @j3m-quantum/ui list --category <category>");
|
|
376
|
+
console.log("");
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
let totalCount = 0;
|
|
380
|
+
for (const [key, cat] of Object.entries(categories)) {
|
|
381
|
+
if (!cat) continue;
|
|
382
|
+
console.log("");
|
|
383
|
+
console.log(`\u25B8 ${cat.label}`);
|
|
384
|
+
console.log("\u2500".repeat(40));
|
|
385
|
+
for (const component of cat.components) {
|
|
386
|
+
totalCount++;
|
|
387
|
+
const figmaInfo = component.figmaNames ? ` (Figma: ${component.figmaNames.join(", ")})` : "";
|
|
388
|
+
console.log(` ${component.name}`);
|
|
389
|
+
console.log(` ${component.description}${figmaInfo}`);
|
|
390
|
+
console.log(` import { ${component.import} } from '@j3m-quantum/ui'`);
|
|
391
|
+
console.log("");
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
console.log("\u2550".repeat(50));
|
|
395
|
+
console.log(`Total: ${totalCount} components`);
|
|
396
|
+
console.log("");
|
|
397
|
+
console.log("Usage:");
|
|
398
|
+
console.log(" import { ComponentName } from '@j3m-quantum/ui'");
|
|
399
|
+
console.log("");
|
|
400
|
+
console.log("Filter by category:");
|
|
401
|
+
console.log(" npx @j3m-quantum/ui list --category blocks");
|
|
402
|
+
console.log("");
|
|
403
|
+
}
|
|
404
|
+
async function doctor() {
|
|
405
|
+
const cwd = process.cwd();
|
|
406
|
+
const results = [];
|
|
407
|
+
console.log("");
|
|
408
|
+
console.log("\u{1FA7A} @j3m-quantum/ui Doctor");
|
|
409
|
+
console.log("\u2550".repeat(50));
|
|
410
|
+
console.log("");
|
|
411
|
+
console.log("Checking your project setup...");
|
|
412
|
+
console.log("");
|
|
413
|
+
const packageJsonPath = path2.join(cwd, "package.json");
|
|
414
|
+
if (fs2.existsSync(packageJsonPath)) {
|
|
415
|
+
const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
|
|
416
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
417
|
+
if (deps["@j3m-quantum/ui"]) {
|
|
418
|
+
const version = deps["@j3m-quantum/ui"];
|
|
419
|
+
results.push({
|
|
420
|
+
name: "@j3m-quantum/ui installed",
|
|
421
|
+
status: "pass",
|
|
422
|
+
message: `Version: ${version}`
|
|
423
|
+
});
|
|
424
|
+
} else {
|
|
425
|
+
results.push({
|
|
426
|
+
name: "@j3m-quantum/ui installed",
|
|
427
|
+
status: "fail",
|
|
428
|
+
message: "Package not found in dependencies",
|
|
429
|
+
fix: "npm install @j3m-quantum/ui"
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (deps["tw-animate-css"]) {
|
|
433
|
+
results.push({
|
|
434
|
+
name: "tw-animate-css installed",
|
|
435
|
+
status: "pass",
|
|
436
|
+
message: `Version: ${deps["tw-animate-css"]}`
|
|
437
|
+
});
|
|
438
|
+
} else {
|
|
439
|
+
results.push({
|
|
440
|
+
name: "tw-animate-css installed",
|
|
441
|
+
status: "warn",
|
|
442
|
+
message: "Not found - animations may not work",
|
|
443
|
+
fix: "npm install tw-animate-css"
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
if (deps["tailwindcss"]) {
|
|
447
|
+
const version = deps["tailwindcss"];
|
|
448
|
+
const majorVersion = parseInt(version.replace(/[^0-9]/g, "").charAt(0));
|
|
449
|
+
if (majorVersion >= 4) {
|
|
450
|
+
results.push({
|
|
451
|
+
name: "Tailwind CSS v4+",
|
|
452
|
+
status: "pass",
|
|
453
|
+
message: `Version: ${version}`
|
|
454
|
+
});
|
|
455
|
+
} else {
|
|
456
|
+
results.push({
|
|
457
|
+
name: "Tailwind CSS v4+",
|
|
458
|
+
status: "fail",
|
|
459
|
+
message: `Version ${version} - requires v4+`,
|
|
460
|
+
fix: "npm install tailwindcss@latest"
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
results.push({
|
|
465
|
+
name: "Tailwind CSS v4+",
|
|
466
|
+
status: "fail",
|
|
467
|
+
message: "Not found",
|
|
468
|
+
fix: "npm install -D tailwindcss @tailwindcss/vite"
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
} else {
|
|
472
|
+
results.push({
|
|
473
|
+
name: "package.json",
|
|
474
|
+
status: "fail",
|
|
475
|
+
message: "Not found - run from project root"
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
const cursorRulesPath = path2.join(cwd, ".cursor", "rules", "j3m-quantum.md");
|
|
479
|
+
const altCursorRulesPath = path2.join(cwd, ".cursorrules");
|
|
480
|
+
if (fs2.existsSync(cursorRulesPath)) {
|
|
481
|
+
results.push({
|
|
482
|
+
name: "Cursor rules configured",
|
|
483
|
+
status: "pass",
|
|
484
|
+
message: ".cursor/rules/j3m-quantum.md found"
|
|
485
|
+
});
|
|
486
|
+
} else if (fs2.existsSync(altCursorRulesPath)) {
|
|
487
|
+
const content = fs2.readFileSync(altCursorRulesPath, "utf-8");
|
|
488
|
+
if (content.includes("@j3m-quantum/ui")) {
|
|
489
|
+
results.push({
|
|
490
|
+
name: "Cursor rules configured",
|
|
491
|
+
status: "pass",
|
|
492
|
+
message: ".cursorrules contains J3M references"
|
|
493
|
+
});
|
|
494
|
+
} else {
|
|
495
|
+
results.push({
|
|
496
|
+
name: "Cursor rules configured",
|
|
497
|
+
status: "warn",
|
|
498
|
+
message: ".cursorrules exists but missing J3M rules",
|
|
499
|
+
fix: "npx @j3m-quantum/ui init"
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
results.push({
|
|
504
|
+
name: "Cursor rules configured",
|
|
505
|
+
status: "warn",
|
|
506
|
+
message: "No cursor rules found - AI may not use components correctly",
|
|
507
|
+
fix: "npx @j3m-quantum/ui init"
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
const possibleCssPaths = [
|
|
511
|
+
path2.join(cwd, "src", "index.css"),
|
|
512
|
+
path2.join(cwd, "src", "styles", "globals.css"),
|
|
513
|
+
path2.join(cwd, "src", "app", "globals.css"),
|
|
514
|
+
path2.join(cwd, "app", "globals.css"),
|
|
515
|
+
path2.join(cwd, "styles", "globals.css")
|
|
516
|
+
];
|
|
517
|
+
let cssFound = false;
|
|
518
|
+
let cssContent = "";
|
|
519
|
+
let foundCssPath = "";
|
|
520
|
+
for (const cssPath of possibleCssPaths) {
|
|
521
|
+
if (fs2.existsSync(cssPath)) {
|
|
522
|
+
cssFound = true;
|
|
523
|
+
cssContent = fs2.readFileSync(cssPath, "utf-8");
|
|
524
|
+
foundCssPath = cssPath.replace(cwd, "");
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (cssFound) {
|
|
529
|
+
const hasJ3mStyles = cssContent.includes("@j3m-quantum/ui/styles");
|
|
530
|
+
const hasTailwind = cssContent.includes("tailwindcss");
|
|
531
|
+
cssContent.includes("tw-animate-css");
|
|
532
|
+
if (hasJ3mStyles && hasTailwind) {
|
|
533
|
+
const tailwindIndex = cssContent.indexOf("tailwindcss");
|
|
534
|
+
const twAnimateIndex = cssContent.indexOf("tw-animate-css");
|
|
535
|
+
const j3mIndex = cssContent.indexOf("@j3m-quantum/ui/styles");
|
|
536
|
+
const orderCorrect = tailwindIndex < j3mIndex && (twAnimateIndex === -1 || twAnimateIndex > tailwindIndex && twAnimateIndex < j3mIndex);
|
|
537
|
+
if (orderCorrect) {
|
|
538
|
+
results.push({
|
|
539
|
+
name: "CSS imports configured",
|
|
540
|
+
status: "pass",
|
|
541
|
+
message: `${foundCssPath} - imports in correct order`
|
|
542
|
+
});
|
|
543
|
+
} else {
|
|
544
|
+
results.push({
|
|
545
|
+
name: "CSS imports configured",
|
|
546
|
+
status: "warn",
|
|
547
|
+
message: `${foundCssPath} - import order may be incorrect`,
|
|
548
|
+
fix: "Order should be: tailwindcss \u2192 tw-animate-css \u2192 @j3m-quantum/ui/styles"
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
} else if (!hasJ3mStyles) {
|
|
552
|
+
results.push({
|
|
553
|
+
name: "CSS imports configured",
|
|
554
|
+
status: "fail",
|
|
555
|
+
message: `${foundCssPath} - missing @j3m-quantum/ui/styles`,
|
|
556
|
+
fix: 'Add: @import "@j3m-quantum/ui/styles";'
|
|
557
|
+
});
|
|
558
|
+
} else if (!hasTailwind) {
|
|
559
|
+
results.push({
|
|
560
|
+
name: "CSS imports configured",
|
|
561
|
+
status: "fail",
|
|
562
|
+
message: `${foundCssPath} - missing tailwindcss import`,
|
|
563
|
+
fix: 'Add: @import "tailwindcss";'
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
} else {
|
|
567
|
+
results.push({
|
|
568
|
+
name: "CSS imports configured",
|
|
569
|
+
status: "warn",
|
|
570
|
+
message: "Could not find CSS entry file",
|
|
571
|
+
fix: "Create src/index.css with required imports"
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
const viteConfigPath = path2.join(cwd, "vite.config.ts");
|
|
575
|
+
const viteConfigJsPath = path2.join(cwd, "vite.config.js");
|
|
576
|
+
if (fs2.existsSync(viteConfigPath) || fs2.existsSync(viteConfigJsPath)) {
|
|
577
|
+
const configPath = fs2.existsSync(viteConfigPath) ? viteConfigPath : viteConfigJsPath;
|
|
578
|
+
const configContent = fs2.readFileSync(configPath, "utf-8");
|
|
579
|
+
if (configContent.includes("@tailwindcss/vite")) {
|
|
580
|
+
results.push({
|
|
581
|
+
name: "Vite + Tailwind plugin",
|
|
582
|
+
status: "pass",
|
|
583
|
+
message: "@tailwindcss/vite configured"
|
|
584
|
+
});
|
|
585
|
+
} else {
|
|
586
|
+
results.push({
|
|
587
|
+
name: "Vite + Tailwind plugin",
|
|
588
|
+
status: "warn",
|
|
589
|
+
message: "Consider using @tailwindcss/vite for better performance"
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
console.log("Results:");
|
|
594
|
+
console.log("\u2500".repeat(50));
|
|
595
|
+
for (const result of results) {
|
|
596
|
+
const icon = result.status === "pass" ? "\u2713" : result.status === "warn" ? "\u26A0" : "\u2717";
|
|
597
|
+
result.status === "pass" ? "" : result.status === "warn" ? "" : "";
|
|
598
|
+
console.log(` ${icon} ${result.name}`);
|
|
599
|
+
console.log(` ${result.message}`);
|
|
600
|
+
if (result.fix) {
|
|
601
|
+
console.log(` Fix: ${result.fix}`);
|
|
602
|
+
}
|
|
603
|
+
console.log("");
|
|
604
|
+
}
|
|
605
|
+
console.log("\u2500".repeat(50));
|
|
606
|
+
const passCount = results.filter((r) => r.status === "pass").length;
|
|
607
|
+
const warnCount = results.filter((r) => r.status === "warn").length;
|
|
608
|
+
const failCount = results.filter((r) => r.status === "fail").length;
|
|
609
|
+
console.log(`Summary: ${passCount} passed, ${warnCount} warnings, ${failCount} failed`);
|
|
610
|
+
console.log("");
|
|
611
|
+
if (failCount > 0) {
|
|
612
|
+
console.log("\u274C Some checks failed. Please fix the issues above.");
|
|
613
|
+
} else if (warnCount > 0) {
|
|
614
|
+
console.log("\u26A0\uFE0F Setup looks good with some warnings.");
|
|
615
|
+
} else {
|
|
616
|
+
console.log("\u2705 All checks passed! Your setup is ready.");
|
|
617
|
+
}
|
|
618
|
+
console.log("");
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// src/cli/index.ts
|
|
622
|
+
var args = process.argv.slice(2);
|
|
623
|
+
var command = args[0];
|
|
624
|
+
var HELP = `
|
|
625
|
+
@j3m-quantum/ui CLI
|
|
626
|
+
|
|
627
|
+
Usage:
|
|
628
|
+
npx @j3m-quantum/ui <command>
|
|
629
|
+
|
|
630
|
+
Commands:
|
|
631
|
+
init Set up cursor rules for AI assistance
|
|
632
|
+
list List all available components
|
|
633
|
+
doctor Check if your setup is correct
|
|
634
|
+
help Show this help message
|
|
635
|
+
|
|
636
|
+
Examples:
|
|
637
|
+
npx @j3m-quantum/ui init
|
|
638
|
+
npx @j3m-quantum/ui list
|
|
639
|
+
npx @j3m-quantum/ui list --category blocks
|
|
640
|
+
npx @j3m-quantum/ui doctor
|
|
641
|
+
`;
|
|
642
|
+
async function main() {
|
|
643
|
+
switch (command) {
|
|
644
|
+
case "init":
|
|
645
|
+
await init();
|
|
646
|
+
break;
|
|
647
|
+
case "list":
|
|
648
|
+
const categoryFlag = args.indexOf("--category");
|
|
649
|
+
const category = categoryFlag !== -1 ? args[categoryFlag + 1] : void 0;
|
|
650
|
+
list(category);
|
|
651
|
+
break;
|
|
652
|
+
case "doctor":
|
|
653
|
+
await doctor();
|
|
654
|
+
break;
|
|
655
|
+
case "help":
|
|
656
|
+
case "--help":
|
|
657
|
+
case "-h":
|
|
658
|
+
case void 0:
|
|
659
|
+
console.log(HELP);
|
|
660
|
+
break;
|
|
661
|
+
default:
|
|
662
|
+
console.error(`Unknown command: ${command}`);
|
|
663
|
+
console.log(HELP);
|
|
664
|
+
process.exit(1);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
main().catch((error) => {
|
|
668
|
+
console.error("Error:", error.message);
|
|
669
|
+
process.exit(1);
|
|
670
|
+
});
|