shadcn 3.6.1 → 3.6.3

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 shadcn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,11 +2,19 @@
2
2
 
3
3
  A CLI for adding components to your project.
4
4
 
5
- ## Usage
5
+ ## create
6
+
7
+ Use the `create` command to create a new project. You will be taken to a website to build your custom design system and choose your framework.
8
+
9
+ ```bash
10
+ npx shadcn create
11
+ ```
12
+
13
+ ## init
6
14
 
7
15
  Use the `init` command to initialize dependencies for a new project.
8
16
 
9
- The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.js`, and CSS variables for the project.
17
+ The `init` command installs dependencies, adds the `cn` util, configures Tailwind CSS, and CSS variables for the project.
10
18
 
11
19
  ```bash
12
20
  npx shadcn init
@@ -40,4 +48,4 @@ Visit https://ui.shadcn.com/docs/cli to view the documentation.
40
48
 
41
49
  ## License
42
50
 
43
- Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.md).
51
+ Licensed under the [MIT license](https://github.com/shadcn-ui/ui/blob/main/LICENSE.md).
@@ -1,3 +1,3 @@
1
1
  var e={lucide:{name:"lucide",title:"Lucide",packages:["lucide-react"],import:"import { ICON } from 'lucide-react'",usage:"<ICON />",export:"lucide-react"},tabler:{name:"tabler",title:"Tabler Icons",packages:["@tabler/icons-react"],import:"import { ICON } from '@tabler/icons-react'",usage:"<ICON />",export:"@tabler/icons-react"},hugeicons:{name:"hugeicons",title:"HugeIcons",packages:["@hugeicons/react","@hugeicons/core-free-icons"],import:`import { HugeiconsIcon } from '@hugeicons/react'
2
- import { ICON } from '@hugeicons/core-free-icons';`,usage:"<HugeiconsIcon icon={ICON} strokeWidth={2} />",export:"@hugeicons/core-free-icons"}};export{e as a};//# sourceMappingURL=chunk-6SDOGUEN.js.map
3
- //# sourceMappingURL=chunk-6SDOGUEN.js.map
2
+ import { ICON } from '@hugeicons/core-free-icons';`,usage:"<HugeiconsIcon icon={ICON} strokeWidth={2} />",export:"@hugeicons/core-free-icons"},phosphor:{name:"phosphor",title:"Phosphor Icons",packages:["@phosphor-icons/react"],import:"import { ICON } from '@phosphor-icons/react'",usage:"<ICON strokeWidth={2} />",export:"@phosphor-icons/react"}};export{e as a};//# sourceMappingURL=chunk-BFNVF2P5.js.map
3
+ //# sourceMappingURL=chunk-BFNVF2P5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/icons/libraries.ts"],"names":["iconLibraries"],"mappings":"AAAO,IAAMA,CAAAA,CAAgB,CAC3B,MAAA,CAAQ,CACN,KAAM,QAAA,CACN,KAAA,CAAO,SACP,QAAA,CAAU,CAAC,cAAc,CAAA,CACzB,MAAA,CAAQ,sCACR,KAAA,CAAO,UAAA,CACP,OAAQ,cACV,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,MAAO,cAAA,CACP,QAAA,CAAU,CAAC,qBAAqB,CAAA,CAChC,OAAQ,4CAAA,CACR,KAAA,CAAO,UAAA,CACP,MAAA,CAAQ,qBACV,CAAA,CACA,UAAW,CACT,IAAA,CAAM,YACN,KAAA,CAAO,WAAA,CACP,SAAU,CAAC,kBAAA,CAAoB,4BAA4B,CAAA,CAC3D,MAAA,CACE,CAAA;AAAA,kDAAA,CAAA,CACF,KAAA,CAAO,gDACP,MAAA,CAAQ,4BACV,EACA,QAAA,CAAU,CACR,KAAM,UAAA,CACN,KAAA,CAAO,iBACP,QAAA,CAAU,CAAC,uBAAuB,CAAA,CAClC,MAAA,CAAQ,+CACR,KAAA,CAAO,0BAAA,CACP,MAAA,CAAQ,uBACV,CACF","file":"chunk-BFNVF2P5.js","sourcesContent":["export const iconLibraries = {\n lucide: {\n name: \"lucide\",\n title: \"Lucide\",\n packages: [\"lucide-react\"],\n import: \"import { ICON } from 'lucide-react'\",\n usage: \"<ICON />\",\n export: \"lucide-react\",\n },\n tabler: {\n name: \"tabler\",\n title: \"Tabler Icons\",\n packages: [\"@tabler/icons-react\"],\n import: \"import { ICON } from '@tabler/icons-react'\",\n usage: \"<ICON />\",\n export: \"@tabler/icons-react\",\n },\n hugeicons: {\n name: \"hugeicons\",\n title: \"HugeIcons\",\n packages: [\"@hugeicons/react\", \"@hugeicons/core-free-icons\"],\n import:\n \"import { HugeiconsIcon } from '@hugeicons/react'\\nimport { ICON } from '@hugeicons/core-free-icons';\",\n usage: \"<HugeiconsIcon icon={ICON} strokeWidth={2} />\",\n export: \"@hugeicons/core-free-icons\",\n },\n phosphor: {\n name: \"phosphor\",\n title: \"Phosphor Icons\",\n packages: [\"@phosphor-icons/react\"],\n import: \"import { ICON } from '@phosphor-icons/react'\",\n usage: \"<ICON strokeWidth={2} />\",\n export: \"@phosphor-icons/react\",\n },\n} as const\n\nexport type IconLibraries = typeof iconLibraries\n\nexport type IconLibrary = IconLibraries[keyof IconLibraries]\n\nexport type IconLibraryName = keyof IconLibraries\n"]}
@@ -1,4 +1,4 @@
1
- import {m,l,f,d,c,e,n,t,o,b as b$1,p,q as q$1,r,s,w,y as y$1,v,g}from'./chunk-WKG3W635.js';import {a,b}from'./chunk-7C5BCSX2.js';import*as y from'path';import y__default,{basename}from'path';import {z}from'zod';import*as G from'fs/promises';import {tmpdir,homedir}from'os';import {green,cyan,yellow,red}from'kleur/colors';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import Le from'fast-glob';import Ne from'fs-extra';import {existsSync,statSync,promises}from'fs';import Ar from'ora';import {Project,SyntaxKind,ScriptKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import Kr from'@babel/plugin-transform-typescript';import*as Ve from'recast';import Xr from'prompts';import pe from'deepmerge';import {HttpsProxyAgent}from'https-proxy-agent';import $s from'node-fetch';import {createHash}from'crypto';import Ns from'stringify-object';import rn from'fuzzysort';var te=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",ke="new-york-v4",It=[{name:"neutral",label:"Neutral"},{name:"gray",label:"Gray"},{name:"zinc",label:"Zinc"},{name:"stone",label:"Stone"},{name:"slate",label:"Slate"}],F={"@shadcn":`${te}/styles/{style}/{name}.json`};var cn=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is deprecated. Use the sonner component instead."},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}];function de(e){return e.replace(/\${(\w+)}/g,(t,r)=>process.env[r]||"")}function ge(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}var N={NOT_FOUND:"NOT_FOUND",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN",FETCH_ERROR:"FETCH_ERROR",NOT_CONFIGURED:"NOT_CONFIGURED",INVALID_CONFIG:"INVALID_CONFIG",MISSING_ENV_VARS:"MISSING_ENV_VARS",LOCAL_FILE_ERROR:"LOCAL_FILE_ERROR",PARSE_ERROR:"PARSE_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},I=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||N.UNKNOWN_ERROR,this.statusCode=r.statusCode,this.cause=r.cause,this.context=r.context,this.suggestion=r.suggestion,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,context:this.context,suggestion:this.suggestion,timestamp:this.timestamp,stack:this.stack}}},q=class extends I{constructor(r,s){let n=`The item at ${r} was not found. It may not exist at the registry.`;super(n,{code:N.NOT_FOUND,statusCode:404,cause:s,context:{url:r},suggestion:"Check if the item name is correct and the registry URL is accessible."});this.url=r;this.name="RegistryNotFoundError";}},ue=class extends I{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:N.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},he=class extends I{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:N.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},ye=class extends I{constructor(r,s,n,i){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,a=typeof i=="string"&&i?`${o} - ${i}`:o,p="Check your network connection and try again.";s===404?p="The requested resource was not found. Check the URL or item name.":s===500?p="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(p="There was a client error. Check your request parameters.");super(a,{code:N.FETCH_ERROR,statusCode:s,cause:i,context:{url:r,responseBody:n},suggestion:p});this.url=r;this.responseBody=n;this.name="RegistryFetchError";}},U=class extends I{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined in components.json as follows:
1
+ import {m,l,f,d,c,e,n,t,o,b as b$1,p,q as q$1,r,s,w,y as y$1,v,g}from'./chunk-WKG3W635.js';import {a,b}from'./chunk-PMFK2ZSQ.js';import*as y from'path';import y__default,{basename}from'path';import {z}from'zod';import*as G from'fs/promises';import {tmpdir,homedir}from'os';import {green,cyan,yellow,red}from'kleur/colors';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import Le from'fast-glob';import Ne from'fs-extra';import {existsSync,statSync,promises}from'fs';import Ar from'ora';import {Project,SyntaxKind,ScriptKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import Kr from'@babel/plugin-transform-typescript';import*as Ve from'recast';import Xr from'prompts';import pe from'deepmerge';import {HttpsProxyAgent}from'https-proxy-agent';import $s from'node-fetch';import {createHash}from'crypto';import Ns from'stringify-object';import rn from'fuzzysort';var te=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",ke="new-york-v4",It=[{name:"neutral",label:"Neutral"},{name:"gray",label:"Gray"},{name:"zinc",label:"Zinc"},{name:"stone",label:"Stone"},{name:"slate",label:"Slate"}],F={"@shadcn":`${te}/styles/{style}/{name}.json`};var cn=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is deprecated. Use the sonner component instead."},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}];function de(e){return e.replace(/\${(\w+)}/g,(t,r)=>process.env[r]||"")}function ge(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}var N={NOT_FOUND:"NOT_FOUND",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN",FETCH_ERROR:"FETCH_ERROR",NOT_CONFIGURED:"NOT_CONFIGURED",INVALID_CONFIG:"INVALID_CONFIG",MISSING_ENV_VARS:"MISSING_ENV_VARS",LOCAL_FILE_ERROR:"LOCAL_FILE_ERROR",PARSE_ERROR:"PARSE_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},I=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||N.UNKNOWN_ERROR,this.statusCode=r.statusCode,this.cause=r.cause,this.context=r.context,this.suggestion=r.suggestion,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,context:this.context,suggestion:this.suggestion,timestamp:this.timestamp,stack:this.stack}}},q=class extends I{constructor(r,s){let n=`The item at ${r} was not found. It may not exist at the registry.`;super(n,{code:N.NOT_FOUND,statusCode:404,cause:s,context:{url:r},suggestion:"Check if the item name is correct and the registry URL is accessible."});this.url=r;this.name="RegistryNotFoundError";}},ue=class extends I{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:N.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},he=class extends I{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:N.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},ye=class extends I{constructor(r,s,n,i){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,a=typeof i=="string"&&i?`${o} - ${i}`:o,p="Check your network connection and try again.";s===404?p="The requested resource was not found. Check the URL or item name.":s===500?p="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(p="There was a client error. Check your request parameters.");super(a,{code:N.FETCH_ERROR,statusCode:s,cause:i,context:{url:r,responseBody:n},suggestion:p});this.url=r;this.responseBody=n;this.name="RegistryFetchError";}},U=class extends I{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined in components.json as follows:
2
2
  {
3
3
  "registries": {
4
4
  "${r}": "[URL_TO_REGISTRY]"
@@ -30,5 +30,5 @@ Message:`),R.error(e.cause)),e.suggestion&&(R.error(`
30
30
  Suggestion:`),R.error(e.suggestion)),R.break(),process.exit(1)),e instanceof z.ZodError){R.error("Validation failed:");for(let[t,r]of Object.entries(e.flatten().fieldErrors))R.error(`- ${P.info(t)}: ${r}`);R.break(),process.exit(1);}e instanceof Error&&(R.error(e.message),R.break(),process.exit(1)),R.break(),process.exit(1);}async function ct(e,t){let{config:r,useCache:s}=t||{};if(L(e)){let[a]=await j([e],{useCache:s});try{return o.parse(a)}catch(p){throw new $(e,p)}}if(!e.startsWith("@"))throw new we(e);let n=e;n.endsWith("/registry")||(n=`${n}/registry`);let i=ce(n,le(r));if(!i?.url)throw new q(n);i.headers&&Object.keys(i.headers).length>0&&ve({[i.url]:i.headers});let[o$1]=await j([i.url],{useCache:s});try{return o.parse(o$1)}catch(a){throw new $(n,a)}}async function Zs(e,t){let{config:r,useCache:s=false}=t||{};return Re(),Q(e,le(r),{useCache:s})}async function Qs(e,t){let{config:r,useCache:s=false}=t||{};return Re(),ar(e,le(r),{useCache:s})}async function tl(e,t){let{useCache:r=true}=t||{};r||Ae.clearCaches();let s=await Ae.search(e);if(!s)return {registries:F};let n=z.object({registries:b$1.optional()}).safeParse(s.config);if(!n.success)throw new $e(e,n.error);return {registries:{...F,...n.data.registries||{}}}}async function lr(){try{let[e]=await j(["index.json"]);return p.parse(e)}catch(e){R.error(`
31
31
  `),fe(e);}}async function rl(){try{let[e]=await j(["styles/index.json"]);return q$1.parse(e)}catch(e){return R.error(`
32
32
  `),fe(e),[]}}async function sl(){try{let[e]=await j(["icons/index.json"]);return r.parse(e)}catch(e){return fe(e),{}}}async function nl(){return It}async function Me(e){try{let[t]=await j([`colors/${e}.json`]);return s.parse(t)}catch(t){fe(t);}}async function Xs(e,t){let r=[];for(let s of t){let n=e.find(i=>i.name===s);if(n&&(r.push(n),n.registryDependencies)){let i=await Xs(e,n.registryDependencies);r.push(...i);}}return r.filter((s,n,i)=>i.findIndex(o=>o.name===s.name)===n)}async function il(e,t){try{let r=t.map(n=>`styles/${e}/${n.name}.json`);return (await j(r)).map(n$1=>n.parse(n$1))}catch(r){return fe(r),[]}}async function ol(e,t,r){if(r)return r;if(t.type==="registry:ui")return e.resolvedPaths.ui??e.resolvedPaths.components;let[s,n]=t.type?.split(":")??[];return s in e.resolvedPaths?y__default.join(e.resolvedPaths[s],n):null}async function en(e){e={useCache:true,...e};let t=`${te}/registries.json`,[r]=await j([t],{useCache:e.useCache});try{return w.parse(r)}catch(s){throw s instanceof z.ZodError?new Ee(s):s}}async function tn(e){e={useCache:true,...e};let t=`${te}/config.json`,[r]=await j([t],{useCache:e.useCache});return y$1.parse(r).presets}async function al(e,t){return (await tn(t)).find(s=>s.name.toLowerCase()===e.toLowerCase())??null}async function sn(e,t){let{query:r,limit:s,offset:n,config:i,useCache:o}=t||{},a=[];for(let f of e){let u=((await ct(f,{config:i,useCache:o})).items||[]).map(w=>({name:w.name,type:w.type,description:w.description,registry:f,addCommandArgument:ln(w.name,f)}));a=a.concat(u);}r&&(a=on(a,{query:r,limit:a.length,keys:["name","description"]}));let p=n||0,c=s||a.length,l=a.length,d={pagination:{total:l,offset:p,limit:c,hasMore:p+c<l},items:a.slice(p,p+c)};return v.parse(d)}var nn=z.object({name:z.string(),type:z.string().optional(),description:z.string().optional(),registry:z.string().optional(),addCommandArgument:z.string().optional()}).passthrough();function on(e,t){t={limit:100,threshold:-1e4,...t};let s=rn.go(t.query,e,{keys:t.keys,threshold:t.threshold,limit:t.limit}).map(n=>n.obj);return z.array(nn).parse(s)}function an(e){try{return new URL(e),!0}catch{return false}}function ln(e,t){if(!an(t))return `${t}/${e}`;let r=t.indexOf("://")+3,s=t.indexOf("/",r);if(s===-1){let f=t.indexOf("?",r);if(f!==-1){let x=t.substring(0,f),w=t.substring(f).replace(/\bregistry\b/g,e);return x+w}return t}let n=t.substring(0,s),i=t.substring(s),o=i.indexOf("?")!==-1?i.indexOf("?"):i.length,a=i.substring(0,o),p=i.substring(o),c=a.lastIndexOf("registry"),l=a;c!==-1&&(l=a.substring(0,c)+e+a.substring(c+8));let d=p.replace(/\bregistry\b/g,e);return n+l+d}
