use-wc 1.0.0-pre.74 → 1.0.0-pre.75

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.
@@ -313,7 +313,7 @@
313
313
 
314
314
  @layer use-theme.link {
315
315
  :is(nav, header, footer, [role="navigation"], [role="menubar"], [role="tablist"], [role="toolbar"]) {
316
- --usewc-effect-link-decoration: var(--usewc-effect-link-chrome-text-decoration);
316
+ --usewc-local-link-decoration-line: var(--usewc-effect-link-chrome-text-decoration);
317
317
  }
318
318
 
319
319
  :is(a:not([class*="appearance-"]), .appearance-a) {
@@ -321,11 +321,23 @@
321
321
  all: unset;
322
322
  }
323
323
 
324
- --usewc-color-link-text: var(--usewc-color-link-text-static);
324
+ /* `--usewc-local-*` names the variables below as rule-scoped plumbing rather than themeable
325
+ tokens — set here to thread the current state (hover/active, chrome context, sidebar) into
326
+ the properties further down, as opposed to the real tokens in `semantic.css` they read
327
+ from. `--usewc-local-link-decoration-color` in particular has to be derived here rather
328
+ than hoisted into `semantic.css`: relative-color syntax reading a `var()` only resolves
329
+ once the referenced custom property is defined on the same element/rule, and
330
+ `--usewc-local-link-text` only ever exists on this one. */
331
+ --usewc-local-link-text: var(--usewc-color-link-text-static);
332
+ --usewc-local-link-decoration-opacity: var(--usewc-effect-link-decoration-opacity);
333
+ --usewc-local-link-decoration-color: oklch(
334
+ from var(--usewc-local-link-text) l c h / var(--usewc-local-link-decoration-opacity)
335
+ );
325
336
  --usewc-effect-outline-width: 0;
326
337
 
327
- color: var(--usewc-color-link-text);
328
- text-decoration: var(--usewc-effect-link-decoration, var(--usewc-effect-link-text-decoration));
338
+ color: var(--usewc-local-link-text);
339
+ text-decoration: var(--usewc-local-link-decoration-line, var(--usewc-effect-link-text-decoration));
340
+ text-decoration-color: var(--usewc-local-link-decoration-color);
329
341
  cursor: pointer;
330
342
  outline: var(--usewc-effect-outline-width) var(--usewc-effect-outline-style) var(--usewc-color-outline);
331
343
  outline-offset: var(--usewc-effect-outline-offset);
@@ -336,7 +348,7 @@
336
348
  }
337
349
 
338
350
  &:is(:hover, :focus-visible) {
339
- --usewc-color-link-text: var(--usewc-color-link-text-hover);
351
+ --usewc-local-link-text: var(--usewc-color-link-text-hover);
340
352
  }
341
353
 
342
354
  &:focus-visible {
@@ -344,12 +356,15 @@
344
356
  }
345
357
 
346
358
  &:active {
347
- --usewc-color-link-text: var(--usewc-color-link-text-active);
359
+ --usewc-local-link-text: var(--usewc-color-link-text-active);
360
+ /* Pressed reads as committed rather than merely hinted at, so the underline matches the
361
+ text exactly here instead of staying a lighter tint of it. */
362
+ --usewc-local-link-decoration-opacity: 1;
348
363
  }
349
364
 
350
365
  nav.sidebar > & {
351
366
  display: block;
352
- /* Swapping these source tokens, rather than the resolved `--usewc-color-link-text` slot
367
+ /* Swapping these source tokens, rather than the resolved `--usewc-local-link-text` slot
353
368
  itself, means the existing `:hover`/`:active` rules above keep working unmodified — they
354
369
  already read through `-hover`/`-active`, so overriding what those resolve to here is
355
370
  enough to recolor every state at once. */
@@ -1401,6 +1416,24 @@
1401
1416
  }
1402
1417
  }
1403
1418
 
