@ssgoi/core 0.0.2 → 2.0.0
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/README.md +252 -23
- package/dist/animator.d.ts +28 -17
- package/dist/animator.d.ts.map +1 -1
- package/dist/create-transition-callback.d.ts +3 -32
- package/dist/create-transition-callback.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +310 -195
- package/dist/presets/index.cjs +1 -0
- package/dist/presets/index.d.ts +16 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +35 -0
- package/dist/transition-strategy.d.ts +60 -0
- package/dist/transition-strategy.d.ts.map +1 -0
- package/dist/transition.d.ts +7 -3
- package/dist/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +2 -1
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +2 -0
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +27 -0
- package/dist/transitions/fly.d.ts.map +1 -0
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.d.ts +1 -0
- package/dist/transitions/index.d.ts.map +1 -1
- package/dist/transitions/index.js +175 -111
- package/dist/transitions/rotate.d.ts +3 -0
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +3 -3
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +3 -1
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.d.ts +8 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +1 -1
- package/dist/view-transitions/index.d.ts +1 -1
- package/dist/view-transitions/index.js +117 -126
- package/dist/view-transitions/scroll.d.ts +8 -0
- package/dist/view-transitions/scroll.d.ts.map +1 -0
- package/package.json +29 -8
package/dist/index.js
CHANGED
|
@@ -1,41 +1,110 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { animate as
|
|
5
|
-
import { g as
|
|
6
|
-
class
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var T = (e, t, n) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var y = (e, t, n) => T(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { animate as R } from "popmotion";
|
|
5
|
+
import { g as P } from "./utils-DR41YsAh.js";
|
|
6
|
+
class V {
|
|
7
7
|
constructor(t) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
y(this, "options");
|
|
9
|
+
y(this, "currentValue");
|
|
10
|
+
y(this, "velocity");
|
|
11
|
+
y(this, "isAnimating", !1);
|
|
12
|
+
y(this, "controls", null);
|
|
13
|
+
// For object animations
|
|
14
|
+
y(this, "animationMap", null);
|
|
15
|
+
y(this, "activeAnimations", /* @__PURE__ */ new Set());
|
|
16
|
+
y(this, "completedAnimations", /* @__PURE__ */ new Set());
|
|
17
|
+
y(this, "updatedProperties", /* @__PURE__ */ new Set());
|
|
18
|
+
y(this, "animate", (t = !1) => {
|
|
14
19
|
!this.isAnimating && this.options.onStart && this.options.onStart(), this.isAnimating = !0;
|
|
15
20
|
const n = t ? this.options.from : this.options.to;
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
if (typeof this.currentValue == "object" && this.currentValue !== null) {
|
|
22
|
+
this.animateObject(n, t);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let i = this.currentValue, a = performance.now();
|
|
26
|
+
const u = {
|
|
18
27
|
from: this.currentValue,
|
|
19
28
|
to: n,
|
|
20
|
-
velocity: this.velocity * 1e3,
|
|
21
|
-
// Convert to px/s
|
|
22
29
|
stiffness: this.options.spring.stiffness,
|
|
23
30
|
damping: this.options.spring.damping,
|
|
24
|
-
mass: 1
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
mass: 1
|
|
32
|
+
};
|
|
33
|
+
typeof this.velocity == "number" && (u.velocity = this.velocity * 1e3), this.controls = R({
|
|
34
|
+
...u,
|
|
35
|
+
onUpdate: (l) => {
|
|
36
|
+
const m = performance.now(), p = (m - a) / 1e3;
|
|
37
|
+
if (p > 0) {
|
|
38
|
+
if (typeof l == "number" && typeof i == "number") {
|
|
39
|
+
const f = (l - i) / p;
|
|
40
|
+
this.velocity = f / 1e3;
|
|
41
|
+
} else if (typeof l == "object" && l !== null) {
|
|
42
|
+
const f = {};
|
|
43
|
+
Object.keys(l).forEach((d) => {
|
|
44
|
+
const r = l[d], o = i[d];
|
|
45
|
+
if (typeof r == "number" && typeof o == "number") {
|
|
46
|
+
const c = (r - o) / p;
|
|
47
|
+
f[d] = c / 1e3;
|
|
48
|
+
}
|
|
49
|
+
}), this.velocity = f;
|
|
50
|
+
}
|
|
51
|
+
i = l, a = m;
|
|
30
52
|
}
|
|
31
|
-
this.currentValue =
|
|
53
|
+
this.currentValue = l, this.options.onUpdate(l);
|
|
32
54
|
},
|
|
33
55
|
onComplete: () => {
|
|
34
|
-
this.currentValue = n, this.isAnimating = !1, this.controls = null, this.velocity
|
|
56
|
+
this.currentValue = n, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((l) => {
|
|
57
|
+
this.velocity[l] = 0;
|
|
58
|
+
}) : this.velocity = 0, this.options.onComplete();
|
|
35
59
|
}
|
|
36
60
|
});
|
|
37
61
|
});
|
|
38
|
-
this
|
|
62
|
+
y(this, "animateObject", (t, n) => {
|
|
63
|
+
const i = this.currentValue, a = Object.keys(i);
|
|
64
|
+
this.animationMap = /* @__PURE__ */ new Map(), this.activeAnimations.clear(), this.completedAnimations.clear(), this.updatedProperties.clear();
|
|
65
|
+
const u = { ...i }, l = {};
|
|
66
|
+
let m = !1;
|
|
67
|
+
const p = () => {
|
|
68
|
+
const f = a.filter((r) => !this.completedAnimations.has(r));
|
|
69
|
+
if (f.every((r) => this.updatedProperties.has(r)) && f.length > 0) {
|
|
70
|
+
if (typeof this.velocity == "object" && this.velocity) {
|
|
71
|
+
const r = performance.now();
|
|
72
|
+
Object.keys(u).forEach((o) => {
|
|
73
|
+
if (l[o]) {
|
|
74
|
+
const c = (r - l[o]) / 1e3, s = this.currentValue[o], h = u[o];
|
|
75
|
+
typeof s == "number" && typeof h == "number" && c > 0 && (this.velocity[o] = (h - s) / c / 1e3);
|
|
76
|
+
}
|
|
77
|
+
l[o] = r;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
this.currentValue = { ...u }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !m && this.options.onStart && (m = !0, this.options.onStart());
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
a.forEach((f) => {
|
|
84
|
+
this.activeAnimations.add(f);
|
|
85
|
+
const d = {
|
|
86
|
+
from: i[f],
|
|
87
|
+
to: t[f],
|
|
88
|
+
stiffness: this.options.spring.stiffness,
|
|
89
|
+
damping: this.options.spring.damping,
|
|
90
|
+
mass: 1
|
|
91
|
+
};
|
|
92
|
+
typeof this.velocity == "object" && this.velocity && f in this.velocity && (d.velocity = this.velocity[f] * 1e3);
|
|
93
|
+
const r = R({
|
|
94
|
+
...d,
|
|
95
|
+
onUpdate: (o) => {
|
|
96
|
+
u[f] = o, this.updatedProperties.add(f), p();
|
|
97
|
+
},
|
|
98
|
+
onComplete: () => {
|
|
99
|
+
this.completedAnimations.add(f), this.updatedProperties.delete(f), this.completedAnimations.size === a.length && (this.currentValue = t, this.isAnimating = !1, this.animationMap = null, typeof this.velocity == "object" && this.velocity && Object.keys(this.velocity).forEach((o) => {
|
|
100
|
+
this.velocity[o] = 0;
|
|
101
|
+
}), this.options.onComplete());
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
this.animationMap.set(f, r);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
if (this.options = {
|
|
39
108
|
from: t.from ?? 0,
|
|
40
109
|
to: t.to ?? 1,
|
|
41
110
|
spring: t.spring ?? { stiffness: 100, damping: 10 },
|
|
@@ -44,7 +113,13 @@ class v {
|
|
|
44
113
|
onComplete: t.onComplete ?? (() => {
|
|
45
114
|
}),
|
|
46
115
|
onStart: t.onStart
|
|
47
|
-
}, this.currentValue = this.options.from
|
|
116
|
+
}, this.currentValue = this.options.from, typeof this.options.from == "object" && this.options.from !== null) {
|
|
117
|
+
const n = {};
|
|
118
|
+
Object.keys(this.options.from).forEach((i) => {
|
|
119
|
+
n[i] = 0;
|
|
120
|
+
}), this.velocity = n;
|
|
121
|
+
} else
|
|
122
|
+
this.velocity = 0;
|
|
48
123
|
}
|
|
49
124
|
// Animation control methods
|
|
50
125
|
forward() {
|
|
@@ -56,12 +131,17 @@ class v {
|
|
|
56
131
|
reverse() {
|
|
57
132
|
const t = this.options.from;
|
|
58
133
|
if (this.options.from = this.options.to, this.options.to = t, this.isAnimating) {
|
|
59
|
-
const n = this.
|
|
134
|
+
const n = this.shouldReverse();
|
|
60
135
|
this.stop(), this.animate(!n);
|
|
61
136
|
}
|
|
62
137
|
}
|
|
138
|
+
shouldReverse() {
|
|
139
|
+
return typeof this.currentValue == "number" && typeof this.options.from == "number" && typeof this.options.to == "number" ? this.currentValue > (this.options.from + this.options.to) / 2 : !1;
|
|
140
|
+
}
|
|
63
141
|
stop() {
|
|
64
|
-
this.isAnimating = !1, this.controls && (this.controls.stop(), this.controls = null)
|
|
142
|
+
this.isAnimating = !1, this.controls && (this.controls.stop(), this.controls = null), this.animationMap && (this.animationMap.forEach((t) => {
|
|
143
|
+
t.stop();
|
|
144
|
+
}), this.animationMap.clear(), this.animationMap = null), this.updatedProperties.clear();
|
|
65
145
|
}
|
|
66
146
|
// State getters
|
|
67
147
|
getVelocity() {
|
|
@@ -76,7 +156,9 @@ class v {
|
|
|
76
156
|
getCurrentState() {
|
|
77
157
|
return {
|
|
78
158
|
position: this.currentValue,
|
|
79
|
-
velocity: this.velocity
|
|
159
|
+
velocity: this.velocity,
|
|
160
|
+
from: this.options.from,
|
|
161
|
+
to: this.options.to
|
|
80
162
|
};
|
|
81
163
|
}
|
|
82
164
|
// State setters
|
|
@@ -89,223 +171,256 @@ class v {
|
|
|
89
171
|
// Configuration
|
|
90
172
|
updateOptions(t) {
|
|
91
173
|
if (this.options = { ...this.options, ...t }, this.isAnimating && this.controls) {
|
|
92
|
-
const n = this.
|
|
174
|
+
const n = this.shouldReverse();
|
|
93
175
|
this.stop(), this.animate(!n);
|
|
94
176
|
}
|
|
95
177
|
}
|
|
96
178
|
// Static factory method
|
|
97
179
|
static fromState(t, n) {
|
|
98
|
-
const
|
|
99
|
-
return
|
|
180
|
+
const i = new V(n);
|
|
181
|
+
return i.setValue(t.position), i.setVelocity(t.velocity), i;
|
|
100
182
|
}
|
|
101
183
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
onComplete: () => {
|
|
122
|
-
var i;
|
|
123
|
-
n = null, l = !1, (i = r.onEnd) == null || i.call(r);
|
|
124
|
-
}
|
|
125
|
-
}), n.backward();
|
|
126
|
-
return;
|
|
184
|
+
const x = Symbol.for("TRANSITION_STRATEGY"), M = (e) => ({
|
|
185
|
+
runIn: async (t) => {
|
|
186
|
+
const { currentAnimation: n } = e;
|
|
187
|
+
if (n && n.direction === "out") {
|
|
188
|
+
const l = n.animator.getCurrentState();
|
|
189
|
+
if (n.animator.stop(), t.out) {
|
|
190
|
+
const m = await t.out, { from: p = 1, to: f = 0 } = m;
|
|
191
|
+
return {
|
|
192
|
+
config: m,
|
|
193
|
+
state: l,
|
|
194
|
+
from: p,
|
|
195
|
+
// OUT animation's from
|
|
196
|
+
to: f,
|
|
197
|
+
// OUT animation's to
|
|
198
|
+
direction: "backward"
|
|
199
|
+
// Will actually go 0→1
|
|
200
|
+
};
|
|
201
|
+
}
|
|
127
202
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const e = await Promise.resolve(m.in(f));
|
|
133
|
-
(h = e.prepare) == null || h.call(e, f), n = new v({
|
|
203
|
+
const i = await t.in;
|
|
204
|
+
if (!i)
|
|
205
|
+
return {
|
|
206
|
+
state: { position: 0, velocity: 0 },
|
|
134
207
|
from: 0,
|
|
135
208
|
to: 1,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
209
|
+
direction: "forward"
|
|
210
|
+
};
|
|
211
|
+
const { from: a = 0, to: u = 1 } = i;
|
|
212
|
+
return {
|
|
213
|
+
config: i,
|
|
214
|
+
state: { position: a, velocity: 0 },
|
|
215
|
+
from: a,
|
|
216
|
+
to: u,
|
|
217
|
+
direction: "forward"
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
runOut: async (t) => {
|
|
221
|
+
const { currentAnimation: n } = e;
|
|
222
|
+
if (n && n.direction === "in") {
|
|
223
|
+
const l = n.animator.getCurrentState();
|
|
224
|
+
if (n.animator.stop(), t.in) {
|
|
225
|
+
const m = await t.in, { from: p = 0, to: f = 1 } = m;
|
|
226
|
+
return {
|
|
227
|
+
config: m,
|
|
228
|
+
state: {
|
|
229
|
+
position: l.position,
|
|
230
|
+
velocity: l.velocity
|
|
231
|
+
},
|
|
232
|
+
from: p,
|
|
233
|
+
// IN animation's from
|
|
234
|
+
to: f,
|
|
235
|
+
// IN animation's to
|
|
236
|
+
direction: "backward"
|
|
237
|
+
// Will actually go 1→0
|
|
238
|
+
};
|
|
239
|
+
}
|
|
147
240
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
241
|
+
const i = await t.out;
|
|
242
|
+
if (!i)
|
|
243
|
+
return {
|
|
244
|
+
state: { position: 1, velocity: 0 },
|
|
245
|
+
from: 1,
|
|
246
|
+
to: 0,
|
|
247
|
+
direction: "forward"
|
|
248
|
+
};
|
|
249
|
+
const { from: a = 1, to: u = 0 } = i;
|
|
250
|
+
return {
|
|
251
|
+
config: i,
|
|
252
|
+
state: { position: a, velocity: 0 },
|
|
253
|
+
from: a,
|
|
254
|
+
to: u,
|
|
255
|
+
direction: "forward"
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
function U(e, t) {
|
|
260
|
+
var d;
|
|
261
|
+
let n = null, i = null, a = null, u = null;
|
|
262
|
+
const l = {
|
|
263
|
+
get currentAnimation() {
|
|
264
|
+
return n;
|
|
265
|
+
}
|
|
266
|
+
}, m = ((d = t == null ? void 0 : t.strategy) == null ? void 0 : d.call(t, l)) || M(l), p = async (r) => {
|
|
267
|
+
var g, b;
|
|
268
|
+
i && (i.remove(), i = null);
|
|
269
|
+
const o = e(), c = {
|
|
270
|
+
in: o.in && Promise.resolve(o.in(r)),
|
|
271
|
+
out: o.out && Promise.resolve(o.out(r))
|
|
272
|
+
}, s = await m.runIn(c);
|
|
273
|
+
if (!s.config)
|
|
274
|
+
return;
|
|
275
|
+
(b = (g = s.config).prepare) == null || b.call(g, r);
|
|
276
|
+
const h = V.fromState(s.state, {
|
|
277
|
+
from: s.from,
|
|
278
|
+
to: s.to,
|
|
279
|
+
spring: s.config.spring,
|
|
280
|
+
onStart: s.config.onStart,
|
|
281
|
+
onUpdate: s.config.tick,
|
|
282
|
+
onComplete: () => {
|
|
283
|
+
var v, w;
|
|
284
|
+
n = null, (w = (v = s.config) == null ? void 0 : v.onEnd) == null || w.call(v);
|
|
161
285
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
(A = i.tick) == null || A.call(i, y);
|
|
173
|
-
},
|
|
174
|
-
onComplete: () => {
|
|
175
|
-
var y;
|
|
176
|
-
(y = i.onEnd) == null || y.call(i), m();
|
|
177
|
-
}
|
|
178
|
-
}), n.backward();
|
|
179
|
-
});
|
|
286
|
+
});
|
|
287
|
+
n = { animator: h, direction: "in" }, s.direction === "forward" ? h.forward() : h.backward();
|
|
288
|
+
}, f = async (r) => {
|
|
289
|
+
var b, v;
|
|
290
|
+
i = r;
|
|
291
|
+
const o = e(), c = {
|
|
292
|
+
in: o.in && Promise.resolve(o.in(r)),
|
|
293
|
+
out: o.out && Promise.resolve(o.out(r))
|
|
294
|
+
}, s = await m.runOut(c);
|
|
295
|
+
if (!s.config)
|
|
180
296
|
return;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
297
|
+
(v = (b = s.config).prepare) == null || v.call(b, r), g();
|
|
298
|
+
const h = V.fromState(s.state, {
|
|
299
|
+
from: s.from,
|
|
300
|
+
to: s.to,
|
|
301
|
+
spring: s.config.spring,
|
|
302
|
+
onStart: s.config.onStart,
|
|
303
|
+
onUpdate: s.config.tick,
|
|
304
|
+
onComplete: () => {
|
|
305
|
+
var w, E, O;
|
|
306
|
+
(E = (w = s.config) == null ? void 0 : w.onEnd) == null || E.call(w), i && (i.remove(), i = null), n = null, (O = t == null ? void 0 : t.onCleanupEnd) == null || O.call(t);
|
|
186
307
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
to: 0,
|
|
192
|
-
spring: r.spring,
|
|
193
|
-
onStart: r.onStart,
|
|
194
|
-
onUpdate: (a) => {
|
|
195
|
-
var p;
|
|
196
|
-
(p = r.tick) == null || p.call(r, a);
|
|
197
|
-
},
|
|
198
|
-
onComplete: () => {
|
|
199
|
-
var a;
|
|
200
|
-
(a = r.onEnd) == null || a.call(r), m();
|
|
201
|
-
}
|
|
202
|
-
}), n.forward();
|
|
203
|
-
});
|
|
308
|
+
});
|
|
309
|
+
n = { animator: h, direction: "out" }, s.direction === "forward" ? h.forward() : h.backward();
|
|
310
|
+
function g() {
|
|
311
|
+
!a || !i || (u && a.contains(u) ? a.insertBefore(i, u) : a.appendChild(i));
|
|
204
312
|
}
|
|
205
|
-
}
|
|
206
|
-
return (
|
|
207
|
-
|
|
208
|
-
|
|
313
|
+
};
|
|
314
|
+
return (r) => {
|
|
315
|
+
if (r)
|
|
316
|
+
return a = r.parentElement, u = r.nextElementSibling, p(r), () => {
|
|
317
|
+
const o = r.cloneNode(!0);
|
|
318
|
+
f(o);
|
|
319
|
+
};
|
|
320
|
+
};
|
|
209
321
|
}
|
|
210
|
-
const
|
|
211
|
-
function
|
|
212
|
-
|
|
213
|
-
let
|
|
214
|
-
return
|
|
322
|
+
const A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
323
|
+
function I(e, t, n) {
|
|
324
|
+
A.set(e, t);
|
|
325
|
+
let i = C.get(e);
|
|
326
|
+
return i || (i = U(
|
|
215
327
|
() => {
|
|
216
|
-
const
|
|
217
|
-
return
|
|
328
|
+
const a = A.get(e);
|
|
329
|
+
return a || (console.warn(`Transition "${String(e)}" not found`), {});
|
|
218
330
|
},
|
|
219
331
|
{
|
|
220
|
-
|
|
332
|
+
strategy: n,
|
|
333
|
+
onCleanupEnd: () => D(e)
|
|
221
334
|
}
|
|
222
|
-
),
|
|
335
|
+
), C.set(e, i), i);
|
|
223
336
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
337
|
+
function D(e) {
|
|
338
|
+
A.delete(e), C.delete(e);
|
|
226
339
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
229
|
-
in:
|
|
230
|
-
out:
|
|
231
|
-
});
|
|
340
|
+
function Y(e) {
|
|
341
|
+
return I(e.key, {
|
|
342
|
+
in: e.in,
|
|
343
|
+
out: e.out
|
|
344
|
+
}, e[x]);
|
|
232
345
|
}
|
|
233
|
-
function
|
|
346
|
+
function _(e) {
|
|
234
347
|
let t = null;
|
|
235
|
-
const n = [...
|
|
236
|
-
for (const
|
|
237
|
-
|
|
238
|
-
(
|
|
239
|
-
) ||
|
|
240
|
-
from:
|
|
241
|
-
to:
|
|
242
|
-
transition:
|
|
348
|
+
const n = [...e.transitions], i = [];
|
|
349
|
+
for (const o of e.transitions)
|
|
350
|
+
o.symmetric && (n.some(
|
|
351
|
+
(s) => s.from === o.to && s.to === o.from
|
|
352
|
+
) || i.push({
|
|
353
|
+
from: o.to,
|
|
354
|
+
to: o.from,
|
|
355
|
+
transition: o.transition
|
|
243
356
|
// Don't add symmetric flag to the reverse to avoid infinite loop
|
|
244
357
|
}));
|
|
245
|
-
n.push(...
|
|
246
|
-
let
|
|
358
|
+
n.push(...i);
|
|
359
|
+
let a = null;
|
|
247
360
|
const u = /* @__PURE__ */ new Map();
|
|
248
361
|
let l = null;
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
x:
|
|
252
|
-
y:
|
|
362
|
+
const m = () => {
|
|
363
|
+
a && l && u.set(l, {
|
|
364
|
+
x: a.scrollLeft,
|
|
365
|
+
y: a.scrollTop
|
|
253
366
|
});
|
|
254
|
-
},
|
|
255
|
-
|
|
367
|
+
}, p = (o, c) => {
|
|
368
|
+
a || (a = P(o), a.addEventListener("scroll", m, {
|
|
256
369
|
passive: !0
|
|
257
|
-
})), l =
|
|
370
|
+
})), l = c;
|
|
258
371
|
}, f = () => {
|
|
259
|
-
const
|
|
372
|
+
const o = t == null ? void 0 : t.from, c = t == null ? void 0 : t.to, s = o && u.has(o) ? u.get(o) : { x: 0, y: 0 }, h = c && u.has(c) ? u.get(c) : { x: 0, y: 0 };
|
|
260
373
|
return {
|
|
261
|
-
x: -
|
|
262
|
-
y: -
|
|
374
|
+
x: -h.x + s.x,
|
|
375
|
+
y: -h.y + s.y
|
|
263
376
|
};
|
|
264
377
|
};
|
|
265
|
-
function
|
|
378
|
+
function d() {
|
|
266
379
|
if (t != null && t.from && (t != null && t.to)) {
|
|
267
|
-
const
|
|
380
|
+
const c = N(
|
|
268
381
|
t.from,
|
|
269
382
|
t.to,
|
|
270
383
|
n
|
|
271
|
-
) ||
|
|
272
|
-
|
|
273
|
-
(
|
|
274
|
-
),
|
|
275
|
-
(
|
|
384
|
+
) || e.defaultTransition, h = { scrollOffset: f() };
|
|
385
|
+
c && (c.out && t.outResolve && t.outResolve(
|
|
386
|
+
(g) => c.out(g, h)
|
|
387
|
+
), c.in && t.inResolve && t.inResolve(
|
|
388
|
+
(g) => c.in(g, h)
|
|
276
389
|
)), t = null;
|
|
277
390
|
}
|
|
278
391
|
}
|
|
279
|
-
const
|
|
280
|
-
t.outResolve =
|
|
281
|
-
})) : (t.to =
|
|
282
|
-
t.inResolve =
|
|
392
|
+
const r = async (o, c) => c === "in" && (!t || !t.from) ? () => ({}) : (t || (t = {}), c === "out" ? (t.from = o, new Promise((s) => {
|
|
393
|
+
t.outResolve = s, d();
|
|
394
|
+
})) : (t.to = o, new Promise((s) => {
|
|
395
|
+
t.inResolve = s, d();
|
|
283
396
|
})));
|
|
284
|
-
return (
|
|
285
|
-
key:
|
|
286
|
-
in: async (
|
|
287
|
-
out: async (
|
|
397
|
+
return (o) => ({
|
|
398
|
+
key: o,
|
|
399
|
+
in: async (c) => (p(c, o), (await r(o, "in"))(c)),
|
|
400
|
+
out: async (c) => (await r(o, "out"))(c)
|
|
288
401
|
});
|
|
289
402
|
}
|
|
290
|
-
function
|
|
291
|
-
for (const
|
|
292
|
-
if (
|
|
293
|
-
return
|
|
294
|
-
for (const
|
|
295
|
-
if ((
|
|
296
|
-
return
|
|
403
|
+
function N(e, t, n) {
|
|
404
|
+
for (const i of n)
|
|
405
|
+
if (S(e, i.from) && S(t, i.to))
|
|
406
|
+
return i.transition;
|
|
407
|
+
for (const i of n)
|
|
408
|
+
if ((i.from === "*" || S(e, i.from)) && (i.to === "*" || S(t, i.to)))
|
|
409
|
+
return i.transition;
|
|
297
410
|
return null;
|
|
298
411
|
}
|
|
299
|
-
function
|
|
412
|
+
function S(e, t) {
|
|
300
413
|
if (t === "*")
|
|
301
414
|
return !0;
|
|
302
415
|
if (t.endsWith("/*")) {
|
|
303
416
|
const n = t.slice(0, -2);
|
|
304
|
-
return
|
|
417
|
+
return e === n || e.startsWith(n + "/");
|
|
305
418
|
}
|
|
306
|
-
return
|
|
419
|
+
return e === t;
|
|
307
420
|
}
|
|
308
421
|
export {
|
|
309
|
-
|
|
310
|
-
|
|
422
|
+
x as TRANSITION_STRATEGY,
|
|
423
|
+
M as createDefaultStrategy,
|
|
424
|
+
_ as createSggoiTransitionContext,
|
|
425
|
+
Y as transition
|
|
311
426
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={stiffness:170,damping:26},n={stiffness:120,damping:14},t={stiffness:180,damping:12},e={stiffness:210,damping:20},f={stiffness:280,damping:60},i={stiffness:280,damping:120},o={default:s,gentle:n,wobbly:t,stiff:e,slow:f,molasses:i};exports.config=o;exports.defaultSpring=s;exports.gentle=n;exports.molasses=i;exports.slow=f;exports.stiff=e;exports.wobbly=t;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SpringConfig } from '../types';
|
|
2
|
+
export declare const defaultSpring: SpringConfig;
|
|
3
|
+
export declare const gentle: SpringConfig;
|
|
4
|
+
export declare const wobbly: SpringConfig;
|
|
5
|
+
export declare const stiff: SpringConfig;
|
|
6
|
+
export declare const slow: SpringConfig;
|
|
7
|
+
export declare const molasses: SpringConfig;
|
|
8
|
+
export declare const config: {
|
|
9
|
+
readonly default: SpringConfig;
|
|
10
|
+
readonly gentle: SpringConfig;
|
|
11
|
+
readonly wobbly: SpringConfig;
|
|
12
|
+
readonly stiff: SpringConfig;
|
|
13
|
+
readonly slow: SpringConfig;
|
|
14
|
+
readonly molasses: SpringConfig;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/presets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,aAAa,EAAE,YAG3B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAGpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAGpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAGnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,YAGlB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,YAGtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const s = {
|
|
2
|
+
stiffness: 170,
|
|
3
|
+
damping: 26
|
|
4
|
+
}, n = {
|
|
5
|
+
stiffness: 120,
|
|
6
|
+
damping: 14
|
|
7
|
+
}, t = {
|
|
8
|
+
stiffness: 180,
|
|
9
|
+
damping: 12
|
|
10
|
+
}, f = {
|
|
11
|
+
stiffness: 210,
|
|
12
|
+
damping: 20
|
|
13
|
+
}, i = {
|
|
14
|
+
stiffness: 280,
|
|
15
|
+
damping: 60
|
|
16
|
+
}, e = {
|
|
17
|
+
stiffness: 280,
|
|
18
|
+
damping: 120
|
|
19
|
+
}, o = {
|
|
20
|
+
default: s,
|
|
21
|
+
gentle: n,
|
|
22
|
+
wobbly: t,
|
|
23
|
+
stiff: f,
|
|
24
|
+
slow: i,
|
|
25
|
+
molasses: e
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
o as config,
|
|
29
|
+
s as defaultSpring,
|
|
30
|
+
n as gentle,
|
|
31
|
+
e as molasses,
|
|
32
|
+
i as slow,
|
|
33
|
+
f as stiff,
|
|
34
|
+
t as wobbly
|
|
35
|
+
};
|