@uselets/ui 1.14.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -53,10 +53,15 @@ bun uselets init
53
53
  ```
54
54
 
55
55
  The command asks which theme to import, asks for your global CSS path with `src/styles/globals.css` as the
56
- default, and optionally installs the agent skill. For non-interactive setup, pass options:
56
+ default, and optionally installs the agent skill. It also imports the Inter font: it detects a conventional
57
+ app entry file (`app/layout.tsx`, `pages/_app.tsx`, `src/main.tsx`, `src/index.tsx`, and `.jsx` variants) and
58
+ inserts `import '@fontsource-variable/inter'` there, or asks for the entry file path when none is found. This
59
+ avoids `@import '@fontsource-variable/inter'` in the global CSS, which some bundlers (including Next.js) don't
60
+ resolve correctly for third-party CSS — import it as a JS module instead. For non-interactive setup, pass
61
+ options:
57
62
 
58
63
  ```bash
59
- bun uselets init --theme max --css src/styles/globals.css --no-install-skill
64
+ bun uselets init --theme max --css src/styles/globals.css --entry app/layout.tsx --no-install-skill
60
65
  ```
61
66
 
62
67
  ## Tailwind CSS v4 setup
@@ -76,13 +81,12 @@ npm install tailwindcss @tailwindcss/postcss
76
81
  export { default } from '@uselets/ui/postcss.config'
77
82
  ```
78
83
 
79
- 3. Import Tailwind, one package theme, and the Inter font in your global stylesheet:
84
+ 3. Import Tailwind and one package theme in your global stylesheet:
80
85
 
81
86
  ```css
82
87
  /* app.css */
83
88
  @import 'tailwindcss';
84
89
  @import '@uselets/ui/themes/max.css';
85
- @import '@fontsource-variable/inter';
86
90
  ```
87
91
 
88
92
  Use `@uselets/ui/themes/gomax.css` instead for GoMax apps. If your app consumes `@uselets/ui` components, add a
@@ -92,17 +96,25 @@ source directive so Tailwind can generate classes used by the package:
92
96
  @source '../node_modules/@uselets/ui/dist';
93
97
  ```
94
98
 
99
+ 4. Import the Inter font once from your app's entry file (not from CSS — bundlers such as Next.js don't
100
+ resolve third-party CSS `@import`s reliably):
101
+
102
+ ```ts
103
+ // app/layout.tsx (or src/main.tsx, pages/_app.tsx, ...)
104
+ import '@fontsource-variable/inter'
105
+ ```
106
+
95
107
  ## Quick start
96
108
 
97
- 1. Import one package theme once in your global stylesheet:
109
+ 1. Import Tailwind and one package theme once in your global stylesheet:
98
110
 
99
111
  ```css
100
112
  @import 'tailwindcss';
101
113
  @import '@uselets/ui/themes/max.css';
