@tamagui/animate-presence 2.7.7 → 3.0.0-beta.643.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/dist/cjs/AnimatePresence.cjs +102 -128
- package/dist/cjs/AnimatePresence.native.cjs +135 -0
- package/dist/cjs/AnimatePresence.native.js +112 -141
- package/dist/cjs/AnimatePresence.native.js.map +1 -1
- package/dist/cjs/LayoutGroupContext.cjs +18 -26
- package/dist/cjs/LayoutGroupContext.native.cjs +34 -0
- package/dist/cjs/LayoutGroupContext.native.js +19 -26
- package/dist/cjs/LayoutGroupContext.native.js.map +1 -1
- package/dist/cjs/PresenceChild.cjs +61 -81
- package/dist/cjs/PresenceChild.native.cjs +105 -0
- package/dist/cjs/PresenceChild.native.js +83 -104
- package/dist/cjs/PresenceChild.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +24 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/AnimatePresence.mjs +90 -112
- package/dist/esm/AnimatePresence.mjs.map +1 -1
- package/dist/esm/AnimatePresence.native.js +100 -126
- package/dist/esm/AnimatePresence.native.js.map +1 -1
- package/dist/esm/LayoutGroupContext.mjs +2 -0
- package/dist/esm/LayoutGroupContext.mjs.map +1 -1
- package/dist/esm/LayoutGroupContext.native.js +3 -1
- package/dist/esm/LayoutGroupContext.native.js.map +1 -1
- package/dist/esm/PresenceChild.mjs +45 -55
- package/dist/esm/PresenceChild.mjs.map +1 -1
- package/dist/esm/PresenceChild.native.js +68 -80
- package/dist/esm/PresenceChild.native.js.map +1 -1
- package/dist/esm/index.js +7 -5
- package/dist/esm/index.mjs +7 -5
- package/dist/esm/index.native.js +7 -5
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/package.json +8 -8
- package/src/AnimatePresence.tsx +3 -25
- package/src/PresenceChild.tsx +1 -10
- package/src/types.ts +0 -24
- package/types/AnimatePresence.d.ts.map +1 -1
- package/types/PresenceChild.d.ts +1 -4
- package/types/PresenceChild.d.ts.map +1 -1
- package/types/types.d.ts +0 -20
- package/types/types.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5,97 +6,76 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
30
26
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
28
|
var PresenceChild_exports = {};
|
|
35
|
-
__export(PresenceChild_exports, {
|
|
36
|
-
PresenceChild: () => PresenceChild
|
|
37
|
-
});
|
|
29
|
+
__export(PresenceChild_exports, { PresenceChild: () => PresenceChild });
|
|
38
30
|
module.exports = __toCommonJS(PresenceChild_exports);
|
|
39
31
|
var import_use_constant = require("@tamagui/use-constant");
|
|
40
32
|
var import_use_presence = require("@tamagui/use-presence");
|
|
41
33
|
var React = __toESM(require("react"), 1);
|
|
42
34
|
var import_react = require("react");
|
|
43
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
const PresenceChild = React.memo(({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
});
|
|
36
|
+
const PresenceChild = React.memo(({ children, initial, isPresent, onExitComplete, presenceAffectsLayout, custom }) => {
|
|
37
|
+
const presenceChildren = (0, import_use_constant.useConstant)(newChildrenMap);
|
|
38
|
+
const id = (0, import_react.useId)() || "";
|
|
39
|
+
const context = React.useMemo(
|
|
40
|
+
() => {
|
|
41
|
+
return {
|
|
42
|
+
id,
|
|
43
|
+
initial,
|
|
44
|
+
isPresent,
|
|
45
|
+
custom,
|
|
46
|
+
onExitComplete: () => {
|
|
47
|
+
presenceChildren.set(id, true);
|
|
48
|
+
for (const isComplete of presenceChildren.values()) {
|
|
49
|
+
if (!isComplete) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
onExitComplete?.();
|
|
54
|
+
},
|
|
55
|
+
register: () => {
|
|
56
|
+
presenceChildren.set(id, false);
|
|
57
|
+
return () => presenceChildren.delete(id);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* If the presence of a child affects the layout of the components around it,
|
|
63
|
+
* we want to make a new context value to ensure they get re-rendered
|
|
64
|
+
* so they can detect that layout change.
|
|
65
|
+
*/
|
|
66
|
+
presenceAffectsLayout ? void 0 : [isPresent, custom]
|
|
67
|
+
);
|
|
68
|
+
React.useMemo(() => {
|
|
69
|
+
presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
|
|
70
|
+
}, [isPresent]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
!isPresent && !presenceChildren.size && onExitComplete?.();
|
|
73
|
+
}, [isPresent]);
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_use_presence.PresenceContext.Provider, {
|
|
75
|
+
value: context,
|
|
76
|
+
children
|
|
77
|
+
});
|
|
98
78
|
});
|
|
99
79
|
function newChildrenMap() {
|
|
100
|
-
|
|
101
|
-
}
|
|
80
|
+
return /* @__PURE__ */ new Map();
|
|
81
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var PresenceChild_exports = {};
|
|
31
|
+
__export(PresenceChild_exports, { PresenceChild: () => PresenceChild });
|
|
32
|
+
module.exports = __toCommonJS(PresenceChild_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_use_constant = require("@tamagui/use-constant");
|
|
35
|
+
var import_use_presence = require("@tamagui/use-presence");
|
|
36
|
+
var React = __toESM(require("react"), 1);
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var PresenceChild = /* @__PURE__ */ React.memo(function(param) {
|
|
39
|
+
var { children, initial, isPresent, onExitComplete, presenceAffectsLayout, custom } = param;
|
|
40
|
+
var presenceChildren = (0, import_use_constant.useConstant)(newChildrenMap);
|
|
41
|
+
var id = (0, import_react.useId)() || "";
|
|
42
|
+
var context = React.useMemo(
|
|
43
|
+
function() {
|
|
44
|
+
return {
|
|
45
|
+
id,
|
|
46
|
+
initial,
|
|
47
|
+
isPresent,
|
|
48
|
+
custom,
|
|
49
|
+
onExitComplete: function() {
|
|
50
|
+
presenceChildren.set(id, true);
|
|
51
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
52
|
+
try {
|
|
53
|
+
for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
54
|
+
var isComplete = _step.value;
|
|
55
|
+
if (!isComplete) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_didIteratorError = true;
|
|
61
|
+
_iteratorError = err;
|
|
62
|
+
} finally {
|
|
63
|
+
try {
|
|
64
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
65
|
+
_iterator.return();
|
|
66
|
+
}
|
|
67
|
+
} finally {
|
|
68
|
+
if (_didIteratorError) {
|
|
69
|
+
throw _iteratorError;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete();
|
|
74
|
+
},
|
|
75
|
+
register: function() {
|
|
76
|
+
presenceChildren.set(id, false);
|
|
77
|
+
return function() {
|
|
78
|
+
return presenceChildren.delete(id);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* If the presence of a child affects the layout of the components around it,
|
|
85
|
+
* we want to make a new context value to ensure they get re-rendered
|
|
86
|
+
* so they can detect that layout change.
|
|
87
|
+
*/
|
|
88
|
+
presenceAffectsLayout ? void 0 : [isPresent, custom]
|
|
89
|
+
);
|
|
90
|
+
React.useMemo(function() {
|
|
91
|
+
presenceChildren.forEach(function(_, key) {
|
|
92
|
+
return presenceChildren.set(key, false);
|
|
93
|
+
});
|
|
94
|
+
}, [isPresent]);
|
|
95
|
+
React.useEffect(function() {
|
|
96
|
+
!isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());
|
|
97
|
+
}, [isPresent]);
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_use_presence.PresenceContext.Provider, {
|
|
99
|
+
value: context,
|
|
100
|
+
children
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
function newChildrenMap() {
|
|
104
|
+
return /* @__PURE__ */ new Map();
|
|
105
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -7,122 +8,100 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
10
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
14
15
|
};
|
|
15
16
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
23
24
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
32
28
|
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
30
|
var PresenceChild_exports = {};
|
|
37
|
-
__export(PresenceChild_exports, {
|
|
38
|
-
PresenceChild: () => PresenceChild
|
|
39
|
-
});
|
|
31
|
+
__export(PresenceChild_exports, { PresenceChild: () => PresenceChild });
|
|
40
32
|
module.exports = __toCommonJS(PresenceChild_exports);
|
|
41
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
34
|
var import_use_constant = require("@tamagui/use-constant");
|
|
43
35
|
var import_use_presence = require("@tamagui/use-presence");
|
|
44
36
|
var React = __toESM(require("react"), 1);
|
|
45
37
|
var import_react = require("react");
|
|
46
|
-
var PresenceChild = /* @__PURE__ */React.memo(function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// @ts-expect-error its ok
|
|
111
|
-
presenceAffectsLayout ? void 0 : [isPresent, exitVariant, enterVariant]);
|
|
112
|
-
React.useMemo(function () {
|
|
113
|
-
presenceChildren.forEach(function (_, key) {
|
|
114
|
-
return presenceChildren.set(key, false);
|
|
115
|
-
});
|
|
116
|
-
}, [isPresent]);
|
|
117
|
-
React.useEffect(function () {
|
|
118
|
-
!isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());
|
|
119
|
-
}, [isPresent]);
|
|
120
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_use_presence.PresenceContext.Provider, {
|
|
121
|
-
value: context,
|
|
122
|
-
children
|
|
123
|
-
});
|
|
38
|
+
var PresenceChild = /* @__PURE__ */ React.memo(function(param) {
|
|
39
|
+
var { children, initial, isPresent, onExitComplete, presenceAffectsLayout, custom } = param;
|
|
40
|
+
var presenceChildren = (0, import_use_constant.useConstant)(newChildrenMap);
|
|
41
|
+
var id = (0, import_react.useId)() || "";
|
|
42
|
+
var context = React.useMemo(
|
|
43
|
+
function() {
|
|
44
|
+
return {
|
|
45
|
+
id,
|
|
46
|
+
initial,
|
|
47
|
+
isPresent,
|
|
48
|
+
custom,
|
|
49
|
+
onExitComplete: function() {
|
|
50
|
+
presenceChildren.set(id, true);
|
|
51
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
52
|
+
try {
|
|
53
|
+
for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
54
|
+
var isComplete = _step.value;
|
|
55
|
+
if (!isComplete) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (err) {
|
|
60
|
+
_didIteratorError = true;
|
|
61
|
+
_iteratorError = err;
|
|
62
|
+
} finally {
|
|
63
|
+
try {
|
|
64
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
65
|
+
_iterator.return();
|
|
66
|
+
}
|
|
67
|
+
} finally {
|
|
68
|
+
if (_didIteratorError) {
|
|
69
|
+
throw _iteratorError;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete();
|
|
74
|
+
},
|
|
75
|
+
register: function() {
|
|
76
|
+
presenceChildren.set(id, false);
|
|
77
|
+
return function() {
|
|
78
|
+
return presenceChildren.delete(id);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* If the presence of a child affects the layout of the components around it,
|
|
85
|
+
* we want to make a new context value to ensure they get re-rendered
|
|
86
|
+
* so they can detect that layout change.
|
|
87
|
+
*/
|
|
88
|
+
presenceAffectsLayout ? void 0 : [isPresent, custom]
|
|
89
|
+
);
|
|
90
|
+
React.useMemo(function() {
|
|
91
|
+
presenceChildren.forEach(function(_, key) {
|
|
92
|
+
return presenceChildren.set(key, false);
|
|
93
|
+
});
|
|
94
|
+
}, [isPresent]);
|
|
95
|
+
React.useEffect(function() {
|
|
96
|
+
!isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());
|
|
97
|
+
}, [isPresent]);
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_use_presence.PresenceContext.Provider, {
|
|
99
|
+
value: context,
|
|
100
|
+
children
|
|
101
|
+
});
|
|
124
102
|
});
|
|
125
103
|
function newChildrenMap() {
|
|
126
|
-
|
|
104
|
+
return /* @__PURE__ */ new Map();
|
|
127
105
|
}
|
|
106
|
+
|
|
128
107
|
//# sourceMappingURL=PresenceChild.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"PresenceChild.native.js","names":[],"sources":["cjs/PresenceChild.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar PresenceChild_exports = {};\n__export(PresenceChild_exports, {\n PresenceChild: () => PresenceChild\n});\nmodule.exports = __toCommonJS(PresenceChild_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_use_constant = require(\"@tamagui/use-constant\");\nvar import_use_presence = require(\"@tamagui/use-presence\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_react = require(\"react\");\nvar PresenceChild = /* @__PURE__ */ React.memo(function(param) {\n var { children, initial, isPresent, onExitComplete, presenceAffectsLayout, custom } = param;\n var presenceChildren = (0, import_use_constant.useConstant)(newChildrenMap);\n var id = (0, import_react.useId)() || \"\";\n var context = React.useMemo(\n function() {\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: function() {\n presenceChildren.set(id, true);\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = presenceChildren.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var isComplete = _step.value;\n if (!isComplete) {\n return;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete();\n },\n register: function() {\n presenceChildren.set(id, false);\n return function() {\n return presenceChildren.delete(id);\n };\n }\n };\n },\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n // @ts-expect-error its ok\n presenceAffectsLayout ? void 0 : [\n isPresent,\n custom\n ]\n );\n React.useMemo(function() {\n presenceChildren.forEach(function(_, key) {\n return presenceChildren.set(key, false);\n });\n }, [\n isPresent\n ]);\n React.useEffect(function() {\n !isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());\n }, [\n isPresent\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_use_presence.PresenceContext.Provider, {\n value: context,\n children\n });\n});\nfunction newChildrenMap() {\n return /* @__PURE__ */ new Map();\n}\n//# sourceMappingURL=PresenceChild.js.map\n"],"mappings":";;;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;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iBAAiB;CACxB,uBAAuB,IAAI,IAAI;AACjC"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
15
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
16
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
17
|
var index_exports = {};
|
|
19
18
|
module.exports = __toCommonJS(index_exports);
|
|
20
19
|
__reExport(index_exports, require("./AnimatePresence.cjs"), module.exports);
|
|
21
20
|
__reExport(index_exports, require("@tamagui/use-presence"), module.exports);
|
|
22
21
|
__reExport(index_exports, require("./types.cjs"), module.exports);
|
|
23
|
-
__reExport(index_exports, require("./PresenceChild.cjs"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("./PresenceChild.cjs"), module.exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(index_exports);
|
|
21
|
+
__reExport(index_exports, require("./AnimatePresence.native.js"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("@tamagui/use-presence"), module.exports);
|
|
23
|
+
__reExport(index_exports, require("./types.native.js"), module.exports);
|
|
24
|
+
__reExport(index_exports, require("./PresenceChild.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
15
16
|
};
|
|
16
17
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
19
|
var index_exports = {};
|
|
21
20
|
module.exports = __toCommonJS(index_exports);
|
|
22
21
|
__reExport(index_exports, require("./AnimatePresence.native.js"), module.exports);
|
|
23
22
|
__reExport(index_exports, require("@tamagui/use-presence"), module.exports);
|
|
24
23
|
__reExport(index_exports, require("./types.native.js"), module.exports);
|
|
25
24
|
__reExport(index_exports, require("./PresenceChild.native.js"), module.exports);
|
|
25
|
+
|
|
26
26
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./AnimatePresence\"), module.exports);\n__reExport(index_exports, require(\"@tamagui/use-presence\"), module.exports);\n__reExport(index_exports, require(\"./types\"), module.exports);\n__reExport(index_exports, require(\"./PresenceChild\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,6BAAmB,GAAG,OAAO,OAAO;AACtE,WAAW,eAAe,QAAQ,uBAAuB,GAAG,OAAO,OAAO;AAC1E,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO;AAC5D,WAAW,eAAe,QAAQ,2BAAiB,GAAG,OAAO,OAAO"}
|