maverick-wave 5.10.0 → 5.11.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/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "maverick-wave",
3
- "version": "5.10.0",
3
+ "version": "5.11.0",
4
4
  "config": {
5
- "version_short": "5.10"
5
+ "version_short": "5.11"
6
6
  },
7
7
  "description": "A lightweight, modern CSS framework for building responsive websites with elegance and speed.",
8
8
  "main": "src/js/main.js",
package/src/js/main.js CHANGED
@@ -555,8 +555,9 @@
555
555
  // ===== Scroll Reveal =====
556
556
 
557
557
  // The cards ride the browser's own view timeline where there is one
558
- // (_reveal.scss). Firefox has none, so there an observer stands in: hide what
559
- // is still below the fold, run the same keyframes when it arrives.
558
+ // (_reveal.scss). Older Safari and Firefox have none, so there an observer
559
+ // stands in: hide what is still below the fold, run the same keyframes when
560
+ // it arrives.
560
561
  function initReveals() {
561
562
  if (CSS.supports('animation-timeline', 'view()')) return;
562
563
  if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
@@ -62,7 +62,26 @@
62
62
  Add <code>mw-parallax-rise</code> next to it and the picture lifts by
63
63
  <code>12vh</code> while the text stays where it is - a pinned block does not
64
64
  travel through the viewport, so that layer runs on the document's own scroll
65
- instead. <code>--mw-parallax-depth</code> is the dial, here as everywhere.
65
+ instead, over the first screen of it. That makes it a hero move: further down
66
+ the page those pixels are long gone and the picture holds still.
67
+ <code>--mw-parallax-depth</code> is the dial, here as everywhere. Several
68
+ pinned blocks on one page are fine, each takes over from the one before.
69
+ </p>
70
+
71
+ <h4 class="mw-text-medium mw-mb-2">
72
+ Slow - <code>mw-parallax-slow</code>, the block travels behind the page
73
+ </h4>
74
+ <p class="mw-text-muted mw-text-measure mw-mb-6">
75
+ The band before the components section on this page: it keeps its place in the
76
+ flow and moves at a quarter of your scrolling, so picture and text are still
77
+ going while the next section closes in from below. Pinning is the same move
78
+ with the tempo at zero.
79
+ <code>--mw-parallax-slow-travel</code> (<code>45vh</code>) is the dial and
80
+ reads against the block's own height - half the height is half speed, the full
81
+ height stands still. Going past it sends the block backwards. The dial belongs
82
+ on the element carrying the class, the height on the
83
+ <code>mw-parallax</code> block inside it: set on the inner block it never
84
+ reaches the animation and the tempo stays at the default.
66
85
  </p>
67
86
 
68
87
  <h4 class="mw-text-medium mw-mb-2">
@@ -348,6 +348,7 @@
348
348
  }
349
349
 
350
350
  &-content {
351
+ align-self: stretch;
351
352
  padding-left: spacing('3');
352
353
  }
353
354
  }
@@ -63,11 +63,11 @@
63
63
  }
64
64
  }
65
65
 
66
- // Firefox ships no scroll timelines, so there the script toggles these
67
- // classes instead (main.js) - the same two positions, triggered instead of
68
- // scrubbed. State and transition are separate because the script sets the
69
- // state a frame earlier: together they would send the bar sliding away in
70
- // front of the reader instead of having it gone already.
66
+ // Older Safari and Firefox ship no scroll timelines, so there the script
67
+ // toggles these classes instead (main.js) - the same two positions,
68
+ // triggered instead of scrubbed. State and transition are separate because
69
+ // the script sets the state a frame earlier: together they would send the
70
+ // bar sliding away in front of the reader instead of having it gone already.
71
71
  @media (prefers-reduced-motion: no-preference) {
72
72
  .mw-header-reveal.mw-header-away {
73
73
  top: calc(-1 * var(--mw-header-reveal-offset));
@@ -86,6 +86,35 @@
86
86
  --mw-parallax-pattern-depth: 4vh;
87
87
  }
88
88
 
89
+ // A third way to use the scroll, between the two above: the block keeps its
90
+ // place in the flow but travels slower than the page, so the section after it
91
+ // closes in from below while picture and text are still moving.
92
+ //
93
+ // `exit` and never `cover`: the block leaves a gap where it used to sit, and
94
+ // the exit phase is the one that starts once its top edge is already past the
95
+ // top of the screen - which is where that gap then stays.
96
+ //
97
+ // Travel over the block's own height is what sets the tempo: half the height
98
+ // is half speed, the full height stands still and is mw-parallax-sticky.
99
+ .mw-parallax-slow {
100
+ --mw-parallax-slow-travel: 45vh;
101
+
102
+ position: relative;
103
+ z-index: 0;
104
+ }
105
+
106
+ @supports (animation-timeline: view()) {
107
+ @media (prefers-reduced-motion: no-preference) {
108
+ .mw-parallax-slow {
109
+ animation-name: mw-parallax-band;
110
+ animation-timing-function: linear;
111
+ animation-fill-mode: both;
112
+ animation-timeline: view();
113
+ animation-range: exit 0% exit 100%;
114
+ }
115
+ }
116
+ }
117
+
89
118
  // A second layer on top of the first, added to the same media element. It
90
119
  // travels a third of the distance, and it is that difference between the two
91
120
  // that reads as depth - one layer alone only slides. What it carries is a
@@ -97,10 +126,15 @@
97
126
  background-image: var(--mw-parallax-pattern-image, none);
98
127
  }
