cronus-ui 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/commands/add-page.d.ts +108 -0
- package/dist/commands/add-page.js +642 -0
- package/dist/commands/add.d.ts +9 -0
- package/dist/commands/add.js +114 -0
- package/dist/commands/ai.d.ts +14 -0
- package/dist/commands/ai.js +69 -0
- package/dist/commands/compose.d.ts +82 -0
- package/dist/commands/compose.js +403 -0
- package/dist/commands/diff.d.ts +8 -0
- package/dist/commands/diff.js +55 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +53 -0
- package/dist/commands/list.d.ts +7 -0
- package/dist/commands/list.js +28 -0
- package/dist/commands/theme.d.ts +23 -0
- package/dist/commands/theme.js +735 -0
- package/dist/commands/upgrade.d.ts +51 -0
- package/dist/commands/upgrade.js +840 -0
- package/dist/compose/data-slots.d.ts +71 -0
- package/dist/compose/data-slots.js +104 -0
- package/dist/compose/manifest.d.ts +90 -0
- package/dist/compose/manifest.js +224 -0
- package/dist/compose/plan.d.ts +164 -0
- package/dist/compose/plan.js +506 -0
- package/dist/compose/preview.d.ts +10 -0
- package/dist/compose/preview.js +48 -0
- package/dist/compose/reload.d.ts +56 -0
- package/dist/compose/reload.js +138 -0
- package/dist/compose/render.d.ts +123 -0
- package/dist/compose/render.js +404 -0
- package/dist/compose/templates.d.ts +22 -0
- package/dist/compose/templates.js +76 -0
- package/dist/compose.d.ts +10 -0
- package/dist/compose.js +8 -0
- package/dist/config.d.ts +94 -0
- package/dist/config.js +38 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +184 -0
- package/dist/registry.d.ts +59 -0
- package/dist/registry.js +96 -0
- package/dist/utils.d.ts +72 -0
- package/dist/utils.js +186 -0
- package/package.json +68 -0
- package/templates/apps/chat.json +44 -0
- package/templates/apps/finance.json +44 -0
- package/templates/apps/landing-agency.json +31 -0
- package/templates/apps/landing-agents.json +32 -0
- package/templates/apps/landing-broadcast.json +29 -0
- package/templates/apps/landing-care.json +28 -0
- package/templates/apps/landing-coverage.json +23 -0
- package/templates/apps/landing-docs.json +29 -0
- package/templates/apps/landing-glass.json +28 -0
- package/templates/apps/landing-ops.json +29 -0
- package/templates/apps/landing-premium.json +31 -0
- package/templates/apps/landing-secure.json +31 -0
- package/templates/apps/landing-shop.json +27 -0
- package/templates/apps/landing-studio.json +30 -0
- package/templates/apps/landing.json +23 -0
- package/templates/apps/mail.json +44 -0
- package/templates/apps/saas.json +64 -0
- package/templates/apps/store.json +75 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface DiffOptions {
|
|
2
|
+
cwd: string;
|
|
3
|
+
registry?: string;
|
|
4
|
+
}
|
|
5
|
+
/** Report which installed components have drifted from the registry. */
|
|
6
|
+
export declare function diff(names: string[], options: DiffOptions): Promise<void>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
import { hasConfig, readConfig } from "../config.js";
|
|
5
|
+
import { Registry } from "../registry.js";
|
|
6
|
+
import { log, resolveSafeDest, rewriteImports, targetDir } from "../utils.js";
|
|
7
|
+
/** Report which installed components have drifted from the registry. */
|
|
8
|
+
export async function diff(names, options) {
|
|
9
|
+
const { cwd } = options;
|
|
10
|
+
if (!hasConfig(cwd)) {
|
|
11
|
+
log.err("No cronus-ui.json found. Run `cronus-ui init` first.");
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const config = await readConfig(cwd);
|
|
16
|
+
const registry = new Registry(options.registry ?? config.registry);
|
|
17
|
+
const targets = names.length > 0 ? names : (await registry.index()).map((i) => i.name);
|
|
18
|
+
let changed = 0;
|
|
19
|
+
for (const name of targets) {
|
|
20
|
+
let item;
|
|
21
|
+
try {
|
|
22
|
+
item = await registry.item(name);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
log.warn(`${name}: not in registry`);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
for (const file of item.files) {
|
|
29
|
+
let dest;
|
|
30
|
+
try {
|
|
31
|
+
dest = resolveSafeDest(cwd, targetDir(config, file.target), file.path);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
log.warn(`${name}: ${err.message}`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (!existsSync(dest))
|
|
38
|
+
continue; // not installed locally
|
|
39
|
+
const local = await readFile(dest, "utf8");
|
|
40
|
+
const upstream = rewriteImports(file.content, config);
|
|
41
|
+
if (local.trim() === upstream.trim()) {
|
|
42
|
+
log.ok(`${pc.dim(name)} up to date`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
changed += 1;
|
|
46
|
+
log.warn(`${name} differs from registry (${file.path})`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (changed === 0)
|
|
51
|
+
log.title("Everything is up to date.");
|
|
52
|
+
else
|
|
53
|
+
log.title(`${changed} component(s) differ. Run \`cronus-ui upgrade\` to merge upstream updates without losing your edits.`);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mkdir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { DEFAULT_CONFIG, hasConfig, writeConfig } from "../config.js";
|
|
4
|
+
import { Registry } from "../registry.js";
|
|
5
|
+
import { detectPackageManager, log, runInstall, writeItemFiles } from "../utils.js";
|
|
6
|
+
const BASE_DEPS = ["clsx", "tailwind-merge", "class-variance-authority", "@radix-ui/react-slot"];
|
|
7
|
+
export async function init(options) {
|
|
8
|
+
const { cwd } = options;
|
|
9
|
+
if (hasConfig(cwd) && !options.yes) {
|
|
10
|
+
log.warn(`${"cronus-ui.json"} already exists. Re-run with --yes to overwrite.`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const config = {
|
|
14
|
+
...DEFAULT_CONFIG,
|
|
15
|
+
registry: options.registry ?? DEFAULT_CONFIG.registry,
|
|
16
|
+
};
|
|
17
|
+
log.title("Initializing Cronus UI");
|
|
18
|
+
await writeConfig(cwd, config);
|
|
19
|
+
log.ok("Wrote cronus-ui.json");
|
|
20
|
+
await mkdir(join(cwd, config.paths.ui), { recursive: true });
|
|
21
|
+
await mkdir(join(cwd, config.paths.lib), { recursive: true });
|
|
22
|
+
await mkdir(join(cwd, config.paths.blocks), { recursive: true });
|
|
23
|
+
log.ok(`Created ${config.paths.ui}, ${config.paths.lib} and ${config.paths.blocks}`);
|
|
24
|
+
// Pull the shared cn() helper from the registry.
|
|
25
|
+
try {
|
|
26
|
+
const registry = new Registry(config.registry);
|
|
27
|
+
const [cn] = await registry.resolve(["cn"]);
|
|
28
|
+
if (cn) {
|
|
29
|
+
await writeItemFiles(cn, config, cwd, { overwrite: true });
|
|
30
|
+
log.ok(`Added ${config.paths.lib}/cn.ts`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
log.warn(`Could not fetch cn from registry (${err.message}). Add it later.`);
|
|
35
|
+
}
|
|
36
|
+
if (!options.skipInstall) {
|
|
37
|
+
const pm = detectPackageManager(cwd);
|
|
38
|
+
log.step(`Installing base dependencies with ${pm}…`);
|
|
39
|
+
try {
|
|
40
|
+
await runInstall(pm, BASE_DEPS, cwd);
|
|
41
|
+
log.ok("Installed base dependencies");
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
log.warn(`Dependency install skipped: ${err.message}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
log.title("Next steps");
|
|
48
|
+
log.step("1. Add Cronus CSS variables or install @cronus-ui/tokens if your registry access allows it.");
|
|
49
|
+
log.step('2. In your global CSS: @import "tailwindcss"; then import your Cronus token CSS.');
|
|
50
|
+
log.step("3. Wrap your app in <CronusUIProvider> from @cronus-ui/theme if you use the theme package.");
|
|
51
|
+
log.step("4. Add components: npx cronus-ui add button card dialog");
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
import { DEFAULT_CONFIG, hasConfig, readConfig } from "../config.js";
|
|
3
|
+
import { Registry } from "../registry.js";
|
|
4
|
+
import { log } from "../utils.js";
|
|
5
|
+
export async function list(options) {
|
|
6
|
+
const source = options.registry
|
|
7
|
+
? options.registry
|
|
8
|
+
: hasConfig(options.cwd)
|
|
9
|
+
? (await readConfig(options.cwd)).registry
|
|
10
|
+
: DEFAULT_CONFIG.registry;
|
|
11
|
+
const registry = new Registry(source);
|
|
12
|
+
let index;
|
|
13
|
+
try {
|
|
14
|
+
index = await registry.index();
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
log.err(`Failed to read registry index: ${err.message}`);
|
|
18
|
+
process.exitCode = 1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const ui = index.filter((i) => i.type === "registry:ui").map((i) => i.name);
|
|
22
|
+
const lib = index.filter((i) => i.type === "registry:lib").map((i) => i.name);
|
|
23
|
+
log.title(`Cronus UI registry — ${index.length} items`);
|
|
24
|
+
if (lib.length > 0)
|
|
25
|
+
console.log(`${pc.dim("lib")} ${lib.join(", ")}`);
|
|
26
|
+
console.log(`${pc.dim("ui")} ${ui.join(", ")}`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The theme presets shipped by @cronus-ui/theme. */
|
|
2
|
+
export declare const THEME_PRESETS: readonly ["aurora", "neutral", "midnight", "sunset", "emerald"];
|
|
3
|
+
/** The two color modes a preset can be pinned to. */
|
|
4
|
+
export declare const THEME_MODES: readonly ["dark", "light"];
|
|
5
|
+
interface ThemeSetOptions {
|
|
6
|
+
name: string;
|
|
7
|
+
mode?: string;
|
|
8
|
+
cwd: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function themeSet(options: ThemeSetOptions): Promise<void>;
|
|
11
|
+
export declare const OVERRIDES_BEGIN = "/* cronus-ui theme overrides \u2014 BEGIN (generated by `cronus-ui theme add`; re-runs replace this block) */";
|
|
12
|
+
export declare const OVERRIDES_END = "/* cronus-ui theme overrides \u2014 END */";
|
|
13
|
+
interface ThemeAddOptions {
|
|
14
|
+
source: string;
|
|
15
|
+
cwd: string;
|
|
16
|
+
/** Globals CSS file for the overrides block (relative to cwd); default: auto-detect. */
|
|
17
|
+
css?: string;
|
|
18
|
+
/** Print everything that would be applied, write nothing. */
|
|
19
|
+
dryRun?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function themeAdd(options: ThemeAddOptions): Promise<void>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=theme.d.ts.map
|