@g3nomaly/ui 0.3.0 → 0.3.2
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 +95 -0
- package/dist/cli/adapter.d.ts +86 -0
- package/dist/cli/adapter.d.ts.map +1 -0
- package/dist/cli/adapter.js +114 -0
- package/dist/cli/adapter.js.map +1 -0
- package/dist/cli/commands/add.d.ts +24 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +24 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/index.d.ts +15 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +9 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +48 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +167 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +20 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +25 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/manifest.d.ts +19 -0
- package/dist/cli/commands/manifest.d.ts.map +1 -0
- package/dist/cli/commands/manifest.js +95 -0
- package/dist/cli/commands/manifest.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +15 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +16 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/source.d.ts +41 -0
- package/dist/cli/commands/source.d.ts.map +1 -0
- package/dist/cli/commands/source.js +38 -0
- package/dist/cli/commands/source.js.map +1 -0
- package/dist/cli/commands/update.d.ts +16 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +17 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +90 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/components/basic/Card.css +32 -0
- package/dist/components/basic/Card.debug.ts +5 -0
- package/dist/components/basic/Card.tsx +31 -0
- package/dist/components/basic/CardFooter.css +16 -0
- package/dist/components/basic/CardFooter.debug.ts +5 -0
- package/dist/components/basic/CardFooter.tsx +29 -0
- package/dist/components/basic/CardHeader.css +14 -0
- package/dist/components/basic/CardHeader.debug.ts +5 -0
- package/dist/components/basic/CardHeader.tsx +29 -0
- package/dist/components/basic/card.meta.ts +14 -0
- package/dist/components/basic/cardfooter.meta.ts +14 -0
- package/dist/components/basic/cardheader.meta.ts +14 -0
- package/dist/components/input/Button.css +34 -0
- package/dist/components/input/Button.debug.ts +5 -0
- package/dist/components/input/Button.tsx +28 -0
- package/dist/components/input/button.meta.ts +14 -0
- package/dist/components.json +138 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/adapters/shadcn.adapter.d.ts +41 -0
- package/dist/registry/adapters/shadcn.adapter.d.ts.map +1 -0
- package/dist/registry/adapters/shadcn.adapter.js +123 -0
- package/dist/registry/adapters/shadcn.adapter.js.map +1 -0
- package/dist/registry/componentsJson.d.ts +24 -0
- package/dist/registry/componentsJson.d.ts.map +1 -0
- package/dist/registry/componentsJson.js +56 -0
- package/dist/registry/componentsJson.js.map +1 -0
- package/dist/registry/index.d.ts +6 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +6 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/manifest.d.ts +21 -0
- package/dist/registry/manifest.d.ts.map +1 -0
- package/dist/registry/manifest.js +88 -0
- package/dist/registry/manifest.js.map +1 -0
- package/dist/registry/readSource.d.ts +37 -0
- package/dist/registry/readSource.d.ts.map +1 -0
- package/dist/registry/readSource.js +58 -0
- package/dist/registry/readSource.js.map +1 -0
- package/dist/registry/types.d.ts +100 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +48 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/sources/builtins.d.ts +8 -0
- package/dist/sources/builtins.d.ts.map +1 -0
- package/dist/sources/builtins.js +10 -0
- package/dist/sources/builtins.js.map +1 -0
- package/package.json +84 -3
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAK,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,OAAO,GAAE,SAAc,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// packages/ui/src/cli/commands/ls.ts
|
|
2
|
+
import { lsEntries, lsSourceRegistry } from "@g3nomaly/core/cli";
|
|
3
|
+
import { fileFlags, installedComponents, openComponentRegistry, openUiProject, uiSources } from "../adapter";
|
|
4
|
+
/**
|
|
5
|
+
* @brief Lists the components the sources offer, `●` marking installed ones, or with `installed` only what is installed.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Output and filter options.
|
|
8
|
+
* @param deps - Test injection.
|
|
9
|
+
*/
|
|
10
|
+
export async function lsCommand(options = {}, deps = {}) {
|
|
11
|
+
const project = await openUiProject(deps);
|
|
12
|
+
const installed = installedComponents(project);
|
|
13
|
+
if (options.installed === true) {
|
|
14
|
+
lsEntries(installed, options);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const registry = await openComponentRegistry(project, fileFlags(project), options.source);
|
|
18
|
+
try {
|
|
19
|
+
lsSourceRegistry(registry, uiSources(project), installed, options);
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
registry.dispose();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAc7G;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAO,GAAc,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC7E,MAAM,OAAO,GAAK,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAC/B,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1F,IAAI,CAAC;QACH,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { glob as _glob } from "glob";
|
|
2
|
+
import type { ProjectDeps } from "../adapter";
|
|
3
|
+
/**
|
|
4
|
+
* @brief Injection points for `manifestCommand`, on top of the project ones.
|
|
5
|
+
*
|
|
6
|
+
* @property glob - Glob used to list the install directory, in place of the `glob` package.
|
|
7
|
+
*/
|
|
8
|
+
export interface ManifestDeps extends ProjectDeps {
|
|
9
|
+
glob?: typeof _glob;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @brief Scans the install directory and rebuilds the manifest from what is on
|
|
13
|
+
* disk: every component the sources offer with at least one file present is
|
|
14
|
+
* recorded, the first source offering a key winning.
|
|
15
|
+
*
|
|
16
|
+
* @param deps - Test injection, including the glob.
|
|
17
|
+
*/
|
|
18
|
+
export declare function manifestCommand(deps?: ManifestDeps): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/manifest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,MAAM,CAAC;AAQrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB;AAqCD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqE5E"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// packages/ui/src/cli/commands/manifest.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { glob as _glob } from "glob";
|
|
6
|
+
import { register } from "@g3nomaly/core/registry";
|
|
7
|
+
import { offers, saveInstallManifest } from "@g3nomaly/core/installer";
|
|
8
|
+
import { hashFile } from "@g3nomaly/core/hash";
|
|
9
|
+
import { c, sym, lineError } from "@g3nomaly/core/cli";
|
|
10
|
+
import { ComponentMetaSchema } from "../../registry/types";
|
|
11
|
+
import { fileFlags, openComponentRegistry, openUiProject } from "../adapter";
|
|
12
|
+
/**
|
|
13
|
+
* @brief A path with forward slashes only.
|
|
14
|
+
*
|
|
15
|
+
* @param p - Path with any separators.
|
|
16
|
+
* @returns The same path with `/` separators.
|
|
17
|
+
*/
|
|
18
|
+
function normalisePath(p) {
|
|
19
|
+
return p.replace(/\\/g, "/");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @brief Whether a file found on disk is the registry file, compared by path ending.
|
|
23
|
+
*
|
|
24
|
+
* @param diskPath - Path found by the disk scan, relative to the install directory.
|
|
25
|
+
* @param registryPath - Path recorded in the registry, relative to the install directory.
|
|
26
|
+
*/
|
|
27
|
+
function matchesRegistryPath(diskPath, registryPath) {
|
|
28
|
+
return normalisePath(diskPath).endsWith(normalisePath(registryPath));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @brief Scans the install directory and rebuilds the manifest from what is on
|
|
32
|
+
* disk: every component the sources offer with at least one file present is
|
|
33
|
+
* recorded, the first source offering a key winning.
|
|
34
|
+
*
|
|
35
|
+
* @param deps - Test injection, including the glob.
|
|
36
|
+
*/
|
|
37
|
+
export async function manifestCommand(deps = {}) {
|
|
38
|
+
const { glob = _glob } = deps;
|
|
39
|
+
const project = await openUiProject(deps);
|
|
40
|
+
const { projectRoot, config, target } = project;
|
|
41
|
+
if (!fs.existsSync(target.installDir)) {
|
|
42
|
+
console.error(lineError(`Install directory not found: ${c.dir(target.installDir)}`));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
console.log();
|
|
46
|
+
console.log(`${sym.search} Scanning ${c.dir(config.g3nui.settings.componentsDir)}...`);
|
|
47
|
+
console.log();
|
|
48
|
+
const diskFiles = await glob("**/*", { cwd: target.installDir, nodir: true, absolute: false });
|
|
49
|
+
const registry = await openComponentRegistry(project, fileFlags(project));
|
|
50
|
+
const available = {};
|
|
51
|
+
for (const { key, entry } of offers(registry))
|
|
52
|
+
available[key] ??= entry;
|
|
53
|
+
registry.dispose();
|
|
54
|
+
const results = [];
|
|
55
|
+
for (const [key, meta] of Object.entries(available)) {
|
|
56
|
+
const presentFiles = [];
|
|
57
|
+
const missingFiles = [];
|
|
58
|
+
for (const file of meta.files) {
|
|
59
|
+
const matched = diskFiles.find((df) => matchesRegistryPath(df, file.path));
|
|
60
|
+
if (matched) {
|
|
61
|
+
const hash = await hashFile(path.join(target.installDir, matched));
|
|
62
|
+
presentFiles.push({ ...file, hash });
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
missingFiles.push(file);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (presentFiles.length > 0) {
|
|
69
|
+
results.push({ key, meta, presentFiles, missingFiles });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (results.length === 0) {
|
|
73
|
+
console.log(chalk.dim("No registered components found on disk."));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
console.log(chalk.bold(`Found ${chalk.white(results.length)} component${results.length !== 1 ? "s" : ""} matching registry:\n`));
|
|
77
|
+
for (const { key, meta, presentFiles, missingFiles } of results) {
|
|
78
|
+
const total = meta.files.length;
|
|
79
|
+
const found = presentFiles.length;
|
|
80
|
+
const keyLabel = c.key(key.padEnd(16));
|
|
81
|
+
if (missingFiles.length === 0) {
|
|
82
|
+
console.log(` ${sym.success} ${keyLabel} ${chalk.dim(`(${found}/${total} files present)`)}`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const missingNames = missingFiles.map((f) => c.file(path.basename(f.path))).join(", ");
|
|
86
|
+
console.log(` ${sym.warn} ${keyLabel} ${chalk.yellow(`(${found}/${total} files present`)} — ${missingNames} ${chalk.yellow("missing)")}`);
|
|
87
|
+
}
|
|
88
|
+
register(target.store, key, { ...meta, files: presentFiles });
|
|
89
|
+
}
|
|
90
|
+
saveInstallManifest(target.manifest, ComponentMetaSchema);
|
|
91
|
+
console.log();
|
|
92
|
+
console.log(chalk.green("Manifest written to ") + c.file(path.relative(projectRoot, target.manifest.filePath)));
|
|
93
|
+
console.log();
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/cli/commands/manifest.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAY7E;;;;;GAKG;AACH,SAAS,aAAa,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,QAAgB,EAAE,YAAoB;IACjE,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC;AACvE,CAAC;AAiBD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAI,GAAiB,EAAE;IAC3D,MAAM,EAAE,IAAI,GA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,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChH,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps } from "../adapter";
|
|
3
|
+
/** Options of `removeCommand`: the core install options, unchanged. */
|
|
4
|
+
export interface RemoveOptions extends InstallOptions {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @brief Removes installed components and drops them from the manifest. Works from
|
|
8
|
+
* the manifest alone; installed dependents are offered for removal too.
|
|
9
|
+
*
|
|
10
|
+
* @param names - Installed component keys to remove.
|
|
11
|
+
* @param options - Force flag.
|
|
12
|
+
* @param deps - Test injection.
|
|
13
|
+
*/
|
|
14
|
+
export declare function removeCommand(names: string[], options?: RemoveOptions, deps?: ProjectDeps): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/remove.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,uEAAuE;AACvE,MAAM,WAAW,aAAc,SAAQ,cAAc;CAAG;AAExD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// packages/ui/src/cli/commands/remove.ts
|
|
2
|
+
import { removeFromTargets } from "@g3nomaly/core/cli";
|
|
3
|
+
import { UI_CONTEXT, openUiProject } from "../adapter";
|
|
4
|
+
/**
|
|
5
|
+
* @brief Removes installed components and drops them from the manifest. Works from
|
|
6
|
+
* the manifest alone; installed dependents are offered for removal too.
|
|
7
|
+
*
|
|
8
|
+
* @param names - Installed component keys to remove.
|
|
9
|
+
* @param options - Force flag.
|
|
10
|
+
* @param deps - Test injection.
|
|
11
|
+
*/
|
|
12
|
+
export async function removeCommand(names, options = {}, deps = {}) {
|
|
13
|
+
const project = await openUiProject(deps);
|
|
14
|
+
await removeFromTargets([project.target], names, options, UI_CONTEXT);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/cli/commands/remove.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMvD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,OAAO,GAAkB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACtG,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ProjectDeps } from "../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* @brief Options of `sourceAddCommand`.
|
|
4
|
+
*
|
|
5
|
+
* @property name - Name to register under; derived from the source when absent.
|
|
6
|
+
* @property ref - Branch or tag a git source is pinned to.
|
|
7
|
+
*/
|
|
8
|
+
export interface SourceAddOptions {
|
|
9
|
+
name?: string;
|
|
10
|
+
ref?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @brief Registers a git repository, npm package or local folder holding a built
|
|
14
|
+
* `dist/components.json` as a component source, after checking it offers at
|
|
15
|
+
* least one component.
|
|
16
|
+
*
|
|
17
|
+
* @param input - The source as typed, e.g. `owner/repo`, `npm:@scope/ui` or `./dist`.
|
|
18
|
+
* @param options - Name and ref of the source.
|
|
19
|
+
* @param deps - Test injection.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sourceAddCommand(input: string, options?: SourceAddOptions, deps?: ProjectDeps): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* @brief Lists the built-in and registered sources, with how many installed components came from each.
|
|
24
|
+
*
|
|
25
|
+
* @param options - Output format.
|
|
26
|
+
* @param deps - Test injection.
|
|
27
|
+
*/
|
|
28
|
+
export declare function sourceLsCommand(options?: {
|
|
29
|
+
json?: boolean;
|
|
30
|
+
}, deps?: ProjectDeps): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* @brief Unregisters a source; refused for built-in sources and, unless forced, while components came from it.
|
|
33
|
+
*
|
|
34
|
+
* @param name - Name of the source to unregister, as `source ls` prints it.
|
|
35
|
+
* @param options - Force flag.
|
|
36
|
+
* @param deps - Test injection.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sourceRemoveCommand(name: string, options?: {
|
|
39
|
+
force?: boolean;
|
|
40
|
+
}, deps?: ProjectDeps): Promise<void>;
|
|
41
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAG,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3H;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG7G;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhI"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// packages/ui/src/cli/commands/source.ts
|
|
2
|
+
import { addSourceEntries, lsSources, removeSourceEntries } from "@g3nomaly/core/cli";
|
|
3
|
+
import { openUiProject, uiSourceContext } from "../adapter";
|
|
4
|
+
/**
|
|
5
|
+
* @brief Registers a git repository, npm package or local folder holding a built
|
|
6
|
+
* `dist/components.json` as a component source, after checking it offers at
|
|
7
|
+
* least one component.
|
|
8
|
+
*
|
|
9
|
+
* @param input - The source as typed, e.g. `owner/repo`, `npm:@scope/ui` or `./dist`.
|
|
10
|
+
* @param options - Name and ref of the source.
|
|
11
|
+
* @param deps - Test injection.
|
|
12
|
+
*/
|
|
13
|
+
export async function sourceAddCommand(input, options = {}, deps = {}) {
|
|
14
|
+
const project = await openUiProject(deps);
|
|
15
|
+
await addSourceEntries([project.target], input, options, uiSourceContext(project));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @brief Lists the built-in and registered sources, with how many installed components came from each.
|
|
19
|
+
*
|
|
20
|
+
* @param options - Output format.
|
|
21
|
+
* @param deps - Test injection.
|
|
22
|
+
*/
|
|
23
|
+
export async function sourceLsCommand(options = {}, deps = {}) {
|
|
24
|
+
const project = await openUiProject(deps);
|
|
25
|
+
lsSources([project.target], options, uiSourceContext(project));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @brief Unregisters a source; refused for built-in sources and, unless forced, while components came from it.
|
|
29
|
+
*
|
|
30
|
+
* @param name - Name of the source to unregister, as `source ls` prints it.
|
|
31
|
+
* @param options - Force flag.
|
|
32
|
+
* @param deps - Test injection.
|
|
33
|
+
*/
|
|
34
|
+
export async function sourceRemoveCommand(name, options = {}, deps = {}) {
|
|
35
|
+
const project = await openUiProject(deps);
|
|
36
|
+
removeSourceEntries([project.target], name, options, uiSourceContext(project));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/cli/commands/source.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAc5D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAa,EAAE,OAAO,GAAqB,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC1G,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAO,GAAuB,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC5F,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1C,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAY,EAAE,OAAO,GAAwB,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC/G,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1C,mBAAmB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps } from "../adapter";
|
|
3
|
+
/** Options of `updateCommand`: the core install options, unchanged. */
|
|
4
|
+
export interface UpdateOptions extends InstallOptions {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @brief Re-installs installed components from the source each one was installed
|
|
8
|
+
* from; with no names, everything installed. Files the user changed since
|
|
9
|
+
* install are kept unless overwritten.
|
|
10
|
+
*
|
|
11
|
+
* @param names - Installed component keys to update; empty for everything installed.
|
|
12
|
+
* @param options - Force and dry-run flags.
|
|
13
|
+
* @param deps - Test injection.
|
|
14
|
+
*/
|
|
15
|
+
export declare function updateCommand(names: string[], options?: UpdateOptions, deps?: ProjectDeps): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,uEAAuE;AACvE,MAAM,WAAW,aAAc,SAAQ,cAAc;CAAG;AAExD;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/ui/src/cli/commands/update.ts
|
|
2
|
+
import { updateFromSources } from "@g3nomaly/core/cli";
|
|
3
|
+
import { UI_CONTEXT, fileFlags, openComponentRegistry, openUiProject } from "../adapter";
|
|
4
|
+
/**
|
|
5
|
+
* @brief Re-installs installed components from the source each one was installed
|
|
6
|
+
* from; with no names, everything installed. Files the user changed since
|
|
7
|
+
* install are kept unless overwritten.
|
|
8
|
+
*
|
|
9
|
+
* @param names - Installed component keys to update; empty for everything installed.
|
|
10
|
+
* @param options - Force and dry-run flags.
|
|
11
|
+
* @param deps - Test injection.
|
|
12
|
+
*/
|
|
13
|
+
export async function updateCommand(names, options = {}, deps = {}) {
|
|
14
|
+
const project = await openUiProject(deps);
|
|
15
|
+
await updateFromSources([project.target], names, () => openComponentRegistry(project, fileFlags(project)), options, UI_CONTEXT);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMzF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,OAAO,GAAkB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACtG,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAClI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// packages/ui/src/cli/index.ts
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { readPackageMeta, warnIfOutdated } from "@g3nomaly/core/utils";
|
|
5
|
+
import { initCommand } from "./commands/init";
|
|
6
|
+
import { addCommand } from "./commands/add";
|
|
7
|
+
import { removeCommand } from "./commands/remove";
|
|
8
|
+
import { updateCommand } from "./commands/update";
|
|
9
|
+
import { lsCommand } from "./commands/ls";
|
|
10
|
+
import { manifestCommand } from "./commands/manifest";
|
|
11
|
+
import { sourceAddCommand, sourceLsCommand, sourceRemoveCommand } from "./commands/source";
|
|
12
|
+
const program = new Command()
|
|
13
|
+
.name("g3nui")
|
|
14
|
+
.description("Install components from any registered source into a project");
|
|
15
|
+
program
|
|
16
|
+
.command("init")
|
|
17
|
+
.description("Initialize g3nui config in this project")
|
|
18
|
+
.option("-f, --force", "Overwrite existing config without prompting")
|
|
19
|
+
.option("--install-dir <path>", "Components install directory (skips interactive prompt)")
|
|
20
|
+
.action(async (opts) => {
|
|
21
|
+
await initCommand({ force: opts.force, installDir: opts.installDir });
|
|
22
|
+
});
|
|
23
|
+
const source = program
|
|
24
|
+
.command("source")
|
|
25
|
+
.description("Register, list and unregister the sources components are installed from");
|
|
26
|
+
source
|
|
27
|
+
.command("add <source>")
|
|
28
|
+
.description("Register a git repository, npm package or local folder holding a built dist/components.json")
|
|
29
|
+
.option("--name <name>", "Name to register it under (default: derived from the source)")
|
|
30
|
+
.option("--ref <ref>", "Branch or tag to pin a git source to (default: its default branch)")
|
|
31
|
+
.action(async (input, opts) => {
|
|
32
|
+
await sourceAddCommand(input, { name: opts.name, ref: opts.ref });
|
|
33
|
+
});
|
|
34
|
+
source
|
|
35
|
+
.command("ls")
|
|
36
|
+
.description("List the registered sources, built-in ones first")
|
|
37
|
+
.option("--json", "Output as JSON")
|
|
38
|
+
.action(async (opts) => {
|
|
39
|
+
await sourceLsCommand({ json: opts.json });
|
|
40
|
+
});
|
|
41
|
+
source
|
|
42
|
+
.command("remove <name>")
|
|
43
|
+
.description("Unregister a source; built-in sources cannot be removed")
|
|
44
|
+
.option("-f, --force", "Unregister even when installed components came from it")
|
|
45
|
+
.action(async (name, opts) => {
|
|
46
|
+
await sourceRemoveCommand(name, { force: opts.force });
|
|
47
|
+
});
|
|
48
|
+
program
|
|
49
|
+
.command("add [components...]")
|
|
50
|
+
.description("Add components or whole groups with their dependencies; name one source with <component>@<source>")
|
|
51
|
+
.option("-f, --force", "Overwrite locally modified files")
|
|
52
|
+
.option("--debug", "Include .debug.ts files")
|
|
53
|
+
.option("--meta", "Include .meta.ts files")
|
|
54
|
+
.action(async (components, opts) => {
|
|
55
|
+
await addCommand(components, { force: opts.force, debug: opts.debug, meta: opts.meta });
|
|
56
|
+
});
|
|
57
|
+
program
|
|
58
|
+
.command("remove [components...]")
|
|
59
|
+
.description("Remove components from your project")
|
|
60
|
+
.option("-f, --force", "Remove even if files have been modified")
|
|
61
|
+
.action(async (components, opts) => {
|
|
62
|
+
await removeCommand(components, { force: opts.force });
|
|
63
|
+
});
|
|
64
|
+
program
|
|
65
|
+
.command("update [components...]")
|
|
66
|
+
.description("Re-install installed components from the source each came from")
|
|
67
|
+
.option("-f, --force", "Overwrite conflicting files without prompting")
|
|
68
|
+
.option("--dry-run", "Preview changes without writing files")
|
|
69
|
+
.action(async (components, opts) => {
|
|
70
|
+
await updateCommand(components, { force: opts.force, dryRun: opts.dryRun });
|
|
71
|
+
});
|
|
72
|
+
program
|
|
73
|
+
.command("ls")
|
|
74
|
+
.description("List the components the sources offer")
|
|
75
|
+
.option("--json", "Output as JSON")
|
|
76
|
+
.option("--source <name>", "Only this source")
|
|
77
|
+
.option("--installed", "List what the manifest records instead of what the sources offer")
|
|
78
|
+
.action(async (opts) => {
|
|
79
|
+
await lsCommand({ json: opts.json, source: opts.source, installed: opts.installed });
|
|
80
|
+
});
|
|
81
|
+
program
|
|
82
|
+
.command("manifest")
|
|
83
|
+
.description("Scan install directory and rebuild the manifest")
|
|
84
|
+
.action(async () => {
|
|
85
|
+
await manifestCommand();
|
|
86
|
+
});
|
|
87
|
+
const self = readPackageMeta(import.meta.url);
|
|
88
|
+
await warnIfOutdated(self.name, self.version, import.meta.url);
|
|
89
|
+
program.parseAsync();
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,+BAA+B;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAU,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAW,gBAAgB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAQ,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAQ,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAY,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE3F,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KAC1B,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,8DAA8D,CAAC,CAAC;AAE/E,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,yCAAyC,CAAC;KACtD,MAAM,CAAC,aAAa,EAAE,6CAA6C,C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C,IAAI,CAAC;KACb,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;KAC7C,MAAM,CAAC,aAAa,EAAE,kEAAkE,CAAC;KACzF,MAAM,CAAC,KAAK,EAAE,IAA8D,EAAE,EAAE;IAC/E,MAAM,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;AACvF,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,iDAAiD,CAAC;KAC9D,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,eAAe,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEL,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9C,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/D,OAAO,CAAC,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.g3nui {
|
|
2
|
+
&.card {
|
|
3
|
+
border-radius: 0.5rem;
|
|
4
|
+
background-color: white;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
transition: all 0.2s ease;
|
|
7
|
+
|
|
8
|
+
/* Variants */
|
|
9
|
+
&--default {
|
|
10
|
+
border: 1px solid #e5e7eb;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&--outlined {
|
|
14
|
+
border: 2px solid #d1d5db;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&--elevated {
|
|
18
|
+
border: 1px solid #e5e7eb;
|
|
19
|
+
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Dark mode support */
|
|
27
|
+
@media (prefers-color-scheme: dark) {
|
|
28
|
+
background-color: #1f2937;
|
|
29
|
+
border-color: #374151;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// packages/ui/src/components/basic/Card.tsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './Card.css';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @brief Props of Card: the content, the extra classes and the look.
|
|
7
|
+
*
|
|
8
|
+
* @property children - Content rendered inside the card.
|
|
9
|
+
* @property className - Extra classes appended to the root element.
|
|
10
|
+
* @property variant - Look of the card: `default`, `outlined` or `elevated`, set as the `card--<variant>` class.
|
|
11
|
+
*/
|
|
12
|
+
export interface CardProps {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
variant?: 'default' | 'outlined' | 'elevated';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Card = React.forwardRef<HTMLDivElement, CardProps>(
|
|
19
|
+
({ children, className = '', variant = 'default' }, ref) => {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={`g3nui card card--${variant} ${className}`}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
Card.displayName = 'Card';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.g3nui {
|
|
2
|
+
&.card__footer {
|
|
3
|
+
padding: 1rem 1.5rem;
|
|
4
|
+
border-top: 1px solid #e5e7eb;
|
|
5
|
+
background-color: #f9fafb;
|
|
6
|
+
|
|
7
|
+
&:first-child {
|
|
8
|
+
border-top: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (prefers-color-scheme: dark) {
|
|
12
|
+
border-color: #374151;
|
|
13
|
+
background-color: #111827;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// packages/ui/src/components/basic/CardFooter.tsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './CardFooter.css';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @brief Props of CardFooter: the content and the extra classes.
|
|
7
|
+
*
|
|
8
|
+
* @property children - Content rendered inside the footer.
|
|
9
|
+
* @property className - Extra classes appended to the root element.
|
|
10
|
+
*/
|
|
11
|
+
export interface CardFooterProps {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CardFooter = React.forwardRef<HTMLDivElement, CardFooterProps>(
|
|
17
|
+
({ children, className = '' }, ref) => {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={`g3nui card__footer ${className}`}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
CardFooter.displayName = 'CardFooter';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// packages/ui/src/components/basic/CardHeader.tsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './CardHeader.css';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @brief Props of CardHeader: the content and the extra classes.
|
|
7
|
+
*
|
|
8
|
+
* @property children - Content rendered inside the header.
|
|
9
|
+
* @property className - Extra classes appended to the root element.
|
|
10
|
+
*/
|
|
11
|
+
export interface CardHeaderProps {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
|
|
17
|
+
({ children, className = '' }, ref) => {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={`g3nui card__header ${className}`}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
CardHeader.displayName = 'CardHeader';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// packages/ui/src/components/basic/card.meta.ts
|
|
2
|
+
import type { PackagedComponent } from "@g3nomaly/ui/types";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: "Card",
|
|
6
|
+
description: "A flexible card component.",
|
|
7
|
+
category: "basic",
|
|
8
|
+
files: [
|
|
9
|
+
{ path: "basic/Card.tsx", type: "component" },
|
|
10
|
+
{ path: "basic/Card.css", type: "style" },
|
|
11
|
+
{ path: "basic/Card.debug.ts", type: "util" },
|
|
12
|
+
],
|
|
13
|
+
registryDependencies: [],
|
|
14
|
+
} satisfies PackagedComponent;
|