shelving 1.292.0 → 1.292.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.292.0",
3
+ "version": "1.292.1",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,11 @@
1
- @layer base {
1
+ @import url("../style/layers.css");
2
+ @import url("../style/Duration.module.css");
3
+
4
+ /* Global CSS, not a CSS module — see `Transition.css` for why. */
5
+ @layer defaults {
2
6
  :root {
3
- --horizontal-transition-size: 25vw;
7
+ /* A percentage is of the snapshot's own size, so the old and new content sit edge to edge and never overlap. */
8
+ --horizontal-transition-size: 100%;
4
9
  --horizontal-transition-duration: var(--duration-normal);
5
10
  }
6
11
  }
@@ -53,6 +58,12 @@
53
58
  }
54
59
  }
55
60
 
61
+ /* Clip the slide to the element's own box, so it does not paint over the content around it. */
62
+ ::view-transition-group(.slide-right),
63
+ ::view-transition-group(.slide-left) {
64
+ overflow: clip;
65
+ }
66
+
56
67
  ::view-transition-new(.slide-right) {
57
68
  animation: slide-in-from-right var(--horizontal-transition-duration) ease-in-out both;
58
69
  }
@@ -7,6 +7,17 @@ A direction-aware `<Transition>` preset that slides its children horizontally
7
7
  - Slides right by default and when the type is `"forward"`; slides left when the type is `"back"`.
8
8
  - Set the direction with `setTransitionType("forward" | "back")` inside a `startTransition()` callback before navigating — see `<Transition>`.
9
9
  - Pass `overlay` to raise the transition group above surrounding content during the animation (`z-index: 100`).
10
+ - The old and new content slide a full width apart, so they sit edge to edge and never overlap.
11
+ - The slide is clipped to the element's own box (`overflow: clip` on the group), so it does not paint over the content around it.
12
+ - During the slide, the snapshots paint above fixed elements such as a bottom bar. To keep a fixed element on top, give it its own `view-transition-name` and put the slide groups below it:
13
+
14
+ ```css
15
+ ::view-transition-group(.slide-right),
16
+ ::view-transition-group(.slide-left) {
17
+ z-index: -1;
18
+ }
19
+ ```
20
+
10
21
  - Under `prefers-reduced-motion: reduce` the slide distance is forced to `0`, so the transition degrades to an opacity-only crossfade with no positional movement (large viewport-level slides are exactly what the preference exists to suppress).
11
22
 
12
23
  ## Usage
@@ -33,7 +44,7 @@ function navigate(direction: "forward" | "back", url: string) {
33
44
 
34
45
  | Variable | Styles | Default |
35
46
  |---|---|---|
36
- | `--horizontal-transition-size` | Slide distance for the enter/leave keyframes | `25vw` |
47
+ | `--horizontal-transition-size` | Slide distance for the enter/leave keyframes. A percentage is of the element's own width. | `100%` |
37
48
  | `--horizontal-transition-duration` | Duration of the slide keyframes | `var(--duration-normal)` |
38
49
 
39
50
  **Global tokens it reads** — `--duration-normal`.
@@ -1,6 +1,11 @@
1
- @layer base {
1
+ @import url("../style/layers.css");
2
+ @import url("../style/Duration.module.css");
3
+
4
+ /* Global CSS, not a CSS module — see `Transition.css` for why. */
5
+ @layer defaults {
2
6
  :root {
3
- --vertical-transition-size: 25vh;
7
+ /* A percentage is of the snapshot's own size, so the old and new content sit edge to edge and never overlap. */
8
+ --vertical-transition-size: 100%;
4
9
  --vertical-transition-duration: var(--duration-normal);
5
10
  }
6
11
  }
@@ -53,6 +58,12 @@
53
58
  }
54
59
  }
55
60
 
61
+ /* Clip the slide to the element's own box, so it does not paint over the content around it. */
62
+ ::view-transition-group(.slide-up),
63
+ ::view-transition-group(.slide-down) {
64
+ overflow: clip;
65
+ }
66
+
56
67
  ::view-transition-new(.slide-up) {
57
68
  animation: slide-in-from-bottom var(--vertical-transition-duration) ease-in-out both;
58
69
  }
@@ -7,6 +7,17 @@ A direction-aware `<Transition>` preset that slides its children vertically —
7
7
  - Slides down by default and when the type is `"forward"`; slides up when the type is `"back"`.
8
8
  - Set the direction with `setTransitionType("forward" | "back")` inside a `startTransition()` callback before navigating — see `<Transition>`.
9
9
  - Pass `overlay` to raise the transition group above surrounding content during the animation (`z-index: 100`).
10
+ - The old and new content slide a full height apart, so they sit edge to edge and never overlap.
11
+ - The slide is clipped to the element's own box (`overflow: clip` on the group), so it does not paint over the content around it.
12
+ - During the slide, the snapshots paint above fixed elements such as a bottom bar. To keep a fixed element on top, give it its own `view-transition-name` and put the slide groups below it:
13
+
14
+ ```css
15
+ ::view-transition-group(.slide-up),
16
+ ::view-transition-group(.slide-down) {
17
+ z-index: -1;
18
+ }
19
+ ```
20
+
10
21
  - Under `prefers-reduced-motion: reduce` the slide distance is forced to `0`, so the transition degrades to an opacity-only crossfade with no positional movement (large viewport-level slides are exactly what the preference exists to suppress).
11
22
 
12
23
  ## Usage
@@ -23,7 +34,7 @@ import { VerticalTransition } from "shelving/ui";
23
34
 
24
35
  | Variable | Styles | Default |
25
36
  |---|---|---|
26
- | `--vertical-transition-size` | Slide distance for the enter/leave keyframes | `25vh` |
37
+ | `--vertical-transition-size` | Slide distance for the enter/leave keyframes. A percentage is of the element's own height. | `100%` |
27
38
  | `--vertical-transition-duration` | Duration of the slide keyframes | `var(--duration-normal)` |
28
39
 
29
40
  **Global tokens it reads** — `--duration-normal`.