ngx-theme-stack 3.5.0 โ†’ 3.5.2

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
@@ -1,96 +1,140 @@
1
- # ngx-theme-stack ๐ŸŽจ
1
+ <div align="center">
2
+
3
+ # ๐ŸŽจ ngx-theme-stack
4
+
5
+ **A simple and powerful headless theme manager for Angular.**
6
+ Built for performance and SSR support.
7
+
8
+ [![npm version](https://img.shields.io/npm/v/ngx-theme-stack.svg?style=flat-square)](https://www.npmjs.com/package/ngx-theme-stack)
9
+ [![license](https://img.shields.io/npm/l/ngx-theme-stack.svg?style=flat-square)](https://github.com/WanderleeDev/ngx-theme-stack/blob/main/LICENSE)
10
+ [![angular](https://img.shields.io/badge/angular-v20%20%7C%20v21-dd0031.svg?style=flat-square&logo=angular)](https://angular.dev/)
11
+ [![signals](https://img.shields.io/badge/signals-powered-a78bfa.svg?style=flat-square)](https://angular.dev/guide/signals)
12
+ [![SSR](https://img.shields.io/badge/SSR-ready-4ade80.svg?style=flat-square)](https://angular.dev/guide/ssr)
13
+
14
+ [๐ŸŒ Live Demo](https://demo-ngx-theme-stack.wanderlee.site/) ยท [๐Ÿ“š Documentation](https://ngx-theme-stack-docs.wanderlee.site/) ยท [โญ Star on GitHub](https://github.com/WanderleeDev/ngx-theme-stack)
2
15
 
3
16
  ![ngx-theme-stack banner](https://raw.githubusercontent.com/WanderleeDev/ngx-theme-stack/refs/heads/main/projects/demo-ngx-theme-stack/public/banner.png)
4
17
 
5
- A simple and powerful headless theme manager for **Angular**. Built for performance and SSR support.
18
+ </div>
6
19
 
7
- [**๐ŸŒ Live Demo**](https://demo-ngx-theme-stack.wanderlee.site/) | [**๐Ÿ“š Documentation**](https://ngx-theme-stack-docs.wanderlee.site/) | [**โญ Star on GitHub**](https://github.com/WanderleeDev/ngx-theme-stack)
20
+ ---
21
+
22
+ ## ๐Ÿ“– Table of Contents
23
+
24
+ - [๐Ÿš€ Features](#-features)
25
+ - [๐Ÿ“ฆ Installation](#-installation)
26
+ - [๐Ÿค– What does `ng add` do for you?](#-what-does-ng-add-do-for-you)
27
+ - [๐Ÿ—๏ธ Architecture & Extensibility](#๏ธ-architecture--extensibility)
28
+ - [๐Ÿ“ Supported Versions](#-supported-versions)
29
+ - [โš™๏ธ Configuration](#๏ธ-configuration)
30
+ - [๐Ÿ› ๏ธ Usage](#๏ธ-usage)
31
+ - [๐Ÿ›ก๏ธ CoreThemeService API](#๏ธ-advanced-corethemeservice-api)
32
+ - [๐ŸŽจ Styling](#-styling)
33
+ - [๐ŸŒช๏ธ Tailwind CSS v4 Integration](#๏ธ-tailwind-css-v4-integration)
34
+ - [โšก Performance Strategies](#-performance-strategies)
35
+ - [๐Ÿ“„ License](#-license)
36
+
37
+ ---
8
38
 
9
39
  ## ๐Ÿš€ Features
10
40
 
11
- - โšก **Single Command Installation**: Automatic configuration via `ng add`.
12
- - ๐ŸŒ“ **System Preference Detection**: Automatic synchronization with OS settings (`prefers-color-scheme`).
13
- - ๐Ÿ”„ **Dynamic Switching**: Multiple ways to toggle themes (toggle, cycle, select).
14
- - ๐Ÿ› ๏ธ **Highly Customizable**: Support for custom themes, class prefixes, and configurable storage.
15
- - ๐Ÿงฑ **Modern Architecture**: Powered by Angular Signals for maximum reactivity and performance.
16
- - ๐ŸŒ **SSR Ready**: Safe to use in Server-Side Rendering environments.
17
- - ๐Ÿšซ **Zero Flicker**: Includes an optimized anti-flash script and the **Critters Trick** strategy to prevent theme jumps and network requests on load.
41
+ | | Feature | Description |
42
+ | --- | ------------------------------- | --------------------------------------------------- |
43
+ | โšก | **Single command setup** | Automatic configuration via `ng add` |
44
+ | ๐ŸŒ“ | **System preference detection** | Auto-syncs with OS via `prefers-color-scheme` |
45
+ | ๐Ÿ”„ | **Dynamic switching** | Toggle, cycle, or select between themes |
46
+ | ๐Ÿ› ๏ธ | **Highly customizable** | Custom themes, class prefixes, configurable storage |
47
+ | ๐Ÿงฑ | **Angular Signals** | Maximum reactivity and performance |
48
+ | ๐ŸŒ | **SSR ready** | Safe in server-side rendering environments |
49
+ | ๐Ÿšซ | **Zero flicker** | Anti-flash script + Critters Trick strategy |
18
50
 
19
- ## ๐Ÿ“ฆ Installation
51
+ ---
20
52
 
21
- To install the library and configure it automatically in your project, run:
53
+ ## ๐Ÿ“ฆ Installation
22
54
 
23
55
  ```bash
24
56
  ng add ngx-theme-stack
25
57
  ```
26
58
 
27
- ### Installation Modes
28
-
29
59
  > [!TIP]
30
60
  > **๐Ÿš€ Using Bun?**
31
- > Since `ng add` is currently not supported for Bun environments, please use this two-step process:
32
- >
33
- > 1. **Install:** `bun add ngx-theme-stack`
34
- > 2. **Configure:** `ng generate ngx-theme-stack:ng-add`
61
+ > Since `ng add` is currently not supported for Bun environments, use this two-step process:
35
62
  >
36
- > This ensures Bun handles the dependency management while the schematic automates the code configuration (providers, index.html, tokens, etc.).
63
+ > ```bash
64
+ > bun add ngx-theme-stack
65
+ > ng generate ngx-theme-stack:ng-add
66
+ > ```
67
+
68
+ ### Installation modes
69
+
70
+ When running `ng add`, you choose between two modes:
71
+
72
+ <details>
73
+ <summary><strong>โšก Quick mode</strong> โ€” default, applies instantly</summary>
74
+
75
+ | Option | Value |
76
+ | ---------------- | ------------------------- |
77
+ | Initial theme | `system` |
78
+ | Apply mode | `class` on `<html>` |
79
+ | Available themes | `light`, `dark`, `system` |
80
+ | Strategy | `critters` โ€” zero flash |
37
81
 
38
- When running `ng add`, you will be presented with two configuration options:
82
+ </details>
39
83
 
40
- 1. **Quick Mode**:
41
- - Applies default configuration instantly.
42
- - Initial theme: `system`.
43
- - Apply mode: `class` (adds the theme class to the `<html>` element).
44
- - Available themes: `['light', 'dark', 'system']`.
45
- - **Strategy**: `critters` (Zero-flash via CSS inlining).
84
+ <details>
85
+ <summary><strong>๐Ÿ› ๏ธ Custom mode</strong> โ€” full control</summary>
46
86
 
47
- 2. **Custom Mode**:
48
- - Choose which themes to include (e.g., if you have a `blue` or `high-contrast` theme).
49
- - Configure the default theme upon app startup.
50
- - Change the `localStorage` key where the theme choice is saved.
51
- - Decide how to apply themes: via classes (`class`), attributes (`data-theme`), or both.
52
- - **Pick your strategy**: `critters` (default) inlines all theme CSS โ€” works for CSR, SSR, and SSG. Use `blocking` if you have a strict CSP or prefer a standard external stylesheet.
87
+ - Choose which themes to include (e.g. `blue`, `high-contrast`)
88
+ - Configure the default theme on startup
89
+ - Change the `localStorage` key
90
+ - Apply via `class`, `data-theme` attribute, or both
91
+ - Pick your anti-flash strategy: `critters` or `blocking`
92
+
93
+ </details>
94
+
95
+ ---
53
96
 
54
97
  ## ๐Ÿค– What does `ng add` do for you?
55
98
 
56
- To provide a "Zero Config" experience, the installation command automates the following:
99
+ The installation command automates the following:
57
100
 
58
- 1. **`app.config.ts` (or `main.ts`)**: Injects `provideThemeStack()` into your providers array. It's **Smart**: it uses AST to follow imports and find your providers even if they are delegated to external files.
59
- 2. **`index.html`**: Injects the blocking anti-flash script into the `<head>` to ensure a seamless theme experience.
60
- 3. **`package.json`**: Adds a `"prebuild"` script to automate theme synchronization.
61
- 4. **`angular.json`**: Registers `themes.css` and optimizes build configurations.
62
- 5. **`themes.css`**: Scaffolds your base theme tokens if they don't exist.
101
+ | File | What changes |
102
+ | --------------- | ----------------------------------------------------------------------- |
103
+ | `app.config.ts` | Injects `provideThemeStack()` using AST โ€” follows imports automatically |
104
+ | `index.html` | Injects the blocking anti-flash script into `<head>` |
105
+ | `package.json` | Adds a `"prebuild"` script for theme synchronization |
106
+ | `angular.json` | Registers `themes.css` and optimizes build config |
107
+ | `themes.css` | Scaffolds base theme tokens if they don't exist |
63
108
 
64
109
  > [!TIP]
65
- > **Re-configuration support:** You can run `ng add` multiple times. If you change your mind about the `storageKey` or the `mode`, the schematic will update your existing code and script automatically without duplicating them.
66
-
67
- ## ๐Ÿ—๏ธ Architecture & Extensibility
110
+ > **Re-configuration support:** Run `ng add` multiple times freely. The schematic updates existing code without duplicating it.
68
111
 
69
- The library is designed to be flexible. The **`CoreThemeService`** is the foundation:
112
+ ---
70
113
 
71
- - **Solid Base:** Manages state (`Signal`), persistence (`localStorage`), system detection (`matchMedia`), and safe DOM manipulation (SSR compatible).
72
- - **Extensibility:** You can inject `CoreThemeService` to build your own custom services or components with specific business logic.
114
+ ## ๐Ÿ—๏ธ Architecture & Extensibility
73
115
 
74
- ### Utility Services (Ready to Use)
116
+ The **`CoreThemeService`** is the foundation โ€” it manages state (Signals), persistence (localStorage), system detection (matchMedia), and safe DOM manipulation (SSR compatible).
75
117
 
76
- For common use cases, we include three services with predefined logic:
118
+ ### Utility services
77
119
 
78
- 1. **`ThemeToggleService`**: A simple binary switch between `light` and `dark`.
79
- 2. **`ThemeSelectService`**: Exposes the full list of themes and methods to select them.
80
- 3. **`ThemeCycleService`**: A circular function to cycle through all available themes; exposes `upcoming`, `preceding`, and `cycleIndex` signals for UI feedback.
120
+ | Service | Pattern | Description |
121
+ | -------------------- | ------- | ------------------------------------------------------------------------- |
122
+ | `ThemeToggleService` | Toggle | Binary switch between `light` and `dark` |
123
+ | `ThemeSelectService` | Select | Exposes the full theme list; ideal for dropdowns |
124
+ | `ThemeCycleService` | Cycle | Rotates through all themes; exposes `upcoming`, `preceding`, `cycleIndex` |
81
125
 
82
126
  ---
83
127
 
84
- ## โš™๏ธ Supported Versions
128
+ ## ๐Ÿ“ Supported Versions
85
129
 
86
- | Angular Version | Support |
87
- | :-------------- | :-------- |
88
- | **Angular 21** | โœ… Stable |
89
- | **Angular 20** | โœ… Stable |
130
+ | Angular Version | Status |
131
+ | --------------- | --------- |
132
+ | Angular 21 | โœ… Stable |
133
+ | Angular 20 | โœ… Stable |
90
134
 
91
- ## โš™๏ธ Configuration
135
+ ---
92
136
 
93
- The best way to configure the library is during installation, but you can also manually adjust the providers in your `app.config.ts`:
137
+ ## โš™๏ธ Configuration
94
138
 
95
139
  ```typescript
96
140
  import { provideThemeStack } from 'ngx-theme-stack';
@@ -98,34 +142,38 @@ import { provideThemeStack } from 'ngx-theme-stack';
98
142
  export const appConfig: ApplicationConfig = {
99
143
  providers: [
100
144
  provideThemeStack({
101
- themes: ['light', 'dark', 'sunset'], // Your theme identifiers
102
- defaultTheme: 'system', // Initial fallback ('system' resolves via matchMedia)
103
- mode: 'class', // 'class', 'attribute' or 'both'
104
- strategy: 'critters', // 'critters' (SSR) or 'blocking' (Standard SPA)
105
- storageKey: 'ngx-theme-stack', // LocalStorage key
145
+ themes: ['light', 'dark', 'sunset'], // your theme identifiers
146
+ defaultTheme: 'system', // resolves via matchMedia
147
+ mode: 'class', // 'class' | 'attribute' | 'both'
148
+ strategy: 'critters', // 'critters' | 'blocking'
149
+ storageKey: 'ngx-theme-stack', // localStorage key
106
150
  }),
107
151
  ],
108
152
  };
109
153
  ```
110
154
 
111
- | Option | Type | Default | Description |
112
- | :------------- | :----------- | :---------------------------- | :------------------------------------------------------------------------ |
113
- | `themes` | `string[]` | `['light', 'dark', 'system']` | List of supported theme identifiers. |
114
- | `defaultTheme` | `string` | `'system'` | Theme used on first visit or when no preference is saved. |
115
- | `mode` | `NgMode` | `'class'` | How the theme is applied: `class`, `attribute` (`data-theme`), or `both`. |
116
- | `strategy` | `NgStrategy` | `'critters'` | Anti-flash performance strategy: `critters` (inlined CSS) or `blocking`. |
117
- | `storageKey` | `string` | `'ngx-theme-stack'` | Key used to persist theme preference in `localStorage`. |
155
+ ### Options reference
118
156
 
119
- > [!IMPORTANT]
120
- > Whenever you update these settings, run `ng generate ngx-theme-stack:sync` to ensure your `index.html` is updated with the correct anti-flash script.
157
+ | Option | Type | Default | Description |
158
+ | -------------- | ------------ | ----------------------------- | ------------------------ |
159
+ | `themes` | `string[]` | `['light', 'dark', 'system']` | Merged with built-ins |
160
+ | `defaultTheme` | `string` | `'system'` | Theme on first visit |
161
+ | `mode` | `NgMode` | `'class'` | How the theme is applied |
162
+ | `strategy` | `NgStrategy` | `'critters'` | Anti-flash strategy |
163
+ | `storageKey` | `string` | `'ngx-theme-stack'` | Persistence key |
121
164
 
122
- ## ๐Ÿ› ๏ธ Usage
165
+ > [!NOTE]
166
+ > Custom themes are **merged** with built-ins. Passing `['sepia', 'ocean']` resolves to `['system', 'light', 'dark', 'sepia', 'ocean']`. After config changes, run:
167
+ >
168
+ > ```bash
169
+ > ng generate ngx-theme-stack:sync --project YOUR_PROJECT_NAME
170
+ > ```
123
171
 
124
- For most use cases, we recommend using the built-in **Utility Services**. They provide ready-to-use logic for common patterns.
172
+ ---
125
173
 
126
- ### 1. Simple Toggle (Dark/Light)
174
+ ## ๐Ÿ› ๏ธ Usage
127
175
 
128
- Use `ThemeToggleService` when you only need a simple switch.
176
+ ### 1 โ€” Simple toggle (dark/light)
129
177
 
130
178
  ```typescript
131
179
  import { inject } from '@angular/core';
@@ -143,9 +191,7 @@ export class ThemeToggleComponent {
143
191
  }
144
192
  ```
145
193
 
146
- ### 2. Multi-theme Cycle
147
-
148
- Use `ThemeCycleService` to rotate through all your configured themes in order.
194
+ ### 2 โ€” Multi-theme cycle
149
195
 
150
196
  ```typescript
151
197
  import { inject } from '@angular/core';
@@ -155,7 +201,7 @@ import { ThemeCycleService } from 'ngx-theme-stack';
155
201
  selector: 'app-theme-cycler',
156
202
  standalone: true,
157
203
  template: `
158
- <button (click)="theme.cycle()">Next theme: {{ theme.upcoming() }}</button>
204
+ <button (click)="theme.cycle()">Next: {{ theme.upcoming() }}</button>
159
205
  <p>Theme {{ theme.cycleIndex() + 1 }} of {{ theme.availableThemes.length }}</p>
160
206
  `,
161
207
  })
@@ -164,9 +210,7 @@ export class ThemeCycleComponent {
164
210
  }
165
211
  ```
166
212
 
167
- ### 3. Direct Selection (Dropdowns/Lists)
168
-
169
- Use `ThemeSelectService` to build selection interfaces like dropdowns or radio groups.
213
+ ### 3 โ€” Direct selection (dropdowns/lists)
170
214
 
171
215
  ```typescript
172
216
  import { inject } from '@angular/core';
@@ -192,9 +236,7 @@ export class ThemeSelectComponent {
192
236
 
193
237
  ---
194
238
 
195
- ### ๐Ÿ›ก๏ธ Advanced: CoreThemeService API
196
-
197
- If you need to build custom logic or want full control over the state, use the foundational `CoreThemeService`.
239
+ ## ๐Ÿ›ก๏ธ Advanced: CoreThemeService API
198
240
 
199
241
  ```typescript
200
242
  import { inject } from '@angular/core';
@@ -204,39 +246,45 @@ import { CoreThemeService } from 'ngx-theme-stack';
204
246
  export class MyAdvancedComponent {
205
247
  themeService = inject(CoreThemeService);
206
248
 
207
- /* --- ๐Ÿ“Š Reactive Signals --- */
208
-
209
- // The exact theme chosen by the user ('dark', 'light', 'system', etc.)
210
- selectedTheme = this.themeService.selectedTheme;
211
-
212
- // The theme finally applied to the DOM (resolves 'system' to 'dark' or 'light')
213
- resolvedTheme = this.themeService.resolvedTheme;
214
-
215
- // Helper boolean signals evaluating the applied theme
216
- isDark = this.themeService.isDark;
217
- isLight = this.themeService.isLight;
218
- isSystem = this.themeService.isSystem;
219
-
220
- // True after the first browser render. Great for preventing SSR flickering!
221
- isHydrated = this.themeService.isHydrated;
222
-
223
- /* --- ๐Ÿ› ๏ธ Methods --- */
249
+ // โ”€โ”€ Signals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
250
+ selectedTheme = this.themeService.selectedTheme; // chosen by user
251
+ resolvedTheme = this.themeService.resolvedTheme; // applied to DOM
252
+ isDark = this.themeService.isDark;
253
+ isLight = this.themeService.isLight;
254
+ isSystem = this.themeService.isSystem;
255
+ isHydrated = this.themeService.isHydrated; // true after first render
224
256
 
257
+ // โ”€โ”€ Methods โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
225
258
  changeTheme(newTheme: string) {
226
- // Validates, applies to the DOM, and saves to localStorage
227
- this.themeService.setTheme(newTheme);
259
+ this.themeService.setTheme(newTheme); // validates + applies + persists
228
260
  }
229
261
  }
230
262
  ```
231
263
 
264
+ > [!NOTE]
265
+ > `isDark` and `isLight` are `false` when a custom theme is active (e.g. `'sunset'`). For custom theme guards, use `resolvedTheme()` directly:
266
+ >
267
+ > ```typescript
268
+ > const isSunset = computed(() => themeService.resolvedTheme() === 'sunset');
269
+ > ```
270
+ >
271
+ > Use `isHydrated()` to guard conditional content (icons, images) against SSR hydration mismatches:
272
+ >
273
+ > ```html
274
+ > @if (theme.isHydrated()) {
275
+ > <img [src]="theme.isDark() ? 'dark-logo.png' : 'light-logo.png'">
276
+ > }
277
+ > ```
278
+
279
+ ---
280
+
232
281
  ## ๐ŸŽจ Styling
233
282
 
234
- The `ng add` command automatically creates a **`src/themes.css`** file. This is where you should define your theme-specific CSS variables.
283
+ `ng add` creates `src/themes.css` automatically. Define your CSS variables there:
235
284
 
236
285
  ```css
237
286
  /* src/themes.css */
238
287
 
239
- /* Using Classes (Default Mode) */
240
288
  :root,
241
289
  .light {
242
290
  --bg-color: #ffffff;
@@ -254,15 +302,14 @@ The `ng add` command automatically creates a **`src/themes.css`** file. This is
254
302
  }
255
303
  ```
256
304
 
257
- ## ๐ŸŒช๏ธ Tailwind CSS v4 Integration
258
-
259
- If you are using **Tailwind CSS v4**, you can map your `themes.css` variables directly to Tailwind design tokens for a clean, theme-aware utility class experience.
305
+ ---
260
306
 
261
- ### 1. Map Semantic Variables โœ… Recommended
307
+ ## ๐ŸŒช๏ธ Tailwind CSS v4 Integration
262
308
 
263
- In your `src/styles.css`, expose your theme variables as Tailwind tokens:
309
+ ### Map semantic variables (recommended)
264
310
 
265
311
  ```css
312
+ /* src/styles.css */
266
313
  @import 'tailwindcss';
267
314
 
268
315
  @theme {
@@ -271,29 +318,22 @@ In your `src/styles.css`, expose your theme variables as Tailwind tokens:
271
318
  }
272
319
  ```
273
320
 
274
- ### 2. Usage in Components
275
-
276
- Now you can write clean, theme-aware classes. Colors update **automatically** whenever `ngx-theme-stack` switches the active theme โ€” no `dark:` prefix needed:
321
+ ### Use in components โ€” no `dark:` prefix needed
277
322
 
278
323
  ```html
279
324
  <div class="bg-main-bg text-main-text shadow-xl">
280
- <!-- Automatically reflects the active theme (dark, light, sunset, etc.) -->
325
+ <!-- automatically reflects the active theme -->
281
326
  </div>
282
327
  ```
283
328
 
284
- > **โœ… Why this works:** The CSS variables on `<html>` are already set before Angular boots (see [Performance Strategies](#-performance-strategies)). Since the Tailwind tokens (`--color-main-bg`) point directly to those variables, **this single approach covers manual toggling + all themes** (dark, light, sunset, etc.) โ€” without any extra Tailwind configuration.
329
+ > **Why this works:** CSS variables are set on `<html>` before Angular boots. Tailwind tokens point directly to those variables, covering all themes (dark, light, sunset, etc.) without extra configuration.
285
330
 
331
+ <details>
332
+ <summary><strong>Optional: enable the <code>dark:</code> prefix</strong></summary>
286
333
 
287
- ---
288
-
289
- ### (Optional) Enable the `dark:` Tailwind Prefix
290
-
291
- Only needed if you want to use `dark:` utilities directly (e.g. `dark:bg-black`) tied to ngx-theme-stack's toggle instead of the OS system preference.
334
+ Only needed if you want `dark:` utilities tied to ngx-theme-stack's toggle:
292
335
 
293
336
  ```css
294
- /* src/styles.css */
295
- @import 'tailwindcss';
296
-
297
337
  /* Class mode */
298
338
  @custom-variant dark (&:where(.dark, .dark *));
299
339
 
@@ -301,59 +341,49 @@ Only needed if you want to use `dark:` utilities directly (e.g. `dark:bg-black`)
301
341
  @custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
302
342
  ```
303
343
 
304
- > **โš ๏ธ** Overriding `@custom-variant dark` disconnects `dark:` from the OS preference and only covers the `dark` theme. For multi-theme support, prefer the CSS variable approach above.
305
-
344
+ > **โš ๏ธ** This disconnects `dark:` from OS preference and only covers the built-in `dark` theme. For multi-theme support, prefer the CSS variable approach above.
306
345
 
346
+ </details>
307
347
 
348
+ ---
308
349
 
309
350
  ## โšก Performance Strategies
310
351
 
311
352
  ### How the theme is applied on first load
312
353
 
313
- `ng add` injects a minimal blocking script as the **first child of `<head>`** in your `index.html`. This script runs before any stylesheet or Angular bundle:
354
+ `ng add` injects a minimal blocking script as the **first child of `<head>`**. It runs before any stylesheet or Angular bundle:
314
355
 
315
356
  ```
316
- 1. Reads the stored theme from localStorage
317
- 2. If the theme (or defaultTheme) is 'system' โ†’
318
- resolves OS preference via matchMedia('prefers-color-scheme: dark')
319
- 3. Applies the theme to <html> (class, attribute, or both)
320
- 4. Sets color-scheme CSS property for native browser adaptation
357
+ 1. Read stored theme from localStorage
358
+ 2. If 'system' โ†’ resolve OS preference via matchMedia('prefers-color-scheme: dark')
359
+ 3. Apply theme to <html> (class, attribute, or both)
360
+ 4. Set color-scheme CSS property for native browser adaptation
321
361
  ```
322
362
 
323
- This script **always runs regardless of strategy** โ€” it eliminates the flash of incorrect theme class. However, the CSS variables (your actual colors) still need to be delivered. That's where the strategy matters.
324
-
325
- ### Anti-flash strategies
326
-
327
- There are two layers to prevent a flash:
328
-
329
- | Layer | What it prevents | Always active? |
330
- |---|---|---|
331
- | Anti-flash script | Wrong theme class on `<html>` | โœ… Yes, always |
332
- | Strategy | Unstyled variables flash | Depends on chosen strategy |
363
+ ### Strategy comparison
333
364
 
334
- **1. Critters (Default)**
365
+ | | critters (default) | blocking |
366
+ | ------------------------- | ---------------------------------- | ------------------------------------------ |
367
+ | **How it works** | Inlines all CSS vars into `<head>` | Loads `themes.css` as render-blocking file |
368
+ | **Network requests** | Zero | One (then cached) |
369
+ | **Flash risk** | None | None |
370
+ | **Works with CSR** | โœ… | โœ… |
371
+ | **Works with SSR/SSG** | โœ… | โš ๏ธ May flash on SSG |
372
+ | **Strict CSP compatible** | โŒ requires `unsafe-inline` | โœ… |
373
+ | **Best for** | Most apps | Strict CSP, many themes |
335
374
 
336
- Injects hidden `<div>`s for each theme into `<body>`, forcing Angular's Critters optimizer to inline **all** CSS variables directly into `<head>`. When the anti-flash script sets the class, the variables are already there โ€” **zero network requests, zero flash**. Works equally for CSR, SSR, and SSG apps.
375
+ <details>
376
+ <summary><strong>When to choose blocking over critters</strong></summary>
337
377
 
338
- **2. Blocking**
378
+ - **Strict CSP** โ€” Critters generates inline `<style>` tags requiring `'unsafe-inline'` in `style-src`
379
+ - **Many themes** โ€” All theme variables get inlined into HTML on every request; a cached file is more efficient
380
+ - **Critters conflicts** โ€” Complex CSS pipelines (PostCSS, CSS Modules) can conflict with Critters
381
+ - **Simpler debugging** โ€” An explicit stylesheet is easier to inspect in DevTools
339
382
 
340
- Disables Critters (`inlineCritical: false`) and loads `themes.css` as a render-blocking stylesheet. The browser blocks rendering until it's downloaded, so there's no visible flash โ€” but it requires one network round-trip. The file is HTTP-cacheable after the first load.
341
-
342
- **When to choose Blocking over Critters:**
343
-
344
- - **Strict CSP** โ€” Critters generates inline `<style>` tags, which require `'unsafe-inline'` in `style-src`. A blocking stylesheet avoids this.
345
- - **Many themes** โ€” All theme variables get inlined into the HTML on every request with Critters. If you have many themes with many variables, a cached external file is more efficient.
346
- - **Critters conflicts** โ€” Complex CSS pipelines (PostCSS, CSS Modules, etc.) can conflict with Critters. Blocking is the safe fallback.
347
- - **Simpler debugging** โ€” An explicit stylesheet is easier to inspect in DevTools than inlined styles.
348
-
349
-
350
- Use the **Sync Command** to refresh your `index.html` if you change your configuration:
351
-
352
- ```bash
353
- ng generate ngx-theme-stack:sync --project YOUR_PROJECT_NAME
354
- ```
383
+ </details>
355
384
 
385
+ ---
356
386
 
357
387
  ## ๐Ÿ“„ License
358
388
 
359
- [MIT](./LICENSE)
389
+ [MIT](https://github.com/WanderleeDev/ngx-theme-stack/blob/main/LICENSE)
@@ -70,8 +70,10 @@ const NGX_THEME_STACK_CONFIG = new InjectionToken('NGX_THEME_STACK_CONFIG', {
70
70
  /**
71
71
  * Provides Theme Stack configuration to Angular's DI system.
72
72
  *
73
- * Custom `themes` are **merged** with the built-in defaults
74
- * (`'light'`, `'dark'`, `'system'`), so you never lose the base themes.
73
+ * The `themes` option accepts **additional** theme identifiers beyond the
74
+ * built-in defaults. They are merged with `'light'`, `'dark'`, and `'system'`
75
+ * so that the resolved {@link NgConfig.themes} array always includes all of
76
+ * them โ€” your custom values are appended after the built-ins.
75
77
  *
76
78
  * **Defaults:**
77
79
  * - `themes`: `['light', 'dark', 'system']`
@@ -184,9 +186,19 @@ class CoreThemeService {
184
186
  const theme = this.#selectedTheme();
185
187
  return theme === 'system' ? this.#systemPreference() : theme;
186
188
  }, ...(ngDevMode ? [{ debugName: "resolvedTheme" }] : /* istanbul ignore next */ []));
187
- /** Whether the currently applied theme is dark. */
189
+ /**
190
+ * Whether the currently applied theme is dark.
191
+ *
192
+ * Returns `false` when a custom theme (e.g. `'sunset'`) is active โ€” use
193
+ * `resolvedTheme()` directly if you need to inspect the current custom theme.
194
+ */
188
195
  isDark = computed(() => this.resolvedTheme() === 'dark', ...(ngDevMode ? [{ debugName: "isDark" }] : /* istanbul ignore next */ []));
189
- /** Whether the currently applied theme is light. */
196
+ /**
197
+ * Whether the currently applied theme is light.
198
+ *
199
+ * Returns `false` when a custom theme (e.g. `'sepia'`) is active โ€” use
200
+ * `resolvedTheme()` directly if you need to inspect the current custom theme.
201
+ */
190
202
  isLight = computed(() => this.resolvedTheme() === 'light', ...(ngDevMode ? [{ debugName: "isLight" }] : /* istanbul ignore next */ []));
191
203
  /** Whether the currently applied theme is system. */
192
204
  isSystem = computed(() => this.selectedTheme() === 'system', ...(ngDevMode ? [{ debugName: "isSystem" }] : /* istanbul ignore next */ []));
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-theme-stack.mjs","sources":["../../../projects/ngx-theme-stack/src/lib/errors.ts","../../../projects/ngx-theme-stack/src/lib/types.ts","../../../projects/ngx-theme-stack/src/lib/config/index.ts","../../../projects/ngx-theme-stack/src/lib/core/core-theme.service.ts","../../../projects/ngx-theme-stack/src/lib/services/theme-cycle.service.ts","../../../projects/ngx-theme-stack/src/lib/services/theme-select.service.ts","../../../projects/ngx-theme-stack/src/lib/services/theme-toggle.service.ts","../../../projects/ngx-theme-stack/src/public-api.ts","../../../projects/ngx-theme-stack/src/ngx-theme-stack.ts"],"sourcesContent":["/**\n * Base error class for `ngx-theme-stack`.\n *\n * Thrown when the library configuration is invalid.\n * Consumers can use `instanceof NgxThemeStackError` to catch only\n * errors originating from this library.\n *\n * @example\n * try {\n * bootstrapApplication(AppComponent, appConfig);\n * } catch (e) {\n * if (e instanceof NgxThemeStackError) {\n * console.error('Bad ngx-theme-stack config:', e.message);\n * }\n * }\n */\nexport class NgxThemeStackError extends Error {\n override readonly name = 'NgxThemeStackError';\n\n constructor(message: string) {\n super(`[ngx-theme-stack] ${message}`);\n // Restore prototype chain (required when targeting ES5 or older)\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","/**\n * Runtime list of built-in themes.\n *\n * Lives here (and not in config/index.ts) because it defines a type:\n * config/index.ts already imports from types.ts, so placing DEFAULT_THEMES\n * here avoids any circular dependency.\n *\n * โš  KEEP IN SYNC with the duplicate in:\n * projects/ngx-theme-stack/schematics/ng-add/constants.ts โ†’ DEFAULT_THEMES\n *\n * Schematics compile to CommonJS and cannot import from this ESM file,\n * so the values are intentionally duplicated. Change both at the same time.\n */\nexport const DEFAULT_THEMES = ['system', 'light', 'dark'] as const;\n\n/** Literal union of built-in themes: `'system' | 'light' | 'dark'`. */\nexport type DefaultNgTheme = (typeof DEFAULT_THEMES)[number];\n\n/**\n * Theme type.\n *\n * - **Without** `T`: open union โ€” accepts any `string` with IDE autocomplete\n * hints for the built-in themes (`'system' | 'light' | 'dark'`).\n * - **With** `T`: closed union โ€” exactly `DefaultNgTheme | T`, enabling\n * full type-safety for custom theme sets.\n *\n * @example\n * NgTheme // 'system' | 'light' | 'dark' | (string & {})\n * NgTheme<'sepia'> // 'system' | 'light' | 'dark' | 'sepia'\n */\nexport type NgTheme<T extends string = string & {}> = DefaultNgTheme | T;\n\n/**\n * Resolved theme โ€” always `'light'` or `'dark'`, never `'system'`.\n * Represents the value that comes from `matchMedia`, not user selection.\n */\nexport type NgSystemTheme = Exclude<DefaultNgTheme, 'system'>;\n\n/**\n * Theme application mode.\n * - `'attribute'`: sets `data-theme` attribute on `<html>`\n * - `'class'`: adds theme class to `<html>`\n * - `'both'`: uses both attribute and class\n */\nexport type NgMode = 'attribute' | 'class' | 'both';\n\n/**\n * Theme application strategy.\n * - `'blocking'`: theme CSS is loaded synchronously before rendering\n * - `'critters'`: theme CSS is inlined using Critters for SSR/SSG\n */\nexport type NgStrategy = 'blocking' | 'critters';\n\n/**\n * Library configuration.\n *\n * @typeParam T - Custom theme literals. Defaults to open `string`, preserving\n * backwards compatibility. Pass specific literals (e.g. `'sepia' | 'ocean'`)\n * via {@link provideThemeStack} to get a closed, type-safe theme union.\n */\nexport interface NgConfig<T extends string = string & {}> {\n /** The theme to use on first visit or when no preference is saved. Default: 'system'. */\n defaultTheme: NgTheme<T>;\n\n /** Key used to persist theme preference in localStorage. Default: 'ngx-theme-stack'. */\n storageKey: string;\n\n /** \n * How the theme should be applied to the document (via class, attribute or both). \n * Default: 'class'.\n */\n mode: NgMode;\n\n /** \n * Performance strategy for anti-flash.\n * Use 'critters' (default) to inline all theme CSS in <head> โ€” works for CSR, SSR, and SSG.\n * Use 'blocking' to load themes.css as a render-blocking stylesheet (HTTP-cacheable).\n */\n strategy: NgStrategy;\n\n /** List of supported theme identifiers. Default: ['light', 'dark', 'system']. */\n themes: NgTheme<T>[];\n}\n","import { InjectionToken } from '@angular/core';\nimport { NgxThemeStackError } from '../errors';\nimport { DEFAULT_THEMES, DefaultNgTheme, NgConfig } from '../types';\n\n/**\n * โš  ATTENTION: SHARED CONFIGURATION VALUES\n *\n * These defaults MUST match the schematic defaults in:\n * projects/ngx-theme-stack/schematics/ng-add/constants.ts โ†’ DEFAULTS\n *\n * Schematics compile to CommonJS and cannot import from this ESM file,\n * so the values are intentionally duplicated. Change both at the same time.\n *\n * If you change defaults here, also update:\n * schematics/ng-add/constants.ts โ†’ DEFAULTS + DEFAULT_THEMES\n */\n\nexport const DEFAULT_NG_CONFIG = {\n defaultTheme: 'system',\n storageKey: 'ngx-theme-stack',\n mode: 'class',\n strategy: 'critters',\n themes: [...DEFAULT_THEMES],\n} satisfies NgConfig;\n\n// The token uses NgConfig<string> because Angular DI resolves types at runtime\n// and cannot carry generic parameters. Type-safety is enforced at the\n// provideThemeStack() call site instead.\nexport const NGX_THEME_STACK_CONFIG = new InjectionToken<NgConfig<string>>(\n 'NGX_THEME_STACK_CONFIG',\n {\n factory: () => DEFAULT_NG_CONFIG,\n },\n);\n\n/**\n * Provides Theme Stack configuration to Angular's DI system.\n *\n * Custom `themes` are **merged** with the built-in defaults\n * (`'light'`, `'dark'`, `'system'`), so you never lose the base themes.\n *\n * **Defaults:**\n * - `themes`: `['light', 'dark', 'system']`\n * - `defaultTheme`: `'system'`\n * - `storageKey`: `'ngx-theme-stack'`\n * - `mode`: `'class'`\n * - `strategy`: `'critters'`\n\n *\n * The type parameter `T` is **inferred automatically** from the `themes` array\n * when passed as a `const` โ€” no need to specify it manually.\n *\n * @typeParam T - Custom theme string literals, inferred from the `themes` option.\n *\n * @param config - Optional partial configuration. Omitted fields fall back to\n * {@link DEFAULT_NG_CONFIG}.\n *\n * @throws {@link NgxThemeStackError}\n * - If any entry in `themes` is an empty or whitespace-only string.\n * - If `defaultTheme` is not present in the resolved (merged) themes array.\n * - If `storageKey` is an empty or whitespace-only string.\n *\n * @example\n * // Default โ€” uses built-in themes and sensible defaults\n * provideThemeStack()\n *\n * @example\n * // Critters strategy โ€” inlines all theme CSS in <head> (works for CSR, SSR, and SSG)\n * provideThemeStack({\n * strategy: 'critters',\n * mode: 'class',\n * })\n *\n * @example\n * // Closed union: TypeScript infers 'sepia' | 'ocean' from the array\n * provideThemeStack({\n * themes: ['sepia', 'ocean'] as const,\n * defaultTheme: 'sepia', // โœ… in resolved themes\n * // defaultTheme: 'nope', // โŒ throws NgxThemeStackError at runtime\n * })\n *\n * @example\n * // Custom storage key and mode\n * provideThemeStack({\n * storageKey: 'my-app-theme',\n * mode: 'attribute',\n * })\n */\nexport function provideThemeStack<const T extends string = DefaultNgTheme>(\n config: Partial<NgConfig<T>> = {},\n) {\n config.themes?.forEach((t) => {\n if (t.trim() === '') throw new NgxThemeStackError('Theme cannot be empty or whitespace.');\n });\n\n const themes = config.themes\n ? Array.from(new Set([...DEFAULT_NG_CONFIG.themes, ...config.themes]))\n : DEFAULT_NG_CONFIG.themes;\n\n if (config.defaultTheme && !(themes as string[]).includes(config.defaultTheme as string)) {\n throw new NgxThemeStackError(\n `\"defaultTheme\" must be one of the resolved themes: [${themes.join(', ')}].`,\n );\n }\n\n if (config.storageKey !== undefined && config.storageKey.trim() === '') {\n throw new NgxThemeStackError('\"storageKey\" cannot be empty or whitespace.');\n }\n\n return {\n provide: NGX_THEME_STACK_CONFIG,\n useValue: {\n ...DEFAULT_NG_CONFIG,\n ...config,\n themes,\n } as NgConfig<string>,\n };\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n computed,\n DestroyRef,\n DOCUMENT,\n effect,\n inject,\n Injectable,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { NGX_THEME_STACK_CONFIG } from '../config';\nimport { NgxThemeStackError } from '../errors';\nimport { NgSystemTheme, NgTheme } from '../types';\n\n/**\n * Core service for managing the application's color theme.\n *\n * Handles theme persistence, system preference detection, and DOM updates.\n * Supports built-in themes ('dark', 'light', 'system') and custom extensions.\n */\n@Injectable({ providedIn: 'root' })\nexport class CoreThemeService {\n // โ”€โ”€ Dependencies โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n readonly #config = inject(NGX_THEME_STACK_CONFIG);\n readonly #destroyRef = inject(DestroyRef);\n readonly #document = inject(DOCUMENT);\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n // โ”€โ”€ Theme configuration โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n /** The initial stored theme read from localStorage on startup. */\n readonly #initialStoredTheme = this.readStoredTheme();\n\n /** List of available themes for Select/Cycle services. Defaults to ['system', 'light', 'dark']. */\n readonly availableThemes = this.#config.themes;\n\n /** Internal Set for O(1) existence checks. */\n readonly #validThemes = new Set<NgTheme>(this.availableThemes);\n\n /**\n * The anti-flash class to remove from the host element.\n * Internal mechanism to bridge the gap between the blocking script's\n * initial DOM state and Angular's first effect run.\n */\n #antiFlashClass: string | null = null;\n\n // โ”€โ”€ System preference โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n /** MediaQueryList for OS color scheme, created once and reused. Null in SSR. */\n readonly #mediaQuery: MediaQueryList | null = this.#isBrowser\n ? (this.#document.defaultView?.matchMedia('(prefers-color-scheme: dark)') ?? null)\n : null;\n\n readonly #systemPreference = signal<NgSystemTheme>(this.resolveSystemPreference());\n\n // โ”€โ”€ Theme state โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n readonly #selectedTheme = signal<NgTheme>(this.resolveInitialTheme());\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#selectedTheme.asReadonly();\n\n /** Resolved theme applied to the DOM. Always `'dark'` or `'light'` (or custom) โ€” never `'system'`. */\n readonly resolvedTheme = computed(() => {\n const theme = this.#selectedTheme();\n return theme === 'system' ? this.#systemPreference() : theme;\n });\n\n /** Whether the currently applied theme is dark. */\n readonly isDark = computed(() => this.resolvedTheme() === 'dark');\n\n /** Whether the currently applied theme is light. */\n readonly isLight = computed(() => this.resolvedTheme() === 'light');\n\n /** Whether the currently applied theme is system. */\n readonly isSystem = computed(() => this.selectedTheme() === 'system');\n\n /**\n * Whether the service has completed client-side initialization.\n *\n * `false` during SSR and on the very first render pass before the initial theme\n * is resolved from `localStorage`. Becomes `true` immediately after the\n * first browser render pass.\n *\n * **Important:** Guard template elements that display `selectedTheme()` or\n * `resolvedTheme()` behind this signal to prevent hydration-mismatch flashes\n * (e.g. if the server renders the default 'system' but the user has 'dark' stored).\n *\n * @example\n * ```html\n * {{ theme.isHydrated() ? theme.selectedTheme() : '...' }}\n * ```\n */\n readonly isHydrated = signal(false);\n\n // โ”€โ”€ Event handler โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n readonly #onSystemPreferenceChange = () =>\n this.#systemPreference.set(this.resolveSystemPreference());\n\n // โ”€โ”€ Lifecycle โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n constructor() {\n this.captureAntiFlashClass();\n\n if (this.#isBrowser && this.#selectedTheme() === 'system') {\n this.startSystemThemeListener();\n }\n\n effect(() => this.applyThemeToDOM(this.resolvedTheme()));\n afterNextRender(() => this.isHydrated.set(true));\n this.#destroyRef.onDestroy(() => this.stopSystemThemeListener());\n }\n\n // โ”€โ”€ Public API โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n /**\n * Changes the active theme.\n *\n * Persists the choice explicitly so that switching e.g. from `'system'` to\n * `'light'` is saved even when the resolved theme did not change\n * (system preference was already `'light'`).\n *\n * @param theme - The theme to apply: `'dark'`, `'light'`, `'system'`, or a custom theme name.\n * @throws If `theme` is not a valid theme according to library configuration.\n */\n public setTheme(theme: NgTheme): void {\n if (!this.#validThemes.has(theme)) {\n throw new NgxThemeStackError(\n `Invalid theme: \"${theme}\". Valid values are: ${[...this.#validThemes].join(', ')}.`,\n );\n }\n if (!this.#isBrowser) return;\n if (theme === this.#selectedTheme()) return;\n if (theme === 'system') {\n this.#systemPreference.set(this.resolveSystemPreference());\n this.startSystemThemeListener();\n } else {\n this.stopSystemThemeListener();\n }\n\n this.#selectedTheme.set(theme);\n this.saveTheme(theme);\n }\n\n // โ”€โ”€ Private โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n private resolveSystemPreference(): NgSystemTheme {\n return this.#mediaQuery?.matches ? 'dark' : 'light';\n }\n\n private resolveInitialTheme(): NgTheme {\n const theme = this.#initialStoredTheme;\n if (theme && this.#validThemes.has(theme as NgTheme)) {\n return theme as NgTheme;\n }\n return this.#config.defaultTheme;\n }\n\n private startSystemThemeListener(): void {\n if (!this.#mediaQuery) return;\n this.stopSystemThemeListener();\n this.#mediaQuery.addEventListener('change', this.#onSystemPreferenceChange);\n }\n\n private stopSystemThemeListener(): void {\n this.#mediaQuery?.removeEventListener('change', this.#onSystemPreferenceChange);\n }\n\n private applyThemeToDOM(theme: NgTheme): void {\n if (!this.#isBrowser) return;\n\n const host = this.#document.documentElement;\n\n if (this.#antiFlashClass) {\n host.classList.remove(this.#antiFlashClass);\n this.#antiFlashClass = null;\n }\n\n const { mode } = this.#config;\n\n if (mode === 'attribute' || mode === 'both') {\n this.applyThemeAttribute(host, theme);\n }\n\n if (mode === 'class' || mode === 'both') {\n this.applyThemeClasses(host, theme);\n }\n\n this.applyColorSchemeHint(host, theme);\n }\n\n private applyThemeAttribute(host: HTMLElement, theme: NgTheme): void {\n host.setAttribute('data-theme', theme);\n }\n\n private applyThemeClasses(host: HTMLElement, theme: NgTheme): void {\n host.classList.remove(...this.availableThemes);\n host.classList.add(theme);\n }\n\n private applyColorSchemeHint(host: HTMLElement, theme: NgTheme): void {\n if (theme === 'dark' || theme === 'light') {\n host.style.setProperty('color-scheme', theme);\n return;\n }\n\n host.style.removeProperty('color-scheme');\n }\n\n private captureAntiFlashClass(): void {\n if (!this.#isBrowser || !this.#initialStoredTheme) return;\n\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(this.#initialStoredTheme)) {\n this.#antiFlashClass = null;\n return;\n }\n\n if (this.#initialStoredTheme === 'system') {\n this.#antiFlashClass = this.resolveSystemPreference();\n return;\n }\n\n this.#antiFlashClass = this.#initialStoredTheme;\n }\n\n private readStoredTheme(): string | null {\n if (!this.#isBrowser) return null;\n\n try {\n return localStorage.getItem(this.#config.storageKey);\n } catch (e) {\n console.warn('[ngx-theme-stack] Could not read theme from localStorage.', e);\n return null;\n }\n }\n\n private saveTheme(theme: NgTheme): void {\n if (!this.#isBrowser) return;\n\n try {\n localStorage.setItem(this.#config.storageKey, theme);\n } catch (e) {\n console.warn('[ngx-theme-stack] Could not save theme to localStorage.', e);\n }\n }\n}\n","import { computed, inject, Injectable } from '@angular/core';\nimport { CoreThemeService } from '../core/core-theme.service';\n\n/**\n * Convenience service for cycling through themes in a fixed order.\n *\n * Default cycle: `'system'` โ†’ `'light'` โ†’ `'dark'` โ†’ `'system'` โ†’ ...\n *\n * Use this when you want to offer users a single button that rotates\n * through all available theme options.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeCycleService {\n readonly #core = inject(CoreThemeService);\n\n /** List of all configured themes for cycling. Defaults to `['light', 'dark', 'system']`. */\n readonly availableThemes = this.#core.availableThemes;\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#core.selectedTheme;\n\n /** Resolved theme currently applied to the DOM. Always concrete โ€” never `'system'`. */\n readonly resolvedTheme = this.#core.resolvedTheme;\n\n /** Index of the currently selected theme in the cycle. */\n readonly cycleIndex = computed(() => {\n return this.availableThemes.indexOf(this.selectedTheme());\n });\n\n /** The theme that comes before the currently selected theme in the cycle. */\n readonly preceding = computed(() => {\n const index = this.cycleIndex();\n const len = this.availableThemes.length;\n return this.availableThemes[(index - 1 + len) % len];\n });\n\n /** The theme that comes after the currently selected theme in the cycle. */\n readonly upcoming = computed(() => {\n const index = this.cycleIndex();\n return this.availableThemes[(index + 1) % this.availableThemes.length];\n });\n\n /** Whether the currently applied theme is `'dark'`. */\n readonly isDark = this.#core.isDark;\n\n /** Whether the currently applied theme is `'light'`. */\n readonly isLight = this.#core.isLight;\n\n /** Whether the user has explicitly selected `'system'` preference. */\n readonly isSystem = this.#core.isSystem;\n\n /**\n * Whether the service has completed client-side initialization and\n * resolved the real persisted theme. Use to prevent hydration flashes.\n */\n readonly isHydrated = this.#core.isHydrated.asReadonly();\n\n /**\n * Advances to the next theme in the cycle.\n *\n * Cycle order is determined by the configured `themes` property in `NgConfig`.\n *\n * If the current theme is not found in the cycle (e.g. set externally),\n * the cycle restarts from the first theme.\n */\n cycle(): void {\n this.#core.setTheme(this.upcoming());\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { CoreThemeService } from '../core/core-theme.service';\nimport { NgTheme } from '../types';\n\n/**\n * Convenience service for selecting a theme from a list.\n *\n * Use this when you want to bind a `<select>` or a group of radio/tab\n * buttons to the full set of available themes.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeSelectService {\n readonly #core = inject(CoreThemeService);\n\n /** List of all configured themes. Defaults to `['light', 'dark', 'system']`. */\n readonly availableThemes = this.#core.availableThemes;\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#core.selectedTheme;\n\n /** Resolved theme currently applied to the DOM. Always concrete โ€” never `'system'`. */\n readonly resolvedTheme = this.#core.resolvedTheme;\n\n /** Whether the currently applied theme is `'dark'`. */\n readonly isDark = this.#core.isDark;\n\n /** Whether the currently applied theme is `'light'`. */\n readonly isLight = this.#core.isLight;\n\n /** Whether the user has explicitly selected `'system'` preference. */\n readonly isSystem = this.#core.isSystem;\n\n /**\n * Whether the service has completed client-side initialization and\n * resolved the real persisted theme. Use to prevent hydration flashes.\n */\n readonly isHydrated = this.#core.isHydrated.asReadonly();\n\n /**\n * Applies the given theme.\n *\n * @param theme - The theme to apply: `'dark'`, `'light'`, `'system'`, or custom.\n * @throws If `theme` is not a valid theme according to library configuration.\n */\n select(theme: NgTheme): void {\n this.#core.setTheme(theme);\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { CoreThemeService } from '../core/core-theme.service';\n\n/**\n * Convenience service for toggling between `'dark'` and `'light'`.\n *\n * Use this when you only need a simple on/off switch and do not\n * need to manage `'system'` or cycle through themes.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeToggleService {\n readonly #core = inject(CoreThemeService);\n\n /** Resolved theme currently applied to the DOM. Always concrete โ€” never `'system'`. */\n readonly resolvedTheme = this.#core.resolvedTheme;\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#core.selectedTheme;\n\n /** Whether the currently applied theme is `'dark'`. */\n readonly isDark = this.#core.isDark;\n\n /** Whether the currently applied theme is `'light'`. */\n readonly isLight = this.#core.isLight;\n\n /** Whether the user has explicitly selected `'system'` preference. */\n readonly isSystem = this.#core.isSystem;\n\n /**\n * Whether the service has completed client-side initialization and\n * resolved the real persisted theme. Use to prevent hydration flashes.\n */\n readonly isHydrated = this.#core.isHydrated.asReadonly();\n\n /**\n * Toggles between `'dark'` and `'light'`.\n *\n * If the selected theme is explicitly `'dark'`, switches to `'light'`.\n * Otherwise (including `'system'`), switches to `'dark'`.\n */\n toggle(): void {\n const next = this.#core.resolvedTheme() === 'dark' ? 'light' : 'dark';\n this.#core.setTheme(next);\n }\n}\n","/*\n * Public API Surface of ngx-theme-stack\n */\n\nexport * from './lib/core/core-theme.service';\nexport * from './lib/config';\nexport * from './lib/services/theme-cycle.service';\nexport * from './lib/services/theme-select.service';\nexport * from './lib/services/theme-toggle.service';\nexport * from './lib/types';\nexport * from './lib/errors';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAeG;AACG,MAAO,kBAAmB,SAAQ,KAAK,CAAA;IACzB,IAAI,GAAG,oBAAoB;AAE7C,IAAA,WAAA,CAAY,OAAe,EAAA;AACzB,QAAA,KAAK,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAA,CAAE,CAAC;;QAErC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;IACnD;AACD;;ACxBD;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM;;ACTxD;;;;;;;;;;;AAWG;AAEI,MAAM,iBAAiB,GAAG;AAC/B,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,UAAU,EAAE,iBAAiB;AAC7B,IAAA,IAAI,EAAE,OAAO;AACb,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,MAAM,EAAE,CAAC,GAAG,cAAc,CAAC;;AAG7B;AACA;AACA;MACa,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB,EACxB;AACE,IAAA,OAAO,EAAE,MAAM,iBAAiB;AACjC,CAAA;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDG;AACG,SAAU,iBAAiB,CAC/B,MAAA,GAA+B,EAAE,EAAA;IAEjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAI;AAC3B,QAAA,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;AAAE,YAAA,MAAM,IAAI,kBAAkB,CAAC,sCAAsC,C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AAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,MAAM;AACrE,QAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3B;uGAjCW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cADL,MAAM,EAAA,CAAA;;2FACnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACTlC;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"ngx-theme-stack.mjs","sources":["../../../projects/ngx-theme-stack/src/lib/errors.ts","../../../projects/ngx-theme-stack/src/lib/types.ts","../../../projects/ngx-theme-stack/src/lib/config/index.ts","../../../projects/ngx-theme-stack/src/lib/core/core-theme.service.ts","../../../projects/ngx-theme-stack/src/lib/services/theme-cycle.service.ts","../../../projects/ngx-theme-stack/src/lib/services/theme-select.service.ts","../../../projects/ngx-theme-stack/src/lib/services/theme-toggle.service.ts","../../../projects/ngx-theme-stack/src/public-api.ts","../../../projects/ngx-theme-stack/src/ngx-theme-stack.ts"],"sourcesContent":["/**\n * Base error class for `ngx-theme-stack`.\n *\n * Thrown when the library configuration is invalid.\n * Consumers can use `instanceof NgxThemeStackError` to catch only\n * errors originating from this library.\n *\n * @example\n * try {\n * bootstrapApplication(AppComponent, appConfig);\n * } catch (e) {\n * if (e instanceof NgxThemeStackError) {\n * console.error('Bad ngx-theme-stack config:', e.message);\n * }\n * }\n */\nexport class NgxThemeStackError extends Error {\n override readonly name = 'NgxThemeStackError';\n\n constructor(message: string) {\n super(`[ngx-theme-stack] ${message}`);\n // Restore prototype chain (required when targeting ES5 or older)\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","/**\n * Runtime list of built-in themes.\n *\n * Lives here (and not in config/index.ts) because it defines a type:\n * config/index.ts already imports from types.ts, so placing DEFAULT_THEMES\n * here avoids any circular dependency.\n *\n * โš  KEEP IN SYNC with the duplicate in:\n * projects/ngx-theme-stack/schematics/ng-add/constants.ts โ†’ DEFAULT_THEMES\n *\n * Schematics compile to CommonJS and cannot import from this ESM file,\n * so the values are intentionally duplicated. Change both at the same time.\n */\nexport const DEFAULT_THEMES = ['system', 'light', 'dark'] as const;\n\n/** Literal union of built-in themes: `'system' | 'light' | 'dark'`. */\nexport type DefaultNgTheme = (typeof DEFAULT_THEMES)[number];\n\n/**\n * Theme type.\n *\n * - **Without** `T`: open union โ€” accepts any `string` with IDE autocomplete\n * hints for the built-in themes (`'system' | 'light' | 'dark'`).\n * - **With** `T`: closed union โ€” exactly `DefaultNgTheme | T`, enabling\n * full type-safety for custom theme sets.\n *\n * @example\n * NgTheme // 'system' | 'light' | 'dark' | (string & {})\n * NgTheme<'sepia'> // 'system' | 'light' | 'dark' | 'sepia'\n */\nexport type NgTheme<T extends string = string & {}> = DefaultNgTheme | T;\n\n/**\n * Resolved theme โ€” always `'light'` or `'dark'`, never `'system'`.\n * Represents the value that comes from `matchMedia`, not user selection.\n */\nexport type NgSystemTheme = Exclude<DefaultNgTheme, 'system'>;\n\n/**\n * Theme application mode.\n * - `'attribute'`: sets `data-theme` attribute on `<html>`\n * - `'class'`: adds theme class to `<html>`\n * - `'both'`: uses both attribute and class\n */\nexport type NgMode = 'attribute' | 'class' | 'both';\n\n/**\n * Theme application strategy.\n * - `'blocking'`: theme CSS is loaded synchronously before rendering\n * - `'critters'`: theme CSS is inlined using Critters for SSR/SSG\n */\nexport type NgStrategy = 'blocking' | 'critters';\n\n/**\n * Library configuration.\n *\n * @typeParam T - Custom theme literals. Defaults to open `string`, preserving\n * backwards compatibility. Pass specific literals (e.g. `'sepia' | 'ocean'`)\n * via {@link provideThemeStack} to get a closed, type-safe theme union.\n */\nexport interface NgConfig<T extends string = string & {}> {\n /** The theme to use on first visit or when no preference is saved. Default: 'system'. */\n defaultTheme: NgTheme<T>;\n\n /** Key used to persist theme preference in localStorage. Default: 'ngx-theme-stack'. */\n storageKey: string;\n\n /** \n * How the theme should be applied to the document (via class, attribute or both). \n * Default: 'class'.\n */\n mode: NgMode;\n\n /** \n * Performance strategy for anti-flash.\n * Use 'critters' (default) to inline all theme CSS in <head> โ€” works for CSR, SSR, and SSG.\n * Use 'blocking' to load themes.css as a render-blocking stylesheet (HTTP-cacheable).\n */\n strategy: NgStrategy;\n\n /**\n * The **resolved** list of supported theme identifiers, always including the\n * built-in themes (`'light'`, `'dark'`, `'system'`).\n *\n * When you pass custom themes to {@link provideThemeStack}, they are **merged**\n * with the built-in defaults โ€” your custom values are appended after them.\n *\n * @example\n * // Input to provideThemeStack:\n * themes: ['sepia', 'ocean'] as const\n *\n * // Resolved value stored in NgConfig:\n * // ['system', 'light', 'dark', 'sepia', 'ocean']\n *\n * Default (no custom themes): `['system', 'light', 'dark']`.\n */\n themes: NgTheme<T>[];\n}\n","import { InjectionToken } from '@angular/core';\nimport { NgxThemeStackError } from '../errors';\nimport { DEFAULT_THEMES, DefaultNgTheme, NgConfig } from '../types';\n\n/**\n * โš  ATTENTION: SHARED CONFIGURATION VALUES\n *\n * These defaults MUST match the schematic defaults in:\n * projects/ngx-theme-stack/schematics/ng-add/constants.ts โ†’ DEFAULTS\n *\n * Schematics compile to CommonJS and cannot import from this ESM file,\n * so the values are intentionally duplicated. Change both at the same time.\n *\n * If you change defaults here, also update:\n * schematics/ng-add/constants.ts โ†’ DEFAULTS + DEFAULT_THEMES\n */\n\nexport const DEFAULT_NG_CONFIG = {\n defaultTheme: 'system',\n storageKey: 'ngx-theme-stack',\n mode: 'class',\n strategy: 'critters',\n themes: [...DEFAULT_THEMES],\n} satisfies NgConfig;\n\n// The token uses NgConfig<string> because Angular DI resolves types at runtime\n// and cannot carry generic parameters. Type-safety is enforced at the\n// provideThemeStack() call site instead.\nexport const NGX_THEME_STACK_CONFIG = new InjectionToken<NgConfig<string>>(\n 'NGX_THEME_STACK_CONFIG',\n {\n factory: () => DEFAULT_NG_CONFIG,\n },\n);\n\n/**\n * Provides Theme Stack configuration to Angular's DI system.\n *\n * The `themes` option accepts **additional** theme identifiers beyond the\n * built-in defaults. They are merged with `'light'`, `'dark'`, and `'system'`\n * so that the resolved {@link NgConfig.themes} array always includes all of\n * them โ€” your custom values are appended after the built-ins.\n *\n * **Defaults:**\n * - `themes`: `['light', 'dark', 'system']`\n * - `defaultTheme`: `'system'`\n * - `storageKey`: `'ngx-theme-stack'`\n * - `mode`: `'class'`\n * - `strategy`: `'critters'`\n\n *\n * The type parameter `T` is **inferred automatically** from the `themes` array\n * when passed as a `const` โ€” no need to specify it manually.\n *\n * @typeParam T - Custom theme string literals, inferred from the `themes` option.\n *\n * @param config - Optional partial configuration. Omitted fields fall back to\n * {@link DEFAULT_NG_CONFIG}.\n *\n * @throws {@link NgxThemeStackError}\n * - If any entry in `themes` is an empty or whitespace-only string.\n * - If `defaultTheme` is not present in the resolved (merged) themes array.\n * - If `storageKey` is an empty or whitespace-only string.\n *\n * @example\n * // Default โ€” uses built-in themes and sensible defaults\n * provideThemeStack()\n *\n * @example\n * // Critters strategy โ€” inlines all theme CSS in <head> (works for CSR, SSR, and SSG)\n * provideThemeStack({\n * strategy: 'critters',\n * mode: 'class',\n * })\n *\n * @example\n * // Closed union: TypeScript infers 'sepia' | 'ocean' from the array\n * provideThemeStack({\n * themes: ['sepia', 'ocean'] as const,\n * defaultTheme: 'sepia', // โœ… in resolved themes\n * // defaultTheme: 'nope', // โŒ throws NgxThemeStackError at runtime\n * })\n *\n * @example\n * // Custom storage key and mode\n * provideThemeStack({\n * storageKey: 'my-app-theme',\n * mode: 'attribute',\n * })\n */\nexport function provideThemeStack<const T extends string = DefaultNgTheme>(\n config: Partial<NgConfig<T>> = {},\n) {\n config.themes?.forEach((t) => {\n if (t.trim() === '') throw new NgxThemeStackError('Theme cannot be empty or whitespace.');\n });\n\n const themes = config.themes\n ? Array.from(new Set([...DEFAULT_NG_CONFIG.themes, ...config.themes]))\n : DEFAULT_NG_CONFIG.themes;\n\n if (config.defaultTheme && !(themes as string[]).includes(config.defaultTheme as string)) {\n throw new NgxThemeStackError(\n `\"defaultTheme\" must be one of the resolved themes: [${themes.join(', ')}].`,\n );\n }\n\n if (config.storageKey !== undefined && config.storageKey.trim() === '') {\n throw new NgxThemeStackError('\"storageKey\" cannot be empty or whitespace.');\n }\n\n return {\n provide: NGX_THEME_STACK_CONFIG,\n useValue: {\n ...DEFAULT_NG_CONFIG,\n ...config,\n themes,\n } as NgConfig<string>,\n };\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n computed,\n DestroyRef,\n DOCUMENT,\n effect,\n inject,\n Injectable,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { NGX_THEME_STACK_CONFIG } from '../config';\nimport { NgxThemeStackError } from '../errors';\nimport { NgSystemTheme, NgTheme } from '../types';\n\n/**\n * Core service for managing the application's color theme.\n *\n * Handles theme persistence, system preference detection, and DOM updates.\n * Supports built-in themes ('dark', 'light', 'system') and custom extensions.\n */\n@Injectable({ providedIn: 'root' })\nexport class CoreThemeService {\n // โ”€โ”€ Dependencies โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n readonly #config = inject(NGX_THEME_STACK_CONFIG);\n readonly #destroyRef = inject(DestroyRef);\n readonly #document = inject(DOCUMENT);\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n // โ”€โ”€ Theme configuration โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n /** The initial stored theme read from localStorage on startup. */\n readonly #initialStoredTheme = this.readStoredTheme();\n\n /** List of available themes for Select/Cycle services. Defaults to ['system', 'light', 'dark']. */\n readonly availableThemes = this.#config.themes;\n\n /** Internal Set for O(1) existence checks. */\n readonly #validThemes = new Set<NgTheme>(this.availableThemes);\n\n /**\n * The anti-flash class to remove from the host element.\n * Internal mechanism to bridge the gap between the blocking script's\n * initial DOM state and Angular's first effect run.\n */\n #antiFlashClass: string | null = null;\n\n // โ”€โ”€ System preference โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n /** MediaQueryList for OS color scheme, created once and reused. Null in SSR. */\n readonly #mediaQuery: MediaQueryList | null = this.#isBrowser\n ? (this.#document.defaultView?.matchMedia('(prefers-color-scheme: dark)') ?? null)\n : null;\n\n readonly #systemPreference = signal<NgSystemTheme>(this.resolveSystemPreference());\n\n // โ”€โ”€ Theme state โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n readonly #selectedTheme = signal<NgTheme>(this.resolveInitialTheme());\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#selectedTheme.asReadonly();\n\n /** Resolved theme applied to the DOM. Always `'dark'` or `'light'` (or custom) โ€” never `'system'`. */\n readonly resolvedTheme = computed(() => {\n const theme = this.#selectedTheme();\n return theme === 'system' ? this.#systemPreference() : theme;\n });\n\n /**\n * Whether the currently applied theme is dark.\n *\n * Returns `false` when a custom theme (e.g. `'sunset'`) is active โ€” use\n * `resolvedTheme()` directly if you need to inspect the current custom theme.\n */\n readonly isDark = computed(() => this.resolvedTheme() === 'dark');\n\n /**\n * Whether the currently applied theme is light.\n *\n * Returns `false` when a custom theme (e.g. `'sepia'`) is active โ€” use\n * `resolvedTheme()` directly if you need to inspect the current custom theme.\n */\n readonly isLight = computed(() => this.resolvedTheme() === 'light');\n\n /** Whether the currently applied theme is system. */\n readonly isSystem = computed(() => this.selectedTheme() === 'system');\n\n /**\n * Whether the service has completed client-side initialization.\n *\n * `false` during SSR and on the very first render pass before the initial theme\n * is resolved from `localStorage`. Becomes `true` immediately after the\n * first browser render pass.\n *\n * **Important:** Guard template elements that display `selectedTheme()` or\n * `resolvedTheme()` behind this signal to prevent hydration-mismatch flashes\n * (e.g. if the server renders the default 'system' but the user has 'dark' stored).\n *\n * @example\n * ```html\n * {{ theme.isHydrated() ? theme.selectedTheme() : '...' }}\n * ```\n */\n readonly isHydrated = signal(false);\n\n // โ”€โ”€ Event handler โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n readonly #onSystemPreferenceChange = () =>\n this.#systemPreference.set(this.resolveSystemPreference());\n\n // โ”€โ”€ Lifecycle โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n constructor() {\n this.captureAntiFlashClass();\n\n if (this.#isBrowser && this.#selectedTheme() === 'system') {\n this.startSystemThemeListener();\n }\n\n effect(() => this.applyThemeToDOM(this.resolvedTheme()));\n afterNextRender(() => this.isHydrated.set(true));\n this.#destroyRef.onDestroy(() => this.stopSystemThemeListener());\n }\n\n // โ”€โ”€ Public API โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n /**\n * Changes the active theme.\n *\n * Persists the choice explicitly so that switching e.g. from `'system'` to\n * `'light'` is saved even when the resolved theme did not change\n * (system preference was already `'light'`).\n *\n * @param theme - The theme to apply: `'dark'`, `'light'`, `'system'`, or a custom theme name.\n * @throws If `theme` is not a valid theme according to library configuration.\n */\n public setTheme(theme: NgTheme): void {\n if (!this.#validThemes.has(theme)) {\n throw new NgxThemeStackError(\n `Invalid theme: \"${theme}\". Valid values are: ${[...this.#validThemes].join(', ')}.`,\n );\n }\n if (!this.#isBrowser) return;\n if (theme === this.#selectedTheme()) return;\n if (theme === 'system') {\n this.#systemPreference.set(this.resolveSystemPreference());\n this.startSystemThemeListener();\n } else {\n this.stopSystemThemeListener();\n }\n\n this.#selectedTheme.set(theme);\n this.saveTheme(theme);\n }\n\n // โ”€โ”€ Private โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n\n private resolveSystemPreference(): NgSystemTheme {\n return this.#mediaQuery?.matches ? 'dark' : 'light';\n }\n\n private resolveInitialTheme(): NgTheme {\n const theme = this.#initialStoredTheme;\n if (theme && this.#validThemes.has(theme as NgTheme)) {\n return theme as NgTheme;\n }\n return this.#config.defaultTheme;\n }\n\n private startSystemThemeListener(): void {\n if (!this.#mediaQuery) return;\n this.stopSystemThemeListener();\n this.#mediaQuery.addEventListener('change', this.#onSystemPreferenceChange);\n }\n\n private stopSystemThemeListener(): void {\n this.#mediaQuery?.removeEventListener('change', this.#onSystemPreferenceChange);\n }\n\n private applyThemeToDOM(theme: NgTheme): void {\n if (!this.#isBrowser) return;\n\n const host = this.#document.documentElement;\n\n if (this.#antiFlashClass) {\n host.classList.remove(this.#antiFlashClass);\n this.#antiFlashClass = null;\n }\n\n const { mode } = this.#config;\n\n if (mode === 'attribute' || mode === 'both') {\n this.applyThemeAttribute(host, theme);\n }\n\n if (mode === 'class' || mode === 'both') {\n this.applyThemeClasses(host, theme);\n }\n\n this.applyColorSchemeHint(host, theme);\n }\n\n private applyThemeAttribute(host: HTMLElement, theme: NgTheme): void {\n host.setAttribute('data-theme', theme);\n }\n\n private applyThemeClasses(host: HTMLElement, theme: NgTheme): void {\n host.classList.remove(...this.availableThemes);\n host.classList.add(theme);\n }\n\n private applyColorSchemeHint(host: HTMLElement, theme: NgTheme): void {\n if (theme === 'dark' || theme === 'light') {\n host.style.setProperty('color-scheme', theme);\n return;\n }\n\n host.style.removeProperty('color-scheme');\n }\n\n private captureAntiFlashClass(): void {\n if (!this.#isBrowser || !this.#initialStoredTheme) return;\n\n if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(this.#initialStoredTheme)) {\n this.#antiFlashClass = null;\n return;\n }\n\n if (this.#initialStoredTheme === 'system') {\n this.#antiFlashClass = this.resolveSystemPreference();\n return;\n }\n\n this.#antiFlashClass = this.#initialStoredTheme;\n }\n\n private readStoredTheme(): string | null {\n if (!this.#isBrowser) return null;\n\n try {\n return localStorage.getItem(this.#config.storageKey);\n } catch (e) {\n console.warn('[ngx-theme-stack] Could not read theme from localStorage.', e);\n return null;\n }\n }\n\n private saveTheme(theme: NgTheme): void {\n if (!this.#isBrowser) return;\n\n try {\n localStorage.setItem(this.#config.storageKey, theme);\n } catch (e) {\n console.warn('[ngx-theme-stack] Could not save theme to localStorage.', e);\n }\n }\n}\n","import { computed, inject, Injectable } from '@angular/core';\nimport { CoreThemeService } from '../core/core-theme.service';\n\n/**\n * Convenience service for cycling through themes in a fixed order.\n *\n * Default cycle: `'system'` โ†’ `'light'` โ†’ `'dark'` โ†’ `'system'` โ†’ ...\n *\n * Use this when you want to offer users a single button that rotates\n * through all available theme options.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeCycleService {\n readonly #core = inject(CoreThemeService);\n\n /** List of all configured themes for cycling. Defaults to `['light', 'dark', 'system']`. */\n readonly availableThemes = this.#core.availableThemes;\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#core.selectedTheme;\n\n /** Resolved theme currently applied to the DOM. Always concrete โ€” never `'system'`. */\n readonly resolvedTheme = this.#core.resolvedTheme;\n\n /** Index of the currently selected theme in the cycle. */\n readonly cycleIndex = computed(() => {\n return this.availableThemes.indexOf(this.selectedTheme());\n });\n\n /** The theme that comes before the currently selected theme in the cycle. */\n readonly preceding = computed(() => {\n const index = this.cycleIndex();\n const len = this.availableThemes.length;\n return this.availableThemes[(index - 1 + len) % len];\n });\n\n /** The theme that comes after the currently selected theme in the cycle. */\n readonly upcoming = computed(() => {\n const index = this.cycleIndex();\n return this.availableThemes[(index + 1) % this.availableThemes.length];\n });\n\n /** Whether the currently applied theme is `'dark'`. */\n readonly isDark = this.#core.isDark;\n\n /** Whether the currently applied theme is `'light'`. */\n readonly isLight = this.#core.isLight;\n\n /** Whether the user has explicitly selected `'system'` preference. */\n readonly isSystem = this.#core.isSystem;\n\n /**\n * Whether the service has completed client-side initialization and\n * resolved the real persisted theme. Use to prevent hydration flashes.\n */\n readonly isHydrated = this.#core.isHydrated.asReadonly();\n\n /**\n * Advances to the next theme in the cycle.\n *\n * Cycle order is determined by the configured `themes` property in `NgConfig`.\n *\n * If the current theme is not found in the cycle (e.g. set externally),\n * the cycle restarts from the first theme.\n */\n cycle(): void {\n this.#core.setTheme(this.upcoming());\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { CoreThemeService } from '../core/core-theme.service';\nimport { NgTheme } from '../types';\n\n/**\n * Convenience service for selecting a theme from a list.\n *\n * Use this when you want to bind a `<select>` or a group of radio/tab\n * buttons to the full set of available themes.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeSelectService {\n readonly #core = inject(CoreThemeService);\n\n /** List of all configured themes. Defaults to `['light', 'dark', 'system']`. */\n readonly availableThemes = this.#core.availableThemes;\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#core.selectedTheme;\n\n /** Resolved theme currently applied to the DOM. Always concrete โ€” never `'system'`. */\n readonly resolvedTheme = this.#core.resolvedTheme;\n\n /** Whether the currently applied theme is `'dark'`. */\n readonly isDark = this.#core.isDark;\n\n /** Whether the currently applied theme is `'light'`. */\n readonly isLight = this.#core.isLight;\n\n /** Whether the user has explicitly selected `'system'` preference. */\n readonly isSystem = this.#core.isSystem;\n\n /**\n * Whether the service has completed client-side initialization and\n * resolved the real persisted theme. Use to prevent hydration flashes.\n */\n readonly isHydrated = this.#core.isHydrated.asReadonly();\n\n /**\n * Applies the given theme.\n *\n * @param theme - The theme to apply: `'dark'`, `'light'`, `'system'`, or custom.\n * @throws If `theme` is not a valid theme according to library configuration.\n */\n select(theme: NgTheme): void {\n this.#core.setTheme(theme);\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { CoreThemeService } from '../core/core-theme.service';\n\n/**\n * Convenience service for toggling between `'dark'` and `'light'`.\n *\n * Use this when you only need a simple on/off switch and do not\n * need to manage `'system'` or cycle through themes.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeToggleService {\n readonly #core = inject(CoreThemeService);\n\n /** Resolved theme currently applied to the DOM. Always concrete โ€” never `'system'`. */\n readonly resolvedTheme = this.#core.resolvedTheme;\n\n /** The theme explicitly selected by the user. May be `'system'`. */\n readonly selectedTheme = this.#core.selectedTheme;\n\n /** Whether the currently applied theme is `'dark'`. */\n readonly isDark = this.#core.isDark;\n\n /** Whether the currently applied theme is `'light'`. */\n readonly isLight = this.#core.isLight;\n\n /** Whether the user has explicitly selected `'system'` preference. */\n readonly isSystem = this.#core.isSystem;\n\n /**\n * Whether the service has completed client-side initialization and\n * resolved the real persisted theme. Use to prevent hydration flashes.\n */\n readonly isHydrated = this.#core.isHydrated.asReadonly();\n\n /**\n * Toggles between `'dark'` and `'light'`.\n *\n * If the selected theme is explicitly `'dark'`, switches to `'light'`.\n * Otherwise (including `'system'`), switches to `'dark'`.\n */\n toggle(): void {\n const next = this.#core.resolvedTheme() === 'dark' ? 'light' : 'dark';\n this.#core.setTheme(next);\n }\n}\n","/*\n * Public API Surface of ngx-theme-stack\n */\n\nexport * from './lib/core/core-theme.service';\nexport * from './lib/config';\nexport * from './lib/services/theme-cycle.service';\nexport * from './lib/services/theme-select.service';\nexport * from './lib/services/theme-toggle.service';\nexport * from './lib/types';\nexport * from './lib/errors';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;AAeG;AACG,MAAO,kBAAmB,SAAQ,KAAK,CAAA;IACzB,IAAI,GAAG,oBAAoB;AAE7C,IAAA,WAAA,CAAY,OAAe,EAAA;AACzB,QAAA,KAAK,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAA,CAAE,CAAC;;QAErC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;IACnD;AACD;;ACxBD;;;;;;;;;;;;AAYG;AACI,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM;;ACTxD;;;;;;;;;;;AAWG;AAEI,MAAM,iBAAiB,GAAG;AAC/B,IAAA,YAAY,EAAE,QAAQ;AACtB,IAAA,UAAU,EAAE,iBAAiB;AAC7B,IAAA,IAAI,EAAE,OAAO;AACb,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,MAAM,EAAE,CAAC,GAAG,cAAc,CAAC;;AAG7B;AACA;AACA;MACa,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB,EACxB;AACE,IAAA,OAAO,EAAE,MAAM,iBAAiB;AACjC,CAAA;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDG;AACG,SAAU,iBAAiB,CAC/B,MAAA,GAA+B,EAAE,EAAA;IAEjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAI;AAC3B,QAAA,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;AAAE,YAAA,MAAM,IAAI,kBAAkB,CAAC,sCAAsC,CAAC;AAC3F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AAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,GAAG,OAAO,GAAG,MAAM;AACrE,QAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3B;uGAjCW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cADL,MAAM,EAAA,CAAA;;2FACnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACTlC;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-theme-stack",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "A stack of themes for Angular applications.",
5
5
  "keywords": [
6
6
  "angular",
@@ -37,9 +37,14 @@ const OPTION_DEFAULT_THEME_RE = /defaultTheme\s*:\s*['"]([^'"]+)['"]/;
37
37
  const OPTION_STRATEGY_RE = /strategy\s*:\s*['"]([^'"]+)['"]/;
38
38
  /**
39
39
  * Extracts the themes array from the options string.
40
- * Matches: themes: ['light', 'dark', 'sunset']
40
+ * Supports both single-line and multiline array declarations:
41
+ * themes: ['light', 'dark', 'sunset']
42
+ * themes: [
43
+ * 'light',
44
+ * 'dark',
45
+ * ] as const
41
46
  */
42
- const OPTION_THEMES_RE = /themes\s*:\s*\[([^\]]*)\]/;
47
+ const OPTION_THEMES_RE = /themes\s*:\s*\[([\s\S]*?)\]/;
43
48
  /** Matches the complete <script> anti-flash block (identified by its marker comment). */
44
49
  const SCRIPT_BLOCK_RE = /<!--\s*ngx-theme-stack\s*anti-flash\s*-->\s*<script[^>]*>[\s\S]*?<\/script>/;
45
50
  /** Marker injected by ng-add that delimits the Critters Trick zone in <body>. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngx-theme-stack/schematics/sync/index.ts"],"names":[],"mappings":";;;;;;;;;;;AA4NA,oBA8HC;AAzVD,qDAAsD;AACtD,2CAAmD;AACnD,mDAA+C;AAG/C,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GAAG,oCAAoC,CAAC;AAE7D,8DAA8D;AAC9D,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD,oEAAoE;AACpE,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAE1D,sEAAsE;AACtE,MAAM,uBAAuB,GAAG,qCAAqC,CAAC;AACtE,kEAAkE;AAClE,MAAM,kBAAkB,GAAG,iCAAiC,CAAC;AAE7D;;;GAGG;AACH,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAErD,yFAAyF;AACzF,MAAM,eAAe,GAAG,6EAA6E,CAAC;AAEtG,iFAAiF;AACjF,MAAM,eAAe,GAAG,yCAAyC,CAAC;AAElE,0EAA0E;AAC1E,MAAM,iBAAiB,GACrB,0FAA0F,CAAC;AAY7F,iFAAiF;AAEjF;;;;;GAKG;AACH,SAAS,aAAa,CACpB,IAAU,EACV,UAAkB,EAClB,OAAyB;;IAEzB,MAAM,UAAU,GAAG;QACjB,GAAG,UAAU,oBAAoB;QACjC,GAAG,UAAU,UAAU;KACxB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,CAA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D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAA,CAAC;AACJ,CAAC"}
@@ -72,7 +72,22 @@ interface NgConfig<T extends string = string & {}> {
72
72
  * Use 'blocking' to load themes.css as a render-blocking stylesheet (HTTP-cacheable).
73
73
  */
74
74
  strategy: NgStrategy;
75
- /** List of supported theme identifiers. Default: ['light', 'dark', 'system']. */
75
+ /**
76
+ * The **resolved** list of supported theme identifiers, always including the
77
+ * built-in themes (`'light'`, `'dark'`, `'system'`).
78
+ *
79
+ * When you pass custom themes to {@link provideThemeStack}, they are **merged**
80
+ * with the built-in defaults โ€” your custom values are appended after them.
81
+ *
82
+ * @example
83
+ * // Input to provideThemeStack:
84
+ * themes: ['sepia', 'ocean'] as const
85
+ *
86
+ * // Resolved value stored in NgConfig:
87
+ * // ['system', 'light', 'dark', 'sepia', 'ocean']
88
+ *
89
+ * Default (no custom themes): `['system', 'light', 'dark']`.
90
+ */
76
91
  themes: NgTheme<T>[];
77
92
  }
78
93
 
@@ -90,9 +105,19 @@ declare class CoreThemeService {
90
105
  readonly selectedTheme: _angular_core.Signal<NgTheme>;
91
106
  /** Resolved theme applied to the DOM. Always `'dark'` or `'light'` (or custom) โ€” never `'system'`. */
92
107
  readonly resolvedTheme: _angular_core.Signal<(string & {}) | NgSystemTheme>;
93
- /** Whether the currently applied theme is dark. */
108
+ /**
109
+ * Whether the currently applied theme is dark.
110
+ *
111
+ * Returns `false` when a custom theme (e.g. `'sunset'`) is active โ€” use
112
+ * `resolvedTheme()` directly if you need to inspect the current custom theme.
113
+ */
94
114
  readonly isDark: _angular_core.Signal<boolean>;
95
- /** Whether the currently applied theme is light. */
115
+ /**
116
+ * Whether the currently applied theme is light.
117
+ *
118
+ * Returns `false` when a custom theme (e.g. `'sepia'`) is active โ€” use
119
+ * `resolvedTheme()` directly if you need to inspect the current custom theme.
120
+ */
96
121
  readonly isLight: _angular_core.Signal<boolean>;
97
122
  /** Whether the currently applied theme is system. */
98
123
  readonly isSystem: _angular_core.Signal<boolean>;
@@ -163,8 +188,10 @@ declare const NGX_THEME_STACK_CONFIG: InjectionToken<NgConfig<string>>;
163
188
  /**
164
189
  * Provides Theme Stack configuration to Angular's DI system.
165
190
  *
166
- * Custom `themes` are **merged** with the built-in defaults
167
- * (`'light'`, `'dark'`, `'system'`), so you never lose the base themes.
191
+ * The `themes` option accepts **additional** theme identifiers beyond the
192
+ * built-in defaults. They are merged with `'light'`, `'dark'`, and `'system'`
193
+ * so that the resolved {@link NgConfig.themes} array always includes all of
194
+ * them โ€” your custom values are appended after the built-ins.
168
195
  *
169
196
  * **Defaults:**
170
197
  * - `themes`: `['light', 'dark', 'system']`