@uncinq/css-components 1.19.0 → 1.21.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.
@@ -42,7 +42,7 @@
42
42
  background-color: var(--btn-color-background-hover);
43
43
  border-color: var(--btn-color-border-hover);
44
44
  box-shadow: var(--btn-shadow-hover);
45
- color: var(--btn-color-text-hover, var(--btn-color-text));
45
+ color: var(--btn-color-text-hover);
46
46
  text-decoration-color: var(--btn-color-text-decoration-hover);
47
47
  }
48
48
  }
@@ -59,6 +59,7 @@
59
59
  --btn-color-border: var(--color-brand);
60
60
  --btn-color-border-hover: var(--color-brand-hover);
61
61
  --btn-color-text: var(--color-text-on-brand);
62
+ --btn-color-text-hover: var(--color-text-on-brand);
62
63
  }
63
64
 
64
65
  .btn-control {
@@ -76,6 +77,7 @@
76
77
  --btn-color-border: var(--color-danger);
77
78
  --btn-color-border-hover: var(--color-danger-hover);
78
79
  --btn-color-text: var(--color-text-on-danger);
80
+ --btn-color-text-hover: var(--color-text-on-danger);
79
81
  }
80
82
 
81
83
  .btn-dark {
@@ -84,6 +86,7 @@
84
86
  --btn-color-border: var(--color-dark);
85
87
  --btn-color-border-hover: var(--color-dark-hover);
86
88
  --btn-color-text: var(--color-text-on-dark);
89
+ --btn-color-text-hover: var(--color-text-on-dark);
87
90
  }
88
91
 
89
92
  .btn-ghost {
@@ -101,6 +104,7 @@
101
104
  --btn-color-border: var(--color-info);
102
105
  --btn-color-border-hover: var(--color-info-hover);
103
106
  --btn-color-text: var(--color-text-on-info);
107
+ --btn-color-text-hover: var(--color-text-on-info);
104
108
  }
105
109
 
106
110
  .btn-light {
@@ -109,6 +113,7 @@
109
113
  --btn-color-border: var(--color-light);
110
114
  --btn-color-border-hover: var(--color-light-hover);
111
115
  --btn-color-text: var(--color-text-on-light);
116
+ --btn-color-text-hover: var(--color-text-on-light);
112
117
  }
113
118
 
114
119
  .btn-link {
@@ -133,6 +138,7 @@
133
138
  --btn-color-border: var(--color-neutral);
134
139
  --btn-color-border-hover: var(--color-neutral-hover);
135
140
  --btn-color-text: var(--color-text-on-neutral);
141
+ --btn-color-text-hover: var(--color-text-on-neutral);
136
142
  }
137
143
 
138
144
  .btn-primary {
@@ -141,6 +147,7 @@
141
147
  --btn-color-border: var(--color-brand);
142
148
  --btn-color-border-hover: var(--color-brand-hover);
143
149
  --btn-color-text: var(--color-text-on-brand);
150
+ --btn-color-text-hover: var(--color-text-on-brand);
144
151
  }
145
152
 
146
153
  .btn-secondary {
@@ -149,6 +156,7 @@
149
156
  --btn-color-border: var(--color-neutral);
150
157
  --btn-color-border-hover: var(--color-neutral-hover);
151
158
  --btn-color-text: var(--color-text-on-neutral);
159
+ --btn-color-text-hover: var(--color-text-on-neutral);
152
160
  }
153
161
 
154
162
  .btn-success {
@@ -157,6 +165,7 @@
157
165
  --btn-color-border: var(--color-success);
158
166
  --btn-color-border-hover: var(--color-success-hover);
159
167
  --btn-color-text: var(--color-text-on-success);
168
+ --btn-color-text-hover: var(--color-text-on-success);
160
169
  }
161
170
 
162
171
  .btn-warning {
@@ -165,6 +174,7 @@
165
174
  --btn-color-border: var(--color-warning);
166
175
  --btn-color-border-hover: var(--color-warning-hover);
167
176
  --btn-color-text: var(--color-text-on-warning);
177
+ --btn-color-text-hover: var(--color-text-on-warning);
168
178
  }
169
179
 
170
180
  /* Sizes */
@@ -61,11 +61,20 @@
61
61
  /* ── Panel ─────────────────────────────────────────────────────── */
62
62
 
