@ssgoi/core 2.0.0 → 2.1.2
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/create-transition-callback.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +284 -238
- package/dist/transition-strategy.d.ts.map +1 -1
- package/dist/transition.d.ts +51 -11
- package/dist/transition.d.ts.map +1 -1
- package/dist/transitions/blur.d.ts +3 -0
- package/dist/transitions/blur.d.ts.map +1 -1
- package/dist/transitions/bounce.d.ts +3 -0
- package/dist/transitions/bounce.d.ts.map +1 -1
- package/dist/transitions/fade.d.ts +3 -0
- package/dist/transitions/fade.d.ts.map +1 -1
- package/dist/transitions/fly.d.ts +3 -0
- package/dist/transitions/fly.d.ts.map +1 -1
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +121 -105
- package/dist/transitions/none.d.ts +3 -0
- package/dist/transitions/none.d.ts.map +1 -1
- package/dist/transitions/rotate.d.ts +3 -0
- package/dist/transitions/rotate.d.ts.map +1 -1
- package/dist/transitions/scale.d.ts +3 -0
- package/dist/transitions/scale.d.ts.map +1 -1
- package/dist/transitions/slide.d.ts +3 -0
- package/dist/transitions/slide.d.ts.map +1 -1
- package/dist/types.d.ts +11 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils-8Eptbv7c.cjs +2 -0
- package/dist/utils-DTRMUQW4.js +31 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/view-transitions/drill.d.ts +9 -0
- package/dist/view-transitions/drill.d.ts.map +1 -0
- package/dist/view-transitions/fade.d.ts +3 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +1 -1
- 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 +234 -169
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils-BSgyev81.cjs +0 -1
- package/dist/utils-DR41YsAh.js +0 -16
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TransitionKey } from '../types';
|
|
1
2
|
interface SlideOptions {
|
|
2
3
|
direction?: 'left' | 'right' | 'up' | 'down';
|
|
3
4
|
distance?: number | string;
|
|
@@ -8,8 +9,10 @@ interface SlideOptions {
|
|
|
8
9
|
stiffness?: number;
|
|
9
10
|
damping?: number;
|
|
10
11
|
};
|
|
12
|
+
key?: TransitionKey;
|
|
11
13
|
}
|
|
12
14
|
export declare const slide: (options?: SlideOptions) => {
|
|
15
|
+
key?: TransitionKey | undefined;
|
|
13
16
|
in: (element: HTMLElement) => {
|
|
14
17
|
spring: {
|
|
15
18
|
stiffness?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/slide.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/slide.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB,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,KAAK,GAAI,UAAS,YAAiB;;kBAoD9B,WAAW;;wBA1Db,MAAM;sBACR,MAAM;;yBA2DG,MAAM;;mBAOV,WAAW;;wBAnEd,MAAM;sBACR,MAAM;;yBAoEG,MAAM;;CAS5B,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type TransitionConfig<TAnimationValue = number> = {
|
|
|
9
9
|
to?: TAnimationValue;
|
|
10
10
|
tick?: (progress: TAnimationValue) => void;
|
|
11
11
|
prepare?: (element: HTMLElement) => void;
|
|
12
|
+
wait?: () => Promise<void>;
|
|
12
13
|
onStart?: () => void;
|
|
13
14
|
onEnd?: () => void;
|
|
14
15
|
};
|
|
@@ -16,6 +17,11 @@ export type GetTransitionConfig<TContext = undefined, TAnimationValue = number>
|
|
|
16
17
|
export type Transition<TContext = undefined, TAnimationValue = number> = {
|
|
17
18
|
in?: GetTransitionConfig<TContext, TAnimationValue>;
|
|
18
19
|
out?: GetTransitionConfig<TContext, TAnimationValue>;
|
|
20
|
+
key?: TransitionKey;
|
|
21
|
+
};
|
|
22
|
+
export type TransitionOptions<TContext = undefined, TAnimationValue = number> = Transition<TContext, TAnimationValue> & {
|
|
23
|
+
key?: TransitionKey;
|
|
24
|
+
ref?: object;
|
|
19
25
|
};
|
|
20
26
|
export type TransitionCallback = (element: HTMLElement | null) => void | (() => void);
|
|
21
27
|
export type SggoiTransitionContext = {
|
|
@@ -26,13 +32,17 @@ export type SggoiTransitionContext = {
|
|
|
26
32
|
};
|
|
27
33
|
export type SggoiTransition = Transition<SggoiTransitionContext>;
|
|
28
34
|
export type SsgoiConfig = {
|
|
29
|
-
transitions
|
|
35
|
+
transitions?: {
|
|
30
36
|
from: string;
|
|
31
37
|
to: string;
|
|
32
38
|
transition: SggoiTransition;
|
|
33
39
|
symmetric?: boolean;
|
|
34
40
|
}[];
|
|
35
41
|
defaultTransition?: SggoiTransition;
|
|
42
|
+
middleware?: (from: string, to: string) => {
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
};
|
|
36
46
|
};
|
|
37
47
|
export type SsgoiContext = (path: string) => Transition & {
|
|
38
48
|
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,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IAG3C,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAGzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAGrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,
|
|
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,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IAG3C,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAGzC,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAG3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAGrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAC7B,QAAQ,GAAG,SAAS,EACpB,eAAe,GAAG,MAAM,IACtB,QAAQ,SAAS,SAAS,GAC1B,CACE,IAAI,EAAE,WAAW,KAEf,gBAAgB,CAAC,eAAe,CAAC,GACjC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GAC9C,CACE,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,QAAQ,KAEf,gBAAgB,CAAC,eAAe,CAAC,GACjC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;AAEnD,MAAM,MAAM,UAAU,CAAC,QAAQ,GAAG,SAAS,EAAE,eAAe,GAAG,MAAM,IAAI;IACvE,EAAE,CAAC,EAAE,mBAAmB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACpD,GAAG,CAAC,EAAE,mBAAmB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACrD,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,GAAG,SAAS,EAAE,eAAe,GAAG,MAAM,IAAI,UAAU,CAAC,QAAQ,EAAE,eAAe,CAAC,GAAG;IACtH,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,WAAW,GAAG,IAAI,KACxB,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxC,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,2 @@
|
|
|
1
|
+
"use strict";const c=e=>{e.style.position="absolute",e.style.width="100%",e.style.top="0",e.style.left="0"},u=e=>{let t=e.parentElement;for(;t&&t!==document.body;){const n=window.getComputedStyle(t),l=n.overflow+n.overflowY+n.overflowX;if(l.includes("auto")||l.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement};const p=e=>{if(!e)return null;const t=e.split(`
|
|
2
|
+
`).map(n=>n.trim());for(let n=3;n<Math.min(t.length,6);n++){const l=t[n],o=l==null?void 0:l.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!o)continue;const r=o[1]??"",i=o[2]??"0",s=o[3]??"0";return{file:r.split(/[\\/]/).pop()||r,line:i,column:s}}return null},a=e=>new Promise(t=>setTimeout(t,e));exports.getScrollingElement=u;exports.parseCallerLocation=p;exports.prepareOutgoing=c;exports.sleep=a;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const u = (e) => {
|
|
2
|
+
e.style.position = "absolute", e.style.width = "100%", e.style.top = "0", e.style.left = "0";
|
|
3
|
+
}, a = (e) => {
|
|
4
|
+
let t = e.parentElement;
|
|
5
|
+
for (; t && t !== document.body; ) {
|
|
6
|
+
const n = window.getComputedStyle(t), o = n.overflow + n.overflowY + n.overflowX;
|
|
7
|
+
if (o.includes("auto") || o.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
|
|
8
|
+
return t;
|
|
9
|
+
t = t.parentElement;
|
|
10
|
+
}
|
|
11
|
+
return document.documentElement;
|
|
12
|
+
};
|
|
13
|
+
const p = (e) => {
|
|
14
|
+
if (!e) return null;
|
|
15
|
+
const t = e.split(`
|
|
16
|
+
`).map((n) => n.trim());
|
|
17
|
+
for (let n = 3; n < Math.min(t.length, 6); n++) {
|
|
18
|
+
const o = t[n], l = o == null ? void 0 : o.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
|
|
19
|
+
if (!l)
|
|
20
|
+
continue;
|
|
21
|
+
const s = l[1] ?? "", r = l[2] ?? "0", i = l[3] ?? "0";
|
|
22
|
+
return { file: s.split(/[\\/]/).pop() || s, line: r, column: i };
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}, m = (e) => new Promise((t) => setTimeout(t, e));
|
|
26
|
+
export {
|
|
27
|
+
u as a,
|
|
28
|
+
a as g,
|
|
29
|
+
p,
|
|
30
|
+
m as s
|
|
31
|
+
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -8,4 +8,15 @@ export declare const prepareOutgoing: (element: HTMLElement) => void;
|
|
|
8
8
|
* Returns the first scrollable parent element or document.documentElement
|
|
9
9
|
*/
|
|
10
10
|
export declare const getScrollingElement: (element: HTMLElement) => HTMLElement;
|
|
11
|
+
export declare const parseCallerLocation: (stack?: string) => {
|
|
12
|
+
file: string;
|
|
13
|
+
line: string;
|
|
14
|
+
column: string;
|
|
15
|
+
} | null;
|
|
16
|
+
/**
|
|
17
|
+
* Delays execution for a specified amount of milliseconds
|
|
18
|
+
* @param ms - Milliseconds to wait
|
|
19
|
+
* @returns Promise that resolves after the specified delay
|
|
20
|
+
*/
|
|
21
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
11
22
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,IAKtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,IAKtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,WAyB1D,CAAC;AAIF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IA2BrG,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAE9C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SpringConfig, SggoiTransition } from '../types';
|
|
2
|
+
interface DrillOptions {
|
|
3
|
+
opacity?: boolean;
|
|
4
|
+
direction?: "enter" | "exit";
|
|
5
|
+
spring?: Partial<SpringConfig>;
|
|
6
|
+
}
|
|
7
|
+
export declare const drill: (options?: DrillOptions) => SggoiTransition;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=drill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drill.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/drill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,GAAI,UAAS,YAAiB,KAAG,eAsElD,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SpringConfig, SggoiTransition } from '../types';
|
|
2
2
|
interface FadeOptions {
|
|
3
|
-
|
|
3
|
+
inSpring?: SpringConfig;
|
|
4
|
+
outSpring?: SpringConfig;
|
|
5
|
+
transitionDelay?: number;
|
|
4
6
|
}
|
|
5
7
|
export declare const fade: (options?: FadeOptions) => SggoiTransition;
|
|
6
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO9D,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eAmDhD,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;AAG9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAkBD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,
|
|
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;AAG9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAkBD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eAgKhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../utils-8Eptbv7c.cjs"),q=(t={})=>{var a,l;const{opacity:n=!1,direction:s="enter"}=t,e={stiffness:((a=t.spring)==null?void 0:a.stiffness)??150,damping:((l=t.spring)==null?void 0:l.damping)??20};return s==="enter"?{in:r=>({spring:e,tick:i=>{r.style.transform=`translateX(${(1-i)*100}%)`,n&&(r.style.opacity=i.toString())}}),out:r=>({spring:e,prepare:i=>{x.prepareOutgoing(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=>{x.prepareOutgoing(i),i.style.zIndex="100"},tick:i=>{r.style.transform=`translateX(${(1-i)*100}%)`,n&&(r.style.opacity=i.toString())}})}},L={stiffness:400,damping:20},Y={stiffness:40,damping:8},F=100,M=(t={})=>{const{inSpring:n=Y,outSpring:s=L,transitionDelay:e=F}=t;let a,l=null;return{in:r=>({spring:n,prepare:i=>{i.style.opacity="0"},wait:async()=>{a&&(await a,await x.sleep(e))},tick:i=>{r.style.opacity=i.toString()}}),out:r=>(a=new Promise(i=>{l=i}),{spring:s,tick:i=>{r.style.opacity=i.toString()},prepare:x.prepareOutgoing,onEnd:()=>{l&&l()}})}};function X(t,n){return t.querySelector(`[data-hero-key="${n}"]`)}function S(t,n){const s=t.getBoundingClientRect(),e=n.getBoundingClientRect();return new DOMRect(e.left-s.left,e.top-s.top,e.width,e.height)}const z=(t={})=>{var l,r;const n={stiffness:((l=t.spring)==null?void 0:l.stiffness)??300,damping:((r=t.spring)==null?void 0:r.damping)??30},s=t.timeout??300;let e=null,a=null;return{in:async(i,o)=>{const u=i,p=Array.from(u.querySelectorAll("[data-hero-key]"));if(p.length===0)return{spring:n,tick:()=>{}};if(!await new Promise(h=>{e?h(!0):(a=h,setTimeout(()=>{a=null,h(!1)},s))})||!e)return e=null,{spring:n,tick:()=>{}};const g=p.map(h=>{const $=h.getAttribute("data-hero-key");if(!$)return null;const c=X(e,$);if(!c)return null;const y=h,f=S(e,c),w=S(u,y),k=f.left-w.left-o.scrollOffset.x,T=f.top-w.top-o.scrollOffset.y,m=f.width/w.width,O=f.height/w.height,D=y.style.transform,E=y.style.position,B=y.style.transformOrigin,P=y.style.zIndex;return{toEl:y,dx:k,dy:T,dw:m,dh:O,originalTransform:D,originalPosition:E,originalTransformOrigin:B,originalZIndex:P}}).filter(Boolean);return e=null,g.length===0?{spring:n,tick:()=>{}}:{spring:n,prepare:()=>{g.forEach(({toEl:h})=>{h.style.position="relative",h.style.transformOrigin="top left",h.style.zIndex="1000"})},tick:h=>{g.forEach(({toEl:$,dx:c,dy:y,dw:f,dh:w})=>{$.style.transform=`translate(${(1-h)*c}px,${(1-h)*y}px) scale(${h+(1-h)*f}, ${h+(1-h)*w})`})},onEnd:()=>{g.forEach(({toEl:h,originalTransform:$,originalPosition:c,originalTransformOrigin:y,originalZIndex:f})=>{h.style.transform=$,h.style.position=c,h.style.transformOrigin=y,h.style.zIndex=f})}}},out:async i=>({onStart:()=>{e=i,a&&(a(!0),a=null)},prepare:o=>{x.prepareOutgoing(o),o.style.opacity="0"}})}};function A(t,n){const s=t.getBoundingClientRect(),e=n.getBoundingClientRect();return new DOMRect(e.left-s.left,e.top-s.top,e.width,e.height)}function C({detailRect:t,galleryRect:n,pageRect:s,scrollOffset:e},a){const l=n.left-t.left+(n.width-t.width)/2-e.x,r=n.top-t.top+(n.height-t.height)/2-e.y,i=n.width/t.width,o=n.height/t.height,u=Math.max(i,o),p=t.top/s.height*100,d=(s.width-(t.left+t.width))/s.width*100,g=(s.height-(t.top+t.height))/s.height*100,h=t.left/s.width*100;return a.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,$=>{const c=1-$,y=p*c,f=d*c,w=g*c,k=h*c;a.style.clipPath=`inset(${y}% ${f}% ${w}% ${k}%)`,a.style.transform=`translate(${l*c}px, ${r*c}px) scale(${1+(u-1)*c})`}}function _({galleryRect:t,detailRect:n,scrollOffset:s},e){const a=n.left-t.left+(n.width-t.width)/2+s.x,l=n.top-t.top+(n.height-t.height)/2+s.y,r=n.width/t.width,i=n.height/t.height,o=Math.max(r,i);return u=>{e.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const p=1-u;e.style.transform=`translate(${a*p-s.x}px, ${l*p-s.y}px) scale(${1+(o-1)*p})`,e.style.opacity=`${1-p}`}}function U({galleryRect:t,detailRect:n,scrollOffset:s},e){const a=n.left-t.left+(n.width-t.width)/2-s.x,l=n.top-t.top+(n.height-t.height)/2-s.y,r=n.width/t.width,i=n.height/t.height,o=Math.max(r,i);return u=>{const p=1-u,d=u;e.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,e.style.transform=`translate(${a*p}px, ${l*p}px) scale(${1+(o-1)*p})`,e.style.opacity=`${d}`}}function b({detailRect:t,galleryRect:n,pageRect:s,scrollOffset:e},a){const l=n.left-t.left+(n.width-t.width)/2+e.x,r=n.top-t.top+(n.height-t.height)/2+e.y,i=n.width/t.width,o=n.height/t.height,u=Math.min(i,o),p=t.top/s.height*100,d=(s.width-(t.left+t.width))/s.width*100,g=(s.height-(t.top+t.height))/s.height*100,h=t.left/s.width*100;return a.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,$=>{const c=1-$,y=p*c,f=d*c,w=g*c,k=h*c;a.style.clipPath=`inset(${y}% ${f}% ${w}% ${k}%)`,a.style.transform=`translate(${l*c-e.x}px, ${r*c-e.y}px) scale(${1+(u-1)*c})`}}function G(t,n,s){const e=t.querySelector("[data-pinterest-detail-key]"),a=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 l=null,r=null,i=!1;if(!e&&a){r=a;const d=r.getAttribute("data-pinterest-detail-key");if(!d)return null;l=t.querySelector(`[data-pinterest-gallery-key="${d}"]`),l&&(i=!0)}else if(e&&!a){r=e;const d=r.getAttribute("data-pinterest-detail-key");if(!d)return null;l=n.querySelector(`[data-pinterest-gallery-key="${d}"]`),l&&(i=!1)}if(!l||!r)return null;const o=A(i?t:n,l),u=A(i?n:t,r),p=n.getBoundingClientRect();return i?{inAnimation:C({detailRect:u,galleryRect:o,pageRect:p,scrollOffset:s},n),outAnimation:_({galleryRect:o,detailRect:u,scrollOffset:s},t)}:{inAnimation:U({galleryRect:o,detailRect:u,scrollOffset:s},n),outAnimation:b({detailRect:u,galleryRect:o,pageRect:p,scrollOffset:s},t)}}const v=(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},s=t.timeout??300;let e=null,a=null,l=null;return{in:async(o,{scrollOffset:u})=>{const p=o;return!await new Promise(g=>{e?g(!0):(a=g,setTimeout(()=>{a=null,g(!1)},s))})||!e?(e=null,{spring:n,tick:()=>{}}):(l=G(e,p,u),l?(e=null,{spring:n,tick:g=>{l&&l.inAnimation(g)}}):{spring:n,tick:()=>{}})},out:async o=>({spring:n,onStart:()=>{e=o,a&&(a(!0),a=null)},prepare:u=>{x.prepareOutgoing(u),u.style.zIndex="-1"},tick:u=>{l&&l.outAnimation(u)}})}},I={stiffness:30,damping:7},j=(t={})=>{var a,l;const n=t.direction??"up",s={stiffness:((a=t.spring)==null?void 0:a.stiffness)??I.stiffness,damping:((l=t.spring)==null?void 0:l.damping)??I.damping},e=n==="up";return{in:r=>({spring:s,tick:i=>{const o=e?(1-i)*100:(1-i)*-100;r.style.transform=`translateY(${o}vh)`}}),out:r=>({spring:s,tick:i=>{const o=e?(1-i)*-100:(1-i)*100;r.style.transform=`translateY(${o}vh)`},prepare:i=>{x.prepareOutgoing(i),i.style.zIndex=e?"-1":"1"}})}};exports.drill=q;exports.fade=M;exports.hero=z;exports.pinterest=v;exports.scroll=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|