-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
6,965 additions
and
8,904 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"$schema": "https://shadcn-vue.com/schema.json", | ||
"style": "default", | ||
"typescript": true, | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "assets/css/tailwind.css", | ||
"baseColor": "slate", | ||
"cssVariables": true | ||
}, | ||
"framework": "nuxt", | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { type ClassValue, clsx } from 'clsx' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
export function cn(...inputs: ClassValue[]) { | ||
return twMerge(clsx(inputs)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { | ||
addComponent, | ||
addComponentsDir, | ||
defineNuxtModule, | ||
tryResolveModule, | ||
} from 'nuxt/kit' | ||
|
||
export interface ShadcnVueOptions { | ||
/** | ||
* Prefix for all the imported component | ||
*/ | ||
prefix: string | ||
|
||
/** | ||
* Directory that the component lives in. | ||
* @default "~/components/ui" | ||
*/ | ||
componentDir: string | ||
} | ||
|
||
export default defineNuxtModule<ShadcnVueOptions>({ | ||
defaults: { | ||
prefix: 'Ui', | ||
componentDir: '~/components/ui', | ||
}, | ||
meta: { | ||
name: 'ShadcnVue', | ||
configKey: 'shadcn', | ||
version: '0.0.1', | ||
compatibility: { | ||
nuxt: '^3.9.0', | ||
bridge: false, | ||
}, | ||
}, | ||
async setup({ componentDir, prefix }) { | ||
const isVeeValidateExist = await tryResolveModule('vee-validate') | ||
|
||
addComponentsDir( | ||
{ | ||
path: componentDir, | ||
extensions: ['.vue'], | ||
prefix, | ||
pathPrefix: false, | ||
}, | ||
{ | ||
prepend: true, | ||
}, | ||
) | ||
|
||
if (isVeeValidateExist !== undefined) { | ||
addComponent({ | ||
filePath: 'vee-validate', | ||
export: 'Form', | ||
name: `${prefix}Form`, | ||
priority: 999, | ||
}) | ||
|
||
addComponent({ | ||
filePath: 'vee-validate', | ||
export: 'Field', | ||
name: `${prefix}FormField`, | ||
priority: 999, | ||
}) | ||
} | ||
|
||
addComponent({ | ||
filePath: 'radix-vue', | ||
export: 'PaginationRoot', | ||
name: `${prefix}Pagination`, | ||
priority: 999, | ||
}) | ||
|
||
addComponent({ | ||
filePath: 'radix-vue', | ||
export: 'PaginationList', | ||
name: `${prefix}PaginationList`, | ||
priority: 999, | ||
}) | ||
|
||
addComponent({ | ||
filePath: 'radix-vue', | ||
export: 'PaginationListItem', | ||
name: `${prefix}PaginationListItem`, | ||
priority: 999, | ||
}) | ||
}, | ||
}) | ||
|
||
declare module '@nuxt/schema' { | ||
interface NuxtConfig { | ||
shadcn?: ShadcnVueOptions | ||
} | ||
interface NuxtOptions { | ||
shadcn?: ShadcnVueOptions | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.