@lukfel/ng-scaffold 21.1.52 → 21.1.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukfel/ng-scaffold",
3
- "version": "21.1.52",
3
+ "version": "21.1.54",
4
4
  "description": "This Angular library provides a basic UI scaffold and services for modern web and mobile apps",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -2,7 +2,11 @@
2
2
  @include mat.elevation-classes();
3
3
  @include mat.app-background();
4
4
 
5
- // Default theme
5
+ // ============================================================================
6
+ // Material 2 (M2) Theming
7
+ // ============================================================================
8
+
9
+ // Default M2 theme
6
10
  $lf-default-theme: (
7
11
  primary: mat.m2-define-palette(mat.$m2-blue-palette),
8
12
  accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400),
@@ -11,7 +15,7 @@ $lf-default-theme: (
11
15
  font-family: 'Roboto'
12
16
  );
13
17
 
14
- // Set theme
18
+ // Set M2 theme
15
19
  // Material requires to split up the mat.all-component-themes and mat.all-component-colors
16
20
  // since mat.all-component-themes should also be imported once, but mat.all-component-colors
17
21
  // can be imported multiple times
@@ -48,7 +52,7 @@ $lf-default-theme: (
48
52
  @include color-variables($theme, 'body');
49
53
  }
50
54
 
51
- // Set colors
55
+ // Set M2 colors
52
56
  @mixin scaffold-colors($theme: $lf-default-theme, $class) {
53
57
  $theme: map-merge($lf-default-theme, $theme);
54
58
 
@@ -77,7 +81,7 @@ $lf-default-theme: (
77
81
  @include color-variables($theme, #{'body.'+$class});
78
82
  }
79
83
 
80
- // Set variables
84
+ // Set M2 variables
81
85
  @mixin color-variables($theme, $scope) {
82
86
  #{$scope}{
83
87
  --color-primary: #{mat.m2-get-color-from-palette(map-get($theme, 'primary'))};
@@ -110,3 +114,134 @@ $lf-default-theme: (
110
114
  }
111
115
  }
112
116
  }
117
+
118
+ // ============================================================================
119
+ // Material 3 (M3) Theming
120
+ // ============================================================================
121
+
122
+ // Default M3 theme
123
+ // M3 uses: primary, tertiary (instead of accent), and error (instead of warn)
124
+ // theme-type: 'light', 'dark', or 'color-scheme' (auto light/dark based on user preference)
125
+ $lf-default-theme-m3: (
126
+ primary: mat.$blue-palette,
127
+ tertiary: mat.$rose-palette,
128
+ theme-type: color-scheme,
129
+ font-family: 'Roboto',
130
+ density: 0,
131
+ );
132
+
133
+ // Set M3 theme
134
+ // Uses mat.theme() which outputs CSS variables (design tokens) instead of static styles.
135
+ // Includes color-variants-backwards-compatibility so that component [color] inputs
136
+ // (color="primary", color="accent", color="warn") continue to work.
137
+ @mixin scaffold-theme-m3($theme: $lf-default-theme-m3) {
138
+ $theme: map-merge($lf-default-theme-m3, $theme);
139
+
140
+ $color-config: (
141
+ primary: map-get($theme, 'primary'),
142
+ tertiary: map-get($theme, 'tertiary'),
143
+ theme-type: map-get($theme, 'theme-type'),
144
+ );
145
+
146
+ html {
147
+ @include mat.theme((
148
+ color: $color-config,
149
+ typography: map-get($theme, 'font-family'),
150
+ density: map-get($theme, 'density'),
151
+ ));
152
+ @include mat.color-variants-backwards-compatibility($theme: mat.define-theme((
153
+ color: $color-config,
154
+ )));
155
+ @include mat.system-classes();
156
+ }
157
+
158
+ @include toolbar-color-compat();
159
+ @include color-variables-m3('body');
160
+ }
161
+
162
+ // Set M3 colors (scoped to a class, for multi-theme support)
163
+ // Only overrides color tokens; typography and density are inherited from the base theme.
164
+ @mixin scaffold-colors-m3($theme: $lf-default-theme-m3, $class) {
165
+ $theme: map-merge($lf-default-theme-m3, $theme);
166
+
167
+ $color-config: (
168
+ primary: map-get($theme, 'primary'),
169
+ tertiary: map-get($theme, 'tertiary'),
170
+ theme-type: map-get($theme, 'theme-type'),
171
+ );
172
+
173
+ .#{$class} {
174
+ @include mat.theme((
175
+ color: $color-config,
176
+ ));
177
+ @include mat.color-variants-backwards-compatibility($theme: mat.define-theme((
178
+ color: $color-config,
179
+ )));
180
+ }
181
+
182
+ @include toolbar-color-compat(#{'.' + $class});
183
+ @include color-variables-m3(#{'body.'+$class});
184
+ }
185
+
186
+ // Toolbar color backwards compatibility
187
+ // M3's color-variants-backwards-compatibility does not cover mat-toolbar.
188
+ // This mixin restores [color] input support for toolbar and ensures icons/buttons
189
+ // inside colored toolbars use the correct contrast color.
190
+ @mixin toolbar-color-compat($scope: null) {
191
+ $prefix: '';
192
+ @if ($scope) {
193
+ $prefix: '#{$scope} ';
194
+ }
195
+
196
+ #{$prefix}.mat-toolbar.mat-primary {
197
+ background-color: var(--mat-sys-primary);
198
+ color: var(--mat-sys-on-primary);
199
+
200
+ .mat-icon,
201
+ .mat-mdc-icon-button,
202
+ .mat-mdc-button {
203
+ color: var(--mat-sys-on-primary);
204
+ }
205
+ }
206
+
207
+ #{$prefix}.mat-toolbar.mat-accent {
208
+ background-color: var(--mat-sys-tertiary);
209
+ color: var(--mat-sys-on-tertiary);
210
+
211
+ .mat-icon,
212
+ .mat-mdc-icon-button,
213
+ .mat-mdc-button {
214
+ color: var(--mat-sys-on-tertiary);
215
+ }
216
+ }
217
+
218
+ #{$prefix}.mat-toolbar.mat-warn {
219
+ background-color: var(--mat-sys-error);
220
+ color: var(--mat-sys-on-error);
221
+
222
+ .mat-icon,
223
+ .mat-mdc-icon-button,
224
+ .mat-mdc-button {
225
+ color: var(--mat-sys-on-error);
226
+ }
227
+ }
228
+ }
229
+
230
+ // Set M3 variables
231
+ // Bridges the M3 system tokens to the same --color-* CSS variables that existing
232
+ // components use, so all library components work without template changes.
233
+ // Note: M3 does not have numbered hue variants (50-900). Only the base semantic
234
+ // colors are bridged. Hue-specific variables are not available in M3.
235
+ @mixin color-variables-m3($scope) {
236
+ #{$scope} {
237
+ --color-primary: var(--mat-sys-primary);
238
+ --color-accent: var(--mat-sys-tertiary);
239
+ --color-warn: var(--mat-sys-error);
240
+ }
241
+
242
+ // Utility classes (same API as M2, backed by M3 tokens)
243
+ @each $palette in ('primary', 'accent', 'warn') {
244
+ .color-#{$palette} { color: var(--color-#{$palette}) !important; }
245
+ .color-bg-#{$palette} { background-color: var(--color-#{$palette}) !important; }
246
+ }
247
+ }
@@ -48,6 +48,7 @@
48
48
 
