@dinachi/cli 0.9.0 → 0.11.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 +101 -0
- package/README.md +34 -5
- package/dist/index.js +294 -63
- package/package.json +8 -6
- package/templates/accordion/accordion.tsx +4 -5
- package/templates/alert-dialog/alert-dialog.tsx +9 -2
- 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/autocomplete/autocomplete.tsx +6 -4
- package/templates/button/button.tsx +19 -2
- package/templates/carousel/carousel.tsx +492 -0
- package/templates/carousel/index.ts +1 -0
- package/templates/collapsible/collapsible.tsx +3 -7
- package/templates/combobox/combobox.tsx +6 -4
- package/templates/compare-slider/compare-slider.tsx +383 -0
- package/templates/compare-slider/index.ts +2 -0
- package/templates/context-menu/context-menu.tsx +10 -6
- package/templates/dialog/dialog.tsx +9 -2
- package/templates/drawer/drawer.tsx +24 -2
- 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 +580 -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/menu/menu.tsx +10 -6
- package/templates/menubar/menubar.tsx +10 -6
- package/templates/meter/meter.tsx +1 -1
- package/templates/navigation-menu/navigation-menu.tsx +9 -6
- package/templates/number-ticker/index.ts +2 -0
- package/templates/number-ticker/number-ticker.tsx +470 -0
- package/templates/otp-field/otp-field.tsx +3 -2
- package/templates/popover/popover.tsx +7 -6
- package/templates/preview-card/preview-card.tsx +2 -1
- package/templates/progress/progress.tsx +1 -1
- 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 +18 -4
- package/templates/slider/slider.tsx +3 -2
- 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/switch/switch.tsx +4 -2
- package/templates/tabs/tabs.tsx +10 -2
- 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/toggle/toggle.tsx +1 -1
- package/templates/tooltip/tooltip.tsx +10 -4
- package/templates/tsconfig.json +1 -0
- 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
|
}
|
|
@@ -79,14 +75,14 @@ function getComponentRegistry() {
|
|
|
79
75
|
name: "accordion",
|
|
80
76
|
description: "A vertically stacked set of interactive headings that each reveal a section of content.",
|
|
81
77
|
files: [{ name: "accordion.tsx" }, { name: "index.ts" }],
|
|
82
|
-
dependencies: ["@base-ui/react", "lucide-react"
|
|
78
|
+
dependencies: ["@base-ui/react", "lucide-react"],
|
|
83
79
|
utilityDependencies: ["cn"]
|
|
84
80
|
},
|
|
85
81
|
"alert-dialog": {
|
|
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",
|
|
@@ -143,7 +139,7 @@ function getComponentRegistry() {
|
|
|
143
139
|
name: "collapsible",
|
|
144
140
|
description: "A collapsible panel controlled by a button.",
|
|
145
141
|
files: [{ name: "collapsible.tsx" }, { name: "index.ts" }],
|
|
146
|
-
dependencies: ["@base-ui/react"
|
|
142
|
+
dependencies: ["@base-ui/react"],
|
|
147
143
|
utilityDependencies: ["cn"]
|
|
148
144
|
},
|
|
149
145
|
combobox: {
|
|
@@ -384,6 +380,161 @@ function getComponentRegistry() {
|
|
|
384
380
|
dependencies: ["@base-ui/react"],
|
|
385
381
|
utilityDependencies: ["cn"]
|
|
386
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
|
+
},
|
|
387
538
|
"json-render": {
|
|
388
539
|
name: "json-render",
|
|
389
540
|
description: "Adapter for @json-render \u2014 renders DinachiUI components from JSON specs with state binding, validation, and actions.",
|
|
@@ -407,7 +558,6 @@ function getComponentRegistry() {
|
|
|
407
558
|
"drawer",
|
|
408
559
|
"fieldset",
|
|
409
560
|
"input",
|
|
410
|
-
"label",
|
|
411
561
|
"number-field",
|
|
412
562
|
"popover",
|
|
413
563
|
"progress",
|
|
@@ -415,7 +565,6 @@ function getComponentRegistry() {
|
|
|
415
565
|
"scroll-area",
|
|
416
566
|
"select",
|
|
417
567
|
"separator",
|
|
418
|
-
"skeleton",
|
|
419
568
|
"slider",
|
|
420
569
|
"switch",
|
|
421
570
|
"tabs",
|
|
@@ -426,7 +575,6 @@ function getComponentRegistry() {
|
|
|
426
575
|
"toggle-group",
|
|
427
576
|
"tooltip"
|
|
428
577
|
],
|
|
429
|
-
utilityDependencies: ["cn"],
|
|
430
578
|
targetDir: "json-render",
|
|
431
579
|
integration: true
|
|
432
580
|
}
|
|
@@ -549,13 +697,14 @@ function parseJsonWithComments(content) {
|
|
|
549
697
|
|
|
550
698
|
// src/utils/dependencies.ts
|
|
551
699
|
var DEPENDENCY_VERSION_MAP = {
|
|
552
|
-
"@base-ui/react": "^1.
|
|
700
|
+
"@base-ui/react": "^1.7.0",
|
|
553
701
|
"lucide-react": "^0.552.0",
|
|
702
|
+
"motion": "^12.23.6",
|
|
554
703
|
"class-variance-authority": "^0.7.1",
|
|
555
704
|
"tailwindcss-animate": "^1.0.7",
|
|
556
705
|
"tw-animate-css": "^1.3.4",
|
|
557
706
|
"clsx": "^2.1.1",
|
|
558
|
-
"tailwind-merge": "^3.
|
|
707
|
+
"tailwind-merge": "^3.5.0",
|
|
559
708
|
"@json-render/core": "^0.14.0",
|
|
560
709
|
"@json-render/react": "^0.14.0",
|
|
561
710
|
"zod": "^4.0.0"
|
|
@@ -665,10 +814,9 @@ function tryResolveAsAlias(absoluteFilePath, compilerConfig) {
|
|
|
665
814
|
}
|
|
666
815
|
return null;
|
|
667
816
|
}
|
|
668
|
-
function rewriteTemplateImports(content, targetFilePath, utilsFilePath,
|
|
817
|
+
function rewriteTemplateImports(content, targetFilePath, utilsFilePath, compilerConfig) {
|
|
669
818
|
const utilsImportPath = tryResolveAsAlias(utilsFilePath, compilerConfig) ?? toImportPath(targetFilePath, utilsFilePath);
|
|
670
|
-
|
|
671
|
-
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`);
|
|
672
820
|
}
|
|
673
821
|
function getComponentDependencies(componentName, visited = /* @__PURE__ */ new Set()) {
|
|
674
822
|
if (visited.has(componentName)) {
|
|
@@ -887,7 +1035,38 @@ ${blocksToAppend.join("\n")}
|
|
|
887
1035
|
allFilesAdded.push({ name: "index.ts", path: indexPath });
|
|
888
1036
|
}
|
|
889
1037
|
}
|
|
890
|
-
|
|
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(
|
|
891
1070
|
async (componentNames, options) => {
|
|
892
1071
|
const spinner = ora("Adding component...").start();
|
|
893
1072
|
try {
|
|
@@ -899,49 +1078,40 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
899
1078
|
const projectRoot = process.cwd();
|
|
900
1079
|
const compilerPathConfig = readCompilerPathConfig(projectRoot);
|
|
901
1080
|
const registry = getComponentRegistry();
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
if (
|
|
917
|
-
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.`);
|
|
918
1097
|
console.log("Available components:");
|
|
919
|
-
Object.keys(registry).forEach((
|
|
920
|
-
console.log(` ${chalk.cyan(
|
|
1098
|
+
Object.keys(registry).forEach((n) => {
|
|
1099
|
+
console.log(` ${chalk.cyan(n)}`);
|
|
921
1100
|
});
|
|
922
1101
|
process.exit(1);
|
|
923
1102
|
}
|
|
924
|
-
for (const name of componentNames) {
|
|
925
|
-
if (!registry[name]) {
|
|
926
|
-
spinner.fail(`\u274C Component "${name}" not found.`);
|
|
927
|
-
console.log("Available components:");
|
|
928
|
-
Object.keys(registry).forEach((n) => {
|
|
929
|
-
console.log(` ${chalk.cyan(n)}`);
|
|
930
|
-
});
|
|
931
|
-
process.exit(1);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
const allWithDeps = /* @__PURE__ */ new Set();
|
|
935
|
-
for (const name of componentNames) {
|
|
936
|
-
allWithDeps.add(name);
|
|
937
|
-
const deps = getComponentDependencies(name);
|
|
938
|
-
deps.forEach((dep) => allWithDeps.add(dep));
|
|
939
|
-
}
|
|
940
|
-
componentsToInstall = Array.from(allWithDeps);
|
|
941
1103
|
}
|
|
942
|
-
|
|
943
|
-
|
|
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);
|
|
944
1109
|
}
|
|
1110
|
+
const componentsToInstall = withComponentDependencies([
|
|
1111
|
+
...bulk,
|
|
1112
|
+
...componentNames
|
|
1113
|
+
]);
|
|
1114
|
+
spinner.text = bulk.length > 0 ? `Installing ${componentsToInstall.length} components...` : `Installing ${componentsToInstall.join(", ")}...`;
|
|
945
1115
|
const componentDir = resolveConfiguredPath(config.aliases.ui, projectRoot, compilerPathConfig);
|
|
946
1116
|
const libDir = resolveConfiguredPath(config.aliases.lib, projectRoot, compilerPathConfig);
|
|
947
1117
|
const utilsFilePath = resolveConfiguredPath(config.aliases.utils, projectRoot, compilerPathConfig);
|
|
@@ -986,8 +1156,10 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
986
1156
|
if (comp.targetDir) {
|
|
987
1157
|
await fs3.ensureDir(fileTargetDir);
|
|
988
1158
|
}
|
|
1159
|
+
const build = builds.get(name);
|
|
1160
|
+
const templateDir = build?.variant.templateDir ?? name;
|
|
989
1161
|
for (const file of comp.files) {
|
|
990
|
-
const sourcePath = path3.join(__dirname2, "../templates",
|
|
1162
|
+
const sourcePath = path3.join(__dirname2, "../templates", templateDir, file.name);
|
|
991
1163
|
const targetPath = path3.join(fileTargetDir, file.name);
|
|
992
1164
|
if (file.name === "index.ts") {
|
|
993
1165
|
if (comp.targetDir) {
|
|
@@ -1015,13 +1187,16 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
1015
1187
|
spinner.start();
|
|
1016
1188
|
}
|
|
1017
1189
|
const templateContent = stripTemplateDirective(await fs3.readFile(sourcePath, "utf-8"));
|
|
1018
|
-
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath,
|
|
1190
|
+
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath, compilerPathConfig);
|
|
1019
1191
|
await fs3.writeFile(targetPath, rewrittenContent);
|
|
1020
1192
|
allFilesAdded.push({ name: file.name, path: targetPath });
|
|
1021
1193
|
}
|
|
1022
1194
|
if (comp.dependencies?.length) {
|
|
1023
1195
|
allDepsInstalled.push(...comp.dependencies);
|
|
1024
1196
|
}
|
|
1197
|
+
if (build?.variant.dependencies?.length) {
|
|
1198
|
+
allDepsInstalled.push(...build.variant.dependencies);
|
|
1199
|
+
}
|
|
1025
1200
|
if (name === "toast") {
|
|
1026
1201
|
const toastLibPath = path3.join(libDir, "toast.ts");
|
|
1027
1202
|
if (!fs3.existsSync(toastLibPath)) {
|
|
@@ -1074,8 +1249,8 @@ export const toastManager = createToastManager();
|
|
|
1074
1249
|
} else if (!options.skipInstall && uniqueDeps.length > 0) {
|
|
1075
1250
|
spinner.text = "All dependencies already installed.";
|
|
1076
1251
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
spinner.succeed(`\u2705 Added
|
|
1252
|
+
if (bulk.length > 0) {
|
|
1253
|
+
spinner.succeed(`\u2705 Added ${componentsToInstall.length} components!`);
|
|
1079
1254
|
} else {
|
|
1080
1255
|
spinner.succeed(`\u2705 Added ${componentsToInstall.join(", ")}!`);
|
|
1081
1256
|
}
|
|
@@ -1116,6 +1291,17 @@ export const toastManager = createToastManager();
|
|
|
1116
1291
|
console.log(` ${chalk.blue("~")} ${dep}`);
|
|
1117
1292
|
});
|
|
1118
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
|
+
}
|
|
1119
1305
|
} catch (error) {
|
|
1120
1306
|
spinner.fail(`\u274C Failed to add component: ${error instanceof Error ? error.message : error}`);
|
|
1121
1307
|
process.exit(1);
|
|
@@ -1164,7 +1350,7 @@ function detectTailwindMajorVersion2(projectRoot) {
|
|
|
1164
1350
|
return 4;
|
|
1165
1351
|
}
|
|
1166
1352
|
}
|
|
1167
|
-
var DINACHI_THEME_PREFIXES = ["--color-", "--radius-"];
|
|
1353
|
+
var DINACHI_THEME_PREFIXES = ["--color-", "--radius-", "--shadow-", "--shadow:"];
|
|
1168
1354
|
function extractPreservedThemeVars(css) {
|
|
1169
1355
|
const themeMatch = css.match(/@theme\s+inline\s*\{([^}]*)\}/);
|
|
1170
1356
|
if (!themeMatch) return [];
|
|
@@ -1205,6 +1391,9 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1205
1391
|
--chart-3: oklch(0.379 0.0438 226.1538);
|
|
1206
1392
|
--chart-4: oklch(0.833 0.1185 88.3461);
|
|
1207
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. */
|
|
1208
1397
|
--sidebar: oklch(0.972 0.0068 145.5233);
|
|
1209
1398
|
--sidebar-foreground: oklch(0.2284 0.023 134.3921);
|
|
1210
1399
|
--sidebar-primary: oklch(0.1324 0.0033 145.3864);
|
|
@@ -1213,7 +1402,32 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1213
1402
|
--sidebar-accent-foreground: oklch(0.1459 0.0497 142.4953);
|
|
1214
1403
|
--sidebar-border: oklch(0.9407 0.0045 134.8505);
|
|
1215
1404
|
--sidebar-ring: oklch(0.5916 0.218 0.5844);
|
|
1216
|
-
--radius:
|
|
1405
|
+
--radius: 1.05rem;
|
|
1406
|
+
/* Every component inlines these same values as a var() fallback, so motion works
|
|
1407
|
+
without them. Declaring them here is what lets a project retune the feel of every
|
|
1408
|
+
installed component from one place. The --motion- prefix avoids Tailwind v4's own
|
|
1409
|
+
--ease-out and --duration-* theme variables. */
|
|
1410
|
+
--motion-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
1411
|
+
--motion-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
|
|
1412
|
+
--motion-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
|
|
1413
|
+
--motion-duration-fast: 150ms;
|
|
1414
|
+
--motion-duration-base: 200ms;
|
|
1415
|
+
/* Softer and tighter than Tailwind's defaults, which every component's shadow-sm,
|
|
1416
|
+
shadow-md and shadow-lg then picks up. Without these the popovers and dialogs a
|
|
1417
|
+
user installs are shadowed harder than the same components on the docs site. */
|
|
1418
|
+
--shadow-2xs: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.06);
|
|
1419
|
+
--shadow-xs: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.06);
|
|
1420
|
+
--shadow-sm: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1421
|
+
0px 1px 2px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1422
|
+
--shadow: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1423
|
+
0px 1px 2px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1424
|
+
--shadow-md: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1425
|
+
0px 2px 4px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1426
|
+
--shadow-lg: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1427
|
+
0px 4px 6px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1428
|
+
--shadow-xl: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.11),
|
|
1429
|
+
0px 8px 10px -5.5px hsl(0 0% 10.1961% / 0.11);
|
|
1430
|
+
--shadow-2xl: 0px 3.5px 9px -4.5px hsl(0 0% 10.1961% / 0.28);
|
|
1217
1431
|
}`;
|
|
1218
1432
|
const darkVars = `.dark {
|
|
1219
1433
|
--background: oklch(0.1149 0 0);
|
|
@@ -1230,7 +1444,7 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1230
1444
|
--muted-foreground: oklch(0.7897 0.0171 133.8518);
|
|
1231
1445
|
--accent: oklch(0.1391 0.0113 136.9894);
|
|
1232
1446
|
--accent-foreground: oklch(0.9742 0.0101 131.3574);
|
|
1233
|
-
--destructive: oklch(0.
|
|
1447
|
+
--destructive: oklch(0.585 0.15 20.8317);
|
|
1234
1448
|
--destructive-foreground: oklch(1 0 0);
|
|
1235
1449
|
--success: oklch(0.5484 0.1497 145.39);
|
|
1236
1450
|
--success-foreground: oklch(1 0 0);
|
|
@@ -1304,7 +1518,15 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1304
1518
|
--radius-sm: calc(var(--radius) - 4px);
|
|
1305
1519
|
--radius-md: calc(var(--radius) - 2px);
|
|
1306
1520
|
--radius-lg: var(--radius);
|
|
1307
|
-
--radius-xl: calc(var(--radius) + 4px)
|
|
1521
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
1522
|
+
--shadow-2xs: var(--shadow-2xs);
|
|
1523
|
+
--shadow-xs: var(--shadow-xs);
|
|
1524
|
+
--shadow-sm: var(--shadow-sm);
|
|
1525
|
+
--shadow: var(--shadow);
|
|
1526
|
+
--shadow-md: var(--shadow-md);
|
|
1527
|
+
--shadow-lg: var(--shadow-lg);
|
|
1528
|
+
--shadow-xl: var(--shadow-xl);
|
|
1529
|
+
--shadow-2xl: var(--shadow-2xl);${preservedLines}
|
|
1308
1530
|
}`);
|
|
1309
1531
|
parts.push(`@layer base {
|
|
1310
1532
|
* {
|
|
@@ -1406,6 +1628,15 @@ function getTW3ColorExtend() {
|
|
|
1406
1628
|
lg: "var(--radius)",
|
|
1407
1629
|
md: "calc(var(--radius) - 2px)",
|
|
1408
1630
|
sm: "calc(var(--radius) - 4px)",
|
|
1631
|
+
},
|
|
1632
|
+
boxShadow: {
|
|
1633
|
+
xs: "var(--shadow-xs)",
|
|
1634
|
+
sm: "var(--shadow-sm)",
|
|
1635
|
+
DEFAULT: "var(--shadow)",
|
|
1636
|
+
md: "var(--shadow-md)",
|
|
1637
|
+
lg: "var(--shadow-lg)",
|
|
1638
|
+
xl: "var(--shadow-xl)",
|
|
1639
|
+
"2xl": "var(--shadow-2xl)",
|
|
1409
1640
|
},`;
|
|
1410
1641
|
}
|
|
1411
1642
|
function createTW3Config(isCjs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dinachi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "CLI for adding Dinachi UI components to your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
31
31
|
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
32
32
|
"type-check": "tsc --noEmit",
|
|
33
|
+
"type-check:templates": "tsc -p templates/tsconfig.json",
|
|
33
34
|
"test": "pnpm run build && node --test test/**/*.test.mjs"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
@@ -43,19 +44,20 @@
|
|
|
43
44
|
"ts-morph": "^27.0.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@base-ui/react": "1.
|
|
47
|
+
"@base-ui/react": "1.7.0",
|
|
47
48
|
"@json-render/core": "^0.14.0",
|
|
48
49
|
"@json-render/react": "^0.14.0",
|
|
49
50
|
"@types/fs-extra": "^11.0.4",
|
|
50
51
|
"@types/prompts": "^2.4.9",
|
|
51
|
-
"@types/react": "^19.2.
|
|
52
|
+
"@types/react": "^19.2.18",
|
|
52
53
|
"class-variance-authority": "^0.7.1",
|
|
53
54
|
"clsx": "^2.1.1",
|
|
54
55
|
"lucide-react": "0.552.0",
|
|
55
|
-
"
|
|
56
|
+
"motion": "^12.23.6",
|
|
57
|
+
"react": "19.2.8",
|
|
56
58
|
"tailwind-merge": "^3.5.0",
|
|
57
|
-
"tsup": "^8.
|
|
58
|
-
"typescript": "^
|
|
59
|
+
"tsup": "^8.5.1",
|
|
60
|
+
"typescript": "^6.0.3",
|
|
59
61
|
"zod": "^4.0.0"
|
|
60
62
|
},
|
|
61
63
|
"peerDependencies": {
|
|
@@ -44,7 +44,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
44
44
|
<BaseAccordion.Trigger
|
|
45
45
|
ref={ref}
|
|
46
46
|
className={cn(
|
|
47
|
-
"flex flex-1 items-center justify-between py-4 font-medium transition-
|
|
47
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-colors hover:underline",
|
|
48
48
|
"[&[data-panel-open]>svg]:rotate-180",
|
|
49
49
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
50
50
|
className
|
|
@@ -52,7 +52,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
52
52
|
{...props}
|
|
53
53
|
>
|
|
54
54
|
{children}
|
|
55
|
-
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-
|
|
55
|
+
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none" />
|
|
56
56
|
</BaseAccordion.Trigger>
|
|
57
57
|
));
|
|
58
58
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
@@ -65,10 +65,9 @@ const AccordionPanel = React.forwardRef<
|
|
|
65
65
|
ref={ref}
|
|
66
66
|
className={cn(
|
|
67
67
|
"overflow-hidden text-sm h-[var(--accordion-panel-height)]",
|
|
68
|
-
"transition-[height] duration-
|
|
68
|
+
"transition-[height] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
69
69
|
"data-[starting-style]:h-0 data-[ending-style]:h-0",
|
|
70
|
-
"
|
|
71
|
-
"data-[closed]:animate-out data-[closed]:slide-up-to-top",
|
|
70
|
+
"motion-reduce:transition-none",
|
|
72
71
|
className
|
|
73
72
|
)}
|
|
74
73
|
{...props}
|
|
@@ -17,7 +17,8 @@ const AlertDialogBackdrop = React.forwardRef<
|
|
|
17
17
|
className={cn(
|
|
18
18
|
"fixed inset-0 z-50 bg-black/80",
|
|
19
19
|
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
20
|
-
"transition-
|
|
20
|
+
"transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
21
|
+
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
21
22
|
className
|
|
22
23
|
)}
|
|
23
24
|
{...props}
|
|
@@ -48,9 +49,15 @@ const AlertDialogPopup = React.forwardRef<
|
|
|
48
49
|
ref={ref}
|
|
49
50
|
className={cn(
|
|
50
51
|
"w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
|
|
52
|
+
// An alert dialog is not anchored to its trigger, so scaling from the centre is
|
|
53
|
+
// correct here in a way it is not for a popover.
|
|
51
54
|
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
52
55
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
53
|
-
"
|
|
56
|
+
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
57
|
+
"transition-[transform,scale,opacity] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
|
|
58
|
+
// Slower in than out. The user is deciding on the way in and has already decided
|
|
59
|
+
// on the way out.
|
|
60
|
+
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
54
61
|
className
|
|
55
62
|
)}
|
|
56
63
|
{...props}
|