untitledui 0.1.56-beta.0 → 0.1.56-beta.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.
@@ -26,11 +26,11 @@ export const migration: MigrationDefinition = {
26
26
  toVersion: "8",
27
27
 
28
28
  classTransforms: [
29
- // Typo fix
29
+ // Typo fix: skeumorphic → skeuomorphic (handle all orderings)
30
30
  {
31
- pattern: /\bshadow-skeumorphic-xs\b/g,
32
- replace: "shadow-skeuomorphic-xs",
33
- description: "shadow-skeumorphic-xs → shadow-skeuomorphic-xs (typo fix)",
31
+ pattern: /\bshadow-xs-skeumorphic\b/g,
32
+ replace: "shadow-xs-skeuomorphic",
33
+ description: "shadow-xs-skeumorphic → shadow-xs-skeuomorphic (typo fix)",
34
34
  },
35
35
  {
36
36
  pattern: /\bshadow-skeumorphic\b/g,
@@ -200,11 +200,6 @@ export const migration: MigrationDefinition = {
200
200
  ],
201
201
 
202
202
  propTransforms: [
203
- {
204
- from: "placeholderIcon=",
205
- to: "icon=",
206
- description: "placeholderIcon prop renamed to icon",
207
- },
208
203
  {
209
204
  from: 'color="gray-blue"',
210
205
  to: 'color="slate"',
package/dist/index.mjs CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
2
- import{Command as m1}from"commander";import R from"chalk";import{Command as f0}from"commander";import*as s from"fs";import Ty from"ora";import*as d from"path";import Vy from"prompts";import{Project as c0}from"ts-morph";import*as t from"fs";import*as iy from"path";import D0 from"os";var G$=iy.join(D0.homedir(),".untitledui"),ay=iy.join(G$,"config.json");function b$(y=ay){if(!t.existsSync(y))return{};try{return JSON.parse(t.readFileSync(y,"utf-8"))}catch{return{}}}function Zy(y=ay){return b$(y).license||""}function Cy(y,$=G$,j=ay){if(!t.existsSync($))t.mkdirSync($,{recursive:!0});let z=b$(j);if(z.license!==y)z.license=y,t.writeFileSync(j,JSON.stringify(z,null,2),"utf-8")}import N0 from"node-fetch";var _$={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function uy(y,$,j){let Y=$.map((W)=>{if(W.includes("modals/"))if(W.includes("-modal"))return W;else return W+"-modal";return W});try{let W=await N0("https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/components",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({type:y,components:Y,key:j})});if(!W.ok)console.log(_$?.[W.statusText]||_$.no_components_found),process.exit(1);return await W.json()}catch(W){return null}}import oy from"node-fetch";var _y={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function w$(y,$=""){let j=`https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/components/list?key=${$}&type=${y}`;try{let z=await oy(j),Y=await z.json();if(!z.ok)console.log(_y?.[z.statusText]||_y.no_components_found),process.exit(1);if(!Y?.components?.length)return null;return Y}catch(z){return console.error(z),null}}async function D$(y,$="",j){let z=`https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/components/list?key=${$}&type=${y}&subfolders=${j.join(",")}`;try{let Y=await oy(z);if(!Y.ok)console.log(_y?.[Y.statusText]||_y.no_components_found),process.exit(1);let W=await Y.json();if(!W?.components?.length)return null;return W}catch(Y){return console.error(Y),null}}async function N$(y=""){let $=`https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/components/list?key=${y}`;try{let j=await oy($);if(!j.ok)console.log(_y?.[j.statusText]||_y.no_components_found),process.exit(1);let z=await j.json();if(!z?.types?.length)return null;return z}catch(j){return console.error(j),null}}import py from"fast-glob";import*as gy from"fs";import*as jy from"path";import{Project as v0}from"ts-morph";import{loadConfig as R$}from"tsconfig-paths";import A0 from"prettier";async function A$(y,$="typescript"){try{return await A0.format(y,{parser:$,printWidth:160,tabWidth:4})}catch(j){return console.error("Error formatting with Prettier:",j),y}}import e from"chalk";import Uy from"fast-glob";import*as $y from"fs";import*as yy from"path";import{loadConfig as ky}from"tsconfig-paths";import x$ from"fs";import x0 from"path";function E$(y=""){let $=x0.join(y,"package.json");if(!x$.existsSync($))return null;else return JSON.parse(x$.readFileSync($,"utf-8"))}import ny from"fs";import I$ from"path";import{createMatchPath as T$}from"tsconfig-paths";function S$(y,$){let j=I$.posix.join(y,"index"),z=(W)=>{try{return ny.existsSync(W)}catch{return!0}},Y=T$($.absoluteBaseUrl,$.paths)(j,void 0,z,[".ts",".tsx",".jsx",".js",".css"]);if(!Y)Y=T$($.absoluteBaseUrl,$.paths)(j,void 0,()=>!0,[".ts",".tsx",".jsx",".js",".css"]);if(Y){let W=Y.split("/").slice(0,-1).join("/");try{if(ny.existsSync(W)&&ny.statSync(W).isFile())return I$.dirname(W)}catch{}return W}else return}var m=["**/node_modules/**",".next","public","dist","build"],Oy=!1,v$={"next-app":"Next.js (App)","next-pages":"Next.js (Pages)",vite:"Vite",other:"Other"};async function Ly(y){let $=$y.existsSync(yy.resolve(y,"src")),j=$y.existsSync(yy.resolve(y,`${$?"src/":""}app`)),[z,Y,W,Z,X]=await Promise.all([Uy.glob("**/{next,vite,astro}.config.*|gatsby-config.*",{cwd:y,deep:2,ignore:m}),E0(y),T0(y),S0(y),E$(y)]),B=$y.existsSync(yy.resolve(y,"components.json")),V=null;if(B)V=JSON.parse($y.readFileSync(yy.resolve(y,"components.json"),"utf-8"));let q=Uy.sync(["**/**/theme.css"],{cwd:y,absolute:!0,onlyFiles:!0,ignore:m}),b=q?.[0]&&$y.readFileSync(q[0],"utf-8").match(/(--color-brand+-\d{1,3}):\s*(rgb\([^)]+\))/g)?.[1]||void 0,J={tailwind:{config:W||void 0,brandColor:b?.replace(/--color-([^-]+(?:-[^-]+)?)-\d+:.*/,"$1")||void 0},examples:V?.examples||void 0,aliases:V?.aliases||Z||{},paths:await I0(V?.aliases||{})||{},isTsx:Y,isSrcDir:$,isAppDir:j,isComponentsJson:!!B,framework:"other"};if(z.find((Q)=>Q.startsWith("next.config."))?.length)return J.framework=j?"next-app":"next-pages",J;else if(z.find((Q)=>Q.startsWith("vite.config."))?.length)return J.framework="vite",J;else if(Object.keys(X?.dependencies||{}).includes("react"))return J.framework="next-pages",J;else if(z?.length||$y.existsSync(yy.resolve(y,"package.json")))return J.framework="other",J;return null}async function E0(y){return(await Uy.glob("tsconfig.*",{cwd:y,deep:2,ignore:m})).length>0}async function I0(y){let $={},j=[],z=Object.entries(y).filter(([,B])=>B);if(z.length===0)return null;let Y=process.cwd(),Z=ky(Y).resultType==="success",X=await F$(Y);if(!X){if(!Oy){if(Oy=!0,process.stdout.write("\r\x1B[K"),Z)console.log(e.yellow(`
3
- ⚠ Could not resolve path aliases from components.json - no paths configured in tsconfig.json.`));else console.log(e.yellow(`
4
- ⚠ Could not resolve path aliases from components.json - tsconfig.json not found.`));console.log(e.dim(` The following aliases will be used for imports but files will be placed in default locations:
5
- `)),z.forEach(([B,V])=>{console.log(e.dim(` ${B}: ${V}`))}),console.log(e.dim(`
2
+ import{Command as r0}from"commander";import C from"chalk";import{Command as s1}from"commander";import*as i from"fs";import Sy from"ora";import*as h from"path";import Jy from"prompts";import{Project as r1}from"ts-morph";import*as jy from"fs";import*as py from"path";import I1 from"os";var N$=py.join(I1.homedir(),".untitledui"),ny=py.join(N$,"config.json");function w$(y=ny){if(!jy.existsSync(y))return{};try{return JSON.parse(jy.readFileSync(y,"utf-8"))}catch{return{}}}function My(y=ny){return w$(y).license||""}function Oy(y,$=N$,j=ny){if(!jy.existsSync($))jy.mkdirSync($,{recursive:!0});let z=w$(j);if(z.license!==y)z.license=y,jy.writeFileSync(j,JSON.stringify(z,null,2),"utf-8")}import T1 from"node-fetch";var A$={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function ky(y,$,j){let Y=$.map((W)=>{if(W.includes("modals/"))if(W.includes("-modal"))return W;else return W+"-modal";return W});try{let W=await T1("http://localhost:3000/react/api/components",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({type:y,components:Y,key:j})});if(!W.ok)console.log(A$?.[W.statusText]||A$.no_components_found),process.exit(1);return await W.json()}catch(W){return null}}import ty from"node-fetch";var Ny={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function x$(y,$=""){let j=`http://localhost:3000/react/api/components/list?key=${$}&type=${y}`;try{let z=await ty(j),Y=await z.json();if(!z.ok)console.log(Ny?.[z.statusText]||Ny.no_components_found),process.exit(1);if(!Y?.components?.length)return null;return Y}catch(z){return console.error(z),null}}async function E$(y,$="",j){let z=`http://localhost:3000/react/api/components/list?key=${$}&type=${y}&subfolders=${j.join(",")}`;try{let Y=await ty(z);if(!Y.ok)console.log(Ny?.[Y.statusText]||Ny.no_components_found),process.exit(1);let W=await Y.json();if(!W?.components?.length)return null;return W}catch(Y){return console.error(Y),null}}async function I$(y=""){let $=`http://localhost:3000/react/api/components/list?key=${y}`;try{let j=await ty($);if(!j.ok)console.log(Ny?.[j.statusText]||Ny.no_components_found),process.exit(1);let z=await j.json();if(!z?.types?.length)return null;return z}catch(j){return console.error(j),null}}import y$ from"fast-glob";import*as dy from"fs";import*as Wy from"path";import{Project as O1}from"ts-morph";import{loadConfig as k$}from"tsconfig-paths";import S1 from"prettier";async function T$(y,$="typescript"){try{return await S1.format(y,{parser:$,printWidth:160,tabWidth:4})}catch(j){return console.error("Error formatting with Prettier:",j),y}}import zy from"chalk";import Vy from"fast-glob";import*as Qy from"fs";import*as Yy from"path";import{loadConfig as Py}from"tsconfig-paths";import S$ from"fs";import v1 from"path";function v$(y=""){let $=v1.join(y,"package.json");if(!S$.existsSync($))return null;else return JSON.parse(S$.readFileSync($,"utf-8"))}import ey from"fs";import F$ from"path";import{createMatchPath as R$}from"tsconfig-paths";function C$(y,$){let j=F$.posix.join(y,"index"),z=(W)=>{try{return ey.existsSync(W)}catch{return!0}},Y=R$($.absoluteBaseUrl,$.paths)(j,void 0,z,[".ts",".tsx",".jsx",".js",".css"]);if(!Y)Y=R$($.absoluteBaseUrl,$.paths)(j,void 0,()=>!0,[".ts",".tsx",".jsx",".js",".css"]);if(Y){let W=Y.split("/").slice(0,-1).join("/");try{if(ey.existsSync(W)&&ey.statSync(W).isFile())return F$.dirname(W)}catch{}return W}else return}var l=["**/node_modules/**",".next","public","dist","build"],gy=!1,u$={"next-app":"Next.js (App)","next-pages":"Next.js (Pages)",vite:"Vite",other:"Other"};async function By(y){let $=Qy.existsSync(Yy.resolve(y,"src")),j=Qy.existsSync(Yy.resolve(y,`${$?"src/":""}app`)),[z,Y,W,Z,X]=await Promise.all([Vy.glob("**/{next,vite,astro}.config.*|gatsby-config.*",{cwd:y,deep:2,ignore:l}),F1(y),C1(y),u1(y),v$(y)]),L=Qy.existsSync(Yy.resolve(y,"components.json")),H=null;if(L)H=JSON.parse(Qy.readFileSync(Yy.resolve(y,"components.json"),"utf-8"));let B=Vy.sync(["**/**/theme.css"],{cwd:y,absolute:!0,onlyFiles:!0,ignore:l}),b=B?.[0]&&Qy.readFileSync(B[0],"utf-8").match(/(--color-brand+-\d{1,3}):\s*(rgb\([^)]+\))/g)?.[1]||void 0,q={tailwind:{config:W||void 0,brandColor:b?.replace(/--color-([^-]+(?:-[^-]+)?)-\d+:.*/,"$1")||void 0},examples:H?.examples||void 0,aliases:H?.aliases||Z||{},paths:await R1(H?.aliases||{})||{},isTsx:Y,isSrcDir:$,isAppDir:j,isComponentsJson:!!L,framework:"other"};if(z.find((Q)=>Q.startsWith("next.config."))?.length)return q.framework=j?"next-app":"next-pages",q;else if(z.find((Q)=>Q.startsWith("vite.config."))?.length)return q.framework="vite",q;else if(Object.keys(X?.dependencies||{}).includes("react"))return q.framework="next-pages",q;else if(z?.length||Qy.existsSync(Yy.resolve(y,"package.json")))return q.framework="other",q;return null}async function F1(y){return(await Vy.glob("tsconfig.*",{cwd:y,deep:2,ignore:l})).length>0}async function R1(y){let $={},j=[],z=Object.entries(y).filter(([,L])=>L);if(z.length===0)return null;let Y=process.cwd(),Z=Py(Y).resultType==="success",X=await O$(Y);if(!X){if(!gy){if(gy=!0,process.stdout.write("\r\x1B[K"),Z)console.log(zy.yellow(`
3
+ ⚠ Could not resolve path aliases from components.json - no paths configured in tsconfig.json.`));else console.log(zy.yellow(`
4
+ ⚠ Could not resolve path aliases from components.json - tsconfig.json not found.`));console.log(zy.dim(` The following aliases will be used for imports but files will be placed in default locations:
5
+ `)),z.forEach(([L,H])=>{console.log(zy.dim(` ${L}: ${H}`))}),console.log(zy.dim(`
6
6
  To fix this, add matching paths to your tsconfig.json.
7
- `))}return null}for(let[B,V]of Object.entries(y))if(V){let q=await S$(V.replace(/\/\*$/,""),X);if(q)$[B]=yy.relative(process.cwd(),q);else j.push(`${B}: ${V}`)}if(j.length>0&&!Oy)Oy=!0,process.stdout.write("\r\x1B[K"),console.log(e.yellow(`
8
- ⚠ Could not resolve the following path aliases from tsconfig.json:`)),j.forEach((B)=>{console.log(e.dim(` ${B}`))}),console.log(e.dim(`
9
- These aliases will be used for imports but files will be placed in default locations.`)),console.log(e.dim(` To fix this, add matching paths to your tsconfig.json.
10
- `));return $}async function F$(y){let[$,j]=await Promise.all([Uy.glob("next.config.*",{cwd:y,deep:1,ignore:m}),Uy.glob("vite.config.*",{cwd:y,deep:1,ignore:m})]),z=$.length>0,Y=j.length>0,W=null;if(z)W=ky(y);else if(Y){if(W=ky(y),W?.resultType==="failed"||!Object.keys(W.paths||{}).length){let Z=await Uy.glob(["tsconfig.app.*","*/tsconfig.app.*"],{cwd:y,deep:1,onlyFiles:!0,absolute:!0,ignore:m}),[X]=Z;if(X)try{let V=function(J){return J.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/,(\s*[}\]])/g,"$1")},B=$y.readFileSync(X,"utf-8"),q=V(B),b=JSON.parse(q);if(b.compilerOptions?.paths)W={resultType:"success",paths:b?.compilerOptions?.paths,baseUrl:b.compilerOptions.baseUrl||".",configFileAbsolutePath:X,absoluteBaseUrl:yy.resolve(y,b.compilerOptions.baseUrl||".")}}catch{}}}else W=ky(y);if(!W||W?.resultType==="failed"||!Object.keys(W.paths).length)return null;return W}async function T0(y){let $=await Uy.glob("tailwind.config.*",{cwd:y,deep:2,ignore:m});if(!$.length)return null;return $[0]}async function S0(y){let $=await F$(y);if(!$)return null;let j={},z={app:/\/?app\/\*$/,components:/\/?components\/\*$/,utils:/\/?utils\/\*$/,styles:/\/?styles\/\*$/,hooks:/\/?hooks\/\*$/,src:/^(\.\/src\/\*|\.\/\*|\/src\/\*|src\/\*|\/\*|\*)$/};for(let[Y,W]of Object.entries($.paths)){let Z=Y.replace(/\/\*$/,"/");for(let[X,B]of Object.entries(z))if(W.some((V)=>B.test(V))){j[X]=Z;break}}return j||null}function wy(y,$){let j=R$(y),z=py.sync(["tailwind.config.*","**/globals.css","package.json"],{cwd:y,deep:4,absolute:!0,onlyFiles:!0,ignore:m}),Y=py.sync("**/{layout,_app,main}.tsx",{cwd:$?jy.posix.join(y,$):y,deep:4,absolute:!0,onlyFiles:!0,ignore:m});return{tailwindFile:z.find((Z)=>Z.includes("tailwind.config.")),cssFile:z.find((Z)=>Z.includes("globals.css")),packageJson:z.find((Z)=>Z.includes("package.json")),tsConfig:j?.resultType==="success"?j?.configFileAbsolutePath:void 0,layoutFile:Y.find((Z)=>Z.includes("layout")),appFile:Y.find((Z)=>Z.includes("_app")),mainFile:Y.find((Z)=>Z.includes("main"))}}function Dy(y,$,j={}){if(y.startsWith("@/components/")){if(j?.components)return y.replace(/^@\/components\//,jy.posix.join(j.components,"/"));if($)return y.replace(/^@\/components\//,jy.posix.join("@",$,"/"))}if(y.startsWith("@/app/")&&j?.app)return y.replace(/^@\/app\//,jy.posix.join(j.app,"/"));if(y.startsWith("@/utils/")&&j?.utils)return y.replace(/^@\/utils\//,jy.posix.join(j.utils,"/"));if(y.startsWith("@/hooks/")&&j?.hooks)return y.replace(/^@\/hooks\//,jy.posix.join(j.hooks,"/"));if(y.startsWith("@/styles/")&&j?.styles)return y.replace(/^@\/styles\//,jy.posix.join(j.styles,"/"));if(y.startsWith("@/")&&j?.src)return y.replace(/^@\//,jy.posix.join(j.src,"/"));return y}async function C$(y,$,j="@/*"){let z=await R$(y);if(z?.resultType==="failed")return null;let Y={};if(!Object.keys(z.paths).length){z.paths={[j]:[`./${$?"src/":""}*`]},Y.src=j.replace(/\/\*$/,"");let W=await gy.promises.readFile(z.configFileAbsolutePath,"utf-8"),Z,X=/(?:\/\/\s*)?"paths":\s*\{(?:[^{}]|\{[^}]*\})*\}/;if(!X.test(W))Z=W.replace(/"compilerOptions":\s*{/,`"compilerOptions": {
11
- "paths": ${JSON.stringify(z.paths)},`);else Z=W.replace(X,`"paths": ${JSON.stringify(z.paths)}`);let V=new v0,q=await A$(Z,"json");return V.createSourceFile(z.configFileAbsolutePath,q,{overwrite:!0}),await V.save(),Y}return Y||null}function u$(y){let $=py.sync(["vite.config.*"],{cwd:y,absolute:!0,onlyFiles:!0,ignore:m})?.[0];if(!$)return!1;try{let j=gy.readFileSync($,"utf-8");return F0(j)}catch{return!1}}function F0(y){let $=y.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"");if(!["tailwindcss","@tailwindcss/vite","tailwind("].some((W)=>$.includes(W)))return!1;return["plugins:","postcss:","css:"].some((W)=>$.includes(W))}var R0=["npm","config","user","agent"].join("_");function My(y){if(y===void 0)y=process.env[R0]||"";if(y.startsWith("yarn"))return"yarn";if(y.startsWith("pnpm"))return"pnpm";if(y.startsWith("bun"))return"bun";return"npm"}function zy(){switch(My()){case"yarn":return"yarn";case"pnpm":return"pnpx";case"bun":return"bunx";default:return"npx"}}function O$(){switch(My()){case"yarn":return"yarn dev";case"pnpm":return"pnpm dev";case"bun":return"bun dev";default:return"npm run dev"}}import C0 from"async-retry";import{execa as k$}from"execa";async function Yy(y,$){let j=Array.isArray(y)?y:Array.from(y);if(!j.length)return;let{cwd:z,dev:Y=!1,spinner:W,label:Z=Y?"devDependencies":"dependencies"}=$,X=My(),V=[X==="npm"?"install":"add",...Y?["-D"]:[],...j];W.start(`Installing ${Z}`),await C0(()=>k$(X,V,{cwd:z}).catch(async(q)=>{if(q.message.includes("peer"))W.warn(`${Z} conflict detected. Retrying with --legacy-peer-deps...`),W.start(`Installing ${Z} with --legacy-peer-deps flag`),await k$(X,[...V,"--legacy-peer-deps"],{cwd:z});else throw q}),{retries:1}),W.succeed(`${Z} installed`)}var g=(y)=>{if(y.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
12
- `),process.exit(1)};function Py(y){return y.replace(/^[ \t]*\/\/\s*(TODO:|collapse-(start|end)).*\r?\n?|[ \t]*{\s*\/\*\s*(TODO:|collapse-(start|end)).*?\*\/\s*}\r?\n?/gm,"")}import Qy from"path";function dy(y,$,j){let z=y.replace(/^(components|utils|hooks|styles)\//,"");if(y.includes("components")&&$?.components)return Qy.relative(process.cwd(),Qy.posix.join($.components,z));if(y.includes("utils")&&$?.utils)return Qy.relative(process.cwd(),Qy.posix.join($.utils,z));if(y.includes("hooks")&&$?.hooks)return Qy.relative(process.cwd(),Qy.posix.join($.hooks,z));if(y.includes("styles")&&$?.styles)return Qy.relative(process.cwd(),Qy.posix.join($.styles,z));return Qy.posix.join(j?"src":"",y)}import g$ from"node-fetch";import{Readable as u0,pipeline as O0}from"stream";import{x as k0}from"tar";import{promisify as g0}from"util";var P0=g0(O0);async function P$(y,$){try{let j=await d0($);await P0(j,k0({cwd:y,strip:1}))}catch(j){throw Error(`Failed to download or extract repository from API: ${j instanceof Error?j.message:j}`)}}async function d0(y){let $=`https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/download-repo?template=${y.template}`;try{let j=await g$($,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/octet-stream"}});if(j.status===403||j.status===404)throw Error("Repository not found");if(!j.ok)throw Error(`Failed to download from API. Status: ${j.status} ${j.statusText}`);if(!j.body)throw Error("Response body is empty");return u0.from(j.body)}catch(j){throw Error(`Error downloading tarball: ${j instanceof Error?j.message:j}`)}}async function d$(y){let $=`https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/validate-key?key=${y}`;try{return(await g$($)).status===200}catch{return!1}}async function fy(y,$){if(!await d$(y))$.fail("Invalid license key"),process.exit(1);Cy(y)}var G={components:[],path:"",type:void 0,license:Zy()},f$=new f0().name("add").description("add a component to your project").argument("[components...]","the components to add").option("-a, --all","add all available components",!1).option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the component to.").option("-d, --dir <directory>","the directory where the project is located.").option("-t, --type <base|marketing|shared-assets|application|foundations>","the type of the component to add.").option("--include-all-components","automatically include all base components without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(y,$)=>{if(y)G.components=y;if($){if(G.all=$.all,G.dir=$.dir,G.path=$.path,G.overwrite=$.overwrite,G.includeAllComponents=$.includeAllComponents,G.license=$.license||G.license,G.yes=$.yes,$.yes)G.includeAllComponents=!0,G.overwrite=!0}try{await ty(G)}catch(j){console.error(R.red(j))}});async function ty(y){if(y)G={...G,...y};let $=Ty().start(),j=d.posix.join(process.cwd(),G.dir||"");if(!s.existsSync(d.resolve(j,"package.json")))$.warn("This command should be run in a project directory."),process.exit(1);let Y=await Ly(j);if(G.license)await fy(G.license,$);$.stop();let W=[];if(G.components.length){let Q=await uy(G.type,G.components,G.license);if(Q&&Q.pro&&Q.pro.length>0){if(console.log(),Q.pro.length===1){let U=Q.pro[0]?.split("/")[1]||Q.pro[0];console.log(R.yellow(`\uD83D\uDD12 The ${R.cyan(U)} component requires PRO access.`))}else console.log(R.yellow("\uD83D\uDD12 The following components require PRO access:")),Q.pro.forEach((U)=>{let D=U?.split("/")[1]||U;console.log(` • ${R.cyan(D)}`)});console.log(),console.log("To access PRO components:"),console.log(` ${R.green("→")} If you've already purchased: ${R.cyan(`${zy()} untitledui@latest login`)}`),console.log(` ${R.green("→")} To purchase PRO components: ${R.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(!Q?.components.length)console.log("No components found"),process.exit(1);W.push(...Q.components)}if(!G?.type&&!G?.components.length){if(G.yes)console.log(R.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await N$(G.license);if(!Q)console.log("No component types found"),process.exit(1);let U=await Vy({type:"select",name:"type",onState:g,message:`What type of ${R.cyan("component")} are you adding?`,choices:Q?.types.map((D)=>({title:D,value:D}))});G.type=U.type}if(!G?.path&&!Y?.paths?.components)if(G.yes)G.path="components";else{let Q=await Vy({type:"text",name:"path",onState:g,message:`Where would you like to add the ${R.cyan("components")}?`,initial:"components"});G.path=Q.path}if(G?.path&&Y&&Y.paths)Y.paths.components=d.posix.join(Y?.isSrcDir?"src":"",G.path);if(Y&&!Object.keys(Y?.aliases).length){let Q="@/*";if(!G.yes){let U=/^[^*"]+\/\*\s*$/;Q=(await Vy({type:"text",name:"aliasPrefix",onState:g,initial:"@/*",message:`What is the ${R.cyan("import alias")} for your project?`,validate:(w)=>U.test(w)?!0:"Import alias must follow the pattern <prefix>/*"}))?.aliasPrefix}Y.aliases=await C$(j,Y?.isSrcDir,Q)}if(!G?.components.length){if(G.yes)console.log(R.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await w$(G?.type,G.license);if(!Q)console.log("No components found"),process.exit(1);let U=await Vy({type:"multiselect",name:"components",onState:g,message:`Which ${R.cyan("components")} would you like to add?`,choices:Q?.components?.map((I)=>({title:I?.name+(I?.count?` (${I?.count} variants)`:"")||"example",value:I||"example",selected:G.components.includes(I.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!U.components||!U.components.length)console.log("No option selected. Exiting..."),process.exit(1);let D=U.components.filter((I)=>I?.type==="file").map((I)=>I.name),w=U.components.filter((I)=>I?.type==="dir").map((I)=>I.name),E=[];if(w.length){let I=await D$(G?.type,G.license,w);if(I&&I.components.length)for(let S of I.components){let[v,M]=Object.entries(S)[0]||[],L=await Vy({type:"select",name:"component",onState:g,message:`Which ${R.cyan("variant")} from ${R.cyan(v)} would you like to add?`,choices:M?.map((K)=>({title:K?.name.replace(/-modal/g,"")||"example",value:K?.name||"example",selected:G.components.includes(K.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!L.component)console.log("No variant selected for "+R.cyan(v));E.push(v+"/"+L.component)}else console.log("No variants found")}G.components=[...E,...D]}if(!G.components?.length)$.warn("No components selected. Exiting."),process.exit(1);let Z=wy(j),X=new Set,B=new Set,V=new Set,q=new c0({tsConfigFilePath:Z?.tsConfig});if($.start(),G.type&&G.components.length){let Q=await uy(G.type,G.components,G.license);if(!Q?.components.length)console.log("No components found"),process.exit(1);W.push(...Q.components)}let b=new Set;if(W.forEach((Q)=>{Q?.components?.forEach((U)=>{b.add({name:U.name,path:U.path})})}),$.stop(),b.size){let Q=Array.from(b).filter((U)=>!s.existsSync(d.posix.join(j,`${Y?.isSrcDir?"src":""}`,U?.path?.replace(/components\//,G.path+"/"))));if(Q?.length)if(G.includeAllComponents)G.baseComponents=Q.map((U)=>U.name);else{let U=await Vy({type:"multiselect",name:"baseComponents",onState:g,message:"Select which base components you want to add",choices:Q.map((D)=>({title:D?.name,value:D?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(G.baseComponents=U.baseComponents,!Q.length&&!U.baseComponents?.length)$.warn("No components selected")}}if($.start(),G?.baseComponents?.length){let Q=await uy("",G.baseComponents,G.license);if(!Q||!Q?.components.length)console.log("No base components found");else W.push(...Q.components)}$.stop();let J=new Set;for(let Q of W){let U=Ty(`Adding ${Q.name}...`).start(),D=Q.files;Q?.dependencies?.forEach((E)=>B.add(E)),Q?.devDependencies?.forEach((E)=>V.add(E));let w=!1;try{for(let{path:E,code:I}of D||[]){let S=d.posix.join(j,dy(E,Y?.paths,Y?.isSrcDir)),v=Y?.framework==="vite"?I.replace(`"use client";
13
-
14
- `,""):I,M=Py(v),L=d.dirname(S);if(s.existsSync(S)&&!G.overwrite&&!J.has(S)){if(s.readFileSync(S,"utf-8")!==M)X.add({code:M,path:S}),w=!0}else if(!J.has(S)){let K=L.split(d.sep),_="";for(let T of K)if(_=_?d.join(_,T):T,_&&s.existsSync(_)&&s.statSync(_).isFile())throw Error(`Cannot create directory '${L}' because '${_}' is an existing file.
15
- Please check your path aliases in components.json and tsconfig.json.`);s.mkdirSync(L,{recursive:!0}),s.writeFileSync(S,M),J.add(S);let x=q.getSourceFile(d.resolve(S));if(x)x.replaceWithText(M);else x=q.addSourceFileAtPath(d.resolve(S));x.getImportDeclarations().forEach((T)=>{let f=T.getModuleSpecifierValue();T.setModuleSpecifier(Dy(f,G.path,Y?.aliases))}),await x.save()}}if(w)U.warn(`Some files of ${R.yellow(Q.name)} already exist`);else U.succeed(`${R.green(Q.name)} is added successfully`)}catch(E){U.fail(`
16
- Failed to add the component ${R.red(Q.name)}`),console.error(R.red(E)),process.exit(1)}}if(X.size&&!G?.overwrite){console.log(`
17
- Following files already exist in the directory.`),X.forEach((U)=>{console.log(R.green(`- ${d.relative(j,U.path)}`))});let Q=!1;if(G.yes)Q=!0;else{let U=await Vy({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0});if(U.overwrite===void 0)console.log(`
18
- Use ${R.cyan("--overwrite")} or ${R.cyan("-o")} flag to overwrite existing files, or run with ${R.cyan("node")} instead of ${R.cyan("bun")}.`),process.exit(1);Q=U.overwrite}if(Q){let U=Ty("Overwriting files").start();X.forEach((D)=>{let w=q.addSourceFileAtPath(d.resolve(D.path));w.replaceWithText(D.code),w.getImportDeclarations().forEach((E)=>{let I=E.getModuleSpecifierValue();E.setModuleSpecifier(Dy(I,G.path,Y?.aliases))}),w.saveSync()}),U.succeed("Files are overwritten")}}if(B.size){let Q=Ty().start();await Yy(B,{cwd:j,spinner:Q,label:"component dependencies"})}if(V.size){let Q=Ty().start();await Yy(V,{cwd:j,dev:!0,spinner:Q,label:"component devDependencies"})}if(G.message!==void 0){if(G.message)console.log(G.message);return}process.exit(0)}import $$ from"chalk";import{Command as s0}from"commander";import*as Wy from"fs";import r0 from"http";import i0 from"open";import a0 from"ora";import o0 from"os";import*as z$ from"path";import{URL as n0}from"url";import*as cy from"fs";import*as Hy from"path";import{fileURLToPath as h0}from"url";var m0=h0(import.meta.url),ey=Hy.dirname(m0);function l0(){let y=[Hy.join(ey,"..","templates","auth-template.html"),Hy.join(ey,"templates","auth-template.html"),Hy.join(process.cwd(),"node_modules","untitledui","templates","auth-template.html"),Hy.join(ey,"..","..","templates","auth-template.html")];for(let $ of y)if(cy.existsSync($))return $;throw Error("Auth template file not found. Please ensure the CLI package is properly installed.")}function c$(){try{let y=l0();return cy.readFileSync(y,"utf-8")}catch(y){return console.warn("Warning: Using fallback auth template. Some styling may be missing."),`<!doctype html>
7
+ `))}return null}for(let[L,H]of Object.entries(y))if(H){let B=await C$(H.replace(/\/\*$/,""),X);if(B)$[L]=Yy.relative(process.cwd(),B);else j.push(`${L}: ${H}`)}if(j.length>0&&!gy)gy=!0,process.stdout.write("\r\x1B[K"),console.log(zy.yellow(`
8
+ ⚠ Could not resolve the following path aliases from tsconfig.json:`)),j.forEach((L)=>{console.log(zy.dim(` ${L}`))}),console.log(zy.dim(`
9
+ These aliases will be used for imports but files will be placed in default locations.`)),console.log(zy.dim(` To fix this, add matching paths to your tsconfig.json.
10
+ `));return $}async function O$(y){let[$,j]=await Promise.all([Vy.glob("next.config.*",{cwd:y,deep:1,ignore:l}),Vy.glob("vite.config.*",{cwd:y,deep:1,ignore:l})]),z=$.length>0,Y=j.length>0,W=null;if(z)W=Py(y);else if(Y){if(W=Py(y),W?.resultType==="failed"||!Object.keys(W.paths||{}).length){let Z=await Vy.glob(["tsconfig.app.*","*/tsconfig.app.*"],{cwd:y,deep:1,onlyFiles:!0,absolute:!0,ignore:l}),[X]=Z;if(X)try{let H=function(q){return q.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/,(\s*[}\]])/g,"$1")},L=Qy.readFileSync(X,"utf-8"),B=H(L),b=JSON.parse(B);if(b.compilerOptions?.paths)W={resultType:"success",paths:b?.compilerOptions?.paths,baseUrl:b.compilerOptions.baseUrl||".",configFileAbsolutePath:X,absoluteBaseUrl:Yy.resolve(y,b.compilerOptions.baseUrl||".")}}catch{}}}else W=Py(y);if(!W||W?.resultType==="failed"||!Object.keys(W.paths).length)return null;return W}async function C1(y){let $=await Vy.glob("tailwind.config.*",{cwd:y,deep:2,ignore:l});if(!$.length)return null;return $[0]}async function u1(y){let $=await O$(y);if(!$)return null;let j={},z={app:/\/?app\/\*$/,components:/\/?components\/\*$/,utils:/\/?utils\/\*$/,styles:/\/?styles\/\*$/,hooks:/\/?hooks\/\*$/,src:/^(\.\/src\/\*|\.\/\*|\/src\/\*|src\/\*|\/\*|\*)$/};for(let[Y,W]of Object.entries($.paths)){let Z=Y.replace(/\/\*$/,"/");for(let[X,L]of Object.entries(z))if(W.some((H)=>L.test(H))){j[X]=Z;break}}return j||null}function wy(y,$){let j=k$(y),z=y$.sync(["tailwind.config.*","**/globals.css","package.json"],{cwd:y,deep:4,absolute:!0,onlyFiles:!0,ignore:l}),Y=y$.sync("**/{layout,_app,main}.tsx",{cwd:$?Wy.posix.join(y,$):y,deep:4,absolute:!0,onlyFiles:!0,ignore:l});return{tailwindFile:z.find((Z)=>Z.includes("tailwind.config.")),cssFile:z.find((Z)=>Z.includes("globals.css")),packageJson:z.find((Z)=>Z.includes("package.json")),tsConfig:j?.resultType==="success"?j?.configFileAbsolutePath:void 0,layoutFile:Y.find((Z)=>Z.includes("layout")),appFile:Y.find((Z)=>Z.includes("_app")),mainFile:Y.find((Z)=>Z.includes("main"))}}function Ay(y,$,j={}){if(y.startsWith("@/components/")){if(j?.components)return y.replace(/^@\/components\//,Wy.posix.join(j.components,"/"));if($)return y.replace(/^@\/components\//,Wy.posix.join("@",$,"/"))}if(y.startsWith("@/app/")&&j?.app)return y.replace(/^@\/app\//,Wy.posix.join(j.app,"/"));if(y.startsWith("@/utils/")&&j?.utils)return y.replace(/^@\/utils\//,Wy.posix.join(j.utils,"/"));if(y.startsWith("@/hooks/")&&j?.hooks)return y.replace(/^@\/hooks\//,Wy.posix.join(j.hooks,"/"));if(y.startsWith("@/styles/")&&j?.styles)return y.replace(/^@\/styles\//,Wy.posix.join(j.styles,"/"));if(y.startsWith("@/")&&j?.src)return y.replace(/^@\//,Wy.posix.join(j.src,"/"));return y}async function g$(y,$,j="@/*"){let z=await k$(y);if(z?.resultType==="failed")return null;let Y={};if(!Object.keys(z.paths).length){z.paths={[j]:[`./${$?"src/":""}*`]},Y.src=j.replace(/\/\*$/,"");let W=await dy.promises.readFile(z.configFileAbsolutePath,"utf-8"),Z,X=/(?:\/\/\s*)?"paths":\s*\{(?:[^{}]|\{[^}]*\})*\}/;if(!X.test(W))Z=W.replace(/"compilerOptions":\s*{/,`"compilerOptions": {
11
+ "paths": ${JSON.stringify(z.paths)},`);else Z=W.replace(X,`"paths": ${JSON.stringify(z.paths)}`);let H=new O1,B=await T$(Z,"json");return H.createSourceFile(z.configFileAbsolutePath,B,{overwrite:!0}),await H.save(),Y}return Y||null}function P$(y){let $=y$.sync(["vite.config.*"],{cwd:y,absolute:!0,onlyFiles:!0,ignore:l})?.[0];if(!$)return!1;try{let j=dy.readFileSync($,"utf-8");return k1(j)}catch{return!1}}function k1(y){let $=y.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"");if(!["tailwindcss","@tailwindcss/vite","tailwind("].some((W)=>$.includes(W)))return!1;return["plugins:","postcss:","css:"].some((W)=>$.includes(W))}var g1=["npm","config","user","agent"].join("_");function qy(y){if(y===void 0)y=process.env[g1]||"";if(y.startsWith("yarn"))return"yarn";if(y.startsWith("pnpm"))return"pnpm";if(y.startsWith("bun"))return"bun";return"npm"}function Zy(){switch(qy()){case"yarn":return"yarn";case"pnpm":return"pnpx";case"bun":return"bunx";default:return"npx"}}function d$(){switch(qy()){case"yarn":return"yarn dev";case"pnpm":return"pnpm dev";case"bun":return"bun dev";default:return"npm run dev"}}import P1 from"async-retry";import{execa as f$}from"execa";async function Uy(y,$){let j=Array.isArray(y)?y:Array.from(y);if(!j.length)return;let{cwd:z,dev:Y=!1,spinner:W,label:Z=Y?"devDependencies":"dependencies"}=$,X=qy(),H=[X==="npm"?"install":"add",...Y?["-D"]:[],...j];W.start(`Installing ${Z}`),await P1(()=>f$(X,H,{cwd:z}).catch(async(B)=>{if(B.message.includes("peer"))W.warn(`${Z} conflict detected. Retrying with --legacy-peer-deps...`),W.start(`Installing ${Z} with --legacy-peer-deps flag`),await f$(X,[...H,"--legacy-peer-deps"],{cwd:z});else throw B}),{retries:1}),W.succeed(`${Z} installed`)}var f=(y)=>{if(y.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
12
+ `),process.exit(1)};function fy(y){return y.replace(/^[ \t]*\/\/\s*(TODO:|collapse-(start|end)).*\r?\n?|[ \t]*{\s*\/\*\s*(TODO:|collapse-(start|end)).*?\*\/\s*}\r?\n?/gm,"")}import Xy from"path";function cy(y,$,j){let z=y.replace(/^(components|utils|hooks|styles)\//,"");if(y.includes("components")&&$?.components)return Xy.relative(process.cwd(),Xy.posix.join($.components,z));if(y.includes("utils")&&$?.utils)return Xy.relative(process.cwd(),Xy.posix.join($.utils,z));if(y.includes("hooks")&&$?.hooks)return Xy.relative(process.cwd(),Xy.posix.join($.hooks,z));if(y.includes("styles")&&$?.styles)return Xy.relative(process.cwd(),Xy.posix.join($.styles,z));return Xy.posix.join(j?"src":"",y)}import c$ from"node-fetch";import{Readable as d1,pipeline as f1}from"stream";import{x as c1}from"tar";import{promisify as h1}from"util";var m1=h1(f1);async function h$(y,$){try{let j=await l1($);await m1(j,c1({cwd:y,strip:1}))}catch(j){throw Error(`Failed to download or extract repository from API: ${j instanceof Error?j.message:j}`)}}async function l1(y){let $=`http://localhost:3000/react/api/download-repo?template=${y.template}`;try{let j=await c$($,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/octet-stream"}});if(j.status===403||j.status===404)throw Error("Repository not found");if(!j.ok)throw Error(`Failed to download from API. Status: ${j.status} ${j.statusText}`);if(!j.body)throw Error("Response body is empty");return d1.from(j.body)}catch(j){throw Error(`Error downloading tarball: ${j instanceof Error?j.message:j}`)}}async function m$(y){let $=`http://localhost:3000/react/api/validate-key?key=${y}`;try{return(await c$($)).status===200}catch{return!1}}async function hy(y,$){if(!await m$(y))$.fail("Invalid license key"),process.exit(1);Oy(y)}var G={components:[],path:"",type:void 0,license:My()},l$=new s1().name("add").description("add a component to your project").argument("[components...]","the components to add").option("-a, --all","add all available components",!1).option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the component to.").option("-d, --dir <directory>","the directory where the project is located.").option("-t, --type <base|marketing|shared-assets|application|foundations>","the type of the component to add.").option("--include-all-components","automatically include all base components without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(y,$)=>{if(y)G.components=y;if($){if(G.all=$.all,G.dir=$.dir,G.path=$.path,G.overwrite=$.overwrite,G.includeAllComponents=$.includeAllComponents,G.license=$.license||G.license,G.yes=$.yes,$.yes)G.includeAllComponents=!0,G.overwrite=!0}try{await $$(G)}catch(j){console.error(C.red(j))}});async function $$(y){if(y)G={...G,...y};let $=Sy().start(),j=h.posix.join(process.cwd(),G.dir||"");if(!i.existsSync(h.resolve(j,"package.json")))$.warn("This command should be run in a project directory."),process.exit(1);let Y=await By(j);if(G.license)await hy(G.license,$);$.stop();let W=[];if(G.components.length){let Q=await ky(G.type,G.components,G.license);if(Q&&Q.pro&&Q.pro.length>0){if(console.log(),Q.pro.length===1){let U=Q.pro[0]?.split("/")[1]||Q.pro[0];console.log(C.yellow(`\uD83D\uDD12 The ${C.cyan(U)} component requires PRO access.`))}else console.log(C.yellow("\uD83D\uDD12 The following components require PRO access:")),Q.pro.forEach((U)=>{let D=U?.split("/")[1]||U;console.log(` • ${C.cyan(D)}`)});console.log(),console.log("To access PRO components:"),console.log(` ${C.green("→")} If you've already purchased: ${C.cyan(`${Zy()} untitledui@latest login`)}`),console.log(` ${C.green("→")} To purchase PRO components: ${C.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(!Q?.components.length)console.log("No components found"),process.exit(1);W.push(...Q.components)}if(!G?.type&&!G?.components.length){if(G.yes)console.log(C.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await I$(G.license);if(!Q)console.log("No component types found"),process.exit(1);let U=await Jy({type:"select",name:"type",onState:f,message:`What type of ${C.cyan("component")} are you adding?`,choices:Q?.types.map((D)=>({title:D,value:D}))});G.type=U.type}if(!G?.path&&!Y?.paths?.components)if(G.yes)G.path="components";else{let Q=await Jy({type:"text",name:"path",onState:f,message:`Where would you like to add the ${C.cyan("components")}?`,initial:"components"});G.path=Q.path}if(G?.path&&Y&&Y.paths)Y.paths.components=h.posix.join(Y?.isSrcDir?"src":"",G.path);if(Y&&!Object.keys(Y?.aliases).length){let Q="@/*";if(!G.yes){let U=/^[^*"]+\/\*\s*$/;Q=(await Jy({type:"text",name:"aliasPrefix",onState:f,initial:"@/*",message:`What is the ${C.cyan("import alias")} for your project?`,validate:(_)=>U.test(_)?!0:"Import alias must follow the pattern <prefix>/*"}))?.aliasPrefix}Y.aliases=await g$(j,Y?.isSrcDir,Q)}if(!G?.components.length){if(G.yes)console.log(C.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await x$(G?.type,G.license);if(!Q)console.log("No components found"),process.exit(1);let U=await Jy({type:"multiselect",name:"components",onState:f,message:`Which ${C.cyan("components")} would you like to add?`,choices:Q?.components?.map((E)=>({title:E?.name+(E?.count?` (${E?.count} variants)`:"")||"example",value:E||"example",selected:G.components.includes(E.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!U.components||!U.components.length)console.log("No option selected. Exiting..."),process.exit(1);let D=U.components.filter((E)=>E?.type==="file").map((E)=>E.name),_=U.components.filter((E)=>E?.type==="dir").map((E)=>E.name),x=[];if(_.length){let E=await E$(G?.type,G.license,_);if(E&&E.components.length)for(let S of E.components){let[F,I]=Object.entries(S)[0]||[],T=await Jy({type:"select",name:"component",onState:f,message:`Which ${C.cyan("variant")} from ${C.cyan(F)} would you like to add?`,choices:I?.map((R)=>({title:R?.name.replace(/-modal/g,"")||"example",value:R?.name||"example",selected:G.components.includes(R.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!T.component)console.log("No variant selected for "+C.cyan(F));x.push(F+"/"+T.component)}else console.log("No variants found")}G.components=[...x,...D]}if(!G.components?.length)$.warn("No components selected. Exiting."),process.exit(1);let Z=wy(j),X=new Set,L=new Set,H=new Set,B=new r1({tsConfigFilePath:Z?.tsConfig});if($.start(),G.type&&G.components.length){let Q=await ky(G.type,G.components,G.license);if(!Q?.components.length)console.log("No components found"),process.exit(1);W.push(...Q.components)}let b=new Set;if(W.forEach((Q)=>{Q?.components?.forEach((U)=>{b.add({name:U.name,path:U.path})})}),$.stop(),b.size){let Q=Array.from(b).filter((U)=>!i.existsSync(h.posix.join(j,`${Y?.isSrcDir?"src":""}`,U?.path?.replace(/components\//,G.path+"/"))));if(Q?.length)if(G.includeAllComponents)G.baseComponents=Q.map((U)=>U.name);else{let U=await Jy({type:"multiselect",name:"baseComponents",onState:f,message:"Select which base components you want to add",choices:Q.map((D)=>({title:D?.name,value:D?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(G.baseComponents=U.baseComponents,!Q.length&&!U.baseComponents?.length)$.warn("No components selected")}}if($.start(),G?.baseComponents?.length){let Q=await ky("",G.baseComponents,G.license);if(!Q||!Q?.components.length)console.log("No base components found");else W.push(...Q.components)}$.stop();let q=new Set;for(let Q of W){let U=Sy(`Adding ${Q.name}...`).start(),D=Q.files;Q?.dependencies?.forEach((x)=>L.add(x)),Q?.devDependencies?.forEach((x)=>H.add(x));let _=!1;try{for(let{path:x,code:E}of D||[]){let S=h.posix.join(j,cy(x,Y?.paths,Y?.isSrcDir)),F=Y?.framework==="vite"?E.replace(`"use client";
13
+
14
+ `,""):E,I=fy(F),T=h.dirname(S);if(i.existsSync(S)&&!G.overwrite&&!q.has(S)){if(i.readFileSync(S,"utf-8")!==I)X.add({code:I,path:S}),_=!0}else if(!q.has(S)){let R=T.split(h.sep),M="";for(let J of R)if(M=M?h.join(M,J):J,M&&i.existsSync(M)&&i.statSync(M).isFile())throw Error(`Cannot create directory '${T}' because '${M}' is an existing file.
15
+ Please check your path aliases in components.json and tsconfig.json.`);i.mkdirSync(T,{recursive:!0}),i.writeFileSync(S,I),q.add(S);let V=B.getSourceFile(h.resolve(S));if(V)V.replaceWithText(I);else V=B.addSourceFileAtPath(h.resolve(S));V.getImportDeclarations().forEach((J)=>{let A=J.getModuleSpecifierValue();J.setModuleSpecifier(Ay(A,G.path,Y?.aliases))}),await V.save()}}if(_)U.warn(`Some files of ${C.yellow(Q.name)} already exist`);else U.succeed(`${C.green(Q.name)} is added successfully`)}catch(x){U.fail(`
16
+ Failed to add the component ${C.red(Q.name)}`),console.error(C.red(x)),process.exit(1)}}if(X.size&&!G?.overwrite){console.log(`
17
+ Following files already exist in the directory.`),X.forEach((U)=>{console.log(C.green(`- ${h.relative(j,U.path)}`))});let Q=!1;if(G.yes)Q=!0;else{let U=await Jy({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0});if(U.overwrite===void 0)console.log(`
18
+ Use ${C.cyan("--overwrite")} or ${C.cyan("-o")} flag to overwrite existing files, or run with ${C.cyan("node")} instead of ${C.cyan("bun")}.`),process.exit(1);Q=U.overwrite}if(Q){let U=Sy("Overwriting files").start();X.forEach((D)=>{let _=B.addSourceFileAtPath(h.resolve(D.path));_.replaceWithText(D.code),_.getImportDeclarations().forEach((x)=>{let E=x.getModuleSpecifierValue();x.setModuleSpecifier(Ay(E,G.path,Y?.aliases))}),_.saveSync()}),U.succeed("Files are overwritten")}}if(L.size){let Q=Sy().start();await Uy(L,{cwd:j,spinner:Q,label:"component dependencies"})}if(H.size){let Q=Sy().start();await Uy(H,{cwd:j,dev:!0,spinner:Q,label:"component devDependencies"})}if(G.message!==void 0){if(G.message)console.log(G.message);return}process.exit(0)}import Y$ from"chalk";import{Command as p1}from"commander";import*as Ly from"fs";import n1 from"http";import t1 from"open";import e1 from"ora";import y0 from"os";import*as W$ from"path";import{URL as $0}from"url";import*as my from"fs";import*as Gy from"path";import{fileURLToPath as i1}from"url";var o1=i1(import.meta.url),j$=Gy.dirname(o1);function a1(){let y=[Gy.join(j$,"..","templates","auth-template.html"),Gy.join(j$,"templates","auth-template.html"),Gy.join(process.cwd(),"node_modules","untitledui","templates","auth-template.html"),Gy.join(j$,"..","..","templates","auth-template.html")];for(let $ of y)if(my.existsSync($))return $;throw Error("Auth template file not found. Please ensure the CLI package is properly installed.")}function s$(){try{let y=a1();return my.readFileSync(y,"utf-8")}catch(y){return console.warn("Warning: Using fallback auth template. Some styling may be missing."),`<!doctype html>
19
19
  <html lang="en">
20
20
  <head>
21
21
  <meta charset="UTF-8" />
@@ -61,120 +61,120 @@ Use ${R.cyan("--overwrite")} or ${R.cyan("-o")} flag to overwrite existing files
61
61
  {{AUTO_CLOSE_SCRIPT}}
62
62
  </div>
63
63
  </body>
64
- </html>`}}function h$(){return c$().replace("{{TITLE}}","Authentication successful").replace("{{HEADING}}","Authentication successful").replace("{{DESCRIPTION}}","You can now close this tab and return to your terminal.").replace("{{AUTO_CLOSE_SCRIPT}}","<script>setTimeout(() => window.close(), 10000);</script>")}function hy(y){return c$().replace("{{TITLE}}","Authentication failed").replace("{{HEADING}}","Authentication failed").replace("{{DESCRIPTION}}",y).replace("{{AUTO_CLOSE_SCRIPT}}","")}var j$=z$.join(o0.homedir(),".untitledui"),y$=z$.join(j$,"config.json"),m$=new s0().name("login").description("authenticate with Untitled UI to access PRO components").action(async()=>{let y=a0("Starting authentication...").start();try{await p0(y),y.succeed("Authentication completed successfully!"),console.log($$.green(`
65
- ✨ You can now access PRO components with the CLI!`)),process.exit(0)}catch($){y.fail(`Authentication failed: ${$ instanceof Error?$.message:$}`),process.exit(1)}});async function p0(y){return new Promise(($,j)=>{let z=r0.createServer((Y,W)=>{let Z=new n0(Y.url,"http://localhost");if(Z.pathname==="/callback"){let X=Z.searchParams.get("apiKey"),B=Z.searchParams.get("error");if(B){W.writeHead(400,{"Content-Type":"text/html"}),W.end(hy(decodeURIComponent(B))),z.close(),j(Error(decodeURIComponent(B)));return}if(!X){W.writeHead(400,{"Content-Type":"text/html"}),W.end(hy("No Access Token received")),z.close(),j(Error("No Access Token received"));return}try{t0(X),W.writeHead(200,{"Content-Type":"text/html"}),W.end(h$()),z.close(),$()}catch(V){W.writeHead(500,{"Content-Type":"text/html"}),W.end(hy("Failed to save authentication data")),z.close(),j(V)}}else W.writeHead(404),W.end("Not found")});z.listen(0,"localhost",()=>{let Z=`https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/cli-auth?port=${z.address().port}`;y.text="Opening browser for authentication...",i0(Z).catch((X)=>{console.log($$.yellow(`
66
- Failed to open browser automatically: ${X.message}`)),console.log($$.cyan(`Please manually open: ${Z}
67
- `))}),y.text="Waiting for authentication in browser..."}),setTimeout(()=>{z.close(),j(Error("Authentication timeout. Please try again."))},300000)})}function t0(y){if(!Wy.existsSync(j$))Wy.mkdirSync(j$,{recursive:!0});let $={};if(Wy.existsSync(y$))try{$=JSON.parse(Wy.readFileSync(y$,"utf-8"))}catch{$={}}$.license=y,Wy.writeFileSync(y$,JSON.stringify($,null,2),"utf-8")}import Y1 from"async-retry";import A from"chalk";import{Command as Q1}from"commander";import*as h from"fs";import Sy from"ora";import*as F from"path";import Ky from"prompts";import{Project as W1}from"ts-morph";import e0 from"node-fetch";async function Ny(y,$){try{let z=await e0("https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/components/example",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({example:y,key:$})});if(!z.ok){if(z.status===401||z.status===403)return{type:"error",status:z.status,message:"PRO access required"};return console.error(`API error: ${z.status} - ${z.statusText}`),null}return await z.json()}catch(z){return console.error(z),null}}import U$ from"async-retry";import P from"chalk";import{Command as y1}from"commander";import{execa as X$}from"execa";import B$ from"fast-glob";import r from"fs";import Ay from"ora";import*as u from"path";import sy from"prompts";import{Project as $1}from"ts-morph";import{fileURLToPath as j1}from"url";import*as my from"fs";import*as l$ from"path";function Y$(y,$){let j=l$.join(y,"package.json");if(!my.existsSync(j))return $;let z=JSON.parse(my.readFileSync(j,"utf-8")),Y={...z.dependencies,...z.devDependencies},W=[];for(let Z of $){let X=Y[Z];if(!X){W.push(Z);continue}if(Z==="tailwindcss"){let B=X.match(/\d+/);if((B?parseInt(B[0],10):0)<4)W.push(Z)}}return W}import Q$ from"chalk";import*as Xy from"fs";import*as ly from"path";function W$(y){if(!Xy.existsSync(ly.resolve(y)))console.log(Q$.red(`Error: CSS file not found at ${y}`)),process.exit(1);let $=Xy.readFileSync(ly.resolve(y),"utf-8"),j=/(--color-[a-zA-Z-]+-\d{1,3}):\s*(rgb\([^)]+\))/g,z={},Y;while((Y=j.exec($))!==null)if(Y[1]&&Y[2])z[Y[1]]=Y[2];return z}function Z$(y,$,j){let z=ly.resolve(j);if(!Xy.existsSync(z)){console.log(Q$.red(`Error: CSS file not found at ${z}`));return}let Y=Xy.readFileSync(z,"utf-8"),W=W$(j),Z={},X={};for(let[V,q]of Object.entries(W))if(V.startsWith(`--color-${y}-`)){let b=V.replace(`--color-${y}-`,"");Z[b]=V}else if(V.startsWith(`--color-${$}-`)){let b=V.replace(`--color-${$}-`,"");X[b]=q}let B=!1;for(let[V,q]of Object.entries(Z))if(X[V]){let b=X[V],J=new RegExp(`(${q}):\\s*rgb\\([^)]*\\);?`,"g");if(J.test(Y))Y=Y.replace(J,`$1: ${b};`),B=!0;else console.log(Q$.yellow(`No match found for ${q}`))}if(B)Xy.writeFileSync(z,Y,"utf-8")}var z1=j1(import.meta.url),s$=u.dirname(z1),i$="vite",a$="nextjs",r$={[a$]:"Next.js",[i$]:"Vite"},o="",C={color:"",template:"",framework:void 0,license:Zy()},o$=new y1().name("init").description("initialize a new project or adjust an existing one").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","display this help message.").option("--vite","initialize a Vite project.",!1).option("--nextjs","initialize a Next.js project.",!1).option("-o, --overwrite","overwrite existing files.",!1).option("--colors-list","show the colors list.",!1).option("-c, --color <color-name>","specify a color for the project.").action(async(y,$)=>{if(y)o=y;if($){if(C.color=$.color,C.template=$.template,C.overwrite=$.overwrite,C.colorsList=$.colorsList,C.license=$.license||C.license,C.vite=$.vite,C.nextjs=$.nextjs,$.vite)C.framework=i$;if($.nextjs)C.framework=a$}try{await L$($),process.exit(0)}catch(j){console.error(P.red(j)),process.exit(1)}});async function L$(y,$=null){let j=process.cwd(),z=r.existsSync(u.resolve(j,"package.json")),Y=u.resolve(u.join(s$,"../config/styles","theme.css")),W=W$(Y??""),Z=Array.from(new Set(Object.keys(W).map((q)=>q?.split("--color-")?.[1]?.replace(/-\d{1,3}/,"")))),X=Ay().start(),B=await Ly(j);if(C.license)Cy(C.license);if(!z){if(X.stop(),!o){let b=await sy({onState:g,type:"text",name:"path",message:"What is your project named?",initial:"untitled-ui"});if(typeof b.path==="string")o=b.path.trim()}if($)$.projectPath=o;let q=r.existsSync(u.resolve(u.posix.join(j,o,"package.json")));if(r.existsSync(u.resolve(u.posix.join(j,o)))&&q)X.fail(P.red("Directory already exists!")),process.exit(1);if(C.vite&&C.nextjs||!C.framework){let b=await sy({type:"select",name:"framework",onState:g,message:`Which ${P.cyan("framework")} would you like to use?`,choices:Object.entries(r$).map(([J,Q])=>({title:Q,value:J}))});C.framework=b.framework}X.succeed("Framework is selected: "+P.green(r$[C.framework]))}else if(B?.framework==="other")X.fail("Unsupported project framework"),console.log(`Please refer to the documentation ${P.cyan("https://www.untitledui.com/docs")} for supported frameworks or proceed with manual installation.`),process.exit(1);else if(B?.framework.startsWith("next")||B?.framework.startsWith("vite"))if(!$&&!B.tailwind.brandColor)X.succeed(P.yellow(`Detected ${v$[B.framework]} project, proceeding with the setup...`));else X.stop();if(C.colorsList||!C.color&&!B?.tailwind.brandColor){let q=await sy({type:"select",name:"color",onState:g,initial:y.color??"",message:`Which ${P.cyan("color")} would you like to use as the ${P.cyanBright("brand")} color?`,choices:Z.map((b)=>({title:b,value:b}))});if(C.color=q.color,C.colorsList&&B)B.tailwind.brandColor=q.color}let V=u.posix.join(j,o||"");if(o&&!z){let q=u.resolve(o);console.log(`
68
- Creating a new project in ${P.blue(o)}`);let b=Ay("Downloading and extracting the repository...").start();try{r.mkdirSync(q,{recursive:!0}),await U$(()=>P$(q,{template:C.framework}),{retries:2}),b.succeed("Files are downloaded and extracted successfully!");let J=Ay({text:"Installing dependencies..."}).start(),Q=B$.sync(["**/styles/theme.css"],{cwd:q,absolute:!0,onlyFiles:!0})[0];if(Z$("brand",C.color||"",Q??""),await U$(()=>X$(My(),["install"],{cwd:V}).catch(async(U)=>{if(U.message.includes("peer"))J.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),J.start("Installing dependencies with --legacy-peer-deps flag"),await X$(My(),["install","--legacy-peer-deps"],{cwd:V})}),{retries:1}),await U$(()=>X$("git",["init"],{cwd:V}),{retries:1}),J.succeed("Dependencies are installed"),!$)console.log(`
64
+ </html>`}}function r$(){return s$().replace("{{TITLE}}","Authentication successful").replace("{{HEADING}}","Authentication successful").replace("{{DESCRIPTION}}","You can now close this tab and return to your terminal.").replace("{{AUTO_CLOSE_SCRIPT}}","<script>setTimeout(() => window.close(), 10000);</script>")}function ly(y){return s$().replace("{{TITLE}}","Authentication failed").replace("{{HEADING}}","Authentication failed").replace("{{DESCRIPTION}}",y).replace("{{AUTO_CLOSE_SCRIPT}}","")}var Q$=W$.join(y0.homedir(),".untitledui"),z$=W$.join(Q$,"config.json"),i$=new p1().name("login").description("authenticate with Untitled UI to access PRO components").action(async()=>{let y=e1("Starting authentication...").start();try{await j0(y),y.succeed("Authentication completed successfully!"),console.log(Y$.green(`
65
+ ✨ You can now access PRO components with the CLI!`)),process.exit(0)}catch($){y.fail(`Authentication failed: ${$ instanceof Error?$.message:$}`),process.exit(1)}});async function j0(y){return new Promise(($,j)=>{let z=n1.createServer((Y,W)=>{let Z=new $0(Y.url,"http://localhost");if(Z.pathname==="/callback"){let X=Z.searchParams.get("apiKey"),L=Z.searchParams.get("error");if(L){W.writeHead(400,{"Content-Type":"text/html"}),W.end(ly(decodeURIComponent(L))),z.close(),j(Error(decodeURIComponent(L)));return}if(!X){W.writeHead(400,{"Content-Type":"text/html"}),W.end(ly("No Access Token received")),z.close(),j(Error("No Access Token received"));return}try{z0(X),W.writeHead(200,{"Content-Type":"text/html"}),W.end(r$()),z.close(),$()}catch(H){W.writeHead(500,{"Content-Type":"text/html"}),W.end(ly("Failed to save authentication data")),z.close(),j(H)}}else W.writeHead(404),W.end("Not found")});z.listen(0,"localhost",()=>{let Z=`http://localhost:3000/react/api/cli-auth?port=${z.address().port}`;y.text="Opening browser for authentication...",t1(Z).catch((X)=>{console.log(Y$.yellow(`
66
+ Failed to open browser automatically: ${X.message}`)),console.log(Y$.cyan(`Please manually open: ${Z}
67
+ `))}),y.text="Waiting for authentication in browser..."}),setTimeout(()=>{z.close(),j(Error("Authentication timeout. Please try again."))},300000)})}function z0(y){if(!Ly.existsSync(Q$))Ly.mkdirSync(Q$,{recursive:!0});let $={};if(Ly.existsSync(z$))try{$=JSON.parse(Ly.readFileSync(z$,"utf-8"))}catch{$={}}$.license=y,Ly.writeFileSync(z$,JSON.stringify($,null,2),"utf-8")}import X0 from"async-retry";import w from"chalk";import{Command as L0}from"commander";import*as m from"fs";import vy from"ora";import*as v from"path";import by from"prompts";import{Project as M0}from"ts-morph";import Y0 from"node-fetch";async function xy(y,$){try{let z=await Y0("http://localhost:3000/react/api/components/example",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({example:y,key:$})});if(!z.ok){if(z.status===401||z.status===403)return{type:"error",status:z.status,message:"PRO access required"};return console.error(`API error: ${z.status} - ${z.statusText}`),null}return await z.json()}catch(z){return console.error(z),null}}import M$ from"async-retry";import c from"chalk";import{Command as Q0}from"commander";import{execa as V$}from"execa";import H$ from"fast-glob";import o from"fs";import Ey from"ora";import*as g from"path";import iy from"prompts";import{Project as W0}from"ts-morph";import{fileURLToPath as Z0}from"url";import*as sy from"fs";import*as o$ from"path";function Z$(y,$){let j=o$.join(y,"package.json");if(!sy.existsSync(j))return $;let z=JSON.parse(sy.readFileSync(j,"utf-8")),Y={...z.dependencies,...z.devDependencies},W=[];for(let Z of $){let X=Y[Z];if(!X){W.push(Z);continue}if(Z==="tailwindcss"){let L=X.match(/\d+/);if((L?parseInt(L[0],10):0)<4)W.push(Z)}}return W}import U$ from"chalk";import*as Hy from"fs";import*as ry from"path";function X$(y){if(!Hy.existsSync(ry.resolve(y)))console.log(U$.red(`Error: CSS file not found at ${y}`)),process.exit(1);let $=Hy.readFileSync(ry.resolve(y),"utf-8"),j=/(--color-[a-zA-Z-]+-\d{1,3}):\s*(rgb\([^)]+\))/g,z={},Y;while((Y=j.exec($))!==null)if(Y[1]&&Y[2])z[Y[1]]=Y[2];return z}function L$(y,$,j){let z=ry.resolve(j);if(!Hy.existsSync(z)){console.log(U$.red(`Error: CSS file not found at ${z}`));return}let Y=Hy.readFileSync(z,"utf-8"),W=X$(j),Z={},X={};for(let[H,B]of Object.entries(W))if(H.startsWith(`--color-${y}-`)){let b=H.replace(`--color-${y}-`,"");Z[b]=H}else if(H.startsWith(`--color-${$}-`)){let b=H.replace(`--color-${$}-`,"");X[b]=B}let L=!1;for(let[H,B]of Object.entries(Z))if(X[H]){let b=X[H],q=new RegExp(`(${B}):\\s*rgb\\([^)]*\\);?`,"g");if(q.test(Y))Y=Y.replace(q,`$1: ${b};`),L=!0;else console.log(U$.yellow(`No match found for ${B}`))}if(L)Hy.writeFileSync(z,Y,"utf-8")}var U0=Z0(import.meta.url),a$=g.dirname(U0),n$="vite",t$="nextjs",p$={[t$]:"Next.js",[n$]:"Vite"},n="",O={color:"",template:"",framework:void 0,license:My()},e$=new Q0().name("init").description("initialize a new project or adjust an existing one").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","display this help message.").option("--vite","initialize a Vite project.",!1).option("--nextjs","initialize a Next.js project.",!1).option("-o, --overwrite","overwrite existing files.",!1).option("--colors-list","show the colors list.",!1).option("-c, --color <color-name>","specify a color for the project.").action(async(y,$)=>{if(y)n=y;if($){if(O.color=$.color,O.template=$.template,O.overwrite=$.overwrite,O.colorsList=$.colorsList,O.license=$.license||O.license,O.vite=$.vite,O.nextjs=$.nextjs,$.vite)O.framework=n$;if($.nextjs)O.framework=t$}try{await K$($),process.exit(0)}catch(j){console.error(c.red(j)),process.exit(1)}});async function K$(y,$=null){let j=process.cwd(),z=o.existsSync(g.resolve(j,"package.json")),Y=g.resolve(g.join(a$,"../config/styles","theme.css")),W=X$(Y??""),Z=Array.from(new Set(Object.keys(W).map((B)=>B?.split("--color-")?.[1]?.replace(/-\d{1,3}/,"")))),X=Ey().start(),L=await By(j);if(O.license)Oy(O.license);if(!z){if(X.stop(),!n){let b=await iy({onState:f,type:"text",name:"path",message:"What is your project named?",initial:"untitled-ui"});if(typeof b.path==="string")n=b.path.trim()}if($)$.projectPath=n;let B=o.existsSync(g.resolve(g.posix.join(j,n,"package.json")));if(o.existsSync(g.resolve(g.posix.join(j,n)))&&B)X.fail(c.red("Directory already exists!")),process.exit(1);if(O.vite&&O.nextjs||!O.framework){let b=await iy({type:"select",name:"framework",onState:f,message:`Which ${c.cyan("framework")} would you like to use?`,choices:Object.entries(p$).map(([q,Q])=>({title:Q,value:q}))});O.framework=b.framework}X.succeed("Framework is selected: "+c.green(p$[O.framework]))}else if(L?.framework==="other")X.fail("Unsupported project framework"),console.log(`Please refer to the documentation ${c.cyan("https://www.untitledui.com/docs")} for supported frameworks or proceed with manual installation.`),process.exit(1);else if(L?.framework.startsWith("next")||L?.framework.startsWith("vite"))if(!$&&!L.tailwind.brandColor)X.succeed(c.yellow(`Detected ${u$[L.framework]} project, proceeding with the setup...`));else X.stop();if(O.colorsList||!O.color&&!L?.tailwind.brandColor){let B=await iy({type:"select",name:"color",onState:f,initial:y.color??"",message:`Which ${c.cyan("color")} would you like to use as the ${c.cyanBright("brand")} color?`,choices:Z.map((b)=>({title:b,value:b}))});if(O.color=B.color,O.colorsList&&L)L.tailwind.brandColor=B.color}let H=g.posix.join(j,n||"");if(n&&!z){let B=g.resolve(n);console.log(`
68
+ Creating a new project in ${c.blue(n)}`);let b=Ey("Downloading and extracting the repository...").start();try{o.mkdirSync(B,{recursive:!0}),await M$(()=>h$(B,{template:O.framework}),{retries:2}),b.succeed("Files are downloaded and extracted successfully!");let q=Ey({text:"Installing dependencies..."}).start(),Q=H$.sync(["**/styles/theme.css"],{cwd:B,absolute:!0,onlyFiles:!0})[0];if(L$("brand",O.color||"",Q??""),await M$(()=>V$(qy(),["install"],{cwd:H}).catch(async(U)=>{if(U.message.includes("peer"))q.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),q.start("Installing dependencies with --legacy-peer-deps flag"),await V$(qy(),["install","--legacy-peer-deps"],{cwd:H})}),{retries:1}),await M$(()=>V$("git",["init"],{cwd:H}),{retries:1}),q.succeed("Dependencies are installed"),!$)console.log(`
69
69
  Your project is ready, to get started run the following commands:
70
70
 
71
- cd ${P.cyan(o)}
72
- ${P.cyan(O$())}`)}catch(J){if(b.fail(P.red(`
73
- Failed to download and extract the repository`)),J instanceof Error)console.error(J.message);else console.error(`
74
- `);r.rmdirSync(q,{recursive:!0}),process.exit(1)}}else{let q=Ay(),b=new Set,J=B?.examples||"",Q=wy(j,J),U=u.resolve(u.join(s$,"../config")),D=B$.sync(["**"],{cwd:U,onlyFiles:!0,ignore:m}),w=Y$(j,["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components"]),E=Y$(j,["@tailwindcss/postcss","postcss"]);if(!$&&!B?.tailwind.brandColor)q.start("Copying files to the project directory");if(D.forEach((v)=>{let M=v.includes("postcss.config"),L=u.posix.join(u.posix.join(U),v),K=u.posix.join(j,M?v:dy(v,B?.paths,B?.isSrcDir));if(r.existsSync(K)){if(C?.overwrite)r.copyFileSync(L,K);else{let _=r.readFileSync(K,"utf-8"),x=r.readFileSync(L,"utf-8");if(_!==x){if(v.endsWith("theme.css")&&B?.tailwind.brandColor)return;b.add({targetFile:K,sourceFile:L})}}return}r.mkdirSync(u.dirname(K),{recursive:!0}),r.writeFileSync(K,""),r.copyFileSync(L,K)}),q.stop(),b.size&&!C?.overwrite){if(console.log(`
75
- `),q.fail("Following files already exist in the directory."),b.forEach((M)=>{console.log(`- ${P.green(M.targetFile)}`)}),(await sy({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let M=Ay("Overwriting files").start();b.forEach((L)=>{r.copyFileSync(L.sourceFile,L.targetFile)}),M.succeed("Files are overwritten")}}if(Q?.tailwindFile)console.log(`
71
+ cd ${c.cyan(n)}
72
+ ${c.cyan(d$())}`)}catch(q){if(b.fail(c.red(`
73
+ Failed to download and extract the repository`)),q instanceof Error)console.error(q.message);else console.error(`
74
+ `);o.rmdirSync(B,{recursive:!0}),process.exit(1)}}else{let B=Ey(),b=new Set,q=L?.examples||"",Q=wy(j,q),U=g.resolve(g.join(a$,"../config")),D=H$.sync(["**"],{cwd:U,onlyFiles:!0,ignore:l}),_=Z$(j,["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components"]),x=Z$(j,["@tailwindcss/postcss","postcss"]);if(!$&&!L?.tailwind.brandColor)B.start("Copying files to the project directory");if(D.forEach((F)=>{let I=F.includes("postcss.config"),T=g.posix.join(g.posix.join(U),F),R=g.posix.join(j,I?F:cy(F,L?.paths,L?.isSrcDir));if(o.existsSync(R)){if(O?.overwrite)o.copyFileSync(T,R);else{let M=o.readFileSync(R,"utf-8"),V=o.readFileSync(T,"utf-8");if(M!==V){if(F.endsWith("theme.css")&&L?.tailwind.brandColor)return;b.add({targetFile:R,sourceFile:T})}}return}o.mkdirSync(g.dirname(R),{recursive:!0}),o.writeFileSync(R,""),o.copyFileSync(T,R)}),B.stop(),b.size&&!O?.overwrite){if(console.log(`
75
+ `),B.fail("Following files already exist in the directory."),b.forEach((I)=>{console.log(`- ${c.green(I.targetFile)}`)}),(await iy({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let I=Ey("Overwriting files").start();b.forEach((T)=>{o.copyFileSync(T.sourceFile,T.targetFile)}),I.succeed("Files are overwritten")}}if(Q?.tailwindFile)console.log(`
76
76
  Tailwind config file exists in the project directory. You can add it to your globals.css as follows:`),console.log(`
77
- ${P.cyan(`@config "../${B?.isSrcDir?"../":""}${u.relative(j,Q.tailwindFile)}";`)}
78
- `);if(B?.framework==="vite"){if(!u$(j))console.log(`
79
- Tailwind CSS is not configured in your Vite project. Please refer to the documentation ${P.cyan("https://www.untitledui.com/react/integrations/vite")} for manual installation.
80
- `)}let I=Q?.layoutFile||Q?.appFile||B?.framework==="vite"&&Q?.mainFile||"";if(I){let M=new $1({tsConfigFilePath:u.resolve(Q?.tsConfig||"")}).addSourceFileAtPath(u.resolve(I)),L="styles/globals.css";if(!M.getImportDeclarations().some((_)=>{let x=_.getModuleSpecifierValue();return/(?:styles\/)?globals\.css$/.test(x)})){let _=B?.aliases?.styles||B?.aliases?.src||"",x=B?.aliases?.styles?`${_}globals.css`:`${_}styles/globals.css`;M.addImportDeclaration({moduleSpecifier:x})}M.saveSync()}let S=B$.sync(["**/theme.css"],{cwd:j,absolute:!0,onlyFiles:!0,ignore:m});if(!S?.length)return q.fail(`Failed to copy ${P.cyan("theme.css")} file.
81
- Ensure that the ${P.cyan("theme.css")} file exists in the project directory under your ${P.yellow("styles")} folder.`);if((C.color||!B?.tailwind.brandColor)&&Z$("brand",C.color||"brand",S[0]??""),w.length||E.length){let v=Ay().start("Installing dependencies");if(w.length)await Yy(w,{cwd:V,spinner:v,label:"dependencies"});if(E.length)await Yy(E,{cwd:V,dev:!0,spinner:v,label:"devDependencies"});v.succeed("Dependencies are installed")}if(!$&&!B?.tailwind.brandColor)q.succeed(P.green("Project setup is completed!"));if($&&z){X.stop(),q.stop();return}else console.log(`
82
- Your project is ready, you can now start adding components.`)}}var H={path:"",example:"",license:Zy(),components:[]},M$={},n$=new Q1().name("example").description("add an example to the project").argument("[example]","the example to add").option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the components to.").option("-e, --example-path <example-path>","the path to add the example file to.").option("--include-all-components","automatically include all components from the example without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(y,$)=>{if(y)H.example=y;if($){if(H.path=$.path,H.overwrite=$.overwrite,H.examplePath=$.examplePath,H.includeAllComponents=$.includeAllComponents,H.yes=$.yes,H.license=$.license||H.license,$.yes)H.includeAllComponents=!0,H.overwrite=!0}try{await L$($,M$),await Z1()}catch(j){console.error(A.red(j))}});async function Z1(){let y=Sy().start(),$=F.posix.join(process.cwd(),M$?.projectPath||"");if(!h.existsSync(F.posix.join(F.resolve($,"package.json"))))y.warn("This command should be run in a project directory."),process.exit(1);let z=await Ly($);if(H.license)await fy(H.license,y);if(y.stop(),!H.example){if(H.yes)console.error(A.red("Error: Example name is required in non-interactive mode.")),console.log(`Usage: ${A.cyan("npx untitledui example <example-name> --yes")}`),console.log(`Example: ${A.cyan("npx untitledui example dashboards-01/01 --yes")}`),process.exit(1);let Q=await Ky({type:"select",name:"example",onState:g,message:"Select which type of example you want to add",choices:[{title:"Application",value:"application"},{title:"Marketing",value:"marketing"}]});H.example=Q.example}let Y=null;if(H.example){let Q=await Ny(H.example,H.license);if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(A.yellow(`\uD83D\uDD12 The ${A.cyan(H.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${A.green("→")} If you've already purchased: ${A.cyan(`${zy()} untitledui@latest login`)}`),console.log(` ${A.green("→")} To purchase PRO examples: ${A.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1);if(Q?.type==="directory"){if(H.yes)if(Q.results.length>0)H.example=Q.results[0]||"",console.log(A.yellow(`Auto-selecting: ${H.example}`)),Q=await Ny(H.example,H.license);else console.error(A.red("Error: No examples found in directory.")),process.exit(1);else{let U=await Ky({type:"select",name:"example",onState:g,message:`Select a folder or file in "${H.example}"`,choices:Q.results.map((D)=>({title:D,value:D}))});if(!U.example)return;H.example=U.example,Q=await Ny(U.example,H.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(A.yellow(`\uD83D\uDD12 The ${A.cyan(H.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${A.green("→")} If you've already purchased: ${A.cyan(`${zy()} untitledui@latest login`)}`),console.log(` ${A.green("→")} To purchase PRO examples: ${A.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-files"){if(H.yes)if(Q.results.length>0)H.example=`${H.example}/${Q.results[0]}`,console.log(A.yellow(`Auto-selecting: ${H.example}`)),Q=await Ny(H.example,H.license);else console.error(A.red("Error: No example files found.")),process.exit(1);else{let U=await Ky({type:"select",name:"example",onState:g,message:`Select which example you want to add from "${H.example}"`,choices:Q.results.map((D)=>({title:D,value:`${H.example}/${D}`}))});if(!U.example)return;H.example=U.example,Q=await Ny(U.example,H.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(A.yellow(`\uD83D\uDD12 The ${A.cyan(H.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${A.green("→")} If you've already purchased: ${A.cyan(`${zy()} untitledui@latest login`)}`),console.log(` ${A.green("→")} To purchase PRO examples: ${A.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-file")Y=Q.content}if(!Y)y.fail("No example found"),process.exit(1);let W=z?.examples||"";if(W){let Q=await Ly(F.posix.join($,W));if(Q)z={...Q,aliases:z?.aliases||{}};H.examplePath=W}if(!H?.examplePath){let Q=z?.isAppDir?"app":"pages",U=z?.isSrcDir?F.posix.join("src",Q):Q;if(H.yes)H.examplePath=U,console.log(A.yellow(`Using default example path: ${U}`));else{let D=await Ky({type:"text",name:"examplePath",onState:g,message:`Where would you like to add the ${A.cyan(H?.example)} example?`,initial:U});H.examplePath=D.examplePath}}if(H.examplePath&&!h.existsSync(F.posix.join($,H.examplePath)))h.mkdirSync(F.posix.join($,H.examplePath),{recursive:!0}),console.log(A.green(`Created directory ${H.examplePath}`));if(!H?.path&&!z?.paths?.components)if(H.yes)H.path="components",console.log(A.yellow("Using default components path: components"));else{let Q=await Ky({type:"text",name:"path",onState:g,message:`Where would you like to add the ${A.cyan("components")}?`,initial:"components"});H.path=Q.path}if(H?.path&&z?.paths&&!z.paths.components)z.paths.components=F.posix.join(z?.isSrcDir?"src":"",H.path);if(!H?.path&&z?.paths?.components)H.path=z.paths.components.replace(/^src\//,"");let Z=Y.components.filter((Q)=>!h.existsSync(F.posix.join($,`${z?.isSrcDir?"src":""}`,Q?.path?.replace(/components\//,H.path+"/"))));if(Z?.length)if(H.includeAllComponents)H.components=Z.map((Q)=>Q.name);else{let Q=await Ky({type:"multiselect",name:"components",onState:g,message:`Select which components you want to add from ${A.cyan(Y.name)} example`,choices:Z.map((U)=>({title:U?.name,value:U?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(H.components=Q.components,!Z.length&&!Q.components?.length)y.warn("No components selected")}let X=wy($),B=new Set,V=new W1({tsConfigFilePath:X?.tsConfig}),q=Sy(`Adding ${H?.example}...`).start(),b="",J=new Set(Y.components.filter((Q)=>H.components?.includes(Q.name)).map((Q)=>F.dirname(Q.path)));try{for(let{path:Q,code:U}of Y.files||[]){let D=F.dirname(Q);if(Array.from(J).some((M)=>D===M||D.startsWith(M+"/")))continue;let E=F.posix.join($,`${z?.isSrcDir?"src":""}`,Q.replace(/components\//,H.path+"/")),I=z?.framework==="vite"?U.replace(`"use client";
83
-
84
- `,""):U,S=Py(I);if(Q.includes("examples")){let M=F.basename(Q);E=F.posix.join($,H?.examplePath??"",M),b=F.posix.join(H?.examplePath??"",M)}let v=F.dirname(E);if(h.existsSync(E)&&!H.overwrite){if(h.readFileSync(E,"utf-8")!==S)B.add({code:S,path:E})}else{let M=v.split(F.sep),L="";for(let _ of M)if(L=L?F.join(L,_):_,L&&h.existsSync(L)&&h.statSync(L).isFile())throw Error(`Cannot create directory '${v}' because '${L}' is an existing file.
85
- Please check your path aliases in components.json and tsconfig.json.`);h.mkdirSync(v,{recursive:!0}),h.writeFileSync(E,S);let K=V.getSourceFile(F.resolve(E));if(K)K.replaceWithText(S);else K=V.addSourceFileAtPath(F.resolve(E));K.getImportDeclarations().forEach((_)=>{let x=_.getModuleSpecifierValue();_.setModuleSpecifier(Dy(x,H.path,z?.aliases))}),await K.save()}}if(B.size)q.warn(`Some files of ${A.yellow(H?.example)} already exist`);else q.succeed(`${A.green(H?.example)} is added successfully`)}catch(Q){q.fail(`
86
- Failed to add the component ${A.red(H?.example)}`),console.error(A.red(Q)),process.exit(1)}if(B.size&&!H?.overwrite){console.log(`
87
- Following files already exist in the directory.`),B.forEach((U)=>{console.log(A.green(`- ${F.relative($,U.path)}`))});let Q=!1;if(H.yes)Q=!0,console.log(A.yellow("Auto-overwriting existing files (--yes mode)"));else{let U=await Ky({type:"confirm",name:"overwrite",onState:g,message:"Do you want to overwrite the existing files?",initial:!0});if(U.overwrite===void 0)console.log(`
88
- Use ${A.cyan("--overwrite")} or ${A.cyan("-o")} flag to overwrite existing files, or run with ${A.cyan("node")} instead of ${A.cyan("bun")}.`),process.exit(1);Q=U.overwrite}if(Q){let U=Sy("Overwriting files").start();B.forEach((D)=>{let w=V.addSourceFileAtPath(F.resolve(D.path));w.replaceWithText(D.code),w.getImportDeclarations().forEach((E)=>{let I=E.getModuleSpecifierValue();E.setModuleSpecifier(Dy(I,H.path,z?.aliases))}),w.saveSync()}),U.succeed("Files are overwritten")}}if(Y?.dependencies?.length){let Q=Sy().start();await Yy(Y.dependencies,{cwd:$,spinner:Q,label:"example dependencies"})}if(Y?.devDependencies?.length){let Q=Sy().start();await Yy(Y.devDependencies,{cwd:$,dev:!0,spinner:Q,label:"example devDependencies"})}if(H?.components?.length)await Y1(()=>ty({components:H.components,dir:M$?.projectPath||"",path:H.path,message:""}),{retries:1});console.log(`
89
- \uD83C\uDF89 Example ${A.green(H.example)} has been added to ${A.green(b)}`),process.exit(0)}import O from"chalk";import{Command as U1}from"commander";import e$ from"fast-glob";import Jy from"fs";import p$ from"ora";import vy from"path";import X1 from"prompts";var B1={ArrowRight:"ArrowNext",ArrowLeft:"ArrowPrevious",ChevronRight:"ChevronNext",ChevronLeft:"ChevronPrevious",ChevronRightDouble:"ChevronNextDouble",ChevronLeftDouble:"ChevronPreviousDouble"},L1=[{pattern:/\bml-/g,replace:"ms-",description:"ml- → ms-"},{pattern:/\bmr-/g,replace:"me-",description:"mr- → me-"},{pattern:/\bpl-/g,replace:"ps-",description:"pl- → ps-"},{pattern:/\bpr-/g,replace:"pe-",description:"pr- → pe-"},{pattern:/(?<!from-|to-|placement-)(?<!\bin-placement-)\bleft-/g,replace:"start-",description:"left- → start-"},{pattern:/(?<!from-|to-|placement-)(?<!\bin-placement-)\bright-/g,replace:"end-",description:"right- → end-"},{pattern:/\brounded-l-/g,replace:"rounded-s-",description:"rounded-l- → rounded-s-"},{pattern:/\brounded-r-/g,replace:"rounded-e-",description:"rounded-r- → rounded-e-"},{pattern:/\brounded-tl-/g,replace:"rounded-ss-",description:"rounded-tl- → rounded-ss-"},{pattern:/\brounded-tr-/g,replace:"rounded-se-",description:"rounded-tr- → rounded-se-"},{pattern:/\brounded-bl-/g,replace:"rounded-es-",description:"rounded-bl- → rounded-es-"},{pattern:/\brounded-br-/g,replace:"rounded-ee-",description:"rounded-br- → rounded-ee-"},{pattern:/\bborder-l-/g,replace:"border-s-",description:"border-l- → border-s-"},{pattern:/\bborder-r-/g,replace:"border-e-",description:"border-r- → border-e-"},{pattern:/\bborder-l\b/g,replace:"border-s",description:"border-l → border-s"},{pattern:/\bborder-r\b/g,replace:"border-e",description:"border-r → border-e"},{pattern:/\btext-left\b/g,replace:"text-start",description:"text-left → text-start"},{pattern:/\btext-right\b/g,replace:"text-end",description:"text-right → text-end"},{pattern:/\bfloat-left\b/g,replace:"float-start",description:"float-left → float-start"},{pattern:/\bfloat-right\b/g,replace:"float-end",description:"float-right → float-end"},{pattern:/\bclear-left\b/g,replace:"clear-start",description:"clear-left → clear-start"},{pattern:/\bclear-right\b/g,replace:"clear-end",description:"clear-right → clear-end"},{pattern:/\bscroll-ml-/g,replace:"scroll-ms-",description:"scroll-ml- → scroll-ms-"},{pattern:/\bscroll-mr-/g,replace:"scroll-me-",description:"scroll-mr- → scroll-me-"},{pattern:/\bscroll-pl-/g,replace:"scroll-ps-",description:"scroll-pl- → scroll-ps-"},{pattern:/\bscroll-pr-/g,replace:"scroll-pe-",description:"scroll-pr- → scroll-pe-"}],By="(?:(sm|md|lg|xl|2xl):)?";function qy(y,$){let j=y.match(/^(sm|md|lg|xl|2xl):/);return j?`${y} ${j[1]}:rtl:${$}`:`${y} rtl:${$}`}var M1=[{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-in-from-right(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-in-from-left)/g,replace:(y)=>`${y} rtl:slide-in-from-left${y.replace("slide-in-from-right","")}`,description:"slide-in-from-right + rtl:slide-in-from-left",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-in-from-left(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-in-from-right)/g,replace:(y)=>`${y} rtl:slide-in-from-right${y.replace("slide-in-from-left","")}`,description:"slide-in-from-left + rtl:slide-in-from-right",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-out-to-right(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-out-to-left)/g,replace:(y)=>`${y} rtl:slide-out-to-left${y.replace("slide-out-to-right","")}`,description:"slide-out-to-right + rtl:slide-out-to-left",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-out-to-left(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-out-to-right)/g,replace:(y)=>`${y} rtl:slide-out-to-right${y.replace("slide-out-to-left","")}`,description:"slide-out-to-left + rtl:slide-out-to-right",needsReview:!0},{pattern:new RegExp(`(?<![-:])${By}translate-x-([\\d./]+|full|px|\\[\\S+\\])(?! rtl:)`,"g"),replace:(y)=>qy(y,`-${y.replace(/^(sm|md|lg|xl|2xl):/,"")}`),description:"translate-x + rtl:-translate-x",needsReview:!0},{pattern:new RegExp(`(?<=^|\\s|")${By}-translate-x-([\\d./]+|full|px|\\[\\S+\\])(?! rtl:)`,"g"),replace:(y)=>{let $=y.match(/^(sm|md|lg|xl|2xl):/),j=y.slice(y.indexOf("-translate-x-")+13);return $?`${y} ${$[1]}:rtl:translate-x-${j}`:`${y} rtl:translate-x-${j}`},description:"-translate-x + rtl:translate-x",needsReview:!0},{pattern:new RegExp(`\\b${By}space-x-(\\d+(?:\\.\\d+)?|\\[\\S+\\])(?!\\s+(?:sm:|md:|lg:|xl:|2xl:)?rtl:space-x-reverse)`,"g"),replace:(y)=>qy(y,"space-x-reverse"),description:"space-x + rtl:space-x-reverse",needsReview:!0},{pattern:new RegExp(`\\b${By}divide-x(?:-(\\d+(?:\\.\\d+)?|\\[\\S+\\]))?(?!\\s+(?:sm:|md:|lg:|xl:|2xl:)?rtl:divide-x-reverse)`,"g"),replace:(y)=>qy(y,"divide-x-reverse"),description:"divide-x + rtl:divide-x-reverse",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${By}bg-linear-to-r\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-linear-to-l)`,"g"),replace:(y)=>qy(y,"bg-linear-to-l"),description:"bg-linear-to-r + rtl:bg-linear-to-l",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${By}bg-linear-to-l\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-linear-to-r)`,"g"),replace:(y)=>qy(y,"bg-linear-to-r"),description:"bg-linear-to-l + rtl:bg-linear-to-r",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${By}bg-gradient-to-r\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-gradient-to-l)`,"g"),replace:(y)=>qy(y,"bg-gradient-to-l"),description:"bg-gradient-to-r + rtl:bg-gradient-to-l",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${By}bg-gradient-to-l\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-gradient-to-r)`,"g"),replace:(y)=>qy(y,"bg-gradient-to-r"),description:"bg-gradient-to-l + rtl:bg-gradient-to-r",needsReview:!0}],V1=/\bleft-1\/2\b.*-translate-x-1\/2|-translate-x-1\/2.*\bleft-1\/2\b/,y0=/\b(ml-|mr-|pl-|pr-|left-|right-|rounded-[lr]-|rounded-t[lr]-|rounded-b[lr]-|border-[lr]|text-left|text-right|float-left|float-right|scroll-m[lr]-|scroll-p[lr]-|translate-x-|space-x-|divide-x|bg-linear-to-[lr]|bg-gradient-to-[lr]|slide-in-from-(?:left|right)|slide-out-to-(?:left|right))/;function $0(y,$){let j=y;for(let z of $)j=j.replace(z.pattern,z.replace);return j}function H1(y,$,j){let z={file:y,changes:[]},Y=$.split(`
90
- `);for(let W=0;W<Y.length;W++){let Z=Y[W];if(/^\s*(import\b|export\b.*from\b)/.test(Z)||/\brequire\s*\(/.test(Z))continue;if(V1.test(Z))continue;let X=Z,B=!1;if(X=X.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(V,q,b,J,Q)=>{let U=q??b??J??Q;if(U==null||!y0.test(U))return V;let D=$0(U,j);if(D!==U)return B=!0,V.replace(U,D);return V}),B&&X!==Z)Y[W]=X,z.changes.push({line:W+1,before:Z.trim(),after:X.trim()})}return z}function K1(y){let $=0,j=y;for(let[z,Y]of Object.entries(B1)){let W=new RegExp(`\\b${z}\\b`,"g"),Z=j;if(j=j.replace(W,Y),j!==Z)$+=(Z.match(W)||[]).length}return{content:j,swaps:$}}async function q1(y){let $=vy.resolve(y);return e$(["**/*.tsx","**/*.ts"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/*.test.tsx"]})}var j0="[data-rtl-flip]:dir(rtl) { transform: scaleX(-1); }";function t$(y){let $=["global.css","globals.css","styles/global.css","styles/globals.css","src/global.css","src/globals.css","src/styles/global.css","src/styles/globals.css","app/global.css","app/globals.css"];for(let z of $){let Y=vy.resolve(y,z);if(Jy.existsSync(Y))return Y}let j=e$.sync(["**/*.css"],{cwd:y,absolute:!0,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"]});for(let z of j){let Y=Jy.readFileSync(z,"utf-8");if(Y.includes("@import")&&Y.includes("tailwindcss"))return z}return j[0]||null}function J1(y,$){let j=Jy.readFileSync(y,"utf-8");if(j.includes("data-rtl-flip"))return!1;let z=j.trimEnd()+`
91
-
92
- `+j0+`
93
- `;if(!$)Jy.writeFileSync(y,z);return!0}var z0=new U1().name("migrate").description("migrate components for RTL support").argument("[path]","path to migrate (defaults to current directory)").option("--dry-run","preview changes without writing files",!1).option("--skip-icons","skip directional icon swapping",!1).option("-y, --yes","skip prompts and use defaults",!1).action(async(y,$)=>{console.log(O.bold(`
77
+ ${c.cyan(`@config "../${L?.isSrcDir?"../":""}${g.relative(j,Q.tailwindFile)}";`)}
78
+ `);if(L?.framework==="vite"){if(!P$(j))console.log(`
79
+ Tailwind CSS is not configured in your Vite project. Please refer to the documentation ${c.cyan("https://www.untitledui.com/react/integrations/vite")} for manual installation.
80
+ `)}let E=Q?.layoutFile||Q?.appFile||L?.framework==="vite"&&Q?.mainFile||"";if(E){let I=new W0({tsConfigFilePath:g.resolve(Q?.tsConfig||"")}).addSourceFileAtPath(g.resolve(E)),T="styles/globals.css";if(!I.getImportDeclarations().some((M)=>{let V=M.getModuleSpecifierValue();return/(?:styles\/)?globals\.css$/.test(V)})){let M=L?.aliases?.styles||L?.aliases?.src||"",V=L?.aliases?.styles?`${M}globals.css`:`${M}styles/globals.css`;I.addImportDeclaration({moduleSpecifier:V})}I.saveSync()}let S=H$.sync(["**/theme.css"],{cwd:j,absolute:!0,onlyFiles:!0,ignore:l});if(!S?.length)return B.fail(`Failed to copy ${c.cyan("theme.css")} file.
81
+ Ensure that the ${c.cyan("theme.css")} file exists in the project directory under your ${c.yellow("styles")} folder.`);if((O.color||!L?.tailwind.brandColor)&&L$("brand",O.color||"brand",S[0]??""),_.length||x.length){let F=Ey().start("Installing dependencies");if(_.length)await Uy(_,{cwd:H,spinner:F,label:"dependencies"});if(x.length)await Uy(x,{cwd:H,dev:!0,spinner:F,label:"devDependencies"});F.succeed("Dependencies are installed")}if(!$&&!L?.tailwind.brandColor)B.succeed(c.green("Project setup is completed!"));if($&&z){X.stop(),B.stop();return}else console.log(`
82
+ Your project is ready, you can now start adding components.`)}}var K={path:"",example:"",license:My(),components:[]},B$={},y1=new L0().name("example").description("add an example to the project").argument("[example]","the example to add").option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the components to.").option("-e, --example-path <example-path>","the path to add the example file to.").option("--include-all-components","automatically include all components from the example without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(y,$)=>{if(y)K.example=y;if($){if(K.path=$.path,K.overwrite=$.overwrite,K.examplePath=$.examplePath,K.includeAllComponents=$.includeAllComponents,K.yes=$.yes,K.license=$.license||K.license,$.yes)K.includeAllComponents=!0,K.overwrite=!0}try{await K$($,B$),await V0()}catch(j){console.error(w.red(j))}});async function V0(){let y=vy().start(),$=v.posix.join(process.cwd(),B$?.projectPath||"");if(!m.existsSync(v.posix.join(v.resolve($,"package.json"))))y.warn("This command should be run in a project directory."),process.exit(1);let z=await By($);if(K.license)await hy(K.license,y);if(y.stop(),!K.example){if(K.yes)console.error(w.red("Error: Example name is required in non-interactive mode.")),console.log(`Usage: ${w.cyan("npx untitledui example <example-name> --yes")}`),console.log(`Example: ${w.cyan("npx untitledui example dashboards-01/01 --yes")}`),process.exit(1);let Q=await by({type:"select",name:"example",onState:f,message:"Select which type of example you want to add",choices:[{title:"Application",value:"application"},{title:"Marketing",value:"marketing"}]});K.example=Q.example}let Y=null;if(K.example){let Q=await xy(K.example,K.license);if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(w.yellow(`\uD83D\uDD12 The ${w.cyan(K.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${w.green("→")} If you've already purchased: ${w.cyan(`${Zy()} untitledui@latest login`)}`),console.log(` ${w.green("→")} To purchase PRO examples: ${w.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1);if(Q?.type==="directory"){if(K.yes)if(Q.results.length>0)K.example=Q.results[0]||"",console.log(w.yellow(`Auto-selecting: ${K.example}`)),Q=await xy(K.example,K.license);else console.error(w.red("Error: No examples found in directory.")),process.exit(1);else{let U=await by({type:"select",name:"example",onState:f,message:`Select a folder or file in "${K.example}"`,choices:Q.results.map((D)=>({title:D,value:D}))});if(!U.example)return;K.example=U.example,Q=await xy(U.example,K.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(w.yellow(`\uD83D\uDD12 The ${w.cyan(K.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${w.green("→")} If you've already purchased: ${w.cyan(`${Zy()} untitledui@latest login`)}`),console.log(` ${w.green("→")} To purchase PRO examples: ${w.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-files"){if(K.yes)if(Q.results.length>0)K.example=`${K.example}/${Q.results[0]}`,console.log(w.yellow(`Auto-selecting: ${K.example}`)),Q=await xy(K.example,K.license);else console.error(w.red("Error: No example files found.")),process.exit(1);else{let U=await by({type:"select",name:"example",onState:f,message:`Select which example you want to add from "${K.example}"`,choices:Q.results.map((D)=>({title:D,value:`${K.example}/${D}`}))});if(!U.example)return;K.example=U.example,Q=await xy(U.example,K.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(w.yellow(`\uD83D\uDD12 The ${w.cyan(K.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${w.green("→")} If you've already purchased: ${w.cyan(`${Zy()} untitledui@latest login`)}`),console.log(` ${w.green("→")} To purchase PRO examples: ${w.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-file")Y=Q.content}if(!Y)y.fail("No example found"),process.exit(1);let W=z?.examples||"";if(W){let Q=await By(v.posix.join($,W));if(Q)z={...Q,aliases:z?.aliases||{}};K.examplePath=W}if(!K?.examplePath){let Q=z?.isAppDir?"app":"pages",U=z?.isSrcDir?v.posix.join("src",Q):Q;if(K.yes)K.examplePath=U,console.log(w.yellow(`Using default example path: ${U}`));else{let D=await by({type:"text",name:"examplePath",onState:f,message:`Where would you like to add the ${w.cyan(K?.example)} example?`,initial:U});K.examplePath=D.examplePath}}if(K.examplePath&&!m.existsSync(v.posix.join($,K.examplePath)))m.mkdirSync(v.posix.join($,K.examplePath),{recursive:!0}),console.log(w.green(`Created directory ${K.examplePath}`));if(!K?.path&&!z?.paths?.components)if(K.yes)K.path="components",console.log(w.yellow("Using default components path: components"));else{let Q=await by({type:"text",name:"path",onState:f,message:`Where would you like to add the ${w.cyan("components")}?`,initial:"components"});K.path=Q.path}if(K?.path&&z?.paths&&!z.paths.components)z.paths.components=v.posix.join(z?.isSrcDir?"src":"",K.path);if(!K?.path&&z?.paths?.components)K.path=z.paths.components.replace(/^src\//,"");let Z=Y.components.filter((Q)=>!m.existsSync(v.posix.join($,`${z?.isSrcDir?"src":""}`,Q?.path?.replace(/components\//,K.path+"/"))));if(Z?.length)if(K.includeAllComponents)K.components=Z.map((Q)=>Q.name);else{let Q=await by({type:"multiselect",name:"components",onState:f,message:`Select which components you want to add from ${w.cyan(Y.name)} example`,choices:Z.map((U)=>({title:U?.name,value:U?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(K.components=Q.components,!Z.length&&!Q.components?.length)y.warn("No components selected")}let X=wy($),L=new Set,H=new M0({tsConfigFilePath:X?.tsConfig}),B=vy(`Adding ${K?.example}...`).start(),b="",q=new Set(Y.components.filter((Q)=>K.components?.includes(Q.name)).map((Q)=>v.dirname(Q.path)));try{for(let{path:Q,code:U}of Y.files||[]){let D=v.dirname(Q);if(Array.from(q).some((I)=>D===I||D.startsWith(I+"/")))continue;let x=v.posix.join($,`${z?.isSrcDir?"src":""}`,Q.replace(/components\//,K.path+"/")),E=z?.framework==="vite"?U.replace(`"use client";
83
+
84
+ `,""):U,S=fy(E);if(Q.includes("examples")){let I=v.basename(Q);x=v.posix.join($,K?.examplePath??"",I),b=v.posix.join(K?.examplePath??"",I)}let F=v.dirname(x);if(m.existsSync(x)&&!K.overwrite){if(m.readFileSync(x,"utf-8")!==S)L.add({code:S,path:x})}else{let I=F.split(v.sep),T="";for(let M of I)if(T=T?v.join(T,M):M,T&&m.existsSync(T)&&m.statSync(T).isFile())throw Error(`Cannot create directory '${F}' because '${T}' is an existing file.
85
+ Please check your path aliases in components.json and tsconfig.json.`);m.mkdirSync(F,{recursive:!0}),m.writeFileSync(x,S);let R=H.getSourceFile(v.resolve(x));if(R)R.replaceWithText(S);else R=H.addSourceFileAtPath(v.resolve(x));R.getImportDeclarations().forEach((M)=>{let V=M.getModuleSpecifierValue();M.setModuleSpecifier(Ay(V,K.path,z?.aliases))}),await R.save()}}if(L.size)B.warn(`Some files of ${w.yellow(K?.example)} already exist`);else B.succeed(`${w.green(K?.example)} is added successfully`)}catch(Q){B.fail(`
86
+ Failed to add the component ${w.red(K?.example)}`),console.error(w.red(Q)),process.exit(1)}if(L.size&&!K?.overwrite){console.log(`
87
+ Following files already exist in the directory.`),L.forEach((U)=>{console.log(w.green(`- ${v.relative($,U.path)}`))});let Q=!1;if(K.yes)Q=!0,console.log(w.yellow("Auto-overwriting existing files (--yes mode)"));else{let U=await by({type:"confirm",name:"overwrite",onState:f,message:"Do you want to overwrite the existing files?",initial:!0});if(U.overwrite===void 0)console.log(`
88
+ Use ${w.cyan("--overwrite")} or ${w.cyan("-o")} flag to overwrite existing files, or run with ${w.cyan("node")} instead of ${w.cyan("bun")}.`),process.exit(1);Q=U.overwrite}if(Q){let U=vy("Overwriting files").start();L.forEach((D)=>{let _=H.addSourceFileAtPath(v.resolve(D.path));_.replaceWithText(D.code),_.getImportDeclarations().forEach((x)=>{let E=x.getModuleSpecifierValue();x.setModuleSpecifier(Ay(E,K.path,z?.aliases))}),_.saveSync()}),U.succeed("Files are overwritten")}}if(Y?.dependencies?.length){let Q=vy().start();await Uy(Y.dependencies,{cwd:$,spinner:Q,label:"example dependencies"})}if(Y?.devDependencies?.length){let Q=vy().start();await Uy(Y.devDependencies,{cwd:$,dev:!0,spinner:Q,label:"example devDependencies"})}if(K?.components?.length)await X0(()=>$$({components:K.components,dir:B$?.projectPath||"",path:K.path,message:""}),{retries:1});console.log(`
89
+ \uD83C\uDF89 Example ${w.green(K.example)} has been added to ${w.green(b)}`),process.exit(0)}import P from"chalk";import{Command as H0}from"commander";import z1 from"fast-glob";import Dy from"fs";import $1 from"ora";import Fy from"path";import K0 from"prompts";var B0={ArrowRight:"ArrowNext",ArrowLeft:"ArrowPrevious",ChevronRight:"ChevronNext",ChevronLeft:"ChevronPrevious",ChevronRightDouble:"ChevronNextDouble",ChevronLeftDouble:"ChevronPreviousDouble"},q0=[{pattern:/\bml-/g,replace:"ms-",description:"ml- → ms-"},{pattern:/\bmr-/g,replace:"me-",description:"mr- → me-"},{pattern:/\bpl-/g,replace:"ps-",description:"pl- → ps-"},{pattern:/\bpr-/g,replace:"pe-",description:"pr- → pe-"},{pattern:/(?<!from-|to-|placement-)(?<!\bin-placement-)\bleft-/g,replace:"start-",description:"left- → start-"},{pattern:/(?<!from-|to-|placement-)(?<!\bin-placement-)\bright-/g,replace:"end-",description:"right- → end-"},{pattern:/\brounded-l-/g,replace:"rounded-s-",description:"rounded-l- → rounded-s-"},{pattern:/\brounded-r-/g,replace:"rounded-e-",description:"rounded-r- → rounded-e-"},{pattern:/\brounded-tl-/g,replace:"rounded-ss-",description:"rounded-tl- → rounded-ss-"},{pattern:/\brounded-tr-/g,replace:"rounded-se-",description:"rounded-tr- → rounded-se-"},{pattern:/\brounded-bl-/g,replace:"rounded-es-",description:"rounded-bl- → rounded-es-"},{pattern:/\brounded-br-/g,replace:"rounded-ee-",description:"rounded-br- → rounded-ee-"},{pattern:/\bborder-l-/g,replace:"border-s-",description:"border-l- → border-s-"},{pattern:/\bborder-r-/g,replace:"border-e-",description:"border-r- → border-e-"},{pattern:/\bborder-l\b/g,replace:"border-s",description:"border-l → border-s"},{pattern:/\bborder-r\b/g,replace:"border-e",description:"border-r → border-e"},{pattern:/\btext-left\b/g,replace:"text-start",description:"text-left → text-start"},{pattern:/\btext-right\b/g,replace:"text-end",description:"text-right → text-end"},{pattern:/\bfloat-left\b/g,replace:"float-start",description:"float-left → float-start"},{pattern:/\bfloat-right\b/g,replace:"float-end",description:"float-right → float-end"},{pattern:/\bclear-left\b/g,replace:"clear-start",description:"clear-left → clear-start"},{pattern:/\bclear-right\b/g,replace:"clear-end",description:"clear-right → clear-end"},{pattern:/\bscroll-ml-/g,replace:"scroll-ms-",description:"scroll-ml- → scroll-ms-"},{pattern:/\bscroll-mr-/g,replace:"scroll-me-",description:"scroll-mr- → scroll-me-"},{pattern:/\bscroll-pl-/g,replace:"scroll-ps-",description:"scroll-pl- → scroll-ps-"},{pattern:/\bscroll-pr-/g,replace:"scroll-pe-",description:"scroll-pr- → scroll-pe-"}],Ky="(?:(sm|md|lg|xl|2xl):)?";function _y(y,$){let j=y.match(/^(sm|md|lg|xl|2xl):/);return j?`${y} ${j[1]}:rtl:${$}`:`${y} rtl:${$}`}var J0=[{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-in-from-right(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-in-from-left)/g,replace:(y)=>`${y} rtl:slide-in-from-left${y.replace("slide-in-from-right","")}`,description:"slide-in-from-right + rtl:slide-in-from-left",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-in-from-left(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-in-from-right)/g,replace:(y)=>`${y} rtl:slide-in-from-right${y.replace("slide-in-from-left","")}`,description:"slide-in-from-left + rtl:slide-in-from-right",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-out-to-right(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-out-to-left)/g,replace:(y)=>`${y} rtl:slide-out-to-left${y.replace("slide-out-to-right","")}`,description:"slide-out-to-right + rtl:slide-out-to-left",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-out-to-left(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-out-to-right)/g,replace:(y)=>`${y} rtl:slide-out-to-right${y.replace("slide-out-to-left","")}`,description:"slide-out-to-left + rtl:slide-out-to-right",needsReview:!0},{pattern:new RegExp(`(?<![-:])${Ky}translate-x-([\\d./]+|full|px|\\[\\S+\\])(?! rtl:)`,"g"),replace:(y)=>_y(y,`-${y.replace(/^(sm|md|lg|xl|2xl):/,"")}`),description:"translate-x + rtl:-translate-x",needsReview:!0},{pattern:new RegExp(`(?<=^|\\s|")${Ky}-translate-x-([\\d./]+|full|px|\\[\\S+\\])(?! rtl:)`,"g"),replace:(y)=>{let $=y.match(/^(sm|md|lg|xl|2xl):/),j=y.slice(y.indexOf("-translate-x-")+13);return $?`${y} ${$[1]}:rtl:translate-x-${j}`:`${y} rtl:translate-x-${j}`},description:"-translate-x + rtl:translate-x",needsReview:!0},{pattern:new RegExp(`\\b${Ky}space-x-(\\d+(?:\\.\\d+)?|\\[\\S+\\])(?!\\s+(?:sm:|md:|lg:|xl:|2xl:)?rtl:space-x-reverse)`,"g"),replace:(y)=>_y(y,"space-x-reverse"),description:"space-x + rtl:space-x-reverse",needsReview:!0},{pattern:new RegExp(`\\b${Ky}divide-x(?:-(\\d+(?:\\.\\d+)?|\\[\\S+\\]))?(?!\\s+(?:sm:|md:|lg:|xl:|2xl:)?rtl:divide-x-reverse)`,"g"),replace:(y)=>_y(y,"divide-x-reverse"),description:"divide-x + rtl:divide-x-reverse",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${Ky}bg-linear-to-r\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-linear-to-l)`,"g"),replace:(y)=>_y(y,"bg-linear-to-l"),description:"bg-linear-to-r + rtl:bg-linear-to-l",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${Ky}bg-linear-to-l\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-linear-to-r)`,"g"),replace:(y)=>_y(y,"bg-linear-to-r"),description:"bg-linear-to-l + rtl:bg-linear-to-r",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${Ky}bg-gradient-to-r\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-gradient-to-l)`,"g"),replace:(y)=>_y(y,"bg-gradient-to-l"),description:"bg-gradient-to-r + rtl:bg-gradient-to-l",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${Ky}bg-gradient-to-l\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-gradient-to-r)`,"g"),replace:(y)=>_y(y,"bg-gradient-to-r"),description:"bg-gradient-to-l + rtl:bg-gradient-to-r",needsReview:!0}],G0=/\bleft-1\/2\b.*-translate-x-1\/2|-translate-x-1\/2.*\bleft-1\/2\b/,Y1=/\b(ml-|mr-|pl-|pr-|left-|right-|rounded-[lr]-|rounded-t[lr]-|rounded-b[lr]-|border-[lr]|text-left|text-right|float-left|float-right|scroll-m[lr]-|scroll-p[lr]-|translate-x-|space-x-|divide-x|bg-linear-to-[lr]|bg-gradient-to-[lr]|slide-in-from-(?:left|right)|slide-out-to-(?:left|right))/;function Q1(y,$){let j=y;for(let z of $)j=j.replace(z.pattern,z.replace);return j}function b0(y,$,j){let z={file:y,changes:[]},Y=$.split(`
90
+ `);for(let W=0;W<Y.length;W++){let Z=Y[W];if(/^\s*(import\b|export\b.*from\b)/.test(Z)||/\brequire\s*\(/.test(Z))continue;if(G0.test(Z))continue;let X=Z,L=!1;if(X=X.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(H,B,b,q,Q)=>{let U=B??b??q??Q;if(U==null||!Y1.test(U))return H;let D=Q1(U,j);if(D!==U)return L=!0,H.replace(U,D);return H}),L&&X!==Z)Y[W]=X,z.changes.push({line:W+1,before:Z.trim(),after:X.trim()})}return z}function _0(y){let $=0,j=y;for(let[z,Y]of Object.entries(B0)){let W=new RegExp(`\\b${z}\\b`,"g"),Z=j;if(j=j.replace(W,Y),j!==Z)$+=(Z.match(W)||[]).length}return{content:j,swaps:$}}async function D0(y){let $=Fy.resolve(y);return z1(["**/*.tsx","**/*.ts"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/*.test.tsx"]})}var W1="[data-rtl-flip]:dir(rtl) { transform: scaleX(-1); }";function j1(y){let $=["global.css","globals.css","styles/global.css","styles/globals.css","src/global.css","src/globals.css","src/styles/global.css","src/styles/globals.css","app/global.css","app/globals.css"];for(let z of $){let Y=Fy.resolve(y,z);if(Dy.existsSync(Y))return Y}let j=z1.sync(["**/*.css"],{cwd:y,absolute:!0,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"]});for(let z of j){let Y=Dy.readFileSync(z,"utf-8");if(Y.includes("@import")&&Y.includes("tailwindcss"))return z}return j[0]||null}function N0(y,$){let j=Dy.readFileSync(y,"utf-8");if(j.includes("data-rtl-flip"))return!1;let z=j.trimEnd()+`
91
+
92
+ `+W1+`
93
+ `;if(!$)Dy.writeFileSync(y,z);return!0}var Z1=new H0().name("migrate").description("migrate components for RTL support").argument("[path]","path to migrate (defaults to current directory)").option("--dry-run","preview changes without writing files",!1).option("--skip-icons","skip directional icon swapping",!1).option("-y, --yes","skip prompts and use defaults",!1).action(async(y,$)=>{console.log(P.bold(`
94
94
  Migrate to RTL
95
- `));let j=vy.resolve(y||".");if(!Jy.existsSync(j))console.log(O.red(` Path not found: ${j}`)),process.exit(1);let z=!$.skipIcons,Y=!0,W=!1;if(!$.yes){let w=await X1([{type:$.skipIcons?null:"confirm",name:"swapIcons",message:"Swap directional icons for RTL-aware versions? (e.g. ArrowRight → ArrowNext)",initial:!0},{type:"confirm",name:"includeVariants",message:"Add rtl: variants for animations, gradients, translate, and space-x?",initial:!0},{type:$.dryRun?null:"confirm",name:"confirm",message:`Apply changes to ${O.cyan(j)}?`,initial:!0}]);if(w.confirm===!1){console.log(O.yellow(`
95
+ `));let j=Fy.resolve(y||".");if(!Dy.existsSync(j))console.log(P.red(` Path not found: ${j}`)),process.exit(1);let z=!$.skipIcons,Y=!0,W=!1;if(!$.yes){let _=await K0([{type:$.skipIcons?null:"confirm",name:"swapIcons",message:"Swap directional icons for RTL-aware versions? (e.g. ArrowRight → ArrowNext)",initial:!0},{type:"confirm",name:"includeVariants",message:"Add rtl: variants for animations, gradients, translate, and space-x?",initial:!0},{type:$.dryRun?null:"confirm",name:"confirm",message:`Apply changes to ${P.cyan(j)}?`,initial:!0}]);if(_.confirm===!1){console.log(P.yellow(`
96
96
  Cancelled.
97
- `));return}z=!$.skipIcons&&w.swapIcons!==!1,Y=w.includeVariants!==!1,W=z}else W=z;let Z=p$(" Scanning files...").start(),X=await q1(j);Z.succeed(` Found ${O.bold(X.length)} files`);let B=[...L1,...Y?M1:[]],V=0,q=0,b=0,J=[],Q=p$(" Transforming...").start();for(let w of X){let E=Jy.readFileSync(w,"utf-8"),I=vy.relative(j,w),S=E,v=!1,M=H1(I,S,B);if(M.changes.length>0){S=E.split(`
98
- `).map((_,x)=>{return M.changes.find((f)=>f.line===x+1)?S.split(`
99
- `)[x]:_}).join(`
100
- `);let L=S.split(`
101
- `),K=E.split(`
102
- `);for(let _ of M.changes){let x=_.line-1,T=K[x];T=T.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(f,n,Iy,p,Gy)=>{let c=n??Iy??p??Gy;if(c==null||!y0.test(c))return f;let by=$0(c,B);return by!==c?f.replace(c,by):f}),L[x]=T}S=L.join(`
103
- `),V+=M.changes.length,v=!0,J.push(M)}if(z){let L=K1(S);if(L.swaps>0)S=L.content,q+=L.swaps,v=!0}if(v){if(b++,!$.dryRun)Jy.writeFileSync(w,S)}}Q.succeed(` Processed ${O.bold(X.length)} files`);let U=!1,D="";if(W&&q>0){let w=t$(j);if(w)D=vy.relative(j,w),U=J1(w,$.dryRun)}if(console.log(O.bold(`
97
+ `));return}z=!$.skipIcons&&_.swapIcons!==!1,Y=_.includeVariants!==!1,W=z}else W=z;let Z=$1(" Scanning files...").start(),X=await D0(j);Z.succeed(` Found ${P.bold(X.length)} files`);let L=[...q0,...Y?J0:[]],H=0,B=0,b=0,q=[],Q=$1(" Transforming...").start();for(let _ of X){let x=Dy.readFileSync(_,"utf-8"),E=Fy.relative(j,_),S=x,F=!1,I=b0(E,S,L);if(I.changes.length>0){S=x.split(`
98
+ `).map((M,V)=>{return I.changes.find((A)=>A.line===V+1)?S.split(`
99
+ `)[V]:M}).join(`
100
+ `);let T=S.split(`
101
+ `),R=x.split(`
102
+ `);for(let M of I.changes){let V=M.line-1,J=R[V];J=J.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(A,u,k,p,e)=>{let yy=u??k??p??e;if(yy==null||!Y1.test(yy))return A;let t=Q1(yy,L);return t!==yy?A.replace(yy,t):A}),T[V]=J}S=T.join(`
103
+ `),H+=I.changes.length,F=!0,q.push(I)}if(z){let T=_0(S);if(T.swaps>0)S=T.content,B+=T.swaps,F=!0}if(F){if(b++,!$.dryRun)Dy.writeFileSync(_,S)}}Q.succeed(` Processed ${P.bold(X.length)} files`);let U=!1,D="";if(W&&B>0){let _=j1(j);if(_)D=Fy.relative(j,_),U=N0(_,$.dryRun)}if(console.log(P.bold(`
104
104
  Summary
105
- `)),console.log(` Files modified: ${O.cyan(b)}`),console.log(` Class changes: ${O.cyan(V)}`),z)console.log(` Icon swaps: ${O.cyan(q)}`);if(U)console.log(` RTL flip rule: ${O.cyan("added")} → ${O.dim(D)}`);else if(W&&q>0&&!U)if(!t$(j))console.log(O.yellow(`
106
- Could not find a global CSS file to inject the RTL flip rule.`)),console.log(O.yellow(` Add this manually to your global stylesheet:
107
- `)),console.log(O.dim(` ${j0}
108
- `));else console.log(` RTL flip rule: ${O.dim("already present")}`);if($.dryRun){if(console.log(O.yellow(`
109
- Dry run — no files were modified.`)),J.length>0){console.log(O.bold(`
105
+ `)),console.log(` Files modified: ${P.cyan(b)}`),console.log(` Class changes: ${P.cyan(H)}`),z)console.log(` Icon swaps: ${P.cyan(B)}`);if(U)console.log(` RTL flip rule: ${P.cyan("added")} → ${P.dim(D)}`);else if(W&&B>0&&!U)if(!j1(j))console.log(P.yellow(`
106
+ Could not find a global CSS file to inject the RTL flip rule.`)),console.log(P.yellow(` Add this manually to your global stylesheet:
107
+ `)),console.log(P.dim(` ${W1}
108
+ `));else console.log(` RTL flip rule: ${P.dim("already present")}`);if($.dryRun){if(console.log(P.yellow(`
109
+ Dry run — no files were modified.`)),q.length>0){console.log(P.bold(`
110
110
  Changes preview:
111
- `));for(let w of J.slice(0,10)){console.log(O.dim(` ${w.file}`));for(let E of w.changes.slice(0,3))console.log(O.red(` - ${E.before.substring(0,100)}`)),console.log(O.green(` + ${E.after.substring(0,100)}`));if(w.changes.length>3)console.log(O.dim(` ... and ${w.changes.length-3} more`))}if(J.length>10)console.log(O.dim(`
112
- ... and ${J.length-10} more files`))}}else console.log(O.green(`
113
- Done! ${b} files updated.`));console.log()});import k from"chalk";import{Command as G1}from"commander";import V$ from"node-fetch";import b1 from"ora";var H$="https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/mcp/tools";async function _1(y,$,j=10){return(await(await V$(`${H$}/search-components`,{method:"POST",headers:{"Content-Type":"application/json",...$&&{Authorization:`Bearer ${$}`}},body:JSON.stringify({query:y,limit:j})})).json()).results||[]}async function w1(y,$,j=10){return(await(await V$(`${H$}/get-page-templates`,{method:"POST",headers:{"Content-Type":"application/json",...$&&{Authorization:`Bearer ${$}`}},body:JSON.stringify({query:y,limit:j})})).json()).templates||[]}async function D1(y,$=10){return(await(await V$(`${H$}/search-icons`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:y,limit:$})})).json()).results||[]}function N1(y,$){let j=y.access==="pro"?k.magenta(" PRO"):k.green(" FREE");if(console.log(` ${k.bold(`${$+1}. ${y.name}`)}${j} ${k.dim(`(${y.category})`)}`),console.log(` ${k.dim(y.description)}`),y.key_features?.length)console.log(` ${y.key_features.map((z)=>k.cyan(z)).join(" ")}`);console.log()}function A1(y,$){if(console.log(` ${k.bold(`${$+1}. ${y.name}`)} ${k.dim(`(${y.type} · ${y.layout})`)}`),console.log(` ${k.dim(y.description)}`),y.sections?.length)console.log(` ${k.dim("Sections:")} ${y.sections.map((j)=>k.cyan(j)).join(" ")}`);if(y.hero_style)console.log(` ${k.dim("Hero:")} ${k.yellow(y.hero_style)}`);console.log()}function x1(y,$){if(console.log(` ${k.bold(`${$+1}. ${y.importName}`)} ${k.dim(`(${y.category})`)}`),console.log(` ${k.dim(`import { ${y.importName} } from "@untitledui/icons"`)}`),y.tags?.length)console.log(` ${y.tags.slice(0,6).map((j)=>k.dim(j)).join(" ")}`);console.log()}var Y0=new G1().name("search").description("search for components, templates, and icons using natural language").argument("<query...>","search query (e.g., 'login with reviews', 'dark pricing table')").option("-t, --type <type>","filter by type: components, templates, icons, all","all").option("-l, --limit <number>","max results per category","5").option("-k, --key <key>","API key for PRO access").action(async(y,$)=>{let j=y.join(" "),z=parseInt($.limit,10),Y=$.key||Zy()||void 0,W=$.type.toLowerCase(),Z=b1(`Searching for "${j}"...`).start();try{let X=W==="all"||W==="components",B=W==="all"||W==="templates",V=W==="all"||W==="icons",[q,b,J]=await Promise.all([X?_1(j,Y,z):Promise.resolve([]),B?w1(j,Y,z):Promise.resolve([]),V?D1(j,z):Promise.resolve([])]);if(Z.stop(),q.length+b.length+J.length===0){console.log(k.yellow(`
111
+ `));for(let _ of q.slice(0,10)){console.log(P.dim(` ${_.file}`));for(let x of _.changes.slice(0,3))console.log(P.red(` - ${x.before.substring(0,100)}`)),console.log(P.green(` + ${x.after.substring(0,100)}`));if(_.changes.length>3)console.log(P.dim(` ... and ${_.changes.length-3} more`))}if(q.length>10)console.log(P.dim(`
112
+ ... and ${q.length-10} more files`))}}else console.log(P.green(`
113
+ Done! ${b} files updated.`));console.log()});import d from"chalk";import{Command as w0}from"commander";import q$ from"node-fetch";import A0 from"ora";var J$="http://localhost:3000/react/api/mcp/tools";async function x0(y,$,j=10){return(await(await q$(`${J$}/search-components`,{method:"POST",headers:{"Content-Type":"application/json",...$&&{Authorization:`Bearer ${$}`}},body:JSON.stringify({query:y,limit:j})})).json()).results||[]}async function E0(y,$,j=10){return(await(await q$(`${J$}/get-page-templates`,{method:"POST",headers:{"Content-Type":"application/json",...$&&{Authorization:`Bearer ${$}`}},body:JSON.stringify({query:y,limit:j})})).json()).templates||[]}async function I0(y,$=10){return(await(await q$(`${J$}/search-icons`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:y,limit:$})})).json()).results||[]}function T0(y,$){let j=y.access==="pro"?d.magenta(" PRO"):d.green(" FREE");if(console.log(` ${d.bold(`${$+1}. ${y.name}`)}${j} ${d.dim(`(${y.category})`)}`),console.log(` ${d.dim(y.description)}`),y.key_features?.length)console.log(` ${y.key_features.map((z)=>d.cyan(z)).join(" ")}`);console.log()}function S0(y,$){if(console.log(` ${d.bold(`${$+1}. ${y.name}`)} ${d.dim(`(${y.type} · ${y.layout})`)}`),console.log(` ${d.dim(y.description)}`),y.sections?.length)console.log(` ${d.dim("Sections:")} ${y.sections.map((j)=>d.cyan(j)).join(" ")}`);if(y.hero_style)console.log(` ${d.dim("Hero:")} ${d.yellow(y.hero_style)}`);console.log()}function v0(y,$){if(console.log(` ${d.bold(`${$+1}. ${y.importName}`)} ${d.dim(`(${y.category})`)}`),console.log(` ${d.dim(`import { ${y.importName} } from "@untitledui/icons"`)}`),y.tags?.length)console.log(` ${y.tags.slice(0,6).map((j)=>d.dim(j)).join(" ")}`);console.log()}var U1=new w0().name("search").description("search for components, templates, and icons using natural language").argument("<query...>","search query (e.g., 'login with reviews', 'dark pricing table')").option("-t, --type <type>","filter by type: components, templates, icons, all","all").option("-l, --limit <number>","max results per category","5").option("-k, --key <key>","API key for PRO access").action(async(y,$)=>{let j=y.join(" "),z=parseInt($.limit,10),Y=$.key||My()||void 0,W=$.type.toLowerCase(),Z=A0(`Searching for "${j}"...`).start();try{let X=W==="all"||W==="components",L=W==="all"||W==="templates",H=W==="all"||W==="icons",[B,b,q]=await Promise.all([X?x0(j,Y,z):Promise.resolve([]),L?E0(j,Y,z):Promise.resolve([]),H?I0(j,z):Promise.resolve([])]);if(Z.stop(),B.length+b.length+q.length===0){console.log(d.yellow(`
114
114
  No results found for "${j}"
115
- `));return}if(q.length>0){if(console.log(k.bold.underline(`
116
- Components (${q.length})
117
- `)),q.forEach(N1),q.length>0){let U=q[0].name;console.log(k.dim(` Install: npx untitledui@latest add ${U} --yes
118
- `))}}if(b.length>0){if(console.log(k.bold.underline(`
115
+ `));return}if(B.length>0){if(console.log(d.bold.underline(`
116
+ Components (${B.length})
117
+ `)),B.forEach(T0),B.length>0){let U=B[0].name;console.log(d.dim(` Install: npx untitledui@latest add ${U} --yes
118
+ `))}}if(b.length>0){if(console.log(d.bold.underline(`
119
119
  Templates (${b.length})
120
- `)),b.forEach(A1),b.length>0){let U=b[0].name;console.log(k.dim(` Install: npx untitledui@latest example ${U} --yes
121
- `))}}if(J.length>0)console.log(k.bold.underline(`
122
- Icons (${J.length})
123
- `)),J.forEach(x1)}catch(X){Z.fail("Search failed"),console.error(k.red(X instanceof Error?X.message:"Unknown error")),process.exit(1)}});import N from"chalk";import{Command as R1}from"commander";import{execa as q$}from"execa";import q0 from"fast-glob";import i from"fs";import a from"ora";import l from"path";import K0 from"prompts";var Q0={fromVersion:"7",toVersion:"8",classTransforms:[{pattern:/\bshadow-skeumorphic-xs\b/g,replace:"shadow-skeuomorphic-xs",description:"shadow-skeumorphic-xs → shadow-skeuomorphic-xs (typo fix)"},{pattern:/\bshadow-skeumorphic\b/g,replace:"shadow-skeuomorphic",description:"shadow-skeumorphic → shadow-skeuomorphic (typo fix)"},{pattern:/\butility-gray-blue-/g,replace:"utility-slate-",description:"utility-gray-blue- → utility-slate-"},{pattern:/\butility-blue-light-/g,replace:"utility-sky-",description:"utility-blue-light- → utility-sky-"},{pattern:/\butility-gray-/g,replace:"utility-neutral-",description:"utility-gray- → utility-neutral-"},{pattern:/\butility-error-/g,replace:"utility-red-",description:"utility-error- → utility-red-"},{pattern:/\butility-warning-/g,replace:"utility-yellow-",description:"utility-warning- → utility-yellow-"},{pattern:/\butility-success-/g,replace:"utility-green-",description:"utility-success- → utility-green-"},{pattern:/\boutline-none\b/g,replace:"outline-hidden",description:"outline-none → outline-hidden"},{pattern:/\bbg-disabled_subtle\b/g,replace:"opacity-50",description:"bg-disabled_subtle → opacity-50",needsReview:!0},{pattern:/\bbg-disabled\b/g,replace:"opacity-50",description:"bg-disabled → opacity-50",needsReview:!0},{pattern:/\btext-disabled\b/g,replace:"",description:"text-disabled → removed",needsReview:!0},{pattern:/\bring-disabled_subtle\b/g,replace:"",description:"ring-disabled_subtle → removed",needsReview:!0},{pattern:/\bring-disabled\b/g,replace:"",description:"ring-disabled → removed",needsReview:!0},{pattern:/\bborder-disabled_subtle\b/g,replace:"",description:"border-disabled_subtle → removed",needsReview:!0},{pattern:/\bborder-disabled\b/g,replace:"",description:"border-disabled → removed",needsReview:!0},{pattern:/\btext-fg-disabled_subtle\b/g,replace:"",description:"text-fg-disabled_subtle → removed",needsReview:!0},{pattern:/\btext-fg-disabled\b/g,replace:"",description:"text-fg-disabled → removed",needsReview:!0},{pattern:/\btext-placeholder_subtle\b/g,replace:"",description:"text-placeholder_subtle → removed",needsReview:!0},{pattern:/\btext-button-primary-icon_hover\b/g,replace:"text-white/70",description:"text-button-primary-icon_hover → text-white/70"},{pattern:/\btext-button-primary-icon\b/g,replace:"text-white/60",description:"text-button-primary-icon → text-white/60"},{pattern:/\btext-button-destructive-primary-icon_hover\b/g,replace:"text-white/70",description:"text-button-destructive-primary-icon_hover → text-white/70"},{pattern:/\btext-button-destructive-primary-icon\b/g,replace:"text-white/60",description:"text-button-destructive-primary-icon → text-white/60"},{pattern:/\bbg-avatar-bg\b/g,replace:"bg-tertiary",description:"bg-avatar-bg → bg-tertiary"},{pattern:/\bring-bg-brand-solid\b/g,replace:"ring-brand-solid",description:"ring-bg-brand-solid → ring-brand-solid"},{pattern:/\bbg-active\b/g,replace:"bg-primary_hover",description:"bg-active → bg-primary_hover",needsReview:!0},{pattern:/\bbg-toggle-button-fg_disabled\b/g,replace:"",description:"bg-toggle-button-fg_disabled → removed",needsReview:!0}],importTransforms:[{from:"pin-input/pin-input",to:"input/pin-input",description:"pin-input moved into input directory"},{from:"nav-item-button",to:"nav-button",description:"nav-item-button renamed to nav-button"}],propTransforms:[{from:"placeholderIcon=",to:"icon=",description:"placeholderIcon prop renamed to icon"},{from:'color="gray-blue"',to:'color="slate"',description:'color="gray-blue" renamed to color="slate"'},{from:'color="blue-light"',to:'color="sky"',description:'color="blue-light" renamed to color="sky"'}],structuralPatterns:[],orphanedTokens:["bg-disabled_subtle","text-disabled","ring-disabled","border-disabled","text-fg-disabled","bg-avatar-bg","text-button-primary-icon","text-button-destructive-primary-icon","bg-toggle-button-fg_disabled","utility-gray-","utility-error-","utility-warning-","utility-success-","utility-gray-blue-","utility-blue-light-","skeumorphic"],dependencyChanges:{update:{next:"16.2.0",react:"^19.2.4","react-dom":"^19.2.4","react-aria-components":"^1.16.0","react-aria":"^3.47.0",tailwindcss:"^4.2.2",motion:"^12.38.0",recharts:"^3.8.0"},add:{},devUpdate:{storybook:"^10.3.0",vite:"^8.0.0","@vitejs/plugin-react":"^6.0.1",eslint:"^10.0.3",typescript:"^5.9.3"},devAdd:{"@storybook/test-runner":"^0.24.3"},remove:[]},configChanges:{tsconfig:[{description:"Update JSX transform to react-jsx",find:'"jsx": "preserve"',replace:'"jsx": "react-jsx"'}]},notes:["Default size for Select, ComboBox, and Input changed from 'sm' to 'md'. Review component usage.","Avatar size 'xxs' removed. Use 'xs' instead.","Dropdown no longer defaults to selectionMode='single'. Set explicitly if needed."]};import*as xy from"fs";import*as K$ from"path";function W0(y){let{tsconfigPath:$,changes:j,dryRun:z}=y,Y=K$.resolve($),W=[],Z=[],X;try{X=xy.readFileSync(Y,"utf-8")}catch{return{applied:W,skipped:j.map((V)=>V.description)}}let B=X;for(let V of j)if(B.includes(V.find))B=B.replace(V.find,V.replace),W.push(V.description);else Z.push(V.description);if(!z&&W.length>0)xy.writeFileSync(Y,B,"utf-8");return{applied:W,skipped:Z}}function Z0(y){let{packageJsonPath:$,update:j,add:z,devUpdate:Y,devAdd:W,remove:Z,dryRun:X}=y,B=K$.resolve($),V=[],q=[],b=[],J;try{let Q=xy.readFileSync(B,"utf-8");J=JSON.parse(Q)}catch{return{updated:V,added:q,removed:b}}if(!J.dependencies)J.dependencies={};if(!J.devDependencies)J.devDependencies={};for(let[Q,U]of Object.entries(j))if(J.dependencies[Q])J.dependencies[Q]=U,V.push(Q);for(let[Q,U]of Object.entries(z))if(!J.dependencies[Q])J.dependencies[Q]=U,q.push(Q);for(let[Q,U]of Object.entries(Y))if(J.devDependencies[Q])J.devDependencies[Q]=U,V.push(Q);for(let[Q,U]of Object.entries(W))if(!J.devDependencies[Q])J.devDependencies[Q]=U,q.push(Q);for(let Q of Z){if(J.dependencies[Q])delete J.dependencies[Q],b.push(Q);if(J.devDependencies[Q]){if(delete J.devDependencies[Q],!b.includes(Q))b.push(Q)}}if(!X&&(V.length>0||q.length>0||b.length>0))xy.writeFileSync(B,JSON.stringify(J,null,2)+`
124
- `,"utf-8");return{updated:V,added:q,removed:b}}import*as Ey from"fs";import*as U0 from"path";function E1(y){let $=/--color-brand-(\d+):\s*([^;]+);/g,j={},z;while((z=$.exec(y))!==null)if(z[1]&&z[2])j[`--color-brand-${z[1]}`]=z[2].trim();return j}function I1(y,$){let j=y;for(let[z,Y]of Object.entries($)){let W=new RegExp(`(${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}):\\s*[^;]+;`,"g");j=j.replace(W,`${z}: ${Y};`)}return j}async function X0(y){let{themePath:$,newThemeContent:j,dryRun:z}=y,Y=U0.resolve($),W;try{W=Ey.readFileSync(Y,"utf-8")}catch{return{brandColors:{},success:!1,message:`Theme file not found at ${Y}`}}let Z=E1(W);if(z)return{brandColors:Z,success:!0,message:`Dry run: found ${Object.keys(Z).length} brand color variables`};try{if(Ey.writeFileSync(Y,j,"utf-8"),Object.keys(Z).length>0){let X=Ey.readFileSync(Y,"utf-8"),B=I1(X,Z);Ey.writeFileSync(Y,B,"utf-8")}return{brandColors:Z,success:!0,message:`Theme upgraded successfully. Preserved ${Object.keys(Z).length} brand color variables.`}}catch(X){let B=X instanceof Error?X.message:String(X);return{brandColors:Z,success:!1,message:`Failed to write theme file: ${B}`}}}var T1=/\bleft-1\/2\b.*-translate-x-1\/2|-translate-x-1\/2.*\bleft-1\/2\b/;function S1(y,$){return $.some((j)=>j.pattern.test(y))}function v1(y,$){let j=y;for(let z of $)z.pattern.lastIndex=0,j=j.replace(z.pattern,z.replace);return j}function F1(y,$,j){let z=[];for(let Y of j){if(Y.pattern.lastIndex=0,Y.pattern.test(y))z.push(Y.description);Y.pattern.lastIndex=0}return z.join("; ")}function B0(y,$,j){let z={file:y,changes:[]},Y=$.split(`
125
- `);for(let W=0;W<Y.length;W++){let Z=Y[W];if(/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(Z))continue;if(T1.test(Z))continue;let X=Z,B=!1;if(X=X.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(V,q,b,J,Q)=>{let U=q??b??J??Q;if(U==null)return V;for(let w of j)w.pattern.lastIndex=0;if(!S1(U,j))return V;for(let w of j)w.pattern.lastIndex=0;let D=v1(U,j);if(D!==U)return B=!0,V.replace(U,D);return V}),B&&X!==Z){let V=F1(Z,X,j);Y[W]=X,z.changes.push({line:W+1,before:Z.trim(),after:X.trim(),description:V})}}return z}function L0(y,$){let j=[],z=y.split(`
126
- `);for(let Y=0;Y<z.length;Y++){let W=z[Y];if(!/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(W))continue;let Z=W;for(let X of $)if(Z.includes(X.from))Z=Z.replace(X.from,X.to);if(Z!==W){z[Y]=Z;let X=$.find((B)=>W.includes(B.from));j.push({line:Y+1,before:W.trim(),after:Z.trim(),description:X?.description??"Import path update"})}}return{content:z.join(`
127
- `),changes:j}}function M0(y,$){let j=[],z=y.split(`
128
- `);for(let Y=0;Y<z.length;Y++){let W=z[Y];if(/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(W))continue;let Z=W;for(let X of $)if(Z.includes(X.from))Z=Z.split(X.from).join(X.to);if(Z!==W){z[Y]=Z;let X=$.find((B)=>W.includes(B.from));j.push({line:Y+1,before:W.trim(),after:Z.trim(),description:X?.description??"Prop update"})}}return{content:z.join(`
129
- `),changes:j}}function V0(y,$,j){let z=[],Y=$.split(`
130
- `);for(let{pattern:W,instruction:Z}of j)for(let X=0;X<Y.length;X++){if(/^\s*(import\b|export\b.*from\b)/.test(Y[X])||/\brequire\s*\(/.test(Y[X]))continue;if(Y[X].includes(W))z.push({file:y,line:X+1,pattern:W,instruction:Z})}return z}function H0(y,$,j){let z=[],Y=$.split(`
131
- `);for(let W=0;W<Y.length;W++)for(let Z of j)if(Y[W].includes(Z))z.push({file:y,line:W+1,token:Z});return z}function C1(y){return{fromVersion:y.fromVersion,toVersion:y.toVersion,classTransforms:y.classRenames.map(($)=>({pattern:new RegExp(`\\b${u1($.from)}\\b`,"g"),replace:$.to,description:$.description,needsReview:$.needsReview})),importTransforms:y.importRenames,propTransforms:y.propRenames,structuralPatterns:y.structuralPatterns,orphanedTokens:y.orphanedTokens,dependencyChanges:y.dependencyChanges,configChanges:y.configChanges,notes:y.notes}}function u1(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function O1(y){let $=l.join(y,"components.json");try{return JSON.parse(i.readFileSync($,"utf-8"))}catch{return null}}function k1(y,$){let j=l.join(y,"components.json");i.writeFileSync(j,JSON.stringify($,null,2)+`
132
- `,"utf-8")}async function g1(y){let $=l.resolve(y);return q0(["**/*.{tsx,ts}"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/.next/**","**/dist/**","**/build/**"]})}async function P1(y){return(await q0(["**/theme.css"],{cwd:y,absolute:!0,deep:5,ignore:["**/node_modules/**","**/.next/**","**/dist/**"]}))[0]}function d1(y){let $=l.join(y,"package.json");return i.existsSync($)?$:void 0}function f1(y){let $=l.join(y,"tsconfig.json");return i.existsSync($)?$:void 0}function c1(y){let $=0;for(let j=0;j<y.length;j++){let z=y.charCodeAt(j);$=($<<5)-$+z|0}return $.toString(36)}var J0=new R1().name("upgrade").description("upgrade your project to the latest version of Untitled UI").option("--dry-run","preview changes without writing files",!1).option("--skip-theme","skip theme.css replacement",!1).option("--skip-deps","skip dependency updates",!1).option("--skip-config","skip config file updates",!1).option("--path <dir>","directory to scan for source files").option("-y, --yes","skip prompts and use defaults",!1).action(async(y)=>{console.log(N.bold(`
120
+ `)),b.forEach(S0),b.length>0){let U=b[0].name;console.log(d.dim(` Install: npx untitledui@latest example ${U} --yes
121
+ `))}}if(q.length>0)console.log(d.bold.underline(`
122
+ Icons (${q.length})
123
+ `)),q.forEach(v0)}catch(X){Z.fail("Search failed"),console.error(d.red(X instanceof Error?X.message:"Unknown error")),process.exit(1)}});import N from"chalk";import{Command as g0}from"commander";import{execa as b$}from"execa";import _$ from"fast-glob";import s from"fs";import a from"ora";import r from"path";import b1 from"prompts";var X1={fromVersion:"7",toVersion:"8",classTransforms:[{pattern:/\bshadow-xs-skeumorphic\b/g,replace:"shadow-xs-skeuomorphic",description:"shadow-xs-skeumorphic → shadow-xs-skeuomorphic (typo fix)"},{pattern:/\bshadow-skeumorphic\b/g,replace:"shadow-skeuomorphic",description:"shadow-skeumorphic → shadow-skeuomorphic (typo fix)"},{pattern:/\butility-gray-blue-/g,replace:"utility-slate-",description:"utility-gray-blue- → utility-slate-"},{pattern:/\butility-blue-light-/g,replace:"utility-sky-",description:"utility-blue-light- → utility-sky-"},{pattern:/\butility-gray-/g,replace:"utility-neutral-",description:"utility-gray- → utility-neutral-"},{pattern:/\butility-error-/g,replace:"utility-red-",description:"utility-error- → utility-red-"},{pattern:/\butility-warning-/g,replace:"utility-yellow-",description:"utility-warning- → utility-yellow-"},{pattern:/\butility-success-/g,replace:"utility-green-",description:"utility-success- → utility-green-"},{pattern:/\boutline-none\b/g,replace:"outline-hidden",description:"outline-none → outline-hidden"},{pattern:/\bbg-disabled_subtle\b/g,replace:"opacity-50",description:"bg-disabled_subtle → opacity-50",needsReview:!0},{pattern:/\bbg-disabled\b/g,replace:"opacity-50",description:"bg-disabled → opacity-50",needsReview:!0},{pattern:/\btext-disabled\b/g,replace:"",description:"text-disabled → removed",needsReview:!0},{pattern:/\bring-disabled_subtle\b/g,replace:"",description:"ring-disabled_subtle → removed",needsReview:!0},{pattern:/\bring-disabled\b/g,replace:"",description:"ring-disabled → removed",needsReview:!0},{pattern:/\bborder-disabled_subtle\b/g,replace:"",description:"border-disabled_subtle → removed",needsReview:!0},{pattern:/\bborder-disabled\b/g,replace:"",description:"border-disabled → removed",needsReview:!0},{pattern:/\btext-fg-disabled_subtle\b/g,replace:"",description:"text-fg-disabled_subtle → removed",needsReview:!0},{pattern:/\btext-fg-disabled\b/g,replace:"",description:"text-fg-disabled → removed",needsReview:!0},{pattern:/\btext-placeholder_subtle\b/g,replace:"",description:"text-placeholder_subtle → removed",needsReview:!0},{pattern:/\btext-button-primary-icon_hover\b/g,replace:"text-white/70",description:"text-button-primary-icon_hover → text-white/70"},{pattern:/\btext-button-primary-icon\b/g,replace:"text-white/60",description:"text-button-primary-icon → text-white/60"},{pattern:/\btext-button-destructive-primary-icon_hover\b/g,replace:"text-white/70",description:"text-button-destructive-primary-icon_hover → text-white/70"},{pattern:/\btext-button-destructive-primary-icon\b/g,replace:"text-white/60",description:"text-button-destructive-primary-icon → text-white/60"},{pattern:/\bbg-avatar-bg\b/g,replace:"bg-tertiary",description:"bg-avatar-bg → bg-tertiary"},{pattern:/\bring-bg-brand-solid\b/g,replace:"ring-brand-solid",description:"ring-bg-brand-solid → ring-brand-solid"},{pattern:/\bbg-active\b/g,replace:"bg-primary_hover",description:"bg-active → bg-primary_hover",needsReview:!0},{pattern:/\bbg-toggle-button-fg_disabled\b/g,replace:"",description:"bg-toggle-button-fg_disabled → removed",needsReview:!0}],importTransforms:[{from:"pin-input/pin-input",to:"input/pin-input",description:"pin-input moved into input directory"},{from:"nav-item-button",to:"nav-button",description:"nav-item-button renamed to nav-button"}],propTransforms:[{from:'color="gray-blue"',to:'color="slate"',description:'color="gray-blue" renamed to color="slate"'},{from:'color="blue-light"',to:'color="sky"',description:'color="blue-light" renamed to color="sky"'}],structuralPatterns:[],orphanedTokens:["bg-disabled_subtle","text-disabled","ring-disabled","border-disabled","text-fg-disabled","bg-avatar-bg","text-button-primary-icon","text-button-destructive-primary-icon","bg-toggle-button-fg_disabled","utility-gray-","utility-error-","utility-warning-","utility-success-","utility-gray-blue-","utility-blue-light-","skeumorphic"],dependencyChanges:{update:{next:"16.2.0",react:"^19.2.4","react-dom":"^19.2.4","react-aria-components":"^1.16.0","react-aria":"^3.47.0",tailwindcss:"^4.2.2",motion:"^12.38.0",recharts:"^3.8.0"},add:{},devUpdate:{storybook:"^10.3.0",vite:"^8.0.0","@vitejs/plugin-react":"^6.0.1",eslint:"^10.0.3",typescript:"^5.9.3"},devAdd:{"@storybook/test-runner":"^0.24.3"},remove:[]},configChanges:{tsconfig:[{description:"Update JSX transform to react-jsx",find:'"jsx": "preserve"',replace:'"jsx": "react-jsx"'}]},notes:["Default size for Select, ComboBox, and Input changed from 'sm' to 'md'. Review component usage.","Avatar size 'xxs' removed. Use 'xs' instead.","Dropdown no longer defaults to selectionMode='single'. Set explicitly if needed."]};import*as Iy from"fs";import*as G$ from"path";function L1(y){let{tsconfigPath:$,changes:j,dryRun:z}=y,Y=G$.resolve($),W=[],Z=[],X;try{X=Iy.readFileSync(Y,"utf-8")}catch{return{applied:W,skipped:j.map((H)=>H.description)}}let L=X;for(let H of j)if(L.includes(H.find))L=L.replace(H.find,H.replace),W.push(H.description);else Z.push(H.description);if(!z&&W.length>0)Iy.writeFileSync(Y,L,"utf-8");return{applied:W,skipped:Z}}function M1(y){let{packageJsonPath:$,update:j,add:z,devUpdate:Y,devAdd:W,remove:Z,dryRun:X}=y,L=G$.resolve($),H=[],B=[],b=[],q;try{let Q=Iy.readFileSync(L,"utf-8");q=JSON.parse(Q)}catch{return{updated:H,added:B,removed:b}}if(!q.dependencies)q.dependencies={};if(!q.devDependencies)q.devDependencies={};for(let[Q,U]of Object.entries(j))if(q.dependencies[Q])q.dependencies[Q]=U,H.push(Q);for(let[Q,U]of Object.entries(z))if(!q.dependencies[Q])q.dependencies[Q]=U,B.push(Q);for(let[Q,U]of Object.entries(Y))if(q.devDependencies[Q])q.devDependencies[Q]=U,H.push(Q);for(let[Q,U]of Object.entries(W))if(!q.devDependencies[Q])q.devDependencies[Q]=U,B.push(Q);for(let Q of Z){if(q.dependencies[Q])delete q.dependencies[Q],b.push(Q);if(q.devDependencies[Q]){if(delete q.devDependencies[Q],!b.includes(Q))b.push(Q)}}if(!X&&(H.length>0||B.length>0||b.length>0))Iy.writeFileSync(L,JSON.stringify(q,null,2)+`
124
+ `,"utf-8");return{updated:H,added:B,removed:b}}import*as Ty from"fs";import*as V1 from"path";function F0(y){let $=/--color-brand-(\d+):\s*([^;]+);/g,j={},z;while((z=$.exec(y))!==null)if(z[1]&&z[2])j[`--color-brand-${z[1]}`]=z[2].trim();return j}function R0(y,$){let j=y;for(let[z,Y]of Object.entries($)){let W=new RegExp(`(${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}):\\s*[^;]+;`,"g");j=j.replace(W,`${z}: ${Y};`)}return j}async function H1(y){let{themePath:$,newThemeContent:j,dryRun:z}=y,Y=V1.resolve($),W;try{W=Ty.readFileSync(Y,"utf-8")}catch{return{brandColors:{},success:!1,message:`Theme file not found at ${Y}`}}let Z=F0(W);if(z)return{brandColors:Z,success:!0,message:`Dry run: found ${Object.keys(Z).length} brand color variables`};try{if(Ty.writeFileSync(Y,j,"utf-8"),Object.keys(Z).length>0){let X=Ty.readFileSync(Y,"utf-8"),L=R0(X,Z);Ty.writeFileSync(Y,L,"utf-8")}return{brandColors:Z,success:!0,message:`Theme upgraded successfully. Preserved ${Object.keys(Z).length} brand color variables.`}}catch(X){let L=X instanceof Error?X.message:String(X);return{brandColors:Z,success:!1,message:`Failed to write theme file: ${L}`}}}var C0=/\bleft-1\/2\b.*-translate-x-1\/2|-translate-x-1\/2.*\bleft-1\/2\b/;function u0(y,$){return $.some((j)=>j.pattern.test(y))}function O0(y,$){let j=y;for(let z of $)z.pattern.lastIndex=0,j=j.replace(z.pattern,z.replace);return j}function k0(y,$,j){let z=[];for(let Y of j){if(Y.pattern.lastIndex=0,Y.pattern.test(y))z.push(Y.description);Y.pattern.lastIndex=0}return z.join("; ")}function K1(y,$,j){let z={file:y,changes:[]},Y=$.split(`
125
+ `);for(let W=0;W<Y.length;W++){let Z=Y[W];if(/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(Z))continue;if(C0.test(Z))continue;let X=Z,L=!1;if(X=X.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(H,B,b,q,Q)=>{let U=B??b??q??Q;if(U==null)return H;for(let _ of j)_.pattern.lastIndex=0;if(!u0(U,j))return H;for(let _ of j)_.pattern.lastIndex=0;let D=O0(U,j);if(D!==U)return L=!0,H.replace(U,D);return H}),L&&X!==Z){let H=k0(Z,X,j);Y[W]=X,z.changes.push({line:W+1,before:Z.trim(),after:X.trim(),description:H})}}return z}function B1(y,$){let j=[],z=y.split(`
126
+ `);for(let Y=0;Y<z.length;Y++){let W=z[Y];if(!/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(W))continue;let Z=W;for(let X of $)if(Z.includes(X.from))Z=Z.replace(X.from,X.to);if(Z!==W){z[Y]=Z;let X=$.find((L)=>W.includes(L.from));j.push({line:Y+1,before:W.trim(),after:Z.trim(),description:X?.description??"Import path update"})}}return{content:z.join(`
127
+ `),changes:j}}function q1(y,$){let j=[],z=y.split(`
128
+ `);for(let Y=0;Y<z.length;Y++){let W=z[Y];if(/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(W))continue;let Z=W;for(let X of $)if(Z.includes(X.from))Z=Z.split(X.from).join(X.to);if(Z!==W){z[Y]=Z;let X=$.find((L)=>W.includes(L.from));j.push({line:Y+1,before:W.trim(),after:Z.trim(),description:X?.description??"Prop update"})}}return{content:z.join(`
129
+ `),changes:j}}function J1(y,$,j){let z=[],Y=$.split(`
130
+ `);for(let{pattern:W,instruction:Z}of j)for(let X=0;X<Y.length;X++){if(/^\s*(import\b|export\b.*from\b)/.test(Y[X])||/\brequire\s*\(/.test(Y[X]))continue;if(Y[X].includes(W))z.push({file:y,line:X+1,pattern:W,instruction:Z})}return z}function G1(y,$,j){let z=[],Y=$.split(`
131
+ `);for(let W=0;W<Y.length;W++)for(let Z of j)if(Y[W].includes(Z))z.push({file:y,line:W+1,token:Z});return z}function P0(y){return{fromVersion:y.fromVersion,toVersion:y.toVersion,classTransforms:y.classRenames.map(($)=>({pattern:new RegExp(`\\b${D1($.from)}\\b`,"g"),replace:$.to,description:$.description,needsReview:$.needsReview})),importTransforms:y.importRenames,propTransforms:y.propRenames,structuralPatterns:y.structuralPatterns,orphanedTokens:y.orphanedTokens,dependencyChanges:y.dependencyChanges,configChanges:y.configChanges,notes:y.notes}}function D1(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d0(y){let $=r.join(y,"components.json");try{return JSON.parse(s.readFileSync($,"utf-8"))}catch{return null}}function f0(y,$){let j=r.join(y,"components.json");s.writeFileSync(j,JSON.stringify($,null,2)+`
132
+ `,"utf-8")}async function _1(y){let $=r.resolve(y);return _$(["**/*.{tsx,ts}"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/.next/**","**/dist/**","**/build/**"]})}async function c0(y){return(await _$(["**/theme.css"],{cwd:y,absolute:!0,deep:5,ignore:["**/node_modules/**","**/.next/**","**/dist/**"]}))[0]}function h0(y){let $=r.join(y,"package.json");return s.existsSync($)?$:void 0}function m0(y){let $=r.join(y,"tsconfig.json");return s.existsSync($)?$:void 0}function l0(y){let $=0;for(let j=0;j<y.length;j++){let z=y.charCodeAt(j);$=($<<5)-$+z|0}return $.toString(36)}var N1=new g0().name("upgrade").description("upgrade your project to the latest version of Untitled UI").option("--dry-run","preview changes without writing files",!1).option("--skip-theme","skip theme.css replacement",!1).option("--skip-deps","skip dependency updates",!1).option("--skip-config","skip config file updates",!1).option("--path <dir>","directory to scan for source files").option("-y, --yes","skip prompts and use defaults",!1).action(async(y)=>{console.log(N.bold(`
133
133
  Upgrade Untitled UI
134
- `));let $=l.resolve(y.path||".");try{let{stdout:M}=await q$("git",["status","--porcelain"],{cwd:$});if(M.trim().length>0){if(console.log(N.yellow(" You have uncommitted changes. We recommend committing first so you can\n revert with `git checkout .` if needed.")),!y.yes){let{proceed:L}=await K0({type:"confirm",name:"proceed",message:"Continue with uncommitted changes?",initial:!0});if(!L){console.log(N.yellow(`
134
+ `));let $=r.resolve(y.path||".");try{let{stdout:M}=await b$("git",["status","--porcelain"],{cwd:$});if(M.trim().length>0){if(console.log(N.yellow(" You have uncommitted changes. We recommend committing first so you can\n revert with `git checkout .` if needed.")),!y.yes){let{proceed:V}=await b1({type:"confirm",name:"proceed",message:"Continue with uncommitted changes?",initial:!0});if(!V){console.log(N.yellow(`
135
135
  Cancelled.
136
- `));return}}console.log()}}catch{}let j=O1($),z=j?.version??"7";if(console.log(` Detected version: ${N.cyan(z)}
136
+ `));return}}console.log()}}catch{}let j=d0($),z=j?.version??"7";if(console.log(` Detected version: ${N.cyan(z)}
137
137
  `),z==="8"){console.log(N.green(` Already on version 8. Nothing to upgrade.
138
- `));return}let Y,W,Z=a(" Fetching migration rules...").start();try{let M=await fetch("https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/upgrade",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fromVersion:z,toVersion:"8"})});if(!M.ok)throw Error(`Server returned ${M.status}`);let L=await M.json();Y=C1(L),W="server",Z.succeed(" Migration rules fetched from server")}catch{Y=Q0,W="built-in",Z.warn(" Could not reach server. Using built-in migration rules")}let X=a(" Scanning files...").start(),B=await g1($);X.succeed(` Found ${N.bold(B.length)} source files`);let V=0,q=0,b=0,J=0,Q=[],U=[],D=[],w=[];if(!y.skipTheme){let M=a(" Upgrading theme.css...").start(),L=await P1($);if(L)try{let K=l.resolve(import.meta.dirname,"../config/styles/theme.css"),_=i.readFileSync(K,"utf-8"),x=await X0({themePath:L,newThemeContent:_,dryRun:y.dryRun});if(x.success){let T=Object.keys(x.brandColors);if(T.length>0)M.succeed(` Theme upgraded. Brand colors preserved: ${N.cyan(T.join(", "))}`);else M.succeed(" Theme upgraded (no custom brand colors found)")}else M.warn(` Theme upgrade issue: ${x.message}`)}catch(K){let _=K instanceof Error?K.message:String(K);M.warn(` Theme upgrade skipped: ${_}`)}else M.warn(" No theme.css found — skipping theme upgrade")}if(!y.skipConfig){let M=a(" Updating config files...").start(),L=f1($);if(L&&Y.configChanges.tsconfig.length>0){let{applied:K,skipped:_}=W0({tsconfigPath:L,changes:Y.configChanges.tsconfig,dryRun:y.dryRun});if(K.length>0)M.succeed(` Config updated: ${K.map((x)=>N.cyan(x)).join(", ")}`);else M.info(" No config changes needed");if(_.length>0)for(let x of _)console.log(N.dim(` Skipped: ${x}`))}else M.info(" No config changes to apply")}if(!y.skipDeps){let M=a(" Updating dependencies...").start(),L=d1($);if(L){let K=Z0({packageJsonPath:L,update:Y.dependencyChanges.update,add:Y.dependencyChanges.add,devUpdate:Y.dependencyChanges.devUpdate,devAdd:Y.dependencyChanges.devAdd,remove:Y.dependencyChanges.remove,dryRun:y.dryRun});if(K.updated.length+K.added.length+K.removed.length>0){if(M.succeed(" Dependencies updated in package.json"),K.updated.length>0)console.log(N.dim(` Updated: ${K.updated.join(", ")}`));if(K.added.length>0)console.log(N.dim(` Added: ${K.added.join(", ")}`));if(K.removed.length>0)console.log(N.dim(` Removed: ${K.removed.join(", ")}`));if(!y.dryRun){let x=a(" Installing dependencies...").start();try{let T=zy();await q$(T==="bunx"?"bun":T==="pnpx"?"pnpm":T==="yarn"?"yarn":"npm",["install"],{cwd:$}),x.succeed(" Dependencies installed")}catch(T){let f=T instanceof Error?T.message:String(T);x.warn(` Could not auto-install dependencies: ${f.substring(0,100)}`),console.log(N.dim(" Run your package manager's install command manually."))}}}else M.info(" No dependency changes needed")}else M.warn(" No package.json found — skipping dependency updates")}let E=a(" Applying source transforms...").start();for(let M of B){let L;try{L=i.readFileSync(M,"utf-8")}catch{continue}let K=l.relative($,M),_=L,x=!1,T=B0(K,_,Y.classTransforms);if(T.changes.length>0){let Iy=_.split(`
139
- `);for(let p of T.changes){let Gy=p.line-1,c=Iy[Gy];c=c.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(by,G0,b0,_0,w0)=>{let Fy=G0??b0??_0??w0;if(Fy==null)return by;let Ry=Fy;for(let ry of Y.classTransforms)ry.pattern.lastIndex=0,Ry=Ry.replace(ry.pattern,ry.replace);return Ry!==Fy?by.replace(Fy,Ry):by}),Iy[Gy]=c}_=Iy.join(`
140
- `),V+=T.changes.length,x=!0,Q.push(T);for(let p of T.changes){let Gy=Y.classTransforms.find((c)=>{return c.pattern.lastIndex=0,c.needsReview&&c.pattern.test(p.before)});for(let c of Y.classTransforms)c.pattern.lastIndex=0;if(Gy)U.push({file:K,line:p.line,description:p.description,before:p.before,after:p.after})}}let f=M0(_,Y.propTransforms);if(f.changes.length>0)_=f.content,q+=f.changes.length,x=!0;let n=L0(_,Y.importTransforms);if(n.changes.length>0)_=n.content,b+=n.changes.length,x=!0;if(x){if(J++,!y.dryRun)i.writeFileSync(M,_)}}E.succeed(` Processed ${N.bold(B.length)} files`);let I=a(" Detecting structural patterns...").start();for(let M of B){let L;try{L=i.readFileSync(M,"utf-8")}catch{continue}let K=l.relative($,M),_=V0(K,L,Y.structuralPatterns);w.push(..._)}if(w.length>0)I.warn(` Found ${N.bold(w.length)} structural patterns requiring manual review`);else I.succeed(" No structural patterns found");if(j?.components&&Array.isArray(j.components)&&j.components.some((M)=>M.contentHash)){let M=a(" Checking stock components...").start(),L=[];for(let K of j.components){if(!K.contentHash||!K.filePath)continue;let _=l.resolve($,K.filePath);try{let x=i.readFileSync(_,"utf-8");if(c1(x)===K.contentHash)L.push({name:K.name,path:K.filePath})}catch{}}if(L.length>0){M.info(` ${N.bold(L.length)} stock components can be auto-refreshed`);let K=y.yes;if(!K){let{confirm:_}=await K0({type:"confirm",name:"confirm",message:`Refresh ${L.length} unmodified stock components to v8.0?`,initial:!0});K=_}if(K&&!y.dryRun){let _=a(" Fetching v8.0 components...").start();try{let x=await fetch("https://untitledui-docs-git-v8-dilshod-turobovs-projects.vercel.app/react/api/components",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({components:L.map((T)=>T.name),version:"8"})});if(x.ok){let T=await x.json(),f=0;for(let n of L)if(T[n.name])i.writeFileSync(l.resolve($,n.path),T[n.name]),f++;_.succeed(` Refreshed ${N.bold(f)} stock components`)}else _.warn(" Could not fetch v8.0 components from server")}catch{_.warn(" Could not reach server for component refresh")}}}else M.info(" No unmodified stock components to refresh")}let S=a(" Scanning for orphaned tokens...").start();for(let M of B){let L;try{L=i.readFileSync(M,"utf-8")}catch{continue}let K=l.relative($,M),_=H0(K,L,Y.orphanedTokens);D.push(..._)}if(D.length>0)S.warn(` Found ${N.bold(D.length)} orphaned v7.0 tokens remaining`);else S.succeed(" No orphaned tokens found");let v=[];if(!y.dryRun){let M=a(" Running type check...").start();try{let L=zy();await q$(L,["tsc","--noEmit"],{cwd:$}),M.succeed(" Type check passed")}catch(L){let _=(L?.stderr||L?.stdout||"").split(`
141
- `).filter((x)=>x.includes("error TS")).slice(0,20);v.push(..._),M.warn(` Type check found ${N.bold(_.length)} error(s)`)}}if(!y.dryRun){let M={version:"8",status:U.length>0||D.length>0?"partial":"success",filesScanned:B.length,filesModified:J,classChanges:V,propChanges:q,importChanges:b,manualReview:U,orphanedTokens:D,typeErrors:v,structuralPatterns:w,notes:Y.notes};try{i.writeFileSync(l.join($,"upgrade-report.json"),JSON.stringify(M,null,2)+`
142
- `,"utf-8")}catch{}if(U.length>0||w.length>0)try{let L=`# Untitled UI v7.0 to v8.0 Upgrade Instructions
138
+ `));return}let Y,W,Z=a(" Fetching migration rules...").start();try{let M=await fetch("http://localhost:3000/react/api/upgrade",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fromVersion:z,toVersion:"8"})});if(!M.ok)throw Error(`Server returned ${M.status}`);let V=await M.json();Y=P0(V),W="server",Z.succeed(" Migration rules fetched from server")}catch{Y=X1,W="built-in",Z.warn(" Could not reach server. Using built-in migration rules")}let X=a(" Scanning files...").start(),L=await _1($);X.succeed(` Found ${N.bold(L.length)} source files`);let H=0,B=0,b=0,q=0,Q=[],U=[],D=[],_=[];if(!y.skipTheme){let M=a(" Upgrading theme.css...").start(),V=await c0($);if(V)try{let J=r.resolve(import.meta.dirname,"../config/styles/theme.css"),A=s.readFileSync(J,"utf-8"),u=await H1({themePath:V,newThemeContent:A,dryRun:y.dryRun});if(u.success){let k=Object.keys(u.brandColors);if(k.length>0)M.succeed(` Theme upgraded. Brand colors preserved: ${N.cyan(k.join(", "))}`);else M.succeed(" Theme upgraded (no custom brand colors found)")}else M.warn(` Theme upgrade issue: ${u.message}`)}catch(J){let A=J instanceof Error?J.message:String(J);M.warn(` Theme upgrade skipped: ${A}`)}else M.warn(" No theme.css found — skipping theme upgrade")}if(!y.skipConfig){let M=a(" Updating config files...").start(),V=m0($);if(V&&Y.configChanges.tsconfig.length>0){let{applied:J,skipped:A}=L1({tsconfigPath:V,changes:Y.configChanges.tsconfig,dryRun:y.dryRun});if(J.length>0)M.succeed(` Config updated: ${J.map((u)=>N.cyan(u)).join(", ")}`);else M.info(" No config changes needed");if(A.length>0)for(let u of A)console.log(N.dim(` Skipped: ${u}`))}else M.info(" No config changes to apply")}if(!y.skipDeps){let M=a(" Updating dependencies...").start(),V=h0($);if(V){let J=M1({packageJsonPath:V,update:Y.dependencyChanges.update,add:Y.dependencyChanges.add,devUpdate:Y.dependencyChanges.devUpdate,devAdd:Y.dependencyChanges.devAdd,remove:Y.dependencyChanges.remove,dryRun:y.dryRun});if(J.updated.length+J.added.length+J.removed.length>0){if(M.succeed(" Dependencies updated in package.json"),J.updated.length>0)console.log(N.dim(` Updated: ${J.updated.join(", ")}`));if(J.added.length>0)console.log(N.dim(` Added: ${J.added.join(", ")}`));if(J.removed.length>0)console.log(N.dim(` Removed: ${J.removed.join(", ")}`));if(!y.dryRun){let u=a(" Installing dependencies...").start();try{let k=Zy();await b$(k==="bunx"?"bun":k==="pnpx"?"pnpm":k==="yarn"?"yarn":"npm",["install"],{cwd:$}),u.succeed(" Dependencies installed")}catch(k){let p=k instanceof Error?k.message:String(k);u.warn(` Could not auto-install dependencies: ${p.substring(0,100)}`),console.log(N.dim(" Run your package manager's install command manually."))}}}else M.info(" No dependency changes needed")}else M.warn(" No package.json found — skipping dependency updates")}let x=a(" Renaming files...").start(),E=new Set;for(let M of Y.importTransforms){let V=M.from.split("/").pop(),J=M.to.split("/").pop();if(V===J)continue;let A=_$.sync([`**/${V}.tsx`,`**/${V}.ts`],{cwd:$,absolute:!0,ignore:["**/node_modules/**"]});for(let u of A){let k=u.replace(new RegExp(`${D1(V)}(\\.tsx?)$`),`${J}$1`);if(!y.dryRun)try{s.renameSync(u,k),E.add(M.from)}catch{}else E.add(M.from)}}let S=Y.importTransforms.filter((M)=>{let V=M.from.split("/").pop(),J=M.to.split("/").pop();if(V===J)return!0;return E.has(M.from)});if(E.size>0)x.succeed(` Renamed ${N.bold(E.size)} files`),L.length=0,L.push(...await _1($));else x.info(" No file renames needed");let F=a(" Applying source transforms...").start();for(let M of L){let V;try{V=s.readFileSync(M,"utf-8")}catch{continue}let J=r.relative($,M),A=V,u=!1,k=K1(J,A,Y.classTransforms);if(k.changes.length>0){let yy=A.split(`
139
+ `);for(let t of k.changes){let Ry=t.line-1,$y=yy[Ry];$y=$y.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(oy,w1,A1,x1,E1)=>{let Cy=w1??A1??x1??E1;if(Cy==null)return oy;let uy=Cy;for(let ay of Y.classTransforms)ay.pattern.lastIndex=0,uy=uy.replace(ay.pattern,ay.replace);return uy!==Cy?oy.replace(Cy,uy):oy}),yy[Ry]=$y}A=yy.join(`
140
+ `),H+=k.changes.length,u=!0,Q.push(k);for(let t of k.changes){let Ry=Y.classTransforms.find(($y)=>{return $y.pattern.lastIndex=0,$y.needsReview&&$y.pattern.test(t.before)});for(let $y of Y.classTransforms)$y.pattern.lastIndex=0;if(Ry)U.push({file:J,line:t.line,description:t.description,before:t.before,after:t.after})}}let p=q1(A,Y.propTransforms);if(p.changes.length>0)A=p.content,B+=p.changes.length,u=!0;let e=B1(A,S);if(e.changes.length>0)A=e.content,b+=e.changes.length,u=!0;if(u){if(q++,!y.dryRun)s.writeFileSync(M,A)}}F.succeed(` Processed ${N.bold(L.length)} files`);let I=a(" Detecting structural patterns...").start();for(let M of L){let V;try{V=s.readFileSync(M,"utf-8")}catch{continue}let J=r.relative($,M),A=J1(J,V,Y.structuralPatterns);_.push(...A)}if(_.length>0)I.warn(` Found ${N.bold(_.length)} structural patterns requiring manual review`);else I.succeed(" No structural patterns found");if(j?.components&&Array.isArray(j.components)&&j.components.some((M)=>M.contentHash)){let M=a(" Checking stock components...").start(),V=[];for(let J of j.components){if(!J.contentHash||!J.filePath)continue;let A=r.resolve($,J.filePath);try{let u=s.readFileSync(A,"utf-8");if(l0(u)===J.contentHash)V.push({name:J.name,path:J.filePath})}catch{}}if(V.length>0){M.info(` ${N.bold(V.length)} stock components can be auto-refreshed`);let J=y.yes;if(!J){let{confirm:A}=await b1({type:"confirm",name:"confirm",message:`Refresh ${V.length} unmodified stock components to v8.0?`,initial:!0});J=A}if(J&&!y.dryRun){let A=a(" Fetching v8.0 components...").start();try{let u=await fetch("http://localhost:3000/react/api/components",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({components:V.map((k)=>k.name),version:"8"})});if(u.ok){let k=await u.json(),p=0;for(let e of V)if(k[e.name])s.writeFileSync(r.resolve($,e.path),k[e.name]),p++;A.succeed(` Refreshed ${N.bold(p)} stock components`)}else A.warn(" Could not fetch v8.0 components from server")}catch{A.warn(" Could not reach server for component refresh")}}}else M.info(" No unmodified stock components to refresh")}let T=a(" Scanning for orphaned tokens...").start();for(let M of L){let V;try{V=s.readFileSync(M,"utf-8")}catch{continue}let J=r.relative($,M),A=G1(J,V,Y.orphanedTokens);D.push(...A)}if(D.length>0)T.warn(` Found ${N.bold(D.length)} orphaned v7.0 tokens remaining`);else T.succeed(" No orphaned tokens found");let R=[];if(!y.dryRun){let M=a(" Running type check...").start();try{let V=Zy();await b$(V,["tsc","--noEmit"],{cwd:$}),M.succeed(" Type check passed")}catch(V){let A=(V?.stderr||V?.stdout||"").split(`
141
+ `).filter((u)=>u.includes("error TS")).slice(0,20);R.push(...A),M.warn(` Type check found ${N.bold(A.length)} error(s)`)}}if(!y.dryRun){let M={version:"8",status:U.length>0||D.length>0?"partial":"success",filesScanned:L.length,filesModified:q,classChanges:H,propChanges:B,importChanges:b,manualReview:U,orphanedTokens:D,typeErrors:R,structuralPatterns:_,notes:Y.notes};try{s.writeFileSync(r.join($,"upgrade-report.json"),JSON.stringify(M,null,2)+`
142
+ `,"utf-8")}catch{}if(U.length>0||_.length>0)try{let V=`# Untitled UI v7.0 to v8.0 Upgrade Instructions
143
143
 
144
- `;if(L+="This file was generated by `untitledui upgrade`. It is meant to guide\n",L+=`manual review of changes that could not be fully automated.
144
+ `;if(V+="This file was generated by `untitledui upgrade`. It is meant to guide\n",V+=`manual review of changes that could not be fully automated.
145
145
 
146
- `,L+=`**Important**: Ignore pre-existing type errors and linting issues.
147
- `,L+=`Focus only on migration-related changes listed below.
146
+ `,V+=`**Important**: Ignore pre-existing type errors and linting issues.
147
+ `,V+=`Focus only on migration-related changes listed below.
148
148
 
149
- `,L+=`Delete this file after review is complete.
149
+ `,V+=`Delete this file after review is complete.
150
150
 
151
- `,w.length>0){L+=`## Structural changes
151
+ `,_.length>0){V+=`## Structural changes
152
152
 
153
- `,L+=`These patterns require manual refactoring:
153
+ `,V+=`These patterns require manual refactoring:
154
154
 
155
- `;for(let K of w)L+=`- **${K.file}:${K.line}** — \`${K.pattern}\`
156
- `,L+=` ${K.instruction}
155
+ `;for(let J of _)V+=`- **${J.file}:${J.line}** — \`${J.pattern}\`
156
+ `,V+=` ${J.instruction}
157
157
 
158
- `}if(U.length>0){L+=`## Manual review items
158
+ `}if(U.length>0){V+=`## Manual review items
159
159
 
160
- `,L+=`These class replacements may need manual verification:
160
+ `,V+=`These class replacements may need manual verification:
161
161
 
162
- `;for(let K of U)L+=`### ${K.file}:${K.line}
162
+ `;for(let J of U)V+=`### ${J.file}:${J.line}
163
163
 
164
- `,L+=`${K.description}
164
+ `,V+=`${J.description}
165
165
 
166
- `,L+="```diff\n",L+=`- ${K.before}
167
- `,L+=`+ ${K.after}
168
- `,L+="```\n\n"}if(Y.notes.length>0){L+=`## Additional notes
166
+ `,V+="```diff\n",V+=`- ${J.before}
167
+ `,V+=`+ ${J.after}
168
+ `,V+="```\n\n"}if(Y.notes.length>0){V+=`## Additional notes
169
169
 
170
- `;for(let K of Y.notes)L+=`- ${K}
171
- `;L+=`
172
- `}i.writeFileSync(l.join($,"UPGRADE-INSTRUCTIONS.md"),L,"utf-8")}catch{}}if(!y.dryRun&&j)j.version="8",k1($,j);if(console.log(N.bold(`
170
+ `;for(let J of Y.notes)V+=`- ${J}
171
+ `;V+=`
172
+ `}s.writeFileSync(r.join($,"UPGRADE-INSTRUCTIONS.md"),V,"utf-8")}catch{}}if(!y.dryRun&&j)j.version="8",f0($,j);if(console.log(N.bold(`
173
173
  Summary
174
- `)),console.log(` Migration source: ${N.cyan(W)}`),console.log(` Files scanned: ${N.cyan(B.length)}`),console.log(` Files modified: ${N.cyan(J)}`),console.log(` Class changes: ${N.cyan(V)}`),console.log(` Prop changes: ${N.cyan(q)}`),console.log(` Import changes: ${N.cyan(b)}`),w.length>0){console.log(` Structural patterns: ${N.yellow(w.length)}`);for(let M of w.slice(0,5))console.log(N.dim(` ${M.file}:${M.line} — ${M.pattern}`));if(w.length>5)console.log(N.dim(` ... and ${w.length-5} more (see UPGRADE-INSTRUCTIONS.md)`))}if(U.length>0){console.log(` Manual review items: ${N.yellow(U.length)}`);for(let M of U.slice(0,5))console.log(N.dim(` ${M.file}:${M.line} — ${M.description}`));if(U.length>5)console.log(N.dim(` ... and ${U.length-5} more (see UPGRADE-INSTRUCTIONS.md)`))}if(D.length>0){console.log(` Orphaned tokens: ${N.yellow(D.length)}`);let M=[...new Set(D.map((L)=>L.token))];for(let L of M.slice(0,5))console.log(N.dim(` ${L}`));if(M.length>5)console.log(N.dim(` ... and ${M.length-5} more`))}if(v.length>0)console.log(` Type errors: ${N.yellow(v.length)}`);if(y.dryRun){if(console.log(N.yellow(`
174
+ `)),console.log(` Migration source: ${N.cyan(W)}`),console.log(` Files scanned: ${N.cyan(L.length)}`),console.log(` Files modified: ${N.cyan(q)}`),console.log(` Class changes: ${N.cyan(H)}`),console.log(` Prop changes: ${N.cyan(B)}`),console.log(` Import changes: ${N.cyan(b)}`),_.length>0){console.log(` Structural patterns: ${N.yellow(_.length)}`);for(let M of _.slice(0,5))console.log(N.dim(` ${M.file}:${M.line} — ${M.pattern}`));if(_.length>5)console.log(N.dim(` ... and ${_.length-5} more (see UPGRADE-INSTRUCTIONS.md)`))}if(U.length>0){console.log(` Manual review items: ${N.yellow(U.length)}`);for(let M of U.slice(0,5))console.log(N.dim(` ${M.file}:${M.line} — ${M.description}`));if(U.length>5)console.log(N.dim(` ... and ${U.length-5} more (see UPGRADE-INSTRUCTIONS.md)`))}if(D.length>0){console.log(` Orphaned tokens: ${N.yellow(D.length)}`);let M=[...new Set(D.map((V)=>V.token))];for(let V of M.slice(0,5))console.log(N.dim(` ${V}`));if(M.length>5)console.log(N.dim(` ... and ${M.length-5} more`))}if(R.length>0)console.log(` Type errors: ${N.yellow(R.length)}`);if(y.dryRun){if(console.log(N.yellow(`
175
175
  Dry run — no files were modified.`)),Q.length>0){console.log(N.bold(`
176
176
  Changes preview:
177
- `));for(let M of Q.slice(0,10)){console.log(N.dim(` ${M.file}`));for(let L of M.changes.slice(0,3))console.log(N.red(` - ${L.before.substring(0,100)}`)),console.log(N.green(` + ${L.after.substring(0,100)}`));if(M.changes.length>3)console.log(N.dim(` ... and ${M.changes.length-3} more`))}if(Q.length>10)console.log(N.dim(`
177
+ `));for(let M of Q.slice(0,10)){console.log(N.dim(` ${M.file}`));for(let V of M.changes.slice(0,3))console.log(N.red(` - ${V.before.substring(0,100)}`)),console.log(N.green(` + ${V.after.substring(0,100)}`));if(M.changes.length>3)console.log(N.dim(` ... and ${M.changes.length-3} more`))}if(Q.length>10)console.log(N.dim(`
178
178
  ... and ${Q.length-10} more files`))}console.log(N.dim(`
179
179
  Run without --dry-run to apply changes.
180
- `))}else console.log(N.green("\n Done! Run `bun run build` to verify.")),console.log(N.dim(" If something went wrong, run `git checkout .` to revert.\n"))});var J$={name:"untitledui",version:"0.1.56-beta.0",main:"dist/index.mjs",description:"The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",type:"module",publishConfig:{access:"public"},scripts:{test:"bun test __tests__/",dev:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/react/api --watch",build:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://www.untitledui.com/react/api","publish:npm":"bun run build && npm publish --access public",start:"node dist/index.mjs"},bugs:{url:"https://github.com/untitleduico/react/issues"},homepage:"https://github.com/untitleduico/react#readme",repository:{type:"git",url:"https://github.com/untitleduico/react.git",directory:"cli"},engines:{node:">=18"},keywords:["untitledui","untitled-ui","untitledui-cli","untitledui-react","untitledui-components","untitledui-examples","untitledui-vite","untitledui-nextjs","cli","tailwindcss","nextjs","react","components","examples","vite"],files:["dist","config","templates","README.md"],author:{name:"Untitled UI",url:"https://www.untitledui.com/react"},contributors:[{name:"Dilshod Turobov",url:"https://x.com/deebovv"},{name:"Jordan Hughes",url:"https://x.com/jordanphughes"}],license:"MIT",bin:{untitledui:"dist/index.mjs"},exports:"./dist/index.mjs",dependencies:{"async-retry":"^1.3.3",chalk:"^5.6.2",commander:"^13.1.0",execa:"^7.2.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",open:"^10.2.0",ora:"^8.2.0",prettier:"^3.7.4",prompts:"^2.4.2",tar:"^7.5.2","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/bun":"^1.3.10","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.41.0",typescript:"^5.9.3"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function l1(){let y=new m1().name(J$.name).version(J$.version);y.addCommand(o$).addCommand(f$).addCommand(n$).addCommand(Y0).addCommand(m$).addCommand(z0).addCommand(J0),y.parse()}l1();
180
+ `))}else console.log(N.green("\n Done! Run `bun run build` to verify.")),console.log(N.dim(" If something went wrong, run `git checkout .` to revert.\n"))});var D$={name:"untitledui",version:"0.1.56-beta.1",main:"dist/index.mjs",description:"The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",type:"module",publishConfig:{access:"public"},scripts:{test:"bun test __tests__/",dev:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/react/api --watch",build:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://www.untitledui.com/react/api","publish:npm":"bun run build && npm publish --access public",start:"node dist/index.mjs"},bugs:{url:"https://github.com/untitleduico/react/issues"},homepage:"https://github.com/untitleduico/react#readme",repository:{type:"git",url:"https://github.com/untitleduico/react.git",directory:"cli"},engines:{node:">=18"},keywords:["untitledui","untitled-ui","untitledui-cli","untitledui-react","untitledui-components","untitledui-examples","untitledui-vite","untitledui-nextjs","cli","tailwindcss","nextjs","react","components","examples","vite"],files:["dist","config","templates","README.md"],author:{name:"Untitled UI",url:"https://www.untitledui.com/react"},contributors:[{name:"Dilshod Turobov",url:"https://x.com/deebovv"},{name:"Jordan Hughes",url:"https://x.com/jordanphughes"}],license:"MIT",bin:{untitledui:"dist/index.mjs"},exports:"./dist/index.mjs",dependencies:{"async-retry":"^1.3.3",chalk:"^5.6.2",commander:"^13.1.0",execa:"^7.2.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",open:"^10.2.0",ora:"^8.2.0",prettier:"^3.7.4",prompts:"^2.4.2",tar:"^7.5.2","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/bun":"^1.3.10","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.41.0",typescript:"^5.9.3"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function i0(){let y=new r0().name(D$.name).version(D$.version);y.addCommand(e$).addCommand(l$).addCommand(y1).addCommand(U1).addCommand(i$).addCommand(Z1).addCommand(N1),y.parse()}i0();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "untitledui",
3
- "version": "0.1.56-beta.0",
3
+ "version": "0.1.56-beta.1",
4
4
  "main": "dist/index.mjs",
5
5
  "description": "The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",
6
6
  "type": "module",