vlite3 1.5.43 → 1.5.45
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/directives/ScrollReveal/ScrollRevealMotion.d.ts +4 -0
- package/directives/ScrollReveal/ScrollRevealMotion.js +68 -56
- package/directives/ScrollReveal/ScrollRevealOptions.d.ts +1 -0
- package/directives/ScrollReveal/ScrollRevealOptions.js +3 -3
- package/directives/ScrollReveal/ScrollRevealPager.d.ts +1 -0
- package/directives/ScrollReveal/ScrollRevealPager.js +74 -50
- package/docs/ScrollRevealReleaseAudit.md +86 -0
- package/docs/components/scroll-reveal.md +17 -9
- package/docs-manifest.json +4 -4
- package/package.json +1 -1
|
@@ -4,6 +4,9 @@ import { ScrollRevealOptions } from './ScrollRevealOptions';
|
|
|
4
4
|
export declare class ScrollRevealMotion {
|
|
5
5
|
private records;
|
|
6
6
|
private observer?;
|
|
7
|
+
private lifetime;
|
|
8
|
+
private lastPosition;
|
|
9
|
+
private upward;
|
|
7
10
|
private context;
|
|
8
11
|
constructor(context: ScrollRevealContext);
|
|
9
12
|
register(element: HTMLElement, options: Required<ScrollRevealOptions>): void;
|
|
@@ -11,6 +14,7 @@ export declare class ScrollRevealMotion {
|
|
|
11
14
|
private cancel;
|
|
12
15
|
show(target: Node, descendants?: boolean, only?: HTMLElement): void;
|
|
13
16
|
refresh(): void;
|
|
17
|
+
private onScroll;
|
|
14
18
|
private onEntries;
|
|
15
19
|
destroy(): void;
|
|
16
20
|
}
|
|
@@ -1,92 +1,104 @@
|
|
|
1
|
-
class
|
|
1
|
+
class w {
|
|
2
2
|
records = /* @__PURE__ */ new Map();
|
|
3
3
|
observer;
|
|
4
|
+
lifetime = new AbortController();
|
|
5
|
+
lastPosition;
|
|
6
|
+
upward = !1;
|
|
4
7
|
context;
|
|
5
|
-
constructor(
|
|
6
|
-
this.context =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
constructor(e) {
|
|
9
|
+
if (this.context = e, this.lastPosition = e.position(), typeof IntersectionObserver > "u" || typeof Element.prototype.animate != "function") return;
|
|
10
|
+
(e.documentRoot ? document : e.container).addEventListener("scroll", this.onScroll, { passive: !0, signal: this.lifetime.signal }), this.observer = new IntersectionObserver(this.onEntries, {
|
|
11
|
+
root: e.documentRoot ? null : e.container,
|
|
12
|
+
threshold: Array.from({ length: 101 }, (t, i) => i / 100)
|
|
13
|
+
});
|
|
10
14
|
}
|
|
11
|
-
register(
|
|
12
|
-
const t = this.records.get(
|
|
15
|
+
register(e, s) {
|
|
16
|
+
const t = this.records.get(e);
|
|
13
17
|
this.cancel(t);
|
|
14
|
-
const
|
|
15
|
-
this.records.set(
|
|
18
|
+
const i = e.getBoundingClientRect(), o = this.context.viewport(), n = t?.seen ?? (i.width > 0 && i.height > 0 && i.top < o.bottom);
|
|
19
|
+
this.records.set(e, {
|
|
20
|
+
options: s,
|
|
21
|
+
seen: n,
|
|
22
|
+
entered: t?.entered ?? !!n,
|
|
23
|
+
intersecting: t?.intersecting ?? !1
|
|
24
|
+
}), this.observer && !n ? this.observer.observe(e) : this.observer?.unobserve(e);
|
|
16
25
|
}
|
|
17
|
-
unregister(
|
|
18
|
-
this.cancel(this.records.get(
|
|
26
|
+
unregister(e) {
|
|
27
|
+
this.cancel(this.records.get(e)), this.records.delete(e), this.observer?.unobserve(e);
|
|
19
28
|
}
|
|
20
|
-
cancel(
|
|
21
|
-
const s =
|
|
22
|
-
s && (s.onfinish = s.oncancel = null, s.cancel(),
|
|
29
|
+
cancel(e) {
|
|
30
|
+
const s = e?.animation;
|
|
31
|
+
s && (s.onfinish = s.oncancel = null, s.cancel(), e.animation = void 0);
|
|
23
32
|
}
|
|
24
|
-
show(
|
|
25
|
-
const
|
|
26
|
-
for (const [
|
|
27
|
-
(
|
|
33
|
+
show(e, s = !1, t) {
|
|
34
|
+
const i = t && this.records.get(t), o = t ? i ? [[t, i]] : [] : this.records;
|
|
35
|
+
for (const [n, c] of o)
|
|
36
|
+
(n.contains(e) || s && e.contains(n)) && (this.cancel(c), c.seen = c.entered = !0, this.observer?.unobserve(n));
|
|
28
37
|
}
|
|
29
38
|
refresh() {
|
|
30
|
-
const
|
|
39
|
+
const e = this.context.viewport();
|
|
31
40
|
for (const [s, t] of this.records) {
|
|
32
41
|
this.cancel(t);
|
|
33
|
-
const
|
|
34
|
-
|
|
42
|
+
const i = s.getBoundingClientRect(), o = i.width > 0 && i.height > 0;
|
|
43
|
+
(o && i.bottom > e.top && i.top < e.bottom || o && i.top < e.bottom) && (t.seen = t.entered = !0, this.observer?.unobserve(s));
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
|
-
|
|
46
|
+
onScroll = () => {
|
|
47
|
+
const e = this.context.position();
|
|
48
|
+
if (e === this.lastPosition) return;
|
|
49
|
+
const s = this.upward;
|
|
50
|
+
this.upward = e < this.lastPosition, this.lastPosition = e, this.upward && !s && this.records.forEach((t, i) => {
|
|
51
|
+
this.cancel(t), t.intersecting && (t.seen = t.entered = !0, this.observer?.unobserve(i));
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
onEntries = (e) => {
|
|
38
55
|
let s = 0;
|
|
39
|
-
for (const t of
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const { options:
|
|
43
|
-
if (!t.isIntersecting)
|
|
44
|
-
|
|
56
|
+
for (const t of e) {
|
|
57
|
+
const i = t.target, o = this.records.get(i);
|
|
58
|
+
if (!o || !i.isConnected) continue;
|
|
59
|
+
const { options: n } = o;
|
|
60
|
+
if (o.intersecting = t.isIntersecting, !t.isIntersecting) continue;
|
|
61
|
+
if (this.onScroll(), this.upward) {
|
|
62
|
+
this.cancel(o), o.seen = o.entered = !0, this.observer?.unobserve(i);
|
|
45
63
|
continue;
|
|
46
64
|
}
|
|
47
|
-
const c = t.rootBounds,
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
if (!this.context.canReveal() || !
|
|
54
|
-
const
|
|
55
|
-
|
|
65
|
+
const c = t.rootBounds, f = c && t.boundingClientRect.height > 0 && t.boundingClientRect.width > 0 ? Math.min(1, c.height / t.boundingClientRect.height) * Math.min(1, c.width / t.boundingClientRect.width) : 1;
|
|
66
|
+
if (o.seen || t.intersectionRatio + 0.01 < Math.min(n.viewFactor, f)) continue;
|
|
67
|
+
o.seen = !0;
|
|
68
|
+
const g = o.entered;
|
|
69
|
+
o.entered = !0, this.observer?.unobserve(i);
|
|
70
|
+
const m = this.context.viewport();
|
|
71
|
+
if (!this.context.canReveal() || !n.mobile && !this.context.finePointer.matches || t.boundingClientRect.top < m.top || i.contains(document.activeElement)) continue;
|
|
72
|
+
const l = Array.from(i.querySelectorAll("img"));
|
|
73
|
+
i instanceof HTMLImageElement && l.push(i);
|
|
56
74
|
let h = !0;
|
|
57
|
-
for (const r of
|
|
75
|
+
for (const r of l)
|
|
58
76
|
(!r.complete || r.naturalWidth === 0) && (h = !1, r.loading = "eager", r.decode?.().catch(() => {
|
|
59
77
|
}));
|
|
60
78
|
if (!h) continue;
|
|
61
|
-
const
|
|
79
|
+
const v = n.useDelay === "always" || n.useDelay === "once" && !g || n.useDelay === "onload" && document.readyState !== "complete" ? n.delay : 0, d = n.origin === "left" || n.origin === "top" ? `calc(-1 * ${n.distance})` : n.distance, b = n.origin === "left" || n.origin === "right" ? `translateX(${d})` : `translateY(${d})`, a = getComputedStyle(i), u = a.transform === "none" ? "" : a.transform;
|
|
62
80
|
try {
|
|
63
|
-
this.cancel(
|
|
64
|
-
const r =
|
|
65
|
-
{ opacity:
|
|
81
|
+
this.cancel(o);
|
|
82
|
+
const r = i.animate([
|
|
83
|
+
{ opacity: n.opacity, transform: `${u} ${b} scale(${n.scale === 0 ? 2e-4 : n.scale})` },
|
|
66
84
|
{ opacity: a.opacity, transform: u || "none" }
|
|
67
85
|
], {
|
|
68
|
-
duration:
|
|
69
|
-
delay: Math.min(1e3,
|
|
70
|
-
easing:
|
|
86
|
+
duration: n.duration,
|
|
87
|
+
delay: Math.min(1e3, v + s++ * n.interval),
|
|
88
|
+
easing: n.easing,
|
|
71
89
|
fill: "backwards"
|
|
72
90
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (r.onfinish = r.oncancel = null, i.animation = void 0, e.reset) {
|
|
76
|
-
const m = o.getBoundingClientRect(), g = this.context.viewport();
|
|
77
|
-
(m.bottom <= g.top || m.top >= g.bottom) && (i.seen = !1);
|
|
78
|
-
}
|
|
79
|
-
e.cleanup && r.cancel();
|
|
80
|
-
}
|
|
91
|
+
o.animation = r, r.onfinish = r.oncancel = () => {
|
|
92
|
+
o.animation === r && (r.onfinish = r.oncancel = null, o.animation = void 0, n.cleanup && r.cancel());
|
|
81
93
|
};
|
|
82
94
|
} catch {
|
|
83
95
|
}
|
|
84
96
|
}
|
|
85
97
|
};
|
|
86
98
|
destroy() {
|
|
87
|
-
this.observer?.disconnect(), this.records.forEach((
|
|
99
|
+
this.lifetime.abort(), this.observer?.disconnect(), this.records.forEach((e) => this.cancel(e)), this.records.clear();
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
102
|
export {
|
|
91
|
-
|
|
103
|
+
w as ScrollRevealMotion
|
|
92
104
|
};
|
|
@@ -7,6 +7,7 @@ export interface ScrollRevealOptions {
|
|
|
7
7
|
origin?: 'top' | 'right' | 'bottom' | 'left';
|
|
8
8
|
opacity?: number;
|
|
9
9
|
scale?: number;
|
|
10
|
+
/** @deprecated Reveals play once per mounted element; repeat is disabled. */
|
|
10
11
|
reset?: boolean;
|
|
11
12
|
viewFactor?: number;
|
|
12
13
|
mobile?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const a = {
|
|
2
2
|
distance: "50px",
|
|
3
|
-
duration:
|
|
4
|
-
delay:
|
|
3
|
+
duration: 450,
|
|
4
|
+
delay: 0,
|
|
5
5
|
easing: "cubic-bezier(0.5, 0, 0, 1)",
|
|
6
6
|
origin: "bottom",
|
|
7
7
|
opacity: 0,
|
|
@@ -20,7 +20,7 @@ function s(i) {
|
|
|
20
20
|
typeof n == "number" && Number.isFinite(n) && n >= 0 && (t[o] = o === "opacity" || o === "viewFactor" ? Math.min(1, n) : n);
|
|
21
21
|
}
|
|
22
22
|
t.viewFactor = Math.round(t.viewFactor * 100) / 100;
|
|
23
|
-
for (const o of ["
|
|
23
|
+
for (const o of ["mobile", "cleanup"])
|
|
24
24
|
typeof e[o] == "boolean" && (t[o] = e[o]);
|
|
25
25
|
return ["top", "right", "bottom", "left"].includes(e.origin) && (t.origin = e.origin), ["always", "once", "onload"].includes(e.useDelay) && (t.useDelay = e.useDelay), typeof e.distance == "string" && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("transform", `translateX(${e.distance})`) && (t.distance = e.distance), typeof e.easing == "string" && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("animation-timing-function", e.easing) && (t.easing = e.easing), t;
|
|
26
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const v = "(min-width: 1024px) and (hover: hover) and (pointer: fine)", E = [
|
|
2
2
|
"input",
|
|
3
3
|
"textarea",
|
|
4
4
|
"select",
|
|
@@ -38,11 +38,11 @@ const p = "(min-width: 1024px) and (hover: hover) and (pointer: fine)", g = [
|
|
|
38
38
|
"searchbox",
|
|
39
39
|
"scrollbar",
|
|
40
40
|
"application"
|
|
41
|
-
].map((
|
|
42
|
-
].join(", "),
|
|
43
|
-
class
|
|
41
|
+
].map((p) => `[role~="${p}"]`)
|
|
42
|
+
].join(", "), r = 2, w = 12, M = 220;
|
|
43
|
+
class y {
|
|
44
44
|
sections = /* @__PURE__ */ new Set();
|
|
45
|
-
desktop = window.matchMedia(
|
|
45
|
+
desktop = window.matchMedia(v);
|
|
46
46
|
listeners;
|
|
47
47
|
movement;
|
|
48
48
|
wheel;
|
|
@@ -73,10 +73,22 @@ class w {
|
|
|
73
73
|
cancel() {
|
|
74
74
|
this.movement && (cancelAnimationFrame(this.movement.frame), this.movement = void 0);
|
|
75
75
|
}
|
|
76
|
+
animate(t, i, s) {
|
|
77
|
+
const n = window.location.href, e = (h) => {
|
|
78
|
+
if (this.movement === t) {
|
|
79
|
+
if (document.hidden || window.location.href !== n || i && !i.isConnected) {
|
|
80
|
+
this.reset();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
s(h) && (t.frame = requestAnimationFrame(e));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
t.frame = requestAnimationFrame(e);
|
|
87
|
+
}
|
|
76
88
|
wheelGesture(t, i) {
|
|
77
89
|
const s = Math.sign(t), n = Math.abs(t), e = this.wheel;
|
|
78
|
-
let h = 0,
|
|
79
|
-
return e && !
|
|
90
|
+
let h = 0, o = !e || s !== e.direction || i - e.lastAt >= M;
|
|
91
|
+
return e && !o && (e.decayTicks = n <= e.magnitude && n < e.peak ? e.decayTicks + 1 : 0, e.decayTicks >= 3 && n <= e.peak / 2 && (e.floor = Math.min(e.floor ?? n, n)), e.floor !== void 0 && (e.floor = Math.min(e.floor, n), e.renewed = n > e.magnitude && n >= e.floor * 2 ? e.renewed + n - e.floor : 0, o = e.renewed >= w, o && (h = s * Math.max(0, e.renewed - n))), e.lastAt = i, e.magnitude = n, e.peak = Math.max(e.peak, n)), !e || o ? (this.distance = h, this.readingEdge = void 0, this.wheel = {
|
|
80
92
|
lastAt: i,
|
|
81
93
|
direction: s,
|
|
82
94
|
magnitude: n,
|
|
@@ -109,7 +121,7 @@ class w {
|
|
|
109
121
|
}
|
|
110
122
|
hasPagingStops() {
|
|
111
123
|
const t = this.geometry();
|
|
112
|
-
if (t.limit <=
|
|
124
|
+
if (t.limit <= r) return !1;
|
|
113
125
|
let i = 0;
|
|
114
126
|
for (const s of this.sections)
|
|
115
127
|
if (this.measureSection(s, t) && ++i === 2) return !0;
|
|
@@ -117,10 +129,27 @@ class w {
|
|
|
117
129
|
}
|
|
118
130
|
readWheel(t, i, s, n) {
|
|
119
131
|
const e = this.context.position();
|
|
120
|
-
if (e < t.start -
|
|
132
|
+
if (e < t.start - r || e > t.end + r || (i > 0 ? e >= t.end - r : e <= t.start + r)) return !1;
|
|
121
133
|
this.readingElement = t.element, this.distance = 0;
|
|
122
|
-
const h = this.readingStep(),
|
|
123
|
-
|
|
134
|
+
const h = this.readingStep(), o = this.movement?.reading, m = (o && this.movement?.direction === i ? o.position : e) + Math.max(-h, Math.min(s, h)), d = m >= t.end || m <= t.start;
|
|
135
|
+
n.preventDefault();
|
|
136
|
+
const c = Math.max(t.start, Math.min(m, t.end));
|
|
137
|
+
if (this.context.reducedMotion.matches)
|
|
138
|
+
this.cancel(), this.context.write(c);
|
|
139
|
+
else if (o && this.movement)
|
|
140
|
+
o.position = c, this.movement.direction = i;
|
|
141
|
+
else {
|
|
142
|
+
this.cancel();
|
|
143
|
+
const l = { position: c }, g = { frame: 0, direction: i, reading: l };
|
|
144
|
+
this.movement = g;
|
|
145
|
+
let x = performance.now(), u = e;
|
|
146
|
+
this.animate(g, t.element, (b) => {
|
|
147
|
+
u += (l.position - u) * (1 - Math.exp(-(b - x) / 65)), x = b;
|
|
148
|
+
const f = Math.abs(l.position - u) < 0.1;
|
|
149
|
+
return this.context.write(f ? l.position : u), f && (this.movement = void 0), !f;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return d && (this.readingEdge = { element: t.element, direction: i }, this.wheel && (this.wheel.consumed = !0)), !0;
|
|
124
153
|
}
|
|
125
154
|
/** Child scroll owners win, including at a contained overscroll boundary. */
|
|
126
155
|
nestedOwns(t, i) {
|
|
@@ -146,20 +175,20 @@ class w {
|
|
|
146
175
|
}
|
|
147
176
|
destination(t, i, s) {
|
|
148
177
|
const n = this.context.position();
|
|
149
|
-
let e, h,
|
|
150
|
-
for (const
|
|
151
|
-
if (
|
|
152
|
-
|
|
178
|
+
let e, h, o;
|
|
179
|
+
for (const l of s)
|
|
180
|
+
if (l.start <= n + r && (e = l), l.start < n - r && (h = l), l.start > n + r) {
|
|
181
|
+
o = l;
|
|
153
182
|
break;
|
|
154
183
|
}
|
|
155
|
-
const
|
|
156
|
-
let
|
|
157
|
-
if (i &&
|
|
184
|
+
const a = e && e.end > e.start + r && n <= e.end + r, m = this.readingStep();
|
|
185
|
+
let d, c;
|
|
186
|
+
if (i && a && (t > 0 ? n < e.end - r : n > e.start + r) ? (c = e, d = Math.min(e.end, Math.max(e.start, n + t * m))) : (c = t > 0 ? o : h, d = c ? t > 0 ? c.start : c.end : t > 0 ? this.context.limit() : 0), !(Math.abs(d - n) <= r))
|
|
158
187
|
return {
|
|
159
|
-
position:
|
|
160
|
-
element:
|
|
161
|
-
progress:
|
|
162
|
-
atEnd: !
|
|
188
|
+
position: d,
|
|
189
|
+
element: c?.element,
|
|
190
|
+
progress: c && c.end > c.start ? (d - c.start) / (c.end - c.start) : 0,
|
|
191
|
+
atEnd: !c && t > 0
|
|
163
192
|
};
|
|
164
193
|
}
|
|
165
194
|
move(t, i) {
|
|
@@ -168,23 +197,18 @@ class w {
|
|
|
168
197
|
this.movement = n;
|
|
169
198
|
const e = () => {
|
|
170
199
|
if (this.movement !== n) return;
|
|
171
|
-
const
|
|
172
|
-
(!t.element ||
|
|
200
|
+
const o = t.element && this.sections.has(t.element) ? this.measureSection(t.element) : void 0, a = o ? o.start + (o.end - o.start) * t.progress : t.atEnd ? this.context.limit() : Math.min(t.position, this.context.limit());
|
|
201
|
+
(!t.element || o) && Math.abs(a - this.context.position()) > r && this.context.write(a), this.movement = void 0, this.distance = 0, o && o.end > o.start + r && (this.readingElement = o.element);
|
|
173
202
|
};
|
|
174
203
|
if (this.context.reducedMotion.matches) {
|
|
175
204
|
this.context.write(t.position), e();
|
|
176
205
|
return;
|
|
177
206
|
}
|
|
178
|
-
const h =
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
const a = Math.min(1, (r - d) / 850);
|
|
185
|
-
this.context.write(s + (t.position - s) * (1 - (1 - a) ** 3)), a < 1 ? n.frame = requestAnimationFrame(c) : e();
|
|
186
|
-
};
|
|
187
|
-
n.frame = requestAnimationFrame(c);
|
|
207
|
+
const h = performance.now();
|
|
208
|
+
this.animate(n, t.element, (o) => {
|
|
209
|
+
const a = Math.min(1, (o - h) / 850);
|
|
210
|
+
return this.context.write(s + (t.position - s) * (1 - (1 - a) ** 3)), a === 1 && e(), a < 1;
|
|
211
|
+
});
|
|
188
212
|
}
|
|
189
213
|
onWheel = (t) => {
|
|
190
214
|
if (this.context.syncNavigation(), !this.enabled() || !t.cancelable || t.defaultPrevented || t.ctrlKey || t.metaKey || t.altKey || t.shiftKey || !Number.isFinite(t.deltaY) || !Number.isFinite(t.deltaX) || !t.deltaY || Math.abs(t.deltaX) > Math.abs(t.deltaY)) {
|
|
@@ -203,38 +227,38 @@ class w {
|
|
|
203
227
|
return;
|
|
204
228
|
}
|
|
205
229
|
if (this.readingEdge) {
|
|
206
|
-
const
|
|
207
|
-
|
|
230
|
+
const a = this.readingEdge, m = this.measureSection(a.element), d = this.movement?.reading?.position ?? this.context.position();
|
|
231
|
+
m && (a.direction > 0 ? Math.abs(d - m.end) <= r : Math.abs(d - m.start) <= r) || (e.consumed = !1, this.readingEdge = void 0);
|
|
208
232
|
}
|
|
209
233
|
if (e.consumed) {
|
|
210
234
|
t.preventDefault();
|
|
211
235
|
return;
|
|
212
236
|
}
|
|
213
|
-
if (this.movement?.direction === i) {
|
|
237
|
+
if (this.movement?.direction === i && !this.movement.reading) {
|
|
214
238
|
t.preventDefault(), e.consumed = !0, this.distance = 0;
|
|
215
239
|
return;
|
|
216
240
|
}
|
|
217
|
-
if (!this.movement && this.readingElement) {
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
241
|
+
if ((!this.movement || this.movement.reading) && this.readingElement) {
|
|
242
|
+
const a = this.measureSection(this.readingElement);
|
|
243
|
+
if (a && this.readWheel(a, i, n, t)) return;
|
|
220
244
|
this.readingElement = void 0;
|
|
221
245
|
}
|
|
222
|
-
if (Math.sign(this.distance) !== i && (this.distance = 0), this.distance += n, Math.abs(this.distance) <
|
|
246
|
+
if (Math.sign(this.distance) !== i && (this.distance = 0), this.distance += n, Math.abs(this.distance) < w) {
|
|
223
247
|
t.preventDefault();
|
|
224
248
|
return;
|
|
225
249
|
}
|
|
226
250
|
const h = this.measure();
|
|
227
251
|
if (h.length < 2) return;
|
|
228
252
|
if (!this.movement) {
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
253
|
+
const a = this.context.position(), m = h.find((d) => a >= d.start - r && a <= d.end + r && (i > 0 ? a < d.end - r : a > d.start + r));
|
|
254
|
+
if (m && this.readWheel(m, i, this.distance, t)) return;
|
|
231
255
|
}
|
|
232
|
-
const
|
|
233
|
-
if (!
|
|
256
|
+
const o = this.destination(i, !1, h);
|
|
257
|
+
if (!o) {
|
|
234
258
|
this.distance = 0;
|
|
235
259
|
return;
|
|
236
260
|
}
|
|
237
|
-
t.preventDefault(), this.distance = 0, e.consumed = !0, this.move(
|
|
261
|
+
t.preventDefault(), this.distance = 0, e.consumed = !0, this.move(o, i);
|
|
238
262
|
};
|
|
239
263
|
onKeydown = (t) => {
|
|
240
264
|
if (this.context.syncNavigation(), !this.enabled() || t.defaultPrevented || t.ctrlKey || t.metaKey || t.altKey) return;
|
|
@@ -245,18 +269,18 @@ class w {
|
|
|
245
269
|
}
|
|
246
270
|
for (const e of t.composedPath()) {
|
|
247
271
|
if (e === this.context.container) break;
|
|
248
|
-
if (e instanceof Element && (e.matches(
|
|
272
|
+
if (e instanceof Element && (e.matches(E) || e.hasAttribute("tabindex") && Number(e.getAttribute("tabindex")) >= 0)) return;
|
|
249
273
|
}
|
|
250
|
-
if (this.nestedOwns(t, i) || this.context.limit() <=
|
|
274
|
+
if (this.nestedOwns(t, i) || this.context.limit() <= r) return;
|
|
251
275
|
const s = this.measure();
|
|
252
276
|
if (s.length < 2) return;
|
|
253
277
|
const n = this.destination(i, !0, s);
|
|
254
|
-
n && (t.preventDefault(), !(t.repeat || this.movement?.direction === i) && (this.reset(), this.move(n, i)));
|
|
278
|
+
n && (t.preventDefault(), !(t.repeat || this.movement?.direction === i && !this.movement.reading) && (this.reset(), this.move(n, i)));
|
|
255
279
|
};
|
|
256
280
|
destroy() {
|
|
257
281
|
this.reset(), this.listeners?.abort(), this.desktop.removeEventListener("change", this.configure), this.sections.clear();
|
|
258
282
|
}
|
|
259
283
|
}
|
|
260
284
|
export {
|
|
261
|
-
|
|
285
|
+
y as ScrollRevealPager
|
|
262
286
|
};
|
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# VLite3 scroll implementation review — 2026-11-02
|
|
2
2
|
|
|
3
|
+
## Faster one-time downward reveals — 2026-11-03
|
|
4
|
+
|
|
5
|
+
Final review follow-up: fixed a partial-visibility reversal edge case. A target
|
|
6
|
+
below its configured viewFactor could remain unvisited if upward reversal did
|
|
7
|
+
not cross an observer threshold; its next downward threshold crossing could then
|
|
8
|
+
animate. Records now retain the observer's intersection state. Upward reversal
|
|
9
|
+
marks intersecting targets visited and releases observation while cancelling
|
|
10
|
+
effects. This reuses observer data without measuring layout on scroll. Added a
|
|
11
|
+
regression source that reverses below viewFactor without delivering another
|
|
12
|
+
observer callback, then checks that subsequent downward input cannot reveal it.
|
|
13
|
+
|
|
14
|
+
Reviewed defaults/normalization, registration updates, observer delivery,
|
|
15
|
+
up/down reversal, focus/history/resource refresh, nested/document ownership and
|
|
16
|
+
destroy cleanup. No further concrete source findings remain in the latest reveal
|
|
17
|
+
change. `git diff --check` passes. Runtime tests and browser acceptance remain
|
|
18
|
+
unperformed under the explicit-approval rule; this is not runtime certification.
|
|
19
|
+
|
|
20
|
+
Default decorative reveals now take 450ms with no initial delay (previously
|
|
21
|
+
800ms plus 200ms). Explicit duration/delay options still apply. Each mounted
|
|
22
|
+
element is visited once; legacy `reset` input normalizes to false and the motion
|
|
23
|
+
engine never rearms visited records. Upward entries are marked visited and shown
|
|
24
|
+
without animation. A passive listener on the actual scroll owner tracks direction;
|
|
25
|
+
upward reversal cancels delayed and active effects. Observer callbacks also sample
|
|
26
|
+
position so direction does not depend on scroll-event delivery order. Initially
|
|
27
|
+
visible/restored content, focus, navigation and reduced-motion exclusions retain
|
|
28
|
+
their existing behavior. Section paging timing is unchanged.
|
|
29
|
+
|
|
30
|
+
Final source audit: one existing per-container motion controller owns direction
|
|
31
|
+
and reveal history. No per-element listeners, additional observers, timers or
|
|
32
|
+
frame loops were introduced. Direction tracking costs constant work per scroll;
|
|
33
|
+
only upward reversal scans records to cancel active effects. Observer targets
|
|
34
|
+
are released after the first visit. Destruction aborts the listener and cancels
|
|
35
|
+
animations. Registration updates preserve visited history. The once-only scope
|
|
36
|
+
is the mounted lifetime, not persistent history across remounts or reloads.
|
|
37
|
+
The demo and option documentation now describe one-time downward behavior;
|
|
38
|
+
`reset` remains a deprecated accepted option with no repeat behavior.
|
|
39
|
+
|
|
40
|
+
Regression sources cover faster defaults, ignored repeat input, update/focus
|
|
41
|
+
history, upward suppression and cancellation for document and nested owners.
|
|
42
|
+
Validation is source review and `git diff --check`; tests, build, typecheck,
|
|
43
|
+
lint, dev server and browser interaction were not run under the repository's
|
|
44
|
+
explicit-approval rule. Physical animation timing remains unverified.
|
|
45
|
+
|
|
3
46
|
Scope: VLite3 only, starting from local version 1.5.40. Reviewed the public
|
|
4
47
|
`vScrollReveal` directive, options, container coordinator, reveal observer/WAAPI
|
|
5
48
|
lifecycle, section pager, Carousel wheel integration, shared scroll CSS, exports,
|
|
@@ -169,3 +212,46 @@ test-pass statements in this audit describe earlier revisions, not this correcti
|
|
|
169
212
|
Gesture classification remains a delta-based heuristic: indistinguishable wheel
|
|
170
213
|
streams cannot be separated by physical intent, and a strong irregular momentum
|
|
171
214
|
spike can resemble renewed input. Device/browser trackpad acceptance remains open.
|
|
215
|
+
|
|
216
|
+
## Smooth tall-section reading — 2026-11-02
|
|
217
|
+
|
|
218
|
+
The reading path wrote each accepted wheel delta directly to the scroll position,
|
|
219
|
+
including viewport-sized increments. This differed from animated section entry
|
|
220
|
+
and explains the source-level jump while revealing a tall section's lower content.
|
|
221
|
+
|
|
222
|
+
Reading input now extends one bounded target, followed on animation frames with
|
|
223
|
+
time-based smoothing. Repeated ticks update that target without restarting an
|
|
224
|
+
easing curve. Reversal discards pending forward distance and targets from the
|
|
225
|
+
visible position. Reading completion performs no destination measurement, heading
|
|
226
|
+
alignment or progress-based correction. Reduced-motion reading remains immediate.
|
|
227
|
+
|
|
228
|
+
Final source audit:
|
|
229
|
+
|
|
230
|
+
- Ownership/lifecycle: reading reuses the pager's single movement slot and cancel
|
|
231
|
+
path. The extracted frame scheduler shares the existing navigation, visibility
|
|
232
|
+
and detached-element guards with section transitions. No second scroll engine,
|
|
233
|
+
queue, timer or listener was added. Keyboard navigation can interrupt reading.
|
|
234
|
+
- Boundaries/concurrency: accumulated targets remain inside the measured reading
|
|
235
|
+
range. Edge consumption checks the pending target while content arrives, so
|
|
236
|
+
momentum cannot invalidate the guard merely because rendering is still moving.
|
|
237
|
+
Existing gesture classification, idle timing and momentum rules are unchanged.
|
|
238
|
+
- Regression: short-section destination selection, 850ms easing, completion
|
|
239
|
+
alignment and reduced-motion behavior retain their existing logic. Tall-section
|
|
240
|
+
entry still uses that path; only internal wheel reading gains smoothing.
|
|
241
|
+
- Performance: constant animation state and one pending frame per container.
|
|
242
|
+
Reading frames do not scan stops or remeasure geometry. Fractional animation
|
|
243
|
+
progress is retained so rounded scroll positions cannot stall frame cleanup.
|
|
244
|
+
- Accessibility/data: keyboard ownership and native input exclusions remain;
|
|
245
|
+
reduced motion bypasses reading animation. No persistence, server work or new
|
|
246
|
+
external inputs are involved.
|
|
247
|
+
|
|
248
|
+
Regression sources cover monotonic intermediate frames, coalesced rapid input,
|
|
249
|
+
reversal, no completion alignment after content growth, rounded positions,
|
|
250
|
+
keyboard takeover, boundary momentum and cancellation/reset/teardown. Existing
|
|
251
|
+
tall-reading expectations now allow animation to finish before checking position.
|
|
252
|
+
|
|
253
|
+
Validation: source review and `git diff --check` only. Tests were updated but not
|
|
254
|
+
executed; no build, typecheck, lint, codegen, dev server or computer use was run,
|
|
255
|
+
following the explicit-approval rule. Physical trackpad feel, rendering and device
|
|
256
|
+
performance remain unverified. This supersedes the earlier immediate reading
|
|
257
|
+
write behavior without changing the wheel re-arming policy.
|
|
@@ -41,16 +41,16 @@ rotation, timelines and other third-party-specific options are outside this API.
|
|
|
41
41
|
| Option | Default | Native behavior |
|
|
42
42
|
| :--- | :--- | :--- |
|
|
43
43
|
| `distance` | `'50px'` | Valid CSS translation length, including CSS calculations. |
|
|
44
|
-
| `duration` | `
|
|
45
|
-
| `delay` | `
|
|
44
|
+
| `duration` | `450` | Nonnegative finite animation duration, in milliseconds. |
|
|
45
|
+
| `delay` | `0` | Nonnegative finite entrance delay, in milliseconds. |
|
|
46
46
|
| `easing` | `'cubic-bezier(0.5, 0, 0, 1)'` | Valid CSS animation timing function. |
|
|
47
47
|
| `origin` | `'bottom'` | `'top'`, `'right'`, `'bottom'` or `'left'`. |
|
|
48
48
|
| `opacity` | `0` | Starting opacity, clamped to 0–1; finishes at the authored opacity. |
|
|
49
49
|
| `scale` | `1` | Nonnegative starting scale; zero uses a small nonzero scale to keep transforms interpolable. Authored transforms are preserved. |
|
|
50
|
-
| `reset` | `false` |
|
|
50
|
+
| `reset` | `false` | Deprecated; ignored. Reveals play once per mounted element. |
|
|
51
51
|
| `viewFactor` | `0` | Visible fraction, clamped to 0–1 and rounded to a percentage. For oversized elements it is limited to the fraction that fits in the scroll viewport. |
|
|
52
52
|
| `mobile` | `true` | When false, decorative reveal requires a hovering fine pointer. |
|
|
53
|
-
| `cleanup` | `false` | Explicitly cancel the completed browser effect to release it. Both values restore authored styles after completion; neither erases the mounted lifetime's seen state
|
|
53
|
+
| `cleanup` | `false` | Explicitly cancel the completed browser effect to release it. Both values restore authored styles after completion; neither erases the mounted lifetime's seen state. |
|
|
54
54
|
| `useDelay` | `'always'` | `'always'`: every entrance; `'once'`: the first entrance in this mounted lifetime; `'onload'`: only while the document has not finished loading. |
|
|
55
55
|
| `interval` | `0` | Stagger eligible entrances in the same observer delivery, in milliseconds. This is a local batch, not a persistent document-wide sequence. |
|
|
56
56
|
|
|
@@ -61,8 +61,8 @@ entrances during fast scrolling. There is no global animation sequence.
|
|
|
61
61
|
<div v-for="item in items" :key="item.id" v-scroll-reveal="{ interval: 70, delay: 0 }">
|
|
62
62
|
{{ item.label }}
|
|
63
63
|
</div>
|
|
64
|
-
<div v-scroll-reveal="{
|
|
65
|
-
Reveal
|
|
64
|
+
<div v-scroll-reveal="{ distance: '24px' }">
|
|
65
|
+
Reveal once on the first downward visit
|
|
66
66
|
</div>
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -106,8 +106,11 @@ scrolling is native. Touch input is always native; no touchmove listener is used
|
|
|
106
106
|
- Deliberate vertical wheel intent accumulates before advancing to the next stop.
|
|
107
107
|
Short sections align their top after the scroller's effective `scroll-padding-top`.
|
|
108
108
|
- Tall sections retain progressive reading between their start and end. The pager
|
|
109
|
-
consumes accepted vertical wheel ticks and
|
|
110
|
-
with at most one viewport-sized
|
|
109
|
+
consumes accepted vertical wheel ticks and extends a smoothly followed target
|
|
110
|
+
within that range, with at most one viewport-sized increment per tick (48px
|
|
111
|
+
overlap). Repeated input updates the same movement; reversal starts from the
|
|
112
|
+
visible position. Reading completion does not realign the section. Reduced
|
|
113
|
+
motion applies the bounded reading position immediately. Downward entry aligns the
|
|
111
114
|
top; upward entry aligns the bottom, then reads toward the top.
|
|
112
115
|
At a reading boundary, same-direction momentum remains held until a fresh
|
|
113
116
|
gesture. Reversal and keyboard navigation
|
|
@@ -167,7 +170,7 @@ and anchors retain ownership; there is no router dependency or history mutation.
|
|
|
167
170
|
## Manual reference
|
|
168
171
|
|
|
169
172
|
The [playground demo](../../src/playground/demos/ScrollRevealDemo.vue) includes basic
|
|
170
|
-
and directional reveals, batch stagger,
|
|
173
|
+
and directional reveals, batch stagger, one-time reveals, short stops, tall reading content
|
|
171
174
|
and a contained nested panel at `/components/scroll-reveal`.
|
|
172
175
|
|
|
173
176
|
## SSR and hydration contract
|
|
@@ -195,3 +198,8 @@ browser globals, including concurrent plain and `:snap` bindings. This does not
|
|
|
195
198
|
certify other exports or third-party dependencies imported by the package root.
|
|
196
199
|
Production bundle imports, streamed/async hydration and browser restoration still
|
|
197
200
|
need runtime verification with the consuming application's build.
|
|
201
|
+
|
|
202
|
+
Reveals run only on the first downward visit during an element’s mounted lifetime.
|
|
203
|
+
Upward entries show authored content immediately and count as visited. Changing
|
|
204
|
+
direction upward cancels active or delayed reveals. Explicit duration and delay
|
|
205
|
+
options still override the faster defaults; section paging timing is independent.
|
package/docs-manifest.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"managedBy": "vlite3",
|
|
3
3
|
"manifestVersion": 1,
|
|
4
4
|
"packageName": "vlite3",
|
|
5
|
-
"packageVersion": "1.5.
|
|
6
|
-
"generatedAt": "2026-11-
|
|
5
|
+
"packageVersion": "1.5.45",
|
|
6
|
+
"generatedAt": "2026-11-03T15:11:22.458Z",
|
|
7
7
|
"files": {
|
|
8
8
|
"component-index.md": {
|
|
9
9
|
"sha256": "2a8a3c18e4b9158ff62eaf23c3aae82b2aee7e10fca9b78f9a6d573ff9b13c61"
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
"sha256": "d6f355061d35552dbfcebde53088bafdaaafbe9934ed3fc9286d39e60348b64b"
|
|
244
244
|
},
|
|
245
245
|
"components/scroll-reveal.md": {
|
|
246
|
-
"sha256": "
|
|
246
|
+
"sha256": "e0f31f2506846eb936625ea68f4c2a0a22139f2de7aef1040ee3dd62c5da5fe9"
|
|
247
247
|
},
|
|
248
248
|
"components/seo-provider.md": {
|
|
249
249
|
"sha256": "ee4ef9991f025ddc6e6a11180d9acce6bbe87d86d5e746da70164260734b983e"
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
"sha256": "115099e4c2fd179fef86430f5c376b8a58f1f0dab5d7c493a6e0c77485845268"
|
|
340
340
|
},
|
|
341
341
|
"ScrollRevealReleaseAudit.md": {
|
|
342
|
-
"sha256": "
|
|
342
|
+
"sha256": "0c1b8086877713423efb2bb22ff7a4f9817595f5e120cd4f245e378bb2a164c9"
|
|
343
343
|
},
|
|
344
344
|
"utilities/search.md": {
|
|
345
345
|
"sha256": "a3e597b3d0a8da8e4ab3a8537231b19149cda48f204ad5cce36860988341e281"
|