@rxap/ngx-theme 19.0.4-dev.0 → 19.1.0-dev.1
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/CHANGELOG.md +12 -0
- package/README.md +86 -1
- package/compodoc/changelog.html +10 -0
- package/compodoc/classes/ThemeColor.html +874 -0
- package/compodoc/dependencies.html +6 -4
- package/compodoc/index.html +70 -2
- package/compodoc/injectables/ThemeModeService.html +1256 -0
- package/compodoc/injectables/ThemeService.html +82 -265
- package/compodoc/interfaces/BasePalette.html +844 -0
- package/compodoc/interfaces/ColorPaletteConfig.html +6 -71
- package/compodoc/interfaces/ColorPaletteConfigWithName.html +6 -71
- package/compodoc/interfaces/ThemeColors.html +898 -0
- package/compodoc/interfaces/ThemeConfig.html +6 -71
- package/compodoc/js/menu-wc.js +25 -0
- package/compodoc/js/menu-wc_es5.js +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/miscellaneous/functions.html +60 -1
- package/compodoc/miscellaneous/typealiases.html +364 -0
- package/compodoc/miscellaneous/variables.html +193 -0
- package/compodoc/overview.html +10 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +2294 -530
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/highlight.css +28 -0
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/ThemeColor.html +4 -0
- package/docs/html/classes/ThemeModeService.html +35 -0
- package/docs/html/classes/ThemeService.html +4 -6
- package/docs/html/enums/ColorPaletteAlgorithm.html +2 -2
- package/docs/html/functions/ComputeColorPalette.html +1 -1
- package/docs/html/functions/ObserveCurrentThemeDensity.html +1 -1
- package/docs/html/functions/applyThemeColorBootstrapHook.html +1 -0
- package/docs/html/functions/provideTheme.html +1 -1
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +61 -3
- package/docs/html/interfaces/ColorPalette.html +2 -2
- package/docs/html/interfaces/ColorPaletteConfig.html +2 -2
- package/docs/html/interfaces/ColorPaletteConfigWithName.html +2 -2
- package/docs/html/interfaces/ThemeColors.html +7 -0
- package/docs/html/interfaces/ThemeConfig.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/html/types/ActiveTheme.html +1 -0
- package/docs/html/types/ThemeSetting.html +1 -0
- package/docs/html/variables/THEME_SETTING_KEY.html +1 -0
- package/docs/markdown/README.md +87 -2
- package/docs/markdown/classes/ThemeColor.md +83 -0
- package/docs/markdown/classes/ThemeModeService.md +282 -0
- package/docs/markdown/classes/ThemeService.md +39 -69
- package/docs/markdown/enumerations/ColorPaletteAlgorithm.md +4 -4
- package/docs/markdown/functions/ComputeColorPalette.md +2 -2
- package/docs/markdown/functions/ObserveCurrentThemeDensity.md +2 -2
- package/docs/markdown/functions/applyThemeColorBootstrapHook.md +31 -0
- package/docs/markdown/functions/provideTheme.md +2 -2
- package/docs/markdown/globals.md +15 -2
- package/docs/markdown/interfaces/ColorPalette.md +16 -16
- package/docs/markdown/interfaces/ColorPaletteConfig.md +5 -5
- package/docs/markdown/interfaces/ColorPaletteConfigWithName.md +6 -6
- package/docs/markdown/interfaces/ThemeColors.md +57 -0
- package/docs/markdown/interfaces/ThemeConfig.md +7 -7
- package/docs/markdown/type-aliases/ActiveTheme.md +11 -0
- package/docs/markdown/type-aliases/ThemeSetting.md +11 -0
- package/docs/markdown/variables/THEME_SETTING_KEY.md +11 -0
- package/docs/wiki/Class.ThemeColor.md +79 -0
- package/docs/wiki/Class.ThemeModeService.md +278 -0
- package/docs/wiki/Class.ThemeService.md +38 -68
- package/docs/wiki/Enumeration.ColorPaletteAlgorithm.md +3 -3
- package/docs/wiki/Function.ComputeColorPalette.md +1 -1
- package/docs/wiki/Function.ObserveCurrentThemeDensity.md +1 -1
- package/docs/wiki/Function.applyThemeColorBootstrapHook.md +27 -0
- package/docs/wiki/Function.provideTheme.md +1 -1
- package/docs/wiki/Home.md +86 -1
- package/docs/wiki/Interface.ColorPalette.md +15 -15
- package/docs/wiki/Interface.ColorPaletteConfig.md +4 -4
- package/docs/wiki/Interface.ColorPaletteConfigWithName.md +5 -5
- package/docs/wiki/Interface.ThemeColors.md +53 -0
- package/docs/wiki/Interface.ThemeConfig.md +6 -6
- package/docs/wiki/TypeAlias.ActiveTheme.md +7 -0
- package/docs/wiki/TypeAlias.ThemeSetting.md +7 -0
- package/docs/wiki/Variable.THEME_SETTING_KEY.md +7 -0
- package/docs/wiki/_Sidebar.md +13 -0
- package/docs/wiki/globals.md +14 -1
- package/fesm2022/rxap-ngx-theme.mjs +392 -61
- package/fesm2022/rxap-ngx-theme.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/lib/theme-color.d.ts +29 -0
- package/lib/theme-mode.service.d.ts +61 -0
- package/lib/theme.service.d.ts +3 -5
- package/package.json +13 -12
|
@@ -119,13 +119,15 @@
|
|
|
119
119
|
<li>
|
|
120
120
|
<b>@angular/core</b> : ^19.2.1</li>
|
|
121
121
|
<li>
|
|
122
|
-
<b>@
|
|
122
|
+
<b>@material/material-color-utilities</b> : ^0.3.0</li>
|
|
123
123
|
<li>
|
|
124
|
-
<b>@rxap/
|
|
124
|
+
<b>@rxap/config</b> : ^19.0.4-dev.1</li>
|
|
125
125
|
<li>
|
|
126
|
-
<b>@rxap/
|
|
126
|
+
<b>@rxap/ngx-pub-sub</b> : ^19.0.4-dev.0</li>
|
|
127
127
|
<li>
|
|
128
|
-
<b>@rxap/
|
|
128
|
+
<b>@rxap/rxjs</b> : ^1.1.16-dev.0</li>
|
|
129
|
+
<li>
|
|
130
|
+
<b>@rxap/utilities</b> : ^16.4.4-dev.0</li>
|
|
129
131
|
<li>
|
|
130
132
|
<b>rxjs</b> : ^7.8.1</li>
|
|
131
133
|
</ul>
|
package/compodoc/index.html
CHANGED
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
<img src="https://img.shields.io/npm/l/@rxap/ngx-theme" alt="NPM" class="img-responsive"></p>
|
|
92
92
|
<ul>
|
|
93
93
|
<li><a href="#installation">Installation</a></li>
|
|
94
|
+
<li><a href="#guides">Guides</a></li>
|
|
94
95
|
<li><a href="#generators">Generators</a><ul>
|
|
95
96
|
<li><a href="#init">init</a></li>
|
|
96
97
|
</ul>
|
|
@@ -99,8 +100,75 @@
|
|
|
99
100
|
<h1>Installation</h1>
|
|
100
101
|
<p><strong>Add the package to your workspace:</strong></p>
|
|
101
102
|
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn add @rxap/ngx-theme</code></pre></div><p><strong>Install peer dependencies:</strong></p>
|
|
102
|
-
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn add @angular/cdk @angular/core @rxap/config @rxap/ngx-pub-sub @rxap/rxjs @rxap/utilities rxjs </code></pre></div><p><strong>Execute the init generator:</strong></p>
|
|
103
|
-
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn nx g @rxap/ngx-theme:init</code></pre></div><h1>
|
|
103
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn add @angular/cdk @angular/core @material/material-color-utilities @rxap/config @rxap/ngx-pub-sub @rxap/rxjs @rxap/utilities rxjs </code></pre></div><p><strong>Execute the init generator:</strong></p>
|
|
104
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn nx g @rxap/ngx-theme:init</code></pre></div><h1>Guides</h1>
|
|
105
|
+
<h1>Dark and Light mode with tailwind and angular material 3</h1>
|
|
106
|
+
<p>This guide provides the setup steps for configuring Tailwind CSS and Angular Material for the light/dark/system theme switching mechanism, using the approaches we discussed previously.</p>
|
|
107
|
+
<h2>1. Configure Tailwind with the Variant Strategy</h2>
|
|
108
|
+
<p>Update your tailwind.config.js to use the variant strategy. This allows Tailwind to react to both the system preference (prefers-color-scheme) and specific classes (.light, .dark) for manual overrides.</p>
|
|
109
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-js">// tailwind.config.js
|
|
110
|
+
/** @type {import('tailwindcss').Config} */
|
|
111
|
+
module.exports = {
|
|
112
|
+
// ... other configurations
|
|
113
|
+
darkMode: 'selector',
|
|
114
|
+
theme: {
|
|
115
|
+
extend: {
|
|
116
|
+
// ... your theme extensions
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
plugins: [],
|
|
120
|
+
// ...
|
|
121
|
+
};</code></pre></div><p>This configuration tells Tailwind to apply dark: variants if EITHER the system preference is dark (and not overridden by .light) OR if the .dark class is explicitly set on an ancestor element.</p>
|
|
122
|
+
<h2>2. Integrate with Angular Material (Modern MDC Approach)</h2>
|
|
123
|
+
<p>Use the modern Angular Material Sass API (mat.theme) to define your theme once and emit CSS variables. Then, use CSS to control the color-scheme property based on the .light and .dark classes applied by the ThemeService. Material components will react automatically to the computed color-scheme.</p>
|
|
124
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-scss">@use '@angular/material' as mat;
|
|
125
|
+
|
|
126
|
+
html {
|
|
127
|
+
@include mat.theme((
|
|
128
|
+
color: mat.$violet-palette,
|
|
129
|
+
typography: Roboto,
|
|
130
|
+
density: 0
|
|
131
|
+
));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// --- Tailwind Integration ---
|
|
135
|
+
@tailwind base;
|
|
136
|
+
@tailwind components;
|
|
137
|
+
@tailwind utilities;
|
|
138
|
+
|
|
139
|
+
// --- Color Scheme Control & Base Styles ---
|
|
140
|
+
html { // Setting on html or :root is fine
|
|
141
|
+
// Default: Let the browser choose light/dark based on system preference.
|
|
142
|
+
// Material components & Tailwind's media query variant will react to this.
|
|
143
|
+
color-scheme: light dark;
|
|
144
|
+
|
|
145
|
+
// Apply base background/text colors (Tailwind handles dark via variants).
|
|
146
|
+
// Add transitions for smoother switching.
|
|
147
|
+
@apply bg-white text-gray-800 transition-colors duration-200 ease-in-out;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Force light mode when .light class is present on an ancestor (e.g., body)
|
|
151
|
+
// Use :where to keep specificity low, preventing conflicts.
|
|
152
|
+
:where(html.light, body.light, .light) {
|
|
153
|
+
color-scheme: light;
|
|
154
|
+
// Ensure light background/text if overriding system dark mode
|
|
155
|
+
@apply bg-white text-gray-800;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Force dark mode when .dark class is present on an ancestor (e.g., body)
|
|
159
|
+
// Use :where to keep specificity low.
|
|
160
|
+
:where(html.dark, body.dark, .dark) {
|
|
161
|
+
color-scheme: dark;
|
|
162
|
+
// Apply dark background/text (complements Tailwind's dark: variants)
|
|
163
|
+
@apply bg-gray-900 text-gray-200;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Other global styles can go here
|
|
167
|
+
body {
|
|
168
|
+
// Ensure body takes full height if needed, etc.
|
|
169
|
+
@apply min-h-screen m-0; // Added margin reset
|
|
170
|
+
}</code></pre></div><p>This setup provides the configuration for Tailwind and the recommended SCSS structure for Angular Material theming that integrates with the ThemeService managing the .light and .dark classes.</p>
|
|
171
|
+
<h1>Generators</h1>
|
|
104
172
|
<h2>init</h2>
|
|
105
173
|
<blockquote>
|
|
106
174
|
<p>Initialize the package in the workspace</p>
|