@hanzogui/animate-presence 2.0.0-rc.41-hanzoai.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/LICENSE +21 -0
- package/LICENSE.md +9 -0
- package/README.md +1 -0
- package/dist/cjs/AnimatePresence.cjs +149 -0
- package/dist/cjs/AnimatePresence.native.js +166 -0
- package/dist/cjs/AnimatePresence.native.js.map +1 -0
- package/dist/cjs/LayoutGroupContext.cjs +40 -0
- package/dist/cjs/LayoutGroupContext.native.js +43 -0
- package/dist/cjs/LayoutGroupContext.native.js.map +1 -0
- package/dist/cjs/PresenceChild.cjs +101 -0
- package/dist/cjs/PresenceChild.native.js +128 -0
- package/dist/cjs/PresenceChild.native.js.map +1 -0
- package/dist/cjs/index.cjs +23 -0
- package/dist/cjs/index.native.js +26 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/esm/AnimatePresence.mjs +124 -0
- package/dist/esm/AnimatePresence.mjs.map +1 -0
- package/dist/esm/AnimatePresence.native.js +138 -0
- package/dist/esm/AnimatePresence.native.js.map +1 -0
- package/dist/esm/LayoutGroupContext.mjs +4 -0
- package/dist/esm/LayoutGroupContext.mjs.map +1 -0
- package/dist/esm/LayoutGroupContext.native.js +4 -0
- package/dist/esm/LayoutGroupContext.native.js.map +1 -0
- package/dist/esm/PresenceChild.mjs +65 -0
- package/dist/esm/PresenceChild.mjs.map +1 -0
- package/dist/esm/PresenceChild.native.js +89 -0
- package/dist/esm/PresenceChild.native.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +5 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/package.json +55 -0
- package/src/AnimatePresence.tsx +219 -0
- package/src/LayoutGroupContext.tsx +8 -0
- package/src/PresenceChild.tsx +90 -0
- package/src/index.ts +4 -0
- package/src/types.ts +107 -0
- package/types/AnimatePresence.d.ts +4 -0
- package/types/AnimatePresence.d.ts.map +1 -0
- package/types/LayoutGroupContext.d.ts +7 -0
- package/types/LayoutGroupContext.d.ts.map +1 -0
- package/types/PresenceChild.d.ts +16 -0
- package/types/PresenceChild.d.ts.map +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.d.ts.map +1 -0
- package/types/types.d.ts +96 -0
- package/types/types.d.ts.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nate Wienert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Framer B.V.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Much of this is taken from framer-motion.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var AnimatePresence_exports = {};
|
|
24
|
+
__export(AnimatePresence_exports, {
|
|
25
|
+
AnimatePresence: () => AnimatePresence
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(AnimatePresence_exports);
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_use_constant = require("@hanzogui/use-constant");
|
|
30
|
+
var import_use_force_update = require("@hanzogui/use-force-update");
|
|
31
|
+
var import_react2 = require("react");
|
|
32
|
+
var import_LayoutGroupContext = require("./LayoutGroupContext.cjs");
|
|
33
|
+
var import_PresenceChild = require("./PresenceChild.cjs");
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
const getChildKey = child => {
|
|
36
|
+
return child.key || (() => {
|
|
37
|
+
const ct = child.type;
|
|
38
|
+
const defaultName = ct["displayName"] || ct["name"] || "";
|
|
39
|
+
if (ct && typeof ct === "object" && "staticConfig" in ct) {
|
|
40
|
+
return ct.staticConfig.componentName || defaultName;
|
|
41
|
+
}
|
|
42
|
+
return defaultName;
|
|
43
|
+
})();
|
|
44
|
+
};
|
|
45
|
+
function onlyElements(children) {
|
|
46
|
+
const filtered = [];
|
|
47
|
+
import_react2.Children.forEach(children, child => {
|
|
48
|
+
if ((0, import_react2.isValidElement)(child)) filtered.push(child);
|
|
49
|
+
});
|
|
50
|
+
return filtered;
|
|
51
|
+
}
|
|
52
|
+
const AnimatePresence = ({
|
|
53
|
+
children,
|
|
54
|
+
enterVariant,
|
|
55
|
+
exitVariant,
|
|
56
|
+
enterExitVariant,
|
|
57
|
+
initial = true,
|
|
58
|
+
onExitComplete,
|
|
59
|
+
exitBeforeEnter,
|
|
60
|
+
mode,
|
|
61
|
+
presenceAffectsLayout = true,
|
|
62
|
+
custom,
|
|
63
|
+
passThrough
|
|
64
|
+
}) => {
|
|
65
|
+
const effectiveMode = mode ?? (exitBeforeEnter ? "wait" : "sync");
|
|
66
|
+
const presentChildren = (0, import_react2.useMemo)(() => onlyElements(children), [children]);
|
|
67
|
+
const presentKeys = presentChildren.map(getChildKey);
|
|
68
|
+
const isInitialRender = (0, import_react2.useRef)(true);
|
|
69
|
+
const frozenCustomRef = (0, import_react2.useRef)(/* @__PURE__ */new Map());
|
|
70
|
+
const pendingPresentChildren = (0, import_react2.useRef)(presentChildren);
|
|
71
|
+
const exitComplete = (0, import_use_constant.useConstant)(() => /* @__PURE__ */new Map());
|
|
72
|
+
const [diffedChildren, setDiffedChildren] = (0, import_react2.useState)(presentChildren);
|
|
73
|
+
const [renderedChildren, setRenderedChildren] = (0, import_react2.useState)(presentChildren);
|
|
74
|
+
const forceRender = (0, import_react2.useContext)(import_LayoutGroupContext.LayoutGroupContext).forceRender ?? (0, import_use_force_update.useForceUpdate)();
|
|
75
|
+
if (passThrough) {
|
|
76
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
77
|
+
children
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
(0, import_react.useInsertionEffect)(() => {
|
|
81
|
+
isInitialRender.current = false;
|
|
82
|
+
pendingPresentChildren.current = presentChildren;
|
|
83
|
+
for (let i = 0; i < renderedChildren.length; i++) {
|
|
84
|
+
const key = getChildKey(renderedChildren[i]);
|
|
85
|
+
if (!presentKeys.includes(key)) {
|
|
86
|
+
if (exitComplete.get(key) !== true) {
|
|
87
|
+
exitComplete.set(key, false);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
exitComplete.delete(key);
|
|
91
|
+
frozenCustomRef.current.delete(key);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
|
|
95
|
+
if (presentChildren !== diffedChildren) {
|
|
96
|
+
let nextChildren = [...presentChildren];
|
|
97
|
+
for (let i = 0; i < renderedChildren.length; i++) {
|
|
98
|
+
const child = renderedChildren[i];
|
|
99
|
+
const key = getChildKey(child);
|
|
100
|
+
if (!presentKeys.includes(key)) {
|
|
101
|
+
nextChildren.splice(i, 0, child);
|
|
102
|
+
if (!frozenCustomRef.current.has(key)) {
|
|
103
|
+
frozenCustomRef.current.set(key, custom);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const exitingChildren = renderedChildren.filter(child => !presentKeys.includes(getChildKey(child)));
|
|
108
|
+
if (effectiveMode === "wait" && exitingChildren.length) {
|
|
109
|
+
nextChildren = exitingChildren;
|
|
110
|
+
}
|
|
111
|
+
setRenderedChildren(onlyElements(nextChildren));
|
|
112
|
+
setDiffedChildren(presentChildren);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
116
|
+
children: renderedChildren.map(child => {
|
|
117
|
+
const key = getChildKey(child);
|
|
118
|
+
const isPresent = presentChildren === renderedChildren || presentKeys.includes(key);
|
|
119
|
+
const onExit = () => {
|
|
120
|
+
if (exitComplete.has(key)) {
|
|
121
|
+
exitComplete.set(key, true);
|
|
122
|
+
} else {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
let isEveryExitComplete = true;
|
|
126
|
+
exitComplete.forEach(isExitComplete => {
|
|
127
|
+
if (!isExitComplete) isEveryExitComplete = false;
|
|
128
|
+
});
|
|
129
|
+
if (isEveryExitComplete) {
|
|
130
|
+
forceRender?.();
|
|
131
|
+
setRenderedChildren(pendingPresentChildren.current);
|
|
132
|
+
onExitComplete?.();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_PresenceChild.PresenceChild, {
|
|
136
|
+
isPresent,
|
|
137
|
+
initial: !isInitialRender.current || initial ? void 0 : false,
|
|
138
|
+
custom: isPresent ? custom : frozenCustomRef.current.get(key) ?? custom,
|
|
139
|
+
presenceAffectsLayout,
|
|
140
|
+
enterExitVariant,
|
|
141
|
+
enterVariant,
|
|
142
|
+
exitVariant,
|
|
143
|
+
onExitComplete: isPresent ? void 0 : onExit,
|
|
144
|
+
children: child
|
|
145
|
+
}, key);
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
AnimatePresence.displayName = "AnimatePresence";
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var AnimatePresence_exports = {};
|
|
26
|
+
__export(AnimatePresence_exports, {
|
|
27
|
+
AnimatePresence: () => AnimatePresence
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(AnimatePresence_exports);
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_use_constant = require("@hanzogui/use-constant");
|
|
33
|
+
var import_use_force_update = require("@hanzogui/use-force-update");
|
|
34
|
+
var import_react2 = require("react");
|
|
35
|
+
var import_LayoutGroupContext = require("./LayoutGroupContext.native.js");
|
|
36
|
+
var import_PresenceChild = require("./PresenceChild.native.js");
|
|
37
|
+
function _type_of(obj) {
|
|
38
|
+
"@swc/helpers - typeof";
|
|
39
|
+
|
|
40
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
41
|
+
}
|
|
42
|
+
var getChildKey = function (child) {
|
|
43
|
+
return child.key || function () {
|
|
44
|
+
var ct = child.type;
|
|
45
|
+
var defaultName = ct["displayName"] || ct["name"] || "";
|
|
46
|
+
if (ct && (typeof ct === "undefined" ? "undefined" : _type_of(ct)) === "object" && "staticConfig" in ct) {
|
|
47
|
+
return ct.staticConfig.componentName || defaultName;
|
|
48
|
+
}
|
|
49
|
+
return defaultName;
|
|
50
|
+
}();
|
|
51
|
+
};
|
|
52
|
+
function onlyElements(children) {
|
|
53
|
+
var filtered = [];
|
|
54
|
+
import_react2.Children.forEach(children, function (child) {
|
|
55
|
+
if (/* @__PURE__ */(0, import_react2.isValidElement)(child)) filtered.push(child);
|
|
56
|
+
});
|
|
57
|
+
return filtered;
|
|
58
|
+
}
|
|
59
|
+
var AnimatePresence = function (param) {
|
|
60
|
+
var {
|
|
61
|
+
children,
|
|
62
|
+
enterVariant,
|
|
63
|
+
exitVariant,
|
|
64
|
+
enterExitVariant,
|
|
65
|
+
initial = true,
|
|
66
|
+
onExitComplete,
|
|
67
|
+
exitBeforeEnter,
|
|
68
|
+
mode,
|
|
69
|
+
presenceAffectsLayout = true,
|
|
70
|
+
custom,
|
|
71
|
+
passThrough
|
|
72
|
+
} = param;
|
|
73
|
+
var effectiveMode = mode !== null && mode !== void 0 ? mode : exitBeforeEnter ? "wait" : "sync";
|
|
74
|
+
var presentChildren = (0, import_react2.useMemo)(function () {
|
|
75
|
+
return onlyElements(children);
|
|
76
|
+
}, [children]);
|
|
77
|
+
var presentKeys = presentChildren.map(getChildKey);
|
|
78
|
+
var isInitialRender = (0, import_react2.useRef)(true);
|
|
79
|
+
var frozenCustomRef = (0, import_react2.useRef)(/* @__PURE__ */new Map());
|
|
80
|
+
var pendingPresentChildren = (0, import_react2.useRef)(presentChildren);
|
|
81
|
+
var exitComplete = (0, import_use_constant.useConstant)(function () {
|
|
82
|
+
return /* @__PURE__ */new Map();
|
|
83
|
+
});
|
|
84
|
+
var [diffedChildren, setDiffedChildren] = (0, import_react2.useState)(presentChildren);
|
|
85
|
+
var [renderedChildren, setRenderedChildren] = (0, import_react2.useState)(presentChildren);
|
|
86
|
+
var _useContext_forceRender;
|
|
87
|
+
var forceRender = (_useContext_forceRender = (0, import_react2.useContext)(import_LayoutGroupContext.LayoutGroupContext).forceRender) !== null && _useContext_forceRender !== void 0 ? _useContext_forceRender : (0, import_use_force_update.useForceUpdate)();
|
|
88
|
+
if (passThrough) {
|
|
89
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
90
|
+
children
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
(0, import_react.useInsertionEffect)(function () {
|
|
94
|
+
isInitialRender.current = false;
|
|
95
|
+
pendingPresentChildren.current = presentChildren;
|
|
96
|
+
for (var i2 = 0; i2 < renderedChildren.length; i2++) {
|
|
97
|
+
var key2 = getChildKey(renderedChildren[i2]);
|
|
98
|
+
if (!presentKeys.includes(key2)) {
|
|
99
|
+
if (exitComplete.get(key2) !== true) {
|
|
100
|
+
exitComplete.set(key2, false);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
exitComplete.delete(key2);
|
|
104
|
+
frozenCustomRef.current.delete(key2);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
|
|
108
|
+
if (presentChildren !== diffedChildren) {
|
|
109
|
+
var nextChildren = [...presentChildren];
|
|
110
|
+
for (var i = 0; i < renderedChildren.length; i++) {
|
|
111
|
+
var child = renderedChildren[i];
|
|
112
|
+
var key = getChildKey(child);
|
|
113
|
+
if (!presentKeys.includes(key)) {
|
|
114
|
+
nextChildren.splice(i, 0, child);
|
|
115
|
+
if (!frozenCustomRef.current.has(key)) {
|
|
116
|
+
frozenCustomRef.current.set(key, custom);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
var exitingChildren = renderedChildren.filter(function (child2) {
|
|
121
|
+
return !presentKeys.includes(getChildKey(child2));
|
|
122
|
+
});
|
|
123
|
+
if (effectiveMode === "wait" && exitingChildren.length) {
|
|
124
|
+
nextChildren = exitingChildren;
|
|
125
|
+
}
|
|
126
|
+
setRenderedChildren(onlyElements(nextChildren));
|
|
127
|
+
setDiffedChildren(presentChildren);
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
131
|
+
children: renderedChildren.map(function (child2) {
|
|
132
|
+
var key2 = getChildKey(child2);
|
|
133
|
+
var isPresent = presentChildren === renderedChildren || presentKeys.includes(key2);
|
|
134
|
+
var onExit = function () {
|
|
135
|
+
if (exitComplete.has(key2)) {
|
|
136
|
+
exitComplete.set(key2, true);
|
|
137
|
+
} else {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
var isEveryExitComplete = true;
|
|
141
|
+
exitComplete.forEach(function (isExitComplete) {
|
|
142
|
+
if (!isExitComplete) isEveryExitComplete = false;
|
|
143
|
+
});
|
|
144
|
+
if (isEveryExitComplete) {
|
|
145
|
+
forceRender === null || forceRender === void 0 ? void 0 : forceRender();
|
|
146
|
+
setRenderedChildren(pendingPresentChildren.current);
|
|
147
|
+
onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var _frozenCustomRef_current_get;
|
|
151
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_PresenceChild.PresenceChild, {
|
|
152
|
+
isPresent,
|
|
153
|
+
initial: !isInitialRender.current || initial ? void 0 : false,
|
|
154
|
+
custom: isPresent ? custom : (_frozenCustomRef_current_get = frozenCustomRef.current.get(key2)) !== null && _frozenCustomRef_current_get !== void 0 ? _frozenCustomRef_current_get : custom,
|
|
155
|
+
presenceAffectsLayout,
|
|
156
|
+
enterExitVariant,
|
|
157
|
+
enterVariant,
|
|
158
|
+
exitVariant,
|
|
159
|
+
onExitComplete: isPresent ? void 0 : onExit,
|
|
160
|
+
children: child2
|
|
161
|
+
}, key2);
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
AnimatePresence.displayName = "AnimatePresence";
|
|
166
|
+
//# sourceMappingURL=AnimatePresence.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","AnimatePresence_exports","__export","AnimatePresence","module","exports","import_jsx_runtime","require","import_react","import_use_constant","import_use_force_update","import_react2","import_LayoutGroupContext","import_PresenceChild","_type_of","obj","Symbol","constructor","getChildKey","child","key","ct","type","defaultName","staticConfig","componentName","onlyElements","children","filtered","Children","forEach","isValidElement","push","param","enterVariant","exitVariant","enterExitVariant","initial","onExitComplete","exitBeforeEnter","mode","presenceAffectsLayout","custom","passThrough","effectiveMode","presentChildren","useMemo","presentKeys","map","isInitialRender","useRef","frozenCustomRef","Map","pendingPresentChildren","exitComplete","useConstant","diffedChildren","setDiffedChildren","useState","renderedChildren","setRenderedChildren","_useContext_forceRender","forceRender","useContext","LayoutGroupContext","useForceUpdate","jsx","Fragment","useInsertionEffect","current","i2","length","key2","includes","get","set","delete","join","nextChildren","i","splice","has","exitingChildren","filter","child2","isPresent","onExit","isEveryExitComplete","isExitComplete","_frozenCustomRef_current_get","PresenceChild"],"sources":["../../src/AnimatePresence.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAmC,CAAAK,uBAAA;AACnC,IAAAK,kBAAA,GAAAC,OAA4B;AAC5B,IAAAC,YAAA,GAAAD,OAAA,QAA+B;AAE/B,IAAAE,mBAAgF,GAAAF,OAAA;AAChF,IAAAG,uBAAA,GAAAH,OAAmC;AACnC,IAAAI,aAAA,GAAAJ,OAA8B;AAiGnB,IAAAK,yBAAA,GAAAL,OAAA;AA5FX,IAAAM,oBAAqB,GAAAN,OAA2C;AAC9D,SACEO,QAAMA,CAAAC,GAAA,EACL;EAEC,uBAAiB;;EACjB,OAAAA,GAAM,WAAAC,MAAiB,gBAAkB,IAAGD,GAAA,CAAAE,WAAW,KAAAD,MAAA,qBAAAD,GAAA;AACvD;AAEE,IAAAG,WAAO,GAAG,SAAAA,CAAAC,KAAa;EAAiB,OAC1CA,KAAA,CAAAC,GAAA;IACA,IAAAC,EAAA,GAAOF,KAAA,CAAAG,IAAA;IACT,IAAGC,WAAA,GAAAF,EAAA,mBAAAA,EAAA;IAEP,IAAAA,EAAA,YAAAA,EAAA,iCAAAP,QAAA,CAAAO,EAAA,qCAAAA,EAAA;MAEA,OAASA,EAAA,CAAAG,YAAa,CAAAC,aAA0C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,oBAAA,CAAA6E,aAAA;QAAAL,SAAA;QAVIhD,OAAA,GAAAY,eAAA,CAAAoB,OAAA,IAAAhC,OAAA;QAWPK,MAAA,EAAA2C,SAAA,GAAA3C,MAAA,IAAA+C,4BAAA,GAAAtC,eAAA,CAAAkB,OAAA,CAAAK,GAAA,CAAAF,IAAA,eAAAiB,4BAAA,cAAAA,4BAAA,GAAA/C,MAAA;QAGND,qBAAA;QAEJL,gBAAA;QAEAF,YAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
34
|
+
var LayoutGroupContext_exports = {};
|
|
35
|
+
__export(LayoutGroupContext_exports, {
|
|
36
|
+
LayoutGroupContext: () => LayoutGroupContext
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(LayoutGroupContext_exports);
|
|
39
|
+
var import_react = __toESM(require("react"), 1);
|
|
40
|
+
const LayoutGroupContext = import_react.default.createContext({});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
36
|
+
var LayoutGroupContext_exports = {};
|
|
37
|
+
__export(LayoutGroupContext_exports, {
|
|
38
|
+
LayoutGroupContext: () => LayoutGroupContext
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(LayoutGroupContext_exports);
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
var LayoutGroupContext = /* @__PURE__ */import_react.default.createContext({});
|
|
43
|
+
//# sourceMappingURL=LayoutGroupContext.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","LayoutGroupContext_exports","__export","LayoutGroupContext","module","exports","import_react","__toESM","require"],"sources":["../../src/LayoutGroupContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,0BAAA;AAOX,IAAAK,YAAM,GAAAC,OAAA,CAAqBC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
34
|
+
var PresenceChild_exports = {};
|
|
35
|
+
__export(PresenceChild_exports, {
|
|
36
|
+
PresenceChild: () => PresenceChild
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(PresenceChild_exports);
|
|
39
|
+
var import_use_constant = require("@hanzogui/use-constant");
|
|
40
|
+
var import_use_presence = require("@hanzogui/use-presence");
|
|
41
|
+
var React = __toESM(require("react"), 1);
|
|
42
|
+
var import_react = require("react");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
const PresenceChild = React.memo(({
|
|
45
|
+
children,
|
|
46
|
+
initial,
|
|
47
|
+
isPresent,
|
|
48
|
+
onExitComplete,
|
|
49
|
+
exitVariant,
|
|
50
|
+
enterVariant,
|
|
51
|
+
enterExitVariant,
|
|
52
|
+
presenceAffectsLayout,
|
|
53
|
+
custom
|
|
54
|
+
}) => {
|
|
55
|
+
const presenceChildren = (0, import_use_constant.useConstant)(newChildrenMap);
|
|
56
|
+
const id = (0, import_react.useId)() || "";
|
|
57
|
+
const context = React.useMemo(() => {
|
|
58
|
+
return {
|
|
59
|
+
id,
|
|
60
|
+
initial,
|
|
61
|
+
isPresent,
|
|
62
|
+
custom,
|
|
63
|
+
exitVariant,
|
|
64
|
+
enterVariant,
|
|
65
|
+
enterExitVariant,
|
|
66
|
+
onExitComplete: () => {
|
|
67
|
+
presenceChildren.set(id, true);
|
|
68
|
+
for (const isComplete of presenceChildren.values()) {
|
|
69
|
+
if (!isComplete) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
onExitComplete?.();
|
|
74
|
+
},
|
|
75
|
+
register: () => {
|
|
76
|
+
presenceChildren.set(id, false);
|
|
77
|
+
return () => presenceChildren.delete(id);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* If the presence of a child affects the layout of the components around it,
|
|
83
|
+
* we want to make a new context value to ensure they get re-rendered
|
|
84
|
+
* so they can detect that layout change.
|
|
85
|
+
*/
|
|
86
|
+
// @ts-expect-error its ok
|
|
87
|
+
presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
|
|
88
|
+
React.useMemo(() => {
|
|
89
|
+
presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
|
|
90
|
+
}, [isPresent]);
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
!isPresent && !presenceChildren.size && onExitComplete?.();
|
|
93
|
+
}, [isPresent]);
|
|
94
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_use_presence.PresenceContext.Provider, {
|
|
95
|
+
value: context,
|
|
96
|
+
children
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
function newChildrenMap() {
|
|
100
|
+
return /* @__PURE__ */new Map();
|
|
101
|
+
}
|