react-transition-state 2.1.2 → 2.1.3

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
@@ -92,8 +92,6 @@ const useTransition = ({
92
92
  return [state, toggle, endTransition];
93
93
  };
94
94
 
95
- const initialStateMap = new Map();
96
- const initialConfigMap = new Map();
97
95
  const updateState = (key, status, setStateMap, latestStateMap, timeoutId, onChange) => {
98
96
  clearTimeout(timeoutId);
99
97
  const state = getState(status);
@@ -118,9 +116,9 @@ const useTransitionMap = ({
118
116
  unmountOnExit,
119
117
  onStateChange: onChange
120
118
  } = {}) => {
121
- const [stateMap, setStateMap] = react.useState(initialStateMap);
119
+ const [stateMap, setStateMap] = react.useState(new Map());
122
120
  const latestStateMap = react.useRef(stateMap);
123
- const configMap = react.useRef(initialConfigMap);
121
+ const configMap = react.useRef(new Map());
124
122
  const [enterTimeout, exitTimeout] = getTimeout(timeout);
125
123
  const setItem = react.useCallback((key, config) => {
126
124
  const {
@@ -1,5 +1,5 @@
1
1
  import { useState, useRef, useCallback, useEffect } from 'react';
2
- import { getState, ENTERED, startOrEnd, getEndStatus, PRE_EXIT, EXITING, getTimeout, nextTick, PRE_ENTER, ENTERING } from './utils.js';
2
+ import { getState, ENTERED, startOrEnd, getTimeout, getEndStatus, PRE_EXIT, nextTick, PRE_ENTER, EXITING, ENTERING } from './utils.js';
3
3
 
4
4
  const updateState = (status, setState, latestState, timeoutId, onChange) => {
5
5
  clearTimeout(timeoutId.current);
@@ -1,8 +1,6 @@
1
1
  import { useState, useRef, useCallback } from 'react';
2
- import { ENTERED, startOrEnd, getEndStatus, PRE_EXIT, EXITING, getTimeout, nextTick, PRE_ENTER, ENTERING, getState } from './utils.js';
2
+ import { getTimeout, getEndStatus, PRE_EXIT, nextTick, PRE_ENTER, EXITING, ENTERING, ENTERED, startOrEnd, getState } from './utils.js';
3
3
 
4
- const initialStateMap = new Map();
5
- const initialConfigMap = new Map();
6
4
  const updateState = (key, status, setStateMap, latestStateMap, timeoutId, onChange) => {
7
5
  clearTimeout(timeoutId);
8
6
  const state = getState(status);
@@ -27,9 +25,9 @@ const useTransitionMap = ({
27
25
  unmountOnExit,
28
26
  onStateChange: onChange
29
27
  } = {}) => {
30
- const [stateMap, setStateMap] = useState(initialStateMap);
28
+ const [stateMap, setStateMap] = useState(new Map());
31
29
  const latestStateMap = useRef(stateMap);
32
- const configMap = useRef(initialConfigMap);
30
+ const configMap = useRef(new Map());
33
31
  const [enterTimeout, exitTimeout] = getTimeout(timeout);
34
32
  const setItem = useCallback((key, config) => {
35
33
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-transition-state",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Zero dependency React transition state machine.",
5
5
  "author": "Zheng Song",
6
6
  "license": "MIT",
@@ -40,28 +40,28 @@
40
40
  "react-dom": ">=16.8.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/core": "^7.25.2",
44
- "@babel/preset-env": "^7.25.3",
43
+ "@babel/core": "^7.25.7",
44
+ "@babel/preset-env": "^7.25.4",
45
45
  "@eslint/compat": "^1.1.1",
46
46
  "@rollup/plugin-babel": "^6.0.4",
47
- "@testing-library/react": "^16.0.0",
48
- "@types/jest": "^29.5.12",
47
+ "@testing-library/react": "^16.0.1",
48
+ "@types/jest": "^29.5.13",
49
49
  "babel-plugin-pure-annotations": "^0.1.2",
50
- "eslint": "^9.9.0",
50
+ "eslint": "^9.9.1",
51
51
  "eslint-config-prettier": "^9.1.0",
52
- "eslint-plugin-jest": "^28.8.0",
53
- "eslint-plugin-react": "^7.35.0",
52
+ "eslint-plugin-jest": "^28.8.3",
53
+ "eslint-plugin-react": "^7.37.1",
54
54
  "eslint-plugin-react-hooks": "^4.6.2",
55
55
  "eslint-plugin-react-hooks-addons": "^0.3.1",
56
- "globals": "^15.9.0",
56
+ "globals": "^15.10.0",
57
57
  "jest": "^29.7.0",
58
58
  "jest-environment-jsdom": "^29.7.0",
59
59
  "npm-run-all": "^4.1.5",
60
60
  "prettier": "^3.3.3",
61
61
  "react": "^18.3.1",
62
62
  "react-dom": "^18.3.1",
63
- "rollup": "^4.20.0",
64
- "typescript": "^5.5.4"
63
+ "rollup": "^4.24.0",
64
+ "typescript": "^5.6.2"
65
65
  },
66
66
  "overrides": {
67
67
  "eslint-plugin-react-hooks": {