1419
+ /* A link inside a cell reads as the cell's own text rather than the document's default link
1420
+ blue — the grid draws attention with its row/selection bands, not link-colored text, so a
1421
+ link that broke from the cell's color would read as an anomaly instead of an affordance.
1422
+ Hover/active still need to move, the same as the default link darkening through
1423
+ blue-600/700/800 — `currentColor` alone can't step down like that, so each state is the
1424
+ cell's own color with its lightness nudged instead. `link.css`'s own decoration-color rule
1425
+ already derives from `--usewc-local-link-text`, so the underline follows every step here for
1426
+ free, staying a lighter tint of whichever shade the text itself is in. */
1427
+ use-gridcell :is(a:not([class*="appearance-"]), .appearance-a) {
1428
+ --usewc-color-link-text-static: currentColor;
1429
+ --usewc-color-link-text-hover: oklch(
1430
+ from currentColor calc(l + var(--usewc-color-grid-cell-link-hover-lightness-shift)) c h
1431
+ );
1432
+ --usewc-color-link-text-active: oklch(
1433
+ from currentColor calc(l + var(--usewc-color-grid-cell-link-active-lightness-shift)) c h
1434
+ );
1435
+ }
1436
+
1404
1437
  use-grid:not(.chips, .list, .appearance-native) {
1405
1438
  display: block;
1406
1439
  overflow: clip;
@@ -2261,6 +2294,17 @@
2261
2294
  min-inline-size: 0;
2262
2295
  }
2263
2296
 
2297
+ /* `--usewc-layout-region-gap`/`-padding` are custom properties, which inherit by default — left
2298
+ alone, a nested `use-layout` would pick up its ancestor's density instead of its own default
2299
+ of "no gap/padding of its own." Resetting them here, at `:where()`'s zero specificity, stops
2300
+ that inheritance at every `use-layout` boundary without affecting a variant class or a
2301
+ `gap`/`padding` attribute below, both of which carry real specificity and still win on the
2302
+ element they target. */
2303
+ :where(use-layout) {
2304
+ --usewc-layout-region-gap: initial;
2305
+ --usewc-layout-region-padding: initial;
2306
+ }
2307
+
2264
2308
  /* ── Variant density ────────────────────────────────────────────────────────────────────────
2265
2309
  A variant class sets its own scale and nothing else; the generic region rules below read
2266
2310
  these properties. Keeping the arrangement in one ruleset rather than four means a future
@@ -2277,6 +2321,14 @@
2277
2321
  --usewc-layout-footer-justify: space-between;
2278
2322
  }
2279
2323
 
2324
+ /* A page's own `h1` — its title, wherever it sits in the topbar — reads at the page's title
2325
+ size and weight rather than the browser's default heading style. Matched at any depth, since
2326
+ a topbar routinely nests it a `<section>` or an `<hgroup>` down. */
2327
+ use-layout.page h1 {
2328
+ font-size: var(--usewc-font-page-title-size);
2329
+ font-weight: var(--usewc-font-page-title-weight);
2330
+ }
2331
+
2280
2332
  use-layout.entry {
2281
2333
  --usewc-layout-region-padding: var(--usewc-layout-entry-padding);
2282
2334
  --usewc-layout-region-gap: var(--usewc-layout-entry-gap);
package/dist/tokens.css CHANGED
@@ -37,6 +37,7 @@
37
37
  --usewc-font-size-18: 1.125rem;
38
38
  --usewc-font-size-20: 1.25rem;
39
39
  --usewc-font-size-24: 1.5rem;
40
+ --usewc-font-size-28: 1.75rem;
40
41
 
41
42
  /** Font weight */
42
43
  --usewc-font-weight-light: 300;
@@ -203,6 +204,12 @@
203
204
  --usewc-color-link-text-visited-hover: var(--usewc-color-indigo-600);
204
205
  --usewc-color-link-text-visited-active: var(--usewc-color-indigo-700);
205
206
  --usewc-effect-link-text-decoration: underline;
207
+ /* The underline is always this much fainter than whatever the link's own text color resolves
208
+ to, in whichever state — a plain number rather than a full `oklch(from ...)` expression,
209
+ since relative-color syntax reading a `var()` only resolves reliably when the referenced
210
+ custom property lives on the same rule; `link.css` does the actual derivation locally,
211
+ alongside the (also local) `--usewc-local-link-text` it reads from. */
212
+ --usewc-effect-link-decoration-opacity: 0.5;
206
213
  --usewc-effect-link-chrome-text-decoration: none;
207
214
  /* - Sidebar nav item */
208
215
  /* A sidebar item reads as chrome, not a hyperlink, so its text stays the document's own ink
@@ -578,6 +585,15 @@
578
585
  --usewc-color-grid-header-background: transparent;
579
586
  --usewc-color-grid-header-text: var(--usewc-color-gray-600);
580
587
  --usewc-color-grid-row-background-hover: oklch(from var(--usewc-color-gray-300) l c h / 0.55);
588
+ /* A link inside a cell inherits its resting color from the cell (`currentColor`), so hover/active
589
+ can't reach for a fixed color the way the default link does — they shift that same color's own
590
+ lightness instead. Light mode's cell text is usually dark, so darkening it further (moving
591
+ toward black) reads as pressed, the same direction the default link's blue-600/700/800
592
+ progression darkens on hover/active; the dark-mode block below flips both to lighten instead,
593
+ since a light-on-dark cell darkening toward the page background would lose contrast rather
594
+ than gain it — the same reason `button.css`'s own hover/active derivation carries a shift. */
595
+ --usewc-color-grid-cell-link-hover-lightness-shift: -0.08;
596
+ --usewc-color-grid-cell-link-active-lightness-shift: -0.16;
581
597
  /* A super-light tint of the primary — its hue and a whisper of its chroma, floated up to
582
598
  near-white — so it tracks the primary even if that's overridden. */
583
599
  --usewc-color-grid-row-background-selected: oklch(from var(--usewc-color-brand-primary) 0.96 0.03 h);
@@ -756,6 +772,8 @@
756
772
  --usewc-layout-page-padding: var(--usewc-space-20);
757
773
  --usewc-layout-page-gap: var(--usewc-space-12);
758
774
  --usewc-layout-page-avatar-size: var(--usewc-layout-region-title-block-size);
775
+ --usewc-font-page-title-size: var(--usewc-font-size-28);
776
+ --usewc-font-page-title-weight: var(--usewc-font-weight-medium);
759
777
 
760
778
  --usewc-layout-card-padding: var(--usewc-space-16);
761
779
  --usewc-layout-card-gap: var(--usewc-space-10);
@@ -898,6 +916,11 @@
898
916
  --usewc-color-grid-header-text: var(--usewc-color-gray-200);
899
917
  --usewc-color-avatar-background: var(--usewc-color-gray-800);
900
918
  --usewc-color-avatar-text: var(--usewc-color-gray-200);
919
+ /* A cell's own text is usually light against a dark page, so hover/active need to lighten it
920
+ further instead of darkening it toward the background — the opposite direction from light
921
+ mode, same as the sign flip below. */
922
+ --usewc-color-grid-cell-link-hover-lightness-shift: 0.08;
923
+ --usewc-color-grid-cell-link-active-lightness-shift: 0.16;
901
924
  }