33
- export{Qs as $,re as A,$ as B,xe as C,we as D,Ee as E,se as F,At as G,Ot as H,Ft as I,Dt as J,ao as K,hs as L,L as M,vo as N,le as O,Re as P,Lo as Q,ce as R,j as S,ga as T,tr as U,Ws as V,Q as W,ar as X,fe as Y,ct as Z,Zs as _,It as a,tl as aa,F as b,lr as ba,cn as c,rl as ca,P as d,sl as da,jn as e,nl as ea,kn as f,Me as fa,$n as g,Xs as ga,An as h,il as ha,Oe as i,ol as ia,Qe as j,en as ja,On as k,tn as ka,Er as l,al as la,Rr as m,sn as ma,Pt as n,Xe as o,W as p,qn as q,ze as r,R as s,Z as t,I as u,q as v,ue as w,he as x,ye as y,U as z};//# sourceMappingURL=chunk-AXG36CF4.js.map
34
- //# sourceMappingURL=chunk-AXG36CF4.js.map
33
+ export{Qs as $,re as A,$ as B,xe as C,we as D,Ee as E,se as F,At as G,Ot as H,Ft as I,Dt as J,ao as K,hs as L,L as M,vo as N,le as O,Re as P,Lo as Q,ce as R,j as S,ga as T,tr as U,Ws as V,Q as W,ar as X,fe as Y,ct as Z,Zs as _,It as a,tl as aa,F as b,lr as ba,cn as c,rl as ca,P as d,sl as da,jn as e,nl as ea,kn as f,Me as fa,$n as g,Xs as ga,An as h,il as ha,Oe as i,ol as ia,Qe as j,en as ja,On as k,tn as ka,Er as l,al as la,Rr as m,sn as ma,Pt as n,Xe as o,W as p,qn as q,ze as r,R as s,Z as t,I as u,q as v,ue as w,he as x,ye as y,U as z};//# sourceMappingURL=chunk-I3JXSMK6.js.map
34
+ //# sourceMappingURL=chunk-I3JXSMK6.js.map