49
49
  --bottom-bar-z-index: 98;
50
50
  --bottom-bar-height: 56px;
51
+ --bottom-bar-font-size: 16px;
51
52
 
52
53
  --placeholder-icon-size: 96px;
53
54
  --placeholder-title-font-size: 20px;
@@ -71,4 +72,4 @@
71
72
  --notification-font-size: 14px;
72
73
 
73
74
  --color-gray: rgba(128, 128, 128, 0.8);
74
- }
75
+ }
@@ -264,6 +264,7 @@ declare class ScaffoldComponent {
264
264
 
265
265
  declare class ColorPickerComponent {
266
266
  libraryConfig: ScaffoldLibraryConfig | null;
267
+ private platformId;
267
268
  readonly color: _angular_core.InputSignal<string>;
268
269
  readonly label: _angular_core.InputSignal<string | undefined>;
269
270
  readonly matIcon: _angular_core.InputSignal<string | undefined>;
@@ -272,6 +273,7 @@ declare class ColorPickerComponent {
272
273
  readonly colorChangeEvent: _angular_core.OutputEmitterRef<string>;
273
274
  isSafari: _angular_core.WritableSignal<boolean>;
274
275
  selectedColor: _angular_core.WritableSignal<string>;
276
+ constructor();
275
277
  labelColor: _angular_core.Signal<string>;
276
278
  selectColor(event: string): void;
277
279
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ColorPickerComponent, never>;