@tamagui/animate 2.7.7 → 3.0.0-beta.637.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/Animate.cjs +47 -64
- package/dist/cjs/Animate.native.cjs +63 -0
- package/dist/cjs/Animate.native.js +47 -63
- package/dist/cjs/Animate.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Animate.mjs +34 -46
- package/dist/esm/Animate.mjs.map +1 -1
- package/dist/esm/Animate.native.js +35 -47
- package/dist/esm/Animate.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/package.json +3 -3
- package/src/Animate.tsx +0 -3
- package/types/Animate.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/cjs/Animate.cjs
CHANGED
|
@@ -1,77 +1,60 @@
|
|
|
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 __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var Animate_exports = {};
|
|
24
|
-
__export(Animate_exports, {
|
|
25
|
-
Animate: () => Animate
|
|
26
|
-
});
|
|
23
|
+
__export(Animate_exports, { Animate: () => Animate });
|
|
27
24
|
module.exports = __toCommonJS(Animate_exports);
|
|
28
25
|
var import_animate_presence = require("@tamagui/animate-presence");
|
|
29
26
|
var import_react = require("react");
|
|
30
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
function Animate({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}),
|
|
65
|
-
children
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
69
|
-
passThrough,
|
|
70
|
-
...props,
|
|
71
|
-
children: mounted || passThrough ? children : null
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
75
|
-
children
|
|
76
|
-
});
|
|
77
|
-
}
|
|
28
|
+
function Animate({ children, lazyMount, type, present, passThrough, ...props }) {
|
|
29
|
+
const [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
|
|
30
|
+
(0, import_react.useEffect)(() => {
|
|
31
|
+
if (passThrough) return;
|
|
32
|
+
if (!lazyMount) return;
|
|
33
|
+
if (!present) return;
|
|
34
|
+
(0, import_react.startTransition)(() => {
|
|
35
|
+
setLazyMounted(present);
|
|
36
|
+
});
|
|
37
|
+
}, [lazyMount, present]);
|
|
38
|
+
const mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
39
|
+
if (type === "presence") {
|
|
40
|
+
if (props.keepChildrenMounted) {
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
|
|
42
|
+
isPresent: true,
|
|
43
|
+
...!passThrough && {
|
|
44
|
+
initial: props.initial ? void 0 : false,
|
|
45
|
+
onExitComplete: props.onExitComplete,
|
|
46
|
+
presenceAffectsLayout: false,
|
|
47
|
+
isPresent: present,
|
|
48
|
+
custom: props.custom
|
|
49
|
+
},
|
|
50
|
+
children
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
54
|
+
passThrough,
|
|
55
|
+
...props,
|
|
56
|
+
children: mounted || passThrough ? children : null
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
60
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var Animate_exports = {};
|
|
25
|
+
__export(Animate_exports, { Animate: () => Animate });
|
|
26
|
+
module.exports = __toCommonJS(Animate_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var import_animate_presence = require("@tamagui/animate-presence");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
function Animate(param) {
|
|
31
|
+
var { children, lazyMount, type, present, passThrough, ...props } = param;
|
|
32
|
+
var [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
|
|
33
|
+
(0, import_react.useEffect)(function() {
|
|
34
|
+
if (passThrough) return;
|
|
35
|
+
if (!lazyMount) return;
|
|
36
|
+
if (!present) return;
|
|
37
|
+
(0, import_react.startTransition)(function() {
|
|
38
|
+
setLazyMounted(present);
|
|
39
|
+
});
|
|
40
|
+
}, [lazyMount, present]);
|
|
41
|
+
var mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
42
|
+
if (type === "presence") {
|
|
43
|
+
if (props.keepChildrenMounted) {
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
|
|
45
|
+
isPresent: true,
|
|
46
|
+
...!passThrough && {
|
|
47
|
+
initial: props.initial ? void 0 : false,
|
|
48
|
+
onExitComplete: props.onExitComplete,
|
|
49
|
+
presenceAffectsLayout: false,
|
|
50
|
+
isPresent: present,
|
|
51
|
+
custom: props.custom
|
|
52
|
+
},
|
|
53
|
+
children
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
57
|
+
passThrough,
|
|
58
|
+
...props,
|
|
59
|
+
children: mounted || passThrough ? children : null
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
63
|
+
}
|
|
@@ -1,81 +1,65 @@
|
|
|
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 __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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var Animate_exports = {};
|
|
26
|
-
__export(Animate_exports, {
|
|
27
|
-
Animate: () => Animate
|
|
28
|
-
});
|
|
25
|
+
__export(Animate_exports, { Animate: () => Animate });
|
|
29
26
|
module.exports = __toCommonJS(Animate_exports);
|
|
30
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
28
|
var import_animate_presence = require("@tamagui/animate-presence");
|
|
32
29
|
var import_react = require("react");
|
|
33
30
|
function Animate(param) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
custom: props.custom
|
|
67
|
-
}),
|
|
68
|
-
children
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
72
|
-
passThrough,
|
|
73
|
-
...props,
|
|
74
|
-
children: mounted || passThrough ? children : null
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
78
|
-
children
|
|
79
|
-
});
|
|
31
|
+
var { children, lazyMount, type, present, passThrough, ...props } = param;
|
|
32
|
+
var [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
|
|
33
|
+
(0, import_react.useEffect)(function() {
|
|
34
|
+
if (passThrough) return;
|
|
35
|
+
if (!lazyMount) return;
|
|
36
|
+
if (!present) return;
|
|
37
|
+
(0, import_react.startTransition)(function() {
|
|
38
|
+
setLazyMounted(present);
|
|
39
|
+
});
|
|
40
|
+
}, [lazyMount, present]);
|
|
41
|
+
var mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
42
|
+
if (type === "presence") {
|
|
43
|
+
if (props.keepChildrenMounted) {
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
|
|
45
|
+
isPresent: true,
|
|
46
|
+
...!passThrough && {
|
|
47
|
+
initial: props.initial ? void 0 : false,
|
|
48
|
+
onExitComplete: props.onExitComplete,
|
|
49
|
+
presenceAffectsLayout: false,
|
|
50
|
+
isPresent: present,
|
|
51
|
+
custom: props.custom
|
|
52
|
+
},
|
|
53
|
+
children
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
57
|
+
passThrough,
|
|
58
|
+
...props,
|
|
59
|
+
children: mounted || passThrough ? children : null
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
80
63
|
}
|
|
64
|
+
|
|
81
65
|
//# sourceMappingURL=Animate.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Animate.native.js","names":[],"sources":["cjs/Animate.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Animate_exports = {};\n__export(Animate_exports, {\n Animate: () => Animate\n});\nmodule.exports = __toCommonJS(Animate_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_animate_presence = require(\"@tamagui/animate-presence\");\nvar import_react = require(\"react\");\nfunction Animate(param) {\n var { children, lazyMount, type, present, passThrough, ...props } = param;\n var [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);\n (0, import_react.useEffect)(function() {\n if (passThrough) return;\n if (!lazyMount) return;\n if (!present) return;\n (0, import_react.startTransition)(function() {\n setLazyMounted(present);\n });\n }, [\n lazyMount,\n present\n ]);\n var mounted = !present ? false : lazyMount ? lazyMounted : present;\n if (type === \"presence\") {\n if (props.keepChildrenMounted) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {\n isPresent: true,\n ...!passThrough && {\n initial: props.initial ? void 0 : false,\n onExitComplete: props.onExitComplete,\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout: false,\n isPresent: present,\n custom: props.custom\n },\n children\n });\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {\n passThrough,\n ...props,\n children: mounted || passThrough ? children : null\n });\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {\n children\n });\n}\n//# sourceMappingURL=Animate.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,kBAAkB,CAAC;AACvB,SAAS,iBAAiB,EACxB,eAAe,QACjB,CAAC;AACD,OAAO,UAAU,aAAa,eAAe;AAC7C,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,0BAA0B,QAAQ,2BAA2B;AACjE,IAAI,eAAe,QAAQ,OAAO;AAClC,SAAS,QAAQ,OAAO;CACtB,IAAI,EAAE,UAAU,WAAW,MAAM,SAAS,aAAa,GAAG,UAAU;CACpE,IAAI,CAAC,aAAa,mBAAmB,GAAG,aAAa,UAAU,YAAY,QAAQ,OAAO;CAC1F,CAAC,GAAG,aAAa,WAAW,WAAW;EACrC,IAAI,aAAa;EACjB,IAAI,CAAC,WAAW;EAChB,IAAI,CAAC,SAAS;EACd,CAAC,GAAG,aAAa,iBAAiB,WAAW;GAC3C,eAAe,OAAO;EACxB,CAAC;CACH,GAAG,CACD,WACA,OACF,CAAC;CACD,IAAI,UAAU,CAAC,UAAU,QAAQ,YAAY,cAAc;CAC3D,IAAI,SAAS,YAAY;EACvB,IAAI,MAAM,qBAAqB;GAC7B,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,wBAAwB,eAAe;IACxF,WAAW;IACX,GAAG,CAAC,eAAe;KACjB,SAAS,MAAM,UAAU,KAAK,IAAI;KAClC,gBAAgB,MAAM;KAGtB,uBAAuB;KACvB,WAAW;KACX,QAAQ,MAAM;IAChB;IACA;GACF,CAAC;EACH;EACA,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,wBAAwB,iBAAiB;GAC1F;GACA,GAAG;GACH,UAAU,WAAW,cAAc,WAAW;EAChD,CAAC;CACH;CACA,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,mBAAmB,UAAU,EAC9E,SACF,CAAC;AACH"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
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
|
-
__reExport(index_exports, require("./Animate.cjs"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./Animate.cjs"), module.exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./Animate.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
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("./Animate.native.js"), module.exports);
|
|
22
|
+
|
|
23
23
|
//# 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(\"./Animate\"), 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,qBAAW,GAAG,OAAO,OAAO"}
|
package/dist/esm/Animate.mjs
CHANGED
|
@@ -1,52 +1,40 @@
|
|
|
1
1
|
import { AnimatePresence, PresenceChild } from "@tamagui/animate-presence";
|
|
2
2
|
import { startTransition, useEffect, useState } from "react";
|
|
3
3
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}),
|
|
38
|
-
children
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return /* @__PURE__ */jsx(AnimatePresence, {
|
|
42
|
-
passThrough,
|
|
43
|
-
...props,
|
|
44
|
-
children: mounted || passThrough ? children : null
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */jsx(Fragment, {
|
|
48
|
-
children
|
|
49
|
-
});
|
|
4
|
+
|
|
5
|
+
function Animate({ children, lazyMount, type, present, passThrough, ...props }) {
|
|
6
|
+
const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (passThrough) return;
|
|
9
|
+
if (!lazyMount) return;
|
|
10
|
+
if (!present) return;
|
|
11
|
+
startTransition(() => {
|
|
12
|
+
setLazyMounted(present);
|
|
13
|
+
});
|
|
14
|
+
}, [lazyMount, present]);
|
|
15
|
+
const mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
16
|
+
if (type === "presence") {
|
|
17
|
+
if (props.keepChildrenMounted) {
|
|
18
|
+
return /* @__PURE__ */ jsx(PresenceChild, {
|
|
19
|
+
isPresent: true,
|
|
20
|
+
...!passThrough && {
|
|
21
|
+
initial: props.initial ? void 0 : false,
|
|
22
|
+
onExitComplete: props.onExitComplete,
|
|
23
|
+
presenceAffectsLayout: false,
|
|
24
|
+
isPresent: present,
|
|
25
|
+
custom: props.custom
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
31
|
+
passThrough,
|
|
32
|
+
...props,
|
|
33
|
+
children: mounted || passThrough ? children : null
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
50
37
|
}
|
|
38
|
+
|
|
51
39
|
export { Animate };
|
|
52
40
|
//# sourceMappingURL=Animate.mjs.map
|
package/dist/esm/Animate.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Animate.js","names":[],"sources":["esm/Animate.js"],"sourcesContent":["import { AnimatePresence, PresenceChild } from \"@tamagui/animate-presence\";\nimport { startTransition, useEffect, useState } from \"react\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nfunction Animate({\n children,\n lazyMount,\n type,\n present,\n passThrough,\n ...props\n}) {\n const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);\n useEffect(() => {\n if (passThrough) return;\n if (!lazyMount) return;\n if (!present) return;\n startTransition(() => {\n setLazyMounted(present);\n });\n }, [lazyMount, present]);\n const mounted = !present ? false : lazyMount ? lazyMounted : present;\n if (type === \"presence\") {\n if (props.keepChildrenMounted) {\n return /* @__PURE__ */ jsx(\n PresenceChild,\n {\n isPresent: true,\n ...!passThrough && {\n initial: props.initial ? void 0 : false,\n onExitComplete: props.onExitComplete,\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout: false,\n isPresent: present,\n custom: props.custom\n },\n children\n }\n );\n }\n return /* @__PURE__ */ jsx(AnimatePresence, { passThrough, ...props, children: mounted || passThrough ? children : null });\n }\n return /* @__PURE__ */ jsx(Fragment, { children });\n}\nexport {\n Animate\n};\n//# sourceMappingURL=Animate.js.map\n"],"mappings":";;;;;AAGA,SAAS,QAAQ,EACf,UACA,WACA,MACA,SACA,aACA,GAAG,SACF;CACD,MAAM,CAAC,aAAa,kBAAkB,SAAS,YAAY,QAAQ,OAAO;CAC1E,gBAAgB;EACd,IAAI,aAAa;EACjB,IAAI,CAAC,WAAW;EAChB,IAAI,CAAC,SAAS;EACd,sBAAsB;GACpB,eAAe,OAAO;EACxB,CAAC;CACH,GAAG,CAAC,WAAW,OAAO,CAAC;CACvB,MAAM,UAAU,CAAC,UAAU,QAAQ,YAAY,cAAc;CAC7D,IAAI,SAAS,YAAY;EACvB,IAAI,MAAM,qBAAqB;GAC7B,OAAuB,oBACrB,eACA;IACE,WAAW;IACX,GAAG,CAAC,eAAe;KACjB,SAAS,MAAM,UAAU,KAAK,IAAI;KAClC,gBAAgB,MAAM;KAGtB,uBAAuB;KACvB,WAAW;KACX,QAAQ,MAAM;IAChB;IACA;GACF,CACF;EACF;EACA,OAAuB,oBAAI,iBAAiB;GAAE;GAAa,GAAG;GAAO,UAAU,WAAW,cAAc,WAAW;EAAK,CAAC;CAC3H;CACA,OAAuB,oBAAI,UAAU,EAAE,SAAS,CAAC;AACnD"}
|
|
@@ -1,53 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AnimatePresence, PresenceChild } from "@tamagui/animate-presence";
|
|
3
3
|
import { startTransition, useEffect, useState } from "react";
|
|
4
|
+
|
|
4
5
|
function Animate(param) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
custom: props.custom
|
|
38
|
-
}),
|
|
39
|
-
children
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return /* @__PURE__ */_jsx(AnimatePresence, {
|
|
43
|
-
passThrough,
|
|
44
|
-
...props,
|
|
45
|
-
children: mounted || passThrough ? children : null
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return /* @__PURE__ */_jsx(_Fragment, {
|
|
49
|
-
children
|
|
50
|
-
});
|
|
6
|
+
var { children, lazyMount, type, present, passThrough, ...props } = param;
|
|
7
|
+
var [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
|
|
8
|
+
useEffect(function() {
|
|
9
|
+
if (passThrough) return;
|
|
10
|
+
if (!lazyMount) return;
|
|
11
|
+
if (!present) return;
|
|
12
|
+
startTransition(function() {
|
|
13
|
+
setLazyMounted(present);
|
|
14
|
+
});
|
|
15
|
+
}, [lazyMount, present]);
|
|
16
|
+
var mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
17
|
+
if (type === "presence") {
|
|
18
|
+
if (props.keepChildrenMounted) {
|
|
19
|
+
return /* @__PURE__ */ jsx(PresenceChild, {
|
|
20
|
+
isPresent: true,
|
|
21
|
+
...!passThrough && {
|
|
22
|
+
initial: props.initial ? void 0 : false,
|
|
23
|
+
onExitComplete: props.onExitComplete,
|
|
24
|
+
presenceAffectsLayout: false,
|
|
25
|
+
isPresent: present,
|
|
26
|
+
custom: props.custom
|
|
27
|
+
},
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
32
|
+
passThrough,
|
|
33
|
+
...props,
|
|
34
|
+
children: mounted || passThrough ? children : null
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
51
38
|
}
|
|
39
|
+
|
|
52
40
|
export { Animate };
|
|
53
41
|
//# sourceMappingURL=Animate.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"Animate.native.js","names":["_Fragment"],"sources":["esm/Animate.native.js"],"sourcesContent":["import { jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { AnimatePresence, PresenceChild } from \"@tamagui/animate-presence\";\nimport { startTransition, useEffect, useState } from \"react\";\nfunction Animate(param) {\n var { children, lazyMount, type, present, passThrough, ...props } = param;\n var [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);\n useEffect(function() {\n if (passThrough) return;\n if (!lazyMount) return;\n if (!present) return;\n startTransition(function() {\n setLazyMounted(present);\n });\n }, [\n lazyMount,\n present\n ]);\n var mounted = !present ? false : lazyMount ? lazyMounted : present;\n if (type === \"presence\") {\n if (props.keepChildrenMounted) {\n return /* @__PURE__ */ _jsx(PresenceChild, {\n isPresent: true,\n ...!passThrough && {\n initial: props.initial ? void 0 : false,\n onExitComplete: props.onExitComplete,\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout: false,\n isPresent: present,\n custom: props.custom\n },\n children\n });\n }\n return /* @__PURE__ */ _jsx(AnimatePresence, {\n passThrough,\n ...props,\n children: mounted || passThrough ? children : null\n });\n }\n return /* @__PURE__ */ _jsx(_Fragment, {\n children\n });\n}\nexport {\n Animate\n};\n//# sourceMappingURL=Animate.js.map\n"],"mappings":";;;;;AAGA,SAAS,QAAQ,OAAO;CACtB,IAAI,EAAE,UAAU,WAAW,MAAM,SAAS,aAAa,GAAG,UAAU;CACpE,IAAI,CAAC,aAAa,kBAAkB,SAAS,YAAY,QAAQ,OAAO;CACxE,UAAU,WAAW;EACnB,IAAI,aAAa;EACjB,IAAI,CAAC,WAAW;EAChB,IAAI,CAAC,SAAS;EACd,gBAAgB,WAAW;GACzB,eAAe,OAAO;EACxB,CAAC;CACH,GAAG,CACD,WACA,OACF,CAAC;CACD,IAAI,UAAU,CAAC,UAAU,QAAQ,YAAY,cAAc;CAC3D,IAAI,SAAS,YAAY;EACvB,IAAI,MAAM,qBAAqB;GAC7B,OAAuB,oBAAK,eAAe;IACzC,WAAW;IACX,GAAG,CAAC,eAAe;KACjB,SAAS,MAAM,UAAU,KAAK,IAAI;KAClC,gBAAgB,MAAM;KAGtB,uBAAuB;KACvB,WAAW;KACX,QAAQ,MAAM;IAChB;IACA;GACF,CAAC;EACH;EACA,OAAuB,oBAAK,iBAAiB;GAC3C;GACA,GAAG;GACH,UAAU,WAAW,cAAc,WAAW;EAChD,CAAC;CACH;CACA,OAAuB,oBAAKA,UAAW,EACrC,SACF,CAAC;AACH"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Animate.mjs"
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./Animate.mjs"
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Animate.mjs"
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from "./Animate.mjs"
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./Animate.native.js"
|
|
2
|
-
//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export * from "./Animate.native.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/animate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.637.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/animate-presence": "
|
|
38
|
+
"@tamagui/animate-presence": "3.0.0-beta.637.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "
|
|
41
|
+
"@tamagui/build": "3.0.0-beta.637.1",
|
|
42
42
|
"react": ">=19"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
package/src/Animate.tsx
CHANGED
|
@@ -65,9 +65,6 @@ export function Animate({
|
|
|
65
65
|
{...(!passThrough && {
|
|
66
66
|
initial: props.initial ? undefined : false,
|
|
67
67
|
onExitComplete: props.onExitComplete,
|
|
68
|
-
enterVariant: props.enterVariant,
|
|
69
|
-
exitVariant: props.exitVariant,
|
|
70
|
-
enterExitVariant: props.enterExitVariant,
|
|
71
68
|
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
72
69
|
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
73
70
|
presenceAffectsLayout: false,
|
package/types/Animate.d.ts.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import type { AnimatePresenceProps } from '@tamagui/animate-presence'\nimport { AnimatePresence, PresenceChild } from '@tamagui/animate-presence'\nimport { startTransition, useEffect, useState } from 'react'\n\ntype BaseProps = {\n children: React.ReactNode\n passThrough?: boolean\n}\n\ntype PresenceProps = AnimatePresenceProps & {\n type: 'presence'\n present: boolean\n keepChildrenMounted?: boolean\n lazyMount?: boolean\n}\n\nexport type AnimateProps = BaseProps & PresenceProps\n\n/**\n * Because mounting and unmounting children can be expensive, this gives us the\n * option to avoid that.\n *\n * type: 'presence' will act just like AnimatePresence, except you use `present`\n * instead of conditional children.\n * Note that this does avoid reconciling the children even when present={false}\n * so no extra cost to perf over AnimatePresence.\n *\n * type: 'presence' with keepChildrenMounted true *always* render the children so you pay\n * the cost up-front to mount them, but then you avoid the mount cost at the start\n * of the animation.\n *\n * There's no \"right way\" it just depends on the use case, this component just makes\n * it easier to choose the strategy yourself.\n *\n *\n */\n\nexport function Animate({\n children,\n lazyMount,\n type,\n present,\n passThrough,\n ...props\n}: AnimateProps): React.ReactNode {\n const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)\n\n useEffect(() => {\n if (passThrough) return\n if (!lazyMount) return\n if (!present) return\n startTransition(() => {\n setLazyMounted(present)\n })\n }, [lazyMount, present])\n\n // always immediately unmount\n const mounted = !present ? false : lazyMount ? lazyMounted : present\n\n if (type === 'presence') {\n if (props.keepChildrenMounted) {\n return (\n <PresenceChild\n isPresent\n {...(!passThrough && {\n initial: props.initial ? undefined : false,\n onExitComplete: props.onExitComplete,\n
|
|
9
|
+
"import type { AnimatePresenceProps } from '@tamagui/animate-presence'\nimport { AnimatePresence, PresenceChild } from '@tamagui/animate-presence'\nimport { startTransition, useEffect, useState } from 'react'\n\ntype BaseProps = {\n children: React.ReactNode\n passThrough?: boolean\n}\n\ntype PresenceProps = AnimatePresenceProps & {\n type: 'presence'\n present: boolean\n keepChildrenMounted?: boolean\n lazyMount?: boolean\n}\n\nexport type AnimateProps = BaseProps & PresenceProps\n\n/**\n * Because mounting and unmounting children can be expensive, this gives us the\n * option to avoid that.\n *\n * type: 'presence' will act just like AnimatePresence, except you use `present`\n * instead of conditional children.\n * Note that this does avoid reconciling the children even when present={false}\n * so no extra cost to perf over AnimatePresence.\n *\n * type: 'presence' with keepChildrenMounted true *always* render the children so you pay\n * the cost up-front to mount them, but then you avoid the mount cost at the start\n * of the animation.\n *\n * There's no \"right way\" it just depends on the use case, this component just makes\n * it easier to choose the strategy yourself.\n *\n *\n */\n\nexport function Animate({\n children,\n lazyMount,\n type,\n present,\n passThrough,\n ...props\n}: AnimateProps): React.ReactNode {\n const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)\n\n useEffect(() => {\n if (passThrough) return\n if (!lazyMount) return\n if (!present) return\n startTransition(() => {\n setLazyMounted(present)\n })\n }, [lazyMount, present])\n\n // always immediately unmount\n const mounted = !present ? false : lazyMount ? lazyMounted : present\n\n if (type === 'presence') {\n if (props.keepChildrenMounted) {\n return (\n <PresenceChild\n isPresent\n {...(!passThrough && {\n initial: props.initial ? undefined : false,\n onExitComplete: props.onExitComplete,\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout: false,\n isPresent: present,\n custom: props.custom,\n })}\n >\n {children as any}\n </PresenceChild>\n )\n }\n\n return (\n <AnimatePresence passThrough={passThrough} {...props}>\n {mounted || passThrough ? children : null}\n </AnimatePresence>\n )\n }\n\n return <>{children}</>\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|