@ssgoi/core 2.2.0 → 2.3.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.d.ts.map +1 -1
- package/dist/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +286 -250
- package/dist/transition-strategy.d.ts +1 -1
- package/dist/transition-strategy.d.ts.map +1 -1
- package/dist/transition.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +78 -77
- package/dist/transitions/mask.d.ts.map +1 -1
- package/dist/transitions/none.d.ts +4 -4
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/get-positioned-parent.d.ts +7 -0
- package/dist/utils/get-positioned-parent.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/view-transitions/film.d.ts +8 -0
- package/dist/view-transitions/film.d.ts.map +1 -0
- package/dist/view-transitions/index.cjs +15 -10
- package/dist/view-transitions/index.d.ts +1 -0
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +370 -278
- package/package.json +10 -9
|
@@ -61,5 +61,5 @@ export declare const createDefaultStrategy: <TAnimationValue = number>(context:
|
|
|
61
61
|
* Page transition strategy - Always starts fresh without checking current animations
|
|
62
62
|
* This is used for page-level transitions where each transition should be independent
|
|
63
63
|
*/
|
|
64
|
-
export declare const createPageTransitionStrategy: <TAnimationValue = number>(
|
|
64
|
+
export declare const createPageTransitionStrategy: <TAnimationValue = number>() => TransitionStrategy<TAnimationValue>;
|
|
65
65
|
//# sourceMappingURL=transition-strategy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../src/lib/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAA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AAK,EAAE,CACL,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAC,KACxC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,CACN,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAC,KACxC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,eAAO,MAAM,qBAAqB,GAAI,eAAe,GAAG,MAAM,EAC5D,SAAS,eAAe,CAAC,eAAe,CAAC,KACxC,kBAAkB,CAAC,eAAe,CA0HpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,eAAe,GAAG,MAAM,OACrB,kBAAkB,CAAC,eAAe,CAkEtC,CAAC"}
|
package/dist/transition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgE7C,wBAAgB,eAAe,IAAI,aAAa,CAY/C;
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgE7C,wBAAgB,eAAe,IAAI,aAAa,CAY/C;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,UAAU,CAAC,eAAe,GAAG,MAAM,EACjD,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG;IACvD,CAAC,mBAAmB,CAAC,CAAC,EAAE,CACtB,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,CAoBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=($={})=>{const{from:e=0,to:s=1,spring:f={stiffness:300,damping:30},key:l}=$;return{in:u=>({spring:f,tick:y=>{const a=e+(s-e)*y;u.style.opacity=a.toString()}}),out:u=>({spring:f,tick:y=>{const a=e+(s-e)*y;u.style.opacity=a.toString()}}),...l&&{key:l}}},h=($={})=>{const{start:e=0,opacity:s=0,axis:f="both",spring:l={stiffness:300,damping:30},key:u}=$,y=a=>{switch(f){case"x":return`scaleX(${a})`;case"y":return`scaleY(${a})`;case"both":default:return`scale(${a})`}};return{in:a=>({spring:l,tick:n=>{const t=e+(1-e)*n;a.style.transform=y(t),a.style.opacity=(s+(1-s)*n).toString()}}),out:a=>({spring:l,tick:n=>{const t=e+(1-e)*n;a.style.transform=y(t),a.style.opacity=(s+(1-s)*n).toString()}}),...u&&{key:u}}},x=($={})=>{const{direction:e,distance:s=100,opacity:f=0,fade:l=!0,axis:u,spring:y={stiffness:400,damping:35},key:a}=$,t=e||(u==="x"?"left":u==="y"?"up":"left"),c=i=>typeof i=="number"?`${i}px`:i,o=i=>{const r=1-i,p=typeof s=="number"?r*s:`calc(${c(s)} * ${r})`;switch(t){case"left":return typeof s=="number"?`translateX(${-p}px)`:`translateX(calc(-1 * ${p}))`;case"right":return typeof s=="number"?`translateX(${p}px)`:`translateX(${p})`;case"up":return typeof s=="number"?`translateY(${-p}px)`:`translateY(calc(-1 * ${p}))`;case"down":return typeof s=="number"?`translateY(${p}px)`:`translateY(${p})`}};return{in:i=>({spring:y,tick:r=>{i.style.transform=o(r),l&&(i.style.opacity=(f+(1-f)*r).toString())}}),out:i=>({spring:y,tick:r=>{i.style.transform=o(r),l&&(i.style.opacity=(f+(1-f)*r).toString())}}),...a&&{key:a}}},k=($={})=>{const{degrees:e=360,clockwise:s=!0,scale:f=!1,fade:l=!0,origin:u="center",axis:y="2d",perspective:a=800,spring:n={stiffness:500,damping:25},key:t}=$,c=s?e:-e,o=i=>{const r=(1-i)*c;switch(y){case"x":return`perspective(${a}px) rotateX(${r}deg)`;case"y":return`perspective(${a}px) rotateY(${r}deg)`;case"z":return`rotateZ(${r}deg)`;case"2d":default:return`rotate(${r}deg)`}};return{in:i=>({spring:n,tick:r=>{const p=[o(r)];f&&p.push(`scale(${r})`),i.style.transform=p.join(" "),i.style.transformOrigin=u,l&&(i.style.opacity=r.toString())}}),out:i=>({spring:n,tick:r=>{const p=[o(r)];f&&p.push(`scale(${r})`),i.style.transform=p.join(" "),i.style.transformOrigin=u,l&&(i.style.opacity=r.toString())}}),...t&&{key:t}}},S=($={})=>{const{height:e=20,intensity:s=1,scale:f=!0,fade:l=!0,direction:u="up",spring:y={stiffness:800,damping:15},key:a}=$;return{in:n=>({spring:y,tick:t=>{const c=[],o=Math.sin(t*Math.PI*(1+s)),i=1-t,r=o*e*i;if(u==="up"?c.push(`translateY(${-Math.abs(r)}px)`):c.push(`translateY(${Math.abs(r)}px)`),f){const p=.8+t*.2+o*.05*i;c.push(`scale(${p})`)}n.style.transform=c.join(" "),l&&(n.style.opacity=t.toString())}}),out:n=>({spring:y,tick:t=>{const c=[],o=Math.sin(t*Math.PI*(1+s)),i=1-t,r=o*e*i;if(u==="up"?c.push(`translateY(${-Math.abs(r)}px)`):c.push(`translateY(${Math.abs(r)}px)`),f){const p=.8+t*.2+o*.05*i;c.push(`scale(${p})`)}n.style.transform=c.join(" "),l&&(n.style.opacity=t.toString())}}),...a&&{key:a}}},M=($={})=>{const{amount:e=10,opacity:s=0,scale:f=!1,fade:l=!0,spring:u={stiffness:300,damping:30},key:y}=$,a=n=>typeof n=="number"?`${n}px`:n;return{in:n=>({spring:u,tick:t=>{const c=1-t,o=typeof e=="number"?c*e:`calc(${a(e)} * ${c})`;n.style.filter=typeof e=="number"?`blur(${o}px)`:`blur(${o})`,f&&(n.style.transform=`scale(${.8+t*.2})`),l&&(n.style.opacity=(s+(1-s)*t).toString())}}),out:n=>({spring:u,tick:t=>{const c=1-t,o=typeof e=="number"?c*e:`calc(${a(e)} * ${c})`;n.style.filter=typeof e=="number"?`blur(${o}px)`:`blur(${o})`,f&&(n.style.transform=`scale(${.8+t*.2})`),l&&(n.style.opacity=(s+(1-s)*t).toString())}}),...y&&{key:y}}},Y=($={})=>{const{x:e=0,y:s=-100,opacity:f=0,spring:l={stiffness:400,damping:35},key:u}=$,y=n=>typeof n=="number"?`${n}px`:n,a=n=>typeof n=="number"?`${n}px`:n;return{in:n=>({spring:l,tick:t=>{const c=typeof e=="number"?(1-t)*e:`calc(${y(e)} * ${1-t})`,o=typeof s=="number"?(1-t)*s:`calc(${a(s)} * ${1-t})`;n.style.transform=`translate(${typeof e=="number"?c+"px":c}, ${typeof s=="number"?o+"px":o})`,n.style.opacity=(f+(1-f)*t).toString()}}),out:n=>({spring:l,tick:t=>{const c=typeof e=="number"?(1-t)*e:`calc(${y(e)} * ${1-t})`,o=typeof s=="number"?(1-t)*s:`calc(${a(s)} * ${1-t})`;n.style.transform=`translate(${typeof e=="number"?c+"px":c}, ${typeof s=="number"?o+"px":o})`,n.style.opacity=(f+(1-f)*t).toString()}}),...u&&{key:u}}},O=($={})=>{const{shape:e="circle",origin:s="center",scale:f=1.5,fade:l=!1,spring:u={stiffness:300,damping:30},key:y}=$,a=()=>{switch(s){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%"}},n=t=>{const c=t*f*100,o=a();switch(e){case"ellipse":return`ellipse(${c}% ${c*.75}% at ${o})`;case"square":{const i=t*f*100,[r,p]=o.split(" "),m=parseFloat(r),d=parseFloat(p),b=i/2;return`polygon(${m-b}% ${d-b}%, ${m+b}% ${d-b}%, ${m+b}% ${d+b}%, ${m-b}% ${d+b}%)`}case"circle":default:return`circle(${c}% at ${o})`}};return{in:t=>({spring:u,tick:c=>{t.style.clipPath=n(c),l&&(t.style.opacity=c.toString())}}),out:t=>({spring:u,tick:c=>{t.style.clipPath=n(c),l&&(t.style.opacity=c.toString())}}),...y&&{key:y}}},V=($={})=>{const{spring:e={stiffness:1e3,damping:100},key:s}=$;return{in:()=>({spring:e,tick:()=>{}}),out:()=>({spring:e,tick:()=>{}}),...s&&{key:s}}};exports.blur=M;exports.bounce=S;exports.fade=g;exports.fly=Y;exports.mask=O;exports.none=V;exports.rotate=k;exports.scale=h;exports.slide=x;
|
|
@@ -2,35 +2,35 @@ const h = ($ = {}) => {
|
|
|
2
2
|
const {
|
|
3
3
|
from: e = 0,
|
|
4
4
|
to: s = 1,
|
|
5
|
-
spring:
|
|
6
|
-
key:
|
|
5
|
+
spring: f = { stiffness: 300, damping: 30 },
|
|
6
|
+
key: l
|
|
7
7
|
} = $;
|
|
8
8
|
return {
|
|
9
|
-
in: (
|
|
10
|
-
spring:
|
|
9
|
+
in: (u) => ({
|
|
10
|
+
spring: f,
|
|
11
11
|
tick: (y) => {
|
|
12
12
|
const a = e + (s - e) * y;
|
|
13
|
-
|
|
13
|
+
u.style.opacity = a.toString();
|
|
14
14
|
}
|
|
15
15
|
}),
|
|
16
|
-
out: (
|
|
17
|
-
spring:
|
|
16
|
+
out: (u) => ({
|
|
17
|
+
spring: f,
|
|
18
18
|
tick: (y) => {
|
|
19
19
|
const a = e + (s - e) * y;
|
|
20
|
-
|
|
20
|
+
u.style.opacity = a.toString();
|
|
21
21
|
}
|
|
22
22
|
}),
|
|
23
|
-
...
|
|
23
|
+
...l && { key: l }
|
|
24
24
|
};
|
|
25
25
|
}, d = ($ = {}) => {
|
|
26
26
|
const {
|
|
27
27
|
start: e = 0,
|
|
28
28
|
opacity: s = 0,
|
|
29
|
-
axis:
|
|
30
|
-
spring:
|
|
31
|
-
key:
|
|
29
|
+
axis: f = "both",
|
|
30
|
+
spring: l = { stiffness: 300, damping: 30 },
|
|
31
|
+
key: u
|
|
32
32
|
} = $, y = (a) => {
|
|
33
|
-
switch (
|
|
33
|
+
switch (f) {
|
|
34
34
|
case "x":
|
|
35
35
|
return `scaleX(${a})`;
|
|
36
36
|
case "y":
|
|
@@ -42,31 +42,31 @@ const h = ($ = {}) => {
|
|
|
42
42
|
};
|
|
43
43
|
return {
|
|
44
44
|
in: (a) => ({
|
|
45
|
-
spring:
|
|
45
|
+
spring: l,
|
|
46
46
|
tick: (n) => {
|
|
47
47
|
const t = e + (1 - e) * n;
|
|
48
48
|
a.style.transform = y(t), a.style.opacity = (s + (1 - s) * n).toString();
|
|
49
49
|
}
|
|
50
50
|
}),
|
|
51
51
|
out: (a) => ({
|
|
52
|
-
spring:
|
|
52
|
+
spring: l,
|
|
53
53
|
tick: (n) => {
|
|
54
54
|
const t = e + (1 - e) * n;
|
|
55
55
|
a.style.transform = y(t), a.style.opacity = (s + (1 - s) * n).toString();
|
|
56
56
|
}
|
|
57
57
|
}),
|
|
58
|
-
...
|
|
58
|
+
...u && { key: u }
|
|
59
59
|
};
|
|
60
60
|
}, x = ($ = {}) => {
|
|
61
61
|
const {
|
|
62
62
|
direction: e,
|
|
63
63
|
distance: s = 100,
|
|
64
|
-
opacity:
|
|
65
|
-
fade:
|
|
66
|
-
axis:
|
|
64
|
+
opacity: f = 0,
|
|
65
|
+
fade: l = !0,
|
|
66
|
+
axis: u,
|
|
67
67
|
spring: y = { stiffness: 400, damping: 35 },
|
|
68
68
|
key: a
|
|
69
|
-
} = $, t = e || (
|
|
69
|
+
} = $, t = e || (u === "x" ? "left" : u === "y" ? "up" : "left"), c = (i) => typeof i == "number" ? `${i}px` : i, o = (i) => {
|
|
70
70
|
const r = 1 - i, p = typeof s == "number" ? r * s : `calc(${c(s)} * ${r})`;
|
|
71
71
|
switch (t) {
|
|
72
72
|
case "left":
|
|
@@ -83,13 +83,13 @@ const h = ($ = {}) => {
|
|
|
83
83
|
in: (i) => ({
|
|
84
84
|
spring: y,
|
|
85
85
|
tick: (r) => {
|
|
86
|
-
i.style.transform =
|
|
86
|
+
i.style.transform = o(r), l && (i.style.opacity = (f + (1 - f) * r).toString());
|
|
87
87
|
}
|
|
88
88
|
}),
|
|
89
89
|
out: (i) => ({
|
|
90
90
|
spring: y,
|
|
91
91
|
tick: (r) => {
|
|
92
|
-
i.style.transform =
|
|
92
|
+
i.style.transform = o(r), l && (i.style.opacity = (f + (1 - f) * r).toString());
|
|
93
93
|
}
|
|
94
94
|
}),
|
|
95
95
|
...a && { key: a }
|
|
@@ -98,14 +98,14 @@ const h = ($ = {}) => {
|
|
|
98
98
|
const {
|
|
99
99
|
degrees: e = 360,
|
|
100
100
|
clockwise: s = !0,
|
|
101
|
-
scale:
|
|
102
|
-
fade:
|
|
103
|
-
origin:
|
|
101
|
+
scale: f = !1,
|
|
102
|
+
fade: l = !0,
|
|
103
|
+
origin: u = "center",
|
|
104
104
|
axis: y = "2d",
|
|
105
105
|
perspective: a = 800,
|
|
106
106
|
spring: n = { stiffness: 500, damping: 25 },
|
|
107
107
|
key: t
|
|
108
|
-
} = $, c = s ? e : -e,
|
|
108
|
+
} = $, c = s ? e : -e, o = (i) => {
|
|
109
109
|
const r = (1 - i) * c;
|
|
110
110
|
switch (y) {
|
|
111
111
|
case "x":
|
|
@@ -123,15 +123,15 @@ const h = ($ = {}) => {
|
|
|
123
123
|
in: (i) => ({
|
|
124
124
|
spring: n,
|
|
125
125
|
tick: (r) => {
|
|
126
|
-
const p = [
|
|
127
|
-
|
|
126
|
+
const p = [o(r)];
|
|
127
|
+
f && p.push(`scale(${r})`), i.style.transform = p.join(" "), i.style.transformOrigin = u, l && (i.style.opacity = r.toString());
|
|
128
128
|
}
|
|
129
129
|
}),
|
|
130
130
|
out: (i) => ({
|
|
131
131
|
spring: n,
|
|
132
132
|
tick: (r) => {
|
|
133
|
-
const p = [
|
|
134
|
-
|
|
133
|
+
const p = [o(r)];
|
|
134
|
+
f && p.push(`scale(${r})`), i.style.transform = p.join(" "), i.style.transformOrigin = u, l && (i.style.opacity = r.toString());
|
|
135
135
|
}
|
|
136
136
|
}),
|
|
137
137
|
...t && { key: t }
|
|
@@ -140,9 +140,9 @@ const h = ($ = {}) => {
|
|
|
140
140
|
const {
|
|
141
141
|
height: e = 20,
|
|
142
142
|
intensity: s = 1,
|
|
143
|
-
scale:
|
|
144
|
-
fade:
|
|
145
|
-
direction:
|
|
143
|
+
scale: f = !0,
|
|
144
|
+
fade: l = !0,
|
|
145
|
+
direction: u = "up",
|
|
146
146
|
spring: y = { stiffness: 800, damping: 15 },
|
|
147
147
|
key: a
|
|
148
148
|
} = $;
|
|
@@ -150,23 +150,23 @@ const h = ($ = {}) => {
|
|
|
150
150
|
in: (n) => ({
|
|
151
151
|
spring: y,
|
|
152
152
|
tick: (t) => {
|
|
153
|
-
const c = [],
|
|
154
|
-
if (
|
|
155
|
-
const p = 0.8 + t * 0.2 +
|
|
153
|
+
const c = [], o = Math.sin(t * Math.PI * (1 + s)), i = 1 - t, r = o * e * i;
|
|
154
|
+
if (u === "up" ? c.push(`translateY(${-Math.abs(r)}px)`) : c.push(`translateY(${Math.abs(r)}px)`), f) {
|
|
155
|
+
const p = 0.8 + t * 0.2 + o * 0.05 * i;
|
|
156
156
|
c.push(`scale(${p})`);
|
|
157
157
|
}
|
|
158
|
-
n.style.transform = c.join(" "),
|
|
158
|
+
n.style.transform = c.join(" "), l && (n.style.opacity = t.toString());
|
|
159
159
|
}
|
|
160
160
|
}),
|
|
161
161
|
out: (n) => ({
|
|
162
162
|
spring: y,
|
|
163
163
|
tick: (t) => {
|
|
164
|
-
const c = [],
|
|
165
|
-
if (
|
|
166
|
-
const p = 0.8 + t * 0.2 +
|
|
164
|
+
const c = [], o = Math.sin(t * Math.PI * (1 + s)), i = 1 - t, r = o * e * i;
|
|
165
|
+
if (u === "up" ? c.push(`translateY(${-Math.abs(r)}px)`) : c.push(`translateY(${Math.abs(r)}px)`), f) {
|
|
166
|
+
const p = 0.8 + t * 0.2 + o * 0.05 * i;
|
|
167
167
|
c.push(`scale(${p})`);
|
|
168
168
|
}
|
|
169
|
-
n.style.transform = c.join(" "),
|
|
169
|
+
n.style.transform = c.join(" "), l && (n.style.opacity = t.toString());
|
|
170
170
|
}
|
|
171
171
|
}),
|
|
172
172
|
...a && { key: a }
|
|
@@ -175,24 +175,24 @@ const h = ($ = {}) => {
|
|
|
175
175
|
const {
|
|
176
176
|
amount: e = 10,
|
|
177
177
|
opacity: s = 0,
|
|
178
|
-
scale:
|
|
179
|
-
fade:
|
|
180
|
-
spring:
|
|
178
|
+
scale: f = !1,
|
|
179
|
+
fade: l = !0,
|
|
180
|
+
spring: u = { stiffness: 300, damping: 30 },
|
|
181
181
|
key: y
|
|
182
182
|
} = $, a = (n) => typeof n == "number" ? `${n}px` : n;
|
|
183
183
|
return {
|
|
184
184
|
in: (n) => ({
|
|
185
|
-
spring:
|
|
185
|
+
spring: u,
|
|
186
186
|
tick: (t) => {
|
|
187
|
-
const c = 1 - t,
|
|
188
|
-
n.style.filter = typeof e == "number" ? `blur(${
|
|
187
|
+
const c = 1 - t, o = typeof e == "number" ? c * e : `calc(${a(e)} * ${c})`;
|
|
188
|
+
n.style.filter = typeof e == "number" ? `blur(${o}px)` : `blur(${o})`, f && (n.style.transform = `scale(${0.8 + t * 0.2})`), l && (n.style.opacity = (s + (1 - s) * t).toString());
|
|
189
189
|
}
|
|
190
190
|
}),
|
|
191
191
|
out: (n) => ({
|
|
192
|
-
spring:
|
|
192
|
+
spring: u,
|
|
193
193
|
tick: (t) => {
|
|
194
|
-
const c = 1 - t,
|
|
195
|
-
n.style.filter = typeof e == "number" ? `blur(${
|
|
194
|
+
const c = 1 - t, o = typeof e == "number" ? c * e : `calc(${a(e)} * ${c})`;
|
|
195
|
+
n.style.filter = typeof e == "number" ? `blur(${o}px)` : `blur(${o})`, f && (n.style.transform = `scale(${0.8 + t * 0.2})`), l && (n.style.opacity = (s + (1 - s) * t).toString());
|
|
196
196
|
}
|
|
197
197
|
}),
|
|
198
198
|
...y && { key: y }
|
|
@@ -201,34 +201,34 @@ const h = ($ = {}) => {
|
|
|
201
201
|
const {
|
|
202
202
|
x: e = 0,
|
|
203
203
|
y: s = -100,
|
|
204
|
-
opacity:
|
|
205
|
-
spring:
|
|
206
|
-
key:
|
|
204
|
+
opacity: f = 0,
|
|
205
|
+
spring: l = { stiffness: 400, damping: 35 },
|
|
206
|
+
key: u
|
|
207
207
|
} = $, y = (n) => typeof n == "number" ? `${n}px` : n, a = (n) => typeof n == "number" ? `${n}px` : n;
|
|
208
208
|
return {
|
|
209
209
|
in: (n) => ({
|
|
210
|
-
spring:
|
|
210
|
+
spring: l,
|
|
211
211
|
tick: (t) => {
|
|
212
|
-
const c = typeof e == "number" ? (1 - t) * e : `calc(${y(e)} * ${1 - t})`,
|
|
213
|
-
n.style.transform = `translate(${typeof e == "number" ? c + "px" : c}, ${typeof s == "number" ?
|
|
212
|
+
const c = typeof e == "number" ? (1 - t) * e : `calc(${y(e)} * ${1 - t})`, o = typeof s == "number" ? (1 - t) * s : `calc(${a(s)} * ${1 - t})`;
|
|
213
|
+
n.style.transform = `translate(${typeof e == "number" ? c + "px" : c}, ${typeof s == "number" ? o + "px" : o})`, n.style.opacity = (f + (1 - f) * t).toString();
|
|
214
214
|
}
|
|
215
215
|
}),
|
|
216
216
|
out: (n) => ({
|
|
217
|
-
spring:
|
|
217
|
+
spring: l,
|
|
218
218
|
tick: (t) => {
|
|
219
|
-
const c = typeof e == "number" ? (1 - t) * e : `calc(${y(e)} * ${1 - t})`,
|
|
220
|
-
n.style.transform = `translate(${typeof e == "number" ? c + "px" : c}, ${typeof s == "number" ?
|
|
219
|
+
const c = typeof e == "number" ? (1 - t) * e : `calc(${y(e)} * ${1 - t})`, o = typeof s == "number" ? (1 - t) * s : `calc(${a(s)} * ${1 - t})`;
|
|
220
|
+
n.style.transform = `translate(${typeof e == "number" ? c + "px" : c}, ${typeof s == "number" ? o + "px" : o})`, n.style.opacity = (f + (1 - f) * t).toString();
|
|
221
221
|
}
|
|
222
222
|
}),
|
|
223
|
-
...
|
|
223
|
+
...u && { key: u }
|
|
224
224
|
};
|
|
225
225
|
}, O = ($ = {}) => {
|
|
226
226
|
const {
|
|
227
227
|
shape: e = "circle",
|
|
228
228
|
origin: s = "center",
|
|
229
|
-
scale:
|
|
230
|
-
fade:
|
|
231
|
-
spring:
|
|
229
|
+
scale: f = 1.5,
|
|
230
|
+
fade: l = !1,
|
|
231
|
+
spring: u = { stiffness: 300, damping: 30 },
|
|
232
232
|
key: y
|
|
233
233
|
} = $, a = () => {
|
|
234
234
|
switch (s) {
|
|
@@ -253,29 +253,30 @@ const h = ($ = {}) => {
|
|
|
253
253
|
return "50% 50%";
|
|
254
254
|
}
|
|
255
255
|
}, n = (t) => {
|
|
256
|
-
const c = t *
|
|
256
|
+
const c = t * f * 100, o = a();
|
|
257
257
|
switch (e) {
|
|
258
258
|
case "ellipse":
|
|
259
|
-
return `ellipse(${c}% ${c * 0.75}% at ${
|
|
260
|
-
case "square":
|
|
261
|
-
const i = t *
|
|
262
|
-
return `polygon(${
|
|
259
|
+
return `ellipse(${c}% ${c * 0.75}% at ${o})`;
|
|
260
|
+
case "square": {
|
|
261
|
+
const i = t * f * 100, [r, p] = o.split(" "), m = parseFloat(r), g = parseFloat(p), b = i / 2;
|
|
262
|
+
return `polygon(${m - b}% ${g - b}%, ${m + b}% ${g - b}%, ${m + b}% ${g + b}%, ${m - b}% ${g + b}%)`;
|
|
263
|
+
}
|
|
263
264
|
case "circle":
|
|
264
265
|
default:
|
|
265
|
-
return `circle(${c}% at ${
|
|
266
|
+
return `circle(${c}% at ${o})`;
|
|
266
267
|
}
|
|
267
268
|
};
|
|
268
269
|
return {
|
|
269
270
|
in: (t) => ({
|
|
270
|
-
spring:
|
|
271
|
+
spring: u,
|
|
271
272
|
tick: (c) => {
|
|
272
|
-
t.style.clipPath = n(c),
|
|
273
|
+
t.style.clipPath = n(c), l && (t.style.opacity = c.toString());
|
|
273
274
|
}
|
|
274
275
|
}),
|
|
275
276
|
out: (t) => ({
|
|
276
|
-
spring:
|
|
277
|
+
spring: u,
|
|
277
278
|
tick: (c) => {
|
|
278
|
-
t.style.clipPath = n(c),
|
|
279
|
+
t.style.clipPath = n(c), l && (t.style.opacity = c.toString());
|
|
279
280
|
}
|
|
280
281
|
}),
|
|
281
282
|
...y && { key: y }
|
|
@@ -283,14 +284,14 @@ const h = ($ = {}) => {
|
|
|
283
284
|
}, V = ($ = {}) => {
|
|
284
285
|
const { spring: e = { stiffness: 1e3, damping: 100 }, key: s } = $;
|
|
285
286
|
return {
|
|
286
|
-
in: (
|
|
287
|
+
in: () => ({
|
|
287
288
|
spring: e,
|
|
288
|
-
tick: (
|
|
289
|
+
tick: () => {
|
|
289
290
|
}
|
|
290
291
|
}),
|
|
291
|
-
out: (
|
|
292
|
+
out: () => ({
|
|
292
293
|
spring: e,
|
|
293
|
-
tick: (
|
|
294
|
+
tick: () => {
|
|
294
295
|
}
|
|
295
296
|
}),
|
|
296
297
|
...s && { key: s }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/mask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxC,MAAM,CAAC,EACH,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/mask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxC,MAAM,CAAC,EACH,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBA4D5B,WAAW;;wBAlEb,MAAM;sBACR,MAAM;;yBAmEG,MAAM;;mBAQV,WAAW;;wBA5Ed,MAAM;sBACR,MAAM;;yBA6EG,MAAM;;CAU5B,CAAC"}
|
|
@@ -8,19 +8,19 @@ interface NoneOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const none: (options?: NoneOptions) => {
|
|
10
10
|
key?: TransitionKey | undefined;
|
|
11
|
-
in: (
|
|
11
|
+
in: () => {
|
|
12
12
|
spring: {
|
|
13
13
|
stiffness?: number;
|
|
14
14
|
damping?: number;
|
|
15
15
|
};
|
|
16
|
-
tick: (
|
|
16
|
+
tick: () => void;
|
|
17
17
|
};
|
|
18
|
-
out: (
|
|
18
|
+
out: () => {
|
|
19
19
|
spring: {
|
|
20
20
|
stiffness?: number;
|
|
21
21
|
damping?: number;
|
|
22
22
|
};
|
|
23
|
-
tick: (
|
|
23
|
+
tick: () => void;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/none.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB
|
|
1
|
+
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/none.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;;;wBAN9B,MAAM;sBACR,MAAM;;;;;;wBADJ,MAAM;sBACR,MAAM;;;;CAuBnB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -24,11 +24,42 @@ export type TransitionOptions<TContext = undefined, TAnimationValue = number> =
|
|
|
24
24
|
ref?: object;
|
|
25
25
|
};
|
|
26
26
|
export type TransitionCallback = (element: HTMLElement | null) => void | (() => void);
|
|
27
|
+
/**
|
|
28
|
+
* Context object passed to view transitions
|
|
29
|
+
* Provides essential information for smooth page transitions
|
|
30
|
+
*/
|
|
27
31
|
export type SggoiTransitionContext = {
|
|
32
|
+
/**
|
|
33
|
+
* The scroll position difference between 'from' and 'to' pages
|
|
34
|
+
* Used in hero and pinterest transitions to maintain natural scroll position
|
|
35
|
+
* when transitioning between pages with different scroll states
|
|
36
|
+
*/
|
|
28
37
|
scrollOffset: {
|
|
29
38
|
x: number;
|
|
30
39
|
y: number;
|
|
31
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* The current page's scroll position
|
|
43
|
+
* Provides the actual scroll coordinates for precise viewport calculations
|
|
44
|
+
* OUT transition receives 'from' page scroll, IN transition receives 'to' page scroll
|
|
45
|
+
*/
|
|
46
|
+
scroll: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The scrollable container element (document.documentElement or custom container)
|
|
52
|
+
* Provides viewport dimensions for calculating transition animations
|
|
53
|
+
* Lazy-evaluated to handle delayed initialization
|
|
54
|
+
*/
|
|
55
|
+
scrollingElement: HTMLElement;
|
|
56
|
+
/**
|
|
57
|
+
* The positioned parent element (containing block for absolute positioning)
|
|
58
|
+
* Returns the nearest ancestor with position: relative/absolute/fixed/sticky
|
|
59
|
+
* Falls back to document.body if no positioned ancestor exists
|
|
60
|
+
* Lazy-evaluated to handle delayed initialization
|
|
61
|
+
*/
|
|
62
|
+
positionedParent: HTMLElement;
|
|
32
63
|
};
|
|
33
64
|
export type SggoiTransition = Transition<SggoiTransitionContext>;
|
|
34
65
|
export type SsgoiConfig = {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,M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IACH,gBAAgB,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,eAAe,CAAC;QAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,EAAE,CAAC;IACJ,iBAAiB,CAAC,EAAE,eAAe,CAAC;IACpC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,KACT,UAAU,GAAG;IAAE,GAAG,EAAE,aAAa,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the positioned parent element that serves as the containing block for absolute positioning
|
|
3
|
+
* Returns the nearest ancestor with position: relative, absolute, fixed, or sticky
|
|
4
|
+
* Falls back to document.body if no positioned ancestor is found
|
|
5
|
+
*/
|
|
6
|
+
export declare const getPositionedParent: (element: HTMLElement) => HTMLElement;
|
|
7
|
+
//# sourceMappingURL=get-positioned-parent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-positioned-parent.d.ts","sourceRoot":"","sources":["../../src/lib/utils/get-positioned-parent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,WAqB1D,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { prepareOutgoing } from './prepare-outgoing';
|
|
2
2
|
export { getScrollingElement } from './get-scrolling-element';
|
|
3
|
+
export { getPositionedParent } from './get-positioned-parent';
|
|
3
4
|
export { parseCallerLocation } from './parse-caller-location';
|
|
4
5
|
export { sleep } from './sleep';
|
|
5
6
|
export { getRect } from './get-rect';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"film.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/film.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,YAAY,EACb,MAAM,UAAU,CAAC;AAgBlB,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAwDD,eAAO,MAAM,IAAI,GAAI,UAAU,WAAW,KAAG,eAsG5C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=t=>{t.style.position="absolute",t.style.width="100%",t.style.top="0",t.style.left="0"},N=t=>new Promise(n=>setTimeout(n,t)),v={stiffness:80,damping:25},C={stiffness:75,damping:25},G=300,q=10,B="horizontal",M="#000000",H=(t={})=>{const{inSpring:n=C,outSpring:e=v,transitionDelay:s=G,blindCount:l=q,direction:a=B,staggerDelay:r=100,blindColor:i=M}=t;let o,h=null;const d=(p,c,f,u=!1)=>{const y=Math.min(.5,r*f/1e3),g=1-y,x=(u?f-1-c:c)/f*y,S=x+g;return p<=x?0:p>=S?1:(p-x)/g},$=(p,c,f="left")=>{window.getComputedStyle(p).position==="static"&&(p.style.position="relative");const y=document.createElement("div");y.className="blind-container",y.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -7,24 +7,29 @@
|
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
z-index: 9999;
|
|
9
9
|
overflow: hidden;
|
|
10
|
-
`;const g=[];for(let w=0;w<
|
|
10
|
+
`;const g=[];for(let w=0;w<l;w++){const x=document.createElement("div");if(a==="horizontal"){const S=100/l,A=`calc(${S}% + 1px)`;x.style.cssText=`
|
|
11
11
|
position: absolute;
|
|
12
|
-
top: ${
|
|
12
|
+
top: ${S*w}%;
|
|
13
13
|
left: 0;
|
|
14
14
|
width: 100%;
|
|
15
15
|
height: ${A};
|
|
16
|
-
background: ${
|
|
17
|
-
transform: scaleX(${
|
|
16
|
+
background: ${i};
|
|
17
|
+
transform: scaleX(${c==="hidden"?0:1});
|
|
18
18
|
transform-origin: ${f} center;
|
|
19
19
|
will-change: transform;
|
|
20
|
-
`}else{const
|
|
20
|
+
`}else{const S=100/l,A=`calc(${S}% + 1px)`;x.style.cssText=`
|
|
21
21
|
position: absolute;
|
|
22
22
|
top: 0;
|
|
23
|
-
left: ${
|
|
23
|
+
left: ${S*w}%;
|
|
24
24
|
width: ${A};
|
|
25
25
|
height: 100%;
|
|
26
|
-
background: ${
|
|
27
|
-
transform: scaleY(${
|
|
26
|
+
background: ${i};
|
|
27
|
+
transform: scaleY(${c==="hidden"?0:1});
|
|
28
28
|
transform-origin: ${f==="left"?"top":"bottom"} center;
|
|
29
29
|
will-change: transform;
|
|
30
|
-
`}g.push(x),y.appendChild(x)}return
|
|
30
|
+
`}g.push(x),y.appendChild(x)}return p.appendChild(y),{container:y,blinds:g}};return{out:()=>{let p=null;return o=new Promise(c=>{h=c}),{spring:e,prepare:c=>{D(c),c.style.zIndex="1000",p=$(c,"hidden","left")},onStart:()=>{},tick:c=>{if(!p)return;const f=1-c;p.blinds.forEach((u,y)=>{const g=d(f,y,l,!1);a==="horizontal"?u.style.transform=`scaleX(${g})`:u.style.transform=`scaleY(${g})`})},onEnd:()=>{h&&h()}}},in:()=>{let p=null;return{spring:n,prepare:c=>{c.style.position="relative",c.style.zIndex="0",p=$(c,"closed","right")},onStart:()=>{},wait:async()=>{o&&await o,await N(s)},tick:c=>{p&&p.blinds.forEach((f,u)=>{const y=d(c,u,l,!1);a==="horizontal"?f.style.transform=`scaleX(${1-y})`:f.style.transform=`scaleY(${1-y})`})},onEnd:()=>{p&&p.container&&p.container.remove()}}}}},k=t=>{t.style.position="absolute",t.style.width="100%",t.style.top="0",t.style.left="0"},W=(t={})=>{var l,a;const{opacity:n=!1,direction:e="enter"}=t,s={stiffness:((l=t.spring)==null?void 0:l.stiffness)??150,damping:((a=t.spring)==null?void 0:a.damping)??20};return e==="enter"?{in:r=>({spring:s,tick:i=>{r.style.transform=`translateX(${(1-i)*100}%)`,n&&(r.style.opacity=i.toString())}}),out:r=>({spring:s,prepare:i=>{k(i),i.style.zIndex="-1"},tick:i=>{r.style.transform=`translateX(${-(1-i)*20}%)`,n&&(r.style.opacity=i.toString())}})}:{in:r=>({spring:{stiffness:100,damping:20},tick:i=>{r.style.transform=`translateX(${-(1-i)*20}%)`,n&&(r.style.opacity=i.toString())}}),out:r=>({spring:{stiffness:100,damping:20},prepare:i=>{k(i),i.style.zIndex="100"},tick:i=>{r.style.transform=`translateX(${(1-i)*100}%)`,n&&(r.style.opacity=i.toString())}})}},j=t=>new Promise(n=>setTimeout(n,t)),Z={stiffness:400,damping:20},J={stiffness:40,damping:8},K=100,Q=(t={})=>{const{inSpring:n=J,outSpring:e=Z,transitionDelay:s=K}=t;let l,a=null;return{in:r=>({spring:n,prepare:i=>{i.style.opacity="0"},wait:async()=>{l&&(await l,await j(s))},tick:i=>{r.style.opacity=i.toString()}}),out:r=>(l=new Promise(i=>{a=i}),{spring:e,tick:i=>{r.style.opacity=i.toString()},prepare:k,onEnd:()=>{a&&a()}})}};function P(t,n){function e(a){let r=0,i=0;const o=a.offsetWidth,h=a.offsetHeight;let d=a;for(;d;)r+=d.offsetTop,i+=d.offsetLeft,d=d.offsetParent;return r-=window.scrollY,i-=window.scrollX,{top:r,left:i,width:o,height:h}}const s=e(t),l=e(n);return new DOMRect(l.left-s.left,l.top-s.top,l.width,l.height)}const V={stiffness:10,damping:5},m=.2,T=.82;function I(t){const n=P(document.body,t.positionedParent);return{top:t.scroll.y,left:0,width:n.width,height:window.innerHeight-n.top}}function b(t,n){const e=n.left+n.width/2,s=n.top+n.height/2;t.style.transformOrigin=`${e}px ${s}px`}function Y(t,n){t.style.clipPath=`polygon(
|
|
31
|
+
${n.left}px ${n.top}px,
|
|
32
|
+
${n.left+n.width}px ${n.top}px,
|
|
33
|
+
${n.left+n.width}px ${n.top+n.height}px,
|
|
34
|
+
${n.left}px ${n.top+n.height}px
|
|
35
|
+
)`}function E(t,n,e){return t<=n?0:t>=e?1:(t-n)/(e-n)}const R=t=>{const n=(t==null?void 0:t.spring)??V,e=(t==null?void 0:t.scale)??.9;return{out:async(s,l)=>{const a=I(l);return{spring:n,prepare:()=>{D(s),b(s,a),Y(s,a)},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin=""},tick:r=>{const i=1-r;if(i<m){const o=E(i,0,m),h=1-(1-e)*o;s.style.transform=`scale(${h})`}else if(i<T){const o=E(i,m,T),h=-a.height*o;s.style.transform=`translateY(${h}px) scale(${e})`}else{const o=E(i,T,1),h=e+(1-e)*o;s.style.transform=`translateY(${-a.height}px) scale(${h})`}}}},in:async(s,l)=>{const a=I(l);return{spring:n,prepare:()=>{b(s,a),Y(s,a),s.style.transform=`translateY(${a.height}px) scale(${e})`},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin=""},tick:r=>{if(r<m)s.style.transform=`translateY(${a.height}px) scale(${e})`,s.style.opacity="0";else if(r<T){const i=E(r,m,T),o=a.height*(1-i);s.style.transform=`translateY(${o}px) scale(${e})`,s.style.opacity="1"}else{const i=E(r,T,1),o=e+(1-e)*i;s.style.transform=`scale(${o})`,s.style.opacity="1"}}}}}};function tt(t,n){return t.querySelector(`[data-hero-key="${n}"]`)}const nt=(t={})=>{var a,r;const n={stiffness:((a=t.spring)==null?void 0:a.stiffness)??300,damping:((r=t.spring)==null?void 0:r.damping)??30},e=t.timeout??300;let s=null,l=null;return{in:async(i,o)=>{const h=i,d=Array.from(h.querySelectorAll("[data-hero-key]"));if(d.length===0)return{spring:n,tick:()=>{}};if(!await new Promise(c=>{s?c(!0):(l=c,setTimeout(()=>{l=null,c(!1)},e))})||!s)return s=null,{spring:n,tick:()=>{}};const p=d.map(c=>{const f=c.getAttribute("data-hero-key");if(!f)return null;const u=tt(s,f);if(!u)return null;const y=c,g=P(s,u),w=P(h,y),x=g.left-w.left-o.scrollOffset.x,S=g.top-w.top-o.scrollOffset.y,A=g.width/w.width,F=g.height/w.height,O=y.style.transform,X=y.style.position,U=y.style.transformOrigin,z=y.style.zIndex;return{toEl:y,dx:x,dy:S,dw:A,dh:F,originalTransform:O,originalPosition:X,originalTransformOrigin:U,originalZIndex:z}}).filter(Boolean);return s=null,p.length===0?{spring:n,tick:()=>{}}:{spring:n,prepare:()=>{p.forEach(({toEl:c})=>{c.style.position="relative",c.style.transformOrigin="top left",c.style.zIndex="1000"})},tick:c=>{p.forEach(({toEl:f,dx:u,dy:y,dw:g,dh:w})=>{f.style.transform=`translate(${(1-c)*u}px,${(1-c)*y}px) scale(${c+(1-c)*g}, ${c+(1-c)*w})`})},onEnd:()=>{p.forEach(({toEl:c,originalTransform:f,originalPosition:u,originalTransformOrigin:y,originalZIndex:g})=>{c.style.transform=f,c.style.position=u,c.style.transformOrigin=y,c.style.zIndex=g})}}},out:async i=>({onStart:()=>{s=i,l&&(l(!0),l=null)},prepare:o=>{k(o),o.style.opacity="0"}})}};function it({detailRect:t,galleryRect:n,pageRect:e,scrollOffset:s},l){const a=n.left-t.left+(n.width-t.width)/2-s.x,r=n.top-t.top+(n.height-t.height)/2-s.y,i=n.width/t.width,o=n.height/t.height,h=Math.max(i,o),d=t.top/e.height*100,$=(e.width-(t.left+t.width))/e.width*100,p=(e.height-(t.top+t.height))/e.height*100,c=t.left/e.width*100;return l.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,f=>{const u=1-f,y=d*u,g=$*u,w=p*u,x=c*u;l.style.clipPath=`inset(${y}% ${g}% ${w}% ${x}%)`,l.style.transform=`translate(${a*u}px, ${r*u}px) scale(${1+(h-1)*u})`}}function st({galleryRect:t,detailRect:n,scrollOffset:e},s){const l=n.left-t.left+(n.width-t.width)/2+e.x,a=n.top-t.top+(n.height-t.height)/2+e.y,r=n.width/t.width,i=n.height/t.height,o=Math.max(r,i);return h=>{s.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const d=1-h;s.style.transform=`translate(${l*d-e.x}px, ${a*d-e.y}px) scale(${1+(o-1)*d})`,s.style.opacity=`${1-d}`}}function et({galleryRect:t,detailRect:n,scrollOffset:e},s){const l=n.left-t.left+(n.width-t.width)/2-e.x,a=n.top-t.top+(n.height-t.height)/2-e.y,r=n.width/t.width,i=n.height/t.height,o=Math.max(r,i);return h=>{const d=1-h,$=h;s.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,s.style.transform=`translate(${l*d}px, ${a*d}px) scale(${1+(o-1)*d})`,s.style.opacity=`${$}`}}function rt({detailRect:t,galleryRect:n,pageRect:e,scrollOffset:s},l){const a=n.left-t.left+(n.width-t.width)/2+s.x,r=n.top-t.top+(n.height-t.height)/2+s.y,i=n.width/t.width,o=n.height/t.height,h=Math.min(i,o),d=t.top/e.height*100,$=(e.width-(t.left+t.width))/e.width*100,p=(e.height-(t.top+t.height))/e.height*100,c=t.left/e.width*100;return l.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,f=>{const u=1-f,y=d*u,g=$*u,w=p*u,x=c*u;l.style.clipPath=`inset(${y}% ${g}% ${w}% ${x}%)`,l.style.transform=`translate(${a*u-s.x}px, ${r*u-s.y}px) scale(${1+(h-1)*u})`}}function at(t,n,e){const s=t.querySelector("[data-pinterest-detail-key]"),l=n.querySelector("[data-pinterest-detail-key]");if(t.querySelectorAll("[data-pinterest-detail-key]").length>1||n.querySelectorAll("[data-pinterest-detail-key]").length>1)return null;let a=null,r=null,i=!1;if(!s&&l){r=l;const $=r.getAttribute("data-pinterest-detail-key");if(!$)return null;a=t.querySelector(`[data-pinterest-gallery-key="${$}"]`),a&&(i=!0)}else if(s&&!l){r=s;const $=r.getAttribute("data-pinterest-detail-key");if(!$)return null;a=n.querySelector(`[data-pinterest-gallery-key="${$}"]`),a&&(i=!1)}if(!a||!r)return null;const o=P(i?t:n,a),h=P(i?n:t,r),d=n.getBoundingClientRect();return i?{inAnimation:it({detailRect:h,galleryRect:o,pageRect:d,scrollOffset:e},n),outAnimation:st({galleryRect:o,detailRect:h,scrollOffset:e},t)}:{inAnimation:et({galleryRect:o,detailRect:h,scrollOffset:e},n),outAnimation:rt({detailRect:h,galleryRect:o,pageRect:d,scrollOffset:e},t)}}const lt=(t={})=>{var r,i;const n={stiffness:((r=t.spring)==null?void 0:r.stiffness)??50,damping:((i=t.spring)==null?void 0:i.damping)??10},e=t.timeout??300;let s=null,l=null,a=null;return{in:async(o,{scrollOffset:h})=>{const d=o;return!await new Promise(p=>{s?p(!0):(l=p,setTimeout(()=>{l=null,p(!1)},e))})||!s?(s=null,{spring:n,tick:()=>{}}):(a=at(s,d,h),a?(s=null,{spring:n,tick:p=>{a&&a.inAnimation(p)}}):{spring:n,tick:()=>{}})},out:async o=>({spring:n,onStart:()=>{s=o,l&&(l(!0),l=null)},prepare:h=>{k(h),h.style.zIndex="-1"},tick:h=>{a&&a.outAnimation(h)}})}},_={stiffness:30,damping:7},ot=(t={})=>{var l,a;const n=t.direction??"up",e={stiffness:((l=t.spring)==null?void 0:l.stiffness)??_.stiffness,damping:((a=t.spring)==null?void 0:a.damping)??_.damping},s=n==="up";return{in:r=>({spring:e,tick:i=>{const o=s?(1-i)*100:(1-i)*-100;r.style.transform=`translateY(${o}vh)`}}),out:r=>({spring:e,tick:i=>{const o=s?(1-i)*-100:(1-i)*100;r.style.transform=`translateY(${o}vh)`},prepare:i=>{k(i),i.style.zIndex=s?"-1":"1"}})}},L={stiffness:30,damping:7},ct=(t={})=>{var l,a;const n=t.direction??"left",e={stiffness:((l=t.spring)==null?void 0:l.stiffness)??L.stiffness,damping:((a=t.spring)==null?void 0:a.damping)??L.damping},s=n==="left";return{in:r=>({spring:e,tick:i=>{const o=s?(1-i)*100:(1-i)*-100;r.style.transform=`translateX(${o}%)`}}),out:r=>({spring:e,tick:i=>{const o=s?(1-i)*-100:(1-i)*100;r.style.transform=`translateX(${o}%)`},prepare:i=>{D(i),i.style.zIndex=s?"-1":"1"}})}};exports.blind=H;exports.drill=W;exports.fade=Q;exports.film=R;exports.hero=nt;exports.pinterest=lt;exports.scroll=ot;exports.slide=ct;
|