@sonny-ui/core 0.1.0-alpha.11 → 0.1.0-alpha.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonny-ui/core",
3
- "version": "0.1.0-alpha.11",
3
+ "version": "0.1.0-alpha.12",
4
4
  "description": "Angular UI component library inspired by shadcn/ui — signals, zoneless, Tailwind CSS v4",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
@@ -21,6 +21,33 @@ function ngAdd(options) {
21
21
  context.logger.info('Added SonnyUI theme import to styles.css');
22
22
  }
23
23
  }
24
+ // Add provideSonnyUI to app.config.ts
25
+ const configPath = 'src/app/app.config.ts';
26
+ if (tree.exists(configPath)) {
27
+ let configContent = tree.read(configPath).toString('utf-8');
28
+ const theme = options.theme || 'light';
29
+ if (!configContent.includes('provideSonnyUI')) {
30
+ // Add import statement
31
+ const importLine = `import { provideSonnyUI } from '@sonny-ui/core';\n`;
32
+ const lastImportIndex = configContent.lastIndexOf('import ');
33
+ const lastImportEnd = configContent.indexOf('\n', lastImportIndex);
34
+ configContent =
35
+ configContent.slice(0, lastImportEnd + 1) +
36
+ importLine +
37
+ configContent.slice(lastImportEnd + 1);
38
+ // Add provider to providers array
39
+ const providersMatch = configContent.match(/providers\s*:\s*\[/);
40
+ if (providersMatch && providersMatch.index !== undefined) {
41
+ const insertPos = providersMatch.index + providersMatch[0].length;
42
+ configContent =
43
+ configContent.slice(0, insertPos) +
44
+ `\n provideSonnyUI({ defaultTheme: '${theme}' }),` +
45
+ configContent.slice(insertPos);
46
+ }
47
+ tree.overwrite(configPath, configContent);
48
+ context.logger.info('Added provideSonnyUI to app.config.ts');
49
+ }
50
+ }
24
51
  return tree;
25
52
  };
26
53
  }
@@ -393,12 +393,12 @@ function generateComponent(options) {
393
393
  // Ensure cn.ts utility exists
394
394
  const cnTargetPath = `${targetDir}/utils/cn.ts`;
395
395
  if (!tree.exists(cnTargetPath)) {
396
- const cnContent = `import { clsx, type ClassValue } from 'clsx';
397
- import { twMerge } from 'tailwind-merge';
398
-
399
- export function cn(...inputs: ClassValue[]): string {
400
- return twMerge(clsx(inputs));
401
- }
396
+ const cnContent = `import { clsx, type ClassValue } from 'clsx';
397
+ import { twMerge } from 'tailwind-merge';
398
+
399
+ export function cn(...inputs: ClassValue[]): string {
400
+ return twMerge(clsx(inputs));
401
+ }
402
402
  `;
403
403
  tree.create(cnTargetPath, cnContent);
404
404
  context.logger.info('Created utils/cn.ts');
@@ -1,32 +1,32 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "SonnyUIGenerateComponentSchema",
4
- "title": "SonnyUI component generator (copy-paste style)",
5
- "type": "object",
6
- "properties": {
7
- "name": {
8
- "type": "string",
9
- "description": "The component to copy (accordion, alert, avatar, badge, breadcrumb, button, button-group, calendar, card, carousel, chat-bubble, checkbox, combobox, diff, divider, dock, drawer, dropdown, fab, fieldset, file-input, indicator, input, kbd, link, list, loader, modal, navbar, pagination, progress, radial-progress, radio, rating, select, sheet, skeleton, slider, stat, status, steps, switch, table, tabs, textarea, timeline, toast, toggle, tooltip, validator).",
10
- "$default": {
11
- "$source": "argv",
12
- "index": 0
13
- }
14
- },
15
- "path": {
16
- "type": "string",
17
- "default": "src/app/ui",
18
- "description": "The path to copy the component into."
19
- },
20
- "prefix": {
21
- "type": "string",
22
- "default": "sny",
23
- "description": "The prefix to use for selectors."
24
- },
25
- "skipTests": {
26
- "type": "boolean",
27
- "default": false,
28
- "description": "Skip copying test files."
29
- }
30
- },
31
- "required": ["name"]
32
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SonnyUIGenerateComponentSchema",
4
+ "title": "SonnyUI component generator (copy-paste style)",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The component to copy (accordion, alert, avatar, badge, breadcrumb, button, button-group, calendar, card, carousel, chat-bubble, checkbox, combobox, diff, divider, dock, drawer, dropdown, fab, fieldset, file-input, indicator, input, kbd, link, list, loader, modal, navbar, pagination, progress, radial-progress, radio, rating, select, sheet, skeleton, slider, stat, status, steps, switch, table, tabs, textarea, timeline, toast, toggle, tooltip, validator).",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ }
14
+ },
15
+ "path": {
16
+ "type": "string",
17
+ "default": "src/app/ui",
18
+ "description": "The path to copy the component into."
19
+ },
20
+ "prefix": {
21
+ "type": "string",
22
+ "default": "sny",
23
+ "description": "The prefix to use for selectors."
24
+ },
25
+ "skipTests": {
26
+ "type": "boolean",
27
+ "default": false,
28
+ "description": "Skip copying test files."
29
+ }
30
+ },
31
+ "required": ["name"]
32
+ }
@@ -13,7 +13,7 @@ declare function cn(...inputs: ClassValue[]): string;
13
13
 
14
14
  interface SonnyConfig {
15
15
  prefix?: string;
16
- defaultTheme?: 'light' | 'dark' | 'corporate';
16
+ defaultTheme?: 'light' | 'dark' | 'corporate' | 'system';
17
17
  }
18
18
  declare const SNY_CONFIG: InjectionToken<SonnyConfig>;
19
19
  declare function provideSonnyUI(config?: Partial<SonnyConfig>): EnvironmentProviders;
@@ -22,11 +22,14 @@ type Theme = 'light' | 'dark' | 'corporate';
22
22
  declare class ThemeService {
23
23
  private readonly document;
24
24
  private readonly isBrowser;
25
+ private readonly config;
25
26
  private readonly _theme;
26
27
  readonly theme: _angular_core.Signal<Theme>;
27
28
  readonly isDark: _angular_core.Signal<boolean>;
29
+ constructor();
28
30
  setTheme(theme: Theme): void;
29
31
  toggleDark(): void;
32
+ private resolveInitialTheme;
30
33
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThemeService, never>;
31
34
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ThemeService>;
32
35
  }