@savvycal/calendar 0.10.0 → 0.10.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotInteractionLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SlotInteractionLayer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SlotInteractionLayer.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SlotInteractionLayer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAU1B,UAAU,yBAAyB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;QAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;KACjC,KAAK,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC;QAClC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC;KACjC,GAAG,IAAI,KACL,IAAI,CAAC;IACV,qBAAqB,CAAC,EAAE,mBAAmB,CAAC;IAC5C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AAyBD,eAAO,MAAM,oBAAoB,iEA6V/B,CAAC"}
|
|
@@ -1,206 +1,219 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as lt, jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { memo as at, useState as X, useRef as e, useCallback as l, useLayoutEffect as ft, useEffect as dt } from "react";
|
|
3
|
+
import { computeAutoScrollIntensity as mt, findVerticalScrollParent as Mt, createVerticalAutoScroller as ht } from "../../lib/autoScroll.js";
|
|
4
|
+
import { buildSyntheticEvent as gt } from "../../lib/selection.js";
|
|
5
|
+
import { EventChip as vt } from "./EventChip.js";
|
|
6
|
+
function S(w, M, L) {
|
|
7
|
+
const h = Math.floor(M / 60), s = M % 60;
|
|
8
|
+
return h >= 24 ? w.add({ days: Math.floor(h / 24) }).toPlainDateTime({ hour: h % 24, minute: s }).toZonedDateTime(L) : w.toPlainDateTime({ hour: h, minute: s }).toZonedDateTime(L);
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
-
columnId:
|
|
11
|
-
fallbackColor:
|
|
10
|
+
const Ct = at(function({
|
|
11
|
+
columnId: M,
|
|
12
|
+
fallbackColor: L,
|
|
12
13
|
column: h,
|
|
13
|
-
date:
|
|
14
|
+
date: s,
|
|
14
15
|
timeZone: a,
|
|
15
|
-
startHour:
|
|
16
|
-
endHour:
|
|
17
|
-
hourHeight:
|
|
18
|
-
snapDuration:
|
|
19
|
-
placeholderDuration:
|
|
20
|
-
cls:
|
|
16
|
+
startHour: _,
|
|
17
|
+
endHour: $,
|
|
18
|
+
hourHeight: Z,
|
|
19
|
+
snapDuration: y,
|
|
20
|
+
placeholderDuration: i,
|
|
21
|
+
cls: Y,
|
|
21
22
|
onSlotClick: x,
|
|
22
|
-
onSelect:
|
|
23
|
-
dragPreviewAppearance:
|
|
24
|
-
renderEvent:
|
|
23
|
+
onSelect: g,
|
|
24
|
+
dragPreviewAppearance: q = "highlight",
|
|
25
|
+
renderEvent: tt
|
|
25
26
|
}) {
|
|
26
|
-
const [
|
|
27
|
+
const [H, z] = X(null), [u, O] = X(null), C = e(null), v = e(null), F = e(!1), P = e(0), b = e(null), p = e(null), G = e(() => {
|
|
28
|
+
}), J = e(g), K = e(M), N = e(s), j = e(a), R = _ * 60, D = $ * 60, f = Z / 60, d = l(
|
|
27
29
|
(n) => {
|
|
28
|
-
const t = n /
|
|
29
|
-
return
|
|
30
|
+
const t = n / f, r = Math.floor(t / y) * y, o = R + r;
|
|
31
|
+
return o + i > D || o < R ? null : o;
|
|
30
32
|
},
|
|
31
33
|
[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
f,
|
|
35
|
+
y,
|
|
36
|
+
i,
|
|
37
|
+
R,
|
|
38
|
+
D
|
|
37
39
|
]
|
|
38
|
-
),
|
|
39
|
-
const r = Math.min(n, t),
|
|
40
|
-
Math.max(n, t) +
|
|
41
|
-
|
|
40
|
+
), Q = e(d), I = e(D), nt = e(y), U = e(i), W = l((n, t) => {
|
|
41
|
+
const r = Math.min(n, t), o = Math.min(
|
|
42
|
+
Math.max(n, t) + U.current,
|
|
43
|
+
I.current
|
|
42
44
|
);
|
|
43
|
-
return { startMin: r, endMin:
|
|
44
|
-
}, []),
|
|
45
|
+
return { startMin: r, endMin: o };
|
|
46
|
+
}, []), V = l(
|
|
45
47
|
(n) => {
|
|
46
|
-
const t = v.current, r =
|
|
48
|
+
const t = v.current, r = C.current;
|
|
47
49
|
if (!t || !r) return;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
F == null && (F = Y.current - N.current);
|
|
54
|
-
const I = K(t.anchorSlotStart, F);
|
|
55
|
-
t.currentStartMin = I.startMin, t.currentEndMin = I.endMin, t.moved = !0, B(I);
|
|
50
|
+
const o = r.getBoundingClientRect(), c = Math.max(0, Math.min(n - o.top, o.height));
|
|
51
|
+
let m = Q.current(c);
|
|
52
|
+
m == null && (m = I.current - U.current);
|
|
53
|
+
const T = W(t.anchorSlotStart, m), it = t.moved && t.currentStartMin === T.startMin && t.currentEndMin === T.endMin;
|
|
54
|
+
t.currentStartMin = T.startMin, t.currentEndMin = T.endMin, t.moved = !0, it || O(T);
|
|
56
55
|
},
|
|
57
|
-
[
|
|
58
|
-
),
|
|
59
|
-
|
|
56
|
+
[W]
|
|
57
|
+
), E = l(
|
|
58
|
+
(n) => {
|
|
59
|
+
P.current = n.clientY, V(n.clientY);
|
|
60
|
+
const t = b.current;
|
|
61
|
+
if (!t) return;
|
|
62
|
+
const r = t.getBoundingClientRect();
|
|
63
|
+
mt(n.clientY, r.top, r.bottom) !== 0 && p.current?.ensure();
|
|
64
|
+
},
|
|
65
|
+
[V]
|
|
66
|
+
), A = e(() => {
|
|
67
|
+
}), k = l(() => {
|
|
68
|
+
p.current?.stop(), p.current = null, b.current = null;
|
|
60
69
|
const n = v.current;
|
|
61
|
-
n && (n.moved && (
|
|
62
|
-
columnId:
|
|
63
|
-
startTime:
|
|
64
|
-
|
|
70
|
+
n && (n.moved && (F.current = !0), J.current?.({
|
|
71
|
+
columnId: K.current,
|
|
72
|
+
startTime: S(
|
|
73
|
+
N.current,
|
|
65
74
|
n.currentStartMin,
|
|
66
|
-
|
|
75
|
+
j.current
|
|
67
76
|
),
|
|
68
|
-
endTime:
|
|
69
|
-
|
|
77
|
+
endTime: S(
|
|
78
|
+
N.current,
|
|
70
79
|
n.currentEndMin,
|
|
71
|
-
|
|
80
|
+
j.current
|
|
72
81
|
)
|
|
73
|
-
})), v.current = null,
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}),
|
|
78
|
-
document.removeEventListener("mousemove",
|
|
79
|
-
}, [
|
|
80
|
-
const
|
|
82
|
+
})), v.current = null, O(null), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", A.current);
|
|
83
|
+
}, [E]);
|
|
84
|
+
ft(() => {
|
|
85
|
+
J.current = g, K.current = M, N.current = s, j.current = a, Q.current = d, I.current = D, nt.current = y, U.current = i, A.current = k, G.current = V;
|
|
86
|
+
}), dt(() => () => {
|
|
87
|
+
p.current?.stop(), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", A.current);
|
|
88
|
+
}, [E]);
|
|
89
|
+
const et = l(
|
|
81
90
|
(n) => {
|
|
82
|
-
if (!
|
|
83
|
-
const t =
|
|
91
|
+
if (!g) return;
|
|
92
|
+
const t = C.current;
|
|
84
93
|
if (!t) return;
|
|
85
|
-
const r = t.getBoundingClientRect(),
|
|
86
|
-
if (
|
|
87
|
-
n.preventDefault(),
|
|
88
|
-
const
|
|
94
|
+
const r = t.getBoundingClientRect(), o = n.clientY - r.top, c = d(o);
|
|
95
|
+
if (c == null) return;
|
|
96
|
+
n.preventDefault(), g(null);
|
|
97
|
+
const m = c + i;
|
|
89
98
|
v.current = {
|
|
90
|
-
anchorSlotStart:
|
|
91
|
-
currentStartMin:
|
|
92
|
-
currentEndMin:
|
|
99
|
+
anchorSlotStart: c,
|
|
100
|
+
currentStartMin: c,
|
|
101
|
+
currentEndMin: m,
|
|
93
102
|
moved: !1
|
|
94
|
-
},
|
|
103
|
+
}, P.current = n.clientY, b.current = Mt(t), p.current?.stop(), p.current = ht({
|
|
104
|
+
getPointerY: () => P.current,
|
|
105
|
+
getScrollParent: () => b.current,
|
|
106
|
+
onScroll: () => G.current(P.current)
|
|
107
|
+
}), O({ startMin: c, endMin: m }), document.addEventListener("mousemove", E), document.addEventListener("mouseup", k);
|
|
95
108
|
},
|
|
96
109
|
[
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
g,
|
|
111
|
+
d,
|
|
112
|
+
i,
|
|
113
|
+
E,
|
|
114
|
+
k
|
|
102
115
|
]
|
|
103
|
-
),
|
|
116
|
+
), rt = l(
|
|
104
117
|
(n) => {
|
|
105
118
|
if (v.current) return;
|
|
106
|
-
const t =
|
|
119
|
+
const t = C.current;
|
|
107
120
|
if (!t) return;
|
|
108
|
-
const r = t.getBoundingClientRect(),
|
|
109
|
-
|
|
121
|
+
const r = t.getBoundingClientRect(), o = n.clientY - r.top;
|
|
122
|
+
z(d(o));
|
|
110
123
|
},
|
|
111
|
-
[
|
|
112
|
-
),
|
|
113
|
-
v.current ||
|
|
114
|
-
}, []),
|
|
124
|
+
[d]
|
|
125
|
+
), ot = l(() => {
|
|
126
|
+
v.current || z(null);
|
|
127
|
+
}, []), ct = l(
|
|
115
128
|
(n) => {
|
|
116
|
-
if (
|
|
117
|
-
|
|
129
|
+
if (F.current) {
|
|
130
|
+
F.current = !1;
|
|
118
131
|
return;
|
|
119
132
|
}
|
|
120
|
-
const t =
|
|
133
|
+
const t = C.current;
|
|
121
134
|
if (!t) return;
|
|
122
|
-
const r = t.getBoundingClientRect(),
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
135
|
+
const r = t.getBoundingClientRect(), o = n.clientY - r.top, c = d(o);
|
|
136
|
+
if (c == null) return;
|
|
137
|
+
const m = c + i;
|
|
125
138
|
x && x({
|
|
126
|
-
columnId:
|
|
127
|
-
startTime:
|
|
128
|
-
endTime:
|
|
139
|
+
columnId: M,
|
|
140
|
+
startTime: S(s, c, a),
|
|
141
|
+
endTime: S(s, m, a)
|
|
129
142
|
});
|
|
130
143
|
},
|
|
131
|
-
[x,
|
|
132
|
-
),
|
|
133
|
-
return /* @__PURE__ */
|
|
144
|
+
[x, d, i, M, s, a]
|
|
145
|
+
), st = H != null ? (H - R) * f : 0, ut = i * f;
|
|
146
|
+
return /* @__PURE__ */ lt(
|
|
134
147
|
"div",
|
|
135
148
|
{
|
|
136
|
-
ref:
|
|
149
|
+
ref: C,
|
|
137
150
|
style: {
|
|
138
151
|
gridRow: "3 / -1",
|
|
139
152
|
gridColumn: h,
|
|
140
153
|
position: "relative",
|
|
141
154
|
pointerEvents: "auto",
|
|
142
|
-
cursor: x ||
|
|
155
|
+
cursor: x || g ? "pointer" : void 0
|
|
143
156
|
},
|
|
144
|
-
onMouseDown:
|
|
145
|
-
onMouseMove:
|
|
146
|
-
onMouseLeave:
|
|
147
|
-
onClick:
|
|
157
|
+
onMouseDown: et,
|
|
158
|
+
onMouseMove: rt,
|
|
159
|
+
onMouseLeave: ot,
|
|
160
|
+
onClick: ct,
|
|
148
161
|
children: [
|
|
149
|
-
|
|
162
|
+
H != null && !u && /* @__PURE__ */ B(
|
|
150
163
|
"div",
|
|
151
164
|
{
|
|
152
165
|
"aria-hidden": "true",
|
|
153
|
-
className:
|
|
166
|
+
className: Y("slotHighlight"),
|
|
154
167
|
style: {
|
|
155
168
|
position: "absolute",
|
|
156
|
-
top:
|
|
169
|
+
top: st,
|
|
157
170
|
left: 0,
|
|
158
171
|
right: 0,
|
|
159
|
-
height:
|
|
172
|
+
height: ut,
|
|
160
173
|
pointerEvents: "none"
|
|
161
174
|
}
|
|
162
175
|
}
|
|
163
176
|
),
|
|
164
|
-
u && (
|
|
177
|
+
u && (q !== "highlight" ? /* @__PURE__ */ B(
|
|
165
178
|
"div",
|
|
166
179
|
{
|
|
167
180
|
"aria-hidden": "true",
|
|
168
|
-
className:
|
|
181
|
+
className: Y("eventColumn"),
|
|
169
182
|
style: { pointerEvents: "none" },
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
|
|
183
|
+
children: /* @__PURE__ */ B(
|
|
184
|
+
vt,
|
|
172
185
|
{
|
|
173
186
|
interactive: !1,
|
|
174
187
|
positioned: {
|
|
175
|
-
event:
|
|
188
|
+
event: gt(
|
|
176
189
|
"",
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
190
|
+
S(s, u.startMin, a),
|
|
191
|
+
S(s, u.endMin, a),
|
|
192
|
+
q.eventData
|
|
180
193
|
),
|
|
181
|
-
top: (u.startMin -
|
|
182
|
-
height: (u.endMin - u.startMin) *
|
|
194
|
+
top: (u.startMin - R) * f,
|
|
195
|
+
height: (u.endMin - u.startMin) * f,
|
|
183
196
|
subColumn: 0,
|
|
184
197
|
totalSubColumns: 1
|
|
185
198
|
},
|
|
186
|
-
fallbackColor:
|
|
199
|
+
fallbackColor: L,
|
|
187
200
|
timeZone: a,
|
|
188
|
-
cls:
|
|
189
|
-
renderEvent:
|
|
201
|
+
cls: Y,
|
|
202
|
+
renderEvent: tt
|
|
190
203
|
}
|
|
191
204
|
)
|
|
192
205
|
}
|
|
193
|
-
) : /* @__PURE__ */
|
|
206
|
+
) : /* @__PURE__ */ B(
|
|
194
207
|
"div",
|
|
195
208
|
{
|
|
196
209
|
"aria-hidden": "true",
|
|
197
|
-
className:
|
|
210
|
+
className: Y("selectionHighlight"),
|
|
198
211
|
style: {
|
|
199
212
|
position: "absolute",
|
|
200
|
-
top: (u.startMin -
|
|
213
|
+
top: (u.startMin - R) * f,
|
|
201
214
|
left: 0,
|
|
202
215
|
right: 0,
|
|
203
|
-
height: (u.endMin - u.startMin) *
|
|
216
|
+
height: (u.endMin - u.startMin) * f,
|
|
204
217
|
pointerEvents: "none"
|
|
205
218
|
}
|
|
206
219
|
}
|
|
@@ -210,5 +223,5 @@ const ht = st(function({
|
|
|
210
223
|
);
|
|
211
224
|
});
|
|
212
225
|
export {
|
|
213
|
-
|
|
226
|
+
Ct as SlotInteractionLayer
|
|
214
227
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Distance from a scroll viewport edge that starts auto-scroll, in px. */
|
|
2
|
+
export declare const AUTO_SCROLL_EDGE_PX = 48;
|
|
3
|
+
/** Peak auto-scroll speed while the pointer is at or past an edge. */
|
|
4
|
+
export declare const AUTO_SCROLL_MAX_PX_PER_SECOND = 400;
|
|
5
|
+
/**
|
|
6
|
+
* Nearest ancestor that scrolls vertically (overflow-y auto/scroll/overlay).
|
|
7
|
+
* The calendar root is `overflow-auto`, so this is the grid's own scroller.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findVerticalScrollParent(el: HTMLElement): HTMLElement | null;
|
|
10
|
+
/**
|
|
11
|
+
* Signed intensity in [-1, 1] for pointer-driven vertical auto-scroll.
|
|
12
|
+
* Negative scrolls up, positive scrolls down, 0 means the pointer is outside
|
|
13
|
+
* the edge zones. Intensity ramps from 0 at `edgePx` away from the edge to 1
|
|
14
|
+
* at the edge (and stays 1 past it). On a short viewport the zones are shrunk
|
|
15
|
+
* so they don't overlap; if they still meet, the closer edge wins.
|
|
16
|
+
*/
|
|
17
|
+
export declare function computeAutoScrollIntensity(pointerY: number, viewportTop: number, viewportBottom: number, edgePx?: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Scroll `scrollParent` by `intensity * maxPxPerSecond * deltaSeconds`.
|
|
20
|
+
* Returns the actual delta applied after clamping to the scroll range.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyVerticalAutoScroll(scrollParent: HTMLElement, intensity: number, deltaSeconds: number, maxPxPerSecond?: number): number;
|
|
23
|
+
export interface VerticalAutoScroller {
|
|
24
|
+
/** Start the rAF loop if it isn't already running. */
|
|
25
|
+
ensure: () => void;
|
|
26
|
+
/** Cancel the rAF loop. Safe to call more than once. */
|
|
27
|
+
stop: () => void;
|
|
28
|
+
}
|
|
29
|
+
interface CreateVerticalAutoScrollerOptions {
|
|
30
|
+
getPointerY: () => number;
|
|
31
|
+
getScrollParent: () => HTMLElement | null;
|
|
32
|
+
/** Called after the scroller actually moves, so the caller can remap the pointer. */
|
|
33
|
+
onScroll: () => void;
|
|
34
|
+
raf?: typeof requestAnimationFrame;
|
|
35
|
+
cancelRaf?: typeof cancelAnimationFrame;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* rAF loop that auto-scrolls while the pointer sits in an edge zone. The
|
|
39
|
+
* loop stops on its own when intensity hits 0 or the scroller can't move
|
|
40
|
+
* further; call `ensure()` again to resume.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createVerticalAutoScroller({ getPointerY, getScrollParent, onScroll, raf, cancelRaf, }: CreateVerticalAutoScrollerOptions): VerticalAutoScroller;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=autoScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoScroll.d.ts","sourceRoot":"","sources":["../../src/lib/autoScroll.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,sEAAsE;AACtE,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAMjD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAS5E;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,MAA4B,GACnC,MAAM,CAiBR;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,WAAW,EACzB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,MAAsC,GACrD,MAAM,CAYR;AAED,MAAM,WAAW,oBAAoB;IACnC,sDAAsD;IACtD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,wDAAwD;IACxD,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,UAAU,iCAAiC;IACzC,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAC1C,qFAAqF;IACrF,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,qBAAqB,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,oBAAoB,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,eAAe,EACf,QAAQ,EACR,GAA2B,EAC3B,SAAgC,GACjC,EAAE,iCAAiC,GAAG,oBAAoB,CAqD1D"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const O = 48, d = 400;
|
|
2
|
+
function h(n) {
|
|
3
|
+
return n === "auto" || n === "scroll" || n === "overlay";
|
|
4
|
+
}
|
|
5
|
+
function E(n) {
|
|
6
|
+
let e = n.parentElement;
|
|
7
|
+
for (; e; ) {
|
|
8
|
+
if (h(getComputedStyle(e).overflowY))
|
|
9
|
+
return e;
|
|
10
|
+
e = e.parentElement;
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function S(n, e, o, c = 48) {
|
|
15
|
+
const u = o - e;
|
|
16
|
+
if (u <= 0) return 0;
|
|
17
|
+
const t = Math.min(c, u / 2);
|
|
18
|
+
if (t <= 0) return 0;
|
|
19
|
+
const l = o - n, r = n - e;
|
|
20
|
+
return l < t && l <= r ? Math.min(1, (t - l) / t) : r < t ? -Math.min(1, (t - r) / t) : 0;
|
|
21
|
+
}
|
|
22
|
+
function p(n, e, o, c = 400) {
|
|
23
|
+
if (e === 0 || o <= 0) return 0;
|
|
24
|
+
const u = e * c * o, t = Math.max(
|
|
25
|
+
0,
|
|
26
|
+
n.scrollHeight - n.clientHeight
|
|
27
|
+
), l = n.scrollTop, r = Math.min(t, Math.max(0, l + u));
|
|
28
|
+
return n.scrollTop = r, r - l;
|
|
29
|
+
}
|
|
30
|
+
function M({
|
|
31
|
+
getPointerY: n,
|
|
32
|
+
getScrollParent: e,
|
|
33
|
+
onScroll: o,
|
|
34
|
+
raf: c = requestAnimationFrame,
|
|
35
|
+
cancelRaf: u = cancelAnimationFrame
|
|
36
|
+
}) {
|
|
37
|
+
let t = null, l = null, r = !1;
|
|
38
|
+
const s = (a) => {
|
|
39
|
+
if (r) return;
|
|
40
|
+
t = null;
|
|
41
|
+
const i = e();
|
|
42
|
+
if (!i) {
|
|
43
|
+
l = null;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const f = i.getBoundingClientRect(), m = S(
|
|
47
|
+
n(),
|
|
48
|
+
f.top,
|
|
49
|
+
f.bottom
|
|
50
|
+
);
|
|
51
|
+
if (m === 0) {
|
|
52
|
+
l = null;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const _ = l == null ? 1 / 60 : Math.min(0.05, (a - l) / 1e3);
|
|
56
|
+
if (l = a, p(i, m, _) === 0) {
|
|
57
|
+
l = null;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
o(), t = c(s);
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
ensure: () => {
|
|
64
|
+
r || t != null || (t = c(s));
|
|
65
|
+
},
|
|
66
|
+
stop: () => {
|
|
67
|
+
r = !0, t != null && (u(t), t = null), l = null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
O as AUTO_SCROLL_EDGE_PX,
|
|
73
|
+
d as AUTO_SCROLL_MAX_PX_PER_SECOND,
|
|
74
|
+
p as applyVerticalAutoScroll,
|
|
75
|
+
S as computeAutoScrollIntensity,
|
|
76
|
+
M as createVerticalAutoScroller,
|
|
77
|
+
E as findVerticalScrollParent
|
|
78
|
+
};
|