@ssgoi/core 2.4.0 → 2.5.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/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +284 -258
- package/dist/jaemin-BAi8PTrj.js +130 -0
- package/dist/jaemin-DL1-g_B5.cjs +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/view-transitions/film.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts +1 -0
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +19 -19
- package/dist/view-transitions/index.d.ts +2 -1
- package/dist/view-transitions/index.d.ts.map +1 -1
- package/dist/view-transitions/index.js +484 -522
- package/dist/view-transitions/jaemin.d.ts +4 -0
- package/dist/view-transitions/jaemin.d.ts.map +1 -1
- package/dist/view-transitions/strip.d.ts +3 -0
- package/dist/view-transitions/strip.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
function R(i, a) {
|
|
2
|
+
function o(d) {
|
|
3
|
+
let l = 0, y = 0;
|
|
4
|
+
const t = d.offsetWidth, g = d.offsetHeight;
|
|
5
|
+
let s = d;
|
|
6
|
+
for (; s; )
|
|
7
|
+
l += s.offsetTop, y += s.offsetLeft, s = s.offsetParent;
|
|
8
|
+
return l -= window.scrollY, y -= window.scrollX, { top: l, left: y, width: t, height: g };
|
|
9
|
+
}
|
|
10
|
+
const e = o(i), n = o(a);
|
|
11
|
+
return new DOMRect(
|
|
12
|
+
n.left - e.left,
|
|
13
|
+
n.top - e.top,
|
|
14
|
+
n.width,
|
|
15
|
+
n.height
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const v = (i, a) => {
|
|
19
|
+
i.style.position = "absolute", i.style.width = "100%", i.style.top = `${-1 * ((a == null ? void 0 : a.scroll.y) ?? 0)}px`, i.style.left = "0";
|
|
20
|
+
};
|
|
21
|
+
function M(i, a = "viewport") {
|
|
22
|
+
if (a === "positioned-parent") {
|
|
23
|
+
const o = i.positionedParent.getBoundingClientRect();
|
|
24
|
+
return {
|
|
25
|
+
top: o.top,
|
|
26
|
+
left: o.left,
|
|
27
|
+
width: o.width,
|
|
28
|
+
height: o.height
|
|
29
|
+
};
|
|
30
|
+
} else {
|
|
31
|
+
const o = R(document.body, i.positionedParent);
|
|
32
|
+
return {
|
|
33
|
+
top: i.scroll.y,
|
|
34
|
+
left: 0,
|
|
35
|
+
width: o.width,
|
|
36
|
+
height: window.innerHeight - o.top
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const F = (i = {}) => O(i), O = (i = {}) => {
|
|
41
|
+
var l, y;
|
|
42
|
+
const a = {
|
|
43
|
+
// Much slower animation - 4x duration by reducing stiffness further
|
|
44
|
+
stiffness: ((l = i.spring) == null ? void 0 : l.stiffness) ?? 50,
|
|
45
|
+
damping: ((y = i.spring) == null ? void 0 : y.damping) ?? 30
|
|
46
|
+
}, o = i.initialRotation ?? 45, e = i.initialScale ?? 0.01, n = i.rotationTriggerPoint ?? 0.8, d = i.containerMode ?? "viewport";
|
|
47
|
+
return {
|
|
48
|
+
out: async (t, g) => {
|
|
49
|
+
const s = t.style.opacity;
|
|
50
|
+
return {
|
|
51
|
+
spring: {
|
|
52
|
+
stiffness: 80,
|
|
53
|
+
damping: 25
|
|
54
|
+
},
|
|
55
|
+
from: 1,
|
|
56
|
+
to: 0,
|
|
57
|
+
prepare: () => {
|
|
58
|
+
v(t, g), t.style.opacity = "1";
|
|
59
|
+
},
|
|
60
|
+
tick: (w) => {
|
|
61
|
+
t.style.opacity = String(w);
|
|
62
|
+
},
|
|
63
|
+
onEnd: () => {
|
|
64
|
+
t.style.opacity = s;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
in: async (t, g) => {
|
|
69
|
+
const s = M(g, d), w = t.style.transform, b = t.style.transformOrigin, x = t.style.position, $ = t.style.zIndex;
|
|
70
|
+
return {
|
|
71
|
+
spring: a,
|
|
72
|
+
from: 0,
|
|
73
|
+
to: 1,
|
|
74
|
+
prepare: () => {
|
|
75
|
+
const r = Math.min(s.width, s.height) * 0.4;
|
|
76
|
+
if (t.style.setProperty(
|
|
77
|
+
"--max-border-radius",
|
|
78
|
+
`${r}px`
|
|
79
|
+
), t.style.setProperty("--border-radius-scale", "1"), t.style.willChange = "transform", t.style.backfaceVisibility = "hidden", d === "positioned-parent")
|
|
80
|
+
t.style.transformOrigin = "50% 50%", t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.width = `${s.width}px`, t.style.height = `${s.height}px`;
|
|
81
|
+
else {
|
|
82
|
+
const p = s.left + s.width / 2, h = s.top + s.height / 2;
|
|
83
|
+
t.style.transformOrigin = `${p}px ${h}px`, t.style.position = "fixed", t.style.top = `${s.top}px`, t.style.left = `${s.left}px`, t.style.width = `${s.width}px`, t.style.height = `${s.height}px`;
|
|
84
|
+
}
|
|
85
|
+
t.style.zIndex = "1000", t.style.overflow = "hidden", t.style.transform = `rotate(${o}deg) scale(${e}) translateZ(0)`, t.style.borderRadius = "calc(var(--max-border-radius) * var(--border-radius-scale))", t.style.opacity = "1";
|
|
86
|
+
},
|
|
87
|
+
tick: (r) => {
|
|
88
|
+
let p;
|
|
89
|
+
if (r <= 0.05)
|
|
90
|
+
p = e;
|
|
91
|
+
else if (r <= n) {
|
|
92
|
+
const c = (r - 0.05) / (n - 0.05), u = Math.pow(c, 9);
|
|
93
|
+
p = e + (0.8 - e) * u;
|
|
94
|
+
} else {
|
|
95
|
+
const c = (r - n) / (1 - n);
|
|
96
|
+
p = 0.8 + 0.2 * (1 - Math.pow(1 - c, 3));
|
|
97
|
+
}
|
|
98
|
+
let h;
|
|
99
|
+
const f = 0.7;
|
|
100
|
+
if (r <= f)
|
|
101
|
+
h = o;
|
|
102
|
+
else {
|
|
103
|
+
const c = (r - f) / (1 - f), u = 1 - Math.pow(1 - c, 2);
|
|
104
|
+
h = o * (1 - u);
|
|
105
|
+
}
|
|
106
|
+
let P;
|
|
107
|
+
if (r <= f)
|
|
108
|
+
P = 1;
|
|
109
|
+
else {
|
|
110
|
+
const c = (r - f) / (1 - f);
|
|
111
|
+
P = 1 - Math.pow(c, 0.5);
|
|
112
|
+
}
|
|
113
|
+
t.style.transform = `rotate(${h.toFixed(2)}deg) scale(${p.toFixed(4)}) translateZ(0)`, t.style.setProperty(
|
|
114
|
+
"--border-radius-scale",
|
|
115
|
+
P.toFixed(4)
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
onEnd: () => {
|
|
119
|
+
t.style.willChange = "", t.style.backfaceVisibility = "", t.style.removeProperty("--max-border-radius"), t.style.removeProperty("--border-radius-scale"), t.style.transform = w, t.style.transformOrigin = b, t.style.position = x, t.style.zIndex = $, t.style.top = "", t.style.left = "", t.style.width = "", t.style.height = "", t.style.overflow = "", t.style.borderRadius = "";
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
F as a,
|
|
127
|
+
R as g,
|
|
128
|
+
O as j,
|
|
129
|
+
v as p
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function b(i,a){function o(d){let l=0,y=0;const t=d.offsetWidth,g=d.offsetHeight;let s=d;for(;s;)l+=s.offsetTop,y+=s.offsetLeft,s=s.offsetParent;return l-=window.scrollY,y-=window.scrollX,{top:l,left:y,width:t,height:g}}const e=o(i),n=o(a);return new DOMRect(n.left-e.left,n.top-e.top,n.width,n.height)}const x=(i,a)=>{i.style.position="absolute",i.style.width="100%",i.style.top=`${-1*((a==null?void 0:a.scroll.y)??0)}px`,i.style.left="0"};function M(i,a="viewport"){if(a==="positioned-parent"){const o=i.positionedParent.getBoundingClientRect();return{top:o.top,left:o.left,width:o.width,height:o.height}}else{const o=b(document.body,i.positionedParent);return{top:i.scroll.y,left:0,width:o.width,height:window.innerHeight-o.top}}}const F=(i={})=>R(i),R=(i={})=>{var l,y;const a={stiffness:((l=i.spring)==null?void 0:l.stiffness)??50,damping:((y=i.spring)==null?void 0:y.damping)??30},o=i.initialRotation??45,e=i.initialScale??.01,n=i.rotationTriggerPoint??.8,d=i.containerMode??"viewport";return{out:async(t,g)=>{const s=t.style.opacity;return{spring:{stiffness:80,damping:25},from:1,to:0,prepare:()=>{x(t,g),t.style.opacity="1"},tick:w=>{t.style.opacity=String(w)},onEnd:()=>{t.style.opacity=s}}},in:async(t,g)=>{const s=M(g,d),w=t.style.transform,$=t.style.transformOrigin,O=t.style.position,v=t.style.zIndex;return{spring:a,from:0,to:1,prepare:()=>{const r=Math.min(s.width,s.height)*.4;if(t.style.setProperty("--max-border-radius",`${r}px`),t.style.setProperty("--border-radius-scale","1"),t.style.willChange="transform",t.style.backfaceVisibility="hidden",d==="positioned-parent")t.style.transformOrigin="50% 50%",t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.width=`${s.width}px`,t.style.height=`${s.height}px`;else{const p=s.left+s.width/2,h=s.top+s.height/2;t.style.transformOrigin=`${p}px ${h}px`,t.style.position="fixed",t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.width=`${s.width}px`,t.style.height=`${s.height}px`}t.style.zIndex="1000",t.style.overflow="hidden",t.style.transform=`rotate(${o}deg) scale(${e}) translateZ(0)`,t.style.borderRadius="calc(var(--max-border-radius) * var(--border-radius-scale))",t.style.opacity="1"},tick:r=>{let p;if(r<=.05)p=e;else if(r<=n){const c=(r-.05)/(n-.05),u=Math.pow(c,9);p=e+(.8-e)*u}else{const c=(r-n)/(1-n);p=.8+.2*(1-Math.pow(1-c,3))}let h;const f=.7;if(r<=f)h=o;else{const c=(r-f)/(1-f),u=1-Math.pow(1-c,2);h=o*(1-u)}let P;if(r<=f)P=1;else{const c=(r-f)/(1-f);P=1-Math.pow(c,.5)}t.style.transform=`rotate(${h.toFixed(2)}deg) scale(${p.toFixed(4)}) translateZ(0)`,t.style.setProperty("--border-radius-scale",P.toFixed(4))},onEnd:()=>{t.style.willChange="",t.style.backfaceVisibility="",t.style.removeProperty("--max-border-radius"),t.style.removeProperty("--border-radius-scale"),t.style.transform=w,t.style.transformOrigin=$,t.style.position=O,t.style.zIndex=v,t.style.top="",t.style.left="",t.style.width="",t.style.height="",t.style.overflow="",t.style.borderRadius=""}}}}};exports.getRect=b;exports.jaemin=F;exports.jaeminInternal=R;exports.prepareOutgoing=x;
|
package/dist/types.d.ts
CHANGED
|
@@ -74,6 +74,12 @@ export type SsgoiConfig = {
|
|
|
74
74
|
from: string;
|
|
75
75
|
to: string;
|
|
76
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Skip page transitions when iOS/Safari swipe-back gesture is detected
|
|
79
|
+
* This prevents animation conflicts between SSGOI and Safari's native swipe animation
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
skipOnIosSwipe?: boolean;
|
|
77
83
|
};
|
|
78
84
|
export type SsgoiContext = (path: string) => Transition & {
|
|
79
85
|
key: TransitionKey;
|
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,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,eAAe,GAAG,MAAM,IAAI;IAEvD,MAAM,CAAC,EAAE,YAAY,CAAC;IAGtB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,EAAE,CAAC,EAAE,eAAe,CAAC;IAGrB,IAAI,CAAC,EAAE,CAAC,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AC,CAAC;AAEzB;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEvC;;;;OAIG;IACH,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEjC;;;;OAIG;IACH,gBAAgB,EAAE,WAAW,CAAC;IAE9B;;;;;OAKG;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;IACxE;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,KACT,UAAU,GAAG;IAAE,GAAG,EAAE,aAAa,CAAA;CAAE,CAAC"}
|
|
@@ -1 +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;
|
|
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;AAmClB,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,eAAO,MAAM,IAAI,GAAI,UAAU,WAAW,KAAG,eAoJ5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eAqKhD,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 b=require("../jaemin-DL1-g_B5.cjs"),H=t=>new Promise(e=>setTimeout(e,t)),N={stiffness:80,damping:25},B={stiffness:75,damping:25},G=300,M=10,q="horizontal",V="#000000",j=(t={})=>{const{inSpring:e=B,outSpring:o=N,transitionDelay:a=G,blindCount:i=M,direction:s=q,staggerDelay:r=100,blindColor:n=V}=t;let l,p=null;const d=(y,h,c,g=!1)=>{const f=Math.min(.5,r*c/1e3),$=1-f,x=(g?c-1-h:h)/c*f,w=x+$;return y<=x?0:y>=w?1:(y-x)/$},u=(y,h,c="left")=>{window.getComputedStyle(y).position==="static"&&(y.style.position="relative");const f=document.createElement("div");f.className="blind-container",f.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -7,29 +7,29 @@
|
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
z-index: 9999;
|
|
9
9
|
overflow: hidden;
|
|
10
|
-
`;const $=[];for(let
|
|
10
|
+
`;const $=[];for(let m=0;m<i;m++){const x=document.createElement("div");if(s==="horizontal"){const w=100/i,A=`calc(${w}% + 1px)`;x.style.cssText=`
|
|
11
11
|
position: absolute;
|
|
12
|
-
top: ${w*
|
|
12
|
+
top: ${w*m}%;
|
|
13
13
|
left: 0;
|
|
14
14
|
width: 100%;
|
|
15
|
-
height: ${
|
|
16
|
-
background: ${
|
|
17
|
-
transform: scaleX(${
|
|
18
|
-
transform-origin: ${
|
|
15
|
+
height: ${A};
|
|
16
|
+
background: ${n};
|
|
17
|
+
transform: scaleX(${h==="hidden"?0:1});
|
|
18
|
+
transform-origin: ${c} center;
|
|
19
19
|
will-change: transform;
|
|
20
|
-
`}else{const w=100/
|
|
20
|
+
`}else{const w=100/i,A=`calc(${w}% + 1px)`;x.style.cssText=`
|
|
21
21
|
position: absolute;
|
|
22
22
|
top: 0;
|
|
23
|
-
left: ${w*
|
|
24
|
-
width: ${
|
|
23
|
+
left: ${w*m}%;
|
|
24
|
+
width: ${A};
|
|
25
25
|
height: 100%;
|
|
26
|
-
background: ${
|
|
27
|
-
transform: scaleY(${
|
|
28
|
-
transform-origin: ${
|
|
26
|
+
background: ${n};
|
|
27
|
+
transform: scaleY(${h==="hidden"?0:1});
|
|
28
|
+
transform-origin: ${c==="left"?"top":"bottom"} center;
|
|
29
29
|
will-change: transform;
|
|
30
|
-
`}$.push(x),f.appendChild(x)}return
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
35
|
-
)`}function R(t,n){t.style.transform=`translateY(${-n.top}px)`}function S(t,n,l){return t<=n?0:t>=l?1:(t-n)/(l-n)}function v(t,n,l){t.topLeft.style.transform=`translate(${n}px, ${l}px)`,t.topRight.style.transform=`translate(${-n}px, ${l}px)`,t.bottomLeft.style.transform=`translate(${n}px, ${-l}px)`,t.bottomRight.style.transform=`translate(${-n}px, ${-l}px)`}function tt(t="white",n){const o=document.createElement("div");o.style.position="fixed",o.style.pointerEvents="none",o.style.zIndex="9999",o.style.top=`${n.top-2}px`,o.style.left=`${n.left-2}px`,o.style.width="10px",o.style.height="10px";const i=document.createElement("div");i.style.position="absolute",i.style.width="10px",i.style.height="2px",i.style.backgroundColor=t,i.style.top="0",i.style.left="0";const s=document.createElement("div");s.style.position="absolute",s.style.width="2px",s.style.height="10px",s.style.backgroundColor=t,s.style.top="0",s.style.left="0",o.appendChild(i),o.appendChild(s);const e=document.createElement("div");e.style.position="fixed",e.style.pointerEvents="none",e.style.zIndex="9999",e.style.top=`${n.top-2}px`,e.style.left=`${n.left+n.width-10+2}px`,e.style.width="10px",e.style.height="10px";const r=document.createElement("div");r.style.position="absolute",r.style.width="10px",r.style.height="2px",r.style.backgroundColor=t,r.style.top="0",r.style.right="0";const d=document.createElement("div");d.style.position="absolute",d.style.width="2px",d.style.height="10px",d.style.backgroundColor=t,d.style.top="0",d.style.right="0",e.appendChild(r),e.appendChild(d);const c=document.createElement("div");c.style.position="fixed",c.style.pointerEvents="none",c.style.zIndex="9999",c.style.top=`${n.top+n.height-10+2}px`,c.style.left=`${n.left-2}px`,c.style.width="10px",c.style.height="10px";const u=document.createElement("div");u.style.position="absolute",u.style.width="10px",u.style.height="2px",u.style.backgroundColor=t,u.style.bottom="0",u.style.left="0";const p=document.createElement("div");p.style.position="absolute",p.style.width="2px",p.style.height="10px",p.style.backgroundColor=t,p.style.bottom="0",p.style.left="0",c.appendChild(u),c.appendChild(p);const a=document.createElement("div");a.style.position="fixed",a.style.pointerEvents="none",a.style.zIndex="9999",a.style.top=`${n.top+n.height-10+2}px`,a.style.left=`${n.left+n.width-10+2}px`,a.style.width="10px",a.style.height="10px";const g=document.createElement("div");g.style.position="absolute",g.style.width="10px",g.style.height="2px",g.style.backgroundColor=t,g.style.bottom="0",g.style.right="0";const y=document.createElement("div");return y.style.position="absolute",y.style.width="2px",y.style.height="10px",y.style.backgroundColor=t,y.style.bottom="0",y.style.right="0",a.appendChild(g),a.appendChild(y),{topLeft:o,topRight:e,bottomLeft:c,bottomRight:a,*[Symbol.iterator](){yield o,yield e,yield c,yield a}}}const et=t=>{var o;const n=(t==null?void 0:t.spring)??Q,l=(t==null?void 0:t.scale)??.92,h=((o=t==null?void 0:t.border)==null?void 0:o.color)??"white";return{out:async(i,s)=>{const e=T(s),r=P(document.body,s.positionedParent),d=tt(h,{...e,top:r.top});return{spring:n,prepare:()=>{m(i),A(i,e),I(i,e),R(i,e);for(const c of d)s.positionedParent.appendChild(c),c.style.transition="transform 0.1s ease-out"},onEnd:()=>{i.style.clipPath="",i.style.transformOrigin="",setTimeout(()=>{for(const c of d)s.positionedParent.removeChild(c)},1e3)},tick:c=>{const u=1-c;if(u<k){const p=S(u,0,k),a=1-(1-l)*p;i.style.transform=`translateY(${-e.top}px) scale(${a})`;const g=(e.width-e.width*a)/2,y=(e.height-e.height*a)/2;v(d,g,y)}else if(u<E){const p=S(u,k,E),a=-e.top-e.height*p;i.style.transform=`translateY(${a}px) scale(${l})`}else{const p=S(u,E,1),a=l+(1-l)*p;i.style.transform=`translateY(${-e.top-e.height}px) scale(${a})`;const g=(e.width-e.width*a)/2,y=(e.height-e.height*a)/2;v(d,g,y)}}}},in:async(i,s)=>{const e=T(s);return{spring:n,prepare:()=>{A(i,e),I(i,e),i.style.transform=`translateY(${-e.top+e.height}px) scale(${l})`},onEnd:()=>{i.style.clipPath="",i.style.transformOrigin="",i.style.transform=""},tick:r=>{if(r<k)i.style.transform=`translateY(${-e.top+e.height}px) scale(${l})`,i.style.opacity="0";else if(r<E){const d=S(r,k,E),c=-e.top+e.height*(1-d);i.style.transform=`translateY(${c}px) scale(${l})`,i.style.opacity="1"}else{const d=S(r,E,1),c=l+(1-l)*d;i.style.transform=`translateY(${-e.top}px) scale(${c})`,i.style.opacity="1"}}}}}};function nt(t,n){return t.querySelector(`[data-hero-key="${n}"]`)}const it=(t={})=>{var i,s;const n={stiffness:((i=t.spring)==null?void 0:i.stiffness)??300,damping:((s=t.spring)==null?void 0:s.damping)??30},l=t.timeout??300;let h=null,o=null;return{in:async(e,r)=>{const d=e,c=Array.from(d.querySelectorAll("[data-hero-key]"));if(c.length===0)return{spring:n,tick:()=>{}};if(!await new Promise(a=>{h?a(!0):(o=a,setTimeout(()=>{o=null,a(!1)},l))})||!h)return h=null,{spring:n,tick:()=>{}};const p=c.map(a=>{const g=a.getAttribute("data-hero-key");if(!g)return null;const y=nt(h,g);if(!y)return null;const f=a,$=P(h,y),b=P(d,f),x=$.left-b.left-r.scrollOffset.x,w=$.top-b.top-r.scrollOffset.y,L=$.width/b.width,F=$.height/b.height,Y=f.style.transform,_=f.style.position,z=f.style.transformOrigin,O=f.style.zIndex;return{toEl:f,dx:x,dy:w,dw:L,dh:F,originalTransform:Y,originalPosition:_,originalTransformOrigin:z,originalZIndex:O}}).filter(Boolean);return h=null,p.length===0?{spring:n,tick:()=>{}}:{spring:n,prepare:()=>{p.forEach(({toEl:a})=>{a.style.position="relative",a.style.transformOrigin="top left",a.style.zIndex="1000"})},tick:a=>{p.forEach(({toEl:g,dx:y,dy:f,dw:$,dh:b})=>{g.style.transform=`translate(${(1-a)*y}px,${(1-a)*f}px) scale(${a+(1-a)*$}, ${a+(1-a)*b})`})},onEnd:()=>{p.forEach(({toEl:a,originalTransform:g,originalPosition:y,originalTransformOrigin:f,originalZIndex:$})=>{a.style.transform=g,a.style.position=y,a.style.transformOrigin=f,a.style.zIndex=$})}}},out:async e=>({onStart:()=>{h=e,o&&(o(!0),o=null)},prepare:r=>{m(r),r.style.opacity="0"}})}};function st(t){const n=P(document.body,t.positionedParent);return{top:t.scroll.y,left:0,width:n.width,height:window.innerHeight-n.top}}const rt=(t={})=>{var i,s;const n={stiffness:((i=t.spring)==null?void 0:i.stiffness)??50,damping:((s=t.spring)==null?void 0:s.damping)??30},l=t.initialRotation??45,h=t.initialScale??.01,o=t.rotationTriggerPoint??.8;return{out:async(e,r)=>{const d=e.style.opacity;return{spring:{stiffness:80,damping:25},from:1,to:0,prepare:()=>{m(e,r),e.style.opacity="1"},tick:c=>{e.style.opacity=String(c)},onEnd:()=>{e.style.opacity=d}}},in:async(e,r)=>{const d=st(r),c=e.style.transform,u=e.style.transformOrigin,p=e.style.position,a=e.style.zIndex;return{spring:n,from:0,to:1,prepare:()=>{const g=Math.min(d.width,d.height)*.4;e.style.setProperty("--max-border-radius",`${g}px`),e.style.setProperty("--border-radius-scale","1"),e.style.willChange="transform",e.style.backfaceVisibility="hidden";const y=d.left+d.width/2,f=d.top+d.height/2;e.style.transformOrigin=`${y}px ${f}px`,e.style.position="fixed",e.style.top=`${d.top}px`,e.style.left=`${d.left}px`,e.style.width=`${d.width}px`,e.style.height=`${d.height}px`,e.style.zIndex="1000",e.style.overflow="hidden",e.style.transform=`rotate(${l}deg) scale(${h}) translateZ(0)`,e.style.borderRadius="calc(var(--max-border-radius) * var(--border-radius-scale))",e.style.opacity="1"},tick:g=>{let y;if(g<=.05)y=h;else if(g<=o){const x=(g-.05)/(o-.05),w=Math.pow(x,9);y=h+(.8-h)*w}else{const x=(g-o)/(1-o);y=.8+.2*(1-Math.pow(1-x,3))}let f;const $=.7;if(g<=$)f=l;else{const x=(g-$)/(1-$),w=1-Math.pow(1-x,2);f=l*(1-w)}let b;if(g<=$)b=1;else{const x=(g-$)/(1-$);b=1-Math.pow(x,.5)}e.style.transform=`rotate(${f.toFixed(2)}deg) scale(${y.toFixed(4)}) translateZ(0)`,e.style.setProperty("--border-radius-scale",b.toFixed(4))},onEnd:()=>{e.style.willChange="",e.style.backfaceVisibility="",e.style.removeProperty("--max-border-radius"),e.style.removeProperty("--border-radius-scale"),e.style.transform=c,e.style.transformOrigin=u,e.style.position=p,e.style.zIndex=a,e.style.top="",e.style.left="",e.style.width="",e.style.height="",e.style.overflow="",e.style.borderRadius=""}}}}};function ot({detailRect:t,galleryRect:n,pageRect:l,scrollOffset:h},o){const i=n.left-t.left+(n.width-t.width)/2-h.x,s=n.top-t.top+(n.height-t.height)/2-h.y,e=n.width/t.width,r=n.height/t.height,d=Math.max(e,r),c=t.top/l.height*100,u=(l.width-(t.left+t.width))/l.width*100,p=(l.height-(t.top+t.height))/l.height*100,a=t.left/l.width*100;return o.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,g=>{const y=1-g,f=c*y,$=u*y,b=p*y,x=a*y;o.style.clipPath=`inset(${f}% ${$}% ${b}% ${x}%)`,o.style.transform=`translate(${i*y}px, ${s*y}px) scale(${1+(d-1)*y})`}}function lt({galleryRect:t,detailRect:n,scrollOffset:l},h){const o=n.left-t.left+(n.width-t.width)/2+l.x,i=n.top-t.top+(n.height-t.height)/2+l.y,s=n.width/t.width,e=n.height/t.height,r=Math.max(s,e);return d=>{h.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const c=1-d;h.style.transform=`translate(${o*c-l.x}px, ${i*c-l.y}px) scale(${1+(r-1)*c})`,h.style.opacity=`${1-c}`}}function at({galleryRect:t,detailRect:n,scrollOffset:l},h){const o=n.left-t.left+(n.width-t.width)/2-l.x,i=n.top-t.top+(n.height-t.height)/2-l.y,s=n.width/t.width,e=n.height/t.height,r=Math.max(s,e);return d=>{const c=1-d,u=d;h.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,h.style.transform=`translate(${o*c}px, ${i*c}px) scale(${1+(r-1)*c})`,h.style.opacity=`${u}`}}function dt({detailRect:t,galleryRect:n,pageRect:l,scrollOffset:h},o){const i=n.left-t.left+(n.width-t.width)/2+h.x,s=n.top-t.top+(n.height-t.height)/2+h.y,e=n.width/t.width,r=n.height/t.height,d=Math.min(e,r),c=t.top/l.height*100,u=(l.width-(t.left+t.width))/l.width*100,p=(l.height-(t.top+t.height))/l.height*100,a=t.left/l.width*100;return o.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,g=>{const y=1-g,f=c*y,$=u*y,b=p*y,x=a*y;o.style.clipPath=`inset(${f}% ${$}% ${b}% ${x}%)`,o.style.transform=`translate(${i*y-h.x}px, ${s*y-h.y}px) scale(${1+(d-1)*y})`}}function ct(t,n,l){const h=t.querySelector("[data-pinterest-detail-key]"),o=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 i=null,s=null,e=!1;if(!h&&o){s=o;const u=s.getAttribute("data-pinterest-detail-key");if(!u)return null;i=t.querySelector(`[data-pinterest-gallery-key="${u}"]`),i&&(e=!0)}else if(h&&!o){s=h;const u=s.getAttribute("data-pinterest-detail-key");if(!u)return null;i=n.querySelector(`[data-pinterest-gallery-key="${u}"]`),i&&(e=!1)}if(!i||!s)return null;const r=P(e?t:n,i),d=P(e?n:t,s),c=n.getBoundingClientRect();return e?{inAnimation:ot({detailRect:d,galleryRect:r,pageRect:c,scrollOffset:l},n),outAnimation:lt({galleryRect:r,detailRect:d,scrollOffset:l},t)}:{inAnimation:at({galleryRect:r,detailRect:d,scrollOffset:l},n),outAnimation:dt({detailRect:d,galleryRect:r,pageRect:c,scrollOffset:l},t)}}const ht=(t={})=>{var s,e;const n={stiffness:((s=t.spring)==null?void 0:s.stiffness)??50,damping:((e=t.spring)==null?void 0:e.damping)??10},l=t.timeout??300;let h=null,o=null,i=null;return{in:async(r,{scrollOffset:d})=>{const c=r;return!await new Promise(p=>{h?p(!0):(o=p,setTimeout(()=>{o=null,p(!1)},l))})||!h?(h=null,{spring:n,tick:()=>{}}):(i=ct(h,c,d),i?(h=null,{spring:n,tick:p=>{i&&i.inAnimation(p)}}):{spring:n,tick:()=>{}})},out:async r=>({spring:n,onStart:()=>{h=r,o&&(o(!0),o=null)},prepare:d=>{m(d),d.style.zIndex="-1"},tick:d=>{i&&i.outAnimation(d)}})}},C={stiffness:30,damping:7},pt=(t={})=>{var r,d;const n=t.direction??"up",l={stiffness:((r=t.spring)==null?void 0:r.stiffness)??C.stiffness,damping:((d=t.spring)==null?void 0:d.damping)??C.damping},h=n==="up";let o=null,i=null,s=null;const e=()=>{if(o===null||i===null)return null;const c=Math.min(o,i),u=window.innerHeight;return Math.max(c,u)};return{in:c=>(i=c.offsetHeight,o!==null&&(s=e()),{spring:l,tick:u=>{if(s===null&&(s=e(),s===null))return;const p=h?(1-u)*s:(1-u)*-s;c.style.transform=`translateY(${p}px)`}}),out:c=>({spring:l,onStart:()=>{o=c.offsetHeight,i!==null&&(s=e())},tick:u=>{if(s===null&&(s=e(),s===null))return;const p=h?(1-u)*-s:(1-u)*s;c.style.transform=`translateY(${p}px)`},prepare:u=>{m(u),u.style.zIndex=h?"-1":"1"}})}},D={stiffness:30,damping:7},yt=(t={})=>{var o,i;const n=t.direction??"left",l={stiffness:((o=t.spring)==null?void 0:o.stiffness)??D.stiffness,damping:((i=t.spring)==null?void 0:i.damping)??D.damping},h=n==="left";return{in:s=>({spring:l,tick:e=>{const r=h?(1-e)*100:(1-e)*-100;s.style.transform=`translateX(${r}%)`}}),out:(s,e)=>({spring:l,tick:r=>{const d=h?(1-r)*-100:(1-r)*100;s.style.transform=`translateX(${d}%)`},prepare:r=>{m(r,e),r.style.zIndex=h?"-1":"1"}})}};exports.blind=G;exports.drill=q;exports.fade=K;exports.film=et;exports.hero=it;exports.jaemin=rt;exports.pinterest=ht;exports.scroll=pt;exports.slide=yt;
|
|
30
|
+
`}$.push(x),f.appendChild(x)}return y.appendChild(f),{container:f,blinds:$}};return{out:()=>{let y=null;return l=new Promise(h=>{p=h}),{spring:o,prepare:h=>{b.prepareOutgoing(h),h.style.zIndex="1000",y=u(h,"hidden","left")},onStart:()=>{},tick:h=>{if(!y)return;const c=1-h;y.blinds.forEach((g,f)=>{const $=d(c,f,i,!1);s==="horizontal"?g.style.transform=`scaleX(${$})`:g.style.transform=`scaleY(${$})`})},onEnd:()=>{p&&p()}}},in:()=>{let y=null;return{spring:e,prepare:h=>{h.style.position="relative",h.style.zIndex="0",y=u(h,"closed","right")},onStart:()=>{},wait:async()=>{l&&await l,await H(a)},tick:h=>{y&&y.blinds.forEach((c,g)=>{const f=d(h,g,i,!1);s==="horizontal"?c.style.transform=`scaleX(${1-f})`:c.style.transform=`scaleY(${1-f})`})},onEnd:()=>{y&&y.container&&y.container.remove()}}}}},Z=(t={})=>{var i,s;const{opacity:e=!1,direction:o="enter"}=t,a={stiffness:((i=t.spring)==null?void 0:i.stiffness)??150,damping:((s=t.spring)==null?void 0:s.damping)??20};return o==="enter"?{in:r=>({spring:a,tick:n=>{r.style.transform=`translateX(${(1-n)*100}%)`,e&&(r.style.opacity=n.toString())}}),out:(r,n)=>({spring:a,prepare:l=>{b.prepareOutgoing(l,n),l.style.zIndex="-1"},tick:l=>{r.style.transform=`translateX(${-(1-l)*20}%)`,e&&(r.style.opacity=l.toString())}})}:{in:r=>({spring:{stiffness:100,damping:20},tick:n=>{r.style.transform=`translateX(${-(1-n)*20}%)`,e&&(r.style.opacity=n.toString())}}),out:(r,n)=>({spring:{stiffness:100,damping:20},prepare:l=>{b.prepareOutgoing(l,n),l.style.zIndex="100"},tick:l=>{r.style.transform=`translateX(${(1-l)*100}%)`,e&&(r.style.opacity=l.toString())}})}},J=t=>new Promise(e=>setTimeout(e,t)),K={stiffness:400,damping:20},Q={stiffness:40,damping:8},R=100,tt=(t={})=>{const{inSpring:e=Q,outSpring:o=K,transitionDelay:a=R}=t;let i,s=null;return{in:r=>({spring:e,prepare:n=>{n.style.opacity="0"},wait:async()=>{i&&(await i,await J(a))},tick:n=>{r.style.opacity=n.toString()}}),out:(r,n)=>(i=new Promise(l=>{s=l}),{spring:o,tick:l=>{r.style.opacity=l.toString()},prepare:l=>b.prepareOutgoing(l,n),onEnd:()=>{s&&s()}})}},et={stiffness:5,damping:3.5},nt=.8,it="white",E={start:0,end:.45},L={start:.85,end:1},T={start:.2,end:.9},st=t=>{var i;const e=(t==null?void 0:t.spring)??et,o=(t==null?void 0:t.scale)??nt,a=((i=t==null?void 0:t.border)==null?void 0:i.color)??it;return{out:async(s,r)=>{const n=P(r),l=b.getRect(document.body,r.positionedParent),p=lt(a,{...n,top:l.top});let d=1,u=-n.top;return{spring:e,prepare:()=>{b.prepareOutgoing(s),I(s,n),v(s,n),ot(s,n);for(const y of p)r.positionedParent.appendChild(y)},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin="",setTimeout(()=>{for(const y of p)r.positionedParent.removeChild(y)},1e3)},tick:y=>{const h=1-y;if(E.start<=h&&h<=E.end){const f=k(h,E.start,E.end);d=1-(1-o)*f}if(L.start<=h&&h<=L.end){const f=k(h,L.start,L.end);d=o+(1-o)*f}if(T.start<=h&&h<=T.end){const f=k(h,T.start,T.end);u=-n.top-n.height*f}s.style.transform=`translateY(${u}px) scale(${d})`;const c=(n.width-n.width*d)/2,g=(n.height-n.height*d)/2;rt(p,c,g)}}},in:async(s,r)=>{const n=P(r);let l=o,p=-n.top+n.height;return{spring:e,prepare:()=>{I(s,n),v(s,n),s.style.transform=`translateY(${-n.top+n.height}px) scale(${o})`},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin="",s.style.transform=""},tick:d=>{if(E.start<=d&&d<=E.end){const u=k(d,E.start,E.end);l=1-(1-o)*u}if(L.start<=d&&d<=L.end){const u=k(d,L.start,L.end);l=o+(1-o)*u}if(T.start<=d&&d<=T.end){const u=k(d,T.start,T.end);p=-n.top+n.height*(1-u)}s.style.transform=`translateY(${p}px) scale(${l})`}}}}};function rt(t,e,o){const a=e*.7,i=o*.7;t.topLeft.style.transform=`translate(${a}px, ${i}px)`,t.topRight.style.transform=`translate(${-a}px, ${i}px)`,t.bottomLeft.style.transform=`translate(${a}px, ${-i}px)`,t.bottomRight.style.transform=`translate(${-a}px, ${-i}px)`}function lt(t="white",e){const i=document.createElement("div");i.style.position="fixed",i.style.pointerEvents="none",i.style.zIndex="9999",i.style.top=`${e.top-1}px`,i.style.left=`${e.left-1}px`,i.style.width="15px",i.style.height="15px";const s=document.createElement("div");s.style.position="absolute",s.style.width="15px",s.style.height="1px",s.style.backgroundColor=t,s.style.top="0",s.style.left="0";const r=document.createElement("div");r.style.position="absolute",r.style.width="1px",r.style.height="15px",r.style.backgroundColor=t,r.style.top="0",r.style.left="0",i.appendChild(s),i.appendChild(r);const n=document.createElement("div");n.style.position="fixed",n.style.pointerEvents="none",n.style.zIndex="9999",n.style.top=`${e.top-1}px`,n.style.left=`${e.left+e.width-15+1}px`,n.style.width="15px",n.style.height="15px";const l=document.createElement("div");l.style.position="absolute",l.style.width="15px",l.style.height="1px",l.style.backgroundColor=t,l.style.top="0",l.style.right="0";const p=document.createElement("div");p.style.position="absolute",p.style.width="1px",p.style.height="15px",p.style.backgroundColor=t,p.style.top="0",p.style.right="0",n.appendChild(l),n.appendChild(p);const d=document.createElement("div");d.style.position="fixed",d.style.pointerEvents="none",d.style.zIndex="9999",d.style.top=`${e.top+e.height-15+1}px`,d.style.left=`${e.left-1}px`,d.style.width="15px",d.style.height="15px";const u=document.createElement("div");u.style.position="absolute",u.style.width="15px",u.style.height="1px",u.style.backgroundColor=t,u.style.bottom="0",u.style.left="0";const y=document.createElement("div");y.style.position="absolute",y.style.width="1px",y.style.height="15px",y.style.backgroundColor=t,y.style.bottom="0",y.style.left="0",d.appendChild(u),d.appendChild(y);const h=document.createElement("div");h.style.position="fixed",h.style.pointerEvents="none",h.style.zIndex="9999",h.style.top=`${e.top+e.height-15+1}px`,h.style.left=`${e.left+e.width-15+1}px`,h.style.width="15px",h.style.height="15px";const c=document.createElement("div");c.style.position="absolute",c.style.width="15px",c.style.height="1px",c.style.backgroundColor=t,c.style.bottom="0",c.style.right="0";const g=document.createElement("div");return g.style.position="absolute",g.style.width="1px",g.style.height="15px",g.style.backgroundColor=t,g.style.bottom="0",g.style.right="0",h.appendChild(c),h.appendChild(g),{topLeft:i,topRight:n,bottomLeft:d,bottomRight:h,*[Symbol.iterator](){yield i,yield n,yield d,yield h}}}function P(t){const e=b.getRect(document.body,t.positionedParent);return{top:t.scroll.y,left:0,width:e.width,height:window.innerHeight-e.top}}function I(t,e){const o=e.left+e.width/2,a=e.top+e.height/2;t.style.transformOrigin=`${o}px ${a}px`}function v(t,e){t.style.clipPath=`polygon(
|
|
31
|
+
${e.left}px ${e.top}px,
|
|
32
|
+
${e.left+e.width}px ${e.top}px,
|
|
33
|
+
${e.left+e.width}px ${e.top+e.height}px,
|
|
34
|
+
${e.left}px ${e.top+e.height}px
|
|
35
|
+
)`}function ot(t,e){t.style.transform=`translateY(${-e.top}px)`}function k(t,e,o){return t<=e?0:t>=o?1:(t-e)/(o-e)}function at(t,e){return t.querySelector(`[data-hero-key="${e}"]`)}const dt=(t={})=>{var r,n;const e={stiffness:((r=t.spring)==null?void 0:r.stiffness)??300,damping:((n=t.spring)==null?void 0:n.damping)??30},o=t.timeout??300,a=t.maxDistance??700;let i=null,s=null;return{in:async(l,p)=>{const d=l,u=Array.from(d.querySelectorAll("[data-hero-key]"));if(u.length===0)return{spring:e,tick:()=>{}};if(!await new Promise(c=>{i?c(!0):(s=c,setTimeout(()=>{s=null,c(!1)},o))})||!i)return i=null,{spring:e,tick:()=>{}};const h=u.map(c=>{const g=c.getAttribute("data-hero-key");if(!g)return null;const f=at(i,g);if(!f)return null;const $=c,m=b.getRect(i,f),x=b.getRect(d,$),w=m.left-x.left-p.scrollOffset.x,A=m.top-x.top-p.scrollOffset.y,_=m.width/x.width,F=m.height/x.height,X=$.style.transform,U=$.style.position,W=$.style.transformOrigin,z=$.style.zIndex;return{toEl:$,dx:w,dy:A,dw:_,dh:F,originalTransform:X,originalPosition:U,originalTransformOrigin:W,originalZIndex:z}}).filter(c=>c!==null&&Math.abs(c.dy)<=a);return i=null,h.length===0?{spring:e,tick:()=>{}}:{spring:e,prepare:()=>{h.forEach(({toEl:c})=>{c.style.position="relative",c.style.transformOrigin="top left",c.style.zIndex="1000"})},tick:c=>{h.forEach(({toEl:g,dx:f,dy:$,dw:m,dh:x})=>{g.style.transform=`translate(${(1-c)*f}px,${(1-c)*$}px) scale(${c+(1-c)*m}, ${c+(1-c)*x})`})},onEnd:()=>{h.forEach(({toEl:c,originalTransform:g,originalPosition:f,originalTransformOrigin:$,originalZIndex:m})=>{c.style.transform=g,c.style.position=f,c.style.transformOrigin=$,c.style.zIndex=m})}}},out:async l=>({onStart:()=>{i=l,s&&(s(!0),s=null)},prepare:p=>{b.prepareOutgoing(p),p.style.opacity="0"}})}};function ct({detailRect:t,galleryRect:e,pageRect:o,scrollOffset:a},i){const s=e.left-t.left+(e.width-t.width)/2-a.x,r=e.top-t.top+(e.height-t.height)/2-a.y,n=e.width/t.width,l=e.height/t.height,p=Math.max(n,l),d=t.top/o.height*100,u=(o.width-(t.left+t.width))/o.width*100,y=(o.height-(t.top+t.height))/o.height*100,h=t.left/o.width*100;return i.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,c=>{const g=1-c,f=d*g,$=u*g,m=y*g,x=h*g;i.style.clipPath=`inset(${f}% ${$}% ${m}% ${x}%)`,i.style.transform=`translate(${s*g}px, ${r*g}px) scale(${1+(p-1)*g})`}}function pt({galleryRect:t,detailRect:e,scrollOffset:o},a){const i=e.left-t.left+(e.width-t.width)/2+o.x,s=e.top-t.top+(e.height-t.height)/2+o.y,r=e.width/t.width,n=e.height/t.height,l=Math.max(r,n);return p=>{a.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const d=1-p;a.style.transform=`translate(${i*d-o.x}px, ${s*d-o.y}px) scale(${1+(l-1)*d})`,a.style.opacity=`${1-d}`}}function ht({galleryRect:t,detailRect:e,scrollOffset:o},a){const i=e.left-t.left+(e.width-t.width)/2-o.x,s=e.top-t.top+(e.height-t.height)/2-o.y,r=e.width/t.width,n=e.height/t.height,l=Math.max(r,n);return p=>{const d=1-p,u=p;a.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,a.style.transform=`translate(${i*d}px, ${s*d}px) scale(${1+(l-1)*d})`,a.style.opacity=`${u}`}}function yt({detailRect:t,galleryRect:e,pageRect:o,scrollOffset:a},i){const s=e.left-t.left+(e.width-t.width)/2+a.x,r=e.top-t.top+(e.height-t.height)/2+a.y,n=e.width/t.width,l=e.height/t.height,p=Math.min(n,l),d=t.top/o.height*100,u=(o.width-(t.left+t.width))/o.width*100,y=(o.height-(t.top+t.height))/o.height*100,h=t.left/o.width*100;return i.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,c=>{const g=1-c,f=d*g,$=u*g,m=y*g,x=h*g;i.style.clipPath=`inset(${f}% ${$}% ${m}% ${x}%)`,i.style.transform=`translate(${s*g-a.x}px, ${r*g-a.y}px) scale(${1+(p-1)*g})`}}function ut(t,e,o){const a=t.querySelector("[data-pinterest-detail-key]"),i=e.querySelector("[data-pinterest-detail-key]");if(t.querySelectorAll("[data-pinterest-detail-key]").length>1||e.querySelectorAll("[data-pinterest-detail-key]").length>1)return null;let s=null,r=null,n=!1;if(!a&&i){r=i;const u=r.getAttribute("data-pinterest-detail-key");if(!u)return null;s=t.querySelector(`[data-pinterest-gallery-key="${u}"]`),s&&(n=!0)}else if(a&&!i){r=a;const u=r.getAttribute("data-pinterest-detail-key");if(!u)return null;s=e.querySelector(`[data-pinterest-gallery-key="${u}"]`),s&&(n=!1)}if(!s||!r)return null;const l=b.getRect(n?t:e,s),p=b.getRect(n?e:t,r),d=e.getBoundingClientRect();return n?{inAnimation:ct({detailRect:p,galleryRect:l,pageRect:d,scrollOffset:o},e),outAnimation:pt({galleryRect:l,detailRect:p,scrollOffset:o},t)}:{inAnimation:ht({galleryRect:l,detailRect:p,scrollOffset:o},e),outAnimation:yt({detailRect:p,galleryRect:l,pageRect:d,scrollOffset:o},t)}}const gt=(t={})=>{var r,n;const e={stiffness:((r=t.spring)==null?void 0:r.stiffness)??50,damping:((n=t.spring)==null?void 0:n.damping)??10},o=t.timeout??300;let a=null,i=null,s=null;return{in:async(l,{scrollOffset:p})=>{const d=l;return!await new Promise(y=>{a?y(!0):(i=y,setTimeout(()=>{i=null,y(!1)},o))})||!a?(a=null,{spring:e,tick:()=>{}}):(s=ut(a,d,p),s?(a=null,{spring:e,tick:y=>{s&&s.inAnimation(y)}}):{spring:e,tick:()=>{}})},out:async l=>({spring:e,onStart:()=>{a=l,i&&(i(!0),i=null)},prepare:p=>{b.prepareOutgoing(p),p.style.zIndex="-1"},tick:p=>{s&&s.outAnimation(p)}})}},D={stiffness:30,damping:7},ft=(t={})=>{var l,p;const e=t.direction??"up",o={stiffness:((l=t.spring)==null?void 0:l.stiffness)??D.stiffness,damping:((p=t.spring)==null?void 0:p.damping)??D.damping},a=e==="up";let i=null,s=null,r=null;const n=()=>{if(i===null||s===null)return null;const d=Math.min(i,s),u=window.innerHeight;return Math.max(d,u)};return{in:d=>(s=d.offsetHeight,i!==null&&(r=n()),{spring:o,tick:u=>{if(r===null&&(r=n(),r===null))return;const y=a?(1-u)*r:(1-u)*-r;d.style.transform=`translateY(${y}px)`}}),out:d=>({spring:o,onStart:()=>{i=d.offsetHeight,s!==null&&(r=n())},tick:u=>{if(r===null&&(r=n(),r===null))return;const y=a?(1-u)*-r:(1-u)*r;d.style.transform=`translateY(${y}px)`},prepare:u=>{b.prepareOutgoing(u),u.style.zIndex=a?"-1":"1"}})}},O={stiffness:30,damping:7},$t=(t={})=>{var i,s;const e=t.direction??"left",o={stiffness:((i=t.spring)==null?void 0:i.stiffness)??O.stiffness,damping:((s=t.spring)==null?void 0:s.damping)??O.damping},a=e==="left";return{in:r=>({spring:o,tick:n=>{const l=a?(1-n)*100:(1-n)*-100;r.style.transform=`translateX(${l}%)`}}),out:(r,n)=>({spring:o,tick:l=>{const p=a?(1-l)*-100:(1-l)*100;r.style.transform=`translateX(${p}%)`},prepare:l=>{b.prepareOutgoing(l,n),l.style.zIndex=a?"-1":"1"}})}},Y={stiffness:300,damping:30},S=20,C=800,xt=()=>{let t,e=null;return{in:o=>({spring:Y,prepare:a=>{a.style.transform=`perspective(${C}px) rotateY(${S}deg) translateX(-100%)`},wait:async()=>{t&&await t},tick:a=>{const i=(1-a)*S,s=-(1-a)*100;o.style.transform=`perspective(${C}px) rotateY(${i}deg) translateX(${s}%)`},onEnd:()=>{o.style.transform=""}}),out:(o,a)=>(t=new Promise(i=>{e=i}),{spring:Y,prepare:i=>{b.prepareOutgoing(i,a)},tick:i=>{const s=1-i,r=s*S,n=s*100;o.style.transform=`perspective(${C}px) rotateY(${-r}deg) translateX(${n}%)`},onEnd:()=>{e&&e(),o.style.transform=""}})}};exports.jaemin=b.jaemin;exports.blind=j;exports.drill=Z;exports.fade=tt;exports.film=st;exports.hero=dt;exports.pinterest=gt;exports.scroll=ft;exports.slide=$t;exports.strip=xt;
|
|
@@ -3,8 +3,9 @@ export * from './drill';
|
|
|
3
3
|
export * from './fade';
|
|
4
4
|
export * from './film';
|
|
5
5
|
export * from './hero';
|
|
6
|
-
export
|
|
6
|
+
export { jaemin } from './jaemin';
|
|
7
7
|
export * from './pinterest';
|
|
8
8
|
export * from './scroll';
|
|
9
9
|
export * from './slide';
|
|
10
|
+
export * from './strip';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|