@firestitch/style 18.0.70 → 18.0.72

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.
@@ -0,0 +1,79 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export type FsColorSchemeType = 'light' | 'dark' | 'system';
4
+ export type FsResolvedColorScheme = 'light' | 'dark';
5
+ /**
6
+ * The one switch behind every light/dark decision in every @firestitch package.
7
+ *
8
+ * WHY THIS IS ONE PROPERTY AND NOT A THEME CLASS. Packages express their two
9
+ * appearances with `light-dark()` in CSS, which picks off the `color-scheme`
10
+ * property. Setting it once on <html> re-paints every package at once -- chips,
11
+ * fields, dividers, menus -- with no class to agree on, no component to notify
12
+ * and no stylesheet to reload. Anything that reads the --fs-* tokens follows
13
+ * automatically, including components compiled into other packages.
14
+ *
15
+ * DECLARED, NOT DETECTED. `prefers-color-scheme` reports the DEVICE, and an app
16
+ * whose user chose Light on a dark phone would otherwise fight its own setting.
17
+ * So the media query is read for exactly one purpose -- reporting what "system"
18
+ * currently resolves to, via `resolvedColorScheme` -- and never to decide the
19
+ * setting itself. Choosing is the caller's job; this only applies the choice.
20
+ *
21
+ * NOTHING IS PERSISTED. The setting lives for the lifetime of the service, so a
22
+ * reload starts from the default. An app that wants the choice remembered stores
23
+ * it wherever it keeps its other preferences and calls `set()` on startup --
24
+ * which keeps this free of any opinion about storage, and keeps a package from
25
+ * writing to a key the application did not choose.
26
+ */
27
+ export declare class FsColorScheme implements OnDestroy {
28
+ private _document;
29
+ private _colorScheme;
30
+ private _systemDark;
31
+ private _mediaQuery;
32
+ private _mediaQueryListener;
33
+ constructor();
34
+ /**
35
+ * What was asked for -- 'light', 'dark' or 'system'. For what "system" is
36
+ * currently showing, read `resolved()`.
37
+ */
38
+ get colorScheme(): import("@angular/core").Signal<FsColorSchemeType>;
39
+ /**
40
+ * The appearance actually on screen, with 'system' resolved to what the
41
+ * operating system asks for. Tracks the OS live while set to 'system', so a
42
+ * caller rendering an icon or a label for the current appearance stays right
43
+ * without polling.
44
+ *
45
+ * A computed rather than a method so it can be handed to a template or an
46
+ * effect on its own -- `resolved` passed as a bare reference keeps working,
47
+ * where an unbound method would lose `this`.
48
+ */
49
+ resolved: import("@angular/core").Signal<FsResolvedColorScheme>;
50
+ set(colorScheme: FsColorSchemeType): void;
51
+ light(): void;
52
+ dark(): void;
53
+ system(): void;
54
+ /**
55
+ * Flips between light and dark. From 'system' it moves to whichever appearance
56
+ * is NOT showing, so the control always does what it says rather than landing
57
+ * on the appearance already on screen.
58
+ */
59
+ toggle(): void;
60
+ ngOnDestroy(): void;
61
+ /**
62
+ * Writes the property <html> rather than <body>: `color-scheme` also tells the
63
+ * browser what to paint the canvas, the scrollbars and the form controls it
64
+ * renders itself, and those follow the root element.
65
+ */
66
+ private _apply;
67
+ /**
68
+ * Kept current at all times, not only while set to 'system', so that switching
69
+ * to 'system' reports the right appearance immediately instead of waiting for
70
+ * the OS to next change.
71
+ *
72
+ * Guarded because matchMedia is absent when rendering on the server, where
73
+ * there is no device to ask.
74
+ */
75
+ private _watchSystem;
76
+ private _unwatchSystem;
77
+ static ɵfac: i0.ɵɵFactoryDeclaration<FsColorScheme, never>;
78
+ static ɵprov: i0.ɵɵInjectableDeclaration<FsColorScheme>;
79
+ }
@@ -0,0 +1,140 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import { Injectable, computed, inject, signal } from '@angular/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * The `color-scheme` value written for each setting. "system" is `light dark`:
6
+ * NOT a third appearance, but both offered to the browser so it resolves the one
7
+ * the operating system asks for.
8
+ */
9
+ const COLOR_SCHEME_VALUES = {
10
+ light: 'light',
11
+ dark: 'dark',
12
+ system: 'light dark',
13
+ };
14
+ const DARK_QUERY = '(prefers-color-scheme: dark)';
15
+ /**
16
+ * The one switch behind every light/dark decision in every @firestitch package.
17
+ *
18
+ * WHY THIS IS ONE PROPERTY AND NOT A THEME CLASS. Packages express their two
19
+ * appearances with `light-dark()` in CSS, which picks off the `color-scheme`
20
+ * property. Setting it once on <html> re-paints every package at once -- chips,
21
+ * fields, dividers, menus -- with no class to agree on, no component to notify
22
+ * and no stylesheet to reload. Anything that reads the --fs-* tokens follows
23
+ * automatically, including components compiled into other packages.
24
+ *
25
+ * DECLARED, NOT DETECTED. `prefers-color-scheme` reports the DEVICE, and an app
26
+ * whose user chose Light on a dark phone would otherwise fight its own setting.
27
+ * So the media query is read for exactly one purpose -- reporting what "system"
28
+ * currently resolves to, via `resolvedColorScheme` -- and never to decide the
29
+ * setting itself. Choosing is the caller's job; this only applies the choice.
30
+ *
31
+ * NOTHING IS PERSISTED. The setting lives for the lifetime of the service, so a
32
+ * reload starts from the default. An app that wants the choice remembered stores
33
+ * it wherever it keeps its other preferences and calls `set()` on startup --
34
+ * which keeps this free of any opinion about storage, and keeps a package from
35
+ * writing to a key the application did not choose.
36
+ */
37
+ export class FsColorScheme {
38
+ _document = inject(DOCUMENT);
39
+ _colorScheme = signal('system');
40
+ _systemDark = signal(false);
41
+ _mediaQuery;
42
+ _mediaQueryListener;
43
+ constructor() {
44
+ this._watchSystem();
45
+ }
46
+ /**
47
+ * What was asked for -- 'light', 'dark' or 'system'. For what "system" is
48
+ * currently showing, read `resolved()`.
49
+ */
50
+ get colorScheme() {
51
+ return this._colorScheme.asReadonly();
52
+ }
53
+ /**
54
+ * The appearance actually on screen, with 'system' resolved to what the
55
+ * operating system asks for. Tracks the OS live while set to 'system', so a
56
+ * caller rendering an icon or a label for the current appearance stays right
57
+ * without polling.
58
+ *
59
+ * A computed rather than a method so it can be handed to a template or an
60
+ * effect on its own -- `resolved` passed as a bare reference keeps working,
61
+ * where an unbound method would lose `this`.
62
+ */
63
+ resolved = computed(() => {
64
+ const colorScheme = this._colorScheme();
65
+ if (colorScheme === 'system') {
66
+ return this._systemDark() ? 'dark' : 'light';
67
+ }
68
+ return colorScheme;
69
+ });
70
+ set(colorScheme) {
71
+ this._colorScheme.set(colorScheme);
72
+ this._apply();
73
+ }
74
+ light() {
75
+ this.set('light');
76
+ }
77
+ dark() {
78
+ this.set('dark');
79
+ }
80
+ system() {
81
+ this.set('system');
82
+ }
83
+ /**
84
+ * Flips between light and dark. From 'system' it moves to whichever appearance
85
+ * is NOT showing, so the control always does what it says rather than landing
86
+ * on the appearance already on screen.
87
+ */
88
+ toggle() {
89
+ this.set(this.resolved() === 'dark' ? 'light' : 'dark');
90
+ }
91
+ ngOnDestroy() {
92
+ this._unwatchSystem();
93
+ }
94
+ /**
95
+ * Writes the property <html> rather than <body>: `color-scheme` also tells the
96
+ * browser what to paint the canvas, the scrollbars and the form controls it
97
+ * renders itself, and those follow the root element.
98
+ */
99
+ _apply() {
100
+ const element = this._document?.documentElement;
101
+ if (!element) {
102
+ return;
103
+ }
104
+ element.style.setProperty('color-scheme', COLOR_SCHEME_VALUES[this._colorScheme()]);
105
+ }
106
+ /**
107
+ * Kept current at all times, not only while set to 'system', so that switching
108
+ * to 'system' reports the right appearance immediately instead of waiting for
109
+ * the OS to next change.
110
+ *
111
+ * Guarded because matchMedia is absent when rendering on the server, where
112
+ * there is no device to ask.
113
+ */
114
+ _watchSystem() {
115
+ const view = this._document?.defaultView;
116
+ if (!view?.matchMedia) {
117
+ return;
118
+ }
119
+ this._mediaQuery = view.matchMedia(DARK_QUERY);
120
+ this._systemDark.set(this._mediaQuery.matches);
121
+ this._mediaQueryListener = (event) => {
122
+ this._systemDark.set(event.matches);
123
+ };
124
+ this._mediaQuery.addEventListener('change', this._mediaQueryListener);
125
+ }
126
+ _unwatchSystem() {
127
+ if (this._mediaQuery && this._mediaQueryListener) {
128
+ this._mediaQuery.removeEventListener('change', this._mediaQueryListener);
129
+ this._mediaQuery = null;
130
+ this._mediaQueryListener = null;
131
+ }
132
+ }
133
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsColorScheme, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
134
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsColorScheme, providedIn: 'root' });
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsColorScheme, decorators: [{
137
+ type: Injectable,
138
+ args: [{ providedIn: 'root' }]
139
+ }], ctorParameters: () => [] });
140
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sb3Itc2NoZW1lLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXBwL3NlcnZpY2VzL2NvbG9yLXNjaGVtZS5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMzQyxPQUFPLEVBQUUsVUFBVSxFQUFhLFFBQVEsRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQU1oRjs7OztHQUlHO0FBQ0gsTUFBTSxtQkFBbUIsR0FBc0M7SUFDN0QsS0FBSyxFQUFFLE9BQU87SUFDZCxJQUFJLEVBQUUsTUFBTTtJQUNaLE1BQU0sRUFBRSxZQUFZO0NBQ3JCLENBQUM7QUFFRixNQUFNLFVBQVUsR0FBRyw4QkFBOEIsQ0FBQztBQUVsRDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBRUgsTUFBTSxPQUFPLGFBQWE7SUFFaEIsU0FBUyxHQUFHLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUU3QixZQUFZLEdBQUcsTUFBTSxDQUFvQixRQUFRLENBQUMsQ0FBQztJQUNuRCxXQUFXLEdBQUcsTUFBTSxDQUFVLEtBQUssQ0FBQyxDQUFDO0lBRXJDLFdBQVcsQ0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1ZXJ5LmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIHRoaXMuX21lZGlhUXVlcnlMaXN0ZW5lcik7XG4gIH1cblxuICBwcml2YXRlIF91bndhdGNoU3lzdGVtKCk6IHZvaWQge1xuICAgIGlmICh0aGlzLl9tZWRpYVF1ZXJ5ICYmIHRoaXMuX21lZGlhUXVlcnlMaXN0ZW5lcikge1xuICAgICAgdGhpcy5fbWVkaWFRdWVyeS5yZW1vdmVFdmVudExpc3RlbmVyKCdjaGFuZ2UnLCB0aGlzLl9tZWRpYVF1ZXJ5TGlzdGVuZXIpO1xuICAgICAgdGhpcy5fbWVkaWFRdWVyeSA9IG51bGw7XG4gICAgICB0aGlzLl9tZWRpYVF1ZXJ5TGlzdGVuZXIgPSBudWxsO1xuICAgIH1cbiAgfVxuXG59XG4iXX0=
@@ -1,6 +1,7 @@
1
1
  /**
2
- * @firestitch/style - Shared styles and variables.
2
+ * @firestitch/style - Shared styles, tokens and the colour scheme switch.
3
3
  * Import SCSS from '@firestitch/style/styles' or include in angular.json styles.
4
4
  */
