@firestitch/style 18.4.1 → 18.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestitch/style",
3
- "version": "18.4.1",
3
+ "version": "18.4.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Firestitch/ngx-style"
@@ -68,6 +68,38 @@
68
68
  // overlay attached to <body>, outside any app shell class, so a scoped block
69
69
  // cannot reach it - the mistake that left dialog buttons unbranded.
70
70
 
71
+ // THE INK - the tokens Material 2 re-declares on the control itself, written
72
+ // once here because they are declared twice: on :root with the rest of their
73
+ // family, and again on Material's own selectors (see THE INK, AGAIN, ON THE
74
+ // CONTROL below). Only the half that swaps with the scheme - a label and an
75
+ // empty outline - never the brand.
76
+
77
+ @mixin -checkbox-ink() {
78
+ // No label here: Material leaves the checkbox's label tokens on :root.
79
+ --mat-checkbox-unselected-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
80
+ --mat-checkbox-unselected-hover-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
81
+ --mat-checkbox-unselected-focus-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
82
+ --mat-checkbox-unselected-pressed-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
83
+ }
84
+
85
+ @mixin -radio-ink() {
86
+ --mat-radio-unselected-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
87
+ --mat-radio-unselected-hover-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
88
+ --mat-radio-unselected-focus-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
89
+ --mat-radio-unselected-pressed-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
90
+
91
+ --mat-radio-label-text-color: var(--fs-color-text, rgba(0, 0, 0, 0.87));
92
+ --mat-radio-disabled-label-color: var(--fs-color-text-faint, rgba(0, 0, 0, 0.38));
93
+ }
94
+
95
+ @mixin -chip-ink() {
96
+ --mat-chip-label-text-color: var(--fs-color-text, rgba(0, 0, 0, 0.87));
97
+ }
98
+
99
+ @mixin -pseudo-checkbox-ink() {
100
+ --mat-pseudo-checkbox-full-unselected-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
101
+ }
102
+
71
103
  @mixin form-controls() {
72
104
  :root {
73
105
  // =========================================================================
@@ -89,10 +121,7 @@
89
121
  // pick for its dividers. --fs-color-text-muted is the token that means
90
122
  // "visible but secondary", which is the job, and it lands near Material's
91
123
  // own default (0.54) rather than under it.
92
- --mat-checkbox-unselected-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
93
- --mat-checkbox-unselected-hover-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
94
- --mat-checkbox-unselected-focus-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
95
- --mat-checkbox-unselected-pressed-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
124
+ @include -checkbox-ink();
96
125
 
97
126
  // Checked: the brand fills the box and the checkmark sits on it. The
98
127
  // checkmark reads the SURFACE colour rather than white, so it stays legible
@@ -119,18 +148,13 @@
119
148
  // =========================================================================
120
149
  // Same three questions as the checkbox, same answers - the two controls
121
150
  // differ in shape and in whether they are exclusive, never in colour.
122
- --mat-radio-unselected-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
123
- --mat-radio-unselected-hover-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
124
- --mat-radio-unselected-focus-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
125
- --mat-radio-unselected-pressed-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
151
+ @include -radio-ink();
126
152
 
127
153
  --mat-radio-selected-icon-color: var(--fs-color-primary, #{variables.$primary-color});
128
154
  --mat-radio-selected-hover-icon-color: var(--fs-color-primary, #{variables.$primary-color});
129
155
  --mat-radio-selected-focus-icon-color: var(--fs-color-primary, #{variables.$primary-color});
130
156
  --mat-radio-selected-pressed-icon-color: var(--fs-color-primary, #{variables.$primary-color});
131
157
 
132
- --mat-radio-label-text-color: var(--fs-color-text, rgba(0, 0, 0, 0.87));
133
- --mat-radio-disabled-label-color: var(--fs-color-text-faint, rgba(0, 0, 0, 0.38));
134
158
  --mat-radio-disabled-unselected-icon-color: var(--fs-hairline, #f0f0f0);
135
159
  --mat-radio-disabled-selected-icon-color: var(--fs-hairline-strong, rgba(0, 0, 0, 0.38));
136
160
  --mat-radio-ripple-color: var(--fs-color-hover, rgba(0, 0, 0, 0.04));
@@ -202,7 +226,7 @@
202
226
  // (unselected) chip takes the hover wash rather than the page ground - that
203
227
  // is what separates it from whatever it sits on without a border.
204
228
  --mat-chip-elevated-container-color: var(--fs-color-hover, rgba(0, 0, 0, 0.04));
205
- --mat-chip-label-text-color: var(--fs-color-text, rgba(0, 0, 0, 0.87));
229
+ @include -chip-ink();
206
230
  --mat-chip-outline-color: var(--fs-hairline-strong, rgba(0, 0, 0, 0.38));
207
231
  --mat-chip-focus-outline-color: var(--fs-color-primary, #{variables.$primary-color});
208
232
 
@@ -234,7 +258,7 @@
234
258
  // FULL is the variant that draws a box; MINIMAL draws only a checkmark with
235
259
  // no container. Both are themed: an app choosing either gets a control that
236
260
  // reads, and the two never disagree about what "selected" looks like.
237
- --mat-pseudo-checkbox-full-unselected-icon-color: var(--fs-color-text-muted, rgba(0, 0, 0, 0.54));
261
+ @include -pseudo-checkbox-ink();
238
262
  --mat-pseudo-checkbox-full-selected-icon-color: var(--fs-color-primary, #{variables.$primary-color});
239
263
  --mat-pseudo-checkbox-full-selected-checkmark-color: var(--fs-surface-background, #FFFFFF);
240
264
 
@@ -248,6 +272,75 @@
248
272
  --mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--fs-color-text-faint, rgba(0, 0, 0, 0.38));
249
273
  }
250
274
 
275
+ // ===========================================================================
276
+ // THE INK, AGAIN, ON THE CONTROL
277
+ // ===========================================================================
278
+ // Material 2 does not leave the tokens above on :root. Its theme re-declares
279
+ // part of each family on the control itself, at the LIGHT theme's values,
280
+ // and a value declared on the element beats one it inherits from :root. So
281
+ // on a dark ground, whatever the block above said:
282
+ //
283
+ // radio label and empty circle near-black .mat-mdc-radio-button.mat-primary / .mat-accent / .mat-warn
284
+ // checkbox empty box near-black .mat-mdc-checkbox.mat-primary / .mat-warn
285
+ // list option empty circle or box near-black .mdc-list-item__start / __end, .mat-mdc-list-option (+ palette)
286
+ // chip label near-black .mat-mdc-standard-chip
287
+ // pseudo-checkbox empty box near-black .mat-primary / .mat-accent / .mat-warn (its panel)
288
+ //
289
+ // An app could only get the values it had already set by restating them on
290
+ // Material's selectors itself. So the same values go on the same selectors
291
+ // here. With :root in front they match Material's specificity when an app
292
+ // includes its theme inside :root - a tie this sheet wins by coming after the
293
+ // theme, the order the :root block above already needs - and beat it outright
294
+ // when the theme sits at the top level.
295
+ //
296
+ // ONLY THE INK. Material's rules carry the brand too (the selected fill, warn
297
+ // red), and those stay Material's: an app's Material palette is its real
298
+ // brand, --fs-color-primary only this package's guess at it. Disabled icons,
299
+ // ripples and state layers stay Material's as well - Material applies its own
300
+ // opacity on top of those, so this package's already-translucent values would
301
+ // all but vanish.
302
+ //
303
+ // Slide toggle and slider need nothing here: what Material re-declares on
304
+ // them is palette only.
305
+
306
+ // A selection list's radio or checkbox is themed through the list item's
307
+ // slots rather than the control, so those selectors sit with the control's.
308
+ :root .mat-mdc-radio-button.mat-primary,
309
+ :root .mat-mdc-radio-button.mat-accent,
310
+ :root .mat-mdc-radio-button.mat-warn,
311
+ :root .mdc-list-item__start,
312
+ :root .mdc-list-item__end,
313
+ :root .mat-accent .mdc-list-item__start,
314
+ :root .mat-accent .mdc-list-item__end,
315
+ :root .mat-warn .mdc-list-item__start,
316
+ :root .mat-warn .mdc-list-item__end {
317
+ @include -radio-ink();
318
+ }
319
+
320
+ :root .mat-mdc-checkbox.mat-primary,
321
+ :root .mat-mdc-checkbox.mat-warn,
322
+ :root .mat-mdc-list-option,
323
+ :root .mat-mdc-list-option.mat-accent,
324
+ :root .mat-mdc-list-option.mat-warn {
325
+ @include -checkbox-ink();
326
+ }
327
+
328
+ // The selected chip's label is the palette's on-primary, declared on
329
+ // .mat-mdc-chip-selected.mat-primary and friends - more specific than this,
330
+ // so it is left alone.
331
+ :root .mat-mdc-standard-chip {
332
+ @include -chip-ink();
333
+ }
334
+
335
+ // Material themes the pseudo-checkbox through whatever ancestor carries the
336
+ // palette class (a select panel is .mat-primary), not through its own
337
+ // element, so the override has to sit on the same bare classes.
338
+ :root .mat-primary,
339
+ :root .mat-accent,
340
+ :root .mat-warn {
341
+ @include -pseudo-checkbox-ink();
342
+ }
343
+
251
344
  // ===========================================================================
252
345
  // THE EMPTY BOX'S INTERIOR
253
346
  // ===========================================================================
@@ -254,14 +254,5 @@
254
254
 
255
255
  --fs-color-hover: rgba(255, 255, 255, 0.08);
256
256
  --fs-color-selected: rgba(255, 255, 255, 0.12);
257
-
258
- // A FILLED CHIP HOVERS BY BRIGHTENING ON A DARK GROUND. @firestitch/chip
259
- // paints its fill as an INLINE style, which beats any stylesheet rule that
260
- // is not !important, so its hover has to be a filter rather than a colour —
261
- // and a filter is a function, not a colour, so there is nothing for a colour
262
- // token to carry. The chip names the AMOUNT instead and this sets it: 90%
263
- // (darken) is the light default declared in the chip itself, and dark has to
264
- // go the other way or a hovered chip recedes into the page.
265
- --fs-chip-hover-brightness: 125%;
266
257
  }
267
258
  }