@crystal-ui/core 2.5.0 → 2.7.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.
package/README.md CHANGED
@@ -67,7 +67,7 @@ icons, hit areas and focus rings are never blurred.
67
67
  | `@crystal-ui/core/core/preferences` | Preference clamping and duration resolution. |
68
68
  | `@crystal-ui/core/core/spring` | Spring physics: sampling, settling time and overshoot. |
69
69
  | `@crystal-ui/core/core/presets` | Keyframes for the material motion presets, computed from tokens. |
70
- | `@crystal-ui/core/motion-recipes` | The 59 motion recipes, each with its spring and per-platform values. |
70
+ | `@crystal-ui/core/motion-recipes` | The 60 motion recipes, each with its spring and per-platform values. |
71
71
  | `@crystal-ui/core/engines` | The Motion and GSAP engine entry. |
72
72
  | `@crystal-ui/core/icons` | The icon manifest. There are 1022 icons on a 24px grid. |
73
73
  | `@crystal-ui/core/shaders/*` | The optical layer's shader sources and their manifest. |
@@ -66,6 +66,8 @@
66
66
  [data-effects=opaque] :is(.cr-resin,.cr-glass)::before,[data-effects=opaque] :is(.cr-resin,.cr-glass)::after{display:none}
67
67
  @media(prefers-reduced-transparency:reduce){:is(.cr-resin,.cr-glass)::before,:is(.cr-resin,.cr-glass)::after{display:none}}
68
68
  @media(forced-colors:active){:is(.cr-resin,.cr-glass)::before,:is(.cr-resin,.cr-glass)::after{display:none}}
69
+ /* The Resin divider (2.7.0) is a line the pointer holds; in forced colours it is drawn in CanvasText, not erased to Canvas. */
70
+ @media(forced-colors:active){:is(.cr-resin,.cr-glass).divider{background:CanvasText!important}}
69
71
 
70
72
  /* The host supplies activation state; this primitive never samples the desktop. */
71
73
  :is(.cr-plastic,.cr-foundation)[data-window-active="false"]{background-color:var(--cr-plastic-inactive);background-image:none}
@@ -300,6 +302,9 @@ dialog.cr-dialog{position:fixed}
300
302
  .cr-dialog::backdrop,.cr-mirage{background:var(--cr-mirage-fallback-fill);-webkit-backdrop-filter:none;backdrop-filter:none}
301
303
  }
302
304
 
305
+ /* The opaque setting is a request for no translucency, and a scrim is the largest translucent area on screen:
306
+ it takes the same flat fill as reduced transparency (2.7.0). */
307
+ [data-effects=opaque] .cr-mirage,[data-effects=opaque] .cr-dialog::backdrop{background:var(--cr-mirage-fallback-fill);-webkit-backdrop-filter:none;backdrop-filter:none}
303
308
  /* Mirage draws its chroma from the actual backdrop, never an invented overlay gradient. */
304
309
  @supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
305
310
  .cr-dialog::backdrop,.cr-mirage{background:var(--cr-mirage-fallback-fill)}
@@ -392,7 +397,12 @@ dialog.cr-dialog{position:fixed}
392
397
  .cr-field-shell :focus-visible {
393
398
  outline: 0;
394
399
  }
