lizaui 8.3.9 → 8.4.9
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/dist/button/index.cjs.js +1 -1
- package/dist/button/index.es.js +1 -1
- package/dist/calendar/index.cjs.js +1 -1
- package/dist/calendar/index.es.js +1 -1
- package/dist/chunks/{button-DaAJ3J_i.js → button-DFrxQHAW.js} +2 -2
- package/dist/chunks/{button-DaAJ3J_i.js.map → button-DFrxQHAW.js.map} +1 -1
- package/dist/chunks/{button-DJYse8Dw.js → button-uo4_Xad_.js} +2 -2
- package/dist/chunks/{button-DJYse8Dw.js.map → button-uo4_Xad_.js.map} +1 -1
- package/dist/chunks/features-animation-BRAvwYFN.js +3437 -0
- package/dist/chunks/features-animation-BRAvwYFN.js.map +1 -0
- package/dist/chunks/features-animation-BoXKk5t2.js +2 -0
- package/dist/chunks/features-animation-BoXKk5t2.js.map +1 -0
- package/dist/chunks/index-BbDfYVLO.js +174 -0
- package/dist/chunks/index-BbDfYVLO.js.map +1 -0
- package/dist/chunks/index-CL73JQgs.js +2 -0
- package/dist/chunks/index-CL73JQgs.js.map +1 -0
- package/dist/chunks/index-DC9BfnBH.js +208 -0
- package/dist/chunks/index-DC9BfnBH.js.map +1 -0
- package/dist/chunks/index-lrI_r1ww.js +10 -0
- package/dist/chunks/index-lrI_r1ww.js.map +1 -0
- package/dist/chunks/proxy-BwQyOw8U.js +2 -0
- package/dist/chunks/proxy-BwQyOw8U.js.map +1 -0
- package/dist/chunks/proxy-kv_Ue2k_.js +1346 -0
- package/dist/chunks/proxy-kv_Ue2k_.js.map +1 -0
- package/dist/chunks/ripple-CzU7YM2G.js +69 -0
- package/dist/chunks/{ripple-DMI95LHg.js.map → ripple-CzU7YM2G.js.map} +1 -1
- package/dist/chunks/ripple-SBteSEo3.js +2 -0
- package/dist/chunks/{ripple-DieNd7XQ.js.map → ripple-SBteSEo3.js.map} +1 -1
- package/dist/chunks/{scroll-area-BwqigcJy.js → scroll-area-B0mWCpSW.js} +2 -2
- package/dist/chunks/{scroll-area-BwqigcJy.js.map → scroll-area-B0mWCpSW.js.map} +1 -1
- package/dist/chunks/{scroll-area-1okMO4N6.js → scroll-area-CE7quLQL.js} +2 -2
- package/dist/chunks/{scroll-area-1okMO4N6.js.map → scroll-area-CE7quLQL.js.map} +1 -1
- package/dist/chunks/{select-B6a8A7js.js → select-BwMqXSzv.js} +2 -2
- package/dist/chunks/{select-B6a8A7js.js.map → select-BwMqXSzv.js.map} +1 -1
- package/dist/chunks/{select-CFefk2Xz.js → select-DGSPwoy8.js} +2 -2
- package/dist/chunks/{select-CFefk2Xz.js.map → select-DGSPwoy8.js.map} +1 -1
- package/dist/chunks/{textarea-BPsle-xc.js → textarea-BYbersWf.js} +32 -31
- package/dist/chunks/{textarea-BPsle-xc.js.map → textarea-BYbersWf.js.map} +1 -1
- package/dist/chunks/{textarea-C2i9A3jn.js → textarea-D9X4fUkV.js} +12 -12
- package/dist/chunks/{textarea-C2i9A3jn.js.map → textarea-D9X4fUkV.js.map} +1 -1
- package/dist/modal/index.cjs.js +1 -1
- package/dist/modal/index.cjs.js.map +1 -1
- package/dist/modal/index.es.js +15 -14
- package/dist/modal/index.es.js.map +1 -1
- package/dist/pagination/index.cjs.js +1 -1
- package/dist/pagination/index.es.js +3 -3
- package/dist/phone-input/index.cjs.js +1 -1
- package/dist/phone-input/index.cjs.js.map +1 -1
- package/dist/phone-input/index.es.js +62 -61
- package/dist/phone-input/index.es.js.map +1 -1
- package/dist/ripple/index.cjs.js +1 -1
- package/dist/ripple/index.es.js +1 -1
- package/dist/table/index.cjs.js +1 -1
- package/dist/table/index.cjs.js.map +1 -1
- package/dist/table/index.es.js +11 -11
- package/dist/table/index.es.js.map +1 -1
- package/dist/time-input/index.cjs.js +1 -1
- package/dist/time-input/index.es.js +2 -2
- package/dist/ui/index.cjs.js +1 -1
- package/dist/ui/index.es.js +7 -7
- package/package.json +1 -1
- package/dist/chunks/ripple-DMI95LHg.js +0 -68
- package/dist/chunks/ripple-DieNd7XQ.js +0 -2
|
@@ -0,0 +1,1346 @@
|
|
|
1
|
+
import { aw as L, bu as tt, a as ce, aR as v, bs as E, br as S, aA as ue, bv as Ft, y as de, bq as U, C as fe, B as me, z as J, p as Nt, d as y, bw as O, bx as pe, by as ge, bz as ye, bA as et, bB as Wt, bg as G, q as ve, bC as $t, x as w, bi as Gt, b5 as it, S as Pe, h as xe, at as zt, bp as Te, aZ as Ht, l as Xt, n as Yt, au as qt, L as De, bD as st, A as Ee, a2 as Se, bt as z, bE as V, bF as F, bG as N, bH as nt, bI as Re, bJ as Ae, bK as Le, bL as j, r as H, bM as ot, bN as Ce, bO as Be, b as Ve, bP as je, bQ as we } from "./features-animation-BRAvwYFN.js";
|
|
2
|
+
import { j as be } from "./jsx-runtime-Cl_4eDuT.js";
|
|
3
|
+
import { useContext as at, Component as Me } from "react";
|
|
4
|
+
import { c as ke, a as Ie, b as Ue } from "./index-DC9BfnBH.js";
|
|
5
|
+
function Oe(t) {
|
|
6
|
+
return t === "x" || t === "y" ? L[t] ? null : (L[t] = !0, () => {
|
|
7
|
+
L[t] = !1;
|
|
8
|
+
}) : L.x || L.y ? null : (L.x = L.y = !0, () => {
|
|
9
|
+
L.x = L.y = !1;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function _t(t) {
|
|
13
|
+
return ke(t) && "ownerSVGElement" in t;
|
|
14
|
+
}
|
|
15
|
+
function Fe(t) {
|
|
16
|
+
return _t(t) && t.tagName === "svg";
|
|
17
|
+
}
|
|
18
|
+
function M(t, e, s, n) {
|
|
19
|
+
return tt(t, e, ce(s), n);
|
|
20
|
+
}
|
|
21
|
+
const Zt = 1e-4, Ne = 1 - Zt, We = 1 + Zt, Kt = 0.01, $e = 0 - Kt, Ge = 0 + Kt;
|
|
22
|
+
function D(t) {
|
|
23
|
+
return t.max - t.min;
|
|
24
|
+
}
|
|
25
|
+
function ze(t, e, s) {
|
|
26
|
+
return Math.abs(t - e) <= s;
|
|
27
|
+
}
|
|
28
|
+
function rt(t, e, s, n = 0.5) {
|
|
29
|
+
t.origin = n, t.originPoint = v(e.min, e.max, t.origin), t.scale = D(s) / D(e), t.translate = v(s.min, s.max, t.origin) - t.originPoint, (t.scale >= Ne && t.scale <= We || isNaN(t.scale)) && (t.scale = 1), (t.translate >= $e && t.translate <= Ge || isNaN(t.translate)) && (t.translate = 0);
|
|
30
|
+
}
|
|
31
|
+
function k(t, e, s, n) {
|
|
32
|
+
rt(t.x, e.x, s.x, n ? n.originX : void 0), rt(t.y, e.y, s.y, n ? n.originY : void 0);
|
|
33
|
+
}
|
|
34
|
+
function lt(t, e, s) {
|
|
35
|
+
t.min = s.min + e.min, t.max = t.min + D(e);
|
|
36
|
+
}
|
|
37
|
+
function He(t, e, s) {
|
|
38
|
+
lt(t.x, e.x, s.x), lt(t.y, e.y, s.y);
|
|
39
|
+
}
|
|
40
|
+
function ht(t, e, s) {
|
|
41
|
+
t.min = e.min - s.min, t.max = t.min + D(e);
|
|
42
|
+
}
|
|
43
|
+
function I(t, e, s) {
|
|
44
|
+
ht(t.x, e.x, s.x), ht(t.y, e.y, s.y);
|
|
45
|
+
}
|
|
46
|
+
function A(t) {
|
|
47
|
+
return [t("x"), t("y")];
|
|
48
|
+
}
|
|
49
|
+
const Jt = ({ current: t }) => t ? t.ownerDocument.defaultView : null, ct = (t, e) => Math.abs(t - e);
|
|
50
|
+
function Xe(t, e) {
|
|
51
|
+
const s = ct(t.x, e.x), n = ct(t.y, e.y);
|
|
52
|
+
return Math.sqrt(s ** 2 + n ** 2);
|
|
53
|
+
}
|
|
54
|
+
class Qt {
|
|
55
|
+
constructor(e, s, { transformPagePoint: n, contextWindow: r = window, dragSnapToOrigin: c = !1, distanceThreshold: i = 3 } = {}) {
|
|
56
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
|
|
57
|
+
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
58
|
+
return;
|
|
59
|
+
const d = Y(this.lastMoveEventInfo, this.history), f = this.startEvent !== null, m = Xe(d.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
|
|
60
|
+
if (!f && !m)
|
|
61
|
+
return;
|
|
62
|
+
const { point: P } = d, { timestamp: g } = E;
|
|
63
|
+
this.history.push({ ...P, timestamp: g });
|
|
64
|
+
const { onStart: p, onMove: x } = this.handlers;
|
|
65
|
+
f || (p && p(this.lastMoveEvent, d), this.startEvent = this.lastMoveEvent), x && x(this.lastMoveEvent, d);
|
|
66
|
+
}, this.handlePointerMove = (d, f) => {
|
|
67
|
+
this.lastMoveEvent = d, this.lastMoveEventInfo = X(f, this.transformPagePoint), S.update(this.updatePoint, !0);
|
|
68
|
+
}, this.handlePointerUp = (d, f) => {
|
|
69
|
+
this.end();
|
|
70
|
+
const { onEnd: m, onSessionEnd: P, resumeAnimation: g } = this.handlers;
|
|
71
|
+
if (this.dragSnapToOrigin && g && g(), !(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
72
|
+
return;
|
|
73
|
+
const p = Y(d.type === "pointercancel" ? this.lastMoveEventInfo : X(f, this.transformPagePoint), this.history);
|
|
74
|
+
this.startEvent && m && m(d, p), P && P(d, p);
|
|
75
|
+
}, !ue(e))
|
|
76
|
+
return;
|
|
77
|
+
this.dragSnapToOrigin = c, this.handlers = s, this.transformPagePoint = n, this.distanceThreshold = i, this.contextWindow = r || window;
|
|
78
|
+
const o = Ft(e), a = X(o, this.transformPagePoint), { point: l } = a, { timestamp: h } = E;
|
|
79
|
+
this.history = [{ ...l, timestamp: h }];
|
|
80
|
+
const { onSessionStart: u } = s;
|
|
81
|
+
u && u(e, Y(a, this.history)), this.removeListeners = de(M(this.contextWindow, "pointermove", this.handlePointerMove), M(this.contextWindow, "pointerup", this.handlePointerUp), M(this.contextWindow, "pointercancel", this.handlePointerUp));
|
|
82
|
+
}
|
|
83
|
+
updateHandlers(e) {
|
|
84
|
+
this.handlers = e;
|
|
85
|
+
}
|
|
86
|
+
end() {
|
|
87
|
+
this.removeListeners && this.removeListeners(), U(this.updatePoint);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function X(t, e) {
|
|
91
|
+
return e ? { point: e(t.point) } : t;
|
|
92
|
+
}
|
|
93
|
+
function ut(t, e) {
|
|
94
|
+
return { x: t.x - e.x, y: t.y - e.y };
|
|
95
|
+
}
|
|
96
|
+
function Y({ point: t }, e) {
|
|
97
|
+
return {
|
|
98
|
+
point: t,
|
|
99
|
+
delta: ut(t, te(e)),
|
|
100
|
+
offset: ut(t, Ye(e)),
|
|
101
|
+
velocity: qe(e, 0.1)
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function Ye(t) {
|
|
105
|
+
return t[0];
|
|
106
|
+
}
|
|
107
|
+
function te(t) {
|
|
108
|
+
return t[t.length - 1];
|
|
109
|
+
}
|
|
110
|
+
function qe(t, e) {
|
|
111
|
+
if (t.length < 2)
|
|
112
|
+
return { x: 0, y: 0 };
|
|
113
|
+
let s = t.length - 1, n = null;
|
|
114
|
+
const r = te(t);
|
|
115
|
+
for (; s >= 0 && (n = t[s], !(r.timestamp - n.timestamp > fe(e))); )
|
|
116
|
+
s--;
|
|
117
|
+
if (!n)
|
|
118
|
+
return { x: 0, y: 0 };
|
|
119
|
+
const c = me(r.timestamp - n.timestamp);
|
|
120
|
+
if (c === 0)
|
|
121
|
+
return { x: 0, y: 0 };
|
|
122
|
+
const i = {
|
|
123
|
+
x: (r.x - n.x) / c,
|
|
124
|
+
y: (r.y - n.y) / c
|
|
125
|
+
};
|
|
126
|
+
return i.x === 1 / 0 && (i.x = 0), i.y === 1 / 0 && (i.y = 0), i;
|
|
127
|
+
}
|
|
128
|
+
function _e(t, { min: e, max: s }, n) {
|
|
129
|
+
return e !== void 0 && t < e ? t = n ? v(e, t, n.min) : Math.max(t, e) : s !== void 0 && t > s && (t = n ? v(s, t, n.max) : Math.min(t, s)), t;
|
|
130
|
+
}
|
|
131
|
+
function dt(t, e, s) {
|
|
132
|
+
return {
|
|
133
|
+
min: e !== void 0 ? t.min + e : void 0,
|
|
134
|
+
max: s !== void 0 ? t.max + s - (t.max - t.min) : void 0
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function Ze(t, { top: e, left: s, bottom: n, right: r }) {
|
|
138
|
+
return {
|
|
139
|
+
x: dt(t.x, s, r),
|
|
140
|
+
y: dt(t.y, e, n)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function ft(t, e) {
|
|
144
|
+
let s = e.min - t.min, n = e.max - t.max;
|
|
145
|
+
return e.max - e.min < t.max - t.min && ([s, n] = [n, s]), { min: s, max: n };
|
|
146
|
+
}
|
|
147
|
+
function Ke(t, e) {
|
|
148
|
+
return {
|
|
149
|
+
x: ft(t.x, e.x),
|
|
150
|
+
y: ft(t.y, e.y)
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function Je(t, e) {
|
|
154
|
+
let s = 0.5;
|
|
155
|
+
const n = D(t), r = D(e);
|
|
156
|
+
return r > n ? s = J(e.min, e.max - n, t.min) : n > r && (s = J(t.min, t.max - r, e.min)), Nt(0, 1, s);
|
|
157
|
+
}
|
|
158
|
+
function Qe(t, e) {
|
|
159
|
+
const s = {};
|
|
160
|
+
return e.min !== void 0 && (s.min = e.min - t.min), e.max !== void 0 && (s.max = e.max - t.min), s;
|
|
161
|
+
}
|
|
162
|
+
const Q = 0.35;
|
|
163
|
+
function ti(t = Q) {
|
|
164
|
+
return t === !1 ? t = 0 : t === !0 && (t = Q), {
|
|
165
|
+
x: mt(t, "left", "right"),
|
|
166
|
+
y: mt(t, "top", "bottom")
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function mt(t, e, s) {
|
|
170
|
+
return {
|
|
171
|
+
min: pt(t, e),
|
|
172
|
+
max: pt(t, s)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function pt(t, e) {
|
|
176
|
+
return typeof t == "number" ? t : t[e] || 0;
|
|
177
|
+
}
|
|
178
|
+
const ei = /* @__PURE__ */ new WeakMap();
|
|
179
|
+
class ii {
|
|
180
|
+
constructor(e) {
|
|
181
|
+
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = y(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
|
|
182
|
+
}
|
|
183
|
+
start(e, { snapToCursor: s = !1, distanceThreshold: n } = {}) {
|
|
184
|
+
const { presenceContext: r } = this.visualElement;
|
|
185
|
+
if (r && r.isPresent === !1)
|
|
186
|
+
return;
|
|
187
|
+
const c = (u) => {
|
|
188
|
+
const { dragSnapToOrigin: d } = this.getProps();
|
|
189
|
+
d ? this.pauseAnimation() : this.stopAnimation(), s && this.snapToCursor(Ft(u).point);
|
|
190
|
+
}, i = (u, d) => {
|
|
191
|
+
const { drag: f, dragPropagation: m, onDragStart: P } = this.getProps();
|
|
192
|
+
if (f && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = Oe(f), !this.openDragLock))
|
|
193
|
+
return;
|
|
194
|
+
this.latestPointerEvent = u, this.latestPanInfo = d, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), A((p) => {
|
|
195
|
+
let x = this.getAxisMotionValue(p).get() || 0;
|
|
196
|
+
if (G.test(x)) {
|
|
197
|
+
const { projection: T } = this.visualElement;
|
|
198
|
+
if (T && T.layout) {
|
|
199
|
+
const C = T.layout.layoutBox[p];
|
|
200
|
+
C && (x = D(C) * (parseFloat(x) / 100));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
this.originPoint[p] = x;
|
|
204
|
+
}), P && S.postRender(() => P(u, d)), et(this.visualElement, "transform");
|
|
205
|
+
const { animationState: g } = this.visualElement;
|
|
206
|
+
g && g.setActive("whileDrag", !0);
|
|
207
|
+
}, o = (u, d) => {
|
|
208
|
+
this.latestPointerEvent = u, this.latestPanInfo = d;
|
|
209
|
+
const { dragPropagation: f, dragDirectionLock: m, onDirectionLock: P, onDrag: g } = this.getProps();
|
|
210
|
+
if (!f && !this.openDragLock)
|
|
211
|
+
return;
|
|
212
|
+
const { offset: p } = d;
|
|
213
|
+
if (m && this.currentDirection === null) {
|
|
214
|
+
this.currentDirection = si(p), this.currentDirection !== null && P && P(this.currentDirection);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
this.updateAxis("x", d.point, p), this.updateAxis("y", d.point, p), this.visualElement.render(), g && g(u, d);
|
|
218
|
+
}, a = (u, d) => {
|
|
219
|
+
this.latestPointerEvent = u, this.latestPanInfo = d, this.stop(u, d), this.latestPointerEvent = null, this.latestPanInfo = null;
|
|
220
|
+
}, l = () => A((u) => this.getAnimationState(u) === "paused" && this.getAxisMotionValue(u).animation?.play()), { dragSnapToOrigin: h } = this.getProps();
|
|
221
|
+
this.panSession = new Qt(e, {
|
|
222
|
+
onSessionStart: c,
|
|
223
|
+
onStart: i,
|
|
224
|
+
onMove: o,
|
|
225
|
+
onSessionEnd: a,
|
|
226
|
+
resumeAnimation: l
|
|
227
|
+
}, {
|
|
228
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
229
|
+
dragSnapToOrigin: h,
|
|
230
|
+
distanceThreshold: n,
|
|
231
|
+
contextWindow: Jt(this.visualElement)
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
stop(e, s) {
|
|
238
|
+
const n = e || this.latestPointerEvent, r = s || this.latestPanInfo, c = this.isDragging;
|
|
239
|
+
if (this.cancel(), !c || !r || !n)
|
|
240
|
+
return;
|
|
241
|
+
const { velocity: i } = r;
|
|
242
|
+
this.startAnimation(i);
|
|
243
|
+
const { onDragEnd: o } = this.getProps();
|
|
244
|
+
o && S.postRender(() => o(n, r));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @internal
|
|
248
|
+
*/
|
|
249
|
+
cancel() {
|
|
250
|
+
this.isDragging = !1;
|
|
251
|
+
const { projection: e, animationState: s } = this.visualElement;
|
|
252
|
+
e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
253
|
+
const { dragPropagation: n } = this.getProps();
|
|
254
|
+
!n && this.openDragLock && (this.openDragLock(), this.openDragLock = null), s && s.setActive("whileDrag", !1);
|
|
255
|
+
}
|
|
256
|
+
updateAxis(e, s, n) {
|
|
257
|
+
const { drag: r } = this.getProps();
|
|
258
|
+
if (!n || !W(e, r, this.currentDirection))
|
|
259
|
+
return;
|
|
260
|
+
const c = this.getAxisMotionValue(e);
|
|
261
|
+
let i = this.originPoint[e] + n[e];
|
|
262
|
+
this.constraints && this.constraints[e] && (i = _e(i, this.constraints[e], this.elastic[e])), c.set(i);
|
|
263
|
+
}
|
|
264
|
+
resolveConstraints() {
|
|
265
|
+
const { dragConstraints: e, dragElastic: s } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, r = this.constraints;
|
|
266
|
+
e && O(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && n ? this.constraints = Ze(n.layoutBox, e) : this.constraints = !1, this.elastic = ti(s), r !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && A((c) => {
|
|
267
|
+
this.constraints !== !1 && this.getAxisMotionValue(c) && (this.constraints[c] = Qe(n.layoutBox[c], this.constraints[c]));
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
resolveRefConstraints() {
|
|
271
|
+
const { dragConstraints: e, onMeasureDragConstraints: s } = this.getProps();
|
|
272
|
+
if (!e || !O(e))
|
|
273
|
+
return !1;
|
|
274
|
+
const n = e.current;
|
|
275
|
+
ve(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
276
|
+
const { projection: r } = this.visualElement;
|
|
277
|
+
if (!r || !r.layout)
|
|
278
|
+
return !1;
|
|
279
|
+
const c = pe(n, r.root, this.visualElement.getTransformPagePoint());
|
|
280
|
+
let i = Ke(r.layout.layoutBox, c);
|
|
281
|
+
if (s) {
|
|
282
|
+
const o = s(ge(i));
|
|
283
|
+
this.hasMutatedConstraints = !!o, o && (i = ye(o));
|
|
284
|
+
}
|
|
285
|
+
return i;
|
|
286
|
+
}
|
|
287
|
+
startAnimation(e) {
|
|
288
|
+
const { drag: s, dragMomentum: n, dragElastic: r, dragTransition: c, dragSnapToOrigin: i, onDragTransitionEnd: o } = this.getProps(), a = this.constraints || {}, l = A((h) => {
|
|
289
|
+
if (!W(h, s, this.currentDirection))
|
|
290
|
+
return;
|
|
291
|
+
let u = a && a[h] || {};
|
|
292
|
+
i && (u = { min: 0, max: 0 });
|
|
293
|
+
const d = r ? 200 : 1e6, f = r ? 40 : 1e7, m = {
|
|
294
|
+
type: "inertia",
|
|
295
|
+
velocity: n ? e[h] : 0,
|
|
296
|
+
bounceStiffness: d,
|
|
297
|
+
bounceDamping: f,
|
|
298
|
+
timeConstant: 750,
|
|
299
|
+
restDelta: 1,
|
|
300
|
+
restSpeed: 10,
|
|
301
|
+
...c,
|
|
302
|
+
...u
|
|
303
|
+
};
|
|
304
|
+
return this.startAxisValueAnimation(h, m);
|
|
305
|
+
});
|
|
306
|
+
return Promise.all(l).then(o);
|
|
307
|
+
}
|
|
308
|
+
startAxisValueAnimation(e, s) {
|
|
309
|
+
const n = this.getAxisMotionValue(e);
|
|
310
|
+
return et(this.visualElement, e), n.start(Wt(e, n, 0, s, this.visualElement, !1));
|
|
311
|
+
}
|
|
312
|
+
stopAnimation() {
|
|
313
|
+
A((e) => this.getAxisMotionValue(e).stop());
|
|
314
|
+
}
|
|
315
|
+
pauseAnimation() {
|
|
316
|
+
A((e) => this.getAxisMotionValue(e).animation?.pause());
|
|
317
|
+
}
|
|
318
|
+
getAnimationState(e) {
|
|
319
|
+
return this.getAxisMotionValue(e).animation?.state;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Drag works differently depending on which props are provided.
|
|
323
|
+
*
|
|
324
|
+
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
|
325
|
+
* - Otherwise, we apply the delta to the x/y motion values.
|
|
326
|
+
*/
|
|
327
|
+
getAxisMotionValue(e) {
|
|
328
|
+
const s = `_drag${e.toUpperCase()}`, n = this.visualElement.getProps(), r = n[s];
|
|
329
|
+
return r || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0);
|
|
330
|
+
}
|
|
331
|
+
snapToCursor(e) {
|
|
332
|
+
A((s) => {
|
|
333
|
+
const { drag: n } = this.getProps();
|
|
334
|
+
if (!W(s, n, this.currentDirection))
|
|
335
|
+
return;
|
|
336
|
+
const { projection: r } = this.visualElement, c = this.getAxisMotionValue(s);
|
|
337
|
+
if (r && r.layout) {
|
|
338
|
+
const { min: i, max: o } = r.layout.layoutBox[s];
|
|
339
|
+
c.set(e[s] - v(i, o, 0.5));
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* When the viewport resizes we want to check if the measured constraints
|
|
345
|
+
* have changed and, if so, reposition the element within those new constraints
|
|
346
|
+
* relative to where it was before the resize.
|
|
347
|
+
*/
|
|
348
|
+
scalePositionWithinConstraints() {
|
|
349
|
+
if (!this.visualElement.current)
|
|
350
|
+
return;
|
|
351
|
+
const { drag: e, dragConstraints: s } = this.getProps(), { projection: n } = this.visualElement;
|
|
352
|
+
if (!O(s) || !n || !this.constraints)
|
|
353
|
+
return;
|
|
354
|
+
this.stopAnimation();
|
|
355
|
+
const r = { x: 0, y: 0 };
|
|
356
|
+
A((i) => {
|
|
357
|
+
const o = this.getAxisMotionValue(i);
|
|
358
|
+
if (o && this.constraints !== !1) {
|
|
359
|
+
const a = o.get();
|
|
360
|
+
r[i] = Je({ min: a, max: a }, this.constraints[i]);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
const { transformTemplate: c } = this.visualElement.getProps();
|
|
364
|
+
this.visualElement.current.style.transform = c ? c({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), A((i) => {
|
|
365
|
+
if (!W(i, e, null))
|
|
366
|
+
return;
|
|
367
|
+
const o = this.getAxisMotionValue(i), { min: a, max: l } = this.constraints[i];
|
|
368
|
+
o.set(v(a, l, r[i]));
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
addListeners() {
|
|
372
|
+
if (!this.visualElement.current)
|
|
373
|
+
return;
|
|
374
|
+
ei.set(this.visualElement, this);
|
|
375
|
+
const e = this.visualElement.current, s = M(e, "pointerdown", (a) => {
|
|
376
|
+
const { drag: l, dragListener: h = !0 } = this.getProps();
|
|
377
|
+
l && h && this.start(a);
|
|
378
|
+
}), n = () => {
|
|
379
|
+
const { dragConstraints: a } = this.getProps();
|
|
380
|
+
O(a) && a.current && (this.constraints = this.resolveRefConstraints());
|
|
381
|
+
}, { projection: r } = this.visualElement, c = r.addEventListener("measure", n);
|
|
382
|
+
r && !r.layout && (r.root && r.root.updateScroll(), r.updateLayout()), S.read(n);
|
|
383
|
+
const i = tt(window, "resize", () => this.scalePositionWithinConstraints()), o = r.addEventListener("didUpdate", (({ delta: a, hasLayoutChanged: l }) => {
|
|
384
|
+
this.isDragging && l && (A((h) => {
|
|
385
|
+
const u = this.getAxisMotionValue(h);
|
|
386
|
+
u && (this.originPoint[h] += a[h].translate, u.set(u.get() + a[h].translate));
|
|
387
|
+
}), this.visualElement.render());
|
|
388
|
+
}));
|
|
389
|
+
return () => {
|
|
390
|
+
i(), s(), c(), o && o();
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
getProps() {
|
|
394
|
+
const e = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: n = !1, dragPropagation: r = !1, dragConstraints: c = !1, dragElastic: i = Q, dragMomentum: o = !0 } = e;
|
|
395
|
+
return {
|
|
396
|
+
...e,
|
|
397
|
+
drag: s,
|
|
398
|
+
dragDirectionLock: n,
|
|
399
|
+
dragPropagation: r,
|
|
400
|
+
dragConstraints: c,
|
|
401
|
+
dragElastic: i,
|
|
402
|
+
dragMomentum: o
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function W(t, e, s) {
|
|
407
|
+
return (e === !0 || e === t) && (s === null || s === t);
|
|
408
|
+
}
|
|
409
|
+
function si(t, e = 10) {
|
|
410
|
+
let s = null;
|
|
411
|
+
return Math.abs(t.y) > e ? s = "y" : Math.abs(t.x) > e && (s = "x"), s;
|
|
412
|
+
}
|
|
413
|
+
class ni extends $t {
|
|
414
|
+
constructor(e) {
|
|
415
|
+
super(e), this.removeGroupControls = w, this.removeListeners = w, this.controls = new ii(e);
|
|
416
|
+
}
|
|
417
|
+
mount() {
|
|
418
|
+
const { dragControls: e } = this.node.getProps();
|
|
419
|
+
e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || w;
|
|
420
|
+
}
|
|
421
|
+
unmount() {
|
|
422
|
+
this.removeGroupControls(), this.removeListeners();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const gt = (t) => (e, s) => {
|
|
426
|
+
t && S.postRender(() => t(e, s));
|
|
427
|
+
};
|
|
428
|
+
class oi extends $t {
|
|
429
|
+
constructor() {
|
|
430
|
+
super(...arguments), this.removePointerDownListener = w;
|
|
431
|
+
}
|
|
432
|
+
onPointerDown(e) {
|
|
433
|
+
this.session = new Qt(e, this.createPanHandlers(), {
|
|
434
|
+
transformPagePoint: this.node.getTransformPagePoint(),
|
|
435
|
+
contextWindow: Jt(this.node)
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
createPanHandlers() {
|
|
439
|
+
const { onPanSessionStart: e, onPanStart: s, onPan: n, onPanEnd: r } = this.node.getProps();
|
|
440
|
+
return {
|
|
441
|
+
onSessionStart: gt(e),
|
|
442
|
+
onStart: gt(s),
|
|
443
|
+
onMove: n,
|
|
444
|
+
onEnd: (c, i) => {
|
|
445
|
+
delete this.session, r && S.postRender(() => r(c, i));
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
mount() {
|
|
450
|
+
this.removePointerDownListener = M(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
|
|
451
|
+
}
|
|
452
|
+
update() {
|
|
453
|
+
this.session && this.session.updateHandlers(this.createPanHandlers());
|
|
454
|
+
}
|
|
455
|
+
unmount() {
|
|
456
|
+
this.removePointerDownListener(), this.session && this.session.end();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
const $ = {
|
|
460
|
+
/**
|
|
461
|
+
* Global flag as to whether the tree has animated since the last time
|
|
462
|
+
* we resized the window
|
|
463
|
+
*/
|
|
464
|
+
hasAnimatedSinceResize: !0,
|
|
465
|
+
/**
|
|
466
|
+
* We set this to true once, on the first update. Any nodes added to the tree beyond that
|
|
467
|
+
* update will be given a `data-projection-id` attribute.
|
|
468
|
+
*/
|
|
469
|
+
hasEverUpdated: !1
|
|
470
|
+
};
|
|
471
|
+
function yt(t, e) {
|
|
472
|
+
return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
|
|
473
|
+
}
|
|
474
|
+
const b = {
|
|
475
|
+
correct: (t, e) => {
|
|
476
|
+
if (!e.target)
|
|
477
|
+
return t;
|
|
478
|
+
if (typeof t == "string")
|
|
479
|
+
if (Gt.test(t))
|
|
480
|
+
t = parseFloat(t);
|
|
481
|
+
else
|
|
482
|
+
return t;
|
|
483
|
+
const s = yt(t, e.target.x), n = yt(t, e.target.y);
|
|
484
|
+
return `${s}% ${n}%`;
|
|
485
|
+
}
|
|
486
|
+
}, ai = {
|
|
487
|
+
correct: (t, { treeScale: e, projectionDelta: s }) => {
|
|
488
|
+
const n = t, r = it.parse(t);
|
|
489
|
+
if (r.length > 5)
|
|
490
|
+
return n;
|
|
491
|
+
const c = it.createTransformer(t), i = typeof r[0] != "number" ? 1 : 0, o = s.x.scale * e.x, a = s.y.scale * e.y;
|
|
492
|
+
r[0 + i] /= o, r[1 + i] /= a;
|
|
493
|
+
const l = v(o, a, 0.5);
|
|
494
|
+
return typeof r[2 + i] == "number" && (r[2 + i] /= l), typeof r[3 + i] == "number" && (r[3 + i] /= l), c(r);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
let q = !1;
|
|
498
|
+
class ri extends Me {
|
|
499
|
+
/**
|
|
500
|
+
* This only mounts projection nodes for components that
|
|
501
|
+
* need measuring, we might want to do it for all components
|
|
502
|
+
* in order to incorporate transforms
|
|
503
|
+
*/
|
|
504
|
+
componentDidMount() {
|
|
505
|
+
const { visualElement: e, layoutGroup: s, switchLayoutGroup: n, layoutId: r } = this.props, { projection: c } = e;
|
|
506
|
+
xe(li), c && (s.group && s.group.add(c), n && n.register && r && n.register(c), q && c.root.didUpdate(), c.addEventListener("animationComplete", () => {
|
|
507
|
+
this.safeToRemove();
|
|
508
|
+
}), c.setOptions({
|
|
509
|
+
...c.options,
|
|
510
|
+
onExitComplete: () => this.safeToRemove()
|
|
511
|
+
})), $.hasEverUpdated = !0;
|
|
512
|
+
}
|
|
513
|
+
getSnapshotBeforeUpdate(e) {
|
|
514
|
+
const { layoutDependency: s, visualElement: n, drag: r, isPresent: c } = this.props, { projection: i } = n;
|
|
515
|
+
return i && (i.isPresent = c, q = !0, r || e.layoutDependency !== s || s === void 0 || e.isPresent !== c ? i.willUpdate() : this.safeToRemove(), e.isPresent !== c && (c ? i.promote() : i.relegate() || S.postRender(() => {
|
|
516
|
+
const o = i.getStack();
|
|
517
|
+
(!o || !o.members.length) && this.safeToRemove();
|
|
518
|
+
}))), null;
|
|
519
|
+
}
|
|
520
|
+
componentDidUpdate() {
|
|
521
|
+
const { projection: e } = this.props.visualElement;
|
|
522
|
+
e && (e.root.didUpdate(), zt.postRender(() => {
|
|
523
|
+
!e.currentAnimation && e.isLead() && this.safeToRemove();
|
|
524
|
+
}));
|
|
525
|
+
}
|
|
526
|
+
componentWillUnmount() {
|
|
527
|
+
const { visualElement: e, layoutGroup: s, switchLayoutGroup: n } = this.props, { projection: r } = e;
|
|
528
|
+
q = !0, r && (r.scheduleCheckAfterUnmount(), s && s.group && s.group.remove(r), n && n.deregister && n.deregister(r));
|
|
529
|
+
}
|
|
530
|
+
safeToRemove() {
|
|
531
|
+
const { safeToRemove: e } = this.props;
|
|
532
|
+
e && e();
|
|
533
|
+
}
|
|
534
|
+
render() {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
function ee(t) {
|
|
539
|
+
const [e, s] = Ie(), n = at(Ue);
|
|
540
|
+
return be.jsx(ri, { ...t, layoutGroup: n, switchLayoutGroup: at(Pe), isPresent: e, safeToRemove: s });
|
|
541
|
+
}
|
|
542
|
+
const li = {
|
|
543
|
+
borderRadius: {
|
|
544
|
+
...b,
|
|
545
|
+
applyTo: [
|
|
546
|
+
"borderTopLeftRadius",
|
|
547
|
+
"borderTopRightRadius",
|
|
548
|
+
"borderBottomLeftRadius",
|
|
549
|
+
"borderBottomRightRadius"
|
|
550
|
+
]
|
|
551
|
+
},
|
|
552
|
+
borderTopLeftRadius: b,
|
|
553
|
+
borderTopRightRadius: b,
|
|
554
|
+
borderBottomLeftRadius: b,
|
|
555
|
+
borderBottomRightRadius: b,
|
|
556
|
+
boxShadow: ai
|
|
557
|
+
};
|
|
558
|
+
function hi(t, e, s) {
|
|
559
|
+
const n = Te(t) ? t : Ht(t);
|
|
560
|
+
return n.start(Wt("", n, e, s)), n.animation;
|
|
561
|
+
}
|
|
562
|
+
const ci = (t, e) => t.depth - e.depth;
|
|
563
|
+
class ui {
|
|
564
|
+
constructor() {
|
|
565
|
+
this.children = [], this.isDirty = !1;
|
|
566
|
+
}
|
|
567
|
+
add(e) {
|
|
568
|
+
Xt(this.children, e), this.isDirty = !0;
|
|
569
|
+
}
|
|
570
|
+
remove(e) {
|
|
571
|
+
Yt(this.children, e), this.isDirty = !0;
|
|
572
|
+
}
|
|
573
|
+
forEach(e) {
|
|
574
|
+
this.isDirty && this.children.sort(ci), this.isDirty = !1, this.children.forEach(e);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function di(t, e) {
|
|
578
|
+
const s = qt.now(), n = ({ timestamp: r }) => {
|
|
579
|
+
const c = r - s;
|
|
580
|
+
c >= e && (U(n), t(c - e));
|
|
581
|
+
};
|
|
582
|
+
return S.setup(n, !0), () => U(n);
|
|
583
|
+
}
|
|
584
|
+
const ie = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], fi = ie.length, vt = (t) => typeof t == "string" ? parseFloat(t) : t, Pt = (t) => typeof t == "number" || Gt.test(t);
|
|
585
|
+
function mi(t, e, s, n, r, c) {
|
|
586
|
+
r ? (t.opacity = v(0, s.opacity ?? 1, pi(n)), t.opacityExit = v(e.opacity ?? 1, 0, gi(n))) : c && (t.opacity = v(e.opacity ?? 1, s.opacity ?? 1, n));
|
|
587
|
+
for (let i = 0; i < fi; i++) {
|
|
588
|
+
const o = `border${ie[i]}Radius`;
|
|
589
|
+
let a = xt(e, o), l = xt(s, o);
|
|
590
|
+
if (a === void 0 && l === void 0)
|
|
591
|
+
continue;
|
|
592
|
+
a || (a = 0), l || (l = 0), a === 0 || l === 0 || Pt(a) === Pt(l) ? (t[o] = Math.max(v(vt(a), vt(l), n), 0), (G.test(l) || G.test(a)) && (t[o] += "%")) : t[o] = l;
|
|
593
|
+
}
|
|
594
|
+
(e.rotate || s.rotate) && (t.rotate = v(e.rotate || 0, s.rotate || 0, n));
|
|
595
|
+
}
|
|
596
|
+
function xt(t, e) {
|
|
597
|
+
return t[e] !== void 0 ? t[e] : t.borderRadius;
|
|
598
|
+
}
|
|
599
|
+
const pi = /* @__PURE__ */ se(0, 0.5, De), gi = /* @__PURE__ */ se(0.5, 0.95, w);
|
|
600
|
+
function se(t, e, s) {
|
|
601
|
+
return (n) => n < t ? 0 : n > e ? 1 : s(J(t, e, n));
|
|
602
|
+
}
|
|
603
|
+
function Tt(t, e) {
|
|
604
|
+
t.min = e.min, t.max = e.max;
|
|
605
|
+
}
|
|
606
|
+
function R(t, e) {
|
|
607
|
+
Tt(t.x, e.x), Tt(t.y, e.y);
|
|
608
|
+
}
|
|
609
|
+
function Dt(t, e) {
|
|
610
|
+
t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
|
|
611
|
+
}
|
|
612
|
+
function Et(t, e, s, n, r) {
|
|
613
|
+
return t -= e, t = st(t, 1 / s, n), r !== void 0 && (t = st(t, 1 / r, n)), t;
|
|
614
|
+
}
|
|
615
|
+
function yi(t, e = 0, s = 1, n = 0.5, r, c = t, i = t) {
|
|
616
|
+
if (G.test(e) && (e = parseFloat(e), e = v(i.min, i.max, e / 100) - i.min), typeof e != "number")
|
|
617
|
+
return;
|
|
618
|
+
let o = v(c.min, c.max, n);
|
|
619
|
+
t === c && (o -= e), t.min = Et(t.min, e, s, o, r), t.max = Et(t.max, e, s, o, r);
|
|
620
|
+
}
|
|
621
|
+
function St(t, e, [s, n, r], c, i) {
|
|
622
|
+
yi(t, e[s], e[n], e[r], e.scale, c, i);
|
|
623
|
+
}
|
|
624
|
+
const vi = ["x", "scaleX", "originX"], Pi = ["y", "scaleY", "originY"];
|
|
625
|
+
function Rt(t, e, s, n) {
|
|
626
|
+
St(t.x, e, vi, s ? s.x : void 0, n ? n.x : void 0), St(t.y, e, Pi, s ? s.y : void 0, n ? n.y : void 0);
|
|
627
|
+
}
|
|
628
|
+
function At(t) {
|
|
629
|
+
return t.translate === 0 && t.scale === 1;
|
|
630
|
+
}
|
|
631
|
+
function ne(t) {
|
|
632
|
+
return At(t.x) && At(t.y);
|
|
633
|
+
}
|
|
634
|
+
function Lt(t, e) {
|
|
635
|
+
return t.min === e.min && t.max === e.max;
|
|
636
|
+
}
|
|
637
|
+
function xi(t, e) {
|
|
638
|
+
return Lt(t.x, e.x) && Lt(t.y, e.y);
|
|
639
|
+
}
|
|
640
|
+
function Ct(t, e) {
|
|
641
|
+
return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
|
|
642
|
+
}
|
|
643
|
+
function oe(t, e) {
|
|
644
|
+
return Ct(t.x, e.x) && Ct(t.y, e.y);
|
|
645
|
+
}
|
|
646
|
+
function Bt(t) {
|
|
647
|
+
return D(t.x) / D(t.y);
|
|
648
|
+
}
|
|
649
|
+
function Vt(t, e) {
|
|
650
|
+
return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
|
|
651
|
+
}
|
|
652
|
+
class Ti {
|
|
653
|
+
constructor() {
|
|
654
|
+
this.members = [];
|
|
655
|
+
}
|
|
656
|
+
add(e) {
|
|
657
|
+
Xt(this.members, e), e.scheduleRender();
|
|
658
|
+
}
|
|
659
|
+
remove(e) {
|
|
660
|
+
if (Yt(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
|
|
661
|
+
const s = this.members[this.members.length - 1];
|
|
662
|
+
s && this.promote(s);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
relegate(e) {
|
|
666
|
+
const s = this.members.findIndex((r) => e === r);
|
|
667
|
+
if (s === 0)
|
|
668
|
+
return !1;
|
|
669
|
+
let n;
|
|
670
|
+
for (let r = s; r >= 0; r--) {
|
|
671
|
+
const c = this.members[r];
|
|
672
|
+
if (c.isPresent !== !1) {
|
|
673
|
+
n = c;
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
return n ? (this.promote(n), !0) : !1;
|
|
678
|
+
}
|
|
679
|
+
promote(e, s) {
|
|
680
|
+
const n = this.lead;
|
|
681
|
+
if (e !== n && (this.prevLead = n, this.lead = e, e.show(), n)) {
|
|
682
|
+
n.instance && n.scheduleRender(), e.scheduleRender(), e.resumeFrom = n, s && (e.resumeFrom.preserveOpacity = !0), n.snapshot && (e.snapshot = n.snapshot, e.snapshot.latestValues = n.animationValues || n.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
|
|
683
|
+
const { crossfade: r } = e.options;
|
|
684
|
+
r === !1 && n.hide();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
exitAnimationComplete() {
|
|
688
|
+
this.members.forEach((e) => {
|
|
689
|
+
const { options: s, resumingFrom: n } = e;
|
|
690
|
+
s.onExitComplete && s.onExitComplete(), n && n.options.onExitComplete && n.options.onExitComplete();
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
scheduleRender() {
|
|
694
|
+
this.members.forEach((e) => {
|
|
695
|
+
e.instance && e.scheduleRender(!1);
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Clear any leads that have been removed this render to prevent them from being
|
|
700
|
+
* used in future animations and to prevent memory leaks
|
|
701
|
+
*/
|
|
702
|
+
removeLeadSnapshot() {
|
|
703
|
+
this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function Di(t, e, s) {
|
|
707
|
+
let n = "";
|
|
708
|
+
const r = t.x.translate / e.x, c = t.y.translate / e.y, i = s?.z || 0;
|
|
709
|
+
if ((r || c || i) && (n = `translate3d(${r}px, ${c}px, ${i}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), s) {
|
|
710
|
+
const { transformPerspective: l, rotate: h, rotateX: u, rotateY: d, skewX: f, skewY: m } = s;
|
|
711
|
+
l && (n = `perspective(${l}px) ${n}`), h && (n += `rotate(${h}deg) `), u && (n += `rotateX(${u}deg) `), d && (n += `rotateY(${d}deg) `), f && (n += `skewX(${f}deg) `), m && (n += `skewY(${m}deg) `);
|
|
712
|
+
}
|
|
713
|
+
const o = t.x.scale * e.x, a = t.y.scale * e.y;
|
|
714
|
+
return (o !== 1 || a !== 1) && (n += `scale(${o}, ${a})`), n || "none";
|
|
715
|
+
}
|
|
716
|
+
const _ = ["", "X", "Y", "Z"], Ei = 1e3;
|
|
717
|
+
let Si = 0;
|
|
718
|
+
function Z(t, e, s, n) {
|
|
719
|
+
const { latestValues: r } = e;
|
|
720
|
+
r[t] && (s[t] = r[t], e.setStaticValue(t, 0), n && (n[t] = 0));
|
|
721
|
+
}
|
|
722
|
+
function ae(t) {
|
|
723
|
+
if (t.hasCheckedOptimisedAppear = !0, t.root === t)
|
|
724
|
+
return;
|
|
725
|
+
const { visualElement: e } = t.options;
|
|
726
|
+
if (!e)
|
|
727
|
+
return;
|
|
728
|
+
const s = Ce(e);
|
|
729
|
+
if (window.MotionHasOptimisedAnimation(s, "transform")) {
|
|
730
|
+
const { layout: r, layoutId: c } = t.options;
|
|
731
|
+
window.MotionCancelOptimisedAnimation(s, "transform", S, !(r || c));
|
|
732
|
+
}
|
|
733
|
+
const { parent: n } = t;
|
|
734
|
+
n && !n.hasCheckedOptimisedAppear && ae(n);
|
|
735
|
+
}
|
|
736
|
+
function re({ attachResizeListener: t, defaultParent: e, measureScroll: s, checkIsScrollRoot: n, resetTransform: r }) {
|
|
737
|
+
return class {
|
|
738
|
+
constructor(i = {}, o = e?.()) {
|
|
739
|
+
this.id = Si++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
|
|
740
|
+
this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
|
|
741
|
+
}, this.updateProjection = () => {
|
|
742
|
+
this.projectionUpdateScheduled = !1, this.nodes.forEach(Li), this.nodes.forEach(ji), this.nodes.forEach(wi), this.nodes.forEach(Ci);
|
|
743
|
+
}, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = i, this.root = o ? o.root || o : this, this.path = o ? [...o.path, o] : [], this.parent = o, this.depth = o ? o.depth + 1 : 0;
|
|
744
|
+
for (let a = 0; a < this.path.length; a++)
|
|
745
|
+
this.path[a].shouldResetTransform = !0;
|
|
746
|
+
this.root === this && (this.nodes = new ui());
|
|
747
|
+
}
|
|
748
|
+
addEventListener(i, o) {
|
|
749
|
+
return this.eventHandlers.has(i) || this.eventHandlers.set(i, new Ee()), this.eventHandlers.get(i).add(o);
|
|
750
|
+
}
|
|
751
|
+
notifyListeners(i, ...o) {
|
|
752
|
+
const a = this.eventHandlers.get(i);
|
|
753
|
+
a && a.notify(...o);
|
|
754
|
+
}
|
|
755
|
+
hasListeners(i) {
|
|
756
|
+
return this.eventHandlers.has(i);
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Lifecycles
|
|
760
|
+
*/
|
|
761
|
+
mount(i) {
|
|
762
|
+
if (this.instance)
|
|
763
|
+
return;
|
|
764
|
+
this.isSVG = _t(i) && !Fe(i), this.instance = i;
|
|
765
|
+
const { layoutId: o, layout: a, visualElement: l } = this.options;
|
|
766
|
+
if (l && !l.current && l.mount(i), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (a || o) && (this.isLayoutDirty = !0), t) {
|
|
767
|
+
let h, u = 0;
|
|
768
|
+
const d = () => this.root.updateBlockedByResize = !1;
|
|
769
|
+
S.read(() => {
|
|
770
|
+
u = window.innerWidth;
|
|
771
|
+
}), t(i, () => {
|
|
772
|
+
const f = window.innerWidth;
|
|
773
|
+
f !== u && (u = f, this.root.updateBlockedByResize = !0, h && h(), h = di(d, 250), $.hasAnimatedSinceResize && ($.hasAnimatedSinceResize = !1, this.nodes.forEach(bt)));
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
o && this.root.registerSharedNode(o, this), this.options.animate !== !1 && l && (o || a) && this.addEventListener("didUpdate", ({ delta: h, hasLayoutChanged: u, hasRelativeLayoutChanged: d, layout: f }) => {
|
|
777
|
+
if (this.isTreeAnimationBlocked()) {
|
|
778
|
+
this.target = void 0, this.relativeTarget = void 0;
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
const m = this.options.transition || l.getDefaultTransition() || Ui, { onLayoutAnimationStart: P, onLayoutAnimationComplete: g } = l.getProps(), p = !this.targetLayout || !oe(this.targetLayout, f), x = !u && d;
|
|
782
|
+
if (this.options.layoutRoot || this.resumeFrom || x || u && (p || !this.currentAnimation)) {
|
|
783
|
+
this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
|
|
784
|
+
const T = {
|
|
785
|
+
...Se(m, "layout"),
|
|
786
|
+
onPlay: P,
|
|
787
|
+
onComplete: g
|
|
788
|
+
};
|
|
789
|
+
(l.shouldReduceMotion || this.options.layoutRoot) && (T.delay = 0, T.type = !1), this.startAnimation(T), this.setAnimationOrigin(h, x);
|
|
790
|
+
} else
|
|
791
|
+
u || bt(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
|
|
792
|
+
this.targetLayout = f;
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
unmount() {
|
|
796
|
+
this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
|
|
797
|
+
const i = this.getStack();
|
|
798
|
+
i && i.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), U(this.updateProjection);
|
|
799
|
+
}
|
|
800
|
+
// only on the root
|
|
801
|
+
blockUpdate() {
|
|
802
|
+
this.updateManuallyBlocked = !0;
|
|
803
|
+
}
|
|
804
|
+
unblockUpdate() {
|
|
805
|
+
this.updateManuallyBlocked = !1;
|
|
806
|
+
}
|
|
807
|
+
isUpdateBlocked() {
|
|
808
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
809
|
+
}
|
|
810
|
+
isTreeAnimationBlocked() {
|
|
811
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
|
|
812
|
+
}
|
|
813
|
+
// Note: currently only running on root node
|
|
814
|
+
startUpdate() {
|
|
815
|
+
this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(bi), this.animationId++);
|
|
816
|
+
}
|
|
817
|
+
getTransformTemplate() {
|
|
818
|
+
const { visualElement: i } = this.options;
|
|
819
|
+
return i && i.getProps().transformTemplate;
|
|
820
|
+
}
|
|
821
|
+
willUpdate(i = !0) {
|
|
822
|
+
if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
|
|
823
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && ae(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
|
|
827
|
+
return;
|
|
828
|
+
this.isLayoutDirty = !0;
|
|
829
|
+
for (let h = 0; h < this.path.length; h++) {
|
|
830
|
+
const u = this.path[h];
|
|
831
|
+
u.shouldResetTransform = !0, u.updateScroll("snapshot"), u.options.layoutRoot && u.willUpdate(!1);
|
|
832
|
+
}
|
|
833
|
+
const { layoutId: o, layout: a } = this.options;
|
|
834
|
+
if (o === void 0 && !a)
|
|
835
|
+
return;
|
|
836
|
+
const l = this.getTransformTemplate();
|
|
837
|
+
this.prevTransformTemplateValue = l ? l(this.latestValues, "") : void 0, this.updateSnapshot(), i && this.notifyListeners("willUpdate");
|
|
838
|
+
}
|
|
839
|
+
update() {
|
|
840
|
+
if (this.updateScheduled = !1, this.isUpdateBlocked()) {
|
|
841
|
+
this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(jt);
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
if (this.animationId <= this.animationCommitId) {
|
|
845
|
+
this.nodes.forEach(wt);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(Vi), this.nodes.forEach(Ri), this.nodes.forEach(Ai)) : this.nodes.forEach(wt), this.clearAllSnapshots();
|
|
849
|
+
const o = qt.now();
|
|
850
|
+
E.delta = Nt(0, 1e3 / 60, o - E.timestamp), E.timestamp = o, E.isProcessing = !0, z.update.process(E), z.preRender.process(E), z.render.process(E), E.isProcessing = !1;
|
|
851
|
+
}
|
|
852
|
+
didUpdate() {
|
|
853
|
+
this.updateScheduled || (this.updateScheduled = !0, zt.read(this.scheduleUpdate));
|
|
854
|
+
}
|
|
855
|
+
clearAllSnapshots() {
|
|
856
|
+
this.nodes.forEach(Bi), this.sharedNodes.forEach(Mi);
|
|
857
|
+
}
|
|
858
|
+
scheduleUpdateProjection() {
|
|
859
|
+
this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, S.preRender(this.updateProjection, !1, !0));
|
|
860
|
+
}
|
|
861
|
+
scheduleCheckAfterUnmount() {
|
|
862
|
+
S.postRender(() => {
|
|
863
|
+
this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Update measurements
|
|
868
|
+
*/
|
|
869
|
+
updateSnapshot() {
|
|
870
|
+
this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !D(this.snapshot.measuredBox.x) && !D(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
|
|
871
|
+
}
|
|
872
|
+
updateLayout() {
|
|
873
|
+
if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
|
|
874
|
+
return;
|
|
875
|
+
if (this.resumeFrom && !this.resumeFrom.instance)
|
|
876
|
+
for (let a = 0; a < this.path.length; a++)
|
|
877
|
+
this.path[a].updateScroll();
|
|
878
|
+
const i = this.layout;
|
|
879
|
+
this.layout = this.measure(!1), this.layoutCorrected = y(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
|
|
880
|
+
const { visualElement: o } = this.options;
|
|
881
|
+
o && o.notify("LayoutMeasure", this.layout.layoutBox, i ? i.layoutBox : void 0);
|
|
882
|
+
}
|
|
883
|
+
updateScroll(i = "measure") {
|
|
884
|
+
let o = !!(this.options.layoutScroll && this.instance);
|
|
885
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === i && (o = !1), o && this.instance) {
|
|
886
|
+
const a = n(this.instance);
|
|
887
|
+
this.scroll = {
|
|
888
|
+
animationId: this.root.animationId,
|
|
889
|
+
phase: i,
|
|
890
|
+
isRoot: a,
|
|
891
|
+
offset: s(this.instance),
|
|
892
|
+
wasRoot: this.scroll ? this.scroll.isRoot : a
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
resetTransform() {
|
|
897
|
+
if (!r)
|
|
898
|
+
return;
|
|
899
|
+
const i = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, o = this.projectionDelta && !ne(this.projectionDelta), a = this.getTransformTemplate(), l = a ? a(this.latestValues, "") : void 0, h = l !== this.prevTransformTemplateValue;
|
|
900
|
+
i && this.instance && (o || V(this.latestValues) || h) && (r(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender());
|
|
901
|
+
}
|
|
902
|
+
measure(i = !0) {
|
|
903
|
+
const o = this.measurePageBox();
|
|
904
|
+
let a = this.removeElementScroll(o);
|
|
905
|
+
return i && (a = this.removeTransform(a)), Oi(a), {
|
|
906
|
+
animationId: this.root.animationId,
|
|
907
|
+
measuredBox: o,
|
|
908
|
+
layoutBox: a,
|
|
909
|
+
latestValues: {},
|
|
910
|
+
source: this.id
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
measurePageBox() {
|
|
914
|
+
const { visualElement: i } = this.options;
|
|
915
|
+
if (!i)
|
|
916
|
+
return y();
|
|
917
|
+
const o = i.measureViewportBox();
|
|
918
|
+
if (!(this.scroll?.wasRoot || this.path.some(Fi))) {
|
|
919
|
+
const { scroll: l } = this.root;
|
|
920
|
+
l && (F(o.x, l.offset.x), F(o.y, l.offset.y));
|
|
921
|
+
}
|
|
922
|
+
return o;
|
|
923
|
+
}
|
|
924
|
+
removeElementScroll(i) {
|
|
925
|
+
const o = y();
|
|
926
|
+
if (R(o, i), this.scroll?.wasRoot)
|
|
927
|
+
return o;
|
|
928
|
+
for (let a = 0; a < this.path.length; a++) {
|
|
929
|
+
const l = this.path[a], { scroll: h, options: u } = l;
|
|
930
|
+
l !== this.root && h && u.layoutScroll && (h.wasRoot && R(o, i), F(o.x, h.offset.x), F(o.y, h.offset.y));
|
|
931
|
+
}
|
|
932
|
+
return o;
|
|
933
|
+
}
|
|
934
|
+
applyTransform(i, o = !1) {
|
|
935
|
+
const a = y();
|
|
936
|
+
R(a, i);
|
|
937
|
+
for (let l = 0; l < this.path.length; l++) {
|
|
938
|
+
const h = this.path[l];
|
|
939
|
+
!o && h.options.layoutScroll && h.scroll && h !== h.root && N(a, {
|
|
940
|
+
x: -h.scroll.offset.x,
|
|
941
|
+
y: -h.scroll.offset.y
|
|
942
|
+
}), V(h.latestValues) && N(a, h.latestValues);
|
|
943
|
+
}
|
|
944
|
+
return V(this.latestValues) && N(a, this.latestValues), a;
|
|
945
|
+
}
|
|
946
|
+
removeTransform(i) {
|
|
947
|
+
const o = y();
|
|
948
|
+
R(o, i);
|
|
949
|
+
for (let a = 0; a < this.path.length; a++) {
|
|
950
|
+
const l = this.path[a];
|
|
951
|
+
if (!l.instance || !V(l.latestValues))
|
|
952
|
+
continue;
|
|
953
|
+
nt(l.latestValues) && l.updateSnapshot();
|
|
954
|
+
const h = y(), u = l.measurePageBox();
|
|
955
|
+
R(h, u), Rt(o, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, h);
|
|
956
|
+
}
|
|
957
|
+
return V(this.latestValues) && Rt(o, this.latestValues), o;
|
|
958
|
+
}
|
|
959
|
+
setTargetDelta(i) {
|
|
960
|
+
this.targetDelta = i, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
|
|
961
|
+
}
|
|
962
|
+
setOptions(i) {
|
|
963
|
+
this.options = {
|
|
964
|
+
...this.options,
|
|
965
|
+
...i,
|
|
966
|
+
crossfade: i.crossfade !== void 0 ? i.crossfade : !0
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
clearMeasurements() {
|
|
970
|
+
this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
|
|
971
|
+
}
|
|
972
|
+
forceRelativeParentToResolveTarget() {
|
|
973
|
+
this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== E.timestamp && this.relativeParent.resolveTargetDelta(!0);
|
|
974
|
+
}
|
|
975
|
+
resolveTargetDelta(i = !1) {
|
|
976
|
+
const o = this.getLead();
|
|
977
|
+
this.isProjectionDirty || (this.isProjectionDirty = o.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = o.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = o.isSharedProjectionDirty);
|
|
978
|
+
const a = !!this.resumingFrom || this !== o;
|
|
979
|
+
if (!(i || a && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
|
|
980
|
+
return;
|
|
981
|
+
const { layout: h, layoutId: u } = this.options;
|
|
982
|
+
if (!(!this.layout || !(h || u))) {
|
|
983
|
+
if (this.resolvedRelativeTargetAt = E.timestamp, !this.targetDelta && !this.relativeTarget) {
|
|
984
|
+
const d = this.getClosestProjectingParent();
|
|
985
|
+
d && d.layout && this.animationProgress !== 1 ? (this.relativeParent = d, this.forceRelativeParentToResolveTarget(), this.relativeTarget = y(), this.relativeTargetOrigin = y(), I(this.relativeTargetOrigin, this.layout.layoutBox, d.layout.layoutBox), R(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
|
|
986
|
+
}
|
|
987
|
+
if (!(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = y(), this.targetWithTransforms = y()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), He(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : R(this.target, this.layout.layoutBox), Re(this.target, this.targetDelta)) : R(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget)) {
|
|
988
|
+
this.attemptToResolveRelativeTarget = !1;
|
|
989
|
+
const d = this.getClosestProjectingParent();
|
|
990
|
+
d && !!d.resumingFrom == !!this.resumingFrom && !d.options.layoutScroll && d.target && this.animationProgress !== 1 ? (this.relativeParent = d, this.forceRelativeParentToResolveTarget(), this.relativeTarget = y(), this.relativeTargetOrigin = y(), I(this.relativeTargetOrigin, this.target, d.target), R(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
getClosestProjectingParent() {
|
|
995
|
+
if (!(!this.parent || nt(this.parent.latestValues) || Ae(this.parent.latestValues)))
|
|
996
|
+
return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
|
|
997
|
+
}
|
|
998
|
+
isProjecting() {
|
|
999
|
+
return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
1000
|
+
}
|
|
1001
|
+
calcProjection() {
|
|
1002
|
+
const i = this.getLead(), o = !!this.resumingFrom || this !== i;
|
|
1003
|
+
let a = !0;
|
|
1004
|
+
if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (a = !1), o && (this.isSharedProjectionDirty || this.isTransformDirty) && (a = !1), this.resolvedRelativeTargetAt === E.timestamp && (a = !1), a)
|
|
1005
|
+
return;
|
|
1006
|
+
const { layout: l, layoutId: h } = this.options;
|
|
1007
|
+
if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(l || h))
|
|
1008
|
+
return;
|
|
1009
|
+
R(this.layoutCorrected, this.layout.layoutBox);
|
|
1010
|
+
const u = this.treeScale.x, d = this.treeScale.y;
|
|
1011
|
+
Le(this.layoutCorrected, this.treeScale, this.path, o), i.layout && !i.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (i.target = i.layout.layoutBox, i.targetWithTransforms = y());
|
|
1012
|
+
const { target: f } = i;
|
|
1013
|
+
if (!f) {
|
|
1014
|
+
this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (Dt(this.prevProjectionDelta.x, this.projectionDelta.x), Dt(this.prevProjectionDelta.y, this.projectionDelta.y)), k(this.projectionDelta, this.layoutCorrected, f, this.latestValues), (this.treeScale.x !== u || this.treeScale.y !== d || !Vt(this.projectionDelta.x, this.prevProjectionDelta.x) || !Vt(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", f));
|
|
1018
|
+
}
|
|
1019
|
+
hide() {
|
|
1020
|
+
this.isVisible = !1;
|
|
1021
|
+
}
|
|
1022
|
+
show() {
|
|
1023
|
+
this.isVisible = !0;
|
|
1024
|
+
}
|
|
1025
|
+
scheduleRender(i = !0) {
|
|
1026
|
+
if (this.options.visualElement?.scheduleRender(), i) {
|
|
1027
|
+
const o = this.getStack();
|
|
1028
|
+
o && o.scheduleRender();
|
|
1029
|
+
}
|
|
1030
|
+
this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
|
|
1031
|
+
}
|
|
1032
|
+
createProjectionDeltas() {
|
|
1033
|
+
this.prevProjectionDelta = j(), this.projectionDelta = j(), this.projectionDeltaWithTransform = j();
|
|
1034
|
+
}
|
|
1035
|
+
setAnimationOrigin(i, o = !1) {
|
|
1036
|
+
const a = this.snapshot, l = a ? a.latestValues : {}, h = { ...this.latestValues }, u = j();
|
|
1037
|
+
(!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !o;
|
|
1038
|
+
const d = y(), f = a ? a.source : void 0, m = this.layout ? this.layout.source : void 0, P = f !== m, g = this.getStack(), p = !g || g.members.length <= 1, x = !!(P && !p && this.options.crossfade === !0 && !this.path.some(Ii));
|
|
1039
|
+
this.animationProgress = 0;
|
|
1040
|
+
let T;
|
|
1041
|
+
this.mixTargetDelta = (C) => {
|
|
1042
|
+
const B = C / 1e3;
|
|
1043
|
+
Mt(u.x, i.x, B), Mt(u.y, i.y, B), this.setTargetDelta(u), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (I(d, this.layout.layoutBox, this.relativeParent.layout.layoutBox), ki(this.relativeTarget, this.relativeTargetOrigin, d, B), T && xi(this.relativeTarget, T) && (this.isProjectionDirty = !1), T || (T = y()), R(T, this.relativeTarget)), P && (this.animationValues = h, mi(h, l, this.latestValues, B, x, p)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = B;
|
|
1044
|
+
}, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
1045
|
+
}
|
|
1046
|
+
startAnimation(i) {
|
|
1047
|
+
this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (U(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = S.update(() => {
|
|
1048
|
+
$.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = Ht(0)), this.currentAnimation = hi(this.motionValue, [0, 1e3], {
|
|
1049
|
+
...i,
|
|
1050
|
+
velocity: 0,
|
|
1051
|
+
isSync: !0,
|
|
1052
|
+
onUpdate: (o) => {
|
|
1053
|
+
this.mixTargetDelta(o), i.onUpdate && i.onUpdate(o);
|
|
1054
|
+
},
|
|
1055
|
+
onStop: () => {
|
|
1056
|
+
},
|
|
1057
|
+
onComplete: () => {
|
|
1058
|
+
i.onComplete && i.onComplete(), this.completeAnimation();
|
|
1059
|
+
}
|
|
1060
|
+
}), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
completeAnimation() {
|
|
1064
|
+
this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
|
|
1065
|
+
const i = this.getStack();
|
|
1066
|
+
i && i.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
|
|
1067
|
+
}
|
|
1068
|
+
finishAnimation() {
|
|
1069
|
+
this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Ei), this.currentAnimation.stop()), this.completeAnimation();
|
|
1070
|
+
}
|
|
1071
|
+
applyTransformsToTarget() {
|
|
1072
|
+
const i = this.getLead();
|
|
1073
|
+
let { targetWithTransforms: o, target: a, layout: l, latestValues: h } = i;
|
|
1074
|
+
if (!(!o || !a || !l)) {
|
|
1075
|
+
if (this !== i && this.layout && l && le(this.options.animationType, this.layout.layoutBox, l.layoutBox)) {
|
|
1076
|
+
a = this.target || y();
|
|
1077
|
+
const u = D(this.layout.layoutBox.x);
|
|
1078
|
+
a.x.min = i.target.x.min, a.x.max = a.x.min + u;
|
|
1079
|
+
const d = D(this.layout.layoutBox.y);
|
|
1080
|
+
a.y.min = i.target.y.min, a.y.max = a.y.min + d;
|
|
1081
|
+
}
|
|
1082
|
+
R(o, a), N(o, h), k(this.projectionDeltaWithTransform, this.layoutCorrected, o, h);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
registerSharedNode(i, o) {
|
|
1086
|
+
this.sharedNodes.has(i) || this.sharedNodes.set(i, new Ti()), this.sharedNodes.get(i).add(o);
|
|
1087
|
+
const l = o.options.initialPromotionConfig;
|
|
1088
|
+
o.promote({
|
|
1089
|
+
transition: l ? l.transition : void 0,
|
|
1090
|
+
preserveFollowOpacity: l && l.shouldPreserveFollowOpacity ? l.shouldPreserveFollowOpacity(o) : void 0
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
isLead() {
|
|
1094
|
+
const i = this.getStack();
|
|
1095
|
+
return i ? i.lead === this : !0;
|
|
1096
|
+
}
|
|
1097
|
+
getLead() {
|
|
1098
|
+
const { layoutId: i } = this.options;
|
|
1099
|
+
return i ? this.getStack()?.lead || this : this;
|
|
1100
|
+
}
|
|
1101
|
+
getPrevLead() {
|
|
1102
|
+
const { layoutId: i } = this.options;
|
|
1103
|
+
return i ? this.getStack()?.prevLead : void 0;
|
|
1104
|
+
}
|
|
1105
|
+
getStack() {
|
|
1106
|
+
const { layoutId: i } = this.options;
|
|
1107
|
+
if (i)
|
|
1108
|
+
return this.root.sharedNodes.get(i);
|
|
1109
|
+
}
|
|
1110
|
+
promote({ needsReset: i, transition: o, preserveFollowOpacity: a } = {}) {
|
|
1111
|
+
const l = this.getStack();
|
|
1112
|
+
l && l.promote(this, a), i && (this.projectionDelta = void 0, this.needsReset = !0), o && this.setOptions({ transition: o });
|
|
1113
|
+
}
|
|
1114
|
+
relegate() {
|
|
1115
|
+
const i = this.getStack();
|
|
1116
|
+
return i ? i.relegate(this) : !1;
|
|
1117
|
+
}
|
|
1118
|
+
resetSkewAndRotation() {
|
|
1119
|
+
const { visualElement: i } = this.options;
|
|
1120
|
+
if (!i)
|
|
1121
|
+
return;
|
|
1122
|
+
let o = !1;
|
|
1123
|
+
const { latestValues: a } = i;
|
|
1124
|
+
if ((a.z || a.rotate || a.rotateX || a.rotateY || a.rotateZ || a.skewX || a.skewY) && (o = !0), !o)
|
|
1125
|
+
return;
|
|
1126
|
+
const l = {};
|
|
1127
|
+
a.z && Z("z", i, l, this.animationValues);
|
|
1128
|
+
for (let h = 0; h < _.length; h++)
|
|
1129
|
+
Z(`rotate${_[h]}`, i, l, this.animationValues), Z(`skew${_[h]}`, i, l, this.animationValues);
|
|
1130
|
+
i.render();
|
|
1131
|
+
for (const h in l)
|
|
1132
|
+
i.setStaticValue(h, l[h]), this.animationValues && (this.animationValues[h] = l[h]);
|
|
1133
|
+
i.scheduleRender();
|
|
1134
|
+
}
|
|
1135
|
+
applyProjectionStyles(i, o) {
|
|
1136
|
+
if (!this.instance || this.isSVG)
|
|
1137
|
+
return;
|
|
1138
|
+
if (!this.isVisible) {
|
|
1139
|
+
i.visibility = "hidden";
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
const a = this.getTransformTemplate();
|
|
1143
|
+
if (this.needsReset) {
|
|
1144
|
+
this.needsReset = !1, i.visibility = "", i.opacity = "", i.pointerEvents = H(o?.pointerEvents) || "", i.transform = a ? a(this.latestValues, "") : "none";
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
const l = this.getLead();
|
|
1148
|
+
if (!this.projectionDelta || !this.layout || !l.target) {
|
|
1149
|
+
this.options.layoutId && (i.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, i.pointerEvents = H(o?.pointerEvents) || ""), this.hasProjected && !V(this.latestValues) && (i.transform = a ? a({}, "") : "none", this.hasProjected = !1);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
i.visibility = "";
|
|
1153
|
+
const h = l.animationValues || l.latestValues;
|
|
1154
|
+
this.applyTransformsToTarget();
|
|
1155
|
+
let u = Di(this.projectionDeltaWithTransform, this.treeScale, h);
|
|
1156
|
+
a && (u = a(h, u)), i.transform = u;
|
|
1157
|
+
const { x: d, y: f } = this.projectionDelta;
|
|
1158
|
+
i.transformOrigin = `${d.origin * 100}% ${f.origin * 100}% 0`, l.animationValues ? i.opacity = l === this ? h.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : h.opacityExit : i.opacity = l === this ? h.opacity !== void 0 ? h.opacity : "" : h.opacityExit !== void 0 ? h.opacityExit : 0;
|
|
1159
|
+
for (const m in ot) {
|
|
1160
|
+
if (h[m] === void 0)
|
|
1161
|
+
continue;
|
|
1162
|
+
const { correct: P, applyTo: g, isCSSVariable: p } = ot[m], x = u === "none" ? h[m] : P(h[m], l);
|
|
1163
|
+
if (g) {
|
|
1164
|
+
const T = g.length;
|
|
1165
|
+
for (let C = 0; C < T; C++)
|
|
1166
|
+
i[g[C]] = x;
|
|
1167
|
+
} else
|
|
1168
|
+
p ? this.options.visualElement.renderState.vars[m] = x : i[m] = x;
|
|
1169
|
+
}
|
|
1170
|
+
this.options.layoutId && (i.pointerEvents = l === this ? H(o?.pointerEvents) || "" : "none");
|
|
1171
|
+
}
|
|
1172
|
+
clearSnapshot() {
|
|
1173
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
1174
|
+
}
|
|
1175
|
+
// Only run on root
|
|
1176
|
+
resetTree() {
|
|
1177
|
+
this.root.nodes.forEach((i) => i.currentAnimation?.stop()), this.root.nodes.forEach(jt), this.root.sharedNodes.clear();
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
function Ri(t) {
|
|
1182
|
+
t.updateLayout();
|
|
1183
|
+
}
|
|
1184
|
+
function Ai(t) {
|
|
1185
|
+
const e = t.resumeFrom?.snapshot || t.snapshot;
|
|
1186
|
+
if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
|
|
1187
|
+
const { layoutBox: s, measuredBox: n } = t.layout, { animationType: r } = t.options, c = e.source !== t.layout.source;
|
|
1188
|
+
r === "size" ? A((h) => {
|
|
1189
|
+
const u = c ? e.measuredBox[h] : e.layoutBox[h], d = D(u);
|
|
1190
|
+
u.min = s[h].min, u.max = u.min + d;
|
|
1191
|
+
}) : le(r, e.layoutBox, s) && A((h) => {
|
|
1192
|
+
const u = c ? e.measuredBox[h] : e.layoutBox[h], d = D(s[h]);
|
|
1193
|
+
u.max = u.min + d, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[h].max = t.relativeTarget[h].min + d);
|
|
1194
|
+
});
|
|
1195
|
+
const i = j();
|
|
1196
|
+
k(i, s, e.layoutBox);
|
|
1197
|
+
const o = j();
|
|
1198
|
+
c ? k(o, t.applyTransform(n, !0), e.measuredBox) : k(o, s, e.layoutBox);
|
|
1199
|
+
const a = !ne(i);
|
|
1200
|
+
let l = !1;
|
|
1201
|
+
if (!t.resumeFrom) {
|
|
1202
|
+
const h = t.getClosestProjectingParent();
|
|
1203
|
+
if (h && !h.resumeFrom) {
|
|
1204
|
+
const { snapshot: u, layout: d } = h;
|
|
1205
|
+
if (u && d) {
|
|
1206
|
+
const f = y();
|
|
1207
|
+
I(f, e.layoutBox, u.layoutBox);
|
|
1208
|
+
const m = y();
|
|
1209
|
+
I(m, s, d.layoutBox), oe(f, m) || (l = !0), h.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = f, t.relativeParent = h);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
t.notifyListeners("didUpdate", {
|
|
1214
|
+
layout: s,
|
|
1215
|
+
snapshot: e,
|
|
1216
|
+
delta: o,
|
|
1217
|
+
layoutDelta: i,
|
|
1218
|
+
hasLayoutChanged: a,
|
|
1219
|
+
hasRelativeLayoutChanged: l
|
|
1220
|
+
});
|
|
1221
|
+
} else if (t.isLead()) {
|
|
1222
|
+
const { onExitComplete: s } = t.options;
|
|
1223
|
+
s && s();
|
|
1224
|
+
}
|
|
1225
|
+
t.options.transition = void 0;
|
|
1226
|
+
}
|
|
1227
|
+
function Li(t) {
|
|
1228
|
+
t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
|
|
1229
|
+
}
|
|
1230
|
+
function Ci(t) {
|
|
1231
|
+
t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
|
|
1232
|
+
}
|
|
1233
|
+
function Bi(t) {
|
|
1234
|
+
t.clearSnapshot();
|
|
1235
|
+
}
|
|
1236
|
+
function jt(t) {
|
|
1237
|
+
t.clearMeasurements();
|
|
1238
|
+
}
|
|
1239
|
+
function wt(t) {
|
|
1240
|
+
t.isLayoutDirty = !1;
|
|
1241
|
+
}
|
|
1242
|
+
function Vi(t) {
|
|
1243
|
+
const { visualElement: e } = t.options;
|
|
1244
|
+
e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
|
|
1245
|
+
}
|
|
1246
|
+
function bt(t) {
|
|
1247
|
+
t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
|
|
1248
|
+
}
|
|
1249
|
+
function ji(t) {
|
|
1250
|
+
t.resolveTargetDelta();
|
|
1251
|
+
}
|
|
1252
|
+
function wi(t) {
|
|
1253
|
+
t.calcProjection();
|
|
1254
|
+
}
|
|
1255
|
+
function bi(t) {
|
|
1256
|
+
t.resetSkewAndRotation();
|
|
1257
|
+
}
|
|
1258
|
+
function Mi(t) {
|
|
1259
|
+
t.removeLeadSnapshot();
|
|
1260
|
+
}
|
|
1261
|
+
function Mt(t, e, s) {
|
|
1262
|
+
t.translate = v(e.translate, 0, s), t.scale = v(e.scale, 1, s), t.origin = e.origin, t.originPoint = e.originPoint;
|
|
1263
|
+
}
|
|
1264
|
+
function kt(t, e, s, n) {
|
|
1265
|
+
t.min = v(e.min, s.min, n), t.max = v(e.max, s.max, n);
|
|
1266
|
+
}
|
|
1267
|
+
function ki(t, e, s, n) {
|
|
1268
|
+
kt(t.x, e.x, s.x, n), kt(t.y, e.y, s.y, n);
|
|
1269
|
+
}
|
|
1270
|
+
function Ii(t) {
|
|
1271
|
+
return t.animationValues && t.animationValues.opacityExit !== void 0;
|
|
1272
|
+
}
|
|
1273
|
+
const Ui = {
|
|
1274
|
+
duration: 0.45,
|
|
1275
|
+
ease: [0.4, 0, 0.1, 1]
|
|
1276
|
+
}, It = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Ut = It("applewebkit/") && !It("chrome/") ? Math.round : w;
|
|
1277
|
+
function Ot(t) {
|
|
1278
|
+
t.min = Ut(t.min), t.max = Ut(t.max);
|
|
1279
|
+
}
|
|
1280
|
+
function Oi(t) {
|
|
1281
|
+
Ot(t.x), Ot(t.y);
|
|
1282
|
+
}
|
|
1283
|
+
function le(t, e, s) {
|
|
1284
|
+
return t === "position" || t === "preserve-aspect" && !ze(Bt(e), Bt(s), 0.2);
|
|
1285
|
+
}
|
|
1286
|
+
function Fi(t) {
|
|
1287
|
+
return t !== t.root && t.scroll?.wasRoot;
|
|
1288
|
+
}
|
|
1289
|
+
const Ni = re({
|
|
1290
|
+
attachResizeListener: (t, e) => tt(t, "resize", e),
|
|
1291
|
+
measureScroll: () => ({
|
|
1292
|
+
x: document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
1293
|
+
y: document.documentElement.scrollTop || document.body.scrollTop
|
|
1294
|
+
}),
|
|
1295
|
+
checkIsScrollRoot: () => !0
|
|
1296
|
+
}), K = {
|
|
1297
|
+
current: void 0
|
|
1298
|
+
}, he = re({
|
|
1299
|
+
measureScroll: (t) => ({
|
|
1300
|
+
x: t.scrollLeft,
|
|
1301
|
+
y: t.scrollTop
|
|
1302
|
+
}),
|
|
1303
|
+
defaultParent: () => {
|
|
1304
|
+
if (!K.current) {
|
|
1305
|
+
const t = new Ni({});
|
|
1306
|
+
t.mount(window), t.setOptions({ layoutScroll: !0 }), K.current = t;
|
|
1307
|
+
}
|
|
1308
|
+
return K.current;
|
|
1309
|
+
},
|
|
1310
|
+
resetTransform: (t, e) => {
|
|
1311
|
+
t.style.transform = e !== void 0 ? e : "none";
|
|
1312
|
+
},
|
|
1313
|
+
checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
|
|
1314
|
+
}), Wi = {
|
|
1315
|
+
pan: {
|
|
1316
|
+
Feature: oi
|
|
1317
|
+
},
|
|
1318
|
+
drag: {
|
|
1319
|
+
Feature: ni,
|
|
1320
|
+
ProjectionNode: he,
|
|
1321
|
+
MeasureLayout: ee
|
|
1322
|
+
}
|
|
1323
|
+
}, $i = {
|
|
1324
|
+
layout: {
|
|
1325
|
+
ProjectionNode: he,
|
|
1326
|
+
MeasureLayout: ee
|
|
1327
|
+
}
|
|
1328
|
+
}, Gi = {
|
|
1329
|
+
...Ve,
|
|
1330
|
+
...Be,
|
|
1331
|
+
...Wi,
|
|
1332
|
+
...$i
|
|
1333
|
+
}, _i = /* @__PURE__ */ je(Gi, we);
|
|
1334
|
+
export {
|
|
1335
|
+
ui as F,
|
|
1336
|
+
M as a,
|
|
1337
|
+
ct as b,
|
|
1338
|
+
D as c,
|
|
1339
|
+
di as d,
|
|
1340
|
+
Xe as e,
|
|
1341
|
+
Fe as f,
|
|
1342
|
+
_t as i,
|
|
1343
|
+
_i as m,
|
|
1344
|
+
Oe as s
|
|
1345
|
+
};
|
|
1346
|
+
//# sourceMappingURL=proxy-kv_Ue2k_.js.map
|