@su-labs/theme 1.0.0 → 1.0.3

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 CHANGED
@@ -31,7 +31,7 @@ The `SuThemeService` must be initialized at application startup to load its conf
31
31
  ```typescript
32
32
  // main.ts or app.config.ts
33
33
  import { provideAppInitializer, inject } from '@angular/core';
34
- import { SuThemeService, SuThemeConfig } from './path/to/su-theme.service';
34
+ import { SuThemeService, SuThemeConfig } from '@su-labs/theme';
35
35
 
36
36
  const myThemeConfig: SuThemeConfig = {
37
37
  // Optional: Set a default theme if none is saved
@@ -83,7 +83,7 @@ Use the setTheme() method to switch themes and the theme signal to read the curr
83
83
  ```TypeScript
84
84
 
85
85
  import { Component, inject } from '@angular/core';
86
- import { SuThemeService, SuThemeName } from './path/to/su-theme.service';
86
+ import { SuThemeService, SuThemeName } from '@su-labs/theme';
87
87
 
88
88
  @Component({
89
89
  selector: 'app-theme-switcher',
@@ -1,6 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { signal, Injectable } from '@angular/core';
3
- import { beforeAll, vi, describe, beforeEach, it, expect } from 'vitest';
4
3
 
5
4
  /**
6
5
  * Service for managing application themes.
@@ -178,125 +177,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
178
177
  }]
179
178
  }] });
180
179
 
181
- let matchMediaCallback = null;
182
- let currentMatches = false;
183
- beforeAll(() => {
184
- vi.stubGlobal('matchMedia', (query) => ({
185
- matches: currentMatches,
186
- media: query,
187
- addEventListener: (_, cb) => {
188
- matchMediaCallback = cb;
189
- },
190
- removeEventListener: () => {
191
- matchMediaCallback = null;
192
- },
193
- onchange: null,
194
- dispatchEvent: vi.fn(),
195
- }));
196
- });
197
- describe('SuThemeService', () => {
198
- let service;
199
- beforeEach(() => {
200
- localStorage.clear();
201
- currentMatches = false;
202
- matchMediaCallback = null;
203
- service = new SuThemeService();
204
- // Reset the DOM for each test
205
- document.documentElement.setAttribute('data-theme', '');
206
- document.documentElement.style.cssText = '';
207
- });
208
- it('should initialize with default theme "system" if no config', () => {
209
- service.init();
210
- expect(service.getUserPreference()).toBe('system');
211
- // The resolved theme can be either 'light' or 'dark' based on the initial `currentMatches`
212
- expect(['light', 'dark']).toContain(service.getTheme());
213
- });
214
- it('should apply custom CSS variables from a configuration', () => {
215
- const customConfig = {
216
- themes: {
217
- light: {
218
- color: 'red',
219
- background: 'black',
220
- },
221
- },
222
- };
223
- service.init(customConfig);
224
- service.setTheme('light');
225
- const rootStyle = getComputedStyle(document.documentElement);
226
- expect(rootStyle.getPropertyValue('--su-theme-color')).toBe('red');
227
- expect(rootStyle.getPropertyValue('--su-theme-background')).toBe('black');
228
- });
229
- it('should save user preference to localStorage', () => {
230
- service.init();
231
- service.setTheme('dark');
232
- expect(localStorage.getItem('su:theme')).toBe('dark');
233
- });
234
- it('should resolve system theme when preference is "system"', () => {
235
- currentMatches = true; // Simulates dark mode
236
- service.init({ defaultTheme: 'system' });
237
- expect(service.getTheme()).toBe('dark');
238
- expect(service.getUserPreference()).toBe('system');
239
- });
240
- describe('setTheme method', () => {
241
- it('should update the theme and apply default variables', () => {
242
- service.init();
243
- service.setTheme('dark');
244
- expect(service.getTheme()).toBe('dark');
245
- const rootStyle = getComputedStyle(document.documentElement);
246
- expect(rootStyle.getPropertyValue('--su-theme-background')).toBe('#1a1a1a');
247
- });
248
- it('should update theme and apply custom variables for the specified theme', () => {
249
- const customConfig = {
250
- themes: {
251
- dark: {
252
- background: '#000000',
253
- color: '#ffffff',
254
- },
255
- },
256
- };
257
- service.init(customConfig);
258
- service.setTheme('dark');
259
- const rootStyle = getComputedStyle(document.documentElement);
260
- expect(service.getTheme()).toBe('dark');
261
- expect(rootStyle.getPropertyValue('--su-theme-background')).toBe('#000000');
262
- expect(rootStyle.getPropertyValue('--su-theme-color')).toBe('#ffffff');
263
- });
264
- });
265
- it('should listen and react to system theme changes only when preference is "system"', () => {
266
- // Initial state: system preference, light mode
267
- service.init({ defaultTheme: 'system' });
268
- expect(service.getTheme()).toBe('light');
269
- // System switches to dark mode
270
- currentMatches = true;
271
- matchMediaCallback?.({ matches: true });
272
- expect(service.getTheme()).toBe('dark');
273
- // System switches back to light mode
274
- currentMatches = false;
275
- matchMediaCallback?.({ matches: false });
276
- expect(service.getTheme()).toBe('light');
277
- // User switches to a specific theme, listener should no longer react
278
- service.setTheme('dark', true);
279
- expect(service.getUserPreference()).toBe('dark');
280
- currentMatches = true;
281
- matchMediaCallback?.({ matches: true });
282
- expect(service.getTheme()).toBe('dark'); // Theme should not change
283
- });
284
- it('should remove event listeners on destroy', () => {
285
- const removeSpy = vi.fn();
286
- vi.stubGlobal('matchMedia', () => ({
287
- matches: false,
288
- addEventListener: vi.fn(),
289
- removeEventListener: removeSpy,
290
- media: '',
291
- onchange: null,
292
- dispatchEvent: vi.fn(),
293
- }));
294
- service.init({ defaultTheme: 'system' });
295
- service.ngOnDestroy();
296
- expect(removeSpy).toHaveBeenCalled();
297
- });
298
- });
299
-
300
180
  /*
301
181
  * Public API Surface of theme
302
182
  */
@@ -1 +1 @@
1
- {"version":3,"file":"su-labs-theme.mjs","sources":["../../../../projects/su-labs/theme/src/lib/theme.service.ts","../../../../projects/su-labs/theme/src/lib/theme.service.spec.ts","../../../../projects/su-labs/theme/src/public-api.ts","../../../../projects/su-labs/theme/src/su-labs-theme.ts"],"sourcesContent":["import { Injectable, signal, WritableSignal, OnDestroy, computed } from '@angular/core';\nimport { SuThemeConfig, SuThemeName, ThemeCssVariables } from './theme.types';\n\n/**\n * Service for managing application themes.\n *\n * Provides reactive theme state via signals and methods to set/get the theme.\n * Supports user preference, system-based themes, and custom CSS variable overrides.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SuThemeService implements OnDestroy {\n /** Configuration for the theme, provided during initialization */\n private suThemeConfig: SuThemeConfig = {};\n\n /** CSS variable prefix, can be customized */\n private cssVarPrefix = '--su-theme-';\n\n /** localStorage key for storing user preference, can be customized */\n private storageKey = 'su:theme';\n\n /** User selected theme (can be 'system') */\n private userPreference: SuThemeName = 'light';\n\n /** Current resolved theme signal ('light' | 'dark' | 'contrast' | 'custom') */\n private currentThemeSignal: WritableSignal<SuThemeName> = signal('light');\n\n /** Read-only access to the resolved theme signal */\n readonly theme = this.currentThemeSignal.asReadonly();\n\n /** System media query listener callback */\n private systemChangeHandler: ((event: MediaQueryListEvent) => void) | null = null;\n\n /** MediaQueryList instance for system theme changes */\n private mediaQuery?: MediaQueryList;\n\n /**\n * Initialize the service with optional configuration.\n * Should be called from APP_INITIALIZER for default setup.\n * @param config Optional configuration object.\n */\n public init(config?: SuThemeConfig): void {\n // Apply configuration and defaults\n this.suThemeConfig = { ...this.suThemeConfig, ...config };\n this.cssVarPrefix = this.suThemeConfig.cssVarPrefix ?? this.cssVarPrefix;\n this.storageKey = this.suThemeConfig.storageKey ?? this.storageKey;\n\n // Set user preference from localStorage or default\n this.userPreference = (localStorage.getItem(this.storageKey) as SuThemeName | null) ?? this.suThemeConfig.defaultTheme ?? 'system';\n\n // Set the initial theme based on the resolved preference\n this.setTheme(this.userPreference, false);\n }\n\n /**\n * Get the currently active, resolved theme.\n * @returns The resolved theme name ('light', 'dark', 'contrast', 'custom').\n */\n public getTheme(): SuThemeName {\n return this.currentThemeSignal();\n }\n\n /**\n * Get the user's theme preference (may be 'system').\n * @returns The user preference ('light', 'dark', 'contrast', 'custom', 'system').\n */\n public getUserPreference(): SuThemeName {\n return this.userPreference;\n }\n\n /**\n * Set a new theme.\n * @param theme The theme to set ('light', 'dark', 'contrast', 'custom', 'system').\n * @param persist Whether to store the preference in localStorage (default: true).\n */\n public setTheme(theme: SuThemeName, persist: boolean = true): void {\n // Stop listening to system changes if we are setting a non-system theme\n if (theme !== 'system') {\n this.stopListeningToSystemChanges();\n }\n\n // Resolve the final theme name\n const resolvedTheme: SuThemeName = theme === 'system' ? this.resolveSystemTheme() : theme;\n\n // Update internal state and signals\n this.userPreference = theme;\n this.currentThemeSignal.set(resolvedTheme);\n\n // Apply the theme to the document and manage system listeners\n document.documentElement.setAttribute('data-theme', resolvedTheme);\n this.applyThemeVariables(resolvedTheme);\n\n // Persist preference to localStorage\n if (persist) {\n localStorage.setItem(this.storageKey, theme);\n }\n\n // Start listening for system changes if the new preference is 'system'\n if (theme === 'system') {\n this.listenToSystemChanges();\n }\n }\n\n /**\n * Resolve the current system theme using prefers-color-scheme.\n * @returns 'dark' if system prefers dark mode, otherwise 'light'.\n */\n private resolveSystemTheme(): SuThemeName {\n if (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n return 'light';\n }\n\n /**\n * Listen to system theme changes and automatically update the theme.\n * Only active when user preference is 'system'.\n */\n private listenToSystemChanges(): void {\n // Only set up the listener if it's not already active\n if (!this.mediaQuery) {\n this.mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n this.systemChangeHandler = (event: MediaQueryListEvent): void => {\n // Only react if the user preference is still 'system'\n if (this.userPreference === 'system') {\n this.currentThemeSignal.set(event.matches ? 'dark' : 'light');\n document.documentElement.setAttribute('data-theme', this.currentThemeSignal());\n this.applyThemeVariables(this.currentThemeSignal());\n }\n };\n this.mediaQuery.addEventListener('change', this.systemChangeHandler);\n }\n }\n\n /**\n * Stop listening to system theme changes.\n * Should be called when the service is destroyed or theme is no longer 'system'.\n */\n private stopListeningToSystemChanges(): void {\n if (this.mediaQuery && this.systemChangeHandler) {\n this.mediaQuery.removeEventListener('change', this.systemChangeHandler);\n this.systemChangeHandler = null;\n this.mediaQuery = undefined;\n }\n }\n\n /**\n * Apply CSS variables for the given theme.\n * This method applies default variables if they are not overridden in the config.\n * @param theme The theme whose variables should be applied.\n */\n private applyThemeVariables(theme: SuThemeName): void {\n // Map of default variables for light and dark themes\n const defaultThemes: Record<SuThemeName, ThemeCssVariables> = {\n light: {\n color: '#333',\n background: '#fff',\n 'main-accent': '#007bff',\n 'second-accent': '#6c757d',\n 'third-accent': '#28a745',\n },\n dark: {\n color: '#f0f0f0',\n background: '#1a1a1a',\n 'main-accent': '#38a8e1',\n 'second-accent': '#a8b0b5',\n 'third-accent': '#2ee057',\n },\n // You can add more default themes here\n contrast: {\n color: '#000',\n background: '#fff',\n 'main-accent': '#ff0000',\n },\n custom: {},\n system: {},\n };\n\n // Use a combination of default and user-defined variables\n const variablesToApply = {\n ...defaultThemes[theme],\n ...(this.suThemeConfig.themes?.[theme] ?? {}),\n };\n\n // Apply the variables to the root element\n for (const [key, value] of Object.entries(variablesToApply)) {\n if (value) {\n document.documentElement.style.setProperty(\n `${this.cssVarPrefix}${key}`,\n value,\n );\n }\n }\n }\n\n /** Angular lifecycle hook for service destruction */\n ngOnDestroy(): void {\n this.stopListeningToSystemChanges();\n }\n}","import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';\nimport { SuThemeService } from './theme.service';\nimport { SuThemeConfig } from './theme.types';\n\nlet matchMediaCallback: ((e: MediaQueryListEvent) => void) | null = null;\nlet currentMatches = false;\n\nbeforeAll(() => {\n vi.stubGlobal('matchMedia', (query: string) => ({\n matches: currentMatches,\n media: query,\n addEventListener: (_: string, cb: (e: MediaQueryListEvent) => void) => {\n matchMediaCallback = cb;\n },\n removeEventListener: () => {\n matchMediaCallback = null;\n },\n onchange: null,\n dispatchEvent: vi.fn(),\n }));\n});\n\ndescribe('SuThemeService', () => {\n let service: SuThemeService;\n\n beforeEach(() => {\n localStorage.clear();\n currentMatches = false;\n matchMediaCallback = null;\n service = new SuThemeService();\n // Reset the DOM for each test\n document.documentElement.setAttribute('data-theme', '');\n document.documentElement.style.cssText = '';\n });\n\n it('should initialize with default theme \"system\" if no config', () => {\n service.init();\n expect(service.getUserPreference()).toBe('system');\n // The resolved theme can be either 'light' or 'dark' based on the initial `currentMatches`\n expect(['light', 'dark']).toContain(service.getTheme());\n });\n\n it('should apply custom CSS variables from a configuration', () => {\n const customConfig: SuThemeConfig = {\n themes: {\n light: {\n color: 'red',\n background: 'black',\n },\n },\n };\n service.init(customConfig);\n service.setTheme('light');\n\n const rootStyle = getComputedStyle(document.documentElement);\n expect(rootStyle.getPropertyValue('--su-theme-color')).toBe('red');\n expect(rootStyle.getPropertyValue('--su-theme-background')).toBe('black');\n });\n\n it('should save user preference to localStorage', () => {\n service.init();\n service.setTheme('dark');\n expect(localStorage.getItem('su:theme')).toBe('dark');\n });\n\n it('should resolve system theme when preference is \"system\"', () => {\n currentMatches = true; // Simulates dark mode\n service.init({ defaultTheme: 'system' });\n expect(service.getTheme()).toBe('dark');\n expect(service.getUserPreference()).toBe('system');\n });\n\n describe('setTheme method', () => {\n it('should update the theme and apply default variables', () => {\n service.init();\n service.setTheme('dark');\n expect(service.getTheme()).toBe('dark');\n const rootStyle = getComputedStyle(document.documentElement);\n expect(rootStyle.getPropertyValue('--su-theme-background')).toBe('#1a1a1a');\n });\n\n it('should update theme and apply custom variables for the specified theme', () => {\n const customConfig: SuThemeConfig = {\n themes: {\n dark: {\n background: '#000000',\n color: '#ffffff',\n },\n },\n };\n service.init(customConfig);\n service.setTheme('dark');\n\n const rootStyle = getComputedStyle(document.documentElement);\n expect(service.getTheme()).toBe('dark');\n expect(rootStyle.getPropertyValue('--su-theme-background')).toBe('#000000');\n expect(rootStyle.getPropertyValue('--su-theme-color')).toBe('#ffffff');\n });\n });\n\n it('should listen and react to system theme changes only when preference is \"system\"', () => {\n // Initial state: system preference, light mode\n service.init({ defaultTheme: 'system' });\n expect(service.getTheme()).toBe('light');\n\n // System switches to dark mode\n currentMatches = true;\n matchMediaCallback?.({ matches: true } as MediaQueryListEvent);\n expect(service.getTheme()).toBe('dark');\n\n // System switches back to light mode\n currentMatches = false;\n matchMediaCallback?.({ matches: false } as MediaQueryListEvent);\n expect(service.getTheme()).toBe('light');\n\n // User switches to a specific theme, listener should no longer react\n service.setTheme('dark', true);\n expect(service.getUserPreference()).toBe('dark');\n\n currentMatches = true;\n matchMediaCallback?.({ matches: true } as MediaQueryListEvent);\n expect(service.getTheme()).toBe('dark'); // Theme should not change\n });\n\n it('should remove event listeners on destroy', () => {\n const removeSpy = vi.fn();\n vi.stubGlobal('matchMedia', () => ({\n matches: false,\n addEventListener: vi.fn(),\n removeEventListener: removeSpy,\n media: '',\n onchange: null,\n dispatchEvent: vi.fn(),\n }));\n service.init({ defaultTheme: 'system' });\n service.ngOnDestroy();\n expect(removeSpy).toHaveBeenCalled();\n });\n});","/*\n * Public API Surface of theme\n */\n\nexport * from './lib/theme.service';\nexport * from './lib/theme.service.spec';\nexport * from './lib/theme.types';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAGA;;;;;AAKG;MAIU,cAAc,CAAA;;IAEjB,aAAa,GAAkB,EAAE;;IAGjC,YAAY,GAAG,aAAa;;IAG5B,UAAU,GAAG,UAAU;;IAGvB,cAAc,GAAgB,OAAO;;AAGrC,IAAA,kBAAkB,GAAgC,MAAM,CAAC,OAAO,8DAAC;;AAGhE,IAAA,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE;;IAG7C,mBAAmB,GAAkD,IAAI;;AAGzE,IAAA,UAAU;AAElB;;;;AAIG;AACI,IAAA,IAAI,CAAC,MAAsB,EAAA;;AAEhC,QAAA,IAAI,CAAC,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,MAAM,EAAE;AACzD,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;AACxE,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;;AAGlE,QAAA,IAAI,CAAC,cAAc,GAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAwB,IAAI,IAAI,CAAC,aAAa,CAAC,YAAY,IAAI,QAAQ;;QAGlI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,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C,OAAO,CAAC;;AAGxC,QAAA,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;QAEhD,cAAc,GAAG,IAAI;QACrB,kBAAkB,GAAG,EAAE,OAAO,EAAE,IAAI,EAAyB,CAAC;AAC9D,QAAA,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1C,KAAC,CAAC;AAEF,IAAA,EAAE,CAAC,0CAA0C,EAAE,MAAK;AAClD,QAAA,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,EAAE;QACzB,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO;AACjC,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;AACzB,YAAA,mBAAmB,EAAE,SAAS;AAC9B,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;AACvB,SAAA,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC;QACxC,OAAO,CAAC,WAAW,EAAE;AACrB,QAAA,MAAM,CAAC,SAAS,CAAC,CAAC,gBAAgB,EAAE;AACtC,KAAC,CAAC;AACJ,CAAC,CAAC;;AC1IF;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"su-labs-theme.mjs","sources":["../../../../projects/su-labs/theme/src/lib/theme.service.ts","../../../../projects/su-labs/theme/src/public-api.ts","../../../../projects/su-labs/theme/src/su-labs-theme.ts"],"sourcesContent":["import { Injectable, signal, WritableSignal, OnDestroy, computed } from '@angular/core';\nimport { SuThemeConfig, SuThemeName, ThemeCssVariables } from './theme.types';\n\n/**\n * Service for managing application themes.\n *\n * Provides reactive theme state via signals and methods to set/get the theme.\n * Supports user preference, system-based themes, and custom CSS variable overrides.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SuThemeService implements OnDestroy {\n /** Configuration for the theme, provided during initialization */\n private suThemeConfig: SuThemeConfig = {};\n\n /** CSS variable prefix, can be customized */\n private cssVarPrefix = '--su-theme-';\n\n /** localStorage key for storing user preference, can be customized */\n private storageKey = 'su:theme';\n\n /** User selected theme (can be 'system') */\n private userPreference: SuThemeName = 'light';\n\n /** Current resolved theme signal ('light' | 'dark' | 'contrast' | 'custom') */\n private currentThemeSignal: WritableSignal<SuThemeName> = signal('light');\n\n /** Read-only access to the resolved theme signal */\n readonly theme = this.currentThemeSignal.asReadonly();\n\n /** System media query listener callback */\n private systemChangeHandler: ((event: MediaQueryListEvent) => void) | null = null;\n\n /** MediaQueryList instance for system theme changes */\n private mediaQuery?: MediaQueryList;\n\n /**\n * Initialize the service with optional configuration.\n * Should be called from APP_INITIALIZER for default setup.\n * @param config Optional configuration object.\n */\n public init(config?: SuThemeConfig): void {\n // Apply configuration and defaults\n this.suThemeConfig = { ...this.suThemeConfig, ...config };\n this.cssVarPrefix = this.suThemeConfig.cssVarPrefix ?? this.cssVarPrefix;\n this.storageKey = this.suThemeConfig.storageKey ?? this.storageKey;\n\n // Set user preference from localStorage or default\n this.userPreference = (localStorage.getItem(this.storageKey) as SuThemeName | null) ?? this.suThemeConfig.defaultTheme ?? 'system';\n\n // Set the initial theme based on the resolved preference\n this.setTheme(this.userPreference, false);\n }\n\n /**\n * Get the currently active, resolved theme.\n * @returns The resolved theme name ('light', 'dark', 'contrast', 'custom').\n */\n public getTheme(): SuThemeName {\n return this.currentThemeSignal();\n }\n\n /**\n * Get the user's theme preference (may be 'system').\n * @returns The user preference ('light', 'dark', 'contrast', 'custom', 'system').\n */\n public getUserPreference(): SuThemeName {\n return this.userPreference;\n }\n\n /**\n * Set a new theme.\n * @param theme The theme to set ('light', 'dark', 'contrast', 'custom', 'system').\n * @param persist Whether to store the preference in localStorage (default: true).\n */\n public setTheme(theme: SuThemeName, persist: boolean = true): void {\n // Stop listening to system changes if we are setting a non-system theme\n if (theme !== 'system') {\n this.stopListeningToSystemChanges();\n }\n\n // Resolve the final theme name\n const resolvedTheme: SuThemeName = theme === 'system' ? this.resolveSystemTheme() : theme;\n\n // Update internal state and signals\n this.userPreference = theme;\n this.currentThemeSignal.set(resolvedTheme);\n\n // Apply the theme to the document and manage system listeners\n document.documentElement.setAttribute('data-theme', resolvedTheme);\n this.applyThemeVariables(resolvedTheme);\n\n // Persist preference to localStorage\n if (persist) {\n localStorage.setItem(this.storageKey, theme);\n }\n\n // Start listening for system changes if the new preference is 'system'\n if (theme === 'system') {\n this.listenToSystemChanges();\n }\n }\n\n /**\n * Resolve the current system theme using prefers-color-scheme.\n * @returns 'dark' if system prefers dark mode, otherwise 'light'.\n */\n private resolveSystemTheme(): SuThemeName {\n if (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n return 'light';\n }\n\n /**\n * Listen to system theme changes and automatically update the theme.\n * Only active when user preference is 'system'.\n */\n private listenToSystemChanges(): void {\n // Only set up the listener if it's not already active\n if (!this.mediaQuery) {\n this.mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n this.systemChangeHandler = (event: MediaQueryListEvent): void => {\n // Only react if the user preference is still 'system'\n if (this.userPreference === 'system') {\n this.currentThemeSignal.set(event.matches ? 'dark' : 'light');\n document.documentElement.setAttribute('data-theme', this.currentThemeSignal());\n this.applyThemeVariables(this.currentThemeSignal());\n }\n };\n this.mediaQuery.addEventListener('change', this.systemChangeHandler);\n }\n }\n\n /**\n * Stop listening to system theme changes.\n * Should be called when the service is destroyed or theme is no longer 'system'.\n */\n private stopListeningToSystemChanges(): void {\n if (this.mediaQuery && this.systemChangeHandler) {\n this.mediaQuery.removeEventListener('change', this.systemChangeHandler);\n this.systemChangeHandler = null;\n this.mediaQuery = undefined;\n }\n }\n\n /**\n * Apply CSS variables for the given theme.\n * This method applies default variables if they are not overridden in the config.\n * @param theme The theme whose variables should be applied.\n */\n private applyThemeVariables(theme: SuThemeName): void {\n // Map of default variables for light and dark themes\n const defaultThemes: Record<SuThemeName, ThemeCssVariables> = {\n light: {\n color: '#333',\n background: '#fff',\n 'main-accent': '#007bff',\n 'second-accent': '#6c757d',\n 'third-accent': '#28a745',\n },\n dark: {\n color: '#f0f0f0',\n background: '#1a1a1a',\n 'main-accent': '#38a8e1',\n 'second-accent': '#a8b0b5',\n 'third-accent': '#2ee057',\n },\n // You can add more default themes here\n contrast: {\n color: '#000',\n background: '#fff',\n 'main-accent': '#ff0000',\n },\n custom: {},\n system: {},\n };\n\n // Use a combination of default and user-defined variables\n const variablesToApply = {\n ...defaultThemes[theme],\n ...(this.suThemeConfig.themes?.[theme] ?? {}),\n };\n\n // Apply the variables to the root element\n for (const [key, value] of Object.entries(variablesToApply)) {\n if (value) {\n document.documentElement.style.setProperty(\n `${this.cssVarPrefix}${key}`,\n value,\n );\n }\n }\n }\n\n /** Angular lifecycle hook for service destruction */\n ngOnDestroy(): void {\n this.stopListeningToSystemChanges();\n }\n}","/*\n * Public API Surface of theme\n */\n\nexport * from './lib/theme.service';\nexport * from './lib/theme.types';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAGA;;;;;AAKG;MAIU,cAAc,CAAA;;IAEjB,aAAa,GAAkB,EAAE;;IAGjC,YAAY,GAAG,aAAa;;IAG5B,UAAU,GAAG,UAAU;;IAGvB,cAAc,GAAgB,OAAO;;AAGrC,IAAA,kBAAkB,GAAgC,MAAM,CAAC,OAAO,8DAAC;;AAGhE,IAAA,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE;;IAG7C,mBAAmB,GAAkD,IAAI;;AAGzE,IAAA,UAAU;AAElB;;;;AAIG;AACI,IAAA,IAAI,CAAC,MAAsB,EAAA;;AAEhC,QAAA,IAAI,CAAC,aA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AA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;2FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@su-labs/theme",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
+ "keywords": [
5
+ "angular",
6
+ "theme",
7
+ "dark-mode",
8
+ "light-mode",
9
+ "css-variables",
10
+ "signals",
11
+ "reactive",
12
+ "theming",
13
+ "utility",
14
+ "service",
15
+ "ui",
16
+ "customizable",
17
+ "localStorage",
18
+ "system-theme",
19
+ "prefers-color-scheme"
20
+ ],
21
+ "homepage": "https://github.com/Greezaaa/settings-utils-lib/tree/main/projects/su-labs/font-size#readme",
22
+ "author": {
23
+ "name": "Yevheniy Alekseyev",
24
+ "email": "yev.alekseyev@gmail.com",
25
+ "url": "https://github.com/Greezaaa"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/Greezaaa/settings-utils-lib.git",
30
+ "directory": "projects/su-labs/font-size"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/Greezaaa/settings-utils-lib/issues"
34
+ },
4
35
  "peerDependencies": {
5
36
  "@angular/common": "^20.1.0",
6
37
  "@angular/core": "^20.1.0"
@@ -9,6 +40,7 @@
9
40
  "tslib": "^2.3.0"
10
41
  },
11
42
  "sideEffects": false,
43
+ "license": "MIT",
12
44
  "module": "fesm2022/su-labs-theme.mjs",
13
45
  "typings": "index.d.ts",
14
46
  "exports": {