@firestitch/style 18.0.70 → 18.0.71

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.0.70",
3
+ "version": "18.0.71",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Firestitch/ngx-style"
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();
@@ -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,66 @@
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
+ // ===== FEEDBACK =====
59
+ // The wash under a hovered or pressed surface. A package must never express
60
+ // hover as filter: brightness() — that DARKENS, which is right on a white
61
+ // page and backwards on a dark one. A translucent wash reads correctly in
62
+ // both modes because it takes its tone from whatever is behind it.
63
+ --fs-color-hover: light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.08));
64
+ --fs-color-selected: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.12));
65
+ }
66
+ }