drivn 1.9.0 → 1.10.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/dist/index.js +203 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {Command}from'commander';import*as n from'@clack/prompts';import m from'picocolors';import {join,dirname}from'path';import {execSync}from'child_process';import {existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import {McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {z as z$1}from'zod';var z={next:"Next.js",react:"React"};function $(e){let r=join(e,"package.json");if(!existsSync(r))throw new Error("package.json not found");let t=JSON.parse(readFileSync(r,"utf-8")),a={...t.dependencies,...t.devDependencies},l="react";a.next&&(l="next");let d=existsSync(join(e,"src")),p=existsSync(join(e,"tsconfig.json"));return {framework:l,srcDir:d,typescript:p}}var G="drivn.config.json";function U(e){let r=join(e,G);return existsSync(r)?JSON.parse(readFileSync(r,"utf-8")):null}function K(e,r){let t=join(e,G);writeFileSync(t,JSON.stringify(r,null,2));}function
|
|
2
|
+
import {Command}from'commander';import*as n from'@clack/prompts';import m from'picocolors';import {join,dirname}from'path';import {execSync}from'child_process';import {existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import {McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import {StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import {z as z$1}from'zod';var z={next:"Next.js",react:"React"};function $(e){let r=join(e,"package.json");if(!existsSync(r))throw new Error("package.json not found");let t=JSON.parse(readFileSync(r,"utf-8")),a={...t.dependencies,...t.devDependencies},l="react";a.next&&(l="next");let d=existsSync(join(e,"src")),p=existsSync(join(e,"tsconfig.json"));return {framework:l,srcDir:d,typescript:p}}var G="drivn.config.json";function U(e){let r=join(e,G);return existsSync(r)?JSON.parse(readFileSync(r,"utf-8")):null}function K(e,r){let t=join(e,G);writeFileSync(t,JSON.stringify(r,null,2));}function je(e){existsSync(e)||mkdirSync(e,{recursive:true});}function b(e,r){je(dirname(e)),writeFileSync(e,r);}function H(e){return readFileSync(e,"utf-8")}function x(e){return existsSync(e)}function E(e){return existsSync(join(e,"pnpm-lock.yaml"))?"pnpm":"npm"}function R(e,r){let t=r.join(" ");return e==="pnpm"?`pnpm add ${t}`:`npm install ${t}`}function W(e){return e==="pnpm"?"pnpm dlx":"npx"}var C=`@import "tailwindcss";
|
|
3
3
|
|
|
4
4
|
:root {
|
|
5
5
|
/* Surfaces */
|
|
@@ -136,13 +136,13 @@ body {
|
|
|
136
136
|
/* Special Surfaces */
|
|
137
137
|
--overlay: hsl(0 0% 0% / 0.18);
|
|
138
138
|
}
|
|
139
|
-
`;var
|
|
139
|
+
`;var _e=`import { type ClassValue, clsx } from 'clsx'
|
|
140
140
|
import { twMerge } from 'tailwind-merge'
|
|
141
141
|
|
|
142
142
|
export function cn(...inputs: ClassValue[]) {
|
|
143
143
|
return twMerge(clsx(inputs))
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
`,Fe=["src/app/globals.css","src/styles/globals.css","src/styles/globals.scss","app/globals.css"];function Ge(e){for(let r of Fe)if(x(join(e,r)))return r;return null}async function Y(){let e=process.cwd();console.log(""),console.log(m.bgCyan(m.bold(m.black(" Drivn "))));let r;try{r=$(e),n.log.success(`Detected ${m.cyan(z[r.framework])}`);}catch{n.log.error("No package.json found. Run this command in a project directory."),n.outro("Setup cancelled"),process.exit(1);}if(x(join(e,"drivn.config.json"))){let s=await n.confirm({message:"Config already exists. Overwrite?",initialValue:false});(n.isCancel(s)||!s)&&(n.cancel("Setup cancelled"),process.exit(0));}let t=r.srcDir?"src/components/ui":"components/ui",a=r.srcDir?"src/utils":"utils",l=await n.group({components:()=>n.text({message:"Where should components be installed?",placeholder:t,defaultValue:t}),utils:()=>n.text({message:"Where should utilities be placed?",placeholder:a,defaultValue:a})},{onCancel:()=>{n.cancel("Setup cancelled"),process.exit(0);}}),d={framework:r.framework,typescript:r.typescript,paths:{components:l.components,utils:l.utils},installed:[]},p=r.typescript?"ts":"js",f=join(e,l.utils,`cn.${p}`);x(f)||b(f,_e);let g=Ge(e);if(g){let s=await n.confirm({message:`Found ${m.cyan(g)}. Add Drivn color tokens?`,initialValue:true});!n.isCancel(s)&&s&&(b(join(e,g),C),d.paths.globals=g,n.log.success(`Color tokens written to ${m.cyan(g)}`));}else {let s=r.srcDir?"src/styles/globals.css":"styles/globals.css",i=await n.text({message:"Where should the globals CSS file be created?",placeholder:s,defaultValue:s});n.isCancel(i)||(b(join(e,i),C),d.paths.globals=i,n.log.success(`Color tokens written to ${m.cyan(i)}`));}K(e,d);let N=E(e),u=W(N),h=["clsx","tailwind-merge","lucide-react"],o=n.spinner();o.start("Installing dependencies");try{execSync(R(N,h),{cwd:e,stdio:"ignore"}),o.stop("Dependencies installed");}catch{o.stop("Failed to install dependencies"),n.log.warn(`Run manually: ${R(N,h)}`);}n.log.info(`Add components with: ${m.cyan(`${u} drivn add button`)}`),n.log.info(`Add dark/light theme: ${m.cyan(`${u} drivn add theme`)}`),n.outro("Drivn initialized");}var q=`'use client'
|
|
146
146
|
|
|
147
147
|
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
|
148
148
|
|
|
@@ -1646,6 +1646,120 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(({
|
|
|
1646
1646
|
Checkbox.displayName = 'Checkbox'
|
|
1647
1647
|
`;var le=`'use client'
|
|
1648
1648
|
|
|
1649
|
+
import * as React from 'react'
|
|
1650
|
+
import { cn } from '@/utils/cn'
|
|
1651
|
+
|
|
1652
|
+
const styles = {
|
|
1653
|
+
panel: 'grid transition-[grid-template-rows] duration-200',
|
|
1654
|
+
content: 'overflow-hidden',
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
interface CollapsibleCtx {
|
|
1658
|
+
open: boolean
|
|
1659
|
+
toggle: () => void
|
|
1660
|
+
triggerId: string
|
|
1661
|
+
contentId: string
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
function CollapsibleRoot({
|
|
1665
|
+
children,
|
|
1666
|
+
className,
|
|
1667
|
+
defaultOpen = false,
|
|
1668
|
+
open: controlledOpen,
|
|
1669
|
+
onOpenChange,
|
|
1670
|
+
}: {
|
|
1671
|
+
children: React.ReactNode
|
|
1672
|
+
className?: string
|
|
1673
|
+
defaultOpen?: boolean
|
|
1674
|
+
open?: boolean
|
|
1675
|
+
onOpenChange?: (open: boolean) => void
|
|
1676
|
+
}) {
|
|
1677
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen)
|
|
1678
|
+
const open = controlledOpen ?? internalOpen
|
|
1679
|
+
const id = React.useId()
|
|
1680
|
+
const triggerId = \`\${id}trigger\`
|
|
1681
|
+
const contentId = \`\${id}content\`
|
|
1682
|
+
|
|
1683
|
+
const toggle = () => {
|
|
1684
|
+
const next = !open
|
|
1685
|
+
if (controlledOpen === undefined) setInternalOpen(next)
|
|
1686
|
+
onOpenChange?.(next)
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
return (
|
|
1690
|
+
<Ctx.Provider value={{ open, toggle, triggerId, contentId }}>
|
|
1691
|
+
<div
|
|
1692
|
+
className={className}
|
|
1693
|
+
data-state={open ? 'open' : 'closed'}
|
|
1694
|
+
>
|
|
1695
|
+
{children}
|
|
1696
|
+
</div>
|
|
1697
|
+
</Ctx.Provider>
|
|
1698
|
+
)
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
function Trigger({
|
|
1702
|
+
children,
|
|
1703
|
+
className,
|
|
1704
|
+
...props
|
|
1705
|
+
}: {
|
|
1706
|
+
children: React.ReactNode
|
|
1707
|
+
className?: string
|
|
1708
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>) {
|
|
1709
|
+
const { open, toggle, triggerId, contentId } = useCtx()
|
|
1710
|
+
return (
|
|
1711
|
+
<button
|
|
1712
|
+
id={triggerId}
|
|
1713
|
+
aria-expanded={open}
|
|
1714
|
+
aria-controls={contentId}
|
|
1715
|
+
data-state={open ? 'open' : 'closed'}
|
|
1716
|
+
className={className}
|
|
1717
|
+
onClick={toggle}
|
|
1718
|
+
{...props}
|
|
1719
|
+
>
|
|
1720
|
+
{children}
|
|
1721
|
+
</button>
|
|
1722
|
+
)
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
function Content({
|
|
1726
|
+
children,
|
|
1727
|
+
className,
|
|
1728
|
+
}: {
|
|
1729
|
+
children: React.ReactNode
|
|
1730
|
+
className?: string
|
|
1731
|
+
}) {
|
|
1732
|
+
const { open, triggerId, contentId } = useCtx()
|
|
1733
|
+
return (
|
|
1734
|
+
<div
|
|
1735
|
+
id={contentId}
|
|
1736
|
+
role="region"
|
|
1737
|
+
aria-labelledby={triggerId}
|
|
1738
|
+
data-state={open ? 'open' : 'closed'}
|
|
1739
|
+
className={styles.panel}
|
|
1740
|
+
style={{ gridTemplateRows: open ? '1fr' : '0fr' }}
|
|
1741
|
+
>
|
|
1742
|
+
<div className={cn(styles.content, className)}>
|
|
1743
|
+
{children}
|
|
1744
|
+
</div>
|
|
1745
|
+
</div>
|
|
1746
|
+
)
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
const Ctx = React.createContext<CollapsibleCtx | null>(null)
|
|
1750
|
+
|
|
1751
|
+
function useCtx() {
|
|
1752
|
+
const c = React.useContext(Ctx)
|
|
1753
|
+
if (!c) throw new Error('Collapsible compound used outside <Collapsible>')
|
|
1754
|
+
return c
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
export const Collapsible = Object.assign(CollapsibleRoot, {
|
|
1758
|
+
Trigger,
|
|
1759
|
+
Content,
|
|
1760
|
+
})
|
|
1761
|
+
`;var de=`'use client'
|
|
1762
|
+
|
|
1649
1763
|
import * as React from 'react'
|
|
1650
1764
|
import { X } from 'lucide-react'
|
|
1651
1765
|
import { cn } from '@/utils/cn'
|
|
@@ -1800,7 +1914,7 @@ export const Dialog = Object.assign(DialogRoot, {
|
|
|
1800
1914
|
Trigger,
|
|
1801
1915
|
Content,
|
|
1802
1916
|
})
|
|
1803
|
-
`;var
|
|
1917
|
+
`;var pe=`'use client'
|
|
1804
1918
|
|
|
1805
1919
|
import * as React from 'react'
|
|
1806
1920
|
import { X } from 'lucide-react'
|
|
@@ -2019,7 +2133,7 @@ export const Drawer = Object.assign(DrawerRoot, {
|
|
|
2019
2133
|
Header,
|
|
2020
2134
|
Footer,
|
|
2021
2135
|
})
|
|
2022
|
-
`;var
|
|
2136
|
+
`;var me=`'use client'
|
|
2023
2137
|
|
|
2024
2138
|
import * as React from 'react'
|
|
2025
2139
|
import { cn } from '@/utils/cn'
|
|
@@ -2217,7 +2331,7 @@ export const Dropdown = Object.assign(DropdownRoot, {
|
|
|
2217
2331
|
Label,
|
|
2218
2332
|
Separator: DropdownSeparator
|
|
2219
2333
|
})
|
|
2220
|
-
`;var
|
|
2334
|
+
`;var ue=`import * as React from 'react'
|
|
2221
2335
|
import { cn } from '@/utils/cn'
|
|
2222
2336
|
|
|
2223
2337
|
const styles = {
|
|
@@ -2240,7 +2354,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(({
|
|
|
2240
2354
|
)
|
|
2241
2355
|
|
|
2242
2356
|
Input.displayName = 'Input'
|
|
2243
|
-
`;var
|
|
2357
|
+
`;var fe=`import * as React from 'react'
|
|
2244
2358
|
import { cn } from '@/utils/cn'
|
|
2245
2359
|
|
|
2246
2360
|
const styles = {
|
|
@@ -2297,7 +2411,7 @@ function Group({
|
|
|
2297
2411
|
}
|
|
2298
2412
|
|
|
2299
2413
|
export const Kbd = Object.assign(KbdRoot, { Group })
|
|
2300
|
-
`;var
|
|
2414
|
+
`;var ge=`import * as React from 'react'
|
|
2301
2415
|
import { cn } from '@/utils/cn'
|
|
2302
2416
|
|
|
2303
2417
|
export function Label({
|
|
@@ -2314,7 +2428,7 @@ export function Label({
|
|
|
2314
2428
|
/>
|
|
2315
2429
|
)
|
|
2316
2430
|
}
|
|
2317
|
-
`;var
|
|
2431
|
+
`;var he=`import * as React from 'react'
|
|
2318
2432
|
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react'
|
|
2319
2433
|
import { cn } from '@/utils/cn'
|
|
2320
2434
|
|
|
@@ -2447,7 +2561,7 @@ export const Pagination = Object.assign(PaginationRoot, {
|
|
|
2447
2561
|
Next,
|
|
2448
2562
|
Ellipsis: PaginationEllipsis,
|
|
2449
2563
|
})
|
|
2450
|
-
`;var
|
|
2564
|
+
`;var be=`'use client'
|
|
2451
2565
|
|
|
2452
2566
|
import * as React from 'react'
|
|
2453
2567
|
import { cn } from '@/utils/cn'
|
|
@@ -2552,7 +2666,7 @@ export const Popover = Object.assign(PopoverRoot, {
|
|
|
2552
2666
|
Trigger,
|
|
2553
2667
|
Content
|
|
2554
2668
|
})
|
|
2555
|
-
`;var
|
|
2669
|
+
`;var ve=`import * as React from 'react'
|
|
2556
2670
|
import { cn } from '@/utils/cn'
|
|
2557
2671
|
|
|
2558
2672
|
const styles = {
|
|
@@ -2590,7 +2704,7 @@ export function Progress({
|
|
|
2590
2704
|
</div>
|
|
2591
2705
|
)
|
|
2592
2706
|
}
|
|
2593
|
-
`;var
|
|
2707
|
+
`;var xe=`'use client'
|
|
2594
2708
|
|
|
2595
2709
|
import * as React from 'react'
|
|
2596
2710
|
import { cn } from '@/utils/cn'
|
|
@@ -2739,7 +2853,7 @@ function useRadioGroup() {
|
|
|
2739
2853
|
}
|
|
2740
2854
|
|
|
2741
2855
|
export const RadioGroup = Object.assign(RadioGroupRoot, { Item })
|
|
2742
|
-
`;var
|
|
2856
|
+
`;var ye=`'use client'
|
|
2743
2857
|
|
|
2744
2858
|
import * as React from 'react'
|
|
2745
2859
|
import { ChevronDown } from 'lucide-react'
|
|
@@ -2893,7 +3007,53 @@ export const Select = Object.assign(SelectRoot, {
|
|
|
2893
3007
|
Menu,
|
|
2894
3008
|
Option
|
|
2895
3009
|
})
|
|
2896
|
-
`;var
|
|
3010
|
+
`;var Ne=`import * as React from 'react'
|
|
3011
|
+
import { cn } from '@/utils/cn'
|
|
3012
|
+
|
|
3013
|
+
const styles = {
|
|
3014
|
+
base: cn(
|
|
3015
|
+
'relative [scrollbar-width:thin]',
|
|
3016
|
+
'[scrollbar-color:var(--border)_transparent]',
|
|
3017
|
+
'[&::-webkit-scrollbar]:w-1.5',
|
|
3018
|
+
'[&::-webkit-scrollbar]:h-1.5',
|
|
3019
|
+
'[&::-webkit-scrollbar-track]:bg-transparent',
|
|
3020
|
+
'[&::-webkit-scrollbar-track]:rounded-full',
|
|
3021
|
+
'[&::-webkit-scrollbar-thumb]:rounded-full',
|
|
3022
|
+
'[&::-webkit-scrollbar-thumb]:bg-border',
|
|
3023
|
+
'[&:hover::-webkit-scrollbar-thumb]:bg-muted-foreground/30',
|
|
3024
|
+
'[&::-webkit-scrollbar-corner]:bg-transparent'
|
|
3025
|
+
),
|
|
3026
|
+
orientations: {
|
|
3027
|
+
vertical: 'overflow-y-auto overflow-x-hidden',
|
|
3028
|
+
horizontal: 'overflow-x-auto overflow-y-hidden',
|
|
3029
|
+
},
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
interface ScrollAreaProps
|
|
3033
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
3034
|
+
orientation?: 'vertical' | 'horizontal'
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
export function ScrollArea({
|
|
3038
|
+
orientation = 'vertical',
|
|
3039
|
+
className,
|
|
3040
|
+
children,
|
|
3041
|
+
...props
|
|
3042
|
+
}: ScrollAreaProps) {
|
|
3043
|
+
return (
|
|
3044
|
+
<div
|
|
3045
|
+
className={cn(
|
|
3046
|
+
styles.base,
|
|
3047
|
+
styles.orientations[orientation],
|
|
3048
|
+
className
|
|
3049
|
+
)}
|
|
3050
|
+
{...props}
|
|
3051
|
+
>
|
|
3052
|
+
{children}
|
|
3053
|
+
</div>
|
|
3054
|
+
)
|
|
3055
|
+
}
|
|
3056
|
+
`;var Ce=`import * as React from 'react'
|
|
2897
3057
|
import { cn } from '@/utils/cn'
|
|
2898
3058
|
|
|
2899
3059
|
const styles = {
|
|
@@ -2917,7 +3077,24 @@ export function Separator({
|
|
|
2917
3077
|
/>
|
|
2918
3078
|
)
|
|
2919
3079
|
}
|
|
2920
|
-
`;var
|
|
3080
|
+
`;var we=`import * as React from 'react'
|
|
3081
|
+
import { cn } from '@/utils/cn'
|
|
3082
|
+
|
|
3083
|
+
export function Skeleton({
|
|
3084
|
+
className,
|
|
3085
|
+
...props
|
|
3086
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
3087
|
+
return (
|
|
3088
|
+
<div
|
|
3089
|
+
className={cn(
|
|
3090
|
+
'bg-muted/80 rounded-md animate-skeleton',
|
|
3091
|
+
className
|
|
3092
|
+
)}
|
|
3093
|
+
{...props}
|
|
3094
|
+
/>
|
|
3095
|
+
)
|
|
3096
|
+
}
|
|
3097
|
+
`;var Re=`'use client'
|
|
2921
3098
|
|
|
2922
3099
|
import * as React from 'react'
|
|
2923
3100
|
import { ChevronDown, PanelLeft } from 'lucide-react'
|
|
@@ -3203,7 +3380,7 @@ export const Sidebar = Object.assign(SidebarRoot, {
|
|
|
3203
3380
|
Separator: SidebarSeparator,
|
|
3204
3381
|
CollapseButton,
|
|
3205
3382
|
})
|
|
3206
|
-
`;var
|
|
3383
|
+
`;var ke=`'use client'
|
|
3207
3384
|
|
|
3208
3385
|
import * as React from 'react'
|
|
3209
3386
|
import { cn } from '@/utils/cn'
|
|
@@ -3348,7 +3525,7 @@ export const Slider = React.forwardRef<HTMLInputElement, SliderProps>(({
|
|
|
3348
3525
|
)
|
|
3349
3526
|
|
|
3350
3527
|
Slider.displayName = 'Slider'
|
|
3351
|
-
`;var
|
|
3528
|
+
`;var Pe=`'use client'
|
|
3352
3529
|
|
|
3353
3530
|
import * as React from 'react'
|
|
3354
3531
|
import { cn } from '@/utils/cn'
|
|
@@ -3389,7 +3566,7 @@ export function Switch({
|
|
|
3389
3566
|
</button>
|
|
3390
3567
|
)
|
|
3391
3568
|
}
|
|
3392
|
-
`;var
|
|
3569
|
+
`;var De=`'use client'
|
|
3393
3570
|
|
|
3394
3571
|
import * as React from 'react'
|
|
3395
3572
|
import { cn } from '@/utils/cn'
|
|
@@ -3503,7 +3680,7 @@ export const Tabs = Object.assign(TabsRoot, {
|
|
|
3503
3680
|
Tab,
|
|
3504
3681
|
Panel
|
|
3505
3682
|
})
|
|
3506
|
-
`;var
|
|
3683
|
+
`;var Se=`import * as React from 'react'
|
|
3507
3684
|
import { cn } from '@/utils/cn'
|
|
3508
3685
|
|
|
3509
3686
|
const styles = {
|
|
@@ -3530,7 +3707,7 @@ export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(({
|
|
|
3530
3707
|
))
|
|
3531
3708
|
|
|
3532
3709
|
Textarea.displayName = 'Textarea'
|
|
3533
|
-
`;var
|
|
3710
|
+
`;var Te=`'use client'
|
|
3534
3711
|
|
|
3535
3712
|
import * as React from 'react'
|
|
3536
3713
|
import { Toaster as Sonner, toast } from 'sonner'
|
|
@@ -3573,7 +3750,7 @@ function Toaster() {
|
|
|
3573
3750
|
}
|
|
3574
3751
|
|
|
3575
3752
|
export { Toaster, toast }
|
|
3576
|
-
`;var
|
|
3753
|
+
`;var Ie=`import * as React from 'react'
|
|
3577
3754
|
import { cn } from '@/utils/cn'
|
|
3578
3755
|
|
|
3579
3756
|
const styles = {
|
|
@@ -3747,7 +3924,7 @@ export const Table = Object.assign(TableRoot, {
|
|
|
3747
3924
|
Head,
|
|
3748
3925
|
Cell,
|
|
3749
3926
|
})
|
|
3750
|
-
`;var
|
|
3927
|
+
`;var Ee=`import * as React from 'react'
|
|
3751
3928
|
import { cn } from '@/utils/cn'
|
|
3752
3929
|
|
|
3753
3930
|
const styles = {
|
|
@@ -3792,7 +3969,7 @@ export function Tooltip({
|
|
|
3792
3969
|
</span>
|
|
3793
3970
|
)
|
|
3794
3971
|
}
|
|
3795
|
-
`;var
|
|
3972
|
+
`;var Le=`
|
|
3796
3973
|
/* react-day-picker theme integration */
|
|
3797
3974
|
.rdp-root {
|
|
3798
3975
|
--rdp-accent-color: var(--primary);
|
|
@@ -3803,7 +3980,7 @@ export function Tooltip({
|
|
|
3803
3980
|
--rdp-selected-border: none;
|
|
3804
3981
|
--rdp-day_button-border: none;
|
|
3805
3982
|
}
|
|
3806
|
-
`,v=[{name:"accordion",description:"Collapsible content sections with dot notation and smooth animation",dependencies:[],npmDependencies:[]},{name:"alert",description:"Contextual feedback messages with variants and icons",dependencies:[],npmDependencies:[]},{name:"aspect-ratio",description:"Maintain consistent width-to-height ratios for images, videos, and embedded content",dependencies:[],npmDependencies:[]},{name:"avatar",description:"User avatar with image support and fallback initials",dependencies:[],npmDependencies:[]},{name:"badge",description:"Small status indicator with color variants",dependencies:[],npmDependencies:[]},{name:"breadcrumb",description:"Breadcrumb navigation with auto-separators, ellipsis, and dot notation",dependencies:[],npmDependencies:[]},{name:"button",description:"Button with variants, sizes, loading state, and icon slots",dependencies:[],npmDependencies:[]},{name:"calendar",description:"Date picker powered by react-day-picker with single, range, and dropdown modes",dependencies:[],npmDependencies:["react-day-picker"]},{name:"date-picker",description:"Date picker input with Calendar dropdown for single date and range selection",dependencies:["calendar"],npmDependencies:[]},{name:"command",description:"Searchable command menu with filtering, keyboard navigation, and dialog mode",dependencies:["dialog"],npmDependencies:["cmdk"]},{name:"carousel",description:"Carousel with touch/swipe, navigation arrows, dot indicators, and loop mode",dependencies:["button"],npmDependencies:["embla-carousel-react"]},{name:"card",description:"Container with dot notation preview and info sub-components",dependencies:[],npmDependencies:[]},{name:"checkbox",description:"Checkbox input with label and CSS-only checkmark",dependencies:[],npmDependencies:[]},{name:"dialog",description:"Modal dialog with dot notation, overlay, and escape key",dependencies:["button"],npmDependencies:[]},{name:"drawer",description:"Slide-in panel with side positioning, header/footer, and overlay",dependencies:["button"],npmDependencies:[]},{name:"dropdown",description:"Dropdown menu with dot notation, groups, separators, and click-outside",dependencies:["button"],npmDependencies:[]},{name:"input",description:"Text input with focus ring and disabled state",dependencies:[],npmDependencies:[]},{name:"kbd",description:"Keyboard key display for shortcuts and hotkeys",dependencies:[],npmDependencies:[]},{name:"label",description:"Accessible form label for inputs, checkboxes, and selects",dependencies:[],npmDependencies:[]},{name:"pagination",description:"Page navigation with dot notation, Previous/Next, ellipsis, and active state",dependencies:[],npmDependencies:[]},{name:"popover",description:"Floating content panel with dot notation and click-outside",dependencies:["button"],npmDependencies:[]},{name:"progress",description:"Progress bar with animated fill and ARIA attributes",dependencies:[],npmDependencies:[]},{name:"radio-group",description:"Radio group with dot notation, orientation support, and controlled/uncontrolled selection",dependencies:[],npmDependencies:[]},{name:"select",description:"Custom select with dot notation and composable options",dependencies:[],npmDependencies:[]},{name:"separator",description:"Visual divider with horizontal and vertical orientation",dependencies:[],npmDependencies:[]},{name:"sidebar",description:"Collapsible sidebar with dot notation, icon items, groups, and layout variants",dependencies:[],npmDependencies:[]},{name:"slider",description:"Range slider with pointer drag, step snapping, and size variants",dependencies:[],npmDependencies:[]},{name:"switch",description:"Toggle switch with smooth transition",dependencies:[],npmDependencies:[]},{name:"tabs",description:"Tab navigation with dot notation and panel content",dependencies:[],npmDependencies:[]},{name:"table",description:"Data table with dot notation, striped/bordered variants, and responsive overflow",dependencies:[],npmDependencies:[]},{name:"textarea",description:"Multi-line text input with consistent styling",dependencies:[],npmDependencies:[]},{name:"theme",description:"Dark/light theme support with next-themes and ThemeProvider",dependencies:[],npmDependencies:["next-themes"]},{name:"toast",description:"Toast notifications powered by Sonner",dependencies:[],npmDependencies:["sonner"]},{name:"tooltip",description:"Pure CSS tooltip with 4 position options",dependencies:[],npmDependencies:[]}],w={accordion:J,alert:X,"aspect-ratio":Z,avatar:Q,badge:ee,breadcrumb:te,button:ne,calendar:oe,"date-picker":re,command:se,carousel:ae,card:ie,checkbox:ce,
|
|
3983
|
+
`,v=[{name:"accordion",description:"Collapsible content sections with dot notation and smooth animation",dependencies:[],npmDependencies:[]},{name:"alert",description:"Contextual feedback messages with variants and icons",dependencies:[],npmDependencies:[]},{name:"aspect-ratio",description:"Maintain consistent width-to-height ratios for images, videos, and embedded content",dependencies:[],npmDependencies:[]},{name:"avatar",description:"User avatar with image support and fallback initials",dependencies:[],npmDependencies:[]},{name:"badge",description:"Small status indicator with color variants",dependencies:[],npmDependencies:[]},{name:"breadcrumb",description:"Breadcrumb navigation with auto-separators, ellipsis, and dot notation",dependencies:[],npmDependencies:[]},{name:"button",description:"Button with variants, sizes, loading state, and icon slots",dependencies:[],npmDependencies:[]},{name:"calendar",description:"Date picker powered by react-day-picker with single, range, and dropdown modes",dependencies:[],npmDependencies:["react-day-picker"]},{name:"date-picker",description:"Date picker input with Calendar dropdown for single date and range selection",dependencies:["calendar"],npmDependencies:[]},{name:"command",description:"Searchable command menu with filtering, keyboard navigation, and dialog mode",dependencies:["dialog"],npmDependencies:["cmdk"]},{name:"carousel",description:"Carousel with touch/swipe, navigation arrows, dot indicators, and loop mode",dependencies:["button"],npmDependencies:["embla-carousel-react"]},{name:"card",description:"Container with dot notation preview and info sub-components",dependencies:[],npmDependencies:[]},{name:"checkbox",description:"Checkbox input with label and CSS-only checkmark",dependencies:[],npmDependencies:[]},{name:"collapsible",description:"Toggle content visibility with smooth animation and accessible controls",dependencies:[],npmDependencies:[]},{name:"dialog",description:"Modal dialog with dot notation, overlay, and escape key",dependencies:["button"],npmDependencies:[]},{name:"drawer",description:"Slide-in panel with side positioning, header/footer, and overlay",dependencies:["button"],npmDependencies:[]},{name:"dropdown",description:"Dropdown menu with dot notation, groups, separators, and click-outside",dependencies:["button"],npmDependencies:[]},{name:"input",description:"Text input with focus ring and disabled state",dependencies:[],npmDependencies:[]},{name:"kbd",description:"Keyboard key display for shortcuts and hotkeys",dependencies:[],npmDependencies:[]},{name:"label",description:"Accessible form label for inputs, checkboxes, and selects",dependencies:[],npmDependencies:[]},{name:"pagination",description:"Page navigation with dot notation, Previous/Next, ellipsis, and active state",dependencies:[],npmDependencies:[]},{name:"popover",description:"Floating content panel with dot notation and click-outside",dependencies:["button"],npmDependencies:[]},{name:"progress",description:"Progress bar with animated fill and ARIA attributes",dependencies:[],npmDependencies:[]},{name:"radio-group",description:"Radio group with dot notation, orientation support, and controlled/uncontrolled selection",dependencies:[],npmDependencies:[]},{name:"select",description:"Custom select with dot notation and composable options",dependencies:[],npmDependencies:[]},{name:"scroll-area",description:"Themed scrollable container with custom scrollbar styling and orientation control",dependencies:[],npmDependencies:[]},{name:"separator",description:"Visual divider with horizontal and vertical orientation",dependencies:[],npmDependencies:[]},{name:"skeleton",description:"Loading placeholder with pulse animation, sized and shaped via className",dependencies:[],npmDependencies:[]},{name:"sidebar",description:"Collapsible sidebar with dot notation, icon items, groups, and layout variants",dependencies:[],npmDependencies:[]},{name:"slider",description:"Range slider with pointer drag, step snapping, and size variants",dependencies:[],npmDependencies:[]},{name:"switch",description:"Toggle switch with smooth transition",dependencies:[],npmDependencies:[]},{name:"tabs",description:"Tab navigation with dot notation and panel content",dependencies:[],npmDependencies:[]},{name:"table",description:"Data table with dot notation, striped/bordered variants, and responsive overflow",dependencies:[],npmDependencies:[]},{name:"textarea",description:"Multi-line text input with consistent styling",dependencies:[],npmDependencies:[]},{name:"theme",description:"Dark/light theme support with next-themes and ThemeProvider",dependencies:[],npmDependencies:["next-themes"]},{name:"toast",description:"Toast notifications powered by Sonner",dependencies:[],npmDependencies:["sonner"]},{name:"tooltip",description:"Pure CSS tooltip with 4 position options",dependencies:[],npmDependencies:[]}],w={accordion:J,alert:X,"aspect-ratio":Z,avatar:Q,badge:ee,breadcrumb:te,button:ne,calendar:oe,"date-picker":re,command:se,carousel:ae,card:ie,checkbox:ce,collapsible:le,dialog:de,drawer:pe,dropdown:me,input:ue,kbd:fe,label:ge,pagination:he,popover:be,progress:ve,"radio-group":xe,select:ye,"scroll-area":Ne,separator:Ce,skeleton:we,sidebar:Re,slider:ke,switch:Pe,table:Ie,tabs:De,textarea:Se,theme:q,toast:Te,tooltip:Ee};async function Oe(e){let r=process.cwd();n.intro("drivn add");let t=U(r);if(t||(n.log.error("Drivn is not initialized. Run npx drivn@latest create"),n.outro("Cancelled"),process.exit(1)),!e||!e.length){let o=await n.multiselect({message:"Select components to add",options:v.map(s=>({label:s.name,hint:s.description,value:s.name})),required:true});n.isCancel(o)&&(n.cancel("Cancelled"),process.exit(0)),e=o;}let a=e.filter(o=>!v.find(s=>s.name===o));a.length&&(n.log.error(`Unknown components: ${a.join(", ")}`),n.log.info("Available: "+v.map(o=>o.name).join(", ")),n.outro("Cancelled"),process.exit(1));let l=e.includes("theme"),d=e.filter(o=>o!=="theme"),p=new Set,f=new Set,g=o=>{if(p.has(o))return;let s=v.find(i=>i.name===o);s&&(s.dependencies.forEach(i=>g(i)),s.npmDependencies?.forEach(i=>f.add(i)),p.add(o));};d.forEach(g),l&&f.add("next-themes");let N=[...p].filter(o=>!d.includes(o));N.length&&n.log.info(`Required dependency: ${N.join(", ")}`);let u=t.typescript?"tsx":"jsx",h=join(r,t.paths.components);for(let o of p){let s=join(h,`${o}.${u}`);if(x(s)){let D=await n.confirm({message:`${o}.${u} exists. Overwrite?`,initialValue:false});if(n.isCancel(D)||!D){n.log.warn(`Skipped ${o}`);continue}}let i=w[o];i=i.replace(/@\/utils/g,`@/${t.paths.utils.replace(/^src\//,"")}`),b(s,i),n.log.success(`${o} \u2192 ${t.paths.components}/${o}.${u}`);}if(l){let o=join(h,`theme-provider.${u}`);if(x(o)){let i=await n.confirm({message:`theme-provider.${u} exists. Overwrite?`,initialValue:false});!n.isCancel(i)&&i?(b(o,w.theme),n.log.success(`theme-provider \u2192 ${t.paths.components}/theme-provider.${u}`)):n.log.warn("Skipped theme-provider");}else b(o,w.theme),n.log.success(`theme-provider \u2192 ${t.paths.components}/theme-provider.${u}`);if(t.paths.globals){let i=join(r,t.paths.globals);if(x(i)){let D=H(i);D.includes('[data-theme="dark"]')?n.log.warn("Theme tokens already exist in globals \u2014 skipped"):(b(i,D+k),n.log.success(`Theme tokens appended to ${m.cyan(t.paths.globals)}`));}else n.log.warn(`Globals file not found at ${t.paths.globals}`);}else n.log.warn('No globals path in drivn.config.json. Add "globals" to paths');let s=t.paths.components.replace(/^src\//,"@/");n.log.message(""),n.log.info(m.bold("Complete the setup:")),n.log.message(""),n.log.message(m.bold(`${m.cyan("1.")} Import ThemeProvider in your root layout:`)),n.log.message(m.cyan(` import { ThemeProvider } from "${s}/theme-provider"`)),n.log.message(""),n.log.message(m.bold(`${m.cyan("2.")} Add suppressHydrationWarning to <html>:`)),n.log.message(m.cyan(" <html suppressHydrationWarning>")),n.log.message(""),n.log.message(m.bold(`${m.cyan("3.")} Wrap your app with ThemeProvider:`)),n.log.message(m.cyan(" <ThemeProvider>")),n.log.message(m.cyan(" {children}")),n.log.message(m.cyan(" </ThemeProvider>")),n.log.message("");}if(p.has("calendar")&&t.paths.globals){let o=join(r,t.paths.globals);if(x(o)){let s=H(o);s.includes(".rdp-root")?n.log.warn("Calendar tokens already exist in globals \u2014 skipped"):(b(o,s+Le),n.log.success(`Calendar tokens appended to ${m.cyan(t.paths.globals)}`));}}if(f.size){let o=E(r),s=[...f],i=n.spinner();i.start("Installing packages");try{execSync(R(o,s),{cwd:r,stdio:"ignore"}),i.stop("Packages installed");}catch{i.stop("Failed to install packages"),n.log.warn(`Run manually: ${R(o,s)}`);}}n.outro("Done.");}var j=`# Drivn Component Conventions
|
|
3807
3984
|
|
|
3808
3985
|
## Core Philosophy
|
|
3809
3986
|
- **Zero runtime UI deps** \u2014 No Radix, no cva, no external UI primitives. Pure React + Tailwind.
|
|
@@ -3916,7 +4093,7 @@ import { cn } from '@/utils/cn'
|
|
|
3916
4093
|
- Components declare internal deps (other Drivn components)
|
|
3917
4094
|
- Some components need npm packages (react-day-picker, cmdk, embla-carousel-react, sonner)
|
|
3918
4095
|
- The CLI resolves and installs all dependencies automatically
|
|
3919
|
-
`;var L={version:"1.
|
|
4096
|
+
`;var L={version:"1.10.0"};function O(e){return v.find(r=>r.name===e)}function qe(e){let r=new Set,t=a=>{if(r.has(a))return;let l=O(a);l&&(l.dependencies.forEach(d=>t(d)),r.add(a));};return t(e),r.delete(e),[...r]}async function Me(){let e=new McpServer({name:"drivn",version:L.version});e.tool("list_components","List all available Drivn UI components with descriptions",{},async()=>({content:[{type:"text",text:JSON.stringify(v.map(t=>({name:t.name,description:t.description})),null,2)}]})),e.tool("get_component","Get the full source code and metadata for a Drivn component",{name:z$1.string().describe('Component name (e.g. "button", "dialog")')},async({name:t})=>{let a=O(t);if(!a)return {content:[{type:"text",text:`Component "${t}" not found. Use list_components to see available components.`}],isError:true};let l=w[t];return {content:[{type:"text",text:JSON.stringify({name:a.name,description:a.description,dependencies:a.dependencies,npmDependencies:a.npmDependencies,source:l},null,2)}]}}),e.tool("get_component_metadata","Get metadata only (no source code) for a Drivn component \u2014 useful for planning",{name:z$1.string().describe("Component name")},async({name:t})=>{let a=O(t);if(!a)return {content:[{type:"text",text:`Component "${t}" not found. Use list_components to see available components.`}],isError:true};let l=qe(t);return {content:[{type:"text",text:JSON.stringify({name:a.name,description:a.description,dependencies:a.dependencies,npmDependencies:a.npmDependencies,allResolvedDependencies:l},null,2)}]}}),e.tool("search_components","Search Drivn components by name or description",{query:z$1.string().describe("Search query")},async({query:t})=>{let a=t.toLowerCase(),l=v.filter(d=>d.name.includes(a)||d.description.toLowerCase().includes(a));return {content:[{type:"text",text:l.length?JSON.stringify(l.map(d=>({name:d.name,description:d.description})),null,2):`No components matching "${t}".`}]}}),e.tool("get_installation_instructions","Get step-by-step installation instructions for one or more components",{components:z$1.array(z$1.string()).describe("Component names to install"),packageManager:z$1.enum(["npm","pnpm"]).optional().describe("Package manager (default: npm)")},async({components:t,packageManager:a})=>{let l=a??"npm",d=new Set,p=new Set,f=[],g=o=>{if(d.has(o))return;let s=O(o);if(!s){f.push(o);return}s.dependencies.forEach(i=>g(i)),s.npmDependencies.forEach(i=>p.add(i)),d.add(o);};if(t.forEach(g),f.length)return {content:[{type:"text",text:`Unknown components: ${f.join(", ")}. Use list_components to see available components.`}],isError:true};let N=l==="pnpm"?"pnpm dlx":"npx",u=l==="pnpm"?"pnpm add":"npm install",h=[];return h.push(`# Install components via CLI
|
|
3920
4097
|
${N} drivn@latest add ${[...d].join(" ")}`),p.size&&h.push(`# Install required npm dependencies
|
|
3921
4098
|
${u} ${[...p].join(" ")}`),h.push(`# Components will be installed to your configured components directory
|
|
3922
4099
|
# (default: src/components/ui/)`),{content:[{type:"text",text:JSON.stringify({componentsToInstall:[...d],npmDependencies:[...p],steps:h},null,2)}]}}),e.tool("get_design_tokens","Get the Drivn CSS design tokens (base globals and theme tokens)",{},async()=>({content:[{type:"text",text:`/* === Base Globals === */
|
|
@@ -3925,4 +4102,4 @@ ${C}
|
|
|
3925
4102
|
/* === Theme Tokens === */
|
|
3926
4103
|
${k}`}]})),e.tool("get_drivn_rules","Get Drivn coding conventions and component patterns",{},async()=>({content:[{type:"text",text:j}]})),e.resource("drivn-rules","drivn://rules",{description:"Drivn coding conventions and component patterns"},async()=>({contents:[{uri:"drivn://rules",mimeType:"text/markdown",text:j}]})),e.resource("drivn-design-tokens","drivn://design-tokens",{description:"Drivn CSS globals and theme tokens"},async()=>({contents:[{uri:"drivn://design-tokens",mimeType:"text/css",text:`${C}
|
|
3927
4104
|
|
|
3928
|
-
${k}`}]}));for(let t of v){let a=`drivn://components/${t.name}`;e.resource(`drivn-component-${t.name}`,a,{description:t.description},async()=>({contents:[{uri:a,mimeType:"text/plain",text:w[t.name]}]}));}let r=new StdioServerTransport;await e.connect(r);}var
|
|
4105
|
+
${k}`}]}));for(let t of v){let a=`drivn://components/${t.name}`;e.resource(`drivn-component-${t.name}`,a,{description:t.description},async()=>({contents:[{uri:a,mimeType:"text/plain",text:w[t.name]}]}));}let r=new StdioServerTransport;await e.connect(r);}var I=new Command;I.name("drivn").description("Drivn \u2014 Modern UI components").version(L.version);I.command("create").description("Initialize Drivn in your project").action(Y);I.command("add [components...]").description("Add components to your project").action(Oe);I.command("mcp").description("Start the Drivn MCP server").action(Me);I.parse();
|