Size the loading indicator and publish the rail's value
Two gaps found rewriting the Boost skill for 2.0's plain CSS, each
closed the way M3 describes it.
`<x-loading size="96">`: M3 gives the loading indicator a responsive
size, 48dp by default and flexible from 24 to 240dp ("never exceed that
range"), with the container and the active shape in a fixed ratio. The
size had no prop, so an application wrote a width and height of its own;
`size` now takes a whole number of px in that range, written as
`--md-loading-size`, and the SVG keeps the 48:38 ratio as it scales. A
value outside the range is ignored, as `<x-icon>` and `<x-shape>` ignore
theirs, and an application's own width and height still win.
`--md-navigation-rail-value`: M3 Expressive's rail has two values,
collapsed and expanded (Compose's WideNavigationRailValue), and content
in a rail follows it. Without a hook an application copied the rail's
seven conditions — mode, `data-rail`, `data-rail-auto`, open, and the
window band — out of navigation-rail.css. The rail now publishes the
answer from the same branches that narrow it: `expanded` by default,
`collapsed` wherever it is drawn collapsed, so a style query in the
application's CSS switches at the first paint and at the same moment
as the rail's own items. A rail open over a scrim reads `expanded`, and
outside a rail the property is unset. A JS attribute would have missed
the first paint; a width container query would have lagged the collapse
animation.
Style queries on a custom property need Firefox 151, so the browser
floor moves from Firefox 147 to 151 (README, the CI note, UPGRADE's new
2.1.0 section); Chrome 125 and Safari 18.4 are unchanged.
Browser tests pin both in Chrome, Firefox and Safari: the indicator's
drawn box at 96 and 32px, and the rail's value — with a style query
acting on it — at the first paint for fixed modes, across the window
classes and the menu button for an adaptive rail, and open and closed
for a modal one. NavigationRailTest pins the value in each of the five
collapsed branches.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
24eb811f34
commit
f2a3c4d056
@@ -4,7 +4,9 @@
|
||||
*
|
||||
* The drawing is resources/svg/loading-indicator/, ported from androidx Compose Material 3's
|
||||
* LoadingIndicator in bin/loading-indicator.mjs (Apache-2.0): LoadingIndicatorTokens' 38px
|
||||
* indicator in a 48px container, which is the size here unless the caller's CSS sizes it. It is
|
||||
* indicator in a 48px container, which is the size here unless `size` (`--md-loading-size`, 24 to
|
||||
* 240px, M3's responsive range) or the caller's CSS sizes it; the SVG scales with its box, so the
|
||||
* container and the shape keep their ratio at every size. It is
|
||||
* drawn in the text colour, `primary` (ActiveIndicatorColor) unless the caller colours it;
|
||||
* `contained` puts it on a `primary-container` circle in `on-primary-container`
|
||||
* (ContainedContainerColor, ContainedIndicatorColor), for a spinner over content.
|
||||
@@ -21,8 +23,8 @@
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
inline-size: 48px;
|
||||
block-size: 48px;
|
||||
inline-size: var(--md-loading-size, 48px);
|
||||
block-size: var(--md-loading-size, 48px);
|
||||
color: var(--md-sys-color-primary);
|
||||
|
||||
& > svg {
|
||||
|
||||
@@ -18,9 +18,8 @@
|
||||
* [data-md-navigation-rail-item] navigation-rail-item.css
|
||||
* [data-md-navigation-rail-footer] never scrolls
|
||||
*
|
||||
* **Collapsed**, reproduced from the Tailwind-era custom variant named `rail-collapsed`: a rail (and
|
||||
* anything in it) is drawn collapsed while any of these hold, each its own rule below wherever a
|
||||
* property differs by shape — a fixed `collapsed` mode; a `collapsible` rail the visitor collapsed
|
||||
* **Collapsed**: a rail (and anything in it) is drawn collapsed while any of these hold, each its
|
||||
* own rule below wherever a property differs by shape — a fixed `collapsed` mode; a `collapsible` rail the visitor collapsed
|
||||
* (`<html data-rail="collapsed">`, set before the first paint by `<x-theme-script>`) and not
|
||||
* currently open over the page; a `modal` rail not open; below `medium` (600px) a `collapsible`
|
||||
* rail regardless of choice, M3's floor ("compact → use a navigation bar, not a standard rail");
|
||||
@@ -34,6 +33,13 @@
|
||||
* `resources/js/navigation.js` reads the same numbers, so the menu button and the drawing agree at
|
||||
* every width.
|
||||
*
|
||||
* The first set of branches also publishes the answer: `--md-navigation-rail-value` is `expanded`
|
||||
* on every rail and `collapsed` wherever those branches hold — M3's two rail values, Compose's
|
||||
* WideNavigationRailValue — so what an application puts in a rail reads it with
|
||||
* `@container style(--md-navigation-rail-value: collapsed)` rather than copying the conditions. It
|
||||
* is an unregistered custom property, so it inherits into every descendant and is unset outside a
|
||||
* rail, where neither value matches.
|
||||
*
|
||||
* `data-md-width="narrow"` is M3's other collapsed width, `NarrowContainerWidth` 80px against the
|
||||
* default 96 (`CollapsedContainerWidth`) — a variable, so every rule below that has its own reason
|
||||
* to name a collapsed width does not have to know which one applies.
|
||||
@@ -66,6 +72,7 @@
|
||||
[data-md-navigation-rail] {
|
||||
--navigation-rail-expanded-width: clamp(220px, var(--navigation-rail-width, 256px), 360px);
|
||||
--navigation-rail-collapsed-width: 96px;
|
||||
--md-navigation-rail-value: expanded;
|
||||
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
@@ -81,17 +88,20 @@
|
||||
[data-md-navigation-rail='modal']:not([data-md-open]) *
|
||||
) {
|
||||
width: var(--navigation-rail-collapsed-width);
|
||||
--md-navigation-rail-value: collapsed;
|
||||
}
|
||||
|
||||
@media (width < 600px) {
|
||||
&:where([data-md-navigation-rail='collapsible']:not([data-md-open]), [data-md-navigation-rail='collapsible']:not([data-md-open]) *) {
|
||||
width: var(--navigation-rail-collapsed-width);
|
||||
--md-navigation-rail-value: collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width < 840px) {
|
||||
&:where([data-md-navigation-rail='adaptive']:not([data-md-open]), [data-md-navigation-rail='adaptive']:not([data-md-open]) *) {
|
||||
width: var(--navigation-rail-collapsed-width);
|
||||
--md-navigation-rail-value: collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +111,7 @@
|
||||
:is([data-rail='collapsed'], [data-rail-auto]) [data-md-navigation-rail='adaptive']:not([data-md-open]) *
|
||||
) {
|
||||
width: var(--navigation-rail-collapsed-width);
|
||||
--md-navigation-rail-value: collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +121,7 @@
|
||||
[data-rail='collapsed'] [data-md-navigation-rail='adaptive']:not([data-md-open]) *
|
||||
) {
|
||||
width: var(--navigation-rail-collapsed-width);
|
||||
--md-navigation-rail-value: collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user