solidui-cli 0.7.1 → 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +43 -4
  2. package/README.md +47 -21
  3. package/dist/index.js +3333 -1076
  4. package/package.json +46 -36
package/dist/index.js CHANGED
@@ -4,1217 +4,3474 @@
4
4
  import { Command as Command3 } from "commander";
5
5
 
6
6
  // src/commands/add.ts
7
- import { existsSync as existsSync2 } from "node:fs";
8
- import { mkdir, writeFile } from "node:fs/promises";
9
- import path3 from "node:path";
10
- import * as p2 from "@clack/prompts";
11
- import { Command } from "commander";
12
- import { execa } from "execa";
7
+ import path7 from "path";
13
8
 
14
- // ../../node_modules/.pnpm/valibot@0.36.0/node_modules/valibot/dist/index.js
15
- var store;
16
- function getGlobalConfig(config2) {
17
- return {
18
- lang: config2?.lang ?? store?.lang,
19
- message: config2?.message,
20
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
21
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
22
- };
23
- }
24
- var store2;
25
- function getGlobalMessage(lang) {
26
- return store2?.get(lang);
9
+ // ../registry/src/versions/supported-versions.json
10
+ var supported_versions_default = {
11
+ requirements: {
12
+ "solid-js": "^2.0.0",
13
+ tailwindcss: "^4.3.0"
14
+ },
15
+ packages: {
16
+ "@astrojs/markdown-remark": "^7.3.10",
17
+ "@astrojs/mdx": "^8.1.6",
18
+ "@fontsource-variable/dm-sans": "^5.3.0",
19
+ "@fontsource-variable/eb-garamond": "^5.3.0",
20
+ "@fontsource-variable/figtree": "^5.3.0",
21
+ "@fontsource-variable/geist": "^5.3.0",
22
+ "@fontsource-variable/geist-mono": "^5.3.0",
23
+ "@fontsource-variable/ibm-plex-sans": "^5.3.0",
24
+ "@fontsource-variable/instrument-sans": "^5.3.0",
25
+ "@fontsource-variable/inter": "^5.3.0",
26
+ "@fontsource-variable/jetbrains-mono": "^5.3.0",
27
+ "@fontsource-variable/lora": "^5.3.0",
28
+ "@fontsource-variable/manrope": "^5.3.0",
29
+ "@fontsource-variable/merriweather": "^5.3.0",
30
+ "@fontsource-variable/montserrat": "^5.3.0",
31
+ "@fontsource-variable/noto-sans": "^5.3.0",
32
+ "@fontsource-variable/noto-serif": "^5.3.0",
33
+ "@fontsource-variable/nunito-sans": "^5.3.0",
34
+ "@fontsource-variable/outfit": "^5.3.0",
35
+ "@fontsource-variable/oxanium": "^5.3.0",
36
+ "@fontsource-variable/playfair-display": "^5.3.0",
37
+ "@fontsource-variable/public-sans": "^5.3.0",
38
+ "@fontsource-variable/raleway": "^5.3.0",
39
+ "@fontsource-variable/roboto": "^5.3.0",
40
+ "@fontsource-variable/roboto-slab": "^5.3.0",
41
+ "@fontsource-variable/source-sans-3": "^5.3.1",
42
+ "@fontsource-variable/space-grotesk": "^5.3.0",
43
+ "@fontsource/instrument-serif": "^5.3.0",
44
+ "@ui-sdk/core": "0.1.0-beta.17",
45
+ "@ui-sdk/solid": "0.1.0-beta.17",
46
+ astro: "^7.4.12",
47
+ "chrono-node": "^2.10.3",
48
+ "class-variance-authority": "^0.7.1",
49
+ clsx: "^2.1.1",
50
+ micromark: "^4.0.3",
51
+ "rehype-pretty-code": "^0.14.6",
52
+ shiki: "^4.6.0",
53
+ "tailwind-merge": "^3.7.1",
54
+ "tw-animate-css": "^1.4.0",
55
+ zod: "^4.6.7"
56
+ }
57
+ };
58
+
59
+ // ../registry/src/versions/index.ts
60
+ var SUPPORTED_VERSIONS = supported_versions_default;
61
+ function supportedRange(name) {
62
+ return SUPPORTED_VERSIONS.requirements[name] ?? SUPPORTED_VERSIONS.packages[name];
27
63
  }
28
- var store3;
29
- function getSchemaMessage(lang) {
30
- return store3?.get(lang);
64
+
65
+ // src/commands/add.ts
66
+ import { Command } from "commander";
67
+
68
+ // src/project/versions.ts
69
+ import path2 from "path";
70
+ import semver from "semver";
71
+
72
+ // src/project/package-json.ts
73
+ import { readFileSync } from "fs";
74
+ import path from "path";
75
+ function readPackageJson(dir) {
76
+ try {
77
+ return JSON.parse(readFileSync(path.join(dir, "package.json"), "utf8"));
78
+ } catch {
79
+ return null;
80
+ }
31
81
  }
32
- var store4;
33
- function getSpecificMessage(reference, lang) {
34
- return store4?.get(reference)?.get(lang);
82
+ function declaredRange(pkg, name) {
83
+ return pkg.dependencies?.[name] ?? pkg.devDependencies?.[name];
35
84
  }
36
- function _stringify(input) {
37
- const type = typeof input;
38
- if (type === "string") {
39
- return `"${input}"`;
40
- }
41
- if (type === "number" || type === "bigint" || type === "boolean") {
42
- return `${input}`;
85
+
86
+ // src/project/versions.ts
87
+ function findInstalledVersion(cwd, name) {
88
+ let dir = path2.resolve(cwd);
89
+ for (; ; ) {
90
+ const version = readPackageJson(
91
+ path2.join(dir, "node_modules", name)
92
+ )?.version;
93
+ if (version) return version;
94
+ const parent = path2.dirname(dir);
95
+ if (parent === dir) return void 0;
96
+ dir = parent;
43
97
  }
44
- if (type === "object" || type === "function") {
45
- return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
98
+ }
99
+ function resolveVersion(cwd, pkg, name) {
100
+ const declared = declaredRange(pkg, name);
101
+ const installed = findInstalledVersion(cwd, name);
102
+ if (declared === void 0) {
103
+ return installed ? { name, source: "installed", version: installed } : { name, source: "missing" };
46
104
  }
47
- return type;
48
- }
49
- function _addIssue(context, label, dataset, config2, other) {
50
- const input = other && "input" in other ? other.input : dataset.value;
51
- const expected = other?.expected ?? context.expects ?? null;
52
- const received = other?.received ?? _stringify(input);
53
- const issue = {
54
- kind: context.kind,
55
- type: context.type,
56
- input,
57
- expected,
58
- received,
59
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
60
- // @ts-expect-error
61
- requirement: context.requirement,
62
- path: other?.path,
63
- issues: other?.issues,
64
- lang: config2.lang,
65
- abortEarly: config2.abortEarly,
66
- abortPipeEarly: config2.abortPipeEarly
67
- };
68
- const isSchema = context.kind === "schema";
69
- const message = other?.message ?? // @ts-expect-error
70
- context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
71
- if (message) {
72
- issue.message = typeof message === "function" ? message(issue) : message;
105
+ if (installed)
106
+ return { name, source: "installed", version: installed, declared };
107
+ const lowest = semver.validRange(declared) ? semver.minVersion(declared) : null;
108
+ return lowest ? { name, source: "declared", version: lowest.version, declared } : { name, source: "unresolved", declared };
109
+ }
110
+ function satisfies(version, range) {
111
+ return semver.satisfies(version, range, { includePrerelease: true });
112
+ }
113
+ function majorOf(version) {
114
+ return semver.major(version);
115
+ }
116
+ function isBelowRange(version, range) {
117
+ const lowest = semver.minVersion(range);
118
+ return lowest ? semver.lt(version, lowest) : false;
119
+ }
120
+ function canUpdateInto(version, range) {
121
+ const lowest = semver.minVersion(range);
122
+ return !!lowest && semver.lt(version, lowest) && semver.major(version) === lowest.major;
123
+ }
124
+
125
+ // src/install/dependencies.ts
126
+ function parseSpec(spec2) {
127
+ const at = spec2.indexOf("@", spec2.startsWith("@") ? 1 : 0);
128
+ return at === -1 ? { name: spec2, range: "" } : { name: spec2.slice(0, at), range: spec2.slice(at + 1) };
129
+ }
130
+ function planDependencies(cwd, pkg, specs) {
131
+ const plan = { install: [], conflicts: [], satisfied: [] };
132
+ const seen = /* @__PURE__ */ new Set();
133
+ for (const spec2 of specs) {
134
+ const { name, range } = parseSpec(spec2);
135
+ if (seen.has(name)) continue;
136
+ seen.add(name);
137
+ const resolved = resolveVersion(cwd, pkg, name);
138
+ if (resolved.source === "missing") plan.install.push(spec2);
139
+ else if (!range) plan.satisfied.push(name);
140
+ else if (!("version" in resolved))
141
+ plan.conflicts.push({ name, range, found: resolved.declared, spec: spec2 });
142
+ else if (satisfies(resolved.version, range)) plan.satisfied.push(name);
143
+ else plan.conflicts.push({ name, range, found: resolved.version, spec: spec2 });
73
144
  }
74
- if (isSchema) {
75
- dataset.typed = false;
145
+ return plan;
146
+ }
147
+ var isExactBuild = (range) => range.includes("-");
148
+ async function resolveConflicts(plan, ui, { ask, yes }) {
149
+ const install = [...plan.install];
150
+ for (const conflict of plan.conflicts) {
151
+ const { name, found, range, spec: spec2 } = conflict;
152
+ const needed = isExactBuild(range);
153
+ const question = needed ? `The components need ${name} ${range}, the project has ${found}. Install ${spec2}?` : `${name} ${found} is outside the tested range ${range}. Install ${spec2}?`;
154
+ if (needed && yes || ask && await ui.confirm(question, needed))
155
+ install.push(spec2);
156
+ else
157
+ ui.warn(
158
+ needed ? `Kept ${name} ${found}. The components are built for ${range} and may break with another build.` : `Kept ${name} ${found}. Solid UI is tested with ${range}.`
159
+ );
76
160
  }
77
- if (dataset.issues) {
78
- dataset.issues.push(issue);
79
- } else {
80
- dataset.issues = [issue];
161
+ return install;
162
+ }
163
+
164
+ // src/install/files.ts
165
+ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
166
+ import path4 from "path";
167
+
168
+ // src/project/tsconfig.ts
169
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
170
+ import path3 from "path";
171
+ import {
172
+ applyEdits,
173
+ modify,
174
+ parse
175
+ } from "jsonc-parser";
176
+ function readTsConfig(file) {
177
+ if (!existsSync(file)) return null;
178
+ const text2 = readFileSync2(file, "utf8");
179
+ const errors = [];
180
+ const config = parse(text2, errors, { allowTrailingComma: true });
181
+ if (errors.length || typeof config !== "object" || config === null) {
182
+ throw new Error(`Could not parse ${file}.`);
81
183
  }
184
+ return { path: file, text: text2, config };
82
185
  }
83
- var ValiError = class extends Error {
84
- /**
85
- * The error issues.
86
- */
87
- issues;
88
- /**
89
- * Creates a Valibot error with useful information.
90
- *
91
- * @param issues The error issues.
92
- */
93
- constructor(issues) {
94
- super(issues[0].message);
95
- this.name = "ValiError";
96
- this.issues = issues;
186
+ function referencedPath(dir, reference) {
187
+ const target = path3.resolve(dir, reference);
188
+ return target.endsWith(".json") ? target : path3.join(target, "tsconfig.json");
189
+ }
190
+ function findAppTsConfig(cwd) {
191
+ const root = readTsConfig(path3.join(cwd, "tsconfig.json"));
192
+ if (!root) return null;
193
+ const { references, files, include, compilerOptions } = root.config;
194
+ const solutionStyle = references?.length && !compilerOptions?.paths && (files?.length === 0 || !files && !include);
195
+ if (!solutionStyle) return root;
196
+ for (const reference of references) {
197
+ const candidate = readTsConfig(referencedPath(cwd, reference.path));
198
+ if (candidate?.config.include?.some((entry) => /^(?:\.\/)?src\b/.test(entry)))
199
+ return candidate;
97
200
  }
98
- };
99
- function getDefault(schema, dataset, config2) {
100
- return typeof schema.default === "function" ? (
101
- // @ts-expect-error
102
- schema.default(dataset, config2)
103
- ) : (
104
- // @ts-expect-error
105
- schema.default
106
- );
201
+ return root;
107
202
  }
108
- function array(item, message) {
109
- return {
110
- kind: "schema",
111
- type: "array",
112
- reference: array,
113
- expects: "Array",
114
- async: false,
115
- item,
116
- message,
117
- _run(dataset, config2) {
118
- const input = dataset.value;
119
- if (Array.isArray(input)) {
120
- dataset.typed = true;
121
- dataset.value = [];
122
- for (let key = 0; key < input.length; key++) {
123
- const value2 = input[key];
124
- const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
125
- if (itemDataset.issues) {
126
- const pathItem = {
127
- type: "array",
128
- origin: "value",
129
- input,
130
- key,
131
- value: value2
132
- };
133
- for (const issue of itemDataset.issues) {
134
- if (issue.path) {
135
- issue.path.unshift(pathItem);
136
- } else {
137
- issue.path = [pathItem];
138
- }
139
- dataset.issues?.push(issue);
140
- }
141
- if (!dataset.issues) {
142
- dataset.issues = itemDataset.issues;
143
- }
144
- if (config2.abortEarly) {
145
- dataset.typed = false;
146
- break;
147
- }
148
- }
149
- if (!itemDataset.typed) {
150
- dataset.typed = false;
151
- }
152
- dataset.value.push(itemDataset.value);
153
- }
154
- } else {
155
- _addIssue(this, "type", dataset, config2);
156
- }
157
- return dataset;
158
- }
159
- };
203
+ function tsPaths(file) {
204
+ return file.config.compilerOptions?.paths ?? {};
160
205
  }
161
- function boolean(message) {
162
- return {
163
- kind: "schema",
164
- type: "boolean",
165
- reference: boolean,
166
- expects: "boolean",
167
- async: false,
168
- message,
169
- _run(dataset, config2) {
170
- if (typeof dataset.value === "boolean") {
171
- dataset.typed = true;
172
- } else {
173
- _addIssue(this, "type", dataset, config2);
206
+ function resolveAlias(file, alias) {
207
+ const dir = path3.dirname(file.path);
208
+ const base2 = path3.resolve(dir, file.config.compilerOptions?.baseUrl ?? ".");
209
+ for (const [pattern, targets] of Object.entries(tsPaths(file))) {
210
+ const target = targets[0];
211
+ if (!target) continue;
212
+ if (pattern.endsWith("/*")) {
213
+ const prefix = pattern.slice(0, -1);
214
+ if (alias.startsWith(prefix)) {
215
+ return path3.resolve(
216
+ base2,
217
+ target.replace("*", alias.slice(prefix.length))
218
+ );
174
219
  }
175
- return dataset;
220
+ } else if (pattern === alias) {
221
+ return path3.resolve(base2, target);
176
222
  }
177
- };
223
+ }
224
+ return null;
178
225
  }
179
- function object(entries, message) {
226
+ var FORMATTING = {
227
+ insertSpaces: true,
228
+ tabSize: 2,
229
+ eol: "\n"
230
+ };
231
+ function addPathAlias(file, prefix, target) {
232
+ const pattern = `${prefix}/*`;
233
+ const indent = file.text.match(/\n( +|\t)"/)?.[1];
234
+ const formattingOptions = indent?.startsWith(" ") ? { ...FORMATTING, insertSpaces: false } : { ...FORMATTING, tabSize: indent?.length ?? 2 };
235
+ const eol = file.text.includes("\r\n") ? "\r\n" : "\n";
236
+ const text2 = applyEdits(
237
+ file.text,
238
+ modify(file.text, ["compilerOptions", "paths", pattern], [target], {
239
+ formattingOptions: { ...formattingOptions, eol }
240
+ })
241
+ );
180
242
  return {
181
- kind: "schema",
182
- type: "object",
183
- reference: object,
184
- expects: "Object",
185
- async: false,
186
- entries,
187
- message,
188
- _run(dataset, config2) {
189
- const input = dataset.value;
190
- if (input && typeof input === "object") {
191
- dataset.typed = true;
192
- dataset.value = {};
193
- for (const key in this.entries) {
194
- const value2 = input[key];
195
- const valueDataset = this.entries[key]._run(
196
- { typed: false, value: value2 },
197
- config2
198
- );
199
- if (valueDataset.issues) {
200
- const pathItem = {
201
- type: "object",
202
- origin: "value",
203
- input,
204
- key,
205
- value: value2
206
- };
207
- for (const issue of valueDataset.issues) {
208
- if (issue.path) {
209
- issue.path.unshift(pathItem);
210
- } else {
211
- issue.path = [pathItem];
212
- }
213
- dataset.issues?.push(issue);
214
- }
215
- if (!dataset.issues) {
216
- dataset.issues = valueDataset.issues;
217
- }
218
- if (config2.abortEarly) {
219
- dataset.typed = false;
220
- break;
221
- }
222
- }
223
- if (!valueDataset.typed) {
224
- dataset.typed = false;
225
- }
226
- if (valueDataset.value !== void 0 || key in input) {
227
- dataset.value[key] = valueDataset.value;
228
- }
229
- }
230
- } else {
231
- _addIssue(this, "type", dataset, config2);
243
+ ...file,
244
+ text: text2,
245
+ config: {
246
+ ...file.config,
247
+ compilerOptions: {
248
+ ...file.config.compilerOptions,
249
+ paths: { ...tsPaths(file), [pattern]: [target] }
232
250
  }
233
- return dataset;
234
251
  }
235
252
  };
236
253
  }
237
- function optional(wrapped, ...args) {
238
- const schema = {
239
- kind: "schema",
240
- type: "optional",
241
- reference: optional,
242
- expects: `${wrapped.expects} | undefined`,
243
- async: false,
244
- wrapped,
245
- _run(dataset, config2) {
246
- if (dataset.value === void 0) {
247
- if ("default" in this) {
248
- dataset.value = getDefault(
249
- this,
250
- dataset,
251
- config2
252
- );
253
- }
254
- if (dataset.value === void 0) {
255
- dataset.typed = true;
256
- return dataset;
257
- }
254
+
255
+ // src/utils/colors.ts
256
+ import { styleText } from "util";
257
+
258
+ // package.json
259
+ var package_default = {
260
+ name: "solidui-cli",
261
+ version: "1.0.0",
262
+ description: "Add Solid UI components to your Solid 2 app: shadcn/ui-style, copy-and-own components built with UI SDK and Tailwind CSS",
263
+ keywords: [
264
+ "cli",
265
+ "components",
266
+ "copy-and-own",
267
+ "registry",
268
+ "shadcn",
269
+ "shadcn-ui",
270
+ "solid",
271
+ "solid-js",
272
+ "solid-ui",
273
+ "solidjs",
274
+ "tailwindcss",
275
+ "ui",
276
+ "ui-sdk"
277
+ ],
278
+ bugs: {
279
+ url: "https://github.com/stefan-karger/solid-ui/issues"
280
+ },
281
+ license: "MIT",
282
+ author: {
283
+ name: "Stefan E-K & Michael Essiet",
284
+ url: "https://twitter.com/stefan_e_k"
285
+ },
286
+ repository: {
287
+ type: "git",
288
+ url: "https://github.com/stefan-karger/solid-ui.git",
289
+ directory: "packages/cli"
290
+ },
291
+ bin: "./dist/index.js",
292
+ files: [
293
+ "dist"
294
+ ],
295
+ type: "module",
296
+ exports: "./dist/index.js",
297
+ publishConfig: {
298
+ access: "public"
299
+ },
300
+ scripts: {
301
+ build: "tsup",
302
+ check: "tsc --noEmit",
303
+ "pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
304
+ "pub:release": "pnpm build && pnpm publish --access public",
305
+ release: "changeset version"
306
+ },
307
+ dependencies: {
308
+ "@babel/parser": "^8.1.3",
309
+ "@clack/prompts": "^1.9.0",
310
+ commander: "^15.1.0",
311
+ execa: "^10.2.1",
312
+ "jsonc-parser": "^3.3.1",
313
+ "package-manager-detector": "^1.9.0",
314
+ semver: "^7.8.6",
315
+ "tailwind-merge": "^3.7.1",
316
+ zod: "^4.6.7"
317
+ },
318
+ devDependencies: {
319
+ "@babel/types": "^8.1.3",
320
+ "@solid-ui/registry": "workspace:*",
321
+ "@types/node": "24.19.2",
322
+ "@types/semver": "^7.8.0",
323
+ tsup: "^9.0.0",
324
+ typescript: "6.0.3"
325
+ },
326
+ engines: {
327
+ node: "^22.18.0 || >=24.11.0"
328
+ }
329
+ };
330
+
331
+ // src/utils/version.ts
332
+ var CLI_NAME = package_default.name;
333
+ var CLI_VERSION = package_default.version;
334
+
335
+ // src/utils/colors.ts
336
+ var style = (format) => (text2) => styleText(format, text2);
337
+ var color = {
338
+ // Commands and code to copy.
339
+ command: style("cyan"),
340
+ // Files init or add creates, changes or leaves alone.
341
+ added: style("green"),
342
+ changed: style("cyan"),
343
+ kept: style("yellow"),
344
+ muted: style("dim")
345
+ };
346
+ function badge(title = `Solid UI v${CLI_VERSION}`) {
347
+ return styleText(["bgCyan", "black"], ` ${title} `);
348
+ }
349
+
350
+ // src/utils/errors.ts
351
+ var CliError = class extends Error {
352
+ constructor(message, exitCode = 1) {
353
+ super(message);
354
+ this.exitCode = exitCode;
355
+ this.name = "CliError";
356
+ }
357
+ exitCode;
358
+ };
359
+
360
+ // src/install/files.ts
361
+ var FOLDERS = {
362
+ "registry:ui": ["ui/", "ui"],
363
+ "registry:lib": ["lib/", "lib"],
364
+ "registry:hook": ["hooks/", "hooks"],
365
+ "registry:component": ["components/", "components"],
366
+ "registry:block": ["components/", "components"]
367
+ };
368
+ function inside(root, target) {
369
+ const relative = path4.relative(root, target);
370
+ return !!relative && !relative.startsWith("..") && !path4.isAbsolute(relative);
371
+ }
372
+ function resolveTargetPath(file, config, tsconfig, cwd) {
373
+ let target;
374
+ const folder = FOLDERS[file.type];
375
+ if (file.target) {
376
+ target = path4.resolve(cwd, file.target);
377
+ } else if (folder) {
378
+ const [prefix, alias] = folder;
379
+ const dir = resolveAlias(tsconfig, config.aliases[alias]);
380
+ if (!dir)
381
+ throw new CliError(
382
+ `${path4.basename(tsconfig.path)} has no path for the ${alias} alias ${config.aliases[alias]}.`
383
+ );
384
+ const relative = file.path.startsWith(prefix) ? file.path.slice(prefix.length) : path4.posix.basename(file.path);
385
+ target = path4.resolve(dir, relative);
386
+ } else {
387
+ throw new CliError(`Can't place ${file.path} (${file.type}).`);
388
+ }
389
+ if (!inside(cwd, target))
390
+ throw new CliError(`${file.path} would be written outside the project.`);
391
+ return target;
392
+ }
393
+ var normalize = (text2) => text2.replace(/\r\n?/g, "\n").trimEnd();
394
+ async function applyFiles(files, cwd, ui, options) {
395
+ const result = { written: [], kept: [] };
396
+ for (const file of files) {
397
+ const relative = path4.relative(cwd, file.path).split(path4.sep).join("/");
398
+ const content = `${normalize(file.content)}
399
+ `;
400
+ const exists = existsSync2(file.path);
401
+ if (exists) {
402
+ if (normalize(readFileSync3(file.path, "utf8")) === normalize(content))
403
+ continue;
404
+ const replace = options.overwrite || (await options.confirm?.(relative) ?? false);
405
+ if (!replace) {
406
+ result.kept.push(relative);
407
+ continue;
258
408
  }
259
- return this.wrapped._run(dataset, config2);
260
409
  }
261
- };
262
- if (0 in args) {
263
- schema.default = args[0];
410
+ await ui.task(
411
+ `${exists ? "Updating" : "Writing"} ${relative}`,
412
+ async () => {
413
+ mkdirSync(path4.dirname(file.path), { recursive: true });
414
+ writeFileSync(file.path, content);
415
+ },
416
+ `${exists ? color.changed("Updated") : color.added("Wrote")} ${relative}`
417
+ );
418
+ result.written.push(relative);
264
419
  }
265
- return schema;
420
+ return result;
266
421
  }
267
- function picklist(options, message) {
268
- return {
269
- kind: "schema",
270
- type: "picklist",
271
- reference: picklist,
272
- expects: options.map(_stringify).join(" | ") || "never",
273
- async: false,
274
- options,
275
- message,
276
- _run(dataset, config2) {
277
- if (this.options.includes(dataset.value)) {
278
- dataset.typed = true;
279
- } else {
280
- _addIssue(this, "type", dataset, config2);
281
- }
282
- return dataset;
422
+
423
+ // ../registry/src/menu.ts
424
+ import { twMerge } from "tailwind-merge";
425
+ var MENU_TRANSLUCENT_CLASSES = "relative animate-none! bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:**:text-accent-foreground! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:focus:bg-foreground/10!";
426
+ var STRING_LITERAL = /(["'`])(?:\\.|(?!\1)[\s\S])*?\1/g;
427
+ var MARKER = /(?:^|\s)cn-menu-(?:target|translucent)(?=\s|$)/;
428
+ function transformMenu(source, menuColor) {
429
+ const inverted = menuColor.startsWith("inverted");
430
+ const translucent = menuColor.endsWith("translucent");
431
+ return source.replace(STRING_LITERAL, (literal, quote) => {
432
+ const value = literal.slice(1, -1);
433
+ if (!MARKER.test(value)) return literal;
434
+ if (quote === "`" && value.includes("${")) {
435
+ throw new Error(
436
+ "[menu] Cannot transform a menu marker in a template expression"
437
+ );
283
438
  }
284
- };
439
+ let classes = value.split(/\s+/).filter(Boolean).flatMap((name) => {
440
+ if (name === "cn-menu-target") return inverted ? ["dark"] : [];
441
+ if (name === "cn-menu-translucent") return [];
442
+ return [name];
443
+ }).join(" ");
444
+ if (translucent && /(?:^|\s)cn-menu-translucent(?=\s|$)/.test(value)) {
445
+ classes = twMerge(classes, MENU_TRANSLUCENT_CLASSES);
446
+ }
447
+ return `${quote}${classes}${quote}`;
448
+ });
285
449
  }
286
- function string(message) {
287
- return {
288
- kind: "schema",
289
- type: "string",
290
- reference: string,
291
- expects: "string",
292
- async: false,
293
- message,
294
- _run(dataset, config2) {
295
- if (typeof dataset.value === "string") {
296
- dataset.typed = true;
297
- } else {
298
- _addIssue(this, "type", dataset, config2);
299
- }
300
- return dataset;
450
+
451
+ // src/install/transform.ts
452
+ var SPECIFIER = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(["'])(~\/[^"'\n]+)\2/g;
453
+ function rewriteAliases(code, aliases) {
454
+ const prefixes = [
455
+ ["~/components/ui", aliases.ui],
456
+ ["~/components", aliases.components],
457
+ ["~/lib", aliases.lib],
458
+ ["~/hooks", aliases.hooks]
459
+ ];
460
+ const map = (specifier) => {
461
+ if (specifier === "~/lib/utils") return aliases.utils;
462
+ for (const [from, to] of prefixes) {
463
+ if (specifier === from || specifier.startsWith(`${from}/`))
464
+ return `${to}${specifier.slice(from.length)}`;
301
465
  }
466
+ return specifier;
302
467
  };
468
+ return code.replace(
469
+ SPECIFIER,
470
+ (_, keyword, quote, specifier) => `${keyword}${quote}${map(specifier)}${quote}`
471
+ );
303
472
  }
304
- function parse(schema, input, config2) {
305
- const dataset = schema._run(
306
- { typed: false, value: input },
307
- getGlobalConfig(config2)
473
+ function transformSource(path12, code, config) {
474
+ if (!/\.[cm]?[jt]sx?$/.test(path12)) return code;
475
+ return rewriteAliases(transformMenu(code, config.menuColor), config.aliases);
476
+ }
477
+
478
+ // src/preflight/add.ts
479
+ import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
480
+ import path6 from "path";
481
+
482
+ // ../registry/src/config.ts
483
+ import { z } from "zod";
484
+
485
+ // ../registry/src/preset/codec.ts
486
+ var BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
487
+ var styles = [
488
+ "nova",
489
+ "vega",
490
+ "maia",
491
+ "lyra",
492
+ "mira",
493
+ "luma",
494
+ "sera",
495
+ "rhea"
496
+ ];
497
+ var baseColors = [
498
+ "neutral",
499
+ "stone",
500
+ "zinc",
501
+ "gray",
502
+ "mauve",
503
+ "olive",
504
+ "mist",
505
+ "taupe"
506
+ ];
507
+ var themes = [
508
+ "neutral",
509
+ "stone",
510
+ "zinc",
511
+ "gray",
512
+ "amber",
513
+ "blue",
514
+ "cyan",
515
+ "emerald",
516
+ "fuchsia",
517
+ "green",
518
+ "indigo",
519
+ "lime",
520
+ "orange",
521
+ "pink",
522
+ "purple",
523
+ "red",
524
+ "rose",
525
+ "sky",
526
+ "teal",
527
+ "violet",
528
+ "yellow",
529
+ "mauve",
530
+ "olive",
531
+ "mist",
532
+ "taupe"
533
+ ];
534
+ var fonts = [
535
+ "inter",
536
+ "noto-sans",
537
+ "nunito-sans",
538
+ "figtree",
539
+ "roboto",
540
+ "raleway",
541
+ "dm-sans",
542
+ "public-sans",
543
+ "outfit",
544
+ "jetbrains-mono",
545
+ "geist",
546
+ "geist-mono",
547
+ "lora",
548
+ "merriweather",
549
+ "playfair-display",
550
+ "noto-serif",
551
+ "roboto-slab",
552
+ "oxanium",
553
+ "manrope",
554
+ "space-grotesk",
555
+ "montserrat",
556
+ "ibm-plex-sans",
557
+ "source-sans-3",
558
+ "instrument-sans",
559
+ "eb-garamond",
560
+ "instrument-serif"
561
+ ];
562
+ var headingFonts = ["inherit", ...fonts];
563
+ var radii = ["default", "none", "small", "medium", "large"];
564
+ var menuAccents = ["subtle", "bold"];
565
+ var menuColors = [
566
+ "default",
567
+ "inverted",
568
+ "default-translucent",
569
+ "inverted-translucent"
570
+ ];
571
+ var presetOptions = {
572
+ menuColor: menuColors,
573
+ menuAccent: menuAccents,
574
+ radius: radii,
575
+ font: fonts,
576
+ theme: themes,
577
+ baseColor: baseColors,
578
+ style: styles,
579
+ chartColor: themes,
580
+ fontHeading: headingFonts
581
+ };
582
+ var fieldLayout = {
583
+ menuColor: [0, 3],
584
+ menuAccent: [3, 3],
585
+ radius: [6, 4],
586
+ font: [10, 6],
587
+ // Offsets 16–21 are reserved for the icon library; zero encodes Lucide.
588
+ theme: [22, 6],
589
+ baseColor: [28, 6],
590
+ style: [34, 6],
591
+ chartColor: [40, 6],
592
+ fontHeading: [46, 5]
593
+ };
594
+ var fields = Object.keys(fieldLayout);
595
+ function unpackPreset(bits) {
596
+ return Object.fromEntries(
597
+ fields.map((field) => {
598
+ const [offset, width] = fieldLayout[field];
599
+ const values = presetOptions[field];
600
+ const index = Math.floor(bits / 2 ** offset) % 2 ** width;
601
+ return [field, values[index] ?? values[0]];
602
+ })
308
603
  );
309
- if (dataset.issues) {
310
- throw new ValiError(dataset.issues);
604
+ }
605
+ var defaultPreset = unpackPreset(0);
606
+ function encodePreset(preset) {
607
+ let bits = 0;
608
+ for (const field of fields) {
609
+ const values = presetOptions[field];
610
+ const index = values.indexOf(preset[field]);
611
+ bits += Math.max(index, 0) * 2 ** fieldLayout[field][0];
311
612
  }
312
- return dataset.value;
613
+ let code = "";
614
+ do {
615
+ code = BASE62[bits % 62] + code;
616
+ bits = Math.floor(bits / 62);
617
+ } while (bits > 0);
618
+ return `b${code}`;
619
+ }
620
+ function isPresetCode(code) {
621
+ return /^b[0-9A-Za-z]{1,9}$/.test(code);
622
+ }
623
+ function decodePreset(code) {
624
+ if (!isPresetCode(code)) return null;
625
+ let bits = 0;
626
+ for (const digit of code.slice(1)) bits = bits * 62 + BASE62.indexOf(digit);
627
+ return bits < 2 ** 51 ? unpackPreset(bits) : null;
628
+ }
629
+ function parsePresetInput(input) {
630
+ return decodePreset(input.trim().replace(/^--preset\s+/i, ""));
313
631
  }
314
632
 
315
- // src/utils/config.ts
316
- import { existsSync, readFileSync } from "node:fs";
317
- import path from "node:path";
318
- import { loadConfig } from "tsconfig-paths";
633
+ // ../registry/src/styles.ts
634
+ var styles2 = [
635
+ "vega",
636
+ "nova",
637
+ "maia",
638
+ "lyra",
639
+ "mira",
640
+ "luma",
641
+ "sera",
642
+ "rhea"
643
+ ];
319
644
 
320
- // src/utils/resolve-import.ts
321
- import { createMatchPath } from "tsconfig-paths";
322
- async function resolveImport(importPath, config) {
323
- return createMatchPath(config.absoluteBaseUrl, config.paths)(importPath, void 0, () => true, [
324
- ".ts",
325
- ".tsx"
326
- ]);
645
+ // ../registry/src/config.ts
646
+ var CONFIG_FILE = "components.json";
647
+ var LEGACY_CONFIG_FILE = "ui.config.json";
648
+ var CONFIG_SCHEMA_URL = "https://solid-ui.com/schema.json";
649
+ var DEFAULT_ALIAS = "~";
650
+ function aliasesFor(prefix) {
651
+ return {
652
+ components: `${prefix}/components`,
653
+ ui: `${prefix}/components/ui`,
654
+ lib: `${prefix}/lib`,
655
+ utils: `${prefix}/lib/utils`,
656
+ hooks: `${prefix}/hooks`
657
+ };
327
658
  }
659
+ var DEFAULT_ALIASES = aliasesFor(DEFAULT_ALIAS);
660
+ var componentsJsonSchema = z.object({
661
+ $schema: z.string().optional(),
662
+ style: z.enum(styles2),
663
+ // Normalized preset code; solid-ui.css is generated from it.
664
+ preset: z.string().refine(isPresetCode, "Expected a preset code like b0"),
665
+ tailwind: z.object({
666
+ // The app stylesheet with `@import "tailwindcss"`. solid-ui.css sits
667
+ // next to it.
668
+ css: z.string().min(1)
669
+ }).strict(),
670
+ menuColor: z.enum(presetOptions.menuColor).default("default"),
671
+ menuAccent: z.enum(presetOptions.menuAccent).default("subtle"),
672
+ aliases: z.object({
673
+ components: z.string().default(DEFAULT_ALIASES.components),
674
+ ui: z.string().default(DEFAULT_ALIASES.ui),
675
+ lib: z.string().default(DEFAULT_ALIASES.lib),
676
+ utils: z.string().default(DEFAULT_ALIASES.utils),
677
+ hooks: z.string().default(DEFAULT_ALIASES.hooks)
678
+ }).strict().default(DEFAULT_ALIASES)
679
+ }).strict();
328
680
 
329
- // src/utils/config.ts
330
- var DEFAULT_COMPONENTS = "~/components/ui";
331
- var DEFAULT_UTILS = "~/lib/utils";
332
- var DEFAULT_CSS_FILE = "src/app.css";
333
- var DEFAULT_TAILWIND_CONFIG = "tailwind.config.cjs";
334
- var DEFAULT_TAILWIND_PREFIX = "";
335
- var RawConfigSchema = object({
336
- $schema: optional(string()),
337
- tsx: boolean(),
338
- tailwind: object({
339
- css: string(),
340
- config: string(),
341
- prefix: optional(string(), "")
342
- }),
343
- aliases: object({
344
- components: string(),
345
- utils: string()
346
- })
347
- });
348
- var ConfigSchema = object({
349
- ...RawConfigSchema.entries,
350
- resolvedPaths: object({
351
- tailwindConfig: string(),
352
- tailwindCss: string(),
353
- utils: string(),
354
- components: string()
355
- })
356
- });
357
- async function resolveConfigPaths(cwd, config) {
358
- const tsConfig = await loadConfig(cwd);
359
- if (tsConfig.resultType === "failed") {
360
- throw new Error(
361
- `Failed to load ${config.tsx ? "tsconfig" : "jsconfig"}.json. ${tsConfig.message ?? ""}`.trim()
362
- );
681
+ // src/constants.ts
682
+ var SOLID_UI_URL = "https://www.solid-ui.com";
683
+ var INSTALLATION_URL = `${SOLID_UI_URL}/docs/installation`;
684
+ var CREATE_URL = `${SOLID_UI_URL}/create`;
685
+ var MIGRATION_URL = `${SOLID_UI_URL}/docs/migration`;
686
+ var LEGACY_CLI_VERSION = "0.7.2";
687
+
688
+ // src/utils/package-manager.ts
689
+ import { existsSync as existsSync3, readFileSync as readFileSync4, statSync } from "fs";
690
+ import path5 from "path";
691
+ import { execa } from "execa";
692
+ import { resolveCommand } from "package-manager-detector/commands";
693
+ import { getUserAgent } from "package-manager-detector/detect";
694
+ var INSTALL_MARKERS = [
695
+ ["node_modules/.modules.yaml", "pnpm"],
696
+ ["node_modules/.package-lock.json", "npm"],
697
+ ["node_modules/.yarn-state.yml", "yarn@berry"],
698
+ ["node_modules/.yarn-integrity", "yarn"],
699
+ [".pnp.cjs", "yarn@berry"],
700
+ ["node_modules/.deno", "deno"]
701
+ ];
702
+ var LOCKFILES = [
703
+ ["bun.lock", "bun"],
704
+ ["bun.lockb", "bun"],
705
+ ["pnpm-lock.yaml", "pnpm"],
706
+ ["yarn.lock", "yarn"],
707
+ ["package-lock.json", "npm"],
708
+ ["npm-shrinkwrap.json", "npm"],
709
+ ["deno.lock", "deno"]
710
+ ];
711
+ var ROOT_MARKERS = [".git", "pnpm-workspace.yaml"];
712
+ var NAMES = {
713
+ npm: "npm",
714
+ pnpm: "pnpm",
715
+ yarn: "yarn",
716
+ bun: "bun",
717
+ deno: "deno"
718
+ };
719
+ function newestLockfile(dir) {
720
+ return LOCKFILES.map(([file, agent]) => ({
721
+ file,
722
+ agent,
723
+ path: path5.join(dir, file)
724
+ })).filter((lock) => existsSync3(lock.path)).map((lock) => ({ ...lock, time: statSync(lock.path).mtimeMs })).sort((a, b) => b.time - a.time)[0];
725
+ }
726
+ function* upwards(cwd) {
727
+ for (let dir = path5.resolve(cwd); ; dir = path5.dirname(dir)) {
728
+ yield dir;
729
+ if (path5.dirname(dir) === dir) return;
363
730
  }
364
- return parse(ConfigSchema, {
365
- ...config,
366
- resolvedPaths: {
367
- tailwindConfig: path.resolve(cwd, config.tailwind.config),
368
- tailwindCss: path.resolve(cwd, config.tailwind.css),
369
- utils: await resolveImport(config.aliases.utils, tsConfig),
370
- components: await resolveImport(config.aliases.components, tsConfig)
371
- }
372
- });
373
731
  }
374
- function getRawConfig(cwd) {
375
- try {
376
- const configPath = path.resolve(cwd, "ui.config.json");
377
- if (!existsSync(configPath)) {
378
- return null;
732
+ function isRoot(dir) {
733
+ return ROOT_MARKERS.some((marker) => existsSync3(path5.join(dir, marker))) || LOCKFILES.some(([file]) => existsSync3(path5.join(dir, file)));
734
+ }
735
+ function installedBy(cwd) {
736
+ for (const dir of upwards(cwd)) {
737
+ for (const [marker, agent] of INSTALL_MARKERS)
738
+ if (existsSync3(path5.join(dir, marker))) return agent;
739
+ if (existsSync3(path5.join(dir, "node_modules"))) {
740
+ const lock = newestLockfile(dir);
741
+ if (lock) return lock.agent;
379
742
  }
380
- const config = JSON.parse(readFileSync(configPath).toString());
381
- return parse(RawConfigSchema, config);
382
- } catch (error) {
383
- throw new Error(`Invalid configuration found in ${cwd}/ui.config.json.`);
743
+ if (isRoot(dir)) return null;
384
744
  }
745
+ return null;
385
746
  }
386
- async function getConfig(cwd) {
387
- const config = getRawConfig(cwd);
388
- if (!config) {
389
- return null;
747
+ function packageManagerField(cwd) {
748
+ for (const dir of upwards(cwd)) {
749
+ const file = path5.join(dir, "package.json");
750
+ if (existsSync3(file)) {
751
+ try {
752
+ const field = JSON.parse(readFileSync4(file, "utf8")).packageManager;
753
+ const name = typeof field === "string" ? field.split("@")[0] : "";
754
+ if (NAMES[name]) return NAMES[name];
755
+ } catch {
756
+ }
757
+ }
758
+ if (isRoot(dir)) return null;
390
759
  }
391
- return await resolveConfigPaths(cwd, config);
760
+ return null;
392
761
  }
762
+ function detectAgent(cwd) {
763
+ return installedBy(cwd) ?? packageManagerField(cwd) ?? getUserAgent() ?? "npm";
764
+ }
765
+ function installCommand(specs, { agent, dev }) {
766
+ const args = agent === "deno" ? specs.map((spec2) => `npm:${spec2}`) : specs;
767
+ const command = specs.length ? resolveCommand(agent, "add", dev ? ["-D", ...args] : args) : resolveCommand(agent, "install", []);
768
+ if (!command)
769
+ throw new CliError(`Could not build an install command for ${agent}.`);
770
+ return command;
771
+ }
772
+ function formatCommand(command) {
773
+ return [command.command, ...command.args].join(" ");
774
+ }
775
+ var installPackages = async (cwd, specs, options) => {
776
+ const command = installCommand(specs, options);
777
+ const result = await execa(command.command, command.args, {
778
+ cwd,
779
+ all: true,
780
+ reject: false,
781
+ stdin: "ignore"
782
+ });
783
+ if (result.exitCode !== 0 || result.failed) {
784
+ const output = String(result.all ?? result.message ?? "").trim().split(/\r?\n/).slice(-30).join("\n");
785
+ throw new CliError(
786
+ `${formatCommand(command)} failed:
393
787
 
394
- // src/utils/get-package-manager.ts
395
- import { detect } from "@antfu/ni";
396
- async function getPackageManager(targetDir) {
397
- const packageManager = await detect({ programmatic: true, cwd: targetDir });
398
- if (packageManager === "yarn@berry") return "yarn";
399
- if (packageManager === "pnpm@6") return "pnpm";
400
- if (packageManager === "bun") return "bun";
401
- return packageManager ?? "npm";
788
+ ${output}
789
+
790
+ Fix the error above, then run the command yourself.`
791
+ );
792
+ }
793
+ };
794
+ function installedMessage(names, agent) {
795
+ return names.length <= 3 ? `Installed ${names.join(", ")}.` : `Installed ${names.length} packages with ${agent}.`;
796
+ }
797
+ function cliCommand(args, version = "latest") {
798
+ const agent = getUserAgent() ?? "npm";
799
+ const command = resolveCommand(agent, "execute", [
800
+ `${CLI_NAME}@${version}`,
801
+ ...args.split(" ").filter(Boolean)
802
+ ]);
803
+ return command ? formatCommand(command) : `npx ${CLI_NAME}@${version} ${args}`.trim();
402
804
  }
403
805
 
404
- // src/utils/logger.ts
405
- import * as p from "@clack/prompts";
406
- import chalk from "chalk";
407
- var headline = (text2) => chalk.bgGreen.bold.black(text2);
408
- var highlight = (text2) => chalk.bold.green(text2);
409
- var subtle = (text2) => chalk.grey(text2);
410
- function handleError(error) {
411
- p.log.message();
412
- if (typeof error === "string") {
413
- p.cancel(error);
414
- process.exit(1);
806
+ // src/preflight/add.ts
807
+ function runAddPreflight(cwd) {
808
+ const configPath = path6.join(cwd, CONFIG_FILE);
809
+ if (!existsSync4(configPath)) {
810
+ if (existsSync4(path6.join(cwd, LEGACY_CONFIG_FILE)))
811
+ throw new CliError(
812
+ `${LEGACY_CONFIG_FILE} belongs to solidui-cli ${LEGACY_CLI_VERSION} and the Solid 1 registry. Keep using that version here:
813
+
814
+ ${cliCommand("add <component>", LEGACY_CLI_VERSION)}`
815
+ );
816
+ throw new CliError(
817
+ `No ${CONFIG_FILE} in ${cwd}. Set up the project first:
818
+
819
+ ${cliCommand("init")}`
820
+ );
821
+ }
822
+ let raw;
823
+ try {
824
+ raw = JSON.parse(readFileSync5(configPath, "utf8"));
825
+ } catch {
826
+ throw new CliError(`${CONFIG_FILE} is not valid JSON.`);
415
827
  }
416
- if (error instanceof Error) {
417
- p.cancel(error.stack);
418
- process.exit(1);
828
+ const parsed = componentsJsonSchema.safeParse(raw);
829
+ if (!parsed.success) {
830
+ const details = parsed.error.issues.map((issue) => ` ${issue.path.join(".") || "(root)"}: ${issue.message}`).join("\n");
831
+ throw new CliError(
832
+ `${CONFIG_FILE} doesn't match solidui-cli 1.x:
833
+ ${details}
834
+
835
+ Run \`${cliCommand("init --force")}\` to write it again.`
836
+ );
419
837
  }
420
- p.cancel("Something went wrong. Please try again.");
421
- process.exit(1);
838
+ const tsconfig = findAppTsConfig(cwd);
839
+ if (!tsconfig)
840
+ throw new CliError(
841
+ `No tsconfig.json in ${cwd}. solidui-cli installs TypeScript source.`
842
+ );
843
+ return { cwd, config: parsed.data, tsconfig };
422
844
  }
423
845
 
424
- // src/utils/registry.ts
425
- var BASE_URL = "https://www.solid-ui.com";
426
- var RegistryIndexSchema = array(
427
- object({
428
- name: string(),
429
- dependencies: optional(array(string())),
430
- registryDependencies: optional(array(string())),
431
- files: array(string()),
432
- type: picklist(["ui", "example"])
846
+ // ../registry/src/schema.ts
847
+ import { z as z2 } from "zod";
848
+ var registryConfigItemSchema = z2.union([
849
+ // Simple string format: "https://example.com/{name}.json"
850
+ z2.string().refine((s) => s.includes("{name}"), {
851
+ message: "Registry URL must include {name} placeholder"
852
+ }),
853
+ // Advanced object format with auth options
854
+ z2.object({
855
+ url: z2.string().refine((s) => s.includes("{name}"), {
856
+ message: "Registry URL must include {name} placeholder"
857
+ }),
858
+ params: z2.record(z2.string(), z2.string()).optional(),
859
+ headers: z2.record(z2.string(), z2.string()).optional()
860
+ })
861
+ ]);
862
+ var registryConfigSchema = z2.record(
863
+ z2.string().refine((key) => key.startsWith("@"), {
864
+ message: "Registry names must start with @ (e.g., @v0, @acme)"
865
+ }),
866
+ registryConfigItemSchema
867
+ );
868
+ var rawConfigSchema = z2.object({
869
+ $schema: z2.string().optional(),
870
+ style: z2.string(),
871
+ rsc: z2.coerce.boolean().default(false),
872
+ tsx: z2.coerce.boolean().default(true),
873
+ tailwind: z2.object({
874
+ config: z2.string().optional(),
875
+ css: z2.string(),
876
+ baseColor: z2.string(),
877
+ cssVariables: z2.boolean().default(true),
878
+ prefix: z2.string().default("").optional()
879
+ }),
880
+ iconLibrary: z2.string().optional(),
881
+ rtl: z2.coerce.boolean().default(false).optional(),
882
+ menuColor: z2.enum(["default", "inverted"]).default("default").optional(),
883
+ menuAccent: z2.enum(["subtle", "bold"]).default("subtle").optional(),
884
+ aliases: z2.object({
885
+ components: z2.string(),
886
+ utils: z2.string(),
887
+ ui: z2.string().optional(),
888
+ lib: z2.string().optional(),
889
+ hooks: z2.string().optional()
890
+ }),
891
+ registries: registryConfigSchema.optional()
892
+ }).strict();
893
+ var configSchema = rawConfigSchema.extend({
894
+ resolvedPaths: z2.object({
895
+ cwd: z2.string(),
896
+ tailwindConfig: z2.string(),
897
+ tailwindCss: z2.string(),
898
+ utils: z2.string(),
899
+ components: z2.string(),
900
+ lib: z2.string(),
901
+ hooks: z2.string(),
902
+ ui: z2.string()
903
+ })
904
+ });
905
+ var rawConfigPatchSchema = z2.object({
906
+ $schema: z2.string().optional(),
907
+ style: z2.string().optional(),
908
+ rsc: z2.coerce.boolean().optional(),
909
+ tsx: z2.coerce.boolean().optional(),
910
+ tailwind: z2.object({
911
+ config: z2.string().optional(),
912
+ css: z2.string().optional(),
913
+ baseColor: z2.string().optional(),
914
+ cssVariables: z2.boolean().optional(),
915
+ prefix: z2.string().optional()
916
+ }).optional(),
917
+ iconLibrary: z2.string().optional(),
918
+ rtl: z2.coerce.boolean().optional(),
919
+ menuColor: z2.enum(["default", "inverted"]).optional(),
920
+ menuAccent: z2.enum(["subtle", "bold"]).optional(),
921
+ aliases: z2.object({
922
+ components: z2.string().optional(),
923
+ utils: z2.string().optional(),
924
+ ui: z2.string().optional(),
925
+ lib: z2.string().optional(),
926
+ hooks: z2.string().optional()
927
+ }).optional(),
928
+ registries: registryConfigSchema.optional()
929
+ }).strict();
930
+ var workspaceConfigSchema = z2.record(z2.string(), configSchema);
931
+ var registryItemTypeSchema = z2.enum([
932
+ "registry:lib",
933
+ "registry:block",
934
+ "registry:component",
935
+ "registry:ui",
936
+ "registry:hook",
937
+ "registry:page",
938
+ "registry:file",
939
+ "registry:theme",
940
+ "registry:style",
941
+ "registry:item",
942
+ "registry:base",
943
+ "registry:font",
944
+ // Internal use only.
945
+ "registry:example",
946
+ "registry:internal"
947
+ ]);
948
+ var registryItemFileSchema = z2.discriminatedUnion("type", [
949
+ // Target is required for registry:file and registry:page
950
+ z2.object({
951
+ path: z2.string(),
952
+ content: z2.string().optional(),
953
+ type: z2.enum(["registry:file", "registry:page"]),
954
+ target: z2.string()
955
+ }),
956
+ z2.object({
957
+ path: z2.string(),
958
+ content: z2.string().optional(),
959
+ type: registryItemTypeSchema.exclude(["registry:file", "registry:page"]),
960
+ target: z2.string().optional()
961
+ })
962
+ ]);
963
+ var registryItemTailwindSchema = z2.object({
964
+ config: z2.object({
965
+ content: z2.array(z2.string()).optional(),
966
+ theme: z2.record(z2.string(), z2.unknown()).optional(),
967
+ plugins: z2.array(z2.string()).optional()
968
+ }).optional()
969
+ });
970
+ var registryItemCssVarsSchema = z2.object({
971
+ theme: z2.record(z2.string(), z2.string()).optional(),
972
+ light: z2.record(z2.string(), z2.string()).optional(),
973
+ dark: z2.record(z2.string(), z2.string()).optional()
974
+ });
975
+ var cssValueSchema = z2.lazy(
976
+ () => z2.union([
977
+ z2.string(),
978
+ z2.array(z2.union([z2.string(), z2.record(z2.string(), z2.string())])),
979
+ z2.record(z2.string(), cssValueSchema)
980
+ ])
981
+ );
982
+ var registryItemCssSchema = z2.record(z2.string(), cssValueSchema);
983
+ var registryItemEnvVarsSchema = z2.record(z2.string(), z2.string());
984
+ var registryItemFontSchema = z2.object({
985
+ family: z2.string(),
986
+ provider: z2.literal("google"),
987
+ import: z2.string(),
988
+ variable: z2.string(),
989
+ weight: z2.array(z2.string()).optional(),
990
+ subsets: z2.array(z2.string()).optional()
991
+ });
992
+ var registryItemCommonSchema = z2.object({
993
+ $schema: z2.string().optional(),
994
+ extends: z2.string().optional(),
995
+ name: z2.string(),
996
+ title: z2.string().optional(),
997
+ author: z2.string().min(2).optional(),
998
+ description: z2.string().optional(),
999
+ dependencies: z2.array(z2.string()).optional(),
1000
+ devDependencies: z2.array(z2.string()).optional(),
1001
+ registryDependencies: z2.array(z2.string()).optional(),
1002
+ files: z2.array(registryItemFileSchema).optional(),
1003
+ tailwind: registryItemTailwindSchema.optional(),
1004
+ cssVars: registryItemCssVarsSchema.optional(),
1005
+ css: registryItemCssSchema.optional(),
1006
+ envVars: registryItemEnvVarsSchema.optional(),
1007
+ meta: z2.record(z2.string(), z2.unknown()).optional(),
1008
+ docs: z2.string().optional(),
1009
+ categories: z2.array(z2.string()).optional()
1010
+ });
1011
+ var registryItemSchema = z2.discriminatedUnion("type", [
1012
+ registryItemCommonSchema.extend({
1013
+ type: z2.literal("registry:base"),
1014
+ config: rawConfigPatchSchema.optional()
1015
+ }),
1016
+ registryItemCommonSchema.extend({
1017
+ type: z2.literal("registry:font"),
1018
+ font: registryItemFontSchema
1019
+ }),
1020
+ registryItemCommonSchema.extend({
1021
+ type: registryItemTypeSchema.exclude(["registry:base", "registry:font"])
1022
+ })
1023
+ ]);
1024
+ var registrySchema = z2.object({
1025
+ name: z2.string(),
1026
+ homepage: z2.string(),
1027
+ items: z2.array(registryItemSchema)
1028
+ });
1029
+ var registryIndexSchema = z2.array(registryItemSchema);
1030
+ var stylesSchema = z2.array(
1031
+ z2.object({
1032
+ name: z2.string(),
1033
+ label: z2.string()
433
1034
  })
434
1035
  );
435
- var RegistryItemSchema = object({
436
- name: string(),
437
- dependencies: optional(array(string())),
438
- files: array(
439
- object({
440
- name: string(),
441
- content: string()
1036
+ var iconsSchema = z2.record(
1037
+ z2.string(),
1038
+ z2.record(z2.string(), z2.string())
1039
+ );
1040
+ var registryBaseColorSchema = z2.object({
1041
+ inlineColors: z2.object({
1042
+ light: z2.record(z2.string(), z2.string()),
1043
+ dark: z2.record(z2.string(), z2.string())
1044
+ }),
1045
+ cssVars: registryItemCssVarsSchema,
1046
+ cssVarsV4: registryItemCssVarsSchema.optional(),
1047
+ inlineColorsTemplate: z2.string(),
1048
+ cssVarsTemplate: z2.string()
1049
+ });
1050
+ var registryResolvedItemsTreeSchema = registryItemCommonSchema.pick({
1051
+ dependencies: true,
1052
+ devDependencies: true,
1053
+ files: true,
1054
+ tailwind: true,
1055
+ cssVars: true,
1056
+ css: true,
1057
+ envVars: true,
1058
+ docs: true
1059
+ }).extend({
1060
+ fonts: z2.array(
1061
+ registryItemCommonSchema.extend({
1062
+ type: z2.literal("registry:font"),
1063
+ font: registryItemFontSchema
442
1064
  })
443
- ),
444
- type: picklist(["ui", "example"])
1065
+ ).optional()
445
1066
  });
446
- async function fetchRegistry(paths) {
447
- try {
448
- const results = await Promise.all(
449
- paths.map(async (path5) => {
450
- const response = await fetch(`${BASE_URL}/registry/${path5}`);
451
- return await response.json();
452
- })
453
- );
454
- return results;
455
- } catch (e) {
456
- console.log(e);
457
- throw new Error(`Failed to fetch registry from ${BASE_URL}.`);
458
- }
459
- }
460
- async function getRegistryIndex() {
461
- try {
462
- const [result] = await fetchRegistry(["index.json"]);
463
- return parse(RegistryIndexSchema, result).filter((item) => item.type === "ui");
464
- } catch (e) {
465
- throw new Error(`Failed to fetch components from registry.`);
466
- }
1067
+ var searchResultItemSchema = z2.object({
1068
+ name: z2.string(),
1069
+ type: z2.string().optional(),
1070
+ description: z2.string().optional(),
1071
+ registry: z2.string(),
1072
+ addCommandArgument: z2.string()
1073
+ });
1074
+ var searchResultsSchema = z2.object({
1075
+ pagination: z2.object({
1076
+ total: z2.number(),
1077
+ offset: z2.number(),
1078
+ limit: z2.number(),
1079
+ hasMore: z2.boolean()
1080
+ }),
1081
+ items: z2.array(searchResultItemSchema)
1082
+ });
1083
+ var registriesIndexSchema = z2.record(
1084
+ z2.string().regex(/^@[a-zA-Z0-9][a-zA-Z0-9-_]*$/),
1085
+ z2.string()
1086
+ );
1087
+ var registriesSchema = z2.array(
1088
+ z2.object({
1089
+ name: z2.string(),
1090
+ homepage: z2.string().optional(),
1091
+ url: z2.string(),
1092
+ description: z2.string().optional()
1093
+ })
1094
+ );
1095
+ var presetSchema = z2.object({
1096
+ name: z2.string(),
1097
+ title: z2.string(),
1098
+ description: z2.string(),
1099
+ base: z2.string(),
1100
+ style: z2.string(),
1101
+ baseColor: z2.string(),
1102
+ theme: z2.string(),
1103
+ iconLibrary: z2.string(),
1104
+ font: z2.string(),
1105
+ rtl: z2.coerce.boolean().default(false),
1106
+ menuAccent: z2.enum(["subtle", "bold"]),
1107
+ menuColor: z2.enum(["default", "inverted"]),
1108
+ radius: z2.string()
1109
+ });
1110
+ var configJsonSchema = z2.object({
1111
+ presets: z2.array(presetSchema)
1112
+ });
1113
+
1114
+ // src/registry/client.ts
1115
+ function registryBaseUrl(env = process.env) {
1116
+ return (env.SOLID_UI_REGISTRY_URL?.trim() || SOLID_UI_URL).replace(/\/+$/, "");
467
1117
  }
468
- async function resolveTree(index, names) {
469
- const tree = [];
470
- for (const name of names) {
471
- const entry = index.find((entry2) => entry2.name === name);
472
- if (!entry) {
473
- continue;
1118
+ function createRegistryClient(baseUrl = registryBaseUrl(), fetchImpl = (url) => fetch(url)) {
1119
+ const cache = /* @__PURE__ */ new Map();
1120
+ async function load(path12) {
1121
+ const url = `${baseUrl}/r/${path12}`;
1122
+ let response;
1123
+ try {
1124
+ response = await fetchImpl(url);
1125
+ } catch (error) {
1126
+ throw new CliError(
1127
+ `Could not reach the registry at ${url}.
1128
+ ${error instanceof Error ? error.message : String(error)}`
1129
+ );
1130
+ }
1131
+ if (response.status === 404) return null;
1132
+ if (!response.ok) {
1133
+ throw new CliError(
1134
+ `The registry at ${url} responded with ${response.status} ${response.statusText}.`
1135
+ );
474
1136
  }
475
- tree.push(entry);
476
- if (entry.registryDependencies) {
477
- const dependencies = await resolveTree(index, entry.registryDependencies);
478
- tree.push(...dependencies);
1137
+ try {
1138
+ return await response.json();
1139
+ } catch {
1140
+ throw new CliError(
1141
+ `The registry at ${url} did not return JSON. A preview deploy behind Vercel Deployment Protection answers with a login page.`
1142
+ );
479
1143
  }
480
1144
  }
481
- return tree.filter(
482
- (component, idx, self) => self.findIndex((c) => c.name === component.name) === idx
483
- );
484
- }
485
- async function fetchTree(tree) {
486
- try {
487
- const paths = tree.map((item) => `ui/${item.name}.json`);
488
- const results = await fetchRegistry(paths);
489
- return parse(array(RegistryItemSchema), results);
490
- } catch (e) {
491
- throw new Error(`Failed to fetch components from registry.`);
1145
+ async function get(path12, schema) {
1146
+ let pending = cache.get(path12);
1147
+ if (!pending) {
1148
+ pending = load(path12);
1149
+ cache.set(path12, pending);
1150
+ }
1151
+ const data = await pending;
1152
+ if (data === null) return null;
1153
+ const parsed = schema.safeParse(data);
1154
+ if (!parsed.success) {
1155
+ throw new CliError(
1156
+ `The registry at ${baseUrl}/r/${path12} returned an unexpected format.
1157
+ ${parsed.error.message}`
1158
+ );
1159
+ }
1160
+ return parsed.data;
492
1161
  }
1162
+ return {
1163
+ baseUrl,
1164
+ async catalog(style2) {
1165
+ const catalog = await get(`styles/${style2}/registry.json`, registrySchema);
1166
+ if (!catalog)
1167
+ throw new CliError(`The registry has no style named ${style2}.`);
1168
+ return catalog;
1169
+ },
1170
+ async item(style2, name) {
1171
+ return get(`styles/${style2}/${name}.json`, registryItemSchema);
1172
+ }
1173
+ };
493
1174
  }
494
1175
 
495
- // src/utils/transformers/index.ts
496
- import { mkdtemp } from "node:fs/promises";
497
- import { tmpdir } from "node:os";
498
- import path2 from "node:path";
499
- import { Project, ScriptKind } from "ts-morph";
500
-
501
- // src/utils/transformers/transform-import.ts
502
- var transformImport = async ({ sourceFile, config }) => {
503
- const importDeclarations = sourceFile.getImportDeclarations();
504
- for (const importDeclaration of importDeclarations) {
505
- const moduleSpecifier = importDeclaration.getModuleSpecifierValue();
506
- if (moduleSpecifier.startsWith("~/registry/")) {
507
- importDeclaration.setModuleSpecifier(
508
- moduleSpecifier.replace(/^~\/registry\/ui/, config.aliases.components)
509
- );
510
- } else if (moduleSpecifier === "~/lib/utils") {
511
- importDeclaration.setModuleSpecifier(
512
- moduleSpecifier.replace(/^~\/lib\/utils/, config.aliases.utils)
1176
+ // src/registry/resolve.ts
1177
+ var PROVIDED_BY_INIT = /* @__PURE__ */ new Set(["style-utilities"]);
1178
+ var INSTALLABLE = /* @__PURE__ */ new Set([
1179
+ "registry:ui",
1180
+ "registry:lib",
1181
+ "registry:hook",
1182
+ "registry:component",
1183
+ "registry:block"
1184
+ ]);
1185
+ function installableItems(catalog) {
1186
+ return catalog.items.filter(
1187
+ (item) => INSTALLABLE.has(item.type) && !PROVIDED_BY_INIT.has(item.name)
1188
+ );
1189
+ }
1190
+ function distance(a, b) {
1191
+ const row = Array.from({ length: b.length + 1 }, (_, index) => index);
1192
+ for (let i = 1; i <= a.length; i++) {
1193
+ let previous = row[0];
1194
+ row[0] = i;
1195
+ for (let j = 1; j <= b.length; j++) {
1196
+ const current = row[j];
1197
+ row[j] = Math.min(
1198
+ row[j] + 1,
1199
+ row[j - 1] + 1,
1200
+ previous + (a[i - 1] === b[j - 1] ? 0 : 1)
513
1201
  );
1202
+ previous = current;
514
1203
  }
515
1204
  }
516
- return sourceFile;
517
- };
1205
+ return row[b.length];
1206
+ }
1207
+ function suggest(name, names) {
1208
+ return names.map((candidate) => ({
1209
+ candidate,
1210
+ score: candidate.includes(name) || name.includes(candidate) ? 0 : distance(name, candidate)
1211
+ })).filter(({ score }) => score <= 3).sort((a, b) => a.score - b.score || a.candidate.localeCompare(b.candidate)).slice(0, 3).map(({ candidate }) => candidate);
1212
+ }
1213
+ function resolveTree(catalog, names) {
1214
+ const byName = new Map(
1215
+ installableItems(catalog).map((item) => [item.name, item])
1216
+ );
1217
+ const unknown = names.filter((name) => !byName.has(name));
1218
+ if (unknown.length) {
1219
+ const lines = unknown.map((name) => {
1220
+ const close = suggest(name, [...byName.keys()]);
1221
+ return close.length ? ` ${name} (did you mean ${close.join(", ")}?)` : ` ${name}`;
1222
+ });
1223
+ throw new CliError(
1224
+ `The registry has no installable item named:
1225
+ ${lines.join("\n")}`
1226
+ );
1227
+ }
1228
+ const ordered = [];
1229
+ const done = /* @__PURE__ */ new Set();
1230
+ const visiting = /* @__PURE__ */ new Set();
1231
+ const visit = (name) => {
1232
+ if (done.has(name) || PROVIDED_BY_INIT.has(name)) return;
1233
+ if (visiting.has(name))
1234
+ throw new CliError(`The registry has a dependency cycle at ${name}.`);
1235
+ const item = byName.get(name);
1236
+ if (!item) throw new CliError(`${name} depends on a missing item.`);
1237
+ visiting.add(name);
1238
+ for (const dependency of item.registryDependencies ?? []) visit(dependency);
1239
+ visiting.delete(name);
1240
+ done.add(name);
1241
+ ordered.push(item);
1242
+ };
1243
+ for (const name of names) visit(name);
1244
+ return ordered;
1245
+ }
518
1246
 
519
- // src/utils/transformers/transform-jsx.ts
520
- import { transformFromAstSync } from "@babel/core";
521
- import { parse as parse2 } from "@babel/parser";
522
- import transformTypescript from "@babel/plugin-transform-typescript";
523
- import * as recast from "recast";
524
- var PARSE_OPTIONS = {
525
- sourceType: "module",
526
- allowImportExportEverywhere: true,
527
- allowReturnOutsideFunction: true,
528
- startLine: 1,
529
- tokens: true,
530
- plugins: [
531
- "asyncGenerators",
532
- "bigInt",
533
- "classPrivateMethods",
534
- "classPrivateProperties",
535
- "classProperties",
536
- "classStaticBlock",
537
- "decimal",
538
- "decorators-legacy",
539
- "doExpressions",
540
- "dynamicImport",
541
- "exportDefaultFrom",
542
- "exportNamespaceFrom",
543
- "functionBind",
544
- "functionSent",
545
- "importAssertions",
546
- "importMeta",
547
- "nullishCoalescingOperator",
548
- "numericSeparator",
549
- "objectRestSpread",
550
- "optionalCatchBinding",
551
- "optionalChaining",
552
- [
553
- "pipelineOperator",
554
- {
555
- proposal: "minimal"
556
- }
557
- ],
558
- [
559
- "recordAndTuple",
560
- {
561
- syntaxType: "hash"
562
- }
563
- ],
564
- "throwExpressions",
565
- "topLevelAwait",
566
- "v8intrinsic",
567
- "typescript",
568
- "jsx"
569
- ]
570
- };
571
- var transformJsx = async ({ sourceFile, config }) => {
572
- const output = sourceFile.getFullText();
573
- if (config.tsx) {
574
- return output;
1247
+ // src/utils/ui.ts
1248
+ import * as p from "@clack/prompts";
1249
+ function cancelled(value) {
1250
+ if (p.isCancel(value)) {
1251
+ p.cancel("Cancelled.");
1252
+ throw new CliError("Cancelled.", 0);
575
1253
  }
576
- const ast = recast.parse(output, {
577
- parser: {
578
- parse: (code) => {
579
- return parse2(code, PARSE_OPTIONS);
580
- }
1254
+ return value;
1255
+ }
1256
+ var terminalUi = {
1257
+ // A blank line, then the badge, as create-solid prints it.
1258
+ intro: (title) => p.intro(`
1259
+ ${title}`),
1260
+ outro: (message) => p.outro(message),
1261
+ info: (message) => p.log.info(message),
1262
+ success: (message) => p.log.success(message),
1263
+ warn: (message) => p.log.warn(message),
1264
+ error: (message) => p.log.error(message),
1265
+ note: (message, title) => p.note(message, title),
1266
+ select: async (message, options, initial) => cancelled(
1267
+ await p.select({
1268
+ message,
1269
+ options,
1270
+ initialValue: initial
1271
+ })
1272
+ ),
1273
+ multiselect: async (message, options) => cancelled(
1274
+ await p.multiselect({
1275
+ message,
1276
+ options,
1277
+ required: false
1278
+ })
1279
+ ),
1280
+ text: async (message, initial, validate) => cancelled(
1281
+ await p.text({
1282
+ message,
1283
+ initialValue: initial,
1284
+ ...validate ? { validate: (value) => validate(value ?? "") } : {}
1285
+ })
1286
+ ),
1287
+ confirm: async (message, initial = true) => cancelled(await p.confirm({ message, initialValue: initial })),
1288
+ task: async (message, run, done) => {
1289
+ const spinner2 = p.spinner();
1290
+ spinner2.start(message);
1291
+ try {
1292
+ const result = await run();
1293
+ spinner2.stop(done ?? message);
1294
+ return result;
1295
+ } catch (error) {
1296
+ spinner2.stop(`${message} failed.`);
1297
+ throw error;
581
1298
  }
582
- });
583
- const result = transformFromAstSync(ast, output, {
584
- cloneInputAst: false,
585
- code: false,
586
- ast: true,
587
- plugins: [transformTypescript],
588
- configFile: false
589
- });
590
- if (!result || !result.ast) {
591
- throw new Error("Failed to transform JSX");
592
1299
  }
593
- return recast.print(result.ast).code;
594
1300
  };
595
1301
 
596
- // src/utils/transformers/transform-tw-prefix.ts
597
- import { SyntaxKind } from "ts-morph";
598
- var transformTwPrefix = async ({ sourceFile, config }) => {
599
- if (!config.tailwind.prefix) {
600
- return sourceFile;
601
- }
602
- sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression).filter((node) => node.getExpression().getText() === "cva").forEach((node) => {
603
- if (node.getArguments()[0]?.isKind(SyntaxKind.StringLiteral)) {
604
- const defaultClassNames = node.getArguments()[0];
605
- if (defaultClassNames) {
606
- defaultClassNames.replaceWithText(
607
- `"${applyPrefix(defaultClassNames.getText()?.replace(/"/g, ""), config.tailwind.prefix)}"`
608
- );
609
- }
610
- }
611
- if (node.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)) {
612
- node.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find((node2) => node2.getName() === "variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach((node2) => {
613
- node2.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach((node3) => {
614
- const classNames = node3.getInitializerIfKind(SyntaxKind.StringLiteral);
615
- if (classNames) {
616
- classNames?.replaceWithText(
617
- `"${applyPrefix(classNames.getText()?.replace(/"/g, ""), config.tailwind.prefix)}"`
618
- );
619
- }
620
- });
621
- });
622
- }
1302
+ // src/commands/add.ts
1303
+ function anchorNotes(specs) {
1304
+ return specs.flatMap((spec2) => {
1305
+ const { name, range } = parseSpec(spec2);
1306
+ const anchor = name.startsWith("@ui-sdk/") ? supportedRange(name) : void 0;
1307
+ return anchor && range && anchor !== range ? [
1308
+ `The registry uses ${name} ${range}; ${CLI_NAME} ${CLI_VERSION} was tested with ${anchor}. Update with: ${color.command(cliCommand(""))}`
1309
+ ] : [];
623
1310
  });
624
- sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute).forEach((node) => {
625
- if (node.getName() === "class") {
626
- if (node.getInitializer()?.isKind(SyntaxKind.StringLiteral)) {
627
- const value = node.getInitializer();
628
- if (value) {
629
- value.replaceWithText(
630
- `"${applyPrefix(value.getText()?.replace(/"/g, ""), config.tailwind.prefix)}"`
631
- );
632
- }
633
- }
634
- if (node.getInitializer()?.isKind(SyntaxKind.JsxExpression)) {
635
- const callExpression = node.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find((node2) => node2.getExpression().getText() === "cn");
636
- if (callExpression) {
637
- callExpression.getArguments().forEach((node2) => {
638
- if (node2.isKind(SyntaxKind.ConditionalExpression) || node2.isKind(SyntaxKind.BinaryExpression)) {
639
- node2.getChildrenOfKind(SyntaxKind.StringLiteral).forEach((node3) => {
640
- node3.replaceWithText(
641
- `"${applyPrefix(node3.getText()?.replace(/"/g, ""), config.tailwind.prefix)}"`
642
- );
643
- });
644
- }
645
- if (node2.isKind(SyntaxKind.StringLiteral)) {
646
- node2.replaceWithText(
647
- `"${applyPrefix(node2.getText()?.replace(/"/g, ""), config.tailwind.prefix)}"`
648
- );
649
- }
650
- });
651
- }
652
- }
653
- }
654
- });
655
- return sourceFile;
656
- };
657
- function applyPrefix(input, prefix = "") {
658
- const classNames = input.split(" ");
659
- const prefixed = [];
660
- for (const className of classNames) {
661
- const [variant, value, modifier] = splitClassName(className);
662
- if (variant) {
663
- modifier ? prefixed.push(`${variant}:${prefix}${value}/${modifier}`) : prefixed.push(`${variant}:${prefix}${value}`);
664
- } else {
665
- modifier ? prefixed.push(`${prefix}${value}/${modifier}`) : prefixed.push(`${prefix}${value}`);
666
- }
667
- }
668
- return prefixed.join(" ");
669
1311
  }
670
- function splitClassName(className) {
671
- if (!className.includes("/") && !className.includes(":")) {
672
- return [null, className, null];
1312
+ async function chooseItems(names, options, catalogNames, ui, interactive) {
1313
+ if (options.all) return catalogNames;
1314
+ if (names.length) return names;
1315
+ if (!interactive)
1316
+ throw new CliError(
1317
+ `Name the components to add, for example: ${color.command(cliCommand("add button"))}`
1318
+ );
1319
+ return ui.multiselect(
1320
+ "Which components would you like to add?",
1321
+ catalogNames.map((name) => ({ value: name, label: name }))
1322
+ );
1323
+ }
1324
+ async function runAdd(names, options, deps = {}) {
1325
+ const ui = deps.ui ?? terminalUi;
1326
+ const interactive = deps.interactive ?? Boolean(process.stdin.isTTY);
1327
+ const install = deps.install ?? installPackages;
1328
+ const cwd = path7.resolve(options.cwd);
1329
+ ui.intro(badge());
1330
+ const project = runAddPreflight(cwd);
1331
+ const { config } = project;
1332
+ const client = deps.client ?? createRegistryClient();
1333
+ const catalog = await ui.task(
1334
+ `Loading the ${config.style} catalog from ${client.baseUrl}`,
1335
+ () => client.catalog(config.style),
1336
+ `Loaded the ${config.style} catalog.`
1337
+ );
1338
+ const components = installableItems(catalog).filter((item) => item.type === "registry:ui").map((item) => item.name);
1339
+ const selected = await chooseItems(
1340
+ names,
1341
+ options,
1342
+ components,
1343
+ ui,
1344
+ interactive
1345
+ );
1346
+ if (!selected.length) {
1347
+ ui.outro("No components selected.");
1348
+ return;
673
1349
  }
674
- const parts = [];
675
- const [rest, alpha] = className.split("/");
676
- if (!rest?.includes(":")) {
677
- return [null, rest, alpha];
1350
+ const tree = resolveTree(catalog, selected);
1351
+ const items = await ui.task(
1352
+ `Loading ${tree.length} ${tree.length === 1 ? "item" : "items"}`,
1353
+ () => Promise.all(
1354
+ tree.map(async ({ name }) => {
1355
+ const item = await client.item(config.style, name);
1356
+ if (!item)
1357
+ throw new CliError(
1358
+ `The registry lists ${name} for ${config.style} but doesn't serve it.`
1359
+ );
1360
+ return item;
1361
+ })
1362
+ ),
1363
+ `Loaded ${tree.map(({ name }) => name).join(", ")}.`
1364
+ );
1365
+ const files = items.flatMap(
1366
+ (item) => (item.files ?? []).map((file) => {
1367
+ if (file.content === void 0)
1368
+ throw new CliError(`${item.name} has no content for ${file.path}.`);
1369
+ return {
1370
+ path: resolveTargetPath(file, config, project.tsconfig, cwd),
1371
+ content: transformSource(file.path, file.content, config)
1372
+ };
1373
+ })
1374
+ );
1375
+ const written = await applyFiles(files, cwd, ui, {
1376
+ overwrite: options.overwrite,
1377
+ confirm: async (file) => interactive && !options.yes && ui.confirm(`${file} already exists and differs. Overwrite it?`, false)
1378
+ });
1379
+ const specs = items.flatMap((item) => item.dependencies ?? []);
1380
+ for (const note2 of anchorNotes(specs)) ui.info(note2);
1381
+ const plan = planDependencies(cwd, readPackageJson(cwd) ?? {}, specs);
1382
+ const installs = await resolveConflicts(plan, ui, {
1383
+ ask: interactive && !options.yes,
1384
+ yes: options.yes
1385
+ });
1386
+ if (installs.length) {
1387
+ const agent = detectAgent(cwd);
1388
+ await ui.task(
1389
+ `Installing ${installs.length} packages with ${agent}`,
1390
+ () => install(cwd, installs, { agent }),
1391
+ installedMessage(
1392
+ installs.map((entry) => parseSpec(entry).name),
1393
+ agent
1394
+ )
1395
+ );
678
1396
  }
679
- const split = rest?.split(":");
680
- const name = split.pop();
681
- const variant = split.join(":");
682
- parts.push(variant ?? null, name ?? null, alpha ?? null);
683
- return parts;
1397
+ for (const file of written.kept)
1398
+ ui.info(
1399
+ `${color.kept("Kept")} ${file} ${color.muted("(yours differs from the registry)")}`
1400
+ );
1401
+ if (written.kept.length && !options.overwrite)
1402
+ ui.info(
1403
+ `Run add with ${color.command("--overwrite")} to replace files that differ.`
1404
+ );
1405
+ ui.outro(
1406
+ written.written.length || installs.length ? `Added ${selected.join(", ")}.` : `${selected.join(", ")} ${selected.length === 1 ? "is" : "are"} already up to date.`
1407
+ );
684
1408
  }
685
-
686
- // src/utils/transformers/index.ts
687
- var project = new Project({
688
- compilerOptions: {}
1409
+ var add = new Command().name("add").description("add components to your project").argument("[components...]", "the components to add").option(
1410
+ "-c, --cwd <dir>",
1411
+ "the project directory (default: current directory)"
1412
+ ).option("-o, --overwrite", "replace files that differ", false).option("-y, --yes", "skip the prompts; keep files that differ", false).option("-a, --all", "add every component", false).action(async (components, options) => {
1413
+ await runAdd(components, {
1414
+ ...options,
1415
+ cwd: options.cwd ?? process.cwd()
1416
+ });
689
1417
  });
690
- async function createTempSourceFile(filename) {
691
- const dir = await mkdtemp(path2.join(tmpdir(), "solidui-"));
692
- return path2.join(dir, filename);
1418
+
1419
+ // src/commands/init.ts
1420
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "fs";
1421
+ import path11 from "path";
1422
+
1423
+ // ../registry/src/theme/fonts.ts
1424
+ var fontFamilies = {
1425
+ inter: "Inter Variable",
1426
+ "noto-sans": "Noto Sans Variable",
1427
+ "nunito-sans": "Nunito Sans Variable",
1428
+ figtree: "Figtree Variable",
1429
+ roboto: "Roboto Variable",
1430
+ raleway: "Raleway Variable",
1431
+ "dm-sans": "DM Sans Variable",
1432
+ "public-sans": "Public Sans Variable",
1433
+ outfit: "Outfit Variable",
1434
+ "jetbrains-mono": "JetBrains Mono Variable",
1435
+ geist: "Geist Variable",
1436
+ "geist-mono": "Geist Mono Variable",
1437
+ lora: "Lora Variable",
1438
+ merriweather: "Merriweather Variable",
1439
+ "playfair-display": "Playfair Display Variable",
1440
+ "noto-serif": "Noto Serif Variable",
1441
+ "roboto-slab": "Roboto Slab Variable",
1442
+ oxanium: "Oxanium Variable",
1443
+ manrope: "Manrope Variable",
1444
+ "space-grotesk": "Space Grotesk Variable",
1445
+ montserrat: "Montserrat Variable",
1446
+ "ibm-plex-sans": "IBM Plex Sans Variable",
1447
+ "source-sans-3": "Source Sans 3 Variable",
1448
+ "instrument-sans": "Instrument Sans Variable",
1449
+ "eb-garamond": "EB Garamond Variable",
1450
+ "instrument-serif": "Instrument Serif"
1451
+ };
1452
+ var monoFonts = /* @__PURE__ */ new Set(["geist-mono", "jetbrains-mono"]);
1453
+ var serifFonts = /* @__PURE__ */ new Set([
1454
+ "noto-serif",
1455
+ "roboto-slab",
1456
+ "merriweather",
1457
+ "lora",
1458
+ "playfair-display",
1459
+ "eb-garamond",
1460
+ "instrument-serif"
1461
+ ]);
1462
+ var fallbacks = {
1463
+ sans: "ui-sans-serif, system-ui, sans-serif",
1464
+ serif: "ui-serif, Georgia, serif",
1465
+ mono: "ui-monospace, SFMono-Regular, Menlo, monospace"
1466
+ };
1467
+ function fontCategory(font) {
1468
+ return monoFonts.has(font) ? "mono" : serifFonts.has(font) ? "serif" : "sans";
1469
+ }
1470
+ function fontPackage(font) {
1471
+ return font === "instrument-serif" ? "@fontsource/instrument-serif" : `@fontsource-variable/${font}`;
693
1472
  }
694
- async function transform(props) {
695
- const tempFile = await createTempSourceFile(props.filename);
696
- const sourceFile = project.createSourceFile(tempFile, props.raw, { scriptKind: ScriptKind.TSX });
697
- transformImport({ sourceFile, ...props });
698
- transformTwPrefix({ sourceFile, ...props });
699
- return await transformJsx({ sourceFile, ...props });
1473
+ function fontStack(font) {
1474
+ return `"${fontFamilies[font]}", ${fallbacks[fontCategory(font)]}`;
1475
+ }
1476
+ function presetFonts(preset) {
1477
+ return preset.fontHeading === "inherit" || preset.fontHeading === preset.font ? [preset.font] : [preset.font, preset.fontHeading];
700
1478
  }
701
1479
 
702
- // src/commands/add.ts
703
- var addOptionsSchema = object({
704
- components: optional(array(string()), []),
705
- cwd: string(),
706
- overwrite: boolean(),
707
- all: boolean()
708
- });
709
- var add = new Command().name("add").description("add components to your project").argument("[components...]", "the components to add").option("-c, --cwd <cwd>", "the working directory", process.cwd()).option("-o --overwrite", "overwrite existing files", false).option("-a, --all", "add all available components", false).action(async (components, opts) => {
710
- try {
711
- const options = parse(addOptionsSchema, { components, ...opts });
712
- const cwd = path3.resolve(options.cwd);
713
- if (!existsSync2(cwd)) {
714
- throw new Error(`The path ${cwd} does not exist. Please try again.`);
1480
+ // ../registry/src/preset/normalize.ts
1481
+ function isCompatiblePresetColor(name, base2) {
1482
+ return name !== "gray" && (name === base2 || !baseColors.some((color2) => color2 === name));
1483
+ }
1484
+ function normalizePreset(preset) {
1485
+ const baseColor = preset.baseColor === "gray" ? "neutral" : preset.baseColor;
1486
+ return {
1487
+ ...preset,
1488
+ baseColor,
1489
+ theme: isCompatiblePresetColor(preset.theme, baseColor) ? preset.theme : baseColor,
1490
+ chartColor: isCompatiblePresetColor(preset.chartColor, baseColor) ? preset.chartColor : baseColor,
1491
+ radius: preset.style === "lyra" || preset.style === "sera" ? "none" : preset.style === "rhea" && preset.radius === "large" ? "default" : preset.radius,
1492
+ menuAccent: preset.menuColor.endsWith("translucent") ? "subtle" : preset.menuAccent
1493
+ };
1494
+ }
1495
+
1496
+ // ../registry/src/theme/palettes.json
1497
+ var palettes_default = {
1498
+ neutral: {
1499
+ light: {
1500
+ background: "oklch(1 0 0)",
1501
+ foreground: "oklch(0.145 0 0)",
1502
+ card: "oklch(1 0 0)",
1503
+ "card-foreground": "oklch(0.145 0 0)",
1504
+ popover: "oklch(1 0 0)",
1505
+ "popover-foreground": "oklch(0.145 0 0)",
1506
+ primary: "oklch(0.205 0 0)",
1507
+ "primary-foreground": "oklch(0.985 0 0)",
1508
+ secondary: "oklch(0.97 0 0)",
1509
+ "secondary-foreground": "oklch(0.205 0 0)",
1510
+ muted: "oklch(0.97 0 0)",
1511
+ "muted-foreground": "oklch(0.556 0 0)",
1512
+ accent: "oklch(0.97 0 0)",
1513
+ "accent-foreground": "oklch(0.205 0 0)",
1514
+ destructive: "oklch(0.577 0.245 27.325)",
1515
+ border: "oklch(0.922 0 0)",
1516
+ input: "oklch(0.922 0 0)",
1517
+ ring: "oklch(0.708 0 0)",
1518
+ "chart-1": "oklch(0.87 0 0)",
1519
+ "chart-2": "oklch(0.556 0 0)",
1520
+ "chart-3": "oklch(0.439 0 0)",
1521
+ "chart-4": "oklch(0.371 0 0)",
1522
+ "chart-5": "oklch(0.269 0 0)",
1523
+ radius: "0.625rem",
1524
+ sidebar: "oklch(0.985 0 0)",
1525
+ "sidebar-foreground": "oklch(0.145 0 0)",
1526
+ "sidebar-primary": "oklch(0.205 0 0)",
1527
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
1528
+ "sidebar-accent": "oklch(0.97 0 0)",
1529
+ "sidebar-accent-foreground": "oklch(0.205 0 0)",
1530
+ "sidebar-border": "oklch(0.922 0 0)",
1531
+ "sidebar-ring": "oklch(0.708 0 0)"
1532
+ },
1533
+ dark: {
1534
+ background: "oklch(0.145 0 0)",
1535
+ foreground: "oklch(0.985 0 0)",
1536
+ card: "oklch(0.205 0 0)",
1537
+ "card-foreground": "oklch(0.985 0 0)",
1538
+ popover: "oklch(0.205 0 0)",
1539
+ "popover-foreground": "oklch(0.985 0 0)",
1540
+ primary: "oklch(0.922 0 0)",
1541
+ "primary-foreground": "oklch(0.205 0 0)",
1542
+ secondary: "oklch(0.269 0 0)",
1543
+ "secondary-foreground": "oklch(0.985 0 0)",
1544
+ muted: "oklch(0.269 0 0)",
1545
+ "muted-foreground": "oklch(0.708 0 0)",
1546
+ accent: "oklch(0.269 0 0)",
1547
+ "accent-foreground": "oklch(0.985 0 0)",
1548
+ destructive: "oklch(0.704 0.191 22.216)",
1549
+ border: "oklch(1 0 0 / 10%)",
1550
+ input: "oklch(1 0 0 / 15%)",
1551
+ ring: "oklch(0.556 0 0)",
1552
+ "chart-1": "oklch(0.87 0 0)",
1553
+ "chart-2": "oklch(0.556 0 0)",
1554
+ "chart-3": "oklch(0.439 0 0)",
1555
+ "chart-4": "oklch(0.371 0 0)",
1556
+ "chart-5": "oklch(0.269 0 0)",
1557
+ sidebar: "oklch(0.205 0 0)",
1558
+ "sidebar-foreground": "oklch(0.985 0 0)",
1559
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1560
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
1561
+ "sidebar-accent": "oklch(0.269 0 0)",
1562
+ "sidebar-accent-foreground": "oklch(0.985 0 0)",
1563
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1564
+ "sidebar-ring": "oklch(0.556 0 0)"
715
1565
  }
716
- const config = await getConfig(cwd);
717
- if (!config) {
718
- p2.log.warning(
719
- `Configuration is missing. Please run ${highlight(`init`)} to create a components.json file.`
720
- );
721
- process.exit(1);
1566
+ },
1567
+ stone: {
1568
+ light: {
1569
+ background: "oklch(1 0 0)",
1570
+ foreground: "oklch(0.147 0.004 49.25)",
1571
+ card: "oklch(1 0 0)",
1572
+ "card-foreground": "oklch(0.147 0.004 49.25)",
1573
+ popover: "oklch(1 0 0)",
1574
+ "popover-foreground": "oklch(0.147 0.004 49.25)",
1575
+ primary: "oklch(0.216 0.006 56.043)",
1576
+ "primary-foreground": "oklch(0.985 0.001 106.423)",
1577
+ secondary: "oklch(0.97 0.001 106.424)",
1578
+ "secondary-foreground": "oklch(0.216 0.006 56.043)",
1579
+ muted: "oklch(0.97 0.001 106.424)",
1580
+ "muted-foreground": "oklch(0.553 0.013 58.071)",
1581
+ accent: "oklch(0.97 0.001 106.424)",
1582
+ "accent-foreground": "oklch(0.216 0.006 56.043)",
1583
+ destructive: "oklch(0.577 0.245 27.325)",
1584
+ border: "oklch(0.923 0.003 48.717)",
1585
+ input: "oklch(0.923 0.003 48.717)",
1586
+ ring: "oklch(0.709 0.01 56.259)",
1587
+ "chart-1": "oklch(0.869 0.005 56.366)",
1588
+ "chart-2": "oklch(0.553 0.013 58.071)",
1589
+ "chart-3": "oklch(0.444 0.011 73.639)",
1590
+ "chart-4": "oklch(0.374 0.01 67.558)",
1591
+ "chart-5": "oklch(0.268 0.007 34.298)",
1592
+ radius: "0.625rem",
1593
+ sidebar: "oklch(0.985 0.001 106.423)",
1594
+ "sidebar-foreground": "oklch(0.147 0.004 49.25)",
1595
+ "sidebar-primary": "oklch(0.216 0.006 56.043)",
1596
+ "sidebar-primary-foreground": "oklch(0.985 0.001 106.423)",
1597
+ "sidebar-accent": "oklch(0.97 0.001 106.424)",
1598
+ "sidebar-accent-foreground": "oklch(0.216 0.006 56.043)",
1599
+ "sidebar-border": "oklch(0.923 0.003 48.717)",
1600
+ "sidebar-ring": "oklch(0.709 0.01 56.259)"
1601
+ },
1602
+ dark: {
1603
+ background: "oklch(0.147 0.004 49.25)",
1604
+ foreground: "oklch(0.985 0.001 106.423)",
1605
+ card: "oklch(0.216 0.006 56.043)",
1606
+ "card-foreground": "oklch(0.985 0.001 106.423)",
1607
+ popover: "oklch(0.216 0.006 56.043)",
1608
+ "popover-foreground": "oklch(0.985 0.001 106.423)",
1609
+ primary: "oklch(0.923 0.003 48.717)",
1610
+ "primary-foreground": "oklch(0.216 0.006 56.043)",
1611
+ secondary: "oklch(0.268 0.007 34.298)",
1612
+ "secondary-foreground": "oklch(0.985 0.001 106.423)",
1613
+ muted: "oklch(0.268 0.007 34.298)",
1614
+ "muted-foreground": "oklch(0.709 0.01 56.259)",
1615
+ accent: "oklch(0.268 0.007 34.298)",
1616
+ "accent-foreground": "oklch(0.985 0.001 106.423)",
1617
+ destructive: "oklch(0.704 0.191 22.216)",
1618
+ border: "oklch(1 0 0 / 10%)",
1619
+ input: "oklch(1 0 0 / 15%)",
1620
+ ring: "oklch(0.553 0.013 58.071)",
1621
+ "chart-1": "oklch(0.869 0.005 56.366)",
1622
+ "chart-2": "oklch(0.553 0.013 58.071)",
1623
+ "chart-3": "oklch(0.444 0.011 73.639)",
1624
+ "chart-4": "oklch(0.374 0.01 67.558)",
1625
+ "chart-5": "oklch(0.268 0.007 34.298)",
1626
+ sidebar: "oklch(0.216 0.006 56.043)",
1627
+ "sidebar-foreground": "oklch(0.985 0.001 106.423)",
1628
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1629
+ "sidebar-primary-foreground": "oklch(0.985 0.001 106.423)",
1630
+ "sidebar-accent": "oklch(0.268 0.007 34.298)",
1631
+ "sidebar-accent-foreground": "oklch(0.985 0.001 106.423)",
1632
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1633
+ "sidebar-ring": "oklch(0.553 0.013 58.071)"
722
1634
  }
723
- const registryIndex = await getRegistryIndex();
724
- let selectedComponents = options.all ? registryIndex.map((v) => v.name) : options.components;
725
- if (!selectedComponents.length) {
726
- const prompts = await p2.group(
727
- {
728
- components: () => p2.multiselect({
729
- message: `Which ${highlight("components")} would you like to add?`,
730
- options: registryIndex.map((v) => ({ label: v.name, value: v.name }))
731
- })
732
- },
733
- {
734
- onCancel: () => {
735
- p2.cancel("Cancelled.");
736
- process.exit(0);
737
- }
738
- }
739
- );
740
- selectedComponents = prompts.components;
1635
+ },
1636
+ zinc: {
1637
+ light: {
1638
+ background: "oklch(1 0 0)",
1639
+ foreground: "oklch(0.141 0.005 285.823)",
1640
+ card: "oklch(1 0 0)",
1641
+ "card-foreground": "oklch(0.141 0.005 285.823)",
1642
+ popover: "oklch(1 0 0)",
1643
+ "popover-foreground": "oklch(0.141 0.005 285.823)",
1644
+ primary: "oklch(0.21 0.006 285.885)",
1645
+ "primary-foreground": "oklch(0.985 0 0)",
1646
+ secondary: "oklch(0.967 0.001 286.375)",
1647
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
1648
+ muted: "oklch(0.967 0.001 286.375)",
1649
+ "muted-foreground": "oklch(0.552 0.016 285.938)",
1650
+ accent: "oklch(0.967 0.001 286.375)",
1651
+ "accent-foreground": "oklch(0.21 0.006 285.885)",
1652
+ destructive: "oklch(0.577 0.245 27.325)",
1653
+ border: "oklch(0.92 0.004 286.32)",
1654
+ input: "oklch(0.92 0.004 286.32)",
1655
+ ring: "oklch(0.705 0.015 286.067)",
1656
+ "chart-1": "oklch(0.871 0.006 286.286)",
1657
+ "chart-2": "oklch(0.552 0.016 285.938)",
1658
+ "chart-3": "oklch(0.442 0.017 285.786)",
1659
+ "chart-4": "oklch(0.37 0.013 285.805)",
1660
+ "chart-5": "oklch(0.274 0.006 286.033)",
1661
+ radius: "0.625rem",
1662
+ sidebar: "oklch(0.985 0 0)",
1663
+ "sidebar-foreground": "oklch(0.141 0.005 285.823)",
1664
+ "sidebar-primary": "oklch(0.21 0.006 285.885)",
1665
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
1666
+ "sidebar-accent": "oklch(0.967 0.001 286.375)",
1667
+ "sidebar-accent-foreground": "oklch(0.21 0.006 285.885)",
1668
+ "sidebar-border": "oklch(0.92 0.004 286.32)",
1669
+ "sidebar-ring": "oklch(0.705 0.015 286.067)"
1670
+ },
1671
+ dark: {
1672
+ background: "oklch(0.141 0.005 285.823)",
1673
+ foreground: "oklch(0.985 0 0)",
1674
+ card: "oklch(0.21 0.006 285.885)",
1675
+ "card-foreground": "oklch(0.985 0 0)",
1676
+ popover: "oklch(0.21 0.006 285.885)",
1677
+ "popover-foreground": "oklch(0.985 0 0)",
1678
+ primary: "oklch(0.92 0.004 286.32)",
1679
+ "primary-foreground": "oklch(0.21 0.006 285.885)",
1680
+ secondary: "oklch(0.274 0.006 286.033)",
1681
+ "secondary-foreground": "oklch(0.985 0 0)",
1682
+ muted: "oklch(0.274 0.006 286.033)",
1683
+ "muted-foreground": "oklch(0.705 0.015 286.067)",
1684
+ accent: "oklch(0.274 0.006 286.033)",
1685
+ "accent-foreground": "oklch(0.985 0 0)",
1686
+ destructive: "oklch(0.704 0.191 22.216)",
1687
+ border: "oklch(1 0 0 / 10%)",
1688
+ input: "oklch(1 0 0 / 15%)",
1689
+ ring: "oklch(0.552 0.016 285.938)",
1690
+ "chart-1": "oklch(0.871 0.006 286.286)",
1691
+ "chart-2": "oklch(0.552 0.016 285.938)",
1692
+ "chart-3": "oklch(0.442 0.017 285.786)",
1693
+ "chart-4": "oklch(0.37 0.013 285.805)",
1694
+ "chart-5": "oklch(0.274 0.006 286.033)",
1695
+ sidebar: "oklch(0.21 0.006 285.885)",
1696
+ "sidebar-foreground": "oklch(0.985 0 0)",
1697
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1698
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
1699
+ "sidebar-accent": "oklch(0.274 0.006 286.033)",
1700
+ "sidebar-accent-foreground": "oklch(0.985 0 0)",
1701
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1702
+ "sidebar-ring": "oklch(0.552 0.016 285.938)"
741
1703
  }
742
- if (!selectedComponents.length) {
743
- p2.log.warn(`No components selected. Exiting.`);
744
- process.exit(0);
1704
+ },
1705
+ mauve: {
1706
+ light: {
1707
+ background: "oklch(1 0 0)",
1708
+ foreground: "oklch(0.145 0.008 326)",
1709
+ card: "oklch(1 0 0)",
1710
+ "card-foreground": "oklch(0.145 0.008 326)",
1711
+ popover: "oklch(1 0 0)",
1712
+ "popover-foreground": "oklch(0.145 0.008 326)",
1713
+ primary: "oklch(0.212 0.019 322.12)",
1714
+ "primary-foreground": "oklch(0.985 0 0)",
1715
+ secondary: "oklch(0.96 0.003 325.6)",
1716
+ "secondary-foreground": "oklch(0.212 0.019 322.12)",
1717
+ muted: "oklch(0.96 0.003 325.6)",
1718
+ "muted-foreground": "oklch(0.542 0.034 322.5)",
1719
+ accent: "oklch(0.96 0.003 325.6)",
1720
+ "accent-foreground": "oklch(0.212 0.019 322.12)",
1721
+ destructive: "oklch(0.577 0.245 27.325)",
1722
+ border: "oklch(0.922 0.005 325.62)",
1723
+ input: "oklch(0.922 0.005 325.62)",
1724
+ ring: "oklch(0.711 0.019 323.02)",
1725
+ "chart-1": "oklch(0.865 0.012 325.68)",
1726
+ "chart-2": "oklch(0.542 0.034 322.5)",
1727
+ "chart-3": "oklch(0.435 0.029 321.78)",
1728
+ "chart-4": "oklch(0.364 0.029 323.89)",
1729
+ "chart-5": "oklch(0.263 0.024 320.12)",
1730
+ radius: "0.625rem",
1731
+ sidebar: "oklch(0.985 0 0)",
1732
+ "sidebar-foreground": "oklch(0.145 0.008 326)",
1733
+ "sidebar-primary": "oklch(0.212 0.019 322.12)",
1734
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
1735
+ "sidebar-accent": "oklch(0.96 0.003 325.6)",
1736
+ "sidebar-accent-foreground": "oklch(0.212 0.019 322.12)",
1737
+ "sidebar-border": "oklch(0.922 0.005 325.62)",
1738
+ "sidebar-ring": "oklch(0.711 0.019 323.02)"
1739
+ },
1740
+ dark: {
1741
+ background: "oklch(0.145 0.008 326)",
1742
+ foreground: "oklch(0.985 0 0)",
1743
+ card: "oklch(0.212 0.019 322.12)",
1744
+ "card-foreground": "oklch(0.985 0 0)",
1745
+ popover: "oklch(0.212 0.019 322.12)",
1746
+ "popover-foreground": "oklch(0.985 0 0)",
1747
+ primary: "oklch(0.922 0.005 325.62)",
1748
+ "primary-foreground": "oklch(0.212 0.019 322.12)",
1749
+ secondary: "oklch(0.263 0.024 320.12)",
1750
+ "secondary-foreground": "oklch(0.985 0 0)",
1751
+ muted: "oklch(0.263 0.024 320.12)",
1752
+ "muted-foreground": "oklch(0.711 0.019 323.02)",
1753
+ accent: "oklch(0.263 0.024 320.12)",
1754
+ "accent-foreground": "oklch(0.985 0 0)",
1755
+ destructive: "oklch(0.704 0.191 22.216)",
1756
+ border: "oklch(1 0 0 / 10%)",
1757
+ input: "oklch(1 0 0 / 15%)",
1758
+ ring: "oklch(0.542 0.034 322.5)",
1759
+ "chart-1": "oklch(0.865 0.012 325.68)",
1760
+ "chart-2": "oklch(0.542 0.034 322.5)",
1761
+ "chart-3": "oklch(0.435 0.029 321.78)",
1762
+ "chart-4": "oklch(0.364 0.029 323.89)",
1763
+ "chart-5": "oklch(0.263 0.024 320.12)",
1764
+ sidebar: "oklch(0.212 0.019 322.12)",
1765
+ "sidebar-foreground": "oklch(0.985 0 0)",
1766
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1767
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
1768
+ "sidebar-accent": "oklch(0.263 0.024 320.12)",
1769
+ "sidebar-accent-foreground": "oklch(0.985 0 0)",
1770
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1771
+ "sidebar-ring": "oklch(0.542 0.034 322.5)"
745
1772
  }
746
- const tree = await resolveTree(registryIndex, selectedComponents);
747
- const payload = await fetchTree(tree);
748
- if (!payload.length) {
749
- p2.log.warn(`Selected components not found. Exiting.`);
750
- process.exit(0);
1773
+ },
1774
+ olive: {
1775
+ light: {
1776
+ background: "oklch(1 0 0)",
1777
+ foreground: "oklch(0.153 0.006 107.1)",
1778
+ card: "oklch(1 0 0)",
1779
+ "card-foreground": "oklch(0.153 0.006 107.1)",
1780
+ popover: "oklch(1 0 0)",
1781
+ "popover-foreground": "oklch(0.153 0.006 107.1)",
1782
+ primary: "oklch(0.228 0.013 107.4)",
1783
+ "primary-foreground": "oklch(0.988 0.003 106.5)",
1784
+ secondary: "oklch(0.966 0.005 106.5)",
1785
+ "secondary-foreground": "oklch(0.228 0.013 107.4)",
1786
+ muted: "oklch(0.966 0.005 106.5)",
1787
+ "muted-foreground": "oklch(0.58 0.031 107.3)",
1788
+ accent: "oklch(0.966 0.005 106.5)",
1789
+ "accent-foreground": "oklch(0.228 0.013 107.4)",
1790
+ destructive: "oklch(0.577 0.245 27.325)",
1791
+ border: "oklch(0.93 0.007 106.5)",
1792
+ input: "oklch(0.93 0.007 106.5)",
1793
+ ring: "oklch(0.737 0.021 106.9)",
1794
+ "chart-1": "oklch(0.88 0.011 106.6)",
1795
+ "chart-2": "oklch(0.58 0.031 107.3)",
1796
+ "chart-3": "oklch(0.466 0.025 107.3)",
1797
+ "chart-4": "oklch(0.394 0.023 107.4)",
1798
+ "chart-5": "oklch(0.286 0.016 107.4)",
1799
+ radius: "0.625rem",
1800
+ sidebar: "oklch(0.988 0.003 106.5)",
1801
+ "sidebar-foreground": "oklch(0.153 0.006 107.1)",
1802
+ "sidebar-primary": "oklch(0.228 0.013 107.4)",
1803
+ "sidebar-primary-foreground": "oklch(0.988 0.003 106.5)",
1804
+ "sidebar-accent": "oklch(0.966 0.005 106.5)",
1805
+ "sidebar-accent-foreground": "oklch(0.228 0.013 107.4)",
1806
+ "sidebar-border": "oklch(0.93 0.007 106.5)",
1807
+ "sidebar-ring": "oklch(0.737 0.021 106.9)"
1808
+ },
1809
+ dark: {
1810
+ background: "oklch(0.153 0.006 107.1)",
1811
+ foreground: "oklch(0.988 0.003 106.5)",
1812
+ card: "oklch(0.228 0.013 107.4)",
1813
+ "card-foreground": "oklch(0.988 0.003 106.5)",
1814
+ popover: "oklch(0.228 0.013 107.4)",
1815
+ "popover-foreground": "oklch(0.988 0.003 106.5)",
1816
+ primary: "oklch(0.93 0.007 106.5)",
1817
+ "primary-foreground": "oklch(0.228 0.013 107.4)",
1818
+ secondary: "oklch(0.286 0.016 107.4)",
1819
+ "secondary-foreground": "oklch(0.988 0.003 106.5)",
1820
+ muted: "oklch(0.286 0.016 107.4)",
1821
+ "muted-foreground": "oklch(0.737 0.021 106.9)",
1822
+ accent: "oklch(0.286 0.016 107.4)",
1823
+ "accent-foreground": "oklch(0.988 0.003 106.5)",
1824
+ destructive: "oklch(0.704 0.191 22.216)",
1825
+ border: "oklch(1 0 0 / 10%)",
1826
+ input: "oklch(1 0 0 / 15%)",
1827
+ ring: "oklch(0.58 0.031 107.3)",
1828
+ "chart-1": "oklch(0.88 0.011 106.6)",
1829
+ "chart-2": "oklch(0.58 0.031 107.3)",
1830
+ "chart-3": "oklch(0.466 0.025 107.3)",
1831
+ "chart-4": "oklch(0.394 0.023 107.4)",
1832
+ "chart-5": "oklch(0.286 0.016 107.4)",
1833
+ sidebar: "oklch(0.228 0.013 107.4)",
1834
+ "sidebar-foreground": "oklch(0.988 0.003 106.5)",
1835
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1836
+ "sidebar-primary-foreground": "oklch(0.988 0.003 106.5)",
1837
+ "sidebar-accent": "oklch(0.286 0.016 107.4)",
1838
+ "sidebar-accent-foreground": "oklch(0.988 0.003 106.5)",
1839
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1840
+ "sidebar-ring": "oklch(0.58 0.031 107.3)"
751
1841
  }
752
- const spinner3 = p2.spinner();
753
- spinner3.start("Installing...");
754
- const targetDir = config.resolvedPaths.components;
755
- if (!existsSync2(targetDir)) {
756
- await mkdir(targetDir, { recursive: true });
1842
+ },
1843
+ mist: {
1844
+ light: {
1845
+ background: "oklch(1 0 0)",
1846
+ foreground: "oklch(0.148 0.004 228.8)",
1847
+ card: "oklch(1 0 0)",
1848
+ "card-foreground": "oklch(0.148 0.004 228.8)",
1849
+ popover: "oklch(1 0 0)",
1850
+ "popover-foreground": "oklch(0.148 0.004 228.8)",
1851
+ primary: "oklch(0.218 0.008 223.9)",
1852
+ "primary-foreground": "oklch(0.987 0.002 197.1)",
1853
+ secondary: "oklch(0.963 0.002 197.1)",
1854
+ "secondary-foreground": "oklch(0.218 0.008 223.9)",
1855
+ muted: "oklch(0.963 0.002 197.1)",
1856
+ "muted-foreground": "oklch(0.56 0.021 213.5)",
1857
+ accent: "oklch(0.963 0.002 197.1)",
1858
+ "accent-foreground": "oklch(0.218 0.008 223.9)",
1859
+ destructive: "oklch(0.577 0.245 27.325)",
1860
+ border: "oklch(0.925 0.005 214.3)",
1861
+ input: "oklch(0.925 0.005 214.3)",
1862
+ ring: "oklch(0.723 0.014 214.4)",
1863
+ "chart-1": "oklch(0.872 0.007 219.6)",
1864
+ "chart-2": "oklch(0.56 0.021 213.5)",
1865
+ "chart-3": "oklch(0.45 0.017 213.2)",
1866
+ "chart-4": "oklch(0.378 0.015 216)",
1867
+ "chart-5": "oklch(0.275 0.011 216.9)",
1868
+ radius: "0.625rem",
1869
+ sidebar: "oklch(0.987 0.002 197.1)",
1870
+ "sidebar-foreground": "oklch(0.148 0.004 228.8)",
1871
+ "sidebar-primary": "oklch(0.218 0.008 223.9)",
1872
+ "sidebar-primary-foreground": "oklch(0.987 0.002 197.1)",
1873
+ "sidebar-accent": "oklch(0.963 0.002 197.1)",
1874
+ "sidebar-accent-foreground": "oklch(0.218 0.008 223.9)",
1875
+ "sidebar-border": "oklch(0.925 0.005 214.3)",
1876
+ "sidebar-ring": "oklch(0.723 0.014 214.4)"
1877
+ },
1878
+ dark: {
1879
+ background: "oklch(0.148 0.004 228.8)",
1880
+ foreground: "oklch(0.987 0.002 197.1)",
1881
+ card: "oklch(0.218 0.008 223.9)",
1882
+ "card-foreground": "oklch(0.987 0.002 197.1)",
1883
+ popover: "oklch(0.218 0.008 223.9)",
1884
+ "popover-foreground": "oklch(0.987 0.002 197.1)",
1885
+ primary: "oklch(0.925 0.005 214.3)",
1886
+ "primary-foreground": "oklch(0.218 0.008 223.9)",
1887
+ secondary: "oklch(0.275 0.011 216.9)",
1888
+ "secondary-foreground": "oklch(0.987 0.002 197.1)",
1889
+ muted: "oklch(0.275 0.011 216.9)",
1890
+ "muted-foreground": "oklch(0.723 0.014 214.4)",
1891
+ accent: "oklch(0.275 0.011 216.9)",
1892
+ "accent-foreground": "oklch(0.987 0.002 197.1)",
1893
+ destructive: "oklch(0.704 0.191 22.216)",
1894
+ border: "oklch(1 0 0 / 10%)",
1895
+ input: "oklch(1 0 0 / 15%)",
1896
+ ring: "oklch(0.56 0.021 213.5)",
1897
+ "chart-1": "oklch(0.872 0.007 219.6)",
1898
+ "chart-2": "oklch(0.56 0.021 213.5)",
1899
+ "chart-3": "oklch(0.45 0.017 213.2)",
1900
+ "chart-4": "oklch(0.378 0.015 216)",
1901
+ "chart-5": "oklch(0.275 0.011 216.9)",
1902
+ sidebar: "oklch(0.218 0.008 223.9)",
1903
+ "sidebar-foreground": "oklch(0.987 0.002 197.1)",
1904
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1905
+ "sidebar-primary-foreground": "oklch(0.987 0.002 197.1)",
1906
+ "sidebar-accent": "oklch(0.275 0.011 216.9)",
1907
+ "sidebar-accent-foreground": "oklch(0.987 0.002 197.1)",
1908
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1909
+ "sidebar-ring": "oklch(0.56 0.021 213.5)"
757
1910
  }
758
- for (const item of payload) {
759
- spinner3.message(`Installing ${highlight(item.name)}...`);
760
- const existingComponent = item.files.filter(
761
- (file) => existsSync2(path3.resolve(targetDir, file.name))
762
- );
763
- if (existingComponent.length && !options.overwrite) {
764
- if (selectedComponents.includes(item.name)) {
765
- spinner3.stop();
766
- const prompts = await p2.group(
767
- {
768
- overwrite: () => p2.confirm({
769
- message: `Component ${item.name} already exists. Would you like to overwrite?`,
770
- initialValue: false
771
- })
772
- },
773
- {
774
- onCancel: () => {
775
- p2.cancel("Cancelled.");
776
- process.exit(0);
777
- }
778
- }
779
- );
780
- const overwrite = prompts.overwrite;
781
- if (!overwrite) {
782
- p2.log.info(
783
- `Skipped ${item.name}. To overwrite, run with the ${highlight("--overwrite")} flag.`
784
- );
785
- continue;
786
- }
787
- spinner3.start(`Installing ${highlight(item.name)}...`);
788
- } else {
789
- continue;
790
- }
791
- }
792
- for (const file of item.files) {
793
- let filePath = path3.resolve(targetDir, file.name);
794
- const content = await transform({
795
- filename: file.name,
796
- raw: file.content,
797
- config
798
- });
799
- if (!config.tsx) {
800
- filePath = filePath.replace(/\.tsx$/, ".jsx");
801
- filePath = filePath.replace(/\.ts$/, ".js");
802
- }
803
- await writeFile(filePath, content, "utf-8");
804
- }
805
- if (item.dependencies?.length) {
806
- const packageManager = await getPackageManager(cwd);
807
- await execa(packageManager, ["add", ...item.dependencies], { cwd });
808
- }
1911
+ },
1912
+ taupe: {
1913
+ light: {
1914
+ background: "oklch(1 0 0)",
1915
+ foreground: "oklch(0.147 0.004 49.3)",
1916
+ card: "oklch(1 0 0)",
1917
+ "card-foreground": "oklch(0.147 0.004 49.3)",
1918
+ popover: "oklch(1 0 0)",
1919
+ "popover-foreground": "oklch(0.147 0.004 49.3)",
1920
+ primary: "oklch(0.214 0.009 43.1)",
1921
+ "primary-foreground": "oklch(0.986 0.002 67.8)",
1922
+ secondary: "oklch(0.96 0.002 17.2)",
1923
+ "secondary-foreground": "oklch(0.214 0.009 43.1)",
1924
+ muted: "oklch(0.96 0.002 17.2)",
1925
+ "muted-foreground": "oklch(0.547 0.021 43.1)",
1926
+ accent: "oklch(0.96 0.002 17.2)",
1927
+ "accent-foreground": "oklch(0.214 0.009 43.1)",
1928
+ destructive: "oklch(0.577 0.245 27.325)",
1929
+ border: "oklch(0.922 0.005 34.3)",
1930
+ input: "oklch(0.922 0.005 34.3)",
1931
+ ring: "oklch(0.714 0.014 41.2)",
1932
+ "chart-1": "oklch(0.868 0.007 39.5)",
1933
+ "chart-2": "oklch(0.547 0.021 43.1)",
1934
+ "chart-3": "oklch(0.438 0.017 39.3)",
1935
+ "chart-4": "oklch(0.367 0.016 35.7)",
1936
+ "chart-5": "oklch(0.268 0.011 36.5)",
1937
+ radius: "0.625rem",
1938
+ sidebar: "oklch(0.986 0.002 67.8)",
1939
+ "sidebar-foreground": "oklch(0.147 0.004 49.3)",
1940
+ "sidebar-primary": "oklch(0.214 0.009 43.1)",
1941
+ "sidebar-primary-foreground": "oklch(0.986 0.002 67.8)",
1942
+ "sidebar-accent": "oklch(0.96 0.002 17.2)",
1943
+ "sidebar-accent-foreground": "oklch(0.214 0.009 43.1)",
1944
+ "sidebar-border": "oklch(0.922 0.005 34.3)",
1945
+ "sidebar-ring": "oklch(0.714 0.014 41.2)"
1946
+ },
1947
+ dark: {
1948
+ background: "oklch(0.147 0.004 49.3)",
1949
+ foreground: "oklch(0.986 0.002 67.8)",
1950
+ card: "oklch(0.214 0.009 43.1)",
1951
+ "card-foreground": "oklch(0.986 0.002 67.8)",
1952
+ popover: "oklch(0.214 0.009 43.1)",
1953
+ "popover-foreground": "oklch(0.986 0.002 67.8)",
1954
+ primary: "oklch(0.922 0.005 34.3)",
1955
+ "primary-foreground": "oklch(0.214 0.009 43.1)",
1956
+ secondary: "oklch(0.268 0.011 36.5)",
1957
+ "secondary-foreground": "oklch(0.986 0.002 67.8)",
1958
+ muted: "oklch(0.268 0.011 36.5)",
1959
+ "muted-foreground": "oklch(0.714 0.014 41.2)",
1960
+ accent: "oklch(0.268 0.011 36.5)",
1961
+ "accent-foreground": "oklch(0.986 0.002 67.8)",
1962
+ destructive: "oklch(0.704 0.191 22.216)",
1963
+ border: "oklch(1 0 0 / 10%)",
1964
+ input: "oklch(1 0 0 / 15%)",
1965
+ ring: "oklch(0.547 0.021 43.1)",
1966
+ "chart-1": "oklch(0.868 0.007 39.5)",
1967
+ "chart-2": "oklch(0.547 0.021 43.1)",
1968
+ "chart-3": "oklch(0.438 0.017 39.3)",
1969
+ "chart-4": "oklch(0.367 0.016 35.7)",
1970
+ "chart-5": "oklch(0.268 0.011 36.5)",
1971
+ sidebar: "oklch(0.214 0.009 43.1)",
1972
+ "sidebar-foreground": "oklch(0.986 0.002 67.8)",
1973
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
1974
+ "sidebar-primary-foreground": "oklch(0.986 0.002 67.8)",
1975
+ "sidebar-accent": "oklch(0.268 0.011 36.5)",
1976
+ "sidebar-accent-foreground": "oklch(0.986 0.002 67.8)",
1977
+ "sidebar-border": "oklch(1 0 0 / 10%)",
1978
+ "sidebar-ring": "oklch(0.547 0.021 43.1)"
1979
+ }
1980
+ },
1981
+ amber: {
1982
+ light: {
1983
+ primary: "oklch(0.555 0.163 48.998)",
1984
+ "primary-foreground": "oklch(0.987 0.022 95.277)",
1985
+ secondary: "oklch(0.967 0.001 286.375)",
1986
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
1987
+ "chart-1": "oklch(0.879 0.169 91.605)",
1988
+ "chart-2": "oklch(0.769 0.188 70.08)",
1989
+ "chart-3": "oklch(0.666 0.179 58.318)",
1990
+ "chart-4": "oklch(0.555 0.163 48.998)",
1991
+ "chart-5": "oklch(0.473 0.137 46.201)",
1992
+ "sidebar-primary": "oklch(0.666 0.179 58.318)",
1993
+ "sidebar-primary-foreground": "oklch(0.987 0.022 95.277)"
1994
+ },
1995
+ dark: {
1996
+ primary: "oklch(0.473 0.137 46.201)",
1997
+ "primary-foreground": "oklch(0.987 0.022 95.277)",
1998
+ secondary: "oklch(0.274 0.006 286.033)",
1999
+ "secondary-foreground": "oklch(0.985 0 0)",
2000
+ "chart-1": "oklch(0.879 0.169 91.605)",
2001
+ "chart-2": "oklch(0.769 0.188 70.08)",
2002
+ "chart-3": "oklch(0.666 0.179 58.318)",
2003
+ "chart-4": "oklch(0.555 0.163 48.998)",
2004
+ "chart-5": "oklch(0.473 0.137 46.201)",
2005
+ "sidebar-primary": "oklch(0.769 0.188 70.08)",
2006
+ "sidebar-primary-foreground": "oklch(0.279 0.077 45.635)"
2007
+ }
2008
+ },
2009
+ blue: {
2010
+ light: {
2011
+ primary: "oklch(0.488 0.243 264.376)",
2012
+ "primary-foreground": "oklch(0.97 0.014 254.604)",
2013
+ secondary: "oklch(0.967 0.001 286.375)",
2014
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2015
+ "chart-1": "oklch(0.809 0.105 251.813)",
2016
+ "chart-2": "oklch(0.623 0.214 259.815)",
2017
+ "chart-3": "oklch(0.546 0.245 262.881)",
2018
+ "chart-4": "oklch(0.488 0.243 264.376)",
2019
+ "chart-5": "oklch(0.424 0.199 265.638)",
2020
+ "sidebar-primary": "oklch(0.546 0.245 262.881)",
2021
+ "sidebar-primary-foreground": "oklch(0.97 0.014 254.604)"
2022
+ },
2023
+ dark: {
2024
+ primary: "oklch(0.424 0.199 265.638)",
2025
+ "primary-foreground": "oklch(0.97 0.014 254.604)",
2026
+ secondary: "oklch(0.274 0.006 286.033)",
2027
+ "secondary-foreground": "oklch(0.985 0 0)",
2028
+ "chart-1": "oklch(0.809 0.105 251.813)",
2029
+ "chart-2": "oklch(0.623 0.214 259.815)",
2030
+ "chart-3": "oklch(0.546 0.245 262.881)",
2031
+ "chart-4": "oklch(0.488 0.243 264.376)",
2032
+ "chart-5": "oklch(0.424 0.199 265.638)",
2033
+ "sidebar-primary": "oklch(0.623 0.214 259.815)",
2034
+ "sidebar-primary-foreground": "oklch(0.97 0.014 254.604)"
2035
+ }
2036
+ },
2037
+ cyan: {
2038
+ light: {
2039
+ primary: "oklch(0.52 0.105 223.128)",
2040
+ "primary-foreground": "oklch(0.984 0.019 200.873)",
2041
+ secondary: "oklch(0.967 0.001 286.375)",
2042
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2043
+ "chart-1": "oklch(0.865 0.127 207.078)",
2044
+ "chart-2": "oklch(0.715 0.143 215.221)",
2045
+ "chart-3": "oklch(0.609 0.126 221.723)",
2046
+ "chart-4": "oklch(0.52 0.105 223.128)",
2047
+ "chart-5": "oklch(0.45 0.085 224.283)",
2048
+ "sidebar-primary": "oklch(0.609 0.126 221.723)",
2049
+ "sidebar-primary-foreground": "oklch(0.984 0.019 200.873)"
2050
+ },
2051
+ dark: {
2052
+ primary: "oklch(0.45 0.085 224.283)",
2053
+ "primary-foreground": "oklch(0.984 0.019 200.873)",
2054
+ secondary: "oklch(0.274 0.006 286.033)",
2055
+ "secondary-foreground": "oklch(0.985 0 0)",
2056
+ "chart-1": "oklch(0.865 0.127 207.078)",
2057
+ "chart-2": "oklch(0.715 0.143 215.221)",
2058
+ "chart-3": "oklch(0.609 0.126 221.723)",
2059
+ "chart-4": "oklch(0.52 0.105 223.128)",
2060
+ "chart-5": "oklch(0.45 0.085 224.283)",
2061
+ "sidebar-primary": "oklch(0.715 0.143 215.221)",
2062
+ "sidebar-primary-foreground": "oklch(0.302 0.056 229.695)"
2063
+ }
2064
+ },
2065
+ emerald: {
2066
+ light: {
2067
+ primary: "oklch(0.508 0.118 165.612)",
2068
+ "primary-foreground": "oklch(0.979 0.021 166.113)",
2069
+ secondary: "oklch(0.967 0.001 286.375)",
2070
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2071
+ "chart-1": "oklch(0.845 0.143 164.978)",
2072
+ "chart-2": "oklch(0.696 0.17 162.48)",
2073
+ "chart-3": "oklch(0.596 0.145 163.225)",
2074
+ "chart-4": "oklch(0.508 0.118 165.612)",
2075
+ "chart-5": "oklch(0.432 0.095 166.913)",
2076
+ "sidebar-primary": "oklch(0.596 0.145 163.225)",
2077
+ "sidebar-primary-foreground": "oklch(0.979 0.021 166.113)"
2078
+ },
2079
+ dark: {
2080
+ primary: "oklch(0.432 0.095 166.913)",
2081
+ "primary-foreground": "oklch(0.979 0.021 166.113)",
2082
+ secondary: "oklch(0.274 0.006 286.033)",
2083
+ "secondary-foreground": "oklch(0.985 0 0)",
2084
+ "chart-1": "oklch(0.845 0.143 164.978)",
2085
+ "chart-2": "oklch(0.696 0.17 162.48)",
2086
+ "chart-3": "oklch(0.596 0.145 163.225)",
2087
+ "chart-4": "oklch(0.508 0.118 165.612)",
2088
+ "chart-5": "oklch(0.432 0.095 166.913)",
2089
+ "sidebar-primary": "oklch(0.696 0.17 162.48)",
2090
+ "sidebar-primary-foreground": "oklch(0.262 0.051 172.552)"
2091
+ }
2092
+ },
2093
+ fuchsia: {
2094
+ light: {
2095
+ primary: "oklch(0.518 0.253 323.949)",
2096
+ "primary-foreground": "oklch(0.977 0.017 320.058)",
2097
+ secondary: "oklch(0.967 0.001 286.375)",
2098
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2099
+ "chart-1": "oklch(0.833 0.145 321.434)",
2100
+ "chart-2": "oklch(0.667 0.295 322.15)",
2101
+ "chart-3": "oklch(0.591 0.293 322.896)",
2102
+ "chart-4": "oklch(0.518 0.253 323.949)",
2103
+ "chart-5": "oklch(0.452 0.211 324.591)",
2104
+ "sidebar-primary": "oklch(0.591 0.293 322.896)",
2105
+ "sidebar-primary-foreground": "oklch(0.977 0.017 320.058)"
2106
+ },
2107
+ dark: {
2108
+ primary: "oklch(0.452 0.211 324.591)",
2109
+ "primary-foreground": "oklch(0.977 0.017 320.058)",
2110
+ secondary: "oklch(0.274 0.006 286.033)",
2111
+ "secondary-foreground": "oklch(0.985 0 0)",
2112
+ "chart-1": "oklch(0.833 0.145 321.434)",
2113
+ "chart-2": "oklch(0.667 0.295 322.15)",
2114
+ "chart-3": "oklch(0.591 0.293 322.896)",
2115
+ "chart-4": "oklch(0.518 0.253 323.949)",
2116
+ "chart-5": "oklch(0.452 0.211 324.591)",
2117
+ "sidebar-primary": "oklch(0.667 0.295 322.15)",
2118
+ "sidebar-primary-foreground": "oklch(0.977 0.017 320.058)"
2119
+ }
2120
+ },
2121
+ green: {
2122
+ light: {
2123
+ primary: "oklch(0.527 0.154 150.069)",
2124
+ "primary-foreground": "oklch(0.982 0.018 155.826)",
2125
+ secondary: "oklch(0.967 0.001 286.375)",
2126
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2127
+ "chart-1": "oklch(0.871 0.15 154.449)",
2128
+ "chart-2": "oklch(0.723 0.219 149.579)",
2129
+ "chart-3": "oklch(0.627 0.194 149.214)",
2130
+ "chart-4": "oklch(0.527 0.154 150.069)",
2131
+ "chart-5": "oklch(0.448 0.119 151.328)",
2132
+ "sidebar-primary": "oklch(0.627 0.194 149.214)",
2133
+ "sidebar-primary-foreground": "oklch(0.982 0.018 155.826)"
2134
+ },
2135
+ dark: {
2136
+ primary: "oklch(0.448 0.119 151.328)",
2137
+ "primary-foreground": "oklch(0.982 0.018 155.826)",
2138
+ secondary: "oklch(0.274 0.006 286.033)",
2139
+ "secondary-foreground": "oklch(0.985 0 0)",
2140
+ "chart-1": "oklch(0.871 0.15 154.449)",
2141
+ "chart-2": "oklch(0.723 0.219 149.579)",
2142
+ "chart-3": "oklch(0.627 0.194 149.214)",
2143
+ "chart-4": "oklch(0.527 0.154 150.069)",
2144
+ "chart-5": "oklch(0.448 0.119 151.328)",
2145
+ "sidebar-primary": "oklch(0.723 0.219 149.579)",
2146
+ "sidebar-primary-foreground": "oklch(0.982 0.018 155.826)"
2147
+ }
2148
+ },
2149
+ indigo: {
2150
+ light: {
2151
+ primary: "oklch(0.457 0.24 277.023)",
2152
+ "primary-foreground": "oklch(0.962 0.018 272.314)",
2153
+ secondary: "oklch(0.967 0.001 286.375)",
2154
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2155
+ "chart-1": "oklch(0.785 0.115 274.713)",
2156
+ "chart-2": "oklch(0.585 0.233 277.117)",
2157
+ "chart-3": "oklch(0.511 0.262 276.966)",
2158
+ "chart-4": "oklch(0.457 0.24 277.023)",
2159
+ "chart-5": "oklch(0.398 0.195 277.366)",
2160
+ "sidebar-primary": "oklch(0.511 0.262 276.966)",
2161
+ "sidebar-primary-foreground": "oklch(0.962 0.018 272.314)"
2162
+ },
2163
+ dark: {
2164
+ primary: "oklch(0.398 0.195 277.366)",
2165
+ "primary-foreground": "oklch(0.962 0.018 272.314)",
2166
+ secondary: "oklch(0.274 0.006 286.033)",
2167
+ "secondary-foreground": "oklch(0.985 0 0)",
2168
+ "chart-1": "oklch(0.785 0.115 274.713)",
2169
+ "chart-2": "oklch(0.585 0.233 277.117)",
2170
+ "chart-3": "oklch(0.511 0.262 276.966)",
2171
+ "chart-4": "oklch(0.457 0.24 277.023)",
2172
+ "chart-5": "oklch(0.398 0.195 277.366)",
2173
+ "sidebar-primary": "oklch(0.585 0.233 277.117)",
2174
+ "sidebar-primary-foreground": "oklch(0.962 0.018 272.314)"
2175
+ }
2176
+ },
2177
+ lime: {
2178
+ light: {
2179
+ primary: "oklch(0.841 0.238 128.85)",
2180
+ "primary-foreground": "oklch(0.405 0.101 131.063)",
2181
+ secondary: "oklch(0.967 0.001 286.375)",
2182
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2183
+ "chart-1": "oklch(0.897 0.196 126.665)",
2184
+ "chart-2": "oklch(0.768 0.233 130.85)",
2185
+ "chart-3": "oklch(0.648 0.2 131.684)",
2186
+ "chart-4": "oklch(0.532 0.157 131.589)",
2187
+ "chart-5": "oklch(0.453 0.124 130.933)",
2188
+ "sidebar-primary": "oklch(0.648 0.2 131.684)",
2189
+ "sidebar-primary-foreground": "oklch(0.986 0.031 120.757)"
2190
+ },
2191
+ dark: {
2192
+ primary: "oklch(0.768 0.233 130.85)",
2193
+ "primary-foreground": "oklch(0.405 0.101 131.063)",
2194
+ secondary: "oklch(0.274 0.006 286.033)",
2195
+ "secondary-foreground": "oklch(0.985 0 0)",
2196
+ "chart-1": "oklch(0.897 0.196 126.665)",
2197
+ "chart-2": "oklch(0.768 0.233 130.85)",
2198
+ "chart-3": "oklch(0.648 0.2 131.684)",
2199
+ "chart-4": "oklch(0.532 0.157 131.589)",
2200
+ "chart-5": "oklch(0.453 0.124 130.933)",
2201
+ "sidebar-primary": "oklch(0.768 0.233 130.85)",
2202
+ "sidebar-primary-foreground": "oklch(0.274 0.072 132.109)"
2203
+ }
2204
+ },
2205
+ orange: {
2206
+ light: {
2207
+ primary: "oklch(0.553 0.195 38.402)",
2208
+ "primary-foreground": "oklch(0.98 0.016 73.684)",
2209
+ secondary: "oklch(0.967 0.001 286.375)",
2210
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2211
+ "chart-1": "oklch(0.837 0.128 66.29)",
2212
+ "chart-2": "oklch(0.705 0.213 47.604)",
2213
+ "chart-3": "oklch(0.646 0.222 41.116)",
2214
+ "chart-4": "oklch(0.553 0.195 38.402)",
2215
+ "chart-5": "oklch(0.47 0.157 37.304)",
2216
+ "sidebar-primary": "oklch(0.646 0.222 41.116)",
2217
+ "sidebar-primary-foreground": "oklch(0.98 0.016 73.684)"
2218
+ },
2219
+ dark: {
2220
+ primary: "oklch(0.47 0.157 37.304)",
2221
+ "primary-foreground": "oklch(0.98 0.016 73.684)",
2222
+ secondary: "oklch(0.274 0.006 286.033)",
2223
+ "secondary-foreground": "oklch(0.985 0 0)",
2224
+ "chart-1": "oklch(0.837 0.128 66.29)",
2225
+ "chart-2": "oklch(0.705 0.213 47.604)",
2226
+ "chart-3": "oklch(0.646 0.222 41.116)",
2227
+ "chart-4": "oklch(0.553 0.195 38.402)",
2228
+ "chart-5": "oklch(0.47 0.157 37.304)",
2229
+ "sidebar-primary": "oklch(0.705 0.213 47.604)",
2230
+ "sidebar-primary-foreground": "oklch(0.98 0.016 73.684)"
2231
+ }
2232
+ },
2233
+ pink: {
2234
+ light: {
2235
+ primary: "oklch(0.525 0.223 3.958)",
2236
+ "primary-foreground": "oklch(0.971 0.014 343.198)",
2237
+ secondary: "oklch(0.967 0.001 286.375)",
2238
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2239
+ "chart-1": "oklch(0.823 0.12 346.018)",
2240
+ "chart-2": "oklch(0.656 0.241 354.308)",
2241
+ "chart-3": "oklch(0.592 0.249 0.584)",
2242
+ "chart-4": "oklch(0.525 0.223 3.958)",
2243
+ "chart-5": "oklch(0.459 0.187 3.815)",
2244
+ "sidebar-primary": "oklch(0.592 0.249 0.584)",
2245
+ "sidebar-primary-foreground": "oklch(0.971 0.014 343.198)"
2246
+ },
2247
+ dark: {
2248
+ primary: "oklch(0.459 0.187 3.815)",
2249
+ "primary-foreground": "oklch(0.971 0.014 343.198)",
2250
+ secondary: "oklch(0.274 0.006 286.033)",
2251
+ "secondary-foreground": "oklch(0.985 0 0)",
2252
+ "chart-1": "oklch(0.823 0.12 346.018)",
2253
+ "chart-2": "oklch(0.656 0.241 354.308)",
2254
+ "chart-3": "oklch(0.592 0.249 0.584)",
2255
+ "chart-4": "oklch(0.525 0.223 3.958)",
2256
+ "chart-5": "oklch(0.459 0.187 3.815)",
2257
+ "sidebar-primary": "oklch(0.656 0.241 354.308)",
2258
+ "sidebar-primary-foreground": "oklch(0.971 0.014 343.198)"
2259
+ }
2260
+ },
2261
+ purple: {
2262
+ light: {
2263
+ primary: "oklch(0.496 0.265 301.924)",
2264
+ "primary-foreground": "oklch(0.977 0.014 308.299)",
2265
+ secondary: "oklch(0.967 0.001 286.375)",
2266
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2267
+ "chart-1": "oklch(0.827 0.119 306.383)",
2268
+ "chart-2": "oklch(0.627 0.265 303.9)",
2269
+ "chart-3": "oklch(0.558 0.288 302.321)",
2270
+ "chart-4": "oklch(0.496 0.265 301.924)",
2271
+ "chart-5": "oklch(0.438 0.218 303.724)",
2272
+ "sidebar-primary": "oklch(0.558 0.288 302.321)",
2273
+ "sidebar-primary-foreground": "oklch(0.977 0.014 308.299)"
2274
+ },
2275
+ dark: {
2276
+ primary: "oklch(0.438 0.218 303.724)",
2277
+ "primary-foreground": "oklch(0.977 0.014 308.299)",
2278
+ secondary: "oklch(0.274 0.006 286.033)",
2279
+ "secondary-foreground": "oklch(0.985 0 0)",
2280
+ "chart-1": "oklch(0.827 0.119 306.383)",
2281
+ "chart-2": "oklch(0.627 0.265 303.9)",
2282
+ "chart-3": "oklch(0.558 0.288 302.321)",
2283
+ "chart-4": "oklch(0.496 0.265 301.924)",
2284
+ "chart-5": "oklch(0.438 0.218 303.724)",
2285
+ "sidebar-primary": "oklch(0.627 0.265 303.9)",
2286
+ "sidebar-primary-foreground": "oklch(0.977 0.014 308.299)"
2287
+ }
2288
+ },
2289
+ red: {
2290
+ light: {
2291
+ primary: "oklch(0.505 0.213 27.518)",
2292
+ "primary-foreground": "oklch(0.971 0.013 17.38)",
2293
+ secondary: "oklch(0.967 0.001 286.375)",
2294
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2295
+ "chart-1": "oklch(0.808 0.114 19.571)",
2296
+ "chart-2": "oklch(0.637 0.237 25.331)",
2297
+ "chart-3": "oklch(0.577 0.245 27.325)",
2298
+ "chart-4": "oklch(0.505 0.213 27.518)",
2299
+ "chart-5": "oklch(0.444 0.177 26.899)",
2300
+ "sidebar-primary": "oklch(0.577 0.245 27.325)",
2301
+ "sidebar-primary-foreground": "oklch(0.971 0.013 17.38)"
2302
+ },
2303
+ dark: {
2304
+ primary: "oklch(0.444 0.177 26.899)",
2305
+ "primary-foreground": "oklch(0.971 0.013 17.38)",
2306
+ secondary: "oklch(0.274 0.006 286.033)",
2307
+ "secondary-foreground": "oklch(0.985 0 0)",
2308
+ "chart-1": "oklch(0.808 0.114 19.571)",
2309
+ "chart-2": "oklch(0.637 0.237 25.331)",
2310
+ "chart-3": "oklch(0.577 0.245 27.325)",
2311
+ "chart-4": "oklch(0.505 0.213 27.518)",
2312
+ "chart-5": "oklch(0.444 0.177 26.899)",
2313
+ "sidebar-primary": "oklch(0.637 0.237 25.331)",
2314
+ "sidebar-primary-foreground": "oklch(0.971 0.013 17.38)"
2315
+ }
2316
+ },
2317
+ rose: {
2318
+ light: {
2319
+ primary: "oklch(0.514 0.222 16.935)",
2320
+ "primary-foreground": "oklch(0.969 0.015 12.422)",
2321
+ secondary: "oklch(0.967 0.001 286.375)",
2322
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2323
+ "chart-1": "oklch(0.81 0.117 11.638)",
2324
+ "chart-2": "oklch(0.645 0.246 16.439)",
2325
+ "chart-3": "oklch(0.586 0.253 17.585)",
2326
+ "chart-4": "oklch(0.514 0.222 16.935)",
2327
+ "chart-5": "oklch(0.455 0.188 13.697)",
2328
+ "sidebar-primary": "oklch(0.586 0.253 17.585)",
2329
+ "sidebar-primary-foreground": "oklch(0.969 0.015 12.422)"
2330
+ },
2331
+ dark: {
2332
+ primary: "oklch(0.455 0.188 13.697)",
2333
+ "primary-foreground": "oklch(0.969 0.015 12.422)",
2334
+ secondary: "oklch(0.274 0.006 286.033)",
2335
+ "secondary-foreground": "oklch(0.985 0 0)",
2336
+ "chart-1": "oklch(0.81 0.117 11.638)",
2337
+ "chart-2": "oklch(0.645 0.246 16.439)",
2338
+ "chart-3": "oklch(0.586 0.253 17.585)",
2339
+ "chart-4": "oklch(0.514 0.222 16.935)",
2340
+ "chart-5": "oklch(0.455 0.188 13.697)",
2341
+ sidebar: "oklch(0.21 0.006 285.885)",
2342
+ "sidebar-primary": "oklch(0.645 0.246 16.439)",
2343
+ "sidebar-primary-foreground": "oklch(0.969 0.015 12.422)"
2344
+ }
2345
+ },
2346
+ sky: {
2347
+ light: {
2348
+ primary: "oklch(0.5 0.134 242.749)",
2349
+ "primary-foreground": "oklch(0.977 0.013 236.62)",
2350
+ secondary: "oklch(0.967 0.001 286.375)",
2351
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2352
+ "chart-1": "oklch(0.828 0.111 230.318)",
2353
+ "chart-2": "oklch(0.685 0.169 237.323)",
2354
+ "chart-3": "oklch(0.588 0.158 241.966)",
2355
+ "chart-4": "oklch(0.5 0.134 242.749)",
2356
+ "chart-5": "oklch(0.443 0.11 240.79)",
2357
+ "sidebar-primary": "oklch(0.588 0.158 241.966)",
2358
+ "sidebar-primary-foreground": "oklch(0.977 0.013 236.62)"
2359
+ },
2360
+ dark: {
2361
+ primary: "oklch(0.443 0.11 240.79)",
2362
+ "primary-foreground": "oklch(0.977 0.013 236.62)",
2363
+ secondary: "oklch(0.274 0.006 286.033)",
2364
+ "secondary-foreground": "oklch(0.985 0 0)",
2365
+ "chart-1": "oklch(0.828 0.111 230.318)",
2366
+ "chart-2": "oklch(0.685 0.169 237.323)",
2367
+ "chart-3": "oklch(0.588 0.158 241.966)",
2368
+ "chart-4": "oklch(0.5 0.134 242.749)",
2369
+ "chart-5": "oklch(0.443 0.11 240.79)",
2370
+ "sidebar-primary": "oklch(0.685 0.169 237.323)",
2371
+ "sidebar-primary-foreground": "oklch(0.293 0.066 243.157)"
2372
+ }
2373
+ },
2374
+ teal: {
2375
+ light: {
2376
+ primary: "oklch(0.511 0.096 186.391)",
2377
+ "primary-foreground": "oklch(0.984 0.014 180.72)",
2378
+ secondary: "oklch(0.967 0.001 286.375)",
2379
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2380
+ "chart-1": "oklch(0.855 0.138 181.071)",
2381
+ "chart-2": "oklch(0.704 0.14 182.503)",
2382
+ "chart-3": "oklch(0.6 0.118 184.704)",
2383
+ "chart-4": "oklch(0.511 0.096 186.391)",
2384
+ "chart-5": "oklch(0.437 0.078 188.216)",
2385
+ "sidebar-primary": "oklch(0.6 0.118 184.704)",
2386
+ "sidebar-primary-foreground": "oklch(0.984 0.014 180.72)"
2387
+ },
2388
+ dark: {
2389
+ primary: "oklch(0.437 0.078 188.216)",
2390
+ "primary-foreground": "oklch(0.984 0.014 180.72)",
2391
+ secondary: "oklch(0.274 0.006 286.033)",
2392
+ "secondary-foreground": "oklch(0.985 0 0)",
2393
+ "chart-1": "oklch(0.855 0.138 181.071)",
2394
+ "chart-2": "oklch(0.704 0.14 182.503)",
2395
+ "chart-3": "oklch(0.6 0.118 184.704)",
2396
+ "chart-4": "oklch(0.511 0.096 186.391)",
2397
+ "chart-5": "oklch(0.437 0.078 188.216)",
2398
+ "sidebar-primary": "oklch(0.704 0.14 182.503)",
2399
+ "sidebar-primary-foreground": "oklch(0.277 0.046 192.524)"
2400
+ }
2401
+ },
2402
+ violet: {
2403
+ light: {
2404
+ primary: "oklch(0.491 0.27 292.581)",
2405
+ "primary-foreground": "oklch(0.969 0.016 293.756)",
2406
+ secondary: "oklch(0.967 0.001 286.375)",
2407
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2408
+ "chart-1": "oklch(0.811 0.111 293.571)",
2409
+ "chart-2": "oklch(0.606 0.25 292.717)",
2410
+ "chart-3": "oklch(0.541 0.281 293.009)",
2411
+ "chart-4": "oklch(0.491 0.27 292.581)",
2412
+ "chart-5": "oklch(0.432 0.232 292.759)",
2413
+ "sidebar-primary": "oklch(0.541 0.281 293.009)",
2414
+ "sidebar-primary-foreground": "oklch(0.969 0.016 293.756)"
2415
+ },
2416
+ dark: {
2417
+ primary: "oklch(0.432 0.232 292.759)",
2418
+ "primary-foreground": "oklch(0.969 0.016 293.756)",
2419
+ secondary: "oklch(0.274 0.006 286.033)",
2420
+ "secondary-foreground": "oklch(0.985 0 0)",
2421
+ "chart-1": "oklch(0.811 0.111 293.571)",
2422
+ "chart-2": "oklch(0.606 0.25 292.717)",
2423
+ "chart-3": "oklch(0.541 0.281 293.009)",
2424
+ "chart-4": "oklch(0.491 0.27 292.581)",
2425
+ "chart-5": "oklch(0.432 0.232 292.759)",
2426
+ "sidebar-primary": "oklch(0.606 0.25 292.717)",
2427
+ "sidebar-primary-foreground": "oklch(0.969 0.016 293.756)"
2428
+ }
2429
+ },
2430
+ yellow: {
2431
+ light: {
2432
+ primary: "oklch(0.852 0.199 91.936)",
2433
+ "primary-foreground": "oklch(0.421 0.095 57.708)",
2434
+ secondary: "oklch(0.967 0.001 286.375)",
2435
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
2436
+ "chart-1": "oklch(0.905 0.182 98.111)",
2437
+ "chart-2": "oklch(0.795 0.184 86.047)",
2438
+ "chart-3": "oklch(0.681 0.162 75.834)",
2439
+ "chart-4": "oklch(0.554 0.135 66.442)",
2440
+ "chart-5": "oklch(0.476 0.114 61.907)",
2441
+ "sidebar-primary": "oklch(0.681 0.162 75.834)",
2442
+ "sidebar-primary-foreground": "oklch(0.987 0.026 102.212)"
2443
+ },
2444
+ dark: {
2445
+ primary: "oklch(0.795 0.184 86.047)",
2446
+ "primary-foreground": "oklch(0.421 0.095 57.708)",
2447
+ secondary: "oklch(0.274 0.006 286.033)",
2448
+ "secondary-foreground": "oklch(0.985 0 0)",
2449
+ "chart-1": "oklch(0.905 0.182 98.111)",
2450
+ "chart-2": "oklch(0.795 0.184 86.047)",
2451
+ "chart-3": "oklch(0.681 0.162 75.834)",
2452
+ "chart-4": "oklch(0.554 0.135 66.442)",
2453
+ "chart-5": "oklch(0.476 0.114 61.907)",
2454
+ "sidebar-primary": "oklch(0.795 0.184 86.047)",
2455
+ "sidebar-primary-foreground": "oklch(0.987 0.026 102.212)"
809
2456
  }
810
- spinner3.stop("Done.");
811
- } catch (e) {
812
- handleError(e);
813
2457
  }
814
- });
815
-
816
- // src/commands/init.ts
817
- import { existsSync as existsSync3 } from "node:fs";
818
- import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
819
- import path4 from "node:path";
820
- import * as p3 from "@clack/prompts";
821
- import { Command as Command2 } from "commander";
822
- import { execa as execa2 } from "execa";
2458
+ };
823
2459
 
824
- // src/utils/get-package-info.ts
825
- import fs from "node:fs";
826
- import { dirname, resolve } from "node:path";
827
- import { fileURLToPath } from "node:url";
828
- var __filename = fileURLToPath(import.meta.url);
829
- var __dirname = dirname(__filename);
830
- function getPackageInfo() {
831
- const location = resolve(__dirname, "..", "package.json");
832
- return readJSONSync(location);
833
- }
834
- function readJSONSync(path5) {
835
- const content = fs.readFileSync(path5, { encoding: "utf-8" });
836
- return JSON.parse(content);
2460
+ // ../registry/src/theme/index.ts
2461
+ var radii2 = {
2462
+ default: "0.625rem",
2463
+ none: "0px",
2464
+ small: "0.45rem",
2465
+ medium: "0.625rem",
2466
+ large: "0.875rem"
2467
+ };
2468
+ function resolvePalette(name, base2) {
2469
+ return name !== "gray" && isCompatiblePresetColor(name, base2) ? name : base2;
837
2470
  }
838
-
839
- // src/utils/templates.ts
840
- var UTILS = `import { type ClassValue, clsx } from "clsx"
841
- import { twMerge } from "tailwind-merge"
842
-
843
- export function cn(...inputs: ClassValue[]) {
844
- return twMerge(clsx(inputs))
2471
+ function resolvePresetTheme(preset) {
2472
+ const base2 = preset.baseColor === "gray" ? "neutral" : preset.baseColor;
2473
+ const theme = resolvePalette(preset.theme, base2);
2474
+ const chart = resolvePalette(preset.chartColor, base2);
2475
+ const translucentMenu = preset.menuColor.endsWith("translucent");
2476
+ const invertedMenu = preset.menuColor.startsWith("inverted");
2477
+ const radius = preset.style === "lyra" || preset.style === "sera" ? radii2.none : preset.style === "rhea" && preset.radius === "large" ? radii2.default : radii2[preset.radius];
2478
+ function colors(mode) {
2479
+ const merged = {
2480
+ ...palettes_default[base2][mode],
2481
+ ...palettes_default[theme][mode]
2482
+ };
2483
+ const chartColors = palettes_default[chart][mode];
2484
+ return {
2485
+ ...merged,
2486
+ "chart-1": chartColors["chart-1"],
2487
+ "chart-2": chartColors["chart-2"],
2488
+ "chart-3": chartColors["chart-3"],
2489
+ "chart-4": chartColors["chart-4"],
2490
+ "chart-5": chartColors["chart-5"],
2491
+ ...preset.menuAccent === "bold" && !translucentMenu && {
2492
+ accent: merged.primary,
2493
+ "accent-foreground": merged["primary-foreground"]
2494
+ },
2495
+ "destructive-foreground": mode === "dark" ? "oklch(0.58 0.22 27)" : "oklch(0.97 0.01 17)",
2496
+ surface: mode === "dark" ? "oklch(0.2 0 0)" : "oklch(0.98 0 0)",
2497
+ "surface-foreground": mode === "dark" ? "oklch(0.708 0 0)" : "var(--foreground)",
2498
+ code: "var(--surface)",
2499
+ "code-foreground": "var(--surface-foreground)",
2500
+ "code-highlight": "var(--accent)",
2501
+ "code-number": mode === "dark" ? "oklch(0.708 0 0)" : "oklch(0.556 0 0)",
2502
+ selection: mode === "dark" ? "oklch(0.922 0 0)" : "oklch(0 0 0)",
2503
+ "selection-foreground": mode === "dark" ? "oklch(0.205 0 0)" : "oklch(1 0 0)",
2504
+ radius
2505
+ };
2506
+ }
2507
+ return {
2508
+ light: colors("light"),
2509
+ dark: colors("dark"),
2510
+ radius,
2511
+ fontFamily: fontFamilies[preset.font],
2512
+ headingFamily: fontFamilies[preset.fontHeading === "inherit" ? preset.font : preset.fontHeading],
2513
+ translucentMenu,
2514
+ invertedMenu
2515
+ };
845
2516
  }
846
- `;
847
- var UTILS_JS = `import { clsx } from "clsx"
848
- import { twMerge } from "tailwind-merge"
849
2517
 
850
- export function cn(...inputs) {
851
- return twMerge(clsx(inputs))
2518
+ // ../registry/src/css.ts
2519
+ var DOCS_ONLY_TOKENS = /* @__PURE__ */ new Set([
2520
+ "destructive-foreground",
2521
+ "surface",
2522
+ "surface-foreground",
2523
+ "code",
2524
+ "code-foreground",
2525
+ "code-highlight",
2526
+ "code-number",
2527
+ "selection",
2528
+ "selection-foreground",
2529
+ "radius"
2530
+ ]);
2531
+ var RADIUS_SCALE = {
2532
+ sm: "calc(var(--radius) * 0.6)",
2533
+ md: "calc(var(--radius) * 0.8)",
2534
+ lg: "var(--radius)",
2535
+ xl: "calc(var(--radius) * 1.4)",
2536
+ "2xl": "calc(var(--radius) * 1.8)",
2537
+ "3xl": "calc(var(--radius) * 2.2)",
2538
+ "4xl": "calc(var(--radius) * 2.6)"
2539
+ };
2540
+ function themeTokens(colors) {
2541
+ return Object.entries(colors).filter(([key]) => !DOCS_ONLY_TOKENS.has(key));
852
2542
  }
853
- `;
854
- var TAILWIND_CONFIG = `/** @type {import('tailwindcss').Config} */
855
- export default {
856
- darkMode: ["variant", [".dark &", '[data-kb-theme="dark"] &']],
857
- content: ["./src/**/*.{ts,tsx}"],
858
- prefix: "<%- prefix %>",
859
- theme: {
860
- container: {
861
- center: true,
862
- padding: "2rem",
863
- screens: {
864
- "2xl": "1400px"
865
- }
866
- },
867
- extend: {
868
- colors: {
869
- border: "hsl(var(--border))",
870
- input: "hsl(var(--input))",
871
- ring: "hsl(var(--ring))",
872
- background: "hsl(var(--background))",
873
- foreground: "hsl(var(--foreground))",
874
- primary: {
875
- DEFAULT: "hsl(var(--primary))",
876
- foreground: "hsl(var(--primary-foreground))"
877
- },
878
- secondary: {
879
- DEFAULT: "hsl(var(--secondary))",
880
- foreground: "hsl(var(--secondary-foreground))"
881
- },
882
- destructive: {
883
- DEFAULT: "hsl(var(--destructive))",
884
- foreground: "hsl(var(--destructive-foreground))"
885
- },
886
- info: {
887
- DEFAULT: "hsl(var(--info))",
888
- foreground: "hsl(var(--info-foreground))"
889
- },
890
- success: {
891
- DEFAULT: "hsl(var(--success))",
892
- foreground: "hsl(var(--success-foreground))"
893
- },
894
- warning: {
895
- DEFAULT: "hsl(var(--warning))",
896
- foreground: "hsl(var(--warning-foreground))"
897
- },
898
- error: {
899
- DEFAULT: "hsl(var(--error))",
900
- foreground: "hsl(var(--error-foreground))"
901
- },
902
- muted: {
903
- DEFAULT: "hsl(var(--muted))",
904
- foreground: "hsl(var(--muted-foreground))"
905
- },
906
- accent: {
907
- DEFAULT: "hsl(var(--accent))",
908
- foreground: "hsl(var(--accent-foreground))"
909
- },
910
- popover: {
911
- DEFAULT: "hsl(var(--popover))",
912
- foreground: "hsl(var(--popover-foreground))"
913
- },
914
- card: {
915
- DEFAULT: "hsl(var(--card))",
916
- foreground: "hsl(var(--card-foreground))"
917
- }
918
- },
919
- borderRadius: {
920
- xl: "calc(var(--radius) + 4px)",
921
- lg: "var(--radius)",
922
- md: "calc(var(--radius) - 2px)",
923
- sm: "calc(var(--radius) - 4px)"
924
- },
925
- keyframes: {
926
- "accordion-down": {
927
- from: { height: 0 },
928
- to: { height: "var(--kb-accordion-content-height)" }
929
- },
930
- "accordion-up": {
931
- from: { height: "var(--kb-accordion-content-height)" },
932
- to: { height: 0 }
933
- },
934
- "content-show": {
935
- from: { opacity: 0, transform: "scale(0.96)" },
936
- to: { opacity: 1, transform: "scale(1)" }
937
- },
938
- "content-hide": {
939
- from: { opacity: 1, transform: "scale(1)" },
940
- to: { opacity: 0, transform: "scale(0.96)" }
941
- },
942
- "caret-blink": {
943
- "0%,70%,100%": { opacity: "1" },
944
- "20%,50%": { opacity: "0" }
945
- }
946
- },
947
- animation: {
948
- "accordion-down": "accordion-down 0.2s ease-out",
949
- "accordion-up": "accordion-up 0.2s ease-out",
950
- "content-show": "content-show 0.2s ease-out",
951
- "content-hide": "content-hide 0.2s ease-out",
952
- "caret-blink": "caret-blink 1.25s ease-out infinite"
953
- }
954
- }
955
- },
956
- plugins: [require("tailwindcss-animate")]
2543
+ function block(selector, declarations) {
2544
+ return `${selector} {
2545
+ ${declarations.map(([property, value]) => ` ${property}: ${value};`).join("\n")}
2546
+ }`;
2547
+ }
2548
+ function createThemeCss(preset) {
2549
+ const theme = resolvePresetTheme(preset);
2550
+ const light = themeTokens(theme.light);
2551
+ const dark = themeTokens(theme.dark);
2552
+ const [bodyFont] = presetFonts(preset);
2553
+ return [
2554
+ block(":root", [
2555
+ ["--radius", theme.radius],
2556
+ ...light.map(([key, value]) => [`--${key}`, value])
2557
+ ]),
2558
+ block(
2559
+ ".dark",
2560
+ dark.map(([key, value]) => [`--${key}`, value])
2561
+ ),
2562
+ block("@theme inline", [
2563
+ ["--font-sans", fontStack(bodyFont)],
2564
+ [
2565
+ "--font-heading",
2566
+ preset.fontHeading === "inherit" ? "var(--font-sans)" : fontStack(preset.fontHeading)
2567
+ ],
2568
+ ...light.map(([key]) => [
2569
+ `--color-${key}`,
2570
+ `var(--${key})`
2571
+ ]),
2572
+ ...Object.entries(RADIUS_SCALE).map(([size, value]) => [
2573
+ `--radius-${size}`,
2574
+ value
2575
+ ])
2576
+ ])
2577
+ ].join("\n\n");
2578
+ }
2579
+ function solidUiCssPackages(preset) {
2580
+ return ["tw-animate-css", ...presetFonts(preset).map(fontPackage)];
957
2581
  }
2582
+ function createSolidUiCss({
2583
+ preset,
2584
+ utilitiesCss,
2585
+ appCss = "your app stylesheet"
2586
+ }) {
2587
+ const header = `/*
2588
+ * Generated by solidui-cli from preset ${encodePreset(preset)} (style ${preset.style}).
2589
+ * Do not edit this file: \`npx solidui-cli init --force\` writes it again.
2590
+ * Put your own styles in ${appCss}.
2591
+ */`;
2592
+ return `${[
2593
+ header,
2594
+ solidUiCssPackages(preset).map((name) => `@import "${name}";`).join("\n"),
2595
+ "@custom-variant dark (&:is(.dark *));",
2596
+ utilitiesCss.replace(/\r\n?/g, "\n").trim(),
2597
+ createThemeCss(preset),
2598
+ `@layer base {
2599
+ * {
2600
+ @apply border-border outline-ring/50;
2601
+ }
2602
+ body {
2603
+ @apply bg-background text-foreground;
2604
+ }
2605
+ }`
2606
+ ].join("\n\n")}
958
2607
  `;
959
- var TAILWIND_CSS = `@tailwind base;
960
- @tailwind components;
961
- @tailwind utilities;
962
-
963
- @layer base {
964
- :root {
965
- --background: 0 0% 100%;
966
- --foreground: 240 10% 3.9%;
967
-
968
- --muted: 240 4.8% 95.9%;
969
- --muted-foreground: 240 3.8% 46.1%;
970
-
971
- --popover: 0 0% 100%;
972
- --popover-foreground: 240 10% 3.9%;
973
-
974
- --border: 240 5.9% 90%;
975
- --input: 240 5.9% 90%;
976
-
977
- --card: 0 0% 100%;
978
- --card-foreground: 240 10% 3.9%;
979
-
980
- --primary: 240 5.9% 10%;
981
- --primary-foreground: 0 0% 98%;
982
-
983
- --secondary: 240 4.8% 95.9%;
984
- --secondary-foreground: 240 5.9% 10%;
985
-
986
- --accent: 240 4.8% 95.9%;
987
- --accent-foreground: 240 5.9% 10%;
988
-
989
- --destructive: 0 84.2% 60.2%;
990
- --destructive-foreground: 0 0% 98%;
991
-
992
- --info: 204 94% 94%;
993
- --info-foreground: 199 89% 48%;
994
-
995
- --success: 149 80% 90%;
996
- --success-foreground: 160 84% 39%;
997
-
998
- --warning: 48 96% 89%;
999
- --warning-foreground: 25 95% 53%;
1000
-
1001
- --error: 0 93% 94%;
1002
- --error-foreground: 0 84% 60%;
1003
-
1004
- --ring: 240 5.9% 10%;
2608
+ }
1005
2609
 
1006
- --radius: 0.5rem;
2610
+ // ../registry/src/preset/defaults.ts
2611
+ var base = {
2612
+ baseColor: "neutral",
2613
+ theme: "neutral",
2614
+ chartColor: "neutral",
2615
+ fontHeading: "inherit",
2616
+ menuAccent: "subtle",
2617
+ menuColor: "default",
2618
+ radius: "default"
2619
+ };
2620
+ var DEFAULT_PRESETS = {
2621
+ nova: {
2622
+ title: "Nova",
2623
+ description: "Geist",
2624
+ preset: { ...base, style: "nova", font: "geist" }
2625
+ },
2626
+ vega: {
2627
+ title: "Vega",
2628
+ description: "Inter",
2629
+ preset: { ...base, style: "vega", font: "inter" }
2630
+ },
2631
+ maia: {
2632
+ title: "Maia",
2633
+ description: "Figtree",
2634
+ preset: { ...base, style: "maia", font: "figtree" }
2635
+ },
2636
+ lyra: {
2637
+ title: "Lyra",
2638
+ description: "JetBrains Mono",
2639
+ preset: normalizePreset({ ...base, style: "lyra", font: "jetbrains-mono" })
2640
+ },
2641
+ mira: {
2642
+ title: "Mira",
2643
+ description: "Inter",
2644
+ preset: { ...base, style: "mira", font: "inter" }
2645
+ },
2646
+ luma: {
2647
+ title: "Luma",
2648
+ description: "Inter",
2649
+ preset: { ...base, style: "luma", font: "inter" }
2650
+ },
2651
+ sera: {
2652
+ title: "Sera",
2653
+ description: "Noto Sans + Playfair Display",
2654
+ preset: normalizePreset({
2655
+ ...base,
2656
+ style: "sera",
2657
+ baseColor: "taupe",
2658
+ theme: "taupe",
2659
+ chartColor: "taupe",
2660
+ font: "noto-sans",
2661
+ fontHeading: "playfair-display"
2662
+ })
2663
+ },
2664
+ rhea: {
2665
+ title: "Rhea",
2666
+ description: "Inter",
2667
+ preset: { ...base, style: "rhea", font: "inter" }
1007
2668
  }
2669
+ };
2670
+ var DEFAULT_PRESET_NAME = "nova";
1008
2671
 
1009
- .dark,
1010
- [data-kb-theme="dark"] {
1011
- --background: 240 10% 3.9%;
1012
- --foreground: 0 0% 98%;
1013
-
1014
- --muted: 240 3.7% 15.9%;
1015
- --muted-foreground: 240 5% 64.9%;
1016
-
1017
- --accent: 240 3.7% 15.9%;
1018
- --accent-foreground: 0 0% 98%;
1019
-
1020
- --popover: 240 10% 3.9%;
1021
- --popover-foreground: 0 0% 98%;
1022
-
1023
- --border: 240 3.7% 15.9%;
1024
- --input: 240 3.7% 15.9%;
1025
-
1026
- --card: 240 10% 3.9%;
1027
- --card-foreground: 0 0% 98%;
1028
-
1029
- --primary: 0 0% 98%;
1030
- --primary-foreground: 240 5.9% 10%;
1031
-
1032
- --secondary: 240 3.7% 15.9%;
1033
- --secondary-foreground: 0 0% 98%;
1034
-
1035
- --destructive: 0 62.8% 30.6%;
1036
- --destructive-foreground: 0 0% 98%;
1037
-
1038
- --info: 204 94% 94%;
1039
- --info-foreground: 199 89% 48%;
2672
+ // src/commands/init.ts
2673
+ import { Command as Command2 } from "commander";
1040
2674
 
1041
- --success: 149 80% 90%;
1042
- --success-foreground: 160 84% 39%;
2675
+ // src/preflight/init.ts
2676
+ import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
2677
+ import path9 from "path";
2678
+ import semver2 from "semver";
1043
2679
 
1044
- --warning: 48 96% 89%;
1045
- --warning-foreground: 25 95% 53%;
2680
+ // src/project/css.ts
2681
+ import { readdirSync, readFileSync as readFileSync6 } from "fs";
2682
+ import path8 from "path";
2683
+ var IGNORED_DIRS = /* @__PURE__ */ new Set([
2684
+ "node_modules",
2685
+ "dist",
2686
+ "build",
2687
+ "public",
2688
+ "coverage",
2689
+ ".git",
2690
+ ".output",
2691
+ ".vinxi",
2692
+ ".astro",
2693
+ ".turbo"
2694
+ ]);
2695
+ var TAILWIND_IMPORT = /@import\s+(?:url\()?["']tailwindcss["']/;
2696
+ function importsTailwind(css) {
2697
+ return TAILWIND_IMPORT.test(css);
2698
+ }
2699
+ function findTailwindStylesheets(cwd, maxDepth = 5) {
2700
+ const found = [];
2701
+ const walk = (dir, depth) => {
2702
+ let entries;
2703
+ try {
2704
+ entries = readdirSync(dir, { withFileTypes: true });
2705
+ } catch {
2706
+ return;
2707
+ }
2708
+ for (const entry of entries) {
2709
+ const full = path8.join(dir, entry.name);
2710
+ if (entry.isDirectory()) {
2711
+ if (depth < maxDepth && !IGNORED_DIRS.has(entry.name))
2712
+ walk(full, depth + 1);
2713
+ } else if (entry.name.endsWith(".css")) {
2714
+ try {
2715
+ if (importsTailwind(readFileSync6(full, "utf8"))) {
2716
+ found.push(path8.relative(cwd, full).split(path8.sep).join("/"));
2717
+ }
2718
+ } catch {
2719
+ }
2720
+ }
2721
+ }
2722
+ };
2723
+ walk(cwd, 0);
2724
+ return found.sort();
2725
+ }
1046
2726
 
1047
- --error: 0 93% 94%;
1048
- --error-foreground: 0 84% 60%;
2727
+ // src/preflight/init.ts
2728
+ var LEGACY_MAJORS = {
2729
+ "solid-js": 2,
2730
+ tailwindcss: 4
2731
+ };
2732
+ function formatRanges() {
2733
+ const entries = Object.entries(SUPPORTED_VERSIONS.requirements);
2734
+ return entries.map(([name, range]) => ` ${name} ${range}`).join("\n");
2735
+ }
2736
+ function legacyMessage(found) {
2737
+ return [
2738
+ "solidui-cli 1.x requires Solid 2 and Tailwind CSS 4.",
2739
+ `Found ${found.join(", ")}.`,
2740
+ "",
2741
+ "These are the minimum requirements from solidui-cli 1.0 on. For the previous",
2742
+ "registry (Solid 1, Kobalte and Corvu, Tailwind CSS 3), use version",
2743
+ `${LEGACY_CLI_VERSION} directly:`,
2744
+ "",
2745
+ ` ${cliCommand("init", LEGACY_CLI_VERSION)}`,
2746
+ "",
2747
+ `To move to Solid 2, see ${MIGRATION_URL}.`
2748
+ ].join("\n");
2749
+ }
2750
+ function rangeMessage(cliVersion, found) {
2751
+ const describe = (entry) => "version" in entry ? `${entry.name} ${entry.version}` : entry.name;
2752
+ const newer = found.some(
2753
+ (entry) => "version" in entry && !isBelowRange(entry.version, SUPPORTED_VERSIONS.requirements[entry.name])
2754
+ );
2755
+ return [
2756
+ `solidui-cli ${cliVersion} supports these versions, which the Solid UI docs are tested with:`,
2757
+ formatRanges(),
2758
+ `Found ${found.map(describe).join(", ")}.`,
2759
+ "",
2760
+ newer ? `Newer versions are supported once a solidui-cli release has been tested with them.
2761
+ Check for one with: ${cliCommand("init")}` : "Update the packages listed above, then run init again."
2762
+ ].join("\n");
2763
+ }
2764
+ function runInitPreflight(cwd, options) {
2765
+ const issues = [];
2766
+ const error = (code, message) => issues.push({ level: "error", code, message });
2767
+ const warn = (code, message) => issues.push({ level: "warning", code, message });
2768
+ const pkg = readPackageJson(cwd);
2769
+ if (!pkg) {
2770
+ error(
2771
+ "no-project",
2772
+ `No package.json found in ${cwd}. Run init in the root of a Solid app.
2773
+ To create one, see ${INSTALLATION_URL}.`
2774
+ );
2775
+ return { ok: false, issues };
2776
+ }
2777
+ if (existsSync5(path9.join(cwd, LEGACY_CONFIG_FILE))) {
2778
+ error(
2779
+ "legacy-project",
2780
+ `${LEGACY_CONFIG_FILE} belongs to solidui-cli ${LEGACY_CLI_VERSION} and the Solid 1 registry.
2781
+ Keep using that version for this project:
1049
2782
 
1050
- --ring: 240 4.9% 83.9%;
2783
+ ${cliCommand("add <component>", LEGACY_CLI_VERSION)}
1051
2784
 
1052
- --radius: 0.5rem;
2785
+ To move to Solid UI 1.x, see ${MIGRATION_URL}.`
2786
+ );
1053
2787
  }
2788
+ const versions = {};
2789
+ for (const name of Object.keys(SUPPORTED_VERSIONS.requirements))
2790
+ versions[name] = resolveVersion(cwd, pkg, name);
2791
+ const legacy = Object.entries(LEGACY_MAJORS).flatMap(([name, major]) => {
2792
+ const entry = versions[name];
2793
+ return "version" in entry && majorOf(entry.version) < major ? [`${name} ${entry.version}`] : [];
2794
+ });
2795
+ if (legacy.length) error("legacy-versions", legacyMessage(legacy));
2796
+ const missing = legacy.length ? [] : Object.values(versions).filter((entry) => entry.source === "missing");
2797
+ for (const entry of missing)
2798
+ error(
2799
+ "missing-requirement",
2800
+ `${entry.name} is not installed. Install it, then run init again.
2801
+ See ${INSTALLATION_URL}.`
2802
+ );
2803
+ if (!legacy.length) {
2804
+ const outside = Object.values(versions).filter((entry) => {
2805
+ const range = SUPPORTED_VERSIONS.requirements[entry.name];
2806
+ if (entry.source === "installed")
2807
+ return !(satisfies(entry.version, range) || canUpdateInto(entry.version, range));
2808
+ if (entry.source === "declared")
2809
+ return !(semver2.intersects(entry.declared, range, {
2810
+ includePrerelease: true
2811
+ }) || canUpdateInto(entry.version, range));
2812
+ return false;
2813
+ });
2814
+ if (outside.length)
2815
+ error("unsupported-version", rangeMessage(options.cliVersion, outside));
2816
+ }
2817
+ let tailwindCss;
2818
+ if (options.css) {
2819
+ if (existsSync5(path9.resolve(cwd, options.css))) tailwindCss = options.css;
2820
+ else error("missing-css", `${options.css} does not exist.`);
2821
+ } else {
2822
+ const stylesheets = findTailwindStylesheets(cwd);
2823
+ if (stylesheets.length === 1) tailwindCss = stylesheets[0];
2824
+ else if (stylesheets.length > 1)
2825
+ error(
2826
+ "ambiguous-tailwind-css",
2827
+ `More than one stylesheet imports Tailwind CSS: ${stylesheets.join(", ")}.
2828
+ Pick the app stylesheet with --css <file>.`
2829
+ );
2830
+ else if (!legacy.length && versions.tailwindcss?.source !== "missing")
2831
+ error(
2832
+ "no-tailwind-css",
2833
+ `No stylesheet imports Tailwind CSS. Add \`@import "tailwindcss";\` to your app stylesheet.
2834
+ See https://tailwindcss.com/docs/installation/using-vite.`
2835
+ );
2836
+ }
2837
+ const tsconfig = findAppTsConfig(cwd);
2838
+ if (!tsconfig || !declaredRange(pkg, "typescript")) {
2839
+ error(
2840
+ "no-typescript",
2841
+ "solidui-cli 1.x installs TypeScript source and needs a TypeScript project: a tsconfig.json and the typescript package."
2842
+ );
2843
+ } else {
2844
+ const source = tsconfig.config.compilerOptions?.jsxImportSource;
2845
+ if (source !== "@solidjs/web")
2846
+ warn(
2847
+ "jsx-import-source",
2848
+ `${path9.basename(tsconfig.path)} sets jsxImportSource to ${source ?? "nothing"}. Solid 2 components need "@solidjs/web".`
2849
+ );
2850
+ }
2851
+ if (issues.some((issue) => issue.level === "error") || !tsconfig || !tailwindCss)
2852
+ return { ok: false, issues };
2853
+ const configPath = path9.join(cwd, CONFIG_FILE);
2854
+ let configAliases = null;
2855
+ try {
2856
+ const parsed = componentsJsonSchema.safeParse(
2857
+ JSON.parse(readFileSync7(configPath, "utf8"))
2858
+ );
2859
+ if (parsed.success) configAliases = parsed.data.aliases;
2860
+ } catch {
2861
+ }
2862
+ return {
2863
+ ok: true,
2864
+ issues,
2865
+ project: {
2866
+ cwd,
2867
+ tailwindCss,
2868
+ tsconfig,
2869
+ aliasTarget: existsSync5(path9.join(cwd, "src")) ? "./src/*" : "./*",
2870
+ hasConfig: existsSync5(configPath),
2871
+ configAliases,
2872
+ needsInstall: Object.values(versions).some(
2873
+ (entry) => entry.source === "declared" || entry.source === "unresolved"
2874
+ ),
2875
+ versions
2876
+ }
2877
+ };
1054
2878
  }
1055
2879
 
1056
- @layer base {
1057
- * {
1058
- @apply border-border;
2880
+ // src/project/app-css.ts
2881
+ var TAILWIND_IMPORT2 = /^[ \t]*@import\s+(?:url\()?["']tailwindcss["'][^;\n]*;[ \t]*(?:\r?\n|$)/m;
2882
+ var LAYER = /^\s*@layer\s+ui-sdk\s*;/m;
2883
+ function solidUiImport(file = "solid-ui.css") {
2884
+ return `@import "./${file}";`;
2885
+ }
2886
+ function patchAppCss(css, file = "solid-ui.css") {
2887
+ const eol = css.includes("\r\n") ? "\r\n" : "\n";
2888
+ let output = css;
2889
+ const importPattern = new RegExp(
2890
+ `@import\\s+(?:url\\()?["']\\./${file.replace(/\./g, "\\.")}["']`
2891
+ );
2892
+ if (!importPattern.test(output)) {
2893
+ const match = TAILWIND_IMPORT2.exec(output);
2894
+ if (!match) throw new Error('The stylesheet has no @import "tailwindcss".');
2895
+ const end = match.index + match[0].length;
2896
+ const separator = match[0].endsWith("\n") ? "" : eol;
2897
+ output = `${output.slice(0, end)}${separator}${solidUiImport(file)}${eol}${output.slice(end)}`;
1059
2898
  }
1060
- body {
1061
- @apply bg-background text-foreground;
1062
- font-feature-settings:
1063
- "rlig" 1,
1064
- "calt" 1;
2899
+ if (!LAYER.test(output)) {
2900
+ const charset = /^@charset[^;]*;[ \t]*\r?\n?/.exec(output);
2901
+ const at = charset ? charset[0].length : 0;
2902
+ output = `${output.slice(0, at)}@layer ui-sdk;${eol}${eol}${output.slice(at)}`;
1065
2903
  }
2904
+ return output;
1066
2905
  }
1067
2906
 
1068
- @layer utilities {
1069
- .step {
1070
- counter-increment: step;
2907
+ // src/project/vite.ts
2908
+ import { existsSync as existsSync6, readFileSync as readFileSync8 } from "fs";
2909
+ import path10 from "path";
2910
+ import { parse as parse2 } from "@babel/parser";
2911
+ var CONFIG_NAMES = [
2912
+ "vite.config.ts",
2913
+ "vite.config.mts",
2914
+ "vite.config.js",
2915
+ "vite.config.mjs",
2916
+ "vite.config.cts",
2917
+ "vite.config.cjs"
2918
+ ];
2919
+ var TSCONFIG_PATHS_ENTRY = "resolve: { tsconfigPaths: true }";
2920
+ var TSCONFIG_PATHS_SNIPPET = `export default defineConfig({
2921
+ ${TSCONFIG_PATHS_ENTRY},
2922
+ plugins: [solid(), tailwindcss()]
2923
+ })`;
2924
+ function findViteConfig(cwd) {
2925
+ for (const name of CONFIG_NAMES) {
2926
+ const file = path10.join(cwd, name);
2927
+ if (existsSync6(file)) return file;
1071
2928
  }
1072
-
1073
- .step:before {
1074
- @apply absolute w-9 h-9 bg-muted rounded-full font-mono font-medium text-center text-base inline-flex items-center justify-center -indent-px border-4 border-background;
1075
- @apply ml-[-50px] mt-[-4px];
1076
- content: counter(step);
2929
+ return null;
2930
+ }
2931
+ function readViteConfig(cwd, prefix = "~") {
2932
+ const file = findViteConfig(cwd);
2933
+ if (!file) return null;
2934
+ const text2 = readFileSync8(file, "utf8");
2935
+ return { path: file, text: text2, plan: planViteAlias(text2, file, prefix) };
2936
+ }
2937
+ function manual(reason) {
2938
+ return { kind: "manual", reason };
2939
+ }
2940
+ function unwrap(node) {
2941
+ while (node && (node.type === "TSSatisfiesExpression" || node.type === "TSAsExpression" || node.type === "TSTypeAssertion" || node.type === "TSNonNullExpression" || node.type === "ParenthesizedExpression"))
2942
+ node = node.expression;
2943
+ return node;
2944
+ }
2945
+ function keyName(property) {
2946
+ if (property.type === "SpreadElement" || property.computed) return void 0;
2947
+ const { key } = property;
2948
+ if (key.type === "Identifier") return key.name;
2949
+ if (key.type === "StringLiteral") return key.value;
2950
+ return void 0;
2951
+ }
2952
+ function findProperty(object, name) {
2953
+ return object.properties.find((property) => keyName(property) === name);
2954
+ }
2955
+ function propertyValue(object, name) {
2956
+ const property = findProperty(object, name);
2957
+ return property?.type === "ObjectProperty" ? unwrap(property.value) : void 0;
2958
+ }
2959
+ function hasSpread(object) {
2960
+ return object.properties.some((property) => property.type === "SpreadElement");
2961
+ }
2962
+ function findBinding(program, name) {
2963
+ for (const statement of program.body) {
2964
+ if (statement.type !== "VariableDeclaration") continue;
2965
+ for (const declarator of statement.declarations)
2966
+ if (declarator.id.type === "Identifier" && declarator.id.name === name)
2967
+ return unwrap(declarator.init);
1077
2968
  }
2969
+ return void 0;
1078
2970
  }
1079
-
1080
- @media (max-width: 640px) {
1081
- .container {
1082
- @apply px-4;
2971
+ function findConfigObject(program) {
2972
+ const exported = program.body.find(
2973
+ (statement) => statement.type === "ExportDefaultDeclaration"
2974
+ );
2975
+ if (!exported) return "it has no export default";
2976
+ let node = unwrap(exported.declaration);
2977
+ for (let depth = 0; node && depth < 5; depth++) {
2978
+ if (node.type === "ObjectExpression") return node;
2979
+ if (node.type === "Identifier") {
2980
+ node = findBinding(program, node.name);
2981
+ continue;
2982
+ }
2983
+ if (node.type === "CallExpression") {
2984
+ const { callee } = node;
2985
+ if (callee.type !== "Identifier" || callee.name !== "defineConfig")
2986
+ return `its export default calls ${callee.type === "Identifier" ? callee.name : "a function"} instead of defineConfig`;
2987
+ node = unwrap(node.arguments[0]);
2988
+ continue;
2989
+ }
2990
+ if (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression") {
2991
+ if (node.body.type !== "BlockStatement") {
2992
+ node = unwrap(node.body);
2993
+ continue;
2994
+ }
2995
+ const returns = node.body.body.filter(
2996
+ (statement) => statement.type === "ReturnStatement"
2997
+ );
2998
+ if (returns.length !== 1)
2999
+ return "its config function doesn't return a single object";
3000
+ node = unwrap(returns[0].argument);
3001
+ continue;
3002
+ }
3003
+ break;
1083
3004
  }
3005
+ return "its export default is not a config object";
1084
3006
  }
1085
-
1086
- ::-webkit-scrollbar {
1087
- width: 16px;
3007
+ function isPrefix(node, prefix) {
3008
+ node = unwrap(node);
3009
+ if (node?.type === "StringLiteral")
3010
+ return node.value === prefix || node.value === `${prefix}/`;
3011
+ if (node?.type === "RegExpLiteral")
3012
+ return node.pattern.startsWith(`^${prefix}`);
3013
+ return false;
1088
3014
  }
1089
-
1090
- ::-webkit-scrollbar-thumb {
1091
- border-radius: 9999px;
1092
- border: 4px solid transparent;
1093
- background-clip: content-box;
1094
- @apply bg-accent;
3015
+ function aliasesPrefix(resolve, prefix) {
3016
+ const alias = propertyValue(resolve, "alias");
3017
+ if (alias?.type === "ObjectExpression")
3018
+ return alias.properties.some(
3019
+ (property) => [prefix, `${prefix}/`].includes(keyName(property) ?? "")
3020
+ );
3021
+ if (alias?.type === "ArrayExpression")
3022
+ return alias.elements.some((element) => {
3023
+ const entry = unwrap(element);
3024
+ return entry?.type === "ObjectExpression" && isPrefix(propertyValue(entry, "find"), prefix);
3025
+ });
3026
+ return false;
1095
3027
  }
1096
-
1097
- ::-webkit-scrollbar-corner {
1098
- display: none;
3028
+ function usesTsconfigPathsPlugin(program, config) {
3029
+ const names = /* @__PURE__ */ new Set(["tsconfigPaths"]);
3030
+ for (const statement of program.body)
3031
+ if (statement.type === "ImportDeclaration" && statement.source.value === "vite-tsconfig-paths")
3032
+ for (const specifier of statement.specifiers)
3033
+ names.add(specifier.local.name);
3034
+ const plugins = propertyValue(config, "plugins");
3035
+ if (plugins?.type !== "ArrayExpression") return false;
3036
+ return plugins.elements.some((element) => {
3037
+ const call = unwrap(element);
3038
+ return call?.type === "CallExpression" && call.callee.type === "Identifier" && names.has(call.callee.name);
3039
+ });
3040
+ }
3041
+ function splice(text2, start, insert, end = start) {
3042
+ return text2.slice(0, start) + insert + text2.slice(end);
3043
+ }
3044
+ function lineIndent(text2, offset) {
3045
+ const lineStart = text2.lastIndexOf("\n", offset - 1) + 1;
3046
+ return /^[ \t]*/.exec(text2.slice(lineStart))[0];
3047
+ }
3048
+ function propertyStart(property) {
3049
+ return Math.min(
3050
+ property.start,
3051
+ ...(property.leadingComments ?? []).map((comment) => comment.start)
3052
+ );
3053
+ }
3054
+ function insertFirst(text2, object, entry) {
3055
+ const first = object.properties[0];
3056
+ if (!first) {
3057
+ const inner = text2.slice(object.start + 1, object.end - 1);
3058
+ return inner.trim() ? (
3059
+ // Only comments inside; they stay after the new entry.
3060
+ splice(text2, object.start + 1, ` ${entry},${inner}`, object.end - 1)
3061
+ ) : splice(text2, object.start, `{ ${entry} }`, object.end);
3062
+ }
3063
+ const start = propertyStart(first);
3064
+ const multiline = text2.slice(object.start, start).includes("\n");
3065
+ const newline = text2.includes("\r\n") ? "\r\n" : "\n";
3066
+ return splice(
3067
+ text2,
3068
+ start,
3069
+ multiline ? `${entry},${newline}${lineIndent(text2, start)}` : `${entry}, `
3070
+ );
3071
+ }
3072
+ function planViteAlias(text2, file = "vite.config.ts", prefix = "~") {
3073
+ let program;
3074
+ try {
3075
+ program = parse2(text2, {
3076
+ sourceType: "module",
3077
+ plugins: /\.[cm]?ts$/.test(file) ? ["typescript"] : []
3078
+ }).program;
3079
+ } catch {
3080
+ return manual("init could not parse it");
3081
+ }
3082
+ const config = findConfigObject(program);
3083
+ if (typeof config === "string") return manual(config);
3084
+ if (usesTsconfigPathsPlugin(program, config)) return { kind: "resolved" };
3085
+ if (!findProperty(config, "resolve")) {
3086
+ if (hasSpread(config)) return manual("its config spreads other options");
3087
+ return {
3088
+ kind: "patch",
3089
+ enable: false,
3090
+ text: insertFirst(text2, config, TSCONFIG_PATHS_ENTRY)
3091
+ };
3092
+ }
3093
+ const resolve = propertyValue(config, "resolve");
3094
+ if (resolve?.type !== "ObjectExpression")
3095
+ return manual("its resolve option is not an object literal");
3096
+ if (aliasesPrefix(resolve, prefix)) return { kind: "resolved" };
3097
+ if (!findProperty(resolve, "tsconfigPaths")) {
3098
+ if (hasSpread(resolve))
3099
+ return manual("its resolve option spreads other options");
3100
+ return {
3101
+ kind: "patch",
3102
+ enable: false,
3103
+ text: insertFirst(text2, resolve, "tsconfigPaths: true")
3104
+ };
3105
+ }
3106
+ const flag = propertyValue(resolve, "tsconfigPaths");
3107
+ if (flag?.type !== "BooleanLiteral")
3108
+ return manual("its resolve.tsconfigPaths is not true or false");
3109
+ if (flag.value) return { kind: "resolved" };
3110
+ return {
3111
+ kind: "patch",
3112
+ enable: true,
3113
+ text: splice(text2, flag.start, "true", flag.end)
3114
+ };
1099
3115
  }
1100
- `;
1101
3116
 
1102
3117
  // src/commands/init.ts
1103
- var PROJECT_DEPENDENCIES = [
1104
- "tailwindcss-animate",
1105
- "class-variance-authority",
1106
- "clsx",
1107
- "tailwind-merge"
1108
- ];
1109
- var initOptionsSchema = object({
1110
- cwd: string()
1111
- });
1112
- var init = new Command2().name("init").description("initialize your project and install dependencies").option("-c, --cwd <cwd>", "the working directory", process.cwd()).action(async (opts) => {
1113
- try {
1114
- const options = parse(initOptionsSchema, opts);
1115
- const cwd = path4.resolve(options.cwd);
1116
- if (!existsSync3(cwd)) {
1117
- throw new Error(`The path ${cwd} does not exist. Please try again.`);
1118
- }
1119
- const info = getPackageInfo();
1120
- p3.intro(headline(` ${info.name} - ${info.version} `));
1121
- const rawConfig = await promptForConfig();
1122
- const spinner3 = p3.spinner();
1123
- spinner3.start(`Creating ui.config.json...`);
1124
- const targetPath = path4.resolve(cwd, "ui.config.json");
1125
- await writeFile2(targetPath, JSON.stringify(rawConfig, null, 2), "utf-8");
1126
- spinner3.stop(`ui.config.json created.`);
1127
- const config = await resolveConfigPaths(cwd, rawConfig);
1128
- spinner3.start(`Initializing project...`);
1129
- for (const [key, resolvedPath] of Object.entries(config.resolvedPaths)) {
1130
- let dirname2 = path4.extname(resolvedPath) ? path4.dirname(resolvedPath) : resolvedPath;
1131
- if (key === "utils" && resolvedPath.endsWith("/utils")) {
1132
- dirname2 = dirname2.replace(/\/utils$/, "");
1133
- }
1134
- if (!existsSync3(dirname2)) {
1135
- await mkdir2(dirname2, { recursive: true });
1136
- }
3118
+ var BASE_PACKAGES = ["class-variance-authority"];
3119
+ function spec(name) {
3120
+ const range = supportedRange(name);
3121
+ return range ? `${name}@${range}` : name;
3122
+ }
3123
+ function rel(cwd, file) {
3124
+ return path11.relative(cwd, file).split(path11.sep).join("/");
3125
+ }
3126
+ async function planViteStep(vite, options, ui, interactive) {
3127
+ if (!vite) return { kind: "manual", reason: "the project has no vite.config" };
3128
+ const { plan } = vite;
3129
+ if (plan.kind === "resolved") return { kind: "none" };
3130
+ if (plan.kind === "manual") return plan;
3131
+ if (plan.enable && interactive && !options.yes && !await ui.confirm(
3132
+ `${path11.basename(vite.path)} sets resolve.tsconfigPaths to false. Solid UI components import through the tsconfig paths alias, which needs it. Set it to true?`,
3133
+ true
3134
+ ))
3135
+ return { kind: "manual", reason: "you kept resolve.tsconfigPaths: false" };
3136
+ return {
3137
+ kind: "write",
3138
+ path: vite.path,
3139
+ text: plan.text,
3140
+ enable: plan.enable
3141
+ };
3142
+ }
3143
+ function versionsOutsideRanges(cwd) {
3144
+ const pkg = readPackageJson(cwd) ?? {};
3145
+ return Object.entries(SUPPORTED_VERSIONS.requirements).flatMap(
3146
+ ([name, range]) => {
3147
+ const found = resolveVersion(cwd, pkg, name);
3148
+ return found.source === "installed" && !satisfies(found.version, range) ? [
3149
+ {
3150
+ name,
3151
+ version: found.version,
3152
+ range,
3153
+ dev: Boolean(pkg.devDependencies?.[name])
3154
+ }
3155
+ ] : [];
1137
3156
  }
1138
- const extension = config.tsx ? "ts" : "js";
1139
- await writeFile2(
1140
- config.resolvedPaths.tailwindConfig,
1141
- TAILWIND_CONFIG.replace("<%- prefix %>", config.tailwind.prefix),
1142
- "utf-8"
3157
+ );
3158
+ }
3159
+ async function alignVersions(cwd, agent, install, ui, { ask, yes, required }) {
3160
+ const outside = versionsOutsideRanges(cwd);
3161
+ if (!outside.length) return;
3162
+ const stuck = outside.filter(
3163
+ ({ version, range }) => !canUpdateInto(version, range)
3164
+ );
3165
+ if (stuck.length) {
3166
+ const message = rangeMessage(
3167
+ CLI_VERSION,
3168
+ stuck.map(({ name, version }) => ({ name, source: "installed", version }))
1143
3169
  );
1144
- await writeFile2(config.resolvedPaths.tailwindCss, TAILWIND_CSS, "utf-8");
1145
- await writeFile2(
1146
- `${config.resolvedPaths.utils}.${extension}`,
1147
- extension === "ts" ? UTILS : UTILS_JS,
1148
- "utf-8"
3170
+ if (required) throw new CliError(message);
3171
+ ui.warn(message);
3172
+ return;
3173
+ }
3174
+ const groups = [false, true].map((dev) => ({
3175
+ dev,
3176
+ specs: outside.filter((entry) => entry.dev === dev).map(({ name, range }) => `${name}@${range}`)
3177
+ })).filter(({ specs }) => specs.length);
3178
+ ui.warn(
3179
+ [
3180
+ `These packages are older than the versions ${CLI_NAME} ${CLI_VERSION} supports:`,
3181
+ ...outside.map(
3182
+ ({ name, version, range }) => ` ${name} ${version} (needs ${range})`
3183
+ )
3184
+ ].join("\n")
3185
+ );
3186
+ if (yes || ask && await ui.confirm("Update them now?", true)) {
3187
+ const names = outside.map(({ name }) => name).join(", ");
3188
+ await ui.task(
3189
+ `Updating ${names} with ${agent}`,
3190
+ async () => {
3191
+ for (const { dev, specs } of groups)
3192
+ await install(cwd, specs, { agent, dev });
3193
+ },
3194
+ `${color.changed("Updated")} ${names}`
1149
3195
  );
1150
- spinner3.stop(`Project initialized.`);
1151
- spinner3.start(`Installing dependencies...`);
1152
- const packageManager = await getPackageManager(cwd);
1153
- await execa2(packageManager, ["add", ...PROJECT_DEPENDENCIES], { cwd });
1154
- spinner3.stop(`Dependencies installed.`);
1155
- p3.outro(
1156
- `${highlight("Success!")} Project initialization completed. You may now add components.`
3196
+ return;
3197
+ }
3198
+ const commands = groups.map(
3199
+ ({ dev, specs }) => ` ${color.command(formatCommand(installCommand(specs, { agent, dev })))}`
3200
+ ).join("\n");
3201
+ if (required)
3202
+ throw new CliError(
3203
+ `Update them with:
3204
+
3205
+ ${commands}
3206
+
3207
+ Then run init again.`
1157
3208
  );
1158
- } catch (e) {
1159
- handleError(e);
3209
+ ui.info(`Update them with:
3210
+
3211
+ ${commands}`);
3212
+ }
3213
+ function parseAlias(input) {
3214
+ const prefix = input.trim().replace(/\/\*?$/, "");
3215
+ return /^[^\s/*.][^\s/*]*$/.test(prefix) ? prefix : null;
3216
+ }
3217
+ async function chooseAliases(options, existing, ui, interactive) {
3218
+ if (options.alias) {
3219
+ const prefix = parseAlias(options.alias);
3220
+ if (!prefix)
3221
+ throw new CliError(
3222
+ `${options.alias} is not an import alias. Use a prefix such as ~ or @.`
3223
+ );
3224
+ return aliasesFor(prefix);
1160
3225
  }
1161
- });
1162
- async function promptForConfig() {
1163
- const options = await p3.group(
3226
+ if (existing) return existing;
3227
+ if (!interactive || options.yes) return aliasesFor(DEFAULT_ALIAS);
3228
+ const answer = await ui.text(
3229
+ "Which import alias should the components use?",
3230
+ DEFAULT_ALIAS,
3231
+ (value) => parseAlias(value) ? void 0 : "Use a prefix such as ~ or @."
3232
+ );
3233
+ return aliasesFor(parseAlias(answer));
3234
+ }
3235
+ async function choosePreset(options, ui, interactive) {
3236
+ if (options.preset) {
3237
+ const preset = parsePresetInput(options.preset);
3238
+ if (!preset)
3239
+ throw new CliError(
3240
+ `${options.preset} is not a preset code. Copy one from ${CREATE_URL}.`
3241
+ );
3242
+ return normalizePreset(preset);
3243
+ }
3244
+ if (options.yes) return DEFAULT_PRESETS[DEFAULT_PRESET_NAME].preset;
3245
+ if (!interactive)
3246
+ throw new CliError(
3247
+ "Pass --preset <code> or --yes when init can't ask, for example in CI."
3248
+ );
3249
+ const choice = await ui.select(
3250
+ "Which preset would you like to start from?",
3251
+ [
3252
+ ...Object.entries(DEFAULT_PRESETS).map(([value, named]) => ({
3253
+ value,
3254
+ label: named.title,
3255
+ hint: named.description
3256
+ })),
3257
+ { value: "custom", label: "Custom", hint: `build one at ${CREATE_URL}` }
3258
+ ],
3259
+ DEFAULT_PRESET_NAME
3260
+ );
3261
+ if (choice === "custom") {
3262
+ ui.note(
3263
+ `Build your preset at ${CREATE_URL}, then run the command it copies:
3264
+
3265
+ ${color.command(cliCommand("init --preset <code>"))}`,
3266
+ "Custom preset"
3267
+ );
3268
+ return null;
3269
+ }
3270
+ return DEFAULT_PRESETS[choice].preset;
3271
+ }
3272
+ async function runInit(options, deps = {}) {
3273
+ const ui = deps.ui ?? terminalUi;
3274
+ const interactive = deps.interactive ?? Boolean(process.stdin.isTTY);
3275
+ const install = deps.install ?? installPackages;
3276
+ const cwd = path11.resolve(options.cwd);
3277
+ ui.intro(badge());
3278
+ const preflight = runInitPreflight(cwd, {
3279
+ cliVersion: CLI_VERSION,
3280
+ ...options.css ? { css: options.css } : {}
3281
+ });
3282
+ for (const issue of preflight.issues)
3283
+ (issue.level === "error" ? ui.error : ui.warn)(issue.message);
3284
+ if (!preflight.ok)
3285
+ throw new CliError("init stopped before changing anything.");
3286
+ const project = preflight.project;
3287
+ if (project.hasConfig && !options.force) {
3288
+ const replace = interactive && !options.yes && await ui.confirm(`${CONFIG_FILE} already exists. Replace it?`, false);
3289
+ if (!replace)
3290
+ throw new CliError(
3291
+ `${CONFIG_FILE} already exists. Run init with --force to replace it and regenerate solid-ui.css.`
3292
+ );
3293
+ }
3294
+ const preset = await choosePreset(options, ui, interactive);
3295
+ if (!preset) return;
3296
+ const code = encodePreset(preset);
3297
+ const aliases = await chooseAliases(
3298
+ options,
3299
+ project.configAliases,
3300
+ ui,
3301
+ interactive
3302
+ );
3303
+ const prefix = aliases.lib.slice(0, aliases.lib.indexOf("/"));
3304
+ const agent = detectAgent(cwd);
3305
+ const align = { ask: interactive && !options.yes, yes: options.yes };
3306
+ if (project.needsInstall) {
3307
+ await ui.task(
3308
+ `Installing dependencies with ${agent}`,
3309
+ () => install(cwd, [], { agent }),
3310
+ `Installed dependencies with ${agent}.`
3311
+ );
3312
+ const pkg = readPackageJson(cwd) ?? {};
3313
+ const missing = Object.keys(SUPPORTED_VERSIONS.requirements).filter(
3314
+ (name) => resolveVersion(cwd, pkg, name).source !== "installed"
3315
+ );
3316
+ if (missing.length)
3317
+ throw new CliError(
3318
+ `${missing.join(", ")} still ${missing.length === 1 ? "isn't" : "aren't"} installed after ${agent} install.`
3319
+ );
3320
+ }
3321
+ await alignVersions(cwd, agent, install, ui, { ...align, required: true });
3322
+ const client = deps.client ?? createRegistryClient();
3323
+ const [utils, utilities] = await ui.task(
3324
+ `Loading the ${preset.style} style from ${client.baseUrl}`,
3325
+ () => Promise.all([
3326
+ client.item(preset.style, "utils"),
3327
+ client.item(preset.style, "style-utilities")
3328
+ ]),
3329
+ `Loaded the ${preset.style} style for preset ${color.command(code)}.`
3330
+ );
3331
+ const utilitiesCss = utilities?.files?.[0]?.content;
3332
+ if (!utils?.files?.length || !utilitiesCss)
3333
+ throw new CliError(
3334
+ `The registry at ${client.baseUrl} is missing the utils or style-utilities item for ${preset.style}.`
3335
+ );
3336
+ const config = {
3337
+ $schema: CONFIG_SCHEMA_URL,
3338
+ style: preset.style,
3339
+ preset: code,
3340
+ tailwind: { css: project.tailwindCss },
3341
+ menuColor: preset.menuColor,
3342
+ menuAccent: preset.menuAccent,
3343
+ aliases
3344
+ };
3345
+ const needsAlias = !resolveAlias(project.tsconfig, aliases.lib);
3346
+ const tsconfig = needsAlias ? addPathAlias(project.tsconfig, prefix, project.aliasTarget) : project.tsconfig;
3347
+ const appCssPath = path11.resolve(cwd, project.tailwindCss);
3348
+ const solidUiCssPath = path11.join(path11.dirname(appCssPath), "solid-ui.css");
3349
+ const appCss = readFileSync9(appCssPath, "utf8");
3350
+ const patchedAppCss = patchAppCss(appCss);
3351
+ const owned = [
1164
3352
  {
1165
- typescript: () => p3.confirm({
1166
- message: `Would you like to use ${highlight("Typescript")} (recommended)?`,
1167
- initialValue: true
1168
- }),
1169
- cssFile: () => p3.text({
1170
- message: `Where is your ${highlight("global CSS")} file? ${subtle("(this file will be overwritten)")}`,
1171
- initialValue: DEFAULT_CSS_FILE
1172
- }),
1173
- tailwindConfig: () => p3.text({
1174
- message: `Where is your ${highlight("Tailwind config")} located? ${subtle("(this file will be overwritten)")}`,
1175
- initialValue: DEFAULT_TAILWIND_CONFIG
1176
- }),
1177
- tailwindPrefix: () => p3.text({
1178
- message: `Are you using a custom ${highlight("tailwind prefix eg. tw-")}? (Leave blank if not)`,
1179
- initialValue: DEFAULT_TAILWIND_PREFIX
1180
- }),
1181
- components: () => p3.text({
1182
- message: `Configure the import alias for ${highlight("components")}:`,
1183
- initialValue: DEFAULT_COMPONENTS
1184
- }),
1185
- utils: () => p3.text({
1186
- message: `Configure the import alias for ${highlight("utils")}:`,
1187
- initialValue: DEFAULT_UTILS
1188
- })
3353
+ path: path11.join(cwd, CONFIG_FILE),
3354
+ content: JSON.stringify(config, null, 2)
1189
3355
  },
1190
3356
  {
1191
- onCancel: () => {
1192
- p3.cancel("Cancelled.");
1193
- process.exit(0);
1194
- }
3357
+ path: solidUiCssPath,
3358
+ content: createSolidUiCss({
3359
+ preset,
3360
+ utilitiesCss,
3361
+ appCss: path11.basename(appCssPath)
3362
+ })
1195
3363
  }
3364
+ ];
3365
+ const source = (utils.files ?? []).map((file) => ({
3366
+ path: resolveTargetPath(file, config, tsconfig, cwd),
3367
+ content: transformSource(file.path, file.content ?? "", config)
3368
+ }));
3369
+ const plan = planDependencies(cwd, readPackageJson(cwd) ?? {}, [
3370
+ ...utils.dependencies ?? [],
3371
+ ...BASE_PACKAGES.map(spec),
3372
+ ...solidUiCssPackages(preset).map(spec)
3373
+ ]);
3374
+ const vite = readViteConfig(cwd, prefix);
3375
+ const viteStep = await planViteStep(vite, options, ui, interactive);
3376
+ const viteName = vite ? rel(cwd, vite.path) : "vite.config.ts";
3377
+ const update = (file, note2, write) => ui.task(
3378
+ `Updating ${file}`,
3379
+ async () => write(),
3380
+ `${color.changed("Updated")} ${file}${note2 ? ` ${color.muted(`(${note2})`)}` : ""}`
1196
3381
  );
1197
- return parse(RawConfigSchema, {
1198
- $schema: "https://solid-ui.com/schema.json",
1199
- tsx: options.typescript,
1200
- tailwind: {
1201
- css: options.cssFile,
1202
- config: options.tailwindConfig,
1203
- prefix: options.tailwindPrefix
1204
- },
1205
- aliases: {
1206
- components: options.components,
1207
- utils: options.utils
1208
- }
3382
+ const written = await applyFiles(owned, cwd, ui, { overwrite: true });
3383
+ if (appCss !== patchedAppCss)
3384
+ await update(
3385
+ project.tailwindCss,
3386
+ "",
3387
+ () => writeFileSync2(appCssPath, patchedAppCss)
3388
+ );
3389
+ if (needsAlias)
3390
+ await update(
3391
+ rel(cwd, tsconfig.path),
3392
+ `added "${prefix}/*"`,
3393
+ () => writeFileSync2(tsconfig.path, tsconfig.text)
3394
+ );
3395
+ if (viteStep.kind === "write") {
3396
+ const { path: vitePath, text: text2, enable } = viteStep;
3397
+ await update(
3398
+ viteName,
3399
+ enable ? "set resolve.tsconfigPaths to true" : "added resolve.tsconfigPaths",
3400
+ () => writeFileSync2(vitePath, text2)
3401
+ );
3402
+ }
3403
+ const kept = await applyFiles(source, cwd, ui, {
3404
+ overwrite: false,
3405
+ confirm: async (file) => interactive && !options.yes && ui.confirm(
3406
+ `${file} differs from the registry version. Replace it?`,
3407
+ false
3408
+ )
1209
3409
  });
3410
+ for (const file of [...written.kept, ...kept.kept])
3411
+ ui.info(
3412
+ `${color.kept("Kept")} ${file} ${color.muted("(yours differs from the registry)")}`
3413
+ );
3414
+ const specs = await resolveConflicts(plan, ui, {
3415
+ ask: interactive && !options.yes,
3416
+ yes: options.yes
3417
+ });
3418
+ if (specs.length) {
3419
+ await ui.task(
3420
+ `Installing ${specs.length} packages with ${agent}`,
3421
+ () => install(cwd, specs, { agent }),
3422
+ installedMessage(
3423
+ specs.map((entry) => parseSpec(entry).name),
3424
+ agent
3425
+ )
3426
+ );
3427
+ await alignVersions(cwd, agent, install, ui, {
3428
+ ...align,
3429
+ required: false
3430
+ });
3431
+ }
3432
+ const addButton = color.command(cliCommand("add button"));
3433
+ if (viteStep.kind === "manual") {
3434
+ ui.warn(
3435
+ `Vite can't resolve ${prefix}/ yet. init left ${viteName} alone because ${viteStep.reason}. Add ${color.command(TSCONFIG_PATHS_ENTRY)} to the config, for example:
3436
+
3437
+ ${color.command(TSCONFIG_PATHS_SNIPPET)}`
3438
+ );
3439
+ ui.outro(
3440
+ `Finish the ${viteName} step above, then add a component with: ${addButton}`
3441
+ );
3442
+ return;
3443
+ }
3444
+ ui.note(addButton, "Add your first component");
3445
+ ui.outro("Solid UI is set up.");
1210
3446
  }
3447
+ var init = new Command2().name("init").description("set up Solid UI in a Solid 2 project").option(
3448
+ "-c, --cwd <dir>",
3449
+ "the project directory (default: current directory)"
3450
+ ).option("-p, --preset <code>", "a preset code from solid-ui.com/create").option("-y, --yes", "skip the prompts and use the defaults", false).option(
3451
+ "-f, --force",
3452
+ "replace an existing components.json and solid-ui.css",
3453
+ false
3454
+ ).option("--css <file>", "the app stylesheet that imports Tailwind CSS").option(
3455
+ "--alias <prefix>",
3456
+ "the import alias for the components (default: ~)"
3457
+ ).action(async (options) => {
3458
+ await runInit({ ...options, cwd: options.cwd ?? process.cwd() });
3459
+ });
1211
3460
 
1212
3461
  // src/index.ts
1213
3462
  process.on("SIGINT", () => process.exit(0));
1214
3463
  process.on("SIGTERM", () => process.exit(0));
1215
3464
  async function main() {
1216
- console.clear();
1217
- const packageInfo = getPackageInfo();
1218
- new Command3().name("solidui-cli").description("add SolidUI components to your project").version(packageInfo.version || "0.0.0", "-v, --version", "display the version number").addCommand(init).addCommand(add).parse();
3465
+ const program = new Command3().name(CLI_NAME).description("add Solid UI components to your Solid 2 project").version(CLI_VERSION, "-v, --version", "display the version number").addCommand(init).addCommand(add);
3466
+ try {
3467
+ await program.parseAsync();
3468
+ } catch (error) {
3469
+ if (error instanceof CliError) {
3470
+ if (error.exitCode !== 0) terminalUi.error(error.message);
3471
+ process.exitCode = error.exitCode;
3472
+ return;
3473
+ }
3474
+ throw error;
3475
+ }
1219
3476
  }
1220
- main();
3477
+ void main();