shadcn-svelte
Version:
Add components to your apps.
1 lines • 8.01 kB
JavaScript
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,p as l,u,v as d,y as f}from"./libraries-tdyxKhrQ.mjs";import{i as p}from"./constants-D_Gv5Vlp.mjs";import{c as m,o as h,r as g,s as _}from"./preset-DZGU31yg.mjs";const v=h,y=g,b=_,x=m,S={$schema:`${p}/schema.json`,aliases:{lib:`$lib`,utils:`$lib/utils`,hooks:`$lib/hooks`,components:`$lib/components`,ui:`$lib/components/ui`},tailwind:{baseColor:`slate`,css:`src/app.css`},typescript:!0,registry:`${p}/registry`,style:`nova`,iconLibrary:`lucide`,menuColor:`default`,menuAccent:`subtle`},C=e=>e.endsWith(`/`)?e.slice(0,-1):e,w=e=>f(`Missing aliases.${e} alias`),T=a({$schema:f().optional(),tailwind:a({css:f(`Missing tailwind.css path`),baseColor:f(`Missing tailwind.baseColor field`)},`Missing tailwind object`),aliases:a({components:w(`components`),utils:w(`utils`)},`Missing aliases object`),typescript:t([i(),a({config:f()})],`Invalid typescript field. Must either be 'true', 'false', or '{ "config": "path/to/tsconfig.json" }'`).default(S.typescript)}),E=T.extend({style:f().optional()}),D=T.extend({aliases:T.shape.aliases.extend({ui:w(`ui`).default(S.aliases.ui),hooks:w(`hooks`).default(S.aliases.hooks),lib:w(`lib`).default(S.aliases.lib)}),registry:f().default(S.registry),style:f().optional(),iconLibrary:s(v).optional(),menuColor:s(x).optional(),menuAccent:s(b).optional()}),O=a({...E.shape,...D.shape,aliases:a({...E.shape.aliases.shape,...D.shape.aliases.shape})}),k=O.extend({sveltekit:i(),resolvedPaths:a({cwd:f(),tailwindCss:f(),utils:f(),components:f(),hooks:f(),ui:f(),lib:f()}),style:f().default(S.style),iconLibrary:s(v).default(S.iconLibrary),menuColor:s(x).default(S.menuColor),menuAccent:s(b).default(S.menuAccent)}),A=[`registry:lib`,`registry:block`,`registry:component`,`registry:ui`,`registry:hook`,`registry:page`,`registry:file`,`registry:theme`,`registry:style`,`registry:item`,`registry:base`,`registry:font`],j=[`registry:block`],M=[`registry:example`,`registry:internal`],N=s([...A,...j,...M]).describe(`The type of the item. Used to determine the type and target path of the item when resolved for a project.`),P=s(A).describe(`The type of the file. Used to resolve the file's path for a project.`),F=a({content:f().describe(`The content of the file.`),type:P,target:f().describe(`The target path of the file. This is where the file will be installed.`)}).describe(`The main payload of the registry item. This is an array of files that are part of the registry item. Each file is an object with a target, type, and content.`),I=f().array().describe(`An array of registry items that this item depends on. Use the name of the item to reference shadcn/ui components and urls to reference other registries.`),L=a({name:f().describe(`The name of the item. Used to identify the item in the registry. It should be unique for your registry.`),title:f().optional().describe(`The human-readable title for your registry item. Keep it short and descriptive.`),type:N,author:f().min(2,`Author name must be at least 2 characters`).optional().describe(`The author of the item. Recommended format: username <url>`),description:f().optional().describe(`The description of the item. Used to provide a brief overview of the item.`),dependencies:f().array().optional().describe(`An array of NPM dependencies required by the registry item.`),devDependencies:f().array().optional().describe(`An array of NPM dev dependencies required by the registry item.`),registryDependencies:e(I),meta:d(f(),u()).optional().describe(`Additional metadata for the registry item. This is an object with any key value pairs.`)}),R=L.extend({relativeUrl:f()}),z=r(R),B=d(f(),f()),V=a({cssVars:a({light:B,dark:B})}),H=a({theme:e(B).describe(`CSS variables for the @theme directive. For Tailwind v4 projects only. Use tailwind for older projects.`),light:e(B).describe(`CSS variables for the light theme.`),dark:e(B).describe(`CSS variables for the dark theme.`)}).describe(`The css variables for the registry item. This will be merged with the project's css variables.`),U=d(f().describe(`Direct CSS string (e.g., 'font-family: sans-serif; line-height: 1.5;')`),c(()=>t([f().describe(`CSS property value (e.g., 'blue', 'var(--color-primary)')`),U.describe(`CSS property value for nested rule`)])).describe(`CSS properties or nested selectors`)).describe(`CSS definitions to be added to the project's CSS file. Supports at-rules, selectors, nested rules, utilities, layers, and more.`),W=a({$schema:f().optional(),...L.shape,docs:f().optional().describe(`The documentation for the registry item. This is a markdown string.`),categories:f().array().optional().describe(`The categories of the registry item. This is an array of strings.`),css:e(U),cssVars:e(H),files:r(F).optional()}),G=a({family:f(),provider:o(`google`),import:f(),variable:f(),weight:r(f()).optional(),subsets:r(f()).optional(),selector:f().optional(),dependency:f().optional()}),K=l(`type`,[W.extend({type:o(`registry:base`),config:Y(O).optional()}),W.extend({type:o(`registry:font`),font:G}),W.extend({type:N.exclude([`registry:base`,`registry:font`])})]),q=a({$schema:f().optional(),name:f().describe(`The name of the registry.`),homepage:f().describe(`The homepage of the registry.`),overrideDependencies:f().array().optional().describe("An array of NPM dependencies that should have their versions overridden during registry `build`."),aliases:a({lib:f().optional(),ui:f().optional(),components:f().optional(),utils:f().optional(),hooks:f().optional()}).optional().describe("Defines which internal import paths should be transformed during registry `build`."),items:L.extend({files:F.partial().extend({path:f().describe(`The path to the file relative to the registry root.`),type:P}).array().describe("An array of files that instructs the `build` command on how to locate and parse the registry files."),registryDependencies:I,cssVars:e(H),css:e(U),font:e(G)}).array().describe(`Defines a custom component registry.`)}),J=a({$schema:f().optional(),style:f().optional().describe(`DEPRECATED IN TAILWIND v4! The style for your components. This cannot be changed after initialization.`),tailwind:a({css:f().describe(`Path to the CSS file that imports Tailwind CSS into your project.`),baseColor:f().describe(`Used to generate the default color palette for your components. This cannot be changed after initialization.`),config:f().optional().describe("DEPRECATED IN TAILWIND v4! The path to your `tailwind.config.[js|ts]` file.")}),aliases:a({components:f().describe(`Import alias for your components.`),utils:f().describe(`Import alias for your utility functions.`),ui:f().optional().describe("Import alias for your UI components. Defaults to `$lib/components/ui`."),hooks:f().optional().describe("Import alias for your hooks. Defaults to `$lib/hooks`."),lib:f().optional().describe("Import alias for your library, which is typically where you store your components, utils, hooks, etc. Defaults to `$lib`.")}).describe("The CLI uses these values and the `alias` config from your `svelte.config.js` file to place generated components in the correct location."),registry:f().optional().describe(`The registry URL tells the CLI where to fetch the shadcn-svelte components/registry from. You can pin this to a specific preview release or your own fork of the registry.`),typescript:t([i(),a({config:f().describe(`Path to the tsconfig/jsconfig file.`)})]).optional().describe("Used to determine if Typescript is used for this project. When set to `false`, `.js` files will be installed instead. Defaults to `true`."),iconLibrary:s(v).optional().describe(`The icon library to use for your components.`),menuColor:s(x).optional().describe(`The color scheme for menus.`),menuAccent:s(b).optional().describe(`The accent style for menus.`)});function Y(t){let r={};return Object.entries(t.shape).forEach(([t,i])=>{i instanceof n?r[t]=Y(i).optional():r[t]=e(i)}),a(r)}export{z as a,G as c,y as d,S as f,C as g,k as h,R as i,K as l,O as m,Y as n,W as o,D as p,V as r,F as s,J as t,q as u};