yummaui 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,7 @@ Detects your framework, package manager and import alias, then writes a `yummaui
26
26
  {
27
27
  "componentsDir": "components/ui",
28
28
  "alias": "@/components/ui",
29
- "registry": "https://yummacss.com/ui/r"
29
+ "registry": "https://yummacss.com/ui/registry"
30
30
  }
31
31
  ```
32
32
 
@@ -91,10 +91,10 @@ outside `componentsDir` instead.
91
91
  The CLI reads a static JSON registry published by the docs site:
92
92
 
93
93
  ```
94
- https://yummacss.com/ui/r/index.json every component
95
- https://yummacss.com/ui/r/<id>.json one component's source and dependencies
96
- https://yummacss.com/ui/r/styles.json the styles and the radius steps each takes
97
- https://yummacss.com/ui/r/<style>-<radius>/<id>.json the same, rewritten for a style
94
+ https://yummacss.com/ui/registry/index.json every component
95
+ https://yummacss.com/ui/registry/<id>.json one component's source and dependencies
96
+ https://yummacss.com/ui/registry/styles.json the styles and the radius steps each takes
97
+ https://yummacss.com/ui/registry/<style>-<radius>/<id>.json the same, rewritten for a style
98
98
  ```
99
99
 
100
100
  ## License
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import{parseArgs as e,styleText as t}from"node:util";import{existsSync as n,mkdirSync as r,readFileSync as i,readdirSync as a,rmSync as o,writeFileSync as s}from"node:fs";import{dirname as c,join as l,relative as u,resolve as d,sep as f}from"node:path";import*as p from"@clack/prompts";import{distance as m}from"fastest-levenshtein";import{spawn as h}from"node:child_process";import{generateCode as g,loadFile as _}from"magicast";import{addVitePlugin as v,getConfigFromVariableDeclaration as y,getDefaultExportOptions as b}from"magicast/helpers";var x=`0.5.1`;const S=`https://yummacss.com/ui/r`;var C=class extends Error{};async function w(e){let t;try{t=await fetch(e,{headers:{accept:`application/json`}})}catch(t){throw new C(`Could not reach the registry at ${e}. Are you online?`,{cause:t})}if(t.status===404)throw new C(`Not found: ${e}`);if(!t.ok)throw new C(`Registry returned ${t.status} for ${e}`);try{return await t.json()}catch(t){throw new C(`Registry sent invalid JSON from ${e}`,{cause:t})}}function ee(e){return w(`${e}/index.json`)}function te(e,t){return w(`${e}/${t}.json`)}function ne(e){return w(`${e}/styles.json`)}function re(e,t,n){let r=t??e.default,i=e.styles[r];if(!i)return{error:`There is no ${r} style. Try one of: ${Object.keys(e.styles).join(`, `)}.`};let a=n??i.radius;return i.allow.includes(a)?{folder:`${r}-${a}`}:{error:`${i.refused[a]??`${i.name} does not take ${a}.`} ${i.name} takes: ${i.allow.join(`, `)}.`}}const T=`yummaui.json`,E=`yumma.config.mjs`,D=`https://yummacss.com/docs/installation`,O=`@yummacss;`,ie={"pnpm-lock.yaml":`pnpm`,"bun.lockb":`bun`,"bun.lock":`bun`,"yarn.lock":`yarn`,"package-lock.json":`npm`};function k(e=process.cwd()){let t=d(e);for(;;){if(n(l(t,`package.json`)))return t;let e=c(t);if(e===t)return null;t=e}}function A(e){try{return JSON.parse(i(l(e,`package.json`),`utf8`))}catch{return{}}}function j(e){for(let[t,r]of Object.entries(ie))if(n(l(e,t)))return r;let t=A(e).packageManager;if(typeof t==`string`){let e=t.split(`@`)[0];if(e===`pnpm`||e===`npm`||e===`yarn`||e===`bun`)return e}return`npm`}function ae(e){let t=A(e),r={...t.dependencies,...t.devDependencies};return r.next?[`app`,`src/app`].some(t=>n(l(e,t)))?`Next.js (App Router)`:`Next.js (Pages Router)`:r.astro?`Astro`:r[`react-router`]||r[`@remix-run/react`]?`React Router`:r.vite?`Vite`:null}function oe(e){for(let t of[`tsconfig.json`,`jsconfig.json`]){let r=l(e,t);if(n(r))try{let e=i(r,`utf8`).replace(/\/\*[\s\S]*?\*\//g,``).replace(/(^|\s)\/\/.*$/gm,`$1`);if(JSON.parse(e)?.compilerOptions?.paths?.[`@/*`])return`@`}catch{}}return null}function se(e){return l(e,T)}function M(e){let t=se(e);if(!n(t))return null;try{let e=JSON.parse(i(t,`utf8`));return{componentsDir:e.componentsDir??`components/ui`,alias:e.alias??null,registry:e.registry??S,...e.style?{style:e.style}:{},...e.radius?{radius:e.radius}:{}}}catch{return null}}function ce(e,t){s(se(e),`${JSON.stringify(t,null,` `)}\n`)}function le(e,t){let n=A(e),r=new Set([...Object.keys(n.dependencies??{}),...Object.keys(n.devDependencies??{}),...Object.keys(n.peerDependencies??{})]);return t.filter(e=>!r.has(e.name))}function N(e,t,n=!1){return{command:e,args:[e===`npm`?`install`:`add`,...n?[`-D`]:[],...t]}}function P(e=k()){switch(e?j(e):`npm`){case`pnpm`:return`pnpm dlx yummaui`;case`yarn`:return`yarn dlx yummaui`;case`bun`:return`bunx yummaui`;default:return`npx yummaui`}}const ue=e=>n=>t(e,n),F=process.stdout.hasColors?.(2**24)?24:process.stdout.hasColors?.()?4:0,I=(e,n)=>r=>F===24?`\x1b[${e}m${r}\x1b[39m`:t(n,r),L=`38;2;190;198;242`,de=`38;2;225;212;168`,fe=`38;2;168;225;173`,pe=`38;2;225;168;168`,R={bold:ue(`bold`),dim:ue(`dim`),accent:I(L,`blue`),success:I(fe,`green`),warning:I(de,`yellow`),danger:I(pe,`red`),badge:e=>F===24?`\x1b[1;97;48;2;76;95;199m${e}\x1b[0m`:t([`bold`,`whiteBright`,`bgBlue`],e)},me={31:pe,32:fe,33:de,35:L,36:L},he=RegExp(`\x1B\\[(3[1-6])m`,`g`);function ge(){if(F!==24)return;let e=process.stdout.write.bind(process.stdout);process.stdout.write=((t,...n)=>e(typeof t==`string`?t.replace(he,(e,t)=>me[t]?`\x1b[${me[t]}m`:e):t,...n))}const z=(e,t)=>`${e} ${t}${e===1?``:t.endsWith(`s`)?`es`:`s`}`;function B(e,t){let[n,...r]=t.split(`
2
+ import{parseArgs as e,styleText as t}from"node:util";import{existsSync as n,mkdirSync as r,readFileSync as i,readdirSync as a,rmSync as o,writeFileSync as s}from"node:fs";import{dirname as c,join as l,relative as u,resolve as d,sep as f}from"node:path";import*as p from"@clack/prompts";import{distance as m}from"fastest-levenshtein";import{spawn as h}from"node:child_process";import{generateCode as g,loadFile as _}from"magicast";import{addVitePlugin as v,getConfigFromVariableDeclaration as y,getDefaultExportOptions as b}from"magicast/helpers";var x=`0.7.0`;const S=`https://yummacss.com/ui/registry`,C=/^https:\/\/(www\.)?yummacss\.com\/ui\/r\/?$/;function ee(e){return!e||C.test(e)?S:e}var w=class extends Error{};async function T(e){let t;try{t=await fetch(e,{headers:{accept:`application/json`}})}catch(t){throw new w(`Could not reach the registry at ${e}. Are you online?`,{cause:t})}if(t.status===404)throw new w(`Not found: ${e}`);if(!t.ok)throw new w(`Registry returned ${t.status} for ${e}`);try{return await t.json()}catch(t){throw new w(`Registry sent invalid JSON from ${e}`,{cause:t})}}function te(e){return T(`${e}/index.json`)}function ne(e,t){return T(`${e}/${t}.json`)}function re(e){return T(`${e}/styles.json`)}function ie(e,t,n){let r=t??e.default,i=e.styles[r];if(!i)return{error:`There is no ${r} style. Try one of: ${Object.keys(e.styles).join(`, `)}.`};let a=n??i.radius;return i.allow.includes(a)?{folder:`${r}-${a}`}:{error:`${i.refused[a]??`${i.name} does not take ${a}.`} ${i.name} takes: ${i.allow.join(`, `)}.`}}const E=`yummaui.json`,D=`yumma.config.mjs`,O=`https://yummacss.com/docs/installation`,k=`@yummacss;`,ae={"pnpm-lock.yaml":`pnpm`,"bun.lockb":`bun`,"bun.lock":`bun`,"yarn.lock":`yarn`,"package-lock.json":`npm`};function A(e=process.cwd()){let t=d(e);for(;;){if(n(l(t,`package.json`)))return t;let e=c(t);if(e===t)return null;t=e}}function j(e){try{return JSON.parse(i(l(e,`package.json`),`utf8`))}catch{return{}}}function M(e){for(let[t,r]of Object.entries(ae))if(n(l(e,t)))return r;let t=j(e).packageManager;if(typeof t==`string`){let e=t.split(`@`)[0];if(e===`pnpm`||e===`npm`||e===`yarn`||e===`bun`)return e}return`npm`}function oe(e){let t=j(e),r={...t.dependencies,...t.devDependencies};return r.next?[`app`,`src/app`].some(t=>n(l(e,t)))?`Next.js (App Router)`:`Next.js (Pages Router)`:r.astro?`Astro`:r[`react-router`]||r[`@remix-run/react`]?`React Router`:r.vite?`Vite`:null}function se(e){for(let t of[`tsconfig.json`,`jsconfig.json`]){let r=l(e,t);if(n(r))try{let e=i(r,`utf8`).replace(/\/\*[\s\S]*?\*\//g,``).replace(/(^|\s)\/\/.*$/gm,`$1`);if(JSON.parse(e)?.compilerOptions?.paths?.[`@/*`])return`@`}catch{}}return null}function ce(e){return l(e,E)}function N(e){let t=ce(e);if(!n(t))return null;try{let e=JSON.parse(i(t,`utf8`));return{componentsDir:e.componentsDir??`components/ui`,alias:e.alias??null,registry:ee(e.registry),...e.style?{style:e.style}:{},...e.radius?{radius:e.radius}:{}}}catch{return null}}function le(e,t){s(ce(e),`${JSON.stringify(t,null,` `)}\n`)}function ue(e,t){let n=j(e),r=new Set([...Object.keys(n.dependencies??{}),...Object.keys(n.devDependencies??{}),...Object.keys(n.peerDependencies??{})]);return t.filter(e=>!r.has(e.name))}function de(e,t,n=!1){return{command:e,args:[e===`npm`?`install`:`add`,...n?[`-D`]:[],...t]}}function P(e=A()){switch(e?M(e):`npm`){case`pnpm`:return`pnpm dlx yummaui`;case`yarn`:return`yarn dlx yummaui`;case`bun`:return`bunx yummaui`;default:return`npx yummaui`}}const fe=e=>n=>t(e,n),F=process.stdout.hasColors?.(2**24)?24:process.stdout.hasColors?.()?4:0,I=(e,n)=>r=>F===24?`\x1b[${e}m${r}\x1b[39m`:t(n,r),L=`38;2;190;198;242`,pe=`38;2;225;212;168`,me=`38;2;168;225;173`,he=`38;2;225;168;168`,R={bold:fe(`bold`),dim:fe(`dim`),accent:I(L,`blue`),success:I(me,`green`),warning:I(pe,`yellow`),danger:I(he,`red`),badge:e=>F===24?`\x1b[1;97;48;2;76;95;199m${e}\x1b[0m`:t([`bold`,`whiteBright`,`bgBlue`],e)},ge={31:he,32:me,33:pe,35:L,36:L},_e=RegExp(`\x1B\\[(3[1-6])m`,`g`);function ve(){if(F!==24)return;let e=process.stdout.write.bind(process.stdout);process.stdout.write=((t,...n)=>e(typeof t==`string`?t.replace(_e,(e,t)=>ge[t]?`\x1b[${ge[t]}m`:e):t,...n))}const z=(e,t)=>`${e} ${t}${e===1?``:t.endsWith(`s`)?`es`:`s`}`;function B(e,t){let[n,...r]=t.split(`
3
3
  `);return[`${R.dim(e.padEnd(11))}${n}`,...r.map(e=>`${` `.repeat(11)}${e}`)].join(`
4
- `)}const V=e=>(t,n)=>p.log.message(B(t,n),{symbol:e,spacing:0}),H={done:V(R.success(p.S_STEP_SUBMIT)),info:V(p.S_INFO),warn:V(R.warning(p.S_WARN)),error:V(R.danger(p.S_ERROR))},U=B;function W(){p.intro(`${F?R.badge(` yummaui `):`yummaui`} ${R.dim(x)}`)}function _e(){p.log.message(``,{symbol:R.dim(p.S_BAR),spacing:0})}function G(e,t){p.outro(B(e,t))}function K(e){return p.cancel(B(`error`,e instanceof Error?e.message:String(e))),1}function q(){return p.cancel(B(`cancelled`,``)),1}function ve(){let e=k();if(!e)return Y.project.missing;let t=M(e);return t?{root:e,config:t}:Y.project.noConfig(P(e))}async function J(e){let t=p.spinner();t.start(B(`registry`,Y.registry.reading));try{let n=await ee(e);return t.stop(B(`registry`,Y.registry.found(n.components.length))),n}catch(e){throw t.error(B(`registry`,Y.registry.unavailable)),e}}const Y={cli:{unknownOption:(e=``)=>`Unknown option ${e}.`,unknownCommand:(e=``)=>`Unknown command "${e}".`,seeHelp:e=>`Run ${e} --help.`},help:(e,t)=>{let n=(e,t)=>` ${R.accent(e.padEnd(24))}${t}`;return`
4
+ `)}const V=e=>(t,n)=>p.log.message(B(t,n),{symbol:e,spacing:0}),H={done:V(R.success(p.S_STEP_SUBMIT)),info:V(p.S_INFO),warn:V(R.warning(p.S_WARN)),error:V(R.danger(p.S_ERROR))},U=B;function W(){p.intro(`${F?R.badge(` yummaui `):`yummaui`} ${R.dim(x)}`)}function ye(){p.log.message(``,{symbol:R.dim(p.S_BAR),spacing:0})}function G(e,t){p.outro(B(e,t))}function K(e){return p.cancel(B(`error`,e instanceof Error?e.message:String(e))),1}function q(){return p.cancel(B(`cancelled`,``)),1}function be(){let e=A();if(!e)return Y.project.missing;let t=N(e);return t?{root:e,config:t}:Y.project.noConfig(P(e))}async function J(e){let t=p.spinner();t.start(B(`registry`,Y.registry.reading));try{let n=await te(e);return t.stop(B(`registry`,Y.registry.found(n.components.length))),n}catch(e){throw t.error(B(`registry`,Y.registry.unavailable)),e}}const Y={cli:{unknownOption:(e=``)=>`Unknown option ${e}.`,unknownCommand:(e=``)=>`Unknown command "${e}".`,seeHelp:e=>`Run ${e} --help.`},help:(e,t)=>{let n=(e,t)=>` ${R.accent(e.padEnd(24))}${t}`;return`
5
5
  ${R.bold(`yummaui`)} ${R.dim(`v${t}`)} Copies Yumma UI components into your project.
6
6
 
7
7
  ${R.bold(`Usage`)} ${e} <command> [options]
@@ -25,20 +25,20 @@ ${R.bold(`Examples`)}
25
25
  ${e} add button tooltip
26
26
  ${e} add button --style compact --radius small
27
27
  ${e} prune --write
28
- `},project:{missing:`No package.json found. Run this inside a project.`,noConfig:e=>`No ${T} found. Run ${R.accent(`${e} init`)} first.`},registry:{reading:`Reading`,found:e=>z(e,`component`),unavailable:`Unavailable`},init:{exists:()=>`${T} exists. ${R.accent(`--force`)} replaces it.`,detected:(e,t,n)=>`${e??`No framework`} with ${t}${n?`, imports through ${n}/`:``}`,where:`Where do components go?`,useAlias:e=>`Import them through ${R.bold(`${e}/`)}?`},add:{nameOne:e=>`Name a component: ${e} add button`,pick:`Which components?`,search:`Type to search`,unknown:(e,t,n)=>`There is no ${R.bold(e)} component. ${t.length?`Did you mean ${t.join(`, `)}?`:`${n} list shows them all.`}`,empty:e=>`${e} has no files.`,replace:e=>`${e} exists. Replace it?`,kept:e=>`${e} ${R.dim(`already there`)}`,nothing:`Nothing written. --overwrite replaces them.`,next:e=>`Import from ${R.accent(e)}`},install:{ask:(e,t)=>`${e.join(`, `)} with ${t}?`,yourself:e=>R.accent(e),failed:e=>`${e} could not install them.`,running:e=>`Running ${e}`,noStart:e=>`Could not start ${e}.`,exited:(e,t)=>`${e} exited with ${t}`},setup:{ask:`Yumma CSS is not set up here. Set it up now?`,unstyled:()=>`Yumma CSS is not set up here, so components render unstyled\n${R.accent(D)}`,declined:()=>`Components render unstyled until it is\n${R.accent(D)}`,docs:()=>R.accent(D),registered:(e,t)=>`${e} registers ${t}`,marked:e=>`${e} starts with ${O}`,noVite:`Add yummacss() from @yummacss/vite to your Vite plugins`,noBuild:`Add @yummacss/vite or @yummacss/postcss to your build`,noStylesheet:`Add ${O} to the stylesheet your app loads`,failed:e=>`Could not change ${e}. The docs have the line to add.`,missingTheme:e=>`Add these to the theme in yumma.config.mjs\n${e.join(`, `)}\n${R.accent(`https://yummacss.com/ui/installation`)}`},list:{next:e=>`${R.accent(`${e} add <component>`)} ${R.dim(`yummacss.com/ui`)}`},prune:{clean:(e,t)=>`Nothing to prune. All ${e} in use, across ${z(t,`file`)}.`,hidden:e=>`${z(e,`file`)} build an import at runtime, so what they load cannot be seen`,next:e=>`Delete them: ${R.accent(`${e} prune --write`)}`,ask:e=>`${z(e,`file`)}?`,kept:`Nothing deleted.`,deleted:e=>`${z(e,`file`)} deleted.`}};function ye(e,t,n,r=!1){let i=n.map(e=>e.slice(0,e.lastIndexOf(`@`))),{command:a,args:o}=N(t,n,r),s=p.taskLog({title:U(`install`,Y.install.running(t)),limit:8}),c=h(a,o,{cwd:e,shell:process.platform===`win32`});for(let e of[c.stdout,c.stderr])e.on(`data`,e=>{for(let t of e.toString().split(/\r?\n/))t.trim()&&s.message(t)});return new Promise(e=>{c.on(`error`,()=>{s.error(U(`install`,Y.install.noStart(a))),e(!1)}),c.on(`close`,t=>{t===0?s.success(U(`install`,i.join(`, `))):s.error(U(`install`,Y.install.exited(a,t)),{showLog:!0}),e(t===0)})})}const X=(e,t)=>t.find(t=>n(l(e,t)))??null,Z=(e,t,n)=>i(l(e,t),`utf8`).includes(n);function be(e){return e?e.startsWith(`Next.js`)?`postcss`:`vite`:null}function xe(e,t){let r=t.split(`/`)[0]??`src`,i=n(l(e,`src`))?[`src`]:[`app`,`pages`,`components`,r].filter(t=>n(l(e,t)));return i.includes(r)||i.push(r),[...new Set(i)].map(e=>`./${e}/**/*.{js,jsx,ts,tsx,mdx}`)}function Se(e,t){if(t===`postcss`)return X(e,[`app/globals.css`,`src/app/globals.css`,`styles/globals.css`,`src/styles/globals.css`]);let r=X(e,[`main`,`index`].flatMap(e=>[`tsx`,`ts`,`jsx`,`js`].map(t=>`src/${e}.${t}`)));if(r){let t=i(l(e,r),`utf8`),a=/import\s+["'](\.{1,2}\/[^"']+\.css)["']/.exec(t)?.[1];if(a){let t=u(e,l(e,c(r),a));if(n(l(e,t)))return t.replace(/\\/g,`/`)}}return X(e,[`src/index.css`,`src/style.css`,`src/styles.css`,`src/App.css`])}const Ce=(e,t)=>Object.keys(t).length?` ${e}: {\n${Object.entries(t).map(([e,t])=>` ${e}: ${JSON.stringify(t)},`).join(`
29
- `)}\n },\n`:``;function we(e,t){let n=t?Ce(`states`,t.states)+Ce(`keyframes`,t.keyframes):``;return`import { defineConfig } from "yummacss";
28
+ `},project:{missing:`No package.json found. Run this inside a project.`,noConfig:e=>`No ${E} found. Run ${R.accent(`${e} init`)} first.`},registry:{reading:`Reading`,found:e=>z(e,`component`),unavailable:`Unavailable`},init:{exists:()=>`${E} exists. ${R.accent(`--force`)} replaces it.`,detected:(e,t,n)=>`${e??`No framework`} with ${t}${n?`, imports through ${n}/`:``}`,where:`Where do components go?`,useAlias:e=>`Import them through ${R.bold(`${e}/`)}?`},add:{nameOne:e=>`Name a component: ${e} add button`,pick:`Which components?`,search:`Type to search`,unknown:(e,t,n)=>`There is no ${R.bold(e)} component. ${t.length?`Did you mean ${t.join(`, `)}?`:`${n} list shows them all.`}`,empty:e=>`${e} has no files.`,replace:e=>`${e} exists. Replace it?`,kept:e=>`${e} ${R.dim(`already there`)}`,nothing:`Nothing written. --overwrite replaces them.`,next:e=>`Import from ${R.accent(e)}`},install:{ask:(e,t)=>`${e.join(`, `)} with ${t}?`,yourself:e=>R.accent(e),failed:e=>`${e} could not install them.`,running:e=>`Running ${e}`,noStart:e=>`Could not start ${e}.`,exited:(e,t)=>`${e} exited with ${t}`},setup:{ask:`Yumma CSS is not set up here. Set it up now?`,unstyled:()=>`Yumma CSS is not set up here, so components render unstyled\n${R.accent(O)}`,declined:()=>`Components render unstyled until it is\n${R.accent(O)}`,docs:()=>R.accent(O),registered:(e,t)=>`${e} registers ${t}`,marked:e=>`${e} starts with ${k}`,noVite:`Add yummacss() from @yummacss/vite to your Vite plugins`,noBuild:`Add @yummacss/vite or @yummacss/postcss to your build`,noStylesheet:`Add ${k} to the stylesheet your app loads`,failed:e=>`Could not change ${e}. The docs have the line to add.`,missingTheme:e=>`Add these to the theme in yumma.config.mjs\n${e.join(`, `)}\n${R.accent(`https://yummacss.com/ui/installation`)}`},list:{next:e=>`${R.accent(`${e} add <component>`)} ${R.dim(`yummacss.com/ui`)}`},prune:{clean:(e,t)=>`Nothing to prune. All ${e} in use, across ${z(t,`file`)}.`,hidden:e=>`${z(e,`file`)} build an import at runtime, so what they load cannot be seen`,next:e=>`Delete them: ${R.accent(`${e} prune --write`)}`,ask:e=>`${z(e,`file`)}?`,kept:`Nothing deleted.`,deleted:e=>`${z(e,`file`)} deleted.`}};function xe(e,t,n,r=!1){let i=n.map(e=>e.slice(0,e.lastIndexOf(`@`))),{command:a,args:o}=de(t,n,r),s=p.taskLog({title:U(`install`,Y.install.running(t)),limit:8}),c=h(a,o,{cwd:e,shell:process.platform===`win32`});for(let e of[c.stdout,c.stderr])e.on(`data`,e=>{for(let t of e.toString().split(/\r?\n/))t.trim()&&s.message(t)});return new Promise(e=>{c.on(`error`,()=>{s.error(U(`install`,Y.install.noStart(a))),e(!1)}),c.on(`close`,t=>{t===0?s.success(U(`install`,i.join(`, `))):s.error(U(`install`,Y.install.exited(a,t)),{showLog:!0}),e(t===0)})})}const X=(e,t)=>t.find(t=>n(l(e,t)))??null,Z=(e,t,n)=>i(l(e,t),`utf8`).includes(n);function Se(e){return e?e.startsWith(`Next.js`)?`postcss`:`vite`:null}function Ce(e,t){let r=t.split(`/`)[0]??`src`,i=n(l(e,`src`))?[`src`]:[`app`,`pages`,`components`,r].filter(t=>n(l(e,t)));return i.includes(r)||i.push(r),[...new Set(i)].map(e=>`./${e}/**/*.{js,jsx,ts,tsx,mdx}`)}function we(e,t){if(t===`postcss`)return X(e,[`app/globals.css`,`src/app/globals.css`,`styles/globals.css`,`src/styles/globals.css`]);let r=X(e,[`main`,`index`].flatMap(e=>[`tsx`,`ts`,`jsx`,`js`].map(t=>`src/${e}.${t}`)));if(r){let t=i(l(e,r),`utf8`),a=/import\s+["'](\.{1,2}\/[^"']+\.css)["']/.exec(t)?.[1];if(a){let t=u(e,l(e,c(r),a));if(n(l(e,t)))return t.replace(/\\/g,`/`)}}return X(e,[`src/index.css`,`src/style.css`,`src/styles.css`,`src/App.css`])}const Te=e=>/^[a-z]+$/.test(e)?e:JSON.stringify(e),Q=(e,t)=>Object.keys(t).length?` ${e}: {\n${Object.entries(t).map(([e,t])=>` ${Te(e)}: ${JSON.stringify(t)},`).join(`
29
+ `)}\n },\n`:``;function Ee(e,t){let n=t?Q(`states`,t.states)+Q(`easings`,t.easings??{})+Q(`keyframes`,t.keyframes):``;return`import { defineConfig } from "yummacss";
30
30
 
31
31
  export default defineConfig({
32
32
  source: [${e.map(e=>`"${e}"`).join(`, `)}],
33
33
  ${n?` theme: {\n${n} },\n`:``}});
34
- `}function Te(e,t){return Object.keys({...t?.states,...t?.keyframes}).filter(t=>!RegExp(`\\b${t}\\s*:`).test(e))}const Ee=(e,t)=>s(t,g(e).code);function De(e){let t=b(e),{config:n,declaration:r}=t.$type===`identifier`?y(e):{config:t,declaration:null};if(!n)throw Error(`no config object`);if(t=n,t.plugins??={},t.plugins[`@yummacss/postcss`]={},r){if(r.init?.type!==`ObjectExpression`)throw Error(`config is not an object literal`);r.init=g(t).code}}function Oe(e,t,r){let a=A(e),o=new Set([...Object.keys(a.dependencies??{}),...Object.keys(a.devDependencies??{})]),c=be(ae(e)),u=c&&`@yummacss/${c}`,d={packages:[],steps:[],manual:[]};if(o.has(`yummacss`)||d.packages.push(`yummacss`),u&&!o.has(u)&&d.packages.push(u),c===`postcss`){let t=X(e,[`postcss.config.mjs`,`postcss.config.js`,`postcss.config.cjs`]);t?Z(e,t,`@yummacss/postcss`)||d.steps.push({stage:`edit`,file:t,apply:async()=>{let n=await _(l(e,t));return De(n),Ee(n,l(e,t)),Y.setup.registered(t,`@yummacss/postcss`)}}):d.steps.push({stage:`write`,file:`postcss.config.mjs`,apply:async()=>(s(l(e,`postcss.config.mjs`),`export default {
34
+ `}function De(e,t){return Object.keys({...t?.states,...t?.easings,...t?.keyframes}).filter(t=>!RegExp(`(?<![\\w-])["']?${t}["']?\\s*:`).test(e))}const Oe=(e,t)=>s(t,g(e).code);function ke(e){let t=b(e),{config:n,declaration:r}=t.$type===`identifier`?y(e):{config:t,declaration:null};if(!n)throw Error(`no config object`);if(t=n,t.plugins??={},t.plugins[`@yummacss/postcss`]={},r){if(r.init?.type!==`ObjectExpression`)throw Error(`config is not an object literal`);r.init=g(t).code}}function Ae(e,t,r){let a=j(e),o=new Set([...Object.keys(a.dependencies??{}),...Object.keys(a.devDependencies??{})]),c=Se(oe(e)),u=c&&`@yummacss/${c}`,d={packages:[],steps:[],manual:[]};if(o.has(`yummacss`)||d.packages.push(`yummacss`),u&&!o.has(u)&&d.packages.push(u),c===`postcss`){let t=X(e,[`postcss.config.mjs`,`postcss.config.js`,`postcss.config.cjs`]);t?Z(e,t,`@yummacss/postcss`)||d.steps.push({stage:`edit`,file:t,apply:async()=>{let n=await _(l(e,t));return ke(n),Oe(n,l(e,t)),Y.setup.registered(t,`@yummacss/postcss`)}}):d.steps.push({stage:`write`,file:`postcss.config.mjs`,apply:async()=>(s(l(e,`postcss.config.mjs`),`export default {
35
35
  plugins: {
36
36
  "@yummacss/postcss": {},
37
37
  },
38
38
  };
39
- `),`postcss.config.mjs`)})}else if(c===`vite`){let t=X(e,[`ts`,`mts`,`js`,`mjs`].map(e=>`vite.config.${e}`));t?Z(e,t,`@yummacss/vite`)||d.steps.push({stage:`edit`,file:t,apply:async()=>{let n=await _(l(e,t));return v(n,{from:`@yummacss/vite`,constructor:`yummacss`}),Ee(n,l(e,t)),Y.setup.registered(t,`yummacss()`)}}):d.manual.push(Y.setup.noVite)}else d.manual.push(Y.setup.noBuild);if(n(l(e,E))){let t=Te(i(l(e,E),`utf8`),r);t.length&&d.manual.push(Y.setup.missingTheme(t))}else d.steps.push({stage:`write`,file:E,apply:async()=>(s(l(e,E),we(xe(e,t),r)),E)});let f=c&&Se(e,c);return f?Z(e,f,`@yummacss`)||d.steps.push({stage:`edit`,file:f,apply:async()=>{let t=l(e,f);return s(t,`${O}\n\n${i(t,`utf8`)}`),Y.setup.marked(f)}}):d.manual.push(Y.setup.noStylesheet),d}async function ke(e,t,n,r){let i=Oe(e,t,r);if(!i.packages.length&&!i.steps.length){for(let e of i.manual)H.warn(`check`,e);return!0}if(!n&&!process.stdout.isTTY)return H.warn(`check`,Y.setup.unstyled()),!0;if(!n){let e=await p.confirm({message:U(`setup`,Y.setup.ask)});if(p.isCancel(e))return q(),!1;if(!e)return H.warn(`check`,Y.setup.declined()),!0}if(i.packages.length&&!await ye(e,j(e),i.packages,!0))return!1;for(let e of i.steps)try{H.done(e.stage,await e.apply())}catch{H.warn(e.stage,Y.setup.failed(e.file))}for(let e of i.manual)H.warn(`manual`,e);return i.manual.length&&H.info(`docs`,Y.setup.docs()),!0}function Ae(e,t,n){return n===`base`?`${t}.tsx`:`${e}.tsx`}function je(e,t,n={}){let r=[];n.all&&r.push(...e.components.map(e=>e.base));for(let n of t){let t=e.components.find(e=>e.component===n);if(!t)return{unknown:n};r.push(t.base)}return{ids:[...new Set(r)]}}function Me(e,t){return e.components.map(({component:e})=>({component:e,score:e.includes(t)||t.includes(e)?0:m(e,t)})).filter(e=>e.score<=2).sort((e,t)=>e.score-t.score).slice(0,5).map(e=>e.component)}async function Ne(e,t){W();let i=ve();if(typeof i==`string`)return K(i);let{root:a,config:o}=i,d;try{d=await J(o.registry)}catch(e){return K(e)}if(e.length===0&&!t.all){if(t.yes||!process.stdout.isTTY)return K(Y.add.nameOne(P(a)));let n=await p.autocompleteMultiselect({message:Y.add.pick,placeholder:Y.add.search,options:d.components.map(e=>({value:e.component,label:e.component})),required:!0});if(p.isCancel(n))return q();e=n}let f=je(d,e,{all:t.all});if(`unknown`in f){let e=Me(d,f.unknown);return K(Y.add.unknown(f.unknown,e,P(a)))}let m=o.registry,h=t.style??o.style??null,g=t.radius??o.radius??null;if(h||g)try{let e=re(await ne(o.registry),h,g);if(`error`in e)return K(e.error);m=`${o.registry}/${e.folder}`,H.info(`style`,e.folder)}catch(e){return K(e)}let _=[],v=new Set;async function y(e){if(v.has(e))return;v.add(e);let t=await te(m,e);for(let e of t.registryDependencies)await y(e);_.push(t)}try{for(let e of f.ids)await y(e)}catch(e){return K(e)}let b=[],x=[],S=new Map;for(let e of _){let i=e.files[0];if(!i)return K(Y.add.empty(e.id));let d=l(a,o.componentsDir,Ae(e.id,e.component,e.variant)),m=u(a,d).replace(/\\/g,`/`);if(n(d)&&!t.overwrite){if(!f.ids.includes(e.id)||t.yes||!process.stdout.isTTY){x.push(m);continue}let n=await p.confirm({message:U(`write`,Y.add.replace(m)),initialValue:!1});if(p.isCancel(n))return q();if(!n){x.push(m);continue}}r(c(d),{recursive:!0}),s(d,i.content),b.push(m);for(let t of e.dependencies)S.set(t.name,t.version)}if(b.length>0&&H.done(`write`,b.join(`
39
+ `),`postcss.config.mjs`)})}else if(c===`vite`){let t=X(e,[`ts`,`mts`,`js`,`mjs`].map(e=>`vite.config.${e}`));t?Z(e,t,`@yummacss/vite`)||d.steps.push({stage:`edit`,file:t,apply:async()=>{let n=await _(l(e,t));return v(n,{from:`@yummacss/vite`,constructor:`yummacss`}),Oe(n,l(e,t)),Y.setup.registered(t,`yummacss()`)}}):d.manual.push(Y.setup.noVite)}else d.manual.push(Y.setup.noBuild);if(n(l(e,D))){let t=De(i(l(e,D),`utf8`),r);t.length&&d.manual.push(Y.setup.missingTheme(t))}else d.steps.push({stage:`write`,file:D,apply:async()=>(s(l(e,D),Ee(Ce(e,t),r)),D)});let f=c&&we(e,c);return f?Z(e,f,`@yummacss`)||d.steps.push({stage:`edit`,file:f,apply:async()=>{let t=l(e,f);return s(t,`${k}\n\n${i(t,`utf8`)}`),Y.setup.marked(f)}}):d.manual.push(Y.setup.noStylesheet),d}async function je(e,t,n,r){let i=Ae(e,t,r);if(!i.packages.length&&!i.steps.length){for(let e of i.manual)H.warn(`check`,e);return!0}if(!n&&!process.stdout.isTTY)return H.warn(`check`,Y.setup.unstyled()),!0;if(!n){let e=await p.confirm({message:U(`setup`,Y.setup.ask)});if(p.isCancel(e))return q(),!1;if(!e)return H.warn(`check`,Y.setup.declined()),!0}if(i.packages.length&&!await xe(e,M(e),i.packages,!0))return!1;for(let e of i.steps)try{H.done(e.stage,await e.apply())}catch{H.warn(e.stage,Y.setup.failed(e.file))}for(let e of i.manual)H.warn(`manual`,e);return i.manual.length&&H.info(`docs`,Y.setup.docs()),!0}function Me(e,t,n){return n===`base`?`${t}.tsx`:`${e}.tsx`}function Ne(e,t,n={}){let r=[];n.all&&r.push(...e.components.map(e=>e.base));for(let n of t){let t=e.components.find(e=>e.component===n);if(!t)return{unknown:n};r.push(t.base)}return{ids:[...new Set(r)]}}function Pe(e,t){return e.components.map(({component:e})=>({component:e,score:e.includes(t)||t.includes(e)?0:m(e,t)})).filter(e=>e.score<=2).sort((e,t)=>e.score-t.score).slice(0,5).map(e=>e.component)}async function Fe(e,t){W();let i=be();if(typeof i==`string`)return K(i);let{root:a,config:o}=i,d;try{d=await J(o.registry)}catch(e){return K(e)}if(e.length===0&&!t.all){if(t.yes||!process.stdout.isTTY)return K(Y.add.nameOne(P(a)));let n=await p.autocompleteMultiselect({message:Y.add.pick,placeholder:Y.add.search,options:d.components.map(e=>({value:e.component,label:e.component})),required:!0});if(p.isCancel(n))return q();e=n}let f=Ne(d,e,{all:t.all});if(`unknown`in f){let e=Pe(d,f.unknown);return K(Y.add.unknown(f.unknown,e,P(a)))}let m=o.registry,h=t.style??o.style??null,g=t.radius??o.radius??null;if(h||g)try{let e=ie(await re(o.registry),h,g);if(`error`in e)return K(e.error);m=`${o.registry}/${e.folder}`,H.info(`style`,e.folder)}catch(e){return K(e)}let _=[],v=new Set;async function y(e){if(v.has(e))return;v.add(e);let t=await ne(m,e);for(let e of t.registryDeps)await y(e);_.push(t)}try{for(let e of f.ids)await y(e)}catch(e){return K(e)}let b=[],x=[],S=new Map;for(let e of _){let i=e.files[0];if(!i)return K(Y.add.empty(e.id));let d=l(a,o.componentsDir,Me(e.id,e.component,e.variant)),m=u(a,d).replace(/\\/g,`/`);if(n(d)&&!t.overwrite){if(!f.ids.includes(e.id)||t.yes||!process.stdout.isTTY){x.push(m);continue}let n=await p.confirm({message:U(`write`,Y.add.replace(m)),initialValue:!1});if(p.isCancel(n))return q();if(!n){x.push(m);continue}}r(c(d),{recursive:!0}),s(d,i.content),b.push(m);for(let t of e.dependencies)S.set(t.name,t.version)}if(b.length>0&&H.done(`write`,b.join(`
40
40
  `)),x.length>0&&H.warn(`kept`,x.map(Y.add.kept).join(`
41
- `)),b.length===0)return G(`next`,Y.add.nothing),0;let C=le(a,[...S].map(([e,t])=>({name:e,version:t})));if(C.length>0){let e=j(a),n=C.map(e=>`${e.name}@${e.version}`),r=C.map(e=>e.name),i=t.yes===!0;if(!i){let t=await p.confirm({message:U(`install`,Y.install.ask(r,e))});if(p.isCancel(t))return q();i=t}if(i){if(!await ye(a,e,n))return K(Y.install.failed(e))}else{let{command:t,args:r}=N(e,n);H.info(`install`,Y.install.yourself([t,...r].join(` `)))}}return await ke(a,o.componentsDir,t.yes===!0,d.theme)?(G(`next`,Y.add.next(o.alias??o.componentsDir)),0):1}async function Pe(e){W(),_e();let t=k();if(!t)return K(Y.project.missing);if(M(t)&&!e.force)return G(`next`,Y.init.exists()),0;let r=ae(t),i=oe(t);H.info(`project`,Y.init.detected(r,j(t),i));let a=n(l(t,`src`))?`src/components/ui`:`components/ui`,o=e.yes?a:await p.text({message:Y.init.where,placeholder:a,defaultValue:a});if(p.isCancel(o))return q();let s=!!i;if(i&&!e.yes){let e=await p.confirm({message:Y.init.useAlias(i)});if(p.isCancel(e))return q();s=e}let c={componentsDir:o,alias:s?`${i}/${o}`:null,registry:S};ce(t,c),H.done(`write`,T);let u=await ee(c.registry).then(e=>e.theme,()=>void 0);return await ke(t,o,e.yes===!0,u)?(G(`next`,R.accent(`${P(t)} add`)),0):1}async function Fe(){W();let e=k(),t=e&&M(e)?.registry||S,n;try{n=await J(t)}catch(e){return K(e)}let r=n.components.map(e=>e.component),i=Math.max(...r.map(e=>e.length))+2,a=[];for(let e=0;e<r.length;e+=3)a.push(r.slice(e,e+3).map(e=>e.padEnd(i)).join(``).trimEnd());return H.done(`available`,a.join(`
42
- `)),G(`next`,Y.list.next(P(e))),0}const Ie=[`.astro`,`.cjs`,`.cts`,`.js`,`.jsx`,`.md`,`.mdx`,`.mjs`,`.mts`,`.svelte`,`.ts`,`.tsx`,`.vue`],Le=new Set([`node_modules`,`.git`]),Re=[/\bfrom\s*["']([^"'\n]+)["']/g,/\bimport\s*\(\s*["']([^"'\n]+)["']/g,/\brequire\s*\(\s*["']([^"'\n]+)["']/g,/\bimport\s+["']([^"'\n]+)["']/g];function ze(e){let t=new Set;for(let n of Re){n.lastIndex=0;for(let r of e.matchAll(n))r[1]&&t.add(r[1])}return[...t]}const Be=/\b(?:from|import\s*\(|require\s*\()\s*`/;function Ve(e){return Be.test(e)}function Q(e){let t=e.split(f).join(`/`).replace(/^\.\//,``);for(let e of Ie)if(t.endsWith(e))return t.slice(0,-e.length);return t}function He(e,t,n){let r=d(n.root,n.componentsDir);if(n.alias){let t=`${n.alias}/`;if(e===n.alias)return`index`;if(e.startsWith(t)){let n=e.slice(t.length);return n?Q(n):`index`}}if(!e.startsWith(`.`))return null;let i=u(r,d(c(t),e));return i?i===`..`||i.startsWith(`..${f}`)?null:Q(i):`index`}function Ue(e,t){return Q(u(d(t.root,t.componentsDir),e))}function $(e,t,n=[]){let r;try{r=a(e,{withFileTypes:!0})}catch{return n}for(let i of r){let r=l(e,i.name);if(i.isDirectory()){if(Le.has(i.name)||r===t)continue;$(r,t,n)}else if(i.isFile()){let e=i.name.lastIndexOf(`.`);e>0&&Ie.includes(i.name.slice(e))&&n.push(r)}}return n}function We(e){let t=new Set;for(let n of e.components)t.add(`${n.component}.tsx`);return t}function Ge(e,t){let n=d(e.root,e.componentsDir),r=$(n,``),a=$(e.root,n),o=new Map,s=new Set,c=new Map,l=[];for(let n of r){let r=Ue(n,e);n.endsWith(`.tsx`)&&!r.includes(`/`)&&t.has(`${r}.tsx`)?o.set(r,n):s.add(r);let a=i(n,`utf8`);Ve(a)&&l.push(n);let u=new Set;for(let t of ze(a)){let r=He(t,n,e);r&&u.add(r)}c.set(r,u)}for(let t of a){let n=i(t,`utf8`);Ve(n)&&l.push(t);for(let r of ze(n)){let n=He(r,t,e);n&&s.add(n)}}let u=new Set,f=[...s];for(;f.length>0;){let e=f.pop();if(!u.has(e)){u.add(e);for(let t of c.get(e)??[])u.has(t)||f.push(t)}}let p=[];for(let[e,t]of o)u.has(e)||p.push(t);return{unused:p.sort(),kept:o.size-p.length,foreign:r.length-o.size,scanned:r.length+a.length,computed:l}}async function Ke(e){W();let t=ve();if(typeof t==`string`)return K(t);let{root:n,config:r}=t,i;try{i=await J(r.registry)}catch(e){return K(e)}let a=Ge({root:n,componentsDir:r.componentsDir,alias:r.alias},We(i)),s=e=>u(n,e).replace(/\\/g,`/`);if(a.computed.length>0&&H.warn(`hidden`,`${Y.prune.hidden(a.computed.length)}\n${a.computed.slice(0,5).map(e=>R.dim(s(e))).join(`
41
+ `)),b.length===0)return G(`next`,Y.add.nothing),0;let C=ue(a,[...S].map(([e,t])=>({name:e,version:t})));if(C.length>0){let e=M(a),n=C.map(e=>`${e.name}@${e.version}`),r=C.map(e=>e.name),i=t.yes===!0;if(!i){let t=await p.confirm({message:U(`install`,Y.install.ask(r,e))});if(p.isCancel(t))return q();i=t}if(i){if(!await xe(a,e,n))return K(Y.install.failed(e))}else{let{command:t,args:r}=de(e,n);H.info(`install`,Y.install.yourself([t,...r].join(` `)))}}return await je(a,o.componentsDir,t.yes===!0,d.theme)?(G(`next`,Y.add.next(o.alias??o.componentsDir)),0):1}async function Ie(e){W(),ye();let t=A();if(!t)return K(Y.project.missing);if(N(t)&&!e.force)return G(`next`,Y.init.exists()),0;let r=oe(t),i=se(t);H.info(`project`,Y.init.detected(r,M(t),i));let a=n(l(t,`src`))?`src/components/ui`:`components/ui`,o=e.yes?a:await p.text({message:Y.init.where,placeholder:a,defaultValue:a});if(p.isCancel(o))return q();let s=!!i;if(i&&!e.yes){let e=await p.confirm({message:Y.init.useAlias(i)});if(p.isCancel(e))return q();s=e}let c={componentsDir:o,alias:s?`${i}/${o}`:null,registry:S};le(t,c),H.done(`write`,E);let u=await te(c.registry).then(e=>e.theme,()=>void 0);return await je(t,o,e.yes===!0,u)?(G(`next`,R.accent(`${P(t)} add`)),0):1}async function Le(){W();let e=A(),t=e&&N(e)?.registry||S,n;try{n=await J(t)}catch(e){return K(e)}let r=n.components.map(e=>e.component),i=Math.max(...r.map(e=>e.length))+2,a=[];for(let e=0;e<r.length;e+=3)a.push(r.slice(e,e+3).map(e=>e.padEnd(i)).join(``).trimEnd());return H.done(`available`,a.join(`
42
+ `)),G(`next`,Y.list.next(P(e))),0}const Re=[`.astro`,`.cjs`,`.cts`,`.js`,`.jsx`,`.md`,`.mdx`,`.mjs`,`.mts`,`.svelte`,`.ts`,`.tsx`,`.vue`],ze=new Set([`node_modules`,`.git`]),Be=[/\bfrom\s*["']([^"'\n]+)["']/g,/\bimport\s*\(\s*["']([^"'\n]+)["']/g,/\brequire\s*\(\s*["']([^"'\n]+)["']/g,/\bimport\s+["']([^"'\n]+)["']/g];function Ve(e){let t=new Set;for(let n of Be){n.lastIndex=0;for(let r of e.matchAll(n))r[1]&&t.add(r[1])}return[...t]}const He=/\b(?:from|import\s*\(|require\s*\()\s*`/;function Ue(e){return He.test(e)}function $(e){let t=e.split(f).join(`/`).replace(/^\.\//,``);for(let e of Re)if(t.endsWith(e))return t.slice(0,-e.length);return t}function We(e,t,n){let r=d(n.root,n.componentsDir);if(n.alias){let t=`${n.alias}/`;if(e===n.alias)return`index`;if(e.startsWith(t)){let n=e.slice(t.length);return n?$(n):`index`}}if(!e.startsWith(`.`))return null;let i=u(r,d(c(t),e));return i?i===`..`||i.startsWith(`..${f}`)?null:$(i):`index`}function Ge(e,t){return $(u(d(t.root,t.componentsDir),e))}function Ke(e,t,n=[]){let r;try{r=a(e,{withFileTypes:!0})}catch{return n}for(let i of r){let r=l(e,i.name);if(i.isDirectory()){if(ze.has(i.name)||r===t)continue;Ke(r,t,n)}else if(i.isFile()){let e=i.name.lastIndexOf(`.`);e>0&&Re.includes(i.name.slice(e))&&n.push(r)}}return n}function qe(e){let t=new Set;for(let n of e.components)t.add(`${n.component}.tsx`);return t}function Je(e,t){let n=d(e.root,e.componentsDir),r=Ke(n,``),a=Ke(e.root,n),o=new Map,s=new Set,c=new Map,l=[];for(let n of r){let r=Ge(n,e);n.endsWith(`.tsx`)&&!r.includes(`/`)&&t.has(`${r}.tsx`)?o.set(r,n):s.add(r);let a=i(n,`utf8`);Ue(a)&&l.push(n);let u=new Set;for(let t of Ve(a)){let r=We(t,n,e);r&&u.add(r)}c.set(r,u)}for(let t of a){let n=i(t,`utf8`);Ue(n)&&l.push(t);for(let r of Ve(n)){let n=We(r,t,e);n&&s.add(n)}}let u=new Set,f=[...s];for(;f.length>0;){let e=f.pop();if(!u.has(e)){u.add(e);for(let t of c.get(e)??[])u.has(t)||f.push(t)}}let p=[];for(let[e,t]of o)u.has(e)||p.push(t);return{unused:p.sort(),kept:o.size-p.length,foreign:r.length-o.size,scanned:r.length+a.length,computed:l}}async function Ye(e){W();let t=be();if(typeof t==`string`)return K(t);let{root:n,config:r}=t,i;try{i=await J(r.registry)}catch(e){return K(e)}let a=Je({root:n,componentsDir:r.componentsDir,alias:r.alias},qe(i)),s=e=>u(n,e).replace(/\\/g,`/`);if(a.computed.length>0&&H.warn(`hidden`,`${Y.prune.hidden(a.computed.length)}\n${a.computed.slice(0,5).map(e=>R.dim(s(e))).join(`
43
43
  `)}`),a.unused.length===0)return G(`next`,Y.prune.clean(a.kept,a.scanned)),0;if(H.warn(`unused`,a.unused.map(s).join(`
44
- `)),!e.write)return G(`next`,Y.prune.next(P(n))),0;if(!e.yes){let e=await p.confirm({message:U(`delete`,Y.prune.ask(a.unused.length)),initialValue:!1});if(p.isCancel(e))return q();if(!e)return G(`next`,Y.prune.kept),0}for(let e of a.unused)o(e,{force:!0});return G(`delete`,Y.prune.deleted(a.unused.length)),0}const qe={all:{type:`boolean`,short:`a`},style:{type:`string`},radius:{type:`string`},overwrite:{type:`boolean`},write:{type:`boolean`},force:{type:`boolean`},yes:{type:`boolean`,short:`y`},help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`V`}},Je=t=>e({args:t,options:qe,allowPositionals:!0}),Ye=()=>Y.help(P(),x);async function Xe(){ge();let e;try{e=Je(process.argv.slice(2))}catch(e){let t=e.code===`ERR_PARSE_ARGS_UNKNOWN_OPTION`,n=String(e).match(/'(-[^']+)'/)?.[1];return console.error(R.danger(t?Y.cli.unknownOption(n):String(e.message))),console.error(Y.cli.seeHelp(P())),1}let{values:t,positionals:n}=e,[r,...i]=n;if(t.version)return console.log(x),0;switch(t.help?void 0:r){case`init`:return Pe(t);case`add`:return Ne(i,t);case`list`:case`ls`:return Fe();case`prune`:return Ke(t);case void 0:return console.log(Ye()),0;default:return console.error(R.danger(Y.cli.unknownCommand(r))),console.log(Ye()),1}}Xe().then(e=>{process.exitCode=e}).catch(e=>{console.error(R.danger(e instanceof Error?e.message:String(e))),process.exitCode=1});export{};
44
+ `)),!e.write)return G(`next`,Y.prune.next(P(n))),0;if(!e.yes){let e=await p.confirm({message:U(`delete`,Y.prune.ask(a.unused.length)),initialValue:!1});if(p.isCancel(e))return q();if(!e)return G(`next`,Y.prune.kept),0}for(let e of a.unused)o(e,{force:!0});return G(`delete`,Y.prune.deleted(a.unused.length)),0}const Xe={all:{type:`boolean`,short:`a`},style:{type:`string`},radius:{type:`string`},overwrite:{type:`boolean`},write:{type:`boolean`},force:{type:`boolean`},yes:{type:`boolean`,short:`y`},help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`V`}},Ze=t=>e({args:t,options:Xe,allowPositionals:!0}),Qe=()=>Y.help(P(),x);async function $e(){ve();let e;try{e=Ze(process.argv.slice(2))}catch(e){let t=e.code===`ERR_PARSE_ARGS_UNKNOWN_OPTION`,n=String(e).match(/'(-[^']+)'/)?.[1];return console.error(R.danger(t?Y.cli.unknownOption(n):String(e.message))),console.error(Y.cli.seeHelp(P())),1}let{values:t,positionals:n}=e,[r,...i]=n;if(t.version)return console.log(x),0;switch(t.help?void 0:r){case`init`:return Ie(t);case`add`:return Fe(i,t);case`list`:case`ls`:return Le();case`prune`:return Ye(t);case void 0:return console.log(Qe()),0;default:return console.error(R.danger(Y.cli.unknownCommand(r))),console.log(Qe()),1}}$e().then(e=>{process.exitCode=e}).catch(e=>{console.error(R.danger(e instanceof Error?e.message:String(e))),process.exitCode=1});export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yummaui",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Add Yumma UI components to your project.",
5
5
  "keywords": [
6
6
  "yummacss",