@ssgoi/core 2.5.0 → 2.5.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/animate.d.ts +35 -0
- package/dist/animate.d.ts.map +1 -0
- package/dist/animation-scheduler.d.ts +47 -0
- package/dist/animation-scheduler.d.ts.map +1 -0
- package/dist/animator.d.ts +3 -8
- package/dist/animator.d.ts.map +1 -1
- package/dist/create-transition-callback.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +776 -321
- package/dist/test-utils.d.ts +46 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/ticker.d.ts +37 -0
- package/dist/ticker.d.ts.map +1 -0
- package/dist/transition-strategy.d.ts +2 -3
- package/dist/transition-strategy.d.ts.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.ts +158 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -1
- package/dist/view-transitions/blind.d.ts.map +1 -1
- package/dist/view-transitions/curtain-reveal.d.ts +19 -0
- package/dist/view-transitions/curtain-reveal.d.ts.map +1 -0
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +13 -13
- 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 +516 -405
- package/package.json +8 -6
- package/dist/view-transitions/hero-rotate.d.ts +0 -28
- package/dist/view-transitions/hero-rotate.d.ts.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SpringConfig, SpringItem } from './types';
|
|
2
|
+
import { Animator } from './animator';
|
|
3
|
+
/**
|
|
4
|
+
* Mock timer utilities for testing animations
|
|
5
|
+
*/
|
|
6
|
+
export declare const mockTimers: {
|
|
7
|
+
setup: () => void;
|
|
8
|
+
cleanup: () => void;
|
|
9
|
+
advance: (ms: number) => void;
|
|
10
|
+
runAll: () => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Create a mock spring item for testing
|
|
14
|
+
*/
|
|
15
|
+
export declare function createMockSpringItem(overrides?: Partial<SpringItem>): SpringItem;
|
|
16
|
+
/**
|
|
17
|
+
* Create a mock spring config
|
|
18
|
+
*/
|
|
19
|
+
export declare function createMockSpringConfig(overrides?: Partial<SpringConfig>): SpringConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Wait for all animators to complete
|
|
22
|
+
* Uses real timers and RAF polling
|
|
23
|
+
*/
|
|
24
|
+
export declare function waitForAnimation(timeout?: number): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Spy on console methods
|
|
27
|
+
*/
|
|
28
|
+
export declare const consoleSpy: {
|
|
29
|
+
warn: () => import('vitest').MockInstance<{
|
|
30
|
+
(...data: any[]): void;
|
|
31
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
32
|
+
}>;
|
|
33
|
+
error: () => import('vitest').MockInstance<{
|
|
34
|
+
(...data: any[]): void;
|
|
35
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
36
|
+
}>;
|
|
37
|
+
log: () => import('vitest').MockInstance<{
|
|
38
|
+
(...data: any[]): void;
|
|
39
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Mock Animator for testing without real animation
|
|
44
|
+
*/
|
|
45
|
+
export declare function createMockAnimator(): Animator;
|
|
46
|
+
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../src/lib/test-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,UAAU;;;kBAQP,MAAM;;CAMrB,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,OAAO,CAAC,UAAU,CAAM,GAClC,UAAU,CAWZ;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GACpC,YAAY,CAMd;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAcpE;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAItB,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,IAaF,QAAQ,CACvC"}
|
package/dist/ticker.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ticker - Singleton requestAnimationFrame manager
|
|
3
|
+
* Prevents multiple RAF calls by batching all animation updates into a single loop
|
|
4
|
+
* Inspired by GSAP's ticker with mobile optimizations
|
|
5
|
+
*/
|
|
6
|
+
type TickerCallback = (deltaTime: number, elapsed: number) => void;
|
|
7
|
+
declare class Ticker {
|
|
8
|
+
private listeners;
|
|
9
|
+
private rafId;
|
|
10
|
+
private isRunning;
|
|
11
|
+
private startTime;
|
|
12
|
+
private lastUpdate;
|
|
13
|
+
private elapsed;
|
|
14
|
+
private lagThreshold;
|
|
15
|
+
private adjustedLag;
|
|
16
|
+
private gap;
|
|
17
|
+
private nextTime;
|
|
18
|
+
private tick;
|
|
19
|
+
subscribe(callback: TickerCallback): () => void;
|
|
20
|
+
unsubscribe(callback: TickerCallback): void;
|
|
21
|
+
/**
|
|
22
|
+
* Configure lag smoothing behavior
|
|
23
|
+
* @param threshold - Time threshold to detect lag (default: 500ms)
|
|
24
|
+
* @param adjustedLag - Max time jump when lag detected (default: 33ms)
|
|
25
|
+
*/
|
|
26
|
+
lagSmoothing(threshold: number, adjustedLag: number): void;
|
|
27
|
+
/**
|
|
28
|
+
* Set maximum FPS
|
|
29
|
+
* @param fps - Target FPS (default: 240)
|
|
30
|
+
*/
|
|
31
|
+
fps(fps: number): void;
|
|
32
|
+
getListenerCount(): number;
|
|
33
|
+
getElapsed(): number;
|
|
34
|
+
}
|
|
35
|
+
export declare const ticker: Ticker;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=ticker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticker.d.ts","sourceRoot":"","sources":["../src/lib/ticker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAEnE,cAAM,MAAM;IACV,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,SAAS,CAAS;IAG1B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,OAAO,CAAK;IAGpB,OAAO,CAAC,YAAY,CAAO;IAC3B,OAAO,CAAC,WAAW,CAAM;IAGzB,OAAO,CAAC,GAAG,CAAc;IACzB,OAAO,CAAC,QAAQ,CAAY;IAE5B,OAAO,CAAC,IAAI,CAmCV;IAEF,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI;IAe/C,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAW3C;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAK1D;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKtB,gBAAgB,IAAI,MAAM;IAI1B,UAAU,IAAI,MAAM;CAGrB;AAGD,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { TransitionConfig } from './types';
|
|
2
|
-
import { Animator } from './animator';
|
|
1
|
+
import { TransitionConfig, AnimationController } from './types';
|
|
3
2
|
export declare const TRANSITION_STRATEGY: unique symbol;
|
|
4
3
|
export interface StrategyContext<TAnimationValue = number> {
|
|
5
4
|
currentAnimation: {
|
|
6
|
-
|
|
5
|
+
controller: AnimationController<TAnimationValue>;
|
|
7
6
|
direction: "in" | "out";
|
|
8
7
|
} | null;
|
|
9
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../src/lib/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../src/lib/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,mBAAmB,eAAoC,CAAC;AAErE,MAAM,WAAW,eAAe,CAAC,eAAe,GAAG,MAAM;IAGvD,gBAAgB,EAAE;QAChB,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;QACjD,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;KACzB,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,cAAc,CAAC,eAAe,GAAG,MAAM;IACtD,MAAM,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC3C,KAAK,EAAE;QACL,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5E,CAAC;IACF,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB,CAAC,eAAe,GAAG,MAAM;IACzD,EAAE,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;IAChD,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,kBAAkB,CAAC,eAAe,GAAG,MAAM;IAC1D,KAAK,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,CAiMpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,eAAe,GAAG,MAAM,OACrB,kBAAkB,CAAC,eAAe,CAoGtC,CAAC"}
|
package/dist/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(i){return"tick"in i&&!("springs"in i)}function r(i){return"springs"in i}exports.isMultiSpring=r;exports.isSingleSpring=n;
|
package/dist/types.d.ts
CHANGED
|
@@ -3,16 +3,101 @@ export type SpringConfig = {
|
|
|
3
3
|
stiffness?: number;
|
|
4
4
|
damping?: number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Schedule strategy for multi-spring animations
|
|
8
|
+
* - overlap: All springs start immediately (parallel execution)
|
|
9
|
+
* - wait: Each spring waits for previous to complete (sequential)
|
|
10
|
+
* - chain: Springs start with offset delays
|
|
11
|
+
*/
|
|
12
|
+
export type ScheduleType = "overlap" | "wait" | "chain";
|
|
13
|
+
/**
|
|
14
|
+
* Base configuration shared by both single and multi-spring transitions
|
|
15
|
+
*/
|
|
16
|
+
export type BaseTransitionConfig = {
|
|
17
|
+
prepare?: (element: HTMLElement) => void;
|
|
18
|
+
wait?: () => Promise<void>;
|
|
19
|
+
onStart?: () => void;
|
|
20
|
+
onEnd?: () => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Single spring configuration (existing - backward compatible)
|
|
24
|
+
* Used for simple transitions with a single animation value
|
|
25
|
+
*/
|
|
26
|
+
export type SingleSpringConfig<TAnimationValue = number> = BaseTransitionConfig & {
|
|
7
27
|
spring?: SpringConfig;
|
|
8
28
|
from?: TAnimationValue;
|
|
9
29
|
to?: TAnimationValue;
|
|
10
30
|
tick?: (progress: TAnimationValue) => void;
|
|
11
|
-
|
|
12
|
-
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Individual spring item in a multi-spring animation
|
|
34
|
+
*/
|
|
35
|
+
export type SpringItem<TAnimationValue = number> = {
|
|
36
|
+
from?: TAnimationValue;
|
|
37
|
+
to?: TAnimationValue;
|
|
38
|
+
spring?: SpringConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Frame callback - called on each animation frame with progress value
|
|
41
|
+
*
|
|
42
|
+
* **Performance Warning:** Use WRITE-ONLY operations for best performance.
|
|
43
|
+
* Avoid reading layout properties inside tick to prevent layout thrashing.
|
|
44
|
+
*
|
|
45
|
+
* Layout-triggering properties (causes forced synchronous layout):
|
|
46
|
+
* - element.offsetWidth, offsetHeight, offsetTop, offsetLeft
|
|
47
|
+
* - element.clientWidth, clientHeight
|
|
48
|
+
* - element.getBoundingClientRect()
|
|
49
|
+
* - element.scrollWidth, scrollHeight, scrollTop, scrollLeft
|
|
50
|
+
* - window.getComputedStyle(element)
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // ❌ Bad: Layout read in tick (causes thrashing)
|
|
54
|
+
* tick: (progress) => {
|
|
55
|
+
* const height = element.offsetHeight // READ - forces layout!
|
|
56
|
+
* element.style.height = height * progress
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // ✅ Good: Read in prepare, write in tick
|
|
61
|
+
* prepare: (element) => {
|
|
62
|
+
* const height = element.offsetHeight // READ once before animation
|
|
63
|
+
* element.dataset.height = height.toString()
|
|
64
|
+
* },
|
|
65
|
+
* tick: (progress) => {
|
|
66
|
+
* const height = parseFloat(element.dataset.height)
|
|
67
|
+
* element.style.height = height * progress // WRITE only
|
|
68
|
+
* }
|
|
69
|
+
*/
|
|
70
|
+
tick: (progress: TAnimationValue) => void;
|
|
13
71
|
onStart?: () => void;
|
|
14
|
-
|
|
72
|
+
onComplete?: () => void;
|
|
73
|
+
/**
|
|
74
|
+
* Delay offset in milliseconds before this spring starts
|
|
75
|
+
* Only applies to 'chain' schedule mode
|
|
76
|
+
*/
|
|
77
|
+
offset?: number;
|
|
15
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Multi-spring configuration (new feature)
|
|
81
|
+
* Used for complex transitions with multiple coordinated animations
|
|
82
|
+
*/
|
|
83
|
+
export type MultiSpringConfig<TAnimationValue = number> = BaseTransitionConfig & {
|
|
84
|
+
springs: SpringItem<TAnimationValue>[];
|
|
85
|
+
schedule?: ScheduleType;
|
|
86
|
+
onProgress?: (completed: number, total: number) => void;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Transition configuration - supports both single and multi-spring animations
|
|
90
|
+
* Uses Union Type for type safety and backward compatibility
|
|
91
|
+
*/
|
|
92
|
+
export type TransitionConfig<TAnimationValue = number> = SingleSpringConfig<TAnimationValue> | MultiSpringConfig<TAnimationValue>;
|
|
93
|
+
/**
|
|
94
|
+
* Type guard to check if config is single spring
|
|
95
|
+
*/
|
|
96
|
+
export declare function isSingleSpring<T>(config: TransitionConfig<T>): config is SingleSpringConfig<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Type guard to check if config is multi-spring
|
|
99
|
+
*/
|
|
100
|
+
export declare function isMultiSpring<T>(config: TransitionConfig<T>): config is MultiSpringConfig<T>;
|
|
16
101
|
export type GetTransitionConfig<TContext = undefined, TAnimationValue = number> = TContext extends undefined ? (node: HTMLElement) => TransitionConfig<TAnimationValue> | Promise<TransitionConfig<TAnimationValue>> : (node: HTMLElement, context: TContext) => TransitionConfig<TAnimationValue> | Promise<TransitionConfig<TAnimationValue>>;
|
|
17
102
|
export type Transition<TContext = undefined, TAnimationValue = number> = {
|
|
18
103
|
in?: GetTransitionConfig<TContext, TAnimationValue>;
|
|
@@ -84,4 +169,73 @@ export type SsgoiConfig = {
|
|
|
84
169
|
export type SsgoiContext = (path: string) => Transition & {
|
|
85
170
|
key: TransitionKey;
|
|
86
171
|
};
|
|
172
|
+
/**
|
|
173
|
+
* Normalized schedule entry for internal processing (discriminated union)
|
|
174
|
+
* Used by AnimationScheduler to unify different schedule strategies
|
|
175
|
+
* @internal
|
|
176
|
+
*/
|
|
177
|
+
export type NormalizedScheduleEntry = OffsetScheduleEntry | WaitScheduleEntry;
|
|
178
|
+
/**
|
|
179
|
+
* Offset-based schedule entry (overlap/chain modes)
|
|
180
|
+
* - delay=0: immediate start (overlap)
|
|
181
|
+
* - delay>0: delayed start with fixed timing (chain)
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
export type OffsetScheduleEntry = {
|
|
185
|
+
type: "offset";
|
|
186
|
+
id: string;
|
|
187
|
+
delay: number;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Wait-based schedule entry (wait mode)
|
|
191
|
+
* Dynamic dependency - starts after previous spring completes
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
export type WaitScheduleEntry = {
|
|
195
|
+
type: "wait";
|
|
196
|
+
id: string;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Animation state (discriminated union)
|
|
200
|
+
* Different return types for single vs multi-spring animations
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
203
|
+
export type AnimationState<T = number> = SingleAnimationState<T> | MultiAnimationState;
|
|
204
|
+
/**
|
|
205
|
+
* Single spring animation state
|
|
206
|
+
* Supports both number and object animations
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
export type SingleAnimationState<T = number> = {
|
|
210
|
+
type: "single";
|
|
211
|
+
position: T;
|
|
212
|
+
velocity: T extends number ? number : Record<string, number>;
|
|
213
|
+
from: T;
|
|
214
|
+
to: T;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Multi-spring animation state
|
|
218
|
+
* Always uses number for progress tracking
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
export type MultiAnimationState = {
|
|
222
|
+
type: "multi";
|
|
223
|
+
completed: number;
|
|
224
|
+
total: number;
|
|
225
|
+
direction: "forward" | "backward";
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Common interface for animation controllers
|
|
229
|
+
* Implemented by both Animator (single spring) and AnimationScheduler (multi-spring)
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
export interface AnimationController<T = number> {
|
|
233
|
+
forward(): void;
|
|
234
|
+
backward(): void;
|
|
235
|
+
stop(): void;
|
|
236
|
+
reverse(options?: {
|
|
237
|
+
offsetMode?: "immediate" | "mirror" | "reverse";
|
|
238
|
+
}): void;
|
|
239
|
+
getCurrentState(): AnimationState<T>;
|
|
240
|
+
}
|
|
87
241
|
//# sourceMappingURL=types.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AA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;IAChB,QAAQ,IAAI,IAAI,CAAC;IACjB,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7E,eAAe,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;CACtC"}
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blind.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/blind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"blind.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/blind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAEhB,MAAM,UAAU,CAAC;AAWlB,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,KAAK,GAAI,UAAS,YAAiB,KAAG,eA8LlD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SggoiTransition, SpringConfig } from '../types';
|
|
2
|
+
type CurtainShape = "circle" | "square" | "triangle";
|
|
3
|
+
interface CurtainRevealOptions {
|
|
4
|
+
/** Background style.
|
|
5
|
+
*
|
|
6
|
+
* Supports both:
|
|
7
|
+
* - Solid colors (e.g., `"#000000"`, `"rgb(255, 0, 0)"`)
|
|
8
|
+
* - CSS gradients (e.g., `"linear-gradient(to right, #000, #fff)"`)
|
|
9
|
+
*/
|
|
10
|
+
background?: string;
|
|
11
|
+
texts?: string[];
|
|
12
|
+
shape?: CurtainShape;
|
|
13
|
+
inSpring?: SpringConfig;
|
|
14
|
+
outSpring?: SpringConfig;
|
|
15
|
+
textStyle?: Partial<CSSStyleDeclaration>;
|
|
16
|
+
}
|
|
17
|
+
export declare const curtainReveal: (options?: CurtainRevealOptions) => SggoiTransition;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=curtain-reveal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curtain-reveal.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/curtain-reveal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAiD9D,KAAK,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAErD,UAAU,oBAAoB;IAC5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAmBD,eAAO,MAAM,aAAa,GACxB,UAAS,oBAAyB,KACjC,eA0HF,CAAC"}
|
|
@@ -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;AAQ9D,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,
|
|
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;AAQ9D,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,eAuDhD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../jaemin-DL1-g_B5.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../jaemin-DL1-g_B5.cjs"),B=t=>new Promise(e=>setTimeout(e,t)),M={stiffness:80,damping:25},G={stiffness:75,damping:25},V=300,j=10,q="horizontal",K="#000000",Z=(t={})=>{const{inSpring:e=G,outSpring:r=M,transitionDelay:c=V,blindCount:s=j,direction:o=q,staggerDelay:l=100,blindColor:n=K}=t;let i,d=null;const a=(p,g,y="left")=>{window.getComputedStyle(p).position==="static"&&(p.style.position="relative");const h=document.createElement("div");h.className="blind-container",h.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
|
|
10
|
+
`;const f=[];for(let $=0;$<s;$++){const m=document.createElement("div");if(o==="horizontal"){const x=100/s,T=`calc(${x}% + 1px)`;m.style.cssText=`
|
|
11
11
|
position: absolute;
|
|
12
|
-
top: ${
|
|
12
|
+
top: ${x*$}%;
|
|
13
13
|
left: 0;
|
|
14
14
|
width: 100%;
|
|
15
|
-
height: ${
|
|
15
|
+
height: ${T};
|
|
16
16
|
background: ${n};
|
|
17
|
-
transform: scaleX(${
|
|
18
|
-
transform-origin: ${
|
|
17
|
+
transform: scaleX(${g==="hidden"?0:1});
|
|
18
|
+
transform-origin: ${y} center;
|
|
19
19
|
will-change: transform;
|
|
20
|
-
`}else{const
|
|
20
|
+
`}else{const x=100/s,T=`calc(${x}% + 1px)`;m.style.cssText=`
|
|
21
21
|
position: absolute;
|
|
22
22
|
top: 0;
|
|
23
|
-
left: ${
|
|
24
|
-
width: ${
|
|
23
|
+
left: ${x*$}%;
|
|
24
|
+
width: ${T};
|
|
25
25
|
height: 100%;
|
|
26
26
|
background: ${n};
|
|
27
|
-
transform: scaleY(${
|
|
28
|
-
transform-origin: ${
|
|
27
|
+
transform: scaleY(${g==="hidden"?0:1});
|
|
28
|
+
transform-origin: ${y==="left"?"top":"bottom"} center;
|
|
29
29
|
will-change: transform;
|
|
30
|
-
`}
|
|
30
|
+
`}f.push(m),h.appendChild(m)}return p.appendChild(h),{container:h,blinds:f}};return{out:()=>{let p=null;return i=new Promise(y=>{d=y}),{springs:Array.from({length:s},(y,u)=>({from:0,to:1,spring:r,offset:u*l,tick:h=>{if(!p)return;const f=p.blinds[u];f&&(o==="horizontal"?f.style.transform=`scaleX(${h})`:f.style.transform=`scaleY(${h})`)}})),schedule:"chain",prepare:y=>{b.prepareOutgoing(y),y.style.zIndex="1000",p=a(y,"hidden","left")},onStart:()=>{},onEnd:()=>{d&&d()}}},in:()=>{let p=null;return{springs:Array.from({length:s},(y,u)=>({from:1,to:0,spring:e,offset:u*l,tick:h=>{if(!p)return;const f=p.blinds[u];f&&(o==="horizontal"?f.style.transform=`scaleX(${h})`:f.style.transform=`scaleY(${h})`)}})),schedule:"chain",prepare:y=>{y.style.position="relative",y.style.zIndex="0",p=a(y,"closed","right")},onStart:()=>{},wait:async()=>{i&&await i,await B(c)},onEnd:()=>{p&&p.container&&p.container.remove()}}}}},J=(t={})=>{var s,o;const{opacity:e=!1,direction:r="enter"}=t,c={stiffness:((s=t.spring)==null?void 0:s.stiffness)??150,damping:((o=t.spring)==null?void 0:o.damping)??20};return r==="enter"?{in:l=>({spring:c,tick:n=>{l.style.transform=`translateX(${(1-n)*100}%)`,e&&(l.style.opacity=n.toString())}}),out:(l,n)=>({spring:c,prepare:i=>{b.prepareOutgoing(i,n),i.style.zIndex="-1"},tick:i=>{l.style.transform=`translateX(${-(1-i)*20}%)`,e&&(l.style.opacity=i.toString())}})}:{in:l=>({spring:{stiffness:100,damping:20},tick:n=>{l.style.transform=`translateX(${-(1-n)*20}%)`,e&&(l.style.opacity=n.toString())}}),out:(l,n)=>({spring:{stiffness:100,damping:20},prepare:i=>{b.prepareOutgoing(i,n),i.style.zIndex="100"},tick:i=>{l.style.transform=`translateX(${(1-i)*100}%)`,e&&(l.style.opacity=i.toString())}})}},Q=t=>new Promise(e=>setTimeout(e,t)),R={stiffness:7,damping:4},tt={stiffness:8,damping:4},et=0,nt=(t={})=>{const{inSpring:e=tt,outSpring:r=R,transitionDelay:c=et}=t;let s,o=null;return{in:l=>({spring:e,prepare:n=>{n.style.opacity="0",n.style.willChange="opacity"},wait:async()=>{s&&(await s,await Q(c))},tick:n=>{l.style.opacity=n.toString()}}),out:(l,n)=>(s=new Promise(i=>{o=i}),{spring:r,tick:i=>{l.style.opacity=i.toString()},prepare:i=>{b.prepareOutgoing(i,n),i.style.willChange="opacity"},onEnd:()=>{o&&o()}})}},it={stiffness:5,damping:3.5},st=.8,rt="white",w={start:0,end:.45},E={start:.85,end:1},L={start:.2,end:.9},ot=t=>{var s;const e=(t==null?void 0:t.spring)??it,r=(t==null?void 0:t.scale)??st,c=((s=t==null?void 0:t.border)==null?void 0:s.color)??rt;return{out:async(o,l)=>{const n=P(l),i=b.getRect(document.body,l.positionedParent),d=at(c,{...n,top:i.top});let a=1,p=-n.top;return{spring:e,prepare:()=>{b.prepareOutgoing(o),k(o,n),I(o,n),dt(o,n);for(const g of d)l.positionedParent.appendChild(g)},onEnd:()=>{o.style.clipPath="",o.style.transformOrigin="",setTimeout(()=>{for(const g of d)l.positionedParent.removeChild(g)},1e3)},tick:g=>{const y=1-g;if(w.start<=y&&y<=w.end){const f=A(y,w.start,w.end);a=1-(1-r)*f}if(E.start<=y&&y<=E.end){const f=A(y,E.start,E.end);a=r+(1-r)*f}if(L.start<=y&&y<=L.end){const f=A(y,L.start,L.end);p=-n.top-n.height*f}o.style.transform=`translateY(${p}px) scale(${a})`;const u=(n.width-n.width*a)/2,h=(n.height-n.height*a)/2;lt(d,u,h)}}},in:async(o,l)=>{const n=P(l);let i=r,d=-n.top+n.height;return{spring:e,prepare:()=>{k(o,n),I(o,n),o.style.transform=`translateY(${-n.top+n.height}px) scale(${r})`},onEnd:()=>{o.style.clipPath="",o.style.transformOrigin="",o.style.transform=""},tick:a=>{if(w.start<=a&&a<=w.end){const p=A(a,w.start,w.end);i=1-(1-r)*p}if(E.start<=a&&a<=E.end){const p=A(a,E.start,E.end);i=r+(1-r)*p}if(L.start<=a&&a<=L.end){const p=A(a,L.start,L.end);d=-n.top+n.height*(1-p)}o.style.transform=`translateY(${d}px) scale(${i})`}}}}};function lt(t,e,r){const c=e*.7,s=r*.7;t.topLeft.style.transform=`translate(${c}px, ${s}px)`,t.topRight.style.transform=`translate(${-c}px, ${s}px)`,t.bottomLeft.style.transform=`translate(${c}px, ${-s}px)`,t.bottomRight.style.transform=`translate(${-c}px, ${-s}px)`}function at(t="white",e){const s=document.createElement("div");s.style.position="fixed",s.style.pointerEvents="none",s.style.zIndex="9999",s.style.top=`${e.top-1}px`,s.style.left=`${e.left-1}px`,s.style.width="15px",s.style.height="15px";const o=document.createElement("div");o.style.position="absolute",o.style.width="15px",o.style.height="1px",o.style.backgroundColor=t,o.style.top="0",o.style.left="0";const l=document.createElement("div");l.style.position="absolute",l.style.width="1px",l.style.height="15px",l.style.backgroundColor=t,l.style.top="0",l.style.left="0",s.appendChild(o),s.appendChild(l);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 i=document.createElement("div");i.style.position="absolute",i.style.width="15px",i.style.height="1px",i.style.backgroundColor=t,i.style.top="0",i.style.right="0";const d=document.createElement("div");d.style.position="absolute",d.style.width="1px",d.style.height="15px",d.style.backgroundColor=t,d.style.top="0",d.style.right="0",n.appendChild(i),n.appendChild(d);const a=document.createElement("div");a.style.position="fixed",a.style.pointerEvents="none",a.style.zIndex="9999",a.style.top=`${e.top+e.height-15+1}px`,a.style.left=`${e.left-1}px`,a.style.width="15px",a.style.height="15px";const p=document.createElement("div");p.style.position="absolute",p.style.width="15px",p.style.height="1px",p.style.backgroundColor=t,p.style.bottom="0",p.style.left="0";const g=document.createElement("div");g.style.position="absolute",g.style.width="1px",g.style.height="15px",g.style.backgroundColor=t,g.style.bottom="0",g.style.left="0",a.appendChild(p),a.appendChild(g);const y=document.createElement("div");y.style.position="fixed",y.style.pointerEvents="none",y.style.zIndex="9999",y.style.top=`${e.top+e.height-15+1}px`,y.style.left=`${e.left+e.width-15+1}px`,y.style.width="15px",y.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.right="0";const h=document.createElement("div");return h.style.position="absolute",h.style.width="1px",h.style.height="15px",h.style.backgroundColor=t,h.style.bottom="0",h.style.right="0",y.appendChild(u),y.appendChild(h),{topLeft:s,topRight:n,bottomLeft:a,bottomRight:y,*[Symbol.iterator](){yield s,yield n,yield a,yield y}}}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 k(t,e){const r=e.left+e.width/2,c=e.top+e.height/2;t.style.transformOrigin=`${r}px ${c}px`}function I(t,e){t.style.clipPath=`polygon(
|
|
31
31
|
${e.left}px ${e.top}px,
|
|
32
32
|
${e.left+e.width}px ${e.top}px,
|
|
33
33
|
${e.left+e.width}px ${e.top+e.height}px,
|
|
34
34
|
${e.left}px ${e.top+e.height}px
|
|
35
|
-
)`}function
|
|
35
|
+
)`}function dt(t,e){t.style.transform=`translateY(${-e.top}px)`}function A(t,e,r){return t<=e?0:t>=r?1:(t-e)/(r-e)}function ct(t,e){return t.querySelector(`[data-hero-key="${e}"]`)}const pt=(t={})=>{var l,n;const e={stiffness:((l=t.spring)==null?void 0:l.stiffness)??300,damping:((n=t.spring)==null?void 0:n.damping)??30},r=t.timeout??300,c=t.maxDistance??700;let s=null,o=null;return{in:async(i,d)=>{const a=i,p=Array.from(a.querySelectorAll("[data-hero-key]"));if(p.length===0)return{spring:e,tick:()=>{}};if(!await new Promise(u=>{s?u(!0):(o=u,setTimeout(()=>{o=null,u(!1)},r))})||!s)return s=null,{spring:e,tick:()=>{}};const y=p.map(u=>{const h=u.getAttribute("data-hero-key");if(!h)return null;const f=ct(s,h);if(!f)return null;const $=u,m=b.getRect(s,f),x=b.getRect(a,$),T=m.left-x.left-d.scrollOffset.x,Y=m.top-x.top-d.scrollOffset.y,U=m.width/x.width,W=m.height/x.height,X=$.style.transform,N=$.style.position,z=$.style.transformOrigin,H=$.style.zIndex;return{toEl:$,dx:T,dy:Y,dw:U,dh:W,originalTransform:X,originalPosition:N,originalTransformOrigin:z,originalZIndex:H}}).filter(u=>u!==null&&Math.abs(u.dy)<=c);return s=null,y.length===0?{spring:e,tick:()=>{}}:{spring:e,prepare:()=>{y.forEach(({toEl:u})=>{u.style.position="relative",u.style.transformOrigin="top left",u.style.zIndex="1000"})},tick:u=>{y.forEach(({toEl:h,dx:f,dy:$,dw:m,dh:x})=>{h.style.transform=`translate(${(1-u)*f}px,${(1-u)*$}px) scale(${u+(1-u)*m}, ${u+(1-u)*x})`})},onEnd:()=>{y.forEach(({toEl:u,originalTransform:h,originalPosition:f,originalTransformOrigin:$,originalZIndex:m})=>{u.style.transform=h,u.style.position=f,u.style.transformOrigin=$,u.style.zIndex=m})}}},out:async i=>({onStart:()=>{s=i,o&&(o(!0),o=null)},prepare:d=>{b.prepareOutgoing(d),d.style.opacity="0"}})}};function ht({detailRect:t,galleryRect:e,pageRect:r,scrollOffset:c},s){const o=e.left-t.left+(e.width-t.width)/2-c.x,l=e.top-t.top+(e.height-t.height)/2-c.y,n=e.width/t.width,i=e.height/t.height,d=Math.max(n,i),a=t.top/r.height*100,p=(r.width-(t.left+t.width))/r.width*100,g=(r.height-(t.top+t.height))/r.height*100,y=t.left/r.width*100;return s.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,u=>{const h=1-u,f=a*h,$=p*h,m=g*h,x=y*h;s.style.clipPath=`inset(${f}% ${$}% ${m}% ${x}%)`,s.style.transform=`translate(${o*h}px, ${l*h}px) scale(${1+(d-1)*h})`}}function yt({galleryRect:t,detailRect:e,scrollOffset:r},c){const s=e.left-t.left+(e.width-t.width)/2+r.x,o=e.top-t.top+(e.height-t.height)/2+r.y,l=e.width/t.width,n=e.height/t.height,i=Math.max(l,n);return d=>{c.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const a=1-d;c.style.transform=`translate(${s*a-r.x}px, ${o*a-r.y}px) scale(${1+(i-1)*a})`,c.style.opacity=`${1-a}`}}function ut({galleryRect:t,detailRect:e,scrollOffset:r},c){const s=e.left-t.left+(e.width-t.width)/2-r.x,o=e.top-t.top+(e.height-t.height)/2-r.y,l=e.width/t.width,n=e.height/t.height,i=Math.max(l,n);return d=>{const a=1-d,p=d;c.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,c.style.transform=`translate(${s*a}px, ${o*a}px) scale(${1+(i-1)*a})`,c.style.opacity=`${p}`}}function gt({detailRect:t,galleryRect:e,pageRect:r,scrollOffset:c},s){const o=e.left-t.left+(e.width-t.width)/2+c.x,l=e.top-t.top+(e.height-t.height)/2+c.y,n=e.width/t.width,i=e.height/t.height,d=Math.min(n,i),a=t.top/r.height*100,p=(r.width-(t.left+t.width))/r.width*100,g=(r.height-(t.top+t.height))/r.height*100,y=t.left/r.width*100;return s.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,u=>{const h=1-u,f=a*h,$=p*h,m=g*h,x=y*h;s.style.clipPath=`inset(${f}% ${$}% ${m}% ${x}%)`,s.style.transform=`translate(${o*h-c.x}px, ${l*h-c.y}px) scale(${1+(d-1)*h})`}}function ft(t,e,r){const c=t.querySelector("[data-pinterest-detail-key]"),s=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 o=null,l=null,n=!1;if(!c&&s){l=s;const p=l.getAttribute("data-pinterest-detail-key");if(!p)return null;o=t.querySelector(`[data-pinterest-gallery-key="${p}"]`),o&&(n=!0)}else if(c&&!s){l=c;const p=l.getAttribute("data-pinterest-detail-key");if(!p)return null;o=e.querySelector(`[data-pinterest-gallery-key="${p}"]`),o&&(n=!1)}if(!o||!l)return null;const i=b.getRect(n?t:e,o),d=b.getRect(n?e:t,l),a=e.getBoundingClientRect();return n?{inAnimation:ht({detailRect:d,galleryRect:i,pageRect:a,scrollOffset:r},e),outAnimation:yt({galleryRect:i,detailRect:d,scrollOffset:r},t)}:{inAnimation:ut({galleryRect:i,detailRect:d,scrollOffset:r},e),outAnimation:gt({detailRect:d,galleryRect:i,pageRect:a,scrollOffset:r},t)}}const $t=(t={})=>{var l,n;const e={stiffness:((l=t.spring)==null?void 0:l.stiffness)??30,damping:((n=t.spring)==null?void 0:n.damping)??10},r=t.timeout??300;let c=null,s=null,o=null;return{in:async(i,{scrollOffset:d})=>{const a=i;return!await new Promise(g=>{c?g(!0):(s=g,setTimeout(()=>{s=null,g(!1)},r))})||!c?(c=null,{spring:e,tick:()=>{}}):(o=ft(c,a,d),o?(c=null,{spring:e,tick:g=>{o&&o.inAnimation(g)}}):{spring:e,tick:()=>{}})},out:async i=>({spring:e,onStart:()=>{c=i,s&&(s(!0),s=null)},prepare:d=>{b.prepareOutgoing(d),d.style.zIndex="-1"},tick:d=>{o&&o.outAnimation(d)}})}},O={stiffness:5,damping:4},mt=(t={})=>{var i,d;const e=t.direction??"up",r={stiffness:((i=t.spring)==null?void 0:i.stiffness)??O.stiffness,damping:((d=t.spring)==null?void 0:d.damping)??O.damping},c=e==="up";let s=null,o=null,l=null;const n=()=>{if(s===null||o===null)return null;const a=Math.min(s,o),p=window.innerHeight;return Math.max(a,p)};return{in:a=>(o=a.offsetHeight,s!==null&&(l=n()),{spring:r,tick:p=>{if(l===null&&(l=n(),l===null))return;const g=c?(1-p)*l:(1-p)*-l;a.style.transform=`translateY(${g}px)`}}),out:a=>({spring:r,onStart:()=>{s=a.offsetHeight,o!==null&&(l=n())},tick:p=>{if(l===null&&(l=n(),l===null))return;const g=c?(1-p)*-l:(1-p)*l;a.style.transform=`translateY(${g}px)`},prepare:p=>{b.prepareOutgoing(p),p.style.zIndex=c?"-1":"1"}})}},D={stiffness:15,damping:7},xt=(t={})=>{var s,o;const e=t.direction??"left",r={stiffness:((s=t.spring)==null?void 0:s.stiffness)??D.stiffness,damping:((o=t.spring)==null?void 0:o.damping)??D.damping},c=e==="left";return{in:l=>({spring:r,tick:n=>{const i=c?(1-n)*100:(1-n)*-100;l.style.transform=`translateX(${i}%)`}}),out:(l,n)=>({spring:r,tick:i=>{const d=c?(1-i)*-100:(1-i)*100;l.style.transform=`translateX(${d}%)`},prepare:i=>{b.prepareOutgoing(i,n),i.style.zIndex=c?"-1":"1"}})}},v={stiffness:17,damping:6},_=20,C=800,bt=()=>{let t,e=null;return{in:r=>({spring:v,prepare:c=>{c.style.transform=`perspective(${C}px) rotateY(${_}deg) translateX(-100%)`},wait:async()=>{t&&await t},tick:c=>{const s=(1-c)*_,o=-(1-c)*100;r.style.transform=`perspective(${C}px) rotateY(${s}deg) translateX(${o}%)`},onEnd:()=>{r.style.transform=""}}),out:(r,c)=>(t=new Promise(s=>{e=s}),{spring:v,prepare:s=>{b.prepareOutgoing(s,c)},tick:s=>{const o=1-s,l=o*_,n=o*100;r.style.transform=`perspective(${C}px) rotateY(${-l}deg) translateX(${n}%)`},onEnd:()=>{e&&e(),r.style.transform=""}})}},wt={stiffness:1,damping:1},Et={stiffness:20,damping:25},Lt="#000000",At="circle",F="CURTAIN_REVEAL_OVERLAY_ID",Tt={position:"fixed",inset:"0",width:"100vw",height:"100%",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},St={position:"relative",display:"inline-block",height:"5.5rem",overflow:"hidden"},_t={display:"flex",height:"100%",willChange:"transform",transition:"transform 0.3s ease"},Ct={display:"inline-flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap",fontSize:"5.5rem",fontWeight:"900",letterSpacing:"0.02em",color:"#FFFFFF"},Pt=.4,S=.5,kt=.2;function It(t,e){switch(t){case"circle":return`circle(${e*100}% at 50% 50%)`;case"square":return`inset(${(1-e)*50}% round ${10*e}%)`;case"triangle":{const r=e*100;return`polygon(50% ${50-r}%, ${50-r}% ${50+r}%, ${50+r}% ${50+r}%)`}}}const Ot=t=>t.reduce((e,r)=>e+r,0),Dt=(t={})=>{const{background:e=Lt,texts:r=[],shape:c=At,inSpring:s=Et,outSpring:o=wt,textStyle:l={}}=t;return{out:(n,i)=>{const d=n.style.opacity;return{spring:o,from:1,to:0,prepare:a=>{b.prepareOutgoing(a,i),a.style.opacity="1"},tick:a=>{const p=Math.max(0,a-Pt);n.style.opacity=String(p)},onEnd:()=>{n.style.opacity=d}}},in:n=>{let i=null,d=null,a=null;const p=document.body.style.overflow,g=document.getElementById(F);let y=[];const u=()=>{i=document.createElement("div"),i.id=F,Object.assign(i.style,Tt,{background:e}),document.body.appendChild(i),d=document.createElement("div"),Object.assign(d.style,St),i.appendChild(d),a=document.createElement("div"),Object.assign(a.style,_t),d.appendChild(a),r.forEach(h=>{const f=document.createElement("div");f.textContent=h,Object.assign(f.style,Ct,l),a.appendChild(f)}),y=Array.from(a.children).map(h=>h.getBoundingClientRect().width)};return{spring:s,from:0,to:1,prepare:()=>{document.body.style.overflow="hidden",n.style.opacity="1",g==null||g.remove(),u(),i&&d&&(i.style.clipPath="none",d.style.transform="scale(1)")},tick:h=>{if(!(!i||!d||!a)){if(h<=S&&r.length>0){const f=h/S,$=Math.min(Math.floor(f*r.length),r.length-1),m=y[$]??0,x=Ot(y.slice(0,$));d.style.width=`${m}px`,a.style.transform=`translateX(-${x}px)`}if(h>S){const $=1-Math.max(0,Math.min(1,(h-S)/kt));i.style.clipPath=It(c,$),d.style.transform=`scale(${$})`}}},onEnd:()=>{i==null||i.remove(),i=d=a=null,document.body.style.overflow=p}}}}};exports.jaemin=b.jaemin;exports.blind=Z;exports.curtainReveal=Dt;exports.drill=J;exports.fade=nt;exports.film=ot;exports.hero=pt;exports.pinterest=$t;exports.scroll=mt;exports.slide=xt;exports.strip=bt;
|
|
@@ -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,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
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;AACxB,cAAc,kBAAkB,CAAC"}
|