inai-react-components 0.1.6 → 0.1.7
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/dist/commands/add.d.ts +1 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +30 -7
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -1
- package/dist/commands/theme.d.ts.map +1 -1
- package/dist/commands/theme.js +21 -1
- package/dist/index.js +1 -1
- package/package.json +4 -1
package/dist/commands/add.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare function findInRegistry(registry: {
|
|
|
28
28
|
export declare function getTargetDir(component: RegistryComponent, aliases: {
|
|
29
29
|
components: string;
|
|
30
30
|
blocks: string;
|
|
31
|
+
templates?: string;
|
|
31
32
|
}): string;
|
|
32
33
|
export declare function runAdd(componentSpec: string, rootDir: string): Promise<AddResult>;
|
|
33
34
|
export declare function addCommand(componentSpec?: string, options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AASrB,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AASrB,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CA6BA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE;IAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAAC,SAAS,EAAE,iBAAiB,EAAE,CAAA;CAAE,EAC1G,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,iBAAiB,GAAG,IAAI,CAc1B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAClE,MAAM,CAgBR;AAED,wBAAsB,MAAM,CAC1B,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC,CAsHpB;AAuBD,wBAAsB,UAAU,CAC9B,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgCf"}
|
package/dist/commands/add.js
CHANGED
|
@@ -11,13 +11,30 @@ import { normalizeThemeCss, getLocalTailwindCssTemplate, getLegacyTailwindCssTem
|
|
|
11
11
|
* into its type prefix and name.
|
|
12
12
|
*/
|
|
13
13
|
export function parseComponentSpec(spec) {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const trimmed = spec.trim();
|
|
15
|
+
if (!trimmed) {
|
|
16
|
+
throw new Error('Component spec cannot be empty.');
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
let prefix = null;
|
|
19
|
+
let name;
|
|
20
|
+
if (trimmed.startsWith("block/")) {
|
|
21
|
+
prefix = "block";
|
|
22
|
+
name = trimmed.slice(6).trim();
|
|
19
23
|
}
|
|
20
|
-
|
|
24
|
+
else if (trimmed.startsWith("template/")) {
|
|
25
|
+
prefix = "template";
|
|
26
|
+
name = trimmed.slice(9).trim();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
name = trimmed;
|
|
30
|
+
}
|
|
31
|
+
if (!name) {
|
|
32
|
+
throw new Error(`Invalid component spec "${spec}" — name cannot be empty.`);
|
|
33
|
+
}
|
|
34
|
+
if (!/^[a-z0-9][a-z0-9\-]*[a-z0-9]$|^[a-z0-9]$/.test(name)) {
|
|
35
|
+
throw new Error(`Invalid component name "${name}" — use only lowercase letters, numbers, and hyphens (e.g. "my-component").`);
|
|
36
|
+
}
|
|
37
|
+
return { prefix, name };
|
|
21
38
|
}
|
|
22
39
|
/**
|
|
23
40
|
* Find a component in the registry, optionally narrowing by type prefix.
|
|
@@ -46,7 +63,13 @@ export function getTargetDir(component, aliases) {
|
|
|
46
63
|
return aliases.blocks.replace(/^@\//, "src/");
|
|
47
64
|
}
|
|
48
65
|
if (type === "template") {
|
|
49
|
-
|
|
66
|
+
if (aliases.templates) {
|
|
67
|
+
return aliases.templates.replace(/^@\//, "src/");
|
|
68
|
+
}
|
|
69
|
+
// Fallback: derive templates dir from blocks dir
|
|
70
|
+
const blocksDir = aliases.blocks.replace(/^@\//, "src/");
|
|
71
|
+
const parent = path.dirname(blocksDir);
|
|
72
|
+
return path.join(parent, "templates");
|
|
50
73
|
}
|
|
51
74
|
// Components, forms, and other types go to the components directory
|
|
52
75
|
return aliases.components.replace(/^@\//, "src/");
|
|
@@ -216,7 +239,7 @@ function discoverThemes(registryDir) {
|
|
|
216
239
|
*/
|
|
217
240
|
async function changeTheme(rootDir, registryDir) {
|
|
218
241
|
const componentsJson = readComponentsJson(rootDir);
|
|
219
|
-
const currentTheme = componentsJson.theme ?? "
|
|
242
|
+
const currentTheme = componentsJson.theme ?? "inai";
|
|
220
243
|
const themes = discoverThemes(registryDir);
|
|
221
244
|
if (themes.length === 0) {
|
|
222
245
|
console.log(chalk.red("No themes found in registry."));
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const AVAILABLE_THEMES: readonly ["monday", "linear", "notion", "vercel", "
|
|
1
|
+
declare const AVAILABLE_THEMES: readonly ["inai", "monday", "linear", "notion", "vercel", "anthropic", "shadcn-default", "shadcn-blue", "shadcn-green", "shadcn-orange", "shadcn-red", "shadcn-rose", "shadcn-violet", "shadcn-yellow", "shadcn-amber", "shadcn-lime", "shadcn-emerald", "shadcn-teal", "shadcn-cyan", "shadcn-sky", "shadcn-indigo", "shadcn-purple", "shadcn-fuchsia", "shadcn-pink"];
|
|
2
2
|
type Theme = (typeof AVAILABLE_THEMES)[number];
|
|
3
3
|
declare const FONT_PRESETS: readonly [{
|
|
4
4
|
readonly name: "outfit";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,gBAAgB,yWAyBZ,CAAC;AACX,KAAK,KAAK,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,CAAC;QACf,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAgBD,wBAAsB,gBAAgB,CACpC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA8F5B;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,cAAc,CAkChB;AAED,wBAAgB,aAAa,IAAI,MAAM,CAQtC;AAOD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAa/H;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAahI;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAoBpE;AA6ED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA4CvD;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0DjE"}
|
package/dist/commands/init.js
CHANGED
|
@@ -5,11 +5,11 @@ import ora from "ora";
|
|
|
5
5
|
import prompts from "prompts";
|
|
6
6
|
import { cloneRegistry, getCacheDir } from "../utils/registry-resolver.js";
|
|
7
7
|
const AVAILABLE_THEMES = [
|
|
8
|
+
"inai",
|
|
8
9
|
"monday",
|
|
9
10
|
"linear",
|
|
10
11
|
"notion",
|
|
11
12
|
"vercel",
|
|
12
|
-
"inai",
|
|
13
13
|
"anthropic",
|
|
14
14
|
"shadcn-default",
|
|
15
15
|
"shadcn-blue",
|
|
@@ -19,6 +19,16 @@ const AVAILABLE_THEMES = [
|
|
|
19
19
|
"shadcn-rose",
|
|
20
20
|
"shadcn-violet",
|
|
21
21
|
"shadcn-yellow",
|
|
22
|
+
"shadcn-amber",
|
|
23
|
+
"shadcn-lime",
|
|
24
|
+
"shadcn-emerald",
|
|
25
|
+
"shadcn-teal",
|
|
26
|
+
"shadcn-cyan",
|
|
27
|
+
"shadcn-sky",
|
|
28
|
+
"shadcn-indigo",
|
|
29
|
+
"shadcn-purple",
|
|
30
|
+
"shadcn-fuchsia",
|
|
31
|
+
"shadcn-pink",
|
|
22
32
|
];
|
|
23
33
|
const FONT_PRESETS = [
|
|
24
34
|
// Sans-serif — geometric & modern
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/commands/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/commands/theme.ts"],"names":[],"mappings":"AA0CA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMhF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgB3F;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAoDlE;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBnF"}
|
package/dist/commands/theme.js
CHANGED
|
@@ -3,11 +3,11 @@ import path from "node:path";
|
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import ora from "ora";
|
|
5
5
|
const AVAILABLE_THEMES = [
|
|
6
|
+
"inai",
|
|
6
7
|
"monday",
|
|
7
8
|
"linear",
|
|
8
9
|
"notion",
|
|
9
10
|
"vercel",
|
|
10
|
-
"inai",
|
|
11
11
|
"anthropic",
|
|
12
12
|
"shadcn-default",
|
|
13
13
|
"shadcn-blue",
|
|
@@ -17,6 +17,26 @@ const AVAILABLE_THEMES = [
|
|
|
17
17
|
"shadcn-rose",
|
|
18
18
|
"shadcn-violet",
|
|
19
19
|
"shadcn-yellow",
|
|
20
|
+
"shadcn-amber",
|
|
21
|
+
"shadcn-lime",
|
|
22
|
+
"shadcn-emerald",
|
|
23
|
+
"shadcn-teal",
|
|
24
|
+
"shadcn-cyan",
|
|
25
|
+
"shadcn-sky",
|
|
26
|
+
"shadcn-indigo",
|
|
27
|
+
"shadcn-purple",
|
|
28
|
+
"shadcn-fuchsia",
|
|
29
|
+
"shadcn-pink",
|
|
30
|
+
"cyberpunk",
|
|
31
|
+
"aurora",
|
|
32
|
+
"sunset",
|
|
33
|
+
"midnight",
|
|
34
|
+
"acid",
|
|
35
|
+
"sakura",
|
|
36
|
+
"ocean",
|
|
37
|
+
"cosmic",
|
|
38
|
+
"matcha",
|
|
39
|
+
"volcanic",
|
|
20
40
|
];
|
|
21
41
|
export function resolveThemesDir(rootDir) {
|
|
22
42
|
return path.join(rootDir, "packages", "tokens", "src", "themes");
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const program = new Command();
|
|
|
12
12
|
program
|
|
13
13
|
.name("inai-ui")
|
|
14
14
|
.description("CLI for InAI UI component library")
|
|
15
|
-
.version("0.1.
|
|
15
|
+
.version("0.1.7");
|
|
16
16
|
program
|
|
17
17
|
.command("init [repo-url]")
|
|
18
18
|
.description("Initialize InAI UI in your project. Optionally pass a Git repo URL to fetch components remotely.")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inai-react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "CLI for InAI UI component library — install components from a private registry into your React project",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"design-system"
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
20
23
|
"repository": {
|
|
21
24
|
"type": "git",
|
|
22
25
|
"url": "git+https://github.com/InAI-Team/inai-components-react.git",
|