untitledui 0.1.56-beta.1 → 0.1.56

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.
@@ -4,7 +4,7 @@ export interface MigrationDefinition {
4
4
  fromVersion: string;
5
5
  toVersion: string;
6
6
  classTransforms: TransformRule[];
7
- importTransforms: { from: string; to: string; description: string }[];
7
+ importTransforms: { from: string; to: string; description: string; symbolRenames?: { from: string; to: string }[] }[];
8
8
  propTransforms: { from: string; to: string; description: string }[];
9
9
  structuralPatterns: { pattern: string; instruction: string }[];
10
10
  orphanedTokens: string[];
@@ -197,6 +197,12 @@ export const migration: MigrationDefinition = {
197
197
  to: "nav-button",
198
198
  description: "nav-item-button renamed to nav-button",
199
199
  },
200
+ {
201
+ from: "select/multi-select",
202
+ to: "select/tag-select",
203
+ description: "multi-select renamed to tag-select (new multi-select is a different component)",
204
+ symbolRenames: [{ from: "MultiSelect", to: "TagSelect" }],
205
+ },
200
206
  ],
201
207
 
202
208
  propTransforms: [
@@ -275,6 +281,7 @@ export const migration: MigrationDefinition = {
275
281
  },
276
282
 
277
283
  notes: [
284
+ "The v7 MultiSelect (tag-chip style) has been renamed to TagSelect. The new MultiSelect is a different component with autocomplete. Update your imports accordingly.",
278
285
  "Default size for Select, ComboBox, and Input changed from 'sm' to 'md'. Review component usage.",
279
286
  "Avatar size 'xxs' removed. Use 'xs' instead.",
280
287
  "Dropdown no longer defaults to selectionMode='single'. Set explicitly if needed.",
package/dist/index.mjs CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
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(`
2
+ import{Command as r1}from"commander";import C from"chalk";import{Command as s0}from"commander";import*as i from"fs";import vy from"ora";import*as h from"path";import Jy from"prompts";import{Project as r0}from"ts-morph";import*as jy from"fs";import*as py from"path";import I0 from"os";var N$=py.join(I0.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 T0 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 T0("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 E$(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 x$(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 O0}from"ts-morph";import{loadConfig as k$}from"tsconfig-paths";import v0 from"prettier";async function T$(y,$="typescript"){try{return await v0.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 gy}from"tsconfig-paths";import v$ from"fs";import S0 from"path";function S$(y=""){let $=S0.join(y,"package.json");if(!v$.existsSync($))return null;else return JSON.parse(v$.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"],Py=!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}),F0(y),C0(y),u0(y),S$(y)]),U=Qy.existsSync(Yy.resolve(y,"components.json")),V=null;if(U)V=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:V?.examples||void 0,aliases:V?.aliases||Z||{},paths:await R0(V?.aliases||{})||{},isTsx:Y,isSrcDir:$,isAppDir:j,isComponentsJson:!!U,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 F0(y){return(await Vy.glob("tsconfig.*",{cwd:y,deep:2,ignore:l})).length>0}async function R0(y){let $={},j=[],z=Object.entries(y).filter(([,U])=>U);if(z.length===0)return null;let Y=process.cwd(),Z=gy(Y).resultType==="success",X=await O$(Y);if(!X){if(!Py){if(Py=!0,process.stdout.write("\r\x1B[K"),Z)console.log(zy.yellow(`
3
3
  ⚠ Could not resolve path aliases from components.json - no paths configured in tsconfig.json.`));else console.log(zy.yellow(`
4
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(`
5
+ `)),z.forEach(([U,V])=>{console.log(zy.dim(` ${U}: ${V}`))}),console.log(zy.dim(`
6
6
  To fix this, add matching paths to your tsconfig.json.
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(`
7
+ `))}return null}for(let[U,V]of Object.entries(y))if(V){let B=await C$(V.replace(/\/\*$/,""),X);if(B)$[U]=Yy.relative(process.cwd(),B);else j.push(`${U}: ${V}`)}if(j.length>0&&!Py)Py=!0,process.stdout.write("\r\x1B[K"),console.log(zy.yellow(`
8
+ ⚠ Could not resolve the following path aliases from tsconfig.json:`)),j.forEach((U)=>{console.log(zy.dim(` ${U}`))}),console.log(zy.dim(`
9
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>
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=gy(y);else if(Y){if(W=gy(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 V=function(q){return q.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/,(\s*[}\]])/g,"$1")},U=Qy.readFileSync(X,"utf-8"),B=V(U),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=gy(y);if(!W||W?.resultType==="failed"||!Object.keys(W.paths).length)return null;return W}async function C0(y){let $=await Vy.glob("tailwind.config.*",{cwd:y,deep:2,ignore:l});if(!$.length)return null;return $[0]}async function u0(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,U]of Object.entries(z))if(W.some((V)=>U.test(V))){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 P$(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 V=new O0,B=await T$(Z,"json");return V.createSourceFile(z.configFileAbsolutePath,B,{overwrite:!0}),await V.save(),Y}return Y||null}function g$(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 k0(j)}catch{return!1}}function k0(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 P0=["npm","config","user","agent"].join("_");function qy(y){if(y===void 0)y=process.env[P0]||"";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 g0 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(),V=[X==="npm"?"install":"add",...Y?["-D"]:[],...j];W.start(`Installing ${Z}`),await g0(()=>f$(X,V,{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,[...V,"--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 d0,pipeline as f0}from"stream";import{x as c0}from"tar";import{promisify as h0}from"util";var m0=h0(f0);async function h$(y,$){try{let j=await l0($);await m0(j,c0({cwd:y,strip:1}))}catch(j){throw Error(`Failed to download or extract repository from API: ${j instanceof Error?j.message:j}`)}}async function l0(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 d0.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 s0().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 $=vy().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 L=Q.pro[0]?.split("/")[1]||Q.pro[0];console.log(C.yellow(`\uD83D\uDD12 The ${C.cyan(L)} component requires PRO access.`))}else console.log(C.yellow("\uD83D\uDD12 The following components require PRO access:")),Q.pro.forEach((L)=>{let D=L?.split("/")[1]||L;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 L=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=L.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 L=/^[^*"]+\/\*\s*$/;Q=(await Jy({type:"text",name:"aliasPrefix",onState:f,initial:"@/*",message:`What is the ${C.cyan("import alias")} for your project?`,validate:(_)=>L.test(_)?!0:"Import alias must follow the pattern <prefix>/*"}))?.aliasPrefix}Y.aliases=await P$(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 E$(G?.type,G.license);if(!Q)console.log("No components found"),process.exit(1);let L=await Jy({type:"multiselect",name:"components",onState:f,message:`Which ${C.cyan("components")} would you like to add?`,choices:Q?.components?.map((x)=>({title:x?.name+(x?.count?` (${x?.count} variants)`:"")||"example",value:x||"example",selected:G.components.includes(x.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!L.components||!L.components.length)console.log("No option selected. Exiting..."),process.exit(1);let D=L.components.filter((x)=>x?.type==="file").map((x)=>x.name),_=L.components.filter((x)=>x?.type==="dir").map((x)=>x.name),E=[];if(_.length){let x=await x$(G?.type,G.license,_);if(x&&x.components.length)for(let v of x.components){let[F,I]=Object.entries(v)[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));E.push(F+"/"+T.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,U=new Set,V=new Set,B=new r0({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((L)=>{b.add({name:L.name,path:L.path})})}),$.stop(),b.size){let Q=Array.from(b).filter((L)=>!i.existsSync(h.posix.join(j,`${Y?.isSrcDir?"src":""}`,L?.path?.replace(/components\//,G.path+"/"))));if(Q?.length)if(G.includeAllComponents)G.baseComponents=Q.map((L)=>L.name);else{let L=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=L.baseComponents,!Q.length&&!L.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 L=vy(`Adding ${Q.name}...`).start(),D=Q.files;Q?.dependencies?.forEach((E)=>U.add(E)),Q?.devDependencies?.forEach((E)=>V.add(E));let _=!1;try{for(let{path:E,code:x}of D||[]){let v=h.posix.join(j,cy(E,Y?.paths,Y?.isSrcDir)),F=Y?.framework==="vite"?x.replace(`"use client";
13
+
14
+ `,""):x,I=fy(F),T=h.dirname(v);if(i.existsSync(v)&&!G.overwrite&&!q.has(v)){if(i.readFileSync(v,"utf-8")!==I)X.add({code:I,path:v}),_=!0}else if(!q.has(v)){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(v,I),q.add(v);let H=B.getSourceFile(h.resolve(v));if(H)H.replaceWithText(I);else H=B.addSourceFileAtPath(h.resolve(v));H.getImportDeclarations().forEach((J)=>{let A=J.getModuleSpecifierValue();J.setModuleSpecifier(Ay(A,G.path,Y?.aliases))}),await H.save()}}if(_)L.warn(`Some files of ${C.yellow(Q.name)} already exist`);else L.succeed(`${C.green(Q.name)} is added successfully`)}catch(E){L.fail(`
16
+ Failed to add the component ${C.red(Q.name)}`),console.error(C.red(E)),process.exit(1)}}if(X.size&&!G?.overwrite){console.log(`
17
+ Following files already exist in the directory.`),X.forEach((L)=>{console.log(C.green(`- ${h.relative(j,L.path)}`))});let Q=!1;if(G.yes)Q=!0;else{let L=await Jy({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0});if(L.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=L.overwrite}if(Q){let L=vy("Overwriting files").start();X.forEach((D)=>{let _=B.addSourceFileAtPath(h.resolve(D.path));_.replaceWithText(D.code),_.getImportDeclarations().forEach((E)=>{let x=E.getModuleSpecifierValue();E.setModuleSpecifier(Ay(x,G.path,Y?.aliases))}),_.saveSync()}),L.succeed("Files are overwritten")}}if(U.size){let Q=vy().start();await Uy(U,{cwd:j,spinner:Q,label:"component dependencies"})}if(V.size){let Q=vy().start();await Uy(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 Y$ from"chalk";import{Command as p0}from"commander";import*as Ly from"fs";import n0 from"http";import t0 from"open";import e0 from"ora";import y1 from"os";import*as W$ from"path";import{URL as $1}from"url";import*as my from"fs";import*as Gy from"path";import{fileURLToPath as i0}from"url";var o0=i0(import.meta.url),j$=Gy.dirname(o0);function a0(){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=a0();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 ${C.cyan("--overwrite")} or ${C.cyan("-o")} flag to overwrite existing files
61
61
  {{AUTO_CLOSE_SCRIPT}}
62
62
  </div>
63
63
  </body>
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(`
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(y1.homedir(),".untitledui"),z$=W$.join(Q$,"config.json"),i$=new p0().name("login").description("authenticate with Untitled UI to access PRO components").action(async()=>{let y=e0("Starting authentication...").start();try{await j1(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 j1(y){return new Promise(($,j)=>{let z=n0.createServer((Y,W)=>{let Z=new $1(Y.url,"http://localhost");if(Z.pathname==="/callback"){let X=Z.searchParams.get("apiKey"),U=Z.searchParams.get("error");if(U){W.writeHead(400,{"Content-Type":"text/html"}),W.end(ly(decodeURIComponent(U))),z.close(),j(Error(decodeURIComponent(U)));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{z1(X),W.writeHead(200,{"Content-Type":"text/html"}),W.end(r$()),z.close(),$()}catch(V){W.writeHead(500,{"Content-Type":"text/html"}),W.end(ly("Failed to save authentication data")),z.close(),j(V)}}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...",t0(Z).catch((X)=>{console.log(Y$.yellow(`
66
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(`
67
+ `))}),y.text="Waiting for authentication in browser..."}),setTimeout(()=>{z.close(),j(Error("Authentication timeout. Please try again."))},300000)})}function z1(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 X1 from"async-retry";import w from"chalk";import{Command as L1}from"commander";import*as m from"fs";import Sy from"ora";import*as S from"path";import by from"prompts";import{Project as M1}from"ts-morph";import Y1 from"node-fetch";async function Ey(y,$){try{let z=await Y1("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 Q1}from"commander";import{execa as V$}from"execa";import H$ from"fast-glob";import o from"fs";import xy from"ora";import*as P from"path";import iy from"prompts";import{Project as W1}from"ts-morph";import{fileURLToPath as Z1}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 U=X.match(/\d+/);if((U?parseInt(U[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[V,B]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]=B}let U=!1;for(let[V,B]of Object.entries(Z))if(X[V]){let b=X[V],q=new RegExp(`(${B}):\\s*rgb\\([^)]*\\);?`,"g");if(q.test(Y))Y=Y.replace(q,`$1: ${b};`),U=!0;else console.log(U$.yellow(`No match found for ${B}`))}if(U)Hy.writeFileSync(z,Y,"utf-8")}var U1=Z1(import.meta.url),a$=P.dirname(U1),n$="vite",t$="nextjs",p$={[t$]:"Next.js",[n$]:"Vite"},n="",O={color:"",template:"",framework:void 0,license:My()},e$=new Q1().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(P.resolve(j,"package.json")),Y=P.resolve(P.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=xy().start(),U=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(P.resolve(P.posix.join(j,n,"package.json")));if(o.existsSync(P.resolve(P.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(U?.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(U?.framework.startsWith("next")||U?.framework.startsWith("vite"))if(!$&&!U.tailwind.brandColor)X.succeed(c.yellow(`Detected ${u$[U.framework]} project, proceeding with the setup...`));else X.stop();if(O.colorsList||!O.color&&!U?.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&&U)U.tailwind.brandColor=B.color}let V=P.posix.join(j,n||"");if(n&&!z){let B=P.resolve(n);console.log(`
68
+ Creating a new project in ${c.blue(n)}`);let b=xy("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=xy({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:V}).catch(async(L)=>{if(L.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:V})}),{retries:1}),await M$(()=>V$("git",["init"],{cwd:V}),{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
71
  cd ${c.cyan(n)}
72
72
  ${c.cyan(d$())}`)}catch(q){if(b.fail(c.red(`
73
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(`
74
+ `);o.rmdirSync(B,{recursive:!0}),process.exit(1)}}else{let B=xy(),b=new Set,q=U?.examples||"",Q=wy(j,q),L=P.resolve(P.join(a$,"../config")),D=H$.sync(["**"],{cwd:L,onlyFiles:!0,ignore:l}),_=Z$(j,["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components"]),E=Z$(j,["@tailwindcss/postcss","postcss"]);if(!$&&!U?.tailwind.brandColor)B.start("Copying files to the project directory");if(D.forEach((F)=>{let I=F.includes("postcss.config"),T=P.posix.join(P.posix.join(L),F),R=P.posix.join(j,I?F:cy(F,U?.paths,U?.isSrcDir));if(o.existsSync(R)){if(O?.overwrite)o.copyFileSync(T,R);else{let M=o.readFileSync(R,"utf-8"),H=o.readFileSync(T,"utf-8");if(M!==H){if(F.endsWith("theme.css")&&U?.tailwind.brandColor)return;b.add({targetFile:R,sourceFile:T})}}return}o.mkdirSync(P.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=xy("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
- ${c.cyan(`@config "../${L?.isSrcDir?"../":""}${g.relative(j,Q.tailwindFile)}";`)}
78
- `);if(L?.framework==="vite"){if(!P$(j))console.log(`
77
+ ${c.cyan(`@config "../${U?.isSrcDir?"../":""}${P.relative(j,Q.tailwindFile)}";`)}
78
+ `);if(U?.framework==="vite"){if(!g$(j))console.log(`
79
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(`
80
+ `)}let x=Q?.layoutFile||Q?.appFile||U?.framework==="vite"&&Q?.mainFile||"";if(x){let I=new W1({tsConfigFilePath:P.resolve(Q?.tsConfig||"")}).addSourceFileAtPath(P.resolve(x)),T="styles/globals.css";if(!I.getImportDeclarations().some((M)=>{let H=M.getModuleSpecifierValue();return/(?:styles\/)?globals\.css$/.test(H)})){let M=U?.aliases?.styles||U?.aliases?.src||"",H=U?.aliases?.styles?`${M}globals.css`:`${M}styles/globals.css`;I.addImportDeclaration({moduleSpecifier:H})}I.saveSync()}let v=H$.sync(["**/theme.css"],{cwd:j,absolute:!0,onlyFiles:!0,ignore:l});if(!v?.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||!U?.tailwind.brandColor)&&L$("brand",O.color||"brand",v[0]??""),_.length||E.length){let F=xy().start("Installing dependencies");if(_.length)await Uy(_,{cwd:V,spinner:F,label:"dependencies"});if(E.length)await Uy(E,{cwd:V,dev:!0,spinner:F,label:"devDependencies"});F.succeed("Dependencies are installed")}if(!$&&!U?.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$={},y0=new L1().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 V1()}catch(j){console.error(w.red(j))}});async function V1(){let y=Sy().start(),$=S.posix.join(process.cwd(),B$?.projectPath||"");if(!m.existsSync(S.posix.join(S.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 Ey(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 Ey(K.example,K.license);else console.error(w.red("Error: No examples found in directory.")),process.exit(1);else{let L=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(!L.example)return;K.example=L.example,Q=await Ey(L.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 Ey(K.example,K.license);else console.error(w.red("Error: No example files found.")),process.exit(1);else{let L=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(!L.example)return;K.example=L.example,Q=await Ey(L.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(S.posix.join($,W));if(Q)z={...Q,aliases:z?.aliases||{}};K.examplePath=W}if(!K?.examplePath){let Q=z?.isAppDir?"app":"pages",L=z?.isSrcDir?S.posix.join("src",Q):Q;if(K.yes)K.examplePath=L,console.log(w.yellow(`Using default example path: ${L}`));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:L});K.examplePath=D.examplePath}}if(K.examplePath&&!m.existsSync(S.posix.join($,K.examplePath)))m.mkdirSync(S.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=S.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(S.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((L)=>({title:L?.name,value:L?.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($),U=new Set,V=new M1({tsConfigFilePath:X?.tsConfig}),B=Sy(`Adding ${K?.example}...`).start(),b="",q=new Set(Y.components.filter((Q)=>K.components?.includes(Q.name)).map((Q)=>S.dirname(Q.path)));try{for(let{path:Q,code:L}of Y.files||[]){let D=S.dirname(Q);if(Array.from(q).some((I)=>D===I||D.startsWith(I+"/")))continue;let E=S.posix.join($,`${z?.isSrcDir?"src":""}`,Q.replace(/components\//,K.path+"/")),x=z?.framework==="vite"?L.replace(`"use client";
83
+
84
+ `,""):L,v=fy(x);if(Q.includes("examples")){let I=S.basename(Q);E=S.posix.join($,K?.examplePath??"",I),b=S.posix.join(K?.examplePath??"",I)}let F=S.dirname(E);if(m.existsSync(E)&&!K.overwrite){if(m.readFileSync(E,"utf-8")!==v)U.add({code:v,path:E})}else{let I=F.split(S.sep),T="";for(let M of I)if(T=T?S.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(E,v);let R=V.getSourceFile(S.resolve(E));if(R)R.replaceWithText(v);else R=V.addSourceFileAtPath(S.resolve(E));R.getImportDeclarations().forEach((M)=>{let H=M.getModuleSpecifierValue();M.setModuleSpecifier(Ay(H,K.path,z?.aliases))}),await R.save()}}if(U.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(U.size&&!K?.overwrite){console.log(`
87
+ Following files already exist in the directory.`),U.forEach((L)=>{console.log(w.green(`- ${S.relative($,L.path)}`))});let Q=!1;if(K.yes)Q=!0,console.log(w.yellow("Auto-overwriting existing files (--yes mode)"));else{let L=await by({type:"confirm",name:"overwrite",onState:f,message:"Do you want to overwrite the existing files?",initial:!0});if(L.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=L.overwrite}if(Q){let L=Sy("Overwriting files").start();U.forEach((D)=>{let _=V.addSourceFileAtPath(S.resolve(D.path));_.replaceWithText(D.code),_.getImportDeclarations().forEach((E)=>{let x=E.getModuleSpecifierValue();E.setModuleSpecifier(Ay(x,K.path,z?.aliases))}),_.saveSync()}),L.succeed("Files are overwritten")}}if(Y?.dependencies?.length){let Q=Sy().start();await Uy(Y.dependencies,{cwd:$,spinner:Q,label:"example dependencies"})}if(Y?.devDependencies?.length){let Q=Sy().start();await Uy(Y.devDependencies,{cwd:$,dev:!0,spinner:Q,label:"example devDependencies"})}if(K?.components?.length)await X1(()=>$$({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 g from"chalk";import{Command as H1}from"commander";import z0 from"fast-glob";import Dy from"fs";import $0 from"ora";import Fy from"path";import K1 from"prompts";var B1={ArrowRight:"ArrowNext",ArrowLeft:"ArrowPrevious",ChevronRight:"ChevronNext",ChevronLeft:"ChevronPrevious",ChevronRightDouble:"ChevronNextDouble",ChevronLeftDouble:"ChevronPreviousDouble"},q1=[{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 J1=[{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./]+(?=\\s|$|")|full|px|\\[\\S+\\])(?!\\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./]+(?=\\s|$|")|full|px|\\[\\S+\\])(?!\\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}],G1=/\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 Q0(y,$){let j=y;for(let z of $)j=j.replace(z.pattern,z.replace);return j}function b1(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(G1.test(Z))continue;let X=Z,U=!1;if(X=X.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(V,B,b,q,Q)=>{let L=B??b??q??Q;if(L==null||!Y0.test(L))return V;let D=Q0(L,j);if(D!==L)return U=!0,V.replace(L,D);return V}),U&&X!==Z)Y[W]=X,z.changes.push({line:W+1,before:Z.trim(),after:X.trim()})}return z}function _1(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 D1(y){let $=Fy.resolve(y);return z0(["**/*.tsx","**/*.ts"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/*.test.tsx"]})}var W0="[data-rtl-flip]:dir(rtl) { transform: scaleX(-1); }";function j0(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=z0.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 N1(y,$){let j=Dy.readFileSync(y,"utf-8");if(j.includes("data-rtl-flip"))return!1;let z=j.trimEnd()+`
91
+
92
+ `+W0+`
93
+ `;if(!$)Dy.writeFileSync(y,z);return!0}var Z0=new H1().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(g.bold(`
94
94
  Migrate to RTL
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(`
95
+ `));let j=Fy.resolve(y||".");if(!Dy.existsSync(j))console.log(g.red(` Path not found: ${j}`)),process.exit(1);let z=!$.skipIcons,Y=!0,W=!1;if(!$.yes){let _=await K1([{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 ${g.cyan(j)}?`,initial:!0}]);if(_.confirm===!1){console.log(g.yellow(`
96
96
  Cancelled.
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(`
97
+ `));return}z=!$.skipIcons&&_.swapIcons!==!1,Y=_.includeVariants!==!1,W=z}else W=z;let Z=$0(" Scanning files...").start(),X=await D1(j);Z.succeed(` Found ${g.bold(X.length)} files`);let U=[...q1,...Y?J1:[]],V=0,B=0,b=0,q=[],Q=$0(" Transforming...").start();for(let _ of X){let E=Dy.readFileSync(_,"utf-8"),x=Fy.relative(j,_),v=E,F=!1,I=b1(x,v,U);if(I.changes.length>0){v=E.split(`
98
+ `).map((M,H)=>{return I.changes.find((A)=>A.line===H+1)?v.split(`
99
+ `)[H]:M}).join(`
100
+ `);let T=v.split(`
101
+ `),R=E.split(`
102
+ `);for(let M of I.changes){let H=M.line-1,J=R[H];J=J.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(A,u,k,p,e)=>{let yy=u??k??p??e;if(yy==null||!Y0.test(yy))return A;let t=Q0(yy,U);return t!==yy?A.replace(yy,t):A}),T[H]=J}v=T.join(`
103
+ `),V+=I.changes.length,F=!0,q.push(I)}if(z){let T=_1(v);if(T.swaps>0)v=T.content,B+=T.swaps,F=!0}if(F){if(b++,!$.dryRun)Dy.writeFileSync(_,v)}}Q.succeed(` Processed ${g.bold(X.length)} files`);let L=!1,D="";if(W&&B>0){let _=j0(j);if(_)D=Fy.relative(j,_),L=N1(_,$.dryRun)}if(console.log(g.bold(`
104
104
  Summary
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(`
105
+ `)),console.log(` Files modified: ${g.cyan(b)}`),console.log(` Class changes: ${g.cyan(V)}`),z)console.log(` Icon swaps: ${g.cyan(B)}`);if(L)console.log(` RTL flip rule: ${g.cyan("added")} → ${g.dim(D)}`);else if(W&&B>0&&!L)if(!j0(j))console.log(g.yellow(`
106
+ Could not find a global CSS file to inject the RTL flip rule.`)),console.log(g.yellow(` Add this manually to your global stylesheet:
107
+ `)),console.log(g.dim(` ${W0}
108
+ `));else console.log(` RTL flip rule: ${g.dim("already present")}`);if($.dryRun){if(console.log(g.yellow(`
109
+ Dry run — no files were modified.`)),q.length>0){console.log(g.bold(`
110
110
  Changes preview:
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(`
111
+ `));for(let _ of q.slice(0,10)){console.log(g.dim(` ${_.file}`));for(let E of _.changes.slice(0,3))console.log(g.red(` - ${E.before.substring(0,100)}`)),console.log(g.green(` + ${E.after.substring(0,100)}`));if(_.changes.length>3)console.log(g.dim(` ... and ${_.changes.length-3} more`))}if(q.length>10)console.log(g.dim(`
112
+ ... and ${q.length-10} more files`))}}else console.log(g.green(`
113
+ Done! ${b} files updated.`));console.log()});import d from"chalk";import{Command as w1}from"commander";import q$ from"node-fetch";import A1 from"ora";var J$="http://localhost:3000/react/api/mcp/tools";async function E1(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 x1(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 I1(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 T1(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 v1(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 S1(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 U0=new w1().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=A1(`Searching for "${j}"...`).start();try{let X=W==="all"||W==="components",U=W==="all"||W==="templates",V=W==="all"||W==="icons",[B,b,q]=await Promise.all([X?E1(j,Y,z):Promise.resolve([]),U?x1(j,Y,z):Promise.resolve([]),V?I1(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
115
  `));return}if(B.length>0){if(console.log(d.bold.underline(`
116
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
117
+ `)),B.forEach(T1),B.length>0){let L=B[0].name;console.log(d.dim(` Install: npx untitledui@latest add ${L} --yes
118
118
  `))}}if(b.length>0){if(console.log(d.bold.underline(`
119
119
  Templates (${b.length})
120
- `)),b.forEach(S0),b.length>0){let U=b[0].name;console.log(d.dim(` Install: npx untitledui@latest example ${U} --yes
120
+ `)),b.forEach(v1),b.length>0){let L=b[0].name;console.log(d.dim(` Install: npx untitledui@latest example ${L} --yes
121
121
  `))}}if(q.length>0)console.log(d.bold.underline(`
122
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(`
123
+ `)),q.forEach(S1)}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 P1}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 b0 from"prompts";var X0={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"},{from:"select/multi-select",to:"select/tag-select",description:"multi-select renamed to tag-select (new multi-select is a different component)",symbolRenames:[{from:"MultiSelect",to:"TagSelect"}]}],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:["The v7 MultiSelect (tag-chip style) has been renamed to TagSelect. The new MultiSelect is a different component with autocomplete. Update your imports accordingly.","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 L0(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((V)=>V.description)}}let U=X;for(let V of j)if(U.includes(V.find))U=U.replace(V.find,V.replace),W.push(V.description);else Z.push(V.description);if(!z&&W.length>0)Iy.writeFileSync(Y,U,"utf-8");return{applied:W,skipped:Z}}function M0(y){let{packageJsonPath:$,update:j,add:z,devUpdate:Y,devAdd:W,remove:Z,dryRun:X}=y,U=G$.resolve($),V=[],B=[],b=[],q;try{let Q=Iy.readFileSync(U,"utf-8");q=JSON.parse(Q)}catch{return{updated:V,added:B,removed:b}}if(!q.dependencies)q.dependencies={};if(!q.devDependencies)q.devDependencies={};for(let[Q,L]of Object.entries(j))if(q.dependencies[Q])q.dependencies[Q]=L,V.push(Q);for(let[Q,L]of Object.entries(z))if(!q.dependencies[Q])q.dependencies[Q]=L,B.push(Q);for(let[Q,L]of Object.entries(Y))if(q.devDependencies[Q])q.devDependencies[Q]=L,V.push(Q);for(let[Q,L]of Object.entries(W))if(!q.devDependencies[Q])q.devDependencies[Q]=L,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&&(V.length>0||B.length>0||b.length>0))Iy.writeFileSync(U,JSON.stringify(q,null,2)+`
124
+ `,"utf-8");return{updated:V,added:B,removed:b}}import*as Ty from"fs";import*as V0 from"path";function F1(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 R1(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 H0(y){let{themePath:$,newThemeContent:j,dryRun:z}=y,Y=V0.resolve($),W;try{W=Ty.readFileSync(Y,"utf-8")}catch{return{brandColors:{},success:!1,message:`Theme file not found at ${Y}`}}let Z=F1(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"),U=R1(X,Z);Ty.writeFileSync(Y,U,"utf-8")}return{brandColors:Z,success:!0,message:`Theme upgraded successfully. Preserved ${Object.keys(Z).length} brand color variables.`}}catch(X){let U=X instanceof Error?X.message:String(X);return{brandColors:Z,success:!1,message:`Failed to write theme file: ${U}`}}}var C1=/\bleft-1\/2\b.*-translate-x-1\/2|-translate-x-1\/2.*\bleft-1\/2\b/;function u1(y,$){return $.some((j)=>j.pattern.test(y))}function O1(y,$){let j=y;for(let z of $)z.pattern.lastIndex=0,j=j.replace(z.pattern,z.replace);return j}function k1(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 K0(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(C1.test(Z))continue;let X=Z,U=!1;if(X=X.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(V,B,b,q,Q)=>{let L=B??b??q??Q;if(L==null)return V;for(let _ of j)_.pattern.lastIndex=0;if(!u1(L,j))return V;for(let _ of j)_.pattern.lastIndex=0;let D=O1(L,j);if(D!==L)return U=!0,V.replace(L,D);return V}),U&&X!==Z){let V=k1(Z,X,j);Y[W]=X,z.changes.push({line:W+1,before:Z.trim(),after:X.trim(),description:V})}}return z}function B0(y,$){let j=[],z=y.split(`
126
+ `),Y=[];for(let W=0;W<z.length;W++){let Z=z[W];if(!/^\s*(import\b|require\s*\(|export\b.*from\b)/.test(Z))continue;let X=Z;for(let U of $)if(X.includes(U.from)){if(X=X.replace(U.from,U.to),U.symbolRenames)Y.push(...U.symbolRenames)}if(X!==Z){z[W]=X;let U=$.find((V)=>Z.includes(V.from));j.push({line:W+1,before:Z.trim(),after:X.trim(),description:U?.description??"Import path update"})}}if(Y.length>0)for(let W=0;W<z.length;W++){let Z=z[W],X=Z;for(let U of Y){let V=new RegExp(`\\b${U.from}\\b`,"g");X=X.replace(V,U.to)}if(X!==Z){if(z[W]=X,!j.some((V)=>V.line===W+1))j.push({line:W+1,before:Z.trim(),after:X.trim(),description:`Renamed ${Y.map((V)=>`${V.from} → ${V.to}`).join(", ")}`})}}return{content:z.join(`
127
+ `),changes:j}}function q0(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((U)=>W.includes(U.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 J0(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 G0(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 g1(y){return{fromVersion:y.fromVersion,toVersion:y.toVersion,classTransforms:y.classRenames.map(($)=>({pattern:new RegExp(`\\b${D0($.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 D0(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d1(y){let $=r.join(y,"components.json");try{return JSON.parse(s.readFileSync($,"utf-8"))}catch{return null}}function f1(y,$){let j=r.join(y,"components.json");s.writeFileSync(j,JSON.stringify($,null,2)+`
132
+ `,"utf-8")}async function _0(y){let $=r.resolve(y);return _$(["**/*.{tsx,ts}"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/.next/**","**/dist/**","**/build/**"]})}async function c1(y){return(await _$(["**/theme.css"],{cwd:y,absolute:!0,deep:5,ignore:["**/node_modules/**","**/.next/**","**/dist/**"]}))[0]}function h1(y){let $=r.join(y,"package.json");return s.existsSync($)?$:void 0}function m1(y){let $=r.join(y,"tsconfig.json");return s.existsSync($)?$:void 0}function l1(y){let $=0;for(let j=0;j<y.length;j++){let z=y.charCodeAt(j);$=($<<5)-$+z|0}return $.toString(36)}var N0=new P1().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 $=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(`
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:H}=await b0({type:"confirm",name:"proceed",message:"Continue with uncommitted changes?",initial:!0});if(!H){console.log(N.yellow(`
135
135
  Cancelled.
136
- `));return}}console.log()}}catch{}let j=d0($),z=j?.version??"7";if(console.log(` Detected version: ${N.cyan(z)}
136
+ `));return}}console.log()}}catch{}let j=d1($),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("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
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 H=await M.json();Y=g1(H),W="server",Z.succeed(" Migration rules fetched from server")}catch{Y=X0,W="built-in",Z.warn(" Could not reach server. Using built-in migration rules")}let X=a(" Scanning files...").start(),U=await _0($);X.succeed(` Found ${N.bold(U.length)} source files`);let V=0,B=0,b=0,q=0,Q=[],L=[],D=[],_=[];if(!y.skipTheme){let M=a(" Upgrading theme.css...").start(),H=await c1($);if(H)try{let J=r.resolve(import.meta.dirname,"../config/styles/theme.css"),A=s.readFileSync(J,"utf-8"),u=await H0({themePath:H,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(),H=m1($);if(H&&Y.configChanges.tsconfig.length>0){let{applied:J,skipped:A}=L0({tsconfigPath:H,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(),H=h1($);if(H){let J=M0({packageJsonPath:H,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 E=a(" Renaming files...").start(),x=new Set;for(let M of Y.importTransforms){let H=M.from.split("/").pop(),J=M.to.split("/").pop();if(H===J)continue;let A=_$.sync([`**/${H}.tsx`,`**/${H}.ts`],{cwd:$,absolute:!0,ignore:["**/node_modules/**"]});for(let u of A){let k=u.replace(new RegExp(`${D0(H)}(\\.tsx?)$`),`${J}$1`);if(!y.dryRun)try{s.renameSync(u,k),x.add(M.from)}catch{}else x.add(M.from)}}let v=Y.importTransforms.filter((M)=>{let H=M.from.split("/").pop(),J=M.to.split("/").pop();if(H===J)return!0;return x.has(M.from)});if(x.size>0)E.succeed(` Renamed ${N.bold(x.size)} files`),U.length=0,U.push(...await _0($));else E.info(" No file renames needed");let F=a(" Applying source transforms...").start();for(let M of U){let H;try{H=s.readFileSync(M,"utf-8")}catch{continue}let J=r.relative($,M),A=H,u=!1,k=K0(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,w0,A0,E0,x0)=>{let Cy=w0??A0??E0??x0;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
+ `),V+=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)L.push({file:J,line:t.line,description:t.description,before:t.before,after:t.after})}}let p=q0(A,Y.propTransforms);if(p.changes.length>0)A=p.content,B+=p.changes.length,u=!0;let e=B0(A,v);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(U.length)} files`);let I=a(" Detecting structural patterns...").start();for(let M of U){let H;try{H=s.readFileSync(M,"utf-8")}catch{continue}let J=r.relative($,M),A=J0(J,H,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(),H=[];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(l1(u)===J.contentHash)H.push({name:J.name,path:J.filePath})}catch{}}if(H.length>0){M.info(` ${N.bold(H.length)} stock components can be auto-refreshed`);let J=y.yes;if(!J){let{confirm:A}=await b0({type:"confirm",name:"confirm",message:`Refresh ${H.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:H.map((k)=>k.name),version:"8"})});if(u.ok){let k=await u.json(),p=0;for(let e of H)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 U){let H;try{H=s.readFileSync(M,"utf-8")}catch{continue}let J=r.relative($,M),A=G0(J,H,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 H=Zy();await b$(H,["tsc","--noEmit"],{cwd:$}),M.succeed(" Type check passed")}catch(H){let A=(H?.stderr||H?.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:L.length>0||D.length>0?"partial":"success",filesScanned:U.length,filesModified:q,classChanges:V,propChanges:B,importChanges:b,manualReview:L,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(L.length>0||_.length>0)try{let H=`# Untitled UI v7.0 to v8.0 Upgrade Instructions
143
143
 
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.
144
+ `;if(H+="This file was generated by `untitledui upgrade`. It is meant to guide\n",H+=`manual review of changes that could not be fully automated.
145
145
 
146
- `,V+=`**Important**: Ignore pre-existing type errors and linting issues.
147
- `,V+=`Focus only on migration-related changes listed below.
146
+ `,H+=`**Important**: Ignore pre-existing type errors and linting issues.
147
+ `,H+=`Focus only on migration-related changes listed below.
148
148
 
149
- `,V+=`Delete this file after review is complete.
149
+ `,H+=`Delete this file after review is complete.
150
150
 
151
- `,_.length>0){V+=`## Structural changes
151
+ `,_.length>0){H+=`## Structural changes
152
152
 
153
- `,V+=`These patterns require manual refactoring:
153
+ `,H+=`These patterns require manual refactoring:
154
154
 
155
- `;for(let J of _)V+=`- **${J.file}:${J.line}** — \`${J.pattern}\`
156
- `,V+=` ${J.instruction}
155
+ `;for(let J of _)H+=`- **${J.file}:${J.line}** — \`${J.pattern}\`
156
+ `,H+=` ${J.instruction}
157
157
 
158
- `}if(U.length>0){V+=`## Manual review items
158
+ `}if(L.length>0){H+=`## Manual review items
159
159
 
160
- `,V+=`These class replacements may need manual verification:
160
+ `,H+=`These class replacements may need manual verification:
161
161
 
162
- `;for(let J of U)V+=`### ${J.file}:${J.line}
162
+ `;for(let J of L)H+=`### ${J.file}:${J.line}
163
163
 
164
- `,V+=`${J.description}
164
+ `,H+=`${J.description}
165
165
 
166
- `,V+="```diff\n",V+=`- ${J.before}
167
- `,V+=`+ ${J.after}
168
- `,V+="```\n\n"}if(Y.notes.length>0){V+=`## Additional notes
166
+ `,H+="```diff\n",H+=`- ${J.before}
167
+ `,H+=`+ ${J.after}
168
+ `,H+="```\n\n"}if(Y.notes.length>0){H+=`## Additional notes
169
169
 
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(`
170
+ `;for(let J of Y.notes)H+=`- ${J}
171
+ `;H+=`
172
+ `}s.writeFileSync(r.join($,"UPGRADE-INSTRUCTIONS.md"),H,"utf-8")}catch{}}if(!y.dryRun&&j)j.version="8",f1($,j);if(console.log(N.bold(`
173
173
  Summary
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(`
174
+ `)),console.log(` Migration source: ${N.cyan(W)}`),console.log(` Files scanned: ${N.cyan(U.length)}`),console.log(` Files modified: ${N.cyan(q)}`),console.log(` Class changes: ${N.cyan(V)}`),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(L.length>0){console.log(` Manual review items: ${N.yellow(L.length)}`);for(let M of L.slice(0,5))console.log(N.dim(` ${M.file}:${M.line} — ${M.description}`));if(L.length>5)console.log(N.dim(` ... and ${L.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((H)=>H.token))];for(let H of M.slice(0,5))console.log(N.dim(` ${H}`));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 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(`
177
+ `));for(let M of Q.slice(0,10)){console.log(N.dim(` ${M.file}`));for(let H of M.changes.slice(0,3))console.log(N.red(` - ${H.before.substring(0,100)}`)),console.log(N.green(` + ${H.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 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();
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",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 i1(){let y=new r1().name(D$.name).version(D$.version);y.addCommand(e$).addCommand(l$).addCommand(y0).addCommand(U0).addCommand(i$).addCommand(Z0).addCommand(N0),y.parse()}i1();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "untitledui",
3
- "version": "0.1.56-beta.1",
3
+ "version": "0.1.56",
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",