@ssgoi/react 0.0.5 → 0.0.7
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/index.cjs +1 -1
- package/dist/index.js +435 -431
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +98 -98
- package/dist/{utils-BSgyev81.cjs → utils-DR41YsAh-CN_CfgYX.cjs} +1 -1
- package/dist/{utils-DR41YsAh.js → utils-DR41YsAh-mLT5vDuI.js} +4 -4
- package/dist/view-transitions/index.cjs +1 -1
- package/dist/view-transitions/index.js +177 -173
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
+
import { r as Lt } from "./utils-DR41YsAh-mLT5vDuI.js";
|
|
1
2
|
import { jsx as mt } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
|
|
4
|
-
function
|
|
3
|
+
import { createContext as Bt, useContext as Wt, useMemo as Gt } from "react";
|
|
4
|
+
var Ht = Object.defineProperty, zt = (t, e, n) => e in t ? Ht(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, j = (t, e, n) => zt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
5
|
+
function dt(t, e) {
|
|
5
6
|
var n = {};
|
|
6
7
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
7
8
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
8
|
-
for (var
|
|
9
|
-
e.indexOf(r[
|
|
9
|
+
for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
|
|
10
|
+
e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
|
|
10
11
|
return n;
|
|
11
12
|
}
|
|
12
|
-
var
|
|
13
|
-
},
|
|
13
|
+
var _ = function() {
|
|
14
|
+
}, E = function() {
|
|
14
15
|
};
|
|
15
|
-
process.env.NODE_ENV !== "production" && (
|
|
16
|
+
process.env.NODE_ENV !== "production" && (_ = function(t, e) {
|
|
16
17
|
!t && typeof console < "u" && console.warn(e);
|
|
17
|
-
},
|
|
18
|
+
}, E = function(t, e) {
|
|
18
19
|
if (!t)
|
|
19
20
|
throw new Error(e);
|
|
20
21
|
});
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
return (-
|
|
32
|
-
}) : (
|
|
33
|
-
const
|
|
34
|
-
return -
|
|
35
|
-
},
|
|
36
|
-
const
|
|
37
|
-
return
|
|
22
|
+
const H = (t, e, n) => Math.min(Math.max(n, t), e), B = 1e-3, Jt = 0.01, at = 10, Kt = 0.05, Qt = 1;
|
|
23
|
+
function Xt({ duration: t = 800, bounce: e = 0.25, velocity: n = 0, mass: r = 1 }) {
|
|
24
|
+
let o, a;
|
|
25
|
+
_(t <= at * 1e3, "Spring duration must be 10 seconds or less");
|
|
26
|
+
let s = 1 - e;
|
|
27
|
+
s = H(Kt, Qt, s), t = H(Jt, at, t / 1e3), s < 1 ? (o = (u) => {
|
|
28
|
+
const h = u * s, m = h * t, i = h - n, l = z(u, s), p = Math.exp(-m);
|
|
29
|
+
return B - i / l * p;
|
|
30
|
+
}, a = (u) => {
|
|
31
|
+
const h = u * s * t, m = h * n + n, i = Math.pow(s, 2) * Math.pow(u, 2) * t, l = Math.exp(-h), p = z(Math.pow(u, 2), s);
|
|
32
|
+
return (-o(u) + B > 0 ? -1 : 1) * ((m - i) * l) / p;
|
|
33
|
+
}) : (o = (u) => {
|
|
34
|
+
const h = Math.exp(-u * t), m = (u - n) * t + 1;
|
|
35
|
+
return -B + h * m;
|
|
36
|
+
}, a = (u) => {
|
|
37
|
+
const h = Math.exp(-u * t), m = (n - u) * (t * t);
|
|
38
|
+
return h * m;
|
|
38
39
|
});
|
|
39
|
-
const
|
|
40
|
+
const f = 5 / t, c = Zt(o, a, f);
|
|
40
41
|
if (t = t * 1e3, isNaN(c))
|
|
41
42
|
return {
|
|
42
43
|
stiffness: 100,
|
|
@@ -44,425 +45,444 @@ function Kt({ duration: t = 800, bounce: e = 0.25, velocity: n = 0, mass: r = 1
|
|
|
44
45
|
duration: t
|
|
45
46
|
};
|
|
46
47
|
{
|
|
47
|
-
const
|
|
48
|
+
const u = Math.pow(c, 2) * r;
|
|
48
49
|
return {
|
|
49
|
-
stiffness:
|
|
50
|
-
damping:
|
|
50
|
+
stiffness: u,
|
|
51
|
+
damping: s * 2 * Math.sqrt(r * u),
|
|
51
52
|
duration: t
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
const
|
|
56
|
+
const Yt = 12;
|
|
56
57
|
function Zt(t, e, n) {
|
|
57
58
|
let r = n;
|
|
58
|
-
for (let
|
|
59
|
+
for (let o = 1; o < Yt; o++)
|
|
59
60
|
r = r - t(r) / e(r);
|
|
60
61
|
return r;
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function z(t, e) {
|
|
63
64
|
return t * Math.sqrt(1 - e * e);
|
|
64
65
|
}
|
|
65
|
-
const
|
|
66
|
+
const _t = ["duration", "bounce"], te = ["stiffness", "damping", "mass"];
|
|
66
67
|
function it(t, e) {
|
|
67
68
|
return e.some((n) => t[n] !== void 0);
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function ee(t) {
|
|
70
71
|
let e = Object.assign({ velocity: 0, stiffness: 100, damping: 10, mass: 1, isResolvedFromDuration: !1 }, t);
|
|
71
|
-
if (!it(t,
|
|
72
|
-
const n =
|
|
72
|
+
if (!it(t, te) && it(t, _t)) {
|
|
73
|
+
const n = Xt(t);
|
|
73
74
|
e = Object.assign(Object.assign(Object.assign({}, e), n), { velocity: 0, mass: 1 }), e.isResolvedFromDuration = !0;
|
|
74
75
|
}
|
|
75
76
|
return e;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
-
var { from: e = 0, to: n = 1, restSpeed: r = 2, restDelta:
|
|
79
|
-
const
|
|
80
|
-
let { stiffness:
|
|
81
|
-
function
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
return n -
|
|
88
|
-
},
|
|
89
|
-
const
|
|
90
|
-
return
|
|
78
|
+
function tt(t) {
|
|
79
|
+
var { from: e = 0, to: n = 1, restSpeed: r = 2, restDelta: o } = t, a = dt(t, ["from", "to", "restSpeed", "restDelta"]);
|
|
80
|
+
const s = { done: !1, value: e };
|
|
81
|
+
let { stiffness: f, damping: c, mass: u, velocity: h, duration: m, isResolvedFromDuration: i } = ee(a), l = lt, p = lt;
|
|
82
|
+
function y() {
|
|
83
|
+
const b = h ? -(h / 1e3) : 0, d = n - e, g = c / (2 * Math.sqrt(f * u)), w = Math.sqrt(f / u) / 1e3;
|
|
84
|
+
if (o === void 0 && (o = Math.min(Math.abs(n - e) / 100, 0.4)), g < 1) {
|
|
85
|
+
const v = z(w, g);
|
|
86
|
+
l = (M) => {
|
|
87
|
+
const x = Math.exp(-g * w * M);
|
|
88
|
+
return n - x * ((b + g * w * d) / v * Math.sin(v * M) + d * Math.cos(v * M));
|
|
89
|
+
}, p = (M) => {
|
|
90
|
+
const x = Math.exp(-g * w * M);
|
|
91
|
+
return g * w * x * (Math.sin(v * M) * (b + g * w * d) / v + d * Math.cos(v * M)) - x * (Math.cos(v * M) * (b + g * w * d) - v * d * Math.sin(v * M));
|
|
91
92
|
};
|
|
92
|
-
} else if (
|
|
93
|
-
|
|
93
|
+
} else if (g === 1)
|
|
94
|
+
l = (v) => n - Math.exp(-w * v) * (d + (b + w * d) * v);
|
|
94
95
|
else {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
return n -
|
|
96
|
+
const v = w * Math.sqrt(g * g - 1);
|
|
97
|
+
l = (M) => {
|
|
98
|
+
const x = Math.exp(-g * w * M), A = Math.min(v * M, 300);
|
|
99
|
+
return n - x * ((b + g * w * d) * Math.sinh(A) + v * d * Math.cosh(A)) / v;
|
|
99
100
|
};
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
|
-
return
|
|
103
|
-
next: (
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
|
|
103
|
+
return y(), {
|
|
104
|
+
next: (b) => {
|
|
105
|
+
const d = l(b);
|
|
106
|
+
if (i)
|
|
107
|
+
s.done = b >= m;
|
|
107
108
|
else {
|
|
108
|
-
const
|
|
109
|
-
|
|
109
|
+
const g = p(b) * 1e3, w = Math.abs(g) <= r, v = Math.abs(n - d) <= o;
|
|
110
|
+
s.done = w && v;
|
|
110
111
|
}
|
|
111
|
-
return
|
|
112
|
+
return s.value = s.done ? n : d, s;
|
|
112
113
|
},
|
|
113
114
|
flipTarget: () => {
|
|
114
|
-
|
|
115
|
+
h = -h, [e, n] = [n, e], y();
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
const
|
|
119
|
+
tt.needsInterpolation = (t, e) => typeof t == "string" || typeof e == "string";
|
|
120
|
+
const lt = (t) => 0, gt = (t, e, n) => {
|
|
120
121
|
const r = e - t;
|
|
121
122
|
return r === 0 ? 1 : (n - t) / r;
|
|
122
|
-
},
|
|
123
|
-
function
|
|
123
|
+
}, et = (t, e, n) => -n * t + n * e + t, vt = (t, e) => (n) => Math.max(Math.min(n, e), t), R = (t) => t % 1 ? Number(t.toFixed(5)) : t, D = /(-)?([\d]*\.?[\d])+/g, J = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi, ne = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;
|
|
124
|
+
function T(t) {
|
|
124
125
|
return typeof t == "string";
|
|
125
126
|
}
|
|
126
|
-
const
|
|
127
|
+
const U = {
|
|
127
128
|
test: (t) => typeof t == "number",
|
|
128
129
|
parse: parseFloat,
|
|
129
130
|
transform: (t) => t
|
|
130
|
-
}, yt = Object.assign(Object.assign({},
|
|
131
|
-
Object.assign(Object.assign({},
|
|
132
|
-
const
|
|
133
|
-
test: (e) =>
|
|
131
|
+
}, yt = Object.assign(Object.assign({}, U), { transform: vt(0, 1) });
|
|
132
|
+
Object.assign(Object.assign({}, U), { default: 1 });
|
|
133
|
+
const re = (t) => ({
|
|
134
|
+
test: (e) => T(e) && e.endsWith(t) && e.split(" ").length === 1,
|
|
134
135
|
parse: parseFloat,
|
|
135
136
|
transform: (e) => `${e}${t}`
|
|
136
|
-
}),
|
|
137
|
-
Object.assign(Object.assign({},
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
137
|
+
}), V = re("%");
|
|
138
|
+
Object.assign(Object.assign({}, V), { parse: (t) => V.parse(t) / 100, transform: (t) => V.transform(t * 100) });
|
|
139
|
+
const nt = (t, e) => (n) => !!(T(n) && ne.test(n) && n.startsWith(t) || e && Object.prototype.hasOwnProperty.call(n, e)), bt = (t, e, n) => (r) => {
|
|
140
|
+
if (!T(r))
|
|
140
141
|
return r;
|
|
141
|
-
const [
|
|
142
|
+
const [o, a, s, f] = r.match(D);
|
|
142
143
|
return {
|
|
143
|
-
[t]: parseFloat(
|
|
144
|
-
[e]: parseFloat(
|
|
145
|
-
[n]: parseFloat(
|
|
146
|
-
alpha:
|
|
144
|
+
[t]: parseFloat(o),
|
|
145
|
+
[e]: parseFloat(a),
|
|
146
|
+
[n]: parseFloat(s),
|
|
147
|
+
alpha: f !== void 0 ? parseFloat(f) : 1
|
|
147
148
|
};
|
|
148
|
-
},
|
|
149
|
-
test:
|
|
149
|
+
}, S = {
|
|
150
|
+
test: nt("hsl", "hue"),
|
|
150
151
|
parse: bt("hue", "saturation", "lightness"),
|
|
151
|
-
transform: ({ hue: t, saturation: e, lightness: n, alpha: r = 1 }) => "hsla(" + Math.round(t) + ", " +
|
|
152
|
-
},
|
|
153
|
-
test:
|
|
152
|
+
transform: ({ hue: t, saturation: e, lightness: n, alpha: r = 1 }) => "hsla(" + Math.round(t) + ", " + V.transform(R(e)) + ", " + V.transform(R(n)) + ", " + R(yt.transform(r)) + ")"
|
|
153
|
+
}, oe = vt(0, 255), W = Object.assign(Object.assign({}, U), { transform: (t) => Math.round(oe(t)) }), O = {
|
|
154
|
+
test: nt("rgb", "red"),
|
|
154
155
|
parse: bt("red", "green", "blue"),
|
|
155
|
-
transform: ({ red: t, green: e, blue: n, alpha: r = 1 }) => "rgba(" +
|
|
156
|
+
transform: ({ red: t, green: e, blue: n, alpha: r = 1 }) => "rgba(" + W.transform(t) + ", " + W.transform(e) + ", " + W.transform(n) + ", " + R(yt.transform(r)) + ")"
|
|
156
157
|
};
|
|
157
|
-
function
|
|
158
|
-
let e = "", n = "", r = "",
|
|
159
|
-
return t.length > 5 ? (e = t.substr(1, 2), n = t.substr(3, 2), r = t.substr(5, 2),
|
|
158
|
+
function se(t) {
|
|
159
|
+
let e = "", n = "", r = "", o = "";
|
|
160
|
+
return t.length > 5 ? (e = t.substr(1, 2), n = t.substr(3, 2), r = t.substr(5, 2), o = t.substr(7, 2)) : (e = t.substr(1, 1), n = t.substr(2, 1), r = t.substr(3, 1), o = t.substr(4, 1), e += e, n += n, r += r, o += o), {
|
|
160
161
|
red: parseInt(e, 16),
|
|
161
162
|
green: parseInt(n, 16),
|
|
162
163
|
blue: parseInt(r, 16),
|
|
163
|
-
alpha:
|
|
164
|
+
alpha: o ? parseInt(o, 16) / 255 : 1
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
const K = {
|
|
167
|
-
test:
|
|
168
|
-
parse:
|
|
169
|
-
transform:
|
|
170
|
-
},
|
|
171
|
-
test: (t) =>
|
|
172
|
-
parse: (t) =>
|
|
173
|
-
transform: (t) =>
|
|
174
|
-
},
|
|
175
|
-
function
|
|
176
|
-
var e, n, r,
|
|
177
|
-
return isNaN(t) &&
|
|
178
|
-
}
|
|
179
|
-
function
|
|
168
|
+
test: nt("#"),
|
|
169
|
+
parse: se,
|
|
170
|
+
transform: O.transform
|
|
171
|
+
}, $ = {
|
|
172
|
+
test: (t) => O.test(t) || K.test(t) || S.test(t),
|
|
173
|
+
parse: (t) => O.test(t) ? O.parse(t) : S.test(t) ? S.parse(t) : K.parse(t),
|
|
174
|
+
transform: (t) => T(t) ? t : t.hasOwnProperty("red") ? O.transform(t) : S.transform(t)
|
|
175
|
+
}, wt = "${c}", Mt = "${n}";
|
|
176
|
+
function ae(t) {
|
|
177
|
+
var e, n, r, o;
|
|
178
|
+
return isNaN(t) && T(t) && ((n = (e = t.match(D)) === null || e === void 0 ? void 0 : e.length) !== null && n !== void 0 ? n : 0) + ((o = (r = t.match(J)) === null || r === void 0 ? void 0 : r.length) !== null && o !== void 0 ? o : 0) > 0;
|
|
179
|
+
}
|
|
180
|
+
function xt(t) {
|
|
180
181
|
typeof t == "number" && (t = `${t}`);
|
|
181
182
|
const e = [];
|
|
182
183
|
let n = 0;
|
|
183
|
-
const r = t.match(
|
|
184
|
-
r && (n = r.length, t = t.replace(
|
|
185
|
-
const
|
|
186
|
-
return
|
|
187
|
-
}
|
|
188
|
-
function
|
|
189
|
-
return
|
|
190
|
-
}
|
|
191
|
-
function
|
|
192
|
-
const { values: e, numColors: n, tokenised: r } =
|
|
193
|
-
return (
|
|
194
|
-
let
|
|
195
|
-
for (let
|
|
196
|
-
|
|
197
|
-
return
|
|
184
|
+
const r = t.match(J);
|
|
185
|
+
r && (n = r.length, t = t.replace(J, wt), e.push(...r.map($.parse)));
|
|
186
|
+
const o = t.match(D);
|
|
187
|
+
return o && (t = t.replace(D, Mt), e.push(...o.map(U.parse))), { values: e, numColors: n, tokenised: t };
|
|
188
|
+
}
|
|
189
|
+
function Ot(t) {
|
|
190
|
+
return xt(t).values;
|
|
191
|
+
}
|
|
192
|
+
function St(t) {
|
|
193
|
+
const { values: e, numColors: n, tokenised: r } = xt(t), o = e.length;
|
|
194
|
+
return (a) => {
|
|
195
|
+
let s = r;
|
|
196
|
+
for (let f = 0; f < o; f++)
|
|
197
|
+
s = s.replace(f < n ? wt : Mt, f < n ? $.transform(a[f]) : R(a[f]));
|
|
198
|
+
return s;
|
|
198
199
|
};
|
|
199
200
|
}
|
|
200
|
-
const
|
|
201
|
-
function
|
|
202
|
-
const e =
|
|
203
|
-
return
|
|
201
|
+
const ie = (t) => typeof t == "number" ? 0 : t;
|
|
202
|
+
function le(t) {
|
|
203
|
+
const e = Ot(t);
|
|
204
|
+
return St(t)(e.map(ie));
|
|
204
205
|
}
|
|
205
|
-
const
|
|
206
|
-
function
|
|
206
|
+
const At = { test: ae, parse: Ot, createTransformer: St, getAnimatableNone: le };
|
|
207
|
+
function G(t, e, n) {
|
|
207
208
|
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
+
function ut({ hue: t, saturation: e, lightness: n, alpha: r }) {
|
|
210
211
|
t /= 360, e /= 100, n /= 100;
|
|
211
|
-
let
|
|
212
|
+
let o = 0, a = 0, s = 0;
|
|
212
213
|
if (!e)
|
|
213
|
-
|
|
214
|
+
o = a = s = n;
|
|
214
215
|
else {
|
|
215
|
-
const
|
|
216
|
-
|
|
216
|
+
const f = n < 0.5 ? n * (1 + e) : n + e - n * e, c = 2 * n - f;
|
|
217
|
+
o = G(c, f, t + 1 / 3), a = G(c, f, t), s = G(c, f, t - 1 / 3);
|
|
217
218
|
}
|
|
218
219
|
return {
|
|
219
|
-
red: Math.round(
|
|
220
|
-
green: Math.round(
|
|
221
|
-
blue: Math.round(
|
|
220
|
+
red: Math.round(o * 255),
|
|
221
|
+
green: Math.round(a * 255),
|
|
222
|
+
blue: Math.round(s * 255),
|
|
222
223
|
alpha: r
|
|
223
224
|
};
|
|
224
225
|
}
|
|
225
|
-
const
|
|
226
|
-
const r = t * t,
|
|
227
|
-
return Math.sqrt(Math.max(0, n * (
|
|
228
|
-
},
|
|
226
|
+
const ue = (t, e, n) => {
|
|
227
|
+
const r = t * t, o = e * e;
|
|
228
|
+
return Math.sqrt(Math.max(0, n * (o - r) + r));
|
|
229
|
+
}, ce = [K, O, S], ct = (t) => ce.find((e) => e.test(t)), ft = (t) => `'${t}' is not an animatable color. Use the equivalent color code instead.`, jt = (t, e) => {
|
|
229
230
|
let n = ct(t), r = ct(e);
|
|
230
|
-
|
|
231
|
-
let
|
|
232
|
-
n ===
|
|
233
|
-
const
|
|
234
|
-
return (
|
|
235
|
-
for (const c in
|
|
236
|
-
c !== "alpha" && (
|
|
237
|
-
return
|
|
231
|
+
E(!!n, ft(t)), E(!!r, ft(e));
|
|
232
|
+
let o = n.parse(t), a = r.parse(e);
|
|
233
|
+
n === S && (o = ut(o), n = O), r === S && (a = ut(a), r = O);
|
|
234
|
+
const s = Object.assign({}, o);
|
|
235
|
+
return (f) => {
|
|
236
|
+
for (const c in s)
|
|
237
|
+
c !== "alpha" && (s[c] = ue(o[c], a[c], f));
|
|
238
|
+
return s.alpha = et(o.alpha, a.alpha, f), n.transform(s);
|
|
238
239
|
};
|
|
239
|
-
},
|
|
240
|
-
function
|
|
241
|
-
return
|
|
242
|
-
}
|
|
243
|
-
const
|
|
244
|
-
const n = [...t], r = n.length,
|
|
245
|
-
return (
|
|
246
|
-
for (let
|
|
247
|
-
n[
|
|
240
|
+
}, fe = (t) => typeof t == "number", pe = (t, e) => (n) => e(t(n)), Ct = (...t) => t.reduce(pe);
|
|
241
|
+
function Rt(t, e) {
|
|
242
|
+
return fe(t) ? (n) => et(t, e, n) : $.test(t) ? jt(t, e) : Pt(t, e);
|
|
243
|
+
}
|
|
244
|
+
const Vt = (t, e) => {
|
|
245
|
+
const n = [...t], r = n.length, o = t.map((a, s) => Rt(a, e[s]));
|
|
246
|
+
return (a) => {
|
|
247
|
+
for (let s = 0; s < r; s++)
|
|
248
|
+
n[s] = o[s](a);
|
|
248
249
|
return n;
|
|
249
250
|
};
|
|
250
|
-
},
|
|
251
|
+
}, he = (t, e) => {
|
|
251
252
|
const n = Object.assign(Object.assign({}, t), e), r = {};
|
|
252
|
-
for (const
|
|
253
|
-
t[
|
|
254
|
-
return (
|
|
255
|
-
for (const
|
|
256
|
-
n[
|
|
253
|
+
for (const o in n)
|
|
254
|
+
t[o] !== void 0 && e[o] !== void 0 && (r[o] = Rt(t[o], e[o]));
|
|
255
|
+
return (o) => {
|
|
256
|
+
for (const a in r)
|
|
257
|
+
n[a] = r[a](o);
|
|
257
258
|
return n;
|
|
258
259
|
};
|
|
259
260
|
};
|
|
260
|
-
function
|
|
261
|
-
const e =
|
|
262
|
-
let r = 0,
|
|
263
|
-
for (let
|
|
264
|
-
r || typeof e[
|
|
265
|
-
return { parsed: e, numNumbers: r, numRGB:
|
|
266
|
-
}
|
|
267
|
-
const
|
|
268
|
-
const n =
|
|
269
|
-
return r.numHSL ===
|
|
270
|
-
},
|
|
271
|
-
function
|
|
261
|
+
function pt(t) {
|
|
262
|
+
const e = At.parse(t), n = e.length;
|
|
263
|
+
let r = 0, o = 0, a = 0;
|
|
264
|
+
for (let s = 0; s < n; s++)
|
|
265
|
+
r || typeof e[s] == "number" ? r++ : e[s].hue !== void 0 ? a++ : o++;
|
|
266
|
+
return { parsed: e, numNumbers: r, numRGB: o, numHSL: a };
|
|
267
|
+
}
|
|
268
|
+
const Pt = (t, e) => {
|
|
269
|
+
const n = At.createTransformer(e), r = pt(t), o = pt(e);
|
|
270
|
+
return r.numHSL === o.numHSL && r.numRGB === o.numRGB && r.numNumbers >= o.numNumbers ? Ct(Vt(r.parsed, o.parsed), n) : (_(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), (a) => `${a > 0 ? e : t}`);
|
|
271
|
+
}, me = (t, e) => (n) => et(t, e, n);
|
|
272
|
+
function de(t) {
|
|
272
273
|
if (typeof t == "number")
|
|
273
|
-
return
|
|
274
|
+
return me;
|
|
274
275
|
if (typeof t == "string")
|
|
275
|
-
return
|
|
276
|
+
return $.test(t) ? jt : Pt;
|
|
276
277
|
if (Array.isArray(t))
|
|
277
|
-
return
|
|
278
|
+
return Vt;
|
|
278
279
|
if (typeof t == "object")
|
|
279
|
-
return
|
|
280
|
+
return he;
|
|
280
281
|
}
|
|
281
|
-
function
|
|
282
|
-
const r = [],
|
|
283
|
-
for (let
|
|
284
|
-
let
|
|
282
|
+
function ge(t, e, n) {
|
|
283
|
+
const r = [], o = n || de(t[0]), a = t.length - 1;
|
|
284
|
+
for (let s = 0; s < a; s++) {
|
|
285
|
+
let f = o(t[s], t[s + 1]);
|
|
285
286
|
if (e) {
|
|
286
|
-
const c = Array.isArray(e) ? e[
|
|
287
|
-
|
|
287
|
+
const c = Array.isArray(e) ? e[s] : e;
|
|
288
|
+
f = Ct(c, f);
|
|
288
289
|
}
|
|
289
|
-
r.push(
|
|
290
|
+
r.push(f);
|
|
290
291
|
}
|
|
291
292
|
return r;
|
|
292
293
|
}
|
|
293
|
-
function
|
|
294
|
-
return (r) => n(
|
|
294
|
+
function ve([t, e], [n]) {
|
|
295
|
+
return (r) => n(gt(t, e, r));
|
|
295
296
|
}
|
|
296
|
-
function
|
|
297
|
+
function ye(t, e) {
|
|
297
298
|
const n = t.length, r = n - 1;
|
|
298
|
-
return (
|
|
299
|
-
let
|
|
300
|
-
if (
|
|
299
|
+
return (o) => {
|
|
300
|
+
let a = 0, s = !1;
|
|
301
|
+
if (o <= t[0] ? s = !0 : o >= t[r] && (a = r - 1, s = !0), !s) {
|
|
301
302
|
let c = 1;
|
|
302
|
-
for (; c < n && !(t[c] >
|
|
303
|
+
for (; c < n && !(t[c] > o || c === r); c++)
|
|
303
304
|
;
|
|
304
|
-
|
|
305
|
+
a = c - 1;
|
|
305
306
|
}
|
|
306
|
-
const
|
|
307
|
-
return e[
|
|
307
|
+
const f = gt(t[a], t[a + 1], o);
|
|
308
|
+
return e[a](f);
|
|
308
309
|
};
|
|
309
310
|
}
|
|
310
|
-
function
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
return n ? (c) =>
|
|
311
|
+
function Et(t, e, { clamp: n = !0, ease: r, mixer: o } = {}) {
|
|
312
|
+
const a = t.length;
|
|
313
|
+
E(a === e.length, "Both input and output ranges must be the same length"), E(!r || !Array.isArray(r) || r.length === a - 1, "Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values."), t[0] > t[a - 1] && (t = [].concat(t), e = [].concat(e), t.reverse(), e.reverse());
|
|
314
|
+
const s = ge(e, r, o), f = a === 2 ? ve(t, s) : ye(t, s);
|
|
315
|
+
return n ? (c) => f(H(t[0], t[a - 1], c)) : f;
|
|
315
316
|
}
|
|
316
|
-
const
|
|
317
|
-
function
|
|
317
|
+
const be = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, we = (t) => (e) => Math.pow(e, t), Me = we(2), xe = be(Me);
|
|
318
|
+
function Oe(t, e) {
|
|
318
319
|
return t.map(() => e || xe).splice(0, t.length - 1);
|
|
319
320
|
}
|
|
320
|
-
function
|
|
321
|
+
function Se(t) {
|
|
321
322
|
const e = t.length;
|
|
322
323
|
return t.map((n, r) => r !== 0 ? r / (e - 1) : 0);
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
+
function Ae(t, e) {
|
|
325
326
|
return t.map((n) => n * e);
|
|
326
327
|
}
|
|
327
|
-
function
|
|
328
|
-
const
|
|
328
|
+
function N({ from: t = 0, to: e = 1, ease: n, offset: r, duration: o = 300 }) {
|
|
329
|
+
const a = { done: !1, value: t }, s = Array.isArray(e) ? e : [t, e], f = Ae(r && r.length === s.length ? r : Se(s), o);
|
|
329
330
|
function c() {
|
|
330
|
-
return
|
|
331
|
-
ease: Array.isArray(n) ? n :
|
|
331
|
+
return Et(f, s, {
|
|
332
|
+
ease: Array.isArray(n) ? n : Oe(s, n)
|
|
332
333
|
});
|
|
333
334
|
}
|
|
334
|
-
let
|
|
335
|
+
let u = c();
|
|
335
336
|
return {
|
|
336
|
-
next: (
|
|
337
|
+
next: (h) => (a.value = u(h), a.done = h >= o, a),
|
|
337
338
|
flipTarget: () => {
|
|
338
|
-
|
|
339
|
+
s.reverse(), u = c();
|
|
339
340
|
}
|
|
340
341
|
};
|
|
341
342
|
}
|
|
342
|
-
function
|
|
343
|
-
const
|
|
344
|
-
let
|
|
345
|
-
const c = e +
|
|
346
|
-
return
|
|
347
|
-
next: (
|
|
348
|
-
const m = -
|
|
349
|
-
return
|
|
343
|
+
function je({ velocity: t = 0, from: e = 0, power: n = 0.8, timeConstant: r = 350, restDelta: o = 0.5, modifyTarget: a }) {
|
|
344
|
+
const s = { done: !1, value: e };
|
|
345
|
+
let f = n * t;
|
|
346
|
+
const c = e + f, u = a === void 0 ? c : a(c);
|
|
347
|
+
return u !== c && (f = u - e), {
|
|
348
|
+
next: (h) => {
|
|
349
|
+
const m = -f * Math.exp(-h / r);
|
|
350
|
+
return s.done = !(m > o || m < -o), s.value = s.done ? u : u + m, s;
|
|
350
351
|
},
|
|
351
352
|
flipTarget: () => {
|
|
352
353
|
}
|
|
353
354
|
};
|
|
354
355
|
}
|
|
355
|
-
const
|
|
356
|
+
const ht = { keyframes: N, spring: tt, decay: je };
|
|
356
357
|
function Ce(t) {
|
|
357
358
|
if (Array.isArray(t.to))
|
|
358
|
-
return
|
|
359
|
-
if (
|
|
360
|
-
return
|
|
359
|
+
return N;
|
|
360
|
+
if (ht[t.type])
|
|
361
|
+
return ht[t.type];
|
|
361
362
|
const e = new Set(Object.keys(t));
|
|
362
|
-
return e.has("ease") || e.has("duration") && !e.has("dampingRatio") ?
|
|
363
|
-
}
|
|
364
|
-
const
|
|
365
|
-
function
|
|
366
|
-
let e = [], n = [], r = 0,
|
|
367
|
-
const
|
|
368
|
-
schedule: (c,
|
|
369
|
-
const m =
|
|
370
|
-
return
|
|
363
|
+
return e.has("ease") || e.has("duration") && !e.has("dampingRatio") ? N : e.has("dampingRatio") || e.has("stiffness") || e.has("mass") || e.has("damping") || e.has("restSpeed") || e.has("restDelta") ? tt : N;
|
|
364
|
+
}
|
|
365
|
+
const kt = 1 / 60 * 1e3, Re = typeof performance < "u" ? () => performance.now() : () => Date.now(), Tt = typeof window < "u" ? (t) => window.requestAnimationFrame(t) : (t) => setTimeout(() => t(Re()), kt);
|
|
366
|
+
function Ve(t) {
|
|
367
|
+
let e = [], n = [], r = 0, o = !1, a = !1;
|
|
368
|
+
const s = /* @__PURE__ */ new WeakSet(), f = {
|
|
369
|
+
schedule: (c, u = !1, h = !1) => {
|
|
370
|
+
const m = h && o, i = m ? e : n;
|
|
371
|
+
return u && s.add(c), i.indexOf(c) === -1 && (i.push(c), m && o && (r = e.length)), c;
|
|
371
372
|
},
|
|
372
373
|
cancel: (c) => {
|
|
373
|
-
const
|
|
374
|
-
|
|
374
|
+
const u = n.indexOf(c);
|
|
375
|
+
u !== -1 && n.splice(u, 1), s.delete(c);
|
|
375
376
|
},
|
|
376
377
|
process: (c) => {
|
|
377
|
-
if (
|
|
378
|
-
|
|
378
|
+
if (o) {
|
|
379
|
+
a = !0;
|
|
379
380
|
return;
|
|
380
381
|
}
|
|
381
|
-
if (
|
|
382
|
-
for (let
|
|
383
|
-
const
|
|
384
|
-
|
|
382
|
+
if (o = !0, [e, n] = [n, e], n.length = 0, r = e.length, r)
|
|
383
|
+
for (let u = 0; u < r; u++) {
|
|
384
|
+
const h = e[u];
|
|
385
|
+
h(c), s.has(h) && (f.schedule(h), t());
|
|
385
386
|
}
|
|
386
|
-
|
|
387
|
+
o = !1, a && (a = !1, f.process(c));
|
|
387
388
|
}
|
|
388
389
|
};
|
|
389
|
-
return
|
|
390
|
+
return f;
|
|
390
391
|
}
|
|
391
|
-
const
|
|
392
|
-
let
|
|
393
|
-
const
|
|
392
|
+
const Pe = 40;
|
|
393
|
+
let Q = !0, k = !1, X = !1;
|
|
394
|
+
const P = {
|
|
394
395
|
delta: 0,
|
|
395
396
|
timestamp: 0
|
|
396
|
-
},
|
|
397
|
+
}, I = [
|
|
397
398
|
"read",
|
|
398
399
|
"update",
|
|
399
400
|
"preRender",
|
|
400
401
|
"render",
|
|
401
402
|
"postRender"
|
|
402
|
-
],
|
|
403
|
-
const n =
|
|
404
|
-
return t[e] = (r,
|
|
405
|
-
}, {}),
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
|
|
403
|
+
], q = I.reduce((t, e) => (t[e] = Ve(() => k = !0), t), {}), Ee = I.reduce((t, e) => {
|
|
404
|
+
const n = q[e];
|
|
405
|
+
return t[e] = (r, o = !1, a = !1) => (k || Ie(), n.schedule(r, o, a)), t;
|
|
406
|
+
}, {}), ke = I.reduce((t, e) => (t[e] = q[e].cancel, t), {});
|
|
407
|
+
I.reduce((t, e) => (t[e] = () => q[e].process(P), t), {});
|
|
408
|
+
const Te = (t) => q[t].process(P), It = (t) => {
|
|
409
|
+
k = !1, P.delta = Q ? kt : Math.max(Math.min(t - P.timestamp, Pe), 1), P.timestamp = t, X = !0, I.forEach(Te), X = !1, k && (Q = !1, Tt(It));
|
|
409
410
|
}, Ie = () => {
|
|
410
|
-
|
|
411
|
+
k = !0, Q = !0, X || Tt(It);
|
|
411
412
|
};
|
|
412
|
-
function
|
|
413
|
+
function Ft(t, e, n = 0) {
|
|
413
414
|
return t - e - n;
|
|
414
415
|
}
|
|
415
|
-
function
|
|
416
|
-
return r ?
|
|
416
|
+
function Fe(t, e, n = 0, r = !0) {
|
|
417
|
+
return r ? Ft(e + -t, e, n) : e - (t - e) + n;
|
|
417
418
|
}
|
|
418
|
-
function
|
|
419
|
+
function Ne(t, e, n, r) {
|
|
419
420
|
return r ? t >= e + n : t <= -n;
|
|
420
421
|
}
|
|
421
422
|
const De = (t) => {
|
|
422
423
|
const e = ({ delta: n }) => t(n);
|
|
423
424
|
return {
|
|
424
|
-
start: () =>
|
|
425
|
-
stop: () =>
|
|
425
|
+
start: () => Ee.update(e, !0),
|
|
426
|
+
stop: () => ke.update(e)
|
|
426
427
|
};
|
|
427
428
|
};
|
|
428
|
-
function
|
|
429
|
-
var e, n, { from: r, autoplay:
|
|
430
|
-
let { to:
|
|
431
|
-
const
|
|
432
|
-
!((n = (e =
|
|
429
|
+
function Ue(t) {
|
|
430
|
+
var e, n, { from: r, autoplay: o = !0, driver: a = De, elapsed: s = 0, repeat: f = 0, repeatType: c = "loop", repeatDelay: u = 0, onPlay: h, onStop: m, onComplete: i, onRepeat: l, onUpdate: p } = t, y = dt(t, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]);
|
|
431
|
+
let { to: b } = y, d, g = 0, w = y.duration, v, M = !1, x = !0, A;
|
|
432
|
+
const rt = Ce(y);
|
|
433
|
+
!((n = (e = rt).needsInterpolation) === null || n === void 0) && n.call(e, r, b) && (A = Et([0, 100], [r, b], {
|
|
433
434
|
clamp: !1
|
|
434
|
-
}), r = 0,
|
|
435
|
-
const
|
|
436
|
-
function
|
|
437
|
-
|
|
435
|
+
}), r = 0, b = 100);
|
|
436
|
+
const ot = rt(Object.assign(Object.assign({}, y), { from: r, to: b }));
|
|
437
|
+
function Dt() {
|
|
438
|
+
g++, c === "reverse" ? (x = g % 2 === 0, s = Fe(s, w, u, x)) : (s = Ft(s, w, u), c === "mirror" && ot.flipTarget()), M = !1, l && l();
|
|
438
439
|
}
|
|
439
|
-
function
|
|
440
|
-
|
|
440
|
+
function Ut() {
|
|
441
|
+
d.stop(), i && i();
|
|
441
442
|
}
|
|
442
|
-
function
|
|
443
|
-
if (
|
|
444
|
-
const st =
|
|
445
|
-
|
|
443
|
+
function $t(L) {
|
|
444
|
+
if (x || (L = -L), s += L, !M) {
|
|
445
|
+
const st = ot.next(Math.max(0, s));
|
|
446
|
+
v = st.value, A && (v = A(v)), M = x ? st.done : s <= 0;
|
|
446
447
|
}
|
|
447
|
-
|
|
448
|
+
p?.(v), M && (g === 0 && (w ?? (w = s)), g < f ? Ne(s, w, u, x) && Dt() : Ut());
|
|
448
449
|
}
|
|
449
|
-
function
|
|
450
|
-
|
|
450
|
+
function qt() {
|
|
451
|
+
h?.(), d = a($t), d.start();
|
|
451
452
|
}
|
|
452
|
-
return
|
|
453
|
+
return o && qt(), {
|
|
453
454
|
stop: () => {
|
|
454
|
-
m?.(),
|
|
455
|
+
m?.(), d.stop();
|
|
455
456
|
}
|
|
456
457
|
};
|
|
457
458
|
}
|
|
458
|
-
class
|
|
459
|
-
options;
|
|
460
|
-
currentValue;
|
|
461
|
-
velocity = 0;
|
|
462
|
-
isAnimating = !1;
|
|
463
|
-
controls = null;
|
|
459
|
+
class C {
|
|
464
460
|
constructor(e) {
|
|
465
|
-
this
|
|
461
|
+
j(this, "options"), j(this, "currentValue"), j(this, "velocity", 0), j(this, "isAnimating", !1), j(this, "controls", null), j(this, "animate", (n = !1) => {
|
|
462
|
+
!this.isAnimating && this.options.onStart && this.options.onStart(), this.isAnimating = !0;
|
|
463
|
+
const r = n ? this.options.from : this.options.to;
|
|
464
|
+
let o = this.currentValue, a = performance.now();
|
|
465
|
+
this.controls = Ue({
|
|
466
|
+
from: this.currentValue,
|
|
467
|
+
to: r,
|
|
468
|
+
velocity: this.velocity * 1e3,
|
|
469
|
+
// Convert to px/s
|
|
470
|
+
stiffness: this.options.spring.stiffness,
|
|
471
|
+
damping: this.options.spring.damping,
|
|
472
|
+
mass: 1,
|
|
473
|
+
onUpdate: (s) => {
|
|
474
|
+
const f = performance.now(), c = (f - a) / 1e3;
|
|
475
|
+
if (c > 0) {
|
|
476
|
+
const u = (s - o) / c;
|
|
477
|
+
this.velocity = u / 1e3, o = s, a = f;
|
|
478
|
+
}
|
|
479
|
+
this.currentValue = s, this.options.onUpdate(s);
|
|
480
|
+
},
|
|
481
|
+
onComplete: () => {
|
|
482
|
+
this.currentValue = r, this.isAnimating = !1, this.controls = null, this.velocity = 0, this.options.onComplete();
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}), this.options = {
|
|
466
486
|
from: e.from ?? 0,
|
|
467
487
|
to: e.to ?? 1,
|
|
468
488
|
spring: e.spring ?? { stiffness: 100, damping: 10 },
|
|
@@ -473,31 +493,6 @@ class T {
|
|
|
473
493
|
onStart: e.onStart
|
|
474
494
|
}, this.currentValue = this.options.from;
|
|
475
495
|
}
|
|
476
|
-
animate = (e = !1) => {
|
|
477
|
-
!this.isAnimating && this.options.onStart && this.options.onStart(), this.isAnimating = !0;
|
|
478
|
-
const n = e ? this.options.from : this.options.to;
|
|
479
|
-
let r = this.currentValue, s = performance.now();
|
|
480
|
-
this.controls = Pe({
|
|
481
|
-
from: this.currentValue,
|
|
482
|
-
to: n,
|
|
483
|
-
velocity: this.velocity * 1e3,
|
|
484
|
-
// Convert to px/s
|
|
485
|
-
stiffness: this.options.spring.stiffness,
|
|
486
|
-
damping: this.options.spring.damping,
|
|
487
|
-
mass: 1,
|
|
488
|
-
onUpdate: (i) => {
|
|
489
|
-
const o = performance.now(), l = (o - s) / 1e3;
|
|
490
|
-
if (l > 0) {
|
|
491
|
-
const c = (i - r) / l;
|
|
492
|
-
this.velocity = c / 1e3, r = i, s = o;
|
|
493
|
-
}
|
|
494
|
-
this.currentValue = i, this.options.onUpdate(i);
|
|
495
|
-
},
|
|
496
|
-
onComplete: () => {
|
|
497
|
-
this.currentValue = n, this.isAnimating = !1, this.controls = null, this.velocity = 0, this.options.onComplete();
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
};
|
|
501
496
|
// Animation control methods
|
|
502
497
|
forward() {
|
|
503
498
|
this.stop(), this.animate(!1);
|
|
@@ -547,196 +542,205 @@ class T {
|
|
|
547
542
|
}
|
|
548
543
|
// Static factory method
|
|
549
544
|
static fromState(e, n) {
|
|
550
|
-
const r = new
|
|
545
|
+
const r = new C(n);
|
|
551
546
|
return r.setValue(e.position), r.setVelocity(e.velocity), r;
|
|
552
547
|
}
|
|
553
548
|
}
|
|
554
|
-
function
|
|
555
|
-
let n = null, r = null,
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
549
|
+
function $e(t, e) {
|
|
550
|
+
let n = null, r = null, o = null, a = null, s = !1;
|
|
551
|
+
const f = async (u) => {
|
|
552
|
+
var h;
|
|
553
|
+
if (n && n.getIsAnimating() && !s) {
|
|
554
|
+
const m = n.getCurrentState();
|
|
555
|
+
n.stop(), r && (r.remove(), r = null), s = !0;
|
|
556
|
+
const i = t();
|
|
557
|
+
if (!i.out) return;
|
|
558
|
+
const l = await Promise.resolve(i.out(u));
|
|
559
|
+
n = C.fromState(m, {
|
|
564
560
|
from: 1,
|
|
565
561
|
to: 0,
|
|
566
|
-
spring:
|
|
567
|
-
onStart:
|
|
568
|
-
onUpdate: (
|
|
569
|
-
|
|
562
|
+
spring: l.spring,
|
|
563
|
+
onStart: l.onStart,
|
|
564
|
+
onUpdate: (p) => {
|
|
565
|
+
var y;
|
|
566
|
+
(y = l.tick) == null || y.call(l, p);
|
|
570
567
|
},
|
|
571
568
|
onComplete: () => {
|
|
572
|
-
|
|
569
|
+
var p;
|
|
570
|
+
n = null, s = !1, (p = l.onEnd) == null || p.call(l);
|
|
573
571
|
}
|
|
574
572
|
}), n.backward();
|
|
575
573
|
return;
|
|
576
574
|
}
|
|
577
575
|
if (!n || !n.getIsAnimating()) {
|
|
578
|
-
|
|
579
|
-
const
|
|
580
|
-
if (!
|
|
581
|
-
const
|
|
582
|
-
|
|
576
|
+
s = !0;
|
|
577
|
+
const m = t();
|
|
578
|
+
if (!m.in) return;
|
|
579
|
+
const i = await Promise.resolve(m.in(u));
|
|
580
|
+
(h = i.prepare) == null || h.call(i, u), n = new C({
|
|
583
581
|
from: 0,
|
|
584
582
|
to: 1,
|
|
585
|
-
spring:
|
|
586
|
-
onStart:
|
|
587
|
-
onUpdate: (
|
|
588
|
-
|
|
583
|
+
spring: i.spring,
|
|
584
|
+
onStart: i.onStart,
|
|
585
|
+
onUpdate: (l) => {
|
|
586
|
+
var p;
|
|
587
|
+
(p = i.tick) == null || p.call(i, l);
|
|
589
588
|
},
|
|
590
589
|
onComplete: () => {
|
|
591
|
-
|
|
590
|
+
var l;
|
|
591
|
+
n = null, s = !1, (l = i.onEnd) == null || l.call(i);
|
|
592
592
|
}
|
|
593
593
|
}), n.forward();
|
|
594
594
|
}
|
|
595
595
|
};
|
|
596
|
-
function c(
|
|
597
|
-
const
|
|
598
|
-
!
|
|
596
|
+
function c(u) {
|
|
597
|
+
const h = () => {
|
|
598
|
+
!o || !r || (a && o.contains(a) ? o.insertBefore(r, a) : o.appendChild(r));
|
|
599
599
|
}, m = () => {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
600
|
+
var l;
|
|
601
|
+
r && (r.remove(), r = null), n = null, s = !1, (l = e?.onCleanupEnd) == null || l.call(e);
|
|
602
|
+
}, i = t();
|
|
603
|
+
if (r = u.cloneNode(!0), n && n.getIsAnimating() && s) {
|
|
604
|
+
const l = n.getCurrentState();
|
|
605
|
+
if (n.stop(), s = !1, !i.in) {
|
|
605
606
|
r = null, m();
|
|
606
607
|
return;
|
|
607
608
|
}
|
|
608
|
-
Promise.resolve(
|
|
609
|
-
|
|
610
|
-
|
|
609
|
+
Promise.resolve(i.in(r)).then(async (p) => {
|
|
610
|
+
var y;
|
|
611
|
+
const b = r && await ((y = i.out) == null ? void 0 : y.call(i, r));
|
|
612
|
+
b != null && b.prepare && r && b.prepare(r), h(), n = C.fromState(l, {
|
|
611
613
|
from: 0,
|
|
612
614
|
to: 1,
|
|
613
|
-
spring:
|
|
614
|
-
onStart:
|
|
615
|
-
onUpdate: (
|
|
616
|
-
|
|
615
|
+
spring: p.spring,
|
|
616
|
+
onStart: p.onStart,
|
|
617
|
+
onUpdate: (d) => {
|
|
618
|
+
var g;
|
|
619
|
+
(g = p.tick) == null || g.call(p, d);
|
|
617
620
|
},
|
|
618
621
|
onComplete: () => {
|
|
619
|
-
|
|
622
|
+
var d;
|
|
623
|
+
(d = p.onEnd) == null || d.call(p), m();
|
|
620
624
|
}
|
|
621
625
|
}), n.backward();
|
|
622
626
|
});
|
|
623
627
|
return;
|
|
624
628
|
}
|
|
625
|
-
if (!n || !n.getIsAnimating() || !
|
|
626
|
-
if (
|
|
629
|
+
if (!n || !n.getIsAnimating() || !s) {
|
|
630
|
+
if (s = !1, !i.out) {
|
|
627
631
|
r = null, m();
|
|
628
632
|
return;
|
|
629
633
|
}
|
|
630
|
-
Promise.resolve(
|
|
631
|
-
|
|
634
|
+
Promise.resolve(i.out(r)).then((l) => {
|
|
635
|
+
var p;
|
|
636
|
+
r && ((p = l.prepare) == null || p.call(l, r)), h(), n = new C({
|
|
632
637
|
from: 1,
|
|
633
638
|
to: 0,
|
|
634
|
-
spring:
|
|
635
|
-
onStart:
|
|
636
|
-
onUpdate: (
|
|
637
|
-
|
|
639
|
+
spring: l.spring,
|
|
640
|
+
onStart: l.onStart,
|
|
641
|
+
onUpdate: (y) => {
|
|
642
|
+
var b;
|
|
643
|
+
(b = l.tick) == null || b.call(l, y);
|
|
638
644
|
},
|
|
639
645
|
onComplete: () => {
|
|
640
|
-
|
|
646
|
+
var y;
|
|
647
|
+
(y = l.onEnd) == null || y.call(l), m();
|
|
641
648
|
}
|
|
642
649
|
}), n.forward();
|
|
643
650
|
});
|
|
644
651
|
}
|
|
645
652
|
}
|
|
646
|
-
return (
|
|
647
|
-
c(
|
|
653
|
+
return (u) => u ? (o = u.parentElement, a = u.nextElementSibling, t().in && f(u), () => {
|
|
654
|
+
c(u);
|
|
648
655
|
}) : void 0;
|
|
649
656
|
}
|
|
650
|
-
const
|
|
651
|
-
function
|
|
652
|
-
|
|
653
|
-
let n =
|
|
654
|
-
return n || (n =
|
|
655
|
-
() => {
|
|
656
|
-
const r = J.get(t);
|
|
657
|
-
return r || (console.warn(`Transition "${String(t)}" not found`), {});
|
|
658
|
-
},
|
|
657
|
+
const Y = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
|
|
658
|
+
function qe(t, e) {
|
|
659
|
+
Y.set(t, e);
|
|
660
|
+
let n = Z.get(t);
|
|
661
|
+
return n || (n = $e(
|
|
662
|
+
() => Y.get(t) || (console.warn(`Transition "${String(t)}" not found`), {}),
|
|
659
663
|
{
|
|
660
|
-
onCleanupEnd: () =>
|
|
664
|
+
onCleanupEnd: () => Le(t)
|
|
661
665
|
}
|
|
662
|
-
),
|
|
666
|
+
), Z.set(t, n), n);
|
|
663
667
|
}
|
|
664
|
-
function
|
|
665
|
-
|
|
668
|
+
function Le(t) {
|
|
669
|
+
Y.delete(t), Z.delete(t);
|
|
666
670
|
}
|
|
667
|
-
function
|
|
668
|
-
return
|
|
671
|
+
function Be(t) {
|
|
672
|
+
return qe(t.key, {
|
|
669
673
|
in: t.in,
|
|
670
674
|
out: t.out
|
|
671
675
|
});
|
|
672
676
|
}
|
|
673
|
-
function
|
|
677
|
+
function We(t) {
|
|
674
678
|
let e = null;
|
|
675
679
|
const n = [...t.transitions], r = [];
|
|
676
|
-
for (const
|
|
677
|
-
|
|
678
|
-
(
|
|
680
|
+
for (const i of t.transitions)
|
|
681
|
+
i.symmetric && (n.some(
|
|
682
|
+
(l) => l.from === i.to && l.to === i.from
|
|
679
683
|
) || r.push({
|
|
680
|
-
from:
|
|
681
|
-
to:
|
|
682
|
-
transition:
|
|
684
|
+
from: i.to,
|
|
685
|
+
to: i.from,
|
|
686
|
+
transition: i.transition
|
|
683
687
|
// Don't add symmetric flag to the reverse to avoid infinite loop
|
|
684
688
|
}));
|
|
685
689
|
n.push(...r);
|
|
686
|
-
let s = null;
|
|
687
|
-
const i = /* @__PURE__ */ new Map();
|
|
688
690
|
let o = null;
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
const a = /* @__PURE__ */ new Map();
|
|
692
|
+
let s = null;
|
|
693
|
+
const f = () => {
|
|
694
|
+
o && s && a.set(s, {
|
|
695
|
+
x: o.scrollLeft,
|
|
696
|
+
y: o.scrollTop
|
|
693
697
|
});
|
|
694
|
-
}, c = (
|
|
695
|
-
|
|
698
|
+
}, c = (i, l) => {
|
|
699
|
+
o || (o = Lt(i), o.addEventListener("scroll", f, {
|
|
696
700
|
passive: !0
|
|
697
|
-
})),
|
|
698
|
-
},
|
|
699
|
-
const
|
|
701
|
+
})), s = l;
|
|
702
|
+
}, u = () => {
|
|
703
|
+
const i = e?.from, l = e?.to, p = i && a.has(i) ? a.get(i) : { x: 0, y: 0 }, y = l && a.has(l) ? a.get(l) : { x: 0, y: 0 };
|
|
700
704
|
return {
|
|
701
|
-
x: -
|
|
702
|
-
y: -
|
|
705
|
+
x: -y.x + p.x,
|
|
706
|
+
y: -y.y + p.y
|
|
703
707
|
};
|
|
704
708
|
};
|
|
705
|
-
function
|
|
706
|
-
if (e
|
|
707
|
-
const
|
|
709
|
+
function h() {
|
|
710
|
+
if (e != null && e.from && e != null && e.to) {
|
|
711
|
+
const i = Ge(
|
|
708
712
|
e.from,
|
|
709
713
|
e.to,
|
|
710
714
|
n
|
|
711
|
-
) || t.defaultTransition,
|
|
712
|
-
|
|
713
|
-
(
|
|
714
|
-
),
|
|
715
|
-
(
|
|
715
|
+
) || t.defaultTransition, l = { scrollOffset: u() };
|
|
716
|
+
i && (i.out && e.outResolve && e.outResolve(
|
|
717
|
+
(p) => i.out(p, l)
|
|
718
|
+
), i.in && e.inResolve && e.inResolve(
|
|
719
|
+
(p) => i.in(p, l)
|
|
716
720
|
)), e = null;
|
|
717
721
|
}
|
|
718
722
|
}
|
|
719
|
-
const m = async (
|
|
720
|
-
e.outResolve =
|
|
721
|
-
})) : (e.to =
|
|
722
|
-
e.inResolve =
|
|
723
|
+
const m = async (i, l) => l === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), l === "out" ? (e.from = i, new Promise((p) => {
|
|
724
|
+
e.outResolve = p, h();
|
|
725
|
+
})) : (e.to = i, new Promise((p) => {
|
|
726
|
+
e.inResolve = p, h();
|
|
723
727
|
})));
|
|
724
|
-
return (
|
|
725
|
-
key:
|
|
726
|
-
in: async (
|
|
727
|
-
out: async (
|
|
728
|
+
return (i) => ({
|
|
729
|
+
key: i,
|
|
730
|
+
in: async (l) => (c(l, i), (await m(i, "in"))(l)),
|
|
731
|
+
out: async (l) => (await m(i, "out"))(l)
|
|
728
732
|
});
|
|
729
733
|
}
|
|
730
|
-
function
|
|
734
|
+
function Ge(t, e, n) {
|
|
731
735
|
for (const r of n)
|
|
732
|
-
if (
|
|
736
|
+
if (F(t, r.from) && F(e, r.to))
|
|
733
737
|
return r.transition;
|
|
734
738
|
for (const r of n)
|
|
735
|
-
if ((r.from === "*" ||
|
|
739
|
+
if ((r.from === "*" || F(t, r.from)) && (r.to === "*" || F(e, r.to)))
|
|
736
740
|
return r.transition;
|
|
737
741
|
return null;
|
|
738
742
|
}
|
|
739
|
-
function
|
|
743
|
+
function F(t, e) {
|
|
740
744
|
if (e === "*")
|
|
741
745
|
return !0;
|
|
742
746
|
if (e.endsWith("/*")) {
|
|
@@ -745,26 +749,26 @@ function D(t, e) {
|
|
|
745
749
|
}
|
|
746
750
|
return t === e;
|
|
747
751
|
}
|
|
748
|
-
const
|
|
749
|
-
const t =
|
|
752
|
+
const He = Be, Nt = Bt(null), ze = Nt.Provider, Je = () => {
|
|
753
|
+
const t = Wt(Nt);
|
|
750
754
|
if (!t)
|
|
751
755
|
throw new Error("useSsgoi must be used within SsgoiProvider");
|
|
752
756
|
return t;
|
|
753
|
-
},
|
|
754
|
-
const n =
|
|
755
|
-
() =>
|
|
757
|
+
}, Ye = ({ config: t, children: e }) => {
|
|
758
|
+
const n = Gt(
|
|
759
|
+
() => We(t),
|
|
756
760
|
[t]
|
|
757
761
|
);
|
|
758
|
-
return /* @__PURE__ */ mt(
|
|
762
|
+
return /* @__PURE__ */ mt(ze, { value: n, children: e });
|
|
759
763
|
}, Ze = ({
|
|
760
764
|
children: t,
|
|
761
765
|
id: e
|
|
762
766
|
}) => {
|
|
763
|
-
const n =
|
|
764
|
-
return /* @__PURE__ */ mt("div", { ref:
|
|
767
|
+
const n = Je();
|
|
768
|
+
return /* @__PURE__ */ mt("div", { ref: He(n(e)), "data-ssgoi-transition": e, children: t });
|
|
765
769
|
};
|
|
766
770
|
export {
|
|
767
|
-
|
|
771
|
+
Ye as Ssgoi,
|
|
768
772
|
Ze as SsgoiTransition,
|
|
769
|
-
|
|
773
|
+
He as transition
|
|
770
774
|
};
|