395
- [data-effects=opaque] :is(button,a.cr-button,.cr-control,.cr-field-shell,.cr-resin-haze,.cr-status) {
400
+ /* The three recipes that take the coat off a control (a bare control, a
401
+ navigation entry and a drag handle) have no coat to make opaque. `:where()`
402
+ keeps this rule's specificity at (0,2,1); without the exclusion it outranked
403
+ their (0,2,0) recipes and drew the surface behind them, and the shorthand
404
+ erased the drag handle's grip (fixed in 2.7.0). */
405
+ [data-effects=opaque] :is(button,a.cr-button,.cr-control,.cr-field-shell,.cr-resin-haze,.cr-status):where(:not(.cr-bare,.cr-nav-item,.cr-drag-handle)) {
396
406
  background: var(--cr-surface);
397
407
  -webkit-backdrop-filter: none;
398
408
  backdrop-filter: none;
@@ -1230,6 +1240,7 @@ span.cr-status>span {
1230
1240
  content: none;
1231
1241
  display: none;
1232
1242
  }
1243
+
1233
1244
  /* Resting state only: focus is a box-shadow recipe, and a blanket `none`
1234
1245
  would silently reduce it to a bare outline. */
1235
1246
  .cr-bare:not(:focus-visible) {
@@ -1584,6 +1595,77 @@ input[type=checkbox][role=switch] {
1584
1595
  }
1585
1596
  }
1586
1597
 
1598
+ /* The travelling selection pill (D-37).
1599
+ *
1600
+ * One `.cr-indicator.pill` behind the selected segment of a strip: tabs, a
1601
+ * segmented control, the dock, bottom navigation or a toggle button group. It
1602
+ * is a child of the plane that holds the segments (`.cr-dock`, `.cr-dock-inner`
1603
+ * or `.cr-group`), hidden from assistive technology, and placed by five
1604
+ * measured properties: `--cr-pill-x`, `--cr-pill-y`, `--cr-pill-width` and
1605
+ * `--cr-pill-height`, the selected segment's box inside the plane's padding
1606
+ * edge, and `--cr-pill-radius`, its corners. `CrystalMotion.travel()`
1607
+ * writes them and moves the pill with the `selection-travel` recipe.
1608
+ *
1609
+ * Until the pill is placed (`data-placed`) it is not drawn and each segment
1610
+ * paints its own selection, so a strip with no script, or before its first
1611
+ * measurement, looks as it always has. Once placed, the selected segment gives
1612
+ * its fill and its contact shadow to the pill and keeps its ink and its weight:
1613
+ * selection is still label weight, so the pill is never the only sign of it.
1614
+ *
1615
+ * z-index -1 inside the plane's stacking context puts the pill above the
1616
+ * plane's Haze backing, which is earlier in the tree at the same level, and
1617
+ * under every segment's label without asking the segments to be positioned. */
1618
+ .cr-indicator.pill {
1619
+ display: none;
1620
+ position: absolute;
1621
+ inset: auto;
1622
+ left: var(--cr-pill-x, 0px);
1623
+ top: var(--cr-pill-y, 0px);
1624
+ width: var(--cr-pill-width, 0px);
1625
+ height: var(--cr-pill-height, 0px);
1626
+ min-width: 0;
1627
+ z-index: -1;
1628
+ border: 0;
1629
+ /* The segment's own corners, so the pill is a pill in the dock and keeps
1630
+ a group's square interior corners. */
1631
+ border-radius: var(--cr-pill-radius, 999px);
1632
+ background: var(--cr-primary);
1633
+ box-shadow: 0 3px 7px var(--cr-shadow-contact);
1634
+ list-style: none;
1635
+ margin: 0;
1636
+ padding: 0;
1637
+ }
1638
+ .cr-indicator.pill[data-placed] {
1639
+ display: block;
1640
+ }
1641
+ .cr-indicator.pill::before,
1642
+ .cr-indicator.pill::after {
1643
+ content: none;
1644
+ display: none;
1645
+ }
1646
+ :is(.cr-dock, .cr-dock-inner, .cr-group):has(> .cr-indicator.pill[data-placed]) :is([aria-pressed=true], [aria-selected=true], [aria-checked=true], [aria-current]:not([aria-current=false]), label:has(input[type=radio]:checked)) {
1647
+ background: transparent;
1648
+ box-shadow: none;
1649
+ }
1650
+ :is(.cr-dock, .cr-dock-inner, .cr-group):has(> .cr-indicator.pill[data-placed]) :is([aria-pressed=true], [aria-selected=true], [aria-checked=true])::before {
1651
+ background: transparent;
1652
+ }
1653
+ /* A group's segments paint their own fill, which a dock's do not. In a toggle
1654
+ set with a pill that fill would hide the pill as it passes behind, so every
1655
+ segment gives its fill to the group's plane and the pill is the one fill
1656
+ drawn. A hover keeps its own, on the element rather than this layer. */
1657
+ .cr-group:has(> .cr-indicator.pill[data-placed]) > :is(button, a.cr-button, .cr-button, .cr-control)::before {
1658
+ background: transparent;
1659
+ filter: none;
1660
+ }
1661
+ /* Forced colours draw selection as the segment's own Highlight outline, which
1662
+ stays; a fill the system would flatten to Canvas is not drawn. */
1663
+ @media (forced-colors:active) {
1664
+ .cr-indicator.pill[data-placed] {
1665
+ display: none;
1666
+ }
1667
+ }
1668
+
1587
1669
  /* A group: the `group` surface (D-26).
1588
1670
  *
1589
1671
  * A button group and a split button are one Resin plane whose segments touch:
@@ -1625,7 +1707,10 @@ input[type=checkbox][role=switch] {
1625
1707
  backdrop-filter: none;
1626
1708
  isolation: isolate;
1627
1709
  }
1628
- .cr-group > :is(button, a.cr-button, .cr-button, .cr-control):first-child {
1710
+ /* A toggle set's pill comes first in the group (D-37), so the first segment is
1711
+ the first child or the one straight after the pill. The pill's case is in
1712
+ :where(), so the rule keeps the specificity it had. */
1713
+ .cr-group > :is(button, a.cr-button, .cr-button, .cr-control):is(:first-child, :where(.cr-indicator.pill:first-child) + *) {
1629
1714
  border-start-start-radius: 999px;
1630
1715
  border-end-start-radius: 999px;
1631
1716
  }
@@ -1645,7 +1730,7 @@ input[type=checkbox][role=switch] {
1645
1730
  border-inline-start: 0;
1646
1731
  border-block-start: 1px solid var(--cr-edge);
1647
1732
  }
1648
- .cr-group.vertical > :is(button, a.cr-button, .cr-button, .cr-control):first-child {
1733
+ .cr-group.vertical > :is(button, a.cr-button, .cr-button, .cr-control):is(:first-child, :where(.cr-indicator.pill:first-child) + *) {
1649
1734
  border-radius: 0;
1650
1735
  border-start-start-radius: 999px;
1651
1736
  border-start-end-radius: 999px;
@@ -1758,6 +1843,219 @@ dialog.cr-dialog:has(> .cr-dialog-body):not([open]) {
1758
1843
  box-shadow: none;
1759
1844
  }
1760
1845
  }
1846
+ /* ---------------------------------------------------------------------------
1847
+ Material variants, 2.7.0 (R-28, proposals/2026-11-16-library-material-
1848
+ upstream.md).
1849
+
1850
+ A platform library that needed a surface Crystal had not published wrote it
1851
+ by hand: a Haze fill inset inside a card, a Frost pane without its grain, a
1852
+ Resin handle with no rim. Ruled 16 November 2026, those are corrections the
1853
+ standard takes in, not add-ons, and where a library's surface had drifted
1854
+ from the base recipe the drift is published here as a named variant rather
1855
+ than left in the library. Each variant states only what differs from the
1856
+ surface it modifies, so the base recipe's fallbacks still apply to
1857
+ everything it does not restate, and each variant that restates a fill or a
1858
+ border restates its own reduced-transparency, opaque, no-backdrop and
1859
+ forced-colours routes.
1860
+
1861
+ Selector note: every variant is the surface compound plus one class,
1862
+ `:is(.cr-haze,.cr-surface).flat`, specificity (0,2,0), authored in this
1863
+ layer. That beats the Resin coat `:is(button, …)` (0,1,1) on the
1864
+ properties a variant states, so a `<button>` that wears a variant gets the
1865
+ variant's fill and border, and keeps the coat's pseudo-layers unless the
1866
+ variant says otherwise. A control that must lose the whole coat wears
1867
+ `.cr-bare` as well.
1868
+
1869
+ Supported compositions: `.cr-haze.flat.sunken`, `.cr-frost.pane.flat`,
1870
+ `.cr-frost.docked.flat`, `.cr-frost.sheet.flat`.
1871
+ Other pairs compose by property but are not part of the contract.
1872
+ --------------------------------------------------------------------------- */
1873
+
1874
+ /* Haze, inset. A reading card: the feathered fill stops `--cr-haze-inset` (8px)
1875
+ short of the box, so content padding is measured from the fill and the card
1876
+ has no border box of its own. No shadow under the fill: an inset card sits
1877
+ in a page, it does not float over it. Alerts, empty states, results,
1878
+ product and cart cards, reviews, summaries, a chart's plot. */
1879
+ :is(.cr-haze,.cr-surface).inset {
1880
+ border: 0;
1881
+ }
1882
+ :is(.cr-haze,.cr-surface).inset::before {
1883
+ inset: var(--cr-haze-inset);
1884
+ box-shadow: none;
1885
+ }
1886
+
1887
+ /* Haze, flush. The same card filled to its own edge, for a tile whose content
1888
+ is the card: a gallery thumbnail, a carousel slide, an organisation chart's
1889
+ node, a swatch. */
1890
+ :is(.cr-haze,.cr-surface).flush {
1891
+ border: 0;
1892
+ }
1893
+ :is(.cr-haze,.cr-surface).flush::before {
1894
+ inset: 0;
1895
+ box-shadow: none;
1896
+ }
1897
+ @media (forced-colors:active) {
1898
+ :is(.cr-haze,.cr-surface):is(.inset,.flush) {
1899
+ border: 1px solid CanvasText;
1900
+ }
1901
+ }
1902
+
1903
+ /* Haze, flat. The fill on the element itself, with no feather and no layer:
1904
+ a row in a list or an accordion, a placeholder. A row is one of many and is
1905
+ drawn edge to edge against its neighbours, so a feathered perimeter would
1906
+ blur the seams. `.sunken` is the flat fill recessed: where the fill gives way
1907
+ to the opaque surface, it gives way to the alternate surface instead, so an
1908
+ image placeholder still reads as a well. */
1909
+ :is(.cr-haze,.cr-surface).flat {
1910
+ border: 0;
1911
+ background: var(--cr-haze-fill);
1912
+ }
1913
+ :is(.cr-haze,.cr-surface).flat::before {
1914
+ display: none;
1915
+ }
1916
+ [data-effects=opaque] :is(.cr-haze,.cr-surface).flat {
1917
+ background: var(--cr-surface);
1918
+ }
1919
+ [data-effects=opaque] :is(.cr-haze,.cr-surface).flat.sunken {
1920
+ background: var(--cr-surface-alt);
1921
+ }
1922
+ @media (prefers-reduced-transparency:reduce) {
1923
+ :is(.cr-haze,.cr-surface).flat {
1924
+ background: var(--cr-surface);
1925
+ }
1926
+ :is(.cr-haze,.cr-surface).flat.sunken {
1927
+ background: var(--cr-surface-alt);
1928
+ }
1929
+ }
1930
+ @media (forced-colors:active) {
1931
+ :is(.cr-haze,.cr-surface).flat {
1932
+ background: Canvas;
1933
+ color: CanvasText;
1934
+ border: 1px solid CanvasText;
1935
+ }
1936
+ }
1937
+
1938
+ /* Haze, raised. The fill takes the float shadow, as the dialog's does: a
1939
+ reading surface that opens over everything, such as a command palette. */
1940
+ :is(.cr-haze,.cr-surface).raised::before {
1941
+ box-shadow: var(--cr-shadow-float);
1942
+ }
1943
+
1944
+ /* Frost, pane. The content radius, 28px, instead of the panel's 34px: a pane
1945
+ that sits beside content rather than over it, such as a navigation rail, a
1946
+ filter panel, a tour step or a workspace pane. */
1947
+ :is(.cr-frost,.cr-acrylic).pane {
1948
+ border-radius: var(--cr-radius);
1949
+ }
1950
+
1951
+ /* Frost, flat. No grain. A pane that holds a long column of controls or rows
1952
+ shows the grain as noise behind them; the fill, rim, blur and shadow are
1953
+ unchanged. */
1954
+ :is(.cr-frost,.cr-acrylic).flat::before {
1955
+ display: none;
1956
+ }
1957
+
1958
+ /* Frost, docked. A pane docked to the edges of the window, such as an app bar
1959
+ or a sidebar: no rim, no radius and no shadow, because it does not float.
1960
+ The side it shares with content is the component's to draw. */
1961
+ :is(.cr-frost,.cr-acrylic).docked {
1962
+ border: 0;
1963
+ border-radius: 0;
1964
+ box-shadow: none;
1965
+ }
1966
+
1967
+ /* Frost, sheet. A pane that slides over content from an edge, such as a
1968
+ drawer: the `--cr-edge` rim, the content radius and the float shadow. Which
1969
+ corners square off against the edge is the component's geometry. */
1970
+ :is(.cr-frost,.cr-acrylic).sheet {
1971
+ border: 1px solid var(--cr-edge);
1972
+ border-radius: var(--cr-radius);
1973
+ box-shadow: var(--cr-shadow-float);
1974
+ }
1975
+
1976
+ /* Frost, reading. A transient Frost surface whose content is read, such as a
1977
+ toast or a popover, holds a Haze reading fill. It is painted on `::after`,
1978
+ because `::before` is the grain, and a fill written there is drawn at the
1979
+ grain's opacity. The inset is `--cr-frost-reading-inset`, defaulting to
1980
+ `--cr-haze-inset`; a component sets the former, never the latter, because
1981
+ controls nested inside read `--cr-haze-inset` for their own pads. */
1982
+ :is(.cr-frost,.cr-acrylic).reading {
1983
+ --cr-frost-reading-inset: var(--cr-haze-inset);
1984
+ }
1985
+ :is(.cr-frost,.cr-acrylic).reading::after {
1986
+ content: '';
1987
+ position: absolute;
1988
+ inset: var(--cr-frost-reading-inset);
1989
+ z-index: -1;
1990
+ pointer-events: none;
1991
+ border-radius: inherit;
1992
+ background: var(--cr-haze-fill);
1993
+ filter: blur(var(--cr-haze-feather));
1994
+ }
1995
+ [data-effects=opaque] :is(.cr-frost,.cr-acrylic).reading::after {
1996
+ background: var(--cr-surface);
1997
+ filter: none;
1998
+ }
1999
+ @media (prefers-reduced-transparency:reduce) {
2000
+ :is(.cr-frost,.cr-acrylic).reading::after {
2001
+ background: var(--cr-surface);
2002
+ filter: none;
2003
+ }
2004
+ }
2005
+ @media (forced-colors:active) {
2006
+ :is(.cr-frost,.cr-acrylic).reading::after {
2007
+ display: none;
2008
+ }
2009
+ }
2010
+
2011
+ /* Resin, flat. No sheen. A Resin plane that is a mark rather than a control,
2012
+ such as a stepper's or a timeline's marker: the fill,
2013
+ rim, blur and float shadow, without the optical highlight layers. */
2014
+ :is(.cr-resin,.cr-glass).flat::before,
2015
+ :is(.cr-resin,.cr-glass).flat::after {
2016
+ display: none;
2017
+ }
2018
+
2019
+ /* Resin, divider. The handle between two resizable regions: the Resin fill
2020
+ and blur only, with no rim, shadow or sheen, because it is a line the
2021
+ pointer can hold rather than a plane. Where the fill gives way, it becomes
2022
+ the outline colour, not the surface, so the line stays visible on the
2023
+ surface it divides. */
2024
+ :is(.cr-resin,.cr-glass).divider {
2025
+ border: 0;
2026
+ box-shadow: none;
2027
+ }
2028
+ :is(.cr-resin,.cr-glass).divider::before,
2029
+ :is(.cr-resin,.cr-glass).divider::after {
2030
+ display: none;
2031
+ }
2032
+ [data-effects=opaque] :is(.cr-resin,.cr-glass).divider {
2033
+ background: var(--cr-outline);
2034
+ -webkit-backdrop-filter: none;
2035
+ backdrop-filter: none;
2036
+ }
2037
+ @media (prefers-reduced-transparency:reduce) {
2038
+ :is(.cr-resin,.cr-glass).divider {
2039
+ background: var(--cr-outline);
2040
+ -webkit-backdrop-filter: none;
2041
+ backdrop-filter: none;
2042
+ }
2043
+ }
2044
+ @supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
2045
+ :is(.cr-resin,.cr-glass).divider {
2046
+ background: var(--cr-outline);
2047
+ }
2048
+ }
2049
+ /* Forced colours: the divider is drawn in CanvasText. That rule sits in the
2050
+ reset layer beside the base forced-colours rule, because the base rule's
2051
+ `background: Canvas !important` is there, and an important declaration in an
2052
+ earlier layer beats one in this layer whatever its specificity. */
2053
+
2054
+ /* Field shell, block. The shell as a block that fills its row, for a field
2055
+ laid out in a form rather than set in a line of text. */
2056
+ .cr-field-shell.block {
2057
+ display: flex;
2058
+ }
1761
2059
 
1762
2060
  /* A count (D-27).
1763
2061
  *
package/assets/motion.js CHANGED
@@ -81,6 +81,60 @@
81
81
  element.dataset.crMotionTravel=within?String(Math.round(distance)):'0';
82
82
  return runComponent(element,'layout',within?[{transform:`translate(${dx}px,${dy}px) scale(.98)`},{transform:'translate(0,0) scale(1)'}]:[{opacity:.65},{opacity:1}],Math.min(1200,380+distance*.65),'GSAP',options);
83
83
  }
84
+ /* The travelling selection pill (D-37). `pill` is the strip's one
85
+ `.cr-indicator.pill`, a child of the plane (`.cr-dock`, `.cr-dock-inner` or
86
+ `.cr-group`); `target` is the segment now selected, whose semantics the
87
+ caller has already set. The pill is placed behind the target through five
88
+ properties the stylesheet reads, the target's box and its corners, and
89
+ `data-placed` hands the selection fill from the segments to the pill. The
90
+ first placement, `{ instant: true }` (for a resize or a font load) and
91
+ reduced motion place without travelling. Otherwise the pill travels from
92
+ where it is seen, which mid-flight is not where it was placed, so an
93
+ interrupted travel turns rather than jumps.
94
+
95
+ The two labels' ink crosses on the pill's clock: the arriving label goes
96
+ from the strip's ink to the selected ink as the pill comes under it, and
97
+ the departing label the other way. Holding either ink until the pill lands
98
+ leaves one label in the colour of whatever is about to be behind it: in a
99
+ dark palette the primary is light, and the strip's light ink on it all but
100
+ disappears. Weight is not animated; it changes with the semantics. */
101
+ const chosen=new WeakMap(),inks=new WeakMap();
102
+ function travel(pill,target,options={}){
103
+ if(!(pill instanceof Element)||!(target instanceof Element))throw new TypeError('CrystalMotion.travel requires the pill and the selected segment');
104
+ const strip=pill.parentElement;if(!strip)throw new TypeError('CrystalMotion.travel requires a pill inside its strip');
105
+ for(const animation of inks.get(pill)||[])animation.cancel();inks.delete(pill);
106
+ const box=strip.getBoundingClientRect(),at=rect=>({x:rect.left-box.left-strip.clientLeft,y:rect.top-box.top-strip.clientTop,width:rect.width,height:rect.height});
107
+ const next=at(target.getBoundingClientRect()),placed=pill.hasAttribute('data-placed'),seen=placed?at(pill.getBoundingClientRect()):null;
108
+ const departing=chosen.get(pill);chosen.set(pill,target);
109
+ stop(pill);
110
+ const corners=getComputedStyle(target).borderRadius,before=seen?getComputedStyle(pill).borderRadius:corners;
111
+ for(const [key,value] of Object.entries(next))pill.style.setProperty('--cr-pill-'+key,value+'px');
112
+ pill.style.setProperty('--cr-pill-radius',corners);
113
+ pill.setAttribute('data-placed','');
114
+ const dx=seen?seen.x-next.x:0,dy=seen?seen.y-next.y:0;
115
+ if(!seen||options.instant||!next.width||(Math.abs(dx)<.5&&Math.abs(dy)<.5&&Math.abs(seen.width-next.width)<.5&&Math.abs(seen.height-next.height)<.5)){
116
+ pill.dataset.crMotionName='selection-travel';pill.dataset.crMotionState='instant';return Promise.resolve({status:'instant'});
117
+ }
118
+ const recipe=recipes['selection-travel'];if(!recipe)throw new RangeError('Unknown Crystal motion: selection-travel');
119
+ pill.dataset.crMotionTravel=String(Math.round(Math.hypot(dx,dy)));
120
+ const run=runComponent(pill,'selection-travel',[
121
+ {transform:`translate(${dx}px,${dy}px)`,width:seen.width+'px',height:seen.height+'px',borderRadius:before},
122
+ {transform:'translate(0px,0px)',width:next.width+'px',height:next.height+'px',borderRadius:corners},
123
+ ],recipe.duration,recipe.engine,options);
124
+ if(pill.dataset.crMotionState==='running'){
125
+ pill.setAttribute('data-travelling','');
126
+ if(departing&&departing!==target&&departing.isConnected&&typeof target.animate==='function'){
127
+ const selectedInk=getComputedStyle(target).color,stripInk=getComputedStyle(departing).color;
128
+ const timing={duration:duration(recipe.duration,options.rate),easing:'cubic-bezier(0.22, 0.65, 0.22, 1)'};
129
+ if(selectedInk!==stripInk)inks.set(pill,[
130
+ target.animate([{color:stripInk},{color:selectedInk}],timing),
131
+ departing.animate([{color:selectedInk},{color:stripInk}],timing),
132
+ ]);
133
+ }
134
+ }
135
+ const land=()=>{if(pill.dataset.crMotionState!=='running')pill.removeAttribute('data-travelling');};
136
+ return run.then(result=>{land();return result;},error=>{land();throw error;});
137
+ }
84
138
  function play(element,name,options={}){
85
139
  if(recipes[name]){const recipe=recipes[name];return runComponent(element,name,recipe.keyframes,recipe.duration,recipe.engine,options);}
86
140
 
@@ -146,5 +200,5 @@
146
200
  work is in the request log. The optical layer remains for motion that a
147
201
  person starts. */
148
202
 
149
- root.CrystalMotion=Object.freeze({play,layout,duration,recipes:Object.freeze(recipes),stop,stopAll,reduced,direction,presets:Object.freeze([...Object.keys(durationNames),...Object.keys(recipes)])});
203
+ root.CrystalMotion=Object.freeze({play,layout,travel,duration,recipes:Object.freeze(recipes),stop,stopAll,reduced,direction,presets:Object.freeze([...Object.keys(durationNames),...Object.keys(recipes)])});
150
204
  })(window);
@@ -80,7 +80,7 @@ and the defect that led to the rule, are in
80
80
 
81
81
  ## Reduced motion
82
82
 
83
- `prefers-reduced-motion: reduce` is honoured by every one of the 59 motion recipes. Each
83
+ `prefers-reduced-motion: reduce` is honoured by every one of the 60 motion recipes. Each
84
84
  recipe declares its own `reduced` behaviour, and motion is not switched off globally,
85
85
  because "no animation" and "no *movement*" are different requirements.
86
86
 
package/docs/catalogue.md CHANGED
@@ -33,17 +33,17 @@ Every component is made of one or more of these surfaces. Its Surface row names
33
33
  | Surface | Materials | Recipe | Components | Use |
34
34
  | --- | --- | --- | --- | --- |
35
35
  | <a id="surface-plastic"></a>**Plastic foundation** `plastic` | Plastic | <code>.cr-plastic</code> | 6 | The root scene or window. One contextual, opaque foundation per view; never a component. |
36
- | <a id="surface-frost"></a>**Frost panel** `frost` | Frost | <code>.cr-frost</code> | 48 | Intermediate task frames and every transient surface that opens over content: side panels, drawers, sheets and app bars, and menus, popovers, tooltips and toasts (R15e). Reading content inside it sits on Haze. `.cr-frost.bar` is a transient overlay shaped as a row of controls, a pill with 4px padding: the selection toolbar over highlighted text. |
37
- | <a id="surface-haze"></a>**Haze reading surface** `haze` | Haze | <code>.cr-haze</code> | 88 | Anything read: cards, rows, panels, wells, forms, messages, decisions. 80% fill, 1.95px feather on an isolated paint layer, crisp foreground. `.cr-well` is the same recipe recessed into a Frost or Resin frame. `.cr-haze.overlay` is the recessed overlay: a transient overlay opened inside a pane that is already lifted, drawn as a flat Haze fill with the `--cr-edge` rim and the content shadow, so it can be told from the pane it sits in. |
38
- | <a id="surface-resin"></a>**Resin plane** `resin` | Resin | <code>.cr-resin</code> | 12 | One floating Resin plane with no reading fill of its own, pill-shaped unless it is a panel: a player's transport bar, a pinned element, a Resin handle over imagery or between regions. Controls inside it lose their own backdrop filter, because Resin never contains Resin. A plane whose controls are labels to be read holds a Haze fill as well, and is a dock. `.cr-resin.transport` is the media transport: the pill with 4px block and 12px inline padding around its 48px controls (58px tall with its rim), with tabular time readouts, wrapping to a second row in a player narrower than 420px. `.cr-media` is the stage it sits on (the content radius, the letterbox, `--cr-media-aspect` and `--cr-media-fit`), and `.cr-media-bar` is the region inset 12px, or the safe area in full screen, that holds the transport. |
36
+ | <a id="surface-frost"></a>**Frost panel** `frost` | Frost | <code>.cr-frost</code> | 48 | Intermediate task frames and every transient surface that opens over content: side panels, drawers, sheets and app bars, and menus, popovers, tooltips and toasts (R15e). Reading content inside it sits on Haze. `.cr-frost.bar` is a transient overlay shaped as a row of controls, a pill with 4px padding: the selection toolbar over highlighted text. `.pane` takes the content radius, for a pane beside content: a navigation rail, a filter panel, a workspace pane. `.flat` drops the grain. `.docked` is a pane docked to the window's edges, with no rim, radius or shadow: an app bar, a sidebar. `.sheet` slides over content from an edge, with the `--cr-edge` rim, the content radius and the float shadow: a drawer. `.reading` holds a Haze reading fill on `::after`, inset by `--cr-frost-reading-inset` (default `--cr-haze-inset`): a toast, a popover. `.flat` composes with `.pane`, `.docked` and `.sheet` (2.7.0). |
37
+ | <a id="surface-haze"></a>**Haze reading surface** `haze` | Haze | <code>.cr-haze</code> | 88 | Anything read: cards, rows, panels, wells, forms, messages, decisions. 80% fill, 1.95px feather on an isolated paint layer, crisp foreground. `.cr-well` is the same recipe recessed into a Frost or Resin frame. `.cr-haze.overlay` is the recessed overlay: a transient overlay opened inside a pane that is already lifted, drawn as a flat Haze fill with the `--cr-edge` rim and the content shadow, so it can be told from the pane it sits in. `.inset` is a reading card with no border box, its fill inset by `--cr-haze-inset` and no shadow under it: an alert, a result, a product card. `.flush` is the same card filled to its own edge: a thumbnail, a slide, a chart node. `.flat` is the fill on the element itself, with no feather and no layer: a list or accordion row. `.flat.sunken` falls back to the alternate surface instead of the surface: a placeholder. `.raised` gives the fill the float shadow: a command palette (2.7.0). |
38
+ | <a id="surface-resin"></a>**Resin plane** `resin` | Resin | <code>.cr-resin</code> | 12 | One floating Resin plane with no reading fill of its own, pill-shaped unless it is a panel: a player's transport bar, a pinned element, a Resin handle over imagery or between regions. Controls inside it lose their own backdrop filter, because Resin never contains Resin. A plane whose controls are labels to be read holds a Haze fill as well, and is a dock. `.cr-resin.transport` is the media transport: the pill with 4px block and 12px inline padding around its 48px controls (58px tall with its rim), with tabular time readouts, wrapping to a second row in a player narrower than 420px. `.cr-media` is the stage it sits on (the content radius, the letterbox, `--cr-media-aspect` and `--cr-media-fit`), and `.cr-media-bar` is the region inset 12px, or the safe area in full screen, that holds the transport. `.flat` drops the sheen layers, for a plane that is a mark rather than a control: a step or timeline marker. `.divider` is the handle between resizable regions: the Resin fill and blur only, with no rim, shadow or sheen, falling back to the outline colour (2.7.0). |
39
39
  | <a id="surface-resin-panel"></a>**Resin panel** `resin-panel` | Resin | <code>.cr-resin.panel</code> | 1 | The Resin plane with the content radius instead of the pill, for a floating control plane that is a rectangle: a floating window, a media control bar wider than it is tall. Same fill, rim, blur and float shadow; only the geometry changes. |
40
40
  | <a id="surface-control"></a>**Resin control** `control` | Resin + Haze | <code>.cr-button</code> | 16 | An action: a Resin shell with the 8px-inset Haze reading pad and the optical sheen. Pill geometry with `.cr-button`, which coats a `button` or an `a`; `.cr-control` coats any element. `.primary` tints the pad, `.quiet` removes it, `.danger` adds the destructive boundary. Selected state is the primary pad plus label weight 800. |
41
- | <a id="surface-field"></a>**Field shell** `field` | Resin + Haze | <code>.cr-field-shell</code> | 28 | The Resin surround of a native text entry, with the Haze well the value is read on and the circular field-state badge. The native control keeps its functional boundary and semantics. `.cr-editor` is the editable surface inside a rich text field: the shared prose vocabulary (headings, lists, checklists, marks, insertions and deletions) with the primary caret and a 28% primary selection, distinct from the primary-soft highlight (D-34). `.cr-editor-toolbar` is its toolbar, above the text on a fine pointer and below it, clear of the touch keyboard, on a coarse one. |
41
+ | <a id="surface-field"></a>**Field shell** `field` | Resin + Haze | <code>.cr-field-shell</code> | 28 | The Resin surround of a native text entry, with the Haze well the value is read on and the circular field-state badge. The native control keeps its functional boundary and semantics. `.cr-editor` is the editable surface inside a rich text field: the shared prose vocabulary (headings, lists, checklists, marks, insertions and deletions) with the primary caret and a 28% primary selection, distinct from the primary-soft highlight (D-34). `.cr-editor-toolbar` is its toolbar, above the text on a fine pointer and below it, clear of the touch keyboard, on a coarse one. `.block` is the shell as a block that fills its row, for a field laid out in a form (2.7.0). |
42
42
  | <a id="surface-compact"></a>**Compact display** `compact` | Resin + Haze | <code>.cr-resin-haze</code> | 5 | Small information displays that sit on content: tags, badges, labels, keyboard caps. A Resin shell with the inset Haze pad, 18px radius. Not for anything that opens. Transient overlays are Frost. `.count` is the size for a count: a 20px circle that grows to a pill, filled to its own edge, with no block padding. |
43
43
  | <a id="surface-stone"></a>**Stone label backing** `stone` | Stone | <code>.cr-stone</code> | 3 | A label over an unknown or moving backdrop: a caption on media, a status bar over a scene. 55% light / 60% dark fill, feathered like Haze, crisp text. `.cr-media-caption` is a caption cue rendered by the library: the Stone backing on a box above the transport, never under it. `.large`, `.larger` and `.solid` are the reader's caption style: a cue 1.25 or 1.5 times the size, and a cue on the opaque surface. `::cue` on a `.cr-media` video is the flat fill for the browser's own renderer, which follows the reader's system caption settings. |
44
- | <a id="surface-mirage"></a>**Mirage scrim** `mirage` | Mirage | <code>.cr-mirage</code> | 10 | The chromatic diffusion of the real scene behind a modal. Never a content surface; the decision surface above it is Haze. |
44
+ | <a id="surface-mirage"></a>**Mirage scrim** `mirage` | Mirage | <code>.cr-mirage</code> | 10 | The chromatic diffusion of the real scene behind a modal. Never a content surface; the decision surface above it is Haze. The opaque setting draws it as the flat fallback fill, as reduced transparency does (2.7.0). |
45
45
  | <a id="surface-dialog"></a>**Dialog** `dialog` | Haze + Mirage | <code>.cr-dialog</code> | 2 | A Haze decision surface over a Mirage scrim, with the float shadow. Modality, focus and dismissal are the product's. The surface does not scroll: `.cr-dialog-body`, worn with `.cr-scroll-frost`, scrolls inside it, so the title stays in view and the edge fade does not dissolve the surface. `position: fixed` is for a native `&lt;dialog&gt;`; on any other element the host positions it. |
46
- | <a id="surface-indicator"></a>**Indicator** `indicator` | Haze | <code>.cr-indicator</code> | 2 | A 20px informational circle painting Haze on an isolated layer, or the moving pill behind a selected segment. Haze rather than Resin, because it sits on a surface that is often already translucent. Never a selection mark. |
46
+ | <a id="surface-indicator"></a>**Indicator** `indicator` | Haze | <code>.cr-indicator</code> | 2 | A 20px informational circle painting Haze on an isolated layer, or, as `.cr-indicator.pill`, the primary fill that travels behind the selected segment of a strip (D-37): tabs, a segmented control, the dock, bottom navigation or a toggle button group. The circle is Haze rather than Resin, because it sits on a surface that is often already translucent. Neither is ever the only mark of a selection: the selected segment keeps its label weight, and the circle never marks one at all. |
47
47
  | <a id="surface-status"></a>**Status badge** `status` | Resin + Haze | <code>.cr-status</code> | 1 | The semantic ink and surface pair behind a symbol, with words beside it. Status colours are independent of the palette and are never redefined by it. |
48
48
  | <a id="surface-bubble"></a>**Authored bubble** `bubble` | Haze | <code>.cr-bubble</code> | 1 | A Haze message surface with a directional tight corner. `.own` uses the palette's own-content pair. |
49
49
  | <a id="surface-table"></a>**Table** `table` | Resin + Haze | <code>.cr-table-scroll</code> | 5 | A Resin shell with an inset Haze fill holding the table, with the primary-soft header and the Resin scrollbar. Rows are read on the Haze; sort and selection are announced, and selection is label weight. |
@@ -327,13 +327,13 @@ One floating Resin plane holding labelled destinations on a shared Stone label g
327
327
 
328
328
  <div class="cr-table-scroll"><table class="cr-table cr-table-properties"><tbody>
329
329
  <tr><th scope="row">States</th><td>default, selected, hover, focus</td></tr>
330
- <tr><th scope="row">Material</th><td>Resin plane, Stone label backing, primary fill on the selected destination</td></tr>
330
+ <tr><th scope="row">Material</th><td>Resin plane, Stone label backing, the primary pill behind the selected destination</td></tr>
331
331
  <tr><th scope="row">Surface</th><td><a href="#surface-dock">Dock</a></td></tr>
332
332
  <tr><th scope="row">Geometry</th><td>Pill; 52px minimum destination height</td></tr>
333
333
  <tr><th scope="row">Semantics</th><td>nav landmark; aria-pressed or aria-current on the destination</td></tr>
334
334
  <tr><th scope="row">Crystal supplies</th><td>The single shared plane, label weight for the current entry, elevation</td></tr>
335
335
  <tr><th scope="row">Product owns</th><td>Destinations and routing</td></tr>
336
- <tr><th scope="row">Motion</th><td><code>selection</code></td></tr>
336
+ <tr><th scope="row">Motion</th><td><code>selection-travel</code></td></tr>
337
337
  <tr><th scope="row">Parity</th><td>mui:BottomNavigation · antd:Menu · mantine:SegmentedControl</td></tr>
338
338
  </tbody></table></div>
339
339
 
@@ -361,13 +361,13 @@ A Resin tab strip with a selected tab and an associated panel.
361
361
 
362
362
  <div class="cr-table-scroll"><table class="cr-table cr-table-properties"><tbody>
363
363
  <tr><th scope="row">States</th><td>default, hover, focus, selected, disabled</td></tr>
364
- <tr><th scope="row">Material</th><td>Resin strip, primary fill on the selected tab</td></tr>
364
+ <tr><th scope="row">Material</th><td>Resin strip, the primary pill behind the selected tab</td></tr>
365
365
  <tr><th scope="row">Surface</th><td><a href="#surface-dock">Dock</a></td></tr>
366
366
  <tr><th scope="row">Geometry</th><td>Pill tabs inside a pill strip; 44px minimum</td></tr>
367
367
  <tr><th scope="row">Semantics</th><td>role=tablist/tab/tabpanel with arrow-key, Home and End navigation and aria-selected</td></tr>
368
368
  <tr><th scope="row">Crystal supplies</th><td>Strip material, label weight for the selected tab, focus ring</td></tr>
369
369
  <tr><th scope="row">Product owns</th><td>The roving tabindex implementation and panel content</td></tr>
370
- <tr><th scope="row">Motion</th><td><code>tab-in</code></td></tr>
370
+ <tr><th scope="row">Motion</th><td><code>tab-in</code>, <code>selection-travel</code></td></tr>
371
371
  <tr><th scope="row">Parity</th><td>mantine:Tabs · mui:Tabs · antd:Tabs</td></tr>
372
372
  </tbody></table></div>
373
373
 
@@ -478,9 +478,9 @@ A Resin destination group pinned to the bottom of a narrow view.
478
478
  <tr><th scope="row">Surface</th><td><a href="#surface-dock">Dock</a></td></tr>
479
479
  <tr><th scope="row">Geometry</th><td>Pill; targets at least 44px; respects the safe area.</td></tr>
480
480
  <tr><th scope="row">Semantics</th><td>role="navigation"; the current destination carries aria-current="page".</td></tr>
481
- <tr><th scope="row">Crystal supplies</th><td>Material, geometry, selection by label weight, safe-area inset</td></tr>
481
+ <tr><th scope="row">Crystal supplies</th><td>Material, geometry, selection by label weight with the pill behind it, safe-area inset</td></tr>
482
482
  <tr><th scope="row">Product owns</th><td>Destinations and routing</td></tr>
483
- <tr><th scope="row">Motion</th><td><code>selection</code></td></tr>
483
+ <tr><th scope="row">Motion</th><td><code>selection-travel</code></td></tr>
484
484
  <tr><th scope="row">Parity</th><td>mui:BottomNavigation</td></tr>
485
485
  </tbody></table></div>
486
486
 
@@ -596,9 +596,9 @@ Adjacent actions sharing one Resin plane with internal hairlines.
596
596
  <tr><th scope="row">Surface</th><td><a href="#surface-group">Group</a></td></tr>
597
597
  <tr><th scope="row">Geometry</th><td>Pill outer geometry; interior corners square against neighbours</td></tr>
598
598
  <tr><th scope="row">Semantics</th><td>group role with an accessible name when the buttons are related</td></tr>
599
- <tr><th scope="row">Crystal supplies</th><td>The shared plane and interior separation</td></tr>
599
+ <tr><th scope="row">Crystal supplies</th><td>The shared plane and interior separation; as a toggle set, the pill behind the pressed button</td></tr>
600
600
  <tr><th scope="row">Product owns</th><td>Which actions are grouped</td></tr>
601
- <tr><th scope="row">Motion</th><td><code>press</code></td></tr>
601
+ <tr><th scope="row">Motion</th><td><code>press</code>, <code>selection-travel</code></td></tr>
602
602
  <tr><th scope="row">Parity</th><td>mantine:Button.Group · mui:ButtonGroup · antd:Space.Compact</td></tr>
603
603
  </tbody></table></div>
604
604
 
@@ -952,13 +952,13 @@ A pill strip of mutually exclusive options sharing one Resin plane.
952
952
 
953
953
  <div class="cr-table-scroll"><table class="cr-table cr-table-properties"><tbody>
954
954
  <tr><th scope="row">States</th><td>default, hover, focus, selected, disabled</td></tr>
955
- <tr><th scope="row">Material</th><td>One Resin plane; primary fill on the selected segment</td></tr>
955
+ <tr><th scope="row">Material</th><td>One Resin plane; the primary pill behind the selected segment</td></tr>
956
956
  <tr><th scope="row">Surface</th><td><a href="#surface-dock">Dock</a></td></tr>
957
957
  <tr><th scope="row">Geometry</th><td>Pill strip and pill segments; 44px minimum</td></tr>
958
958
  <tr><th scope="row">Semantics</th><td>Radio group semantics, or aria-pressed on buttons; never aria-selected outside a tablist</td></tr>
959
959
  <tr><th scope="row">Crystal supplies</th><td>Shared plane, label weight for the selected segment, focus ring</td></tr>
960
960
  <tr><th scope="row">Product owns</th><td>Options and change handling</td></tr>
961
- <tr><th scope="row">Motion</th><td><code>selection</code></td></tr>
961
+ <tr><th scope="row">Motion</th><td><code>selection-travel</code></td></tr>
962
962
  <tr><th scope="row">Parity</th><td>mantine:SegmentedControl · mui:ToggleButtonGroup · antd:Segmented</td></tr>
963
963
  </tbody></table></div>
964
964
 
@@ -112,6 +112,25 @@ The media and text recipes of 2.4.0 add no surface. Each is a selector on a surf
112
112
 
113
113
  A native switch is a checkbox with a track, `<input type="checkbox" role="switch">`, styled by element like the checkbox and radio. The track reads `--cr-switch-track-width` and `-height`, the thumb is the opaque surface, and the on state is the primary-soft pair.
114
114
 
115
+ The material variants of 2.7.0 add no surface either. Each was a surface a platform library had drawn by hand because Crystal had not published it; ruled on 16 November 2026, those are corrections the standard takes in, and where a library's surface had drifted from the base recipe the drift is published as a named variant. Each variant states only what differs from the surface it modifies, so the base recipe's opaque, reduced-transparency, no-backdrop and forced-colours routes still apply to everything else, and each variant that restates a fill or a border carries its own routes. A variant is the surface compound plus one class, authored in the component layer, so on a `<button>` it beats the Resin coat on what it states; a control that must lose the whole coat wears `.cr-bare` as well.
116
+
117
+ | Variant | Surface | What it is |
118
+ |---|---|---|
119
+ | `.cr-haze.inset` | Haze reading surface | A reading card with no border box: the feathered fill stops `--cr-haze-inset` (8px) short of the box, with no shadow under it. An alert, an empty state, a result, a product or cart card, a review, a chart's plot. Forced colours draw a CanvasText boundary. |
120
+ | `.cr-haze.flush` | Haze reading surface | The same card filled to its own edge, for a tile whose content is the card: a thumbnail, a slide, an organisation chart's node, a swatch. |
121
+ | `.cr-haze.flat`, `.flat.sunken` | Haze reading surface | The fill on the element itself, with no feather and no layer: a row in a list or an accordion, drawn edge to edge against its neighbours. It becomes the surface where translucency gives way; `.sunken` becomes the alternate surface instead, for a placeholder that should still read as a well. |
122
+ | `.cr-haze.raised` | Haze reading surface | The fill takes the float shadow, as the dialog's does: a reading surface opened over everything, such as a command palette. |
123
+ | `.cr-frost.pane` | Frost panel | The content radius, 28px, instead of the panel's 34px, for a pane beside content: a navigation rail, a filter panel, a tour step, a workspace pane. |
124
+ | `.cr-frost.flat` | Frost panel | No grain, for a pane holding a long column of controls or rows. Composes with `.pane`, `.docked` and `.sheet`. |
125
+ | `.cr-frost.docked` | Frost panel | A pane docked to the window's edges, such as an app bar or a sidebar: no rim, radius or shadow. The side it shares with content is the component's to draw. |
126
+ | `.cr-frost.sheet` | Frost panel | A pane that slides over content from an edge, such as a drawer: the `--cr-edge` rim, the content radius and the float shadow. Which corners square off against the edge is the component's geometry. |
127
+ | `.cr-frost.reading` | Frost panel | A transient Frost surface whose content is read, such as a toast or a popover, holding a Haze reading fill on `::after`, because `::before` is the grain. The inset is `--cr-frost-reading-inset`, which defaults to `--cr-haze-inset`; set the former, never the latter, because controls inside read `--cr-haze-inset` for their own pads. |
128
+ | `.cr-resin.flat` | Resin plane | No sheen: a plane that is a mark rather than a control, such as a step or timeline marker. |
129
+ | `.cr-resin.divider` | Resin plane | The handle between resizable regions: the Resin fill and blur only, with no rim, shadow or sheen. Where the fill gives way it becomes the outline colour, so the line stays visible on the surface it divides, and CanvasText in forced colours. |
130
+ | `.cr-field-shell.block` | Field shell | The shell as a block that fills its row, for a field laid out in a form rather than set in a line of text. |
131
+
132
+ Two existing recipes changed in 2.7.0. `.cr-mirage` and a dialog's `::backdrop` now take the flat fallback fill with no backdrop filter under `[data-effects=opaque]`, as they already did under reduced transparency; before, the opaque setting left the largest translucent area on screen translucent. And `.cr-bare`, `.cr-nav-item` and `.cr-drag-handle` on a `<button>` now stay transparent under `[data-effects=opaque]`: the coat's opaque route had outranked them, drawing the surface behind a bare control and erasing the drag handle's grip.
133
+
115
134
  ### Interaction surface geometry
116
135
 
117
136
  Use a broad, luminous Resin rim with an 8px inset reading fill and diffuse paired shadows. Avoid thin dark perimeter strokes on ordinary action buttons; native text-entry fields retain a functional boundary and every control retains a visible keyboard focus ring. Standalone actions use generous padding and full pill geometry.