5
- export const STYLE_VERSION = '18.0.54';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7R0FHRztBQUNILE1BQU0sQ0FBQyxNQUFNLGFBQWEsR0FBRyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBmaXJlc3RpdGNoL3N0eWxlIC0gU2hhcmVkIHN0eWxlcyBhbmQgdmFyaWFibGVzLlxuICogSW1wb3J0IFNDU1MgZnJvbSAnQGZpcmVzdGl0Y2gvc3R5bGUvc3R5bGVzJyBvciBpbmNsdWRlIGluIGFuZ3VsYXIuanNvbiBzdHlsZXMuXG4gKi9cbmV4cG9ydCBjb25zdCBTVFlMRV9WRVJTSU9OID0gJzE4LjAuNTQnO1xuIl19
5
+ // Services
6
+ export { FsColorScheme } from './app/services/color-scheme.service';
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7R0FHRztBQUVILFdBQVc7QUFDWCxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0scUNBQXFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBmaXJlc3RpdGNoL3N0eWxlIC0gU2hhcmVkIHN0eWxlcywgdG9rZW5zIGFuZCB0aGUgY29sb3VyIHNjaGVtZSBzd2l0Y2guXG4gKiBJbXBvcnQgU0NTUyBmcm9tICdAZmlyZXN0aXRjaC9zdHlsZS9zdHlsZXMnIG9yIGluY2x1ZGUgaW4gYW5ndWxhci5qc29uIHN0eWxlcy5cbiAqL1xuXG4vLyBTZXJ2aWNlc1xuZXhwb3J0IHsgRnNDb2xvclNjaGVtZSB9IGZyb20gJy4vYXBwL3NlcnZpY2VzL2NvbG9yLXNjaGVtZS5zZXJ2aWNlJztcblxuLy8gVHlwZXNcbmV4cG9ydCB0eXBlIHsgRnNDb2xvclNjaGVtZVR5cGUsIEZzUmVzb2x2ZWRDb2xvclNjaGVtZSB9IGZyb20gJy4vYXBwL3NlcnZpY2VzL2NvbG9yLXNjaGVtZS5zZXJ2aWNlJztcbiJdfQ==
@@ -1,12 +1,153 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, signal, computed, Injectable } from '@angular/core';
4
+
5
+ /**
6
+ * The `color-scheme` value written for each setting. "system" is `light dark`:
7
+ * NOT a third appearance, but both offered to the browser so it resolves the one
8
+ * the operating system asks for.
9
+ */
10
+ const COLOR_SCHEME_VALUES = {
11
+ light: 'light',
12
+ dark: 'dark',
13
+ system: 'light dark',
14
+ };
15
+ const DARK_QUERY = '(prefers-color-scheme: dark)';
16
+ /**
17
+ * The one switch behind every light/dark decision in every @firestitch package.
18
+ *
19
+ * WHY THIS IS ONE PROPERTY AND NOT A THEME CLASS. Packages express their two
20
+ * appearances with `light-dark()` in CSS, which picks off the `color-scheme`
21
+ * property. Setting it once on <html> re-paints every package at once -- chips,
22
+ * fields, dividers, menus -- with no class to agree on, no component to notify
23
+ * and no stylesheet to reload. Anything that reads the --fs-* tokens follows
24
+ * automatically, including components compiled into other packages.
25
+ *
26
+ * DECLARED, NOT DETECTED. `prefers-color-scheme` reports the DEVICE, and an app
27
+ * whose user chose Light on a dark phone would otherwise fight its own setting.
28
+ * So the media query is read for exactly one purpose -- reporting what "system"
29
+ * currently resolves to, via `resolvedColorScheme` -- and never to decide the
30
+ * setting itself. Choosing is the caller's job; this only applies the choice.
31
+ *
32
+ * NOTHING IS PERSISTED. The setting lives for the lifetime of the service, so a
33
+ * reload starts from the default. An app that wants the choice remembered stores
34
+ * it wherever it keeps its other preferences and calls `set()` on startup --
35
+ * which keeps this free of any opinion about storage, and keeps a package from
36
+ * writing to a key the application did not choose.
37
+ */
38
+ class FsColorScheme {
39
+ _document = inject(DOCUMENT);
40
+ _colorScheme = signal('system');
41
+ _systemDark = signal(false);
42
+ _mediaQuery;
43
+ _mediaQueryListener;
44
+ constructor() {
45
+ this._watchSystem();
46
+ }
47
+ /**
48
+ * What was asked for -- 'light', 'dark' or 'system'. For what "system" is
49
+ * currently showing, read `resolved()`.
50
+ */
51
+ get colorScheme() {
52
+ return this._colorScheme.asReadonly();
53
+ }
54
+ /**
55
+ * The appearance actually on screen, with 'system' resolved to what the
56
+ * operating system asks for. Tracks the OS live while set to 'system', so a
57
+ * caller rendering an icon or a label for the current appearance stays right
58
+ * without polling.
59
+ *
60
+ * A computed rather than a method so it can be handed to a template or an
61
+ * effect on its own -- `resolved` passed as a bare reference keeps working,
62
+ * where an unbound method would lose `this`.
63
+ */
64
+ resolved = computed(() => {
65
+ const colorScheme = this._colorScheme();
66
+ if (colorScheme === 'system') {
67
+ return this._systemDark() ? 'dark' : 'light';
68
+ }
69
+ return colorScheme;
70
+ });
71
+ set(colorScheme) {
72
+ this._colorScheme.set(colorScheme);
73
+ this._apply();
74
+ }
75
+ light() {
76
+ this.set('light');
77
+ }
78
+ dark() {
79
+ this.set('dark');
80
+ }
81
+ system() {
82
+ this.set('system');
83
+ }
84
+ /**
85
+ * Flips between light and dark. From 'system' it moves to whichever appearance
86
+ * is NOT showing, so the control always does what it says rather than landing
87
+ * on the appearance already on screen.
88
+ */
89
+ toggle() {
90
+ this.set(this.resolved() === 'dark' ? 'light' : 'dark');
91
+ }
92
+ ngOnDestroy() {
93
+ this._unwatchSystem();
94
+ }
95
+ /**
96
+ * Writes the property <html> rather than <body>: `color-scheme` also tells the
97
+ * browser what to paint the canvas, the scrollbars and the form controls it
98
+ * renders itself, and those follow the root element.
99
+ */
100
+ _apply() {
101
+ const element = this._document?.documentElement;
102
+ if (!element) {
103
+ return;
104
+ }
105
+ element.style.setProperty('color-scheme', COLOR_SCHEME_VALUES[this._colorScheme()]);
106
+ }
107
+ /**
108
+ * Kept current at all times, not only while set to 'system', so that switching
109
+ * to 'system' reports the right appearance immediately instead of waiting for
110
+ * the OS to next change.
111
+ *
112
+ * Guarded because matchMedia is absent when rendering on the server, where
113
+ * there is no device to ask.
114
+ */
115
+ _watchSystem() {
116
+ const view = this._document?.defaultView;
117
+ if (!view?.matchMedia) {
118
+ return;
119
+ }
120
+ this._mediaQuery = view.matchMedia(DARK_QUERY);
121
+ this._systemDark.set(this._mediaQuery.matches);
122
+ this._mediaQueryListener = (event) => {
123
+ this._systemDark.set(event.matches);
124
+ };
125
+ this._mediaQuery.addEventListener('change', this._mediaQueryListener);
126
+ }
127
+ _unwatchSystem() {
128
+ if (this._mediaQuery && this._mediaQueryListener) {
129
+ this._mediaQuery.removeEventListener('change', this._mediaQueryListener);
130
+ this._mediaQuery = null;
131
+ this._mediaQueryListener = null;
132
+ }
133
+ }
134
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsColorScheme, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
135
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsColorScheme, providedIn: 'root' });
136
+ }
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsColorScheme, decorators: [{
138
+ type: Injectable,
139
+ args: [{ providedIn: 'root' }]
140
+ }], ctorParameters: () => [] });
141
+
1
142
  /**
2
- * @firestitch/style - Shared styles and variables.
143
+ * @firestitch/style - Shared styles, tokens and the colour scheme switch.
3
144
  * Import SCSS from '@firestitch/style/styles' or include in angular.json styles.
4
145
  */
