@flightdev/transitions 0.2.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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/adapters/react/index.d.ts +210 -0
  4. package/dist/adapters/react/index.js +261 -0
  5. package/dist/adapters/react/index.js.map +1 -0
  6. package/dist/adapters/solid/index.d.ts +5 -0
  7. package/dist/adapters/solid/index.js +9 -0
  8. package/dist/adapters/solid/index.js.map +1 -0
  9. package/dist/adapters/svelte/index.d.ts +5 -0
  10. package/dist/adapters/svelte/index.js +9 -0
  11. package/dist/adapters/svelte/index.js.map +1 -0
  12. package/dist/adapters/vue/index.d.ts +5 -0
  13. package/dist/adapters/vue/index.js +9 -0
  14. package/dist/adapters/vue/index.js.map +1 -0
  15. package/dist/chunk-DZC3OLDU.js +121 -0
  16. package/dist/chunk-DZC3OLDU.js.map +1 -0
  17. package/dist/chunk-GEYKSLH6.js +190 -0
  18. package/dist/chunk-GEYKSLH6.js.map +1 -0
  19. package/dist/chunk-N7U5LD4Z.js +70 -0
  20. package/dist/chunk-N7U5LD4Z.js.map +1 -0
  21. package/dist/chunk-OV3U5STU.js +252 -0
  22. package/dist/chunk-OV3U5STU.js.map +1 -0
  23. package/dist/chunk-QSB65CTV.js +438 -0
  24. package/dist/chunk-QSB65CTV.js.map +1 -0
  25. package/dist/chunk-SPUGO5I5.js +138 -0
  26. package/dist/chunk-SPUGO5I5.js.map +1 -0
  27. package/dist/chunk-W7HSR35B.js +3 -0
  28. package/dist/chunk-W7HSR35B.js.map +1 -0
  29. package/dist/chunk-X2A7XWYR.js +442 -0
  30. package/dist/chunk-X2A7XWYR.js.map +1 -0
  31. package/dist/chunk-XLVYHPII.js +3 -0
  32. package/dist/chunk-XLVYHPII.js.map +1 -0
  33. package/dist/chunk-ZI6E7GNQ.js +136 -0
  34. package/dist/chunk-ZI6E7GNQ.js.map +1 -0
  35. package/dist/component/index.d.ts +87 -0
  36. package/dist/component/index.js +5 -0
  37. package/dist/component/index.js.map +1 -0
  38. package/dist/config/index.d.ts +93 -0
  39. package/dist/config/index.js +5 -0
  40. package/dist/config/index.js.map +1 -0
  41. package/dist/core/index.d.ts +107 -0
  42. package/dist/core/index.js +5 -0
  43. package/dist/core/index.js.map +1 -0
  44. package/dist/index.d.ts +10 -0
  45. package/dist/index.js +11 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/layout/index.d.ts +112 -0
  48. package/dist/layout/index.js +4 -0
  49. package/dist/layout/index.js.map +1 -0
  50. package/dist/page/index.d.ts +87 -0
  51. package/dist/page/index.js +7 -0
  52. package/dist/page/index.js.map +1 -0
  53. package/dist/presets/index.d.ts +192 -0
  54. package/dist/presets/index.js +3 -0
  55. package/dist/presets/index.js.map +1 -0
  56. package/dist/router/index.d.ts +104 -0
  57. package/dist/router/index.js +7 -0
  58. package/dist/router/index.js.map +1 -0
  59. package/dist/transition-manager-QWm4OSFw.d.ts +62 -0
  60. package/dist/types-BA4L37s4.d.ts +272 -0
  61. package/dist/view-transition-LSN_PSbm.d.ts +97 -0
  62. package/package.json +148 -0