902
925
  }
903
926
 
package/dist/use-wc.mjs CHANGED
@@ -5223,13 +5223,7 @@ let UseGridCell = class UseGridCell extends UseWidget {
5223
5223
  this.#action = null;
5224
5224
  this.#actionsInitialized = false;
5225
5225
  this.#handleFocusIn = () => {
5226
- if (!this.#actionsInitialized) {
5227
- focusable(this).forEach((el) => {
5228
- el.tabIndex = -1;
5229
- if (!this.#action) this.#action = el;
5230
- });
5231
- this.#actionsInitialized = true;
5232
- }
5226
+ this.#initializeAction();
5233
5227
  if (this.#action) {
5234
5228
  this.#action.focus();
5235
5229
  this.tabIndex = -1;
@@ -5246,10 +5240,19 @@ let UseGridCell = class UseGridCell extends UseWidget {
5246
5240
  if (!this.hasAttribute("role")) this.setAttribute("role", this.closest("use-gridhead") ? "columnheader" : "gridcell");
5247
5241
  this.tabIndex = -1;
5248
5242
  if (this.mode === "action") {
5243
+ queueMicrotask(() => this.#initializeAction());
5249
5244
  this.addEventListener("focusin", this.#handleFocusIn);
5250
5245
  this.addEventListener("focusout", this.#handleFocusOut);
5251
5246
  }
5252
5247
  }
5248
+ #initializeAction() {
5249
+ if (this.#actionsInitialized) return;
5250
+ focusable(this).forEach((el) => {
5251
+ el.tabIndex = -1;
5252
+ if (!this.#action) this.#action = el;
5253
+ });
5254
+ this.#actionsInitialized = true;
5255
+ }
5253
5256
  #handleFocusIn;
5254
5257
  #handleFocusOut;
5255
5258
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-wc",
3
- "version": "1.0.0-pre.74",
3
+ "version": "1.0.0-pre.75",
4
4
  "private": false,
5
5
  "homepage": "https://usewc.com",
6
6
  "bugs": "https://github.com/dang-rabbits/use-wc/issues",