@ssgoi/core
Version:
Core animation engine for SSGOI - Native app-like page transitions with spring physics
46 lines • 1.81 kB
TypeScript
import { SsgoiConfig, SsgoiContext } from '../types';
/**
* SSGOI Transition Context Operation Principles
*
* Page transition scenario: /home → /about
*
* 1. OUT animation starts (when /home page disappears)
* - getTransition('unique-id', 'out', '/home') is called
* - Stores { from: '/home' } in pendingTransitions
* - Creates Promise and stores outResolve (not resolved yet)
* - Calls checkAndResolve → waits because 'to' is missing
*
* 2. IN animation starts (when /about page appears)
* - getTransition('unique-id', 'in', '/about') is called
* - Adds { to: '/about' } to existing pending
* - Creates Promise and stores inResolve
* - Calls checkAndResolve → both 'from' and 'to' are present!
*
* 3. Transition matching and resolution
* - Finds appropriate transition with from: '/home', to: '/about'
* - Resolves both out and in with the found transition's settings
* - Removes the id from pendingTransitions
*
* Key point: OUT and IN wait for each other. When both are ready,
* they find the appropriate transition using from/to info
* and resolve simultaneously.
*
* Edge cases:
* - No OUT animation on page refresh or initial entry
* - When only IN is called, checkAndResolve doesn't work without 'from'
* - Promise isn't resolved, so animation doesn't start
*/
/**
* Creates a transition configuration
*
* @example
* const config = createSggoiTransitionConfig({
* transitions: [
* { from: '/home', to: '/about', transition: fade() },
* { from: '/products', to: '/products/*', transition: slide() }
* ],
* defaultTransition: fade()
* });
*/
export declare function createSggoiTransitionContext(options: SsgoiConfig): SsgoiContext;
//# sourceMappingURL=create-ssgoi-transition-context.d.ts.map