102
- @import '@fontsource-variable/inter';
103
114
  ```
104
115
 
105
- For GoMax apps, import `@uselets/ui/themes/gomax.css` instead.
116
+ For GoMax apps, import `@uselets/ui/themes/gomax.css` instead. Import the font once from your app's entry
117
+ file, as shown above.
106
118
 
107
119
  2. Import components from the package root:
108
120
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import{spawn as e}from"node:child_process";import t from"node:fs/promises";import n from"node:path";import r from"node:readline/promises";import{fileURLToPath as i}from"node:url";import{Command as a,Option as o}from"commander";const s=`uselets-ui`,c={codex:n.join(`.agents`,`skills`,s),claude:n.join(`.claude`,`skills`,s)},l=Object.keys(c);async function u(e){try{return await t.access(e),!0}catch{return!1}}async function d(e){return JSON.parse(await t.readFile(e,`utf8`))}async function f(){let e=i(new URL(`.`,import.meta.url));for(;;)try{return await t.access(n.join(e,`package.json`)),e}catch{let t=n.dirname(e);if(t===e)throw Error(`Unable to resolve @uselets/ui package root`);e=t}}function p(e){return e===`all`?l:[e]}function m(e,t){return!!(e.dependencies?.[t]||e.devDependencies?.[t]||e.peerDependencies?.[t]||e.optionalDependencies?.[t])}async function h(e,t){let r=t.packageManager?.split(`@`)[0];return r===`bun`||r===`pnpm`||r===`yarn`||r===`npm`?r:await u(n.join(e,`bun.lock`))?`bun`:await u(n.join(e,`pnpm-lock.yaml`))?`pnpm`:await u(n.join(e,`yarn.lock`))?`yarn`:(await u(n.join(e,`package-lock.json`)),`npm`)}function g(e,t,n){switch(e){case`bun`:return[`bun`,`add`,...n?[`-d`]:[],...t];case`pnpm`:return[`pnpm`,`add`,...n?[`-D`]:[],...t];case`yarn`:return[`yarn`,`add`,...n?[`-D`]:[],...t];case`npm`:return[`npm`,`install`,...n?[`-D`]:[],...t]}}async function _(t,n){let[r,...i]=t;if(!r)throw Error(`Missing command`);console.log(`Running: ${t.join(` `)}`),await new Promise((t,a)=>{let o=e(r,i,{cwd:n,stdio:`inherit`});o.on(`error`,a),o.on(`close`,e=>{if(e===0){t();return}a(Error(`${r} exited with code ${e}`))})})}function v(e,t){let n=e.dependencies?.[t]??e.devDependencies?.[t];if(!n)throw Error(`Unable to find ${t} version in @uselets/ui package metadata`);return n}async function y(e,t){let r=await f(),i=await d(n.join(r,`package.json`)),a=await h(e,t),o=[],s=[];if(!i.name||!i.version)throw Error(`Unable to resolve @uselets/ui package name and version`);m(t,i.name)||o.push(`${i.name}@${i.version}`),m(t,`@fontsource-variable/inter`)||o.push(`@fontsource-variable/inter@${v(i,`@fontsource-variable/inter`)}`),m(t,`tailwindcss`)||s.push(`tailwindcss@${v(i,`tailwindcss`)}`),m(t,`@tailwindcss/postcss`)||s.push(`@tailwindcss/postcss@${v(i,`@tailwindcss/postcss`)}`),o.length>0?await _(g(a,o,!1),e):console.log(`Runtime dependencies already declared.`),s.length>0?await _(g(a,s,!0),e):console.log(`Tailwind dependencies already declared.`)}async function b(e){let r=await f(),i=n.join(r,`skills`,s);try{await t.access(i)}catch{throw Error(`Bundled skill not found at ${i}`)}let a=[];for(let r of e){let e=n.join(process.cwd(),c[r]);await t.rm(e,{recursive:!0,force:!0}),await t.mkdir(n.dirname(e),{recursive:!0}),await t.cp(i,e,{recursive:!0}),a.push(e)}console.log(`Installed ${s} skill:`);for(let e of a)console.log(`- ${e}`)}async function x(){return r.createInterface({input:process.stdin,output:process.stdout})}async function S(e){if(!process.stdin.isTTY)return e;let t=await x();try{for(;;){let n=(await t.question(`Theme (max/gomax) [${e}]: `)).trim().toLowerCase();if(!n)return e;if(n===`max`||n===`gomax`)return n;console.log(`Please choose "max" or "gomax".`)}}finally{t.close()}}async function C(e){if(!process.stdin.isTTY)return e;let t=await x();try{return(await t.question(`Global CSS path [${e}]: `)).trim()||e}finally{t.close()}}async function w(){if(!process.stdin.isTTY)return!1;let e=await x();try{for(;;){let t=(await e.question(`Install agent skill? (y/N): `)).trim().toLowerCase();if(!t||t===`n`||t===`no`)return!1;if(t===`y`||t===`yes`)return!0;console.log(`Please answer "y" or "n".`)}}finally{e.close()}}async function T(e){let r=n.join(e,`postcss.config.mjs`);if(await u(r)){console.log(`Preserved existing postcss.config.mjs.`);return}await t.writeFile(r,`export { default } from '@uselets/ui/postcss.config'
3
- `),console.log(`Created postcss.config.mjs.`)}function E(e){let t=n.posix.dirname(e.replaceAll(n.sep,n.posix.sep)),r=n.posix.relative(t,`node_modules/@uselets/ui/dist`);return r.startsWith(`.`)?r:`./${r}`}function D(e,t,n){let r=[],i=/@import\s+['"]tailwindcss['"]/.test(e),a=/@import\s+['"]@uselets\/ui\/themes\/(?:max|gomax)\.css['"]/.test(e),o=/@import\s+['"]@fontsource-variable\/inter['"]/.test(e),s=/@source\s+['"][^'"]*@uselets\/ui\/dist['"]/.test(e);return i||r.push(`@import 'tailwindcss';`),a||r.push(`@import '@uselets/ui/themes/${t}.css';`),o||r.push(`@import '@fontsource-variable/inter';`),s||r.push(`@source '${E(n)}';`),{imports:r,hasTheme:a}}async function O(e,r,i){let a=n.resolve(e,r),o=await u(a)?await t.readFile(a,`utf8`):``,{imports:s,hasTheme:c}=D(o,i,r);if(c&&console.log(`Preserved existing @uselets/ui theme import.`),s.length===0){console.log(`Global CSS already configured at ${r}.`);return}let l=o.length>0&&!o.startsWith(`
2
+ import{spawn as e}from"node:child_process";import t from"node:fs/promises";import n from"node:path";import r from"node:readline/promises";import{fileURLToPath as i}from"node:url";import{Command as a,Option as o}from"commander";const s=`uselets-ui`,c=`@fontsource-variable/inter`,l=[`app/layout.tsx`,`app/layout.jsx`,`pages/_app.tsx`,`pages/_app.jsx`,`src/main.tsx`,`src/main.jsx`,`src/index.tsx`,`src/index.jsx`],u={codex:n.join(`.agents`,`skills`,s),claude:n.join(`.claude`,`skills`,s)},d=Object.keys(u);async function f(e){try{return await t.access(e),!0}catch{return!1}}async function p(e){return JSON.parse(await t.readFile(e,`utf8`))}async function m(){let e=i(new URL(`.`,import.meta.url));for(;;)try{return await t.access(n.join(e,`package.json`)),e}catch{let t=n.dirname(e);if(t===e)throw Error(`Unable to resolve @uselets/ui package root`);e=t}}function h(e){return e===`all`?d:[e]}function g(e,t){return!!(e.dependencies?.[t]||e.devDependencies?.[t]||e.peerDependencies?.[t]||e.optionalDependencies?.[t])}async function _(e,t){let r=t.packageManager?.split(`@`)[0];return r===`bun`||r===`pnpm`||r===`yarn`||r===`npm`?r:await f(n.join(e,`bun.lock`))?`bun`:await f(n.join(e,`pnpm-lock.yaml`))?`pnpm`:await f(n.join(e,`yarn.lock`))?`yarn`:(await f(n.join(e,`package-lock.json`)),`npm`)}function v(e,t,n){switch(e){case`bun`:return[`bun`,`add`,...n?[`-d`]:[],...t];case`pnpm`:return[`pnpm`,`add`,...n?[`-D`]:[],...t];case`yarn`:return[`yarn`,`add`,...n?[`-D`]:[],...t];case`npm`:return[`npm`,`install`,...n?[`-D`]:[],...t]}}async function y(t,n){let[r,...i]=t;if(!r)throw Error(`Missing command`);console.log(`Running: ${t.join(` `)}`),await new Promise((t,a)=>{let o=e(r,i,{cwd:n,stdio:`inherit`});o.on(`error`,a),o.on(`close`,e=>{if(e===0){t();return}a(Error(`${r} exited with code ${e}`))})})}function b(e,t){let n=e.dependencies?.[t]??e.devDependencies?.[t];if(!n)throw Error(`Unable to find ${t} version in @uselets/ui package metadata`);return n}async function x(e,t){let r=await m(),i=await p(n.join(r,`package.json`)),a=await _(e,t),o=[],s=[];if(!i.name||!i.version)throw Error(`Unable to resolve @uselets/ui package name and version`);g(t,i.name)||o.push(`${i.name}@${i.version}`),g(t,c)||o.push(`${c}@${b(i,c)}`),g(t,`tailwindcss`)||s.push(`tailwindcss@${b(i,`tailwindcss`)}`),g(t,`@tailwindcss/postcss`)||s.push(`@tailwindcss/postcss@${b(i,`@tailwindcss/postcss`)}`),o.length>0?await y(v(a,o,!1),e):console.log(`Runtime dependencies already declared.`),s.length>0?await y(v(a,s,!0),e):console.log(`Tailwind dependencies already declared.`)}async function S(e){let r=await m(),i=n.join(r,`skills`,s);try{await t.access(i)}catch{throw Error(`Bundled skill not found at ${i}`)}let a=[];for(let r of e){let e=n.join(process.cwd(),u[r]);await t.rm(e,{recursive:!0,force:!0}),await t.mkdir(n.dirname(e),{recursive:!0}),await t.cp(i,e,{recursive:!0}),a.push(e)}console.log(`Installed ${s} skill:`);for(let e of a)console.log(`- ${e}`)}async function C(){return r.createInterface({input:process.stdin,output:process.stdout})}async function w(e){if(!process.stdin.isTTY)return e;let t=await C();try{for(;;){let n=(await t.question(`Theme (max/gomax) [${e}]: `)).trim().toLowerCase();if(!n)return e;if(n===`max`||n===`gomax`)return n;console.log(`Please choose "max" or "gomax".`)}}finally{t.close()}}async function T(e){if(!process.stdin.isTTY)return e;let t=await C();try{return(await t.question(`Global CSS path [${e}]: `)).trim()||e}finally{t.close()}}async function E(){if(!process.stdin.isTTY)return!1;let e=await C();try{for(;;){let t=(await e.question(`Install agent skill? (y/N): `)).trim().toLowerCase();if(!t||t===`n`||t===`no`)return!1;if(t===`y`||t===`yes`)return!0;console.log(`Please answer "y" or "n".`)}}finally{e.close()}}async function D(e){let r=n.join(e,`postcss.config.mjs`);if(await f(r)){console.log(`Preserved existing postcss.config.mjs.`);return}await t.writeFile(r,`export { default } from '@uselets/ui/postcss.config'
3
+ `),console.log(`Created postcss.config.mjs.`)}function O(e){let t=n.posix.dirname(e.replaceAll(n.sep,n.posix.sep)),r=n.posix.relative(t,`node_modules/@uselets/ui/dist`);return r.startsWith(`.`)?r:`./${r}`}function k(e,t,n){let r=[],i=/@import\s+['"]tailwindcss['"]/.test(e),a=/@import\s+['"]@uselets\/ui\/themes\/(?:max|gomax)\.css['"]/.test(e),o=/@source\s+['"][^'"]*@uselets\/ui\/dist['"]/.test(e);return i||r.push(`@import 'tailwindcss';`),a||r.push(`@import '@uselets/ui/themes/${t}.css';`),o||r.push(`@source '${O(n)}';`),{imports:r,hasTheme:a}}async function A(e,r,i){let a=n.resolve(e,r),o=await f(a)?await t.readFile(a,`utf8`):``,{imports:s,hasTheme:c}=k(o,i,r);if(c&&console.log(`Preserved existing @uselets/ui theme import.`),s.length===0){console.log(`Global CSS already configured at ${r}.`);return}let l=o.length>0&&!o.startsWith(`
4
4
  `)?`
5
- `:``,d=`${s.join(`
6
- `)}${l}${o}`;await t.mkdir(n.dirname(a),{recursive:!0}),await t.writeFile(a,d),console.log(`Updated global CSS at ${r}.`)}async function k(e){let t=process.cwd(),r=n.join(t,`package.json`);if(!await u(r))throw Error(`No package.json found in the current directory. Run uselets init from your project root.`);let i=await d(r),a=e.theme??await S(`max`),o=e.css??await C(`src/styles/globals.css`),s=e.installSkill??await w();await y(t,i),await T(t),await O(t,o,a),s&&await b(l)}async function A(){let e=new a;if(e.name(`uselets`).description(`CLI for @uselets/ui`).showHelpAfterError(),e.command(`skill`).description(`Reinstall the ${s} agent skill`).addOption(new o(`--agent <agent>`,`Target agent directory`).choices([`codex`,`claude`,`all`]).default(`all`)).action(async e=>{await b(p(e.agent))}),e.command(`init`).description(`Set up @uselets/ui in this project`).addOption(new o(`--theme <theme>`,`Theme to import`).choices([`max`,`gomax`])).option(`--css <path>`,`Global CSS file path`).option(`--install-skill`,`Install the agent skill without prompting`).option(`--no-install-skill`,`Skip the agent skill prompt and installation`).action(async e=>{await k(e)}),process.argv.length<=2){e.outputHelp();return}await e.parseAsync()}A().catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});export{};
5
+ `:``,u=`${s.join(`
6
+ `)}${l}${o}`;await t.mkdir(n.dirname(a),{recursive:!0}),await t.writeFile(a,u),console.log(`Updated global CSS at ${r}.`)}async function j(e){for(let t of l)if(await f(n.join(e,t)))return t}async function M(){if(!process.stdin.isTTY)return;let e=await C();try{return(await e.question(`App entry file to import the font in (leave empty to skip): `)).trim()||void 0}finally{e.close()}}async function N(e,t){return t||await j(e)||M()}function P(e){console.log(`${e} Add \`import '${c}'\` to your app's entry file (for example app/layout.tsx or src/main.tsx) to load the font.`)}async function F(e,r){if(!r){P(`Could not detect an app entry file.`);return}let i=n.resolve(e,r);if(!await f(i)){P(`Entry file ${r} not found.`);return}let a=await t.readFile(i,`utf8`);if(RegExp(`import\\s+['"]${c}['"]`).test(a)){console.log(`Font import already present in ${r}.`);return}let o=a.match(/^(['"])use (?:client|server)\1;?\r?\n/),s=`import '${c}'\n`,l=o?a.slice(0,o[0].length)+s+a.slice(o[0].length):s+a;await t.writeFile(i,l),console.log(`Added font import to ${r}.`)}async function I(e){let t=process.cwd(),r=n.join(t,`package.json`);if(!await f(r))throw Error(`No package.json found in the current directory. Run uselets init from your project root.`);let i=await p(r),a=e.theme??await w(`max`),o=e.css??await T(`src/styles/globals.css`),s=await N(t,e.entry),c=e.installSkill??await E();await x(t,i),await D(t),await A(t,o,a),await F(t,s),c&&await S(d)}async function L(){let e=new a;if(e.name(`uselets`).description(`CLI for @uselets/ui`).showHelpAfterError(),e.command(`skill`).description(`Reinstall the ${s} agent skill`).addOption(new o(`--agent <agent>`,`Target agent directory`).choices([`codex`,`claude`,`all`]).default(`all`)).action(async e=>{await S(h(e.agent))}),e.command(`init`).description(`Set up @uselets/ui in this project`).addOption(new o(`--theme <theme>`,`Theme to import`).choices([`max`,`gomax`])).option(`--css <path>`,`Global CSS file path`).option(`--entry <path>`,`App entry file to import the font in (for example app/layout.tsx or src/main.tsx)`).option(`--install-skill`,`Install the agent skill without prompting`).option(`--no-install-skill`,`Skip the agent skill prompt and installation`).action(async e=>{await I(e)}),process.argv.length<=2){e.outputHelp();return}await e.parseAsync()}L().catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});export{};
7
7
  //# sourceMappingURL=uselets.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"uselets.mjs","names":[],"sources":["../../src/cli/uselets.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { spawn } from 'node:child_process'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport readline from 'node:readline/promises'\nimport { fileURLToPath } from 'node:url'\n\nimport { Command, Option } from 'commander'\n\nconst SKILL_NAME = 'uselets-ui'\nconst DEFAULT_CSS_PATH = 'src/styles/globals.css'\nconst POSTCSS_CONFIG = \"export { default } from '@uselets/ui/postcss.config'\\n\"\nconst AGENT_TARGETS = {\n codex: path.join('.agents', 'skills', SKILL_NAME),\n claude: path.join('.claude', 'skills', SKILL_NAME)\n} as const\n\ntype AgentTarget = keyof typeof AGENT_TARGETS\ntype AgentOption = AgentTarget | 'all'\ntype ThemeOption = 'max' | 'gomax'\ntype PackageManager = 'bun' | 'pnpm' | 'yarn' | 'npm'\ntype PackageJson = {\n name?: string\n version?: string\n packageManager?: string\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n peerDependencies?: Record<string, string>\n optionalDependencies?: Record<string, string>\n}\ntype InitOptions = {\n theme?: ThemeOption\n css?: string\n installSkill?: boolean\n}\n\nconst ALL_AGENT_TARGETS = Object.keys(AGENT_TARGETS) as AgentTarget[]\n\nasync function pathExists(targetPath: string) {\n try {\n await fs.access(targetPath)\n return true\n } catch {\n return false\n }\n}\n\nasync function readJsonFile<T>(filePath: string) {\n return JSON.parse(await fs.readFile(filePath, 'utf8')) as T\n}\n\nasync function findPackageRoot() {\n let currentDir = fileURLToPath(new URL('.', import.meta.url))\n\n while (true) {\n try {\n await fs.access(path.join(currentDir, 'package.json'))\n return currentDir\n } catch {\n const parentDir = path.dirname(currentDir)\n\n if (parentDir === currentDir) {\n throw new Error('Unable to resolve @uselets/ui package root')\n }\n\n currentDir = parentDir\n }\n }\n}\n\nfunction resolveTargets(agent: AgentOption) {\n return agent === 'all' ? ALL_AGENT_TARGETS : [agent]\n}\n\nfunction hasDependency(packageJson: PackageJson, dependencyName: string) {\n return Boolean(\n packageJson.dependencies?.[dependencyName] ||\n packageJson.devDependencies?.[dependencyName] ||\n packageJson.peerDependencies?.[dependencyName] ||\n packageJson.optionalDependencies?.[dependencyName]\n )\n}\n\nasync function detectPackageManager(projectRoot: string, packageJson: PackageJson): Promise<PackageManager> {\n const declaredManager = packageJson.packageManager?.split('@')[0]\n\n if (\n declaredManager === 'bun' ||\n declaredManager === 'pnpm' ||\n declaredManager === 'yarn' ||\n declaredManager === 'npm'\n ) {\n return declaredManager\n }\n\n if (await pathExists(path.join(projectRoot, 'bun.lock'))) {\n return 'bun'\n }\n\n if (await pathExists(path.join(projectRoot, 'pnpm-lock.yaml'))) {\n return 'pnpm'\n }\n\n if (await pathExists(path.join(projectRoot, 'yarn.lock'))) {\n return 'yarn'\n }\n\n if (await pathExists(path.join(projectRoot, 'package-lock.json'))) {\n return 'npm'\n }\n\n return 'npm'\n}\n\nfunction buildAddCommand(packageManager: PackageManager, dependencies: string[], dev: boolean) {\n switch (packageManager) {\n case 'bun':\n return ['bun', 'add', ...(dev ? ['-d'] : []), ...dependencies]\n case 'pnpm':\n return ['pnpm', 'add', ...(dev ? ['-D'] : []), ...dependencies]\n case 'yarn':\n return ['yarn', 'add', ...(dev ? ['-D'] : []), ...dependencies]\n case 'npm':\n return ['npm', 'install', ...(dev ? ['-D'] : []), ...dependencies]\n }\n}\n\nasync function runCommand(commandParts: string[], cwd: string) {\n const [command, ...args] = commandParts\n\n if (!command) {\n throw new Error('Missing command')\n }\n\n console.log(`Running: ${commandParts.join(' ')}`)\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(command, args, { cwd, stdio: 'inherit' })\n\n child.on('error', reject)\n child.on('close', (code) => {\n if (code === 0) {\n resolve()\n return\n }\n\n reject(new Error(`${command} exited with code ${code}`))\n })\n })\n}\n\nfunction getPackageVersion(packageJson: PackageJson, dependencyName: string) {\n const version = packageJson.dependencies?.[dependencyName] ?? packageJson.devDependencies?.[dependencyName]\n\n if (!version) {\n throw new Error(`Unable to find ${dependencyName} version in @uselets/ui package metadata`)\n }\n\n return version\n}\n\nasync function installMissingDependencies(projectRoot: string, projectPackageJson: PackageJson) {\n const packageRoot = await findPackageRoot()\n const packageJson = await readJsonFile<PackageJson>(path.join(packageRoot, 'package.json'))\n const packageManager = await detectPackageManager(projectRoot, projectPackageJson)\n const runtimeDependencies = []\n const devDependencies = []\n\n if (!packageJson.name || !packageJson.version) {\n throw new Error('Unable to resolve @uselets/ui package name and version')\n }\n\n if (!hasDependency(projectPackageJson, packageJson.name)) {\n runtimeDependencies.push(`${packageJson.name}@${packageJson.version}`)\n }\n\n if (!hasDependency(projectPackageJson, '@fontsource-variable/inter')) {\n runtimeDependencies.push(\n `@fontsource-variable/inter@${getPackageVersion(packageJson, '@fontsource-variable/inter')}`\n )\n }\n\n if (!hasDependency(projectPackageJson, 'tailwindcss')) {\n devDependencies.push(`tailwindcss@${getPackageVersion(packageJson, 'tailwindcss')}`)\n }\n\n if (!hasDependency(projectPackageJson, '@tailwindcss/postcss')) {\n devDependencies.push(`@tailwindcss/postcss@${getPackageVersion(packageJson, '@tailwindcss/postcss')}`)\n }\n\n if (runtimeDependencies.length > 0) {\n await runCommand(buildAddCommand(packageManager, runtimeDependencies, false), projectRoot)\n } else {\n console.log('Runtime dependencies already declared.')\n }\n\n if (devDependencies.length > 0) {\n await runCommand(buildAddCommand(packageManager, devDependencies, true), projectRoot)\n } else {\n console.log('Tailwind dependencies already declared.')\n }\n}\n\nasync function installSkill(targets: AgentTarget[]) {\n const packageRoot = await findPackageRoot()\n const sourcePath = path.join(packageRoot, 'skills', SKILL_NAME)\n\n try {\n await fs.access(sourcePath)\n } catch {\n throw new Error(`Bundled skill not found at ${sourcePath}`)\n }\n\n const installedPaths = []\n\n for (const target of targets) {\n const targetPath = path.join(process.cwd(), AGENT_TARGETS[target])\n\n await fs.rm(targetPath, { recursive: true, force: true })\n await fs.mkdir(path.dirname(targetPath), { recursive: true })\n await fs.cp(sourcePath, targetPath, { recursive: true })\n\n installedPaths.push(targetPath)\n }\n\n console.log(`Installed ${SKILL_NAME} skill:`)\n\n for (const installedPath of installedPaths) {\n console.log(`- ${installedPath}`)\n }\n}\n\nasync function createPrompt() {\n return readline.createInterface({ input: process.stdin, output: process.stdout })\n}\n\nasync function promptTheme(defaultTheme: ThemeOption) {\n if (!process.stdin.isTTY) {\n return defaultTheme\n }\n\n const prompt = await createPrompt()\n\n try {\n while (true) {\n const answer = (await prompt.question(`Theme (max/gomax) [${defaultTheme}]: `)).trim().toLowerCase()\n\n if (!answer) {\n return defaultTheme\n }\n\n if (answer === 'max' || answer === 'gomax') {\n return answer\n }\n\n console.log('Please choose \"max\" or \"gomax\".')\n }\n } finally {\n prompt.close()\n }\n}\n\nasync function promptCssPath(defaultCssPath: string) {\n if (!process.stdin.isTTY) {\n return defaultCssPath\n }\n\n const prompt = await createPrompt()\n\n try {\n const answer = (await prompt.question(`Global CSS path [${defaultCssPath}]: `)).trim()\n return answer || defaultCssPath\n } finally {\n prompt.close()\n }\n}\n\nasync function promptInstallSkill() {\n if (!process.stdin.isTTY) {\n return false\n }\n\n const prompt = await createPrompt()\n\n try {\n while (true) {\n const answer = (await prompt.question('Install agent skill? (y/N): ')).trim().toLowerCase()\n\n if (!answer || answer === 'n' || answer === 'no') {\n return false\n }\n\n if (answer === 'y' || answer === 'yes') {\n return true\n }\n\n console.log('Please answer \"y\" or \"n\".')\n }\n } finally {\n prompt.close()\n }\n}\n\nasync function ensurePostcssConfig(projectRoot: string) {\n const postcssPath = path.join(projectRoot, 'postcss.config.mjs')\n\n if (await pathExists(postcssPath)) {\n console.log('Preserved existing postcss.config.mjs.')\n return\n }\n\n await fs.writeFile(postcssPath, POSTCSS_CONFIG)\n console.log('Created postcss.config.mjs.')\n}\n\nfunction buildPackageSource(cssPath: string) {\n const cssDir = path.posix.dirname(cssPath.replaceAll(path.sep, path.posix.sep))\n const relativeSource = path.posix.relative(cssDir, 'node_modules/@uselets/ui/dist')\n\n return relativeSource.startsWith('.') ? relativeSource : `./${relativeSource}`\n}\n\nfunction buildCssImports(source: string, theme: ThemeOption, cssPath: string) {\n const imports = []\n const hasTailwind = /@import\\s+['\"]tailwindcss['\"]/.test(source)\n const hasTheme = /@import\\s+['\"]@uselets\\/ui\\/themes\\/(?:max|gomax)\\.css['\"]/.test(source)\n const hasFont = /@import\\s+['\"]@fontsource-variable\\/inter['\"]/.test(source)\n const hasPackageSource = /@source\\s+['\"][^'\"]*@uselets\\/ui\\/dist['\"]/.test(source)\n\n if (!hasTailwind) {\n imports.push(\"@import 'tailwindcss';\")\n }\n\n if (!hasTheme) {\n imports.push(`@import '@uselets/ui/themes/${theme}.css';`)\n }\n\n if (!hasFont) {\n imports.push(\"@import '@fontsource-variable/inter';\")\n }\n\n if (!hasPackageSource) {\n imports.push(`@source '${buildPackageSource(cssPath)}';`)\n }\n\n return { imports, hasTheme }\n}\n\nasync function ensureGlobalCss(projectRoot: string, cssPath: string, theme: ThemeOption) {\n const absoluteCssPath = path.resolve(projectRoot, cssPath)\n const existingSource = (await pathExists(absoluteCssPath)) ? await fs.readFile(absoluteCssPath, 'utf8') : ''\n const { imports, hasTheme } = buildCssImports(existingSource, theme, cssPath)\n\n if (hasTheme) {\n console.log('Preserved existing @uselets/ui theme import.')\n }\n\n if (imports.length === 0) {\n console.log(`Global CSS already configured at ${cssPath}.`)\n return\n }\n\n const separator = existingSource.length > 0 && !existingSource.startsWith('\\n') ? '\\n' : ''\n const updatedSource = `${imports.join('\\n')}${separator}${existingSource}`\n\n await fs.mkdir(path.dirname(absoluteCssPath), { recursive: true })\n await fs.writeFile(absoluteCssPath, updatedSource)\n console.log(`Updated global CSS at ${cssPath}.`)\n}\n\nasync function initProject(options: InitOptions) {\n const projectRoot = process.cwd()\n const packageJsonPath = path.join(projectRoot, 'package.json')\n\n if (!(await pathExists(packageJsonPath))) {\n throw new Error('No package.json found in the current directory. Run uselets init from your project root.')\n }\n\n const projectPackageJson = await readJsonFile<PackageJson>(packageJsonPath)\n const theme = options.theme ?? (await promptTheme('max'))\n const cssPath = options.css ?? (await promptCssPath(DEFAULT_CSS_PATH))\n const shouldInstallSkill = options.installSkill ?? (await promptInstallSkill())\n\n await installMissingDependencies(projectRoot, projectPackageJson)\n await ensurePostcssConfig(projectRoot)\n await ensureGlobalCss(projectRoot, cssPath, theme)\n\n if (shouldInstallSkill) {\n await installSkill(ALL_AGENT_TARGETS)\n }\n}\n\nasync function main() {\n const program = new Command()\n\n program.name('uselets').description('CLI for @uselets/ui').showHelpAfterError()\n\n program\n .command('skill')\n .description(`Reinstall the ${SKILL_NAME} agent skill`)\n .addOption(\n new Option('--agent <agent>', 'Target agent directory').choices(['codex', 'claude', 'all']).default('all')\n )\n .action(async (options: { agent: AgentOption }) => {\n await installSkill(resolveTargets(options.agent))\n })\n\n program\n .command('init')\n .description('Set up @uselets/ui in this project')\n .addOption(new Option('--theme <theme>', 'Theme to import').choices(['max', 'gomax']))\n .option('--css <path>', 'Global CSS file path')\n .option('--install-skill', 'Install the agent skill without prompting')\n .option('--no-install-skill', 'Skip the agent skill prompt and installation')\n .action(async (options: InitOptions) => {\n await initProject(options)\n })\n\n if (process.argv.length <= 2) {\n program.outputHelp()\n return\n }\n\n await program.parseAsync()\n}\n\nmain().catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error)\n process.exitCode = 1\n})\n"],"mappings":";mOAUA,MAAM,EAAa,aAGb,EAAgB,CACpB,MAAO,EAAK,KAAK,UAAW,SAAU,CAAU,EAChD,OAAQ,EAAK,KAAK,UAAW,SAAU,CAAU,CACnD,EAqBM,EAAoB,OAAO,KAAK,CAAa,EAEnD,eAAe,EAAW,EAAoB,CAC5C,GAAI,CAEF,OADA,MAAM,EAAG,OAAO,CAAU,EACnB,EACT,MAAQ,CACN,MAAO,EACT,CACF,CAEA,eAAe,EAAgB,EAAkB,CAC/C,OAAO,KAAK,MAAM,MAAM,EAAG,SAAS,EAAU,MAAM,CAAC,CACvD,CAEA,eAAe,GAAkB,CAC/B,IAAI,EAAa,EAAc,IAAI,IAAI,IAAK,OAAO,KAAK,GAA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'node:fs/promises'\nimport path from 'node:path'\nimport readline from 'node:readline/promises'\nimport { fileURLToPath } from 'node:url'\n\nimport { Command, Option } from 'commander'\n\nconst SKILL_NAME = 'uselets-ui'\nconst DEFAULT_CSS_PATH = 'src/styles/globals.css'\nconst FONT_PACKAGE = '@fontsource-variable/inter'\nconst ENTRY_FILE_CANDIDATES = [\n 'app/layout.tsx',\n 'app/layout.jsx',\n 'pages/_app.tsx',\n 'pages/_app.jsx',\n 'src/main.tsx',\n 'src/main.jsx',\n 'src/index.tsx',\n 'src/index.jsx'\n]\nconst POSTCSS_CONFIG = \"export { default } from '@uselets/ui/postcss.config'\\n\"\nconst AGENT_TARGETS = {\n codex: path.join('.agents', 'skills', SKILL_NAME),\n claude: path.join('.claude', 'skills', SKILL_NAME)\n} as const\n\ntype AgentTarget = keyof typeof AGENT_TARGETS\ntype AgentOption = AgentTarget | 'all'\ntype ThemeOption = 'max' | 'gomax'\ntype PackageManager = 'bun' | 'pnpm' | 'yarn' | 'npm'\ntype PackageJson = {\n name?: string\n version?: string\n packageManager?: string\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n peerDependencies?: Record<string, string>\n optionalDependencies?: Record<string, string>\n}\ntype InitOptions = {\n theme?: ThemeOption\n css?: string\n entry?: string\n installSkill?: boolean\n}\n\nconst ALL_AGENT_TARGETS = Object.keys(AGENT_TARGETS) as AgentTarget[]\n\nasync function pathExists(targetPath: string) {\n try {\n await fs.access(targetPath)\n return true\n } catch {\n return false\n }\n}\n\nasync function readJsonFile<T>(filePath: string) {\n return JSON.parse(await fs.readFile(filePath, 'utf8')) as T\n}\n\nasync function findPackageRoot() {\n let currentDir = fileURLToPath(new URL('.', import.meta.url))\n\n while (true) {\n try {\n await fs.access(path.join(currentDir, 'package.json'))\n return currentDir\n } catch {\n const parentDir = path.dirname(currentDir)\n\n if (parentDir === currentDir) {\n throw new Error('Unable to resolve @uselets/ui package root')\n }\n\n currentDir = parentDir\n }\n }\n}\n\nfunction resolveTargets(agent: AgentOption) {\n return agent === 'all' ? ALL_AGENT_TARGETS : [agent]\n}\n\nfunction hasDependency(packageJson: PackageJson, dependencyName: string) {\n return Boolean(\n packageJson.dependencies?.[dependencyName] ||\n packageJson.devDependencies?.[dependencyName] ||\n packageJson.peerDependencies?.[dependencyName] ||\n packageJson.optionalDependencies?.[dependencyName]\n )\n}\n\nasync function detectPackageManager(projectRoot: string, packageJson: PackageJson): Promise<PackageManager> {\n const declaredManager = packageJson.packageManager?.split('@')[0]\n\n if (\n declaredManager === 'bun' ||\n declaredManager === 'pnpm' ||\n declaredManager === 'yarn' ||\n declaredManager === 'npm'\n ) {\n return declaredManager\n }\n\n if (await pathExists(path.join(projectRoot, 'bun.lock'))) {\n return 'bun'\n }\n\n if (await pathExists(path.join(projectRoot, 'pnpm-lock.yaml'))) {\n return 'pnpm'\n }\n\n if (await pathExists(path.join(projectRoot, 'yarn.lock'))) {\n return 'yarn'\n }\n\n if (await pathExists(path.join(projectRoot, 'package-lock.json'))) {\n return 'npm'\n }\n\n return 'npm'\n}\n\nfunction buildAddCommand(packageManager: PackageManager, dependencies: string[], dev: boolean) {\n switch (packageManager) {\n case 'bun':\n return ['bun', 'add', ...(dev ? ['-d'] : []), ...dependencies]\n case 'pnpm':\n return ['pnpm', 'add', ...(dev ? ['-D'] : []), ...dependencies]\n case 'yarn':\n return ['yarn', 'add', ...(dev ? ['-D'] : []), ...dependencies]\n case 'npm':\n return ['npm', 'install', ...(dev ? ['-D'] : []), ...dependencies]\n }\n}\n\nasync function runCommand(commandParts: string[], cwd: string) {\n const [command, ...args] = commandParts\n\n if (!command) {\n throw new Error('Missing command')\n }\n\n console.log(`Running: ${commandParts.join(' ')}`)\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(command, args, { cwd, stdio: 'inherit' })\n\n child.on('error', reject)\n child.on('close', (code) => {\n if (code === 0) {\n resolve()\n return\n }\n\n reject(new Error(`${command} exited with code ${code}`))\n })\n })\n}\n\nfunction getPackageVersion(packageJson: PackageJson, dependencyName: string) {\n const version = packageJson.dependencies?.[dependencyName] ?? packageJson.devDependencies?.[dependencyName]\n\n if (!version) {\n throw new Error(`Unable to find ${dependencyName} version in @uselets/ui package metadata`)\n }\n\n return version\n}\n\nasync function installMissingDependencies(projectRoot: string, projectPackageJson: PackageJson) {\n const packageRoot = await findPackageRoot()\n const packageJson = await readJsonFile<PackageJson>(path.join(packageRoot, 'package.json'))\n const packageManager = await detectPackageManager(projectRoot, projectPackageJson)\n const runtimeDependencies = []\n const devDependencies = []\n\n if (!packageJson.name || !packageJson.version) {\n throw new Error('Unable to resolve @uselets/ui package name and version')\n }\n\n if (!hasDependency(projectPackageJson, packageJson.name)) {\n runtimeDependencies.push(`${packageJson.name}@${packageJson.version}`)\n }\n\n if (!hasDependency(projectPackageJson, FONT_PACKAGE)) {\n runtimeDependencies.push(`${FONT_PACKAGE}@${getPackageVersion(packageJson, FONT_PACKAGE)}`)\n }\n\n if (!hasDependency(projectPackageJson, 'tailwindcss')) {\n devDependencies.push(`tailwindcss@${getPackageVersion(packageJson, 'tailwindcss')}`)\n }\n\n if (!hasDependency(projectPackageJson, '@tailwindcss/postcss')) {\n devDependencies.push(`@tailwindcss/postcss@${getPackageVersion(packageJson, '@tailwindcss/postcss')}`)\n }\n\n if (runtimeDependencies.length > 0) {\n await runCommand(buildAddCommand(packageManager, runtimeDependencies, false), projectRoot)\n } else {\n console.log('Runtime dependencies already declared.')\n }\n\n if (devDependencies.length > 0) {\n await runCommand(buildAddCommand(packageManager, devDependencies, true), projectRoot)\n } else {\n console.log('Tailwind dependencies already declared.')\n }\n}\n\nasync function installSkill(targets: AgentTarget[]) {\n const packageRoot = await findPackageRoot()\n const sourcePath = path.join(packageRoot, 'skills', SKILL_NAME)\n\n try {\n await fs.access(sourcePath)\n } catch {\n throw new Error(`Bundled skill not found at ${sourcePath}`)\n }\n\n const installedPaths = []\n\n for (const target of targets) {\n const targetPath = path.join(process.cwd(), AGENT_TARGETS[target])\n\n await fs.rm(targetPath, { recursive: true, force: true })\n await fs.mkdir(path.dirname(targetPath), { recursive: true })\n await fs.cp(sourcePath, targetPath, { recursive: true })\n\n installedPaths.push(targetPath)\n }\n\n console.log(`Installed ${SKILL_NAME} skill:`)\n\n for (const installedPath of installedPaths) {\n console.log(`- ${installedPath}`)\n }\n}\n\nasync function createPrompt() {\n return readline.createInterface({ input: process.stdin, output: process.stdout })\n}\n\nasync function promptTheme(defaultTheme: ThemeOption) {\n if (!process.stdin.isTTY) {\n return defaultTheme\n }\n\n const prompt = await createPrompt()\n\n try {\n while (true) {\n const answer = (await prompt.question(`Theme (max/gomax) [${defaultTheme}]: `)).trim().toLowerCase()\n\n if (!answer) {\n return defaultTheme\n }\n\n if (answer === 'max' || answer === 'gomax') {\n return answer\n }\n\n console.log('Please choose \"max\" or \"gomax\".')\n }\n } finally {\n prompt.close()\n }\n}\n\nasync function promptCssPath(defaultCssPath: string) {\n if (!process.stdin.isTTY) {\n return defaultCssPath\n }\n\n const prompt = await createPrompt()\n\n try {\n const answer = (await prompt.question(`Global CSS path [${defaultCssPath}]: `)).trim()\n return answer || defaultCssPath\n } finally {\n prompt.close()\n }\n}\n\nasync function promptInstallSkill() {\n if (!process.stdin.isTTY) {\n return false\n }\n\n const prompt = await createPrompt()\n\n try {\n while (true) {\n const answer = (await prompt.question('Install agent skill? (y/N): ')).trim().toLowerCase()\n\n if (!answer || answer === 'n' || answer === 'no') {\n return false\n }\n\n if (answer === 'y' || answer === 'yes') {\n return true\n }\n\n console.log('Please answer \"y\" or \"n\".')\n }\n } finally {\n prompt.close()\n }\n}\n\nasync function ensurePostcssConfig(projectRoot: string) {\n const postcssPath = path.join(projectRoot, 'postcss.config.mjs')\n\n if (await pathExists(postcssPath)) {\n console.log('Preserved existing postcss.config.mjs.')\n return\n }\n\n await fs.writeFile(postcssPath, POSTCSS_CONFIG)\n console.log('Created postcss.config.mjs.')\n}\n\nfunction buildPackageSource(cssPath: string) {\n const cssDir = path.posix.dirname(cssPath.replaceAll(path.sep, path.posix.sep))\n const relativeSource = path.posix.relative(cssDir, 'node_modules/@uselets/ui/dist')\n\n return relativeSource.startsWith('.') ? relativeSource : `./${relativeSource}`\n}\n\nfunction buildCssImports(source: string, theme: ThemeOption, cssPath: string) {\n const imports = []\n const hasTailwind = /@import\\s+['\"]tailwindcss['\"]/.test(source)\n const hasTheme = /@import\\s+['\"]@uselets\\/ui\\/themes\\/(?:max|gomax)\\.css['\"]/.test(source)\n const hasPackageSource = /@source\\s+['\"][^'\"]*@uselets\\/ui\\/dist['\"]/.test(source)\n\n if (!hasTailwind) {\n imports.push(\"@import 'tailwindcss';\")\n }\n\n if (!hasTheme) {\n imports.push(`@import '@uselets/ui/themes/${theme}.css';`)\n }\n\n if (!hasPackageSource) {\n imports.push(`@source '${buildPackageSource(cssPath)}';`)\n }\n\n return { imports, hasTheme }\n}\n\nasync function ensureGlobalCss(projectRoot: string, cssPath: string, theme: ThemeOption) {\n const absoluteCssPath = path.resolve(projectRoot, cssPath)\n const existingSource = (await pathExists(absoluteCssPath)) ? await fs.readFile(absoluteCssPath, 'utf8') : ''\n const { imports, hasTheme } = buildCssImports(existingSource, theme, cssPath)\n\n if (hasTheme) {\n console.log('Preserved existing @uselets/ui theme import.')\n }\n\n if (imports.length === 0) {\n console.log(`Global CSS already configured at ${cssPath}.`)\n return\n }\n\n const separator = existingSource.length > 0 && !existingSource.startsWith('\\n') ? '\\n' : ''\n const updatedSource = `${imports.join('\\n')}${separator}${existingSource}`\n\n await fs.mkdir(path.dirname(absoluteCssPath), { recursive: true })\n await fs.writeFile(absoluteCssPath, updatedSource)\n console.log(`Updated global CSS at ${cssPath}.`)\n}\n\nasync function detectEntryFile(projectRoot: string) {\n for (const candidate of ENTRY_FILE_CANDIDATES) {\n if (await pathExists(path.join(projectRoot, candidate))) {\n return candidate\n }\n }\n\n return undefined\n}\n\nasync function promptEntryPath() {\n if (!process.stdin.isTTY) {\n return undefined\n }\n\n const prompt = await createPrompt()\n\n try {\n const answer = (await prompt.question('App entry file to import the font in (leave empty to skip): ')).trim()\n return answer || undefined\n } finally {\n prompt.close()\n }\n}\n\nasync function resolveEntryPath(projectRoot: string, entryOption?: string) {\n if (entryOption) {\n return entryOption\n }\n\n const detected = await detectEntryFile(projectRoot)\n\n if (detected) {\n return detected\n }\n\n return promptEntryPath()\n}\n\nfunction logManualFontImportInstructions(reason: string) {\n console.log(\n `${reason} Add \\`import '${FONT_PACKAGE}'\\` to your app's entry file (for example app/layout.tsx or src/main.tsx) to load the font.`\n )\n}\n\nasync function ensureFontImport(projectRoot: string, entryPath?: string) {\n if (!entryPath) {\n logManualFontImportInstructions('Could not detect an app entry file.')\n return\n }\n\n const absoluteEntryPath = path.resolve(projectRoot, entryPath)\n\n if (!(await pathExists(absoluteEntryPath))) {\n logManualFontImportInstructions(`Entry file ${entryPath} not found.`)\n return\n }\n\n const source = await fs.readFile(absoluteEntryPath, 'utf8')\n const importPattern = new RegExp(`import\\\\s+['\"]${FONT_PACKAGE}['\"]`)\n\n if (importPattern.test(source)) {\n console.log(`Font import already present in ${entryPath}.`)\n return\n }\n\n const directiveMatch = source.match(/^(['\"])use (?:client|server)\\1;?\\r?\\n/)\n const insertion = `import '${FONT_PACKAGE}'\\n`\n const updatedSource = directiveMatch\n ? source.slice(0, directiveMatch[0].length) + insertion + source.slice(directiveMatch[0].length)\n : insertion + source\n\n await fs.writeFile(absoluteEntryPath, updatedSource)\n console.log(`Added font import to ${entryPath}.`)\n}\n\nasync function initProject(options: InitOptions) {\n const projectRoot = process.cwd()\n const packageJsonPath = path.join(projectRoot, 'package.json')\n\n if (!(await pathExists(packageJsonPath))) {\n throw new Error('No package.json found in the current directory. Run uselets init from your project root.')\n }\n\n const projectPackageJson = await readJsonFile<PackageJson>(packageJsonPath)\n const theme = options.theme ?? (await promptTheme('max'))\n const cssPath = options.css ?? (await promptCssPath(DEFAULT_CSS_PATH))\n const entryPath = await resolveEntryPath(projectRoot, options.entry)\n const shouldInstallSkill = options.installSkill ?? (await promptInstallSkill())\n\n await installMissingDependencies(projectRoot, projectPackageJson)\n await ensurePostcssConfig(projectRoot)\n await ensureGlobalCss(projectRoot, cssPath, theme)\n await ensureFontImport(projectRoot, entryPath)\n\n if (shouldInstallSkill) {\n await installSkill(ALL_AGENT_TARGETS)\n }\n}\n\nasync function main() {\n const program = new Command()\n\n program.name('uselets').description('CLI for @uselets/ui').showHelpAfterError()\n\n program\n .command('skill')\n .description(`Reinstall the ${SKILL_NAME} agent skill`)\n .addOption(\n new Option('--agent <agent>', 'Target agent directory').choices(['codex', 'claude', 'all']).default('all')\n )\n .action(async (options: { agent: AgentOption }) => {\n await installSkill(resolveTargets(options.agent))\n })\n\n program\n .command('init')\n .description('Set up @uselets/ui in this project')\n .addOption(new Option('--theme <theme>', 'Theme to import').choices(['max', 'gomax']))\n .option('--css <path>', 'Global CSS file path')\n .option('--entry <path>', 'App entry file to import the font in (for example app/layout.tsx or src/main.tsx)')\n .option('--install-skill', 'Install the agent skill without prompting')\n .option('--no-install-skill', 'Skip the agent skill prompt and installation')\n .action(async (options: InitOptions) => {\n await initProject(options)\n })\n\n if (process.argv.length <= 2) {\n program.outputHelp()\n return\n }\n\n await program.parseAsync()\n}\n\nmain().catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error)\n process.exitCode = 1\n})\n"],"mappings":";mOAUA,MAAM,EAAa,aAEb,EAAe,6BACf,EAAwB,CAC5B,iBACA,iBACA,iBACA,iBACA,eACA,eACA,gBACA,eACF,EAEM,EAAgB,CACpB,MAAO,EAAK,KAAK,UAAW,SAAU,CAAU,EAChD,OAAQ,EAAK,KAAK,UAAW,SAAU,CAAU,CACnD,EAsBM,EAAoB,OAAO,KAAK,CAAa,EAEnD,eAAe,EAAW,EAAoB,CAC5C,GAAI,CAEF,OADA,MAAM,EAAG,OAAO,CAAU,EACnB,EACT,MAAQ,CACN,MAAO,EACT,CACF,CAEA,eAAe,EAAgB,EAAkB,CAC/C,OAAO,KAAK,MAAM,MAAM,EAAG,SAAS,EA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
- import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{useFieldControlId as t}from"./field.js";import{Slider as n}from"radix-ui";import{jsx as r,jsxs as i}from"react/jsx-runtime";import*as a from"react";function Slider({className:o,defaultValue:s,id:c,value:l,min:u=0,max:d=100,...f}){let p=t(c),m=a.useMemo(()=>Array.isArray(l)?l:Array.isArray(s)?s:[u,d],[l,s,u,d]);return i(n.Root,{id:p,"data-slot":`slider`,defaultValue:s,value:l,min:u,max:d,className:e(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,o),...f,children:[r(n.Track,{"data-slot":`slider-track`,className:e(`relative grow overflow-hidden rounded-full bg-muted`,`data-horizontal:h-1 data-horizontal:w-full`,`data-vertical:h-full data-vertical:w-1`),children:r(n.Range,{"data-slot":`slider-range`,className:`absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),m.map(t=>r(n.Thumb,{"data-slot":`slider-thumb`,className:e(`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50`,`transition-[color,box-shadow] select-none after:absolute after:-inset-2`,`hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3`,`disabled:pointer-events-none disabled:opacity-50`)},t))]})}export{Slider};
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{useFieldControlId as t}from"./field.js";import{Slider as n}from"radix-ui";import{jsx as r,jsxs as i}from"react/jsx-runtime";import*as a from"react";function Slider({className:o,defaultValue:s,id:c,value:l,min:u=0,max:d=100,...f}){let p=t(c),m=a.useMemo(()=>Array.isArray(l)?l:Array.isArray(s)?s:[u,d],[l,s,u,d]);return i(n.Root,{id:p,"data-slot":`slider`,defaultValue:s,value:l,min:u,max:d,className:e(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,o),...f,children:[r(n.Track,{"data-slot":`slider-track`,className:e(`relative grow overflow-hidden rounded-full bg-muted`,`data-horizontal:h-1 data-horizontal:w-full`,`data-vertical:h-full data-vertical:w-1`),children:r(n.Range,{"data-slot":`slider-range`,className:`absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),m.map((t,i)=>r(n.Thumb,{"data-slot":`slider-thumb`,className:e(`relative block size-3 shrink-0 rounded-full border border-ring bg-white dark:bg-primary ring-ring/50`,`transition-[color,box-shadow] select-none after:absolute after:-inset-2`,`hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3`,`disabled:pointer-events-none disabled:opacity-50`)},String(i)))]})}export{Slider};
2
2
  //# sourceMappingURL=slider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":["SliderPrimitive"],"sources":["../../src/components/slider.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Slider as SliderPrimitive } from 'radix-ui'\n\nimport { cn } from '../lib/utils'\nimport { useFieldControlId } from './field'\n\nexport type SliderProps = React.ComponentProps<typeof SliderPrimitive.Root>\n\nfunction Slider({ className, defaultValue, id, value, min = 0, max = 100, ...props }: SliderProps) {\n const fieldControlId = useFieldControlId(id)\n const _values = React.useMemo(\n () => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]),\n [value, defaultValue, min, max]\n )\n\n return (\n <SliderPrimitive.Root\n id={fieldControlId}\n data-slot=\"slider\"\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n className={cn(\n 'relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col',\n className\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className={cn(\n 'relative grow overflow-hidden rounded-full bg-muted',\n 'data-horizontal:h-1 data-horizontal:w-full',\n 'data-vertical:h-full data-vertical:w-1'\n )}\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full\"\n />\n </SliderPrimitive.Track>\n {_values.map((value) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={value}\n className={cn(\n 'relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50',\n 'transition-[color,box-shadow] select-none after:absolute after:-inset-2',\n 'hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3',\n 'disabled:pointer-events-none disabled:opacity-50'\n )}\n />\n ))}\n </SliderPrimitive.Root>\n )\n}\n\nexport { Slider }\n"],"mappings":"wOASA,SAAS,OAAO,CAAE,YAAW,eAAc,KAAI,QAAO,MAAM,EAAG,MAAM,IAAK,GAAG,GAAsB,CACjG,IAAM,EAAiB,EAAkB,CAAE,EACrC,EAAU,EAAM,YACb,MAAM,QAAQ,CAAK,EAAI,EAAQ,MAAM,QAAQ,CAAY,EAAI,EAAe,CAAC,EAAK,CAAG,EAC5F,CAAC,EAAO,EAAc,EAAK,CAAG,CAChC,EAEA,OACE,EAACA,EAAgB,KAAjB,CACE,GAAI,EACJ,YAAU,SACI,eACP,QACF,MACA,MACL,UAAW,EACT,4KACA,CACF,EACA,GAAI,EAXN,SAAA,CAaE,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EACT,sDACA,6CACA,wCACF,EAEA,SAAA,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAU,6EACX,CAAA,CACoB,CAAA,EACtB,EAAQ,IAAK,GACZ,EAACA,EAAgB,MAAjB,CACE,YAAU,eAEV,UAAW,EACT,uFACA,0EACA,+EACA,kDACF,CACD,EAPM,CAON,CACF,CACmB,GAE1B"}
1
+ {"version":3,"file":"slider.js","names":["SliderPrimitive"],"sources":["../../src/components/slider.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Slider as SliderPrimitive } from 'radix-ui'\n\nimport { cn } from '../lib/utils'\nimport { useFieldControlId } from './field'\n\nexport type SliderProps = React.ComponentProps<typeof SliderPrimitive.Root>\n\nfunction Slider({ className, defaultValue, id, value, min = 0, max = 100, ...props }: SliderProps) {\n const fieldControlId = useFieldControlId(id)\n const values = React.useMemo(\n () => (Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]),\n [value, defaultValue, min, max]\n )\n\n return (\n <SliderPrimitive.Root\n id={fieldControlId}\n data-slot=\"slider\"\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n className={cn(\n 'relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col',\n className\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className={cn(\n 'relative grow overflow-hidden rounded-full bg-muted',\n 'data-horizontal:h-1 data-horizontal:w-full',\n 'data-vertical:h-full data-vertical:w-1'\n )}\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full\"\n />\n </SliderPrimitive.Track>\n {values.map((_, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={String(index)}\n className={cn(\n 'relative block size-3 shrink-0 rounded-full border border-ring bg-white dark:bg-primary ring-ring/50',\n 'transition-[color,box-shadow] select-none after:absolute after:-inset-2',\n 'hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3',\n 'disabled:pointer-events-none disabled:opacity-50'\n )}\n />\n ))}\n </SliderPrimitive.Root>\n )\n}\n\nexport { Slider }\n"],"mappings":"wOASA,SAAS,OAAO,CAAE,YAAW,eAAc,KAAI,QAAO,MAAM,EAAG,MAAM,IAAK,GAAG,GAAsB,CACjG,IAAM,EAAiB,EAAkB,CAAE,EACrC,EAAS,EAAM,YACZ,MAAM,QAAQ,CAAK,EAAI,EAAQ,MAAM,QAAQ,CAAY,EAAI,EAAe,CAAC,EAAK,CAAG,EAC5F,CAAC,EAAO,EAAc,EAAK,CAAG,CAChC,EAEA,OACE,EAACA,EAAgB,KAAjB,CACE,GAAI,EACJ,YAAU,SACI,eACP,QACF,MACA,MACL,UAAW,EACT,4KACA,CACF,EACA,GAAI,EAXN,SAAA,CAaE,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EACT,sDACA,6CACA,wCACF,EAEA,SAAA,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAU,6EACX,CAAA,CACoB,CAAA,EACtB,EAAO,KAAK,EAAG,IACd,EAACA,EAAgB,MAAjB,CACE,YAAU,eAEV,UAAW,EACT,uGACA,0EACA,+EACA,kDACF,CACD,EAPM,OAAO,CAAK,CAOlB,CACF,CACmB,GAE1B"}
@@ -46,10 +46,12 @@ To set up a consumer project after installing `@uselets/ui`, run `bun uselets in
46
46
  - Prefer barrel imports for common app usage and readability.
47
47
  - Use module subpaths when you want a single module or when the user asks for the exact import path.
48
48
  - Use `@uselets/ui/hooks/<hook-module>` for dedicated hook subpaths, not legacy `@uselets/ui/use-*` paths.
49
- - Recommend importing Tailwind, one theme stylesheet, and Inter once in the app global CSS. Use `@uselets/ui/themes/max.css` for Max apps or `@uselets/ui/themes/gomax.css` for Gomax apps.
49
+ - Recommend importing Tailwind and one theme stylesheet once in the app global CSS. Use `@uselets/ui/themes/max.css` for Max apps or `@uselets/ui/themes/gomax.css` for Gomax apps.
50
50
  - Recommend `@source '../node_modules/@uselets/ui/dist';` when Tailwind needs to generate classes used by installed `@uselets/ui` components.
51
51
  - Treat `@uselets/ui/themes/gomax.css` as the GoMax Figma-backed palette, exposed through the same public color families as the Max theme.
52
- - Recommend `@fontsource-variable/inter` when matching the package typography setup.
52
+ - Recommend `@fontsource-variable/inter` when matching the package typography setup. Import it once from the
53
+ app's entry file (`import '@fontsource-variable/inter'` in `app/layout.tsx`, `pages/_app.tsx`, or `src/main.tsx`),
54
+ not via `@import` in CSS — some bundlers, including Next.js, don't resolve third-party CSS `@import`s reliably.
53
55
  - Recommend `@uselets/ui/postcss.config` when the app needs the package PostCSS preset for Tailwind v4.
54
56
  - For tooltip-heavy apps, wrap the app with `TooltipProvider`; use `Tooltip label={...}` for common trigger/content usage and `TooltipRoot` only when manual composition is needed.
55
57
  - Use `UnstyledButton` when button semantics are needed without `Button` variants; it provides reset styles, pointer cursor, focus ring, default `type="button"`, and `asChild`.
@@ -53,12 +53,12 @@ Run the package setup command from the project root to install dependencies, con
53
53
  bun uselets init
54
54
  ```
55
55
 
56
- The command asks for the package theme, defaults the global CSS path to `src/styles/globals.css`, creates that CSS file when missing, preserves an existing `postcss.config.mjs`, and asks whether to install the agent skill.
56
+ The command asks for the package theme, defaults the global CSS path to `src/styles/globals.css`, creates that CSS file when missing, preserves an existing `postcss.config.mjs`, and asks whether to install the agent skill. It also detects a conventional app entry file (`app/layout.tsx`, `pages/_app.tsx`, `src/main.tsx`, `src/index.tsx`, and `.jsx` variants) and inserts `import '@fontsource-variable/inter'` there, or asks for the entry file path when none is found. Use `--entry <path>` to set it explicitly for non-interactive setups.
57
57
 
58
58
  For non-interactive setup, provide explicit options:
59
59
 
60
60
  ```bash
61
- bun uselets init --theme max --css src/styles/globals.css --no-install-skill
61
+ bun uselets init --theme max --css src/styles/globals.css --entry app/layout.tsx --no-install-skill
62
62
  ```
63
63
 
64
64
  ## Agent skill installation
@@ -99,16 +99,22 @@ Use `bun uselets skill --agent codex` or `bun uselets skill --agent claude` to i
99
99
 
100
100
  ## Base setup
101
101
 
102
- Import Tailwind, one package theme, and Inter once in the app global stylesheet:
102
+ Import Tailwind and one package theme once in the app global stylesheet:
103
103
 
104
104
  ```css
105
105
  @import 'tailwindcss';
106
106
  @import '@uselets/ui/themes/max.css';
107
- @import '@fontsource-variable/inter';
108
107
  ```
109
108
 
110
109
  For GoMax apps, import `@uselets/ui/themes/gomax.css` instead.
111
110
 
111
+ Import the Inter font once from the app's entry file, not from CSS (some bundlers, including Next.js, don't resolve third-party CSS `@import`s reliably):
112
+
113
+ ```ts
114
+ // app/layout.tsx (or src/main.tsx, pages/_app.tsx, ...)
115
+ import '@fontsource-variable/inter'
116
+ ```
117
+
112
118
  If the app needs Tailwind v4 PostCSS setup, reuse the package preset:
113
119
 
114
120
  ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uselets/ui",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "React component library for the LET'S design system.",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@base-ui/react": "1.6.0",
62
- "@fontsource-variable/inter": "5.2.8",
62
+ "@fontsource-variable/inter": "5.3.0",
63
63
  "@react-input/mask": "2.0.4",
64
64
  "@tabler/icons-react": "3.45.0",
65
65
  "@tanstack/react-table": "8.21.3",
@@ -71,13 +71,13 @@
71
71
  "embla-carousel-react": "8.6.0",
72
72
  "input-otp": "1.4.2",
73
73
  "next-themes": "0.4.6",
74
- "radix-ui": "1.6.2",
74
+ "radix-ui": "1.6.7",
75
75
  "react-day-picker": "10.0.1",
76
- "react-dropzone": "17.0.0",
76
+ "react-dropzone": "19.1.1",
77
77
  "react-phone-number-input": "3.4.17",
78
78
  "react-resizable-panels": "4.12.2",
79
- "recharts": "3.9.2",
80
- "shadcn": "4.13.1",
79
+ "recharts": "3.10.1",
80
+ "shadcn": "4.16.0",
81
81
  "sonner": "2.0.7",
82
82
  "tailwind-merge": "3.6.0",
83
83
  "tailwind-scrollbar": "4.0.2",
@@ -91,14 +91,14 @@
91
91
  "@bosh-code/tsdown-plugin-tailwindcss": "1.0.1",
92
92
  "@tailwindcss/postcss": "4.3.3",
93
93
  "@testing-library/react": "16.3.2",
94
- "@tsdown/css": "0.22.9",
95
- "@turbo/gen": "2.10.5",
96
- "@types/node": "26.1.1",
94
+ "@tsdown/css": "0.22.14",
95
+ "@turbo/gen": "2.10.7",
96
+ "@types/node": "26.1.2",
97
97
  "@types/react": "19.2.17",
98
98
  "@types/react-dom": "19.2.3",
99
99
  "jsdom": "29.1.1",
100
100
  "tailwindcss": "4.3.3",
101
- "tsdown": "0.22.9",
101
+ "tsdown": "0.22.14",
102
102
  "typescript": "7.0.2",
103
103
  "vitest": "4.1.10"
104
104
  }
@@ -46,10 +46,12 @@ To set up a consumer project after installing `@uselets/ui`, run `bun uselets in
46
46
  - Prefer barrel imports for common app usage and readability.
47
47
  - Use module subpaths when you want a single module or when the user asks for the exact import path.
48
48
  - Use `@uselets/ui/hooks/<hook-module>` for dedicated hook subpaths, not legacy `@uselets/ui/use-*` paths.
49
- - Recommend importing Tailwind, one theme stylesheet, and Inter once in the app global CSS. Use `@uselets/ui/themes/max.css` for Max apps or `@uselets/ui/themes/gomax.css` for Gomax apps.
49
+ - Recommend importing Tailwind and one theme stylesheet once in the app global CSS. Use `@uselets/ui/themes/max.css` for Max apps or `@uselets/ui/themes/gomax.css` for Gomax apps.
50
50
  - Recommend `@source '../node_modules/@uselets/ui/dist';` when Tailwind needs to generate classes used by installed `@uselets/ui` components.
51
51
  - Treat `@uselets/ui/themes/gomax.css` as the GoMax Figma-backed palette, exposed through the same public color families as the Max theme.
52
- - Recommend `@fontsource-variable/inter` when matching the package typography setup.
52
+ - Recommend `@fontsource-variable/inter` when matching the package typography setup. Import it once from the
53
+ app's entry file (`import '@fontsource-variable/inter'` in `app/layout.tsx`, `pages/_app.tsx`, or `src/main.tsx`),
54
+ not via `@import` in CSS — some bundlers, including Next.js, don't resolve third-party CSS `@import`s reliably.
53
55
  - Recommend `@uselets/ui/postcss.config` when the app needs the package PostCSS preset for Tailwind v4.
54
56
  - For tooltip-heavy apps, wrap the app with `TooltipProvider`; use `Tooltip label={...}` for common trigger/content usage and `TooltipRoot` only when manual composition is needed.
55
57
  - Use `UnstyledButton` when button semantics are needed without `Button` variants; it provides reset styles, pointer cursor, focus ring, default `type="button"`, and `asChild`.
@@ -53,12 +53,12 @@ Run the package setup command from the project root to install dependencies, con
53
53
  bun uselets init
54
54
  ```
55
55
 
56
- The command asks for the package theme, defaults the global CSS path to `src/styles/globals.css`, creates that CSS file when missing, preserves an existing `postcss.config.mjs`, and asks whether to install the agent skill.
56
+ The command asks for the package theme, defaults the global CSS path to `src/styles/globals.css`, creates that CSS file when missing, preserves an existing `postcss.config.mjs`, and asks whether to install the agent skill. It also detects a conventional app entry file (`app/layout.tsx`, `pages/_app.tsx`, `src/main.tsx`, `src/index.tsx`, and `.jsx` variants) and inserts `import '@fontsource-variable/inter'` there, or asks for the entry file path when none is found. Use `--entry <path>` to set it explicitly for non-interactive setups.
57
57
 
58
58
  For non-interactive setup, provide explicit options:
59
59
 
60
60
  ```bash
61
- bun uselets init --theme max --css src/styles/globals.css --no-install-skill
61
+ bun uselets init --theme max --css src/styles/globals.css --entry app/layout.tsx --no-install-skill
62
62
  ```
63
63
 
64
64
  ## Agent skill installation
@@ -99,16 +99,22 @@ Use `bun uselets skill --agent codex` or `bun uselets skill --agent claude` to i
99
99
 
100
100
  ## Base setup
101
101
 
102
- Import Tailwind, one package theme, and Inter once in the app global stylesheet:
102
+ Import Tailwind and one package theme once in the app global stylesheet:
103
103
 
104
104
  ```css
105
105
  @import 'tailwindcss';
106
106
  @import '@uselets/ui/themes/max.css';
107
- @import '@fontsource-variable/inter';
108
107
  ```
109
108
 
110
109
  For GoMax apps, import `@uselets/ui/themes/gomax.css` instead.
111
110
 
111
+ Import the Inter font once from the app's entry file, not from CSS (some bundlers, including Next.js, don't resolve third-party CSS `@import`s reliably):
112
+
113
+ ```ts
114
+ // app/layout.tsx (or src/main.tsx, pages/_app.tsx, ...)
115
+ import '@fontsource-variable/inter'
116
+ ```
117
+
112
118
  If the app needs Tailwind v4 PostCSS setup, reuse the package preset:
113
119
 
114
120
  ```js