aplance-ui 1.5.2 → 1.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/README.md +1 -1
- package/dist/api.d.ts +2 -1
- package/dist/api.js +103 -68
- package/dist/api.js.map +1 -1
- package/dist/frameworks/vite-react/vite.config.ts.template +1 -1
- package/dist/index.js +103 -68
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
- package/registry/components/primitives/modal/modal.module.css +9 -3
- package/registry/components/primitives/popover/popover-context.ts +2 -0
- package/registry/components/primitives/popover/popover.tsx +47 -2
- package/registry/components/ui/chart/chart.tsx +51 -30
- package/registry/components/ui/chart/types.ts +5 -1
- package/registry/components/ui/data-table/checkbox-column.tsx +12 -8
- package/registry/components/ui/data-table/data-table.module.css +41 -19
- package/registry/components/ui/data-table/data-table.tsx +1285 -1238
- package/registry/components/ui/data-table/filter-bar.tsx +56 -13
- package/registry/components/ui/data-table/filter-modal.tsx +16 -82
- package/registry/components/ui/data-table/filter-sheet.tsx +97 -0
- package/registry/components/ui/data-table/filters.tsx +21 -21
- package/registry/components/ui/data-table/pagination-bar.tsx +4 -6
- package/registry/components/ui/data-table/types.ts +149 -80
- package/registry/components/ui/data-table/useDataTable.tsx +35 -16
- package/registry/components/ui/data-table/utils.ts +691 -471
- package/registry/components/ui/input-fields/date-picker/calendar.tsx +7 -15
- package/registry/components/ui/input-fields/date-picker/date-picker.tsx +1 -1
- package/registry/components/ui/input-fields/date-picker/types.ts +3 -3
- package/registry/components/ui/input-fields/emoji-picker/emoji-palette.tsx +1 -1
- package/registry/registry.json +16 -11
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A source-first React UI CLI by Aplance Technologies. `aplance-ui` scaffolds comp
|
|
|
4
4
|
|
|
5
5
|
## Install & init
|
|
6
6
|
|
|
7
|
-
Inside an existing React project (Vite + React, Next.js, TanStack Start, Astro, or Electron-Vite):
|
|
7
|
+
Inside an existing React 19 project (Vite + React, Next.js, TanStack Start, Astro, or Electron-Vite), on Node.js 20.12 or newer:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npx aplance-ui init
|
package/dist/api.d.ts
CHANGED
|
@@ -176,4 +176,5 @@ interface ListCommandOptions {
|
|
|
176
176
|
}
|
|
177
177
|
declare const runList: (opts: ListCommandOptions) => void;
|
|
178
178
|
|
|
179
|
-
export {
|
|
179
|
+
export { CSS_CONFIG_PLACEMENTS, SUPPORTED_TEMPLATES, allUnitsInOrder, configExists, findColor, findRadius, findSpacing, loadConfig, loadRegistry, makeDefaultConfig, resolvePaths, resolveUnits, runAdd, runInit, runList };
|
|
180
|
+
export type { AddCommandOptions, ComponentsConfig, CssConfigPlacement, FrameworkTemplate, InitCommandOptions, InstallMeta, ListCommandOptions, LoadedRegistry, Registry, RegistryUnit, ResolvedPaths, ThemeDescriptor, ThemeRegistry };
|
package/dist/api.js
CHANGED
|
@@ -180,10 +180,11 @@ var applyFileOps = async (ops, opts) => {
|
|
|
180
180
|
ensureDir(op.target);
|
|
181
181
|
writeFileSync(op.target, op.content);
|
|
182
182
|
} catch (err) {
|
|
183
|
-
const
|
|
183
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
184
184
|
throw new Error(
|
|
185
|
-
`Failed to write ${rel}: ${
|
|
186
|
-
${written} file(s) were already written before this failure. Fix the underlying issue (permissions? disk space?) and re-run - identical files will be detected as unchanged and skipped
|
|
185
|
+
`Failed to write ${rel}: ${reason}
|
|
186
|
+
${written} file(s) were already written before this failure. Fix the underlying issue (permissions? disk space?) and re-run - identical files will be detected as unchanged and skipped.`,
|
|
187
|
+
{ cause: err }
|
|
187
188
|
);
|
|
188
189
|
}
|
|
189
190
|
logger.ok(`wrote ${rel}`);
|
|
@@ -1111,18 +1112,18 @@ var firstExisting = (cwd, names) => {
|
|
|
1111
1112
|
var readDeclaredDeps = (packageJsonPath) => {
|
|
1112
1113
|
try {
|
|
1113
1114
|
const pkg = JSON.parse(readFileSync7(packageJsonPath, "utf8"));
|
|
1114
|
-
return
|
|
1115
|
-
...Object.
|
|
1116
|
-
...Object.
|
|
1117
|
-
...Object.
|
|
1115
|
+
return new Map([
|
|
1116
|
+
...Object.entries(pkg.peerDependencies ?? {}),
|
|
1117
|
+
...Object.entries(pkg.devDependencies ?? {}),
|
|
1118
|
+
...Object.entries(pkg.dependencies ?? {})
|
|
1118
1119
|
]);
|
|
1119
1120
|
} catch {
|
|
1120
|
-
return /* @__PURE__ */ new
|
|
1121
|
+
return /* @__PURE__ */ new Map();
|
|
1121
1122
|
}
|
|
1122
1123
|
};
|
|
1123
1124
|
var detectProject = (cwd) => {
|
|
1124
1125
|
const packageJsonPath = existsSync6(join6(cwd, "package.json")) ? join6(cwd, "package.json") : null;
|
|
1125
|
-
const declaredDeps = packageJsonPath ? readDeclaredDeps(packageJsonPath) : /* @__PURE__ */ new
|
|
1126
|
+
const declaredDeps = packageJsonPath ? readDeclaredDeps(packageJsonPath) : /* @__PURE__ */ new Map();
|
|
1126
1127
|
const viteConfigPath = firstExisting(cwd, VITE_CONFIG_NAMES);
|
|
1127
1128
|
const nextConfigPath = firstExisting(cwd, NEXT_CONFIG_NAMES);
|
|
1128
1129
|
const astroConfigPath = firstExisting(cwd, ASTRO_CONFIG_NAMES);
|
|
@@ -1393,35 +1394,84 @@ var detectPackageManager = (cwd) => {
|
|
|
1393
1394
|
if (existsSync8(join8(cwd, "package-lock.json"))) return "npm";
|
|
1394
1395
|
return "npm";
|
|
1395
1396
|
};
|
|
1396
|
-
var
|
|
1397
|
-
const
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
const devDependencies = { ...meta.baseDevDependencies };
|
|
1401
|
-
if (cfg.utilities.enabled) {
|
|
1402
|
-
Object.assign(devDependencies, meta.utilitiesDevDependencies);
|
|
1397
|
+
var leadingMajor = (spec) => {
|
|
1398
|
+
const value = spec.trim();
|
|
1399
|
+
if (value.includes("||") || value.includes(":") || /\s-\s/.test(value)) {
|
|
1400
|
+
return null;
|
|
1403
1401
|
}
|
|
1402
|
+
const match = /^(?:\^|~|>=|=|v)?\s*(\d+)(?:[.\s]|$)/.exec(value);
|
|
1403
|
+
return match ? Number(match[1]) : null;
|
|
1404
|
+
};
|
|
1405
|
+
var isOlderMajor = (declared, required) => {
|
|
1406
|
+
const have = leadingMajor(declared);
|
|
1407
|
+
const need = leadingMajor(required);
|
|
1408
|
+
return have !== null && need !== null && have < need;
|
|
1409
|
+
};
|
|
1410
|
+
var unitDependencies = (meta, units) => {
|
|
1411
|
+
const deps = {};
|
|
1404
1412
|
for (const unit of units) {
|
|
1405
1413
|
for (const pkg of unit.externalDeps) {
|
|
1406
|
-
if (pkg in dependencies) continue;
|
|
1407
1414
|
const version = meta.packageVersions[pkg];
|
|
1408
|
-
if (
|
|
1409
|
-
dependencies[pkg] = version;
|
|
1415
|
+
if (version) deps[pkg] = version;
|
|
1410
1416
|
}
|
|
1411
1417
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
+
return deps;
|
|
1419
|
+
};
|
|
1420
|
+
var settleDeclared = (bags, meta, project) => {
|
|
1421
|
+
const toolchain = /* @__PURE__ */ new Set([
|
|
1422
|
+
...Object.keys(meta.baseDependencies),
|
|
1423
|
+
...Object.keys(meta.baseDevDependencies),
|
|
1424
|
+
...Object.keys(meta.utilitiesDevDependencies)
|
|
1425
|
+
]);
|
|
1426
|
+
const settled = {
|
|
1427
|
+
skipped: [],
|
|
1428
|
+
upgraded: [],
|
|
1429
|
+
outdated: []
|
|
1430
|
+
};
|
|
1431
|
+
for (const bag of bags) {
|
|
1432
|
+
for (const [name, required] of Object.entries(bag)) {
|
|
1433
|
+
const declared = project.declaredDeps.get(name);
|
|
1434
|
+
if (declared === void 0) continue;
|
|
1435
|
+
if (!isOlderMajor(declared, required)) {
|
|
1436
|
+
settled.skipped.push({ name, reason: "already-declared" });
|
|
1437
|
+
} else if (toolchain.has(name)) {
|
|
1438
|
+
settled.outdated.push({ name, declared, required });
|
|
1439
|
+
} else {
|
|
1440
|
+
settled.upgraded.push({ name, from: declared, to: required });
|
|
1441
|
+
continue;
|
|
1418
1442
|
}
|
|
1443
|
+
delete bag[name];
|
|
1419
1444
|
}
|
|
1445
|
+
}
|
|
1446
|
+
return settled;
|
|
1447
|
+
};
|
|
1448
|
+
var computeDependencyPlan = (input) => {
|
|
1449
|
+
const { registry, units, cfg, project } = input;
|
|
1450
|
+
const meta = registry.installMeta;
|
|
1451
|
+
const dependencies = { ...meta.baseDependencies };
|
|
1452
|
+
for (const [name, range] of Object.entries(unitDependencies(meta, units))) {
|
|
1453
|
+
if (!(name in dependencies)) dependencies[name] = range;
|
|
1454
|
+
}
|
|
1455
|
+
const devDependencies = {
|
|
1456
|
+
...meta.baseDevDependencies,
|
|
1457
|
+
...cfg.utilities.enabled ? meta.utilitiesDevDependencies : {}
|
|
1458
|
+
};
|
|
1459
|
+
return {
|
|
1460
|
+
dependencies,
|
|
1461
|
+
devDependencies,
|
|
1462
|
+
...settleDeclared([dependencies, devDependencies], meta, project)
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
var computeUnitDependencyPlan = (input) => {
|
|
1466
|
+
const meta = input.registry.installMeta;
|
|
1467
|
+
const dependencies = unitDependencies(meta, input.units);
|
|
1468
|
+
return {
|
|
1469
|
+
dependencies,
|
|
1470
|
+
devDependencies: {},
|
|
1471
|
+
...settleDeclared([dependencies], meta, input.project)
|
|
1420
1472
|
};
|
|
1421
|
-
filter(dependencies);
|
|
1422
|
-
filter(devDependencies);
|
|
1423
|
-
return { dependencies, devDependencies, skipped };
|
|
1424
1473
|
};
|
|
1474
|
+
var quoteArg = (arg) => /^[\w@./:=+-]+$/.test(arg) ? arg : `"${arg}"`;
|
|
1425
1475
|
var buildInstallCommands = (pm, plan) => {
|
|
1426
1476
|
const commands = [];
|
|
1427
1477
|
const runtimeSpecs = Object.entries(plan.dependencies).map(
|
|
@@ -1432,20 +1482,13 @@ var buildInstallCommands = (pm, plan) => {
|
|
|
1432
1482
|
);
|
|
1433
1483
|
const runtimeArgs = installArgs(pm, runtimeSpecs, false);
|
|
1434
1484
|
const devArgs = installArgs(pm, devSpecs, true);
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
if (devSpecs.length > 0) {
|
|
1443
|
-
commands.push({
|
|
1444
|
-
bin: pm,
|
|
1445
|
-
args: devArgs,
|
|
1446
|
-
label: `${pm} ${devArgs.join(" ")}`
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1485
|
+
const command = (args) => ({
|
|
1486
|
+
bin: pm,
|
|
1487
|
+
args,
|
|
1488
|
+
label: [pm, ...args].map(quoteArg).join(" ")
|
|
1489
|
+
});
|
|
1490
|
+
if (runtimeSpecs.length > 0) commands.push(command(runtimeArgs));
|
|
1491
|
+
if (devSpecs.length > 0) commands.push(command(devArgs));
|
|
1449
1492
|
return commands;
|
|
1450
1493
|
};
|
|
1451
1494
|
var installArgs = (pm, specs, dev) => {
|
|
@@ -1470,12 +1513,12 @@ var runInstall = async (commands, opts) => {
|
|
|
1470
1513
|
for (const cmd of commands) {
|
|
1471
1514
|
opts.onCommand?.(cmd);
|
|
1472
1515
|
await new Promise((resolve, reject) => {
|
|
1473
|
-
const
|
|
1516
|
+
const spawnOptions = {
|
|
1474
1517
|
cwd: opts.cwd,
|
|
1475
1518
|
stdio: "inherit",
|
|
1476
|
-
env: { ...process.env, ...opts.env }
|
|
1477
|
-
|
|
1478
|
-
});
|
|
1519
|
+
env: { ...process.env, ...opts.env }
|
|
1520
|
+
};
|
|
1521
|
+
const child = process.platform === "win32" ? spawn(cmd.label, { ...spawnOptions, shell: true }) : spawn(cmd.bin, cmd.args, spawnOptions);
|
|
1479
1522
|
child.on("error", reject);
|
|
1480
1523
|
child.on("close", (code) => {
|
|
1481
1524
|
if (code === 0) resolve();
|
|
@@ -1491,7 +1534,11 @@ var runInstall = async (commands, opts) => {
|
|
|
1491
1534
|
};
|
|
1492
1535
|
var describePlan = (plan) => {
|
|
1493
1536
|
const lines = [];
|
|
1494
|
-
const
|
|
1537
|
+
const upgradedFrom = new Map(plan.upgraded.map((u) => [u.name, u.from]));
|
|
1538
|
+
const rows = (bag) => Object.entries(bag).sort(([a], [b]) => a.localeCompare(b)).map(([name, v]) => {
|
|
1539
|
+
const from = upgradedFrom.get(name);
|
|
1540
|
+
return ` ${name} ${v}${from ? ` (upgrades ${from})` : ""}`;
|
|
1541
|
+
});
|
|
1495
1542
|
if (Object.keys(plan.dependencies).length) {
|
|
1496
1543
|
lines.push("dependencies:");
|
|
1497
1544
|
lines.push(...rows(plan.dependencies));
|
|
@@ -1506,6 +1553,13 @@ var describePlan = (plan) => {
|
|
|
1506
1553
|
lines.push("already declared (kept as-is):");
|
|
1507
1554
|
lines.push(...plan.skipped.map((s) => ` ${s.name}`));
|
|
1508
1555
|
}
|
|
1556
|
+
if (plan.outdated.length) {
|
|
1557
|
+
if (lines.length) lines.push("");
|
|
1558
|
+
lines.push("older major kept as-is (upgrade when you can):");
|
|
1559
|
+
lines.push(
|
|
1560
|
+
...plan.outdated.map((o) => ` ${o.name} ${o.declared} (scaffold expects ${o.required})`)
|
|
1561
|
+
);
|
|
1562
|
+
}
|
|
1509
1563
|
if (!lines.length) lines.push("nothing to install - all deps already declared.");
|
|
1510
1564
|
return lines.join("\n");
|
|
1511
1565
|
};
|
|
@@ -1825,7 +1879,7 @@ var runInit = async (opts) => {
|
|
|
1825
1879
|
${snippet.content.split("\n").map((l) => " " + l).join("\n")}`);
|
|
1826
1880
|
}
|
|
1827
1881
|
steps.push(
|
|
1828
|
-
`${pc4.cyan(String(stepIdx
|
|
1882
|
+
`${pc4.cyan(String(stepIdx))} ${pc4.bold("Add more components anytime")}
|
|
1829
1883
|
npx aplance-ui add <name> ${pc4.dim("# e.g. button modal tooltip")}
|
|
1830
1884
|
npx aplance-ui add ${pc4.dim("# interactive multi-select")}
|
|
1831
1885
|
npx aplance-ui list ${pc4.dim("# see everything available")}`
|
|
@@ -1885,7 +1939,7 @@ var runAdd = async (opts) => {
|
|
|
1885
1939
|
});
|
|
1886
1940
|
const summary = `${result.written} written \xB7 ${result.skipped} skipped \xB7 ${result.unchanged} unchanged`;
|
|
1887
1941
|
const project = detectProject(opts.cwd);
|
|
1888
|
-
const plan =
|
|
1942
|
+
const plan = computeUnitDependencyPlan({ registry, units, project });
|
|
1889
1943
|
const pm = opts.packageManager ?? detectPackageManager(opts.cwd);
|
|
1890
1944
|
const installCommands = buildInstallCommands(pm, plan);
|
|
1891
1945
|
const hasWork = installCommands.length > 0;
|
|
@@ -1943,25 +1997,6 @@ var runAdd = async (opts) => {
|
|
|
1943
1997
|
logger.info(summary);
|
|
1944
1998
|
goodbye(`Added ${units.length} unit${units.length === 1 ? "" : "s"}.`);
|
|
1945
1999
|
};
|
|
1946
|
-
var computeRuntimePlan = (registry, units, project) => {
|
|
1947
|
-
const dependencies = {};
|
|
1948
|
-
const skipped = [];
|
|
1949
|
-
const meta = registry.installMeta;
|
|
1950
|
-
for (const unit of units) {
|
|
1951
|
-
for (const pkg of unit.externalDeps) {
|
|
1952
|
-
const version = meta.packageVersions[pkg];
|
|
1953
|
-
if (!version) continue;
|
|
1954
|
-
if (project.declaredDeps.has(pkg)) {
|
|
1955
|
-
if (!skipped.some((entry) => entry.name === pkg)) {
|
|
1956
|
-
skipped.push({ name: pkg, reason: "already-declared" });
|
|
1957
|
-
}
|
|
1958
|
-
continue;
|
|
1959
|
-
}
|
|
1960
|
-
dependencies[pkg] = version;
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
return { dependencies, devDependencies: {}, skipped };
|
|
1964
|
-
};
|
|
1965
2000
|
var pickUnits = async (all) => multiselect2({
|
|
1966
2001
|
message: `Select units to add ${pc5.dim("(space to toggle, enter to confirm)")}`,
|
|
1967
2002
|
options: groupedUnitOptions(all),
|