63
63
  :where(.modal, .drawer) {
64
+ /* The panel paints its own background, so it restates the whole text
65
+ context a host may have set for its own (a header recolours text,
66
+ muted text, surtitles and links). Muted and surtitle are derived again
67
+ here: a value derived on an ancestor is inherited already computed, so
68
+ it would keep the host's colour. */
69
+ --color-credit: var(--color-text-muted);
64
70
  --color-link: var(--panel-color-text);
65
71
  --color-link-active: var(--panel-color-text-active);
66
72
  --color-link-hover: var(--panel-color-text-hover);
73
+ --color-text: var(--panel-color-text);
74
+ --color-text-muted: oklch(from var(--color-text) l c h / var(--opacity-muted));
67
75
  --nav-color-text: var(--color-link);
68
76
  --nav-color-text-active: var(--color-link-active);
77
+ --surtitle-color-text: var(--color-text-muted);
69
78
 
70
79
  background-color: var(--panel-color-background);
71
80
  border: 0;
@@ -175,11 +184,15 @@
175
184
  them invalid at computed-value time rather than page-valued, and every
176
185
  link would fall back to the surrounding text colour instead of the
177
186
  site's link colour. Keep this list in step with the panel rule above. */
187
+ --color-credit: inherit;
178
188
  --color-link: inherit;
179
189
  --color-link-active: inherit;
180
190
  --color-link-hover: inherit;
191
+ --color-text: inherit;
192
+ --color-text-muted: inherit;
181
193
  --nav-color-text: inherit;
182
194
  --nav-color-text-active: inherit;
195
+ --surtitle-color-text: inherit;
183
196
 
184
197
  background-color: transparent;
185
198
  block-size: auto;
@@ -224,11 +237,15 @@
224
237
  them invalid at computed-value time rather than page-valued, and every
225
238
  link would fall back to the surrounding text colour instead of the
226
239
  site's link colour. Keep this list in step with the panel rule above. */
240
+ --color-credit: inherit;
227
241
  --color-link: inherit;
228
242
  --color-link-active: inherit;
229
243
  --color-link-hover: inherit;
244
+ --color-text: inherit;
245
+ --color-text-muted: inherit;
230
246
  --nav-color-text: inherit;
231
247
  --nav-color-text-active: inherit;
248
+ --surtitle-color-text: inherit;
232
249
 
233
250
  background-color: transparent;
234
251
  block-size: auto;
@@ -273,11 +290,15 @@
273
290
  them invalid at computed-value time rather than page-valued, and every
274
291
  link would fall back to the surrounding text colour instead of the
275
292
  site's link colour. Keep this list in step with the panel rule above. */
293
+ --color-credit: inherit;
276
294
  --color-link: inherit;
277
295
  --color-link-active: inherit;
278
296
  --color-link-hover: inherit;
297
+ --color-text: inherit;
298
+ --color-text-muted: inherit;
279
299
  --nav-color-text: inherit;
280
300
  --nav-color-text-active: inherit;
301
+ --surtitle-color-text: inherit;
281
302
 
282
303
  background-color: transparent;
283
304
  block-size: auto;
@@ -322,11 +343,15 @@
322
343
  them invalid at computed-value time rather than page-valued, and every
323
344
  link would fall back to the surrounding text colour instead of the
324
345
  site's link colour. Keep this list in step with the panel rule above. */
346
+ --color-credit: inherit;
325
347
  --color-link: inherit;
326
348
  --color-link-active: inherit;
327
349
  --color-link-hover: inherit;
350
+ --color-text: inherit;
351
+ --color-text-muted: inherit;
328
352
  --nav-color-text: inherit;
329
353
  --nav-color-text-active: inherit;
354
+ --surtitle-color-text: inherit;
330
355
 
331
356
  background-color: transparent;
332
357
  block-size: auto;
@@ -72,6 +72,7 @@
72
72
  --btn-color-border: var(--color-light);
73
73
  --btn-color-border-hover: var(--color-light-hover);
74
74
  --btn-color-text: var(--color-text-on-light);
75
+ --btn-color-text-hover: var(--color-text-on-light);
75
76
  --color-heading: var(--push-color);
76
77
  --color-link: var(--push-color);
77
78
  --color-link-hover: var(--push-color);
@@ -30,7 +30,7 @@ Variants compose freely: `class="btn btn-danger btn-sm btn-ghost"`.
30
30
  | `.btn-warning` | Warning |
31
31
  | `.btn-info` | Informational |
32
32
 
33
- Each sets four properties together: background, border, their hover values, and the text colour.
33
+ Each sets its background, border and text colour, with their hover values.
34
34
 
35
35
  ```css
36
36
  .btn-danger {
@@ -39,12 +39,13 @@ Each sets four properties together: background, border, their hover values, and
39
39
  --btn-color-border: var(--color-danger);
40
40
  --btn-color-border-hover: var(--color-danger-hover);
41
41
  --btn-color-text: var(--color-text-on-danger);
42
+ --btn-color-text-hover: var(--color-text-on-danger);
42
43
  }
43
44
  ```
44
45
 
45
46
  The text colour always comes from the matching `--color-text-on-*` semantic token, so contrast survives a change to the underlying colour. That pairing is the reason to rebrand by redefining `--color-brand` rather than `--btn-color-background`.
46
47
 
47
- The text keeps its colour on hover: `.btn` reads `var(--btn-color-text-hover, var(--btn-color-text))`, and `--btn-color-text-hover` is no token, so it is unset unless a variant or a context sets it. A context that recolours its buttons, as a push over a dark media does, only needs `--btn-color-text`.
48
+ The hover text colour has to be set alongside the text colour, even when the two are the same. The `--btn-color-text-hover` token defaults to `var(--btn-color-text)`, but on `:root`, where it resolves to the default text colour once and for all: a variant or a context that only changes `--btn-color-text`, as a push over a dark media does, would see its text turn back to `--color-text-on-brand` on hover.
48
49
 
49
50
  `.btn-primary` and `.btn-brand` resolve to exactly the same values, as do `.btn-secondary` and `.btn-neutral`. The intent names exist so a page can say *primary action* without deciding which colour that is.
50
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinq/css-components",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "Framework-agnostic CSS component implementations.",
5
5
  "license": "MIT",
6
6
  "repository": {