@savvycal/calendar 0.10.0 → 0.10.2

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;AAI1B,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,iEA4T/B,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 ot, jsx as b } from "react/jsx-runtime";
2
- import { memo as st, useState as Q, useRef as o, useCallback as d, useLayoutEffect as it, useEffect as ut } from "react";
3
- import { buildSyntheticEvent as ct } from "../../lib/selection.js";
4
- import { EventChip as at } from "./EventChip.js";
5
- function R(H, m, T) {
6
- const h = Math.floor(m / 60), i = m % 60;
7
- return h >= 24 ? H.add({ days: Math.floor(h / 24) }).toPlainDateTime({ hour: h % 24, minute: i }).toZonedDateTime(T) : H.toPlainDateTime({ hour: h, minute: i }).toZonedDateTime(T);
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 ht = st(function({
10
- columnId: m,
11
- fallbackColor: T,
10
+ const Ct = at(function({
11
+ columnId: M,
12
+ fallbackColor: L,
12
13
  column: h,
13
- date: i,
14
+ date: s,
14
15
  timeZone: a,
15
- startHour: V,
16
- endHour: W,
17
- hourHeight: X,
18
- snapDuration: S,
19
- placeholderDuration: c,
20
- cls: L,
16
+ startHour: _,
17
+ endHour: $,
18
+ hourHeight: Z,
19
+ snapDuration: y,
20
+ placeholderDuration: i,
21
+ cls: Y,
21
22
  onSlotClick: x,
22
- onSelect: M,
23
- dragPreviewAppearance: k = "highlight",
24
- renderEvent: _
23
+ onSelect: g,
24
+ dragPreviewAppearance: q = "highlight",
25
+ renderEvent: tt
25
26
  }) {
26
- const [w, q] = Q(null), [u, B] = Q(null), y = o(null), v = o(null), D = o(!1), z = o(M), G = o(m), O = o(i), P = o(a), g = V * 60, C = W * 60, l = X / 60, f = d(
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 / l, r = Math.floor(t / S) * S, e = g + r;
29
- return e + c > C || e < g ? null : e;
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
- l,
33
- S,
34
- c,
35
- g,
36
- C
34
+ f,
35
+ y,
36
+ i,
37
+ R,
38
+ D
37
39
  ]
38
- ), J = o(f), Y = o(C), $ = o(S), N = o(c), K = d((n, t) => {
39
- const r = Math.min(n, t), e = Math.min(
40
- Math.max(n, t) + N.current,
41
- Y.current
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: e };
44
- }, []), p = d(
45
+ return { startMin: r, endMin: o };
46
+ }, []), V = l(
45
47
  (n) => {
46
- const t = v.current, r = y.current;
48
+ const t = v.current, r = C.current;
47
49
  if (!t || !r) return;
48
- const e = r.getBoundingClientRect(), s = e.height, E = Math.max(
49
- 0,
50
- Math.min(n.clientY - e.top, s)
51
- );
52
- let F = J.current(E);
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
- [K]
58
- ), j = o(() => {
59
- }), U = d(() => {
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 && (D.current = !0), z.current?.({
62
- columnId: G.current,
63
- startTime: R(
64
- O.current,
70
+ n && (n.moved && (F.current = !0), J.current?.({
71
+ columnId: K.current,
72
+ startTime: S(
73
+ N.current,
65
74
  n.currentStartMin,
66
- P.current
75
+ j.current
67
76
  ),
68
- endTime: R(
69
- O.current,
77
+ endTime: S(
78
+ N.current,
70
79
  n.currentEndMin,
71
- P.current
80
+ j.current
72
81
  )
73
- })), v.current = null, B(null), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", j.current);
74
- }, [p]);
75
- it(() => {
76
- z.current = M, G.current = m, O.current = i, P.current = a, J.current = f, Y.current = C, $.current = S, N.current = c, j.current = U;
77
- }), ut(() => () => {
78
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", j.current);
79
- }, [p]);
80
- const A = d(
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 (!M) return;
83
- const t = y.current;
91
+ if (!g) return;
92
+ const t = C.current;
84
93
  if (!t) return;
85
- const r = t.getBoundingClientRect(), e = n.clientY - r.top, s = f(e);
86
- if (s == null) return;
87
- n.preventDefault(), M(null);
88
- const E = s + c;
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: s,
91
- currentStartMin: s,
92
- currentEndMin: E,
99
+ anchorSlotStart: c,
100
+ currentStartMin: c,
101
+ currentEndMin: m,
93
102
  moved: !1
94
- }, B({ startMin: s, endMin: E }), document.addEventListener("mousemove", p), document.addEventListener("mouseup", U);
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
- M,
98
- f,
99
- c,
100
- p,
101
- U
110
+ g,
111
+ d,
112
+ i,
113
+ E,
114
+ k
102
115
  ]
103
- ), Z = d(
116
+ ), rt = l(
104
117
  (n) => {
105
118
  if (v.current) return;
106
- const t = y.current;
119
+ const t = C.current;
107
120
  if (!t) return;
108
- const r = t.getBoundingClientRect(), e = n.clientY - r.top;
109
- q(f(e));
121
+ const r = t.getBoundingClientRect(), o = n.clientY - r.top;
122
+ z(d(o));
110
123
  },
111
- [f]
112
- ), tt = d(() => {
113
- v.current || q(null);
114
- }, []), nt = d(
124
+ [d]
125
+ ), ot = l(() => {
126
+ v.current || z(null);
127
+ }, []), ct = l(
115
128
  (n) => {
116
- if (D.current) {
117
- D.current = !1;
129
+ if (F.current) {
130
+ F.current = !1;
118
131
  return;
119
132
  }
120
- const t = y.current;
133
+ const t = C.current;
121
134
  if (!t) return;
122
- const r = t.getBoundingClientRect(), e = n.clientY - r.top, s = f(e);
123
- if (s == null) return;
124
- const E = s + c;
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: m,
127
- startTime: R(i, s, a),
128
- endTime: R(i, E, a)
139
+ columnId: M,
140
+ startTime: S(s, c, a),
141
+ endTime: S(s, m, a)
129
142
  });
130
143
  },
131
- [x, f, c, m, i, a]
132
- ), et = w != null ? (w - g) * l : 0, rt = c * l;
133
- return /* @__PURE__ */ ot(
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: y,
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 || M ? "pointer" : void 0
155
+ cursor: x || g ? "pointer" : void 0
143
156
  },
144
- onMouseDown: A,
145
- onMouseMove: Z,
146
- onMouseLeave: tt,
147
- onClick: nt,
157
+ onMouseDown: et,
158
+ onMouseMove: rt,
159
+ onMouseLeave: ot,
160
+ onClick: ct,
148
161
  children: [
149
- w != null && !u && /* @__PURE__ */ b(
162
+ H != null && !u && /* @__PURE__ */ B(
150
163
  "div",
151
164
  {
152
165
  "aria-hidden": "true",
153
- className: L("slotHighlight"),
166
+ className: Y("slotHighlight"),
154
167
  style: {
155
168
  position: "absolute",
156
- top: et,
169
+ top: st,
157
170
  left: 0,
158
171
  right: 0,
159
- height: rt,
172
+ height: ut,
160
173
  pointerEvents: "none"
161
174
  }
162
175
  }
163
176
  ),
164
- u && (k !== "highlight" ? /* @__PURE__ */ b(
177
+ u && (q !== "highlight" ? /* @__PURE__ */ B(
165
178
  "div",
166
179
  {
167
180
  "aria-hidden": "true",
168
- className: L("eventColumn"),
181
+ className: Y("eventColumn"),
169
182
  style: { pointerEvents: "none" },
170
- children: /* @__PURE__ */ b(
171
- at,
183
+ children: /* @__PURE__ */ B(
184
+ vt,
172
185
  {
173
186
  interactive: !1,
174
187
  positioned: {
175
- event: ct(
188
+ event: gt(
176
189
  "",
177
- R(i, u.startMin, a),
178
- R(i, u.endMin, a),
179
- k.eventData
190
+ S(s, u.startMin, a),
191
+ S(s, u.endMin, a),
192
+ q.eventData
180
193
  ),
181
- top: (u.startMin - g) * l,
182
- height: (u.endMin - u.startMin) * l,
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: T,
199
+ fallbackColor: L,
187
200
  timeZone: a,
188
- cls: L,
189
- renderEvent: _
201
+ cls: Y,
202
+ renderEvent: tt
190
203
  }
191
204
  )
192
205
  }
193
- ) : /* @__PURE__ */ b(
206
+ ) : /* @__PURE__ */ B(
194
207
  "div",
195
208
  {
196
209
  "aria-hidden": "true",
197
- className: L("selectionHighlight"),
210
+ className: Y("selectionHighlight"),
198
211
  style: {
199
212
  position: "absolute",
200
- top: (u.startMin - g) * l,
213
+ top: (u.startMin - R) * f,
201
214
  left: 0,
202
215
  right: 0,
203
- height: (u.endMin - u.startMin) * l,
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
- ht as SlotInteractionLayer
226
+ Ct as SlotInteractionLayer
214
227
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UnavailabilityOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/shared/UnavailabilityOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,UAAU,0BAA0B;IAClC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;CAChD;AAED,eAAO,MAAM,qBAAqB,kEAiChC,CAAC"}
1
+ {"version":3,"file":"UnavailabilityOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/shared/UnavailabilityOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,UAAU,0BAA0B;IAClC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;CAChD;AAED,eAAO,MAAM,qBAAqB,kEAuChC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { memo as o } from "react";
3
- const v = o(function({
2
+ import { memo as r } from "react";
3
+ const p = r(function({
4
4
  blocks: t,
5
- column: n,
6
- cls: r
5
+ column: o,
6
+ cls: a
7
7
  }) {
8
8
  return t.length === 0 ? null : /* @__PURE__ */ e(
9
9
  "div",
@@ -11,28 +11,34 @@ const v = o(function({
11
11
  "aria-hidden": "true",
12
12
  style: {
13
13
  gridRow: "3 / -1",
14
- gridColumn: n,
14
+ gridColumn: o,
15
15
  position: "relative",
16
- pointerEvents: "none"
16
+ pointerEvents: "none",
17
+ // One compositor layer for the row-spanning grid item. Safari
18
+ // otherwise fragments that item and paints semi-transparent
19
+ // backgrounds once per row.
20
+ isolation: "isolate",
21
+ transform: "translateZ(0)",
22
+ overflow: "hidden"
17
23
  },
18
- children: t.map((i, a) => /* @__PURE__ */ e(
24
+ children: t.map((i, n) => /* @__PURE__ */ e(
19
25
  "div",
20
26
  {
21
- className: r("unavailableOverlay"),
27
+ className: a("unavailableOverlay"),
22
28
  style: {
23
29
  position: "absolute",
24
30
  top: i.top,
25
31
  left: 0,
26
32
  right: 0,
27
33
  height: i.height,
28
- backgroundPosition: `0 ${-i.top}px`
34
+ backgroundPosition: `0 ${-Math.round(i.top)}px`
29
35
  }
30
36
  },
31
- a
37
+ n
32
38
  ))
33
39
  }
34
40
  );
35
41
  });
36
42
  export {
37
- v as UnavailabilityOverlay
43
+ p as UnavailabilityOverlay
38
44
  };
@@ -8,27 +8,23 @@
8
8
  * @import "@savvycal/calendar/components.css";
9
9
  */
10
10
 
11
- /* Unavailable time overlay with cross-hatching.
12
- * Do not use background-attachment: fixed — mobile browsers fail to paint
13
- * fixed backgrounds inside overflow scrollers. Overlay blocks set
14
- * background-position from their grid top so disjoint ranges share one
15
- * stripe origin. */
11
+ /* Unavailable time overlay with diagonal stripes.
12
+ *
13
+ * Use a repeating SVG tile, not repeating-linear-gradient. Safari paints
14
+ * angled repeating gradients on tall grid items as stacked, offset bands.
15
+ * Overlay blocks set background-position from their grid top so disjoint
16
+ * ranges share one stripe origin. Do not use background-attachment: fixed
17
+ * — mobile browsers fail to paint fixed backgrounds inside overflow
18
+ * scrollers.
19
+ */
16
20
  .cal-unavailable-overlay {
17
- background-image: repeating-linear-gradient(
18
- -45deg,
19
- oklch(0 0 0 / 0.02),
20
- oklch(0 0 0 / 0.02) 3px,
21
- oklch(0 0 0 / 0.08) 3px,
22
- oklch(0 0 0 / 0.08) 6px
23
- );
21
+ isolation: isolate;
22
+ transform: translateZ(0);
23
+ background-repeat: repeat;
24
+ background-size: 8px 8px;
25
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(0,0,0,0.02)'/%3E%3Cpath d='M-2,2 l4,-4 M0,8 l8,-8 M6,10 l4,-4' stroke='rgba(0,0,0,0.08)' stroke-width='3' fill='none'/%3E%3C/svg%3E");
24
26
  }
25
27
 
26
28
  .dark .cal-unavailable-overlay {
27
- background-image: repeating-linear-gradient(
28
- -45deg,
29
- oklch(1 0 0 / 0.02),
30
- oklch(1 0 0 / 0.02) 3px,
31
- oklch(1 0 0 / 0.08) 3px,
32
- oklch(1 0 0 / 0.08) 6px
33
- );
29
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255,255,255,0.02)'/%3E%3Cpath d='M-2,2 l4,-4 M0,8 l8,-8 M6,10 l4,-4' stroke='rgba(255,255,255,0.08)' stroke-width='3' fill='none'/%3E%3C/svg%3E");
34
30
  }
@@ -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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvycal/calendar",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {