@ssgoi/core 5.0.2 → 5.2.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/dist/animator/multi-animator.d.ts.map +1 -1
- package/dist/animator/runner/keyframes-runner.d.ts +14 -0
- package/dist/animator/runner/keyframes-runner.d.ts.map +1 -0
- package/dist/animator/runner/provider.d.ts +12 -3
- package/dist/animator/runner/provider.d.ts.map +1 -1
- package/dist/animator/single-animator.d.ts +7 -0
- package/dist/animator/single-animator.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +636 -506
- package/dist/{provider-Cu4NSF1Q.js → provider-B2B8CK6H.js} +37 -62
- package/dist/provider-BKaONTeg.cjs +1 -0
- package/dist/spring-integrator-95Mh7mdw.cjs +1 -0
- package/dist/spring-integrator-BM4a-82c.js +33 -0
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +2 -2
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/create-swipe-back-detector.d.ts +43 -0
- package/dist/ssgoi-transition/create-swipe-back-detector.d.ts.map +1 -0
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +2 -2
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +33 -32
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +77 -73
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +44 -36
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/view-transitions/film.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +15 -15
- package/dist/view-transitions/index.js +884 -775
- package/dist/view-transitions/instagram.d.ts.map +1 -1
- package/dist/view-transitions/pinterest.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/provider-Cs5iBqRD.cjs +0 -1
- package/dist/ssgoi-transition/create-navigation-direction-detector.d.ts +0 -20
- package/dist/ssgoi-transition/create-navigation-direction-detector.d.ts.map +0 -1
- package/dist/utils/is-android.d.ts +0 -5
- package/dist/utils/is-android.d.ts.map +0 -1
- package/dist/utils/is-desktop.d.ts +0 -5
- package/dist/utils/is-desktop.d.ts.map +0 -1
- package/dist/utils/is-ios.d.ts +0 -6
- package/dist/utils/is-ios.d.ts.map +0 -1
- package/dist/utils/match-platform.d.ts +0 -8
- package/dist/utils/match-platform.d.ts.map +0 -1
|
@@ -1,62 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var n = (
|
|
4
|
-
|
|
5
|
-
class
|
|
6
|
-
constructor(e) {
|
|
7
|
-
n(this, "omega");
|
|
8
|
-
// Angular frequency
|
|
9
|
-
n(this, "zeta");
|
|
10
|
-
// Damping ratio
|
|
11
|
-
n(this, "restDelta");
|
|
12
|
-
n(this, "restSpeed");
|
|
13
|
-
const { stiffness: t, damping: s } = e, i = 1;
|
|
14
|
-
this.omega = Math.sqrt(t / i), this.zeta = s / (2 * Math.sqrt(t * i)), this.restDelta = e.restDelta ?? 0.01, this.restSpeed = e.restSpeed ?? 0.01;
|
|
15
|
-
}
|
|
16
|
-
step(e, t, s) {
|
|
17
|
-
const i = Math.min(s, 0.033), { omega: r, zeta: p } = this, { position: c, velocity: d } = e, h = -2 * i * p * r * d, o = i * r * r * (t - c), l = d + h + o;
|
|
18
|
-
return {
|
|
19
|
-
position: c + i * l,
|
|
20
|
-
velocity: l
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
isSettled(e, t) {
|
|
24
|
-
const s = Math.abs(t - e.position), i = Math.abs(e.velocity);
|
|
25
|
-
return s < this.restDelta && i < this.restSpeed;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
class H {
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var E = (r, e, t) => e in r ? v(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var n = (r, e, t) => E(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { P as M, V as O, a as b } from "./spring-integrator-BM4a-82c.js";
|
|
5
|
+
class F {
|
|
29
6
|
constructor(e) {
|
|
30
7
|
n(this, "leader");
|
|
31
8
|
n(this, "follower");
|
|
32
9
|
n(this, "restDelta");
|
|
33
10
|
n(this, "restSpeed");
|
|
34
|
-
this.restDelta = e.restDelta ??
|
|
11
|
+
this.restDelta = e.restDelta ?? M, this.restSpeed = e.restSpeed ?? O, this.leader = new b({
|
|
35
12
|
stiffness: e.stiffness,
|
|
36
13
|
damping: e.damping,
|
|
37
14
|
restDelta: this.restDelta,
|
|
38
15
|
restSpeed: this.restSpeed
|
|
39
16
|
});
|
|
40
|
-
let t, s, i,
|
|
41
|
-
typeof e.follower == "number" ? (t = e.stiffness * e.follower, s = e.damping) : e.follower ? (t = e.follower.stiffness, s = e.follower.damping, i = e.follower.restDelta,
|
|
17
|
+
let t, s, i, a;
|
|
18
|
+
typeof e.follower == "number" ? (t = e.stiffness * e.follower, s = e.damping) : e.follower ? (t = e.follower.stiffness, s = e.follower.damping, i = e.follower.restDelta, a = e.follower.restSpeed) : (t = e.stiffness, s = e.damping), this.follower = new b({
|
|
42
19
|
stiffness: t,
|
|
43
20
|
damping: s,
|
|
44
21
|
restDelta: i ?? this.restDelta,
|
|
45
|
-
restSpeed:
|
|
22
|
+
restSpeed: a ?? this.restSpeed
|
|
46
23
|
});
|
|
47
24
|
}
|
|
48
25
|
step(e, t, s) {
|
|
49
|
-
const
|
|
26
|
+
const a = e._leader ?? {
|
|
50
27
|
position: e.position,
|
|
51
28
|
velocity: e.velocity
|
|
52
|
-
}, p = this.leader.step(
|
|
29
|
+
}, p = this.leader.step(a, t, s), m = this.follower.step(
|
|
53
30
|
e,
|
|
54
31
|
p.position,
|
|
55
32
|
s
|
|
56
33
|
);
|
|
57
34
|
return {
|
|
58
|
-
position:
|
|
59
|
-
velocity:
|
|
35
|
+
position: m.position,
|
|
36
|
+
velocity: m.velocity,
|
|
60
37
|
_leader: p
|
|
61
38
|
};
|
|
62
39
|
}
|
|
@@ -65,8 +42,8 @@ class H {
|
|
|
65
42
|
return s._leader ? Math.abs(t - s._leader.position) < this.restDelta && Math.abs(s._leader.velocity) < this.restSpeed && i : i;
|
|
66
43
|
}
|
|
67
44
|
}
|
|
68
|
-
const
|
|
69
|
-
class
|
|
45
|
+
const x = 0.01, L = 500, H = 10;
|
|
46
|
+
class N {
|
|
70
47
|
constructor(e) {
|
|
71
48
|
n(this, "acceleration");
|
|
72
49
|
n(this, "resistance");
|
|
@@ -76,35 +53,35 @@ class F {
|
|
|
76
53
|
n(this, "bounceStiffness");
|
|
77
54
|
n(this, "bounceDamping");
|
|
78
55
|
n(this, "restDelta");
|
|
79
|
-
this.acceleration = e.acceleration, this.resistance = e.resistance, this.resistanceType = e.resistanceType ?? "quadratic", this.min = e.min, this.max = e.max, this.bounceStiffness = e.bounceStiffness ??
|
|
56
|
+
this.acceleration = e.acceleration, this.resistance = e.resistance, this.resistanceType = e.resistanceType ?? "quadratic", this.min = e.min, this.max = e.max, this.bounceStiffness = e.bounceStiffness ?? L, this.bounceDamping = e.bounceDamping ?? H, this.restDelta = e.restDelta ?? x;
|
|
80
57
|
}
|
|
81
58
|
step(e, t, s) {
|
|
82
|
-
const i = Math.min(s, 0.033), { acceleration:
|
|
59
|
+
const i = Math.min(s, 0.033), { acceleration: a, resistance: p, resistanceType: m, min: S, max: h } = this, { position: l, velocity: c } = e, D = S !== void 0 && l < S, w = h !== void 0 && l > h;
|
|
83
60
|
let u;
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
u =
|
|
61
|
+
if (D || w) {
|
|
62
|
+
const f = l - (D ? S : h), I = -this.bounceStiffness * f, _ = -this.bounceDamping * c;
|
|
63
|
+
u = I + _;
|
|
87
64
|
} else {
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
|
|
65
|
+
const d = t > l ? 1 : -1;
|
|
66
|
+
let f;
|
|
67
|
+
m === "linear" ? f = p * c : f = p * c * Math.abs(c), u = d * a - f;
|
|
91
68
|
}
|
|
92
|
-
const
|
|
93
|
-
let
|
|
94
|
-
if (!
|
|
95
|
-
const
|
|
96
|
-
(
|
|
69
|
+
const y = c + u * i;
|
|
70
|
+
let o = l + y * i;
|
|
71
|
+
if (!D && !w) {
|
|
72
|
+
const d = t > l ? 1 : -1;
|
|
73
|
+
(d > 0 && o > t || d < 0 && o < t) && (o = t);
|
|
97
74
|
}
|
|
98
75
|
return {
|
|
99
|
-
position:
|
|
100
|
-
velocity:
|
|
76
|
+
position: o,
|
|
77
|
+
velocity: o === t ? 0 : y
|
|
101
78
|
};
|
|
102
79
|
}
|
|
103
80
|
isSettled(e, t) {
|
|
104
81
|
return Math.abs(t - e.position) < this.restDelta;
|
|
105
82
|
}
|
|
106
83
|
}
|
|
107
|
-
class
|
|
84
|
+
class T {
|
|
108
85
|
/**
|
|
109
86
|
* Create an Integrator from physics config
|
|
110
87
|
*
|
|
@@ -118,7 +95,7 @@ class y {
|
|
|
118
95
|
"Cannot use both 'spring' and 'inertia' together. Choose one physics type."
|
|
119
96
|
);
|
|
120
97
|
if (e.inertia)
|
|
121
|
-
return new
|
|
98
|
+
return new N({
|
|
122
99
|
acceleration: e.inertia.acceleration,
|
|
123
100
|
resistance: e.inertia.resistance,
|
|
124
101
|
resistanceType: e.inertia.resistanceType,
|
|
@@ -135,7 +112,7 @@ class y {
|
|
|
135
112
|
return typeof s == "number" ? i = s : typeof s == "object" && (i = {
|
|
136
113
|
stiffness: s.stiffness,
|
|
137
114
|
damping: s.damping
|
|
138
|
-
}), new
|
|
115
|
+
}), new F({
|
|
139
116
|
stiffness: t.stiffness,
|
|
140
117
|
damping: t.damping,
|
|
141
118
|
follower: i,
|
|
@@ -155,13 +132,11 @@ class y {
|
|
|
155
132
|
* @deprecated Use from({ spring: config }) instead
|
|
156
133
|
*/
|
|
157
134
|
static fromSpring(e) {
|
|
158
|
-
return
|
|
135
|
+
return T.from({ spring: e });
|
|
159
136
|
}
|
|
160
137
|
}
|
|
161
138
|
export {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
b as a,
|
|
166
|
-
F as b
|
|
139
|
+
F as D,
|
|
140
|
+
T as I,
|
|
141
|
+
N as a
|
|
167
142
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var M=Object.defineProperty;var O=(n,e,t)=>e in n?M(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var i=(n,e,t)=>O(n,typeof e!="symbol"?e+"":e,t);const f=require("./spring-integrator-95Mh7mdw.cjs");class T{constructor(e){i(this,"leader");i(this,"follower");i(this,"restDelta");i(this,"restSpeed");this.restDelta=e.restDelta??f.POSITION_THRESHOLD,this.restSpeed=e.restSpeed??f.VELOCITY_THRESHOLD,this.leader=new f.SpringIntegrator({stiffness:e.stiffness,damping:e.damping,restDelta:this.restDelta,restSpeed:this.restSpeed});let t,s,r,a;typeof e.follower=="number"?(t=e.stiffness*e.follower,s=e.damping):e.follower?(t=e.follower.stiffness,s=e.follower.damping,r=e.follower.restDelta,a=e.follower.restSpeed):(t=e.stiffness,s=e.damping),this.follower=new f.SpringIntegrator({stiffness:t,damping:s,restDelta:r??this.restDelta,restSpeed:a??this.restSpeed})}step(e,t,s){const a=e._leader??{position:e.position,velocity:e.velocity},p=this.leader.step(a,t,s),m=this.follower.step(e,p.position,s);return{position:m.position,velocity:m.velocity,_leader:p}}isSettled(e,t){const s=e,r=Math.abs(t-e.position)<this.restDelta&&Math.abs(e.velocity)<this.restSpeed;return s._leader?Math.abs(t-s._leader.position)<this.restDelta&&Math.abs(s._leader.velocity)<this.restSpeed&&r:r}}const F=.01,g=500,L=10;class v{constructor(e){i(this,"acceleration");i(this,"resistance");i(this,"resistanceType");i(this,"min");i(this,"max");i(this,"bounceStiffness");i(this,"bounceDamping");i(this,"restDelta");this.acceleration=e.acceleration,this.resistance=e.resistance,this.resistanceType=e.resistanceType??"quadratic",this.min=e.min,this.max=e.max,this.bounceStiffness=e.bounceStiffness??g,this.bounceDamping=e.bounceDamping??L,this.restDelta=e.restDelta??F}step(e,t,s){const r=Math.min(s,.033),{acceleration:a,resistance:p,resistanceType:m,min:h,max:u}=this,{position:o,velocity:c}=e,D=h!==void 0&&o<h,y=u!==void 0&&o>u;let b;if(D||y){const S=o-(D?h:u),_=-this.bounceStiffness*S,E=-this.bounceDamping*c;b=_+E}else{const d=t>o?1:-1;let S;m==="linear"?S=p*c:S=p*c*Math.abs(c),b=d*a-S}const I=c+b*r;let l=o+I*r;if(!D&&!y){const d=t>o?1:-1;(d>0&&l>t||d<0&&l<t)&&(l=t)}return{position:l,velocity:l===t?0:I}}isSettled(e,t){return Math.abs(t-e.position)<this.restDelta}}class w{static from(e){if(e.spring&&e.inertia)throw new Error("Cannot use both 'spring' and 'inertia' together. Choose one physics type.");if(e.inertia)return new v({acceleration:e.inertia.acceleration,resistance:e.inertia.resistance,resistanceType:e.inertia.resistanceType,min:e.inertia.min,max:e.inertia.max,bounceStiffness:e.inertia.bounceStiffness,bounceDamping:e.inertia.bounceDamping,restDelta:e.inertia.restDelta});const t=e.spring??{stiffness:300,damping:30};if(t.doubleSpring){const s=t.doubleSpring;let r;return typeof s=="number"?r=s:typeof s=="object"&&(r={stiffness:s.stiffness,damping:s.damping}),new T({stiffness:t.stiffness,damping:t.damping,follower:r,restDelta:t.restDelta,restSpeed:t.restSpeed})}return new f.SpringIntegrator({stiffness:t.stiffness,damping:t.damping,restDelta:t.restDelta,restSpeed:t.restSpeed})}static fromSpring(e){return w.from({spring:e})}}exports.DoubleSpringIntegrator=T;exports.InertiaIntegrator=v;exports.IntegratorProvider=w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var E=Object.defineProperty;var L=(o,t,s)=>t in o?E(o,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[t]=s;var i=(o,t,s)=>L(o,typeof t!="symbol"?t+"":t,s);class p{constructor(t){i(this,"omega");i(this,"zeta");i(this,"restDelta");i(this,"restSpeed");const{stiffness:s,damping:n}=t,e=1;this.omega=Math.sqrt(s/e),this.zeta=n/(2*Math.sqrt(s*e)),this.restDelta=t.restDelta??.01,this.restSpeed=t.restSpeed??.01}step(t,s,n){const e=Math.min(n,.033),{omega:r,zeta:c}=this,{position:S,velocity:T}=t,O=-2*e*c*r*T,H=e*r*r*(s-S),a=T+O+H;return{position:S+e*a,velocity:a}}isSettled(t,s){const n=Math.abs(s-t.position),e=Math.abs(t.velocity);return n<this.restDelta&&e<this.restSpeed}}exports.POSITION_THRESHOLD=.01;exports.SETTLE_THRESHOLD=.05;exports.SpringIntegrator=p;exports.VELOCITY_THRESHOLD=.01;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var T = (o, t, s) => t in o ? O(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
|
|
3
|
+
var a = (o, t, s) => T(o, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
const D = 0.01, E = 0.01, m = 0.05;
|
|
5
|
+
class L {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
a(this, "omega");
|
|
8
|
+
// Angular frequency
|
|
9
|
+
a(this, "zeta");
|
|
10
|
+
// Damping ratio
|
|
11
|
+
a(this, "restDelta");
|
|
12
|
+
a(this, "restSpeed");
|
|
13
|
+
const { stiffness: s, damping: n } = t, e = 1;
|
|
14
|
+
this.omega = Math.sqrt(s / e), this.zeta = n / (2 * Math.sqrt(s * e)), this.restDelta = t.restDelta ?? 0.01, this.restSpeed = t.restSpeed ?? 0.01;
|
|
15
|
+
}
|
|
16
|
+
step(t, s, n) {
|
|
17
|
+
const e = Math.min(n, 0.033), { omega: i, zeta: S } = this, { position: r, velocity: c } = t, h = -2 * e * S * i * c, l = e * i * i * (s - r), p = c + h + l;
|
|
18
|
+
return {
|
|
19
|
+
position: r + e * p,
|
|
20
|
+
velocity: p
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
isSettled(t, s) {
|
|
24
|
+
const n = Math.abs(s - t.position), e = Math.abs(t.velocity);
|
|
25
|
+
return n < this.restDelta && e < this.restSpeed;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
D as P,
|
|
30
|
+
m as S,
|
|
31
|
+
E as V,
|
|
32
|
+
L as a
|
|
33
|
+
};
|
|
@@ -5,12 +5,12 @@ import { SsgoiConfig, SsgoiContext, SsgoiInternalOptions } from '../types';
|
|
|
5
5
|
* Page transition scenario: /home → /about
|
|
6
6
|
*
|
|
7
7
|
* **Default mode (outFirst: true)**: OUT must arrive before IN
|
|
8
|
-
* - Best for frameworks with native destroy callbacks (Svelte
|
|
8
|
+
* - Best for frameworks with native destroy callbacks (Svelte)
|
|
9
9
|
* - OUT triggers first, then IN completes the pair
|
|
10
10
|
* - If IN arrives without OUT, returns empty transition (page refresh)
|
|
11
11
|
*
|
|
12
12
|
* **Observer mode (outFirst: false)**: OUT and IN can arrive in any order
|
|
13
|
-
* - Best for frameworks using MutationObserver (React)
|
|
13
|
+
* - Best for frameworks using MutationObserver (React, Vue, Solid)
|
|
14
14
|
* - Either OUT or IN can arrive first
|
|
15
15
|
* - Both wait indefinitely for the other to complete the pair
|
|
16
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAchF;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,oBAAoB,GACrC,YAAY,CA8Id"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swipe-Back Detector
|
|
3
|
+
*
|
|
4
|
+
* Detects native edge swipe-back / swipe-forward gestures (iOS Safari, Android
|
|
5
|
+
* system back gesture) purely from touch event sequences. We deliberately do
|
|
6
|
+
* NOT depend on popstate because:
|
|
7
|
+
*
|
|
8
|
+
* - iOS 16+ has a regression (WebKit 248303) where swipe-back skips popstate
|
|
9
|
+
* when history entries were created without user interaction.
|
|
10
|
+
* - popstate doesn't tell us *how* the navigation happened — header back-button,
|
|
11
|
+
* keyboard shortcut, history.back() and edge-swipe all look identical.
|
|
12
|
+
*
|
|
13
|
+
* Heuristic
|
|
14
|
+
* 1. touchstart with a single touch starting within EDGE_THRESHOLD px of either
|
|
15
|
+
* vertical edge of the layout viewport → record a candidate.
|
|
16
|
+
* 2. touchmove that is horizontally dominant AND moves *away* from that edge
|
|
17
|
+
* by more than MOVE_THRESHOLD → mark candidate as "moved".
|
|
18
|
+
* Multi-touch, vertically-dominant motion, or losing the tracked finger all
|
|
19
|
+
* drop the candidate.
|
|
20
|
+
* 3. touchend with cumulative |dx| ≥ FINAL_DISTANCE in the correct direction
|
|
21
|
+
* → settle as a swipe.
|
|
22
|
+
* touchcancel after horizontal commitment also counts: the browser took the
|
|
23
|
+
* gesture over, which is exactly what edge-swipe-back does on iOS.
|
|
24
|
+
*
|
|
25
|
+
* Settling arms an "active" flag. The flag auto-expires after EXPIRE_WINDOW so
|
|
26
|
+
* a successful gesture that wasn't actually a navigation (e.g. user dragged a
|
|
27
|
+
* right-anchored sheet) doesn't poison subsequent navigations.
|
|
28
|
+
*
|
|
29
|
+
* The flag also has a `stickyActive` mirror that lives one extra macrotask past
|
|
30
|
+
* `onPageEnter()`, so an OUT/IN pair queued together (which can fire in either
|
|
31
|
+
* order across adapters) reads the same value.
|
|
32
|
+
*
|
|
33
|
+
* Mac trackpad and Magic Trackpad swipes don't dispatch touch events on web, so
|
|
34
|
+
* they go unhandled here. That's intentional — we'd rather miss-detect those
|
|
35
|
+
* than false-positive them.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createSwipeBackDetector(): {
|
|
38
|
+
initialize: () => void;
|
|
39
|
+
destroy: () => void;
|
|
40
|
+
isSwipeBack: () => boolean;
|
|
41
|
+
onPageEnter: () => void;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=create-swipe-back-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-swipe-back-detector.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-swipe-back-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAkBH,wBAAgB,uBAAuB;;;;;EA4LtC"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Collects out/in navigation events and provides navigation pairs.
|
|
5
5
|
* Each strategy handles the timing differently:
|
|
6
|
-
* - OutFirst: OUT must arrive before IN (for Svelte
|
|
7
|
-
* - AnyOrder: OUT and IN can arrive in any order (for React)
|
|
6
|
+
* - OutFirst: OUT must arrive before IN (for Svelte)
|
|
7
|
+
* - AnyOrder: OUT and IN can arrive in any order (for React, Vue, Solid)
|
|
8
8
|
*/
|
|
9
9
|
export type NavigationPair = {
|
|
10
10
|
from: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../provider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../spring-integrator-95Mh7mdw.cjs"),x=require("../provider-BKaONTeg.cjs");function m(e,t){return e!=null&&e.spring||e!=null&&e.inertia||e!=null&&e.integrator?e:{spring:t.spring}}const I=(e={})=>{const{from:t=0,to:n=1,key:c}=e,r=m(e.physics,{spring:{stiffness:300,damping:30}});return{in:()=>({physics:r,css:s=>({opacity:t+(n-t)*s})}),out:()=>({physics:r,css:s=>({opacity:t+(n-t)*s})}),...c&&{key:c}}},w=(e={})=>{const{start:t=0,opacity:n=0,axis:c="both",key:r}=e,s=m(e.physics,{spring:{stiffness:300,damping:30}}),g=a=>{switch(c){case"x":return`scaleX(${a})`;case"y":return`scaleY(${a})`;case"both":default:return`scale(${a})`}},u=a=>{const o=t+(1-t)*a;return{transform:g(o),opacity:n+(1-n)*a}};return{in:()=>({physics:s,css:u}),out:()=>({physics:s,css:u}),...r&&{key:r}}},C=(e={})=>{const{direction:t,distance:n=100,opacity:c=0,fade:r=!0,axis:s,key:g}=e,u=m(e.physics,{spring:{stiffness:400,damping:35}}),o=t||(s==="x"?"left":s==="y"?"up":"left"),l=$=>{const i=1-$;if(typeof n=="number"){const d=i*n;switch(o){case"left":return`translate3d(${-d}px, 0, 0)`;case"right":return`translate3d(${d}px, 0, 0)`;case"up":return`translate3d(0, ${-d}px, 0)`;case"down":return`translate3d(0, ${d}px, 0)`}}else switch(o){case"left":return`translate3d(calc(-1 * ${n} * ${i}), 0, 0)`;case"right":return`translate3d(calc(${n} * ${i}), 0, 0)`;case"up":return`translate3d(0, calc(-1 * ${n} * ${i}), 0)`;case"down":return`translate3d(0, calc(${n} * ${i}), 0)`}},f=$=>{const i={transform:l($)};return r&&(i.opacity=c+(1-c)*$),i};return{in:()=>({physics:u,css:f}),out:()=>({physics:u,css:f}),...g&&{key:g}}},P=(e={})=>{const{degrees:t=360,clockwise:n=!0,scale:c=!1,fade:r=!0,origin:s="center",axis:g="2d",perspective:u=800,key:a}=e,o=m(e.physics,{spring:{stiffness:500,damping:25}}),l=n?t:-t,f=i=>{const d=(1-i)*l;switch(g){case"x":return`perspective(${u}px) rotateX(${d}deg)`;case"y":return`perspective(${u}px) rotateY(${d}deg)`;case"z":return`rotateZ(${d}deg)`;case"2d":default:return`rotate(${d}deg)`}},$=i=>{const d={},y=[f(i)];return c&&y.push(`scale(${i})`),d.transform=y.join(" "),d.transformOrigin=s,r&&(d.opacity=i),d};return{in:()=>({physics:o,css:$}),out:()=>({physics:o,css:$}),...a&&{key:a}}},v=(e={})=>{const{height:t=20,intensity:n=1,scale:c=!0,fade:r=!0,direction:s="up",key:g}=e,u=m(e.physics,{spring:{stiffness:800,damping:15}}),a=o=>{const l={},f=[],$=Math.sin(o*Math.PI*(1+n)),i=1-o,d=$*t*i;if(s==="up"?f.push(`translateY(${-Math.abs(d)}px)`):f.push(`translateY(${Math.abs(d)}px)`),c){const y=.8+o*.2+$*.05*i;f.push(`scale(${y})`)}return l.transform=f.join(" "),r&&(l.opacity=o),l};return{in:()=>({physics:u,css:a}),out:()=>({physics:u,css:a}),...g&&{key:g}}},M=(e={})=>{const{amount:t=10,opacity:n=0,scale:c=!1,fade:r=!0,key:s}=e,g=m(e.physics,{spring:{stiffness:300,damping:30}}),u=a=>{const o=1-a,l={};return typeof t=="number"?l.filter=`blur(${o*t}px)`:l.filter=`blur(calc(${t} * ${o}))`,c&&(l.transform=`scale(${.8+a*.2})`),r&&(l.opacity=n+(1-n)*a),l};return{in:()=>({physics:g,css:u}),out:()=>({physics:g,css:u}),...s&&{key:s}}},D=(e={})=>{const{x:t=0,y:n=-100,opacity:c=0,spring:r,key:s}=e,g={stiffness:(r==null?void 0:r.stiffness)??400,damping:(r==null?void 0:r.damping)??35,doubleSpring:(r==null?void 0:r.doubleSpring)??!1},u=a=>{const o=1-a;let l,f;return typeof t=="number"?l=`${o*t}px`:l=`calc(${t} * ${o})`,typeof n=="number"?f=`${o*n}px`:f=`calc(${n} * ${o})`,{transform:`translate3d(${l}, ${f}, 0)`,opacity:c+(1-c)*a}};return{in:()=>({spring:g,css:u}),out:()=>({spring:g,css:u}),...s&&{key:s}}},q=(e={})=>{const{shape:t="circle",origin:n="center",scale:c=1.5,fade:r=!1,spring:s,key:g}=e,u={stiffness:(s==null?void 0:s.stiffness)??300,damping:(s==null?void 0:s.damping)??30,doubleSpring:(s==null?void 0:s.doubleSpring)??!1},a=()=>{switch(n){case"top":return"50% 0%";case"bottom":return"50% 100%";case"left":return"0% 50%";case"right":return"100% 50%";case"top-left":return"0% 0%";case"top-right":return"100% 0%";case"bottom-left":return"0% 100%";case"bottom-right":return"100% 100%";case"center":default:return"50% 50%"}},o=f=>{const $=f*c*100,i=a();switch(t){case"ellipse":return`ellipse(${$}% ${$*.75}% at ${i})`;case"square":{const d=f*c*100,[y,S]=i.split(" "),b=parseFloat(y),h=parseFloat(S),p=d/2;return`polygon(${b-p}% ${h-p}%, ${b+p}% ${h-p}%, ${b+p}% ${h+p}%, ${b-p}% ${h+p}%)`}case"circle":default:return`circle(${$}% at ${i})`}},l=f=>{const $={clipPath:o(f)};return r&&($.opacity=f),$};return{in:()=>({spring:u,css:l}),out:()=>({spring:u,css:l}),...g&&{key:g}}},z=(e={})=>{const{spring:t,key:n}=e,c={stiffness:(t==null?void 0:t.stiffness)??1e3,damping:(t==null?void 0:t.damping)??100,doubleSpring:(t==null?void 0:t.doubleSpring)??!1};return{in:()=>({spring:c,css:()=>({})}),out:()=>({spring:c,css:()=>({})}),...n&&{key:n}}};exports.SpringIntegrator=k.SpringIntegrator;exports.DoubleSpringIntegrator=x.DoubleSpringIntegrator;exports.InertiaIntegrator=x.InertiaIntegrator;exports.IntegratorProvider=x.IntegratorProvider;exports.blur=M;exports.bounce=v;exports.fade=I;exports.fly=D;exports.mask=q;exports.none=z;exports.rotate=P;exports.scale=w;exports.slide=C;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { a as v } from "../spring-integrator-BM4a-82c.js";
|
|
2
|
+
import { D as j, a as q, I as A } from "../provider-B2B8CK6H.js";
|
|
3
|
+
function y(e, t) {
|
|
3
4
|
return e != null && e.spring || e != null && e.inertia || e != null && e.integrator ? e : { spring: t.spring };
|
|
4
5
|
}
|
|
5
6
|
const k = (e = {}) => {
|
|
6
|
-
const { from: t = 0, to: n = 1, key: c } = e, r =
|
|
7
|
+
const { from: t = 0, to: n = 1, key: c } = e, r = y(e.physics, {
|
|
7
8
|
spring: { stiffness: 300, damping: 30 }
|
|
8
9
|
});
|
|
9
10
|
return {
|
|
@@ -22,7 +23,7 @@ const k = (e = {}) => {
|
|
|
22
23
|
...c && { key: c }
|
|
23
24
|
};
|
|
24
25
|
}, S = (e = {}) => {
|
|
25
|
-
const { start: t = 0, opacity: n = 0, axis: c = "both", key: r } = e, s =
|
|
26
|
+
const { start: t = 0, opacity: n = 0, axis: c = "both", key: r } = e, s = y(e.physics, {
|
|
26
27
|
spring: { stiffness: 300, damping: 30 }
|
|
27
28
|
}), $ = (a) => {
|
|
28
29
|
switch (c) {
|
|
@@ -54,10 +55,10 @@ const k = (e = {}) => {
|
|
|
54
55
|
fade: r = !0,
|
|
55
56
|
axis: s,
|
|
56
57
|
key: $
|
|
57
|
-
} = e, u =
|
|
58
|
+
} = e, u = y(e.physics, {
|
|
58
59
|
spring: { stiffness: 400, damping: 35 }
|
|
59
|
-
}), o = t || (s === "x" ? "left" : s === "y" ? "up" : "left"), l = (
|
|
60
|
-
const i = 1 -
|
|
60
|
+
}), o = t || (s === "x" ? "left" : s === "y" ? "up" : "left"), l = (p) => {
|
|
61
|
+
const i = 1 - p;
|
|
61
62
|
if (typeof n == "number") {
|
|
62
63
|
const d = i * n;
|
|
63
64
|
switch (o) {
|
|
@@ -81,11 +82,11 @@ const k = (e = {}) => {
|
|
|
81
82
|
case "down":
|
|
82
83
|
return `translate3d(0, calc(${n} * ${i}), 0)`;
|
|
83
84
|
}
|
|
84
|
-
}, f = (
|
|
85
|
+
}, f = (p) => {
|
|
85
86
|
const i = {
|
|
86
|
-
transform: l(
|
|
87
|
+
transform: l(p)
|
|
87
88
|
};
|
|
88
|
-
return r && (i.opacity = c + (1 - c) *
|
|
89
|
+
return r && (i.opacity = c + (1 - c) * p), i;
|
|
89
90
|
};
|
|
90
91
|
return {
|
|
91
92
|
in: () => ({ physics: u, css: f }),
|
|
@@ -102,7 +103,7 @@ const k = (e = {}) => {
|
|
|
102
103
|
axis: $ = "2d",
|
|
103
104
|
perspective: u = 800,
|
|
104
105
|
key: a
|
|
105
|
-
} = e, o =
|
|
106
|
+
} = e, o = y(e.physics, {
|
|
106
107
|
spring: { stiffness: 500, damping: 25 }
|
|
107
108
|
}), l = n ? t : -t, f = (i) => {
|
|
108
109
|
const d = (1 - i) * l;
|
|
@@ -117,13 +118,13 @@ const k = (e = {}) => {
|
|
|
117
118
|
default:
|
|
118
119
|
return `rotate(${d}deg)`;
|
|
119
120
|
}
|
|
120
|
-
},
|
|
121
|
-
const d = {},
|
|
122
|
-
return c &&
|
|
121
|
+
}, p = (i) => {
|
|
122
|
+
const d = {}, m = [f(i)];
|
|
123
|
+
return c && m.push(`scale(${i})`), d.transform = m.join(" "), d.transformOrigin = s, r && (d.opacity = i), d;
|
|
123
124
|
};
|
|
124
125
|
return {
|
|
125
|
-
in: () => ({ physics: o, css:
|
|
126
|
-
out: () => ({ physics: o, css:
|
|
126
|
+
in: () => ({ physics: o, css: p }),
|
|
127
|
+
out: () => ({ physics: o, css: p }),
|
|
127
128
|
...a && { key: a }
|
|
128
129
|
};
|
|
129
130
|
}, I = (e = {}) => {
|
|
@@ -134,13 +135,13 @@ const k = (e = {}) => {
|
|
|
134
135
|
fade: r = !0,
|
|
135
136
|
direction: s = "up",
|
|
136
137
|
key: $
|
|
137
|
-
} = e, u =
|
|
138
|
+
} = e, u = y(e.physics, {
|
|
138
139
|
spring: { stiffness: 800, damping: 15 }
|
|
139
140
|
}), a = (o) => {
|
|
140
|
-
const l = {}, f = [],
|
|
141
|
+
const l = {}, f = [], p = Math.sin(o * Math.PI * (1 + n)), i = 1 - o, d = p * t * i;
|
|
141
142
|
if (s === "up" ? f.push(`translateY(${-Math.abs(d)}px)`) : f.push(`translateY(${Math.abs(d)}px)`), c) {
|
|
142
|
-
const
|
|
143
|
-
f.push(`scale(${
|
|
143
|
+
const m = 0.8 + o * 0.2 + p * 0.05 * i;
|
|
144
|
+
f.push(`scale(${m})`);
|
|
144
145
|
}
|
|
145
146
|
return l.transform = f.join(" "), r && (l.opacity = o), l;
|
|
146
147
|
};
|
|
@@ -150,7 +151,7 @@ const k = (e = {}) => {
|
|
|
150
151
|
...$ && { key: $ }
|
|
151
152
|
};
|
|
152
153
|
}, P = (e = {}) => {
|
|
153
|
-
const { amount: t = 10, opacity: n = 0, scale: c = !1, fade: r = !0, key: s } = e, $ =
|
|
154
|
+
const { amount: t = 10, opacity: n = 0, scale: c = !1, fade: r = !0, key: s } = e, $ = y(e.physics, {
|
|
154
155
|
spring: { stiffness: 300, damping: 30 }
|
|
155
156
|
}), u = (a) => {
|
|
156
157
|
const o = 1 - a, l = {};
|
|
@@ -220,23 +221,23 @@ const k = (e = {}) => {
|
|
|
220
221
|
return "50% 50%";
|
|
221
222
|
}
|
|
222
223
|
}, o = (f) => {
|
|
223
|
-
const
|
|
224
|
+
const p = f * c * 100, i = a();
|
|
224
225
|
switch (t) {
|
|
225
226
|
case "ellipse":
|
|
226
|
-
return `ellipse(${
|
|
227
|
+
return `ellipse(${p}% ${p * 0.75}% at ${i})`;
|
|
227
228
|
case "square": {
|
|
228
|
-
const d = f * c * 100, [
|
|
229
|
-
return `polygon(${b -
|
|
229
|
+
const d = f * c * 100, [m, x] = i.split(" "), b = parseFloat(m), h = parseFloat(x), g = d / 2;
|
|
230
|
+
return `polygon(${b - g}% ${h - g}%, ${b + g}% ${h - g}%, ${b + g}% ${h + g}%, ${b - g}% ${h + g}%)`;
|
|
230
231
|
}
|
|
231
232
|
case "circle":
|
|
232
233
|
default:
|
|
233
|
-
return `circle(${
|
|
234
|
+
return `circle(${p}% at ${i})`;
|
|
234
235
|
}
|
|
235
236
|
}, l = (f) => {
|
|
236
|
-
const
|
|
237
|
+
const p = {
|
|
237
238
|
clipPath: o(f)
|
|
238
239
|
};
|
|
239
|
-
return r && (
|
|
240
|
+
return r && (p.opacity = f), p;
|
|
240
241
|
};
|
|
241
242
|
return {
|
|
242
243
|
in: () => ({
|
|
@@ -268,10 +269,10 @@ const k = (e = {}) => {
|
|
|
268
269
|
};
|
|
269
270
|
};
|
|
270
271
|
export {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
j as DoubleSpringIntegrator,
|
|
273
|
+
q as InertiaIntegrator,
|
|
274
|
+
A as IntegratorProvider,
|
|
275
|
+
v as SpringIntegrator,
|
|
275
276
|
P as blur,
|
|
276
277
|
I as bounce,
|
|
277
278
|
k as fade,
|
package/dist/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(e){return("tick"in e||"css"in e)&&!("items"in e)}function a(e){return"items"in e}function y(e){return"css"in e&&typeof e.css=="function"}function p(e){return"tick"in e&&typeof e.tick=="function"}function o(e){return"keyframes"in e&&e.keyframes!==void 0&&e.keyframes!==null}async function h(e){const n=await e;return a(n)?{prepare:n.prepare,wait:n.wait,onReady:n.onReady,onStart:n.onStart,onEnd:n.onEnd,items:n.items,schedule:n.schedule}:{prepare:n.prepare,wait:n.wait,onReady:n.onReady,onStart:n.onStart,onEnd:n.onEnd,items:[{physics:n.physics,tick:n.tick,css:n.css}],schedule:"parallel"}}function k(e,n){const r=e.schedule??"parallel",l=e.items.map(s=>{let t;switch(r){case"parallel":t=0;break;case"sequential":t=1;break;case"stagger":t=Math.max(0,Math.min(1,s.offset??0));break;default:t=0}if(o(s)){const{offset:z,...d}=s;return{...d,normalizedOffset:t}}const{css:i,offset:S,...u}=s,m=i?typeof i=="function"?n?{element:n,style:i}:void 0:{element:i.element,style:i.style}:void 0;return{...u,css:m,normalizedOffset:t}}),{schedule:A,...c}=e;return{...c,items:l}}exports.isCssAnimation=y;exports.isKeyframesAnimation=o;exports.isMultiAnimation=a;exports.isSingleAnimation=f;exports.isTickAnimation=p;exports.normalizeSchedule=k;exports.normalizeToMultiAnimation=h;
|