@motion.page/sdk 0.1.0 → 0.1.1
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/README.md +372 -26
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +5 -5
- package/dist/index.js +7 -7
- package/dist/index.js.map +5 -5
- package/dist/triggers/TriggerManager.d.ts +7 -0
- package/dist/utils/getLayoutRect.d.ts +8 -3
- package/package.json +1 -6
|
@@ -117,6 +117,13 @@ export declare class TriggerManager {
|
|
|
117
117
|
* Refresh all position-based triggers after layout changes (e.g. window resize).
|
|
118
118
|
* This includes scroll triggers, hover event triggers, gesture triggers, and
|
|
119
119
|
* mouseMove triggers — all of which cache element bounds at setup time.
|
|
120
|
+
*
|
|
121
|
+
* Scroll triggers are refreshed in DOM document order (top to bottom).
|
|
122
|
+
* This ensures that when a pinned trigger's spacer size changes during refresh,
|
|
123
|
+
* triggers lower in the page measure the already-updated spacer positions rather
|
|
124
|
+
* than stale pre-refresh values. Non-pinned triggers (no pin manager / layout
|
|
125
|
+
* rect) are always sorted after pinned ones so they benefit from all spacer
|
|
126
|
+
* updates before recalculating their own positions.
|
|
120
127
|
*/
|
|
121
128
|
refreshScrollTriggers(): void;
|
|
122
129
|
/**
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns the element's bounding rect as if no CSS transform were applied.
|
|
3
|
-
* Temporarily strips
|
|
2
|
+
* Returns the element's bounding rect as if no CSS transform or position:fixed were applied.
|
|
3
|
+
* Temporarily strips inline transforms and any fixed positioning, measures, then restores.
|
|
4
4
|
* This gives us the "layout" position in the document flow.
|
|
5
5
|
*
|
|
6
6
|
* Used by ScrollTrigger and MarkerManager to compute trigger positions and
|
|
7
7
|
* marker placements relative to the element's original layout position,
|
|
8
|
-
* regardless of any animation transforms currently applied.
|
|
8
|
+
* regardless of any animation transforms or pin states currently applied.
|
|
9
|
+
*
|
|
10
|
+
* Handles position:fixed elements: a fixed element returns viewport-relative
|
|
11
|
+
* coordinates from getBoundingClientRect(), which would produce incorrect
|
|
12
|
+
* document-relative trigger positions. Temporarily clearing position/top/left/width
|
|
13
|
+
* restores document-flow measurement before reading the rect.
|
|
9
14
|
*/
|
|
10
15
|
export declare function getLayoutRect(element: Element): DOMRect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motion.page/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "High-performance CSS animation SDK with scroll, hover, gesture, and cursor triggers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,11 +43,6 @@
|
|
|
43
43
|
],
|
|
44
44
|
"author": "Motion.page",
|
|
45
45
|
"license": "SEE LICENSE IN LICENSE",
|
|
46
|
-
"repository": {
|
|
47
|
-
"type": "git",
|
|
48
|
-
"url": "https://github.com/nicDamours/motion.page",
|
|
49
|
-
"directory": "packages/sdk"
|
|
50
|
-
},
|
|
51
46
|
"homepage": "https://motion.page",
|
|
52
47
|
"engines": {
|
|
53
48
|
"node": ">=18"
|