react-transition-state 2.1.0-alpha.2 → 2.1.1-alpha.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/dist/cjs/index.js
CHANGED
|
@@ -72,7 +72,10 @@ const useTransition = ({
|
|
|
72
72
|
break;
|
|
73
73
|
case PRE_ENTER:
|
|
74
74
|
case PRE_EXIT:
|
|
75
|
-
timeoutId.current = setTimeout(() =>
|
|
75
|
+
timeoutId.current = setTimeout(() => {
|
|
76
|
+
// Reading document.body.offsetTop can force browser to repaint
|
|
77
|
+
isNaN(document.body.offsetTop) || transitState(status + 1);
|
|
78
|
+
}, 0);
|
|
76
79
|
break;
|
|
77
80
|
}
|
|
78
81
|
};
|
|
@@ -166,7 +169,10 @@ const useTransitionMap = ({
|
|
|
166
169
|
break;
|
|
167
170
|
case PRE_ENTER:
|
|
168
171
|
case PRE_EXIT:
|
|
169
|
-
config.timeoutId = setTimeout(() =>
|
|
172
|
+
config.timeoutId = setTimeout(() => {
|
|
173
|
+
// Reading document.body.offsetTop can force browser to repaint
|
|
174
|
+
isNaN(document.body.offsetTop) || transitState(status + 1);
|
|
175
|
+
}, 0);
|
|
170
176
|
break;
|
|
171
177
|
}
|
|
172
178
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
2
|
-
import { getState, ENTERED, startOrEnd,
|
|
2
|
+
import { getState, ENTERED, startOrEnd, getEndStatus, PRE_EXIT, EXITING, getTimeout, PRE_ENTER, ENTERING } from './utils.js';
|
|
3
3
|
|
|
4
4
|
const updateState = (status, setState, latestState, timeoutId, onChange) => {
|
|
5
5
|
clearTimeout(timeoutId.current);
|
|
@@ -41,7 +41,10 @@ const useTransition = ({
|
|
|
41
41
|
break;
|
|
42
42
|
case PRE_ENTER:
|
|
43
43
|
case PRE_EXIT:
|
|
44
|
-
timeoutId.current = setTimeout(() =>
|
|
44
|
+
timeoutId.current = setTimeout(() => {
|
|
45
|
+
// Reading document.body.offsetTop can force browser to repaint
|
|
46
|
+
isNaN(document.body.offsetTop) || transitState(status + 1);
|
|
47
|
+
}, 0);
|
|
45
48
|
break;
|
|
46
49
|
}
|
|
47
50
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef, useCallback } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ENTERED, startOrEnd, getEndStatus, PRE_EXIT, EXITING, getTimeout, PRE_ENTER, ENTERING, getState } from './utils.js';
|
|
3
3
|
|
|
4
4
|
const initialStateMap = new Map();
|
|
5
5
|
const initialConfigMap = new Map();
|
|
@@ -79,7 +79,10 @@ const useTransitionMap = ({
|
|
|
79
79
|
break;
|
|
80
80
|
case PRE_ENTER:
|
|
81
81
|
case PRE_EXIT:
|
|
82
|
-
config.timeoutId = setTimeout(() =>
|
|
82
|
+
config.timeoutId = setTimeout(() => {
|
|
83
|
+
// Reading document.body.offsetTop can force browser to repaint
|
|
84
|
+
isNaN(document.body.offsetTop) || transitState(status + 1);
|
|
85
|
+
}, 0);
|
|
83
86
|
break;
|
|
84
87
|
}
|
|
85
88
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-transition-state",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1-alpha.0",
|
|
4
4
|
"description": "Zero dependency React transition state machine.",
|
|
5
5
|
"author": "Zheng Song",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,25 +41,25 @@
|
|
|
41
41
|
"react-dom": ">=16.8.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@babel/core": "^7.
|
|
45
|
-
"@babel/preset-env": "^7.
|
|
44
|
+
"@babel/core": "^7.22.5",
|
|
45
|
+
"@babel/preset-env": "^7.22.5",
|
|
46
46
|
"@rollup/plugin-babel": "^6.0.3",
|
|
47
|
-
"@testing-library/react": "^
|
|
48
|
-
"@types/jest": "^29.
|
|
47
|
+
"@testing-library/react": "^14.0.0",
|
|
48
|
+
"@types/jest": "^29.5.2",
|
|
49
49
|
"babel-plugin-pure-annotations": "^0.1.2",
|
|
50
50
|
"dtslint": "^4.1.6",
|
|
51
|
-
"eslint": "^8.
|
|
52
|
-
"eslint-config-prettier": "^8.
|
|
51
|
+
"eslint": "^8.41.0",
|
|
52
|
+
"eslint-config-prettier": "^8.8.0",
|
|
53
53
|
"eslint-plugin-jest": "^27.2.1",
|
|
54
54
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
55
|
-
"jest": "^29.
|
|
56
|
-
"jest-environment-jsdom": "^29.
|
|
55
|
+
"jest": "^29.5.0",
|
|
56
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
57
57
|
"npm-run-all": "^4.1.5",
|
|
58
|
-
"prettier": "^2.8.
|
|
58
|
+
"prettier": "^2.8.8",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-dom": "^18.2.0",
|
|
61
61
|
"regenerator-runtime": "^0.13.11",
|
|
62
|
-
"rollup": "^3.
|
|
63
|
-
"typescript": "^
|
|
62
|
+
"rollup": "^3.25.1",
|
|
63
|
+
"typescript": "^5.1.3"
|
|
64
64
|
}
|
|
65
65
|
}
|