actual-css 0.16.1 → 0.17.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 (66) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +8 -4
  3. package/components.json +19 -4
  4. package/dist/actual.full.css +393 -69
  5. package/dist/actual.full.js +2 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/app-ui.md +37 -3
  8. package/docs/design-notes/enhancement-contract.md +3 -1
  9. package/docs/navigation.json +14 -1
  10. package/docs/pages/components/alert.md +45 -17
  11. package/docs/pages/components/button.md +3 -0
  12. package/docs/pages/components/dialog.md +36 -0
  13. package/docs/pages/components/drawer.md +52 -8
  14. package/docs/pages/components/navbar.md +26 -2
  15. package/docs/pages/components/rating.md +111 -12
  16. package/docs/pages/components/segmented.md +36 -1
  17. package/docs/pages/components/spinner.md +2 -0
  18. package/docs/pages/components/table.md +77 -0
  19. package/docs/pages/components/timeline.md +3 -1
  20. package/docs/pages/enhancements/flyout.md +83 -14
  21. package/docs/pages/enhancements/tabs.md +5 -0
  22. package/docs/pages/examples/overview.md +5 -1
  23. package/docs/pages/forms/ajax.md +101 -0
  24. package/docs/pages/forms/color-swatches.md +31 -2
  25. package/docs/pages/forms/joined-controls.md +8 -3
  26. package/docs/pages/forms/overview.md +1 -1
  27. package/docs/pages/forms/unsaved-changes.md +198 -0
  28. package/docs/pages/foundations/philosophy.md +2 -1
  29. package/docs/pages/foundations/theming.md +2 -1
  30. package/docs/pages/foundations/tokens.md +1 -1
  31. package/docs/pages/guides/introduction.md +1 -1
  32. package/docs/pages/guides/progressive-enhancement.md +30 -49
  33. package/docs/pages/guides/upgrading.md +15 -2
  34. package/docs/pages/layout/choosing.md +5 -0
  35. package/docs/pages/layout/column-layout.md +22 -8
  36. package/docs/pages/layout/sidebar-shell.md +68 -0
  37. package/docs/pages/patterns/empty-state.md +74 -0
  38. package/docs/pages/patterns/hierarchical-nav.md +40 -19
  39. package/docs/pages/patterns/navigation-list.md +3 -60
  40. package/docs/pages/patterns/stat.md +61 -0
  41. package/docs/pages/utilities/accessibility.md +32 -10
  42. package/package.json +4 -1
  43. package/reserved-classes.json +2 -0
  44. package/src/css/components/busy.css +25 -0
  45. package/src/css/components/button.css +3 -0
  46. package/src/css/components/drawer.css +37 -3
  47. package/src/css/components/flyout.css +37 -0
  48. package/src/css/components/modal.css +3 -0
  49. package/src/css/components/navbar.css +99 -38
  50. package/src/css/components/rating.css +50 -5
  51. package/src/css/components/segmented.css +25 -2
  52. package/src/css/forms/color-swatch.css +38 -19
  53. package/src/css/forms/custom-select.css +5 -0
  54. package/src/css/layout/index.css +2 -0
  55. package/src/css/layout/sidebar-shell.css +67 -0
  56. package/src/js/ajax.js +148 -0
  57. package/src/js/dialog.js +59 -2
  58. package/src/js/dirty.js +140 -0
  59. package/src/js/dismiss.js +25 -0
  60. package/src/js/events.js +17 -0
  61. package/src/js/focus.js +12 -0
  62. package/src/js/form-submission.js +34 -0
  63. package/src/js/full.js +2 -0
  64. package/src/js/tab.js +16 -2
  65. package/src/js/validation.js +12 -4
  66. package/src/tooling/theme-contrast.js +3 -2
