@j3m-quantum/ui 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/cursor-rules-for-consumers.md +184 -107
- package/dist/cli/index.js +284 -112
- package/dist/cli/postinstall.js +38 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as fs2 from 'fs';
|
|
3
|
-
import * as
|
|
3
|
+
import * as path from 'path';
|
|
4
4
|
|
|
5
5
|
var CURSOR_RULES_CONTENT = `# J3M Design System Rules
|
|
6
6
|
|
|
@@ -10,21 +10,128 @@ var CURSOR_RULES_CONTENT = `# J3M Design System Rules
|
|
|
10
10
|
- Do NOT use shadcn CLI to add components - everything is already bundled
|
|
11
11
|
- Do NOT create local component copies - use the package exports
|
|
12
12
|
|
|
13
|
-
## CRITICAL:
|
|
13
|
+
## CRITICAL: Pre-built Blocks - USE THESE FIRST!
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
Before implementing ANY sidebar, navigation, header, or dashboard layout, ALWAYS import these pre-built blocks:
|
|
16
|
+
|
|
17
|
+
\`\`\`tsx
|
|
18
|
+
// Pre-built blocks - USE THESE, don't build from scratch!
|
|
19
|
+
import {
|
|
20
|
+
SiteHeader, // Header with breadcrumbs + search + sidebar trigger
|
|
21
|
+
NavMain, // Main navigation with icons + collapsible sub-items
|
|
22
|
+
NavSecondary, // Secondary nav (Support, Feedback links)
|
|
23
|
+
NavUser, // User profile with dropdown menu
|
|
24
|
+
NavProjects, // Project list navigation
|
|
25
|
+
SearchForm, // Search input for sidebar
|
|
26
|
+
} from '@j3m-quantum/ui'
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
## \u26D4 NEVER Create These Manually
|
|
30
|
+
|
|
31
|
+
| Instead of building... | Use this block |
|
|
32
|
+
|------------------------|----------------|
|
|
33
|
+
| \u274C Custom sidebar navigation | \u2705 \`NavMain\` |
|
|
34
|
+
| \u274C Custom user menu/profile | \u2705 \`NavUser\` |
|
|
35
|
+
| \u274C Custom page header | \u2705 \`SiteHeader\` |
|
|
36
|
+
| \u274C Custom project list | \u2705 \`NavProjects\` |
|
|
37
|
+
| \u274C Custom secondary links | \u2705 \`NavSecondary\` |
|
|
38
|
+
| \u274C Custom search in sidebar | \u2705 \`SearchForm\` |
|
|
39
|
+
| \u274C Custom CSS tokens | \u2705 Package provides all tokens |
|
|
40
|
+
|
|
41
|
+
## Block Props Reference
|
|
42
|
+
|
|
43
|
+
### NavMain
|
|
44
|
+
\`\`\`tsx
|
|
45
|
+
import { NavMain, type NavItem } from '@j3m-quantum/ui'
|
|
46
|
+
import { Home, Settings, Users } from 'lucide-react'
|
|
47
|
+
|
|
48
|
+
const navItems: NavItem[] = [
|
|
49
|
+
{ title: "Home", url: "/", icon: Home, isActive: true },
|
|
50
|
+
{ title: "Settings", url: "/settings", icon: Settings, items: [
|
|
51
|
+
{ title: "General", url: "/settings/general" },
|
|
52
|
+
{ title: "Team", url: "/settings/team" },
|
|
53
|
+
]},
|
|
54
|
+
{ title: "Users", url: "/users", icon: Users },
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
<NavMain items={navItems} label="Navigation" />
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
### NavUser
|
|
61
|
+
\`\`\`tsx
|
|
62
|
+
import { NavUser } from '@j3m-quantum/ui'
|
|
63
|
+
|
|
64
|
+
<NavUser
|
|
65
|
+
user={{
|
|
66
|
+
name: "John Doe",
|
|
67
|
+
email: "john@example.com",
|
|
68
|
+
avatar: "/avatar.jpg" // or "" for initials fallback
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
### SiteHeader
|
|
74
|
+
\`\`\`tsx
|
|
75
|
+
import { SiteHeader, SidebarTrigger } from '@j3m-quantum/ui'
|
|
76
|
+
|
|
77
|
+
<SiteHeader
|
|
78
|
+
trigger={<SidebarTrigger />}
|
|
79
|
+
breadcrumbs={[
|
|
80
|
+
{ label: "Dashboard", href: "/" },
|
|
81
|
+
{ label: "Settings" } // No href = current page
|
|
82
|
+
]}
|
|
83
|
+
showSearch={true}
|
|
84
|
+
/>
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
### NavSecondary
|
|
88
|
+
\`\`\`tsx
|
|
89
|
+
import { NavSecondary } from '@j3m-quantum/ui'
|
|
90
|
+
import { LifeBuoy, Send } from 'lucide-react'
|
|
91
|
+
|
|
92
|
+
<NavSecondary items={[
|
|
93
|
+
{ title: "Support", url: "/support", icon: LifeBuoy },
|
|
94
|
+
{ title: "Feedback", url: "/feedback", icon: Send },
|
|
95
|
+
]} />
|
|
96
|
+
\`\`\`
|
|
97
|
+
|
|
98
|
+
## Sidebar Features Checklist
|
|
99
|
+
|
|
100
|
+
When using Sidebar, remember these features:
|
|
101
|
+
|
|
102
|
+
| Feature | Usage |
|
|
103
|
+
|---------|-------|
|
|
104
|
+
| \`collapsible="icon"\` | Collapses sidebar to icons only |
|
|
105
|
+
| \`collapsible="offcanvas"\` | Slides sidebar off screen |
|
|
106
|
+
| \`<SidebarRail />\` | Edge rail for drag-to-toggle |
|
|
107
|
+
| \`tooltip\` prop on SidebarMenuButton | Shows tooltips when collapsed |
|
|
108
|
+
| \`<SidebarMenuBadge>\` | Notification counts on menu items |
|
|
109
|
+
| \`<SidebarGroup>\` + \`<SidebarGroupLabel>\` | Organize sections |
|
|
110
|
+
|
|
111
|
+
\`\`\`tsx
|
|
112
|
+
<Sidebar collapsible="icon">
|
|
113
|
+
<SidebarContent>
|
|
114
|
+
<SidebarGroup>
|
|
115
|
+
<SidebarGroupLabel>Platform</SidebarGroupLabel>
|
|
116
|
+
<NavMain items={navItems} />
|
|
117
|
+
</SidebarGroup>
|
|
118
|
+
</SidebarContent>
|
|
119
|
+
<SidebarRail />
|
|
120
|
+
</Sidebar>
|
|
121
|
+
\`\`\`
|
|
19
122
|
|
|
20
123
|
## CSS Import Order (Critical)
|
|
21
|
-
The order in src/index.css must be:
|
|
22
124
|
\`\`\`css
|
|
23
125
|
@import "tailwindcss";
|
|
24
126
|
@import "tw-animate-css"; /* Required for animations */
|
|
25
127
|
@import "@j3m-quantum/ui/styles"; /* J3M theme and tokens */
|
|
128
|
+
|
|
129
|
+
/* REQUIRED: Tell Tailwind to scan the package for utility classes */
|
|
130
|
+
@source "../node_modules/@j3m-quantum/ui/dist/**/*.js";
|
|
26
131
|
\`\`\`
|
|
27
132
|
|
|
133
|
+
The @source directive is CRITICAL - without it, Tailwind v4 won't generate CSS for component classes.
|
|
134
|
+
|
|
28
135
|
## Theme Modes (4 Modes)
|
|
29
136
|
| Mode | Classes | Description |
|
|
30
137
|
|------|---------|-------------|
|
|
@@ -58,28 +165,17 @@ When you see these Figma layer names, use these components:
|
|
|
58
165
|
|
|
59
166
|
| Figma Layer Name | Import |
|
|
60
167
|
|------------------|--------|
|
|
61
|
-
| "Button", "CTA", "Primary Button"
|
|
62
|
-
| "Card", "Container", "Panel"
|
|
63
|
-
| "Input", "Text Field"
|
|
64
|
-
| "Dialog", "Modal", "Popup" | \`
|
|
65
|
-
| "Sheet", "Side Panel", "Drawer" | \`
|
|
66
|
-
| "
|
|
67
|
-
| "
|
|
68
|
-
| "
|
|
69
|
-
| "
|
|
70
|
-
| "
|
|
71
|
-
| "
|
|
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'\` |
|
|
168
|
+
| "Button", "CTA", "Primary Button" | \`Button\` |
|
|
169
|
+
| "Card", "Container", "Panel" | \`Card, CardHeader, CardContent\` |
|
|
170
|
+
| "Input", "Text Field" | \`Input\` |
|
|
171
|
+
| "Dialog", "Modal", "Popup" | \`Dialog, DialogContent, DialogHeader\` |
|
|
172
|
+
| "Sheet", "Side Panel", "Drawer" | \`Sheet, SheetContent\` |
|
|
173
|
+
| "Sidebar", "Navigation", "Nav" | \`SidebarProvider, Sidebar, NavMain\` |
|
|
174
|
+
| "Header", "Page Header", "Toolbar" | \`SiteHeader\` |
|
|
175
|
+
| "User Menu", "Profile", "Avatar Menu" | \`NavUser\` |
|
|
176
|
+
| "Table", "Data Grid" | \`Table\` |
|
|
177
|
+
| "Planning Grid", "Week Table" | \`PlanningTable\` |
|
|
178
|
+
| "Calibration Table" | \`CalibrationTable\` |
|
|
83
179
|
|
|
84
180
|
## Available Components (60+)
|
|
85
181
|
|
|
@@ -109,83 +205,78 @@ Map, MapTileLayer, MapMarker, MapPopup, MapTooltip, MapZoomControl
|
|
|
109
205
|
|
|
110
206
|
## DO
|
|
111
207
|
- Import all components from @j3m-quantum/ui
|
|
208
|
+
- Use pre-built blocks (NavMain, NavUser, SiteHeader) instead of building custom
|
|
112
209
|
- Use Tailwind semantic classes: bg-primary, text-muted-foreground, bg-accent
|
|
113
|
-
- Use CSS variables for custom styling: var(--primary), var(--background)
|
|
114
210
|
- Use \`glass-context\` class on Cards with interactive components in glass mode
|
|
115
|
-
- Check the component list above
|
|
116
|
-
- Use the j3m-app-bg class on root element for proper backgrounds
|
|
211
|
+
- Check the component/block list above BEFORE building anything custom
|
|
117
212
|
|
|
118
213
|
## DON'T
|
|
119
|
-
- Don't create new component files for UI
|
|
214
|
+
- Don't create new component files for UI that exists in @j3m-quantum/ui
|
|
215
|
+
- Don't build custom sidebar/navigation - use NavMain, NavUser, etc.
|
|
120
216
|
- Don't use shadcn CLI - components are already bundled
|
|
121
|
-
- Don't
|
|
217
|
+
- Don't add custom CSS tokens - the package provides everything
|
|
122
218
|
- 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
219
|
|
|
128
|
-
|
|
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
|
-
\`\`\`
|
|
220
|
+
## Complete Dashboard Example
|
|
143
221
|
|
|
144
|
-
### Dashboard Layout
|
|
145
222
|
\`\`\`tsx
|
|
146
223
|
import {
|
|
147
|
-
SidebarProvider, Sidebar, SidebarContent, SidebarFooter, SidebarInset,
|
|
148
|
-
SiteHeader, SidebarTrigger, NavMain, NavUser
|
|
224
|
+
SidebarProvider, Sidebar, SidebarContent, SidebarFooter, SidebarInset, SidebarRail,
|
|
225
|
+
SiteHeader, SidebarTrigger, NavMain, NavUser, NavSecondary, type NavItem
|
|
149
226
|
} from '@j3m-quantum/ui'
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
</
|
|
227
|
+
import { Home, Settings, LifeBuoy, Send } from 'lucide-react'
|
|
228
|
+
|
|
229
|
+
const navItems: NavItem[] = [
|
|
230
|
+
{ title: "Home", url: "/", icon: Home, isActive: true },
|
|
231
|
+
{ title: "Settings", url: "/settings", icon: Settings },
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
function App() {
|
|
235
|
+
return (
|
|
236
|
+
<div className="j3m-app-bg min-h-screen">
|
|
237
|
+
<SidebarProvider>
|
|
238
|
+
<Sidebar collapsible="icon">
|
|
239
|
+
<SidebarContent>
|
|
240
|
+
<NavMain items={navItems} />
|
|
241
|
+
</SidebarContent>
|
|
242
|
+
<SidebarFooter>
|
|
243
|
+
<NavSecondary items={[
|
|
244
|
+
{ title: "Support", url: "#", icon: LifeBuoy },
|
|
245
|
+
{ title: "Feedback", url: "#", icon: Send },
|
|
246
|
+
]} />
|
|
247
|
+
<NavUser user={{ name: "John Doe", email: "john@example.com", avatar: "" }} />
|
|
248
|
+
</SidebarFooter>
|
|
249
|
+
<SidebarRail />
|
|
250
|
+
</Sidebar>
|
|
251
|
+
<SidebarInset>
|
|
252
|
+
<SiteHeader
|
|
253
|
+
trigger={<SidebarTrigger />}
|
|
254
|
+
breadcrumbs={[{ label: "Dashboard" }]}
|
|
255
|
+
/>
|
|
256
|
+
<main className="p-4">
|
|
257
|
+
{/* Your content here */}
|
|
258
|
+
</main>
|
|
259
|
+
</SidebarInset>
|
|
260
|
+
</SidebarProvider>
|
|
261
|
+
</div>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
165
264
|
\`\`\`
|
|
166
265
|
|
|
167
|
-
|
|
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
|
-
\`\`\`
|
|
266
|
+
## Recommended Prompts for AI
|
|
185
267
|
|
|
186
|
-
|
|
268
|
+
**Good prompts:**
|
|
269
|
+
- "Create a dashboard using @j3m-quantum/ui blocks: NavMain, NavUser, SiteHeader"
|
|
270
|
+
- "Use only pre-built blocks from @j3m-quantum/ui, don't create custom components"
|
|
271
|
+
- "Import SiteHeader for the header and NavMain for navigation from @j3m-quantum/ui"
|
|
272
|
+
- "Check the j3m-quantum cursor rules before implementing"
|
|
187
273
|
|
|
188
|
-
|
|
274
|
+
**Bad prompts (avoid these):**
|
|
275
|
+
- "Create a sidebar" \u2192 AI might build from scratch
|
|
276
|
+
- "Add navigation" \u2192 Too vague, specify NavMain
|
|
277
|
+
- "Make a header" \u2192 Specify SiteHeader instead
|
|
278
|
+
|
|
279
|
+
## CLI Commands
|
|
189
280
|
|
|
190
281
|
\`\`\`bash
|
|
191
282
|
npx @j3m-quantum/ui init # Set up these rules (already done!)
|
|
@@ -193,12 +284,53 @@ npx @j3m-quantum/ui list # List all available components
|
|
|
193
284
|
npx @j3m-quantum/ui doctor # Check if setup is correct
|
|
194
285
|
\`\`\`
|
|
195
286
|
`;
|
|
287
|
+
var SOURCE_DIRECTIVE = '@source "../node_modules/@j3m-quantum/ui/dist/**/*.js";';
|
|
288
|
+
function findCssFile(cwd) {
|
|
289
|
+
const possiblePaths = [
|
|
290
|
+
path.join(cwd, "src", "index.css"),
|
|
291
|
+
path.join(cwd, "src", "styles", "globals.css"),
|
|
292
|
+
path.join(cwd, "src", "styles", "index.css"),
|
|
293
|
+
path.join(cwd, "src", "app", "globals.css"),
|
|
294
|
+
path.join(cwd, "app", "globals.css"),
|
|
295
|
+
path.join(cwd, "styles", "globals.css"),
|
|
296
|
+
path.join(cwd, "styles", "index.css")
|
|
297
|
+
];
|
|
298
|
+
for (const cssPath of possiblePaths) {
|
|
299
|
+
if (fs2.existsSync(cssPath)) {
|
|
300
|
+
return cssPath;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
function updateCssFile(cssPath) {
|
|
306
|
+
const content = fs2.readFileSync(cssPath, "utf-8");
|
|
307
|
+
if (content.includes("@j3m-quantum/ui/dist")) {
|
|
308
|
+
return { updated: false, message: "already configured" };
|
|
309
|
+
}
|
|
310
|
+
if (!content.includes("@j3m-quantum/ui/styles")) {
|
|
311
|
+
return { updated: false, message: "missing @j3m-quantum/ui/styles import" };
|
|
312
|
+
}
|
|
313
|
+
const lines = content.split("\n");
|
|
314
|
+
let insertIndex = -1;
|
|
315
|
+
for (let i = 0; i < lines.length; i++) {
|
|
316
|
+
if (lines[i].includes("@j3m-quantum/ui/styles")) {
|
|
317
|
+
insertIndex = i + 1;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (insertIndex === -1) {
|
|
322
|
+
return { updated: false, message: "could not find insertion point" };
|
|
323
|
+
}
|
|
324
|
+
lines.splice(insertIndex, 0, "", "/* Required: Tell Tailwind v4 to scan package for utility classes */", SOURCE_DIRECTIVE);
|
|
325
|
+
fs2.writeFileSync(cssPath, lines.join("\n"), "utf-8");
|
|
326
|
+
return { updated: true, message: "added @source directive" };
|
|
327
|
+
}
|
|
196
328
|
async function init() {
|
|
197
329
|
const cwd = process.cwd();
|
|
198
|
-
const cursorDir =
|
|
199
|
-
const rulesDir =
|
|
200
|
-
const rulesFile =
|
|
201
|
-
const cursorRulesFile =
|
|
330
|
+
const cursorDir = path.join(cwd, ".cursor");
|
|
331
|
+
const rulesDir = path.join(cursorDir, "rules");
|
|
332
|
+
const rulesFile = path.join(rulesDir, "j3m-quantum.md");
|
|
333
|
+
const cursorRulesFile = path.join(cwd, ".cursorrules");
|
|
202
334
|
console.log("");
|
|
203
335
|
console.log("\u{1F3A8} Setting up @j3m-quantum/ui...");
|
|
204
336
|
console.log("");
|
|
@@ -217,24 +349,49 @@ async function init() {
|
|
|
217
349
|
}
|
|
218
350
|
}
|
|
219
351
|
console.log("");
|
|
352
|
+
console.log("Configuring Tailwind v4...");
|
|
353
|
+
const cssFile = findCssFile(cwd);
|
|
354
|
+
if (cssFile) {
|
|
355
|
+
const relativePath = cssFile.replace(cwd, "").replace(/^\//, "");
|
|
356
|
+
const result = updateCssFile(cssFile);
|
|
357
|
+
if (result.updated) {
|
|
358
|
+
console.log(` \u2713 Updated ${relativePath} - ${result.message}`);
|
|
359
|
+
} else if (result.message === "already configured") {
|
|
360
|
+
console.log(` \u2713 ${relativePath} - already configured`);
|
|
361
|
+
} else {
|
|
362
|
+
console.log(` \u26A0 ${relativePath} - ${result.message}`);
|
|
363
|
+
console.log(" You may need to manually add:");
|
|
364
|
+
console.log(` ${SOURCE_DIRECTIVE}`);
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
console.log(" \u26A0 Could not find CSS entry file");
|
|
368
|
+
console.log(" Add this to your main CSS file after the @j3m-quantum/ui/styles import:");
|
|
369
|
+
console.log("");
|
|
370
|
+
console.log(` ${SOURCE_DIRECTIVE}`);
|
|
371
|
+
}
|
|
372
|
+
console.log("");
|
|
220
373
|
console.log("\u2705 Setup complete!");
|
|
221
374
|
console.log("");
|
|
375
|
+
console.log("What was configured:");
|
|
376
|
+
console.log(" \u2022 AI cursor rules for correct component usage");
|
|
377
|
+
console.log(" \u2022 Tailwind v4 @source directive to scan package classes");
|
|
378
|
+
console.log("");
|
|
222
379
|
console.log("AI assistants will now:");
|
|
223
380
|
console.log(" \u2022 Use components from @j3m-quantum/ui");
|
|
224
381
|
console.log(" \u2022 Know about all 60+ available components");
|
|
225
382
|
console.log(" \u2022 Map Figma layers to correct components");
|
|
226
383
|
console.log(" \u2022 Follow J3M styling guidelines");
|
|
227
384
|
console.log("");
|
|
228
|
-
console.log("
|
|
229
|
-
console.log(
|
|
230
|
-
console.log('
|
|
231
|
-
console.log('
|
|
232
|
-
console.log(
|
|
385
|
+
console.log("Required CSS imports (if not already present):");
|
|
386
|
+
console.log(' @import "tailwindcss";');
|
|
387
|
+
console.log(' @import "tw-animate-css";');
|
|
388
|
+
console.log(' @import "@j3m-quantum/ui/styles";');
|
|
389
|
+
console.log(` ${SOURCE_DIRECTIVE}`);
|
|
233
390
|
console.log("");
|
|
234
|
-
console.log("
|
|
391
|
+
console.log("Run 'npx @j3m-quantum/ui doctor' to verify setup");
|
|
235
392
|
console.log("");
|
|
236
393
|
} catch (error) {
|
|
237
|
-
console.error("\u274C Failed to set up
|
|
394
|
+
console.error("\u274C Failed to set up:", error.message);
|
|
238
395
|
process.exit(1);
|
|
239
396
|
}
|
|
240
397
|
}
|
|
@@ -410,7 +567,7 @@ async function doctor() {
|
|
|
410
567
|
console.log("");
|
|
411
568
|
console.log("Checking your project setup...");
|
|
412
569
|
console.log("");
|
|
413
|
-
const packageJsonPath =
|
|
570
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
414
571
|
if (fs2.existsSync(packageJsonPath)) {
|
|
415
572
|
const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
|
|
416
573
|
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
@@ -475,8 +632,8 @@ async function doctor() {
|
|
|
475
632
|
message: "Not found - run from project root"
|
|
476
633
|
});
|
|
477
634
|
}
|
|
478
|
-
const cursorRulesPath =
|
|
479
|
-
const altCursorRulesPath =
|
|
635
|
+
const cursorRulesPath = path.join(cwd, ".cursor", "rules", "j3m-quantum.md");
|
|
636
|
+
const altCursorRulesPath = path.join(cwd, ".cursorrules");
|
|
480
637
|
if (fs2.existsSync(cursorRulesPath)) {
|
|
481
638
|
results.push({
|
|
482
639
|
name: "Cursor rules configured",
|
|
@@ -508,11 +665,11 @@ async function doctor() {
|
|
|
508
665
|
});
|
|
509
666
|
}
|
|
510
667
|
const possibleCssPaths = [
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
668
|
+
path.join(cwd, "src", "index.css"),
|
|
669
|
+
path.join(cwd, "src", "styles", "globals.css"),
|
|
670
|
+
path.join(cwd, "src", "app", "globals.css"),
|
|
671
|
+
path.join(cwd, "app", "globals.css"),
|
|
672
|
+
path.join(cwd, "styles", "globals.css")
|
|
516
673
|
];
|
|
517
674
|
let cssFound = false;
|
|
518
675
|
let cssContent = "";
|
|
@@ -529,6 +686,7 @@ async function doctor() {
|
|
|
529
686
|
const hasJ3mStyles = cssContent.includes("@j3m-quantum/ui/styles");
|
|
530
687
|
const hasTailwind = cssContent.includes("tailwindcss");
|
|
531
688
|
cssContent.includes("tw-animate-css");
|
|
689
|
+
const hasSourceDirective = cssContent.includes("@j3m-quantum/ui/dist");
|
|
532
690
|
if (hasJ3mStyles && hasTailwind) {
|
|
533
691
|
const tailwindIndex = cssContent.indexOf("tailwindcss");
|
|
534
692
|
const twAnimateIndex = cssContent.indexOf("tw-animate-css");
|
|
@@ -563,6 +721,20 @@ async function doctor() {
|
|
|
563
721
|
fix: 'Add: @import "tailwindcss";'
|
|
564
722
|
});
|
|
565
723
|
}
|
|
724
|
+
if (hasSourceDirective) {
|
|
725
|
+
results.push({
|
|
726
|
+
name: "Tailwind @source directive",
|
|
727
|
+
status: "pass",
|
|
728
|
+
message: `${foundCssPath} - @source configured for package scanning`
|
|
729
|
+
});
|
|
730
|
+
} else {
|
|
731
|
+
results.push({
|
|
732
|
+
name: "Tailwind @source directive",
|
|
733
|
+
status: "fail",
|
|
734
|
+
message: `${foundCssPath} - missing @source directive (components will be unstyled!)`,
|
|
735
|
+
fix: 'Add: @source "../node_modules/@j3m-quantum/ui/dist/**/*.js";'
|
|
736
|
+
});
|
|
737
|
+
}
|
|
566
738
|
} else {
|
|
567
739
|
results.push({
|
|
568
740
|
name: "CSS imports configured",
|
|
@@ -571,8 +743,8 @@ async function doctor() {
|
|
|
571
743
|
fix: "Create src/index.css with required imports"
|
|
572
744
|
});
|
|
573
745
|
}
|
|
574
|
-
const viteConfigPath =
|
|
575
|
-
const viteConfigJsPath =
|
|
746
|
+
const viteConfigPath = path.join(cwd, "vite.config.ts");
|
|
747
|
+
const viteConfigJsPath = path.join(cwd, "vite.config.js");
|
|
576
748
|
if (fs2.existsSync(viteConfigPath) || fs2.existsSync(viteConfigJsPath)) {
|
|
577
749
|
const configPath = fs2.existsSync(viteConfigPath) ? viteConfigPath : viteConfigJsPath;
|
|
578
750
|
const configContent = fs2.readFileSync(configPath, "utf-8");
|
package/dist/cli/postinstall.js
CHANGED
|
@@ -3,23 +3,43 @@
|
|
|
3
3
|
var isCI = process.env.CI || process.env.CONTINUOUS_INTEGRATION;
|
|
4
4
|
if (!isCI) {
|
|
5
5
|
console.log(`
|
|
6
|
-
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
7
|
-
\u2502
|
|
8
|
-
\
|
|
9
|
-
|
|
10
|
-
\
|
|
11
|
-
\
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
7
|
+
\u2502 \u{1F3A8} @j3m-quantum/ui installed successfully! \u2502
|
|
8
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
9
|
+
|
|
10
|
+
\u{1F4E6} Quick Start - Dashboard Layout:
|
|
11
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
12
|
+
import {
|
|
13
|
+
SidebarProvider, Sidebar, SidebarContent, SidebarFooter, SidebarInset,
|
|
14
|
+
SiteHeader, SidebarTrigger, NavMain, NavUser, type NavItem
|
|
15
|
+
} from '@j3m-quantum/ui'
|
|
16
|
+
|
|
17
|
+
<SidebarProvider>
|
|
18
|
+
<Sidebar collapsible="icon">
|
|
19
|
+
<SidebarContent>
|
|
20
|
+
<NavMain items={[{ title: "Home", url: "/", icon: Home, isActive: true }]} />
|
|
21
|
+
</SidebarContent>
|
|
22
|
+
<SidebarFooter>
|
|
23
|
+
<NavUser user={{ name: "User", email: "user@example.com", avatar: "" }} />
|
|
24
|
+
</SidebarFooter>
|
|
25
|
+
</Sidebar>
|
|
26
|
+
<SidebarInset>
|
|
27
|
+
<SiteHeader trigger={<SidebarTrigger />} breadcrumbs={[{ label: "Home" }]} />
|
|
28
|
+
<main className="p-4">{/* content */}</main>
|
|
29
|
+
</SidebarInset>
|
|
30
|
+
</SidebarProvider>
|
|
31
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
32
|
+
|
|
33
|
+
\u26A1 IMPORTANT: Run this to set up AI assistance:
|
|
34
|
+
|
|
35
|
+
npx @j3m-quantum/ui init
|
|
36
|
+
|
|
37
|
+
This configures Cursor/Copilot to use the correct components
|
|
38
|
+
and adds the required @source directive for Tailwind v4.
|
|
39
|
+
|
|
40
|
+
\u{1F4CB} Other commands:
|
|
41
|
+
npx @j3m-quantum/ui list - List all 60+ components
|
|
42
|
+
npx @j3m-quantum/ui doctor - Check if setup is correct
|
|
43
|
+
|
|
24
44
|
`);
|
|
25
45
|
}
|