@motion.page/sdk 1.0.6 → 1.0.8
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/core/AnimationBuilder.d.ts +2 -0
- package/dist/core/Timeline.d.ts +0 -12
- package/dist/index.cjs +13 -12
- package/dist/index.cjs.map +8 -8
- package/dist/index.js +13 -12
- package/dist/index.js.map +8 -8
- package/dist/triggers/TriggerManager.d.ts +28 -0
- package/dist/types/index.d.ts +7 -0
- package/package.json +1 -1
|
@@ -38,6 +38,8 @@ export declare class TriggerManager {
|
|
|
38
38
|
private static _pageLoadTriggerFactory;
|
|
39
39
|
/** Debounce delay (ms) for the window resize → refreshScrollTriggers handler */
|
|
40
40
|
private static readonly _RESIZE_DEBOUNCE_MS;
|
|
41
|
+
/** Debounce delay (ms) for the body ResizeObserver → refreshScrollTriggers handler */
|
|
42
|
+
private static readonly _BODY_RESIZE_DEBOUNCE_MS;
|
|
41
43
|
private _pageLoadTrigger;
|
|
42
44
|
private _scrollTriggers;
|
|
43
45
|
private _eventTriggers;
|
|
@@ -49,6 +51,12 @@ export declare class TriggerManager {
|
|
|
49
51
|
private _resizeHandler;
|
|
50
52
|
/** Timer id for debounced resize */
|
|
51
53
|
private _resizeTimer;
|
|
54
|
+
/** ResizeObserver watching document.body for height changes (layout shifts) */
|
|
55
|
+
private _bodyResizeObserver;
|
|
56
|
+
/** Last known body height — only refresh when height actually changes */
|
|
57
|
+
private _lastBodyHeight;
|
|
58
|
+
/** Timer id for debounced body resize */
|
|
59
|
+
private _bodyResizeTimer;
|
|
52
60
|
/** All trigger maps — used by unregister() and killAll() for bulk iteration */
|
|
53
61
|
private get _allTriggerMaps();
|
|
54
62
|
private constructor();
|
|
@@ -83,6 +91,26 @@ export declare class TriggerManager {
|
|
|
83
91
|
* @internal
|
|
84
92
|
*/
|
|
85
93
|
private _detachResizeListener;
|
|
94
|
+
/**
|
|
95
|
+
* Attach a ResizeObserver on document.body to detect document height changes.
|
|
96
|
+
*
|
|
97
|
+
* Layout shifts caused by content-visibility:auto, lazy-loaded images,
|
|
98
|
+
* dynamic content insertion, or font loading can change the document height
|
|
99
|
+
* without triggering a window resize event. This observer detects those
|
|
100
|
+
* shifts and refreshes all scroll triggers so pin positions stay correct.
|
|
101
|
+
*
|
|
102
|
+
* Only reacts to height changes (width changes are already covered by the
|
|
103
|
+
* window resize listener). Debounced to avoid excessive refreshes during
|
|
104
|
+
* rapid layout shifts (e.g. multiple images loading in sequence).
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
private _attachBodyResizeObserver;
|
|
108
|
+
/**
|
|
109
|
+
* Detach the body ResizeObserver.
|
|
110
|
+
* Called when the last scroll trigger is removed or killAll() is invoked.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
private _detachBodyResizeObserver;
|
|
86
114
|
/**
|
|
87
115
|
* Register a scroll trigger
|
|
88
116
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -152,6 +152,13 @@ export interface FitConfig {
|
|
|
152
152
|
export interface AnimationConfig {
|
|
153
153
|
from?: AnimationVars;
|
|
154
154
|
to?: AnimationVars;
|
|
155
|
+
/**
|
|
156
|
+
* Immediately set CSS properties on target(s) without animation (duration: 0).
|
|
157
|
+
* Equivalent to GSAP's gsap.set() — applied before from/to tweens.
|
|
158
|
+
* @example
|
|
159
|
+
* Motion('init', '.box', { set: { opacity: 0, visibility: 'visible' }, to: { opacity: 1 }, duration: 1 })
|
|
160
|
+
*/
|
|
161
|
+
set?: AnimationVars;
|
|
155
162
|
duration?: number;
|
|
156
163
|
delay?: number;
|
|
157
164
|
ease?: string;
|