5
- const STYLE_VERSION = '18.0.54';
146
+ // Services
6
147
 
7
148
  /**
8
149
  * Generated bundle index. Do not edit.
9
150
  */
10
151
 
11
- export { STYLE_VERSION };
152
+ export { FsColorScheme };
12
153
  //# sourceMappingURL=firestitch-style.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"firestitch-style.mjs","sources":["../../src/public_api.ts","../../src/firestitch-style.ts"],"sourcesContent":["/**\n * @firestitch/style - Shared styles and variables.\n * Import SCSS from '@firestitch/style/styles' or include in angular.json styles.\n */\nexport const STYLE_VERSION = '18.0.54';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":"AAAA;;;AAGG;AACI,MAAM,aAAa,GAAG;;ACJ7B;;AAEG;;;;"}
1
+ {"version":3,"file":"firestitch-style.mjs","sources":["../../src/app/services/color-scheme.service.ts","../../src/public_api.ts","../../src/firestitch-style.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Injectable, OnDestroy, computed, inject, signal } from '@angular/core';\n\n\nexport type FsColorSchemeType = 'light' | 'dark' | 'system';\nexport type FsResolvedColorScheme = 'light' | 'dark';\n\n/**\n * The `color-scheme` value written for each setting. \"system\" is `light dark`:\n * NOT a third appearance, but both offered to the browser so it resolves the one\n * the operating system asks for.\n */\nconst COLOR_SCHEME_VALUES: Record<FsColorSchemeType, string> = {\n light: 'light',\n dark: 'dark',\n system: 'light dark',\n};\n\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\n/**\n * The one switch behind every light/dark decision in every @firestitch package.\n *\n * WHY THIS IS ONE PROPERTY AND NOT A THEME CLASS. Packages express their two\n * appearances with `light-dark()` in CSS, which picks off the `color-scheme`\n * property. Setting it once on <html> re-paints every package at once -- chips,\n * fields, dividers, menus -- with no class to agree on, no component to notify\n * and no stylesheet to reload. Anything that reads the --fs-* tokens follows\n * automatically, including components compiled into other packages.\n *\n * DECLARED, NOT DETECTED. `prefers-color-scheme` reports the DEVICE, and an app\n * whose user chose Light on a dark phone would otherwise fight its own setting.\n * So the media query is read for exactly one purpose -- reporting what \"system\"\n * currently resolves to, via `resolvedColorScheme` -- and never to decide the\n * setting itself. Choosing is the caller's job; this only applies the choice.\n *\n * NOTHING IS PERSISTED. The setting lives for the lifetime of the service, so a\n * reload starts from the default. An app that wants the choice remembered stores\n * it wherever it keeps its other preferences and calls `set()` on startup --\n * which keeps this free of any opinion about storage, and keeps a package from\n * writing to a key the application did not choose.\n */\n@Injectable({ providedIn: 'root' })\nexport class FsColorScheme implements OnDestroy {\n\n private _document = inject(DOCUMENT);\n\n private _colorScheme = signal<FsColorSchemeType>('system');\n private _systemDark = signal<boolean>(false);\n\n private _mediaQuery: MediaQueryList;\n private _mediaQueryListener: (event: MediaQueryListEvent) => void;\n\n constructor() {\n this._watchSystem();\n }\n\n /**\n * What was asked for -- 'light', 'dark' or 'system'. For what \"system\" is\n * currently showing, read `resolved()`.\n */\n public get colorScheme() {\n return this._colorScheme.asReadonly();\n }\n\n /**\n * The appearance actually on screen, with 'system' resolved to what the\n * operating system asks for. Tracks the OS live while set to 'system', so a\n * caller rendering an icon or a label for the current appearance stays right\n * without polling.\n *\n * A computed rather than a method so it can be handed to a template or an\n * effect on its own -- `resolved` passed as a bare reference keeps working,\n * where an unbound method would lose `this`.\n */\n public resolved = computed<FsResolvedColorScheme>(() => {\n const colorScheme = this._colorScheme();\n\n if (colorScheme === 'system') {\n return this._systemDark() ? 'dark' : 'light';\n }\n\n return colorScheme;\n });\n\n public set(colorScheme: FsColorSchemeType): void {\n this._colorScheme.set(colorScheme);\n this._apply();\n }\n\n public light(): void {\n this.set('light');\n }\n\n public dark(): void {\n this.set('dark');\n }\n\n public system(): void {\n this.set('system');\n }\n\n /**\n * Flips between light and dark. From 'system' it moves to whichever appearance\n * is NOT showing, so the control always does what it says rather than landing\n * on the appearance already on screen.\n */\n public toggle(): void {\n this.set(this.resolved() === 'dark' ? 'light' : 'dark');\n }\n\n public ngOnDestroy(): void {\n this._unwatchSystem();\n }\n\n /**\n * Writes the property <html> rather than <body>: `color-scheme` also tells the\n * browser what to paint the canvas, the scrollbars and the form controls it\n * renders itself, and those follow the root element.\n */\n private _apply(): void {\n const element = this._document?.documentElement;\n\n if (!element) {\n return;\n }\n\n element.style.setProperty('color-scheme', COLOR_SCHEME_VALUES[this._colorScheme()]);\n }\n\n /**\n * Kept current at all times, not only while set to 'system', so that switching\n * to 'system' reports the right appearance immediately instead of waiting for\n * the OS to next change.\n *\n * Guarded because matchMedia is absent when rendering on the server, where\n * there is no device to ask.\n */\n private _watchSystem(): void {\n const view = this._document?.defaultView;\n\n if (!view?.matchMedia) {\n return;\n }\n\n this._mediaQuery = view.matchMedia(DARK_QUERY);\n this._systemDark.set(this._mediaQuery.matches);\n\n this._mediaQueryListener = (event: MediaQueryListEvent) => {\n this._systemDark.set(event.matches);\n };\n\n this._mediaQuery.addEventListener('change', this._mediaQueryListener);\n }\n\n private _unwatchSystem(): void {\n if (this._mediaQuery && this._mediaQueryListener) {\n this._mediaQuery.removeEventListener('change', this._mediaQueryListener);\n this._mediaQuery = null;\n this._mediaQueryListener = null;\n }\n }\n\n}\n","/**\n * @firestitch/style - Shared styles, tokens and the colour scheme switch.\n * Import SCSS from '@firestitch/style/styles' or include in angular.json styles.\n */\n\n// Services\nexport { FsColorScheme } from './app/services/color-scheme.service';\n\n// Types\nexport type { FsColorSchemeType, FsResolvedColorScheme } from './app/services/color-scheme.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;AAOA;;;;AAIG;AACH,MAAM,mBAAmB,GAAsC;AAC7D,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,MAAM,EAAE,YAAY;CACrB,CAAC;AAEF,MAAM,UAAU,GAAG,8BAA8B,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;AAqBG;MAEU,aAAa,CAAA;AAEhB,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAE7B,IAAA,YAAY,GAAG,MAAM,CAAoB,QAAQ,CAAC,CAAC;AACnD,IAAA,WAAW,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;AAErC,IAAA,WAAW,CAAiB;AAC5B,IAAA,mBAAmB,CAAuC;AAElE,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,YAAY,EAAE,CAAC;KACrB;AAED;;;AAGG;AACH,IAAA,IAAW,WAAW,GAAA;AACpB,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;KACvC;AAED;;;;;;;;;AASG;AACI,IAAA,QAAQ,GAAG,QAAQ,CAAwB,MAAK;AACrD,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;AAExC,QAAA,IAAI,WAAW,KAAK,QAAQ,EAAE;AAC5B,YAAA,OAAO,IAAI,CAAC,WAAW,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC;SAC9C;AAED,QAAA,OAAO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AC,mBAAmB,GAAG,CAAC,KAA0B,KAAI;YACxD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACtC,SAAC,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;KACvE;IAEO,cAAc,GAAA;QACpB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAChD,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACzE,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACxB,YAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;SACjC;KACF;uGAtHU,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA,CAAA;;2FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;AC1ClC;;;AAGG;AAEH;;ACLA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestitch/style",
3
- "version": "18.0.70",
3
+ "version": "18.0.72",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Firestitch/ngx-style"
package/public_api.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @firestitch/style - Shared styles and variables.
2
+ * @firestitch/style - Shared styles, tokens and the colour scheme switch.
3
3
  * Import SCSS from '@firestitch/style/styles' or include in angular.json styles.
4
4
  */
5
- export declare const STYLE_VERSION = "18.0.54";
5
+ export { FsColorScheme } from './app/services/color-scheme.service';
6
+ export type { FsColorSchemeType, FsResolvedColorScheme } from './app/services/color-scheme.service';
package/styles/_core.scss CHANGED
@@ -1,3 +1,4 @@
1
+ @use 'tokens';
1
2
  @use 'headings';
2
3
  @use 'helpers';
3
4
  @use 'layout';
@@ -8,6 +9,12 @@
8
9
 
9
10
 
10
11
  @mixin core() {
12
+ // FIRST, and it has to be: every block below may read a --fs-* name, and the
13
+ // packages that consume them fall back to a hardcoded pair when the name is
14
+ // missing. Declaring them up front means the cascade reads in the order a
15
+ // person would, even though custom properties resolve at use rather than at
16
+ // declaration.
17
+ @include tokens.tokens();
11
18
  @include headings.headings();
12
19
  @include form-field.form-field();
13
20
  @include helpers.helpers();
@@ -42,13 +42,24 @@
42
42
  // Tokens are set/read under both the v18/v19 --mdc-* names and the
43
43
  // v20+ --mat-form-field-* names so consumers on Material 18-22 all work.
44
44
  .mat-mdc-form-field.mat-form-field-appearance-fill {
45
- --mdc-filled-text-field-container-color: white;
46
- --mdc-filled-text-field-disabled-container-color: #F5F5F5;
47
- --mat-form-field-filled-container-color: white;
48
- --mat-form-field-filled-disabled-container-color: #F5F5F5;
45
+ // THE FILL GROUND, IN BOTH APPEARANCES. These were flat `white` and
46
+ // `#F5F5F5`, declared on the field element itself -- which outranks any
47
+ // :root override a consumer writes, because a custom property declared on
48
+ // the matching element always beats one inherited from the document root.
49
+ // So a host app could not correct these from outside; they had to be fixed
50
+ // here.
51
+ //
52
+ // The light values are unchanged (white, #F5F5F5 as the light half of each
53
+ // pair), so nothing about the light appearance moves. Only the dark half is
54
+ // new, and light-dark() picks between them off the `color-scheme` the host
55
+ // declares -- no class, no input, no media query.
56
+ --mdc-filled-text-field-container-color: var(--fs-color-surface, light-dark(#FFFFFF, #232428));
57
+ --mdc-filled-text-field-disabled-container-color: var(--fs-color-hover, light-dark(#F5F5F5, rgba(255, 255, 255, 0.08)));
58
+ --mat-form-field-filled-container-color: var(--fs-color-surface, light-dark(#FFFFFF, #232428));
59
+ --mat-form-field-filled-disabled-container-color: var(--fs-color-hover, light-dark(#F5F5F5, rgba(255, 255, 255, 0.08)));
49
60
 
50
61
  .mat-mdc-text-field-wrapper {
51
- border: 1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, 0.38)));
62
+ border: 1px solid var(--mdc-outlined-text-field-outline-color, var(--mat-form-field-outlined-outline-color, rgb(127 127 127 / 38%)));
52
63
  border-radius: var(--mdc-outlined-text-field-container-shape, var(--mat-form-field-outlined-container-shape, 4px));
53
64
  }
54
65
 
@@ -62,7 +73,10 @@
62
73
 
63
74
  &:hover:not(.mat-focused):not(.mat-form-field-invalid):not(.mat-form-field-disabled) {
64
75
  .mat-mdc-text-field-wrapper {
65
- border-color: var(--mdc-outlined-text-field-hover-outline-color, var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, 0.87)));
76
+ // The last-resort fallback is a PAIR, not a flat black: this renders
77
+ // when @firestitch/style's material layer is absent, and a black hover
78
+ // border on a dark ground reads as a hole punched in the field.
79
+ border-color: var(--mdc-outlined-text-field-hover-outline-color, var(--mat-form-field-outlined-hover-outline-color, light-dark(rgba(0, 0, 0, 0.87), #E8EDEC)));
66
80
  }
67
81
  }
68
82
 
@@ -95,7 +109,7 @@
95
109
  }
96
110
 
97
111
  &.mat-form-field-disabled .mat-mdc-text-field-wrapper {
98
- border-color: var(--mdc-outlined-text-field-disabled-outline-color, var(--mat-form-field-outlined-disabled-outline-color, rgba(0, 0, 0, 0.06)));
112
+ border-color: var(--mdc-outlined-text-field-disabled-outline-color, var(--mat-form-field-outlined-disabled-outline-color, light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.12))));
99
113
  }
100
114
  }
101
115
 
@@ -1,5 +1,13 @@
1
1
  @use '../variables';
2
2
 
3
+ $gaps: (
4
+ 'none': 0px,
5
+ 'xs': 5px,
6
+ 'sm': 10px,
7
+ 'md': 20px,
8
+ 'lg': 40px,
9
+ );
10
+
3
11
  @mixin layout() {
4
12
  .fs-row,
5
13
  span[class*='fs-row'],
@@ -139,54 +147,24 @@
139
147
  flex-direction: column;
140
148
  }
141
149
 
142
- &[#{$attributeName}*='.gap-none'],
143
- &[#{$attributeName}*='.row-gap-none'] {
144
- row-gap: 0px;
145
- }
146
-
147
- &[#{$attributeName}*='.gap-xs'],
148
- &[#{$attributeName}*='.row-gap-xs'] {
149
- row-gap: 5px;
150
- }
151
-
152
- &[#{$attributeName}*='.gap-sm'],
153
- &[#{$attributeName}*='.row-gap-sm'] {
154
- row-gap: 10px;
155
- }
156
-
157
- &[#{$attributeName}*='.gap-md'],
158
- &[#{$attributeName}*='.row-gap-md'] {
159
- row-gap: 20px;
160
- }
161
-
162
- &[#{$attributeName}*='.gap-lg'],
163
- &[#{$attributeName}*='.row-gap-lg'] {
164
- row-gap: 40px;
165
- }
166
-
167
- &[#{$attributeName}*='.gap-none'],
168
- &[#{$attributeName}*='.column-gap-none'] {
169
- column-gap: 0px;
170
- }
171
-
172
- &[#{$attributeName}*='.gap-xs'],
173
- &[#{$attributeName}*='.column-gap-xs'] {
174
- column-gap: 5px;
175
- }
176
-
177
- &[#{$attributeName}*='.gap-sm'],
178
- &[#{$attributeName}*='.column-gap-sm'] {
179
- column-gap: 10px;
150
+ // All selectors below have the same specificity, so source order decides the winner.
151
+ // Emit every .gap-* size first and every axis-specific size after, so .row-gap-* and
152
+ // .column-gap-* always override .gap-*, whatever sizes they happen to name.
153
+ @each $name, $size in $gaps {
154
+ &[#{$attributeName}*='.gap-#{$name}'] {
155
+ row-gap: $size;
156
+ column-gap: $size;
157
+ }
180
158
  }
181
159
 
182
- &[#{$attributeName}*='.gap-md'],
183
- &[#{$attributeName}*='.column-gap-md'] {
184
- column-gap: 20px;
185
- }
160
+ @each $name, $size in $gaps {
161
+ &[#{$attributeName}*='.row-gap-#{$name}'] {
162
+ row-gap: $size;
163
+ }
186
164
 
187
- &[#{$attributeName}*='.gap-lg'],
188
- &[#{$attributeName}*='.column-gap-lg'] {
189
- column-gap: 40px;
165
+ &[#{$attributeName}*='.column-gap-#{$name}'] {
166
+ column-gap: $size;
167
+ }
190
168
  }
191
169
 
192
170
  &[#{$attributeName}*='.align-start'] {
@@ -0,0 +1,88 @@
1
+ // =============================================================================
2
+ // THE SHARED COLOUR CONTRACT
3
+ // =============================================================================
4
+ // The names every @firestitch package reads instead of hardcoding a hex.
5
+ //
6
+ // WHY light-dark() AND NOT A THEME CLASS. These packages have to work unchanged
7
+ // in two worlds at once: legacy apps on Material 2 and new apps on Material 3.
8
+ // A class-based swap would mean every host app agreeing on the same class name
9
+ // and setting it; light-dark() reads the `color-scheme` property, which is the
10
+ // ONE mechanism both Material versions and the browser itself already honour.
11
+ // A package that reads these names needs to know nothing about its host.
12
+ //
13
+ // THE HOST APP MUST DECLARE color-scheme. Without it the browser resolves every
14
+ // light-dark() to its LIGHT value — the pair is not a detector, it is a picker,
15
+ // and `color-scheme` is what it picks from:
16
+ //
17
+ // :root { color-scheme: dark; }
18
+ // .my-light { color-scheme: light; }
19
+ //
20
+ // DECLARED, NOT DETECTED. Nothing here reads prefers-color-scheme. That media
21
+ // query reports the DEVICE, and an app whose user chose Light on a dark phone
22
+ // would then fight its own setting. Resolving the choice is the app's job; this
23
+ // file only supplies the two values it picks between.
24
+ //
25
+ // EVERY CONSUMER KEEPS ITS OWN FALLBACK. A package reads these as
26
+ // `var(--fs-hairline, light-dark(#f0f0f0, rgba(255,255,255,.22)))` so that it
27
+ // still renders correctly when @firestitch/style is not installed at all. The
28
+ // fallback is the contract's default restated locally — keep the two in step.
29
+ //
30
+ // These are CSS custom properties, not Sass variables, on purpose: they resolve
31
+ // in the browser at paint time, so one declaration re-skins a whole tree
32
+ // including components compiled into other packages. A Sass variable is baked
33
+ // at build time and can never do that.
34
+
35
+ @mixin tokens() {
36
+ :root {
37
+ // ===== INK =====
38
+ // Three levels. Full-strength is for the text that matters; muted carries
39
+ // labels and secondary copy; faint is for text that is present but quiet.
40
+ --fs-color-text: light-dark(rgba(0, 0, 0, 0.87), #E8EDEC);
41
+ --fs-color-text-muted: light-dark(rgba(0, 0, 0, 0.54), #97A5A6);
42
+ --fs-color-text-faint: light-dark(rgba(0, 0, 0, 0.38), #6A7779);
43
+
44
+ // ===== SURFACES =====
45
+ // The ground a component sits on, and the surface it draws for itself.
46
+ // `raised` is for the surface that floats above the page — a menu panel, a
47
+ // dropdown — which on a dark ground must be LIGHTER, not darker.
48
+ --fs-color-surface: light-dark(#FFFFFF, #232428);
49
+ --fs-color-surface-raised: light-dark(#FFFFFF, #292A2F);
50
+
51
+ // ===== LINES =====
52
+ // The hairline does most of the structural work: chip outlines, dividers,
53
+ // field borders. Deliberately low-contrast in both modes — it should read
54
+ // as a fold in the surface, not as a drawn line.
55
+ --fs-hairline: light-dark(#f0f0f0, rgba(255, 255, 255, 0.22));
56
+ --fs-hairline-strong: light-dark(rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.38));
57
+
58
+ // ===== BRAND =====
59
+ // The application's own colour, and the one name a package reads to render
60
+ // anything "primary": a selected filter chip's outline and text, an active
61
+ // state, an accent rule.
62
+ //
63
+ // A PACKAGE NEVER READS AN APPLICATION'S OWN NAME. Apps carry their brand
64
+ // under whatever name they like -- set at runtime from a setting, hardcoded
65
+ // in a palette, derived from a theme -- and the app maps that onto this one
66
+ // name at its root:
67
+ //
68
+ // :root { --fs-color-primary: var(--my-app-brand-colour); }
69
+ //
70
+ // so nothing inside a package has to know the application exists. Leaving it
71
+ // unmapped is fine: the default below is a neutral slate that reads on both
72
+ // grounds, so a package renders sensibly in an app that has set nothing.
73
+ //
74
+ // NOT PER-SCHEME BY DEFAULT. A brand colour is picked to work on its own
75
+ // ground, so this is a single value rather than a light-dark() pair -- an app
76
+ // whose brand does need to shift between schemes maps it to a pair of its own
77
+ // when it sets the name above.
78
+ --fs-color-primary: #1B474E;
79
+
80
+ // ===== FEEDBACK =====
81
+ // The wash under a hovered or pressed surface. A package must never express
82
+ // hover as filter: brightness() — that DARKENS, which is right on a white
83
+ // page and backwards on a dark one. A translucent wash reads correctly in
84
+ // both modes because it takes its tone from whatever is behind it.
85
+ --fs-color-hover: light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.08));
86
+ --fs-color-selected: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
87
+ }
88
+ }
@@ -18,7 +18,24 @@
18
18
  --mat-dialog-supporting-text-color: #{variables.$body-color};
19
19
 
20
20
  --mdc-elevated-card-container-shape: 12px;
21
+ // FIELD OUTLINE, PLACEHOLDER AND HOVER, IN BOTH APPEARANCES.
22
+ //
23
+ // The resting outline is deliberately a NEUTRAL grey at 38% -- it reads on a
24
+ // white page and on a dark one without needing a pair, which is why it is
25
+ // stated once rather than through light-dark().
26
+ //
27
+ // The rest cannot do that. Material's light theme emits them as flat blacks
28
+ // (rgba(0,0,0,.6) for the placeholder and the hover label, rgba(0,0,0,.87)
29
+ // for the hover outline), and black on a dark ground is invisible -- the
30
+ // placeholder disappears and the hover border reads as a hole. Each keeps
31
+ // its current light value as the light half, so nothing about the light
32
+ // appearance changes; only the dark half is new.
21
33
  --mdc-outlined-text-field-outline-color: rgb(127 127 127 / 38%);
34
+ --mdc-outlined-text-field-hover-outline-color: var(--fs-color-text, light-dark(rgba(0, 0, 0, 0.87), #E8EDEC));
35
+ --mdc-outlined-text-field-input-text-placeholder-color: var(--fs-color-text-muted, light-dark(rgba(0, 0, 0, 0.6), #97A5A6));
36
+ --mdc-filled-text-field-input-text-placeholder-color: var(--fs-color-text-muted, light-dark(rgba(0, 0, 0, 0.6), #97A5A6));
37
+ --mdc-outlined-text-field-hover-label-text-color: var(--fs-color-text-muted, light-dark(rgba(0, 0, 0, 0.6), #97A5A6));
38
+ --mdc-filled-text-field-hover-label-text-color: var(--fs-color-text-muted, light-dark(rgba(0, 0, 0, 0.6), #97A5A6));
22
39
 
23
40
  /*
24
41
  * Buttons < Angular 20