@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.
Files changed (41) hide show
  1. package/README.md +252 -23
  2. package/dist/animator.d.ts +28 -17
  3. package/dist/animator.d.ts.map +1 -1
  4. package/dist/create-transition-callback.d.ts +3 -32
  5. package/dist/create-transition-callback.d.ts.map +1 -1
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +310 -195
  10. package/dist/presets/index.cjs +1 -0
  11. package/dist/presets/index.d.ts +16 -0
  12. package/dist/presets/index.d.ts.map +1 -0
  13. package/dist/presets/index.js +35 -0
  14. package/dist/transition-strategy.d.ts +60 -0
  15. package/dist/transition-strategy.d.ts.map +1 -0
  16. package/dist/transition.d.ts +7 -3
  17. package/dist/transition.d.ts.map +1 -1
  18. package/dist/transitions/blur.d.ts +2 -1
  19. package/dist/transitions/blur.d.ts.map +1 -1
  20. package/dist/transitions/bounce.d.ts +2 -0
  21. package/dist/transitions/bounce.d.ts.map +1 -1
  22. package/dist/transitions/fly.d.ts +27 -0
  23. package/dist/transitions/fly.d.ts.map +1 -0
  24. package/dist/transitions/index.cjs +1 -1
  25. package/dist/transitions/index.d.ts +1 -0
  26. package/dist/transitions/index.d.ts.map +1 -1
  27. package/dist/transitions/index.js +175 -111
  28. package/dist/transitions/rotate.d.ts +3 -0
  29. package/dist/transitions/rotate.d.ts.map +1 -1
  30. package/dist/transitions/scale.d.ts +3 -3
  31. package/dist/transitions/scale.d.ts.map +1 -1
  32. package/dist/transitions/slide.d.ts +3 -1
  33. package/dist/transitions/slide.d.ts.map +1 -1
  34. package/dist/types.d.ts +8 -6
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/view-transitions/index.cjs +1 -1
  37. package/dist/view-transitions/index.d.ts +1 -1
  38. package/dist/view-transitions/index.js +117 -126
  39. package/dist/view-transitions/scroll.d.ts +8 -0
  40. package/dist/view-transitions/scroll.d.ts.map +1 -0
  41. package/package.json +29 -8