@@ -1328,6 +1328,7 @@ small {
1328
1328
  * .center centered content column
1329
1329
  * .frame fixed-ratio media frame
1330
1330
  * .app-shell full-height application shell
1331
+ * .sidebar-shell persistent side region + main, each scrolling; drawer below 64rem
1331
1332
  * .app-layout topbar + scrolling main + bottom/side app navigation
1332
1333
  * .media fixed media + flexible content
1333
1334
  * .switcher peer regions: all horizontal or all stacked
@@ -1510,6 +1511,74 @@ small {
1510
1511
  flex-direction: column;
1511
1512
  }
1512
1513
 
1514
+ /*
1515
+ * Sidebar shell — a persistent side region beside the main one on a wide
1516
+ * viewport, each scrolling on its own; below 64rem the side region hides and
1517
+ * the document scrolls. The page mirrors the navigation into a dialog.drawer.
1518
+ *
1519
+ * Docs: docs/pages/layout/sidebar-shell.md
1520
+ * Design note: docs/design-notes/app-ui.md#sidebar-shell
1521
+ *
1522
+ * Structure: two direct children, an `aside` (side) and one other element
1523
+ * (main). The breakpoint is a literal; a custom property cannot sit in a
1524
+ * media condition.
1525
+ *
1526
+ * Public hooks:
1527
+ * --sidebar-shell-size
1528
+ */
1529
+ .sidebar-shell {
1530
+ --sidebar-shell-size: 16rem;
1531
+ }
1532
+
1533
+ /* Hidden below, never shown above: the aside keeps the author's display (an
1534
+ aside.stack). Where range syntax is unsupported the rule drops and the
1535
+ sidebar stacks above the content, still reachable. Screen only: a printed
1536
+ page is narrower than 64rem, and print never hides framework content. */
1537
+ @media screen and (width < 64rem) {
1538
+ .sidebar-shell > aside {
1539
+ display: none;
1540
+ }
1541
+ }
1542
+
1543
+ @media (width >= 64rem) {
1544
+ .sidebar-shell {
1545
+ display: grid;
1546
+ grid-template-columns: var(--sidebar-shell-size) minmax(0, 1fr);
1547
+ block-size: var(--viewport-block);
1548
+ }
1549
+
1550
+ /* Each region is its own scroller, so the sidebar stays put. min-block-size
1551
+ lets the grid row hold them to the viewport instead of their content. */
1552
+ .sidebar-shell > * {
1553
+ min-block-size: 0;
1554
+ overflow: auto;
1555
+ overscroll-behavior: contain;
1556
+ }
1557
+
1558
+ .sidebar-shell > aside {
1559
+ grid-column: 1;
1560
+ grid-row: 1;
1561
+ }
1562
+
1563
+ .sidebar-shell > :not(aside) {
1564
+ grid-column: 2;
1565
+ grid-row: 1;
1566
+ }
1567
+ }
1568
+
1569
+ /* Paper is one flow, side then main, nothing clipped by a scroller. Leaving
1570
+ the sidebar off the page is the application's print stylesheet. */
1571
+ @media print {
1572
+ .sidebar-shell {
1573
+ display: block;
1574
+ block-size: auto;
1575
+ }
1576
+
1577
+ .sidebar-shell > * {
1578
+ overflow: visible;
1579
+ }
1580
+ }
1581
+
1513
1582
  /*
1514
1583
  * Specialized application shell recipe: one exact DOM structure uses a
1515
1584
  * bottom navigation bar when narrow and a labelled side navigation when space
@@ -3669,11 +3738,11 @@ small {
3669
3738
  * rows sit one gap apart like columns. Edge, selection ring and focus ring all
3670
3739
  * belong to the visible swatch.
3671
3740
  *
3672
- * The color is arbitrary, so nothing drawn on it may assume a contrast: the
3673
- * selected mark is a double ring (--text outside, --surface-opaque inside) that
3674
- * reads on any fill, and a hairline edge keeps a near-white color apart from
3675
- * the page. ::before opts out of forced colors to keep the color, so it takes
3676
- * system colors itself there.
3741
+ * The color is arbitrary, so nothing is drawn on it: the selected mark is a
3742
+ * --text ring outside the swatch (::after), past a transparent gap, so it reads
3743
+ * on any color and any background and leaves the color whole. A hairline edge
3744
+ * keeps a near-white color apart from the page. Both pseudo-elements opt out of
3745
+ * forced colors to keep the color, so they take system colors themselves there.
3677
3746
  *
3678
3747
  * Without :has() the native radio stays visible in the swatch and carries the
3679
3748
  * state; the ring needs :has() to mirror it.
@@ -3681,16 +3750,18 @@ small {
3681
3750
  * Public hooks:
3682
3751
  * --color-swatch-value (fallback-only: the color, set per swatch)
3683
3752
  * --color-swatch-size
3684
- * --color-swatch-radius
3753
+ * --color-swatch-radius (fallback-only: set it on the palette or a swatch)
3685
3754
  */
3686
3755
  .color-swatch {
3687
3756
  /* The .switch track height (switch.css); a browser test holds them equal. */
3688
3757
  --color-swatch-size: calc(var(--choice-control-size) + 0.125em);
3689
- --color-swatch-radius: var(--radius-full);
3690
3758
  /* Internal: what the hit area adds to the swatch, half on each side. One gap
3691
3759
  at most, so two neighbours never claim the same point — a wider reach let
3692
3760
  the next swatch take a click on this one's center. */
3693
3761
  --color-swatch-reach: clamp(0px, var(--control-size) - var(--color-swatch-size), var(--gap));
3762
+ /* Internal: how far the selection ring (gap + stroke) reaches past the
3763
+ swatch. The focus ring moves out by as much on a checked swatch. */
3764
+ --color-swatch-ring: 4px;
3694
3765
 
3695
3766
  position: relative;
3696
3767
  display: inline-grid;
@@ -3722,13 +3793,29 @@ small {
3722
3793
  block-size: var(--color-swatch-size);
3723
3794
  box-sizing: border-box;
3724
3795
  border: var(--border-width) solid var(--border-control);
3725
- border-radius: var(--color-swatch-radius);
3796
+ border-radius: var(--color-swatch-radius, var(--radius-full));
3726
3797
  background: var(--color-swatch-value, transparent) padding-box;
3727
3798
  /* The color is the content, as on .color (native.css). */
3728
3799
  forced-color-adjust: none;
3729
- transition:
3730
- border-color var(--duration),
3731
- box-shadow var(--duration);
3800
+ transition: border-color var(--duration);
3801
+ }
3802
+
3803
+ /* Selection ring, drawn on every swatch and colored when checked. Its negative
3804
+ margin lays it out at the swatch size: a ring wider than the grid track
3805
+ would widen it and push the swatch off-center in a tight palette. */
3806
+ .color-swatch::after {
3807
+ content: "";
3808
+ grid-area: 1 / 1;
3809
+ inline-size: calc(var(--color-swatch-size) + 2 * var(--color-swatch-ring));
3810
+ block-size: calc(var(--color-swatch-size) + 2 * var(--color-swatch-ring));
3811
+ margin: calc(-1 * var(--color-swatch-ring));
3812
+ box-sizing: border-box;
3813
+ border: calc(var(--color-swatch-ring) / 2) solid transparent;
3814
+ border-radius: calc(var(--color-swatch-radius, var(--radius-full)) + var(--color-swatch-ring));
3815
+ pointer-events: none;
3816
+ /* The gap stays transparent; forced colors would paint it. */
3817
+ forced-color-adjust: none;
3818
+ transition: border-color var(--duration);
3732
3819
  }
3733
3820
 
3734
3821
  /* Shares the swatch's cell and paints after ::before, so a native radio left
@@ -3760,10 +3847,8 @@ small {
3760
3847
  border-color: var(--text-subtle);
3761
3848
  }
3762
3849
 
3763
- .color-swatch:has(> input:checked)::before {
3764
- box-shadow:
3765
- inset 0 0 0 2px var(--text),
3766
- inset 0 0 0 4px var(--surface-opaque);
3850
+ .color-swatch:has(> input:checked)::after {
3851
+ border-color: var(--text);
3767
3852
  }
3768
3853
 
3769
3854
  /* The ring goes around the visible swatch, not the larger hit area. */
@@ -3781,6 +3866,11 @@ small {
3781
3866
  outline-offset: var(--focus-outline-offset);
3782
3867
  }
3783
3868
 
3869
+ /* Outside the selection ring, so the two never share a stroke. */
3870
+ .color-swatch:has(> input:checked:focus-visible)::before {
3871
+ outline-offset: calc(var(--focus-outline-offset) + var(--color-swatch-ring));
3872
+ }
3873
+
3784
3874
  .color-swatch:disabled {
3785
3875
  opacity: var(--disabled-opacity);
3786
3876
  cursor: not-allowed;
@@ -3800,10 +3890,8 @@ small {
3800
3890
  border-color: CanvasText;
3801
3891
  }
3802
3892
 
3803
- .color-swatch:has(> input:checked)::before {
3804
- box-shadow:
3805
- inset 0 0 0 2px CanvasText,
3806
- inset 0 0 0 4px Canvas;
3893
+ .color-swatch:has(> input:checked)::after {
3894
+ border-color: CanvasText;
3807
3895
  }
3808
3896
 
3809
3897
  .color-swatch:disabled::before {
@@ -3837,6 +3925,11 @@ small {
3837
3925
  .select:not([multiple], .native, [size]:not([size="1"])) {
3838
3926
  appearance: base-select;
3839
3927
  align-items: center;
3928
+ /* why: base-select brings a UA padding-block (0.25em) that the native
3929
+ select lacks; with a 24px line it pushed a .compact select to 34px
3930
+ against --control-size 32px. min-block-size and align-items already
3931
+ center the value. */
3932
+ padding-block: 0;
3840
3933
 
3841
3934
  &::picker(select) {
3842
3935
  appearance: base-select;
@@ -4282,6 +4375,9 @@ small {
4282
4375
  }
4283
4376
 
4284
4377
  .btn.icon-only {
4378
+ /* why: beside a full-width control (.join, a flex row) it would share the
4379
+ shrink and stop being square. */
4380
+ flex: none;
4285
4381
  inline-size: var(--btn-min-size);
4286
4382
  block-size: var(--btn-min-size);
4287
4383
  padding: 0;
@@ -5350,6 +5446,9 @@ a.badge[aria-disabled="true"] {
5350
5446
  /* Keep the surface anchored to the viewport in the top layer. This also
5351
5447
  provides the containing block for the absolutely positioned close button. */
5352
5448
  position: fixed;
5449
+ /* Restates the UA centering: a modal authored inside .stack or .cluster
5450
+ would otherwise take their child margin reset and pin to the top. */
5451
+ margin: auto;
5353
5452
 
5354
5453
  /* The root is :where(dialog).modal (0-1-0), so a single author class can
5355
5454
  outrank these defaults — no fallback-only indirection needed here. */
@@ -5701,14 +5800,17 @@ html.has-modal-open.had-scrollbar {
5701
5800
  * navigation content inside uses .nav-link and .accordion, which carry their
5702
5801
  * own link/summary styling.
5703
5802
  *
5803
+ * Sides: start (default), end, and bottom (a bottom sheet) via data-side.
5804
+ *
5704
5805
  * Public hooks:
5705
- * --drawer-size
5806
+ * --drawer-size (width on start/end, maximum height on bottom)
5706
5807
  * --drawer-pad
5707
5808
  *
5708
5809
  * The corner close control is .close (components/close.css).
5709
5810
  *
5710
5811
  * Internal:
5711
5812
  * --drawer-closed-translate (side/RTL positioning state)
5813
+ * --drawer-closed-transform (closed position; bottom changes its axis)
5712
5814
  * --drawer-focus-bleed
5713
5815
  * --drawer-close-reserve (header room for a corner close; zero without a close)
5714
5816
  * --drawer-motion-duration (shared by panel and ::backdrop so exit duration
@@ -5721,6 +5823,9 @@ html.has-modal-open.had-scrollbar {
5721
5823
  /* The inset a direct .bleed child cancels (components/bleed.css). */
5722
5824
  --surface-pad: var(--drawer-pad);
5723
5825
  --drawer-closed-translate: -100%;
5826
+ /* The closed position as one transform, so a side can change axis without
5827
+ a rule that would tie with [open] on specificity. */
5828
+ --drawer-closed-transform: translateX(var(--drawer-closed-translate));
5724
5829
  /* Header room for a corner close. Unconditional baseline: without :has()
5725
5830
  (Degraded tier) a header keeps too much room rather than a title running
5726
5831
  under the close. Zeroed when the drawer has no close. */
@@ -5759,7 +5864,7 @@ html.has-modal-open.had-scrollbar {
5759
5864
  color: var(--text);
5760
5865
  box-shadow: var(--shadow);
5761
5866
  opacity: 0;
5762
- transform: translateX(var(--drawer-closed-translate));
5867
+ transform: var(--drawer-closed-transform);
5763
5868
  /* Unsupported discrete behavior drops alone, preserving opacity/transform. */
5764
5869
  transition-property: opacity, transform, overlay, display;
5765
5870
  transition-duration: var(--drawer-motion-duration);
@@ -5813,10 +5918,32 @@ html.has-modal-open.had-scrollbar {
5813
5918
  opacity: 1;
5814
5919
  }
5815
5920
 
5921
+ /* Bottom sheet: the same drawer on the block-end edge, sized by its content
5922
+ up to --drawer-size, which reads as a height here. :where() keeps the size
5923
+ at the base rule's weight, so an application class still overrides it. */
5924
+ :where(dialog).drawer:where([data-side="bottom"]) {
5925
+ --drawer-size: 32rem;
5926
+ --drawer-closed-transform: translateY(100%);
5927
+ }
5928
+
5929
+ :where(dialog).drawer[data-side="bottom"] {
5930
+ inset-block: auto 0;
5931
+ inset-inline: 0;
5932
+ inline-size: 100%;
5933
+ block-size: auto;
5934
+ max-block-size: min(calc(var(--viewport-block) * 0.85), var(--drawer-size));
5935
+ /* The home indicator sits over the panel's last line otherwise. */
5936
+ padding-block-end: calc(var(--drawer-pad) + env(safe-area-inset-bottom, 0px));
5937
+ border-inline-end: 0;
5938
+ border-block-start: var(--border-width) solid var(--border);
5939
+ border-start-start-radius: var(--radius-lg);
5940
+ border-start-end-radius: var(--radius-lg);
5941
+ }
5942
+
5816
5943
  @starting-style {
5817
5944
  :where(dialog).drawer[open] {
5818
5945
  opacity: 0;
5819
- transform: translateX(var(--drawer-closed-translate));
5946
+ transform: var(--drawer-closed-transform);
5820
5947
  }
5821
5948
 
5822
5949
  :where(dialog).drawer[open]::backdrop {
@@ -5844,6 +5971,12 @@ html.has-modal-open.had-scrollbar {
5844
5971
  under the header or footer. */
5845
5972
  margin: calc(var(--drawer-focus-bleed) * -1);
5846
5973
  padding: var(--drawer-focus-bleed);
5974
+ /* The scrollport reaches the panel's inline-end edge and takes the panel
5975
+ padding back inside: the scrollbar sits on the edge and the content keeps
5976
+ --drawer-pad on both sides. Inside the content box, the scrollbar sat a
5977
+ focus bleed from the text with the panel padding wasted beyond it. */
5978
+ margin-inline-end: calc(var(--drawer-pad) * -1);
5979
+ padding-inline-end: var(--drawer-pad);
5847
5980
  overflow: auto;
5848
5981
  overscroll-behavior: contain;
5849
5982
  }
@@ -5997,6 +6130,9 @@ picture.bleed > img {
5997
6130
  * Runtime marker (managed by surface.js): .is-open marks an open flyout.
5998
6131
  * --surface-anchor-width is set by surface.js while an open flyout is positioned.
5999
6132
  *
6133
+ * Modifier: .scrollable keeps a header and footer in view while the one body
6134
+ * region between them scrolls.
6135
+ *
6000
6136
  * Public hooks:
6001
6137
  * --flyout-inline-size
6002
6138
  * --flyout-max-inline-size
@@ -6004,6 +6140,7 @@ picture.bleed > img {
6004
6140
  *
6005
6141
  * Internal:
6006
6142
  * --menu-item-size (derived from --control-size for menu rows)
6143
+ * --flyout-focus-bleed (focus reserve of the .scrollable body)
6007
6144
  * --available-height (measured by the positioner)
6008
6145
  * --surface-anchor-width (measured by surface.js)
6009
6146
  */
@@ -6154,6 +6291,39 @@ picture.bleed > img {
6154
6291
  margin: 0;
6155
6292
  }
6156
6293
 
6294
+ /* .scrollable: the .modal.scrollable contract on a panel with a header, one
6295
+ body and a footer — the header and footer keep their size and the body
6296
+ absorbs the overflow, so an Apply row stays in view however long the list
6297
+ or however little room the positioner leaves. Opt-in, because a menu or a
6298
+ multi-section nav panel has no single body to scroll. :where() keeps the
6299
+ display at .flyout's weight, so [hidden] and the closed popover still win
6300
+ whatever the source order. */
6301
+ .flyout:where(.scrollable) {
6302
+ display: flex;
6303
+ flex-direction: column;
6304
+ overflow: hidden;
6305
+ }
6306
+
6307
+ .flyout.scrollable > :is(header, footer) {
6308
+ flex: none;
6309
+ }
6310
+
6311
+ .flyout.scrollable > :not(:is(header, footer)) {
6312
+ /* Declared here, not as a :root alias: an inherited alias arrives already
6313
+ computed, so a --focus-ring-width override on the panel would not reach
6314
+ it. */
6315
+ --flyout-focus-bleed: calc(var(--focus-outline-offset) + var(--focus-ring-width));
6316
+
6317
+ flex: 1 1 auto;
6318
+ min-block-size: 0;
6319
+ /* Keep focus paint inside the clip without moving the content: the reserve
6320
+ reaches into the panel gap and padding, both --space-10 by default. */
6321
+ margin: calc(var(--flyout-focus-bleed) * -1);
6322
+ padding: var(--flyout-focus-bleed);
6323
+ overflow: auto;
6324
+ overscroll-behavior: contain;
6325
+ }
6326
+
6157
6327
  /* Vertical dividers — .menu-separator (menu.css) is the canonical way to
6158
6328
  separate menu items. Flyout panels that are not menus use auto grid gap
6159
6329
  declared on .flyout itself. */
@@ -6797,8 +6967,13 @@ picture.bleed > img {
6797
6967
  * shows that spinner as a centered overlay over a faded surface. Buttons keep
6798
6968
  * their spinners inline (e.g. .btn[aria-busy] > .spinner stays inline-flex).
6799
6969
  *
6970
+ * The overlay fades in after --busy-delay, so a fast request leaves the
6971
+ * content untouched instead of flashing it. Reduced motion drops the delay
6972
+ * with every other animation (reset.css): the overlay then shows at once.
6973
+ *
6800
6974
  * Public hooks:
6801
6975
  * --busy-overlay-bg
6976
+ * --busy-delay
6802
6977
  *
6803
6978
  * Internal:
6804
6979
  * --spinner-size (overlay copy of the shared spinner hook)
@@ -6833,6 +7008,26 @@ picture.bleed > img {
6833
7008
  margin: auto;
6834
7009
  display: block;
6835
7010
  }
7011
+
7012
+ @media (prefers-reduced-motion: no-preference) {
7013
+ [aria-busy="true"]:not(.btn):has(> .spinner:last-child)::before {
7014
+ animation: actual-busy-reveal var(--duration-slow) var(--busy-delay, 300ms) ease both;
7015
+ }
7016
+
7017
+ /* Restates the spin: one animation list replaces spinner.css's. */
7018
+ [aria-busy="true"]:not(.btn) > .spinner:last-child {
7019
+ animation:
7020
+ actual-busy-reveal var(--duration-slow) var(--busy-delay, 300ms) ease both,
7021
+ actual-spin var(--duration-spin) linear infinite;
7022
+ }
7023
+ }
7024
+ }
7025
+
7026
+ /* `both` holds the from-frame through the delay. */
7027
+ @keyframes actual-busy-reveal {
7028
+ from {
7029
+ opacity: 0;
7030
+ }
6836
7031
  }
6837
7032
 
6838
7033
  @supports (selector([aria-busy="true"]:has(> .spinner:last-child))) and
@@ -7649,10 +7844,12 @@ a.avatar[aria-disabled="true"] {
7649
7844
  * --rating-color
7650
7845
  * --rating-empty
7651
7846
  * --rating-star
7847
+ * --rating-star-empty (the empty star's shape; the filled one by default)
7652
7848
  * --rating-value (display: the shown value, fractions allowed)
7653
7849
  * --rating-max (display: the number of stars)
7654
7850
  *
7655
7851
  * Internal:
7852
+ * --rating-shape
7656
7853
  * --rating-fill
7657
7854
  * --rating-direction
7658
7855
  */
@@ -7662,10 +7859,12 @@ a.avatar[aria-disabled="true"] {
7662
7859
 
7663
7860
  .rating {
7664
7861
  --rating-size: 1.25rem;
7665
- --rating-gap: 0.1rem;
7862
+ --rating-gap: var(--space-10);
7666
7863
  --rating-color: var(--intent, var(--warning));
7667
7864
  --rating-empty: var(--border);
7668
7865
  --rating-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 16 16'%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z'/%3E%3C/svg%3E");
7866
+ /* An outline here turns the empty stars into a shape cue (see the docs). */
7867
+ --rating-star-empty: var(--rating-star);
7669
7868
 
7670
7869
  display: inline-flex;
7671
7870
  gap: 0;
@@ -7676,19 +7875,29 @@ a.avatar[aria-disabled="true"] {
7676
7875
  appearance: none;
7677
7876
  flex: 0 0 auto;
7678
7877
  inline-size: calc(var(--rating-size) + var(--rating-gap));
7679
- block-size: var(--rating-size);
7878
+ /* Taller than the star: the hit area grows, the drawing does not. */
7879
+ block-size: calc(var(--rating-size) + var(--space-20));
7680
7880
  margin: 0;
7681
7881
  border: 0;
7682
7882
  background: var(--rating-empty);
7683
7883
  /* Contiguous radio boxes own hit-testing; the centered mask preserves the
7684
- star's proportions while leaving a purely visual gap between values. */
7685
- -webkit-mask: var(--rating-star) center / var(--rating-size) var(--rating-size) no-repeat;
7686
- mask: var(--rating-star) center / var(--rating-size) var(--rating-size) no-repeat;
7884
+ star's proportions while leaving a purely visual gap between values.
7885
+ A rule that fills a star sets --rating-shape, never mask-image: a state
7886
+ selector outranks the forced-colors mask: none below, and its mask-image
7887
+ would clip the native radio there. */
7888
+ -webkit-mask:
7889
+ var(--rating-shape, var(--rating-star-empty)) center / var(--rating-size) var(--rating-size)
7890
+ no-repeat;
7891
+ mask:
7892
+ var(--rating-shape, var(--rating-star-empty)) center / var(--rating-size) var(--rating-size)
7893
+ no-repeat;
7687
7894
  cursor: pointer;
7688
7895
  transition: background-color var(--duration);
7689
7896
  }
7690
7897
 
7691
7898
  .rating > input[type="radio"]:checked {
7899
+ --rating-shape: var(--rating-star);
7900
+
7692
7901
  background: var(--rating-color);
7693
7902
  }
7694
7903
 
@@ -7700,6 +7909,8 @@ a.avatar[aria-disabled="true"] {
7700
7909
  .rating > input[type="radio"]:focus-visible {
7701
7910
  outline: var(--focus-ring-width) solid var(--focus);
7702
7911
  outline-offset: var(--focus-outline-offset);
7912
+ --rating-shape: var(--rating-star);
7913
+
7703
7914
  background: var(--rating-color);
7704
7915
  }
7705
7916
 
@@ -7707,18 +7918,24 @@ a.avatar[aria-disabled="true"] {
7707
7918
  star. The enhancement only adds cumulative checked and hover previews. */
7708
7919
  @supports selector(:has(*)) {
7709
7920
  .rating > input[type="radio"]:has(~ input[type="radio"]:checked) {
7921
+ --rating-shape: var(--rating-star);
7922
+
7710
7923
  background: var(--rating-color);
7711
7924
  }
7712
7925
 
7713
7926
  @media (hover: hover) {
7714
7927
  .rating > input[type="radio"]:not(:disabled):hover,
7715
7928
  .rating > input[type="radio"]:has(~ input[type="radio"]:not(:disabled):hover) {
7929
+ --rating-shape: var(--rating-star);
7930
+
7716
7931
  background: var(--rating-color);
7717
7932
  }
7718
7933
 
7719
7934
  /* A hovered value previews exactly that value: later stars are emptied,
7720
7935
  including a previously checked star beyond the pointer. */
7721
7936
  .rating > input[type="radio"]:not(:disabled):hover ~ input[type="radio"] {
7937
+ --rating-shape: var(--rating-star-empty);
7938
+
7722
7939
  background: var(--rating-empty);
7723
7940
  }
7724
7941
  }
@@ -7749,6 +7966,29 @@ a.avatar[aria-disabled="true"] {
7749
7966
  repeat-x;
7750
7967
  }
7751
7968
 
7969
+ /* The filled share in the filled shape, the rest in the empty one:
7970
+ (filled star ∩ value band) ∪ empty star. With the default empty shape it
7971
+ draws exactly the single layer above. Guarded on purpose: the declaration
7972
+ holds var(), so an engine without composite keywords would not drop it at
7973
+ parse time but invalidate it at computed time, leaving no mask at all — a
7974
+ solid bar. Without it (Chromium before 120), a custom empty shape shows as
7975
+ filled-shape empty stars. */
7976
+ @supports (mask-composite: intersect) {
7977
+ .rating[role="img"] {
7978
+ mask:
7979
+ var(--rating-star) left center / calc(var(--rating-size) + var(--rating-gap))
7980
+ var(--rating-size) repeat-x intersect,
7981
+ linear-gradient(
7982
+ var(--rating-direction),
7983
+ #000 var(--rating-fill),
7984
+ transparent var(--rating-fill)
7985
+ )
7986
+ add,
7987
+ var(--rating-star-empty) left center / calc(var(--rating-size) + var(--rating-gap))
7988
+ var(--rating-size) repeat-x;
7989
+ }
7990
+ }
7991
+
7752
7992
  /* The fill starts at the inline start; only the direction changes, so the
7753
7993
  forced-colors gradient below follows it too. Safari before 16.4 has no
7754
7994
  :dir(); the attribute path is its fallback, as in avatar.css. Each selector
@@ -8484,7 +8724,9 @@ a.avatar[aria-disabled="true"] {
8484
8724
  * list shared with .drawer, fed by the shared --gap token.
8485
8725
  *
8486
8726
  * Public hooks:
8487
- * --state-selected-text (fallback-only: current-link ink, see tokens.css)
8727
+ * --nav-current-bg (fallback-only: current-link fill)
8728
+ * --nav-current-fg (fallback-only: current-link ink)
8729
+ * --nav-list-indent (fallback-only: nested .nav-list inset)
8488
8730
  *
8489
8731
  * Internal:
8490
8732
  * --gap (local value for the shared gap token)
@@ -8535,6 +8777,8 @@ a.avatar[aria-disabled="true"] {
8535
8777
  .nav-link {
8536
8778
  display: inline-flex;
8537
8779
  align-items: center;
8780
+ /* Icon + label rows; a text-only link has one flex item and shows no gap. */
8781
+ gap: var(--space-20);
8538
8782
  min-block-size: var(--control-size-sm);
8539
8783
  padding-block: 0;
8540
8784
  padding-inline: var(--space-20);
@@ -8548,43 +8792,45 @@ a.avatar[aria-disabled="true"] {
8548
8792
  cursor: pointer;
8549
8793
  }
8550
8794
 
8551
- /* nav-link serves two contracts: plain page navigation (aria-current="page")
8552
- and scrollspy, which toggles aria-current="location" on the active link.
8553
- Those two values are the contract; any other, "false" included, is inert.
8554
- Selection never changes text metrics: the shared medium weight is kept and
8555
- the current link is carried by the selected accent. */
8795
+ /* nav-link serves three contracts: plain page navigation (aria-current="page"),
8796
+ scrollspy, which toggles aria-current="location" on the active link, and
8797
+ section navigation (aria-current="true"): a link whose section holds the
8798
+ current page without being it, as on .tab. Those three values are the
8799
+ contract; any other, "false" included, is inert.
8800
+ Selection never changes text metrics: the shared medium weight is kept.
8801
+
8802
+ The current link is neutral: full --text ink over a stronger tint of it,
8803
+ against --text-muted at rest. That is a luminance step on both ink and
8804
+ fill, so the state does not rest on hue. A brand-accent ink was measured
8805
+ and dropped: on light presets the accent is already at 4.5:1 on the page,
8806
+ so any fill strong enough to carry the state pushed it under. */
8556
8807
  .nav-link:hover {
8557
8808
  background: var(--surface-subtle);
8558
8809
  color: var(--text);
8559
8810
  }
8560
8811
 
8561
8812
  /* Current last, equal specificity to :hover (0,2,0): a hovered current link
8562
- keeps the selected accent instead of dropping to --text. The surface fill is
8563
- shared with the hover rule above. */
8564
- .nav-link:is([aria-current="page"], [aria-current="location"]) {
8565
- background: var(--surface-subtle);
8566
- color: var(--state-selected-text, var(--state-selected));
8567
- }
8568
-
8569
- /* On a bar with its own --ui-bg/--ui-fg the fill is a tint of the link's own
8570
- ink, the .btn.ghost hover recipe, so it reads on light and dark bars alike
8571
- instead of snapping back to --surface-subtle. Not --ui-hover-bg: that is the
8572
- bar's own hover and can equal its fill. The ink follows --ui-fg too — the
8573
- selected accent has no contrast pair with an arbitrary bar. The baseline
8574
- above keeps the light chip where color-mix is missing, with ink that is
8575
- legible on it. */
8813
+ keeps its current fill. */
8814
+ .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
8815
+ background: var(--nav-current-bg, var(--surface-subtle));
8816
+ color: var(--nav-current-fg, var(--text));
8817
+ }
8818
+
8819
+ /* Fills are a tint of the link's own ink, the .btn.ghost hover recipe, so they
8820
+ read on light and dark bars alike, including a bar with its own
8821
+ --ui-bg/--ui-fg. Not --ui-hover-bg: that is the bar's own hover and can
8822
+ equal its fill. Current is a step above hover (18% vs 10%), so the current
8823
+ link stays apart while another is hovered. The baseline above keeps a
8824
+ light chip where color-mix is missing. */
8576
8825
  @supports (color: color-mix(in oklch, red, white)) {
8577
- .nav-link:is(:hover, [aria-current="page"], [aria-current="location"]) {
8578
- background: color-mix(in oklch, currentColor 10%, transparent);
8579
- }
8580
-
8581
8826
  .nav-link:hover {
8827
+ background: color-mix(in oklch, currentColor 10%, transparent);
8582
8828
  color: var(--ui-fg, var(--text));
8583
8829
  }
8584
8830
 
8585
- /* After :hover so a hovered current link keeps the selected accent. */
8586
- .nav-link:is([aria-current="page"], [aria-current="location"]) {
8587
- color: var(--ui-fg, var(--state-selected-text, var(--state-selected)));
8831
+ .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
8832
+ background: var(--nav-current-bg, color-mix(in oklch, currentColor 18%, transparent));
8833
+ color: var(--nav-current-fg, var(--ui-fg, var(--text)));
8588
8834
  }
8589
8835
  }
8590
8836
 
@@ -8608,25 +8854,80 @@ a.avatar[aria-disabled="true"] {
8608
8854
  margin: 0;
8609
8855
  }
8610
8856
 
8857
+ /* The positioning context lives on every row link, so becoming current never
8858
+ moves an app-positioned decoration (or the forced-colors trait below) to a
8859
+ new containing block. */
8611
8860
  .nav-list .nav-link {
8612
8861
  position: relative;
8613
8862
  inline-size: 100%;
8614
8863
  }
8615
8864
 
8616
- /* Vertical current indicator: inset inline-start trait in currentColor, so it
8617
- follows the forced palette without a forced-colors block and never touches
8618
- the row separators. Navbar horizontal links keep color + surface only. The
8619
- positioning context lives on every row link, so becoming current never moves
8620
- an app-positioned decoration to a new containing block.
8621
- The trait sits centered in the link's inline padding with rounded ends: flush
8622
- on the edge, a square line read as pasted onto the rounded fill. */
8623
- .nav-list .nav-link:is([aria-current="page"], [aria-current="location"])::before {
8865
+ /* Collapsible group: <details> in a row, <summary class="nav-link"> as its
8866
+ label, a nested .nav-list as its links. The summary takes the link's row,
8867
+ hover and focus; display: inline-flex already drops the list-item marker,
8868
+ the WebKit pseudo is Safari's own. */
8869
+ .nav-list summary.nav-link {
8870
+ list-style: none;
8871
+ }
8872
+
8873
+ .nav-list summary.nav-link::-webkit-details-marker {
8874
+ display: none;
8875
+ }
8876
+
8877
+ /* The open state is the native [open], so the chevron needs no script. */
8878
+ .nav-list summary.nav-link::after {
8624
8879
  content: "";
8625
- position: absolute;
8626
- inset-block: var(--space-20);
8627
- inset-inline-start: calc((var(--space-20) - 2px) / 2);
8628
- border-inline-start: 2px solid currentColor;
8629
- border-radius: var(--radius-full);
8880
+ flex: 0 0 auto;
8881
+ margin-inline-start: auto;
8882
+ inline-size: 1rem;
8883
+ block-size: 1rem;
8884
+ background-color: currentColor;
8885
+ -webkit-mask: var(--icon-chevron) center / contain no-repeat;
8886
+ mask: var(--icon-chevron) center / contain no-repeat;
8887
+ transition: transform var(--duration);
8888
+ }
8889
+
8890
+ .nav-list details[open] > summary.nav-link::after {
8891
+ transform: rotate(180deg);
8892
+ }
8893
+
8894
+ /* A nested list is indented so its labels start under the parent's label,
8895
+ past a 1em leading icon and the link gap. Fallback-only: a base
8896
+ declaration on .nav-list would reset an override at every level. */
8897
+ .nav-list .nav-list {
8898
+ margin-block-start: var(--gap);
8899
+ padding-inline-start: var(--nav-list-indent, calc(1em + var(--space-20)));
8900
+ }
8901
+
8902
+ /* Forced colors drops the fill and maps both inks to LinkText, so the current
8903
+ link would be indistinguishable: it gets a shape instead. A vertical row
8904
+ takes an inline-start trait, centered in the link's inline padding with
8905
+ rounded ends; a horizontal link an underline. */
8906
+ @media (forced-colors: active) {
8907
+ .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
8908
+ text-decoration: underline;
8909
+ text-underline-offset: 0.25em;
8910
+ }
8911
+
8912
+ .nav-list .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
8913
+ text-decoration: none;
8914
+ }
8915
+
8916
+ /* The chevron is a mask over a fill that forced colors would remap to
8917
+ Canvas, as in accordion.css. */
8918
+ .nav-list summary.nav-link::after {
8919
+ background-color: CanvasText;
8920
+ }
8921
+
8922
+ .nav-list
8923
+ .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"])::before {
8924
+ content: "";
8925
+ position: absolute;
8926
+ inset-block: var(--space-20);
8927
+ inset-inline-start: calc((var(--space-20) - 2px) / 2);
8928
+ border-inline-start: 2px solid currentColor;
8929
+ border-radius: var(--radius-full);
8930
+ }
8630
8931
  }
8631
8932
 
8632
8933
  /*
@@ -9142,7 +9443,8 @@ a.avatar[aria-disabled="true"] {
9142
9443
  * fill and focus ring, and the native radio stays visible to carry both.
9143
9444
  *
9144
9445
  * One row of equal shares (grid-auto-columns: 1fr), at least --control-size
9145
- * tall so it lines up with .btn and .input. Labels wrap instead of truncating;
9446
+ * tall so it lines up with .btn and .input; .vertical stacks the segments in
9447
+ * one column instead. Labels wrap instead of truncating;
9146
9448
  * a word longer than its share breaks, so the control never overflows its
9147
9449
  * container. A strip too long for one row is .tabs, which scrolls.
9148
9450
  *
@@ -9157,6 +9459,9 @@ a.avatar[aria-disabled="true"] {
9157
9459
  * --segmented-fg
9158
9460
  * --segmented-selected-bg
9159
9461
  * --segmented-selected-border
9462
+ *
9463
+ * Internal:
9464
+ * --segment-min-size
9160
9465
  */
9161
9466
  .segmented {
9162
9467
  --segmented-bg: var(--surface-subtle);
@@ -9194,8 +9499,14 @@ a.avatar[aria-disabled="true"] {
9194
9499
  own min-block-size: a <fieldset> lays its content in an anonymous box
9195
9500
  sized to the content, so a minimum on the track left the segments short.
9196
9501
  A minimum, not a height: a wrapped label grows the whole row. */
9197
- min-block-size: calc(var(--control-size) - 2 * (var(--segmented-pad) + var(--border-width)));
9502
+ --segment-min-size: calc(var(--control-size) - 2 * (var(--segmented-pad) + var(--border-width)));
9503
+
9504
+ min-block-size: var(--segment-min-size);
9505
+ /* why: the block padding gives a wrapped label room, but must never push
9506
+ one line past the minimum: .compact keeps the 16px font in a 32px control,
9507
+ where a fixed 2px made the track 33px against .btn's 32px. */
9198
9508
  padding: calc(var(--space-10) / 2) var(--space-30);
9509
+ padding-block: clamp(0px, (var(--segment-min-size) - 1lh) / 2, var(--space-10) / 2);
9199
9510
  border: 0;
9200
9511
  border-radius: calc(var(--segmented-radius) - var(--segmented-pad));
9201
9512
  background: transparent;
@@ -9216,6 +9527,19 @@ a.avatar[aria-disabled="true"] {
9216
9527
  box-shadow var(--duration);
9217
9528
  }
9218
9529
 
9530
+ /* Vertical: one segment per row, labels at the inline start. .vertical for
9531
+ radios and links, where aria-orientation is not a valid attribute; a
9532
+ vertical tablist already carries aria-orientation (what the tabs runtime
9533
+ reads for Up/Down), so the layout follows it and cannot disagree. */
9534
+ .segmented:is(.vertical, :where([aria-orientation="vertical"])) {
9535
+ grid-auto-flow: row;
9536
+ }
9537
+
9538
+ .segmented:is(.vertical, :where([aria-orientation="vertical"])) > .segment {
9539
+ justify-content: flex-start;
9540
+ text-align: start;
9541
+ }
9542
+
9219
9543
  .segment > input {
9220
9544
  margin: 0;
9221
9545
  }