99
128
 
100
- // Everything after it has to cover it, or the pinned picture shows through the
101
- // gaps. The z-index needs the weight of a class to beat the plain
102
- // `position: relative` those sections carry.
103
- .mw-parallax-sticky ~ * {
129
+ // Both variants above are overtaken rather than scrolled away, so everything
130
+ // after them has to cover them or the picture shows through the gaps. The
131
+ // z-index needs the weight of a class to beat the plain `position: relative`
132
+ // those sections carry.
133
+ //
134
+ // Except a pinned block: `position: relative` here and `sticky` above carry
135
+ // the same weight, and this rule is the later one - it would take the pinning
136
+ // away from every band after the first.
137
+ :is(.mw-parallax-sticky, .mw-parallax-slow) ~ *:not(.mw-parallax-sticky) {
104
138
  position: relative;
105
139
  z-index: 1;
106
140
  }
@@ -108,7 +142,9 @@
108
142
  // Zero specificity on purpose: it is a floor, not a rule. A section that
109
143
  // paints its own surface - mw-section-alternate, a project's own band - has
110
144
  // to win here, and this file is forwarded last.
111
- :where(.mw-parallax-sticky ~ *) {
145
+ :where(
146
+ :is(.mw-parallax-sticky, .mw-parallax-slow) ~ *:not(.mw-parallax-sticky)
147
+ ) {
112
148
  background: var(--mw-page-background);
113
149
  }
114
150
 
@@ -155,10 +191,10 @@
155
191
  }
156
192
  }
157
193
 
158
- // Firefox ships no scroll timelines, so there the script writes the progress
159
- // and the travel is worked out here (main.js). Keeping the transform in CSS
160
- // is what lets every depth variant above - and an inline
161
- // `--mw-parallax-depth` - go on working untouched.
194
+ // Older Safari and Firefox ship no scroll timelines, so there the script
195
+ // writes the progress and the travel is worked out here (main.js). Keeping
196
+ // the transform in CSS is what lets every depth variant above - and an
197
+ // inline `--mw-parallax-depth` - go on working untouched.
162
198
  //
163
199
  // 0 puts the layer at +depth and 1 at -depth, the two ends of the keyframes.
164
200
  @media (prefers-reduced-motion: no-preference) {
@@ -171,6 +207,16 @@
171
207
  }
172
208
  }
173
209
 
210
+ @keyframes mw-parallax-band {
211
+ from {
212
+ transform: translateY(0);
213
+ }
214
+
215
+ to {
216
+ transform: translateY(var(--mw-parallax-slow-travel));
217
+ }
218
+ }
219
+
174
220
  @keyframes mw-parallax {
175
221
  from {
176
222
  transform: translate3d(0, var(--mw-parallax-depth), 0);
@@ -35,11 +35,11 @@
35
35
  }
36
36
  }
37
37
 
38
- // Firefox ships no scroll timelines at all, so there the script drives the
39
- // same movement (main.js): `mw-reveal-hidden` while the element waits below
40
- // the fold, `mw-reveal-run` once it enters. Both classes are added by the
41
- // script and never by the markup - a page without JS keeps everything
42
- // visible, which is what the guard above is for.
38
+ // Older Safari and Firefox ship no scroll timelines, so there the script
39
+ // drives the same movement (main.js): `mw-reveal-hidden` while the element
40
+ // waits below the fold, `mw-reveal-run` once it enters. Both classes are
41
+ // added by the script and never by the markup - a page without JS keeps
42
+ // everything visible, which is what the guard above is for.
43
43
  @media (prefers-reduced-motion: no-preference) {
44
44
  .mw-reveal-hidden {
45
45
  opacity: 0;