@dinachi/cli 0.8.2 → 0.10.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/CHANGELOG.md +144 -0
- package/README.md +36 -5
- package/dist/index.js +336 -62
- package/package.json +17 -14
- package/templates/animated-icon/animated-icon.tsx +145 -0
- package/templates/animated-icon/index.ts +1 -0
- package/templates/animated-list/animated-list.tsx +161 -0
- package/templates/animated-list/index.ts +2 -0
- package/templates/animated-tabs/animated-tabs.tsx +244 -0
- package/templates/animated-tabs/index.ts +13 -0
- package/templates/badge/badge.tsx +4 -4
- package/templates/carousel/carousel.tsx +492 -0
- package/templates/carousel/index.ts +1 -0
- package/templates/compare-slider/compare-slider.tsx +383 -0
- package/templates/compare-slider/index.ts +2 -0
- package/templates/expandable-card/expandable-card.tsx +509 -0
- package/templates/expandable-card/index.ts +1 -0
- package/templates/hold-to-confirm/hold-to-confirm.tsx +573 -0
- package/templates/hold-to-confirm/index.ts +2 -0
- package/templates/load-transition/index.ts +1 -0
- package/templates/load-transition/load-transition.tsx +163 -0
- package/templates/marquee/index.ts +2 -0
- package/templates/marquee/marquee.tsx +256 -0
- package/templates/number-ticker/index.ts +2 -0
- package/templates/number-ticker/number-ticker.tsx +470 -0
- package/templates/otp-field/index.ts +1 -0
- package/templates/otp-field/otp-field.tsx +72 -0
- package/templates/progress-ring/index.ts +1 -0
- package/templates/progress-ring/progress-ring.tsx +268 -0
- package/templates/scroll-progress/index.ts +2 -0
- package/templates/scroll-progress/scroll-progress.tsx +147 -0
- package/templates/scroll-reveal/index.ts +2 -0
- package/templates/scroll-reveal/scroll-reveal.tsx +198 -0
- package/templates/select/select.tsx +4 -2
- package/templates/slider/slider.tsx +1 -1
- package/templates/sortable/index.ts +1 -0
- package/templates/sortable/sortable.tsx +349 -0
- package/templates/stagger-list/index.ts +2 -0
- package/templates/stagger-list/stagger-list.tsx +204 -0
- package/templates/streaming-text/index.ts +2 -0
- package/templates/streaming-text/streaming-text.tsx +220 -0
- package/templates/swipeable-row/index.ts +2 -0
- package/templates/swipeable-row/swipeable-row.tsx +368 -0
- package/templates/text-morph/index.ts +2 -0
- package/templates/text-morph/text-morph.tsx +265 -0
- package/templates/text-shimmer/index.ts +2 -0
- package/templates/text-shimmer/text-shimmer.tsx +151 -0
- package/templates/textarea/textarea.tsx +1 -2
- package/templates/toast/toast.tsx +24 -19
- package/templates/tsconfig.json +1 -0
- package/LICENSE +0 -21
- package/templates/utils/variants.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -66,10 +66,6 @@ function getUtilityRegistry() {
|
|
|
66
66
|
cn: {
|
|
67
67
|
name: "utils",
|
|
68
68
|
dependencies: ["clsx", "tailwind-merge"]
|
|
69
|
-
},
|
|
70
|
-
variants: {
|
|
71
|
-
name: "variants",
|
|
72
|
-
dependencies: ["class-variance-authority"]
|
|
73
69
|
}
|
|
74
70
|
};
|
|
75
71
|
}
|
|
@@ -86,7 +82,7 @@ function getComponentRegistry() {
|
|
|
86
82
|
name: "alert-dialog",
|
|
87
83
|
description: "A modal dialog that interrupts the user with important content and expects a response.",
|
|
88
84
|
files: [{ name: "alert-dialog.tsx" }, { name: "index.ts" }],
|
|
89
|
-
dependencies: ["@base-ui/react"
|
|
85
|
+
dependencies: ["@base-ui/react"],
|
|
90
86
|
utilityDependencies: ["cn"]
|
|
91
87
|
},
|
|
92
88
|
autocomplete: {
|
|
@@ -107,7 +103,7 @@ function getComponentRegistry() {
|
|
|
107
103
|
name: "badge",
|
|
108
104
|
description: "A small status indicator for highlighting information.",
|
|
109
105
|
files: [{ name: "badge.tsx" }, { name: "index.ts" }],
|
|
110
|
-
dependencies: ["
|
|
106
|
+
dependencies: ["class-variance-authority"],
|
|
111
107
|
utilityDependencies: ["cn"]
|
|
112
108
|
},
|
|
113
109
|
button: {
|
|
@@ -115,7 +111,7 @@ function getComponentRegistry() {
|
|
|
115
111
|
description: "A customizable button component with multiple variants.",
|
|
116
112
|
files: [{ name: "button.tsx" }, { name: "index.ts" }],
|
|
117
113
|
dependencies: ["@base-ui/react", "class-variance-authority"],
|
|
118
|
-
utilityDependencies: ["cn"
|
|
114
|
+
utilityDependencies: ["cn"]
|
|
119
115
|
},
|
|
120
116
|
card: {
|
|
121
117
|
name: "card",
|
|
@@ -213,7 +209,7 @@ function getComponentRegistry() {
|
|
|
213
209
|
name: "link",
|
|
214
210
|
description: "A semantic anchor element with style variants and support for external links and framework router composition.",
|
|
215
211
|
files: [{ name: "link.tsx" }, { name: "index.ts" }],
|
|
216
|
-
dependencies: ["class-variance-authority"],
|
|
212
|
+
dependencies: ["@base-ui/react", "class-variance-authority"],
|
|
217
213
|
utilityDependencies: ["cn"]
|
|
218
214
|
},
|
|
219
215
|
menu: {
|
|
@@ -251,6 +247,13 @@ function getComponentRegistry() {
|
|
|
251
247
|
dependencies: ["@base-ui/react", "lucide-react"],
|
|
252
248
|
utilityDependencies: ["cn"]
|
|
253
249
|
},
|
|
250
|
+
"otp-field": {
|
|
251
|
+
name: "otp-field",
|
|
252
|
+
description: "A one-time password / verification code input with auto-focus, paste handling, and validation.",
|
|
253
|
+
files: [{ name: "otp-field.tsx" }, { name: "index.ts" }],
|
|
254
|
+
dependencies: ["@base-ui/react"],
|
|
255
|
+
utilityDependencies: ["cn"]
|
|
256
|
+
},
|
|
254
257
|
popover: {
|
|
255
258
|
name: "popover",
|
|
256
259
|
description: "An anchored floating panel for contextual information and lightweight interactions.",
|
|
@@ -377,6 +380,161 @@ function getComponentRegistry() {
|
|
|
377
380
|
dependencies: ["@base-ui/react"],
|
|
378
381
|
utilityDependencies: ["cn"]
|
|
379
382
|
},
|
|
383
|
+
// ---- Motion tier ----------------------------------------------------
|
|
384
|
+
// Opt-in. Nothing in the core tier depends on these, and installing a core
|
|
385
|
+
// component never pulls in `motion`.
|
|
386
|
+
"animated-icon": {
|
|
387
|
+
name: "animated-icon",
|
|
388
|
+
description: "Two icons in one place, trading with a transition instead of a swap.",
|
|
389
|
+
files: [{ name: "animated-icon.tsx" }, { name: "index.ts" }],
|
|
390
|
+
dependencies: ["motion"],
|
|
391
|
+
utilityDependencies: ["cn"],
|
|
392
|
+
tier: "motion"
|
|
393
|
+
},
|
|
394
|
+
"animated-list": {
|
|
395
|
+
name: "animated-list",
|
|
396
|
+
description: "A list that animates entrances, exits, and the rows displaced by both.",
|
|
397
|
+
files: [{ name: "animated-list.tsx" }, { name: "index.ts" }],
|
|
398
|
+
dependencies: ["motion"],
|
|
399
|
+
utilityDependencies: ["cn"],
|
|
400
|
+
tier: "motion"
|
|
401
|
+
},
|
|
402
|
+
"animated-tabs": {
|
|
403
|
+
name: "animated-tabs",
|
|
404
|
+
description: "Tabs whose active pill travels between triggers using a shared layout animation.",
|
|
405
|
+
files: [{ name: "animated-tabs.tsx" }, { name: "index.ts" }],
|
|
406
|
+
dependencies: ["@base-ui/react", "motion"],
|
|
407
|
+
utilityDependencies: ["cn"],
|
|
408
|
+
tier: "motion"
|
|
409
|
+
},
|
|
410
|
+
carousel: {
|
|
411
|
+
name: "carousel",
|
|
412
|
+
description: "A carousel that snaps to where the flick was aimed, not to where it stopped.",
|
|
413
|
+
files: [{ name: "carousel.tsx" }, { name: "index.ts" }],
|
|
414
|
+
dependencies: ["motion"],
|
|
415
|
+
utilityDependencies: ["cn"],
|
|
416
|
+
tier: "motion"
|
|
417
|
+
},
|
|
418
|
+
"compare-slider": {
|
|
419
|
+
name: "compare-slider",
|
|
420
|
+
description: "A draggable divider for comparing two layers side by side.",
|
|
421
|
+
files: [{ name: "compare-slider.tsx" }, { name: "index.ts" }],
|
|
422
|
+
dependencies: ["motion"],
|
|
423
|
+
utilityDependencies: ["cn"],
|
|
424
|
+
tier: "motion"
|
|
425
|
+
},
|
|
426
|
+
"expandable-card": {
|
|
427
|
+
name: "expandable-card",
|
|
428
|
+
description: "A card that opens into its own detail view using a shared layout animation.",
|
|
429
|
+
files: [{ name: "expandable-card.tsx" }, { name: "index.ts" }],
|
|
430
|
+
dependencies: ["motion"],
|
|
431
|
+
utilityDependencies: ["cn"],
|
|
432
|
+
tier: "motion"
|
|
433
|
+
},
|
|
434
|
+
"hold-to-confirm": {
|
|
435
|
+
name: "hold-to-confirm",
|
|
436
|
+
description: "A destructive action gated behind a deliberate press-and-hold.",
|
|
437
|
+
files: [{ name: "hold-to-confirm.tsx" }, { name: "index.ts" }],
|
|
438
|
+
dependencies: ["@base-ui/react", "motion"],
|
|
439
|
+
utilityDependencies: ["cn"],
|
|
440
|
+
tier: "motion"
|
|
441
|
+
},
|
|
442
|
+
"load-transition": {
|
|
443
|
+
name: "load-transition",
|
|
444
|
+
description: "The handover from skeleton to content, without the height jump.",
|
|
445
|
+
files: [{ name: "load-transition.tsx" }, { name: "index.ts" }],
|
|
446
|
+
dependencies: ["motion"],
|
|
447
|
+
utilityDependencies: ["cn"],
|
|
448
|
+
tier: "motion"
|
|
449
|
+
},
|
|
450
|
+
marquee: {
|
|
451
|
+
name: "marquee",
|
|
452
|
+
description: "A seamless looping ticker that pauses on hover and focus.",
|
|
453
|
+
files: [{ name: "marquee.tsx" }, { name: "index.ts" }],
|
|
454
|
+
dependencies: ["motion"],
|
|
455
|
+
utilityDependencies: ["cn"],
|
|
456
|
+
tier: "motion"
|
|
457
|
+
},
|
|
458
|
+
"number-ticker": {
|
|
459
|
+
name: "number-ticker",
|
|
460
|
+
description: "A number that springs to its value with tabular figures.",
|
|
461
|
+
files: [{ name: "number-ticker.tsx" }, { name: "index.ts" }],
|
|
462
|
+
dependencies: ["motion"],
|
|
463
|
+
utilityDependencies: ["cn"],
|
|
464
|
+
tier: "motion"
|
|
465
|
+
},
|
|
466
|
+
"progress-ring": {
|
|
467
|
+
name: "progress-ring",
|
|
468
|
+
description: "A radial progress arc, spring-driven, with an indeterminate sweep.",
|
|
469
|
+
files: [{ name: "progress-ring.tsx" }, { name: "index.ts" }],
|
|
470
|
+
dependencies: ["motion"],
|
|
471
|
+
utilityDependencies: ["cn"],
|
|
472
|
+
tier: "motion"
|
|
473
|
+
},
|
|
474
|
+
"scroll-progress": {
|
|
475
|
+
name: "scroll-progress",
|
|
476
|
+
description: "A spring-smoothed bar tracking how far a container has been scrolled.",
|
|
477
|
+
files: [{ name: "scroll-progress.tsx" }, { name: "index.ts" }],
|
|
478
|
+
dependencies: ["motion"],
|
|
479
|
+
utilityDependencies: ["cn"],
|
|
480
|
+
tier: "motion"
|
|
481
|
+
},
|
|
482
|
+
"scroll-reveal": {
|
|
483
|
+
name: "scroll-reveal",
|
|
484
|
+
description: "Content that wipes into view with a clip-path as it enters the viewport.",
|
|
485
|
+
files: [{ name: "scroll-reveal.tsx" }, { name: "index.ts" }],
|
|
486
|
+
dependencies: ["motion"],
|
|
487
|
+
utilityDependencies: ["cn"],
|
|
488
|
+
tier: "motion"
|
|
489
|
+
},
|
|
490
|
+
"sortable": {
|
|
491
|
+
name: "sortable",
|
|
492
|
+
description: "A list reordered by drag or by keyboard, both ending in the same place.",
|
|
493
|
+
files: [{ name: "sortable.tsx" }, { name: "index.ts" }],
|
|
494
|
+
dependencies: ["motion"],
|
|
495
|
+
utilityDependencies: ["cn"],
|
|
496
|
+
tier: "motion"
|
|
497
|
+
},
|
|
498
|
+
"stagger-list": {
|
|
499
|
+
name: "stagger-list",
|
|
500
|
+
description: "A list whose items rise into place one after another.",
|
|
501
|
+
files: [{ name: "stagger-list.tsx" }, { name: "index.ts" }],
|
|
502
|
+
dependencies: ["motion"],
|
|
503
|
+
utilityDependencies: ["cn"],
|
|
504
|
+
tier: "motion"
|
|
505
|
+
},
|
|
506
|
+
"streaming-text": {
|
|
507
|
+
name: "streaming-text",
|
|
508
|
+
description: "Text revealed a word at a time as it streams in, without rewinding.",
|
|
509
|
+
files: [{ name: "streaming-text.tsx" }, { name: "index.ts" }],
|
|
510
|
+
dependencies: ["motion"],
|
|
511
|
+
utilityDependencies: ["cn"],
|
|
512
|
+
tier: "motion"
|
|
513
|
+
},
|
|
514
|
+
"swipeable-row": {
|
|
515
|
+
name: "swipeable-row",
|
|
516
|
+
description: "A row whose actions are revealed by a velocity-projected swipe.",
|
|
517
|
+
files: [{ name: "swipeable-row.tsx" }, { name: "index.ts" }],
|
|
518
|
+
dependencies: ["motion"],
|
|
519
|
+
utilityDependencies: ["cn"],
|
|
520
|
+
tier: "motion"
|
|
521
|
+
},
|
|
522
|
+
"text-morph": {
|
|
523
|
+
name: "text-morph",
|
|
524
|
+
description: "Text that swaps with a blur-bridged crossfade instead of cutting.",
|
|
525
|
+
files: [{ name: "text-morph.tsx" }, { name: "index.ts" }],
|
|
526
|
+
dependencies: ["motion"],
|
|
527
|
+
utilityDependencies: ["cn"],
|
|
528
|
+
tier: "motion"
|
|
529
|
+
},
|
|
530
|
+
"text-shimmer": {
|
|
531
|
+
name: "text-shimmer",
|
|
532
|
+
description: "A highlight sweeping across text for quiet pending states.",
|
|
533
|
+
files: [{ name: "text-shimmer.tsx" }, { name: "index.ts" }],
|
|
534
|
+
dependencies: ["motion"],
|
|
535
|
+
utilityDependencies: ["cn"],
|
|
536
|
+
tier: "motion"
|
|
537
|
+
},
|
|
380
538
|
"json-render": {
|
|
381
539
|
name: "json-render",
|
|
382
540
|
description: "Adapter for @json-render \u2014 renders DinachiUI components from JSON specs with state binding, validation, and actions.",
|
|
@@ -400,7 +558,6 @@ function getComponentRegistry() {
|
|
|
400
558
|
"drawer",
|
|
401
559
|
"fieldset",
|
|
402
560
|
"input",
|
|
403
|
-
"label",
|
|
404
561
|
"number-field",
|
|
405
562
|
"popover",
|
|
406
563
|
"progress",
|
|
@@ -408,7 +565,6 @@ function getComponentRegistry() {
|
|
|
408
565
|
"scroll-area",
|
|
409
566
|
"select",
|
|
410
567
|
"separator",
|
|
411
|
-
"skeleton",
|
|
412
568
|
"slider",
|
|
413
569
|
"switch",
|
|
414
570
|
"tabs",
|
|
@@ -419,7 +575,6 @@ function getComponentRegistry() {
|
|
|
419
575
|
"toggle-group",
|
|
420
576
|
"tooltip"
|
|
421
577
|
],
|
|
422
|
-
utilityDependencies: ["cn"],
|
|
423
578
|
targetDir: "json-render",
|
|
424
579
|
integration: true
|
|
425
580
|
}
|
|
@@ -542,13 +697,14 @@ function parseJsonWithComments(content) {
|
|
|
542
697
|
|
|
543
698
|
// src/utils/dependencies.ts
|
|
544
699
|
var DEPENDENCY_VERSION_MAP = {
|
|
545
|
-
"@base-ui/react": "^1.
|
|
700
|
+
"@base-ui/react": "^1.7.0",
|
|
546
701
|
"lucide-react": "^0.552.0",
|
|
702
|
+
"motion": "^12.23.6",
|
|
547
703
|
"class-variance-authority": "^0.7.1",
|
|
548
704
|
"tailwindcss-animate": "^1.0.7",
|
|
549
705
|
"tw-animate-css": "^1.3.4",
|
|
550
706
|
"clsx": "^2.1.1",
|
|
551
|
-
"tailwind-merge": "^3.
|
|
707
|
+
"tailwind-merge": "^3.5.0",
|
|
552
708
|
"@json-render/core": "^0.14.0",
|
|
553
709
|
"@json-render/react": "^0.14.0",
|
|
554
710
|
"zod": "^4.0.0"
|
|
@@ -658,10 +814,9 @@ function tryResolveAsAlias(absoluteFilePath, compilerConfig) {
|
|
|
658
814
|
}
|
|
659
815
|
return null;
|
|
660
816
|
}
|
|
661
|
-
function rewriteTemplateImports(content, targetFilePath, utilsFilePath,
|
|
817
|
+
function rewriteTemplateImports(content, targetFilePath, utilsFilePath, compilerConfig) {
|
|
662
818
|
const utilsImportPath = tryResolveAsAlias(utilsFilePath, compilerConfig) ?? toImportPath(targetFilePath, utilsFilePath);
|
|
663
|
-
|
|
664
|
-
return content.replace(/(['"])@\/lib\/utils\1/g, `$1${utilsImportPath}$1`).replace(/(['"])@\/lib\/variants\1/g, `$1${variantsImportPath}$1`);
|
|
819
|
+
return content.replace(/(['"])@\/lib\/utils\1/g, `$1${utilsImportPath}$1`);
|
|
665
820
|
}
|
|
666
821
|
function getComponentDependencies(componentName, visited = /* @__PURE__ */ new Set()) {
|
|
667
822
|
if (visited.has(componentName)) {
|
|
@@ -880,7 +1035,38 @@ ${blocksToAppend.join("\n")}
|
|
|
880
1035
|
allFilesAdded.push({ name: "index.ts", path: indexPath });
|
|
881
1036
|
}
|
|
882
1037
|
}
|
|
883
|
-
|
|
1038
|
+
function componentsInTier(tier) {
|
|
1039
|
+
const registry = getComponentRegistry();
|
|
1040
|
+
return Object.keys(registry).filter(
|
|
1041
|
+
(name) => !registry[name].integration && (registry[name].tier ?? "core") === tier
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
function motionBuild(component) {
|
|
1045
|
+
const variant = component.variants?.motion;
|
|
1046
|
+
if (variant) return { variant, redundant: false };
|
|
1047
|
+
return { redundant: (component.tier ?? "core") === "motion" };
|
|
1048
|
+
}
|
|
1049
|
+
function resolveBuilds(names, wantsMotion) {
|
|
1050
|
+
const registry = getComponentRegistry();
|
|
1051
|
+
const asked = wantsMotion ? names.map((name) => ({ name, ...motionBuild(registry[name]) })) : [];
|
|
1052
|
+
return {
|
|
1053
|
+
builds: new Map(
|
|
1054
|
+
asked.flatMap(
|
|
1055
|
+
({ name, variant }) => variant ? [[name, { flag: "motion", variant }]] : []
|
|
1056
|
+
)
|
|
1057
|
+
),
|
|
1058
|
+
missing: asked.filter((entry) => !entry.variant && !entry.redundant).map((entry) => entry.name)
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function withComponentDependencies(names) {
|
|
1062
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
1063
|
+
for (const name of names) {
|
|
1064
|
+
resolved.add(name);
|
|
1065
|
+
for (const dep of getComponentDependencies(name)) resolved.add(dep);
|
|
1066
|
+
}
|
|
1067
|
+
return [...resolved];
|
|
1068
|
+
}
|
|
1069
|
+
var addCommand = new Command("add").description("Add a component to your project").argument("[components...]", "Names of the components to add (optional when using --all or --motion)").option("-y, --yes", "Skip confirmation prompts").option("-o, --overwrite", "Overwrite existing files").option("-a, --all", "Install every core component").option("-m, --motion", "With component names, install their motion build. On its own, install every motion component").option("--skip-install", "Skip package installation").action(
|
|
884
1070
|
async (componentNames, options) => {
|
|
885
1071
|
const spinner = ora("Adding component...").start();
|
|
886
1072
|
try {
|
|
@@ -892,49 +1078,40 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
892
1078
|
const projectRoot = process.cwd();
|
|
893
1079
|
const compilerPathConfig = readCompilerPathConfig(projectRoot);
|
|
894
1080
|
const registry = getComponentRegistry();
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
if (
|
|
910
|
-
spinner.fail(
|
|
1081
|
+
const includeMotionTier = options.motion && (componentNames.length === 0 || options.all);
|
|
1082
|
+
const bulk = [
|
|
1083
|
+
...options.all ? componentsInTier("core") : [],
|
|
1084
|
+
...includeMotionTier ? componentsInTier("motion") : []
|
|
1085
|
+
];
|
|
1086
|
+
if (bulk.length === 0 && componentNames.length === 0) {
|
|
1087
|
+
spinner.fail("\u274C Component name is required when not using --all or --motion.");
|
|
1088
|
+
console.log("Available components:");
|
|
1089
|
+
Object.keys(registry).forEach((name) => {
|
|
1090
|
+
console.log(` ${chalk.cyan(name)}`);
|
|
1091
|
+
});
|
|
1092
|
+
process.exit(1);
|
|
1093
|
+
}
|
|
1094
|
+
for (const name of componentNames) {
|
|
1095
|
+
if (!registry[name]) {
|
|
1096
|
+
spinner.fail(`\u274C Component "${name}" not found.`);
|
|
911
1097
|
console.log("Available components:");
|
|
912
|
-
Object.keys(registry).forEach((
|
|
913
|
-
console.log(` ${chalk.cyan(
|
|
1098
|
+
Object.keys(registry).forEach((n) => {
|
|
1099
|
+
console.log(` ${chalk.cyan(n)}`);
|
|
914
1100
|
});
|
|
915
1101
|
process.exit(1);
|
|
916
1102
|
}
|
|
917
|
-
for (const name of componentNames) {
|
|
918
|
-
if (!registry[name]) {
|
|
919
|
-
spinner.fail(`\u274C Component "${name}" not found.`);
|
|
920
|
-
console.log("Available components:");
|
|
921
|
-
Object.keys(registry).forEach((n) => {
|
|
922
|
-
console.log(` ${chalk.cyan(n)}`);
|
|
923
|
-
});
|
|
924
|
-
process.exit(1);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
const allWithDeps = /* @__PURE__ */ new Set();
|
|
928
|
-
for (const name of componentNames) {
|
|
929
|
-
allWithDeps.add(name);
|
|
930
|
-
const deps = getComponentDependencies(name);
|
|
931
|
-
deps.forEach((dep) => allWithDeps.add(dep));
|
|
932
|
-
}
|
|
933
|
-
componentsToInstall = Array.from(allWithDeps);
|
|
934
1103
|
}
|
|
935
|
-
|
|
936
|
-
|
|
1104
|
+
const { builds, missing } = resolveBuilds(componentNames, Boolean(options.motion));
|
|
1105
|
+
if (missing.length > 0) {
|
|
1106
|
+
spinner.fail(`\u274C No motion build for ${missing.map((n) => `"${n}"`).join(", ")}.`);
|
|
1107
|
+
console.log(`Install without --motion, or run ${chalk.cyan("dinachi add --motion")} for the motion tier.`);
|
|
1108
|
+
process.exit(1);
|
|
937
1109
|
}
|
|
1110
|
+
const componentsToInstall = withComponentDependencies([
|
|
1111
|
+
...bulk,
|
|
1112
|
+
...componentNames
|
|
1113
|
+
]);
|
|
1114
|
+
spinner.text = bulk.length > 0 ? `Installing ${componentsToInstall.length} components...` : `Installing ${componentsToInstall.join(", ")}...`;
|
|
938
1115
|
const componentDir = resolveConfiguredPath(config.aliases.ui, projectRoot, compilerPathConfig);
|
|
939
1116
|
const libDir = resolveConfiguredPath(config.aliases.lib, projectRoot, compilerPathConfig);
|
|
940
1117
|
const utilsFilePath = resolveConfiguredPath(config.aliases.utils, projectRoot, compilerPathConfig);
|
|
@@ -979,8 +1156,10 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
979
1156
|
if (comp.targetDir) {
|
|
980
1157
|
await fs3.ensureDir(fileTargetDir);
|
|
981
1158
|
}
|
|
1159
|
+
const build = builds.get(name);
|
|
1160
|
+
const templateDir = build?.variant.templateDir ?? name;
|
|
982
1161
|
for (const file of comp.files) {
|
|
983
|
-
const sourcePath = path3.join(__dirname2, "../templates",
|
|
1162
|
+
const sourcePath = path3.join(__dirname2, "../templates", templateDir, file.name);
|
|
984
1163
|
const targetPath = path3.join(fileTargetDir, file.name);
|
|
985
1164
|
if (file.name === "index.ts") {
|
|
986
1165
|
if (comp.targetDir) {
|
|
@@ -1008,13 +1187,16 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
1008
1187
|
spinner.start();
|
|
1009
1188
|
}
|
|
1010
1189
|
const templateContent = stripTemplateDirective(await fs3.readFile(sourcePath, "utf-8"));
|
|
1011
|
-
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath,
|
|
1190
|
+
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath, compilerPathConfig);
|
|
1012
1191
|
await fs3.writeFile(targetPath, rewrittenContent);
|
|
1013
1192
|
allFilesAdded.push({ name: file.name, path: targetPath });
|
|
1014
1193
|
}
|
|
1015
1194
|
if (comp.dependencies?.length) {
|
|
1016
1195
|
allDepsInstalled.push(...comp.dependencies);
|
|
1017
1196
|
}
|
|
1197
|
+
if (build?.variant.dependencies?.length) {
|
|
1198
|
+
allDepsInstalled.push(...build.variant.dependencies);
|
|
1199
|
+
}
|
|
1018
1200
|
if (name === "toast") {
|
|
1019
1201
|
const toastLibPath = path3.join(libDir, "toast.ts");
|
|
1020
1202
|
if (!fs3.existsSync(toastLibPath)) {
|
|
@@ -1067,8 +1249,8 @@ export const toastManager = createToastManager();
|
|
|
1067
1249
|
} else if (!options.skipInstall && uniqueDeps.length > 0) {
|
|
1068
1250
|
spinner.text = "All dependencies already installed.";
|
|
1069
1251
|
}
|
|
1070
|
-
if (
|
|
1071
|
-
spinner.succeed(`\u2705 Added
|
|
1252
|
+
if (bulk.length > 0) {
|
|
1253
|
+
spinner.succeed(`\u2705 Added ${componentsToInstall.length} components!`);
|
|
1072
1254
|
} else {
|
|
1073
1255
|
spinner.succeed(`\u2705 Added ${componentsToInstall.join(", ")}!`);
|
|
1074
1256
|
}
|
|
@@ -1109,6 +1291,17 @@ export const toastManager = createToastManager();
|
|
|
1109
1291
|
console.log(` ${chalk.blue("~")} ${dep}`);
|
|
1110
1292
|
});
|
|
1111
1293
|
}
|
|
1294
|
+
const unselected = componentsToInstall.flatMap(
|
|
1295
|
+
(name) => Object.entries(registry[name]?.variants ?? {}).filter(([flag]) => builds.get(name)?.flag !== flag).map(([flag, variant]) => ({ name, flag, variant }))
|
|
1296
|
+
);
|
|
1297
|
+
if (unselected.length > 0) {
|
|
1298
|
+
console.log();
|
|
1299
|
+
console.log("Also available in another build:");
|
|
1300
|
+
unselected.forEach(({ name, flag, variant }) => {
|
|
1301
|
+
console.log(` ${chalk.cyan(name)} ${chalk.dim(`\u2014 ${variant.description}`)}`);
|
|
1302
|
+
console.log(` ${chalk.dim(`dinachi add ${name} --${flag} --overwrite`)}`);
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1112
1305
|
} catch (error) {
|
|
1113
1306
|
spinner.fail(`\u274C Failed to add component: ${error instanceof Error ? error.message : error}`);
|
|
1114
1307
|
process.exit(1);
|
|
@@ -1157,7 +1350,7 @@ function detectTailwindMajorVersion2(projectRoot) {
|
|
|
1157
1350
|
return 4;
|
|
1158
1351
|
}
|
|
1159
1352
|
}
|
|
1160
|
-
var DINACHI_THEME_PREFIXES = ["--color-", "--radius-"];
|
|
1353
|
+
var DINACHI_THEME_PREFIXES = ["--color-", "--radius-", "--shadow-", "--shadow:"];
|
|
1161
1354
|
function extractPreservedThemeVars(css) {
|
|
1162
1355
|
const themeMatch = css.match(/@theme\s+inline\s*\{([^}]*)\}/);
|
|
1163
1356
|
if (!themeMatch) return [];
|
|
@@ -1188,10 +1381,44 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1188
1381
|
--success-foreground: oklch(1 0 0);
|
|
1189
1382
|
--warning: oklch(0.6365 0.1639 55.49);
|
|
1190
1383
|
--warning-foreground: oklch(1 0 0);
|
|
1384
|
+
--info: oklch(0.623 0.214 259.815);
|
|
1385
|
+
--info-foreground: oklch(1 0 0);
|
|
1191
1386
|
--border: oklch(0.9239 0.0017 145.5613);
|
|
1192
1387
|
--input: oklch(0.8481 0.0105 145.4823);
|
|
1193
1388
|
--ring: oklch(0.1459 0.0497 142.4953);
|
|
1194
|
-
--
|
|
1389
|
+
--chart-1: oklch(0.6038 0.2363 344.4657);
|
|
1390
|
+
--chart-2: oklch(0.4445 0.2251 300.6246);
|
|
1391
|
+
--chart-3: oklch(0.379 0.0438 226.1538);
|
|
1392
|
+
--chart-4: oklch(0.833 0.1185 88.3461);
|
|
1393
|
+
--chart-5: oklch(0.7843 0.1256 58.9964);
|
|
1394
|
+
/* A panel surface, distinct from the page. The docs site points --sidebar at
|
|
1395
|
+
--background instead, because its nav is part of the page rather than docked beside
|
|
1396
|
+
it \u2014 that is a choice about that layout, not a value this theme is drifting from. */
|
|
1397
|
+
--sidebar: oklch(0.972 0.0068 145.5233);
|
|
1398
|
+
--sidebar-foreground: oklch(0.2284 0.023 134.3921);
|
|
1399
|
+
--sidebar-primary: oklch(0.1324 0.0033 145.3864);
|
|
1400
|
+
--sidebar-primary-foreground: oklch(0.9742 0.0101 131.3574);
|
|
1401
|
+
--sidebar-accent: oklch(0.9248 0.0051 145.5339);
|
|
1402
|
+
--sidebar-accent-foreground: oklch(0.1459 0.0497 142.4953);
|
|
1403
|
+
--sidebar-border: oklch(0.9407 0.0045 134.8505);
|
|
1404
|
+
--sidebar-ring: oklch(0.5916 0.218 0.5844);
|
|
1405
|
+
--radius: 1.05rem;
|
|
1406
|
+
/* Softer and tighter than Tailwind's defaults, which every component's shadow-sm,
|
|
1407
|
+
shadow-md and shadow-lg then picks up. Without these the popovers and dialogs a
|
|
1408
|
+
user installs are shadowed harder than the same components on the docs site. */
|
|
1409
|
+
--shadow-2xs: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.06);
|
|
1410
|
+
--shadow-xs: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.06);
|
|
1411
|
+
--shadow-sm: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1412
|
+
0px 1px 2px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1413
|
+
--shadow: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1414
|
+
0px 1px 2px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1415
|
+
--shadow-md: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1416
|
+
0px 2px 4px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1417
|
+
--shadow-lg: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1418
|
+
0px 4px 6px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1419
|
+
--shadow-xl: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1420
|
+
0px 8px 10px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1421
|
+
--shadow-2xl: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.28);
|
|
1195
1422
|
}`;
|
|
1196
1423
|
const darkVars = `.dark {
|
|
1197
1424
|
--background: oklch(0.1149 0 0);
|
|
@@ -1208,15 +1435,30 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1208
1435
|
--muted-foreground: oklch(0.7897 0.0171 133.8518);
|
|
1209
1436
|
--accent: oklch(0.1391 0.0113 136.9894);
|
|
1210
1437
|
--accent-foreground: oklch(0.9742 0.0101 131.3574);
|
|
1211
|
-
--destructive: oklch(0.
|
|
1438
|
+
--destructive: oklch(0.585 0.15 20.8317);
|
|
1212
1439
|
--destructive-foreground: oklch(1 0 0);
|
|
1213
1440
|
--success: oklch(0.5484 0.1497 145.39);
|
|
1214
1441
|
--success-foreground: oklch(1 0 0);
|
|
1215
1442
|
--warning: oklch(0.5966 0.1499 55.49);
|
|
1216
1443
|
--warning-foreground: oklch(1 0 0);
|
|
1444
|
+
--info: oklch(0.707 0.165 254.624);
|
|
1445
|
+
--info-foreground: oklch(0.1324 0.0033 145.3864);
|
|
1217
1446
|
--border: oklch(0.1811 0.0128 129.2819);
|
|
1218
1447
|
--input: oklch(0.2213 0.0193 135.2915);
|
|
1219
1448
|
--ring: oklch(0.9248 0.0051 145.5339);
|
|
1449
|
+
--chart-1: oklch(0.5316 0.1409 355.1999);
|
|
1450
|
+
--chart-2: oklch(0.5633 0.1912 306.8561);
|
|
1451
|
+
--chart-3: oklch(0.7227 0.1502 60.5799);
|
|
1452
|
+
--chart-4: oklch(0.6193 0.2029 312.7422);
|
|
1453
|
+
--chart-5: oklch(0.6118 0.2093 6.1387);
|
|
1454
|
+
--sidebar: oklch(0.1495 0.0139 121.7627);
|
|
1455
|
+
--sidebar-foreground: oklch(0.8942 0.0315 133.3174);
|
|
1456
|
+
--sidebar-primary: oklch(0.9729 0.0101 145.4971);
|
|
1457
|
+
--sidebar-primary-foreground: oklch(0.1324 0.0033 145.3864);
|
|
1458
|
+
--sidebar-accent: oklch(0.2163 0.0025 145.4898);
|
|
1459
|
+
--sidebar-accent-foreground: oklch(0.9699 0.0013 106.4238);
|
|
1460
|
+
--sidebar-border: oklch(0.2757 0.0116 128.9395);
|
|
1461
|
+
--sidebar-ring: oklch(0.9248 0.0051 145.5339);
|
|
1220
1462
|
}`;
|
|
1221
1463
|
const parts = [];
|
|
1222
1464
|
if (tailwindMajor >= 4) {
|
|
@@ -1246,13 +1488,36 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1246
1488
|
--color-success-foreground: var(--success-foreground);
|
|
1247
1489
|
--color-warning: var(--warning);
|
|
1248
1490
|
--color-warning-foreground: var(--warning-foreground);
|
|
1491
|
+
--color-info: var(--info);
|
|
1492
|
+
--color-info-foreground: var(--info-foreground);
|
|
1249
1493
|
--color-border: var(--border);
|
|
1250
1494
|
--color-input: var(--input);
|
|
1251
1495
|
--color-ring: var(--ring);
|
|
1496
|
+
--color-chart-1: var(--chart-1);
|
|
1497
|
+
--color-chart-2: var(--chart-2);
|
|
1498
|
+
--color-chart-3: var(--chart-3);
|
|
1499
|
+
--color-chart-4: var(--chart-4);
|
|
1500
|
+
--color-chart-5: var(--chart-5);
|
|
1501
|
+
--color-sidebar: var(--sidebar);
|
|
1502
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
1503
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
1504
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
1505
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
1506
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
1507
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
1508
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
1252
1509
|
--radius-sm: calc(var(--radius) - 4px);
|
|
1253
1510
|
--radius-md: calc(var(--radius) - 2px);
|
|
1254
1511
|
--radius-lg: var(--radius);
|
|
1255
|
-
--radius-xl: calc(var(--radius) + 4px)
|
|
1512
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
1513
|
+
--shadow-2xs: var(--shadow-2xs);
|
|
1514
|
+
--shadow-xs: var(--shadow-xs);
|
|
1515
|
+
--shadow-sm: var(--shadow-sm);
|
|
1516
|
+
--shadow: var(--shadow);
|
|
1517
|
+
--shadow-md: var(--shadow-md);
|
|
1518
|
+
--shadow-lg: var(--shadow-lg);
|
|
1519
|
+
--shadow-xl: var(--shadow-xl);
|
|
1520
|
+
--shadow-2xl: var(--shadow-2xl);${preservedLines}
|
|
1256
1521
|
}`);
|
|
1257
1522
|
parts.push(`@layer base {
|
|
1258
1523
|
* {
|
|
@@ -1354,6 +1619,15 @@ function getTW3ColorExtend() {
|
|
|
1354
1619
|
lg: "var(--radius)",
|
|
1355
1620
|
md: "calc(var(--radius) - 2px)",
|
|
1356
1621
|
sm: "calc(var(--radius) - 4px)",
|
|
1622
|
+
},
|
|
1623
|
+
boxShadow: {
|
|
1624
|
+
xs: "var(--shadow-xs)",
|
|
1625
|
+
sm: "var(--shadow-sm)",
|
|
1626
|
+
DEFAULT: "var(--shadow)",
|
|
1627
|
+
md: "var(--shadow-md)",
|
|
1628
|
+
lg: "var(--shadow-lg)",
|
|
1629
|
+
xl: "var(--shadow-xl)",
|
|
1630
|
+
"2xl": "var(--shadow-2xl)",
|
|
1357
1631
|
},`;
|
|
1358
1632
|
}
|
|
1359
1633
|
function createTW3Config(isCjs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dinachi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "CLI for adding Dinachi UI components to your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -23,8 +23,16 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
-
"templates"
|
|
26
|
+
"templates",
|
|
27
|
+
"CHANGELOG.md"
|
|
27
28
|
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
31
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
32
|
+
"type-check": "tsc --noEmit",
|
|
33
|
+
"type-check:templates": "tsc -p templates/tsconfig.json",
|
|
34
|
+
"test": "pnpm run build && node --test test/**/*.test.mjs"
|
|
35
|
+
},
|
|
28
36
|
"dependencies": {
|
|
29
37
|
"chalk": "^5.3.0",
|
|
30
38
|
"commander": "^14.0.2",
|
|
@@ -36,19 +44,20 @@
|
|
|
36
44
|
"ts-morph": "^27.0.2"
|
|
37
45
|
},
|
|
38
46
|
"devDependencies": {
|
|
39
|
-
"@base-ui/react": "1.
|
|
47
|
+
"@base-ui/react": "1.7.0",
|
|
40
48
|
"@json-render/core": "^0.14.0",
|
|
41
49
|
"@json-render/react": "^0.14.0",
|
|
42
50
|
"@types/fs-extra": "^11.0.4",
|
|
43
51
|
"@types/prompts": "^2.4.9",
|
|
44
|
-
"@types/react": "^19.2.
|
|
52
|
+
"@types/react": "^19.2.18",
|
|
45
53
|
"class-variance-authority": "^0.7.1",
|
|
46
54
|
"clsx": "^2.1.1",
|
|
47
55
|
"lucide-react": "0.552.0",
|
|
48
|
-
"
|
|
56
|
+
"motion": "^12.23.6",
|
|
57
|
+
"react": "19.2.8",
|
|
49
58
|
"tailwind-merge": "^3.5.0",
|
|
50
|
-
"tsup": "^8.
|
|
51
|
-
"typescript": "^
|
|
59
|
+
"tsup": "^8.5.1",
|
|
60
|
+
"typescript": "^6.0.3",
|
|
52
61
|
"zod": "^4.0.0"
|
|
53
62
|
},
|
|
54
63
|
"peerDependencies": {
|
|
@@ -56,11 +65,5 @@
|
|
|
56
65
|
},
|
|
57
66
|
"publishConfig": {
|
|
58
67
|
"access": "public"
|
|
59
|
-
},
|
|
60
|
-
"scripts": {
|
|
61
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
62
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
63
|
-
"type-check": "tsc --noEmit",
|
|
64
|
-
"test": "pnpm run build && node --test test/**/*.test.mjs"
|
|
65
68
|
}
|
|
66
|
-
}
|
|
69
|
+
}
|