@@ -0,0 +1,87 @@
1
+ import { P as PageTransitionConfig, T as TransitionPreset, C as CustomTransition, c as TransitionDirection, f as TransitionContext } from '../types-BA4L37s4.js';
2
+
3
+ /**
4
+ * @flightdev/transitions - Page Transitions
5
+ *
6
+ * Page-level transition management for route navigation.
7
+ */
8
+
9
+ /**
10
+ * Define transition configuration for the current page
11
+ * Similar to Nuxt's definePageMeta but for transitions only
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * // In a page component
16
+ * definePageTransition({
17
+ * default: 'slide-left',
18
+ * backTransition: 'slide-right',
19
+ * duration: 250,
20
+ * });
21
+ *
22
+ * export default function DashboardPage() {
23
+ * return <div>Dashboard</div>;
24
+ * }
25
+ * ```
26
+ */
27
+ declare function definePageTransition(config: PageTransitionConfig): void;
28
+ /**
29
+ * Get the transition configuration for a specific page
30
+ */
31
+ declare function getPageTransition(path: string): PageTransitionConfig | undefined;
32
+ /**
33
+ * Clear all page transition configurations
34
+ * Useful for testing or hot module replacement
35
+ */
36
+ declare function clearPageTransitions(): void;
37
+ /**
38
+ * Options for executing a page transition
39
+ */
40
+ interface ExecutePageTransitionOptions {
41
+ /** The path being navigated to */
42
+ to: string;
43
+ /** The path being navigated from */
44
+ from?: string;
45
+ /** Override the transition type */
46
+ transition?: TransitionPreset | CustomTransition | false;
47
+ /** Force a specific direction */
48
+ direction?: TransitionDirection;
49
+ /** Callback to execute the actual DOM update */
50
+ updateDOM: () => void | Promise<void>;
51
+ }
52
+ /**
53
+ * Execute a page transition
54
+ *
55
+ * This is the main function used by the router integration to
56
+ * perform transitions between pages.
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * await executePageTransition({
61
+ * to: '/dashboard',
62
+ * from: '/home',
63
+ * updateDOM: () => {
64
+ * // Update the page content
65
+ * },
66
+ * });
67
+ * ```
68
+ */
69
+ declare function executePageTransition(options: ExecutePageTransitionOptions): Promise<void>;
70
+ /**
71
+ * Register a callback to run before a page leaves
72
+ */
73
+ declare function onBeforePageLeave(callback: (context: TransitionContext) => void): () => void;
74
+ /**
75
+ * Register a callback to run after a page leaves
76
+ */
77
+ declare function onAfterPageLeave(callback: (context: TransitionContext) => void): () => void;
78
+ /**
79
+ * Register a callback to run before a page enters
80
+ */
81
+ declare function onBeforePageEnter(callback: (context: TransitionContext) => void): () => void;
82
+ /**
83
+ * Register a callback to run after a page enters
84
+ */
85
+ declare function onAfterPageEnter(callback: (context: TransitionContext) => void): () => void;
86
+
87
+ export { type ExecutePageTransitionOptions, clearPageTransitions, definePageTransition, executePageTransition, getPageTransition, onAfterPageEnter, onAfterPageLeave, onBeforePageEnter, onBeforePageLeave };
@@ -0,0 +1,7 @@
1
+ import '../chunk-XLVYHPII.js';
2
+ export { clearPageTransitions, definePageTransition, executePageTransition, getPageTransition, onAfterPageEnter, onAfterPageLeave, onBeforePageEnter, onBeforePageLeave } from '../chunk-SPUGO5I5.js';
3
+ import '../chunk-QSB65CTV.js';
4
+ import '../chunk-X2A7XWYR.js';
5
+ import '../chunk-OV3U5STU.js';
6
+ //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,192 @@
1
+ import { C as CustomTransition, T as TransitionPreset } from '../types-BA4L37s4.js';
2
+
3
+ /**
4
+ * @flightdev/transitions - Fade Presets
5
+ *
6
+ * Fade transition presets for smooth opacity-based animations.
7
+ */
8
+
9
+ /**
10
+ * Simple fade transition
11
+ * Elements fade in/out with opacity only
12
+ */
13
+ declare const fade: CustomTransition;
14
+ /**
15
+ * Fade with subtle scale
16
+ * Elements fade and slightly shrink on exit, grow on enter
17
+ */
18
+ declare const fadeScale: CustomTransition;
19
+ /**
20
+ * Fade with blur effect
21
+ * Elements fade and blur on exit, unblur on enter
22
+ */
23
+ declare const fadeBlur: CustomTransition;
24
+ /**
25
+ * Slow fade for dramatic effect
26
+ * Longer duration for hero sections or important content
27
+ */
28
+ declare const fadeSlow: CustomTransition;
29
+ /**
30
+ * Fast fade for snappy UI
31
+ * Quick transitions for responsive feel
32
+ */
33
+ declare const fadeFast: CustomTransition;
34
+
35
+ /**
36
+ * @flightdev/transitions - Slide Presets
37
+ *
38
+ * Slide transition presets for directional page animations.
39
+ */
40
+
41
+ /**
42
+ * Slide from left
43
+ * New content slides in from the left, old slides out to the right
44
+ */
45
+ declare const slideLeft: CustomTransition;
46
+ /**
47
+ * Slide from right
48
+ * New content slides in from the right, old slides out to the left
49
+ */
50
+ declare const slideRight: CustomTransition;
51
+ /**
52
+ * Slide from top
53
+ * New content slides in from the top, old slides out to the bottom
54
+ */
55
+ declare const slideUp: CustomTransition;
56
+ /**
57
+ * Slide from bottom
58
+ * New content slides in from the bottom, old slides out to the top
59
+ * Common for modals and bottom sheets
60
+ */
61
+ declare const slideDown: CustomTransition;
62
+ /**
63
+ * Slide with fade (subtle offset)
64
+ * Elements slide a small distance while fading
65
+ * Less dramatic than full slide
66
+ */
67
+ declare const slideFade: CustomTransition;
68
+ /**
69
+ * Slide with scale (iOS-like)
70
+ * Elements slide and scale slightly for depth effect
71
+ */
72
+ declare const slideScale: CustomTransition;
73
+ /**
74
+ * Slide overlay (modal-like)
75
+ * New content slides over old content which stays in place
76
+ */
77
+ declare const slideOverlay: CustomTransition;
78
+
79
+ /**
80
+ * @flightdev/transitions - Scale Presets
81
+ *
82
+ * Scale transition presets for zoom-based animations.
83
+ */
84
+
85
+ /**
86
+ * Scale in/out
87
+ * Elements grow on enter, shrink on exit
88
+ */
89
+ declare const scale: CustomTransition;
90
+ /**
91
+ * Scale up (zoom in effect)
92
+ * Elements scale from smaller to normal
93
+ */
94
+ declare const scaleUp: CustomTransition;
95
+ /**
96
+ * Scale down (zoom out effect)
97
+ * Elements scale from larger to normal
98
+ */
99
+ declare const scaleDown: CustomTransition;
100
+ /**
101
+ * Scale fade (subtle)
102
+ * Very subtle scale with fade for refined UI
103
+ */
104
+ declare const scaleFade: CustomTransition;
105
+ /**
106
+ * Pop (bouncy scale)
107
+ * Elements pop in with overshoot for playful UI
108
+ */
109
+ declare const pop: CustomTransition;
110
+ /**
111
+ * Expand from center
112
+ * Elements expand from center point
113
+ */
114
+ declare const expand: CustomTransition;
115
+
116
+ /**
117
+ * @flightdev/transitions - Special Presets
118
+ *
119
+ * Special transition presets for advanced effects.
120
+ */
121
+
122
+ /**
123
+ * No transition (instant swap)
124
+ * Use when you want to disable transitions for specific pages
125
+ */
126
+ declare const none: CustomTransition;
127
+ /**
128
+ * Flip horizontal (3D rotation)
129
+ * Elements flip like a card horizontally
130
+ */
131
+ declare const flipX: CustomTransition;
132
+ /**
133
+ * Flip vertical (3D rotation)
134
+ * Elements flip like a card vertically
135
+ */
136
+ declare const flipY: CustomTransition;
137
+ /**
138
+ * Rotate in/out
139
+ * Elements rotate while fading
140
+ */
141
+ declare const rotate: CustomTransition;
142
+ /**
143
+ * Swing in (pendulum effect)
144
+ * Elements swing in from the top
145
+ */
146
+ declare const swing: CustomTransition;
147
+ /**
148
+ * Morph placeholder
149
+ * Actual morph is handled by shared element transitions
150
+ */
151
+ declare const morph: CustomTransition;
152
+ /**
153
+ * Wipe left (reveal effect)
154
+ * Content is revealed from right to left using clip-path
155
+ */
156
+ declare const wipeLeft: CustomTransition;
157
+ /**
158
+ * Wipe up (reveal effect)
159
+ * Content is revealed from bottom to top using clip-path
160
+ */
161
+ declare const wipeUp: CustomTransition;
162
+ /**
163
+ * Circle reveal
164
+ * Content is revealed in a circular pattern from center
165
+ */
166
+ declare const circleReveal: CustomTransition;
167
+
168
+ /**
169
+ * @flightdev/transitions - Presets Module
170
+ *
171
+ * All transition presets exported for easy consumption.
172
+ */
173
+
174
+ /**
175
+ * Map of preset names to transition definitions
176
+ * Used by resolveTransition to look up presets by name
177
+ */
178
+ declare const presetMap: Record<TransitionPreset, CustomTransition>;
179
+ /**
180
+ * Get a preset transition by name
181
+ */
182
+ declare function getPreset(name: TransitionPreset): CustomTransition | undefined;
183
+ /**
184
+ * Check if a string is a valid preset name
185
+ */
186
+ declare function isPresetName(name: string): name is TransitionPreset;
187
+ /**
188
+ * Get all available preset names
189
+ */
190
+ declare function getPresetNames(): TransitionPreset[];
191
+
192
+ export { circleReveal, expand, fade, fadeBlur, fadeFast, fadeScale, fadeSlow, flipX, flipY, getPreset, getPresetNames, isPresetName, morph, none, pop, presetMap, rotate, scale, scaleDown, scaleFade, scaleUp, slideDown, slideFade, slideLeft, slideOverlay, slideRight, slideScale, slideUp, swing, wipeLeft, wipeUp };
@@ -0,0 +1,3 @@
1
+ export { circleReveal, expand, fade, fadeBlur, fadeFast, fadeScale, fadeSlow, flipX, flipY, getPreset, getPresetNames, isPresetName, morph, none, pop, presetMap, rotate, scale, scaleDown, scaleFade, scaleUp, slideDown, slideFade, slideLeft, slideOverlay, slideRight, slideScale, slideUp, swing, wipeLeft, wipeUp } from '../chunk-QSB65CTV.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,104 @@
1
+ import { T as TransitionPreset, C as CustomTransition, c as TransitionDirection, P as PageTransitionConfig } from '../types-BA4L37s4.js';
2
+
3
+ /**
4
+ * @flightdev/transitions - Router Integration
5
+ *
6
+ * Integration with @flightdev/router for seamless page transitions.
7
+ */
8
+
9
+ /**
10
+ * Options for navigating with transitions
11
+ */
12
+ interface NavigateWithTransitionOptions {
13
+ /** Replace current history entry instead of push */
14
+ replace?: boolean;
15
+ /** Scroll to top after navigation */
16
+ scroll?: boolean;
17
+ /** State to pass to the new route */
18
+ state?: Record<string, unknown>;
19
+ /** Transition to use (overrides page default) */
20
+ transition?: TransitionPreset | CustomTransition | false;
21
+ /** Force transition even if globally disabled */
22
+ forceTransition?: boolean;
23
+ /** Direction hint for the transition */
24
+ direction?: TransitionDirection;
25
+ }
26
+ /**
27
+ * Navigate to a URL with transition support
28
+ *
29
+ * This function wraps the standard navigation with View Transitions API
30
+ * support and integrates with the Flight transitions system.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { navigateWithTransition } from '@flightdev/transitions/router';
35
+ *
36
+ * // Simple navigation
37
+ * await navigateWithTransition('/about');
38
+ *
39
+ * // With options
40
+ * await navigateWithTransition('/dashboard', {
41
+ * transition: 'slide-left',
42
+ * replace: false,
43
+ * });
44
+ * ```
45
+ */
46
+ declare function navigateWithTransition(to: string, options?: NavigateWithTransitionOptions): Promise<void>;
47
+ /**
48
+ * Set up history navigation listeners for back/forward transitions
49
+ *
50
+ * Call this once during app initialization to enable transitions
51
+ * for browser back/forward navigation.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import { setupHistoryTransitions } from '@flightdev/transitions/router';
56
+ *
57
+ * // In your app initialization
58
+ * setupHistoryTransitions();
59
+ * ```
60
+ */
61
+ declare function setupHistoryTransitions(): () => void;
62
+ /**
63
+ * Prefetch a route's assets for faster transitions
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * // Prefetch on hover
68
+ * element.addEventListener('mouseenter', () => {
69
+ * prefetchRoute('/about');
70
+ * });
71
+ * ```
72
+ */
73
+ declare function prefetchRoute(url: string): void;
74
+ /**
75
+ * Check if a route has been prefetched
76
+ */
77
+ declare function isRoutePrefetched(url: string): boolean;
78
+ /**
79
+ * Configure transitions based on route patterns
80
+ */
81
+ interface RouteTransitionConfig {
82
+ /** Route pattern (supports wildcards) */
83
+ pattern: string;
84
+ /** Transition configuration for this route */
85
+ transition: PageTransitionConfig;
86
+ }
87
+ /**
88
+ * Register transition configs for route patterns
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * registerRouteTransitions([
93
+ * { pattern: '/dashboard/*', transition: { default: 'slide-left' } },
94
+ * { pattern: '/settings', transition: { default: 'fade' } },
95
+ * ]);
96
+ * ```
97
+ */
98
+ declare function registerRouteTransitions(configs: RouteTransitionConfig[]): void;
99
+ /**
100
+ * Get transition config for a route based on registered patterns
101
+ */
102
+ declare function getRouteTransitionConfig(path: string): PageTransitionConfig | undefined;
103
+
104
+ export { type NavigateWithTransitionOptions, type RouteTransitionConfig, getRouteTransitionConfig, isRoutePrefetched, navigateWithTransition, prefetchRoute, registerRouteTransitions, setupHistoryTransitions };
@@ -0,0 +1,7 @@
1
+ export { getRouteTransitionConfig, isRoutePrefetched, navigateWithTransition, prefetchRoute, registerRouteTransitions, setupHistoryTransitions } from '../chunk-DZC3OLDU.js';
2
+ import '../chunk-SPUGO5I5.js';
3
+ import '../chunk-QSB65CTV.js';
4
+ import '../chunk-X2A7XWYR.js';
5
+ import '../chunk-OV3U5STU.js';
6
+ //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,62 @@
1
+ import { i as TransitionsConfig, j as TransitionState, k as TransitionListener, P as PageTransitionConfig, c as TransitionDirection } from './types-BA4L37s4.js';
2
+
3
+ /**
4
+ * @flightdev/transitions - Transition Manager
5
+ *
6
+ * Central orchestrator for all transition operations.
7
+ * Manages state, configuration, and coordinates between different
8
+ * transition types (page, layout, component).
9
+ */
10
+
11
+ /**
12
+ * Create a new transition manager instance
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const manager = createTransitionManager({
17
+ * pageTransition: 'fade',
18
+ * duration: 200,
19
+ * });
20
+ *
21
+ * // Subscribe to state changes
22
+ * manager.subscribe((state) => {
23
+ * console.log('Transition state:', state);
24
+ * });
25
+ *
26
+ * // Start a transition
27
+ * await manager.startPageTransition('/new-page');
28
+ * ```
29
+ */
30
+ declare function createTransitionManager(initialConfig?: TransitionsConfig): TransitionManager;
31
+ interface TransitionManager {
32
+ /** Get current transition state (readonly copy) */
33
+ getState(): TransitionState;
34
+ /** Get current configuration (readonly copy) */
35
+ getConfig(): TransitionsConfig;
36
+ /** Update configuration */
37
+ configure(config: TransitionsConfig): void;
38
+ /** Subscribe to state changes, returns unsubscribe function */
39
+ subscribe(listener: TransitionListener): () => void;
40
+ /** Start a page transition */
41
+ startPageTransition(to: string, config?: PageTransitionConfig): Promise<void>;
42
+ /** Skip the current transition immediately */
43
+ skipTransition(): void;
44
+ /** Check if transitions are enabled */
45
+ isEnabled(): boolean;
46
+ /** Check if View Transitions API is supported */
47
+ isViewTransitionSupported(): boolean;
48
+ /** Set the navigation direction */
49
+ setDirection(direction: TransitionDirection): void;
50
+ /** Clean up resources */
51
+ destroy(): void;
52
+ }
53
+ /**
54
+ * Get or create the global transition manager instance
55
+ */
56
+ declare function getTransitionManager(): TransitionManager;
57
+ /**
58
+ * Initialize the global transition manager with configuration
59
+ */
60
+ declare function initTransitions(config: TransitionsConfig): TransitionManager;
61
+
62
+ export { type TransitionManager as T, createTransitionManager as c, getTransitionManager as g, initTransitions as i };