@gilav21/shadcn-angular 0.0.14 → 0.0.16

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.
@@ -6,6 +6,11 @@ export interface ComponentDefinition {
6
6
  files: string[]; // Relative paths to component files
7
7
  dependencies?: string[]; // Other components this depends on
8
8
  npmDependencies?: string[]; // NPM packages this depends on
9
+ shortcutDefinitions?: {
10
+ exportName: string;
11
+ componentName: string;
12
+ sourceFile: string;
13
+ }[];
9
14
  }
10
15
 
11
16
  export type ComponentName = keyof typeof registry;
@@ -49,6 +54,7 @@ export const registry: Record<string, ComponentDefinition> = {
49
54
  button: {
50
55
  name: 'button',
51
56
  files: ['button.component.ts'],
57
+ dependencies: ['ripple'],
52
58
  },
53
59
  'button-group': {
54
60
  name: 'button-group',
@@ -89,6 +95,13 @@ export const registry: Record<string, ComponentDefinition> = {
89
95
  name: 'command',
90
96
  files: ['command.component.ts'],
91
97
  dependencies: ['dialog'],
98
+ shortcutDefinitions: [
99
+ {
100
+ exportName: 'COMMAND_DIALOG_SHORTCUT_DEFINITIONS',
101
+ componentName: 'command-dialog',
102
+ sourceFile: 'command.component.ts',
103
+ },
104
+ ],
92
105
  },
93
106
  'context-menu': {
94
107
  name: 'context-menu',
@@ -140,6 +153,7 @@ export const registry: Record<string, ComponentDefinition> = {
140
153
  'pagination',
141
154
  'popover',
142
155
  'component-outlet',
156
+ 'icon',
143
157
  ],
144
158
  },
145
159
  dialog: {
@@ -154,11 +168,12 @@ export const registry: Record<string, ComponentDefinition> = {
154
168
  'dock-icon.component.ts',
155
169
  'dock-label.component.ts',
156
170
  ],
171
+ dependencies: ['icon'],
157
172
  },
158
173
  'tree-select': {
159
174
  name: 'tree-select',
160
175
  files: ['tree-select.component.ts'],
161
- dependencies: ['popover', 'tree'],
176
+ dependencies: ['popover', 'tree', 'icon'],
162
177
  },
163
178
  'virtual-scroll': {
164
179
  name: 'virtual-scroll',
@@ -185,6 +200,10 @@ export const registry: Record<string, ComponentDefinition> = {
185
200
  name: 'field',
186
201
  files: ['field.component.ts'],
187
202
  },
203
+ icon: {
204
+ name: 'icon',
205
+ files: ['icon.component.ts'],
206
+ },
188
207
 
189
208
  'file-upload': {
190
209
  name: 'file-upload',
@@ -275,7 +294,7 @@ export const registry: Record<string, ComponentDefinition> = {
275
294
  sidebar: {
276
295
  name: 'sidebar',
277
296
  files: ['sidebar.component.ts'],
278
- dependencies: ['scroll-area', 'tooltip'],
297
+ dependencies: ['scroll-area', 'tooltip', 'icon'],
279
298
  },
280
299
  skeleton: {
281
300
  name: 'skeleton',
@@ -332,6 +351,7 @@ export const registry: Record<string, ComponentDefinition> = {
332
351
  tree: {
333
352
  name: 'tree',
334
353
  files: ['tree.component.ts'],
354
+ dependencies: ['icon'],
335
355
  },
336
356
  'speed-dial': {
337
357
  name: 'speed-dial',
@@ -346,7 +366,7 @@ export const registry: Record<string, ComponentDefinition> = {
346
366
  'emoji-picker': {
347
367
  name: 'emoji-picker',
348
368
  files: ['emoji-picker.component.ts', 'emoji-data.ts'],
349
- dependencies: ['button', 'input', 'scroll-area', 'popover'],
369
+ dependencies: ['input', 'scroll-area', 'tooltip'],
350
370
  },
351
371
  'rich-text-editor': {
352
372
  name: 'rich-text-editor',
@@ -355,18 +375,30 @@ export const registry: Record<string, ComponentDefinition> = {
355
375
  'rich-text-toolbar.component.ts',
356
376
  'rich-text-sanitizer.service.ts',
357
377
  'rich-text-markdown.service.ts',
378
+ 'rich-text-paste-normalizer.service.ts',
379
+ 'rich-text-command-registry.service.ts',
358
380
  'rich-text-mention.component.ts',
359
381
  'rich-text-image-resizer.component.ts',
382
+ 'rich-text-locales.ts',
360
383
  ],
361
384
  dependencies: [
362
385
  'button',
363
386
  'separator',
364
387
  'popover',
365
388
  'emoji-picker',
389
+ 'autocomplete',
366
390
  'select',
367
391
  'input',
392
+ 'dialog',
368
393
  'scroll-area',
369
394
  ],
395
+ shortcutDefinitions: [
396
+ {
397
+ exportName: 'RICH_TEXT_SHORTCUT_DEFINITIONS',
398
+ componentName: 'rich-text-editor',
399
+ sourceFile: 'rich-text-editor.component.ts',
400
+ },
401
+ ],
370
402
  },
371
403
  // Chart Components
372
404
  'pie-chart': {
@@ -435,7 +467,7 @@ export const registry: Record<string, ComponentDefinition> = {
435
467
  },
436
468
  'bento-grid': {
437
469
  name: 'bento-grid',
438
- dependencies: ['context-menu', 'component-outlet'],
470
+ dependencies: ['context-menu', 'component-outlet', 'icon'],
439
471
  files: [
440
472
  'bento-grid.component.ts',
441
473
  ],
@@ -449,12 +481,14 @@ export const registry: Record<string, ComponentDefinition> = {
449
481
  'label',
450
482
  'select',
451
483
  'switch',
452
- 'slider'
484
+ 'slider',
485
+ 'icon'
453
486
  ],
454
487
  files: [
455
488
  'page-builder/page-builder.component.ts',
456
489
  'page-builder/page-builder.types.ts',
457
- 'page-builder/property-editor.component.ts'
490
+ 'page-builder/property-editor.component.ts',
491
+ 'page-builder/page-renderer.component.ts'
458
492
  ],
459
493
  },
460
494
  'component-outlet': {
@@ -466,4 +500,75 @@ export const registry: Record<string, ComponentDefinition> = {
466
500
  files: ['split-button.component.ts'],
467
501
  dependencies: ['button', 'dropdown-menu'],
468
502
  },
503
+ // Animations
504
+ 'gradient-text': {
505
+ name: 'gradient-text',
506
+ files: ['gradient-text.component.ts'],
507
+ },
508
+ 'flip-text': {
509
+ name: 'flip-text',
510
+ files: ['flip-text.component.ts'],
511
+ },
512
+ meteors: {
513
+ name: 'meteors',
514
+ files: ['meteors.component.ts'],
515
+ },
516
+ 'shine-border': {
517
+ name: 'shine-border',
518
+ files: ['shine-border.component.ts'],
519
+ },
520
+ 'scroll-progress': {
521
+ name: 'scroll-progress',
522
+ files: ['scroll-progress.component.ts'],
523
+ },
524
+ 'blur-fade': {
525
+ name: 'blur-fade',
526
+ files: ['blur-fade.component.ts'],
527
+ },
528
+ ripple: {
529
+ name: 'ripple',
530
+ files: ['ripple.directive.ts'],
531
+ },
532
+ marquee: {
533
+ name: 'marquee',
534
+ files: ['marquee.component.ts'],
535
+ },
536
+ 'word-rotate': {
537
+ name: 'word-rotate',
538
+ files: ['word-rotate.component.ts'],
539
+ },
540
+ 'morphing-text': {
541
+ name: 'morphing-text',
542
+ files: ['morphing-text.component.ts'],
543
+ },
544
+ 'typing-animation': {
545
+ name: 'typing-animation',
546
+ files: ['typing-animation.component.ts'],
547
+ },
548
+ 'wobble-card': {
549
+ name: 'wobble-card',
550
+ files: ['wobble-card.component.ts'],
551
+ },
552
+ magnetic: {
553
+ name: 'magnetic',
554
+ files: ['magnetic.directive.ts'],
555
+ },
556
+ orbit: {
557
+ name: 'orbit',
558
+ files: ['orbit.component.ts'],
559
+ },
560
+ 'stagger-children': {
561
+ name: 'stagger-children',
562
+ files: ['stagger-children.component.ts'],
563
+ },
564
+ particles: {
565
+ name: 'particles',
566
+ files: ['particles.component.ts'],
567
+ },
568
+ // Kanban
569
+ kanban: {
570
+ name: 'kanban',
571
+ files: ['kanban.component.ts'],
572
+ dependencies: ['badge', 'avatar', 'scroll-area', 'separator'],
573
+ },
469
574
  };
@@ -15,7 +15,6 @@ export interface Config {
15
15
  utils: string;
16
16
  ui: string;
17
17
  };
18
- iconLibrary: string;
19
18
  }
20
19
 
21
20
  export function getDefaultConfig(): Config {
@@ -33,7 +32,6 @@ export function getDefaultConfig(): Config {
33
32
  utils: '@/components/lib/utils',
34
33
  ui: '@/components/ui',
35
34
  },
36
- iconLibrary: 'lucide-angular',
37
35
  };
38
36
  }
39
37
 
@@ -0,0 +1,79 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import type { Config } from './config.js';
4
+
5
+ export interface ShortcutRegistryEntry {
6
+ exportName: string;
7
+ componentName: string;
8
+ sourceFile: string;
9
+ }
10
+
11
+ function aliasToProjectPath(aliasOrPath: string): string {
12
+ return aliasOrPath.startsWith('@/')
13
+ ? path.join('src', aliasOrPath.slice(2))
14
+ : aliasOrPath;
15
+ }
16
+
17
+ function resolveProjectPath(cwd: string, inputPath: string): string {
18
+ const resolved = path.resolve(cwd, inputPath);
19
+ const relative = path.relative(cwd, resolved);
20
+ if (relative.startsWith('..') || path.isAbsolute(relative)) {
21
+ throw new Error(`Path must stay inside the project directory: ${inputPath}`);
22
+ }
23
+ return resolved;
24
+ }
25
+
26
+ function getShortcutRegistryIndexPath(cwd: string, config: Config): string {
27
+ const utilsFilePath = resolveProjectPath(cwd, aliasToProjectPath(config.aliases.utils) + '.ts');
28
+ const utilsDir = path.dirname(utilsFilePath);
29
+ return path.join(utilsDir, 'shortcut-registry.index.ts');
30
+ }
31
+
32
+ export async function writeShortcutRegistryIndex(
33
+ cwd: string,
34
+ config: Config,
35
+ entries: ShortcutRegistryEntry[],
36
+ ): Promise<string> {
37
+ const registryPath = getShortcutRegistryIndexPath(cwd, config);
38
+ await fs.ensureDir(path.dirname(registryPath));
39
+
40
+ const uniqueEntries = Array.from(new Map(entries.map(entry => [entry.exportName, entry])).values())
41
+ .sort((a, b) => a.exportName.localeCompare(b.exportName));
42
+
43
+ const uiAlias = config.aliases.ui;
44
+ const utilsAliasDir = config.aliases.utils.includes('/')
45
+ ? config.aliases.utils.slice(0, config.aliases.utils.lastIndexOf('/'))
46
+ : config.aliases.utils;
47
+ const shortcutServiceImport = `${utilsAliasDir}/shortcut-binding.service`;
48
+
49
+ const imports = uniqueEntries
50
+ .map(entry => {
51
+ const importPath = `${uiAlias}/${entry.sourceFile.replace(/\.ts$/, '')}`;
52
+ return `import { ${entry.exportName} } from '${importPath}';`;
53
+ })
54
+ .join('\n');
55
+
56
+ const catalogItems = uniqueEntries
57
+ .map(entry => ` { componentName: '${entry.componentName}', definitions: ${entry.exportName} },`)
58
+ .join('\n');
59
+
60
+ const content = `// Auto-generated by shadcn-angular CLI. Do not edit manually.
61
+ import type { ShortcutBindingService, ShortcutDefinition } from '${shortcutServiceImport}';
62
+ ${imports ? `${imports}\n` : ''}
63
+ export const GENERATED_SHORTCUT_CATALOG: ReadonlyArray<{
64
+ componentName: string;
65
+ definitions: ReadonlyArray<ShortcutDefinition>;
66
+ }> = [
67
+ ${catalogItems}
68
+ ];
69
+
70
+ export function registerGeneratedShortcutCatalog(shortcuts: ShortcutBindingService): void {
71
+ for (const entry of GENERATED_SHORTCUT_CATALOG) {
72
+ shortcuts.defineShortcuts(entry.componentName, [...entry.definitions]);
73
+ }
74
+ }
75
+ `;
76
+
77
+ await fs.writeFile(registryPath, content);
78
+ return registryPath;
79
+ }