vlite3 1.5.50 → 1.5.51
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const v = "(min-width: 1024px) and (hover: hover) and (pointer: fine)",
|
|
1
|
+
const v = "(min-width: 1024px) and (hover: hover) and (pointer: fine)", M = [
|
|
2
2
|
"input",
|
|
3
3
|
"textarea",
|
|
4
4
|
"select",
|
|
@@ -39,8 +39,8 @@ const v = "(min-width: 1024px) and (hover: hover) and (pointer: fine)", E = [
|
|
|
39
39
|
"scrollbar",
|
|
40
40
|
"application"
|
|
41
41
|
].map((p) => `[role~="${p}"]`)
|
|
42
|
-
].join(", "), r = 2, w = 12,
|
|
43
|
-
class
|
|
42
|
+
].join(", "), r = 2, w = 12, E = 220, y = 320, k = 560, A = 60;
|
|
43
|
+
class S {
|
|
44
44
|
sections = /* @__PURE__ */ new Set();
|
|
45
45
|
desktop = window.matchMedia(v);
|
|
46
46
|
listeners;
|
|
@@ -64,8 +64,8 @@ class y {
|
|
|
64
64
|
const t = this.sections.size >= 2 && this.desktop.matches;
|
|
65
65
|
if (!!this.listeners === t || (this.listeners?.abort(), this.listeners = void 0, !t)) return;
|
|
66
66
|
this.listeners = new AbortController();
|
|
67
|
-
const i = this.context.documentRoot ? window : this.context.container,
|
|
68
|
-
i.addEventListener("wheel", this.onWheel, { ...
|
|
67
|
+
const i = this.context.documentRoot ? window : this.context.container, n = { capture: !0, signal: this.listeners.signal };
|
|
68
|
+
i.addEventListener("wheel", this.onWheel, { ...n, passive: !1 }), i.addEventListener("keydown", this.onKeydown, n);
|
|
69
69
|
};
|
|
70
70
|
reset = () => {
|
|
71
71
|
this.cancel(), this.wheel = void 0, this.distance = 0, this.readingElement = void 0, this.readingEdge = void 0;
|
|
@@ -73,26 +73,26 @@ class y {
|
|
|
73
73
|
cancel() {
|
|
74
74
|
this.movement && (cancelAnimationFrame(this.movement.frame), this.movement = void 0);
|
|
75
75
|
}
|
|
76
|
-
animate(t, i,
|
|
77
|
-
const
|
|
76
|
+
animate(t, i, n) {
|
|
77
|
+
const s = window.location.href, e = (h) => {
|
|
78
78
|
if (this.movement === t) {
|
|
79
|
-
if (document.hidden || window.location.href !==
|
|
79
|
+
if (document.hidden || window.location.href !== s || i && !i.isConnected) {
|
|
80
80
|
this.reset();
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
n(h) && (t.frame = requestAnimationFrame(e));
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
t.frame = requestAnimationFrame(e);
|
|
87
87
|
}
|
|
88
88
|
wheelGesture(t, i) {
|
|
89
|
-
const
|
|
90
|
-
let h = 0,
|
|
91
|
-
return e && !
|
|
89
|
+
const n = Math.sign(t), s = Math.abs(t), e = this.wheel;
|
|
90
|
+
let h = 0, d = !e || n !== e.direction || i - e.lastAt >= E;
|
|
91
|
+
return e && !d && (e.decayTicks = s <= e.magnitude && s < e.peak ? e.decayTicks + 1 : 0, e.decayTicks >= 3 && s <= e.peak / 2 && (e.floor = Math.min(e.floor ?? s, s)), e.floor !== void 0 && (e.floor = Math.min(e.floor, s), e.renewed = s > e.magnitude && s >= e.floor * 2 ? e.renewed + s - e.floor : 0, d = e.renewed >= w, d && (h = n * Math.max(0, e.renewed - s))), e.lastAt = i, e.magnitude = s, e.peak = Math.max(e.peak, s)), !e || d ? (this.distance = h, this.readingEdge = void 0, this.wheel = {
|
|
92
92
|
lastAt: i,
|
|
93
|
-
direction:
|
|
94
|
-
magnitude:
|
|
95
|
-
peak:
|
|
93
|
+
direction: n,
|
|
94
|
+
magnitude: s,
|
|
95
|
+
peak: s,
|
|
96
96
|
decayTicks: 0,
|
|
97
97
|
renewed: 0,
|
|
98
98
|
consumed: !1
|
|
@@ -110,93 +110,93 @@ class y {
|
|
|
110
110
|
}
|
|
111
111
|
measureSection(t, i = this.geometry()) {
|
|
112
112
|
if (!t.isConnected) return;
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
115
|
-
const
|
|
116
|
-
return { element: t, start: e, end:
|
|
113
|
+
const n = t.getBoundingClientRect();
|
|
114
|
+
if (!n.height || !n.width) return;
|
|
115
|
+
const s = (h) => Math.max(0, Math.min(h, i.limit)), e = s(n.top - i.top + i.from - i.padding);
|
|
116
|
+
return { element: t, start: e, end: s(Math.max(e, n.bottom - i.bottom + i.from)) };
|
|
117
117
|
}
|
|
118
118
|
measure() {
|
|
119
119
|
const t = this.geometry();
|
|
120
|
-
return Array.from(this.sections).map((i) => this.measureSection(i, t)).filter((i) => !!i).sort((i,
|
|
120
|
+
return Array.from(this.sections).map((i) => this.measureSection(i, t)).filter((i) => !!i).sort((i, n) => i.start - n.start);
|
|
121
121
|
}
|
|
122
122
|
hasPagingStops() {
|
|
123
123
|
const t = this.geometry();
|
|
124
124
|
if (t.limit <= r) return !1;
|
|
125
125
|
let i = 0;
|
|
126
|
-
for (const
|
|
127
|
-
if (this.measureSection(
|
|
126
|
+
for (const n of this.sections)
|
|
127
|
+
if (this.measureSection(n, t) && ++i === 2) return !0;
|
|
128
128
|
return !1;
|
|
129
129
|
}
|
|
130
|
-
readWheel(t, i,
|
|
130
|
+
readWheel(t, i, n, s) {
|
|
131
131
|
const e = this.context.position();
|
|
132
132
|
if (e < t.start - r || e > t.end + r || (i > 0 ? e >= t.end - r : e <= t.start + r)) return !1;
|
|
133
133
|
this.readingElement = t.element, this.distance = 0;
|
|
134
|
-
const h = this.readingStep(),
|
|
135
|
-
|
|
136
|
-
const c = Math.max(t.start, Math.min(
|
|
134
|
+
const h = this.readingStep(), d = this.movement?.reading, a = (d && this.movement?.direction === i ? d.position : e) + Math.max(-h, Math.min(n, h)), m = a >= t.end || a <= t.start;
|
|
135
|
+
s.preventDefault();
|
|
136
|
+
const c = Math.max(t.start, Math.min(a, t.end));
|
|
137
137
|
if (this.context.reducedMotion.matches)
|
|
138
138
|
this.cancel(), this.context.write(c);
|
|
139
|
-
else if (
|
|
140
|
-
|
|
139
|
+
else if (d && this.movement)
|
|
140
|
+
d.position = c, this.movement.direction = i;
|
|
141
141
|
else {
|
|
142
142
|
this.cancel();
|
|
143
143
|
const l = { position: c }, g = { frame: 0, direction: i, reading: l };
|
|
144
144
|
this.movement = g;
|
|
145
145
|
let x = performance.now(), u = e;
|
|
146
146
|
this.animate(g, t.element, (b) => {
|
|
147
|
-
u += (l.position - u) * (1 - Math.exp(-(b - x) /
|
|
147
|
+
u += (l.position - u) * (1 - Math.exp(-(b - x) / A)), x = b;
|
|
148
148
|
const f = Math.abs(l.position - u) < 0.1;
|
|
149
149
|
return this.context.write(f ? l.position : u), f && (this.movement = void 0), !f;
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return m && (this.readingEdge = { element: t.element, direction: i }, this.wheel && (this.wheel.consumed = !0)), !0;
|
|
153
153
|
}
|
|
154
154
|
/** Child scroll owners win, including at a contained overscroll boundary. */
|
|
155
155
|
nestedOwns(t, i) {
|
|
156
|
-
for (const
|
|
157
|
-
if (
|
|
158
|
-
if (!(
|
|
159
|
-
if (t.type === "wheel" &&
|
|
160
|
-
const
|
|
161
|
-
if (!/^(auto|scroll|overlay)$/.test(
|
|
162
|
-
const e = i > 0 ?
|
|
163
|
-
if (
|
|
156
|
+
for (const n of t.composedPath()) {
|
|
157
|
+
if (n === this.context.container || n === document.body || n === document.documentElement) break;
|
|
158
|
+
if (!(n instanceof HTMLElement)) continue;
|
|
159
|
+
if (t.type === "wheel" && n.getAttribute("data-vlite-wheel-directions")?.split(" ").includes(i > 0 ? "down" : "up")) return !0;
|
|
160
|
+
const s = getComputedStyle(n);
|
|
161
|
+
if (!/^(auto|scroll|overlay)$/.test(s.overflowY)) continue;
|
|
162
|
+
const e = i > 0 ? n.scrollTop + n.clientHeight < n.scrollHeight - 1 : n.scrollTop > 0;
|
|
163
|
+
if (n.scrollHeight > n.clientHeight && e || /^(contain|none)$/.test(s.overscrollBehaviorY)) return !0;
|
|
164
164
|
}
|
|
165
165
|
return !1;
|
|
166
166
|
}
|
|
167
167
|
enabled() {
|
|
168
168
|
if (document.hidden || !this.desktop.matches) return !1;
|
|
169
169
|
const { container: t, documentRoot: i } = this.context;
|
|
170
|
-
return ![t, ...i ? [document.body] : []].some((
|
|
170
|
+
return ![t, ...i ? [document.body] : []].some((n) => /^(hidden|clip)$/.test(getComputedStyle(n).overflowY));
|
|
171
171
|
}
|
|
172
172
|
readingStep() {
|
|
173
173
|
const t = this.context.viewport();
|
|
174
174
|
return Math.max(48, t.bottom - t.top - this.context.padding() - 48);
|
|
175
175
|
}
|
|
176
|
-
destination(t, i,
|
|
177
|
-
const
|
|
178
|
-
let e, h,
|
|
179
|
-
for (const l of
|
|
180
|
-
if (l.start <=
|
|
181
|
-
|
|
176
|
+
destination(t, i, n) {
|
|
177
|
+
const s = this.context.position();
|
|
178
|
+
let e, h, d;
|
|
179
|
+
for (const l of n)
|
|
180
|
+
if (l.start <= s + r && (e = l), l.start < s - r && (h = l), l.start > s + r) {
|
|
181
|
+
d = l;
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
|
-
const
|
|
185
|
-
let
|
|
186
|
-
if (i &&
|
|
184
|
+
const o = e && e.end > e.start + r && s <= e.end + r, a = this.readingStep();
|
|
185
|
+
let m, c;
|
|
186
|
+
if (i && o && (t > 0 ? s < e.end - r : s > e.start + r) ? (c = e, m = Math.min(e.end, Math.max(e.start, s + t * a))) : (c = t > 0 ? d : h, m = c ? t > 0 ? c.start : c.end : t > 0 ? this.context.limit() : 0), !(Math.abs(m - s) <= r))
|
|
187
187
|
return {
|
|
188
|
-
position:
|
|
188
|
+
position: m,
|
|
189
189
|
element: c?.element,
|
|
190
|
-
progress: c && c.end > c.start ? (
|
|
190
|
+
progress: c && c.end > c.start ? (m - c.start) / (c.end - c.start) : 0,
|
|
191
191
|
atEnd: !c && t > 0
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
move(t, i) {
|
|
195
195
|
this.cancel(), this.readingElement = void 0;
|
|
196
|
-
const
|
|
197
|
-
this.movement =
|
|
196
|
+
const n = this.context.position(), s = { frame: 0, direction: i };
|
|
197
|
+
this.movement = s;
|
|
198
198
|
const e = () => {
|
|
199
|
-
if (this.movement !==
|
|
199
|
+
if (this.movement !== s) return;
|
|
200
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
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);
|
|
202
202
|
};
|
|
@@ -204,10 +204,10 @@ class y {
|
|
|
204
204
|
this.context.write(t.position), e();
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
const h = performance.now();
|
|
208
|
-
this.animate(
|
|
209
|
-
const a = Math.min(1, (o - h) /
|
|
210
|
-
return this.context.write(
|
|
207
|
+
const h = performance.now(), d = Math.min(k, y + Math.abs(t.position - n) * 0.2);
|
|
208
|
+
this.animate(s, t.element, (o) => {
|
|
209
|
+
const a = Math.min(1, (o - h) / d);
|
|
210
|
+
return this.context.write(n + (t.position - n) * (1 - (1 - a) ** 3)), a === 1 && e(), a < 1;
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
onWheel = (t) => {
|
|
@@ -215,9 +215,9 @@ class y {
|
|
|
215
215
|
this.movement && this.reset();
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
const i = Math.sign(t.deltaY),
|
|
219
|
-
if (!Number.isFinite(
|
|
220
|
-
const e = this.wheelGesture(
|
|
218
|
+
const i = Math.sign(t.deltaY), n = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? Math.max(1, this.context.viewport().bottom - this.context.viewport().top - this.context.padding()) : 1, s = t.deltaY * n;
|
|
219
|
+
if (!Number.isFinite(s)) return;
|
|
220
|
+
const e = this.wheelGesture(s, performance.now());
|
|
221
221
|
if (this.nestedOwns(t, i)) {
|
|
222
222
|
this.cancel(), e.consumed = !0, this.distance = 0;
|
|
223
223
|
return;
|
|
@@ -227,8 +227,8 @@ class y {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
if (this.readingEdge) {
|
|
230
|
-
const
|
|
231
|
-
|
|
230
|
+
const o = this.readingEdge, a = this.measureSection(o.element), m = this.movement?.reading?.position ?? this.context.position();
|
|
231
|
+
a && (o.direction > 0 ? Math.abs(m - a.end) <= r : Math.abs(m - a.start) <= r) || (e.consumed = !1, this.readingEdge = void 0);
|
|
232
232
|
}
|
|
233
233
|
if (e.consumed) {
|
|
234
234
|
t.preventDefault();
|
|
@@ -239,26 +239,26 @@ class y {
|
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
if ((!this.movement || this.movement.reading) && this.readingElement) {
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
242
|
+
const o = this.measureSection(this.readingElement);
|
|
243
|
+
if (o && this.readWheel(o, i, s, t)) return;
|
|
244
244
|
this.readingElement = void 0;
|
|
245
245
|
}
|
|
246
|
-
if (Math.sign(this.distance) !== i && (this.distance = 0), this.distance +=
|
|
246
|
+
if (Math.sign(this.distance) !== i && (this.distance = 0), this.distance += s, Math.abs(this.distance) < w) {
|
|
247
247
|
t.preventDefault();
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
const h = this.measure();
|
|
251
251
|
if (h.length < 2) return;
|
|
252
252
|
if (!this.movement) {
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
253
|
+
const o = this.context.position(), a = h.find((m) => o >= m.start - r && o <= m.end + r && (i > 0 ? o < m.end - r : o > m.start + r));
|
|
254
|
+
if (a && this.readWheel(a, i, this.distance, t)) return;
|
|
255
255
|
}
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
256
|
+
const d = this.destination(i, !1, h);
|
|
257
|
+
if (!d) {
|
|
258
258
|
this.distance = 0;
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
|
-
t.preventDefault(), this.distance = 0, e.consumed = !0, this.move(
|
|
261
|
+
t.preventDefault(), this.distance = 0, e.consumed = !0, this.move(d, i);
|
|
262
262
|
};
|
|
263
263
|
onKeydown = (t) => {
|
|
264
264
|
if (this.context.syncNavigation(), !this.enabled() || t.defaultPrevented || t.ctrlKey || t.metaKey || t.altKey) return;
|
|
@@ -269,18 +269,18 @@ class y {
|
|
|
269
269
|
}
|
|
270
270
|
for (const e of t.composedPath()) {
|
|
271
271
|
if (e === this.context.container) break;
|
|
272
|
-
if (e instanceof Element && (e.matches(
|
|
272
|
+
if (e instanceof Element && (e.matches(M) || e.hasAttribute("tabindex") && Number(e.getAttribute("tabindex")) >= 0)) return;
|
|
273
273
|
}
|
|
274
274
|
if (this.nestedOwns(t, i) || this.context.limit() <= r) return;
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
const
|
|
278
|
-
|
|
275
|
+
const n = this.measure();
|
|
276
|
+
if (n.length < 2) return;
|
|
277
|
+
const s = this.destination(i, !0, n);
|
|
278
|
+
s && (t.preventDefault(), !(t.repeat || this.movement?.direction === i && !this.movement.reading) && (this.reset(), this.move(s, i)));
|
|
279
279
|
};
|
|
280
280
|
destroy() {
|
|
281
281
|
this.reset(), this.listeners?.abort(), this.desktop.removeEventListener("change", this.configure), this.sections.clear();
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
export {
|
|
285
|
-
|
|
285
|
+
S as ScrollRevealPager
|
|
286
286
|
};
|
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.51",
|
|
6
|
+
"generatedAt": "2026-11-06T22:24:41.217Z",
|
|
7
7
|
"files": {
|
|
8
8
|
"component-index.md": {
|
|
9
9
|
"sha256": "2a8a3c18e4b9158ff62eaf23c3aae82b2aee7e10fca9b78f9a6d573ff9b13c61"
|
package/package.json
CHANGED
|
File without changes
|