ngx-theme-stack 3.8.3 → 3.8.5
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
|
@@ -27,6 +27,7 @@ Built for performance and SSR support.
|
|
|
27
27
|
- [🏗️ Architecture & Extensibility](#️-architecture--extensibility)
|
|
28
28
|
- [📐 Supported Versions](#-supported-versions)
|
|
29
29
|
- [⚙️ Configuration](#️-configuration)
|
|
30
|
+
- [🔄 Theme Synchronization](#-theme-synchronization)
|
|
30
31
|
- [🛠️ Usage](#️-usage)
|
|
31
32
|
- [🛡️ CoreThemeService API](#️-advanced-corethemeservice-api)
|
|
32
33
|
- [🎨 Styling](#-styling)
|
|
@@ -102,7 +103,7 @@ The installation command automates the following:
|
|
|
102
103
|
| --------------- | ----------------------------------------------------------------------- |
|
|
103
104
|
| `app.config.ts` | Injects `provideThemeStack()` using AST — follows imports automatically |
|
|
104
105
|
| `index.html` | Injects the blocking anti-flash script into `<head>` |
|
|
105
|
-
| `package.json` | Adds a `"
|
|
106
|
+
| `package.json` | Adds a central `"ngx-theme-stack:sync"` script and configures `"prestart"` / `"prebuild"` hooks to run it automatically |
|
|
106
107
|
| `angular.json` | Registers `themes.css` and optimizes build config |
|
|
107
108
|
| `themes.css` | Scaffolds base theme tokens if they don't exist |
|
|
108
109
|
| `SKILL.md` | Generates an AI Agent Skill under `.agents/skills/` (optional) |
|
|
@@ -163,12 +164,68 @@ export const appConfig: ApplicationConfig = {
|
|
|
163
164
|
| `strategy` | `NgStrategy` | `'critters'` | Anti-flash strategy |
|
|
164
165
|
| `storageKey` | `string` | `'ngx-theme-stack'` | Persistence key |
|
|
165
166
|
|
|
166
|
-
> [!
|
|
167
|
-
> Custom themes are **merged** with built-ins. Passing `['sepia', 'ocean']` resolves to `['system', 'light', 'dark', 'sepia', 'ocean']`.
|
|
168
|
-
>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
> [!IMPORTANT]
|
|
168
|
+
> Custom themes are **merged** with built-ins. Passing `['sepia', 'ocean']` resolves to `['system', 'light', 'dark', 'sepia', 'ocean']`.
|
|
169
|
+
> After making any configuration changes, you **must** synchronize the workspace. See [🔄 Theme Synchronization](#-theme-synchronization) below for instructions and when to run it.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🔄 Theme Synchronization
|
|
174
|
+
|
|
175
|
+
The synchronization schematic validates and compiles your theme configuration in `app.config.ts` into static assets (like the zero-flash anti-flash script in `index.html` and critters placeholders).
|
|
176
|
+
|
|
177
|
+
### Centralized Script
|
|
178
|
+
|
|
179
|
+
The installation schematic registers a centralized `"ngx-theme-stack:sync"` script in your `package.json` to compile configurations:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Run manually using your package manager of choice:
|
|
183
|
+
npm run ngx-theme-stack:sync
|
|
184
|
+
pnpm run ngx-theme-stack:sync
|
|
185
|
+
yarn run ngx-theme-stack:sync
|
|
186
|
+
bun run ngx-theme-stack:sync
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### When should you run sync?
|
|
190
|
+
|
|
191
|
+
You should run this command after:
|
|
192
|
+
- ➕ **Adding or removing** themes in `provideThemeStack`
|
|
193
|
+
- 🏷️ **Renaming** a theme identifier
|
|
194
|
+
- ⚙️ **Changing** configuration settings like `storageKey`, `mode`, or `strategy`
|
|
195
|
+
- 📝 **Manually editing** the anti-flash script in your `index.html` file
|
|
196
|
+
|
|
197
|
+
### Development vs. Production (Serving vs. Building)
|
|
198
|
+
|
|
199
|
+
To prevent you from having to run this command manually, the `ng add` command automatically detects your package manager and registers hooks in your `package.json` (appending/prepending safely to any existing scripts):
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
"scripts": {
|
|
203
|
+
"ngx-theme-stack:sync": "ng generate ngx-theme-stack:sync --project YOUR_PROJECT_NAME",
|
|
204
|
+
"prestart": "npm run ngx-theme-stack:sync",
|
|
205
|
+
"start": "ng serve",
|
|
206
|
+
"prebuild": "npm run ngx-theme-stack:sync",
|
|
207
|
+
"build": "ng build"
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This ensures that the theme configuration is synchronized automatically before running your local development server (`npm start` / `pnpm start` / `yarn start` / `bun start`) and before production builds (`ng build`).
|
|
212
|
+
|
|
213
|
+
> [!WARNING]
|
|
214
|
+
> If you run `ng serve` or `ng build` directly from the CLI (bypassing npm/pnpm/yarn/bun scripts), the package manager hooks (`prestart` and `prebuild`) will not run. In this case, you must run the synchronization command manually after making configuration changes.
|
|
215
|
+
|
|
216
|
+
### Troubleshooting: Theme reverts to Default/System on reload
|
|
217
|
+
|
|
218
|
+
If you select a newly added custom theme (e.g. `'sunset'`) and reload the page, but the page reverts to the default theme (e.g. `'system'`), the theme is being rejected by the anti-flash script.
|
|
219
|
+
|
|
220
|
+
**Diagnostic steps:**
|
|
221
|
+
1. Open your `src/index.html` file.
|
|
222
|
+
2. Locate the `<script>` tag inside `<head>` marked with `<!-- ngx-theme-stack anti-flash -->`.
|
|
223
|
+
3. Check the valid themes array (`v`) defined in that script (e.g., `v=["system","light","dark"]`).
|
|
224
|
+
4. **Verify if your custom theme is missing from this array.** To prevent layout flicker and XSS injections, the blocking script rejects any theme not explicitly registered in this array and falls back to the default.
|
|
225
|
+
5. If it is missing, run the synchronization script:
|
|
226
|
+
```bash
|
|
227
|
+
npm run ngx-theme-stack:sync
|
|
228
|
+
```
|
|
172
229
|
|
|
173
230
|
---
|
|
174
231
|
|
package/package.json
CHANGED
|
@@ -112,7 +112,16 @@ function ngAdd(options) {
|
|
|
112
112
|
t.create(themesPath, content);
|
|
113
113
|
changeset.push(` \u001b[36mA\u001b[0m ${themesPath} (theme tokens)`);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function detectPackageManager(t) {
|
|
116
|
+
if (t.exists('/pnpm-lock.yaml'))
|
|
117
|
+
return 'pnpm';
|
|
118
|
+
if (t.exists('/yarn.lock'))
|
|
119
|
+
return 'yarn';
|
|
120
|
+
if (t.exists('/bun.lockb') || t.exists('/bun.lock'))
|
|
121
|
+
return 'bun';
|
|
122
|
+
return 'npm';
|
|
123
|
+
}
|
|
124
|
+
function patchPackageJsonScripts(t) {
|
|
116
125
|
const pkgPath = '/package.json';
|
|
117
126
|
const buffer = t.read(pkgPath);
|
|
118
127
|
if (!buffer)
|
|
@@ -120,17 +129,46 @@ function ngAdd(options) {
|
|
|
120
129
|
const pkg = JSON.parse(buffer.toString());
|
|
121
130
|
pkg.scripts = pkg.scripts || {};
|
|
122
131
|
const syncCmd = `ng generate ngx-theme-stack:sync --project ${projectName}`;
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
132
|
+
const pm = detectPackageManager(t);
|
|
133
|
+
const pmRunCmd = `${pm} run ngx-theme-stack:sync`;
|
|
134
|
+
// 1. Add/Update main sync script
|
|
135
|
+
const existingSync = pkg.scripts['ngx-theme-stack:sync'];
|
|
136
|
+
if (!existingSync) {
|
|
137
|
+
pkg.scripts['ngx-theme-stack:sync'] = syncCmd;
|
|
138
|
+
changeset.push(' \u001b[33mM\u001b[0m package.json (ngx-theme-stack:sync script added)');
|
|
139
|
+
}
|
|
140
|
+
else if (existingSync !== syncCmd) {
|
|
141
|
+
pkg.scripts['ngx-theme-stack:sync'] = syncCmd;
|
|
142
|
+
changeset.push(' \u001b[33mM\u001b[0m package.json (ngx-theme-stack:sync script updated)');
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
changeset.push(' \u001b[90mℹ\u001b[0m package.json (ngx-theme-stack:sync script already correct — skipped)');
|
|
146
|
+
}
|
|
147
|
+
// 2. Patch prebuild (runs before production builds)
|
|
148
|
+
const existingPrebuild = pkg.scripts.prebuild;
|
|
149
|
+
if (!existingPrebuild) {
|
|
150
|
+
pkg.scripts.prebuild = pmRunCmd;
|
|
151
|
+
changeset.push(` \u001b[33mM\u001b[0m package.json (prebuild script added with ${pmRunCmd})`);
|
|
152
|
+
}
|
|
153
|
+
else if (!existingPrebuild.includes('ngx-theme-stack:sync')) {
|
|
154
|
+
pkg.scripts.prebuild = `${existingPrebuild} && ${pmRunCmd}`;
|
|
155
|
+
changeset.push(' \u001b[33mM\u001b[0m package.json (sync run appended to existing prebuild)');
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
changeset.push(' \u001b[90mℹ\u001b[0m package.json (prebuild already contains sync run — skipped)');
|
|
159
|
+
}
|
|
160
|
+
// 3. Patch prestart (runs before local development server)
|
|
161
|
+
const existingPrestart = pkg.scripts.prestart;
|
|
162
|
+
if (!existingPrestart) {
|
|
163
|
+
pkg.scripts.prestart = pmRunCmd;
|
|
164
|
+
changeset.push(` \u001b[33mM\u001b[0m package.json (prestart script added with ${pmRunCmd})`);
|
|
127
165
|
}
|
|
128
|
-
else if (!
|
|
129
|
-
pkg.scripts.
|
|
130
|
-
changeset.push(' \u001b[33mM\u001b[0m package.json (sync
|
|
166
|
+
else if (!existingPrestart.includes('ngx-theme-stack:sync')) {
|
|
167
|
+
pkg.scripts.prestart = `${pmRunCmd} && ${existingPrestart}`;
|
|
168
|
+
changeset.push(' \u001b[33mM\u001b[0m package.json (sync run prepended to existing prestart)');
|
|
131
169
|
}
|
|
132
170
|
else {
|
|
133
|
-
changeset.push(' \u001b[90mℹ\u001b[0m package.json (
|
|
171
|
+
changeset.push(' \u001b[90mℹ\u001b[0m package.json (prestart already contains sync run — skipped)');
|
|
134
172
|
}
|
|
135
173
|
t.overwrite(pkgPath, JSON.stringify(pkg, null, 2));
|
|
136
174
|
}
|
|
@@ -177,7 +215,7 @@ function ngAdd(options) {
|
|
|
177
215
|
}
|
|
178
216
|
return (0, schematics_1.chain)([
|
|
179
217
|
scaffoldThemesCss,
|
|
180
|
-
|
|
218
|
+
patchPackageJsonScripts,
|
|
181
219
|
patchAngularJson,
|
|
182
220
|
scaffoldAgentSkill,
|
|
183
221
|
patchProviderAndIndexHtml,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngx-theme-stack/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAmEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngx-theme-stack/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAmEA,sBAiLC;AApPD,2DAAiF;AACjF,6CAA8C;AAC9C,6CAA8C;AAC9C,2CAAuD;AAEvD,mCAAmE;AACnE,0CAA+C;AAY/C,SAAe,oBAAoB,CAAC,WAAqB;;QACvD,MAAM,EAAE,GAAG,IAAA,gBAAQ,GAAE,CAAC;QAEtB,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAE3B,MAAM,SAAS,GAAG,MAAM,IAAA,WAAG,EAAC,EAAE,EAAE,oDAAoD,CAAC,CAAC;YACtF,MAAM,YAAY,GAAG,SAAS;gBAC5B,CAAC,CAAC,SAAS;qBACN,KAAK,CAAC,GAAG,CAAC;qBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;qBACpB,MAAM,CAAC,OAAO,CAAC;gBACpB,CAAC,CAAC,EAAE,CAAC;YACP,MAAM,MAAM,GAAG,CAAC,GAAG,0BAAc,EAAE,GAAG,YAAY,CAAC,CAAC;YAEpD,MAAM,YAAY,GAAG,MAAM,IAAA,eAAO,EAAC,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAEpE,MAAM,MAAM,GAAG,MAAM,IAAA,WAAG,EAAC,EAAE,EAAE,uBAAuB,oBAAQ,CAAC,UAAU,KAAK,CAAC,CAAC;YAC9E,MAAM,UAAU,GAAG,MAAM,IAAI,oBAAQ,CAAC,UAAU,CAAC;YAEjD,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAU,CAAC;YAC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28
|
## Constraints & Rules
|
|
29
29
|
|
|
30
30
|
- Call \`provideThemeStack()\` once in root \`app.config.ts\`. Custom themes merge with defaults.
|
|
31
|
-
- **Theme Synchronization**:
|
|
31
|
+
- **Theme Synchronization**: Syncs theme configuration in \`app.config.ts\` with \`index.html\` assets.
|
|
32
|
+
- **Manual execution**: Run \`<package-manager> run ngx-theme-stack:sync\` (e.g., \`npm run ngx-theme-stack:sync\`).
|
|
33
|
+
- **Auto-Sync**: Runs automatically before serving or building via \`"prestart"\` and \`"prebuild"\` hooks in \`package.json\`.
|
|
34
|
+
- **When to sync**: Run after adding/removing themes, renaming themes, changing configuration settings (storageKey, mode, strategy), or manually editing index.html.
|
|
35
|
+
- **Debugging**: If a theme reverts to default/system on reload, check if the theme identifier is missing in the valid themes array (\`v\`) in \`index.html\`. If missing, run synchronization.
|
|
32
36
|
- \`isDark()\` / \`isLight()\` return false for custom themes (use \`resolvedTheme()\`).
|
|
33
37
|
- Pick ONE convenience service per component. Do not write custom localStorage or direct DOM logic.
|
|
34
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngx-theme-stack/schematics/skill/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngx-theme-stack/schematics/skill/index.ts"],"names":[],"mappings":";;AAoQA,sCAUC;AAED,sBAMC;AAnRD,wDAAwD;AACxD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGrB,CAAC;AAEF,gFAAgF;AAEhF,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoErB,CAAC;AAEF,+EAA+E;AAE/E,MAAM,eAAe,GACrB;;;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