@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.
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/adapters/react/index.d.ts +210 -0
- package/dist/adapters/react/index.js +261 -0
- package/dist/adapters/react/index.js.map +1 -0
- package/dist/adapters/solid/index.d.ts +5 -0
- package/dist/adapters/solid/index.js +9 -0
- package/dist/adapters/solid/index.js.map +1 -0
- package/dist/adapters/svelte/index.d.ts +5 -0
- package/dist/adapters/svelte/index.js +9 -0
- package/dist/adapters/svelte/index.js.map +1 -0
- package/dist/adapters/vue/index.d.ts +5 -0
- package/dist/adapters/vue/index.js +9 -0
- package/dist/adapters/vue/index.js.map +1 -0
- package/dist/chunk-DZC3OLDU.js +121 -0
- package/dist/chunk-DZC3OLDU.js.map +1 -0
- package/dist/chunk-GEYKSLH6.js +190 -0
- package/dist/chunk-GEYKSLH6.js.map +1 -0
- package/dist/chunk-N7U5LD4Z.js +70 -0
- package/dist/chunk-N7U5LD4Z.js.map +1 -0
- package/dist/chunk-OV3U5STU.js +252 -0
- package/dist/chunk-OV3U5STU.js.map +1 -0
- package/dist/chunk-QSB65CTV.js +438 -0
- package/dist/chunk-QSB65CTV.js.map +1 -0
- package/dist/chunk-SPUGO5I5.js +138 -0
- package/dist/chunk-SPUGO5I5.js.map +1 -0
- package/dist/chunk-W7HSR35B.js +3 -0
- package/dist/chunk-W7HSR35B.js.map +1 -0
- package/dist/chunk-X2A7XWYR.js +442 -0
- package/dist/chunk-X2A7XWYR.js.map +1 -0
- package/dist/chunk-XLVYHPII.js +3 -0
- package/dist/chunk-XLVYHPII.js.map +1 -0
- package/dist/chunk-ZI6E7GNQ.js +136 -0
- package/dist/chunk-ZI6E7GNQ.js.map +1 -0
- package/dist/component/index.d.ts +87 -0
- package/dist/component/index.js +5 -0
- package/dist/component/index.js.map +1 -0
- package/dist/config/index.d.ts +93 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/index.d.ts +107 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/index.d.ts +112 -0
- package/dist/layout/index.js +4 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/page/index.d.ts +87 -0
- package/dist/page/index.js +7 -0
- package/dist/page/index.js.map +1 -0
- package/dist/presets/index.d.ts +192 -0
- package/dist/presets/index.js +3 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/router/index.d.ts +104 -0
- package/dist/router/index.js +7 -0
- package/dist/router/index.js.map +1 -0
- package/dist/transition-manager-QWm4OSFw.d.ts +62 -0
- package/dist/types-BA4L37s4.d.ts +272 -0
- package/dist/view-transition-LSN_PSbm.d.ts +97 -0
- package/package.json +148 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { flip } from './chunk-OV3U5STU.js';
|
|
2
|
+
|
|
3
|
+
// src/layout/layout-transition.ts
|
|
4
|
+
var layoutTransitionConfigs = /* @__PURE__ */ new Map();
|
|
5
|
+
function defineLayoutTransition(layoutId, config) {
|
|
6
|
+
layoutTransitionConfigs.set(layoutId, config);
|
|
7
|
+
}
|
|
8
|
+
function getLayoutTransition(layoutId) {
|
|
9
|
+
return layoutTransitionConfigs.get(layoutId);
|
|
10
|
+
}
|
|
11
|
+
function clearLayoutTransitions() {
|
|
12
|
+
layoutTransitionConfigs.clear();
|
|
13
|
+
}
|
|
14
|
+
var sharedElementRegistry = /* @__PURE__ */ new Map();
|
|
15
|
+
function registerSharedElement(name, element) {
|
|
16
|
+
sharedElementRegistry.set(name, element);
|
|
17
|
+
element.style.viewTransitionName = name;
|
|
18
|
+
}
|
|
19
|
+
function unregisterSharedElement(name) {
|
|
20
|
+
const element = sharedElementRegistry.get(name);
|
|
21
|
+
if (element) {
|
|
22
|
+
element.style.viewTransitionName = "";
|
|
23
|
+
}
|
|
24
|
+
sharedElementRegistry.delete(name);
|
|
25
|
+
}
|
|
26
|
+
function getSharedElement(name) {
|
|
27
|
+
return sharedElementRegistry.get(name);
|
|
28
|
+
}
|
|
29
|
+
function clearSharedElements() {
|
|
30
|
+
sharedElementRegistry.forEach((element) => {
|
|
31
|
+
element.style.viewTransitionName = "";
|
|
32
|
+
});
|
|
33
|
+
sharedElementRegistry.clear();
|
|
34
|
+
}
|
|
35
|
+
function getSharedElementNames() {
|
|
36
|
+
return Array.from(sharedElementRegistry.keys());
|
|
37
|
+
}
|
|
38
|
+
async function animateSharedElement(options) {
|
|
39
|
+
const { name, duration = 300, easing, onComplete } = options;
|
|
40
|
+
const element = sharedElementRegistry.get(name);
|
|
41
|
+
if (!element) {
|
|
42
|
+
console.warn(`[Flight Transitions] Shared element "${name}" not found`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await new Promise((resolve) => {
|
|
46
|
+
flip(element, () => {
|
|
47
|
+
}, {
|
|
48
|
+
duration,
|
|
49
|
+
easing,
|
|
50
|
+
onComplete: () => {
|
|
51
|
+
onComplete?.();
|
|
52
|
+
resolve();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var persistentLayouts = /* @__PURE__ */ new Set();
|
|
58
|
+
function markLayoutPersistent(layoutId) {
|
|
59
|
+
persistentLayouts.add(layoutId);
|
|
60
|
+
}
|
|
61
|
+
function isLayoutPersistent(layoutId) {
|
|
62
|
+
return persistentLayouts.has(layoutId);
|
|
63
|
+
}
|
|
64
|
+
function clearPersistentLayouts() {
|
|
65
|
+
persistentLayouts.clear();
|
|
66
|
+
}
|
|
67
|
+
async function executeLayoutTransition(fromLayoutId, toLayoutId, updateDOM) {
|
|
68
|
+
const toConfig = layoutTransitionConfigs.get(toLayoutId);
|
|
69
|
+
if (fromLayoutId === toLayoutId && toConfig?.persist) {
|
|
70
|
+
await updateDOM();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (toConfig?.sharedElements) {
|
|
74
|
+
for (const config of toConfig.sharedElements) {
|
|
75
|
+
const element = sharedElementRegistry.get(config.name);
|
|
76
|
+
if (element) {
|
|
77
|
+
element.style.viewTransitionName = config.name;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
await updateDOM();
|
|
82
|
+
}
|
|
83
|
+
function autoRegisterSharedElements() {
|
|
84
|
+
if (typeof document === "undefined") return;
|
|
85
|
+
const elements = document.querySelectorAll("[data-transition-name]");
|
|
86
|
+
elements.forEach((el) => {
|
|
87
|
+
if (el instanceof HTMLElement) {
|
|
88
|
+
const name = el.dataset.transitionName;
|
|
89
|
+
if (name) {
|
|
90
|
+
registerSharedElement(name, el);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function setupSharedElementObserver() {
|
|
96
|
+
if (typeof document === "undefined") return () => {
|
|
97
|
+
};
|
|
98
|
+
const observer = new MutationObserver((mutations) => {
|
|
99
|
+
for (const mutation of mutations) {
|
|
100
|
+
mutation.addedNodes.forEach((node) => {
|
|
101
|
+
if (node instanceof HTMLElement) {
|
|
102
|
+
const name = node.dataset?.transitionName;
|
|
103
|
+
if (name) {
|
|
104
|
+
registerSharedElement(name, node);
|
|
105
|
+
}
|
|
106
|
+
const children = node.querySelectorAll("[data-transition-name]");
|
|
107
|
+
children.forEach((child) => {
|
|
108
|
+
if (child instanceof HTMLElement) {
|
|
109
|
+
const childName = child.dataset.transitionName;
|
|
110
|
+
if (childName) {
|
|
111
|
+
registerSharedElement(childName, child);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
mutation.removedNodes.forEach((node) => {
|
|
118
|
+
if (node instanceof HTMLElement) {
|
|
119
|
+
const name = node.dataset?.transitionName;
|
|
120
|
+
if (name) {
|
|
121
|
+
unregisterSharedElement(name);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
observer.observe(document.body, {
|
|
128
|
+
childList: true,
|
|
129
|
+
subtree: true
|
|
130
|
+
});
|
|
131
|
+
return () => observer.disconnect();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { animateSharedElement, autoRegisterSharedElements, clearLayoutTransitions, clearPersistentLayouts, clearSharedElements, defineLayoutTransition, executeLayoutTransition, getLayoutTransition, getSharedElement, getSharedElementNames, isLayoutPersistent, markLayoutPersistent, registerSharedElement, setupSharedElementObserver, unregisterSharedElement };
|
|
135
|
+
//# sourceMappingURL=chunk-ZI6E7GNQ.js.map
|
|
136
|
+
//# sourceMappingURL=chunk-ZI6E7GNQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/layout/layout-transition.ts"],"names":[],"mappings":";;;AAkBA,IAAM,uBAAA,uBAA8B,GAAA,EAAoC;AAkBjE,SAAS,sBAAA,CACZ,UACA,MAAA,EACI;AACJ,EAAA,uBAAA,CAAwB,GAAA,CAAI,UAAU,MAAM,CAAA;AAChD;AAKO,SAAS,oBACZ,QAAA,EACkC;AAClC,EAAA,OAAO,uBAAA,CAAwB,IAAI,QAAQ,CAAA;AAC/C;AAKO,SAAS,sBAAA,GAA+B;AAC3C,EAAA,uBAAA,CAAwB,KAAA,EAAM;AAClC;AAOA,IAAM,qBAAA,uBAA4B,GAAA,EAAyB;AAapD,SAAS,qBAAA,CAAsB,MAAc,OAAA,EAA4B;AAC5E,EAAA,qBAAA,CAAsB,GAAA,CAAI,MAAM,OAAO,CAAA;AAGvC,EAAA,OAAA,CAAQ,MAAM,kBAAA,GAAqB,IAAA;AACvC;AAKO,SAAS,wBAAwB,IAAA,EAAoB;AACxD,EAAA,MAAM,OAAA,GAAU,qBAAA,CAAsB,GAAA,CAAI,IAAI,CAAA;AAC9C,EAAA,IAAI,OAAA,EAAS;AACT,IAAA,OAAA,CAAQ,MAAM,k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AO,MAAM,SAAS,UAAA,EAAW;AACrC","file":"chunk-ZI6E7GNQ.js","sourcesContent":["/**\r\n * @flightdev/transitions - Layout Transitions\r\n * \r\n * Layout-level transitions for persistent UI elements across navigations.\r\n */\r\n\r\nimport type {\r\n LayoutTransitionConfig,\r\n SharedElementConfig,\r\n ResolvedTransition,\r\n} from '../core/types';\r\nimport { flip } from '../core/animation-engine';\r\n\r\n// =============================================================================\r\n// LAYOUT TRANSITION CONFIG\r\n// =============================================================================\r\n\r\n/** Storage for layout-specific transition configurations */\r\nconst layoutTransitionConfigs = new Map<string, LayoutTransitionConfig>();\r\n\r\n/**\r\n * Define transition configuration for a layout\r\n * \r\n * @example\r\n * ```tsx\r\n * // In a layout component\r\n * defineLayoutTransition({\r\n * default: 'fade',\r\n * persist: true, // Layout persists during page transitions\r\n * sharedElements: [\r\n * { name: 'header', animation: 'none' },\r\n * { name: 'sidebar', animation: 'none' },\r\n * ],\r\n * });\r\n * ```\r\n */\r\nexport function defineLayoutTransition(\r\n layoutId: string,\r\n config: LayoutTransitionConfig\r\n): void {\r\n layoutTransitionConfigs.set(layoutId, config);\r\n}\r\n\r\n/**\r\n * Get the transition configuration for a layout\r\n */\r\nexport function getLayoutTransition(\r\n layoutId: string\r\n): LayoutTransitionConfig | undefined {\r\n return layoutTransitionConfigs.get(layoutId);\r\n}\r\n\r\n/**\r\n * Clear all layout transition configurations\r\n */\r\nexport function clearLayoutTransitions(): void {\r\n layoutTransitionConfigs.clear();\r\n}\r\n\r\n// =============================================================================\r\n// SHARED ELEMENT TRANSITIONS\r\n// =============================================================================\r\n\r\n/** Registry of shared elements on the current page */\r\nconst sharedElementRegistry = new Map<string, HTMLElement>();\r\n\r\n/**\r\n * Register a shared element for transition\r\n * \r\n * @example\r\n * ```typescript\r\n * // Register an element\r\n * registerSharedElement('hero-image', document.getElementById('hero'));\r\n * \r\n * // On navigation, elements with matching names will animate between positions\r\n * ```\r\n */\r\nexport function registerSharedElement(name: string, element: HTMLElement): void {\r\n sharedElementRegistry.set(name, element);\r\n\r\n // Set the view-transition-name CSS property\r\n element.style.viewTransitionName = name;\r\n}\r\n\r\n/**\r\n * Unregister a shared element\r\n */\r\nexport function unregisterSharedElement(name: string): void {\r\n const element = sharedElementRegistry.get(name);\r\n if (element) {\r\n element.style.viewTransitionName = '';\r\n }\r\n sharedElementRegistry.delete(name);\r\n}\r\n\r\n/**\r\n * Get a registered shared element\r\n */\r\nexport function getSharedElement(name: string): HTMLElement | undefined {\r\n return sharedElementRegistry.get(name);\r\n}\r\n\r\n/**\r\n * Clear all shared elements\r\n */\r\nexport function clearSharedElements(): void {\r\n sharedElementRegistry.forEach((element) => {\r\n element.style.viewTransitionName = '';\r\n });\r\n sharedElementRegistry.clear();\r\n}\r\n\r\n/**\r\n * Get all registered shared element names\r\n */\r\nexport function getSharedElementNames(): string[] {\r\n return Array.from(sharedElementRegistry.keys());\r\n}\r\n\r\n// =============================================================================\r\n// SHARED ELEMENT ANIMATION\r\n// =============================================================================\r\n\r\n/**\r\n * Options for shared element transition\r\n */\r\nexport interface SharedElementTransitionOptions {\r\n /** Name of the shared element */\r\n name: string;\r\n /** Duration of the animation */\r\n duration?: number;\r\n /** Easing function */\r\n easing?: string;\r\n /** Callback when animation completes */\r\n onComplete?: () => void;\r\n}\r\n\r\n/**\r\n * Animate a shared element between two states using FLIP\r\n * \r\n * This manually implements shared element transitions for browsers\r\n * that don't support the View Transitions API.\r\n */\r\nexport async function animateSharedElement(\r\n options: SharedElementTransitionOptions\r\n): Promise<void> {\r\n const { name, duration = 300, easing, onComplete } = options;\r\n const element = sharedElementRegistry.get(name);\r\n\r\n if (!element) {\r\n console.warn(`[Flight Transitions] Shared element \"${name}\" not found`);\r\n return;\r\n }\r\n\r\n // Use FLIP animation\r\n await new Promise<void>((resolve) => {\r\n const handle = flip(element, () => {\r\n // This would be called after DOM update\r\n }, {\r\n duration,\r\n easing,\r\n onComplete: () => {\r\n onComplete?.();\r\n resolve();\r\n },\r\n });\r\n });\r\n}\r\n\r\n// =============================================================================\r\n// LAYOUT PERSISTENCE\r\n// =============================================================================\r\n\r\n/**\r\n * Track which layouts should persist during transitions\r\n */\r\nconst persistentLayouts = new Set<string>();\r\n\r\n/**\r\n * Mark a layout as persistent (it won't transition)\r\n */\r\nexport function markLayoutPersistent(layoutId: string): void {\r\n persistentLayouts.add(layoutId);\r\n}\r\n\r\n/**\r\n * Check if a layout is persistent\r\n */\r\nexport function isLayoutPersistent(layoutId: string): boolean {\r\n return persistentLayouts.has(layoutId);\r\n}\r\n\r\n/**\r\n * Clear persistent layout tracking\r\n */\r\nexport function clearPersistentLayouts(): void {\r\n persistentLayouts.clear();\r\n}\r\n\r\n// =============================================================================\r\n// LAYOUT TRANSITION EXECUTION\r\n// =============================================================================\r\n\r\n/**\r\n * Execute a layout transition\r\n * \r\n * Unlike page transitions, layout transitions are more subtle and\r\n * typically involve animating specific sections while preserving others.\r\n */\r\nexport async function executeLayoutTransition(\r\n fromLayoutId: string | null,\r\n toLayoutId: string,\r\n updateDOM: () => void | Promise<void>\r\n): Promise<void> {\r\n const toConfig = layoutTransitionConfigs.get(toLayoutId);\r\n\r\n // If layout is persistent and same, no transition needed\r\n if (fromLayoutId === toLayoutId && toConfig?.persist) {\r\n await updateDOM();\r\n return;\r\n }\r\n\r\n // Configure shared elements if specified\r\n if (toConfig?.sharedElements) {\r\n for (const config of toConfig.sharedElements) {\r\n const element = sharedElementRegistry.get(config.name);\r\n if (element) {\r\n element.style.viewTransitionName = config.name;\r\n }\r\n }\r\n }\r\n\r\n // Execute the DOM update\r\n await updateDOM();\r\n}\r\n\r\n// =============================================================================\r\n// AUTO-DETECTION OF SHARED ELEMENTS\r\n// =============================================================================\r\n\r\n/**\r\n * Automatically find and register shared elements based on data attributes\r\n * \r\n * Elements with `data-transition-name` or `transition:name` will be registered.\r\n */\r\nexport function autoRegisterSharedElements(): void {\r\n if (typeof document === 'undefined') return;\r\n\r\n // Find elements with data-transition-name\r\n const elements = document.querySelectorAll('[data-transition-name]');\r\n\r\n elements.forEach((el) => {\r\n if (el instanceof HTMLElement) {\r\n const name = el.dataset.transitionName;\r\n if (name) {\r\n registerSharedElement(name, el);\r\n }\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Set up a MutationObserver to auto-register shared elements\r\n */\r\nexport function setupSharedElementObserver(): () => void {\r\n if (typeof document === 'undefined') return () => { };\r\n\r\n const observer = new MutationObserver((mutations) => {\r\n for (const mutation of mutations) {\r\n // Check added nodes\r\n mutation.addedNodes.forEach((node) => {\r\n if (node instanceof HTMLElement) {\r\n // Check the node itself\r\n const name = node.dataset?.transitionName;\r\n if (name) {\r\n registerSharedElement(name, node);\r\n }\r\n\r\n // Check children\r\n const children = node.querySelectorAll('[data-transition-name]');\r\n children.forEach((child) => {\r\n if (child instanceof HTMLElement) {\r\n const childName = child.dataset.transitionName;\r\n if (childName) {\r\n registerSharedElement(childName, child);\r\n }\r\n }\r\n });\r\n }\r\n });\r\n\r\n // Check removed nodes\r\n mutation.removedNodes.forEach((node) => {\r\n if (node instanceof HTMLElement) {\r\n const name = node.dataset?.transitionName;\r\n if (name) {\r\n unregisterSharedElement(name);\r\n }\r\n }\r\n });\r\n }\r\n });\r\n\r\n observer.observe(document.body, {\r\n childList: true,\r\n subtree: true,\r\n });\r\n\r\n return () => observer.disconnect();\r\n}\r\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { T as TransitionPreset, C as CustomTransition } from '../types-BA4L37s4.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @flightdev/transitions - Component Transitions
|
|
5
|
+
*
|
|
6
|
+
* Component-level transitions for enter/leave animations.
|
|
7
|
+
* Framework-agnostic primitives that adapters build upon.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates a presence controller for managing enter/exit animations
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const presence = createPresence(element, {
|
|
16
|
+
* type: 'fade',
|
|
17
|
+
* onComplete: () => element.remove(),
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // Show
|
|
21
|
+
* await presence.enter();
|
|
22
|
+
*
|
|
23
|
+
* // Hide
|
|
24
|
+
* await presence.exit();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare function createPresence(element: HTMLElement, options?: PresenceOptions): PresenceController;
|
|
28
|
+
interface PresenceOptions {
|
|
29
|
+
type?: TransitionPreset | CustomTransition;
|
|
30
|
+
duration?: number;
|
|
31
|
+
appear?: boolean;
|
|
32
|
+
onEnterStart?: () => void;
|
|
33
|
+
onEnterComplete?: () => void;
|
|
34
|
+
onExitStart?: () => void;
|
|
35
|
+
onExitComplete?: () => void;
|
|
36
|
+
}
|
|
37
|
+
interface PresenceController {
|
|
38
|
+
readonly isPresent: boolean;
|
|
39
|
+
enter(): Promise<void>;
|
|
40
|
+
exit(): Promise<void>;
|
|
41
|
+
cancel(): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a transition group controller for list animations
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const group = createTransitionGroup(containerElement, {
|
|
49
|
+
* type: 'fade',
|
|
50
|
+
* stagger: 50,
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* // Animate items entering
|
|
54
|
+
* group.addItems([item1, item2, item3]);
|
|
55
|
+
*
|
|
56
|
+
* // Animate items leaving
|
|
57
|
+
* group.removeItems([item2]);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function createTransitionGroup(container: HTMLElement, options?: TransitionGroupOptions): TransitionGroupController;
|
|
61
|
+
interface TransitionGroupOptions {
|
|
62
|
+
type?: TransitionPreset | CustomTransition;
|
|
63
|
+
stagger?: number;
|
|
64
|
+
appear?: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface TransitionGroupController {
|
|
67
|
+
readonly items: HTMLElement[];
|
|
68
|
+
addItems(items: HTMLElement[]): Promise<void>;
|
|
69
|
+
removeItems(items: HTMLElement[]): Promise<void>;
|
|
70
|
+
reorderItems(newOrder: HTMLElement[], animate?: boolean): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Simple visibility toggle with transition
|
|
74
|
+
*/
|
|
75
|
+
declare function toggleVisibility(element: HTMLElement, show: boolean, options?: {
|
|
76
|
+
type?: TransitionPreset | CustomTransition;
|
|
77
|
+
duration?: number;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Transition between two elements (one out, one in)
|
|
81
|
+
*/
|
|
82
|
+
declare function crossfade(outElement: HTMLElement, inElement: HTMLElement, options?: {
|
|
83
|
+
type?: TransitionPreset | CustomTransition;
|
|
84
|
+
mode?: 'in-out' | 'out-in' | 'simultaneous';
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
|
|
87
|
+
export { type PresenceController, type PresenceOptions, type TransitionGroupController, type TransitionGroupOptions, createPresence, createTransitionGroup, crossfade, toggleVisibility };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { i as TransitionsConfig, T as TransitionPreset, C as CustomTransition } from '../types-BA4L37s4.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @flightdev/transitions - Configuration Module
|
|
5
|
+
*
|
|
6
|
+
* Configuration helpers and defaults for the transitions system.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Default transitions configuration
|
|
11
|
+
*/
|
|
12
|
+
declare const defaultConfig: TransitionsConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Define transitions configuration
|
|
15
|
+
*
|
|
16
|
+
* Use this in flight.config.ts to configure transitions globally.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // flight.config.ts
|
|
21
|
+
* import { defineConfig } from '@flightdev/core';
|
|
22
|
+
* import { defineTransitionsConfig } from '@flightdev/transitions/config';
|
|
23
|
+
*
|
|
24
|
+
* export default defineConfig({
|
|
25
|
+
* transitions: defineTransitionsConfig({
|
|
26
|
+
* pageTransition: 'slide-left',
|
|
27
|
+
* duration: 300,
|
|
28
|
+
* }),
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function defineTransitionsConfig(config: Partial<TransitionsConfig>): TransitionsConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the transitions system with configuration
|
|
35
|
+
*
|
|
36
|
+
* Call this during app initialization to set up transitions.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { initializeTransitions } from '@flightdev/transitions/config';
|
|
41
|
+
*
|
|
42
|
+
* initializeTransitions({
|
|
43
|
+
* pageTransition: 'fade',
|
|
44
|
+
* reduceMotion: 'respect-system',
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare function initializeTransitions(config?: Partial<TransitionsConfig>): void;
|
|
49
|
+
/**
|
|
50
|
+
* Update transitions configuration at runtime
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // Disable transitions
|
|
55
|
+
* updateTransitionsConfig({ enabled: false });
|
|
56
|
+
*
|
|
57
|
+
* // Change default transition
|
|
58
|
+
* updateTransitionsConfig({ pageTransition: 'slide-left' });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare function updateTransitionsConfig(config: Partial<TransitionsConfig>): void;
|
|
62
|
+
/**
|
|
63
|
+
* Get the current transitions configuration
|
|
64
|
+
*/
|
|
65
|
+
declare function getTransitionsConfig(): TransitionsConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Check if a value is a valid transition preset name
|
|
68
|
+
*/
|
|
69
|
+
declare function isTransitionPreset(value: unknown): value is TransitionPreset;
|
|
70
|
+
/**
|
|
71
|
+
* Check if a value is a custom transition definition
|
|
72
|
+
*/
|
|
73
|
+
declare function isCustomTransition(value: unknown): value is CustomTransition;
|
|
74
|
+
/**
|
|
75
|
+
* Check if the current environment supports transitions
|
|
76
|
+
*/
|
|
77
|
+
declare function isTransitionsSupported(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Get browser capability information
|
|
80
|
+
*/
|
|
81
|
+
declare function getCapabilities(): TransitionCapabilities;
|
|
82
|
+
interface TransitionCapabilities {
|
|
83
|
+
/** Browser supports View Transitions API */
|
|
84
|
+
viewTransitionsApi: boolean;
|
|
85
|
+
/** Browser supports Web Animations API */
|
|
86
|
+
webAnimationsApi: boolean;
|
|
87
|
+
/** Browser supports CSS view-transition-name */
|
|
88
|
+
cssViewTransitions: boolean;
|
|
89
|
+
/** User prefers reduced motion */
|
|
90
|
+
reducedMotion: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { type TransitionCapabilities, defaultConfig, defineTransitionsConfig, getCapabilities, getTransitionsConfig, initializeTransitions, isCustomTransition, isTransitionPreset, isTransitionsSupported, updateTransitionsConfig };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { defaultConfig, defineTransitionsConfig, getCapabilities, getTransitionsConfig, initializeTransitions, isCustomTransition, isTransitionPreset, isTransitionsSupported, updateTransitionsConfig } from '../chunk-N7U5LD4Z.js';
|
|
2
|
+
import '../chunk-X2A7XWYR.js';
|
|
3
|
+
import '../chunk-OV3U5STU.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { d as TransitionKeyframe, F as FillMode, R as ResolvedTransition, T as TransitionPreset, C as CustomTransition } from '../types-BA4L37s4.js';
|
|
2
|
+
export { A as AnimatableProperty, L as LayoutTransitionConfig, m as LinkWithTransitionProps, N as NavigateWithTransitionOptions, P as PageTransitionConfig, e as ReduceMotionBehavior, S as SharedElementConfig, f as TransitionContext, c as TransitionDirection, h as TransitionGroupProps, l as TransitionInput, k as TransitionListener, g as TransitionProps, j as TransitionState, i as TransitionsConfig, V as ViewTransition, a as ViewTransitionOptions, b as ViewTransitionResult } from '../types-BA4L37s4.js';
|
|
3
|
+
export { C as CrossDocumentTransitionOptions, e as enableCrossDocumentTransitions, a as isCrossDocumentTransitionSupported, i as isViewTransitionSupported, s as startViewTransition } from '../view-transition-LSN_PSbm.js';
|
|
4
|
+
export { T as TransitionManager, c as createTransitionManager, g as getTransitionManager, i as initTransitions } from '../transition-manager-QWm4OSFw.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @flightdev/transitions - Animation Engine
|
|
8
|
+
*
|
|
9
|
+
* Low-level animation primitives using the Web Animations API.
|
|
10
|
+
* Provides performant, interruptible animations with proper cleanup.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Default animation duration in milliseconds */
|
|
14
|
+
declare const DEFAULT_DURATION = 200;
|
|
15
|
+
/** Default easing function */
|
|
16
|
+
declare const DEFAULT_EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
17
|
+
/** Reduced motion duration (near-instant) */
|
|
18
|
+
declare const REDUCED_MOTION_DURATION = 1;
|
|
19
|
+
/**
|
|
20
|
+
* Options for creating an animation
|
|
21
|
+
*/
|
|
22
|
+
interface AnimationOptions {
|
|
23
|
+
/** Animation duration in milliseconds */
|
|
24
|
+
duration?: number;
|
|
25
|
+
/** CSS easing function */
|
|
26
|
+
easing?: string;
|
|
27
|
+
/** Delay before animation starts */
|
|
28
|
+
delay?: number;
|
|
29
|
+
/** Animation fill mode */
|
|
30
|
+
fill?: FillMode;
|
|
31
|
+
/** Callback when animation starts */
|
|
32
|
+
onStart?: () => void;
|
|
33
|
+
/** Callback when animation completes */
|
|
34
|
+
onComplete?: () => void;
|
|
35
|
+
/** Callback when animation is cancelled */
|
|
36
|
+
onCancel?: () => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Result from creating an animation
|
|
40
|
+
*/
|
|
41
|
+
interface AnimationHandle {
|
|
42
|
+
/** The underlying Animation object */
|
|
43
|
+
animation: Animation;
|
|
44
|
+
/** Promise that resolves when animation finishes */
|
|
45
|
+
finished: Promise<void>;
|
|
46
|
+
/** Cancel the animation */
|
|
47
|
+
cancel(): void;
|
|
48
|
+
/** Pause the animation */
|
|
49
|
+
pause(): void;
|
|
50
|
+
/** Resume a paused animation */
|
|
51
|
+
resume(): void;
|
|
52
|
+
/** Reverse the animation direction */
|
|
53
|
+
reverse(): void;
|
|
54
|
+
/** Set the current time (0-1 normalized) */
|
|
55
|
+
seek(progress: number): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Animate an element with keyframes
|
|
59
|
+
*
|
|
60
|
+
* Uses the Web Animations API for smooth, performant animations.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const handle = animate(element, {
|
|
65
|
+
* from: { opacity: '1', transform: 'scale(1)' },
|
|
66
|
+
* to: { opacity: '0', transform: 'scale(0.95)' }
|
|
67
|
+
* }, { duration: 200 });
|
|
68
|
+
*
|
|
69
|
+
* await handle.finished;
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function animate(element: Element, keyframe: TransitionKeyframe, options?: AnimationOptions): AnimationHandle;
|
|
73
|
+
/**
|
|
74
|
+
* Animate an element out (leaving)
|
|
75
|
+
*/
|
|
76
|
+
declare function animateOut(element: Element, transition: ResolvedTransition, options?: Omit<AnimationOptions, 'duration' | 'easing'>): AnimationHandle;
|
|
77
|
+
/**
|
|
78
|
+
* Animate an element in (entering)
|
|
79
|
+
*/
|
|
80
|
+
declare function animateIn(element: Element, transition: ResolvedTransition, options?: Omit<AnimationOptions, 'duration' | 'easing'>): AnimationHandle;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a preset name or custom transition to a normalized format
|
|
83
|
+
*/
|
|
84
|
+
declare function resolveTransition(input: TransitionPreset | CustomTransition | false, reducedMotion?: boolean): ResolvedTransition | null;
|
|
85
|
+
/**
|
|
86
|
+
* Check if user prefers reduced motion
|
|
87
|
+
*/
|
|
88
|
+
declare function prefersReducedMotion(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Subscribe to reduced motion preference changes
|
|
91
|
+
*/
|
|
92
|
+
declare function onReducedMotionChange(callback: (prefersReduced: boolean) => void): () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Cancel all running animations on an element
|
|
95
|
+
*/
|
|
96
|
+
declare function cancelAnimations(element: Element): void;
|
|
97
|
+
/**
|
|
98
|
+
* Wait for all animations on an element to complete
|
|
99
|
+
*/
|
|
100
|
+
declare function waitForAnimations(element: Element): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* FLIP animation helper (First, Last, Invert, Play)
|
|
103
|
+
* Useful for shared element transitions
|
|
104
|
+
*/
|
|
105
|
+
declare function flip(element: HTMLElement, callback: () => void | Promise<void>, options?: AnimationOptions): AnimationHandle;
|
|
106
|
+
|
|
107
|
+
export { type AnimationHandle, type AnimationOptions, CustomTransition, DEFAULT_DURATION, DEFAULT_EASING, FillMode, REDUCED_MOTION_DURATION, ResolvedTransition, TransitionKeyframe, TransitionPreset, animate, animateIn, animateOut, cancelAnimations, flip, onReducedMotionChange, prefersReducedMotion, resolveTransition, waitForAnimations };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import '../chunk-W7HSR35B.js';
|
|
2
|
+
export { createTransitionManager, enableCrossDocumentTransitions, getTransitionManager, initTransitions, isCrossDocumentTransitionSupported, isViewTransitionSupported, startViewTransition } from '../chunk-X2A7XWYR.js';
|
|
3
|
+
export { DEFAULT_DURATION, DEFAULT_EASING, REDUCED_MOTION_DURATION, animate, animateIn, animateOut, cancelAnimations, flip, onReducedMotionChange, prefersReducedMotion, resolveTransition, waitForAnimations } from '../chunk-OV3U5STU.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { C as CustomTransition, L as LayoutTransitionConfig, P as PageTransitionConfig, e as ReduceMotionBehavior, R as ResolvedTransition, S as SharedElementConfig, f as TransitionContext, c as TransitionDirection, h as TransitionGroupProps, d as TransitionKeyframe, k as TransitionListener, T as TransitionPreset, g as TransitionProps, j as TransitionState, i as TransitionsConfig, V as ViewTransition, a as ViewTransitionOptions, b as ViewTransitionResult } from './types-BA4L37s4.js';
|
|
2
|
+
export { e as enableCrossDocumentTransitions, a as isCrossDocumentTransitionSupported, i as isViewTransitionSupported, s as startViewTransition } from './view-transition-LSN_PSbm.js';
|
|
3
|
+
export { DEFAULT_DURATION, DEFAULT_EASING, animate, animateIn, animateOut, cancelAnimations, flip, onReducedMotionChange, prefersReducedMotion, resolveTransition, waitForAnimations } from './core/index.js';
|
|
4
|
+
export { c as createTransitionManager, g as getTransitionManager, i as initTransitions } from './transition-manager-QWm4OSFw.js';
|
|
5
|
+
export { definePageTransition, executePageTransition, getPageTransition, onAfterPageEnter, onAfterPageLeave, onBeforePageEnter, onBeforePageLeave } from './page/index.js';
|
|
6
|
+
export { animateSharedElement, autoRegisterSharedElements, defineLayoutTransition, getSharedElement, registerSharedElement, setupSharedElementObserver, unregisterSharedElement } from './layout/index.js';
|
|
7
|
+
export { createPresence, createTransitionGroup, crossfade, toggleVisibility } from './component/index.js';
|
|
8
|
+
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, slideRight, slideScale, slideUp, wipeLeft, wipeUp } from './presets/index.js';
|
|
9
|
+
export { defaultConfig, defineTransitionsConfig, getCapabilities, getTransitionsConfig, initializeTransitions, isTransitionsSupported, updateTransitionsConfig } from './config/index.js';
|
|
10
|
+
export { navigateWithTransition, prefetchRoute, registerRouteTransitions, setupHistoryTransitions } from './router/index.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { navigateWithTransition, prefetchRoute, registerRouteTransitions, setupHistoryTransitions } from './chunk-DZC3OLDU.js';
|
|
2
|
+
export { defaultConfig, defineTransitionsConfig, getCapabilities, getTransitionsConfig, initializeTransitions, isTransitionsSupported, updateTransitionsConfig } from './chunk-N7U5LD4Z.js';
|
|
3
|
+
export { createPresence, createTransitionGroup, crossfade, toggleVisibility } from './chunk-GEYKSLH6.js';
|
|
4
|
+
import './chunk-XLVYHPII.js';
|
|
5
|
+
export { definePageTransition, executePageTransition, getPageTransition, onAfterPageEnter, onAfterPageLeave, onBeforePageEnter, onBeforePageLeave } from './chunk-SPUGO5I5.js';
|
|
6
|
+
export { animateSharedElement, autoRegisterSharedElements, defineLayoutTransition, getSharedElement, registerSharedElement, setupSharedElementObserver, unregisterSharedElement } from './chunk-ZI6E7GNQ.js';
|
|
7
|
+
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, slideRight, slideScale, slideUp, wipeLeft, wipeUp } from './chunk-QSB65CTV.js';
|
|
8
|
+
export { createTransitionManager, enableCrossDocumentTransitions, getTransitionManager, initTransitions, isCrossDocumentTransitionSupported, isViewTransitionSupported, startViewTransition } from './chunk-X2A7XWYR.js';
|
|
9
|
+
export { DEFAULT_DURATION, DEFAULT_EASING, animate, animateIn, animateOut, cancelAnimations, flip, onReducedMotionChange, prefersReducedMotion, resolveTransition, waitForAnimations } from './chunk-OV3U5STU.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { L as LayoutTransitionConfig } from '../types-BA4L37s4.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @flightdev/transitions - Layout Transitions
|
|
5
|
+
*
|
|
6
|
+
* Layout-level transitions for persistent UI elements across navigations.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Define transition configuration for a layout
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // In a layout component
|
|
15
|
+
* defineLayoutTransition({
|
|
16
|
+
* default: 'fade',
|
|
17
|
+
* persist: true, // Layout persists during page transitions
|
|
18
|
+
* sharedElements: [
|
|
19
|
+
* { name: 'header', animation: 'none' },
|
|
20
|
+
* { name: 'sidebar', animation: 'none' },
|
|
21
|
+
* ],
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function defineLayoutTransition(layoutId: string, config: LayoutTransitionConfig): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the transition configuration for a layout
|
|
28
|
+
*/
|
|
29
|
+
declare function getLayoutTransition(layoutId: string): LayoutTransitionConfig | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Clear all layout transition configurations
|
|
32
|
+
*/
|
|
33
|
+
declare function clearLayoutTransitions(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Register a shared element for transition
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Register an element
|
|
40
|
+
* registerSharedElement('hero-image', document.getElementById('hero'));
|
|
41
|
+
*
|
|
42
|
+
* // On navigation, elements with matching names will animate between positions
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare function registerSharedElement(name: string, element: HTMLElement): void;
|
|
46
|
+
/**
|
|
47
|
+
* Unregister a shared element
|
|
48
|
+
*/
|
|
49
|
+
declare function unregisterSharedElement(name: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get a registered shared element
|
|
52
|
+
*/
|
|
53
|
+
declare function getSharedElement(name: string): HTMLElement | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Clear all shared elements
|
|
56
|
+
*/
|
|
57
|
+
declare function clearSharedElements(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get all registered shared element names
|
|
60
|
+
*/
|
|
61
|
+
declare function getSharedElementNames(): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Options for shared element transition
|
|
64
|
+
*/
|
|
65
|
+
interface SharedElementTransitionOptions {
|
|
66
|
+
/** Name of the shared element */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Duration of the animation */
|
|
69
|
+
duration?: number;
|
|
70
|
+
/** Easing function */
|
|
71
|
+
easing?: string;
|
|
72
|
+
/** Callback when animation completes */
|
|
73
|
+
onComplete?: () => void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Animate a shared element between two states using FLIP
|
|
77
|
+
*
|
|
78
|
+
* This manually implements shared element transitions for browsers
|
|
79
|
+
* that don't support the View Transitions API.
|
|
80
|
+
*/
|
|
81
|
+
declare function animateSharedElement(options: SharedElementTransitionOptions): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Mark a layout as persistent (it won't transition)
|
|
84
|
+
*/
|
|
85
|
+
declare function markLayoutPersistent(layoutId: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Check if a layout is persistent
|
|
88
|
+
*/
|
|
89
|
+
declare function isLayoutPersistent(layoutId: string): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Clear persistent layout tracking
|
|
92
|
+
*/
|
|
93
|
+
declare function clearPersistentLayouts(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Execute a layout transition
|
|
96
|
+
*
|
|
97
|
+
* Unlike page transitions, layout transitions are more subtle and
|
|
98
|
+
* typically involve animating specific sections while preserving others.
|
|
99
|
+
*/
|
|
100
|
+
declare function executeLayoutTransition(fromLayoutId: string | null, toLayoutId: string, updateDOM: () => void | Promise<void>): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Automatically find and register shared elements based on data attributes
|
|
103
|
+
*
|
|
104
|
+
* Elements with `data-transition-name` or `transition:name` will be registered.
|
|
105
|
+
*/
|
|
106
|
+
declare function autoRegisterSharedElements(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Set up a MutationObserver to auto-register shared elements
|
|
109
|
+
*/
|
|
110
|
+
declare function setupSharedElementObserver(): () => void;
|
|
111
|
+
|
|
112
|
+
export { type SharedElementTransitionOptions, animateSharedElement, autoRegisterSharedElements, clearLayoutTransitions, clearPersistentLayouts, clearSharedElements, defineLayoutTransition, executeLayoutTransition, getLayoutTransition, getSharedElement, getSharedElementNames, isLayoutPersistent, markLayoutPersistent, registerSharedElement, setupSharedElementObserver, unregisterSharedElement };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { animateSharedElement, autoRegisterSharedElements, clearLayoutTransitions, clearPersistentLayouts, clearSharedElements, defineLayoutTransition, executeLayoutTransition, getLayoutTransition, getSharedElement, getSharedElementNames, isLayoutPersistent, markLayoutPersistent, registerSharedElement, setupSharedElementObserver, unregisterSharedElement } from '../chunk-ZI6E7GNQ.js';
|
|
2
|
+
import '../chunk-OV3U5STU.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|