page-transition 0.1.0-beta.25 → 0.1.0-beta.26
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/hooks/usePopState.js +14 -2
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
19
19
|
const removeEnter = useTransitionEndObj({
|
|
20
20
|
transitionEndData,
|
|
21
21
|
fn: () => {
|
|
22
|
+
console.log('removeEnter transitionEnd');
|
|
22
23
|
container.current?.classList.remove('enter');
|
|
23
24
|
state.current = 'idle';
|
|
24
25
|
reverse.current.lock = true;
|
|
@@ -27,6 +28,7 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
27
28
|
const afterExit = useTransitionEndObj({
|
|
28
29
|
transitionEndData,
|
|
29
30
|
fn: afterExitFn.current = () => {
|
|
31
|
+
console.log('afterExit transitionEnd');
|
|
30
32
|
transitionEnd({
|
|
31
33
|
transitionEndObj: removeEnter,
|
|
32
34
|
transitionEndHandler,
|
|
@@ -52,6 +54,7 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
52
54
|
const pop = useTransitionEndObj({
|
|
53
55
|
transitionEndData,
|
|
54
56
|
fn: () => {
|
|
57
|
+
console.log('pop transitionEnd');
|
|
55
58
|
state.current = 'navigating';
|
|
56
59
|
window.scrollTo(0, window.history.state.scrollY ?? 0);
|
|
57
60
|
resolveFn.current?.();
|
|
@@ -66,12 +69,15 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
66
69
|
resolveUseFn.current = reject;
|
|
67
70
|
new Promise((resolveNavigating) => {
|
|
68
71
|
if (state.current === "navigating") {
|
|
72
|
+
console.log('navigating');
|
|
69
73
|
if (currentPathname.current !== window.location.pathname) {
|
|
74
|
+
console.log('currentPathname.current !== window.location.pathname');
|
|
70
75
|
resolveFn.current?.();
|
|
71
76
|
setPromise(null);
|
|
72
77
|
return;
|
|
73
78
|
}
|
|
74
79
|
else if (currentPathname.current === window.location.pathname) {
|
|
80
|
+
console.log('currentPathname.current === window.location.pathname');
|
|
75
81
|
afterExitFn.current?.();
|
|
76
82
|
}
|
|
77
83
|
}
|
|
@@ -79,7 +85,9 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
79
85
|
resolveNavigating();
|
|
80
86
|
}
|
|
81
87
|
}).then(() => {
|
|
88
|
+
console.log('not navigating');
|
|
82
89
|
if (currentPathname.current === window.location.pathname) {
|
|
90
|
+
console.log('currentPathname.current === window.location.pathname');
|
|
83
91
|
transitionEnd({
|
|
84
92
|
transitionEndObj: afterExit,
|
|
85
93
|
transitionEndHandler,
|
|
@@ -89,6 +97,7 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
89
97
|
return;
|
|
90
98
|
}
|
|
91
99
|
if (state.current === 'entering') {
|
|
100
|
+
console.log('state.current === entering');
|
|
92
101
|
let elArray = [];
|
|
93
102
|
if (transitionEndData.current.mirror) {
|
|
94
103
|
elArray = [...transitionEndData.current.mirrorElArray, ...transitionEndData.current.elArray];
|
|
@@ -103,14 +112,17 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
103
112
|
transitionProperty: transitionEndData.current.transitionProperty,
|
|
104
113
|
target: 0
|
|
105
114
|
}).then(() => {
|
|
115
|
+
console.log('updatePlaybackRate done');
|
|
106
116
|
transitionEnd({
|
|
107
117
|
transitionEndObj: pop,
|
|
108
118
|
transitionEndHandler,
|
|
109
119
|
reverse,
|
|
110
120
|
delayStep
|
|
111
121
|
});
|
|
122
|
+
console.log('transitionEnd done');
|
|
112
123
|
container.current?.classList.remove('enter');
|
|
113
124
|
container.current?.classList.add('exit');
|
|
125
|
+
console.log('classList done');
|
|
114
126
|
state.current = 'exiting';
|
|
115
127
|
setPlaybackRate({
|
|
116
128
|
elArray,
|
|
@@ -123,8 +135,8 @@ export function usePopState({ container, currentPathname, transitionEndData, tra
|
|
|
123
135
|
elArray,
|
|
124
136
|
transitionProperty: transitionEndData.current.transitionProperty,
|
|
125
137
|
target: 1
|
|
126
|
-
}).catch(() => { });
|
|
127
|
-
}).catch(() => { });
|
|
138
|
+
}).catch(() => { console.log('updatePlaybackRate catch innen'); });
|
|
139
|
+
}).catch(() => { console.log('updatePlaybackRate catch ausen'); });
|
|
128
140
|
return;
|
|
129
141
|
}
|
|
130
142
|
transitionEnd({
|