@firestitch/style 18.1.2 → 18.2.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/styles/_tokens.scss +82 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestitch/style",
3
- "version": "18.1.2",
3
+ "version": "18.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Firestitch/ngx-style"
@@ -3,29 +3,50 @@
3
3
  // =============================================================================
4
4
  // The names every @firestitch package reads instead of hardcoding a hex.
5
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.
6
+ // DARK IS THE BASE; LIGHT IS AN OVERRIDE. The dark values are declared plainly
7
+ // on :root, and a second block restates the light ones when the host marks
8
+ // itself light. No light-dark() in any declaration here — read on.
12
9
  //
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:
10
+ // WHY NOT light-dark(), WHICH THIS FILE USED UNTIL 18.2.0. It was the right
11
+ // idea and it does not survive the build. light-dark() needs Chrome 123+, and
12
+ // a host whose browserslist still includes an older engine gets it DOWNLEVELLED
13
+ // by esbuild — flattened to its LIGHT half, unconditionally. The failure is
14
+ // silent and total: every token resolves to its light value on a dark ground,
15
+ // so a checkbox outline computes to rgba(0, 0, 0, 0.54) — black on a dark
16
+ // panel, invisible. Nothing warns, the source file looks correct, and the
17
+ // served CSS is the only place the truth shows.
16
18
  //
17
- // :root { color-scheme: dark; }
18
- // .my-light { color-scheme: light; }
19
+ // That is not a browser-support question a shared package gets to have an
20
+ // opinion about. A host app chooses its own browserslist for its own reasons,
21
+ // and a colour contract that quietly inverts on some of those choices is
22
+ // broken, not merely modern.
19
23
  //
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
+ // HOW A HOST SAYS "LIGHT". Either marker works, and an app almost certainly
25
+ // already sets one:
26
+ //
27
+ // <html class="theme-light"> or <html data-theme="light">
28
+ //
29
+ // A host that marks nothing gets the dark values. That is a deliberate default
30
+ // rather than a guess: these packages render on dark app grounds, and a dark
31
+ // token on a light page reads as heavy, while a light token on a dark page
32
+ // disappears completely. Failing toward "too strong" beats failing toward
33
+ // invisible.
34
+ //
35
+ // STILL DECLARED, NOT DETECTED. Nothing here reads prefers-color-scheme. That
36
+ // media query reports the DEVICE, and an app whose user chose Light on a dark
37
+ // phone would then fight its own setting. Resolving the choice is the app's
38
+ // job; this file supplies the values and reads the marker the app already sets.
39
+ //
40
+ // KEEP DECLARING color-scheme TOO. It is what paints the browser's own chrome —
41
+ // caret, scrollbars, autofill, native control internals — which no custom
42
+ // property can reach. It no longer drives these tokens, but it is not
43
+ // redundant.
24
44
  //
25
45
  // EVERY CONSUMER KEEPS ITS OWN FALLBACK. A package reads these as
26
46
  // `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.
47
+ // still renders correctly when @firestitch/style is not installed at all. Those
48
+ // fallbacks keep light-dark() and that is fine — they fire only when the token
49
+ // is undefined, which is exactly the case where this file was never loaded.
29
50
  //
30
51
  // These are CSS custom properties, not Sass variables, on purpose: they resolve
31
52
  // in the browser at paint time, so one declaration re-skins a whole tree
@@ -37,9 +58,9 @@
37
58
  // ===== INK =====
38
59
  // Three levels. Full-strength is for the text that matters; muted carries
39
60
  // 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);
61
+ --fs-color-text: #E8EDEC;
62
+ --fs-color-text-muted: #97A5A6;
63
+ --fs-color-text-faint: #6A7779;
43
64
 
44
65
  // ===== SURFACE =====
45
66
  // ONE surface colour for everything that is a surface: a page, a dialog, a
@@ -59,14 +80,18 @@
59
80
  // separates with a shadow, a hairline or a blur; if a genuine need for a
60
81
  // second surface colour appears later, add it then, with the case that
61
82
  // justifies it. Do not reintroduce `raised` as a default.
62
- --fs-surface-background: light-dark(#FFFFFF, #232428);
83
+ --fs-surface-background: #232428;
63
84
 
64
85
  // ===== LINES =====
65
86
  // The hairline does most of the structural work: chip outlines, dividers,
66
87
  // field borders. Deliberately low-contrast in both modes — it should read
67
88
  // as a fold in the surface, not as a drawn line.
68
- --fs-hairline: light-dark(#f0f0f0, rgba(255, 255, 255, 0.22));
69
- --fs-hairline-strong: light-dark(rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.38));
89
+ //
90
+ // NOT FOR A CONTROL OUTLINE. An empty checkbox or radio is the control's
91
+ // whole resting state, not a fold in a surface, so it reads
92
+ // --fs-color-text-muted instead — see _form-controls.scss.
93
+ --fs-hairline: rgba(255, 255, 255, 0.22);
94
+ --fs-hairline-strong: rgba(255, 255, 255, 0.38);
70
95
 
71
96
  // ===== BRAND =====
72
97
  // The application's own colour, and the one name a package reads to render
@@ -95,7 +120,39 @@
95
120
  // hover as filter: brightness() — that DARKENS, which is right on a white
96
121
  // page and backwards on a dark one. A translucent wash reads correctly in
97
122
  // both modes because it takes its tone from whatever is behind it.
98
- --fs-color-hover: light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.08));
99
- --fs-color-selected: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
123
+ --fs-color-hover: rgba(255, 255, 255, 0.08);
124
+ --fs-color-selected: rgba(255, 255, 255, 0.12);
125
+ }
126
+
127
+ // ===========================================================================
128
+ // LIGHT MODE
129
+ // ===========================================================================
130
+ // The same names restated with their light values. Custom properties inherit,
131
+ // so every consumer keeps reading one name and silently gets the right value
132
+ // — a package component never learns which mode it is in, which is the whole
133
+ // point of the contract.
134
+ //
135
+ // BOTH MARKERS, because apps already differ and neither is worth a migration:
136
+ // `.theme-light` is what the CloudCure apps set from their ThemeService,
137
+ // `[data-theme="light"]` is the broader web convention. They are listed as
138
+ // separate selectors rather than one `:is()` so the specificity stays a flat
139
+ // 0-1-0 in every engine.
140
+ //
141
+ // --fs-color-primary is absent on purpose. A brand colour is picked to work
142
+ // on its own ground and does not flip with the scheme; an app whose brand
143
+ // genuinely needs to shift maps the name to a pair of its own.
144
+ :root.theme-light,
145
+ :root[data-theme='light'] {
146
+ --fs-color-text: rgba(0, 0, 0, 0.87);
147
+ --fs-color-text-muted: rgba(0, 0, 0, 0.54);
148
+ --fs-color-text-faint: rgba(0, 0, 0, 0.38);
149
+
150
+ --fs-surface-background: #FFFFFF;
151
+
152
+ --fs-hairline: #f0f0f0;
153
+ --fs-hairline-strong: rgba(0, 0, 0, 0.38);
154
+
155
+ --fs-color-hover: rgba(0, 0, 0, 0.04);
156
+ --fs-color-selected: rgba(0, 0, 0, 0.08);
100
157
  }
101
158
  }