package/dist/index.js CHANGED
@@ -1,41 +1,110 @@
1
- var E = Object.defineProperty;
2
- var R = (o, t, n) => t in o ? E(o, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[t] = n;
3
- var d = (o, t, n) => R(o, typeof t != "symbol" ? t + "" : t, n);
4
- import { animate as P } from "popmotion";
5
- import { g as b } from "./utils-DR41YsAh.js";
6
- class v {
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
- d(this, "options");
9
- d(this, "currentValue");
10
- d(this, "velocity", 0);
11
- d(this, "isAnimating", !1);
12
- d(this, "controls", null);
13
- d(this, "animate", (t = !1) => {
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
- let s = this.currentValue, c = performance.now();
17
- this.controls = P({
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
- onUpdate: (u) => {
26
- const l = performance.now(), S = (l - c) / 1e3;
27
- if (S > 0) {
28
- const w = (u - s) / S;
29
- this.velocity = w / 1e3, s = u, c = l;
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 = u, this.options.onUpdate(u);
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 = 0, this.options.onComplete();
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.options = {
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.currentValue > (this.options.from + this.options.to) / 2;
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.currentValue < this.options.to;
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 s = new v(n);
99
- return s.setValue(t.position), s.setVelocity(t.velocity), s;
180
+ const i = new V(n);
181
+ return i.setValue(t.position), i.setVelocity(t.velocity), i;
100
182
  }
101
183
  }
102
- function k(o, t) {
103
- let n = null, s = null, c = null, u = null, l = !1;
104
- const S = async (f) => {
105
- var h;
106
- if (n && n.getIsAnimating() && !l) {
107
- const m = n.getCurrentState();
108
- n.stop(), s && (s.remove(), s = null), l = !0;
109
- const e = o();
110
- if (!e.out) return;
111
- const r = await Promise.resolve(e.out(f));
112
- n = v.fromState(m, {
113
- from: 1,
114
- to: 0,
115
- spring: r.spring,
116
- onStart: r.onStart,
117
- onUpdate: (i) => {
118
- var a;
119
- (a = r.tick) == null || a.call(r, i);
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
- if (!n || !n.getIsAnimating()) {
129
- l = !0;
130
- const m = o();
131
- if (!m.in) return;
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
- spring: e.spring,
137
- onStart: e.onStart,
138
- onUpdate: (r) => {
139
- var i;
140
- (i = e.tick) == null || i.call(e, r);
141
- },
142
- onComplete: () => {
143
- var r;
144
- n = null, l = !1, (r = e.onEnd) == null || r.call(e);
145
- }
146
- }), n.forward();
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
- function w(f) {
150
- const h = () => {
151
- !c || !s || (u && c.contains(u) ? c.insertBefore(s, u) : c.appendChild(s));
152
- }, m = () => {
153
- var r;
154
- s && (s.remove(), s = null), n = null, l = !1, (r = t == null ? void 0 : t.onCleanupEnd) == null || r.call(t);
155
- }, e = o();
156
- if (s = f.cloneNode(!0), n && n.getIsAnimating() && l) {
157
- const r = n.getCurrentState();
158
- if (n.stop(), l = !1, !e.in) {
159
- s = null, m();
160
- return;
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
- Promise.resolve(e.in(s)).then(async (i) => {
163
- var p;
164
- const a = s && await ((p = e.out) == null ? void 0 : p.call(e, s));
165
- a != null && a.prepare && s && a.prepare(s), h(), n = v.fromState(r, {
166
- from: 0,
167
- to: 1,
168
- spring: i.spring,
169
- onStart: i.onStart,
170
- onUpdate: (y) => {
171
- var A;
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
- if (!n || !n.getIsAnimating() || !l) {
183
- if (l = !1, !e.out) {
184
- s = null, m();
185
- return;
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
- Promise.resolve(e.out(s)).then((r) => {
188
- var i;
189
- s && ((i = r.prepare) == null || i.call(r, s)), h(), n = new v({
190
- from: 1,
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 (f) => f ? (c = f.parentElement, u = f.nextElementSibling, o().in && S(f), () => {
207
- w(f);
208
- }) : void 0;
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 g = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
211
- function U(o, t) {
212
- g.set(o, t);
213
- let n = x.get(o);
214
- return n || (n = k(
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 s = g.get(o);
217
- return s || (console.warn(`Transition "${String(o)}" not found`), {});
328
+ const a = A.get(e);
329
+ return a || (console.warn(`Transition "${String(e)}" not found`), {});
218
330
  },
219
331
  {
220
- onCleanupEnd: () => I(o)
332
+ strategy: n,
333
+ onCleanupEnd: () => D(e)
221
334
  }
222
- ), x.set(o, n), n);
335
+ ), C.set(e, i), i);
223
336
  }
224
- function I(o) {
225
- g.delete(o), x.delete(o);
337
+ function D(e) {
338
+ A.delete(e), C.delete(e);
226
339
  }
227
- function L(o) {
228
- return U(o.key, {
229
- in: o.in,
230
- out: o.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 W(o) {
346
+ function _(e) {
234
347
  let t = null;
235
- const n = [...o.transitions], s = [];
236
- for (const e of o.transitions)
237
- e.symmetric && (n.some(
238
- (i) => i.from === e.to && i.to === e.from
239
- ) || s.push({
240
- from: e.to,
241
- to: e.from,
242
- transition: e.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(...s);
246
- let c = null;
358
+ n.push(...i);
359
+ let a = null;
247
360
  const u = /* @__PURE__ */ new Map();
248
361
  let l = null;
249
- const S = () => {
250
- c && l && u.set(l, {
251
- x: c.scrollLeft,
252
- y: c.scrollTop
362
+ const m = () => {
363
+ a && l && u.set(l, {
364
+ x: a.scrollLeft,
365
+ y: a.scrollTop
253
366
  });
254
- }, w = (e, r) => {
255
- c || (c = b(e), c.addEventListener("scroll", S, {
367
+ }, p = (o, c) => {
368
+ a || (a = P(o), a.addEventListener("scroll", m, {
256
369
  passive: !0
257
- })), l = r;
370
+ })), l = c;
258
371
  }, f = () => {
259
- const e = t == null ? void 0 : t.from, r = t == null ? void 0 : t.to, i = e && u.has(e) ? u.get(e) : { x: 0, y: 0 }, a = r && u.has(r) ? u.get(r) : { x: 0, y: 0 };
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: -a.x + i.x,
262
- y: -a.y + i.y
374
+ x: -h.x + s.x,
375
+ y: -h.y + s.y
263
376
  };
264
377
  };
265
- function h() {
378
+ function d() {
266
379
  if (t != null && t.from && (t != null && t.to)) {
267
- const r = T(
380
+ const c = N(
268
381
  t.from,
269
382
  t.to,
270
383
  n
271
- ) || o.defaultTransition, a = { scrollOffset: f() };
272
- r && (r.out && t.outResolve && t.outResolve(
273
- (p) => r.out(p, a)
274
- ), r.in && t.inResolve && t.inResolve(
275
- (p) => r.in(p, a)
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 m = async (e, r) => r === "in" && (!t || !t.from) ? () => ({}) : (t || (t = {}), r === "out" ? (t.from = e, new Promise((i) => {
280
- t.outResolve = i, h();
281
- })) : (t.to = e, new Promise((i) => {
282
- t.inResolve = i, h();
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 (e) => ({
285
- key: e,
286
- in: async (r) => (w(r, e), (await m(e, "in"))(r)),
287
- out: async (r) => (await m(e, "out"))(r)
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 T(o, t, n) {
291
- for (const s of n)
292
- if (V(o, s.from) && V(t, s.to))
293
- return s.transition;
294
- for (const s of n)
295
- if ((s.from === "*" || V(o, s.from)) && (s.to === "*" || V(t, s.to)))
296
- return s.transition;
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 V(o, t) {
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 o === n || o.startsWith(n + "/");
417
+ return e === n || e.startsWith(n + "/");
305
418
  }
306
- return o === t;
419
+ return e === t;
307
420
  }
308
421
  export {
309
- W as createSggoiTransitionContext,
310
- L as transition
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
+ };